This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -0,0 +1,75 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Controller\Admin\AbstractAdminController;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Model\ModelSlidersXRef;
use Nextend\SmartSlider3\SmartSlider3Info;
abstract class AbstractControllerAdmin extends AbstractAdminController {
use TraitAdminUrl;
public function initialize() {
parent::initialize();
Js::addFirstCode('window.ss2lang = {};');
require_once dirname(__FILE__) . '/JavaScriptTranslation.php';
}
public function loadSliderManager() {
$groupID = Request::$REQUEST->getInt('sliderid', 0);
$storage = StorageSectionManager::getStorage('smartslider');
$options = array(
'userEmail' => Platform::getUserEmail(),
'skipNewsletter' => intval($storage->get('free', 'subscribeOnImport')) || intval($storage->get('free', 'dismissNewsletterSampleSliders')),
'exportAllUrl' => $this->getUrlDashboardExportAll($groupID),
'ajaxUrl' => $this->getAjaxUrlSlidesCreate(),
'previewUrl' => $this->getUrlPreviewIndex(0),
'importUrl' => $this->getUrlImport($groupID),
'paginationUrl' => $this->getUrlPaginator()
);
Js::addInline("new _N2.ManageSliders('" . $groupID . "', " . json_encode($options) . ", " . json_encode(SmartSlider3Info::shouldSkipLicenseModal()) . ");");
}
public function redirectToSliders() {
$this->redirect($this->getUrlDashboard());
}
/**
* @param int $sliderID
*
* @return bool
*/
protected function getGroupData($sliderID) {
$groupID = Request::$REQUEST->getInt('groupID');
$xref = new ModelSlidersXRef($this);
$groups = $xref->getGroups($sliderID, 'published');
$currentGroup = false;
foreach ($groups as $group) {
if ($group['group_id'] == $groupID) {
$currentGroup = $group;
break;
}
}
if ($currentGroup === false) {
$currentGroup = $groups[0];
}
return $currentGroup;
}
}

View File

@ -0,0 +1,202 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin;
use Exception;
use Nextend\Framework\Application\AbstractApplicationType;
use Nextend\Framework\Asset\Css\Css;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Browse\ControllerAjaxBrowse;
use Nextend\Framework\Content\ControllerAjaxContent;
use Nextend\Framework\Font\ControllerAjaxFont;
use Nextend\Framework\Image\ControllerAjaxImage;
use Nextend\Framework\Image\Image;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Router\Router;
use Nextend\Framework\Style\ControllerAjaxStyle;
use Nextend\SmartSlider3\Application\Admin\Generator\ControllerAjaxGenerator;
use Nextend\SmartSlider3\Application\Admin\Generator\ControllerGenerator;
use Nextend\SmartSlider3\Application\Admin\GoPro\ControllerGoPro;
use Nextend\SmartSlider3\Application\Admin\Help\ControllerHelp;
use Nextend\SmartSlider3\Application\Admin\Layout\AbstractLayoutMenu;
use Nextend\SmartSlider3\Application\Admin\Preview\ControllerPreview;
use Nextend\SmartSlider3\Application\Admin\Settings\ControllerAjaxSettings;
use Nextend\SmartSlider3\Application\Admin\Settings\ControllerSettings;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerAjaxSlider;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerSlider;
use Nextend\SmartSlider3\Application\Admin\Sliders\ControllerAjaxSliders;
use Nextend\SmartSlider3\Application\Admin\Sliders\ControllerSliders;
use Nextend\SmartSlider3\Application\Admin\Slides\ControllerAjaxSlides;
use Nextend\SmartSlider3\Application\Admin\Slides\ControllerSlides;
use Nextend\SmartSlider3\Application\Admin\Update\ControllerUpdate;
use Nextend\SmartSlider3\Application\Admin\Visuals\ControllerAjaxCss;
use Nextend\SmartSlider3\BackgroundAnimation\ControllerAjaxBackgroundAnimation;
use Nextend\SmartSlider3\Platform\Joomla\JoomlaShim;
use Nextend\SmartSlider3\Platform\SmartSlider3Platform;
use Nextend\SmartSlider3\SmartSlider3Info;
class ApplicationTypeAdmin extends AbstractApplicationType {
use TraitAdminUrl;
protected $key = 'admin';
protected function createRouter() {
$this->router = new Router(SmartSlider3Platform::getAdminUrl(), SmartSlider3Platform::getAdminAjaxUrl(), SmartSlider3Platform::getNetworkAdminUrl());
}
public function setLayout($layout) {
parent::setLayout($layout);
if ($this->layout instanceof AbstractLayoutMenu) {
$this->layout->addBreadcrumb(n2_('Dashboard'), 'ssi_16 ssi_16--dashboard', $this->getUrlDashboard());
}
Js::addGlobalInline("window.N2SS3VERSION='" . SmartSlider3Info::$version . "';");
}
protected function getControllerSliders() {
return new ControllerSliders($this);
}
protected function getControllerAjaxSliders() {
return new ControllerAjaxSliders($this);
}
protected function getControllerSlider() {
return new ControllerSlider($this);
}
protected function getControllerAjaxSlider() {
return new ControllerAjaxSlider($this);
}
protected function getControllerSlides() {
return new ControllerSlides($this);
}
protected function getControllerAjaxSlides() {
return new ControllerAjaxSlides($this);
}
protected function getControllerGenerator() {
return new ControllerGenerator($this);
}
protected function getControllerAjaxGenerator() {
return new ControllerAjaxGenerator($this);
}
protected function getControllerPreview() {
return new ControllerPreview($this);
}
protected function getControllerSettings() {
return new ControllerSettings($this);
}
protected function getControllerAjaxSettings() {
return new ControllerAjaxSettings($this);
}
protected function getControllerHelp() {
return new ControllerHelp($this);
}
protected function getControllerGoPro() {
return new ControllerGoPro($this);
}
protected function getControllerAjaxBackgroundAnimation() {
return new ControllerAjaxBackgroundAnimation($this);
}
protected function getControllerAjaxFont() {
return new ControllerAjaxFont($this);
}
protected function getControllerAjaxStyle() {
return new ControllerAjaxStyle($this);
}
protected function getControllerAjaxCss() {
return new ControllerAjaxCss($this);
}
protected function getControllerAjaxImage() {
return new ControllerAjaxImage($this);
}
protected function getControllerAjaxContent() {
return new ControllerAjaxContent($this);
}
protected function getControllerUpdate() {
return new ControllerUpdate($this);
}
protected function getControllerAjaxBrowse() {
return new ControllerAjaxBrowse($this);
}
protected function getDefaultController($controllerName, $ajax = false) {
if ($controllerName !== 'sliders') {
return $this->getControllerSliders();
}
throw new Exception('Missing default controller for application type.');
}
public function enqueueAssets() {
Js::addInline('_N2.AjaxHelper.addAdminUrl(' . json_encode($this->getKey()) . ', ' . json_encode($this->createAjaxUrl('/')) . ');');
JS::addInline('_N2.BrowserCompatibility(' . json_encode($this->getUrlHelpBrowserIncompatible()) . ');');
parent::enqueueAssets();
if (Platform::isAdmin()) {
Js::addGlobalInline('window.N2SS3C="' . SmartSlider3Info::$campaign . '";');
}
Image::enqueueHelper();
static $once;
if ($once != null) {
return;
}
$once = true;
$path = self::getAssetsPath();
Css::addStaticGroup($path . '/dist/smartslider-admin.min.css', 'smartslider-admin');
Js::addStaticGroup($path . '/dist/smartslider-backend.min.js', 'smartslider-backend');
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager;
use Nextend\Framework\Form\AbstractFormManager;
use Nextend\Framework\Form\Element\Hidden;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Pattern\MVCHelperTrait;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Slider\Slider;
class FormManagerSlide extends AbstractFormManager {
use TraitAdminUrl;
protected $data;
/**
* @var int
*/
protected $groupID;
/** @var Slider */
private $slider;
private $slide;
/**
* @var Form
*/
protected $form;
/**
* FormManagerSlide constructor.
*
* @param MVCHelperTrait $MVCHelper
* @param int $groupID
* @param Slider $slider
* @param $slide
*/
public function __construct($MVCHelper, $groupID, $slider, $slide) {
$this->groupID = $groupID;
$this->slider = $slider;
$this->slide = $slide;
parent::__construct($MVCHelper);
$params = json_decode($slide['params'], true);
if ($params == null) $params = array();
$params += $slide;
$params['sliderid'] = $slide['slider'];
$params['generator_id'] = $slide['generator_id'];
$params['first'] = isset($slide['first']) ? $slide['first'] : 0;
$this->data = $params;
$this->initForm();
}
public function render() {
$this->form->render();
}
private function initForm() {
$this->form = new Form($this, 'slide');
if (!empty($this->data['guides'])) {
$this->form->set('guides', $this->data['guides']);
}
$hidden = $this->form->getFieldsetHidden();
new Hidden($hidden, 'slide', '');
new Hidden($hidden, 'guides', '');
}
}

View File

@ -0,0 +1,166 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Font\FontManager;
use Nextend\Framework\Form\AbstractFormManager;
use Nextend\Framework\Form\Element\Hidden;
use Nextend\Framework\Form\FormTabbed;
use Nextend\Framework\Pattern\MVCHelperTrait;
use Nextend\Framework\Style\StyleManager;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderAnimations;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderAutoplay;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderControls;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderDeveloper;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderGeneral;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderOptimize;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderSize;
use Nextend\SmartSlider3\Application\Admin\FormManager\Slider\SliderSlides;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Header\BlockHeader;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\BackgroundAnimation\BackgroundAnimationManager;
use Nextend\SmartSlider3\Slider\SliderParams;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeAdmin;
use Nextend\SmartSlider3\Slider\SliderType\SliderTypeFactory;
use Nextend\SmartSlider3Pro\PostBackgroundAnimation\PostBackgroundAnimationManager;
class FormManagerSlider extends AbstractFormManager {
use TraitAdminUrl;
protected $slider;
protected $data;
/**
* @var FormTabbed
*/
protected $form;
/**
* @var AbstractSliderTypeAdmin
*/
protected $sliderType;
/**
* FormManagerSlider constructor.
*
* @param MVCHelperTrait $MVCHelper
* @param $slider
*/
public function __construct($MVCHelper, $slider) {
parent::__construct($MVCHelper);
$this->slider = $slider;
$sliderParams = new SliderParams($slider['id'], $slider['type'], $slider['params'], true);
$data = $sliderParams->toArray();
$data['title'] = $slider['title'];
$data['type'] = $slider['type'];
$data['thumbnail'] = $slider['thumbnail'];
$data['alias'] = isset($slider['alias']) ? $slider['alias'] : '';
$this->data = $data;
$this->initForm();
}
public function render() {
$this->form->render();
}
/**
* @return array|mixed|object
*/
public function getData() {
return $this->data;
}
/**
* @param BlockHeader $blockHeader
*/
public function addTabsToHeader($blockHeader) {
$this->form->addTabsToHeader($blockHeader);
}
/**
* @return AbstractSliderTypeAdmin
*/
public function getSliderType() {
return $this->sliderType;
}
private function initForm() {
FontManager::enqueue($this);
StyleManager::enqueue($this);
// Background animations are required for simple type. We need to load the lightbox, because it is not working over AJAX slider type change.
BackgroundAnimationManager::enqueue($this);
$this->form = new FormTabbed($this, 'slider');
$this->form->setSessionID('slider-' . $this->slider['id']);
$this->form->set('sliderID', $this->slider['id']);
$this->form->set('class', 'nextend-smart-slider-admin');
$this->form->loadArray($this->data);
$this->initSliderType();
new SliderGeneral($this, $this->form);
new SliderSize($this->form);
new SliderControls($this->form);
new SliderAnimations($this->form);
new SliderAutoplay($this->form);
new SliderOptimize($this->form);
new SliderSlides($this->form);
new SliderDeveloper($this->form);
$this->sliderType->prepareForm($this->form);
}
private function initSliderType() {
new Hidden($this->form->getFieldsetHidden(), 'type', 'simple');
$availableTypes = SliderTypeFactory::getAdminTypes();
$sliderType = $this->form->get('type', 'simple');
if (!isset($availableTypes[$sliderType])) {
$sliderType = 'simple';
}
$this->sliderType = $availableTypes[$sliderType];
$types = array();
foreach ($availableTypes as $type) {
if (!$type->isDepreciated() || $type->getName() == $sliderType) {
$types[$type->getName()] = array(
'icon' => $type->getIcon(),
'label' => $type->getLabel()
);
}
}
JS::addInline('new _N2.SliderChangeType(' . json_encode(array(
'types' => $types,
'currentType' => $sliderType,
'ajaxUrl' => $this->form->createAjaxUrl(array(
"slider/changeSliderType",
array(
'sliderID' => $this->form->get('sliderID')
)
))
)) . ');');
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerTab;
use Nextend\Framework\Form\FormTabbed;
abstract class AbstractSliderTab {
/**
* @var FormTabbed
*/
protected $form;
/**
* @var ContainerTab
*/
protected $tab;
/**
* AbstractSliderTab constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
$this->form = $form;
$this->tab = $form->createTab($this->getName(), $this->getLabel());
}
/**
* @return string
*/
abstract protected function getName();
/**
* @return string
*/
abstract protected function getLabel();
}

View File

@ -0,0 +1,64 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\FormTabbed;
use Nextend\SmartSlider3Pro\Form\Element\Particle;
use Nextend\SmartSlider3Pro\Form\Element\ShapeDivider;
class SliderAnimations extends AbstractSliderTab {
/**
* SliderAnimations constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
parent::__construct($form);
$this->effects();
}
/**
* @return string
*/
protected function getName() {
return 'animations';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('Animations');
}
protected function effects() {
/**
* Used for field injection: /animations/effects
* Used for field removal: /animations/effects
*/
$table = new ContainerTable($this->tab, 'effects', n2_('Effects'));
/**
* Used for field injection: /animations/effects/effects-row1
*/
$row = $table->createRow('effects-row1');
}
protected function layerAnimations() {
/**
* Used for field removal: /animations/layer-animations
*/
}
protected function layerParallax() {
}
}

View File

@ -0,0 +1,94 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\FormTabbed;
use Nextend\SmartSlider3\Widget\WidgetGroupFactory;
use Nextend\SmartSlider3Pro\Form\Element\AutoplayPicker;
class SliderAutoplay extends AbstractSliderTab {
/**
* SliderAutoplay constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
parent::__construct($form);
$this->autoplay();
$plugins = WidgetGroupFactory::getGroups();
if (isset($plugins['autoplay'])) {
$plugins['autoplay']->renderFields($this->tab);
}
if (isset($plugins['indicator'])) {
$plugins['indicator']->renderFields($this->tab);
}
}
/**
* @return string
*/
protected function getName() {
return 'autoplay';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('Autoplay');
}
protected function autoplay() {
$table = new ContainerTable($this->tab, 'autoplay', n2_('Autoplay'));
new OnOff($table->getFieldsetLabel(), 'autoplay', n2_('Enable'), 0, array(
'relatedAttribute' => 'autoplay',
'relatedFieldsOn' => array(
'table-rows-autoplay',
'table-widget-autoplay',
'table-widget-indicator',
'autoplay-single-slide-notice'
)
));
$row2 = $table->createRow('row-2');
new Number($row2, 'autoplayDuration', n2_('Slide duration'), 8000, array(
'wide' => 5,
'unit' => 'ms'
));
$row3 = $table->createRow('row-3');
new OnOff($row3, 'autoplayStopClick', n2_('Stop on click'), 1);
new Select($row3, 'autoplayStopMouse', n2_('Stop on mouse'), 0, array(
'options' => array(
'0' => n2_('Off'),
'enter' => n2_('Enter'),
'leave' => n2_('Leave')
)
));
new OnOff($row3, 'autoplayStopMedia', n2_('Stop on media'), 1);
$row4 = $table->createRow('row-4');
new OnOff($row4, 'autoplayResumeClick', n2_('Resume on click'), 0);
new Select($row4, 'autoplayResumeMouse', n2_('Resume on mouse'), 0, array(
'options' => array(
'0' => n2_('Off'),
'leave' => n2_('Leave'),
'enter' => n2_('Enter')
)
));
new OnOff($row4, 'autoplayResumeMedia', n2_('Resume on media'), 1);
}
}

View File

@ -0,0 +1,91 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\FormTabbed;
use Nextend\Framework\Pattern\OrderableTrait;
use Nextend\SmartSlider3\Widget\WidgetGroupFactory;
class SliderControls extends AbstractSliderTab {
use OrderableTrait;
/**
* SliderControls constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
parent::__construct($form);
$this->general();
$this->controls();
}
/**
* @return string
*/
protected function getName() {
return 'controls';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('Controls');
}
protected function general() {
/**
* Used for field removal: /controls/general
*/
$table = new ContainerTable($this->tab, 'general', n2_('General'));
$row1 = $table->createRow('general-1');
new Select($row1, 'controlsTouch', n2_('Drag'), 'horizontal', array(
'options' => array(
'0' => n2_('Disabled'),
'horizontal' => n2_('Horizontal'),
'vertical' => n2_('Vertical')
),
'tipLabel' => n2_('Drag'),
'tipDescription' => n2_('Defines the drag (and touch) direction for your slider.')
));
new Select($row1, 'controlsScroll', n2_('Mouse wheel'), '0', array(
'options' => array(
'0' => n2_('Disabled'),
'1' => n2_('Vertical'),
'2' => n2_('Horizontal')
),
'tipLabel' => n2_('Mouse wheel'),
'tipDescription' => n2_('Allows switching slides with the mouse wheel.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1778-slider-settings-controls#mouse-wheel'
));
new OnOff($row1, 'controlsKeyboard', n2_('Keyboard'), 1, array(
'tipLabel' => n2_('Keyboard'),
'tipDescription' => n2_('Allows switching slides with the keyboard.')
));
}
protected function controls() {
$plugins = WidgetGroupFactory::getGroups();
self::uasort($plugins);
unset($plugins['autoplay']);
unset($plugins['indicator']);
foreach ($plugins as $name => $widgetGroup) {
$widgetGroup->renderFields($this->tab);
}
}
}

View File

@ -0,0 +1,142 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\FormTabbed;
class SliderDeveloper extends AbstractSliderTab {
/**
* SliderDeveloper constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
parent::__construct($form);
$this->developer();
}
/**
* @return string
*/
protected function getName() {
return 'developer';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('Developer');
}
protected function developer() {
$table = new ContainerTable($this->tab, 'developer', n2_('Developer'));
$row1 = $table->createRow('developer-1');
/**
* Used for field removal: /developer/developer/developer-1/controlsBlockCarouselInteraction
*/
new OnOff($row1, 'controlsBlockCarouselInteraction', n2_('Block carousel'), 1, array(
'tipLabel' => n2_('Block carousel'),
'tipDescription' => n2_('Stops the carousel at the last slide when the source of interaction is vertical touch, vertical pointer, mouse wheel or vertical keyboard.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1806-slider-settings-developer#block-carousel'
));
new OnOff($row1, 'clear-both', n2_('Clear before'), 1, array(
'tipLabel' => n2_('Clear before'),
'tipDescription' => n2_('Closes the unclosed float CSS codes before the slider.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1806-slider-settings-developer#clear-before'
));
new OnOff($row1, 'clear-both-after', n2_('Clear after'), 1, array(
'tipLabel' => n2_('Clear after'),
'tipDescription' => n2_('Allows you to put your slider next to your text.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1806-slider-settings-developer#clear-after'
));
$rowHideScrollbar = $table->createRow('developer-hide-scrollbar');
new OnOff($rowHideScrollbar, 'overflow-hidden-page', n2_('Hide scrollbar'), 0, array(
'relatedFieldsOn' => array(
'slideroverflow-hidden-page-notice'
)
));
new Warning($rowHideScrollbar, 'overflow-hidden-page-notice', n2_('Your website won\'t be scrollable anymore! All out of screen elements will be hidden.'));
$row2 = $table->createRow('developer-2');
new OnOff($row2, 'responsiveFocusUser', n2_('Scroll to slider'), 1, array(
'tipLabel' => n2_('Scroll to slider'),
'tipDescription' => n2_('The page scrolls back to the slider when the user interacts with it.'),
'relatedFieldsOn' => array(
'sliderresponsiveFocusEdge'
)
));
new Select($row2, 'responsiveFocusEdge', n2_('Edge'), 'auto', array(
'options' => array(
'auto' => n2_('Auto'),
'top' => n2_('Top - when needed'),
'top-force' => n2_('Top - always'),
'bottom' => n2_('Bottom - when needed'),
'bottom-force' => n2_('Bottom - always'),
)
));
$row21 = $table->createRow('developer-21');
new OnOff($row21, 'is-delayed', n2_('Delayed (for lightbox/tabs)'), 0, array(
'tipLabel' => n2_('Delayed (for lightbox/tabs)'),
'tipDescription' => n2_('Delays the loading of the slider until its container gets visible. Useful when you display the slider in a lightbox or tab.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1801-slider-settings-optimize#delayed-for-lightboxtabs'
));
$row211 = $table->createRow('developer-211');
new OnOff($row211, 'legacy-font-scale', n2_('Legacy font scale'), 0, array(
'relatedFieldsOn' => array(
'sliderlegacy-font-scale-notice'
)
));
new Warning($row211, 'legacy-font-scale-notice', n2_('This feature brings back the non-adaptive font size for absolute layers which were made before version 3.5. Turning on can affect website performance, so we suggest to keep it disabled.
'));
$row22 = $table->createRow('developer-22');
new Text($row22, 'classes', n2_('Slider CSS classes'), '', array(
'tipLabel' => n2_('Slider CSS classes'),
'tipDescription' => n2_('You can put custom CSS classes to the slider\'s container.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1806-slider-settings-developer#css'
));
$row3 = $table->createRow('developer-3');
new Textarea($row3, 'custom-css-codes', 'CSS', '', array(
'height' => 26
));
$row11 = $table->createRow('developer-11');
new Number($row11, 'loading-time', n2_('Loading animation waiting time'), 2000, array(
'wide' => 5,
'unit' => 'ms',
));
$row10 = $table->createRow('developer-10');
new Textarea($row10, 'related-posts', n2_('Post IDs') . ' (' . n2_('one per line') . ')', '', array(
'tipLabel' => n2_('Post IDs') . ' (' . n2_('one per line') . ')',
'tipDescription' => n2_('The cache of the posts with the given ID will be cleared upon save.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1806-slider-settings-developer#post-ids-one-per-line',
'height' => 26
));
}
}

View File

@ -0,0 +1,170 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MarginPadding;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Fieldset\FieldsetRowPlain;
use Nextend\Framework\Form\FormTabbed;
use Nextend\SmartSlider3\Application\Admin\FormManager\FormManagerSlider;
use Nextend\SmartSlider3\Form\Element\PublishSlider;
class SliderGeneral extends AbstractSliderTab {
/**
* @var FormManagerSlider
*/
protected $manager;
/**
* SliderGeneral constructor.
*
* @param FormManagerSlider $manager
* @param FormTabbed $form
*/
public function __construct($manager, $form) {
$this->manager = $manager;
parent::__construct($form);
$this->publish();
$this->general();
$this->alias();
$this->sliderDesign();
}
/**
* @return string
*/
protected function getName() {
return 'general';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('General');
}
protected function publish() {
$table = new ContainerTable($this->tab, 'publish', n2_('Publish'));
$row = new FieldsetRowPlain($table, 'publish');
new PublishSlider($row);
}
protected function general() {
$table = new ContainerTable($this->tab, 'general', n2_('General') . ' - ' . $this->manager->getSliderType()
->getLabelFull());
$row1 = $table->createRow('general-1');
new Text($row1, 'title', n2_('Name'), n2_('Slider'), array(
'style' => 'width:300px;'
));
new FieldImage($row1, 'thumbnail', n2_('Thumbnail'), '', array(
'tipLabel' => n2_('Thumbnail'),
'tipDescription' => n2_('Slider thumbnail which appears in the slider list.')
));
new Text($row1, 'aria-label', n2_('ARIA label'), '', array(
'style' => 'width:200px;',
'tipLabel' => n2_('ARIA label'),
'tipDescription' => n2_('It allows you to label your slider for screen readers.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1722-slider-settings-general#aria-label'
));
}
protected function alias() {
$table = new ContainerTable($this->tab, 'alias', n2_('Alias'));
$row1 = $table->createRow('alias-1');
new Text($row1, 'alias', n2_('Alias'), '', array(
'style' => 'width:200px;',
'tipLabel' => n2_('Alias'),
'tipDescription' => n2_('You can use this alias in the slider\'s shortcode.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1722-slider-settings-general#alias'
));
new OnOff($row1, 'alias-id', n2_('Use as anchor'), '', array(
'tipLabel' => n2_('Use as anchor'),
'tipDescription' => n2_('Creates an empty div before the slider, using the alias as the ID of this div. As a result, you can use #your-alias in the URL to make the page jump to the slider.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1722-slider-settings-general#use-as-anchor',
'relatedFieldsOn' => array(
'slideralias-smoothscroll',
'slideralias-slideswitch'
)
));
new OnOff($row1, 'alias-smoothscroll', n2_('Smooth scroll'), '', array(
'tipLabel' => n2_('Smooth scroll'),
'tipDescription' => n2_('The #your-alias urls in links would be forced to smooth scroll to the slider.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1722-slider-settings-general#smooth-scroll-to-this-element'
));
/**
* Used for field removal: /general/alias/alias-1/alias-slideswitch
*/
new OnOff($row1, 'alias-slideswitch', n2_('Switch slide'), '', array(
'tipLabel' => n2_('Switch slide'),
'tipDescription' => n2_('Use #your-alias-2 as an anchor to jump to the slider and switch to the 2nd slide immediately. Use #your-alias-3 for the 3rd slide and so on.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1722-slider-settings-general#allow-slide-switching-for-anchor',
'relatedFieldsOn' => array(
'slideralias-slideswitch-scroll'
)
));
new OnOff($row1, 'alias-slideswitch-scroll', n2_('Scroll to slide'), 1, array(
'tipLabel' => n2_('Scroll to slide'),
'tipDescription' => n2_('The "Switch slide" option won\'t scroll you to the slider. Only the slides will switch.')
));
}
protected function sliderDesign() {
$table = new ContainerTable($this->tab, 'design', n2_('Slider design'));
/**
* Used for field injection: /general/design/design-1
*/
$row1 = $table->createRow('design-1');
new Select($row1, 'align', n2_('Align'), 'normal', array(
'options' => array(
'normal' => n2_('Normal'),
'left' => n2_('Left'),
'center' => n2_('Center'),
'right' => n2_('Right')
)
));
/**
* Used for field injection: /general/design/design-1/margin
*/
$margin = new MarginPadding($row1, 'margin', n2_('Margin'), '0|*|0|*|0|*|0', array(
'unit' => 'px',
'tipLabel' => n2_('Margin'),
'tipDescription' => n2_('Puts a fix margin around your slider.')
));
for ($i = 1; $i < 5; $i++) {
new Number($margin, 'col-border-width-' . $i, false, '', array(
'wide' => 3
));
}
}
}

View File

@ -0,0 +1,172 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\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\Message\Warning;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\FormTabbed;
class SliderOptimize extends AbstractSliderTab {
/**
* SliderOptimize constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
parent::__construct($form);
$this->loading();
$this->optimizeSlide();
$this->other();
}
/**
* @return string
*/
protected function getName() {
return 'optimize';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('Optimize');
}
protected function loading() {
$table = new ContainerTable($this->tab, 'loading', n2_('Loading'));
$row1 = $table->createRow('loading-1');
new Select($row1, 'loading-type', n2_('Loading type'), '', array(
'options' => array(
'' => n2_('Instant'),
'afterOnLoad' => n2_('After page loaded'),
'afterDelay' => n2_('After delay')
),
'relatedValueFields' => array(
array(
'values' => array(
'afterDelay'
),
'field' => array(
'sliderdelay'
)
)
),
'tipLabel' => n2_('Loading type'),
'tipDescription' => n2_('If your slider is above the fold, you can load it immediately. Otherwise, you can load it only after the page has loaded.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1801-slider-settings-optimize#loading-type'
));
new Number($row1, 'delay', n2_('Load delay'), 0, array(
'wide' => 5,
'unit' => 'ms'
));
new OnOff($row1, 'playWhenVisible', n2_('Play when visible'), 1, array(
'relatedFieldsOn' => array(
'sliderplayWhenVisibleAt'
),
'tipLabel' => n2_('Play when visible'),
'tipDescription' => n2_('Makes sure that the autoplay and layer animations only start when your slider is visible.')
));
new Number($row1, 'playWhenVisibleAt', n2_('At'), 50, array(
'unit' => '%',
'wide' => 3
));
}
protected function optimizeSlide() {
$table = new ContainerTable($this->tab, 'optimize-slide', n2_('Slide background images'));
$row2 = $table->createRow('optimize-slide-2');
$memoryLimitText = '';
if (function_exists('ini_get')) {
$memory_limit = ini_get('memory_limit');
if (!empty($memory_limit)) {
$memoryLimitText = ' (' . $memory_limit . ')';
}
}
new Warning($row2, 'optimize-notice', sprintf(n2_('Convert to WebP and image resizing require a lot of memory. Lift the memory limit%s if you get a blank page.'), $memoryLimitText));
$row3 = $table->createRow('optimize-slide-3');
$optimizeWebp = new Grouping($row3, 'optimize-slide-webp');
new OnOff($optimizeWebp, 'optimize-scale', n2_('Resize'), '0', array(
'relatedFieldsOn' => array(
'slideroptimize-slide-width-normal',
'slideroptimize-quality'
)
));
new Number($optimizeWebp, 'optimize-quality', n2_('Quality'), 70, array(
'min' => 0,
'max' => 100,
'unit' => '%',
'wide' => 3,
'post' => 'break'
));
new Number($optimizeWebp, 'optimize-slide-width-normal', n2_('Default width'), 1920, array(
'min' => 0,
'unit' => 'px',
'wide' => 4
));
$row4 = $table->createRow('optimize-slide-4');
new OnOff($row4, 'optimize-thumbnail-scale', n2_('Resize Thumbnail'), '0', array(
'relatedFieldsOn' => array(
'slideroptimize-thumbnail-quality',
'slideroptimizeThumbnailWidth',
'slideroptimizeThumbnailHeight'
)
));
new Number($row4, 'optimize-thumbnail-quality', n2_('Thumbnail Quality'), 70, array(
'min' => 0,
'max' => 100,
'unit' => '%',
'wide' => 3,
'post' => 'break'
));
new Number($row4, 'optimizeThumbnailWidth', n2_('Thumbnail width'), 100, array(
'min' => 0,
'unit' => 'px',
'wide' => 4
));
new Number($row4, 'optimizeThumbnailHeight', n2_('Thumbnail height'), 60, array(
'min' => 0,
'unit' => 'px',
'wide' => 4
));
}
protected function optimizeLayer() {
}
protected function optimizeSliderBackgroundImage() {
}
protected function other() {
}
}

View File

@ -0,0 +1,290 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerRowGroup;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Breakpoint;
use Nextend\Framework\Form\Element\CheckboxOnOff;
use Nextend\Framework\Form\Element\Group\GroupCheckboxOnOff;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\Hidden\HiddenOnOff;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text\HiddenText;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\FormTabbed;
use Nextend\SmartSlider3\Application\Admin\Settings\ViewSettingsGeneral;
use Nextend\SmartSlider3\Form\Element\Select\ResponsiveSubFormIcon;
use Nextend\SmartSlider3\Settings;
class SliderSize extends AbstractSliderTab {
/**
* SliderSize constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
parent::__construct($form);
$this->size();
$this->breakpoints();
$this->layout();
$this->customSize();
}
/**
* @return string
*/
protected function getName() {
return 'size';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('Size');
}
protected function size() {
$table = new ContainerTable($this->tab, 'size', n2_('Slider size'));
/**
* Used for field injection: /size/size/size-1
*/
$row1 = $table->createRow('size-1');
new NumberAutoComplete($row1, 'width', n2_('Width'), 900, array(
'wide' => 5,
'min' => 10,
'values' => array(
1920,
1400,
1000,
800,
600,
400
),
'unit' => 'px'
));
new NumberAutoComplete($row1, 'height', n2_('Height'), 500, array(
'wide' => 5,
'min' => 10,
'values' => array(
800,
600,
500,
400,
300,
200
),
'unit' => 'px'
));
/**
* Used for field removal: /size/size/size-2
*/
$row2 = $table->createRow('size-2');
new OnOff($row2, 'responsiveLimitSlideWidth', n2_('Limit slide width'), 1, array(
'relatedFieldsOn' => array(
'slidergrouping-responsive-slide-width'
),
'tipLabel' => n2_('Limit slide width'),
'tipDescription' => n2_('Limits the width of the slide and prevents the slider from getting too tall.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1774-slider-settings-size#limit-slide-width'
));
$slideMaxWidthGroup = new Grouping($row2, 'grouping-responsive-slide-width');
new OnOff($slideMaxWidthGroup, 'responsiveSlideWidth', n2_('Desktop'), 0, array(
'relatedFieldsOn' => array(
'sliderresponsiveSlideWidthMax'
)
));
new NumberAutoComplete($slideMaxWidthGroup, 'responsiveSlideWidthMax', n2_('Max'), 3000, array(
'min' => 0,
'values' => array(
3000,
980
),
'unit' => 'px',
'wide' => 5
));
new OnOff($slideMaxWidthGroup, 'responsiveSlideWidthTablet', n2_('Tablet'), 0, array(
'relatedFieldsOn' => array(
'sliderresponsiveSlideWidthMaxTablet'
)
));
new NumberAutoComplete($slideMaxWidthGroup, 'responsiveSlideWidthMaxTablet', n2_('Max'), 3000, array(
'min' => 0,
'values' => array(
3000,
980
),
'unit' => 'px',
'wide' => 5
));
new OnOff($slideMaxWidthGroup, 'responsiveSlideWidthMobile', n2_('Mobile'), 0, array(
'relatedFieldsOn' => array(
'sliderresponsiveSlideWidthMaxMobile'
)
));
new NumberAutoComplete($slideMaxWidthGroup, 'responsiveSlideWidthMaxMobile', n2_('Max'), 480, array(
'min' => 0,
'values' => array(
3000,
480
),
'unit' => 'px',
'wide' => 5
));
}
protected function breakpoints() {
$table = new ContainerTable($this->tab, 'breakpoints', n2_('Breakpoints'));
$tableFieldset = $table->getFieldsetLabel();
new HiddenText($tableFieldset, 'responsive-breakpoint-tablet-portrait', false, ViewSettingsGeneral::defaults['tablet-portrait']);
new HiddenText($tableFieldset, 'responsive-breakpoint-tablet-portrait-landscape', false, ViewSettingsGeneral::defaults['tablet-landscape']);
new HiddenText($tableFieldset, 'responsive-breakpoint-mobile-portrait', false, ViewSettingsGeneral::defaults['mobile-portrait']);
new HiddenText($tableFieldset, 'responsive-breakpoint-mobile-portrait-landscape', false, ViewSettingsGeneral::defaults['mobile-landscape']);
new HiddenOnOff($tableFieldset, 'responsive-breakpoint-tablet-portrait-enabled', n2_('Tablet'), 1, array(
'relatedFieldsOn' => array(
'sliderresponsive-breakpoint-notice-tablet-portrait',
'table-row-override-slider-size-tablet-portrait-row'
)
));
new HiddenOnOff($tableFieldset, 'responsive-breakpoint-mobile-portrait-enabled', n2_('Mobile'), 1, array(
'relatedFieldsOn' => array(
'sliderresponsive-breakpoint-notice-mobile-portrait',
'table-row-override-slider-size-mobile-portrait-row'
)
));
$row1 = $table->createRow('breakpoints-row-1');
$instructions = n2_('Breakpoints define the browser width in pixel when the slider switches to a different device.');
new Notice($row1, 'breakpoints-instructions', n2_('Instruction'), $instructions);
$row2 = $table->createRow('breakpoints-row-2');
new OnOff($row2, 'responsive-breakpoint-global', n2_('Global breakpoints'), 0, array(
'tipLabel' => n2_('Global breakpoints'),
'tipDescription' => sprintf(n2_('You can use the global breakpoints, or adjust them locally here. You can configure the Global breakpoints at %1$sGlobal settings%2$s > General > Breakpoints'), sprintf('<a href="%s" target="_blank">', $this->form->getMVCHelper()
->getUrlSettingsDefault()), '</a>')
));
new Breakpoint($row2, 'breakpoints', array(
'tabletportrait-portrait' => 'sliderresponsive-breakpoint-tablet-portrait',
'tabletportrait-landscape' => 'sliderresponsive-breakpoint-tablet-portrait-landscape',
'mobileportrait-portrait' => 'sliderresponsive-breakpoint-mobile-portrait',
'mobileportrait-landscape' => 'sliderresponsive-breakpoint-mobile-portrait-landscape'
), array(), array(
'field' => 'sliderresponsive-breakpoint-global',
'values' => array(
'tabletportrait-portrait' => Settings::get('responsive-screen-width-tablet-portrait', ViewSettingsGeneral::defaults['tablet-portrait']),
'tabletportrait-landscape' => Settings::get('responsive-screen-width-tablet-portrait-landscape', ViewSettingsGeneral::defaults['tablet-landscape']),
'mobileportrait-portrait' => Settings::get('responsive-screen-width-mobile-portrait', ViewSettingsGeneral::defaults['mobile-portrait']),
'mobileportrait-landscape' => Settings::get('responsive-screen-width-mobile-portrait-landscape', ViewSettingsGeneral::defaults['mobile-landscape'])
)
));
}
protected function layout() {
$table = new ContainerTable($this->tab, 'responsive-mode', n2_('Layout'));
$row1 = $table->createRow('responsive-mode-row-1');
/**
* Used for option removal: /size/responsive-mode/responsive-mode-row-1/responsive-mode
*/
new ResponsiveSubFormIcon($row1, 'responsive-mode', $table, $this->form->createAjaxUrl(array("slider/renderresponsivetype")), 'auto');
}
protected function customSize() {
}
/**
* @param ContainerRowGroup $rowGroup
*/
protected function desktopLandscape($rowGroup) {
}
/**
* @param ContainerRowGroup $rowGroup
*/
protected function tabletLandscape($rowGroup) {
}
/**
* @param ContainerRowGroup $rowGroup
*/
protected function tabletPortrait($rowGroup) {
$row = $rowGroup->createRow('override-slider-size-tablet-portrait-row');
new OnOff($row, 'slider-size-override-tablet-portrait', n2_('Tablet'), 0, array(
'relatedFieldsOn' => array(
'slidertablet-portrait-width',
'slidertablet-portrait-height'
)
));
new Number($row, 'tablet-portrait-width', n2_('Width'), 768, array(
'wide' => 5,
'unit' => 'px'
));
new Number($row, 'tablet-portrait-height', n2_('Height'), 1024, array(
'wide' => 5,
'unit' => 'px'
));
}
/**
* @param ContainerRowGroup $rowGroup
*/
protected function mobileLandscape($rowGroup) {
}
/**
* @param ContainerRowGroup $rowGroup
*/
protected function mobilePortrait($rowGroup) {
$row = $rowGroup->createRow('override-slider-size-mobile-portrait-row');
new OnOff($row, 'slider-size-override-mobile-portrait', n2_('Mobile'), 0, array(
'relatedFieldsOn' => array(
'slidermobile-portrait-width',
'slidermobile-portrait-height'
)
));
new Number($row, 'mobile-portrait-width', n2_('Width'), 320, array(
'wide' => 5,
'unit' => 'px'
));
new Number($row, 'mobile-portrait-height', n2_('Height'), 568, array(
'wide' => 5,
'unit' => 'px'
));
}
}

View File

@ -0,0 +1,160 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\FormManager\Slider;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\FormTabbed;
class SliderSlides extends AbstractSliderTab {
/**
* SliderSlides constructor.
*
* @param FormTabbed $form
*/
public function __construct($form) {
parent::__construct($form);
$this->design();
}
/**
* @return string
*/
protected function getName() {
return 'slides';
}
/**
* @return string
*/
protected function getLabel() {
return n2_('Slides');
}
protected function design() {
$table = new ContainerTable($this->tab, 'slides-design', n2_('Slides design'));
/**
* Used for field injection: /slides/slides-design/slides-design-1
*/
$row1 = $table->createRow('slides-design-1');
/**
* Used for field injection: /slides/slides-design/slides-design-1/backgroundMode
*/
new Select\FillMode($row1, 'backgroundMode', n2_('Slide background image fill'), 'fill', array(
'tipLabel' => n2_('Slide background image fill'),
'tipDescription' => n2_('If the size of your image is not the same as your slider\'s, you can improve the result with the filling modes.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1809-slider-settings-slides#slide-background-image-fill',
'relatedValueFields' => array(
array(
'values' => array(
'blurfit'
),
'field' => array(
'sliderbackgroundBlurFit'
)
)
)
));
new NumberSlider($row1, 'backgroundBlurFit', n2_('Background Blur'), 7, array(
'unit' => 'px',
'min' => 7,
'max' => '50',
'style' => 'width:22px;'
));
}
protected function slides() {
/**
* Used for field removal: /slides/slides-randomize
*/
$table = new ContainerTable($this->tab, 'slides-randomize', n2_('Randomize'));
$row1 = $table->createRow('slides-randomize-1');
new OnOff($row1, 'randomize', n2_('Randomize slides'), 0);
new OnOff($row1, 'randomizeFirst', n2_('Randomize first'), 0);
new OnOff($row1, 'randomize-cache', n2_('Cache support'), 1);
new Number($row1, 'variations', n2_('Cache variations'), 5, array(
'wide' => 5
));
/**
* Used for field removal: /slides/other
*/
$table = new ContainerTable($this->tab, 'other', n2_('Other'));
$row2 = $table->createRow('other-1');
new OnOff($row2, 'reverse-slides', n2_('Reverse'), 0, array(
'tipLabel' => n2_('Reverse'),
'tipDescription' => n2_('You can make your slides appear in the slider in a reversed order.')
));
new Number($row2, 'maximumslidecount', n2_('Max count'), 1000, array(
'wide' => 4,
'tipLabel' => n2_('Max count'),
'tipDescription' => n2_('You can limit how many slides you want to show from your slider. It\'s best used with the Randomize feature, to improve the experience.')
));
new OnOff($row2, 'maintain-session', n2_('Maintain session'), 0, array(
'tipLabel' => n2_('Maintain session'),
'tipDescription' => n2_('The slider continues from the last viewed slide when the visitor comes back to the page.')
));
$row3 = $table->createRow('slides-2');
new OnOff($row3, 'global-lightbox', n2_('Backgrounds in lightbox'), 0, array(
'tipLabel' => n2_('Backgrounds in lightbox'),
'tipDescription' => n2_('Creates a lightbox from your slide background images. This feature only works if all slides have background images.'),
'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1809-slider-settings-slides#backgrounds-in-lightbox',
'relatedFieldsOn' => array(
'sliderglobal-lightbox-label'
)
));
new Select($row3, 'global-lightbox-label', n2_('Show label'), '0', array(
'options' => array(
'0' => n2_('No'),
'name' => n2_('Only slide name'),
'namemore' => n2_('Slide name and description')
)
));
}
protected function parallax() {
/**
* Used for field removal: /slides/slides-parallax
*/
$table = new ContainerTable($this->tab, 'slides-parallax', n2_('Background parallax'));
new OnOff($table->getFieldsetLabel(), 'slide-background-parallax', false, 0, array(
'relatedFieldsOn' => array(
'table-rows-slides-parallax'
)
));
$row1 = $table->createRow('slides-parallax-1');
new Select($row1, 'slide-background-parallax-strength', n2_('Strength'), 50, array(
'options' => array(
10 => n2_('Super soft') . ' 10%',
30 => n2_('Soft') . ' 30%',
50 => n2_('Normal') . ' 50%',
75 => n2_('Strong') . ' 75%',
100 => n2_('Super strong') . ' 100%'
)
));
new OnOff($row1, 'bg-parallax-tablet', n2_('Tablet'), 0);
new OnOff($row1, 'bg-parallax-mobile', n2_('Mobile'), 0);
}
}

View File

@ -0,0 +1,228 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Exception;
use Nextend\Framework\Controller\Admin\AdminAjaxController;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Application\Helper\HelperSliderChanged;
use Nextend\SmartSlider3\Application\Model\ModelGenerator;
use Nextend\SmartSlider3\Application\Model\ModelSlides;
class ControllerAjaxGenerator extends AdminAjaxController {
use TraitAdminUrl;
public function actionCheckConfiguration() {
$this->validateToken();
$this->validatePermission('smartslider_config');
$group = Request::$REQUEST->getVar('group');
$this->validateVariable($group, 'group');
$sliderID = Request::$REQUEST->getVar('sliderid');
$this->validateVariable($sliderID, 'sliderid');
$groupID = Request::$REQUEST->getInt('groupID');
$generatorModel = new ModelGenerator($this);
$generatorGroup = $generatorModel->getGeneratorGroup($group);
$configuration = $generatorGroup->getConfiguration();
$configuration->addData(Request::$POST->getVar('generator'));
if ($configuration->wellConfigured()) {
$this->redirect($this->getUrlGeneratorCreateStep2($group, $sliderID, $groupID));
} else {
$this->response->redirect($this->getUrlGeneratorCheckConfiguration($group, $sliderID, $groupID));
}
}
public function actionCreateSettings() {
$this->validateToken();
$this->validatePermission('smartslider_edit');
$group = Request::$REQUEST->getVar('group');
$this->validateVariable($group, 'group');
$type = Request::$REQUEST->getVar('type');
$this->validateVariable($type, 'type');
$sliderID = Request::$REQUEST->getVar('sliderid');
$this->validateVariable($sliderID, 'sliderid');
$groupID = Request::$REQUEST->getInt('groupID');
$generatorModel = new ModelGenerator($this);
$result = $generatorModel->createGenerator($sliderID, Request::$REQUEST->getVar('generator'));
Notification::success(n2_('Generator created.'));
$this->response->redirect($this->getUrlSlideEdit($result['slideId'], $sliderID, $groupID));
}
public function actionEdit() {
$this->validateToken();
$this->validatePermission('smartslider_edit');
$generatorId = Request::$REQUEST->getInt('generator_id');
$this->validateVariable($generatorId, 'generatorId');
$groupID = Request::$REQUEST->getInt('groupID');
$generatorModel = new ModelGenerator($this);
$generator = $generatorModel->get($generatorId);
$this->validateDatabase($generator);
$slidesModel = new ModelSlides($this);
$slides = $slidesModel->getAll(-1, 'OR generator_id = ' . $generator['id'] . '');
if (count($slides) > 0) {
$slide = $slides[0];
$request = new Data(Request::$REQUEST->getVar('generator'));
$slideParams = new Data($slide['params'], true);
$slideParams->set('record-slides', $request->get('record-slides', 1));
$slidesModel->updateSlideParams($slide['id'], $slideParams->toArray());
$request->un_set('record-slides');
$generatorModel->save($generatorId, $request->toArray());
$helper = new HelperSliderChanged($this);
$helper->setSliderChanged($slide['slider'], 1);
Notification::success(n2_('Generator updated and cache cleared.'));
$this->response->respond();
}
}
public function actionRecordsTable() {
$this->validateToken();
$this->validatePermission('smartslider_edit');
$generatorID = Request::$REQUEST->getInt('generator_id');
$generatorModel = new ModelGenerator($this);
if ($generatorID > 0) {
$generator = $generatorModel->get($generatorID);
$this->validateDatabase($generator);
} else {
$info = new Data(Request::$REQUEST->getVar('generator'));
$generator = array(
'group' => $info->get('group'),
'type' => $info->get('type'),
'params' => '{}'
);
}
$generatorGroup = $generatorModel->getGeneratorGroup($generator['group']);
if (!$generatorGroup) {
Notification::notice(n2_('Generator group not found'));
$this->response->error();
}
$generatorSource = $generatorGroup->getSource($generator['type']);
if (!$generatorSource) {
Notification::notice(n2_('Generator source not found'));
$this->response->error();
}
$generator['params'] = new Data($generator['params'], true);
$generator['params']->loadArray(Request::$REQUEST->getVar('generator'));
$generatorSource->setData($generator['params']);
$request = new Data(Request::$REQUEST->getVar('generator'));
$group = max(intval($request->get('record-group', 1)), 1);
$result = $generatorSource->getData(max($request->get('record-slides', 1), 1), max($request->get('record-start', 1), 1), $group);
if (empty($result)) {
Notification::notice(n2_('No records found for the filter'));
$this->response->respond(null);
}
$view = new ViewAjaxGeneratorRecordsTable($this);
$view->setRecordGroup($group);
$view->setRecords($result);
$this->response->respond($view->display());
}
public function actionGetAuthUrl() {
$this->validateToken();
$this->validatePermission('smartslider_config');
$group = Request::$REQUEST->getVar('group');
$generatorModel = new ModelGenerator($this);
$generatorGroup = $generatorModel->getGeneratorGroup($group);
try {
$configuration = $generatorGroup->getConfiguration();
$this->response->respond(array('authUrl' => $configuration->startAuth($this)));
} catch (Exception $e) {
Notification::error($e->getMessage());
$this->response->error();
}
}
public function actionGetRefresh() {
$this->validateToken();
$this->validatePermission('smartslider_config');
$group = Request::$REQUEST->getVar('group');
$generatorModel = new ModelGenerator($this);
$generatorGroup = $generatorModel->getGeneratorGroup($group);
try {
$configuration = $generatorGroup->getConfiguration();
$this->response->respond(array('authUrl' => $configuration->refreshToken($this)));
} catch (Exception $e) {
Notification::error($e->getMessage());
$this->response->error();
}
}
public function actionGetData() {
$this->validateToken();
$this->validatePermission('smartslider_edit');
$group = Request::$REQUEST->getVar('group');
$generatorModel = new ModelGenerator($this);
$generatorGroup = $generatorModel->getGeneratorGroup($group);
try {
$configuration = $generatorGroup->getConfiguration();
$this->response->respond(call_user_func(array(
$configuration,
Request::$REQUEST->getCmd('method')
)));
} catch (Exception $e) {
Notification::error($e->getMessage());
$this->response->error();
}
}
}

View File

@ -0,0 +1,225 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Exception;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\PageFlow;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\AbstractControllerAdmin;
use Nextend\SmartSlider3\Application\Model\ModelGenerator;
use Nextend\SmartSlider3\Application\Model\ModelSliders;
use Nextend\SmartSlider3\Application\Model\ModelSlides;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
class ControllerGenerator extends AbstractControllerAdmin {
public function actionCreate() {
if ($this->validatePermission('smartslider_edit')) {
$sliderID = Request::$REQUEST->getInt("sliderid", 0);
$slidersModel = new ModelSliders($this);
$slider = $slidersModel->get($sliderID);
if ($this->validateDatabase($slider)) {
$groupData = $this->getGroupData($sliderID);
$view = new ViewGeneratorCreateStep1Groups($this);
$view->setGroupData($groupData['group_id'], $groupData['title']);
$view->setSlider($slider);
$view->display();
}
}
}
public function actionCreateStep2() {
if ($this->validatePermission('smartslider_edit')) {
$sliderID = Request::$REQUEST->getInt("sliderid", 0);
$slidersModel = new ModelSliders($this);
$slider = $slidersModel->get($sliderID);
if ($this->validateDatabase($slider)) {
$groupData = $this->getGroupData($sliderID);
$generatorGroup = GeneratorFactory::getGenerator(Request::$REQUEST->getCmd('group'));
if (!$generatorGroup) {
$this->redirect($this->getUrlGeneratorCreate($sliderID, $groupData['group_id']));
}
$sources = $generatorGroup->getSources();
if (empty($sources)) {
Notification::error($generatorGroup->getError());
$this->redirect($this->getUrlGeneratorCreate($sliderID, $groupData['group_id']));
}
if (count($sources) == 1) {
/**
* There is only one source in this generator. Skip to the next step.
*/
reset($sources);
$this->redirect($this->getUrlGeneratorCreateSettings($generatorGroup->getName(), $sources[key($sources)]->getName(), $sliderID, $groupData['group_id']));
}
$view = new ViewGeneratorCreateStep3Sources($this);
$view->setGroupData($groupData['group_id'], $groupData['title']);
$view->setSlider($slider);
$view->setGeneratorGroup($generatorGroup);
$view->display();
}
}
}
public function actionEdit() {
if ($this->validatePermission('smartslider_edit')) {
$generatorId = Request::$REQUEST->getInt('generator_id');
$generatorModel = new ModelGenerator($this);
$generator = $generatorModel->get($generatorId);
if ($this->validateDatabase($generator)) {
Request::$REQUEST->set('group', $generator['group']);
Request::$REQUEST->set('type', $generator['type']);
$slidesModel = new ModelSlides($this);
$slides = $slidesModel->getAll(-1, 'OR generator_id = ' . $generator['id'] . '');
if (count($slides) > 0) {
$slide = $slides[0];
Request::$REQUEST->set('sliderid', $slide['slider']);
$slidersModel = new ModelSliders($this);
$slider = $slidersModel->get($slide['slider']);
$groupData = $this->getGroupData($slider['id']);
$group = $generator['group'];
$type = $generator['type'];
$generatorGroup = $generatorModel->getGeneratorGroup($group);
if (!$generatorGroup) {
$this->redirect($this->getUrlSlideEdit($slide['id'], $slider['id'], $groupData['group_id']));
}
$generatorSource = $generatorGroup->getSource($type);
if (!$generatorSource) {
$this->redirect($this->getUrlSlideEdit($slide['id'], $slider['id'], $groupData['group_id']));
}
$view = new ViewGeneratorEdit($this);
$view->setGroupData($groupData['group_id'], $groupData['title']);
$view->setSlider($slider);
$view->setSlide($slide);
$view->setGenerator($generator);
$view->setGeneratorGroup($generatorGroup);
$view->setGeneratorSource($generatorSource);
$view->display();
} else {
$this->redirect($this->getUrlDashboard());
}
} else {
$this->redirect($this->getUrlDashboard());
}
}
}
public function actionCreateSettings() {
if ($this->validatePermission('smartslider_edit')) {
$slidersModel = new ModelSliders($this);
$sliderID = Request::$REQUEST->getInt('sliderid');
if (!($slider = $slidersModel->get($sliderID))) {
$this->redirectToSliders();
}
$groupData = $this->getGroupData($slider['id']);
$generatorGroup = GeneratorFactory::getGenerator(Request::$REQUEST->getCmd('group'));
$source = $generatorGroup->getSource(Request::$REQUEST->getVar('type'));
if ($source) {
$view = new ViewGeneratorCreateStep4Settings($this);
$view->setGroupData($groupData['group_id'], $groupData['title']);
$view->setSlider($slider);
$view->setGeneratorGroup($generatorGroup);
$view->setGeneratorSource($source);
$view->display();
} else {
$this->redirect($this->getUrlSliderEdit($slider['id'], $groupData['group_id']));
}
}
}
public function actionCheckConfiguration() {
if ($this->validatePermission('smartslider_config') && $this->validatePermission('smartslider_edit')) {
$group = Request::$REQUEST->getVar('group');
$generatorGroup = GeneratorFactory::getGenerator($group);
$configuration = $generatorGroup->getConfiguration();
$slidersModel = new ModelSliders($this);
$sliderID = Request::$REQUEST->getInt('sliderid');
if (!($slider = $slidersModel->get($sliderID))) {
$this->redirectToSliders();
}
$groupData = $this->getGroupData($sliderID);
if ($configuration->wellConfigured()) {
$this->redirect($this->getUrlGeneratorCreateStep2($group, $sliderID, $groupData['group_id']));
}
$view = new ViewGeneratorCreateStep2Configure($this);
$view->setGroupData($groupData['group_id'], $groupData['title']);
$view->setSlider($slider);
$view->setGeneratorGroup($generatorGroup);
$view->setConfiguration($configuration);
$view->display();
}
}
public function actionFinishAuth() {
if ($this->validatePermission('smartslider_config')) {
$generatorModel = new ModelGenerator($this);
$group = Request::$REQUEST->getVar('group');
$generatorGroup = $generatorModel->getGeneratorGroup($group);
$configuration = $generatorGroup->getConfiguration();
$result = $configuration->finishAuth($this);
if ($result === true) {
Notification::success(n2_('Authentication successful.'));
echo '<script>window.opener.location.reload();self.close();</script>';
} else {
if ($result instanceof Exception) {
$message = $result->getMessage();
} else {
$message = 'Something wrong with the credentials';
}
echo '<script>window.opener._N2.Notification.error("' . esc_html($message) . '");self.close();</script>';
}
PageFlow::exitApplication();
}
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Generator\GeneratorBox\BlockGeneratorBox;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
/**
* @var ViewGeneratorCreateStep1Groups $this
*/
$generatorGroups = $this->getGeneratorGroups();
/** @var AbstractGeneratorGroup[] $installed */
$installed = array();
/** @var AbstractGeneratorGroup[] $notInstalled */
$notInstalled = array();
foreach ($generatorGroups as $generatorGroup) {
if (!$generatorGroup->isDeprecated()) {
if ($generatorGroup->isInstalled()) {
$installed[] = $generatorGroup;
} else {
$notInstalled[] = $generatorGroup;
}
}
}
?>
<div class="n2_slide_generator_step1">
<div class="n2_slide_generator_step1__installed_generators">
<?php
foreach ($installed as $generatorGroup) {
$blockGeneratorBox = new BlockGeneratorBox($this);
$blockGeneratorBox->setImageUrl($generatorGroup->getImageUrl());
$blockGeneratorBox->setLabel($generatorGroup->getLabel());
$blockGeneratorBox->setButtonLabel(n2_('Choose'));
$blockGeneratorBox->setDescription($generatorGroup->getDescription());
$blockGeneratorBox->setDocsLink($generatorGroup->getDocsLink());
if ($generatorGroup->hasConfiguration()) {
$url = $this->getUrlGeneratorCheckConfiguration($generatorGroup->getName(), $this->getSliderID(), $this->groupID);
} else {
$url = $this->getUrlGeneratorCreateStep2($generatorGroup->getName(), $this->getSliderID(), $this->groupID);
}
$blockGeneratorBox->setButtonLink($url);
$blockGeneratorBox->display();
}
?>
</div>
<?php if (!empty($notInstalled)): ?>
<div class="n2_slide_generator_step1__not_installed">
<div class="n2_slide_generator_step1__not_installed_label">
<?php n2_e('Not installed'); ?>
</div>
<div class="n2_slide_generator_step1__not_installed_generators">
<?php
foreach ($notInstalled as $generatorGroup) {
$blockGeneratorBox = new BlockGeneratorBox($this);
$blockGeneratorBox->setImageUrl($generatorGroup->getImageUrl());
$blockGeneratorBox->setLabel($generatorGroup->getLabel());
$blockGeneratorBox->setButtonLabel(n2_('Visit'));
$blockGeneratorBox->setButtonLinkTarget('_blank');
$blockGeneratorBox->setButtonLink($generatorGroup->getUrl());
$blockGeneratorBox->setDescription($generatorGroup->getDescription());
$blockGeneratorBox->display();
}
?>
</div>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\Framework\Asset\Js\Js;
/**
* @var ViewGeneratorCreateStep2Configure $this
*/
JS::addInline('new _N2.GeneratorConfigure();');
?>
<form id="n2-ss-form-generator-configure" action="<?php echo esc_url($this->getAjaxUrlGeneratorCheckConfiguration($this->getGeneratorGroup()
->getName(), $this->getSliderID(), $this->getGroupID())); ?>" method="post">
<?php
$this->renderForm();
?>
</form>

View File

@ -0,0 +1,30 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Generator\GeneratorBox\BlockGeneratorBox;
/**
* @var ViewGeneratorCreateStep3Sources $this
*/
$generatorGroup = $this->getGeneratorGroup();
?>
<div class="n2_slide_generator_step3">
<?php
foreach ($generatorGroup->getSources() as $source) {
$blockGeneratorBox = new BlockGeneratorBox($this);
$blockGeneratorBox->setImageUrl($generatorGroup->getImageUrl());
$blockGeneratorBox->setLabel($source->getLabel());
$blockGeneratorBox->setButtonLink($this->getUrlGeneratorCreateSettings($generatorGroup->getName(), $source->getName(), $this->getSliderID(), $this->groupID));
$blockGeneratorBox->setButtonLabel(n2_('Choose'));
$blockGeneratorBox->setDescription($source->getDescription());
$blockGeneratorBox->display();
}
?>
</div>

View File

@ -0,0 +1,27 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\Framework\Asset\Js\Js;
/**
* @var ViewGeneratorCreateStep4Settings $this
*/
$generatorGroup = $this->getGeneratorGroup();
$generatorSource = $this->getGeneratorSource();
JS::addInline('new _N2.GeneratorAdd();');
?>
<form id="n2-ss-form-generator-add" action="<?php echo esc_url($this->getAjaxUrlGeneratorCreateSettings($this->getGeneratorGroup()
->getName(), $this->getGeneratorSource()
->getName(), $this->getSliderID(), $this->getGroupID())); ?>" method="post">
<?php
$this->displayForm();
?>
<input name="generator[group]" value="<?php echo esc_attr($generatorGroup->getName()); ?>" type="hidden">
<input name="generator[type]" value="<?php echo esc_attr($generatorSource->getName()); ?>" type="hidden">
<input name="slider-id" value="<?php echo esc_attr($this->getSliderID()); ?>" type="hidden">
</form>

View File

@ -0,0 +1,29 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\Framework\Asset\Js\Js;
use Nextend\SmartSlider3\Settings;
/**
* @var ViewGeneratorEdit $this
*/
$generator = $this->getGenerator();
$generatorGroup = $this->getGeneratorGroup();
$generatorSource = $this->getGeneratorSource();
JS::addInline('new _N2.GeneratorEdit(' . json_encode(array(
'previewInNewWindow' => !!Settings::get('preview-new-window', 0),
'previewUrl' => $this->getUrlPreviewGenerator($generator['id'])
)) . ');');
?>
<form id="n2-ss-form-generator-edit" action="<?php echo esc_url($this->getAjaxUrlGeneratorEdit($generator['id'], $this->getGroupID())); ?>" method="post">
<?php
$this->renderForm();
?>
<input name="generator[group]" value="<?php echo esc_attr($generatorGroup->getName()); ?>" type="hidden">
<input name="generator[type]" value="<?php echo esc_attr($generatorSource->getName()); ?>" type="hidden">
<input name="slider-id" value="<?php echo esc_attr($this->getSliderID()); ?>" type="hidden">
</form>

View File

@ -0,0 +1,79 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\Framework\View\AbstractViewAjax;
class ViewAjaxGeneratorRecordsTable extends AbstractViewAjax {
/** @var integer */
protected $recordGroup = 1;
/** @var array */
protected $records;
public function display() {
$records = $this->getRecords();
$headings = array();
for ($currentGroupIndex = 1; $currentGroupIndex <= $this->getRecordGroup(); $currentGroupIndex++) {
$headings[] = '#';
foreach ($records[0][0] as $recordKey => $v) {
$headings[] = '{' . $recordKey . '/' . $currentGroupIndex . '}';
}
}
$rows = array();
$i = 0;
foreach ($records as $recordGroup) {
foreach ($recordGroup as $record) {
$rows[$i][] = $i + 1;
foreach ($record as $recordValue) {
if ($recordValue === null) {
$rows[$i][] = '';
} else {
$rows[$i][] = htmlspecialchars($recordValue, ENT_QUOTES, "UTF-8");
}
}
}
$i++;
}
return array(
'headings' => $headings,
'rows' => $rows
);
}
/**
* @return int
*/
public function getRecordGroup() {
return $this->recordGroup;
}
/**
* @param int $recordGroup
*/
public function setRecordGroup($recordGroup) {
$this->recordGroup = $recordGroup;
}
/**
* @return array
*/
public function getRecords() {
return $this->records;
}
/**
* @param array $records
*/
public function setRecords($records) {
$this->records = $records;
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
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\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
class ViewGeneratorCreateStep1Groups extends AbstractView {
use TraitAdminUrl;
protected $groupID = 0;
protected $groupTitle = '';
/** @var array */
protected $slider;
public function display() {
$this->layout = new LayoutDefault($this);
if ($this->groupID) {
$this->layout->addBreadcrumb(Sanitize::esc_html($this->groupTitle), 'ssi_16 ssi_16--folderclosed', $this->getUrlSliderEdit($this->groupID));
}
$this->layout->addBreadcrumb(Sanitize::esc_html($this->slider['title']), 'ssi_16 ssi_16--image', $this->getUrlSliderEdit($this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb(n2_('Add dynamic slides'), '');
$blockHeader = new BlockHeader($this);
$blockHeader->setHeading(n2_('Add dynamic slides'));
$this->layout->addContentBlock($blockHeader);
$this->layout->addContent($this->render('CreateStep1Groups'));
$this->layout->render();
}
/**
* @param int $groupID
* @param string $groupTitle
*/
public function setGroupData($groupID, $groupTitle) {
$this->groupID = $groupID;
$this->groupTitle = $groupTitle;
}
/**
* @return array
*/
public function getSlider() {
return $this->slider;
}
/**
* @param array $slider
*/
public function setSlider($slider) {
$this->slider = $slider;
}
/**
* @return integer
*/
public function getSliderID() {
return $this->slider['id'];
}
/**
* @return AbstractGeneratorGroup[]
*/
public function getGeneratorGroups() {
return GeneratorFactory::getGenerators();
}
}

View File

@ -0,0 +1,155 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
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\BlockButtonCancel;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonSave;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroupConfiguration;
class ViewGeneratorCreateStep2Configure extends AbstractView {
use TraitAdminUrl;
protected $active = 'general';
/** @var LayoutDefault */
protected $layout;
/**
* @var BlockHeader
*/
protected $blockHeader;
protected $groupID;
protected $groupTitle;
/** @var array */
protected $slider;
/** @var AbstractGeneratorGroup */
protected $generatorGroup;
/** @var AbstractGeneratorGroupConfiguration */
protected $configuration;
/**
* @param int $groupID
* @param string $groupTitle
*/
public function setGroupData($groupID, $groupTitle) {
$this->groupID = $groupID;
$this->groupTitle = $groupTitle;
}
/**
* @return array
*/
public function getSlider() {
return $this->slider;
}
/**
* @param array $slider
*/
public function setSlider($slider) {
$this->slider = $slider;
}
public function hasSlider() {
return !is_null($this->slider);
}
public function getSliderID() {
return $this->slider['id'];
}
/**
* @return mixed
*/
public function getGroupID() {
return $this->groupID;
}
/**
* @return AbstractGeneratorGroup
*/
public function getGeneratorGroup() {
return $this->generatorGroup;
}
/**
* @param AbstractGeneratorGroup $generatorGroup
*/
public function setGeneratorGroup($generatorGroup) {
$this->generatorGroup = $generatorGroup;
}
/**
* @return mixed
*/
public function getConfiguration() {
return $this->configuration;
}
/**
* @param mixed $configuration
*/
public function setConfiguration($configuration) {
$this->configuration = $configuration;
}
public function renderForm() {
$this->configuration->render($this);
}
public function display() {
$this->layout = new LayoutDefault($this);
if ($this->groupID) {
$this->layout->addBreadcrumb(Sanitize::esc_html($this->groupTitle), 'ssi_16 ssi_16--folderclosed', $this->getUrlSliderEdit($this->groupID));
}
$this->layout->addBreadcrumb(Sanitize::esc_html($this->slider['title']), 'ssi_16 ssi_16--image', $this->getUrlSliderEdit($this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb(n2_('Add dynamic slides'), '', $this->getUrlGeneratorCreate($this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb(n2_('Configure') . ' - ' . $this->generatorGroup->getLabel(), '');
$topBar = new BlockTopBarMain($this);
$buttonSave = new BlockButtonSave($this);
$buttonSave->addClass('n2_button--inactive');
$buttonSave->addClass('n2_generator_configuration_save');
$topBar->addPrimaryBlock($buttonSave);
$buttonCancel = new BlockButtonCancel($this);
$buttonCancel->addClass('n2_generator_configuration_cancel');
$buttonCancel->setUrl($this->getUrlGeneratorCreate($this->slider['id'], $this->groupID));
$topBar->addPrimaryBlock($buttonCancel);
$this->layout->setTopBar($topBar->toHTML());
$blockHeader = new BlockHeader($this);
$blockHeader->setHeading(n2_('Configure') . ': ' . $this->generatorGroup->getLabel());
$this->layout->addContentBlock($blockHeader);
$this->layout->addContent($this->render('CreateStep2Configure'));
$this->layout->render();
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
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\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
class ViewGeneratorCreateStep3Sources extends AbstractView {
use TraitAdminUrl;
protected $groupID = 0;
protected $groupTitle = '';
/** @var array */
protected $slider;
/** @var AbstractGeneratorGroup */
protected $generatorGroup;
public function display() {
$this->layout = new LayoutDefault($this);
if ($this->groupID) {
$this->layout->addBreadcrumb(Sanitize::esc_html($this->groupTitle), 'ssi_16 ssi_16--folderclosed', $this->getUrlSliderEdit($this->groupID));
}
$this->layout->addBreadcrumb(Sanitize::esc_html($this->slider['title']), 'ssi_16 ssi_16--image', $this->getUrlSliderEdit($this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb(n2_('Add dynamic slides'), '', $this->getUrlGeneratorCreate($this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb($this->generatorGroup->getLabel(), '');
$blockHeader = new BlockHeader($this);
$blockHeader->setHeading(n2_('Add dynamic slides') . ': ' . $this->generatorGroup->getLabel());
$this->layout->addContentBlock($blockHeader);
$this->layout->addContent($this->render('CreateStep3Sources'));
$this->layout->render();
}
/**
* @param int $groupID
* @param string $groupTitle
*/
public function setGroupData($groupID, $groupTitle) {
$this->groupID = $groupID;
$this->groupTitle = $groupTitle;
}
/**
* @return array
*/
public function getSlider() {
return $this->slider;
}
/**
* @param array $slider
*/
public function setSlider($slider) {
$this->slider = $slider;
}
/**
* @return int
*/
public function getSliderID() {
return $this->slider['id'];
}
/**
* @return AbstractGeneratorGroup
*/
public function getGeneratorGroup() {
return $this->generatorGroup;
}
/**
* @param AbstractGeneratorGroup $generatorGroup
*/
public function setGeneratorGroup($generatorGroup) {
$this->generatorGroup = $generatorGroup;
}
}

View File

@ -0,0 +1,156 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\Framework\Form\Element\Token;
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\BlockButtonCancel;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonSave;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Application\Model\ModelGenerator;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
class ViewGeneratorCreateStep4Settings extends AbstractView {
use TraitAdminUrl;
protected $groupID = 0;
protected $groupTitle = '';
/** @var array */
protected $slider;
/** @var AbstractGeneratorGroup */
protected $generatorGroup;
/** @var AbstractGenerator */
protected $generatorSource;
public function display() {
$this->layout = new LayoutDefault($this);
if ($this->groupID) {
$this->layout->addBreadcrumb(Sanitize::esc_html($this->groupTitle), 'ssi_16 ssi_16--folderclosed', $this->getUrlSliderEdit($this->groupID));
}
$this->layout->addBreadcrumb(Sanitize::esc_html($this->slider['title']), 'ssi_16 ssi_16--image', $this->getUrlSliderEdit($this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb(n2_('Add dynamic slides'), '', $this->getUrlGeneratorCreate($this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb($this->generatorGroup->getLabel(), '', $this->getUrlGeneratorCreateStep2($this->generatorGroup->getName(), $this->slider['id'], $this->groupID));
$this->layout->addBreadcrumb($this->generatorSource->getLabel(), '');
$topBar = new BlockTopBarMain($this);
$buttonSave = new BlockButtonSave($this);
$buttonSave->addClass('n2_generator_add');
$buttonSave->setLabel(n2_('Add'));
$topBar->addPrimaryBlock($buttonSave);
$buttonCancel = new BlockButtonCancel($this);
$buttonCancel->addClass('n2_generator_add_cancel');
$buttonCancel->setUrl($this->getUrlSliderEdit($this->slider['id'], $this->groupID));
$topBar->addPrimaryBlock($buttonCancel);
$this->layout->setTopBar($topBar->toHTML());
$blockHeader = new BlockHeader($this);
$blockHeader->setHeading(n2_('Add dynamic slides') . ': ' . $this->generatorGroup->getLabel() . ' - ' . $this->generatorSource->getLabel());
$this->layout->addContentBlock($blockHeader);
$this->layout->addContent($this->render('CreateStep4Settings'));
$this->layout->render();
}
/**
* @param int $groupID
* @param string $groupTitle
*/
public function setGroupData($groupID, $groupTitle) {
$this->groupID = $groupID;
$this->groupTitle = $groupTitle;
}
/**
* @return array
*/
public function getSlider() {
return $this->slider;
}
/**
* @return int
*/
public function getGroupID() {
return $this->groupID;
}
/**
* @param array $slider
*/
public function setSlider($slider) {
$this->slider = $slider;
}
/**
* @return integer
*/
public function getSliderID() {
return $this->slider['id'];
}
/**
* @return AbstractGeneratorGroup
*/
public function getGeneratorGroup() {
return $this->generatorGroup;
}
/**
* @param AbstractGeneratorGroup $generatorGroup
*/
public function setGeneratorGroup($generatorGroup) {
$this->generatorGroup = $generatorGroup;
}
/**
* @return AbstractGenerator
*/
public function getGeneratorSource() {
return $this->generatorSource;
}
/**
* @param AbstractGenerator $generatorSource
*/
public function setGeneratorSource($generatorSource) {
$this->generatorSource = $generatorSource;
}
public function displayForm() {
$form = new Form($this, 'generator');
new Token($form->getFieldsetHidden());
$this->generatorSource->renderFields($form->getContainer());
$generatorModel = new ModelGenerator($this);
$generatorModel->renderFields($form->getContainer());
$form->render();
}
}

View File

@ -0,0 +1,207 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Generator;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Form\Element\Token;
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\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\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Application\Model\ModelGenerator;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
class ViewGeneratorEdit extends AbstractView {
use TraitAdminUrl;
protected $groupID;
protected $groupTitle;
/** @var array */
protected $slider;
/** @var array */
protected $slide;
/** @var array */
protected $generator;
/** @var AbstractGeneratorGroup */
protected $generatorGroup;
/** @var AbstractGenerator */
protected $generatorSource;
public function display() {
$this->layout = new LayoutDefault($this);
if ($this->groupID) {
$this->layout->addBreadcrumb(Sanitize::esc_html($this->groupTitle), 'ssi_16 ssi_16--folderclosed', $this->getUrlSliderEdit($this->groupID));
}
$this->layout->addBreadcrumb(Sanitize::esc_html($this->slider['title']), 'ssi_16 ssi_16--image', $this->getUrlSliderEdit($this->getSliderID(), $this->groupID));
$this->layout->addBreadcrumb(n2_('Slide'), 'ssi_16 ssi_16--slides', $this->getUrlSlideEdit($this->slide['id'], $this->getSliderID(), $this->groupID));
$this->layout->addBreadcrumb(n2_('Generator'), 'ssi_16 ssi_16--cog');
$topBar = new BlockTopBarMain($this);
$buttonSave = new BlockButtonSave($this);
$buttonSave->addClass('n2_button--inactive');
$buttonSave->addClass('n2_generator_settings_save');
$topBar->addPrimaryBlock($buttonSave);
$buttonBack = new BlockButtonBack($this);
$buttonBack->setUrl($this->getUrlSlideEdit($this->slide['id'], $this->getSliderID(), $this->groupID));
$buttonBack->addClass('n2_generator_settings_back');
$topBar->addPrimaryBlock($buttonBack);
$buttonPreview = new BlockButtonPlainIcon($this);
$buttonPreview->addAttribute('id', 'n2-ss-preview');
$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->layout->setTopBar($topBar->toHTML());
$blockHeader = new BlockHeader($this);
$blockHeader->setHeading(n2_('Generator') . ': ' . $this->generatorGroup->getLabel() . ' - ' . $this->generatorSource->getLabel());
$this->layout->addContentBlock($blockHeader);
$this->layout->addContent($this->render('Edit'));
$this->layout->render();
}
public function renderForm() {
$params = new Data($this->generator['params'], true);
$slideParams = new Data($this->slide['params'], true);
$params->set('record-slides', $slideParams->get('record-slides', 1));
$form = new Form($this, 'generator');
new Token($form->getFieldsetHidden());
$form->loadArray($params->toArray());
$this->generatorSource->renderFields($form->getContainer());
$generatorModel = new ModelGenerator($this);
$generatorModel->renderFields($form->getContainer());
$form->render();
}
/**
* @param int $groupID
* @param string $groupTitle
*/
public function setGroupData($groupID, $groupTitle) {
$this->groupID = $groupID;
$this->groupTitle = $groupTitle;
}
/**
* @return array
*/
public function getSlider() {
return $this->slider;
}
/**
* @param array $slider
*/
public function setSlider($slider) {
$this->slider = $slider;
}
/**
* @return integer
*/
public function getSliderID() {
return $this->slider['id'];
}
/**
* @return mixed
*/
public function getGroupID() {
return $this->groupID;
}
/**
* @return array
*/
public function getSlide() {
return $this->slide;
}
/**
* @param array $slide
*/
public function setSlide($slide) {
$this->slide = $slide;
}
/**
* @return array
*/
public function getGenerator() {
return $this->generator;
}
/**
* @param array $generator
*/
public function setGenerator($generator) {
$this->generator = $generator;
}
/**
* @return AbstractGeneratorGroup
*/
public function getGeneratorGroup() {
return $this->generatorGroup;
}
/**
* @param AbstractGeneratorGroup $generatorGroup
*/
public function setGeneratorGroup($generatorGroup) {
$this->generatorGroup = $generatorGroup;
}
/**
* @return AbstractGenerator
*/
public function getGeneratorSource() {
return $this->generatorSource;
}
/**
* @param AbstractGenerator $generatorSource
*/
public function setGeneratorSource($generatorSource) {
$this->generatorSource = $generatorSource;
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\GoPro\BlockAlreadyPurchased;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var BlockAlreadyPurchased $this
*/
?>
<div class="n2_page_free_go_pro_already_purchased">
<div class="n2_page_free_go_pro_already_purchased__logo">
<i class="ssi_48 ssi_48--protect"></i>
</div>
<div class="n2_page_free_go_pro_already_purchased__heading">
<?php n2_e('How to upgrade to Smart Slider 3 Pro?'); ?>
</div>
<div class="n2_page_free_go_pro_already_purchased__paragraph">
<?php echo sprintf(n2_('After making your purchase, %1$slog in to your account%3$s and download the Pro installer. To get started with Smart Slider 3 Pro, simply %2$sinstall it on your website%3$s.'), '<a href="' . esc_url(SmartSlider3Info::decorateExternalUrl('https://secure.nextendweb.com/', array('utm_source' => 'already-purchased'))) . '" target="_blank">', '<a href="https://smartslider.helpscoutdocs.com/category/1696-installation" target="_blank">', '</a>'); ?>
</div>
<a href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://secure.nextendweb.com/', array('utm_source' => 'already-purchased'))); ?>" target="_blank" class="n2_page_free_go_pro_already_purchased__button">
<?php n2_e('Download Pro'); ?>
</a>
<div class="n2_page_free_go_pro_already_purchased__paragraph">
<?php n2_e('Feel free to remove the Free version, as you no longer need it. Your sliders will stay!'); ?>
</div>
</div>

View File

@ -0,0 +1,12 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\GoPro\BlockAlreadyPurchased;
use Nextend\Framework\View\AbstractBlock;
class BlockAlreadyPurchased extends AbstractBlock {
public function display() {
$this->renderTemplatePart('AlreadyPurchased');
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\GoPro;
use Nextend\SmartSlider3\Application\Admin\AbstractControllerAdmin;
class ControllerGoPro extends AbstractControllerAdmin {
public function actionIndex() {
$view = new ViewGoProIndex($this);
$view->display();
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\GoPro;
use Nextend\SmartSlider3\Application\Admin\GoPro\BlockAlreadyPurchased\BlockAlreadyPurchased;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes\BlockDashboardUpgradePro;
/**
* @var $this ViewGoProIndex
*/
?>
<div class="n2_page_free_go_pro">
<div class="n2_page_free_go_pro__col">
<div class="n2_page_free_go_pro__heading">
<?php n2_e('Ready to go Pro?'); ?>
</div>
<div class="n2_page_free_go_pro__subheading">
<?php n2_e('Supercharge Smart Slider 3 with powerful functionality!'); ?>
</div>
<?php
$upgradePro = new BlockDashboardUpgradePro($this);
$upgradePro->setHasDismiss(false);
$upgradePro->setSource('page-go-pro');
$upgradePro->display();
?>
</div>
<div class="n2_page_free_go_pro__col">
<div class="n2_page_free_go_pro__heading">
<?php n2_e('Already purchased?'); ?>
</div>
<div class="n2_page_free_go_pro__subheading">
<?php n2_e('Get started with the Pro version now!'); ?>
</div>
<?php
$alreadyPurchased = new BlockAlreadyPurchased($this);
$alreadyPurchased->display();
?>
</div>
</div>

View File

@ -0,0 +1,30 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\GoPro;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
class ViewGoProIndex extends AbstractView {
use TraitAdminUrl;
public function __construct($controller) {
parent::__construct($controller);
}
public function display() {
$this->layout = new LayoutDefault($this);
$this->layout->addBreadcrumb(n2_('Go Pro'));
$this->layout->addContent($this->render('Index'));
$this->layout->render();
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Help;
use Nextend\Framework\Api;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Application\Admin\AbstractControllerAdmin;
use WP_HTTP_Proxy;
class ControllerHelp extends AbstractControllerAdmin {
public function actionIndex() {
$view = new ViewHelpIndex($this);
$view->display();
}
public function actionBrowserIncompatible() {
$view = new ViewHelpBrowserIncompatible($this);
$view->display();
}
public function actionTestApi() {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, Api::getApiUrl());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$errorFile = dirname(__FILE__) . '/curl_error.txt';
$out = fopen($errorFile, "w");
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $out);
$proxy = new WP_HTTP_Proxy();
if ($proxy->is_enabled() && $proxy->send_through_proxy(Api::getApiUrl())) {
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY, $proxy->host());
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy->port());
if ($proxy->use_authentication()) {
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy->authentication());
}
}
$output = curl_exec($ch);
curl_close($ch);
fclose($out);
$log = array("API Connection Test");
$log[] = htmlspecialchars(file_get_contents($errorFile));
unlink($errorFile);
if (!empty($output)) {
$log[] = "RESPONSE: " . htmlspecialchars($output);
}
if (strpos($output, 'ACTION_MISSING') === false) {
Notification::error(sprintf(n2_('Unable to connect to the API (%1$s). %2$s See %3$sDebug Information%4$s for more details!'), Api::getApiUrl(), '<br>', '<b>', '</b>'));
} else {
Notification::notice(n2_('Successful connection with the API.'));
}
$log[] = '------------------------------------------';
$log[] = '';
StorageSectionManager::getStorage('smartslider')
->set('log', 'api', json_encode($log));
$this->redirect($this->getUrlHelp());
}
}

View File

@ -0,0 +1,284 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Help;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Request\Request;
use Nextend\Framework\Sanitize;
use Nextend\Framework\Url\Url;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var $this ViewHelpIndex
*/
$conflicts = $this->getConflicts();
?>
<div class="n2_help_center">
<div class="n2_help_center__getting_started">
<div class="n2_help_center__getting_started__heading">
<?php n2_e('Welcome to Help Center'); ?>
</div>
<div class="n2_help_center__getting_started__subheading">
<?php n2_e('To help you get started, we\'ve put together a super tutorial video that shows you the basic settings.'); ?>
</div>
<div class="n2_help_center__getting_started__video">
<div class="n2_help_center__getting_started__video_placeholder"></div>
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/videoseries?list=PLSawiBnEUNfvVeY7M8Yx7UdyOpBEmoH7Z&rel=0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
</div>
<?php
if (!empty($conflicts)) {
?>
<div class="n2_help_center__conflicts" id="n2_help_center__possible_conflicts">
<div class="n2_help_center__conflicts_icon"><i class="ssi_48 ssi_48--bug"></i></div>
<div class="n2_help_center__conflicts_label"><?php n2_e('Possible conflicts'); ?></div>
<div class="n2_help_center__conflicts_description">
<div class="n2_help_center__conflicts_test_api">
<a href="<?php echo esc_url($this->getUrlHelpTestApi()); ?>">
<?php n2_e('Test connection'); ?>
</a>
</div>
<?php
?>
<?php if (empty($conflicts)): ?>
<div class="n2_help_center__no_conflicts_detected"><?php n2_e('No conflicts detected.'); ?></div>
<?php else: ?>
<?php foreach ($conflicts as $conflict): ?>
<div class="n2_help_center__conflicts_detected"><?php echo wp_kses($conflict, Sanitize::$basicTags); ?></div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<?php
}
?>
<div class="n2_help_center__search">
<div class="n2_help_center__search_heading">
<?php n2_e('Hello! How can we help you today?'); ?>
</div>
<div class="n2_help_center__search_field">
<form target="_blank" action="https://smartslider.helpscoutdocs.com/search" method="get">
<input name="query" type="text" placeholder="<?php n2_e('Search in the knowledge base'); ?>">
<button type="submit"><?php n2_e('Search'); ?></button>
</form>
</div>
</div>
<div class="n2_help_center__actions">
<div class="n2_help_center__action">
<a class="n2_help_center__action_link"
href="<?php echo esc_url('https://smartslider.helpscoutdocs.com/?utm_campaign=' . SmartSlider3Info::$campaign . '&utm_source=dashboard-documentation&utm_medium=smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan); ?>"
target="_blank"></a>
<div class="n2_help_center__action_icon"><i class="ssi_48 ssi_48--doc"></i></div>
<div class="n2_help_center__action_label"><?php n2_e('Documentation'); ?></div>
<div class="n2_help_center__action_description"><?php n2_e('To get started with Smart Slider 3, please refer to this guide for downloading, installing, and using.'); ?></div>
</div>
<div class="n2_help_center__action">
<a class="n2_help_center__action_link" href="https://smartslider3.com/contact-us/support/"
onclick="document.getElementById('n2_support_form').submit(); return false;"></a>
<div class="n2_help_center__action_icon"><i class="ssi_48 ssi_48--help"></i></div>
<div class="n2_help_center__action_label"><?php n2_e('Email support'); ?></div>
<div class="n2_help_center__action_description"><?php n2_e('Need one-to-one assistance? Get in touch with our Support team! We\'d love the opportunity to help you.'); ?></div>
</div>
<div class="n2_help_center__action">
<a class="n2_help_center__action_link"
href="<?php echo esc_url('https://www.youtube.com/watch?v=3PPtkRU7D74&list=PLSawiBnEUNfvVeY7M8Yx7UdyOpBEmoH7Z&utm_campaign=' . SmartSlider3Info::$campaign . '&utm_source=dashboard-watch-videos&utm_medium=smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan); ?>"
target="_blank"></a>
<div class="n2_help_center__action_icon"><i class="ssi_48 ssi_48--camera"></i></div>
<div class="n2_help_center__action_label"><?php n2_e('Tutorial videos'); ?></div>
<div class="n2_help_center__action_description"><?php n2_e('Check our video tutorials which cover everything you need to know about Smart Slider 3.'); ?></div>
</div>
</div>
<div class="n2_help_center__articles_heading">
<?php n2_e('Selected articles'); ?>
</div>
<div class="n2_help_center__articles">
<?php
foreach ($this->getArticles() as $article) {
?>
<div class="n2_help_center__article">
<a class="n2_help_center__article_link" href="<?php echo esc_url($article['url']); ?>" target="_blank"></a>
<div class="n2_help_center__article_label"><?php echo esc_html($article['label']); ?></div>
<i class="ssi_16 ssi_16--breadcrumb n2_help_center__article_icon"></i>
</div>
<?php
}
?>
</div>
<?php
if (empty($conflicts)) {
?>
<div class="n2_help_center__conflicts" id="n2_help_center__possible_conflicts">
<div class="n2_help_center__conflicts_icon"><i class="ssi_48 ssi_48--bug"></i></div>
<div class="n2_help_center__conflicts_label"><?php n2_e('Possible conflicts'); ?></div>
<div class="n2_help_center__conflicts_description">
<div class="n2_help_center__conflicts_test_api">
<a href="<?php echo esc_url($this->getUrlHelpTestApi()); ?>">
<?php n2_e('Test connection'); ?>
</a>
</div>
<?php
?>
<?php if (empty($conflicts)): ?>
<div class="n2_help_center__no_conflicts_detected"><?php n2_e('No conflicts detected.'); ?></div>
<?php else: ?>
<?php foreach ($conflicts as $conflict): ?>
<div class="n2_help_center__conflicts_detected"><?php echo wp_kses($conflict, Sanitize::$basicTags); ?></div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<?php
}
?>
<?php
?>
<div class="n2_help_center__system_information">
<div class="n2_help_center__system_information_label">
<?php n2_e('Debug information'); ?>
</div>
<form id="n2_support_form" class="n2_help_center__system_information_form" method="post"
action="https://smartslider3.com/contact-us/support/" target="_blank">
<?php
$debug = array(
'Smart Slider 3 - version: ' . SmartSlider3Info::$completeVersion,
'Plan: ' . SmartSlider3Info::$plan,
'Platform: ' . Platform::getLabel() . ' - ' . Platform::getVersion(),
'Site url: ' . Platform::getSiteUrl(),
'Path: ' . Filesystem::getBasePath(),
'Uri: ' . Url::getBaseUri(),
'Browser: ' . Request::$SERVER->getVar('HTTP_USER_AGENT'),
''
);
$curlLog = $this->getCurlLog();
if (!empty($curlLog)) {
$debug = array_merge($debug, $curlLog);
$debug[] = '';
}
if (function_exists('ini_get')) {
$debug[] = 'PHP: ' . phpversion();
$debug[] = 'PHP - memory_limit: ' . ini_get('memory_limit');
$debug[] = 'PHP - max_input_vars: ' . ini_get('max_input_vars');
$opcache = ini_get('opcache.enable');
$debug[] = 'PHP - opcache.enable: ' . intval($opcache);
if ($opcache) {
$debug[] = 'PHP - opcache.revalidate_freq: ' . ini_get('opcache.revalidate_freq');
}
$debug[] = '';
}
if (extension_loaded('gd')) {
$debug[] = 'GD modules status:';
foreach (gd_info() as $module => $status) {
$debug[] = $module . ' : ' . (!empty($status) ? $status : "0");
}
}
$debug[] = '';
if (function_exists('get_loaded_extensions')) {
$debug[] = 'Uncommon PHP extensions:';
$debug[] = implode(" \t", array_diff(get_loaded_extensions(), array(
'Core',
'openssl',
'pcre',
'zlib',
'SPL',
'session',
'standard',
'cgi-fcgi',
'mysqlnd',
'PDO',
'bz2',
'calendar',
'filter',
'hash',
'Reflection',
'zip',
'Zend OPcache',
'shmop',
'sodium',
'date',
'dom',
'ctype',
'xml',
'libxml',
'fileinfo',
'ftp',
'gettext',
'iconv',
'intl',
'json',
'exif',
'mysqli',
'pdo_mysql',
'Phar',
'posix',
'readline',
'SimpleXML',
'soap',
'sockets',
'sysvmsg',
'sysvsem',
'sysvshm',
'tokenizer',
'wddx',
'xmlreader',
'xmlwriter',
'xsl'
)));
$debug[] = '';
}
$debugConflicts = $this->getDebugConflicts();
if (empty($debugConflicts)) {
$debug[] = 'No conflicts detected';
} else {
$debug[] = 'Conflicts:';
foreach ($debugConflicts as $conflict) {
$debug[] = ' - ' . $conflict;
}
$debug[] = '';
}
$debug = array_merge($debug, Platform::getDebug());
?>
<textarea readonly name="debug_information"
style="width:100%;height:800px;"><?php echo esc_html(implode("\n", $debug)); ?></textarea>
</form>
</div>
</div>

View File

@ -0,0 +1,28 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Help;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutError;
class ViewHelpBrowserIncompatible extends AbstractView {
public function display() {
$this->layout = new LayoutError($this);
$browsers = array(
sprintf(n2_('%s or later'), 'Chrome 68'),
sprintf(n2_('%s or later'), 'Firefox 52'),
sprintf(n2_('%s or later'), 'Safari 10'),
sprintf(n2_('%s or later'), 'Opera 55'),
sprintf(n2_('%s or later'), 'Edge 18'),
);
$this->layout->setError(n2_('You are using an unsupported browser!'), sprintf(n2_('Smart Slider 3 does not support your current browser for editing. Supported browsers are the following: %s.'), implode(', ', $browsers)), 'https://smartslider.helpscoutdocs.com/article/1716-system-requirements');
$this->layout->render();
}
}

View File

@ -0,0 +1,113 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Help;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Conflict\Conflict;
class ViewHelpIndex extends AbstractView {
use TraitAdminUrl;
/** @var Conflict */
protected $conflict;
public function __construct($controller) {
parent::__construct($controller);
$this->conflict = Conflict::getInstance();
}
public function display() {
$this->layout = new LayoutDefault($this);
$this->layout->addBreadcrumb(n2_('Help center'), '', $this->getUrlHelp());
$this->layout->addContent($this->render('Index'));
$this->layout->render();
}
public function getConflicts() {
return $this->conflict->getConflicts();
}
public function getDebugConflicts() {
return $this->conflict->getDebugConflicts();
}
public function getCurlLog() {
return $this->conflict->getCurlLog();
}
/**
* @return array
*/
public function getArticles() {
$arr = array(
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1923-free-vs-pro',
'label' => 'Free vs Pro'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1918-upgrading-from-free-to-pro',
'label' => 'How to update to the Pro version?'
)
);
return array_merge($arr, array(
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1916-slide-editing-in-smart-slider-3#why-is-the-slider-so-tall-on-mobile',
'label' => 'Why is the slider tall on mobile?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1916-slide-editing-in-smart-slider-3',
'label' => 'Slide editing in Smart Slider 3'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1922-how-to-set-your-background-image#cropped',
'label' => 'Why are my images cropped?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1924-how-to-add-a-video',
'label' => 'How can I add a video?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1807-slider-settings-autoplay',
'label' => 'Where is the autoplay?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1919-video-autoplay-handling',
'label' => 'Why isn\'t my video autoplaying?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1925-how-to-speed-up-your-site',
'label' => 'How can I speed up my site?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/category/1699-publishing',
'label' => 'How can I publish my sliders?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1828-using-your-own-fonts',
'label' => 'How to use different fonts in the slider?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/article/1725-dynamic-slide-basics',
'label' => 'What is a dynamic slide?'
),
array(
'url' => 'https://smartslider.helpscoutdocs.com/collection/1712-troubleshooting',
'label' => 'Troubleshooting'
)
));
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,79 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Request\Request;
use Nextend\Framework\View\AbstractLayout;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\NavBar\BlockNavBar;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\SmartSlider3Info;
abstract class AbstractLayoutMenu extends AbstractLayout {
use TraitAdminUrl;
/** @var BlockNavBar */
protected $header;
protected $classes = array();
public function __construct($view) {
$this->header = new BlockNavBar($this);
parent::__construct($view);
$this->header->setLogo($this->getApplicationType()
->getLogo());
$this->header->setSidebarLink($this->getUrlDashboard());
$cmd = Request::$REQUEST->getVar("nextendcontroller", "sliders");
$this->header->addMenuItem(Html::link(n2_('Go Pro'), SmartSlider3Info::getProUrlPricing(array(
'utm_source' => 'go-pro-button-top-menu',
'utm_medium' => 'smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan,
'utm_campaign' => SmartSlider3Info::$campaign
)), array(
'target' => '_blank'
)));
$this->header->addMenuItem(Html::link(n2_('Settings'), $this->getUrlSettingsDefault()), $cmd == "settings");
$this->header->addMenuItem(Html::link(n2_('Help'), $this->getUrlHelp()), $cmd == "help");
}
public function addHeaderMenuItem($item) {
$this->header->addMenuItem($item);
}
/**
* @param $label
* @param $icon
* @param string $url
*
* @return Helper\Breadcrumb
*/
public function addBreadcrumb($label, $icon = '', $url = '#') {
return $this->header->addBreadcrumb($label, $icon, $url);
}
public function getHeader() {
return $this->header->toHTML();
}
public function getClasses() {
return $this->classes;
}
public function addClass($class) {
$this->classes[] = $class;
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Admin;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Plugin;
use Nextend\Framework\Sanitize;
use Nextend\SmartSlider3\Settings;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var $this BlockAdmin
*/
?>
<div <?php $this->renderAttributes(); ?>>
<div class="n2_admin__header">
<?php echo wp_kses($this->getHeader(), Sanitize::$adminTemplateTags); ?>
</div>
<div class="n2_admin__content">
<?php echo wp_kses($this->getSubNavigation(), Sanitize::$adminTemplateTags); ?>
<?php $this->displayTopBar(); ?>
<?php $this->displayContent(); ?>
</div>
<?php
Plugin::doAction('afterApplicationContent');
?>
</div>
<?php
Notification::show();

View File

@ -0,0 +1,129 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Admin;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\AbstractLayout;
use Nextend\Framework\View\Html;
class BlockAdmin extends AbstractBlock {
/**
* @var AbstractLayout
*/
protected $layout;
protected $id = 'n2-admin';
protected $classes = array(
'n2',
'n2_admin',
'n2_admin_ui',
'fitvidsignore'
);
protected $attributes = array();
protected $header = '';
protected $subNavigation = '';
/**
* @var string
*/
protected $topBar = '';
/**
* @param AbstractLayout $layout
*/
public function setLayout($layout) {
$this->layout = $layout;
}
public function displayContent() {
$this->layout->displayContent();
}
public function display() {
$this->renderTemplatePart('Admin');
}
/**
* @return string
*/
public function getClass() {
$this->classes = array_unique($this->classes);
return implode(' ', $this->classes);
}
/**
* @param array $classes
*/
public function addClasses($classes) {
$this->classes += $classes;
}
/**
* @return string
*/
public function getHeader() {
return $this->header;
}
/**
* @param string $header
*/
public function setHeader($header) {
$this->header = $header;
}
/**
* @return string
*/
public function getSubNavigation() {
return $this->subNavigation;
}
/**
* @param string $subNavigation
*/
public function setSubNavigation($subNavigation) {
$this->subNavigation = $subNavigation;
}
public function displayTopBar() {
echo wp_kses($this->topBar, Sanitize::$adminTemplateTags);
}
/**
* @param string $topBar
*/
public function setTopBar($topBar) {
$this->topBar = $topBar;
}
/**
* @param string $content
*/
public function setContent($content) {
$this->content = $content;
}
public function setAttribute($name, $value) {
$this->attributes[$name] = $value;
}
public function renderAttributes() {
echo wp_kses(Html::renderAttributes($this->attributes + array(
'id' => $this->id,
'class' => implode(' ', $this->classes)
)), Sanitize::$adminTemplateTags);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminEditor;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Settings;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var $this BlockAdminEditor
*/
?>
<div <?php $this->renderAttributes(); ?>>
<?php $this->displayEditorOverlay(); ?>
<div class="n2_admin_editor__content">
<div class="n2_admin_editor__content_inner" dir="ltr">
<?php $this->displayContent(); ?>
</div>
</div>
<?php
Plugin::doAction('afterApplicationContent');
?>
</div>
<?php
Notification::show();

View File

@ -0,0 +1,76 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminEditor;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slide\EditorOverlay\BlockEditorOverlay;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutEditor;
class BlockAdminEditor extends AbstractBlock {
/**
* @var LayoutEditor
*/
protected $layout;
protected $id = 'n2-admin';
protected $classes = array(
'n2',
'n2_admin',
'n2_admin_ui',
'n2_admin_editor',
'fitvidsignore'
);
protected $attributes = array();
/**
* @var BlockEditorOverlay
*/
protected $editorOverlay;
/**
* @param LayoutEditor $layout
*/
public function setLayout($layout) {
$this->layout = $layout;
}
public function displayContent() {
$this->layout->displayContent();
}
public function display() {
$this->renderTemplatePart('AdminEditor');
}
public function setAttribute($name, $value) {
$this->attributes[$name] = $value;
}
public function renderAttributes() {
echo wp_kses(Html::renderAttributes($this->attributes + array(
'id' => $this->id,
'class' => implode(' ', $this->classes)
)), Sanitize::$adminTemplateTags);
}
public function displayEditorOverlay() {
$this->editorOverlay->display();
}
/**
* @param BlockEditorOverlay $editorOverlay
*/
public function setEditorOverlay($editorOverlay) {
$this->editorOverlay = $editorOverlay;
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminEmpty;
use Nextend\SmartSlider3\Settings;
/**
* @var $this BlockAdminEmpty
*/
?>
<div <?php $this->renderAttributes(); ?>>
<?php $this->displayContent(); ?>
</div>

View File

@ -0,0 +1,54 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminEmpty;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\AbstractLayout;
use Nextend\Framework\View\Html;
class BlockAdminEmpty extends AbstractBlock {
/**
* @var AbstractLayout
*/
protected $layout;
protected $id = 'n2-admin';
protected $classes = array(
'n2',
'n2_admin',
'n2_admin_ui',
'n2_admin--empty',
'fitvidsignore'
);
protected $attributes = array();
/**
* @param AbstractLayout $layout
*/
public function setLayout($layout) {
$this->layout = $layout;
}
public function displayContent() {
$this->layout->displayContent();
}
public function display() {
$this->renderTemplatePart('AdminEmpty');
}
public function renderAttributes() {
echo wp_kses(Html::renderAttributes($this->attributes + array(
'id' => $this->id,
'class' => implode(' ', $this->classes)
)), Sanitize::$adminTemplateTags);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminError;
/**
* @var $this BlockAdminError
*/
?>
<div style="margin: 20px;width: 500px;border: 2px solid #1D81F9;background-color: #FFFFFF;border-radius: 5px;padding: 40px 50px;">
<div style="font-size: 18px;line-height: 28px;font-weight: bold;color: #283F4D;">
<?php
echo esc_html($this->getTitle());
?>
</div>
<div style="font-size: 14px;line-height: 24px;color: #325C77;">
<?php
echo esc_html($this->getContent());
?>
</div>
<?php if ($this->hasUrl()): ?>
<div style="margin-top: 10px;">
<a href="<?php echo esc_url($this->getUrl()); ?>" target="_blank" style="font-size: 14px;line-height: 24px;color: #1375E9;text-decoration: none;text-transform: capitalize"><?php n2_e('Read more'); ?></a>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,69 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminError;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\AbstractLayout;
class BlockAdminError extends AbstractBlock {
/**
* @var AbstractLayout
*/
protected $layout;
protected $title, $content, $url = '';
/**
* @param AbstractLayout $layout
*/
public function setLayout($layout) {
$this->layout = $layout;
}
public function setError($title, $content, $url = '') {
$this->title = $title;
$this->content = $content;
$this->url = $url;
}
public function displayContent() {
$this->layout->displayContent();
}
public function display() {
$this->renderTemplatePart('AdminError');
}
/**
* @return string
*/
public function getTitle() {
return $this->title;
}
/**
* @return string
*/
public function getContent() {
return $this->content;
}
/**
* @return bool
*/
public function hasUrl() {
return !empty($this->url);
}
/**
* @return string
*/
public function getUrl() {
return $this->url;
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminIframe;
use Nextend\SmartSlider3\Settings;
/**
* @var $this BlockAdminIframe
*/
?>
<div <?php $this->renderAttributes(); ?>>
<div class="n2_iframe_application__nav_bar">
<div class="n2_iframe_application__nav_bar_label">
<?php echo esc_html($this->getLabel()); ?>
</div>
<div class="n2_iframe_application__nav_bar_actions">
<?php
foreach ($this->getActions() as $action) {
$action->display();
}
?>
</div>
</div>
<div class="n2_iframe_application__content">
<?php $this->displayContent(); ?>
</div>
</div>

View File

@ -0,0 +1,111 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\AdminIframe;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\AbstractLayout;
use Nextend\Framework\View\Html;
class BlockAdminIframe extends AbstractBlock {
/**
* @var AbstractLayout
*/
protected $layout;
protected $id = 'n2-admin';
protected $classes = array(
'n2',
'n2_admin',
'n2_admin_ui',
'n2_iframe_application',
'fitvidsignore'
);
protected $attributes = array();
protected $label = '';
/**
* @var AbstractBlock[]
*/
protected $actions = array();
/**
* @param AbstractLayout $layout
*/
public function setLayout($layout) {
$this->layout = $layout;
}
public function displayContent() {
$this->layout->displayContent();
}
public function display() {
$this->renderTemplatePart('AdminIframe');
}
/**
* @return string
*/
public function getLabel() {
return $this->label;
}
/**
* @param string $label
*/
public function setLabel($label) {
$this->label = $label;
}
/**
* @return AbstractBlock[]
*/
public function getActions() {
return $this->actions;
}
/**
* @param AbstractBlock[] $actions
*/
public function setActions($actions) {
$this->actions = $actions;
}
/**
* @return string
*/
public function getClass() {
$this->classes = array_unique($this->classes);
return implode(' ', $this->classes);
}
/**
* @param array $classes
*/
public function addClasses($classes) {
$this->classes += $classes;
}
public function setAttribute($name, $value) {
$this->attributes[$name] = $value;
}
public function renderAttributes() {
echo wp_kses(Html::renderAttributes($this->attributes + array(
'id' => $this->id,
'class' => implode(' ', $this->classes)
)), Sanitize::$adminTemplateTags);
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Banner;
/**
* @var $this BlockBanner
*/
$closeUrl = $this->getCloseUrl();
?>
<div id="<?php echo esc_attr($this->getID()); ?>" class="n2_admin__banner">
<div class="n2_admin__banner_inner">
<img src="<?php echo esc_url($this->getImage()); ?>" alt="">
<div class="n2_admin__banner_inner_title"><?php echo esc_attr($this->getTitle()); ?></div>
<div class="n2_admin__banner_inner_description"><?php echo esc_attr($this->getDescription()); ?></div>
<a class="n2_admin__banner_inner_button n2_button n2_button--big n2_button--green"
href="<?php echo esc_url($this->getButtonHref()); ?>"
onclick="<?php echo esc_js($this->getButtonOnclick()); ?>"
target="_blank">
<?php echo esc_html($this->getButtonTitle()); ?>
</a>
</div>
<?php if (!empty($closeUrl)): ?>
<div class="n2_admin__banner_close">
<i class="ssi_16 ssi_16--remove"></i>
</div>
<script>
_N2.r(['$', 'documentReady'], function () {
var $ = _N2.$;
var $banner = $('#<?php echo esc_html($this->getID()); ?>');
$banner.find('.n2_admin__banner_close').on('click', function (e) {
e.preventDefault();
_N2.AjaxHelper.ajax({url: <?php echo json_encode(esc_url($closeUrl)); ?>});
$banner.remove();
});
});
</script>
<?php endif; ?>
</div>

View File

@ -0,0 +1,136 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Banner;
use Nextend\Framework\View\AbstractBlock;
class BlockBanner extends AbstractBlock {
protected $id = '';
protected $image = 'ssi_64 ssi_64--dummy';
protected $title = '';
protected $description = '';
protected $buttonTitle = '';
protected $buttonHref = '#';
protected $buttonOnclick = '';
protected $closeUrl = '';
public function display() {
$this->renderTemplatePart('Banner');
}
/**
* @return string
*/
public function getID() {
return $this->id;
}
/**
* @param $id
*/
public function setID($id) {
$this->id = $id;
}
/**
* @return string
*/
public function getImage() {
return $this->image;
}
/**
* @param $image
*/
public function setImage($image) {
$this->image = $image;
}
/**
* @return string
*/
public function getTitle() {
return $this->title;
}
/**
* @param $title
*/
public function setTitle($title) {
$this->title = $title;
}
/**
* @return string
*/
public function getDescription() {
return $this->description;
}
/**
* @param $description
*/
public function setDescription($description) {
$this->description = $description;
}
/**
* @return string
*/
public function getCloseUrl() {
return $this->closeUrl;
}
/**
* @param $closeUrl
*/
public function setCloseUrl($closeUrl) {
$this->closeUrl = $closeUrl;
}
/**
* @return string
*/
public function getButtonTitle() {
return $this->buttonTitle;
}
/**
* @return string
*/
public function getButtonHref() {
return $this->buttonHref;
}
/**
* @return string
*/
public function getButtonOnclick() {
return $this->buttonOnclick;
}
/**
* @param $button
*/
public function setButton($button) {
$this->buttonTitle = $button['title'];
if (isset($button['href'])) {
$this->buttonHref = $button['href'];
}
if (isset($button['onclick'])) {
$this->buttonOnclick = $button['onclick'];
}
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Banner;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
class BlockBannerActivate extends BlockBanner {
protected function init() {
$this->setID('n2-ss-activate-license-banner');
$this->setImage(ResourceTranslator::toUrl('$ss3-admin$/images/activate.svg'));
$this->setTitle(n2_('Activate Smart Slider 3 Pro'));
$this->setDescription(n2_('Activation is required to unlock all features!') . ' ' . n2_('Register Smart Slider 3 Pro on this domain to enable auto update, slider templates and slide library.'));
$this->setButton(array(
'title' => n2_('Activate'),
'onclick' => '_N2.License.get().startActivation();return false;'
));
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\BlockBreadCrumb;
use Nextend\Framework\View\AbstractBlock;
use Nextend\SmartSlider3\Application\Admin\Layout\Helper\Breadcrumb;
class BlockBreadCrumb extends AbstractBlock {
/**
* @var Breadcrumb[]
*/
protected $breadCrumbs = array();
public function display() {
$this->renderTemplatePart('BreadCrumb');
}
/**
* @return Breadcrumb[]
*/
public function getBreadCrumbs() {
/**
* If there is no activate item in the menu or in the breadcrumb, mark the last breadcrumb as active.
*/
if (!$this->hasActiveItem()) {
$this->breadCrumbs[count($this->breadCrumbs) - 1]->setIsActive(true);
}
return $this->breadCrumbs;
}
/**
* @param $label
* @param $icon
* @param string $url
*
* @return Breadcrumb
*/
public function addBreadcrumb($label, $icon, $url = '#') {
$breadCrumb = new Breadcrumb($label, $icon, $url);
$this->breadCrumbs[] = $breadCrumb;
return $breadCrumb;
}
private function hasActiveItem() {
foreach ($this->breadCrumbs as $breadCrumb) {
if ($breadCrumb->isActive()) {
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\BlockBreadCrumb;
/**
* @var $this BlockBreadCrumb
*/
?>
<div class="n2_breadcrumbs">
<?php
$breadcrumbs = $this->getBreadCrumbs();
$length = count($breadcrumbs);
foreach ($breadcrumbs as $i => $breadcrumb):
?>
<div class="n2_breadcrumbs__breadcrumb<?php echo $breadcrumb->isActive() ? ' n2_breadcrumbs__breadcrumb--active' : ''; ?>"><?php $breadcrumb->display(); ?></div>
<?php
if ($i < $length - 1):
?>
<div class="n2_breadcrumbs__arrow"><i class="ssi_16 ssi_16--breadcrumb"></i></div>
<?php
endif;
?>
<?php
endforeach;
?>
</div>

View File

@ -0,0 +1,49 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\ContentSidebar;
use Nextend\Framework\View\AbstractBlock;
class BlockContentSidebar extends AbstractBlock {
protected $sidebar = '';
protected $content = '';
public function display() {
$this->renderTemplatePart('ContentSidebar');
}
/**
* @return string
*/
public function getSidebar() {
return $this->sidebar;
}
/**
* @param string $sidebar
*/
public function setSidebar($sidebar) {
$this->sidebar = $sidebar;
}
/**
* @return string
*/
public function getContent() {
return $this->content;
}
/**
* @param string $content
*/
public function setContent($content) {
$this->content = $content;
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\ContentSidebar;
use Nextend\Framework\Sanitize;
/**
* @var $this BlockContentSidebar
*/
?>
<div class="n2-admin-content-with-sidebar">
<div class="n2-admin-content-with-sidebar__sidebar">
<?php
echo wp_kses($this->getSidebar(), Sanitize::$adminTemplateTags);
?>
</div>
<div class="n2-admin-content-with-sidebar__content">
<?php
echo wp_kses($this->getContent(), Sanitize::$adminTemplateTags);
?>
</div>
</div>

View File

@ -0,0 +1,31 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\FreeNeedMore;
use Nextend\Framework\View\AbstractBlock;
class BlockFreeNeedMore extends AbstractBlock {
protected $source;
public function display() {
$this->renderTemplatePart('FreeNeedMore');
}
/**
* @return string
*/
public function getSource() {
return $this->source;
}
/**
* @param string $source
*/
public function setSource($source) {
$this->source = $source;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\FreeNeedMore;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var $this BlockFreeNeedMore
*/
?>
<div class="n2_free_need_more">
<div class="n2_free_need_more__logo">
<img src="<?php echo esc_url(ResourceTranslator::toUrl('$ss3-admin$/images/logo-filled.svg')); ?>" alt="logo">
</div>
<div class="n2_free_need_more__title">
<?php n2_e('Need more?'); ?>
</div>
<div class="n2_free_need_more__paragraph">
<?php n2_e('Unlock all the pro features by upgrading to Smart Slider 3 Pro.'); ?>
</div>
<a href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://smartslider3.com/pricing/', array('utm_source' => $this->getSource()))); ?>" target="_blank" class="n2_free_need_more__button">
<?php n2_e('Go Pro'); ?>
</a>
</div>

View File

@ -0,0 +1,97 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Header;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
class BlockHeader extends AbstractBlock {
protected $heading = '';
protected $headingAfter = '';
protected $actions = array();
/**
* @var MenuItem[]
*/
protected $menuItems = array();
public function display() {
$this->renderTemplatePart('Header');
}
/**
* @return string
*/
public function getHeading() {
return $this->heading;
}
/**
* @param string $heading
*/
public function setHeading($heading) {
$this->heading = Sanitize::esc_html($heading);
}
/**
* @return string
*/
public function getHeadingAfter() {
return $this->headingAfter;
}
public function hasHeadingAfter() {
return !empty($this->headingAfter);
}
/**
* @param string $headingAfter
*/
public function setHeadingAfter($headingAfter) {
$this->headingAfter = $headingAfter;
}
/**
* @return array
*/
public function getActions() {
return $this->actions;
}
public function hasActions() {
return !empty($this->actions);
}
/**
* @param string $action
*/
public function addAction($action) {
$this->actions[] = $action;
}
/**
* @return MenuItem[]
*/
public function getMenuItems() {
return $this->menuItems;
}
public function hasMenuItems() {
return !empty($this->menuItems);
}
/**
* @param MenuItem $menuItem
*/
public function addMenuItem($menuItem) {
$this->menuItems[] = $menuItem;
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Header;
use Nextend\Framework\Sanitize;
/**
* @var $this BlockHeader
*/
?>
<div class="n2_header<?php echo $this->hasMenuItems() ? ' n2_header--has-menu-items' : ''; ?>">
<div class="n2_header__content">
<div class="n2_header__heading_container">
<div class="n2_header__heading">
<div class="n2_header__heading_primary">
<?php
echo esc_html($this->getHeading());
?>
</div>
<?php
if ($this->hasHeadingAfter()):
?>
<div class="n2_header__heading_after">
<?php
echo esc_html($this->getHeadingAfter());
?>
</div>
<?php
endif;
?>
</div>
</div>
<?php
if ($this->hasActions()):
?>
<div class="n2_header__actions">
<?php
echo wp_kses(implode('', $this->getActions()), Sanitize::$adminTemplateTags);
?>
</div>
<?php
endif;
?>
</div>
<?php
if ($this->hasMenuItems()):
?>
<div class="n2_header__menu">
<?php
foreach ($this->getMenuItems() as $menuItem) {
$menuItem->display();
}
?>
</div>
<?php
endif;
?>
</div>

View File

@ -0,0 +1,95 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Header;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
class MenuItem {
protected $isActive = false;
protected $label = '';
protected $url = '#';
protected $classes = array(
'n2_header__menu_item'
);
protected $attributes = array();
public function __construct($label) {
$this->label = $label;
}
public function getHtml() {
$attributes = $this->attributes;
if ($this->isActive) {
$this->classes[] = 'n2_header__menu_item--active';
}
if (!empty($this->classes)) {
$attributes['class'] = implode(' ', array_unique($this->classes));
}
return Html::link($this->label, $this->url, $attributes);
}
public function display() {
echo wp_kses($this->getHtml(), Sanitize::$adminTemplateTags);
}
/**
* @return bool
*/
public function isActive() {
return $this->isActive;
}
/**
* @param bool $isActive
*/
public function setActive($isActive) {
$this->isActive = $isActive;
}
/**
* @return string
*/
public function getLabel() {
return $this->label;
}
/**
* @param string $label
*/
public function setLabel($label) {
$this->label = $label;
}
/**
* @return string
*/
public function getUrl() {
return $this->url;
}
/**
* @param string $url
*/
public function setUrl($url) {
$this->url = $url;
}
public function addClass($className) {
$this->classes[] = $className;
}
public function setAttribute($name, $value) {
$this->attributes[$name] = $value;
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\NavBar;
use Nextend\Framework\View\AbstractBlock;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\BlockBreadCrumb\BlockBreadCrumb;
use Nextend\SmartSlider3\Application\Admin\Layout\Helper\Breadcrumb;
use Nextend\SmartSlider3\Application\Admin\Layout\Helper\MenuItem;
class BlockNavBar extends AbstractBlock {
protected $sidebarLink = '';
protected $logo = '';
/**
* @var MenuItem[]
*/
protected $menuItems = array();
/**
* @var BlockBreadCrumb
*/
protected $blockBreadCrumb;
public function display() {
$this->renderTemplatePart('NavBar');
}
protected function init() {
$this->blockBreadCrumb = new BlockBreadCrumb($this);
}
/**
* @return string
*/
public function getSidebarLink() {
return $this->sidebarLink;
}
/**
* @param string $sidebarLink
*/
public function setSidebarLink($sidebarLink) {
$this->sidebarLink = $sidebarLink;
}
/**
* @return string
*/
public function getLogo() {
return $this->logo;
}
/**
* @param string $logo
*/
public function setLogo($logo) {
$this->logo = $logo;
}
/**
* @return MenuItem[]
*/
public function getMenuItems() {
return $this->menuItems;
}
/**
* @param string $menuItem
* @param bool $isActive
*/
public function addMenuItem($menuItem, $isActive = false) {
$this->menuItems[] = new MenuItem($menuItem, $isActive);
}
/**
* @param $label
* @param $icon
* @param string $url
*
* @return Breadcrumb
*/
public function addBreadcrumb($label, $icon, $url = '#') {
return $this->blockBreadCrumb->addBreadcrumb($label, $icon, $url);
}
public function displayBreadCrumbs() {
$this->blockBreadCrumb->display();
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\NavBar;
use Nextend\Framework\Sanitize;
/**
* @var $this BlockNavBar
*/
?>
<div class="n2_nav_bar">
<?php $this->displayBreadCrumbs(); ?>
<div class="n2_nav_bar__logo">
<a href="<?php echo esc_url($this->getSidebarLink()); ?>" tabindex="-1">
<?php echo wp_kses($this->getLogo(), Sanitize::$adminTemplateTags); ?>
</a>
</div>
<div class="n2_nav_bar__menu">
<?php
foreach ($this->getMenuItems() as $menuItem):
?>
<div class="n2_nav_bar__menuitem<?php echo $menuItem->isActive() ? ' n2_nav_bar__menuitem--active' : ''; ?>"><?php $menuItem->display(); ?></div>
<?php
endforeach;
?>
</div>
</div>

View File

@ -0,0 +1,47 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarGroup;
use Nextend\Framework\View\AbstractBlock;
class BlockTopBarGroup extends AbstractBlock {
/**
* @var AbstractBlock[]
*/
protected $blocks = array();
protected $classes = array('n2_top_bar_group');
public function display() {
$this->renderTemplatePart('TopBarGroup');
}
/**
* @param AbstractBlock $block
*/
public function addBlock($block) {
$this->blocks[] = $block;
}
public function displayBlocks() {
foreach ($this->blocks as $block) {
$block->display();
}
}
public function setNarrow() {
$this->classes[] = 'n2_top_bar_group--narrow';
}
/**
* @return array
*/
public function getClasses() {
return $this->classes;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarGroup;
/**
* @var $this BlockTopBarGroup
*/
?>
<div class="<?php echo esc_html(implode(' ', $this->getClasses())); ?>">
<div class="n2_top_bar_group__inner">
<?php
$this->displayBlocks();
?>
</div>
</div>

View File

@ -0,0 +1,62 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain;
use Nextend\Framework\View\AbstractBlock;
class BlockTopBarMain extends AbstractBlock {
private static $idCounter = 1;
protected $id = 0;
/**
* @var AbstractBlock[]
*/
protected $primaryBlocks = array();
/**
* @var AbstractBlock[]
*/
protected $secondaryBlocks = array();
protected $content = '';
protected function init() {
$this->id = self::$idCounter++;
parent::init();
}
public function display() {
$this->renderTemplatePart('TopBarMain');
}
public function addPrimaryBlock($block) {
$this->primaryBlocks[] = $block;
}
public function displayPrimary() {
foreach ($this->primaryBlocks as $block) {
$block->display();
}
}
public function addSecondaryBlock($block) {
$this->secondaryBlocks[] = $block;
}
public function displaySecondary() {
foreach ($this->secondaryBlocks as $block) {
$block->display();
}
}
public function getID() {
return 'n2_top_bar_main_' . $this->id;
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain;
/**
* @var $this BlockTopBarMain
*/
?>
<script>
_N2.r(['$', 'documentReady'], function () {
var $ = _N2.$;
$('#<?php echo esc_html($this->getID()); ?>').css('top', _N2.Window.getTopOffset() + 'px');
});
</script>
<div id="<?php echo esc_html($this->getID()); ?>" class="n2_admin__top_bar n2_top_bar_main">
<div class="n2_top_bar_main__primary">
<?php
$this->displayPrimary();
?>
</div>
<div class="n2_top_bar_main__secondary">
<?php
$this->displaySecondary();
?>
</div>
</div>

View File

@ -0,0 +1,18 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\TopBarMainEditor;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\BlockTopBarMain;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
class BlockTopBarMainEditor extends BlockTopBarMain {
use TraitAdminUrl;
public function display() {
$this->renderTemplatePart('TopBarMainEditor');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\TopBarMainEditor;
use Nextend\Framework\Sanitize;
/**
* @var $this BlockTopBarMainEditor
*/
?>
<div id="<?php echo esc_attr($this->getID()); ?>" class="n2_admin__top_bar n2_top_bar_main n2_admin_editor_overlay__top_bar_main">
<div class="n2_top_bar_main__primary">
<?php
$this->displayPrimary();
?>
</div>
<div class="n2_top_bar_main__logo">
<a href="<?php echo esc_url($this->getUrlDashboard()); ?>">
<?php echo wp_kses($this->getApplicationType()
->getLogo(), Sanitize::$adminTemplateTags); ?>
</a>
</div>
<div class="n2_top_bar_main__secondary">
<?php
$this->displaySecondary();
?>
</div>
</div>

View File

@ -0,0 +1,18 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardInfo;
use Nextend\Framework\View\AbstractBlock;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
class BlockDashboardInfo extends AbstractBlock {
use TraitAdminUrl;
public function display() {
$this->renderTemplatePart('DashboardInfo');
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardInfo;
use Nextend\Framework\Asset\Js\Js;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonDashboardInfo;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var $this BlockDashboardInfo
*/
Js::addInline('new _N2.DashboardInfo();');
?>
<div class="n2_dashboard_info">
<?php
$info = new BlockButtonDashboardInfo($this);
$info->display();
?>
<div class="n2_dashboard_info__content">
<div class="n2_dashboard_info__row_icon n2_dashboard_info__row_icon_version">
<i class="ssi_24 ssi_24--circularinfo"></i>
</div>
<div class="n2_dashboard_info__row_content n2_dashboard_info__row_content_version">
Smart Slider
<?php
echo esc_html(SmartSlider3Info::$version . '-' . SmartSlider3Info::$plan);
?>
</div>
<div class="n2_dashboard_info__row_action n2_dashboard_info__row_action_version">
<a target="_blank" href="https://smartslider.helpscoutdocs.com/article/1746-changelog"><?php n2_e('Changelog') ?></a>
</div>
<?php
$this->getRouter()
->setMultiSite();
$checkForUpdateUrl = $this->getUrlUpdateDownload();
$this->getRouter()
->unSetMultiSite();
?>
<div class="n2_dashboard_info__row_icon n2_dashboard_info__row_icon_check_update">
<i class="ssi_24 ssi_24--refresh"></i>
</div>
<div class="n2_dashboard_info__row_content n2_dashboard_info__row_content_check_update">
<?php n2_e('Check for update'); ?>
</div>
<div class="n2_dashboard_info__row_action n2_dashboard_info__row_action_check_update">
<a target="_blank" href="<?php echo esc_url($checkForUpdateUrl); ?>"><?php n2_e('Check') ?></a>
</div>
<?php
?>
</div>
</div>
<?php

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager;
use Nextend\Framework\View\AbstractBlock;
class BlockDashboardManager extends AbstractBlock {
public function display() {
$this->renderTemplatePart('DashboardManager');
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\View\AbstractBlock;
class BlockDashboardNewsletter extends AbstractBlock {
public function display() {
$storage = StorageSectionManager::getStorage('smartslider');
if (!$storage->get('free', 'subscribeOnImport') && !$storage->get('free', 'dismissNewsletterDashboard')) {
$this->renderTemplatePart('DashboardNewsletter');
}
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\View\AbstractBlock;
use Nextend\SmartSlider3\Application\Model\ModelSliders;
class BlockDashboardReview extends AbstractBlock {
public function display() {
if (!StorageSectionManager::getStorage('smartslider')
->get('free', 'rated')) {
$modelSliders = new ModelSliders($this);
if ($modelSliders->getSlidersCount() >= 3) {
$this->renderTemplatePart('DashboardReview');
}
}
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\View\AbstractBlock;
class BlockDashboardUpgradePro extends AbstractBlock {
protected $hasDismiss = false;
protected $source = 'dashboard-why-upgrade';
public function display() {
if (!StorageSectionManager::getStorage('smartslider')
->get('free', 'upgrade-pro')) {
$this->renderTemplatePart('DashboardUpgradePro');
}
}
/**
* @return bool
*/
public function hasDismiss() {
return $this->hasDismiss;
}
/**
* @param bool $hasDismiss
*/
public function setHasDismiss($hasDismiss) {
$this->hasDismiss = $hasDismiss;
}
/**
* @return string
*/
public function getSource() {
return $this->source;
}
/**
* @param string $source
*/
public function setSource($source) {
$this->source = $source;
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes;
use Nextend\Framework\Platform\Platform;
/**
* @var BlockDashboardNewsletter $this
*/
?>
<div class="n2_dashboard_manager_newsletter">
<div class="n2_dashboard_manager_newsletter__logo">
<i class="ssi_48 ssi_48--newsletter"></i>
</div>
<div class="n2_dashboard_manager_newsletter__heading">
<?php n2_e('Dont miss any update'); ?>
</div>
<div class="n2_dashboard_newsletter__paragraph">
<?php n2_e('Join more than 120,000 subscribers and get access to the latest slider templates, tips, tutorials and other exclusive contents directly to your inbox.'); ?>
</div>
<form class="n2_dashboard_newsletter__form">
<input type="hidden" name="<?php echo esc_attr(strtoupper(Platform::getName())); ?>" value="Yes">
<input type="hidden" name="SOURCE" value="Smart Slider 3">
<input type="email" name="EMAIL" value="<?php echo esc_attr(Platform::getUserEmail()); ?>" placeholder="Email" tabindex="-1">
</form>
<div class="n2_dashboard_manager_newsletter__button">
<?php n2_e('Subscribe'); ?>
</div>
<div class="n2_dashboard_manager_newsletter__close">
<i class="ssi_16 ssi_16--remove"></i>
</div>
</div>
<script>
_N2.r(['$', 'documentReady'], function () {
var $ = _N2.$;
var $box = $('.n2_dashboard_manager_newsletter'),
close = function (e, action) {
_N2.AjaxHelper
.ajax({
type: "POST",
url: _N2.AjaxHelper.makeAjaxUrl(_N2.AjaxHelper.getAdminUrl('ss3-admin'), {
nextendcontroller: 'settings',
nextendaction: action || 'dismissNewsletterDashboard'
}),
dataType: 'json'
});
$box.remove();
},
$form = $('.n2_dashboard_newsletter__form')
.on('submit', function (e) {
e.preventDefault();
_N2.AjaxHelper
.ajax({
type: "POST",
url: "https://secure.nextendweb.com/mailchimp/subscribe.php",
data: $form.serialize(),
dataType: 'json'
})
.done(function () {
});
close(e, 'subscribed');
});
$('.n2_dashboard_manager_newsletter__button')
.on('click', function () {
$form.trigger("submit");
});
$box.find('.n2_dashboard_manager_newsletter__close')
.on('click', close);
});
</script>

View File

@ -0,0 +1,101 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes;
use Nextend\Framework\Platform\Platform;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var BlockDashboardReview $this
*/
?>
<div class="n2_dashboard_manager_review" data-star="0">
<div class="n2_dashboard_manager_review__logo">
<i class="ssi_48 ssi_48--review0"></i>
<i class="ssi_48 ssi_48--review1"></i>
<i class="ssi_48 ssi_48--review2"></i>
<i class="ssi_48 ssi_48--review3"></i>
<i class="ssi_48 ssi_48--review4"></i>
<i class="ssi_48 ssi_48--review5"></i>
</div>
<div class="n2_dashboard_manager_review__heading">
<?php n2_e('Let us know how we\'re doing'); ?>
</div>
<div class="n2_dashboard_manager_review__paragraph">
<?php n2_e('If you are happy with Smart Slider 3 and can take a minute please leave a review. This will help to spread its popularity and to make this plugin a better one.'); ?>
</div>
<div class="n2_dashboard_manager_review__star_selector">
<div class="n2_dashboard_manager_review__star" data-star="1" data-href="<?php echo esc_url('https://smartslider3.com/suggestion/?utm_campaign=' . SmartSlider3Info::$campaign . '&utm_source=dashboard-review-1&utm_medium=smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan); ?>">
<i class="ssi_24 ssi_24--star"></i>
</div>
<div class="n2_dashboard_manager_review__star" data-star="2" data-href="<?php echo esc_url('https://smartslider3.com/suggestion/?utm_campaign=' . SmartSlider3Info::$campaign . '&utm_source=dashboard-review-2&utm_medium=smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan); ?>">
<i class="ssi_24 ssi_24--star"></i>
</div>
<div class="n2_dashboard_manager_review__star" data-star="3" data-href="<?php echo esc_url('https://smartslider3.com/satisfied-customer/?utm_campaign=' . SmartSlider3Info::$campaign . '&utm_source=dashboard-review-3&utm_medium=smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan); ?>">
<i class="ssi_24 ssi_24--star"></i>
</div>
<div class="n2_dashboard_manager_review__star" data-star="4" data-href="<?php echo esc_url('https://smartslider3.com/satisfied-customer/?utm_campaign=' . SmartSlider3Info::$campaign . '&utm_source=dashboard-review-4&utm_medium=smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan); ?>">
<i class="ssi_24 ssi_24--star"></i>
</div>
<?php
$reviewUrl = 'https://smartslider3.com/redirect/wordpress-review.html?utm_campaign=' . SmartSlider3Info::$campaign . '&utm_source=dashboard-review-5&utm_medium=smartslider-' . Platform::getName() . '-' . SmartSlider3Info::$plan;
?>
<div class="n2_dashboard_manager_review__star" data-star="5" data-href="<?php echo esc_url($reviewUrl); ?>">
<i class="ssi_24 ssi_24--star"></i></div>
</div>
<div class="n2_dashboard_manager_review__label" data-star="0"><?php n2_e('Rate your experience'); ?></div>
<div class="n2_dashboard_manager_review__label" data-star="1"><?php n2_e('Hated it'); ?></div>
<div class="n2_dashboard_manager_review__label" data-star="2"><?php n2_e('Disliked it'); ?></div>
<div class="n2_dashboard_manager_review__label" data-star="3"><?php n2_e('It was ok'); ?></div>
<div class="n2_dashboard_manager_review__label" data-star="4"><?php n2_e('Liked it'); ?></div>
<div class="n2_dashboard_manager_review__label" data-star="5"><?php n2_e('Loved it'); ?></div>
<div class="n2_dashboard_manager_review__close">
<i class="ssi_16 ssi_16--remove"></i>
</div>
</div>
<script>
_N2.r(['$', 'documentReady'], function () {
var $ = _N2.$;
var $box = $('.n2_dashboard_manager_review'),
close = function () {
_N2.AjaxHelper
.ajax({
type: "POST",
url: _N2.AjaxHelper.makeAjaxUrl(_N2.AjaxHelper.getAdminUrl('ss3-admin'), {
nextendcontroller: 'settings',
nextendaction: 'rated'
}),
dataType: 'json'
});
$box.remove();
};
$('.n2_dashboard_manager_review__star')
.on({
mouseenter: function (e) {
$box.attr('data-star', $(e.currentTarget).data('star'));
},
mouseleave: function () {
$box.attr('data-star', 0);
},
click: function (e) {
window.open($(e.currentTarget).data('href'), '_blank');
close();
}
});
$box.find('.n2_dashboard_manager_review__close')
.on('click', close);
});
</script>

View File

@ -0,0 +1,90 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes;
use Nextend\SmartSlider3\SmartSlider3Info;
/**
* @var BlockDashboardUpgradePro $this
*/
?>
<div class="n2_dashboard_manager_upgrade_pro">
<div class="n2_dashboard_manager_upgrade_pro__logo">
<i class="ssi_48 ssi_48--upgrade"></i>
</div>
<div class="n2_dashboard_manager_upgrade_pro__heading">
<?php n2_e('Why upgrade to Smart Slider 3 Pro?'); ?>
</div>
<div class="n2_dashboard_manager_upgrade_pro__details">
<a target="_blank" href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://smartslider3.com/sample-sliders/', array('utm_source' => $this->getSource() . '-sample-sliders'))); ?>" class="n2_dashboard_manager_upgrade_pro__details_option">
<i class="ssi_16 ssi_16--filledcheck"></i>
<div class="n2_dashboard_manager_upgrade_pro__details_option_label"><?php echo sprintf(n2_('%d+ slider templates'), '120'); ?></div>
</a>
<a target="_blank" href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://smartslider3.com/slide-library/', array('utm_source' => $this->getSource() . '-slide-library'))); ?>" class="n2_dashboard_manager_upgrade_pro__details_option">
<i class="ssi_16 ssi_16--filledcheck"></i>
<div class="n2_dashboard_manager_upgrade_pro__details_option_label"><?php n2_e('Full slide library access'); ?></div>
</a>
<a target="_blank" href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://smartslider3.com/layers/', array('utm_source' => $this->getSource() . '-layers'))); ?>" class="n2_dashboard_manager_upgrade_pro__details_option">
<i class="ssi_16 ssi_16--filledcheck"></i>
<div class="n2_dashboard_manager_upgrade_pro__details_option_label"><?php echo sprintf(n2_('%d new layers'), '20'); ?></div>
</a>
<a target="_blank" href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://smartslider3.com/features/', array('utm_source' => $this->getSource() . '-free-pro'))); ?>" class="n2_dashboard_manager_upgrade_pro__details_option">
<i class="ssi_16 ssi_16--filledcheck"></i>
<div class="n2_dashboard_manager_upgrade_pro__details_option_label"><?php n2_e('Extra advanced options'); ?></div>
</a>
<a target="_blank" href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://smartslider3.com/animations-and-effects/', array('utm_source' => $this->getSource() . '-animations'))); ?>" class="n2_dashboard_manager_upgrade_pro__details_option">
<i class="ssi_16 ssi_16--filledcheck"></i>
<div class="n2_dashboard_manager_upgrade_pro__details_option_label"><?php n2_e('New animations & effects'); ?></div>
</a>
<a target="_blank" href="<?php echo esc_url(SmartSlider3Info::decorateExternalUrl('https://smartslider3.com/help/', array('utm_source' => $this->getSource() . '-support'))); ?>" class="n2_dashboard_manager_upgrade_pro__details_option">
<i class="ssi_16 ssi_16--filledcheck"></i>
<div class="n2_dashboard_manager_upgrade_pro__details_option_label"><?php n2_e('Lifetime update & support'); ?></div>
</a>
</div>
<a href="<?php echo esc_url(SmartSlider3Info::getWhyProUrl(array('utm_source' => $this->getSource()))); ?>" target="_blank" class="n2_dashboard_manager_upgrade_pro__button">
<?php n2_e('Upgrade to Pro'); ?>
</a>
<?php
if ($this->hasDismiss()):
?>
<div class="n2_dashboard_manager_upgrade_pro__close">
<i class="ssi_16 ssi_16--remove"></i>
</div>
<?php
endif;
?>
</div>
<?php
if ($this->hasDismiss()):
?>
<script>
_N2.r(['$', 'documentReady'], function () {
var $ = _N2.$;
var $box = $('.n2_dashboard_manager_upgrade_pro'),
close = function () {
_N2.AjaxHelper
.ajax({
type: "POST",
url: _N2.AjaxHelper.makeAjaxUrl(_N2.AjaxHelper.getAdminUrl('ss3-admin'), {
nextendcontroller: 'settings',
nextendaction: 'dismissupgradepro'
}),
dataType: 'json'
});
$box.remove();
};
$box.find('.n2_dashboard_manager_upgrade_pro__close')
.on('click', close);
});
</script>
<?php
endif;
?>

View File

@ -0,0 +1,27 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes\BlockDashboardNewsletter;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes\BlockDashboardReview;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Dashboard\DashboardManager\Boxes\BlockDashboardUpgradePro;
/**
* @var BlockDashboardManager $this
*/
?>
<div class="n2_dashboard_manager">
<div class="n2_dashboard_manager__content">
<?php
$upgradePro = new BlockDashboardUpgradePro($this);
$upgradePro->display();
$review = new BlockDashboardReview($this);
$review->display();
$newsletter = new BlockDashboardNewsletter($this);
$newsletter->display();
?>
</div>
</div>

View File

@ -0,0 +1,106 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\Html;
abstract class AbstractButton extends AbstractBlock {
protected $url = '#';
protected $attributes = array();
protected $classes = array();
protected $baseClass = '';
protected $size = 'medium';
protected $tabindex = 0;
public function display() {
echo wp_kses(Html::link($this->getContent(), $this->getUrl(), $this->getAttributes()), Sanitize::$adminTemplateTags);
}
abstract protected function getContent();
/**
* @return string
*/
public function getUrl() {
return $this->url;
}
/**
* @param string $url
*/
public function setUrl($url) {
$this->url = $url;
}
/**
* @param $className
*/
public function addClass($className) {
$this->classes[] = $className;
}
public function addAttribute($name, $value) {
$this->attributes[$name] = $value;
}
public function getAttributes() {
$classes = array_merge(array($this->baseClass), $this->getClasses());
return $this->attributes + array('class' => implode(' ', $classes));
}
/**
* @param string $target
*/
public function setTarget($target) {
$this->addAttribute('target', $target);
}
/**
* @return array
*/
public function getClasses() {
$classes = $this->classes;
$classes[] = $this->baseClass . '--' . $this->size;
return $classes;
}
public function setSmall() {
$this->size = 'small';
}
public function setMedium() {
$this->size = 'medium';
}
public function setBig() {
$this->size = 'big';
}
/**
* @param integer $tabIndex
*/
public function setTabIndex($tabIndex) {
$this->tabindex = $tabIndex;
if ($this->tabindex === 0) {
unset($this->attributes['tabindex']);
} else {
$this->attributes['tabindex'] = $this->tabindex;
}
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class AbstractButtonLabel extends AbstractButton {
protected $label = '';
protected $icon = '';
protected $iconBefore = "";
protected $iconBeforeClass = "";
protected function getContent() {
$content = '';
if (!empty($this->iconBefore)) {
$content .= '<i class="' . $this->iconBefore . ' ' . $this->iconBeforeClass . '"></i>';
}
$content .= '<span class="' . $this->baseClass . '__label">' . $this->getLabel() . '</span>';
if (!empty($this->icon)) {
$content .= '<i class="' . $this->icon . '"></i>';
}
return $content;
}
/**
* @return string
*/
public function getLabel() {
return $this->label;
}
/**
* @param string $label
*/
public function setLabel($label) {
$this->label = $label;
}
/**
* @param string $icon
*/
public function setIcon($icon) {
$this->icon = $icon;
}
/**
* @param string $icon
* @param string $extraClass
*/
public function setIconBefore($icon, $extraClass = "") {
$this->iconBefore = $icon;
$this->iconBeforeClass = $extraClass;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButton extends AbstractButtonLabel {
protected $baseClass = 'n2_button';
protected $color = 'blue';
public function setBlue() {
$this->color = 'blue';
}
public function setGreen() {
$this->color = 'green';
}
public function setRed() {
$this->color = 'red';
}
public function setGrey() {
$this->color = 'grey';
}
public function setGreyDark() {
$this->color = 'grey-dark';
}
public function getClasses() {
$classes = parent::getClasses();
$classes[] = $this->baseClass . '--' . $this->color;
return $classes;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonApply extends BlockButton {
protected function init() {
parent::init();
$this->setLabel(n2_('Apply'));
$this->setBig();
$this->setGreen();
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonBack extends BlockButton {
protected function init() {
parent::init();
$this->setLabel(n2_('Back'));
$this->setBig();
$this->setGreyDark();
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonCancel extends BlockButton {
protected function init() {
parent::init();
$this->setLabel(n2_('Cancel'));
$this->setBig();
$this->setRed();
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonDashboardInfo extends BlockButtonPlainIcon {
protected $baseClass = 'n2_button_plain_icon';
protected $icon = 'ssi_24 ssi_24--notification';
protected $size = 'big';
protected function init() {
parent::init();
$this->setTabIndex(-1);
}
protected function getContent() {
return '<i class="' . $this->icon . '"></i><div class="n2_dashboard_info__marker"></div>';
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonIcon extends BlockButtonPlainIcon {
protected $baseClass = 'n2_button_icon';
protected $color = 'grey';
public function setBlue() {
$this->color = 'blue';
}
public function setGreen() {
$this->color = 'green';
}
public function setRed() {
$this->color = 'red';
}
public function setGrey() {
$this->color = 'grey';
}
public function setGreyDark() {
$this->color = 'grey-dark';
}
public function getClasses() {
$classes = parent::getClasses();
$classes[] = $this->baseClass . '--' . $this->color;
return $classes;
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonIconCode extends BlockButtonIcon {
protected function getContent() {
return $this->icon;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonImport extends BlockButton {
protected function init() {
parent::init();
$this->setLabel(n2_('Import'));
$this->setBig();
$this->setGreen();
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonPlain extends AbstractButtonLabel {
protected $baseClass = 'n2_button_plain';
protected $color = '';
public function setColorBlue() {
$this->color = 'blue';
}
/**
* @return array
*/
public function getClasses() {
$classes = parent::getClasses();
if (!empty($this->color)) {
$classes[] = $this->baseClass . '--color-' . $this->color;
}
return $classes;
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonPlainIcon extends AbstractButton {
protected $baseClass = 'n2_button_plain_icon';
protected $icon = '';
protected function getContent() {
return '<i class="' . $this->icon . '"></i>';
}
/**
* @param string $icon
*/
public function setIcon($icon) {
$this->icon = $icon;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
class BlockButtonSave extends BlockButton {
protected function init() {
parent::init();
$this->setLabel(n2_('Save'));
$this->setBig();
$this->setGreen();
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button;
use Nextend\Framework\View\AbstractBlock;
class BlockButtonSpacer extends AbstractBlock {
protected $isVisible = false;
public function display() {
$classes = array('n2_button_spacer');
if ($this->isVisible) {
$classes[] = 'n2_button_spacer--visible';
}
echo '<div class="' . esc_attr(implode(' ', $classes)) . '"></div>';
}
/**
* @param bool $isVisible
*/
public function setIsVisible($isVisible) {
$this->isVisible = $isVisible;
}
}

View File

@ -0,0 +1,128 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\AbstractButton;
class BlockFloatingMenu extends AbstractBlock {
/**
* @var AbstractButton
*/
protected $button;
protected $classes = array(
'n2_popover',
'n2_floating_menu'
);
protected $attributes = array();
/**
* @var AbstractBlock[]
*/
protected $menuItems = array();
protected $contentID;
public function display() {
$this->renderTemplatePart('FloatingMenu');
}
public function displayButton() {
$this->button->display();
}
/**
* @param AbstractButton $button
*/
public function setButton($button) {
$button->setTabIndex(-1);
$button->addClass('n2_floating_menu__button n2_popover__trigger');
$this->button = $button;
}
/**
* @param AbstractBlock $item
*/
public function addMenuItem($item) {
$this->menuItems[] = $item;
}
public function addSeparator($classes = array()) {
$separator = new BlockFloatingMenuItemSeparator($this);
$separator->setclasses($classes);
$this->menuItems[] = $separator;
}
/**
* @return AbstractBlock[]
*/
public function getMenuItems() {
return $this->menuItems;
}
public function addClass($className) {
$this->classes[] = $className;
}
public function getClasses() {
return $this->classes;
}
/**
* @return mixed
*/
public function getContentID() {
return $this->contentID;
}
/**
* @param mixed $contentID
*/
public function setContentID($contentID) {
$this->contentID = $contentID;
}
public function renderAttributes() {
echo wp_kses(Html::renderAttributes($this->attributes + array(
'class' => implode(' ', $this->classes)
)), Sanitize::$adminTemplateTags);
}
public function setAttribute($name, $value) {
$this->attributes[$name] = $value;
}
public function setLeft() {
$this->setAttribute('data-horizontal', 'left');
}
public function setRight() {
$this->setAttribute('data-horizontal', 'right');
}
public function setAbove() {
$this->setAttribute('data-vertical', 'above');
}
public function setBelow() {
$this->setAttribute('data-vertical', 'below');
}
public function setRelatedClass($selector) {
$this->setAttribute('data-relatedclass', $selector);
}
}
Js::addInline('_N2.r(\'$\', function () {_N2.$(".n2_floating_menu").nextendPopover();});');

View File

@ -0,0 +1,111 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\Framework\View\Html;
class BlockFloatingMenuItem extends AbstractBlock {
protected $label = '';
protected $url = '#';
protected $icon = '';
protected $isActive = false;
protected $attributes = array();
protected $classes = array(
'n2_floating_menu__item'
);
protected $color = 'grey';
public function display() {
$label = '';
if (!empty($this->icon)) {
$label .= '<i class="' . $this->icon . '"></i>';
}
$label .= '<div class="n2_floating_menu__item_label">' . $this->label . '</div>';
echo wp_kses(Html::link($label, $this->url, $this->attributes + array('class' => implode(' ', $this->getClasses()))), Sanitize::$adminTemplateTags);
}
/**
* @param string $label
*/
public function setLabel($label) {
$this->label = $label;
}
/**
* @param string $url
*/
public function setUrl($url) {
$this->url = $url;
}
/**
* @param string $icon
*/
public function setIcon($icon) {
$this->icon = $icon;
}
/**
* @param bool $isActive
*/
public function setIsActive($isActive) {
$this->isActive = $isActive;
}
public function addAttribute($name, $value) {
$this->attributes[$name] = $value;
}
public function addClass($className) {
$this->classes[] = $className;
}
/**
* @param string $target
*/
public function setTarget($target) {
$this->addAttribute('target', $target);
}
public function setRed() {
$this->color = 'red';
}
public function setGrey() {
$this->color = 'grey';
}
public function getClasses() {
$classes = $this->classes;
if ($this->isActive) {
$classes[] = 'n2_floating_menu__item--active';
}
$classes[] = 'n2_floating_menu__item--' . $this->color;
return $classes;
}
public function setState($state) {
$this->attributes['data-state'] = $state;
}
public function setStayOpen() {
$this->addAttribute('data-stay-open', 1);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu;
use Nextend\Framework\View\AbstractBlock;
class BlockFloatingMenuItemSeparator extends AbstractBlock {
protected $classes = array();
public function display() {
echo '<div class="' . esc_attr(implode(' ', array_merge(array(
'n2_floating_menu__item_separator'
), $this->classes))) . '"></div>';
}
/**
* @param array $classes
*/
public function setClasses($classes) {
$this->classes = $classes;
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu;
/**
* @var BlockFloatingMenu $this
*/
?>
<div <?php $this->renderAttributes(); ?>>
<?php
$this->displayButton();
$contentID = $this->getContentID();
?>
<div <?php if (!empty($contentID)): ?>id="<?php echo esc_attr($this->getContentID()); ?>"<?php endif; ?> class="n2_popover_content n2_floating_menu__items_container">
<div class="n2_popover_content_exit"></div>
<div class="n2_popover_content_inner n2_floating_menu__items">
<?php
foreach ($this->getMenuItems() as $menuItem) {
$menuItem->display();
}
?>
</div>
</div>
</div>

View File

@ -0,0 +1,133 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Generator\GeneratorBox;
use Nextend\Framework\View\AbstractBlock;
class BlockGeneratorBox extends AbstractBlock {
protected $label = '';
protected $buttonLink = '';
protected $buttonLinkTarget = '';
protected $buttonLabel = '';
protected $description = '';
protected $docsLink = '';
/** @var string */
protected $imageUrl;
public function display() {
$this->renderTemplatePart('GeneratorBox');
}
/**
* @return string
*/
public function getLabel() {
return $this->label;
}
/**
* @param string $label
*/
public function setLabel($label) {
$this->label = $label;
}
/**
* @return string
*/
public function getDescription() {
return $this->description;
}
/**
* @param string $description
*/
public function setDescription($description) {
$this->description = $description;
}
/**
* @param string
*/
public function getDocsLink() {
return $this->docsLink;
}
/**
* @param string $link
*/
public function setDocsLink($link) {
$this->docsLink = $link;
}
/**
* @return string
*/
public function getButtonLink() {
return $this->buttonLink;
}
/**
* @param string $buttonLink
*/
public function setButtonLink($buttonLink) {
$this->buttonLink = $buttonLink;
}
/**
* @return string
*/
public function getButtonLabel() {
return $this->buttonLabel;
}
/**
* @param string $buttonLabel
*/
public function setButtonLabel($buttonLabel) {
$this->buttonLabel = $buttonLabel;
}
public function hasButtonLabel() {
return !empty($this->buttonLabel);
}
/**
* @return string
*/
public function getButtonLinkTarget() {
return $this->buttonLinkTarget;
}
/**
* @param string $buttonLinkTarget
*/
public function setButtonLinkTarget($buttonLinkTarget) {
$this->buttonLinkTarget = $buttonLinkTarget;
}
/**
* @return string
*/
public function getImageUrl() {
return $this->imageUrl;
}
/**
* @param string $imageUrl
*/
public function setImageUrl($imageUrl) {
$this->imageUrl = $imageUrl;
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Generator\GeneratorBox;
/**
* @var $this BlockGeneratorBox
*/
?>
<div class="n2_slide_generator_box" style="background-image: url('<?php echo esc_url($this->getImageUrl()); ?>');">
<div class="n2_slide_generator_box__title">
<div class="n2_slide_generator_box__title_label">
<div class="n2_slide_generator_box__title_label_inner">
<?php
$label = $this->getLabel();
echo esc_html($label);
?>
</div>
<i class="ssi_16 ssi_16--info" data-tip-description="<?php echo esc_attr($this->getDescription()); ?>" data-tip-label="<?php echo esc_attr($label); ?>" data-tip-link="<?php echo esc_url($this->getDocsLink()); ?>"></i>
</div>
<a href="<?php echo esc_url($this->getButtonLink()); ?>" target="<?php echo esc_attr($this->getButtonLinkTarget()); ?>" class="n2_slide_generator_box__title_button">
<?php echo esc_html($this->getButtonLabel()); ?>
</a>
</div>
</div>

View File

@ -0,0 +1,119 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Slide\AddLayer;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\FreeNeedMore\BlockFreeNeedMore;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonIconCode;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonPlainIcon;
/**
* @var $this BlockAddLayer
*/
?>
<div class="n2_add_layer">
<div class="n2_add_layer__bar">
<div class="n2_add_layer__bar_top">
<?php
$buttonAddLayer = new BlockButtonIconCode($this);
$buttonAddLayer->addClass('n2_add_layer__bar_button');
$buttonAddLayer->addClass('n2_add_layer__bar_button_add');
$buttonAddLayer->setIcon('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="currentColor" d="M13 3a1 1 0 0 1 1 1v6h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-6v6a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-6H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h6V4a1 1 0 0 1 1-1h2z"/></svg>');
$buttonAddLayer->setGreen();
$buttonAddLayer->addAttribute('data-n2tip', n2_('Add Layer'));
$buttonAddLayer->display();
$this->displayAddShortcut('heading', 'ssi_24 ssi_24--heading', n2_('Heading'));
$this->displayAddShortcut('text', 'ssi_24 ssi_24--text', n2_('Text'));
$this->displayAddShortcut('image', 'ssi_24 ssi_24--image', n2_('Image'));
$this->displayAddShortcut('button', 'ssi_24 ssi_24--button', n2_('Button'));
$this->displayAddShortcut('structure-2col', 'ssi_24 ssi_24--col2', n2_('Row'));
?>
</div>
<div class="n2_add_layer__bar_bottom">
<?php
?>
</div>
</div>
<div class="n2_add_layer__more n2_form--dark">
<div class="n2_add_layer__more_tab_buttons">
<div class="n2_add_layer__more_tab_button" data-related-tab="layers">
<div class="n2_add_layer__more_tab_button_icon">
<i class="ssi_24 ssi_24--layers"></i>
</div>
<div class="n2_add_layer__more_tab_button_label">
<?php n2_e('Layers'); ?>
</div>
</div>
<div class="n2_add_layer__more_tab_button" data-related-tab="library">
<div class="n2_add_layer__more_tab_button_icon">
<i class="ssi_24 ssi_24--smart"></i>
</div>
<div class="n2_add_layer__more_tab_button_label">
<?php n2_e('Library'); ?>
</div>
</div>
</div>
<div class="n2_add_layer__more_tab" data-tab="layers">
<div class="n2_add_layer__more_layers">
<?php
foreach ($this->getGroups() as $groupLabel => $boxes):
?>
<div class="n2_add_layer_group">
<div class="n2_add_layer_group__label">
<?php echo esc_html($groupLabel); ?>
</div>
<div class="n2_add_layer_group__content">
<?php
foreach ($boxes as $box):
echo wp_kses(Html::openTag('div', array(
'class' => 'n2_add_layer_box'
) + $box['attributes']), Sanitize::$adminTemplateTags);
?>
<div class="n2_add_layer_box__icon">
<i class="<?php echo esc_attr($box['icon']) ?>"></i>
</div>
<div class="n2_add_layer_box__label_wrap">
<div class="n2_add_layer_box__label">
<?php echo esc_html($box['label']); ?>
</div>
</div>
<?php
echo wp_kses(Html::closeTag('div'), Sanitize::$basicTags);
endforeach;
?>
</div>
</div>
<?php
endforeach;
?>
<?php
$freeNeedMore = new BlockFreeNeedMore($this);
$freeNeedMore->setSource('add-layer');
$freeNeedMore->display();
?>
</div>
<div class="n2_add_layer__more_position n2_add_layer_position" data-position="default">
<div class="n2_add_layer_position__label n2_add_layer_position__default_label">
<?php n2_e('Default'); ?>
</div>
<div class="n2_add_layer_position__switch_container">
<div class="n2_add_layer_position__switch">
<div class="n2_add_layer_position__switch_dot">
</div>
</div>
</div>
<div class=" n2_add_layer_position__label n2_add_layer_position__absolute_label">
<?php n2_e('Absolute'); ?>
</div>
</div>
</div>
<div class="n2_add_layer__more_tab n2_add_layer_library" data-tab="library">
</div>
</div>
</div>

View File

@ -0,0 +1,89 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Slide\AddLayer;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Plugin;
use Nextend\Framework\Style\ModelCss;
use Nextend\Framework\View\AbstractBlock;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonPlainIcon;
use Nextend\SmartSlider3\Renderable\Item\ItemFactory;
use Nextend\SmartSlider3\Slider\SliderType\SliderTypeFactory;
class BlockAddLayer extends AbstractBlock {
protected $groups = array();
protected $sliderType = '';
public function display() {
$this->groups[n2_x('Basic', 'Layer group')] = array(
array(
'label' => n2_('Row'),
'icon' => 'ssi_32 ssi_32--col2',
'attributes' => array(
'data-item' => 'structure-2col'
)
)
);
$cssModel = new ModelCss($this);
$itemDefaults = SliderTypeFactory::getType($this->sliderType)
->getItemDefaults();
foreach (ItemFactory::getItemGroups() as $groupLabel => $group) {
foreach ($group as $type => $item) {
if (!$item->isLegacy()) {
if (!isset($this->groups[$groupLabel])) {
$this->groups[$groupLabel] = array();
}
$visualKey = 'ss3item' . $type;
$visuals = $cssModel->getVisuals($visualKey);
Plugin::doAction($visualKey . 'Storage', array(
&$visuals
));
Js::addInline('window["' . $visualKey . '"] = ' . json_encode($visuals) . ';');
$this->groups[$groupLabel][] = array(
'label' => $item->getTitle(),
'icon' => $item->getIcon(),
'attributes' => array(
'data-item' => $type,
'data-layerproperties' => json_encode((object)array_merge($item->getLayerProperties(), $itemDefaults))
)
);
}
}
}
$this->renderTemplatePart('AddLayer');
}
/**
* @return array
*/
public function getGroups() {
return $this->groups;
}
/**
* @param string $sliderType
*/
public function setSliderType($sliderType) {
$this->sliderType = $sliderType;
}
public function displayAddShortcut($type, $icon, $label) {
$button = new BlockButtonPlainIcon($this);
$button->addClass('n2_add_layer__bar_button');
$button->setIcon($icon);
$button->addAttribute('data-add-layer-shortcut', $type);
$button->addAttribute('data-n2tip', $label);
$button->display();
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace Nextend\SmartSlider3\Application\Admin\Layout\Block\Slide\EditorOverlay;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractBlock;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\BlockBreadCrumb\BlockBreadCrumb;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\TopBarMainEditor\BlockTopBarMainEditor;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slide\AddLayer\BlockAddLayer;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slide\SlideManager\BlockSlideManager;
class BlockEditorOverlay extends AbstractBlock {
/**
* @var BlockTopBarMainEditor
*/
protected $topBar;
/**
* @var BlockBreadCrumb
*/
protected $blockBreadCrumb;
/**
* @var BlockSlideManager
*/
protected $slideManager;
/**
* @var BlockAddLayer
*/
protected $blockAddLayer;
/**
* @var string
*/
protected $contentLayerWindow;
protected function init() {
$this->topBar = new BlockTopBarMainEditor($this);
$this->blockBreadCrumb = new BlockBreadCrumb($this);
$this->topBar->addSecondaryBlock($this->blockBreadCrumb);
}
public function display() {
$this->renderTemplatePart('EditorOverlay');
}
/**
* @param BlockSlideManager $slideManager
*/
public function setSlideManager($slideManager) {
$this->slideManager = $slideManager;
$slideManager->addClass('n2_admin_editor__ui_slide_manager');
}
public function displaySlideManager() {
$this->slideManager->display();
}
/**
* @return BlockTopBarMainEditor
*/
public function getTopBar() {
return $this->topBar;
}
public function displayTopBar() {
$this->topBar->display();
}
/**
* @return BlockBreadCrumb
*/
public function getBlockBreadCrumb() {
return $this->blockBreadCrumb;
}
/**
* @param BlockAddLayer $blockAddLayer
*/
public function setBlockAddLayer($blockAddLayer) {
$this->blockAddLayer = $blockAddLayer;
}
public function displayBlockAddLayer() {
$this->blockAddLayer->display();
}
/**
* @param string $contentLayerWindow
*/
public function setContentLayerWindow($contentLayerWindow) {
$this->contentLayerWindow = $contentLayerWindow;
}
public function displayBlockLayerWindow() {
echo wp_kses($this->contentLayerWindow, Sanitize::$adminFormTags);
}
}

Some files were not shown because too many files have changed in this diff Show More