Your IP : 216.73.216.141


Current Path : /proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/1147586/cwd/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/1147586/cwd/SplitText.tar

ModelSplitText.php000064400000015554152412001220010175 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();
    }
}SplitTextManager.php000064400000000700152412001220010472 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();
    }
}SplitTextRenderer.php000064400000024201152412001240010672 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'
        )
    ),
);SplitTextStorage.php000064400000005140152412001300010526 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];
        }
    }
}Block/SplitTextManager/BlockSplitTextManager.php000064400000004054152412001370015746 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();
    }
}Block/SplitTextManager/Index.php000064400000002032152412001400012573 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>Block/SplitTextManager/Sidebar.php000064400000000767152412001400013112 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>