changed Request::is to Request::route_is.
This commit is contained in:
@@ -74,17 +74,6 @@ class Request {
|
||||
return ($uri == '') ? '/' : Str::lower($uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the route handling the request is a given name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public static function is($name)
|
||||
{
|
||||
return (is_array(static::$route->callback) and isset(static::$route->callback['name']) and static::$route->callback['name'] === $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request method.
|
||||
*
|
||||
@@ -125,7 +114,7 @@ class Request {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function secure()
|
||||
public static function is_secure()
|
||||
{
|
||||
return (static::protocol() == 'https');
|
||||
}
|
||||
@@ -145,11 +134,22 @@ class Request {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ajax()
|
||||
public static function is_ajax()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and Str::lower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the route handling the request is a given name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public static function route_is($name)
|
||||
{
|
||||
return (is_array(static::$route->callback) and isset(static::$route->callback['name']) and static::$route->callback['name'] === $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic Method to handle dynamic static methods.
|
||||
*/
|
||||
@@ -160,9 +160,9 @@ class Request {
|
||||
//
|
||||
// Example: Request::is_login()
|
||||
// --------------------------------------------------------------
|
||||
if (strpos($method, 'is_') === 0)
|
||||
if (strpos($method, 'route_is_') === 0)
|
||||
{
|
||||
return static::is(substr($method, 3));
|
||||
return static::route_is(substr($method, 9));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class Router {
|
||||
|
||||
if (preg_match('#^'.$key.'$#', $method.' '.$uri))
|
||||
{
|
||||
return Request::$route = new Route($key, $callback, Route\Parser::parameters($uri, $key));
|
||||
return Request::$route = new Route($keys, $callback, Route\Parser::parameters($uri, $key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user