public function __construct($appType, $defaultParams) { $this->appType = $appType; $this->initLayout(); N2AssetsManager::getInstance(); $this->initialize(); }
public function subform($appType, $configurationXmlFile, $values, $control_name, $name) { if (N2Filesystem::fileexists($configurationXmlFile)) { N2Loader::import('libraries.form.form'); $form = new N2Form($appType); $form->loadArray($values); //$subformValue = array(); //$subformValue[N2Post::getVar('name')] = N2Post::getVar('value'); //$form->loadArray($subformValue); $form->loadXMLFile($configurationXmlFile); ob_end_clean(); // To clear the output of the platform ob_start(); $subform = $form->getSubFormAjax(N2Post::getVar('tab'), $name); $subform->initAjax($control_name); echo $subform->renderForm(); //echo N2AssetsManager::generateAjaxCSS(); $scripts = N2AssetsManager::generateAjaxJS(); $html = ob_get_clean(); $response = array('html' => $html, 'scripts' => $scripts); } else { $response = array('error' => 'Configuration file not found: ' . $configurationXmlFile); } return $response; }
function onAfterRender() { if (class_exists('JEventDispatcher', false)) { $dispatcher = JEventDispatcher::getInstance(); } else { $dispatcher = JDispatcher::getInstance(); } $dispatcher->trigger('onNextendBeforeCompileHead'); ob_start(); if (class_exists('N2AssetsManager')) { echo N2AssetsManager::getCSS(); echo N2AssetsManager::getJs(); } $head = ob_get_clean(); if ($head != '') { $application = JFactory::getApplication(); if (class_exists('JApplicationWeb') && method_exists($application, 'getBody')) { $body = $application->getBody(); $mode = 'JApplicationWeb'; } else { $body = JResponse::getBody(); $mode = 'JResponse'; } $body = preg_replace('/<\\/head>/', $head . '</head>', $body, 1); switch ($mode) { case 'JResponse': JResponse::setBody($body); break; default: $application->setBody($body); } } }
public function renderCachedSlider() { N2AssetsManager::createStack(); $content = array(); $content['html'] = $this->slider->render(); $assets = N2AssetsManager::removeStack(); if ($content['html'] === false) { return false; } $content['assets'] = $assets; return $content; }
public static function afterOutputEnd() { self::$nextend_wp_footer = true; if (defined('N2LIBRARY')) { ob_start(); do_action('nextend_css'); do_action('nextend_js'); if (class_exists('N2AssetsManager')) { echo N2AssetsManager::getCSS(); echo N2AssetsManager::getJs(); } self::$nextend_head = ob_get_clean(); } if (N2Settings::get('safemode') == 1) { echo self::$nextend_head; } return true; }
public static function frontend($force = false) { static $once; if ($once != null && !$force) { return; } $once = true; N2AssetsManager::getInstance(); N2JS::addInline('window.N2PRO=' . N2PRO . ';', true); N2JS::addInline('window.N2GSAP=' . N2GSAP . ';', true); N2JS::addInline('window.N2PLATFORM="' . N2Platform::getPlatform() . '";', true); N2JS::addInline('window.nextend={localization: {}, deferreds:[], loadScript: function(url){n2jQuery.ready(function () {nextend.deferreds.push(n2.ajax({url:url,dataType:"script",cache:true,error:function(){console.log(arguments)}}))})}, ready: function(cb){n2.when.apply(n2, nextend.deferreds).done(function(){cb.call(window,n2)})}};', true); N2JS::jQuery($force); N2JS::addFiles(N2LIBRARYASSETS . "/js", array('consts.js', 'class.js', 'base64.js', 'mobile-detect.js'), 'nextend-frontend'); N2JS::addFiles(N2LIBRARYASSETS . "/js/core/jquery", array("jquery.imagesloaded.js", "litebox.js", "jquery.universalpointer.js", "jquery.mousewheel.js", "EventBurrito.js"), "nextend-frontend"); N2JS::modernizr(); N2CSS::addFiles(N2LIBRARYASSETS . "/css", array('litebox.css'), 'nextend-frontend'); self::animation($force); N2Loader::import('libraries.fonts.fonts'); N2Plugin::callPlugin('fontservices', 'onFontManagerLoad', array($force)); }
public function __construct($app, $appTypePath) { parent::__construct($app, $appTypePath); N2AssetsManager::addCachedGroup('core'); N2AssetsManager::addCachedGroup('smartslider'); }
public function createHTML($isZIP = true) { $this->files = array(); ob_end_clean(); N2AssetsManager::createStack(); N2AssetsPredefined::frontend(true); ob_start(); N2Base::getApplication("smartslider")->getApplicationType('widget')->render(array("controller" => 'home', "action" => N2Platform::getPlatform(), "useRequest" => false), array($this->sliderId, 'Export as HTML')); $slidersModel = new N2SmartsliderSlidersModel(); $slider = $slidersModel->get($this->sliderId); $sliderHTML = ob_get_clean(); $headHTML = ''; $css = N2AssetsManager::getCSS(true); foreach ($css['url'] as $url) { $headHTML .= N2Html::style($url, true, array('media' => 'screen, print')) . "\n"; } array_unshift($css['files'], N2LIBRARYASSETS . '/normalize.css'); foreach ($css['files'] as $file) { $path = 'css/' . basename($file); $this->files[$path] = file_get_contents($file); $headHTML .= N2Html::style($path, true, array('media' => 'screen, print')) . "\n"; } if ($css['inline'] != '') { $headHTML .= N2Html::style($css['inline']) . "\n"; } $js = N2AssetsManager::getJs(true); if ($js['globalInline'] != '') { $headHTML .= N2Html::script($js['globalInline']) . "\n"; } foreach ($js['url'] as $url) { $headHTML .= N2Html::script($url, true) . "\n"; } foreach ($js['files'] as $file) { $path = 'js/' . basename($file); $this->files[$path] = file_get_contents($file); $headHTML .= N2Html::script($path, true) . "\n"; } if ($js['inline'] != '') { $headHTML .= N2Html::script($js['inline']) . "\n"; } $sliderHTML = preg_replace_callback('/(src|data-desktop|data-tablet|data-mobile)=["|\'](.*?)["|\']/i', array($this, 'replaceHTMLImage'), $sliderHTML); $sliderHTML = preg_replace_callback('/url\\(\\s*([\'"]|('))?(\\S*\\.(?:jpe?g|gif|png))([\'"]|('))?\\s*\\)[^;}]*?/i', array($this, 'replaceHTMLBGImage'), $sliderHTML); $sliderHTML = preg_replace_callback('/(n2-lightbox-urls)=["|\'](.*?)["|\']/i', array($this, 'replaceLightboxImages'), $sliderHTML); $headHTML = preg_replace_callback('/"([^"]*?\\.(jpg|png|gif|jpeg))"/i', array($this, 'replaceJSON'), $headHTML); $this->files['index.html'] = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge, chrome=1\">\n<title>" . $slider['title'] . "</title>\n" . $headHTML . "</head>\n<body>\n" . $sliderHTML . "</body>\n</html>"; if (!$isZIP) { return $this->files; } $zip = new N2ZipFile(); foreach ($this->files as $path => $content) { $zip->addFile($content, $path); } ob_end_clean(); header('Content-disposition: attachment; filename=' . preg_replace('/[^a-zA-Z0-9_-]/', '', $slider['title']) . '.zip'); header('Content-type: application/zip'); echo $zip->file(); n2_exit(true); }
public static function disableCacheAll() { self::$cacheAll = false; }