MediaWiki
master
|
Group all the pieces relevant to the context of a request into one instance. More...
Public Member Functions | |
canUseWikiPage () | |
Check whether a WikiPage object can be get with getWikiPage(). | |
getLang () | |
getLanguage () | |
Get the Language object. | |
getOutput () | |
Get the OutputPage object. | |
getRequest () | |
Get the WebRequest object. | |
getSkin () | |
Get the Skin object. | |
getTitle () | |
Get the Title object. | |
getUser () | |
Get the User object. | |
getWikiPage () | |
Get the WikiPage object. | |
msg () | |
Helpful methods. | |
setLang ($l) | |
Set the Language object. | |
setLanguage ($l) | |
Set the Language object. | |
setOutput (OutputPage $o) | |
setRequest (WebRequest $r) | |
Set the WebRequest object. | |
setSkin (Skin $s) | |
Set the Skin object. | |
setTitle (Title $t) | |
Set the Title object. | |
setUser (User $u) | |
Set the User object. | |
setWikiPage (WikiPage $p) | |
Set the WikiPage object. | |
Static Public Member Functions | |
static | getMain () |
Static methods. | |
static | newExtraneousContext (Title $title, $request=array()) |
Create a new extraneous context. | |
static | sanitizeLangCode ($code) |
Accepts a language code and ensures it's sane. | |
Private Attributes | |
Language | $lang |
OutputPage | $output |
WebRequest | $request |
Skin | $skin |
Title | $title |
User | $user |
WikiPage | $wikipage |
Group all the pieces relevant to the context of a request into one instance.
Definition at line 30 of file RequestContext.php.
Check whether a WikiPage object can be get with getWikiPage().
Callers should expect that an exception is thrown from getWikiPage() if this method returns false.
Implements IContextSource.
Definition at line 114 of file RequestContext.php.
Implements IContextSource.
Definition at line 261 of file RequestContext.php.
Get the Language object.
Implements IContextSource.
Definition at line 272 of file RequestContext.php.
References $wgContLang, array(), Language\factory(), getRequest(), getUser(), global, sanitizeLangCode(), and wfRunHooks().
Referenced by UploadFromUrlTestSuite\setUp().
static RequestContext::getMain | ( | ) | [static] |
Static methods.
Get the RequestContext object associated with the main request
Definition at line 366 of file RequestContext.php.
Referenced by LogFormatter\__construct(), StubUserLang\_newObject(), Linker\buildRollbackLink(), FeedUtils\formatDiffRow(), Linker\generateRollback(), and WikitextContent\isCountable().
Get the OutputPage object.
Implements IContextSource.
Definition at line 178 of file RequestContext.php.
Get the WebRequest object.
Implements IContextSource.
Definition at line 74 of file RequestContext.php.
Referenced by getLanguage().
Get the Skin object.
Implements IContextSource.
Definition at line 308 of file RequestContext.php.
Get the Title object.
Implements IContextSource.
Definition at line 98 of file RequestContext.php.
Referenced by setWikiPage().
Get the User object.
Implements IContextSource.
Definition at line 199 of file RequestContext.php.
Referenced by getLanguage().
Get the WikiPage object.
May throw an exception if there's no Title object set or the Title object belongs to a special namespace that doesn't have WikiPage, so use first canUseWikiPage() to check whether this method can be called safely.
MWException |
Implements IContextSource.
Definition at line 155 of file RequestContext.php.
Helpful methods.
Get a Message object with context set Parameters are the same as wfMessage()
Implements IContextSource.
Definition at line 354 of file RequestContext.php.
static RequestContext::newExtraneousContext | ( | Title $ | title, |
$ | request = array() |
||
) | [static] |
Create a new extraneous context.
The context is filled with information external to the current session.
$title | Title Title to use for the extraneous request |
$request | Mixed A WebRequest or data to use for a FauxRequest |
Definition at line 388 of file RequestContext.php.
Referenced by RecentChangeTest\__construct(), Title\moveToInternal(), and ManualLogEntry\publish().
static RequestContext::sanitizeLangCode | ( | $ | code | ) | [static] |
Accepts a language code and ensures it's sane.
Outputs a cleaned up language code and replaces with $wgLanguageCode if not sane.
$code | string |
Definition at line 212 of file RequestContext.php.
References empty, global, Language\isValidCode(), and wfDebug().
Referenced by getLanguage().
RequestContext::setLang | ( | $ | l | ) |
Set the Language object.
$l | Mixed Language instance or language code |
Definition at line 233 of file RequestContext.php.
References setLanguage(), and wfDeprecated().
RequestContext::setLanguage | ( | $ | l | ) |
Set the Language object.
$l | Mixed Language instance or language code |
MWException |
Definition at line 245 of file RequestContext.php.
Referenced by setLang().
$o | OutputPage |
Definition at line 169 of file RequestContext.php.
Set the WebRequest object.
$r | WebRequest object |
Definition at line 65 of file RequestContext.php.
References request.
RequestContext::setSkin | ( | Skin $ | s | ) |
RequestContext::setTitle | ( | Title $ | t | ) |
Set the Title object.
$t | Title object |
Definition at line 87 of file RequestContext.php.
Referenced by PreferencesTest\__construct(), RebuildFileCache\execute(), and setWikiPage().
RequestContext::setUser | ( | User $ | u | ) |
Set the User object.
$u | User |
Definition at line 190 of file RequestContext.php.
Referenced by SpecialSearchTest\testProfileAndNamespaceLoading().
Set the WikiPage object.
$p | WikiPage object |
Definition at line 135 of file RequestContext.php.
References getTitle(), WikiPage\getTitle(), and setTitle().
Language RequestContext::$lang [private] |
Definition at line 54 of file RequestContext.php.
OutputPage RequestContext::$output [private] |
Definition at line 46 of file RequestContext.php.
WebRequest RequestContext::$request [private] |
Definition at line 34 of file RequestContext.php.
Definition at line 58 of file RequestContext.php.
Definition at line 38 of file RequestContext.php.
Definition at line 50 of file RequestContext.php.
WikiPage RequestContext::$wikipage [private] |
Definition at line 42 of file RequestContext.php.