diff --git a/system/request.php b/system/request.php index 5e933bee..9b954bc6 100644 --- a/system/request.php +++ b/system/request.php @@ -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)); } } diff --git a/system/router.php b/system/router.php index 3bb18981..bb35cef2 100644 --- a/system/router.php +++ b/system/router.php @@ -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)); } } }