/** * Method to get the field input markup for a generic list. * Use the multiple attribute to enable multiselect. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $request = JFactory::getApplication()->input; if (class_exists('JModelLegacy')) { $templateModel = JModelLegacy::getInstance('Style', 'TemplatesModel'); } else { $templateModel = JModel::getInstance('Style', 'TemplatesModel'); } $templateData = $templateModel->getItem($request->getInt('id')); $templateXml = JSNTplHelper::getManifest($templateData->template); $mobileMenuIconType = (string) $templateXml->mobileMenuIconType; if (strtolower($mobileMenuIconType) != 'yes') { $html[] = '<script type="text/javascript"> (function($) { $(document).ready(function() { $("#jsn_mobileMenuIconTypeText").parent().parent().prev().hide(); $("#jsn_mobileMenuIconTypeText").parent().parent().hide(); }); })(jQuery); </script>'; } else { $html[] = '<script type="text/javascript"> (function($) { $(document).ready(function() { if ($("input[name=\'jsn[mobileMenuIconType]\']:checked").val() == "text") { $("#jsn_mobileMenuIconTypeText").parent().parent().show(); } else { $("#jsn_mobileMenuIconTypeText").parent().parent().hide(); } $(".radio input[name=\'jsn[mobileMenuIconType]\']").click(function(){ if ($(this).val() == "text") { $("#jsn_mobileMenuIconTypeText").parent().parent().show(); } else { $("#jsn_mobileMenuIconTypeText").parent().parent().hide(); } }); }); })(jQuery); </script>'; } $data = array(); $options = array('default' => $this->value == '' ? (int) $this->element['default'] : $this->value); if (isset($this->element['disabled']) && $this->element['disabled'] == 'true') { $options['class'] = 'disabled'; $options['disabled'] = 'disabled'; } // Get all radio options from xml foreach ($this->element->children() as $option) { $data[] = array('value' => $option['value'], 'text' => (string) $option); } $html[] = JSNTplFormHelper::radio($this->name, $data, $options); return implode($html); }
public function getInput() { // Get template data $data = JSNTplHelper::getEditingTemplate(); // Preset values $data->_JSNListColor = new stdClass(); $defaultValues = array('list' => array(), 'colors' => array()); foreach ($this->element->option as $option) { $value = (string) $option['value']; $data->_JSNColorList->default[$value] = array('label' => (string) $option, 'value' => $value); $defaultValues['list'][] = $value; $defaultValues['colors'][] = $value; } $data->_JSNColorList->option['list'] = array_keys($data->_JSNColorList->default); $data->_JSNListColor->option['checked'] = $data->_JSNColorList->option['list']; if (!empty($this->value)) { $decodedValue = json_decode($this->value); if (is_array($decodedValue->list)) { $optionList = array(); foreach ($decodedValue->list as $item) { if (isset($data->_JSNColorList->default[$item])) { $optionList[] = $item; } elseif (@isset($decodedValue->colors[$item])) { unset($decodedValue->colors[$item]); } } $arrayDiff = array_diff($data->_JSNColorList->option['list'], $optionList); $data->_JSNColorList->option['list'] = array_merge($optionList, $arrayDiff); } if (is_array($decodedValue->colors) and !empty($decodedValue->colors)) { if (count($arrayDiff)) { $data->_JSNListColor->option['checked'] = array_merge($optionList, array_diff($data->_JSNListColor->option['checked'], $decodedValue->colors)); } else { $data->_JSNListColor->option['checked'] = $decodedValue->colors; } } } else { $this->value = array('list' => $data->_JSNColorList->option['list'], 'colors' => $data->_JSNListColor->option['checked']); } $this->disabled = isset($this->element['disabled']) && $this->element['disabled'] == 'true'; $this->disabledClass = $this->disabled ? 'disabled' : ''; return parent::getInput(); }
/** * Autoload class file of JSN Template Framework. * * @param string $className Name of class needs to be loaded. * * @return boolean */ function jsn_template_framework_class_loader($className) { if (strpos($className, 'JSNTpl') === 0) { $path = strtolower(preg_replace('/([A-Z])/', '/\\1', substr($className, 6))); $fullPath = JSN_PATH_TPLFRAMEWORK_LIBRARIES . '/' . $path; // Load alternative class for backward compatible with old template version $app = JFactory::getApplication(); $tpl = $app->getTemplate(); if ($app->isSite() and substr($tpl, 0, 4) == 'jsn_' and !JSNTplVersion::isCompatible($tpl, JSNTplHelper::getTemplateVersion($tpl))) { if (is_file("{$fullPath}_v1.php") and is_readable("{$fullPath}_v1.php")) { $fullPath .= '_v1'; } } if (is_file("{$fullPath}.php") and is_readable("{$fullPath}.php")) { return include_once "{$fullPath}.php"; } return false; } }
/** * Generate HTML code for input field. * * @return string */ public function getInput() { // Get template data $data = JSNTplHelper::getEditingTemplate(); // Preset values $data->_JSNListColor = new stdClass(); $defaultValues = array('list' => array(), 'colors' => array()); foreach ($this->element->option as $option) { $value = (string) $option['value']; $data->_JSNListColor->default[$value] = array('label' => (string) $option, 'value' => $value); $defaultValues['list'][] = $value; $defaultValues['colors'][] = $value; } $data->_JSNListColor->option['list'] = array_keys($data->_JSNListColor->default); $data->_JSNListColor->option['checked'] = $data->_JSNListColor->option['list']; // Generate param name $paramName = (string) $this->element['name']; if (isset($data->params[$paramName])) { $decodedValue = json_decode($data->params[$paramName]); if ($decodedValue and is_array($decodedValue->list)) { $optionList = array(); foreach ($decodedValue->list as $item) { if (isset($data->_JSNListColor->default[$item])) { $optionList[] = $item; } } $arrayDiff = array_diff($data->_JSNListColor->option['list'], $optionList); $data->_JSNListColor->option['list'] = array_merge($optionList, $arrayDiff); } if (@is_array($decodedValue->colors)) { if (count($arrayDiff)) { $data->_JSNListColor->option['checked'] = array_merge($optionList, array_diff($data->_JSNListColor->option['checked'], $decodedValue->colors)); } else { $data->_JSNListColor->option['checked'] = $decodedValue->colors; } } } else { $data->params[$paramName] = array('list' => $data->_JSNListColor->option['list'], 'colors' => $data->_JSNListColor->option['checked']); } // Prepare other field attributes $this->disabled = 'true' == (string) $this->element['disabled']; return parent::getInput(); }
/** * Parse field declaration to render input. * * @return void */ public function getInput() { // Make sure we have options declared if (!isset($this->element->option)) { return JText::_('JSN_TPLFW_LAYOUT_MISSING_WIDTH_TYPE_DECLARATION'); } // Get template data $data = JSNTplHelper::getEditingTemplate(); // Initialize field value if (isset($data->params[(string) $this->element['name']])) { $this->value = $data->params[(string) $this->element['name']]; } else { !empty($this->value) or $this->value = (string) $this->element['default']; if (is_string($this->value)) { $this->value = (substr($this->value, 0, 1) == '{' and substr($this->value, -1) == '}') ? json_decode($this->value, true) : array('type' => $this->value); } } // Parse default template width type options foreach ($this->element->option as $option) { // Store option $this->options[(string) $option['name']] = array('label' => (string) $option['label'], 'suffix' => (string) $option['suffix'], 'type' => count($option->children()) ? (int) $option['multiple'] ? 'checkbox' : 'radio' : 'number', 'options' => $option->children(), 'class' => (string) $option['class'], 'pro' => (string) $option['pro'] == 'true' ? true : false); // Preset missing field value with default value if (!isset($this->value[(string) $option['name']])) { if (count($option->children())) { foreach ($option->children() as $child) { if ((string) $child['default'] == 'checked') { if ((int) $option['multiple']) { $this->value[(string) $option['name']][] = (string) $child['value']; } else { $this->value[(string) $option['name']] = (string) $child['value']; } } } } else { $this->value[(string) $option['name']] = (string) $option['default']; } } } return parent::getInput(); }
/** * Parse field declaration to render input. * * @return void */ public function getInput() { // Make sure we have options declared if (!isset($this->element->option)) { return JText::_('JSN_TPLFW_ERROR_MISSING_OPTIONS'); } // Get template data $data = JSNTplHelper::getEditingTemplate(); // Initialize field value if (isset($data->params[(string) $this->element['name']])) { $this->value = $data->params[(string) $this->element['name']]; } elseif (empty($this->value)) { $this->value = (string) $this->element['default']; } if (is_string($this->value)) { $this->value = (substr($this->value, 0, 1) == '{' and substr($this->value, -1) == '}') ? json_decode($this->value, true) : array($this->value => 1); } // Parse field attributes $options['class'] = isset($this->element['class']) ? (string) $this->element['class'] : ''; $options['disabled'] = ''; if (isset($this->element['disabled']) and $this->element['disabled'] == 'true') { $options['class'] .= ' disabled'; $options['disabled'] = ' disabled="disabled"'; } // Get all checkbox options from xml $data = array(); foreach ($this->element->children() as $option) { // Check if option is checked if (is_array($this->value)) { $checked = (array_key_exists((string) $option['value'], $this->value) and $this->value[(string) $option['value']]); } else { $checked = (isset($option['default']) and (string) $option['default'] == 'checked'); } $data[] = array('value' => (string) $option['value'], 'text' => (string) $option, 'checked' => $checked ? ' checked="checked"' : ''); } return JSNTplFormHelper::checkbox($this->name, $data, $options); }
/** * Function to parse column declaration. * * @param array $group Array of SimpleXMLElement object respresent a group of columns. * @param array &$option Option array to store column data. * * @return void */ protected function parseColumns($group, &$option) { // Get template data $data = JSNTplHelper::getEditingTemplate(); foreach ($group->children() as $column) { $cname = (string) $column['name']; $value = isset($option[$cname]) ? $option[$cname] : (string) $column['default']; $order = ($order = (int) $column['sourceCodeOrder']) < 10 ? "0{$order}" : $order; // Store option $option[$cname] = array('label' => (string) $column['label'], 'value' => $value, 'order' => $order); // Does this column has nested column? if (count($column->children())) { $option[$cname]['columns'] = array(); // Pass values to options array if (@is_array($data->params["{$cname}Columns"])) { foreach ($data->params["{$cname}Columns"] as $oname => $value) { $option[$cname]['columns'][preg_replace('/^\\d+:/', '', $oname)] = $value; } } // Parse nested columns $this->parseColumns($column, $option[$cname]['columns']); } } }
public function downloadFrameworkAction() { if (!JSNTplHelper::isDisabledFunction('set_time_limit')) { set_time_limit(0); } // Download package file try { JSNTplApiLightcart::downloadPackage('tpl_framework'); } catch (Exception $e) { throw $e; } }
<li> <a class="jsn-icon24 jsn-icon-social jsn-icon-twitter" href="http://www.twitter.com/joomlashine" title="Follow us on Twitter" target="_blank"></a> </li> <li> <a class="jsn-icon24 jsn-icon-social jsn-icon-youtube" href="http://www.youtube.com/joomlashine" title="Watch us on YouTube" target="_blank"></a> </li> </ul> </div> <div class="clearbreak"></div> </div --> </div> </div> </div> <?php $backupFile = JSNTplHelper::findLatestBackup($this->data->template); if (is_file($backupFile)) { ?> <div id="jsn-backup-file" class="row-fluid"> <div class="span12 alert alert-block alert-warning" style="margin-top:20px"> <a href="javascript:void(0)" title="<?php echo JText::_('JSN_TPLFW_CLOSE'); ?> " class="jsn-close-message close" style="right:0">×</a> <span class="label label-important"><?php echo JText::_('JSN_TPLFW_IMPORTANT_INFORMATION'); ?> </span> <p> <?php echo JText::_('JSN_TPLFW_AUTO_UPDATE_INSTALL_DOWNLOAD_BACKUP');
/** * This method will be used to find an extension that determined * by name. * * Return "install" when extension does not installed * Return "update" when extension is installed and is out of date * Return "installed" when extension is installed and is up to date * * @param string $name The name of extension * @param string $version Version number that used to determine state * * @return string */ private function _getExtensionState($name, $version) { $installedExtensions = JSNTplHelper::findInstalledExtensions(); if (!isset($installedExtensions[$name])) { return 'install'; } if (version_compare($installedExtensions[$name]->version, $version, '<')) { return 'update'; } return 'installed'; }
/** * Save active form context to memory when editing an template * * @param object $context Current context of template form * @param object $data Data of the form * @return void */ public function onContentPrepareForm($context, $data) { if ($context->getName() == 'com_templates.style' and !empty($data)) { $templateName = is_object($data) ? $data->template : $data['template']; if (JSNTplTemplateRecognization::detect($templateName)) { $templateManifest = JSNTplHelper::getManifest($templateName); $templateGroup = isset($templateManifest->group) ? trim((string) $templateManifest->group) : ''; // Create template admin instance if ($templateGroup == 'jsntemplate') { self::$_templateAdmin = JSNTplTemplateAdmin::getInstance($context); } } } }
/** * Get list of supported editions for current template. * * @return array */ protected function loadEditions() { $cacheFile = JPATH_SITE . '/templates/' . $this->data->template . '/editions.json'; // Retrieve template editions from cache file if (is_file($cacheFile) and is_readable($cacheFile)) { $editions = json_decode(JFile::read($cacheFile), true); if (!empty($editions)) { $this->editions = $editions; return $editions; } } try { $response = JSNTplHttpRequest::get(JSN_TPLFRAMEWORK_VERSIONING_URL . '?category=cat_template'); $json = json_decode(trim($response['body']), true); } catch (Exception $e) { // Do nothing } // Return only free edition if cannot parse data returned from server if (empty($json) or !is_array($json) or !isset($json['items'])) { $this->editions = array('FREE'); } else { $templateId = JSNTplHelper::getTemplateId($this->data->template); $this->editions = array('FREE'); foreach ($json['items'] as $item) { if (isset($item['identified_name']) && $templateId == $item['identified_name']) { if (isset($item['editions']) and is_array($item['editions'])) { foreach ($item['editions'] as $edition) { $e = strtoupper(trim($edition['edition'])); in_array($e, $this->editions) or $this->editions[] = $e; } } elseif (isset($item['edition']) and !empty($item['edition'])) { $e = strtoupper(trim($item['edition'])); in_array($e, $this->editions) or $this->editions[] = $e; } } } } // Cache edition data $buffer = json_encode($this->editions); JFile::write($cacheFile, $buffer); }
/** * This method will be used to find an extension that determined * by name. * * Return "install" when extension does not installed * Return "update" when extension is installed and is out of date * Return "installed" when extension is installed and is up to date * * @param string $name The name of extension * @param string $version Version number that used to determine state * * @return string */ private function _getExtensionState($name, $version, $isThirdParty = false) { $installedExtensions = JSNTplHelper::findInstalledExtensions(); if (!isset($installedExtensions[$name])) { return 'install'; } if (version_compare($installedExtensions[$name]->version, $version, '<')) { return 'update'; } if ($isThirdParty) { if (version_compare($installedExtensions[$name]->version, $version, '>')) { return 'unsupported'; } } return 'installed'; }
/** * Install downloaded package to joomla system * * @return void */ public function installAction() { JSNTplHelper::isDisabledFunction('set_time_limit') or set_time_limit(0); $config = JFactory::getConfig(); $config->set('debug', 0); if (!is_file($packageFile = $this->session->get($this->template['id'] . '.upgradePackage'))) { throw new Exception("Package file not found: {$packageFile}"); } // Load extension installation library jimport('joomla.installer.helper'); $language = JFactory::getLanguage(); $language->load('lib_joomla', JPATH_SITE); // Unpack downloaded upgrade package $unpackedInfo = JInstallerHelper::unpack($packageFile); if (empty($unpackedInfo) or !isset($unpackedInfo['dir'])) { throw new Exception(JText::_('JSN_TPLFW_ERROR_CANNOT_EXTRACT_TEMPLATE_PACKAGE_FILE')); } // Check if template is copied to another name if ($xml = simplexml_load_file($unpackedInfo['dir'] . '/template/templateDetails.xml')) { if (strcasecmp($this->template['name'], trim((string) $xml->name)) != 0) { // Update templateDetails.xml with new name $content = str_replace((string) $xml->name, $this->template['name'], JFile::read($unpackedInfo['dir'] . '/template/templateDetails.xml')); JFile::write($unpackedInfo['dir'] . '/template/templateDetails.xml', $content); } } // Upgrade now $installer = JInstaller::getInstance(); $installer->setUpgrade(true); $installResult = $installer->install($unpackedInfo['dir']); if ($installResult === false) { foreach (JError::getErrors() as $error) { throw $error; } } // Clean up temporary data JInstallerHelper::cleanupInstall($packageFile, $unpackedInfo['dir']); // Retrieve style id of installed package $q = $this->dbo->getQuery(true); $q->select('id'); $q->from('#__template_styles'); $q->where('template = ' . $q->quote($this->template['name'])); $this->dbo->setQuery($q); $styleId = $this->dbo->loadResult(); $q = $this->dbo->getQuery(true); $q->update('#__template_styles'); $q->set('home = 0'); $q->where('client_id = 0'); $this->dbo->setQuery($q); $this->dbo->{$this->queryMethod}(); $q = $this->dbo->getQuery(true); $q->update('#__template_styles'); $q->set('home = 1'); $q->where('id = ' . (int) $styleId); $this->dbo->setQuery($q); $this->dbo->{$this->queryMethod}(); $this->setResponse(array('styleId' => $styleId)); }
/** * Preparing template parameters for the template * * @return void */ private function _prepare($loadTemplateCSS, $loadTemplateJS) { $this->_loadTemplateCSS = $loadTemplateCSS; $this->_loadTemplateJS = $loadTemplateJS; $templateParams = isset($this->_document->params) ? $this->_document->params : null; $templateName = isset($this->_document->template) ? $this->_document->template : null; if (empty($templateParams) or empty($templateName) or $templateName == 'system') { $templateDetails = JFactory::getApplication()->getTemplate(true); $templateParams = $templateDetails->params; $templateName = $templateDetails->template; } // Update show content on frontpage parameter $app = JFactory::getApplication(); $menu = $app->getMenu()->getActive(); $lang = JFactory::getLanguage(); $lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR); $manifest = JSNTplHelper::getManifest($templateName); $this->_document->app = JFactory::getApplication(); $this->_document->template = $templateName; $this->_document->version = JSNTplHelper::getTemplateVersion($templateName); $this->_document->isFree = !isset($manifest->edition) || $manifest->edition == 'FREE'; $this->_document->uri = JFactory::getUri(); $this->_document->rootUrl = $this->_document->uri->root(true); $this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template; $columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright'); // Find customizable columns $customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]'); if (count($customColumns) > 0) { $columns = array(); foreach (end($customColumns)->children() as $column) { $columns[] = (string) $column['name']; } } // Add columns to overriable parameter list foreach ($columns as $column) { $className = $column; if (strpos($column, 'column') === 0) { $className = substr($column, 6); } $this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'integer', 'name' => $column); } // Load template parameters $params = $this->loadParams($templateParams->toArray(), $templateName, true); // Detect browser information $this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo(); $this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie'; $this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7; // Custom direction from url parameter $direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction); $this->_document->direction = $direction; // Apply custom params $params = $this->_overrideCustomParams($params); $params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true; if ($this->_document->isFree === true) { $params['mobileSupport'] = false; $params['useCSS3Effect'] = false; } // Prepare logo parameter if ($params['logoColored']) { $params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png"; } if ($params['mobileSupport'] == false) { $params['desktopSwitcher'] = false; } if (!preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) { $params['logoFile'] = JUri::root(true) . '/' . $params['logoFile']; } // Prepare color variation to show in site tool if ($params['colorSelector'] and !@count($params['sitetoolsColorsItems'])) { $params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option'); if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) { $xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml'); $params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option'); } foreach ($params['sitetoolsColorsItems'] as &$color) { $color = (string) $color['value']; } } // Prepare Google Analytics code $params['codeAnalytic'] = trim($params['codeAnalytic']); if (!empty($params['codeAnalytic'])) { if (strpos($params['codeAnalytic'], '<script') === false) { $params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic']; } if (strpos($params['codeAnalytic'], '</script>') === false) { $params['codeAnalytic'] = $params['codeAnalytic'] . '</script>'; } } // Binding parameters to document object $this->_document->params = new JRegistry(); foreach ($params as $key => $value) { $this->_document->params->set($key, $value); $this->_document->{$key} = $value; } // Assign helper object $this->_document->helper = $this; $this->_document->attributes = $this->_overrideAttributes; $this->_document->templatePrefix = $this->_document->template . '_'; // Prepare body class $this->_prepareBodyClass(); // Prepare template styles $this->_prepareHead(); }
/** * Method to get the field input markup for a generic list. * Use the multiple attribute to enable multiselect. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $request = JFactory::getApplication()->input; if (class_exists('JModelLegacy')) { $templateModel = JModelLegacy::getInstance('Style', 'TemplatesModel'); } else { $templateModel = JModel::getInstance('Style', 'TemplatesModel'); } $templateData = $templateModel->getItem($request->getInt('id')); $templateXml = JSNTplHelper::getManifest($templateData->template); $mobileMenuEffect = (string) $templateXml->mobileMenuEffect; $html = array(); $attr = ''; // Initialize some field attributes. $attr .= !empty($this->class) ? ' class="' . $this->class . '"' : ''; $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : ''; $attr .= $this->multiple ? ' multiple' : ''; $attr .= $this->required ? ' required aria-required="true"' : ''; $attr .= $this->autofocus ? ' autofocus' : ''; // To avoid user's confusion, readonly="true" should imply disabled="true". if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true') { $attr .= ' disabled="disabled"'; } // Initialize JavaScript field attributes. $attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : ''; // Get the field options. $options = (array) $this->getOptions(); //if (strtolower($mobileMenuEffect) != 'yes') //{ //Only get default if the template does not support Mobile Menu Effect //$options = array(@$options[0]); //} if (strtolower($mobileMenuEffect) != 'yes') { $html[] = '<script type="text/javascript"> (function($) { $(document).ready(function() { $("select[name=\'jsn[mobileMenuEffect]\']").parent().parent().hide(); }); })(jQuery); </script>'; } // Create a read-only list (no name) with hidden input(s) to store the value(s). if ((string) $this->readonly == '1' || (string) $this->readonly == 'true') { $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id); // E.g. form field type tag sends $this->value as array if ($this->multiple && is_array($this->value)) { if (!count($this->value)) { $this->value[] = ''; } foreach ($this->value as $value) { $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"/>'; } } else { $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"/>'; } } else { $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); } return implode($html); }
* @author JoomlaShine Team <*****@*****.**> * @copyright Copyright (C) 2015 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('JModelLegacy')) { $templateModel = JModelLegacy::getInstance('Style', 'TemplatesModel'); } else { $templateModel = JModel::getInstance('Style', 'TemplatesModel'); } $template = $templateModel->getItem(JFactory::getApplication()->input->getInt('id')); $templateEdition = JSNTplHelper::getTemplateEdition($template->template); $templateName = JText::_($template->template); ?> <div id="jsn-megamenu-builder" class="jsn-padding-mini jsn-rounded-mini jsn-box-shadow-mini"> <!-- TOP LEVEL MENU ITEMS PANEL --> <div id="jsn-tpl-mm-top-level-menu-container"></div> <!-- MEGAMENU SETTING PANEL --> <div class="megamenu-builder-container"> <div id="megamenu-setting-container"> <!-- MegaMenu elements --> <div id="jsn-mm-form-design-content"> <div class="jsn-mm-form-container jsn-layout"> <a href="javascript:void(0);" id="jsn-mm-add-container" class="jsn-add-more"><i class="icon-add"></i><?php echo JText::_('JSN_TPLFW_MEGAMENU_ADD_ROW', true); ?>
/** * Retrieve template detailed information and store * it in the memory * * @param string $name The template name * @return void */ private function _parseTemplateInfo($name) { if (!($details = JSNTplTemplateRecognization::detect($name))) { JFactory::getApplication()->enqueueMessage("The template {$name} is not a valid JoomlaShine template!"); } $this->template = array('name' => $name, 'realName' => JText::_($name), 'id' => JSNTplHelper::getTemplateId($name), 'edition' => JSNTplHelper::getTemplateEdition($name), 'version' => JSNTplHelper::getTemplateVersion($name)); }
/** * Download templates information data from JoomlaShine server * * @return object */ public static function getVersionData() { if (empty(self::$versionData)) { try { $response = JSNTplHttpRequest::get(JSN_TPLFRAMEWORK_VERSIONING_URL . '?category=cat_template'); } catch (Exception $e) { throw $e; } self::$versionData = json_decode($response['body'], true); } // Return result return self::$versionData; }
/** * Constructor for template admin * * @param JForm $context Current context of template admin. */ private function __construct(JForm $context) { if (class_exists('JModelLegacy')) { $templateModel = JModelLegacy::getInstance('Style', 'TemplatesModel'); } else { $templateModel = JModel::getInstance('Style', 'TemplatesModel'); } $request = JFactory::getApplication()->input; $this->baseUrl = JUri::root(true); $this->baseAssetUrl = $this->baseUrl . '/plugins/system/jsntplframework/assets'; $this->context = $context; $this->data = $templateModel->getItem($request->getInt('id')); $this->version = new JVersion(); $this->doc = JFactory::getDocument(); $this->helper = JSNTplTemplateHelper::getInstance($this->data->template); $this->templateXml = JSNTplHelper::getManifest($this->data->template); // Retrieve template form instance $this->templateForm = JForm::getInstance('com_templates.style', 'style', array('control' => 'jform', 'load_data' => true)); $this->templateEdition = JSNTplTemplateEdition::getInstance($this->data); // Load cache engine $this->cache = JFactory::getCache('plg_system_jsntplframework'); // Load language $language = JFactory::getLanguage(); $language->load('tpl_' . $this->data->template, JPATH_ROOT); }
/** * Download product installation package from lightcart. * Return path to downloaded package when download successfull * * @param string $id Identified name of the product * @param string $edition Product edition to download * @param string $username Customer username * @param string $password Customer password * @param string $savePath Path to save downloaded package * * @return string */ public static function downloadPackage($id, $edition = null, $username = null, $password = null, $savePath = null) { $joomlaVersion = JSNTplHelper::getJoomlaVersion(2); // Send request to joomlashine server to checking customer information $query = array('controller=remoteconnectauthentication', 'task=authenticate', 'tmpl=component', 'identified_name=' . $id, 'joomla_version=' . $joomlaVersion, 'upgrade=yes', 'custom=1', 'language=' . JFactory::getLanguage()->getTag()); if (!empty($edition)) { $query[] = 'edition=' . $edition; } if (!empty($username) && !empty($password)) { $query[] = 'username='******'password='******'tmp_path') : $savePath; $downloadUrl = JSN_TPLFRAMEWORK_LIGHTCART_URL . '&' . implode('&', $query); $filePath = $tmpPath . '/jsn-' . $id . '.zip'; try { JSNTplHttpRequest::get($downloadUrl, $filePath, array('content-type' => array('application/zip', 'application/x-zip', 'application/x-zip-compressed', 'application/octet-stream', 'application/x-compress', 'application/x-compressed', 'multipart/x-zip'))); } catch (Exception $e) { // Check if we have LightCart error code? if (strlen($e->getMessage() == 5 and preg_match('/^ERR[0-9]+$/', $e->getMessage()))) { throw new Exception(JText::_('JSN_TPLFW_LIGHTCART_ERROR_' . $e->getMessage())); } else { throw $e; } } return $filePath; }
<?php /** * @version $Id$ * @package JSNTPLFW * @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'); // Get template data $data = JSNTplHelper::getEditingTemplate(); // Generate param name $paramName = (string) $this->element['name']; ?> <div class="jsn-color-list jsn-color-list-v1 <?php echo $this->disabledClass; ?> "> <ul class="jsn-items-list ui-sortable" data-target="#<?php echo $this->id; ?> "> <?php foreach ($data->_JSNColorList->option['list'] as $item) { ?> <?php
$template = JSNTplTemplateRecognization::detect($this->data->template); // Prepare template name for link generation $templateName = 'jsn-' . strtolower($template->name); // Generate template introduction link $templateLink = "http://www.joomlashine.com/joomla-templates/{$templateName}.html"; // Process template edition $edition = $this->templateEdition->getEdition(); if ($edition == 'FREE') { $editionClass = 'jsn-free-edition'; } else { $editionClass = 'jsn-pro-edition'; } // Get next template edition $nextEdition = str_replace('PRO ', '', $this->templateEdition->getNextEdition()); // Get installed template version $version = JSNTplHelper::getTemplateVersion($this->data->template); ?> <div class="jsn-master"><div id="jsn-template-config" class="jsn-bootstrap <?php echo $wrapperClass; ?> <?php echo $editionClass; ?> "> <form action="" method="POST" name="adminForm" id="style-form"> <input type="hidden" name="task" /> <input type="hidden" name="customized" value="<?php echo @count($this->data->params) ? 'yes' : 'no'; ?> " /> <?php
/** * Preparing template parameters for the template * * @return void */ private function _prepare($loadTemplateCSS, $loadTemplateJS) { $this->_loadTemplateCSS = $loadTemplateCSS; $this->_loadTemplateJS = $loadTemplateJS; $templateParams = isset($this->_document->params) ? $this->_document->params : null; $templateName = isset($this->_document->template) ? $this->_document->template : null; if (empty($templateParams) or empty($templateName) or $templateName == 'system') { $templateDetails = JFactory::getApplication()->getTemplate(true); $templateParams = $templateDetails->params; $templateName = $templateDetails->template; } // Get template information $this->_template = JSNTplTemplateRecognization::detect($templateName); // Update show content on frontpage parameter $app = JFactory::getApplication(); $menu = $app->getMenu()->getActive(); $lang = JFactory::getLanguage(); $lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR); $manifest = JSNTplHelper::getManifest($templateName); $this->_document->app = JFactory::getApplication(); $this->_document->template = $templateName; $this->_document->version = JSNTplHelper::getTemplateVersion($templateName); $this->_document->isFree = empty($manifest->edition) || $manifest->edition == 'FREE'; $this->_document->uri = JFactory::getUri(); $this->_document->rootUrl = $this->_document->uri->root(true); $this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template; $columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright'); // Find customizable columns $customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]'); if (count($customColumns) > 0) { $columns = array(); foreach (end($customColumns)->children() as $column) { $columns[] = (string) $column['name']; } } // Add columns to overriable parameter list foreach ($columns as $column) { $className = $column; if (strpos($column, 'column') === 0) { $className = substr($column, 6); } $this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'string', 'name' => $column); } // Load template parameters $params = $this->loadParams($templateParams->toArray(), $templateName, true); // Detect browser information $this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo(); $this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie'; $this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7; // Custom direction from url parameter $direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction); $this->_document->direction = $direction; // Apply custom params $params = $this->_overrideCustomParams($params); $params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true; // Prepare logo parameter if ($params['logoColored']) { $params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png"; } if (!empty($params['logoFile']) and !preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) { $params['logoFile'] = JUri::root(true) . '/' . $params['logoFile']; } // Prepare color variation to show in site tool if (!isset($params['sitetoolsColorsItems']) and $colorSettings = json_decode($params['sitetoolsColors'])) { if (!count($colorSettings->colors)) { $params['sitetoolsColorsItems'] = array(); } } if ($params['sitetoolsColors'] and !isset($params['sitetoolsColorsItems'])) { $params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option'); if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) { $xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml'); $params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option'); } if ($params['sitetoolsColorsItems']) { foreach ($params['sitetoolsColorsItems'] as &$color) { $color = (string) $color['value']; } } $params['sitetoolsColorsItems'] != false or $params['sitetoolsColorsItems'] = array(); } $params['colorSelector'] = count($params['sitetoolsColorsItems']) ? true : false; // Check if site tools has tool to show if ($params['sitetoolStyle']) { $visible = count($params['sitetoolsColorsItems']); if (!$visible) { $params['sitetoolStyle'] = false; } } // Prepare Google Analytics code $params['codeAnalytic'] = trim($params['codeAnalytic']); if (!empty($params['codeAnalytic'])) { if (strpos($params['codeAnalytic'], '<script') === false) { $params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic']; } if (strpos($params['codeAnalytic'], '</script>') === false) { $params['codeAnalytic'] = $params['codeAnalytic'] . '</script>'; } } // Check if user specified custom width for any column foreach ($columns as $column) { if (isset($params[$column])) { // Re-generate column name $columnName = str_replace('column-', '', strtolower(preg_replace('/([A-Z])/', '-\\1', $column))); foreach (array('promoColumns', 'mainColumns', 'contentColumns') as $row) { foreach ($params[$row] as $id => $class) { // Re-fine ID $realId = preg_replace('/^\\d+:/', '', $id); if (str_replace('-', '', $realId) == str_replace('-', '', $columnName)) { if (strcasecmp(substr($params[$column], 0, 4), 'span') != 0) { // Convert framework v1 value type to compatible with framework v2 $span = round($params[$column] / (100 / 12)); } else { $span = intval(substr($params[$column], 4)); } // Alter current parameter value $currentSpan = intval(substr($class, 4)); if ($currentSpan != $span) { $params[$row][$id] = "span{$span}"; foreach ($params[$row] as $id => $class) { if (preg_match('/(\\d+:)?(promo|content|component)/', $id)) { $params[$row][$id] = 'span' . (intval(substr($class, 4)) + ($currentSpan - $span)); // Done altering break; } } } // Done altering break 2; } } } } } // Process column width if (strcasecmp(get_class($this->_document), 'JDocumentHTML') == 0) { $utils = JSNTplUtils::getInstance(); foreach (array('promoColumns', 'mainColumns', 'contentColumns', 'userColumns') as $row) { $visible = count($params[$row]); $spacing = 0; $columns = array(); foreach ($params[$row] as $id => $class) { // Re-fine ID $realId = preg_replace('/^\\d+:/', '', $id); // Detect the visibility of this column if (!in_array($realId, array('content', 'component')) and !$utils->countModules($realId)) { $visible--; $spacing += intval(str_replace('span', '', $class)); $columns[$id] = 0; } else { $columns[$id] = 1; } } // Expand visible columns if neccessary if ($visible < count($params[$row])) { foreach ($columns as $id => $status) { if (!$status) { // Column is invisible, unset data unset($params[$row][$id]); } elseif ($visible > 0) { // Alter column spanning if (count($columns) > 3) { $params[$row][$id] = preg_replace('/span\\d+/i', 'span' . 12 / $visible, $params[$row][$id]); } elseif ($visible == 1) { $params[$row][$id] = preg_replace('/span\\d+/i', 'span12', $params[$row][$id]); } } } if (count($columns) == 3 and $visible == 2) { // Sort columns to ensure correct source code order ksort($columns); $ordering = array_keys($columns); // Always expand main column if left or right is invisible if ($columns[$ordering[0]] and $row != 'userColumns') { $span = intval(str_replace('span', '', $params[$row][$ordering[0]])); $params[$row][$ordering[0]] = preg_replace('/span\\d+/i', 'span' . ($span + $spacing), $params[$row][$ordering[0]]); } else { foreach ($ordering as $key) { if ($columns[$key]) { $params[$row][$key] = preg_replace('/span\\d+/i', 'span6', $params[$row][$key]); } } } } } // Set visual column ordering $columns = array(); $ordering = 0; foreach ($params[$row] as $id => $class) { // Add class to indicate the order of this column $params[$row][$id] .= ' order' . $ordering++; } // Sort columns for correct source code ordering ksort($params[$row]); foreach ($params[$row] as $id => $class) { // Store data for processing visual ordering later $columns[] = array('id' => $id, 'class' => $class); } // Process visual ordering for visible columns foreach ($columns as $ordering => $column) { $visualOrdering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $column['class'])); $offset = 0; if ($ordering < $visualOrdering) { for ($i = $ordering + 1; $i < $visible; $i++) { $nextOrdering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $columns[$i]['class'])); if (($ordering == 0 or $nextOrdering > 0) and $nextOrdering < $visualOrdering) { $offset += intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } } elseif ($ordering > 0 and $ordering == $visualOrdering and $ordering + 1 < $visible) { for ($i = 0; $i < $ordering; $i++) { if (preg_match('/offset\\d+/', $columns[$i]['class'])) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } if ($offset < 0) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$ordering]['class'])); } } elseif ($ordering > $visualOrdering) { for ($i = 0; $i < $ordering; $i++) { $prevOrdering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $columns[$i]['class'])); if ($prevOrdering > $visualOrdering) { if (preg_match('/offset\\d+/', $columns[$i]['class'])) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); $offset -= intval(preg_replace('/^.*offset(\\d+).*$/', '\\1', $columns[$i]['class'])); } elseif (strpos($columns[$i]['class'], 'offset-') === false) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } elseif ($i > 0 and $prevOrdering < $visualOrdering) { $offset += intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } } // Set offset so the column display in correct visual ordering if ($offset != 0) { $columns[$ordering]['class'] = preg_replace('/(order\\d+)/', "\\1 offset{$offset}", $columns[$ordering]['class']); } } // Update column IDs and classes foreach ($columns as $column) { unset($params[$row][$column['id']]); // Re-fine ID $realId = preg_replace('/^\\d+:/', '', $column['id']); // Re-fine column order $ordering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $column['class'])) + 1; // Split classes to span, order and offset $classes = explode(' ', preg_replace('/order\\d+/', "order{$ordering}", $column['class'])); // Reset column data $params[$row][$realId] = array('span' => $classes[0], 'order' => isset($classes[1]) ? $classes[1] : '', 'offset' => isset($classes[2]) ? $classes[2] : ''); } } // Prepare social icons $socialIcons = array(); foreach ((array) @$params['socialIcons']['status'] as $channel) { // Set default value if (@empty($params['socialIcons'][$channel]['link']) and in_array($channel, array('facebook', 'twitter', 'youtube'))) { if (!@isset($params['socialIcons'][$channel]['title'])) { $params['socialIcons'][$channel]['title'] = JText::_('JSN_TPLFW_SOCIAL_NETWORK_INTEGRATION_' . strtoupper($channel)); } $params['socialIcons'][$channel]['link'] = "http://www.{$channel}.com/joomlashine"; } if (!@empty($params['socialIcons'][$channel]['link'])) { $socialIcons[$channel] = $params['socialIcons'][$channel]; } } } $params['socialIcons'] = $socialIcons; // Backward compatible: set templateStyle parameter as it still be used in component output only template file $params['templateStyle'] = $params['fontStyle']['style']; // Binding parameters to document object $this->_document->params = new JRegistry(); foreach ($params as $key => $value) { $this->_document->params->set($key, $value); $this->_document->{$key} = $value; } // Assign helper object $this->_document->helper = $this; $this->_document->attributes = $this->_overrideAttributes; $this->_document->templatePrefix = $this->_document->template . '_'; // Prepare body class $this->_prepareBodyClass(); // Prepare template styles $this->_prepareHead(); }
/** * Process checking customer information * * @return void */ public function authAction() { // Process posted back data that sent from client if ($this->request->getMethod() == 'POST') { $username = $this->request->getString('username', ''); $password = $this->request->getString('password', ''); // Create new HTTP Request try { $orderedEditions = JSNTplApiLightcart::getOrderedEditions($this->template['id'], $username, $password); } catch (Exception $e) { throw $e; } $edition = $this->template['edition']; if ($edition != 'FREE' and strpos($edition, 'PRO ') === false) { $edition = 'PRO ' . $edition; } if (in_array($edition, $orderedEditions)) { $this->setResponse(array('id' => $this->template['id'], 'edition' => $edition, 'joomlaVersion' => JSNTplHelper::getJoomlaVersion(2), 'username' => urlencode($username), 'password' => urlencode($password))); } else { throw new Exception(JText::_('JSN_TPLFW_ERROR_API_ERR02')); } } }
/** * Clean up junk data related to the missing component. * * @param string $name The component name. * @param array $modules Additional modules to be removed. * @param array $plugins Additional plugins to be removed. * * @return void */ private function _cleanJunkData($name, $modules = null, $plugins = null) { // Only clean-up junk data if component is really missing. if (!JSNTplHelper::isInstalledExtension($name)) { // Get all menu items associated with the missing component. $q = $this->dbo->getQuery(true); $q->select('id')->from('#__menu')->where("type = 'component'"); $q->where("link LIKE '%option=" . $name . "%'"); $this->dbo->setQuery($q); $items = $this->dbo->loadColumn(); if (count($items)) { // Get all modules associated with all menu items of the missing component. $q = $this->dbo->getQuery(true); $q->select('moduleid')->from('#__modules_menu')->where('menuid IN (' . implode(', ', $items) . ')'); $this->dbo->setQuery($q); $mods = $this->dbo->loadColumn(); // Clean up menu table. $q = $this->dbo->getQuery(true); $q->delete('#__menu')->where('id IN (' . implode(', ', $items) . ')'); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } // Clean up menu item alias also. $q = $this->dbo->getQuery(true); $q->delete('#__menu')->where("type = 'alias'")->where('(params LIKE \'%"aliasoptions":"' . implode('"%\' OR params LIKE \'%"aliasoptions":"', $items) . '"%\')'); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } // Clean up module menu mapping table. $q = $this->dbo->getQuery(true); $q->delete('#__modules_menu')->where('menuid IN (' . implode(', ', $items) . ')'); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } } if (isset($mods) && count($mods)) { // Make sure queried modules does not associate with menu items of other component. $q = $this->dbo->getQuery(true); $q->select('moduleid')->from('#__modules_menu')->where('moduleid IN (' . implode(', ', $mods) . ')'); $this->dbo->setQuery($q); if ($items = $this->dbo->loadColumn()) { $mods = array_diff($mods, $items); } // Clean up modules table. if (count($mods)) { $q = $this->dbo->getQuery(true); $q->delete('#__modules')->where('id IN (' . implode(', ', $mods) . ')'); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } } } // Clean up modules associated with the missing component but not associated with its menu items. $q = $this->dbo->getQuery(true); $q->delete('#__modules')->where("params LIKE '%\"moduleclass_sfx\":\"%jsn-demo-module-for-{$name}\"%'"); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } // Clean up assets table. $q = $this->dbo->getQuery(true); $q->delete('#__assets')->where('name = ' . $q->quote($name)); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } // Clean up extensions table. $q = $this->dbo->getQuery(true); $q->delete('#__extensions')->where('element = ' . $q->quote($name)); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } } // Clean up additional modules if specified. if ($modules && @count($modules)) { foreach ($modules as $module) { // Only clean-up junk data if module is really missing. if (!@is_dir(JPATH_ROOT . '/modules/' . (string) $module)) { // Clean up modules table. $q = $this->dbo->getQuery(true); $q->delete('#__modules')->where('module = ' . $q->quote((string) $module)); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } // Clean up extensions table. $q = $this->dbo->getQuery(true); $q->delete('#__extensions')->where("type = 'module'"); $q->where('element = ' . $q->quote((string) $module)); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } } } } // Clean up additional plugins if specified. if ($plugins && @count($plugins)) { foreach ($plugins as $plugin) { // Only clean-up junk data if plugin is really missing. if (!@is_dir(JPATH_ROOT . '/plugins/' . (string) $plugin['group'] . '/' . (string) $plugin)) { // Clean up extensions table. $q = $this->dbo->getQuery(true); $q->delete('#__extensions')->where("type = 'plugin'"); $q->where('folder = ' . $q->quote((string) $plugin['group'])); $q->where('element = ' . $q->quote((string) $plugin)); $this->dbo->setQuery($q); if (!$this->dbo->{$this->queryMethod}()) { throw new Exception($this->dbo->getErrorMsg()); } } } } }
*/ // No direct access defined('_JEXEC') or die('Restricted index access'); // Load template framework if (!defined('JSN_PATH_TPLFRAMEWORK')) { require_once JPATH_ROOT . '/plugins/system/jsntplframework/jsntplframework.defines.php'; require_once JPATH_ROOT . '/plugins/system/jsntplframework/libraries/joomlashine/loader.php'; } // Preparing template parameters JSNTplTemplateHelper::prepare(); // Get template utilities $jsnutils = JSNTplUtils::getInstance(); ?> <!DOCTYPE html> <!-- <?php echo $this->template . ' ' . JSNTplHelper::getTemplateVersion($this->template); ?> --> <html lang="<?php echo $this->language; ?> " dir="<?php echo $this->direction; ?> "> <head> <jdoc:include type="head" /> </head> <body id="jsn-master" class="<?php echo $this->bodyClass; ?>
/** * Create a backup of modified files then force user to download it. * * @return void */ public function downloadAction() { // Import necessary library jimport('joomla.filesystem.file'); if ($isUpdate = JFactory::getApplication()->input->getCmd('type') == 'update') { if (is_readable(JFactory::getConfig()->get('tmp_path') . '/jsn-' . $this->template['id'] . '.zip')) { $this->backupAction(); } else { $this->setResponse(JSNTplHelper::findLatestBackup($this->template['name'])); } } else { $this->backupAction(); } // Get path to backup file $path = $this->getResponse(); // Force user to download backup file header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($path)); header('Content-Disposition: attachment; filename=' . basename($path)); header('Cache-Control: no-cache, must-revalidate, max-age=60'); header('Expires: Sat, 01 Jan 2000 12:00:00 GMT'); echo JFile::read($path); // Exit immediately exit; }