Even more refactoring on the request class.

This commit is contained in:
Taylor Otwell 2011-08-08 09:44:57 -05:00
parent 88ebf6125c
commit a26efbc2e3
1 changed files with 8 additions and 4 deletions

View File

@ -29,11 +29,15 @@ public static function uri()
$uri = static::raw_uri();
$base = parse_url(Config::get('application.url'), PHP_URL_PATH);
if (strpos($uri, $base = parse_url(Config::get('application.url'), PHP_URL_PATH)) === 0)
{
$uri = substr($uri, strlen($base));
}
if (strpos($uri, $base) === 0) $uri = substr($uri, strlen($base));
if (strpos($uri, $index = '/index.php') === 0) $uri = substr($uri, strlen($index));
if (strpos($uri, $index = '/index.php') === 0)
{
$uri = substr($uri, strlen($index));
}
return static::$uri = (($uri = trim($uri, '/')) == '') ? '/' : $uri;
}