function fetchElement() { $this->setfolder(); $files = NextendFilesystem::files($this->_folder); $this->_xml->addChild('option', NextendText::_('No_image'))->addAttribute('value', -1); for ($i = 0; $i < count($files); $i++) { $ext = pathinfo($files[$i], PATHINFO_EXTENSION); if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png') { $this->_xml->addChild('option', htmlspecialchars(ucfirst($files[$i])))->addAttribute('value', NextendFilesystem::toLinux(NextendFilesystem::pathToRelativePath($this->_folder . $files[$i]))); } } if (nextendIsWordPress()) { $wpfolder = get_template_directory() . '/' . NextendXmlGetAttribute($this->_xml, 'folder') . '/'; if (isset($_GET['nextendpath'])) { echo $wpfolder . "<br />"; } if (NextendFilesystem::existsFolder($wpfolder)) { $files = NextendFilesystem::files($wpfolder); for ($i = 0; $i < count($files); $i++) { $ext = pathinfo($files[$i], PATHINFO_EXTENSION); if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png') { $this->_xml->addChild('option', htmlspecialchars(ucfirst($files[$i])))->addAttribute('value', NextendFilesystem::toLinux(NextendFilesystem::pathToRelativePath($wpfolder . $files[$i]))); } } } } $css = NextendCss::getInstance(); $css->addCssLibraryFile('element/imagelist.css'); $html = "<div class='nextend-imagelist' style='" . NextendXmlGetAttribute($this->_xml, 'style') . "'>"; $html .= parent::fetchElement(); $html .= '</div>'; return $html; }
static function getInstance() { static $instance; if (!is_object($instance)) { $instance = new NextendJavascriptjQuery(); if (nextendIsWordPress()) { wp_enqueue_script('jquery'); } else { $instance->addJsLibraryFile('jQuery.js'); } $instance->addJsLibraryFile('uacss.js'); } return $instance; }
function fetchElement() { if (isset($_REQUEST['get'])) { $get = json_decode(get_magic_quotes_gpc() || nextendIsWordPress() ? stripslashes($_REQUEST['get']) : $_REQUEST['get'], true); if (isset($get['sliderid'])) { nextendimportsmartslider2('nextend.smartslider.settings'); NextendSmartSliderFontSettings::initAdminFonts(intval($get['sliderid'])); } } $this->_xml->addChild('option', 'None')->addAttribute('value', ''); if (isset($GLOBALS['nextendfontmatrix']) && count($GLOBALS['nextendfontmatrix'])) { foreach ($GLOBALS['nextendfontmatrix'] as $k => $v) { $this->_xml->addChild('option', $v)->addAttribute('value', $k); } } return parent::fetchElement(); }
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 problems() { $count = 0; if (nextendIsWordPress()) { $nextenderror = get_option('nextend_error'); if ($nextenderror !== false && is_array($nextenderror)) { if (isset($nextenderror['missinghead'])) { foreach ($nextenderror['missinghead'] as $url) { $count++; } } if (isset($nextenderror['missingfooter'])) { foreach ($nextenderror['missingfooter'] as $url) { $count++; } } } } return $count; }
function subform() { $response = array(); if (!isset($_POST['data'])) { echo json_encode(array('error' => 'Post not OK!')); exit; } if (get_magic_quotes_gpc() || nextendIsWordPress()) { $_POST['data'] = stripslashes($_POST['data']); } $data = json_decode($_POST['data'], true); $configurationXmlFile = rtrim(NextendFilesystem::getBasePath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $data['xml']; if (NextendFilesystem::fileexists($configurationXmlFile)) { nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); $css = NextendCSS::getInstance(); $js = NextendJavascript::getInstance(); $js->loadLibrary('dojo'); nextendimport('nextend.form.form'); $form = new NextendForm(); $form->loadArray($data['orig']); $form->loadArray(array($data['name'] => $data['value'])); $form->loadXMLFile($configurationXmlFile); ob_start(); $subform = $form->getSubform($data['tab'], $data['name']); $subform->initAjax($data['control_name']); echo $subform->renderForm(); echo "<style>"; echo $css->generateAjaxCSS($data['loadedCSS']); echo "</style>"; $scripts = $js->generateAjaxJs($data['loadedJSS']); $html = ob_get_clean(); $response = array('html' => $html, 'scripts' => $scripts); } else { $response = array('error' => 'Configuration file not found'); } echo json_encode($response); exit; }
{ 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 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; }
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 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()); } } }
function fixMagicQuotes() { static $run; if (!$run) { if (get_magic_quotes_gpc() || nextendIsWordPress()) { $_GET = self::stripslashes_r($_GET); $_POST = self::stripslashes_r($_POST); $_COOKIE = self::stripslashes_r($_COOKIE); $_REQUEST = self::stripslashes_r($_REQUEST); } $run = true; } }
/* # 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 exportSliderAsHTML($id) { global $zip, $nextendexport; $nextendexport = true; nextendimport('nextend.externals.zip_lib'); $zip = new NextendZipFile(); $slider = $this->getSlider($id); $title = preg_replace('/[^a-zA-Z0-9]/', '_', $slider['title']) . '.zip'; ob_start(); if (nextendIsJoomla()) { nextendimportsmartslider2('nextend.smartslider.joomla.slider'); $slider_obj = new NextendSliderJoomla(intval($id), intval($id), dirname(__FILE__)); } else { if (nextendIsWordPress()) { global $wp_version; $wp_version = '1.0.0'; // Fake it to load the jQuery nextendimportsmartslider2('nextend.smartslider.wordpress.slider'); $params = array(); nextendimportsmartslider2('nextend.smartslider.wordpress.slider'); $slider_obj = new NextendSliderWordpress(intval($id), $params, dirname(__FILE__)); } } $slider_obj->render(); $body = preg_replace('/<link rel="stylesheet" href=".*?" type="text\\/css" \\/>/', '', ob_get_clean()); ob_start(); $css = NextendCss::getInstance(); $csslines = NextendFilesystem::readFile(NextendFilesystem::absoluteURLToPath($css->generateCSS())) . "\n"; $csslines .= NextendFilesystem::readFile(NextendFilesystem::absoluteURLToPath($css->generateCSS($slider_obj->getId()))) . "\n"; 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 . ')'; } } $csslines = preg_replace_callback('/url\\((.*?)\\)/', 'ss2_css_image_replace', $csslines); $googlefonts = ''; if (class_exists('NextendFontsGoogle', false)) { $fonts = NextendFontsGoogle::getInstance(); $googlefonts = '<link rel="stylesheet" type="text/css" href="' . $fonts->getFontUrl() . '">' . "\n"; } $zip->addFile($csslines, 'style.css'); $js = NextendJavascript::getInstance(); $js->generateLibraryJs(); if (count($js->_jsFiles)) { foreach ($js->_jsFiles as $file) { if (substr($file, 0, 4) == 'http') { $file; } else { $js->_cache->addFile($file); } } } $js->_cache->addInline($js->_js); $jslines = NextendFilesystem::readFile(NextendFilesystem::absoluteURLToPath($js->_cache->getCache())) . "\n"; $zip->addFile($jslines, 'script.js'); $zip->addFile('<!DOCTYPE html> <html> <head> <title>' . $slider['title'] . '</title> ' . $googlefonts . '<link rel="stylesheet" type="text/css" href="style.css"> <script type="text/javascript" src="script.js"></script> </head> <body> <!-- Smart Slider 2 START --> ' . $body . ' <!-- Smart Slider 2 END --> </body> </html>', 'index.html'); ob_end_clean(); return array($title, $zip->file()); }