1) { return in_array(static::uri(), $parameters); } if (count($parameters) === 1) { return static::uri() == $parameters[0]; } return false; } /** * Get the request method. * * @return string */ public static function 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']); } /** * Get the requestor's IP address. * * @return string */ public static function ip() { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { return $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { return $_SERVER['HTTP_CLIENT_IP']; } elseif (isset($_SERVER['REMOTE_ADDR'])) { return $_SERVER['REMOTE_ADDR']; } } /** * Determine if the request is using HTTPS. * * @return bool */ public static function is_secure() { return (static::protocol() == 'https'); } /** * Get the HTTP protocol for the request. * * @return string */ public static function protocol() { return (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; } /** * Determine if the request is an AJAX request. * * @return bool */ public static function is_ajax() { return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and Str::lower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); } }