function generateCSS() { if (class_exists('NextendFontsGoogle')) { $fonts = NextendFontsGoogle::getInstance(); $fonts->generateFonts(); } if (count($this->_cssFiles)) { foreach ($this->_cssFiles as $file) { if (is_array($file)) { // LESS $this->_lesscache->addContext($file[1], $file[2]); } else { if (substr($file, 0, 4) == 'http') { $this->serveCSSFile($file); } else { if ($this->_cacheenabled) { $this->_cache->addFile($file); } else { $url = NextendFilesystem::pathToAbsoluteURL($file); $this->serveCSSFile($url); } } } } } if ($this->_cacheenabled) { if ($this->_lesscache) { $this->_cache->addFile(NextendFilesystem::absoluteURLToPath($this->_lesscache->getCache())); } $this->serveCSSFile($this->_cache->getCache()); } else { if ($this->_lesscache) { $this->serveCSSFile($this->_lesscache->getCache()); } } $this->serveCSS(); }
nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); $css = NextendCss::getInstance(); if (nextendIsJoomla()) { $css->addCssFile(NEXTEND_SMART_SLIDER2_ASSETS . 'admin/css/joomlaclear.css'); } $css->addCssFile(NEXTEND_SMART_SLIDER2_ASSETS . 'admin/css/common.css'); $css->addCssFile(NEXTEND_SMART_SLIDER2_ASSETS . 'admin/css/icons.css'); $css->addCssFile(NEXTEND_SMART_SLIDER2_ASSETS . 'admin/css/header.css'); $css->addCssFile(NEXTEND_SMART_SLIDER2_ASSETS . 'admin/css/toolbar.css'); nextendimport('nextend.form.form'); NextendForm::loadQtip(); $js = NextendJavascript::getInstance(); $js->loadLibrary('jquery'); nextendimport('nextend.fonts.google'); $fonts = NextendFontsGoogle::getInstance(); $fonts->addFont('Open Sans'); $fonts->addFont('Open Sans', 600); $fonts->addFont('Open Sans', 700); ?> <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">
function render() { $data = array('css' => '', 'js' => array(), 'fonts' => array(), 'html' => ''); $this->css = $css = NextendCss::getInstance(); $tmpCSScacheTime = $css->_cache->_cacheTime; $css->_cache->_cacheTime = 'static'; $cssFiles = $css->_cssFiles; $css->_cssFiles = array(); $js = NextendJavascript::getInstance(); $jsFiles = array(); $jsFiles['core'] = $js->_jsFiles; $js->_jsFiles = array(); $jsFiles['libraries'] = array(); foreach ($js->_loadedLibraries as $k => $v) { $jsFiles['libraries'][$k] = array(); $jsFiles['libraries'][$k]['jsfiles'] = $v->_jsFiles; $jsFiles['libraries'][$k]['js'] = $v->_js; $js->_loadedLibraries[$k]->_jsFiles = array(); $js->_loadedLibraries[$k]->_js = ''; } $google = NextendFontsGoogle::getInstance(); $fonts = $google->_fonts; $google->_fonts = array(); ob_start(); $this->slider->render(true); $this->id = $this->slider->getId(); $data['html'] = preg_replace_callback('/<style.*?>(.*?)<\\/style>/s', array($this, 'inlineCSS'), ob_get_clean()); $data['fonts'] = $google->_fonts; $google->_fonts = $fonts; $extracssfiles = $css->_cssFiles; $css->_cssFiles = $cssFiles; foreach ($extracssfiles as $f) { $css->addCssFile($f, $this->id); } $css->_cacheGroup[$this->id]->_cacheTime = 'static'; $data['css'] = $css->generateCSS($this->id, false); $css->_cache->_cacheTime = $tmpCSScacheTime; $data['js']['core'] = $js->_jsFiles; $js->_jsFiles = $jsFiles['core']; foreach ($js->_loadedLibraries as $k => $v) { $data['libraries'][$k]['jsfiles'] = $v->_jsFiles; $data['libraries'][$k]['js'] = $v->_js; if (isset($jsFiles['libraries'][$k])) { $js->_loadedLibraries[$k]->_jsFiles = $jsFiles['libraries'][$k]['jsfiles']; $js->_loadedLibraries[$k]->_js = $jsFiles['libraries'][$k]['js']; } } return $data; }
function decorateFormEnd() { echo "</div>"; $fonts = NextendFontsGoogle::getInstance(); $fonts->addFont('Open Sans'); $fonts->addFont('Open Sans', 600); $fonts->addFont('Open Sans', 700); }
function decorateFormEnd() { echo "</div>"; $fonts = NextendFontsGoogle::getInstance(); $fonts->addFont('Montserrat'); }
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()); }
function generateCSS($group = null, $serve = true) { if (!$group && class_exists('NextendFontsGoogle', false)) { $fonts = NextendFontsGoogle::getInstance(); $fonts->generateFonts(); } $cssfiles = !$group ? $this->_cssFiles : (isset($this->_cssFilesGroup[$group]) ? $this->_cssFilesGroup[$group] : null); if (!$cssfiles) { return ''; } $cache = !$group ? $this->_cache : $this->_cacheGroup[$group]; $lesscache = !$group ? $this->_lesscache : $this->_lesscacheGroup[$group]; if (count($cssfiles)) { foreach ($cssfiles as $file) { if (is_array($file)) { // LESS $lesscache->addContext($file[1], $file[2]); } else { if (substr($file, 0, 4) == 'http') { $this->serveCSSFile($file); } else { if (NextendFilesystem::safefileexists($file)) { if ($this->_cacheenabled) { $cache->addFile($file); } else { $url = NextendFilesystem::pathToAbsoluteURL($file); $this->serveCSSFile($url); } } else { if ($this->_cacheenabled) { $cache->addText($file); } else { $this->addCss($file, $group); } } } } } } $filename = null; if ($this->_cacheenabled) { if ($lesscache) { $filename = $lesscache->getCache(); if ($filename) { $cache->addFile(NextendFilesystem::absoluteURLToPath($filename)); } } $filename = $cache->getCache(); if ($serve && $filename) { $this->serveCSSFile($filename); } } else { if ($lesscache) { $filename = $lesscache->getCache(); if ($serve && $filename) { $this->serveCSSFile($filename); } } } $this->serveCSS(true, $group); return $filename; }
function loadFont($families) { preg_match_all("/google\\(.*?family=(.*?)\\);\\)/", $families, $out, PREG_SET_ORDER); foreach ($out as $f) { nextendimport('nextend.fonts.google'); $fonts = NextendFontsGoogle::getInstance(); preg_match('/(.*?)(:(.*?))?(&subset=(.*))?$/', $f[1], $g); $family = str_replace('+', ' ', $g[1]); $style = 400; if (isset($g[3]) && !empty($g[3])) { $style = $g[3]; } $subset = 'latin'; if (isset($g[5])) { $subset = $g[5]; } $fonts->addFont($family, $style, $subset); $families = str_replace($f[0], "'" . $family . "'", $families); } return $families; }