Stud.IP  jlu_4.3 Revision 64286
Request Class Reference
Inheritance diagram for Request:
Inheritance graph
Collaboration diagram for Request:
Collaboration graph

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)
 
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 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

◆ addslashes()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract()

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
Here is the caller graph for this function:

◆ float()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ floatArray()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

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
Here is the call graph for this function:

◆ getArray()

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
Here is the call graph for this function:

◆ getDateTime()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInstance()

static getInstance ( )
static

Return the Request singleton instance.

Here is the caller graph for this function:

◆ getIterator()

getIterator ( )

IteratorAggregate: Create interator for request parameters.

◆ getManyObjects()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObject()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTime()

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.
Here is the call graph for this function:

◆ i18n()

static i18n (   $param,
  $default = 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
Returns
I18NString parameter value as string (if set), else NULL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ int()

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
Here is the call graph for this function:

◆ intArray()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAjax()

static isAjax ( )
static

This is an alias of Request::isXhr

Returns
boolean true if this an XmlHttpRequest sent by jQuery/prototype
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDelete()

static isDelete ( )
static
Returns
boolean true if this a DELETE request
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDialog()

static isDialog ( )
static

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

Returns
bool
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isGet()

static isGet ( )
static
Returns
boolean true if this a GET request
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isPost()

static isPost ( )
static
Returns
boolean true if this a POST request
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isPut()

static isPut ( )
static
Returns
boolean true if this a PUT request
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isXhr()

static isXhr ( )
static
Returns
boolean true if this an XmlHttpRequest sent by jQuery/prototype

◆ method()

static method ( )
static

Returns the (uppercase) request method.

Returns
string the uppercased method of the request
Here is the caller graph for this function:

◆ offsetExists()

offsetExists (   $offset)

ArrayAccess: Check whether the given offset exists.

◆ offsetGet()

offsetGet (   $offset)

ArrayAccess: Get the value at the given offset.

◆ offsetSet()

offsetSet (   $offset,
  $value 
)

ArrayAccess: Set the value at the given offset.

◆ offsetUnset()

offsetUnset (   $offset)

ArrayAccess: Delete the value at the given offset.

◆ option()

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
Here is the call graph for this function:

◆ optionArray()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ path()

static path ( )
static

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

Here is the caller graph for this function:

◆ protocol()

static protocol ( )
static

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

Here is the caller graph for this function:

◆ quoted()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ quotedArray()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ server()

static server ( )
static

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

Here is the caller graph for this function:

◆ set()

static set (   $param,
  $value 
)
static

Set the selected query parameter to a specific value.

Parameters
string$paramparameter name
mixed$valueparameter value (string or array)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ submitted()

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
Here is the call graph for this function:

◆ submittedSome()

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
Here is the caller graph for this function:

◆ url()

static url ( )
static

Return the current URL, including query parameters.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ username()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ usernameArray()

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
Here is the call graph for this function:
Here is the caller graph for this function:

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