MediaWiki  REL1_24
DerivativeRequest Class Reference

Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base request for the remaining stuff (cookies, session and headers). More...

Inheritance diagram for DerivativeRequest:
Collaboration diagram for DerivativeRequest:

List of all members.

Public Member Functions

 __construct (WebRequest $base, $data, $wasPosted=false)
 checkSessionCookie ()
 Returns true if there is a session cookie set.
 getAcceptLang ()
 getAllHeaders ()
 Get an array containing all request headers.
 getCookie ($key, $prefix=null, $default=null)
 Get a cookie from the $_COOKIE jar.
 getHeader ($name)
 getIP ()
 getProtocol ()
 Get the current URL protocol (http or https)
 getSessionData ($key)
 setSessionData ($key, $data)

Private Attributes

 $base

Detailed Description

Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base request for the remaining stuff (cookies, session and headers).

Since:
1.19

Definition at line 1434 of file WebRequest.php.


Constructor & Destructor Documentation

DerivativeRequest::__construct ( WebRequest base,
data,
wasPosted = false 
)
Parameters:
WebRequest$base
array$dataArray of *non*-urlencoded key => value pairs, the fake GET/POST values
bool$wasPostedWhether to treat the data as POST

Definition at line 1443 of file WebRequest.php.


Member Function Documentation

Returns true if there is a session cookie set.

This does not necessarily mean that the user is logged in!

If you want to check for an open session, use session_id() instead; that will also tell you if the session was opened during the current request (in which case the cookie will be sent back to the client at the end of the script run).

Returns:
bool

Reimplemented from FauxRequest.

Definition at line 1452 of file WebRequest.php.

Definition at line 1472 of file WebRequest.php.

Get an array containing all request headers.

Returns:
array Mapping header name to its value

Reimplemented from WebRequest.

Definition at line 1460 of file WebRequest.php.

DerivativeRequest::getCookie ( key,
prefix = null,
default = null 
)

Get a cookie from the $_COOKIE jar.

Parameters:
string$keyThe name of the cookie
string$prefixA prefix to use for the cookie name, if not $wgCookiePrefix
mixed$defaultWhat to return if the value isn't found
Returns:
mixed Cookie value or $default if the cookie not set

Reimplemented from FauxRequest.

Definition at line 1448 of file WebRequest.php.

Parameters:
string$nameThe name of the header to get (case insensitive).
Returns:
bool|string

Reimplemented from FauxRequest.

Definition at line 1456 of file WebRequest.php.

Definition at line 1476 of file WebRequest.php.

Get the current URL protocol (http or https)

Returns:
string

Reimplemented from FauxRequest.

Definition at line 1480 of file WebRequest.php.

Parameters:
string$key
Returns:
array|null

Reimplemented from FauxRequest.

Definition at line 1464 of file WebRequest.php.

DerivativeRequest::setSessionData ( key,
data 
)
Parameters:
string$key
array$data

Reimplemented from FauxRequest.

Definition at line 1468 of file WebRequest.php.


Member Data Documentation

DerivativeRequest::$base [private]

Definition at line 1435 of file WebRequest.php.


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