Your IP : 216.73.216.11


Current Path : /home/digilove/public_html/41423/
Upload File :
Current File : //home/digilove/public_html/41423/SmartSlider3Pro.tar

SmartSlider3Pro.php000064400000002253152355233130010256 0ustar00<?php

namespace Nextend\SmartSlider3Pro;

use Nextend\Framework\Pattern\SingletonTrait;
use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Application\ApplicationSmartSlider3;
use Nextend\SmartSlider3Pro\Application\PluggedApplicationSmartSlider3Pro;
use Nextend\SmartSlider3Pro\Generator\GeneratorLoader;
use Nextend\SmartSlider3Pro\Renderable\Item\ItemLoader;
use Nextend\SmartSlider3Pro\Slider\ResponsiveTypeLoader;
use Nextend\SmartSlider3Pro\Slider\SliderTypeLoader;
use Nextend\SmartSlider3Pro\Widget\WidgetLoader;

class SmartSlider3Pro {

    use SingletonTrait;

    protected function init() {

        Plugin::addAction('PluggableApplication\Nextend\SmartSlider3\Application\ApplicationSmartSlider3', array(
            $this,
            'plugSmartSlider3Pro'
        ));

        new SliderTypeLoader();

        new ResponsiveTypeLoader();

        new WidgetLoader();

        new GeneratorLoader();

        new ItemLoader();
    
    }

    /**
     * @param ApplicationSmartSlider3 $application
     */
    public function plugSmartSlider3Pro($application) {

        new PluggedApplicationSmartSlider3Pro($application);
    }
}Renderable/Joomla/Item/JoomlaModule/ItemJoomlaModule.php000064400000004647152355233130017251 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Joomla\Item\JoomlaModule;


use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemJoomlaModule extends AbstractItem {

    protected $ordering = 101;

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'joomlamodule';
    }

    public function getTitle() {
        return n2_('Joomla module');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--joomla';
    }

    public function getGroup() {
        return n2_x('Advanced', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemJoomlaModuleFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {
        return parent::getValues() + array(
                'positiontype'  => 'loadposition',
                'positionvalue' => ''
            );
    }


    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-joomlamodule', n2_('General'));

        new Warning($settings, '', sprintf(n2_('Please note, that %1$swe do not support%2$s the Joomla module layer!%3$sThe loaded module often needs code customizations what you have to do yourself, so we only suggest using this layer if you are a developer!'), '<b>', '</b>', '<br>'));

        new Select($settings, 'positiontype', n2_('Type'), 'loadposition', array(
            'options' => array(
                'loadposition' => 'Loadposition - Content plugin',
                'loadmoduleid' => 'Loadmoduleid - Content plugin',
                'module'       => 'Module - Modules Anywhere',
                'modulepos'    => 'Modulepos - Modules Anywhere'
            )
        ));

        new Text($settings, 'positionvalue', n2_('Value'), '', array(
            'style'          => 'width:302px;',
            'tipLabel'       => n2_('Position name or module ID'),
            'tipDescription' => n2_('The position name of your module (for Loadposition and Modulepos) or the module\'s ID (Module).'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1853-joomla-module-layer'
        ));
    }
}Renderable/Joomla/Item/JoomlaModule/ItemJoomlaModuleFrontend.php000064400000000771152355233130020743 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Joomla\Item\JoomlaModule;


use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemJoomlaModuleFrontend extends AbstractItemFrontend {

    public function render() {

        return '<div class="n2-ss-item-content n2-ow">{' . $this->data->get('positiontype', '') . ' ' . $this->data->get('positionvalue', '') . '}</div>';
    }

    public function renderAdminTemplate() {

        return $this->render();
    }
}Renderable/Item/ItemLoader.php000064400000005245152355233130012253 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item;


use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Platform\Joomla\JoomlaShim;
use Nextend\SmartSlider3\Renderable\Item\ItemFactory;
use Nextend\SmartSlider3Pro\Renderable\Item\AnimatedHeading\ItemAnimatedHeading;
use Nextend\SmartSlider3Pro\Renderable\Item\Area\ItemArea;
use Nextend\SmartSlider3Pro\Renderable\Item\Audio\ItemAudio;
use Nextend\SmartSlider3Pro\Renderable\Item\BeforeAfter\ItemBeforeAfter;
use Nextend\SmartSlider3Pro\Renderable\Item\Caption\ItemCaption;
use Nextend\SmartSlider3Pro\Renderable\Item\CircleCounter\ItemCircleCounter;
use Nextend\SmartSlider3Pro\Renderable\Item\Counter\ItemCounter;
use Nextend\SmartSlider3Pro\Renderable\Item\Countdown\ItemCountdown;
use Nextend\SmartSlider3Pro\Renderable\Item\HighlightedHeading\ItemHighlightedHeading;
use Nextend\SmartSlider3Pro\Renderable\Item\Html\ItemHtml;
use Nextend\SmartSlider3Pro\Renderable\Item\HtmlList\ItemHtmlList;
use Nextend\SmartSlider3Pro\Renderable\Item\Icon\ItemIcon;
use Nextend\SmartSlider3Pro\Renderable\Item\Iframe\ItemIframe;
use Nextend\SmartSlider3Pro\Renderable\Item\ImageArea\ItemImageArea;
use Nextend\SmartSlider3Pro\Renderable\Item\ImageBox\ItemImageBox;
use Nextend\SmartSlider3Pro\Renderable\Item\Input\ItemInput;
use Nextend\SmartSlider3Pro\Renderable\Item\ProgressBar\ItemProgressBar;
use Nextend\SmartSlider3Pro\Renderable\Item\Transition\ItemTransition;
use Nextend\SmartSlider3Pro\Renderable\Item\Video\ItemVideo;
use Nextend\SmartSlider3Pro\Renderable\Joomla\Item\JoomlaModule\ItemJoomlaModule;

class ItemLoader {

    public function __construct() {

        Plugin::addAction('PluggableFactoryRenderableItem', array(
            $this,
            'renderableItems'
        ));
    }

    /**
     * @param ItemFactory $factory
     */
    public function renderableItems($factory) {

        new ItemAnimatedHeading($factory);
        new ItemArea($factory);
        new ItemAudio($factory);
        new ItemCaption($factory);
        new ItemCircleCounter($factory);
        new ItemCounter($factory);
        new ItemCountdown($factory);
        new ItemHighlightedHeading($factory);
        new ItemHtml($factory);
        new ItemIcon($factory);
        new ItemIframe($factory);
        new ItemImageArea($factory);
        new ItemImageBox($factory);
        new ItemInput($factory);
        new ItemHtmlList($factory);
        new ItemProgressBar($factory);
        new ItemTransition($factory);
        new ItemVideo($factory);
        new ItemBeforeAfter($factory);
        if (!JoomlaShim::$isJoomla4) {
            new ItemJoomlaModule($factory);
        }
    
    }
}Renderable/Item/Video/ItemVideo.php000064400000021610152355233130013153 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Video;


use Nextend\Framework\Data\Data;
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;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\Video;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemVideo extends AbstractItem {

    protected $ordering = 20;

    protected $layerProperties = array(
        "desktopportraitwidth"  => 300,
        "desktopportraitheight" => 'auto'
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'video';
    }

    public function getTitle() {
        return n2_('Video');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--video';
    }

    public function getGroup() {
        return n2_x('Media', 'Layer group');
    }

    /**
     * @param Data $data
     */
    public function upgradeData($data) {
        if (!$data->has('aspect-ratio')) {
            $data->set('aspect-ratio', 'fill');
        }
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemVideoFrontend($this, $id, $itemData, $layer);
    }

    /**
     * @return array
     */
    public function getValues() {
        return parent::getValues() + array(
                'autoplay'         => 0,
                'video_mp4'        => '',
                'aspect-ratio'     => '16:9',
                'scroll-pause'     => 'partly-visible',
                'showcontrols'     => 1,
                'volume'           => 1,
                'loop'             => 0,
                'reset'            => 0,
                'videoplay'        => '',
                'videopause'       => '',
                'videoend'         => '',
                'ended'            => '',
                'playbutton'       => 1,
                'playbuttonwidth'  => 48,
                'playbuttonheight' => 48,
                'playbuttonimage'  => '',
                'poster'           => ''
            );
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('poster', $slide->fill($data->get('poster', '')));
        $data->set('video_mp4', $slide->fill($data->get('video_mp4', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addImage($data->get('poster'));
        $export->addImage($data->get('video_mp4'));
        $export->addImage($data->get('playbuttonimage'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('poster', $import->fixImage($data->get('poster')));
        $data->set('video_mp4', $import->fixImage($data->get('video_mp4')));
        $data->set('playbuttonimage', $import->fixImage($data->get('playbuttonimage')));

        return $data;
    }

    public function prepareSample($data) {
        $data->set('poster', ResourceTranslator::toUrl($data->get('poster')));
        $data->set('video_mp4', ResourceTranslator::toUrl($data->get('video_mp4')));

        return $data;
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-video', n2_('General'));

        new Video($settings, 'video_mp4', n2_('MP4 video'), '', array(
            'width' => 220
        ));

        new FieldImage($settings, 'poster', n2_('Cover image'), '', array(
            'width' => 220
        ));

        new Select($settings, 'aspect-ratio', n2_('Aspect ratio'), '16:9', array(
            'options'            => array(
                '16:9'   => '16:9',
                '16:10'  => '16:10',
                '4:3'    => '4:3',
                'custom' => n2_('Custom'),
                'fill'   => n2_('Fill layer height')
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'custom'
                    ),
                    'field'  => array(
                        'item_videoaspect-ratio-width',
                        'item_videoaspect-ratio-height'
                    )
                ),
                array(
                    'values' => array(
                        'fill'
                    ),
                    'field'  => array(
                        'item_videoaspect-ratio-notice'
                    )
                )
            )
        ));

        new Text\Number($settings, 'aspect-ratio-width', n2_('Width'), '16', array(
            'wide' => 4,
            'min'  => 1
        ));

        new Text\Number($settings, 'aspect-ratio-height', n2_('Height'), '9', array(
            'wide' => 4,
            'min'  => 1
        ));

        new Notice($settings, 'aspect-ratio-notice', n2_('Fill layer height'), n2_('Set on Style tab.'));

        $misc = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-video-misc', n2_('Video settings'));

        new Warning($misc, 'slide-background-notice', sprintf(n2_('Video autoplaying has a lot of limitations made by browsers. %1$sLearn about them.%2$s'), '<a href="https://smartslider.helpscoutdocs.com/article/1919-video-autoplay-handling" target="_blank">', '</a>'));

        new OnOff($misc, 'autoplay', n2_('Autoplay'), 0, array(
            'relatedFieldsOn' => array(
                'item_videoautoplay-notice'
            )
        ));

        new Select($misc, 'ended', n2_('When ended'), '', array(
            'options' => array(
                ''     => n2_('Do nothing'),
                'next' => n2_('Go to next slide')
            )
        ));

        new OnOff($misc, 'loop', n2_x('Loop', 'Video/Audio play'), 0, array(
            'relatedFieldsOff' => array(
                'item_videoended'
            )
        ));

        new Select($misc, 'volume', n2_('Volume'), 1, array(
            'options' => array(
                '0'    => n2_('Mute'),
                '0.25' => '25%',
                '0.5'  => '50%',
                '0.75' => '75%',
                '1'    => '100%'
            )
        ));

        new OnOff($misc, 'reset', n2_('Restart on slide change'), 0, array(
            'tipLabel'       => n2_('Restart on slide change'),
            'tipDescription' => n2_('Starts the video from the beginning when the slide is viewed again.')
        ));

        $display = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-video-display', n2_('Display'));

        new Select($display, 'fill-mode', n2_('Fill mode'), 'cover', array(
            'options' => array(
                'cover'   => n2_('Fill'),
                'contain' => n2_('Fit')
            )
        ));

        new OnOff($display, 'showcontrols', n2_('Controls'), 0);

        $load = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-video-dev', n2_('Loading'));

        new Select($load, 'preload', n2_('Preload'), 'metadata', array(
            'options' => array(
                'auto'     => 'Auto',
                'metadata' => 'metadata',
                'none'     => n2_('None')
            )
        ));

        new Select($load, 'scroll-pause', n2_('Pause on scroll'), 'partly-visible', array(
            'options'        => array(
                ''               => n2_('Never'),
                'partly-visible' => n2_('When partly visible'),
                'not-visible'    => n2_('When not visible'),
            ),
            'tipLabel'       => n2_('Pause on scroll'),
            'tipDescription' => n2_('You can pause the video when the visitor scrolls away from the slider')
        ));

        $playButton = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-video-playbutton', n2_('Play button'));
        new OnOff($playButton, 'playbutton', n2_('Play button'), 1, array(
            'relatedFieldsOn' => array(
                'item_videoplaybuttonwidth',
                'item_videoplaybuttonheight',
                'item_videoplaybuttonimage',
            )
        ));
        new Text\Number($playButton, 'playbuttonwidth', n2_('Width'), 48, array(
            'unit' => 'px',
            'wide' => 4
        ));
        new Text\Number($playButton, 'playbuttonheight', n2_('Height'), 48, array(
            'unit' => 'px',
            'wide' => 4
        ));

        new FieldImage($playButton, 'playbuttonimage', n2_('Image'), '', array(
            'width' => 220
        ));
    }
}Renderable/Item/Video/ItemVideoFrontend.php000064400000015753152355233130014666 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Video;


use Nextend\Framework\Data\Data;
use Nextend\Framework\FastImageSize\FastImageSize;
use Nextend\Framework\Image\Image;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemVideoFrontend extends AbstractItemFrontend {

    public function render() {
        $owner = $this->layer->getOwner();

        $aspectRatio = $this->data->get('aspect-ratio', '16:9');

        $hasImage = 0;
        $poster   = $owner->fill($this->data->get('poster'));

        $coverImage = '';
        if (!empty($poster)) {

            $coverImage = $owner->renderImage($this, $poster, array(
                'class' => 'n2_ss_video_cover',
                'alt'   => n2_('Play')
            ), array(
                'class' => 'n2-ow-all'
            ));

            $hasImage  = 1;
            $playImage = '';

            if ($this->data->get('playbutton', 1) == 1) {

                $playWidth  = intval($this->data->get('playbuttonwidth', '48'));
                $playHeight = intval($this->data->get('playbuttonheight', '48'));
                if ($playWidth > 0 && $playHeight > 0) {

                    $attributes = Html::addExcludeLazyLoadAttributes(array(
                        'style' => '',
                        'class' => 'n2_ss_video_play_btn'
                    ));

                    if ($playWidth != 48) {
                        $attributes['style'] .= 'width:' . $playWidth . 'px;';
                    }
                    if ($playHeight != 48) {
                        $attributes['style'] .= 'height:' . $playHeight . 'px;';
                    }

                    $playButtonImage = $this->data->get('playbuttonimage', '');
                    if (!empty($playButtonImage)) {
                        $image = $this->data->get('playbuttonimage', '');
                        FastImageSize::initAttributes($image, $attributes);
                        $src = ResourceTranslator::toUrl($image);
                    } else {
                        $image = '$ss3-frontend$/images/play.svg';
                        FastImageSize::initAttributes($image, $attributes);
                        $src = Image::SVGToBase64($image);
                    }

                    $playImage = Html::image($src, 'Play', $attributes);
                }
            }

            $coverImage = Html::tag('div', array(
                'class'              => 'n2_ss_video_player__cover',
                'data-force-pointer' => ''
            ), $coverImage . $playImage);
        }

        $owner->addScript('new _N2.FrontendItemVideo(this, "' . $this->id . '", ' . $this->data->toJSON() . ', ' . $hasImage . ');');

        $style = '';
        if ($aspectRatio == 'custom') {
            $style = 'style="padding-top:' . ($this->data->get('aspect-ratio-height', '9') / $this->data->get('aspect-ratio-width', '16') * 100) . '%"';
        }

        return Html::tag("div", array(
            'class'             => 'n2_ss_video_player n2-ss-item-content n2-ss-item-video-container n2-ow-all',
            'data-aspect-ratio' => $aspectRatio
        ), '<div class="n2_ss_video_player__placeholder" ' . $style . '></div>' . Html::tag("video", $this->setOptions($this->data, $this->id), $this->setContent($owner, $this->data)) . $coverImage);
    }

    public function renderAdminTemplate() {
        $aspectRatio = $this->data->get('aspect-ratio', '16:9');

        $style = '';
        if ($aspectRatio == 'custom') {
            $style = 'style="padding-top:' . ($this->data->get('aspect-ratio-height', '9') / $this->data->get('aspect-ratio-width', '16') * 100) . '%"';
        }

        $playButtonImage = $this->data->get('playbuttonimage', '');
        if (!empty($playButtonImage)) {
            $playButtonImage = ResourceTranslator::toUrl($playButtonImage);
        } else {
            $playButtonImage = Image::SVGToBase64('$ss3-frontend$/images/play.svg');
        }

        $playButtonStyle  = '';
        $playButtonWidth  = intval($this->data->get('playbuttonwidth', '48'));
        $playButtonHeight = intval($this->data->get('playbuttonheight', '48'));

        if ($playButtonWidth > 0) {
            $playButtonStyle .= 'width:' . $playButtonWidth . 'px;';
        }
        if ($playButtonHeight > 0) {
            $playButtonStyle .= 'height:' . $playButtonHeight . 'px;';
        }

        $playButton = Html::image($playButtonImage, n2_('Play'), Html::addExcludeLazyLoadAttributes(array(
            'class' => 'n2_ss_video_play_btn',
            'style' => $playButtonStyle
        )));

        return Html::tag('div', array(
            'class'             => 'n2_ss_video_player n2-ss-item-content n2-ss-item-video-container n2-ow-all',
            'data-aspect-ratio' => $aspectRatio,
            "style"             => 'background: URL(' . ResourceTranslator::toUrl($this->data->getIfEmpty('poster', '$ss3-frontend$/images/placeholder/video.png')) . ') no-repeat 50% 50%; background-size: cover;'
        ), '<div class="n2_ss_video_player__placeholder" ' . $style . '></div>' . ($this->data->get('playbutton', 1) ? '<div class="n2_ss_video_player__cover">' . $playButton . '</div>' : ''));
    }

    /**
     * @param $data Data
     * @param $id
     *
     * @return array
     */
    private function setOptions($data, $id) {
        $videoOptions = array(
            'style'        => '',
            'class'        => 'n2-ow intrinsic-ignore data-tf-not-load n2-' . $data->get("fill-mode", 'cover'),
            'encode'       => false,
            'controlsList' => 'nodownload'
        );

        $videoOptions["data-volume"] = $data->get("volume", 1);
        if ($videoOptions["data-volume"] == 0) {
            $videoOptions['muted'] = 'muted';
        }

        $videoOptions['playsinline']        = 1;
        $videoOptions['webkit-playsinline'] = 1;

        if ($data->get('loop')) {
            $videoOptions['loop'] = 'loop';
        }


        $videoOptions["id"] = $id;

        if ($data->get("showcontrols")) {
            $videoOptions["controls"] = "yes";
        } else {
            $videoOptions["style"] .= "pointer-events:none;";
        }

        $videoOptions["preload"] = $data->get("preload", "auto");

        return $videoOptions;
    }

    /**
     * @param $owner AbstractRenderableOwner
     * @param $data  Data
     *
     * @return string
     */
    private function setContent($owner, $data) {
        $videoContent = "";

        if ($data->get("video_mp4", false)) {
            $videoContent .= Html::tag("source", array(
                "src"  => ResourceTranslator::toUrl($owner->fill($data->get("video_mp4"))),
                "type" => "video/mp4"
            ), '', false);
        }

        return $videoContent;
    }
}Renderable/Item/Transition/ItemTransition.php000064400000014365152355233130015334 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Transition;


use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemTransition extends AbstractItem {

    protected $ordering = 5;

    protected $layerProperties = array("desktopportraitwidth" => 200);

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'transition';
    }

    public function getTitle() {
        return n2_('Transition');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--transition';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemTransitionFrontend($this, $id, $itemData, $layer);
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/transition.n2less", array(
            "sliderid" => $renderable->elementId
        ));
    }

    public function getValues() {
        return parent::getValues() + array(
                'animation'      => 'Fade',
                'image'          => '$ss3-frontend$/images/placeholder/image.png',
                'image2'         => '$ss3-frontend$/images/placeholder/video.png',
                'alt'            => '',
                'alt2'           => '',
                'href'           => '#',
                'href-target'    => '_self',
                'href-rel'       => '',
                'image-optimize' => 1
            );
    }


    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('image', $slide->fill($data->get('image', '')));
        $data->set('image2', $slide->fill($data->get('image2', '')));
        $data->set('alt', $slide->fill($data->get('alt', '')));
        $data->set('href', $slide->fill($data->get('href', '#|*|')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addImage($data->get('image'));
        $export->addImage($data->get('image2'));
        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('image', $import->fixImage($data->get('image', '')));
        $data->set('image2', $import->fixImage($data->get('image2', '')));
        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function prepareSample($data) {
        $data->set('image', ResourceTranslator::toUrl($data->get('image')));
        $data->set('image2', ResourceTranslator::toUrl($data->get('image2')));

        return $data;
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-transition', n2_('General'));
        new FieldImage($settings, 'image', n2_('Front image'), '', array(
            'relatedAlt' => 'item_transitionalt',
            'width'      => 220
        ));
        new FieldImage($settings, 'image2', n2_('Back image'), '', array(
            'relatedAlt' => 'item_transitionalt2',
            'width'      => 220

        ));

        new Select($settings, 'animation', n2_('Animation'), '', array(
            'options' => array(
                'Fade'           => n2_('Fade'),
                'VerticalFlip'   => n2_('Vertical flip'),
                'HorizontalFlip' => n2_('Horizontal flip')
            )
        ));

        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-transition-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'relatedFields' => array(
                'item_transitionhref-target',
                'item_transitionhref-rel'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));

        $seo = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-transition-seo', n2_('SEO'));
        new Text($seo, 'alt', n2_('Front image alt tag'), '', array(
            'style' => 'width:133px;'
        ));
        new Text($seo, 'alt2', n2_('Back image alt tag'), '', array(
            'style' => 'width:133px;'
        ));

        $optimize = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-transition-optimize', n2_('Optimize'));
        new OnOff($optimize, 'image-optimize', n2_('Optimize image'), 1, array(
            'tipLabel'       => n2_('Optimize image'),
            'tipDescription' => n2_('You can turn off the Layer image optimization for this image, to resize it for tablet and mobile.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1839-caption-layer#optimize'
        ));
    }

}Renderable/Item/Transition/ItemTransitionFrontend.php000064400000004523152355233130017027 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Transition;


use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemTransitionFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {

        $image  = $this->data->get('image', '');
        $image2 = $this->data->get('image2', '');
        if (empty($image) && empty($image2)) {
            return '';
        }

        $owner = $this->layer->getOwner();

        $image  = $owner->fill($image);
        $image2 = $owner->fill($image2);

        if (empty($image) && empty($image2)) {
            return '';
        }

        $this->loadResources($owner);
        $owner->addScript('new _N2.FrontendItemTransition(this, "' . $this->id . '", "' . $this->data->get('animation', 'Fade') . '");');

        $html = Html::openTag("div", array(
            "class" => "n2-ss-item-transition-inner"
        ));

        $imageAttributes = array(
            'alt'   => htmlspecialchars($owner->fill($this->data->get('alt', ''))),
            'class' => 'n2-ss-item-transition-image1'
        );

        $html .= $owner->renderImage($this, $image, $imageAttributes);

        $imageAttributes2 = array(
            'alt'   => htmlspecialchars($owner->fill($this->data->get('alt2', ''))),
            'class' => 'n2-ss-item-transition-image2'
        );

        $html .= $owner->renderImage($this, $image2, $imageAttributes2);


        $html .= Html::closeTag('div');

        $linkAttributes = array();
        if ($this->isEditor) {
            $linkAttributes['onclick'] = 'return false;';
        }

        return Html::tag("div", array(
            "id"    => $this->id,
            "class" => "n2-ss-item-transition n2-ss-item-content n2-ow-all"
        ), $this->getLink($html, $linkAttributes));
    }

    /**
     * @param $owner AbstractRenderableOwner
     */
    public function loadResources($owner) {

        $owner->addLess(self::getAssetsPath() . "/transition.n2less", array(
            "sliderid" => $owner->getElementID()
        ));
    }
}Renderable/Item/ProgressBar/ItemProgressBar.php000064400000014456152355233130015533 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\ProgressBar;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemProgressBar extends AbstractItem {

    protected $ordering = 10;

    protected $layerProperties = array(
        "desktopportraitwidth" => 300
    );

    protected $fonts = array(
        'font'      => array(
            'defaultName' => 'item-progressbar-font',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"14||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"right","letterspacing":"normal","wordspacing":"normal","texttransform":"none"}]}'
        ),
        'fontlabel' => array(
            'defaultName' => 'item-progressbar-fontlabel',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"14||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"left","letterspacing":"normal","wordspacing":"normal","texttransform":"none"}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'progressbar';
    }

    public function getTitle() {
        return n2_('Progress bar');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--progressbar';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemProgressBarFrontend($this, $id, $itemData, $layer);
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/progressbar.n2less", array(
            "sliderid" => $renderable->elementId
        ));
    }

    public function getValues() {

        return parent::getValues() + array(
                'value'             => 50,
                'startvalue'        => 0,
                'total'             => 100,
                'color'             => '00000080',
                'color2'            => '64c133ff',
                'pre'               => '',
                'post'              => '%',
                'label'             => n2_('Progress'),
                'labelplacement'    => 'before',
                'animationduration' => 1000,
                'animationdelay'    => 0
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('label', $slide->fill($data->get('label', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('fontlabel'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('fontlabel', $import->fixSection($data->get('fontlabel')));

        return $data;
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-progressbar-font', n2_('Progress bar'), $this->fonts['font']['value'], array(
            'mode' => 'simple'
        ));

        new Font($row1, 'item-progressbar-fontlabel', n2_('Label'), $this->fonts['fontlabel']['value'], array(
            'mode' => 'simple'
        ));

    }

    public function renderFields($container) {
        $counter = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-progressbar-counter', n2_('Counter'));
        new Number($counter, 'value', n2_('Value'), '', array(
            'wide' => 5
        ));
        new Number($counter, 'startvalue', n2_('Start from'), '', array(
            'wide' => 5
        ));
        new Number($counter, 'total', n2_('Total'), '', array(
            'wide' => 5
        ));

        $display = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-progressbar-display', n2_('Display'));
        new Color($display, 'color', n2_('Color'), '', array(
            'alpha' => true
        ));
        new Color($display, 'color2', n2_('Active color'), '', array(
            'alpha' => true
        ));

        $labels = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-progressbar-labels', n2_('Labels'));
        new Text($labels, 'label', n2_('Label'), '', array(
            'style' => 'width:150px;'
        ));
        new Select($labels, 'labelplacement', n2_('Placement'), '', array(
            'options' => array(
                'before' => n2_('Before'),
                'over'   => n2_('Over'),
                'after'  => n2_('After')
            )
        ));
        new Text($labels, 'pre', n2_('Pre'), '', array(
            'style' => 'width:40px;'
        ));
        new Text($labels, 'post', n2_('Post'), '', array(
            'style' => 'width:40px;'
        ));

        $animation = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-progressbar-animation', n2_('Animation'));
        new Number($animation, 'animationduration', n2_('Animation duration'), 1, array(
            'min'  => 0,
            'wide' => 5,
            'unit' => 'ms'
        ));
        new Number($animation, 'animationdelay', n2_('Delay'), 0, array(
            'min'  => 0,
            'wide' => 5,
            'unit' => 'ms'
        ));

        new HiddenFont($counter, 'font', n2_('Font') . ' - ' . n2_('Counter'), '', array(
            'mode' => 'simple'
        ));

        new HiddenFont($counter, 'fontlabel', n2_('Font') . ' - ' . n2_('Label'), '', array(
            'mode' => 'simple'
        ));
    }
}Renderable/Item/ProgressBar/ItemProgressBarFrontend.php000064400000010634152355233130017225 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\ProgressBar;


use Nextend\Framework\Parser\Color;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemProgressBarFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $this->loadResources($owner);

        $value      = intval($this->data->get('value'));
        $min        = min(0, $value);
        $startvalue = max(intval($this->data->get('startvalue')), $min);
        $total      = max(max(intval($this->data->get('total')), $startvalue), $value);
        $duration   = max(0, intval($this->data->get('animationduration')));

        if ($total != $min) {
            $toPercent = (min($value, $total) - $min) / ($total - $min);

            if ($duration == 0) {
                // We do not have animation
                $fromPercent = $toPercent;
            } else {
                $fromPercent = (min($startvalue, $total) - $min) / ($total - $min);
            }
        } else {
            $duration    = 0;
            $fromPercent = $toPercent = 0;
        }


        $labelHTML = '';
        $label     = Sanitize::filter_allowed_html($owner->fill($this->data->get('label')));
        $placement = '';
        if (!empty($label)) {
            $fontLabel = $owner->addFont($this->data->get('fontlabel'), 'simple');

            $labelHTML = Html::tag('div', array(
                'class' => 'n2-ss-item-progressbar-label n2-ow ' . $fontLabel
            ), $label);
            $placement = $this->data->get('labelplacement');
        }

        $html = '';

        if ($placement == 'before') {
            $html .= $labelHTML;
        }

        $html .= Html::openTag('div', array(
            'id'    => $this->id,
            'class' => 'n2-ow n2-ss-item-progressbar',
            'style' => 'background-color: ' . Color::colorToRGBA($this->data->get('color')) . ';'
        ));

        $html .= Html::openTag('div', array(
            'class' => 'n2-ow n2-ss-item-progressbar-inner',
            'style' => 'width:' . $fromPercent * 100 . '%;background-color: ' . Color::colorToRGBA($this->data->get('color2')) . ';'
        ));

        if ($placement == 'over') {
            $html .= $labelHTML;
        }


        $font = $owner->addFont($this->data->get('font'), 'simple');

        $pre  = Sanitize::filter_allowed_html($this->data->get('pre'));
        $post = Sanitize::filter_allowed_html($this->data->get('post'));

        $html .= Html::tag('div', array(
            'class' => 'n2-ss-item-progressbar-counting n2-ow ' . $font
        ), $pre . round($min + $fromPercent * ($total - $min)) . $post);


        $html .= '</div>';

        $html .= '</div>';

        if ($placement == 'after') {
            $html .= $labelHTML;
        }

        $jsData = array(
            'name'        => 'progressbar',
            'pre'         => $pre,
            'post'        => $post,
            'fromPercent' => $fromPercent,
            'toPercent'   => $toPercent,
            'duration'    => $duration,
            'delay'       => $this->data->get('animationdelay'),
            'min'         => $min,
            'total'       => $total,
            'counting'    => '.n2-ss-item-progressbar-counting',
            'display'     => '.n2-ss-item-progressbar-inner',
            'displayMode' => 'width'
        );

        if ($this->isEditor && $owner->underEdit) {
            $owner->addScript('new _N2.CounterItemAdmin(this, "' . $this->id . '", ' . json_encode($jsData) . ');');
        } else {
            $owner->addScript('new _N2.FrontendItemCounter(this, "' . $this->id . '", ' . json_encode($jsData) . ');');
        }

        return Html::tag('div', array(
            'class' => 'n2-ss-item-content n2-ow'
        ), $html);
    }

    /**
     * @param $owner AbstractRenderableOwner
     */
    public function loadResources($owner) {
        $owner->addLess(self::getAssetsPath() . "/progressbar.n2less", array(
            "sliderid" => $owner->getElementID()
        ));
    }
}Renderable/Item/Input/ItemInput.php000064400000020771152355233130013244 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Input;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemInput extends AbstractItem {

    protected $ordering = 100;

    protected $fonts = array(
        'inputfont'  => array(
            'defaultName' => 'item-input-font',
            'value'       => '{"data":[{"color":"000000ff","size":"15||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Montserrat,Arial","lineheight":"44px","bold":0,"italic":0,"underline":0,"align":"left","letterspacing":"normal","wordspacing":"normal","texttransform":"none","extra":"height:44px;"},{},{}]}'
        ),
        'buttonfont' => array(
            'defaultName' => 'item-input-button-font',
            'value'       => '{"data":[{"color":"ffffffff","size":"14||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Montserrat,Arial","lineheight":"44px","bold":0,"italic":0,"underline":0,"align":"left","letterspacing":"normal","wordspacing":"normal","texttransform":"none","extra":""},{},{}]}'
        )
    );

    protected $styles = array(
        'style'       => array(
            'defaultName' => 'item-input-container-style',
            'value'       => ''
        ),
        'inputstyle'  => array(
            'defaultName' => 'item-input-style',
            'value'       => '{"data":[{"backgroundcolor":"ffffffff","padding":"0|*|20|*|0|*|20|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":""},{}]}'
        ),
        'buttonstyle' => array(
            'defaultName' => 'item-input-button-style',
            'value'       => '{"data":[{"backgroundcolor":"04bc8fff","padding":"0|*|35|*|0|*|35|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":""},{}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'input';
    }

    public function getTitle() {
        return n2_('Input');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--input';
    }

    public function getGroup() {
        return n2_x('Advanced', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemInputFrontend($this, $id, $itemData, $layer);
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Style($row1, 'item-input-container-style', n2_('Container'), $this->styles['style']['value'], array(
            'mode' => 'heading'
        ));

        new Font($row1, 'item-input-font', n2_('Input'), $this->fonts['inputfont']['value'], array(
            'mode' => 'input'
        ));

        new Style($row1, 'item-input-style', n2_('Input'), $this->styles['inputstyle']['value'], array(
            'mode' => 'heading'
        ));

        new Font($row1, 'item-input-button-font', n2_('Button'), $this->fonts['buttonfont']['value'], array(
            'mode' => 'hover'
        ));

        new Style($row1, 'item-input-button-style', n2_('Button'), $this->styles['buttonstyle']['value'], array(
            'mode' => 'button'
        ));
    }


    public function getValues() {

        return parent::getValues() + array(
                'placeholder' => n2_('What are you looking for?'),
                'action'      => 'https://www.google.com/search',
                'method'      => 'GET',
                'target'      => '_self',
                'parameters'  => 'ie=utf-8&oe=utf-8',
                'name'        => 'q',
                'buttonlabel' => n2_('Search'),
                'submit'      => '',
                'class'       => '',
                'onsubmit'    => '',
                'onkeyup'     => ''
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('parameters', $slide->fill($data->get('parameters')));
        $data->set('buttonlabel', $slide->fill($data->get('buttonlabel')));
        $data->set('action', $slide->fill($data->get('action')));
        $data->set('name', $slide->fill($data->get('name')));
        $data->set('placeholder', $slide->fill($data->get('placeholder')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('style'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('style', $import->fixSection($data->get('style')));

        return $data;
    }

    public function renderFields($container) {

        $text = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-input', n2_('Text'));

        new Warning($text, 'item-input-notice', n2_('We only suggest using this layer if you are a developer, since the Input layer requires deep understanding how HTML form works.'));

        new Text($text, 'placeholder', n2_('Placeholder text'), n2_('What are you looking for?'), array(
            'style' => 'width:170px;'
        ));

        new Text($text, 'buttonlabel', n2_('Label'), n2_('Button'), array(
            'style' => 'width:96px;'
        ));

        $developer = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-input-developer', n2_('Form'));
        new Text($developer, 'name', n2_('Input name'), 'q', array(
            'style' => 'width:80px;'
        ));
        new Select($developer, 'method', n2_('Method'), 'GET', array(
            'options' => array(
                'GET'  => 'GET',
                'POST' => 'POST'
            )
        ));
        new LinkTarget($developer, 'target', n2_('Target window'));
        new Text($developer, 'action', n2_('Form action'), 'https://www.google.com/search', array(
            'style' => 'width:302px;'
        ));
        new Textarea($developer, 'parameters', n2_('Parameters'), 'ie=utf-8&oe=utf-8', array(
            'width' => 314
        ));
        new Select($developer, 'submit', n2_('Slide action to submit'), '', array(
            'options' => array(
                ''           => n2_('Off'),
                'click'      => n2_('Click'),
                'mouseenter' => n2_('Mouse enter'),
                'mouseleave' => n2_('Mouse leave')
            )
        ));

        $js = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-input-js', n2_('JavaScript'));
        new Text($js, 'onsubmit', 'OnSubmit', '', array(
            'style' => 'width:133px;'
        ));
        new Text($js, 'onkeyup', 'OnKeyUp', '', array(
            'style' => 'width:133px;'
        ));

        $html = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-input-html', n2_('Advanced'));
        new Text($html, 'class', n2_('CSS Class'), '', array(
            'style'          => 'width:302px;',
            'tipLabel'       => n2_('CSS Class'),
            'tipDescription' => sprintf(n2_('Class on the %s element.'), '<form>'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1812-layer-style#advanced'
        ));


        new HiddenFont($text, 'inputfont', n2_('Input'), '', array(
            'mode' => 'paragraph'
        ));

        new HiddenStyle($text, 'inputstyle', n2_('Input'), '', array(
            'mode' => 'heading'
        ));

        new HiddenStyle($text, 'style', n2_('Container'), '', array(
            'mode' => 'heading'
        ));

        new HiddenFont($text, 'buttonfont', n2_('Button'), '', array(
            'mode' => 'hover'
        ));

        new HiddenStyle($text, 'buttonstyle', n2_('Button'), '', array(
            'mode' => 'heading'
        ));
    }
}Renderable/Item/Input/ItemInputFrontend.php000064400000010520152355233130014733 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Input;


use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemInputFrontend extends AbstractItemFrontend {

    public function render() {
        $owner = $this->layer->getOwner();

        $style = $owner->addStyle($this->data->get('style'), 'heading');

        $inputFont  = $owner->addFont($this->data->get('inputfont'), 'paragraph');
        $inputStyle = $owner->addStyle($this->data->get('inputstyle'), 'heading');

        $slideSubmitAction = $this->data->get('submit');
        if (!empty($slideSubmitAction)) {
            $owner->addScript('(function(){var form=document.getElementById("' . $this->id . '");form.closest(".n2-ss-slide").addEventListener("' . $this->data->get('submit') . '",function(){form.submit()})})();');
        }

        $parameters     = explode('&', $owner->fill($this->data->get('parameters')));
        $parametersHTML = '';
        foreach ($parameters as $parameter) {
            $parameter = explode('=', $parameter);
            if (count($parameter) == 2) {
                $parametersHTML .= Html::tag('input', array(
                    'type'  => 'hidden',
                    'name'  => $parameter[0],
                    'value' => $parameter[1],
                    'class' => 'n2-ow'
                ), false, false);
            }
        }


        $button      = '';
        $buttonLabel = strip_tags($owner->fill($this->data->get('buttonlabel')));
        if (!empty($buttonLabel)) {

            $buttonFont  = $owner->addFont($this->data->get('buttonfont'), 'hover');
            $buttonStyle = $owner->addStyle($this->data->get('buttonstyle'), 'heading');

            $button = Html::tag('input', array(
                'encode' => false,
                'style'  => 'white-space:nowrap;',
                'type'   => 'submit',
                'value'  => $buttonLabel,
                'class'  => 'n2-form-button ' . $buttonFont . ' ' . $buttonStyle . ' n2-ow'
            ), false, false);
        }

        return Html::tag('form', array(
            'class'    => 'n2-ss-item-input-form ' . $style . ' n2-ss-item-content n2-ow ' . $owner->fill($this->data->get('class', '')),
            'id'       => $this->id,
            'action'   => $owner->fill($this->data->get('action')),
            'method'   => $this->data->get('method'),
            'target'   => $this->data->get('target'),
            'onsubmit' => $this->data->get('onsubmit')
        ), Html::tag('input', array(
                'encode'      => false,
                'name'        => $owner->fill($this->data->get('name', '')),
                'type'        => 'text',
                'placeholder' => strip_tags($owner->fill($this->data->get('placeholder', ''))),
                'class'       => 'n2-input n2-ow ' . $inputFont . $inputStyle,
                'style'       => 'display: block; width: 100%;white-space:nowrap;',
                'onkeyup'     => $this->data->get('onkeyup')
            ), false, false) . $parametersHTML . $button);
    }

    public function renderAdminTemplate() {
        $owner = $this->layer->getOwner();

        $style = $owner->addStyle($this->data->get('style'), 'heading');


        $inputFont  = $owner->addFont($this->data->get('inputfont'), 'paragraph');
        $inputStyle = $owner->addStyle($this->data->get('inputstyle'), 'heading');

        $button      = '';
        $buttonLabel = strip_tags($owner->fill($this->data->get('buttonlabel')));
        if (!empty($buttonLabel)) {
            $buttonFont  = $owner->addFont($this->data->get('buttonfont'), 'hover');
            $buttonStyle = $owner->addStyle($this->data->get('buttonstyle'), 'heading');

            $button = Html::tag('div', array(
                'style' => 'white-space:nowrap;',
                'class' => 'n2-form-button ' . $buttonFont . ' ' . $buttonStyle . ' n2-ow'
            ), $buttonLabel);
        }


        return Html::tag('div', array(
            'class' => 'n2-ss-item-input-form ' . $style . ' ' . $this->data->get('class', '') . ' n2-ow'
        ), "<div class='n2-input n2-ow " . $inputFont . " " . $inputStyle . "' style='white-space:nowrap;'>" . strip_tags($owner->fill($this->data->get('placeholder', ''))) . "</div>" . $button);

    }
}Renderable/Item/ImageBox/ItemImageBox.php000064400000033444152355233130014235 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\ImageBox;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\Icon;
use Nextend\Framework\Form\Element\IconTab;
use Nextend\Framework\Form\Element\MarginPadding;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\RichTextarea;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Form\Element\Radio\InnerAlign;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemImageBox extends AbstractItem {

    protected $ordering = 1;

    protected $layerProperties = array("desktopportraitwidth" => "300");

    protected $fonts = array(
        'fonttitle'       => array(
            'defaultName' => 'item-imagebox-fonttitle',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"32||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}'
        ),
        'fontdescription' => array(
            'defaultName' => 'item-imagebox-fontdescription',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"16||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"2","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""},{"extra":""}]}'
        )
    );

    protected $styles = array(
        'style' => array(
            'defaultName' => 'item-imagebox-style',
            'value'       => ''
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'imagebox';
    }

    public function getTitle() {
        return n2_('Image box');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--imagebox';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemImageBoxFrontend($this, $id, $itemData, $layer);
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/imagebox.n2less", array(
            "sliderid" => $renderable->elementId
        ));
    }

    public function getValues() {

        return parent::getValues() + array(
                'layout'          => 'top',
                'padding'         => '10|*|10|*|10|*|10',
                'inneralign'      => 'center',
                'verticalalign'   => 'flex-start',
                'image'           => '$ss3-frontend$/images/placeholder/image.png',
                'imagewidth'      => 100,
                'alt'             => '',
                'icon'            => '',
                'iconsize'        => 64,
                'iconcolor'       => 'ffffffff',
                'heading'         => n2_('Heading'),
                'headingpriority' => 'div',
                'description'     => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
                'href'            => '#',
                'href-target'     => '_self',
                'href-rel'        => '',
                'href-aria-label' => '',
                'fullwidth'       => 0,
                'image-optimize'  => 1
            );
    }


    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('heading', $slide->fill($data->get('heading', '')));
        $data->set('description', $slide->fill($data->get('description', '')));
        $data->set('href', $slide->fill($data->get('href', '#|*|')));
        $data->set('image', $slide->fill($data->get('image', '')));
        $data->set('alt', $slide->fill($data->get('alt', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addImage($data->get('image'));
        $export->addVisual($data->get('fonttitle'));
        $export->addVisual($data->get('fontdescription'));
        $export->addVisual($data->get('style'));
        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('image', $import->fixImage($data->get('image')));
        $data->set('fonttitle', $import->fixSection($data->get('fonttitle')));
        $data->set('fontdescription', $import->fixSection($data->get('fontdescription')));
        $data->set('style', $import->fixSection($data->get('style')));
        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function prepareSample($data) {
        $data->set('image', ResourceTranslator::toUrl($data->get('image')));

        return $data;
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-imagebox-fonttitle', n2_('Title'), $this->fonts['fonttitle']['value'], array(
            'mode' => 'hover'
        ));

        new Font($row1, 'item-imagebox-fontdescription', n2_('Description'), $this->fonts['fontdescription']['value'], array(
            'mode' => 'paragraph'
        ));

        new Style($row1, 'item-imagebox-style', n2_('Image box'), $this->styles['style']['value'], array(
            'mode' => 'heading'
        ));
    }

    public function renderFields($container) {
        $imageSettings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'image-settings', n2_('General'));

        new IconTab($imageSettings, 'imagetype', n2_('Type'), 'image', array(
            'options'            => array(
                'image' => 'ssi_16 ssi_16--image',
                'icon'  => 'ssi_16 ssi_16--star'
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'image'
                    ),
                    'field'  => array(
                        'item_imageboximage',
                        'item_imageboximagewidth',
                        'item_imageboxalt'
                    )
                ),
                array(
                    'values' => array(
                        'icon'
                    ),
                    'field'  => array(
                        'item_imageboxicon',
                        'item_imageboxiconsize',
                        'item_imageboxiconcolor',
                        'item_imageboxhref-aria-label'
                    )
                )
            ),
            'tooltips'           => array(
                'image' => n2_('Image'),
                'icon'  => n2_('Icon'),
            )
        ));

        new FieldImage($imageSettings, 'image', n2_('Image'), '', array(
            'relatedAlt' => 'item_imageboxalt',
            'width'      => 140
        ));

        new NumberSlider($imageSettings, 'imagewidth', n2_('Width'), '', array(
            'max'  => 100,
            'unit' => '%',
            'wide' => 3
        ));
        new Text($imageSettings, 'alt', 'SEO - ' . n2_('Alt tag'), '', array(
            'style' => 'width:218px;'
        ));


        new Icon($imageSettings, 'icon', n2_('Icon'), '', array(
            'hasClear' => true
        ));
        new NumberSlider($imageSettings, 'iconsize', n2_('Size'), 100, array(
            'min'       => 8,
            'max'       => 400,
            'sliderMax' => 200,
            'step'      => 4,
            'wide'      => 3,
            'unit'      => 'px'
        ));
        new Color($imageSettings, 'iconcolor', n2_('Color'), '', array(
            'alpha' => true
        ));

        new OnOff($imageSettings, 'fullwidth', n2_('Full width'), 1);

        $text = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'text-settings', n2_('Text'));
        new Text($text, 'heading', n2_('Heading'), n2_('Heading'), array(
            'style' => 'width:226px;'
        ));
        new Select($text, 'headingpriority', n2_('Tag'), 'div', array(
            'options' => array(
                'div' => 'div',
                '1'   => 'H1',
                '2'   => 'H2',
                '3'   => 'H3',
                '4'   => 'H4',
                '5'   => 'H5',
                '6'   => 'H6'
            )
        ));

        new HiddenFont($text, 'fonttitle', n2_('Heading'), '', array(
            'mode' => 'hover'
        ));

        new RichTextarea($text, 'description', n2_('Description'), '', array(
            'fieldStyle' => 'height: 120px; width: 314px;resize: vertical;'
        ));

        new HiddenFont($text, 'fontdescription', n2_('Description'), '', array(
            'mode' => 'paragraph'
        ));

        new HiddenStyle($text, 'style', false, '', array(
            'mode' => 'box'
        ));

        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-imagebox-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'relatedFields' => array(
                'item_imageboxhref-target',
                'item_imageboxhref-rel'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));
        new Text($link, 'href-aria-label', n2_('Aria label'), '', array(
            'tipLabel'       => n2_('Aria label'),
            'tipDescription' => sprintf(n2_('Enter an %1$s aria-label attribute %2$s that describes the link.'), '<a href="https://www.w3.org/TR/WCAG20-TECHS/ARIA14.html" target="_blank">', '</a>')
        ));

        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-imagebox', n2_('Display'));

        new Select($settings, 'layout', n2_('Layout'), '', array(
            'options'            => array(
                'top'    => n2_('Top'),
                'left'   => n2_('Left'),
                'right'  => n2_('Right'),
                'bottom' => n2_('Bottom')
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'left',
                        'right'
                    ),
                    'field'  => array(
                        'item_imageboxverticalalign'
                    )
                )
            )
        ));

        $padding = new MarginPadding($settings, 'padding', n2_('Padding'), '10|*|10|*|10|*|10', array(
            'unit' => 'px'
        ));
        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($padding, 'padding-' . $i, false, '', array(
                'values' => array(
                    0,
                    5,
                    10,
                    20,
                    30
                ),
                'wide'   => 3
            ));
        }

        new InnerAlign($settings, 'inneralign', n2_('Inner align'));
        new Select($settings, 'verticalalign', n2_('Vertical align'), '', array(
            'options'        => array(
                'flex-start' => n2_('Top'),
                'center'     => n2_('Center'),
                'flex-end'   => n2_('Bottom')
            ),
            'tipLabel'       => n2_('Vertical align'),
            'tipDescription' => n2_('Positions the text inside the layer. Only works with left and right layout.')
        ));


        $optimize = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption-optimize', n2_('Optimize'));
        new OnOff($optimize, 'image-optimize', n2_('Optimize image'), 1, array(
            'tipLabel'       => n2_('Optimize image'),
            'tipDescription' => n2_('You can turn off the Layer image optimization for this image, to resize it for tablet and mobile.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1839-caption-layer#optimize'
        ));
    }
}Renderable/Item/ImageBox/ItemImageBoxFrontend.php000064400000011230152355233130015722 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\ImageBox;


use Nextend\Framework\Icon\Icon;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Component\AbstractComponent;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemImageBoxFrontend extends AbstractItemFrontend {

    public function isAuto() {
        return !$this->data->get('fullwidth', 1);
    }

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $this->loadResources($owner);

        $style = $owner->addStyle($this->data->get('style'), 'heading');

        $layout = $this->data->get('layout');

        $attr = array(
            'class'       => 'n2-ss-item-imagebox-container n2-ss-item-content n2-ow-all ' . $style,
            'data-layout' => $layout,
            'style'       => AbstractComponent::innerAlignToStyle($this->data->get('inneralign'))
        );

        if ($layout == 'left' || $layout == 'right') {
            $attr['style'] .= 'align-items:' . $this->data->get('verticalalign') . ';';
        }

        $html = Html::openTag('div', $attr);

        // START IMAGE SECTION
        $imageHTML           = '';
        $imageContainerStyle = '';
        $imageInnerStyle     = '';
        $icon                = $this->data->get('icon');
        $image               = $this->data->get('image');
        $imageType           = $this->data->get('imagetype', 'icon');
        $linkAttributes      = array();
        if (!empty($icon) && $imageType == 'icon') {
            $iconData  = Icon::render($icon);
            $imageHTML .= Html::tag('i', array(
                'class' => 'n2i ' . $iconData['class'],
                'style' => 'color: ' . Color::colorToRGBA($this->data->get('iconcolor')) . ';font-size:' . ($this->data->get('iconsize') / 16 * 100) . '%'
            ), $iconData['ligature']);

            $ariaLabel = $this->data->get('href-aria-label', '');
            if (!empty($ariaLabel)) {
                $linkAttributes['aria-label'] = $ariaLabel;
            }
        } else if (!empty($image)) {

            if ($layout == 'top' || $layout == 'bottom') {
                $imageInnerStyle .= 'max-width:' . $this->data->get('imagewidth') . '%;';
            } else {
                $imageContainerStyle .= 'max-width:' . $this->data->get('imagewidth') . '%;';
            }

            $image = $owner->fill($this->data->get('image'));

            $imageAttributes = array(
                'alt'   => $owner->fill($this->data->get('alt')),
                'style' => $imageInnerStyle,
                'class' => ''
            );

            $imageHTML = $owner->renderImage($this, $image, $imageAttributes);
        }

        if (!empty($imageHTML)) {
            $html .= Html::tag('div', array(
                'class' => 'n2-ss-item-imagebox-image',
                'style' => $imageContainerStyle
            ), $this->getLink($imageHTML, $linkAttributes));
        }
        // END IMAGE SECTION


        // START CONTENT SECTION
        $html .= Html::openTag('div', array(
            'class' => 'n2-ss-item-imagebox-content',
            'style' => 'padding:' . implode('px ', explode('|*|', $this->data->get('padding'))) . 'px'
        ));

        $heading = Sanitize::filter_allowed_html($this->data->get('heading'));
        if (!empty($heading)) {
            $font = $owner->addFont($this->data->get('fonttitle'), 'hover');

            $priority = $this->data->get('headingpriority');
            $html     .= $this->getLink(Html::tag($priority > 0 ? 'h' . $priority : $priority, array('class' => $font), $owner->fill($heading)));
        }

        $description = Sanitize::filter_allowed_html($this->data->get('description'));
        if (!empty($description)) {
            $font = $owner->addFont($this->data->get('fontdescription'), 'paragraph');

            $html .= Html::tag('div', array('class' => $font), $owner->fill($description));
        }

        $html .= '</div>';
        // END CONTENT SECTION


        $html .= '</div>';

        return $html;
    }

    /**
     * @param AbstractRenderableOwner $owner
     */
    public function loadResources($owner) {
        $owner->addLess(self::getAssetsPath() . "/imagebox.n2less", array(
            "sliderid" => $owner->getElementID()
        ));
    }
}Renderable/Item/ImageArea/ItemImageArea.php000064400000012675152355233130014500 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\ImageArea;


use Nextend\Framework\Form\Element\LayerWindowFocus;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\HiddenText;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemImageArea extends AbstractItem {

    protected $ordering = 6;

    protected $layerProperties = array(
        "desktopportraitwidth"  => 150,
        "desktopportraitheight" => 150
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'imagearea';
    }

    public function getTitle() {
        return n2_('Image area');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--imagearea';
    }

    public function getGroup() {
        return n2_x('Advanced', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemImageAreaFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {
        return parent::getValues() + array(
                'image'       => '$ss3-frontend$/images/placeholder/image.png',
                'alt'         => '',
                'href'        => '#',
                'href-target' => '_self',
                'href-rel'    => '',
                'fillmode'    => 'cover',
                'positionx'   => 50,
                'positiony'   => 50
            );
    }


    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('image', $slide->fill($data->get('image', '')));
        $data->set('href', $slide->fill($data->get('href', '#|*|')));
        $data->set('alt', $slide->fill($data->get('alt', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addImage($data->get('image'));
        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('image', $import->fixImage($data->get('image')));
        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function prepareSample($data) {
        $data->set('image', ResourceTranslator::toUrl($data->get('image')));

        return $data;
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-imagearea', n2_('General'));

        $fieldImage = new FieldImage($settings, 'image', n2_('Image'), '', array(
            'relatedAlt'    => 'item_imageareaalt',
            'width'         => 220,
            'relatedFields' => array(
                'item_imageareaitem-imagearea-focus'
            )
        ));

        $fieldFocusX = new HiddenText($settings, 'positionx', 50);
        $fieldFocusY = new HiddenText($settings, 'positiony', 50);

        $focusField = new LayerWindowFocus($settings, 'item-imagearea-focus', n2_('Focus'), array(
            'tipLabel'       => n2_('Focus'),
            'tipDescription' => n2_('You can set the starting position of a background image. This makes sure that the selected part will always remain visible, so you should pick the most important part.')
        ));

        $focusField->setFields($fieldImage, $fieldFocusX, $fieldFocusY);

        new Select($settings, 'fillmode', n2_('Fill mode'), 'cover', array(
            'options' => array(
                'cover'   => n2_('Fill'),
                'contain' => n2_('Fit')
            )
        ));
        new Text($settings, 'alt', 'SEO - ' . n2_('Alt tag'), '', array(
            'style' => 'width:133px;'
        ));


        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-imagearea-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'relatedFields' => array(
                'item_imageareahref-target',
                'item_imageareahref-rel'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));

    }
}Renderable/Item/ImageArea/ItemImageAreaFrontend.php000064400000003165152355233130016172 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\ImageArea;


use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemImageAreaFrontend extends AbstractItemFrontend {

    public function render() {

        if ($this->hasLink()) {
            return $this->getLink($this->getHtml(false), array(
                'style' => 'display: block; width:100%;height:100%;',
                'class' => 'n2-ss-item-content n2-ow'
            ));
        }

        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml($isContent = true) {
        $owner = $this->layer->getOwner();

        $image = $this->data->get('image', '');
        if (empty($image)) {
            return '';
        }

        $image = $owner->fill($image);

        $imageUrl = ResourceTranslator::toUrl($image);

        $owner->addImage($imageUrl);

        $imageAttributes = array(
            "alt"   => htmlspecialchars($owner->fill($this->data->get('alt', ''))),
            'class' => ($isContent ? 'n2-ss-item-content ' : '') . ' n2-ss-item-image-area',
            'style' => 'object-fit:' . $this->data->get('fillmode', 'cover') . ';object-position:' . $this->data->get('positionx', 50) . '% ' . $this->data->get('positiony', 50) . '%;'
        );

        return $owner->renderImage($this, $image, $imageAttributes, array(
            'class' => 'n2-ow-all'
        ));
    }

    public function needHeight() {
        return true;
    }
}Renderable/Item/Iframe/ItemIframe.php000064400000006114152355233130013447 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Iframe;


use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\MixedField;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemIframe extends AbstractItem {

    protected $ordering = 100;

    protected $layerProperties = array(
        "desktopportraitwidth"  => 300,
        "desktopportraitheight" => 300
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'iframe';
    }

    public function getTitle() {
        return n2_('Iframe');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--iframe';
    }

    public function getGroup() {
        return n2_x('Advanced', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemIframeFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {
        return parent::getValues() + array(
                'url'    => 'https://smartslider3.com/',
                'size'   => '100%|*|100%',
                'scroll' => 'yes'
            );
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('url', $slide->fill($data->get('url', '')));

        return $data;
    }

    public function renderFields($container) {
        $general = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-iframe', n2_('General'));
        new Warning($general, '', sprintf(n2_('Please note, that %1$swe do not support%2$s customized coding! The iframe layer often needs code customizations what you have to do yourself, so we only suggest using this layer if you are a developer!'), '<b>', '</b>'));

        new Text($general, 'url', n2_('Iframe url'), '', array(
            'style' => 'width:302px;'
        ));

        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-iframe-settings', n2_('Display'));
        new Select($settings, 'scroll', n2_('Scroll'), 'auto', array(
            'options'        => array(
                'yes'  => n2_('Yes'),
                'no'   => n2_('No'),
                'auto' => n2_('Auto')
            ),
            'tipLabel'       => n2_('Scroll'),
            'tipDescription' => n2_('You can disable the scroll on the iframe content.')
        ));
        $size = new MixedField($settings, 'size', false, '100%|*|100%');
        new Text($size, 'size-1', n2_('Width'), '', array(
            'style' => 'width:40px;'
        ));
        new Text($size, 'size-2', n2_('Height'), '', array(
            'style' => 'width:40px;'
        ));

        $advanced = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-iframe-advanced', n2_('Advanced'));

        new Text($advanced, 'title', n2_('Iframe title'), '', array(
            'style' => 'width:302px;'
        ));
    }
}Renderable/Item/Iframe/ItemIframeFrontend.php000064400000003060152355233130015144 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Iframe;


use Nextend\Framework\Parser\Common;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemIframeFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $size = (array)Common::parse($this->data->get('size', ''));
        if (!isset($size[0])) $size[0] = '100%';
        if (!isset($size[1])) $size[1] = '100%';

        $attributes = array(
            "encode"      => false,
            "frameborder" => 0,
            "class"       => "n2-ow intrinsic-ignore",
            "width"       => $size[0],
            "height"      => $size[1],
            "scrolling"   => $this->data->get("scroll"),
            "sandbox"     => 'allow-modals allow-forms allow-popups allow-scripts allow-same-origin'
        );

        $title = strip_tags($this->data->get('title', ''));
        if (!empty($title)) {
            $attributes['title'] = $title;
        }

        $attributes[$owner->isLazyLoadingEnabled() ? 'data-lazysrc' : 'src'] = $owner->fill($this->data->get("url"));

        return Html::tag('div', array('class' => 'n2-ss-item-iframe-wrapper n2-ss-item-content n2-ow'), Html::tag("iframe", $attributes, ""));
    }

    public function needHeight() {
        return true;
    }
}Renderable/Item/HtmlList/ItemHtmlList.php000064400000014326152355233130014345 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\HtmlList;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemHtmlList extends AbstractItem {

    protected $ordering = 6;

    protected $layerProperties = array(
        "desktopportraitleft"   => 0,
        "desktopportraittop"    => 0,
        "desktopportraitwidth"  => 400,
        "desktopportraitalign"  => "left",
        "desktopportraitvalign" => "top"
    );

    protected $fonts = array(
        'font' => array(
            'defaultName' => 'item-list-font',
            'value'       => '{"data":[{"color":"ffffffff","size":"14||px","align":"left"},{"color":"1890d7ff"},{"extra":""}]}'
        )
    );

    protected $styles = array(
        'liststyle' => array(
            'defaultName' => 'item-list-liststyle',
            'value'       => '{"data":[{"extra":"margin-top:0;\nmargin-bottom:0;"}, {"extra":""}]}'
        ),
        'itemstyle' => array(
            'defaultName' => 'item-list-itemstyle',
            'value'       => '{"name":"List","data":[{"padding":"10|*|20|*|10|*|20|*|px","extra":"margin:0;"},{"extra":""}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'list';
    }

    public function getTitle() {
        return n2_('List');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--list';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemHtmlListFrontend($this, $id, $itemData, $layer);
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-list-font', n2_('List'), $this->fonts['font']['value'], array(
            'mode' => 'list'
        ));

        new Style($row1, 'item-list-liststyle', n2_('List'), $this->styles['liststyle']['value'], array(
            'mode' => 'heading'
        ));

        new Style($row1, 'item-list-itemstyle', n2_('Item'), $this->styles['itemstyle']['value'], array(
            'mode' => 'heading'
        ));
    }

    public function getValues() {

        return parent::getValues() + array(
                'content' => n2_("Item 1\nItem 2\nItem 3"),
                'type'    => 'disc'
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('content', $slide->fill($data->get('content', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('liststyle'));
        $export->addVisual($data->get('itemstyle'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('liststyle', $import->fixSection($data->get('liststyle')));
        $data->set('itemstyle', $import->fixSection($data->get('itemstyle')));

        return $data;
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-list', n2_('General'));

        new Textarea($settings, 'content', n2_('Items'), '', array(
            'width'  => 314,
            'height' => 120
        ));

        new Select($settings, 'type', n2_('List type'), '', array(
            'options' => array(
                'none'                 => n2_x('None', 'List layer type'),
                'disc'                 => n2_x('Disc', 'List layer type'),
                'square'               => n2_x('Square', 'List layer type'),
                'circle'               => n2_x('Circle', 'List layer type'),
                'decimal'              => n2_x('Decimal', 'List layer type'),
                'armenian'             => n2_x('Armenian', 'List layer type'),
                'cjk-ideographic'      => n2_x('Cjk-ideographic', 'List layer type'),
                'decimal-leading-zero' => n2_x('Decimal-leading-zero', 'List layer type'),
                'georgian'             => n2_x('Georgian', 'List layer type'),
                'hebrew'               => n2_x('Hebrew', 'List layer type'),
                'hiragana'             => n2_x('Hiragana', 'List layer type'),
                'hiragana-iroha'       => n2_x('Hiragana-iroha', 'List layer type'),
                'katakana'             => n2_x('Katakana', 'List layer type'),
                'katakana-iroha'       => n2_x('Katakana-iroha', 'List layer type'),
                'lower-alpha'          => n2_x('Lower-alpha', 'List layer type'),
                'lower-greek'          => n2_x('Lower-greek', 'List layer type'),
                'lower-latin'          => n2_x('Lower-latin', 'List layer type'),
                'lower-roman'          => n2_x('Lower-roman', 'List layer type'),
                'upper-alpha'          => n2_x('Upper-alpha', 'List layer type'),
                'upper-latin'          => n2_x('Upper-latin', 'List layer type'),
                'upper-roman'          => n2_x('Upper-roman', 'List layer type')
            )
        ));
        new HiddenFont($settings, 'font', false, '', array(
            'mode' => 'list',
        ));
        new HiddenStyle($settings, 'liststyle', n2_('Style') . ' - ' . n2_('List'), '', array(
            'mode' => 'heading'
        ));
        new HiddenStyle($settings, 'itemstyle', n2_('Style') . ' - ' . n2_('Item'), '', array(
            'mode' => 'heading'
        ));
    }
}Renderable/Item/HtmlList/ItemHtmlListFrontend.php000064400000002355152355233130016044 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\HtmlList;


use Nextend\Framework\View\Html;
use Nextend\Framework\Sanitize;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemHtmlListFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }


    private function getHTML() {
        $owner = $this->layer->getOwner();

        $font      = $owner->addFont($this->data->get('font'), 'list');
        $listStyle = $owner->addStyle($this->data->get('liststyle'), 'heading');
        $itemStyle = $owner->addStyle($this->data->get('itemstyle'), 'heading');


        $html = '';
        $lis  = explode("\n", Sanitize::filter_allowed_html($owner->fill($this->data->get('content', ''))));
        foreach ($lis as $li) {
            $html .= '<li class="' . $itemStyle . ' n2-ow" style="list-style-type:inherit;">' . $li . '</li>';
        }

        return Html::tag('ol', array(
            'class' => $font . '' . $listStyle . ' n2-ss-item-content n2-ow',
            'style' => "list-style-type:" . $this->data->get('type')
        ), $html);
    }
}Renderable/Item/Icon/ItemIcon.php000064400000011513152355233130012620 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Icon;


use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\Icon;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemIcon extends AbstractItem {

    protected $ordering = 5;

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'icon2';
    }

    public function getTitle() {
        return n2_('Icon');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--icon';
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemIconFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {
        return parent::getValues() + array(
                'icon'            => 'fa:smile-o',
                'color'           => 'ffffffff',
                'colorhover'      => 'ffffff00',
                'size'            => 100,
                'href'            => '#',
                'href-target'     => '_self',
                'href-rel'        => '',
                'href-aria-label' => '',
                'style'           => ''
            );
    }

    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('icon', $slide->fill($data->get('icon', '')));
        $data->set('href', $slide->fill($data->get('href', '#|*|')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('style'));
        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('style', $import->fixSection($data->get('style')));
        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-icon2-icon', n2_('General'));
        new Icon($settings, 'icon', n2_('Icon'));
        new Color($settings, 'color', n2_('Color'), '00000080', array(
            'alpha' => true
        ));
        new Color($settings, 'colorhover', n2_('Hover color'), '00000000', array(
            'alpha' => true
        ));

        new NumberSlider($settings, 'size', n2_('Size'), 24, array(
            'min'       => 4,
            'max'       => 10000,
            'sliderMax' => 200,
            'step'      => 4,
            'wide'      => 3,
            'unit'      => 'px'
        ));

        new HiddenStyle($settings, 'style', false, '', array(
            'mode' => 'box'
        ));

        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-icon2-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'style'         => 'width:236px;',
            'relatedFields' => array(
                'item_icon2href-target',
                'item_icon2href-rel',
                'item_icon2href-aria-label'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));
        new Text($link, 'href-aria-label', n2_('ARIA label'), '', array(
            'tipLabel'       => n2_('ARIA label'),
            'tipDescription' => sprintf(n2_('Enter an %1$s aria-label attribute %2$s that describes the link.'), '<a href="https://www.w3.org/TR/WCAG20-TECHS/ARIA14.html" target="_blank">', '</a>')
        ));
    }
}Renderable/Item/Icon/ItemIconFrontend.php000064400000004031152355233130014315 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Icon;


use Nextend\Framework\Icon\Icon;
use Nextend\Framework\Parser\Color;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemIconFrontend extends AbstractItemFrontend {

    public function isAuto() {
        return true;
    }

    public function render() {

        if ($this->hasLink()) {
            $attributes = array(
                'style' => 'display:inline-block;',
                'class' => 'n2-ss-item-content n2-ow'
            );

            $ariaLabel = $this->data->get('href-aria-label', '');
            if (!empty($ariaLabel)) {
                $attributes['aria-label'] = $ariaLabel;
            }

            return $this->getLink($this->getHtml(false), $attributes);
        }

        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml($isContent = true) {
        $owner = $this->layer->getOwner();

        $iconData = Icon::render($this->data->get('icon'));
        if (!$iconData) {
            return '';
        }

        $styleClass = $owner->addStyle($this->data->get('style'), 'heading');

        $selector = 'div#' . $owner->getElementID() . ' .' . $this->id;
        $color    = Color::colorToRGBA($this->data->get('color', '00000080'));
        $style    = $selector . '{color:' . $color . '}';
        if (substr($this->data->get('colorhover', '00000000'), 6, 2) != '00') {
            $colorHover = Color::colorToRGBA($this->data->get('colorhover', '00000000'));
            $style      .= $selector . ':HOVER,' . $selector . ':FOCUS,' . $selector . ':VISITED{color:' . $colorHover . '}';
        }

        $owner->addCSS($style);


        return '<span class="n2i ' . $styleClass . ' ' . $this->id . ' ' . $iconData['class'] . ($isContent ? ' n2-ss-item-content' : '') . '" style="font-size:' . ($this->data->get('size') / 16 * 100) . '%;">' . $iconData['ligature'] . '</span>';
    }
}Renderable/Item/Html/ItemHtml.php000064400000004765152355233130012663 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Html;


use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Radio\TextAlign;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemHtml extends AbstractItem {

    protected $ordering = 102;

    protected $layerProperties = array("desktopportraitwidth" => 200);

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'html';
    }

    public function getTitle() {
        return n2_('HTML');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--html';
    }

    public function getGroup() {
        return n2_x('Advanced', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemHtmlFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {
        return parent::getValues() + array(
                'html'      => '<div>' . n2_('Empty element') . '</div>',
                'css'       => ".selector{\n\n}",
                'textalign' => 'inherit'
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('html', $slide->fill($data->get('html', '')));

        return $data;
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-html', n2_('General'));
        new Warning($settings, 'item-html-notice', sprintf(n2_('Please note that %1$swe do not support%2$s the HTML layer and the 3rd party codes loaded by it. We only suggest using this layer if you are a developer. %3$sAlso, make sure your HTML code is valid! Invalid HTML codes can mess up the entire slide and the only way resolving this problem is deleting the slide.'), '<b>', '</b>', '<br>'));

        new Textarea($settings, 'html', 'HTML', '', array(
            'height' => 130,
            'width'  => 314
        ));
        new TextAlign($settings, 'textalign', n2_('Text align'), 'inherit');

        if (class_exists('tidy', false)) {
            new OnOff($settings, 'tidy', n2_('Repair HTML errors'), 1);
        }

        new Textarea($settings, 'css', 'CSS', '', array(
            'height' => 130,
            'width'  => 314
        ));
    }
}Renderable/Item/Html/ItemHtmlFrontend.php000064400000004046152355233130014353 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Html;


use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;
use tidy;

class ItemHtmlFrontend extends AbstractItemFrontend {

    private $scripts = array();

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $css = '';
        if ($cssCode = $this->data->get('css', '')) {
            $css = Html::style($cssCode);
        }

        return Html::tag("div", array(), $this->closeTags('<div style="text-align:' . $this->data->get("textalign") . ';">' . $owner->fill($this->data->get("html")) . '</div>') . $css);
    }

    private function closeTags($html) {

        $html = Html::tag('div', array(
            'class' => 'n2-ss-item-content n2-ow'
        ), $html);

        if (class_exists('tidy', false) && $this->data->get('tidy', 1)) {
            $tidy_config = array(
                'show-body-only'      => true,
                'wrap'                => 0,
                'new-blocklevel-tags' => 'menu,mytag,article,header,footer,section,nav,svg,path,g,a,lottie-player',
                'new-inline-tags'     => 'video,audio,canvas,ruby,rt,rp',
                'doctype'             => '<!DOCTYPE HTML>',
                'preserve-entities'   => true,
                'drop-empty-elements' => false,
                'drop-empty-paras'    => false
            );
            $tidy        = new tidy();

            $html = preg_replace_callback('/<script.*?>.*?<\/script>/ism', array(
                $this,
                'matchScript'
            ), $html);

            return $tidy->repairString($html, $tidy_config, 'UTF8') . implode('', $this->scripts);
        }

        return $html;
    }

    public function matchScript($matches) {
        $this->scripts[] = $matches[0];

        return '';
    }
}Renderable/Item/HighlightedHeading/ItemHighlightedHeading.php000064400000030175152355233130020245 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\HighlightedHeading;


use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemHighlightedHeading extends AbstractItem {

    protected $ordering = 3;

    protected $fonts = array(
        'font' => array(
            'defaultName' => 'item-highlighted-heading-font',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{},{}]}'
        )
    );

    protected $styles = array(
        'style' => array(
            'defaultName' => 'item-highlighted-heading-style',
            'value'       => '{"data":[{},{"padding":"0|*|0|*|0|*|0|*|px"},{"padding":"0|*|0|*|0|*|0|*|px"}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'highlightedHeading';
    }

    public function getTitle() {
        return n2_('Highlighted heading');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--highlightheading';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemHighlightedHeadingFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {

        return parent::getValues() + array(
                'type'  => 'circle1',
                'color' => '5CBA3CFF',
                'width' => 10,
                'front' => 0,

                'before-text'      => n2_('This page is'),
                'highlighted-text' => n2_('Amazing'),
                'after-text'       => '',

                'animate'    => 1,
                'delay'      => 0,
                'duration'   => 1500,
                'loop'       => 0,
                'loop-delay' => 2000,

                'href'        => '#',
                'href-target' => '_self',
                'href-rel'    => '',

                'priority' => 'div',

                'class' => ''
            );
    }

    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/highlightedHeading.n2less", array(
            "sliderid" => $renderable->elementId
        ));

        $renderable->addScript('_N2.ItemHighlightedHeading.svg=' . json_encode($this->getTypes()) . ';');
    }

    private function getTypes() {
        static $types = null;
        if ($types === null) {
            $types     = array();
            $extension = 'svg';
            $folder    = self::getAssetsPath() . '/svg/';
            $files     = Filesystem::files($folder);
            for ($i = 0; $i < count($files); $i++) {
                $pathInfo = pathinfo($files[$i]);
                if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
                    $types[$pathInfo['filename']] = file_get_contents($folder . $files[$i]);
                }
            }
        }

        return $types;
    }

    private function getTypeOptions() {
        return array(
            ''                  => n2_('None'),
            'circle1'           => sprintf(n2_('Circle %d'), '1'),
            'circle2'           => sprintf(n2_('Circle %d'), '2'),
            'circle3'           => sprintf(n2_('Circle %d'), '3'),
            'curly1'            => sprintf(n2_('Curly %d'), '1'),
            'curly2'            => sprintf(n2_('Curly %d'), '2'),
            'highlight1'        => sprintf(n2_('Highlight %d'), '1'),
            'highlight2'        => sprintf(n2_('Highlight %d'), '2'),
            'highlight3'        => sprintf(n2_('Highlight %d'), '3'),
            'line_through1'     => sprintf(n2_('Line Through %d'), '1'),
            'line_through2'     => sprintf(n2_('Line Through %d'), '2'),
            'line_through3'     => sprintf(n2_('Line Through %d'), '3'),
            'rectangle1'        => sprintf(n2_('Rectangle %d'), '1'),
            'rectangle2'        => sprintf(n2_('Rectangle %d'), '2'),
            'underline1'        => sprintf(n2_('Underline %d'), '1'),
            'underline2'        => sprintf(n2_('Underline %d'), '2'),
            'underline3'        => sprintf(n2_('Underline %d'), '3'),
            'underline_double1' => sprintf(n2_('Underline double %d'), '1'),
            'underline_double2' => sprintf(n2_('Underline double %d'), '2'),
            'zigzag1'           => sprintf(n2_('ZigZag %d'), '1'),
            'zigzag2'           => sprintf(n2_('ZigZag %d'), '2'),
            'zigzag3'           => sprintf(n2_('ZigZag %d'), '3'),
        );
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('heading', $slide->fill($data->get('heading', '')));
        $data->set('href', $slide->fill($data->get('href', '#|*|')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('style'));
        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('style', $import->fixSection($data->get('style')));
        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-highlighted-heading-font', false, $this->fonts['font']['value'], array(
            'mode' => 'hover'
        ));

        new Style($row1, 'item-highlighted-heading-style', false, $this->styles['style']['value'], array(
            'mode' => 'heading'
        ));
    }

    public function renderFields($container) {
        $text = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-highlighted-heading-text', n2_('General'));

        new Text($text, 'before-text', n2_('Before text'), '', array(
            'style' => 'width: 302px;'
        ));

        new Text($text, 'highlighted-text', n2_('Highlighted text'), '', array(
            'style' => 'width: 302px;'
        ));

        new Text($text, 'after-text', n2_('After text'), '', array(
            'style' => 'width: 302px;'
        ));

        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-highlightheading-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'style'         => 'width:236px;',
            'relatedFields' => array(
                'item_highlightedHeadinghref-target',
                'item_highlightedHeadinghref-rel'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));

        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-highlighted-heading', n2_('Highlight'));

        new Select($settings, 'type', n2_('Type'), '', array(
            'options'       => $this->getTypeOptions(),
            'relatedFields' => array(
                'item_highlightedHeadingcolor',
                'item_highlightedHeadingwidth',
                'item_highlightedHeadingfront',
                'fieldset-layer-window-item-highlightheading-animation'
            )
        ));
        new Color($settings, 'color', n2_('Color'), '', array(
            'alpha' => true
        ));
        new NumberSlider($settings, 'width', n2_('Width'), '', array(
            'max'  => 100,
            'min'  => 1,
            'unit' => 'px',
            'wide' => 3
        ));
        new OnOff($settings, 'front', n2_('Bring front'), 0, array(
            'tipLabel'       => n2_('Bring front'),
            'tipDescription' => n2_('Puts the shape on top of the text.')
        ));

        $animation = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-highlightheading-animation', n2_('Animation'));
        new OnOff($animation, 'animate', n2_('Animate'), 1, array(
            'relatedFieldsOn' => array(
                'item_highlightedHeadingdelay',
                'item_highlightedHeadingduration',
                'item_highlightedHeadingloop-group'
            )
        ));
        new Number($animation, 'delay', n2_('Delay'), 0, array(
            'unit' => 'ms',
            'wide' => 5
        ));
        new Number($animation, 'duration', n2_('Duration'), 1500, array(
            'unit' => 'ms',
            'wide' => 5,
            'post' => 'break'
        ));

        $groupingLoop = new Grouping($animation, 'loop-group');

        new OnOff($groupingLoop, 'loop', n2_x('Loop', 'Effect'), 1, array(
            'relatedFieldsOn' => array(
                'item_highlightedHeadingloop-delay'
            )
        ));
        new Number($groupingLoop, 'loop-delay', n2_('Loop delay'), 0, array(
            'unit' => 'ms',
            'wide' => 5
        ));

        $dev = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-highlightheading-dev', n2_('Advanced'));
        new Select($dev, 'priority', 'Tag', 'div', array(
            'options' => array(
                'div' => 'div',
                '1'   => 'H1',
                '2'   => 'H2',
                '3'   => 'H3',
                '4'   => 'H4',
                '5'   => 'H5',
                '6'   => 'H6'
            )
        ));

        new HiddenFont($settings, 'font', n2_('Font') . ' - ' . n2_('Heading'), '', array(
            'mode' => 'highlight'
        ));

        new HiddenStyle($settings, 'style', n2_('Style') . ' - ' . n2_('Heading'), '', array(
            'mode' => 'highlight'
        ));


        new Text($dev, 'class', n2_('CSS Class'), '', array(
            'style'          => 'width:226px;',
            'tipLabel'       => n2_('CSS Class'),
            'tipDescription' => n2_('Class on the selected tag element.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1812-layer-style#advanced'
        ));

    }
}Renderable/Item/HighlightedHeading/ItemHighlightedHeadingFrontend.php000064400000012623152355233130021743 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\HighlightedHeading;


use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemHighlightedHeadingFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $this->loadResources($owner);

        $heading = array();

        $beforeText = Sanitize::filter_allowed_html($owner->fill($this->data->get('before-text', '')));
        if (!empty($beforeText)) {
            $heading[] = Html::tag('div', array(
                'class' => 'n2-ss-highlighted-heading-before'
            ), $beforeText);
        }

        $highlightedText = Sanitize::filter_allowed_html($owner->fill($this->data->get('highlighted-text', '')));
        if (!empty($highlightedText)) {

            $svg           = '';
            $highlightType = $this->data->get('type', '');
            if (!empty($highlightType)) {
                $svgPath = self::getAssetsPath() . '/svg/' . $highlightType . '.svg';
                if (Filesystem::fileexists($svgPath)) {
                    $svg = Filesystem::readFile($svgPath);

                    $highlightColor = $this->data->get('color', '');
                    $css            = array(
                        'stroke:#' . substr($highlightColor, 0, 6) . ';',
                        'stroke-opacity:' . Color::hex2opacity($highlightColor) . ';',
                        'stroke-width:' . $this->data->get('width', 10) . 'px;'
                    );
                    $owner->addCSS('div #' . $owner->getElementID() . ' #' . $this->id . ' svg path{' . implode('', $css) . '}');
                }
            }

            $attributes = array(
                'class'          => 'n2-highlighted n2-ss-highlighted-heading-highlighted n2-ow',
                'data-highlight' => $highlightType
            );

            if ($this->data->get('animate', 1)) {
                $attributes['data-animate'] = 1;
            }

            $delay = $this->data->get('delay', 0);
            if ($delay > 0) {
                $attributes['data-delay'] = $delay;
            }

            $duration = $this->data->get('duration', 1500);
            if ($duration != 1500) {
                $attributes['data-duration'] = $duration;
            }

            if ($this->data->get('loop', 0)) {
                $attributes['data-loop'] = 1;
            }

            $loopDelay = $this->data->get('loop-delay', 0);
            if ($loopDelay >= 0) {
                $attributes['data-loop-delay'] = $loopDelay;
            }

            if ($this->data->get('front', 0)) {
                $attributes['data-front'] = 1;
            }

            $highlightedInner = Html::tag('div', array(
                    'class' => 'n2-ss-highlighted-heading-highlighted-text'
                ), $highlightedText) . $svg;


            $href = $this->data->get('href', '');
            if (!empty($href) && $href != '#') {
                $heading[] = $this->getLink($highlightedInner, $attributes);
            } else {
                $heading[] = Html::tag('div', $attributes, $highlightedInner);
            }
        }

        $afterText = Sanitize::filter_allowed_html($owner->fill($this->data->get('after-text', '')));
        if (!empty($afterText)) {
            $heading[] = Html::tag('div', array(
                'class' => 'n2-ss-highlighted-heading-after'
            ), $afterText);
        }


        $font = $owner->addFont($this->data->get('font'), 'highlight');


        $style = $owner->addStyle($this->data->get('style'), 'highlight');

        return $this->heading($this->data->get('priority', 'div'), array(
            "id"    => $this->id,
            "class" => 'n2-ss-highlighted-heading-wrapper ' . $font . ' ' . $style . ' n2-ss-item-content n2-ss-text n2-ow'
        ), implode('', $heading));
    }

    private function heading($type, $attributes, $content) {
        if (is_numeric($type) && $type > 0) {
            return Html::tag("h{$type}", $attributes, $content);
        }

        return Html::tag("div", $attributes, $content);
    }

    /**
     * @param AbstractRenderableOwner $owner
     */
    public function loadResources($owner) {
        $owner->addLess(self::getAssetsPath() . "/highlightedHeading.n2less", array(
            "sliderid" => $owner->getElementID()
        ));

        if (!$owner->isScriptAdded('highlighted-heading')) {
            if ($this->isEditor) {
                $owner->addScript('this.sliderElement.querySelectorAll(\'.n2-ss-currently-edited-slide .n2-ss-highlighted-heading-highlighted\').forEach((function(el){new _N2.HighlightedHeadingItemAdmin(el, this)}).bind(this));', 'highlighted-heading');
            } else {
                $owner->addScript('this.sliderElement.querySelectorAll(\'.n2-ss-highlighted-heading-highlighted\').forEach((function(el){new _N2.FrontendItemHighlightedHeading(el, this)}).bind(this));', 'highlighted-heading');
            }
        }
    }
}Renderable/Item/Counter/ItemCounter.php000064400000012557152355233130014107 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Counter;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemCounter extends AbstractItem {

    protected $ordering = 11;

    protected $fonts = array(
        'font'      => array(
            'defaultName' => 'item-counter-font',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"40||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"}]}'
        ),
        'fontlabel' => array(
            'defaultName' => 'item-counter-fontlabel',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"16||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"2","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'counter';
    }

    public function getTitle() {
        return n2_('Counter');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--counter';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemCounterFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {

        return parent::getValues() + array(
                'value'             => 50,
                'startvalue'        => 0,
                'pre'               => '',
                'post'              => '%',
                'label'             => '',
                'labelplacement'    => 'after',
                'animationduration' => 1000,
                'animationdelay'    => 0
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('label', $slide->fill($data->get('label', '')));
        $data->set('value', $slide->fill($data->get('value', '')));
        $data->set('startvalue', $slide->fill($data->get('startvalue', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('fontlabel'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('fontlabel', $import->fixSection($data->get('fontlabel')));

        return $data;
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-counter-font', n2_('Counter'), $this->fonts['font']['value'], array(
            'mode' => 'simple'
        ));

        new Font($row1, 'item-counter-fontlabel', n2_('Label'), $this->fonts['fontlabel']['value'], array(
            'mode' => 'simple'
        ));
    }

    public function renderFields($container) {
        $counter = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-counter', n2_('Counter'));
        new Number($counter, 'value', n2_('Value'), '', array(
            'wide' => 5
        ));
        new Number($counter, 'startvalue', n2_('Start from'), '', array(
            'wide' => 5
        ));

        $labels = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-counter-labels', n2_('Labels'));
        new Text($labels, 'pre', n2_('Pre'), '', array(
            'style' => 'width:50px;'
        ));
        new Text($labels, 'post', n2_('Post'), '', array(
            'style' => 'width:50px;'
        ));
        new Text($labels, 'label', n2_('Label'), '', array(
            'style' => 'width:150px;'
        ));
        new Select($labels, 'labelplacement', n2_('Placement'), '', array(
            'options' => array(
                'before' => n2_('Before'),
                'after'  => n2_('After')
            )
        ));

        $animation = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-counter-animation', n2_('Animation'));
        new Number($animation, 'animationduration', n2_('Animation duration'), 1, array(
            'min'  => 0,
            'wide' => 5,
            'unit' => 'ms'
        ));
        new Number($animation, 'animationdelay', n2_('Delay'), 0, array(
            'min'  => 0,
            'wide' => 5,
            'unit' => 'ms'
        ));

        new HiddenFont($counter, 'font', n2_('Font') . ' - ' . n2_('Counter'), '', array(
            'mode' => 'simple'
        ));
        new HiddenFont($counter, 'fontlabel', n2_('Font') . ' - ' . n2_('Label'), '', array(
            'mode' => 'simple'
        ));
    }

}Renderable/Item/Counter/ItemCounterFrontend.php000064400000006714152355233130015605 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Counter;


use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemCounterFrontend extends AbstractItemFrontend {

    public function isAuto() {
        return true;
    }

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $value      = intval($owner->fill($this->data->get('value')));
        $min        = min(0, $value);
        $startvalue = max(intval($owner->fill($this->data->get('startvalue'))), $min);
        $total      = max($startvalue, $value);
        $duration   = max(0, intval($this->data->get('animationduration')));

        if ($total != $min) {
            $toPercent = (min($value, $total) - $min) / ($total - $min);
            if ($duration == 0) {
                // We do not have animation
                $fromPercent = $toPercent;
            } else {
                $fromPercent = (min($startvalue, $total) - $min) / ($total - $min);
            }
        } else {
            $duration    = 0;
            $fromPercent = $toPercent = 0;
        }

        $label     = Sanitize::filter_allowed_html($owner->fill($this->data->get('label')));
        $placement = '';
        if (!empty($label)) {

            $fontLabel = $owner->addFont($this->data->get('fontlabel'), 'simple');

            $labelHTML = Html::tag('div', array(
                'class' => $fontLabel
            ), $label);
            $placement = $this->data->get('labelplacement');
        }

        $html = '';

        if ($placement == 'before') {
            $html .= $labelHTML;
        }

        $font = $owner->addFont($this->data->get('font'), 'simple');

        $pre             = Sanitize::filter_allowed_html($this->data->get('pre'));
        $post            = Sanitize::filter_allowed_html($this->data->get('post'));
        $countingDivHTML = Html::tag('div', array(
            'class' => 'n2-ss-item-counter-counting-div n2-ow ' . $font
        ), $pre . round($min + $fromPercent * ($total - $min)) . $post);

        $html .= Html::tag('div', array(
            'id'    => $this->id,
            'class' => 'n2-ow'
        ), $countingDivHTML);


        if ($placement == 'after') {
            $html .= $labelHTML;
        }

        $jsData = array(
            'name'        => 'counter',
            'pre'         => $pre,
            'post'        => $post,
            'fromPercent' => $fromPercent,
            'toPercent'   => $toPercent,
            'duration'    => $duration,
            'delay'       => $this->data->get('animationdelay'),
            'min'         => $min,
            'total'       => $total,
            'counting'    => '.n2-ss-item-counter-counting-div',
            'displayMode' => false
        );

        if ($this->isEditor && $owner->underEdit) {
            $owner->addScript('new _N2.CounterItemAdmin(this, "' . $this->id . '", ' . json_encode($jsData) . ');');
        } else {
            $owner->addScript('new _N2.FrontendItemCounter(this, "' . $this->id . '", ' . json_encode($jsData) . ');');
        }

        return Html::tag('div', array(
            'class' => 'n2-ss-item-content n2-ow'
        ), $html);
    }
}Renderable/Item/Countdown/ItemCountdown.php000064400000026176152355233130015013 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Countdown;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Gap;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Platform\Platform;
use Nextend\SmartSlider3\Form\Element\DatePicker;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemCountdown extends AbstractItem {

    protected $ordering = 11;

    protected $fonts = array(
        'font'      => array(
            'defaultName' => 'item-countdown-font',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"40||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"}]}'
        ),
        'fontlabel' => array(
            'defaultName' => 'item-countdown-fontlabel',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"16||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"capitalize"}]}'
        )
    );

    protected $styles = array(
        'style' => array(
            'defaultName' => 'item-countdown-style',
            'value'       => ''
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'countdown';
    }

    public function getTitle() {
        return n2_('Countdown');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--countdown';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemCountdownFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {

        return parent::getValues() + array(
                'slide-schedule' => 0,
                'date'           => date('Y-m-d H:i:s'),

                'gap'            => '10|*|10',
                'columns'        => 4,
                'label'          => 1,
                'tablet-style'   => 0,
                'tablet-gap'     => '10|*|10',
                'tablet-columns' => 4,

                'mobile-style'   => 0,
                'mobile-gap'     => '10|*|10',
                'mobile-columns' => 1,

                'action'       => '',
                'redirect-url' => ''
            );
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('style'));
        $export->addVisual($data->get('fontlabel'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('style', $import->fixSection($data->get('style')));
        $data->set('fontlabel', $import->fixSection($data->get('fontlabel')));

        return $data;
    }

    public function globalDefaultItemFontAndStyle($container) {
        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-countdown-font', n2_('Countdown'), $this->fonts['font']['value'], array(
            'mode' => 'simple'
        ));

        new Font($row1, 'item-countdown-fontlabel', n2_('Label'), $this->fonts['fontlabel']['value'], array(
            'mode' => 'simple'
        ));

        new Style($row1, 'item-countdown-style', n2_('Countdown'), $this->styles['style']['value'], array(
            'mode' => 'heading'
        ));
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . '/countdown.n2less', array(
            'sliderid' => $renderable->elementId
        ));
    }

    public function renderFields($container) {

        $offset  = (Platform::getTimestamp() - gmdate('U', time() - date('Z'))) / 60;
        $minutes = $offset % 60;
        $hours   = (int)($offset / 60);

        Js::addGlobalInline('window.ssTimezoneOffset=' . json_encode(sprintf('%+03d:%02d', $hours, $minutes)) . ';');

        $dateFieldset = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-countdown', n2_('Date'));

        new OnOff($dateFieldset, 'slide-schedule', n2_('Use slide schedule'), 0, array(
            'relatedFieldsOff' => array(
                'item_countdowndate'
            ),
            'relatedFieldsOn'  => array(
                'item_countdownschedule-notice'
            ),
            'tipLabel'         => n2_('Use slide schedule'),
            'tipDescription'   => n2_('You can use the "Unpublished on" date of the slide itself.'),
            'tipLink'          => 'https://smartslider.helpscoutdocs.com/article/2047-countdown-layer#use-slide-schedule'
        ));

        new Notice($dateFieldset, 'schedule-notice', n2_('Use Slide Schedule'), n2_('Go to Slide → Content tab and set the Unpublish on date for the slide.'));


        $dateGroup = new Grouping($dateFieldset, 'date-group');

        new DatePicker($dateGroup, 'date', 'Date', date('Y-m-d H:i:s'), array(
            'onOff' => false
        ));

        new HiddenFont($dateFieldset, 'font', n2_('Font') . ' - ' . n2_('Countdown'), '', array(
            'mode' => 'simple'
        ));

        new HiddenFont($dateFieldset, 'fontlabel', n2_('Font') . ' - ' . n2_('Label'), '', array(
            'mode' => 'simple'
        ));

        new HiddenStyle($dateFieldset, 'style', false, '', array(
            'mode' => 'heading'
        ));

        $style = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-countdown-style', n2_('Style'));

        new OnOff($style, 'label', n2_('Show label'), 1, array(
            'tipLabel'       => n2_('Show label'),
            'tipDescription' => n2_('Displays the days, hours, minutes and seconds texts under the counter numbers. To display the labels in your own language, translate the texts in the language files.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1938-translation#translation'
        ));

        $gap = new Gap($style, 'gap', n2_('Gap'), '10|*|10', array(
            'tipLabel'       => n2_('Gap'),
            'tipDescription' => n2_('Creates vertical and horizontal distance between the counter elements.')
        ));
        $gap->setUnit('px');

        for ($i = 1; $i < 3; $i++) {
            new NumberAutoComplete($gap, 'gap-' . $i, false, '', array(
                'values' => array(
                    0,
                    5,
                    10,
                    20,
                    30
                ),
                'wide'   => 3
            ));
        }

        new Select($style, 'columns', n2_('Columns'), '4', array(
            'options' => array(
                '1' => '1',
                '2' => '2',
                '4' => '4'
            )
        ));

        $tabletStyleGroup = new Grouping($style, 'tablet-style-group');

        new OnOff($tabletStyleGroup, 'tablet-style', n2_('Tablet style'), 0, array(
            'relatedFieldsOn' => array(
                'item_countdowntablet-gap',
                'item_countdowntablet-columns'
            ),
            'tipLabel'        => n2_('Tablet style'),
            'tipDescription'  => n2_('Set custom Gap and Column for tablet.')
        ));

        $gap = new Gap($tabletStyleGroup, 'tablet-gap', n2_('Gap'), '10|*|10');
        $gap->setUnit('px');

        for ($i = 1; $i < 3; $i++) {
            new NumberAutoComplete($gap, 'tablet-gap-' . $i, false, '', array(
                'values' => array(
                    0,
                    5,
                    10,
                    20,
                    30
                ),
                'wide'   => 3
            ));
        }

        new Select($tabletStyleGroup, 'tablet-columns', n2_('Columns'), '4', array(
            'options' => array(
                '1' => '1',
                '2' => '2',
                '4' => '4'
            )
        ));

        $mobileStyleGroup = new Grouping($style, 'mobile-style-group');
        new OnOff($mobileStyleGroup, 'mobile-style', n2_('Mobile style'), 0, array(
            'relatedFieldsOn' => array(
                'item_countdownmobile-gap',
                'item_countdownmobile-columns'
            ),
            'tipLabel'        => n2_('Mobile style'),
            'tipDescription'  => n2_('Set custom Gap and Column for mobile.')
        ));

        $gap = new Gap($mobileStyleGroup, 'mobile-gap', n2_('Gap'), '10|*|10');
        $gap->setUnit('px');

        for ($i = 1; $i < 3; $i++) {
            new NumberAutoComplete($gap, 'mobile-gap-' . $i, false, '', array(
                'values' => array(
                    0,
                    5,
                    10,
                    20,
                    30
                ),
                'wide'   => 3
            ));
        }

        new Select($mobileStyleGroup, 'mobile-columns', n2_('Columns'), '4', array(
            'options' => array(
                '1' => '1',
                '2' => '2',
                '4' => '4'
            )
        ));

        $general = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-countdown-general', n2_('General'));

        new Select($general, 'action', n2_('Action when ends'), '4', array(
            'options'            => array(
                ''          => n2_('No action'),
                'hideLayer' => n2_('Hide layer'),
                'redirect'  => n2_('Redirect to URL'),
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'redirect',
                    ),
                    'field'  => array(
                        'item_countdownredirect-url'
                    )
                )
            ),
            'tipLabel'           => n2_('Action when ends'),
            'tipDescription'     => n2_('Choose what happens after the counter reached zero.'),
            'tipLink'            => 'https://smartslider.helpscoutdocs.com/article/2047-countdown-layer#action-when-ends'
        ));

        new Text($general, 'redirect-url', n2_('Redirect to URL'), '', array(
            'style' => 'width: 140px;'
        ));
    }

}Renderable/Item/Countdown/ItemCountdownFrontend.php000064400000013133152355233130016500 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Renderable\Item\Countdown;

use Nextend\Framework\Platform\Platform;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemCountdownFrontend extends AbstractItemFrontend {

    private $font, $style, $fontLabel;

    public function isAuto() {
        return true;
    }

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();
        $this->loadResources($owner);

        if ($this->data->get('slide-schedule')) {
            $date = $this->layer->getOwner()->publish_down;
        } else {
            $date = $this->data->get('date');
        }

        if (empty($date)) {
            $date = date('Y-m-d H:i:s', time() + 86400);
        }

        $currentTimestampUtc = gmdate('U');

        $timezoneOffset = Platform::getTimestamp() - $currentTimestampUtc;
        /**
         * Adjust date to GMT
         */
        $timestampUTC = strtotime($date) - $timezoneOffset;


        $diff = $timestampUTC - $currentTimestampUtc;

        $days    = 0;
        $hours   = 0;
        $minutes = 0;
        $seconds = 0;

        if ($diff > 0) {
            $days    = floor($diff / 86400);
            $diff    -= $days * 86400;
            $hours   = floor($diff / 3600);
            $diff    -= $hours * 3600;
            $minutes = floor($diff / 60);
            $diff    -= $minutes * 60;
            $seconds = $diff;
        }

        $this->font      = $owner->addFont($this->data->get('font'), 'simple');
        $this->fontLabel = $owner->addFont($this->data->get('fontlabel'), 'simple');
        $this->style     = $owner->addStyle($this->data->get('style'), 'heading');


        $columns = $this->data->get('columns', 4);
        $gap     = explode('|*|', $this->data->get('gap', '10|*|10'));

        $cssVariables = array(
            '--ss-counter-columns:' . $columns,
            '--ss-counter-gap-v:' . $gap[0] . 'px',
            '--ss-counter-gap-h:' . $gap[1] . 'px'
        );

        if ($this->data->get('tablet-style')) {
            $tabletColumns = $this->data->get('tablet-columns', 4);
            if ($columns !== $tabletColumns) {
                $cssVariables[] = '--ss-counter-tablet-columns:' . $tabletColumns;
            }
            $tabletGap = explode('|*|', $this->data->get('tablet-gap', '10|*|10'));
            if ($gap[0] !== $tabletGap[0]) {
                $cssVariables[] = '--ss-counter-tablet-gap-v:' . $tabletGap[0] . 'px';
            }
            if ($gap[1] !== $tabletGap[1]) {
                $cssVariables[] = '--ss-counter-tablet-gap-h:' . $tabletGap[1] . 'px';
            }
        }

        if ($this->data->get('mobile-style')) {
            $mobileColumns = $this->data->get('mobile-columns', 4);
            if ($columns !== $mobileColumns) {
                $cssVariables[] = '--ss-counter-mobile-columns:' . $mobileColumns;
            }
            $mobileGap = explode('|*|', $this->data->get('mobile-gap', '10|*|10'));
            if ($gap[0] !== $mobileGap[0]) {
                $cssVariables[] = '--ss-counter-mobile-gap-v:' . $mobileGap[0] . 'px';
            }
            if ($gap[1] !== $mobileGap[1]) {
                $cssVariables[] = '--ss-counter-mobile-gap-h:' . $mobileGap[1] . 'px';
            }
        }

        return Html::tag('div', array(
            'class'             => 'n2-ss-item-countdown_container n2-ss-item-content n2-ow-all',
            'style'             => implode(';', $cssVariables),
            'data-timestamp'    => $timestampUTC,
            'data-action'       => $this->data->get('action'),
            'data-redirect-url' => $this->data->get('redirect-url')
        ), implode(array(
            $this->createCard('day', $days, n2_('Days')),
            $this->createCard('hour', $hours, n2_('Hours')),
            $this->createCard('minute', $minutes, n2_('Minutes')),
            $this->createCard('second', $seconds, n2_('Seconds'))
        )));
    }

    private function createCard($element, $value, $label) {

        $labelHTML = '';
        if ($this->data->get('label', 1)) {
            $labelHTML = Html::tag('div', array(
                'class' => 'n2-ss-item-countdown_label ' . $this->fontLabel
            ), $label);
        }

        return Html::tag('div', array(
            'class' => 'n2-ss-item-countdown_element n2-ss-item-countdown_' . $element . ' ' . $this->style
        ), Html::tag('div', array(
                'class' => 'n2-ss-item-countdown_number ' . $this->font
            ), $this->formatNumber($value)) . $labelHTML);
    }

    private function formatNumber($number) {
        if ($number < 10) {
            return '0' . $number;
        } else {
            return $number;
        }
    }

    /**
     * @param AbstractRenderableOwner $owner
     */
    public function loadResources($owner) {
        $owner->addLess(self::getAssetsPath() . "/countdown.n2less", array(
            "sliderid" => $owner->getElementID()
        ));

        if (!$this->layer->getOwner()
                         ->isAdmin() && !$owner->isScriptAdded('countdown')) {
            $owner->addScript('this.sliderElement.querySelectorAll(\'.n2-ss-item-countdown_container\').forEach((function(el){new _N2.FrontendItemCountdown(el, this)}).bind(this));', 'countdown');
        }
    }
}Renderable/Item/CircleCounter/ItemCircleCounter.php000064400000015745152355233130016355 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\CircleCounter;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Fieldset;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemCircleCounter extends AbstractItem {

    protected $ordering = 11;

    protected $fonts = array(
        'font'      => array(
            'defaultName' => 'item-circlecounter-font',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"40||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1","bold":0,"italic":0,"underline":0,"align":"center","letterspacing":"normal","wordspacing":"normal","texttransform":"none"}]}'
        ),
        'fontlabel' => array(
            'defaultName' => 'item-circlecounter-fontlabel',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"16||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"2","bold":0,"italic":0,"underline":0,"align":"center","letterspacing":"normal","wordspacing":"normal","texttransform":"none"}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'circlecounter';
    }

    public function getTitle() {
        return n2_('Circle counter');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--circlecounter';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemCircleCounterFrontend($this, $id, $itemData, $layer);
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/circlecounter.n2less", array(
            "sliderid" => $renderable->elementId
        ));
    }

    public function getValues() {

        return parent::getValues() + array(
                'value'             => 50,
                'startvalue'        => 0,
                'total'             => 100,
                'size'              => 200,
                'strokewidth'       => 10,
                'color'             => '00000033',
                'color2'            => '64c133ff',
                'pre'               => '',
                'post'              => '%',
                'label'             => '',
                'labelplacement'    => 'after',
                'animationduration' => 1000,
                'animationdelay'    => 0
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('label', $slide->fill($data->get('label', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('fontlabel'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('fontlabel', $import->fixSection($data->get('fontlabel')));

        return $data;
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-circlecounter-font', n2_('Counter'), $this->fonts['font']['value'], array(
            'mode' => 'simple'
        ));

        new Font($row1, 'item-circlecounter-fontlabel', n2_('Label'), $this->fonts['fontlabel']['value'], array(
            'mode' => 'simple'
        ));

    }

    public function renderFields($container) {
        $counter = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-circlecounter', n2_('Counter'));
        new Number($counter, 'value', n2_('Value'), '', array(
            'wide' => 5
        ));
        new Number($counter, 'startvalue', n2_('Start from'), '', array(
            'wide' => 5
        ));
        new Number($counter, 'total', n2_('Total'), '', array(
            'wide' => 5
        ));

        $display = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-circlecounter-display', n2_('Display'));
        new Color($display, 'color', n2_('Color'), '', array(
            'alpha' => true
        ));
        new Color($display, 'color2', n2_('Active color'), '', array(
            'alpha' => true
        ));
        new NumberSlider($display, 'size', n2_('Size'), '', array(
            'min'       => 20,
            'max'       => 1000,
            'sliderMax' => 500,
            'step'      => 10,
            'unit'      => 'px',
            'wide'      => 4
        ));
        new NumberSlider($display, 'strokewidth', n2_('Stroke width'), '', array(
            'min'       => 1,
            'max'       => 300,
            'sliderMax' => 100,
            'step'      => 1,
            'unit'      => 'px',
            'wide'      => 3
        ));

        $labels = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-circlecounter-labels', n2_('Labels'));
        new Text($labels, 'label', n2_('Label'), '', array(
            'style' => 'width:150px;'
        ));
        new Select($labels, 'labelplacement', n2_('Placement'), '', array(
            'options' => array(
                'before'      => n2_('Before'),
                'innerbefore' => n2_('Inner before'),
                'innerafter'  => n2_('Inner after'),
                'after'       => n2_('After')
            )
        ));
        new Text($labels, 'pre', n2_('Pre'), '', array(
            'style' => 'width:40px;'
        ));
        new Text($labels, 'post', n2_('Post'), '', array(
            'style' => 'width:40px;'
        ));

        $animation = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-circlecounter-animation', n2_('Animation'));
        new Number($animation, 'animationduration', n2_('Animation duration'), 1, array(
            'min'  => 0,
            'wide' => 5,
            'unit' => 'ms'
        ));
        new Number($animation, 'animationdelay', n2_('Delay'), 0, array(
            'min'  => 0,
            'wide' => 5,
            'unit' => 'ms'
        ));

        new HiddenFont($counter, 'font', n2_('Font') . ' - ' . n2_('Counter'), '', array(
            'mode' => 'simple'
        ));
        new HiddenFont($counter, 'fontlabel', n2_('Font') . ' - ' . n2_('Label'), '', array(
            'mode' => 'simple'
        ));
    }
}Renderable/Item/CircleCounter/ItemCircleCounterFrontend.php000064400000013407152355233130020046 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\CircleCounter;


use Nextend\Framework\Parser\Color;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemCircleCounterFrontend extends AbstractItemFrontend {

    public function isAuto() {
        return true;
    }

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $this->loadResources($owner);

        $value       = intval($this->data->get('value'));
        $min         = min(0, $value);
        $strokeWidth = intval($this->data->get('strokewidth'));
        $size        = max(intval($this->data->get('size')), $strokeWidth + 1);
        $startValue  = max(intval($this->data->get('startvalue')), $min);
        $total       = max(max(intval($this->data->get('total')), $startValue), $value);
        $duration    = max(0, intval($this->data->get('animationduration')));

        $center = $size / 2;
        $r      = ($size - $strokeWidth) / 2;
        $c      = pi() * $r * 2;

        if ($total != $min) {
            $toPercent = (min($value, $total) - $min) / ($total - $min);

            if ($duration == 0) {
                // We do not have animation
                $fromPercent = $toPercent;
            } else {
                $fromPercent = (min($startValue, $total) - $min) / ($total - $min);
            }
        } else {
            $duration    = 0;
            $fromPercent = $toPercent = 0;
        }

        $pct = (1 - $fromPercent) * $c;

        $labelHTML = '';
        $label     = Sanitize::filter_allowed_html($owner->fill($this->data->get('label')));
        $placement = '';
        if (!empty($label)) {
            $fontLabel = $owner->addFont($this->data->get('fontlabel'), 'simple');

            $labelHTML = Html::tag('div', array(
                'class' => $fontLabel
            ), $label);
            $placement = $this->data->get('labelplacement');
        }


        $html = '';

        if ($placement == 'before') {
            $html .= $labelHTML;
        }

        $font = $owner->addFont($this->data->get('font'), 'simple');

        $pre             = Sanitize::filter_allowed_html($this->data->get('pre'));
        $post            = Sanitize::filter_allowed_html($this->data->get('post'));
        $countingDivHTML = Html::tag('div', array(
            'class' => 'n2-ss-item-circlecounter-counting-div n2-ow ' . $font
        ), $pre . round($min + $fromPercent * ($total - $min)) . $post);

        $html .= Html::openTag('div', array(
            'id'    => $this->id,
            'class' => 'n2-ow n2-ss-item-circlecounter-svg-container',
            'style' => 'width:' . $size . 'px;'
        ));

        $color  = $this->data->get('color');
        $color2 = $this->data->get('color2');
        $html   .= '<svg class="svg" viewBox="0 0 ' . $size . ' ' . $size . '" version="1.1" style="width:' . $size . 'px;height:' . $size . 'px;" preserveAspectRatio="xMinYMin meet">';
        $html   .= '<circle class="fl-bar-bg" r="' . $r . '" cx="' . $center . '" cy="' . $center . '" stroke="#' . substr($color, 0, 6) . '" stroke-opacity="' . Color::hex2alpha($color) / 127 . '" stroke-width="' . $strokeWidth . '" stroke-dashoffset="0" stroke-dasharray="' . $c . '" fill="transparent"></circle>';
        $html   .= '<circle class="fl-bar" r="' . $r . '" cx="' . $center . '" cy="' . $center . '" stroke="#' . substr($color2, 0, 6) . '" stroke-opacity="' . Color::hex2alpha($color2) / 127 . '" stroke-width="' . $strokeWidth . '" stroke-dasharray="' . $c . '" stroke-dashoffset="' . $pct . '" transform="rotate(-90 ' . $center . ' ' . $center . ')" fill="transparent"></circle>';
        $html   .= '</svg>';

        $html .= Html::openTag('div', array(
            'class' => 'n2-ow n2-ss-item-circlecounter-svg-overlay'
        ));

        if ($placement == 'innerbefore') {
            $html .= $labelHTML;
        }

        $html .= $countingDivHTML;


        if ($placement == 'innerafter') {
            $html .= $labelHTML;
        }

        $html .= '</div>';
        $html .= '</div>';


        if ($placement == 'after') {
            $html .= $labelHTML;
        }

        $jsData = array(
            'name'        => 'circlecounter',
            'pre'         => $pre,
            'post'        => $post,
            'fromPercent' => $fromPercent,
            'toPercent'   => $toPercent,
            'duration'    => $duration,
            'delay'       => $this->data->get('animationdelay'),
            'min'         => $min,
            'total'       => $total,
            'c'           => $c,
            'counting'    => '.n2-ss-item-circlecounter-counting-div',
            'displayMode' => 'circle',
            'display'     => 'circle + circle'
        );

        if ($this->isEditor && $owner->underEdit) {
            $owner->addScript('new _N2.CounterItemAdmin(this, "' . $this->id . '", ' . json_encode($jsData) . ');');
        } else {
            $owner->addScript('new _N2.FrontendItemCounter(this, "' . $this->id . '", ' . json_encode($jsData) . ');');
        }

        return Html::tag('div', array(
            'class' => 'n2-ss-item-content n2-ow'
        ), $html);
    }

    /**
     * @param AbstractRenderableOwner $owner
     */
    public function loadResources($owner) {
        $owner->addLess(self::getAssetsPath() . "/circlecounter.n2less", array(
            "sliderid" => $owner->getElementID()
        ));
    }
}Renderable/Item/Caption/ItemCaption.php000064400000023756152355233130014046 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Caption;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\MixedField;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemCaption extends AbstractItem {

    protected $ordering = 4;

    protected $layerProperties = array(
        "desktopportraitleft"  => 0,
        "desktopportraittop"   => 0,
        "desktopportraitwidth" => 200
    );

    protected $fonts = array(
        'fonttitle' => array(
            'defaultName' => 'item-caption-font-title',
            'value'       => '{"data":[{"color":"ffffffff","size":"14||px","align":"inherit"},{"extra":""},{"extra":""}]}'
        ),
        'font'      => array(
            'defaultName' => 'item-caption-font',
            'value'       => '{"data":[{"color":"ffffffff","size":"14||px","align":"inherit"},{"extra":""},{"extra":""}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'caption';
    }

    public function getTitle() {
        return n2_('Caption');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--imagecaption';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemCaptionFrontend($this, $id, $itemData, $layer);
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-caption-font-title', n2_('Title'), $this->fonts['fonttitle']['value'], array(
            'mode' => 'paragraph'
        ));

        new Font($row1, 'item-caption-font', n2_('Description'), $this->fonts['font']['value'], array(
            'mode' => 'paragraph'
        ));
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/caption.n2less", array(
            "sliderid" => $renderable->elementId
        ));
    }

    public function getValues() {

        return parent::getValues() + array(
                'animation'      => 'Simple|*|left|*|0',
                'image'          => '$ss3-frontend$/images/placeholder/image.png',
                'alt'            => '',
                'href'           => '#',
                'href-target'    => '_self',
                'href-rel'       => '',
                'verticalalign'  => 'center',
                'content'        => n2_('Caption'),
                'description'    => '',
                'color'          => '00000080',
                'image-optimize' => 1
            );
    }


    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('image', $slide->fill($data->get('image', '')));
        $data->set('alt', $slide->fill($data->get('alt', '')));
        $data->set('content', $slide->fill($data->get('content', '')));
        $data->set('description', $slide->fill($data->get('description', '')));
        $data->set('href', $slide->fill($data->get('href', '#|*|')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addImage($data->get('image'));
        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('fonttitle'));
        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('image', $import->fixImage($data->get('image')));
        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('fonttitle', $import->fixSection($data->get('fonttitle')));
        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function prepareSample($data) {
        $data->set('image', ResourceTranslator::toUrl($data->get('image')));

        return $data;
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption', n2_('General'));

        new FieldImage($settings, 'image', n2_('Image'), '', array(
            'relatedAlt' => 'item_captionalt',
            'width'      => 220
        ));

        new Text($settings, 'content', n2_('Title'), '', array(
            'style' => 'width:302px;'
        ));
        new HiddenFont($settings, 'fonttitle', n2_('Font') . ' - ' . n2_('Title'), '', array(
            'mode' => 'paragraph'
        ));

        new Textarea($settings, 'description', n2_('Description'), '', array(
            'width' => 314
        ));
        new HiddenFont($settings, 'font', n2_('Font') . ' - ' . n2_('Description'), '', array(
            'mode' => 'paragraph'
        ));

        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'relatedFields' => array(
                'item_captionhref-target',
                'item_captionhref-rel'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));

        $animationFieldset = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption-animation', n2_('Animation'));
        $animation         = new MixedField($animationFieldset, 'animation', false, 'Simple|*|left|*|0');
        new Select($animation, 'animation-1', n2_('Animation'), '', array(
            'options'            => array(
                'Full'   => n2_('Full'),
                'Simple' => n2_('Simple'),
                'Fade'   => n2_('Fade')
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'Full',
                        'Simple'
                    ),
                    'field'  => array(
                        'animationitem_captionanimation-2'
                    )
                ),
                array(
                    'values' => array(
                        'Full',
                        'Fade'
                    ),
                    'field'  => array(
                        'item_captionverticalalign'
                    )
                )
            )
        ));
        new Select($animation, 'animation-2', n2_('Direction'), '', array(
            'options' => array(
                'top'    => n2_('Top'),
                'right'  => n2_('Right'),
                'bottom' => n2_('Bottom'),
                'left'   => n2_('Left')
            )
        ));
        new OnOff($animation, 'animation-3', n2_('Scale'), 0, array(
            'tipLabel'       => n2_('Scale'),
            'tipDescription' => n2_('Scales up the image on hover')
        ));

        $overlay = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption-overlay', n2_('Display'));
        new Color($overlay, 'color', n2_('Overlay background'), '00000080', array(
            'alpha' => true
        ));
        new Select($overlay, 'verticalalign', n2_('Vertical align'), '', array(
            'options'        => array(
                'flex-start' => n2_('Top'),
                'center'     => n2_('Center'),
                'flex-end'   => n2_('Bottom')
            ),
            'tipLabel'       => n2_('Vertical align'),
            'tipDescription' => n2_('Positions the text inside the overlay.')
        ));

        $seo = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption-seo', n2_('SEO'));
        new Text($seo, 'alt', 'SEO - ' . n2_('Alt tag'), '', array(
            'style' => 'width:302px;'
        ));

        $optimize = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption-optimize', n2_('Optimize'));
        new OnOff($optimize, 'image-optimize', n2_('Optimize image'), 1, array(
            'tipLabel'       => n2_('Optimize image'),
            'tipDescription' => n2_('You can turn off the Layer image optimization for this image, to resize it for tablet and mobile.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1839-caption-layer#optimize'
        ));

    }
}Renderable/Item/Caption/ItemCaptionFrontend.php000064400000006543152355233130015541 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Caption;


use Nextend\Framework\Parser\Color;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemCaptionFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $this->loadResources($owner);

        list($mode, $direction, $scale) = Common::parse($this->data->get('animation', 'Simple|*|left|*|0'));
        switch ($direction) {
            case 'top':
                $axis  = 'yP';
                $ratio = -1;
                break;
            case 'right':
                $axis  = 'xP';
                $ratio = 1;
                break;
            case 'bottom':
                $axis  = 'yP';
                $ratio = 1;
                break;
            case 'left':
                $axis  = 'xP';
                $ratio = -1;
                break;
        }
        $owner->addScript('new _N2.FrontendItemCaption(this, "' . $this->id . '", "' . $mode . '",' . json_encode($axis) . ',' . json_encode($ratio) . ', ' . intval($scale) . ');');

        $image = $owner->fill($this->data->get('image', ''));

        $imageAttributes = array(
            'alt' => htmlspecialchars($owner->fill($this->data->get('alt', '')))
        );

        $html = $owner->renderImage($this, $image, $imageAttributes);

        $rgba = Color::colorToRGBA($this->data->get('color', '00000080'));
        $html .= Html::openTag("div", array(
            "class" => "n2-ss-item-caption-content",
            "style" => "background: {$rgba};" . 'justify-content:' . $this->data->get('verticalalign', 'center') . ';'
        ));

        $title = Sanitize::filter_allowed_html($owner->fill($this->data->get('content', '')));
        if ($title != '') {
            $fontTitle = $owner->addFont($this->data->get('fonttitle'), 'paragraph');
            $html      .= Html::tag("div", array("class" => 'n2-div-h4 ' . $fontTitle), $title);
        }

        $description = Sanitize::filter_allowed_html($owner->fill($this->data->get('description', '')));
        if ($description != '') {
            $font = $owner->addFont($this->data->get('font'), 'paragraph');
            $html .= Html::tag("p", array("class" => $font), $description);
        }

        $html .= Html::closeTag("div");

        $linkAttributes = array();
        if ($this->isEditor) {
            $linkAttributes['onclick'] = 'return false;';
        }

        return Html::tag("div", array(
            "id"             => $this->id,
            "class"          => "n2-ss-item-caption n2-ss-item-content n2-ow-all n2-ss-item-caption-" . $mode,
            "data-direction" => $direction
        ), $this->getLink($html, $linkAttributes));
    }

    /**
     * @param AbstractRenderableOwner $owner
     */
    public function loadResources($owner) {

        $owner->addLess(self::getAssetsPath() . "/caption.n2less", array(
            "sliderid" => $owner->getElementID()
        ));
    }
}Renderable/Item/BeforeAfter/ItemBeforeAfter.php000064400000033522152355233130015414 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Renderable\Item\BeforeAfter;


use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemBeforeAfter extends AbstractItem {


    protected $fonts = array(
        'fontlabel'   => array(
            'defaultName' => 'item-beforeafter-fontlabel',
            'value'       => '{"data":[{"extra":"","color":"000000FF","size":"14||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1.2","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{},{}]}'
        ),
        'fontcaption' => array(
            'defaultName' => 'item-beforeafter-fontcaption',
            'value'       => '{"data":[{"extra":"","color":"000000FF","size":"14||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1.2","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{},{}]}'
        )
    );


    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'beforeafter';
    }

    public function getTitle() {
        return n2_('Before After');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--beforeafter';
    }

    public function getGroup() {
        return n2_x('Special', 'Layer group');
    }


    public function createFrontend($id, $itemData, $layer) {
        return new ItemBeforeAfterFrontend($this, $id, $itemData, $layer);
    }


    public function loadResources($renderable) {
        parent::loadResources($renderable);
        $renderable->addLess(self::getAssetsPath() . "/beforeAfter.n2less", array(
            "sliderid" => $renderable->elementId
        ));


        $renderable->addScript('_N2.ItemBeforeafter.svgUrlList=' . json_encode($this->getArrowUrlList()) . ';');
        $renderable->addScript('_N2.ItemBeforeafter.svgTypeList=' . json_encode($this->getArrowTypeList()) . ';');


    }


    public function getValues() {
        return parent::getValues() + array(
                'imagebefore'       => '$ss3-frontend$/images/placeholder/image.png',
                'imageafter'        => '$ss3-frontend$/images/placeholder/video.png',
                'textbefore'        => n2_('Before'),
                'textafter'         => n2_('After'),
                'labelposition'     => 'center',
                'labelbackground'   => 'FFFFFFFF',
                'showlabel'         => 1,
                'labeltype'         => 'normal',
                'showcaption'       => 0,
                'captiontext'       => n2_('Caption'),
                'captiontype'       => 'normal',
                'captionposition'   => '3-2',
                'captionbackground' => 'FFFFFFFF',
                'direction'         => 'horizontal',
                'interaction'       => 'drag',
                'dividerstyle'      => 'arrow',
                'dividercolor'      => 'FFFFFFFF',
                'dividerwidth'      => '4',
                'width'             => '4',
                'startposition'     => '50',
                'image-optimize'  => 1
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('imagebefore', $slide->fill($data->get('imagebefore', '')));
        $data->set('imageafter', $slide->fill($data->get('imageafter', '')));
        $data->set('textbefore', $slide->fill($data->get('textbefore', '')));
        $data->set('textafter', $slide->fill($data->get('textafter', '')));
        $data->set('captiontext', $slide->fill($data->get('captiontext', '')));
        $data->set('altbefore', $slide->fill($data->get('altbefore', '')));
        $data->set('altafter', $slide->fill($data->get('altafter', '')));

        return $data;

    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('fontlabel'));
        $export->addVisual($data->get('fontcaption'));

        $export->addImage($data->get('imagebefore', ''));
        $export->addImage($data->get('imageafter', ''));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('fontlabel', $import->fixSection($data->get('fontlabel')));
        $data->set('fontcaption', $import->fixSection($data->get('fontcaption')));

        $data->set('imagebefore', $import->fixImage($data->get('imagebefore')));
        $data->set('imageafter', $import->fixImage($data->get('imageafter')));



        return $data;
    }

    public function prepareSample($data) {
        $data->set('imagebefore', ResourceTranslator::toUrl($data->get('imagebefore', '')));
        $data->set('imageafter', ResourceTranslator::toUrl($data->get('imageafter', '')));

        return $data;
    }



    private function getArrowTypeList() {
        return array(
            'arrow' => 'default',
            'circle'    => 'custom',
            'rectangle' => 'custom'
        );
    }

    private function getArrowUrlList() {
        static $types = null;
        if ($types === null) {
            $types     = array();
            $extension = 'svg';
            $folder    = self::getAssetsPath() . '/svg/';
            $files     = Filesystem::files($folder);
            foreach ($files as $file) {
                $pathInfo = pathinfo($file);
                if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
                    $types[$pathInfo['filename']] = Filesystem::readFile($folder . $file);;
                }
            }
        }

        return $types;
    }

    public function getArrowSvg($type) {
        $arrowList = $this->getArrowUrlList();

        if (isset($this->getArrowTypeList()[$type])) {
            $arrow = $arrowList["arrow_" . $this->getArrowTypeList()[$type]];
            return $arrow;
        }

        return false;
    }

    private function getCaptionTypes() {
        return array(
            '1-1' => n2_('Left top'),
            '1-2' => n2_('Center top'),
            '1-3' => n2_('Right top'),
            '2-1' => n2_('Left center'),
            '2-2' => n2_('Center'),
            '2-3' => n2_('Right Center'),
            '3-1' => n2_('Left bottom'),
            '3-2' => n2_('Center bottom'),
            '3-3' => n2_('Right bottom')
        );
    }




    public function globalDefaultItemFontAndStyle($container) {
        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-beforeafter-fontlabel', false, $this->fonts['fontlabel']['value'], array(
            'mode' => 'simple'
        ));
        new Font($row1, 'item-beforeafter-captionlabel', false, $this->fonts['fontcaption']['value'], array(
            'mode' => 'simple'
        ));

    }

    public function renderFields($container) {

        $general = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-beforeafter', n2_('General'));
        new FieldImage($general, 'imagebefore', n2_('Before Image'), '', array(
            'width'         => 220,
            'relatedFields' => array(
                'item_beforeafteraltbefore'
            )
        ));
        new FieldImage($general, 'imageafter', n2_('After Image'), '', array(
            'width'         => 220,
            'relatedFields' => array(
                'item_beforeafteraltafter'
            )
        ));

        $label = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-beforeafter-label', n2_('Label'));
        new OnOff($label, 'showlabel', n2_('Labels'), 1, array(
            'relatedFieldsOn' => array(
                'item_beforeaftertextbefore',
                'item_beforeaftertextafter',
                'item_beforeafterlabelposition',
                'item_beforeafterlabeltype',
                'item_beforeafterlabelbackground',
            )
        ));
        new Select($label, 'labeltype', n2_('Show Label'), '', array(
            'options' => array(
                'normal' => n2_('Normal'),
                'hover'  => n2_('Hover'),
                'always' => n2_('Always')
            )
        ));
        new Select($label, 'labelposition', n2_('Position'), '', array(
            'options' => array(
                'start'  => n2_('Start'),
                'center' => n2_('Center'),
                'end'    => n2_('End')
            )
        ));
        new Text($label, 'textbefore', n2_('Before label'), '', array(
            'style' => 'width:132px;',
        ));
        new Text($label, 'textafter', n2_('After label'), '', array(
            'style' => 'width:132px;',
        ));


        new Color($label, 'labelbackground', n2_('Background'), 'FFFFFFFF', array(
            'alpha' => true,
            'style' => "width:75px"

        ));

        new HiddenFont($label, 'fontlabel', n2_('Font') . ' - ' . n2_('Label'), '', array(
            'mode' => 'simple'
        ));

        $behavior = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-beforeafter-behavior', n2_('Behavior'));
        new Select($behavior, 'direction', n2_('Direction'), '', array(
            'options' => array(
                'horizontal' => n2_('Horizontal'),
                'vertical'   => n2_('Vertical'),
            )
        ));

        new Select($behavior, 'interaction', n2_('Interaction'), 'drag', array(
            'options' => array(
                'drag'  => n2_('Drag'),
                'hover' => n2_('Hover'),
            )
        ));

        $divider = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-beforeafter-divider', n2_('Divider'));

        new Select($divider, 'dividerstyle', n2_('Type'), 'arrow', array(
            'options' => array(
                'line'      => n2_('Line'),
                'arrow'     => n2_('Arrow'),
                'circle'    => n2_('Circle'),
                'rectangle' => n2_('Rectangle'),
            )
        ));

        new Color($divider, 'dividercolor', n2_('Color'), 'FFFFFFFF', array(
            'alpha' => true,
            'style' => "width:65px"

        ));

        $caption = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-beforeafter-caption', n2_('Caption'));
        new OnOff($caption, 'showcaption', n2_('Caption'), 0, array(
            'relatedFieldsOn' => array(
                'item_beforeaftercaptiontype',
                'item_beforeaftercaptionposition',
                'item_beforeaftercaptiontext',
                'item_beforeaftercaptionbackground',
            )
        ));

        new Select($caption, 'captiontype', n2_('Show Caption'), 'normal', array(
            'options' => array(
                'normal' => n2_('Normal'),
                'hover'  => n2_('Hover'),
                'always' => n2_('Always')
            )
        ));

        new Select($caption, 'captionposition', n2_('Position'), '', array(
            'options' => $this->getCaptionTypes()
        ));

        new Text($caption, 'captiontext', n2_('Caption text'), 'Caption', array(
            'style' => 'width:132px;',
        ));

        new Color($caption, 'captionbackground', n2_('Background'), 'FFFFFFFF', array(
            'alpha' => true,
            'style' => "width:75px"

        ));

        new HiddenFont($caption, 'fontcaption', n2_('Font') . ' - ' . n2_('Caption'), '', array(
            'mode' => 'simple'
        ));


        new NumberSlider($divider, 'startposition', n2_('Position'), 50, array(
            'min'       => 0,
            'max'       => 100,
            'unit'      => '%',
            'style'     => "width:15px;",
            'sliderMax' => 100,
            'step'      => 5,
            'wide'      => 4
        ));

        new Select($divider, 'dividerwidth', n2_('Width'), 4, array(
            'options' => array(
                '2'  => '2',
                '4'  => '4',
                '6'  => '6',
                '8'  => '8',
                '10' => '10'
            )
        ));



        $seo = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-beforeafter-seo', n2_('SEO'));
        new Text($seo, 'altbefore', n2_('Before image alt tag'), '', array(
            'style' => 'width:132px;'
        ));
        new Text($seo, 'altafter', n2_('After image alt tag'), '', array(
            'style' => 'width:132px;'
        ));

        $optimize = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-caption-optimize', n2_('Optimize'));
        new OnOff($optimize, 'image-optimize', n2_('Optimize images'), 1, array(
            'tipLabel'       => n2_('Optimize image'),
            'tipDescription' => n2_('You can turn off the Layer image optimization for this image, to resize it for tablet and mobile.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1839-caption-layer#optimize'
        ));

    }
}Renderable/Item/BeforeAfter/ItemBeforeAfterFrontend.php000064400000021523152355233130017112 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\BeforeAfter;


use Nextend\Framework\Parser\Color;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemBeforeAfterFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }


    private function getHtml() {
        $image  = $this->data->get('imagebefore', '');
        $image2 = $this->data->get('imageafter', '');

        if (empty($image) && empty($image2)) {
            return '';
        }

        $owner = $this->layer->getOwner();
        $this->loadResources($owner);

        $image  = $owner->fill($image);
        $image2 = $owner->fill($image2);

        if (empty($image) && empty($image2)) {
            return '';
        }


        $attributes = [
            'direction'         => $this->data->get('direction', 'horizontal'),
            'startposition'     => $this->data->get('startposition', '50'),
            'interaction'       => $this->data->get('interaction', 'drag'),
            'dividerstyle'      => $this->data->get('dividerstyle', 'line'),
            'dividercolor'      => $this->data->get('dividercolor', '00000080'),
            'dividerwidth'      => $this->data->get('dividerwidth', '4'),
            'labelpositon'      => $this->data->get('labelposition', 'end'),
            'labelfront'        => $this->data->get('labelfront', '0'),
            'labeltype'         => $this->data->get('labeltype', 'normal'),
            'showlabel'         => $this->data->get('showlabel', 1),
            'labelbackground'   => $this->data->get('labelbackground', 'FFFFFF80'),
            'fontlabel'         => $owner->addFont($this->data->get('fontlabel'), 'simple'),
            'fontcaption'       => $owner->addFont($this->data->get('fontcaption'), 'simple'),
            'showcaption'       => $this->data->get('showcaption', ""),
            'captiontype'       => $this->data->get('captiontype', ""),
            'captionbackground' => $this->data->get('captionbackground', "00000080"),
            'captionpos'        => $this->data->get('captionposition', "2-3"),
            'captionrow'        => '2',
            'captioncol'        => '3',
        ];


        //need here because style
        $gridValues               = explode('-', $attributes['captionpos']);
        $attributes['captionrow'] = $gridValues[0];
        $attributes['captioncol'] = $gridValues[1];

        //Container
        $styles = "
       --dividerColor : " . Color::colorToRGBA($attributes['dividercolor'], '00000080') . " ;
       --dividerPos : " . $attributes['startposition'] . "%;
       --imagePos : " . $attributes['startposition'] . "%;
       --labelBackground : " . Color::colorToRGBA($attributes['labelbackground'], '00000080') . ";
       --captionBackground : " . Color::colorToRGBA($attributes['captionbackground'], '00000080') . ";
       --dividerWidth : " . $attributes['dividerwidth'] . "px;";

        $containerInEditor = $this->isEditor ? "n2-ss-item-ba-container--ineditor" : "";

        $html = Html::openTag("div", array(
            'style' => $styles,
            "class" => "n2-ss-item-ba-container n2-ss-item-ba-container--{$attributes['direction']} n2_container_scrollable $containerInEditor n2-ss-item-ba-container--interaction-{$attributes['interaction']}"
        ));


        $labelBefore = $textBefore = "";
        $labelAfter  = $textAfter = "";
        if ($attributes['showlabel']) {
            $textBefore = Sanitize::filter_allowed_html($owner->fill($this->data->get('textbefore', "")));
            $textAfter  = Sanitize::filter_allowed_html($owner->fill($this->data->get('textafter', "")));
            $show       = $attributes['interaction'] === 'hover' && $attributes['labeltype'] === 'hover' ? 'normal' : $attributes['labeltype'];

            $labelClass = $this->isEditor ? "" : "n2-ss-item-ba-label--show-$show n2-ss-text n2-ow ";
            $labelClass .= $attributes['fontlabel'];

            if ($textBefore) $labelBefore = "<div class='n2-ss-item-ba-label n2-ss-item-ba-label--before $labelClass'> $textBefore</div>";
            if ($textAfter) $labelAfter = "<div class='n2-ss-item-ba-label n2-ss-item-ba-label--after $labelClass'> $textAfter</div>";

        }

        //Caption
        if ($attributes['showcaption']) {
            $captionText = Sanitize::filter_allowed_html($owner->fill($this->data->get('captiontext', "")));
            if ($captionText != "") {
                $show           = $attributes['interaction'] === 'hover' && $attributes['captiontype'] === 'hover' ? 'normal' : $attributes['captiontype'];
                $labelClass     = $this->isEditor ? "" : "n2-ss-item-ba-caption--show-$show n2-ss-text n2-ow";
                $caption        = "<div class='n2-ss-item-ba-caption $labelClass {$attributes['fontcaption']}'> $captionText</div>";
                $labelContainer = Html::tag('div', array(
                    "data-position" => $attributes['captionpos'],
                    "class"         => "n2-ss-item-ba-caption-container"
                ), $caption);
                $html           .= $labelContainer;
            }
        }

        //Images

        $imageAttributes = array(
            'alt'       => htmlspecialchars($owner->fill($this->data->getIfEmpty('altbefore', $textBefore))),
            'class'     => 'n2-ow-all n2-ss-item-ba-image n2-ss-item-ba-image--before',
            'draggable' => 'false'
        );

        $imageBefore = Html::tag("div", array(
            "class" => "n2-ss-item-ba-image-container n2-ss-item-ba-image-container--bottom n2-ss-item-ba-label-container--{$attributes['labelpositon']}"
        ), $labelBefore . $owner->renderImage($this, $image, $imageAttributes));


        $imageAttributes2 = array(
            'alt'       => htmlspecialchars($owner->fill($this->data->getIfEmpty('altafter', $textAfter))),
            'class'     => 'n2-ow-all n2-ss-item-ba-image n2-ss-item-ba-image--after',
            'draggable' => 'false'
        );

        $imageAfter = Html::tag("div", array(
            "class" => "n2-ss-item-ba-image-container n2-ss-item-ba-image-container--top n2-ss-item-ba-label-container--{$attributes['labelpositon']}"
        ), $labelAfter . $owner->renderImage($this, $image2, $imageAttributes2));


        $html .= $imageBefore;
        $html .= $imageAfter;

        //Divider
        $dividerClass = ($attributes['dividerstyle'] === 'line' || $attributes['dividerstyle'] === 'arrow') ? '' : 'n2-ss-item-ba-divider--gap';
        $divider      = Html::openTag("div", array(
            "class" => "n2-ss-item-ba-divider $dividerClass"
        ));
        //Divider-part-top
        $divider .= "<div class='n2-ss-item-ba-divider-part n2-ss-item-ba-divider-part--top'></div>";

        //Svg arrows
        $svg = $this->item->getArrowSvg($attributes['dividerstyle']);
        //arrowContainer
        if ($svg) {
            $arrowContainer = Html::tag("div", array(
                "class" => "n2-ss-item-ba-arrow-container n2-ss-item-ba-arrow-container--{$attributes['dividerstyle']}"
            ), $svg . $svg);

            $divider .= $arrowContainer;
        }

        //Divider-part-bottom
        $divider .= "<div class='n2-ss-item-ba-divider-part n2-ss-item-ba-divider-part--bottom'></div>";

        //Divider Close
        $divider .= Html::closeTag('div');


        //Dividercontainer
        $dividerContainer = Html::tag("div", array(
            "class" => "n2-ss-item-ba-divider-container"
        ), $divider);

        $html .= $dividerContainer;

        //Close Container
        $html .= Html::closeTag('div');


        $jsData = array(
            'startPos'    => $attributes['startposition'],
            'interaction' => $attributes['interaction'],
            'direction'   => $attributes['direction'],
            'labeltype'   => $attributes['labeltype'],
            'captiontype' => $attributes['captiontype'],

        );

        if (!$this->isEditor && !$owner->underEdit) {
            $owner->addScript('new _N2.FrontendItemBeforeAfter(this, "' . $this->id . '", ' . json_encode($jsData) . ');');
        }


        return Html::tag("div", array(
            "id"    => $this->id,
            "class" => "n2-ss-item-ba-wrapper n2-ss-item-content n2-ow-all"
        ), $html);
    }


    /**
     * @param $owner AbstractRenderableOwner
     */
    public function loadResources($owner) {


        $owner->addLess(self::getAssetsPath() . "/beforeAfter.n2less", array(
            "sliderid" => $owner->getElementID()
        ));


    }


}Renderable/Item/Audio/ItemAudio.php000064400000012552152355233130013146 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Audio;


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\Color;
use Nextend\Framework\Form\Element\Text\Video;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemAudio extends AbstractItem {

    protected $ordering = 21;

    protected $layerProperties = array(
        "desktopportraitwidth" => 300
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'audio';
    }

    public function getTitle() {
        return n2_('Audio');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--audio';
    }

    public function getGroup() {
        return n2_x('Media', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemAudioFrontend($this, $id, $itemData, $layer);
    }

    /**
     * @return array
     */
    public function getValues() {
        return parent::getValues() + array(
                'audio_mp3'     => '',
                'volume'        => 1,
                'autoplay'      => 0,
                'loop'          => 0,
                'reset'         => 0,
                'color'         => '000000B2',
                'color2'        => 'ffffff',
                'videoplay'     => '',
                'videopause'    => '',
                'videoend'      => '',
                'fullwidth'     => 1,
                'show'          => 1,
                'show-progress' => 1,
                'show-time'     => 1,
                'show-volume'   => 1,
                'iconsize'      => 'small',
            );
    }


    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('audio_mp3', $slide->fill($data->get('audio_mp3', '')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addImage($data->get('audio_mp3'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('audio_mp3', $import->fixImage($data->get('audio_mp3')));

        return $data;
    }

    public function prepareSample($data) {
        $data->set('audio_mp3', ResourceTranslator::toUrl($data->get('audio_mp3')));

        return $data;
    }

    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/audio.n2less", array(
            "sliderid" => $renderable->elementId
        ));
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-audio', n2_('General'));

        new Video($settings, 'audio_mp3', n2_('MP3 audio'), '', array(
            'width' => 220
        ));

        new Color($settings, 'color', n2_('Main color'), '', array(
            'alpha' => true
        ));
        new Color($settings, 'color2', n2_('Secondary color'));

        $audioSettings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-audio-settings', n2_('Audio settings'));
        new Warning($audioSettings, 'autoplay-notice', sprintf(n2_('Audio autoplaying has a lot of limitations made by browsers. You can read about them %1$shere%2$s.'), '<a href="https://smartslider.helpscoutdocs.com/article/1919-video-autoplay-handling" target="_blank">', '</a>'));

        new OnOff($audioSettings, 'autoplay', n2_('Autoplay'), 0, array(
            'relatedFieldsOn' => array(
                'item_audioautoplay-notice'
            )
        ));
        new OnOff($audioSettings, 'loop', n2_x('Loop', 'Video/Audio play'), 0);
        new Select($audioSettings, 'volume', n2_('Volume'), 1, array(
            'options' => array(
                '0'    => n2_('Mute'),
                '0.25' => '25%',
                '0.5'  => '50%',
                '0.75' => '75%',
                '1'    => '100%'
            )
        ));
        new OnOff($audioSettings, 'reset', n2_('Restart on slide change'), 0, array(
            'tipLabel'       => n2_('Restart on slide change'),
            'tipDescription' => n2_('Starts the audio from the beginning when the slide is viewed again.')
        ));

        $display = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-audio-display', n2_('Display'));
        new OnOff($display, 'fullwidth', n2_('Full width'), 0);
        new OnOff($display, 'show', n2_('Controls'), 0, array(
            'relatedFieldsOn' => array(
                'item_audioiconsize'
            )
        ));
        new OnOff($display, 'show-progress', n2_('Progress'), 0);
        new OnOff($display, 'show-time', n2_('Time'), 0);
        new OnOff($display, 'show-volume', n2_('Volume'), 0);
        new Select($display, 'iconsize', n2_('Icon Size'), 'small', array(
            'options' => array(
                'small'  => 'Small',
                'medium' => 'Medium',
                'large'  => 'Large'
            )
        ));
    }
}Renderable/Item/Audio/ItemAudioFrontend.php000064400000013477152355233130014655 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Audio;


use Nextend\Framework\Parser\Color;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemAudioFrontend extends AbstractItemFrontend {

    public function render() {
        $owner = $this->layer->getOwner();

        $owner->addScript('new _N2.FrontendItemAudio(this, "' . $this->id . '", ' . $this->data->toJSON() . ');');

        return $this->getHTML();
    }

    public function renderAdminTemplate() {
        return $this->getHTML();
    }

    public function getHTML() {
        $owner = $this->layer->getOwner();

        $this->loadResources($owner);
        $attributes['iconsize'] = $this->data->get('iconsize');

        $attributes = array(
            'class' => 'n2-ss-item-audio-bar n2-ss-item-audio-bar--' . $attributes['iconsize'] . ' n2-ow n2-ss-item-content n2-ow-all',
            'id'    => $this->id
        );

        $controls = array();

        if ($this->data->get('show')) {
            $attributes['data-state']  = 'paused';
            $attributes['data-volume'] = '1';
            $attributes['style']       = 'background-color:' . Color::colorToRGBA($this->data->get('color')) . ';';
            if (!$this->data->get('fullwidth')) {
                $attributes['style'] .= 'display:inline-flex;vertical-align:top;';
            }

            $controls[] = '<div class="n2-ss-item-audio-play"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="{color2}" d="M20 15.99c0 .41-.21.772-.52.967l-6.867 4.87c-.003 0-.006.002-.01.004l-.003.004c-.158.1-.342.156-.54.156-.585 0-1.06-.504-1.06-1.125v-9.752c0-.622.475-1.126 1.06-1.126.198 0 .382.058.54.157l.004.002.01.006 6.865 4.868c.31.196.52.556.52.97z"></path></svg></div>';
            $controls[] = '<div class="n2-ss-item-audio-pause"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="{color2}" d="M17 22V10h4v12h-4zm-6-12h4v12h-4V10z"></path></svg></div>';

            if ($this->data->get('show-progress')) {
                $controls[] = '<div class="n2-ss-item-audio-progress-container n2_container_scrollable"><div class="n2-ss-item-audio-progress" style="background:{bar};"><div style="background:{color2};" class="n2-ss-item-audio-progress-playhead"></div></div></div>';
            }
            if ($this->data->get('show-time')) {
                $controls[] = '<div class="n2-ss-item-audio-time" style="color:{color2};">00:00 / 00:00</div>';
            }
            if ($this->data->get('show-volume')) {
                $controls[] = '<div class="n2-ss-item-audio-unmute"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="{color2}" d="M15 22h-1l-4-4H9c-.45 0-1-.527-1-1v-3c0-.474.55-1 1-1h1l4-4h1v13z"/></svg></div>';
                $controls[] = '<div class="n2-ss-item-audio-mute"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="{color2}" d="M15 22h-1l-4-4H9c-.45 0-1-.527-1-1v-3c0-.474.55-1 1-1h1l4-4h1v13zm3.147-1.954l-.06.002c-.215 0-.423-.09-.577-.25l-.11-.116c-.286-.3-.32-.776-.078-1.117.612-.865.935-1.892.935-2.968 0-1.158-.367-2.244-1.06-3.14-.266-.342-.24-.837.055-1.148l.11-.115c.162-.172.38-.265.618-.25.23.012.446.126.592.313.963 1.236 1.472 2.737 1.472 4.34 0 1.49-.45 2.912-1.3 4.106-.143.2-.36.324-.597.342zm3.38 2.65c-.15.183-.363.293-.59.303H20.9c-.215 0-.423-.09-.577-.25l-.107-.114c-.3-.314-.32-.817-.048-1.158 1.32-1.644 2.045-3.733 2.045-5.88 0-2.236-.778-4.387-2.19-6.058-.285-.34-.27-.853.034-1.174l.107-.112c.16-.168.365-.26.603-.252.225.006.438.11.587.287C23.06 10.303 24 12.9 24 15.596c0 2.595-.878 5.116-2.474 7.1z"></path></svg></div>';
                $controls[] = '<div class="n2-ss-item-audio-volume-container n2_container_scrollable"><div class="n2-ss-item-audio-volume" style="background:{bar};"><div style="background:{color2};" class="n2-ss-item-audio-volumehead"></div></div></div>';
            }
        } else if ($owner->isAdmin()) {
            $controls[]          = 'Audio';
            $attributes['style'] = 'color:#' . $this->data->get('color2') . ';';
        }

        return Html::tag('div', $attributes, $this->getAudioHTML($owner) . str_replace(array(
                '{bar}',
                '{color2}'
            ), array(
                Color::colorToRGBA($this->data->get('color2') . '33'),
                '#' . $this->data->get('color2')
            ), implode('', $controls)));
    }

    /**
     * @param AbstractRenderableOwner $slide
     *
     * @return string
     */
    private function getAudioHTML($slide) {
        $attributes = array();

        if ($this->data->get("volume", 1) == 0) {
            $attributes['muted'] = true;
        }

        return Html::tag("audio", $attributes, $this->setContent($slide));
    }


    /**
     * @param AbstractRenderableOwner $slide
     *
     * @return string
     */
    private function setContent($slide) {
        $videoContent = "";

        if ($this->data->get("audio_mp3", false)) {

            $audioUrl = ResourceTranslator::toUrl($slide->fill($this->data->get("audio_mp3")));
            $type     = "audio/mpeg";

            if (strpos($audioUrl, '.m4a')) {
                $type = "audio/mp4";
            }

            $videoContent .= Html::tag("source", array(
                "src"  => $audioUrl,
                "type" => $type
            ), '', false);
        }

        return $videoContent;
    }

    /**
     * @param AbstractRenderableOwner $owner
     */
    public function loadResources($owner) {
        $owner->addLess(self::getAssetsPath() . "/audio.n2less", array(
            "sliderid" => $owner->getElementID()
        ));
    }
}Renderable/Item/Area/ItemArea.php000064400000016356152355233130012572 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Area;


use Nextend\Framework\Form\Element\MarginPadding;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Gradient;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemArea extends AbstractItem {

    protected $ordering = 100;

    protected $layerProperties = array(
        "desktopportraitwidth"  => 150,
        "desktopportraitheight" => 150
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'area';
    }

    public function getTitle() {
        return n2_('Area');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--area';
    }

    public function getGroup() {
        return n2_x('Advanced', 'Layer group');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemAreaFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {
        return parent::getValues() + array(
                'width'        => '',
                'height'       => '',
                'color'        => '000000ff',
                'gradient'     => 'off',
                'color2'       => '000000ff',
                'css'          => '',
                'borderWidth'  => '0|*|0|*|0|*|0',
                'borderStyle'  => 'solid',
                'borderColor'  => 'ffffff1f',
                'borderRadius' => 0,
                'href'         => '#',
                'href-target'  => '_self',
                'href-rel'     => '',
            );
    }

    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }

        $borderWidthV1 = $data->get('borderWidth', 0);
        if (is_numeric($borderWidthV1)) {
            $data->set('borderWidth', $borderWidthV1 . '|*|' . $borderWidthV1 . '|*|' . $borderWidthV1 . '|*|' . $borderWidthV1 . '');
        }

    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('href', $slide->fill($data->get('href', '#|*|')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function renderFields($container) {
        $color = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-area', n2_('Color'));
        new Color($color, 'color', n2_('Background color'), '00000000', array(
            'alpha' => true
        ));
        new Gradient($color, 'gradient', n2_('Gradient'), 'off', array(
            'relatedFields' => array(
                'item_areacolor2'
            )
        ));
        new Color($color, 'color2', n2_('Color end'), 'ffffff00', array(
            'alpha' => true
        ));

        $border = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-area-border', n2_('Border'));

        $borderWidth = new MarginPadding($border, 'borderWidth', n2_('Border'), '0|*|0|*|0|*|0', array(
            'unit'          => 'px',
            'relatedFields' => array(
                'item_areaborderStyle',
                'item_areaborderColor',
            )
        ));

        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($borderWidth, 'borderWidth-' . $i, false, '', array(
                'values' => array(
                    0,
                    1,
                    2,
                    3,
                    5
                ),
                'min'    => 0,
                'wide'   => 3
            ));
        }

        new Select($border, 'borderStyle', n2_('Style'), 'solid', array(
            'options' => array(
                'none'   => n2_('None'),
                'solid'  => n2_('Solid'),
                'dashed' => n2_('Dashed'),
                'dotted' => n2_('Dotted'),
            )
        ));

        new Color($border, 'borderColor', n2_('Color'), '00000000', array(
            'alpha' => true
        ));

        new NumberAutoComplete($border, 'borderRadius', n2_('Border radius'), 0, array(
            'values' => array(
                0,
                3,
                5,
                10,
                99
            ),
            'wide'   => 3,
            'unit'   => 'px'
        ));

        $size = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-area-size', n2_('Size'));
        new Number($size, 'width', n2_('Width'), '', array(
            'wide'           => 4,
            'unit'           => 'px',
            'tipLabel'       => n2_('Width'),
            'tipDescription' => sprintf(n2_('Fix width for the %1$s.'), $this->getTitle())
        ));
        new Number($size, 'height', n2_('Height'), '', array(
            'wide'           => 4,
            'unit'           => 'px',
            'tipLabel'       => n2_('Height'),
            'tipDescription' => sprintf(n2_('Fix height for the %1$s.'), $this->getTitle())
        ));

        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-area-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'relatedFields' => array(
                'item_areahref-target',
                'item_areahref-rel'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));

        $developer = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-area-developer', n2_('Advanced'));
        new Textarea($developer, 'css', 'CSS', '', array(
            'width'          => 314,
            'tipLabel'       => 'CSS',
            'tipDescription' => n2_('Write custom CSS codes here without selectors.')
        ));
    }
}Renderable/Item/Area/ItemAreaFrontend.php000064400000007463152355233130014271 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\Area;


use Nextend\Framework\Parser\Color;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemAreaFrontend extends AbstractItemFrontend {

    public function render() {

        if ($this->hasLink()) {
            return $this->getLink($this->getHtml(false), array(
                'style' => 'display: block; width:100%;height:100%;',
                'class' => 'n2-ss-item-content n2-ow'
            ));
        }

        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml($isContent = true) {
        $style = '';

        $color    = $this->data->get('color');
        $gradient = $this->data->get('gradient', 'off');

        if ($gradient != 'off') {
            $colorEnd = $this->data->get('color2');
            switch ($gradient) {
                case 'horizontal':
                    $style .= 'background:linear-gradient(to right, ' . Color::colorToRGBA($color) . ' 0%,' . Color::colorToRGBA($colorEnd) . ' 100%);';
                    break;
                case 'vertical':
                    $style .= 'background:linear-gradient(to bottom, ' . Color::colorToRGBA($color) . ' 0%,' . Color::colorToRGBA($colorEnd) . ' 100%);';
                    break;
                case 'diagonal1':
                    $style .= 'background:linear-gradient(45deg, ' . Color::colorToRGBA($color) . ' 0%,' . Color::colorToRGBA($colorEnd) . ' 100%);';
                    break;
                case 'diagonal2':
                    $style .= 'background:linear-gradient(135deg, ' . Color::colorToRGBA($color) . ' 0%,' . Color::colorToRGBA($colorEnd) . ' 100%);';
                    break;
            }
        } else {
            if (strlen($color) == 8 && substr($color, 6, 2) != '00') {
                $style = 'background-color: #' . substr($color, 0, 6) . ';';
                $style .= "background-color: " . Color::colorToRGBA($color) . ";";
            }
        }

        $_width = intval($this->data->get('width'));
        if ($_width > 0) {
            $style .= 'width:' . $_width . 'px;';
        }


        $height = '100%';

        $_height = intval($this->data->get('height'));
        if ($_height > 0) {
            $height = $_height . 'px';
        }

        $style .= 'height:' . $height . ';';


        $borderWidths = array();
        list($borderWidths[0], $borderWidths[1], $borderWidths[2], $borderWidths[3]) = (array)Common::parse($this->data->getIfEmpty('borderWidth', '0|*|0|*|0|*|0'));

        $hasBorder = false;
        for ($i = 0; $i < 4; $i++) {
            $borderWidths[$i] = max(0, intval($borderWidths[$i]));
            if ($borderWidths[$i] > 0) {
                $hasBorder = true;
            }
        }


        if ($hasBorder) {
            $borderRgba = Color::colorToRGBA($this->data->get('borderColor'));
            $style      .= 'border-width:' . implode('px ', explode('|*|', $this->data->get('borderWidth'))) . 'px;';
            $style      .= 'border-style: ' . $this->data->get('borderStyle') . ';';
            $style      .= 'border-color: ' . $borderRgba . ';';
            $style      .= 'box-sizing: border-box;';
        }
        $borderRadius = max(0, intval($this->data->get('borderRadius')));
        if ($borderRadius > 0) {
            $style .= 'border-radius:' . $borderRadius . 'px;';
        }

        return Html::tag('div', array(
            'class' => ($isContent ? 'n2-ss-item-content ' : '') . 'n2-ow',
            'style' => $style . $this->data->get('css')
        ));
    }

    public function needHeight() {
        return true;
    }
}Renderable/Item/AnimatedHeading/ItemAnimatedHeading.php000064400000023555152355233130017055 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Renderable\Item\AnimatedHeading;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Hidden\HiddenFont;
use Nextend\Framework\Form\Element\Hidden\HiddenStyle;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\LinkTarget;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Element\Text\Url;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Renderable\Item\AbstractItem;

class ItemAnimatedHeading extends AbstractItem {

    protected $ordering = 2;

    protected $fonts = array(
        'font' => array(
            'defaultName' => 'item-animated-heading-font',
            'value'       => '{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{},{}]}'
        )
    );

    protected $styles = array(
        'style' => array(
            'defaultName' => 'item-animated-heading-style',
            'value'       => '{"data":[{},{"padding":"0|*|0|*|0|*|0|*|px"},{}]}'
        )
    );

    protected function isBuiltIn() {
        return true;
    }

    public function getType() {
        return 'animatedHeading';
    }

    public function getTitle() {
        return n2_('Animated heading');
    }

    public function getIcon() {
        return 'ssi_32 ssi_32--animatedheading';
    }

    public function getGroup() {
        return n2_('Special');
    }

    public function createFrontend($id, $itemData, $layer) {
        return new ItemAnimatedHeadingFrontend($this, $id, $itemData, $layer);
    }

    public function getValues() {

        return parent::getValues() + array(
                'type'          => 'slide',
                'color'         => 'ffffffff',
                'loop'          => 0,
                'delay'         => 0,
                'speed'         => 100,
                'show-duration' => 1500,
                'animate-width' => 1,

                'priority'      => 'div',
                'before-text'   => n2_('We are Passionate About'),
                'animated-text' => n2_("Amazing Food\nGreat Hospitality"),
                'href'          => '#',
                'href-target'   => '_self',
                'href-rel'      => '',
                'after-text'    => '',
                'title'         => '',

                'class' => ''
            );
    }

    public function upgradeData($data) {
        $linkV1 = $data->get('link', '');
        if (!empty($linkV1)) {
            list($link, $target, $rel) = array_pad((array)Common::parse($linkV1), 3, '');
            $data->un_set('link');
            $data->set('href', $link);
            $data->set('href-target', $target);
            $data->set('href-rel', $rel);
        }
    }


    public function loadResources($renderable) {
        parent::loadResources($renderable);

        $renderable->addLess(self::getAssetsPath() . "/animatedHeading.n2less", array(
            "sliderid" => $renderable->elementId
        ));
    }

    public function getFilled($slide, $data) {
        $data = parent::getFilled($slide, $data);

        $data->set('heading', $slide->fill($data->get('heading', '')));
        $data->set('href', $slide->fill($data->get('href', '#|*|')));

        return $data;
    }

    public function prepareExport($export, $data) {
        parent::prepareExport($export, $data);

        $export->addVisual($data->get('font'));
        $export->addVisual($data->get('style'));
        $export->addLightbox($data->get('href'));
    }

    public function prepareImport($import, $data) {
        $data = parent::prepareImport($import, $data);

        $data->set('font', $import->fixSection($data->get('font')));
        $data->set('style', $import->fixSection($data->get('style')));
        $data->set('href', $import->fixLightbox($data->get('href')));

        return $data;
    }

    public function globalDefaultItemFontAndStyle($container) {

        $table = new ContainerTable($container, $this->getType(), $this->getTitle());
        $row1  = $table->createRow($this->getType() . '-1');

        new Font($row1, 'item-animated-heading-font', false, $this->fonts['font']['value'], array(
            'mode' => 'hover'
        ));

        new Style($row1, 'item-animated-heading-style', false, $this->styles['style']['value'], array(
            'mode' => 'heading'
        ));
    }

    public function renderFields($container) {
        $settings = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-animated-heading-text', n2_('General'));

        new Text($settings, 'before-text', n2_('Before text'), '', array(
            'style' => 'width: 302px;'
        ));

        new Textarea($settings, 'animated-text', n2_('Animated text'), '', array(
            'height' => 70,
            'width'  => 314
        ));

        new Text($settings, 'after-text', n2_('After text'), '', array(
            'style' => 'width: 302px;'
        ));

        $link = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-animated-heading-link', n2_('Link'));
        new Url($link, 'href', n2_('Link'), '', array(
            'style'         => 'width:236px;',
            'relatedFields' => array(
                'item_animatedHeadinghref-target',
                'item_animatedHeadinghref-rel'
            ),
            'width'         => 248
        ));
        new LinkTarget($link, 'href-target', n2_('Target window'));
        new Text($link, 'href-rel', n2_('Rel'), '', array(
            'style'          => 'width:195px;',
            'tipLabel'       => n2_('Rel'),
            'tipDescription' => sprintf(n2_('Enter the %1$s rel attribute %2$s that represents the relationship between the current document and the linked document. Multiple rel attributes can be separated with space. E.g. nofollow noopener noreferrer'), '<a href="https://www.w3schools.com/TAGS/att_a_rel.asp" target="_blank">', '</a>')
        ));

        $animation = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-animated-heading-animation', n2_('Animation'));

        new Select($animation, 'type', n2_('Type'), '', array(
            'options'            => array(
                'fade'        => n2_('Fade'),
                'rotating'    => n2_('Rotating'),
                'drop-in'     => n2_('Drop-in'),
                'slide'       => n2_x('Slide', 'Animation'),
                'slide-down'  => n2_('Slide down'),
                'typewriter1' => n2_('Typewriter'),
                'chars'       => n2_('Chars'),
                'chars2'      => n2_('Chars 2')
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'fade',
                        'rotating',
                        'drop-in',
                        'slide',
                        'slide-down',
                        'chars',
                        'chars2'
                    ),
                    'field'  => array(
                        'item_animatedHeadinganimate-width'
                    )
                ),
                array(
                    'values' => array(
                        'typewriter1',
                    ),
                    'field'  => array(
                        'item_animatedHeadingcolor'
                    )
                )
            )
        ));
        new OnOff($animation, 'animate-width', n2_('Auto width'), 1);
        new Color($animation, 'color', n2_('Cursor color'), '', array(
            'alpha' => true
        ));

        new OnOff($animation, 'loop', n2_x('Loop', 'Effect'), 1);

        new Number($animation, 'delay', n2_('Delay'), 0, array(
            'unit' => 'ms',
            'wide' => 5,
            'min'  => 0
        ));
        new NumberSlider($animation, 'speed', n2_('Speed'), 100, array(
            'style'     => 'width:35px;',
            'unit'      => '%',
            'min'       => 10,
            'max'       => 400,
            'step'      => 1,
            'sliderMax' => 150
        ));
        new Number($animation, 'show-duration', n2_('Show duration'), 1500, array(
            'unit' => 'ms',
            'wide' => 5,
            'min'  => 0
        ));

        $dev = new Fieldset\LayerWindow\FieldsetLayerWindow($container, 'item-animated-heading-developer', n2_('Advanced'));
        new Select($dev, 'priority', 'Tag', 'div', array(
            'options' => array(
                'div' => 'div',
                '1'   => 'H1',
                '2'   => 'H2',
                '3'   => 'H3',
                '4'   => 'H4',
                '5'   => 'H5',
                '6'   => 'H6'
            )
        ));

        new HiddenFont($settings, 'font', false, '', array(
            'mode' => 'highlight'
        ));

        new HiddenStyle($settings, 'style', false, '', array(
            'mode' => 'highlight'
        ));


        new Text($dev, 'class', n2_('CSS Class'), '', array(
            'style'          => 'width:226px;',
            'tipLabel'       => n2_('CSS Class'),
            'tipDescription' => n2_('Class on the selected tag element.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1812-layer-style#advanced'
        ));

    }
}Renderable/Item/AnimatedHeading/ItemAnimatedHeadingFrontend.php000064400000012051152355233130020542 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Renderable\Item\AnimatedHeading;

use Nextend\Framework\Parser\Color;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Renderable\AbstractRenderableOwner;
use Nextend\SmartSlider3\Renderable\Item\AbstractItemFrontend;

class ItemAnimatedHeadingFrontend extends AbstractItemFrontend {

    public function render() {
        return $this->getHtml();
    }

    public function renderAdminTemplate() {
        return $this->getHtml();
    }

    private function getHtml() {
        $owner = $this->layer->getOwner();

        $this->loadResources($owner);

        $heading = array();

        $beforeText = Sanitize::filter_allowed_html($owner->fill($this->data->get('before-text', '')));
        if (!empty($beforeText)) {
            $heading[] = Html::tag('ss-text', array(
                    'class' => 'n2-ss-animated-heading-before'
                ), $beforeText) . ' ';
        }

        $animatedText = preg_split('/\r\n|\r|\n/', Sanitize::filter_allowed_html($owner->fill($this->data->get('animated-text', ''))));
        if (!empty($animatedText)) {


            $attributes = array(
                'class' => 'n2-highlighted n2-ss-animated-heading-i'
            );
            $type       = $this->data->get('type', 'slide');
            if ($type != 'slide') {
                $attributes['data-animation-type'] = $type;
            }

            $color = $this->data->get('color', 'ffffffff');
            if ($color != 'ffffffff') {
                $attributes['data-color'] = Color::colorToRGBA($color);
            }

            $animateWidth = $this->data->get('animate-width', '1');
            if ($animateWidth != 1) {
                $attributes['data-animate-width'] = $animateWidth;
            }


            $delay = $this->data->get('delay', 0);
            if ($delay > 0) {
                $attributes['data-delay'] = $delay;
            }

            $showDuration = max(0, $this->data->get('show-duration', 1500));
            if ($showDuration != 1500) {
                $attributes['data-show-duration'] = $showDuration;
            }

            $speed = max(0, $this->data->get('speed', 100));
            if ($speed != 100) {
                $attributes['data-speed'] = $speed;
            }

            if ($this->data->get('loop', 0)) {
                $attributes['data-loop'] = 1;
            }

            $animatedInner = '';

            foreach ($animatedText as $text) {
                $text = trim($text);
                if (!empty($text)) {
                    $animatedInner .= Html::tag('div', array(
                        'class' => 'n2-ss-animated-heading-i-text'
                    ), $text);
                }
            }
            $animatedInner = Html::tag('div', array(
                'class' => 'n2-ss-animated-heading-i2'
            ), $animatedInner);

            $href = $this->data->get('href', '');
            if (!empty($href) && $href != '#') {
                $heading[] = $this->getLink($animatedInner, $attributes);
            } else {
                $heading[] = Html::tag('ss-text', $attributes, $animatedInner);
            }
        }

        $afterText = Sanitize::filter_allowed_html($owner->fill($this->data->get('after-text', '')));
        if (!empty($afterText)) {
            $heading[] = ' ' . Html::tag('ss-text', array(
                    'class' => 'n2-ss-animated-heading-after'
                ), $afterText);
        }


        $font  = $owner->addFont($this->data->get('font'), 'highlight');
        $style = $owner->addStyle($this->data->get('style'), 'highlight');

        return $this->heading($this->data->get('priority', 'div'), array(
            "id"    => $this->id,
            "class" => 'n2-ss-animated-heading-wrapper ' . $font . ' ' . $style . ' n2-ss-item-content n2-ss-text n2-ow-all'
        ), implode('', $heading));
    }

    private function heading($type, $attributes, $content) {
        if (is_numeric($type) && $type > 0) {
            return Html::tag("h{$type}", $attributes, $content);
        }

        return Html::tag("div", $attributes, $content);
    }

    /**
     * @param AbstractRenderableOwner $owner
     */
    public function loadResources($owner) {
        $owner->addLess(self::getAssetsPath() . "/animatedHeading.n2less", array(
            "sliderid" => $owner->getElementID()
        ));

        if (!$owner->isScriptAdded('animated-heading')) {
            if ($this->isEditor) {
                $owner->addScript('this.sliderElement.querySelectorAll(\'.n2-ss-currently-edited-slide .n2-ss-animated-heading-i\').forEach((function(el){new _N2.AnimatedHeadingItemAdmin(el, this)}).bind(this));', 'animated-heading');
            } else {
                $owner->addScript("this.sliderElement.querySelectorAll('.n2-ss-animated-heading-i').forEach((function(el){new _N2.FrontendItemAnimatedHeading(el, this)}).bind(this));", 'animated-heading');
            }
        }
    }
}Form/Element/AutoplayPicker.php000064400000006216152355233130012514 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Form\Element;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\AbstractField;
use Nextend\Framework\Form\ContainerInterface;
use Nextend\Framework\Form\Element\AbstractFieldHidden;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\TraitFieldset;

class AutoplayPicker extends AbstractFieldHidden implements ContainerInterface {

    use TraitFieldset;

    private static $separator = '|*|';

    protected function fetchElement() {
        $this->addAutoPlayPicker();

        $default = explode(self::$separator, $this->defaultValue);

        $value = explode(self::$separator, $this->getValue());

        $value = $value + $default;


        $html = '<div class="n2_field_autoplaypicker">';
        $html .= '<div class="n2_field_autoplaypicker__label"></div><i class="n2_field_autoplaypicker__arrow ssi_16 ssi_16--selectarrow"></i>';
        $html .= '<div class="n2_field_autoplaypicker__popover">';

        $subElements = array();
        $i           = 0;

        $element = $this->first;
        while ($element) {

            $element->setExposeName(false);
            if (isset($value[$i])) {
                $element->setDefaultValue($value[$i]);
            }

            $html            .= $this->decorateElement($element);
            $subElements[$i] = $element->getID();
            $i++;

            $element = $element->getNext();
        }

        $html .= '</div>';
        $html .= parent::fetchElement();
        $html .= '</div>';

        Js::addInline('new _N2.FormElementAutoPlayPicker("' . $this->fieldID . '", ' . json_encode($subElements) . ', "' . self::$separator . '");');

        return $html;
    }

    /**
     * @param AbstractField $element
     *
     * @return string
     */
    public function decorateElement($element) {

        return $this->parent->decorateElement($element);
    }

    protected function addAutoPlayPicker() {
        new Number($this, $this->name . '-1', n2_('Interval'), '', array(
            'wide' => 3,
            'min'  => 1
        ));

        new Select($this, $this->name . '-2', n2_('Interval modifier'), '', array(
            'options'            => array(
                'loop'       => n2_x('loops', 'Autoplay modifier'),
                'slide'      => n2_x('slide count', 'Autoplay modifier'),
                'slideindex' => n2_x('slide index', 'Autoplay modifier')
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'loop'
                    ),
                    'field'  => array(
                        $this->getControlName() . $this->name . '-3'
                    )
                )
            ),
        ));
        new Select($this, $this->name . '-3', n2_('Stops on'), '', array(
            'options' => array(
                'current' => n2_x('last slide', 'Autoplay modifier'),
                'next'    => n2_x('next slide', 'Autoplay modifier')
            )
        ));
    }
}Form/Element/CanvasLayerParentPicker.php000064400000001126152355233130014273 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Form\Element;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\AbstractFieldHidden;
use Nextend\Framework\View\Html;

class CanvasLayerParentPicker extends AbstractFieldHidden {

    protected function fetchElement() {

        Js::addInline('new _N2.FormElementLayerPicker("' . $this->fieldID . '");');
        $this->renderRelatedFields();

        return parent::fetchElement() . Html::tag('div', array(
                'class' => 'n2_ss_absolute_parent_picker'
            ), '<i class="ssi_16"></i>');
    }
}Form/Element/Particle.php000064400000001303152355233130011313 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Form\Element;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\AbstractChooser;
use Nextend\Framework\Request\Request;

class Particle extends AbstractChooser {

    protected function addScript() {

        $MVCHelper = $this->getForm();

        Js::addInline('new _N2.FormElementParticleManager("' . $this->fieldID . '", ' . json_encode(array(
                'editUrl' => $MVCHelper->createUrl(array(
                    'slider/particle',
                    array(
                        'sliderid' => Request::$GET->getInt('sliderid')
                    )
                ), true)
            )) . ');');
    }
}Form/Element/ParticleSkin.php000064400000005427152355233130012153 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Form\Element;


use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Element\Select\Skin;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;

class ParticleSkin extends Skin {

    protected $fixed = true;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $labels = array(
            'link'        => n2_('Link'),
            'polygons'    => n2_('Polygons'),
            'bloom'       => n2_('Bloom'),
            'web'         => n2_('Web'),
            'blackwidow'  => n2_('Black widow'),
            'zodiac'      => n2_('Zodiac'),
            'fading-dots' => n2_('Fading dots'),
            'pirouette'   => n2_('Pirouette'),
            'sparkling'   => n2_('Sparkling'),
        );

        $this->options = array(
            '0' => array(
                'label'    => n2_('Disabled'),
                'settings' => array()
            )
        );

        $folder    = ResourceTranslator::toPath('$ss3-pro-frontend$/js/particle/presets/');
        $files     = Filesystem::files($folder);
        $extension = 'json';
        for ($i = 0; $i < count($files); $i++) {
            $pathInfo = pathinfo($files[$i]);
            if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {

                $jsProp = json_decode(Filesystem::readFile($folder . $pathInfo['filename'] . '.json'), true);

                $this->options[$pathInfo['filename']] = array(
                    'label'    => $labels[$pathInfo['filename']],
                    'settings' => array(
                        'color'      => substr($jsProp['particles']["color"]["value"], 1) . str_pad(dechex(intval($jsProp['particles']["opacity"]["value"] * 255)), 2, "0", STR_PAD_LEFT),
                        'line-color' => substr($jsProp['particles']["line_linked"]["color"], 1) . str_pad(dechex(intval($jsProp['particles']["line_linked"]["opacity"] * 255)), 2, "0", STR_PAD_LEFT),
                        'hover'      => $jsProp['interactivity']["events"]["onhover"]['enable'] ? $jsProp['interactivity']["events"]["onhover"]['mode'] : 0,
                        'click'      => $jsProp['interactivity']["events"]["onclick"]['enable'] ? $jsProp['interactivity']["events"]["onclick"]['mode'] : 0,
                        'number'     => $jsProp['particles']["number"]["value"],
                        'speed'      => $jsProp['particles']["move"]["speed"]
                    )
                );

            }
        }

        $this->options['custom'] = array(
            'label'    => n2_('Custom'),
            'settings' => array()
        );
    }
}Form/Element/PostBackgroundAnimation.php000064400000000604152355233130014340 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Form\Element;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\AbstractChooser;

class PostBackgroundAnimation extends AbstractChooser {

    protected function addScript() {

        Js::addInline('new _N2.FormElementPostAnimationManager("' . $this->fieldID . '", "postbackgroundanimationManager");');
    }
}Form/Element/ShapeDivider.php000064400000001321152355233130012117 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Form\Element;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\AbstractChooser;
use Nextend\Framework\Request\Request;

class ShapeDivider extends AbstractChooser {

    protected function addScript() {

        $MVCHelper = $this->getForm();

        Js::addInline('new _N2.FormElementShapeDividerManager("' . $this->fieldID . '", ' . json_encode(array(
                'editUrl' => $MVCHelper->createUrl(array(
                    'slider/shapedivider',
                    array(
                        'sliderid' => Request::$GET->getInt('sliderid')
                    )
                ), true)
            )) . ');');
    }
}Form/Element/SplitTextAnimation.php000064400000004156152355233130013361 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Form\Element;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\AbstractChooser;
use Nextend\SmartSlider3Pro\SplitText\SplitTextManager;

class SplitTextAnimation extends AbstractChooser {


    protected $relatedStyle = '';
    protected $relatedFont = '';
    protected $group = '';
    protected $transformOrigin = '';
    protected $preview = '';
    protected $linkedRelatedFields = array();

    protected function addScript() {

        Js::addInline('new _N2.FormElementSplitTextAnimationManager("' . $this->fieldID . '", {
            font: "' . $this->relatedFont . '",
            style: "' . $this->relatedStyle . '",
            preview: ' . json_encode($this->preview) . ',
            group: "' . $this->group . '",
            transformOrigin: "' . $this->transformOrigin . '",
            linkedRelatedFields: ' . json_encode($this->linkedRelatedFields) . ',
        });');
    }

    protected function fetchElement() {

        SplitTextManager::enqueue($this->getForm()
                                       ->getMVCHelper());

        return parent::fetchElement();
    }

    /**
     * @param string $relatedStyle
     */
    public function setRelatedStyle($relatedStyle) {
        $this->relatedStyle = $relatedStyle;
    }

    /**
     * @param string $relatedFont
     */
    public function setRelatedFont($relatedFont) {
        $this->relatedFont = $relatedFont;
    }

    /**
     * @param string $group
     */
    public function setGroup($group) {
        $this->group = $group;
    }

    /**
     * @param string $transformOrigin
     */
    public function setTransformOrigin($transformOrigin) {
        $this->transformOrigin = $transformOrigin;
    }

    /**
     * @param string $preview
     */
    public function setPreview($preview) {
        $this->preview = $preview;
    }

    /**
     * @param array $linkedRelatedFields
     */
    public function setLinkedRelatedFields($linkedRelatedFields) {
        $this->linkedRelatedFields = $linkedRelatedFields;
    }
}Form/Element/Select/ShapeDividerSelect.php000064400000007346152355233130014513 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Form\Element\Select;


use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\View\Html;

class ShapeDividerSelect extends Select {

    private static $_options;

    public function __construct($insertAt, $name = '', $label = '', $default = '', array $parameters = array()) {
        if (self::$_options === null) {
            self::$_options = array(
                'simple-Arrow'        => n2_('Arrow'),
                'simple-Curve1'       => sprintf(n2_('Curve %d'), '1'),
                'simple-Curve2'       => sprintf(n2_('Curve %d'), '2'),
                'simple-Curve3'       => sprintf(n2_('Curve %d'), '3'),
                'simple-Curve4'       => sprintf(n2_('Curve %d'), '4'),
                'simple-Curves'       => n2_('Curves'),
                'simple-Fan1'         => sprintf(n2_('Fan %d'), '1'),
                'simple-Fan2'         => sprintf(n2_('Fan %d'), '2'),
                'simple-Fan3'         => sprintf(n2_('Fan %d'), '3'),
                'simple-Fan4'         => sprintf(n2_('Fan %d'), '4'),
                'simple-Hills'        => n2_('Hills'),
                'simple-Incline1'     => sprintf(n2_('Incline %d'), '1'),
                'simple-Incline2'     => sprintf(n2_('Incline %d'), '2'),
                'simple-Incline3'     => sprintf(n2_('Incline %d'), '3'),
                'simple-InverseArrow' => n2_('Inverse arrow'),
                'simple-Rectangle'    => n2_('Rectangle'),
                'simple-Slopes'       => n2_('Slopes'),
                'simple-Tilt1'        => sprintf(n2_('Tilt %d'), '1'),
                'simple-Tilt2'        => sprintf(n2_('Tilt %d'), '2'),
                'simple-Triangle1'    => sprintf(n2_('Triangle %d'), '1'),
                'simple-Triangle2'    => sprintf(n2_('Triangle %d'), '2'),
                'simple-Wave1'        => sprintf(n2_('Wave %d'), '1'),
                'simple-Wave2'        => sprintf(n2_('Wave %d'), '2'),
                'simple-Waves'        => n2_('Waves'),
                'simple-Columns1'     => sprintf(n2_('Columns %d'), '1'),
                'simple-Columns2'     => sprintf(n2_('Columns %d'), '2'),
                'simple-Paper1'       => sprintf(n2_('Paper %d'), '1'),
                'simple-Paper2'       => sprintf(n2_('Paper %d'), '2'),
                'simple-Paper3'       => sprintf(n2_('Paper %d'), '3'),
                'simple-Paper4'       => sprintf(n2_('Paper %d'), '4'),
                'bicolor'             => array(
                    'label'   => n2_('2 Colors'),
                    'options' => array(
                        'bi-Fan'         => n2_('Fan'),
                        'bi-MaskedWaves' => n2_('Masked waves'),
                        'bi-Ribbon'      => n2_('Ribbon'),
                        'bi-Waves'       => n2_('Waves')
                    )
                )
            );
        }

        parent::__construct($insertAt, $name, $label, $default, $parameters);
    }

    protected function renderOptions($options) {

        $html = '<option value="0" ' . $this->isSelected('0') . '>' . n2_('Disabled') . '</option>';

        $html .= $this->renderOptionsRecursive(self::$_options);

        return $html;
    }

    private function renderOptionsRecursive($options) {
        $html = '';

        foreach ($options as $value => $option) {
            if (is_array($option)) {
                $html .= Html::tag('optgroup', array('label' => $option['label']), $this->renderOptionsRecursive($option['options']));
            } else {
                $html .= '<option value="' . $value . '" ' . $this->isSelected($value) . '>' . $option . '</option>';

            }
        }

        return $html;
    }
}Widget/WidgetLoader.php000064400000026350152355233130011062 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget;


use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Widget\Arrow\ArrowImage\ArrowImage;
use Nextend\SmartSlider3\Widget\Autoplay\AutoplayImage\AutoplayImage;
use Nextend\SmartSlider3\Widget\Bullet\BulletTransition\BulletTransition;
use Nextend\SmartSlider3\Widget\Group\AbstractWidgetGroup;
use Nextend\SmartSlider3\Widget\Thumbnail\Basic\ThumbnailBasic;
use Nextend\SmartSlider3Pro\Widget\Arrow\ArrowGrow\ArrowGrow;
use Nextend\SmartSlider3Pro\Widget\Arrow\ArrowImageBar\ArrowImageBar;
use Nextend\SmartSlider3Pro\Widget\Arrow\ArrowReveal\ArrowReveal;
use Nextend\SmartSlider3Pro\Widget\Arrow\ArrowText\ArrowText;
use Nextend\SmartSlider3Pro\Widget\Bar\BarVertical\BarVertical;
use Nextend\SmartSlider3Pro\Widget\Bullet\BulletNumbers\BulletNumbers;
use Nextend\SmartSlider3Pro\Widget\Bullet\BulletText\BulletText;
use Nextend\SmartSlider3Pro\Widget\FullScreen\FullScreenImage\FullScreenImage;
use Nextend\SmartSlider3Pro\Widget\Group\FullScreen;
use Nextend\SmartSlider3Pro\Widget\Group\Html;
use Nextend\SmartSlider3Pro\Widget\Group\Indicator;
use Nextend\SmartSlider3Pro\Widget\Html\HtmlCode\HtmlCode;
use Nextend\SmartSlider3Pro\Widget\Indicator\IndicatorPie\IndicatorPie;
use Nextend\SmartSlider3Pro\Widget\Indicator\IndicatorStripe\IndicatorStripe;

class WidgetLoader {

    public function __construct() {

        Plugin::addAction('PluggableFactorySliderWidgetGroup', array(
            $this,
            'sliderWidgetGroup'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetArrow', array(
            $this,
            'sliderWidgetArrow'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetBullet', array(
            $this,
            'sliderWidgetBullet'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetAutoplay', array(
            $this,
            'sliderWidgetAutoplay'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetBar', array(
            $this,
            'sliderWidgetBar'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetIndicator', array(
            $this,
            'sliderWidgetIndicator'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetHtml', array(
            $this,
            'sliderWidgetHtml'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetFullScreen', array(
            $this,
            'sliderWidgetFullScreen'
        ));

        Plugin::addAction('PluggableFactorySliderWidgetThumbnail', array(
            $this,
            'sliderWidgetThumbnail'
        ));
    }

    public function sliderWidgetGroup() {
        new FullScreen();
        new Indicator();
        new Html();
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetArrow($group) {

        new ArrowImage($group, 'image');

        new ArrowImage($group, 'imageBigRectangle', array(
            'widget-arrow-style'                    => '{"data":[{"backgroundcolor":"000000ab","padding":"20|*|20|*|20|*|20|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":""},{"backgroundcolor":"5F39C2FF"}]}',
            'widget-arrow-animation'                => 'horizontal',
            'widget-arrow-previous-position-offset' => 0,
            'widget-arrow-next-position-offset'     => 0,
        ));

        new ArrowImage($group, 'imageVertical', array(
            'widget-arrow-previous'               => '$ss$/plugins/widgetarrow/image/image/previous/simple-vertical.svg',
            'widget-arrow-next'                   => '$ss$/plugins/widgetarrow/image/image/next/simple-vertical.svg',
            'widget-arrow-style'                  => '{"data":[{"backgroundcolor":"000000ab","padding":"10|*|10|*|10|*|10|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":""},{"backgroundcolor":"04C018FF"}]}',
            'widget-arrow-previous-position-area' => 3,
            'widget-arrow-next-position-area'     => 10,
        ));

        new ArrowGrow($group, 'grow');

        new ArrowImageBar($group, 'imagebar');

        new ArrowReveal($group, 'reveal');

        new ArrowText($group, 'text');
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetAutoplay($group) {
        new AutoplayImage($group, 'imageBlue', array(
            'widget-autoplay-position-area' => 11,
            'widget-autoplay-style'         => '{"data":[{"backgroundcolor":"000000ab","padding":"10|*|10|*|10|*|10|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":""},{"backgroundcolor":"04C018FF"}]}'
        ));
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetHtml($group) {

        new HtmlCode($group, 'html');
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetFullScreen($group) {

        new FullScreenImage($group, 'image');

        new FullScreenImage($group, 'imageBlue', array(
            'widget-fullscreen-tonormal' => '$ss$/plugins/widgetfullscreen/image/image/tonormal/full2.svg',
            'widget-fullscreen-tofull'   => '$ss$/plugins/widgetfullscreen/image/image/tofull/full2.svg',
            'widget-fullscreen-style'    => '{"data":[{"backgroundcolor":"000000ab","padding":"10|*|10|*|10|*|10|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":""},{"backgroundcolor":"04C018FF"}]}'
        ));
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetBullet($group) {

        new BulletTransition($group, 'transitionBorder', array(
            'widget-bullet-style' => '{"data":[{"backgroundcolor":"00000000","padding":"5|*|5|*|5|*|5|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"2|*|solid|*|000000c2","borderradius":"50","extra":"margin: 4px;"},{"backgroundcolor":"000000ba","border":"2|*|solid|*|ffffff00"}]}'
        ));

        new BulletTransition($group, 'transitionRectangle', array(
            'widget-bullet-style' => '{"data":[{"backgroundcolor":"000000ab","padding":"8|*|8|*|8|*|8|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":"margin: 4px;"},{"backgroundcolor":"04C018FF"}]}'
        ));

        new BulletTransition($group, 'transitionBar', array(
            'widget-bullet-style' => '{"data":[{"backgroundcolor":"00000000","padding":"5|*|5|*|5|*|5|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"2|*|solid|*|000000c2","borderradius":"50","extra":"margin: 4px 3px;"},{"backgroundcolor":"000000ba","border":"2|*|solid|*|ffffff00"}]}',
            'widget-bullet-bar'   => '{"data":[{"backgroundcolor":"ffffff80","padding":"2|*|5|*|2|*|5|*|px","boxshadow":"0|*|1|*|5|*|0|*|00000033","border":"0|*|solid|*|000000ff","borderradius":"50","extra":""}]}',
        ));

        new BulletNumbers($group, 'numbers');

        new BulletText($group, 'text');
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetIndicator($group) {

        new IndicatorPie($group, 'pie');

        new IndicatorPie($group, 'pieFull', array(
            'widget-indicator-thickness' => 100,
            'widget-indicator-track'     => 'ffffff00',
            'widget-indicator-bar'       => 'ffffff80',
        ));

        new IndicatorStripe($group, 'stripe');
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetBar($group) {

        new BarVertical($group, 'vertical');
    }

    /**
     * @param AbstractWidgetGroup $group
     */
    public function sliderWidgetThumbnail($group) {

        new ThumbnailBasic($group, 'defaultHorizontal', array(
            'widget-thumbnail-style-bar'         => '{"data":[{"backgroundcolor":"242424ff","padding":"0|*|0|*|0|*|0|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":""}]}',
            'widget-thumbnail-style-slides'      => '{"data":[{"backgroundcolor":"00000000","padding":"0|*|0|*|0|*|0|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|ffffff00","borderradius":"0","opacity":"40","extra":"transition: all 0.4s;\nbackground-size: cover;"},{"border":"0|*|solid|*|ffffffcc","opacity":"100","extra":""}]}',
            'widget-thumbnail-title-style'       => '{"data":[{"backgroundcolor":"00000000","padding":"3|*|10|*|3|*|10|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":"bottom: 0;\nleft: 0;"}]}',
            'widget-thumbnail-title'             => 1,
            'widget-thumbnail-title-font'        => '{"data":[{"color":"ffffffff","size":"14||px","tshadow":"0|*|0|*|0|*|000000ab","afont":"Montserrat","lineheight":"1.4","bold":0,"italic":0,"underline":0,"align":"left"},{"color":"fc2828ff","afont":"Raleway,Arial","size":"25||px"},{}]}',
            'widget-thumbnail-description'       => 1,
            'widget-thumbnail-caption-placement' => 'after'
        ));

        new ThumbnailBasic($group, 'defaultHorizontalGallery', array(
            'widget-thumbnail-title' => 0,
            'widget-thumbnail-group' => 2
        ));

        new ThumbnailBasic($group, 'defaultVertical', array(
            'widget-thumbnail-position-area' => 5,
            'widget-thumbnail-title'         => 1,
        ));

        new ThumbnailBasic($group, 'defaultVerticalText', array(
            'widget-thumbnail-position-area'     => 5,
            'widget-thumbnail-style-slides'      => '{"data":[{"backgroundcolor":"00000000","padding":"0|*|0|*|0|*|0|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|ffffff00","borderradius":"0","opacity":"60","extra":"background-size: cover;\nmargin: 10px 0;\n"},{"backgroundcolor":"00000000","opacity":"100","extra":"background-size: cover;\nmargin: 10px 0;\n"}]}',
            'widget-thumbnail-title-style'       => '{"data":[{"backgroundcolor":"00000000","padding":"3|*|10|*|3|*|10|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":"bottom: 0;\nleft: 0;"}]}',
            'widget-thumbnail-title'             => 1,
            'widget-thumbnail-title-font'        => '{"data":[{"color":"ffffffe6","size":"14||px","tshadow":"0|*|0|*|0|*|000000ab","afont":"Montserrat","lineheight":"1.8","bold":0,"italic":0,"underline":0,"align":"left","extra":""},{"color":"fc2828ff","afont":"Raleway,Arial","size":"25||px"},{}]}',
            'widget-thumbnail-description'       => 1,
            'widget-thumbnail-description-font'  => '{"data":[{"color":"ffffff7d","size":"12||px","tshadow":"0|*|0|*|0|*|000000ab","afont":"Montserrat","lineheight":"1.3","bold":0,"italic":0,"underline":0,"align":"left"},{"color":"fc2828ff","afont":"Raleway,Arial","size":"25||px"},{}]}',
            'widget-thumbnail-caption-size'      => 200,
            'widget-thumbnail-show-image'        => 0,
            'widget-thumbnail-width'             => 100,
            'widget-thumbnail-height'            => 60,
            'widget-thumbnail-caption-placement' => 'after'
        ));
    }

}Widget/Html/HtmlCode/HtmlCode.php000064400000001572152355233130012611 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Html\HtmlCode;


use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3\Widget\AbstractWidget;

class HtmlCode extends AbstractWidget {

    protected $key = 'widget-html-';

    protected $defaults = array(
        'widget-html-position-mode' => 'simple',
        'widget-html-position-area' => 2,
        'widget-html-code'          => '',
    );

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-html-row-1');

        new WidgetPosition($row1, 'widget-html-position', n2_('Position'));

        new Textarea($row1, 'widget-html-code', 'HTML', '', array(
            'height' => 300,
            'width'  => 600
        ));
    }
}Widget/Html/HtmlCode/HtmlCodeFrontend.php000064400000002054152355233130014305 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Widget\Html\HtmlCode;

use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class HtmlCodeFrontend extends AbstractWidgetFrontend {

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->addToPlacement($this->key . 'position-', array(
            $this,
            'render'
        ));

    }

    public function render($attributes = array()) {

        $slider = $this->slider;
        $params = $this->params;

        $slider->features->addInitCallback("new _N2.SmartSliderWidget(this, 'html', '.n2-widget-html');");
        $slider->sliderType->addJSDependency('SmartSliderWidget');

        $displayAttributes = $this->getDisplayAttributes($params, $this->key, 1);

        return Html::tag('div', Html::mergeAttributes($attributes, $displayAttributes, array(
            "class" => "n2-widget-html"
        )), $params->get($this->key . 'code'));

    }
}Widget/FullScreen/FullScreenImage/FullScreenImage.php000064400000012072152355233130016560 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\FullScreen\FullScreenImage;


use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Radio\ImageListFromFolder;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3\Widget\AbstractWidget;

class FullScreenImage extends AbstractWidget {

    protected $key = 'widget-fullscreen-';

    protected $defaults = array(
        'widget-fullscreen-desktop-image-width' => 16,
        'widget-fullscreen-tablet-image-width'  => 16,
        'widget-fullscreen-mobile-image-width'  => 8,
        'widget-fullscreen-tonormal-image'      => '',
        'widget-fullscreen-tonormal-color'      => 'ffffffcc',
        'widget-fullscreen-tonormal'            => '$ss$/plugins/widgetfullscreen/image/image/tonormal/full1.svg',
        'widget-fullscreen-style'               => '{"data":[{"backgroundcolor":"000000ab","padding":"10|*|10|*|10|*|10|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":""},{"backgroundcolor":"000000ab"}]}',
        'widget-fullscreen-position-mode'       => 'simple',
        'widget-fullscreen-position-area'       => 4,
        'widget-fullscreen-position-offset'     => 15,
        'widget-fullscreen-mirror'              => 1,
        'widget-fullscreen-tofull-image'        => '',
        'widget-fullscreen-tofull-color'        => 'ffffffcc',
        'widget-fullscreen-tofull'              => '$ss$/plugins/widgetfullscreen/image/image/tofull/full1.svg'
    );

    public function renderFields($container) {

        $rowIcon = new FieldsetRow($container, 'widget-bullet-transition-row-icon');

        $fieldToNormal = new ImageListFromFolder($rowIcon, 'widget-fullscreen-tonormal', n2_('To normal'), '', array(
            'folder' => self::getAssetsPath() . '/tonormal/'
        ));

        new FieldImage($fieldToNormal, 'widget-fullscreen-tonormal-image', n2_('Custom'), '', array(
            'relatedFieldsOff' => array(
                'sliderwidget-fullscreen-tonormal-color'
            )
        ));

        new Color($rowIcon, 'widget-fullscreen-tonormal-color', n2_('Color'), '', array(
            'alpha' => true
        ));


        new OnOff($rowIcon, 'widget-fullscreen-mirror', n2_('Mirror'), '', array(
            'relatedFieldsOff' => array(
                'sliderwidget-fullscreen-tofull',
                'sliderwidget-fullscreen-tofull-color'
            )
        ));

        $fieldToFull = new ImageListFromFolder($rowIcon, 'widget-fullscreen-tofull', n2_('To fullscreen'), '', array(
            'folder' => self::getAssetsPath() . '/tofull/'
        ));

        new FieldImage($fieldToFull, 'widget-fullscreen-tofull-image', n2_('Custom'), '', array(
            'relatedFieldsOff' => array(
                'sliderwidget-fullscreen-tofull-color-grouping'
            )
        ));

        $groupingPauseColor = new Grouping($rowIcon, 'widget-fullscreen-tofull-color-grouping');
        new Color($groupingPauseColor, 'widget-fullscreen-tofull-color', n2_('Color'), '', array(
            'alpha' => true
        ));

        $row3 = new FieldsetRow($container, 'widget-fullscreen-image-row-3');

        new Style($row3, 'widget-fullscreen-style', n2_('Fullscreen'), '', array(
            'mode'    => 'button',
            'preview' => 'SmartSliderAdminWidgetFullScreenImage'
        ));

        new WidgetPosition($row3, 'widget-fullscreen-position', n2_('Position'));


        $row4 = new FieldsetRow($container, 'widget-fullscreen-image-row-4');

        new Number($row4, 'widget-fullscreen-desktop-image-width', n2_('Image width - Desktop'), '', array(
            'wide' => 4,
            'unit' => 'px'
        ));

        new Number($row4, 'widget-fullscreen-tablet-image-width', n2_('Image width - Tablet'), '', array(
            'wide' => 4,
            'unit' => 'px'
        ));

        new Number($row4, 'widget-fullscreen-mobile-image-width', n2_('Image width - Mobile'), '', array(
            'wide' => 4,
            'unit' => 'px'
        ));

    }

    public function prepareExport($export, $params) {
        $export->addImage($params->get($this->key . 'tonormal-image', ''));
        $export->addImage($params->get($this->key . 'tofull-image', ''));

        $export->addVisual($params->get($this->key . 'style'));
    }

    public function prepareImport($import, $params) {

        $params->set($this->key . 'tonormal-image', $import->fixImage($params->get($this->key . 'tonormal-image', '')));
        $params->set($this->key . 'tofull-image', $import->fixImage($params->get($this->key . 'tofull-image', '')));

        $params->set($this->key . 'style', $import->fixSection($params->get($this->key . 'style', '')));
    }
}Widget/FullScreen/FullScreenImage/FullScreenImageFrontend.php000064400000015226152355233130020264 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\FullScreen\FullScreenImage;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Cast;
use Nextend\Framework\FastImageSize\FastImageSize;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class FullScreenImageFrontend extends AbstractWidgetFrontend {

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->addToPlacement($this->key . 'position-', array(
            $this,
            'render'
        ));

    }

    public function render($attributes = array()) {

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        $html = '';

        $sizeAttributes = array();

        $toNormalImage = $params->get($this->key . 'tonormal-image');
        $toNormalValue = $params->get($this->key . 'tonormal');
        $toNormalColor = $params->get($this->key . 'tonormal-color');

        if (empty($toNormalImage)) {
            if ($toNormalValue == -1) {
                $toNormal = null;
            } else {
                $toNormal = ResourceTranslator::pathToResource(self::getAssetsPath() . '/tonormal/' . basename($toNormalValue));
            }
        } else {
            $toNormal = $toNormalImage;
        }

        if ($params->get($this->key . 'mirror')) {
            $toFullColor = $toNormalColor;
            if (!empty($toNormalImage)) {
                $toFull = $toNormalImage;
            } else {
                $toFull = ResourceTranslator::pathToResource(self::getAssetsPath() . '/tofull/' . basename($toNormalValue));
            }
        } else {
            $toFull      = $params->get($this->key . 'tofull-image');
            $toFullColor = $params->get($this->key . 'tofull-color');
            if (empty($toFull)) {
                $toFullValue = $params->get($this->key . 'tofull');
                if ($toFull == -1) {
                    $toFull = null;
                } else {
                    $toFull = ResourceTranslator::pathToResource(self::getAssetsPath() . '/tofull/' . basename($toFullValue));
                }
            }
        }


        if ($toNormal && $toFull) {

            $desktopWidth = $params->get('widget-fullscreen-desktop-image-width');
            $tabletWidth  = $params->get('widget-fullscreen-tablet-image-width');
            $mobileWidth  = $params->get('widget-fullscreen-mobile-image-width');

            $slider->addDeviceCSS('all', '#' . $id . ' .n2-full-screen-widget img{width: ' . $desktopWidth . 'px}');
            if ($tabletWidth != $desktopWidth) {
                $slider->addDeviceCSS('tabletportrait', 'div#' . $id . ' .n2-full-screen-widget img{width: ' . $tabletWidth . 'px}');
                $slider->addDeviceCSS('tabletlandscape', 'div#' . $id . ' .n2-full-screen-widget img{width: ' . $tabletWidth . 'px}');
            }
            if ($mobileWidth != $desktopWidth) {
                $slider->addDeviceCSS('mobileportrait', 'div#' . $id . ' .n2-full-screen-widget img{width: ' . $mobileWidth . 'px}');
                $slider->addDeviceCSS('mobilelandscape', 'div#' . $id . ' .n2-full-screen-widget img{width: ' . $mobileWidth . 'px}');
            }

            FastImageSize::initAttributes($toNormal, $sizeAttributes);

            $ext = pathinfo($toNormal, PATHINFO_EXTENSION);
            if ($ext == 'svg' && ResourceTranslator::isResource($toNormal)) {
                list($color, $opacity) = Color::colorToSVG($toNormalColor);
                $toNormal = 'data:image/svg+xml;base64,' . Base64::encode(str_replace(array(
                        'fill="#FFF"',
                        'opacity="1"'
                    ), array(
                        'fill="#' . $color . '"',
                        'opacity="' . $opacity . '"'
                    ), Filesystem::readFile(ResourceTranslator::toPath($toNormal))));
            } else {
                $toNormal = ResourceTranslator::toUrl($toNormal);
            }

            $ext = pathinfo($toFull, PATHINFO_EXTENSION);
            if ($ext == 'svg' && ResourceTranslator::isResource($toFull)) {
                list($color, $opacity) = Color::colorToSVG($toFullColor);
                $toFull = 'data:image/svg+xml;base64,' . Base64::encode(str_replace(array(
                        'fill="#FFF"',
                        'opacity="1"'
                    ), array(
                        'fill="#' . $color . '"',
                        'opacity="' . $opacity . '"'
                    ), Filesystem::readFile(ResourceTranslator::toPath($toFull))));
            } else {
                $toFull = ResourceTranslator::toUrl($toFull);
            }

            $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
                "sliderid" => $slider->elementId
            ));

            Js::addStaticGroup(self::getAssetsPath() . '/dist/w-fullscreen.min.js', 'w-fullscreen');

            $displayAttributes = $this->getDisplayAttributes($params, $this->key);

            $styleClass = $slider->addStyle($params->get($this->key . 'style'), 'heading');


            $slider->features->addInitCallback('new _N2.SmartSliderWidgetFullScreenImage(this, ' . Cast::floatToString($params->get($this->key . 'responsive-desktop')) . ', ' . Cast::floatToString($params->get($this->key . 'responsive-tablet')) . ', ' . Cast::floatToString($params->get($this->key . 'responsive-mobile')) . ');');
            $slider->sliderType->addJSDependency('SmartSliderWidgetFullScreenImage');

            $html = Html::tag('div', Html::mergeAttributes($attributes, $displayAttributes, array(
                'class' => $styleClass . 'n2-full-screen-widget n2-ow-all n2-full-screen-widget-image nextend-fullscreen'
            )), Html::image($toNormal, n2_('Exit full screen'), $sizeAttributes + Html::addExcludeLazyLoadAttributes(array(
                        'class'    => 'n2-full-screen-widget-to-normal',
                        'role'     => 'button',
                        'tabindex' => '0'
                    ))) . Html::image($toFull, n2_('Enter Full screen'), $sizeAttributes + Html::addExcludeLazyLoadAttributes(array(
                        'class'    => 'n2-full-screen-widget-to-full',
                        'role'     => 'button',
                        'tabindex' => '0'
                    ))));
        }

        return $html;
    }
}Widget/Bullet/BulletNumbers/BulletNumbers.php000064400000011165152355233130015303 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Bullet\BulletNumbers;


use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3\Widget\Bullet\AbstractBullet;

class BulletNumbers extends AbstractBullet {

    protected $defaults = array(
        'widget-bullet-position-mode'        => 'simple',
        'widget-bullet-position-area'        => 10,
        'widget-bullet-position-offset'      => 5,
        'widget-bullet-action'               => 'click',
        'widget-bullet-style'                => '{"data":[{"backgroundcolor":"000000ab","padding":"5|*|9|*|5|*|9|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":"min-width: 10px;\nmargin: 4px;"},{"backgroundcolor":"5F39C2FF","padding":"5|*|9|*|5|*|9|*|px"}]}',
        'widget-bullet-font'                 => '{"data":[{"color":"ffffffff","size":"14||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Montserrat","lineheight":"1.2","bold":0,"italic":0,"underline":0,"align":"center","extra":""},{"color":"ffffffff"}]}',
        'widget-bullet-bar'                  => '',
        'widget-bullet-align'                => 'center',
        'widget-bullet-orientation'          => 'auto',
        'widget-bullet-bar-full-size'        => 0,
        'widget-bullet-overlay'              => 0,
        'widget-bullet-thumbnail-show-image' => 0,
        'widget-bullet-thumbnail-width'      => 60,
        'widget-bullet-thumbnail-style'      => '{"data":[{"backgroundcolor":"00000080","padding":"3|*|3|*|3|*|3|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":"margin: 5px;"}]}',
        'widget-bullet-thumbnail-side'       => 'before'
    );


    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-bullet-number-row-1');

        new WidgetPosition($row1, 'widget-bullet-position', n2_('Position'));

        new Select($row1, 'widget-bullet-action', n2_('Action'), '', array(
            'options' => array(
                'click'      => n2_('Click'),
                'mouseenter' => n2_('Hover')
            )
        ));

        $row2 = new FieldsetRow($container, 'widget-bullet-number-row-2');

        new Style($row2, 'widget-bullet-style', n2_('Dot'), '', array(
            'mode'    => 'dot',
            'font'    => 'sliderwidget-bullet-font',
            'style2'  => 'sliderwidget-bullet-bar',
            'preview' => 'SmartSliderAdminWidgetBulletNumbers'
        ));

        new Font($row2, 'widget-bullet-font', n2_('Text'), '', array(
            'mode'    => 'dot',
            'style'   => 'sliderwidget-bullet-style',
            'style2'  => 'sliderwidget-bullet-bar',
            'preview' => 'SmartSliderAdminWidgetBulletNumbers'
        ));

        new Style($row2, 'widget-bullet-bar', n2_('Bar'), '', array(
            'mode'    => 'simple',
            'font'    => 'sliderwidget-bullet-font',
            'style2'  => 'sliderwidget-bullet-style',
            'preview' => 'SmartSliderAdminWidgetBulletNumbers'
        ));

        new OnOff($row2, 'widget-bullet-bar-full-size', n2_('Bar full size'), '');
        new Select($row2, 'widget-bullet-align', n2_('Align'), '', array(
            'options' => array(
                'left'   => n2_('Left'),
                'center' => n2_('Center'),
                'right'  => n2_('Right')
            )
        ));
        new Select($row2, 'widget-bullet-orientation', n2_('Orientation'), '', array(
            'options' => array(
                'auto'       => n2_('Auto'),
                'horizontal' => n2_('Horizontal'),
                'vertical'   => n2_('Vertical')
            )
        ));
        new OnOff($row2, 'widget-bullet-overlay', n2_('Overlay'), '');
    }

    public function prepareExport($export, $params) {
        $export->addVisual($params->get($this->key . 'style'));
        $export->addVisual($params->get($this->key . 'bar'));
        $export->addVisual($params->get($this->key . 'font'));
    }

    public function prepareImport($import, $params) {

        $params->set($this->key . 'style', $import->fixSection($params->get($this->key . 'style')));
        $params->set($this->key . 'bar', $import->fixSection($params->get($this->key . 'bar')));
        $params->set($this->key . 'font', $import->fixSection($params->get($this->key . 'font')));
    }
}Widget/Bullet/BulletNumbers/BulletNumbersFrontend.php000064400000007012152355233130016777 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Bullet\BulletNumbers;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\Bullet\AbstractBulletFrontend;

class BulletNumbersFrontend extends AbstractBulletFrontend {

    public function render($attributes = array()) {

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        if ($slider->getSlidesCount() <= 1) {
            return '';
        }


        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        Js::addStaticGroup($this->getCommonAssetsPath() . '/dist/w-bullet.min.js', 'w-bullet');

        $displayAttributes = $this->getDisplayAttributes($params, $this->key, 1);

        $bulletStyle = $slider->addStyle($params->get($this->key . 'style'), 'dot');
        $barStyle    = $slider->addStyle($params->get($this->key . 'bar'), 'simple');

        $bulletFont = $slider->addFont($params->get($this->key . 'font'), 'dot');

        $orientation = $this->getOrientationByPosition($params->get($this->key . 'position-mode'), $params->get($this->key . 'position-area'), $params->get($this->key . 'orientation'), 'horizontal');

        $parameters = array(
            'overlay'    => ($params->get($this->key . 'position-mode') || $params->get($this->key . 'overlay')) ? 1 : 0,
            'area'       => intval($params->get($this->key . 'position-area')),
            'dotClasses' => $bulletStyle . $bulletFont,
            'mode'       => 'numeric',
            'action'     => $params->get($this->key . 'action')
        );

        if ($params->get($this->key . 'thumbnail-show-image')) {

            $parameters['thumbnail']       = 1;
            $parameters['thumbnailWidth']  = intval($params->get($this->key . 'thumbnail-width'));
            $parameters['thumbnailHeight'] = intval($params->get($this->key . 'thumbnail-height'));
            $parameters['thumbnailStyle']  = $slider->addStyle($params->get($this->key . 'thumbnail-style'), 'simple', '');
            $side                          = $params->get($this->key . 'thumbnail-side', 'before');


            if ($side == 'before') {
                if ($orientation == 'vertical') {
                    $position = 'left';
                } else {
                    $position = 'top';
                }
            } else {
                if ($orientation == 'vertical') {
                    $position = 'right';
                } else {
                    $position = 'bottom';
                }
            }
            $parameters['thumbnailPosition'] = $position;
        }

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetBulletTransition(this, ' . json_encode($parameters) . ');');
        $slider->sliderType->addJSDependency('SmartSliderWidgetBulletTransition');

        $fullSize = intval($params->get($this->key . 'bar-full-size'));

        return Html::tag("div", Html::mergeAttributes($attributes, $displayAttributes, array(
            "class" => 'n2-ss-control-bullet n2-ow-all n2-ss-control-bullet-' . $orientation . ($fullSize ? ' n2-ss-control-bullet-fullsize' : '')
        )), Html::tag("div", array(
            "class" => $barStyle . " nextend-bullet-bar n2-bar-justify-content-" . $params->get($this->key . 'align')
        ), '<div class="n2-bullet ' . $bulletStyle . $bulletFont . '" style="visibility:hidden;">&nbsp;</div>'));
    }
}Widget/Bullet/BulletText/BulletText.php000064400000011064152355233130014123 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Bullet\BulletText;


use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3\Widget\Bullet\AbstractBullet;

class BulletText extends AbstractBullet {

    protected $defaults = array(
        'widget-bullet-position-mode'        => 'simple',
        'widget-bullet-position-area'        => 10,
        'widget-bullet-position-offset'      => 5,
        'widget-bullet-action'               => 'click',
        'widget-bullet-style'                => '{"data":[{"backgroundcolor":"000000ab","padding":"5|*|15|*|5|*|15|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"30","extra":"margin: 4px;"},{"backgroundcolor":"04C018FF"}]}',
        'widget-bullet-font'                 => '{"data":[{"color":"ffffffff","size":"12||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Montserrat","lineheight":"1.3","bold":0,"italic":0,"underline":0,"align":"left","extra":""},{"color":"ffffffff"}]}',
        'widget-bullet-bar'                  => '',
        'widget-bullet-align'                => 'center',
        'widget-bullet-orientation'          => 'auto',
        'widget-bullet-bar-full-size'        => 0,
        'widget-bullet-overlay'              => 0,
        'widget-bullet-thumbnail-show-image' => 0,
        'widget-bullet-thumbnail-width'      => 60,
        'widget-bullet-thumbnail-style'      => '{"data":[{"backgroundcolor":"00000080","padding":"3|*|3|*|3|*|3|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":"margin: 5px;"}]}',
        'widget-bullet-thumbnail-side'       => 'before'
    );

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-bullet-text-row-1');

        new WidgetPosition($row1, 'widget-bullet-position', n2_('Position'));

        new Select($row1, 'widget-bullet-action', n2_('Action'), '', array(
            'options' => array(
                'click'      => n2_('Click'),
                'mouseenter' => n2_('Hover')
            )
        ));


        $row2 = new FieldsetRow($container, 'widget-bullet-text-row-2');

        new Style($row2, 'widget-bullet-style', n2_('Dot'), '', array(
            'mode'    => 'dot',
            'font'    => 'sliderwidget-bullet-font',
            'style2'  => 'sliderwidget-bullet-bar',
            'preview' => 'SmartSliderAdminWidgetBulletText'
        ));

        new Font($row2, 'widget-bullet-font', n2_('Text'), '', array(
            'mode'    => 'dot',
            'style'   => 'sliderwidget-bullet-style',
            'style2'  => 'sliderwidget-bullet-bar',
            'preview' => 'SmartSliderAdminWidgetBulletText'
        ));

        new Style($row2, 'widget-bullet-bar', n2_('Bar'), '', array(
            'mode'    => 'simple',
            'font'    => 'sliderwidget-bullet-font',
            'style2'  => 'sliderwidget-bullet-style',
            'preview' => 'SmartSliderAdminWidgetBulletText'
        ));

        new OnOff($row2, 'widget-bullet-bar-full-size', n2_('Bar full size'), '');
        new Select($row2, 'widget-bullet-align', n2_('Align'), '', array(
            'options' => array(
                'left'   => n2_('Left'),
                'center' => n2_('Center'),
                'right'  => n2_('Right')
            )
        ));
        new Select($row2, 'widget-bullet-orientation', n2_('Orientation'), '', array(
            'options' => array(
                'auto'       => n2_('Auto'),
                'horizontal' => n2_('Horizontal'),
                'vertical'   => n2_('Vertical')
            )
        ));
        new OnOff($row2, 'widget-bullet-overlay', n2_('Overlay'), '');
    }


    public function prepareExport($export, $params) {
        $export->addVisual($params->get($this->key . 'style'));
        $export->addVisual($params->get($this->key . 'bar'));
        $export->addVisual($params->get($this->key . 'font'));
    }

    public function prepareImport($import, $params) {

        $params->set($this->key . 'style', $import->fixSection($params->get($this->key . 'style')));
        $params->set($this->key . 'bar', $import->fixSection($params->get($this->key . 'bar')));
        $params->set($this->key . 'font', $import->fixSection($params->get($this->key . 'font')));
    }
}Widget/Bullet/BulletText/BulletTextFrontend.php000064400000007046152355233130015630 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Bullet\BulletText;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\Bullet\AbstractBulletFrontend;

class BulletTextFrontend extends AbstractBulletFrontend {

    public function render($attributes = array()) {

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        if ($slider->getSlidesCount() <= 1) {
            return '';
        }

        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        Js::addStaticGroup($this->getCommonAssetsPath() . '/dist/w-bullet.min.js', 'w-bullet');


        $displayAttributes = $this->getDisplayAttributes($params, $this->key, 1);

        $bulletStyle = $slider->addStyle($params->get($this->key . 'style'), 'dot');
        $barStyle    = $slider->addStyle($params->get($this->key . 'bar'), 'simple');

        $bulletFont = $slider->addFont($params->get($this->key . 'font'), 'dot');


        $orientation = $this->getOrientationByPosition($params->get($this->key . 'position-mode'), $params->get($this->key . 'position-area'), $params->get($this->key . 'orientation'), 'horizontal');


        $parameters = array(
            'overlay'    => ($params->get($this->key . 'position-mode') != 'simple' || $params->get($this->key . 'overlay') || $orientation == 'vertical') ? 1 : 0,
            'area'       => intval($params->get($this->key . 'position-area')),
            'dotClasses' => $bulletStyle . $bulletFont,
            'mode'       => 'title',
            'action'     => $params->get($this->key . 'action')
        );

        if ($params->get($this->key . 'thumbnail-show-image')) {

            $parameters['thumbnail']       = 1;
            $parameters['thumbnailWidth']  = intval($params->get($this->key . 'thumbnail-width'));
            $parameters['thumbnailHeight'] = intval($params->get($this->key . 'thumbnail-height'));
            $parameters['thumbnailStyle']  = $slider->addStyle($params->get($this->key . 'thumbnail-style'), 'simple', '');
            $side                          = $params->get($this->key . 'thumbnail-side');


            if ($side == 'before') {
                if ($orientation == 'vertical') {
                    $position = 'left';
                } else {
                    $position = 'top';
                }
            } else {
                if ($orientation == 'vertical') {
                    $position = 'right';
                } else {
                    $position = 'bottom';
                }
            }
            $parameters['thumbnailPosition'] = $position;
        }

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetBulletTransition(this, ' . json_encode($parameters) . ');');
        $slider->sliderType->addJSDependency('SmartSliderWidgetBulletTransition');

        $fullSize = intval($params->get($this->key . 'bar-full-size'));

        return Html::tag("div", Html::mergeAttributes($attributes, $displayAttributes, array(
            "class" => 'n2-ss-control-bullet n2-ow-all n2-ss-control-bullet-' . $orientation . ($fullSize ? ' n2-ss-control-bullet-fullsize' : '')
        )), Html::tag("div", array(
            "class" => $barStyle . " nextend-bullet-bar n2-bar-justify-content-" . $params->get($this->key . 'align')
        ), '<div class="n2-bullet ' . $bulletStyle . $bulletFont . '" style="visibility:hidden;">&nbsp;</div>'));
    }
}Widget/Bar/BarVertical/BarVertical.php000064400000006763152355233130013616 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Bar\BarVertical;


use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3\Widget\Bar\AbstractWidgetBar;

class BarVertical extends AbstractWidgetBar {

    protected $defaults = array(
        'widget-bar-position-mode'    => 'simple',
        'widget-bar-position-area'    => 6,
        'widget-bar-position-offset'  => 0,
        'widget-bar-style'            => '{"data":[{"backgroundcolor":"000000ab","padding":"20|*|20|*|20|*|20|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":""}]}',
        'widget-bar-font-title'       => '{"data":[{"color":"ffffffff","size":"16||px","tshadow":"0|*|0|*|0|*|000000c7","afont":"Montserrat","lineheight":"1.3","bold":0,"italic":0,"underline":0,"align":"left"},{"color":"fc2828ff","afont":"Raleway,Arial","size":"25||px"},{}]}',
        'widget-bar-font-description' => '{"data":[{"color":"ffffffff","size":"12||px","tshadow":"0|*|0|*|0|*|000000c7","afont":"Montserrat","lineheight":"1.6","bold":0,"italic":0,"underline":0,"align":"left","extra":"margin-top:10px;"},{"color":"fc2828ff","afont":"Raleway,Arial","size":"25||px"},{}]}',
        'widget-bar-width'            => '200px',
        'widget-bar-height'           => '100%',
        'widget-bar-animate'          => 0
    );

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-bar-vertical-row-1');

        new WidgetPosition($row1, 'widget-bar-position', n2_('Position'));

        new OnOff($row1, 'widget-bar-animate', n2_('Animate'));

        new Style($row1, 'widget-bar-style', n2_('Bar'), '', array(
            'mode'    => 'simple',
            'font'    => 'sliderwidget-bar-font-title',
            'font2'   => 'sliderwidget-bar-font-description',
            'preview' => 'SmartSliderAdminWidgetBarVertical'
        ));

        new Font($row1, 'widget-bar-font-title', n2_('Title'), '', array(
            'mode'    => 'simple',
            'style'   => 'sliderwidget-bar-style',
            'preview' => 'SmartSliderAdminWidgetBarVertical'
        ));

        new Font($row1, 'widget-bar-font-description', n2_('Description'), '', array(
            'mode'    => 'simple',
            'style'   => 'sliderwidget-bar-style',
            'preview' => 'SmartSliderAdminWidgetBarVertical'
        ));

        $row2 = new FieldsetRow($container, 'widget-bar-vertical-row-2');

        new Text($row2, 'widget-bar-width', n2_('Width'));
        new Text($row2, 'widget-bar-height', n2_('Height'), '');
    }


    public function prepareExport($export, $params) {
        $export->addVisual($params->get($this->key . 'style'));
        $export->addVisual($params->get($this->key . 'font-title'));
        $export->addVisual($params->get($this->key . 'font-description'));
    }

    public function prepareImport($import, $params) {

        $params->set($this->key . 'style', $import->fixSection($params->get($this->key . 'style', '')));
        $params->set($this->key . 'font-title', $import->fixSection($params->get($this->key . 'font-title', '')));
        $params->set($this->key . 'font-description', $import->fixSection($params->get($this->key . 'font-description', '')));
    }
}Widget/Bar/BarVertical/BarVerticalFrontend.php000064400000006271152355233130015310 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Widget\Bar\BarVertical;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class BarVerticalFrontend extends AbstractWidgetFrontend {

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->slider->exposeSlideData['description'] = true;

        $this->addToPlacement($this->key . 'position-', array(
            $this,
            'render'
        ));
    }

    public function render($attributes = array()) {

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        Js::addStaticGroup(self::getAssetsPath() . '/dist/w-bar-vertical.min.js', 'w-bar-vertical');

        $displayAttributes = $this->getDisplayAttributes($params, $this->key, 1);

        $styleClass = $slider->addStyle($params->get($this->key . 'style'), 'simple');

        $fontTitle       = $slider->addFont($params->get($this->key . 'font-title'), 'simple');
        $fontDescription = $slider->addFont($params->get($this->key . 'font-description'), 'simple');


        $style = 'text-align: ' . $params->get($this->key . 'align', 'left') . ';';

        $width = $params->get($this->key . 'width');
        if (is_numeric($width) || substr($width, -1) == '%' || substr($width, -2) == 'px') {
            $style .= 'width:' . $width . ';';
            if (substr($width, -1) == '%') {
                $attributes['data-width-percent'] = substr($width, 0, -1);
            }
        }

        $height = $params->get($this->key . 'height');
        if (is_numeric($height) || substr($height, -1) == '%' || substr($height, -2) == 'px') {
            $style .= 'height:' . $height . ';';
            if (substr($height, -1) == '%') {
                $attributes['data-height-percent'] = substr($height, 0, -1);
            }
        }

        $parameters = array(
            'area'            => intval($params->get($this->key . 'position-area')),
            'animate'         => intval($params->get($this->key . 'animate')),
            'fontTitle'       => $fontTitle,
            'fontDescription' => $fontDescription
        );

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetBarVertical(this, ' . json_encode($parameters) . ');');
        $slider->sliderType->addJSDependency('SmartSliderWidgetBarVertical');

        return Html::tag("div", Html::mergeAttributes($attributes, $displayAttributes, array(
            "class" => "nextend-bar nextend-bar-vertical n2-ss-widget-hidden n2-ow-all",
            "style" => $style
        )), Html::tag("div", array(
            "class" => $styleClass
        ), Html::tag("div", array(), '')));
    }

    protected function translateArea($area) {

        if ($area == 5) {
            return 'left';
        } else if ($area == 8) {
            return 'right';
        }

        return parent::translateArea($area);
    }
}Widget/Arrow/ArrowText/ArrowText.php000064400000006102152355233130013471 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowText;


use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3\Widget\Arrow\AbstractWidgetArrow;

class ArrowText extends AbstractWidgetArrow {

    protected $key = 'widget-arrow-';

    protected $defaults = array(
        'widget-arrow-style'                    => '{"data":[{"backgroundcolor":"000000ab","padding":"8|*|10|*|8|*|10|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":""},{"backgroundcolor":"04C018FF"}]}',
        'widget-arrow-font'                     => '{"data":[{"color":"ffffffff","size":"12||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Montserrat","lineheight":"1.3","bold":0,"italic":0,"underline":0,"align":"left","extra":""},{}]}',
        'widget-arrow-previous-position-mode'   => 'simple',
        'widget-arrow-previous-position-area'   => 6,
        'widget-arrow-previous-position-offset' => 15,
        'widget-arrow-next-position-mode'       => 'simple',
        'widget-arrow-next-position-area'       => 7,
        'widget-arrow-next-position-offset'     => 15
    );

    public function __construct($widgetGroup, $name, $defaults = array()) {
        parent::__construct($widgetGroup, $name, array_merge(array(
            'widget-arrow-previous-label' => n2_('Prev'),
            'widget-arrow-next-label'     => n2_('Next')
        ), $defaults));
    }

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-arrow-text-row-1');

        new Text($row1, 'widget-arrow-previous-label', n2_('Previous label'));
        new Text($row1, 'widget-arrow-next-label', n2_('Next label'));

        $row2 = new FieldsetRow($container, 'widget-arrow-text-row-2');

        new Style($row2, 'widget-arrow-style', n2_('Arrow'), '', array(
            'mode'    => 'button',
            'font'    => 'sliderwidget-arrow-font',
            'preview' => 'SmartSliderAdminWidgetArrowText'
        ));

        new Font($row2, 'widget-arrow-font', n2_('Text'), '', array(
            'mode'    => 'link',
            'style'   => 'sliderwidget-arrow-style',
            'preview' => 'SmartSliderAdminWidgetArrowText'
        ));

        new WidgetPosition($row2, 'widget-arrow-previous-position', n2_('Previous position'));

        new WidgetPosition($row2, 'widget-arrow-next-position', n2_('Next position'));
    }

    public function prepareExport($export, $params) {
        $export->addVisual($params->get($this->key . 'font'));
        $export->addVisual($params->get($this->key . 'style'));
    }

    public function prepareImport($import, $params) {

        $params->set($this->key . 'font', $import->fixSection($params->get($this->key . 'font', '')));
        $params->set($this->key . 'style', $import->fixSection($params->get($this->key . 'style', '')));
    }
}Widget/Arrow/ArrowText/ArrowTextFrontend.php000064400000007423152355233130015200 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowText;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class ArrowTextFrontend extends AbstractWidgetFrontend {

    protected $rendered = false;

    protected $previousArguments;
    protected $nextArguments;

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->addToPlacement($this->key . 'previous-position-', array(
            $this,
            'renderPrevious'
        ));

        $this->addToPlacement($this->key . 'next-position-', array(
            $this,
            'renderNext'
        ));
    }

    public function renderPrevious($attributes = array()) {

        $this->render();

        if ($this->previousArguments) {

            array_unshift($this->previousArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->previousArguments);
        }

        return '';
    }

    public function renderNext($attributes = array()) {

        $this->render();

        if ($this->nextArguments) {

            array_unshift($this->nextArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->nextArguments);
        }

        return '';
    }

    private function render() {

        if ($this->rendered) return;

        $this->rendered = true;

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;
        if ($slider->getSlidesCount() <= 1) {
            return;
        }

        Js::addStaticGroup(self::getAssetsPath() . '/dist/w-arrow-text.min.js', 'w-arrow-text');

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetArrowText(this);');
        $slider->sliderType->addJSDependency('SmartSliderWidgetArrowText');

        $displayAttributes = $this->getDisplayAttributes($params, $this->key);

        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        $font  = $slider->addFont($params->get($this->key . 'font'), 'hover');
        $style = $slider->addStyle($params->get($this->key . 'style'), 'heading');

        $this->previousArguments = array(
            $id,
            'previous',
            $displayAttributes,
            $font,
            $style
        );
        $this->nextArguments     = array(
            $id,
            'next',
            $displayAttributes,
            $font,
            $style
        );
    }

    private function getHtml($attributes, $id, $side, $displayAttributes, $font, $styleClass) {

        $label = '';
        switch ($side) {
            case 'previous':
                $label = n2_('Previous slide');
                break;
            case 'next':
                $label = n2_('Next slide');
                break;
        }

        $html = Html::openTag("div", Html::mergeAttributes($attributes, $displayAttributes, array(
            'id'         => $id . '-arrow-' . $side,
            "class"      => "nextend-arrow nextend-arrow-{$side} n2-ow-all",
            'tabindex'   => '0',
            'role'       => 'button',
            'aria-label' => $label
        )));


        $html .= Html::tag('div', array(
            "class" => $styleClass . ' ' . $font . ' nextend-arrow-text',
            "style" => 'display:inline-block'
        ), $this->params->get($this->key . $side . '-label'));

        $html .= Html::closeTag("div");

        return $html;
    }
}Widget/Arrow/ArrowReveal/ArrowReveal.php000064400000010476152355233130014266 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowReveal;


use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Radio\ImageListFromFolder;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Widget\Arrow\AbstractWidgetArrow;

class ArrowReveal extends AbstractWidgetArrow {

    protected $defaults = array(
        'widget-arrow-previous-position-mode'   => 'simple',
        'widget-arrow-previous-position-area'   => 6,
        'widget-arrow-previous-position-offset' => 0,
        'widget-arrow-next-position-mode'       => 'simple',
        'widget-arrow-next-position-area'       => 7,
        'widget-arrow-next-position-offset'     => 0,
        'widget-arrow-font'                     => '',
        'widget-arrow-background'               => '00000080',
        'widget-arrow-title-show'               => 0,
        'widget-arrow-title-font'               => '{"data":[{"color":"ffffffff","size":"12||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Montserrat","lineheight":"1.3","bold":0,"italic":0,"underline":0,"align":"left","extra":""},{}]}',
        'widget-arrow-title-background'         => '000000cc',
        'widget-arrow-animation'                => 'slide',
        'widget-arrow-previous-color'           => 'ffffffcc',
        'widget-arrow-previous'                 => '$ss$/plugins/widgetarrow/reveal/reveal/previous/simple-horizontal.svg',
        'widget-arrow-mirror'                   => 1,
        'widget-arrow-next-color'               => 'ffffffcc',
        'widget-arrow-next'                     => '$ss$/plugins/widgetarrow/reveal/reveal/next/simple-horizontal.svg'
    );

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-arrow-reveal-row-1');

        new Color($row1, 'widget-arrow-background', n2_('Background'), '', array(
            'alpha' => true
        ));

        new Select($row1, 'widget-arrow-animation', n2_('Animation'), '', array(
            'options' => array(
                'slide' => n2_x('Slide', 'Animation'),
                'fade'  => n2_('Fade'),
                'turn'  => n2_('Turn')
            )
        ));

        $rowPrevious = new FieldsetRow($container, 'widget-arrow-reveal-row-previous');

        new ImageListFromFolder($rowPrevious, 'widget-arrow-previous', n2_x('Previous', 'Arrow direction'), '', array(
            'post'   => 'break',
            'folder' => self::getAssetsPath() . '/previous/'
        ));
        new Color($rowPrevious, 'widget-arrow-previous-color', n2_('Color'), '', array(
            'alpha' => true
        ));

        new OnOff($rowPrevious, 'widget-arrow-mirror', n2_('Mirror'), '', array(
            'relatedFieldsOff' => array(
                'sliderwidget-arrow-next',
                'sliderwidget-arrow-next-color'
            )
        ));

        new ImageListFromFolder($rowPrevious, 'widget-arrow-next', n2_x('Next', 'Arrow direction'), '', array(
            'post'   => 'break',
            'folder' => self::getAssetsPath() . '/next/'
        ));
        new Color($rowPrevious, 'widget-arrow-next-color', n2_('Color'), '', array(
            'alpha' => true
        ));

        $rowTitle = new FieldsetRow($container, 'widget-arrow-reveal-row-title');
        new OnOff($rowTitle, 'widget-arrow-title-show', n2_('Slide title'), 0, array(
            'relatedFieldsOn' => array(
                'sliderwidget-arrow-title-font',
                'sliderwidget-arrow-title-background'
            )
        ));
        new Font($rowTitle, 'widget-arrow-title-font', n2_('Font'), '', array(
            'mode'    => 'link',
            'preview' => 'SmartSliderAdminWidgetArrowReveal'
        ));
        new Color($rowTitle, 'widget-arrow-title-background', n2_('Background color'), '', array(
            'alpha' => true
        ));
    }

    public function prepareExport($export, $params) {
        $export->addVisual($params->get($this->key . 'title-font'));
    }

    public function prepareImport($import, $params) {

        $params->set($this->key . 'title-font', $import->fixSection($params->get($this->key . 'title-font', '')));
    }
}Widget/Arrow/ArrowReveal/ArrowRevealFrontend.php000064400000015236152355233130015765 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowReveal;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class ArrowRevealFrontend extends AbstractWidgetFrontend {

    protected $rendered = false;

    protected $previousArguments;
    protected $nextArguments;

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->slider->exposeSlideData['thumbnail'] = true;

        $this->addToPlacement($this->key . 'previous-position-', array(
            $this,
            'renderPrevious'
        ));

        $this->addToPlacement($this->key . 'next-position-', array(
            $this,
            'renderNext'
        ));
    }

    public function renderPrevious($attributes = array()) {

        $this->render();

        if ($this->previousArguments) {

            array_unshift($this->previousArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->previousArguments);
        }

        return '';
    }

    public function renderNext($attributes = array()) {

        $this->render();

        if ($this->nextArguments) {

            array_unshift($this->nextArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->nextArguments);
        }

        return '';
    }

    private function render() {

        if ($this->rendered) return;

        $this->rendered = true;

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        if ($slider->getSlidesCount() <= 1) {
            return;
        }

        $RGBA      = Color::colorToRGBA($params->get($this->key . 'background'));
        $titleRGBA = Color::colorToRGBA($params->get($this->key . 'title-background'));


        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid"            => $slider->elementId,
            "arrowBackgroundRGBA" => $RGBA,
            "titleBackgroundRGBA" => $titleRGBA
        ));

        Js::addStaticGroup(self::getAssetsPath() . '/dist/w-arrow-reveal.min.js', 'w-arrow-reveal');

        $previousValue = basename($params->get($this->key . 'previous'));
        if ($previousValue == -1) {
            $previous = false;
        } else {
            $previous = ResourceTranslator::pathToResource(self::getAssetsPath() . '/previous/' . $previousValue);
        }
        $previousColor = $params->get($this->key . 'previous-color');
        if ($params->get($this->key . 'mirror')) {
            if ($previousValue == -1) {
                $next = false;
            } else {
                $next = ResourceTranslator::pathToResource(self::getAssetsPath() . '/next/' . $previousValue);
            }
            $nextColor = $previousColor;
        } else {
            $nextValue = basename($params->get($this->key . 'next'));
            if ($nextValue == -1) {
                $next = false;
            } else {
                $next = ResourceTranslator::pathToResource(self::getAssetsPath() . '/next/' . $nextValue);
            }
            $nextColor = $params->get($this->key . 'next-color');
        }

        $fontClass = $slider->addFont($params->get($this->key . 'title-font'), 'simple');

        $animation      = $params->get($this->key . 'animation');
        $animationClass = ' n2-ss-arrow-animation-' . $animation;

        if ($previous) {
            $this->previousArguments = array(
                $id,
                'previous',
                $previous,
                $fontClass,
                $animationClass,
                $previousColor
            );
        }
        if ($next) {
            $this->nextArguments = array(
                $id,
                'next',
                $next,
                $fontClass,
                $animationClass,
                $nextColor
            );
        }

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetArrowReveal(this,"' . $animation . '");');
        $slider->sliderType->addJSDependency('SmartSliderWidgetArrowReveal');

    }

    /**
     * @param array $attributes
     * @param       $id
     * @param       $side
     * @param       $image
     * @param       $fontClass
     * @param       $animationClass
     * @param       $color
     *
     * @return string
     */
    private function getHTML($attributes, $id, $side, $image, $fontClass, $animationClass, $color) {

        $displayAttributes = $this->getDisplayAttributes($this->params, $this->key);

        $ext = pathinfo($image, PATHINFO_EXTENSION);
        if ($ext == 'svg' && ResourceTranslator::isResource($image)) {
            list($color, $opacity) = Color::colorToSVG($color);
            $image = 'data:image/svg+xml;base64,' . Base64::encode(str_replace(array(
                    'fill="#FFF"',
                    'opacity="1"'
                ), array(
                    'fill="#' . $color . '"',
                    'opacity="' . $opacity . '"'
                ), Filesystem::readFile(ResourceTranslator::toPath($image))));
        } else {
            $image = ResourceTranslator::toUrl($image);
        }

        $label = '';
        switch ($side) {
            case 'previous':
                $label = n2_('Previous slide');
                break;
            case 'next':
                $label = n2_('Next slide');
                break;
        }

        return Html::tag('div', Html::mergeAttributes($attributes, $displayAttributes, array(
            'id'         => $id . '-arrow-' . $side,
            'class'      => 'nextend-arrow n2-ow nextend-arrow-reveal nextend-arrow-' . $side . $animationClass,
            'role'       => 'button',
            'aria-label' => $label,
            'tabindex'   => '0'
        )), Html::tag('div', array(
                'class' => ' nextend-arrow-image n2-ow'
            ), $this->params->get($this->key . 'title-show') ? Html::tag('div', array(
                'class' => $fontClass . ' nextend-arrow-title n2-ow'
            ), '') : '') . Html::tag('div', array(
                'class' => 'nextend-arrow-arrow n2-ow',
                'style' => 'background-image: url(' . $image . ');'
            ), ''));
    }
}Widget/Arrow/ArrowImageBar/ArrowImageBar.php000064400000005010152355233130014734 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowImageBar;


use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Radio\ImageListFromFolder;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Widget\Arrow\AbstractWidgetArrow;

class ArrowImageBar extends AbstractWidgetArrow {

    protected $defaults = array(
        'widget-arrow-previous-position-mode'   => 'simple',
        'widget-arrow-previous-position-area'   => 2,
        'widget-arrow-previous-position-offset' => 0,
        'widget-arrow-next-position-mode'       => 'simple',
        'widget-arrow-next-position-area'       => 4,
        'widget-arrow-next-position-offset'     => 0,
        'widget-arrow-width'                    => 100,
        'widget-arrow-previous-color'           => 'ffffffcc',
        'widget-arrow-previous'                 => '$ss$/plugins/widgetarrow/imagebar/imagebar/previous/simple-horizontal.svg',
        'widget-arrow-mirror'                   => 1,
        'widget-arrow-next-color'               => 'ffffffcc',
        'widget-arrow-next'                     => '$ss$/plugins/widgetarrow/imagebar/imagebar/next/simple-horizontal.svg'
    );

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-arrow-image-bar-row-1');
        new Number($row1, 'widget-arrow-width', n2_('Width'), 0, array(
            'style' => 'width:40px;',
            'unit'  => 'px'
        ));

        $rowIcon = new FieldsetRow($container, 'widget-arrow-image-bar-row-icon');
        new ImageListFromFolder($rowIcon, 'widget-arrow-previous', n2_x('Previous', 'Arrow direction'), '', array(
            'folder' => self::getAssetsPath() . '/previous/'
        ));
        new Color($rowIcon, 'widget-arrow-previous-color', n2_('Color'), '', array(
            'alpha' => true
        ));

        new OnOff($rowIcon, 'widget-arrow-mirror', n2_('Mirror'), '', array(
            'relatedFieldsOff' => array(
                'sliderwidget-arrow-next',
                'sliderwidget-arrow-next-color'
            )
        ));

        new ImageListFromFolder($rowIcon, 'widget-arrow-next', n2_x('Next', 'Arrow direction'), '', array(
            'folder' => self::getAssetsPath() . '/next/'
        ));
        new Color($rowIcon, 'widget-arrow-next-color', n2_('Color'), '', array(
            'alpha' => true
        ));
    }
}Widget/Arrow/ArrowImageBar/ArrowImageBarFrontend.php000064400000013636152355233130016451 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowImageBar;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class ArrowImageBarFrontend extends AbstractWidgetFrontend {

    protected $rendered = false;

    protected $previousArguments;
    protected $nextArguments;

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->slider->exposeSlideData['thumbnail'] = true;

        $this->addToPlacement($this->key . 'previous-position-', array(
            $this,
            'renderPrevious'
        ));

        $this->addToPlacement($this->key . 'next-position-', array(
            $this,
            'renderNext'
        ));
    }

    public function renderPrevious($attributes = array()) {

        $this->render();

        if ($this->previousArguments) {

            array_unshift($this->previousArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->previousArguments);
        }

        return '';
    }

    public function renderNext($attributes = array()) {

        $this->render();

        if ($this->nextArguments) {

            array_unshift($this->nextArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->nextArguments);
        }

        return '';
    }

    private function render() {

        if ($this->rendered) return;

        $this->rendered = true;

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        if ($slider->getSlidesCount() <= 1) {
            return;
        }

        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        Js::addStaticGroup(self::getAssetsPath() . '/dist/w-arrow-imagebar.min.js', 'w-arrow-imagebar');

        $previousValue = basename($params->get($this->key . 'previous'));
        if ($previousValue == -1) {
            $previous = false;
        } else {
            $previous = ResourceTranslator::pathToResource(self::getAssetsPath() . '/previous/' . $previousValue);
        }
        $previousColor = $params->get($this->key . 'previous-color');
        if ($params->get($this->key . 'mirror')) {
            if ($previousValue == -1) {
                $next = false;
            } else {
                $next = ResourceTranslator::pathToResource(self::getAssetsPath() . '/next/' . $previousValue);
            }
            $nextColor = $previousColor;
        } else {
            $nextValue = basename($params->get($this->key . 'next'));
            if ($nextValue == -1) {
                $next = false;
            } else {
                $next = ResourceTranslator::pathToResource(self::getAssetsPath() . '/next/' . $nextValue);
            }
            $nextColor = $params->get($this->key . 'next-color');
        }

        if ($previous) {
            $this->previousArguments = array(
                $id,
                'previous',
                $previous,
                $previousColor
            );
        }
        if ($next) {
            $this->nextArguments = array(
                $id,
                'next',
                $next,
                $nextColor
            );
        }

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetArrowImageBar(this);');
        $slider->sliderType->addJSDependency('SmartSliderWidgetArrowImageBar');
    }

    /**
     * @param array         $attributes
     * @param               $id
     * @param Data          $params
     * @param               $side
     *
     * @return string
     */
    private function getHTML($attributes, $id, $side, $image, $color) {

        $displayAttributes = $this->getDisplayAttributes($this->params, $this->key);


        $ext = pathinfo($image, PATHINFO_EXTENSION);
        if ($ext == 'svg' && ResourceTranslator::isResource($image)) {
            list($color, $opacity) = Color::colorToSVG($color);
            $image = 'data:image/svg+xml;base64,' . Base64::encode(str_replace(array(
                    'fill="#FFF"',
                    'opacity="1"'
                ), array(
                    'fill="#' . $color . '"',
                    'opacity="' . $opacity . '"'
                ), Filesystem::readFile(ResourceTranslator::toPath($image))));
        } else {
            $image = ResourceTranslator::toUrl($image);
        }

        $style = 'width: ' . intval($this->params->get($this->key . 'width')) . 'px';

        $label = '';
        switch ($side) {
            case 'previous':
                $label = n2_('Previous slide');
                break;
            case 'next':
                $label = n2_('Next slide');
                break;
        }

        return Html::tag('div', Html::mergeAttributes($attributes, $displayAttributes, array(
            'id'         => $id . '-arrow-' . $side,
            'class'      => 'nextend-arrow nextend-arrow-imagebar n2-ow-all nextend-arrow-' . $side,
            'style'      => $style,
            'role'       => 'button',
            'aria-label' => $label,
            'tabindex'   => '0'
        )), Html::tag('div', array(
                'class' => 'nextend-arrow-image'
            ), '') . Html::tag('div', array(
                'class' => 'nextend-arrow-arrow',
                'style' => 'background-image: url(' . $image . ');'
            ), ''));
    }
}Widget/Arrow/ArrowGrow/ArrowGrowFrontend.php000064400000014176152355233130015167 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowGrow;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class ArrowGrowFrontend extends AbstractWidgetFrontend {

    protected $rendered = false;

    protected $previousArguments;
    protected $nextArguments;

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->addToPlacement($this->key . 'previous-position-', array(
            $this,
            'renderPrevious'
        ));

        $this->addToPlacement($this->key . 'next-position-', array(
            $this,
            'renderNext'
        ));
    }

    public function renderPrevious($attributes = array()) {

        $this->render();

        if ($this->previousArguments) {

            array_unshift($this->previousArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->previousArguments);
        }

        return '';
    }

    public function renderNext($attributes = array()) {

        $this->render();

        if ($this->nextArguments) {

            array_unshift($this->nextArguments, $attributes);

            return call_user_func_array(array(
                $this,
                'getHTML'
            ), $this->nextArguments);
        }

        return '';
    }

    private function render() {

        if ($this->rendered) return;

        $this->rendered = true;

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        if ($slider->getSlidesCount() <= 1) {
            return '';
        }

        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        Js::addStaticGroup(self::getAssetsPath() . '/dist/w-arrow-grow.min.js', 'w-arrow-grow');

        $previousValue = basename($params->get($this->key . 'previous'));
        if ($previousValue == -1) {
            $previous = false;
        } else {
            $previous = ResourceTranslator::pathToResource(self::getAssetsPath() . '/previous/' . $previousValue);
        }
        $previousColor = $params->get($this->key . 'previous-color');
        if ($params->get($this->key . 'mirror')) {
            if ($previousValue == -1) {
                $next = false;
            } else {
                $next = ResourceTranslator::pathToResource(self::getAssetsPath() . '/next/' . $previousValue);
            }
            $nextColor = $previousColor;
        } else {
            $nextValue = basename($params->get($this->key . 'next'));
            if ($nextValue == -1) {
                $next = false;
            } else {
                $next = ResourceTranslator::pathToResource(self::getAssetsPath() . '/next/' . $nextValue);
            }
            $nextColor = $params->get($this->key . 'next-color');
        }

        $fontClass  = $slider->addFont($params->get($this->key . 'font'), 'hover');
        $styleClass = $slider->addStyle($params->get($this->key . 'style'), 'heading');

        if ($previous) {
            $this->previousArguments = array(
                $id,
                'previous',
                $previous,
                $fontClass,
                $styleClass,
                $previousColor
            );
        }
        if ($next) {
            $this->nextArguments = array(
                $id,
                'next',
                $next,
                $fontClass,
                $styleClass,
                $nextColor
            );
        }

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetArrowGrow(this, ' . $params->get($this->key . 'animation-delay') . ');');
        $slider->sliderType->addJSDependency('SmartSliderWidgetArrowGrow');

    }

    /**
     * @param array  $attributes
     * @param        $id
     * @param        $side
     * @param        $image
     * @param        $fontClass
     * @param        $styleClass
     * @param        $color
     *
     * @return string
     */
    protected function getHTML($attributes, $id, $side, $image, $fontClass, $styleClass, $color) {

        $displayAttributes = $this->getDisplayAttributes($this->params, $this->key);

        $ext = pathinfo($image, PATHINFO_EXTENSION);
        if ($ext == 'svg' && ResourceTranslator::isResource($image)) {

            list($color, $opacity) = Color::colorToSVG($color);
            $image = 'data:image/svg+xml;base64,' . Base64::encode(str_replace(array(
                    'fill="#FFF"',
                    'opacity="1"'
                ), array(
                    'fill="#' . $color . '"',
                    'opacity="' . $opacity . '"'
                ), Filesystem::readFile(ResourceTranslator::toPath($image))));
        } else {
            $image = ResourceTranslator::toUrl($image);
        }

        $label = '';
        switch ($side) {
            case 'previous':
                $label = n2_('Previous slide');
                break;
            case 'next':
                $label = n2_('Next slide');
                break;
        }

        return Html::tag('div', Html::mergeAttributes($attributes, $displayAttributes, array(
            'id'         => $id . '-arrow-' . $side,
            'class'      => $styleClass . 'nextend-arrow n2-ow-all nextend-arrow-grow nextend-arrow-' . $side,
            'role'       => 'button',
            'aria-label' => $label,
            'tabindex'   => '0'
        )), Html::tag('div', array(
                'class' => $fontClass . ' nextend-arrow-title'
            ), '') . Html::tag('div', array(
                'class' => 'nextend-arrow-arrow',
                'style' => 'background-image: url(' . $image . ');'
            ), ''));
    }
}Widget/Arrow/ArrowGrow/ArrowGrow.php000064400000007241152355233130013462 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Arrow\ArrowGrow;


use Nextend\Framework\Form\Element\Font;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Radio\ImageListFromFolder;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Widget\Arrow\AbstractWidgetArrow;

class ArrowGrow extends AbstractWidgetArrow {

    protected $defaults = array(
        'widget-arrow-previous-position-mode'   => 'simple',
        'widget-arrow-previous-position-area'   => 6,
        'widget-arrow-previous-position-offset' => 15,
        'widget-arrow-next-position-mode'       => 'simple',
        'widget-arrow-next-position-area'       => 7,
        'widget-arrow-next-position-offset'     => 15,
        'widget-arrow-style'                    => '{"data":[{"backgroundcolor":"00000080","padding":"3|*|3|*|3|*|3|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"50","extra":""},{"backgroundcolor":"1D81F9FF"}]}',
        'widget-arrow-font'                     => '{"data":[{"color":"ffffffff","size":"12||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Montserrat","lineheight":"1.3","bold":0,"italic":0,"underline":0,"align":"left","extra":""},{}]}',
        'widget-arrow-previous-color'           => 'ffffffcc',
        'widget-arrow-previous'                 => '$ss$/plugins/widgetarrow/grow/grow/previous/simple-horizontal.svg',
        'widget-arrow-mirror'                   => 1,
        'widget-arrow-next-color'               => 'ffffffcc',
        'widget-arrow-next'                     => '$ss$/plugins/widgetarrow/grow/grow/next/simple-horizontal.svg'
    );

    public function renderFields($container) {

        $rowIcon = new FieldsetRow($container, 'widget-arrow-grow-row-icon');
        new ImageListFromFolder($rowIcon, 'widget-arrow-previous', n2_x('Previous', 'Arrow direction'), '', array(
            'folder' => self::getAssetsPath() . '/previous/'
        ));
        new Color($rowIcon, 'widget-arrow-previous-color', n2_('Color'), '', array(
            'alpha' => true
        ));

        new OnOff($rowIcon, 'widget-arrow-mirror', n2_('Mirror'), '', array(
            'relatedFieldsOff' => array(
                'sliderwidget-arrow-next',
                'sliderwidget-arrow-next-color'
            )
        ));

        new ImageListFromFolder($rowIcon, 'widget-arrow-next', n2_x('Next', 'Arrow direction'), '', array(
            'folder' => self::getAssetsPath() . '/next/'
        ));
        new Color($rowIcon, 'widget-arrow-next-color', n2_('Color'), '', array(
            'alpha' => true
        ));

        $row3 = new FieldsetRow($container, 'widget-arrow-grow-row-3');

        new Style($row3, 'widget-arrow-style', n2_('Arrow'), '', array(
            'mode'    => 'button',
            'preview' => 'SmartSliderAdminWidgetArrowGrow'
        ));
        new Font($row3, 'widget-arrow-font', n2_('Text'), '', array(
            'mode'    => 'link',
            'preview' => 'SmartSliderAdminWidgetArrowGrow',
            'style'   => 'sliderwidget-arrow-style'
        ));
    }

    public function prepareExport($export, $params) {
        $export->addVisual($params->get($this->key . 'style'));
        $export->addVisual($params->get($this->key . 'font'));
    }

    public function prepareImport($import, $params) {

        $params->set($this->key . 'style', $import->fixSection($params->get($this->key . 'style', '')));
        $params->set($this->key . 'font', $import->fixSection($params->get($this->key . 'font', '')));
    }
}Widget/Indicator/AbstractWidgetIndicator.php000064400000000346152355233130015165 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Indicator;


use Nextend\SmartSlider3\Widget\AbstractWidget;

abstract class AbstractWidgetIndicator extends AbstractWidget {

    protected $key = 'widget-indicator-';
}Widget/Indicator/IndicatorStripe/IndicatorStripe.php000064400000003102152355233130016620 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Indicator\IndicatorStripe;


use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3Pro\Widget\Indicator\AbstractWidgetIndicator;

class IndicatorStripe extends AbstractWidgetIndicator {

    protected $defaults = array(
        'widget-indicator-position-mode' => 'simple',
        'widget-indicator-position-area' => 9,
        'widget-indicator-width'         => '100%',
        'widget-indicator-height'        => 6,
        'widget-indicator-track'         => '000000ab',
        'widget-indicator-bar'           => '1D81F9FF'
    );

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-indicator-stripe-1');

        new WidgetPosition($row1, 'widget-indicator-position', n2_('Position'));

        new Text($row1, 'widget-indicator-width', n2_('Width'), '', array(
            'style' => 'width:30px;',
            'unit'  => 'px'
        ));
        new Number($row1, 'widget-indicator-height', n2_('Height'), '', array(
            'wide' => 4,
            'unit' => 'px'
        ));


        new Color($row1, 'widget-indicator-track', n2_('Track color'), '', array(
            'alpha' => true
        ));
        new Color($row1, 'widget-indicator-bar', n2_('Bar color'), '', array(
            'alpha' => true
        ));
    }

}Widget/Indicator/IndicatorStripe/IndicatorStripeFrontend.php000064400000004536152355233130020334 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Indicator\IndicatorStripe;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class IndicatorStripeFrontend extends AbstractWidgetFrontend {

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->addToPlacement($this->key . 'position-', array(
            $this,
            'render'
        ));

    }

    public function render($attributes = array()) {

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        if (!$params->get('autoplay', 0)) {
            return '';
        }

        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        Js::addStaticGroup(self::getAssetsPath() . '/dist/w-indicator-stripe.min.js', 'w-indicator-stripe');

        $displayAttributes = $this->getDisplayAttributes($params, $this->key);

        $trackRGBA = Color::colorToRGBA($params->get($this->key . 'track'));
        $barRGBA   = Color::colorToRGBA($params->get($this->key . 'bar'));

        $style = '';

        $width = $params->get($this->key . 'width');
        if (is_numeric($width) || substr($width, -1) == '%' || substr($width, -2) == 'px') {
            $style .= 'width:' . $width . ';';
        }

        $height = intval($params->get($this->key . 'height'));

        $parameters = array(
            'area' => intval($params->get($this->key . 'position-area'))
        );

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetIndicatorStripe(this, ' . json_encode($parameters) . ');');
        $slider->sliderType->addJSDependency('SmartSliderWidgetIndicatorStripe');

        return Html::tag('div', Html::mergeAttributes($attributes, $displayAttributes, array(
            'class' => "nextend-indicator nextend-indicator-stripe n2-ow-all",
            'style' => 'background-color:' . $trackRGBA . ';' . $style
        )), Html::tag('div', array(
            'class' => "nextend-indicator-track",
            'style' => 'height: ' . $height . 'px;background-color:' . $barRGBA . ';'
        ), ''));
    }
}Widget/Indicator/IndicatorPie/IndicatorPie.php000064400000003453152355233130015347 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Indicator\IndicatorPie;

use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
use Nextend\SmartSlider3Pro\Widget\Indicator\AbstractWidgetIndicator;

class IndicatorPie extends AbstractWidgetIndicator {

    protected $defaults = array(
        'widget-indicator-position-mode'   => 'simple',
        'widget-indicator-position-area'   => 4,
        'widget-indicator-position-offset' => 15,
        'widget-indicator-size'            => 25,
        'widget-indicator-thickness'       => 30,
        'widget-indicator-track'           => '000000ab',
        'widget-indicator-bar'             => 'ffffffff'
    );

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'widget-indicator-pie-1');

        new WidgetPosition($row1, 'widget-indicator-position', n2_('Position'));

        new Number($row1, 'widget-indicator-size', n2_('Size'), '', array(
            'wide' => 4,
            'unit' => 'px'
        ));
        new Number($row1, 'widget-indicator-thickness', n2_('Line thickness'), '', array(
            'wide' => 3,
            'unit' => '%'
        ));

        new Color($row1, 'widget-indicator-track', n2_('Track color'), '', array(
            'alpha' => true
        ));
        new Color($row1, 'widget-indicator-bar', n2_('Bar color'), '', array(
            'alpha' => true
        ));

        new Style($row1, 'widget-indicator-style', n2_('Style'), '', array(
            'mode'    => 'button',
            'preview' => 'SmartSliderAdminWidgetIndicatorPie'
        ));
    }
}Widget/Indicator/IndicatorPie/IndicatorPieFrontend.php000064400000004236152355233130017047 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Indicator\IndicatorPie;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;

class IndicatorPieFrontend extends AbstractWidgetFrontend {

    public function __construct($sliderWidget, $widget, $params) {

        parent::__construct($sliderWidget, $widget, $params);

        $this->addToPlacement($this->key . 'position-', array(
            $this,
            'render'
        ));

    }

    public function render($attributes = array()) {

        $slider = $this->slider;
        $id     = $this->slider->elementId;
        $params = $this->params;

        if (!$params->get('autoplay', 0)) {
            return '';
        }

        $slider->addLess(self::getAssetsPath() . '/style.n2less', array(
            "sliderid" => $slider->elementId
        ));

        Js::addStaticGroup(self::getAssetsPath() . '/dist/w-indicator-pie.min.js', 'w-indicator-pie');

        $displayAttributes = $this->getDisplayAttributes($params, $this->key);

        $track      = Color::colorToSVG($params->get($this->key . 'track'));
        $bar        = Color::colorToSVG($params->get($this->key . 'bar'));
        $parameters = array(
            'backstroke'         => $track[0],
            'backstrokeopacity'  => $track[1],
            'frontstroke'        => $bar[0],
            'frontstrokeopacity' => $bar[1],
            'size'               => intval($params->get($this->key . 'size')),
            'thickness'          => $params->get($this->key . 'thickness') / 100
        );

        $styleClass = $slider->addStyle($params->get($this->key . 'style'), 'heading');

        $slider->features->addInitCallback('new _N2.SmartSliderWidgetIndicatorPie(this, ' . json_encode($parameters) . ');');
        $slider->sliderType->addJSDependency('SmartSliderWidgetIndicatorPie');

        return Html::tag('div', Html::mergeAttributes($attributes, $displayAttributes, array(
            'class' => $styleClass . " nextend-indicator nextend-indicator-pie n2-ow-all"
        )));
    }
}Widget/Group/FullScreen.php000064400000004764152355233130011653 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Group;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Group\AbstractWidgetGroup;

class FullScreen extends AbstractWidgetGroup {

    use PluggableTrait;

    public $ordering = 9;

    public function __construct() {
        parent::__construct();

        $this->makePluggable('SliderWidgetFullScreen');
    }

    public function getName() {
        return 'fullscreen';
    }

    public function getLabel() {
        return n2_('Fullscreen');
    }

    public function renderFields($container) {

        $form = $container->getForm();

        $this->compatibility($form);

        /**
         * Used for field removal: /controls/widget-fullscreen
         */
        $table = new ContainerTable($container, 'widget-fullscreen', n2_('Fullscreen'));

        new OnOff($table->getFieldsetLabel(), 'widget-fullscreen-enabled', false, 0, array(
            'relatedFieldsOn' => array(
                'table-rows-widget-fullscreen'
            )
        ));

        $fullscreenWarning = $table->createRow('widget-fullscreen-warning');
        $warningText       = sprintf(n2_('%1$s does not support the full screen API. For this reason the full screen button will not appear on %1$s devices.'), 'iPhone');
        new Warning($fullscreenWarning, 'widget-fullscreen-warning-iphone', $warningText);

        $row1 = $table->createRow('widget-fullscreen-1');

        $url = $form->createAjaxUrl(array("slider/renderwidgetfullscreen"));
        new ControlTypePicker($row1, 'widgetfullscreen', $table, $url, $this, 'image');


        $row2 = $table->createRow('widget-fullscreen-2');

        new OnOff($row2, 'widget-fullscreen-display-hover', n2_('Shows on hover'), 0);

        $this->addHideOnFeature('widget-fullscreen-display-', $row2);

        new Text($row2, 'widget-fullscreen-exclude-slides', n2_('Hide on slides'), '', array(
            'tipLabel'       => n2_('Hide on slides'),
            'tipDescription' => n2_('List the slides separated by commas on which you want the controls to be hidden.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1859-fullscreen#hide-on-slides'
        ));
    }
}Widget/Group/Html.php000064400000003714152355233130010507 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Group;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Group\AbstractWidgetGroup;

class Html extends AbstractWidgetGroup {

    use PluggableTrait;

    public $ordering = 10;

    protected $showOnMobileDefault = 1;

    public function __construct() {
        parent::__construct();

        $this->makePluggable('SliderWidgetHtml');
    }

    public function getName() {
        return 'html';
    }

    public function getLabel() {
        return 'HTML';
    }

    public function renderFields($container) {

        $form = $container->getForm();

        $this->compatibility($form);

        $table = new ContainerTable($container, 'widget-html', 'HTML');

        new OnOff($table->getFieldsetLabel(), 'widget-html-enabled', false, 0, array(
            'relatedFieldsOn' => array(
                'table-rows-widget-html'
            )
        ));


        $row1 = $table->createRow('widget-html-1');

        $url = $form->createAjaxUrl(array("slider/renderwidgethtml"));
        new ControlTypePicker($row1, 'widgethtml', $table, $url, $this, 'html');


        $row2 = $table->createRow('widget-html-2');
        new OnOff($row2, 'widget-html-display-hover', n2_('Shows on hover'), 0);

        $this->addHideOnFeature('widget-html-display-', $row2);

        new Text($row2, 'widget-html-exclude-slides', n2_('Hide on slides'), '', array(
            'tipLabel'       => n2_('Hide on slides'),
            'tipDescription' => n2_('List the slides separated by commas on which you want the controls to be hidden.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1860-html#hide-on-slides'
        ));
    }
}Widget/Group/Indicator.php000064400000004006152355233130011512 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Widget\Group;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Group\AbstractWidgetGroup;

class Indicator extends AbstractWidgetGroup {

    use PluggableTrait;

    public $ordering = 4;

    public function __construct() {
        parent::__construct();

        $this->makePluggable('SliderWidgetIndicator');
    }

    public function getName() {
        return 'indicator';
    }

    public function getLabel() {
        return n2_('Indicator');
    }

    public function renderFields($container) {

        $form = $container->getForm();

        $this->compatibility($form);

        $table = new ContainerTable($container, 'widget-indicator', n2_('Indicator'));

        new OnOff($table->getFieldsetLabel(), 'widget-indicator-enabled', false, 0, array(
            'relatedFieldsOn' => array(
                'table-rows-widget-indicator'
            )
        ));

        $row1 = $table->createRow('widget-indicator-1');

        $url = $form->createAjaxUrl(array("slider/renderwidgetindicator"));
        new ControlTypePicker($row1, 'widgetindicator', $table, $url, $this);


        $row2 = $table->createRow('widget-indicator-2');

        new OnOff($row2, 'widget-indicator-display-hover', n2_('Shows on hover'), 0);

        $this->addHideOnFeature('widget-indicator-display-', $row2);

        new Text($row2, 'widget-indicator-exclude-slides', n2_('Hide on slides'), '', array(
            'tipLabel'       => n2_('Hide on slides'),
            'tipDescription' => n2_('List the slides separated by commas on which you want the controls to be hidden.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1807-slider-settings-autoplay#hide-on-slides-35'
        ));
    }
}SplitText/ModelSplitText.php000064400000015554152355233130012152 0ustar00<?php


namespace Nextend\SmartSlider3Pro\SplitText;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField;
use Nextend\Framework\Form\Element\Radio;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Easing;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Fieldset\FieldsetVisualSet;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Visual\ModelVisual;

class ModelSplitText extends ModelVisual {

    protected $type = 'splittextanimation';

    protected function init() {

        SplitTextStorage::getInstance();

        $this->storage = StorageSectionManager::getStorage('smartslider');
    }

    public function renderSetsForm() {

        $form = new Form($this, $this->type . 'set');
        $form->addClass('n2_fullscreen_editor__content_sidebar_top_bar');
        $form->setDark();

        $setsTab = new FieldsetVisualSet($form->getContainer(), 'splittextanimation-sets', n2_('Sets'));
        new Select($setsTab, 'sets', false, '');

        $form->render();
    }

    public function renderForm() {
        $form = new Form($this, 'n2-splittextanimation-editor');

        $table = new ContainerTable($form->getContainer(), 'splittextanimation-table', n2_('Text animation settings'));

        $table->setFieldsetPositionEnd();

        $firstRow = $table->createRow('firstrow');

        new Radio($firstRow, 'mode', n2_('Mode'), 'chars', array(
            'options' => array(
                'chars' => n2_('Chars'),
                'words' => n2_('Words')
            )
        ));

        new Select($firstRow, 'sort', n2_('Sort'), 'normal', array(
            'options' => array(
                'normal'        => n2_('Normal'),
                'reversed'      => n2_('Reversed'),
                'random'        => n2_('Random'),
                'side'          => n2_('Side'),
                'sideShifted'   => n2_('Side shifted'),
                'center'        => n2_('Center'),
                'centerShifted' => n2_('Center shifted')
            )
        ));

        new NumberAutoComplete($firstRow, 'duration', n2_('Duration'), 800, array(
            'style'  => 'width:40px;',
            'min'    => 0,
            'values' => array(
                500,
                800,
                1000,
                1500,
                2000
            ),
            'unit'   => 'ms'
        ));

        new NumberAutoComplete($firstRow, 'stagger', n2_('Stagger'), 50, array(
            'style'  => 'width:40px;',
            'values' => array(
                25,
                50,
                100,
                200,
                400
            ),
            'unit'   => 'ms'
        ));

        new Easing($firstRow, 'easing', n2_('Easing'), 'easeOutCubic');

        $transformOrigin = new MixedField($firstRow, 'transformorigin', n2_('Transform origin'), '50|*|50|*|0');

        new NumberAutoComplete($transformOrigin, 'transformorigin-1', false, '', array(
            'sublabel' => 'X',
            'values'   => array(
                0,
                50,
                100
            ),
            'unit'     => '%',
            'wide'     => 4
        ));

        new NumberAutoComplete($transformOrigin, 'transformorigin-2', false, '', array(
            'sublabel' => 'Y',
            'values'   => array(
                0,
                50,
                100
            ),
            'unit'     => '%',
            'wide'     => 4
        ));

        new Number($transformOrigin, 'transformorigin-3', false, '', array(
            'sublabel' => 'Z',
            'unit'     => 'px',
            'wide'     => 4
        ));

        $secondRow = $table->createRow('thirdrow');

        new NumberSlider($secondRow, 'opacity', n2_('Opacity'), 100, array(
            'style' => 'width:22px;',
            'min'   => 0,
            'max'   => 100,
            'unit'  => '%'
        ));

        new NumberAutoComplete($secondRow, 'scale', n2_('Scale'), 100, array(
            'style'  => 'width:40px;',
            'min'    => 0,
            'max'    => 9999,
            'values' => array(
                0,
                50,
                100,
                150,
                1000
            ),
            'unit'   => '%'
        ));

        $offset = new MixedField($secondRow, 'offset', n2_('Offset'), '0|*|0');

        new NumberAutoComplete($offset, 'offset-1', false, '', array(
            'style'    => 'width:40px;',
            'sublabel' => 'X',
            'values'   => array(
                -400,
                -200,
                -100,
                0,
                100,
                200,
                400
            ),
            'unit'     => 'px'
        ));

        new NumberAutoComplete($offset, 'offset-2', false, '', array(
            'style'    => 'width:40px;',
            'sublabel' => 'Y',
            'values'   => array(
                -400,
                -200,
                -100,
                0,
                100,
                200,
                400
            ),
            'unit'     => 'px'
        ));

        $rotate = new MixedField($secondRow, 'rotate', n2_('Rotate'), '0|*|0|*|0');

        new NumberAutoComplete($rotate, 'rotate-1', false, '', array(
            'style'    => 'width:40px;',
            'sublabel' => 'X',
            'values'   => array(
                0,
                90,
                180,
                -90,
                -180
            ),
            'unit'     => '°'
        ));

        new NumberAutoComplete($rotate, 'rotate-2', false, '', array(
            'style'    => 'width:40px;',
            'sublabel' => 'Y',
            'values'   => array(
                0,
                90,
                180,
                -90,
                -180
            ),
            'unit'     => '°'
        ));

        new NumberAutoComplete($rotate, 'rotate-3', false, '', array(
            'style'    => 'width:40px;',
            'sublabel' => 'Z',
            'values'   => array(
                0,
                90,
                180,
                -90,
                -180
            ),
            'unit'     => '°'
        ));

        $previewTable = new ContainerTable($form->getContainer(), 'splittextanimation-preview', n2_('Preview'));

        $previewTable->setFieldsetPositionEnd();

        new Color($previewTable->getFieldsetLabel(), 'preview-background', false, 'ced3d5');

        $form->render();
    }
}SplitText/SplitTextManager.php000064400000000700152355233130012447 0ustar00<?php

namespace Nextend\SmartSlider3Pro\SplitText;

use Nextend\Framework\Pattern\VisualManagerTrait;
use Nextend\SmartSlider3Pro\SplitText\Block\SplitTextManager\BlockSplitTextManager;

class SplitTextManager {

    use VisualManagerTrait;

    public function display() {

        $postBackgroundAnimationManagerBlock = new BlockSplitTextManager($this->MVCHelper);
        $postBackgroundAnimationManagerBlock->display();
    }
}SplitText/SplitTextRenderer.php000064400000024201152355233130012645 0ustar00<?php

namespace Nextend\SmartSlider3Pro\SplitText;

use Nextend\Framework\Asset\Css\Css;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Model\Section;
use Nextend\Framework\Settings;

class SplitTextRenderer {

    public static $pre = '';
    public static $sets = array();
    public static $animations = array();

    /**
     * @var Animation
     */
    public static $animation;

    public static $mode;

    public static function preLoad($animationId) {
        if (intval($animationId) > 0) {
            $animation = Section::getById($animationId, 'animation');
            if ($animation) {
                self::$sets[] = $animation['referencekey'];
            }
        }
    }

    public static function render($animation, $mode, $group, $pre = '') {

        $cssData = self::_render($animation, $mode, $pre);
        if ($cssData) {
            Css::addCode($cssData[1], $group);

            return $cssData[0];
        }

        return '';
    }

    public static function _render($animation, $mode, $pre = '') {
        self::$pre = $pre;
        if (intval($animation) > 0) {
            // Linked
            $animation = Section::getById($animation, 'animation');
            if ($animation) {
                if (is_string($animation['value'])) {

                    $decoded = $animation['value'];
                    if ($decoded[0] != '{') {
                        $decoded = Base64::decode($decoded);
                    }

                    $value = json_decode($decoded, true);
                } else {
                    $value = $animation['value'];
                }
                $selector = 'n2-animation-' . $animation['id'] . '-' . $mode;

                self::$sets[] = $animation['referencekey'];

                if (!isset(self::$animations[$animation['id']])) {
                    self::$animations[$animation['id']] = array(
                        $mode
                    );
                } else if (!in_array($mode, self::$animations[$animation['id']])) {
                    self::$animations[$animation['id']][] = $mode;
                }

                return array(
                    $selector . ' ',
                    self::renderStyle($mode, $pre, $selector, $value['data'])
                );
            }
        } else if ($animation != '') {
            $decoded = $animation;
            if ($decoded[0] != '{') {
                $decoded = Base64::decode($decoded);
            } else {
                $animation = Base64::encode($decoded);
            }

            $value = json_decode($decoded, true);
            if ($value) {
                $selector = 'n2-animation-' . md5($animation) . '-' . $mode;

                return array(
                    $selector . ' ',
                    self::renderStyle($mode, $pre, $selector, $value['data'])
                );
            }
        }

        return false;
    }

    private static function renderStyle($mode, $pre, $selector, $tabs) {
        $search  = array(
            '@pre',
            '@selector'
        );
        $replace = array(
            $pre,
            '.' . $selector
        );
        $tabs[0] = array_merge(array(
            'backgroundcolor' => 'ffffff00',
            'opacity'         => 100,
            'padding'         => '0|*|0|*|0|*|0|*|px',
            'boxshadow'       => '0|*|0|*|0|*|0|*|000000ff',
            'border'          => '0|*|solid|*|000000ff',
            'borderradius'    => '0',
            'extra'           => '',
        ), $tabs[0]);
        foreach ($tabs as $k => $tab) {
            $search[]  = '@tab' . $k;
            $replace[] = self::$animation->animation($tab);
        }

        $template = '';
        foreach (self::$mode[$mode]['selectors'] as $s => $animation) {
            if (!in_array($animation, $search) || !empty($replace[array_search($animation, $search)])) {
                $template .= $s . "{" . $animation . "}";
            }
        }

        return str_replace($search, $replace, $template);
    }
}


$frontendAccessibility = intval(Settings::get('frontend-accessibility', 1));

SplitTextRenderer::$mode = array(
    '0'              => array(
        'id'            => '0',
        'label'         => n2_('Single'),
        'tabs'          => array(
            n2_('Text')
        ),
        'renderOptions' => array(
            'combined' => false
        ),
        'preview'       => '<div class="{styleClassName}">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>',
        'selectors'     => array(
            '@pre@selector' => '@tab'
        )
    ),
    'simple'         => array(
        'id'            => 'simple',
        'label'         => n2_('Simple'),
        'tabs'          => array(
            n2_('Normal')
        ),
        'renderOptions' => array(
            'combined' => true
        ),
        'preview'       => '<div class="{styleClassName}" style="width: 200px; height:100px;"></div>',
        'selectors'     => array(
            '@pre@selector' => '@tab0'
        )
    ),
    'box'            => array(
        'id'            => 'box',
        'label'         => n2_('Box'),
        'tabs'          => array(
            n2_('Normal'),
            n2_('Hover')
        ),
        'renderOptions' => array(
            'combined' => true
        ),
        'preview'       => '<div class="{styleClassName}" style="width: 200px; height:100px;"></div>',
        'selectors'     => array(
            '@pre@selector'       => '@tab0',
            '@pre@selector:HOVER' => '@tab1'
        )
    ),
    'button'         => array(
        'id'            => 'button',
        'label'         => n2_('Button'),
        'tabs'          => array(
            n2_('Normal'),
            n2_('Hover')
        ),
        'renderOptions' => array(
            'combined' => true
        ),
        'preview'       => '<div><a style="display:inline-block; margin:20px;" class="{styleClassName}" href="#" onclick="return false;">Button</a></div>',
        'selectors'     => $frontendAccessibility ? array(
            '@pre@selector'                                                  => '@tab0',
            '@pre@selector:Hover, @pre@selector:ACTIVE, @pre@selector:FOCUS' => '@tab1'
        ) : array(
            '@pre@selector, @pre@selector:FOCUS'        => '@tab0',
            '@pre@selector:Hover, @pre@selector:ACTIVE' => '@tab1'
        )
    ),
    'heading'        => array(
        'id'            => 'heading',
        'label'         => n2_('Heading'),
        'tabs'          => array(
            n2_('Normal'),
            n2_('Hover')
        ),
        'renderOptions' => array(
            'combined' => true
        ),
        'preview'       => '<div class="{styleClassName}">Heading</div>',
        'selectors'     => $frontendAccessibility ? array(
            '@pre@selector'                                                  => '@tab0',
            '@pre@selector:Hover, @pre@selector:ACTIVE, @pre@selector:FOCUS' => '@tab1'
        ) : array(
            '@pre@selector, @pre@selector:FOCUS'        => '@tab0',
            '@pre@selector:Hover, @pre@selector:ACTIVE' => '@tab1'
        )
    ),
    'heading-active' => array(
        'id'            => 'heading-active',
        'label'         => n2_('Heading active'),
        'tabs'          => array(
            n2_('Normal'),
            n2_('Active')
        ),
        'renderOptions' => array(
            'combined' => true
        ),
        'preview'       => '<div class="{styleClassName}">Heading</div>',
        'selectors'     => array(
            '@pre@selector'           => '@tab0',
            '@pre@selector.n2-active' => '@tab1'
        )
    ),
    'dot'            => array(
        'id'            => 'dot',
        'label'         => n2_('Dot'),
        'tabs'          => array(
            n2_('Normal'),
            n2_('Active')
        ),
        'renderOptions' => array(
            'combined' => true
        ),
        'preview'       => '<div><div class="{styleClassName}" style="display: inline-block; margin: 3px;"></div><div class="{styleClassName} n2-active" style="display: inline-block; margin: 3px;"></div><div class="{styleClassName}" style="display: inline-block; margin: 3px;"></div></div>',
        'selectors'     => array(
            '@pre@selector'                                => '@tab0',
            '@pre@selector.n2-active, @pre@selector:HOVER' => '@tab1'
        )
    ),
    'highlight'      => array(
        'id'            => 'highlight',
        'label'         => n2_('Highlight'),
        'tabs'          => array(
            n2_('Normal'),
            n2_('Highlight'),
            n2_('Hover')
        ),
        'renderOptions' => array(
            'combined' => true
        ),
        'preview'       => '<div class="{fontClassName}">' . n2_('Button') . '</div>',
        'selectors'     => $frontendAccessibility ? array(
            '@pre@selector'                                                                                                  => '@tab0',
            '@pre@selector .n2-highlighted'                                                                                  => '@tab1',
            '@pre@selector .n2-highlighted:HOVER, @pre@selector .n2-highlighted:ACTIVE, @pre@selector .n2-highlighted:FOCUS' => '@tab2'
        ) : array(
            '@pre@selector'                                                             => '@tab0',
            '@pre@selector .n2-highlighted, @pre@selector .n2-highlighted:FOCUS'        => '@tab1',
            '@pre@selector .n2-highlighted:HOVER, @pre@selector .n2-highlighted:ACTIVE' => '@tab2'
        )
    ),
);SplitText/SplitTextStorage.php000064400000005140152355233130012504 0ustar00<?php


namespace Nextend\SmartSlider3Pro\SplitText;


use Nextend\Framework\Pattern\SingletonTrait;
use Nextend\Framework\Plugin;

class SplitTextStorage {

    use SingletonTrait;

    private $sets = array();

    private $animation = array();

    private $animationBySet = array();

    private $animationById = array();

    protected function init() {
        Plugin::addAction('smartslidersplittextanimationset', array(
            $this,
            'animationSet'
        ));
        Plugin::addAction('smartslidersplittextanimation', array(
            $this,
            'animations'
        ));
        Plugin::addAction('splittextanimation', array(
            $this,
            'animation'
        ));
    }

    private function load() {
        static $loaded;
        if (!$loaded) {
            Plugin::doAction('splitTextAnimationStorage', array(
                &$this->sets,
                &$this->animation
            ));

            for ($i = 0; $i < count($this->animation); $i++) {
                if (!isset($this->animationBySet[$this->animation[$i]['referencekey']])) {
                    $this->animationBySet[$this->animation[$i]['referencekey']] = array();
                }
                $this->animationBySet[$this->animation[$i]['referencekey']][] = &$this->animation[$i];
                $this->animationById[$this->animation[$i]['id']]              = &$this->animation[$i];
            }
            $loaded = true;
        }
    }

    public function animationSet($referenceKey, &$sets) {
        $this->load();

        for ($i = count($this->sets) - 1; $i >= 0; $i--) {
            $this->sets[$i]['isSystem'] = 1;
            $this->sets[$i]['editable'] = 0;
            array_unshift($sets, $this->sets[$i]);
        }

    }

    public function animations($referenceKey, &$animation) {
        $this->load();

        if (isset($this->animationBySet[$referenceKey])) {
            $_animation = &$this->animationBySet[$referenceKey];
            for ($i = count($_animation) - 1; $i >= 0; $i--) {
                $_animation[$i]['isSystem'] = 1;
                $_animation[$i]['editable'] = 0;
                array_unshift($animation, $_animation[$i]);
            }

        }
    }

    public function animation($id, &$animation) {
        $this->load();

        if (isset($this->animationById[$id])) {
            $this->animationById[$id]['isSystem'] = 1;
            $this->animationById[$id]['editable'] = 0;
            $animation                            = $this->animationById[$id];
        }
    }
}SplitText/Block/SplitTextManager/BlockSplitTextManager.php000064400000004054152355233130017715 0ustar00<?php


namespace Nextend\SmartSlider3Pro\SplitText\Block\SplitTextManager;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Visual\AbstractBlockVisual;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonCancel;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonSave;
use Nextend\SmartSlider3Pro\SplitText\ModelSplitText;
use Nextend\SmartSlider3Pro\SplitText\SplitTextRenderer;

class BlockSplitTextManager extends AbstractBlockVisual {

    /** @var ModelSplitText */
    protected $model;

    /**
     * @return ModelSplitText
     */
    public function getModel() {
        return $this->model;
    }

    public function display() {

        $this->model = new ModelSplitText($this);

        $this->renderTemplatePart('Index');
    }

    public function displayTopBar() {

        $buttonCancel = new BlockButtonCancel($this);
        $buttonCancel->addClass('n2_fullscreen_editor__cancel');
        $buttonCancel->display();

        $buttonApply = new BlockButtonSave($this);
        $buttonApply->setLabel(n2_('Apply'));
        $buttonApply->addClass('n2_fullscreen_editor__save');
        $buttonApply->display();
    }

    public function displaySidebar() {

        $this->renderTemplatePart('Sidebar');
    }

    public function displayContent() {

        $model = $this->getModel();


        $sets = $model->getSets();

        SplitTextRenderer::$sets[] = $sets[0]['id'];

        $animations = array();
        foreach (array_unique(SplitTextRenderer::$sets) as $setId) {
            $animations[$setId] = $model->getVisuals($setId);
        }

        Js::addFirstCode("
            new _N2.NextendSplitTextAnimationManager({
                fixedSet: 1000,
                sets: " . json_encode($sets) . ",
                visuals: " . json_encode($animations) . ",
                ajaxUrl: '" . $this->createAjaxUrl(array('splittextanimation/index')) . "'
            });
        ");

        $model->renderForm();
    }
}SplitText/Block/SplitTextManager/Index.php000064400000002032152355233130014550 0ustar00<?php

namespace Nextend\SmartSlider3Pro\SplitText\Block\SplitTextManager;

/**
 * @var BlockSplitTextManager $this
 */
?>
<div id="n2-lightbox-splittextanimation" class="n2_fullscreen_editor">
    <div class="n2_fullscreen_editor__overlay"></div>
    <div class="n2_fullscreen_editor__window">
        <div class="n2_fullscreen_editor__nav_bar">
            <div class="n2_fullscreen_editor__nav_bar_label">
                <?php n2_e('Text animation'); ?>
            </div>
            <div class="n2_fullscreen_editor__nav_bar_actions">
                <?php $this->displayTopBar(); ?>
            </div>
        </div>
        <div class="n2_fullscreen_editor__content">
            <div class="n2_fullscreen_editor__content_sidebar n2_container_scrollable">
                <?php $this->displaySidebar(); ?>
            </div>
            <div class="n2_fullscreen_editor__content_content n2_container_scrollable">
                <?php $this->displayContent(); ?>
            </div>
        </div>
    </div>
</div>SplitText/Block/SplitTextManager/Sidebar.php000064400000000767152355233130015067 0ustar00<?php

namespace Nextend\SmartSlider3Pro\SplitText\Block\SplitTextManager;

use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonSave;

/**
 * @var BlockSplitTextManager $this
 */
?>

<div class="n2_fullscreen_editor__save_as_new_container">
    <?php
    $saveAsNew = new BlockButtonSave($this);
    $saveAsNew->addClass('n2_fullscreen_editor__save_as_new');
    $saveAsNew->setLabel(n2_('Save as new animation'));
    $saveAsNew->display();
    ?>
</div>
Slider/ResponsiveTypeLoader.php000064400000001124152355233130012625 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider;


use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Slider\ResponsiveType\ResponsiveTypeFactory;
use Nextend\SmartSlider3Pro\Slider\ResponsiveType\FullPage\ResponsiveTypeFullPage;

class ResponsiveTypeLoader {

    public function __construct() {

        Plugin::addAction('PluggableFactorySliderResponsiveType', array(
            $this,
            'sliderResponsiveTypes'
        ));
    }

    public function sliderResponsiveTypes() {
        ResponsiveTypeFactory::addType(new ResponsiveTypeFullPage());
    }
}Slider/SliderTypeLoader.php000064400000001447152355233130011722 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider;


use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Slider\SliderType\SliderTypeFactory;
use Nextend\SmartSlider3Pro\Slider\SliderType\Carousel\SliderTypeCarousel;
use Nextend\SmartSlider3Pro\Slider\SliderType\Group\SliderTypeGroup;
use Nextend\SmartSlider3Pro\Slider\SliderType\Showcase\SliderTypeShowcase;

class SliderTypeLoader {

    public function __construct() {

        Plugin::addAction('PluggableFactorySliderType', array(
            $this,
            'sliderTypes'
        ));
    }

    public function sliderTypes() {
        SliderTypeFactory::addType(new SliderTypeGroup());
        SliderTypeFactory::addType(new SliderTypeShowcase());
        SliderTypeFactory::addType(new SliderTypeCarousel());
    }
}Slider/ResponsiveType/FullPage/ResponsiveTypeFullPage.php000064400000001022152355233130017611 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Slider\ResponsiveType\FullPage;

use Nextend\SmartSlider3\Slider\ResponsiveType\AbstractResponsiveType;

class ResponsiveTypeFullPage extends AbstractResponsiveType {


    public function getName() {
        return 'fullpage';
    }

    public function createFrontend($responsive) {

        return new ResponsiveTypeFullPageFrontend($this, $responsive);
    }

    public function createAdmin() {

        return new ResponsiveTypeFullPageAdmin($this);
    }


}Slider/ResponsiveType/FullPage/ResponsiveTypeFullPageAdmin.php000064400000012172152355233130020572 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Slider\ResponsiveType\FullPage;

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\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Slider\ResponsiveType\AbstractResponsiveTypeAdmin;

class ResponsiveTypeFullPageAdmin extends AbstractResponsiveTypeAdmin {

    protected $ordering = 3;

    public function getLabel() {

        return n2_('Full page');
    }

    public function getIcon() {
        return 'ssi_64 ssi_64--stretch';
    }

    public function renderFields($container) {

        $row1 = new FieldsetRow($container, 'responsive-fullpage-1');

        new OnOff($row1, 'responsiveForceFull', n2_('Force full width'), 1, array(
            'tipLabel'       => n2_('Force full width'),
            'tipDescription' => n2_('The slider tries to fill the full width of the browser.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1777-fullpage-layout#force-full-width'
        ));

        new Select($row1, 'responsiveForceFullOverflowX', n2_('Overflow-X'), 'body', array(
            'options'        => array(
                'body' => 'body',
                'html' => 'html',
                'none' => n2_('None')
            ),
            'tipLabel'       => n2_('Overflow-X'),
            'tipDescription' => n2_('Prevents the vertical scrollbar from appear during certain slide background animations.')
        ));

        new Text($row1, 'responsiveForceFullHorizontalSelector', n2_('Adjust slider width to'), 'body', array(
            'tipLabel'       => n2_('Adjust slider width to'),
            'tipDescription' => n2_('You can make the slider fill up a selected parent element instead of the full browser width.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1777-fullpage-layout#adjust-slider-width-to'
        ));
        new OnOff($row1, 'responsiveConstrainRatio', n2_('Constrain ratio'), 0, array(
            'tipLabel'       => n2_('Constrain ratio'),
            'tipDescription' => n2_('The slide scales horizontally and vertically with the same amount.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1777-fullpage-layout#constrain-ratio'
        ));

        $row2 = new FieldsetRow($container, 'responsive-fullpage-2');

        new Select($row2, 'sliderHeightBasedOn', n2_('Height based on'), 'real', array(
            'options'        => array(
                'real'  => 'Real height',
                '100vh' => 'CSS 100vh'
            ),
            'tipLabel'       => n2_('Height based on'),
            'tipDescription' => n2_('The real height makes your slider have the height of the browser without the URL bar, while the CSS 100vh makes it exactly as big as the browser height.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1777-fullpage-layout#height-based-on'
        ));

        $form = $container->getForm();
        if (!$form->has('responsive-focus') && $form->has('responsiveHeightOffset')) {
            $old = $form->get('responsiveHeightOffset');

            $oldDefault = '';

            if ($old !== $oldDefault) {
                $form->set('responsive-focus', 1);
                $form->set('responsive-focus-top', $old);
            }
        }


        new Number($row2, 'responsiveDecreaseSliderHeight', n2_('Decrease height'), 0, array(
            'unit'           => 'px',
            'wide'           => 4,
            'tipLabel'       => n2_('Decrease height'),
            'tipDescription' => n2_('You can make your slider smaller than the full height of the browser by a given pixel, for example, to fit below your menu without causing scrollbar.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1777-fullpage-layout#decrease-height-by-selectors'
        ));

        new Select($row2, 'responsive-focus', n2_('Decrease height by selectors'), 0, array(
            'options'        => array(
                0 => n2_('Use global focus selectors'),
                1 => n2_('Use local selectors')
            ),
            'relatedFields'  => array(
                'sliderresponsive-focus-top',
                'sliderresponsive-focus-bottom'
            ),
            'tipLabel'       => n2_('Decrease height by selectors'),
            'tipDescription' => n2_('You can make your slider smaller than the full height of the browser, for example, to fit below your menu without causing scrollbar.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1777-fullpage-layout#decrease-height-by-selectors'
        ));
        new Text($row2, 'responsive-focus-top', n2_('Top') . ' - ' . n2_('CSS selector (sum of heights)'), '', array(
            'style' => 'width:400px;'
        ));
        new Text($row2, 'responsive-focus-bottom', n2_('Bottom') . ' - ' . n2_('CSS selector (sum of heights)'), '', array(
            'style' => 'width:400px;'
        ));
    }
}Slider/ResponsiveType/FullPage/ResponsiveTypeFullPageFrontend.php000064400000002044152355233130021316 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Slider\ResponsiveType\FullPage;

use Nextend\SmartSlider3\Slider\ResponsiveType\AbstractResponsiveTypeFrontend;

class ResponsiveTypeFullPageFrontend extends AbstractResponsiveTypeFrontend {

    public function parse($params, $responsive, $features) {

        $features->align->align = 'normal';

        $responsive->forceFull          = intval($params->get('responsiveForceFull', 1));
        $responsive->forceFullOverflowX = $params->get('responsiveForceFullOverflowX', 'body');

        $responsive->forceFullHorizontalSelector = $params->get('responsiveForceFullHorizontalSelector', 'body');

        $responsive->sliderHeightBasedOn            = $params->get('sliderHeightBasedOn', 'real');
        $responsive->responsiveDecreaseSliderHeight = intval($params->get('responsiveDecreaseSliderHeight', 0));

        if (intval($params->get('responsiveConstrainRatio', 0))) {
            $this->responsive->slider->sliderType->addClass('n2-ss-full-page--constrain-ratio');
        }
    }
}Slider/SliderType/Showcase/SliderTypeShowcase.php000064400000001560152355233130016124 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Showcase;


use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderType;

class SliderTypeShowcase extends AbstractSliderType {

    public function getName() {
        return 'showcase';
    }

    public function createFrontend($slider) {
        return new SliderTypeShowcaseFrontend($slider);
    }

    public function createCss($slider) {
        return new SliderTypeShowcaseCss($slider);
    }


    public function createAdmin() {
        return new SliderTypeShowcaseAdmin($this);
    }

    public function export($export, $slider) {
        $export->addImage($slider['params']->get('background', ''));
    }

    public function import($import, $slider) {

        $slider['params']->set('background', $import->fixImage($slider['params']->get('background', '')));
    }
}Slider/SliderType/Showcase/SliderTypeShowcaseAdmin.php000064400000067533152355233130017111 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Showcase;


use Nextend\Framework\Form\Container\ContainerRowGroup;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MarginPadding;
use Nextend\Framework\Form\Element\MixedField;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Radio;
use Nextend\Framework\Form\Element\Select\Easing;
use Nextend\Framework\Form\Element\Select\Skin;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\Framework\Form\Insert\InsertAfter;
use Nextend\Framework\Form\Insert\InsertBefore;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeAdmin;

class SliderTypeShowcaseAdmin extends AbstractSliderTypeAdmin {

    protected $ordering = 4;

    public function getLabel() {
        return n2_('Showcase');
    }

    public function getLabelFull() {
        return n2_x('Showcase slider', 'Slider type');
    }

    public function getIcon() {
        return 'ssi_64 ssi_64--showcase';
    }

    public function prepareForm($form) {

        $tableSlideSize = new ContainerTable(new InsertAfter($form->getElement('/size/size')), 'slider-type-showcase-settings-size', n2_('Slide size'));

        $rowSettingsSlide = new FieldsetRow($tableSlideSize, 'slider-type-showcase-settings-slide-size');

        new NumberAutoComplete($rowSettingsSlide, 'slide-width', n2_('Slide width'), 600, array(
            'values' => array(
                400,
                600,
                800,
                1000
            ),
            'unit'   => 'px',
            'wide'   => 5
        ));
        new NumberAutoComplete($rowSettingsSlide, 'slide-height', n2_('Slide height'), 400, array(
            'values' => array(
                300,
                400,
                600,
                800,
                1000
            ),
            'unit'   => 'px',
            'wide'   => 5,
            'post'   => 'break'
        ));

        new NumberAutoComplete($rowSettingsSlide, 'slide-distance', n2_('Slide distance'), 60, array(
            'values'         => array(
                0,
                60,
                150
            ),
            'unit'           => 'px',
            'wide'           => 3,
            'tipLabel'       => n2_('Slide distance'),
            'tipDescription' => n2_('Fix space between the slides.')
        ));

        $rowGroupSlides = new ContainerRowGroup(new InsertAfter($form->getElement('/slides/slides-design/slides-design-1')), 'slider-type-showcase-group-slides', false);

        $rowSettingsSlideDisplay = new FieldsetRow($rowGroupSlides, 'slider-type-showcase-settings-slide-display');

        new Number($rowSettingsSlideDisplay, 'slide-border-width', n2_('Slide border width'), 0, array(
            'unit'          => 'px',
            'wide'          => 3,
            'relatedFields' => array('sliderslide-border-color')
        ));
        new Color($rowSettingsSlideDisplay, 'slide-border-color', n2_('Slide border color'), '3E3E3Eff', array(
            'alpha' => true
        ));
        new Number($rowSettingsSlideDisplay, 'slide-border-radius', n2_('Slide border radius'), 0, array(
            'unit' => 'px',
            'wide' => 3,
            'post' => 'break'
        ));

        $rowGroupGeneral = new ContainerRowGroup(new InsertAfter($form->getElement('/general/design/design-1')), 'slider-type-showcase-group-general', false);

        $rowSettingsSlider = new FieldsetRow($rowGroupGeneral, 'slider-type-showcase-settings-slider');

        new Number($rowSettingsSlider, 'border-width', n2_('Slider border width'), 0, array(
            'unit'          => 'px',
            'wide'          => 3,
            'relatedFields' => array('sliderborder-color')
        ));
        new Color($rowSettingsSlider, 'border-color', n2_('Slider border color'), '3E3E3Eff', array(
            'alpha' => true
        ));
        new Number($rowSettingsSlider, 'border-radius', n2_('Slider border radius'), 0, array(
            'unit' => 'px',
            'wide' => 3,
            'post' => 'break'
        ));

        $spaceGroup = new ContainerRowGroup(new InsertAfter($rowGroupGeneral), 'slider-type-carousel-space', n2_('Side spacing'));

        $rowSpaceDesktop = $spaceGroup->createRow('slider-type-carousel-space-desktop');

        new OnOff($rowSpaceDesktop, 'side-spacing-desktop-enable', n2_('Desktop'), 1, array(
            'relatedFieldsOn' => array(
                'sliderside-spacing-desktop'
            ),
            'tipLabel'        => n2_('Desktop side spacing'),
            'tipDescription'  => n2_('You can create a fix distance between the slider and the slides where your controls are which appear on this device. This way your controls won\'t cover the slide content.')
        ));

        $sideSpacingDesktop = new MarginPadding($rowSpaceDesktop, 'side-spacing-desktop', n2_('Side spacing'), '0|*|20|*|0|*|20', array(
            'unit' => 'px'
        ));
        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($sideSpacingDesktop, 'side-spacing-desktop-' . $i, false, '', array(
                'values' => array(
                    0,
                    20,
                    40,
                    80
                ),
                'wide'   => 3
            ));
        }


        new OnOff($rowSpaceDesktop, 'side-spacing-tablet-enable', n2_('Tablet'), 0, array(
            'relatedFieldsOn' => array(
                'sliderside-spacing-tablet'
            ),
            'tipLabel'        => n2_('Tablet side spacing'),
            'tipDescription'  => n2_('You can create a fix distance between the slider and the slides where your controls are which appear on this device. This way your controls won\'t cover the slide content.')
        ));

        $sideSpacingTablet = new MarginPadding($rowSpaceDesktop, 'side-spacing-tablet', n2_('Side spacing'), '0|*|0|*|0|*|0', array(
            'unit' => 'px'
        ));
        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($sideSpacingTablet, 'side-spacing-tablet-' . $i, false, '', array(
                'values' => array(
                    0,
                    20,
                    40,
                    80
                ),
                'wide'   => 3
            ));
        }


        new OnOff($rowSpaceDesktop, 'side-spacing-mobile-enable', n2_('Mobile'), 0, array(
            'relatedFieldsOn' => array(
                'sliderside-spacing-mobile'
            ),
            'tipLabel'        => n2_('Mobile side spacing'),
            'tipDescription'  => n2_('You can create a fix distance between the slider and the slides where your controls are which appear on this device. This way your controls won\'t cover the slide content.')
        ));

        $sideSpacingMobile = new MarginPadding($rowSpaceDesktop, 'side-spacing-mobile', n2_('Side spacing'), '0|*|0|*|0|*|0', array(
            'unit' => 'px'
        ));
        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($sideSpacingMobile, 'side-spacing-mobile-' . $i, false, '', array(
                'values' => array(
                    0,
                    20,
                    40,
                    80
                ),
                'wide'   => 3
            ));
        }

        $rowSlideCSS = new FieldsetRow($rowGroupSlides, 'slider-type-showcase-settings-slidecss');

        new Skin($rowSlideCSS, 'slide-preset', n2_('Slide CSS Preset'), '', array(
            'post'    => 'break',
            'options' => array(
                'shadow' => array(
                    'label'    => n2_('Light shadow'),
                    'settings' => array(
                        'slide-css' => 'box-shadow: 1px 0 5px RGBA(0, 0, 0, 0.2), -1px 0 5px RGBA(0, 0, 0, 0.2);'
                    )
                )
            )
        ));

        new Textarea($rowSlideCSS, 'slide-css', 'Slide CSS', '', array(
            'width'  => 500,
            'height' => 26
        ));


        $rowSliderCSS = new FieldsetRow($rowGroupGeneral, 'slider-type-showcase-settings-slidercss');

        new Skin($rowSliderCSS, 'slider-preset', n2_('Slider CSS Preset'), '', array(
            'post'    => 'break',
            'options' => array(
                'shadow'       => array(
                    'label'    => n2_('Light shadow'),
                    'settings' => array(
                        'slider-css' => 'box-shadow: 1px 0 5px RGBA(0, 0, 0, 0.2), -1px 0 5px RGBA(0, 0, 0, 0.2);'
                    )
                ),
                'shadow2'      => array(
                    'label'    => n2_('Dark shadow'),
                    'settings' => array(
                        'slider-css' => 'box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.6);'
                    )
                ),
                'photo'        => array(
                    'label'    => n2_('Photo'),
                    'settings' => array(
                        'slider-css'   => 'box-shadow: 1px 0 5px RGBA(0, 0, 0, 0.2), -1px 0 5px RGBA(0, 0, 0, 0.2);',
                        'border-width' => '8',
                        'border-color' => 'FFFFFFFF'
                    )
                ),
                'roundedphoto' => array(
                    'label'    => n2_('Photo rounded'),
                    'settings' => array(
                        'slider-css'    => 'box-shadow: 1px 0 5px RGBA(0, 0, 0, 0.2), -1px 0 5px RGBA(0, 0, 0, 0.2);',
                        'border-width'  => '5',
                        'border-color'  => 'FFFFFFFF',
                        'border-radius' => '12'
                    )
                )
            )
        ));

        new Textarea($rowSliderCSS, 'slider-css', 'Slider CSS', '', array(
            'height' => 26
        ));


        $tableShowcaseAnimation = new ContainerTable(new InsertBefore($form->getElement('/animations/effects')), 'slider-type-showcase-animation', n2_('Showcase animation'));

        $rowAnimation1 = new FieldsetRow($tableShowcaseAnimation, 'slider-type-showcase-animation-1');

        new Skin($rowAnimation1, 'animation-preset', n2_('Preset'), '', array(
            'fixed'   => true,
            'options' => array(
                'none'                => array(
                    'label'    => n2_('Default'),
                    'settings' => array(
                        'slide-distance' => 60,
                        'perspective'    => 1000,
                        'opacity'        => '0|*|100|*|100|*|100',
                        'scale'          => '0|*|100|*|100|*|100',
                        'translate-x'    => '0|*|0|*|0|*|0',
                        'translate-y'    => '0|*|0|*|0|*|0',
                        'translate-z'    => '0|*|0|*|0|*|0',
                        'rotate-x'       => '0|*|0|*|0|*|0',
                        'rotate-y'       => '0|*|0|*|0|*|0',
                        'rotate-z'       => '0|*|0|*|0|*|0'
                    )
                ),
                'horizontal'          => array(
                    'label'    => n2_('Horizontal showcase'),
                    'settings' => array(
                        'animation-direction' => 'horizontal',
                        'slide-distance'      => 60,
                        'perspective'         => 1000,
                        'opacity'             => '0|*|100|*|100|*|100',
                        'scale'               => '0|*|100|*|100|*|100',
                        'translate-x'         => '0|*|0|*|0|*|0',
                        'translate-y'         => '0|*|0|*|0|*|0',
                        'translate-z'         => '0|*|0|*|0|*|0',
                        'rotate-x'            => '0|*|0|*|0|*|0',
                        'rotate-y'            => '0|*|0|*|0|*|0',
                        'rotate-z'            => '0|*|0|*|0|*|0'
                    )
                ),
                'vertical'            => array(
                    'label'    => n2_('Vertical showcase'),
                    'settings' => array(
                        'animation-direction' => 'vertical',
                        'slide-distance'      => 60,
                        'perspective'         => 1000,
                        'opacity'             => '0|*|100|*|100|*|100',
                        'scale'               => '0|*|100|*|100|*|100',
                        'translate-x'         => '0|*|0|*|0|*|0',
                        'translate-y'         => '0|*|0|*|0|*|0',
                        'translate-z'         => '0|*|0|*|0|*|0',
                        'rotate-x'            => '0|*|0|*|0|*|0',
                        'rotate-y'            => '0|*|0|*|0|*|0',
                        'rotate-z'            => '0|*|0|*|0|*|0'
                    )
                ),
                'horizontalcoverflow' => array(
                    'label'    => n2_('Horizontal cover flow'),
                    'settings' => array(
                        'animation-direction' => 'horizontal',
                        'slide-distance'      => 10,
                        'perspective'         => 2000,
                        'opacity'             => '0|*|100|*|100|*|100',
                        'scale'               => '1|*|70|*|100|*|70',
                        'translate-x'         => '0|*|0|*|0|*|0',
                        'translate-y'         => '0|*|0|*|0|*|0',
                        'translate-z'         => '0|*|0|*|0|*|0',
                        'rotate-x'            => '0|*|0|*|0|*|0',
                        'rotate-y'            => '1|*|45|*|0|*|-45',
                        'rotate-z'            => '0|*|0|*|0|*|0'
                    )
                ),
                'verticalcoverflow'   => array(
                    'label'    => n2_('Vertical cover flow'),
                    'settings' => array(
                        'animation-direction' => 'vertical',
                        'slide-distance'      => 10,
                        'perspective'         => 2000,
                        'opacity'             => '0|*|100|*|100|*|100',
                        'scale'               => '1|*|70|*|100|*|70',
                        'translate-x'         => '0|*|0|*|0|*|0',
                        'translate-y'         => '0|*|0|*|0|*|0',
                        'translate-z'         => '0|*|0|*|0|*|0',
                        'rotate-x'            => '1|*|-45|*|0|*|45',
                        'rotate-y'            => '0|*|0|*|0|*|0',
                        'rotate-z'            => '0|*|0|*|0|*|0'
                    )
                )
            )
        ));


        $rowAnimation2 = new FieldsetRow($tableShowcaseAnimation, 'slider-type-showcase-animation-2');

        new NumberAutoComplete($rowAnimation2, 'animation-duration', n2_('Duration'), 800, array(
            'wide'   => 5,
            'min'    => 200,
            'values' => array(
                1000,
                1500,
                2000
            ),
            'unit'   => 'ms'
        ));

        new Easing($rowAnimation2, 'animation-easing', n2_('Easing'), 'easeOutQuad');

        new Radio($rowAnimation2, 'animation-direction', n2_('Direction'), 'horizontal', array(
            'options' => array(
                'horizontal' => n2_('Horizontal'),
                'vertical'   => n2_('Vertical')
            )
        ));

        $rowAnimationTransform = new FieldsetRow($tableShowcaseAnimation, 'slider-type-showcase-animation-opacity');

        $opacity = new MixedField($rowAnimationTransform, 'opacity', false, '0|*|100|*|100|*|100');
        new OnOff($opacity, 'opacity-1', n2_('Opacity'), 0, array(
            'relatedFieldsOn' => array(
                'opacityslideropacity-2',
                'opacityslideropacity-3',
                'opacityslideropacity-4'
            )
        ));
        new NumberAutoComplete($opacity, 'opacity-2', n2_('Before'), '', array(
            'wide'   => 3,
            'min'    => 0,
            'max'    => 100,
            'values' => array(
                0,
                70,
                100
            ),
            'unit'   => '%'
        ));
        new NumberAutoComplete($opacity, 'opacity-3', n2_('Active'), '', array(
            'wide'   => 3,
            'min'    => 0,
            'max'    => 100,
            'values' => array(
                0,
                70,
                100
            ),
            'unit'   => '%'
        ));
        new NumberAutoComplete($opacity, 'opacity-4', n2_('After'), '', array(
            'wide'   => 3,
            'min'    => 0,
            'max'    => 100,
            'values' => array(
                0,
                70,
                100
            ),
            'unit'   => '%'
        ));

        $scale = new MixedField($rowAnimationTransform, 'scale', false, '0|*|100|*|100|*|100');
        new OnOff($scale, 'scale-1', n2_('Scale'), 0, array(
            'relatedFieldsOn' => array(
                'scalesliderscale-2',
                'scalesliderscale-3',
                'scalesliderscale-4'
            )
        ));
        new NumberAutoComplete($scale, 'scale-2', n2_('Before'), '', array(
            'wide'   => 3,
            'min'    => 0,
            'values' => array(
                0,
                50,
                80,
                90,
                100
            ),
            'unit'   => '%'
        ));
        new NumberAutoComplete($scale, 'scale-3', n2_('Active'), '', array(
            'wide'   => 3,
            'min'    => 0,
            'values' => array(
                0,
                50,
                80,
                90,
                100
            ),
            'unit'   => '%'
        ));
        new NumberAutoComplete($scale, 'scale-4', n2_('After'), '', array(
            'wide'   => 3,
            'min'    => 0,
            'values' => array(
                0,
                50,
                80,
                90,
                100
            ),
            'unit'   => '%'
        ));


        $rowAnimationPosition = new FieldsetRow($tableShowcaseAnimation, 'slider-type-showcase-animation-x');

        $translateX = new MixedField($rowAnimationPosition, 'translate-x', false, '0|*|0|*|0|*|0');
        new OnOff($translateX, 'translate-x-1', 'X', 0, array(
            'relatedFieldsOn' => array(
                'translate-xslidertranslate-x-2',
                'translate-xslidertranslate-x-3',
                'translate-xslidertranslate-x-4'
            )
        ));
        new NumberAutoComplete($translateX, 'translate-x-2', n2_('Before'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));
        new NumberAutoComplete($translateX, 'translate-x-3', n2_('Active'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));
        new NumberAutoComplete($translateX, 'translate-x-4', n2_('After'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));

        $translateY = new MixedField($rowAnimationPosition, 'translate-y', false, '0|*|0|*|0|*|0');
        new OnOff($translateY, 'translate-y-1', 'Y', 0, array(
            'relatedFieldsOn' => array(
                'translate-yslidertranslate-y-2',
                'translate-yslidertranslate-y-3',
                'translate-yslidertranslate-y-4'
            )
        ));
        new NumberAutoComplete($translateY, 'translate-y-2', n2_('Before'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));
        new NumberAutoComplete($translateY, 'translate-y-3', n2_('Active'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));
        new NumberAutoComplete($translateY, 'translate-y-4', n2_('After'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));

        $translateZ = new MixedField($rowAnimationPosition, 'translate-z', false, '0|*|0|*|0|*|0');
        new OnOff($translateZ, 'translate-z-1', 'Z', 0, array(
            'relatedFieldsOn' => array(
                'translate-zslidertranslate-z-2',
                'translate-zslidertranslate-z-3',
                'translate-zslidertranslate-z-4'
            )
        ));
        new NumberAutoComplete($translateZ, 'translate-z-2', n2_('Before'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));
        new NumberAutoComplete($translateZ, 'translate-z-3', n2_('Active'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));
        new NumberAutoComplete($translateZ, 'translate-z-4', n2_('After'), '', array(
            'wide'   => 4,
            'values' => array(
                -100,
                0,
                100
            ),
            'unit'   => 'px'
        ));


        $rowAnimationRotate = new FieldsetRow($tableShowcaseAnimation, 'slider-type-showcase-animation-rotate-x');

        $rotateX = new MixedField($rowAnimationRotate, 'rotate-x', false, '0|*|0|*|0|*|0');
        new OnOff($rotateX, 'rotate-x-1', n2_('Rotate') . ' X', 0, array(
            'relatedFieldsOn' => array(
                'rotate-xsliderrotate-x-2',
                'rotate-xsliderrotate-x-3',
                'rotate-xsliderrotate-x-4'
            )
        ));
        new NumberAutoComplete($rotateX, 'rotate-x-2', n2_('Before'), '', array(
            'wide'   => 4,
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));
        new NumberAutoComplete($rotateX, 'rotate-x-3', n2_('Active'), '', array(
            'wide'   => 4,
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));
        new NumberAutoComplete($rotateX, 'rotate-x-4', n2_('After'), '', array(
            'style'  => 'width:30px;',
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));

        $rotateY = new MixedField($rowAnimationRotate, 'rotate-y', false, '0|*|0|*|0|*|0');
        new OnOff($rotateY, 'rotate-y-1', n2_('Rotate') . ' Y', 0, array(
            'relatedFieldsOn' => array(
                'rotate-ysliderrotate-y-2',
                'rotate-ysliderrotate-y-3',
                'rotate-ysliderrotate-y-4'
            )
        ));
        new NumberAutoComplete($rotateY, 'rotate-y-2', n2_('Before'), '', array(
            'style'  => 'width:30px;',
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));
        new NumberAutoComplete($rotateY, 'rotate-y-3', n2_('Active'), '', array(
            'style'  => 'width:30px;',
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));
        new NumberAutoComplete($rotateY, 'rotate-y-4', n2_('After'), '', array(
            'style'  => 'width:30px;',
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));

        $rotateZ = new MixedField($rowAnimationRotate, 'rotate-z', false, '0|*|0|*|0|*|0');
        new OnOff($rotateZ, 'rotate-z-1', n2_('Rotate') . ' Z', 0, array(
            'relatedFieldsOn' => array(
                'rotate-zsliderrotate-z-2',
                'rotate-zsliderrotate-z-3',
                'rotate-zsliderrotate-z-4'
            )
        ));
        new NumberAutoComplete($rotateZ, 'rotate-z-2', n2_('Before'), '', array(
            'style'  => 'width:30px;',
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));
        new NumberAutoComplete($rotateZ, 'rotate-z-3', n2_('Active'), '', array(
            'style'  => 'width:30px;',
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));
        new NumberAutoComplete($rotateZ, 'rotate-z-4', n2_('After'), '', array(
            'style'  => 'width:30px;',
            'values' => array(
                -60,
                -30,
                0,
                60,
                30
            ),
            'unit'   => '°'
        ));

        $rowSettingsBehavior = new FieldsetRow($tableShowcaseAnimation, 'slider-type-showcase-settings-behavior');

        new OnOff($rowSettingsBehavior, 'carousel', n2_x('Carousel', 'Feature'), 1, array(
            'tipLabel'         => n2_x('Carousel', 'Feature'),
            'tipDescription'   => n2_('This option will create a complete round from your slides if you have enough slides. If you don\'t have enough slides, you could consider duplicating all the slides or just add more slides until you will get a carousel round.'),
            'tipLink'          => 'https://smartslider.helpscoutdocs.com/article/1799-showcase-slider-type#carousel',
            'relatedFieldsOn'  => array(
                'slidercontrolsBlockCarouselInteraction'
            ),
            'relatedFieldsOff' => array(
                'sliderdisabled-carousel-notice'
            )
        ));

        new OnOff($rowSettingsBehavior, 'slide-overlay', n2_('Switch with next/previous slides'), 1, array(
            'tipLabel'       => n2_('Switch with next/previous slides'),
            'tipDescription' => n2_('Clicking on any slide that\'s not in the middle will make the slider switch to that slide. With this option you can disable this behavior, for example, to allow clicking on buttons on the visible slides.'),
        ));

        /**
         * Removing slider settings which are unnecessary for Showcase slider type.
         */

        $form->getElement('/controls/widget-fullscreen')
             ->remove();
        $form->getElement('/size/responsive-mode/responsive-mode-row-1/responsive-mode')
             ->removeOption('fullpage');
        $form->getElement('/size/size/size-2')
             ->remove();
        $form->getElement('/optimize/optimize-slide/optimize-slide-loading-mode/imageloadNeighborSlides')
             ->remove();
        $form->getElement('/size/override-slider-size')
             ->remove();

    }
}Slider/SliderType/Showcase/SliderTypeShowcaseCss.php000064400000006475152355233130016607 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Showcase;


use Nextend\Framework\Parser\Color;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeCss;

class SliderTypeShowcaseCss extends AbstractSliderTypeCss {

    public function __construct($slider) {
        parent::__construct($slider);
        $params = $this->slider->params;

        switch ($params->get('animation-direction')) {
            case 'vertical':
                $this->context['distanceh'] = 0;
                $this->context['distancev'] = intval($params->get('slide-distance')) . 'px';
                break;
            default:
                $this->context['distancev'] = 0;
                $this->context['distanceh'] = intval($params->get('slide-distance')) . 'px';
        }


        $this->context['perspective'] = intval($params->get('perspective')) . 'px';


        $width  = intval($this->context['width']);
        $height = intval($this->context['height']);

        $this->context['sliderwidth'] = $width . 'px';

        $this->context['backgroundSize']       = $params->getIfEmpty('background-size', 'inherit');
        $this->context['backgroundAttachment'] = $params->get('background-fixed') ? 'fixed' : 'scroll';

        $borderWidth                   = $params->getIfEmpty('border-width', 0);
        $borderColor                   = $params->get('border-color');
        $this->context['borderRadius'] = $params->get('border-radius') . 'px';


        $this->context['border'] = $borderWidth . 'px';

        $rgba                        = Color::hex2rgba($borderColor);
        $this->context['borderrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $width  = $width - $borderWidth * 2;
        $height = $height - $borderWidth * 2;

        $this->context['slideBorderRadius'] = $params->get('slide-border-radius') . 'px';

        $slideBorderWidth                  = max(0, $params->get('slide-border-width', 0));
        $this->context['slideborderwidth'] = $slideBorderWidth . 'px';

        $rgba                              = Color::hex2rgba($params->get('slide-border-color'));
        $this->context['slidebordercolor'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';


        $slideWidth  = min($width, max(50, intval($params->get('slide-width'))));
        $slideHeight = min($height, max(50, intval($params->get('slide-height'))));

        $this->context['slideouterwidth']  = $slideWidth . 'px';
        $this->context['slideouterheight'] = $slideHeight . 'px';

        $this->context['verticalmargin']   = round(($height - $slideHeight) / 2) . 'px';
        $this->context['horizontalmargin'] = round(($width - $slideWidth) / 2) . 'px';

        $this->context['canvaswidth']  = $slideWidth - 2 * $slideBorderWidth . 'px';
        $this->context['canvasheight'] = $slideHeight - 2 * $slideBorderWidth . 'px';


        $this->initSizes();

        $this->slider->addLess(SliderTypeShowcase::getAssetsPath() . '/style.n2less', $this->context);


        $this->base = array(
            'sliderWidth'  => $width,
            'sliderHeight' => $height,
            'slideWidth'   => $slideWidth,
            'slideHeight'  => $slideHeight
        );
    }
}Slider/SliderType/Showcase/SliderTypeShowcaseFrontend.php000064400000023325152355233130017627 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Showcase;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeFrontend;

class SliderTypeShowcaseFrontend extends AbstractSliderTypeFrontend {

    private $direction = 'horizontal';

    public function getDefaults() {
        return array(
            'slide-width'         => 600,
            'slide-height'        => 400,
            'background'          => '',
            'background-size'     => 'cover',
            'background-fixed'    => 0,
            'border-width'        => 0,
            'border-color'        => '3E3E3Eff',
            'border-radius'       => 0,
            'slider-css'          => '',
            'slide-css'           => '',
            'animation-duration'  => 800,
            'animation-easing'    => 'easeOutQuad',
            'animation-direction' => 'horizontal',
            'slide-distance'      => 60,
            'perspective'         => 1000,
            'carousel'            => 1,
            'carousel-slides'     => 3,
            'opacity'             => '0|*|100|*|100|*|100',
            'scale'               => '0|*|100|*|100|*|100',
            'translate-x'         => '0|*|0|*|0|*|0',
            'translate-y'         => '0|*|0|*|0|*|0',
            'translate-z'         => '0|*|0|*|0|*|0',
            'rotate-x'            => '0|*|0|*|0|*|0',
            'rotate-y'            => '0|*|0|*|0|*|0',
            'rotate-z'            => '0|*|0|*|0|*|0'
        );
    }

    protected function renderType($css) {

        $params = $this->slider->params;

        Js::addStaticGroup(SliderTypeShowcase::getAssetsPath() . '/dist/ss-showcase.min.js', 'ss-showcase');

        $this->jsDependency[] = 'ss-showcase';

        $sliderCSS = $params->get('slider-css');

        $this->initSliderBackground('.n2-ss-slider-2');

        $this->initParticleJS();

        echo wp_kses($this->openSliderElement(), Sanitize::$basicTags);
        ob_start();

        $overlay = $params->get('slide-overlay', 1);
        ?>
        <div class="n2-ss-slider-1 n2_ss__touch_element n2-ow">
            <div class="n2-ss-slider-2 n2-ow"<?php echo empty($sliderCSS) ? '' : ' style="' . esc_attr($sliderCSS) . '"'; ?>>
                <?php
                echo wp_kses($this->getBackgroundVideo($params), Sanitize::$videoTags);
                ?>
                <div class="n2-ss-slider-3 n2-ow">
                    <?php
                    $this->displaySizeSVGs($css, true);

                    // PHPCS - Content already escaped
                    echo $this->slider->staticHtml; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                    ?>
                    <div class="n2-ss-showcase-slides n2-ow">
                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 <?php echo esc_attr($css->base['slideWidth'] . ' ' . $css->base['slideHeight']); ?>" class="n2-ow n2-ss-preserve-size n2-ss-slide-limiter"></svg>
                        <?php
                        foreach ($this->slider->getSlides() as $i => $slide) {
                            $slide->finalize();


                            // PHPCS - Content already escaped
                            echo Html::tag('div', Html::mergeAttributes($slide->attributes, array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                                                                                                   'class' => 'n2-ss-slide ' . $slide->classes . ' n2-ow',
                                                                                                   'style' => $slide->style . $params->get('slide-css')
                            )), $slide->background . Html::tag('div', array('class' => 'n2-ss-slide-inner') + $slide->linkAttributes, $slide->getHTML()) . ($overlay ? Html::tag('div', array('class' => 'n2-ss-showcase-overlay n2-ow')) : ''));
                        }
                        ?></div>
                </div>
                <?php
                $this->renderShapeDividers();
                ?>
            </div>
        </div>
        <?php

        // PHPCS - Content already escaped
        echo $this->widgets->wrapSlider(ob_get_clean()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        echo wp_kses($this->closeSliderElement(), Sanitize::$basicTags);

        $this->javaScriptProperties['carousel']           = intval($params->get('carousel'));
        $this->javaScriptProperties['carouselSideSlides'] = intval((max(intval($params->get('carousel-slides')), 1) - 1) / 2);

        $this->javaScriptProperties['showcase'] = array(
            'duration' => intval($params->get('animation-duration')),
            'ease'     => $params->get('animation-easing')
        );


        $sideSpacing = array();

        if ($params->get('side-spacing-desktop-enable', 0)) {
            $sideSpacing['desktop'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-desktop'))), 4, 0);
        } else {
            $sideSpacing['desktop'] = array(
                0,
                0,
                0,
                0
            );
        }

        if ($params->get('side-spacing-tablet-enable', 0)) {
            $sideSpacing['tablet'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-tablet'))), 4, 0);
        } else {
            $sideSpacing['tablet'] = $sideSpacing['desktop'];
        }

        if ($params->get('side-spacing-mobile-enable', 0)) {
            $sideSpacing['mobile'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-mobile'))), 4, 0);
        } else {
            $sideSpacing['mobile'] = $sideSpacing['tablet'];
        }

        $desktop = implode('px ', $sideSpacing['desktop']) . 'px';
        $this->slider->addDeviceCSS('all', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $desktop . '}');

        $tablet = implode('px ', $sideSpacing['tablet']) . 'px';
        if ($tablet !== $desktop) {
            $this->slider->addDeviceCSS('tabletportrait', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $tablet . '}');
            $this->slider->addDeviceCSS('tabletlandscape', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $tablet . '}');

        }
        $mobile = implode('px ', $sideSpacing['mobile']) . 'px';
        if ($mobile !== $desktop) {
            $this->slider->addDeviceCSS('mobileportrait', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $mobile . '}');
            $this->slider->addDeviceCSS('mobilelandscape', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $mobile . '}');

        }

        $this->initAnimationProperties();

        $this->style .= $css->getCSS();
    }

    public function getScript() {
        return "_N2.r(" . json_encode(array_unique($this->jsDependency)) . ",function(){new _N2.SmartSliderShowcase('{$this->slider->elementId}', " . $this->encodeJavaScriptProperties() . ");});";
    }

    protected function getSliderClasses() {
        switch ($this->slider->params->get('animation-direction', 'horizontal')) {
            case 'vertical':
                $this->direction = 'vertical';

                return parent::getSliderClasses() . ' n2-ss-showcase-vertical';
                break;
            default:
                $this->direction = 'horizontal';

                return parent::getSliderClasses() . ' n2-ss-showcase-horizontal';
        }
    }

    private function initAnimationProperties() {
        $params = $this->slider->params;

        $slideDistance = intval($params->get('slide-distance'));

        $this->javaScriptProperties['showcase'] += array(
            'direction' => $this->direction,
            'distance'  => $slideDistance,
            'animate'   => array(
                'opacity'   => self::animationPropertyState($params, 'opacity', 100),
                'scale'     => self::animationPropertyState($params, 'scale', 100),
                'x'         => self::animationPropertyState($params, 'translate-x'),
                'y'         => self::animationPropertyState($params, 'translate-y'),
                'z'         => self::animationPropertyState($params, 'translate-z'),
                'rotationX' => self::animationPropertyState($params, 'rotate-x'),
                'rotationY' => self::animationPropertyState($params, 'rotate-y'),
                'rotationZ' => self::animationPropertyState($params, 'rotate-z'),
            ),
            'overlay'   => $params->get('slide-overlay', 1)
        );
    }

    private static function animationPropertyState($params, $prop, $normalize = 1) {
        $propValue = Common::parse($params->get($prop));
        if ($propValue[0] != 1) {
            return null;
        }

        return array(
            'before' => intval($propValue[1]) / $normalize,
            'active' => intval($propValue[2]) / $normalize,
            'after'  => intval($propValue[3]) / $normalize
        );
    }

    /**
     * @param $params Data
     */
    public function limitParams($params) {
        $limitParams = array(
            'widget-fullscreen-enabled' => 0,
            'responsiveLimitSlideWidth' => 0,
            'imageloadNeighborSlides'   => 0,
            'slider-size-override'      => 0
        );

        if ($params->get('responsive-mode') === 'fullpage') {
            $limitParams['responsive-mode'] = 'auto';
        }

        $params->loadArray($limitParams);
    }
}Slider/SliderType/Group/SliderTypeGroup.php000064400000001034152355233130014760 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Group;


use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderType;

class SliderTypeGroup extends AbstractSliderType {

    public function getName() {
        return 'group';
    }

    public function createFrontend($slider) {
        return new SliderTypeGroupFrontend($slider);
    }

    public function createCss($slider) {
        return new SliderTypeGroupCss($slider);
    }

    public function createAdmin() {
        return false;
    }
}Slider/SliderType/Group/SliderTypeGroupCss.php000064400000000455152355233130015437 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Slider\SliderType\Group;

use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeCss;

class SliderTypeGroupCss extends AbstractSliderTypeCss {

    public function render() {

    }

    protected function renderType(&$context) {

    }
}Slider/SliderType/Group/SliderTypeGroupFrontend.php000064400000002501152355233130016460 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Slider\SliderType\Group;

use Nextend\Framework\Platform\Platform;
use Nextend\SmartSlider3\Application\Model\ModelSlidersXRef;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeFrontend;
use Nextend\SmartSlider3\SliderManager\SliderManager;

class SliderTypeGroupFrontend extends AbstractSliderTypeFrontend {

    private $earlier = 2145916800;

    public function render($css) {

        ob_start();
        $this->renderType($css);


        return ob_get_clean();
    }

    protected function renderType($css) {
        $isAdmin = Platform::isAdmin();

        $xref = new ModelSlidersXRef($this->slider);
        $rows = $xref->getSliders($this->slider->data->get('id'), 'published');
        foreach ($rows as $row) {
            $slider     = new SliderManager($this->slider, $row['slider_id'], $isAdmin);
            $sliderHTML = $slider->render();


            // PHPCS - Content already escaped
            echo $sliderHTML; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
            if (!empty($sliderHTML)) {
                $this->earlier = min($slider->slider->getNextCacheRefresh(), $this->earlier);
            }
        }
    }

    public function getNextCacheRefresh() {
        return $this->earlier;
    }
}Slider/SliderType/Carousel/SliderTypeCarousel.php000064400000001560152355233130016126 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Carousel;


use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderType;

class SliderTypeCarousel extends AbstractSliderType {

    public function getName() {
        return 'carousel';
    }

    public function createFrontend($slider) {
        return new SliderTypeCarouselFrontend($slider);
    }

    public function createCss($slider) {
        return new SliderTypeCarouselCss($slider);
    }


    public function createAdmin() {
        return new SliderTypeCarouselAdmin($this);
    }

    public function export($export, $slider) {
        $export->addImage($slider['params']->get('background', ''));
    }

    public function import($import, $slider) {

        $slider['params']->set('background', $import->fixImage($slider['params']->get('background', '')));
    }
}Slider/SliderType/Carousel/SliderTypeCarouselAdmin.php000064400000030733152355233130017103 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Carousel;


use Nextend\Framework\Form\Container\ContainerRowGroup;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\MarginPadding;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Radio;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Easing;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\Number;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\Framework\Form\Insert\InsertAfter;
use Nextend\Framework\Form\Insert\InsertBefore;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeAdmin;

class SliderTypeCarouselAdmin extends AbstractSliderTypeAdmin {

    protected $ordering = 3;

    public function getLabel() {
        return n2_('Carousel');
    }

    public function getLabelFull() {
        return n2_x('Carousel slider', 'Slider type');
    }

    public function getIcon() {
        return 'ssi_64 ssi_64--carousel';
    }

    public function prepareForm($form) {

        $tableSlideSize = new ContainerTable(new InsertAfter($form->getElement('/size/size')), 'slider-type-carousel-settings-size', n2_('Slide size'));

        $rowSettings = new FieldsetRow($tableSlideSize, 'slider-type-carousel-settings-size-1');

        new NumberAutoComplete($rowSettings, 'slide-width', n2_('Slide width'), 600, array(
            'values' => array(
                400,
                600,
                800,
                1000
            ),
            'unit'   => 'px',
            'wide'   => 5
        ));
        new NumberAutoComplete($rowSettings, 'slide-height', n2_('Slide height'), 400, array(
            'values' => array(
                300,
                400,
                600,
                800,
                1000
            ),
            'unit'   => 'px',
            'wide'   => 5
        ));


        new NumberAutoComplete($rowSettings, 'maximum-pane-width', n2_('Max pane width'), 3000, array(
            'tipLabel'       => n2_('Max pane width'),
            'tipDescription' => n2_('You can use this option to limit how many slides can show up next to each other.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1786-carousel-slider-type#max-pane-width',
            'values'         => array(
                300,
                600,
                980,
                3000
            ),
            'unit'           => 'px',
            'wide'           => 5
        ));

        new NumberAutoComplete($rowSettings, 'minimum-slide-gap', n2_('Minimum slide distance'), 10, array(
            'tipLabel'       => n2_('Minimum slide distance'),
            'tipDescription' => n2_('The minimum space between two slides.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1786-carousel-slider-type#minimum-slide-distance',
            'values'         => array(
                10,
                50,
                100,
                200
            ),
            'unit'           => 'px',
            'wide'           => 3
        ));

        $spaceGroup = new ContainerRowGroup(new InsertAfter($form->getElement('/general/design/design-1')), 'slider-type-carousel-space', n2_('Side spacing'));

        $rowSpaceDesktop = $spaceGroup->createRow('slider-type-carousel-space-desktop');

        new OnOff($rowSpaceDesktop, 'side-spacing-desktop-enable', n2_('Desktop'), 0, array(
            'relatedFieldsOn' => array(
                'sliderside-spacing-desktop'
            ),
            'tipLabel'        => n2_('Desktop side spacing'),
            'tipDescription'  => n2_('You can create a fix distance between the slider and the slides where your controls are which appear on this device. This way your controls won\'t cover the slide content.')
        ));

        $sideSpacingDesktop = new MarginPadding($rowSpaceDesktop, 'side-spacing-desktop', n2_('Side spacing'), '0|*|0|*|0|*|0', array(
            'unit' => 'px'
        ));
        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($sideSpacingDesktop, 'side-spacing-desktop-' . $i, false, '', array(
                'values' => array(
                    0,
                    20,
                    40,
                    80
                ),
                'wide'   => 3
            ));
        }


        new OnOff($rowSpaceDesktop, 'side-spacing-tablet-enable', n2_('Tablet'), 0, array(
            'relatedFieldsOn' => array(
                'sliderside-spacing-tablet'
            ),
            'tipLabel'        => n2_('Tablet side spacing'),
            'tipDescription'  => n2_('You can create a fix distance between the slider and the slides where your controls are which appear on this device. This way your controls won\'t cover the slide content.')
        ));

        $sideSpacingTablet = new MarginPadding($rowSpaceDesktop, 'side-spacing-tablet', n2_('Side spacing'), '0|*|0|*|0|*|0', array(
            'unit' => 'px'
        ));
        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($sideSpacingTablet, 'side-spacing-tablet-' . $i, false, '', array(
                'values' => array(
                    0,
                    20,
                    40,
                    80
                ),
                'wide'   => 3
            ));
        }


        new OnOff($rowSpaceDesktop, 'side-spacing-mobile-enable', n2_('Mobile'), 0, array(
            'relatedFieldsOn' => array(
                'sliderside-spacing-mobile'
            ),
            'tipLabel'        => n2_('Mobile side spacing'),
            'tipDescription'  => n2_('You can create a fix distance between the slider and the slides where your controls are which appear on this device. This way your controls won\'t cover the slide content.')
        ));

        $sideSpacingMobile = new MarginPadding($rowSpaceDesktop, 'side-spacing-mobile', n2_('Side spacing'), '0|*|0|*|0|*|0', array(
            'unit' => 'px'
        ));
        for ($i = 1; $i < 5; $i++) {
            new NumberAutoComplete($sideSpacingMobile, 'side-spacing-mobile-' . $i, false, '', array(
                'values' => array(
                    0,
                    20,
                    40,
                    80
                ),
                'wide'   => 3
            ));
        }

        $rowGroupSlides = new ContainerRowGroup(new InsertAfter($form->getElement('/slides/slides-design/slides-design-1')), 'slider-type-carousel-group-slides', false);

        $rowSlideBackground = new FieldsetRow($rowGroupSlides, 'slider-type-carousel-background-slide');

        new Color($rowSlideBackground, 'slide-background-color', n2_('Slide background color'), 'ffffffff', array(
            'alpha' => true
        ));

        $rowDesignSlide = new FieldsetRow($rowGroupSlides, 'slider-type-carousel-design-slide');
        new Number($rowDesignSlide, 'slide-border-width', n2_('Slide border width'), 0, array(
            'unit'          => 'px',
            'wide'          => 3,
            'relatedFields' => array('sliderslide-border-color')
        ));
        new Color($rowDesignSlide, 'slide-border-color', n2_('Slide border color'), '3E3E3Eff', array(
            'alpha' => true
        ));
        new Number($rowDesignSlide, 'slide-border-radius', n2_('Slide border radius'), 0, array(
            'wide' => 3,
            'unit' => 'px'
        ));

        $rowDesignSlider = new FieldsetRow(new InsertAfter($form->getElement('/general/design/design-1')), 'slider-type-carousel-design-slider');

        new Number($rowDesignSlider, 'border-width', n2_('Slider border width'), 0, array(
            'unit'          => 'px',
            'wide'          => 3,
            'relatedFields' => array('sliderborder-color')
        ));
        new Color($rowDesignSlider, 'border-color', n2_('Slider border color'), '3E3E3Eff', array(
            'alpha' => true
        ));
        new Number($rowDesignSlider, 'border-radius', n2_('Slider border radius'), 0, array(
            'unit' => 'px',
            'wide' => 3
        ));

        $tableMainAnimation = new ContainerTable(new InsertBefore($form->getElement('/animations/effects')), 'slider-type-carousel-animation', n2_('Main animation'));

        $rowAnimation1 = new FieldsetRow($tableMainAnimation, 'slider-type-carousel-animation-1');

        $notice = n2_('The Single Switch setting can only move the slides horizontally!') . '<br>';

        new Select($rowAnimation1, 'animation', n2_('Main animation'), 'horizontal', array(
            'options'            => array(
                'no'         => n2_('No'),
                'horizontal' => n2_('Horizontal'),
                'fade'       => n2_('Fade')
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'horizontal',
                        'fade'
                    ),
                    'field'  => array(
                        'slideranimation-duration',
                        'slideranimation-easing'
                    )
                ),
                array(
                    'values' => array(
                        'horizontal'
                    ),
                    'field'  => array(
                        'slidergrouping-single-switch'
                    )
                )
            )
        ));


        new NumberAutoComplete($rowAnimation1, 'animation-duration', n2_('Duration'), 800, array(
            'values' => array(
                800,
                1500,
                2000
            ),
            'unit'   => 'ms',
            'wide'   => 5
        ));

        new Easing($rowAnimation1, 'animation-easing', n2_('Easing'), 'easeOutQuad');


        $rowAnimation2 = new FieldsetRow($tableMainAnimation, 'slider-type-carousel-animation-2');

        new OnOff($rowAnimation2, 'carousel', n2_x('Carousel', 'Feature'), 1, array(
            'tipLabel'         => n2_x('Carousel', 'Feature'),
            'tipDescription'   => n2_('This option will create a complete round from your slides if you have enough slides. If you don\'t have enough slides, you could consider duplicating all the slides or just add more slides until you will get a carousel round.'),
            'tipLink'          => 'https://smartslider.helpscoutdocs.com/article/1786-carousel-slider-type#carousel',
            'relatedFieldsOn'  => array(
                'slidercontrolsBlockCarouselInteraction'
            ),
            'relatedFieldsOff' => array(
                'sliderdisabled-carousel-notice'
            )
        ));

        $groupingSingleSwitch = new Grouping($rowAnimation2, 'grouping-single-switch');
        new OnOff($groupingSingleSwitch, 'single-switch', n2_('Single switch'), 0, array(
            'tipLabel'        => n2_('Single switch'),
            'tipDescription'  => n2_('It switches one slide instead of moving all the visible slides.'),
            'tipLink'         => 'https://smartslider.helpscoutdocs.com/article/1786-carousel-slider-type#single-switch',
            'relatedFieldsOn' => array(
                'sliderslider-side-spacing'
            )
        ));

        new Radio($groupingSingleSwitch, 'slider-side-spacing', n2_('Justify slides'), 1, array(
            'options' => array(
                '0' => n2_('Space between'),
                '1' => n2_('Space around'),
                '2' => n2_('Center')
            )
        ));

        /**
         * Removing slider settings which are unnecessary for Carousel slider type.
         */
        $form->getElement('/animations/layer-parallax')
             ->remove();
        $form->getElement('/controls/widget-bar')
             ->remove();
        $form->getElement('/controls/widget-fullscreen')
             ->remove();
        $form->getElement('/size/size/size-2')
             ->remove();
        $form->getElement('/optimize/optimize-slide/optimize-slide-loading-mode/imageloadNeighborSlides')
             ->remove();
        $form->getElement('/size/override-slider-size')
             ->remove();


        $form->getElement('/size/responsive-mode/responsive-mode-row-1/responsive-mode')
             ->removeOption('fullpage');


    }
}Slider/SliderType/Carousel/SliderTypeCarouselCss.php000064400000015775152355233130016614 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Carousel;


use Nextend\Framework\Parser\Color;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeCss;

class SliderTypeCarouselCss extends AbstractSliderTypeCss {

    public function __construct($slider) {
        parent::__construct($slider);

        if ($this->slider->params->get('animation') === 'horizontal' && $this->slider->params->get('single-switch', 0)) {
            $this->constructCarouselSingle();
        } else {
            $this->constructCarouselMulti();
        }
    }

    private function constructCarouselMulti() {

        $params = $this->slider->params;

        $width  = intval($this->context['width']);
        $height = intval($this->context['height']);


        $backgroundColor                 = $params->get('background-color');
        $rgba                            = Color::hex2rgba($backgroundColor);
        $this->context['backgroundrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $this->context['backgroundSize']       = $params->getIfEmpty('background-size', 'inherit');
        $this->context['backgroundAttachment'] = $params->get('background-fixed') ? 'fixed' : 'scroll';


        $backgroundColor                      = $params->get('slide-background-color');
        $rgba                                 = Color::hex2rgba($backgroundColor);
        $this->context['slideBackgroundrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $this->context['slideBorderRadius'] = $params->get('slide-border-radius') . 'px';

        $borderWidth                   = max(0, $params->get('border-width', 0));
        $backgroundColor               = $params->get('border-color');
        $this->context['borderRadius'] = $params->get('border-radius') . 'px';


        $this->context['border'] = $borderWidth . 'px';

        $rgba                        = Color::hex2rgba($backgroundColor);
        $this->context['borderrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $width                         = $width - $borderWidth * 2;
        $height                        = $height - $borderWidth * 2;
        $this->context['inner1height'] = $height . 'px';

        $slideBorderWidth                  = max(0, $params->get('slide-border-width', 0));
        $this->context['slideborderwidth'] = $slideBorderWidth . 'px';

        $rgba                              = Color::hex2rgba($params->get('slide-border-color'));
        $this->context['slidebordercolor'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';


        $slideWidth  = min($width, max(50, intval($params->get('slide-width'))));
        $slideHeight = max(50, intval($params->get('slide-height')));

        $this->context['slideouterwidth']  = $slideWidth . 'px';
        $this->context['slideouterheight'] = $slideHeight . 'px';

        $this->context['canvaswidth']  = min($width, max(50, intval($params->get('slide-width')))) - 2 * $slideBorderWidth . 'px';
        $this->context['canvasheight'] = min($height, max(50, intval($params->get('slide-height')))) - 2 * $slideBorderWidth . 'px';

        $this->initSizes();

        $this->slider->addLess(SliderTypeCarousel::getAssetsPath() . '/Multi/style.n2less', $this->context);

        $this->base = array(
            'sliderWidth'      => $width,
            'sliderHeight'     => $height,
            'slideOuterWidth'  => $slideWidth,
            'slideOuterHeight' => $slideHeight,
            'slideWidth'       => $slideWidth,
            'slideHeight'      => $slideHeight
        );
    }

    private function constructCarouselSingle() {

        $params = $this->slider->params;

        $width  = intval($this->context['width']);
        $height = intval($this->context['height']);


        $backgroundColor                 = $params->get('background-color');
        $rgba                            = Color::hex2rgba($backgroundColor);
        $this->context['backgroundrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $this->context['backgroundSize']       = $params->getIfEmpty('background-size', 'inherit');
        $this->context['backgroundAttachment'] = $params->get('background-fixed') ? 'fixed' : 'scroll';


        $backgroundColor                      = $params->get('slide-background-color');
        $rgba                                 = Color::hex2rgba($backgroundColor);
        $this->context['slideBackgroundrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $this->context['slideBorderRadius'] = $params->get('slide-border-radius') . 'px';

        $borderWidth                   = max(0, $params->get('border-width', 0));
        $backgroundColor               = $params->get('border-color');
        $this->context['borderRadius'] = $params->get('border-radius') . 'px';


        $this->context['border'] = $borderWidth . 'px';

        $rgba                        = Color::hex2rgba($backgroundColor);
        $this->context['borderrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $width                         = $width - $borderWidth * 2;
        $height                        = $height - $borderWidth * 2;
        $this->context['inner1height'] = $height . 'px';

        $slideBorderWidth                  = max(0, $params->get('slide-border-width', 0));
        $this->context['slideborderwidth'] = $slideBorderWidth . 'px';

        $rgba                              = Color::hex2rgba($params->get('slide-border-color'));
        $this->context['slidebordercolor'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';

        $slideWidth                        = min($width, max(50, intval($params->get('slide-width'))));
        $slideHeight                       = max(50, intval($params->get('slide-height')));
        $this->context['slideouterwidth']  = $slideWidth . 'px';
        $this->context['slideouterheight'] = $slideHeight . 'px';

        $this->context['canvaswidth']  = min($width, max(50, intval($params->get('slide-width')))) - 2 * $slideBorderWidth . 'px';
        $this->context['canvasheight'] = min($height, max(50, intval($params->get('slide-height')))) - 2 * $slideBorderWidth . 'px';

        $this->initSizes();

        $this->slider->addLess(SliderTypeCarousel::getAssetsPath() . '/Single/style.n2less', $this->context);

        $this->base = array(
            'sliderWidth'      => $width,
            'sliderHeight'     => $height,
            'slideOuterWidth'  => $slideWidth,
            'slideOuterHeight' => $slideHeight,
            'slideWidth'       => $slideWidth,
            'slideHeight'      => $slideHeight
        );
    }
}Slider/SliderType/Carousel/SliderTypeCarouselFrontend.php000064400000034031152355233130017625 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Slider\SliderType\Carousel;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\Html;
use Nextend\SmartSlider3\Slider\SliderType\AbstractSliderTypeFrontend;

class SliderTypeCarouselFrontend extends AbstractSliderTypeFrontend {

    public function getDefaults() {
        return array(
            'single-switch'          => 0,
            'slide-width'            => 600,
            'slide-height'           => 400,
            'maximum-pane-width'     => 3000,
            'minimum-slide-gap'      => 10,
            'background-color'       => 'ffffff00',
            'background'             => '',
            'background-size'        => 'cover',
            'background-fixed'       => 0,
            'animation'              => 'horizontal',
            'animation-duration'     => 800,
            'animation-easing'       => 'easeOutQuad',
            'carousel'               => 1,
            'border-width'           => 0,
            'border-color'           => '3E3E3Eff',
            'border-radius'          => 0,
            'slide-background-color' => 'ffffff',
            'slide-border-radius'    => 0
        );
    }

    protected function getSliderClasses() {

        return parent::getSliderClasses() . ' n2-ss-slider-carousel-animation-' . $this->slider->params->get('animation', 'horizontal');
    }

    protected function renderType($css) {
        if ($this->slider->params->get('animation') === 'horizontal' && $this->slider->params->get('single-switch', 0)) {
            $this->renderTypeSingle($css);
        } else {
            $this->renderTypeMulti($css);
        }
    }

    protected function renderTypeMulti($css) {

        $params = $this->slider->params;

        Js::addStaticGroup(SliderTypeCarousel::getAssetsPath() . '/dist/ss-carousel.min.js', 'ss-carousel');

        $this->jsDependency[] = 'ss-carousel';

        $this->initSliderBackground('.n2-ss-slider-2');

        $this->initParticleJS();

        echo wp_kses($this->openSliderElement(), Sanitize::$basicTags);
        ob_start();
        ?>
        <div class="n2-ss-slider-1 n2_ss__touch_element n2-ow">
            <div class="n2-ss-slider-2 n2-ow">
                <?php
                echo wp_kses($this->getBackgroundVideo($params), Sanitize::$videoTags);
                ?>
                <div class="n2-ss-slider-3 n2-ow">
                    <?php
                    $this->displaySizeSVGs($css, true);

                    // PHPCS - Content already escaped
                    echo $this->slider->staticHtml; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                    ?>
                    <div class="n2-ss-slider-pane n2-ow">
                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 <?php echo esc_attr($css->base['slideWidth'] . ' ' . $css->base['slideHeight']); ?>" class="n2-ow n2-ss-preserve-size n2-ss-slide-limiter"></svg>
                        <?php
                        foreach ($this->slider->getSlides() as $i => $slide) {
                            $slide->finalize();

                            // PHPCS - Content already escaped
                            echo Html::tag('div', Html::mergeAttributes($slide->attributes, $slide->linkAttributes, array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                                                                                                                           'class' => 'n2-ss-slide ' . $slide->classes . ' n2-ow',
                                                                                                                           'style' => $slide->style . $params->get('slide-css')
                            )), $slide->background . $slide->getHTML());
                        }
                        ?>
                    </div>
                </div>
                <?php
                $this->renderShapeDividers();
                ?>
            </div>
        </div>
        <?php

        // PHPCS - Content already escaped
        echo $this->widgets->wrapSlider(ob_get_clean()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        echo wp_kses($this->closeSliderElement(), Sanitize::$basicTags);


        $this->javaScriptProperties['mainanimation'] = array(
            'type'     => $params->get('animation'),
            'duration' => intval($params->get('animation-duration')),
            'ease'     => $params->get('animation-easing')
        );

        $this->slider->addDeviceCSS('all', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{max-width:' . intval($params->get('maximum-pane-width')) . 'px;}');


        $this->javaScriptProperties['carousel']                      = intval($params->get('carousel'));
        $this->javaScriptProperties['maxPaneWidth']                  = intval($params->get('maximum-pane-width'));
        $this->javaScriptProperties['responsive']['minimumSlideGap'] = intval($params->get('minimum-slide-gap'));

        $sideSpacing = array();

        if ($params->get('side-spacing-desktop-enable', 0)) {
            $sideSpacing['desktop'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-desktop'))), 4, 0);
        } else {
            $sideSpacing['desktop'] = array(
                0,
                0,
                0,
                0
            );
        }

        if ($params->get('side-spacing-tablet-enable', 0)) {
            $sideSpacing['tablet'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-tablet'))), 4, 0);
        } else {
            $sideSpacing['tablet'] = $sideSpacing['desktop'];
        }

        if ($params->get('side-spacing-mobile-enable', 0)) {
            $sideSpacing['mobile'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-mobile'))), 4, 0);
        } else {
            $sideSpacing['mobile'] = $sideSpacing['tablet'];
        }

        $desktop = implode('px ', $sideSpacing['desktop']) . 'px';
        $this->slider->addDeviceCSS('all', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $desktop . '}');

        $tablet = implode('px ', $sideSpacing['tablet']) . 'px';
        if ($tablet !== $desktop) {
            $this->slider->addDeviceCSS('tabletportrait', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $tablet . '}');
            $this->slider->addDeviceCSS('tabletlandscape', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $tablet . '}');

        }
        $mobile = implode('px ', $sideSpacing['mobile']) . 'px';
        if ($mobile !== $desktop) {
            $this->slider->addDeviceCSS('mobileportrait', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $mobile . '}');
            $this->slider->addDeviceCSS('mobilelandscape', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $mobile . '}');

        }

        $this->javaScriptProperties['responsive']['border'] = max(0, intval($params->get('border-width', 0)));

        $this->javaScriptProperties['parallax']['enabled'] = 0;

        $this->style .= $css->getCSS();
    }

    protected function renderTypeSingle($css) {

        $params = $this->slider->params;

        Js::addStaticGroup(SliderTypeCarousel::getAssetsPath() . '/dist/ss-carousel-single.min.js', 'ss-carousel-single');

        $this->jsDependency[] = 'ss-carousel-single';

        $sliderCSS = $params->get('slider-css');

        $this->initSliderBackground('.n2-ss-slider-2');

        $this->initParticleJS();

        echo wp_kses($this->openSliderElement(), Sanitize::$basicTags);
        ob_start();
        ?>
        <div class="n2-ss-slider-1 n2_ss__touch_element n2-ow">
            <div class="n2-ss-slider-2 n2-ow" style="<?php echo esc_attr($sliderCSS); ?>">
                <?php
                echo wp_kses($this->getBackgroundVideo($params), Sanitize::$videoTags);
                ?>
                <div class="n2-ss-slider-3 n2-ow">
                    <?php
                    $this->displaySizeSVGs($css, true);

                    // PHPCS - Content already escaped
                    echo $this->slider->staticHtml; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                    ?>
                    <div class="n2-ss-slider-pane-single n2-ow">
                        <div class="n2-ss-slider-pipeline n2-ow" style="--slide-width:<?php echo esc_attr($css->base['slideWidth']); ?>px;">
                            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 <?php echo esc_attr($css->base['slideWidth'] . ' ' . $css->base['slideHeight']); ?>" class="n2-ow n2-ss-preserve-size n2-ss-slide-limiter"></svg>
                            <?php

                            foreach ($this->slider->getSlides() as $i => $slide) {
                                $slide->finalize();

                                // PHPCS - Content already escaped
                                echo Html::tag('div', Html::mergeAttributes($slide->attributes, $slide->linkAttributes, array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                                                                                                                               'class' => 'n2-ss-slide ' . $slide->classes . ' n2-ow',
                                                                                                                               'style' => $slide->style . $params->get('slide-css')
                                )), $slide->background . $slide->getHTML());
                            }
                            ?></div>
                    </div>
                </div>
                <?php
                $this->renderShapeDividers();
                ?>
            </div>
        </div>
        <?php
        echo $this->widgets->wrapSlider(ob_get_clean()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        echo wp_kses($this->closeSliderElement(), Sanitize::$basicTags);

        $this->javaScriptProperties['mainanimation'] = array(
            'duration' => intval($params->get('animation-duration')),
            'ease'     => $params->get('animation-easing')
        );

        $this->slider->addDeviceCSS('all', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{max-width:' . intval($params->get('maximum-pane-width')) . 'px;}');


        $this->javaScriptProperties['carousel']                      = intval($params->get('carousel'));
        $this->javaScriptProperties['maxPaneWidth']                  = intval($params->get('maximum-pane-width'));
        $this->javaScriptProperties['responsive']['minimumSlideGap'] = intval($params->get('minimum-slide-gap'));
        $this->javaScriptProperties['responsive']['justifySlides']   = intval($params->get('slider-side-spacing', 1));

        $sideSpacing = array();

        if ($params->get('side-spacing-desktop-enable', 0)) {
            $sideSpacing['desktop'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-desktop'))), 4, 0);
        } else {
            $sideSpacing['desktop'] = array(
                0,
                0,
                0,
                0
            );
        }

        if ($params->get('side-spacing-tablet-enable', 0)) {
            $sideSpacing['tablet'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-tablet'))), 4, 0);
        } else {
            $sideSpacing['tablet'] = $sideSpacing['desktop'];
        }

        if ($params->get('side-spacing-mobile-enable', 0)) {
            $sideSpacing['mobile'] = array_pad(array_map('intval', explode('|*|', $params->get('side-spacing-mobile'))), 4, 0);
        } else {
            $sideSpacing['mobile'] = $sideSpacing['tablet'];
        }

        $desktop = implode('px ', $sideSpacing['desktop']) . 'px';
        $this->slider->addDeviceCSS('all', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $desktop . '}');

        $tablet = implode('px ', $sideSpacing['tablet']) . 'px';
        if ($tablet !== $desktop) {
            $this->slider->addDeviceCSS('tabletportrait', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $tablet . '}');
            $this->slider->addDeviceCSS('tabletlandscape', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $tablet . '}');

        }
        $mobile = implode('px ', $sideSpacing['mobile']) . 'px';
        if ($mobile !== $desktop) {
            $this->slider->addDeviceCSS('mobileportrait', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $mobile . '}');
            $this->slider->addDeviceCSS('mobilelandscape', 'div#' . $this->slider->elementId . ' .n2-ss-slider-3{padding:' . $mobile . '}');

        }

        $this->style .= $css->getCSS();
    }


    public function getScript() {
        if ($this->slider->params->get('animation') === 'horizontal' && $this->slider->params->get('single-switch', 0)) {
            return "_N2.r(" . json_encode(array_unique($this->jsDependency)) . ",function(){new _N2.SmartSliderCarouselSingle('{$this->slider->elementId}', " . $this->encodeJavaScriptProperties() . ");});";
        } else {
            return "_N2.r(" . json_encode(array_unique($this->jsDependency)) . ",function(){new _N2.SmartSliderCarousel('{$this->slider->elementId}', " . $this->encodeJavaScriptProperties() . ");});";
        }
    }

    /**
     * @param $params Data
     */
    public function limitParams($params) {
        $limitParams = array(
            'widget-bar-enabled'        => 0,
            'widget-fullscreen-enabled' => 0,
            'responsiveLimitSlideWidth' => 0,
            'imageloadNeighborSlides'   => 0,
            'slider-size-override'      => 0
        );

        if ($params->get('responsive-mode') === 'fullpage') {
            $limitParams['responsive-mode'] = 'auto';
        }

        $params->loadArray($limitParams);
    }
}PostBackgroundAnimation/ModelPostBackgroundAnimation.php000064400000004135152355233130017615 0ustar00<?php


namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Fieldset\FieldsetVisualSet;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Visual\ModelVisual;

class ModelPostBackgroundAnimation extends ModelVisual {

    protected $type = 'postbackgroundanimation';

    protected function init() {

        PostBackgroundAnimationStorage::getInstance();

        $this->storage = StorageSectionManager::getStorage('smartslider');
    }

    protected function getPath() {
        return dirname(__FILE__);
    }

    public function renderSetsForm() {

        $form = new Form($this, $this->type . 'set');
        $form->addClass('n2_fullscreen_editor__content_sidebar_top_bar');
        $form->setDark();

        $setsTab = new FieldsetVisualSet($form->getContainer(), 'postbackgroundanimation-sets', n2_('Animation type'));
        new Select($setsTab, 'sets', false);

        $form->render();
    }

    public function renderForm() {
        $form = new Form($this, 'n2-post-background');

        $table = new ContainerTable($form->getContainer(), 'post-background-preview', n2_('Preview'));

        $table->setFieldsetPositionEnd();

        new NumberAutoComplete($table->getFieldsetLabel(), 'transformorigin-x', false, '50', array(
            'style'    => 'width:22px;',
            'values'   => array(
                0,
                50,
                100
            ),
            'unit'     => '%',
            'sublabel' => 'X'
        ));

        new NumberAutoComplete($table->getFieldsetLabel(), 'transformorigin-y', false, '50', array(
            'style'    => 'width:22px;',
            'values'   => array(
                0,
                50,
                100
            ),
            'unit'     => '%',
            'sublabel' => 'Y'
        ));

        $form->render();
    }
}PostBackgroundAnimation/PostBackgroundAnimationManager.php000064400000001032152355233130020120 0ustar00<?php


namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation;


use Nextend\Framework\Pattern\VisualManagerTrait;
use Nextend\SmartSlider3Pro\PostBackgroundAnimation\Block\PostBackgroundAnimationManager\BlockPostBackgroundAnimationManager;

class PostBackgroundAnimationManager {

    use VisualManagerTrait;

    public function display() {

        $postBackgroundAnimationManagerBlock = new BlockPostBackgroundAnimationManager($this->MVCHelper);
        $postBackgroundAnimationManagerBlock->display();
    }

}PostBackgroundAnimation/PostBackgroundAnimationStorage.php000064400000005210152355233130020154 0ustar00<?php

namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation;

use Nextend\Framework\Pattern\SingletonTrait;
use Nextend\Framework\Plugin;

class PostBackgroundAnimationStorage {

    use SingletonTrait;

    private $sets = array();

    private $animation = array();

    private $animationBySet = array();

    private $animationById = array();

    protected function init() {
        Plugin::addAction('smartsliderpostbackgroundanimationset', array(
            $this,
            'animationSet'
        ));
        Plugin::addAction('smartsliderpostbackgroundanimation', array(
            $this,
            'animations'
        ));
        Plugin::addAction('postbackgroundanimation', array(
            $this,
            'animation'
        ));
    }

    private function load() {
        static $loaded;
        if (!$loaded) {
            Plugin::doAction('postBackgroundAnimationStorage', array(
                &$this->sets,
                &$this->animation
            ));

            for ($i = 0; $i < count($this->animation); $i++) {
                if (!isset($this->animationBySet[$this->animation[$i]['referencekey']])) {
                    $this->animationBySet[$this->animation[$i]['referencekey']] = array();
                }
                $this->animationBySet[$this->animation[$i]['referencekey']][] = &$this->animation[$i];
                $this->animationById[$this->animation[$i]['id']]              = &$this->animation[$i];
            }
            $loaded = true;
        }
    }

    public function animationSet($referenceKey, &$sets) {
        $this->load();

        for ($i = count($this->sets) - 1; $i >= 0; $i--) {
            $this->sets[$i]['isSystem'] = 1;
            $this->sets[$i]['editable'] = 0;
            array_unshift($sets, $this->sets[$i]);
        }

    }

    public function animations($referenceKey, &$animation) {
        $this->load();
        if (isset($this->animationBySet[$referenceKey])) {
            $_animation = &$this->animationBySet[$referenceKey];
            for ($i = count($_animation) - 1; $i >= 0; $i--) {
                $_animation[$i]['isSystem'] = 1;
                $_animation[$i]['editable'] = 0;
                array_unshift($animation, $_animation[$i]);
            }

        }
    }

    public function animation($id, &$animation) {
        $this->load();
        if (isset($this->animationById[$id])) {
            $this->animationById[$id]['isSystem'] = 1;
            $this->animationById[$id]['editable'] = 0;
            $animation                            = $this->animationById[$id];
        }
    }
}PostBackgroundAnimation/Block/PostBackgroundAnimationManager/BlockPostBackgroundAnimationManager.php000064400000003342152355233130030213 0ustar00<?php


namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation\Block\PostBackgroundAnimationManager;


use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Visual\AbstractBlockVisual;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonApply;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonCancel;
use Nextend\SmartSlider3Pro\PostBackgroundAnimation\ModelPostBackgroundAnimation;

class BlockPostBackgroundAnimationManager extends AbstractBlockVisual {

    /** @var ModelPostBackgroundAnimation */
    protected $model;

    /**
     * @return ModelPostBackgroundAnimation
     */
    public function getModel() {
        return $this->model;
    }

    public function display() {

        $this->model = new ModelPostBackgroundAnimation($this);

        $this->renderTemplatePart('Index');
    }

    public function displayTopBar() {

        $buttonCancel = new BlockButtonCancel($this);
        $buttonCancel->addClass('n2_fullscreen_editor__cancel');
        $buttonCancel->display();

        $buttonApply = new BlockButtonApply($this);
        $buttonApply->addClass('n2_fullscreen_editor__save');
        $buttonApply->display();
    }

    public function displayContent() {
        $model = $this->getModel();

        $sets = $model->getSets();

        Js::addFirstCode("
            new _N2.PostBgAnimationManager({
                setsIdentifier: '" . $model->getType() . "set',
                sets: " . json_encode($sets) . ",
                visuals: {},
                ajaxUrl: '" . $this->createAjaxUrl(array('postbackgroundanimation/index')) . "'
            });
        ");

        $model->renderForm();
    }
}PostBackgroundAnimation/Block/PostBackgroundAnimationManager/Index.php000064400000002222152355233130022223 0ustar00<?php

namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation\Block\PostBackgroundAnimationManager;

/**
 * @var BlockPostBackgroundAnimationManager $this
 */
?>

<div id="n2-lightbox-postbackgroundanimation" class="n2_fullscreen_editor">
    <div class="n2_fullscreen_editor__overlay"></div>
    <div class="n2_fullscreen_editor__window">
        <div class="n2_fullscreen_editor__nav_bar">
            <div class="n2_fullscreen_editor__nav_bar_label">
                <?php n2_e('Ken Burns effect'); ?>
            </div>
            <div class="n2_fullscreen_editor__nav_bar_actions">
                <?php $this->displayTopBar(); ?>
            </div>
        </div>
        <div class="n2_fullscreen_editor__content">
            <div class="n2_fullscreen_editor__content_sidebar n2_container_scrollable">
                <?php
                $this->getModel()
                     ->renderSetsForm();
                ?>
            </div>
            <div class="n2_fullscreen_editor__content_content n2_container_scrollable">
                <?php $this->displayContent(); ?>
            </div>
        </div>
    </div>
</div>LayerAnimation/LayerAnimationStorage.php000064400000107531152355233130014443 0ustar00<?php


namespace Nextend\SmartSlider3Pro\LayerAnimation;


use Nextend\Framework\Pattern\SingletonTrait;

class LayerAnimationStorage {

    use SingletonTrait;

    protected $data = array(
        'in'   => array(),
        'loop' => array(),
        'out'  => array()
    );

    protected function init() {

        $this->data['in']   = array(
            'fade'    => array(
                'icon'  => 'ssi_24--fade',
                'label' => n2_('Fade'),
                'a'     => $this->inFade()
            ),
            'move'    => array(
                'icon'  => 'ssi_24--move',
                'label' => n2_('Move'),
                'a'     => $this->inMove()
            ),
            'reveal'  => array(
                'icon'  => 'ssi_24--reveal',
                'label' => n2_('Reveal'),
                'a'     => $this->inReveal()
            ),
            'scale'   => array(
                'icon'  => 'ssi_24--scale',
                'label' => n2_('Scale'),
                'a'     => $this->inScale()
            ),
            'flip'    => array(
                'icon'  => 'ssi_24--flip',
                'label' => n2_('Flip'),
                'a'     => $this->inFlip()
            ),
            'rotate'  => array(
                'icon'  => 'ssi_24--rotate',
                'label' => n2_('Rotate'),
                'a'     => $this->inRotate()
            ),
            'bounce'  => array(
                'icon'  => 'ssi_24--bounce',
                'label' => n2_('Bounce'),
                'a'     => $this->inBounce()
            ),
            'special' => array(
                'icon'  => 'ssi_24--special',
                'label' => n2_('Special'),
                'a'     => $this->inSpecial()
            )
        );
        $this->data['loop'] = array(
            'special' => array(
                'icon'  => 'ssi_24--special',
                'label' => n2_('Special'),
                'a'     => $this->loopSpecial()
            )
        );
        $this->data['out']  = array(
            'fade' => array(
                'icon'  => 'ssi_24--fade',
                'label' => n2_('Fade'),
                'a'     => $this->outFade()
            ),
        );
    }

    /**
     * @return string
     */
    public function getData() {

        return json_encode($this->data);
    }

    private function inFade() {
        return array(
            array(
                'type'      => 'basic',
                'name'      => n2_('Fade'),
                'keyFrames' => array(
                    array(
                        'opacity' => 0
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Blur'),
                'keyFrames' => array(
                    array(
                        'n2blur'  => 10,
                        'opacity' => 0
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Left fade'),
                'keyFrames' => array(
                    array(
                        'opacity' => 0,
                        'x'       => 400
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Right fade'),
                'keyFrames' => array(
                    array(
                        'opacity' => 0,
                        'x'       => -400
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Top fade'),
                'keyFrames' => array(
                    array(
                        'opacity' => 0,
                        'y'       => 400
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Bottom fade'),
                'keyFrames' => array(
                    array(
                        'opacity' => 0,
                        'y'       => -400
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Flash'),
                'keyFrames' => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.25,
                        'opacity'  => 1
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.25,
                        'opacity'  => 0
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.25,
                        'opacity'  => 1
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.25,
                        'opacity'  => 0
                    )
                )
            ),
        );
    }

    private function inMove() {
        return array(
            array(
                'type'      => 'basic',
                'name'      => n2_('Left'),
                'keyFrames' => array(
                    array(
                        'x' => 400
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Right'),
                'keyFrames' => array(
                    array(
                        'x' => -400
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Top'),
                'keyFrames' => array(
                    array(
                        'y' => 400
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Bottom'),
                'keyFrames' => array(
                    array(
                        'y' => -400
                    )
                )
            )
        );
    }

    private function inReveal() {
        return array(
            array(
                'type' => 'reveal',
                'name' => n2_('Left to Right'),
                'data' => array(
                    'from' => 'left',
                    'to'   => 'right'
                )
            ),
            array(
                'type' => 'reveal',
                'name' => n2_('Top to Bottom'),
                'data' => array(
                    'from' => 'top',
                    'to'   => 'bottom'
                )
            ),
            array(
                'type' => 'reveal',
                'name' => n2_('Skew Left to Right'),
                'data' => array(
                    'from' => 'skew-left',
                    'to'   => 'skew-right'
                )
            ),
            array(
                'type' => 'reveal',
                'name' => n2_('Curtains'),
                'data' => array(
                    'from' => 'curtains-horizontal',
                    'to'   => 'curtains-horizontal'
                )
            ),
            array(
                'type' => 'reveal',
                'name' => n2_('Rotate'),
                'data' => array(
                    'from' => 'rotate-top-left',
                    'to'   => 'rotate-top-left-'
                )
            ),
            array(
                'type' => 'reveal',
                'name' => n2_('Circle'),
                'data' => array(
                    'from' => 'circle-left',
                    'to'   => 'circle-right'
                )
            )
        );
    }

    private function inScale() {
        return array(
            array(
                'type'      => 'basic',
                'name'      => n2_('Downscale'),
                'keyFrames' => array(
                    array(
                        'scaleX'  => 2,
                        'scaleY'  => 2,
                        'opacity' => 0
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Upscale'),
                'keyFrames' => array(
                    array(
                        'scaleX' => 0,
                        'scaleY' => 0
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Downscale back out'),
                'keyFrames' => array(
                    array(
                        'ease'    => 'easeOutBack',
                        'opacity' => 0,
                        'scaleX'  => 1.2,
                        'scaleY'  => 1.2
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Upscale back out'),
                'keyFrames' => array(
                    array(
                        'ease'    => 'easeOutBack',
                        'opacity' => 0,
                        'scaleX'  => 0.8,
                        'scaleY'  => 0.8
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Pulse'),
                'keyFrames' => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.5
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.5,
                        'scaleX'   => 1.05,
                        'scaleY'   => 1.05
                    )
                )
            ),
        );
    }

    private function inFlip() {
        return array(
            array(
                'type'            => 'basic',
                'name'            => n2_('Flip left'),
                'transformOrigin' => '0|*|50|*|0',
                'keyFrames'       => array(
                    array(
                        'opacity'   => 0,
                        'rotationY' => -90
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Flip right'),
                'transformOrigin' => '100|*|50|*|0',
                'keyFrames'       => array(
                    array(
                        'opacity'   => 0,
                        'rotationY' => 90
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Flip down'),
                'transformOrigin' => '50|*|0|*|0',
                'keyFrames'       => array(
                    array(
                        'opacity'   => 0,
                        'rotationX' => 90
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Flip up'),
                'transformOrigin' => '50|*|100|*|0',
                'keyFrames'       => array(
                    array(
                        'opacity'   => 0,
                        'rotationX' => -90
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Flip in X'),
                'keyFrames' => array(
                    array(
                        'duration'  => 0.4,
                        'opacity'   => 0,
                        'rotationY' => -90
                    ),
                    array(
                        'duration'  => 0.2,
                        'opacity'   => 0.5,
                        'rotationY' => 20
                    ),
                    array(
                        'duration'  => 0.2,
                        'opacity'   => 1,
                        'rotationY' => -10
                    ),
                    array(
                        'duration'  => 0.2,
                        'rotationY' => 5
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Flip in Y'),
                'keyFrames' => array(
                    array(
                        'duration'  => 0.4,
                        'opacity'   => 0,
                        'rotationX' => -90
                    ),
                    array(
                        'duration'  => 0.2,
                        'opacity'   => 0.5,
                        'rotationX' => 20
                    ),
                    array(
                        'duration'  => 0.2,
                        'opacity'   => 1,
                        'rotationX' => -10
                    ),
                    array(
                        'duration'  => 0.2,
                        'rotationX' => 5
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Flap'),
                'keyFrames' => array(
                    array(
                        'duration'  => 0.5,
                        'opacity'   => 0,
                        'rotationX' => 90
                    ),
                    array(
                        'duration'  => 0.5,
                        'opacity'   => 1,
                        'rotationX' => -50
                    )
                )
            )
        );
    }

    private function inRotate() {
        return array(
            array(
                'type'            => 'basic',
                'name'            => n2_('Rotate top left'),
                'transformOrigin' => '0|*|0|*|0',
                'keyFrames'       => array(
                    array(
                        'duration'  => 1,
                        'opacity'   => 0,
                        'rotationZ' => 90
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Rotate top right'),
                'transformOrigin' => '100|*|0|*|0',
                'keyFrames'       => array(
                    array(
                        'duration'  => 1,
                        'opacity'   => 0,
                        'rotationZ' => -90
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Roll in'),
                'keyFrames' => array(
                    array(
                        'duration'  => 1,
                        'x'         => 500,
                        'rotationZ' => 360
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Rotate top left back out'),
                'transformOrigin' => '0|*|0|*|0',
                'keyFrames'       => array(
                    array(
                        'ease'      => 'easeOutBack',
                        'rotationZ' => 180
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Rotate all axis'),
                'transformOrigin' => '0|*|0|*|0',
                'keyFrames'       => array(
                    array(
                        'opacity'   => 0,
                        'rotationX' => 90,
                        'rotationY' => 20,
                        'rotationZ' => 20
                    )
                )
            )
        );
    }

    private function inBounce() {
        return array(
            array(
                'type'      => 'basic',
                'name'      => n2_('Bounce'),
                'keyFrames' => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.18
                    ),
                    array(
                        'ease'     => 'easeInQuint',
                        'duration' => 0.18,
                        'y'        => 30
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.15
                    ),
                    array(
                        'ease'     => 'easeInQuint',
                        'duration' => 0.15,
                        'y'        => 15
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.12
                    ),
                    array(
                        'ease'     => 'easeInQuint',
                        'duration' => 0.12,
                        'y'        => 8
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Bounce in'),
                'keyFrames' => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.2,
                        'opacity'  => 0,
                        'scaleX'   => 0.3,
                        'scaleY'   => 0.3
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.2,
                        'opacity'  => .33,
                        'scaleX'   => 1.1,
                        'scaleY'   => 1.1
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.2,
                        'opacity'  => .66,
                        'scaleX'   => .9,
                        'scaleY'   => .9
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.2,
                        'opacity'  => 1,
                        'scaleX'   => 1.03,
                        'scaleY'   => 1.03
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.2,
                        'opacity'  => 1,
                        'scaleX'   => .97,
                        'scaleY'   => .97
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Bounce in left'),
                'keyFrames' => array(
                    array(
                        'duration' => 0.6,
                        'opacity'  => 0,
                        'x'        => 3000
                    ),
                    array(
                        'duration' => 0.15,
                        'opacity'  => 1,
                        'x'        => -25
                    ),
                    array(
                        'duration' => 0.15,
                        'x'        => 10
                    ),
                    array(
                        'duration' => 0.15,
                        'x'        => -5
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Bounce in right'),
                'keyFrames' => array(
                    array(
                        'duration' => 0.6,
                        'opacity'  => 0,
                        'x'        => -3000
                    ),
                    array(
                        'duration' => 0.15,
                        'opacity'  => 1,
                        'x'        => 25
                    ),
                    array(
                        'duration' => 0.15,
                        'x'        => -10
                    ),
                    array(
                        'duration' => 0.15,
                        'x'        => 5
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Bounce in down'),
                'keyFrames' => array(
                    array(
                        'duration' => 0.6,
                        'opacity'  => 0,
                        'y'        => 3000
                    ),
                    array(
                        'duration' => 0.15,
                        'opacity'  => 1,
                        'y'        => -25
                    ),
                    array(
                        'duration' => 0.15,
                        'y'        => 10
                    ),
                    array(
                        'duration' => 0.15,
                        'y'        => -5
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Bounce in up'),
                'keyFrames' => array(
                    array(
                        'duration' => 0.6,
                        'opacity'  => 0,
                        'y'        => -3000
                    ),
                    array(
                        'duration' => 0.15,
                        'opacity'  => 1,
                        'y'        => 25
                    ),
                    array(
                        'duration' => 0.15,
                        'y'        => -10
                    ),
                    array(
                        'duration' => 0.15,
                        'y'        => 5
                    )
                )
            )
        );
    }

    private function inSpecial() {
        return array(
            array(
                'type'      => 'basic',
                'name'      => n2_('Rubber band'),
                'keyFrames' => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.3
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'scaleX'   => 1.25,
                        'scaleY'   => 0.75
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'scaleX'   => 0.75,
                        'scaleY'   => 1.25
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.15,
                        'scaleX'   => 1.15,
                        'scaleY'   => 0.85
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'scaleX'   => 0.95,
                        'scaleY'   => 1.05
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.25,
                        'scaleX'   => 1.05,
                        'scaleY'   => 0.95
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Shake'),
                'keyFrames' => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => 10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => -10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => 10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => -10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => 10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => -10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => 10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => -10
                    ),
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1,
                        'x'        => 10
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Swing'),
                'transformOrigin' => '50|*|0|*|0',
                'keyFrames'       => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.2
                    ),
                    array(
                        'duration'  => 0.2,
                        'rotationZ' => -15
                    ),
                    array(
                        'duration'  => 0.2,
                        'rotationZ' => 10
                    ),
                    array(
                        'duration'  => 0.2,
                        'rotationZ' => -5
                    ),
                    array(
                        'duration'  => 0.2,
                        'rotationZ' => 5
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Wooble'),
                'keyFrames' => array(
                    array(
                        'ease'     => 'easeOutCubic',
                        'duration' => 0.1
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 0.9,
                        'scaleY'    => 0.9,
                        'rotationZ' => 3
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 0.9,
                        'scaleY'    => 0.9,
                        'rotationZ' => 3
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 1.1,
                        'scaleY'    => 1.1,
                        'rotationZ' => -3
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 1.1,
                        'scaleY'    => 1.1,
                        'rotationZ' => 3,
                        'x'         => -10
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 1.1,
                        'scaleY'    => 1.1,
                        'rotationZ' => -3,
                        'x'         => 10
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 1.1,
                        'scaleY'    => 1.1,
                        'rotationZ' => 3,
                        'x'         => -10
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 1.1,
                        'scaleY'    => 1.1,
                        'rotationZ' => -3,
                        'x'         => 10
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 1.1,
                        'scaleY'    => 1.1,
                        'rotationZ' => 3
                    ),
                    array(
                        'duration'  => 0.1,
                        'scaleX'    => 1.1,
                        'scaleY'    => 1.1,
                        'rotationZ' => -3
                    )
                )
            )
        );
    }

    private function loopSpecial() {
        return array(
            array(
                'type'      => 'basic',
                'name'      => n2_('Pulse'),
                'keyFrames' => array(
                    array(
                        'duration' => .5,
                        'scaleX'   => 1.05,
                        'scaleY'   => 1.05
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Shrink'),
                'keyFrames' => array(
                    array(
                        'duration' => .5,
                        'scaleX'   => .8,
                        'scaleY'   => .8
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_x('Slide', 'Animation'),
                'keyFrames' => array(
                    array(
                        'duration' => .5,
                        'x'        => 200
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Roll'),
                'keyFrames' => array(
                    array(
                        'ease'      => 'linear',
                        'duration'  => 1,
                        'rotationZ' => 360
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Grow rotate'),
                'keyFrames' => array(
                    array(
                        'duration'  => 0.5,
                        'rotationZ' => 10,
                        'scaleX'    => 1.15,
                        'scaleY'    => 1.15
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Skew'),
                'keyFrames' => array(
                    array(
                        'duration' => 0.5,
                        'skewX'    => -15
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Swing'),
                'transformOrigin' => '50|*|0|*|0',
                'keyFrames'       => array(
                    array(
                        'duration'  => 0.5,
                        'rotationZ' => 10
                    ),
                    array(
                        'duration'  => 0.5,
                        'rotationZ' => -10
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Pendulum'),
                'transformOrigin' => '50|*|-300|*|0',
                'keyFrames'       => array(
                    array(
                        'duration'  => 0.5,
                        'rotationZ' => 10
                    ),
                    array(
                        'duration'  => 0.5,
                        'rotationZ' => -10
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Pendulum 3D'),
                'transformOrigin' => '50|*|-80|*|20',
                'keyFrames'       => array(
                    array(
                        'duration'  => 2,
                        'x'         => 30,
                        'rotationX' => 8,
                        'rotationY' => 10
                    ),
                    array(
                        'duration'  => 2,
                        'x'         => -30,
                        'rotationX' => 8,
                        'rotationY' => -10
                    )
                )
            ),
            array(
                'type'            => 'basic',
                'name'            => n2_('Vertical pendulum 3D'),
                'transformOrigin' => '-80|*|50|*|20',
                'keyFrames'       => array(
                    array(
                        'duration'  => 2,
                        'y'         => 30,
                        'rotationX' => -10
                    ),
                    array(
                        'duration'  => 2,
                        'y'         => -30,
                        'rotationX' => 10
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Shake'),
                'keyFrames' => array(
                    array(
                        'duration' => .05,
                        'x'        => 10
                    ),
                    array(
                        'duration' => .05,
                        'x'        => -10
                    ),
                    array(
                        'duration'  => .05,
                        'x'         => 10,
                        'rotationZ' => 3
                    ),
                    array(
                        'duration'  => .05,
                        'y'         => 10,
                        'rotationZ' => -3
                    ),
                    array(
                        'duration'  => .05,
                        'x'         => 10,
                        'rotationZ' => -2
                    ),
                    array(
                        'duration'  => .05,
                        'x'         => 10,
                        'y'         => -5,
                        'rotationZ' => 3
                    )
                )
            )
        );
    }

    private function outFade() {
        return array(
            array(
                'type'      => 'basic',
                'name'      => n2_('Fade'),
                'keyFrames' => array(
                    array(
                        'opacity' => 0
                    )
                )
            ),
            array(
                'type'      => 'basic',
                'name'      => n2_('Blur'),
                'keyFrames' => array(
                    array(
                        'n2blur'  => 10,
                        'opacity' => 0
                    )
                )
            ),
            array(
                'type' => 'reveal',
                'name' => n2_('Reveal'),
                'data' => array(
                    'from' => 'left',
                    'to'   => 'right'
                )
            )
        );
    }
}Generator/GeneratorLoader.php000064400000001067152355233130012266 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Generator;


use Nextend\Framework\Plugin;
use Nextend\SmartSlider3Pro\Generator;

class GeneratorLoader {

    public function __construct() {

        Plugin::addAction('PluggableFactorySliderGenerator', array(
            $this,
            'sliderGenerator'
        ));
    }

    public function sliderGenerator() {
        new Generator\Common\GeneratorCommonLoader();
        new Generator\Joomla\GeneratorJoomlaLoader();
    
    }

    public function sliderGeneratorRESTLoader() {
    }
}Generator/Joomla/GeneratorJoomlaLoader.php000064400000000305152355233130014643 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Generator\Joomla;


use Nextend\SmartSlider3\Generator\AbstractGeneratorLoader;

class GeneratorJoomlaLoader extends AbstractGeneratorLoader {

}Generator/Joomla/Virtuemart/GeneratorGroupVirtuemart.php000064400000002202152355233130017612 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Sources\VirtuemartProducts;

class GeneratorGroupVirtuemart extends AbstractGeneratorGroup {

    protected $name = 'virtuemart';

    protected $url = 'https://extensions.joomla.org/extension/virtuemart/';

    public function getLabel() {
        return 'VirtueMart';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'VirtueMart');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php');
    }

    protected function loadSources() {
        new VirtuemartProducts($this, 'products', n2_('Products'));
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupVirtuemart);
Generator/Joomla/Virtuemart/Sources/VirtuemartProducts.php000064400000040354152355233130020107 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Sources;

use CurrencyDisplay;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Elements\VirtuemartCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Elements\VirtuemartManufacturers;
use Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Elements\VirtuemartLanguages;
use VirtueMartModelProduct;
use VmConfig;

class VirtuemartProducts extends AbstractGenerator {

    protected $layout = 'product', $media_product_path, $media_product_path_resized, $resized_extensions = array(), $extensions = array(
        '.jpg',
        '.jpeg',
        '.png',
        '.svg',
        '.gif',
        '.webp',
        '.JPG',
        '.JPEG',
        '.PNG',
        '.SVG',
        '.GIF',
        '.WEBP'
    );

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'VirtueMart');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new VirtuemartCategories($source, 'virtuemartcategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new VirtuemartManufacturers($source, 'virtuemartmanufacturers', n2_('Manufacturer'), 0, array(
            'isMultiple' => true
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'virtuemartfeatured', n2_('Featured'), 0);
        new Filter($limit, 'virtuemartinstock', n2_('In stock'), 0);
        new VirtuemartLanguages($limit, 'virtuemartlanguage', n2_('Language'), 0);
        new VirtuemartLanguages($limit, 'fallbacklanguage', n2_('Fallback language'), '');
        new OnOff($limit, 'virtuemartparentonly', n2_('Show parent products only'), 0);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'virtuemartproductsorder', 'prod.created_on|*|desc', array(
            'options' => array(
                ''                      => n2_('None'),
                'prod_ext.product_name' => n2_('Product name'),
                'cat.category_name'     => n2_('Category'),
                'prod.product_special'  => 'Special',
                'cat_x.ordering'        => n2_('Ordering'),
                'prod.hits'             => n2_('Hits'),
                'prod.created_on'       => n2_('Creation time'),
                'prod.modified_on'      => n2_('Modification time'),
                'rand()'                => n2_('Random')
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php');
        VmConfig::loadConfig();

        $language = $this->data->get('virtuemartlanguage', 0);
        if (!$language) $language = VMLANG;

        $fallbackLanguage = $this->data->get('fallbacklanguage', '');

        $categories    = array_map('intval', explode('||', $this->data->get('virtuemartcategories', '')));
        $manufacturers = array_map('intval', explode('||', $this->data->get('virtuemartmanufacturers', '')));

        $query = 'SELECT ';
        $query .= 'prod.virtuemart_product_id AS id, ';
        $query .= 'prod.product_sku AS sku, ';
        $query .= 'prod_ext.product_name AS name, ';
        $query .= 'prod_ext.product_s_desc AS short_description, ';
        $query .= 'prod_ext.product_desc AS description, ';
        $query .= 'prod_ext.slug AS slug, ';

        $query .= 'cat.virtuemart_category_id AS category_id, ';
        $query .= 'cat.category_name AS category_name, ';
        $query .= 'cat.category_description AS category_description, ';
        $query .= 'cat.slug AS category_slug, ';

        $query .= 'man.virtuemart_manufacturer_id AS manufacturer_id, ';
        $query .= 'man.mf_name AS manufacturer_name, ';
        $query .= 'man.mf_email AS manufacturer_email, ';
        $query .= 'man.mf_desc AS manufacturer_description, ';
        $query .= 'man.mf_url AS manufacturer_url, ';
        $query .= 'man.slug AS manufacturer_slug, ';

        if (!empty($fallbackLanguage)) {
            $query .= 'prod_ext_fb.product_name AS title_fb, ';
            $query .= 'prod_ext_fb.product_s_desc AS short_description_fb, ';
            $query .= 'prod_ext_fb.product_desc AS description_fb, ';
            $query .= 'prod_ext_fb.slug AS slug_fb, ';

            $query .= 'cat_fb.virtuemart_category_id AS category_id_fb, ';
            $query .= 'cat_fb.category_name AS category_name_fb, ';
            $query .= 'cat_fb.category_description AS category_description_fb, ';
            $query .= 'cat_fb.slug AS category_slug_fb, ';

            $query .= 'man_fb.virtuemart_manufacturer_id AS manufacturer_id_fb, ';
            $query .= 'man_fb.mf_name AS manufacturer_name_fb, ';
            $query .= 'man_fb.mf_email AS manufacturer_email_fb, ';
            $query .= 'man_fb.mf_desc AS manufacturer_description_fb, ';
            $query .= 'man_fb.mf_url AS manufacturer_url_fb, ';
            $query .= 'man_fb.slug AS manufacturer_slug_fb, ';
        }

        $query .= 'med.file_url AS image, ';
        $query .= 'med.file_url_thumb AS thumbnail ';

        $query .= 'FROM #__virtuemart_products AS prod ';

        $query .= 'LEFT JOIN #__virtuemart_products_' . $language . ' AS prod_ext ON prod.virtuemart_product_id = prod_ext.virtuemart_product_id ';

        $query .= 'LEFT JOIN #__virtuemart_product_categories AS cat_x ON cat_x.virtuemart_product_id = prod.virtuemart_product_id ';

        $query .= 'LEFT JOIN #__virtuemart_categories_' . $language . ' AS cat ON cat_x.virtuemart_category_id = cat.virtuemart_category_id ';

        $query .= 'LEFT JOIN #__virtuemart_product_manufacturers AS man_x ON man_x.virtuemart_product_id = prod.virtuemart_product_id ';

        $query .= 'LEFT JOIN #__virtuemart_manufacturers_' . $language . ' AS man ON man_x.virtuemart_manufacturer_id = man.virtuemart_manufacturer_id ';

        $query .= 'LEFT JOIN #__virtuemart_product_medias AS med_x ON med_x.virtuemart_product_id = prod.virtuemart_product_id ';

        $query .= 'LEFT JOIN #__virtuemart_medias AS med ON med_x.virtuemart_media_id = med.virtuemart_media_id ';

        if (!empty($fallbackLanguage)) {
            $query .= 'LEFT JOIN #__virtuemart_products_' . $fallbackLanguage . ' AS prod_ext_fb ON prod.virtuemart_product_id = prod_ext_fb.virtuemart_product_id ';

            $query .= 'LEFT JOIN #__virtuemart_categories_' . $fallbackLanguage . ' AS cat_fb ON cat_x.virtuemart_category_id = cat_fb.virtuemart_category_id ';

            $query .= 'LEFT JOIN #__virtuemart_manufacturers_' . $fallbackLanguage . ' AS man_fb ON man_x.virtuemart_manufacturer_id = man_fb.virtuemart_manufacturer_id ';
        }

        $where = array(
            ' prod.published = 1 ',
            ' med.file_is_downloadable = 0 ',
            ' med.file_is_forSale = 0 '
        );

        if (!in_array(0, $categories) && count($categories) > 0) {
            $where[] = 'cat_x.virtuemart_category_id IN (' . implode(',', $categories) . ') ';
        }

        if (!in_array(0, $manufacturers) && count($manufacturers) > 0) {
            $where[] = 'man.virtuemart_manufacturer_id IN (' . implode(',', $manufacturers) . ') ';
        }

        switch ($this->data->get('virtuemartfeatured', 0)) {
            case 1:
                $where[] = ' prod.product_special = 1 ';
                break;
            case -1:
                $where[] = ' prod.product_special = 0 ';
                break;
        }

        switch ($this->data->get('virtuemartinstock', 0)) {
            case 1:
                $where[] = ' prod.product_in_stock > 0 ';
                break;
            case -1:
                $where[] = ' prod.product_in_stock = 0 ';
                break;
        }

        if ($this->data->get('virtuemartparentonly', 0)) {
            $where[] = ' prod.virtuemart_product_id IN (SELECT product_parent_id FROM #__virtuemart_products) ';
        }

        $query .= 'WHERE ' . implode(' AND ', $where) . ' GROUP BY prod.virtuemart_product_id ';

        $order = Common::parse($this->data->get('virtuemartproductsorder', 'prod.created_on|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);
        require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php');
        if (!class_exists('VirtueMartModelProduct')) {
            require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'product.php');
        }
        $currency = CurrencyDisplay::getInstance();

        $data = array();
        $ids  = array();

        $this->media_product_path         = VmConfig::get('media_product_path');
        $this->media_product_path_resized = $this->media_product_path . 'resized/';

        $thumbnail_width  = str_replace('px', '', VmConfig::get('img_width'));
        $thumbnail_height = str_replace('px', '', VmConfig::get('img_height'));
        foreach ($this->extensions as $extension) {
            $this->resized_extensions[] = '_' . $thumbnail_width . 'x' . $thumbnail_height . $extension;
        }

        if (is_array($result)) {
            for ($i = 0; $i < count($result); $i++) {
                $productModel = new VirtueMartModelProduct();
                $p            = $productModel->getProduct($result[$i]['id'], TRUE, TRUE, TRUE, 1, 0);
                $ids[]        = $result[$i]['id'];

                $url = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $result[$i]['id'];
                if (!empty($p->categoryItem[0]['virtuemart_category_id']) && $p->categoryItem[0]['virtuemart_category_id'] != 0) {
                    $url .= '&virtuemart_category_id=' . $p->categoryItem[0]['virtuemart_category_id'];
                }

                $r = array(
                    'title'       => $result[$i]['name'],
                    'url'         => $url,
                    'description' => $result[$i]['description']
                );

                $r['image'] = ImageFallback::fallback(array(
                    $result[$i]['image'] == 'images/stories/virtuemart/product/cart_logo.jpg' ? '' : $result[$i]['image']
                ), array(
                    $result[$i]['description'],
                    $result[$i]['short_description']
                ));

                $r['thumbnail'] = ImageFallback::fallback(array(
                    $result[$i]['thumbnail'],
                    $this->thumbnail($result[$i]['image']),
                    $r['image']
                ));

                $r += array(
                    'price'                        => $currency->createPriceDiv('costPrice', '', $p->prices, true),
                    'short_description'            => $result[$i]['short_description'],
                    'category_name'                => $result[$i]['category_name'],
                    'category_description'         => $result[$i]['category_description'],
                    'category_url'                 => !empty($result[$i]['category_id']) ? 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $result[$i]['category_id'] : '',
                    'manufacturer_name'            => $result[$i]['manufacturer_name'],
                    'manufacturer_description'     => $result[$i]['manufacturer_description'],
                    'manufacturer_email'           => $result[$i]['manufacturer_email'],
                    'manufacturer_url'             => $result[$i]['manufacturer_url'],
                    'base_price'                   => $currency->createPriceDiv('basePrice', '', $p->prices, true),
                    'base_price_variant'           => $currency->createPriceDiv('basePriceVariant', '', $p->prices, true),
                    'base_price_with_tax'          => $currency->createPriceDiv('basePriceWithTax', '', $p->prices, true),
                    'discounted_price_without_tax' => $currency->createPriceDiv('discountedPriceWithoutTax', '', $p->prices, true),
                    'price_before_tax'             => $currency->createPriceDiv('priceBeforeTax', '', $p->prices, true),
                    'sales_price'                  => $currency->createPriceDiv('salesPrice', '', $p->prices, true),
                    'tax_amount'                   => $currency->createPriceDiv('taxAmount', '', $p->prices, true),
                    'sales_price_with_discount'    => $currency->createPriceDiv('salesPriceWithDiscount', '', $p->prices, true),
                    'sales_price_temp'             => $currency->createPriceDiv('salesPriceTemp', '', $p->prices, true),
                    'unit_price'                   => $currency->createPriceDiv('unitPrice', '', $p->prices, true),
                    'price_without_tax'            => $currency->createPriceDiv('priceWithoutTax', '', $p->prices, true),
                    'discount_amount'              => $currency->createPriceDiv('discountAmount', '', $p->prices, true),
                    'sku'                          => $result[$i]['sku'],
                    'id'                           => $result[$i]['id'],
                    'category_id'                  => $result[$i]['category_id'],
                    'manufacturer_id'              => $result[$i]['manufacturer_id']
                );

                if (!empty($fallbackLanguage)) {
                    foreach ($r as $key => $value) {
                        if ($value === '' || $value === null) {
                            if (!empty($result[$i][$key . '_fb'])) {
                                $r[$key] = $result[$i][$key . '_fb'];
                            }
                        }
                    }
                }

                $data[] = $r;
            }
        }

        if (!empty($ids)) {
            $query = 'SELECT vm.file_url, vm.file_url_thumb, vpm.virtuemart_product_id  AS id
                        FROM #__virtuemart_medias AS vm 
                        LEFT JOIN #__virtuemart_product_medias AS vpm  
                        ON vm.virtuemart_media_id = vpm.virtuemart_media_id  
                        WHERE vm.virtuemart_media_id IN 
                            (SELECT virtuemart_media_id FROM #__virtuemart_product_medias WHERE virtuemart_product_id IN (' . implode(',', $ids) . '))
                            ORDER BY vpm.ordering';

            $images = Database::queryAll($query);
            for ($i = 0; $i < count($data); $i++) {
                $k = 1;
                for ($j = 0; $j < count($images); $j++) {
                    if ($data[$i]['id'] == $images[$j]['id']) {
                        $data[$i]['image_' . $k]     = ImageFallback::fallback(array($images[$j]['file_url']));
                        $data[$i]['thumbnail_' . $k] = ImageFallback::fallback(array(
                            $images[$j]['file_url_thumb'],
                            $this->thumbnail($images[$j]['file_url']),
                            $images[$j]['file_url']
                        ));
                        $k++;
                    }
                }
            }
        }

        return $data;
    }

    private function thumbnail($image) {
        return str_replace($this->media_product_path, $this->media_product_path_resized, str_replace($this->extensions, $this->resized_extensions, $image));
    }
}
Generator/Joomla/Virtuemart/Elements/VirtuemartCategories.php000064400000003700152355233130020514 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;
use VmConfig;


class VirtuemartCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php');
        VmConfig::loadConfig();
        $query = 'SELECT a.virtuemart_category_id AS id, b.category_parent_id AS parent_id, b.category_parent_id AS parent, c.category_name AS title ' . 'FROM #__virtuemart_categories AS a ' . 'LEFT JOIN #__virtuemart_category_categories AS b ON a.virtuemart_category_id = b.category_child_id ' . 'LEFT JOIN #__virtuemart_categories_' . VMLANG . ' AS c ON a.virtuemart_category_id = c.virtuemart_category_id ' . 'WHERE a.published = 1 ' . 'ORDER BY a.ordering';

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                if (!empty($v->title)) {
                    $pt   = $v->parent_id;
                    $list = isset($children[$pt]) ? $children[$pt] : array();
                    array_push($list, $v);
                    $children[$pt] = $list;
                }
            }
        }

        $this->options['0'] = n2_('All');

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }

    }

}
Generator/Joomla/Virtuemart/Elements/VirtuemartLanguages.php000064400000001253152355233130020336 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Elements;

use Nextend\Framework\Form\Element\Select;
use vmLanguage;


class VirtuemartLanguages extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $this->options['0'] = n2_('default');

        if (vmLanguage::$langCount) {
            foreach (vmLanguage::$langs as $lang) {
                $lang = strtolower(str_replace('-', '_', $lang));

                $this->options[$lang] = $lang;
            }
        }

    }

}
Generator/Joomla/Virtuemart/Elements/VirtuemartManufacturers.php000064400000002142152355233130021245 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Virtuemart\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;
use VmConfig;


class VirtuemartManufacturers extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php');
        VmConfig::loadConfig();
        $query = 'SELECT virtuemart_manufacturer_id AS id, mf_name AS name FROM #__virtuemart_manufacturers_' . VMLANG . ' ORDER BY id';

        $manufacturers = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($manufacturers)) {
            foreach ($manufacturers as $manufacturer) {
                $this->options[$manufacturer->id] = $manufacturer->name;
            }
        }

    }

}
Generator/Joomla/Rseventspro/GeneratorGroupRseventspro.php000064400000002153152355233130020177 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Sources\RseventsproEvents;

class GeneratorGroupRseventspro extends AbstractGeneratorGroup {

    protected $name = 'rseventspro';

    protected $url = 'https://extensions.joomla.org/extension/rsevents-pro/';

    public function getLabel() {
        return 'RSEvents!Pro';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'RSEvents!Pro');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_rseventspro' . DIRECTORY_SEPARATOR . 'rseventspro.php');
    }

    protected function loadSources() {
        new RseventsproEvents($this, 'events', n2_('Events'));
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupRseventspro);
Generator/Joomla/Rseventspro/Sources/RseventsproEvents.php000064400000034512152355233130020127 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Sources;

use DateTime;
use DateTimeZone;
use Joomla\CMS\Factory;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements\RseventsproCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements\RseventsproGroups;
use Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements\RseventsproLocations;
use Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements\RseventsproTags;
use rseventsproHelper;
use RseventsproHelperRoute;


class RseventsproEvents extends AbstractGenerator {

    protected $layout = 'event';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'RSEvents!Pro');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new RseventsproCategories($source, 'sourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new RseventsproGroups($source, 'sourcegroups', n2_('Group'), 0, array(
            'isMultiple' => true
        ));
        new RseventsproLocations($source, 'sourcelocations', n2_('Location'), 0, array(
            'isMultiple' => true
        ));
        new RseventsproTags($source, 'sourcetags', n2_('Tag'), 0, array(
            'isMultiple' => true
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'started', n2_('Started'), 0);
        new Filter($limit, 'ended', n2_('Ended'), -1);
        new Filter($limit, 'featured', n2_('Featured'), 0);
        new Filter($limit, 'allday', n2_('All day event'), 0);
        new Filter($limit, 'recurring', n2_('Recurring events'), 0);
        new MenuItems($limit, 'itemid', n2_('Menu item (item ID)'), 0);


        $date = $filterGroup->createRow('date-row');
        new Text($date, 'rseventsprodate', n2_('Date format'), 'm-d-Y');
        new Text($date, 'rseventsprotime', n2_('Time format'), 'G:i');
        new Textarea($date, 'rseventstranslatedate', n2_('Translate date and time'), 'January->January||February->February||March->March', array(
            'width'  => 300,
            'height' => 100
        ));
        new Text($date, 'rseventsoffset', n2_('Date variable offset'), '', array(
            'tipLabel'       => n2_('Date variable offset'),
            'tipDescription' => n2_('Timezone offset in hours. For example: +2 or -7. If you leave it empty, Joomla\'s System -> Global Configuration -> Server -> Server Time Zone setting will be used.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1920-joomla-rsevents-pro-generator'
        ));

        new Text($date, 'rseventsfilteroffset', n2_('Date filter offset'), '', array(
            'tipLabel'       => n2_('Date filter offset'),
            'tipDescription' => n2_('Timezone offset in hours. For example: +2 or -7. If you leave it empty, Joomla\'s System -> Global Configuration -> Server -> Server Time Zone setting will be used.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1920-joomla-rsevents-pro-generator'
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'rseventsproorder', 'start|*|desc', array(
            'options' => array(
                ''        => n2_('None'),
                'start'   => n2_('Start date'),
                'end'     => n2_('End date'),
                'created' => n2_('Creation date'),
                'name'    => n2_('Title'),
                'hits'    => n2_('Hits'),
                'id'      => 'ID'
            )
        ));
    }

    private function translate($from, $translate) {
        if (!empty($translate) && !empty($from)) {
            foreach ($translate as $key => $value) {
                $from = str_replace($key, $value, $from);
            }
        }

        return $from;
    }

    private function formatDate($datetime, $format = 'Y-m-d', $strtotime = true) {
        if ($datetime != '0000-00-00 00:00:00') {
            if ($strtotime) {
                $datetime = strtotime($datetime);
            }

            return date($format, $datetime);
        } else {
            return '';
        }
    }

    protected function _getData($count, $startIndex) {
        require_once(JPATH_SITE . '/components/com_rseventspro/helpers/rseventspro.php');
        require_once(JPATH_SITE . '/components/com_rseventspro/helpers/route.php');

        $categories = array_map('intval', explode('||', $this->data->get('sourcecategories', '')));
        $groups     = array_map('intval', explode('||', $this->data->get('sourcegroups', '')));
        $tags       = array_map('intval', explode('||', $this->data->get('sourcetags', '')));
        $locations  = array_map('intval', explode('||', $this->data->get('sourcelocations', '')));

        $where = array('re.published <> 0');

        if (!in_array('0', $categories)) {
            $where[] = "re.id IN (SELECT ide FROM #__rseventspro_taxonomy WHERE id IN (" . implode(', ', $categories) . ") AND type = 'category')";
        }

        if (!in_array('0', $groups)) {
            $where[] = "re.id IN (SELECT ide FROM #__rseventspro_taxonomy WHERE id IN (" . implode(', ', $groups) . ") AND type = 'groups')";
        }

        if (!in_array('0', $tags)) {
            $where[] = "re.id IN (SELECT ide FROM #__rseventspro_taxonomy WHERE id IN (" . implode(', ', $tags) . ") AND type = 'tag')";
        }

        if (!in_array('0', $locations)) {
            $where[] = "re.location IN (" . implode(', ', $locations) . ")";
        }
        if (method_exists('rseventsproHelper', 'showdate')) {
            $today = rseventsproHelper::showdate("now", 'Y-m-d H:i:s');
        } else {
            $today = date('Y-m-d H:i:s', time());
        }

        $config   = Factory::getConfig();
        $timezone = new DateTimeZone($config->get('offset'));
        $offset   = $timezone->getOffset(new DateTime);

        if ($this->data->get('rseventsfilteroffset', '') !== '') {
            $offset = intval($this->data->get('rseventsfilteroffset', 0)) * 3600;
        }

        switch ($this->data->get('started', '0')) {
            case 1:
                $where[] = "DATE_ADD(re.start, INTERVAL " . $offset . " SECOND) < '" . $today . "'";
                break;
            case -1:
                $where[] = "DATE_ADD(re.start, INTERVAL " . $offset . " SECOND) >= '" . $today . "'";
                break;
        }

        switch ($this->data->get('ended', '-1')) {
            case 1:
                $where[] = "((DATE_ADD(re.end, INTERVAL " . $offset . " SECOND) < '" . $today . "' AND re.allday = 0) OR (DATE_ADD(re.start , INTERVAL " . $offset . " SECOND)< '" . $today . "' AND re.allday = 1))";
                break;
            case -1:
                $where[] = "((DATE_ADD(re.end, INTERVAL " . $offset . " SECOND) >= '" . $today . "' AND re.allday = 0) OR (DATE_ADD(re.start, INTERVAL " . $offset . " SECOND) >= '" . $today . "' AND re.allday = 1))";
                break;
        }

        switch ($this->data->get('allday', '0')) {
            case 1:
                $where[] = "re.allday = 1";
                break;
            case -1:
                $where[] = "re.allday = 0";
                break;
        }

        switch ($this->data->get('recurring', '0')) {
            case 1:
                $where[] = "re.recurring = 1";
                break;
            case -1:
                $where[] = "re.recurring = 0";
                break;
        }

        switch ($this->data->get('featured', '0')) {
            case 1:
                $where[] = "re.featured = 1";
                break;
            case -1:
                $where[] = "re.featured = 0";
                break;
        }

        $query = 'SELECT
        re.start, re.end, re.id, re.name, re.description, re.created, re.URL, re.email, re.phone, re.metaname, re.metakeywords, re.metadescription, re.hits, re.icon, 
        rl.name as loc_name, rl.url as loc_url, rl.address, rl.description AS loc_description, rl.coordinates
        FROM #__rseventspro_events AS re
        LEFT JOIN #__rseventspro_locations AS rl ON re.location = rl.id
        WHERE ' . implode(' AND ', $where) . ' ';

        $order = Common::parse($this->data->get('rseventsproorder', 'start|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY re.' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        $data       = array();
        $dateFormat = $this->data->get('rseventsprodate', 'm-d-Y');
        $timeFormat = $this->data->get('rseventsprotime', 'G:i');

        $translateDate  = $this->data->get('rseventstranslatedate', '');
        $translateValue = explode('||', $translateDate);
        $translate      = array();
        if ($translateDate != 'January->January||February->February||March->March' && !empty($translateValue)) {
            foreach ($translateValue as $tv) {
                $translateArray = explode('->', $tv);
                if (!empty($translateArray) && count($translateArray) == 2) {
                    $translate[$translateArray[0]] = $translateArray[1];
                }
            }
        }

        if ($this->data->get('rseventsoffset', '') !== '') {
            $offset = intval($this->data->get('rseventsoffset', 0)) * 3600;
        }

        $itemID = $this->data->get('itemid', '0');

        $config = rseventsproHelper::getConfig();
        foreach ($result as $res) {
            $r = array(
                'title'       => $res['name'],
                'description' => $res['description']
            );

            if (isset($res['icon'])) {
                $res['icon'] = 'components/com_rseventspro/assets/images/events/' . $res['icon'];
            } else {
                $res['icon'] = '';
            }

            $r['image'] = $r['thumbnail'] = ImageFallback::fallback(array(
                @$res['icon']
            ), array(
                @$res['description']
            ));

            $r['icon_small_width'] = rseventsproHelper::thumb($res['id'], $config->icon_small_width);
            $r['icon_big_width']   = rseventsproHelper::thumb($res['id'], $config->icon_big_width);

            if (isset($r['icon_small_width'])) {
                $r['thumbnail'] = $r['icon_small_width'];
            } else {
                $r['thumbnail'] = $r['image'];
            }

            if ($res['start'] != '0000-00-00 00:00:00') {
                $res['start'] = $this->formatDate(strtotime($res['start']) + $offset, 'Y-m-d H:i:s', false);
            }
            if ($res['end'] != '0000-00-00 00:00:00') {
                $res['end'] = $this->formatDate(strtotime($res['end']) + $offset, 'Y-m-d H:i:s', false);
            }
            $res['created'] = $this->formatDate(strtotime($res['created']) + $offset, 'Y-m-d H:i:s', false);
            if (method_exists('rseventsproHelper', 'showdate')) {
                $r += array(
                    'start_date' => $this->translate(rseventsproHelper::showdate($res['start'], $dateFormat), $translate),
                    'start_time' => $this->translate(rseventsproHelper::showdate($res['start'], $timeFormat), $translate),
                    'end_date'   => $this->translate(rseventsproHelper::showdate($res['end'], $dateFormat), $translate),
                    'end_time'   => $this->translate(rseventsproHelper::showdate($res['end'], $timeFormat), $translate)
                );
            } else {
                $r += array(
                    'start_date' => $this->translate($this->formatDate($res['start'], $dateFormat), $translate),
                    'start_time' => $this->translate($this->formatDate($res['start'], $timeFormat), $translate),
                    'end_date'   => $this->translate($this->formatDate($res['end'], $dateFormat), $translate),
                    'end_time'   => $this->translate($this->formatDate($res['end'], $timeFormat), $translate)
                );
            }

            if (empty($itemID)) {
                $itemID = rseventsproHelper::itemid($res['id']);
            }

            $r += array(
                'url'                  => rseventsproHelper::route('index.php?option=com_rseventspro&layout=show&id=' . rseventsproHelper::sef($res['id'], $res['name']), true, $itemID),
                'created'              => $res['created'],
                'website'              => $res['URL'],
                'email'                => $res['email'],
                'phone'                => $res['phone'],
                'metaname'             => $res['metaname'],
                'metakeywords'         => $res['metakeywords'],
                'metadescription'      => $res['metadescription'],
                'hits'                 => $res['hits'],
                'id'                   => $res['id'],
                'location_name'        => $res['loc_name'],
                'location_url'         => $res['loc_url'],
                'location_address'     => $res['address'],
                'location_description' => $res['loc_description']
            );

            $coordinates = explode(',', $res['coordinates']);
            if (count($coordinates) == 2) {
                $r += array(
                    'location_coordinates_lat'  => $coordinates[0],
                    'location_coordinates_long' => $coordinates[1]
                );
            }

            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Rseventspro/Elements/RseventsproCategories.php000064400000003315152355233130021076 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


jimport('joomla.access.access');

class RseventsproCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);
        $query     = "SELECT id, name, parent_id, title FROM #__assets WHERE name LIKE '%com_rseventspro.category%' ORDER BY parent_id";
        $menuItems = Database::queryAll($query, false, "object");
        for ($i = 0; $i < count($menuItems); $i++) {
            $name = explode('.', $menuItems[$i]->name);
            @$menuItems[$i]->rsEventCatId = end($name);
        }

        $query      = "SELECT id FROM #__assets WHERE name = 'com_rseventspro' LIMIT 1";
        $mainParent = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', $mainParent[0]->id, '', array(), $children, 9999, 0, 0);

        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->rsEventCatId] = $option->treename;
            }
        }

    }
}
Generator/Joomla/Rseventspro/Elements/RseventsproGroups.php000064400000001365152355233130020273 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class RseventsproGroups extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query  = "SELECT id, name FROM #__rseventspro_groups";
        $groups = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($groups)) {
            foreach ($groups as $group) {
                $this->options[$group->id] = $group->name;
            }
        }
    }

}
Generator/Joomla/Rseventspro/Elements/RseventsproLocations.php000064400000001444152355233130020745 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class RseventsproLocations extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query     = "SELECT id, name FROM #__rseventspro_locations WHERE published = 1";
        $locations = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($locations)) {
            foreach ($locations as $location) {
                $this->options[$location->id] = $location->name;
            }
        }
    }

}
Generator/Joomla/Rseventspro/Elements/RseventsproTags.php000064400000001371152355233130017707 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Rseventspro\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class RseventsproTags extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = "SELECT id, name FROM #__rseventspro_tags WHERE published = 1";
        $tags  = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($tags)) {
            foreach ($tags as $tag) {
                $this->options[$tag->id] = $tag->name;
            }
        }
    }

}
Generator/Joomla/Phocagallery/GeneratorGroupPhocagallery.php000064400000002116152355233130020336 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Phocagallery;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Phocagallery\Sources\PhocagalleryImages;

class GeneratorGroupPhocagallery extends AbstractGeneratorGroup {

    protected $name = 'phocagallery';

    protected $url = 'https://extensions.joomla.org/extension/phoca-gallery/';

    public function getLabel() {
        return 'Phoca Gallery';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'Phoca Gallery');
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_phocagallery');
    }

    protected function loadSources() {
        new PhocagalleryImages($this, 'images', n2_('Images'));
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupPhocagallery);
Generator/Joomla/Phocagallery/Sources/PhocagalleryImages.php000064400000012453152355233130020230 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Phocagallery\Sources;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\Url\Url;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Joomla\Phocagallery\Elements\PhocagalleryCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Phocagallery\Elements\PhocagalleryTags;

class PhocagalleryImages extends AbstractGenerator {

    protected $layout = 'image_extended';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'Phoca Gallery');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new PhocagalleryCategories($source, 'phocagallerysourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new PhocagalleryTags($source, 'phocagallerysourcetags', n2_('Tag'), 0, array(
            'isMultiple' => true
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Text($limit, 'phocagallerysourcelanguage', n2_('Language'), '*');

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'phocagalleryorder', 'con.date|*|desc', array(
            'options' => array(
                ''             => n2_('None'),
                'con.title'    => n2_('Title'),
                'cat_title'    => n2_('Category title'),
                'con.ordering' => n2_('Ordering'),
                'con.hits'     => n2_('Hits'),
                'con.date'     => n2_('Date')
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $categories = array_map('intval', explode('||', $this->data->get('phocagallerysourcecategories', '')));
        $tags       = array_map('intval', explode('||', $this->data->get('phocagallerysourcetags', '')));

        $query = 'SELECT ';
        $query .= 'con.id, ';
        $query .= 'con.title, ';
        $query .= 'con.alias, ';
        $query .= 'con.filename, ';
        $query .= 'con.description, ';
        $query .= 'con.hits, ';

        $query .= 'con.catid, ';
        $query .= 'cat.title AS cat_title, ';
        $query .= 'cat.description AS cat_description, ';
        $query .= 'cat.alias AS cat_alias ';

        $query .= 'FROM #__phocagallery AS con ';

        $query .= 'LEFT JOIN #__phocagallery_categories AS cat ON cat.id = con.catid ';

        $where = array(
            'con.published = 1 ',
            'con.approved = 1 '
        );
        if (count($categories) > 0 && !in_array('0', $categories)) {
            $where[] = 'con.catid IN (' . implode(',', $categories) . ') ';
        }

        if (count($tags) > 0 && !in_array('0', $tags)) {
            $where[] = 'con.id IN (SELECT imgid FROM #__phocagallery_tags_ref WHERE tagid IN (' . implode(',', $tags) . ')) ';
        }

        $language = $this->data->get('phocagallerysourcelanguage', '*');
        if ($language) {
            $where[] = 'con.language = ' . Database::quote($language) . ' ';
        }

        if (count($where)) {
            $query .= ' WHERE ' . implode(' AND ', $where);
        }

        $order = Common::parse($this->data->get('phocagalleryorder', 'con.date|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        $data = array();
        $uri  = Url::getBaseUri();
        for ($i = 0; $i < count($result); $i++) {
            $image  = ResourceTranslator::urlToResource($uri . "/images/phocagallery/" . $result[$i]['filename']);
            $r      = array(
                'image'                => $image,
                'thumbnail'            => $image,
                'title'                => $result[$i]['title'],
                'description'          => $result[$i]['description'],
                'url'                  => 'index.php?option=com_phocagallery&view=detail&catid=' . $result[$i]['catid'] . ':' . $result[$i]['cat_alias'] . '&id=' . $result[$i]['id'] . ':' . $result[$i]['alias'],
                'url_label'            => n2_('View image'),
                'filename'             => $result[$i]['filename'],
                'category_title'       => $result[$i]['cat_title'],
                'category_description' => $result[$i]['cat_description'],
                'category_url'         => 'index.php?option=com_phocagallery&view=category&id=' . $result[$i]['catid'] . ':' . $result[$i]['cat_alias'],
                'hits'                 => $result[$i]['hits'],
                'id'                   => $result[$i]['id']
            );
            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Phocagallery/Elements/PhocagalleryCategories.php000064400000002577152355233130021247 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Phocagallery\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class PhocagalleryCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT
            *, title, 
            parent_id AS parent, parent_id  
          FROM #__phocagallery_categories 
          WHERE published = 1 ORDER BY parent_id, ordering';

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }
        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);

        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Phocagallery/Elements/PhocagalleryTags.php000064400000001421152355233130020043 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Phocagallery\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class PhocagalleryTags extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT id, title FROM #__phocagallery_tags WHERE published = 1 ORDER BY ordering';

        $tags = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($tags)) {
            foreach ($tags as $tag) {
                $this->options[$tag->id] = $tag->title;
            }
        }
    }

}
Generator/Joomla/Mijoshop/GeneratorGroupMijoshop.php000064400000002242152355233130016672 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Sources\MijoshopProducts;

class GeneratorGroupMijoshop extends AbstractGeneratorGroup {

    protected $name = 'mijoshop';

    protected $url = 'https://miwisoft.com/joomla-extensions/mijoshop-joomla-shopping-cart';

    public function getLabel() {
        return 'MijoShop';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'MijoShop');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_mijoshop' . DIRECTORY_SEPARATOR . 'mijoshop.php');
    }

    protected function loadSources() {
        new MijoshopProducts($this, 'products', n2_('Products'));
    }

    public function isDeprecated() {
        return true;
    }

}

GeneratorFactory::addGenerator(new GeneratorGroupMijoshop);
Generator/Joomla/Mijoshop/Sources/MijoshopProducts.php000064400000021067152355233130017163 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Sources;

use Joomla\CMS\Factory;
use MijoShop;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Elements\MijoshopCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Elements\MijoshopLanguages;
use Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Elements\MijoshopManufacturers;

class MijoshopProducts extends AbstractGenerator {

    protected $layout = 'product';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'MijoShop');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new MijoshopCategories($source, 'mijoshopsourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new MijoshopManufacturers($source, 'mijoshopsourcemanufacturers', n2_('Manufacturer'), 0, array(
            'isMultiple' => true
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'mijoshopsourcespecial', 'Special', 0);
        new Filter($limit, 'mijoshopsourceinstock', n2_('In stock'), 0);
        new MijoshopLanguages($limit, 'mijoshopsourcelanguage', n2_('Language'), '');

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'mijoshoporder', 'p.date_added|*|desc', array(
            'options' => array(
                ''                => n2_('None'),
                'pc.name'         => n2_('Product name'),
                'p.sort_order'    => n2_('Ordering'),
                'p.viewed'        => n2_('Viewed'),
                'p.price'         => n2_('Price'),
                'p.date_added'    => n2_('Creation time'),
                'p.date_modified' => n2_('Modification time')
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        //Load Mijoshop config
        MijoShop::get('opencart')
                ->loadControllerFunction('startup/startup/index');
        $config   = MijoShop::get('opencart')
                            ->get('config');
        $currency = MijoShop::get('opencart')
                            ->get('currency');

        $router = MijoShop::get('router');

        $language_id = intval($this->data->get('mijoshopsourcelanguage'));
        if (!$language_id) $language_id = intval($config->get('config_language_id'));

        $tmpLng = $config->get('config_language_id');
        $config->set('config_language_id', $language_id);

        $tax    = MijoShop::get('opencart')
                          ->get('tax');
        $length = MijoShop::get('opencart')
                          ->get('length');
        $weight = MijoShop::get('opencart')
                          ->get('weight');

        $query = 'SELECT ';
        $query .= 'p.product_id ';

        $where = array(' p.status = 1 ');
        switch ($this->data->get('mijoshopsourcespecial', 0)) {
            case 0:
                $query .= ', ps.price AS special_price ';
                break;
            case 1:
                $query .= ', ps.price AS special_price ';

                $where[] = ' ps.price IS NOT NULL';
                $jNow    = Factory::getDate();
                $now     = $jNow->toSql();
                $where[] = ' (ps.date_start = "0000-00-00" OR ps.date_start < \'' . $now . '\')';
                $where[] = ' (ps.date_end = "0000-00-00" OR ps.date_end > \'' . $now . '\')';
                break;
            case -1:
                $jNow    = Factory::getDate();
                $now     = $jNow->toSql();
                $where[] = ' (ps.price IS NULL OR (ps.date_start > \'' . $now . '\' OR ps.date_end < \'' . $now . '\' AND ps.date_end <> "0000-00-00"))';
                break;
        }

        $query .= 'FROM #__mijoshop_product AS p ';

        $query .= 'LEFT JOIN #__mijoshop_product_description AS pc USING(product_id) ';
        $query .= 'LEFT JOIN #__mijoshop_product_to_category AS ptc USING(product_id) ';
        $query .= 'LEFT JOIN #__mijoshop_product_special AS ps USING(product_id) ';

        $categories = array_map('intval', explode('||', $this->data->get('mijoshopsourcecategories', '0')));

        if (!in_array(0, $categories) && count($categories) > 0) {
            $where[] = 'ptc.category_id IN (' . implode(',', $categories) . ') ';
        }

        $manufacturers = array_map('intval', explode('||', $this->data->get('mijoshopmanufacturers', '0')));

        if (!in_array(0, $manufacturers) && count($manufacturers) > 0) {
            $where[] = 'p.manufacturer_id IN (' . implode(',', $manufacturers) . ') ';
        }

        switch ($this->data->get('mijoshopsourceinstock', 0)) {
            case 1:
                $where[] = ' p.quantity > 0 ';
                break;
            case -1:
                $where[] = ' p.quantity = 0 ';
                break;
        }

        $where[] = ' pc.language_id  = ' . $language_id;

        if (count($where) > 0) {
            $query .= 'WHERE ' . implode(' AND ', $where) . ' ';
        }

        $query .= 'GROUP BY p.product_id ';

        $order = Common::parse($this->data->get('mijoshoporder', 'p.date_added|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }
        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        $data = array();
        for ($i = 0; $i < count($result); $i++) {

            $pi = MijoShop::get('opencart')
                          ->loadModelFunction('catalog/product/getProduct', $result[$i]['product_id']);

            $r = array(
                'title'       => $pi['name'],
                'url'         => $router->route('index.php?option=com_mijoshop&route=product/product&product_id=' . $pi['product_id']),
                'description' => html_entity_decode($pi['description'])
            );
            if (!empty($pi['image'])) {
                $r['image'] = ResourceTranslator::urlToResource(Filesystem::pathToAbsoluteURL(DIR_IMAGE) . $pi['image']);
            } else {
                $r['image'] = ImageFallback::fallback(array(), array($r['description']));
            }

            $r += array(
                'thumbnail' => $r['image'],
                'price'     => $currency->format($tax->calculate($pi['price'], $pi['tax_class_id'], $config->get('config_tax')), $config->get('config_currency'))
            );
            if (!empty($result[$i]['special_price'])) {
                $r['special_price'] = $currency->format($tax->calculate($result[$i]['special_price'], $pi['tax_class_id'], $config->get('config_tax')), $config->get('config_currency'));
            }

            if ($config->get('config_tax')) {

                $r['price_without_tax'] = $currency->format(!empty($result[$i]['special_price']) ? $result[$i]['special_price'] : $pi['price'], $config->get('config_currency'));
            }

            $r      += array(
                'model'    => $pi['model'],
                'sku'      => $pi['sku'],
                'upc'      => $pi['upc'],
                'ean'      => $pi['ean'],
                'jan'      => $pi['jan'],
                'isbn'     => $pi['isbn'],
                'mpn'      => $pi['mpn'],
                'location' => $pi['location'],
                'weight'   => $weight->format($pi['weight'], $pi['weight_class_id']),
                'length'   => $length->format($pi['length'], $pi['length_class_id']),
                'width'    => $length->format($pi['width'], $pi['length_class_id']),
                'height'   => $length->format($pi['height'], $pi['length_class_id']),
                'tag'      => $pi['tag']
            );
            $data[] = $r;
        }

        $config->set('config_language_id', $tmpLng);

        return $data;
    }

}
Generator/Joomla/Mijoshop/Elements/MijoshopCategories.php000064400000003715152355233130017576 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use MijoShop;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class MijoshopCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $lang       = '';
        $config     = MijoShop::get('opencart')
                              ->get('config');
        $languageId = $config->get('config_language_id');
        if (is_object($config) && $languageId) {
            $lang = ' AND cd.language_id = ' . $languageId;
        }

        $query = 'SELECT 
                    m.category_id AS id, 
                    cd.name AS name, 
                    cd.name AS title, 
                    m.parent_id AS parent, 
                    m.parent_id as parent_id
                FROM #__mijoshop_category m
                LEFT JOIN #__mijoshop_category_description AS cd ON cd.category_id = m.category_id
                WHERE m.status = 1 ' . $lang . '
                ORDER BY m.sort_order';

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }
        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);

        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }

    }

}
Generator/Joomla/Mijoshop/Elements/MijoshopLanguages.php000064400000001472152355233130017415 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class MijoshopLanguages extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT lang_id, title
                FROM #__languages
                WHERE published = 1';

        $languages = Database::queryAll($query, false, "object");

        $this->options['0'] = 'Auto';

        if (count($languages)) {
            foreach ($languages as $language) {
                $this->options[$language->lang_id] = $language->title;
            }
        }
    }

}
Generator/Joomla/Mijoshop/Elements/MijoshopManufacturers.php000064400000001517152355233130020326 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Mijoshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class MijoshopManufacturers extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT manufacturer_id AS id, name FROM #__mijoshop_manufacturer ORDER BY sort_order, id';

        $manufacturers = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($manufacturers)) {
            foreach ($manufacturers as $manufacturer) {
                $this->options[$manufacturer->id] = $manufacturer->name;
            }
        }
    }

}
Generator/Joomla/K2/GeneratorGroupK2.php000064400000002125152355233130014042 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\K2;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\K2\Sources\K2Items;

class GeneratorGroupK2 extends AbstractGeneratorGroup {

    protected $name = 'k2';

    protected $url = 'https://extensions.joomla.org/extension/authoring-a-content/content-construction/k2/';

    public function getLabel() {
        return 'K2';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'K2 ' . n2_('Items'));
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_k2');
    }

    protected function loadSources() {
        new K2Items($this, 'items', n2_('Items'));
    }

    public function isDeprecated() {
        return true;
    }

}

GeneratorFactory::addGenerator(new GeneratorGroupK2);
Generator/Joomla/K2/Sources/K2Items.php000064400000026224152355233130013611 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\K2\Sources;

use DateTime;
use DateTimeZone;
use Joomla\CMS\Factory;
use K2ModelItem;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\Url\Url;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\K2\Elements\K2Categories;
use Nextend\SmartSlider3Pro\Generator\Joomla\K2\Elements\K2Tags;

class K2Items extends AbstractGenerator {

    private $extraFields, $offset;

    protected $layout = 'article';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), n2_('Items'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new K2Categories($source, 'k2itemssourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new K2Tags($source, 'k2itemssourcetags', n2_('Tag'), 0, array(
            'isMultiple' => true
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'k2itemssourcefeatured', n2_('Featured'), 0);
        new Text($limit, 'k2itemssourceuserid', n2_('User ID'), '');
        new Text($limit, 'k2itemssourcelanguage', n2_('Language'), '');
        new MenuItems($limit, 'k2itemsitemid', n2_('Menu item (item ID)'), 0);


        $date = $filterGroup->createRow('date-row');
        new Text($date, 'sourcedateformat', n2_('Date format'), 'm-d-Y');
        new Text($date, 'sourcetimeformat', n2_('Time format'), 'G:i');

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'k2itemsorder', 'con.created|*|desc', array(
            'options' => array(
                ''                 => n2_('None'),
                'con.title'        => n2_('Title'),
                'cat_title'        => n2_('Category'),
                'created_by_alias' => n2_('User name'),
                'con.featured'     => n2_('Featured'),
                'con.ordering'     => n2_('Ordering'),
                'con.hits'         => n2_('Hits'),
                'con.created'      => n2_('Creation time'),
                'con.modified'     => n2_('Modification time')
            )
        ));
    }

    protected function resetState() {
        $this->extraFields = null;
    }

    function loadExtraFields() {
        static $extraFields = null;
        if ($extraFields === null) {

            $query = 'SELECT ';
            $query .= 'fgroups.name AS group_name, ';
            $query .= 'field.name AS name, ';
            $query .= 'field.id ';

            $query .= 'FROM #__k2_extra_fields_groups AS fgroups ';

            $query .= 'LEFT JOIN #__k2_extra_fields AS field ON field.group = fgroups.id ';

            $query .= 'WHERE field.published = 1 ';

            $this->extraFields = Database::queryAll($query, false, "assoc", "id");
        }
    }

    public function datify($date, $format) {
        $timestamp = strtotime($date) + $this->offset;

        return date($format, $timestamp);
    }

    public function removeSpecChar($str) {
        return iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $str);
    }

    protected function _getData($count, $startIndex) {

        $categories = array_map('intval', explode('||', $this->data->get('k2itemssourcecategories', '0')));
        $tags       = array_map('intval', explode('||', $this->data->get('k2itemssourcetags', '0')));

        $query = 'SELECT ';
        $query .= 'con.id, ';
        $query .= 'con.title, ';
        $query .= 'con.alias, ';
        $query .= 'con.introtext, ';
        $query .= 'con.fulltext, ';
        $query .= 'con.catid, ';
        $query .= 'con.created, ';
        $query .= 'con.modified, ';
        $query .= 'cat.name AS cat_title, ';
        $query .= 'cat.alias AS cat_alias, ';
        $query .= 'con.created_by, ';
        $query .= 'usr.name AS created_by_alias, ';
        $query .= 'con.hits, ';
        $query .= 'con.image_caption, ';
        $query .= 'con.image_credits, ';
        $query .= 'con.video, ';
        $query .= 'con.extra_fields ';

        $query .= 'FROM #__k2_items AS con ';

        $query .= 'LEFT JOIN #__users AS usr ON usr.id = con.created_by ';

        $query .= 'LEFT JOIN #__k2_categories AS cat ON cat.id = con.catid ';

        $jNow  = Factory::getDate();
        $now   = $jNow->toSql();
        $where = array(
            "con.published = 1 AND (con.publish_up = '0000-00-00 00:00:00' OR con.publish_up IS NULL OR con.publish_up < '" . $now . "') AND (con.publish_down = '0000-00-00 00:00:00' OR con.publish_down IS NULL OR con.publish_down > '" . $now . "') ",
            'con.trash = 0 '
        );
        if (!in_array('0', $categories)) {
            $where[] = 'con.catid IN (' . implode(',', $categories) . ') ';
        }

        if (!in_array('0', $tags)) {
            $where[] = 'con.id IN ( SELECT itemID FROM #__k2_tags_xref WHERE tagID IN (' . implode(",", $tags) . ')) ';
        }

        $sourceUserId = intval($this->data->get('k2itemssourceuserid', ''));
        if ($sourceUserId) {
            $where[] = 'con.created_by = ' . $sourceUserId . ' ';
        }

        switch ($this->data->get('k2itemssourcefeatured', 0)) {
            case 1:
                $where[] = 'con.featured = 1 ';
                break;
            case -1:
                $where[] = 'con.featured = 0 ';
                break;
        }

        $language = $this->data->get('k2itemssourcelanguage', '*');
        if ($language) {
            $where[] = 'con.language = ' . Database::quote($language) . ' ';
        }

        if (count($where) > 0) {
            $query .= 'WHERE ' . implode(' AND ', $where) . ' ';
        }

        $order = Common::parse($this->data->get('k2itemsorder', 'con.created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query  .= 'LIMIT ' . $startIndex . ', ' . $count . ' ';
        $result = Database::queryAll($query);
        $this->loadExtraFields();

        require_once(JPATH_SITE . '/components/com_k2/helpers/utilities.php');
        if (!class_exists('K2ModelItem')) {
            require_once(JPATH_ADMINISTRATOR . '/components/com_k2/models/model.php');
            require_once(JPATH_SITE . '/components/com_k2/models/item.php');
        }
        $k2item = new K2ModelItem();

        $config       = Factory::getConfig();
        $timezone     = new DateTimeZone($config->get('offset'));
        $this->offset = $timezone->getOffset(new DateTime);

        $data = array();
        for ($i = 0; $i < count($result); $i++) {

            $modified = '?t=' . strftime("%Y%m%d_%H%M%S", strtotime($result[$i]['modified']));

            $r = array(
                'title'       => $result[$i]['title'],
                'description' => $result[$i]['introtext'],
            );

            $thumbnail = JPATH_SITE . "/media/k2/items/cache/" . md5("Image" . $result[$i]['id']) . "_S.jpg";
            if (Filesystem::fileexists($thumbnail)) {
                $r['thumbnail'] = ResourceTranslator::urlToResource(Url::pathToUri($thumbnail)) . $modified;
            }

            $image = JPATH_SITE . "/media/k2/items/cache/" . md5("Image" . $result[$i]['id']) . "_XL.jpg";
            if (Filesystem::fileexists($image)) {
                $r['image'] = ResourceTranslator::urlToResource(Url::pathToUri($image)) . $modified;
            } else {
                $r['image'] = ImageFallback::fallback(array(), array($r['description']));
            }
            if (!isset($r['thumbnail'])) {
                $r['thumbnail'] = $r['image'];
            }

            $image = JPATH_SITE . "/media/k2/items/src/" . md5("Image" . $result[$i]['id']) . ".jpg";
            if (Filesystem::fileexists($image)) {
                $r['src_image'] = ResourceTranslator::urlToResource(Url::pathToUri($image)) . $modified;
            }

            if (!empty($result[$i]['video'])) {
                $r['video'] = $result[$i]['video'];
                preg_match_all('/(<source.*?src=[\'"](.*?)[\'"][^>]+>)/i', $result[$i]['video'], $video);
                $r['video_src'] = $video[2][0];
                preg_match_all('/(<source.*?src=[\'"](.*mp4)[\'"][^>]+>)/i', $result[$i]['video'], $mp4);
                if (isset($mp4[2][0])) {
                    $r['video_src_mp4'] = $mp4[2][0];
                }
            }

            $itemID = $this->data->get('k2itemsitemid', '0');
            $url    = 'index.php?option=com_k2&view=item&id=' . $result[$i]['id'] . ':' . $result[$i]['alias'];
            if (!empty($itemID) && $itemID != 0) {
                $url .= '&Itemid=' . $itemID;
            }

            $r += array(
                'url'              => $url,
                'url_label'        => n2_('View item'),
                'category_title'   => $result[$i]['cat_title'],
                'category_url'     => 'index.php?option=com_k2&view=itemlist&task=category&id=' . $result[$i]['catid'] . ':' . $result[$i]['cat_alias'],
                'alias'            => $result[$i]['alias'],
                'id'               => $result[$i]['id'],
                'category_id'      => $result[$i]['catid'],
                'created_by_alias' => $result[$i]['created_by_alias'],
                'hits'             => $result[$i]['hits'],
                'image_caption'    => $result[$i]['image_caption'],
                'image_credits'    => $result[$i]['image_credits'],
                'created_date'     => $this->datify($result[$i]['created'], $this->data->get('sourcedateformat', 'm-d-Y')),
                'created_time'     => $this->datify($result[$i]['created'], $this->data->get('sourcetimeformat', 'G:i'))
            );

            $item   = (object)$result[$i];
            $extras = $k2item->getItemExtraFields($result[$i]['extra_fields'], $item);

            $count = 0;
            if (is_array($extras) && count($extras) > 0) {
                foreach ($extras as $field) {
                    $count++;
                    $r['extra' . $count] = $r['extra' . $this->removeSpecChar($field->id)] = $r['extra' . $this->removeSpecChar($field->id . '_' . preg_replace("/\W|_/", "", $this->extraFields[$field->id]['group_name'] . '_' . $this->extraFields[$field->id]['name']))] = $field->value;
                }
            }
            $data[] = $r;
        }

        return $data;
    }

}
Generator/Joomla/K2/Elements/K2Categories.php000064400000002504152355233130014741 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\K2\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class K2Categories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT m.*, m.name AS title, m.parent AS parent, m.parent AS parent_id  FROM #__k2_categories m WHERE published = 1 ORDER BY parent, ordering';

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        $this->options['0'] = n2_('All');

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/K2/Elements/K2Tags.php000064400000001353152355233130013553 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\K2\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class K2Tags extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT id, name FROM #__k2_tags WHERE published = 1 ORDER BY id';

        $tags = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($tags)) {
            foreach ($tags as $tag) {
                $this->options[$tag->id] = $tag->name;
            }
        }
    }

}
Generator/Joomla/Joomshopping5/GeneratorGroupJoomshopping5.php000064400000003067152355233130020622 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Sources\JoomshoppingProducts;
use Nextend\SmartSlider3\Platform\Joomla\JoomlaShim;

class GeneratorGroupJoomshopping5 extends AbstractGeneratorGroup {

    protected $name = 'joomshopping5';

    protected $url = 'https://extensions.joomla.org/extension/joomshopping/';

    public function getLabel() {
        return 'JoomShopping';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'JoomShopping');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jshopping' . DIRECTORY_SEPARATOR . 'jshopping.xml');
    }

    protected function loadSources() {
        if (JoomlaShim::$isJoomla4) {
            require_once(JPATH_SITE . "/components/com_jshopping/classmap.php");
            require_once(JPATH_SITE . "/components/com_jshopping/bootstrap.php");
            require_once(JPATH_SITE . "/components/com_jshopping/Lib/JSFactory.php");

            new JoomshoppingProducts($this, 'products', n2_('Products'));
        }
    }

    public function isDeprecated() {
        return !JoomlaShim::$isJoomla4;
    }
}

GeneratorFactory::addGenerator(new GeneratorGroupJoomshopping5);Generator/Joomla/Joomshopping5/Sources/JoomshoppingProducts.php000064400000027307152355233130021023 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Sources;

use Joomla\CMS\Factory;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Elements\JoomshoppingCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Elements\JoomshoppingLabels;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Elements\JoomshoppingManufacturers;
use Joomla\Component\Jshopping\Site\Helper\Helper;
use Joomla\Component\Jshopping\Site\Lib\JSFactory;


class JoomshoppingProducts extends AbstractGenerator {

    protected $layout = 'product';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'JoomShopping');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new JoomshoppingCategories($source, 'sourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new JoomshoppingManufacturers($source, 'sourcemanufacturers', n2_('Manufacturer'), 0, array(
            'isMultiple' => true
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'sourceinstock', n2_('In stock'), 0);
        new JoomshoppingLabels($limit, 'sourcelabel', n2_('Label'), -1);

        new MenuItems($limit, 'itemid', n2_('Menu item (item ID)'), 0);
        new Text($limit, 'language', n2_('Language'), '', array(
            'tipLabel'       => n2_('Language'),
            'tipDescription' => 'en-GB,de-DE,hu-HU,...',
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1882-joomla-joomshopping-generator#language',
        ));

        new OnOff($limit, 'allimage', n2_('Ask down all product images'), 0);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'productsorder', 'pr.product_date_added|*|desc', array(
            'options' => array(
                ''                        => n2_('None'),
                'pr.name'                 => n2_('Product name'),
                'category_name'           => n2_('Category'),
                'pr_cat.product_ordering' => n2_('Ordering'),
                'pr.hits'                 => n2_('Hits'),
                'pr.product_date_added'   => n2_('Creation time'),
                'pr.date_modify'          => n2_('Modification time')
            )
        ));
    }

    protected function _getData($count, $startIndex) {
        $jShopConfig = JSFactory::getConfig();
        $langObject  = JSFactory::getLang();
        $language    = $this->data->get('language', '');
        $customLang  = !empty($language);
        if ($customLang) {
            $checkLanguage = Database::queryRow("SELECT * FROM #__jshopping_languages WHERE language = '" . $language . "'");
            if (empty($checkLanguage)) {
                Notification::error('Wrong language code is used in the generator settings!');

                return null;
            }
        }
        $session = Factory::getSession();

        $where = array(' pr.product_publish = 1 ');

        $category = array_map('intval', explode('||', $this->data->get('sourcecategories', '')));
        if (!in_array(0, $category) && count($category) > 0) {
            $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
        }

        $manufacturers = array_map('intval', explode('||', $this->data->get('sourcemanufacturers', '')));
        if (!in_array(0, $manufacturers) && count($manufacturers) > 0) {
            $where[] = 'pr.product_manufacturer_id IN (' . implode(',', $manufacturers) . ') ';
        }

        switch ($this->data->get('sourceinstock', 0)) {
            case 1:
                $where[] = ' (pr.product_quantity > 0 OR pr.unlimited = 1) ';
                break;
            case -1:
                $where[] = ' (pr.product_quantity = 0 AND pr.unlimited = 0) ';
                break;
        }

        $label_id = intval($this->data->get('sourcelabel', -1));

        if ($label_id != -1) {
            $where[] = ' pr.label_id = "' . $label_id . '" ';
        }

        $o     = '';
        $order = Common::parse($this->data->get('productsorder', 'pr.product_date_added|*|desc'));
        if ($order[0]) {
            if ($order[0] == 'pr.name') $order[0] = 'pr.`' . $langObject->get('name') . '`';
            $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query = "SELECT 
                        pr.product_id, 
                        pr.product_publish, 
                        pr_cat.product_ordering, ";

        if ($customLang) {
            $query .= " pr.`name_" . $language . "` as name,
                        pr.`short_description_" . $language . "` as short_description,
                        pr.`description_" . $language . "` as description,
                        man.`name_" . $language . "` as man_name,";
        } else {
            $query .= " pr.`" . $langObject->get('name') . "` as name,
                        pr.`" . $langObject->get('short_description') . "` as short_description,
                        pr.`" . $langObject->get('description') . "` as description,
                        man.`" . $langObject->get('name') . "` as man_name,";
        }

        $query .= "     pr.product_ean as ean,
                        pr.product_quantity as qty,
                        pr.image as image,
                        pr.product_price,
                        pr.product_old_price,
                        pr.currency_id,
                        pr.hits,
                        pr.unlimited,
                        pr.product_date_added,
                        pr.label_id,
                        pr.vendor_id,
                        V.f_name as v_f_name,
                        V.l_name as v_l_name,
                        cat.category_image,
                        cat.category_id,";

        if ($customLang) {
            $query .= " cat.`name_" . $language . "` as category_name,
                        cat.`alias_" . $language . "` as category_alias,
                        cat.`short_description_" . $language . "` as category_short_description,
                        cat.`description_" . $language . "` as category_description";
        } else {
            $query .= " cat.`" . $langObject->get('name') . "` as category_name,
                        cat.`" . $langObject->get('alias') . "` as category_alias,
                        cat.`" . $langObject->get('short_description') . "` as category_short_description,
                        cat.`" . $langObject->get('description') . "` as category_description";
        }

        $query .= " FROM `#__jshopping_products` AS pr
                    LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat USING (product_id)
                    LEFT JOIN `#__jshopping_categories` AS cat USING (category_id)
                    LEFT JOIN `#__jshopping_manufacturers` AS man ON pr.product_manufacturer_id=man.manufacturer_id
                    LEFT JOIN `#__jshopping_vendors` as V on pr.vendor_id=V.id
                    WHERE pr.parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " GROUP BY pr.product_id " . $o . " LIMIT " . $startIndex . ", " . $count;


        $result = Database::queryAll($query);

        $data = array();

        $itemID = $this->data->get('itemid', '0');

        $allImage = $this->data->get('allimage', 0);

        for ($i = 0; $i < count($result); $i++) {
            $r = array(
                'title'             => $result[$i]['name'],
                'url'               => Helper::SEFLink('index.php?option=com_jshopping&controller=product&task=view&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']),
                'joomla_url'        => 'index.php?option=com_jshopping&controller=product&task=view&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id'] . '&Itemid=' . $itemID,
                'description'       => $result[$i]['description'],
                'short_description' => $result[$i]['short_description']
            );

            if ($result[$i]['image'] != null) {
                $r += array(
                    'image'      => ResourceTranslator::urlToResource($jShopConfig->image_product_live_path . '/' . $result[$i]['image']),
                    'thumbnail'  => ResourceTranslator::urlToResource($jShopConfig->image_product_live_path . '/thumb_' . $result[$i]['image']),
                    'image_full' => ResourceTranslator::urlToResource($jShopConfig->image_product_live_path . '/full_' . $result[$i]['image'])
                );
            } else {
                $image      = ImageFallback::findImage($r['description']);
                $r['image'] = $r['thumbnail'] = ImageFallback::fallback(array($image));
            }

            $r += array(
                'price'                      => Helper::formatprice($result[$i]['product_price']),
                'product_old_price'          => $result[$i]['product_old_price'] > 0 ? Helper::formatprice($result[$i]['product_old_price']) : '',
                'category_name'              => $result[$i]['category_name'],
                'category_short_description' => $result[$i]['category_short_description'],
                'category_description'       => $result[$i]['category_description'],
                'category_url'               => Helper::SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $result[$i]['category_id']),
                'add_to_cart_url'            => Helper::SEFLink('index.php?option=com_jshopping&controller=cart&task=add&quantity=1&to=cart&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']),
                'manufacturer_name'          => $result[$i]['man_name'],
                'product_id'                 => $result[$i]['product_id']
            );

            if ($allImage) {
                $imageQuery = 'SELECT image_name FROM #__jshopping_products_images WHERE product_id = ' . $result[$i]['product_id'] . ' ORDER BY ordering asc';
                $images     = Database::queryAll($imageQuery);
                for ($j = 0; $j < count($images); $j++) {
                    $r += array(
                        'image' . ($j + 1)      => ImageFallback::fallback(array($images[$j]['image_name']), array(), $jShopConfig->image_product_live_path),
                        'thumbnail' . ($j + 1)  => ImageFallback::fallback(array('thumb_' . $images[$j]['image_name']), array(), $jShopConfig->image_product_live_path),
                        'image_full' . ($j + 1) => ImageFallback::fallback(array('full_' . $images[$j]['image_name']), array(), $jShopConfig->image_product_live_path)
                    );
                }
            }

            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Joomshopping5/Elements/JoomshoppingCategories.php000064400000003351152355233130021427 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Elements;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Form\Element\Select;
use Joomla\Component\Jshopping\Site\Lib\JSFactory;


class JoomshoppingCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        $lang = JSFactory::getLang();

        $query = "SELECT m.category_id AS id, `" . $lang->get('name') . "` AS title, `" . $lang->get('name') . "` AS name, m.category_parent_id AS parent_id, m.category_parent_id as parent
              FROM #__jshopping_categories AS m
              LEFT JOIN #__jshopping_products_to_categories AS f
              ON m.category_id = f.category_id
              WHERE m.category_publish = 1
              ORDER BY ordering";

        $db->setQuery($query);
        $menuItems = $db->loadObjectList();

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }
        jimport('joomla.html.html.menu');
        $options            = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Joomshopping5/Elements/JoomshoppingLabels.php000064400000001766152355233130020554 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Elements;

use Joomla\CMS\Factory;
use Joomla\Component\Jshopping\Site\Lib\JSFactory;
use Nextend\Framework\Form\Element\Select;


class JoomshoppingLabels extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        $lang = JSFactory::getLang();

        $query = "SELECT id, `" . $lang->get('name') . "` AS name
              FROM #__jshopping_product_labels
              ORDER BY name";

        $db->setQuery($query);
        $labels = $db->loadObjectList();

        $this->options['-1'] = n2_('All');
        $this->options['0']  = n2_('None');

        if (count($labels)) {
            foreach ($labels as $option) {
                $this->options[$option->id] = $option->name;
            }
        }
    }

}
Generator/Joomla/Joomshopping5/Elements/JoomshoppingManufacturers.php000064400000002034152355233130022156 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping5\Elements;

use Joomla\CMS\Factory;
use Joomla\Component\Jshopping\Site\Lib\JSFactory;
use Nextend\Framework\Form\Element\Select;

class JoomshoppingManufacturers extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        $lang = JSFactory::getLang();

        $query = "SELECT manufacturer_id AS id, `" . $lang->get('name') . "` AS title
              FROM #__jshopping_manufacturers
              WHERE manufacturer_publish = 1
              ORDER BY ordering";

        $db->setQuery($query);
        $menuItems = $db->loadObjectList();

        $this->options['0'] = n2_('All');

        if (count($menuItems)) {
            foreach ($menuItems as $option) {
                $this->options[$option->id] = $option->title;
            }
        }
    }

}
Generator/Joomla/Joomshopping/GeneratorGroupJoomshopping.php000064400000002375152355233130020451 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Sources\JoomshoppingProducts;
use Nextend\SmartSlider3\Platform\Joomla\JoomlaShim;

class GeneratorGroupJoomshopping extends AbstractGeneratorGroup {

    protected $name = 'joomshopping';

    protected $url = 'https://extensions.joomla.org/extension/joomshopping/';

    public function getLabel() {
        return 'JoomShopping';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'JoomShopping');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jshopping' . DIRECTORY_SEPARATOR . 'jshopping.php');
    }

    protected function loadSources() {
        new JoomshoppingProducts($this, 'products', n2_('Products'));
    }

    public function isDeprecated() {
        return JoomlaShim::$isJoomla4;
    }
}

GeneratorFactory::addGenerator(new GeneratorGroupJoomshopping);Generator/Joomla/Joomshopping/Sources/JoomshoppingProducts.php000064400000031330152355233130020725 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Sources;

use Joomla\CMS\Factory;
use JSFactory;
use JTable;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Elements\JoomshoppingCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Elements\JoomshoppingLabels;
use Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Elements\JoomshoppingManufacturers;


class JoomshoppingProducts extends AbstractGenerator {

    protected $layout = 'product';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'JoomShopping');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new JoomshoppingCategories($source, 'sourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new JoomshoppingManufacturers($source, 'sourcemanufacturers', n2_('Manufacturer'), 0, array(
            'isMultiple' => true
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'sourceinstock', n2_('In stock'), 0);
        new JoomshoppingLabels($limit, 'sourcelabel', n2_('Label'), -1);

        new MenuItems($limit, 'itemid', n2_('Menu item (item ID)'), 0);
        new Text($limit, 'language', n2_('Language'), '', array(
            'tipLabel'       => n2_('Language'),
            'tipDescription' => 'en-GB,de-DE,hu-HU,...',
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1882-joomla-joomshopping-generator#language',
        ));

        new OnOff($limit, 'allimage', n2_('Ask down all product images'), 0);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'productsorder', 'pr.product_date_added|*|desc', array(
            'options' => array(
                ''                        => n2_('None'),
                'pr.name'                 => n2_('Product name'),
                'category_name'           => n2_('Category'),
                'pr_cat.product_ordering' => n2_('Ordering'),
                'pr.hits'                 => n2_('Hits'),
                'pr.product_date_added'   => n2_('Creation time'),
                'pr.date_modify'          => n2_('Modification time')
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        require_once(JPATH_SITE . "/components/com_jshopping/lib/factory.php");

        $jShopConfig = JSFactory::getConfig();
        $langObject  = JSFactory::getLang();
        $language    = $this->data->get('language', '');
        $customLang  = !empty($language);
        if ($customLang) {
            $checkLanguage = Database::queryRow("SELECT * FROM #__jshopping_languages WHERE language = '" . $language . "'");
            if (empty($checkLanguage)) {
                Notification::error('Wrong language code is used in the generator settings!');

                return null;
            }
        }
        $session = Factory::getSession();

        $where = array(' pr.product_publish = 1 ');

        $category = array_map('intval', explode('||', $this->data->get('sourcecategories', '')));
        if (!in_array(0, $category) && count($category) > 0) {
            $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
        }

        $manufacturers = array_map('intval', explode('||', $this->data->get('sourcemanufacturers', '')));
        if (!in_array(0, $manufacturers) && count($manufacturers) > 0) {
            $where[] = 'pr.product_manufacturer_id IN (' . implode(',', $manufacturers) . ') ';
        }

        switch ($this->data->get('sourceinstock', 0)) {
            case 1:
                $where[] = ' (pr.product_quantity > 0 OR pr.unlimited = 1) ';
                break;
            case -1:
                $where[] = ' (pr.product_quantity = 0 AND pr.unlimited = 0) ';
                break;
        }

        $label_id = intval($this->data->get('sourcelabel', -1));

        if ($label_id != -1) {
            $where[] = ' pr.label_id = "' . $label_id . '" ';
        }

        $o     = '';
        $order = Common::parse($this->data->get('productsorder', 'pr.product_date_added|*|desc'));
        if ($order[0]) {
            if ($order[0] == 'pr.name') $order[0] = 'pr.`' . $langObject->get('name') . '`';
            $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query = "SELECT 
                        pr.product_id, 
                        pr.product_publish, 
                        pr_cat.product_ordering, ";

        if ($customLang) {
            $query .= " pr.`name_" . $language . "` as name,
                        pr.`short_description_" . $language . "` as short_description,
                        pr.`description_" . $language . "` as description,
                        man.`name_" . $language . "` as man_name,";
        } else {
            $query .= " pr.`" . $langObject->get('name') . "` as name,
                        pr.`" . $langObject->get('short_description') . "` as short_description,
                        pr.`" . $langObject->get('description') . "` as description,
                        man.`" . $langObject->get('name') . "` as man_name,";
        }

        $query .= "     pr.product_ean as ean,
                        pr.product_quantity as qty,
                        pr.image as image,
                        pr.product_price,
                        pr.currency_id,
                        pr.hits,
                        pr.unlimited,
                        pr.product_date_added,
                        pr.label_id,
                        pr.vendor_id,
                        V.f_name as v_f_name,
                        V.l_name as v_l_name,
                        cat.category_image,
                        cat.category_id,";

        if ($customLang) {
            $query .= " cat.`name_" . $language . "` as category_name,
                        cat.`alias_" . $language . "` as category_alias,
                        cat.`short_description_" . $language . "` as category_short_description,
                        cat.`description_" . $language . "` as category_description";
        } else {
            $query .= " cat.`" . $langObject->get('name') . "` as category_name,
                        cat.`" . $langObject->get('alias') . "` as category_alias,
                        cat.`" . $langObject->get('short_description') . "` as category_short_description,
                        cat.`" . $langObject->get('description') . "` as category_description";
        }

        $query .= " FROM `#__jshopping_products` AS pr
                    LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat USING (product_id)
                    LEFT JOIN `#__jshopping_categories` AS cat USING (category_id)
                    LEFT JOIN `#__jshopping_manufacturers` AS man ON pr.product_manufacturer_id=man.manufacturer_id
                    LEFT JOIN `#__jshopping_vendors` as V on pr.vendor_id=V.id
                    WHERE pr.parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " GROUP BY pr.product_id " . $o . " LIMIT " . $startIndex . ", " . $count;

        $result = Database::queryAll($query);

        $data = array();

        $itemID = $this->data->get('itemid', '0');

        $allImage = $this->data->get('allimage', 0);

        for ($i = 0; $i < count($result); $i++) {
            $product = JTable::getInstance('product', 'jshop');
            $product->load($result[$i]['product_id']);

            $jinput = Factory::getApplication()->input;
            $attr   = $jinput->get('attr', null, null);

            $back_value = $session->get('product_back_value');
            if (!isset($back_value['pid'])) $back_value = array(
                'pid'  => null,
                'attr' => null,
                'qty'  => null
            );
            if ($back_value['pid'] != $result[$i]['product_id']) $back_value = array(
                'pid'  => null,
                'attr' => null,
                'qty'  => null
            );
            if (!is_array($back_value['attr'])) $back_value['attr'] = array();
            if (count($back_value['attr']) == 0 && is_array($attr)) $back_value['attr'] = $attr;
            $attributesDatas = $product->getAttributesDatas($back_value['attr']);
            $product->setAttributeActive($attributesDatas['attributeActive']);

            getDisplayPriceForProduct($product->product_price);
            $product->getExtendsData();

            $r = array(
                'title'             => $result[$i]['name'],
                'url'               => SEFLink('index.php?option=com_jshopping&controller=product&task=view&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']),
                'joomla_url'        => 'index.php?option=com_jshopping&controller=product&task=view&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id'] . '&Itemid=' . $itemID,
                'description'       => $result[$i]['description'],
                'short_description' => $result[$i]['short_description']
            );

            $op = $product->getOldPrice();

            if ($result[$i]['image'] != null) {
                $r += array(
                    'image'      => ResourceTranslator::urlToResource($jShopConfig->image_product_live_path . '/' . $result[$i]['image']),
                    'thumbnail'  => ResourceTranslator::urlToResource($jShopConfig->image_product_live_path . '/thumb_' . $result[$i]['image']),
                    'image_full' => ResourceTranslator::urlToResource($jShopConfig->image_product_live_path . '/full_' . $result[$i]['image'])
                );
            } else {
                $image      = ImageFallback::findImage($r['description']);
                $r['image'] = $r['thumbnail'] = ImageFallback::fallback(array($image));
            }

            $r += array(
                'price'                      => formatprice($product->getPriceCalculate()),
                'product_old_price'          => $op > 0 ? formatprice($op) : '',
                'category_name'              => $result[$i]['category_name'],
                'category_short_description' => $result[$i]['category_short_description'],
                'category_description'       => $result[$i]['category_description'],
                'category_url'               => SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $result[$i]['category_id']),
                'add_to_cart_url'            => SEFLink('index.php?option=com_jshopping&controller=cart&task=add&quantity=1&to=cart&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']),
                'manufacturer_name'          => $result[$i]['man_name'],
                'product_id'                 => $result[$i]['product_id']
            );

            if ($allImage) {
                $imageQuery = 'SELECT image_name FROM #__jshopping_products_images WHERE product_id = ' . $result[$i]['product_id'] . ' ORDER BY ordering asc';
                $images     = Database::queryAll($imageQuery);
                for ($j = 0; $j < count($images); $j++) {
                    $r += array(
                        'image' . ($j + 1)      => ImageFallback::fallback(array($images[$j]['image_name']), array(), $jShopConfig->image_product_live_path),
                        'thumbnail' . ($j + 1)  => ImageFallback::fallback(array('thumb_' . $images[$j]['image_name']), array(), $jShopConfig->image_product_live_path),
                        'image_full' . ($j + 1) => ImageFallback::fallback(array('full_' . $images[$j]['image_name']), array(), $jShopConfig->image_product_live_path)
                    );
                }
            }

            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Joomshopping/Elements/JoomshoppingCategories.php000064400000003425152355233130021344 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Elements;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use JSFactory;
use Nextend\Framework\Form\Element\Select;


class JoomshoppingCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        require_once(JPATH_SITE . "/components/com_jshopping/lib/factory.php");
        $lang = JSFactory::getLang();

        $query = "SELECT m.category_id AS id, `" . $lang->get('name') . "` AS title, `" . $lang->get('name') . "` AS name, m.category_parent_id AS parent_id, m.category_parent_id as parent
              FROM #__jshopping_categories AS m
              LEFT JOIN #__jshopping_products_to_categories AS f
              ON m.category_id = f.category_id
              WHERE m.category_publish = 1
              ORDER BY ordering";

        $db->setQuery($query);
        $menuItems = $db->loadObjectList();

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }
        jimport('joomla.html.html.menu');
        $options            = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Joomshopping/Elements/JoomshoppingLabels.php000064400000002042152355233130020453 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Elements;

use Joomla\CMS\Factory;
use JSFactory;
use Nextend\Framework\Form\Element\Select;


class JoomshoppingLabels extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        require_once(JPATH_SITE . "/components/com_jshopping/lib/factory.php");
        $lang = JSFactory::getLang();

        $query = "SELECT id, `" . $lang->get('name') . "` AS name
              FROM #__jshopping_product_labels
              ORDER BY name";

        $db->setQuery($query);
        $labels = $db->loadObjectList();

        $this->options['-1'] = n2_('All');
        $this->options['0']  = n2_('None');

        if (count($labels)) {
            foreach ($labels as $option) {
                $this->options[$option->id] = $option->name;
            }
        }
    }

}
Generator/Joomla/Joomshopping/Elements/JoomshoppingManufacturers.php000064400000002110152355233130022064 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Joomshopping\Elements;

use Joomla\CMS\Factory;
use JSFactory;
use Nextend\Framework\Form\Element\Select;

class JoomshoppingManufacturers extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        require_once(JPATH_SITE . "/components/com_jshopping/lib/factory.php");
        $lang = JSFactory::getLang();

        $query = "SELECT manufacturer_id AS id, `" . $lang->get('name') . "` AS title
              FROM #__jshopping_manufacturers
              WHERE manufacturer_publish = 1
              ORDER BY ordering";

        $db->setQuery($query);
        $menuItems = $db->loadObjectList();

        $this->options['0'] = n2_('All');

        if (count($menuItems)) {
            foreach ($menuItems as $option) {
                $this->options[$option->id] = $option->title;
            }
        }
    }

}
Generator/Joomla/Jevents/GeneratorGroupJevents.php000064400000003515152355233130016352 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Jevents;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Sources\JeventsEvents;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Sources\JeventsRepeatingevents;

class GeneratorGroupJevents extends AbstractGeneratorGroup {

    protected $name = 'jevents';

    protected $url = 'https://extensions.joomla.org/extension/jevents/';

    public function getLabel() {
        return 'JEvents';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'JEvents');
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jevents');
    }

    protected function loadSources() {
        new JeventsEvents($this, 'events', n2_('One time events'));
        new JeventsRepeatingevents($this, 'repeatingevents', n2_('Repeating events'));
    }

    public static function formatDate($datetime, $dateOrTime, $format, $dateLanguage) {
        $checkDateTime = strtotime($datetime);
        if ($dateOrTime == 1 || $checkDateTime != '0000-00-00 00:00:00') {
            if (!empty($dateLanguage)) {
                $locale = setlocale(LC_ALL, 0);
                setlocale(LC_ALL, $dateLanguage);
                $date = strftime($format, $datetime);
                setlocale(LC_ALL, $locale);
            } else {
                $date = date($format, $datetime);
            }

            return $date;
        } else {
            return '0000-00-00';
        }
    }

}

GeneratorFactory::addGenerator(new GeneratorGroupJevents);
Generator/Joomla/Jevents/Sources/JeventsEvents.php000064400000030362152355233130016276 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Sources;

use DateTime;
use DateTimeZone;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;
use Joomla\CMS\Uri\Uri;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Elements\JeventsCalendars;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Elements\JeventsCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\GeneratorGroupJevents;

class JeventsEvents extends AbstractGenerator {

    protected $layout = 'event';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('One time events'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new JeventsCategories($source, 'sourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new JeventsCalendars($source, 'sourcecalendars', 'Calendar', 0, array(
            'isMultiple' => true
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'started', n2_('Started'), 0);
        new Filter($limit, 'ended', n2_('Ended'), -1);
        new Filter($limit, 'noendtime', 'Specified end time', 0);

        new Text($limit, 'location', n2_('Location'), '*');
        new Text($limit, 'dateformat', n2_('Date format'), 'm-d-Y');
        new Text($limit, 'timeformat', n2_('Time format'), 'G:i');
        new Text($limit, 'datelanguage', n2_('Date language'), '');

        new Text($limit, 'variableoffset', n2_('Date variable offset'), '', array(
            'tipLabel'       => n2_('Date variable offset'),
            'tipDescription' => n2_('Timezone offset in hours. For example: +2 or -7. If you leave it empty, Joomla\'s System -> Global Configuration -> Server -> Server Time Zone setting will be used.')
        ));

        new Text($limit, 'filteroffset', n2_('Date filter offset'), '', array(
            'tipLabel'       => n2_('Date filter offset'),
            'tipDescription' => n2_('Timezone offset in hours. For example: +2 or -7. If you leave it empty, Joomla\'s System -> Global Configuration -> Server -> Server Time Zone setting will be used.')
        ));


        new MenuItems($limit, 'itemid', n2_('Menu item (item ID)'), 0);
        new Select($limit, 'eventstate', n2_('Status'), 1, array(
            'options' => array(
                ''   => n2_('All'),
                '1'  => n2_('Published'),
                '0'  => n2_('Unpublished'),
                '-1' => n2_('Trashed')
            )
        ));

        $standardImages = $filterGroup->createRow('images-row');
        new OnOff($standardImages, 'multiimages', 'JEvents Standard Image and File Uploads plugin', 0);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'jeventsorder', 'a.dtstart|*|desc', array(
            'options' => array(
                ''           => n2_('None'),
                'a.dtstart'  => n2_('Start date'),
                'a.dtend'    => n2_('End date'),
                'b.created'  => n2_('Creation time'),
                'a.modified' => n2_('Modification time'),
                'a.summary'  => n2_('Title'),
                'a.hits'     => n2_('Hits'),
                'b.ev_id'    => 'ID'
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $categories = array_map('intval', explode('||', $this->data->get('sourcecategories', '')));
        $calendars  = array_map('intval', explode('||', $this->data->get('sourcecalendars', '')));

        $dateFormat = $this->data->get('dateformat', 'Y-m-d');
        if (empty($dateFormat)) {
            $dateFormat = 'Y-m-d';
        }

        $timeFormat = $this->data->get('timeformat', 'H:i:s');
        if (empty($timeFormat)) {
            $timeFormat = 'H:i:s';
        }

        $dateLanguage = $this->data->get('datelanguage', '');

        $itemId = $this->data->get('itemid', '0');

        $innerWhere = array();
        if (!in_array('0', $categories)) {
            $innerWhere[] = ' catid IN(' . implode(', ', $categories) . ')';
        }
        if (!in_array('0', $calendars)) {
            $innerWhere[] = ' icsid IN(' . implode(', ', $calendars) . ')';
        }

        if (!empty($innerWhere)) {
            $innerWhereStrAll = 'WHERE';
            $innerWhereStrAll .= implode(' AND ', $innerWhere);
        } else {
            $innerWhereStrAll = '';
        }

        $where = array(
            'a.evdet_id IN (SELECT detail_id FROM #__jevents_vevent ' . $innerWhereStrAll . ')',
            'a.evdet_id NOT IN (SELECT eventdetail_id FROM #__jevents_repetition GROUP BY eventdetail_id HAVING COUNT(eventdetail_id) > 1)'
        );

        if (Filesystem::existsFile(JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'jevents' . DIRECTORY_SEPARATOR . 'jevfiles' . DIRECTORY_SEPARATOR . 'jevfiles.php') && $this->data->get('multiimages', 0)) {
            $multi = true;
        } else {
            $multi = false;
        }

        $folder = '';
        if ($multi) {
            $plugin = PluginHelper::getPlugin('jevents', 'jevfiles');
            $params = new Registry($plugin->params);
            $folder .= rtrim(Uri::root(false), '/') . '/' . trim($params->get('image_path', 'images'), '/') . '/' . trim($params->get('folder'), '/');
        }

        $config   = Factory::getConfig();
        $timezone = new DateTimeZone($config->get('offset'));
        $JOffset  = $offset = $timezone->getOffset(new DateTime);

        if ($this->data->get('filteroffset', '') !== '') {
            $offset = intval($this->data->get('filteroffset', 0)) * 3600;
        }

        $today = time() + $offset;

        switch ($this->data->get('started', '0')) {
            case 1:
                $where[] = 'a.dtstart < ' . $today;
                break;
            case -1:
                $where[] = 'a.dtstart >= ' . $today;
                break;
        }

        switch ($this->data->get('ended', '-1')) {
            case 1:
                $where[] = 'a.dtend < ' . $today;
                break;
            case -1:
                $where[] = 'a.dtend >= ' . $today;
                break;
        }

        switch ($this->data->get('noendtime', 0)) {
            case 1:
                $where[] = 'a.noendtime = 0';
                break;
            case -1:
                $where[] = 'a.noendtime = 1';
                break;
        }

        $location = $this->data->get('location', '*');
        if ($location != '*' && !empty($location)) {
            $where[] = "location = '" . $location . "'";
        }

        $state = $this->data->get('eventstate', '1');
        if ($state != "") {
            $where[] = "b.state = '" . $state . "'";
        }

        $order = Common::parse($this->data->get('jeventsorder', 'a.dtstart|*|desc'));
        if ($order[0]) {
            $orderBy = 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query = 'SELECT d.rp_id, b.ev_id, FROM_UNIXTIME(a.dtstart) AS event_start,
                    FROM_UNIXTIME(a.dtend) AS event_end, a.description, a.location, a.summary,
                    a.contact, a.hits, a.extra_info';

        $query .= ' FROM #__jevents_vevdetail AS a LEFT JOIN #__jevents_vevent
                    AS b ON a.evdet_id = b.detail_id ';

        $query .= 'LEFT JOIN #__jevents_repetition AS d ON a.evdet_id = d.eventid ';

        $query .= ' WHERE ' . implode(' AND ', $where) . ' GROUP BY b.ev_id ' . $orderBy . ' LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);
        $data   = array();

        if ($multi) {
            $query = "SELECT ev_id,";
            for ($i = 1; $i < 30; $i++) {
                $query .= "imagename" . $i . ",";
            }
            $query          .= "imagename30 FROM #__jev_files_combined WHERE ev_id IN (SELECT ev_id FROM #__jevents_vevent " . $innerWhereStrAll . ") AND ev_id NOT IN (SELECT eventid FROM #__jevents_repetition GROUP BY eventid HAVING COUNT(eventid) > 1)";
            $jevfilesresult = Database::queryAll($query);
            foreach ($jevfilesresult as $files) {
                $event_id = $files['ev_id'];
                unset($files['ev_id']);
                foreach ($files as $file) {
                    if (!empty($file)) {
                        $jffile[$event_id][]           = $folder . '/' . $file;
                        $jffileoriginals[$event_id][]  = $folder . '/originals/orig_' . $file;
                        $jffilethumbnails[$event_id][] = $folder . '/thumbnails/thumb_' . $file;
                    }
                }
            }
        }

        if ($this->data->get('variableoffset', '') !== '') {
            $offset = intval($this->data->get('variableoffset', 0)) * 3600;
        } else {
            $offset = $JOffset;
        }

        foreach ($result as $res) {
            $r = array(
                'title'       => $res['summary'],
                'description' => $res['description']
            );

            $image     = '';
            $thumbnail = '';
            if ($multi) {
                $i = 0;
                if (isset($jffile[$res['ev_id']])) {
                    $images = array();
                    foreach ($jffile[$res['ev_id']] as $jff) {
                        $images += array(
                            'image_' . $i       => $jff,
                            'image_orig_' . $i  => $jffileoriginals[$res['ev_id']][$i],
                            'image_thumb_' . $i => $jffilethumbnails[$res['ev_id']][$i]

                        );
                        if (empty($image)) {
                            $image     = $images['image_orig_' . $i];
                            $thumbnail = $images['image_thumb_' . $i];
                        }
                        $i++;
                    }
                }
            }

            $r['image'] = ImageFallback::fallback(array($image), array(
                $res['description']
            ), $folder);

            $r['thumbnail'] = ImageFallback::fallback(array(
                $thumbnail,
                $r['image']
            ), array(), $folder);

            $r += array(
                'url'        => 'index.php?option=com_jevents&task=icalevent.detail&evid=' . $res['ev_id'] . '&Itemid=' . $itemId,
                'start_date' => GeneratorGroupJevents::formatDate(strtotime($res['event_start']) + $offset, 0, $dateFormat, $dateLanguage),
                'start_time' => GeneratorGroupJevents::formatDate(strtotime($res['event_start']) + $offset, 1, $timeFormat, $dateLanguage),
                'end_date'   => GeneratorGroupJevents::formatDate(strtotime($res['event_end']) + $offset, 0, $dateFormat, $dateLanguage),
                'end_time'   => GeneratorGroupJevents::formatDate(strtotime($res['event_end']) + $offset, 1, $timeFormat, $dateLanguage),
                'location'   => $res['location'],
                'contact'    => $res['contact'],
                'hits'       => $res['hits'],
                'extra_info' => $res['extra_info'],
                'ev_id'      => $res['ev_id'],
                'rp_id'      => $res['rp_id']
            );

            if ($multi) {
                $r = array_merge($r, $images);
            }
            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Jevents/Sources/JeventsRepeatingevents.php000064400000024751152355233130020202 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Sources;

use DateTime;
use DateTimeZone;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;
use Joomla\CMS\Uri\Uri;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Elements\JeventsCalendars;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Elements\JeventsCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\GeneratorGroupJevents;

class JeventsRepeatingevents extends AbstractGenerator {

    protected $layout = 'event';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('Repeating events'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new JeventsCategories($source, 'sourcecategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new JeventsCalendars($source, 'sourcecalendars', 'Calendar', 0, array(
            'isMultiple' => true
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'noendtime', 'Specified end time', 0);

        new Text($limit, 'location', n2_('Location'), '*');
        new Text($limit, 'dateformat', n2_('Date format'), 'm-d-Y');
        new Text($limit, 'timeformat', n2_('Time format'), 'G:i');
        new Text($limit, 'datelanguage', n2_('Date language'), '');

        new Text($limit, 'offset', n2_('Date variable offset'), '', array(
            'tipLabel'       => n2_('Date variable offset'),
            'tipDescription' => n2_('Timezone offset in hours. For example: +2 or -7. If you leave it empty, Joomla\'s System -> Global Configuration -> Server -> Server Time Zone setting will be used.')
        ));

        new MenuItems($limit, 'itemid', n2_('Menu item (item ID)'), 0);

        $standardImages = $filterGroup->createRow('images-row');
        new OnOff($standardImages, 'multiimages', 'JEvents Standard Image and File Uploads plugin', 0);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'jeventsorder', 'a.dtstart|*|desc', array(
            'options' => array(
                ''           => n2_('None'),
                'a.dtstart'  => n2_('Start date'),
                'a.dtend'    => n2_('End date'),
                'b.created'  => n2_('Creation time'),
                'a.modified' => n2_('Modification time'),
                'a.summary'  => n2_('Title'),
                'a.hits'     => n2_('Hits'),
                'b.ev_id'    => 'ID',
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $categories = array_map('intval', explode('||', $this->data->get('sourcecategories', '')));
        $calendars  = array_map('intval', explode('||', $this->data->get('sourcecalendars', '')));

        $dateFormat = $this->data->get('dateformat', 'Y-m-d');
        if (empty($dateFormat)) {
            $dateFormat = 'Y-m-d';
        }

        $timeFormat = $this->data->get('timeformat', 'H:i:s');
        if (empty($timeFormat)) {
            $timeFormat = 'H:i:s';
        }

        $dateLanguage = $this->data->get('datelanguage', '');

        $config   = Factory::getConfig();
        $timezone = new DateTimeZone($config->get('offset'));
        $offset   = $timezone->getOffset(new DateTime);

        if ($this->data->get('offset', '') !== '') {
            $offset = intval($this->data->get('offset', 0)) * 3600;
        }

        $itemId = $this->data->get('itemid', '0');

        $innerWhere = array();
        if (!in_array('0', $categories)) {
            $innerWhere[] = ' catid IN(' . implode(', ', $categories) . ')';
        }
        if (!in_array('0', $calendars)) {
            $innerWhere[] = ' icsid IN(' . implode(', ', $calendars) . ')';
        }

        if (!empty($innerWhere)) {
            $innerWhereStrAll = 'WHERE';
            $innerWhereStrAll .= implode(' AND ', $innerWhere);
        } else {
            $innerWhereStrAll = '';
        }

        $where = array(
            "a.evdet_id IN (SELECT detail_id FROM #__jevents_vevent " . $innerWhereStrAll . ")",
            "a.evdet_id IN (SELECT eventdetail_id FROM #__jevents_repetition GROUP BY eventdetail_id HAVING COUNT(eventdetail_id) > 1)",
            "b.state = '1'"
        );

        if (Filesystem::existsFile(JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'jevents' . DIRECTORY_SEPARATOR . 'jevfiles' . DIRECTORY_SEPARATOR . 'jevfiles.php') && $this->data->get('multiimages', 0)) {
            $multi = true;
        } else {
            $multi = false;
        }

        $folder = '';
        if ($multi) {
            $plugin = PluginHelper::getPlugin('jevents', 'jevfiles');
            $params = new Registry($plugin->params);
            $folder .= rtrim(Uri::root(false), '/') . '/' . trim($params->get('image_path', 'images'), '/') . '/' . trim($params->get('folder'), '/');
        }

        switch ($this->data->get('noendtime', 0)) {
            case 1:
                $where[] = 'a.noendtime = 0';
                break;
            case -1:
                $where[] = 'a.noendtime = 1';
                break;
        }

        $location = $this->data->get('location', '*');
        if ($location != '*' && !empty($location)) {
            $where[] = "location = '" . $location . "'";
        }

        $order = Common::parse($this->data->get('jeventsorder', 'a.dtstart|*|desc'));
        if ($order[0]) {
            $orderBy = 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query = 'SELECT d.rp_id, b.ev_id, FROM_UNIXTIME(a.dtstart) AS event_start,
                    FROM_UNIXTIME(a.dtend) AS event_end, a.description, a.location, a.summary,
                    a.contact, a.hits, a.extra_info ';

        $query .= ' FROM #__jevents_vevdetail AS a LEFT JOIN #__jevents_vevent
                    AS b ON a.evdet_id = b.detail_id ';

        $query .= 'LEFT JOIN #__jevents_repetition AS d ON a.evdet_id = d.eventid ';

        $query .= ' WHERE ' . implode(' AND ', $where) . ' GROUP BY b.ev_id ' . $orderBy . ' LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        $data = array();

        if ($multi) {
            $query = "SELECT ev_id,";
            for ($i = 1; $i < 30; $i++) {
                $query .= "imagename" . $i . ",";
            }
            $query          .= "imagename30 FROM #__jev_files_combined WHERE ev_id IN (SELECT eventid FROM #__jevents_repetition GROUP BY eventid HAVING COUNT(eventid) > 1)";
            $jevfilesresult = Database::queryAll($query);
            foreach ($jevfilesresult as $files) {
                $event_id = $files['ev_id'];
                unset($files['ev_id']);
                foreach ($files as $file) {
                    if (!empty($file)) {
                        $jffile[$event_id][]           = $folder . '/' . $file;
                        $jffileoriginals[$event_id][]  = $folder . '/originals/orig_' . $file;
                        $jffilethumbnails[$event_id][] = $folder . '/thumbnails/thumb_' . $file;
                    }
                }
            }
        }

        foreach ($result as $res) {
            $r = array(
                'title'       => $res['summary'],
                'description' => $res['description']
            );

            $image     = '';
            $thumbnail = '';
            if ($multi) {
                $i = 0;
                if (isset($jffile[$res['ev_id']])) {
                    $images = array();
                    foreach ($jffile[$res['ev_id']] as $jff) {
                        $images += array(
                            'image_' . $i       => $jff,
                            'image_orig_' . $i  => $jffileoriginals[$res['ev_id']][$i],
                            'image_thumb_' . $i => $jffilethumbnails[$res['ev_id']][$i]

                        );
                        if (empty($image)) {
                            $image     = $images['image_orig_' . $i];
                            $thumbnail = $images['image_thumb_' . $i];
                        }
                        $i++;
                    }
                }
            }

            $r['image'] = ImageFallback::fallback(array($image), array(
                $res['description']
            ), $folder);

            $r['thumbnail'] = ImageFallback::fallback(array(
                $thumbnail,
                $r['image']
            ), array(), $folder);

            $r += array(
                'url'        => 'index.php?option=com_jevents&task=icalrepeat.detail&evid=' . $res['rp_id'] . '&Itemid=' . $itemId,
                'start_date' => GeneratorGroupJevents::formatDate(strtotime($res['event_start']) + $offset, 0, $dateFormat, $dateLanguage),
                'start_time' => GeneratorGroupJevents::formatDate(strtotime($res['event_start']) + $offset, 1, $timeFormat, $dateLanguage),
                'end_date'   => GeneratorGroupJevents::formatDate(strtotime($res['event_end']) + $offset, 0, $dateFormat, $dateLanguage),
                'end_time'   => GeneratorGroupJevents::formatDate(strtotime($res['event_end']) + $offset, 1, $timeFormat, $dateLanguage),
                'location'   => $res['location'],
                'contact'    => $res['contact'],
                'hits'       => $res['hits'],
                'extra_info' => $res['extra_info'],
                'ev_id'      => $res['ev_id'],
                'rp_id'      => $res['rp_id']
            );

            if ($multi) {
                $r = array_merge($r, $images);
            }
            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Jevents/Elements/JeventsCalendars.php000064400000001440152355233130017052 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class JeventsCalendars extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query     = "SELECT ics_id, label FROM #__jevents_icsfile WHERE state = '1'";
        $calendars = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($calendars)) {
            foreach ($calendars as $calendar) {
                $this->options[$calendar->ics_id] = $calendar->label;
            }
        }

    }

}
Generator/Joomla/Jevents/Elements/JeventsCategories.php000064400000003040152355233130017241 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Jevents\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class JeventsCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query     = "SELECT id, parent_id, title, name FROM #__assets WHERE name LIKE '%com_jevents.category%' ORDER BY parent_id";
        $menuItems = Database::queryAll($query, false, "object");

        $query      = "SELECT id FROM #__assets WHERE name = 'com_jevents' LIMIT 1";
        $mainParent = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', $mainParent[0]->id, '', array(), $children, 9999, 0, 0);

        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $id                    = explode('.', $option->name);
                $this->options[$id[2]] = $option->treename;
            }
        }

    }
}
Generator/Joomla/Ignitegallery/GeneratorGroupIgnitegallery.php000064400000002170152355233130020710 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Ignitegallery;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Ignitegallery\Sources\IgnitegalleryImages;

class GeneratorGroupIgnitegallery extends AbstractGeneratorGroup {

    protected $name = 'ignitegallery';

    protected $url = 'https://extensions.joomla.org/profile/extension/photos-a-images/galleries/ignite-gallery/';

    public function getLabel() {
        return 'Ignite Gallery';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'Ignite Gallery');
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_igallery');
    }

    protected function loadSources() {
        new IgnitegalleryImages($this, 'images', n2_('Images'));
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupIgnitegallery);

Generator/Joomla/Ignitegallery/Sources/IgnitegalleryImages.php000064400000020012152355233130020570 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Ignitegallery\Sources;

use Igniteg\Component\Igallery\Administrator\Helper\FileHelper;
use Joomla\CMS\Filesystem\File;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\Url\Url;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Joomla\Ignitegallery\Elements\IgnitegalleryCategories;

class IgnitegalleryImages extends AbstractGenerator {

    protected $layout = 'image_extended';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'Ignite Gallery');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');

        new IgnitegalleryCategories($source, 'ignitegallerysourcecategory', n2_('Category'), 0, array(
            'isMultiple' => true
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'ignitegalleryorder', 'con.date|*|desc', array(
            'options' => array(
                ''             => n2_('None'),
                'con.filename' => n2_('Filename'),
                'cat_title'    => n2_('Category'),
                'con.ordering' => n2_('Ordering'),
                'con.hits'     => n2_('Hits'),
                'con.date'     => n2_('Creation time')
            )
        ));
    }

    protected function _getData($count, $startIndex) {
        require_once(JPATH_ADMINISTRATOR . '/components/com_igallery/defines.php');
        if (version_compare(IG_VERSION, '4.8', '<')) {
            Notification::error(n2_('Update your Ignite Gallery! Only Ignite Gallery 4.8+ versions are supported.'));

            return null;
        } else {

            $categories = array_map('intval', explode('||', $this->data->get('ignitegallerysourcecategory', '')));

            $query = 'SELECT ';
            $query .= 'con.id, ';
            $query .= 'con.filename, ';
            $query .= 'con.description, ';
            $query .= 'con.alt_text, ';
            $query .= 'con.link, ';
            $query .= 'con.hits, ';
            $query .= 'con.rotation, ';
            $query .= 'con.filesys, ';
            $query .= 'con.src, ';

            $query .= 'con.gallery_id, ';
            $query .= 'cat.name AS cat_title, ';
            $query .= 'cat.alias AS cat_alias, ';
            $query .= 'cat.id AS cat_id, ';
            $query .= 'cat.folder AS cat_folder, ';

            $query .= 'pro.thumb_width, ';
            $query .= 'pro.thumb_height, ';
            $query .= 'pro.crop_thumbs, ';
            $query .= 'pro.img_quality, ';
            $query .= 'pro.round_fill, ';
            $query .= 'pro.round_thumb ';

            $query .= 'FROM #__igallery_img AS con ';

            $query .= 'LEFT JOIN #__igallery AS cat ON cat.id = con.gallery_id ';

            $query .= 'LEFT JOIN #__igallery_profiles AS pro ON pro.id = cat.profile ';

            $where = array('con.published = 1 ');
            if (count($categories) > 0 && !in_array('0', $categories)) {
                $where[] = 'con.gallery_id IN (' . implode(',', $categories) . ') ';
            }

            if (count($where)) {
                $query .= ' WHERE ' . implode(' AND ', $where);
            }

            $order = Common::parse($this->data->get('ignitegalleryorder', 'con.date|*|desc'));
            if ($order[0]) {
                $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
            }

            $query .= 'LIMIT ' . $startIndex . ', ' . $count . ' ';

            $result = Database::queryAll($query);

            $data = array();

            for ($i = 0; $i < count($result); $i++) {
                $isNewFilesystem = $result[$i]['filesys'];

                if ($isNewFilesystem) {
                    $folderName = $result[$i]['cat_folder'];
                } else {
                    $increment  = FileHelper::getIncrementFromFilename($result[$i]['filename']);
                    $folderName = FileHelper::getFolderName($increment);
                }

                $sourceFile = IG_ORIG_PATH . '/' . $folderName . '/' . $result[$i]['filename'];

                if (!empty($result[$i]['src'])) {
                    $sourceFile = JPATH_SITE . '/' . $result[$i]['src'];
                }
                $result[$i]['original_image'] = ResourceTranslator::urlToResource(Url::pathToUri($sourceFile));

                $size = getimagesize($sourceFile);

                if ($size !== false) {
                    $imageArray = FileHelper::originalToResized($result[$i]['filename'], $folderName, $result[$i]['src'], $size[0], $size[1], 100, 0, $result[$i]['rotation'], 0, 0, 0);

                    $result[$i]['image'] = ResourceTranslator::urlToResource(IG_IMAGE_HTML_RESIZE . $imageArray['folderName'] . '/' . $imageArray['fullFileName']);

                    $thumbnailArray = FileHelper::originalToResized($result[$i]['filename'], $folderName, $result[$i]['src'], $result[$i]['thumb_width'], $result[$i]['thumb_height'], $result[$i]['img_quality'], $result[$i]['crop_thumbs'], $result[$i]['rotation'], $result[$i]['round_thumb'], $result[$i]['round_fill']);

                    $result[$i]['thumbnail'] = ResourceTranslator::urlToResource(IG_IMAGE_HTML_RESIZE . $thumbnailArray['folderName'] . '/' . $thumbnailArray['fullFileName']);
                } else {
                    $result[$i]['image'] = $result[$i]['thumbnail'] = $result[$i]['original_image'];
                }

                $filename = File::stripExt($result[$i]['filename']);
                if (!$isNewFilesystem) {
                    $searchRef = strrpos($filename, '-');
                    if ($searchRef !== false) {
                        $filename = substr($filename, 0, $searchRef);
                    }
                }
                $result[$i]['url']          = $result[$i]['image_url'] = 'index.php?option=com_igallery&view=category&igid=' . $result[$i]['gallery_id'] . '&i=' . $filename;
                $result[$i]['category_url'] = 'index.php?option=com_igallery&view=category&igid=' . $result[$i]['gallery_id'];
                if (!empty($result[$i]['link'])) {
                    $result[$i]['url'] = $result[$i]['link'];
                }
                $result[$i]['url_label'] = n2_('View');
                if (!empty($result[$i]['alt_text'])) {
                    $result[$i]['title'] = $result[$i]['alt_text'];
                } else {
                    $result[$i]['title'] = $result[$i]['filename'];
                }

                $r = array(
                    'image'          => $result[$i]['image'],
                    'thumbnail'      => $result[$i]['thumbnail'],
                    'original_image' => $result[$i]['original_image'],
                    'title'          => $result[$i]['title'],
                    'description'    => $result[$i]['description'],
                    'url'            => $result[$i]['url'],
                    'url_label'      => $result[$i]['url_label'],
                    'filename'       => $result[$i]['filename'],
                    'image_url'      => $result[$i]['image_url'],
                    'hits'           => $result[$i]['hits'],
                    'category_title' => $result[$i]['cat_title'],
                    'category_url'   => $result[$i]['category_url'],
                    'id'             => $result[$i]['id']
                );

                $data[] = $r;
            }

            return $data;
        }
    }

}
Generator/Joomla/Ignitegallery/Elements/IgnitegalleryCategories.php000064400000002551152355233130021611 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Ignitegallery\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class IgnitegalleryCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT
            *, name AS title, 
            parent, parent AS parent_id  
          FROM #__igallery
          WHERE published = 1 ORDER BY parent';

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        $this->options['0'] = n2_('All');

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }

    }
}
Generator/Joomla/Hikashop/GeneratorGroupHikashop.php000064400000002367152355233130016636 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Sources\HikashopProducts;
use Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Sources\HikashopProductsbyid;

class GeneratorGroupHikashop extends AbstractGeneratorGroup {

    protected $name = 'hikashop';

    protected $url = 'https://extensions.joomla.org/extension/hikashop/';

    public function getLabel() {
        return 'HikaShop';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'HikaShop');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_hikashop' . DIRECTORY_SEPARATOR . 'hikashop.php');
    }

    protected function loadSources() {
        new HikashopProducts($this, 'products', n2_('Products'));
        new HikashopProductsbyid($this, 'productsbyid', n2_('Products') . ' - IDs');
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupHikashop);
Generator/Joomla/Hikashop/Sources/HikashopProducts.php000064400000025002152355233130017110 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Sources;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements\HikashopBrands;
use Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements\HikashopCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements\HikashopTags;
use Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements\HikashopWarehouses;
use stdClass;

class HikashopProducts extends AbstractGenerator {

    protected $layout = 'product';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('Products'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new HikashopCategories($source, 'hikashopcategories', n2_('Category'), 0, array(
            'isMultiple' => true
        ));
        new HikashopBrands($source, 'hikashopbrands', n2_('Brand'), 0, array(
            'isMultiple' => true
        ));
        new HikashopTags($source, 'hikashoptags', n2_('Tag'), 0, array(
            'isMultiple' => true
        ));
        new HikashopWarehouses($source, 'hikashopwarehouses', n2_('Warehouse'), 0, array(
            'isMultiple' => true
        ));

        $options = $filterGroup->createRow('options');
        new MenuItems($options, 'hikashopitemid', n2_('Menu item (item ID)'), 0);
        new OnOff($options, 'hikashopimages', n2_('Include all images'), 1);


        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'hikashopproductsorder', 'p.product_created|*|desc', array(
            'options' => array(
                ''                        => n2_('None'),
                'p.product_id'            => 'ID',
                'p.product_name'          => n2_('Product name'),
                'p.product_hit'           => n2_('Hits'),
                'p.product_sales'         => n2_('Sales'),
                'p.product_average_score' => n2_('Average score'),
                'p.product_total_vote'    => n2_('Total vote'),
                'p.product_created'       => n2_('Creation time'),
                'p.product_modified'      => n2_('Modification time')
            )
        ));
    }

    function getPrice($pid, $tax_id = 0) {
        $arr                    = array();
        $arr[0]                 = new stdClass();
        $arr[0]->product_id     = $pid;
        $arr[0]->product_tax_id = $tax_id;
        $currencyClass          = hikashop_get('class.currency');
        $zone                   = hikashop_getZone();
        $cur                    = hikashop_getCurrency();
        $currencyClass->getListingPrices($arr, $zone, $cur);
        $i         = 0;
        $currPrice = 0;
        if (isset($arr[0]->prices)) {
            foreach ($arr[0]->prices as $k => $price) {
                if (!$i) {
                    $currPrice = $price->price_value_with_tax;
                }
                if ($price->price_value_with_tax < $currPrice) $currPrice = $price->price_value_with_tax;
                $i++;
            }

            return $currencyClass->format($currPrice, $cur);
        } else {
            return '';
        }
    }

    function url($id, $alias, $itemID) {
        $url = 'index.php?option=com_hikashop&ctrl=product&task=show&cid=' . $id;
        if (!empty($alias)) {
            $url .= '&name=' . $alias;
        }
        if (!empty($itemID) && $itemID != 0) {
            $url .= '&Itemid=' . $itemID;
        }

        return $url;
    }

    protected function _getData($count, $startIndex) {
        require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php');

        $categories = array_map('intval', explode('||', $this->data->get('hikashopcategories', '')));
        $brands     = array_map('intval', explode('||', $this->data->get('hikashopbrands', '0')));
        $tags       = array_map('intval', explode('||', $this->data->get('hikashoptags', '0')));
        $warehouses = array_map('intval', explode('||', $this->data->get('hikashopwarehouses', '0')));

        $where = array(
            "p.product_published = 1 ",
            "p.product_type <> 'variant'"
        );

        if (!in_array(0, $categories) && count($categories) > 0) {
            $where[] = "p.product_id IN (SELECT product_id FROM #__hikashop_product_category WHERE category_id IN (" . implode(',', $categories) . "))";
        }

        if (!in_array(0, $brands) && count($brands) > 0) {
            $where[] = "p.product_manufacturer_id IN (" . implode(',', $brands) . ")";
        }

        if (!in_array(0, $tags)) {
            $where[] = 'p.product_id IN (SELECT content_item_id FROM #__contentitem_tag_map WHERE type_alias = \'com_hikashop.product\' AND tag_id IN (' . implode(',', $tags) . ')) ';
        }

        if (!in_array(0, $warehouses) && count($warehouses) > 0) {
            $where[] = "p.product_warehouse_id IN (" . implode(',', $warehouses) . ")";
        }

        $query = "SELECT * FROM #__hikashop_product AS p LEFT JOIN #__hikashop_file AS f ON p.product_id = f.file_ref_id AND f.file_type='product' WHERE " . implode(' AND ', $where);

        $query .= " GROUP BY p.product_id ";

        $order = Common::parse($this->data->get('hikashopproductsorder', 'p.product_created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1];
        }

        $query .= ' LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        if (function_exists('hikashop_config')) {
            $config = hikashop_config();
            $folder = $config->get('uploadfolder');
            if (empty($folder)) {
                $folder = 'media/com_hikashop/upload/';
            } else if (substr($folder, -1) != '/') {
                $folder .= '/';
            }
        } else {
            $folder = 'media/com_hikashop/upload/';
        }

        $image_result_array = array();
        $hikashopimages     = $this->data->get('hikashopimages', 0);
        if (!empty($hikashopimages)) {
            $id_array = array();
            for ($i = 0; $i < count($result); $i++) {
                $id_array[] = $result[$i]['product_id'];
            }

            $image_result = array();
            if (!empty($id_array)) {
                $query        = "SELECT file_ref_id, file_path FROM #__hikashop_file WHERE file_ref_id IN(" . implode(",", $id_array) . ") AND file_type = 'product' ORDER BY file_ordering";
                $image_result = Database::queryAll($query);
            }

            foreach ($image_result as $ir) {
                if (!empty($ir['file_path'])) {
                    $image_result_array[$ir['file_ref_id']][] = $ir['file_path'];
                }
            }
        }

        $data = array();
        for ($i = 0; $i < count($result); $i++) {
            $r = array(
                'title'       => $result[$i]['product_name'],
                'url'         => $this->url($result[$i]['product_id'], $result[$i]['product_alias'], $this->data->get('hikashopitemid', '0')),
                'description' => $result[$i]['product_description']
            );

            $r['image'] = ImageFallback::fallback(array(
                !empty($result[$i]['file_path']) ? $folder . $result[$i]['file_path'] : '',
            ), array(
                @$r['description']
            ));

            if (!empty($result[$i]['file_path'])) {
                $r['thumbnail'] = str_replace($folder, $folder . 'thumbnails/100x100/', $r['image']);
            } else {
                $r['thumbnail'] = $r['image'];
            }

            $r += array(
                'price'                    => $this->getPrice($result[$i]['product_id'], $result[$i]['product_tax_id']),
                'price_without_tax'        => $this->getPrice($result[$i]['product_id']),
                'product_code'             => $result[$i]['product_code'],
                'hits'                     => $result[$i]['product_hit'],
                'brand_url'                => $result[$i]['product_url'],
                'product_weight'           => $result[$i]['product_weight'],
                'product_weight_unit'      => $result[$i]['product_weight_unit'],
                'product_keywords'         => $result[$i]['product_keywords'],
                'product_meta_description' => $result[$i]['product_meta_description'],
                'product_width'            => $result[$i]['product_width'],
                'product_length'           => $result[$i]['product_length'],
                'product_height'           => $result[$i]['product_height'],
                'product_dimension_unit'   => $result[$i]['product_dimension_unit'],
                'product_sales'            => $result[$i]['product_sales'],
                'product_average_score'    => $result[$i]['product_average_score'],
                'product_total_vote'       => $result[$i]['product_total_vote'],
                'product_page_title'       => $result[$i]['product_page_title'],
                'product_alias'            => $result[$i]['product_alias'],
                'product_price_percentage' => $result[$i]['product_price_percentage'],
                'product_msrp'             => $result[$i]['product_msrp'],
                'product_canonical'        => $result[$i]['product_canonical'],
                'product_id'               => $result[$i]['product_id']
            );

            if (!empty($image_result_array[$result[$i]['product_id']])) {
                $j = 0;
                foreach ($image_result_array[$result[$i]['product_id']] as $image) {
                    $j++;
                    $r['image_' . $j] = ImageFallback::fallback(array($folder . $image));
                }
            }

            $data[] = $r;
        }

        return $data;
    }
}
Generator/Joomla/Hikashop/Sources/HikashopProductsbyid.php000064400000015754152355233130017775 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Sources;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use stdClass;

class HikashopProductsbyid extends AbstractGenerator {

    protected $layout = 'product';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('Products') . ' - IDs');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');

        new Textarea($source, 'ids', n2_('Product IDs'), '', array(
            'width'          => 300,
            'height'         => 200,
            'tipLabel'       => n2_('Product IDs'),
            'tipDescription' => n2_('Write the product IDs you want to display here, in the order you want them to appear in the generator. One product ID per line.')
        ));

        new MenuItems($source, 'hikashopitemid', n2_('Menu item (item ID)'), 0);
    }

    function getPrice($pid, $tax_id = 0) {
        $arr                    = array();
        $arr[0]                 = new stdClass();
        $arr[0]->product_id     = $pid;
        $arr[0]->product_tax_id = $tax_id;
        $currencyClass          = hikashop_get('class.currency');
        $zone                   = hikashop_getZone();
        $cur                    = hikashop_getCurrency();
        $currencyClass->getListingPrices($arr, $zone, $cur);
        $i         = 0;
        $currPrice = 0;
        if (isset($arr[0]->prices)) {
            foreach ($arr[0]->prices as $k => $price) {
                if (!$i) {
                    $currPrice = $price->price_value_with_tax;
                }
                if ($price->price_value_with_tax < $currPrice) $currPrice = $price->price_value_with_tax;
                $i++;
            }

            return $currencyClass->format($currPrice, $cur);
        } else {
            return '';
        }
    }

    function url($id, $alias, $itemID) {
        $url = 'index.php?option=com_hikashop&ctrl=product&task=show&cid=' . $id;
        if (!empty($alias)) {
            $url .= '&name=' . $alias;
        }
        if (!empty($itemID) && $itemID != 0) {
            $url .= '&Itemid=' . $itemID;
        }

        return $url;
    }

    function getProductIDs() {
        return array_map('intval', explode("\n", str_replace(array(
            "\r\n",
            "\n\r",
            "\r"
        ), "\n", $this->data->get('ids'))));
    }

    protected function _getData($count, $startIndex) {
        require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php');

        $idarray = self::getProductIDs();

        $where = array(
            "p.product_published = 1 "
        );

        if (count($idarray) > 0) {
            $where[] = "p.product_id IN (" . implode(',', $idarray) . ")";
        }

        $query = "SELECT * FROM #__hikashop_product AS p LEFT JOIN #__hikashop_file AS f ON p.product_id = f.file_ref_id AND f.file_type='product' WHERE " . implode(' AND ', $where);

        $query .= " GROUP BY p.product_id ";

        $order = Common::parse($this->data->get('hikashopproductsorder', 'p.product_created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1];
        }

        $query .= ' LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        if (function_exists('hikashop_config')) {
            $config = hikashop_config();
            $folder = $config->get('uploadfolder');
            if (empty($folder)) {
                $folder = 'media/com_hikashop/upload/';
            } else if (substr($folder, -1) != '/') {
                $folder .= '/';
            }
        } else {
            $folder = 'media/com_hikashop/upload/';
        }

        $data = array();
        for ($i = 0; $i < count($result); $i++) {
            $r = array(
                'title'       => $result[$i]['product_name'],
                'url'         => $this->url($result[$i]['product_id'], $result[$i]['product_alias'], $this->data->get('hikashopitemid', '0')),
                'description' => $result[$i]['product_description']
            );

            $r['image'] = ImageFallback::fallback(array(
                !empty($result[$i]['file_path']) ? $folder . $result[$i]['file_path'] : '',
            ), array(
                @$r['description']
            ));

            if (!empty($result[$i]['file_path'])) {
                $r['thumbnail'] = str_replace($folder, $folder . 'thumbnails/100x100/', $r['image']);
            } else {
                $r['thumbnail'] = $r['image'];
            }

            $r      += array(
                'price'                    => $this->getPrice($result[$i]['product_id'], $result[$i]['product_tax_id']),
                'price_without_tax'        => $this->getPrice($result[$i]['product_id']),
                'product_code'             => $result[$i]['product_code'],
                'hits'                     => $result[$i]['product_hit'],
                'brand_url'                => $result[$i]['product_url'],
                'product_weight'           => $result[$i]['product_weight'],
                'product_weight_unit'      => $result[$i]['product_weight_unit'],
                'product_keywords'         => $result[$i]['product_keywords'],
                'product_meta_description' => $result[$i]['product_meta_description'],
                'product_width'            => $result[$i]['product_width'],
                'product_length'           => $result[$i]['product_length'],
                'product_height'           => $result[$i]['product_height'],
                'product_dimension_unit'   => $result[$i]['product_dimension_unit'],
                'product_sales'            => $result[$i]['product_sales'],
                'product_average_score'    => $result[$i]['product_average_score'],
                'product_total_vote'       => $result[$i]['product_total_vote'],
                'product_page_title'       => $result[$i]['product_page_title'],
                'product_alias'            => $result[$i]['product_alias'],
                'product_price_percentage' => $result[$i]['product_price_percentage'],
                'product_msrp'             => $result[$i]['product_msrp'],
                'product_canonical'        => $result[$i]['product_canonical'],
                'product_id'               => $result[$i]['product_id']
            );
            $data[] = $r;
        }

        return $data;
    }
}
Generator/Joomla/Hikashop/Elements/HikashopBrands.php000064400000002650152355233130016653 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;

class HikashopBrands extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = "SELECT category_id AS id, category_name AS title, category_name AS name,
        category_parent_id AS parent_id, category_parent_id AS parent FROM #__hikashop_category WHERE category_published = 1 AND category_type = 'manufacturer'";

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 1, '', array(), $children, 9999, 0, 0);

        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Hikashop/Elements/HikashopTags.php000064400000001375152355233130016343 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class HikashopTags extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = "SELECT title, id FROM #__tags WHERE published = 1 AND parent_id <> 0";

        $tags = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($tags)) {
            foreach ($tags as $tag) {
                $this->options[$tag->id] = $tag->title;
            }
        }
    }

}
Generator/Joomla/Hikashop/Elements/HikashopCategories.php000064400000002647152355233130017535 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;

class HikashopCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = "SELECT category_id AS id, category_name AS title, category_name AS name,
        category_parent_id AS parent_id, category_parent_id AS parent FROM #__hikashop_category WHERE category_published = 1 AND category_type = 'product'";

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 1, '', array(), $children, 9999, 0, 0);

        $this->options['0'] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Hikashop/Elements/HikashopWarehouses.php000064400000001522152355233130017564 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Hikashop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class HikashopWarehouses extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = "SELECT warehouse_name, warehouse_id FROM #__hikashop_warehouse WHERE warehouse_published = 1";

        $warehouses = Database::queryAll($query, false, "object");

        $this->options['0'] = n2_('All');

        if (count($warehouses)) {
            foreach ($warehouses as $warehouse) {
                $this->options[$warehouse->warehouse_id] = $warehouse->warehouse_name;
            }
        }
    }

}
Generator/Joomla/Flexicontent/GeneratorGroupFlexicontent.php000064400000002104152355233130020413 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Sources\FlexicontentItems;

class GeneratorGroupFlexicontent extends AbstractGeneratorGroup {

    protected $name = 'flexicontent';

    protected $url = 'https://extensions.joomla.org/extension/flexicontent/';

    public function getLabel() {
        return 'FLEXIcontent';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'FLEXIcontent');
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_flexicontent');
    }

    protected function loadSources() {
        new FlexicontentItems($this, 'items', 'Items');
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupFlexicontent);

Generator/Joomla/Flexicontent/Sources/FlexicontentItems.php000064400000025420152355233130020162 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Sources;

use DateTime;
use DateTimeZone;
use FlexicontentHelperRoute;
use Joomla\CMS\Factory;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Elements\FlexicontentCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Elements\FlexicontentTags;
use Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Elements\FlexicontentTypes;

class FlexicontentItems extends AbstractGenerator {

    protected $layout = 'article';

    protected $translate = array();

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'FLEXIcontent');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new FlexicontentTypes($source, 'sourcetype', n2_('Type'), 0);
        new FlexicontentCategories($source, 'sourcecategory', n2_('Categories'), 0, array(
            'isMultiple' => true
        ));
        new FlexicontentTags($source, 'sourcetag', n2_('Tags'), 0, array(
            'isMultiple' => true
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'sourcefeatured', n2_('Featured'), 0);
        new Text($limit, 'sourcelanguage', n2_('Language'), '*');
        new Text($limit, 'sourceids', n2_('Only display items with these IDs'), '');

        $date = $filterGroup->createRow('date-row');
        new Text($date, 'dateformat', n2_('Date format'), 'Y-m-d');
        new Text($date, 'timeformat', n2_('Time format'), 'G:i');
        new Text($date, 'offset', n2_('Offset hours'), '', array(
            'tipLabel'       => n2_('Offset hours'),
            'tipDescription' => n2_('Timezone offset in hours. For example: +2 or -7. If you leave it empty, Joomla\'s System -> Global Configuration -> Server -> Server Time Zone setting will be used.')
        ));
        new Textarea($date, 'translatedate', n2_('Translate date and time'), 'January->January||February->February||March->March', array(
            'width'  => 300,
            'height' => 100
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'flexiorder', 'con.created|*|desc', array(
            'options' => array(
                ''                 => n2_('None'),
                'con.title'        => n2_('Title'),
                'cat_title'        => n2_('Category title'),
                'created_by_alias' => n2_('Username'),
                'con.featured'     => n2_('Featured'),
                'con.ordering'     => n2_('Ordering'),
                'con.hits'         => n2_('Hits'),
                'con.created'      => n2_('Creation time'),
                'con.modified'     => n2_('Modification time')
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $query = 'SELECT ';
        $query .= 'con.id, con.title, con.images, con.introtext, con.fulltext, con.hits, con.created, con.modified, cat.id AS category_id, cat.title AS category_title, users.name AS created_by, users.username AS created_by_username ';

        $query .= 'FROM #__content AS con ';

        $query .= 'LEFT JOIN #__flexicontent_cats_item_relations AS fcat ON fcat.itemid = con.id ';
        $query .= 'LEFT JOIN #__categories AS cat ON fcat.catid = cat.id ';
        $query .= 'LEFT JOIN #__users AS users ON con.created_by = users.id ';

        $jNow  = Factory::getDate();
        $now   = $jNow->toSql();
        $where = array(
            "(con.publish_up = '0000-00-00 00:00:00' OR con.publish_up IS NULL OR con.publish_up < '" . $now . "') AND (con.publish_down = '0000-00-00 00:00:00' OR con.publish_down IS NULL OR con.publish_down > '" . $now . "') ",
            'con.state = 1 '
        );

        $category = array_map('intval', explode('||', $this->data->get('sourcecategory', '')));
        if (!in_array('0', $category)) {
            $where[] = 'fcat.catid IN (' . implode(',', $category) . ') ';
        }

        $tag = array_map('intval', explode('||', $this->data->get('sourcetag', '0')));
        if (!in_array('0', $tag)) {
            $where[] = ' con.id IN (SELECT itemid FROM #__flexicontent_tags_item_relations WHERE tid IN(' . implode(',', $tag) . '))';
        }

        $type = array_map('intval', explode('||', $this->data->get('sourcetype', '0')));
        if (!in_array('0', $type)) {
            $where[] = ' con.id IN (SELECT item_id FROM #__flexicontent_items_ext WHERE type_id IN(' . implode(',', $type) . '))';
        }

        $ids = $this->data->get('sourceids', '');
        if (!empty($ids)) {
            $where[] = ' con.id IN (' . $ids . ')';
        }

        switch ($this->data->get('sourcefeatured', 0)) {
            case 1:
                $where[] = 'con.featured = 1 ';
                break;
            case -1:
                $where[] = 'con.featured = 0 ';
                break;
        }

        $language = $this->data->get('sourcelanguage', '*');
        if ($language) {
            $db      = Factory::getDbo();
            $where[] = 'con.language = ' . $db->quote($language) . ' ';
        }

        if (count($where)) {
            $query .= ' WHERE ' . implode(' AND ', $where);
        }

        $query .= 'GROUP BY con.id ';

        $order = Common::parse($this->data->get('flexiorder', 'con.created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        require_once(JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'route.php');

        $this->processTranslateField();
        $dateFormat = $this->data->get('dateformat', 'Y-m-d');
        $timeFormat = $this->data->get('timeformat', 'G:i');

        $data = array();
        for ($i = 0; $i < count($result); $i++) {
            $r = array(
                'title'       => $result[$i]['title'],
                'description' => $result[$i]['introtext'],
                'introtext'   => $result[$i]['introtext'],
                'fulltext'    => $result[$i]['fulltext'],
            );

            if (!empty($result[$i]['images'])) {
                $img        = json_decode($result[$i]['images']);
                $r['image'] = $r['thumbnail'] = ImageFallback::fallback(array(
                    @$img->image_intro,
                    @$img->image_fulltext
                ), array(
                    $result[$i]['introtext']
                ));
            }

            $r += array(
                'url'                 => FlexicontentHelperRoute::getItemRoute($result[$i]['id'], $result[$i]['category_id']),
                'creation_date'       => $this->translate($this->datify($result[$i]['created'], $dateFormat)),
                'creation_time'       => $this->translate($this->datify($result[$i]['created'], $timeFormat)),
                'modification_date'   => $this->translate($this->datify($result[$i]['modified'], $dateFormat)),
                'modification_time'   => $this->translate($this->datify($result[$i]['modified'], $timeFormat)),
                'created_by'          => $result[$i]['created_by'],
                'created_by_username' => $result[$i]['created_by_username'],
                'hits'                => $result[$i]['hits'],
                'category_title'      => $result[$i]['category_title'],
                'id'                  => $result[$i]['id'],
                'category_id'         => $result[$i]['category_id'],
                'category_url'        => FlexicontentHelperRoute::getCategoryRoute($result[$i]['category_id'])
            );

            $r += $this->getFields($result[$i]['id']);

            $data[] = $r;
        }

        return $data;
    }

    private function getFields($id) {
        $query  = "SELECT item.value, fields.id, fields.name FROM #__flexicontent_fields_item_relations AS item LEFT JOIN #__flexicontent_fields AS fields ON item.field_id = fields.id WHERE item_id = " . $id;
        $fields = Database::queryAll($query);

        $data = array();
        foreach ($fields as $field) {
            $values = @unserialize($field['value']);
            if ($values === false) {
                $data += array($field['name'] . $field['id'] => $field['value']);
            } else {
                foreach ($values as $name => $value) {
                    $data += array($field['name'] . $field['id'] . '_' . $name => $value);
                }
            }
        }

        return $data;
    }

    private function datify($date, $format) {
        if ($date != "0000-00-00 00:00:00") {
            $config   = Factory::getConfig();
            $timezone = new DateTimeZone($config->get('offset'));

            $offset = $this->data->get('offset', '');
            if ($offset !== '') {
                $offset = intval($offset) * 3600;
            } else {
                $offset = $timezone->getOffset(new DateTime);
            }

            $result = date($format, strtotime($date) + $offset);

            return $result;
        } else {
            return '';
        }
    }

    private function processTranslateField() {
        $translateField  = $this->data->get('translatedate', '');
        $translateValues = explode('||', $translateField);
        if ($translateField != 'January->January||February->February||March->March' && !empty($translateValues)) {
            foreach ($translateValues as $translateValue) {
                $translateFromTo = explode('->', $translateValue);
                if (!empty($translateFromTo) && count($translateFromTo) == 2) {
                    $this->translate[$translateFromTo[0]] = $translateFromTo[1];
                }
            }
        }
    }

    private function translate($text) {
        if (!empty($this->translate) && !empty($text)) {
            foreach ($this->translate as $from => $to) {
                $text = str_replace($from, $to, $text);
            }
        }

        return $text;
    }
}Generator/Joomla/Flexicontent/Elements/FlexicontentCategories.php000064400000003154152355233130021317 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Elements;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Form\Element\Select;


class FlexicontentCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        $query = 'SELECT
                    m.id, 
                    m.title AS name, 
                    m.title, 
                    m.parent_id AS parent, 
                    m.parent_id
                FROM #__categories m
                WHERE m.published = 1 AND (m.extension = "com_content" OR m.extension = "system")
                ORDER BY m.lft';


        $db->setQuery($query);
        $menuItems = $db->loadObjectList();
        $children  = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        $this->options['0'] = n2_('All');

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        if (count($options)) {
            array_shift($options);
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Flexicontent/Elements/FlexicontentTags.php000064400000001440152355233130020124 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Elements;

use Joomla\CMS\Factory;
use Nextend\Framework\Form\Element\Select;


class FlexicontentTags extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        $db->setQuery('SELECT id, name FROM #__flexicontent_tags WHERE published = 1 ORDER BY id');
        $menuItems = $db->loadObjectList();

        $this->options['0'] = n2_('All');

        if (count($menuItems)) {
            foreach ($menuItems as $option) {
                $this->options[$option->id] = $option->name;
            }
        }
    }
}
Generator/Joomla/Flexicontent/Elements/FlexicontentTypes.php000064400000001617152355233130020340 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Flexicontent\Elements;

use Joomla\CMS\Factory;
use Nextend\Framework\Form\Element\Select;


class FlexicontentTypes extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $db = Factory::getDBO();

        $db->setQuery('SELECT id, name FROM #__flexicontent_types WHERE published = 1 ORDER BY id');
        $menuItems = $db->loadObjectList();

        $this->options[0] = 'All';

        if (count($menuItems)) {
            foreach ($menuItems as $option) {
                $this->options[$option->id] = $option->name;
            }
            if ($this->getValue() == '') {
                $this->setValue($menuItems[0]->id);
            }
        }

    }

}
Generator/Joomla/Eventsbooking/GeneratorGroupEventsbooking.php000064400000002172152355233130020746 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eventsbooking;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eventsbooking\Sources\EventsbookingEvents;

class GeneratorGroupEventsbooking extends AbstractGeneratorGroup {

    protected $name = 'eventsbooking';

    protected $url = 'https://extensions.joomla.org/extension/event-booking/';

    public function getLabel() {
        return 'Event Booking';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'Event Booking');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_eventbooking' . DIRECTORY_SEPARATOR . 'eventbooking.php');
    }

    protected function loadSources() {
        new EventsbookingEvents($this, 'events', n2_('Events'));
    }
}

GeneratorFactory::addGenerator(new GeneratorGroupEventsbooking);
Generator/Joomla/Eventsbooking/Sources/EventsbookingEvents.php000064400000026075152355233130020702 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eventsbooking\Sources;

use EventbookingHelper;
use EventbookingHelperRoute;
use Joomla\CMS\Router\Route;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Joomla\Element\Select\MenuItems;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eventsbooking\Elements\EventsbookingCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eventsbooking\Elements\EventsbookingLocations;

require_once(JPATH_SITE . '/components/com_eventbooking/helper/helper.php');
require_once(JPATH_SITE . '/components/com_eventbooking/helper/route.php');

class EventsbookingEvents extends AbstractGenerator {

    protected $layout = 'event';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'Event Booking');
    }

    private function formatDate($datetime, $dateOrTime, $format) {
        if ($dateOrTime == 1 || $datetime != '0000-00-00 00:00:00') {
            return date($format, strtotime($datetime));
        } else {
            return '';
        }
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EventsbookingCategories($source, 'sourcecategories', n2_('Categories'), 0, array(
            'isMultiple' => true
        ));
        new EventsbookingLocations($source, 'sourcelocations', n2_('Locations'), 0, array(
            'isMultiple' => true
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'started', n2_('Started'), 0);
        new Filter($limit, 'ended', n2_('Ended'), -1);
        new Filter($limit, 'published', n2_('Published'), 1);
        new Filter($limit, 'featured', n2_('Featured'), 0);
        new Select($limit, 'recurring', n2_('Recurring'), '0', array(
            'options' => array(
                '0' => n2_('All'),
                '1' => n2_('All, but from recurring ones only parent events'),
                '2' => n2_('Only recurring events'),
                '3' => n2_('Only recurring event parents'),
                '4' => n2_('Only not recurring events')
            )
        ));


        $variables = $filterGroup->createRow('variable');
        new Text($variables, 'dateformat', n2_('Date format'), 'm-d-Y');
        new Text($variables, 'timeformat', n2_('Time format'), 'G:i');
        new MenuItems($variables, 'itemid', n2_('Menu item (item ID)'), 0);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'eventsbookingorder', 'event_date|*|asc', array(
            'options' => array(
                ''                           => n2_('None'),
                'event_date'                 => n2_('Start date'),
                'event_end_date'             => n2_('End date'),
                'id'                         => n2_('ID'),
                'title'                      => n2_('Title'),
                'individual_price'           => n2_('Price'),
                'discount'                   => n2_('Discount'),
                'registration_start_date'    => n2_('Registration start date'),
                'cut_off_date'               => n2_('Cut off date'),
                'cancel_before_date'         => n2_('Cancel before date'),
                'publish_up'                 => n2_('Publish up date'),
                'publish_down'               => n2_('Publish down date'),
                'early_bird_discount_date'   => n2_('Early bird discount date'),
                'early_bird_discount_amount' => n2_('Early bird discount amount'),
                'late_fee_date'              => n2_('Late fee date'),
                'recurring_end_date'         => n2_('Recurring end date'),
                'max_end_date'               => n2_('Max end date')
            )
        ));
    }

    protected function _getData($count, $startIndex) {
        $dateFormat = $this->data->get('dateformat', 'Y-m-d');
        if (empty($dateFormat)) {
            $dateFormat = 'Y-m-d';
        }

        $timeFormat = $this->data->get('timeformat', 'H:i:s');
        if (empty($timeFormat)) {
            $timeFormat = 'H:i:s';
        }

        $itemId = $this->data->get('itemid', '0');

        $where = array();

        $categories = array_map('intval', explode('||', $this->data->get('sourcecategories', '')));
        if (!in_array('0', $categories)) {
            $where[] = ' id IN (SELECT event_id FROM #__eb_event_categories WHERE category_id IN (' . implode(', ', $categories) . '))';
        }

        $locations = array_map('intval', explode('||', $this->data->get('sourcelocations', '')));
        if (!in_array('0', $locations)) {
            $where[] = ' location_id IN(' . implode(', ', $locations) . ')';
        }

        $today = date('Y-m-d h:i:s', time());

        switch ($this->data->get('started', '0')) {
            case 1:
                $where[] = " event_date < '" . $today . "'";
                break;
            case -1:
                $where[] = " event_date >= '" . $today . "'";
                break;
        }

        switch ($this->data->get('ended', '-1')) {
            case 1:
                $where[] = " (event_end_date < '" . $today . "' AND event_end_date <> '0000-00-00 00:00:00')";
                break;
            case -1:
                $where[] = " (event_end_date >= '" . $today . "' OR event_end_date = '0000-00-00 00:00:00')";
                break;
        }

        switch ($this->data->get('recurring', '0')) {
            case 0:
                break;
            case 1:
                $where[] = " parent_id = 0";
                break;
            case 2:
                $where[] = " (recurring_type > 0 OR parent_id > 0)";
                break;
            case 3:
                $where[] = " recurring_type > 0";
                break;
            case 4:
                $where[] = " recurring_frequency is NULL";
                break;
        }

        switch ($this->data->get('published', '1')) {
            case 0:
                break;
            case 1:
                $where[] = " published = 1";
                break;
            case -1:
                $where[] = " published = 0";
                break;
        }

        switch ($this->data->get('featured', '1')) {
            case 0:
                break;
            case 1:
                $where[] = " featured = 1";
                break;
            case -1:
                $where[] = " featured = 0";
                break;
        }

        $query = 'SELECT * FROM #__eb_events';
        if (!empty($where)) {
            $query .= ' WHERE' . implode(' AND ', $where);
        }

        $order = Common::parse($this->data->get('eventsbookingorder', 'event_date|*|asc'));
        if ($order[0]) {
            $query .= ' ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= ' LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);
        $data   = array();
        $config = EventbookingHelper::getConfig();
        foreach ($result as $res) {
            $r = array(
                'title'             => $res['title'],
                'description'       => $res['description'],
                'short_description' => $res['short_description']
            );

            $r['image'] = ImageFallback::fallback(array(
                !empty($res['image']) ? $res['image'] : '',
                !empty($res['thumb']) ? 'images/com_eventbooking/' . $res['thumb'] : '',
                !empty($res['thumb']) ? 'media/com_eventbooking/images/' . $res['thumb'] : ''
            ), array(
                $res['description'],
                $res['short_description']
            ));

            $r['thumbnail'] = ImageFallback::fallback(array(
                !empty($res['thumb']) ? 'images/com_eventbooking/thumb/' . $res['thumb'] : '',
                !empty($res['thumb']) ? 'media/com_eventbooking/images/thumb/' . $res['thumb'] : '',
                $r['image']
            ));

            $r['url'] = Route::_(EventbookingHelperRoute::getEventRoute($res['id'], 0, $itemId), false);
            $r        += array(
                'start_date'                             => $this->formatDate($res['event_date'], 0, $dateFormat),
                'start_time'                             => $this->formatDate($res['event_date'], 1, $timeFormat),
                'end_date'                               => $this->formatDate($res['event_end_date'], 0, $dateFormat),
                'end_time'                               => $this->formatDate($res['event_end_date'], 1, $timeFormat),
                'price'                                  => EventbookingHelper::formatCurrency($res['individual_price'], $config, $res['currency_symbol']),
                'discount'                               => EventbookingHelper::formatCurrency($res['discount'], $config, $res['currency_symbol']),
                'unformatted_price'                      => $res['individual_price'],
                'unformatted_discount'                   => $res['discount'],
                'tax_rate'                               => $res['tax_rate'],
                'price_with_tax'                         => EventbookingHelper::formatCurrency(round($res['individual_price'] * (1 + $res['tax_rate'] / 100), 2), $config, $res['currency_symbol']),
                'unformatted_price_with_tax'             => round($res['individual_price'] * (1 + $res['tax_rate'] / 100), 2),
                'early_bird_discount_date'               => $this->formatDate($res['early_bird_discount_date'], 0, $dateFormat),
                'early_bird_discount_amount'             => EventbookingHelper::formatCurrency($res['early_bird_discount_amount'], $config, $res['currency_symbol']),
                'unformatted_early_bird_discount_amount' => $res['early_bird_discount_amount'],
                'cut_off_date'                           => $this->formatDate($res['cut_off_date'], 0, $dateFormat),
                'cancel_before_date'                     => $this->formatDate($res['cancel_before_date'], 0, $dateFormat),
                'recurring_end_date'                     => $this->formatDate($res['recurring_end_date'], 0, $dateFormat),
                'registration_start_date'                => $this->formatDate($res['registration_start_date'], 0, $dateFormat)
            );
            $data[]   = $r;
        }

        return $data;
    }

}Generator/Joomla/Eventsbooking/Elements/EventsbookingCategories.php000064400000002416152355233130021645 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eventsbooking\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;

class EventsbookingCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query     = "SELECT id, parent AS parent_id, name AS title FROM #__eb_categories";
        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }
        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);

        $this->options[0] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Eventsbooking/Elements/EventsbookingLocations.php000064400000001411152355233130021505 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eventsbooking\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EventsbookingLocations extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query     = "SELECT id, name FROM #__eb_locations";
        $locations = Database::queryAll($query, false, "object");

        $this->options[0] = n2_('All');

        if (count($locations)) {
            foreach ($locations as $location) {
                $this->options[$location->id] = $location->name;
            }
        }
    }

}
Generator/Joomla/Eshop/GeneratorGroupEshop.php000064400000002101152355233130015440 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Sources\EshopProducts;

class GeneratorGroupEshop extends AbstractGeneratorGroup {

    protected $name = 'eshop';

    protected $url = 'https://extensions.joomla.org/extension/e-commerce/shopping-cart/eshop/';

    public function getLabel() {
        return 'EShop';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EShop');
    }

    public function isInstalled() {
        return Filesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_eshop' . DIRECTORY_SEPARATOR . 'eshop.php');
    }

    protected function loadSources() {
        new EshopProducts($this, 'products', n2_('Products'));
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupEshop);
Generator/Joomla/Eshop/Sources/EshopProducts.php000064400000041342152355233130015735 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Sources;

use EshopHelper;
use EshopRoute;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\Url\Url;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements\EshopCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements\EshopCategoryLanguage;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements\EshopCurrency;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements\EshopManufacturerLanguage;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements\EshopManufacturers;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements\EshopProductLanguage;
use Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements\EshopTags;

class EshopProducts extends AbstractGenerator {

    protected $layout = 'product';

    var $leftSymbol;
    var $rightSymbol;
    var $decimalPlace;
    var $currentTime;
    var $exchangeValue;
    var $decimalPoint;
    var $thousandsSeparator;
    var $categoryTree;

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EShop');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EshopCategories($source, 'eshopsourcecategories', n2_('Categories'), 0, array(
            'isMultiple' => true
        ));
        new EshopManufacturers($source, 'eshopsourcemanufacturers', n2_('Manufacturer'), 0, array(
            'isMultiple' => true
        ));
        new EshopTags($source, 'eshopsourcetags', n2_('Tags'), 0, array(
            'isMultiple' => true
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'eshopsourcefeatured', n2_('Featured'), 0);
        new Filter($limit, 'eshopsourcediscount', n2_('On discount'), 0);
        new Filter($limit, 'eshopsourceinstock', n2_('In stock'), 0);
        new OnOff($limit, 'eshopsourcesubcategory', n2_('Include subcategories'), 0);


        $language = $filterGroup->createRow('language');
        new EshopCurrency($language, 'eshopsourcecurrencycode', n2_('Currency'), 0);
        new EshopProductLanguage($language, 'eshopsourceproductlanguage', n2_('Product language'), 0);
        new EshopCategoryLanguage($language, 'eshopsourcecategorylanguage', n2_('Category language'), 0);
        new EshopManufacturerLanguage($language, 'eshopsourcemanufacturerlanguage', n2_('Manufacturer language'), 0);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'eshoporder', 'p.created_date|*|desc', array(
            'options' => array(
                ''                => n2_('None'),
                'p.product_price' => n2_('Price'),
                'pd.product_name' => n2_('Product name'),
                'p.ordering'      => n2_('Ordering'),
                'p.hits'          => n2_('Hits'),
                'p.created_date'  => n2_('Creation time'),
                'p.modified_date' => n2_('Modification time'),
                'p.id'            => n2_('Product ID')
            )
        ));
    }

    protected function resetState() {
        $this->leftSymbol         = '';
        $this->rightSymbol        = '';
        $this->decimalPlace       = '';
        $this->currentTime        = '';
        $this->exchangeValue      = '';
        $this->decimalPoint       = '';
        $this->thousandsSeparator = '';
        $this->categoryTree       = array();
    }

    function setCurrencyDetails($left, $right, $dec, $point, $thou, $now, $exchange) {
        $this->leftSymbol         = $left;
        $this->rightSymbol        = $right;
        $this->decimalPlace       = $dec;
        $this->decimalPoint       = $point;
        $this->thousandsSeparator = $thou;
        $this->currentTime        = $now;
        $this->exchangeValue      = $exchange;
    }

    function decimals($var) {
        if (!empty($this->decimalPlace)) {
            return number_format($var, $this->decimalPlace, $this->decimalPoint, $this->thousandsSeparator);
        } else {
            return round($var);
        }
    }

    function createPrice($product_price, $discount_price = null, $discount_date_start = null, $discount_date_end = null, $symbol = true) {
        if ($symbol) {
            $price = $this->leftSymbol;
        } else {
            $price = '';
        }
        if (!empty($discount_price)) {
            if (($discount_date_start == '0000-00-00 00:00:00' || $discount_date_start <= $this->currentTime) && ($discount_date_end == '0000-00-00 00:00:00' || $discount_date_end > $this->currentTime)) {
                $product_price = $discount_price;
            }
        }
        $product_price = $this->exchangeValue * $product_price;
        $price         .= $this->decimals($product_price);
        $price         .= $this->rightSymbol;

        return $price;
    }

    function buildCategoryTree($categoryID) {
        $categories = EshopHelper::getCategories($categoryID);
        if (!empty($categories)) {
            foreach ($categories as $cat) {
                $this->categoryTree[] = $cat->id;
                $this->buildCategoryTree($cat->id);
            }
        }
    }

    protected function _getData($count, $startIndex) {
        if (!class_exists('EshopRoute')) {
            require_once(JPATH_SITE . '/components/com_eshop/helpers/helper.php');
            require_once(JPATH_SITE . '/components/com_eshop/helpers/route.php');
        }

        $categories    = array_map('intval', explode('||', $this->data->get('eshopsourcecategories', '0')));
        $manufacturers = array_map('intval', explode('||', $this->data->get('eshopsourcemanufacturers', '0')));
        $tags          = array_map('intval', explode('||', $this->data->get('eshopsourcetags', '0')));

        if ($this->data->get('eshopsourcesubcategory', '0') == 1) {
            foreach ($categories as $cat) {
                $this->buildCategoryTree($cat);
            }
            $categories = $this->categoryTree;
        }

        $where = array('p.published = 1');
        if (!in_array(0, $categories) && count($categories) > 0) {
            $where[] = 'pc.category_id IN(' . implode(', ', $categories) . ') ';
        }
        if (!in_array(0, $manufacturers) && count($manufacturers) > 0) {
            $where[] = 'p.manufacturer_id IN(' . implode(', ', $manufacturers) . ') ';
        }
        if (!in_array(0, $tags) && count($tags) > 0) {
            $where[] = 'pt.tag_id IN(' . implode(', ', $tags) . ') ';
        }

        switch ($this->data->get('eshopsourcefeatured', 0)) {
            case 1:
                $where[] = 'p.product_featured = 1 ';
                break;
            case -1:
                $where[] = 'p.product_featured = 0 ';
                break;
        }

        $jNow = Factory::getDate();
        $now  = $jNow->toSql();
        switch ($this->data->get('eshopsourcediscount', 0)) {
            case 1:
                $where[] = "p.id IN (SELECT product_id FROM #__eshop_productdiscounts WHERE
        date_start = '0000-00-00 00:00:00' OR date_start IS NULL OR date_start <= '" . $now . "' AND date_end = '0000-00-00 00:00:00' OR date_end IS NULL OR date_end > '" . $now . "') ";
                break;
            case -1:
                $where[] = "p.id NOT IN (SELECT product_id FROM #__eshop_productdiscounts WHERE
        date_start = '0000-00-00 00:00:00' OR date_start IS NULL OR date_start <= '" . $now . "' AND date_end = '0000-00-00 00:00:00' OR date_end IS NULL OR date_end > '" . $now . "') ";
                break;
        }

        switch ($this->data->get('eshopsourceinstock', 0)) {
            case 1:
                $where[] = "p.product_quantity > 0";
                break;
            case -1:
                $where[] = "product_quantity = 0";
                break;
        }

        $prodLang = $this->data->get('eshopsourceproductlanguage', '');
        if (!empty($prodLang)) {
            $where[] = "pd.language = '" . $prodLang . "'";
        }

        $catLang = $this->data->get('eshopsourcecategorylanguage', '');
        if (!empty($catLang)) {
            $where[] = "cd.language = '" . $catLang . "'";
        }

        $manLang = $this->data->get('eshopsourcemanufacturerlanguage', '');
        if (!empty($manLang)) {
            $where[] = "md.language = '" . $manLang . "'";
        }

        $currencyCode = $this->data->get('eshopsourcecurrencycode', '');
        if (!empty($currencyCode)) {
            $where[] = "cu.currency_code = '" . $currencyCode . "'";
        } else {
            $where[] = "cu.currency_code = (SELECT config_value FROM #__eshop_configs WHERE config_key = 'default_currency_code' LIMIT 1)";
        }

        $query = "SELECT *, cow.config_value AS image_thumb_width, coh.config_value AS image_thumb_height, p.id AS id
                  FROM #__eshop_products AS p
                  LEFT JOIN #__eshop_productcategories AS pc ON p.id = pc.product_id
                  LEFT JOIN #__eshop_productdetails AS pd ON p.id = pd.product_id
                  LEFT JOIN #__eshop_productimages AS pi ON p.id = pi.product_id
                  LEFT JOIN #__eshop_productdiscounts AS pdi ON p.id = pdi.product_id
                  LEFT JOIN #__eshop_producttags as pt ON p.id = pt.product_id
                  LEFT JOIN #__eshop_categories as c ON c.id = pc.category_id
                  LEFT JOIN #__eshop_categorydetails as cd ON cd.category_id = pc.category_id
                  LEFT JOIN #__eshop_manufacturers as m ON p.manufacturer_id = m.id
                  LEFT JOIN #__eshop_manufacturerdetails AS md ON p.manufacturer_id = md.manufacturer_id
                  CROSS JOIN #__eshop_currencies AS cu
                  CROSS JOIN #__eshop_configs AS cow
                  CROSS JOIN #__eshop_configs AS coh
                  WHERE cow.config_key = 'image_thumb_width' AND coh.config_key = 'image_thumb_height' AND " . implode(' AND ', $where) . " GROUP BY p.id ";

        $order = Common::parse($this->data->get('eshoporder', 'p.created_date|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count . ' ';

        $result = Database::queryAll($query);

        $query = 'SELECT tax_rate FROM #__eshop_taxes';
        $taxes = Database::queryAll($query);

        $data = array();
        foreach ($result as $res) {
            $this->setCurrencyDetails($res['left_symbol'], $res['right_symbol'], $res['decimal_place'], $res['decimal_symbol'], $res['thousands_separator'], $now, $res['exchanged_value']);
            $r = array(
                'title'             => $res['product_name'],
                'url'               => Route::_(EshopRoute::getProductRoute($res['id'], $res['category_id'])),
                'description'       => $res['product_desc'],
                'short_description' => $res['product_short_desc']
            );

            $r['image'] = ImageFallback::fallback(array(
                !empty($res['product_image']) ? 'media/com_eshop/products/' . $res['product_image'] : ''
            ), array($res['product_desc']));

            $reSized = explode('.', $res['product_image']);
            if (count($reSized) == 2 && file_exists(JPATH_ROOT . '/media/com_eshop/products/resized/' . $reSized[0] . '-' . $res['image_thumb_width'] . 'x' . $res['image_thumb_height'] . '.' . $reSized[1])) {
                $r['thumbnail'] = ResourceTranslator::urlToResource(JPATH_ROOT . 'media/com_eshop/products/resized/' . $reSized[0] . '-' . $res['image_thumb_width'] . 'x' . $res['image_thumb_height'] . '.' . $reSized[1]);
            } else {
                $r['thumbnail'] = $r['image'];
            }

            $r += array(
                'price'                                  => $this->createPrice($res['product_price']),
                'price_without_currency_symbol'          => $this->createPrice($res['product_price'], null, null, null, false),
                'discount_price'                         => $this->createPrice($res['price']),
                'discount_price_without_currency_symbol' => $this->createPrice($res['price'], null, null, null, false),
                'id'                                     => $res['id'],
                'product_sku'                            => $res['product_sku'],
                'product_weight'                         => $this->decimals($res['product_weight']),
                'product_length'                         => $this->decimals($res['product_length']),
                'product_width'                          => $this->decimals($res['product_width']),
                'product_height'                         => $this->decimals($res['product_height']),
                'product_shipping_cost'                  => $this->createPrice($res['product_shipping_cost']),
                'hits'                                   => $res['hits'],
                'product_page_title'                     => $res['product_page_title'],
                'product_page_heading'                   => $res['product_page_heading'],
                'tab1_title'                             => $res['tab1_title'],
                'tab1_content'                           => $res['tab1_content'],
                'tab2_title'                             => $res['tab2_title'],
                'tab2_content'                           => $res['tab2_content'],
                'tab3_title'                             => $res['tab3_title'],
                'tab3_content'                           => $res['tab3_content'],
                'tab4_title'                             => $res['tab4_title'],
                'tab4_content'                           => $res['tab4_content'],
                'tab5_title'                             => $res['tab5_title'],
                'tab5_content'                           => $res['tab5_content'],
                'category_name'                          => $res['category_name'],
                'category_desc'                          => $res['category_desc'],
                'category_image'                         => !empty($res['category_image']) ? ResourceTranslator::urlToResource(Url::pathToUri(JPATH_ROOT . '/media/com_eshop/categories/' . $res['category_image'])) : '',
                'category_url'                           => Route::_(EshopRoute::getCategoryRoute($res['category_id'])),
                'manufacturer_email'                     => $res['manufacturer_email'],
                'manufacturer_url'                       => $res['manufacturer_url'],
                'manufacturer_site_url'                  => Route::_(EshopRoute::getManufacturerRoute($res['manufacturer_id'])),
                'manufacturer_image'                     => !empty($res['manufacturer_image']) ? ResourceTranslator::urlToResource(Url::pathToUri(JPATH_ROOT . '/media/com_eshop/manufacturers/' . $res['manufacturer_image'])) : '',
                'manufacturer_name'                      => $res['manufacturer_name'],
                'manufacturer_desc'                      => $res['manufacturer_desc'],
                'manufacturer_page_title'                => $res['manufacturer_page_title'],
                'manufacturer_page_heading'              => $res['manufacturer_page_heading']
            );

            $r['full_price'] = $r['price'];

            $j = 1;
            foreach ($taxes as $tax) {
                $r['price_with_tax' . $j] = $this->createPrice($res['product_price'] + $res['product_price'] * $tax['tax_rate'] / 100);
                $j++;
            }

            $k     = 1;
            $query = 'SELECT tag_name FROM #__eshop_producttags as pt LEFT JOIN #__eshop_tags AS t ON pt.tag_id = t.id WHERE product_id = ' . $res['id'] . ';';
            $tags  = Database::queryAll($query);
            foreach ($tags as $tag) {
                $r['tag_name' . $k] = $tag['tag_name'];
                $k++;
            }

            $data[] = $r;
        }

        return $data;
    }

}Generator/Joomla/Eshop/Elements/EshopCategories.php000064400000002734152355233130016352 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EshopCategories extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT a.id AS id, a.category_parent_id AS parent_id, b.category_name AS title
                  FROM #__eshop_categories AS a
                  LEFT JOIN #__eshop_categorydetails AS b ON a.id = b.category_id
                  WHERE a.published = 1
                  ORDER BY parent_id';

        $menuItems = Database::queryAll($query, false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }
        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);

        $this->options[0] = n2_('All');

        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }

}
Generator/Joomla/Eshop/Elements/EshopCategoryLanguage.php000064400000001515152355233130017502 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EshopCategoryLanguage extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT language
                  FROM #__eshop_categorydetails
                  GROUP BY language';

        $languages = Database::queryAll($query, false, "object");

        $this->options[0] = n2_('Default');

        if (count($languages)) {
            foreach ($languages as $language) {
                $this->options[$language->language] = $language->language;
            }
        }
    }

}
Generator/Joomla/Eshop/Elements/EshopCurrency.php000064400000001457152355233130016060 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EshopCurrency extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT currency_code
                  FROM #__eshop_currencies
                  ORDER BY id';

        $codes = Database::queryAll($query, false, "object");

        $this->options[0] = n2_('Default');
        if (count($codes)) {
            foreach ($codes as $code) {
                $this->options[$code->currency_code] = $code->currency_code;
            }
        }
    }

}
Generator/Joomla/Eshop/Elements/EshopManufacturerLanguage.php000064400000001523152355233130020360 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EshopManufacturerLanguage extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT language
                  FROM #__eshop_manufacturerdetails
                  GROUP BY language';

        $languages = Database::queryAll($query, false, "object");

        $this->options[0] = n2_('Default');
        if (count($languages)) {
            foreach ($languages as $language) {
                $this->options[$language->language] = $language->language;
            }
        }
    }

}
Generator/Joomla/Eshop/Elements/EshopManufacturers.php000064400000001623152355233130017100 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EshopManufacturers extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT manufacturer_name, manufacturer_id
                  FROM #__eshop_manufacturerdetails
                  ORDER BY manufacturer_id';

        $manufacturers = Database::queryAll($query, false, "object");

        $this->options[0] = n2_('All');

        if (count($manufacturers)) {
            foreach ($manufacturers as $manufacturer) {
                $this->options[$manufacturer->manufacturer_id] = $manufacturer->manufacturer_name;
            }
        }
    }

}
Generator/Joomla/Eshop/Elements/EshopProductLanguage.php000064400000001511152355233130017341 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EshopProductLanguage extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT language
                  FROM #__eshop_productdetails
                  GROUP BY language';

        $languages = Database::queryAll($query, false, "object");

        $this->options[0] = n2_('Default');
        if (count($languages)) {
            foreach ($languages as $language) {
                $this->options[$language->language] = $language->language;
            }
        }
    }

}
Generator/Joomla/Eshop/Elements/EshopTags.php000064400000001414152355233130015155 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Eshop\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EshopTags extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $query = 'SELECT tag_name, id
                  FROM #__eshop_tags
                  ORDER BY id';

        $tags = Database::queryAll($query, false, "object");

        $this->options[0] = n2_('All');

        if (count($tags)) {
            foreach ($tags as $tag) {
                $this->options[$tag->id] = $tag->tag_name;
            }
        }
    }

}
Generator/Joomla/Easysocial/GeneratorGroupEasysocial.php000064400000003411152355233130017501 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources\EasysocialAlbums;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources\EasysocialEvents;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources\EasysocialGroups;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources\EasysocialPages;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources\EasysocialUsers;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources\EasysocialVideos;

class GeneratorGroupEasysocial extends AbstractGeneratorGroup {

    protected $name = 'easysocial';

    protected $url = 'https://extensions.joomla.org/extension/easysocial/';

    public function getLabel() {
        return 'EasySocial';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasySocial');
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial');
    }

    protected function loadSources() {
        new EasysocialEvents($this, 'events', n2_('Events'));
        new EasysocialGroups($this, 'groups', n2_('Groups'));
        new EasysocialAlbums($this, 'albums', n2_('Albums'));
        new EasysocialVideos($this, 'videos', n2_('Videos'));
        new EasysocialPages($this, 'pages', n2_('Pages'));
        new EasysocialUsers($this, 'users', n2_('Users'));
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupEasysocial);

Generator/Joomla/Easysocial/Sources/EasysocialAlbums.php000064400000020456152355233130017414 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources;

use ES;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Elements\EasysocialCategories;

class EasysocialAlbums extends AbstractGenerator {

    protected $layout = 'image';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasySocial ' . n2_('Albums'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EasysocialCategories($source, 'easysocialgroups', n2_('Groups'), 0, array(
            'isMultiple'  => true,
            'size'        => 10,
            'table'       => 'social_clusters',
            'clusterType' => 'group',
            'orderBy'     => 'id'
        ));
        new EasysocialCategories($source, 'easysocialevents', n2_('Events'), 0, array(
            'isMultiple'  => true,
            'size'        => 10,
            'table'       => 'social_clusters',
            'clusterType' => 'event',
            'orderBy'     => 'id'
        ));
        new EasysocialCategories($source, 'easysocialpages', n2_('Pages'), 0, array(
            'isMultiple'  => true,
            'size'        => 10,
            'table'       => 'social_clusters',
            'clusterType' => 'page',
            'orderBy'     => 'id'
        ));


        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'featured', n2_('Featured'), 0);
        new Text($limit, 'albumtitle', 'Album title', '*');
        new Filter($limit, 'avatarandcover', 'Include avatar and cover images', 0);


        new Text($limit, 'allowed-users', n2_('Allowed user IDs'), '', array(
            'tipLabel'       => n2_('Allowed user IDs'),
            'tipDescription' => n2_('Separate them by comma.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1887-joomla-easysocial-generator#allowed-user-ids-50'
        ));

        new Text($limit, 'banned-users', n2_('Banned user IDs'), '', array(
            'tipLabel'       => n2_('Allowed user IDs'),
            'tipDescription' => n2_('Separate them by comma.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1887-joomla-easysocial-generator#banned-user-ids-51'
        ));


        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easysocialorder', 'created|*|desc', array(
            'options' => array(
                ''        => n2_('None'),
                'title'   => n2_('Title'),
                'created' => n2_('Creation time'),
                'id'      => 'ID'
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $groups = array_map('intval', explode('||', $this->data->get('easysocialgroups', '0')));
        $events = array_map('intval', explode('||', $this->data->get('easysocialevents', '0')));
        $pages  = array_map('intval', explode('||', $this->data->get('easysocialpages', '0')));

        if (!in_array('0', $groups) && !in_array('0', $events) && !in_array('0', $pages)) {
            $clusters = array_merge($groups, $events, $pages);
        } else {
            $cluster_helper = array();
            if (!in_array('0', $groups)) {
                $cluster_helper = array_merge($cluster_helper, $groups);
            }
            if (!in_array('0', $events)) {
                $cluster_helper = array_merge($cluster_helper, $events);
            }
            if (!in_array('0', $pages)) {
                $cluster_helper = array_merge($cluster_helper, $pages);
            }
            $clusters = $cluster_helper;
        }

        if (in_array('0', $groups) && in_array('0', $events) && in_array('0', $pages)) {
            $all = "OR uid IN (SELECT id FROM #__social_clusters WHERE cluster_type = 'group' OR cluster_type = 'event' OR cluster_type = 'page')";
        } else if (in_array('0', $groups) && in_array('0', $events)) {
            $all = "OR uid IN (SELECT id FROM #__social_clusters WHERE cluster_type = 'group' OR cluster_type = 'event')";
        } else if (in_array('0', $groups) && in_array('0', $pages)) {
            $all = "OR uid IN (SELECT id FROM #__social_clusters WHERE cluster_type = 'group' OR cluster_type = 'page')";
        } else if (in_array('0', $events) && in_array('0', $pages)) {
            $all = "OR uid IN (SELECT id FROM #__social_clusters WHERE cluster_type = 'event' OR cluster_type = 'page')";
        } else if (in_array('0', $pages)) {
            $all = "OR uid IN (SELECT id FROM #__social_clusters WHERE cluster_type = 'page')";
        } else if (in_array('0', $events)) {
            $all = "OR uid IN (SELECT id FROM #__social_clusters WHERE cluster_type = 'event')";
        } else if (in_array('0', $groups)) {
            $all = "OR uid IN (SELECT id FROM #__social_clusters WHERE cluster_type = 'group')";
        }

        $albumWhere = array("1=1");

        if (!empty($clusters)) {
            $albumWhere[] = "(uid IN (" . implode(',', $clusters) . ") " . $all . ")";
        }

        if ($this->data->get('avatarandcover', '0') == '0') {
            $albumWhere[] = "title = 'COM_EASYSOCIAL_ALBUMS_PROFILE_AVATAR' OR title = 'COM_EASYSOCIAL_ALBUMS_PROFILE_COVER'";
        } elseif ($this->data->get('avatarandcover', '0') == '-1') {
            $albumWhere[] = "title <> 'COM_EASYSOCIAL_ALBUMS_PROFILE_AVATAR' AND title <> 'COM_EASYSOCIAL_ALBUMS_PROFILE_COVER'";
        }

        $albumTitle = $this->data->get('albumtitle', '*');
        if ($albumTitle != '*' && !empty($albumTitle)) {
            $albumWhere[] = "title = '" . $albumTitle . "'";
        }

        $allowedUsers = $this->data->get('allowed-users', '');
        if (!empty($allowedUsers)) {
            $albumWhere[] = "user_id IN (" . $allowedUsers . ")";
        }

        $bannedUsers = $this->data->get('banned-users', '');
        if (!empty($bannedUsers)) {
            $albumWhere[] = "user_id NOT IN (" . $bannedUsers . ")";
        }

        $where = array(
            "album_id IN (SELECT id FROM #__social_albums WHERE  " . implode(' AND ', $albumWhere) . ")",
            "state = 1"
        );

        switch ($this->data->get('featured', 0)) {
            case 1:
                $where[] = 'featured = 1';
                break;
            case -1:
                $where[] = 'featured = 0';
                break;
        }

        $query = "SELECT
                  id, title
                  FROM #__social_photos
                  WHERE " . implode(' AND ', $where);


        $order = Common::parse($this->data->get('easysocialorder', 'created|*|desc'));
        if ($order[0]) {
            $query .= ' ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= " LIMIT " . $startIndex . ", " . $count;

        $result = Database::queryAll($query);
        $data   = array();

        // EasySocial quote: "Prior to ES 2.0, we no longer use square and featured as image variation". This is why the photos are returning thumbnail and large images.
        $photo = ES::table('Photo');
        for ($i = 0; $i < count($result); $i++) {
            $photo->load($result[$i]['id']);
            $r = array(
                'title'     => $result[$i]['title'],
                'image'     => $photo->getSource('original'),
                'thumbnail' => $photo->getSource('thumbnail'),
                'square'    => $photo->getSource('square'),
                'featured'  => $photo->getSource('featured'),
                'large'     => $photo->getSource('large'),
                'stock'     => $photo->getSource('stock')
            );

            $data[] = $r;
        }

        return $data;
    }
}
Generator/Joomla/Easysocial/Sources/EasysocialEvents.php000064400000024735152355233130017441 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources;

use ES;
use FRoute;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Elements\EasysocialCategories;

class EasysocialEvents extends AbstractGenerator {

    protected $layout = 'event';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasySocial ' . n2_('Events'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EasysocialCategories($source, 'easysocialcategories', n2_('Categories'), 0, array(
            'isMultiple' => true,
            'size'       => 10,
            'table'      => 'social_clusters_categories',
            'typeDb'     => 'event'
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'started', n2_('Started'), 0);
        new Filter($limit, 'ended', n2_('Ended'), -1);
        new Filter($limit, 'allday', n2_('All day'), 0);
        new Filter($limit, 'recurring', n2_('Recurring events'), 0);
        new Filter($limit, 'featured', n2_('Featured'), 0);
        new Select($limit, 'eventtype', n2_('Type'), 0, array(
            'options' => array(
                '0' => n2_('All'),
                '1' => n2_('Open'),
                '2' => n2_('Closed'),
                '3' => n2_('Invite only')
            )
        ));

        new Text($limit, 'location', n2_('Location'), '*');

        new Text($limit, 'allowed-users', n2_('Allowed user IDs'), '', array(
            'tipLabel'       => n2_('Allowed user IDs'),
            'tipDescription' => n2_('Pull posts only from these users. Separate them by comma.')
        ));

        new Text($limit, 'banned-users', n2_('Banned user IDs'), '', array(
            'tipLabel'       => n2_('Banned user IDs'),
            'tipDescription' => n2_('Do not pull posts from these users. Separate them by comma.')
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easysocialorder', 'b.start|*|asc', array(
            'options' => array(
                ''          => n2_('None'),
                'a.title'   => n2_('Title'),
                'a.created' => n2_('Creation time'),
                'b.start'   => n2_('Start time'),
                'b.end'     => n2_('End time'),
                'a.id'      => 'ID'
            )
        ));
    }

    private function formatDate($datetime, $dateOrTime = 0) {
        switch ($dateOrTime) {
            case 0:
                $dot = 'Y-m-d';
                break;
            case 1:
                $dot = 'H:i:s';
                break;
        }
        if ($dateOrTime == 1 || $datetime != '0000-00-00 00:00:00') {
            return date($dot, strtotime($datetime));
        } else {
            return '0000-00-00';
        }
    }

    protected function _getData($count, $startIndex) {

        $where = array(
            "a.cluster_type = 'event'",
            "a.state = '1'"
        );

        $category = array_map('intval', explode('||', $this->data->get('easysocialcategories', '')));

        if (!in_array('0', $category)) {
            $where[] = 'a.category_id IN (' . implode(',', $category) . ')';
        }

        $today = date('Y-m-d h:i:s', time());

        switch ($this->data->get('started', '0')) {
            case 1:
                $where[] = "b.start < '" . $today . "'";
                break;
            case -1:
                $where[] = "b.start >= '" . $today . "'";
                break;
        }

        switch ($this->data->get('ended', '-1')) {
            case 1:
                $where[] = "(b.end < '" . $today . "' AND b.end <> '0000-00-00 00:00:00')";
                break;
            case -1:
                $where[] = "(b.end >= '" . $today . "' OR b.end = '0000-00-00 00:00:00')";
                break;
        }

        switch ($this->data->get('allday', 0)) {
            case 1:
                $where[] = 'b.all_day = 1';
                break;
            case -1:
                $where[] = 'b.all_day = 0';
                break;
        }

        switch ($this->data->get('recurring', 0)) {
            case 0:
                $groupby = 'GROUP BY a.id ';
                break;
            case 1:
                $where[] = 'a.parent_id <> 0';
                $groupby = 'GROUP BY a.parent_id ';
                break;
            case -1:
                $where[] = 'a.parent_id = 0';
                $groupby = 'GROUP BY a.id ';
                break;
        }

        switch ($this->data->get('featured', 0)) {
            case 1:
                $where[] = 'a.featured = 1';
                break;
            case -1:
                $where[] = 'a.featured = 0';
                break;
        }

        $typeDb = $this->data->get('eventtype', 0);
        if ($typeDb != 0) {
            $where[] = 'a.type = ' . $typeDb;
        }

        $location = $this->data->get('location', '*');
        if ($location != '*' && !empty($location)) {
            $where[] = "a.address = '" . $location . "'";
        }

        $allowedUsers = $this->data->get('allowed-users', '');
        if (!empty($allowedUsers)) {
            $where[] = "a.creator_uid IN (" . $allowedUsers . ")";
        }

        $bannedUsers = $this->data->get('banned-users', '');
        if (!empty($bannedUsers)) {
            $where[] = "a.creator_uid NOT IN (" . $bannedUsers . ")";
        }

        $query = "SELECT
                  a.title, a.description, a.address, a.longitude, a.latitude, a.created, a.alias, a.category_id, a.id, a.alias,
                  b.start, b.end,
                  c.small, c.medium, c.square, c.large, c.uid,
                  (SELECT photo_id FROM #__social_covers WHERE uid = a.id and type='event' LIMIT 1) AS photo_id
                  FROM #__social_clusters AS a
                  LEFT JOIN #__social_events_meta AS b ON b.cluster_id = a.id
                  LEFT JOIN #__social_avatars AS c ON c.uid = a.id
                  WHERE " . implode(' AND ', $where) . "  ";

        $query .= $groupby;

        $order = Common::parse($this->data->get('easysocialorder', 'b.start|*|asc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        if (!class_exists('FRoute')) {
            $file = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'easysocial.php';
            if (file_exists($file)) {
                require_once($file);
            }
            require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'router.php');
        }

        $urlOptions = array(
            'layout'   => 'item',
            'external' => false,
            'sef'      => true
        );

        $avatar = ES::table('Avatar');
        $photo  = ES::table('Photo');

        $data = array();
        for ($i = 0; $i < count($result); $i++) {
            $urlOptions['id'] = $result[$i]['id'];
            $photo->load($result[$i]['photo_id']);
            $avatar->load(array(
                'uid'  => $result[$i]['uid'],
                'type' => 'event'
            ));
            $r = array(
                'title'       => $result[$i]['title'],
                'description' => $result[$i]['description']
            );

            $r['thumbnail'] = $photo->getSource('thumbnail');
            $r['image']     = ImageFallback::fallback(array(
                $photo->getSource('original'),
                $photo->getSource('large')
            ));

            if ($r['thumbnail'] == '' && $r['image'] != '') {
                $thumbnail      = $photo->getSource('thumbnail');
                $r['thumbnail'] = !empty($thumbnail) ? $thumbnail : $r['image'];
            }
            // EasySocial quote: "Prior to ES 2.0, we no longer use square and featured as image variation". This is why the photos are returning thumbnail and large images.
            $r += array(
                'square_image'        => $photo->getSource('square'),
                'featured_image'      => $photo->getSource('featured'),
                'large_image'         => $photo->getSource('large'),
                'stock_image'         => $photo->getSource('stock'),
                'avatar_small_image'  => $avatar->getSource('small'),
                'avatar_medium_image' => $avatar->getSource('medium'),
                'avatar_square_image' => $avatar->getSource('square'),
                'avatar_large_image'  => $avatar->getSource('large'),
                'url'                 => FRoute::events($urlOptions, true),
                'start_date'          => $this->formatDate($result[$i]['start']),
                'start_time'          => $this->formatDate($result[$i]['start'], 1),
                'end_date'            => $this->formatDate($result[$i]['end']),
                'end_time'            => $this->formatDate($result[$i]['end'], 1),
                'address'             => $result[$i]['address'],
                'longitude'           => $result[$i]['longitude'],
                'latitude'            => $result[$i]['latitude'],
                'creation_time'       => $result[$i]['created'],
                'alias'               => $result[$i]['alias'],
                'category_id'         => $result[$i]['category_id'],
                'id'                  => $result[$i]['id']
            );

            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Easysocial/Sources/EasysocialGroups.php000064400000016604152355233130017450 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources;

use ES;
use FRoute;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Elements\EasysocialCategories;

class EasysocialGroups extends AbstractGenerator {

    protected $layout = 'article';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasySocial ' . n2_('Groups'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EasysocialCategories($source, 'easysocialcategories', n2_('Categories'), 0, array(
            'isMultiple' => true,
            'size'       => 10,
            'table'      => 'social_clusters_categories',
            'typeDb'     => 'group'
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'featured', n2_('Featured'), 0);
        new Select($limit, 'grouptype', n2_('Type'), 0, array(
            'options' => array(
                '0' => n2_('All'),
                '1' => n2_('Open'),
                '2' => n2_('Closed'),
                '3' => n2_('Invite only')
            )
        ));

        new Text($limit, 'allowed-users', n2_('Allowed user IDs'), '', array(
            'tipLabel'       => n2_('Allowed user IDs'),
            'tipDescription' => n2_('Pull posts only from these users. Separate them by comma.')
        ));
        new Text($limit, 'banned-users', n2_('Banned user IDs'), '', array(
            'tipLabel'       => n2_('Banned user IDs'),
            'tipDescription' => n2_('Do not pull posts from these users. Separate them by comma.')
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easysocialorder', 'a.created|*|desc', array(
            'options' => array(
                ''          => n2_('None'),
                'a.title'   => n2_('Title'),
                'a.created' => n2_('Creation time'),
                'a.id'      => 'ID'
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $where = array(
            "a.parent_id = 0",
            "a.cluster_type = 'group'",
            "a.state = '1'"
        );

        $category = array_map('intval', explode('||', $this->data->get('easysocialcategories', '')));

        if (!in_array('0', $category)) {
            $where[] = 'a.category_id IN (' . implode(',', $category) . ')';
        }

        switch ($this->data->get('featured', 0)) {
            case 1:
                $where[] = 'a.featured = 1';
                break;
            case -1:
                $where[] = 'a.featured = 0';
                break;
        }

        $typeDb = $this->data->get('grouptype', 0);
        if ($typeDb != 0) {
            $where[] = 'a.type = ' . $typeDb;
        }

        $location = $this->data->get('location', '*');
        if ($location != '*' && !empty($location)) {
            $where[] = "a.address = '" . $location . "'";
        }

        $allowedUsers = $this->data->get('allowed-users', '');
        if (!empty($allowedUsers)) {
            $where[] = "a.creator_uid IN (" . $allowedUsers . ")";
        }

        $bannedUsers = $this->data->get('banned-users', '');
        if (!empty($bannedUsers)) {
            $where[] = "a.creator_uid NOT IN (" . $bannedUsers . ")";
        }

        $query = "SELECT
                  a.id, a.title, a.description, a.created, a.alias, a.category_id,
                  (SELECT photo_id FROM #__social_covers WHERE uid = a.id and type='group' LIMIT 1) AS photo_id
                  FROM #__social_clusters AS a
                  WHERE " . implode(' AND ', $where) . "  ";

        $order = Common::parse($this->data->get('easysocialorder', 'a.created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count . ' ';

        $result = Database::queryAll($query);

        if (!class_exists('FRoute')) {
            if (file_exists(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'easysocial.php')) {
                require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'easysocial.php');
            }
            require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'router.php');
        }

        $urlOptions = array(
            'layout'   => 'item',
            'external' => false,
            'sef'      => true
        );

        $avatar = ES::table('Avatar');
        $photo  = ES::table('Photo');
        $data   = array();
        for ($i = 0; $i < count($result); $i++) {
            $urlOptions['id'] = $result[$i]['id'];
            $photo->load($result[$i]['photo_id']);
            $avatar->load(array(
                'uid'  => $result[$i]['id'],
                'type' => 'group'
            ));

            $r = array(
                'title'       => $result[$i]['title'],
                'description' => $result[$i]['description']
            );

            $photoLarge  = $photo->getSource('large');
            $avatarLarge = $avatar->getSource('large');
            $r['image']  = $r['thumbnail'] = ImageFallback::fallback(array(
                @$photo->getSource('original'),
                @$photoLarge,
                @$avatarLarge
            ));

            $r += array(
                'thumbnail'           => $photo->getSource('thumbnail'),
                'square_image'        => $photo->getSource('square'),
                'featured_image'      => $photo->getSource('featured'),
                'large_image'         => $photoLarge,
                'stock_image'         => $photo->getSource('stock'),
                'avatar_small_image'  => $avatar->getSource('small'),
                'avatar_medium_image' => $avatar->getSource('medium'),
                'avatar_square_image' => $avatar->getSource('square'),
                'avatar_large_image'  => $avatarLarge,
                'url'                 => FRoute::groups($urlOptions, true),
                'creation_time'       => $result[$i]['created'],
                'alias'               => $result[$i]['alias'],
                'category_id'         => $result[$i]['category_id'],
                'id'                  => $result[$i]['id']
            );

            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Easysocial/Sources/EasysocialPages.php000064400000017243152355233130017230 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources;

use ES;
use FRoute;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Elements\EasysocialCategories;

class EasysocialPages extends AbstractGenerator {

    protected $layout = 'article';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasySocial ' . n2_('Pages'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EasysocialCategories($source, 'easysocialcategories', n2_('Categories'), 0, array(
            'isMultiple' => true,
            'size'       => 10,
            'table'      => 'social_clusters_categories',
            'typeDb'     => 'page'
        ));

        $limit = $filterGroup->createRow('limit-row');

        new Filter($limit, 'featured', n2_('Featured'), 0);

        new Text($limit, 'allowed-users', n2_('Allowed user IDs'), '', array(
            'tipLabel'       => n2_('Allowed user IDs'),
            'tipDescription' => n2_('Pull posts only from these users. Separate them by comma.')
        ));

        new Text($limit, 'banned-users', n2_('Banned user IDs'), '', array(
            'tipLabel'       => n2_('Banned user IDs'),
            'tipDescription' => n2_('Do not pull posts from these users. Separate them by comma.')
        ));

        new Select($limit, 'accesstype', n2_('Type'), 0, array(
            'options' => array(
                '0' => n2_('All'),
                '1' => n2_('Public'),
                '2' => n2_('Private'),
                '3' => n2_('Invite only')
            )
        ));

        new Select($limit, 'notification', n2_('Notification'), 0, array(
            'options' => array(
                '0' => n2_('All'),
                '1' => n2_('Both'),
                '2' => n2_('Email only'),
                '3' => n2_('Internal only'),
                '4' => n2_('None')
            )
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easysocialorder', 'a.created|*|desc', array(
            'options' => array(
                ''          => n2_('None'),
                'a.title'   => n2_('Title'),
                'a.created' => n2_('Creation time'),
                'a.hits'    => n2_('Hits'),
                'a.id'      => 'ID'
            )
        ));

    }

    protected function _getData($count, $startIndex) {

        $where = array(
            "a.cluster_type = 'page'",
            "a.state = '1'"
        );

        $category = array_map('intval', explode('||', $this->data->get('easysocialcategories', '')));

        if (!in_array('0', $category)) {
            $where[] = 'a.category_id IN (' . implode(',', $category) . ')';
        }

        switch ($this->data->get('featured', 0)) {
            case 1:
                $where[] = 'a.featured = 1';
                break;
            case -1:
                $where[] = 'a.featured = 0';
                break;
        }

        $typeDb = $this->data->get('accesstype', 0);
        if ($typeDb != 0) {
            $where[] = 'a.type = ' . $typeDb;
        }

        $typeDb = $this->data->get('notification', 0);
        if ($typeDb != 0) {
            $where[] = 'a.notification = ' . $typeDb;
        }

        $allowedUsers = $this->data->get('allowed-users', '');
        if (!empty($allowedUsers)) {
            $where[] = "a.creator_uid IN (" . $allowedUsers . ")";
        }

        $bannedUsers = $this->data->get('banned-users', '');
        if (!empty($bannedUsers)) {
            $where[] = "a.creator_uid NOT IN (" . $bannedUsers . ")";
        }

        $query = "SELECT
                  a.title, a.description, a.created, a.hits, a.category_id, a.id, a.alias,                  
                  c.small, c.medium, c.square, c.large, c.uid,
                  (SELECT photo_id FROM #__social_covers WHERE uid = a.id and type='page' LIMIT 1) AS photo_id
                  FROM #__social_clusters AS a
                  LEFT JOIN #__social_avatars AS c ON c.uid = a.id
                  WHERE " . implode(' AND ', $where) . "  ";

        $order = Common::parse($this->data->get('easysocialorder', 'a.created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        if (!class_exists('FRoute')) {
            $file = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'easysocial.php';
            if (file_exists($file)) {
                require_once($file);
            }
            require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'router.php');
        }

        $urlOptions = array(
            'layout'   => 'item',
            'external' => false,
            'sef'      => true
        );

        $avatar = ES::table('Avatar');
        $photo  = ES::table('Photo');

        $data = array();
        for ($i = 0; $i < count($result); $i++) {
            $urlOptions['id'] = $result[$i]['id'];
            $photo->load($result[$i]['photo_id']);
            $avatar->load(array(
                'uid'  => $result[$i]['uid'],
                'type' => 'page'
            ));
            $r = array(
                'title'       => $result[$i]['title'],
                'description' => $result[$i]['description']
            );

            $r['thumbnail'] = $photo->getSource('thumbnail');
            $r['image']     = ImageFallback::fallback(array(
                $photo->getSource('original'),
                $photo->getSource('large')
            ));

            if ($r['thumbnail'] == '' && $r['image'] != '') {
                $thumbnail      = $photo->getSource('thumbnail');
                $r['thumbnail'] = !empty($thumbnail) ? $thumbnail : $r['image'];
            }

            $r += array(
                'large_image'         => $photo->getSource('large'),
                'avatar_small_image'  => $avatar->getSource('small'),
                'avatar_medium_image' => $avatar->getSource('medium'),
                'avatar_square_image' => $avatar->getSource('square'),
                'avatar_large_image'  => $avatar->getSource('large'),
                'url'                 => FRoute::pages($urlOptions, true),
                'hits'                => $result[$i]['hits'],
                'creation_time'       => $result[$i]['created'],
                'alias'               => $result[$i]['alias'],
                'category_id'         => $result[$i]['category_id'],
                'id'                  => $result[$i]['id']
            );

            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Easysocial/Sources/EasysocialUsers.php000064400000023147152355233130017272 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources;

use ES;
use Foundry;
use FRoute;
use Joomla\CMS\Router\Route;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Elements\EasysocialCategories;

class EasysocialUsers extends AbstractGenerator {

    protected $layout = 'article';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasySocial ' . n2_('Users'));
    }

    private function removeSpaces($str) {
        return str_replace(' ', '', $str);
    }

    private function runIni($title) {
        if (function_exists('parse_ini_file')) {
            $language = parse_ini_file(JPATH_ROOT . '/administrator/language/en-GB/en-GB.com_easysocial.ini');
            if (isset($language[$title])) {
                return $this->removeSpaces($language[$title]);
            } else {
                return $title;
            }
        } else {
            return $title;
        }
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');

        new EasysocialCategories($source, 'easysocialprofiles', n2_('Profiles'), 0, array(
            'isMultiple' => true,
            'size'       => 10,
            'table'      => 'social_profiles'
        ));

        new EasysocialCategories($source, 'easysocialbadges', n2_('Badges'), 0, array(
            'isMultiple' => true,
            'size'       => 10,
            'table'      => 'social_badges',
            'orderBy'    => 'id',
            'ini'        => 1
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Text($limit, 'maxphotos', 'Max photos asked down per user', '3');

        new Text($limit, 'allowed-users', n2_('Allowed user IDs'), '', array(
            'tipLabel'       => n2_('Allowed user IDs'),
            'tipDescription' => n2_('Pull posts only from these users. Separate them by comma.')
        ));

        new Text($limit, 'banned-users', n2_('Banned user IDs'), '', array(
            'tipLabel'       => n2_('Banned user IDs'),
            'tipDescription' => n2_('Do not pull posts from these users. Separate them by comma.')
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easysocialorder', 'u.registerDate|*|desc', array(
            'options' => array(
                ''                => n2_('None'),
                'u.registerDate'  => n2_('Register date'),
                'u.lastvisitDate' => n2_('Last visit date'),
                'points'          => n2_('Points'),
                'u.name'          => n2_('Name'),
                'u.id'            => 'ID'
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $where = array(
            "su.state <> '0'"
        );

        $profiles = array_map('intval', explode('||', $this->data->get('easysocialprofiles', '')));
        if (!in_array('0', $profiles)) {
            $where[] = 'spm.profile_id IN (' . implode(',', $profiles) . ')';
        }

        $badges = array_map('intval', explode('||', $this->data->get('easysocialbadges', '')));
        if (!in_array('0', $badges)) {
            $where[] = 'u.id IN (SELECT user_id FROM #__social_badges_maps WHERE badge_id IN (' . implode(',', $badges) . '))';
        }

        $allowedUsers = $this->data->get('allowed-users', '');
        if (!empty($allowedUsers)) {
            $where[] = "u.id IN (" . $allowedUsers . ")";
        }

        $bannedUsers = $this->data->get('banned-users', '');
        if (!empty($bannedUsers)) {
            $where[] = "u.id NOT IN (" . $bannedUsers . ")";
        }

        $query = "SELECT u.name, u.username, u.email, u.id, SUM(sph.points) AS points FROM #__social_users AS su
                  LEFT JOIN #__users AS u ON u.id = su.user_id 
                  LEFT JOIN #__social_profiles_maps AS spm ON spm.user_id = su.user_id
                  LEFT JOIN #__social_points_history AS sph ON sph.user_id = su.user_id    
                  WHERE " . implode(' AND ', $where) . "  ";

        $order = Common::parse($this->data->get('easysocialorder', 'u.registerDate|*|desc'));

        if ($order[0]) {
            $query .= 'GROUP BY su.user_id ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query  .= 'LIMIT ' . $startIndex . ', ' . $count;
        $result = Database::queryAll($query);

        if (!class_exists('FRoute')) {
            $file = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'easysocial.php';
            if (file_exists($file)) {
                require_once($file);
            }
            require_once(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easysocial' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'router.php');
        }

        $avatar    = ES::table('Avatar');
        $photo     = ES::table('Photo');
        $maxPhotos = intval(Common::parse($this->data->get('maxphotos', '3')));
        $data      = array();
        for ($i = 0; $i < count($result); $i++) {
            $r = array(
                'title'    => $result[$i]['name'],
                'name'     => $result[$i]['name'],
                'username' => $result[$i]['username'],
                'email'    => $result[$i]['email'],
                'id'       => $result[$i]['id']
            );

            if (!empty($result[$i]['points'])) {
                $r['points'] = $result[$i]['points'];
            } else {
                $r['points'] = 0;
            }

            $query = "SELECT id FROM #__social_photos WHERE uid = '" . $result[$i]['id'] . "' ORDER BY id DESC";
            if (!empty($maxPhotos)) {
                $query .= " LIMIT " . $maxPhotos;
            }
            $photo_ids = Database::queryAll($query);
            $j         = 0;
            foreach ($photo_ids as $photo_id) {
                $j++;
                $photo->load($photo_id);
                $original       = $photo->getSource('original');
                $large          = $photo->getSource('large');
                $thumbnail      = $photo->getSource('thumbnail');
                $r              += array(
                    'photo' . $j . '_original'  => $original,
                    'photo' . $j . '_large'     => $large,
                    'photo' . $j . '_thumbnail' => $thumbnail,
                );
                $r['image']     = $original;
                $r['thumbnail'] = $thumbnail;
            }
            $avatar->load(array(
                'uid'  => $result[$i]['id'],
                'type' => 'user'
            ));

            if ($avatar->uid == $result[$i]['id']) {

                $avatar_small  = $avatar->getSource('small');
                $avatar_medium = $avatar->getSource('medium');
                $avatar_square = $avatar->getSource('square');
                $avatar_large  = $avatar->getSource('large');

                if (empty($r['image'])) {
                    $r['image'] = $avatar_large;
                }
                if (empty($r['thumbnail'])) {
                    $r['thumbnail'] = $avatar_square;
                }

                $r += array(
                    'avatar_small_image'  => $avatar_small,
                    'avatar_medium_image' => $avatar_medium,
                    'avatar_square_image' => $avatar_square,
                    'avatar_large_image'  => $avatar_large
                );
            }

            $user = Foundry::user($result[$i]['id']);
            $r    += array(
                'url' => Route::_($user->getPermalink('', true))
            );

            $query      = "SELECT sf.title, sfd.datakey, sfd.data FROM #__social_fields_data AS sfd LEFT JOIN #__social_fields AS sf ON sfd.field_id = sf.id WHERE uid = '" . $result[$i]['id'] . "' AND type = 'user'";
            $user_datas = Database::queryAll($query);
            $j          = 0;
            foreach ($user_datas as $user_data) {
                if (!empty($user_data['title'])) {
                    $user_data['title'] = $this->removeSpaces($this->runIni($user_data['title']));
                }
                if (!empty($user_data['datakey'])) {
                    $user_data['datakey'] = $this->removeSpaces($user_data['datakey']);
                    $r                    += array(
                        $user_data['title'] . '_' . $user_data['datakey'] => $user_data['data']
                    );
                } else if (!empty($user_data['data']) && !empty($user_data['title'])) {
                    $r += array(
                        $user_data['title'] => $user_data['data']
                    );
                } else if (!empty($user_data['data'])) {
                    $j++;
                    $r += array(
                        'user_data' . $j => $user_data['data']
                    );
                }
            }

            $data[] = $r;
        }

        return $data;
    }
}Generator/Joomla/Easysocial/Sources/EasysocialVideos.php000064400000010236152355233130017415 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Sources;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Elements\EasysocialCategories;

class EasysocialVideos extends AbstractGenerator {

    protected $layout = 'article';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasySocial ' . n2_('Videos'));
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EasysocialCategories($source, 'easysocialcategories', n2_('Categories'), 0, array(
            'isMultiple' => true,
            'size'       => 10,
            'table'      => 'social_videos_categories'
        ));

        $limit = $filterGroup->createRow('limit-row');
        new Filter($limit, 'featured', n2_('Featured'), 0);

        new Text($limit, 'allowed-users', n2_('Allowed user IDs'), '', array(
            'tipLabel'       => n2_('Allowed user IDs'),
            'tipDescription' => n2_('Pull posts only from these users. Separate them by comma.')
        ));

        new Text($limit, 'banned-users', n2_('Banned user IDs'), '', array(
            'tipLabel'       => n2_('Banned user IDs'),
            'tipDescription' => n2_('Do not pull posts from these users. Separate them by comma.')
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easysocialorder', 'created|*|desc', array(
            'options' => array(
                ''        => n2_('None'),
                'title'   => n2_('Title'),
                'created' => n2_('Creation time'),
                'id'      => 'ID'
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $where = array(
            "state = '1'"
        );

        $category = array_map('intval', explode('||', $this->data->get('easysocialcategories', '')));

        if (!in_array('0', $category)) {
            $where[] = 'category_id IN (' . implode(',', $category) . ')';
        }

        switch ($this->data->get('featured', 0)) {
            case 1:
                $where[] = 'featured = 1';
                break;
            case -1:
                $where[] = 'featured = 0';
                break;
        }

        $allowedUsers = $this->data->get('allowed-users', '');
        if (!empty($allowedUsers)) {
            $where[] = "user_id IN (" . $allowedUsers . ")";
        }

        $bannedUsers = $this->data->get('banned-users', '');
        if (!empty($bannedUsers)) {
            $where[] = "user_id NOT IN (" . $bannedUsers . ")";
        }

        $query = "SELECT * FROM #__social_videos WHERE " . implode(' AND ', $where) . "  ";

        $order = Common::parse($this->data->get('easysocialorder', 'created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count;

        $result = Database::queryAll($query);

        $data = array();
        for ($i = 0; $i < count($result); $i++) {
            $r = array(
                'video'       => $result[$i]['path'],
                'title'       => $result[$i]['title'],
                'description' => $result[$i]['description'],
                'hits'        => $result[$i]['hits'],
                'thumbnail'   => !empty($result[$i]['thumbnail']) ? '$/' . $result[$i]['thumbnail'] : '',
                'id'          => $result[$i]['id']
            );

            $data[] = $r;
        }

        return $data;
    }
}
Generator/Joomla/Easysocial/Elements/EasysocialCategories.php000064400000004215152355233130020402 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easysocial\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EasysocialCategories extends Select {

    protected $table = '';
    protected $typeDb = '';
    protected $clusterType = '';
    protected $orderBy = 'ordering, id';
    protected $ini = false;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        if (!empty($this->typeDb)) {
            $typeDb = "AND type='" . $this->typeDb . "'";
        } else {
            $typeDb = '';
        }

        if (!empty($this->clusterType)) {
            $cluserType = "AND cluster_type='" . $this->clusterType . "'";
        } else {
            $cluserType = '';
        }

        $categories = Database::queryAll("SELECT * FROM #__" . $this->table . " WHERE state = 1 " . $typeDb . $cluserType . "  ORDER BY " . $this->orderBy, false, "object");

        $this->options[0] = n2_('All');

        if (count($categories)) {
            foreach ($categories as $category) {
                $this->options[$category->id] = $this->runIni($category->title);
            }
        }
    }

    public function setTable($table) {
        $this->table = $table;
    }

    public function setTypeDb($typeDb) {
        $this->typeDb = $typeDb;
    }

    public function setClusterType($clusterType) {
        $this->clusterType = $clusterType;
    }

    public function setOrderBy($orderBy) {
        $this->orderBy = $orderBy;
    }

    public function setIni($ini) {
        $this->ini = true;
    }

    private function runIni($title) {
        if ($this->ini && function_exists('parse_ini_file')) {
            $language = parse_ini_file(JPATH_ROOT . '/language/en-GB/en-GB.com_easysocial.ini');
            if (isset($language[$title])) {
                return $language[$title];
            } else {
                return $title;
            }
        } else {
            return $title;
        }
    }
}Generator/Joomla/Easydiscuss/GeneratorGroupEasydiscuss.php000064400000002175152355233130020115 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easydiscuss;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easydiscuss\Sources\EasydiscussDiscussions;

class GeneratorGroupEasydiscuss extends AbstractGeneratorGroup {

    protected $name = 'easydiscuss';

    protected $url = 'https://extensions.joomla.org/extensions/extension/communication/question-a-answers/easydiscuss/';

    public function getLabel() {
        return 'EasyDiscuss';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasyDiscuss');
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easydiscuss');
    }

    protected function loadSources() {
        new EasydiscussDiscussions($this, 'discussions', 'Discussions');
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupEasydiscuss);

Generator/Joomla/Easydiscuss/Sources/EasydiscussDiscussions.php000064400000013372152355233130021104 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easydiscuss\Sources;

use Joomla\CMS\Factory;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easydiscuss\Elements\EasydiscussCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easydiscuss\Elements\EasydiscussTags;


class EasydiscussDiscussions extends AbstractGenerator {

    protected $layout = 'article';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasyDiscuss');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EasydiscussCategories($source, 'easydiscusscategories', n2_('Category'), 0);
        new EasydiscussTags($source, 'easydiscusstags', n2_('Tags'), 0);

        $limit = $filterGroup->createRow('limit-row');
        new Text($limit, 'easydiscussuserid', n2_('User ID'), '');
        new Filter($limit, 'easydiscussfeatured', n2_('Featured'), 0);
        new Filter($limit, 'easydiscussresolved', n2_('Resolved'), 0);
        new OnOff($limit, 'easydiscussmain', n2_('Only main discussions'), 1);

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easydiscussorder', 'created|*|desc', array(
            'options' => array(
                ''         => n2_('None'),
                'title'    => n2_('Title'),
                'cattitle' => n2_('Category title'),
                'ordering' => n2_('Ordering'),
                'created'  => n2_('Creation time'),
                'modified' => n2_('Modification time')
            )
        ));
    }

    protected function _getData($count, $startIndex) {

        $category = array_map('intval', explode('||', $this->data->get('easydiscusscategories', '')));

        $where = array("published = '1'");

        if (!in_array('0', $category)) {
            $where[] = 'category_id IN (' . implode(',', $category) . ') ';
        }

        $tags = array_map('intval', explode('||', $this->data->get('easydiscusstags', '0')));

        if (!in_array(0, $tags)) {
            $where[] = 'id IN (SELECT post_id FROM #__discuss_posts_tags WHERE tag_id IN(' . implode(',', $tags) . ')) ';
        }

        switch ($this->data->get('easydiscussfeatured', 0)) {
            case 1:
                $where[] = "featured = 1 ";
                break;
            case -1:
                $where[] = "featured = 0 ";
                break;
        }

        switch ($this->data->get('easydiscussresolved', 0)) {
            case 1:
                $where[] = "isresolve = 1 ";
                break;
            case -1:
                $where[] = "isresolve = 0 ";
                break;
        }

        $sourceUserId = intval($this->data->get('easydiscussuserid', ''));
        if (!empty($sourceUserId)) {
            $where[] = 'user_id = ' . $sourceUserId . ' ';
        }

        $sourceDiscussionMain = intval($this->data->get('easydiscussmain', ''));
        if (!empty($sourceDiscussionMain)) {
            $where[] = "parent_id = '0' ";
        }

        $query = 'SELECT * FROM #__discuss_posts WHERE ' . implode(' AND ', $where) . ' ';

        $order = Common::parse($this->data->get('easydiscussorder', 'created|*|desc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count . ' ';

        $result = Database::queryAll($query);

        $data = array();
        for ($i = 0; $i < count($result); $i++) {
            $user = Factory::getUser($result[$i]['user_id']);
            $r    = array(
                'title'           => $result[$i]['title'],
                'description'     => $result[$i]['content'],
                'url'             => 'index.php?option=com_easydiscuss&view=post&id=' . $result[$i]['id'],
                'url_label'       => n2_('View discussion'),
                'category_url'    => 'index.php?option=com_easydiscuss&view=categories&layout=listings&category_id=' . $result[$i]['category_id'],
                'user_name'       => $user->username,
                'user_real_name'  => $user->name,
                'vote'            => $result[$i]['vote'],
                'hits'            => $result[$i]['hits'],
                'number_of_likes' => $result[$i]['num_likes'],
                'number_of_votes' => $result[$i]['sum_totalvote'],
                'created'         => $result[$i]['created'],
                'modified'        => $result[$i]['modified'],
                'user_id'         => $result[$i]['user_id'],
                'latitude'        => $result[$i]['latitude'],
                'longitude'       => $result[$i]['longitude'],
                'parent_id'       => $result[$i]['parent_id'],
                'category_id'     => $result[$i]['category_id'],
                'id'              => $result[$i]['id']
            );

            $r['image'] = $r['thumbnail'] = ImageFallback::fallback(array(), array($result[$i]['content']));

            $data[] = $r;
        }

        return $data;
    }
}
Generator/Joomla/Easydiscuss/Elements/EasydiscussCategories.php000064400000002473152355233130021014 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easydiscuss\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EasydiscussCategories extends Select {

    protected $isMultiple = true;
    protected $size = 10;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $menuItems = Database::queryAll('SELECT * FROM #__discuss_category WHERE published = 1 ORDER BY parent_id, ordering', false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        $this->options['0'] = n2_('All');

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }
}Generator/Joomla/Easydiscuss/Elements/EasydiscussTags.php000064400000001464152355233130017624 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easydiscuss\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EasydiscussTags extends Select {

    protected $isMultiple = true;
    protected $size = 10;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $menuItems = Database::queryAll('SELECT * FROM #__discuss_tags WHERE published = 1 ORDER BY id', false, "object");

        $this->options['0'] = n2_('All');

        if (count($menuItems)) {
            foreach ($menuItems as $option) {
                $this->options[$option->id] = $option->title;
            }
        }
    }
}Generator/Joomla/Easyblog/GeneratorGroupEasyblog.php000064400000002030152355233130016617 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easyblog;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3\Generator\GeneratorFactory;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easyblog\Sources\EasyblogPosts;

class GeneratorGroupEasyblog extends AbstractGeneratorGroup {

    protected $name = 'easyblog';

    protected $url = 'https://extensions.joomla.org/extension/easyblog/';

    public function getLabel() {
        return 'EasyBlog';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasyBlog');
    }

    public function isInstalled() {
        return Filesystem::existsFolder(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog');
    }

    protected function loadSources() {
        new EasyblogPosts($this, 'posts', 'Posts');
    }


}

GeneratorFactory::addGenerator(new GeneratorGroupEasyblog);

Generator/Joomla/Easyblog/Sources/EasyblogPosts.php000064400000025253152355233130016423 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easyblog\Sources;

use EB;
use EBMM;
use EBR;
use Foundry;
use Joomla\CMS\Factory;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select\Filter;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\Url\Url;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3\Platform\Joomla\ImageFallback;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easyblog\Elements\EasyblogCategories;
use Nextend\SmartSlider3Pro\Generator\Joomla\Easyblog\Elements\EasyblogTags;

class EasyblogPosts extends AbstractGenerator {

    protected $layout = 'article';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s content.'), 'EasyBlog');
    }

    public function renderFields($container) {
        parent::renderFields($container);

        $filterGroup = new ContainerTable($container, 'filter', n2_('Filter'));

        $source = $filterGroup->createRow('source-row');
        new EasyblogCategories($source, 'easyblogcategories', n2_('Categories'), 0);
        new EasyblogTags($source, 'easyblogtags', n2_('Tags'), 0);
        new OnOff($source, 'easyblogsubcategories', n2_('Include subcategories'), 0);

        $limit = $filterGroup->createRow('limit-row');
        new Text($limit, 'easybloguserid', n2_('User ID'), '');
        new Filter($limit, 'easyblogfrontpage', n2_('Frontpage'), 0);
        new Filter($limit, 'easyblogfeatured', n2_('Featured'), 0);
        new Text($limit, 'easyblogexclude', n2_('Exclude ID'), '');

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'easyblogorder', 'con.created|*|desc', array(
            'options' => array(
                ''             => n2_('None'),
                'con.title'    => n2_('Title'),
                'cattitle'     => n2_('Category title'),
                'blogger'      => n2_('Username'),
                'con.ordering' => n2_('Ordering'),
                'con.created'  => n2_('Creation time'),
                'con.modified' => n2_('Modification time')
            )
        ));
    }

    private function findImage($path, $url) {
        $locations = array(
            'easyblog_images',
            'easyblog_articles',
            'easyblog_shared',
            'easyblog_cavatar',
            'easyblog_tavatar'
        );

        $pathlocation = '';

        foreach ($locations as $l) {
            if (strpos($path, $l)) {
                $pathlocation = $l;
                break;
            }
        }

        if ($pathlocation != '') {
            foreach ($locations as $l) {
                if ($pathlocation != $l) {
                    if (file_exists(str_replace($pathlocation, $l, $path))) {
                        return str_replace($pathlocation, $l, $url);
                        break;
                    }
                }
            }
        }
    }

    protected function _getData($count, $startIndex) {
        require_once(JPATH_ADMINISTRATOR . "/components/com_easyblog/includes/easyblog.php");
        EB::mediamanager();

        $category = array_map('intval', explode('||', $this->data->get('easyblogcategories', '')));
        if (!in_array('0', $category) && $this->data->get('easyblogsubcategories', 0)) {
            $checkCategory = $category;
            do {
                $catQuery  = 'SELECT id FROM #__easyblog_category WHERE parent_id IN (' . implode(',', $checkCategory) . ')';
                $catResult = Database::queryAll($catQuery);
                if (!empty($catResult)) {
                    $checkCategory = array();
                    foreach ($catResult as $subCategory) {
                        $checkCategory[] = $category[] = $subCategory['id'];
                    }
                }
            } while (!empty($catResult));
        }

        $query = 'SELECT con.*, con.intro as "main_content_of_post", con.content as "rest_of_the_post", usr.id AS "user_id", usr.nickname as "blogger", usr.avatar as "blogger_avatar_picture", cat.title as cat_title ';

        /* id 	created_by 	title 	description 	alias 	avatar 	parent_id 	private 	created 	status 	published 	ordering 	level 	lft 	rgt 	default */

        $query .= 'FROM #__easyblog_post con ';

        $query .= 'LEFT JOIN #__easyblog_users usr ON usr.id = con.created_by ';

        $query .= 'LEFT JOIN #__easyblog_category cat ON cat.id = con.category_id ';

        $jnow  = Factory::getDate();
        $now   = $jnow->toSql();
        $where = array("con.published = 1 AND (con.publish_up = '0000-00-00 00:00:00' OR con.publish_up IS NULL OR con.publish_up < '" . $now . "') AND (con.publish_down = '0000-00-00 00:00:00' OR con.publish_down IS NULL OR con.publish_down > '" . $now . "') ");

        $exclude = $this->data->get('easyblogexclude', '');
        if (!empty($exclude)) {
            $where[] = ' con.id NOT IN (' . $exclude . ') ';
        }

        if (!in_array('0', $category)) {
            $where[] = 'con.id IN (SELECT post_id FROM #__easyblog_post_category WHERE category_id in (' . implode(',', $category) . ')) ';
        }

        $tags = array_map('intval', explode('||', $this->data->get('easyblogtags', '0')));

        if (!in_array(0, $tags)) {
            $where[] = 'con.id IN (SELECT post_id FROM #__easyblog_post_tag WHERE tag_id IN(' . implode(',', $tags) . '))';
        }

        switch ($this->data->get('easyblogfrontpage', 0)) {
            case 1:
                $where[] = "con.frontpage = 1 ";
                break;
            case -1:
                $where[] = "con.frontpage = 0 ";
                break;
        }

        switch ($this->data->get('easyblogfeatured', 0)) {
            case 1:
                $where[] = "con.id IN (SELECT content_id FROM #__easyblog_featured WHERE type = 'post')";
                break;
            case -1:
                $where[] = "con.id NOT IN (SELECT content_id FROM #__easyblog_featured WHERE type = 'post')";
                break;
        }

        $sourceUserId = intval($this->data->get('easybloguserid', ''));
        if (!empty($sourceUserId)) {
            $where[] = 'con.created_by = ' . $sourceUserId . ' ';
        }

        $where[] = " con.state = 0 ";

        if (count($where) > 0) {
            $query .= 'WHERE ' . implode(' AND ', $where) . ' ';
        }

        $order = Common::parse($this->data->get('easyblogorder', 'con.title|*|asc'));
        if ($order[0]) {
            $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
        }

        $query .= 'LIMIT ' . $startIndex . ', ' . $count . ' ';

        $result = Database::queryAll($query);

        $data = array();
        $root = Url::getBaseUri();
        for ($i = 0; $i < count($result); $i++) {
            $description = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $result[$i]['main_content_of_post']);

            $url = 'index.php?option=com_easyblog&view=entry&id=' . $result[$i]['id'];
            if (class_exists('EBR', false)) {
                $url = EBR::_($url, true, null, false, false, false);
            }

            $r = array(
                'title'       => $result[$i]['title'],
                'description' => $description,
                'url'         => $url,
            );

            if (!empty($result[$i]['image'])) {
                $imageUrl = EBMM::getUrl($result[$i]['image']);
                $filename = EBMM::getTitle($result[$i]['image']);
                $filepath = EBMM::getPath($result[$i]['image']);
                if (file_exists($filepath)) {
                    $fullRoot = '';
                    $image    = $imageUrl;
                } else {
                    $newImageUrl = $this->findImage($filepath, $imageUrl);
                    if (!empty($newImageUrl)) {
                        $fullRoot = str_replace($filename, '', $newImageUrl);
                        $image    = $filename;
                    } else {
                        $fullRoot = $root;
                        $image    = '';
                    }
                }
            } else {
                $fullRoot = $root;
                $image    = '';
            }

            $r['image'] = $r['thumbnail'] = ImageFallback::fallback(array($image), array($result[$i]['content']), $fullRoot);
            $content    = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $result[$i]['content']);

            $category_url = 'index.php?option=com_easyblog&view=categories&id=' . $result[$i]['category_id'];
            if (class_exists('EBR', false)) {
                $category_url = EBR::_($category_url);
            }

            if (class_exists('EB', false)) {
                $category = EB::table('Category');
                $category->load($result[$i]['category_id']);
                $r['category_post_cover'] = $category->getDefaultPostCover();
            }

            $r += array(
                'url_label'         => n2_('View post'),
                'category_url'      => $category_url,
                'category_title'    => $result[$i]['cat_title'],
                'blogger'           => $result[$i]['blogger'],
                'created_by_id'     => $result[$i]['created_by'],
                'creation_time'     => $result[$i]['created'],
                'modification_time' => $result[$i]['modified'],
                'content'           => $content,
                'latitude'          => $result[$i]['latitude'],
                'longitude'         => $result[$i]['longitude'],
                'address'           => $result[$i]['address'],
                'hits'              => $result[$i]['hits'],
                'category_id'       => $result[$i]['category_id'],
                'id'                => $result[$i]['id'],
            );

            if (class_exists('Foundry')) {
                $user = Foundry::user($result[$i]['user_id']);
                $r    += array(
                    'blogger_avatar_picture'        => $user->getAvatar("medium"),
                    'blogger_avatar_picture_small'  => $user->getAvatar("small"),
                    'blogger_avatar_picture_square' => $user->getAvatar("square"),
                    'blogger_avatar_picture_large'  => $user->getAvatar("large"),
                );
            }
            $data[] = $r;
        }

        return $data;
    }
}
Generator/Joomla/Easyblog/Elements/EasyblogCategories.php000064400000002466152355233130017532 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easyblog\Elements;

use Joomla\CMS\HTML\HTMLHelper;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EasyblogCategories extends Select {

    protected $isMultiple = true;
    protected $size = 10;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $menuItems = Database::queryAll('SELECT * FROM #__easyblog_category WHERE published = 1 ORDER BY parent_id, ordering', false, "object");

        $children = array();
        if ($menuItems) {
            foreach ($menuItems as $v) {
                $pt   = $v->parent_id;
                $list = isset($children[$pt]) ? $children[$pt] : array();
                array_push($list, $v);
                $children[$pt] = $list;
            }
        }

        $this->options['0'] = n2_('All');

        jimport('joomla.html.html.menu');
        $options = HTMLHelper::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
        if (count($options)) {
            foreach ($options as $option) {
                $this->options[$option->id] = $option->treename;
            }
        }
    }
}Generator/Joomla/Easyblog/Elements/EasyblogTags.php000064400000001476152355233130016343 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Easyblog\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;


class EasyblogTags extends Select {

    protected $isMultiple = true;
    protected $size = 10;

    public function __construct($insertAt, $name = '', $label = '', $default = '', array $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $menuItems = Database::queryAll('SELECT * FROM #__easyblog_tag WHERE published = 1 ORDER BY ordering, id', false, "object");

        $this->options['0'] = n2_('All');

        if (count($menuItems)) {
            foreach ($menuItems as $option) {
                $this->options[$option->id] = $option->title;
            }
        }
    }
}Generator/Common/GeneratorCommonLoader.php000064400000000305152355233130014661 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Generator\Common;


use Nextend\SmartSlider3\Generator\AbstractGeneratorLoader;

class GeneratorCommonLoader extends AbstractGeneratorLoader {

}Generator/Common/GeneratorCommonRESTLoader.php000064400000001431152355233130015360 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Generator\Common;

use Nextend\Framework\Filesystem\Filesystem;
use ReflectionClass;
use ReflectionException;

class GeneratorCommonRESTLoader {

    public function __construct() {

        try {
            $reflectionClass = new ReflectionClass($this);
            $namespace       = $reflectionClass->getNamespaceName();

            $dir = dirname($reflectionClass->getFileName());

            foreach (Filesystem::folders($dir) as $name) {
                $className = '\\' . $namespace . '\\' . $name . '\\GeneratorGroupREST' . $name;

                if (class_exists($className)) {
                    new $className;
                }
            }
        } catch (ReflectionException $e) {

        }
    }
}Generator/Common/YouTube/ConfigurationYoutube.php000064400000022772152355233130016227 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube;

use Exception;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Token;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\Framework\Router\Router;
use Nextend\GoogleApi\Google_Service_YouTube_PlaylistListResponse;
use Nextend\SmartSlider3\Application\ApplicationSmartSlider3;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroupConfiguration;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\Elements\YouTubeToken;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service\Google_Service_YouTube;

class ConfigurationYoutube extends AbstractGeneratorGroupConfiguration {

    private $data;

    /**
     * N2SSPluginGeneratorYoutube constructor.
     *
     * @param GeneratorGroupYouTube $group
     */
    public function __construct($group) {
        parent::__construct($group);

        $this->data = new Data(array(
            'apiKey'      => '',
            'apiSecret'   => '',
            'accessToken' => ''
        ));

        $this->data->loadJSON(StorageSectionManager::getStorage('smartslider')
                                                   ->get('youtube'));

    }

    public function wellConfigured() {
        if (!$this->data->get('apiKey') || !$this->data->get('apiSecret') || !$this->data->get('accessToken')) {
            return false;
        }

        $api = $this->getApi();
        try {
            if ($api->isAccessTokenExpired()) {
                return false;
            }

            return true;
        } catch (Exception $e) {
            return false;
        }
    }

    public function getApi() {

        $client = new Google_Client();
        $client->setAccessType('offline');

        $client->setClientId(trim($this->data->get('apiKey')));
        $client->setClientSecret(trim($this->data->get('apiSecret')));
        $client->addScope(array(
            Google_Service_YouTube::YOUTUBE,
            Google_Service_YouTube::YOUTUBE_READONLY
        ));


        $client->setRedirectUri(ApplicationSmartSlider3::getInstance()
                                                       ->getApplicationTypeAdmin()
                                                       ->createUrl(array(
                                                           "generator/finishAuth",
                                                           array(
                                                               'group' => Request::$REQUEST->getVar('group')
                                                           )
                                                       )));

        $token = Base64::decode($this->data->get('accessToken', null));
        try {
            if ($token) {
                $client->setAccessToken($token);
                if ($client->isAccessTokenExpired()) {
                    $refreshToken = $client->getRefreshToken();
                    if (!empty($refreshToken)) {
                        $client->refreshToken($refreshToken);

                        try {
                            $oldAccessToken = json_decode(Base64::decode($this->data->get('accessToken')), true);
                            if (!is_array($oldAccessToken)) {
                                $oldAccessToken = array();
                            }
                        } catch (Exception $e) {
                            $oldAccessToken = array();
                        }

                        $this->data->set('accessToken', Base64::encode(json_encode(array_merge($oldAccessToken, json_decode($client->getAccessToken(), true)))));
                        $this->addData($this->data->toArray());
                    }
                }
            }
        } catch (Exception $e) {
            Notification::error($e->getMessage());
        }

        return $client;
    }

    public function getData() {
        return $this->data->toArray();
    }

    public function addData($data, $store = true) {
        $this->data->loadArray($data);
        if ($store) {
            StorageSectionManager::getStorage('smartslider')
                                 ->set('youtube', null, json_encode($this->data->toArray()));
        }
    }

    public function render($MVCHelper) {
        $form = new Form($MVCHelper, 'generator');
        $form->loadArray($this->getData());

        $table = new ContainerTable($form->getContainer(), 'youtube-generator', 'YouTube api');

        $instruction     = $table->createRow('youtube-instruction');
        $instructionText = sprintf(n2_('%2$s Check the documentation %3$s to learn how to configure your %1$s app.'), 'YouTube', '<a href="https://smartslider.helpscoutdocs.com/article/1906-youtube-generator" target="_blank">', '</a>');
        new Notice($instruction, 'instruction', n2_('Instruction'), $instructionText);

        $settings = $table->createRow('youtube');
        new Text($settings, 'apiKey', 'Client ID', '', array(
            'style' => 'width:600px;'
        ));
        new Text($settings, 'apiSecret', 'Client secret', '', array(
            'style' => 'width:250px;'
        ));
        new YoutubeToken($settings, 'accessToken', n2_('Token'));
        new Notice($settings, 'callback', n2_('Callback url'), $this->getCallbackUrl($MVCHelper->getRouter()));
        new Token($settings);

        $form->render();

        try {
            $this->getApi();
        } catch (Exception $e) {
            Notification::error($e->getMessage());
        }
    }

    public function startAuth($approvalPrompt = 'auto') {
        if (session_id() == "") {
            session_start();
        }
        $this->addData(Request::$REQUEST->getVar('generator'), false);

        $_SESSION['data'] = $this->getData();

        $client = $this->getApi();
        $client->setApprovalPrompt($approvalPrompt);
        $client->setAccessType('offline');

        return $client->createAuthUrl();
    }

    public function finishAuth($MVCHelper) {
        if (session_id() == "") {
            session_start();
        }
        $this->addData($_SESSION['data'], false);
        unset($_SESSION['data']);
        try {
            $client = $this->getApi();
            $client->authenticate(Request::$GET->getVar('code'));
            $accessToken = $client->getAccessToken();

            if ($accessToken) {
                $data = $this->getData();

                try {
                    $oldAccessToken = json_decode(Base64::decode($data['accessToken']), true);
                    if (!is_array($oldAccessToken)) {
                        $oldAccessToken = array();
                    }
                } catch (Exception $e) {
                    $oldAccessToken = array();
                }

                $newAccessToken = array_merge($oldAccessToken, json_decode($accessToken, true));

                if (!isset($newAccessToken['refresh_token'])) {
                    header('Location: ' . $this->startAuth('force'));
                    exit;
                }

                $data['accessToken'] = Base64::encode(json_encode($newAccessToken));
                $this->addData($data);

                return true;
            }

            return false;
        } catch (Exception $e) {
            return $e;
        }
    }

    public function getPlayListsAjax() {
        $channelID = Request::$REQUEST->getVar('channelID');

        $api = $this->getApi();

        $playLists = $this->getPlaylists($api, $channelID);


        $response = array();
        if (count($playLists)) {
            foreach ($playLists as $playlist) {
                $response[$playlist['id']] = $playlist['snippet']['title'];
            }
        }

        return $response;
    }


    public function getPlaylists($api, $channelID) {
        $channelID     = trim($channelID);
        $youtubeClient = new Google_Service_YouTube($api);
        $request       = array(
            'mine'       => true,
            'maxResults' => 50
        );
        if (!empty($channelID)) {
            $request = array(
                'channelId'  => $channelID,
                'maxResults' => 50
            );
        }

        /** @var Google_Service_YouTube_PlaylistListResponse $playlists */
        $playlists = $youtubeClient->playlists->listPlaylists('id,snippet', $request);
        $items     = $playlists['items'];

        while ($nextPageToken = $playlists->getNextPageToken()) {
            $request['pageToken'] = $nextPageToken;
            /** @var Google_Service_YouTube_PlaylistListResponse $playlists */
            $playlists = $youtubeClient->playlists->listPlaylists('id,snippet', $request);
            $items     = array_merge($items, $playlists['items']);
        }

        return $items;

    }

    /**
     * @param Router $router
     *
     * @return string
     */
    private function getCallbackUrl($router) {

        return $router->createUrl(array(
            "generator/finishAuth",
            array(
                'group' => 'youtube'
            )
        ));
    }
}Generator/Common/YouTube/GeneratorGroupYouTube.php000064400000001676152355233130016323 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\Sources\YouTubeByPlaylist;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\Sources\YouTubeBySearch;

class GeneratorGroupYouTube extends AbstractGeneratorGroup {

    protected $name = 'youtube';

    protected $needConfiguration = true;

    public function __construct() {
        parent::__construct();

        $this->configuration = new ConfigurationYoutube($this);
    }

    public function getLabel() {
        return 'YouTube';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'YouTube');
    }

    protected function loadSources() {

        new YouTubeBySearch($this, 'bysearch', n2_('Search'));
        new YouTubeByPlaylist($this, 'byplaylist', n2_('Playlist'));
    }
}
Generator/Common/YouTube/Sources/YouTubeByPlaylist.php000064400000013417152355233130017073 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\Sources;

use Exception;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Notification\Notification;
use Nextend\GoogleApi\Google_Service_YouTube_SearchListResponse;
use Nextend\GoogleApi\Google_Service_YouTube_SearchResult;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\Elements\YouTubePlaylistByUser;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service\Google_Service_YouTube;

class YouTubeByPlaylist extends AbstractGenerator {

    private $resultPerPage = 50;
    private $pages;
    private $youtubeClient;

    protected $layout = 'youtube';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'YouTube ' . n2_('Playlist'));
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Text($filter, 'channel-id', 'Channel id - ' . n2_('optional'), '', array(
            'style' => "width:400px;"
        ));

        new YouTubePlaylistByUser($filter, 'playlist-id', 'Playlist', '', array(
            'config' => $this->group->getConfiguration()
        ));

        new Select($filter, 'privacy', n2_('Privacy status'), 'public||private||unlisted', array(
            'isMultiple' => true,
            'size'       => 3,
            'options'    => array(
                'public'   => 'public',
                'private'  => 'private',
                'unlisted' => 'unlisted'
            )
        ));
    }

    protected function resetState() {
        $this->pages = array();

        if (!$this->youtubeClient) {
            $client              = $this->group->getConfiguration()
                                               ->getApi();
            $this->youtubeClient = new Google_Service_YouTube($client);
        }
    }

    protected function _getData($count, $startIndex) {

        $data = array();
        try {
            $offset  = $startIndex;
            $limit   = $count;
            $privacy = explode('||', $this->data->get('privacy', 'public||private||unlisted'));
            for ($i = 0, $j = $offset; $j < $offset + $limit; $i++, $j++) {

                $items = $this->getPage(intval($j / $this->resultPerPage))
                              ->getItems();

                /** @var Google_Service_YouTube_SearchResult $item */
                $item = @$items[$j % $this->resultPerPage];
                if (empty($item)) {
                    // There is no more item in the list
                    break;
                }

                if (in_array($item['status']['privacyStatus'], $privacy)) {
                    $snippet               = $item['snippet'];
                    $record                = array();
                    $record['video_id']    = $snippet['resourceId']['videoId'];
                    $record['video_url']   = 'http://www.youtube.com/watch?v=' . $snippet['resourceId']['videoId'];
                    $record['title']       = $snippet['title'];
                    $record['description'] = $snippet['description'];
                    if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['default']) && isset($snippet['thumbnails']['default']['url'])) {
                        $record['thumbnail'] = $snippet['thumbnails']['default']['url'];
                    }
                    if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['medium']) && isset($snippet['thumbnails']['medium']['url'])) {
                        $record['thumbnail_medium'] = $snippet['thumbnails']['medium']['url'];
                    }
                    if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['high']) && isset($snippet['thumbnails']['high']['url'])) {
                        $record['thumbnail_high'] = $snippet['thumbnails']['high']['url'];
                    }
                    if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['standard']) && isset($snippet['thumbnails']['standard']['url'])) {
                        $record['thumbnail_standard'] = $snippet['thumbnails']['standard']['url'];
                    }
                    if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['maxres']) && isset($snippet['thumbnails']['maxres']['url'])) {
                        $record['thumbnail_maxres'] = $snippet['thumbnails']['maxres']['url'];
                    }
                    $record['channel_title'] = $snippet['channelTitle'];
                    $record['channel_url']   = 'http://www.youtube.com/channel/' . $snippet['channelId'];

                    $data[] = &$record;
                    unset($record);
                }
            }
        } catch (Exception $e) {
            Notification::error($e->getMessage());
        }

        return $data;
    }

    private function getPage($page) {
        if (!isset($this->pages[$page])) {
            $request = array(
                'maxResults' => $this->resultPerPage,
                'playlistId' => $this->data->get('playlist-id', '')
            );
            if ($page != 0) {
                $request['pageToken'] = $this->getPage($page - 1)
                                             ->getNextPageToken();
            }
            /** @var Google_Service_YouTube_SearchListResponse $searchResponse */
            $this->pages[$page] = $this->youtubeClient->playlistItems->listPlaylistItems('id,snippet,status', $request);
        }

        return $this->pages[$page];
    }
}Generator/Common/YouTube/Sources/YouTubeBySearch.php000064400000011614152355233130016474 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\Sources;

use Exception;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Notification\Notification;
use Nextend\GoogleApi\Google_Service_YouTube_SearchListResponse;
use Nextend\GoogleApi\Google_Service_YouTube_SearchResult;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service\Google_Service_YouTube;

class YouTubeBySearch extends AbstractGenerator {

    private $resultPerPage = 50;
    private $pages;
    private $youtubeClient;

    protected $layout = 'youtube';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'YouTube ' . n2_('Search'));
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Text($filter, 'search-term', n2_('Search'), '', array(
            'style' => 'width:200px;'
        ));
    }

    protected function resetState() {
        $this->pages = array();

        if (!$this->youtubeClient) {
            $client              = $this->group->getConfiguration()
                                               ->getApi();
            $this->youtubeClient = new Google_Service_YouTube($client);
        }
    }

    protected function _getData($count, $startIndex) {

        $data = array();
        try {

            $offset = $startIndex;
            $limit  = $count;
            for ($i = 0, $j = $offset; $j < $offset + $limit; $i++, $j++) {

                $items = $this->getPage(intval($j / $this->resultPerPage))
                              ->getItems();

                /** @var Google_Service_YouTube_SearchResult $item */
                $item = $items[$j % $this->resultPerPage];
                if (empty($item)) {
                    // There is no more item in the list
                    break;
                }
                $record              = array();
                $record['video_id']  = $item['id']['videoId'];
                $record['video_url'] = 'http://www.youtube.com/watch?v=' . $item['id']['videoId'];

                $snippet               = $item['snippet'];
                $record['title']       = $snippet['title'];
                $record['description'] = $snippet['description'];
                if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['default']) && isset($snippet['thumbnails']['default']['url'])) {
                    $record['thumbnail'] = $snippet['thumbnails']['default']['url'];
                }
                if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['medium']) && isset($snippet['thumbnails']['medium']['url'])) {
                    $record['thumbnail_medium'] = $snippet['thumbnails']['medium']['url'];
                }
                if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['high']) && isset($snippet['thumbnails']['high']['url'])) {
                    $record['thumbnail_high'] = $snippet['thumbnails']['high']['url'];
                }
                if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['standard']) && isset($snippet['thumbnails']['standard']['url'])) {
                    $record['thumbnail_standard'] = $snippet['thumbnails']['standard']['url'];
                }
                if (isset($snippet['thumbnails']) && isset($snippet['thumbnails']['maxres']) && isset($snippet['thumbnails']['maxres']['url'])) {
                    $record['thumbnail_maxres'] = $snippet['thumbnails']['maxres']['url'];
                }
                $record['channel_title'] = $snippet['channelTitle'];
                $record['channel_url']   = 'http://www.youtube.com/user/' . $snippet['channelTitle'];

                $data[$i] = &$record;
                unset($record);

            }

        } catch (Exception $e) {
            Notification::error($e->getMessage());
        }

        return $data;
    }

    private function getPage($page) {
        if (!isset($this->pages[$page])) {
            $request = array(
                'q'               => $this->data->get('search-term', ''),
                'maxResults'      => $this->resultPerPage,
                'type'            => 'video',
                'videoEmbeddable' => 'true'
            );
            if ($page != 0) {
                $request['pageToken'] = $this->getPage($page - 1)
                                             ->getNextPageToken();
            }
            /** @var Google_Service_YouTube_SearchListResponse $searchResponse */
            $this->pages[$page] = $this->youtubeClient->search->listSearch('id,snippet', $request);
        }

        return $this->pages[$page];
    }
}Generator/Common/YouTube/googleclient/Google_Client.php000064400000052113152355233130017220 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient;

use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Auth\Google_Auth_OAuth2;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_Request;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_REST;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\IO\Google_IO_Curl;

/**
 * The Google API Client
 * http://code.google.com/p/google-api-php-client/
 *
 * @author Chris Chabot <chabotc@google.com>
 * @author Chirag Shah <chirags@google.com>
 */
class Google_Client {

    const LIBVER = "1.1.2";
    const USER_AGENT_SUFFIX = "google-api-php-client/";
    /**
     * @var Google_Auth_Abstract $auth
     */
    private $auth;

    /**
     * @var Google_IO_Abstract $io
     */
    private $io;

    /**
     * @var Google_Cache_Abstract $cache
     */
    private $cache;

    /**
     * @var Google_Config $config
     */
    private $config;

    /**
     * @var Google_Logger_Abstract $logger
     */
    private $logger;

    /**
     * @var boolean $deferExecution
     */
    private $deferExecution = false;

    /** @var array $scopes */
    // Scopes requested by the client
    protected $requestedScopes = array();

    // definitions of services that are discovered.
    protected $services = array();

    // Used to track authenticated state, can't discover services after doing authenticate()
    private $authenticated = false;

    /**
     * Construct the Google Client.
     *
     * @param $config Google_Config or string for the ini file to load
     */
    public function __construct($config = null) {
        if (is_string($config) && strlen($config)) {
            $config = new Google_Config($config);
        } else if (!($config instanceof Google_Config)) {
            $config = new Google_Config();

            if ($this->isAppEngine()) {
                // Automatically use Memcache if we're in AppEngine.
                $config->setCacheClass('Google_Cache_Memcache');
            }

            if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
                // Automatically disable compress.zlib, as currently unsupported.
                $config->setClassConfig(Google_Http_Request::class, 'disable_gzip', true);
            }
        }

        if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
            if (function_exists('curl_version') && function_exists('curl_exec') && !$this->isAppEngine()) {
                $config->setIoClass(Google_IO_Curl::class);
            }
        }

        $this->config = $config;
    }

    /**
     * Get a string containing the version of the library.
     *
     * @return string
     */
    public function getLibraryVersion() {
        return self::LIBVER;
    }

    /**
     * Attempt to exchange a code for an valid authentication token.
     * Helper wrapped around the OAuth 2.0 implementation.
     *
     * @param $code string code from accounts.google.com
     *
     * @return string token
     */
    public function authenticate($code) {
        $this->authenticated = true;

        return $this->getAuth()
                    ->authenticate($code);
    }

    /**
     * Set the auth config from the JSON string provided.
     * This structure should match the file downloaded from
     * the "Download JSON" button on in the Google Developer
     * Console.
     *
     * @param string $json the configuration json
     *
     * @throws Google_Exception
     */
    public function setAuthConfig($json) {
        $data = json_decode($json);
        $key  = isset($data->installed) ? 'installed' : 'web';
        if (!isset($data->$key)) {
            throw new Google_Exception("Invalid client secret JSON file.");
        }
        $this->setClientId($data->$key->client_id);
        $this->setClientSecret($data->$key->client_secret);
        if (isset($data->$key->redirect_uris)) {
            $this->setRedirectUri($data->$key->redirect_uris[0]);
        }
    }

    /**
     * Set the auth config from the JSON file in the path
     * provided. This should match the file downloaded from
     * the "Download JSON" button on in the Google Developer
     * Console.
     *
     * @param string $file the file location of the client json
     */
    public function setAuthConfigFile($file) {
        $this->setAuthConfig(file_get_contents($file));
    }

    /**
     * @return array
     * @visible For Testing
     * @throws Google_Auth_Exception
     */
    public function prepareScopes() {
        if (empty($this->requestedScopes)) {
            throw new Google_Auth_Exception("No scopes specified");
        }
        $scopes = implode(' ', $this->requestedScopes);

        return $scopes;
    }

    /**
     * Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl()
     * or Google_Client#getAccessToken().
     *
     * @param string $accessToken JSON encoded string containing in the following format:
     *                            {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
     *                            "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
     */
    public function setAccessToken($accessToken) {
        if ($accessToken == 'null') {
            $accessToken = null;
        }
        $this->getAuth()
             ->setAccessToken($accessToken);
    }


    /**
     * Set the authenticator object
     *
     * @param Google_Auth_Abstract $auth
     */
    public function setAuth(Google_Auth_Abstract $auth) {
        $this->config->setAuthClass(get_class($auth));
        $this->auth = $auth;
    }

    /**
     * Set the IO object
     *
     * @param Google_IO_Abstract $io
     */
    public function setIo(Google_IO_Abstract $io) {
        $this->config->setIoClass(get_class($io));
        $this->io = $io;
    }

    /**
     * Set the Cache object
     *
     * @param Google_Cache_Abstract $cache
     */
    public function setCache(Google_Cache_Abstract $cache) {
        $this->config->setCacheClass(get_class($cache));
        $this->cache = $cache;
    }

    /**
     * Set the Logger object
     *
     * @param Google_Logger_Abstract $logger
     */
    public function setLogger(Google_Logger_Abstract $logger) {
        $this->config->setLoggerClass(get_class($logger));
        $this->logger = $logger;
    }

    /**
     * Construct the OAuth 2.0 authorization request URI.
     *
     * @return string
     */
    public function createAuthUrl() {
        $scopes = $this->prepareScopes();

        return $this->getAuth()
                    ->createAuthUrl($scopes);
    }

    /**
     * Get the OAuth 2.0 access token.
     *
     * @return string $accessToken JSON encoded string in the following format:
     * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
     *  "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
     */
    public function getAccessToken() {
        $token = $this->getAuth()
                      ->getAccessToken();
        // The response is json encoded, so could be the string null.
        // It is arguable whether this check should be here or lower
        // in the library.
        return (null == $token || 'null' == $token || '[]' == $token) ? null : $token;
    }

    /**
     * Get the OAuth 2.0 refresh token.
     *
     * @return string $refreshToken refresh token or null if not available
     */
    public function getRefreshToken() {
        return $this->getAuth()
                    ->getRefreshToken();
    }

    /**
     * Returns if the access_token is expired.
     *
     * @return bool Returns True if the access_token is expired.
     */
    public function isAccessTokenExpired() {
        return $this->getAuth()
                    ->isAccessTokenExpired();
    }

    /**
     * Set OAuth 2.0 "state" parameter to achieve per-request customization.
     *
     * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
     *
     * @param string $state
     */
    public function setState($state) {
        $this->getAuth()
             ->setState($state);
    }

    /**
     * @param string $accessType Possible values for access_type include:
     *                           {@code "offline"} to request offline access from the user.
     *                           {@code "online"} to request online access from the user.
     */
    public function setAccessType($accessType) {
        $this->config->setAccessType($accessType);
    }

    /**
     * @param string $approvalPrompt Possible values for approval_prompt include:
     *                               {@code "force"} to force the approval UI to appear. (This is the default value)
     *                               {@code "auto"} to request auto-approval when possible.
     */
    public function setApprovalPrompt($approvalPrompt) {
        $this->config->setApprovalPrompt($approvalPrompt);
    }

    /**
     * Set the login hint, email address or sub id.
     *
     * @param string $loginHint
     */
    public function setLoginHint($loginHint) {
        $this->config->setLoginHint($loginHint);
    }

    /**
     * Set the application name, this is included in the User-Agent HTTP header.
     *
     * @param string $applicationName
     */
    public function setApplicationName($applicationName) {
        $this->config->setApplicationName($applicationName);
    }

    /**
     * Set the OAuth 2.0 Client ID.
     *
     * @param string $clientId
     */
    public function setClientId($clientId) {
        $this->config->setClientId($clientId);
    }

    /**
     * Set the OAuth 2.0 Client Secret.
     *
     * @param string $clientSecret
     */
    public function setClientSecret($clientSecret) {
        $this->config->setClientSecret($clientSecret);
    }

    /**
     * Set the OAuth 2.0 Redirect URI.
     *
     * @param string $redirectUri
     */
    public function setRedirectUri($redirectUri) {
        $this->config->setRedirectUri($redirectUri);
    }

    /**
     * If 'plus.login' is included in the list of requested scopes, you can use
     * this method to define types of app activities that your app will write.
     * You can find a list of available types here:
     *
     * @link https://developers.google.com/+/api/moment-types
     *
     * @param array $requestVisibleActions Array of app activity types
     */
    public function setRequestVisibleActions($requestVisibleActions) {
        if (is_array($requestVisibleActions)) {
            $requestVisibleActions = join(" ", $requestVisibleActions);
        }
        $this->config->setRequestVisibleActions($requestVisibleActions);
    }

    /**
     * Set the developer key to use, these are obtained through the API Console.
     *
     * @see http://code.google.com/apis/console-help/#generatingdevkeys
     *
     * @param string $developerKey
     */
    public function setDeveloperKey($developerKey) {
        $this->config->setDeveloperKey($developerKey);
    }

    /**
     * Set the hd (hosted domain) parameter streamlines the login process for
     * Google Apps hosted accounts. By including the domain of the user, you
     * restrict sign-in to accounts at that domain.
     *
     * @param $hd string - the domain to use.
     */
    public function setHostedDomain($hd) {
        $this->config->setHostedDomain($hd);
    }

    /**
     * Set the prompt hint. Valid values are none, consent and select_account.
     * If no value is specified and the user has not previously authorized
     * access, then the user is shown a consent screen.
     *
     * @param $prompt string
     */
    public function setPrompt($prompt) {
        $this->config->setPrompt($prompt);
    }

    /**
     * openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
     * 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
     * an authentication request is valid.
     *
     * @param $realm string - the URL-space to use.
     */
    public function setOpenidRealm($realm) {
        $this->config->setOpenidRealm($realm);
    }

    /**
     * If this is provided with the value true, and the authorization request is
     * granted, the authorization will include any previous authorizations
     * granted to this user/application combination for other scopes.
     *
     * @param $include boolean - the URL-space to use.
     */
    public function setIncludeGrantedScopes($include) {
        $this->config->setIncludeGrantedScopes($include);
    }

    /**
     * Fetches a fresh OAuth 2.0 access token with the given refresh token.
     *
     * @param string $refreshToken
     */
    public function refreshToken($refreshToken) {
        $this->getAuth()
             ->refreshToken($refreshToken);
    }

    /**
     * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
     * token, if a token isn't provided.
     *
     * @param string|null $token The token (access token or a refresh token) that should be revoked.
     *
     * @return boolean Returns True if the revocation was successful, otherwise False.
     * @throws Google_Auth_Exception
     *
     */
    public function revokeToken($token = null) {
        return $this->getAuth()
                    ->revokeToken($token);
    }

    /**
     * Verify an id_token. This method will verify the current id_token, if one
     * isn't provided.
     *
     * @param string|null $token The token (id_token) that should be verified.
     *
     * @return Google_Auth_LoginTicket Returns an apiLoginTicket if the verification was
     * successful.
     * @throws Google_Auth_Exception
     *
     */
    public function verifyIdToken($token = null) {
        return $this->getAuth()
                    ->verifyIdToken($token);
    }

    /**
     * Verify a JWT that was signed with your own certificates.
     *
     * @param $id_token      string The JWT token
     * @param $cert_location array of certificates
     * @param $audience      string the expected consumer of the token
     * @param $issuer        string the expected issuer, defaults to Google
     * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
     *
     * @return mixed token information if valid, false if not
     */
    public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null) {
        $auth  = new Google_Auth_OAuth2($this);
        $certs = $auth->retrieveCertsFromLocation($cert_location);

        return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
    }

    /**
     * Set the scopes to be requested. Must be called before createAuthUrl().
     * Will remove any previously configured scopes.
     *
     * @param array $scopes , ie: array('https://www.googleapis.com/auth/plus.login',
     *                      'https://www.googleapis.com/auth/moderator')
     */
    public function setScopes($scopes) {
        $this->requestedScopes = array();
        $this->addScope($scopes);
    }

    /**
     * This functions adds a scope to be requested as part of the OAuth2.0 flow.
     * Will append any scopes not previously requested to the scope parameter.
     * A single string will be treated as a scope to request. An array of strings
     * will each be appended.
     *
     * @param $scope_or_scopes string|array e.g. "profile"
     */
    public function addScope($scope_or_scopes) {
        if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
            $this->requestedScopes[] = $scope_or_scopes;
        } else if (is_array($scope_or_scopes)) {
            foreach ($scope_or_scopes as $scope) {
                $this->addScope($scope);
            }
        }
    }

    /**
     * Returns the list of scopes requested by the client
     *
     * @return array the list of scopes
     *
     */
    public function getScopes() {
        return $this->requestedScopes;
    }

    /**
     * Declare whether batch calls should be used. This may increase throughput
     * by making multiple requests in one connection.
     *
     * @param boolean $useBatch True if the batch support should
     *                          be enabled. Defaults to False.
     */
    public function setUseBatch($useBatch) {
        // This is actually an alias for setDefer.
        $this->setDefer($useBatch);
    }

    /**
     * Declare whether making API calls should make the call immediately, or
     * return a request which can be called with ->execute();
     *
     * @param boolean $defer True if calls should not be executed right away.
     */
    public function setDefer($defer) {
        $this->deferExecution = $defer;
    }

    /**
     * Helper method to execute deferred HTTP requests.
     *
     * @param $request Google_Http_Request|Google_Http_Batch
     *
     * @return object of the type of the expected class or array.
     * @throws Google_Exception
     */
    public function execute($request) {
        if ($request instanceof Google_Http_Request) {
            $request->setUserAgent($this->getApplicationName() . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion());
            if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
                $request->enableGzip();
            }
            $request->maybeMoveParametersToBody();

            return Google_Http_REST::execute($this, $request);
        } else if ($request instanceof Google_Http_Batch) {
            return $request->execute();
        } else {
            throw new Google_Exception("Do not know how to execute this type of object.");
        }
    }

    /**
     * Whether or not to return raw requests
     *
     * @return boolean
     */
    public function shouldDefer() {
        return $this->deferExecution;
    }

    /**
     * @return Google_Auth_Abstract Authentication implementation
     */
    public function getAuth() {
        if (!isset($this->auth)) {
            $class      = $this->config->getAuthClass();
            $this->auth = new $class($this);
        }

        return $this->auth;
    }

    /**
     * @return Google_IO_Abstract IO implementation
     */
    public function getIo() {
        if (!isset($this->io)) {
            $class    = $this->config->getIoClass();
            $this->io = new $class($this);
        }

        return $this->io;
    }

    /**
     * @return Google_Cache_Abstract Cache implementation
     */
    public function getCache() {
        if (!isset($this->cache)) {
            $class       = $this->config->getCacheClass();
            $this->cache = new $class($this);
        }

        return $this->cache;
    }

    /**
     * @return Google_Logger_Abstract Logger implementation
     */
    public function getLogger() {
        if (!isset($this->logger)) {
            $class        = $this->config->getLoggerClass();
            $this->logger = new $class($this);
        }

        return $this->logger;
    }

    /**
     * Retrieve custom configuration for a specific class.
     *
     * @param $class string|object - class or instance of class to retrieve
     * @param $key   string optional - key to retrieve
     *
     * @return array
     */
    public function getClassConfig($class, $key = null) {
        if (!is_string($class)) {
            $class = get_class($class);
        }

        return $this->config->getClassConfig($class, $key);
    }

    /**
     * Set configuration specific to a given class.
     * $config->setClassConfig('Google_Cache_File',
     *   array('directory' => '/tmp/cache'));
     *
     * @param $class  string|object - The class name for the configuration
     * @param $config string key or an array of configuration values
     * @param $value  string optional - if $config is a key, the value
     *
     */
    public function setClassConfig($class, $config, $value = null) {
        if (!is_string($class)) {
            $class = get_class($class);
        }
        $this->config->setClassConfig($class, $config, $value);

    }

    /**
     * @return string the base URL to use for calls to the APIs
     */
    public function getBasePath() {
        return $this->config->getBasePath();
    }

    /**
     * @return string the name of the application
     */
    public function getApplicationName() {
        return $this->config->getApplicationName();
    }

    /**
     * Are we running in Google AppEngine?
     * return bool
     */
    public function isAppEngine() {
        return (Request::$SERVER->getVar('SERVER_SOFTWARE') !== null && strpos(Request::$SERVER->getVar('SERVER_SOFTWARE'), 'Google App Engine') !== false);
    }
}
Generator/Common/YouTube/googleclient/Google_Collection.php000064400000005670152355233130020103 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient;

use Countable;
use Iterator;

/**
 * Extension to the regular Google_Model that automatically
 * exposes the items array for iteration, so you can just
 * iterate over the object rather than a reference inside.
 */
class Google_Collection extends Google_Model implements Iterator, Countable {

    protected $collection_key = 'items';

    public function rewind(): void {
        if (isset($this->modelData[$this->collection_key]) && is_array($this->modelData[$this->collection_key])) {
            reset($this->modelData[$this->collection_key]);
        }
    }

    /** @return mixed */
    #[\ReturnTypeWillChange]
    public function current() {
        $this->coerceType($this->key());
        if (is_array($this->modelData[$this->collection_key])) {
            return current($this->modelData[$this->collection_key]);
        }
    }

    /** @return mixed */
    #[\ReturnTypeWillChange]
    public function key() {
        if (isset($this->modelData[$this->collection_key]) && is_array($this->modelData[$this->collection_key])) {
            return key($this->modelData[$this->collection_key]);
        }
    }

    public function next(): void {
        next($this->modelData[$this->collection_key]);
    }

    public function valid(): bool {
        $key = $this->key();

        return $key !== null && $key !== false;
    }

    public function count(): int {
        return count($this->modelData[$this->collection_key]);
    }

    public function offsetExists($offset): bool {
        if (!is_numeric($offset)) {
            return parent::offsetExists($offset);
        }

        return isset($this->modelData[$this->collection_key][$offset]);
    }

    /** @return mixed */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset) {
        if (!is_numeric($offset)) {
            return parent::offsetGet($offset);
        }
        $this->coerceType($offset);

        return $this->modelData[$this->collection_key][$offset];
    }

    public function offsetSet($offset, $value): void {
        if (!is_numeric($offset)) {
            parent::offsetSet($offset, $value);
        }
        $this->modelData[$this->collection_key][$offset] = $value;
    }

    public function offsetUnset($offset): void {
        if (!is_numeric($offset)) {
            parent::offsetUnset($offset);
        }
        unset($this->modelData[$this->collection_key][$offset]);
    }

    private function coerceType($offset) {
        $typeKey = $this->keyType($this->collection_key);
        if (isset($this->$typeKey) && !is_object($this->modelData[$this->collection_key][$offset])) {
            $type                                            = $this->$typeKey;
            $this->modelData[$this->collection_key][$offset] = new $type($this->modelData[$this->collection_key][$offset]);
        }
    }
}
Generator/Common/YouTube/googleclient/Google_Config.php000064400000036553152355233130017221 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Auth\Google_Auth_OAuth2;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Logger\Google_Logger_Null;

/**
 * A class to contain the library configuration for the Google API client.
 */
class Google_Config {

    const GZIP_DISABLED = true;
    const GZIP_ENABLED = false;
    const GZIP_UPLOADS_ENABLED = true;
    const GZIP_UPLOADS_DISABLED = false;
    const USE_AUTO_IO_SELECTION = "auto";
    const TASK_RETRY_NEVER = 0;
    const TASK_RETRY_ONCE = 1;
    const TASK_RETRY_ALWAYS = -1;
    protected $configuration;

    /**
     * Create a new Google_Config. Can accept an ini file location with the
     * local configuration. For example:
     *     application_name="My App"
     *
     * @param [$ini_file_location] - optional - The location of the ini file to load
     */
    public function __construct($ini_file_location = null) {
        $this->configuration = array(
            // The application_name is included in the User-Agent HTTP header.
            'application_name' => '',

            // Which Authentication, Storage and HTTP IO classes to use.
            'auth_class'       => Google_Auth_OAuth2::class,
            'io_class'         => self::USE_AUTO_IO_SELECTION,
            'logger_class'     => Google_Logger_Null::class,

            // Don't change these unless you're working against a special development
            // or testing environment.
            'base_path'        => 'https://www.googleapis.com',

            // Definition of class specific values, like file paths and so on.
            'classes'          => array(
                'Google_IO_Abstract'       => array(
                    'request_timeout_seconds' => 100,
                ),
                'Google_Logger_Abstract'   => array(
                    'level'          => 'debug',
                    'log_format'     => "[%datetime%] %level%: %message% %context%\n",
                    'date_format'    => 'd/M/Y:H:i:s O',
                    'allow_newlines' => true
                ),
                'Google_Logger_File'       => array(
                    'file' => 'php://stdout',
                    'mode' => 0640,
                    'lock' => false,
                ),
                'Google_Http_Request'      => array(
                    // Disable the use of gzip on calls if set to true. Defaults to false.
                    'disable_gzip'            => self::GZIP_ENABLED,

                    // We default gzip to disabled on uploads even if gzip is otherwise
                    // enabled, due to some issues seen with small packet sizes for uploads.
                    // Please test with this option before enabling gzip for uploads in
                    // a production environment.
                    'enable_gzip_for_uploads' => self::GZIP_UPLOADS_DISABLED,
                ),
                // If you want to pass in OAuth 2.0 settings, they will need to be
                // structured like this.
                'Google_Auth_OAuth2'       => array(
                    // Keys for OAuth 2.0 access, see the API console at
                    // https://developers.google.com/console
                    'client_id'                  => '',
                    'client_secret'              => '',
                    'redirect_uri'               => '',

                    // Simple API access key, also from the API console. Ensure you get
                    // a Server key, and not a Browser key.
                    'developer_key'              => '',

                    // Other parameters.
                    'hd'                         => '',
                    'prompt'                     => '',
                    'openid.realm'               => '',
                    'include_granted_scopes'     => '',
                    'login_hint'                 => '',
                    'request_visible_actions'    => '',
                    'access_type'                => 'online',
                    'approval_prompt'            => 'auto',
                    'federated_signon_certs_url' => 'https://www.googleapis.com/oauth2/v1/certs',
                ),
                'Google_Task_Runner'       => array(
                    // Delays are specified in seconds
                    'initial_delay' => 1,
                    'max_delay'     => 60,
                    // Base number for exponential backoff
                    'factor'        => 2,
                    // A random number between -jitter and jitter will be added to the
                    // factor on each iteration to allow for better distribution of
                    // retries.
                    'jitter'        => .5,
                    // Maximum number of retries allowed
                    'retries'       => 0
                ),
                'Google_Service_Exception' => array(
                    'retry_map' => array(
                        '500'                   => self::TASK_RETRY_ALWAYS,
                        '503'                   => self::TASK_RETRY_ALWAYS,
                        'rateLimitExceeded'     => self::TASK_RETRY_ALWAYS,
                        'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS
                    )
                ),
                'Google_IO_Exception'      => array(
                    'retry_map' => !extension_loaded('curl') ? array() : array(
                        CURLE_COULDNT_RESOLVE_HOST => self::TASK_RETRY_ALWAYS,
                        CURLE_COULDNT_CONNECT      => self::TASK_RETRY_ALWAYS,
                        CURLE_OPERATION_TIMEOUTED  => self::TASK_RETRY_ALWAYS,
                        CURLE_SSL_CONNECT_ERROR    => self::TASK_RETRY_ALWAYS,
                        CURLE_GOT_NOTHING          => self::TASK_RETRY_ALWAYS
                    )
                ),
                // Set a default directory for the file cache.
                'Google_Cache_File'        => array(
                    'directory' => sys_get_temp_dir() . '/Google_Client'
                )
            ),
        );
        if ($ini_file_location) {
            $ini = parse_ini_file($ini_file_location, true);
            if (is_array($ini) && count($ini)) {
                $merged_configuration = $ini + $this->configuration;
                if (isset($ini['classes']) && isset($this->configuration['classes'])) {
                    $merged_configuration['classes'] = $ini['classes'] + $this->configuration['classes'];
                }
                $this->configuration = $merged_configuration;
            }
        }
    }

    /**
     * Set configuration specific to a given class.
     * $config->setClassConfig('Google_Cache_File',
     *   array('directory' => '/tmp/cache'));
     *
     * @param $class  string The class name for the configuration
     * @param $config string key or an array of configuration values
     * @param $value  string optional - if $config is a key, the value
     */
    public function setClassConfig($class, $config, $value = null) {
        if (!is_array($config)) {
            if (!isset($this->configuration['classes'][$class])) {
                $this->configuration['classes'][$class] = array();
            }
            $this->configuration['classes'][$class][$config] = $value;
        } else {
            $this->configuration['classes'][$class] = $config;
        }
    }

    public function getClassConfig($class, $key = null) {
        if (!isset($this->configuration['classes'][$class])) {
            return null;
        }
        if ($key === null) {
            return $this->configuration['classes'][$class];
        } else if (isset($this->configuration['classes'][$class][$key])) {
            return $this->configuration['classes'][$class][$key];
        } else {
            return null;
        }
    }

    /**
     * Return the configured cache class.
     *
     * @return string
     */
    public function getCacheClass() {
        return $this->configuration['cache_class'];
    }

    /**
     * Return the configured logger class.
     *
     * @return string
     */
    public function getLoggerClass() {
        return $this->configuration['logger_class'];
    }

    /**
     * Return the configured Auth class.
     *
     * @return string
     */
    public function getAuthClass() {
        return $this->configuration['auth_class'];
    }

    /**
     * Set the auth class.
     *
     * @param $class string the class name to set
     */
    public function setAuthClass($class) {
        $prev = $this->configuration['auth_class'];
        if (!isset($this->configuration['classes'][$class]) && isset($this->configuration['classes'][$prev])) {
            $this->configuration['classes'][$class] = $this->configuration['classes'][$prev];
        }
        $this->configuration['auth_class'] = $class;
    }

    /**
     * Set the IO class.
     *
     * @param $class string the class name to set
     */
    public function setIoClass($class) {
        $prev = $this->configuration['io_class'];
        if (!isset($this->configuration['classes'][$class]) && isset($this->configuration['classes'][$prev])) {
            $this->configuration['classes'][$class] = $this->configuration['classes'][$prev];
        }
        $this->configuration['io_class'] = $class;
    }

    /**
     * Set the cache class.
     *
     * @param $class string the class name to set
     */
    public function setCacheClass($class) {
        $prev = $this->configuration['cache_class'];
        if (!isset($this->configuration['classes'][$class]) && isset($this->configuration['classes'][$prev])) {
            $this->configuration['classes'][$class] = $this->configuration['classes'][$prev];
        }
        $this->configuration['cache_class'] = $class;
    }

    /**
     * Set the logger class.
     *
     * @param $class string the class name to set
     */
    public function setLoggerClass($class) {
        $prev = $this->configuration['logger_class'];
        if (!isset($this->configuration['classes'][$class]) && isset($this->configuration['classes'][$prev])) {
            $this->configuration['classes'][$class] = $this->configuration['classes'][$prev];
        }
        $this->configuration['logger_class'] = $class;
    }

    /**
     * Return the configured IO class.
     *
     * @return string
     */
    public function getIoClass() {
        return $this->configuration['io_class'];
    }

    /**
     * Set the application name, this is included in the User-Agent HTTP header.
     *
     * @param string $name
     */
    public function setApplicationName($name) {
        $this->configuration['application_name'] = $name;
    }

    /**
     * @return string the name of the application
     */
    public function getApplicationName() {
        return $this->configuration['application_name'];
    }

    /**
     * Set the client ID for the auth class.
     *
     * @param $clientId string - the API console client ID
     */
    public function setClientId($clientId) {
        $this->setAuthConfig('client_id', $clientId);
    }

    /**
     * Set the client secret for the auth class.
     *
     * @param $secret string - the API console client secret
     */
    public function setClientSecret($secret) {
        $this->setAuthConfig('client_secret', $secret);
    }

    /**
     * Set the redirect uri for the auth class. Note that if using the
     * Javascript based sign in flow, this should be the string 'postmessage'.
     *
     * @param $uri string - the URI that users should be redirected to
     */
    public function setRedirectUri($uri) {
        $this->setAuthConfig('redirect_uri', $uri);
    }

    /**
     * Set the app activities for the auth class.
     *
     * @param $rva string a space separated list of app activity types
     */
    public function setRequestVisibleActions($rva) {
        $this->setAuthConfig('request_visible_actions', $rva);
    }

    /**
     * Set the the access type requested (offline or online.)
     *
     * @param $access string - the access type
     */
    public function setAccessType($access) {
        $this->setAuthConfig('access_type', $access);
    }

    /**
     * Set when to show the approval prompt (auto or force)
     *
     * @param $approval string - the approval request
     */
    public function setApprovalPrompt($approval) {
        $this->setAuthConfig('approval_prompt', $approval);
    }

    /**
     * Set the login hint (email address or sub identifier)
     *
     * @param $hint string
     */
    public function setLoginHint($hint) {
        $this->setAuthConfig('login_hint', $hint);
    }

    /**
     * Set the developer key for the auth class. Note that this is separate value
     * from the client ID - if it looks like a URL, its a client ID!
     *
     * @param $key string - the API console developer key
     */
    public function setDeveloperKey($key) {
        $this->setAuthConfig('developer_key', $key);
    }

    /**
     * Set the hd (hosted domain) parameter streamlines the login process for
     * Google Apps hosted accounts. By including the domain of the user, you
     * restrict sign-in to accounts at that domain.
     *
     * @param $hd string - the domain to use.
     */
    public function setHostedDomain($hd) {
        $this->setAuthConfig('hd', $hd);
    }

    /**
     * Set the prompt hint. Valid values are none, consent and select_account.
     * If no value is specified and the user has not previously authorized
     * access, then the user is shown a consent screen.
     *
     * @param $prompt string
     */
    public function setPrompt($prompt) {
        $this->setAuthConfig('prompt', $prompt);
    }

    /**
     * openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
     * 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
     * an authentication request is valid.
     *
     * @param $realm string - the URL-space to use.
     */
    public function setOpenidRealm($realm) {
        $this->setAuthConfig('openid.realm', $realm);
    }

    /**
     * If this is provided with the value true, and the authorization request is
     * granted, the authorization will include any previous authorizations
     * granted to this user/application combination for other scopes.
     *
     * @param $include boolean - the URL-space to use.
     */
    public function setIncludeGrantedScopes($include) {
        $this->setAuthConfig('include_granted_scopes', $include ? "true" : "false");
    }

    /**
     * @return string the base URL to use for API calls
     */
    public function getBasePath() {
        return $this->configuration['base_path'];
    }

    /**
     * Set the auth configuration for the current auth class.
     *
     * @param $key   - the key to set
     * @param $value - the parameter value
     */
    private function setAuthConfig($key, $value) {
        if (!isset($this->configuration['classes'][$this->getAuthClass()])) {
            $this->configuration['classes'][$this->getAuthClass()] = array();
        }
        $this->configuration['classes'][$this->getAuthClass()][$key] = $value;
    }
}
Generator/Common/YouTube/googleclient/Google_Exception.php000064400000000230152355233130017731 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient;

use Exception;

class Google_Exception extends Exception {

}
Generator/Common/YouTube/googleclient/Google_Model.php000064400000020640152355233130017042 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient;

use ArrayAccess;
use ReflectionObject;
use ReflectionProperty;
use stdClass;

/**
 * This class defines attributes, valid values, and usage which is generated
 * from a given json schema.
 * http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5
 *
 * @author Chirag Shah <chirags@google.com>
 *
 */
class Google_Model implements ArrayAccess {

    protected $internal_gapi_mappings = array();
    protected $modelData = array();
    protected $processed = array();

    /**
     * Polymorphic - accepts a variable number of arguments dependent
     * on the type of the model subclass.
     */
    final public function __construct() {
        if (func_num_args() == 1 && is_array(func_get_arg(0))) {
            // Initialize the model with the array's contents.
            $array = func_get_arg(0);
            $this->mapTypes($array);
        }
        $this->gapiInit();
    }

    /**
     * Getter that handles passthrough access to the data array, and lazy object creation.
     *
     * @param string $key Property name.
     *
     * @return mixed The value if any, or null.
     */
    public function __get($key) {
        $keyTypeName = $this->keyType($key);
        $keyDataType = $this->dataType($key);
        if (isset($this->$keyTypeName) && !isset($this->processed[$key])) {
            if (isset($this->modelData[$key])) {
                $val = $this->modelData[$key];
            } else if (isset($this->$keyDataType) && ($this->$keyDataType == 'array' || $this->$keyDataType == 'map')) {
                $val = array();
            } else {
                $val = null;
            }

            if ($this->isAssociativeArray($val)) {
                if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) {
                    foreach ($val as $arrayKey => $arrayItem) {
                        $this->modelData[$key][$arrayKey] = $this->createObjectFromName($keyTypeName, $arrayItem);
                    }
                } else {
                    $this->modelData[$key] = $this->createObjectFromName($keyTypeName, $val);
                }
            } else if (is_array($val)) {
                $arrayObject = array();
                foreach ($val as $arrayIndex => $arrayItem) {
                    $arrayObject[$arrayIndex] = $this->createObjectFromName($keyTypeName, $arrayItem);
                }
                $this->modelData[$key] = $arrayObject;
            }
            $this->processed[$key] = true;
        }

        return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
    }

    /**
     * Initialize this object's properties from an array.
     *
     * @param array $array Used to seed this object's properties.
     *
     * @return void
     */
    protected function mapTypes($array) {
        // Hard initilise simple types, lazy load more complex ones.
        foreach ($array as $key => $val) {
            if (!property_exists($this, $this->keyType($key)) && property_exists($this, $key)) {
                $this->$key = $val;
                unset($array[$key]);
            } elseif (property_exists($this, $camelKey = Google_Utils::camelCase($key))) {
                // This checks if property exists as camelCase, leaving it in array as snake_case
                // in case of backwards compatibility issues.
                $this->$camelKey = $val;
            }
        }
        $this->modelData = $array;
    }

    /**
     * Blank initialiser to be used in subclasses to do  post-construction initialisation - this
     * avoids the need for subclasses to have to implement the variadics handling in their
     * constructors.
     */
    protected function gapiInit() {
        return;
    }

    /**
     * Create a simplified object suitable for straightforward
     * conversion to JSON. This is relatively expensive
     * due to the usage of reflection, but shouldn't be called
     * a whole lot, and is the most straightforward way to filter.
     */
    public function toSimpleObject() {
        $object = new stdClass();

        // Process all other data.
        foreach ($this->modelData as $key => $val) {
            $result = $this->getSimpleValue($val);
            if ($result !== null) {
                $object->$key = $result;
            }
        }

        // Process all public properties.
        $reflect = new ReflectionObject($this);
        $props   = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
        foreach ($props as $member) {
            $name   = $member->getName();
            $result = $this->getSimpleValue($this->$name);
            if ($result !== null) {
                $name          = $this->getMappedName($name);
                $object->$name = $result;
            }
        }

        return $object;
    }

    /**
     * Handle different types of values, primarily
     * other objects and map and array data types.
     */
    private function getSimpleValue($value) {
        if ($value instanceof Google_Model) {
            return $value->toSimpleObject();
        } else if (is_array($value)) {
            $return = array();
            foreach ($value as $key => $a_value) {
                $a_value = $this->getSimpleValue($a_value);
                if ($a_value !== null) {
                    $key          = $this->getMappedName($key);
                    $return[$key] = $a_value;
                }
            }

            return $return;
        }

        return $value;
    }

    /**
     * If there is an internal name mapping, use that.
     */
    private function getMappedName($key) {
        if (isset($this->internal_gapi_mappings) && isset($this->internal_gapi_mappings[$key])) {
            $key = $this->internal_gapi_mappings[$key];
        }

        return $key;
    }

    /**
     * Returns true only if the array is associative.
     *
     * @param array $array
     *
     * @return bool True if the array is associative.
     */
    protected function isAssociativeArray($array) {
        if (!is_array($array)) {
            return false;
        }
        $keys = array_keys($array);
        foreach ($keys as $key) {
            if (is_string($key)) {
                return true;
            }
        }

        return false;
    }

    /**
     * Given a variable name, discover its type.
     *
     * @param $name
     * @param $item
     *
     * @return object The object from the item.
     */
    private function createObjectFromName($name, $item) {
        if (strpos($this->$name, 'Google_Service_YouTube') !== false) {
            $type = 'Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service\\' . $this->$name;
        } else {
            $type = __NAMESPACE__ . '\\' . $this->$name;
        }

        return new $type($item);
    }

    /**
     * Verify if $obj is an array.
     *
     * @throws Google_Exception Thrown if $obj isn't an array.
     *
     * @param array  $obj    Items that should be validated.
     * @param string $method Method expecting an array as an argument.
     */
    public function assertIsArray($obj, $method) {
        if ($obj && !is_array($obj)) {
            throw new Google_Exception("Incorrect parameter type passed to $method(). Expected an array.");
        }
    }

    public function offsetExists($offset): bool {
        return isset($this->$offset) || isset($this->modelData[$offset]);
    }

    /** @return mixed */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset) {
        return isset($this->$offset) ? $this->$offset : $this->__get($offset);
    }

    public function offsetSet($offset, $value): void {
        if (property_exists($this, $offset)) {
            $this->$offset = $value;
        } else {
            $this->modelData[$offset] = $value;
            $this->processed[$offset] = true;
        }
    }

    public function offsetUnset($offset): void {
        unset($this->modelData[$offset]);
    }

    protected function keyType($key) {
        return $key . "Type";
    }

    protected function dataType($key) {
        return $key . "DataType";
    }

    public function __isset($key) {
        return isset($this->modelData[$key]);
    }

    public function __unset($key) {
        unset($this->modelData[$key]);
    }
}
Generator/Common/YouTube/googleclient/Google_Service.php000064400000002154152355233130017402 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient;

/*
 * Copyright 2010 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

class Google_Service {

    public $version;
    public $servicePath;
    public $availableScopes;
    public $resource;
    private $client;

    public function __construct(Google_Client $client) {
        $this->client = $client;
    }

    /**
     * Return the associated Google_Client class.
     *
     * @return Google_Client
     */
    public function getClient() {
        return $this->client;
    }
}
Generator/Common/YouTube/googleclient/Google_Utils.php000064400000010275152355233130017105 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient;

/**
 * Collection of static utility methods used for convenience across
 * the client library.
 *
 * @author Chirag Shah <chirags@google.com>
 */
class Google_Utils {

    public static function urlSafeB64Encode($data) {
        $b64 = n2_base64_encode($data);
        $b64 = str_replace(array(
            '+',
            '/',
            '\r',
            '\n',
            '='
        ), array(
            '-',
            '_'
        ), $b64);

        return $b64;
    }

    public static function urlSafeB64Decode($b64) {
        $b64 = str_replace(array(
            '-',
            '_'
        ), array(
            '+',
            '/'
        ), $b64);

        return n2_base64_decode($b64);
    }

    /**
     * Misc function used to count the number of bytes in a post body, in the
     * world of multi-byte chars and the unpredictability of
     * strlen/mb_strlen/sizeof, this is the only way to do that in a sane
     * manner at the moment.
     *
     * This algorithm was originally developed for the
     * Solar Framework by Paul M. Jones
     *
     * @link   http://solarphp.com/
     * @link   http://svn.solarphp.com/core/trunk/Solar/Json.php
     * @link   http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Json/Decoder.php
     *
     * @param string $str
     *
     * @return int The number of bytes in a string.
     */
    public static function getStrLen($str) {
        $strlenVar = strlen($str);
        $d         = $ret = 0;
        for ($count = 0; $count < $strlenVar; ++$count) {
            $ordinalValue = ord($str[$ret]);
            switch (true) {
                case (($ordinalValue >= 0x20) && ($ordinalValue <= 0x7F)):
                    // characters U-00000000 - U-0000007F (same as ASCII)
                    $ret++;
                    break;
                case (($ordinalValue & 0xE0) == 0xC0):
                    // characters U-00000080 - U-000007FF, mask 110XXXXX
                    // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
                    $ret += 2;
                    break;
                case (($ordinalValue & 0xF0) == 0xE0):
                    // characters U-00000800 - U-0000FFFF, mask 1110XXXX
                    // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
                    $ret += 3;
                    break;
                case (($ordinalValue & 0xF8) == 0xF0):
                    // characters U-00010000 - U-001FFFFF, mask 11110XXX
                    // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
                    $ret += 4;
                    break;
                case (($ordinalValue & 0xFC) == 0xF8):
                    // characters U-00200000 - U-03FFFFFF, mask 111110XX
                    // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
                    $ret += 5;
                    break;
                case (($ordinalValue & 0xFE) == 0xFC):
                    // characters U-04000000 - U-7FFFFFFF, mask 1111110X
                    // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
                    $ret += 6;
                    break;
                default:
                    $ret++;
            }
        }

        return $ret;
    }

    /**
     * Normalize all keys in an array to lower-case.
     *
     * @param array $arr
     *
     * @return array Normalized array.
     */
    public static function normalize($arr) {
        if (!is_array($arr)) {
            return array();
        }

        $normalized = array();
        foreach ($arr as $key => $val) {
            $normalized[strtolower($key)] = $val;
        }

        return $normalized;
    }

    /**
     * Convert a string to camelCase
     *
     * @param string $value
     *
     * @return string
     */
    public static function camelCase($value) {
        $value    = ucwords(str_replace(array(
            '-',
            '_'
        ), ' ', $value));
        $value    = str_replace(' ', '', $value);
        $value[0] = strtolower($value[0]);

        return $value;
    }
}
Generator/Common/YouTube/googleclient/Logger/Google_Logger_Abstract.php000064400000024442152355233130022267 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Logger;

use DateTime;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;

/**
 * Abstract logging class based on the PSR-3 standard.
 *
 * NOTE: We don't implement `Psr\Log\LoggerInterface` because we need to
 * maintain PHP 5.2 support.
 *
 * @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
 */
abstract class Google_Logger_Abstract {

    /**
     * Default log format
     */
    const DEFAULT_LOG_FORMAT = "[%datetime%] %level%: %message% %context%\n";
    /**
     * Default date format
     *
     * Example: 16/Nov/2014:03:26:16 -0500
     */
    const DEFAULT_DATE_FORMAT = 'd/M/Y:H:i:s O';

    /**
     * System is unusable
     */
    const EMERGENCY = 'emergency';
    /**
     * Action must be taken immediately
     *
     * Example: Entire website down, database unavailable, etc. This should
     * trigger the SMS alerts and wake you up.
     */
    const ALERT = 'alert';
    /**
     * Critical conditions
     *
     * Example: Application component unavailable, unexpected exception.
     */
    const CRITICAL = 'critical';
    /**
     * Runtime errors that do not require immediate action but should typically
     * be logged and monitored.
     */
    const ERROR = 'error';
    /**
     * Exceptional occurrences that are not errors.
     *
     * Example: Use of deprecated APIs, poor use of an API, undesirable things
     * that are not necessarily wrong.
     */
    const WARNING = 'warning';
    /**
     * Normal but significant events.
     */
    const NOTICE = 'notice';
    /**
     * Interesting events.
     *
     * Example: User logs in, SQL logs.
     */
    const INFO = 'info';
    /**
     * Detailed debug information.
     */
    const DEBUG = 'debug';

    /**
     * @var array $levels Logging levels
     */
    protected static $levels = array(
        self::EMERGENCY => 600,
        self::ALERT     => 550,
        self::CRITICAL  => 500,
        self::ERROR     => 400,
        self::WARNING   => 300,
        self::NOTICE    => 250,
        self::INFO      => 200,
        self::DEBUG     => 100,
    );

    /**
     * @var integer $level The minimum logging level
     */
    protected $level = self::DEBUG;

    /**
     * @var string $logFormat The current log format
     */
    protected $logFormat = self::DEFAULT_LOG_FORMAT;
    /**
     * @var string $dateFormat The current date format
     */
    protected $dateFormat = self::DEFAULT_DATE_FORMAT;

    /**
     * @var boolean $allowNewLines If newlines are allowed
     */
    protected $allowNewLines = false;

    /**
     * @param Google_Client $client The current Google client
     */
    public function __construct(Google_Client $client) {
        $this->setLevel($client->getClassConfig('Google_Logger_Abstract', 'level'));

        $format          = $client->getClassConfig('Google_Logger_Abstract', 'log_format');
        $this->logFormat = $format ? $format : self::DEFAULT_LOG_FORMAT;

        $format           = $client->getClassConfig('Google_Logger_Abstract', 'date_format');
        $this->dateFormat = $format ? $format : self::DEFAULT_DATE_FORMAT;

        $this->allowNewLines = (bool)$client->getClassConfig('Google_Logger_Abstract', 'allow_newlines');
    }

    /**
     * Sets the minimum logging level that this logger handles.
     *
     * @param integer $level
     */
    public function setLevel($level) {
        $this->level = $this->normalizeLevel($level);
    }

    /**
     * Checks if the logger should handle messages at the provided level.
     *
     * @param integer $level
     *
     * @return boolean
     */
    public function shouldHandle($level) {
        return $this->normalizeLevel($level) >= $this->level;
    }

    /**
     * System is unusable.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function emergency($message, array $context = array()) {
        $this->log(self::EMERGENCY, $message, $context);
    }

    /**
     * Action must be taken immediately.
     *
     * Example: Entire website down, database unavailable, etc. This should
     * trigger the SMS alerts and wake you up.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function alert($message, array $context = array()) {
        $this->log(self::ALERT, $message, $context);
    }

    /**
     * Critical conditions.
     *
     * Example: Application component unavailable, unexpected exception.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function critical($message, array $context = array()) {
        $this->log(self::CRITICAL, $message, $context);
    }

    /**
     * Runtime errors that do not require immediate action but should typically
     * be logged and monitored.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function error($message, array $context = array()) {
        $this->log(self::ERROR, $message, $context);
    }

    /**
     * Exceptional occurrences that are not errors.
     *
     * Example: Use of deprecated APIs, poor use of an API, undesirable things
     * that are not necessarily wrong.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function warning($message, array $context = array()) {
        $this->log(self::WARNING, $message, $context);
    }

    /**
     * Normal but significant events.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function notice($message, array $context = array()) {
        $this->log(self::NOTICE, $message, $context);
    }

    /**
     * Interesting events.
     *
     * Example: User logs in, SQL logs.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function info($message, array $context = array()) {
        $this->log(self::INFO, $message, $context);
    }

    /**
     * Detailed debug information.
     *
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function debug($message, array $context = array()) {
        $this->log(self::DEBUG, $message, $context);
    }

    /**
     * Logs with an arbitrary level.
     *
     * @param mixed  $level   The log level
     * @param string $message The log message
     * @param array  $context The log context
     */
    public function log($level, $message, array $context = array()) {
        if (!$this->shouldHandle($level)) {
            return false;
        }

        $levelName = is_int($level) ? array_search($level, self::$levels) : $level;
        $message   = $this->interpolate(array(
            'message'  => $message,
            'context'  => $context,
            'level'    => strtoupper($levelName),
            'datetime' => new DateTime(),
        ));

        $this->write($message);
    }

    /**
     * Interpolates log variables into the defined log format.
     *
     * @param array $variables The log variables.
     *
     * @return string
     */
    protected function interpolate(array $variables = array()) {
        $template = $this->logFormat;

        if (!$variables['context']) {
            $template = str_replace('%context%', '', $template);
            unset($variables['context']);
        } else {
            $this->reverseJsonInContext($variables['context']);
        }

        foreach ($variables as $key => $value) {
            if (strpos($template, '%' . $key . '%') !== false) {
                $template = str_replace('%' . $key . '%', $this->export($value), $template);
            }
        }

        return $template;
    }

    /**
     * Reverses JSON encoded PHP arrays and objects so that they log better.
     *
     * @param array $context The log context
     */
    protected function reverseJsonInContext(array &$context) {
        if (!$context) {
            return;
        }

        foreach ($context as $key => $val) {
            if (!$val || !is_string($val) || !($val[0] == '{' || $val[0] == '[')) {
                continue;
            }

            $json = @json_decode($val);
            if (is_object($json) || is_array($json)) {
                $context[$key] = $json;
            }
        }
    }

    /**
     * Exports a PHP value for logging to a string.
     *
     * @param mixed $value The value to
     */
    protected function export($value) {
        if (is_string($value)) {
            if ($this->allowNewLines) {
                return $value;
            }

            return preg_replace('/[\r\n]+/', ' ', $value);
        }

        if (is_resource($value)) {
            return sprintf('resource(%d) of type (%s)', $value, get_resource_type($value));
        }

        if ($value instanceof DateTime) {
            return $value->format($this->dateFormat);
        }

        $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;

        if ($this->allowNewLines) {
            $options |= JSON_PRETTY_PRINT;
        }

        return @json_encode($value, $options);
    }

    /**
     * Converts a given log level to the integer form.
     *
     * @param mixed $level The logging level
     *
     * @return integer $level The normalized level
     * @throws Google_Logger_Exception If $level is invalid
     */
    protected function normalizeLevel($level) {
        if (is_int($level) && array_search($level, self::$levels) !== false) {
            return $level;
        }

        if (is_string($level) && isset(self::$levels[$level])) {
            return self::$levels[$level];
        }

        throw new Google_Logger_Exception(sprintf("Unknown LogLevel: '%s'", $level));
    }

    /**
     * Writes a message to the current log implementation.
     *
     * @param string $message The message
     */
    abstract protected function write($message);
}
Generator/Common/YouTube/googleclient/Logger/Google_Logger_Null.php000064400000000756152355233130021440 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Logger;


/**
 * Null logger based on the PSR-3 standard.
 *
 * This logger simply discards all messages.
 */
class Google_Logger_Null extends Google_Logger_Abstract {

    /**
     * {@inheritdoc}
     */
    public function shouldHandle($level) {
        return false;
    }

    /**
     * {@inheritdoc}
     */
    protected function write($message, array $context = array()) {
    }
}
Generator/Common/YouTube/googleclient/Task/Google_Task_Exception.php000064400000000360152355233130021621 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Task;


use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Exception;

class Google_Task_Exception extends Google_Exception {

}
Generator/Common/YouTube/googleclient/Task/Google_Task_Retryable.php000064400000000730152355233130021615 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Task;


/**
 * Interface for checking how many times a given task can be retried following
 * a failure.
 */
interface Google_Task_Retryable {

    /**
     * Gets the number of times the associated task can be retried.
     *
     * NOTE: -1 is returned if the task can be retried indefinitely
     *
     * @return integer
     */
    public function allowedRetries();
}
Generator/Common/YouTube/googleclient/Task/Google_Task_Runner.php000064400000014765152355233130021152 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Task;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;

/**
 * A task runner with exponential backoff support.
 *
 * @see https://developers.google.com/drive/web/handle-errors#implementing_exponential_backoff
 */
class Google_Task_Runner {

    /**
     * @var integer $maxDelay The max time (in seconds) to wait before a retry.
     */
    private $maxDelay = 60;
    /**
     * @var integer $delay The previous delay from which the next is calculated.
     */
    private $delay = 1;

    /**
     * @var integer $factor The base number for the exponential back off.
     */
    private $factor = 2;
    /**
     * @var float $jitter A random number between -$jitter and $jitter will be
     * added to $factor on each iteration to allow for a better distribution of
     * retries.
     */
    private $jitter = 0.5;

    /**
     * @var integer $attempts The number of attempts that have been tried so far.
     */
    private $attempts = 0;
    /**
     * @var integer $maxAttempts The max number of attempts allowed.
     */
    private $maxAttempts = 1;

    /**
     * @var Google_Client $client The current API client.
     */
    private $client;

    /**
     * @var string $name The name of the current task (used for logging).
     */
    private $name;
    /**
     * @var callable $action The task to run and possibly retry.
     */
    private $action;
    /**
     * @var array $arguments The task arguments.
     */
    private $arguments;

    /**
     * Creates a new task runner with exponential backoff support.
     *
     * @param Google_Client $client    The current API client
     * @param string        $name      The name of the current task (used for logging)
     * @param callable      $action    The task to run and possibly retry
     * @param array         $arguments The task arguments
     *
     * @throws Google_Task_Exception when misconfigured
     */
    public function __construct(Google_Client $client, $name, $action, array $arguments = array()) {
        $config = (array)$client->getClassConfig('Google_Task_Runner');

        if (isset($config['initial_delay'])) {
            if ($config['initial_delay'] < 0) {
                throw new Google_Task_Exception('Task configuration `initial_delay` must not be negative.');
            }

            $this->delay = $config['initial_delay'];
        }

        if (isset($config['max_delay'])) {
            if ($config['max_delay'] <= 0) {
                throw new Google_Task_Exception('Task configuration `max_delay` must be greater than 0.');
            }

            $this->maxDelay = $config['max_delay'];
        }

        if (isset($config['factor'])) {
            if ($config['factor'] <= 0) {
                throw new Google_Task_Exception('Task configuration `factor` must be greater than 0.');
            }

            $this->factor = $config['factor'];
        }

        if (isset($config['jitter'])) {
            if ($config['jitter'] <= 0) {
                throw new Google_Task_Exception('Task configuration `jitter` must be greater than 0.');
            }

            $this->jitter = $config['jitter'];
        }

        if (isset($config['retries'])) {
            if ($config['retries'] < 0) {
                throw new Google_Task_Exception('Task configuration `retries` must not be negative.');
            }
            $this->maxAttempts += $config['retries'];
        }

        if (!is_callable($action)) {
            throw new Google_Task_Exception('Task argument `$action` must be a valid callable.');
        }

        $this->name      = $name;
        $this->client    = $client;
        $this->action    = $action;
        $this->arguments = $arguments;
    }

    /**
     * Checks if a retry can be attempted.
     *
     * @return boolean
     */
    public function canAttmpt() {
        return $this->attempts < $this->maxAttempts;
    }

    /**
     * Runs the task and (if applicable) automatically retries when errors occur.
     *
     * @return mixed
     * @throws Google_Task_Retryable on failure when no retries are available.
     */
    public function run() {
        while ($this->attempt()) {
            try {
                return call_user_func_array($this->action, $this->arguments);
            } catch (Google_Task_Retryable $exception) {
                $allowedRetries = $exception->allowedRetries();

                if (!$this->canAttmpt() || !$allowedRetries) {
                    throw $exception;
                }

                if ($allowedRetries > 0) {
                    $this->maxAttempts = min($this->maxAttempts, $this->attempts + $allowedRetries);
                }
            }
        }
    }

    /**
     * Runs a task once, if possible. This is useful for bypassing the `run()`
     * loop.
     *
     * NOTE: If this is not the first attempt, this function will sleep in
     * accordance to the backoff configurations before running the task.
     *
     * @return boolean
     */
    public function attempt() {
        if (!$this->canAttmpt()) {
            return false;
        }

        if ($this->attempts > 0) {
            $this->backOff();
        }

        $this->attempts++;

        return true;
    }

    /**
     * Sleeps in accordance to the backoff configurations.
     */
    private function backOff() {
        $delay = $this->getDelay();

        $this->client->getLogger()
                     ->debug('Retrying task with backoff', array(
                         'request'         => $this->name,
                         'retry'           => $this->attempts,
                         'backoff_seconds' => $delay
                     ));

        usleep($delay * 1000000);
    }

    /**
     * Gets the delay (in seconds) for the current backoff period.
     *
     * @return float
     */
    private function getDelay() {
        $jitter = $this->getJitter();
        $factor = $this->attempts > 1 ? $this->factor + $jitter : 1 + abs($jitter);

        return $this->delay = min($this->maxDelay, $this->delay * $factor);
    }

    /**
     * Gets the current jitter (random number between -$this->jitter and
     * $this->jitter).
     *
     * @return float
     */
    private function getJitter() {
        return $this->jitter * 2 * mt_rand() / mt_getrandmax() - $this->jitter;
    }
}
Generator/Common/YouTube/googleclient/IO/Google_IO_Abstract.php000064400000027454152355233130020455 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\IO;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_CacheParser;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_Request;

/**
 * Abstract IO base class
 */
abstract class Google_IO_Abstract {

    const UNKNOWN_CODE = 0;
    const FORM_URLENCODED = 'application/x-www-form-urlencoded';
    private static $CONNECTION_ESTABLISHED_HEADERS = array(
        "HTTP/1.0 200 Connection established\r\n\r\n",
        "HTTP/1.1 200 Connection established\r\n\r\n",
    );
    private static $ENTITY_HTTP_METHODS = array(
        "POST" => null,
        "PUT"  => null
    );
    private static $HOP_BY_HOP = array(
        'connection'          => true,
        'keep-alive'          => true,
        'proxy-authenticate'  => true,
        'proxy-authorization' => true,
        'te'                  => true,
        'trailers'            => true,
        'transfer-encoding'   => true,
        'upgrade'             => true
    );


    /** @var Google_Client */
    protected $client;

    public function __construct(Google_Client $client) {
        $this->client = $client;
        $timeout      = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
        if ($timeout > 0) {
            $this->setTimeout($timeout);
        }
    }

    /**
     * Executes a Google_Http_Request and returns the resulting populated Google_Http_Request
     *
     * @param Google_Http_Request $request
     *
     * @return Google_Http_Request $request
     */
    abstract public function executeRequest(Google_Http_Request $request);

    /**
     * Set options that update the transport implementation's behavior.
     *
     * @param $options
     */
    abstract public function setOptions($options);

    /**
     * Set the maximum request time in seconds.
     *
     * @param $timeout in seconds
     */
    abstract public function setTimeout($timeout);

    /**
     * Get the maximum request time in seconds.
     *
     * @return timeout in seconds
     */
    abstract public function getTimeout();

    /**
     * Test for the presence of a cURL header processing bug
     *
     * The cURL bug was present in versions prior to 7.30.0 and caused the header
     * length to be miscalculated when a "Connection established" header added by
     * some proxies was present.
     *
     * @return boolean
     */
    abstract protected function needsQuirk();

    /**
     * @visible for testing.
     * Cache the response to an HTTP request if it is cacheable.
     *
     * @param Google_Http_Request $request
     *
     * @return bool Returns true if the insertion was successful.
     * Otherwise, return false.
     */
    public function setCachedRequest(Google_Http_Request $request) {
        // Determine if the request is cacheable.
        if (Google_Http_CacheParser::isResponseCacheable($request)) {
            $this->client->getCache()
                         ->set($request->getCacheKey(), $request);

            return true;
        }

        return false;
    }

    /**
     * Execute an HTTP Request
     *
     * @param Google_HttpRequest $request the http request to be executed
     *
     * @return Google_HttpRequest http request with the response http code,
     * response headers and response body filled in
     * @throws Google_IO_Exception on curl or IO error
     */
    public function makeRequest(Google_Http_Request $request) {
        // First, check to see if we have a valid cached version.
        $cached = $this->getCachedRequest($request);
        if ($cached !== false && $cached instanceof Google_Http_Request) {
            if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
                return $cached;
            }
        }

        if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
            $request = $this->processEntityRequest($request);
        }

        list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);

        if ($respHttpCode == 304 && $cached) {
            // If the server responded NOT_MODIFIED, return the cached request.
            $this->updateCachedRequest($cached, $responseHeaders);

            return $cached;
        }

        if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
            $responseHeaders['date'] = date("r");
        }

        $request->setResponseHttpCode($respHttpCode);
        $request->setResponseHeaders($responseHeaders);
        $request->setResponseBody($responseData);
        // Store the request in cache (the function checks to see if the request
        // can actually be cached)
        $this->setCachedRequest($request);

        return $request;
    }

    /**
     * @visible for testing.
     *
     * @param Google_Http_Request $request
     *
     * @return Google_Http_Request|bool Returns the cached object or
     * false if the operation was unsuccessful.
     */
    public function getCachedRequest(Google_Http_Request $request) {
        if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
            return false;
        }

        return $this->client->getCache()
                            ->get($request->getCacheKey());
    }

    /**
     * @visible for testing
     * Process an http request that contains an enclosed entity.
     *
     * @param Google_Http_Request $request
     *
     * @return Google_Http_Request Processed request with the enclosed entity.
     */
    public function processEntityRequest(Google_Http_Request $request) {
        $postBody    = $request->getPostBody();
        $contentType = $request->getRequestHeader("content-type");

        // Set the default content-type as application/x-www-form-urlencoded.
        if (false == $contentType) {
            $contentType = self::FORM_URLENCODED;
            $request->setRequestHeaders(array('content-type' => $contentType));
        }

        // Force the payload to match the content-type asserted in the header.
        if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
            $postBody = http_build_query($postBody, '', '&');
            $request->setPostBody($postBody);
        }

        // Make sure the content-length header is set.
        if (!$postBody || is_string($postBody)) {
            $postsLength = strlen($postBody);
            $request->setRequestHeaders(array('content-length' => $postsLength));
        }

        return $request;
    }

    /**
     * Check if an already cached request must be revalidated, and if so update
     * the request with the correct ETag headers.
     *
     * @param Google_Http_Request $cached  A previously cached response.
     * @param Google_Http_Request $request The outbound request.
     *                                     return bool If the cached object needs to be revalidated, false if it is
     *                                     still current and can be re-used.
     */
    protected function checkMustRevalidateCachedRequest($cached, $request) {
        if (Google_Http_CacheParser::mustRevalidate($cached)) {
            $addHeaders = array();
            if ($cached->getResponseHeader('etag')) {
                // [13.3.4] If an entity tag has been provided by the origin server,
                // we must use that entity tag in any cache-conditional request.
                $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
            } elseif ($cached->getResponseHeader('date')) {
                $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
            }

            $request->setRequestHeaders($addHeaders);

            return true;
        } else {
            return false;
        }
    }

    /**
     * Update a cached request, using the headers from the last response.
     *
     * @param Google_HttpRequest $cached A previously cached response.
     * @param mixed   Associative array of response headers from the last request.
     */
    protected function updateCachedRequest($cached, $responseHeaders) {
        $hopByHop = self::$HOP_BY_HOP;
        if (!empty($responseHeaders['connection'])) {
            $connectionHeaders = array_map('strtolower', array_filter(array_map('trim', explode(',', $responseHeaders['connection']))));
            $hopByHop          += array_fill_keys($connectionHeaders, true);
        }

        $endToEnd = array_diff_key($responseHeaders, $hopByHop);
        $cached->setResponseHeaders($endToEnd);
    }

    /**
     * Used by the IO lib and also the batch processing.
     *
     * @param $respData
     * @param $headerSize
     *
     * @return array
     */
    public function parseHttpResponse($respData, $headerSize) {
        // check proxy header
        foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
            if (stripos($respData, $established_header) !== false) {
                // existed, remove it
                $respData = str_ireplace($established_header, '', $respData);
                // Subtract the proxy header size unless the cURL bug prior to 7.30.0
                // is present which prevented the proxy header size from being taken into
                // account.
                if (!$this->needsQuirk()) {
                    $headerSize -= strlen($established_header);
                }
                break;
            }
        }

        if ($headerSize) {
            $responseBody    = substr($respData, $headerSize);
            $responseHeaders = substr($respData, 0, $headerSize);
        } else {
            $responseSegments = explode("\r\n\r\n", $respData, 2);
            $responseHeaders  = $responseSegments[0];
            $responseBody     = isset($responseSegments[1]) ? $responseSegments[1] : null;
        }

        $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);

        return array(
            $responseHeaders,
            $responseBody
        );
    }

    /**
     * Parse out headers from raw headers
     *
     * @param rawHeaders array or string
     *
     * @return array
     */
    public function getHttpResponseHeaders($rawHeaders) {
        if (is_array($rawHeaders)) {
            return $this->parseArrayHeaders($rawHeaders);
        } else {
            return $this->parseStringHeaders($rawHeaders);
        }
    }

    private function parseStringHeaders($rawHeaders) {
        $headers             = array();
        $responseHeaderLines = explode("\r\n", $rawHeaders);
        foreach ($responseHeaderLines as $headerLine) {
            if ($headerLine && strpos($headerLine, ':') !== false) {
                list($header, $value) = explode(': ', $headerLine, 2);
                $header = strtolower($header);
                if (isset($headers[$header])) {
                    $headers[$header] .= "\n" . $value;
                } else {
                    $headers[$header] = $value;
                }
            }
        }

        return $headers;
    }

    private function parseArrayHeaders($rawHeaders) {
        $header_count = count($rawHeaders);
        $headers      = array();

        for ($i = 0; $i < $header_count; $i++) {
            $header = $rawHeaders[$i];
            // Times will have colons in - so we just want the first match.
            $header_parts = explode(': ', $header, 2);
            if (count($header_parts) == 2) {
                $headers[strtolower($header_parts[0])] = $header_parts[1];
            }
        }

        return $headers;
    }
}
Generator/Common/YouTube/googleclient/IO/Google_IO_Curl.php000064400000013003152355233130017600 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\IO;

use Nextend\Framework\Misc\HttpClient;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_Request;
use WP_HTTP_Proxy;

/**
 * Curl based implementation of Google_IO.
 *
 * @author Stuart Langley <slangley@google.com>
 */
class Google_IO_Curl extends Google_IO_Abstract {

    // cURL hex representation of version 7.30.0
    const NO_QUIRK_VERSION = 0x071E00;

    private $options = array();

    public function __construct(Google_Client $client) {
        if (!extension_loaded('curl')) {
            $error = 'The cURL IO handler requires the cURL extension to be enabled';
            $client->getLogger()
                   ->critical($error);
            throw new Google_IO_Exception($error);
        }

        parent::__construct($client);
    }

    /**
     * Execute an HTTP Request
     *
     * @param Google_HttpRequest $request the http request to be executed
     *
     * @return Google_HttpRequest http request with the response http code,
     * response headers and response body filled in
     * @throws Google_IO_Exception on curl or IO error
     */
    public function executeRequest(Google_Http_Request $request) {
        $curl = curl_init();

        if ($request->getPostBody()) {
            curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody());
        }

        $requestHeaders = $request->getRequestHeaders();
        if ($requestHeaders && is_array($requestHeaders)) {
            $curlHeaders = array();
            foreach ($requestHeaders as $k => $v) {
                $curlHeaders[] = "$k: $v";
            }
            curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
        }
        curl_setopt($curl, CURLOPT_URL, $request->getUrl());

        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
        curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent());

        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
        // 1 is CURL_SSLVERSION_TLSv1, which is not always defined in PHP.
        curl_setopt($curl, CURLOPT_SSLVERSION, 1);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, true);

        if ($request->canGzip()) {
            curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
        }

        foreach ($this->options as $key => $var) {
            curl_setopt($curl, $key, $var);
        }

        if (!isset($this->options[CURLOPT_CAINFO])) {
            curl_setopt($curl, CURLOPT_CAINFO, HttpClient::getCacertPath());
        }

        $this->client->getLogger()
                     ->debug('cURL request', array(
                         'url'     => $request->getUrl(),
                         'method'  => $request->getRequestMethod(),
                         'headers' => $requestHeaders,
                         'body'    => $request->getPostBody()
                     ));

        $response = curl_exec($curl);
        if ($response === false) {
            $error = curl_error($curl);
            $code  = curl_errno($curl);
            $map   = $this->client->getClassConfig('Google_IO_Exception', 'retry_map');

            $this->client->getLogger()
                         ->error('cURL ' . $error);
            throw new Google_IO_Exception($error, $code, null, $map);
        }
        $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

        list($responseHeaders, $responseBody) = $this->parseHttpResponse($response, $headerSize);
        $responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

        $this->client->getLogger()
                     ->debug('cURL response', array(
                         'code'    => $responseCode,
                         'headers' => $responseHeaders,
                         'body'    => $responseBody,
                     ));

        return array(
            $responseBody,
            $responseHeaders,
            $responseCode
        );
    }

    /**
     * Set options that update the transport implementation's behavior.
     *
     * @param $options
     */
    public function setOptions($options) {
        $this->options = $options + $this->options;
    }

    /**
     * Set the maximum request time in seconds.
     *
     * @param $timeout in seconds
     */
    public function setTimeout($timeout) {
        // Since this timeout is really for putting a bound on the time
        // we'll set them both to the same. If you need to specify a longer
        // CURLOPT_TIMEOUT, or a tigher CONNECTTIMEOUT, the best thing to
        // do is use the setOptions method for the values individually.
        $this->options[CURLOPT_CONNECTTIMEOUT] = $timeout;
        $this->options[CURLOPT_TIMEOUT]        = $timeout;
    }

    /**
     * Get the maximum request time in seconds.
     *
     * @return timeout in seconds
     */
    public function getTimeout() {
        return $this->options[CURLOPT_TIMEOUT];
    }

    /**
     * Test for the presence of a cURL header processing bug
     *
     * {@inheritDoc}
     *
     * @return boolean
     */
    protected function needsQuirk() {
        $ver        = curl_version();
        $versionNum = $ver['version_number'];

        return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;
    }
}
Generator/Common/YouTube/googleclient/IO/Google_IO_Exception.php000064400000002610152355233130020633 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\IO;


use Exception;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Exception;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Task\Google_Task_Retryable;

class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable {

    /**
     * @var array $retryMap Map of errors with retry counts.
     */
    private $retryMap = array();

    /**
     * Creates a new IO exception with an optional retry map.
     *
     * @param string         $message
     * @param int            $code
     * @param Exception|null $previous
     * @param array|null     $retryMap Map of errors with retry counts.
     */
    public function __construct($message, $code = 0, Exception $previous = null, array $retryMap = null) {
        parent::__construct($message, $code, $previous);

        if (is_array($retryMap)) {
            $this->retryMap = $retryMap;
        }
    }

    /**
     * Gets the number of times the associated task can be retried.
     *
     * NOTE: -1 is returned if the task can be retried indefinitely
     *
     * @return integer
     */
    public function allowedRetries() {
        if (isset($this->retryMap[$this->code])) {
            return $this->retryMap[$this->code];
        }

        return 0;
    }
}
Generator/Common/YouTube/googleclient/Service/Google_Service_Exception.php000064400000004641152355233130023023 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service;

use Exception;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Exception;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Task\Google_Task_Retryable;

class Google_Service_Exception extends Google_Exception implements Google_Task_Retryable {

    /**
     * Optional list of errors returned in a JSON body of an HTTP error response.
     */
    protected $errors = array();

    /**
     * @var array $retryMap Map of errors with retry counts.
     */
    private $retryMap = array();

    /**
     * Override default constructor to add the ability to set $errors and a retry
     * map.
     *
     * @param string         $message
     * @param int            $code
     * @param Exception|null $previous
     * @param [{string, string}] errors List of errors returned in an HTTP
     *                                  response.  Defaults to [].
     * @param array|null     $retryMap  Map of errors with retry counts.
     */
    public function __construct($message, $code = 0, Exception $previous = null, $errors = array(), array $retryMap = null) {
        parent::__construct($message, $code, $previous);

        $this->errors = $errors;

        if (is_array($retryMap)) {
            $this->retryMap = $retryMap;
        }
    }

    /**
     * An example of the possible errors returned.
     *
     * {
     *   "domain": "global",
     *   "reason": "authError",
     *   "message": "Invalid Credentials",
     *   "locationType": "header",
     *   "location": "Authorization",
     * }
     *
     * @return [{string, string}] List of errors return in an HTTP response or [].
     */
    public function getErrors() {
        return $this->errors;
    }

    /**
     * Gets the number of times the associated task can be retried.
     *
     * NOTE: -1 is returned if the task can be retried indefinitely
     *
     * @return integer
     */
    public function allowedRetries() {
        if (isset($this->retryMap[$this->code])) {
            return $this->retryMap[$this->code];
        }

        $errors = $this->getErrors();

        if (!empty($errors) && isset($errors[0]['reason']) && isset($this->retryMap[$errors[0]['reason']])) {
            return $this->retryMap[$errors[0]['reason']];
        }

        return 0;
    }
}
Generator/Common/YouTube/googleclient/Service/Google_Service_Resource.php000064400000022000152355233130022641 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_Request;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_REST;


/**
 * Implements the actual methods/resources of the discovered Google API using magic function
 * calling overloading (__call()), which on call will see if the method name (plus.activities.list)
 * is available in this service, and if so construct an apiHttpRequest representing it.
 *
 * @author Chris Chabot <chabotc@google.com>
 * @author Chirag Shah <chirags@google.com>
 *
 */
class Google_Service_Resource {

    // Valid query parameters that work, but don't appear in discovery.
    private $stackParameters = array(
        'alt'         => array(
            'type'     => 'string',
            'location' => 'query'
        ),
        'fields'      => array(
            'type'     => 'string',
            'location' => 'query'
        ),
        'trace'       => array(
            'type'     => 'string',
            'location' => 'query'
        ),
        'userIp'      => array(
            'type'     => 'string',
            'location' => 'query'
        ),
        'userip'      => array(
            'type'     => 'string',
            'location' => 'query'
        ),
        'quotaUser'   => array(
            'type'     => 'string',
            'location' => 'query'
        ),
        'data'        => array(
            'type'     => 'string',
            'location' => 'body'
        ),
        'mimeType'    => array(
            'type'     => 'string',
            'location' => 'header'
        ),
        'uploadType'  => array(
            'type'     => 'string',
            'location' => 'query'
        ),
        'mediaUpload' => array(
            'type'     => 'complex',
            'location' => 'query'
        ),
    );

    /** @var Google_Service $service */
    private $service;

    /** @var Google_Client $client */
    private $client;

    /** @var string $serviceName */
    private $serviceName;

    /** @var string $resourceName */
    private $resourceName;

    /** @var array $methods */
    private $methods;

    public function __construct($service, $serviceName, $resourceName, $resource) {
        $this->service      = $service;
        $this->client       = $service->getClient();
        $this->serviceName  = $serviceName;
        $this->resourceName = $resourceName;
        $this->methods      = isset($resource['methods']) ? $resource['methods'] : array($resourceName => $resource);
    }

    /**
     * TODO(ianbarber): This function needs simplifying.
     *
     * @param $name
     * @param $arguments
     * @param $expected_class - optional, the expected class name
     *
     * @return Google_Http_Request|expected_class
     * @throws Google_Exception
     */
    public function call($name, $arguments, $expected_class = null) {
        if (!isset($this->methods[$name])) {
            $this->client->getLogger()
                         ->error('Service method unknown', array(
                             'service'  => $this->serviceName,
                             'resource' => $this->resourceName,
                             'method'   => $name
                         ));

            throw new Google_Exception("Unknown function: " . "{$this->serviceName}->{$this->resourceName}->{$name}()");
        }
        $method     = $this->methods[$name];
        $parameters = $arguments[0];

        // postBody is a special case since it's not defined in the discovery
        // document as parameter, but we abuse the param entry for storing it.
        $postBody = null;
        if (isset($parameters['postBody'])) {
            if ($parameters['postBody'] instanceof Google_Model) {
                // In the cases the post body is an existing object, we want
                // to use the smart method to create a simple object for
                // for JSONification.
                $parameters['postBody'] = $parameters['postBody']->toSimpleObject();
            } else if (is_object($parameters['postBody'])) {
                // If the post body is another kind of object, we will try and
                // wrangle it into a sensible format.
                $parameters['postBody'] = $this->convertToArrayAndStripNulls($parameters['postBody']);
            }
            $postBody = json_encode($parameters['postBody']);
            unset($parameters['postBody']);
        }

        // TODO(ianbarber): optParams here probably should have been
        // handled already - this may well be redundant code.
        if (isset($parameters['optParams'])) {
            $optParams = $parameters['optParams'];
            unset($parameters['optParams']);
            $parameters = array_merge($parameters, $optParams);
        }

        if (!isset($method['parameters'])) {
            $method['parameters'] = array();
        }

        $method['parameters'] = array_merge($method['parameters'], $this->stackParameters);
        foreach ($parameters as $key => $val) {
            if ($key != 'postBody' && !isset($method['parameters'][$key])) {
                $this->client->getLogger()
                             ->error('Service parameter unknown', array(
                                 'service'   => $this->serviceName,
                                 'resource'  => $this->resourceName,
                                 'method'    => $name,
                                 'parameter' => $key
                             ));
                throw new Google_Exception("($name) unknown parameter: '$key'");
            }
        }

        foreach ($method['parameters'] as $paramName => $paramSpec) {
            if (isset($paramSpec['required']) && $paramSpec['required'] && !isset($parameters[$paramName])) {
                $this->client->getLogger()
                             ->error('Service parameter missing', array(
                                 'service'   => $this->serviceName,
                                 'resource'  => $this->resourceName,
                                 'method'    => $name,
                                 'parameter' => $paramName
                             ));
                throw new Google_Exception("($name) missing required param: '$paramName'");
            }
            if (isset($parameters[$paramName])) {
                $value                           = $parameters[$paramName];
                $parameters[$paramName]          = $paramSpec;
                $parameters[$paramName]['value'] = $value;
                unset($parameters[$paramName]['required']);
            } else {
                // Ensure we don't pass nulls.
                unset($parameters[$paramName]);
            }
        }

        $servicePath = $this->service->servicePath;

        $this->client->getLogger()
                     ->info('Service Call', array(
                         'service'   => $this->serviceName,
                         'resource'  => $this->resourceName,
                         'method'    => $name,
                         'arguments' => $parameters,
                     ));

        $url         = Google_Http_REST::createRequestUri($servicePath, $method['path'], $parameters);
        $httpRequest = new Google_Http_Request($url, $method['httpMethod'], null, $postBody);
        $httpRequest->setBaseComponent($this->client->getBasePath());

        if ($postBody) {
            $contentTypeHeader                 = array();
            $contentTypeHeader['content-type'] = 'application/json; charset=UTF-8';
            $httpRequest->setRequestHeaders($contentTypeHeader);
            $httpRequest->setPostBody($postBody);
        }

        $httpRequest = $this->client->getAuth()
                                    ->sign($httpRequest);
        $httpRequest->setExpectedClass($expected_class);

        if (isset($parameters['data']) && ($parameters['uploadType']['value'] == 'media' || $parameters['uploadType']['value'] == 'multipart')) {
            // If we are doing a simple media upload, trigger that as a convenience.
            $mfu = new Google_Http_MediaFileUpload($this->client, $httpRequest, isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream', $parameters['data']['value']);
        }

        if ($this->client->shouldDefer()) {
            // If we are in batch or upload mode, return the raw request.
            return $httpRequest;
        }

        return $this->client->execute($httpRequest);
    }

    protected function convertToArrayAndStripNulls($o) {
        $o = (array)$o;
        foreach ($o as $k => $v) {
            if ($v === null) {
                unset($o[$k]);
            } elseif (is_object($v) || is_array($v)) {
                $o[$k] = $this->convertToArrayAndStripNulls($o[$k]);
            }
        }

        return $o;
    }
}
Generator/Common/YouTube/googleclient/Service/Google_Service_YouTube.php000064400001272140152355233130022463 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Collection;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Model;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Service;

/**
 * Service definition for YouTube (v3).
 *
 * <p>
 * Programmatic access to YouTube features.</p>
 *
 * <p>
 * For more information about this service, see the API
 * <a href="https://developers.google.com/youtube/v3" target="_blank">Documentation</a>
 * </p>
 *
 * @author Google, Inc.
 */
class Google_Service_YouTube extends Google_Service {

    /** Manage your YouTube account. */
    const YOUTUBE = "https://www.googleapis.com/auth/youtube";
    /** View your YouTube account. */
    const YOUTUBE_READONLY = "https://www.googleapis.com/auth/youtube.readonly";
    /** Manage your YouTube videos. */
    const YOUTUBE_UPLOAD = "https://www.googleapis.com/auth/youtube.upload";
    /** View and manage your assets and associated content on YouTube. */
    const YOUTUBEPARTNER = "https://www.googleapis.com/auth/youtubepartner";
    /** View private information of your YouTube channel relevant during the audit process with a YouTube partner. */
    const YOUTUBEPARTNER_CHANNEL_AUDIT = "https://www.googleapis.com/auth/youtubepartner-channel-audit";

    public $activities;
    public $channelBanners;
    public $channelSections;
    public $channels;
    public $guideCategories;
    public $i18nLanguages;
    public $i18nRegions;
    public $liveBroadcasts;
    public $liveStreams;
    public $playlistItems;
    public $playlists;
    public $search;
    public $serviceName;
    public $subscriptions;
    public $thumbnails;
    public $videoCategories;
    public $videos;
    public $watermarks;


    /**
     * Constructs the internal representation of the YouTube service.
     *
     * @param Google_Client $client
     */
    public function __construct(Google_Client $client) {
        parent::__construct($client);
        $this->servicePath = 'youtube/v3/';
        $this->version     = 'v3';
        $this->serviceName = 'youtube';

        $this->activities      = new Google_Service_YouTube_Activities_Resource($this, $this->serviceName, 'activities', array(
            'methods' => array(
                'insert' => array(
                    'path'       => 'activities',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part' => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                    ),
                ),
                'list'   => array(
                    'path'       => 'activities',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'            => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'regionCode'      => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'publishedBefore' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'channelId'       => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mine'            => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'maxResults'      => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'pageToken'       => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'home'            => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'publishedAfter'  => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->channelBanners  = new Google_Service_YouTube_ChannelBanners_Resource($this, $this->serviceName, 'channelBanners', array(
            'methods' => array(
                'insert' => array(
                    'path'       => 'channelBanners/insert',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->channelSections = new Google_Service_YouTube_ChannelSections_Resource($this, $this->serviceName, 'channelSections', array(
            'methods' => array(
                'delete' => array(
                    'path'       => 'channelSections',
                    'httpMethod' => 'DELETE',
                    'parameters' => array(
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'insert' => array(
                    'path'       => 'channelSections',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'list'   => array(
                    'path'       => 'channelSections',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'channelId'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mine'                   => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                    ),
                ),
                'update' => array(
                    'path'       => 'channelSections',
                    'httpMethod' => 'PUT',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->channels        = new Google_Service_YouTube_Channels_Resource($this, $this->serviceName, 'channels', array(
            'methods' => array(
                'list'   => array(
                    'path'       => 'channels',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'managedByMe'            => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'forUsername'            => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mine'                   => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'maxResults'             => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'pageToken'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mySubscribers'          => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'categoryId'             => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'update' => array(
                    'path'       => 'channels',
                    'httpMethod' => 'PUT',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->guideCategories = new Google_Service_YouTube_GuideCategories_Resource($this, $this->serviceName, 'guideCategories', array(
            'methods' => array(
                'list' => array(
                    'path'       => 'guideCategories',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'       => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'regionCode' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'hl'         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->i18nLanguages   = new Google_Service_YouTube_I18nLanguages_Resource($this, $this->serviceName, 'i18nLanguages', array(
            'methods' => array(
                'list' => array(
                    'path'       => 'i18nLanguages',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part' => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'hl'   => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->i18nRegions     = new Google_Service_YouTube_I18nRegions_Resource($this, $this->serviceName, 'i18nRegions', array(
            'methods' => array(
                'list' => array(
                    'path'       => 'i18nRegions',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part' => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'hl'   => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->liveBroadcasts  = new Google_Service_YouTube_LiveBroadcasts_Resource($this, $this->serviceName, 'liveBroadcasts', array(
            'methods' => array(
                'bind'       => array(
                    'path'       => 'liveBroadcasts/bind',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'streamId'                      => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'control'    => array(
                    'path'       => 'liveBroadcasts/control',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'displaySlate'                  => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'offsetTimeMs'                  => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'walltime'                      => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'delete'     => array(
                    'path'       => 'liveBroadcasts',
                    'httpMethod' => 'DELETE',
                    'parameters' => array(
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'insert'     => array(
                    'path'       => 'liveBroadcasts',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'list'       => array(
                    'path'       => 'liveBroadcasts',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'broadcastStatus'               => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mine'                          => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'maxResults'                    => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'pageToken'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'transition' => array(
                    'path'       => 'liveBroadcasts/transition',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'broadcastStatus'               => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'update'     => array(
                    'path'       => 'liveBroadcasts',
                    'httpMethod' => 'PUT',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->liveStreams     = new Google_Service_YouTube_LiveStreams_Resource($this, $this->serviceName, 'liveStreams', array(
            'methods' => array(
                'delete' => array(
                    'path'       => 'liveStreams',
                    'httpMethod' => 'DELETE',
                    'parameters' => array(
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'insert' => array(
                    'path'       => 'liveStreams',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'list'   => array(
                    'path'       => 'liveStreams',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mine'                          => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'maxResults'                    => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'pageToken'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'update' => array(
                    'path'       => 'liveStreams',
                    'httpMethod' => 'PUT',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->playlistItems   = new Google_Service_YouTube_PlaylistItems_Resource($this, $this->serviceName, 'playlistItems', array(
            'methods' => array(
                'delete' => array(
                    'path'       => 'playlistItems',
                    'httpMethod' => 'DELETE',
                    'parameters' => array(
                        'id' => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                    ),
                ),
                'insert' => array(
                    'path'       => 'playlistItems',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'list'   => array(
                    'path'       => 'playlistItems',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'playlistId'             => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoId'                => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'maxResults'             => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'pageToken'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'update' => array(
                    'path'       => 'playlistItems',
                    'httpMethod' => 'PUT',
                    'parameters' => array(
                        'part' => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                    ),
                ),
            )
        ));
        $this->playlists       = new Google_Service_YouTube_Playlists_Resource($this, $this->serviceName, 'playlists', array(
            'methods' => array(
                'delete' => array(
                    'path'       => 'playlists',
                    'httpMethod' => 'DELETE',
                    'parameters' => array(
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'insert' => array(
                    'path'       => 'playlists',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'list'   => array(
                    'path'       => 'playlists',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'channelId'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mine'                          => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'maxResults'                    => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'pageToken'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'update' => array(
                    'path'       => 'playlists',
                    'httpMethod' => 'PUT',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->search          = new Google_Service_YouTube_Search_Resource($this, $this->serviceName, 'search', array(
            'methods' => array(
                'list' => array(
                    'path'       => 'search',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'eventType'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'channelId'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoSyndicated'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'channelType'            => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoCaption'           => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'publishedAfter'         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'pageToken'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'forContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'regionCode'             => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'location'               => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'locationRadius'         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoType'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'type'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'topicId'                => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'publishedBefore'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoDimension'         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoLicense'           => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'maxResults'             => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'relatedToVideoId'       => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoDefinition'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoDuration'          => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'forMine'                => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'q'                      => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'safeSearch'             => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoEmbeddable'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoCategoryId'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'order'                  => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->subscriptions   = new Google_Service_YouTube_Subscriptions_Resource($this, $this->serviceName, 'subscriptions', array(
            'methods' => array(
                'delete' => array(
                    'path'       => 'subscriptions',
                    'httpMethod' => 'DELETE',
                    'parameters' => array(
                        'id' => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                    ),
                ),
                'insert' => array(
                    'path'       => 'subscriptions',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part' => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                    ),
                ),
                'list'   => array(
                    'path'       => 'subscriptions',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'channelId'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mine'                          => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'maxResults'                    => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'forChannelId'                  => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'pageToken'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'mySubscribers'                 => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'order'                         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'                            => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->thumbnails      = new Google_Service_YouTube_Thumbnails_Resource($this, $this->serviceName, 'thumbnails', array(
            'methods' => array(
                'set' => array(
                    'path'       => 'thumbnails/set',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'videoId'                => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->videoCategories = new Google_Service_YouTube_VideoCategories_Resource($this, $this->serviceName, 'videoCategories', array(
            'methods' => array(
                'list' => array(
                    'path'       => 'videoCategories',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'       => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'regionCode' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'hl'         => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->videos          = new Google_Service_YouTube_Videos_Resource($this, $this->serviceName, 'videos', array(
            'methods' => array(
                'delete'    => array(
                    'path'       => 'videos',
                    'httpMethod' => 'DELETE',
                    'parameters' => array(
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'getRating' => array(
                    'path'       => 'videos/getRating',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'insert'    => array(
                    'path'       => 'videos',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'part'                          => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'stabilize'                     => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'onBehalfOfContentOwnerChannel' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'notifySubscribers'             => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                        'autoLevels'                    => array(
                            'location' => 'query',
                            'type'     => 'boolean',
                        ),
                    ),
                ),
                'list'      => array(
                    'path'       => 'videos',
                    'httpMethod' => 'GET',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'regionCode'             => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'locale'                 => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'videoCategoryId'        => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'chart'                  => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'maxResults'             => array(
                            'location' => 'query',
                            'type'     => 'integer',
                        ),
                        'pageToken'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'myRating'               => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'rate'      => array(
                    'path'       => 'videos/rate',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'id'                     => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'rating'                 => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'update'    => array(
                    'path'       => 'videos',
                    'httpMethod' => 'PUT',
                    'parameters' => array(
                        'part'                   => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
        $this->watermarks      = new Google_Service_YouTube_Watermarks_Resource($this, $this->serviceName, 'watermarks', array(
            'methods' => array(
                'set'   => array(
                    'path'       => 'watermarks/set',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'channelId'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
                'unset' => array(
                    'path'       => 'watermarks/unset',
                    'httpMethod' => 'POST',
                    'parameters' => array(
                        'channelId'              => array(
                            'location' => 'query',
                            'type'     => 'string',
                            'required' => true,
                        ),
                        'onBehalfOfContentOwner' => array(
                            'location' => 'query',
                            'type'     => 'string',
                        ),
                    ),
                ),
            )
        ));
    }
}


/**
 * The "activities" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $activities = $youtubeService->activities;
 *  </code>
 */
class Google_Service_YouTube_Activities_Resource extends Google_Service_Resource {

    /**
     * Posts a bulletin for a specific channel. (The user submitting the request
     * must be authorized to act on the channel's behalf.)
     *
     * Note: Even though an activity resource can contain information about actions
     * like a user rating a video or marking a video as a favorite, you need to use
     * other API methods to generate those activity resources. For example, you
     * would use the API's videos.rate() method to rate a video and the
     * playlistItems.insert() method to mark a video as a favorite.
     * (activities.insert)
     *
     * @param string          $part      The part parameter serves two purposes in this operation.
     *                                   It identifies the properties that the write operation will set as well as the
     *                                   properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet and
     * contentDetails.
     * @param Google_Activity $postBody
     * @param array           $optParams Optional parameters.
     *
     * @return Google_Service_YouTube_Activity
     */
    public function insert($part, Google_Service_YouTube_Activity $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_Activity::class);
    }

    /**
     * Returns a list of channel activity events that match the request criteria.
     * For example, you can retrieve events associated with a particular channel,
     * events associated with the user's subscriptions and Google+ friends, or the
     * YouTube home page feed, which is customized for each user.
     * (activities.listActivities)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more activity resource properties that the API response will include.
     *                          The part names that you can include in the parameter value are id, snippet,
     *                          and contentDetails.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a activity
     * resource, the snippet property contains other properties that identify the
     * type of activity, a display title for the activity, and so forth. If you set
     * part=snippet, the API response will also contain all of those nested
     * properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string regionCode The regionCode parameter instructs the API to
     * return results for the specified country. The parameter value is an ISO
     * 3166-1 alpha-2 country code. YouTube uses this value when the authorized
     * user's previous activity on YouTube does not provide enough information to
     * generate the activity feed.
     * @opt_param string publishedBefore The publishedBefore parameter specifies the
     * date and time before which an activity must have occurred for that activity
     * to be included in the API response. If the parameter value specifies a day,
     * but not a time, then any activities that occurred that day will be excluded
     * from the result set. The value is specified in ISO 8601 (YYYY-MM-
     * DDThh:mm:ss.sZ) format.
     * @opt_param string channelId The channelId parameter specifies a unique
     * YouTube channel ID. The API will then return a list of that channel's
     * activities.
     * @opt_param bool mine Set this parameter's value to true to retrieve a feed of
     * the authenticated user's activities.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param bool home Set this parameter's value to true to retrieve the
     * activity feed that displays on the YouTube home page for the currently
     * authenticated user.
     * @opt_param string publishedAfter The publishedAfter parameter specifies the
     * earliest date and time that an activity could have occurred for that activity
     * to be included in the API response. If the parameter value specifies a day,
     * but not a time, then any activities that occurred that day will be included
     * in the result set. The value is specified in ISO 8601 (YYYY-MM-
     * DDThh:mm:ss.sZ) format.
     * @return Google_Service_YouTube_ActivityListResponse
     */
    public function listActivities($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_ActivityListResponse::class);
    }
}

/**
 * The "channelBanners" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $channelBanners = $youtubeService->channelBanners;
 *  </code>
 */
class Google_Service_YouTube_ChannelBanners_Resource extends Google_Service_Resource {

    /**
     * Uploads a channel banner image to YouTube. This method represents the first
     * two steps in a three-step process to update the banner image for a channel:
     *
     * - Call the channelBanners.insert method to upload the binary image data to
     * YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192
     * pixels. - Extract the url property's value from the response that the API
     * returns for step 1. - Call the channels.update method to update the channel's
     * branding settings. Set the brandingSettings.image.bannerExternalUrl
     * property's value to the URL obtained in step 2. (channelBanners.insert)
     *
     * @param Google_ChannelBannerResource $postBody
     * @param array                        $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_ChannelBannerResource
     */
    public function insert(Google_Service_YouTube_ChannelBannerResource $postBody, $optParams = array()) {
        $params = array('postBody' => $postBody);
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_ChannelBannerResource::class);
    }
}

/**
 * The "channelSections" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $channelSections = $youtubeService->channelSections;
 *  </code>
 */
class Google_Service_YouTube_ChannelSections_Resource extends Google_Service_Resource {

    /**
     * Deletes a channelSection. (channelSections.delete)
     *
     * @param string $id        The id parameter specifies the YouTube channelSection ID
     *                          for the resource that is being deleted. In a channelSection resource, the id
     *                          property specifies the YouTube channelSection ID.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     */
    public function delete($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('delete', array($params));
    }

    /**
     * Adds a channelSection for the authenticated user's channel.
     * (channelSections.insert)
     *
     * @param string                $part      The part parameter serves two purposes in this operation.
     *                                         It identifies the properties that the write operation will set as well
     *                                         as the properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet and
     * contentDetails.
     * @param Google_ChannelSection $postBody
     * @param array                 $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_ChannelSection
     */
    public function insert($part, Google_Service_YouTube_ChannelSection $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_ChannelSection::class);
    }

    /**
     * Returns channelSection resources that match the API request criteria.
     * (channelSections.listChannelSections)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more channelSection resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id,
     *                          snippet, and contentDetails.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a
     * channelSection resource, the snippet property contains other properties, such
     * as a display title for the channelSection. If you set part=snippet, the API
     * response will also contain all of those nested properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string channelId The channelId parameter specifies a YouTube
     * channel ID. The API will only return that channel's channelSections.
     * @opt_param string id The id parameter specifies a comma-separated list of the
     * YouTube channelSection ID(s) for the resource(s) that are being retrieved. In
     * a channelSection resource, the id property specifies the YouTube
     * channelSection ID.
     * @opt_param bool mine Set this parameter's value to true to retrieve a feed of
     * the authenticated user's channelSections.
     * @return Google_Service_YouTube_ChannelSectionListResponse
     */
    public function listChannelSections($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_ChannelSectionListResponse::class);
    }

    /**
     * Update a channelSection. (channelSections.update)
     *
     * @param string                $part      The part parameter serves two purposes in this operation.
     *                                         It identifies the properties that the write operation will set as well
     *                                         as the properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet and
     * contentDetails.
     * @param Google_ChannelSection $postBody
     * @param array                 $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_ChannelSection
     */
    public function update($part, Google_Service_YouTube_ChannelSection $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('update', array($params), Google_Service_YouTube_ChannelSection::class);
    }
}

/**
 * The "channels" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $channels = $youtubeService->channels;
 *  </code>
 */
class Google_Service_YouTube_Channels_Resource extends Google_Service_Resource {

    /**
     * Returns a collection of zero or more channel resources that match the request
     * criteria. (channels.listChannels)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more channel resource properties that the API response will include.
     *                          The part names that you can include in the parameter value are id, snippet,
     *                          contentDetails, statistics, topicDetails, and invideoPromotion.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a channel
     * resource, the contentDetails property contains other properties, such as the
     * uploads properties. As such, if you set part=contentDetails, the API response
     * will also contain all of those nested properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param bool managedByMe Set this parameter's value to true to instruct
     * the API to only return channels managed by the content owner that the
     * onBehalfOfContentOwner parameter specifies. The user must be authenticated as
     * a CMS account linked to the specified content owner and
     * onBehalfOfContentOwner must be provided.
     * @opt_param string onBehalfOfContentOwner The onBehalfOfContentOwner parameter
     * indicates that the authenticated user is acting on behalf of the content
     * owner specified in the parameter value. This parameter is intended for
     * YouTube content partners that own and manage many different YouTube channels.
     * It allows content owners to authenticate once and get access to all their
     * video and channel data, without having to provide authentication credentials
     * for each individual channel. The actual CMS account that the user
     * authenticates with needs to be linked to the specified YouTube content owner.
     * @opt_param string forUsername The forUsername parameter specifies a YouTube
     * username, thereby requesting the channel associated with that username.
     * @opt_param bool mine Set this parameter's value to true to instruct the API
     * to only return channels owned by the authenticated user.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     * @opt_param string id The id parameter specifies a comma-separated list of the
     * YouTube channel ID(s) for the resource(s) that are being retrieved. In a
     * channel resource, the id property specifies the channel's YouTube channel ID.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param bool mySubscribers Set this parameter's value to true to retrieve
     * a list of channels that subscribed to the authenticated user's channel.
     * @opt_param string categoryId The categoryId parameter specifies a YouTube
     * guide category, thereby requesting YouTube channels associated with that
     * category.
     * @return Google_Service_YouTube_ChannelListResponse
     */
    public function listChannels($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_ChannelListResponse::class);
    }

    /**
     * Updates a channel's metadata. (channels.update)
     *
     * @param string         $part      The part parameter serves two purposes in this operation.
     *                                  It identifies the properties that the write operation will set as well as the
     *                                  properties that the API response will include.
     *
     * The part names that you can include in the parameter value are id and
     * invideoPromotion.
     *
     * Note that this method will override the existing values for all of the
     * mutable properties that are contained in any parts that the parameter value
     * specifies.
     * @param Google_Channel $postBody
     * @param array          $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner The onBehalfOfContentOwner parameter
     * indicates that the authenticated user is acting on behalf of the content
     * owner specified in the parameter value. This parameter is intended for
     * YouTube content partners that own and manage many different YouTube channels.
     * It allows content owners to authenticate once and get access to all their
     * video and channel data, without having to provide authentication credentials
     * for each individual channel. The actual CMS account that the user
     * authenticates with needs to be linked to the specified YouTube content owner.
     * @return Google_Service_YouTube_Channel
     */
    public function update($part, Google_Service_YouTube_Channel $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('update', array($params), Google_Service_YouTube_Channel::class);
    }
}

/**
 * The "guideCategories" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $guideCategories = $youtubeService->guideCategories;
 *  </code>
 */
class Google_Service_YouTube_GuideCategories_Resource extends Google_Service_Resource {

    /**
     * Returns a list of categories that can be associated with YouTube channels.
     * (guideCategories.listGuideCategories)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more guideCategory resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id
     *                          and snippet.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a
     * guideCategory resource, the snippet property contains other properties, such
     * as the category's title. If you set part=snippet, the API response will also
     * contain all of those nested properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string regionCode The regionCode parameter instructs the API to
     * return the list of guide categories available in the specified country. The
     * parameter value is an ISO 3166-1 alpha-2 country code.
     * @opt_param string id The id parameter specifies a comma-separated list of the
     * YouTube channel category ID(s) for the resource(s) that are being retrieved.
     * In a guideCategory resource, the id property specifies the YouTube channel
     * category ID.
     * @opt_param string hl The hl parameter specifies the language that will be
     * used for text values in the API response.
     * @return Google_Service_YouTube_GuideCategoryListResponse
     */
    public function listGuideCategories($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_GuideCategoryListResponse::class);
    }
}

/**
 * The "i18nLanguages" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $i18nLanguages = $youtubeService->i18nLanguages;
 *  </code>
 */
class Google_Service_YouTube_I18nLanguages_Resource extends Google_Service_Resource {

    /**
     * Returns a list of supported languages. (i18nLanguages.listI18nLanguages)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more i18nLanguage resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id
     *                          and snippet.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string hl The hl parameter specifies the language that should be
     * used for text values in the API response.
     * @return Google_Service_YouTube_I18nLanguageListResponse
     */
    public function listI18nLanguages($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_I18nLanguageListResponse::class);
    }
}

/**
 * The "i18nRegions" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $i18nRegions = $youtubeService->i18nRegions;
 *  </code>
 */
class Google_Service_YouTube_I18nRegions_Resource extends Google_Service_Resource {

    /**
     * Returns a list of supported regions. (i18nRegions.listI18nRegions)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more i18nRegion resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id
     *                          and snippet.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string hl The hl parameter specifies the language that should be
     * used for text values in the API response.
     * @return Google_Service_YouTube_I18nRegionListResponse
     */
    public function listI18nRegions($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_I18nRegionListResponse::class);
    }
}

/**
 * The "liveBroadcasts" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $liveBroadcasts = $youtubeService->liveBroadcasts;
 *  </code>
 */
class Google_Service_YouTube_LiveBroadcasts_Resource extends Google_Service_Resource {

    /**
     * Binds a YouTube broadcast to a stream or removes an existing binding between
     * a broadcast and a stream. A broadcast can only be bound to one video stream.
     * (liveBroadcasts.bind)
     *
     * @param string $id        The id parameter specifies the unique ID of the broadcast
     *                          that is being bound to a video stream.
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more liveBroadcast resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id,
     *                          snippet, contentDetails, and status.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string streamId The streamId parameter specifies the unique ID of
     * the video stream that is being bound to a broadcast. If this parameter is
     * omitted, the API will remove any existing binding between the broadcast and a
     * video stream.
     * @return Google_Service_YouTube_LiveBroadcast
     */
    public function bind($id, $part, $optParams = array()) {
        $params = array(
            'id'   => $id,
            'part' => $part
        );
        $params = array_merge($params, $optParams);

        return $this->call('bind', array($params), Google_Service_YouTube_LiveBroadcast::class);
    }

    /**
     * Controls the settings for a slate that can be displayed in the broadcast
     * stream. (liveBroadcasts.control)
     *
     * @param string $id        The id parameter specifies the YouTube live broadcast ID
     *                          that uniquely identifies the broadcast in which the slate is being updated.
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more liveBroadcast resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id,
     *                          snippet, contentDetails, and status.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param bool displaySlate The displaySlate parameter specifies whether the
     * slate is being enabled or disabled.
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string offsetTimeMs The offsetTimeMs parameter specifies a
     * positive time offset when the specified slate change will occur. The value is
     * measured in milliseconds from the beginning of the broadcast's monitor
     * stream, which is the time that the testing phase for the broadcast began.
     * Even though it is specified in milliseconds, the value is actually an
     * approximation, and YouTube completes the requested action as closely as
     * possible to that time.
     *
     * If you do not specify a value for this parameter, then YouTube performs the
     * action as soon as possible. See the Getting started guide for more details.
     *
     * Important: You should only specify a value for this parameter if your
     * broadcast stream is delayed.
     * @opt_param string walltime The walltime parameter specifies the wall clock
     * time at which the specified slate change will occur. The value is specified
     * in ISO 8601 (YYYY-MM-DDThh:mm:ss.sssZ) format.
     * @return Google_Service_YouTube_LiveBroadcast
     */
    public function control($id, $part, $optParams = array()) {
        $params = array(
            'id'   => $id,
            'part' => $part
        );
        $params = array_merge($params, $optParams);

        return $this->call('control', array($params), Google_Service_YouTube_LiveBroadcast::class);
    }

    /**
     * Deletes a broadcast. (liveBroadcasts.delete)
     *
     * @param string $id        The id parameter specifies the YouTube live broadcast ID
     *                          for the resource that is being deleted.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     */
    public function delete($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('delete', array($params));
    }

    /**
     * Creates a broadcast. (liveBroadcasts.insert)
     *
     * @param string               $part      The part parameter serves two purposes in this operation.
     *                                        It identifies the properties that the write operation will set as well as
     *                                        the properties that the API response will include.
     *
     * The part properties that you can include in the parameter value are id,
     * snippet, contentDetails, and status.
     * @param Google_LiveBroadcast $postBody
     * @param array                $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_LiveBroadcast
     */
    public function insert($part, Google_Service_YouTube_LiveBroadcast $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_LiveBroadcast::class);
    }

    /**
     * Returns a list of YouTube broadcasts that match the API request parameters.
     * (liveBroadcasts.listLiveBroadcasts)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more liveBroadcast resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id,
     *                          snippet, contentDetails, and status.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string broadcastStatus The broadcastStatus parameter filters the
     * API response to only include broadcasts with the specified status.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param bool mine The mine parameter can be used to instruct the API to
     * only return broadcasts owned by the authenticated user. Set the parameter
     * value to true to only retrieve your own broadcasts.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param string id The id parameter specifies a comma-separated list of
     * YouTube broadcast IDs that identify the broadcasts being retrieved. In a
     * liveBroadcast resource, the id property specifies the broadcast's ID.
     * @return Google_Service_YouTube_LiveBroadcastListResponse
     */
    public function listLiveBroadcasts($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_LiveBroadcastListResponse::class);
    }

    /**
     * Changes the status of a YouTube live broadcast and initiates any processes
     * associated with the new status. For example, when you transition a
     * broadcast's status to testing, YouTube starts to transmit video to that
     * broadcast's monitor stream. Before calling this method, you should confirm
     * that the value of the status.streamStatus property for the stream bound to
     * your broadcast is active. (liveBroadcasts.transition)
     *
     * @param string $broadcastStatus The broadcastStatus parameter identifies the
     *                                state to which the broadcast is changing. Note that to transition a broadcast
     *                                to either the testing or live state, the status.streamStatus must be active
     *                                for the stream that the broadcast is bound to.
     * @param string $id              The id parameter specifies the unique ID of the broadcast
     *                                that is transitioning to another status.
     * @param string $part            The part parameter specifies a comma-separated list of
     *                                one or more liveBroadcast resource properties that the API response will
     *                                include. The part names that you can include in the parameter value are id,
     *                                snippet, contentDetails, and status.
     * @param array  $optParams       Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_LiveBroadcast
     */
    public function transition($broadcastStatus, $id, $part, $optParams = array()) {
        $params = array(
            'broadcastStatus' => $broadcastStatus,
            'id'              => $id,
            'part'            => $part
        );
        $params = array_merge($params, $optParams);

        return $this->call('transition', array($params), Google_Service_YouTube_LiveBroadcast::class);
    }

    /**
     * Updates a broadcast. For example, you could modify the broadcast settings
     * defined in the liveBroadcast resource's contentDetails object.
     * (liveBroadcasts.update)
     *
     * @param string               $part      The part parameter serves two purposes in this operation.
     *                                        It identifies the properties that the write operation will set as well as
     *                                        the properties that the API response will include.
     *
     * The part properties that you can include in the parameter value are id,
     * snippet, contentDetails, and status.
     *
     * Note that this method will override the existing values for all of the
     * mutable properties that are contained in any parts that the parameter value
     * specifies. For example, a broadcast's privacy status is defined in the status
     * part. As such, if your request is updating a private or unlisted broadcast,
     * and the request's part parameter value includes the status part, the
     * broadcast's privacy setting will be updated to whatever value the request
     * body specifies. If the request body does not specify a value, the existing
     * privacy setting will be removed and the broadcast will revert to the default
     * privacy setting.
     * @param Google_LiveBroadcast $postBody
     * @param array                $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_LiveBroadcast
     */
    public function update($part, Google_Service_YouTube_LiveBroadcast $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('update', array($params), Google_Service_YouTube_LiveBroadcast::class);
    }
}

/**
 * The "liveStreams" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $liveStreams = $youtubeService->liveStreams;
 *  </code>
 */
class Google_Service_YouTube_LiveStreams_Resource extends Google_Service_Resource {

    /**
     * Deletes a video stream. (liveStreams.delete)
     *
     * @param string $id        The id parameter specifies the YouTube live stream ID for
     *                          the resource that is being deleted.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     */
    public function delete($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('delete', array($params));
    }

    /**
     * Creates a video stream. The stream enables you to send your video to YouTube,
     * which can then broadcast the video to your audience. (liveStreams.insert)
     *
     * @param string            $part      The part parameter serves two purposes in this operation.
     *                                     It identifies the properties that the write operation will set as well as the
     *                                     properties that the API response will include.
     *
     * The part properties that you can include in the parameter value are id,
     * snippet, cdn, and status.
     * @param Google_LiveStream $postBody
     * @param array             $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_LiveStream
     */
    public function insert($part, Google_Service_YouTube_LiveStream $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_LiveStream::class);
    }

    /**
     * Returns a list of video streams that match the API request parameters.
     * (liveStreams.listLiveStreams)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more liveStream resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id,
     *                          snippet, cdn, and status.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param bool mine The mine parameter can be used to instruct the API to
     * only return streams owned by the authenticated user. Set the parameter value
     * to true to only retrieve your own streams.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set. Acceptable values
     * are 0 to 50, inclusive. The default value is 5.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param string id The id parameter specifies a comma-separated list of
     * YouTube stream IDs that identify the streams being retrieved. In a liveStream
     * resource, the id property specifies the stream's ID.
     * @return Google_Service_YouTube_LiveStreamListResponse
     */
    public function listLiveStreams($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_LiveStreamListResponse::class);
    }

    /**
     * Updates a video stream. If the properties that you want to change cannot be
     * updated, then you need to create a new stream with the proper settings.
     * (liveStreams.update)
     *
     * @param string            $part      The part parameter serves two purposes in this operation.
     *                                     It identifies the properties that the write operation will set as well as the
     *                                     properties that the API response will include.
     *
     * The part properties that you can include in the parameter value are id,
     * snippet, cdn, and status.
     *
     * Note that this method will override the existing values for all of the
     * mutable properties that are contained in any parts that the parameter value
     * specifies. If the request body does not specify a value for a mutable
     * property, the existing value for that property will be removed.
     * @param Google_LiveStream $postBody
     * @param array             $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_LiveStream
     */
    public function update($part, Google_Service_YouTube_LiveStream $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('update', array($params), Google_Service_YouTube_LiveStream::class);
    }
}

/**
 * The "playlistItems" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $playlistItems = $youtubeService->playlistItems;
 *  </code>
 */
class Google_Service_YouTube_PlaylistItems_Resource extends Google_Service_Resource {

    /**
     * Deletes a playlist item. (playlistItems.delete)
     *
     * @param string $id        The id parameter specifies the YouTube playlist item ID for
     *                          the playlist item that is being deleted. In a playlistItem resource, the id
     *                          property specifies the playlist item's ID.
     * @param array  $optParams Optional parameters.
     */
    public function delete($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('delete', array($params));
    }

    /**
     * Adds a resource to a playlist. (playlistItems.insert)
     *
     * @param string              $part      The part parameter serves two purposes in this operation.
     *                                       It identifies the properties that the write operation will set as well as
     *                                       the properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet,
     * contentDetails, and status.
     * @param Google_PlaylistItem $postBody
     * @param array               $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_PlaylistItem
     */
    public function insert($part, Google_Service_YouTube_PlaylistItem $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_PlaylistItem::class);
    }

    /**
     * Returns a collection of playlist items that match the API request parameters.
     * You can retrieve all of the playlist items in a specified playlist or
     * retrieve one or more playlist items by their unique IDs.
     * (playlistItems.listPlaylistItems)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more playlistItem resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id,
     *                          snippet, contentDetails, and status.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a
     * playlistItem resource, the snippet property contains numerous fields,
     * including the title, description, position, and resourceId properties. As
     * such, if you set part=snippet, the API response will contain all of those
     * properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string playlistId The playlistId parameter specifies the unique ID
     * of the playlist for which you want to retrieve playlist items. Note that even
     * though this is an optional parameter, every request to retrieve playlist
     * items must specify a value for either the id parameter or the playlistId
     * parameter.
     * @opt_param string videoId The videoId parameter specifies that the request
     * should return only the playlist items that contain the specified video.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param string id The id parameter specifies a comma-separated list of one
     * or more unique playlist item IDs.
     * @return Google_Service_YouTube_PlaylistItemListResponse
     */
    public function listPlaylistItems($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_PlaylistItemListResponse::class);
    }

    /**
     * Modifies a playlist item. For example, you could update the item's position
     * in the playlist. (playlistItems.update)
     *
     * @param string              $part      The part parameter serves two purposes in this operation.
     *                                       It identifies the properties that the write operation will set as well as
     *                                       the properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet,
     * contentDetails, and status.
     *
     * Note that this method will override the existing values for all of the
     * mutable properties that are contained in any parts that the parameter value
     * specifies. For example, a playlist item can specify a start time and end
     * time, which identify the times portion of the video that should play when
     * users watch the video in the playlist. If your request is updating a playlist
     * item that sets these values, and the request's part parameter value includes
     * the contentDetails part, the playlist item's start and end times will be
     * updated to whatever value the request body specifies. If the request body
     * does not specify values, the existing start and end times will be removed and
     * replaced with the default settings.
     * @param Google_PlaylistItem $postBody
     * @param array               $optParams Optional parameters.
     *
     * @return Google_Service_YouTube_PlaylistItem
     */
    public function update($part, Google_Service_YouTube_PlaylistItem $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('update', array($params), Google_Service_YouTube_PlaylistItem::class);
    }
}

/**
 * The "playlists" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $playlists = $youtubeService->playlists;
 *  </code>
 */
class Google_Service_YouTube_Playlists_Resource extends Google_Service_Resource {

    /**
     * Deletes a playlist. (playlists.delete)
     *
     * @param string $id        The id parameter specifies the YouTube playlist ID for the
     *                          playlist that is being deleted. In a playlist resource, the id property
     *                          specifies the playlist's ID.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     */
    public function delete($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('delete', array($params));
    }

    /**
     * Creates a playlist. (playlists.insert)
     *
     * @param string          $part      The part parameter serves two purposes in this operation.
     *                                   It identifies the properties that the write operation will set as well as the
     *                                   properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet and
     * status.
     * @param Google_Playlist $postBody
     * @param array           $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_Playlist
     */
    public function insert($part, Google_Service_YouTube_Playlist $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_Playlist::class);
    }

    /**
     * Returns a collection of playlists that match the API request parameters. For
     * example, you can retrieve all playlists that the authenticated user owns, or
     * you can retrieve one or more playlists by their unique IDs.
     * (playlists.listPlaylists)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more playlist resource properties that the API response will include.
     *                          The part names that you can include in the parameter value are id, snippet,
     *                          status, and contentDetails.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a playlist
     * resource, the snippet property contains properties like author, title,
     * description, tags, and timeCreated. As such, if you set part=snippet, the API
     * response will contain all of those properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string channelId This value indicates that the API should only
     * return the specified channel's playlists.
     * @opt_param bool mine Set this parameter's value to true to instruct the API
     * to only return playlists owned by the authenticated user.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param string id The id parameter specifies a comma-separated list of the
     * YouTube playlist ID(s) for the resource(s) that are being retrieved. In a
     * playlist resource, the id property specifies the playlist's YouTube playlist
     * ID.
     * @return Google_Service_YouTube_PlaylistListResponse
     */
    public function listPlaylists($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_PlaylistListResponse::class);
    }

    /**
     * Modifies a playlist. For example, you could change a playlist's title,
     * description, or privacy status. (playlists.update)
     *
     * @param string          $part      The part parameter serves two purposes in this operation.
     *                                   It identifies the properties that the write operation will set as well as the
     *                                   properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet and
     * status.
     *
     * Note that this method will override the existing values for all of the
     * mutable properties that are contained in any parts that the parameter value
     * specifies. For example, a playlist's privacy setting is contained in the
     * status part. As such, if your request is updating a private playlist, and the
     * request's part parameter value includes the status part, the playlist's
     * privacy setting will be updated to whatever value the request body specifies.
     * If the request body does not specify a value, the existing privacy setting
     * will be removed and the playlist will revert to the default privacy setting.
     * @param Google_Playlist $postBody
     * @param array           $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_Playlist
     */
    public function update($part, Google_Service_YouTube_Playlist $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('update', array($params), Google_Service_YouTube_Playlist::class);
    }
}

/**
 * The "search" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $search = $youtubeService->search;
 *  </code>
 */
class Google_Service_YouTube_Search_Resource extends Google_Service_Resource {

    /**
     * Returns a collection of search results that match the query parameters
     * specified in the API request. By default, a search result set identifies
     * matching video, channel, and playlist resources, but you can also configure
     * queries to only retrieve a specific type of resource. (search.listSearch)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more search resource properties that the API response will include.
     *                          The part names that you can include in the parameter value are id and
     *                          snippet.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a search
     * result, the snippet property contains other properties that identify the
     * result's title, description, and so forth. If you set part=snippet, the API
     * response will also contain all of those nested properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string eventType The eventType parameter restricts a search to
     * broadcast events.
     * @opt_param string channelId The channelId parameter indicates that the API
     * response should only contain resources created by the channel
     * @opt_param string videoSyndicated The videoSyndicated parameter lets you to
     * restrict a search to only videos that can be played outside youtube.com.
     * @opt_param string channelType The channelType parameter lets you restrict a
     * search to a particular type of channel.
     * @opt_param string videoCaption The videoCaption parameter indicates whether
     * the API should filter video search results based on whether they have
     * captions.
     * @opt_param string publishedAfter The publishedAfter parameter indicates that
     * the API response should only contain resources created after the specified
     * time. The value is an RFC 3339 formatted date-time value
     * (1970-01-01T00:00:00Z).
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param bool forContentOwner Note: This parameter is intended exclusively
     * for YouTube content partners.
     *
     * The forContentOwner parameter restricts the search to only retrieve resources
     * owned by the content owner specified by the onBehalfOfContentOwner parameter.
     * The user must be authenticated using a CMS account linked to the specified
     * content owner and onBehalfOfContentOwner must be provided.
     * @opt_param string regionCode The regionCode parameter instructs the API to
     * return search results for the specified country. The parameter value is an
     * ISO 3166-1 alpha-2 country code.
     * @opt_param string location The location parameter restricts a search to
     * videos that have a geographical location specified in their metadata. The
     * value is a string that specifies geographic latitude/longitude coordinates
     * e.g. (37.42307,-122.08427)
     * @opt_param string locationRadius The locationRadius, in conjunction with the
     * location parameter, defines a geographic area. If the geographic coordinates
     * associated with a video fall within that area, then the video may be included
     * in search results. This parameter value must be a floating point number
     * followed by a measurement unit. Valid measurement units are m, km, ft, and
     * mi. For example, valid parameter values include 1500m, 5km, 10000ft, and
     * 0.75mi. The API does not support locationRadius parameter values larger than
     * 1000 kilometers.
     * @opt_param string videoType The videoType parameter lets you restrict a
     * search to a particular type of videos.
     * @opt_param string type The type parameter restricts a search query to only
     * retrieve a particular type of resource. The value is a comma-separated list
     * of resource types.
     * @opt_param string topicId The topicId parameter indicates that the API
     * response should only contain resources associated with the specified topic.
     * The value identifies a Freebase topic ID.
     * @opt_param string publishedBefore The publishedBefore parameter indicates
     * that the API response should only contain resources created before the
     * specified time. The value is an RFC 3339 formatted date-time value
     * (1970-01-01T00:00:00Z).
     * @opt_param string videoDimension The videoDimension parameter lets you
     * restrict a search to only retrieve 2D or 3D videos.
     * @opt_param string videoLicense The videoLicense parameter filters search
     * results to only include videos with a particular license. YouTube lets video
     * uploaders choose to attach either the Creative Commons license or the
     * standard YouTube license to each of their videos.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     * @opt_param string relatedToVideoId The relatedToVideoId parameter retrieves a
     * list of videos that are related to the video that the parameter value
     * identifies. The parameter value must be set to a YouTube video ID and, if you
     * are using this parameter, the type parameter must be set to video.
     * @opt_param string videoDefinition The videoDefinition parameter lets you
     * restrict a search to only include either high definition (HD) or standard
     * definition (SD) videos. HD videos are available for playback in at least
     * 720p, though higher resolutions, like 1080p, might also be available.
     * @opt_param string videoDuration The videoDuration parameter filters video
     * search results based on their duration.
     * @opt_param bool forMine The forMine parameter restricts the search to only
     * retrieve videos owned by the authenticated user. If you set this parameter to
     * true, then the type parameter's value must also be set to video.
     * @opt_param string q The q parameter specifies the query term to search for.
     * @opt_param string safeSearch The safeSearch parameter indicates whether the
     * search results should include restricted content as well as standard content.
     * @opt_param string videoEmbeddable The videoEmbeddable parameter lets you to
     * restrict a search to only videos that can be embedded into a webpage.
     * @opt_param string videoCategoryId The videoCategoryId parameter filters video
     * search results based on their category.
     * @opt_param string order The order parameter specifies the method that will be
     * used to order resources in the API response.
     * @return Google_Service_YouTube_SearchListResponse
     */
    public function listSearch($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_SearchListResponse::class);
    }
}

/**
 * The "subscriptions" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $subscriptions = $youtubeService->subscriptions;
 *  </code>
 */
class Google_Service_YouTube_Subscriptions_Resource extends Google_Service_Resource {

    /**
     * Deletes a subscription. (subscriptions.delete)
     *
     * @param string $id        The id parameter specifies the YouTube subscription ID for
     *                          the resource that is being deleted. In a subscription resource, the id
     *                          property specifies the YouTube subscription ID.
     * @param array  $optParams Optional parameters.
     */
    public function delete($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('delete', array($params));
    }

    /**
     * Adds a subscription for the authenticated user's channel.
     * (subscriptions.insert)
     *
     * @param string              $part      The part parameter serves two purposes in this operation.
     *                                       It identifies the properties that the write operation will set as well as
     *                                       the properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet and
     * contentDetails.
     * @param Google_Subscription $postBody
     * @param array               $optParams Optional parameters.
     *
     * @return Google_Service_YouTube_Subscription
     */
    public function insert($part, Google_Service_YouTube_Subscription $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_Subscription::class);
    }

    /**
     * Returns subscription resources that match the API request criteria.
     * (subscriptions.listSubscriptions)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more subscription resource properties that the API response will
     *                          include. The part names that you can include in the parameter value are id,
     *                          snippet, and contentDetails.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a
     * subscription resource, the snippet property contains other properties, such
     * as a display title for the subscription. If you set part=snippet, the API
     * response will also contain all of those nested properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param string channelId The channelId parameter specifies a YouTube
     * channel ID. The API will only return that channel's subscriptions.
     * @opt_param bool mine Set this parameter's value to true to retrieve a feed of
     * the authenticated user's subscriptions.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     * @opt_param string forChannelId The forChannelId parameter specifies a comma-
     * separated list of channel IDs. The API response will then only contain
     * subscriptions matching those channels.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     * @opt_param bool mySubscribers Set this parameter's value to true to retrieve
     * a feed of the subscribers of the authenticated user.
     * @opt_param string order The order parameter specifies the method that will be
     * used to sort resources in the API response.
     * @opt_param string id The id parameter specifies a comma-separated list of the
     * YouTube subscription ID(s) for the resource(s) that are being retrieved. In a
     * subscription resource, the id property specifies the YouTube subscription ID.
     * @return Google_Service_YouTube_SubscriptionListResponse
     */
    public function listSubscriptions($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_SubscriptionListResponse::class);
    }
}

/**
 * The "thumbnails" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $thumbnails = $youtubeService->thumbnails;
 *  </code>
 */
class Google_Service_YouTube_Thumbnails_Resource extends Google_Service_Resource {

    /**
     * Uploads a custom video thumbnail to YouTube and sets it for a video.
     * (thumbnails.set)
     *
     * @param string $videoId   The videoId parameter specifies a YouTube video ID for
     *                          which the custom video thumbnail is being provided.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner The onBehalfOfContentOwner parameter
     * indicates that the authenticated user is acting on behalf of the content
     * owner specified in the parameter value. This parameter is intended for
     * YouTube content partners that own and manage many different YouTube channels.
     * It allows content owners to authenticate once and get access to all their
     * video and channel data, without having to provide authentication credentials
     * for each individual channel. The actual CMS account that the user
     * authenticates with needs to be linked to the specified YouTube content owner.
     * @return Google_Service_YouTube_ThumbnailSetResponse
     */
    public function set($videoId, $optParams = array()) {
        $params = array('videoId' => $videoId);
        $params = array_merge($params, $optParams);

        return $this->call('set', array($params), Google_Service_YouTube_ThumbnailSetResponse::class);
    }
}

/**
 * The "videoCategories" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $videoCategories = $youtubeService->videoCategories;
 *  </code>
 */
class Google_Service_YouTube_VideoCategories_Resource extends Google_Service_Resource {

    /**
     * Returns a list of categories that can be associated with YouTube videos.
     * (videoCategories.listVideoCategories)
     *
     * @param string $part      The part parameter specifies the videoCategory resource
     *                          parts that the API response will include. Supported values are id and
     *                          snippet.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string regionCode The regionCode parameter instructs the API to
     * return the list of video categories available in the specified country. The
     * parameter value is an ISO 3166-1 alpha-2 country code.
     * @opt_param string id The id parameter specifies a comma-separated list of
     * video category IDs for the resources that you are retrieving.
     * @opt_param string hl The hl parameter specifies the language that should be
     * used for text values in the API response.
     * @return Google_Service_YouTube_VideoCategoryListResponse
     */
    public function listVideoCategories($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_VideoCategoryListResponse::class);
    }
}

/**
 * The "videos" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $videos = $youtubeService->videos;
 *  </code>
 */
class Google_Service_YouTube_Videos_Resource extends Google_Service_Resource {

    /**
     * Deletes a YouTube video. (videos.delete)
     *
     * @param string $id        The id parameter specifies the YouTube video ID for the
     *                          resource that is being deleted. In a video resource, the id property
     *                          specifies the video's ID.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The actual CMS
     * account that the user authenticates with must be linked to the specified
     * YouTube content owner.
     */
    public function delete($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('delete', array($params));
    }

    /**
     * Retrieves the ratings that the authorized user gave to a list of specified
     * videos. (videos.getRating)
     *
     * @param string $id        The id parameter specifies a comma-separated list of the
     *                          YouTube video ID(s) for the resource(s) for which you are retrieving rating
     *                          data. In a video resource, the id property specifies the video's ID.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @return Google_Service_YouTube_VideoGetRatingResponse
     */
    public function getRating($id, $optParams = array()) {
        $params = array('id' => $id);
        $params = array_merge($params, $optParams);

        return $this->call('getRating', array($params), Google_Service_YouTube_VideoGetRatingResponse::class);
    }

    /**
     * Uploads a video to YouTube and optionally sets the video's metadata.
     * (videos.insert)
     *
     * @param string       $part      The part parameter serves two purposes in this operation.
     *                                It identifies the properties that the write operation will set as well as the
     *                                properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet,
     * contentDetails, fileDetails, liveStreamingDetails, player, processingDetails,
     * recordingDetails, statistics, status, suggestions, and topicDetails. However,
     * not all of those parts contain properties that can be set when setting or
     * updating a video's metadata. For example, the statistics object encapsulates
     * statistics that YouTube calculates for a video and does not contain values
     * that you can set or modify. If the parameter value specifies a part that does
     * not contain mutable values, that part will still be included in the API
     * response.
     * @param Google_Video $postBody
     * @param array        $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param bool stabilize The stabilize parameter indicates whether YouTube
     * should adjust the video to remove shaky camera motions.
     * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
     * used in a properly authorized request. Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID
     * of the channel to which a video is being added. This parameter is required
     * when a request specifies a value for the onBehalfOfContentOwner parameter,
     * and it can only be used in conjunction with that parameter. In addition, the
     * request must be authorized using a CMS account that is linked to the content
     * owner that the onBehalfOfContentOwner parameter specifies. Finally, the
     * channel that the onBehalfOfContentOwnerChannel parameter value specifies must
     * be linked to the content owner that the onBehalfOfContentOwner parameter
     * specifies.
     *
     * This parameter is intended for YouTube content partners that own and manage
     * many different YouTube channels. It allows content owners to authenticate
     * once and perform actions on behalf of the channel specified in the parameter
     * value, without having to provide authentication credentials for each separate
     * channel.
     * @opt_param bool notifySubscribers The notifySubscribers parameter indicates
     * whether YouTube should send notification to subscribers about the inserted
     * video.
     * @opt_param bool autoLevels The autoLevels parameter indicates whether YouTube
     * should automatically enhance the video's lighting and color.
     * @return Google_Service_YouTube_Video
     */
    public function insert($part, Google_Service_YouTube_Video $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('insert', array($params), Google_Service_YouTube_Video::class);
    }

    /**
     * Returns a list of videos that match the API request parameters.
     * (videos.listVideos)
     *
     * @param string $part      The part parameter specifies a comma-separated list of
     *                          one or more video resource properties that the API response will include. The
     *                          part names that you can include in the parameter value are id, snippet,
     *                          contentDetails, fileDetails, liveStreamingDetails, player, processingDetails,
     *                          recordingDetails, statistics, status, suggestions, and topicDetails.
     *
     * If the parameter identifies a property that contains child properties, the
     * child properties will be included in the response. For example, in a video
     * resource, the snippet property contains the channelId, title, description,
     * tags, and categoryId properties. As such, if you set part=snippet, the API
     * response will contain all of those properties.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     * @opt_param string regionCode The regionCode parameter instructs the API to
     * select a video chart available in the specified region. This parameter can
     * only be used in conjunction with the chart parameter. The parameter value is
     * an ISO 3166-1 alpha-2 country code.
     * @opt_param string locale DEPRECATED
     * @opt_param string videoCategoryId The videoCategoryId parameter identifies
     * the video category for which the chart should be retrieved. This parameter
     * can only be used in conjunction with the chart parameter. By default, charts
     * are not restricted to a particular category.
     * @opt_param string chart The chart parameter identifies the chart that you
     * want to retrieve.
     * @opt_param string maxResults The maxResults parameter specifies the maximum
     * number of items that should be returned in the result set.
     *
     * Note: This parameter is supported for use in conjunction with the myRating
     * parameter, but it is not supported for use in conjunction with the id
     * parameter.
     * @opt_param string pageToken The pageToken parameter identifies a specific
     * page in the result set that should be returned. In an API response, the
     * nextPageToken and prevPageToken properties identify other pages that could be
     * retrieved.
     *
     * Note: This parameter is supported for use in conjunction with the myRating
     * parameter, but it is not supported for use in conjunction with the id
     * parameter.
     * @opt_param string myRating Set this parameter's value to like or dislike to
     * instruct the API to only return videos liked or disliked by the authenticated
     * user.
     * @opt_param string id The id parameter specifies a comma-separated list of the
     * YouTube video ID(s) for the resource(s) that are being retrieved. In a video
     * resource, the id property specifies the video's ID.
     * @return Google_Service_YouTube_VideoListResponse
     */
    public function listVideos($part, $optParams = array()) {
        $params = array('part' => $part);
        $params = array_merge($params, $optParams);

        return $this->call('list', array($params), Google_Service_YouTube_VideoListResponse::class);
    }

    /**
     * Add a like or dislike rating to a video or remove a rating from a video.
     * (videos.rate)
     *
     * @param string $id        The id parameter specifies the YouTube video ID of the
     *                          video that is being rated or having its rating removed.
     * @param string $rating    Specifies the rating to record.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The CMS account that
     * the user authenticates with must be linked to the specified YouTube content
     * owner.
     */
    public function rate($id, $rating, $optParams = array()) {
        $params = array(
            'id'     => $id,
            'rating' => $rating
        );
        $params = array_merge($params, $optParams);

        return $this->call('rate', array($params));
    }

    /**
     * Updates a video's metadata. (videos.update)
     *
     * @param string       $part      The part parameter serves two purposes in this operation.
     *                                It identifies the properties that the write operation will set as well as the
     *                                properties that the API response will include.
     *
     * The part names that you can include in the parameter value are snippet,
     * contentDetails, fileDetails, liveStreamingDetails, player, processingDetails,
     * recordingDetails, statistics, status, suggestions, and topicDetails.
     *
     * Note that this method will override the existing values for all of the
     * mutable properties that are contained in any parts that the parameter value
     * specifies. For example, a video's privacy setting is contained in the status
     * part. As such, if your request is updating a private video, and the request's
     * part parameter value includes the status part, the video's privacy setting
     * will be updated to whatever value the request body specifies. If the request
     * body does not specify a value, the existing privacy setting will be removed
     * and the video will revert to the default privacy setting.
     *
     * In addition, not all of those parts contain properties that can be set when
     * setting or updating a video's metadata. For example, the statistics object
     * encapsulates statistics that YouTube calculates for a video and does not
     * contain values that you can set or modify. If the parameter value specifies a
     * part that does not contain mutable values, that part will still be included
     * in the API response.
     * @param Google_Video $postBody
     * @param array        $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
     * exclusively for YouTube content partners.
     *
     * The onBehalfOfContentOwner parameter indicates that the request's
     * authorization credentials identify a YouTube CMS user who is acting on behalf
     * of the content owner specified in the parameter value. This parameter is
     * intended for YouTube content partners that own and manage many different
     * YouTube channels. It allows content owners to authenticate once and get
     * access to all their video and channel data, without having to provide
     * authentication credentials for each individual channel. The actual CMS
     * account that the user authenticates with must be linked to the specified
     * YouTube content owner.
     * @return Google_Service_YouTube_Video
     */
    public function update($part, Google_Service_YouTube_Video $postBody, $optParams = array()) {
        $params = array(
            'part'     => $part,
            'postBody' => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('update', array($params), Google_Service_YouTube_Video::class);
    }
}

/**
 * The "watermarks" collection of methods.
 * Typical usage is:
 *  <code>
 *   $youtubeService = new Google_Service_YouTube(...);
 *   $watermarks = $youtubeService->watermarks;
 *  </code>
 */
class Google_Service_YouTube_Watermarks_Resource extends Google_Service_Resource {

    /**
     * Uploads a watermark image to YouTube and sets it for a channel.
     * (watermarks.set)
     *
     * @param string                 $channelId The channelId parameter specifies a YouTube channel
     *                                          ID for which the watermark is being provided.
     * @param Google_InvideoBranding $postBody
     * @param array                  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner The onBehalfOfContentOwner parameter
     * indicates that the authenticated user is acting on behalf of the content
     * owner specified in the parameter value. This parameter is intended for
     * YouTube content partners that own and manage many different YouTube channels.
     * It allows content owners to authenticate once and get access to all their
     * video and channel data, without having to provide authentication credentials
     * for each individual channel. The actual CMS account that the user
     * authenticates with needs to be linked to the specified YouTube content owner.
     */
    public function set($channelId, Google_Service_YouTube_InvideoBranding $postBody, $optParams = array()) {
        $params = array(
            'channelId' => $channelId,
            'postBody'  => $postBody
        );
        $params = array_merge($params, $optParams);

        return $this->call('set', array($params));
    }

    /**
     * Deletes a watermark. (watermarks.unsetWatermarks)
     *
     * @param string $channelId The channelId parameter specifies a YouTube channel
     *                          ID for which the watermark is being unset.
     * @param array  $optParams Optional parameters.
     *
     * @opt_param string onBehalfOfContentOwner The onBehalfOfContentOwner parameter
     * indicates that the authenticated user is acting on behalf of the content
     * owner specified in the parameter value. This parameter is intended for
     * YouTube content partners that own and manage many different YouTube channels.
     * It allows content owners to authenticate once and get access to all their
     * video and channel data, without having to provide authentication credentials
     * for each individual channel. The actual CMS account that the user
     * authenticates with needs to be linked to the specified YouTube content owner.
     */
    public function unsetWatermarks($channelId, $optParams = array()) {
        $params = array('channelId' => $channelId);
        $params = array_merge($params, $optParams);

        return $this->call('unset', array($params));
    }
}


class Google_Service_YouTube_AccessPolicy extends Google_Collection {

    protected $collection_key = 'exception';
    protected $internal_gapi_mappings = array();
    public $allowed;
    public $exception;


    public function setAllowed($allowed) {
        $this->allowed = $allowed;
    }

    public function getAllowed() {
        return $this->allowed;
    }

    public function setException($exception) {
        $this->exception = $exception;
    }

    public function getException() {
        return $this->exception;
    }
}

class Google_Service_YouTube_Activity extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $contentDetailsType = 'Google_Service_YouTube_ActivityContentDetails';
    protected $contentDetailsDataType = '';
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_ActivitySnippet';
    protected $snippetDataType = '';


    public function setContentDetails(Google_Service_YouTube_ActivityContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_ActivitySnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }
}

class Google_Service_YouTube_ActivityContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $bulletinType = 'Google_Service_YouTube_ActivityContentDetailsBulletin';
    protected $bulletinDataType = '';
    protected $channelItemType = 'Google_Service_YouTube_ActivityContentDetailsChannelItem';
    protected $channelItemDataType = '';
    protected $commentType = 'Google_Service_YouTube_ActivityContentDetailsComment';
    protected $commentDataType = '';
    protected $favoriteType = 'Google_Service_YouTube_ActivityContentDetailsFavorite';
    protected $favoriteDataType = '';
    protected $likeType = 'Google_Service_YouTube_ActivityContentDetailsLike';
    protected $likeDataType = '';
    protected $playlistItemType = 'Google_Service_YouTube_ActivityContentDetailsPlaylistItem';
    protected $playlistItemDataType = '';
    protected $promotedItemType = 'Google_Service_YouTube_ActivityContentDetailsPromotedItem';
    protected $promotedItemDataType = '';
    protected $recommendationType = 'Google_Service_YouTube_ActivityContentDetailsRecommendation';
    protected $recommendationDataType = '';
    protected $socialType = 'Google_Service_YouTube_ActivityContentDetailsSocial';
    protected $socialDataType = '';
    protected $subscriptionType = 'Google_Service_YouTube_ActivityContentDetailsSubscription';
    protected $subscriptionDataType = '';
    protected $uploadType = 'Google_Service_YouTube_ActivityContentDetailsUpload';
    protected $uploadDataType = '';


    public function setBulletin(Google_Service_YouTube_ActivityContentDetailsBulletin $bulletin) {
        $this->bulletin = $bulletin;
    }

    public function getBulletin() {
        return $this->bulletin;
    }

    public function setChannelItem(Google_Service_YouTube_ActivityContentDetailsChannelItem $channelItem) {
        $this->channelItem = $channelItem;
    }

    public function getChannelItem() {
        return $this->channelItem;
    }

    public function setComment(Google_Service_YouTube_ActivityContentDetailsComment $comment) {
        $this->comment = $comment;
    }

    public function getComment() {
        return $this->comment;
    }

    public function setFavorite(Google_Service_YouTube_ActivityContentDetailsFavorite $favorite) {
        $this->favorite = $favorite;
    }

    public function getFavorite() {
        return $this->favorite;
    }

    public function setLike(Google_Service_YouTube_ActivityContentDetailsLike $like) {
        $this->like = $like;
    }

    public function getLike() {
        return $this->like;
    }

    public function setPlaylistItem(Google_Service_YouTube_ActivityContentDetailsPlaylistItem $playlistItem) {
        $this->playlistItem = $playlistItem;
    }

    public function getPlaylistItem() {
        return $this->playlistItem;
    }

    public function setPromotedItem(Google_Service_YouTube_ActivityContentDetailsPromotedItem $promotedItem) {
        $this->promotedItem = $promotedItem;
    }

    public function getPromotedItem() {
        return $this->promotedItem;
    }

    public function setRecommendation(Google_Service_YouTube_ActivityContentDetailsRecommendation $recommendation) {
        $this->recommendation = $recommendation;
    }

    public function getRecommendation() {
        return $this->recommendation;
    }

    public function setSocial(Google_Service_YouTube_ActivityContentDetailsSocial $social) {
        $this->social = $social;
    }

    public function getSocial() {
        return $this->social;
    }

    public function setSubscription(Google_Service_YouTube_ActivityContentDetailsSubscription $subscription) {
        $this->subscription = $subscription;
    }

    public function getSubscription() {
        return $this->subscription;
    }

    public function setUpload(Google_Service_YouTube_ActivityContentDetailsUpload $upload) {
        $this->upload = $upload;
    }

    public function getUpload() {
        return $this->upload;
    }
}

class Google_Service_YouTube_ActivityContentDetailsBulletin extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';


    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsChannelItem extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';


    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsComment extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';


    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsFavorite extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';


    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsLike extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';


    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsPlaylistItem extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $playlistId;
    public $playlistItemId;
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';


    public function setPlaylistId($playlistId) {
        $this->playlistId = $playlistId;
    }

    public function getPlaylistId() {
        return $this->playlistId;
    }

    public function setPlaylistItemId($playlistItemId) {
        $this->playlistItemId = $playlistItemId;
    }

    public function getPlaylistItemId() {
        return $this->playlistItemId;
    }

    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsPromotedItem extends Google_Collection {

    protected $collection_key = 'impressionUrl';
    protected $internal_gapi_mappings = array();
    public $adTag;
    public $clickTrackingUrl;
    public $creativeViewUrl;
    public $ctaType;
    public $customCtaButtonText;
    public $descriptionText;
    public $destinationUrl;
    public $forecastingUrl;
    public $impressionUrl;
    public $videoId;


    public function setAdTag($adTag) {
        $this->adTag = $adTag;
    }

    public function getAdTag() {
        return $this->adTag;
    }

    public function setClickTrackingUrl($clickTrackingUrl) {
        $this->clickTrackingUrl = $clickTrackingUrl;
    }

    public function getClickTrackingUrl() {
        return $this->clickTrackingUrl;
    }

    public function setCreativeViewUrl($creativeViewUrl) {
        $this->creativeViewUrl = $creativeViewUrl;
    }

    public function getCreativeViewUrl() {
        return $this->creativeViewUrl;
    }

    public function setCtaType($ctaType) {
        $this->ctaType = $ctaType;
    }

    public function getCtaType() {
        return $this->ctaType;
    }

    public function setCustomCtaButtonText($customCtaButtonText) {
        $this->customCtaButtonText = $customCtaButtonText;
    }

    public function getCustomCtaButtonText() {
        return $this->customCtaButtonText;
    }

    public function setDescriptionText($descriptionText) {
        $this->descriptionText = $descriptionText;
    }

    public function getDescriptionText() {
        return $this->descriptionText;
    }

    public function setDestinationUrl($destinationUrl) {
        $this->destinationUrl = $destinationUrl;
    }

    public function getDestinationUrl() {
        return $this->destinationUrl;
    }

    public function setForecastingUrl($forecastingUrl) {
        $this->forecastingUrl = $forecastingUrl;
    }

    public function getForecastingUrl() {
        return $this->forecastingUrl;
    }

    public function setImpressionUrl($impressionUrl) {
        $this->impressionUrl = $impressionUrl;
    }

    public function getImpressionUrl() {
        return $this->impressionUrl;
    }

    public function setVideoId($videoId) {
        $this->videoId = $videoId;
    }

    public function getVideoId() {
        return $this->videoId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsRecommendation extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $reason;
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';
    protected $seedResourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $seedResourceIdDataType = '';


    public function setReason($reason) {
        $this->reason = $reason;
    }

    public function getReason() {
        return $this->reason;
    }

    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }

    public function setSeedResourceId(Google_Service_YouTube_ResourceId $seedResourceId) {
        $this->seedResourceId = $seedResourceId;
    }

    public function getSeedResourceId() {
        return $this->seedResourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsSocial extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $author;
    public $imageUrl;
    public $referenceUrl;
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';
    public $type;


    public function setAuthor($author) {
        $this->author = $author;
    }

    public function getAuthor() {
        return $this->author;
    }

    public function setImageUrl($imageUrl) {
        $this->imageUrl = $imageUrl;
    }

    public function getImageUrl() {
        return $this->imageUrl;
    }

    public function setReferenceUrl($referenceUrl) {
        $this->referenceUrl = $referenceUrl;
    }

    public function getReferenceUrl() {
        return $this->referenceUrl;
    }

    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }

    public function setType($type) {
        $this->type = $type;
    }

    public function getType() {
        return $this->type;
    }
}

class Google_Service_YouTube_ActivityContentDetailsSubscription extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';


    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }
}

class Google_Service_YouTube_ActivityContentDetailsUpload extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $videoId;


    public function setVideoId($videoId) {
        $this->videoId = $videoId;
    }

    public function getVideoId() {
        return $this->videoId;
    }
}

class Google_Service_YouTube_ActivityListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_Activity';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_ActivitySnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $channelTitle;
    public $description;
    public $groupId;
    public $publishedAt;
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;
    public $type;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setChannelTitle($channelTitle) {
        $this->channelTitle = $channelTitle;
    }

    public function getChannelTitle() {
        return $this->channelTitle;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setGroupId($groupId) {
        $this->groupId = $groupId;
    }

    public function getGroupId() {
        return $this->groupId;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }

    public function setType($type) {
        $this->type = $type;
    }

    public function getType() {
        return $this->type;
    }
}

class Google_Service_YouTube_CdnSettings extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $format;
    protected $ingestionInfoType = 'Google_Service_YouTube_IngestionInfo';
    protected $ingestionInfoDataType = '';
    public $ingestionType;


    public function setFormat($format) {
        $this->format = $format;
    }

    public function getFormat() {
        return $this->format;
    }

    public function setIngestionInfo(Google_Service_YouTube_IngestionInfo $ingestionInfo) {
        $this->ingestionInfo = $ingestionInfo;
    }

    public function getIngestionInfo() {
        return $this->ingestionInfo;
    }

    public function setIngestionType($ingestionType) {
        $this->ingestionType = $ingestionType;
    }

    public function getIngestionType() {
        return $this->ingestionType;
    }
}

class Google_Service_YouTube_Channel extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $auditDetailsType = 'Google_Service_YouTube_ChannelAuditDetails';
    protected $auditDetailsDataType = '';
    protected $brandingSettingsType = 'Google_Service_YouTube_ChannelBrandingSettings';
    protected $brandingSettingsDataType = '';
    protected $contentDetailsType = 'Google_Service_YouTube_ChannelContentDetails';
    protected $contentDetailsDataType = '';
    protected $contentOwnerDetailsType = 'Google_Service_YouTube_ChannelContentOwnerDetails';
    protected $contentOwnerDetailsDataType = '';
    protected $conversionPingsType = 'Google_Service_YouTube_ChannelConversionPings';
    protected $conversionPingsDataType = '';
    public $etag;
    public $id;
    protected $invideoPromotionType = 'Google_Service_YouTube_InvideoPromotion';
    protected $invideoPromotionDataType = '';
    public $kind;
    protected $localizationsType = 'Google_Service_YouTube_ChannelLocalization';
    protected $localizationsDataType = 'map';
    protected $snippetType = 'Google_Service_YouTube_ChannelSnippet';
    protected $snippetDataType = '';
    protected $statisticsType = 'Google_Service_YouTube_ChannelStatistics';
    protected $statisticsDataType = '';
    protected $statusType = 'Google_Service_YouTube_ChannelStatus';
    protected $statusDataType = '';
    protected $topicDetailsType = 'Google_Service_YouTube_ChannelTopicDetails';
    protected $topicDetailsDataType = '';


    public function setAuditDetails(Google_Service_YouTube_ChannelAuditDetails $auditDetails) {
        $this->auditDetails = $auditDetails;
    }

    public function getAuditDetails() {
        return $this->auditDetails;
    }

    public function setBrandingSettings(Google_Service_YouTube_ChannelBrandingSettings $brandingSettings) {
        $this->brandingSettings = $brandingSettings;
    }

    public function getBrandingSettings() {
        return $this->brandingSettings;
    }

    public function setContentDetails(Google_Service_YouTube_ChannelContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setContentOwnerDetails(Google_Service_YouTube_ChannelContentOwnerDetails $contentOwnerDetails) {
        $this->contentOwnerDetails = $contentOwnerDetails;
    }

    public function getContentOwnerDetails() {
        return $this->contentOwnerDetails;
    }

    public function setConversionPings(Google_Service_YouTube_ChannelConversionPings $conversionPings) {
        $this->conversionPings = $conversionPings;
    }

    public function getConversionPings() {
        return $this->conversionPings;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setInvideoPromotion(Google_Service_YouTube_InvideoPromotion $invideoPromotion) {
        $this->invideoPromotion = $invideoPromotion;
    }

    public function getInvideoPromotion() {
        return $this->invideoPromotion;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setLocalizations($localizations) {
        $this->localizations = $localizations;
    }

    public function getLocalizations() {
        return $this->localizations;
    }

    public function setSnippet(Google_Service_YouTube_ChannelSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }

    public function setStatistics(Google_Service_YouTube_ChannelStatistics $statistics) {
        $this->statistics = $statistics;
    }

    public function getStatistics() {
        return $this->statistics;
    }

    public function setStatus(Google_Service_YouTube_ChannelStatus $status) {
        $this->status = $status;
    }

    public function getStatus() {
        return $this->status;
    }

    public function setTopicDetails(Google_Service_YouTube_ChannelTopicDetails $topicDetails) {
        $this->topicDetails = $topicDetails;
    }

    public function getTopicDetails() {
        return $this->topicDetails;
    }
}

class Google_Service_YouTube_ChannelAuditDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $communityGuidelinesGoodStanding;
    public $contentIdClaimsGoodStanding;
    public $copyrightStrikesGoodStanding;
    public $overallGoodStanding;


    public function setCommunityGuidelinesGoodStanding($communityGuidelinesGoodStanding) {
        $this->communityGuidelinesGoodStanding = $communityGuidelinesGoodStanding;
    }

    public function getCommunityGuidelinesGoodStanding() {
        return $this->communityGuidelinesGoodStanding;
    }

    public function setContentIdClaimsGoodStanding($contentIdClaimsGoodStanding) {
        $this->contentIdClaimsGoodStanding = $contentIdClaimsGoodStanding;
    }

    public function getContentIdClaimsGoodStanding() {
        return $this->contentIdClaimsGoodStanding;
    }

    public function setCopyrightStrikesGoodStanding($copyrightStrikesGoodStanding) {
        $this->copyrightStrikesGoodStanding = $copyrightStrikesGoodStanding;
    }

    public function getCopyrightStrikesGoodStanding() {
        return $this->copyrightStrikesGoodStanding;
    }

    public function setOverallGoodStanding($overallGoodStanding) {
        $this->overallGoodStanding = $overallGoodStanding;
    }

    public function getOverallGoodStanding() {
        return $this->overallGoodStanding;
    }
}

class Google_Service_YouTube_ChannelBannerResource extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $etag;
    public $kind;
    public $url;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setUrl($url) {
        $this->url = $url;
    }

    public function getUrl() {
        return $this->url;
    }
}

class Google_Service_YouTube_ChannelBrandingSettings extends Google_Collection {

    protected $collection_key = 'hints';
    protected $internal_gapi_mappings = array();
    protected $channelType = 'Google_Service_YouTube_ChannelSettings';
    protected $channelDataType = '';
    protected $hintsType = 'Google_Service_YouTube_PropertyValue';
    protected $hintsDataType = 'array';
    protected $imageType = 'Google_Service_YouTube_ImageSettings';
    protected $imageDataType = '';
    protected $watchType = 'Google_Service_YouTube_WatchSettings';
    protected $watchDataType = '';


    public function setChannel(Google_Service_YouTube_ChannelSettings $channel) {
        $this->channel = $channel;
    }

    public function getChannel() {
        return $this->channel;
    }

    public function setHints($hints) {
        $this->hints = $hints;
    }

    public function getHints() {
        return $this->hints;
    }

    public function setImage(Google_Service_YouTube_ImageSettings $image) {
        $this->image = $image;
    }

    public function getImage() {
        return $this->image;
    }

    public function setWatch(Google_Service_YouTube_WatchSettings $watch) {
        $this->watch = $watch;
    }

    public function getWatch() {
        return $this->watch;
    }
}

class Google_Service_YouTube_ChannelContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $googlePlusUserId;
    protected $relatedPlaylistsType = 'Google_Service_YouTube_ChannelContentDetailsRelatedPlaylists';
    protected $relatedPlaylistsDataType = '';


    public function setGooglePlusUserId($googlePlusUserId) {
        $this->googlePlusUserId = $googlePlusUserId;
    }

    public function getGooglePlusUserId() {
        return $this->googlePlusUserId;
    }

    public function setRelatedPlaylists(Google_Service_YouTube_ChannelContentDetailsRelatedPlaylists $relatedPlaylists) {
        $this->relatedPlaylists = $relatedPlaylists;
    }

    public function getRelatedPlaylists() {
        return $this->relatedPlaylists;
    }
}

class Google_Service_YouTube_ChannelContentDetailsRelatedPlaylists extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $favorites;
    public $likes;
    public $uploads;
    public $watchHistory;
    public $watchLater;


    public function setFavorites($favorites) {
        $this->favorites = $favorites;
    }

    public function getFavorites() {
        return $this->favorites;
    }

    public function setLikes($likes) {
        $this->likes = $likes;
    }

    public function getLikes() {
        return $this->likes;
    }

    public function setUploads($uploads) {
        $this->uploads = $uploads;
    }

    public function getUploads() {
        return $this->uploads;
    }

    public function setWatchHistory($watchHistory) {
        $this->watchHistory = $watchHistory;
    }

    public function getWatchHistory() {
        return $this->watchHistory;
    }

    public function setWatchLater($watchLater) {
        $this->watchLater = $watchLater;
    }

    public function getWatchLater() {
        return $this->watchLater;
    }
}

class Google_Service_YouTube_ChannelContentOwnerDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $contentOwner;
    public $timeLinked;


    public function setContentOwner($contentOwner) {
        $this->contentOwner = $contentOwner;
    }

    public function getContentOwner() {
        return $this->contentOwner;
    }

    public function setTimeLinked($timeLinked) {
        $this->timeLinked = $timeLinked;
    }

    public function getTimeLinked() {
        return $this->timeLinked;
    }
}

class Google_Service_YouTube_ChannelConversionPing extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $context;
    public $conversionUrl;


    public function setContext($context) {
        $this->context = $context;
    }

    public function getContext() {
        return $this->context;
    }

    public function setConversionUrl($conversionUrl) {
        $this->conversionUrl = $conversionUrl;
    }

    public function getConversionUrl() {
        return $this->conversionUrl;
    }
}

class Google_Service_YouTube_ChannelConversionPings extends Google_Collection {

    protected $collection_key = 'pings';
    protected $internal_gapi_mappings = array();
    protected $pingsType = 'Google_Service_YouTube_ChannelConversionPing';
    protected $pingsDataType = 'array';


    public function setPings($pings) {
        $this->pings = $pings;
    }

    public function getPings() {
        return $this->pings;
    }
}

class Google_Service_YouTube_ChannelListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_Channel';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_ChannelLocalization extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $description;
    public $title;


    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_ChannelLocalizations extends Google_Model {

}

class Google_Service_YouTube_ChannelSection extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $contentDetailsType = 'Google_Service_YouTube_ChannelSectionContentDetails';
    protected $contentDetailsDataType = '';
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_ChannelSectionSnippet';
    protected $snippetDataType = '';


    public function setContentDetails(Google_Service_YouTube_ChannelSectionContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_ChannelSectionSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }
}

class Google_Service_YouTube_ChannelSectionContentDetails extends Google_Collection {

    protected $collection_key = 'playlists';
    protected $internal_gapi_mappings = array();
    public $channels;
    public $playlists;


    public function setChannels($channels) {
        $this->channels = $channels;
    }

    public function getChannels() {
        return $this->channels;
    }

    public function setPlaylists($playlists) {
        $this->playlists = $playlists;
    }

    public function getPlaylists() {
        return $this->playlists;
    }
}

class Google_Service_YouTube_ChannelSectionListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_ChannelSection';
    protected $itemsDataType = 'array';
    public $kind;
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_ChannelSectionSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $position;
    public $style;
    public $title;
    public $type;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setPosition($position) {
        $this->position = $position;
    }

    public function getPosition() {
        return $this->position;
    }

    public function setStyle($style) {
        $this->style = $style;
    }

    public function getStyle() {
        return $this->style;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }

    public function setType($type) {
        $this->type = $type;
    }

    public function getType() {
        return $this->type;
    }
}

class Google_Service_YouTube_ChannelSettings extends Google_Collection {

    protected $collection_key = 'featuredChannelsUrls';
    protected $internal_gapi_mappings = array();
    public $defaultLanguage;
    public $defaultTab;
    public $description;
    public $featuredChannelsTitle;
    public $featuredChannelsUrls;
    public $keywords;
    public $moderateComments;
    public $profileColor;
    public $showBrowseView;
    public $showRelatedChannels;
    public $title;
    public $trackingAnalyticsAccountId;
    public $unsubscribedTrailer;


    public function setDefaultLanguage($defaultLanguage) {
        $this->defaultLanguage = $defaultLanguage;
    }

    public function getDefaultLanguage() {
        return $this->defaultLanguage;
    }

    public function setDefaultTab($defaultTab) {
        $this->defaultTab = $defaultTab;
    }

    public function getDefaultTab() {
        return $this->defaultTab;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setFeaturedChannelsTitle($featuredChannelsTitle) {
        $this->featuredChannelsTitle = $featuredChannelsTitle;
    }

    public function getFeaturedChannelsTitle() {
        return $this->featuredChannelsTitle;
    }

    public function setFeaturedChannelsUrls($featuredChannelsUrls) {
        $this->featuredChannelsUrls = $featuredChannelsUrls;
    }

    public function getFeaturedChannelsUrls() {
        return $this->featuredChannelsUrls;
    }

    public function setKeywords($keywords) {
        $this->keywords = $keywords;
    }

    public function getKeywords() {
        return $this->keywords;
    }

    public function setModerateComments($moderateComments) {
        $this->moderateComments = $moderateComments;
    }

    public function getModerateComments() {
        return $this->moderateComments;
    }

    public function setProfileColor($profileColor) {
        $this->profileColor = $profileColor;
    }

    public function getProfileColor() {
        return $this->profileColor;
    }

    public function setShowBrowseView($showBrowseView) {
        $this->showBrowseView = $showBrowseView;
    }

    public function getShowBrowseView() {
        return $this->showBrowseView;
    }

    public function setShowRelatedChannels($showRelatedChannels) {
        $this->showRelatedChannels = $showRelatedChannels;
    }

    public function getShowRelatedChannels() {
        return $this->showRelatedChannels;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }

    public function setTrackingAnalyticsAccountId($trackingAnalyticsAccountId) {
        $this->trackingAnalyticsAccountId = $trackingAnalyticsAccountId;
    }

    public function getTrackingAnalyticsAccountId() {
        return $this->trackingAnalyticsAccountId;
    }

    public function setUnsubscribedTrailer($unsubscribedTrailer) {
        $this->unsubscribedTrailer = $unsubscribedTrailer;
    }

    public function getUnsubscribedTrailer() {
        return $this->unsubscribedTrailer;
    }
}

class Google_Service_YouTube_ChannelSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $defaultLanguage;
    public $description;
    protected $localizedType = 'Google_Service_YouTube_ChannelLocalization';
    protected $localizedDataType = '';
    public $publishedAt;
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setDefaultLanguage($defaultLanguage) {
        $this->defaultLanguage = $defaultLanguage;
    }

    public function getDefaultLanguage() {
        return $this->defaultLanguage;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setLocalized(Google_Service_YouTube_ChannelLocalization $localized) {
        $this->localized = $localized;
    }

    public function getLocalized() {
        return $this->localized;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_ChannelStatistics extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $commentCount;
    public $hiddenSubscriberCount;
    public $subscriberCount;
    public $videoCount;
    public $viewCount;


    public function setCommentCount($commentCount) {
        $this->commentCount = $commentCount;
    }

    public function getCommentCount() {
        return $this->commentCount;
    }

    public function setHiddenSubscriberCount($hiddenSubscriberCount) {
        $this->hiddenSubscriberCount = $hiddenSubscriberCount;
    }

    public function getHiddenSubscriberCount() {
        return $this->hiddenSubscriberCount;
    }

    public function setSubscriberCount($subscriberCount) {
        $this->subscriberCount = $subscriberCount;
    }

    public function getSubscriberCount() {
        return $this->subscriberCount;
    }

    public function setVideoCount($videoCount) {
        $this->videoCount = $videoCount;
    }

    public function getVideoCount() {
        return $this->videoCount;
    }

    public function setViewCount($viewCount) {
        $this->viewCount = $viewCount;
    }

    public function getViewCount() {
        return $this->viewCount;
    }
}

class Google_Service_YouTube_ChannelStatus extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $isLinked;
    public $longUploadsStatus;
    public $privacyStatus;


    public function setIsLinked($isLinked) {
        $this->isLinked = $isLinked;
    }

    public function getIsLinked() {
        return $this->isLinked;
    }

    public function setLongUploadsStatus($longUploadsStatus) {
        $this->longUploadsStatus = $longUploadsStatus;
    }

    public function getLongUploadsStatus() {
        return $this->longUploadsStatus;
    }

    public function setPrivacyStatus($privacyStatus) {
        $this->privacyStatus = $privacyStatus;
    }

    public function getPrivacyStatus() {
        return $this->privacyStatus;
    }
}

class Google_Service_YouTube_ChannelTopicDetails extends Google_Collection {

    protected $collection_key = 'topicIds';
    protected $internal_gapi_mappings = array();
    public $topicIds;


    public function setTopicIds($topicIds) {
        $this->topicIds = $topicIds;
    }

    public function getTopicIds() {
        return $this->topicIds;
    }
}

class Google_Service_YouTube_ContentRating extends Google_Collection {

    protected $collection_key = 'djctqRatingReasons';
    protected $internal_gapi_mappings = array();
    public $acbRating;
    public $agcomRating;
    public $anatelRating;
    public $bbfcRating;
    public $bfvcRating;
    public $bmukkRating;
    public $catvRating;
    public $catvfrRating;
    public $cbfcRating;
    public $cccRating;
    public $cceRating;
    public $chfilmRating;
    public $chvrsRating;
    public $cicfRating;
    public $cnaRating;
    public $csaRating;
    public $cscfRating;
    public $czfilmRating;
    public $djctqRating;
    public $djctqRatingReasons;
    public $eefilmRating;
    public $egfilmRating;
    public $eirinRating;
    public $fcbmRating;
    public $fcoRating;
    public $fmocRating;
    public $fpbRating;
    public $fskRating;
    public $grfilmRating;
    public $icaaRating;
    public $ifcoRating;
    public $ilfilmRating;
    public $incaaRating;
    public $kfcbRating;
    public $kijkwijzerRating;
    public $kmrbRating;
    public $lsfRating;
    public $mccaaRating;
    public $mccypRating;
    public $mdaRating;
    public $medietilsynetRating;
    public $mekuRating;
    public $mibacRating;
    public $mocRating;
    public $moctwRating;
    public $mpaaRating;
    public $mtrcbRating;
    public $nbcRating;
    public $nbcplRating;
    public $nfrcRating;
    public $nfvcbRating;
    public $nkclvRating;
    public $oflcRating;
    public $pefilmRating;
    public $rcnofRating;
    public $resorteviolenciaRating;
    public $rtcRating;
    public $rteRating;
    public $russiaRating;
    public $skfilmRating;
    public $smaisRating;
    public $smsaRating;
    public $tvpgRating;
    public $ytRating;


    public function setAcbRating($acbRating) {
        $this->acbRating = $acbRating;
    }

    public function getAcbRating() {
        return $this->acbRating;
    }

    public function setAgcomRating($agcomRating) {
        $this->agcomRating = $agcomRating;
    }

    public function getAgcomRating() {
        return $this->agcomRating;
    }

    public function setAnatelRating($anatelRating) {
        $this->anatelRating = $anatelRating;
    }

    public function getAnatelRating() {
        return $this->anatelRating;
    }

    public function setBbfcRating($bbfcRating) {
        $this->bbfcRating = $bbfcRating;
    }

    public function getBbfcRating() {
        return $this->bbfcRating;
    }

    public function setBfvcRating($bfvcRating) {
        $this->bfvcRating = $bfvcRating;
    }

    public function getBfvcRating() {
        return $this->bfvcRating;
    }

    public function setBmukkRating($bmukkRating) {
        $this->bmukkRating = $bmukkRating;
    }

    public function getBmukkRating() {
        return $this->bmukkRating;
    }

    public function setCatvRating($catvRating) {
        $this->catvRating = $catvRating;
    }

    public function getCatvRating() {
        return $this->catvRating;
    }

    public function setCatvfrRating($catvfrRating) {
        $this->catvfrRating = $catvfrRating;
    }

    public function getCatvfrRating() {
        return $this->catvfrRating;
    }

    public function setCbfcRating($cbfcRating) {
        $this->cbfcRating = $cbfcRating;
    }

    public function getCbfcRating() {
        return $this->cbfcRating;
    }

    public function setCccRating($cccRating) {
        $this->cccRating = $cccRating;
    }

    public function getCccRating() {
        return $this->cccRating;
    }

    public function setCceRating($cceRating) {
        $this->cceRating = $cceRating;
    }

    public function getCceRating() {
        return $this->cceRating;
    }

    public function setChfilmRating($chfilmRating) {
        $this->chfilmRating = $chfilmRating;
    }

    public function getChfilmRating() {
        return $this->chfilmRating;
    }

    public function setChvrsRating($chvrsRating) {
        $this->chvrsRating = $chvrsRating;
    }

    public function getChvrsRating() {
        return $this->chvrsRating;
    }

    public function setCicfRating($cicfRating) {
        $this->cicfRating = $cicfRating;
    }

    public function getCicfRating() {
        return $this->cicfRating;
    }

    public function setCnaRating($cnaRating) {
        $this->cnaRating = $cnaRating;
    }

    public function getCnaRating() {
        return $this->cnaRating;
    }

    public function setCsaRating($csaRating) {
        $this->csaRating = $csaRating;
    }

    public function getCsaRating() {
        return $this->csaRating;
    }

    public function setCscfRating($cscfRating) {
        $this->cscfRating = $cscfRating;
    }

    public function getCscfRating() {
        return $this->cscfRating;
    }

    public function setCzfilmRating($czfilmRating) {
        $this->czfilmRating = $czfilmRating;
    }

    public function getCzfilmRating() {
        return $this->czfilmRating;
    }

    public function setDjctqRating($djctqRating) {
        $this->djctqRating = $djctqRating;
    }

    public function getDjctqRating() {
        return $this->djctqRating;
    }

    public function setDjctqRatingReasons($djctqRatingReasons) {
        $this->djctqRatingReasons = $djctqRatingReasons;
    }

    public function getDjctqRatingReasons() {
        return $this->djctqRatingReasons;
    }

    public function setEefilmRating($eefilmRating) {
        $this->eefilmRating = $eefilmRating;
    }

    public function getEefilmRating() {
        return $this->eefilmRating;
    }

    public function setEgfilmRating($egfilmRating) {
        $this->egfilmRating = $egfilmRating;
    }

    public function getEgfilmRating() {
        return $this->egfilmRating;
    }

    public function setEirinRating($eirinRating) {
        $this->eirinRating = $eirinRating;
    }

    public function getEirinRating() {
        return $this->eirinRating;
    }

    public function setFcbmRating($fcbmRating) {
        $this->fcbmRating = $fcbmRating;
    }

    public function getFcbmRating() {
        return $this->fcbmRating;
    }

    public function setFcoRating($fcoRating) {
        $this->fcoRating = $fcoRating;
    }

    public function getFcoRating() {
        return $this->fcoRating;
    }

    public function setFmocRating($fmocRating) {
        $this->fmocRating = $fmocRating;
    }

    public function getFmocRating() {
        return $this->fmocRating;
    }

    public function setFpbRating($fpbRating) {
        $this->fpbRating = $fpbRating;
    }

    public function getFpbRating() {
        return $this->fpbRating;
    }

    public function setFskRating($fskRating) {
        $this->fskRating = $fskRating;
    }

    public function getFskRating() {
        return $this->fskRating;
    }

    public function setGrfilmRating($grfilmRating) {
        $this->grfilmRating = $grfilmRating;
    }

    public function getGrfilmRating() {
        return $this->grfilmRating;
    }

    public function setIcaaRating($icaaRating) {
        $this->icaaRating = $icaaRating;
    }

    public function getIcaaRating() {
        return $this->icaaRating;
    }

    public function setIfcoRating($ifcoRating) {
        $this->ifcoRating = $ifcoRating;
    }

    public function getIfcoRating() {
        return $this->ifcoRating;
    }

    public function setIlfilmRating($ilfilmRating) {
        $this->ilfilmRating = $ilfilmRating;
    }

    public function getIlfilmRating() {
        return $this->ilfilmRating;
    }

    public function setIncaaRating($incaaRating) {
        $this->incaaRating = $incaaRating;
    }

    public function getIncaaRating() {
        return $this->incaaRating;
    }

    public function setKfcbRating($kfcbRating) {
        $this->kfcbRating = $kfcbRating;
    }

    public function getKfcbRating() {
        return $this->kfcbRating;
    }

    public function setKijkwijzerRating($kijkwijzerRating) {
        $this->kijkwijzerRating = $kijkwijzerRating;
    }

    public function getKijkwijzerRating() {
        return $this->kijkwijzerRating;
    }

    public function setKmrbRating($kmrbRating) {
        $this->kmrbRating = $kmrbRating;
    }

    public function getKmrbRating() {
        return $this->kmrbRating;
    }

    public function setLsfRating($lsfRating) {
        $this->lsfRating = $lsfRating;
    }

    public function getLsfRating() {
        return $this->lsfRating;
    }

    public function setMccaaRating($mccaaRating) {
        $this->mccaaRating = $mccaaRating;
    }

    public function getMccaaRating() {
        return $this->mccaaRating;
    }

    public function setMccypRating($mccypRating) {
        $this->mccypRating = $mccypRating;
    }

    public function getMccypRating() {
        return $this->mccypRating;
    }

    public function setMdaRating($mdaRating) {
        $this->mdaRating = $mdaRating;
    }

    public function getMdaRating() {
        return $this->mdaRating;
    }

    public function setMedietilsynetRating($medietilsynetRating) {
        $this->medietilsynetRating = $medietilsynetRating;
    }

    public function getMedietilsynetRating() {
        return $this->medietilsynetRating;
    }

    public function setMekuRating($mekuRating) {
        $this->mekuRating = $mekuRating;
    }

    public function getMekuRating() {
        return $this->mekuRating;
    }

    public function setMibacRating($mibacRating) {
        $this->mibacRating = $mibacRating;
    }

    public function getMibacRating() {
        return $this->mibacRating;
    }

    public function setMocRating($mocRating) {
        $this->mocRating = $mocRating;
    }

    public function getMocRating() {
        return $this->mocRating;
    }

    public function setMoctwRating($moctwRating) {
        $this->moctwRating = $moctwRating;
    }

    public function getMoctwRating() {
        return $this->moctwRating;
    }

    public function setMpaaRating($mpaaRating) {
        $this->mpaaRating = $mpaaRating;
    }

    public function getMpaaRating() {
        return $this->mpaaRating;
    }

    public function setMtrcbRating($mtrcbRating) {
        $this->mtrcbRating = $mtrcbRating;
    }

    public function getMtrcbRating() {
        return $this->mtrcbRating;
    }

    public function setNbcRating($nbcRating) {
        $this->nbcRating = $nbcRating;
    }

    public function getNbcRating() {
        return $this->nbcRating;
    }

    public function setNbcplRating($nbcplRating) {
        $this->nbcplRating = $nbcplRating;
    }

    public function getNbcplRating() {
        return $this->nbcplRating;
    }

    public function setNfrcRating($nfrcRating) {
        $this->nfrcRating = $nfrcRating;
    }

    public function getNfrcRating() {
        return $this->nfrcRating;
    }

    public function setNfvcbRating($nfvcbRating) {
        $this->nfvcbRating = $nfvcbRating;
    }

    public function getNfvcbRating() {
        return $this->nfvcbRating;
    }

    public function setNkclvRating($nkclvRating) {
        $this->nkclvRating = $nkclvRating;
    }

    public function getNkclvRating() {
        return $this->nkclvRating;
    }

    public function setOflcRating($oflcRating) {
        $this->oflcRating = $oflcRating;
    }

    public function getOflcRating() {
        return $this->oflcRating;
    }

    public function setPefilmRating($pefilmRating) {
        $this->pefilmRating = $pefilmRating;
    }

    public function getPefilmRating() {
        return $this->pefilmRating;
    }

    public function setRcnofRating($rcnofRating) {
        $this->rcnofRating = $rcnofRating;
    }

    public function getRcnofRating() {
        return $this->rcnofRating;
    }

    public function setResorteviolenciaRating($resorteviolenciaRating) {
        $this->resorteviolenciaRating = $resorteviolenciaRating;
    }

    public function getResorteviolenciaRating() {
        return $this->resorteviolenciaRating;
    }

    public function setRtcRating($rtcRating) {
        $this->rtcRating = $rtcRating;
    }

    public function getRtcRating() {
        return $this->rtcRating;
    }

    public function setRteRating($rteRating) {
        $this->rteRating = $rteRating;
    }

    public function getRteRating() {
        return $this->rteRating;
    }

    public function setRussiaRating($russiaRating) {
        $this->russiaRating = $russiaRating;
    }

    public function getRussiaRating() {
        return $this->russiaRating;
    }

    public function setSkfilmRating($skfilmRating) {
        $this->skfilmRating = $skfilmRating;
    }

    public function getSkfilmRating() {
        return $this->skfilmRating;
    }

    public function setSmaisRating($smaisRating) {
        $this->smaisRating = $smaisRating;
    }

    public function getSmaisRating() {
        return $this->smaisRating;
    }

    public function setSmsaRating($smsaRating) {
        $this->smsaRating = $smsaRating;
    }

    public function getSmsaRating() {
        return $this->smsaRating;
    }

    public function setTvpgRating($tvpgRating) {
        $this->tvpgRating = $tvpgRating;
    }

    public function getTvpgRating() {
        return $this->tvpgRating;
    }

    public function setYtRating($ytRating) {
        $this->ytRating = $ytRating;
    }

    public function getYtRating() {
        return $this->ytRating;
    }
}

class Google_Service_YouTube_GeoPoint extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $altitude;
    public $latitude;
    public $longitude;


    public function setAltitude($altitude) {
        $this->altitude = $altitude;
    }

    public function getAltitude() {
        return $this->altitude;
    }

    public function setLatitude($latitude) {
        $this->latitude = $latitude;
    }

    public function getLatitude() {
        return $this->latitude;
    }

    public function setLongitude($longitude) {
        $this->longitude = $longitude;
    }

    public function getLongitude() {
        return $this->longitude;
    }
}

class Google_Service_YouTube_GuideCategory extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_GuideCategorySnippet';
    protected $snippetDataType = '';


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_GuideCategorySnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }
}

class Google_Service_YouTube_GuideCategoryListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_GuideCategory';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_GuideCategorySnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $title;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_I18nLanguage extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_I18nLanguageSnippet';
    protected $snippetDataType = '';


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_I18nLanguageSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }
}

class Google_Service_YouTube_I18nLanguageListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_I18nLanguage';
    protected $itemsDataType = 'array';
    public $kind;
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_I18nLanguageSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $hl;
    public $name;


    public function setHl($hl) {
        $this->hl = $hl;
    }

    public function getHl() {
        return $this->hl;
    }

    public function setName($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

class Google_Service_YouTube_I18nRegion extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_I18nRegionSnippet';
    protected $snippetDataType = '';


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_I18nRegionSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }
}

class Google_Service_YouTube_I18nRegionListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_I18nRegion';
    protected $itemsDataType = 'array';
    public $kind;
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_I18nRegionSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $gl;
    public $name;


    public function setGl($gl) {
        $this->gl = $gl;
    }

    public function getGl() {
        return $this->gl;
    }

    public function setName($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

class Google_Service_YouTube_ImageSettings extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $backgroundImageUrlType = 'Google_Service_YouTube_LocalizedProperty';
    protected $backgroundImageUrlDataType = '';
    public $bannerExternalUrl;
    public $bannerImageUrl;
    public $bannerMobileExtraHdImageUrl;
    public $bannerMobileHdImageUrl;
    public $bannerMobileImageUrl;
    public $bannerMobileLowImageUrl;
    public $bannerMobileMediumHdImageUrl;
    public $bannerTabletExtraHdImageUrl;
    public $bannerTabletHdImageUrl;
    public $bannerTabletImageUrl;
    public $bannerTabletLowImageUrl;
    public $bannerTvHighImageUrl;
    public $bannerTvImageUrl;
    public $bannerTvLowImageUrl;
    public $bannerTvMediumImageUrl;
    protected $largeBrandedBannerImageImapScriptType = 'Google_Service_YouTube_LocalizedProperty';
    protected $largeBrandedBannerImageImapScriptDataType = '';
    protected $largeBrandedBannerImageUrlType = 'Google_Service_YouTube_LocalizedProperty';
    protected $largeBrandedBannerImageUrlDataType = '';
    protected $smallBrandedBannerImageImapScriptType = 'Google_Service_YouTube_LocalizedProperty';
    protected $smallBrandedBannerImageImapScriptDataType = '';
    protected $smallBrandedBannerImageUrlType = 'Google_Service_YouTube_LocalizedProperty';
    protected $smallBrandedBannerImageUrlDataType = '';
    public $trackingImageUrl;
    public $watchIconImageUrl;


    public function setBackgroundImageUrl(Google_Service_YouTube_LocalizedProperty $backgroundImageUrl) {
        $this->backgroundImageUrl = $backgroundImageUrl;
    }

    public function getBackgroundImageUrl() {
        return $this->backgroundImageUrl;
    }

    public function setBannerExternalUrl($bannerExternalUrl) {
        $this->bannerExternalUrl = $bannerExternalUrl;
    }

    public function getBannerExternalUrl() {
        return $this->bannerExternalUrl;
    }

    public function setBannerImageUrl($bannerImageUrl) {
        $this->bannerImageUrl = $bannerImageUrl;
    }

    public function getBannerImageUrl() {
        return $this->bannerImageUrl;
    }

    public function setBannerMobileExtraHdImageUrl($bannerMobileExtraHdImageUrl) {
        $this->bannerMobileExtraHdImageUrl = $bannerMobileExtraHdImageUrl;
    }

    public function getBannerMobileExtraHdImageUrl() {
        return $this->bannerMobileExtraHdImageUrl;
    }

    public function setBannerMobileHdImageUrl($bannerMobileHdImageUrl) {
        $this->bannerMobileHdImageUrl = $bannerMobileHdImageUrl;
    }

    public function getBannerMobileHdImageUrl() {
        return $this->bannerMobileHdImageUrl;
    }

    public function setBannerMobileImageUrl($bannerMobileImageUrl) {
        $this->bannerMobileImageUrl = $bannerMobileImageUrl;
    }

    public function getBannerMobileImageUrl() {
        return $this->bannerMobileImageUrl;
    }

    public function setBannerMobileLowImageUrl($bannerMobileLowImageUrl) {
        $this->bannerMobileLowImageUrl = $bannerMobileLowImageUrl;
    }

    public function getBannerMobileLowImageUrl() {
        return $this->bannerMobileLowImageUrl;
    }

    public function setBannerMobileMediumHdImageUrl($bannerMobileMediumHdImageUrl) {
        $this->bannerMobileMediumHdImageUrl = $bannerMobileMediumHdImageUrl;
    }

    public function getBannerMobileMediumHdImageUrl() {
        return $this->bannerMobileMediumHdImageUrl;
    }

    public function setBannerTabletExtraHdImageUrl($bannerTabletExtraHdImageUrl) {
        $this->bannerTabletExtraHdImageUrl = $bannerTabletExtraHdImageUrl;
    }

    public function getBannerTabletExtraHdImageUrl() {
        return $this->bannerTabletExtraHdImageUrl;
    }

    public function setBannerTabletHdImageUrl($bannerTabletHdImageUrl) {
        $this->bannerTabletHdImageUrl = $bannerTabletHdImageUrl;
    }

    public function getBannerTabletHdImageUrl() {
        return $this->bannerTabletHdImageUrl;
    }

    public function setBannerTabletImageUrl($bannerTabletImageUrl) {
        $this->bannerTabletImageUrl = $bannerTabletImageUrl;
    }

    public function getBannerTabletImageUrl() {
        return $this->bannerTabletImageUrl;
    }

    public function setBannerTabletLowImageUrl($bannerTabletLowImageUrl) {
        $this->bannerTabletLowImageUrl = $bannerTabletLowImageUrl;
    }

    public function getBannerTabletLowImageUrl() {
        return $this->bannerTabletLowImageUrl;
    }

    public function setBannerTvHighImageUrl($bannerTvHighImageUrl) {
        $this->bannerTvHighImageUrl = $bannerTvHighImageUrl;
    }

    public function getBannerTvHighImageUrl() {
        return $this->bannerTvHighImageUrl;
    }

    public function setBannerTvImageUrl($bannerTvImageUrl) {
        $this->bannerTvImageUrl = $bannerTvImageUrl;
    }

    public function getBannerTvImageUrl() {
        return $this->bannerTvImageUrl;
    }

    public function setBannerTvLowImageUrl($bannerTvLowImageUrl) {
        $this->bannerTvLowImageUrl = $bannerTvLowImageUrl;
    }

    public function getBannerTvLowImageUrl() {
        return $this->bannerTvLowImageUrl;
    }

    public function setBannerTvMediumImageUrl($bannerTvMediumImageUrl) {
        $this->bannerTvMediumImageUrl = $bannerTvMediumImageUrl;
    }

    public function getBannerTvMediumImageUrl() {
        return $this->bannerTvMediumImageUrl;
    }

    public function setLargeBrandedBannerImageImapScript(Google_Service_YouTube_LocalizedProperty $largeBrandedBannerImageImapScript) {
        $this->largeBrandedBannerImageImapScript = $largeBrandedBannerImageImapScript;
    }

    public function getLargeBrandedBannerImageImapScript() {
        return $this->largeBrandedBannerImageImapScript;
    }

    public function setLargeBrandedBannerImageUrl(Google_Service_YouTube_LocalizedProperty $largeBrandedBannerImageUrl) {
        $this->largeBrandedBannerImageUrl = $largeBrandedBannerImageUrl;
    }

    public function getLargeBrandedBannerImageUrl() {
        return $this->largeBrandedBannerImageUrl;
    }

    public function setSmallBrandedBannerImageImapScript(Google_Service_YouTube_LocalizedProperty $smallBrandedBannerImageImapScript) {
        $this->smallBrandedBannerImageImapScript = $smallBrandedBannerImageImapScript;
    }

    public function getSmallBrandedBannerImageImapScript() {
        return $this->smallBrandedBannerImageImapScript;
    }

    public function setSmallBrandedBannerImageUrl(Google_Service_YouTube_LocalizedProperty $smallBrandedBannerImageUrl) {
        $this->smallBrandedBannerImageUrl = $smallBrandedBannerImageUrl;
    }

    public function getSmallBrandedBannerImageUrl() {
        return $this->smallBrandedBannerImageUrl;
    }

    public function setTrackingImageUrl($trackingImageUrl) {
        $this->trackingImageUrl = $trackingImageUrl;
    }

    public function getTrackingImageUrl() {
        return $this->trackingImageUrl;
    }

    public function setWatchIconImageUrl($watchIconImageUrl) {
        $this->watchIconImageUrl = $watchIconImageUrl;
    }

    public function getWatchIconImageUrl() {
        return $this->watchIconImageUrl;
    }
}

class Google_Service_YouTube_IngestionInfo extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $backupIngestionAddress;
    public $ingestionAddress;
    public $streamName;


    public function setBackupIngestionAddress($backupIngestionAddress) {
        $this->backupIngestionAddress = $backupIngestionAddress;
    }

    public function getBackupIngestionAddress() {
        return $this->backupIngestionAddress;
    }

    public function setIngestionAddress($ingestionAddress) {
        $this->ingestionAddress = $ingestionAddress;
    }

    public function getIngestionAddress() {
        return $this->ingestionAddress;
    }

    public function setStreamName($streamName) {
        $this->streamName = $streamName;
    }

    public function getStreamName() {
        return $this->streamName;
    }
}

class Google_Service_YouTube_InvideoBranding extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $imageBytes;
    public $imageUrl;
    protected $positionType = 'Google_Service_YouTube_InvideoPosition';
    protected $positionDataType = '';
    public $targetChannelId;
    protected $timingType = 'Google_Service_YouTube_InvideoTiming';
    protected $timingDataType = '';


    public function setImageBytes($imageBytes) {
        $this->imageBytes = $imageBytes;
    }

    public function getImageBytes() {
        return $this->imageBytes;
    }

    public function setImageUrl($imageUrl) {
        $this->imageUrl = $imageUrl;
    }

    public function getImageUrl() {
        return $this->imageUrl;
    }

    public function setPosition(Google_Service_YouTube_InvideoPosition $position) {
        $this->position = $position;
    }

    public function getPosition() {
        return $this->position;
    }

    public function setTargetChannelId($targetChannelId) {
        $this->targetChannelId = $targetChannelId;
    }

    public function getTargetChannelId() {
        return $this->targetChannelId;
    }

    public function setTiming(Google_Service_YouTube_InvideoTiming $timing) {
        $this->timing = $timing;
    }

    public function getTiming() {
        return $this->timing;
    }
}

class Google_Service_YouTube_InvideoPosition extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $cornerPosition;
    public $type;


    public function setCornerPosition($cornerPosition) {
        $this->cornerPosition = $cornerPosition;
    }

    public function getCornerPosition() {
        return $this->cornerPosition;
    }

    public function setType($type) {
        $this->type = $type;
    }

    public function getType() {
        return $this->type;
    }
}

class Google_Service_YouTube_InvideoPromotion extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    protected $defaultTimingType = 'Google_Service_YouTube_InvideoTiming';
    protected $defaultTimingDataType = '';
    protected $itemsType = 'Google_Service_YouTube_PromotedItem';
    protected $itemsDataType = 'array';
    protected $positionType = 'Google_Service_YouTube_InvideoPosition';
    protected $positionDataType = '';
    public $useSmartTiming;


    public function setDefaultTiming(Google_Service_YouTube_InvideoTiming $defaultTiming) {
        $this->defaultTiming = $defaultTiming;
    }

    public function getDefaultTiming() {
        return $this->defaultTiming;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setPosition(Google_Service_YouTube_InvideoPosition $position) {
        $this->position = $position;
    }

    public function getPosition() {
        return $this->position;
    }

    public function setUseSmartTiming($useSmartTiming) {
        $this->useSmartTiming = $useSmartTiming;
    }

    public function getUseSmartTiming() {
        return $this->useSmartTiming;
    }
}

class Google_Service_YouTube_InvideoTiming extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $durationMs;
    public $offsetMs;
    public $type;


    public function setDurationMs($durationMs) {
        $this->durationMs = $durationMs;
    }

    public function getDurationMs() {
        return $this->durationMs;
    }

    public function setOffsetMs($offsetMs) {
        $this->offsetMs = $offsetMs;
    }

    public function getOffsetMs() {
        return $this->offsetMs;
    }

    public function setType($type) {
        $this->type = $type;
    }

    public function getType() {
        return $this->type;
    }
}

class Google_Service_YouTube_LanguageTag extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $value;


    public function setValue($value) {
        $this->value = $value;
    }

    public function getValue() {
        return $this->value;
    }
}

class Google_Service_YouTube_LiveBroadcast extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $contentDetailsType = 'Google_Service_YouTube_LiveBroadcastContentDetails';
    protected $contentDetailsDataType = '';
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_LiveBroadcastSnippet';
    protected $snippetDataType = '';
    protected $statusType = 'Google_Service_YouTube_LiveBroadcastStatus';
    protected $statusDataType = '';


    public function setContentDetails(Google_Service_YouTube_LiveBroadcastContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_LiveBroadcastSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }

    public function setStatus(Google_Service_YouTube_LiveBroadcastStatus $status) {
        $this->status = $status;
    }

    public function getStatus() {
        return $this->status;
    }
}

class Google_Service_YouTube_LiveBroadcastContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $boundStreamId;
    public $enableClosedCaptions;
    public $enableContentEncryption;
    public $enableDvr;
    public $enableEmbed;
    protected $monitorStreamType = 'Google_Service_YouTube_MonitorStreamInfo';
    protected $monitorStreamDataType = '';
    public $recordFromStart;
    public $startWithSlate;


    public function setBoundStreamId($boundStreamId) {
        $this->boundStreamId = $boundStreamId;
    }

    public function getBoundStreamId() {
        return $this->boundStreamId;
    }

    public function setEnableClosedCaptions($enableClosedCaptions) {
        $this->enableClosedCaptions = $enableClosedCaptions;
    }

    public function getEnableClosedCaptions() {
        return $this->enableClosedCaptions;
    }

    public function setEnableContentEncryption($enableContentEncryption) {
        $this->enableContentEncryption = $enableContentEncryption;
    }

    public function getEnableContentEncryption() {
        return $this->enableContentEncryption;
    }

    public function setEnableDvr($enableDvr) {
        $this->enableDvr = $enableDvr;
    }

    public function getEnableDvr() {
        return $this->enableDvr;
    }

    public function setEnableEmbed($enableEmbed) {
        $this->enableEmbed = $enableEmbed;
    }

    public function getEnableEmbed() {
        return $this->enableEmbed;
    }

    public function setMonitorStream(Google_Service_YouTube_MonitorStreamInfo $monitorStream) {
        $this->monitorStream = $monitorStream;
    }

    public function getMonitorStream() {
        return $this->monitorStream;
    }

    public function setRecordFromStart($recordFromStart) {
        $this->recordFromStart = $recordFromStart;
    }

    public function getRecordFromStart() {
        return $this->recordFromStart;
    }

    public function setStartWithSlate($startWithSlate) {
        $this->startWithSlate = $startWithSlate;
    }

    public function getStartWithSlate() {
        return $this->startWithSlate;
    }
}

class Google_Service_YouTube_LiveBroadcastListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_LiveBroadcast';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_LiveBroadcastSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $actualEndTime;
    public $actualStartTime;
    public $channelId;
    public $description;
    public $publishedAt;
    public $scheduledEndTime;
    public $scheduledStartTime;
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setActualEndTime($actualEndTime) {
        $this->actualEndTime = $actualEndTime;
    }

    public function getActualEndTime() {
        return $this->actualEndTime;
    }

    public function setActualStartTime($actualStartTime) {
        $this->actualStartTime = $actualStartTime;
    }

    public function getActualStartTime() {
        return $this->actualStartTime;
    }

    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setScheduledEndTime($scheduledEndTime) {
        $this->scheduledEndTime = $scheduledEndTime;
    }

    public function getScheduledEndTime() {
        return $this->scheduledEndTime;
    }

    public function setScheduledStartTime($scheduledStartTime) {
        $this->scheduledStartTime = $scheduledStartTime;
    }

    public function getScheduledStartTime() {
        return $this->scheduledStartTime;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_LiveBroadcastStatus extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $lifeCycleStatus;
    public $liveBroadcastPriority;
    public $privacyStatus;
    public $recordingStatus;


    public function setLifeCycleStatus($lifeCycleStatus) {
        $this->lifeCycleStatus = $lifeCycleStatus;
    }

    public function getLifeCycleStatus() {
        return $this->lifeCycleStatus;
    }

    public function setLiveBroadcastPriority($liveBroadcastPriority) {
        $this->liveBroadcastPriority = $liveBroadcastPriority;
    }

    public function getLiveBroadcastPriority() {
        return $this->liveBroadcastPriority;
    }

    public function setPrivacyStatus($privacyStatus) {
        $this->privacyStatus = $privacyStatus;
    }

    public function getPrivacyStatus() {
        return $this->privacyStatus;
    }

    public function setRecordingStatus($recordingStatus) {
        $this->recordingStatus = $recordingStatus;
    }

    public function getRecordingStatus() {
        return $this->recordingStatus;
    }
}

class Google_Service_YouTube_LiveStream extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $cdnType = 'Google_Service_YouTube_CdnSettings';
    protected $cdnDataType = '';
    protected $contentDetailsType = 'Google_Service_YouTube_LiveStreamContentDetails';
    protected $contentDetailsDataType = '';
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_LiveStreamSnippet';
    protected $snippetDataType = '';
    protected $statusType = 'Google_Service_YouTube_LiveStreamStatus';
    protected $statusDataType = '';


    public function setCdn(Google_Service_YouTube_CdnSettings $cdn) {
        $this->cdn = $cdn;
    }

    public function getCdn() {
        return $this->cdn;
    }

    public function setContentDetails(Google_Service_YouTube_LiveStreamContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_LiveStreamSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }

    public function setStatus(Google_Service_YouTube_LiveStreamStatus $status) {
        $this->status = $status;
    }

    public function getStatus() {
        return $this->status;
    }
}

class Google_Service_YouTube_LiveStreamContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $closedCaptionsIngestionUrl;
    public $isReusable;


    public function setClosedCaptionsIngestionUrl($closedCaptionsIngestionUrl) {
        $this->closedCaptionsIngestionUrl = $closedCaptionsIngestionUrl;
    }

    public function getClosedCaptionsIngestionUrl() {
        return $this->closedCaptionsIngestionUrl;
    }

    public function setIsReusable($isReusable) {
        $this->isReusable = $isReusable;
    }

    public function getIsReusable() {
        return $this->isReusable;
    }
}

class Google_Service_YouTube_LiveStreamListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_LiveStream';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_LiveStreamSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $description;
    public $publishedAt;
    public $title;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_LiveStreamStatus extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $streamStatus;


    public function setStreamStatus($streamStatus) {
        $this->streamStatus = $streamStatus;
    }

    public function getStreamStatus() {
        return $this->streamStatus;
    }
}

class Google_Service_YouTube_LocalizedProperty extends Google_Collection {

    protected $collection_key = 'localized';
    protected $internal_gapi_mappings = array();
    public $default;
    protected $defaultLanguageType = 'Google_Service_YouTube_LanguageTag';
    protected $defaultLanguageDataType = '';
    protected $localizedType = 'Google_Service_YouTube_LocalizedString';
    protected $localizedDataType = 'array';


    public function setDefault($default) {
        $this->default = $default;
    }

    public function getDefault() {
        return $this->default;
    }

    public function setDefaultLanguage(Google_Service_YouTube_LanguageTag $defaultLanguage) {
        $this->defaultLanguage = $defaultLanguage;
    }

    public function getDefaultLanguage() {
        return $this->defaultLanguage;
    }

    public function setLocalized($localized) {
        $this->localized = $localized;
    }

    public function getLocalized() {
        return $this->localized;
    }
}

class Google_Service_YouTube_LocalizedString extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $language;
    public $value;


    public function setLanguage($language) {
        $this->language = $language;
    }

    public function getLanguage() {
        return $this->language;
    }

    public function setValue($value) {
        $this->value = $value;
    }

    public function getValue() {
        return $this->value;
    }
}

class Google_Service_YouTube_MonitorStreamInfo extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $broadcastStreamDelayMs;
    public $embedHtml;
    public $enableMonitorStream;


    public function setBroadcastStreamDelayMs($broadcastStreamDelayMs) {
        $this->broadcastStreamDelayMs = $broadcastStreamDelayMs;
    }

    public function getBroadcastStreamDelayMs() {
        return $this->broadcastStreamDelayMs;
    }

    public function setEmbedHtml($embedHtml) {
        $this->embedHtml = $embedHtml;
    }

    public function getEmbedHtml() {
        return $this->embedHtml;
    }

    public function setEnableMonitorStream($enableMonitorStream) {
        $this->enableMonitorStream = $enableMonitorStream;
    }

    public function getEnableMonitorStream() {
        return $this->enableMonitorStream;
    }
}

class Google_Service_YouTube_PageInfo extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $resultsPerPage;
    public $totalResults;


    public function setResultsPerPage($resultsPerPage) {
        $this->resultsPerPage = $resultsPerPage;
    }

    public function getResultsPerPage() {
        return $this->resultsPerPage;
    }

    public function setTotalResults($totalResults) {
        $this->totalResults = $totalResults;
    }

    public function getTotalResults() {
        return $this->totalResults;
    }
}

class Google_Service_YouTube_Playlist extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $contentDetailsType = 'Google_Service_YouTube_PlaylistContentDetails';
    protected $contentDetailsDataType = '';
    public $etag;
    public $id;
    public $kind;
    protected $playerType = 'Google_Service_YouTube_PlaylistPlayer';
    protected $playerDataType = '';
    protected $snippetType = 'Google_Service_YouTube_PlaylistSnippet';
    protected $snippetDataType = '';
    protected $statusType = 'Google_Service_YouTube_PlaylistStatus';
    protected $statusDataType = '';


    public function setContentDetails(Google_Service_YouTube_PlaylistContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setPlayer(Google_Service_YouTube_PlaylistPlayer $player) {
        $this->player = $player;
    }

    public function getPlayer() {
        return $this->player;
    }

    public function setSnippet(Google_Service_YouTube_PlaylistSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }

    public function setStatus(Google_Service_YouTube_PlaylistStatus $status) {
        $this->status = $status;
    }

    public function getStatus() {
        return $this->status;
    }
}

class Google_Service_YouTube_PlaylistContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $itemCount;


    public function setItemCount($itemCount) {
        $this->itemCount = $itemCount;
    }

    public function getItemCount() {
        return $this->itemCount;
    }
}

class Google_Service_YouTube_PlaylistItem extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $contentDetailsType = 'Google_Service_YouTube_PlaylistItemContentDetails';
    protected $contentDetailsDataType = '';
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_PlaylistItemSnippet';
    protected $snippetDataType = '';
    protected $statusType = 'Google_Service_YouTube_PlaylistItemStatus';
    protected $statusDataType = '';


    public function setContentDetails(Google_Service_YouTube_PlaylistItemContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_PlaylistItemSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }

    public function setStatus(Google_Service_YouTube_PlaylistItemStatus $status) {
        $this->status = $status;
    }

    public function getStatus() {
        return $this->status;
    }
}

class Google_Service_YouTube_PlaylistItemContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $endAt;
    public $note;
    public $startAt;
    public $videoId;


    public function setEndAt($endAt) {
        $this->endAt = $endAt;
    }

    public function getEndAt() {
        return $this->endAt;
    }

    public function setNote($note) {
        $this->note = $note;
    }

    public function getNote() {
        return $this->note;
    }

    public function setStartAt($startAt) {
        $this->startAt = $startAt;
    }

    public function getStartAt() {
        return $this->startAt;
    }

    public function setVideoId($videoId) {
        $this->videoId = $videoId;
    }

    public function getVideoId() {
        return $this->videoId;
    }
}

class Google_Service_YouTube_PlaylistItemListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_PlaylistItem';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_PlaylistItemSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $channelTitle;
    public $description;
    public $playlistId;
    public $position;
    public $publishedAt;
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setChannelTitle($channelTitle) {
        $this->channelTitle = $channelTitle;
    }

    public function getChannelTitle() {
        return $this->channelTitle;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setPlaylistId($playlistId) {
        $this->playlistId = $playlistId;
    }

    public function getPlaylistId() {
        return $this->playlistId;
    }

    public function setPosition($position) {
        $this->position = $position;
    }

    public function getPosition() {
        return $this->position;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_PlaylistItemStatus extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $privacyStatus;


    public function setPrivacyStatus($privacyStatus) {
        $this->privacyStatus = $privacyStatus;
    }

    public function getPrivacyStatus() {
        return $this->privacyStatus;
    }
}

class Google_Service_YouTube_PlaylistListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_Playlist';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_PlaylistPlayer extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $embedHtml;


    public function setEmbedHtml($embedHtml) {
        $this->embedHtml = $embedHtml;
    }

    public function getEmbedHtml() {
        return $this->embedHtml;
    }
}

class Google_Service_YouTube_PlaylistSnippet extends Google_Collection {

    protected $collection_key = 'tags';
    protected $internal_gapi_mappings = array();
    public $channelId;
    public $channelTitle;
    public $description;
    public $publishedAt;
    public $tags;
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setChannelTitle($channelTitle) {
        $this->channelTitle = $channelTitle;
    }

    public function getChannelTitle() {
        return $this->channelTitle;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setTags($tags) {
        $this->tags = $tags;
    }

    public function getTags() {
        return $this->tags;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_PlaylistStatus extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $privacyStatus;


    public function setPrivacyStatus($privacyStatus) {
        $this->privacyStatus = $privacyStatus;
    }

    public function getPrivacyStatus() {
        return $this->privacyStatus;
    }
}

class Google_Service_YouTube_PromotedItem extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $customMessage;
    protected $idType = 'Google_Service_YouTube_PromotedItemId';
    protected $idDataType = '';
    public $promotedByContentOwner;
    protected $timingType = 'Google_Service_YouTube_InvideoTiming';
    protected $timingDataType = '';


    public function setCustomMessage($customMessage) {
        $this->customMessage = $customMessage;
    }

    public function getCustomMessage() {
        return $this->customMessage;
    }

    public function setId(Google_Service_YouTube_PromotedItemId $id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setPromotedByContentOwner($promotedByContentOwner) {
        $this->promotedByContentOwner = $promotedByContentOwner;
    }

    public function getPromotedByContentOwner() {
        return $this->promotedByContentOwner;
    }

    public function setTiming(Google_Service_YouTube_InvideoTiming $timing) {
        $this->timing = $timing;
    }

    public function getTiming() {
        return $this->timing;
    }
}

class Google_Service_YouTube_PromotedItemId extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $recentlyUploadedBy;
    public $type;
    public $videoId;
    public $websiteUrl;


    public function setRecentlyUploadedBy($recentlyUploadedBy) {
        $this->recentlyUploadedBy = $recentlyUploadedBy;
    }

    public function getRecentlyUploadedBy() {
        return $this->recentlyUploadedBy;
    }

    public function setType($type) {
        $this->type = $type;
    }

    public function getType() {
        return $this->type;
    }

    public function setVideoId($videoId) {
        $this->videoId = $videoId;
    }

    public function getVideoId() {
        return $this->videoId;
    }

    public function setWebsiteUrl($websiteUrl) {
        $this->websiteUrl = $websiteUrl;
    }

    public function getWebsiteUrl() {
        return $this->websiteUrl;
    }
}

class Google_Service_YouTube_PropertyValue extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $property;
    public $value;


    public function setProperty($property) {
        $this->property = $property;
    }

    public function getProperty() {
        return $this->property;
    }

    public function setValue($value) {
        $this->value = $value;
    }

    public function getValue() {
        return $this->value;
    }
}

class Google_Service_YouTube_ResourceId extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $kind;
    public $playlistId;
    public $videoId;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setPlaylistId($playlistId) {
        $this->playlistId = $playlistId;
    }

    public function getPlaylistId() {
        return $this->playlistId;
    }

    public function setVideoId($videoId) {
        $this->videoId = $videoId;
    }

    public function getVideoId() {
        return $this->videoId;
    }
}

class Google_Service_YouTube_SearchListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_SearchResult';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_SearchResult extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $etag;
    protected $idType = 'Google_Service_YouTube_ResourceId';
    protected $idDataType = '';
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_SearchResultSnippet';
    protected $snippetDataType = '';


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId(Google_Service_YouTube_ResourceId $id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_SearchResultSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }
}

class Google_Service_YouTube_SearchResultSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $channelTitle;
    public $description;
    public $liveBroadcastContent;
    public $publishedAt;
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setChannelTitle($channelTitle) {
        $this->channelTitle = $channelTitle;
    }

    public function getChannelTitle() {
        return $this->channelTitle;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setLiveBroadcastContent($liveBroadcastContent) {
        $this->liveBroadcastContent = $liveBroadcastContent;
    }

    public function getLiveBroadcastContent() {
        return $this->liveBroadcastContent;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_Subscription extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $contentDetailsType = 'Google_Service_YouTube_SubscriptionContentDetails';
    protected $contentDetailsDataType = '';
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_SubscriptionSnippet';
    protected $snippetDataType = '';
    protected $subscriberSnippetType = 'Google_Service_YouTube_SubscriptionSubscriberSnippet';
    protected $subscriberSnippetDataType = '';


    public function setContentDetails(Google_Service_YouTube_SubscriptionContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_SubscriptionSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }

    public function setSubscriberSnippet(Google_Service_YouTube_SubscriptionSubscriberSnippet $subscriberSnippet) {
        $this->subscriberSnippet = $subscriberSnippet;
    }

    public function getSubscriberSnippet() {
        return $this->subscriberSnippet;
    }
}

class Google_Service_YouTube_SubscriptionContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $activityType;
    public $newItemCount;
    public $totalItemCount;


    public function setActivityType($activityType) {
        $this->activityType = $activityType;
    }

    public function getActivityType() {
        return $this->activityType;
    }

    public function setNewItemCount($newItemCount) {
        $this->newItemCount = $newItemCount;
    }

    public function getNewItemCount() {
        return $this->newItemCount;
    }

    public function setTotalItemCount($totalItemCount) {
        $this->totalItemCount = $totalItemCount;
    }

    public function getTotalItemCount() {
        return $this->totalItemCount;
    }
}

class Google_Service_YouTube_SubscriptionListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_Subscription';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_SubscriptionSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $channelTitle;
    public $description;
    public $publishedAt;
    protected $resourceIdType = 'Google_Service_YouTube_ResourceId';
    protected $resourceIdDataType = '';
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setChannelTitle($channelTitle) {
        $this->channelTitle = $channelTitle;
    }

    public function getChannelTitle() {
        return $this->channelTitle;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setResourceId(Google_Service_YouTube_ResourceId $resourceId) {
        $this->resourceId = $resourceId;
    }

    public function getResourceId() {
        return $this->resourceId;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_SubscriptionSubscriberSnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $channelId;
    public $description;
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_Thumbnail extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $height;
    public $url;
    public $width;


    public function setHeight($height) {
        $this->height = $height;
    }

    public function getHeight() {
        return $this->height;
    }

    public function setUrl($url) {
        $this->url = $url;
    }

    public function getUrl() {
        return $this->url;
    }

    public function setWidth($width) {
        $this->width = $width;
    }

    public function getWidth() {
        return $this->width;
    }
}

class Google_Service_YouTube_ThumbnailDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $defaultType = 'Google_Service_YouTube_Thumbnail';
    protected $defaultDataType = '';
    protected $highType = 'Google_Service_YouTube_Thumbnail';
    protected $highDataType = '';
    protected $maxresType = 'Google_Service_YouTube_Thumbnail';
    protected $maxresDataType = '';
    protected $mediumType = 'Google_Service_YouTube_Thumbnail';
    protected $mediumDataType = '';
    protected $standardType = 'Google_Service_YouTube_Thumbnail';
    protected $standardDataType = '';


    public function setDefault(Google_Service_YouTube_Thumbnail $default) {
        $this->default = $default;
    }

    public function getDefault() {
        return $this->default;
    }

    public function setHigh(Google_Service_YouTube_Thumbnail $high) {
        $this->high = $high;
    }

    public function getHigh() {
        return $this->high;
    }

    public function setMaxres(Google_Service_YouTube_Thumbnail $maxres) {
        $this->maxres = $maxres;
    }

    public function getMaxres() {
        return $this->maxres;
    }

    public function setMedium(Google_Service_YouTube_Thumbnail $medium) {
        $this->medium = $medium;
    }

    public function getMedium() {
        return $this->medium;
    }

    public function setStandard(Google_Service_YouTube_Thumbnail $standard) {
        $this->standard = $standard;
    }

    public function getStandard() {
        return $this->standard;
    }
}

class Google_Service_YouTube_ThumbnailSetResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $itemsDataType = 'array';
    public $kind;
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_TokenPagination extends Google_Model {

}

class Google_Service_YouTube_Video extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $ageGatingType = 'Google_Service_YouTube_VideoAgeGating';
    protected $ageGatingDataType = '';
    protected $contentDetailsType = 'Google_Service_YouTube_VideoContentDetails';
    protected $contentDetailsDataType = '';
    protected $conversionPingsType = 'Google_Service_YouTube_VideoConversionPings';
    protected $conversionPingsDataType = '';
    public $etag;
    protected $fileDetailsType = 'Google_Service_YouTube_VideoFileDetails';
    protected $fileDetailsDataType = '';
    public $id;
    public $kind;
    protected $liveStreamingDetailsType = 'Google_Service_YouTube_VideoLiveStreamingDetails';
    protected $liveStreamingDetailsDataType = '';
    protected $monetizationDetailsType = 'Google_Service_YouTube_VideoMonetizationDetails';
    protected $monetizationDetailsDataType = '';
    protected $playerType = 'Google_Service_YouTube_VideoPlayer';
    protected $playerDataType = '';
    protected $processingDetailsType = 'Google_Service_YouTube_VideoProcessingDetails';
    protected $processingDetailsDataType = '';
    protected $projectDetailsType = 'Google_Service_YouTube_VideoProjectDetails';
    protected $projectDetailsDataType = '';
    protected $recordingDetailsType = 'Google_Service_YouTube_VideoRecordingDetails';
    protected $recordingDetailsDataType = '';
    protected $snippetType = 'Google_Service_YouTube_VideoSnippet';
    protected $snippetDataType = '';
    protected $statisticsType = 'Google_Service_YouTube_VideoStatistics';
    protected $statisticsDataType = '';
    protected $statusType = 'Google_Service_YouTube_VideoStatus';
    protected $statusDataType = '';
    protected $suggestionsType = 'Google_Service_YouTube_VideoSuggestions';
    protected $suggestionsDataType = '';
    protected $topicDetailsType = 'Google_Service_YouTube_VideoTopicDetails';
    protected $topicDetailsDataType = '';


    public function setAgeGating(Google_Service_YouTube_VideoAgeGating $ageGating) {
        $this->ageGating = $ageGating;
    }

    public function getAgeGating() {
        return $this->ageGating;
    }

    public function setContentDetails(Google_Service_YouTube_VideoContentDetails $contentDetails) {
        $this->contentDetails = $contentDetails;
    }

    public function getContentDetails() {
        return $this->contentDetails;
    }

    public function setConversionPings(Google_Service_YouTube_VideoConversionPings $conversionPings) {
        $this->conversionPings = $conversionPings;
    }

    public function getConversionPings() {
        return $this->conversionPings;
    }

    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setFileDetails(Google_Service_YouTube_VideoFileDetails $fileDetails) {
        $this->fileDetails = $fileDetails;
    }

    public function getFileDetails() {
        return $this->fileDetails;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setLiveStreamingDetails(Google_Service_YouTube_VideoLiveStreamingDetails $liveStreamingDetails) {
        $this->liveStreamingDetails = $liveStreamingDetails;
    }

    public function getLiveStreamingDetails() {
        return $this->liveStreamingDetails;
    }

    public function setMonetizationDetails(Google_Service_YouTube_VideoMonetizationDetails $monetizationDetails) {
        $this->monetizationDetails = $monetizationDetails;
    }

    public function getMonetizationDetails() {
        return $this->monetizationDetails;
    }

    public function setPlayer(Google_Service_YouTube_VideoPlayer $player) {
        $this->player = $player;
    }

    public function getPlayer() {
        return $this->player;
    }

    public function setProcessingDetails(Google_Service_YouTube_VideoProcessingDetails $processingDetails) {
        $this->processingDetails = $processingDetails;
    }

    public function getProcessingDetails() {
        return $this->processingDetails;
    }

    public function setProjectDetails(Google_Service_YouTube_VideoProjectDetails $projectDetails) {
        $this->projectDetails = $projectDetails;
    }

    public function getProjectDetails() {
        return $this->projectDetails;
    }

    public function setRecordingDetails(Google_Service_YouTube_VideoRecordingDetails $recordingDetails) {
        $this->recordingDetails = $recordingDetails;
    }

    public function getRecordingDetails() {
        return $this->recordingDetails;
    }

    public function setSnippet(Google_Service_YouTube_VideoSnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }

    public function setStatistics(Google_Service_YouTube_VideoStatistics $statistics) {
        $this->statistics = $statistics;
    }

    public function getStatistics() {
        return $this->statistics;
    }

    public function setStatus(Google_Service_YouTube_VideoStatus $status) {
        $this->status = $status;
    }

    public function getStatus() {
        return $this->status;
    }

    public function setSuggestions(Google_Service_YouTube_VideoSuggestions $suggestions) {
        $this->suggestions = $suggestions;
    }

    public function getSuggestions() {
        return $this->suggestions;
    }

    public function setTopicDetails(Google_Service_YouTube_VideoTopicDetails $topicDetails) {
        $this->topicDetails = $topicDetails;
    }

    public function getTopicDetails() {
        return $this->topicDetails;
    }
}

class Google_Service_YouTube_VideoAgeGating extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $alcoholContent;
    public $restricted;
    public $videoGameRating;


    public function setAlcoholContent($alcoholContent) {
        $this->alcoholContent = $alcoholContent;
    }

    public function getAlcoholContent() {
        return $this->alcoholContent;
    }

    public function setRestricted($restricted) {
        $this->restricted = $restricted;
    }

    public function getRestricted() {
        return $this->restricted;
    }

    public function setVideoGameRating($videoGameRating) {
        $this->videoGameRating = $videoGameRating;
    }

    public function getVideoGameRating() {
        return $this->videoGameRating;
    }
}

class Google_Service_YouTube_VideoCategory extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $etag;
    public $id;
    public $kind;
    protected $snippetType = 'Google_Service_YouTube_VideoCategorySnippet';
    protected $snippetDataType = '';


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getId() {
        return $this->id;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setSnippet(Google_Service_YouTube_VideoCategorySnippet $snippet) {
        $this->snippet = $snippet;
    }

    public function getSnippet() {
        return $this->snippet;
    }
}

class Google_Service_YouTube_VideoCategoryListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_VideoCategory';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_VideoCategorySnippet extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $assignable;
    public $channelId;
    public $title;


    public function setAssignable($assignable) {
        $this->assignable = $assignable;
    }

    public function getAssignable() {
        return $this->assignable;
    }

    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_VideoContentDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $caption;
    protected $contentRatingType = 'Google_Service_YouTube_ContentRating';
    protected $contentRatingDataType = '';
    protected $countryRestrictionType = 'Google_Service_YouTube_AccessPolicy';
    protected $countryRestrictionDataType = '';
    public $definition;
    public $dimension;
    public $duration;
    public $licensedContent;
    protected $regionRestrictionType = 'Google_Service_YouTube_VideoContentDetailsRegionRestriction';
    protected $regionRestrictionDataType = '';


    public function setCaption($caption) {
        $this->caption = $caption;
    }

    public function getCaption() {
        return $this->caption;
    }

    public function setContentRating(Google_Service_YouTube_ContentRating $contentRating) {
        $this->contentRating = $contentRating;
    }

    public function getContentRating() {
        return $this->contentRating;
    }

    public function setCountryRestriction(Google_Service_YouTube_AccessPolicy $countryRestriction) {
        $this->countryRestriction = $countryRestriction;
    }

    public function getCountryRestriction() {
        return $this->countryRestriction;
    }

    public function setDefinition($definition) {
        $this->definition = $definition;
    }

    public function getDefinition() {
        return $this->definition;
    }

    public function setDimension($dimension) {
        $this->dimension = $dimension;
    }

    public function getDimension() {
        return $this->dimension;
    }

    public function setDuration($duration) {
        $this->duration = $duration;
    }

    public function getDuration() {
        return $this->duration;
    }

    public function setLicensedContent($licensedContent) {
        $this->licensedContent = $licensedContent;
    }

    public function getLicensedContent() {
        return $this->licensedContent;
    }

    public function setRegionRestriction(Google_Service_YouTube_VideoContentDetailsRegionRestriction $regionRestriction) {
        $this->regionRestriction = $regionRestriction;
    }

    public function getRegionRestriction() {
        return $this->regionRestriction;
    }
}

class Google_Service_YouTube_VideoContentDetailsRegionRestriction extends Google_Collection {

    protected $collection_key = 'blocked';
    protected $internal_gapi_mappings = array();
    public $allowed;
    public $blocked;


    public function setAllowed($allowed) {
        $this->allowed = $allowed;
    }

    public function getAllowed() {
        return $this->allowed;
    }

    public function setBlocked($blocked) {
        $this->blocked = $blocked;
    }

    public function getBlocked() {
        return $this->blocked;
    }
}

class Google_Service_YouTube_VideoConversionPing extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $context;
    public $conversionUrl;


    public function setContext($context) {
        $this->context = $context;
    }

    public function getContext() {
        return $this->context;
    }

    public function setConversionUrl($conversionUrl) {
        $this->conversionUrl = $conversionUrl;
    }

    public function getConversionUrl() {
        return $this->conversionUrl;
    }
}

class Google_Service_YouTube_VideoConversionPings extends Google_Collection {

    protected $collection_key = 'pings';
    protected $internal_gapi_mappings = array();
    protected $pingsType = 'Google_Service_YouTube_VideoConversionPing';
    protected $pingsDataType = 'array';


    public function setPings($pings) {
        $this->pings = $pings;
    }

    public function getPings() {
        return $this->pings;
    }
}

class Google_Service_YouTube_VideoFileDetails extends Google_Collection {

    protected $collection_key = 'videoStreams';
    protected $internal_gapi_mappings = array();
    protected $audioStreamsType = 'Google_Service_YouTube_VideoFileDetailsAudioStream';
    protected $audioStreamsDataType = 'array';
    public $bitrateBps;
    public $container;
    public $creationTime;
    public $durationMs;
    public $fileName;
    public $fileSize;
    public $fileType;
    protected $recordingLocationType = 'Google_Service_YouTube_GeoPoint';
    protected $recordingLocationDataType = '';
    protected $videoStreamsType = 'Google_Service_YouTube_VideoFileDetailsVideoStream';
    protected $videoStreamsDataType = 'array';


    public function setAudioStreams($audioStreams) {
        $this->audioStreams = $audioStreams;
    }

    public function getAudioStreams() {
        return $this->audioStreams;
    }

    public function setBitrateBps($bitrateBps) {
        $this->bitrateBps = $bitrateBps;
    }

    public function getBitrateBps() {
        return $this->bitrateBps;
    }

    public function setContainer($container) {
        $this->container = $container;
    }

    public function getContainer() {
        return $this->container;
    }

    public function setCreationTime($creationTime) {
        $this->creationTime = $creationTime;
    }

    public function getCreationTime() {
        return $this->creationTime;
    }

    public function setDurationMs($durationMs) {
        $this->durationMs = $durationMs;
    }

    public function getDurationMs() {
        return $this->durationMs;
    }

    public function setFileName($fileName) {
        $this->fileName = $fileName;
    }

    public function getFileName() {
        return $this->fileName;
    }

    public function setFileSize($fileSize) {
        $this->fileSize = $fileSize;
    }

    public function getFileSize() {
        return $this->fileSize;
    }

    public function setFileType($fileType) {
        $this->fileType = $fileType;
    }

    public function getFileType() {
        return $this->fileType;
    }

    public function setRecordingLocation(Google_Service_YouTube_GeoPoint $recordingLocation) {
        $this->recordingLocation = $recordingLocation;
    }

    public function getRecordingLocation() {
        return $this->recordingLocation;
    }

    public function setVideoStreams($videoStreams) {
        $this->videoStreams = $videoStreams;
    }

    public function getVideoStreams() {
        return $this->videoStreams;
    }
}

class Google_Service_YouTube_VideoFileDetailsAudioStream extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $bitrateBps;
    public $channelCount;
    public $codec;
    public $vendor;


    public function setBitrateBps($bitrateBps) {
        $this->bitrateBps = $bitrateBps;
    }

    public function getBitrateBps() {
        return $this->bitrateBps;
    }

    public function setChannelCount($channelCount) {
        $this->channelCount = $channelCount;
    }

    public function getChannelCount() {
        return $this->channelCount;
    }

    public function setCodec($codec) {
        $this->codec = $codec;
    }

    public function getCodec() {
        return $this->codec;
    }

    public function setVendor($vendor) {
        $this->vendor = $vendor;
    }

    public function getVendor() {
        return $this->vendor;
    }
}

class Google_Service_YouTube_VideoFileDetailsVideoStream extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $aspectRatio;
    public $bitrateBps;
    public $codec;
    public $frameRateFps;
    public $heightPixels;
    public $rotation;
    public $vendor;
    public $widthPixels;


    public function setAspectRatio($aspectRatio) {
        $this->aspectRatio = $aspectRatio;
    }

    public function getAspectRatio() {
        return $this->aspectRatio;
    }

    public function setBitrateBps($bitrateBps) {
        $this->bitrateBps = $bitrateBps;
    }

    public function getBitrateBps() {
        return $this->bitrateBps;
    }

    public function setCodec($codec) {
        $this->codec = $codec;
    }

    public function getCodec() {
        return $this->codec;
    }

    public function setFrameRateFps($frameRateFps) {
        $this->frameRateFps = $frameRateFps;
    }

    public function getFrameRateFps() {
        return $this->frameRateFps;
    }

    public function setHeightPixels($heightPixels) {
        $this->heightPixels = $heightPixels;
    }

    public function getHeightPixels() {
        return $this->heightPixels;
    }

    public function setRotation($rotation) {
        $this->rotation = $rotation;
    }

    public function getRotation() {
        return $this->rotation;
    }

    public function setVendor($vendor) {
        $this->vendor = $vendor;
    }

    public function getVendor() {
        return $this->vendor;
    }

    public function setWidthPixels($widthPixels) {
        $this->widthPixels = $widthPixels;
    }

    public function getWidthPixels() {
        return $this->widthPixels;
    }
}

class Google_Service_YouTube_VideoGetRatingResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_VideoRating';
    protected $itemsDataType = 'array';
    public $kind;
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_VideoListResponse extends Google_Collection {

    protected $collection_key = 'items';
    protected $internal_gapi_mappings = array();
    public $etag;
    public $eventId;
    protected $itemsType = 'Google_Service_YouTube_Video';
    protected $itemsDataType = 'array';
    public $kind;
    public $nextPageToken;
    protected $pageInfoType = 'Google_Service_YouTube_PageInfo';
    protected $pageInfoDataType = '';
    public $prevPageToken;
    protected $tokenPaginationType = 'Google_Service_YouTube_TokenPagination';
    protected $tokenPaginationDataType = '';
    public $visitorId;


    public function setEtag($etag) {
        $this->etag = $etag;
    }

    public function getEtag() {
        return $this->etag;
    }

    public function setEventId($eventId) {
        $this->eventId = $eventId;
    }

    public function getEventId() {
        return $this->eventId;
    }

    public function setItems($items) {
        $this->items = $items;
    }

    public function getItems() {
        return $this->items;
    }

    public function setKind($kind) {
        $this->kind = $kind;
    }

    public function getKind() {
        return $this->kind;
    }

    public function setNextPageToken($nextPageToken) {
        $this->nextPageToken = $nextPageToken;
    }

    public function getNextPageToken() {
        return $this->nextPageToken;
    }

    public function setPageInfo(Google_Service_YouTube_PageInfo $pageInfo) {
        $this->pageInfo = $pageInfo;
    }

    public function getPageInfo() {
        return $this->pageInfo;
    }

    public function setPrevPageToken($prevPageToken) {
        $this->prevPageToken = $prevPageToken;
    }

    public function getPrevPageToken() {
        return $this->prevPageToken;
    }

    public function setTokenPagination(Google_Service_YouTube_TokenPagination $tokenPagination) {
        $this->tokenPagination = $tokenPagination;
    }

    public function getTokenPagination() {
        return $this->tokenPagination;
    }

    public function setVisitorId($visitorId) {
        $this->visitorId = $visitorId;
    }

    public function getVisitorId() {
        return $this->visitorId;
    }
}

class Google_Service_YouTube_VideoLiveStreamingDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $actualEndTime;
    public $actualStartTime;
    public $concurrentViewers;
    public $scheduledEndTime;
    public $scheduledStartTime;


    public function setActualEndTime($actualEndTime) {
        $this->actualEndTime = $actualEndTime;
    }

    public function getActualEndTime() {
        return $this->actualEndTime;
    }

    public function setActualStartTime($actualStartTime) {
        $this->actualStartTime = $actualStartTime;
    }

    public function getActualStartTime() {
        return $this->actualStartTime;
    }

    public function setConcurrentViewers($concurrentViewers) {
        $this->concurrentViewers = $concurrentViewers;
    }

    public function getConcurrentViewers() {
        return $this->concurrentViewers;
    }

    public function setScheduledEndTime($scheduledEndTime) {
        $this->scheduledEndTime = $scheduledEndTime;
    }

    public function getScheduledEndTime() {
        return $this->scheduledEndTime;
    }

    public function setScheduledStartTime($scheduledStartTime) {
        $this->scheduledStartTime = $scheduledStartTime;
    }

    public function getScheduledStartTime() {
        return $this->scheduledStartTime;
    }
}

class Google_Service_YouTube_VideoMonetizationDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $accessType = 'Google_Service_YouTube_AccessPolicy';
    protected $accessDataType = '';


    public function setAccess(Google_Service_YouTube_AccessPolicy $access) {
        $this->access = $access;
    }

    public function getAccess() {
        return $this->access;
    }
}

class Google_Service_YouTube_VideoPlayer extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $embedHtml;


    public function setEmbedHtml($embedHtml) {
        $this->embedHtml = $embedHtml;
    }

    public function getEmbedHtml() {
        return $this->embedHtml;
    }
}

class Google_Service_YouTube_VideoProcessingDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $editorSuggestionsAvailability;
    public $fileDetailsAvailability;
    public $processingFailureReason;
    public $processingIssuesAvailability;
    protected $processingProgressType = 'Google_Service_YouTube_VideoProcessingDetailsProcessingProgress';
    protected $processingProgressDataType = '';
    public $processingStatus;
    public $tagSuggestionsAvailability;
    public $thumbnailsAvailability;


    public function setEditorSuggestionsAvailability($editorSuggestionsAvailability) {
        $this->editorSuggestionsAvailability = $editorSuggestionsAvailability;
    }

    public function getEditorSuggestionsAvailability() {
        return $this->editorSuggestionsAvailability;
    }

    public function setFileDetailsAvailability($fileDetailsAvailability) {
        $this->fileDetailsAvailability = $fileDetailsAvailability;
    }

    public function getFileDetailsAvailability() {
        return $this->fileDetailsAvailability;
    }

    public function setProcessingFailureReason($processingFailureReason) {
        $this->processingFailureReason = $processingFailureReason;
    }

    public function getProcessingFailureReason() {
        return $this->processingFailureReason;
    }

    public function setProcessingIssuesAvailability($processingIssuesAvailability) {
        $this->processingIssuesAvailability = $processingIssuesAvailability;
    }

    public function getProcessingIssuesAvailability() {
        return $this->processingIssuesAvailability;
    }

    public function setProcessingProgress(Google_Service_YouTube_VideoProcessingDetailsProcessingProgress $processingProgress) {
        $this->processingProgress = $processingProgress;
    }

    public function getProcessingProgress() {
        return $this->processingProgress;
    }

    public function setProcessingStatus($processingStatus) {
        $this->processingStatus = $processingStatus;
    }

    public function getProcessingStatus() {
        return $this->processingStatus;
    }

    public function setTagSuggestionsAvailability($tagSuggestionsAvailability) {
        $this->tagSuggestionsAvailability = $tagSuggestionsAvailability;
    }

    public function getTagSuggestionsAvailability() {
        return $this->tagSuggestionsAvailability;
    }

    public function setThumbnailsAvailability($thumbnailsAvailability) {
        $this->thumbnailsAvailability = $thumbnailsAvailability;
    }

    public function getThumbnailsAvailability() {
        return $this->thumbnailsAvailability;
    }
}

class Google_Service_YouTube_VideoProcessingDetailsProcessingProgress extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $partsProcessed;
    public $partsTotal;
    public $timeLeftMs;


    public function setPartsProcessed($partsProcessed) {
        $this->partsProcessed = $partsProcessed;
    }

    public function getPartsProcessed() {
        return $this->partsProcessed;
    }

    public function setPartsTotal($partsTotal) {
        $this->partsTotal = $partsTotal;
    }

    public function getPartsTotal() {
        return $this->partsTotal;
    }

    public function setTimeLeftMs($timeLeftMs) {
        $this->timeLeftMs = $timeLeftMs;
    }

    public function getTimeLeftMs() {
        return $this->timeLeftMs;
    }
}

class Google_Service_YouTube_VideoProjectDetails extends Google_Collection {

    protected $collection_key = 'tags';
    protected $internal_gapi_mappings = array();
    public $tags;


    public function setTags($tags) {
        $this->tags = $tags;
    }

    public function getTags() {
        return $this->tags;
    }
}

class Google_Service_YouTube_VideoRating extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $rating;
    public $videoId;


    public function setRating($rating) {
        $this->rating = $rating;
    }

    public function getRating() {
        return $this->rating;
    }

    public function setVideoId($videoId) {
        $this->videoId = $videoId;
    }

    public function getVideoId() {
        return $this->videoId;
    }
}

class Google_Service_YouTube_VideoRecordingDetails extends Google_Model {

    protected $internal_gapi_mappings = array();
    protected $locationType = 'Google_Service_YouTube_GeoPoint';
    protected $locationDataType = '';
    public $locationDescription;
    public $recordingDate;


    public function setLocation(Google_Service_YouTube_GeoPoint $location) {
        $this->location = $location;
    }

    public function getLocation() {
        return $this->location;
    }

    public function setLocationDescription($locationDescription) {
        $this->locationDescription = $locationDescription;
    }

    public function getLocationDescription() {
        return $this->locationDescription;
    }

    public function setRecordingDate($recordingDate) {
        $this->recordingDate = $recordingDate;
    }

    public function getRecordingDate() {
        return $this->recordingDate;
    }
}

class Google_Service_YouTube_VideoSnippet extends Google_Collection {

    protected $collection_key = 'tags';
    protected $internal_gapi_mappings = array();
    public $categoryId;
    public $channelId;
    public $channelTitle;
    public $description;
    public $liveBroadcastContent;
    public $publishedAt;
    public $tags;
    protected $thumbnailsType = 'Google_Service_YouTube_ThumbnailDetails';
    protected $thumbnailsDataType = '';
    public $title;


    public function setCategoryId($categoryId) {
        $this->categoryId = $categoryId;
    }

    public function getCategoryId() {
        return $this->categoryId;
    }

    public function setChannelId($channelId) {
        $this->channelId = $channelId;
    }

    public function getChannelId() {
        return $this->channelId;
    }

    public function setChannelTitle($channelTitle) {
        $this->channelTitle = $channelTitle;
    }

    public function getChannelTitle() {
        return $this->channelTitle;
    }

    public function setDescription($description) {
        $this->description = $description;
    }

    public function getDescription() {
        return $this->description;
    }

    public function setLiveBroadcastContent($liveBroadcastContent) {
        $this->liveBroadcastContent = $liveBroadcastContent;
    }

    public function getLiveBroadcastContent() {
        return $this->liveBroadcastContent;
    }

    public function setPublishedAt($publishedAt) {
        $this->publishedAt = $publishedAt;
    }

    public function getPublishedAt() {
        return $this->publishedAt;
    }

    public function setTags($tags) {
        $this->tags = $tags;
    }

    public function getTags() {
        return $this->tags;
    }

    public function setThumbnails(Google_Service_YouTube_ThumbnailDetails $thumbnails) {
        $this->thumbnails = $thumbnails;
    }

    public function getThumbnails() {
        return $this->thumbnails;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }
}

class Google_Service_YouTube_VideoStatistics extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $commentCount;
    public $dislikeCount;
    public $favoriteCount;
    public $likeCount;
    public $viewCount;


    public function setCommentCount($commentCount) {
        $this->commentCount = $commentCount;
    }

    public function getCommentCount() {
        return $this->commentCount;
    }

    public function setDislikeCount($dislikeCount) {
        $this->dislikeCount = $dislikeCount;
    }

    public function getDislikeCount() {
        return $this->dislikeCount;
    }

    public function setFavoriteCount($favoriteCount) {
        $this->favoriteCount = $favoriteCount;
    }

    public function getFavoriteCount() {
        return $this->favoriteCount;
    }

    public function setLikeCount($likeCount) {
        $this->likeCount = $likeCount;
    }

    public function getLikeCount() {
        return $this->likeCount;
    }

    public function setViewCount($viewCount) {
        $this->viewCount = $viewCount;
    }

    public function getViewCount() {
        return $this->viewCount;
    }
}

class Google_Service_YouTube_VideoStatus extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $embeddable;
    public $failureReason;
    public $license;
    public $privacyStatus;
    public $publicStatsViewable;
    public $publishAt;
    public $rejectionReason;
    public $uploadStatus;


    public function setEmbeddable($embeddable) {
        $this->embeddable = $embeddable;
    }

    public function getEmbeddable() {
        return $this->embeddable;
    }

    public function setFailureReason($failureReason) {
        $this->failureReason = $failureReason;
    }

    public function getFailureReason() {
        return $this->failureReason;
    }

    public function setLicense($license) {
        $this->license = $license;
    }

    public function getLicense() {
        return $this->license;
    }

    public function setPrivacyStatus($privacyStatus) {
        $this->privacyStatus = $privacyStatus;
    }

    public function getPrivacyStatus() {
        return $this->privacyStatus;
    }

    public function setPublicStatsViewable($publicStatsViewable) {
        $this->publicStatsViewable = $publicStatsViewable;
    }

    public function getPublicStatsViewable() {
        return $this->publicStatsViewable;
    }

    public function setPublishAt($publishAt) {
        $this->publishAt = $publishAt;
    }

    public function getPublishAt() {
        return $this->publishAt;
    }

    public function setRejectionReason($rejectionReason) {
        $this->rejectionReason = $rejectionReason;
    }

    public function getRejectionReason() {
        return $this->rejectionReason;
    }

    public function setUploadStatus($uploadStatus) {
        $this->uploadStatus = $uploadStatus;
    }

    public function getUploadStatus() {
        return $this->uploadStatus;
    }
}

class Google_Service_YouTube_VideoSuggestions extends Google_Collection {

    protected $collection_key = 'tagSuggestions';
    protected $internal_gapi_mappings = array();
    public $editorSuggestions;
    public $processingErrors;
    public $processingHints;
    public $processingWarnings;
    protected $tagSuggestionsType = 'Google_Service_YouTube_VideoSuggestionsTagSuggestion';
    protected $tagSuggestionsDataType = 'array';


    public function setEditorSuggestions($editorSuggestions) {
        $this->editorSuggestions = $editorSuggestions;
    }

    public function getEditorSuggestions() {
        return $this->editorSuggestions;
    }

    public function setProcessingErrors($processingErrors) {
        $this->processingErrors = $processingErrors;
    }

    public function getProcessingErrors() {
        return $this->processingErrors;
    }

    public function setProcessingHints($processingHints) {
        $this->processingHints = $processingHints;
    }

    public function getProcessingHints() {
        return $this->processingHints;
    }

    public function setProcessingWarnings($processingWarnings) {
        $this->processingWarnings = $processingWarnings;
    }

    public function getProcessingWarnings() {
        return $this->processingWarnings;
    }

    public function setTagSuggestions($tagSuggestions) {
        $this->tagSuggestions = $tagSuggestions;
    }

    public function getTagSuggestions() {
        return $this->tagSuggestions;
    }
}

class Google_Service_YouTube_VideoSuggestionsTagSuggestion extends Google_Collection {

    protected $collection_key = 'categoryRestricts';
    protected $internal_gapi_mappings = array();
    public $categoryRestricts;
    public $tag;


    public function setCategoryRestricts($categoryRestricts) {
        $this->categoryRestricts = $categoryRestricts;
    }

    public function getCategoryRestricts() {
        return $this->categoryRestricts;
    }

    public function setTag($tag) {
        $this->tag = $tag;
    }

    public function getTag() {
        return $this->tag;
    }
}

class Google_Service_YouTube_VideoTopicDetails extends Google_Collection {

    protected $collection_key = 'topicIds';
    protected $internal_gapi_mappings = array();
    public $relevantTopicIds;
    public $topicIds;


    public function setRelevantTopicIds($relevantTopicIds) {
        $this->relevantTopicIds = $relevantTopicIds;
    }

    public function getRelevantTopicIds() {
        return $this->relevantTopicIds;
    }

    public function setTopicIds($topicIds) {
        $this->topicIds = $topicIds;
    }

    public function getTopicIds() {
        return $this->topicIds;
    }
}

class Google_Service_YouTube_WatchSettings extends Google_Model {

    protected $internal_gapi_mappings = array();
    public $backgroundColor;
    public $featuredPlaylistId;
    public $textColor;


    public function setBackgroundColor($backgroundColor) {
        $this->backgroundColor = $backgroundColor;
    }

    public function getBackgroundColor() {
        return $this->backgroundColor;
    }

    public function setFeaturedPlaylistId($featuredPlaylistId) {
        $this->featuredPlaylistId = $featuredPlaylistId;
    }

    public function getFeaturedPlaylistId() {
        return $this->featuredPlaylistId;
    }

    public function setTextColor($textColor) {
        $this->textColor = $textColor;
    }

    public function getTextColor() {
        return $this->textColor;
    }
}
Generator/Common/YouTube/googleclient/Http/Google_Http_CacheParser.php000064400000014421152355233130022100 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http;


/**
 * Implement the caching directives specified in rfc2616. This
 * implementation is guided by the guidance offered in rfc2616-sec13.
 *
 * @author Chirag Shah <chirags@google.com>
 */
class Google_Http_CacheParser {

    public static $CACHEABLE_HTTP_METHODS = array(
        'GET',
        'HEAD'
    );
    public static $CACHEABLE_STATUS_CODES = array(
        '200',
        '203',
        '300',
        '301'
    );

    /**
     * Check if an HTTP request can be cached by a private local cache.
     *
     * @static
     *
     * @param Google_Http_Request $resp
     *
     * @return bool True if the request is cacheable.
     * False if the request is uncacheable.
     */
    public static function isRequestCacheable(Google_Http_Request $resp) {
        $method = $resp->getRequestMethod();
        if (!in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
            return false;
        }

        // Don't cache authorized requests/responses.
        // [rfc2616-14.8] When a shared cache receives a request containing an
        // Authorization field, it MUST NOT return the corresponding response
        // as a reply to any other request...
        if ($resp->getRequestHeader("authorization")) {
            return false;
        }

        return true;
    }

    /**
     * Check if an HTTP response can be cached by a private local cache.
     *
     * @static
     *
     * @param Google_Http_Request $resp
     *
     * @return bool True if the response is cacheable.
     * False if the response is un-cacheable.
     */
    public static function isResponseCacheable(Google_Http_Request $resp) {
        // First, check if the HTTP request was cacheable before inspecting the
        // HTTP response.
        if (false == self::isRequestCacheable($resp)) {
            return false;
        }

        $code = $resp->getResponseHttpCode();
        if (!in_array($code, self::$CACHEABLE_STATUS_CODES)) {
            return false;
        }

        // The resource is uncacheable if the resource is already expired and
        // the resource doesn't have an ETag for revalidation.
        $etag = $resp->getResponseHeader("etag");
        if (self::isExpired($resp) && $etag == false) {
            return false;
        }

        // [rfc2616-14.9.2]  If [no-store is] sent in a response, a cache MUST NOT
        // store any part of either this response or the request that elicited it.
        $cacheControl = $resp->getParsedCacheControl();
        if (isset($cacheControl['no-store'])) {
            return false;
        }

        // Pragma: no-cache is an http request directive, but is occasionally
        // used as a response header incorrectly.
        $pragma = $resp->getResponseHeader('pragma');
        if ($pragma == 'no-cache' || strpos($pragma, 'no-cache') !== false) {
            return false;
        }

        // [rfc2616-14.44] Vary: * is extremely difficult to cache. "It implies that
        // a cache cannot determine from the request headers of a subsequent request
        // whether this response is the appropriate representation."
        // Given this, we deem responses with the Vary header as uncacheable.
        $vary = $resp->getResponseHeader('vary');
        if ($vary) {
            return false;
        }

        return true;
    }

    /**
     * @static
     *
     * @param Google_Http_Request $resp
     *
     * @return bool True if the HTTP response is considered to be expired.
     * False if it is considered to be fresh.
     */
    public static function isExpired(Google_Http_Request $resp) {
        // HTTP/1.1 clients and caches MUST treat other invalid date formats,
        // especially including the value “0”, as in the past.
        $parsedExpires   = false;
        $responseHeaders = $resp->getResponseHeaders();

        if (isset($responseHeaders['expires'])) {
            $rawExpires = $responseHeaders['expires'];
            // Check for a malformed expires header first.
            if (empty($rawExpires) || (is_numeric($rawExpires) && $rawExpires <= 0)) {
                return true;
            }

            // See if we can parse the expires header.
            $parsedExpires = strtotime($rawExpires);
            if (false == $parsedExpires || $parsedExpires <= 0) {
                return true;
            }
        }

        // Calculate the freshness of an http response.
        $freshnessLifetime = false;
        $cacheControl      = $resp->getParsedCacheControl();
        if (isset($cacheControl['max-age'])) {
            $freshnessLifetime = $cacheControl['max-age'];
        }

        $rawDate    = $resp->getResponseHeader('date');
        $parsedDate = strtotime($rawDate);

        if (empty($rawDate) || false == $parsedDate) {
            // We can't default this to now, as that means future cache reads
            // will always pass with the logic below, so we will require a
            // date be injected if not supplied.
            throw new Google_Exception("All cacheable requests must have creation dates.");
        }

        if (false == $freshnessLifetime && isset($responseHeaders['expires'])) {
            $freshnessLifetime = $parsedExpires - $parsedDate;
        }

        if (false == $freshnessLifetime) {
            return true;
        }

        // Calculate the age of an http response.
        $age = max(0, time() - $parsedDate);
        if (isset($responseHeaders['age'])) {
            $age = max($age, strtotime($responseHeaders['age']));
        }

        return $freshnessLifetime <= $age;
    }

    /**
     * Determine if a cache entry should be revalidated with by the origin.
     *
     * @param Google_Http_Request $response
     *
     * @return bool True if the entry is expired, else return false.
     */
    public static function mustRevalidate(Google_Http_Request $response) {
        // [13.3] When a cache has a stale entry that it would like to use as a
        // response to a client's request, it first has to check with the origin
        // server to see if its cached entry is still usable.
        return self::isExpired($response);
    }
}
Generator/Common/YouTube/googleclient/Http/Google_Http_Request.php000064400000030214152355233130021346 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Utils;

/**
 * HTTP Request to be executed by IO classes. Upon execution, the
 * responseHttpCode, responseHeaders and responseBody will be filled in.
 *
 * @author Chris Chabot <chabotc@google.com>
 * @author Chirag Shah <chirags@google.com>
 *
 */
class Google_Http_Request {

    const GZIP_UA = " (gzip)";

    private $batchHeaders = array(
        'Content-Type'              => 'application/http',
        'Content-Transfer-Encoding' => 'binary',
        'MIME-Version'              => '1.0',
    );

    protected $queryParams;
    protected $requestMethod;
    protected $requestHeaders;
    protected $baseComponent = null;
    protected $path;
    protected $postBody;
    protected $userAgent;
    protected $canGzip = null;

    protected $responseHttpCode;
    protected $responseHeaders;
    protected $responseBody;

    protected $expectedClass;

    public $accessKey;

    public function __construct($url, $method = 'GET', $headers = array(), $postBody = null) {
        $this->setUrl($url);
        $this->setRequestMethod($method);
        $this->setRequestHeaders($headers);
        $this->setPostBody($postBody);
    }

    /**
     * Misc function that returns the base url component of the $url
     * used by the OAuth signing class to calculate the base string
     *
     * @return string The base url component of the $url.
     */
    public function getBaseComponent() {
        return $this->baseComponent;
    }

    /**
     * Set the base URL that path and query parameters will be added to.
     *
     * @param $baseComponent string
     */
    public function setBaseComponent($baseComponent) {
        $this->baseComponent = $baseComponent;
    }

    /**
     * Enable support for gzipped responses with this request.
     */
    public function enableGzip() {
        $this->setRequestHeaders(array("Accept-Encoding" => "gzip"));
        $this->canGzip = true;
        $this->setUserAgent($this->userAgent);
    }

    /**
     * Disable support for gzip responses with this request.
     */
    public function disableGzip() {
        if (isset($this->requestHeaders['accept-encoding']) && $this->requestHeaders['accept-encoding'] == "gzip") {
            unset($this->requestHeaders['accept-encoding']);
        }
        $this->canGzip   = false;
        $this->userAgent = str_replace(self::GZIP_UA, "", $this->userAgent);
    }

    /**
     * Can this request accept a gzip response?
     *
     * @return bool
     */
    public function canGzip() {
        return $this->canGzip;
    }

    /**
     * Misc function that returns an array of the query parameters of the current
     * url used by the OAuth signing class to calculate the signature
     *
     * @return array Query parameters in the query string.
     */
    public function getQueryParams() {
        return $this->queryParams;
    }

    /**
     * Set a new query parameter.
     *
     * @param $key   - string to set, does not need to be URL encoded
     * @param $value - string to set, does not need to be URL encoded
     */
    public function setQueryParam($key, $value) {
        $this->queryParams[$key] = $value;
    }

    /**
     * @return string HTTP Response Code.
     */
    public function getResponseHttpCode() {
        return (int)$this->responseHttpCode;
    }

    /**
     * @param int $responseHttpCode HTTP Response Code.
     */
    public function setResponseHttpCode($responseHttpCode) {
        $this->responseHttpCode = $responseHttpCode;
    }

    /**
     * @return $responseHeaders (array) HTTP Response Headers.
     */
    public function getResponseHeaders() {
        return $this->responseHeaders;
    }

    /**
     * @return string HTTP Response Body
     */
    public function getResponseBody() {
        return $this->responseBody;
    }

    /**
     * Set the class the response to this request should expect.
     *
     * @param $class string the class name
     */
    public function setExpectedClass($class) {
        $this->expectedClass = $class;
    }

    /**
     * Retrieve the expected class the response should expect.
     *
     * @return string class name
     */
    public function getExpectedClass() {
        return $this->expectedClass;
    }

    /**
     * @param array $headers The HTTP response headers
     *                       to be normalized.
     */
    public function setResponseHeaders($headers) {
        $headers = Google_Utils::normalize($headers);
        if ($this->responseHeaders) {
            $headers = array_merge($this->responseHeaders, $headers);
        }

        $this->responseHeaders = $headers;
    }

    /**
     * @param string $key
     *
     * @return array|boolean Returns the requested HTTP header or
     * false if unavailable.
     */
    public function getResponseHeader($key) {
        return isset($this->responseHeaders[$key]) ? $this->responseHeaders[$key] : false;
    }

    /**
     * @param string $responseBody The HTTP response body.
     */
    public function setResponseBody($responseBody) {
        $this->responseBody = $responseBody;
    }

    /**
     * @return string $url The request URL.
     */
    public function getUrl() {
        return $this->baseComponent . $this->path . (count($this->queryParams) ? "?" . $this->buildQuery($this->queryParams) : '');
    }

    /**
     * @return string $method HTTP Request Method.
     */
    public function getRequestMethod() {
        return $this->requestMethod;
    }

    /**
     * @return array $headers HTTP Request Headers.
     */
    public function getRequestHeaders() {
        return $this->requestHeaders;
    }

    /**
     * @param string $key
     *
     * @return array|boolean Returns the requested HTTP header or
     * false if unavailable.
     */
    public function getRequestHeader($key) {
        return isset($this->requestHeaders[$key]) ? $this->requestHeaders[$key] : false;
    }

    /**
     * @return string $postBody HTTP Request Body.
     */
    public function getPostBody() {
        return $this->postBody;
    }

    /**
     * @param string $url the url to set
     */
    public function setUrl($url) {
        if (substr($url, 0, 4) != 'http') {
            // Force the path become relative.
            if (substr($url, 0, 1) !== '/') {
                $url = '/' . $url;
            }
        }
        $parts = parse_url($url);
        if (isset($parts['host'])) {
            $this->baseComponent = sprintf("%s%s%s", isset($parts['scheme']) ? $parts['scheme'] . "://" : '', isset($parts['host']) ? $parts['host'] : '', isset($parts['port']) ? ":" . $parts['port'] : '');
        }
        $this->path        = isset($parts['path']) ? $parts['path'] : '';
        $this->queryParams = array();
        if (isset($parts['query'])) {
            $this->queryParams = $this->parseQuery($parts['query']);
        }
    }

    /**
     * @param string $method Set he HTTP Method and normalize
     *                       it to upper-case, as required by HTTP.
     *
     */
    public function setRequestMethod($method) {
        $this->requestMethod = strtoupper($method);
    }

    /**
     * @param array $headers The HTTP request headers
     *                       to be set and normalized.
     */
    public function setRequestHeaders($headers) {
        $headers = Google_Utils::normalize($headers);
        if ($this->requestHeaders) {
            $headers = array_merge($this->requestHeaders, $headers);
        }
        $this->requestHeaders = $headers;
    }

    /**
     * @param string $postBody the postBody to set
     */
    public function setPostBody($postBody) {
        $this->postBody = $postBody;
    }

    /**
     * Set the User-Agent Header.
     *
     * @param string $userAgent The User-Agent.
     */
    public function setUserAgent($userAgent) {
        $this->userAgent = $userAgent;
        if ($this->canGzip) {
            $this->userAgent = $userAgent . self::GZIP_UA;
        }
    }

    /**
     * @return string The User-Agent.
     */
    public function getUserAgent() {
        return $this->userAgent;
    }

    /**
     * Returns a cache key depending on if this was an OAuth signed request
     * in which case it will use the non-signed url and access key to make this
     * cache key unique per authenticated user, else use the plain request url
     *
     * @return string The md5 hash of the request cache key.
     */
    public function getCacheKey() {
        $key = $this->getUrl();

        if (isset($this->accessKey)) {
            $key .= $this->accessKey;
        }

        if (isset($this->requestHeaders['authorization'])) {
            $key .= $this->requestHeaders['authorization'];
        }

        return md5($key);
    }

    public function getParsedCacheControl() {
        $parsed          = array();
        $rawCacheControl = $this->getResponseHeader('cache-control');
        if ($rawCacheControl) {
            $rawCacheControl = str_replace(', ', '&', $rawCacheControl);
            parse_str($rawCacheControl, $parsed);
        }

        return $parsed;
    }

    /**
     * @param string $id
     *
     * @return string A string representation of the HTTP Request.
     */
    public function toBatchString($id) {
        $str  = '';
        $path = parse_url($this->getUrl(), PHP_URL_PATH) . "?" . http_build_query($this->queryParams);
        $str  .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";

        foreach ($this->getRequestHeaders() as $key => $val) {
            $str .= $key . ': ' . $val . "\n";
        }

        if ($this->getPostBody()) {
            $str .= "\n";
            $str .= $this->getPostBody();
        }

        $headers = '';
        foreach ($this->batchHeaders as $key => $val) {
            $headers .= $key . ': ' . $val . "\n";
        }

        $headers .= "Content-ID: $id\n";
        $str     = $headers . "\n" . $str;

        return $str;
    }

    /**
     * Our own version of parse_str that allows for multiple variables
     * with the same name.
     *
     * @param $string - the query string to parse
     */
    private function parseQuery($string) {
        $return = array();
        $parts  = explode("&", $string);
        foreach ($parts as $part) {
            list($key, $value) = explode('=', $part, 2);
            $value = urldecode($value);
            if (isset($return[$key])) {
                if (!is_array($return[$key])) {
                    $return[$key] = array($return[$key]);
                }
                $return[$key][] = $value;
            } else {
                $return[$key] = $value;
            }
        }

        return $return;
    }

    /**
     * A version of build query that allows for multiple
     * duplicate keys.
     *
     * @param $parts array of key value pairs
     */
    private function buildQuery($parts) {
        $return = array();
        foreach ($parts as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $v) {
                    $return[] = urlencode($key) . "=" . urlencode($v);
                }
            } else {
                $return[] = urlencode($key) . "=" . urlencode($value);
            }
        }

        return implode('&', $return);
    }

    /**
     * If we're POSTing and have no body to send, we can send the query
     * parameters in there, which avoids length issues with longer query
     * params.
     */
    public function maybeMoveParametersToBody() {
        if ($this->getRequestMethod() == "POST" && empty($this->postBody)) {
            $this->setRequestHeaders(array(
                "content-type" => "application/x-www-form-urlencoded; charset=UTF-8"
            ));
            $this->setPostBody($this->buildQuery($this->queryParams));
            $this->queryParams = array();
        }
    }
}
Generator/Common/YouTube/googleclient/Http/Google_Http_REST.php000064400000014217152355233130020500 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Service\Google_Service_Exception;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Task\Google_Task_Runner;

/**
 * This class implements the RESTful transport of apiServiceRequest()'s
 *
 * @author Chris Chabot <chabotc@google.com>
 * @author Chirag Shah <chirags@google.com>
 */
class Google_Http_REST {

    /**
     * Executes a Google_Http_Request and (if applicable) automatically retries
     * when errors occur.
     *
     * @param Google_Client       $client
     * @param Google_Http_Request $req
     *
     * @return array decoded result
     * @throws Google_Service_Exception on server side error (ie: not authenticated,
     *  invalid or malformed post body, invalid url)
     */
    public static function execute(Google_Client $client, Google_Http_Request $req) {
        $runner = new Google_Task_Runner($client, sprintf('%s %s', $req->getRequestMethod(), $req->getUrl()), array(
            get_class(),
            'doExecute'
        ), array(
            $client,
            $req
        ));

        return $runner->run();
    }

    /**
     * Executes a Google_Http_Request
     *
     * @param Google_Client       $client
     * @param Google_Http_Request $req
     *
     * @return array decoded result
     * @throws Google_Service_Exception on server side error (ie: not authenticated,
     *  invalid or malformed post body, invalid url)
     */
    public static function doExecute(Google_Client $client, Google_Http_Request $req) {
        $httpRequest = $client->getIo()
                              ->makeRequest($req);
        $httpRequest->setExpectedClass($req->getExpectedClass());

        return self::decodeHttpResponse($httpRequest, $client);
    }

    /**
     * Decode an HTTP Response.
     *
     * @static
     *
     * @param Google_Http_Request $response The http response to be decoded.
     * @param Google_Client       $client
     *
     * @return mixed|null
     * @throws Google_Service_Exception
     *
     */
    public static function decodeHttpResponse($response, Google_Client $client = null) {
        $code    = $response->getResponseHttpCode();
        $body    = $response->getResponseBody();
        $decoded = null;

        if ((intVal($code)) >= 300) {
            $decoded = json_decode($body, true);
            $err     = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl();
            if (isset($decoded['error']) && isset($decoded['error']['message']) && isset($decoded['error']['code'])) {
                // if we're getting a json encoded error definition, use that instead of the raw response
                // body for improved readability
                $err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}";
            } else {
                $err .= ": ($code) $body";
            }

            $errors = null;
            // Specific check for APIs which don't return error details, such as Blogger.
            if (isset($decoded['error']) && isset($decoded['error']['errors'])) {
                $errors = $decoded['error']['errors'];
            }

            $map = null;
            if ($client) {
                $client->getLogger()
                       ->error($err, array(
                           'code'   => $code,
                           'errors' => $errors
                       ));

                $map = $client->getClassConfig('Google_Service_Exception', 'retry_map');
            }
            throw new Google_Service_Exception($err, $code, null, $errors, $map);
        }

        // Only attempt to decode the response, if the response code wasn't (204) 'no content'
        if ($code != '204') {
            $decoded = json_decode($body, true);
            if ($decoded === null || $decoded === "") {
                $error = "Invalid json in service response: $body";
                if ($client) {
                    $client->getLogger()
                           ->error($error);
                }
                throw new Google_Service_Exception($error);
            }

            if ($response->getExpectedClass()) {
                $class   = $response->getExpectedClass();
                $decoded = new $class($decoded);
            }
        }

        return $decoded;
    }

    /**
     * Parse/expand request parameters and create a fully qualified
     * request uri.
     *
     * @static
     *
     * @param string $servicePath
     * @param string $restPath
     * @param array  $params
     *
     * @return string $requestUrl
     */
    public static function createRequestUri($servicePath, $restPath, $params) {
        $requestUrl      = $servicePath . $restPath;
        $uriTemplateVars = array();
        $queryVars       = array();
        foreach ($params as $paramName => $paramSpec) {
            if ($paramSpec['type'] == 'boolean') {
                $paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false';
            }
            if ($paramSpec['location'] == 'path') {
                $uriTemplateVars[$paramName] = $paramSpec['value'];
            } else if ($paramSpec['location'] == 'query') {
                if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
                    foreach ($paramSpec['value'] as $value) {
                        $queryVars[] = $paramName . '=' . rawurlencode($value);
                    }
                } else {
                    $queryVars[] = $paramName . '=' . rawurlencode($paramSpec['value']);
                }
            }
        }

        if (count($uriTemplateVars)) {
            $uriTemplateParser = new Google_Utils_URITemplate();
            $requestUrl        = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
        }

        if (count($queryVars)) {
            $requestUrl .= '?' . implode('&', $queryVars);
        }

        return $requestUrl;
    }
}
Generator/Common/YouTube/googleclient/Auth/Google_Auth_Abstract.php000064400000001463152355233130021431 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Auth;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_Request;

/**
 * Abstract class for the Authentication in the API client
 *
 * @author Chris Chabot <chabotc@google.com>
 *
 */
abstract class Google_Auth_Abstract {

    /**
     * An utility function that first calls $this->auth->sign($request) and then
     * executes makeRequest() on that signed request. Used for when a request
     * should be authenticated
     *
     * @param Google_Http_Request $request
     *
     * @return Google_Http_Request $request
     */
    abstract public function authenticatedRequest(Google_Http_Request $request);

    abstract public function sign(Google_Http_Request $request);
}
Generator/Common/YouTube/googleclient/Auth/Google_Auth_Exception.php000064400000000356152355233130021624 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Auth;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Exception;

class Google_Auth_Exception extends Google_Exception {

}
Generator/Common/YouTube/googleclient/Auth/Google_Auth_OAuth2.php000064400000050435152355233130020773 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Auth;

use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Google_Client;
use Nextend\SmartSlider3Pro\Generator\Common\YouTube\googleclient\Http\Google_Http_Request;

/**
 * Authentication class that deals with the OAuth 2 web-server authentication flow
 *
 * @author Chris Chabot <chabotc@google.com>
 * @author Chirag Shah <chirags@google.com>
 *
 */
class Google_Auth_OAuth2 extends Google_Auth_Abstract {

    const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
    const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
    const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
    const CLOCK_SKEW_SECS = 300; // five minutes in seconds
    const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
    const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
    const OAUTH2_ISSUER = 'accounts.google.com';

    /** @var Google_Auth_AssertionCredentials $assertionCredentials */
    private $assertionCredentials;

    /**
     * @var string The state parameters for CSRF and other forgery protection.
     */
    private $state;

    /**
     * @var array The token bundle.
     */
    private $token = array();

    /**
     * @var Google_Client the base client
     */
    private $client;

    /**
     * Instantiates the class, but does not initiate the login flow, leaving it
     * to the discretion of the caller.
     */
    public function __construct(Google_Client $client) {
        $this->client = $client;
    }

    /**
     * Perform an authenticated / signed apiHttpRequest.
     * This function takes the apiHttpRequest, calls apiAuth->sign on it
     * (which can modify the request in what ever way fits the auth mechanism)
     * and then calls apiCurlIO::makeRequest on the signed request
     *
     * @param Google_Http_Request $request
     *
     * @return Google_Http_Request The resulting HTTP response including the
     * responseHttpCode, responseHeaders and responseBody.
     */
    public function authenticatedRequest(Google_Http_Request $request) {
        $request = $this->sign($request);

        return $this->client->getIo()
                            ->makeRequest($request);
    }

    /**
     * @param string $code
     *
     * @return string
     * @throws Google_Auth_Exception
     */
    public function authenticate($code) {
        if (strlen($code) == 0) {
            throw new Google_Auth_Exception("Invalid code");
        }

        // We got here from the redirect from a successful authorization grant,
        // fetch the access token
        $request = new Google_Http_Request(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
            'code'          => $code,
            'grant_type'    => 'authorization_code',
            'redirect_uri'  => $this->client->getClassConfig($this, 'redirect_uri'),
            'client_id'     => $this->client->getClassConfig($this, 'client_id'),
            'client_secret' => $this->client->getClassConfig($this, 'client_secret')
        ));
        $request->disableGzip();
        $response = $this->client->getIo()
                                 ->makeRequest($request);

        if ($response->getResponseHttpCode() == 200) {
            $this->setAccessToken($response->getResponseBody());
            $this->token['created'] = time();

            return $this->getAccessToken();
        } else {
            $decodedResponse = json_decode($response->getResponseBody(), true);
            if ($decodedResponse != null && $decodedResponse['error']) {
                $errorText = $decodedResponse['error'];
                if (isset($decodedResponse['error_description'])) {
                    $errorText .= ": " . $decodedResponse['error_description'];
                }
            }
            throw new Google_Auth_Exception(sprintf("Error fetching OAuth2 access token, message: '%s'", $errorText), $response->getResponseHttpCode());
        }
    }

    /**
     * Create a URL to obtain user authorization.
     * The authorization endpoint allows the user to first
     * authenticate, and then grant/deny the access request.
     *
     * @param string $scope The scope is expressed as a list of space-delimited strings.
     *
     * @return string
     */
    public function createAuthUrl($scope) {
        $params = array(
            'response_type' => 'code',
            'redirect_uri'  => $this->client->getClassConfig($this, 'redirect_uri'),
            'client_id'     => $this->client->getClassConfig($this, 'client_id'),
            'scope'         => $scope,
            'access_type'   => $this->client->getClassConfig($this, 'access_type'),
        );

        // Prefer prompt to approval prompt.
        if ($this->client->getClassConfig($this, 'prompt')) {
            $params = $this->maybeAddParam($params, 'prompt');
        } else {
            $params = $this->maybeAddParam($params, 'approval_prompt');
        }
        $params = $this->maybeAddParam($params, 'login_hint');
        $params = $this->maybeAddParam($params, 'hd');
        $params = $this->maybeAddParam($params, 'openid.realm');
        $params = $this->maybeAddParam($params, 'include_granted_scopes');

        // If the list of scopes contains plus.login, add request_visible_actions
        // to auth URL.
        $rva = $this->client->getClassConfig($this, 'request_visible_actions');
        if (strpos($scope, 'plus.login') && strlen($rva) > 0) {
            $params['request_visible_actions'] = $rva;
        }

        if (isset($this->state)) {
            $params['state'] = $this->state;
        }

        return self::OAUTH2_AUTH_URL . "?" . http_build_query($params, '', '&');
    }

    /**
     * @param string $token
     *
     * @throws Google_Auth_Exception
     */
    public function setAccessToken($token) {
        $token = json_decode($token, true);
        if ($token == null) {
            throw new Google_Auth_Exception('Could not json decode the token');
        }
        if (!isset($token['access_token'])) {
            throw new Google_Auth_Exception("Invalid token format");
        }
        $this->token = $token;
    }

    public function getAccessToken() {
        return json_encode($this->token);
    }

    public function getRefreshToken() {
        if (array_key_exists('refresh_token', $this->token)) {
            return $this->token['refresh_token'];
        } else {
            return null;
        }
    }

    public function setState($state) {
        $this->state = $state;
    }

    public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds) {
        $this->assertionCredentials = $creds;
    }

    /**
     * Include an accessToken in a given apiHttpRequest.
     *
     * @param Google_Http_Request $request
     *
     * @return Google_Http_Request
     * @throws Google_Auth_Exception
     */
    public function sign(Google_Http_Request $request) {
        // add the developer key to the request before signing it
        if ($this->client->getClassConfig($this, 'developer_key')) {
            $request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key'));
        }

        // Cannot sign the request without an OAuth access token.
        if (null == $this->token && null == $this->assertionCredentials) {
            return $request;
        }

        // Check if the token is set to expire in the next 30 seconds
        // (or has already expired).
        if ($this->isAccessTokenExpired()) {
            if ($this->assertionCredentials) {
                $this->refreshTokenWithAssertion();
            } else {
                $this->client->getLogger()
                             ->debug('OAuth2 access token expired');
                if (!array_key_exists('refresh_token', $this->token)) {
                    $error = "The OAuth 2.0 access token has expired," . " and a refresh token is not available. Refresh tokens" . " are not returned for responses that were auto-approved.";

                    $this->client->getLogger()
                                 ->error($error);
                    throw new Google_Auth_Exception($error);
                }
                $this->refreshToken($this->token['refresh_token']);
            }
        }

        $this->client->getLogger()
                     ->debug('OAuth2 authentication');

        // Add the OAuth2 header to the request
        $request->setRequestHeaders(array('Authorization' => 'Bearer ' . $this->token['access_token']));

        return $request;
    }

    /**
     * Fetches a fresh access token with the given refresh token.
     *
     * @param string $refreshToken
     *
     * @return void
     */
    public function refreshToken($refreshToken) {
        $this->refreshTokenRequest(array(
            'client_id'     => $this->client->getClassConfig($this, 'client_id'),
            'client_secret' => $this->client->getClassConfig($this, 'client_secret'),
            'refresh_token' => $refreshToken,
            'grant_type'    => 'refresh_token'
        ));
    }

    /**
     * Fetches a fresh access token with a given assertion token.
     *
     * @param Google_Auth_AssertionCredentials $assertionCredentials optional.
     *
     * @return void
     */
    public function refreshTokenWithAssertion($assertionCredentials = null) {
        if (!$assertionCredentials) {
            $assertionCredentials = $this->assertionCredentials;
        }

        $cacheKey = $assertionCredentials->getCacheKey();

        if ($cacheKey) {
            // We can check whether we have a token available in the
            // cache. If it is expired, we can retrieve a new one from
            // the assertion.
            $token = $this->client->getCache()
                                  ->get($cacheKey);
            if ($token) {
                $this->setAccessToken($token);
            }
            if (!$this->isAccessTokenExpired()) {
                return;
            }
        }

        $this->client->getLogger()
                     ->debug('OAuth2 access token expired');
        $this->refreshTokenRequest(array(
            'grant_type'     => 'assertion',
            'assertion_type' => $assertionCredentials->assertionType,
            'assertion'      => $assertionCredentials->generateAssertion(),
        ));

        if ($cacheKey) {
            // Attempt to cache the token.
            $this->client->getCache()
                         ->set($cacheKey, $this->getAccessToken());
        }
    }

    private function refreshTokenRequest($params) {
        if (isset($params['assertion'])) {
            $this->client->getLogger()
                         ->info('OAuth2 access token refresh with Signed JWT assertion grants.');
        } else {
            $this->client->getLogger()
                         ->info('OAuth2 access token refresh');
        }

        $http = new Google_Http_Request(self::OAUTH2_TOKEN_URI, 'POST', array(), $params);
        $http->disableGzip();
        $request = $this->client->getIo()
                                ->makeRequest($http);

        $code = $request->getResponseHttpCode();
        $body = $request->getResponseBody();
        if (200 == $code) {
            $token = json_decode($body, true);
            if ($token == null) {
                throw new Google_Auth_Exception("Could not json decode the access token");
            }

            if (!isset($token['access_token']) || !isset($token['expires_in'])) {
                throw new Google_Auth_Exception("Invalid token format");
            }

            if (isset($token['id_token'])) {
                $this->token['id_token'] = $token['id_token'];
            }
            $this->token['access_token'] = $token['access_token'];
            $this->token['expires_in']   = $token['expires_in'];
            $this->token['created']      = time();
        } else {
            throw new Google_Auth_Exception("Error refreshing the OAuth2 token, message: '$body'", $code);
        }
    }

    /**
     * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
     * token, if a token isn't provided.
     *
     * @param string|null $token The token (access token or a refresh token) that should be revoked.
     *
     * @return boolean Returns True if the revocation was successful, otherwise False.
     * @throws Google_Auth_Exception
     *
     */
    public function revokeToken($token = null) {
        if (!$token) {
            if (!$this->token) {
                // Not initialized, no token to actually revoke
                return false;
            } elseif (array_key_exists('refresh_token', $this->token)) {
                $token = $this->token['refresh_token'];
            } else {
                $token = $this->token['access_token'];
            }
        }
        $request = new Google_Http_Request(self::OAUTH2_REVOKE_URI, 'POST', array(), "token=$token");
        $request->disableGzip();
        $response = $this->client->getIo()
                                 ->makeRequest($request);
        $code     = $response->getResponseHttpCode();
        if ($code == 200) {
            $this->token = null;

            return true;
        }

        return false;
    }

    /**
     * Returns if the access_token is expired.
     *
     * @return bool Returns True if the access_token is expired.
     */
    public function isAccessTokenExpired() {
        if (!$this->token || !isset($this->token['created'])) {
            return true;
        }

        // If the token is set to expire in the next 30 seconds.
        $expired = ($this->token['created'] + ($this->token['expires_in'] - 30)) < time();

        return $expired;
    }

    // Gets federated sign-on certificates to use for verifying identity tokens.
    // Returns certs as array structure, where keys are key ids, and values
    // are PEM encoded certificates.
    private function getFederatedSignOnCerts() {
        return $this->retrieveCertsFromLocation($this->client->getClassConfig($this, 'federated_signon_certs_url'));
    }

    /**
     * Retrieve and cache a certificates file.
     *
     * @param $url string location
     *
     * @return array certificates
     * @throws Google_Auth_Exception
     */
    public function retrieveCertsFromLocation($url) {
        // If we're retrieving a local file, just grab it.
        if ("http" != substr($url, 0, 4)) {
            $file = file_get_contents($url);
            if ($file) {
                return json_decode($file, true);
            } else {
                throw new Google_Auth_Exception("Failed to retrieve verification certificates: '" . $url . "'.");
            }
        }

        // This relies on makeRequest caching certificate responses.
        $request = $this->client->getIo()
                                ->makeRequest(new Google_Http_Request($url));
        if ($request->getResponseHttpCode() == 200) {
            $certs = json_decode($request->getResponseBody(), true);
            if ($certs) {
                return $certs;
            }
        }
        throw new Google_Auth_Exception("Failed to retrieve verification certificates: '" . $request->getResponseBody() . "'.", $request->getResponseHttpCode());
    }

    /**
     * Verifies an id token and returns the authenticated apiLoginTicket.
     * Throws an exception if the id token is not valid.
     * The audience parameter can be used to control which id tokens are
     * accepted.  By default, the id token must have been issued to this OAuth2 client.
     *
     * @param $id_token
     * @param $audience
     *
     * @return Google_Auth_LoginTicket
     */
    public function verifyIdToken($id_token = null, $audience = null) {
        if (!$id_token) {
            $id_token = $this->token['id_token'];
        }
        $certs = $this->getFederatedSignonCerts();
        if (!$audience) {
            $audience = $this->client->getClassConfig($this, 'client_id');
        }

        return $this->verifySignedJwtWithCerts($id_token, $certs, $audience, self::OAUTH2_ISSUER);
    }

    /**
     * Verifies the id token, returns the verified token contents.
     *
     * @param $jwt               string the token
     * @param $certs             array of certificates
     * @param $required_audience string the expected consumer of the token
     * @param [$issuer] the expected issues, defaults to Google
     * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
     *
     * @return mixed token information if valid, false if not
     * @throws Google_Auth_Exception
     */
    public function verifySignedJwtWithCerts($jwt, $certs, $required_audience, $issuer = null, $max_expiry = null) {
        if (!$max_expiry) {
            // Set the maximum time we will accept a token for.
            $max_expiry = self::MAX_TOKEN_LIFETIME_SECS;
        }

        $segments = explode(".", $jwt);
        if (count($segments) != 3) {
            throw new Google_Auth_Exception("Wrong number of segments in token: $jwt");
        }
        $signed    = $segments[0] . "." . $segments[1];
        $signature = Google_Utils::urlSafeB64Decode($segments[2]);

        // Parse envelope.
        $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
        if (!$envelope) {
            throw new Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
        }

        // Parse token
        $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
        $payload   = json_decode($json_body, true);
        if (!$payload) {
            throw new Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
        }

        // Check signature
        $verified = false;
        foreach ($certs as $keyName => $pem) {
            $public_key = new Google_Verifier_Pem($pem);
            if ($public_key->verify($signed, $signature)) {
                $verified = true;
                break;
            }
        }

        if (!$verified) {
            throw new Google_Auth_Exception("Invalid token signature: $jwt");
        }

        // Check issued-at timestamp
        $iat = 0;
        if (array_key_exists("iat", $payload)) {
            $iat = $payload["iat"];
        }
        if (!$iat) {
            throw new Google_Auth_Exception("No issue time in token: $json_body");
        }
        $earliest = $iat - self::CLOCK_SKEW_SECS;

        // Check expiration timestamp
        $now = time();
        $exp = 0;
        if (array_key_exists("exp", $payload)) {
            $exp = $payload["exp"];
        }
        if (!$exp) {
            throw new Google_Auth_Exception("No expiration time in token: $json_body");
        }
        if ($exp >= $now + $max_expiry) {
            throw new Google_Auth_Exception(sprintf("Expiration time too far in future: %s", $json_body));
        }

        $latest = $exp + self::CLOCK_SKEW_SECS;
        if ($now < $earliest) {
            throw new Google_Auth_Exception(sprintf("Token used too early, %s < %s: %s", $now, $earliest, $json_body));
        }
        if ($now > $latest) {
            throw new Google_Auth_Exception(sprintf("Token used too late, %s > %s: %s", $now, $latest, $json_body));
        }

        $iss = $payload['iss'];
        if ($issuer && $iss != $issuer) {
            throw new Google_Auth_Exception(sprintf("Invalid issuer, %s != %s: %s", $iss, $issuer, $json_body));
        }

        // Check audience
        $aud = $payload["aud"];
        if ($aud != $required_audience) {
            throw new Google_Auth_Exception(sprintf("Wrong recipient, %s != %s:", $aud, $required_audience, $json_body));
        }

        // All good.
        return new Google_Auth_LoginTicket($envelope, $payload);
    }

    /**
     * Add a parameter to the auth params if not empty string.
     */
    private function maybeAddParam($params, $name) {
        $param = $this->client->getClassConfig($this, $name);
        if ($param != '') {
            $params[$name] = $param;
        }

        return $params;
    }
}
Generator/Common/YouTube/Elements/YouTubePlaylistByUser.php000064400000003731152355233130020061 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\Elements;

use Exception;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;

class YouTubePlaylistByUser extends Select {

    /** @var  N2SliderGeneratorYouTubeConfiguration */
    protected $config;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        try {
            $playlists = $this->config->getPlaylists($this->config->getApi(), $this->getForm()
                                                                                   ->get('channel-id', ''));

            foreach ($playlists as $k => $item) {
                $this->options[$item['id']] = $item['snippet']['title'];
            }

            if (!isset($this->options[$this->getValue()])) {
                $this->setValue($playlists[0]['id']);
            }

        } catch (Exception $e) {
            Notification::error($e->getMessage());
        }


    }

    protected function fetchElement() {

        $getDataUrl = $this->getForm()
                           ->createAjaxUrl(array(
                               "generator/getData",
                               array(
                                   'group' => Request::$REQUEST->getVar('group'),
                                   'type'  => Request::$REQUEST->getVar('type')
                               )
                           ));

        Js::addInline('
            new _N2.FormElementYouTubePlaylists("' . $this->fieldID . '", "' . $getDataUrl . '");
        ');

        return parent::fetchElement();
    }

    /**
     * @param N2SliderGeneratorYouTubeConfiguration $config
     */
    public function setConfig($config) {
        $this->config = $config;
    }
}
Generator/Common/YouTube/Elements/YouTubeToken.php000064400000001722152355233130016204 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\YouTube\Elements;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Request\Request;

class YouTubeToken extends Text {

    protected function fetchElement() {

        $authUrl = $this->getForm()
                        ->createAjaxUrl(array(
                            "generator/getAuthUrl",
                            array(
                                'group' => Request::$REQUEST->getVar('group'),
                                'type'  => Request::$REQUEST->getVar('type')
                            )
                        ));

        Js::addInline('new _N2.FormElementYoutubeToken("' . $this->fieldID . '", "' . $authUrl . '");');

        return parent::fetchElement();
    }

    protected function post() {
        return '<a class="n2_field_text__choose_text" href="#">' . n2_('Request token') . '</a>';
    }
}


Generator/Common/Vimeo/ConfigurationVimeo.php000064400000015342152355233130015330 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Vimeo;

use Exception;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Token;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\Framework\Router\Router;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroupConfiguration;
use Nextend\SmartSlider3Pro\Generator\Common\Vimeo\Elements\VimeoToken;
use Vimeo\Vimeo;

class ConfigurationVimeo extends AbstractGeneratorGroupConfiguration {

    private $data;

    /**
     * N2SliderGeneratorVimeoConfiguration constructor.
     *
     * @param GeneratorGroupVimeo $group
     */
    public function __construct($group) {
        parent::__construct($group);
        $this->data = new Data(array(
            'client_id'     => '',
            'client_secret' => '',
            'access_token'  => ''
        ));

        $this->data->loadJSON(StorageSectionManager::getStorage('smartslider')
                                                   ->get('vimeo'));

    }

    public function wellConfigured() {
        if (!$this->data->get('client_id') || !$this->data->get('client_secret') || !$this->data->get('access_token')) {
            return false;
        }
        $client = $this->getApi();

        $response = $client->request('/oauth/verify');
        if ($response['status'] == 200) {
            return true;
        }

        return false;
    }

    /**
     *
     * @return Vimeo
     */
    public function getApi() {

        require_once(dirname(__FILE__) . "/api/Exceptions/ExceptionInterface.php");
        require_once(dirname(__FILE__) . "/api/Exceptions/VimeoRequestException.php");
        require_once(dirname(__FILE__) . "/api/Exceptions/VimeoUploadException.php");
        require_once(dirname(__FILE__) . "/api/Vimeo.php");

        $client = new Vimeo($this->data->get('client_id'), $this->data->get('client_secret'));

        $client->clientCredentials('private');

        $client->setToken($this->data->get('access_token'));

        return $client;
    }

    public function getData() {
        return $this->data->toArray();
    }

    public function addData($data, $store = true) {
        $this->data->loadArray($data);
        if ($store) {
            StorageSectionManager::getStorage('smartslider')
                                 ->set('vimeo', null, json_encode($this->data->toArray()));
        }
    }

    public function render($MVCHelper) {
        $form = new Form($MVCHelper, 'generator');
        $form->loadArray($this->getData());

        $table = new ContainerTable($form->getContainer(), 'vimeo-generator', 'Vimeo api');

        $instruction     = $table->createRow('vimeo-instruction');
        $instructionText = sprintf(n2_('%2$s Check the documentation %3$s to learn how to configure your %1$s app.'), 'Vimeo', '<a href="https://smartslider.helpscoutdocs.com/article/1912-vimeo-generator" target="_blank">', '</a>');
        new Notice($instruction, 'instruction', n2_('Instruction'), $instructionText);

        $settings = $table->createRow('vimeo');
        new Text($settings, 'client_id', 'Client identifier', '', array(
            'style' => 'width:400px;'
        ));
        new Text($settings, 'client_secret', 'Client secret', '', array(
            'style' => 'width:400px;'
        ));
        new VimeoToken($settings, 'access_token', n2_('Token'));
        new Notice($settings, 'callback', n2_('Callback url'), $this->getCallbackUrl($MVCHelper->getRouter()));
        new Token($settings);

        $form->render();

        if ($this->data->get('client_id') != '' && $this->data->get('client_secret') != '') {
            try {
                $client = $this->getApi();

                $response = $client->request('/oauth/verify');
                if ($response['status'] != 200) {
                    if (!empty($response['body']['error'])) {
                        Notification::error($response['body']['error']);
                    }
                }
            } catch (Exception $e) {
                Notification::error($e->getMessage());
            }
        }
    }

    public function startAuth($MVCHelper) {
        if (session_id() == "") {
            session_start();
        }
        $this->addData(Request::$REQUEST->getVar('generator'), false);

        $_SESSION['data']       = $this->getData();
        $_SESSION['vimeostate'] = rand();

        $client = $this->getApi();

        $FinishAuthUrl = $MVCHelper->createUrl(array(
            "generator/finishAuth",
            array(
                'group' => 'vimeo'
            )
        ));

        return $client->buildAuthorizationEndpoint($FinishAuthUrl, array('private'), $_SESSION['vimeostate']);
    }

    public function finishAuth($MVCHelper) {
        if (session_id() == "") {
            session_start();
        }
        if (Request::$REQUEST->getInt('state') !== 0 && isset($_SESSION['vimeostate']) && Request::$REQUEST->getInt('state') == $_SESSION['vimeostate']) {
            $this->addData($_SESSION['data'], false);
            unset($_SESSION['data']);
            unset($_SESSION['vimeostate']);
            try {
                $client = $this->getApi();
                $client->setToken('');
                $FinishAuthUrl = $MVCHelper->createUrl(array(
                    "generator/finishAuth",
                    array(
                        'group' => 'vimeo'
                    )
                ));

                $response = $client->accessToken(Request::$REQUEST->getVar('code'), $FinishAuthUrl);

                if ($response['status'] == 200) {
                    $this->data->set('access_token', $response['body']['access_token']);
                    $client->setToken($response['body']['access_token']);
                    $this->addData($this->getData());

                    return true;
                } else {
                    return $client->response['body']['error_description'];
                }
            } catch (Exception $e) {
                return $e->getMessage();
            }
        } else {
            return 'State does not match!';
        }
    }

    /**
     * @param Router $router
     *
     * @return string
     */
    private function getCallbackUrl($router) {
        return $router->createUrl(array(
            "generator/finishAuth",
            array(
                'group' => 'vimeo'
            )
        ));
    }
}Generator/Common/Vimeo/GeneratorGroupVimeo.php000064400000001411152355233130015454 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Vimeo;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Vimeo\Sources\VimeoAlbum;

class GeneratorGroupVimeo extends AbstractGeneratorGroup {

    protected $name = 'vimeo';

    protected $needConfiguration = true;

    public function __construct() {
        parent::__construct();

        $this->configuration = new ConfigurationVimeo($this);
    }

    public function getLabel() {
        return 'Vimeo';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Vimeo');
    }

    protected function loadSources() {

        new VimeoAlbum($this, 'album', 'Showcase');
    }
}
Generator/Common/Vimeo/Sources/VimeoAlbum.php000064400000006770152355233130015211 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Vimeo\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\Vimeo\Elements\VimeoAlbums;
use Vimeo\Vimeo;

class VimeoAlbum extends AbstractGenerator {

    protected $layout = 'vimeo';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Vimeo');
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new VimeoAlbums($filter, 'album', 'Showcase', '', array(
            'api' => $this->group->getConfiguration()
                                 ->getApi()
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'vimeoorder', '|*|asc', array(
            'options' => array(
                ''              => n2_('None'),
                'alphabetical'  => n2_('Alphabetic'),
                'comments'      => n2_('Comments'),
                'date'          => n2_('Date'),
                'default'       => n2_('Default'),
                'duration'      => n2_('Duration'),
                'likes'         => n2_('Likes'),
                'manual'        => n2_('Manual'),
                'modified_time' => n2_('Modified time'),
                'plays'         => n2_('Plays')
            )
        ));
    }

    protected function _getData($count, $startIndex) {
        $data = array();
        /** @var Vimeo $api */
        $api = $this->group->getConfiguration()
                           ->getApi();

        $album = $this->data->get('album', '');
        if (!empty($album)) {
            $args = array(
                'per_page' => $startIndex + $count
            );

            $order = Common::parse($this->data->get('vimeoorder', '|*|asc'));
            if (!empty($order[0])) {
                $args['sort'] = $order[0];
            }

            $response = $api->request($album . '/videos', $args);

            if ($response['status'] == 200) {
                $videos = array_slice($response['body']['data'], $startIndex, $count);

                foreach ($videos as $video) {
                    $record = array();

                    $record['title']       = $video['name'];
                    $record['description'] = $video['description'];
                    $record['id']          = str_replace('/videos/', '', $video['uri']);
                    $record['url']         = $record['link'] = $video['link'];

                    foreach ($video['pictures']['sizes'] as $picture) {
                        $record['image' . $picture['width'] . 'x' . $picture['height']]     = $picture['link'];
                        $record['imageplay' . $picture['width'] . 'x' . $picture['height']] = $picture['link_with_play_button'];
                    }

                    $record['image'] = $record['image1920x1080'];

                    $data[] = &$record;
                    unset($record);
                }
            }
        }

        if ($order[1] == 'desc') {
            $data = array_reverse($data);
        }

        return $data;
    }
}Generator/Common/Vimeo/Elements/VimeoAlbums.php000064400000001772152355233130015522 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Vimeo\Elements;

use Nextend\Framework\Form\Element\Select;
use Vimeo\Vimeo;


class VimeoAlbums extends Select {

    /** @var  Vimeo */
    protected $api;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);


        $response = $this->api->request('/me/albums', array(
            'per_page' => 100
        ));

        if ($response['status'] == 200) {
            $albums = $response['body']['data'];
            foreach ($albums as $album) {
                $this->options[$album['uri']] = $album['name'];
            }

            if (!isset($this->options[$this->getValue()])) {
                $this->setValue($albums[0]['uri']);
            }
        }
    }

    /**
     * @param Vimeo $api
     */
    public function setApi($api) {
        $this->api = $api;
    }

}
Generator/Common/Vimeo/Elements/VimeoToken.php000064400000001702152355233130015350 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Vimeo\Elements;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Request\Request;

class VimeoToken extends Text {

    function fetchElement() {

        $authUrl = $this->getForm()
                        ->createAjaxUrl(array(
                            "generator/getAuthUrl",
                            array(
                                'group' => Request::$REQUEST->getVar('group'),
                                'type'  => Request::$REQUEST->getVar('type')
                            )
                        ));

        Js::addInline('new _N2.FormElementVimeoToken("' . $this->fieldID . '", "' . $authUrl . '");');

        return parent::fetchElement();
    }

    protected function post() {
        return '<a class="n2_field_text__choose_text" href="#">' . n2_('Request token') . '</a>';
    }
}


Generator/Common/Vimeo/api/Vimeo.php000064400000052205152355233130013350 0ustar00<?php

namespace Vimeo;

use Exception;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Misc\HttpClient;
use Vimeo\Exceptions\VimeoRequestException;
use Vimeo\Exceptions\VimeoUploadException;

/**
 *   Copyright 2013 Vimeo
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

if (!function_exists('json_decode')) {
    throw new Exception('We could not find json_decode. json_decode is found in php 5.2 and up, but may be missing on some Linux systems due to licensing conflicts. If you are running ubuntu try "sudo apt-get install php5-json".');
}

class Vimeo {

    const ROOT_ENDPOINT = 'https://api.vimeo.com';
    const AUTH_ENDPOINT = 'https://api.vimeo.com/oauth/authorize';
    const ACCESS_TOKEN_ENDPOINT = '/oauth/access_token';
    const CLIENT_CREDENTIALS_TOKEN_ENDPOINT = '/oauth/authorize/client';
    const REPLACE_ENDPOINT = '/files';
    const VERSION_STRING = 'application/vnd.vimeo.*+json; version=3.2';
    const USER_AGENT = 'vimeo.php 1.2.7; (http://developer.vimeo.com/api/docs)';

    protected $_curl_opts = array();
    protected $CURL_DEFAULTS = array();

    private $_client_id = null;
    private $_client_secret = null;
    private $_access_token = null;

    /**
     * Creates the Vimeo library, and tracks the client and token information.
     *
     * @param string $client_id     Your applications client id. Can be found on developer.vimeo.com/apps
     * @param string $client_secret Your applications client secret. Can be found on developer.vimeo.com/apps
     * @param string $access_token  Your applications client id. Can be found on developer.vimeo.com/apps or generated
     *                              using OAuth 2.
     */
    public function __construct($client_id, $client_secret, $access_token = null) {
        $this->_client_id     = $client_id;
        $this->_client_secret = $client_secret;
        $this->_access_token  = $access_token;
        $this->CURL_DEFAULTS  = array(
            CURLOPT_HEADER         => 1,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT        => 30,
            CURLOPT_SSL_VERIFYPEER => true,
            //Certificate must indicate that the server is the server to which you meant to connect.
            CURLOPT_SSL_VERIFYHOST => 2,
            CURLOPT_CAINFO         => HttpClient::getCacertPath()
        );
    }

    /**
     * Make an API request to Vimeo.
     *
     * @param string $url     A Vimeo API Endpoint. Should not include the host
     * @param array  $params  An array of parameters to send to the endpoint. If the HTTP method is GET, they will be
     *                        added to the url, otherwise they will be written to the body
     * @param string $method  The HTTP Method of the request
     * @param bool   $json_body
     * @param array  $headers An array of HTTP headers to pass along with the request.
     *
     * @return array This array contains three keys, 'status' is the status code, 'body' is an object representation of
     *               the json response body, and headers are an associated array of response headers
     */
    public function request($url, $params = array(), $method = 'GET', $json_body = true, array $headers = array()) {
        $headers = array_merge(array(
            'Accept'     => self::VERSION_STRING,
            'User-Agent' => self::USER_AGENT,
        ), $headers);

        $method = strtoupper($method);

        // add bearer token, or client information
        if (!empty($this->_access_token)) {
            $headers['Authorization'] = 'Bearer ' . $this->_access_token;
        } else {
            //  this may be a call to get the tokens, so we add the client info.
            $headers['Authorization'] = 'Basic ' . $this->_authHeader();
        }

        //  Set the methods, determine the URL that we should actually request and prep the body.
        $curl_opts = array();
        switch ($method) {
            case 'GET':
                if (!empty($params)) {
                    $query_component = '?' . http_build_query($params, '', '&');
                } else {
                    $query_component = '';
                }

                $curl_url = self::ROOT_ENDPOINT . $url . $query_component;
                break;

            case 'POST':
            case 'PATCH':
            case 'PUT':
            case 'DELETE':
                if ($json_body && !empty($params)) {
                    $headers['Content-Type'] = 'application/json';
                    $body                    = json_encode($params);
                } else {
                    $body = http_build_query($params, '', '&');
                }

                $curl_url  = self::ROOT_ENDPOINT . $url;
                $curl_opts = array(
                    CURLOPT_POST          => true,
                    CURLOPT_CUSTOMREQUEST => $method,
                    CURLOPT_POSTFIELDS    => $body
                );
                break;
        }

        // Set the headers
        foreach ($headers as $key => $value) {
            $curl_opts[CURLOPT_HTTPHEADER][] = sprintf('%s: %s', $key, $value);
        }

        $response = $this->_request($curl_url, $curl_opts);

        $response['body'] = json_decode($response['body'], true);

        return $response;
    }

    /**
     * Request the access token associated with this library.
     *
     * @return string
     */
    public function getToken() {
        return $this->_access_token;
    }

    /**
     * Assign a new access token to this library.
     *
     * @param string $access_token the new access token
     */
    public function setToken($access_token) {
        $this->_access_token = $access_token;
    }

    /**
     * Sets custom cURL options.
     *
     * @param array $curl_opts An associative array of cURL options.
     */
    public function setCURLOptions($curl_opts = array()) {
        $this->_curl_opts = $curl_opts;
    }

    /**
     * Convert the raw headers string into an associated array
     *
     * @param string $headers
     *
     * @return array
     */
    public static function parse_headers($headers) {
        $final_headers = array();
        $list          = explode("\n", trim($headers));

        $http = array_shift($list);

        foreach ($list as $header) {
            $parts                          = explode(':', $header, 2);
            $final_headers[trim($parts[0])] = isset($parts[1]) ? trim($parts[1]) : '';
        }

        return $final_headers;
    }

    /**
     * Request an access token. This is the final step of the
     * OAuth 2 workflow, and should be called from your redirect url.
     *
     * @param string $code         The authorization code that was provided to your redirect url
     * @param string $redirect_uri The redirect_uri that is configured on your app page, and was used in
     *                             buildAuthorizationEndpoint
     *
     * @return array This array contains three keys, 'status' is the status code, 'body' is an object representation of
     *               the json response body, and headers are an associated array of response headers
     */
    public function accessToken($code, $redirect_uri) {
        return $this->request(self::ACCESS_TOKEN_ENDPOINT, array(
            'grant_type'   => 'authorization_code',
            'code'         => $code,
            'redirect_uri' => $redirect_uri
        ), "POST", false);
    }

    /**
     * Get client credentials for requests.
     *
     * @param mixed $scope Scopes to request for this token from the server.
     *
     * @return array Response from the server with the tokens, we also set it into this object.
     */
    public function clientCredentials($scope = 'public') {
        if (is_array($scope)) {
            $scope = implode(' ', $scope);
        }

        $token_response = $this->request(self::CLIENT_CREDENTIALS_TOKEN_ENDPOINT, array(
            'grant_type' => 'client_credentials',
            'scope'      => $scope
        ), "POST", false);

        return $token_response;
    }

    /**
     * Build the url that your user.
     *
     * @param string $redirect_uri The redirect url that you have configured on your app page
     * @param string $scope        An array of scopes that your final access token needs to access
     * @param string $state        A random variable that will be returned on your redirect url. You should validate
     *                             that this matches
     *
     * @return string
     */
    public function buildAuthorizationEndpoint($redirect_uri, $scope = 'public', $state = null) {
        $query = array(
            "response_type" => 'code',
            "client_id"     => $this->_client_id,
            "redirect_uri"  => $redirect_uri
        );

        $query['scope'] = $scope;
        if (empty($scope)) {
            $query['scope'] = 'public';
        } elseif (is_array($scope)) {
            $query['scope'] = implode(' ', $scope);
        }

        if (!empty($state)) {
            $query['state'] = $state;
        }

        return self::AUTH_ENDPOINT . '?' . http_build_query($query);
    }

    /**
     * Upload a file. This should be used to upload a local file.
     * If you want a form for your site to upload direct to Vimeo,
     * you should look at the POST /me/videos endpoint.
     *
     * @param string  $file_path       Path to the video file to upload.
     * @param boolean $upgrade_to_1080 Should we automatically upgrade the video file to 1080p
     *
     * @return string Video URI
     * @throws VimeoUploadException
     */
    public function upload($file_path, $upgrade_to_1080 = false, $machine_id = null) {
        // Validate that our file is real.
        if (!is_file($file_path)) {
            throw new VimeoUploadException('Unable to locate file to upload.');
        }

        // Begin the upload request by getting a ticket
        $ticket_args = array(
            'type'            => 'streaming',
            'upgrade_to_1080' => $upgrade_to_1080
        );
        if ($machine_id !== null) {
            $ticket_args['machine_id'] = $machine_id;
        }
        $ticket = $this->request('/me/videos', $ticket_args, 'POST');

        return $this->perform_upload($file_path, $ticket);
    }

    /**
     * Replace the source of a single Vimeo video.
     *
     * @param string  $video_uri       Video uri of the video file to replace.
     * @param string  $file_path       Path to the video file to upload.
     * @param boolean $upgrade_to_1080 Should we automatically upgrade the video file to 1080p
     *
     * @return string Status
     * @throws VimeoUploadException
     */
    public function replace($video_uri, $file_path, $upgrade_to_1080 = false, $machine_id = null) {
        //  Validate that our file is real.
        if (!is_file($file_path)) {
            throw new VimeoUploadException('Unable to locate file to upload.');
        }

        $uri = $video_uri . self::REPLACE_ENDPOINT;

        // Begin the upload request by getting a ticket
        $ticket_args = array(
            'type'            => 'streaming',
            'upgrade_to_1080' => $upgrade_to_1080
        );
        if ($machine_id !== null) {
            $ticket_args['machine_id'] = $machine_id;
        }
        $ticket = $this->request($uri, $ticket_args, 'PUT');

        return $this->perform_upload($file_path, $ticket);
    }

    /**
     * Uploads an image to an individual picture response.
     *
     * @param string  $pictures_uri The pictures endpoint for a resource that allows picture uploads (eg videos and
     *                              users)
     * @param string  $file_path    The path to your image file
     * @param boolean $activate     Activate image after upload
     *
     * @return string The URI of the uploaded image.
     * @throws VimeoUploadException
     */
    public function uploadImage($pictures_uri, $file_path, $activate = false) {
        // Validate that our file is real.
        if (!is_file($file_path)) {
            throw new VimeoUploadException('Unable to locate file to upload.');
        }

        $pictures_response = $this->request($pictures_uri, array(), 'POST');
        if ($pictures_response['status'] !== 201) {
            throw new VimeoUploadException('Unable to request an upload url from vimeo');
        }

        $upload_url = $pictures_response['body']['link'];

        $image_resource = fopen($file_path, 'r');

        $curl_opts = array(
            CURLOPT_TIMEOUT       => 240,
            CURLOPT_UPLOAD        => true,
            CURLOPT_CUSTOMREQUEST => 'PUT',
            CURLOPT_READDATA      => $image_resource
        );

        $curl = curl_init($upload_url);

        // Merge the options
        curl_setopt_array($curl, $curl_opts + $this->CURL_DEFAULTS);
        $response  = curl_exec($curl);
        $curl_info = curl_getinfo($curl);

        if (!$response) {
            $error = curl_error($curl);
            throw new VimeoUploadException($error);
        }
        curl_close($curl);

        if ($curl_info['http_code'] !== 200) {
            throw new VimeoUploadException($response);
        }

        // Activate the uploaded image
        if ($activate) {
            $completion = $this->request($pictures_response['body']['uri'], array('active' => true), 'PATCH');
        }

        return $pictures_response['body']['uri'];
    }

    /**
     * Uploads a text track.
     *
     * @param string $texttracks_uri The text tracks uri that we are adding our text track to
     * @param string $file_path      The path to your text track file
     * @param string $track_type     The type of your text track
     * @param string $language       The language of your text track
     *
     * @return string The URI of the uploaded text track.
     * @throws VimeoUploadException
     */
    public function uploadTexttrack($texttracks_uri, $file_path, $track_type, $language) {
        // Validate that our file is real.
        if (!is_file($file_path)) {
            throw new VimeoUploadException('Unable to locate file to upload.');
        }

        // To simplify the script we provide the filename as the text track name, but you can provide any value you want.
        $name = array_slice(explode("/", $file_path), -1);
        $name = $name[0];

        $texttrack_response = $this->request($texttracks_uri, array(
            'type'     => $track_type,
            'language' => $language,
            'name'     => $name
        ), 'POST');

        if ($texttrack_response['status'] !== 201) {
            throw new VimeoUploadException('Unable to request an upload url from vimeo');
        }

        $upload_url = $texttrack_response['body']['link'];

        $texttrack_resource = fopen($file_path, 'r');

        $curl_opts = array(
            CURLOPT_TIMEOUT       => 240,
            CURLOPT_UPLOAD        => true,
            CURLOPT_CUSTOMREQUEST => 'PUT',
            CURLOPT_READDATA      => $texttrack_resource
        );

        $curl = curl_init($upload_url);

        // Merge the options
        curl_setopt_array($curl, $curl_opts + $this->CURL_DEFAULTS);
        $response  = curl_exec($curl);
        $curl_info = curl_getinfo($curl);

        if (!$response) {
            $error = curl_error($curl);
            throw new VimeoUploadException($error);
        }
        curl_close($curl);

        if ($curl_info['http_code'] !== 200) {
            throw new VimeoUploadException($response);
        }

        return $texttrack_response['body']['uri'];
    }

    /**
     * Internal function to handle requests, both authenticated and by the upload function.
     *
     * @param string $url
     * @param array  $curl_opts
     *
     * @return array
     */
    private function _request($url, $curl_opts = array()) {
        // Merge the options (custom options take precedence).
        $curl_opts = $this->_curl_opts + $curl_opts + $this->CURL_DEFAULTS;

        // Call the API.
        $curl = curl_init($url);
        curl_setopt_array($curl, $curl_opts);
        $response  = curl_exec($curl);
        $curl_info = curl_getinfo($curl);

        if (isset($curl_info['http_code']) && $curl_info['http_code'] === 0) {
            $curl_error = curl_error($curl);
            $curl_error = !empty($curl_error) ? '[' . $curl_error . ']' : '';
            throw new VimeoRequestException('Unable to complete request.' . $curl_error);
        }

        curl_close($curl);

        // Retrieve the info
        $header_size = $curl_info['header_size'];
        $headers     = substr($response, 0, $header_size);
        $body        = substr($response, $header_size);

        // Return it raw.
        return array(
            'body'    => $body,
            'status'  => $curl_info['http_code'],
            'headers' => self::parse_headers($headers)
        );
    }

    /**
     * Get authorization header for retrieving tokens/credentials.
     *
     * @return string
     */
    private function _authHeader() {
        return Base64::encode($this->_client_id . ':' . $this->_client_secret);
    }

    /**
     * Take an upload ticket and perform the actual upload
     *
     * @param string $file_path Path to the video file to upload.
     * @param array  $ticket    Upload ticket data.
     *
     * @return string Video URI
     * @throws VimeoUploadException
     */
    private function perform_upload($file_path, $ticket) {
        if ($ticket['status'] !== 201) {
            $ticket_error = !empty($ticket['body']['error']) ? '[' . $ticket['body']['error'] . ']' : '';
            throw new VimeoUploadException('Unable to get an upload ticket.' . $ticket_error);
        }

        // We are going to always target the secure upload URL.
        $url = $ticket['body']['upload_link_secure'];

        // We need a handle on the input file since we may have to send segments multiple times.
        $file = fopen($file_path, 'r');

        // PUTs a file in a POST....do for the streaming when we get there.
        $curl_opts = array(
            CURLOPT_PUT        => true,
            CURLOPT_INFILE     => $file,
            CURLOPT_INFILESIZE => filesize($file_path),
            CURLOPT_UPLOAD     => true,
            CURLOPT_HTTPHEADER => array(
                'Expect: ',
                'Content-Range: replaced...'
            )
        );

        // These are the options that set up the validate call.
        $curl_opts_check_progress = array(
            CURLOPT_PUT        => true,
            CURLOPT_HTTPHEADER => array(
                'Content-Length: 0',
                'Content-Range: bytes */*'
            )
        );

        // Perform the upload by streaming as much to the server as possible and ending when we reach the filesize on the server.
        $size      = filesize($file_path);
        $server_at = 0;
        do {
            // The last HTTP header we set MUST be the Content-Range, since we need to remove it and replace it with a proper one.
            array_pop($curl_opts[CURLOPT_HTTPHEADER]);
            $curl_opts[CURLOPT_HTTPHEADER][] = 'Content-Range: bytes ' . $server_at . '-' . $size . '/' . $size;

            fseek($file, $server_at);   //  Put the FP at the point where the server is.

            try {
                $this->_request($url, $curl_opts);   //Send what we can.
            } catch (VimeoRequestException $exception) {
                // ignored, it's likely a timeout, and we should only consider a failure from the progress check as a legit failure
            }

            $progress_check = $this->_request($url, $curl_opts_check_progress); //  Check on what the server has.

            // Figure out how much is on the server.
            list(, $server_at) = explode('-', $progress_check['headers']['Range']);
            $server_at = (int)$server_at;
        } while ($server_at < $size);

        // Complete the upload on the server.
        $completion = $this->request($ticket['body']['complete_uri'], array(), 'DELETE');

        // Validate that we got back 201 Created
        $status = (int)$completion['status'];
        if ($status !== 201) {
            $error = !empty($completion['body']['error']) ? '[' . $completion['body']['error'] . ']' : '';
            throw new VimeoUploadException('Error completing the upload.' . $error);
        }

        // Furnish the location for the new clip in the API via the Location header.
        return $completion['headers']['Location'];
    }
}
Generator/Common/Vimeo/api/Exceptions/ExceptionInterface.php000064400000000156152355233130020167 0ustar00<?php

namespace Vimeo\Exceptions;

/**
 * ExceptionInterface
 */
interface ExceptionInterface {

}
Generator/Common/Vimeo/api/Exceptions/VimeoRequestException.php000064400000000325152355233130020715 0ustar00<?php

namespace Vimeo\Exceptions;

use Exception;

/**
 * VimeoRequestException class for failure to make request.
 */
class VimeoRequestException extends Exception implements ExceptionInterface {

}
Generator/Common/Vimeo/api/Exceptions/VimeoUploadException.php000064400000000333152355233130020510 0ustar00<?php

namespace Vimeo\Exceptions;

use Exception;

/**
 * VimeoUploadException class for failure to upload to the server.
 */
class VimeoUploadException extends Exception implements ExceptionInterface {

}
Generator/Common/Text/GeneratorGroupText.php000064400000001317152355233130015173 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Text;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Text\Sources\TextInput;
use Nextend\SmartSlider3Pro\Generator\Common\Text\Sources\TextText;

class GeneratorGroupText extends AbstractGeneratorGroup {

    protected $name = 'text';

    public function getLabel() {
        return 'CSV';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'CSV');
    }

    protected function loadSources() {

        new TextText($this, 'text', n2_('CSV from url'));
        new TextInput($this, 'input', n2_('CSV from input'));
    }
}
Generator/Common/Text/Sources/TextInput.php000064400000003544152355233130014756 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Text\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class TextInput extends AbstractGenerator {

    protected $layout = 'text_generator';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('CSV from input'));
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Textarea($filter, 'source', 'CSV', '', array(
            'width'  => 300,
            'height' => 200
        ));

        new Text($filter, 'delimiter', 'Column delimiter', ',', array(
            'style' => 'width:50px;'
        ));
    }

    protected function _getData($count, $startIndex) {
        $source    = $this->data->get('source', '');
        $delimiter = $this->data->get('delimiter', ',');

        if (empty($delimiter)) {
            $delimiter = ",";
        }
        $data = array();

        if (!empty($source)) {
            $i = 0;
            $k = 0;
            foreach (preg_split("/((\r?\n)|(\r\n?))/", $source) as $line) {
                if ($startIndex <= $i && ($count + $startIndex) > $i) {
                    $line  = rtrim($line, "\r\n");
                    $parts = explode($delimiter, $line);
                    $j     = 1;
                    foreach ($parts as $part) {
                        $data[$k]['variable' . $j] = $part;
                        $j++;
                    }
                    $k++;
                }
                $i++;
            }
        }

        return $data;
    }
}Generator/Common/Text/Sources/TextText.php000064400000004024152355233130014575 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Text\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Misc\HttpClient;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class TextText extends AbstractGenerator {

    protected $layout = 'text_generator';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('CSV from url'));
    }

    public function renderFields($container) {
        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $source = $filterGroup->createRow('source');

        new Text($source, 'sourcefile', 'CSV url', '', array(
            'style' => 'width:600px;'
        ));

        $delimiter = $filterGroup->createRow('delimiter-row');

        new Text($delimiter, 'delimiter', 'Column delimiter', ',', array(
            'style' => 'width:50px;'
        ));
    }

    protected function _getData($count, $startIndex) {
        $delimiter = $this->data->get('delimiter', ',');
        $source    = $this->data->get('sourcefile', '');
        $content   = HttpClient::get($source);

        if (!$content) {
            Notification::error('The file on the given url is either empty or it cannot be accessed.');

            return null;
        }

        $lines = preg_split('/$\R?^/m', $content);
        $data  = array();
        if (!empty($lines)) {
            $k = 0;
            for ($i = 0; $i < count($lines) && ($count + $startIndex) > $i; $i++) {
                if ($startIndex <= $i) {
                    $parts = explode($delimiter, $lines[$i]);
                    $j     = 1;
                    foreach ($parts as $part) {
                        $data[$k]['variable' . $j] = $part;
                        $j++;
                    }
                    $k++;
                }
            }
        }

        return $data;
    }
}Generator/Common/Rss/GeneratorGroupRss.php000064400000001071152355233130014636 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Rss;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Rss\Sources\RSSFeed;

class GeneratorGroupRss extends AbstractGeneratorGroup {

    protected $name = 'rss';

    public function getLabel() {
        return 'RSS';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'RSS');
    }

    protected function loadSources() {

        new RSSFeed($this, 'feed', 'RSS Feed');
    }
}Generator/Common/Rss/Sources/RSSFeed.php000064400000016355152355233130014074 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Rss\Sources;

use Exception;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Misc\HttpClient;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use SimpleXmlElement;

class RSSFeed extends AbstractGenerator {

    protected $layout = 'text';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'RSS');
    }

    public function renderFields($container) {
        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $url = $filterGroup->createRow('url-row');

        new Text($url, 'rssurl', 'RSS url', '', array(
            'style' => 'width:600px;'
        ));

        $date = $filterGroup->createRow('date');

        new Text($date, 'dateformat', n2_('Date format'), 'm-d-Y');
        new Text($date, 'offset', n2_('Offset hours'), '', array(
            'tipLabel'       => n2_('Offset hours'),
            'tipDescription' => n2_('Timezone offset in hours. For example: +2 or -7.')
        ));
        new Textarea($date, 'sourcetranslatedate', n2_('Translate date and time'), 'January->January||February->February||March->March', array(
            'width'  => 300,
            'height' => 100
        ));
    }

    protected function _getData($count, $startIndex) {
        $url             = $this->data->get('rssurl', '');
        $date_format     = $this->data->get('dateformat', 'Y-m-d');
        $sourceTranslate = $this->data->get('sourcetranslatedate', '');
        $translate       = $this->generateTranslationArray($sourceTranslate);

        $content = HttpClient::get($url);

        if (!$content) {
            Notification::error('The file on the given url is either empty or it cannot be accessed.');

            return null;
        }

        try {
            @$xml = new SimpleXmlElement($content);
            $namespaces = $xml->getNamespaces(true);
        } catch (Exception $e) {
            Notification::error(n2_('The data in the given url is not valid XML.'));

            return null;
        }

        $data = array();
        $i    = 0;

        $atom = false;
        if (isset($xml->channel->item)) {
            $entries = $xml->channel->item;
        } else if (isset($xml->entry)) {
            $entries = $xml->entry;
            $atom    = true;
        }

        foreach ($entries as $entry) {
            foreach ($entry as $key => $value) {
                $val = (string)$value;
                foreach ($value as $inner_key => $inner_val) {
                    $data[$i][$key . '_' . $inner_key] = $inner_val;
                }
                if (!empty($val)) {
                    if ($this->checkIsAValidDate($val)) {
                        $offset = $this->data->get('offset', '');
                        if (!empty($offset)) {
                            $offset = intval($offset) * 3600;
                        } else {
                            $offset = 0;
                        }
                        $val = $this->translate(date($date_format, strtotime($val) + $offset), $translate);
                    }
                    $data[$i][$key] = $val;
                }
                $attributes = $entry->$key->attributes();
                if (!empty($attributes)) {
                    foreach ($attributes as $attribute => $attribute_val) {
                        $attribute_val_str = @(string)$attribute_val;
                        if (isset($attribute_val_str)) {
                            $data[$i][$key . '_' . $attribute] = $attribute_val_str;
                        }
                    }
                }

                if (is_array($namespaces)) {
                    foreach ($namespaces as $namespace => $namespacevalue) {
                        $data[$i][$namespace] = $namespacevalue;
                        foreach ($entry->children($namespacevalue) as $k => $v) {
                            $value = @(string)$v;
                            if (!empty($value)) {
                                $data[$i][$namespace . '_' . $k] = trim($value);
                            }
                            $namespace_attributes = @$v->attributes();
                            if (!empty($namespace_attributes)) {
                                foreach ($namespace_attributes as $attr => $attr_val) {
                                    $data[$i][$namespace . '_' . $k . '_' . $attr] = trim((string)$attr_val);
                                }
                            }
                        }
                    }
                }
            }

            $group = $entry->children('http://search.yahoo.com/mrss/')->group;
            foreach ($group as $group_name => $group_data) {
                foreach ($group_data as $group_key => $group_val) {
                    $group_val_str = @(string)$attribute_val;
                    if (isset($group_val_str)) {
                        $data[$i][$group_name . '_' . $group_key] = $group_val_str;
                    }
                    $attributes = $group_data->$group_key->attributes();
                    if (!empty($attributes)) {
                        foreach ($attributes as $attribute => $attribute_val) {
                            $attribute_val_str = @(string)$attribute_val;
                            if (isset($attribute_val_str)) {
                                $data[$i][$group_name . '_' . $group_key . '_' . $attribute] = $attribute_val_str;
                            }
                        }
                    }
                }
            }
            if ($atom) {
                $content = @(string)$entry->content;
            } else {
                $content = @(string)$entry->children('http://purl.org/rss/1.0/modules/content/')->encoded;
            }
            if (!empty($content)) {
                $data[$i]['content'] = $content;
            }
            $i++;
            if ($i == $count + $startIndex) break;
        }
        $data = array_slice($data, $startIndex, $count);

        return $data;
    }

    protected function checkIsAValidDate($dateString) {
        return (bool)strtotime($dateString);
    }

    private function translate($from, $translate) {
        if (!empty($translate) && !empty($from)) {
            foreach ($translate as $key => $value) {
                $from = str_replace($key, $value, $from);
            }
        }

        return $from;
    }

    private function generateTranslationArray($sourceTranslate) {
        $translate      = array();
        $translateValue = explode('||', $sourceTranslate);
        if ($sourceTranslate != 'January->January||February->February||March->March' && !empty($translateValue)) {
            foreach ($translateValue as $tv) {
                $translateArray = explode('->', $tv);
                if (!empty($translateArray) && count($translateArray) == 2) {
                    $translate[$translateArray[0]] = $translateArray[1];
                }
            }
        }

        return $translate;
    }
}
Generator/Common/Pinterest/GeneratorGroupPinterest.php000064400000001173152355233130017255 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Pinterest;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Pinterest\Sources\PinterestImages;

class GeneratorGroupPinterest extends AbstractGeneratorGroup {

    protected $name = 'pinterest';

    public function getLabel() {
        return 'Pinterest';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Pinterest images');
    }

    protected function loadSources() {

        new PinterestImages($this, 'images', n2_('Images'));
    }

}Generator/Common/Pinterest/Sources/PinterestImages.php000064400000014177152355233130017152 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Pinterest\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Misc\HttpClient;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class PinterestImages extends AbstractGenerator {

    protected $layout = 'image_extended';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Pinterest images');
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Text($filter, 'pinterestusername', 'Username', '');
        new Text($filter, 'pinterestboard', 'Board slug', 'All');
    }

    function escape($string) {
        $string = str_replace(' ', '-', $string);
        $string = preg_replace('/(?=\P{Nd})(?!\+)(?!\-)\P{L}/u', '', $string);

        return $string;
    }

    protected function _getData($count, $startIndex) {
        $username = $this->data->get('pinterestusername', '');
        $board    = $this->data->get('pinterestboard', 'All');

        $data = array();

        if ($board == "All" || $board == "all" || $board == "") {
            $boardSpecified = false;
            $jsonUrl        = "https://api.pinterest.com/v3/pidgets/users/" . $username . "/pins/";
        } else {
            $boardSpecified = true;
            $board          = urlencode($this->escape($board));
            $jsonUrl        = "https://api.pinterest.com/v3/pidgets/boards/" . $username . "/" . $board . "/pins/";

        }
        $json = HttpClient::get($jsonUrl);
        if (!$json) {
            return null;
        }
        $pins     = json_decode($json);
        $imageKey = '237x';
        if (is_object($pins) && isset($pins->data->pins)) {
            for ($i = 0; $i < count($pins->data->pins) && $i < $count; $i++) {
                $pin = $pins->data->pins[$i];

                $data[$i]['image']       = str_replace("/237x/", "/1200x/", $pin->images->$imageKey->url);
                $data[$i]['thumbnail']   = $pin->images->$imageKey->url;
                $data[$i]['description'] = $pin->description;
                $data[$i]['title']       = $data[$i]['description'];
                $data[$i]['url']         = "https://www.pinterest.com/pin/" . $pin->id;
                $data[$i]['url_label']   = n2_("View");

                $data[$i]['id']                     = $pin->id;
                $data[$i]['link']                   = $pin->link;
                $data[$i]['image_736']              = str_replace("/237x/", "/736x/", $pin->images->$imageKey->url);
                $data[$i]['pinner_about']           = $pin->pinner->about;
                $data[$i]['pinner_location']        = $pin->pinner->location;
                $data[$i]['pinner_full_name']       = $pin->pinner->full_name;
                $data[$i]['pinner_follower_count']  = $pin->pinner->follower_count;
                $data[$i]['pinner_image_small_url'] = $pin->pinner->image_small_url;
                $data[$i]['pinner_image_140_url']   = str_replace("_30.", "_140.", $data[$i]['pinner_image_small_url']);
                $data[$i]['pinner_image_280_url']   = str_replace("_30.", "_280.", $data[$i]['pinner_image_small_url']);
                $data[$i]['pinner_image_big_url']   = str_replace("_30.", ".", $data[$i]['pinner_image_small_url']);
                $data[$i]['pinner_pin_count']       = $pin->pinner->pin_count;
                $data[$i]['pinner_profile_url']     = $pin->pinner->profile_url;
                $data[$i]['repin_count']            = $pin->repin_count;
                $data[$i]['dominant_color']         = $pin->dominant_color;
                if (!empty($pin->like_count)) {
                    $data[$i]['like_count'] = $pin->like_count;
                }
                if (!$boardSpecified) {
                    $data[$i]['board_description']         = $pin->board->description;
                    $data[$i]['board_url']                 = "http://www.pinterest.com" . $pin->board->url;
                    $data[$i]['board_image_thumbnail_url'] = $pin->board->image_thumbnail_url;
                    $data[$i]['board_pin_count']           = $pin->board->pin_count;
                    $data[$i]['board_name']                = $pin->board->name;
                } else {
                    $data[$i]['board_description']         = $pins->data->board->description;
                    $data[$i]['board_url']                 = "http://www.pinterest.com" . $pins->data->board->url;
                    $data[$i]['board_image_thumbnail_url'] = $pins->data->board->image_thumbnail_url;
                    $data[$i]['board_pin_count']           = $pins->data->board->pin_count;
                    $data[$i]['board_name']                = $pins->data->board->name;
                }
                $data[$i]['user_about']           = $pins->data->user->about;
                $data[$i]['user_location']        = $pins->data->user->location;
                $data[$i]['user_full_name']       = $pins->data->user->full_name;
                $data[$i]['user_follower_count']  = $pins->data->user->follower_count;
                $data[$i]['user_image_small_url'] = $pins->data->user->image_small_url;
                $data[$i]['user_image_140_url']   = str_replace("_30.", "_140.", $data[$i]['user_image_small_url']);
                $data[$i]['user_image_280_url']   = str_replace("_30.", "_280.", $data[$i]['user_image_small_url']);
                $data[$i]['user_image_big_url']   = str_replace("_30.", ".", $data[$i]['user_image_small_url']);
                $data[$i]['user_pin_count']       = $pins->data->user->pin_count;
                $data[$i]['user_profile_url']     = $pins->data->user->profile_url;
                $data[$i]['pin_it']               = "http://pinterest.com/pin/create/button/?url=" . urlencode($data[$i]['url']) . "&media=" . urlencode($data[$i]['image']) . "&description=" . urlencode($data[$i]['description']);
            }
        }

        return $data;
    }

}
Generator/Common/Json/GeneratorGroupJson.php000064400000001316152355233130015144 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Json;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Json\Sources\JsonInput;
use Nextend\SmartSlider3Pro\Generator\Common\Json\Sources\JsonUrl;

class GeneratorGroupJson extends AbstractGeneratorGroup {

    protected $name = 'json';

    public function getLabel() {
        return 'JSON';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'JSON');
    }

    protected function loadSources() {

        new JsonUrl($this, 'url', n2_('JSON from url'));
        new JsonInput($this, 'input', n2_('JSON from input'));
    }
}Generator/Common/Json/Sources/JsonInput.php000064400000013153152355233130014725 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Json\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class JsonInput extends AbstractGenerator {

    protected $layout = 'text';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('JSON from input'));
    }

    public function renderFields($container) {
        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $source = $filterGroup->createRow('source');

        new Textarea($source, 'source', 'JSON or XML', '', array(
            'width'  => 300,
            'height' => 200
        ));

        $filter = $filterGroup->createRow('filter');

        new Select($filter, 'data_type', 'Data type', 0, array(
            'options' => array(
                0 => 'JSON',
                1 => 'XML'
            )
        ));

        new Select($filter, 'json_level', 'Level separation', 2, array(
            'tipLabel'       => n2_('Level separation'),
            'tipDescription' => n2_('JSON codes can be customized to have many different levels. From a code it is impossible to know from which level do you want to use the given datas on the different slides, so you have to select that level from this list.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1911-json-generator#filter',
            'options'        => array(
                1 => 'first level',
                2 => 'second level',
                3 => 'third level'
            )
        ));

        new Select($filter, 'remove_levels', 'Remove levels from result', 0, array(
            'options' => array(
                0 => 0,
                1 => 1,
                2 => 2,
                3 => 3
            )
        ));
    }

    protected function flatten_array($array, $parent = '', $basekey = '') {
        if (!is_array($array)) {
            return false;
        }
        $result = array();
        if (!empty($basekey)) {
            $result['base_name'] = $basekey;
        }
        foreach ($array as $key => $value) {
            $original_key = $key;
            if (!empty($parent)) {
                $key = $parent . '_' . $key;
            }
            $result[$key . '_name'] = $original_key;
            if (is_array($value)) {
                $result = array_merge($result, $this->flatten_array($value, $key));
            } else {
                $result[$key] = $value;
            }
        }

        return $result;
    }

    protected function removeLevel($array) {
        $result = array();
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result = array_merge($result, $value);
            }
        }

        return $result;
    }

    protected function _getData($count, $startIndex) {
        $source = $this->data->get('source', '');
        $data   = array();

        if (($this->data->get('data_type', 0) == 1) || (strtolower(substr($source, -4)) == '.xml')) {
            $xmlData = true;
            $xml     = @simplexml_load_string($source, "SimpleXMLElement", LIBXML_NOCDATA);
            $source  = json_encode((array)$xml);
        } else {
            $xmlData = true;
        }

        $json = json_decode($source, true);
        if (!is_array($json) || $json == array('0' => false)) {
            if ($xmlData) {
                Notification::error(sprintf(n2_('The given text is not valid XML! %1$sValidate your code%2$s to make sure it is correct.'), '<a href="https://www.xmlvalidation.com/" target="_blank">', '</a>'));
            } else {
                Notification::error(sprintf(n2_('The given text is not valid JSON! %1$sValidate your code%2$s to make sure it is correct.'), '<a href="https://jsonlint.com/" target="_blank">', '</a>'));
            }

            return null;
        }

        $remove_levels = intval($this->data->get('remove_levels', 0));
        if ($remove_levels != 0) {
            for ($i = 0; $i < $remove_levels; $i++) {
                $json = $this->removeLevel($json);
            }
        }

        switch ($this->data->get('json_level', 2)) {
            case 1:
                $data[] = $this->flatten_array($json);
                break;
            case 2:
                foreach ($json as $key => $json_row) {
                    if (is_array($json_row)) {
                        $data[] = $this->flatten_array($json_row, '', $key);
                    }
                }
                break;
            case 3:
                $array_values = array_values($json);
                if (is_array($array_values)) {
                    $array_shift = array_shift($array_values);
                    if (is_array($array_shift) && !empty($array_shift)) {
                        foreach ($array_shift as $key => $json_row) {
                            if (is_array($json_row)) {
                                $data[] = $this->flatten_array($json_row, '', $key);
                            }
                        }
                    }
                }
                break;

        }

        if (empty($data)) {
            Notification::error(n2_('Try to change the "Level separation" or "Remove levels from result" setting.'));
        } else {
            $data = array_slice($data, $startIndex, $count);
        }

        return $data;
    }
}Generator/Common/Json/Sources/JsonUrl.php000064400000013611152355233130014367 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Json\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Misc\HttpClient;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class JsonUrl extends AbstractGenerator {

    protected $layout = 'text';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('JSON from url'));
    }

    public function renderFields($container) {
        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $source = $filterGroup->createRow('source');

        new Text($source, 'sourcefile', 'JSON or XML url', '', array(
            'style' => 'width:600px;'
        ));

        $filter = $filterGroup->createRow('filter');

        new Select($filter, 'data_type', 'Data type', 0, array(
            'options' => array(
                0 => 'JSON',
                1 => 'XML'
            )
        ));

        new Select($filter, 'json_level', 'Level separation', 2, array(
            'tipLabel'       => n2_('Level separation'),
            'tipDescription' => n2_('JSON codes can be customized to have many different levels. From a code it is impossible to know from which level do you want to use the given datas on the different slides, so you have to select that level from this list.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1911-json-generator#filter',
            'options'        => array(
                1 => 'first level',
                2 => 'second level',
                3 => 'third level'
            )
        ));

        new Select($filter, 'remove_levels', 'Remove levels from result', 0, array(
            'options' => array(
                0 => 0,
                1 => 1,
                2 => 2,
                3 => 3
            )
        ));
    }

    protected function flatten_array($array, $parent = '', $basekey = '') {
        if (!is_array($array)) {
            return false;
        }
        $result = array();
        if (!empty($basekey)) {
            $result['base_name'] = $basekey;
        }
        foreach ($array as $key => $value) {
            $original_key = $key;
            if (!empty($parent)) {
                $key = $parent . '_' . $key;
            }
            $result[$key . '_name'] = $original_key;
            if (is_array($value)) {
                $result = array_merge($result, $this->flatten_array($value, $key));
            } else {
                $result[$key] = $value;
            }
        }

        return $result;
    }

    protected function removeLevel($array) {
        $result = array();
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result = array_merge($result, $value);
            }
        }

        return $result;
    }

    protected function _getData($count, $startIndex) {
        $source  = $this->data->get('sourcefile', '');
        $data    = array();
        $options = array();

        $content = HttpClient::get($source, $options);

        if (!$content) {
            Notification::error('The file on the given url is either empty or it cannot be accessed.');

            return null;
        }

        if (($this->data->get('data_type', 0) == 1) || (strtolower(substr($source, -4)) == '.xml')) {
            $xmlData = true;
            $xml     = @simplexml_load_string($content, "SimpleXMLElement", LIBXML_NOCDATA);
            $content = json_encode((array)$xml);
        } else {
            $xmlData = false;
        }
        $json = json_decode($content, true);

        if (!is_array($json) || $json == array('0' => false)) {
            if ($xmlData) {
                Notification::error(sprintf(n2_('The given text is not valid XML! %1$sValidate your code%2$s to make sure it is correct.'), '<a href="https://www.xmlvalidation.com/" target="_blank">', '</a>'));
            } else {
                Notification::error(sprintf(n2_('The given text is not valid JSON! %1$sValidate your code%2$s to make sure it is correct.'), '<a href="https://jsonlint.com/" target="_blank">', '</a>'));
            }

            return null;
        }

        $remove_levels = intval($this->data->get('remove_levels', 0));
        if ($remove_levels != 0) {
            for ($i = 0; $i < $remove_levels; $i++) {
                $json = $this->removeLevel($json);
            }
        }

        switch ($this->data->get('json_level', 2)) {
            case 1:
                $data[] = $this->flatten_array($json);
                break;
            case 2:
                foreach ($json as $key => $json_row) {
                    if (is_array($json_row)) {
                        $data[] = $this->flatten_array($json_row, '', $key);
                    }
                }
                break;
            case 3:
                $array_values = array_values($json);
                if (is_array($array_values)) {
                    $array_shift = array_shift($array_values);
                    if (is_array($array_shift) && !empty($array_shift)) {
                        foreach ($array_shift as $key => $json_row) {
                            if (is_array($json_row)) {
                                $data[] = $this->flatten_array($json_row, '', $key);
                            }
                        }
                    }
                }
                break;

        }

        if (empty($data)) {
            Notification::error(n2_('Try to change the "Level separation" or "Remove levels from result" setting.'));
        } else {
            $data = array_slice($data, $startIndex, $count);
        }


        return $data;
    }
}Generator/Common/Instagram/ConfigurationInstagram.php000064400000022651152355233130017045 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Instagram;

use Joomla\CMS\Uri\Uri;
use Nextend\Framework\Browse\BulletProof\Exception;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Token;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroupConfiguration;
use Nextend\SmartSlider3Pro\Generator\Common\Instagram\api\InstagramBasicDisplay;
use Nextend\SmartSlider3Pro\Generator\Common\Instagram\Elements\InstagramRefreshToken;
use Nextend\SmartSlider3Pro\Generator\Common\Instagram\Elements\InstagramToken;

class ConfigurationInstagram extends AbstractGeneratorGroupConfiguration {

    private $data;

    /**
     * N2SliderGeneratorinstagramConfiguration constructor.
     *
     * @param GeneratorGroupInstagram $group
     */
    public function __construct($group) {
        parent::__construct($group);
        $this->data = new Data(array(
            'appId'       => '',
            'secret'      => '',
            'accessToken' => '',
            'expiresAt'   => ''
        ));

        $this->data->loadJSON(StorageSectionManager::getStorage('smartslider')
                                                   ->get('instagram'));
    }

    public function wellConfigured() {
        if (!$this->data->get('appId') || !$this->data->get('secret') || !$this->data->get('accessToken')) {
            return false;
        }

        $api = $this->getApi();
        try {
            $api->getUserProfile();

            return true;
        } catch (Exception $e) {
            Notification::error($e->getMessage());

            return false;
        }
    }

    public function getApi() {
        $appId       = $this->data->get('appId');
        $appSecret   = $this->data->get('secret');
        $accessToken = $this->data->get('accessToken');

        if (!empty($appId) && !empty($appSecret)) {
            $api = new InstagramBasicDisplay(array(
                'appId'       => $appId,
                'appSecret'   => $appSecret,
                'redirectUri' => $this->getCallbackUrl()
            ));

            if (!empty($accessToken)) {
                $api->setAccessToken($accessToken);
            }

            return $api;
        } else if (!empty($appId) && empty($this->data->get('secret'))) {
            throw new Exception(n2_('The secret is empty. Please insert that value too!'));
        } else if (empty($appId) && !empty($this->data->get('secret'))) {
            throw new Exception(n2_('The App ID is empty. Please insert that value too!'));
        } else {
            throw new Exception(n2_('The App ID and the Secret is empty!'));
        }

    }

    public function getData() {
        return $this->data->toArray();
    }

    public function addData($data, $store = true) {
        $this->data->loadArray($data);
        if ($store) {
            StorageSectionManager::getStorage('smartslider')
                                 ->set('instagram', null, json_encode($this->data->toArray()));
        }
    }

    public function render($MVCHelper) {

        $form = new Form($MVCHelper, 'generator');
        $form->loadArray($this->getData());
        $table       = new ContainerTable($form->getContainer(), 'instagram-api', 'Instagram api');
        $callBackUrl = $this->getCallbackUrl();

        if (substr($callBackUrl, 0, 8) !== 'https://') {
            $url = "https://docs.joomla.org/Enabling_HTTPS_on_your_site";
        
            $warning     = $table->createRow('instagram-warning');
            $warningText = sprintf(n2_('%1$s allows HTTPS Redirect URIs only! You must move your site to HTTPS in order to use this generator!'), 'Instagram') . ' - <a href="' . $url . '" target="_blank" rel="nofollow noopener noreferrer">' . n2_('How to get SSL for my website?') . '</a>';
            new Warning($warning, 'warning', $warningText);
        } else {
            $instruction     = $table->createRow('instagram-instruction');
            $instructionText = sprintf(n2_('%2$s Check the documentation %3$s to learn how to configure your %1$s app.'), 'Instagram', '<a href="https://smartslider.helpscoutdocs.com/article/2052-instagram-generator" target="_blank">', '</a>');
            new Notice($instruction, 'instruction', n2_('Instruction'), $instructionText);
        }

        $expDate = $this->data->get('expiresAt');
        if ($this->data->get('accessToken') && $expDate) {
            $exp     = $table->createRow('instagram-exp-warning');
            $expDate = $this->data->get('expiresAt');
            $this->checkExpire($table, $exp);
            new Notice($exp, 'expires', n2_('The token will expire at:'), Platform::localizeDate($expDate));
        }
        $settings = $table->createRow('instagram');
        new Text($settings, 'appId', 'App ID', '', array(
            'style' => 'width:120px;'
        ));
        new Text($settings, 'secret', 'Secret', '', array(
            'style' => 'width:250px;'
        ));

        new InstagramToken($settings, 'accessToken', n2_('Token'));
        new Notice($settings, 'callback', n2_('Callback url'), $callBackUrl);

        new Token($settings);

        $form->render();


    }

    public function refreshToken($MVCHelper) {
        $api   = $this->getApi();
        $token = $api->refreshToken($this->data->get('accessToken'));

        $api->setAccessToken($token->access_token);
        try {
            $user = $api->getUserProfile();
            if ($user) {
                $data                = $this->getData();
                $data['accessToken'] = $token->access_token;
                $data['expiresAt']   = time() + $token->expires_in;
                $this->addData($data);

                return true;
            }

            return false;
        } catch (Exception $e) {
            return $e;
        }

    }

    public function startAuth($MVCHelper) {

        if (session_id() == "") {
            session_start();
        }
        $this->addData(Request::$REQUEST->getVar('generator'), false);

        $_SESSION['data'] = $this->getData();

        $api = $this->getApi();

        $_SESSION['instagramstate'] = $this->generateRandomState();

        return $api->getLoginUrl(array(
            'user_profile',
            'user_media'
        ), $_SESSION['instagramstate']);
    }

    public function finishAuth($MVCHelper) {
        if (session_id() == "") {
            session_start();
        }

        if (Request::$REQUEST->getVar('state') !== null && isset($_SESSION['instagramstate']) && Request::$REQUEST->getVar('state') == $_SESSION['instagramstate']) {
            $this->addData($_SESSION['data'], false);
            unset($_SESSION['data']);

            $code  = Request::$GET->getVar('code');
            $api   = $this->getApi();
            $token = $api->getOAuthToken($code, true);
            if ($token) {
                $token = $api->getLongLivedToken($token, false);
                $api->setAccessToken($token->access_token);
                try {
                    $user = $api->getUserProfile();
                    if ($user) {
                        $data                = $this->getData();
                        $data['accessToken'] = $token->access_token;
                        $data['expiresAt']   = time() + $token->expires_in;
                        $this->addData($data);

                        return true;
                    }

                    return false;
                } catch (Exception $e) {
                    return $e;
                }
            }

            return new Exception(n2_('Access token was not returned.Please check the credentials!'));

        } else {
            return new Exception(n2_('State does not match!'));
        }
    }


    public function checkExpire($container, $group = null) {
        $expDate = $this->data->get('expiresAt');
        $now     = Platform::getTimestamp();
        if ($expDate && $expDate - (2 * 24 * 60 * 60) < $now) {
            if (!$group) {
                $errorGroup = new ContainerTable($container, 'instagram-api', 'Token Expiration');
                $group      = $errorGroup->createRow('error');
            }
            if ($expDate <= $now) {
                Notification::error(n2_('The token expired. Please request new token! '));
                new Warning($group, 'expires', n2_('The token expired. Please request new token!'));

                return false;
            } else {
                new Warning($group, 'expires', n2_('The token will expire in two days! Please refresh the token!'));
                new InstagramRefreshToken($group, 'refreshToken', n2_('Refresh Token'), n2_('Refresh'));
            }
        }

        return true;

    }

    private function getCallbackUrl() {
        return str_replace('\\', '/', Uri::root() . 'plugins' . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . 'smartslider3' . DIRECTORY_SEPARATOR . 'apis' . DIRECTORY_SEPARATOR . 'instagram.php');
    
    }
}
Generator/Common/Instagram/GeneratorGroupInstagram.php000064400000001456152355233130017201 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Instagram;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Instagram\Sources\InstagramImages;


class GeneratorGroupInstagram extends AbstractGeneratorGroup {

    protected $name = 'instagram';

    protected $needConfiguration = true;

    public function __construct() {

        parent::__construct();
        $this->configuration = new ConfigurationInstagram($this);
    }

    public function getLabel() {
        return 'Instagram';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Instagram');
    }

    protected function loadSources() {
        new InstagramImages($this, 'images', 'Images');

    }
}Generator/Common/Instagram/GeneratorGroupRESTInstagram.php000064400000000643152355233130017674 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Instagram;

use Nextend\SmartSlider3\Application\ApplicationSmartSlider3;
use WP_REST_Server;
use Exception;


class GeneratorGroupRESTInstagram {

    public function __construct() {
    }

    public function registerInstagramRedirectRESTRoute() {
    }


    public function redirectToInstagramEndpointWithStateAndCode($request) {
    }
}Generator/Common/Instagram/Sources/InstagramImages.php000064400000023750152355233130017067 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Instagram\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\Platform\Platform;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\Framework\Browse\BulletProof\Exception;
use Nextend\Framework\Notification\Notification;

class InstagramImages extends AbstractGenerator {

    protected $layout = 'image';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Instagram media');
    }

    public function renderFields($container) {
        $this->group->getConfiguration()
                    ->checkExpire($container);

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));
        $filterImage = $filterGroup->createRow('filter-image');
        new OnOff($filterImage, 'allow_images', "Allow Single images", 1, array());

        $filteralbum = $filterGroup->createRow('filter-video');

        new OnOff($filteralbum, 'allow_album', "Allow albums", 0, array(
            'relatedFieldsOn' => array(
                "generatoralbum_type",

            )
        ));

        new Select($filteralbum, 'album_type', n2_('Album loading method'), '0', array(
            'options' => array(
                0 => n2_('Load first images only'),
                1 => n2_('Load album images separately'),
                2 => n2_('Load Album images as record data')
            )
        ));


        $filtervideo = $filterGroup->createRow('filter-video');
        new OnOff($filtervideo, 'allow_video', "Allow videos", 0);

        $date = $filterGroup->createRow('date-row');
        new Text($date, 'instagramdate', n2_('Date format'), 'm-d-Y');
        new Text($date, 'instagramtime', n2_('Time format'), 'G:i');
        new Textarea($date, 'instagramtranslatedate', n2_('Translate date and time'), 'January->January||February->February||March->March', array(
            'width'  => 300,
            'height' => 100
        ));


        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'order', '0|*|asc', array(
            'options' => array(
                '0' => n2_('None'),
                '1' => n2_('Caption'),
                '2' => n2_('Creation date')
            )
        ));


    }


    protected function _getData($count, $startIndex) {
        $api  = $this->group->getConfiguration()
                            ->getApi();
        $data = array();

        $api->setMediaFields('timestamp,media_url,media_type,permalink,thumbnail_url,caption,username');
        $api->setMediaChildrenFields('timestamp,media_url,media_type,permalink,username');
        try {
            $images                    = $api->getUserMedia();
            $dateOptions               = array();
            $dateOptions['dateFormat'] = $this->data->get('instagramdate', 'm-d-Y');
            $dateOptions['timeFormat'] = $this->data->get('instagramtime', 'G:i');

            $translateDate            = $this->data->get('instagramtranslatedate', '');
            $translateValue           = explode('||', $translateDate);
            $dateOptions['translate'] = array();
            if ($translateDate != 'January->January||February->February||March->March' && !empty($translateValue)) {
                foreach ($translateValue as $tv) {
                    $translateArray = explode('->', $tv);
                    if (!empty($translateArray) && count($translateArray) == 2) {
                        $dateOptions['translate'][$translateArray[0]] = $translateArray[1];
                    }
                }
            }


            if (is_object($images) && isset($images->data)) {
                $idx = 0;
                $this->iterateImages($images->data, $dateOptions, $data, $idx, $api);
            }

            $this->shortData($data);
            $data = array_slice($data, $startIndex, $count);
        } catch (Exception $e) {
            Notification::error($e->getMessage());
            return null;
        }

        return $data;
    }

    protected function shortData(&$data) {
        list($orderBy, $sort) = Common::parse($this->data->get('order', '0|*|asc'));

        switch ($orderBy) {
            case 1:
                usort($data, array(
                    $this,
                    $sort
                ));
                break;
            case 2:
                usort($data, array(
                    $this,
                    'orderByDate_' . $sort
                ));
                break;
            default:
                break;
        }

    }

    private function inAvailableMediaTypes($img, $force = false) {
        $mediaTypes = [
            'IMAGE'          => ($force) ? $force : intval($this->data->get('allow_images', 1)),
            'CAROUSEL_ALBUM' => intval($this->data->get('allow_album', 0)),
            'VIDEO'          => intval($this->data->get('allow_video', 0)),
        ];

        if (isset($mediaTypes[$img->media_type])) {
            return $mediaTypes[$img->media_type];
        }

        return false;
    }

    private function transformData($img, $dateOptions, $parent = null, $withImage = true) {
        $data = array();
        if ($parent) {
            $data['caption'] = isset($parent->caption) ? $parent->caption : '';
        } else {
            $data['caption'] = isset($img->caption) ? $img->caption : '';
        }

        if ($img->media_type === 'VIDEO') {
            $data['image'] = $img->thumbnail_url;
            $data['video'] = $img->media_url;
        }

        if ($withImage && ($img->media_type === 'IMAGE' || $img->media_type === 'CAROUSEL_ALBUM')) {
            $data['image'] = $img->media_url;
        }

        $data['link']      = $img->permalink;
        $data['date']      = $this->translate($this->formatDate($img->timestamp, $dateOptions['dateFormat']), $dateOptions['translate']);
        $data['time']      = $this->translate($this->formatDate($img->timestamp, $dateOptions['timeFormat']), $dateOptions['translate']);
        $data['username']  = $img->username;
        $data['timestamp'] = strtotime($img->timestamp);

        return $data;
    }


    private function iterateImages($images, $dateOptions, &$data, &$idx, $api, &$childrenIdx = null, $parent = null) {

        foreach ($images as $img) {

            //force needs because children's images should be shown
            $force = false;


            if (isset($childrenIdx) || $parent) {
                //if it's children image, get children media, what has different data
                $img   = $api->getMedia($img->id, true);
                $force = true;
            }

            if ($this->inAvailableMediaTypes($img, $force)) {
                //if carousel album,check if need to load separately images or not
                if ($img->media_type === 'CAROUSEL_ALBUM' && $this->data->get('allow_album', 0)) {
                    $albumType = $this->data->get('album_type', 0);
                    if ($albumType) {

                        if ($albumType == 1) {
                            //children images don't have caption, so need parent's caption
                            $parent = $img;
                        } else {
                            $childrenIdx = 1;
                            /*@TODO should we add main image if we use images as record data?*/
                            $data[$idx] = $this->transformData($img, $dateOptions, $parent);
                        }
                        //iterate trough children
                        $children = $api->getMediaChildren($img->id);
                        $this->iterateImages($children->children->data, $dateOptions, $data, $idx, $api, $childrenIdx, $parent);
                        $parent      = null;
                        $childrenIdx = null;
                        $idx++;
                    } else {
                        $data[$idx] = $this->transformData($img, $dateOptions);
                        $idx++;
                    }
                } else {
                    if (isset($childrenIdx)) {
                        $data[$idx]['album_' . strtolower($img->media_type) . '_' . $childrenIdx] = $img->media_url;
                        $childrenIdx++;
                    } else {
                        $data[$idx] = $this->transformData($img, $dateOptions, $parent);
                        $idx++;
                    }
                }

            }

        }

    }

    private function translate($from, $translate) {
        if (!empty($translate) && !empty($from)) {
            foreach ($translate as $key => $value) {
                $from = str_replace($key, $value, $from);
            }
        }

        return $from;
    }

    private function formatDate($datetime, $format = 'Y-m-d', $strtotime = true) {
        if ($datetime != '0000-00-00 00:00:00') {
            if ($strtotime) {
                $datetime = strtotime($datetime);
            }

            return date($format, $datetime);
        } else {
            return '';
        }
    }

    private function asc($a, $b) {
        return (strtolower($b['caption']) < strtolower($a['caption']) ? 1 : -1);
    }

    private function desc($a, $b) {
        return (strtolower($a['caption']) < strtolower($b['caption']) ? 1 : -1);
    }

    private function orderByDate_asc($a, $b) {
        return ($b['timestamp'] < $a['timestamp'] ? 1 : -1);
    }

    private function orderByDate_desc($a, $b) {
        return ($a['timestamp'] < $b['timestamp'] ? 1 : -1);
    }

}
Generator/Common/Instagram/Elements/InstagramRefreshToken.php000064400000001537152355233130020411 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Instagram\Elements;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\Button;
use Nextend\Framework\Request\Request;


class InstagramRefreshToken extends Button {

    protected function fetchElement() {

        $authUrl = $this->getForm()
                        ->createAjaxUrl(array(
                            "generator/getRefresh",
                            array(
                                'group' => Request::$REQUEST->getVar('group'),
                                'type'  => Request::$REQUEST->getVar('type')
                            )
                        ));

        Js::addInline('new _N2.FormElementInstagramRefreshToken("' . $this->fieldID . '", "' . $authUrl . '");');

        return parent::fetchElement();
    }
}


Generator/Common/Instagram/Elements/InstagramToken.php000064400000001732152355233130017067 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Instagram\Elements;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Request\Request;


class InstagramToken extends Text {

    protected function fetchElement() {

        $authUrl = $this->getForm()
                        ->createAjaxUrl(array(
                            "generator/getAuthUrl",
                            array(
                                'group' => Request::$REQUEST->getVar('group'),
                                'type'  => Request::$REQUEST->getVar('type')
                            )
                        ));

        Js::addInline('new _N2.FormElementInstagramToken("' . $this->fieldID . '", "' . $authUrl . '");');

        return parent::fetchElement();
    }

    protected function post() {
        return '<a class="n2_field_text__choose_text" href="#">' . n2_('Request token') . '</a>';
    }
}


Generator/Common/Instagram/api/InstagramBasicDisplay.php000064400000032742152355233130017360 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Generator\Common\Instagram\api;

use Nextend\Framework\Browse\BulletProof\Exception;
/**
 *
 * Copyright (c) 2020 espresso.dev
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 **/


/**
 * Class InstagramBasicDisplay
 *
 * @package EspressoDev\InstagramBasicDisplay
 */
class InstagramBasicDisplay {

    const API_URL = 'https://graph.instagram.com/';

    const API_OAUTH_URL = 'https://api.instagram.com/oauth/authorize';

    const API_OAUTH_TOKEN_URL = 'https://api.instagram.com/oauth/access_token';

    const API_TOKEN_EXCHANGE_URL = 'https://graph.instagram.com/access_token';

    const API_TOKEN_REFRESH_URL = 'https://graph.instagram.com/refresh_access_token';

    /**
     * @var string
     */
    private $_appId;

    /**
     * @var string
     */
    private $_appSecret;

    /**
     * @var string
     */
    private $_redirectUri;

    /**
     * @var string
     */
    private $_accesstoken;

    /**
     * @var string[]
     */
    private $_scopes = [
        'user_profile',
        'user_media'
    ];

    /**
     * @var string
     */
    private $_userFields = 'account_type, id, media_count, username';

    /**
     * @var string
     */
    private $_mediaFields = 'caption, id, media_type, media_url, permalink, thumbnail_url, timestamp, username, children{id, media_type, media_url, permalink, thumbnail_url, timestamp, username}';

    /**
     * @var string
     */
    private $_mediaChildrenFields = 'id, media_type, media_url, permalink, thumbnail_url, timestamp, username';

    /**
     * @var int
     */
    private $_timeout = 90000;

    /**
     * @var int
     */
    private $_connectTimeout = 20000;

    /**
     * InstagramBasicDisplay constructor.
     *
     * @param string[string]|string $config configuration parameters
     *
     * @throws Exception
     */
    public function __construct($config = null) {

        if (is_array($config)) {
            $this->setAppId($config['appId']);
            $this->setAppSecret($config['appSecret']);
            $this->setRedirectUri($config['redirectUri']);

            if (isset($config['timeout'])) {
                $this->setTimeout($config['timeout']);
            }

            if (isset($config['connectTimeout'])) {
                $this->setConnectTimeout($config['connectTimeout']);
            }
        } elseif (is_string($config)) {
            // For read-only
            $this->setAccessToken($config);
        } else {
            throw new Exception('Configuration data is missing.');
        }
    }

    /**
     * @param string[] $scopes
     * @param string   $state
     *
     * @return string
     * @throws Exception
     */
    public function getLoginUrl($scopes = [
        'user_profile',
        'user_media'
    ],                          $state = '') {

        if (is_array($scopes) && count(array_intersect($scopes, $this->_scopes)) === count($scopes)) {
            return self::API_OAUTH_URL . '?client_id=' . $this->getAppId() . '&redirect_uri=' . urlencode($this->getRedirectUri()) . '&scope=' . implode(',', $scopes) . '&response_type=code' . ($state != '' ? '&state=' . $state : '');
        }

        throw new Exception("Error: getLoginUrl() - The parameter isn't an array or invalid scope permissions used.");
    }

    /**
     * @param int $id
     *
     * @return object
     * @throws Exception
     */
    public function getUserProfile($id = 0) {
        if ($id === 0) {
            $id = 'me';
        }

        return $this->_makeCall($id, ['fields' => $this->_userFields]);
    }

    /**
     * @param string      $id
     * @param int         $limit
     * @param string|null $before
     * @param string|null $after
     *
     * @return object
     * @throws Exception
     */
    public function getUserMedia($id = 'me', $limit = 0, $before = null, $after = null) {
        $params = [
            'fields' => $this->_mediaFields
        ];

        if ($limit > 0) {
            $params['limit'] = $limit;
        }
        if (isset($before)) {
            $params['before'] = $before;
        }
        if (isset($after)) {
            $params['after'] = $after;
        }

        return $this->_makeCall($id . '/media', $params);
    }

    /**
     * @param string $id
     *
     * @return object
     * @throws Exception
     */
    public function getMedia($id, $children = false) {
        $params = $this->_mediaFields;
        if ($children) {
            $params = $this->_mediaChildrenFields;
        }

        return $this->_makeCall($id, ['fields' => $params]);
    }

    /**
     * @param string $id
     *
     * @return object
     * @throws Exception
     */
    public function getMediaChildren($id) {
        return $this->_makeCall($id, ['fields' => 'children']);
    }

    /**
     * @param object $obj
     *
     * @return object|null
     * @throws Exception
     */
    public function pagination($obj) {
        if (is_object($obj) && !is_null($obj->paging)) {
            if (!isset($obj->paging->next)) {
                return null;
            }

            $apiCall = explode('?', $obj->paging->next);

            if (count($apiCall) < 2) {
                return null;
            }

            $function = str_replace(self::API_URL, '', $apiCall[0]);
            parse_str($apiCall[1], $params);

            // No need to include access token as this will be handled by _makeCall
            unset($params['access_token']);

            return $this->_makeCall($function, $params);
        }

        throw new Exception("Error: pagination() | This method doesn't support pagination.");
    }

    /**
     * @param string $code
     * @param bool   $tokenOnly
     *
     * @return object|string
     * @throws Exception
     */
    public function getOAuthToken($code, $tokenOnly = false) {
        $apiData = array(
            'client_id'     => $this->getAppId(),
            'client_secret' => $this->getAppSecret(),
            'grant_type'    => 'authorization_code',
            'redirect_uri'  => $this->getRedirectUriWithoutQuerys(),
            'code'          => $code
        );

        $result = $this->_makeOAuthCall(self::API_OAUTH_TOKEN_URL, $apiData);

        return !$tokenOnly ? $result : $result->access_token;
    }

    /**
     * @param string $token
     * @param bool   $tokenOnly
     *
     * @return object|string
     * @throws Exception
     */
    public function getLongLivedToken($token, $tokenOnly = false) {
        $apiData = array(
            'client_secret' => $this->getAppSecret(),
            'grant_type'    => 'ig_exchange_token',
            'access_token'  => $token
        );

        $result = $this->_makeOAuthCall(self::API_TOKEN_EXCHANGE_URL, $apiData, 'GET');

        return !$tokenOnly ? $result : $result->access_token;
    }

    /**
     * @param string $token
     * @param bool   $tokenOnly
     *
     * @return object|string
     * @throws Exception
     */
    public function refreshToken($token, $tokenOnly = false) {
        $apiData = array(
            'grant_type'   => 'ig_refresh_token',
            'access_token' => $token
        );

        $result = $this->_makeOAuthCall(self::API_TOKEN_REFRESH_URL, $apiData, 'GET');

        return !$tokenOnly ? $result : $result->access_token;
    }

    /**
     * @param string        $function
     * @param string[]|null $params
     * @param string        $method
     *
     * @return object
     * @throws Exception
     */
    protected function _makeCall($function, $params = null, $method = 'GET') {
        if (!isset($this->_accesstoken)) {
            throw new Exception("Error: _makeCall() | $function - This method requires an authenticated users access token.");
        }

        $authMethod = '?access_token=' . $this->getAccessToken();

        $paramString = null;

        if (isset($params) && is_array($params)) {
            $paramString = '&' . http_build_query($params);
        }

        $apiCall    = self::API_URL . $function . $authMethod . (('GET' === $method) ? $paramString : null);
        $headerData = array('Accept: application/json');

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $apiCall);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headerData);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->_connectTimeout);
        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->_timeout);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_HEADER, true);

        $jsonData = curl_exec($ch);

        if (!$jsonData) {
            throw new Exception('Error: _makeCall() - cURL error: ' . curl_error($ch), curl_errno($ch));
        }

        list($headerContent, $jsonData) = explode("\r\n\r\n", $jsonData, 2);

        $data = json_decode($jsonData);
        if(isset($data->error)) {
            throw new Exception($data->error->message);
        }

        curl_close($ch);

        return json_decode($jsonData);
    }

    /**
     * @param string   $apiHost
     * @param string[] $params
     * @param string   $method
     *
     * @return object
     * @throws Exception
     */
    private function _makeOAuthCall($apiHost, $params, $method = 'POST') {
        $paramString = null;

        if (isset($params) && is_array($params)) {
            $paramString = '?' . http_build_query($params);
        }

        $apiCall = $apiHost . (('GET' === $method) ? $paramString : null);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $apiCall);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->_timeout);

        if ($method === 'POST') {
            curl_setopt($ch, CURLOPT_POST, count($params));
            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
        }

        $jsonData = curl_exec($ch);

        if (!$jsonData) {
            throw new Exception('Error: _makeOAuthCall() - cURL error: ' . curl_error($ch));
        }

        curl_close($ch);

        return json_decode($jsonData);
    }

    /**
     * @param string $token
     */
    public function setAccessToken($token) {
        $this->_accesstoken = $token;
    }

    /**
     * @return string
     */
    public function getAccessToken() {
        return $this->_accesstoken;
    }

    /**
     * @param string $appId
     */
    public function setAppId($appId) {
        $this->_appId = $appId;
    }

    /**
     * @return string
     */
    public function getAppId() {
        return $this->_appId;
    }

    /**
     * @param string $appSecret
     */
    public function setAppSecret($appSecret) {
        $this->_appSecret = $appSecret;
    }

    /**
     * @return string
     */
    public function getAppSecret() {
        return $this->_appSecret;
    }

    /**
     * @param string $redirectUri
     */
    public function setRedirectUri($redirectUri) {
        $this->_redirectUri = $redirectUri;
    }

    /**
     * @return string
     */
    public function getRedirectUri() {
        return $this->_redirectUri;
    }


    /**
     * needs because Instagram Api removes query strings from the return url, and urls has to match
     *
     * @return string
     */
    public function getRedirectUriWithoutQuerys() {
        return strtok($this->_redirectUri, '?');
    }

    /**
     * @param string $fields
     */
    public function setUserFields($fields) {
        $this->_userFields = $fields;
    }

    /**
     * @param string $fields
     */
    public function setMediaFields($fields) {
        $this->_mediaFields = $fields;
    }

    /**
     * @param string $fields
     */
    public function setMediaChildrenFields($fields) {
        $this->_mediaChildrenFields = $fields;
    }

    /**
     * @param int $timeout
     */
    public function setTimeout($timeout) {
        $this->_timeout = $timeout;
    }

    /**
     * @param int $connectTimeout
     */
    public function setConnectTimeout($connectTimeout) {
        $this->_connectTimeout = $connectTimeout;
    }
}Generator/Common/Flickr/ConfigurationFlickr.php000064400000015256152355233130015622 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr;

use Exception;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\Message\Warning;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Token;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\Framework\Router\Router;
use Nextend\SmartSlider3\Application\ApplicationSmartSlider3;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroupConfiguration;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\api\DPZFlickr;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\Elements\FlickrToken;

class ConfigurationFlickr extends AbstractGeneratorGroupConfiguration {

    private $data;

    /**
     * N2SliderGeneratorFlickrConfiguration constructor.
     *
     * @param GeneratorGroupFlickr $group
     */
    public function __construct($group) {
        parent::__construct($group);
        $this->data = new Data(array(
            'api_key'    => '',
            'api_secret' => '',
            'token'      => ''
        ));

        $this->data->loadJSON(StorageSectionManager::getStorage('smartslider')
                                                   ->get('flickr'));
    }

    public function wellConfigured() {
        if (!$this->data->get('api_key') || !$this->data->get('api_secret') || !$this->data->get('token')) {
            return false;
        }
        $api = $this->getApi();

        if ($api->call('flickr.test.login') === false) {
            return false;
        }

        return true;
    }

    public function getApi() {
        $api_key    = $this->data->get('api_key');
        $api_secret = $this->data->get('api_secret');
        $auth_url   = ApplicationSmartSlider3::getInstance()
                                             ->getApplicationTypeAdmin()
                                             ->createUrl(array(
                                                 "generator/finishAuth",
                                                 array(
                                                     'group' => Request::$REQUEST->getVar('group')
                                                 )
                                             ));

        $api = new DPZFlickr($api_key, $api_secret, $auth_url);

        $token = json_decode($this->data->get('token'), true);
        $api->setData($token);

        return $api;
    }

    public function getData() {
        return $this->data->toArray();
    }

    public function addData($data, $store = true) {
        $this->data->loadArray($data);
        if ($store) {
            StorageSectionManager::getStorage('smartslider')
                                 ->set('flickr', null, json_encode($this->data->toArray()));
        }
    }

    public function render($MVCHelper) {

        $form = new Form($MVCHelper, 'generator');
        $form->loadArray($this->getData());


        $table = new ContainerTable($form->getContainer(), 'flickr-api', 'Flickr api');

        $callBackUrl = $this->getCallbackUrl($MVCHelper->getRouter());

        if (substr($callBackUrl, 0, 8) !== 'https://') {
            $url = "https://docs.joomla.org/Enabling_HTTPS_on_your_site";
        
            $warning     = $table->createRow('flickr-warning');
            $warningText = sprintf(n2_('%1$s allows HTTPS Redirect URIs only! You must move your site to HTTPS in order to use this generator!'), 'Flickr') . ' - <a href="' . $url . '" target="_blank" rel="nofollow noopener noreferrer">' . n2_('How to get SSL for my website?') . '</a>';
            new Warning($warning, 'warning', $warningText);
        } else {
            $instruction     = $table->createRow('flickr-instruction');
            $instructionText = sprintf(n2_('%2$s Check the documentation %3$s to learn how to configure your %1$s app.'), 'Flickr', '<a href="https://smartslider.helpscoutdocs.com/article/1905-flickr-generator" target="_blank">', '</a>');
            new Notice($instruction, 'instruction', n2_('Instruction'), $instructionText);
        }

        $settings = $table->createRow('flickr');
        new Text($settings, 'api_key', 'Api key', '', array(
            'style' => 'width:250px;'
        ));
        new Text($settings, 'api_secret', 'Api secret', '', array(
            'style' => 'width:250px;'
        ));
        new FlickrToken($settings, 'token', n2_('Token'));
        new Notice($settings, 'callback', n2_('Callback url'), $callBackUrl);
        new Token($settings);

        $api = $this->getApi();
        if ($api->call('flickr.test.login') === false) {
            Notification::error(n2_('The key and secret is not valid!'));
        }

        $form->render();
    }

    public function startAuth($MVCHelper) {
        if (session_id() == "") {
            session_start();
        }
        $this->addData(Request::$REQUEST->getVar('generator'), false);

        $_SESSION['data'] = $this->getData();
        $api              = $this->getApi();
        $api->setData(array());

        $url = $api->authenticate();

        if (!$url) {
            throw new Exception('Api key or Api secret is not valid.');
        }

        return $url;
    }

    public function finishAuth($MVCHelper) {
        if (session_id() == "") {
            session_start();
        }

        $api = $this->getApi();
        $api->setData(array());
        $api->authenticateStep2();

        $this->data->loadArray($_SESSION['data']);
        $data          = $this->getData();
        $data['token'] = json_encode(array(
            'oauth_request_token'        => $api->getOauthData('oauth_request_token'),
            'oauth_request_token_secret' => $api->getOauthData('oauth_request_token_secret'),
            'oauth_access_token'         => $api->getOauthData('oauth_access_token'),
            'oauth_access_token_secret'  => $api->getOauthData('oauth_access_token_secret'),
            'user_nsid'                  => $api->getOauthData('user_nsid')
        ));

        $this->addData($data);

        unset($_SESSION['FlickrSessionOauthData']);
        unset($_SESSION['data']);

        return true;
    }

    /**
     * @param Router $router
     *
     * @return string
     */
    private function getCallbackUrl($router) {
        return $router->createUrl(array(
            "generator/finishAuth",
            array(
                'group' => 'flickr'
            )
        ));
    }
}
Generator/Common/Flickr/GeneratorGroupFlickr.php000064400000002411152355233130015743 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources\FlickrPeopleAlbum;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources\FlickrPeoplePhotoGallery;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources\FlickrPeoplePhotoStream;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources\FlickrPhotosSearch;

class GeneratorGroupFlickr extends AbstractGeneratorGroup {

    protected $name = 'flickr';

    protected $needConfiguration = true;

    public function __construct() {
        parent::__construct();

        $this->configuration = new ConfigurationFlickr($this);
    }

    public function getLabel() {
        return 'Flickr';
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Flickr');
    }

    protected function loadSources() {

        new FlickrPeoplePhotoStream($this, 'peoplephotostream', 'Photostream');
        new FlickrPeopleAlbum($this, 'peoplealbum', 'Album');
        new FlickrPeoplePhotoGallery($this, 'peoplephotogallery', 'Photogallery');
        new FlickrPhotosSearch($this, 'photossearch', n2_('Search'));
    }
}Generator/Common/Flickr/Sources/FlickrPeopleAlbum.php000064400000013402152355233130016632 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\Elements\FlickrAlbums;

class FlickrPeopleAlbum extends AbstractGenerator {

    protected $layout = 'image_extended';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Flickr album');
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new FlickrAlbums($filter, 'peoplephotoset', n2_('Album'), '', array(
            'api' => $this->group->getConfiguration()
                                 ->getApi()
        ));
    }

    protected function fallback($images) {
        foreach ($images as $image) {
            if (!empty($image)) {
                return $image;
            }
        }

        return '';
    }

    protected function _getData($count, $startIndex) {

        $data = array();

        $photoSet = $this->data->get('peoplephotoset', 0);
        if ($photoSet != '') {

            $client = $this->group->getConfiguration()
                                  ->getApi();

            $result = $client->photosets_getPhotos($photoSet, 'description, date_upload, date_taken, owner_name, geo, tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', NULL, $startIndex + $count);

            if (is_array($result['photoset']['photo']) && !empty($result['photoset']['photo'])) {
                $photos = array_slice($result['photoset']['photo'], $startIndex, $count);
            } else {
                Notification::error(n2_('There are no photos in this album!'));

                return null;
            }

            $imageTypes = array(
                't',
                's',
                'q',
                'm',
                'n',
                'z',
                'c',
                'l',
                'o'
            );

            $ownerCache = array();
            $i          = 0;
            foreach ($photos as $photo) {
                if (!isset($ownerCache[$photo['ownername']])) {
                    $owner                           = $client->people_findByUsername($photo['ownername']);
                    $ownerCache[$photo['ownername']] = $client->people_getInfo($owner['user']['nsid']);
                }
                $ow = $ownerCache[$photo['ownername']];

                foreach ($imageTypes as $imageType) {
                    if (!isset($photo['url_' . $imageType])) {
                        $photo['url_' . $imageType] = '';
                    }
                }

                $data[$i]['image']       = $this->fallback(array(
                    $photo['url_o'],
                    $photo['url_l'],
                    $photo['url_z'],
                    $photo['url_m']
                ));
                $data[$i]['thumbnail']   = $this->fallback(array(
                    $photo['url_m'],
                    $photo['url_l'],
                    $photo['url_t']
                ));
                $data[$i]['title']       = $photo['title'];
                $data[$i]['description'] = $photo['description']['_content'];
                $data[$i]['url']         = $ow['person']['photosurl']['_content'];
                $data[$i]['url_label']   = n2_('View');

                $data[$i]['owner_username']       = $ow['person']['username']['_content'];
                $data[$i]['author_name']          = isset($ow['person']['realname']['_content']) ? $ow['person']['realname']['_content'] : $ow['person']['username']['_content'];
                $data[$i]['author_url']           = $ow['person']['profileurl']['_content'];
                $data[$i]['url_t']                = $photo['url_t'];
                $data[$i]['url_s']                = $photo['url_s'];
                $data[$i]['url_q']                = $photo['url_q'];
                $data[$i]['url_m']                = $photo['url_m'];
                $data[$i]['url_n']                = $photo['url_n'];
                $data[$i]['url_z']                = $photo['url_z'];
                $data[$i]['url_c']                = $photo['url_c'];
                $data[$i]['url_l']                = $photo['url_l'];
                $data[$i]['url_o']                = $photo['url_o'];
                $data[$i]['dateupload']           = $photo['dateupload'];
                $data[$i]['datetaken']            = $photo['datetaken'];
                $data[$i]['datetakengranularity'] = $photo['datetakengranularity'];
                $data[$i]['datetakenunknown']     = $photo['datetakenunknown'];
                $data[$i]['ownername']            = $photo['ownername'];
                $data[$i]['views']                = $photo['views'];
                $data[$i]['tags']                 = $photo['tags'];
                $data[$i]['latitude']             = $photo['latitude'];
                $data[$i]['longitude']            = $photo['longitude'];
                $data[$i]['accuracy']             = $photo['accuracy'];
                $data[$i]['context']              = $photo['context'];
                $data[$i]['media']                = $photo['media'];
                $data[$i]['media_status']         = $photo['media_status'];
                $data[$i]['url_sq']               = $photo['url_sq'];
                $i++;
            }
        } else {
            Notification::error(n2_('Please choose an album!'));
        }

        return $data;
    }
}Generator/Common/Flickr/Sources/FlickrPeoplePhotoStream.php000064400000012600152355233130020036 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class FlickrPeoplePhotoStream extends AbstractGenerator {

    protected $layout = 'image_extended';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Flickr photo stream');
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Select($filter, 'peoplephotostreamprivacy', n2_('Privacy'), 1, array(
            'options' => array(
                '1' => 'Public photos',
                '2' => 'Private photos visible to friends',
                '3' => 'Private photos visible to family',
                '4' => 'Private photos visible to friends &amp; family',
                '5' => 'Completely private photos'
            )
        ));
    }

    protected function fallback($images) {
        foreach ($images as $image) {
            if (!empty($image)) {
                return $image;
            }
        }

        return '';
    }

    protected function _getData($count, $startIndex) {
        $data = array();

        $client = $this->group->getConfiguration()
                              ->getApi();

        $peoplephotostreamprivacy = intval($this->data->get('peoplephotostreamprivacy', 1));

        $result = $client->people_getPhotos('me', array(
            'per_page'       => $startIndex + $count,
            'privacy_filter' => $peoplephotostreamprivacy,
            'extras'         => 'description, date_upload, date_taken, owner_name, geo, tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o'
        ));

        if (is_array($result['photos']['photo']) && !empty($result['photos']['photo'])) {
            $photos = array_slice($result['photos']['photo'], $startIndex, $count);
        } else {
            Notification::error(n2_('There are no photos with this privacy filter!'));

            return null;
        }

        $ownerCache = array();

        $i = 0;
        foreach ($photos as $photo) {
            if (!isset($ownerCache[$photo['ownername']])) {
                $owner                           = $client->people_findByUsername($photo['ownername']);
                $ownerCache[$photo['ownername']] = $client->people_getInfo($owner['user']['nsid']);
            }
            $ow = $ownerCache[$photo['ownername']];

            $data[$i]['image']       = $this->fallback(array(
                $photo['url_o'],
                $photo['url_l'],
                $photo['url_z'],
                $photo['url_m']
            ));
            $data[$i]['thumbnail']   = $this->fallback(array(
                $photo['url_m'],
                $photo['url_l'],
                $photo['url_t']
            ));
            $data[$i]['title']       = $photo['title'];
            $data[$i]['description'] = $photo['description']['_content'];
            $data[$i]['url']         = $ow['person']['photosurl']['_content'];
            $data[$i]['url_label']   = n2_('View');

            $data[$i]['owner_username']       = $ow['person']['username']['_content'];
            $data[$i]['author_name']          = isset($ow['person']['realname']['_content']) ? $ow['person']['realname']['_content'] : $ow['person']['username']['_content'];
            $data[$i]['author_url']           = $ow['person']['profileurl']['_content'];
            $data[$i]['url_t']                = $photo['url_t'];
            $data[$i]['url_s']                = $photo['url_s'];
            $data[$i]['url_q']                = $photo['url_q'];
            $data[$i]['url_m']                = $photo['url_m'];
            $data[$i]['url_n']                = $photo['url_n'];
            $data[$i]['url_z']                = $photo['url_z'];
            $data[$i]['url_c']                = $photo['url_c'];
            $data[$i]['url_l']                = $photo['url_l'];
            $data[$i]['url_o']                = $photo['url_o'];
            $data[$i]['owner']                = $photo['owner'];
            $data[$i]['dateupload']           = $photo['dateupload'];
            $data[$i]['datetaken']            = $photo['datetaken'];
            $data[$i]['datetakengranularity'] = $photo['datetakengranularity'];
            $data[$i]['datetakenunknown']     = $photo['datetakenunknown'];
            $data[$i]['ownername']            = $photo['ownername'];
            $data[$i]['views']                = $photo['views'];
            $data[$i]['tags']                 = $photo['tags'];
            $data[$i]['latitude']             = $photo['latitude'];
            $data[$i]['longitude']            = $photo['longitude'];
            $data[$i]['accuracy']             = $photo['accuracy'];
            $data[$i]['context']              = $photo['context'];
            $data[$i]['media']                = $photo['media'];
            $data[$i]['media_status']         = $photo['media_status'];
            $data[$i]['url_sq']               = $photo['url_sq'];
            $i++;
        }

        return $data;
    }

}
Generator/Common/Flickr/Sources/FlickrPeoplePhotoGallery.php000064400000013527152355233130020213 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\Flickr\Elements\FlickrGalleries;

class FlickrPeoplePhotoGallery extends AbstractGenerator {

    protected $layout = 'image_extended';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), 'Flickr gallery');
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new FlickrGalleries($filter, 'peoplephotogallery', n2_('Album'), '', array(
            'api' => $this->group->getConfiguration()
                                 ->getApi()
        ));
    }

    protected function fallback($images) {
        foreach ($images as $image) {
            if (!empty($image)) {
                return $image;
            }
        }

        return '';
    }

    protected function _getData($count, $startIndex) {

        $data = array();

        $galleryID = $this->data->get('peoplephotogallery', 0);
        if ($galleryID != 0) {

            $client = $this->group->getConfiguration()
                                  ->getApi();

            $result = $client->galleries_getPhotos($galleryID, 'description, date_upload, date_taken, owner_name, geo, tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', $count + $startIndex);
            if (is_array($result['photos']['photo']) && !empty($result['photos']['photo'])) {
                $photos = array_slice($result['photos']['photo'], $startIndex, $count);
            } else {
                Notification::error(n2_('There are no photos in this gallery!'));

                return null;
            }

            $imageTypes = array(
                't',
                's',
                'q',
                'm',
                'n',
                'z',
                'c',
                'l',
                'o'
            );

            $ownerCache = array();
            $i          = 0;
            foreach ($photos as $photo) {
                if (!isset($ownerCache[$photo['ownername']])) {
                    $owner                           = $client->people_findByUsername($photo['ownername']);
                    $ownerCache[$photo['ownername']] = $client->people_getInfo($owner['user']['nsid']);
                }
                $ow = $ownerCache[$photo['ownername']];

                foreach ($imageTypes as $imageType) {
                    if (!isset($photo['url_' . $imageType])) {
                        $photo['url_' . $imageType] = '';
                    }
                }

                $data[$i]['image']       = $this->fallback(array(
                    $photo['url_o'],
                    $photo['url_l'],
                    $photo['url_z'],
                    $photo['url_m']
                ));
                $data[$i]['thumbnail']   = $this->fallback(array(
                    $photo['url_m'],
                    $photo['url_l'],
                    $photo['url_t']
                ));
                $data[$i]['title']       = $photo['title'];
                $data[$i]['description'] = $photo['description']['_content'];
                $data[$i]['url']         = $ow['person']['photosurl']['_content'];
                $data[$i]['url_label']   = n2_('View');

                $data[$i]['owner_username']       = $ow['person']['username']['_content'];
                $data[$i]['author_name']          = isset($ow['person']['realname']['_content']) ? $ow['person']['realname']['_content'] : $ow['person']['username']['_content'];
                $data[$i]['author_url']           = $ow['person']['profileurl']['_content'];
                $data[$i]['url_t']                = $photo['url_t'];
                $data[$i]['url_s']                = $photo['url_s'];
                $data[$i]['url_q']                = $photo['url_q'];
                $data[$i]['url_m']                = $photo['url_m'];
                $data[$i]['url_n']                = $photo['url_n'];
                $data[$i]['url_z']                = $photo['url_z'];
                $data[$i]['url_c']                = $photo['url_c'];
                $data[$i]['url_l']                = $photo['url_l'];
                $data[$i]['url_o']                = $photo['url_o'];
                $data[$i]['owner']                = $photo['owner'];
                $data[$i]['dateupload']           = $photo['dateupload'];
                $data[$i]['datetaken']            = $photo['datetaken'];
                $data[$i]['datetakengranularity'] = $photo['datetakengranularity'];
                $data[$i]['datetakenunknown']     = $photo['datetakenunknown'];
                $data[$i]['ownername']            = $photo['ownername'];
                $data[$i]['views']                = $photo['views'];
                $data[$i]['tags']                 = $photo['tags'];
                $data[$i]['latitude']             = $photo['latitude'];
                $data[$i]['longitude']            = $photo['longitude'];
                $data[$i]['accuracy']             = $photo['accuracy'];
                $data[$i]['context']              = $photo['context'];
                $data[$i]['media']                = $photo['media'];
                $data[$i]['media_status']         = $photo['media_status'];
                $data[$i]['url_sq']               = $photo['url_sq'];
                $i++;
            }
        } else {
            Notification::error(n2_('Please chooose a gallery!'));
        }

        return $data;
    }
}Generator/Common/Flickr/Sources/FlickrPhotosSearch.php000064400000007432152355233130017035 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class FlickrPhotosSearch extends AbstractGenerator {

    protected $layout = 'image';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_x('Flickr search', 'Flickr generator type'));
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Text($filter, 'userID', n2_('User name or ID'), 'me');
        new Text($filter, 'tags', n2_('Tags'), '');
        new Text($filter, 'text', n2_('Search in title, description or tags'), '');

        new Select($filter, 'privacy', n2_('Privacy'), 1, array(
            'options' => array(
                '1' => 'Public photos',
                '2' => 'Private photos visible to friends',
                '3' => 'Private photos visible to family',
                '4' => 'Private photos visible to friends &amp; family',
                '5' => 'Completely private photos'
            )
        ));
        new Select($filter, 'type', n2_('Type'), 7, array(
            'options' => array(
                '7' => n2_('All'),
                '1' => 'Photos only',
                '2' => 'Screenshots only',
                '3' => '\'Other\' only',
                '4' => 'Photos and screenshots',
                '5' => 'Screenshots and \'other\'',
                '6' => 'Photos and \'other\''

            )
        ));

    }

    protected function _getData($count, $startIndex) {
        $client = $this->group->getConfiguration()
                              ->getApi();

        $userID  = $this->data->get('userID', 'me');
        $tags    = $this->data->get('tags', '');
        $text    = $this->data->get('text', '');
        $privacy = $this->data->get('privacy', '1');
        $type    = $this->data->get('type', '1');

        $args = array(
            'tags'           => $tags,
            'user_id'        => $userID,
            'text'           => $text,
            'privacy_filter' => $privacy,
            'content_type'   => $type,
            'per_page'       => $count
        );

        $result = $client->photos_search($args);
        if (is_array($result['photos']) && !empty($result['photos'])) {
            $photos = $result['photos']['photo'];
        } else {
            return null;
        }

        $data = array();
        foreach ($photos as $photo) {
            if (!isset($ow)) {
                $ow = $client->people_getInfo($photo['owner']);
            }
            $image  = 'https://c2.staticflickr.com/' . $photo['farm'] . '/' . $photo['server'] . '/' . $photo['id'] . '_' . $photo['secret'];
            $r      = array(
                'image'     => $image . '_b.jpg',
                'thumbnail' => $image . '_m.jpg',
                'title'     => $photo['title'],
                'url'       => 'https://www.flickr.com/photos/' . $photo['owner'] . '/' . $photo['id'],
                'url_b'     => $image . '_b.jpg',
                'url_c'     => $image . '_c.jpg',
                'url_h'     => $image . '_h.jpg',
                'url_m'     => $image . '_m.jpg',
                'url_n'     => $image . '_n.jpg',
                'url_s'     => $image . '_s.jpg',
                'url_t'     => $image . '_t.jpg',
                'url_q'     => $image . '_q.jpg',
                'url_z'     => $image . '_z.jpg'
            );
            $data[] = $r;
        }

        return $data;
    }
}Generator/Common/Flickr/Elements/FlickrAlbums.php000064400000002330152355233130015777 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\Elements;

use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Notification\Notification;


class FlickrAlbums extends Select {

    /** @var  DPZFlickr */
    protected $api;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $result = $this->api->photosets_getList('');

        if (isset($result['stat']) && $result['stat'] == "fail") {
            Notification::error($result['message']);

            return false;
        }
        if (isset($result['photosets']) && isset($result['photosets']['photoset'])) {
            $photoSets = $result['photosets']['photoset'];
            if (count($photoSets)) {
                foreach ($photoSets as $set) {
                    $this->options[$set['id']] = $set['title']['_content'];
                }
                if ($this->getValue() == '') {
                    $this->setValue($photoSets[0]['id']);
                }
            }
        }
    }

    public function setApi($api) {
        $this->api = $api;
    }
}
Generator/Common/Flickr/Elements/FlickrToken.php000064400000001713152355233130015640 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\Elements;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Request\Request;


class FlickrToken extends Text {

    protected function fetchElement() {

        $authUrl = $this->getForm()
                        ->createAjaxUrl(array(
                            "generator/getAuthUrl",
                            array(
                                'group' => Request::$REQUEST->getVar('group'),
                                'type'  => Request::$REQUEST->getVar('type')
                            )
                        ));

        Js::addInline('new _N2.FormElementFlickrToken("' . $this->fieldID . '", "' . $authUrl . '");');

        return parent::fetchElement();
    }

    protected function post() {
        return '<a class="n2_field_text__choose_text" href="#">' . n2_('Request token') . '</a>';
    }
}Generator/Common/Flickr/Elements/FlickrGalleries.php000064400000002353152355233130016470 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\Elements;

use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Notification\Notification;


class FlickrGalleries extends Select {

    /** @var  DPZFlickr */
    protected $api;

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $result = $this->api->galleries_getList('');

        if (isset($result['stat']) && $result['stat'] == "fail") {
            Notification::error($result['message']);

            return false;
        }

        if (isset($result['galleries']) && isset($result['galleries']['gallery'])) {
            $galleries = $result['galleries']['gallery'];

            if (count($galleries)) {
                foreach ($galleries as $gallery) {
                    $this->options[$gallery['id']] = $gallery['title']['_content'];
                }
                if ($this->getValue() == '') {
                    $this->setValue($galleries[0]['id']);
                }
            }
        }

    }

    public function setApi($api) {
        $this->api = $api;
    }
}
Generator/Common/Flickr/api/DPZFlickr.php000064400000061772152355233130014225 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Flickr\api;

use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use WP_HTTP_Proxy;

/**
 * Flickr API Kit with support for OAuth 1.0a for PHP >= 5.3.0. Requires curl.
 *
 * Author: David Wilkinson
 * Web: http://dopiaza.org/
 *
 * Copyright (c) 2012 David Wilkinson
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
 * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */
class DPZFlickr {

    const VERSION = '1.3';

    /**
     * Session variable name used to store authentication data
     */
    const SESSION_OAUTH_DATA = 'FlickrSessionOauthData';

    /**
     * Key names for various authentication data items
     */
    const OAUTH_REQUEST_TOKEN = 'oauth_request_token';
    const OAUTH_REQUEST_TOKEN_SECRET = 'oauth_request_token_secret';
    const OAUTH_VERIFIER = 'oauth_verifier';
    const OAUTH_ACCESS_TOKEN = 'oauth_access_token';
    const OAUTH_ACCESS_TOKEN_SECRET = 'oauth_access_token_secret';
    const USER_NSID = 'user_nsid';
    const USER_NAME = 'user_name';
    const USER_FULL_NAME = 'user_full_name';
    const PERMISSIONS = 'permissions';
    const IS_AUTHENTICATING = 'is_authenticating';

    /**
     * Default timeout in seconds for HTTP requests
     */
    const DEFAULT_HTTP_TIMEOUT = 30;

    /**
     * Various API endpoints
     */
    const REQUEST_TOKEN_ENDPOINT = 'https://www.flickr.com/services/oauth/request_token';
    const AUTH_ENDPOINT = 'https://www.flickr.com/services/oauth/authorize';
    const ACCESS_TOKEN_ENDPOINT = 'https://www.flickr.com/services/oauth/access_token';
    const API_ENDPOINT = 'https://api.flickr.com/services/rest';
    const UPLOAD_ENDPOINT = 'https://up.flickr.com/services/upload/';
    const REPLACE_ENDPOINT = 'https://up.flickr.com/services/replace/';

    /**
     * @var string Flickr API key
     */
    private $consumerKey;

    /**
     * @var string Flickr API secret
     */
    private $consumerSecret;

    /**
     * @var string Callback URI for authentication
     */
    private $callback;

    /**
     * @var string HTTP Method to use for API calls
     */
    private $method = 'POST';

    /**
     * @var int HTTP Response code for last call made
     */
    private $lastHttpResponseCode;

    /**
     * @var int Timeout in seconds for HTTP calls
     */
    private $httpTimeout;

    private $data = array();

    /**
     * Create a new Flickr object
     *
     * @param string $key      The Flickr API key
     * @param string $secret   The Flickr API secret
     * @param string $callback The callback URL for authentication
     */
    public function __construct($key, $secret = NULL, $callback = NULL) {
        // start a new session if there isn't one already
        if (session_id() == '') {
            session_start();
        }

        $this->consumerKey    = $key;
        $this->consumerSecret = $secret;
        $this->callback       = $callback;

        $this->httpTimeout = self::DEFAULT_HTTP_TIMEOUT;
    }

    /**
     * Call a Flickr API method
     *
     * @param string $method     The FLickr API method name
     * @param array  $parameters The method parameters
     *
     * @return mixed|null The response object
     */
    public function call($method, $parameters = NULL) {
        $requestParams           = ($parameters == NULL ? array() : $parameters);
        $requestParams['method'] = $method;
        $requestParams['format'] = 'php_serial';

        $requestParams = array_merge($requestParams, $this->getOauthParams());

        $requestParams['oauth_token'] = $this->getOauthData(self::OAUTH_ACCESS_TOKEN);
        $this->sign(self::API_ENDPOINT, $requestParams);

        $response = $this->httpRequest(self::API_ENDPOINT, $requestParams);

        if ($response == 'oauth_problem=token_rejected') {
            $unserialize = NULL;
        } else {
            $unserialize = @unserialize($response);
            if ($unserialize == false) {
                Notification::error('Flickr API error. <a href="https://smartslider.helpscoutdocs.com/article/1905-flickr-generator">Request a new token!</a>');
            }
        }

        return empty($response) ? NULL : $unserialize;
    }

    /**
     * Upload a photo
     *
     * @param $parameters
     *
     * @return mixed|null
     */
    public function upload($parameters) {
        $requestParams = ($parameters == NULL ? array() : $parameters);

        $requestParams = array_merge($requestParams, $this->getOauthParams());

        $requestParams['oauth_token'] = $this->getOauthData(self::OAUTH_ACCESS_TOKEN);

        // We don't want to include the photo when signing the request
        // so temporarily remove it whilst we sign
        $photo = $requestParams['photo'];
        unset($requestParams['photo']);
        $this->sign(self::UPLOAD_ENDPOINT, $requestParams);
        $requestParams['photo'] = $photo;

        $xml = $this->httpRequest(self::UPLOAD_ENDPOINT, $requestParams);

        $response = $this->getResponseFromXML($xml);

        return empty($response) ? NULL : $response;
    }

    /**
     * Replace a photo
     *
     * @param $parameters
     *
     * @return mixed|null
     */
    public function replace($parameters) {
        $requestParams = ($parameters == NULL ? array() : $parameters);

        $requestParams = array_merge($requestParams, $this->getOauthParams());

        $requestParams['oauth_token'] = $this->getOauthData(self::OAUTH_ACCESS_TOKEN);

        // We don't want to include the photo when signing the request
        // so temporarily remove it whilst we sign
        $photo = $requestParams['photo'];
        unset($requestParams['photo']);
        $this->sign(self::REPLACE_ENDPOINT, $requestParams);
        $requestParams['photo'] = $photo;

        $xml = $this->httpRequest(self::REPLACE_ENDPOINT, $requestParams);

        $response = $this->getResponseFromXML($xml);

        return empty($response) ? NULL : $response;
    }

    public function authenticate($permissions = 'read') {

        // We're authenticating afresh, clear out the session just in case there are remnants of a
        // previous authentication in there
        $this->signout();

        if ($this->obtainRequestToken()) {
            // We've got the request token, redirect to Flickr for authentication/authorisation
            // Make a note in the session of where we are first
            $this->setOauthData(self::IS_AUTHENTICATING, true);
            $this->setOauthData(self::PERMISSIONS, $permissions);

            return (sprintf('%s?oauth_token=%s&perms=%s', self::AUTH_ENDPOINT, $this->getOauthData(self::OAUTH_REQUEST_TOKEN), $permissions));
        }

        return false;
    }

    public function authenticateStep2() {
        if ($this->getOauthData(self::IS_AUTHENTICATING)) {
            $oauthToken    = Request::$GET->getVar('oauth_token');
            $oauthVerifier = Request::$GET->getVar('oauth_verifier');

            if (!empty($oauthToken) && !empty($oauthVerifier)) {
                // Looks like we're in the callback
                $this->setOauthData(self::OAUTH_REQUEST_TOKEN, $oauthToken);
                $this->setOauthData(self::OAUTH_VERIFIER, $oauthVerifier);

                return $this->obtainAccessToken();
            }

            $this->setOauthData(self::IS_AUTHENTICATING, false);
        }

        return false;
    }

    /**
     * Sign the current user out of the current Flickr session. Note this doesn't affect the user's state on the
     * Flickr web site itself, it merely removes the current request/access tokens from the session.
     *
     */
    public function signout() {
        unset($_SESSION[self::SESSION_OAUTH_DATA]);
    }

    /**
     * Is the current session authenticated on Flickr
     *
     * @return bool the current authentication status
     */
    public function isAuthenticated() {
        $authNSID = $this->getOauthData(self::USER_NSID);

        return !empty($authNSID);
    }

    /**
     * Return a value from the OAuth session data
     *
     * @param string $key
     *
     * @return string value
     */
    public function getOauthData($key) {
        if (isset($this->data[$key])) {
            return $this->data[$key];
        }
        $val  = NULL;
        $data = @$_SESSION[self::SESSION_OAUTH_DATA];
        if (is_array($data)) {
            $val = @$data[$key];
        }

        return $val;
    }

    public function setData($data) {
        $this->data = $data;
    }

    /**
     * Return the HTTP Response code for the last HTTP call made
     *
     * @return int
     */
    public function getLastHttpResponseCode() {
        return $this->lastHttpResponseCode;
    }

    /**
     * Set the timeout for HTTP requests
     *
     * @param int $timeout
     */
    public function setHttpTimeout($timeout) {
        $this->httpTimeout = $timeout;
    }


    /**
     * Convert an old authentication token into an OAuth access token
     *
     * @param string $token
     */
    public function convertOldToken($token) {
        $param = array(
            'method'     => 'flickr.auth.oauth.getAccessToken',
            'format'     => 'php_serial',
            'api_key'    => $this->consumerKey,
            'auth_token' => $token
        );

        $this->signUsingOldStyleAuth($param);

        $rsp      = $this->httpRequest(self::API_ENDPOINT, $param);
        $response = unserialize($rsp);

        if (@$response['stat'] == 'ok') {
            $accessToken       = @$response['auth']['access_token']['oauth_token'];
            $accessTokenSecret = @$response['auth']['access_token']['oauth_token_secret'];
            $this->setOauthData(self::OAUTH_ACCESS_TOKEN, $accessToken);
            $this->setOauthData(self::OAUTH_ACCESS_TOKEN_SECRET, $accessTokenSecret);

            $response = $this->call('flickr.auth.oauth.checkToken');
            if (@$response['stat'] == 'ok') {
                $this->setOauthData(self::USER_NSID, @$response['oauth']['user']['nsid']);
                $this->setOauthData(self::USER_NAME, @$response['oauth']['user']['username']);
                $this->setOauthData(self::USER_FULL_NAME, @$response['oauth']['user']['fullname']);
            }
        }
    }

    /**
     * Sign an array of parameters using the old-style auth method
     *
     * @param array $parameters
     */
    private function signUsingOldStyleAuth(&$parameters) {
        $keys = array_keys($parameters);
        sort($keys, SORT_STRING);
        $s = $this->consumerSecret;
        foreach ($keys as $k) {
            $s .= $k . $parameters[$k];
        }

        $parameters['api_sig'] = md5($s);
    }

    public function setOauthData($key, $value) {
        $data = @$_SESSION[self::SESSION_OAUTH_DATA];
        if (!is_array($data)) {
            $data = array();
        }
        $data[$key]                         = $value;
        $_SESSION[self::SESSION_OAUTH_DATA] = $data;
    }

    /**
     * Check whether the current permission satisfy those requested
     *
     * @param string $permissionsRequired
     *
     * @return bool
     */
    private function doWeHaveGoodEnoughPermissions($permissionsRequired) {
        $ok = false;

        $currentPermissions = $this->getOauthData(self::PERMISSIONS);

        switch ($permissionsRequired) {
            case 'read':
                $ok = preg_match('/^(read|write|delete)$/', $currentPermissions);
                break;

            case 'write':
                $ok = preg_match('/^(write|delete)$/', $currentPermissions);
                break;

            case 'delete':
                $ok = ($currentPermissions == 'delete');
                break;
        }

        return $ok;
    }

    /**
     * Get a request token from Flickr
     *
     * @return bool
     */
    private function obtainRequestToken() {
        $params                   = $this->getOauthParams();
        $params['oauth_callback'] = $this->callback;

        $this->sign(self::REQUEST_TOKEN_ENDPOINT, $params);

        $rsp                = $this->httpRequest(self::REQUEST_TOKEN_ENDPOINT, $params);
        $responseParameters = $this->splitParameters($rsp);
        $callbackOK         = (@$responseParameters['oauth_callback_confirmed'] == 'true');

        if ($callbackOK) {
            $this->setOauthData(self::OAUTH_REQUEST_TOKEN, @$responseParameters['oauth_token']);
            $this->setOauthData(self::OAUTH_REQUEST_TOKEN_SECRET, @$responseParameters['oauth_token_secret']);
        }

        return $callbackOK;
    }

    /**
     * Get an access token from Flickr
     *
     * @return bool
     */
    private function obtainAccessToken() {
        $params                   = $this->getOauthParams();
        $params['oauth_token']    = $this->getOauthData(self::OAUTH_REQUEST_TOKEN);
        $params['oauth_verifier'] = $this->getOauthData(self::OAUTH_VERIFIER);

        $this->sign(self::ACCESS_TOKEN_ENDPOINT, $params);

        $rsp = $this->httpRequest(self::ACCESS_TOKEN_ENDPOINT, $params);

        $responseParameters = $this->splitParameters($rsp);
        $ok                 = !empty($responseParameters['oauth_token']);

        if ($ok) {
            $this->setOauthData(self::OAUTH_ACCESS_TOKEN, @$responseParameters['oauth_token']);
            $this->setOauthData(self::OAUTH_ACCESS_TOKEN_SECRET, @$responseParameters['oauth_token_secret']);
            $this->setOauthData(self::USER_NSID, @$responseParameters['user_nsid']);
            $this->setOauthData(self::USER_NAME, @$responseParameters['username']);
            $this->setOauthData(self::USER_FULL_NAME, @$responseParameters['fullname']);
        }

        return $ok;
    }

    /**
     * Split a string into an array of key-value pairs
     *
     * @param string $string
     *
     * @return array
     */
    private function splitParameters($string) {
        $parameters    = array();
        $keyValuePairs = explode('&', $string);
        foreach ($keyValuePairs as $kvp) {
            $pieces = explode('=', $kvp);
            if (count($pieces) == 2) {
                $parameters[rawurldecode($pieces[0])] = rawurldecode($pieces[1]);
            }
        }

        return $parameters;
    }

    /**
     * Join an array of parameters together into a URL-encoded string
     *
     * @param array $parameters
     *
     * @return string
     */
    private function joinParameters($parameters) {
        $keys = array_keys($parameters);
        sort($keys, SORT_STRING);
        $keyValuePairs = array();
        foreach ($keys as $k) {
            if ($parameters[$k] !== null) {
                array_push($keyValuePairs, rawurlencode($k) . "=" . rawurlencode($parameters[$k]));
            }
        }

        return implode("&", $keyValuePairs);
    }

    /**
     * Get the base string for creating an OAuth signature
     *
     * @param string $method
     * @param string $url
     * @param array  $parameters
     *
     * @return string
     */
    private function getBaseString($method, $url, $parameters) {
        $components = array(
            rawurlencode($method),
            rawurlencode($url),
            rawurlencode($this->joinParameters($parameters))
        );

        $baseString = implode("&", $components);

        return $baseString;
    }

    /**
     * Sign an array of parameters with an OAuth signature
     *
     * @param string $url
     * @param array  $parameters
     */
    private function sign($url, &$parameters) {
        $baseString                    = $this->getBaseString($this->method, $url, $parameters);
        $signature                     = $this->getSignature($baseString);
        $parameters['oauth_signature'] = $signature;
    }

    /**
     * Calculate the signature for a string
     *
     * @param string $string
     *
     * @return string
     */
    private function getSignature($string) {
        $keyPart1 = $this->consumerSecret;
        $keyPart2 = $this->getOauthData(self::OAUTH_ACCESS_TOKEN_SECRET);
        if (empty($keyPart2)) {
            $keyPart2 = $this->getOauthData(self::OAUTH_REQUEST_TOKEN_SECRET);
        }
        if (empty($keyPart2)) {
            $keyPart2 = '';
        }

        $key = "$keyPart1&$keyPart2";

        return Base64::encode(hash_hmac('sha1', $string, $key, true));
    }

    /**
     * Get the standard OAuth parameters
     *
     * @return array
     */
    private function getOauthParams() {
        $params = array(
            'oauth_nonce'            => $this->makeNonce(),
            'oauth_timestamp'        => time(),
            'oauth_consumer_key'     => $this->consumerKey,
            'oauth_signature_method' => 'HMAC-SHA1',
            'oauth_version'          => '1.0',
        );

        return $params;
    }

    /**
     * Create a nonce
     *
     * @return string
     */
    private function makeNonce() {
        // Create a string that will be unique for this app and this user at this time
        $reasonablyDistinctiveString = implode(':', array(
            $this->consumerKey,
            $this->getOauthData(self::USER_NSID),
            microtime()
        ));

        return md5($reasonablyDistinctiveString);
    }

    /**
     * Get the response structure from an XML response.
     * Annoyingly, upload and replace returns XML rather than serialised PHP.
     * The responses are pretty simple, so rather than depend on an XML parser we'll fake it and
     * decode using regexps
     *
     * @param $xml
     *
     * @return mixed
     */
    private function getResponseFromXML($xml) {
        $rsp     = array();
        $stat    = 'fail';
        $matches = array();
        preg_match('/<rsp stat="(ok|fail)">/s', $xml, $matches);
        if (count($matches) > 0) {
            $stat = $matches[1];
        }
        if ($stat == 'ok') {
            // do this in individual steps in case the order of the attributes ever changes
            $rsp['stat'] = $stat;
            $photoid     = array();
            $matches     = array();
            preg_match('/<photoid.*>(\d+)<\/photoid>/s', $xml, $matches);
            if (count($matches) > 0) {
                $photoid['_content'] = $matches[1];
            }
            $matches = array();
            preg_match('/<photoid.* secret="(\w+)".*>/s', $xml, $matches);
            if (count($matches) > 0) {
                $photoid['secret'] = $matches[1];
            }
            $matches = array();
            preg_match('/<photoid.* originalsecret="(\w+)".*>/s', $xml, $matches);
            if (count($matches) > 0) {
                $photoid['originalsecret'] = $matches[1];
            }
            $rsp['photoid'] = $photoid;
        } else {
            $rsp['stat'] = 'fail';
            $err         = array();
            $matches     = array();
            preg_match('/<err.* code="([^"]*)".*>/s', $xml, $matches);
            if (count($matches) > 0) {
                $err['code'] = $matches[1];
            }
            $matches = array();
            preg_match('/<err.* msg="([^"]*)".*>/s', $xml, $matches);
            if (count($matches) > 0) {
                $err['msg'] = $matches[1];
            }
            $rsp['err'] = $err;
        }

        return $rsp;
    }

    /**
     * Make an HTTP request
     *
     * @param string $url
     * @param array  $parameters
     *
     * @return mixed
     */
    private function httpRequest($url, $parameters) {
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($curl, CURLOPT_TIMEOUT, $this->httpTimeout);

        if ($this->method == 'POST') {
            curl_setopt($curl, CURLOPT_URL, $url);
            curl_setopt($curl, CURLOPT_POST, TRUE);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $parameters);
        } else {
            // Assume GET
            curl_setopt($curl, CURLOPT_URL, "$url?" . $this->joinParameters($parameters));
        }

        $response = curl_exec($curl);
        $headers  = curl_getinfo($curl);

        curl_close($curl);

        $this->lastHttpResponseCode = $headers['http_code'];

        return $response;
    }

    function people_getPhotos($user_id, $args = array()) {
        /* This function strays from the method of arguments that I've
         * used in the other functions for the fact that there are just
         * so many arguments to this API method. What you'll need to do
         * is pass an associative array to the function containing the
         * arguments you want to pass to the API.  For example:
         *   $photos = $f->photos_search(array("tags"=>"brown,cow", "tag_mode"=>"any"));
         * This will return photos tagged with either "brown" or "cow"
         * or both. See the API documentation (link below) for a full
         * list of arguments.
         */

        /* http://www.flickr.com/services/api/flickr.people.getPhotos.html */
        return $this->call('flickr.people.getPhotos', array_merge(array('user_id' => $user_id), $args));
    }

    function people_findByUsername($username) {
        /* http://www.flickr.com/services/api/flickr.people.findByUsername.html */
        return $this->call("flickr.people.findByUsername", array("username" => $username));
    }

    function people_getInfo($user_id) {
        /* http://www.flickr.com/services/api/flickr.people.getInfo.html */
        return $this->call("flickr.people.getInfo", array("user_id" => $user_id));
    }

    function galleries_getPhotos($gallery_id, $extras = NULL, $per_page = NULL, $page = NULL) {
        /* http://www.flickr.com/services/api/flickr.galleries.getPhotos.html */
        return $this->call('flickr.galleries.getPhotos', array(
            'gallery_id' => $gallery_id,
            'extras'     => $extras,
            'per_page'   => $per_page,
            'page'       => $page
        ));
    }

    function photosets_getPhotos($photoset_id, $extras = NULL, $privacy_filter = NULL, $per_page = NULL, $page = NULL, $media = NULL) {
        /* http://www.flickr.com/services/api/flickr.photosets.getPhotos.html */
        return $this->call('flickr.photosets.getPhotos', array(
            'photoset_id'    => $photoset_id,
            'extras'         => $extras,
            'privacy_filter' => $privacy_filter,
            'per_page'       => $per_page,
            'page'           => $page,
            'media'          => $media
        ));
    }

    function photosets_getList($user_id = NULL) {
        /* http://www.flickr.com/services/api/flickr.photosets.getList.html */
        return $this->call("flickr.photosets.getList", array("user_id" => $user_id));
    }

    function galleries_getList($user_id, $per_page = NULL, $page = NULL) {
        /* http://www.flickr.com/services/api/flickr.galleries.getList.html */
        return $this->call('flickr.galleries.getList', array(
            'user_id'  => $user_id,
            'per_page' => $per_page,
            'page'     => $page
        ));
    }

    function photos_search($args = array()) {
        /* This function strays from the method of arguments that I've
         * used in the other functions for the fact that there are just
         * so many arguments to this API method. What you'll need to do
         * is pass an associative array to the function containing the
         * arguments you want to pass to the API.  For example:
         *   $photos = $f->photos_search(array("tags"=>"brown,cow", "tag_mode"=>"any"));
         * This will return photos tagged with either "brown" or "cow"
         * or both. See the API documentation (link below) for a full
         * list of arguments.
         */

        /* http://www.flickr.com/services/api/flickr.photos.search.html */
        return $this->call("flickr.photos.search", $args);

    }
}Generator/Common/ImagesInFolder/GeneratorGroupImagesInFolder.php000064400000007224152355233130021006 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder;

use Joomla\CMS\Uri\Uri;
use Nextend\Framework\Request\Request;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\Framework\Url\Url;
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\Sources\ImagesInFolderImages;
use Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\Sources\ImagesInFolderSubfolders;
use Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\Sources\ImagesInFolderVideos;

class GeneratorGroupImagesInFolder extends AbstractGeneratorGroup {

    protected $name = 'infolder';

    public function getLabel() {
        return n2_('Folder');
    }

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('Images in folder'));
    }

    protected function loadSources() {

        new ImagesInFolderImages($this, 'images', n2_('Images in folder'));
        new ImagesInFolderSubfolders($this, 'subfolders', n2_('Images in folder and subfolders'));
        new ImagesInFolderVideos($this, 'videos', n2_('Videos in folder'));
    }

    public static function trim($str, $addPathSeparator = true) {
        $str = ltrim(rtrim($str, '/'), '/');
        if ($addPathSeparator && strpos($str, ':') === false) {
            $str = DIRECTORY_SEPARATOR . $str;
        }

        return $str;
    }

    public static function fixSeparators($str) {
        return str_replace(array(
            '\\',
            '/'
        ), DIRECTORY_SEPARATOR, $str);
    }

    public static function pathToUri($path, $media_folder = true) {
        $path = self::fixSeparators(self::trim($path));
        $root = self::getRootPath();
        if (!empty($root) && !$media_folder) {
            $path = str_replace($root, '', $path);

            return self::getSiteUrl() . $path;
        } else if ($media_folder) {
            return ResourceTranslator::urlToResource(Url::pathToUri($path));
        } else {
            return Url::pathToUri($path);
        }
    }

    public static function getSiteUrl() {
        $site_url = Uri::root();
    

        if (empty($site_url)) {
            $site_url = (strtolower(Request::$SERVER->getCmd('HTTPS', 'off')) != 'off' ? "https://" : "http://") . Request::$SERVER->getVar('HTTP_HOST');
        }

        return self::fixSeparators(self::trim($site_url, false));
    }

    public static function getRootPath() {
        $root = '';
        $root = JPATH_ROOT;
    

        if (!empty($root)) {
            $root = self::trim($root);
        }

        return $root;
    }

    public static function found($seachTerms, $string) {
        if (!empty($seachTerms[0])) {
            foreach ($seachTerms as $seachTerm) {
                if (strpos($string, $seachTerm) !== false) {
                    return true;
                }
            }

            return false;
        } else {
            return null;
        }
    }

    public static function order($data, $orderBy, $sort) {
        if (!empty($orderBy)) {
            switch ($orderBy) {
                case 1:
                    $key = 'title';
                    break;
                case 2:
                    $key = 'created';
                    break;
                default:
                    $key = $orderBy;
                    break;
            }

            $helper = array_map('strtolower', array_column($data, $key));
            array_multisort($helper, constant("SORT_" . strtoupper($sort)), SORT_NATURAL, $data);
        }

        return $data;
    }
}Generator/Common/ImagesInFolder/Sources/ImagesInFolderImages.php000064400000015704152355233130020675 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\Sources;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Folder;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\GeneratorGroupImagesInFolder;

class ImagesInFolderImages extends AbstractGenerator {

    protected $layout = 'image';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('Images in folder'));
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Folder($filter, 'sourcefolder', n2_('Source folder'), '');

        new OnOff($filter, 'iptc', 'EXIF', 0);

        $excludeGroup = $filterGroup->createRowGroup('exclude-group', n2_('Filename based exclusion'));

        $excludeRow = $excludeGroup->createRow('exclude-row');

        new OnOff($excludeRow, 'remove_resize', 'Exclude resized images', 0, array(
            'tipLabel'       => n2_('Remove resized images'),
            'tipDescription' => n2_('This option removes files that match the "-[number]x[number].[extension]" pattern in the end of their file names. For example, "myimage.jpg" will stay in the generator result, but "myimage-120x120.jpg" will be removed, because it\'s the same image, just in a smaller size.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1901-images-from-folder-generator#exclude-resized-images'
        ));

        new Text($excludeRow, 'includes', n2_('Filename has to contain'), '', array(
            'tipLabel'       => n2_('Filename has to contain'),
            'tipDescription' => n2_('Only those images will be asked down, which have the given texts within their filenames. You can write down multiple texts separated by comma.')
        ));

        new Text($excludeRow, 'excludes', n2_('Filename cannot contain'), '', array(
            'tipLabel'       => n2_('Filename cannot contain'),
            'tipDescription' => n2_('Only those images will be asked down, which don\'t have the given texts within their filenames. You can write down multiple texts separated by comma.')
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'order', '0|*|asc', array(
            'options' => array(
                '0' => n2_('None'),
                '1' => n2_('Filename'),
                '2' => n2_('Creation date')
            )
        ));
    }

    protected function _getData($count, $startIndex) {
        $root   = GeneratorGroupImagesInFolder::fixSeparators(Filesystem::getImagesFolder());
        $source = GeneratorGroupImagesInFolder::fixSeparators($this->data->get('sourcefolder', ''));
        if (substr($source, 0, 1) == '*') {
            $media_folder = false;
            $source       = substr($source, 1);
            if (!Filesystem::existsFolder($source)) {
                Notification::error(n2_('Wrong path. This is the default image folder path, so try to navigate from here:') . '<br>*' . $root);

                return null;
            } else {
                $root = '';
            }
        } else {
            $media_folder = true;
        }
        $folder = Filesystem::realpath($root . GeneratorGroupImagesInFolder::trim($source));
        $files  = Filesystem::files($folder);

        $includes = array_map('trim', explode(',', $this->data->get('includes', '')));
        $excludes = array_map('trim', explode(',', $this->data->get('excludes', '')));

        for ($i = count($files) - 1; $i >= 0; $i--) {
            $ext        = strtolower(pathinfo($files[$i], PATHINFO_EXTENSION));
            $extensions = array(
                'jpg',
                'jpeg',
                'png',
                'svg',
                'gif',
                'webp'
            );
            if (!in_array($ext, $extensions) || GeneratorGroupImagesInFolder::found($includes, $files[$i]) === false || GeneratorGroupImagesInFolder::found($excludes, $files[$i]) === true) {
                array_splice($files, $i, 1);
            }
        }

        $IPTC = $this->data->get('iptc', 0) && function_exists('exif_read_data');

        list($orderBy, $sort) = Common::parse($this->data->get('order', '0|*|asc'));

        $removeResized = $this->data->get('remove_resize', 0);

        if ($orderBy > 0 || $removeResized) {
            $fileCount = 1000; //hardcoded file number limitation
        } else {
            $fileCount = $count;
            $files     = array_slice($files, $startIndex);
        }

        $data = array();
        for ($i = 0; $i < $fileCount && isset($files[$i]); $i++) {
            $image    = GeneratorGroupImagesInFolder::pathToUri($folder . DIRECTORY_SEPARATOR . $files[$i], $media_folder);
            $data[$i] = array(
                'image'     => $image,
                'thumbnail' => $image,
                'title'     => $files[$i],
                'name'      => preg_replace('/\\.[^.\\s]{3,4}$/', '', $files[$i]),
                'created'   => filemtime($folder . DIRECTORY_SEPARATOR . $files[$i])
            );
            if ($IPTC) {
                $properties = @exif_read_data($folder . DIRECTORY_SEPARATOR . $files[$i]);
                if ($properties) {
                    foreach ($properties as $key => $property) {
                        if (!is_array($property) && $property != '' && preg_match('/^[a-zA-Z]+$/', $key)) {
                            preg_match('/([2-9][0-9]*)\/([0-9]+)/', $property, $matches);
                            if (empty($matches)) {
                                $data[$i][$key] = $property;
                            } else {
                                $data[$i][$key] = round($matches[1] / $matches[2], 2);
                            }
                        }
                    }
                }
            }
        }

        if ($removeResized) {
            $new = array();
            for ($i = 0; $i < count($data); $i++) {
                if (!preg_match('/[_-]\d+x\d+(?=\.[a-z]{3,4}$)/', $data[$i]['title'], $match)) {
                    $new[] = $data[$i];
                }
            }
            $data = $new;
        }

        $data = GeneratorGroupImagesInFolder::order($data, $orderBy, $sort);

        if ($orderBy > 0 || $removeResized) {
            $data = array_slice($data, $startIndex, $count);
        }

        return $data;
    }
}Generator/Common/ImagesInFolder/Sources/ImagesInFolderSubfolders.php000064400000023735152355233130021603 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\Sources;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\Folder;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\GeneratorGroupImagesInFolder;

class ImagesInFolderSubfolders extends AbstractGenerator {

    protected $layout = 'image';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('Images in folder and subfolders'));
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Folder($filter, 'sourcefolder', n2_('Source folder'), '');

        new OnOff($filter, 'iptc', 'EXIF', 0);

        $excludeGroup = $filterGroup->createRowGroup('exclude-group', n2_('Filename based exclusion'));

        $excludeRow = $excludeGroup->createRow('exclude-row');

        new OnOff($excludeRow, 'remove_resize', 'Exclude resized images', 0, array(
            'tipLabel'       => n2_('Remove resized images'),
            'tipDescription' => n2_('This option removes files that match the "-[number]x[number].[extension]" pattern in the end of their file names. For example, "myimage.jpg" will stay in the generator result, but "myimage-120x120.jpg" will be removed, because it\'s the same image, just in a smaller size.'),
            'tipLink'        => 'https://smartslider.helpscoutdocs.com/article/1901-images-from-folder-generator#exclude-resized-images'
        ));

        new Text($excludeRow, 'includes', n2_('Filename has to contain'), '', array(
            'tipLabel'       => n2_('Filename has to contain'),
            'tipDescription' => n2_('Only those images will be asked down, which have the given texts within their filenames. You can write down multiple texts separated by comma.')
        ));

        new Text($excludeRow, 'excludes', n2_('Filename cannot contain'), '', array(
            'tipLabel'       => n2_('Filename cannot contain'),
            'tipDescription' => n2_('Only those images will be asked down, which don\'t have the given texts within their filenames. You can write down multiple texts separated by comma.')
        ));

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'order', '0|*|asc', array(
            'options' => array(
                '0' => n2_('None'),
                '1' => n2_('Filename'),
                '2' => n2_('Creation date')
            )
        ));
    }

    function getSubFolders($folders = array(), $ready = array()) {
        $subFolders = array();
        foreach ($folders as $folder) {
            $ready[]          = $folder;
            $subFoldersHelper = Filesystem::folders($folder);
            foreach ($subFoldersHelper as $helper) {
                $subFolders[] = $folder . DIRECTORY_SEPARATOR . $helper;
            }
        }
        if (!empty($subFolders)) {
            return $this->getSubFolders($subFolders, $ready);
        } else {
            return $ready;
        }
    }

    protected function _getData($count, $startIndex) {
        $root   = GeneratorGroupImagesInFolder::fixSeparators(Filesystem::getImagesFolder());
        $source = GeneratorGroupImagesInFolder::fixSeparators($this->data->get('sourcefolder', ''));

        $search = (strpos($source, "%%") !== false);
        if (substr($source, 0, 1) != DIRECTORY_SEPARATOR && substr($source, 0, 1) != '*') {
            $source = DIRECTORY_SEPARATOR . $source;
        }
        if ($search) {
            $parts          = preg_split("/[\s\/]+/", $source);
            $originalSource = $source;
            $source         = '';
            foreach ($parts as $part) {
                if (strpos($part, "%%") !== false) {
                    $source .= $part . DIRECTORY_SEPARATOR;
                } else {
                    if (substr($source, -2, 2) == '//') {
                        $source = substr($source, 0, -1);
                    }
                    break;
                }
            }
            $base = $root;
        }

        if (substr($source, 0, 1) == '*') {
            $media_folder = false;
            $source       = substr($source, 1);
            if (!Filesystem::existsFolder($source)) {
                Notification::error(n2_('Wrong path. This is the default image folder path, so try to navigate from here:') . '<br>*' . $root);

                return array();
            } else {
                $root = '';
            }
        } else {
            $media_folder = true;
        }

        $baseFolder = Filesystem::realpath($root . GeneratorGroupImagesInFolder::trim($source));

        if (empty($baseFolder)) {
            Notification::error(n2_('Folder not found.'));

            return array();
        }
        $folders = $this->getSubFolders(array($baseFolder));

        if ($search) {
            if (substr($originalSource, 0, 1) == '*') {
                $originalSource = substr($originalSource, 1);
            } else {
                $originalSource = $base . $originalSource;
            }
            $from           = array(
                '%%',
                '/'
            );
            $to             = array(
                '([^.]+)',
                '\/'
            );
            $pattern        = str_replace($from, $to, $originalSource);
            $pattern        = '#' . $pattern . '#';
            $matchedFolders = array();
            foreach ($folders as $folder) {
                if (preg_match($pattern, $folder . DIRECTORY_SEPARATOR)) {
                    $matchedFolders[] = $folder;
                }
            }
            $folders = $matchedFolders;
        }

        $allFiles = array();
        foreach ($folders as $f) {
            $allFiles[$f] = Filesystem::files($f);
        }

        $includes = array_map('trim', explode(',', $this->data->get('includes', '')));
        $excludes = array_map('trim', explode(',', $this->data->get('excludes', '')));

        $return = array();

        list($orderBy, $sort) = Common::parse($this->data->get('order', '0|*|asc'));

        $removeResized = $this->data->get('remove_resize', 0);

        $IPTC = $this->data->get('iptc', 0) && function_exists('exif_read_data');

        if ($orderBy > 0 || $removeResized) {
            $fileCount = 1000; //hardcoded file number limitation
        } else {
            $fileCount = $count;
        }

        foreach ($allFiles as $folder => $files) {
            if (count($return) < $fileCount) {

                for ($i = count($files) - 1; $i >= 0; $i--) {
                    $ext        = strtolower(pathinfo($files[$i], PATHINFO_EXTENSION));
                    $extensions = array(
                        'jpg',
                        'jpeg',
                        'png',
                        'svg',
                        'gif',
                        'webp'
                    );
                    if (!in_array($ext, $extensions) || GeneratorGroupImagesInFolder::found($includes, $files[$i]) === false || GeneratorGroupImagesInFolder::found($excludes, $files[$i]) === true) {
                        array_splice($files, $i, 1);
                    }
                }

                $data = array();
                for ($i = 0; $i < $fileCount && isset($files[$i]); $i++) {
                    $image    = GeneratorGroupImagesInFolder::pathToUri($folder . DIRECTORY_SEPARATOR . $files[$i], $media_folder);
                    $data[$i] = array(
                        'image'      => $image,
                        'thumbnail'  => $image,
                        'title'      => $files[$i],
                        'name'       => preg_replace('/\\.[^.\\s]{3,4}$/', '', $files[$i]),
                        'folder'     => $folder,
                        'foldername' => basename($folder),
                        'created'    => filemtime($folder . DIRECTORY_SEPARATOR . $files[$i])
                    );
                    if ($IPTC) {
                        $properties = @exif_read_data($folder . DIRECTORY_SEPARATOR . $files[$i]);
                        if ($properties) {
                            foreach ($properties as $key => $property) {
                                if (!is_array($property) && $property != '' && preg_match('/^[a-zA-Z]+$/', $key)) {
                                    preg_match('/([2-9][0-9]*)\/([0-9]+)/', $property, $matches);
                                    if (empty($matches)) {
                                        $data[$i][$key] = $property;
                                    } else {
                                        $data[$i][$key] = round($matches[1] / $matches[2], 2);
                                    }
                                }
                            }
                        }
                    }
                }

                $return = array_merge($return, $data);
            }
        }

        if ($removeResized) {
            $new = array();
            for ($i = 0; $i < count($return); $i++) {
                if (!preg_match('/[_-]\d+x\d+(?=\.[a-z]{3,4}$)/', $return[$i]['title'], $match)) {
                    $new[] = $return[$i];
                }
            }
            $return = $new;
        }

        $return = GeneratorGroupImagesInFolder::order($return, $orderBy, $sort);

        $return = array_slice($return, $startIndex, $count);

        return $return;
    }
}Generator/Common/ImagesInFolder/Sources/ImagesInFolderVideos.php000064400000007135152355233130020720 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\Sources;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\MixedField\GeneratorOrder;
use Nextend\Framework\Form\Element\Text\Folder;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Parser\Common;
use Nextend\SmartSlider3\Generator\AbstractGenerator;
use Nextend\SmartSlider3Pro\Generator\Common\ImagesInFolder\GeneratorGroupImagesInFolder;

class ImagesInFolderVideos extends AbstractGenerator {

    protected $layout = 'video_mp4';

    public function getDescription() {
        return sprintf(n2_('Creates slides from %1$s.'), n2_('Videos in folder'));
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        $filter = $filterGroup->createRow('filter');

        new Folder($filter, 'sourcefolder', n2_('Source folder'), '');

        $orderGroup = new ContainerTable($container, 'order-group', n2_('Order'));
        $order      = $orderGroup->createRow('order-row');
        new GeneratorOrder($order, 'order', '0|*|asc', array(
            'options' => array(
                '0' => n2_('None'),
                '1' => n2_('Filename'),
                '2' => n2_('Creation date')
            )
        ));
    }

    protected function _getData($count, $startIndex) {
        $root   = GeneratorGroupImagesInFolder::fixSeparators(Filesystem::getImagesFolder());
        $source = GeneratorGroupImagesInFolder::fixSeparators($this->data->get('sourcefolder', ''));
        if (substr($source, 0, 1) == '*') {
            $media_folder = false;
            $source       = substr($source, 1);
            if (!Filesystem::existsFolder($source)) {
                Notification::error(n2_('Wrong path. This is the default upload/media folder path, so try to navigate from here:') . '<br>*' . $root);

                return null;
            } else {
                $root = '';
            }
        } else {
            $media_folder = true;
        }

        $folder = Filesystem::realpath($root . GeneratorGroupImagesInFolder::trim($source));
        $files  = Filesystem::files($folder);

        for ($i = count($files) - 1; $i >= 0; $i--) {
            $ext = strtolower(pathinfo($files[$i], PATHINFO_EXTENSION));
            if ($ext != 'mp4') {
                array_splice($files, $i, 1);
            }
        }

        $files = array_slice($files, $startIndex);

        list($orderBy, $sort) = Common::parse($this->data->get('order', '0|*|asc'));

        if ($orderBy > 0) {
            $fileCount = 1000; //hardcoded file number limitation
        } else {
            $fileCount = $count;
            $files     = array_slice($files, $startIndex);
        }

        $data = array();
        for ($i = 0; $i < $fileCount && isset($files[$i]); $i++) {
            $video    = GeneratorGroupImagesInFolder::pathToUri($folder . DIRECTORY_SEPARATOR . $files[$i], $media_folder);
            $data[$i] = array(
                'video'   => $video,
                'title'   => $files[$i],
                'name'    => preg_replace('/\\.[^.\\s]{3,4}$/', '', $files[$i]),
                'created' => filemtime($folder . DIRECTORY_SEPARATOR . $files[$i])
            );
        }

        if ($orderBy > 0) {
            $data = GeneratorGroupImagesInFolder::order($data, $orderBy, $sort);

            $data = array_slice($data, $startIndex, $count);
        }

        return $data;
    }
}Generator/Common/Custom/GeneratorGroupCustom.php000064400000002645152355233130016054 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Custom;

use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
use Nextend\SmartSlider3Pro\Generator\Common\Custom\Sources\CustomCustom;

class GeneratorGroupCustom extends AbstractGeneratorGroup {

    protected $name = 'custom', $error = '';

    public function getLabel() {
        return 'Custom';
    }

    public function getDescription() {
        return n2_('Creates slides by your custom settings.');
    }

    public function getDocsLink() {
        return 'https://smartslider.helpscoutdocs.com/article/1957-creating-a-custom-generator';
    }

    public function getError() {
        return $this->error;
    }

    protected function loadSources() {
        $customGenerators = array();
        global $smartSliderCustomGenerators;
        if (!empty($smartSliderCustomGenerators)) {
            $customGenerators = $smartSliderCustomGenerators;
        }
    

        foreach ($customGenerators as $customGenerator) {
            new CustomCustom($this, $customGenerator);
        }

        if (empty($customGenerators)) {
            $this->error = sprintf(n2_('You don\'t have custom generators yet. %1$s Check the documentation %2$s to learn how to create your own generator.'), '<a href="https://smartslider.helpscoutdocs.com/article/1957-creating-a-custom-generator" target="_blank">', '</a>');
        }
    }
}
Generator/Common/Custom/Sources/CustomCustom.php000064400000010524152355233130016001 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Generator\Common\Custom\Sources;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Fieldset\FieldsetRow;
use Nextend\SmartSlider3\Generator\AbstractGenerator;

class CustomCustom extends AbstractGenerator {

    protected $layout = 'image';

    private $generator = array();

    public function __construct($group, $generator) {
        $this->generator = $generator;
        parent::__construct($group, $generator['name'], $generator['label']);
    }

    public function renderFields($container) {

        $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter'));

        foreach ($this->generator['options'] as $k => $option) {
            $row = $filterGroup->createRow('filter' . $k);

            $fields = isset($option[0]) ? $option : array($option);

            foreach ($fields as $field) {
                switch ($field['type']) {
                    case 'onoff':
                        $this->onOff($row, $field);
                        break;
                    case 'text':
                        $this->text($row, $field);
                        break;
                    case 'textarea':
                        $this->textArea($row, $field);
                        break;
                    case 'select':
                        $this->select($row, $field);
                        break;
                }
            }
        }
    }

    protected function _getData($count, $startIndex) {

        $result = call_user_func($this->generator['records'], array(
            'options'    => $this->data->_data,
            'slideCount' => $count,
            'startIndex' => $startIndex
        ));

        return $result;
    }

    private function setDefault($parameters, $default = '') {

        if (!isset($parameters['label'])) {
            $parameters['label'] = $parameters['name'];
        }

        if (!isset($parameters['default'])) {
            $parameters['default'] = $default;
        }

        return $parameters;
    }

    /**
     * @param FieldsetRow $parent
     * @param             $parameters
     */
    private function onOff($parent, $parameters) {

        $parameters = $this->setDefault($parameters, 0);

        new OnOff($parent, $parameters['name'], $parameters['label'], $parameters['default']);
    }

    /**
     * @param FieldsetRow $parent
     * @param             $parameters
     */
    private function text($parent, $parameters) {

        $parameters = $this->setDefault($parameters);

        new Text($parent, $parameters['name'], $parameters['label'], $parameters['default']);
    }

    /**
     * @param FieldsetRow $parent
     * @param             $parameters
     */
    private function textArea($parent, $parameters) {

        $parameters = $this->setDefault($parameters);

        $size = array();
        if (isset($parameters['width'])) {
            $size['width'] = $parameters['width'];
        }
        if (isset($parameters['height'])) {
            $size['height'] = $parameters['height'];
        }

        new Textarea($parent, $parameters['name'], $parameters['label'], $parameters['default'], $size);
    }

    /**
     * @param FieldsetRow $parent
     * @param             $parameters
     */
    private function select($parent, $parameters) {

        $parameters = array_merge(array(
            'options' => array(
                'none' => n2_('No options given')
            )
        ), $parameters);

        $parameters = $this->setDefault($parameters, array_values($parameters['options'])[0]);

        $options = array(
            'options' => $parameters['options']
        );

        if (!empty($parameters['multiple'])) {
            $options += array(
                'isMultiple' => true
            );

            if (!empty($parameters['size'])) {
                $options += array(
                    'size' => $parameters['size']
                );
            }
        }

        new Select($parent, $parameters['name'], $parameters['label'], $parameters['default'], $options);
    }
}Application/PluggedApplicationSmartSlider3Pro.php000064400000003217152355233130016216 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application;


use Nextend\Framework\Plugin;
use Nextend\SmartSlider3\Application\Admin\ApplicationTypeAdmin;
use Nextend\SmartSlider3\Application\ApplicationSmartSlider3;
use Nextend\SmartSlider3\Application\Frontend\ApplicationTypeFrontend;
use Nextend\SmartSlider3Pro\Application\Admin\PluggedApplicationTypeAdmin;
use Nextend\SmartSlider3Pro\Application\Frontend\PluggedApplicationTypeFrontend;

class PluggedApplicationSmartSlider3Pro {

    /** @var ApplicationSmartSlider3 */
    protected $application;

    /**
     * PluggedApplicationSmartSlider3Pro constructor.
     *
     * @param ApplicationSmartSlider3 $application
     */
    public function __construct($application) {

        $this->application = $application;

        Plugin::addAction('PluggableApplicationType\Nextend\SmartSlider3\Application\Admin\ApplicationTypeAdmin', array(
            $this,
            'plugApplicationTypeAdmin'
        ));

        Plugin::addAction('PluggableApplicationType\Nextend\SmartSlider3\Application\Frontend\ApplicationTypeFrontend', array(
            $this,
            'plugApplicationTypeFrontend'
        ));
    }


    /**
     * @param ApplicationTypeAdmin $applicationTypeAdmin
     */
    public function plugApplicationTypeAdmin($applicationTypeAdmin) {

        new PluggedApplicationTypeAdmin($applicationTypeAdmin);
    }


    /**
     * @param ApplicationTypeFrontend $applicationTypeFrontend
     */
    public function plugApplicationTypeFrontend($applicationTypeFrontend) {

        new PluggedApplicationTypeFrontend($applicationTypeFrontend);
    }
}Application/Frontend/PluggedApplicationTypeFrontend.php000064400000001175152355233130017422 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Frontend;


use Nextend\Framework\Pattern\GetAssetsPathTrait;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Application\Frontend\ApplicationTypeFrontend;

class PluggedApplicationTypeFrontend {

    use GetAssetsPathTrait;

    /** @var ApplicationTypeFrontend */
    protected $applicationType;

    public function __construct($applicationType) {

        $this->applicationType = $applicationType;

        ResourceTranslator::createResource('$ss3-pro-frontend$', self::getAssetsPath(), self::getAssetsUri());
    }
}Application/Admin/PluggedApplicationTypeAdmin.php000064400000006732152355233130016150 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin;


use Nextend\Framework\Pattern\GetAssetsPathTrait;
use Nextend\Framework\Plugin;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Application\Admin\ApplicationTypeAdmin;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerAjaxSlider;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerSlider;
use Nextend\SmartSlider3\Application\Admin\Sliders\ControllerAjaxSliders;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\License\ControllerAjaxLicense;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\License\ControllerLicense;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\PluggedControllerAjaxSlider;
use Nextend\SmartSlider3Pro\Application\Admin\Slider\PluggedControllerSlider;
use Nextend\SmartSlider3Pro\Application\Admin\Sliders\PluggedControllerAjaxSliders;
use Nextend\SmartSlider3Pro\Application\Admin\Visual\ControllerAjaxPostBackgroundAnimation;
use Nextend\SmartSlider3Pro\Application\Admin\Visual\ControllerAjaxSplitTextAnimation;

class PluggedApplicationTypeAdmin {

    use GetAssetsPathTrait;

    /** @var ApplicationTypeAdmin */
    protected $applicationType;

    /**
     * PluggedApplicationTypeAdmin constructor.
     *
     * @param ApplicationTypeAdmin $applicationType
     */
    public function __construct($applicationType) {

        $this->applicationType = $applicationType;

        ResourceTranslator::createResource('$ss3-pro-admin$', self::getAssetsPath(), self::getAssetsUri());

        $applicationType->addExternalController('postbackgroundanimation', $this);

        $applicationType->addExternalController('splittextanimation', $this);

        $applicationType->addExternalController('license', $this);

        Plugin::addAction('PluggableController\Nextend\SmartSlider3\Application\Admin\Sliders\ControllerAjaxSliders', array(
            $this,
            'plugControllerAjaxSliders'
        ));

        Plugin::addAction('PluggableController\Nextend\SmartSlider3\Application\Admin\Slider\ControllerSlider', array(
            $this,
            'plugControllerSlider'
        ));

        Plugin::addAction('PluggableController\Nextend\SmartSlider3\Application\Admin\Slider\ControllerAjaxSlider', array(
            $this,
            'plugControllerAjaxSlider'
        ));
    }

    public function getControllerAjaxPostBackgroundAnimation() {

        return new ControllerAjaxPostBackgroundAnimation($this->applicationType);
    }

    public function getControllerAjaxSplitTextAnimation() {

        return new ControllerAjaxSplitTextAnimation($this->applicationType);
    }

    public function getControllerLicense() {

        return new ControllerLicense($this->applicationType);
    }

    public function getControllerAjaxLicense() {

        return new ControllerAjaxLicense($this->applicationType);
    }

    /**
     * @param ControllerAjaxSliders $controller
     */
    public function plugControllerAjaxSliders($controller) {

        new PluggedControllerAjaxSliders($controller);
    }

    /**
     * @param ControllerSlider $controller
     */
    public function plugControllerSlider($controller) {

        new PluggedControllerSlider($controller);
    }

    /**
     * @param ControllerAjaxSlider $controller
     */
    public function plugControllerAjaxSlider($controller) {

        new PluggedControllerAjaxSlider($controller);
    }
}Application/Admin/Visual/ControllerAjaxPostBackgroundAnimation.php000064400000000740152355233130021453 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Visual;


use Nextend\Framework\Controller\Admin\AdminVisualManagerAjaxController;
use Nextend\SmartSlider3Pro\PostBackgroundAnimation\ModelPostBackgroundAnimation;

class ControllerAjaxPostBackgroundAnimation extends AdminVisualManagerAjaxController {

    protected $type = 'postbackgroundanimation';

    public function getModel() {

        return new ModelPostBackgroundAnimation($this);
    }

}Application/Admin/Visual/ControllerAjaxSplitTextAnimation.php000064400000000652152355233130020470 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Visual;


use Nextend\Framework\Controller\Admin\AdminVisualManagerAjaxController;
use Nextend\SmartSlider3Pro\SplitText\ModelSplitText;

class ControllerAjaxSplitTextAnimation extends AdminVisualManagerAjaxController {

    protected $type = 'splittextanimation';

    public function getModel() {

        return new ModelSplitText($this);
    }
}Application/Admin/Sliders/PluggedControllerAjaxSliders.php000064400000001727152355233130017753 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Sliders;


use Nextend\SmartSlider3\Application\Admin\Sliders\ControllerAjaxSliders;
use Nextend\SmartSlider3\Application\Model\ModelSliders;

class PluggedControllerAjaxSliders {

    /** @var ControllerAjaxSliders */
    protected $controller;

    public function __construct($controller) {
        $this->controller = $controller;

        $this->controller->addExternalAction('listGroups', array(
            $this,
            'actionListGroups'
        ));
    }

    public function actionListGroups() {
        $this->controller->validateToken();

        $slidersModel = new ModelSliders($this->controller);
        $result       = $slidersModel->getGroups('published');

        $data = array();
        foreach ($result as $r) {
            $data[$r['id']] = $r['title'];
        }

        $this->controller->getResponse()
                         ->respond($data);
    }
}Application/Admin/Slider/PluggedControllerAjaxSlider.php000064400000011462152355233130017402 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;


use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerAjaxSlider;
use Nextend\SmartSlider3\Application\Admin\Slider\ViewAjaxSliderBox;
use Nextend\SmartSlider3\Application\Model\ModelSliders;
use Nextend\SmartSlider3\Application\Model\ModelSlidersXRef;

class PluggedControllerAjaxSlider {

    /** @var ControllerAjaxSlider */
    protected $controller;

    public function __construct($controller) {
        $this->controller = $controller;

        $this->controller->addExternalAction('getGroupInfoBySliderID', array(
            $this,
            'getGroupInfoBySliderID'
        ));

        $this->controller->addExternalAction('changeGroup', array(
            $this,
            'changeGroup'
        ));

        $this->controller->addExternalAction('createGroup', array(
            $this,
            'actionCreateGroup'
        ));

        $this->controller->addExternalAction('addToGroup', array(
            $this,
            'actionAddToGroup'
        ));
    }

    public function getGroupInfoBySliderID() {
        $this->controller->validateToken();

        $this->controller->validatePermission('smartslider_edit');

        $sliderID = Request::$REQUEST->getInt('sliderID');
        $this->controller->validateVariable($sliderID, 'slider');

        $slidersModel = new ModelSliders($this->controller);

        $xref = new ModelSlidersXRef($this->controller);

        $this->controller->getResponse()
                         ->respond(array(
                             'groups'   => $slidersModel->getGroups('published'),
                             'linkedTo' => $xref->getGroupsIDs($sliderID)
                         ));
    }

    public function changeGroup() {


        $sliderID = Request::$REQUEST->getInt('sliderID');
        $this->controller->validateVariable($sliderID, 'slider');

        $toLink   = array_map('intval', Request::$POST->getVar('toLink', array()));
        $toDelete = array_map('intval', Request::$POST->getVar('toDelete', array()));

        $xref = new ModelSlidersXRef($this->controller);

        foreach ($toDelete as $groupID) {
            $xref->deleteXref($groupID, $sliderID);
        }

        foreach ($toLink as $groupID) {
            $xref->add($groupID, $sliderID);
        }

        $slidersModel = new ModelSliders($this->controller);
        $slidersModel->reindexOrdering();

        $this->controller->getResponse()
                         ->respond();
    }

    public function actionCreateGroup() {
        $this->controller->validateToken();

        $this->controller->validatePermission('smartslider_edit');
        $slidersModel = new ModelSliders($this->controller);

        $title = Request::$REQUEST->getVar('title');
        $this->controller->validateVariable(!empty($title), 'group name');

        $slider = array(
            'type'  => 'group',
            'title' => $title
        );

        $sliderid = $slidersModel->create($slider);

        $this->controller->validateDatabase($slider);

        $this->controller->redirect($this->controller->getUrlSliderEdit($sliderid));
    }

    public function actionAddToGroup() {
        $this->controller->validateToken();

        $this->controller->validatePermission('smartslider_edit');

        $actionType = Request::$REQUEST->getCmd('actionType');
        $this->controller->validateVariable($actionType, 'Action');

        $currentGroupID = Request::$REQUEST->getInt('currentGroupID', 0);

        $groupID = Request::$REQUEST->getInt('groupID');
        $this->controller->validateVariable($groupID, 'group');

        $sliders = Request::$REQUEST->getVar('sliders');
        if (!is_array($sliders)) {
            Notification::error(n2_('Missing sliders!'));
            $this->controller->getResponse()
                             ->error();
        }

        $slidersModel = new ModelSliders($this->controller);

        $xref = new ModelSlidersXRef($this->controller);
        foreach ($sliders as $sliderID) {
            switch ($actionType) {
                case 'copy':
                    $newSliderID = $slidersModel->duplicate($sliderID, false);
                    $xref->add($groupID, $newSliderID);
                    break;
                case 'link':
                    $xref->add($groupID, $sliderID);
                    break;
                default:
                    $xref->deleteXref($currentGroupID, $sliderID);
                    $xref->add($groupID, $sliderID);
                    break;
            }
        }
        $this->controller->getResponse()
                         ->respond();
    }

}Application/Admin/Slider/PluggedControllerSlider.php000064400000004636152355233130016603 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;

use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\Slider\ControllerSlider;

class PluggedControllerSlider {

    /** @var ControllerSlider */
    protected $controller;

    public function __construct($controller) {
        $this->controller = $controller;

        $this->controller->addExternalAction('editGroup', array(
            $this,
            'actionEditGroup'
        ));

        $this->controller->addExternalAction('shapedivider', array(
            $this,
            'actionShapeDivider'
        ));

        $this->controller->addExternalAction('shapedividerpreview', array(
            $this,
            'actionShapeDividerPreview'
        ));

        $this->controller->addExternalAction('particle', array(
            $this,
            'actionParticle'
        ));
    }

    /**
     * @param array $slider
     */
    public function actionEditGroup($slider = array()) {
        if (empty($slider)) {
            $this->controller->redirectToSliders();
        }

        $this->controller->loadSliderManager();

        $view = new ViewSliderEditGroup($this->controller);
        $view->setSlider($slider);
        $view->display();
    }

    public function actionShapeDivider() {
        if ($this->controller->validateToken() && $this->controller->validatePermission('smartslider_edit')) {

            $view = new ViewSliderShapeDivider($this->controller);
            $view->setSliderID($this->controller->getSliderID());
            $view->display();

        }
    }

    public function actionShapeDividerPreview() {

        if ($this->controller->validateToken() && $this->controller->validatePermission('smartslider_edit')) {
            $view = new ViewSliderShapeDividerPreview($this->controller);
            $view->setSliderData(json_decode(Request::$POST->getVar('sliderData', '[]'), true));
            $view->setSliderID($this->controller->getSliderID());

            $view->display();
        }
    }

    public function actionParticle() {
        if ($this->controller->validateToken() && $this->controller->validatePermission('smartslider_edit')) {

            $view = new ViewSliderParticle($this->controller);
            $view->setSliderID($this->controller->getSliderID());
            $view->display();

        }
    }
}Application/Admin/Slider/ViewSliderEditGroup.php000064400000017005152355233130015677 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;


use Nextend\Framework\Acl\Acl;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Hidden;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\FieldImage;
use Nextend\Framework\Form\Fieldset\FieldsetRowPlain;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Sanitize;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\Header\BlockHeader;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Core\TopBarMain\BlockTopBarMain;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButton;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonBack;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonPlainIcon;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonSave;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu\BlockFloatingMenu;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\FloatingMenu\BlockFloatingMenuItem;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slider\SliderManager\BlockSliderManager;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutDefault;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Form\Element\PublishSlider;

class ViewSliderEditGroup extends AbstractView {

    use TraitAdminUrl;

    protected $groupID = 0;

    protected $slider;

    /**
     * @var BlockHeader
     */
    protected $blockHeader;

    protected $formData = array();

    /**
     * @param array $slider
     */
    public function setSlider($slider) {
        $this->slider = $slider;
    }

    public function getSlider() {
        return $this->slider;
    }

    public function display() {

        $this->layout = new LayoutDefault($this);

        $this->layout->addBreadcrumb(Sanitize::esc_html($this->slider['title']), 'ssi_16 ssi_16--folderclosed');


        $topBar = new BlockTopBarMain($this);

        $buttonSave = new BlockButtonSave($this);
        $buttonSave->addClass('n2_button--inactive');
        $buttonSave->addClass('n2_group_settings_save');
        $topBar->addPrimaryBlock($buttonSave);

        $buttonBack = new BlockButtonBack($this);
        $buttonBack->setUrl($this->getUrlDashboard());
        $buttonBack->addClass('n2_group_settings_back');
        $topBar->addPrimaryBlock($buttonBack);

        $buttonPreview = new BlockButtonPlainIcon($this);
        $buttonPreview->addClass('n2_top_bar_button_icon');
        $buttonPreview->addClass('n2_top_bar_main__preview');
        $buttonPreview->setIcon('ssi_24 ssi_24--preview');
        $buttonPreview->addAttribute('data-n2tip', n2_('Preview'));
        $buttonPreview->setUrl($this->getUrlPreviewIndex($this->slider['id']));
        $topBar->addPrimaryBlock($buttonPreview);

        $this->displayHeader();


        $this->layout->setTopBar($topBar->toHTML());

        $this->layout->addContent($this->render('EditGroup'));


        $this->layout->render();
    }

    protected function displayHeader() {


        $this->blockHeader = new BlockHeader($this);
        $this->blockHeader->setHeading($this->slider['title']);
        $this->blockHeader->setHeadingAfter('ID: ' . $this->slider['id']);

        $this->addHeaderActions();

        $this->layout->addContentBlock($this->blockHeader);
    }

    private function addHeaderActions() {

        $accessEdit   = Acl::canDo('smartslider_edit', $this);
        $accessDelete = Acl::canDo('smartslider_delete', $this);

        if ($accessEdit || $accessDelete) {

            $sliderid = $this->slider['id'];

            $actionsMenu = new BlockFloatingMenu($this);

            $actions = new BlockButton($this);
            $actions->setBig();
            $actions->setLabel(n2_('Actions'));
            $actions->setIcon('ssi_16 ssi_16--buttonarrow');
            $actionsMenu->setButton($actions);


            if ($accessEdit) {

                $item = new BlockFloatingMenuItem($this);
                $item->setLabel(n2_('Clear cache'));
                $item->setIcon('ssi_16 ssi_16--reset');
                $item->setUrl($this->getUrlSliderClearCache($sliderid));
                $actionsMenu->addMenuItem($item);

                $item = new BlockFloatingMenuItem($this);
                $item->setLabel(sprintf(n2_('Export %1$s as HTML'), n2_('Group')));
                $item->setIcon('ssi_16 ssi_16--download');
                $item->setUrl($this->getUrlSliderExportHtml($sliderid));
                $actionsMenu->addMenuItem($item);

                $item = new BlockFloatingMenuItem($this);
                $item->setLabel(n2_('Export'));
                $item->setIcon('ssi_16 ssi_16--download');
                $item->setUrl($this->getUrlSliderExport($sliderid));
                $actionsMenu->addMenuItem($item);
            


                $item = new BlockFloatingMenuItem($this);
                $item->setLabel(n2_('Duplicate'));
                $item->setIcon('ssi_16 ssi_16--duplicate');
                $item->setUrl($this->getUrlSliderDuplicate($sliderid, $this->groupID));
                $actionsMenu->addMenuItem($item);
            }

            if ($accessDelete) {

                $item = new BlockFloatingMenuItem($this);
                $item->setRed();
                $item->setLabel(n2_('Move to trash'));
                $item->setIcon('ssi_16 ssi_16--delete');
                $item->setUrl($this->getUrlSliderMoveToTrash($sliderid, $this->groupID));
                $actionsMenu->addMenuItem($item);
            }

            $this->blockHeader->addAction($actionsMenu->toHTML());
        }
    }

    public function renderSliderManager() {

        $sliderManager = new BlockSliderManager($this->layout);
        $sliderManager->setGroupID($this->slider['id']);
        $sliderManager->display();
    }


    public function renderForm() {

        $slider = $this->slider;

        $data = json_decode($slider['params'], true);
        if ($data == null) $data = array();
        $data['title']     = $slider['title'];
        $data['type']      = $slider['type'];
        $data['thumbnail'] = $slider['thumbnail'];
        $data['alias']     = isset($slider['alias']) ? $slider['alias'] : '';

        $this->editGroupForm($data);

        $this->formData = $data;
    }

    private function editGroupForm($data = array()) {

        $form = new Form($this, 'slider');
        $form->set('class', 'nextend-smart-slider-admin');

        $form->loadArray($data);

        $table = new ContainerTable($form->getContainer(), 'publish', n2_('Publish'));
        $row   = new FieldsetRowPlain($table, 'publish');
        new PublishSlider($row);


        $table = new ContainerTable($form->getContainer(), 'group', n2_('General'));

        $row1 = $table->createRow('row-1');

        new Text($row1, 'title', n2_('Name'), n2_('Group'), array(
            'style' => 'width:400px;'
        ));

        new Text($row1, 'alias', n2_('Alias'), '', array(
            'style' => 'width:200px;'
        ));

        new FieldImage($row1, 'thumbnail', n2_('Thumbnail'));

        new Hidden($row1, 'type', 'group');


        $form->render();
    }

    /**
     * @return array
     */
    public function getFormData() {
        return $this->formData;
    }
}Application/Admin/Slider/ViewSliderParticle.php000064400000013005152355233130015534 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;


use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\Message\Notice;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Form;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonApply;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonCancel;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutIframe;
use Nextend\SmartSlider3Pro\Form\Element\ParticleSkin;

class ViewSliderParticle extends AbstractView {

    /** @var integer */
    protected $sliderID;

    public function display() {
        $this->layout = new LayoutIframe($this);

        $this->layout->setLabel(n2_('Particle effect'));

        $buttonCancel = new BlockButtonCancel($this);
        $buttonCancel->addAttribute('id', 'n2-ss-form-cancel');
        $buttonCancel->setBig();
        $this->layout->addAction($buttonCancel);

        $buttonSet = new BlockButtonApply($this);
        $buttonSet->addAttribute('id', 'n2-ss-form-save');
        $buttonSet->setBig();
        $this->layout->addAction($buttonSet);

        $this->layout->addContent($this->render('Particle'));

        $this->layout->render();
    }

    /**
     * @return integer
     */
    public function getSliderID() {
        return $this->sliderID;
    }

    /**
     * @param integer $sliderID
     */
    public function setSliderID($sliderID) {
        $this->sliderID = $sliderID;
    }

    public function renderForm() {

        $form = new Form($this, 'slider');

        $table = new ContainerTable($form->getContainer(), 'particle', n2_('Particle effect'));

        $settings = $table->createRow('row1');


        new ParticleSkin($settings, 'preset', n2_('Effect'), 0, array(
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'link',
                        'polygons',
                        'bloom',
                        'web',
                        'blackwidow',
                        'zodiac',
                        'fading-dots',
                        'pirouette',
                        'sparkling',
                        'custom'
                    ),
                    'field'  => array(
                        'slidermobile'
                    )
                ),
                array(
                    'values' => array(
                        'link',
                        'polygons',
                        'bloom',
                        'web',
                        'blackwidow',
                        'zodiac',
                        'fading-dots',
                        'pirouette',
                        'sparkling'
                    ),
                    'field'  => array(
                        'slidercustomization'
                    )
                ),
                array(
                    'values' => array(
                        'custom'
                    ),
                    'field'  => array(
                        'slidercustom',
                        'table-row-row2'
                    )
                )
            )
        ));

        $customization = new Grouping($settings, 'customization');

        new Color($customization, 'color', n2_('Color'), 'FFFFFF80', array(
            'alpha' => true
        ));

        new Color($customization, 'line-color', n2_('Line color'), 'FFFFFF66', array(
            'alpha' => true
        ));

        new NumberSlider($customization, 'speed', n2_('Speed'), 2, array(
            'style' => 'width:35px;',
            'min'   => 1,
            'max'   => 60
        ));

        new NumberSlider($customization, 'number', n2_('Number of particles'), 28, array(
            'style' => 'width:35px;',
            'min'   => 10,
            'max'   => 200
        ));

        new Select($customization, 'hover', n2_('Hover'), 'off', array(
            'options' => array(
                '0'       => n2_('Off'),
                'grab'    => n2_('Grab'),
                'bubble'  => n2_('Bubble'),
                'repulse' => n2_('Repulse')
            )
        ));

        new Select($customization, 'click', n2_('Click'), 'off', array(
            'options' => array(
                '0'       => n2_('Off'),
                'repulse' => n2_('Repulse'),
                'push'    => n2_('Push'),
                'remove'  => n2_('Remove'),
                'bubble'  => n2_('Bubble')
            )
        ));

        new Textarea($settings, 'custom', n2_('Custom'), '', array(
            'width'     => 480,
            'minHeight' => 200
        ));

        new OnOff($settings, 'mobile', n2_('Hide on mobile'), 0, array(
            'invert' => true
        ));

        $notice = $table->createRow('row2');

        new Notice($notice, 'instructions', 'Instructions', 'You can generate at <a target="_blank" href="http://vincentgarreau.com/particles.js/">http://vincentgarreau.com/particles.js/</a> Then <i>Download current config (json)</i> and paste content into the field.');

        $form->render();
    }
}Application/Admin/Slider/ViewSliderShapeDivider.php000064400000017474152355233130016356 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;

use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Grouping;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Tab;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\NumberSlider;
use Nextend\Framework\Form\Form;
use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonApply;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonCancel;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Slider\DeviceZoom\BlockDeviceZoom;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutIframe;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3Pro\Form\Element\Select\ShapeDividerSelect;

class ViewSliderShapeDivider extends AbstractView {

    use TraitAdminUrl;

    /** @var integer */
    protected $sliderID;

    public function display() {
        $this->layout = new LayoutIframe($this);

        $this->layout->setLabel(n2_('Shape divider'));

        $deviceZoom = new BlockDeviceZoom($this);
        $this->layout->addAction($deviceZoom);

        $buttonCancel = new BlockButtonCancel($this);
        $buttonCancel->addAttribute('id', 'n2-ss-form-cancel');
        $buttonCancel->setBig();
        $this->layout->addAction($buttonCancel);

        $buttonSet = new BlockButtonApply($this);
        $buttonSet->addAttribute('id', 'n2-ss-form-save');
        $buttonSet->setBig();
        $this->layout->addAction($buttonSet);

        $this->layout->addContent($this->render('ShapeDivider'));

        $this->layout->render();
    }

    /**
     * @return integer
     */
    public function getSliderID() {
        return $this->sliderID;
    }

    /**
     * @param integer $sliderID
     */
    public function setSliderID($sliderID) {
        $this->sliderID = $sliderID;
    }


    public function renderForm() {

        $form = new Form($this, 'slider');

        $table = new ContainerTable($form->getContainer(), 'shapedivider', n2_('Shape divider'));

        $table->setFieldsetPositionEnd();

        new Tab($table->getFieldsetLabel(), 'position', false, 'bottom', array(
            'options'            => array(
                'top'    => n2_('Top'),
                'bottom' => n2_('Bottom')
            ),
            'relatedValueFields' => array(
                array(
                    'values' => array(
                        'top'
                    ),
                    'field'  => array(
                        'table-row-shapedivider-top'
                    )
                ),
                array(
                    'values' => array(
                        'bottom'
                    ),
                    'field'  => array(
                        'table-row-shapedivider-bottom'
                    )
                )
            )
        ));


        $top = $table->createRow('shapedivider-top');
        new ShapeDividerSelect($top, 'shapedivider-top-type', n2_('Type'), '0', array(
            'relatedFields' => array(
                'slidershapedivider-top-group-container'
            )
        ));

        $groupingTopOptionsContainer = new Grouping($top, 'shapedivider-top-group-container');
        new Color($groupingTopOptionsContainer, 'shapedivider-top-color', n2_('Color'), 'ffffffff', array(
            'alpha' => true
        ));

        new Color($groupingTopOptionsContainer, 'shapedivider-top-color2', n2_('Secondary'), 'FFFFFF80', array(
            'alpha' => true
        ));

        new NumberSlider($groupingTopOptionsContainer, 'shapedivider-top-width', n2_('Width'), 100, array(
            'unit'          => '%',
            'style'         => 'width:35px;',
            'min'           => 100,
            'max'           => 400,
            'step'          => 5,
            'sliderMax'     => 400,
            'rowAttributes' => array(
                'data-devicespecific' => ''
            )
        ));

        new NumberSlider($groupingTopOptionsContainer, 'shapedivider-top-height', n2_('Height'), 100, array(
            'unit'          => '%',
            'style'         => 'width:35px;',
            'min'           => 0,
            'max'           => 500,
            'step'          => 10,
            'sliderMax'     => 500,
            'rowAttributes' => array(
                'data-devicespecific' => ''
            )
        ));

        new OnOff($groupingTopOptionsContainer, 'shapedivider-top-flip', n2_('Flip'), 0);
        new OnOff($groupingTopOptionsContainer, 'shapedivider-top-animate', n2_('Animate'), 0);
        new NumberSlider($groupingTopOptionsContainer, 'shapedivider-top-speed', n2_('Speed'), 100, array(
            'style'     => 'width:35px;',
            'unit'      => '%',
            'min'       => 10,
            'max'       => 1000,
            'step'      => 1,
            'sliderMax' => 100
        ));

        new Select($groupingTopOptionsContainer, 'shapedivider-top-scroll', n2_('Scroll'), '0', array(
            'options' => array(
                '0'      => n2_('None'),
                'grow'   => n2_('Grow'),
                'shrink' => n2_('Shrink')
            )
        ));

        $bottom = $table->createRow('shapedivider-bottom');
        new ShapeDividerSelect($bottom, 'shapedivider-bottom-type', n2_('Type'), '0', array(
            'relatedFields' => array(
                'slidershapedivider-bottom-group-container'
            )
        ));

        $groupingBottomOptionsContainer = new Grouping($bottom, 'shapedivider-bottom-group-container');
        new Color($groupingBottomOptionsContainer, 'shapedivider-bottom-color', n2_('Color'), 'ffffffff', array(
            'alpha' => true
        ));

        new Color($groupingBottomOptionsContainer, 'shapedivider-bottom-color2', n2_('Secondary'), 'FFFFFF80', array(
            'alpha' => true
        ));

        new NumberSlider($groupingBottomOptionsContainer, 'shapedivider-bottom-width', n2_('Width'), 100, array(
            'style'         => 'width:35px;',
            'unit'          => '%',
            'min'           => 100,
            'max'           => 400,
            'step'          => 5,
            'sliderMax'     => 400,
            'rowAttributes' => array(
                'data-devicespecific' => ''
            )
        ));

        new NumberSlider($groupingBottomOptionsContainer, 'shapedivider-bottom-height', n2_('Height'), 100, array(
            'style'         => 'width:35px;',
            'unit'          => '%',
            'min'           => 0,
            'max'           => 500,
            'step'          => 10,
            'rowAttributes' => array(
                'data-devicespecific' => ''
            )
        ));

        new OnOff($groupingBottomOptionsContainer, 'shapedivider-bottom-flip', n2_('Flip'), 0);
        new OnOff($groupingBottomOptionsContainer, 'shapedivider-bottom-animate', n2_('Animate'), 0);
        new NumberSlider($groupingBottomOptionsContainer, 'shapedivider-bottom-speed', n2_('Speed'), 100, array(
            'style'     => 'width:35px;',
            'unit'      => '%',
            'min'       => 10,
            'max'       => 1000,
            'step'      => 1,
            'sliderMax' => 100
        ));

        new Select($groupingBottomOptionsContainer, 'shapedivider-bottom-scroll', n2_('Scroll'), '0', array(
            'options' => array(
                '0'      => n2_('None'),
                'grow'   => n2_('Grow'),
                'shrink' => n2_('Shrink')
            )
        ));


        $form->render();
    }
}Application/Admin/Slider/ViewSliderShapeDividerPreview.php000064400000003177152355233130017713 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;


use Nextend\Framework\View\AbstractView;
use Nextend\SmartSlider3\Application\Admin\Layout\LayoutEmpty;
use Nextend\SmartSlider3\SliderManager\SliderManager;

class ViewSliderShapeDividerPreview extends AbstractView {

    /** @var integer */
    protected $sliderID;

    /** @var array */
    protected $sliderData;

    public function display() {
        $this->layout = new LayoutEmpty($this);

        $this->layout->addContent($this->render('ShapeDividerPreview'));

        $this->layout->render();

    }

    /**
     * @return int
     */
    public function getSliderID() {
        return $this->sliderID;
    }

    /**
     * @param int $sliderID
     */
    public function setSliderID($sliderID) {
        $this->sliderID = $sliderID;
    }

    /**
     * @return array
     */
    public function getSliderData() {
        return $this->sliderData;
    }

    /**
     * @param array $sliderData
     */
    public function setSliderData($sliderData) {
        $this->sliderData = $sliderData;
    }

    /**
     * @return string contains escaped html data
     */
    public function renderSlider() {

        $locale = setlocale(LC_NUMERIC, 0);
        setlocale(LC_NUMERIC, "C");

        $sliderManager = new SliderManager($this, $this->sliderID, true, array(
            'sliderData' => $this->getSliderData()
        ));
        $sliderManager->allowDisplayWhenEmpty();

        $sliderHTML = $sliderManager->render();

        setlocale(LC_NUMERIC, $locale);

        return $sliderHTML;
    }
}Application/Admin/Slider/Template/EditGroup.php000064400000001564152355233130015457 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;

use Nextend\Framework\Asset\Js\Js;
use Nextend\SmartSlider3\Settings;

/**
 * @var $this ViewSliderEditGroup
 */

$slider = $this->getSlider();

JS::addInline('new _N2.GroupEdit(' . json_encode(array(
        'previewInNewWindow' => !!Settings::get('preview-new-window', 0),
        'saveAjaxUrl'        => $this->getAjaxUrlSliderEdit($slider['id']),
        'previewUrl'         => $this->getUrlPreviewSlider($slider['id']),
        'ajaxUrl'            => $this->getAjaxUrlSliderEdit($slider['id']),
        'formData'           => $this->getFormData()
    )) . ');');
?>

<div class="n2-ss-sliders-outer-container">
    <?php
    $this->renderSliderManager();
    ?>
</div>
<form id="n2-ss-edit-group-form" action="#" method="post">
    <?php
    $this->renderForm();
    ?>
</form>Application/Admin/Slider/Template/Particle.php000064400000004420152355233130015312 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Request\Request;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;
use Nextend\SmartSlider3\Settings;
use Nextend\SmartSlider3\Slider\Slider;

/**
 * @var $this ViewSliderParticle
 */

JS::addGlobalInline('document.documentElement.classList.add("n2_html--application-only");');

$postedSliderData                    = (array)Request::$POST->getVar('slider', false);
$postedSliderData['desktop']         = 1; // Shape divider does not work if slider is not visible.
$postedSliderData['playWhenVisible'] = 0;


$frontendSlider = new Slider($this, $this->getSliderID(), array(
    'disableResponsive' => true,
    'sliderData'        => $postedSliderData
), true);

$frontendSlider->initAll();
$sliderHTML = $frontendSlider->render();

$externals = esc_attr(Settings::get('external-css-files'));
if (!empty($externals)) {
    $externals = explode("\n", $externals);
    foreach ($externals as $external) {
        echo "<link rel='stylesheet' href='" . esc_url($external) . "' type='text/css' media='all'>";
    }
}

Js::addStaticGroup(ResourceTranslator::toPath('$ss3-pro-frontend$/dist/particle.min.js'), 'particles');

$folder    = ResourceTranslator::toPath('$ss3-pro-frontend$/js/particle/presets/');
$files     = Filesystem::files($folder);
$extension = 'json';

$types = array();
for ($i = 0; $i < count($files); $i++) {
    $pathInfo = pathinfo($files[$i]);
    if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
        $types[$pathInfo['filename']] = file_get_contents($folder . $files[$i]);
    }
}

Js::addFirstCode("    
    new _N2.ParticleAdminManager(" . $this->getSliderID() . ", " . json_encode($types) . ");
");

$this->renderForm();
?>

<div class="n2_slider_preview_area">
    <div class="n2_slider_preview_area__inner" style="width:100%;max-width:<?php echo esc_attr($frontendSlider->features->responsive->sizes['desktopPortrait']['width']); ?>px;">
        <?php

        // PHPCS - Content already escaped
        echo $sliderHTML; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        ?>
    </div>
</div>Application/Admin/Slider/Template/ShapeDividerPreview.php000064400000002026152355233130017460 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;


use Nextend\Framework\Asset\Js\Js;
use Nextend\SmartSlider3\Settings;

/**
 * @var $this ViewSliderShapeDividerPreview
 */


JS::addGlobalInline('document.documentElement.classList.add("n2_html--application-only");');
JS::addGlobalInline('document.documentElement.classList.add("n2_html--slider-preview");');

$slider = $this->renderSlider();

$externals = esc_attr(Settings::get('external-css-files'));
if (!empty($externals)) {
    $externals = explode("\n", $externals);
    foreach ($externals as $external) {
        echo "<link rel='stylesheet' href='" . esc_attr($external) . "' type='text/css' media='all'>";
    }
}
// PHPCS - Content already escaped
echo $slider; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>

<script>
    document.addEventListener('keydown', function (e) {
        if (e.key === 'Escape') {
            parent.postMessage(JSON.stringify({action: 'cancel'}), "*");
        }
    });
</script>Application/Admin/Slider/Template/ShapeDivider.php000064400000004754152355233130016130 0ustar00<?php

namespace Nextend\SmartSlider3Pro\Application\Admin\Slider;

use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Request\Request;
use Nextend\Framework\ResourceTranslator\ResourceTranslator;

/**
 * @var $this ViewSliderShapeDivider
 */

JS::addGlobalInline('document.documentElement.classList.add("n2_html--application-only");');

$postedSliderData                    = (array)Request::$POST->getVar('slider', false);
$postedSliderData['playWhenVisible'] = 0;
/**
 * Shape divider admin editor does not work if slider is not visible.
 */
$postedSliderData['desktopportrait']  = 1;
$postedSliderData['desktoplandscape'] = 1;
$postedSliderData['tabletportrait']   = 1;
$postedSliderData['tabletlandscape']  = 1;
$postedSliderData['mobileportrait']   = 1;
$postedSliderData['mobilelandscape']  = 1;

$folder = ResourceTranslator::toPath('$ss3-pro-frontend$/shapedivider/');

$files     = Filesystem::files($folder);
$extension = 'svg';
$types     = array();
for ($i = 0; $i < count($files); $i++) {
    $pathInfo = pathinfo($files[$i]);
    if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
        $types['simple-' . $pathInfo['filename']] = file_get_contents($folder . $files[$i]);
    }
}

$folder .= 'bicolor/';
$files  = Filesystem::files($folder);
for ($i = 0; $i < count($files); $i++) {
    $pathInfo = pathinfo($files[$i]);
    if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension) {
        $types['bi-' . $pathInfo['filename']] = file_get_contents($folder . $files[$i]);
    }
}

Js::addFirstCode("    
    new _N2.ShapeDividerAdminManager(" . $this->getSliderID() . ", " . json_encode($types) . ");
");

$this->renderForm();
?>

<div class="n2_slider_preview_area" style="min-height:0;">
    <div class="n2_slider_preview_area__inner">
        <form id="n2_shape_divider__frame_form" target="n2_shape_divider__frame" action="<?php echo esc_url($this->MVCHelper->createUrl(array(
            'slider/shapedividerpreview',
            array(
                'sliderid' => $this->getSliderID()
            )
        ), true)); ?>" method="post" class="n2_form_element--hidden">
            <input type="hidden" name="sliderData" value="<?php echo esc_attr(json_encode($postedSliderData)); ?>">
        </form>
        <iframe name="n2_shape_divider__frame" id="n2_shape_divider__frame" style="width:100%;height: calc(100vh - 100px);"></iframe>
    </div>
</div>Application/Admin/Slider/License/ControllerAjaxLicense.php000064400000004304152355233130017611 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Slider\License;


use Nextend\Framework\Controller\Admin\AdminAjaxController;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Request\Request;
use Nextend\SmartSlider3\Application\Admin\TraitAdminUrl;
use Nextend\SmartSlider3\Application\Model\ModelLicense;
use Nextend\SmartSlider3\SmartSlider3Info;

class ControllerAjaxLicense extends AdminAjaxController {

    use TraitAdminUrl;

    public function actionAdd() {
        $this->validateToken();
        $this->validatePermission('smartslider_edit');


        $licenseKey = Request::$REQUEST->getVar('licenseKey');
        if (empty($licenseKey)) {
            Notification::error(n2_('License key cannot be empty!'));
            $this->response->error();
        }


        $status = ModelLicense::getInstance()
                              ->checkKey($licenseKey, 'licenseadd');

        $hasError = SmartSlider3Info::hasApiError($status);

        if ($hasError == 'dashboard') {
            $this->response->redirect($this->getUrlDashboard());
        } else if ($hasError !== false) {
            $this->response->error();
        }

        ModelLicense::getInstance()
                    ->setKey($licenseKey);
        $this->response->respond(array(
            'valid' => true
        ));
    
    }

    public function actionCheck() {
        $this->validateToken();
        $showErrors = Request::$REQUEST->getInt('showErrors', 1);

        $status = ModelLicense::getInstance()
                              ->isActive(Request::$REQUEST->getInt('cacheAccepted', 1));

        if ($showErrors) {
            $hasError = SmartSlider3Info::hasApiError($status);
            if ($hasError == 'dashboard') {
                $this->response->redirect($this->getUrlDashboard());
            } else if ($hasError !== false) {
                $this->response->error();
            }
            Notification::notice(n2_('License key is active!'));
            $this->response->respond();
        }

        if ($status == 'OK') {
            $this->response->respond();
        }
        $this->response->error();
    
    }
}Application/Admin/Slider/License/ControllerLicense.php000064400000001060152355233130017001 0ustar00<?php


namespace Nextend\SmartSlider3Pro\Application\Admin\Slider\License;


use Nextend\SmartSlider3\Application\Admin\AbstractControllerAdmin;
use Nextend\SmartSlider3\Application\Model\ModelLicense;
use Nextend\SmartSlider3\SmartSlider3Info;

class ControllerLicense extends AbstractControllerAdmin {

    public function actionDeAuthorize() {
        $status = ModelLicense::getInstance()
                              ->deAuthorize();

        SmartSlider3Info::hasApiError($status);

        $this->redirectToSliders();
    
    }
}