/** * The form field type. * * @var string * @since 1.6 */ protected function getInput() { JHTML::_('behavior.modal', 'a.jsn-modal'); $doc = JFactory::getDocument(); $templateName = explode(DS, str_replace(array('\\elements', '/elements'), '', dirname(__FILE__))); $templateName = $templateName[count($templateName) - 1]; require_once JPATH_ROOT . DS . 'templates' . DS . $templateName . DS . 'includes' . DS . 'lib' . DS . 'jsn_utils.php'; $doc->addScript(JURI::root() . 'templates/' . $templateName . '/admin/js/jsn_slider.js'); $doc->addScript(JURI::root() . 'templates/' . $templateName . '/admin/js/jsn_admin.js'); $doc->addStyleSheet(JURI::root() . 'templates/' . $templateName . '/admin/css/jsn_admin.css'); $doc->addScriptDeclaration(' var templateLang = {}; templateLang.expand_all = "' . JText::_('EXPAND_ALL') . '"; templateLang.collapse_all = "' . JText::_('COLLAPSE_ALL') . '"; '); $jsnUtils = JSNUtils::getInstance(); $tellMore = ''; $html = ''; $result = $jsnUtils->getTemplateDetails(); $templateVersion = $result->version; $templateName = $result->name; $templateEdition = $result->edition; $templateName = str_replace('_', ' ', $templateName); $templateEdition = strtolower($templateEdition); // check System Cache - Plugin define('JSN_CACHESENSITIVE', $jsnUtils->checkSystemCache()); $hashCookieIndex = isset($_COOKIE['HashCookieIndex']) ? json_decode($_COOKIE['HashCookieIndex']) : null; if (empty($hashCookieIndex->selected)) { $hashCookieIndex->selected = '0,'; setcookie('HashCookieIndex', json_encode($hashCookieIndex), 0, '/'); } $jsAccordion = "window.addEvent('domready', function(){\n\t\t\t\t\t\t\t\tnew Accordion(\$\$('.panel h3.jpane-toggler'), \$\$('.panel div.jpane-slider'), {\n\t\t\t\t\t\t\t\t\tonActive: function(toggler, i) {\n\t\t\t\t\t\t\t\t\t\ttoggler.addClass('jpane-toggler-down');\n\t\t\t\t\t\t\t\t\t\ttoggler.removeClass('jpane-toggler');\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tonBackground: function(toggler, i) {\n\t\t\t\t\t\t\t\t\t\ttoggler.addClass('jpane-toggler');\n\t\t\t\t\t\t\t\t\t\ttoggler.removeClass('jpane-toggler-down');\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tduration: 300,\n\t\t\t\t\t\t\t\t\topacity: false,\n\t\t\t\t\t\t\t\t\talwaysHide: true\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t});"; $doc->addScriptDeclaration($jsAccordion); $templateName = preg_replace('/_(free|pro)$/i', '', $result->name); $templateDocName = strtolower(str_replace('_', '-', $templateName)); $templateReadableName = preg_replace('/^JSN_(.*)/ie', '"JSN " . ucfirst(strtolower("\\1"))', $templateName); $html = '<div class="jsn-quickstarted">'; $html .= '<p>' . JTEXT::sprintf('WELCOME_MESSAGE', $templateReadableName) . '</p> <ol id="jsn-quickstart-links"> <li> ' . JText::_('INSTALL_SAMPLE_DATA_AS_SEEN_ON_DEMO_WEBSITE') . ' <a class="jsn-modal btn link-button" rel="{handler: \'iframe\', size: {x: 750, y: 650}, closable: false}" href="../index.php?template=' . strtolower($result->name) . '&tmpl=jsn_installsampledata&template_style_id=' . JRequest::getInt('id') . '">' . JText::_('INSTALL_SAMPLE_DATA') . '</a> </li> <li> ' . JText::_('WATCH_CONFIGURATION_VIDEOS_ON_YOUTUBE') . ' <a class="btn link-button" href="http://www.joomlashine.com/docs/joomla-templates/template-configuration-videos.html" target="_blank">Watch videos</a> </li> <li> ' . JText::_('DOWNLOAD_AND_READ_DOCUMENT_IN_PDF') . ' <a class="btn link-button" href="http://www.joomlashine.com/joomla-templates/' . $templateDocName . '-docs.zip">Download documentation</a> </li> </ol>'; $html .= '</div>'; return $html; }
/** * The form field type. * * @var string * @since 1.6 */ protected function getInput() { JHTML::_('behavior.modal', 'a.jsn-modal'); require_once dirname(dirname(__FILE__)) . DS . 'includes' . DS . 'lib' . DS . 'jsn_utils.php'; $jsnUtils = JSNUtils::getInstance(); $doc = JFactory::getDocument(); $templateName = $jsnUtils->getTemplateName(); $copyright = ''; $html = ''; $manifestCache = $jsnUtils->getTemplateManifestCache($templateName); $manifestCache = json_decode($manifestCache); $result = $jsnUtils->getTemplateDetails(); $frontIndexPath = JURI::root() . $jsnUtils->determineFrontendIndex(); $proExists = $jsnUtils->checkProEditionExist($templateName, true); $doc->addScriptDeclaration("\n\t\t\tfunction checkIntegrity()\n\t\t\t{\n\t\t\t\t\$('jsn-check-integrity').set('html', '');\n\t\t\t\t\$('jsn-check-integrity-result').set('html', '');\n\t\t\t\tvar actionIntegrityUrl = '" . $frontIndexPath . "';\n\n\t\t\t\tvar resultIntegrityMsg = new Element('span');\n\t\t\t\tresultIntegrityMsg.set('class','jsn-integrity-checking');\n\t\t\t\tresultIntegrityMsg.set('html','" . JText::_('CHECKING', true) . "');\n\t\t\t\tresultIntegrityMsg.inject(\$('jsn-check-integrity-result'));\n\n\t\t\t\tvar jsonRequest = new Request.JSON({url: actionIntegrityUrl, onSuccess: function(jsonObj){\n\t\t\t\t\tif(jsonObj.integrity == '1') {\n\t\t\t\t\t\tresultIntegrityMsg.set('class','jsn-modification-exist');\n\t\t\t\t\t\tresultIntegrityMsg.set('html','<span>" . JText::_('SOME_FILES_HAVE_BEEN_MODIFIED', true) . ". <a href=\"../index.php?template=" . $templateName . "&tmpl=jsn_listmodifiedfiles\" class=\"link-action\" id=\"see-file-details\" rel=\"{handler: \\'iframe\\', size: {x: 570, y:320}}\" onclick=\"SqueezeBox.fromElement(\$(\\'see-file-details\\'), {parse: \\'rel\\'}); return false;\">" . JText::_('SEE_DETAILS_FILE', true) . "</a></span>');\n\t\t\t\t\t} else if (jsonObj.integrity == '0') {\n\t\t\t\t\t\tresultIntegrityMsg.set('class','jsn-no-modification');\n\t\t\t\t\t\tresultIntegrityMsg.set('html','" . JText::_('NO_FILES_MODIFICATION_FOUND', true) . "');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresultIntegrityMsg.set('class','jsn-no-modification');\n\t\t\t\t\t\tresultIntegrityMsg.set('html','" . JText::_('NO_CHECKSUM_FILE_FOUND', true) . "');\n\t\t\t\t\t}\n\t\t\t\t\tresultIntegrityMsg.inject(\$('jsn-check-integrity-result'));\n\t\t\t\t}}).get({'template': '" . $templateName . "', 'tmpl': 'jsn_runajax', 'task': 'checkFilesIntegrity'});\n\t\t\t}\n\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t \$('jsn-check-version').set('html', '');\n\t\t\t\tvar actionVersionUrl = '" . $frontIndexPath . "';\n\t\t\t\tvar resultVersionMsg = new Element('span');\n\t\t\t\tresultVersionMsg.set('class','jsn-version-checking');\n\t\t\t\tresultVersionMsg.set('html',' - " . JText::_('CHECKING_VERSION', true) . "');\n\t\t\t\tresultVersionMsg.inject(\$('jsn-check-version-result'));\n\t\t\t\tvar jsonRequest = new Request.JSON({url: actionVersionUrl, onSuccess: function(jsonObj){\n\t\t\t\t\tif(jsonObj.connection && jsonObj.version != '') {\n\t\t\t\t\t\tif(jsonObj.version == '" . $manifestCache->version . "') {\n\t\t\t\t\t\t\tresultVersionMsg.set('class','jsn-latest-version');\n\t\t\t\t\t\t\tresultVersionMsg.set('html',' - " . JText::_('THE_LATEST_VERSION') . "');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresultVersionMsg.set('class','jsn-outdated-version');\n\t\t\t\t\t\t\tresultVersionMsg.set('html',' - <a href=\"../index.php?template=" . $templateName . "&tmpl=jsn_autoupdater&template_style_id=" . JRequest::getInt('id') . "\" class=\"link-action\" id=\"jsn-auto-update\" rel=\"{handler: \\'iframe\\', size: {x: 750, y:680}}\" onclick=\"SqueezeBox.fromElement(\$(\\'jsn-auto-update\\'), {parse: \\'rel\\'}); return false;\">" . JText::_('UPDATE_NOW', true) . "'+jsonObj.version+'</a>');\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresultVersionMsg.set('class','jsn-connection-fail');\n\t\t\t\t\t\tresultVersionMsg.set('html',' <span class=\"grey\">-</span> " . JText::_('CONNECTION_FAILED', true) . "');\n\t\t\t\t\t}\n\t\t\t\t\tresultVersionMsg.inject(\$('jsn-check-version-result'));\n\t\t\t\t}}).get({'template': '" . $templateName . "', 'tmpl': 'jsn_runajax', 'task': 'checkVersion'});\n\t\t\t\t\$('jsn-check-integrity').addEvent('click', function() {checkIntegrity()});\n\t\t\t});\n\n\t\t"); $explodedTemplateName = explode('_', $templateName); if (strstr($result->copyright, $result->author) === false) { $copyright = $result->copyright . ' (<a target="_blank" title="' . $result->author . '" href="' . $result->authorUrl . '">' . $result->author . '</a>)'; } else { $copyright = str_replace($result->author, '<a target="_blank" title="' . $result->author . '" href="' . $result->authorUrl . '">' . $result->author . '</a>', $result->copyright); } $staticLink = $result->authorUrl . '/joomla-templates/' . @$explodedTemplateName[0] . '-' . @$explodedTemplateName[1] . '.html'; $html = '<div class="jsn-about">'; $html .= '<div class="jsn-product-intro">'; $html .= '<table width="100%"><tbody><tr><td width="10">'; $html .= '<div class="jsn-template-thumbnail">'; $html .= '<img src ="../templates/' . $templateName . '/template_thumbnail.png" width="206" height="150" />'; $html .= '</div>'; $html .= '</td><td>'; $html .= '<div class="jsn-template-details">'; $html .= '<h2>'; $html .= str_replace('_', ' ', $result->name) . ' ' . $result->edition; $html .= '</h2>'; if ($proExists === false) { $html .= '<a class="link-button jsn-modal" title="' . JText::_('UPGRADE_TO_PRO') . '" rel="{handler: \'iframe\', size: {x: 750, y: 650}, closable: false}" href="../index.php?template=' . strtolower($result->name) . '&tmpl=jsn_upgrade&template_style_id=' . JRequest::getInt('id') . '"><span class="icon-proversion">' . JText::_('JSN_UPGRADE_TEMPLATE') . '</span></a>'; } $html .= '<hr />'; $html .= '<dl>'; $html .= '<dt>' . JText::_('VERSION') . ':</dt><dd><strong class="jsn-current-version">' . $manifestCache->version . '</strong><a href="javascript:void(0);" class="link-action" id="jsn-check-version"></a><span id="jsn-check-version-result"></span></dd>'; $html .= '<dt>' . JText::_('COPYRIGHT') . ':</dt><dd>' . $copyright . '</dd>'; $html .= '<dt>' . JText::_('INTEGRITY') . ':</dt><dd><a href="javascript:void(0);" class="link-action" id="jsn-check-integrity">' . JText::_('CHECK_FOR_FILES_MODIFICATION') . '</a><span id="jsn-check-integrity-result"></span></dd>'; $html .= '</dl></td></tr></tbody></table></div><div class="jsn-product-cta">'; $html .= '<div style="float: left; width: 60%;"><ul class="horizontal-list"><li><a rel="{handler: \'iframe\', size: {x: 640, y: 510}}" href="' . $result->authorUrl . '/' . @$explodedTemplateName[2] . '-joomla-templates-promo.html" class="link-button jsn-modal"><span class="icon-gallery">' . JText::_('SEE_OTHER_TEMPLATES') . '</span></a></li></ul></div>'; $html .= '<div style="float: right; text-align: right;"><ul class="horizontal-list">'; $html .= '<li><a target="_blank" title="Connect with us on Facebook" href="http://www.facebook.com/joomlashine"><img width="24" height="24" alt="Connect with us on Facebook" src="' . JURI::root() . 'templates/' . strtolower($result->name) . '/admin/images/icon-facebook.png"></a></li>'; $html .= '<li><a target="_blank" title="Follow us on Twitter" href="http://www.twitter.com/joomlashine"><img width="24" height="24" alt="Follow us on Twitter" src="' . JURI::root() . 'templates/' . strtolower($result->name) . '/admin/images/icon-twitter.png"></a></li>'; $html .= '<li><a target="_blank" title="Watch us on YouTube" href="http://www.youtube.com/joomlashine"><img width="24" height="24" alt="Watch us on YouTube" src="' . JURI::root() . 'templates/' . strtolower($result->name) . '/admin/images/icon-youtube.png"></a></li>'; $html .= '</ul></div>'; $html .= '</div>'; $html .= '</div>'; return $html; }
function setTemplateInfo() { $objUtils = JSNUtils::getInstance(); $objReadXMLFile = new JSNReadXMLFile(); $templateManifest = $objReadXMLFile->getTemplateManifestFileInformation(); if ($templateManifest['edition'] != '' && $templateManifest['edition'] != 'free') { $edition = 'pro ' . $templateManifest['edition']; } else { $edition = 'free'; } $this->_edition = $edition; $this->_based_identified_name = ''; $this->_identified_name = str_replace('jsn', 'tpl', strtolower($templateManifest['name'])); $this->_joomla_version = $objUtils->getJoomlaVersion(true); $this->_full_name = strtolower($templateManifest['full_name']); $this->_name = strtolower($templateManifest['name']); $this->_template_version = $templateManifest['version']; }
/** * The form field type. * * @var string * @since 1.6 */ protected function getInput() { require_once dirname(dirname(__FILE__)) . DS . 'includes' . DS . 'lib' . DS . 'jsn_utils.php'; $jsnUtils = JSNUtils::getInstance(); $doc = JFactory::getDocument(); $templateName = $jsnUtils->getTemplateName(); $templateAbsPath = JPATH_ROOT . DS . 'templates' . DS . $templateName; $attr = $this->element['disabled'] ? 'disabled="' . $this->element['disabled'] . '"' : ''; $default = $this->element['default'] ? $this->element['default'] : ''; $data = $jsnUtils->getPositions($templateName); $html = '<div class="jsn-positionmapping">'; if ($this->value) { $html .= $jsnUtils->renderPositionComboBox($this->value, $data['desktop'], 'Select position', 'jform[params][' . $this->element['name'] . ']', $attr); } else { $html .= $jsnUtils->renderPositionComboBox($default, $data['desktop'], 'Select position', 'jform[params][' . $this->element['name'] . ']', $attr); } $html .= '</div>'; return $html; }
/** * Method to get the field label markup. * * @return string The field label markup. * @since 11.1 */ protected function getLabel() { $jsnUtils = JSNUtils::getInstance(); $result = $jsnUtils->getTemplateDetails(); $proExists = $jsnUtils->checkProEditionExist($jsnUtils->getTemplateName(), true); if (!JSN_CACHESENSITIVE && $this->element['cachesensitive'] == 'yes') { return implode('', array()); } $html = array(); $class = $this->element['class'] ? (string) $this->element['class'] : ''; $html[] = '<span class="spacer">'; $html[] = '<span class="before"></span>'; $html[] = '<span class="' . $class . '">'; if ((string) $this->element['hr'] == 'true') { $html[] = '<hr class="' . $class . '" />'; } else { $label = ''; // Get the label text from the XML element, defaulting to the element name. $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; $text = $this->translateLabel ? JText::_($text) : $text; // Build the class for the label. $class = !empty($this->description) ? 'hasTip' : ''; $class = $this->required == true ? $class . ' required' : $class; // Add the opening label tag and main attributes attributes. $label .= '<label id="' . $this->id . '-lbl" class="' . $class . '"'; // If a description is specified, use it to build a tooltip. if (!empty($this->description)) { $label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? JText::_($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"'; } // Add the label text and closing tag. if ($proExists === false) { $upgrade_link = '<strong><a class="link-action jsn-modal" rel="{handler: \'iframe\', size: {x: 750, y: 650}, closable: false}" href="../index.php?template=' . strtolower($result->name) . '&tmpl=jsn_upgrade&template_style_id=' . JRequest::getInt('id') . '">Upgrade now</a></strong>'; } else { $upgrade_link = ''; } $label .= '>' . JText::sprintf($text, $upgrade_link) . '</label>'; $html[] = $label; } $html[] = '</span>'; $html[] = '<span class="after"></span>'; $html[] = '</span>'; return implode('', $html); }
function modChrome_jsnmodule($module, &$params, &$attribs) { $jsnutils = JSNUtils::getInstance(); $moduleTitleOuput = '<span class="jsn-moduleicon">' . $module->title . '</span>'; $beginModuleContainerOutput = ''; $endModuleContainerOutput = ''; // Check module class for xHTML output if (isset($attribs['class'])) { // Check value in attribute class to generate appropriate xHTML code for module title if (preg_match("/\\bjsn-duohead\\b/", (string) $attribs['class'])) { $moduleTitleOuput = '<span class="jsn-moduleicon">' . $jsnutils->wrapFirstWord($module->title) . '</span>'; } if (preg_match("/\\bjsn-innerhead\\b/", (string) $attribs['class'])) { $moduleTitleOuput = '<span class="jsn-moduletitle_inner1"><span class="jsn-moduletitle_inner2">' . $moduleTitleOuput . '</span></span>'; } // Check value in attribute class to generate appropriate xHTML code for module container if (preg_match("/\\bjsn-triobox\\b/", (string) $attribs['class'])) { $beginModuleContainerOutput = '<div class="jsn-top"><div class="jsn-top_inner"></div></div><div class="jsn-middle"><div class="jsn-middle_inner">'; $endModuleContainerOutput = '</div></div><div class="jsn-bottom"><div class="jsn-bottom_inner"></div></div>'; } else { } if (preg_match("/\\bjsn-roundedbox\\b/", (string) $attribs['class'])) { $beginModuleContainerOutput = '<div><div>'; $endModuleContainerOutput = '</div></div>'; } else { } } // Generate output code to template echo '<div class="' . $params->get('moduleclass_sfx') . ' jsn-modulecontainer"><div class="jsn-modulecontainer_inner">'; echo $beginModuleContainerOutput; if ($module->showtitle) { echo '<h3 class="jsn-moduletitle">' . $moduleTitleOuput . '</h3>'; } echo '<div class="jsn-modulecontent">'; echo $module->content; echo '<div class="clearbreak"></div></div>'; echo $endModuleContainerOutput; echo '</div></div>'; }
/** * The form field type. * * @var string * @since 1.6 */ protected function getInput() { require_once dirname(dirname(__FILE__)) . DS . 'includes' . DS . 'lib' . DS . 'jsn_utils.php'; $jsnUtils = JSNUtils::getInstance(); $templateName = $jsnUtils->getTemplateName(); $doc = JFactory::getDocument(); $attr = ''; $jconfig = new JConfig(); // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $value = htmlspecialchars(html_entity_decode($this->value, ENT_QUOTES), ENT_QUOTES); $root_folder = str_replace('\\', '/', JPATH_ROOT) . '/'; $html = '<div class="jsn-cachefolder">'; if (!$this->element['disabled']) { $doc->addScriptDeclaration("\n\t\t\t\twindow.addEvent('domready', function(){ \n\t\t\t\t\t\$('jform_params_cachefolder').addEvents({\n\t\t\t\t\t\tkeyup: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\$('jform_params_cachefolder').fireEvent('hideCheckLink');\n\t\t\t\t\t\t},\n\t\t\t\t\t\tkeydown: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\$('jform_params_cachefolder').fireEvent('hideCheckLink');\n\t\t\t\t\t\t},\n\t\t\t\t\t\thideCheckLink: function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif( \$('jform_params_cachefolder').value == '') \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\$('jsn-checkcache').set('styles', {'visibility': 'hidden'});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\$('jsn-checkcache').set('styles', {'visibility': 'visible'});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\t\n\t\t\t\t\t\$('jsn-checkcache-action').addEvent('click', function() {\n\t\t\t\t\t\tactionUrl = '" . JURI::root() . "index.php';\n\t\t\t\t\t\tvar resultMsg = new Element('font');\n\t\t\t\t\t\tvar jsonRequest = new Request.JSON({url: actionUrl, onSuccess: function(jsonObj){\n\t\t\t\t\t\t\t\$('jsn-checkcache-result').set('html' , '');\n\t\t\t\t\t\t\tif(jsonObj.isDir) {\n\t\t\t\t\t\t\t\tif(jsonObj.isWritable) {\n\t\t\t\t\t\t\t\t\tresultMsg.set({color: 'green', text: '" . JText::_('FOLDER_EXISTS_WRITABLE') . "'});\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tresultMsg.set({color: 'red', text: '" . JText::_('FOLDER_NOT_WRITABLE') . "'});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tresultMsg.set({color: 'red', text: '" . JText::_('FOLDER_NOT_EXISTS') . "'});\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresultMsg.inject(\$('jsn-checkcache-result'));\n\t\t\t\t\t\t}}).get({'template': '" . $templateName . "', 'tmpl': 'jsn_runajax', 'cache_folder': '" . $root_folder . "' + \$('jform_params_cachefolder').value , 'task': 'checkCacheFolder'});\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t"); $html .= '<input value="' . $value . '" type="text" name="' . $this->name . '" id="jform_params_cachefolder" ' . $attr . ' /><span id="jsn-checkcache"><a id="jsn-checkcache-action" class="link-action" href="javascript:void(0)">' . JText::_('CHECK_CACHE_FOLDER') . '</a><span id="jsn-checkcache-result"></span></span>'; } else { $html .= '<input value="' . $value . '" type="text" name="' . $this->name . '" id="jform_params_cachefolder" ' . $attr . ' /><span id="jsn-checkcache"><span class="link-disabled">' . JText::_('CHECK_CACHE_FOLDER') . '</span></span>'; } $html .= '</div>'; return $html; }
<?php /** * @version $Id: default.php 20196 2011-01-09 02:40:25Z ian $ * @package Joomla.Site * @subpackage mod_menu * @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; $app = JFactory::getApplication(); $template = $app->getTemplate(); require_once JPATH_THEMES . DS . $template . DS . 'includes' . DS . 'lib' . DS . 'jsn_utils.php'; $jsn_utils = JSNUtils::getInstance(); // Note. It is important to remove spaces between elements. ?> <ul class="<?php echo $class_sfx; ?> "<?php $tag = ''; if ($params->get('tag_id') != NULL) { $tag = $params->get('tag_id') . ''; echo ' id="' . $tag . '"'; } ?> > <?php $count = 1;
/** * * Initialize instance of JSNUtils class */ function _setUtilsInstance() { $this->_obj_utils = JSNUtils::getInstance(); }
function socketDownload() { /** * When it come across this point from a JSNDownloadPackage instance, * the fsockopen will always be used, not cURL nor fOPEN */ $objJSNUtil = JSNUtils::getInstance(); if (!function_exists('fsockopen')) { if ($objJSNUtil->cURLCheckFunctions()) { return $this->cURLDownload(); } elseif ($objJSNUtil->fOPENCheck()) { return $this->fOPENDownload(); } else { return false; } } $crlf = "\r\n"; $response = ''; $data = ''; if (is_array($this->_data) && count($this->_data) > 0) { $data = array(); while (list($n, $v) = each($this->_data)) { $data[] = "{$n}={$v}"; } $data = implode('&', $data); $contentType = "Content-type: application/x-www-form-urlencoded" . $crlf; } else { $data = $this->_data; $contentType = "Content-type: text/xml" . $crlf; } if (is_null($this->_referer)) { $referer = JURI::root(); } $this->_fp = @fsockopen(($this->_protocol == 'https' ? 'ssl://' : '') . $this->_host, $this->_port, $errno, $errstr); if ($this->_fp === false) { return false; } if ($this->_method == 'post') { $req = 'POST ' . $this->_uri . ' HTTP/1.1' . $crlf . 'Host: ' . $this->_host . $crlf . 'Referer: ' . $referer . $crlf . $contentType . 'Content-length: ' . strlen($data) . $crlf . 'Connection: close' . $crlf . $crlf . $data; } elseif ($this->_method == 'get') { $req = 'GET ' . $this->_uri . $this->_query . ' HTTP/1.1' . $crlf . 'Host: ' . $this->_host . $crlf . 'Connection: close' . $crlf . $crlf; @fwrite($this->_fp, $req); } while (is_resource($this->_fp) && $this->_fp && !feof($this->_fp)) { $response .= fread($this->_fp, 1024); } @fclose($this->_fp); $pos = @strpos($response, $crlf . $crlf); if ($pos === false) { return $response; } $header = substr($response, 0, $pos); $body = substr($response, $pos + 2 * strlen($crlf)); $headers = array(); $lines = explode($crlf, $header); foreach ($lines as $line) { if (($pos = strpos($line, ':')) !== false) { $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos + 1)); } } /* Modify a bit for sample data extension installing */ if (isset($headers['location']) && $this->_nofollow !== true) { $http = new JSNHTTPSocket($headers['location'], $this->_data, $this->_referer, $this->_method); return $http->socketDownload(); } else { return $body; } }
protected function getInput() { require_once dirname(dirname(__FILE__)) . DS . 'includes' . DS . 'lib' . DS . 'jsn_utils.php'; $jsnUtils = JSNUtils::getInstance(); $templateName = $jsnUtils->getTemplateName(); /* Form the internal path to default template logo */ $defaultLogoPath = ''; if (strpos($this->name, 'mobileLogoPath') !== false) { $defaultLogoPath = 'templates/' . $templateName . '/images/logo-m.png'; } elseif (strpos($this->name, 'logoPath') !== false) { $defaultLogoPath = 'templates/' . $templateName . '/images/logo.png'; } if ($this->value == '') { $this->value = $defaultLogoPath; } $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id'; $authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by'; $asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id']; $disabled = (string) $this->element['disabled'] == 'true' ? true : false; // check System Cache Plugin $cacheSensitive = JSN_CACHESENSITIVE && (string) $this->element['cachesensitive'] == 'yes'; if ($cacheSensitive) { $disabled = true; } if ($asset == "") { $asset = JRequest::getCmd('option'); } $link = (string) $this->element['link']; if (!self::$initialised) { // Load the modal behavior script. JHtml::_('behavior.modal'); // Build the script. $script = array(); $script[] = ' function jInsertFieldValue(value, id) {'; $script[] = ' var old_id = document.id(id).value;'; $script[] = ' if (old_id != id) {'; $script[] = ' var elem = document.id(id)'; $script[] = ' elem.value = value;'; $script[] = ' elem.fireEvent("change");'; $script[] = ' }'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); self::$initialised = true; } // Initialize variables. $html = array(); $attr = ''; // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $attr .= $disabled ? ' disabled="disabled"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; // The text field. $html[] = '<div class="fltlft">'; $html[] = ' <input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . ' readonly="readonly"' . $attr . ' />'; $html[] = '</div>'; $directory = (string) $this->element['directory']; if ($this->value == $defaultLogoPath) { $folder = ''; } elseif (file_exists(JPATH_ROOT . '/' . $this->value)) { $folder = explode('/', $this->value); array_shift($folder); array_pop($folder); $folder = implode('/', $folder); } elseif (file_exists(JPATH_ROOT . '/images/' . $directory)) { $folder = $directory; } else { $folder = ''; } // The button. $unactived = $disabled ? ' jsn-disabled-button' : ''; $ref = $disabled ? '' : ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}"'; $href = $disabled ? ' href="javascript:void(0);"' : ' href="' . ($this->element['readonly'] ? '' : ($link ? $link : 'index.php?option=com_media&view=images&tmpl=component&asset=' . $asset . '&author=' . $this->form->getValue($authorField)) . '&fieldid=' . $this->id . '&folder=' . $folder) . '"'; $modal = $disabled ? '' : ' class="modal"'; $html[] = '<div class="button2-left' . $unactived . '">'; $html[] = ' <div class="blank">'; $html[] = ' <a' . $modal . ' title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '"' . $href . $ref . '>'; $html[] = ' ' . JText::_('JLIB_FORM_BUTTON_SELECT') . '</a>'; $html[] = ' </div>'; $html[] = '</div>'; $html[] = '<div class="button2-left' . $unactived . '">'; $html[] = ' <div class="blank">'; $html[] = ' <a title="' . JText::_('LOGO_BUTTON_DEFAULT') . '"' . ' href="javascript:void(0);"' . ' onclick="document.getElementById(\'' . $this->id . '\').value=\'' . htmlspecialchars($defaultLogoPath, ENT_COMPAT, 'UTF-8') . '\';">'; $html[] = ' ' . JText::_('LOGO_BUTTON_DEFAULT') . '</a>'; $html[] = ' </div>'; $html[] = '</div>'; return implode("\n", $html); }