AnewtRequest Class Reference

The AnewtRequest class contains request information. More...

List of all members.

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.


Detailed Description

The AnewtRequest class contains request information.

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.


Member Function Documentation

static AnewtRequest::url ( include_query_string = true  )  [static]

Alias for AnewtRequest::relative_url().

Parameters:
$include_query_string Whether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true)
Returns:
The relative URL for the current request.
See also:
AnewtRequest::relative_url

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.

Parameters:
$include_query_string Whether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true)
Returns:
The relative URL for the current request.
See also:
AnewtRequest::canonical_url

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.

Parameters:
$include_query_string Whether the query string (the part after the question mark in HTTP GET request should be included (optional, defaults to true)
Returns:
The canonical URL for the current request.
See also:
AnewtRequest::relative_url

AnewtRequest::canonical_base_url

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.

Returns:
The canonical base URL for the current request.
See also:
AnewtRequest::canonical_url

Definition at line 116 of file request.lib.php.

static AnewtRequest::host (  )  [static]

Returns the hostname as provided in the server configuration.

Returns:
Host name for the current request.

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.

Returns:
Host name for the current request.

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.

Returns:
Domain name for the current request.

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.

Returns:
The refererring url of the current request, or null.

Definition at line 227 of file request.lib.php.

static AnewtRequest::referrer (  )  [static]

Alias for AnewtRequest::referer.

See also:
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).

Returns:
A string telling which type of request this is. This can be either 'GET' or 'POST'.
See also:
AnewtRequest::is_get

AnewtRequest::is_post

Definition at line 262 of file request.lib.php.

static AnewtRequest::is_get (  )  [static]

Check if the request is a HTTP GET request.

Returns:
True if the request is a GET request, false otherwise.
See also:
AnewtRequest::is_post

AnewtRequest::method

Definition at line 289 of file request.lib.php.

static AnewtRequest::is_post (  )  [static]

Check if the request is a HTTP POST request.

Returns:
True if the request is a POST request, false otherwise.
See also:
AnewtRequest::is_get

AnewtRequest::method

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.

Parameters:
$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.
Returns:
A valid integer or the default value.

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.

Parameters:
$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.
Returns:
A valid integer or the default value.

Definition at line 334 of file request.lib.php.

static AnewtRequest::cookie_int ( key,
default = null 
) [static]

Gets an integer from the COOKIE data.

Parameters:
$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.
Returns:
A valid integer or the default value.

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.

Parameters:
$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.
Returns:
A string or the default value.

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.

Parameters:
$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.
Returns:
A string or the default value.

Definition at line 379 of file request.lib.php.

static AnewtRequest::cookie_string ( key,
default = null 
) [static]

Gets a string from the COOKIE data.

Parameters:
$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.
Returns:
A string or the default value.

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.

Parameters:
$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.
Returns:
A string or the default value.
See also:
array_get_bool

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.

Parameters:
$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.
Returns:
A string or the default value.
See also:
array_get_bool

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.

Parameters:
$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.
Returns:
A string or the default value.
See also:
array_get_bool

Definition at line 457 of file request.lib.php.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:38 2009 for Anewt by  doxygen 1.5.9