示例#1
0
function shNormalizeNonSefUrl($url)
{
    // returns non-sef url with slugs removed + a few fixes
    $uri = new JURI($url);
    shNormalizeNonSefUri($uri);
    return $uri->toString(array('path', 'query', 'fragment'));
}
示例#2
0
文件: shsef.php 项目: sangkasi/joomla
 function _buildSefRoute(&$uri)
 {
     $sefConfig =& shRouter::shGetConfig();
     $shPageInfo =& shRouter::shPageInfo();
     $menu =& shRouter::shGetMenu();
     // keep a copy of  Joomla original URI, which has article names in it (ie: 43:article-title)
     $originalUri = clone $uri;
     shNormalizeNonSefUri($uri, $menu);
     shNormalizeNonSefUri($originalUri, $menu, $removeSlugs = false);
     // do our job!
     $query = $uri->getQuery(false);
     $route = shSefRelToAbs('index.php?' . $query, null, $uri, $originalUri);
     $route = ltrim(str_replace($GLOBALS['shConfigLiveSite'], '', $route), '/');
     $route = $shPageInfo->base . ($route == '/' ? '' : $route);
     // find path
     if (strpos($route, '?') !== false) {
         $parts = explode('?', $route);
         if ($sefConfig->shRewriteMode == 2) {
             // '/index.php?/'
             // need to extract the first part of the query, which is actually the path
             // and store it as the path
             $tmpParts = explode('/index.php?/', $route);
             $tmpPath = '';
             if (isset($tmpParts[1])) {
                 // there is somethings after the /index.php?/
                 if (strpos($tmpParts[1], '?') !== false) {
                     // but this can also have parameters, so only get the path
                     $tmpPathParts = explode('?', $tmpParts[1]);
                     $tmpPath = $tmpPathParts[0];
                 } else {
                     $tmpPath = $tmpParts[1];
                 }
             }
             $path = $tmpParts[0] . '/index.php?/' . $tmpPath;
         } else {
             // there are some query vars, just use the path
             $path = $parts[0];
         }
     } else {
         $path = $route;
     }
     $uri->setPath($path);
 }
 protected function _buildSefRoute(&$uri)
 {
     $pageInfo =& Sh404sefFactory::getPageInfo();
     $sefConfig = Sh404sefFactory::getConfig();
     $menu =& JFactory::getApplication()->getMenu();
     // keep a copy of  Joomla original URI, which has article names in it (ie: 43:article-title)
     $originalUri = clone $uri;
     shNormalizeNonSefUri($uri, $menu);
     shNormalizeNonSefUri($originalUri, $menu, $removeSlugs = false);
     // do our job!
     $query = $uri->getQuery(false);
     $route = shSefRelToAbs('index.php?' . $query, null, $uri, $originalUri);
     $route = ltrim(str_replace($pageInfo->getDefaultLiveSite(), '', $route), '/');
     $route = $route == '/' ? '' : $route;
     // find path
     $nonSefVars = $uri->getQuery($asArray = true);
     if (strpos($route, '?') !== false && !empty($nonSefVars)) {
         $parts = explode('?', $route);
         if ($sefConfig->shRewriteMode == 2) {
             // '/index.php?/' - removed from V 3.0+, but code left, as maybe we can put it back later?
             // need to extract the first part of the query, which is actually the path
             // and store it as the path
             $tmpParts = explode('/index.php?/', $route);
             $tmpPath = '';
             if (isset($tmpParts[1])) {
                 // there is somethings after the /index.php?/
                 if (strpos($tmpParts[1], '?') !== false) {
                     // but this can also have parameters, so only get the path
                     $tmpPathParts = explode('?', $tmpParts[1]);
                     $tmpPath = $tmpPathParts[0];
                 } else {
                     $tmpPath = $tmpParts[1];
                 }
             }
             $path = $tmpParts[0] . '/index.php?/' . $tmpPath;
         } else {
             // there are some query vars, just use the path
             $path = $parts[0];
         }
     } else {
         $path = $route;
     }
     $uri->setPath($path);
 }
示例#4
0
文件: shsef.php 项目: justinlyon/scc
 function _buildSefRoute(&$uri)
 {
     $sefConfig =& shRouter::shGetConfig();
     $shPageInfo =& shRouter::shPageInfo();
     $menu =& shRouter::shGetMenu();
     // keep a copy of  Joomla original URI, which has article names in it (ie: 43:article-title)
     $originalUri = clone $uri;
     shNormalizeNonSefUri($uri, $menu);
     shNormalizeNonSefUri($originalUri, $menu, $removeSlugs = false);
     // do our job!
     $query = $uri->getQuery(false);
     $route = shSefRelToAbs('index.php?' . $query, null, $uri, $originalUri);
     $route = ltrim(str_replace($GLOBALS['shConfigLiveSite'], '', $route), '/');
     $route = $shPageInfo->base . ($route == '/' ? '' : $route);
     // find path
     if (strpos($route, '?') !== false) {
         $parts = explode('?', $route);
         $path = $parts[0];
     } else {
         $path = $route;
     }
     $uri->setPath($path);
 }