コード例 #1
0
ファイル: helper.php プロジェクト: RangerWalt/ecci
 /**
  * internal function to generate a new href link
  * @param	TableJFLanguage	the language
  * @return	string	new href string
  */
 function _createHRef($language, $modparams)
 {
     // NB I pass the language in order to ensure I use the standard language cache files
     $db = JFactory::getDBO();
     $pfunc = $db->_profile();
     $uri = JURI::getInstance();
     $currenturl = $uri->toString();
     $code = $language->getLanguageCode();
     $app = JFactory::getApplication();
     $router = $app->getRouter();
     $vars = $router->getVars();
     $href = "index.php";
     $hrefVars = '';
     // set lang to correct value
     $vars['lang'] = $code;
     $filter =& JFilterInput::getInstance();
     foreach ($vars as $k => $v) {
         if ($hrefVars != "") {
             $hrefVars .= "&";
         }
         if (is_array($v)) {
             $arrayValue = $filter->clean($v, 'array');
             $arrayVars = '';
             foreach (array_keys($arrayValue) as $akey) {
                 if ($arrayVars != '') {
                     $arrayVars .= "&";
                 }
                 $arrayVars .= $k . '[' . $akey . ']=' . $filter->clean($arrayValue[$akey]);
             }
             $hrefVars .= $arrayVars;
         } else {
             $hrefVars .= $k . '=' . $filter->clean($v);
         }
     }
     // Add the existing variables
     if ($hrefVars != "") {
         $href .= '?' . $hrefVars;
     }
     $params = JComponentHelper::getParams("com_joomfish");
     if ($modparams->get("cache_href", 1) && $params->get("transcaching", 1)) {
         $jfm = JoomFishManager::getInstance();
         $cache = $jfm->getCache($language->code);
         $url = $cache->get(array("JFModuleHTML", '_createHRef2'), array($currenturl, $href, $code));
     } else {
         $url = JFModuleHTML::_createHRef2($currenturl, $href, $code);
     }
     $db->_profile($pfunc);
     return $url;
 }