MediaWiki  REL1_19
ResourceLoaderUserGroupsModule.php
Go to the documentation of this file.
00001 <?php
00024 class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule {
00025 
00026         /* Protected Methods */
00027         protected $origin = self::ORIGIN_USER_SITEWIDE;
00028 
00033         protected function getPages( ResourceLoaderContext $context ) {
00034                 if ( $context->getUser() ) {
00035                         $user = User::newFromName( $context->getUser() );
00036                         if ( $user instanceof User ) {
00037                                 $pages = array();
00038                                 foreach( $user->getEffectiveGroups() as $group ) {
00039                                         if ( in_array( $group, array( '*', 'user' ) ) ) {
00040                                                 continue;
00041                                         }
00042                                         $pages["MediaWiki:Group-$group.js"] = array( 'type' => 'script' );
00043                                         $pages["MediaWiki:Group-$group.css"] = array( 'type' => 'style' );
00044                                 }
00045                                 return $pages;
00046                         }
00047                 }
00048                 return array();
00049         }
00050 
00051         /* Methods */
00052 
00056         public function getGroup() {
00057                 return 'user';
00058         }
00059 }