/** * Passes a string thru an printf * * @access public * @param format The format string * @param mixed Mixed number of arguments for the sprintf function * @since 1.5 */ function printf($string) { $lang =& shjlang16Helper::getLanguage(); $args = func_get_args(); if (count($args) > 0) { $args[0] = $lang->_($args[0]); return call_user_func_array('printf', $args); } return ''; }
die('Direct Access to this location is not allowed.'); } // Ensure that user has access to this function. $user =& JFactory::getUser(); if (!($user->usertype == 'Super Administrator' || $user->usertype == 'Administrator')) { $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH')); } // Setup paths. $sef_config_class = JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php'; $sef_config_file = JPATH_ADMINISTRATOR . '/components/com_sh404sef/config/config.sef.php'; // Make sure class was loaded. if (!class_exists('shSEFConfig')) { if (is_readable($sef_config_class)) { require_once $sef_config_class; } else { JError::RaiseError(500, COM_SH404SEF_NOREAD . "( {$sef_config_class} )<br />" . COM_SH404SEF_CHK_PERMS); } } // testing JLanguage16 jimport('joomla.language.language'); $j16Language =& shjlang16Helper::getLanguage(); $loaded = $j16Language->load('com_sh404sef', JPATH_BASE); // include sh404sef default language file shIncludeLanguageFile(); // find about specific controller requested $cName = JRequest::getCmd('c'); // get controller from factory $controller = Sh404sefFactory::getController($cName); // read and execute task $controller->execute(JRequest::getCmd('task')); $controller->redirect();
function shSetJfLanguage($requestlang) { if (empty($requestlang)) { return; } // get instance of JoomFishManager to obtain active language list and config values $jfm =& JoomFishManager::getInstance(); $activeLanguages = $jfm->getActiveLanguages(); // get the name of the language file for joomla $jfLang = TableJFLanguage::createByShortcode($requestlang, true); // set Joomfish stuff // Get the global configuration object global $mainframe; $registry =& JFactory::getConfig(); $params = $registry->getValue("jfrouter.params"); $enableCookie = empty($params) ? 1 : $params->get('enableCookie', 1); if ($enableCookie) { setcookie("lang", "", time() - 1800, "/"); setcookie("jfcookie", "", time() - 1800, "/"); setcookie("jfcookie[lang]", $jfLang->shortcode, time() + 24 * 3600, '/'); } $GLOBALS['iso_client_lang'] = $jfLang->shortcode; $GLOBALS['mosConfig_lang'] = $jfLang->code; $mainframe->setUserState('application.lang', $jfLang->code); $registry->setValue("config.jflang", $jfLang->code); $registry->setValue("config.lang_site", $jfLang->code); $registry->setValue("config.language", $jfLang->code); $registry->setValue("joomfish.language", $jfLang); // Force factory static instance to be updated if necessary $lang =& JFactory::getLanguage(); if ($jfLang->code != $lang->getTag()) { $lang = JFactory::_createLanguage(); } $lang16 =& shjlang16Helper::getLanguage(); if ($jfLang->code != $lang16->getTag()) { $lang16 = Jlanguage16::createLanguage(); } // overwrite with the valued from $jfLang $params = new JParameter($jfLang->params); $paramarray = $params->toArray(); foreach ($paramarray as $key => $val) { $registry->setValue("config." . $key, $val); if (defined("_JLEGACY")) { $name = 'mosConfig_' . $key; $GLOBALS[$name] = $val; } } // set our own data $GLOBALS['shMosConfig_lang'] = $lang->get('backwardlang', 'english'); $GLOBALS['shMosConfig_locale'] = $jfLang->code; $GLOBALS['shMosConfig_shortcode'] = $jfLang->shortcode; }
// no direct access defined('_JEXEC') or die('Restricted access'); // define path to sh404SEF front and backend dirs require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_sh404sef' . DS . 'defines.php'; // Ensure that user has access to this function. $user =& JFactory::getUser(); if (!($user->usertype == 'Super Administrator' || $user->usertype == 'Administrator')) { // no display if not allowed return; } $lang =& JFactory::getLanguage(); $app =& JFactory::getApplication(); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::root() . 'administrator/modules/mod_sh404sef_cpicon/styles.css'); // load our text strings $lang =& shjlang16Helper::getLanguage(); $lang->load('mod_sh404sef_cpicon'); // is an update available? $versionsInfo = Sh404sefHelperUpdates::getUpdatesInfos(); $updateText = $versionsInfo->shouldUpdate ? '<br /><font color="red">' . JText16::_('COM_SH404SEF_UPDATE_REQUIRED') . '</font>' : '<br /><font color="green">' . JText16::_('COM_SH404SEF_UPDATE_NOT_REQUIRED') . '</font>'; ?> <div id="modsh404_cpanel" style="float:<?php echo $lang->isRTL() ? 'right' : 'left'; ?> ;"> <div class="icon"> <a href="index.php?option=com_sh404sef"> <img src="components/com_sh404sef/assets/images/icon-48-analytics.png" title="sh404sef & Analytics" alt="sh404sef & Analytics" />
/** * Parse XML file for language information. * * @param string $path Path to the xml files * @return array Array holding the found metadata as a key => value pair * @since 1.5 */ public static function _parseXMLLanguageFile($path) { // Try to load the file /*if (!$xml = JFactory::getXML($path)) { return null; }*/ // shumisha : JFactory::getXML() does not exist in J! 1.5 if (!($xml = shjlang16Helper::_getXML($path))) { return null; } // Check that it's a metadata file if ((string) $xml->getName() != 'metafile') { return null; } $metadata = array(); foreach ($xml->metadata->children() as $child) { $metadata[$child->getName()] = (string) $child; } return $metadata; }