MediaWiki REL1_30
|
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack of outputting) via it. More...
Public Member Functions | |
clearCookie ( $name, $options=[]) | |
Unset a browser cookie. | |
getHeader ( $key) | |
Get a response header. | |
hasCookies () | |
Checks whether this request is performing cookie operations. | |
header ( $string, $replace=true, $http_response_code=null) | |
Output an HTTP header, wrapper for PHP's header() | |
headersSent () | |
Test if headers have been sent. | |
setCookie ( $name, $value, $expire=0, $options=[]) | |
Set the browser cookie. | |
statusHeader ( $code) | |
Output an HTTP status code header. | |
Static Protected Attributes | |
static array | $setCookies = [] |
Used to record set cookies, because PHP's setcookie() will happily send an identical Set-Cookie to the client. | |
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack of outputting) via it.
Definition at line 28 of file WebResponse.php.
WebResponse::clearCookie | ( | $name, | |
$options = [] ) |
Unset a browser cookie.
This sets the cookie with an empty value and an expiry set to a time in the past, which will cause the browser to remove any cookie with the given name, domain and path from its cookie store. Options other than these (and prefix) have no effect.
string | $name | Cookie name |
array | $options | Cookie options, see setCookie() |
Definition at line 170 of file WebResponse.php.
References $options, and setCookie().
WebResponse::getHeader | ( | $key | ) |
Get a response header.
string | $key | The name of the header to get (case insensitive). |
Reimplemented in FauxResponse.
Definition at line 56 of file WebResponse.php.
WebResponse::hasCookies | ( | ) |
Checks whether this request is performing cookie operations.
Definition at line 180 of file WebResponse.php.
References $setCookies.
WebResponse::header | ( | $string, | |
$replace = true, | |||
$http_response_code = null ) |
Output an HTTP header, wrapper for PHP's header()
string | $string | Header to output |
bool | $replace | Replace current similar header |
null | int | $http_response_code | Forces the HTTP response code to the specified value. |
Reimplemented in FauxResponse.
Definition at line 41 of file WebResponse.php.
References header().
Referenced by header().
WebResponse::headersSent | ( | ) |
Test if headers have been sent.
Reimplemented in FauxResponse.
Definition at line 80 of file WebResponse.php.
WebResponse::setCookie | ( | $name, | |
$value, | |||
$expire = 0, | |||
$options = [] ) |
Set the browser cookie.
string | $name | The name of the cookie. |
string | $value | The value to be stored in the cookie. |
int | null | $expire | Unix timestamp (in seconds) when the cookie should expire. 0 (the default) causes it to expire $wgCookieExpiration seconds from now. null causes it to be a session cookie. |
array | $options | Assoc of additional cookie options: prefix: string, name prefix ($wgCookiePrefix) domain: string, cookie domain ($wgCookieDomain) path: string, cookie path ($wgCookiePath) secure: bool, secure attribute ($wgCookieSecure) httpOnly: bool, httpOnly attribute ($wgCookieHttpOnly) |
Reimplemented in FauxResponse.
Definition at line 99 of file WebResponse.php.
References $name, $options, $value, $wgCookieDomain, $wgCookieExpiration, $wgCookieHttpOnly, $wgCookiePath, $wgCookiePrefix, $wgCookieSecure, string, and wfDebugLog().
Referenced by clearCookie(), and Block\setCookie().
WebResponse::statusHeader | ( | $code | ) |
Output an HTTP status code header.
int | $code | Status code |
Reimplemented in FauxResponse.
Definition at line 71 of file WebResponse.php.
References $code, and HttpStatus\header().
|
staticprotected |
Used to record set cookies, because PHP's setcookie() will happily send an identical Set-Cookie to the client.
Definition at line 33 of file WebResponse.php.
Referenced by hasCookies().