MediaWiki  1.23.2
ResourceLoaderUserTokensModule.php
Go to the documentation of this file.
1 <?php
28 
29  /* Protected Members */
30 
32 
33  protected $targets = array( 'desktop', 'mobile' );
34 
35  /* Methods */
36 
42  protected function contextUserTokens() {
44 
45  return array(
46  'editToken' => $wgUser->getEditToken(),
47  'patrolToken' => ApiQueryRecentChanges::getPatrolToken( null, null ),
48  'watchToken' => ApiQueryInfo::getWatchToken( null, null ),
49  );
50  }
51 
56  public function getScript( ResourceLoaderContext $context ) {
57  return Xml::encodeJsCall( 'mw.user.tokens.set',
58  array( $this->contextUserTokens() ),
60  );
61  }
62 
66  public function supportsURLLoading() {
67  return false;
68  }
69 
73  public function getGroup() {
74  return 'private';
75  }
76 }
ApiQueryRecentChanges\getPatrolToken
static getPatrolToken( $pageid, $title, $rc=null)
Definition: ApiQueryRecentChanges.php:77
ResourceLoaderContext
Object passed around to modules which contains information about the state of a specific loader reque...
Definition: ResourceLoaderContext.php:29
ResourceLoaderUserTokensModule\getScript
getScript(ResourceLoaderContext $context)
Definition: ResourceLoaderUserTokensModule.php:56
$wgUser
$wgUser
Definition: Setup.php:552
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
ResourceLoaderUserTokensModule\getGroup
getGroup()
Definition: ResourceLoaderUserTokensModule.php:73
Xml\encodeJsCall
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:665
ResourceLoaderUserTokensModule
Module for user tokens.
Definition: ResourceLoaderUserTokensModule.php:27
ApiQueryInfo\getWatchToken
static getWatchToken( $pageid, $title)
Definition: ApiQueryInfo.php:224
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ResourceLoaderUserTokensModule\$origin
$origin
Definition: ResourceLoaderUserTokensModule.php:31
ResourceLoaderUserTokensModule\$targets
$targets
Definition: ResourceLoaderUserTokensModule.php:33
ResourceLoaderUserTokensModule\contextUserTokens
contextUserTokens()
Fetch the tokens for the current user.
Definition: ResourceLoaderUserTokensModule.php:42
ResourceLoaderModule\ORIGIN_CORE_INDIVIDUAL
const ORIGIN_CORE_INDIVIDUAL
Definition: ResourceLoaderModule.php:40
ResourceLoaderModule
Abstraction for resource loader modules, with name registration and maxage functionality.
Definition: ResourceLoaderModule.php:28
ResourceLoader\inDebugMode
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
Definition: ResourceLoader.php:1188
ResourceLoaderUserTokensModule\supportsURLLoading
supportsURLLoading()
Definition: ResourceLoaderUserTokensModule.php:66