MediaWiki  1.23.2
ContextSource.php
Go to the documentation of this file.
1 <?php
30 abstract class ContextSource implements IContextSource {
34  private $context;
35 
41  public function getContext() {
42  if ( $this->context === null ) {
43  $class = get_class( $this );
44  wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
45  "Using RequestContext::getMain() for sanity\n" );
46  $this->context = RequestContext::getMain();
47  }
48 
49  return $this->context;
50  }
51 
58  public function setContext( IContextSource $context ) {
59  $this->context = $context;
60  }
61 
68  public function getConfig() {
69  return $this->getContext()->getConfig();
70  }
71 
78  public function getRequest() {
79  return $this->getContext()->getRequest();
80  }
81 
88  public function getTitle() {
89  return $this->getContext()->getTitle();
90  }
91 
100  public function canUseWikiPage() {
101  return $this->getContext()->canUseWikiPage();
102  }
103 
113  public function getWikiPage() {
114  return $this->getContext()->getWikiPage();
115  }
116 
123  public function getOutput() {
124  return $this->getContext()->getOutput();
125  }
126 
133  public function getUser() {
134  return $this->getContext()->getUser();
135  }
136 
143  public function getLang() {
144  wfDeprecated( __METHOD__, '1.19' );
145 
146  return $this->getLanguage();
147  }
148 
155  public function getLanguage() {
156  return $this->getContext()->getLanguage();
157  }
158 
165  public function getSkin() {
166  return $this->getContext()->getSkin();
167  }
168 
176  public function msg( /* $args */ ) {
177  $args = func_get_args();
178 
179  return call_user_func_array( array( $this->getContext(), 'msg' ), $args );
180  }
181 
189  public function exportSession() {
190  return $this->getContext()->exportSession();
191  }
192 }
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
ContextSource\getConfig
getConfig()
Get the Config object.
Definition: ContextSource.php:67
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:175
ContextSource\getLang
getLang()
Get the Language object.
Definition: ContextSource.php:142
ContextSource\canUseWikiPage
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
Definition: ContextSource.php:99
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
ContextSource\getTitle
getTitle()
Get the Title object.
Definition: ContextSource.php:87
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:154
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1127
ContextSource\getOutput
getOutput()
Get the OutputPage object.
Definition: ContextSource.php:122
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
ContextSource\getWikiPage
getWikiPage()
Get the WikiPage object.
Definition: ContextSource.php:112
ContextSource\getSkin
getSkin()
Get the Skin object.
Definition: ContextSource.php:164
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ContextSource\setContext
setContext(IContextSource $context)
Set the IContextSource object.
Definition: ContextSource.php:57
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:933
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:420
IContextSource
Interface for objects which can provide a context on request.
Definition: IContextSource.php:29
$args
if( $line===false) $args
Definition: cdb.php:62
ContextSource\exportSession
exportSession()
Export the resolved user IP, HTTP headers, user ID, and session ID.
Definition: ContextSource.php:188