Arbit - project tracking

Arbit - project tracking

API documentation :: Docs For Class arbitHttpTools

Core::arbitHttpTools

Class arbitHttpTools

Arbit HTTP tool class Provides basic methods to interface with the request handling environment offered by PHP, implementing sanity checking, and a abstraction layer to be more setup independant.

Arbit HTTP tool class Provides basic methods to interface with the request handling environment offered by PHP, implementing sanity checking, and a abstraction layer to be more setup independant.

Author(s):
Version:   $Revision: 1629 $
License:   GPL

Constants

RAW = 'arbitHttpNoConverter' Get raw value, passed in by the browser. normally.

Get raw value, passed in by the browser. Should not be necessary to use normally.

TYPE_ARRAY = 'arbitHttpArrayConverter' Get value passed in by the browser as an array. provided, an empty array is returned.

Get value passed in by the browser as an array. If no value has been provided, an empty array is returned.

TYPE_NUMERIC = 'arbitHttpNumberConverter' Get value passed in by the browser as a float number.

Get value passed in by the browser as a float number.

TYPE_STRING = 'arbitHttpStringConverter' Get value passed in by the browser as an UTF-8 string. encoding conversions will be handled transparently.

Get value passed in by the browser as an UTF-8 string. The charset and encoding conversions will be handled transparently.

Member Variables

protected static mixed $formOk
Variable indicating if the one-time token for the submitted form has been OK, or still needs to be checked. check result, or null, if the check did not yet happen.

Variable indicating if the one-time token for the submitted form has been OK, or still needs to be checked. Either boolean, indication the check result, or null, if the check did not yet happen.

protected static array $serverDefaulValues
Default values for commonly user server variables, when it makes sense to supply one.

Default values for commonly user server variables, when it makes sense to supply one. This array is provided for the case, that some server variables are not set in some special environment.

Method Summary

public static void error( $code )
Send HTTP error Send a HTTP error of the provided code.
public static mixed get( $name , [ $type = self::TYPE_STRING] )
Get a request variable.
public static array getFiles( $name )
Get files for given identifier Get all files, which are sent by the client with the given identifier.
public static void header( $string )
Send header Send HTTP header, if this is still possible, and throw a exception otherwise.
public static bool isHttpRequest( )
Is this a HTTP request? Returns true, if this is a HTTP request, and headers may be sent. is required, since the PHP session functions try to send headers themselves and does not allow us to dispatch the sending of headers into the proper output writers.
public static string serverVariable( $key )
Return server environment variable value Return (unquoted) value from the superglobal $_SERVER array. value is not available, return the default value. default value either, null will be returned.
public static void setCookie( $name , $value , $path , [ $time = 0] , [ $httpOnly = true] )
Set cookie Set a cookie with the given name and value for the currently used host.
protected static string unquote( $value )
Unquote autoescaped values If magic_quotes_gpc is set, all values are pseudo-escaped with useless slashes. disable magic_quotes_gpc in your global php.

Methods

error

static void error( int $code )

Send HTTP error Send a HTTP error of the provided code.

Send HTTP error Send a HTTP error of the provided code.

Parameters:
Name Type Description
$code int

get

static mixed get( string $name , [int $type = self::TYPE_STRING] )

Get a request variable.

Get a request variable. Get POST and COOKIE variables from the current request context. GET variables can already be found in the arbit request struct, so that they cannot be fetched using this method. You may specify the type of the variable you want to receive by the optional second parameter. It defaults to string, which means that no modifications are applied to the request value. If the variable is not available in the current request, or the contents from a form were requested, and the one-time token wasn't valid anymore the method will return null.

Parameters:
Name Type Description
$name string
$type int

getFiles

static array getFiles( string $name )

Get files for given identifier Get all files, which are sent by the client with the given identifier.

Get files for given identifier Get all files, which are sent by the client with the given identifier.

Parameters:
Name Type Description
$name string

header

static void header( string $string )

Send header Send HTTP header, if this is still possible, and throw a exception otherwise.

Send header Send HTTP header, if this is still possible, and throw a exception otherwise. The exception may be cought in test cases to ensure the correct header has been sent.

Parameters:
Name Type Description
$string string

isHttpRequest

static bool isHttpRequest( )

Is this a HTTP request? Returns true, if this is a HTTP request, and headers may be sent. is required, since the PHP session functions try to send headers themselves and does not allow us to dispatch the sending of headers into the proper output writers.

Is this a HTTP request? Returns true, if this is a HTTP request, and headers may be sent. This is required, since the PHP session functions try to send headers themselves and does not allow us to dispatch the sending of headers into the proper output writers.

serverVariable

static string serverVariable( string $key )

Return server environment variable value Return (unquoted) value from the superglobal $_SERVER array. value is not available, return the default value. default value either, null will be returned.

Return server environment variable value Return (unquoted) value from the superglobal $_SERVER array. If the value is not available, return the default value. If there isn't a default value either, null will be returned.

Parameters:
Name Type Description
$key string

setCookie

static void setCookie( string $name , string $value , string $path , [int $time = 0] , [bool $httpOnly = true] )

Set cookie Set a cookie with the given name and value for the currently used host.

Set cookie Set a cookie with the given name and value for the currently used host. A path is mandatory to specify the current root of the project.

Parameters:
Name Type Description
$name string
$value string
$path string
$time int
$httpOnly bool

unquote

static string unquote( string $value )

Unquote autoescaped values If magic_quotes_gpc is set, all values are pseudo-escaped with useless slashes. disable magic_quotes_gpc in your global php.

Unquote autoescaped values If magic_quotes_gpc is set, all values are pseudo-escaped with useless slashes. We remove them, if set, or just keep the value. You WANT to disable magic_quotes_gpc in your global php.ini.

Parameters:
Name Type Description
$value string
Documentation generated on Mon, 05 Apr 2010 14:01:59 +0200 by phpDocumentor 1.4.3