static function getInstance() { global $nextendexport; static $instance; if (!is_object($instance)) { $instance = new NextendJavascriptjQuery(); $instance->addJsLibraryFile('njQuery.js'); $jqueryLoaded = false; if (nextendIsJoomla()) { JLoader::import('joomla.version'); $version = new JVersion(); if (version_compare($version->RELEASE, '3.0', '>=')) { JHtml::_('jquery.framework'); $jqueryLoaded = true; } } if ($nextendexport) { $jqueryLoaded = false; } if (!$jqueryLoaded) { $instance->addJsLibraryFile('jQuery.js'); } $instance->addJsLibraryFile('uacss.js'); $instance->addJsLibraryFile('jquery.unique-element-id.js'); } return $instance; }
function NextendSliderWidgets($slider, $id) { $this->_slider = $slider; $this->_id = $id; $this->_widgets = array(); $this->_enabledWidgets = array(); $params = $this->_slider->_sliderParams; if ($slider->_backend) { return; } $plugins = array(); NextendPlugin::callPlugin('nextendsliderwidget', 'onNextendSliderWidgetList', array(&$plugins)); foreach ($plugins as $k => $v) { $widget = $params->get('widget' . $k); $display = NextendParse::parse($params->get('widget' . $k . 'display', '0|*|always|*|0|*|0')); if ($widget != '' && (isset($display[0]) && intval($display[0]) || isset($display[2]) && intval($display[2]) || isset($display[3]) && intval($display[3]))) { $this->_enabledWidgets[$k] = $widget; } } foreach ($this->_enabledWidgets as $k => $v) { if (nextendIsJoomla()) { JPluginHelper::importPlugin('nextendsliderwidget' . $k); } $class = 'plgNextendSliderWidget' . $k . $v; if (class_exists($class, false)) { $this->_widgets[$k] = call_user_func(array($class, 'render'), $slider, $id, $params); } } }
function fetchElement() { global $smartslidercontroller, $ss2sliderafterform; $this->_value = htmlspecialchars($this->_form->get($this->_name, $this->_default), ENT_QUOTES); $this->_form->set($this->_name, $this->_value); $html = '<div style="display:none;">' . parent::fetchElement() . '</div>'; $slider = null; $params = new NextendData(); if (nextendIsJoomla()) { nextendimportsmartslider2('nextend.smartslider.joomla.slider'); $module = new stdClass(); $module->id = 0; $params->loadArray(array('slider' => intval($_GET['sliderid']))); $slider = new NextendSliderJoomla($module, $params, dirname(__FILE__), true); } else { if (nextendIsWordpress()) { nextendimportsmartslider2('nextend.smartslider.wordpress.slider'); $slider = new NextendSliderWordpress(intval($_GET['sliderid']), $params, dirname(__FILE__), true); } else { if (nextendIsMagento()) { nextendimportsmartslider2('nextend.smartslider.magento.slider'); $slider = new NextendSliderMagento(intval($_GET['sliderid']), $params, dirname(__FILE__), true); } } } ob_start(); echo "<div id='smartslider-adjust-height' style='overflow:auto; margin: 5px; padding: 5px;'>"; $slider->render(); echo "</div>"; echo "<div id='smart-slider-layer-dummy' class='smart-slider-layer'></div>"; echo '<div class="smartslider-slide-advanced-layers" style="min-width: 1600px;"></div>'; $ss2sliderafterform = ob_get_clean(); $css = NextendCss::getInstance(); $css->addCssLibraryFile('jqueryui/jquery.ui.resizable.css'); $css->addCssFile(NEXTEND_SMART_SLIDER2_ASSETS . 'admin/css/layer.css'); $js = NextendJavascript::getInstance(); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.core.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.widget.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.mouse.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.resizable.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.draggable.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.sortable.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.droppable.min.js'); $js->addLibraryJsFile('jquery', NEXTENDLIBRARYASSETS . 'js' . DIRECTORY_SEPARATOR . 'base64.js'); $js->addLibraryJsFile('jquery', NEXTENDLIBRARYASSETS . 'js' . DIRECTORY_SEPARATOR . 'sortable.js'); $js->addLibraryJsFile('jquery', NEXTEND_SMART_SLIDER2_ASSETS . 'admin' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'console.js'); $js->addLibraryJsFile('jquery', NEXTEND_SMART_SLIDER2_ASSETS . 'admin' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'slide.js'); $js->addLibraryJsFile('jquery', NEXTEND_SMART_SLIDER2_ASSETS . 'admin' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'slide.layer.js'); $js->addLibraryJsFile('jquery', NEXTEND_SMART_SLIDER2_ASSETS . 'admin' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'slide.item.js'); $js->addLibraryJsFile('jquery', NEXTEND_SMART_SLIDER2_ASSETS . 'admin' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'slide.layout.js'); $js->addLibraryJs('jquery', "\r\n njQuery(document).ready(function(){\r\n var el = \$('#smartslider-adjust-height');\r\n el.height(el[0].scrollHeight+10);\r\n \$(window).trigger('resize');\r\n });\r\n ndojo.addOnLoad(function(){\r\n SmartSliderAdminSlide('" . $slider->getId() . "','" . $slider->_activeSlide . "','" . $this->_id . "', '" . $smartslidercontroller->route('controller=layouts&action=create') . "');\r\n });\r\n "); if (NextendSmartSliderSettings::get('slideeditoralert', 1)) { $js->addLibraryJs('jquery', "\r\n njQuery(window).on('beforeunload', function() {\r\n if (njQuery.now()-window.nextendtime > 60000 && !window.nextendsave) { // 1 min\r\n return '" . NextendText::_('Your_slide_settings_has_not_been_submitted_yet') . "';\r\n } else {\r\n return;\r\n }\r\n });\r\n "); } return $html; }
function fetchElement() { $html = parent::fetchElement(); if (nextendIsJoomla()) { JHtml::_('behavior.modal'); $user = JFactory::getUser(); $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component'; $html .= '<div class="button2-left" style="margin: 2px 0 2px 10px; float: left;"> <div class="article"> <a onclick="window.jSelectArticle = function(id, title, catid, object, link, lang){njQuery(\'#' . $this->_id . '\').val(link); NfireEvent(document.getElementById(\'' . $this->_id . '\'),\'change\');SqueezeBox.close();};return false;" rel="{handler: \'iframe\', size: {x: 900, y: 520}}" href="' . $link . '" title="Article" class="modal btn modal-button"><i class="icon-file-add"></i>' . NextendText::_('Article') . '</a> </div> </div>'; } return $html; }
function loadList() { if ($this->_list == null) { if (nextendIsJoomla()) { $this->loadJoomlaList(); } else { if (nextendIsMagento()) { $this->loadOtherList(); } else { if (nextendIsWordpress()) { $this->loadWordpressList(); } } } } }
static function getInstance() { static $instance; if (!is_object($instance)) { if (nextendIsJoomla()) { nextendimport('nextend.javascript.joomla'); $instance = new NextendJavascriptJoomla(); } elseif (nextendIsWordPress()) { nextendimport('nextend.javascript.wordpress'); $instance = new NextendJavascriptWordPress(); } elseif (nextendIsMagento()) { nextendimport('nextend.javascript.magento'); $instance = new NextendJavascriptMagento(); } } return $instance; }
function fetchElement() { $folder = NextendXmlGetAttribute($this->_xml, 'folder'); if ($folder === 'systemimages') { if (nextendIsJoomla()) { $folder = JPATH_SITE . '/images/'; } else { if (nextendIsWordpress()) { $folder = wp_upload_dir(); $folder = $folder['basedir'] . '/'; } else { if (nextendIsMagento()) { $folder = Mage::getBaseDir('media') . '/'; } } } } $this->addFolder($folder); return parent::fetchElement(); }
function NextendSmartsliderAdminController($key) { global $smartslidercontroller; $smartslidercontroller = $this; parent::NextendController($key); if (!$this->canDo('core.manage')) { $this->access = 0; $this->message(NextendText::_('Access not allowed to this resource.')); return; } nextendimport('nextend.css.css'); $css = NextendCss::getInstance(); $css->addCssLibraryFile('ni.css'); $this->_baseControllerPath = dirname(__FILE__); $this->_routeMap = array('sliders' => array('sliders_slider' => array('default', 'create', 'edit', 'full'), 'sliders_generator' => array('default', 'edit')), 'slides' => array('sliders_slides' => array('default', 'create', 'edit', 'order')), 'layouts' => array('sliders_layouts' => array('default', 'create', 'edit')), 'settings' => array('sliders_settings' => array('default', 'layout', 'font')), 'help' => array('sliders_help' => array('default'))); $this->init(); if (nextendIsJoomla()) { $this->_router->_baseurl = 'index.php?option=com_smartslider2'; } else { if (nextendIsWordpress()) { $this->_router->_baseurl = 'admin.php?page=nextend-smart-slider2'; } } }
?> <?php $this->loadFragment('secondcolstart'); ?> <?php $accessModuleCreate = $this->canDo('core.create', 'com_modules'); $accessSliderCreate = $this->canDo('slider.create'); $accessSliderEdit = $this->canDo('slider.edit'); $accessSliderDelete = $this->canDo('slider.delete'); $accessSlideCreate = $this->canDo('slide.create'); $accessSlideEdit = $this->canDo('slide.edit'); $accessSlideDelete = $this->canDo('slide.delete'); $accessCore = $this->canDo('core.admin'); $j15 = !nextendIsJoomla() || version_compare(JVERSION, '1.6.0', 'ge') ? false : true; $sliderid = NextendRequest::getInt('sliderid', 0); $slidersModel = $this->getModel('sliders'); $slider = $slidersModel->getSlider($sliderid); $generatorParams = new NextendData(); $generatorParams->loadJSON($slider['generator']); ?> <h2>Generator</h2> <div class="smartslider-button-wrap"> <div class="smartslider-button smartslider-back smartslider-button-grey smartslider-button-blue-active smartslider-icon-container"> <a href="<?php echo $this->route('controller=sliders&view=sliders_generator&action=generatorstart&sliderid=' . $sliderid); ?> " class="smartslider-button-link"><span class="smartslider-icon smartslider-action-icon smartslider-action-icon-generator"></span><?php echo NextendText::_('Change_source');
function fetchElement() { $html = parent::fetchElement(); if (nextendIsJoomla()) { JHtml::_('behavior.modal'); $user = JFactory::getUser(); $link = 'index.php?option=com_media&view=images&tmpl=component&e_name=com_smartslider2&author=' . $user->id; $html .= '<div class="button2-left" style="margin: 2px 0 2px 10px; float: left;"> <div class="image"> <a onclick="window.jInsertEditorText = function(tag, editor){njQuery(\'#' . $this->_id . '\').val((window.nextendimageurl == 0 ? \'' . NextendUri::getBaseUri() . '\' : \'\')+njQuery(tag).attr(\'src\')); NfireEvent(document.getElementById(\'' . $this->_id . '\'),\'change\'); };return false;" rel="{handler: \'iframe\', size: {x: 900, y: 520}}" href="' . $link . '" title="Image" class="modal btn modal-button"><i class="icon-picture"></i>' . NextendText::_('Image') . '</a> </div> </div>'; } else { if (nextendIsWordPress()) { add_thickbox(); wp_enqueue_script('media-upload'); wp_print_styles('editor-buttons'); $html .= ' <div class="wp-media-buttons" style="float: left; margint-top:1px;"> <a title="Add Media" onclick="window.send_to_editor = function(html){var inp = njQuery(\'#' . $this->_id . '\'); setFromWPLibrary(html, inp); };tb_show(\'\', \'' . admin_url('media-upload.php?type=image&TB_iframe=true&width=800&height=800') . '\');return false;" data-editor="content" class="button insert-media add_media" href="#"><span class="wp-media-buttons-icon"></span> Add Media</a> </div> <script> function setFromWPLibrary(html, el){ if( Object.prototype.toString.call( html) === \'[object Array]\' ) { el.val(html[0]); }else{ var html = jQuery(html); var img = html; if(html[0].tagName != \'IMG\'){ img = jQuery(\'img\',html); } el.val(img.attr(\'src\')); } NfireEvent(el[0], \'change\'); tb_remove(); } </script> '; } else { if (nextendIsMagento()) { static $loaded; ob_start(); if ($loaded == null) { $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'extjs/ext-tree.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'extjs/ext-tree-checkbox.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'extjs/fix-defer.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/variables.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/wysiwyg/widget.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'lib/flex.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'lib/FABridge.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/flexuploader.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/browser.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'prototype/window.js"></script>'; $html .= '<link rel="stylesheet" type="text/css" href="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'prototype/windows/themes/default.css" media="screen"/>'; $html .= '<link rel="stylesheet" type="text/css" href="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'adminhtml/default/default/lib/prototype/windows/themes/magento.css" media="screen"/>'; ?> <script type="text/javascript"> njQuery(window).ready(function(){ Mediabrowser.prototype.insert = Mediabrowser.prototype.insert.wrap(function(parentMethod, event) { var div; if (event != undefined) { div = $(Event.findElement(event, 'DIV')); } else { $$('div.selected').each(function (e) { div = jQuery('#'+e.id); }); } if (div.length == 0) { return false; } var targetEl = this.getTargetElement(); if (! targetEl) { alert("Target element not found for content update"); Windows.close('browser_window'); return; } div = div[0]; var params = {filename:div.id, node:this.currentNode.id, store:this.storeId}; if (targetEl.tagName.toLowerCase() == 'textarea') { params.as_is = 1; } new Ajax.Request(this.onInsertUrl, { parameters: params, onSuccess: function(transport) { try { this.onAjaxSuccess(transport); if (this.getMediaBrowserOpener()) { self.blur(); } Windows.close('browser_window'); if (targetEl.tagName.toLowerCase() == 'input') { targetEl.value = transport.responseText; NfireEvent(targetEl, 'change'); // AntoineK overload START if (varienGlobalEvents) { varienGlobalEvents.fireEvent('mediachooserChange' + targetEl.id, transport.responseText); } // AntoineK overload END } else { updateElementAtCursor(targetEl, transport.responseText); if (varienGlobalEvents) { varienGlobalEvents.fireEvent('tinymceChange'); } } } catch (e) { alert(e.message); } }.bind(this) }); }); }); </script> <?php $loaded = true; } ?> <script type="text/javascript"> njQuery(window).ready(function(){ jQuery('#<?php echo $this->_id; ?> _button').on('click', function(event){ event.preventDefault(); MediabrowserUtility.openDialog('<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/cms_wysiwyg_images_chooser/index', array('target_element_id' => $this->_id, 'store' => 'undefined', 'type' => 'image')); ?> '); }); }); </script> <?php $html .= ob_get_clean(); $html .= '<a id="' . $this->_id . '_button" title="Add Image" data-editor="content" class="button add-image" href="#"> <span class="wp-media-buttons-icon"></span> Add Image </a>'; } } } return $html; }
$fonts->addFont('Open Sans'); $fonts->addFont('Open Sans', 600); $fonts->addFont('Open Sans', 700); ?> <script type="text/javascript"> window.nextendFixRelative = function(uri){ if(uri.substr(0, 1) == '/' || uri.indexOf('://') != -1) return uri; return '<?php echo NextendUri::getRelative(); ?> '+uri; } window.nextendimageurl = <?php echo nextendIsJoomla() ? intval(NextendSmartSliderJoomlaSettings::get('imageurl', 1)) : 0; ?> ; </script> <div id="smartslider-admin" class="nextend-nowindow smartslider-advanced-layers-simple-active smartslider-device-all-active ni"> <div class="smartslider-head"> <div class="smartslider-logo" style="cursor: pointer;" onclick="location.href='<?php echo $this->route('controller=sliders'); ?> ';"> <div class="smartslider-border"></div> </div> <div class="smartslider-toolbar smartslider-toolbar-iron"> <div class="smartslider-toolbar-controllers">
function NextendSliderCache($slider) { nextendimportsmartslider2('nextend.smartslider.check'); nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); nextendimport('nextend.fonts.google'); $this->slider = $slider; $sliderid = $slider->_sliderid; $recache = false; $cached = json_decode(NextendSmartSliderStorage::get('slidercache' . $sliderid), true); if (nextendIsWordpress()) { $time = current_time('timestamp'); } else { $time = time(); } nextendimportsmartslider2('nextend.smartslider.admin.models.slides'); $slidesModel = new NextendSmartsliderAdminModelSlides(null); $slides = $slidesModel->getSlides($sliderid, ''); $slideexpire = null; foreach ($slides as $s) { $publish_up = strtotime($s['publish_up']); if ($publish_up && $publish_up > $time && ($slideexpire == null || $publish_up < $slideexpire)) { $slideexpire = $publish_up; } $publish_down = strtotime($s['publish_down']); if ($publish_down && $publish_down > $time && ($slideexpire == null || $publish_down < $slideexpire)) { $slideexpire = $publish_down; } } if (is_array($cached)) { if (NextendSmartSliderStorage::get('sliderchanged' . $sliderid) == 1) { $recache = true; } else { if (isset($cached['time']) && isset($cached['expire']) && $cached['time'] < time() - $cached['expire'] * 60 * 60) { $recache = true; } else { if (isset($cached['slideexpire']) && $cached['slideexpire'] < $time) { $recache = true; } } } } else { $recache = true; } if (!$recache) { $data = $cached['data']; if (isset($data['css'])) { if (!NextendFilesystem::fileexists(NextendFilesystem::absoluteURLToPath($data['css']))) { $recache = true; } } else { $recache = true; } if (!isset($data['libraries']) || !isset($data['libraries']['jquery']) || !isset($data['libraries']['jquery']['jsfiles']) || count($data['libraries']['jquery']['jsfiles']) == 0) { $recache = true; } } //$recache = true; if ($recache) { $data = $this->render(); $cached = array('time' => time(), 'data' => $data); if ($this->slider->_generatorParams->get('enabled', 0)) { $generatorcached = json_decode(NextendSmartSliderStorage::get('generator' . $sliderid), true); if (is_array($generatorcached)) { $cached['time'] = $generatorcached['time']; $cached['expire'] = $this->slider->_generatorParams->get('cachetime', '24'); } } if ($slideexpire) { $cached['slideexpire'] = $slideexpire; } NextendSmartSliderStorage::set('slidercache' . $sliderid, json_encode($cached)); NextendSmartSliderStorage::set('sliderchanged' . $sliderid, '0'); } $this->cssurl = $data['css']; if (nextendIsWordPress()) { add_action('nextend_css', array($this, 'addCSS')); } elseif (nextendIsMagento()) { Nextend_SmartSlider2_Model_Observer::$sliders[] = array($this, 'addCSS'); } else { $this->addCSS(); } $js = NextendJavascript::getInstance(); foreach ($data['js']['core'] as $j) { $js->addJsFile($j); } if (isset($data['libraries']) && count($data['libraries'])) { foreach ($data['libraries'] as $library => $jss) { $js->loadLibrary($library); if (!empty($jss['js'])) { $js->addLibraryJs($library, $jss['js']); } if (count($jss['jsfiles'])) { foreach ($jss['jsfiles'] as $j) { $js->addLibraryJsFile($library, $j); } } } } if (isset($data['fonts']) && count($data['fonts'])) { $google = NextendFontsGoogle::getInstance(); foreach ($data['fonts'] as $k => $v) { $style = explode(',', $v[0]); $subset = explode(',', $v[1]); for ($i = 0; $i < count($style); $i++) { $google->addFont($k, $style[$i], $subset[$i]); } } } $slider = $data['html']; if (nextendIsJoomla()) { if (version_compare(JVERSION, '1.6.0', 'ge')) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $article = new stdClass(); $article->text = $slider; $_p = array(); $dispatcher->trigger('onContentPrepare', array('com_smartslider2', &$article, &$_p, 0)); if (!empty($article->text)) { $slider = $article->text; } } } elseif (nextendIsWordPress()) { if (!function_exists('ss2_attr_shortcode')) { function ss2_attr_shortcode($matches) { return 'data-' . $matches[1] . '="' . str_replace('"', '"', do_shortcode(str_replace('"', '"', $matches[2]))) . '"'; } } $slider = preg_replace_callback("/data-(click|enter|leave)=\"(.*?)\"/", "ss2_attr_shortcode", $slider); $slider = do_shortcode($slider); } echo $slider; }
function fullAction() { if (nextendIsJoomla()) { $this->display('default', 'full'); } else { if (nextendIsWordpress()) { $this->display('default', 'fullwordpress'); } } }
/* # author Roland Soos # copyright Copyright (C) Nextendweb.com. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-3.0.txt GNU/GPL */ defined('_JEXEC') or die('Restricted access'); $js = NextendJavascript::getInstance(); $accessSliderCreate = $this->canDo('slider.create'); $accessSliderEdit = $this->canDo('slider.edit'); $accessSliderDelete = $this->canDo('slider.delete'); $accessSlideCreate = $this->canDo('slide.create'); $accessSlideEdit = $this->canDo('slide.edit'); $accessSlideDelete = $this->canDo('slide.delete'); $accessCore = $this->canDo('core.admin'); $isJ = nextendIsJoomla(); $isWP = nextendIsWordPress(); $isMage = nextendIsMagento(); $j15 = !$isJ || version_compare(JVERSION, '1.6.0', 'ge') ? false : true; ?> <div class="smartslider-button-wrap"> <?php $slidersModel = $this->getModel('sliders'); $sliderid = NextendRequest::getInt('sliderid'); if (NextendRequest::getCmd('action', '') == '' || NextendRequest::getCmd('view', 'sliders_slider') == 'sliders_slider' && NextendRequest::getCmd('action', 'create') == 'create') { $sliders = $slidersModel->getSliders(); if ($accessSliderCreate) { ?> <div class="smartslider-button smartslider-import smartslider-button-grey smartslider-button-blue-active smartslider-icon-container <?php echo NextendRequest::getCmd('view') == 'sliders_slider' && NextendRequest::getCmd('action') == 'import' ? 'active' : '';
function ss2_css_image_replace($ms) { global $zip; if (substr($ms[1], 0, 2) == '//') { $ms[1] = 'http:' . $ms[1]; } $path = NextendFilesystem::absoluteURLToPath($ms[1]); if (NextendFilesystem::fileexists($path)) { if (nextendIsJoomla()) { $rel = str_replace('plugins/', 'images/', NextendFilesystem::pathToRelativePath($path)); } else { if (nextendIsWordpress()) { $rel = str_replace(NEXTEND_SMART_SLIDER2 . 'plugins/', 'images/', $path); } } $zip->addFile(NextendFilesystem::readFile($path), $rel); return 'url(' . $rel . ')'; } }
function fetchElement() { $css = NextendCss::getInstance(); $css->addCssFile(NEXTEND_SMART_SLIDER2_ASSETS . 'admin/css/createquick.css'); $css->addCssLibraryFile('element/textarea.css'); $js = NextendJavascript::getInstance(); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.core.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.widget.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.mouse.min.js'); $js->addLibraryJsLibraryFile('jquery', 'ui/jquery.ui.sortable.min.js'); $this->_value = $this->_form->get($this->_name, $this->_default); $images = json_decode($this->_value, true); $html = '<div id="selected-images-container" class="">'; if (nextendIsWordpress()) { add_filter('media_view_strings', 'custom_media_uploader_tabs', 5); function custom_media_uploader_tabs($strings) { $strings['insertMediaTitle'] = "Image"; $strings['insertIntoPost'] = "Add to slider"; // remove options if (isset($strings['createGalleryTitle'])) { unset($strings['createGalleryTitle']); } if (isset($strings['insertFromUrlTitle'])) { unset($strings['insertFromUrlTitle']); } return $strings; } wp_enqueue_style('editor'); if (function_exists('wp_enqueue_media')) { wp_enqueue_media(); } else { wp_enqueue_style('thickbox'); wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); } $html .= '<a title="Add Image" data-editor="content" class="button add-image" href="#"> <span class="wp-media-buttons-icon"></span> Add Image </a> <div style="clear: both;"></div>'; } else { if (nextendIsMagento()) { $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'extjs/ext-tree.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'extjs/ext-tree-checkbox.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'extjs/fix-defer.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/variables.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/wysiwyg/widget.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'lib/flex.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'lib/FABridge.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/flexuploader.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'mage/adminhtml/browser.js"></script>'; $html .= '<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'prototype/window.js"></script>'; $html .= '<link rel="stylesheet" type="text/css" href="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'prototype/windows/themes/default.css" media="screen"/>'; $html .= '<link rel="stylesheet" type="text/css" href="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'adminhtml/default/default/lib/prototype/windows/themes/magento.css" media="screen"/>'; $html .= '<a title="Add Image" data-editor="content" class="button add-image" href="#"> <span class="wp-media-buttons-icon"></span> Add Image </a> <input type="hidden" id="magentohidden" /> <div style="clear: both;"></div>'; } } $html .= '<div id="delete-image"></div> <ul id="selected-images">'; if (is_array($images)) { $i = 0; foreach ($images as $img) { $html .= '<li>'; $html .= '<img src="' . NextendUri::fixrelative($img['image']) . '" data-src="' . $img['image'] . '" /><div class="field-container">'; $html .= ' <div class="nextend-mixed-group"> <div class="nextend-mixed-label"> <label for="title' . $i . '" id="title' . $i . '-lbl">Title</label> </div> <div class="nextend-mixed-element"> <div class="nextend-text "> <input type="text" autocomplete="off" style="width:390px;" value="' . $img['title'] . '" name="" id="title' . $i . '"> </div> </div> </div>'; $html .= ' <div class="nextend-mixed-group" style="clear: both;"> <div class="nextend-mixed-label"> <label for="link' . $i . '" id="link' . $i . '-lbl">Link</label> </div> <div class="nextend-mixed-element"> <div class="nextend-text"> <input type="text" autocomplete="off" style="width:390px;" value="' . $img['url'] . '" name="" id="link' . $i . '"> </div> </div> </div>'; $html .= ' <div class="nextend-mixed-group" style="clear: both;"> <div class="nextend-mixed-label"> <label for="description' . $i . '" id="description' . $i . '-lbl">Description</label> </div> <div class="nextend-mixed-element"> <div class="nextend-textarea "> <textarea autocomplete="off" style="width:400px; height: 40px;" name="" id="description' . $i . '">' . $img['description'] . '</textarea> </div> </div> </div>'; $html .= '</div><div style="clear:both;"></div></li>'; $i++; } } $html .= '</ul> <div style="clear: both;"></div> </div>' . parent::fetchElement(); if (nextendIsJoomla()) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $extension = $app->input->get('option'); $link = 'index.php?option=com_media&view=images&tmpl=component&e_name=&asset=' . $extension . '&author=' . $user->id; $html .= '<div style="margin: 0 -10px -5px;"><h2>Choose images</h2> <div class="blue-container"> <iframe frameborder="0" src="' . $link . '" id="image-chooser" width="100%" style="float: left; width: 100%;" height="0"></iframe> </div></div>'; } ob_start(); ?> <script type="text/html" id="image-form-skeleton"> <div class="field-container"> <div class="nextend-mixed-group"> <div class="nextend-mixed-label"> <label for="title'.$i.'" id="title'.$i.'-lbl">Title</label> </div> <div class="nextend-mixed-element"> <div class="nextend-text "> <input type="text" autocomplete="off" style="width:390px;" value="" name="" id="title'.$i.'"> </div> </div> </div> <div class="nextend-mixed-group" style="clear: both;"> <div class="nextend-mixed-label"> <label for="link'.$i.'" id="link'.$i.'-lbl">Link</label> </div> <div class="nextend-mixed-element"> <div class="nextend-text"> <input type="text" autocomplete="off" style="width:390px;" value="" name="" id="link'.$i.'"> </div> </div> </div> <div class="nextend-mixed-group" style="clear: both;"> <div class="nextend-mixed-label"> <label for="description'.$i.'" id="description'.$i.'-lbl">Description</label> </div> <div class="nextend-mixed-element"> <div class="nextend-textarea "> <textarea autocomplete="off" style="width:400px; height: 40px;" name="" id="description'.$i.'"></textarea> </div> </div> </div> </div> <div style="clear:both;"></div> </script> <script> njQuery(window).ready(function(){ var $ = njQuery, images = $('#selected-images'), deleteimage = $('#delete-image'), form = $('#smartslider-form'), skeleton = njQuery('#image-form-skeleton').html(), iii = 10000; function addImageToList(img){ var el = $('<li><img src="'+nextendFixRelative(img)+'" data-src="'+img+'" />'+skeleton.replace(/'\.\$i\.'/g, iii)+'</li>').appendTo(images); iii++; images.sortable( "refresh" ); $(window).trigger('resize'); return el; } <?php if (nextendIsJoomla()) { ?> var folder = "<?php echo JComponentHelper::getParams('com_media')->get('image_path', 'images') . '/'; ?> ", base_uri = "<?php echo NextendUri::getBaseUri(); ?> ", iframe = $('#image-chooser'), frame = $('#image-chooser'); frame.on('load', function(){ frame = $(this.contentWindow.document); frame.find('#imageframe').next('.well').remove(); frame.find('#imageframe').next('fieldset').remove(); frame.find('#imageframe').prev('fieldset').find('.fltrt').remove(); frame.find('#imageForm').find('.pull-right').remove(); frame.find('#upbutton').css('verticalAlign', 'top'); this.contentWindow.ImageManager.populateFields = function(file){ var uri = ''; if(window.nextendimageurl == 0) uri = base_uri; addImageToList(uri+folder+file); } frame.find('#system-message-container').css('paddingTop', '15px'); frame.find('body').css('overflow', 'hidden').css('padding', '0 15px'); iframe.css('height', frame.find('html').prop('scrollHeight')); $(window).trigger('resize'); }); <?php } elseif (nextendIsWordpress()) { ?> var file_frame; jQuery('#smartslider-admin .add-image').on('click', function(event){ event.preventDefault(); // If the media frame already exists, reopen it. if ( file_frame ) { file_frame.open(); return; } // Create the media frame. file_frame = wp.media.frames.file_frame = wp.media({ multiple: 'add', frame: 'post', library: {type: 'image'} }); // When an image is selected, run a callback. file_frame.on('insert', function(selection) { var state = file_frame.state(); selection = selection || state.get('selection'); if ( ! selection ) return; selection.map( function( attachment ) { var display = state.display( attachment ).toJSON(); attachment = attachment.toJSON(); var el = addImageToList(attachment.url); el.find('input[id^=title]').val(attachment.title); if(attachment.caption != '') el.find('textarea[id^=description]').val(attachment.caption); else if(attachment.description != '') el.find('textarea[id^=description]').val(attachment.description); if(typeof display !== 'undefined' && typeof display.linkUrl !== 'undefined') el.find('input[id^=link]').val(display.linkUrl); }); }); file_frame.open(); // Remove the Media Library tab (media_upload_tabs filter is broken in 3.6) jQuery(".media-menu a:contains('Media Library')").remove(); }); <?php } elseif (nextendIsMagento()) { ?> var magentohidden = document.getElementById('magentohidden'); Mediabrowser.prototype.insert = Mediabrowser.prototype.insert.wrap(function(parentMethod, event) { var div; if (event != undefined) { div = $(Event.findElement(event, 'DIV')); } else { $$('div.selected').each(function (e) { div = $('#'+e.id); }); } if (div.length == 0) { return false; } var targetEl = this.getTargetElement(); if (! targetEl) { alert("Target element not found for content update"); Windows.close('browser_window'); return; } div = div[0]; var params = {filename:div.id, node:this.currentNode.id, store:this.storeId}; if (targetEl.tagName.toLowerCase() == 'textarea') { params.as_is = 1; } new Ajax.Request(this.onInsertUrl, { parameters: params, onSuccess: function(transport) { try { this.onAjaxSuccess(transport); if (this.getMediaBrowserOpener()) { self.blur(); } Windows.close('browser_window'); if (targetEl.tagName.toLowerCase() == 'input') { targetEl.value = transport.responseText; // AntoineK overload START if (varienGlobalEvents) { varienGlobalEvents.fireEvent('mediachooserChange' + targetEl.id, transport.responseText); } // AntoineK overload END } else { updateElementAtCursor(targetEl, transport.responseText); if (varienGlobalEvents) { varienGlobalEvents.fireEvent('tinymceChange'); } } } catch (e) { alert(e.message); } }.bind(this) }); }); jQuery('#smartslider-admin .add-image').on('click', function(event){ event.preventDefault(); MediabrowserUtility.openDialog('<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/cms_wysiwyg_images_chooser/index', array('target_element_id' => 'magentohidden', 'store' => 'undefined', 'type' => 'image')); ?> '); }); varienGlobalEvents.attachEventHandler('mediachooserChangemagentohidden', function(url){ addImageToList(url); }); <?php } ?> $(document.body).css('overflow', 'auto'); images.sortable({ connectWith: deleteimage, placeholder: "ui-state-highlight", forcePlaceholderSize: true, appendTo: document.body, tolerance: 'pointer', handle: "img", over: function(){ $(window).trigger('resize'); }, out: function(){ $(window).trigger('resize'); } }); $(window).on('resize', function(){ deleteimage.height(images.height()); }); deleteimage.sortable({ tolerance: 'pointer', appendTo: document.body, over: function(){ deleteimage.addClass('over'); $(window).trigger('resize'); }, out: function(){ deleteimage.removeClass('over'); $(window).trigger('resize'); }, update: function(event, ui) { ui.item.remove(); $(window).trigger('resize'); } }); images.find('img').disableSelection(); form.on('submit', function(){ var data = {}, i = 0; images.find('img').each(function(){ data[i] = {}; data[i].image = $(this).data('src'); var cont = $(this).parent(); data[i].title = cont.find('input[id^=title]').val(); data[i].url = cont.find('input[id^=link]').val(); data[i].description = cont.find('textarea[id^=description]').val(); i++; }); $('#<?php echo $this->_id; ?> ').val(JSON.stringify(data)); }); }); </script> <?php $html .= ob_get_clean(); return $html; }
function joomlaAction() { if (nextendIsJoomla()) { $this->defaultAction('joomla'); } }
{ static $instance; if (!is_object($instance)) { $instance = new NextendUri(); } // if return $instance; } static function setBaseUri($uri) { $i = NextendUri::getInstance(); $i->_baseuri = $uri; } static function getBaseUri() { $i = NextendUri::getInstance(); return $i->_baseuri; } static function pathToUri($path) { $i = NextendUri::getInstance(); return $i->_baseuri . str_replace(array(NextendFilesystem::getBasePath(), DIRECTORY_SEPARATOR), array('', '/'), str_replace('/', DIRECTORY_SEPARATOR, $path)); } } if (nextendIsJoomla()) { nextendimport('nextend.uri.joomla'); } elseif (nextendIsWordPress()) { nextendimport('nextend.uri.wordpress'); } elseif (nextendIsMagento()) { nextendimport('nextend.uri.magento'); }
function render($cache = false) { if ($this->_norender) { return; } $this->preRender(); $id = $this->getId(); $data =& $this->_data; $this->addJs(); $jquery = NextendSmartSliderSettings::get('jquery', 1); if (!$jquery && !class_exists('NextendSmartsliderAdminController', false)) { $js = NextendJavascript::getInstance(); $js->_loadedLibraries['jquery']->removeJsLibraryFile('jQuery.js'); } if (isset($this->_slides[$this->_activeSlide])) { $this->_slides[$this->_activeSlide]['classes'] .= ' smart-slider-slide-active'; } $fadeonload = (array) NextendParse::parse($this->_sliderParams->get('fadeonload', '1|*|0')); if (!isset($fadeonload[1])) { $fadeonload[1] = 0; } else { if ($fadeonload[1]) { $fadeonload[0] = 1; } } $sliderClasses = !$this->_backend && $fadeonload[0] ? 'nextend-slider-fadeload ' : ''; $sliderClasses .= 'nextend-desktop '; $properties = $this->generateJSProperties(); $fontsize = (array) NextendParse::parse($this->_sliderParams->get('globalfontsize', '12|*|11|*|10')); if (!isset($fontsize[1])) { $fontsize[1] = 11; } if (intval($fontsize[1]) <= 0) { $fontsize[1] = $fontsize[0]; } if (!isset($fontsize[2])) { $fontsize[2] = 10; } if (intval($fontsize[2]) <= 0) { $fontsize[2] = $fontsize[1]; } $size = $this->addCSS(); $backgroundresize = $this->_sliderParams->get('backgroundresize', 0); if ($backgroundresize != '0') { $works = nextend_try_to_test_memory_limit(); if ($works) { $canvasWidth = $size[4]; $canvasHeight = $size[5]; $resizeremote = intval(NextendSmartSliderSettings::get('resizeremote', 0)); nextendimport('nextend.cache.image'); $imageCache = new NextendCacheImage(); for ($i = 0; $i < count($this->_slides); $i++) { $imageCache->setBackground(substr($this->_slides[$i]['background'], 0, 6)); $this->_slides[$i]['bg']['desktop'] = $imageCache->resizeImage($this->_slides[$i]['bg']['desktop'], $canvasWidth, $canvasHeight, $backgroundresize, $resizeremote); } } else { if (NextendSmartSliderSettings::get('debugmessages', 1)) { echo "It seems like the <a href='http://php.net/manual/en/ini.core.php#ini.memory-limit'>memory_limit</a> on the server is too low for the background resize. Please set it minimum 60M and reload the page! You can disable this message in <a href='http://www.nextendweb.com/wiki/smart-slider-documentation/global-settings/'>global configuration</a> 'Frontend debug message' option."; } } } $css = NextendCss::getInstance(); $widgets = new NextendSliderWidgets($this, $id); $items = new NextendSliderItems($id, $this, $this->_backend); ob_start(); if (!$this->_backend && $fadeonload[0]) { $css->addCssFile('div#' . $id . '.nextend-slider-fadeload{position: absolute; opacity: 0;}', $this->getId()); } include $this->_typePath . 'slider.php'; $slider = ob_get_clean(); if (!$this->_backend) { NextendPlugin::callPlugin('nextendslideritem', 'onNextendSliderRender', array(&$slider, $id)); $slider = preg_replace('/data-itemvalues=".*?"/', '', $slider); // Remove unnecessary attributes... $slider = preg_replace('/data-item=".*?"/', '', $slider); // Remove unnecessary attributes... $slider = preg_replace('/data-leave=""/', '', $slider); // Remove unnecessary attributes... $slider = preg_replace('/data-enter=""/', '', $slider); // Remove unnecessary attributes... $slider = preg_replace('/data-click=""/', '', $slider); // Remove unnecessary attributes... if ($cache == false) { if (nextendIsJoomla()) { if (version_compare(JVERSION, '1.6.0', 'ge')) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $article = new stdClass(); $article->text = $slider; $_p = array(); $dispatcher->trigger('onContentPrepare', array('com_smartslider2', &$article, &$_p, 0)); if (!empty($article->text)) { $slider = $article->text; } } } elseif (nextendIsWordPress()) { if (!function_exists('ss2_attr_shortcode')) { function ss2_attr_shortcode($matches) { return 'data-' . $matches[1] . '="' . str_replace('"', '"', do_shortcode(str_replace('"', '"', $matches[2]))) . '"'; } } $slider = preg_replace_callback("/data-(click|enter|leave)=\"(.*?)\"/", "ss2_attr_shortcode", $slider); $slider = do_shortcode($slider); } } } $slider = str_replace(array('{{id}}', 'nextend-smart-slider-0'), $this->getId(), $slider); if (!$this->_backend) { $translateurl = (array) NextendParse::parse(NextendSmartSliderSettings::get('translateurl', '')); if (isset($translateurl[0]) && isset($translateurl[1])) { $slider = str_replace($translateurl[0], $translateurl[1], $slider); } } $align = $this->_sliderParams->get('align', 'normal'); $responsive = (array) NextendParse::parse($this->_sliderParams->get('responsive', '0|*|0')); if ($responsive[1] != 1 && $align != 'normal') { switch ($align) { case 'left': echo "<div class='ss2-align' style='float:left;'>"; break; case 'center': echo "<div class='ss2-align' style='margin: 0 auto; max-width: " . $size[0] . "px;'>"; break; case 'right': echo "<div class='ss2-align' style='float:right;'>"; break; } $align = true; } else { echo "<div class='ss2-align'>"; } echo $this->parseSlider($slider); if ($align === true) { echo "</div><div style='clear:both;'></div>"; } else { echo "</div>"; } if (!$this->_backend && $fadeonload[0] && (isset($responsive[0]) && $responsive[0] || isset($responsive[1]) && $responsive[1])) { $works = nextend_try_to_test_memory_limit(); if ($works) { if ($size[0] + $size[3] > 0 && $size[1] > 0 && function_exists('imagecreatetruecolor')) { echo '<div id="' . $id . '-placeholder" >'; $im = imagecreatetruecolor($size[0] + $size[3], $size[1]); imagesavealpha($im, true); imagealphablending($im, false); $trans = imagecolorallocatealpha($im, 255, 0, 0, 127); imagefilledrectangle($im, 0, 0, $size[0] + $size[3], $size[1], $trans); ob_start(); imagepng($im); imagedestroy($im); $img = base64_encode(ob_get_clean()); echo '<img alt="" style="width:100%; max-width: ' . (intval($this->_sliderParams->get('simpleresponsivemaxwidth', 30000)) + $size[3]) . 'px;" src="data:image/png;base64,' . $img . '" />'; if ($size[2] > 0) { $im = imagecreatetruecolor($size[0] + $size[3], $size[2]); imagesavealpha($im, true); imagealphablending($im, false); $trans = imagecolorallocatealpha($im, 255, 0, 0, 127); imagefilledrectangle($im, 0, 0, $size[0] + $size[3], $size[2], $trans); ob_start(); imagepng($im); imagedestroy($im); $img = base64_encode(ob_get_clean()); echo '<img alt="" style="width:100%;" src="data:image/png;base64,' . $img . '" />'; } echo '</div>'; } else { $css->addCssFile('#' . $id . ' .nextend-slider-fadeload{position: relative !important;}', $this->getId()); } } else { if (NextendSmartSliderSettings::get('debugmessages', 1)) { echo "It seems like the <a href='http://php.net/manual/en/ini.core.php#ini.memory-limit'>memory_limit</a> on the server is too low for the fade on load feature. Please set it minimum 60M and reload the page! You can disable this message in <a href='http://www.nextendweb.com/wiki/smart-slider-documentation/global-settings/'>global configuration</a> 'Frontend debug message' option."; } } } else { $css->addCssFile('#' . $id . '.nextend-slider-fadeload{position: relative !important;}', $this->getId()); } NextendPlugin::callPlugin('nextendslider', 'onNextendSliderRenderAfter'); if (!$cache) { if (nextendIsWordPress()) { add_action('nextend_css', array($this, 'wpAddCSS')); } elseif (nextendIsMagento()) { Nextend_SmartSlider2_Model_Observer::$sliders[] = $this->getId(); } else { $css->generateCSS($this->getId()); } } }