Changeset 1976

Show
Ignore:
Timestamp:
02/06/08 18:33:55 (7 months ago)
Author:
Shadowhand
Message:

Tiny optimization to Router.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Router.php

    r1911 r1976  
    205205                        } 
    206206                } 
    207                 elseif (count($_GET) === 1 AND current($_GET) == '' AND substr($_SERVER['QUERY_STRING'], -1) !== '=') 
     207                elseif (count($_GET) === 1 AND current($_GET) === '' AND substr($_SERVER['QUERY_STRING'], -1) !== '=') 
    208208                { 
    209209                        // The URI is the array key, eg: ?this/is/the/uri 
     
    239239                { 
    240240                        // Remove the front controller from the current uri 
    241                         self::$current_uri = (string) substr(self::$current_uri, $strpos_fc + strlen($fc)); 
    242                 } 
    243  
    244                 if ($suffix = Config::item('core.url_suffix') AND strpos(self::$current_uri, $suffix) !== FALSE) 
    245                 { 
    246                         // Remove the URL suffix 
    247                         self::$current_uri = preg_replace('!'.preg_quote($suffix).'$!u', '', self::$current_uri); 
    248  
    249                         // Set the URL suffix 
    250                         self::$url_suffix = $suffix; 
    251                 } 
    252  
    253                 // Remove extra slashes from the segments that could cause fucked up routing 
    254                 self::$current_uri = preg_replace('!//+!', '/', trim(self::$current_uri, '/')); 
     241                        self::$current_uri = substr(self::$current_uri, $strpos_fc + strlen($fc)); 
     242                } 
     243 
     244                if (self::$current_uri !== '') 
     245                { 
     246                        if ($suffix = Config::item('core.url_suffix') AND strpos(self::$current_uri, $suffix) !== FALSE) 
     247                        { 
     248                                // Remove the URL suffix 
     249                                self::$current_uri = preg_replace('!'.preg_quote($suffix).'$!u', '', self::$current_uri); 
     250 
     251                                // Set the URL suffix 
     252                                self::$url_suffix = $suffix; 
     253                        } 
     254 
     255                        // Remove extra slashes from the segments that could cause fucked up routing 
     256                        self::$current_uri = preg_replace('!//+!', '/', trim(self::$current_uri, '/')); 
     257                } 
    255258        } 
    256259