MediaWiki  REL1_21
ResourceLoaderUserTokensModule.php
Go to the documentation of this file.
00001 <?php
00027 class ResourceLoaderUserTokensModule extends ResourceLoaderModule {
00028 
00029         /* Protected Members */
00030 
00031         protected $origin = self::ORIGIN_CORE_INDIVIDUAL;
00032 
00033         /* Methods */
00034 
00041         protected function contextUserTokens( ResourceLoaderContext $context ) {
00042                 global $wgUser;
00043 
00044                 return array(
00045                         'editToken' => $wgUser->getEditToken(),
00046                         'patrolToken' => ApiQueryRecentChanges::getPatrolToken( null, null ),
00047                         'watchToken' => ApiQueryInfo::getWatchToken( null, null ),
00048                 );
00049         }
00050 
00055         public function getScript( ResourceLoaderContext $context ) {
00056                 return Xml::encodeJsCall( 'mw.user.tokens.set',
00057                         array( $this->contextUserTokens( $context ) ) );
00058         }
00059 
00063         public function supportsURLLoading() {
00064                 return false;
00065         }
00066 
00070         public function getGroup() {
00071                 return 'private';
00072         }
00073 }