\rex_request

Class for getting the superglobals.

Summary

Methods
Properties
Constants
get()
post()
request()
server()
session()
setSession()
unsetSession()
clearSession()
cookie()
files()
env()
requestMethod()
isXmlHttpRequest()
isPJAXRequest()
isPJAXContainer()
isHttps()
getSessionNamespace()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

get()

get(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_GET and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Returns

mixed —

post()

post(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_POST and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Returns

mixed —

request()

request(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_REQUEST and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Returns

mixed —

server()

server(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_SERVER and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Returns

mixed —

session()

session(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_SESSION and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Throws

\rex_exception

Returns

mixed —

setSession()

setSession(string  $varname, mixed  $value) : mixed

Sets a session variable.

Parameters

string $varname

Variable name

mixed $value

Value

Throws

\rex_exception

Returns

mixed —

unsetSession()

unsetSession(string  $varname) : mixed

Deletes a session variable.

Parameters

string $varname

Variable name

Throws

\rex_exception

Returns

mixed —

clearSession()

clearSession() : mixed

clear redaxo session contents within the current namespace (the session itself stays alive).

Throws

\rex_exception

Returns

mixed —

cookie()

cookie(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_COOKIE and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Returns

mixed —

files()

files(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_FILES and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Returns

mixed —

env()

env(string  $varname, mixed  $vartype = '', mixed  $default = '') : mixed

Returns the variable $varname of $_ENV and casts the value.

Parameters

string $varname

Variable name

mixed $vartype

Variable type

mixed $default

Default value

Returns

mixed —

requestMethod()

requestMethod() : string

Returns the HTTP method of the current request.

Returns

string —

HTTP method in lowercase (head,get,post,put,delete)

isXmlHttpRequest()

isXmlHttpRequest() : bool

Returns true if the request is a XMLHttpRequest.

This only works if your javaScript library sets an X-Requested-With HTTP header. This is the case with Prototype, Mootools, jQuery, and perhaps others.

Inspired by a method of the symfony framework.

Returns

bool —

true if the request is an XMLHttpRequest, false otherwise

isPJAXRequest()

isPJAXRequest() : bool

Returns true if the request is a PJAX-Request.

Returns

bool —

isPJAXContainer()

isPJAXContainer(string  $containerId) : bool

Returns true when the current request is a PJAX-Request and the requested container matches the given $containerId.

Parameters

string $containerId

Returns

bool —

isHttps()

isHttps() : bool

Returns whether the current request is served via https/ssl.

Returns

bool —

true when https/ssl, otherwise false

getSessionNamespace()

getSessionNamespace() : string

Returns the session namespace for the current http request.

Returns

string —