Properties

$TYPE_UNKNOWN

$TYPE_UNKNOWN : 

Unknown type. It will <b>not</b> be used. Just for initialize.

..

Type

$TYPE_ACTION

$TYPE_ACTION : 

Action type (called from link)

Type

$TYPE_AJAX

$TYPE_AJAX : 

Action type (called from AJAX)

Type

$TYPE_MENU

$TYPE_MENU : 

Action type (called from menu)

Type

$TYPE_VIEW

$TYPE_VIEW : 

View type

Type

$queryTypes

$queryTypes : 

Possible query types

Type

$request

$request : 

Type

$upload

$upload : 

Type

$checkedFields

$checkedFields : 

Type

$checkedUploads

$checkedUploads : 

Type

$server

$server : 

Type

$cookie

$cookie : 

Type

$instance

$instance : 

Type

Methods

getInstance()

getInstance() : \myMVC_HttpRequest

Returns the instance of this class.

Returns

\myMVC_HttpRequest

An instance of the request class

getRequestMethod()

getRequestMethod() : string

Returns the request method (GET/POST)

Returns

string —

The request method

getQueryString()

getQueryString() : string

Returns HTTP query string

Returns

string —

The HTTP query string

getReferrer()

getReferrer() : array

Returns the referrer of the current page

Returns

array —

The referrer as associative array (type = cmd|view, name = <Action|View name>) or false, if no referrer can be found

getQueryType()

getQueryType() : string

Returns the query type (Action or View)

Returns

string —

The query type [cmd|menu|view] or false if no known query was found

getQueryTypes()

getQueryTypes(string  $postfix = '') : array

Returns all valid query types

Parameters

string $postfix

Postfix to add to all query types

Returns

array —

An array with all valid query types

isEmptyRequest()

isEmptyRequest() : boolean

Returns whether the current query is empty (then it must be forwarded to a default)

Returns

boolean —

true if the query is empty, false otherwise

getAction()

getAction() : string

Returns the current action or false if no action was called

Returns

string —

The called action or false if no action was called

isAJAX()

isAJAX() : boolean

Returns if the current action was called as AJAX

Returns

boolean —

true if the current Action was called as AJAX, false otherwise

getView()

getView() : string

Returns the current view or false if no action was called

Returns

string —

The called view or false if no action was called

setParameterValid()

setParameterValid(string  $parameter) 

Set the given parameter as valid (passed the validation)

Parameters

string $parameter

The name of the valid parameter

getAllParameters()

getAllParameters(boolean  $checked = true) 

Returns an associative array with all given parameters and their value (format: 'parameter' => 'value')

Parameters

boolean $checked

If true (default), then just checked parameter will be returned

getInvalidParameters()

getInvalidParameters() 

Returns an associative array with all parameters, that passed the validation, and their value (format: 'parameter' => 'value')

hasSubmitParameter()

hasSubmitParameter(string  $key) : boolean

Returns whether the given <b>unvalidated</b> parameter exists

Parameters

string $key

The name of the parameter

Returns

boolean —

true if it exists, false otherwise

hasSubmitParameterLike()

hasSubmitParameterLike(string  $key) : boolean

Returns whether the an <b>unvalidated</b> parameter starting with $key exists

Parameters

string $key

The name of the parameter

Returns

boolean —

true if it exists, false otherwise

getSubmitParameter()

getSubmitParameter(string  $key) : string

Returns the <b>unvalidated</b> value for the given parameter.

Useful if a form has more submit buttons and you want to check which button was used

Parameters

string $key

The name of the parameter

Returns

string —

The value of the parameters or false if it doesn't exists

getSubmitParameterLike()

getSubmitParameterLike(string  $key) : string

Returns the <b>unvalidated</b> value for the parameter starting with $key.

Useful if a form has more submit buttons and you want to check which button was used

Parameters

string $key

The name of the parameter

Returns

string —

The value of the parameters or false if it doesn't exists

getSubmitParameterNameLike()

getSubmitParameterNameLike(string  $key) : string

Returns the <b>name</b> of the parameter starting with $key.

Useful if a form has more submit buttons and you want to check which button was used

Parameters

string $key

The name of the parameter

Returns

string —

The name of the parameters or false if it doesn't exists

hasParameter()

hasParameter(string  $key) : boolean

Returns whether the given parameter exists

Parameters

string $key

The name of the parameter

Returns

boolean —

true if it exists, false otherwise

hasParameterLike()

hasParameterLike(string  $key) : boolean

Returns whether the a parameter starting with $key exists

Parameters

string $key

The name of the parameter

Returns

boolean —

true if it exists, false otherwise

getParameter()

getParameter(string  $key) : string

Returns the value of the given parameter

Parameters

string $key

The name of the parameter

Returns

string —

The value of the parameters or false if it doesn't exists

getParameterLike()

getParameterLike(string  $key) : string

Returns the value of a parameter starting with $key

Parameters

string $key

The name of the parameter

Returns

string —

The value of the parameters or false if it doesn't exists

setParameter()

setParameter(string  $key, string  $value) 

Set a value for a parameter (useful to call other pages)

Parameters

string $key

The name of the parameter

string $value

The value

getSubmitUpload()

getSubmitUpload(string  $key) : array

Returns the <b>unvalidated</b> value for the given upload.

Useful if a form has more submit buttons and you want to check which button was used

Parameters

string $key

The name of the parameter

Returns

array —

The value of the parameters or false if it doesn't exists

hasUpload()

hasUpload(string  $key) : boolean

Returns whether the given upload exists and a file was uploaded

Parameters

string $key

The name of the parameter

Returns

boolean —

true if it exists, false otherwise

getUpload()

getUpload(string  $key) : array

Return the upload file, if given

Parameters

string $key

The name of the parameter

Returns

array —

Associative array with the file data ot false if no file uploaded Keys: name, type, size, tmp_name, error

__construct()

__construct() 

Constructor.

Get from PHP engine the request. WARNING: This class has to be used as Singleton! Example:

$request = myMVC_HttpRequest::getInstance();