More function level documentation
[lhc/web/wiklou.git] / includes / Skin.php
index 3a671dc..f3e5669 100644 (file)
@@ -23,7 +23,10 @@ abstract class Skin extends Linker {
        /**#@-*/
        protected $mRevisionId; // The revision ID we're looking at, null if not applicable.
        protected $skinname = 'standard';
-       // @todo Fixme: should be protected :-\
+       /**
+        * todo Fixme: should be protected :-\
+        * @var Title
+        */
        var $mTitle = null;
        protected $mRelevantTitle = null;
        protected $mRelevantUser = null;
@@ -470,49 +473,6 @@ abstract class Skin extends Linker {
                } 
        }
 
-       /**
-        * Make a <script> tag containing global variables
-        * @param $skinName string Name of the skin
-        * The odd calling convention is for backwards compatibility
-        * @todo FIXME: Make this not depend on $wgTitle!
-        * 
-        * Do not add things here which can be evaluated in ResourceLoaderStartupScript - in other words, without state.
-        * You will only be adding bloat to the page and causing page caches to have to be purged on configuration changes.
-        */
-       static function makeGlobalVariablesScript( $skinName ) {
-               global $wgTitle, $wgUser, $wgRequest, $wgOut, $wgUseAjax, $wgEnableMWSuggest;
-               
-               $ns = $wgTitle->getNamespace();
-               $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $wgTitle->getNsText();
-               $vars = array(
-                       'wgCanonicalNamespace' => $nsname,
-                       'wgCanonicalSpecialPageName' => $ns == NS_SPECIAL ?
-                               SpecialPage::resolveAlias( $wgTitle->getDBkey() ) : false, # bug 21115
-                       'wgNamespaceNumber' => $wgTitle->getNamespace(),
-                       'wgPageName' => $wgTitle->getPrefixedDBKey(),
-                       'wgTitle' => $wgTitle->getText(),
-                       'wgAction' => $wgRequest->getText( 'action', 'view' ),
-                       'wgArticleId' => $wgTitle->getArticleId(),
-                       'wgIsArticle' => $wgOut->isArticle(),
-                       'wgUserName' => $wgUser->isAnon() ? null : $wgUser->getName(),
-                       'wgUserGroups' => $wgUser->getEffectiveGroups(),
-                       'wgCurRevisionId' => $wgTitle->getLatestRevID(),
-                       'wgCategories' => $wgOut->getCategories(),
-                       'wgBreakFrames' => $wgOut->getFrameOptions() == 'DENY',
-               );
-               foreach ( $wgTitle->getRestrictionTypes() as $type ) {
-                       $vars['wgRestriction' . ucfirst( $type )] = $wgTitle->getRestrictions( $type );
-               }
-               if ( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) {
-                       $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $wgUser );
-               }
-               
-               // Allow extensions to add their custom variables to the global JS variables
-               wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) );
-               
-               return self::makeVariablesScript( $vars );
-       }
-
        /**
         * To make it harder for someone to slip a user a fake
         * user-JavaScript or user-CSS preview, a random token
@@ -589,7 +549,7 @@ abstract class Skin extends Linker {
         * @private
         */
        function setupUserCss( OutputPage $out ) {
-               global $wgRequest;
+               global $wgRequest, $wgUser;
                global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs;
 
                wfProfileIn( __METHOD__ );
@@ -603,6 +563,9 @@ abstract class Skin extends Linker {
                // Per-site custom styles
                if ( $wgUseSiteCss ) {
                        $out->addModuleStyles( 'site' );
+                       if( $wgUser->isLoggedIn() ){
+                               $out->addModuleStyles( 'user.groups' );
+                       }
                }
 
                // Per-user custom styles
@@ -1626,7 +1589,7 @@ abstract class Skin extends Linker {
                        $namespaceNotice = '';
                }
 
-               wfProfileOut( $fname );
+               wfProfileOut( __METHOD__ );
                return $namespaceNotice;
        }