MediaWiki
REL1_19
|
00001 <?php 00026 class ResourceLoaderUserModule extends ResourceLoaderWikiModule { 00027 00028 /* Protected Methods */ 00029 protected $origin = self::ORIGIN_USER_INDIVIDUAL; 00030 00035 protected function getPages( ResourceLoaderContext $context ) { 00036 if ( $context->getUser() ) { 00037 // Get the normalized title of the user's user page 00038 $username = $context->getUser(); 00039 $userpageTitle = Title::makeTitleSafe( NS_USER, $username ); 00040 $userpage = $userpageTitle->getPrefixedDBkey(); // Needed so $excludepages works 00041 00042 $pages = array( 00043 "$userpage/common.js" => array( 'type' => 'script' ), 00044 "$userpage/" . $context->getSkin() . '.js' => 00045 array( 'type' => 'script' ), 00046 "$userpage/common.css" => array( 'type' => 'style' ), 00047 "$userpage/" . $context->getSkin() . '.css' => 00048 array( 'type' => 'style' ), 00049 ); 00050 00051 // Hack for bug 26283: if we're on a preview page for a CSS/JS page, 00052 // we need to exclude that page from this module. In that case, the excludepage 00053 // parameter will be set to the name of the page we need to exclude. 00054 $excludepage = $context->getRequest()->getVal( 'excludepage' ); 00055 if ( isset( $pages[$excludepage] ) ) { 00056 // This works because $excludepage is generated with getPrefixedDBkey(), 00057 // just like the keys in $pages[] above 00058 unset( $pages[$excludepage] ); 00059 } 00060 return $pages; 00061 } 00062 return array(); 00063 } 00064 00065 /* Methods */ 00066 00070 public function getGroup() { 00071 return 'user'; 00072 } 00073 }