MediaWiki  REL1_19
ResourceLoaderUserTokensModule.php
Go to the documentation of this file.
00001 <?php
00025 class ResourceLoaderUserTokensModule extends ResourceLoaderModule {
00026 
00027         /* Protected Members */
00028 
00029         protected $origin = self::ORIGIN_CORE_INDIVIDUAL;
00030 
00031         /* Methods */
00032 
00039         protected function contextUserTokens( ResourceLoaderContext $context ) {
00040                 global $wgUser;
00041 
00042                 return array(
00043                         'editToken' => $wgUser->getEditToken(),
00044                         'watchToken' => ApiQueryInfo::getWatchToken(null, null),
00045                 );
00046         }
00047 
00052         public function getScript( ResourceLoaderContext $context ) {
00053                 return Xml::encodeJsCall( 'mw.user.tokens.set',
00054                         array( $this->contextUserTokens( $context ) ) );
00055         }
00056 
00060         public function getGroup() {
00061                 return 'private';
00062         }
00063 }