Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
Request Class Reference
Inheritance diagram for Request:

Public Member Functions

 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIterator ()
 

Static Public Member Functions

static getInstance ()
 
static url ()
 
static protocol ()
 
static server ()
 
static path ()
 
static set ($param, $value)
 
static get ($param, $default=NULL)
 
static i18n ($param, $default=NULL, Callable $op=null)
 
static quoted ($param, $default=NULL)
 
static option ($param, $default=NULL)
 
static int ($param, $default=NULL)
 
static float ($param, $default=NULL)
 
static getDateTime ($param= 'date', $format= 'Y-m-d', $second_param=null, $second_format=null, $default=null)
 
static getTime ($param= 'time', $format= 'H:i', $date=null)
 
static username ($param, $default=NULL)
 
static getArray ($param)
 
static quotedArray ($param)
 
static optionArray ($param)
 
static intArray ($param)
 
static floatArray ($param)
 
static bool ($param, $default=null)
 
static boolArray ($param)
 
static usernameArray ($param)
 
static submitted ($param)
 
static submittedSome ($param)
 
static addslashes ($value)
 
static method ()
 
static isGet ()
 
static isPost ()
 
static isPut ()
 
static isDelete ()
 
static isXhr ()
 
static isAjax ()
 
static extract ($what)
 
static isDialog ()
 
static getObject ($param, $expected_class=null, $allow_null=true)
 
static getManyObjects ($param, $expected_class=null, $allow_null=true)
 

Detailed Description

Singleton class representing a HTTP request in Stud.IP.

Member Function Documentation

static addslashes (   $value)
static

Quote a given string or array using addslashes(). If the parameter is an array, the quoting is applied recursively.

Parameters
mixed$valuestring or array value to be quoted
Returns
mixed quoted string or array
static bool (   $param,
  $default = null 
)
static

Return the value of the selected query parameter as a boolean.

Parameters
string$paramparameter name
bool$defaultdefault value if parameter is not set
Returns
bool parameter value as bool (if set), else NULL
Since
Stud.IP 4.4
static boolArray (   $param)
static

Return the value of the selected query parameter as a boolean array.

Parameters
string$paramparameter name
Returns
array parameter value as array (if set), else an empty array
Since
Stud.IP 4.4
static extract (   $what)
static

extracts some params from request, the desired params must be a comma separated list for each param, the type of used extraction method can be specified after the name, default is get null values are not returned

e.g.: $data = Request::extract('admission_prelim int, admission_binding submitted, admission_prelim_txt'); will yield array(3) { ["admission_prelim"]=> int(1) ["admission_binding"]=> bool(false) ["admission_prelim_txt"]=> string(0) "" }

Parameters
string$whatcomma separated list of param names and types
Returns
array assoc array with extracted data
static float (   $param,
  $default = NULL 
)
static

Return the value of the selected query parameter as a float.

Parameters
string$paramparameter name
float$defaultdefault value if parameter is not set
Returns
float parameter value as float (if set), else NULL
static floatArray (   $param)
static

Return the value of the selected query parameter as a float array.

Parameters
string$paramparameter name
Returns
array parameter value as array (if set), else an empty array
static get (   $param,
  $default = NULL 
)
static

Return the value of the selected query parameter as a string.

Parameters
string$paramparameter name
string$defaultdefault value if parameter is not set
Returns
string parameter value as string (if set), else NULL
static getArray (   $param)
static

Return the value of the selected query parameter as an array.

Parameters
string$paramparameter name
Returns
array parameter value as array (if set), else an empty array
static getDateTime (   $param = 'date',
  $format = 'Y-m-d',
  $second_param = null,
  $second_format = null,
  $default = null 
)
static

Returns the date and time values from one or two fields as a DateTime object. The $second_param and $second_format parameters are handy in case the date and time values come from different fields.

Parameters
string$paramThe name of the date/time field.
string$formatThe date format of the date/time field.
string$second_paramThe name of the second field, if used. This parameter is optional.
string$second_formatThe time format of the second field, if used. This parameter is optional.
DateTime | null$defaultEither a default DateTime object or null if no default shall be set. In the latter case a DateTime object representing the unix timestamp 0 is returned.
Returns
DateTime|bool A DateTime object containing the date and time values of the specified date and time field. In case something went wrong the boolean value false is returned.
See Also
the following PHP documentation page for a list of accepted date and time formats: https://secure.php.net/manual/en/datetime.createfromformat.php
static getInstance ( )
static

Return the Request singleton instance.

getIterator ( )

IteratorAggregate: Create interator for request parameters.

static getManyObjects (   $param,
  $expected_class = null,
  $allow_null = true 
)
static

Returns a collection of objects that have previously been serialized using the ObjectBuilder.

Parameters
String$paramparameter name
mixed$expected_classExpected class name of objects (optional)
bool$allow_nullIf true, return empty array on error; otherwise an exception is thrown
Returns
array as collection of objects
Exceptions
Exceptionwhen an error occurs and $allow_null = false
See Also
ObjectBuilder
static getObject (   $param,
  $expected_class = null,
  $allow_null = true 
)
static

Returns an object that has previously been serialized using the ObjectBuilder.

Parameters
String$paramparameter name
mixed$expected_classExpected class name of object (optional)
bool$allow_nullIf true, return null on error; otherwise an exception is thrown
Returns
mixed Object of arbitrary type or null on error and $allow_null
Exceptions
Exceptionwhen an error occurs and $allow_null = false
See Also
ObjectBuilder
static getTime (   $param = 'time',
  $format = 'H:i',
  $date = null 
)
static

Retrieves a parameter that stores time data and converts the time data to a DateTime object. If a date is specified using an existing DateTime object, the time will be set on the existing DateTime object and the modified object is returned.

Parameters
string$paramThe name of the time field.
string$formatThe time format of the time field.
DateTime | null$dateAn optional DateTime object whose time shall be set from the specified parameter.
Returns
DateTime|bool A DateTime object containing the time value of the specified date and time field. In case something went wrong the boolean value false is returned.
static i18n (   $param,
  $default = NULL,
Callable  $op = null 
)
static

Return the value of the selected query parameter as an I18NString.

Parameters
string$paramparameter name
string$defaultdefault value if parameter is not set
Callable$opOperation to perform on each text string
Returns
I18NString parameter value as string (if set), else NULL
static int (   $param,
  $default = NULL 
)
static

Return the value of the selected query parameter as an integer.

Parameters
string$paramparameter name
int$defaultdefault value if parameter is not set
Returns
int parameter value as integer (if set), else NULL
static intArray (   $param)
static

Return the value of the selected query parameter as an integer array.

Parameters
string$paramparameter name
Returns
array parameter value as array (if set), else an empty array
static isAjax ( )
static

This is an alias of Request::isXhr

Returns
boolean true if this an XmlHttpRequest sent by jQuery/prototype
static isDelete ( )
static
Returns
boolean true if this a DELETE request
static isDialog ( )
static

returns true if http header indicates that the response will be rendered as dialog

Returns
bool
static isGet ( )
static
Returns
boolean true if this a GET request
static isPost ( )
static
Returns
boolean true if this a POST request
static isPut ( )
static
Returns
boolean true if this a PUT request
static isXhr ( )
static
Returns
boolean true if this an XmlHttpRequest sent by jQuery/prototype
static method ( )
static

Returns the (uppercase) request method.

Returns
string the uppercased method of the request
offsetExists (   $offset)

ArrayAccess: Check whether the given offset exists.

offsetGet (   $offset)

ArrayAccess: Get the value at the given offset.

offsetSet (   $offset,
  $value 
)

ArrayAccess: Set the value at the given offset.

offsetUnset (   $offset)

ArrayAccess: Delete the value at the given offset.

static option (   $param,
  $default = NULL 
)
static

Return the value of the selected query parameter as an alphanumeric string (consisting of only digits, letters and underscores).

Parameters
string$paramparameter name
string$defaultdefault value if parameter is not set
Returns
string parameter value as string (if set), else NULL
static optionArray (   $param)
static

Return the value of the selected query parameter as an array of alphanumeric strings (consisting of only digits, letters and underscores).

Parameters
string$paramparameter name
Returns
array parameter value as array (if set), else an empty array
static path ( )
static

Return the current request path, relative to the server root.

static protocol ( )
static

Return the current protocol ('http' or 'https').

static quoted (   $param,
  $default = NULL 
)
static

Return the value of the selected query parameter as a string. The contents of the string is quoted with addslashes().

Parameters
string$paramparameter name
string$defaultdefault value if parameter is not set
Returns
string parameter value as string (if set), else NULL
static quotedArray (   $param)
static

Return the value of the selected query parameter as a string array. The contents of each element is quoted with addslashes().

Parameters
string$paramparameter name
Returns
array parameter value as array (if set), else an empty array
static server ( )
static

Return the current server name and port (host:port).

static set (   $param,
  $value 
)
static

Set the selected query parameter to a specific value.

Parameters
string$paramparameter name
mixed$valueparameter value (string or array)
static submitted (   $param)
static

Check whether a form submit button has been pressed. This works for both image and text submit buttons.

Parameters
string$paramsubmit button name
Returns
boolean true if the button has been submitted, else false
static submittedSome (   $param)
static

Check whether one of the form submit buttons has been pressed. This works for both image and text submit buttons.

Parameters
string... a variable argument list of submit button names
Returns
boolean true if any button has been submitted, else false
static url ( )
static

Return the current URL, including query parameters.

static username (   $param,
  $default = NULL 
)
static

Return the value of the selected query parameter as a string consisting only of allowed characters for usernames.

Parameters
string$paramparameter name
string$defaultdefault value if parameter is not set
Returns
string parameter value (if set), else NULL
static usernameArray (   $param)
static

Return the value of the selected query parameter as an array of strings consisting only of allowed characters for usernames.

Parameters
string$paramparameter name
Returns
array parameter value as array (if set), else an empty array

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