MediaWiki  REL1_24
ResourceLoaderUserOptionsModule.php
Go to the documentation of this file.
00001 <?php
00028 class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
00029 
00030     /* Protected Members */
00031 
00032     protected $modifiedTime = array();
00033 
00034     protected $origin = self::ORIGIN_CORE_INDIVIDUAL;
00035 
00036     protected $targets = array( 'desktop', 'mobile' );
00037 
00038     /* Methods */
00039 
00044     public function getModifiedTime( ResourceLoaderContext $context ) {
00045         $hash = $context->getHash();
00046         if ( !isset( $this->modifiedTime[$hash] ) ) {
00047             global $wgUser;
00048             $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
00049         }
00050 
00051         return $this->modifiedTime[$hash];
00052     }
00053 
00058     public function getScript( ResourceLoaderContext $context ) {
00059         global $wgUser;
00060         return Xml::encodeJsCall( 'mw.user.options.set',
00061             array( $wgUser->getOptions() ),
00062             ResourceLoader::inDebugMode()
00063         );
00064     }
00065 
00069     public function supportsURLLoading() {
00070         return false;
00071     }
00072 
00076     public function getGroup() {
00077         return 'private';
00078     }
00079 }