MediaWiki  1.23.1
AjaxResponse Class Reference

Handle responses for Ajax requests (send headers, print content, that sort of thing) More...

Collaboration diagram for AjaxResponse:

Public Member Functions

 __construct ( $text=null)
 
 addText ( $text)
 Add content to the response. More...
 
 checkLastModified ( $timestamp)
 checkLastModified tells the client to use the client-cached response if possible. More...
 
 disable ()
 Disable output. More...
 
 loadFromMemcached ( $mckey, $touched)
 
 printText ()
 Output text. More...
 
 sendHeaders ()
 Construct the header and output it. More...
 
 setCacheDuration ( $duration)
 Set the number of seconds to get the response cached by a proxy. More...
 
 setContentType ( $type)
 Set the HTTP header Content-Type. More...
 
 setResponseCode ( $code)
 Set the HTTP response code. More...
 
 setVary ( $vary)
 Set the HTTP Vary header. More...
 
 storeInMemcached ( $mckey, $expiry=86400)
 

Private Attributes

int $mCacheDuration
 Number of seconds to get the response cached by a proxy $mCacheDuration. More...
 
string $mContentType
 HTTP header Content-Type $mContentType. More...
 
bool $mDisabled
 Disables output. More...
 
string false $mLastModified
 Date for the HTTP header Last-modified $mLastModified. More...
 
string $mResponseCode
 HTTP response code $mResponseCode. More...
 
string $mText
 Content of our HTTP response $mText. More...
 
string $mVary
 HTTP Vary header $mVary. More...
 

Detailed Description

Handle responses for Ajax requests (send headers, print content, that sort of thing)

Definition at line 30 of file AjaxResponse.php.

Constructor & Destructor Documentation

◆ __construct()

AjaxResponse::__construct (   $text = null)
Parameters
$textstring|null

Definition at line 69 of file AjaxResponse.php.

References addText().

Member Function Documentation

◆ addText()

AjaxResponse::addText (   $text)

Add content to the response.

Parameters
$textstring

Definition at line 127 of file AjaxResponse.php.

Referenced by __construct().

◆ checkLastModified()

AjaxResponse::checkLastModified (   $timestamp)

checkLastModified tells the client to use the client-cached response if possible.

If successful, the AjaxResponse is disabled so that any future call to AjaxResponse::printText() have no effect.

Parameters
$timestampstring
Returns
bool Returns true if the response code was set to 304 Not Modified.

Definition at line 205 of file AjaxResponse.php.

References $fname, $timestamp, $wgUser, disable(), global, setResponseCode(), TS_MW, TS_RFC2822, wfDebug(), and wfTimestamp().

◆ disable()

AjaxResponse::disable ( )

Disable output.

Definition at line 119 of file AjaxResponse.php.

Referenced by checkLastModified().

◆ loadFromMemcached()

AjaxResponse::loadFromMemcached (   $mckey,
  $touched 
)
Parameters
$mckeystring
$touchedint
Returns
bool

Definition at line 262 of file AjaxResponse.php.

References $wgMemc, global, and wfDebug().

◆ printText()

AjaxResponse::printText ( )

Output text.

Definition at line 136 of file AjaxResponse.php.

References $mText.

◆ sendHeaders()

AjaxResponse::sendHeaders ( )

Construct the header and output it.

Definition at line 145 of file AjaxResponse.php.

References $n, and global.

◆ setCacheDuration()

AjaxResponse::setCacheDuration (   $duration)

Set the number of seconds to get the response cached by a proxy.

Parameters
$durationint

Definition at line 88 of file AjaxResponse.php.

◆ setContentType()

AjaxResponse::setContentType (   $type)

Set the HTTP header Content-Type.

Parameters
$typestring

Definition at line 112 of file AjaxResponse.php.

References $type.

◆ setResponseCode()

AjaxResponse::setResponseCode (   $code)

Set the HTTP response code.

Parameters
$codestring

Definition at line 104 of file AjaxResponse.php.

Referenced by checkLastModified().

◆ setVary()

AjaxResponse::setVary (   $vary)

Set the HTTP Vary header.

Parameters
$varystring

Definition at line 96 of file AjaxResponse.php.

◆ storeInMemcached()

AjaxResponse::storeInMemcached (   $mckey,
  $expiry = 86400 
)
Parameters
$mckeystring
$expiryint
Returns
bool

Definition at line 290 of file AjaxResponse.php.

References $wgMemc, array(), global, and wfTimestampNow().

Member Data Documentation

◆ $mCacheDuration

int AjaxResponse::$mCacheDuration
private

Number of seconds to get the response cached by a proxy $mCacheDuration.

Definition at line 34 of file AjaxResponse.php.

◆ $mContentType

string AjaxResponse::$mContentType
private

HTTP header Content-Type $mContentType.

Definition at line 39 of file AjaxResponse.php.

◆ $mDisabled

bool AjaxResponse::$mDisabled
private

Disables output.

Can be set by calling $AjaxResponse->disable() $mDisabled

Definition at line 44 of file AjaxResponse.php.

◆ $mLastModified

string false AjaxResponse::$mLastModified
private

Date for the HTTP header Last-modified $mLastModified.

Definition at line 49 of file AjaxResponse.php.

◆ $mResponseCode

string AjaxResponse::$mResponseCode
private

HTTP response code $mResponseCode.

Definition at line 54 of file AjaxResponse.php.

◆ $mText

string AjaxResponse::$mText
private

Content of our HTTP response $mText.

Definition at line 64 of file AjaxResponse.php.

Referenced by printText().

◆ $mVary

string AjaxResponse::$mVary
private

HTTP Vary header $mVary.

Definition at line 59 of file AjaxResponse.php.


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