public static function backend($force = false) { static $once; if ($once != null && !$force) { return; } $once = true; $family = n2_x('Montserrat', 'Default Google font family for admin'); foreach (explode(',', n2_x('latin', 'Default Google font charset for admin')) as $subset) { N2GoogleFonts::addSubset($subset); } N2GoogleFonts::addFont($family); N2CSS::addInline('.n2,html[dir="rtl"] .n2,.n2 td,.n2 th,.n2 select, .n2 textarea, .n2 input{font-family: "' . $family . '", Arial, sans-serif;}'); N2CSS::addFiles(N2LIBRARYASSETS . "/css", array('nextend-font.css', 'font.css', 'admin.css', 'form.css', 'notificationcenter.css', 'spectrum.css', 'contextMenu.css'), 'nextend-backend'); foreach (glob(N2LIBRARYASSETS . "/css/tabs/*.css") as $file) { N2CSS::addFile($file, 'nextend-backend'); } foreach (glob(N2LIBRARYASSETS . "/css/jquery/*.css") as $file) { N2CSS::addFile($file, 'nextend-backend'); } N2JS::addFiles(N2LIBRARYASSETS . "/js", array('json2.js', 'admin.js', 'color.js', 'query-string.js', 'md5.js', 'css.js', 'imagehelper.js', 'modal.js', 'notificationcenter.js', 'spectrum.js', 'expert.js'), 'nextend-backend'); N2Localization::addJS(array('Cancel', 'Delete', 'Delete and never show again', 'Are you sure you want to delete?', 'Documentation')); self::form($force); N2JS::addFiles(N2LIBRARYASSETS . "/js/core/jquery", array("fixto.js", "jstorage.js", "jquery.datetimepicker.js", "jquery.tinyscrollbar.min.js", "jquery.unique-element-id.js", "vertical-pane.js"), "nextend-backend"); wp_enqueue_script('nextend-ui', N2Uri::pathToUri(N2LIBRARYASSETS . "/js/core/jquery/ui/jquery-ui.nextend.js"), array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-autocomplete', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-sortable', 'jquery-ui-slider'), '1.0', 1); wp_enqueue_script('nextend-ui-iframe-transport', N2Uri::pathToUri(N2LIBRARYASSETS . "/js/core/jquery/ui/jquery.iframe-transport.js"), array('jquery-ui-core', 'jquery-ui-widget'), '1.0', 1); wp_enqueue_script('nextend-ui-fileupload', N2Uri::pathToUri(N2LIBRARYASSETS . "/js/core/jquery/ui/jquery.fileupload.js"), array('jquery-ui-core', 'jquery-ui-widget'), '1.0', 1); N2JS::addFiles(N2LIBRARYASSETS . "/js/core/jquery/ui", array('jquery.contextMenu.js'), "nextend-backend"); N2Base::getApplication('system')->info->assetsBackend(); N2JS::addFirstCode("NextendAjaxHelper.addAjaxArray(" . json_encode(N2Form::tokenizeUrl()) . ");"); N2Plugin::callPlugin('fontservices', 'onFontManagerLoadBackend'); }
public function getDashboardButtons($slider) { $sliderid = $slider['id']; $app = N2Base::getApplication('smartslider'); $accessEdit = N2Acl::canDo('smartslider_edit', $app->info); $accessDelete = N2Acl::canDo('smartslider_delete', $app->info); $buttons = ''; if ($accessEdit) { $buttons .= N2Html::tag('a', array('data-label' => n2_('Quick Edit - Slides'), 'href' => '#', 'id' => 'n2-quick-slides-edit'), N2Html::tag('i', array('class' => 'n2-i n2-i-slideedit'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Clear slider cache'), 'href' => $this->appType->router->createUrl(array('slider/clearcache', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-refresh'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Export slider as HTML'), 'href' => $this->appType->router->createUrl(array('slider/exporthtml', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-html'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Export'), 'href' => $this->appType->router->createUrl(array('slider/export', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-export'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Duplicate slider'), 'href' => $this->appType->router->createUrl(array('slider/duplicate', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-duplicate'))); } if ($accessDelete) { $buttons .= N2Html::tag('a', array('data-label' => n2_('Delete slider'), "onclick" => "return NextendDeleteModalLink(this, 'slider-delete', " . json_encode($slider['title']) . ");", 'href' => $this->appType->router->createUrl(array('slider/delete', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-delete'))); } return $buttons; }
public function route($url, $params = array(), $isPost = false) { if (!strpos($url, "/")) { throw new Exception("Invalid action {$url}. Valid format controller/method"); } $parsedAction = explode("/", $url); $url = ""; if (strpos($this->baseUrl, "?")) { $url .= $this->baseUrl . "&nextendcontroller=" . $this->normalizeParameter($parsedAction[0]); } else { $url .= $this->baseUrl . "?nextendcontroller=" . $this->normalizeParameter($parsedAction[0]); } $url .= "&nextendaction=" . $this->normalizeParameter($parsedAction[1]); if ($isPost) { $params += N2Form::tokenizeUrl(); } if (count($params)) { $url .= "&" . http_build_query($params, null, '&'); } return $url; }
function ($) { var form = $('#smartslider-form'), formAction = form.attr('action'), isPreview = false; var modal = new NextendSimpleModal('<iframe name="n2-tab-preview" src="about:blank" style="width: 100%;height:100%;"></iframe>'); modal.modal.on('ModalHide', function () { modal.modal.find('iframe').attr('src', 'about:blank'); $(window).trigger('SSPreviewHide'); }); $('#n2-ss-preview').on('click', function (e) { isPreview = true; e.preventDefault(); modal.show(); form.attr({ action: '<?php echo $this->appType->router->createUrl(array("preview/generator", N2Form::tokenizeUrl() + array('generator_id' => $generator['id']))); ?> ', target: 'n2-tab-preview' }).submit().attr({ action: formAction, target: null }); isPreview = false; }); } ); </script>
var modal = new NextendSimpleModal('<iframe name="n2-tab-preview" src="" style="width: 100%;height:100%;"></iframe>'); modal.modal.on('ModalHide', function () { modal.modal.find('iframe').attr('src', 'about:blank'); $(window).trigger('SSPreviewHide'); }); $('#n2-ss-preview').on('click', function (e) { nextend.isPreview = true; e.preventDefault(); nextend.smartSlider.slide.prepareForm(); modal.show(); //var currentRequest = form.serialize(); form.attr({ action: '<?php echo $this->appType->router->createUrl(array("preview/slide", N2Form::tokenizeUrl() + array('slideId' => $slide ? $slide['id'] : 0, 'sliderId' => $sliderId))); ?> ', target: 'n2-tab-preview' }).submit().attr({ action: formAction, target: null }); nextend.isPreview = false; }); } ); </script> <form id="smartslider-form" action="" method="post">
}).done(function () { $('.n2-heading-bar .n2-heading').html($('#slidertitle').val()); $('dt.n2-ss-slide2-list > a > span').eq(0).html($('#slidertitle').val()); nextend.askToSave = true; n2('#smartslider-form').trigger('saved'); }); } }); $('#n2-ss-preview').on('click', function (e) { isPreview = true; e.preventDefault(); modal.show(); form.attr({ action: '<?php echo $this->appType->router->createUrl(array("preview/index", N2Form::tokenizeUrl() + array('sliderid' => $slider['id']))); ?> ', target: 'n2-tab-preview' }).submit().attr({ action: formAction, target: null }); isPreview = false; }); new NextendHeadingScrollToPane(headings, [ $('#n2-tab-slider, #n2-tab-slider-size, #n2-tab-slider-size-tablet, #n2-tab-slider-size-mobile, #n2-tab-slider-responsive, #nextend-responsive-mode-panel, #n2-tab-slides, #n2-tab-slider-layer, #n2-tab-autoplay, #n2-tab-slider-advanced'), $('#n2-tab-widgets'), $('#n2-tab-slider-responsive')
/** * @param $slide N2SmartSliderSlide * @param $slider N2SmartSliderAbstract * @param $widget * @param $appType * * @throws Exception */ public static function box($slide, $slider, $widget, $appType) { $lt = array(); if ($slide->isStatic()) { $lt[] = N2Html::tag('div', array('class' => 'n2-button-tag n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5'), n2_('Static slide')); } else { $lt[] = N2Html::tag('div', array('class' => 'n2-button-tag n2-button n2-button-x-small n2-button-green n2-uc n2-h5 n2-slide-is-first'), n2_('First')); $lt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5 n2-slide-first', 'href' => $appType->router->createUrl(array('slides/first', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), n2_('Set First')); } $rt = array(); $rt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-small n2-sidebar-list-bg n2-sidebar-list-bg n2-slide-duplicate', 'href' => $appType->router->createUrl(array('slides/duplicate', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-duplicate'), '')); $rt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-small n2-sidebar-list-bg n2-slide-delete', 'href' => $appType->router->createUrl(array('slides/delete', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-delete'), '')); $rt[] = N2Html::tag('div', array('class' => 'n2-button n2-button-small n2-button-blue n2-slide-selected'), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-tick'), '')); $rb = array(); if ($slide->hasGenerator()) { $rb[] = N2Html::tag('a', array('class' => 'n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5 n2-slide-generator' . (N2Request::getVar('generator_id') == $slide->generator_id ? ' n2-button-blue' : ''), 'href' => $appType->router->createUrl(array('generator/edit', array('generator_id' => $slide->generator_id)))), 'Edit generator'); } $image = $slide->getThumbnail(); if (empty($image)) { $image = '$system$/images/placeholder/image.png'; } $editUrl = $appType->router->createUrl(array('slides/edit', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id))); $widget->init("box", array('attributes' => array('class' => 'n2-box-slide n2-box-overflow' . ($slide->isFirst() ? ' n2-first-slide' : '') . ($slide->isCurrentlyEdited() ? ' n2-ss-slide-active' : ''), 'data-slideid' => $slide->id, 'data-title' => $slide->getRawTitle(), 'data-description' => $slide->getRawDescription(), 'data-link' => $slide->getRawLink(), 'data-image' => N2ImageHelper::fixed($image), 'data-editUrl' => $editUrl), 'image' => N2ImageHelper::fixed($image), 'firstCol' => N2Html::link($slide->getTitle() . ($slide->hasGenerator() ? ' [' . $slide->getSlideStat() . ']' : ''), $editUrl, array('class' => 'n2-h4')), 'lt' => implode('', $lt), 'rt' => implode('', $rt), 'rtAttributes' => array('class' => 'n2-on-hover'), 'rb' => implode('', $rb), 'placeholderContent' => N2Html::tag('a', array('class' => 'n2-slide-published' . ($slide->published ? ' n2-active' : ''), 'href' => $appType->router->createUrl(array('slides/publish', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-unpublished'), '')))); }
function n2GetBox($class, $image, $html, $hasBorder = true) { echo N2Html::tag('div', array('class' => 'n2-box n2-box-title ' . $class . ($hasBorder ? ' n2-box-border' : '')), N2Html::image(N2ImageHelper::fixed('$ss$/admin/images/' . $image)) . N2Html::tag("div", array('class' => 'n2-box-placeholder'), N2Html::tag("table", array(), N2Html::tag("tr", array(), N2Html::tag("td", array('class' => 'n2-box-button'), $html))))); } n2GetBox('n2-ss-demo-slider', 'add-demo.png', '<div>' . n2_('100+ Sample slide with one click.') . '</div><a href="#" class="n2-button n2-button-small n2-button-green n2-uc n2-h5">' . n2_('add sample slider') . '</a>'); ob_start(); $this->widget->init("buttonmenu", array("content" => N2Html::tag('div', array('class' => 'n2-button-menu'), N2Html::tag('div', array('class' => 'n2-button-menu-inner n2-border-radius'), N2Html::link(n2_('Import by upload'), $this->appType->router->createUrl(array('sliders/importbyupload')), array('class' => 'n2-h4')) . N2Html::link(n2_('Restore by upload'), $this->appType->router->createUrl(array('sliders/restorebyupload')), array('class' => 'n2-h4')) . N2Html::link(n2_('Import from server'), $this->appType->router->createUrl(array('sliders/importfromserver')), array('class' => 'n2-h4')) . N2Html::link(n2_('Export all slider'), $this->appType->router->createUrl(array('sliders/exportall')), array('class' => 'n2-h4', 'target' => '_blank')))))); n2GetBox('', 'import-upload.png', '<div>' . n2_('Import slider from different sources.') . '</div>' . N2Html::tag('div', array('class' => 'n2-button n2-button-with-menu n2-button-small n2-button-green'), N2Html::link(n2_('Import by upload'), $this->appType->router->createUrl(array('sliders/importbyupload')), array('class' => 'n2-button-inner n2-uc n2-h5')) . ob_get_clean())); n2GetBox('n2-box-wide n2-box-overflow n2-box-free', 'free/box2.png', N2Html::tag('div', array(), 'Take your slider to the next level with Smart Slider 3 PRO!') . N2Html::link('See all features', N2SS3::getWhyProUrl(), array('target' => '_blank', 'class' => 'n2-button n2-button-blue n2-button-medium n2-h5 n2-uc')), false); $updateModel = N2SmartsliderUpdateModel::getInstance(); $hasUpdate = $updateModel->hasUpdate(); $this->appType->router->setMultiSite(); $updateUrl = $this->appType->router->createUrl(array('update/update', N2Form::tokenizeUrl() + array('download' => 1))); $this->appType->router->unSetMultiSite(); $versionsTXT = '<div>' . sprintf(n2_('Installed version: %s'), N2SS3::$version . (N2SSPRO ? ' Pro' : '')) . ($hasUpdate ? '<br/>' . sprintf(n2_('Latest version: %s'), $updateModel->getVersion() . (N2SSPRO ? ' Pro' : '')) : '<br/>' . sprintf(n2_('Last check: %s'), $updateModel->lastCheck())) . '</div>'; n2GetBox('', 'Update.png', $versionsTXT . ($hasUpdate ? '<a href="' . $updateUrl . '" class="n2-button n2-button-small n2-button-blue n2-uc n2-h5">' . n2_('Update') . '</a>' : '') . (!$hasUpdate ? '<a href="' . $this->appType->router->createUrl(array('update/check', N2Form::tokenizeUrl())) . '" class="n2-button n2-button-small n2-button-blue n2-uc n2-h5">' . n2_('Check') . '</a>' : '') . '<a href="#" onclick="NextendModalDocumentation(\'' . n2_('Changelog') . '\', \'http://doc.smartslider3.com/article/432-changelog\');return false;" class="n2-button n2-button-small n2-button-grey n2-uc n2-h5">' . n2_('Changelog') . '</a>'); if ($hasUpdate) { ?> <script type="text/javascript"> n2(window).ready(function ($) { $('.n2-main-top-bar').append('<div class="n2-left n2-top-bar-menu"><span><?php printf(n2_('Version %s available!'), $updateModel->getVersion()); ?> </span> <a style="font-size: 12px;margin-right: 10px;" class="n2-h3 n2-uc n2-has-underline n2-button n2-button-blue n2-button-medium" href="<?php echo $updateUrl; ?> "><?php n2_e('Update'); ?> </a> <a style="font-size: 12px;" class="n2-h3 n2-uc n2-has-underline n2-button n2-button-grey n2-button-medium" href="#" onclick="NextendModalDocumentation(\'<?php n2_e('Changelog');
<div class="n2-sidebar-list-bg n2-ss-slides-control"> <?php echo N2Html::tag('div', array('class' => 'n2-button n2-button-big n2-button-grey n2-slides-bulk'), N2Html::tag('i', array('class' => 'n2-i n2-i-bulk n2-it'), '')); echo N2Html::tag('div', array('class' => 'n2-button n2-button-with-menu n2-button-big n2-button-green n2-slides-add'), N2Html::link(n2_('Add image slide'), '#', array('class' => 'n2-button-inner n2-add-quick-image n2-uc n2-h3')) . $buttonMenu); echo N2Html::tag('div', array('class' => 'n2-button n2-button-with-menu n2-button-big n2-button-grey n2-bulk-select'), N2Html::link(n2_('Select'), '#', array('class' => 'n2-button-inner n2-uc n2-h4')) . $selectButtonMenu); echo N2Html::tag('div', array('class' => 'n2-button n2-button-with-menu n2-button-big n2-button-grey n2-bulk-action'), N2Html::link(n2_('Delete'), '#', array('class' => 'n2-button-inner n2-uc n2-h4')) . $actionButtonMenu); echo N2Html::tag('div', array('class' => 'n2-button n2-button-big n2-button-red n2-bulk-cancel n2-uc n2-h4'), n2_('Cancel')); ?> </div> <?php $preUl = ob_get_clean(); } $actions = ''; if ($accessEdit) { $actions .= N2Html::tag('a', array("href" => $this->appType->router->createUrl(array('slider/duplicate', array('sliderid' => $slider["id"]) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-16 n2-i-duplicate n2-i-grey-opacity'), '')); } if ($accessDelete) { $actions .= N2Html::tag('a', array("onclick" => "return NextendDeleteModalLink(this, 'slider-delete', " . json_encode($slider['title']) . ");", "href" => $this->appType->router->createUrl(array('slider/delete', array('sliderid' => $slider["id"]) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-16 n2-i-delete n2-i-grey-opacity'), '')); } $dl[] = array('title' => '<i class="n2-i n2-i-slider"></i><span>' . $slider['title'] . '</span><span class="n2-id n2-h5">#' . $slider['id'] . '</span>', 'link' => $this->appType->router->createUrl(array('slider/edit', array('sliderid' => $slider["id"]))), 'class' => 'n2-ss-slide2-list ' . ($active ? 'n2-open ' : '') . ($active && $controller == 'sliders' ? 'active ' : ''), 'preUl' => $preUl, 'tooltip' => null, 'actions' => $actions); } } /** * @see Definitionlist */ $this->widget->init("definitionlist", array("dl" => $dl)); if ($showSlideManager) { $this->renderInline("slidemanager", array('slider' => $slider)); } ?> </div>
public static function addButtonDialog() { global $wpdb; $query = 'SELECT sliders.title, sliders.id, slides.thumbnail FROM ' . $wpdb->prefix . 'nextend2_smartslider3_sliders AS sliders LEFT JOIN ' . $wpdb->prefix . 'nextend2_smartslider3_slides AS slides ON slides.id = (SELECT id FROM ' . $wpdb->prefix . 'nextend2_smartslider3_slides WHERE slider = sliders.id AND published = 1 AND generator_id = 0 AND thumbnail NOT LIKE \'\' ORDER BY ordering DESC LIMIT 1) ORDER BY time DESC'; $sliders = $wpdb->get_results($query, ARRAY_A); ?> <div id='n2-ss-editor-modal' title='Select a Slider'> <div class="n2-ss-editor-inner"> <div class="n2-ss-editor-header">Select a Slider<div class="n2-ss-editor-header-close"></div></div> <div class="n2-ss-editor-boxes"> <?php $router = N2Base::getApplication('smartslider')->router; $token = N2Form::tokenizeUrl(); foreach ($sliders as $slider) { if (empty($slider['thumbnail'])) { $slider['thumbnail'] = '$system$/images/placeholder/image.png'; } ?> <div class="n2-ss-editor-box" data-sliderid="<?php echo $slider['id']; ?> " style="background-image: url(<?php echo N2ImageHelper::fixed($slider['thumbnail']); ?> ); "> <div class="n2-ss-editor-box-actions"> <a target="_blank" href="<?php echo $router->createUrl(array('slider/edit', array('sliderid' => $slider["id"]))); ?> ">Edit</a> <a target="_blank" href="<?php echo $router->createUrl(array('preview/index', array('sliderid' => $slider["id"]) + $token)); ?> ">Preview</a> </div> <div class="n2-ss-editor-box-title"><?php echo $slider['title']; ?> </div> </div> <?php } ?> </div> <div class="n2-ss-editor-buttons"> <a href="#" class="n2-ss-editor-insert">Insert slider</a> <a target="_blank" href="<?php echo $router->createUrl(array('sliders/index')); ?> " class="n2-ss-editor-create-slider">Create slider</a> </div> </div> </div> <script type="text/javascript"> jQuery(document).ready(function ($) { var modal = $('#n2-ss-editor-modal'), inner = $('.n2-ss-editor-inner'), boxes = inner.find('.n2-ss-editor-boxes'), $window = $(window), active = null, callback = function () { }, watchResize = function () { boxes.height(inner.height() - 116); $window.on('resize.ss', function () { boxes.height(inner.height() - 116); }); }, unWatchResize = function () { $window.off('resize.ss'); }, show = function () { modal.addClass('n2-active'); watchResize(); }, hide = function () { unWatchResize(); modal.removeClass('n2-active'); }; boxes.find('.n2-ss-editor-box').on('click', function () { if (active !== null) { active.removeClass('n2-active'); } active = $(this).addClass('n2-active'); }); modal.on('click', function (e) { if (e.target == modal.get(0)) { hide(); } }); $('.n2-ss-editor-header-close').on('click', function (e) { e.preventDefault(); hide(); }); $('.n2-ss-editor-insert').on('click', function (e) { e.preventDefault(); if (active !== null) { callback(active.data('sliderid')); hide(); } else { alert('Please select a slider!'); } }); window.NextendSmartSliderWPTinyMCEModal = function (ed) { callback = function (id) { ed.execCommand('mceInsertContent', false, '<div>[smartslider3 slider=' + id + ']</div>'); }; show(); }; if (typeof QTags !== 'undefined') { QTags.addButton('smart-slider-3', 'Smart Slider', function () { callback = function (id) { QTags.insertContent('<div>[smartslider3 slider=' + id + ']</div>'); }; show(); }); } }); </script> <?php }