function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     // Don't SEF URLs with "return" variable
     if (!empty($return)) {
         return $uri;
     }
     $title = array();
     $title[] = JoomSEF::_getMenuTitle(@$option, null, @$Itemid);
     if (isset($task)) {
         if ($task == 'register') {
             $title[] = JText::_('Register');
             unset($task);
         }
         /*if($task=='activate') {
           	$title[]=$vars['activation'];
           }*/
     }
     if (!empty($view)) {
         $title[] = JText::_($view);
     }
     if (!empty($layout)) {
         $title[] = JText::_($layout);
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $this->_createNonSefVars($uri);
         $newUri = JoomSEF::_sefGetLocation($uri, $title, @$task, null, null, @$lang, $this->nonSefVars);
     }
     return $newUri;
 }
示例#2
0
 function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     $title = array();
     $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid);
     $newUri = $uri;
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang);
     }
     return $newUri;
 }
 function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     $title = array();
     $profile_name = $this->getAiContactSafeProfileName($pf);
     if (strlen(trim($profile_name)) > 0) {
         $title[] = $profile_name;
     } else {
         $title[] = JoomSEF::_getMenuTitle(@$option, null, @$Itemid);
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang);
     }
     return $newUri;
 }
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $params = SEFTools::GetExtParams('com_content');
     $vars = $uri->getQuery(true);
     extract($vars);
     // Set title.
     $title = array();
     $title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid);
     if (!empty($tmpl)) {
         $title[] = $tmpl;
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $this->_createNonSefVars($uri);
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, $this->ignoreVars);
     }
     return $newUri;
 }
示例#5
0
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $this->params =& SEFTools::getExtParams('com_banners');
     $vars = $uri->getQuery(true);
     extract($vars);
     $title[] = JoomSEF::_getMenuTitleLang(@$option, @$task, @$Itemid);
     switch (@$task) {
         case 'click':
             $title[] = $this->GetBannerName($id);
             unset($task);
             break;
     }
     $newUri = $uri;
     if (isset($this->lang)) {
         $lang = $this->lang;
     }
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, @$task, null, null, @$lang);
     }
     return $newUri;
 }
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $mainframe =& JFactory::getApplication();
     $this->params =& SEFTools::GetExtParams('com_content');
     $vars = $uri->getQuery(true);
     extract($vars);
     // Do not SEF URLs with exturl variable
     //if( !empty($exturl) )   return $string;
     // Do not SEF edit urls
     if (isset($task) && $task == 'edit') {
         return $uri;
     }
     // Set title.
     $title = array();
     switch (@$view) {
         case 'new':
         case 'edit':
             /*
             $title[] = getMenuTitle($option, $task, $Itemid, $string);
             $title[] = 'new' . $sefConfig->suffix;
             */
             break;
         case 'archive':
             $title[] = JText::_($view);
             if (!empty($year)) {
                 $title[] = $year;
             }
             if (!empty($month)) {
                 $title[] = $month;
             }
             break;
             /*
             case 'archivecategory':
             case 'archivesection': {
             if (eregi($task.".*id=".$id, $_SERVER['REQUEST_URI'])) break;
             }
             */
         /*
         case 'archivecategory':
         case 'archivesection': {
         if (eregi($task.".*id=".$id, $_SERVER['REQUEST_URI'])) break;
         }
         */
         default:
             if (isset($format)) {
                 if ($format == 'pdf') {
                     // wrong ID
                     if (intval($id) == 0) {
                         return $uri;
                     }
                     // create PDF
                     $title = $this->_getContentTitles(!empty($view) ? $view : 'article', $id);
                     if (count($title) === 0) {
                         $title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid);
                     }
                     // Add Google News number if set to
                     if (@$view == 'article' && $this->params->get('googlenewsnum', '0') != '0') {
                         $i = count($title) - 1;
                         $title[$i] = $this->GoogleNews($title[$i], $id);
                     }
                     $title[] = JText::_('PDF');
                 } elseif ($format == 'feed') {
                     // Create feed
                     if (@$view != 'frontpage') {
                         // wrong ID
                         if (intval($id) == 0) {
                             return $uri;
                         }
                         $title = $this->_getContentTitles(!empty($view) ? $view : 'article', $id);
                         // Add Google News number if set to
                         if (@$view == 'article' && $this->params->get('googlenewsnum', '0') != '0') {
                             $i = count($title) - 1;
                             $title[$i] = $this->GoogleNews($title[$i], $id);
                         }
                     }
                     if (count($title) === 0 && empty($type)) {
                         $title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid);
                     }
                     if (!empty($type)) {
                         $title[] = $type;
                     }
                 }
             } else {
                 if (isset($id)) {
                     // wrong ID
                     if (intval($id) == 0) {
                         return $uri;
                     }
                     $title = $this->_getContentTitles(@$view, @$id);
                     if (count($title) === 0) {
                         $title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid);
                     }
                     // Add Google News number if set to
                     if (@$view == 'article' && $this->params->get('googlenewsnum', '0') != '0') {
                         $i = count($title) - 1;
                         $title[$i] = $this->GoogleNews($title[$i], $id);
                     }
                 } else {
                     $title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid);
                     //$title[] = JText::_('Submit');
                 }
                 // Layout
                 $addLayout = $this->params->get('add_layout', '2');
                 if (isset($layout) && !empty($layout) && $addLayout != '0') {
                     if ($addLayout == '2') {
                         $defLayout = $this->params->get('def_layout', 'default');
                         if ($layout != $defLayout) {
                             $title[] = $layout;
                         }
                     } else {
                         $title[] = $layout;
                     }
                 }
                 if (isset($limitstart) && (!$sefConfig->appendNonSef || $this->params->get('pagination', '0') == '0')) {
                     $pagetext = null;
                     if (@$view == 'article') {
                         // Multipage article - get the correct page title
                         $page = $limitstart + 1;
                         if ($this->params->get('multipagetitles', '1') == '1') {
                             $pagetext = $this->_getPageTitle($limitstart);
                         }
                     } else {
                         // Is limit set?
                         if (!isset($limit)) {
                             // Try to get limit from menu parameters
                             $menu =& JSite::getMenu();
                             if (!isset($Itemid)) {
                                 // We need to find Itemid first
                                 $active =& $menu->getActive();
                                 $Itemid = $active->id;
                             }
                             $menuParams =& $menu->getParams($Itemid);
                             $leading = $menuParams->get('num_leading_articles', 1);
                             $intro = $menuParams->get('num_intro_articles', 4);
                             $links = $menuParams->get('num_links', 4);
                             if (isset($layout) && $layout == 'blog') {
                                 $limit = $leading + $intro;
                                 // + $links;
                             } else {
                                 $limit = $menuParams->get('display_num', $mainframe->getCfg('list_limit'));
                                 $limit = $mainframe->getUserStateFromRequest('com_content.' . $uri->getVar('layout', 'default') . '.limit', 'limit', $limit, 'int');
                             }
                         }
                         $page = intval($limitstart / $limit) + 1;
                     }
                     if (is_null($pagetext)) {
                         $pagetext = strval($page);
                         if ($cnfPageText = $sefConfig->getPageText()) {
                             $pagetext = str_replace('%s', $page, $cnfPageText);
                         }
                     }
                     $title = array_merge($title, explode('/', $pagetext));
                     //$title[] = $pagetext;
                 }
                 // show all
                 if (isset($showall) && $showall == 1) {
                     $title[] = JText::_('All Pages');
                 }
                 // print article
                 if (isset($print) && $print == 1) {
                     $title[] = JText::_('Print') . (!empty($page) ? '-' . ($page + 1) : '');
                 }
             }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $metatags = $this->getMetaTags();
         if (isset($this->metatitle)) {
             $metatags['metatitle'] = $this->metatitle;
         }
         $this->_createNonSefVars($uri);
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars, null, $metatags, $priority, true, null, $sitemap);
     }
     return $newUri;
 }
示例#7
0
 function build(&$uri)
 {
     $mainframe =& JFactory::getApplication();
     $config =& JFactory::getConfig();
     $sefConfig =& SEFConfig::getConfig();
     $cache =& SEFCache::getInstance();
     // trigger onSefStart patches
     $mainframe->triggerEvent('onSefStart');
     $prevLang = '';
     // for correct title translations
     // do not SEF URLs with tmpl=component if set to
     if (!$sefConfig->sefComponentUrls && $uri->getVar('tmpl') == 'component') {
         $mainframe->triggerEvent('onSefEnd');
         return;
     }
     // check if this is site root;
     // if site is root, do not do anything else
     // except if we have to set language every time
     $vars = $uri->getQuery(true);
     if (empty($vars) && (!SEFTools::JoomFishInstalled() || !$sefConfig->alwaysUseLang)) {
         // trigger onSefEnd patches
         $mainframe->triggerEvent('onSefEnd');
         $uri = new JURI(JURI::root());
         return;
     }
     // check URL for junk if set to
     if ($sefConfig->checkJunkUrls) {
         $junkWords =& $sefConfig->getJunkWords();
         $seferr = false;
         if (substr($uri->getVar('option', ''), 0, 4) != 'com_') {
             $seferr = true;
         } elseif (count($junkWords)) {
             $exclude =& $sefConfig->getJunkExclude();
             foreach ($vars as $key => $val) {
                 if (in_array($key, $exclude)) {
                     continue;
                 }
                 // Check junk words
                 foreach ($junkWords as $word) {
                     if (is_string($val)) {
                         if (strpos($val, $word) !== false) {
                             $seferr = true;
                             break;
                         }
                     }
                 }
                 if ($seferr) {
                     break;
                 }
             }
         }
         if ($seferr) {
             // trigger onSefEnd patches
             $mainframe->triggerEvent('onSefEnd');
             // fix the path
             $path = $uri->getPath();
             if ($path[0] != '/') {
                 $path = JURI::base(true) . '/' . $path;
                 $uri->setPath($path);
             }
             return;
         }
     }
     if (SEFTools::JoomFishInstalled()) {
         $lang = $uri->getVar('lang');
         // if lang not set
         if (empty($lang)) {
             if ($sefConfig->alwaysUseLang) {
                 // add lang variable if set to
                 $uri->setVar('lang', SEFTools::getLangCode());
             } else {
                 // delete lang variable so it is not empty
                 $uri->delVar('lang');
             }
         }
         // get the URL's language and set it as global language (for correct translation)
         $lang = $uri->getVar('lang');
         $code = '';
         if (!empty($lang)) {
             $code = SEFTools::getLangLongCode($lang);
             if (!is_null($code)) {
                 if ($code != SEFTools::getLangLongCode()) {
                     $language =& JFactory::getLanguage();
                     $prevLang = $language->setLanguage($code);
                     $language->load();
                 }
             }
         }
         // set the live_site according to language
         if ($sefConfig->langPlacement == _COM_SEF_LANG_DOMAIN) {
             $u =& JURI::getInstance();
             $curdomain = $sefdomain = $u->getHost();
             if (!empty($lang)) {
                 if (isset($sefConfig->jfSubDomains[$lang])) {
                     $sefdomain = $sefConfig->jfSubDomains[$lang];
                     //$uri->delVar('lang');
                 }
             }
             $config =& JFactory::getConfig();
             $config->setValue('joomfish.current_host', $curdomain);
             $config->setValue('joomfish.sef_host', $sefdomain);
         }
     }
     // if there are no variables and only single language is used
     $vars = $uri->getQuery(true);
     if (empty($vars) && !isset($lang)) {
         JoomSEF::_endSef($prevLang);
         return;
     }
     $option = $uri->getVar('option');
     if (!is_null($option)) {
         $params =& SEFTools::getExtParams($option);
         // Check the stop rule
         $stopRule = trim($params->get('stopRule', ''));
         if ($stopRule != '') {
             if (preg_match('/' . $stopRule . '/', $uri->toString()) > 0) {
                 // Don't SEF this URL
                 $uri = JoomSEF::_createUri($uri);
                 JoomSEF::_endSef($prevLang);
                 return;
             }
         }
         $handling = $params->get('handling', '0');
         switch ($handling) {
             // skipped extensions
             case '2':
                 // Check homepage
                 if (JoomSEF::_isHomePage($uri)) {
                     $lang = $uri->getVar('lang');
                     if (empty($lang)) {
                         $uri = new JURI('index.php');
                     } else {
                         $uri = new JURI('index.php?lang=' . $lang);
                     }
                 }
                 // Build URL
                 $uri = JoomSEF::_createUri($uri);
                 JoomSEF::_endSef($prevLang);
                 return;
                 // non-cached extensions
             // non-cached extensions
             case '1':
                 $router = JoomSEF::get('sef.global.jrouter');
                 if (!empty($router)) {
                     // Store language for later use
                     $uriLang = $uri->getVar('lang');
                     $uri->delVar('lang');
                     // Check homepage
                     if (JoomSEF::_isHomePage($uri)) {
                         $url = 'index.php';
                     } else {
                         $url = $uri->toString();
                     }
                     // Build URL
                     $uri = $router->build($url);
                     // Add language if needed
                     if (!is_null($uriLang)) {
                         $route = $uri->getPath();
                         $route = JoomSEF::_addLangToRoute($route, $uriLang);
                         $uri->setPath($route);
                     }
                 }
                 JoomSEF::_endSef($prevLang);
                 return;
                 // default handler or basic rewriting
             // default handler or basic rewriting
             default:
                 // if component has its own sef_ext plug-in included.
                 // however, prefer own plugin if exists (added by Michal, 28.11.2006)
                 $compExt = JPATH_ROOT . DS . 'components' . DS . $option . DS . 'router.php';
                 $ownExt = JPATH_ROOT . DS . 'components' . DS . 'com_sef' . DS . 'sef_ext' . DS . $option . '.php';
                 // compatible extension build block
                 if (file_exists($compExt) && !file_exists($ownExt) && $handling == '0') {
                     // Check homepage
                     if (JoomSEF::_isHomePage($uri)) {
                         $lang = $uri->getVar('lang');
                         if (empty($lang)) {
                             $uri = new JURI('index.php');
                         } else {
                             $uri = new JURI('index.php?lang=' . $lang);
                         }
                         // Build URL
                         $uri = JoomSEF::_createUri($uri);
                         JoomSEF::_endSef($prevLang);
                         return;
                     }
                     // load the plug-in file
                     require_once $compExt;
                     // Store the language for later use
                     $uriLang = $uri->getVar('lang');
                     $uri->delVar('lang');
                     $app =& JFactory::getApplication();
                     $menu =& JSite::getMenu();
                     $route = $uri->getPath();
                     $query = $uri->getQuery(true);
                     $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $query['option']);
                     $tmp = '';
                     $function = substr($component, 4) . 'BuildRoute';
                     $parts = $function($query);
                     $total = count($parts);
                     for ($i = 0; $i < $total; $i++) {
                         $parts[$i] = str_replace(':', '-', $parts[$i]);
                     }
                     $result = implode('/', $parts);
                     $tmp = $result != "" ? '/' . $result : '';
                     // build the application route
                     $built = false;
                     if (isset($query['Itemid']) && !empty($query['Itemid'])) {
                         $item = $menu->getItem($query['Itemid']);
                         if (is_object($item) && $query['option'] == $item->component) {
                             $tmp = !empty($tmp) ? $item->route . $tmp : $item->route;
                             $built = true;
                         }
                     }
                     if (!$built) {
                         $tmp = 'component/' . substr($query['option'], 4) . $tmp;
                     }
                     $route .= '/' . $tmp;
                     if ($app->getCfg('sef_suffix') && !(substr($route, -9) == 'index.php' || substr($route, -1) == '/')) {
                         if ($format = $uri->getVar('format', 'html')) {
                             $route .= '.' . $format;
                             $uri->delVar('format');
                         }
                     }
                     if ($app->getCfg('sef_rewrite')) {
                         // transform the route
                         $route = str_replace('index.php/', '', $route);
                     }
                     // Unset unneeded query information
                     unset($query['Itemid']);
                     unset($query['option']);
                     // Add language to route if needed
                     if (!is_null($uriLang)) {
                         $route = JoomSEF::_addLangToRoute($route, $uriLang);
                     }
                     //Set query again in the URI
                     $uri->setQuery($query);
                     $uri->setPath($route);
                     $uri = JoomSEF::_createUri($uri);
                     JoomSEF::_endSef($prevLang);
                     return;
                 } else {
                     if ($handling == '3') {
                         // Basic rewriting
                         $class = 'SefExt_Basic';
                     } else {
                         if (file_exists($ownExt)) {
                             $class = 'SefExt_' . $option;
                             require_once $ownExt;
                             if (!class_exists($class)) {
                                 $class = 'SefExt';
                             }
                         } else {
                             $class = 'SefExt';
                         }
                     }
                     $sef_ext = new $class();
                     // Set currently handled URI
                     $sef_ext->setCurrentUri($uri);
                     // Let the extension change the url and options
                     $origUri = clone $uri;
                     $sef_ext->beforeCreate($uri);
                     // Ensure that the session IDs are removed
                     // If set to
                     $sid = $uri->getVar('sid');
                     if (!$sefConfig->dontRemoveSid) {
                         $uri->delVar('sid');
                     }
                     // Ensure that the mosmsg are removed.
                     $mosmsg = $uri->getVar('mosmsg');
                     $uri->delVar('mosmsg');
                     // override Itemid if set to
                     $override = $params->get('itemid', '0');
                     $overrideId = $params->get('overrideId', '');
                     if ($override != '0' && $overrideId != '') {
                         $uri->setVar('Itemid', $overrideId);
                     }
                     // clean Itemid if desired
                     // David: only if overriding is disabled
                     if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $override == '0') {
                         $Itemid = $uri->getVar('Itemid');
                         $uri->delVar('Itemid');
                     }
                     // Get nonsef and ignore vars from extension
                     list($nonSefVars, $ignoreVars) = $sef_ext->getNonSefVars($uri);
                     // Create array of all the non sef vars
                     $nonSefVars = SEFTools::getNonSefVars($uri, $nonSefVars, $ignoreVars);
                     // Create a copy of JURI object
                     $uri2 = clone $uri;
                     // Remove nonsef variables from our JURI copy
                     $nonSefUrl = SEFTools::RemoveVariables($uri2, array_keys($nonSefVars));
                     // Check homepage
                     if (JoomSEF::_isHomePage($uri2, true)) {
                         // Create homepage SEF URL without non-SEF variables
                         $title = array();
                         $data = JoomSEF::_sefGetLocation($uri2, $title, null, null, null, $uri->getVar('lang'));
                         $uri = JoomSEF::_storeLocation($data);
                         // Add non-SEF variables
                         $uri->setQuery($nonSefUrl);
                         JoomSEF::_endSef($prevLang);
                         return;
                     }
                     if (!SEFTools::JoomFishInstalled()) {
                         $titlepage = false;
                         $subdomain = SEFTools::getSubdomain($origUri, $titlepage);
                         if (strlen($subdomain)) {
                             $uri->setHost($subdomain . "." . JFactory::getURI()->getHost());
                         }
                     }
                     $url = JoomSEF::_uriToUrl($uri2);
                     // try to get url from cache
                     $sefUrl = false;
                     if ($sefConfig->useCache) {
                         $sefUrl = $cache->GetSefUrl($url);
                     }
                     if (!$sefConfig->useCache || !$sefUrl) {
                         // check if the url is already saved in the database
                         $sefUrl = $sef_ext->getSefUrlFromDatabase($uri2);
                         if (is_string($sefUrl)) {
                             // Backward compatibility
                             $sefstring = $sefUrl;
                             $sefUrl = new stdClass();
                             $sefUrl->sefurl = $sefstring;
                             $sefUrl->sef = 1;
                         }
                     }
                     if (!$sefUrl) {
                         // rewrite the URL, creating new JURI object
                         $data = $sef_ext->create($uri);
                         if (is_object($data) && is_a($data, 'JURI')) {
                             // Backwards compatibility
                             $uri = $data;
                         } else {
                             // Handle subdomains
                             if (!SEFTools::JoomFishInstalled()) {
                                 if (!isset($data["host"])) {
                                     $comp_host = $sef_ext->getParam('subdomain');
                                     if (!strlen($comp_host) && strlen($subdomain)) {
                                         $data["host"] = $uri->getHost();
                                     } else {
                                         if (strlen($comp_host)) {
                                             $data["host"] = $comp_host . "." . JFactory::getURI()->getHost();
                                         }
                                     }
                                 } else {
                                     $data["host"] = null;
                                 }
                             }
                             if ($titlepage) {
                                 $data["title"] = array();
                             }
                             $uri = JoomSEF::_storeLocation($data);
                         }
                     } else {
                         // if SEF is disabled, don't SEF
                         if (isset($sefUrl->sef) && !$sefUrl->sef) {
                             $uri = JoomSEF::_createUri($uri);
                             JoomSEF::_endSef($prevLang);
                             return;
                         }
                         // Create new JURI object from $sefstring
                         if (!strlen($sefUrl->host)) {
                             $root = JFactory::getUri()->toString(array('host', 'port'));
                         } else {
                             $root = $sefUrl->host;
                         }
                         $url = JFactory::getURI()->getScheme() . "://" . $root . JURI::root(true);
                         if (substr($url, -1) != '/') {
                             $url .= '/';
                         }
                         $url .= $sefUrl->sefurl;
                         // Add nonSef part if set
                         if (!empty($nonSefUrl)) {
                             $url .= '?' . $nonSefUrl;
                         }
                         // Add fragment if set
                         $fragment = $uri->getFragment();
                         if (!empty($fragment)) {
                             $url .= '#' . $fragment;
                         }
                         $uri = new JURI($url);
                     }
                     // reconnect the sid to the url
                     if (!empty($sid) && !$sefConfig->dontRemoveSid) {
                         $uri->setVar('sid', $sid);
                     }
                     // reconnect mosmsg to the url
                     if (!empty($mosmsg)) {
                         $uri->setVar('mosmsg', $mosmsg);
                     }
                     // reconnect ItemID to the url
                     // David: only if extension doesn't set its own Itemid through overrideId parameter
                     if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $sefConfig->reappendSource && $override == '0' && !empty($Itemid)) {
                         $uri->setVar('Itemid', $Itemid);
                     }
                     // let the extension change the resulting SEF url
                     $sef_ext->afterCreate($uri);
                 }
         }
     } else {
         if (!is_null($uri->getVar('Itemid'))) {
             // there is only Itemid present - we must override the Ignore multiple sources option
             $oldIgnore = $sefConfig->ignoreSource;
             $sefConfig->ignoreSource = 0;
             $title = array();
             $title[] = JoomSEF::_getMenuTitle(null, null, $uri->getVar('Itemid'));
             $data = JoomSEF::_sefGetLocation($uri, $title, null, null, null, $uri->getVar('lang'));
             $uri = JoomSEF::_storeLocation($data);
             $sefConfig->ignoreSource = $oldIgnore;
         }
     }
     JoomSEF::_endSef($prevLang);
 }
示例#8
0
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $vars = $uri->getQuery(true);
     extract($vars);
     $title[] = JoomSEF::_getMenuTitleLang($option, $this->lang, @$Itemid);
     switch (@$view) {
         case 'categories':
             break;
         case 'category':
             $catInfo = $this->getCategoryInfo($id);
             if ($catInfo === false) {
                 JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_weblinks');
             }
             if (is_array($catInfo->path)) {
                 $title = array_merge($title, $catInfo->path);
             }
             break;
         case 'form':
             if (isset($w_id)) {
                 $title = array_merge($title, $this->getWeblinkTitle(@$w_id));
             }
             break;
         case 'weblink':
             if (!empty($id)) {
                 $title = array_merge($title, $this->getWeblinkTitle($id));
             } else {
                 if ($this->params->get('always_en', '0') == '1') {
                     $title[] = 'Submit';
                 } else {
                     $title[] = JText::_('COM_SEF_SUBMIT');
                 }
             }
             break;
     }
     switch (@$task) {
         case 'weblink.go':
             if (!empty($id)) {
                 $title = array_merge($title, $this->getWeblinkTitle($id));
             } else {
                 if ($this->params->get('always_en', '0') == '1') {
                     $title[] = 'Submit';
                 } else {
                     $title[] = JText::_('COM_SEF_SUBMIT');
                 }
             }
             break;
         case 'new':
             $title[] = 'new' . $sefConfig->suffix;
             break;
         case 'weblink.edit':
             $title = array_merge($title, $this->getWeblinkTitle(@$w_id));
             if ($this->params->get('always_en', '0') == '1') {
                 $title[] = 'Edit';
             } else {
                 $title[] = JText::_('COM_SEF_EDIT');
             }
             if (@$return) {
                 $nonSefVars['return'] = $return;
             }
             break;
     }
     if (@$format) {
         if ($format == 'feed' && @$type) {
             $title[] = ucfirst($type);
         } else {
             $title[] = ucfirst($format);
         }
     }
     $newUri = $uri;
     if (count($title)) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, @$nonSefVars, null, $this->metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
示例#9
0
 public function create(&$uri)
 {
     $this->metadesc = null;
     $this->cat_desc = null;
     $this->item_desc = null;
     $sefConfig =& SEFConfig::getConfig();
     $title = array();
     $vars = $uri->getQuery(true);
     extract($vars);
     $this->_createNonSefVars($uri);
     // Set title.
     $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid);
     switch (@$view) {
         case 'form':
             // 13.2.2012, dajo: Don't SEF
             return $uri;
             //$this->nonSefVars = array();
             //$this->nonSefVars["return"]=@$return;
             //if(isset($a_id)) {
             //    $title=array_merge($title,$this->_getArticle($a_id));
             //}
             //$title[] = JText::_('COM_SEF_FORM');
             //break;
         //$this->nonSefVars = array();
         //$this->nonSefVars["return"]=@$return;
         //if(isset($a_id)) {
         //    $title=array_merge($title,$this->_getArticle($a_id));
         //}
         //$title[] = JText::_('COM_SEF_FORM');
         //break;
         case 'featured':
             if (isset($format) && $format == "feed") {
                 @($title[] = $type);
             }
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         case 'categories':
             break;
         case 'category':
             if (isset($id)) {
                 $catInfo = $this->getCategoryInfo($id);
                 if ($catInfo === false) {
                     JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_content');
                     return $uri;
                 }
                 if (is_array($catInfo->path) && count($catInfo->path) > 0) {
                     $title = array_merge($title, $catInfo->path);
                 }
             }
             if ($this->params->get('add_layout') == 2 || $this->params->get('add_layout') == 1 && $this->params->get('def_layout') != @$layout) {
                 @($title[] = $layout);
             }
             if (isset($format) && $format == "feed") {
                 @($title[] = $type);
             }
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         case 'article':
             $articleInfo = $this->_getArticle($id);
             if (!$articleInfo) {
                 return $uri;
             }
             $title = array_merge($title, $articleInfo);
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         case 'archive':
             if (!empty($year)) {
                 $title[] = $year;
             }
             if (!empty($month)) {
                 $title[] = $month;
             }
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         default:
             switch (@$task) {
                 case 'article.add':
                     if (isset($catid)) {
                         $catInfo = $this->getCategoryInfo($catid);
                         if ($catInfo === false) {
                             JoomSefLogger::Log("Category with ID {$catid} could not be found.", $this, 'com_content');
                             return $uri;
                         }
                         if (is_array($catInfo->path) && count($catInfo->path) > 0) {
                             $title = array_merge($title, $catInfo->path);
                         }
                     }
                     if ($this->params->get('always_en', '0') == '1') {
                         $title[] = 'New';
                     } else {
                         $title[] = JText::_('COM_SEF_NEW');
                     }
                     break;
                 case 'article.edit':
                     if (isset($a_id)) {
                         $title = array_merge($title, $this->_getArticle($a_id));
                     }
                     if ($this->params->get('always_en', '0') == '1') {
                         $title[] = 'Edit';
                     } else {
                         $title[] = JText::_('COM_SEF_EDIT');
                     }
                     break;
                 default:
                     // Don't SEF
                     return $uri;
             }
             break;
     }
     // Handle printing
     if (isset($print) && intval($print) == 1) {
         if ($this->params->get('always_en', '0') == '1') {
             $title[] = 'Print';
         } else {
             $title[] = JText::_('JGLOBAL_PRINT');
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         if ($this->params->get('meta_titlepage', '0') == '1' && !empty($this->pageNumberText)) {
             // Add page number to page title
             if (!empty($this->metatags["metatitle"])) {
                 $this->metatags["metatitle"] .= ' - ' . $this->pageNumberText;
             } else {
                 $this->metatags["metatitle"] = (!empty($this->pageTitle) ? $this->pageTitle . ' - ' : '') . $this->pageNumberText;
             }
         }
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars, null, $this->metatags, $priority, true, null, $sitemap);
     }
     return $newUri;
 }
示例#10
0
 function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     $title = array();
     if ($this->params->get('showMenuTitle', '1') == '1') {
         $title[] = JoomSEF::_getMenuTitleLang($uri->getVar('option'), @$lang, $uri->getVar('Itemid'));
     } else {
         $title[] = substr($uri->getVar('option'), 4);
     }
     $noAdd = array('option', 'lang', 'Itemid');
     foreach ($vars as $name => $value) {
         if (in_array($name, $noAdd)) {
             continue;
         }
         // Arrays support
         $this->_addValue($title, $value);
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang);
     }
     return $newUri;
 }
示例#11
0
 function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     $this->_createNonSefVars($uri);
     $this->_prepareTexts();
     $title = array();
     $title[] = JoomSEF::_getMenuTitleLang(@$option, $lang, @$Itemid);
     if (!empty($view)) {
         if ($this->params->get('always_en', '0') == '1') {
             $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $view)];
         } else {
             $title[] = JText::_('COM_SEF_USERS_' . $view);
         }
     }
     if (!empty($layout)) {
         if ($this->params->get('always_en', '0') == '1') {
             $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $layout)];
         } else {
             $title[] = JText::_('COM_SEF_USERS_' . $layout);
         }
     }
     if (!empty($task)) {
         $tasks = explode('.', $task);
         if ($tasks[0] == 'profile') {
             if (isset($user_id)) {
                 $title[] = $this->GetUserName($user_id);
             }
         } else {
             if ($this->params->get('always_en', '0') == '1') {
                 $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $tasks[0])];
             } else {
                 $title[] = JText::_('COM_SEF_USERS_' . $tasks[0]);
             }
         }
         if (isset($tasks[1])) {
             if ($tasks[1] == 'remind') {
                 $tasks[1] = 'submit';
             }
             if ($this->params->get('always_en', '0') == '1') {
                 $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $tasks[1])];
             } else {
                 $title[] = JText::_('COM_SEF_USERS_' . $tasks[1]);
             }
             if (in_array($tasks[1], array('confirm', 'complete'))) {
                 if ($this->params->get('always_en', '0') == '1') {
                     $title[] = self::$textsEn['COM_SEF_USERS_SUBMIT'];
                 } else {
                     $title[] = JText::_('COM_SEF_USERS_SUBMIT');
                 }
             }
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars);
     }
     return $newUri;
 }
 function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     $this->params =& SEFTools::getExtParams('com_search');
     $newUri = $uri;
     if (!(isset($task) ? @$task : null)) {
         $title[] = JoomSEF::_getMenuTitle($option, isset($task) ? $task : null);
         if (isset($searchword) && $this->params->get('nonsefphrase', '1') != '1') {
             $title[] = $searchword;
         }
         if (count($title) > 0) {
             $this->_createNonSefVars($uri);
             if (!isset($searchword) || $this->params->get('nonsefphrase', '1') != '1') {
                 // Generate meta tags
                 $desc = array();
                 if (isset($searchword)) {
                     $desc[] = $searchword;
                 }
                 if (isset($searchphrase)) {
                     $desc[] = $searchphrase;
                 }
                 $this->metadesc = implode(', ', $desc);
                 unset($desc);
             }
             $metatags = $this->getMetaTags();
             $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$vars['lang'], $this->nonSefVars, null, $metatags);
         }
     }
     return $newUri;
 }
 function create(&$uri)
 {
     // Extract variables
     $vars = $uri->getQuery(true);
     extract($vars);
     $title = array();
     $this->params = SEFTools::getExtParams('com_contact');
     $title[] = JoomSEF::_getMenuTitle(@$option, @$task, @$Itemid);
     if (isset($view)) {
         switch ($view) {
             case 'contact':
                 $title = array_merge($title, $this->getContactName($id));
                 unset($view);
                 break;
             case 'category':
                 if (isset($catid)) {
                     $title[] = $this->getCategoryTitle($catid);
                 }
                 unset($view);
                 break;
         }
     }
     if (!empty($format) && $format == 'feed') {
         if (!empty($type)) {
             $title[] = $type;
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         $newUri = JoomSEF::_sefGetLocation($uri, $title, @$view, null, null, @$lang, null, null, $metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
示例#14
0
 function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     $title = array();
     // Don't SEF if no variables
     if (self::$is20 && is_null($uri->getVar('view'))) {
         return $uri;
     }
     // JF translate extension.
     $sefConfig =& SEFConfig::getConfig();
     $database =& JFactory::getDBO();
     $jfTranslate = $sefConfig->translateNames ? ', `id`' : '';
     // load params
     $this->params = SEFTools::getExtParams('com_kunena');
     $catRewrite = true;
     $msgRewrite = true;
     $usrRewrite = true;
     /*if (isset($view) && ($view == 'category')) {
           $msgRewrite = false;
       }*/
     if ($msgRewrite || $catRewrite) {
         if ($catRewrite && !empty($catid)) {
             $categories = $this->GetCategories($catid);
             if (is_null($categories)) {
                 // Error, don't SEF
                 return $uri;
             }
         }
         if (isset($id)) {
             $msgID = $id;
         } elseif (isset($msg_id)) {
             $msgID = $msg_id;
         } elseif (isset($replyto)) {
             $msgID = $replyto;
         } elseif (isset($pid)) {
             $msgID = $pid;
         } else {
             $msgID = null;
         }
         if ($msgRewrite && !empty($msgID)) {
             if (isset($func) && $func == 'announcement') {
                 $msgTitle = $this->GetAnnouncementTitle($msgID);
             } else {
                 if (self::$is20) {
                     $msgTitle = $this->GetTopicTitle($msgID);
                 } else {
                     $msgTitle = $this->GetMessageTitle($msgID);
                 }
             }
             if (is_null($msgTitle)) {
                 // Error, don't SEF
                 return $uri;
             }
         }
     }
     // Set non-sef vars according to settings
     $this->_createNonSefVars($uri);
     // this needs to follow previous that use do
     if ($this->params->get('doExclude', true)) {
         unset($do);
     }
     // get user ID
     if ($usrRewrite && isset($userid)) {
         if ($this->params->get('userIdInsteadOfLogin', false)) {
             $usrTitle = 'user-' . $userid;
         } else {
             $query = "SELECT `username` FROM `#__users` WHERE `id` = {$userid}";
             $database->setQuery($query);
             $usrTitle = $database->loadResult();
         }
     }
     // use view if func not set
     if (!isset($func) && isset($view)) {
         $func = $view;
         unset($view);
     }
     // if task is not set, use do
     if (empty($task) && isset($func) && $func == 'post' && isset($do)) {
         $task = $do;
         unset($func);
         unset($do);
     }
     if (empty($task) && isset($func)) {
         $task = $func;
         unset($func);
     }
     // First subdir
     if (!empty($option) && !self::$is16) {
         $title[] = JoomSEF::_getMenuTitle($option, @$task, @$Itemid);
     } elseif (self::$is16) {
         $menuTitle = $this->getDefaultForumMenuTitle();
         if (!is_null($menuTitle)) {
             $title[] = $menuTitle;
         }
     }
     // Category
     if (isset($categories) && !empty($categories)) {
         $addCat = $this->params->get('categories', '2');
         if ($addCat == '2') {
             $title = array_merge($title, $categories);
         } else {
             if ($addCat == '1' || empty($msgID)) {
                 $title[] = $categories[count($categories) - 1];
             }
         }
     }
     // Announcement
     if (@$task == 'announcement') {
         $title[] = JText::_('Announcements');
     }
     // Topic
     if (isset($msgTitle) && !empty($msgTitle) && isset($task) && $task != 'showcat') {
         //$title[] = (!isset($do) && !isset($func)) ? $msgTitle.$sefConfig->suffix : $msgTitle;
         $title[] = $msgTitle;
     }
     if (isset($task) && in_array($task, array('search', 'advsearch'))) {
         if ($task == 'advsearch') {
             $title[] = JText::_('Advanced Search');
         } else {
             $title[] = JText::_($task);
         }
         if (isset($limitstart)) {
             unset($limitstart);
         }
         if (isset($limit)) {
             unset($limit);
         }
         unset($task);
     }
     if (isset($task) && $task == 'topics') {
         $title[] = $task;
         unset($task);
     }
     // Cleanout some views
     if (in_array(@$view, array('entrypage', 'category', 'topic', 'home'))) {
         unset($view);
     }
     // Cleanout some funcs
     if (in_array(@$func, array('showcat', 'view', 'announcement', 'entrypage', 'rules', 'category', 'topic', 'home'))) {
         unset($func);
     }
     // Cleanout some tasks
     if (in_array(@$task, array('showcat', 'view', 'announcement', 'entrypage', 'category', 'topic', 'home'))) {
         unset($task);
     }
     // View
     if (isset($view)) {
         $title[] = $view;
     }
     // JSON
     if (isset($task) && $task == 'json') {
         $title[] = $task;
         unset($task);
     }
     // Action
     if (isset($action)) {
         $title[] = $action;
         unset($action);
     }
     // User
     if (@$task == 'user') {
         if (empty($Itemid)) {
             $title[] = 'user';
         } else {
             $app = JFactory::getApplication();
             $menu = $app->getMenu('site');
             $item = $menu->getItem($Itemid);
             if (!is_object($item) || !isset($item->query['view']) || $item->query['view'] != 'user') {
                 $title[] = 'user';
             } else {
                 $title[] = 'profile';
             }
         }
         $task = null;
     }
     if (isset($usrTitle) && !empty($usrTitle)) {
         if (@$task == 'fbprofile') {
             $title[] = 'users';
             $task = null;
         } elseif (@$task == 'profile') {
             $title[] = 'profile';
             $task = null;
         } elseif (@$task == 'showprf') {
             $task = null;
         }
         $title[] = $usrTitle;
     }
     // Misc
     if (@$task == 'misc' && !empty($Itemid)) {
         // Use correct menu title
         $title[] = JoomSEF::_getMenuTitle(null, null, $Itemid);
         $task = null;
     }
     // Layout
     if (isset($layout)) {
         switch ($layout) {
             case 'reply':
                 if (isset($quote) && $quote) {
                     $layout = 'quote';
                 }
                 $title[] = $layout;
                 break;
             case 'list':
                 if ($uri->getVar('view') == 'category') {
                     $layout = 'index';
                     $title[] = $layout;
                 } else {
                     if ($uri->getVar('view') == 'user') {
                         $title[] = $layout;
                     }
                 }
                 break;
             case 'default':
                 // Don't add
                 break;
             default:
                 $title[] = $layout;
                 break;
         }
         unset($layout);
     }
     // Gallery
     if (isset($gallery)) {
         $title[] = $gallery;
     }
     // Func and do
     if (isset($do) || isset($func)) {
         if (isset($func)) {
             if ($func == 'search') {
                 $oper[] = 'do';
             }
             $oper[] = $func;
         }
         if (isset($do)) {
             $oper[] = $do;
         }
         $title[] = join('-', $oper) . $sefConfig->suffix;
     }
     // Fix some task texts
     if (isset($task)) {
         $task = str_replace(array('listcat', 'userlist'), array('categories', 'users'), $task);
     }
     // Mode
     if (isset($mode) && $mode == 'noreplies') {
         $title[] = $mode;
     }
     // Feeds
     if (isset($format)) {
         switch ($format) {
             case 'feed':
                 if (!isset($type)) {
                     $type = 'rss';
                 }
                 $title[] = $type;
                 break;
             case 'raw':
                 $title[] = $format;
                 break;
         }
     }
     // Page number
     if (isset($limitstart)) {
         // Limit should be set due to beforeCreate function, but to be sure
         if (!isset($limit)) {
             if (in_array($uri->getVar('view'), array('category', 'topics')) && isset(self::$kunenaConfig->threads_per_page)) {
                 $limit = self::$kunenaConfig->threads_per_page;
             } elseif ($uri->getVar('view') == 'user') {
                 $limit = self::$kunenaConfig->userlist_rows;
             } else {
                 $limit = self::$kunenaConfig->messages_per_page;
             }
         }
         $pageNum = intval($limitstart / $limit) + 1;
         $pagetext = strval($pageNum);
         if ($cnfPageText = $sefConfig->getPageText()) {
             $pagetext = str_replace('%s', $pageNum, $cnfPageText);
         }
         $title = array_merge($title, explode('/', $pagetext));
         //$title[] = $pagetext;
     }
     // Selection
     if (!empty($sel)) {
         if (isset($task) && $task == 'latest') {
             $num = $sel >= 24 ? $sel / 24 : $sel;
             $title[] = $task . '-' . $num;
             unset($task);
         } else {
             $title[] = $sel;
         }
     }
     if (isset($page) && $page > 1) {
         $pagetext = strval($page);
         if ($cnfPageText = $sefConfig->getPageText()) {
             $pagetext = str_replace('%s', $page, $cnfPageText);
         }
         $title[] = $pagetext;
     }
     // Task
     if (isset($task)) {
         $title[] = $task;
         unset($task);
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, @$limit, @$limitstart, @$lang, $this->nonSefVars, $this->ignoreVars, null, null, true);
     }
     return $newUri;
 }
示例#15
0
 function create(&$uri)
 {
     $this->metadesc = null;
     // Extract variables
     $vars = $uri->getQuery(true);
     extract($vars);
     $this->params = SEFTools::getExtParams('com_contact');
     $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid);
     if (isset($view)) {
         switch ($view) {
             case 'categories':
             case 'featured':
                 break;
             case 'category':
                 $catInfo = $this->getCategoryInfo($id);
                 if ($catInfo === false) {
                     JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_contact');
                 }
                 if (is_array($catInfo->path)) {
                     $title = array_merge($title, $catInfo->path);
                 }
                 break;
             case 'contact':
                 $title = array_merge($title, $this->getContactName($id));
                 break;
         }
     }
     if (!empty($format)) {
         if ($format == 'feed' && !empty($type)) {
             $title[] = $type;
         } elseif ($format == 'vcf') {
             $title[] = 'vCard';
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, null, $this->metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
示例#16
0
 function create(&$uri)
 {
     $vars = $uri->getQuery(true);
     extract($vars);
     // Don't SEF opensearch links
     if (isset($format) && $format == 'opensearch') {
         return $uri;
     }
     $this->params =& SEFTools::getExtParams('com_search');
     $newUri = $uri;
     if (!(isset($task) ? @$task : null)) {
         $title[] = JoomSEF::_getMenuTitleLang($option, $lang, @$Itemid);
         if (isset($searchword) && $this->params->get('nonsefphrase', '1') != '1') {
             $title[] = $searchword;
         }
         if (isset($view) && ($view != 'search' || $this->params->get('add_search', '0') == '1')) {
             $title[] = $view;
         }
         if (isset($format)) {
             $title[] = $format;
         }
         $this->_createNonSefVars($uri);
         if (!isset($searchword) || $this->params->get('nonsefphrase', '1') != '1') {
             // Generate meta tags
             $desc = array();
             if (isset($searchword)) {
                 $desc[] = $searchword;
             }
             if (isset($searchphrase)) {
                 $desc[] = $searchphrase;
             }
             $this->metadesc = implode(', ', $desc);
             unset($desc);
         }
         $metatags = $this->getMetaTags();
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars, null, $metatags, null, true);
     }
     return $newUri;
 }
示例#17
0
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $database =& JFactory::getDBO();
     $vars = $uri->getQuery(true);
     extract($vars);
     $title = array();
     $title[] = JoomSEF::_getMenuTitleLang($option, $this->lang);
     switch (@$view) {
         case 'categories':
             break;
         case 'category':
             $catInfo = $this->getCategoryInfo($id);
             if ($catInfo === false) {
                 JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_newsfeeds');
             }
             if (is_array($catInfo->path)) {
                 $title = array_merge($title, $catInfo->path);
             }
             break;
         case 'newsfeed':
             $title = array_merge($title, $this->getFeedTitle($id));
             break;
     }
     if (isset($format)) {
         if ($format == 'feed' && isset($type)) {
             $title[] = $type;
         } else {
             $title[] = $format;
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, null, $this->metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $database =& JFactory::getDBO();
     $this->params =& SEFTools::getExtParams('com_newsfeeds');
     $vars = $uri->getQuery(true);
     extract($vars);
     // JF translate extension.
     $jfTranslate = $sefConfig->translateNames ? ', `id`' : '';
     $title = array();
     $title[] = JoomSEF::_getMenuTitle($option, @$this_task);
     if (@$view == 'category' && isset($id)) {
         $title[] = $this->getCategoryTitle($id, SEFTools::UseAlias($this->params, 'category_alias'));
     }
     if (@$view == "newsfeed") {
         if (!empty($catid)) {
             if ($this->params->get('show_category', '1')) {
                 $title[] = $this->getCategoryTitle($catid, SEFTools::UseAlias($this->params, 'category_alias'));
             }
         }
         if (empty($feedid)) {
             $feedid = $id;
         }
         $field = 'name';
         if (SEFTools::UseAlias($this->params, 'feed_alias')) {
             $field = 'alias';
         }
         $feedid = intval($feedid);
         $database->setQuery("SELECT `{$field}` AS `name` {$jfTranslate} FROM `#__newsfeeds` WHERE `id` = '{$feedid}'");
         $row = $database->loadObject();
         if (is_null($row)) {
             JoomSefLogger::Log("Newsfeed with ID {$feedid} could not be found.", $this, 'com_newsfeeds');
         } elseif (!empty($row->name)) {
             $name = $row->name;
             if ($this->params->get('feedid', '0')) {
                 $name = $feedid . '-' . $name;
             }
             $title[] = $name;
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$vars['lang'], null, null, $metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
示例#19
0
文件: joomsef.php 项目: 01J/bealtine
 function build(&$uri, $check = false)
 {
     static $extsCache;
     if (!isset($extsCache)) {
         $extsCache = array();
     }
     $mainframe = JFactory::getApplication();
     $jRouter = $mainframe->getRouter();
     $jRouter->SetMode(JROUTER_MODE_SEF);
     $config = JFactory::getConfig();
     $sefConfig = SEFConfig::getConfig();
     $cache = SEFCache::getInstance();
     // Restore global "Add suffix to URLs"
     $sefSuffix = JoomSEF::get('sef.global.orig_sef_suffix');
     $config->set('sef_suffix', $sefSuffix);
     // trigger onSefStart patches
     $mainframe->triggerEvent('onSefStart');
     // Do not SEF URLs with specific format or template according to configuration
     if (in_array($uri->getVar('format'), array('raw', 'json', 'xml')) || $uri->getVar('tmpl') == 'raw' || !$sefConfig->sefComponentUrls && $uri->getVar('tmpl') == 'component') {
         $uri = JoomSEF::_createUri($uri);
         $mainframe->triggerEvent('onSefEnd');
         $jRouter->SetMode(JROUTER_MODE_RAW);
         return;
     }
     // check URL for junk if set to
     $vars = $uri->getQuery(true);
     if ($sefConfig->checkJunkUrls) {
         $junkWords =& $sefConfig->getJunkWords();
         $seferr = false;
         if (substr($uri->getVar('option', ''), 0, 4) != 'com_') {
             $seferr = true;
         } elseif (count($junkWords)) {
             $exclude =& $sefConfig->getJunkExclude();
             foreach ($vars as $key => $val) {
                 if (in_array($key, $exclude)) {
                     continue;
                 }
                 // Check junk words
                 foreach ($junkWords as $word) {
                     if (is_string($val)) {
                         if (strpos($val, $word) !== false) {
                             $seferr = true;
                             break;
                         }
                     }
                 }
                 if ($seferr) {
                     break;
                 }
             }
         }
         if ($seferr) {
             // trigger onSefEnd patches
             $mainframe->triggerEvent('onSefEnd');
             $jRouter->SetMode(JROUTER_MODE_RAW);
             // fix the path
             $path = $uri->getPath();
             return;
         }
     }
     // Handle lang variable
     if ($sefConfig->langEnable && $check == false) {
         $langs = JLanguageHelper::getLanguages('sef');
         $langsCode = JLanguageHelper::getLanguages('lang_code');
         $langVar = $uri->getVar('lang');
         if (empty($langVar)) {
             $langVar = JRequest::getVar('lang');
             $uri->setVar('lang', $langVar);
         }
         // Check for non-existent language
         if (!isset($langs[$langVar])) {
             // Not a SEF code, check for long code
             if (isset($langsCode[$langVar])) {
                 // Fix the code to short version
                 $uri->setVar('lang', $langsCode[$langVar]->sef);
             } else {
                 // Non-existent language, use current
                 $curLang = JFactory::getLanguage();
                 $uri->setVar('lang', $langsCode[$curLang->getTag()]->sef);
             }
         }
         // Check for mismatched language and Itemid?
         if ($sefConfig->mismatchedLangHandling != _COM_SEF_MISMATCHED_LANG_DONT_HANDLE) {
             $langVar = $uri->getVar('lang');
             $itemidVar = $uri->getVar('Itemid');
             if (!empty($langVar) && !empty($itemidVar)) {
                 // Get menu item language
                 $menu = $mainframe->getMenu('site');
                 $item = $menu->getItem($itemidVar);
                 if (is_object($item) && !empty($item->language) && $item->language != '*') {
                     if ($langsCode[$item->language]->sef != $langVar) {
                         if ($sefConfig->mismatchedLangHandling == _COM_SEF_MISMATCHED_LANG_DONT_SEF) {
                             // Don't SEF
                             $mainframe->triggerEvent('onSefEnd');
                             $jRouter->SetMode(JROUTER_MODE_RAW);
                             return;
                         } else {
                             // Fix lang variable
                             $uri->setVar('lang', $langsCode[$item->language]->sef);
                         }
                     }
                 }
             }
         }
     }
     // Correct FaLang support for translations
     $prevLang = '';
     if ($sefConfig->langEnable && $check == false) {
         $langVar = $uri->getVar('lang');
         if (!empty($langVar)) {
             $langCode = JoomSEF::getLangCode($langVar);
             if (!is_null($langCode)) {
                 $curCode = JoomSEF::getLangCode();
                 if ($langCode != $curCode) {
                     // URL language is different from current language,
                     // change current language for correct translations
                     $language = JFactory::getLanguage();
                     $prevLang = $language->setLanguage($langCode);
                     // 6.12.2012 dajo: Make sure that loaded language overwrites current strings!
                     $language->load('joomla', JPATH_BASE, null, true);
                 }
             }
         }
     }
     // if there are no variables and only single language is used
     $vars = $uri->getQuery(true);
     if (empty($vars) && !isset($lang)) {
         JoomSEF::_endSef($prevLang);
         return;
     }
     $option = $uri->getVar('option');
     if (!is_null($option)) {
         $params =& SEFTools::getExtParams($option);
         // Check the stop rule
         $stopRule = trim($params->get('stopRule', ''));
         if ($stopRule != '') {
             if (preg_match('/' . $stopRule . '/', $uri->toString()) > 0) {
                 // Don't SEF this URL
                 $uri = JoomSEF::_createUri($uri);
                 JoomSEF::_endSef($prevLang);
                 $jRouter->SetMode(JROUTER_MODE_RAW);
                 return;
             }
         }
         if (strlen($uri->getVar('Itemid')) == 0) {
             $uri->delVar('Itemid');
         }
         $handling = $params->get('handling', '0');
         switch ($handling) {
             // skipped extensions
             case '2':
                 // Check homepage
                 if (JoomSEF::_isHomePage($uri)) {
                     $lang = $uri->getVar('lang');
                     if (empty($lang)) {
                         JoomSefUri::updateUri($uri, 'index.php');
                     } else {
                         JoomSefUri::updateUri($uri, 'index.php?lang=' . $lang);
                     }
                 }
                 // Build URL
                 $uri = JoomSEF::_createUri($uri);
                 JoomSEF::_endSef($prevLang);
                 $jRouter->SetMode(JROUTER_MODE_RAW);
                 return;
                 // non-cached extensions
             // non-cached extensions
             case '1':
                 // Check homepage
                 if (JoomSEF::_isHomePage($uri)) {
                     $lang = $uri->getVar('lang');
                     if (empty($lang)) {
                         JoomSefUri::updateUri($uri, 'index.php');
                     } else {
                         JoomSefUri::updateUri($uri, 'index.php?lang=' . $lang);
                     }
                 }
                 JoomSEF::_endSef($prevLang);
                 return;
                 // default handler or basic rewriting
             // default handler or basic rewriting
             default:
                 // if component has its own sef_ext plug-in included.
                 // however, prefer own plugin if exists (added by Michal, 28.11.2006)
                 $compExt = JPATH_ROOT . '/components/' . $option . '/router.php';
                 $ownExt = JPATH_ROOT . '/components/com_sef/sef_ext/' . $option . '.php';
                 // compatible extension build block
                 if (file_exists($compExt) && !file_exists($ownExt) && $handling == '0') {
                     // Check homepage
                     if (JoomSEF::_isHomePage($uri)) {
                         $lang = $uri->getVar('lang');
                         if (empty($lang)) {
                             JoomSefUri::updateUri($uri, 'index.php');
                         } else {
                             JoomSefUri::updateUri($uri, 'index.php?lang=' . $lang);
                         }
                         // Create homepage SEF URL
                         $title = array();
                         $data = JoomSEF::_sefGetLocation($uri, $title, null, null, null, $uri->getVar('lang'));
                         $uri = JoomSEF::_storeLocation($data);
                         // remove path as Joomla will add it back
                         $uri->setPath(preg_replace("@^" . $uri->base(true) . "@", "", $uri->getPath()));
                         // Disable global "Add suffix to URLs" again
                         $config->set('sef_suffix', 0);
                         JoomSEF::_endSef($prevLang);
                         return;
                     }
                     // load the plug-in file
                     self::_isolatedRequireOnce($compExt);
                     $app = JFactory::getApplication();
                     $menu = $app->getMenu('site');
                     $route = $uri->getPath();
                     $query = $uri->getQuery(true);
                     $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $query['option']);
                     $tmp = '';
                     // Replace limitstart -> start, which is default Joomla's behaviour
                     if (isset($query['limitstart'])) {
                         $query['start'] = (int) $query['limitstart'];
                         unset($query['limitstart']);
                     }
                     // Get component router object if supported
                     $componentRouter = self::getComponentRouter($component);
                     if ($componentRouter) {
                         // Use the new Joomla 3 interface
                         $parts = $componentRouter->build($query);
                     } else {
                         // Use old procedural approach
                         $function = substr($component, 4) . 'BuildRoute';
                         $parts = $function($query);
                     }
                     if (!is_array($parts)) {
                         if (is_string($parts)) {
                             $parts = array($parts);
                         } else {
                             // Don't SEF
                             JoomSEF::_endSef($prevLang);
                             // Disable global "Add suffix to URLs" again
                             $config->set('sef_suffix', 0);
                             return;
                         }
                     }
                     $total = count($parts);
                     for ($i = 0; $i < $total; $i++) {
                         $parts[$i] = str_replace(':', '-', $parts[$i]);
                     }
                     $result = implode('/', $parts);
                     $tmp = $result != "" ? '/' . $result : '';
                     // build the application route
                     $built = false;
                     if (isset($query['Itemid']) && !empty($query['Itemid'])) {
                         $item = $menu->getItem($query['Itemid']);
                         if (is_object($item) && $query['option'] == $item->component) {
                             $tmp = !empty($tmp) ? $item->route . $tmp : $item->route;
                             $built = true;
                         }
                     }
                     if (!$built) {
                         $tmp = 'component/' . substr($query['option'], 4) . $tmp;
                     }
                     $route .= '/' . $tmp;
                     if ($app->getCfg('sef_suffix') && !(substr($route, -9) == 'index.php' || substr($route, -1) == '/')) {
                         if ($format = $uri->getVar('format', 'html')) {
                             $route .= '.' . $format;
                             $uri->delVar('format');
                         }
                     }
                     if ($app->getCfg('sef_rewrite')) {
                         // transform the route
                         $route = str_replace('index.php/', '', $route);
                     }
                     // Unset unneeded query information
                     unset($query['Itemid']);
                     unset($query['option']);
                     //Set query again in the URI
                     $uri->setQuery($query);
                     $uri->setPath($route);
                     $uri = JoomSEF::_createUri($uri);
                     JoomSEF::_endSef($prevLang);
                     // Disable global "Add suffix to URLs" again
                     $config->set('sef_suffix', 0);
                     return;
                 } else {
                     // Disable global "Add suffix to URLs"
                     $config->set('sef_suffix', 0);
                     if ($handling == '3') {
                         // Basic rewriting
                         $class = 'SefExt_Basic';
                     } else {
                         if (file_exists($ownExt)) {
                             $class = 'SefExt_' . $option;
                         } else {
                             $class = 'SefExt';
                         }
                     }
                     // Extensions cache
                     if (!class_exists($class)) {
                         require $ownExt;
                     }
                     $sef_ext = new $class();
                     $extsCache[$class] = $sef_ext;
                     // Set currently handled URI
                     $sef_ext->setCurrentUri($uri);
                     // 17.2.2012, dajo: isHomePage should be tested before the beforeCreate() is called
                     // Grr Joomla SEF router adds home Itemid to Items without menu Item assigned
                     $homes = array_keys(SEFTools::getHomeQueries());
                     if (in_array($uri->getVar('Itemid'), $homes) && !JoomSEF::_isHomePage($uri)) {
                         $uri->setVar('Itemid', JRequest::getInt('Itemid'));
                     }
                     // Let the extension change the url and options
                     $sef_ext->beforeCreate($uri);
                     list($sid, $mosmsg) = self::_prepareUriForCreate($params, $uri);
                     // Get nonsef and ignore vars from extension
                     list($nonSefVars, $ignoreVars) = $sef_ext->getNonSefVars($uri);
                     // Create array of all the non sef vars
                     $nonSefVars = SEFTools::getNonSefVars($uri, $nonSefVars, $ignoreVars);
                     // Create a copy of JURI object
                     $uri2 = clone $uri;
                     // Remove nonsef variables from our JURI copy
                     $nonSefUrl = SEFTools::RemoveVariables($uri2, array_keys($nonSefVars));
                     // Check homepage
                     if (JoomSEF::_isHomePage($uri2, true)) {
                         $title = array();
                         $lng = $uri2->getVar('lang');
                         if ($sefConfig->langEnable && $sefConfig->langPlacementJoomla != _COM_SEF_LANG_DOMAIN && ($sefConfig->alwaysUseLangHomeJoomla || $lng != $sefConfig->mainLanguageJoomla)) {
                             $title[] = $lng;
                         }
                         $pagination = false;
                         if (method_exists($sef_ext, "_processPagination")) {
                             $title = array_merge($title, $sef_ext->_processPagination($uri2));
                             $pagination = true;
                         }
                         if ($uri2->getVar('format') == 'feed') {
                             $title[] = $uri2->getVar('type');
                         }
                         $data = JoomSEF::_sefGetLocation($uri2, $title, null, null, null, $uri->getVar('lang'), null, null, null, null, $pagination);
                         unset($data["lang"]);
                         // We need to copy data, otherwise we would return $uri2 object - not working in Joomla 3
                         JoomSefUri::copyUri(JoomSEF::_storeLocation($data), $uri);
                         // remove path as Joomla will add it back
                         $uri->setPath(preg_replace("@^" . $uri->base(true) . "@", "", $uri->getPath()));
                         // Set non-SEF variables
                         $uri->setQuery($nonSefUrl);
                         // Set domain
                         if ($sefConfig->langEnable && $sefConfig->langPlacementJoomla == _COM_SEF_LANG_DOMAIN) {
                             if (!empty($lng) && isset($sefConfig->subDomainsJoomla[$lng])) {
                                 $uri->setHost($sefConfig->subDomainsJoomla[$lng]);
                             }
                         }
                         JoomSEF::_endSef($prevLang);
                         return;
                     }
                     // clean Itemid if desired
                     // David: only if overriding is disabled
                     $override = $params->get('itemid', '0');
                     if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $override == '0') {
                         $Itemid = $uri->getVar('Itemid');
                         $uri2->delVar('Itemid');
                     }
                     $url = JoomSEF::_uriToUrl($uri2);
                     // try to get url from cache
                     $sefUrl = false;
                     if ($sefConfig->useCache) {
                         if (!$check) {
                             $sefUrl = $cache->GetSefUrl($url);
                         }
                     }
                     if (!$sefConfig->useCache || !$sefUrl) {
                         // check if the url is already saved in the database
                         $sefUrl = $sef_ext->getSefUrlFromDatabase($uri2);
                         if (is_string($sefUrl)) {
                             // Backward compatibility
                             $sefstring = $sefUrl;
                             $sefUrl = new stdClass();
                             $sefUrl->sefurl = $sefstring;
                             $sefUrl->sef = 1;
                             $sefUrl->host = '';
                         }
                     }
                     // unknown URL yet
                     if (!$sefUrl || $check) {
                         // load JoomSEF Language File
                         JFactory::getLanguage()->load('com_sef', JPATH_ADMINISTRATOR);
                         // rewrite the URL, creating new JURI object
                         $data = $sef_ext->create($uri);
                         if (is_object($data) && is_a($data, 'JURI')) {
                             // Backwards compatibility
                             JoomSefUri::copyUri($data, $uri);
                         } else {
                             if ($sefConfig->langPlacementJoomla == _COM_SEF_LANG_PATH) {
                                 // if data is not array, then we don't have in lang language from SEF extension, because it's original URL
                                 if (is_array($data)) {
                                     if ($data['lang'] == '*') {
                                         // If we don't want to have language in multilanguage content strip down the language from path to eleminate duplicit pages with same content
                                         if ($sefConfig->addLangMulti) {
                                             $data["lang"] = $data["uri"]->getVar('lang');
                                         } else {
                                             unset($data["lang"]);
                                             $data["uri"]->delVar('lang');
                                         }
                                     } else {
                                         $langs = JLanguageHelper::getLanguages('lang_code');
                                         if (array_key_exists($data["lang"], $langs)) {
                                             $data["lang"] = $langs[$data["lang"]]->sef;
                                         }
                                         if (!strlen($data["lang"])) {
                                             $data["lang"] = $data["uri"]->getVar('lang');
                                         }
                                     }
                                 }
                                 if ($sefConfig->alwaysUseLangJoomla == false) {
                                     if (isset($data["lang"]) && $data["lang"] == $sefConfig->mainLanguageJoomla) {
                                         unset($data["lang"]);
                                         $data["uri"]->delVar('lang');
                                     }
                                 }
                             }
                             $titlepage = false;
                             $subdomain = SEFTools::getSubdomain($uri->getVar('Itemid'), $uri, $titlepage);
                             if (strlen($subdomain)) {
                                 $curHost = JFactory::getURI()->getHost();
                                 if (substr($curHost, 0, 4) == 'www.') {
                                     $curHost = substr($curHost, 4);
                                 }
                                 $uri->setHost($subdomain . '.' . $curHost);
                             }
                             if ($titlepage) {
                                 $data["title"] = array();
                             }
                             if (!isset($data["host"])) {
                                 $data["host"] = $uri->getHost();
                             }
                             if ($check) {
                                 $this->_data = $data;
                             }
                             // 12.11.2012 dajo: Itemid must be removed in _storeLocation after the menu title is removed too
                             /*if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && ($override == '0')) {
                                   if (isset($data['uri'])) {
                                       $data['uri']->delVar('Itemid');
                                   }
                               }*/
                             $removeItemid = isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $override == '0';
                             JoomSefUri::copyUri(JoomSEF::_storeLocation($data, $check, $removeItemid), $uri);
                         }
                     } else {
                         // if SEF is disabled, don't SEF
                         if (isset($sefUrl->sef) && !$sefUrl->sef) {
                             $uri = JoomSEF::_createUri($uri);
                             JoomSEF::_endSef($prevLang);
                             $jRouter->SetMode(JROUTER_MODE_RAW);
                             return;
                         }
                         // Create new JURI object from $sefstring
                         if (!isset($sefUrl->host) || !strlen($sefUrl->host)) {
                             $root = JFactory::getUri()->toString(array('host', 'port'));
                         } else {
                             $root = $sefUrl->host;
                         }
                         $url = JFactory::getURI()->getScheme() . "://" . $root . JURI::root(true);
                         if (substr($url, -1) != '/') {
                             $url .= '/';
                         }
                         if (isset($sefUrl->sefurl)) {
                             $url .= $sefUrl->sefurl;
                         }
                         // Add nonSef part if set
                         if (!empty($nonSefUrl)) {
                             $url .= '?' . $nonSefUrl;
                         }
                         // Add fragment if set
                         $fragment = $uri->getFragment();
                         if (!empty($fragment)) {
                             $url .= '#' . $fragment;
                         }
                         JoomSefUri::updateUri($uri, $url);
                     }
                     // Set domain
                     if ($sefConfig->langEnable && $sefConfig->langPlacementJoomla == _COM_SEF_LANG_DOMAIN) {
                         $lng = $uri2->getVar('lang');
                         if (!empty($lng) && isset($sefConfig->subDomainsJoomla[$lng])) {
                             $uri->setHost($sefConfig->subDomainsJoomla[$lng]);
                         }
                     }
                     // reconnect the sid to the url
                     if (!empty($sid) && COM_SEF_CONFIG_REMOVE_SID) {
                         $uri->setVar('sid', $sid);
                     }
                     // reconnect mosmsg to the url
                     if (!empty($mosmsg)) {
                         $uri->setVar('mosmsg', $mosmsg);
                     }
                     // reconnect ItemID to the url
                     // David: only if extension doesn't set its own Itemid through overrideId parameter
                     if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $sefConfig->reappendSource && $override == '0' && !empty($Itemid)) {
                         $uri->setVar('Itemid', $Itemid);
                     }
                     // let the extension change the resulting SEF url
                     $sef_ext->afterCreate($uri);
                 }
         }
     } else {
         if (!is_null($uri->getVar('Itemid'))) {
             // there is only Itemid present - we must override the Ignore multiple sources option
             $oldIgnore = $sefConfig->ignoreSource;
             $sefConfig->ignoreSource = 0;
             $lang = "";
             $title = array();
             $title[] = JoomSEF::_getMenuTitleLang(null, $lang, $uri->getVar('Itemid'));
             $data = JoomSEF::_sefGetLocation($uri, $title, null, null, null, strlen($lang) ? $lang : $uri->getVar('lang'));
             $uri = JoomSEF::_storeLocation($data);
             $sefConfig->ignoreSource = $oldIgnore;
         }
     }
     $uri->setPath(preg_replace("@^" . $uri->base(true) . "@", "", $uri->getPath()));
     JoomSEF::_endSef($prevLang);
     // Set Joomla's router so it doesn't process URL further
     $jRouter->SetMode(JROUTER_MODE_RAW);
 }
示例#20
0
 public function create(&$uri)
 {
     $title = array();
     $vars = $uri->getQuery(true);
     $this->_createNonSefVars($uri);
     // Set menu title
     $title[] = JoomSEF::_getMenuTitle($uri->getVar('option'), $uri->getVar('task'), $uri->getVar('Itemid'));
     if (isset($vars['view'])) {
         switch ($vars['view']) {
             case 'tag':
                 if (isset($vars['id'])) {
                     $tag = $this->getTag($vars['id']);
                     if (is_null($tag)) {
                         JoomSefLogger::Log('Tag with ID ' . $vars['id'] . ' not set.', $this, 'com_tags');
                         return $uri;
                     }
                     $title[] = $tag;
                 }
                 break;
             default:
                 $title[] = $vars['view'];
                 break;
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, $uri->getVar('lang'), $this->nonSefVars, null, null, null, true);
     }
     return $newUri;
 }