Static Public Member Functions | |
URL methods | |
These method can be used to find out various forms of the request url, e.g. relative and absolute urls, domain names, and so on. | |
| static | url ($include_query_string=true) |
| Alias for AnewtRequest::relative_url(). | |
| static | relative_url ($include_query_string=true) |
| Returns the relative URL for the current request. | |
| static | canonical_url ($include_query_string=true) |
| Returns the canonical URL for the current request. | |
| static | canonical_base_url () |
| Returns the canonical base URL for the current request. | |
| static | host () |
| Returns the hostname as provided in the server configuration. | |
| static | http_host () |
| Returns the host name as provided in the client's HTTP Host header. | |
| static | domain () |
| Return the domain name for the current request. | |
| static | referer () |
| Return the HTTP referer of the current request, if any. | |
| static | referrer () |
| Alias for AnewtRequest::referer. | |
GET, POST, and cookie methods | |
These methods allow you to find out the request method of the current request, and offers various type-safe methods to extract values from GET and POST parameters and cookies. | |
| static | method () |
| Returns the method type of this request (GET or POST). | |
| static | is_get () |
| Check if the request is a HTTP GET request. | |
| static | is_post () |
| Check if the request is a HTTP POST request. | |
| static | get_int ($key, $default=null) |
| Get an integer from the GET request data. | |
| static | post_int ($key, $default=null) |
| Gets an integer from the POST request data. | |
| static | cookie_int ($key, $default=null) |
| Gets an integer from the COOKIE data. | |
| static | get_string ($key, $default=null) |
| Gets a string from the GET request data. | |
| static | post_string ($key, $default=null) |
| Gets a string from the POST request data. | |
| static | cookie_string ($key, $default=null) |
| Gets a string from the COOKIE data. | |
| static | get_bool ($key, $default=null) |
| Gets a boolean value from the GET data. | |
| static | post_bool ($key, $default=null) |
| Gets a boolean value from the POST data. | |
| static | cookie_bool ($key, $default=null) |
| Gets a boolean value from the COOKIE data. | |
This class provides several static methods that can be used to get information about the current HTTP request.
Definition at line 16 of file request.lib.php.
| static AnewtRequest::url | ( | $ | include_query_string = true |
) | [static] |
Alias for AnewtRequest::relative_url().
| $include_query_string | Whether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true) |
Definition at line 36 of file request.lib.php.
| static AnewtRequest::relative_url | ( | $ | include_query_string = true |
) | [static] |
Returns the relative URL for the current request.
| $include_query_string | Whether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true) |
Definition at line 53 of file request.lib.php.
| static AnewtRequest::canonical_url | ( | $ | include_query_string = true |
) | [static] |
Returns the canonical URL for the current request.
This includes the http part, the hostname and (optionally) port number.
| $include_query_string | Whether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true) |
Definition at line 96 of file request.lib.php.
| static AnewtRequest::canonical_base_url | ( | ) | [static] |
Returns the canonical base URL for the current request.
This includes the http part, the hostname and (optionally) port number.
Definition at line 116 of file request.lib.php.
| static AnewtRequest::host | ( | ) | [static] |
Returns the hostname as provided in the server configuration.
Definition at line 156 of file request.lib.php.
| static AnewtRequest::http_host | ( | ) | [static] |
Returns the host name as provided in the client's HTTP Host header.
Note that this value should be treated as unsafe, since it's user-provided.
Definition at line 167 of file request.lib.php.
| static AnewtRequest::domain | ( | ) | [static] |
Return the domain name for the current request.
Heuristics are used to detect the the domain name. This will fail horribly for extremely short domain names. A domain name is assumed to be the rightmost part of the full hostname. A test on very short strings is used to detect top level domains such as .com, .nl and double ones like .co.uk. This obviously fails for longer top level domains and extremely short domain names.
Definition at line 182 of file request.lib.php.
| static AnewtRequest::referer | ( | ) | [static] |
Return the HTTP referer of the current request, if any.
This method uses the HTTP_REFERER header in the HTTP request, and will return null if no referer was set.
Definition at line 227 of file request.lib.php.
| static AnewtRequest::referrer | ( | ) | [static] |
Alias for AnewtRequest::referer.
Definition at line 237 of file request.lib.php.
| static AnewtRequest::method | ( | ) | [static] |
Returns the method type of this request (GET or POST).
Definition at line 262 of file request.lib.php.
| static AnewtRequest::is_get | ( | ) | [static] |
Check if the request is a HTTP GET request.
Definition at line 289 of file request.lib.php.
| static AnewtRequest::is_post | ( | ) | [static] |
Check if the request is a HTTP POST request.
Definition at line 303 of file request.lib.php.
| static AnewtRequest::get_int | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Get an integer from the GET request data.
| $key | The name of the integer. | |
| $default | The default value to return if no valid integer was found. If you omit this parameter, null is used. |
Definition at line 320 of file request.lib.php.
| static AnewtRequest::post_int | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets an integer from the POST request data.
| $key | The name of the integer. | |
| $default | The default value to return if no valid integer was found. If you omit this parameter, null is used. |
Definition at line 334 of file request.lib.php.
| static AnewtRequest::cookie_int | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets an integer from the COOKIE data.
| $key | The name of the integer. | |
| $default | The default value to return if no valid integer was found. If you omit this parameter, null is used. |
Definition at line 348 of file request.lib.php.
| static AnewtRequest::get_string | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets a string from the GET request data.
| $key | The name of the string. | |
| $default | The default value to return if no string was found. If you omit this parameter, null is used. |
Definition at line 365 of file request.lib.php.
| static AnewtRequest::post_string | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets a string from the POST request data.
| $key | The name of the string. | |
| $default | The default value to return if no string was found. If you omit this parameter, null is used. |
Definition at line 379 of file request.lib.php.
| static AnewtRequest::cookie_string | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets a string from the COOKIE data.
| $key | The name of the string. | |
| $default | The default value to return if no string was found. If you omit this parameter, null is used. |
Definition at line 393 of file request.lib.php.
| static AnewtRequest::get_bool | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets a boolean value from the GET data.
| $key | The name of the boolean. | |
| $default | The default value to return if no valid boolean was found. If you omit this parameter, null is used. |
Definition at line 417 of file request.lib.php.
| static AnewtRequest::post_bool | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets a boolean value from the POST data.
| $key | The name of the boolean. | |
| $default | The default value to return if no valid boolean was found. If you omit this parameter, null is used. |
Definition at line 437 of file request.lib.php.
| static AnewtRequest::cookie_bool | ( | $ | key, | |
| $ | default = null | |||
| ) | [static] |
Gets a boolean value from the COOKIE data.
| $key | The name of the boolean. | |
| $default | The default value to return if no valid boolean was found. If you omit this parameter, null is used. |
Definition at line 457 of file request.lib.php.
1.5.9