| Current Path : /proc/self/root/proc/self/root/var/tmp/ |
| Current File : //proc/self/root/proc/self/root/var/tmp/phppDbBEl |
<?php
namespace Nextend\SmartSlider3Pro\Application;
use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Application\Admin\ApplicationTypeAdmin;
use Nextend\SmartSlider3\Application\ApplicationSmartSlider3;
use Nextend\SmartSlider3\Application\Frontend\ApplicationTypeFrontend;
use Nextend\SmartSlider3Pro\Application\Admin\PluggedApplicationTypeAdmin;
use Nextend\SmartSlider3Pro\Application\Frontend\PluggedApplicationTypeFrontend;
class PluggedApplicationSmartSlider3Pro {
/** @var ApplicationSmartSlider3 */
protected $application;
/**
* PluggedApplicationSmartSlider3Pro constructor.
*
* @param ApplicationSmartSlider3 $application
*/
public function __construct($application) {
$this->application = $application;
Plugin::addAction('PluggableApplicationType\Nextend\SmartSlider3\Application\Admin\ApplicationTypeAdmin', array(
$this,
'plugApplicationTypeAdmin'
));
Plugin::addAction('PluggableApplicationType\Nextend\SmartSlider3\Application\Frontend\ApplicationTypeFrontend', array(
$this,
'plugApplicationTypeFrontend'
));
}
/**
* @param ApplicationTypeAdmin $applicationTypeAdmin
*/
public function plugApplicationTypeAdmin($applicationTypeAdmin) {
new PluggedApplicationTypeAdmin($applicationTypeAdmin);
}
/**
* @param ApplicationTypeFrontend $applicationTypeFrontend
*/
public function plugApplicationTypeFrontend($applicationTypeFrontend) {
new PluggedApplicationTypeFrontend($applicationTypeFrontend);
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Frontend;
use Nextend\Framework\Pattern\GetAssetsPathTrait;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Application\Frontend\ApplicationTypeFrontend;
class PluggedApplicationTypeFrontend {
use GetAssetsPathTrait;
/** @var ApplicationTypeFrontend */
protected $applicationType;
public function __construct($applicationType) {
$this->applicationType = $applicationType;
ResourceTranslator::createResource('$ss3-pro-frontend$', self::getAssetsPath(), self::getAssetsUri());
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin;
use Nextend\Framework\Pattern\GetAssetsPathTrait;
use Nextend\Framework\Plugin;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Application\Admin\ApplicationTypeAdmin;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerAjaxSlider;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerSlider;
use Nextend\SmartSlider3\Application\Admin\Sliders\ControllerAjaxSliders;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\License\ControllerAjaxLicense;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\License\ControllerLicense;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\PluggedControllerAjaxSlider;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\PluggedControllerSlider;
use Nextend\SmartSlider3Pro\Application\Admin\Sliders\PluggedControllerAjaxSliders;
use Nextend\SmartSlider3Pro\Application\Admin\Visual\ControllerAjaxPostBackgroundAnimation;
use Nextend\SmartSlider3Pro\Application\Admin\Visual\ControllerAjaxSplitTextAnimation;
class PluggedApplicationTypeAdmin {
use GetAssetsPathTrait;
/** @var ApplicationTypeAdmin */
protected $applicationType;
/**
* PluggedApplicationTypeAdmin constructor.
*
* @param ApplicationTypeAdmin $applicationType
*/
public function __construct($applicationType) {
$this->applicationType = $applicationType;
ResourceTranslator::createResource('$ss3-pro-admin$', self::getAssetsPath(), self::getAssetsUri());
$applicationType->addExternalController('postbackgroundanimation', $this);
$applicationType->addExternalController('splittextanimation', $this);
$applicationType->addExternalController('license', $this);
Plugin::addAction('PluggableController\Nextend\SmartSlider3\Application\Admin\Sliders\ControllerAjaxSliders', array(
$this,
'plugControllerAjaxSliders'
));
Plugin::addAction('PluggableController\Nextend\SmartSlider3\Application\Admin\Slider\ControllerSlider', array(
$this,
'plugControllerSlider'
));
Plugin::addAction('PluggableController\Nextend\SmartSlider3\Application\Admin\Slider\ControllerAjaxSlider', array(
$this,
'plugControllerAjaxSlider'
));
}
public function getControllerAjaxPostBackgroundAnimation() {
return new ControllerAjaxPostBackgroundAnimation($this->applicationType);
}
public function getControllerAjaxSplitTextAnimation() {
return new ControllerAjaxSplitTextAnimation($this->applicationType);
}
public function getControllerLicense() {
return new ControllerLicense($this->applicationType);
}
public function getControllerAjaxLicense() {
return new ControllerAjaxLicense($this->applicationType);
}
/**
* @param ControllerAjaxSliders $controller
*/
public function plugControllerAjaxSliders($controller) {
new PluggedControllerAjaxSliders($controller);
}
/**
* @param ControllerSlider $controller
*/
public function plugControllerSlider($controller) {
new PluggedControllerSlider($controller);
}
/**
* @param ControllerAjaxSlider $controller
*/
public function plugControllerAjaxSlider($controller) {
new PluggedControllerAjaxSlider($controller);
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Visual;
use Nextend\Framework\Controller\Admin\AdminVisualManagerAjaxController;
use Nextend\SmartSlider3Pro\PostBackgroundAnimation\ModelPostBackgroundAnimation;
class ControllerAjaxPostBackgroundAnimation extends AdminVisualManagerAjaxController {
protected $type = 'postbackgroundanimation';
public function getModel() {
return new ModelPostBackgroundAnimation($this);
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Visual;
use Nextend\Framework\Controller\Admin\AdminVisualManagerAjaxController;
use Nextend\SmartSlider3Pro\SplitText\ModelSplitText;
class ControllerAjaxSplitTextAnimation extends AdminVisualManagerAjaxController {
protected $type = 'splittextanimation';
public function getModel() {
return new ModelSplitText($this);
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Sliders;
use Nextend\SmartSlider3\Application\Admin\Sliders\ControllerAjaxSliders;
use Nextend\SmartSlider3\Application\Model\ModelSliders;
class PluggedControllerAjaxSliders {
/** @var ControllerAjaxSliders */
protected $controller;
public function __construct($controller) {
$this->controller = $controller;
$this->controller->addExternalAction('listGroups', array(
$this,
'actionListGroups'
));
}
public function actionListGroups() {
$this->controller->validateToken();
$slidersModel = new ModelSliders($this->controller);
$result = $slidersModel->getGroups('published');
$data = array();
foreach ($result as $r) {
$data[$r['id']] = $r['title'];
}
$this->controller->getResponse()
->respond($data);
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerAjaxSlider;
use Nextend\SmartSlider3\Application\Admin\Slider\ViewAjaxSliderBox;
use Nextend\SmartSlider3\Application\Model\ModelSliders;
use Nextend\SmartSlider3\Application\Model\ModelSlidersXRef;
class PluggedControllerAjaxSlider {
/** @var ControllerAjaxSlider */
protected $controller;
public function __construct($controller) {
$this->controller = $controller;
$this->controller->addExternalAction('getGroupInfoBySliderID', array(
$this,
'getGroupInfoBySliderID'
));
$this->controller->addExternalAction('changeGroup', array(
$this,
'changeGroup'
));
$this->controller->addExternalAction('createGroup', array(
$this,
'actionCreateGroup'
));
$this->controller->addExternalAction('addToGroup', array(
$this,
'actionAddToGroup'
));
}
public function getGroupInfoBySliderID() {
$this->controller->validateToken();
$this->controller->validatePermission('smartslider_edit');
$sliderID = Request::$REQUEST->getInt('sliderID');
$this->controller->validateVariable($sliderID, 'slider');
$slidersModel = new ModelSliders($this->controller);
$xref = new ModelSlidersXRef($this->controller);
$this->controller->getResponse()
->respond(array(
'groups' => $slidersModel->getGroups('published'),
'linkedTo' => $xref->getGroupsIDs($sliderID)
));
}
public function changeGroup() {
$sliderID = Request::$REQUEST->getInt('sliderID');
$this->controller->validateVariable($sliderID, 'slider');
$toLink = array_map('intval', Request::$POST->getVar('toLink', array()));
$toDelete = array_map('intval', Request::$POST->getVar('toDelete', array()));
$xref = new ModelSlidersXRef($this->controller);
foreach ($toDelete as $groupID) {
$xref->deleteXref($groupID, $sliderID);
}
foreach ($toLink as $groupID) {
$xref->add($groupID, $sliderID);
}
$slidersModel = new ModelSliders($this->controller);
$slidersModel->reindexOrdering();
$this->controller->getResponse()
->respond();
}
public function actionCreateGroup() {
$this->controller->validateToken();
$this->controller->validatePermission('smartslider_edit');
$slidersModel = new ModelSliders($this->controller);
$title = Request::$REQUEST->getVar('title');
$this->controller->validateVariable(!empty($title), 'group name');
$slider = array(
'type' => 'group',
'title' => $title
);
$sliderid = $slidersModel->create($slider);
$this->controller->validateDatabase($slider);
$this->controller->redirect($this->controller->getUrlSliderEdit($sliderid));
}
public function actionAddToGroup() {
$this->controller->validateToken();
$this->controller->validatePermission('smartslider_edit');
$actionType = Request::$REQUEST->getCmd('actionType');
$this->controller->validateVariable($actionType, 'Action');
$currentGroupID = Request::$REQUEST->getInt('currentGroupID', 0);
$groupID = Request::$REQUEST->getInt('groupID');
$this->controller->validateVariable($groupID, 'group');
$sliders = Request::$REQUEST->getVar('sliders');
if (!is_array($sliders)) {
Notification::error(n2_('Missing sliders!'));
$this->controller->getResponse()
->error();
}
$slidersModel = new ModelSliders($this->controller);
$xref = new ModelSlidersXRef($this->controller);
foreach ($sliders as $sliderID) {
switch ($actionType) {
case 'copy':
$newSliderID = $slidersModel->duplicate($sliderID, false);
$xref->add($groupID, $newSliderID);
break;
case 'link':
$xref->add($groupID, $sliderID);
break;
default:
$xref->deleteXref($currentGroupID, $sliderID);
$xref->add($groupID, $sliderID);
break;
}
}
$this->controller->getResponse()
->respond();
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerSlider;
class PluggedControllerSlider {
/** @var ControllerSlider */
protected $controller;
public function __construct($controller) {
$this->controller = $controller;
$this->controller->addExternalAction('editGroup', array(
$this,
'actionEditGroup'
));
$this->controller->addExternalAction('shapedivider', array(
$this,
'actionShapeDivider'
));
$this->controller->addExternalAction('shapedividerpreview', array(
$this,
'actionShapeDividerPreview'
));
$this->controller->addExternalAction('particle', array(
$this,
'actionParticle'
));
}
/**
* @param array $slider
*/
public function actionEditGroup($slider = array()) {
if (empty($slider)) {
$this->controller->redirectToSliders();
}
$this->controller->loadSliderManager();
$view = new ViewSliderEditGroup($this->controller);
$view->setSlider($slider);
$view->display();
}
public function actionShapeDivider() {
if ($this->controller->validateToken() && $this->controller->validatePermission('smartslider_edit')) {
$view = new ViewSliderShapeDivider($this->controller);
$view->setSliderID($this->controller->getSliderID());
$view->display();
}
}
public function actionShapeDividerPreview() {
if ($this->controller->validateToken() && $this->controller->validatePermission('smartslider_edit')) {
$view = new ViewSliderShapeDividerPreview($this->controller);
$view->setSliderData(json_decode(Request::$POST->getVar('sliderData', '[]'), true));
$view->setSliderID($this->controller->getSliderID());
$view->display();
}
}
public function actionParticle() {
if ($this->controller->validateToken() && $this->controller->validatePermission('smartslider_edit')) {
$view = new ViewSliderParticle($this->controller);
$view->setSliderID($this->controller->getSliderID());
$view->display();
}
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Acl\Acl;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Hidden;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Fieldset\FieldsetRowPlain;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Header\BlockHeader;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\BlockTopBarMain;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButton;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonBack;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonPlainIcon;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonSave;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu\BlockFloatingMenu;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu\BlockFloatingMenuItem;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slider\SliderManager\BlockSliderManager;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Form\Element\PublishSlider;
class ViewSliderEditGroup extends AbstractView {
use TraitAdminUrl;
protected $groupID = 0;
protected $slider;
/**
* @var BlockHeader
*/
protected $blockHeader;
protected $formData = array();
/**
* @param array $slider
*/
public function setSlider($slider) {
$this->slider = $slider;
}
public function getSlider() {
return $this->slider;
}
public function display() {
$this->layout = new LayoutDefault($this);
$this->layout->addBreadcrumb(Sanitize::esc_html($this->slider['title']), 'ssi_16 ssi_16--folderclosed');
$topBar = new BlockTopBarMain($this);
$buttonSave = new BlockButtonSave($this);
$buttonSave->addClass('n2_button--inactive');
$buttonSave->addClass('n2_group_settings_save');
$topBar->addPrimaryBlock($buttonSave);
$buttonBack = new BlockButtonBack($this);
$buttonBack->setUrl($this->getUrlDashboard());
$buttonBack->addClass('n2_group_settings_back');
$topBar->addPrimaryBlock($buttonBack);
$buttonPreview = new BlockButtonPlainIcon($this);
$buttonPreview->addClass('n2_top_bar_button_icon');
$buttonPreview->addClass('n2_top_bar_main__preview');
$buttonPreview->setIcon('ssi_24 ssi_24--preview');
$buttonPreview->addAttribute('data-n2tip', n2_('Preview'));
$buttonPreview->setUrl($this->getUrlPreviewIndex($this->slider['id']));
$topBar->addPrimaryBlock($buttonPreview);
$this->displayHeader();
$this->layout->setTopBar($topBar->toHTML());
$this->layout->addContent($this->render('EditGroup'));
$this->layout->render();
}
protected function displayHeader() {
$this->blockHeader = new BlockHeader($this);
$this->blockHeader->setHeading($this->slider['title']);
$this->blockHeader->setHeadingAfter('ID: ' . $this->slider['id']);
$this->addHeaderActions();
$this->layout->addContentBlock($this->blockHeader);
}
private function addHeaderActions() {
$accessEdit = Acl::canDo('smartslider_edit', $this);
$accessDelete = Acl::canDo('smartslider_delete', $this);
if ($accessEdit || $accessDelete) {
$sliderid = $this->slider['id'];
$actionsMenu = new BlockFloatingMenu($this);
$actions = new BlockButton($this);
$actions->setBig();
$actions->setLabel(n2_('Actions'));
$actions->setIcon('ssi_16 ssi_16--buttonarrow');
$actionsMenu->setButton($actions);
if ($accessEdit) {
$item = new BlockFloatingMenuItem($this);
$item->setLabel(n2_('Clear cache'));
$item->setIcon('ssi_16 ssi_16--reset');
$item->setUrl($this->getUrlSliderClearCache($sliderid));
$actionsMenu->addMenuItem($item);
$item = new BlockFloatingMenuItem($this);
$item->setLabel(sprintf(n2_('Export %1$s as HTML'), n2_('Group')));
$item->setIcon('ssi_16 ssi_16--download');
$item->setUrl($this->getUrlSliderExportHtml($sliderid));
$actionsMenu->addMenuItem($item);
$item = new BlockFloatingMenuItem($this);
$item->setLabel(n2_('Export'));
$item->setIcon('ssi_16 ssi_16--download');
$item->setUrl($this->getUrlSliderExport($sliderid));
$actionsMenu->addMenuItem($item);
$item = new BlockFloatingMenuItem($this);
$item->setLabel(n2_('Duplicate'));
$item->setIcon('ssi_16 ssi_16--duplicate');
$item->setUrl($this->getUrlSliderDuplicate($sliderid, $this->groupID));
$actionsMenu->addMenuItem($item);
}
if ($accessDelete) {
$item = new BlockFloatingMenuItem($this);
$item->setRed();
$item->setLabel(n2_('Move to trash'));
$item->setIcon('ssi_16 ssi_16--delete');
$item->setUrl($this->getUrlSliderMoveToTrash($sliderid, $this->groupID));
$actionsMenu->addMenuItem($item);
}
$this->blockHeader->addAction($actionsMenu->toHTML());
}
}
public function renderSliderManager() {
$sliderManager = new BlockSliderManager($this->layout);
$sliderManager->setGroupID($this->slider['id']);
$sliderManager->display();
}
public function renderForm() {
$slider = $this->slider;
$data = json_decode($slider['params'], true);
if ($data == null) $data = array();
$data['title'] = $slider['title'];
$data['type'] = $slider['type'];
$data['thumbnail'] = $slider['thumbnail'];
$data['alias'] = isset($slider['alias']) ? $slider['alias'] : '';
$this->editGroupForm($data);
$this->formData = $data;
}
private function editGroupForm($data = array()) {
$form = new Form($this, 'slider');
$form->set('class', 'nextend-smart-slider-admin');
$form->loadArray($data);
$table = new ContainerTable($form->getContainer(), 'publish', n2_('Publish'));
$row = new FieldsetRowPlain($table, 'publish');
new PublishSlider($row);
$table = new ContainerTable($form->getContainer(), 'group', n2_('General'));
$row1 = $table->createRow('row-1');
new Text($row1, 'title', n2_('Name'), n2_('Group'), array(
'style' => 'width:400px;'
));
new Text($row1, 'alias', n2_('Alias'), '', array(
'style' => 'width:200px;'
));
new FieldImage($row1, 'thumbnail', n2_('Thumbnail'));
new Hidden($row1, 'type', 'group');
$form->render();
}
/**
* @return array
*/
public function getFormData() {
return $this->formData;
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Form;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonApply;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonCancel;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutIframe;
use Nextend\SmartSlider3Pro\Form\Element\ParticleSkin;
class ViewSliderParticle extends AbstractView {
/** @var integer */
protected $sliderID;
public function display() {
$this->layout = new LayoutIframe($this);
$this->layout->setLabel(n2_('Particle effect'));
$buttonCancel = new BlockButtonCancel($this);
$buttonCancel->addAttribute('id', 'n2-ss-form-cancel');
$buttonCancel->setBig();
$this->layout->addAction($buttonCancel);
$buttonSet = new BlockButtonApply($this);
$buttonSet->addAttribute('id', 'n2-ss-form-save');
$buttonSet->setBig();
$this->layout->addAction($buttonSet);
$this->layout->addContent($this->render('Particle'));
$this->layout->render();
}
/**
* @return integer
*/
public function getSliderID() {
return $this->sliderID;
}
/**
* @param integer $sliderID
*/
public function setSliderID($sliderID) {
$this->sliderID = $sliderID;
}
public function renderForm() {
$form = new Form($this, 'slider');
$table = new ContainerTable($form->getContainer(), 'particle', n2_('Particle effect'));
$settings = $table->createRow('row1');
new ParticleSkin($settings, 'preset', n2_('Effect'), 0, array(
'relatedValueFields' => array(
array(
'values' => array(
'link',
'polygons',
'bloom',
'web',
'blackwidow',
'zodiac',
'fading-dots',
'pirouette',
'sparkling',
'custom'
),
'field' => array(
'slidermobile'
)
),
array(
'values' => array(
'link',
'polygons',
'bloom',
'web',
'blackwidow',
'zodiac',
'fading-dots',
'pirouette',
'sparkling'
),
'field' => array(
'slidercustomization'
)
),
array(
'values' => array(
'custom'
),
'field' => array(
'slidercustom',
'table-row-row2'
)
)
)
));
$customization = new Grouping($settings, 'customization');
new Color($customization, 'color', n2_('Color'), 'FFFFFF80', array(
'alpha' => true
));
new Color($customization, 'line-color', n2_('Line color'), 'FFFFFF66', array(
'alpha' => true
));
new NumberSlider($customization, 'speed', n2_('Speed'), 2, array(
'style' => 'width:35px;',
'min' => 1,
'max' => 60
));
new NumberSlider($customization, 'number', n2_('Number of particles'), 28, array(
'style' => 'width:35px;',
'min' => 10,
'max' => 200
));
new Select($customization, 'hover', n2_('Hover'), 'off', array(
'options' => array(
'0' => n2_('Off'),
'grab' => n2_('Grab'),
'bubble' => n2_('Bubble'),
'repulse' => n2_('Repulse')
)
));
new Select($customization, 'click', n2_('Click'), 'off', array(
'options' => array(
'0' => n2_('Off'),
'repulse' => n2_('Repulse'),
'push' => n2_('Push'),
'remove' => n2_('Remove'),
'bubble' => n2_('Bubble')
)
));
new Textarea($settings, 'custom', n2_('Custom'), '', array(
'width' => 480,
'minHeight' => 200
));
new OnOff($settings, 'mobile', n2_('Hide on mobile'), 0, array(
'invert' => true
));
$notice = $table->createRow('row2');
new Notice($notice, 'instructions', 'Instructions', 'You can generate at <a target="_blank" href="http://vincentgarreau.com/particles.js/">http://vincentgarreau.com/particles.js/</a> Then <i>Download current config (json)</i> and paste content into the field.');
$form->render();
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Tab;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Form;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonApply;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonCancel;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slider\DeviceZoom\BlockDeviceZoom;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutIframe;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3Pro\Form\Element\Select\ShapeDividerSelect;
class ViewSliderShapeDivider extends AbstractView {
use TraitAdminUrl;
/** @var integer */
protected $sliderID;
public function display() {
$this->layout = new LayoutIframe($this);
$this->layout->setLabel(n2_('Shape divider'));
$deviceZoom = new BlockDeviceZoom($this);
$this->layout->addAction($deviceZoom);
$buttonCancel = new BlockButtonCancel($this);
$buttonCancel->addAttribute('id', 'n2-ss-form-cancel');
$buttonCancel->setBig();
$this->layout->addAction($buttonCancel);
$buttonSet = new BlockButtonApply($this);
$buttonSet->addAttribute('id', 'n2-ss-form-save');
$buttonSet->setBig();
$this->layout->addAction($buttonSet);
$this->layout->addContent($this->render('ShapeDivider'));
$this->layout->render();
}
/**
* @return integer
*/
public function getSliderID() {
return $this->sliderID;
}
/**
* @param integer $sliderID
*/
public function setSliderID($sliderID) {
$this->sliderID = $sliderID;
}
public function renderForm() {
$form = new Form($this, 'slider');
$table = new ContainerTable($form->getContainer(), 'shapedivider', n2_('Shape divider'));
$table->setFieldsetPositionEnd();
new Tab($table->getFieldsetLabel(), 'position', false, 'bottom', array(
'options' => array(
'top' => n2_('Top'),
'bottom' => n2_('Bottom')
),
'relatedValueFields' => array(
array(
'values' => array(
'top'
),
'field' => array(
'table-row-shapedivider-top'
)
),
array(
'values' => array(
'bottom'
),
'field' => array(
'table-row-shapedivider-bottom'
)
)
)
));
$top = $table->createRow('shapedivider-top');
new ShapeDividerSelect($top, 'shapedivider-top-type', n2_('Type'), '0', array(
'relatedFields' => array(
'slidershapedivider-top-group-container'
)
));
$groupingTopOptionsContainer = new Grouping($top, 'shapedivider-top-group-container');
new Color($groupingTopOptionsContainer, 'shapedivider-top-color', n2_('Color'), 'ffffffff', array(
'alpha' => true
));
new Color($groupingTopOptionsContainer, 'shapedivider-top-color2', n2_('Secondary'), 'FFFFFF80', array(
'alpha' => true
));
new NumberSlider($groupingTopOptionsContainer, 'shapedivider-top-width', n2_('Width'), 100, array(
'unit' => '%',
'style' => 'width:35px;',
'min' => 100,
'max' => 400,
'step' => 5,
'sliderMax' => 400,
'rowAttributes' => array(
'data-devicespecific' => ''
)
));
new NumberSlider($groupingTopOptionsContainer, 'shapedivider-top-height', n2_('Height'), 100, array(
'unit' => '%',
'style' => 'width:35px;',
'min' => 0,
'max' => 500,
'step' => 10,
'sliderMax' => 500,
'rowAttributes' => array(
'data-devicespecific' => ''
)
));
new OnOff($groupingTopOptionsContainer, 'shapedivider-top-flip', n2_('Flip'), 0);
new OnOff($groupingTopOptionsContainer, 'shapedivider-top-animate', n2_('Animate'), 0);
new NumberSlider($groupingTopOptionsContainer, 'shapedivider-top-speed', n2_('Speed'), 100, array(
'style' => 'width:35px;',
'unit' => '%',
'min' => 10,
'max' => 1000,
'step' => 1,
'sliderMax' => 100
));
new Select($groupingTopOptionsContainer, 'shapedivider-top-scroll', n2_('Scroll'), '0', array(
'options' => array(
'0' => n2_('None'),
'grow' => n2_('Grow'),
'shrink' => n2_('Shrink')
)
));
$bottom = $table->createRow('shapedivider-bottom');
new ShapeDividerSelect($bottom, 'shapedivider-bottom-type', n2_('Type'), '0', array(
'relatedFields' => array(
'slidershapedivider-bottom-group-container'
)
));
$groupingBottomOptionsContainer = new Grouping($bottom, 'shapedivider-bottom-group-container');
new Color($groupingBottomOptionsContainer, 'shapedivider-bottom-color', n2_('Color'), 'ffffffff', array(
'alpha' => true
));
new Color($groupingBottomOptionsContainer, 'shapedivider-bottom-color2', n2_('Secondary'), 'FFFFFF80', array(
'alpha' => true
));
new NumberSlider($groupingBottomOptionsContainer, 'shapedivider-bottom-width', n2_('Width'), 100, array(
'style' => 'width:35px;',
'unit' => '%',
'min' => 100,
'max' => 400,
'step' => 5,
'sliderMax' => 400,
'rowAttributes' => array(
'data-devicespecific' => ''
)
));
new NumberSlider($groupingBottomOptionsContainer, 'shapedivider-bottom-height', n2_('Height'), 100, array(
'style' => 'width:35px;',
'unit' => '%',
'min' => 0,
'max' => 500,
'step' => 10,
'rowAttributes' => array(
'data-devicespecific' => ''
)
));
new OnOff($groupingBottomOptionsContainer, 'shapedivider-bottom-flip', n2_('Flip'), 0);
new OnOff($groupingBottomOptionsContainer, 'shapedivider-bottom-animate', n2_('Animate'), 0);
new NumberSlider($groupingBottomOptionsContainer, 'shapedivider-bottom-speed', n2_('Speed'), 100, array(
'style' => 'width:35px;',
'unit' => '%',
'min' => 10,
'max' => 1000,
'step' => 1,
'sliderMax' => 100
));
new Select($groupingBottomOptionsContainer, 'shapedivider-bottom-scroll', n2_('Scroll'), '0', array(
'options' => array(
'0' => n2_('None'),
'grow' => n2_('Grow'),
'shrink' => n2_('Shrink')
)
));
$form->render();
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutEmpty;
use Nextend\SmartSlider3\SliderManager\SliderManager;
class ViewSliderShapeDividerPreview extends AbstractView {
/** @var integer */
protected $sliderID;
/** @var array */
protected $sliderData;
public function display() {
$this->layout = new LayoutEmpty($this);
$this->layout->addContent($this->render('ShapeDividerPreview'));
$this->layout->render();
}
/**
* @return int
*/
public function getSliderID() {
return $this->sliderID;
}
/**
* @param int $sliderID
*/
public function setSliderID($sliderID) {
$this->sliderID = $sliderID;
}
/**
* @return array
*/
public function getSliderData() {
return $this->sliderData;
}
/**
* @param array $sliderData
*/
public function setSliderData($sliderData) {
$this->sliderData = $sliderData;
}
/**
* @return string contains escaped html data
*/
public function renderSlider() {
$locale = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, "C");
$sliderManager = new SliderManager($this, $this->sliderID, true, array(
'sliderData' => $this->getSliderData()
));
$sliderManager->allowDisplayWhenEmpty();
$sliderHTML = $sliderManager->render();
setlocale(LC_NUMERIC, $locale);
return $sliderHTML;
}
}<?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Asset\Js\Js;
use Nextend\SmartSlider3\Settings;
/**
* @var $this ViewSliderEditGroup
*/
$slider = $this->getSlider();
JS::addInline('new _N2.GroupEdit(' . json_encode(array(
'previewInNewWindow' => !!Settings::get('preview-new-window', 0),
'saveAjaxUrl' => $this->getAjaxUrlSliderEdit($slider['id']),
'previewUrl' => $this->getUrlPreviewSlider($slider['id']),
'ajaxUrl' => $this->getAjaxUrlSliderEdit($slider['id']),
'formData' => $this->getFormData()
)) . ');');
?>
<div class="n2-ss-sliders-outer-container">
<?php
$this->renderSliderManager();
?>
</div>
<form id="n2-ss-edit-group-form" action="#" method="post">
<?php
$this->renderForm();
?>
</form><?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Request\Request;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Settings;
use Nextend\SmartSlider3\Slider\Slider;
/**
* @var $this ViewSliderParticle
*/
JS::addGlobalInline('document.documentElement.classList.add("n2_html--application-only");');
$postedSliderData = (array)Request::$POST->getVar('slider', false);
$postedSliderData['desktop'] = 1; // Shape divider does not work if slider is not visible.
$postedSliderData['playWhenVisible'] = 0;
$frontendSlider = new Slider($this, $this->getSliderID(), array(
'disableResponsive' => true,
'sliderData' => $postedSliderData
), true);
$frontendSlider->initAll();
$sliderHTML = $frontendSlider->render();
$externals = esc_attr(Settings::get('external-css-files'));
if (!empty($externals)) {
$externals = explode("\n", $externals);
foreach ($externals as $external) {
echo "<link rel='stylesheet' href='" . esc_url($external) . "' type='text/css' media='all'>";
}
}
Js::addStaticGroup(ResourceTranslator::toPath('$ss3-pro-frontend$/dist/particle.min.js'), 'particles');
$folder = ResourceTranslator::toPath('$ss3-pro-frontend$/js/particle/presets/');
$files = Filesystem::files($folder);
$extension = 'json';
$types = array();
for ($i = 0; $i < count($files); $i++) {
$pathInfo = pathinfo($files[$i]);
if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
$types[$pathInfo['filename']] = file_get_contents($folder . $files[$i]);
}
}
Js::addFirstCode("
new _N2.ParticleAdminManager(" . $this->getSliderID() . ", " . json_encode($types) . ");
");
$this->renderForm();
?>
<div class="n2_slider_preview_area">
<div class="n2_slider_preview_area__inner" style="width:100%;max-width:<?php echo esc_attr($frontendSlider->features->responsive->sizes['desktopPortrait']['width']); ?>px;">
<?php
// PHPCS - Content already escaped
echo $sliderHTML; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</div>
</div><?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Asset\Js\Js;
use Nextend\SmartSlider3\Settings;
/**
* @var $this ViewSliderShapeDividerPreview
*/
JS::addGlobalInline('document.documentElement.classList.add("n2_html--application-only");');
JS::addGlobalInline('document.documentElement.classList.add("n2_html--slider-preview");');
$slider = $this->renderSlider();
$externals = esc_attr(Settings::get('external-css-files'));
if (!empty($externals)) {
$externals = explode("\n", $externals);
foreach ($externals as $external) {
echo "<link rel='stylesheet' href='" . esc_attr($external) . "' type='text/css' media='all'>";
}
}
// PHPCS - Content already escaped
echo $slider; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<script>
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape') {
parent.postMessage(JSON.stringify({action: 'cancel'}), "*");
}
});
</script><?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Request\Request;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
/**
* @var $this ViewSliderShapeDivider
*/
JS::addGlobalInline('document.documentElement.classList.add("n2_html--application-only");');
$postedSliderData = (array)Request::$POST->getVar('slider', false);
$postedSliderData['playWhenVisible'] = 0;
/**
* Shape divider admin editor does not work if slider is not visible.
*/
$postedSliderData['desktopportrait'] = 1;
$postedSliderData['desktoplandscape'] = 1;
$postedSliderData['tabletportrait'] = 1;
$postedSliderData['tabletlandscape'] = 1;
$postedSliderData['mobileportrait'] = 1;
$postedSliderData['mobilelandscape'] = 1;
$folder = ResourceTranslator::toPath('$ss3-pro-frontend$/shapedivider/');
$files = Filesystem::files($folder);
$extension = 'svg';
$types = array();
for ($i = 0; $i < count($files); $i++) {
$pathInfo = pathinfo($files[$i]);
if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
$types['simple-' . $pathInfo['filename']] = file_get_contents($folder . $files[$i]);
}
}
$folder .= 'bicolor/';
$files = Filesystem::files($folder);
for ($i = 0; $i < count($files); $i++) {
$pathInfo = pathinfo($files[$i]);
if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
$types['bi-' . $pathInfo['filename']] = file_get_contents($folder . $files[$i]);
}
}
Js::addFirstCode("
new _N2.ShapeDividerAdminManager(" . $this->getSliderID() . ", " . json_encode($types) . ");
");
$this->renderForm();
?>
<div class="n2_slider_preview_area" style="min-height:0;">
<div class="n2_slider_preview_area__inner">
<form id="n2_shape_divider__frame_form" target="n2_shape_divider__frame" action="<?php echo esc_url($this->MVCHelper->createUrl(array(
'slider/shapedividerpreview',
array(
'sliderid' => $this->getSliderID()
)
), true)); ?>" method="post" class="n2_form_element--hidden">
<input type="hidden" name="sliderData" value="<?php echo esc_attr(json_encode($postedSliderData)); ?>">
</form>
<iframe name="n2_shape_divider__frame" id="n2_shape_divider__frame" style="width:100%;height: calc(100vh - 100px);"></iframe>
</div>
</div><?php
namespace Nextend\SmartSlider3Pro\Application\Admin\Slider\License;
use Nextend\Framework\Controller\Admin\AdminAjaxController;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Application\Model\ModelLicense;
use Nextend\SmartSlider3\SmartSlider3Info;
class ControllerAjaxLicense extends AdminAjaxController {
use TraitAdminUrl;
public function actionAdd() {
$this->validateToken();
$this->validatePermission('smartslider_edit');
$licenseKey = Request::$REQUEST->getVar('licenseKey');
if (empty($licenseKey)) {
Notification::error(n2_('License key cannot be empty!'));
$this->response->error();
}
$status = ModelLicense::getInstance()
->checkKey($licenseKey, 'licenseadd');
$hasError = SmartSlider3Info::hasApiError($status);
if ($hasError == 'dashboard') {
$this->response->redirect($this->getUrlDashboard());
} else if ($hasError !== false) {
$this->response->error();
}
ModelLicense::getInstance()
->setKey($licenseKey);
$this->response->respond(array(
'valid' => true
));
}
public function actionCheck() {
$this->validateToken();
$showErrors = Request::$REQUEST->getInt('showErrors', 1);
$status = ModelLicense::getInstance()
->isActive(Request::$REQUEST->getInt('cacheAccepted', 1));
if ($showErrors) {
$hasError = SmartSlider3Info::hasApiError($status);
if ($hasError == 'dashboard') {
$this->response->redirect($this->getUrlDashboard());
} else if ($hasError !== false) {
$this->response->error();
}
Notification::notice(n2_('License key is active!'));
$this->response->respond();
}
if ($status == 'OK') {
$this->response->respond();
}
$this->response->error();
}
}