/** * Load common assets. * * @param boolean $inline Whether to load assets inline or load in header? * * @return void */ public static function loadAssets($inline = false) { // Define common stylesheets $stylesheets = array(); if (JSNVersion::isJoomlaCompatible('3.0')) { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css'; if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery.ui.1.9.0.ie.css'; } } else { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/bootstrap/css/bootstrap.min.css'; $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.custom.css'; if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) { $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.ie.css'; } } $stylesheets[] = JSN_URL_ASSETS . '/joomlashine/css/jsn-gui.css'; // Load stylesheets if (!$inline) { JSNHtmlAsset::addStyle($stylesheets); } else { foreach ($stylesheets as $stylesheet) { $html[] = '<link type="text/css" href="' . $stylesheet . '" rel="stylesheet" />'; } echo implode("\n", $html); } // Load scripts if (JSNVersion::isJoomlaCompatible('3.2')) { JSNHtmlAsset::addScript(JUri::root(true) . '/media/jui/js/jquery.min.js'); } }
/** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $template = JSNTemplateHelper::getInstance(); $onPositionClick = ''; $initFilter = ''; $displayNotice = $app->input->getInt('notice'); $bypassNotif = $app->input->getVar('bypassNotif', ''); // Get template author. $templateAuthor = $template->getAuthor(); JSNPositionsHelper::dispatchTemplateFramework($templateAuthor); $document->addStyleSheet(JSN_URL_ASSETS . '/joomlashine/css/jsn-positions.css'); if (JSNVersion::isJoomlaCompatible('3.0')) { $document->addScript(JURI::root(true) . '/media/jui/js/jquery.js'); } else { $document->addScript(JSN_URL_ASSETS . '/3rd-party/jquery/jquery-1.8.2.js'); } if (isset($this->filterEnabled) and $this->filterEnabled) { $document->addScript(JSN_URL_ASSETS . '/joomlashine/js/positions.filter.js'); $initFilter = 'changeposition = new JoomlaShine.jQuery.visualmodeFilter({});'; } if (isset($this->customScripts)) { $document->addScriptDeclaration(implode('\\n', $this->customScripts)); } $onPositionClick = isset($this->onPositionClickCallBack) ? implode('\\n', $this->onPositionClickCallBack) : ''; // Get JSN Template Framework version $db = JFactory::getDbo(); $q = $db->getQuery(true); $q->select('manifest_cache'); $q->from('#__extensions'); $q->where("element = 'jsntplframework'"); $q->where("type = 'plugin'", 'AND'); $q->where("folder = 'system'", 'AND'); $db->setQuery($q); // Load dependency installation status. $res = $db->loadObject(); $res = json_decode($res->manifest_cache); $jsnTplFwVersion = $res->version; $jsnTemplateCustomJs = ''; if (version_compare($jsnTplFwVersion, '2.0.1', '<=')) { $jsnTemplateCustomJs = "\$('body').addClass('jsn-bootstrap');"; } $_customScript = "\n\t\t\tvar changeposition;\n\t\t\t(function(\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\tvar posOutline\t= \$('.jsn-position');\n\t\t\t\t\tvar _idAlter\t= false;\n\t\t\t\t\tif (\$('.jsn-position').length == 0) {\n\t\t\t\t\t\tposOutline\t= \$('.mod-preview');\n\t\t\t\t\t\t_idAlter\t= true;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tposOutline.css({'z-index':'9999', 'position':'relative'});\n\t\t\t\t\t}\n\t\t\t\t\tposOutline.each(function(){\n\t\t\t\t\t\tif(_idAlter){\n\t\t\t\t\t\t\tpreviewInfo = \$(this).children('.mod-preview-info').text();\n\n\t\t\t\t\t\t\t_splitted = previewInfo.split('[');\n\t\t\t\t\t\t\tif(_splitted.length > 1){\n\t\t\t\t\t\t\t\tposname\t= _splitted[0];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t_splitted = posname.split(': ');\n\t\t\t\t\t\t\tif(_splitted.length > 1){\n\t\t\t\t\t\t\t\tposname\t= _splitted[1];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tposname = \$.trim(posname);\n\n\t\t\t\t\t\t\t\$(this).attr('id', posname + '-jsnposition');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\$(this)[0].oncontextmenu = function() {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.click(function () {\n\t\t\t\t\t\t" . $onPositionClick . "\n\t\t\t\t\t});\n\t\t\t\t\t" . $jsnTemplateCustomJs . "\n\t\t\t\t});\n\t\t\t\t" . $initFilter . "\n\t\t\t\t\n\t\t\t})(jQuery);\n\t\t"; $document->addScriptDeclaration($_customScript); $jsnrender = JSNPositionsRender::getInstance(); $jsnrender->renderPage(JURI::root() . 'index.php?poweradmin=1&vsm_changeposition=1&tp=1', 'changePosition'); $this->assignRef('jsnrender', $jsnrender); parent::display($tpl); }
/** * Load assets. * * @return void */ public static function addAssets($checkVersion = true) { // Load common assets $stylesheets = array(); $stylesheets[] = JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css'; $stylesheets[] = JURI::root(true) . '/plugins/system/jsnframework/assets/joomlashine/css/jsn-gui.css'; //$stylesheets[] = JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/font-awesome/css/font-awesome.css'; // Load proprietary assets // Load scripts if ($checkVersion && JSNVersion::isJoomlaCompatible('3.2')) { JSNHtmlAsset::addScript(JUri::root(true) . '/media/jui/js/jquery.min.js'); // $document = JFactory::getDocument(); //$document->addScript(JURI::root(true) . '/media/jui/js/jquery.min.js'); // JSNHtmlAsset::addScriptLibrary('jquery.ui', JSN_UNIFORM_ASSETS_URI . "/js/libs/jquery-ui-1.10.3.custom.min", array('jquery')); } $stylesheets[] = JURI::base(true) . '/components/com_uniform/assets/css/uniform.css'; JSNHtmlAsset::addStyle($stylesheets); }
/** * * This function to helper save configs for the component * * @param: (Number) ($componentId) is id of component in extension table * @param: (string) ($componentName) is name of component * @param: (Array) ($config) is array store key and value to save * @return: Save to the database table */ public static function extension($extension_name, $configs = array()) { // Import files used for Joomla 3.2 JSNFactory::import('plugins.system.jsnframework.libraries.joomlashine.version.version', 'site'); // Import files for Joomla 3.2 if (JSNVersion::isJoomlaCompatible('3.2')) { JSNFactory::import('components.com_config.model.cms', 'site'); JSNFactory::import('components.com_config.model.form', 'site'); } $extension_name = JString::strtolower(JString::trim($extension_name)); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select("params"); $query->from("#__extensions"); $query->where("name = " . $db->quote($extension_name)); $db->setQuery($query); $paramsString = $db->loadResult(); if (!empty($paramsString)) { $jParams = new JRegistry(); //$jParams = new JParameter(); $jParams->loadObject(json_decode($paramsString)); $params = $jParams->toArray(); foreach ($configs as $k => $val) { $params[$k] = (string) $val; } $query->clear(); $query->select("extension_id"); $query->from("#__extensions"); $query->where("name=" . $db->quote(JString::strtolower($extension_name))); $db->setQuery($query); $ext_id = $db->loadResult(); JSNFactory::import('components.com_config.model.component'); $config = new ConfigModelComponent(); $config->save(array('params' => $params, 'id' => $ext_id, 'option' => $extension_name)); return true; } return false; }
public function display($tpl = null) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); // Check if this view is used for module editing page. $moduleEdit = JRequest::getCmd('moduleedit', ''); $active_positions = array(); $model = $this->getModel('changeposition'); if (!$moduleEdit) { $moduleid = $app->getUserState('com_poweradmin.changeposition.moduleid'); } else { $moduleid = array(JRequest::getCmd('moduleid', '')); } for ($i = 0; $i < count($moduleid); $i++) { $active_positions[] = "\$('#" . $model->getModulePosition($moduleid[$i]) . "-jsnposition').addClass('active-position').attr('title', 'Active position');"; } JSNHtmlAsset::addScript(JURI::root(true) . '/media/jui/js/jquery.js'); JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.jquery.noconflict.js'); JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js'); //$document->addScript(JSN_POWERADMIN_LIB_JSNJS_URI. 'jsn.filter.visualmode.js'); //Enable position filter. $this->setFilterable(true); $customScript = "\n\t\t\tvar baseUrl = '" . JURI::root() . "';\n\t\t\tvar moduleid = new Array();\n\t\t\tmoduleid = [" . @implode(",", $moduleid) . "];\n\t\t\t(function (\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\t" . implode(PHP_EOL, $active_positions) . "\n\t\t\t\t});\n\t\t\t})(JoomlaShine.jQuery);\n \t\t"; $this->addCustomScripts($customScript); //Callback after position clicked. if (!$moduleEdit) { $onPostionClick = "\n \t\t\tif ( !\$(this).hasClass('active-position') ){\n\t\t\t\tJoomlaShine.jQuery.setPosition(moduleid, \$(this).attr('id').replace('-jsnposition', ''));\n \t\t\t\tparent.JoomlaShine.jQuery('.ui-dialog-content').dialog('close');\n \t\t\t}\n \t\t\t"; } else { $onPostionClick = "\n \t\t\tif ( !\$(this).hasClass('active-position') ){\n \t\t\t\tvar posName = \$(this).attr('id').replace('-jsnposition', '');\n \t\t\t\tparent.JoomlaShine.jQuery('#jform_position').val(posName);\n \t\t\t\tparent.modal.close();\n \t\t\t}\n \t\t\t"; } $this->addPositionClickCallBack($onPostionClick); $template = JSNTemplateHelper::getInstance(); $onPositionClick = ''; $initFilter = ''; $displayNotice = $app->input->getInt('notice'); $bypassNotif = $app->input->getVar('bypassNotif', ''); // Get template author. $templateAuthor = $template->getAuthor(); JSNPositionsHelper::dispatchTemplateFramework($templateAuthor); $document->addStyleSheet(JSN_URL_ASSETS . '/joomlashine/css/jsn-positions.css'); if (JSNVersion::isJoomlaCompatible('3.0')) { $document->addScript(JURI::root(true) . '/media/jui/js/jquery.js'); } else { $document->addScript(JSN_URL_ASSETS . '/3rd-party/jquery/jquery-1.8.2.js'); } if (isset($this->filterEnabled) and $this->filterEnabled) { $document->addScript(JSN_URL_ASSETS . '/joomlashine/js/positions.filter.js'); $initFilter = 'changeposition = new JoomlaShine.jQuery.visualmodeFilter({});'; } if (isset($this->customScripts)) { $document->addScriptDeclaration(implode('\\n', $this->customScripts)); } $onPositionClick = isset($this->onPositionClickCallBack) ? implode('\\n', $this->onPositionClickCallBack) : ''; // Get JSN Template Framework version $db = JFactory::getDbo(); $q = $db->getQuery(true); $q->select('manifest_cache'); $q->from('#__extensions'); $q->where("element = 'jsntplframework'"); $q->where("type = 'plugin'", 'AND'); $q->where("folder = 'system'", 'AND'); $db->setQuery($q); // Load dependency installation status. $res = $db->loadObject(); $res = json_decode($res->manifest_cache); $jsnTplFwVersion = $res->version; $jsnTemplateCustomJs = ''; if (version_compare($jsnTplFwVersion, '2.0.1', '<=')) { $jsnTemplateCustomJs = "\$('body').addClass('jsn-bootstrap');"; } $_customScript = "\n\t\t\tvar changeposition;\n\t\t\t(function(\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\tvar posOutline\t= \$('.jsn-position');\n\t\t\t\t\tvar _idAlter\t= false;\n\t\t\t\t\tif (\$('.jsn-position').length == 0) {\n\t\t\t\t\t\tposOutline\t= \$('.mod-preview');\n\t\t\t\t\t\t_idAlter\t= true;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tposOutline.css({'z-index':'9999', 'position':'relative'});\n\t\t\t\t\t}\n\t\t\t\t\tposOutline.each(function(){\n\t\t\t\t\t\tif(_idAlter){\n\t\t\t\t\t\t\tpreviewInfo = \$(this).children('.mod-preview-info').text();\n\n\t\t\t\t\t\t\t_splitted = previewInfo.split('[');\n\t\t\t\t\t\t\tif(_splitted.length > 1){\n\t\t\t\t\t\t\t\tposname\t= _splitted[0];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t_splitted = posname.split(': ');\n\t\t\t\t\t\t\tif(_splitted.length > 1){\n\t\t\t\t\t\t\t\tposname\t= _splitted[1];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tposname = \$.trim(posname);\n\n\t\t\t\t\t\t\t\$(this).attr('id', posname + '-jsnposition');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\$(this)[0].oncontextmenu = function() {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.click(function () {\n\t\t\t\t\t\t" . $onPositionClick . "\n\t\t\t\t\t});\n\t\t\t\t\t" . $jsnTemplateCustomJs . "\n\t\t\t\t});\n\t\t\t\t" . $initFilter . "\n\t\t\t\t\n\t\t\t})(jQuery);\n\t\t"; $document->addScriptDeclaration($_customScript); $previewModulePositionsIsEnabled = JComponentHelper::getParams('com_templates')->get('template_positions_display', 0); if (!$previewModulePositionsIsEnabled) { /** * Get config class */ JSNFactory::localimport('libraries.joomlashine.config'); JSNConfig::extension('com_templates', array('template_positions_display' => 1)); } $config = JFactory::getConfig(); $secret = $config->get('secret'); $jsnrender = JSNPositionsRender::getInstance(); $jsnrender->renderPage(JURI::root() . 'index.php?poweradmin=1&vsm_changeposition=1&tp=1&jsnpa_key=' . md5($secret), 'changePosition'); $this->jsnrender = $jsnrender; parent::display($tpl); }
<div class="jsn-page-update"> <div class="jsn-page-content jsn-rounded-large jsn-box-shadow-large jsn-bootstrap"> <span id="jsn-update-cancel"><a class="jsn-link-action" href="<?php echo JRoute::_('index.php?option=' . $input->getCmd('option')); ?> "> <?php echo JText::_('JCANCEL'); ?> </a></span> <h1><?php echo JText::sprintf('JSN_EXTFW_UPDATE_PAGE_HEAD', $name, $edition); ?> </h1> <?php if (!JSNVersion::isJoomlaCompatible(JSN_FRAMEWORK_REQUIRED_JOOMLA_VER) or !JSNVersion::checkCompatibility(JSNUtilsText::getConstant('IDENTIFIED_NAME'), JSNUtilsText::getConstant('VERSION'))) { // Show a message indicating user that their JoomlaShine product is no longer compatible with the installed JoomlaShine extension framework ?> <div class="alert alert-danger"><?php echo JText::_('JSN_EXTFW_GENERAL_INCOMPATIBLE_ALERT'); ?> </div> <?php } ?> <div id="jsn-update-action"> <p><?php echo JText::sprintf('JSN_EXTFW_UPDATE_PAGE_DESC', $name); ?> </p> <div class="alert alert-info">
<?php /** * @version $Id$ * @package JSN_Framework * @author JoomlaShine Team <*****@*****.**> * @copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. * @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html * * Websites: http://www.joomlashine.com * Technical Support: Feedback - http://www.joomlashine.com/contact-us/get-support.html */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); if (!class_exists('JSNBaseController')) { if (JSNVersion::isJoomlaCompatible('3.0') and class_exists('JControllerLegacy')) { return require_once dirname(__FILE__) . '/compat/controller_j30.php'; } if (JSNVersion::isJoomlaCompatible('2.5')) { return require_once dirname(__FILE__) . '/compat/controller_j25.php'; } }
$checkUpdate = true; } } // Load installer model for checking dependency require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php'; $model = new JSNMobilizeModelInstaller(); if (($result = $model->check($check, $checkUpdate)) !== -1) { $missingDependency = true; } if ($missingDependency) { // Redirect to dependency installer view $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer'); } // Check compatibility between component and installed Joomla version if (!JSNVersion::isJoomlaCompatible(JSN_MOBILIZE_REQUIRED_JOOMLA_VER)) { try { $result = JSNUpdateHelper::check(JSN_MOBILIZE_IDENTIFIED_NAME, JSN_MOBILIZE_REQUIRED_JOOMLA_VER); if ($result[JSN_MOBILIZE_IDENTIFIED_NAME]) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } else { $app->enqueueMessage(JText::_('JSN_MOBILIZE_NOT_COMPATIBLE_MSG')); } } catch (Exception $e) { $app->enqueueMessage(JText::_('JSN_MOBILIZE_NOT_COMPATIBLE_MSG')); } } // Check compatibility between component and the installed version of JoomlaShine extension framework if (!JSNVersion::checkCompatibility(JSN_MOBILIZE_IDENTIFIED_NAME, JSN_MOBILIZE_VERSION)) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function initToolbar() { $bar = JToolBar::getInstance('toolbar'); $edition = defined('JSN_MOBILIZE_EDITION') ? JSN_MOBILIZE_EDITION : "free"; if (strtolower($edition) == "free") { $dataListForm = JSNMobilizeHelper::getProfiles(); $countForm = 1 - count($dataListForm) > 0 ? 1 - count($dataListForm) : 0; $msg = JText::sprintf('JSN_MOBILIZE_YOU_HAVE_REACHED_THE_LIMITATION_OF_1_PROFILE_IN_FREE_EDITION', (int) $countForm) . ' <a class="jsn-link-action" href="index.php?option=com_mobilize&view=upgrade">' . JText::_("JSN_MOBILIZE_UPGRADE_EDITION") . '</a>'; if (count($dataListForm) < 1) { JToolBarHelper::addNew('profile.add', 'JTOOLBAR_NEW'); JFactory::getApplication()->enqueueMessage($msg); } else { $bar->appendButton('Custom', '<button class="btn btn-small btn-success disabled jsn-popup-upgrade" onclick="return false;"><i class="icon-new icon-white"></i>' . JText::_('JTOOLBAR_NEW') . '</button>'); $session = JFactory::getSession(); $seesionQueue = $session->get('application.queue'); if ($seesionQueue[0]['type'] != "error") { JError::raiseNotice(100, $msg); } } } else { JToolBarHelper::addNew('profile.add', 'JTOOLBAR_NEW'); } JToolBarHelper::editList('profile.edit', 'JTOOLBAR_EDIT'); !JSNVersion::isJoomlaCompatible('2.5') or JToolBarHelper::divider(); JToolBarHelper::publish('profiles.publish', 'JSN_MOBILIZE_PUBLISH', true); JToolBarHelper::unpublish('profiles.unpublish', 'JSN_MOBILIZE_UNPUBLISH', true); !JSNVersion::isJoomlaCompatible('2.5') or JToolBarHelper::divider(); JToolBarHelper::deleteList('JSN_MOBILIZE_CONFIRM_DELETE', 'profiles.delete', 'JTOOLBAR_DELETE'); !JSNVersion::isJoomlaCompatible('2.5') or JToolBarHelper::divider(); JSNMobilizeHelper::initToolbar('JSN_MOBILIZE_PROFILES_MANAGER', 'mobilize-profiles'); }
<link href="../../../../assets/3rd-party/bootstrap/css/bootstrap.min.css" rel="stylesheet" /> <link href="../../../../assets/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.custom.css" rel="stylesheet" /> <?php } ?> <link href="../../../../assets/3rd-party/jquery-layout/css/layout-default-latest.css" rel="stylesheet" /> <link href="../../../../assets/joomlashine/css/jsn-gui.css" rel="stylesheet" /> <!-- Load HTML5 elements support for IE6-8 --> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <?php if (JSNVersion::isJoomlaCompatible('3.0')) { ?> <script src="../../../../<?php echo JSNVersion::isJoomlaCompatible('3.2') ? 'assets/3rd-party/jquery/jquery.min.js' : '../../../media/jui/js/jquery.js'; ?> "></script> <script src="../../../../assets/3rd-party/jquery-ui/js/jquery-ui-1.9.0.custom.min.js"></script> <?php } else { ?> <script src="../../../../assets/3rd-party/jquery/jquery-1.7.1.min.js"></script> <script src="../../../../assets/3rd-party/jquery-ui/js/jquery-ui-1.8.16.custom.min.js"></script> <?php } ?> <script src="../../../../assets/3rd-party/jquery-layout/js/jquery.layout-latest.js"></script> <script src="../../../../assets/3rd-party/jquery-jstree/jquery.jstree.js"></script> <style type="text/css"> #jsn-media-directory-tree {
/** * Check if there is new update for installed JoomlaShine product. * * @return mixed */ private function checkUpdate() { // Initialize extensions to check for update $exts = JSNVersion::isJoomlaCompatible('3.1') ? array($this->option) : JSNVersion::$products; // Get Joomla version $joomlaVersion = new JVersion(); // Get list of JoomlaShine product need to be checked for new update $checks = $products = array(); foreach ($exts as $product) { // Instantiate JSN Config model self::$_app->input->set('option', $product); $model = new JSNConfigModel(); // Only continue if product is installed if (is_readable(JPATH_ROOT . '/administrator/components/' . $product . '/config.xml')) { // Get product configuration $cfg = JSNConfigHelper::get($product); if (!$cfg->get('config-table-not-exists') and !$cfg->get('live_update_checking', 0)) { if (time() - $cfg->get('live_update_last_check', 0) >= (int) $cfg->get('live_update_check_interval', 6) * 60 * 60) { // Store necessary data to config table $form = $model->getForm(array(), true, JPATH_ROOT . '/administrator/components/' . $product . '/config.xml'); $data = array('live_update_checking' => 1); try { $model->save($form, $data); // Store product for checking new update later file_exists($define = JPATH_ROOT . '/administrator/components/' . $product . '/' . substr($product, 4) . '.defines.php') or file_exists($define = JPATH_ROOT . '/administrator/components/' . $product . '/defines.' . substr($product, 4) . '.php') or file_exists($define = JPATH_ROOT . '/administrator/components/' . $product . '/defines.php') or $define = null; if (!empty($define)) { if ($product == 'com_imageshow' and !class_exists('JSNISFactory')) { // JSN ImageShow specific fix if (file_exists(JPATH_ROOT . '/administrator/components/com_imageshow/classes/jsn_is_factory.php')) { require_once JPATH_ROOT . '/administrator/components/com_imageshow/classes/jsn_is_factory.php'; } else { // Do nothing as this is a background process continue; } } require_once $define; $products[JSNUtilsText::getConstant('IDENTIFIED_NAME')] = $product; $checks[JSNUtilsText::getConstant('IDENTIFIED_NAME')] = JSNUtilsText::getConstant('VERSION', $product); } } catch (Exception $e) { // Do nothing as this is a background process continue; } } } } } // Check update for installed JoomlaShine product if (count($products)) { if ($checks = JSNUpdateHelper::check($checks, $joomlaVersion->RELEASE)) { // Get database object $db = JFactory::getDbo(); foreach ($checks as $id => &$result) { // Instantiate JSN Config model self::$_app->input->set('option', $products[$id]); $model = new JSNConfigModel(); // Get product configuration $cfg = JSNConfigHelper::get($products[$id]); // Decode last update info $last = is_string($last = $cfg->get('live_update_last_notified', '{"version":"0.0.0"}')) ? json_decode($last) : $last; if ($result and version_compare($result->version, $last->version, '>')) { // Get product details if ($info = JSNUtilsXml::loadManifestCache($products[$id])) { $name = 'JSN ' . preg_replace('/^JSN\\s*/i', '', $info->name) . (($edition = JSNUtilsText::getConstant('EDITION', $products[$id])) ? ' ' . $edition : ''); if (!JSNVersion::isJoomlaCompatible('3.1')) { // Get extension ID $q = $db->getQuery(true); $q->select('extension_id'); $q->from('#__extensions'); $q->where("element = '" . $products[$id] . "'"); $q->where("type = 'component'", 'AND'); $db->setQuery($q); $eid = $db->loadResult(); // Check if update is stored before $q = $db->getQuery(true); $q->select('version'); $q->from('#__updates'); $q->where("extension_id = '{$eid}'"); $db->setQuery($q); // Store update info to Joomla updates table if ($current = $db->loadResult()) { $q = $db->getQuery(true); $q->update('#__updates'); $q->set("version = '{$result->version}'"); $q->where("extension_id = '{$eid}'"); $q->where("version = '{$current}'", 'AND'); } else { $q = $db->getQuery(true); $q->insert('#__updates'); $q->columns('extension_id, name, element, type, version'); $q->values("{$eid}, '{$name}', '{$products[$id]}', 'component', '{$result->version}'"); } $db->setQuery($q); $db->execute(); } else { // Generate XML content for latest update $xml[] = '<?xml version="1.0" encoding="utf-8"?>'; $xml[] = '<extensionset name="JoomlaShine Extensions" description="JoomlaShine Extensions Updates">'; $xml[] = ' <extension name="' . $name . '" element="' . $products[$id] . '" type="component" client="administrator" version="' . $result->version . '" detailsurl="" />'; $xml[] = '</extensionset>'; // Write XML content to a local cache file JFile::write(JFactory::getConfig()->get('tmp_path') . '/' . str_replace('com_', 'jsn_', $products[$id]) . '_update.xml', implode("\n", $xml)); } if ($cfg->get('live_update_notification', 0)) { // Get super administrator account to notify about update available if (!isset($admins)) { // Get Joomla config $joomlaConfig = JFactory::getConfig(); // Build query to get super administrator account $q = $db->getQuery(true); $q->select('u.id, u.email'); $q->from('#__user_usergroup_map AS g'); $q->join('INNER', '#__users AS u ON g.user_id = u.id'); $q->where('g.group_id = 8'); $q->where('u.sendEmail = 1'); $q->where('u.block = 0'); $db->setQuery($q); try { if (!($admins = $db->loadObjectList())) { return; } } catch (Exception $e) { return; } } // Generate replacement $substitutions = array('__SITE_NAME__' => $joomlaConfig->get('sitename'), '__SITE_URL__' => JUri::root(), '__PRODUCT__' => $name, '__CURRENT__' => JSNUtilsText::getConstant('VERSION', $products[$id]), '__NEW__' => $result->version, '__LINK__' => JUri::root() . 'administrator/index.php?option=' . $products[$id] . '&view=update'); // Initialize email subject and message $subject = JText::_('JSN_EXTFW_UPDATE_NOTIFICATION_SUBJECT'); $message = JText::_('JSN_EXTFW_UPDATE_NOTIFICATION_MESSAGE'); foreach ($substitutions as $k => $v) { $subject = str_replace($k, $v, $subject); $message = str_replace($k, $v, $message); } foreach ($admins as $admin) { // Initialize mailer then send update notification email try { $mailer = JFactory::getMailer(); $mailer->setSender(array($joomlaConfig->get('mailfrom'), $joomlaConfig->get('fromname'))); $mailer->addRecipient($admin->email); $mailer->setSubject($subject); $mailer->setBody($message); $mailer->Send(); } catch (Exception $e) { return; } } } } } // Store last check update time $form = $model->getForm(array(), true, JPATH_ROOT . '/administrator/components/' . $products[$id] . '/config.xml'); $data = array('live_update_checking' => '0', 'live_update_last_check' => time()); if ($result) { // Store last version notified $data['live_update_last_notified'] = json_encode($result); } try { $model->save($form, $data); } catch (Exception $e) { // Do nothing as this is a background process continue; } } } } // Restore current option self::$_app->input->set('option', $this->option); // In Joomla! 3.1, return generated XML content about latest update if (JSNVersion::isJoomlaCompatible('3.1')) { if (isset($xml)) { return implode("\n", $xml); } elseif (is_readable($cache = JFactory::getConfig()->get('tmp_path') . '/' . str_replace('com_', 'jsn_', $this->option) . '_update.xml')) { return JFile::read($cache); } else { return '<?xml version="1.0" encoding="utf-8"?><extensionset />'; } } }
// Checking for dependency is necessary $checkUpdate = true; } // Load installer model for checking dependency require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php'; $model = new JSNEasySliderModelInstaller(); if (($result = $model->check($check, $checkUpdate)) !== -1) { $missingDependency = true; } if ($missingDependency) { // Redirect to dependency installer view $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer'); } // Check compatibility between component and installed Joomla version if (!JSNVersion::isJoomlaCompatible(JSN_EASYSLIDER_REQUIRED_JOOMLA_VER)) { try { $result = JSNUpdateHelper::check(JSN_EASYSLIDER_IDENTIFIED_NAME, JSN_EASYSLIDER_REQUIRED_JOOMLA_VER); if ($result[JSN_EASYSLIDER_IDENTIFIED_NAME]) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } else { $app->enqueueMessage(JText::_('JSN_EASYSLIDER_NOT_COMPATIBLE_MSG')); } } catch (Exception $e) { $app->enqueueMessage(JText::_('JSN_EASYSLIDER_NOT_COMPATIBLE_MSG')); } } // Check compatibility between component and the installed version of JoomlaShine extension framework if (!JSNVersion::checkCompatibility(JSN_EASYSLIDER_IDENTIFIED_NAME, JSN_EASYSLIDER_VERSION)) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } }
// Checking for dependency is necessary $checkUpdate = true; } // Load installer model for checking dependency require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php'; $model = new JSNPagebuilderModelInstaller(); if (($result = $model->check($check, $checkUpdate)) !== -1) { $missingDependency = true; } if ($missingDependency) { // Redirect to dependency installer view $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer'); } // Check compatibility between component and installed Joomla version if (!JSNVersion::isJoomlaCompatible('3.')) { try { $result = JSNUpdateHelper::check(JSN_PAGEBUILDER_IDENTIFIED_NAME, '3.0'); if ($result[JSN_PAGEBUILDER_IDENTIFIED_NAME]) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } else { $app->enqueueMessage(JText::_('JSN_PAGEBUILDER_NOT_COMPATIBLE_MSG')); } } catch (Exception $e) { $app->enqueueMessage(JText::_('JSN_PAGEBUILDER_NOT_COMPATIBLE_MSG')); } } // Check compatibility between component and the installed version of JoomlaShine extension framework if (!JSNVersion::checkCompatibility(JSN_PAGEBUILDER_IDENTIFIED_NAME, JSN_PAGEBUILDER_VERSION)) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } }
/** * Method to render list of root menu item. * * @param string $parent Dot separated parent menu item id, e.g. root.2nd_level.3rd_level, to get menu item from * * @return void */ public static function render($parent = 'jsnmenu') { // Instantiate a JSN Menu object $renderer = JSNVersion::isJoomlaCompatible('3.0') ? new JToolbarButtonJSNMenu() : new JButtonJSNMenu(); // Generate markup tag for sub-menu try { $html = $renderer->renderMenu($parent); } catch (Exception $e) { $html = ''; } if (JSNVersion::isJoomlaCompatible('3.0')) { echo $html; } else { // In Joomla 2.5, set the HTML as content for 'submenu' module position JFactory::getDocument()->setBuffer($html, array('type' => 'modules', 'name' => 'submenu')); } }
/** * Proceed positions rendering * * Remove default tp=1 layout, replace by jsn style to * show page positions * * @return void */ public function onAfterDispatch() { if (!JSNVersion::isJoomlaCompatible(JSN_FRAMEWORK_REQUIRED_JOOMLA_VER)) { return; } // Keep this for joomla 2.5. Will be deprecated. if (JSNVersion::isJoomlaCompatible('2.5') and !JSNVersion::isJoomlaCompatible('3.0')) { if (self::$_app->isAdmin() and self::$_app->input->getVar('format', '') != 'raw' and self::$_app->input->getVar('option', '') == 'com_poweradmin' and self::$_app->input->getVar('view') != 'update' and self::$_app->input->getVar('view') != 'changeposition') { $version = PoweradminHelper::getVersion(); if (version_compare($version, '1.1.3', '>=')) { $JSNMedia = JSNFactory::getMedia(); $JSNMedia->addMedia(); } } } if (self::$_app->input->getCmd('poweradmin', 0) == 1) { $jsnHelper = JSNPositionsModel::_getInstance(); $jsnHelper->renderEmptyComponent(); $jsnHelper->renderEmptyModule(); } }
require_once dirname(__FILE__) . '/libraries/joomlashine/base/controller.php'; // Initialize common assets require_once JPATH_COMPONENT_ADMINISTRATOR . '/bootstrap.php'; // Check if all dependency is installed require_once JPATH_COMPONENT_ADMINISTRATOR . '/dependency.php'; // Require base shorcode element // TODO: under included files will be packed in a loader class require_once dirname(__FILE__) . '/libraries/innotheme/shortcode/element.php'; require_once dirname(__FILE__) . '/libraries/innotheme/shortcode/parent.php'; require_once dirname(__FILE__) . '/libraries/innotheme/shortcode/child.php'; // Check if JoomlaShine extension framework is exists? if ($framework->extension_id) { // Autoload all helper classes. JSN_Loader::register(dirname(__FILE__), 'JSNPagebuilder'); // Autoload all shortcode JSN_Loader::register(dirname(__FILE__) . '/helpers/shortcode', 'JSNPBShortcode'); //JSN_Loader::register(JPATH_ROOT . '/plugins/pagebuilder/' , 'JSNPBShortcode'); //JSN_Loader::register(JPATH_ROOT . '/administrator/components/com_pagebuilder/elements/' , 'JSNPBShortcode'); JSN_Loader::register(JPATH_ROOT . '/plugins/jsnpagebuilder/defaultelements/', 'JSNPBShortcode'); // Store all PageBuilder's shortcode into an object. global $JSNPbElements; $JSNPbElements = new JSNPagebuilderHelpersElements(); } if (strpos('installer + update + upgrade', $input->getCmd('view')) !== false or JSNVersion::isJoomlaCompatible(JSN_PAGEBUILDER_REQUIRED_JOOMLA_VER)) { // Get the appropriate controller $controller = JSNBaseController::getInstance('JSNPagebuilder'); // Perform the request task $controller->execute($input->getCmd('task')); // Redirect if set by the controller $controller->redirect(); }
<?php echo JSNFormHelper::render($this->form); ?> <?php echo $this->loadTemplate('slider'); ?> <div id="jsn-modal"></div> <input type="hidden" name="slider_id" value="<?php echo isset($this->slider->slider_id) ? $this->slider->slider_id : ''; ?> " /> <input type="hidden" name="redirect_url" id="redirectUrl" value="" /> <?php if (JSNVersion::isJoomlaCompatible('2.5') and !JSNVersion::isJoomlaCompatible('3.0')) { ?> <input type="hidden" name="redirect_url_form" id="redirectUrlForm" value="" /> <input type="hidden" name="open_article" id="open-article" value="" /> <?php } ?> <input type="hidden" name="option" value="com_easyslider" /> <input type="hidden" name="view" value="slider" /> <input type="hidden" name="task" id="jsn-task" value="" /> <?php echo JHTML::_('form.token'); ?> <!--</form>--> </div>
// Checking for dependency is necessary $checkUpdate = true; } // Load installer model for checking dependency require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php'; $model = new JSNUniformModelInstaller(); if (($result = $model->check($check, $checkUpdate)) !== -1) { $missingDependency = true; } if ($missingDependency) { // Redirect to dependency installer view $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer'); } // Check compatibility between component and installed Joomla version if (!JSNVersion::isJoomlaCompatible(JSN_UNIFORM_REQUIRED_JOOMLA_VER)) { try { $result = JSNUpdateHelper::check(JSN_UNIFORM_IDENTIFIED_NAME, JSN_UNIFORM_REQUIRED_JOOMLA_VER); if ($result[JSN_UNIFORM_IDENTIFIED_NAME]) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } else { $app->enqueueMessage(JText::_('JSN_UNIFORM_NOT_COMPATIBLE_MSG'), 'error'); } } catch (Exception $e) { $app->enqueueMessage(JText::_('JSN_UNIFORM_NOT_COMPATIBLE_MSG'), 'error'); } } // Check compatibility between component and the installed version of JoomlaShine extension framework if (!JSNVersion::checkCompatibility(JSN_UNIFORM_IDENTIFIED_NAME, JSN_UNIFORM_VERSION)) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } }
define('JSN_TEMPLATE_CLASSES_OVERWRITE', JSN_PATH_FRAMEWORK . '/libraries/template/overwrites/'); // Define necessary variables. $baseUrl = JURI::base(true); $rootUrl = JURI::root(true); $application = JFactory::getApplication(); // Add base path that point to folder contains javascript files of the framework JSNHtmlAsset::addScriptPath('jsn', 'joomlashine/js'); // Prepare config foreach (JSNVersion::$products as $product) { JSNHtmlAsset::prepare($product, !$application->isSite()); } // Predefine script libraries if (JSNVersion::isJoomlaCompatible('3.2')) { JSNHtmlAsset::addScriptLibrary('jquery', '3rd-party/jquery/jquery.min.js'); } if (JSNVersion::isJoomlaCompatible('3.0')) { JSNHtmlAsset::addScriptLibrary('jquery.ui', '3rd-party/jquery-ui/js/jquery-ui-1.9.0.custom.min', array('jquery')); } else { JSNHtmlAsset::addScriptLibrary('jquery.ui', '3rd-party/jquery-ui/js/jquery-ui-1.8.16.custom.min', array('jquery')); } JSNHtmlAsset::addScriptLibrary('bootstrap', '3rd-party/bootstrap/js/bootstrap.min', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.cookie', '3rd-party/jquery-ck/jquery.ck', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.hotkeys', '3rd-party/jquery-hotkeys/jquery.hotkeys', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.jstorage', '3rd-party/jquery-jstorage/jquery.jstorage', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.jstree', '3rd-party/jquery-jstree/jquery.jstree', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.layout', '3rd-party/jquery-layout/js/jquery.layout-latest', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.tinyscrollbar', '3rd-party/jquery-tinyscrollbar/jquery.tinyscrollbar', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.topzindex', '3rd-party/jquery-topzindex/jquery.topzindex', array('jquery')); JSNHtmlAsset::addScriptLibrary('jquery.contextMenu', '3rd-party/jquery-contextMenu/jquery.contextMenu', array('jquery', 'jquery.ui')); JSNHtmlAsset::addScriptLibrary('jquery.daterangepicker', '3rd-party/jquery-daterangepicker/js/daterangepicker.jQuery.compressed', array('jquery', 'jquery.ui')); JSNHtmlAsset::addScriptLibrary('jquery.scrollto', '3rd-party/jquery-scrollto/jquery.scrollTo', array('jquery'));
/** * Setup toolbar. * * @return void */ protected function initToolbar() { $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::apply('profile.apply'); JToolBarHelper::save('profile.save'); JToolBarHelper::cancel('profile.cancel', 'JSN_MOBILIZE_CLOSE'); !JSNVersion::isJoomlaCompatible('2.5') or JToolBarHelper::divider(); JSNMobilizeHelper::initToolbar('JSN_MOBILIZE_PROFILE_PAGETITLE', 'mobilize-profiles', false); }
/** * Communicate with JoomlaShine server for latest product version. * * If a product does not have sub-product, the <b>$products</b> parameter * does not required when calling this method: * * <pre>JSNUpdateHelper::check();</pre> * * Result will be returned in the following format: * * <pre>If product update is available: * <code>array( * 'identified_name' => object( * 'name' => 'The product name', * 'identified_name' => 'The product identification', * 'description' => 'The product description', * 'version' => 'The latest product version', * 'authentication' => 'Indicates whether authentication is required when updating product' * ) * )</code> * If the product does not have update: * <code>array( * 'identified_name' => false * )</code></pre> * * If a product has sub-product, this method need to be called as below to * check all sub-product for latest version: * * <pre>JSNUpdateHelper::check( * array( * // Core component * 'imageshow' => '4.2.0', * * // Themes * 'themeclassic' => '1.1.5', * 'themeslider' => '1.0.4', * 'themegrid' => '1.0.0', * * // Sources * 'picasa' => '1.1.2', * 'flickr' => '1.1.2', * 'phoca' => '1.0.1', * 'joomgallery' => '1.0.1', * 'rsgallery2' => '1.0.1', * 'facebook' => '1.0.1' * ) * );</pre> * * In this case, the returned result might look like below: * * <pre>array( * // Core component * 'imageshow' => object( * 'name' => 'JSN ImageShow', * 'identified_name' => 'imageshow', * 'description' => 'Something about JSN ImageShow', * 'version' => '4.3.0', * 'editions' => array( * 0 => object( * 'edition' => 'PRO STANDARD', * 'authentication' => 1 * ), * 1 => object( * 'edition' => 'PRO UNLIMITED', * 'authentication' => 1 * ), * 2 => object( * 'edition' => 'FREE', * 'authentication' => 0 * ) * ) * ), * * // Themes * 'themeclassic' => false, // Product update not available * 'themeslider' => false, // Product update not available * 'themegrid' => object( * 'name' => 'Theme Grid', * 'identified_name' => 'themegrid', * 'description' => 'JSN ImageShow Theme Grid plugin', * 'version' => '1.0.1', * 'edition' => 'FREE', * 'authentication' => 0 * ), * * // Sources * 'picasa' => false, // Product update not available * 'flickr' => false, // Product update not available * 'phoca' => false, // Product update not available * 'joomgallery' => false, // Product update not available * 'rsgallery2' => false, // Product update not available * 'facebook' => object( * 'name' => 'FaceBook', * 'identified_name' => 'facebook', * 'description' => 'JSN ImageShow Image Source Facebook plugin', * 'version' => '1.0.2', * 'edition' => 'FREE', * 'authentication' => 0 * ) * )</pre> * * @param array $products Array of identified name for checking latest version. * @param string $requiredJoomlaVersion Joomla version required by extension, e.g. 2.5, 3.0, etc. * @param array $latestUpdates Latest update response (for use in self recursive call only). * @param array $results Check update results (for use in self recursive call only). * * @return mixed */ public static function check($products = array(), $requiredJoomlaVersion = JSN_FRAMEWORK_REQUIRED_JOOMLA_VER, $latestUpdates = '', $results = '') { // Only communicate with server if check update URLs is not load before if (empty($latestUpdates)) { if (!isset(self::$versions)) { try { // Get Joomla config and input object $config = JFactory::getConfig(); $input = JFactory::getApplication()->input; // Generate cache file path $cache = $config->get('tmp_path') . '/JoomlaShineUpdates.json'; // Get current option and view $option = $input->getCmd('option'); $view = $input->getCmd('view'); // Get latest version from local file if not in about page or cache is not timed out if ((!in_array($option, JSNVersion::$products) or $view != 'about') and is_readable($cache) and time() - filemtime($cache) < CHECK_UPDATE_PERIOD) { // Decode JSON encoded update details self::$versions = json_decode(JFile::read($cache)); } else { // Always update cache file modification time is_writable($cache) and touch($cache, time()); // Communicate with JoomlaShine server via latest version checking URL try { self::$versions = JSNUtilsHttp::get(JSN_EXT_VERSION_CHECK_URL); self::$versions = isset(self::$versions['body']) ? self::$versions['body'] : '{"items":[]}'; // Cache latest version to local file system JFile::write($cache, self::$versions); // Decode JSON encoded update details self::$versions = json_decode(self::$versions); } catch (Exception $e) { throw $e; } } } catch (Exception $e) { throw new Exception(JText::_('JSN_EXTFW_VERSION_CHECK_FAIL')); } } $latestUpdates = self::$versions; } // Prepare product identification if (!is_array($products) or !count($products)) { is_array($products) or $products = array(); // Get the product info $version = JSNUtilsText::getConstant('VERSION'); // Is identified name defined? if ($const = JSNUtilsText::getConstant('IDENTIFIED_NAME')) { $products[$const] = $version; } else { $component = substr(JFactory::getApplication()->input->getCmd('option'), 4); $products[$component] = $version; $products['ext_' . $component] = $version; } } // Get Joomla version $joomlaVersion = new JVersion(); // Preset return results is_array($results) or $results = array(); // Get the latest product version foreach ($products as $product => $current) { if (!isset($results[$product])) { foreach ($latestUpdates->items as $item) { if (isset($item->items)) { $results = self::check(array($product => $current), $requiredJoomlaVersion, $item, $results); continue; } if (isset($item->identified_name) and $item->identified_name == $product) { $results[$product] = $item; break; } } // Does latest product info found? if (isset($results[$product]) and is_object($results[$product])) { // Does product support installed Joomla version? $tags = explode(';', $results[$product]->tags); if (!in_array($joomlaVersion->RELEASE, $tags)) { $results[$product] = false; } // Does product upgradable? if ($results[$product] and !empty($requiredJoomlaVersion) and !JSNVersion::isJoomlaCompatible($requiredJoomlaVersion) and !version_compare($results[$product]->version, $current, '>=')) { $results[$product] = false; } // Does product have newer version? if ($results[$product] and (empty($requiredJoomlaVersion) or JSNVersion::isJoomlaCompatible($requiredJoomlaVersion)) and !version_compare($results[$product]->version, $current, '>')) { $results[$product] = false; } } } } return $results; }
/** * Load assets * * @return void */ public static function loadAssets($checkVersion = true) { // Load common assets $stylesheets[] = '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'; $stylesheets[] = JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css'; $stylesheets[] = JURI::root(true) . '/plugins/system/jsnframework/assets/joomlashine/css/jsn-gui.css'; $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-tipsy/tipsy.css'; $stylesheets[] = JURI::base(true) . '/components/com_mobilize/assets/css/mobilize.css'; if ($checkVersion && JSNVersion::isJoomlaCompatible('3.2')) { JSNHtmlAsset::addScript(JUri::root(true) . '/media/jui/js/jquery.min.js'); } JSNHtmlAsset::addStyle($stylesheets); }
require_once dirname(__FILE__) . '/libraries/joomlashine/base/view.php'; require_once dirname(__FILE__) . '/libraries/joomlashine/base/controller.php'; // Import joomla controller library jimport('joomla.application.component.controller'); // Get application object $app = JFactory::getApplication(); $input = $app->input; $tmpl = $input->getCmd('tmpl'); $task = $input->getCmd('task'); $isControllerExecutable = true; if (!($tmpl === 'component' || $task)) { // Check if all dependency is installed require_once JPATH_COMPONENT_ADMINISTRATOR . '/dependency.php'; // Require helper file JLoader::register('PowerAdminHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/poweradmin.php'); !(class_exists('JSNUtilsLanguage') && method_exists(new JSNUtilsLanguage(), 'loadDefault')); if (strpos('installer + update + upgrade', $input->getCmd('view')) !== false or JSNVersion::isJoomlaCompatible('3.')) { $isControllerExecutable = true; } else { $isControllerExecutable = false; } } if ($isControllerExecutable) { // Get the appropriate controller $controller = JSNBaseController::getInstance('Poweradmin'); $controller = new $controller(); // Perform the request task $controller->execute($input->getCmd('task')); // Redirect if set by the controller $controller->redirect(); }
/** * Add declaration code of assets to header of webpage. * * @return void */ public static function buildHeader() { if (!self::$_hasModules && !preg_match('/<script([^>]*)>\\s*require\\(([^<]+)<\\/script>/i', JResponse::getBody())) { return ''; } $application = JFactory::getApplication(); $document = JFactory::getDocument(); $component = preg_replace('/^com_/i', '', is_object($application->input) ? $application->input->getCmd('option') : ''); $version = self::_getExtensionVersion(is_object($application->input) ? $application->input->getCmd('option') : ''); $baseUrl = JURI::base(); $rootUrl = JURI::root(); // Auto define path for component's modules self::addScriptPath($component, $baseUrl . '/components/com_' . $component . '/assets/js'); self::addScriptPath($component . '/3rd', $baseUrl . '/components/com_' . $component . '/assets/3rd-party'); // Common configuration $env = array('rootUrl' => $rootUrl, 'baseUrl' => $baseUrl, 'version' => $version); if (JSNVersion::isJoomlaCompatible('2.5') and !JSNVersion::isJoomlaCompatible('3.0')) { $jquery = "JSNFrameworkUrl + '/3rd-party/jquery/jquery-1.7.1.min.js'"; } elseif (JSNVersion::isJoomlaCompatible('3.2')) { $jquery = "JSNEnv.rootUrl + '/plugins/system/jsnframework/3rd-party/jquery/jquery.min.js'"; } else { $jquery = "JSNEnv.rootUrl + '/media/jui/js/jquery.min.js'"; } $paths = json_encode(self::$_paths); $depends = json_encode(self::$_dependencies); $modules = json_encode(self::$_scriptModules); $language = json_encode(JSNUtilsLanguage::getTranslated(array('JSN_EXTFW_GENERAL_LOADING', 'JSN_EXTFW_GENERAL_CLOSE'))); $html = "\n\t\t\t<script type=\"text/javascript\" src=\"" . JSN_URL_ASSETS . "/3rd-party/requirejs/require.js\"></script>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t// JoomlaShine script configuration\n\t\t\t\tvar JSNEnv = " . json_encode($env) . ";\n\t\t\t\tvar JSNFrameworkUrl = JSNEnv.rootUrl + '/plugins/system/jsnframework/assets';\n\t\t\t\tvar JSNModules = {$modules};\n\t\t\t\tvar JSNLoadedModules = {};\n\t\t\t\tvar JSNCoreLanguage = {$language};\n\n\t\t\t\trequire.config({\n\t\t\t\t\turlArgs: 'v=' + JSNEnv.version,\n\t\t\t\t\tbaseUrl: JSNFrameworkUrl,\n\t\t\t\t\tpaths: {$paths},\n\t\t\t\t\tshim: {$depends},\n\t\t\t\t\twaitSeconds: 500\n\t\t\t\t});\n\n\t\t\t\tdefine('jquery', ((!window.JoomlaShine || (window.JoomlaShine && !window.JoomlaShine.jQuery)) && !window.jQuery) ? [{$jquery}] : [], function () {\n\t\t\t\t\t(JoomlaShine = window.JoomlaShine || {});\n\t\t\t\t\t(!JoomlaShine.jQuery || (jQuery = JoomlaShine.jQuery));\n\n\t\t\t\t\treturn jQuery.noConflict();\n\t\t\t\t});\n\n\t\t\t\tif (typeof(JSNModules) != 'undefined') {\n\t\t\t\t\t(JoomlaShine = window.JoomlaShine || {});\n\t\t\t\t\t(!window.jQuery || (JoomlaShine.jQueryBackup = jQuery));\n\t\t\t\t\t(!JoomlaShine.jQuery || (jQuery = JoomlaShine.jQuery));\n\n\t\t\t\t\tfor (key in JSNModules) {\n\t\t\t\t\t\t!function (module, params) {\n\t\t\t\t\t\t\trequire([module], function (Object) {\n\t\t\t\t\t\t\t\tif (typeof(Object) == 'function')\n\t\t\t\t\t\t\t\t\tJSNLoadedModules[module] = new Object(params);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t(JSNModules[key].module, JSNModules[key].params);\n\t\t\t\t\t}\n\n\t\t\t\t\t(!window.jQuery || (JoomlaShine.jQuery = jQuery));\n\t\t\t\t\t(!JoomlaShine.jQueryBackup || (jQuery = JoomlaShine.jQueryBackup));\n\t\t\t\t}\n\t\t\t</script>"; return $html; }
} } /******************************* JSN IMAGESHOW ***************************************/ // Load installer model for checking dependency require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php'; $model = new ImageShowModelInstaller(); if (($result = $model->check($check, $checkUpdate)) !== -1) { $missingDependency = true; } if ($missingDependency) { // Redirect to dependency installer view $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer'); } // Check compatibility between component and installed Joomla version if (!JSNVersion::isJoomlaCompatible('3.')) { try { $result = JSNUpdateHelper::check(JSN_IMAGESHOW_IDENTIFIED_NAME, '3.0'); if ($result[JSN_IMAGESHOW_IDENTIFIED_NAME]) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } else { $app->enqueueMessage(JText::_('JSN_IMAGESHOW_NOT_COMPATIBLE_MSG')); } } catch (Exception $e) { $app->enqueueMessage(JText::_('JSN_IMAGESHOW_NOT_COMPATIBLE_MSG')); } } // Check compatibility between component and the installed version of JoomlaShine extension framework if (!JSNVersion::checkCompatibility(JSN_IMAGESHOW_IDENTIFIED_NAME, JSN_IMAGESHOW_VERSION)) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } }
// Checking for dependency is necessary $checkUpdate = true; } // Load installer model for checking dependency require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php'; $model = new PoweradminModelInstaller(); if (($result = $model->check($check, $checkUpdate)) !== -1) { $missingDependency = true; } if ($missingDependency) { // Redirect to dependency installer view $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer'); } // Check compatibility between component and installed Joomla version if (!JSNVersion::isJoomlaCompatible('3.')) { try { $result = JSNUpdateHelper::check(JSN_POWERADMIN_IDENTIFIED_NAME, '3.0'); if ($result[JSN_POWERADMIN_IDENTIFIED_NAME]) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } else { $app->enqueueMessage(JText::_('JSN_POWERADMIN_NOT_COMPATIBLE_MSG')); } } catch (Exception $e) { $app->enqueueMessage(JText::_('JSN_POWERADMIN_NOT_COMPATIBLE_MSG')); } } // Check compatibility between component and the installed version of JoomlaShine extension framework if (!JSNVersion::checkCompatibility(JSN_POWERADMIN_IDENTIFIED_NAME, JSN_POWERADMIN_VERSION)) { $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update'); } }