Removed usage of Arr from Request class.

This commit is contained in:
Taylor Otwell 2011-07-06 11:23:14 -07:00
parent f8b12b5daa
commit 1a82d9c54f
1 changed files with 4 additions and 16 deletions

View File

@ -28,16 +28,10 @@ public static function uri()
return static::$uri; return static::$uri;
} }
// -------------------------------------------------------
// Use the PATH_INFO variable if it is available.
// -------------------------------------------------------
if (isset($_SERVER['PATH_INFO'])) if (isset($_SERVER['PATH_INFO']))
{ {
$uri = $_SERVER['PATH_INFO']; $uri = $_SERVER['PATH_INFO'];
} }
// -------------------------------------------------------
// No PATH_INFO? Let's try REQUEST_URI.
// -------------------------------------------------------
elseif (isset($_SERVER['REQUEST_URI'])) elseif (isset($_SERVER['REQUEST_URI']))
{ {
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
@ -84,15 +78,14 @@ public static function uri()
/** /**
* Get the request method. * Get the request method.
* *
* The request method may be spoofed if a hidden "REQUEST_METHOD" POST element
* is present, allowing HTML forms to simulate PUT and DELETE requests.
*
* @return string * @return string
*/ */
public static function method() public static function method()
{ {
// -------------------------------------------------------------- return (array_key_exists('REQUEST_METHOD', $_POST)) ? $_POST['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD'];
// The method can be spoofed using a POST variable, allowing HTML
// forms to simulate PUT and DELETE requests.
// --------------------------------------------------------------
return Arr::get($_POST, 'REQUEST_METHOD', $_SERVER['REQUEST_METHOD']);
} }
/** /**
@ -162,11 +155,6 @@ public static function route_is($name)
*/ */
public static function __callStatic($method, $parameters) public static function __callStatic($method, $parameters)
{ {
// --------------------------------------------------------------
// Dynamically call the "is" method using the given name.
//
// Example: Request::is_login()
// --------------------------------------------------------------
if (strpos($method, 'route_is_') === 0) if (strpos($method, 'route_is_') === 0)
{ {
return static::route_is(substr($method, 9)); return static::route_is(substr($method, 9));