Merge "Enable $wgVectorUseIconWatch by default."
[lhc/web/wiklou.git] / includes / OutputPage.php
index f719421..905b005 100644 (file)
@@ -123,7 +123,7 @@ class OutputPage extends ContextSource {
        var $mScripts = '';
 
        /**
-        * Inline CSS styles. Use addInlineStyle() sparsingly
+        * Inline CSS styles. Use addInlineStyle() sparingly
         */
        var $mInlineStyles = '';
 
@@ -270,8 +270,8 @@ class OutputPage extends ContextSource {
        /**
         * Redirect to $url rather than displaying the normal page
         *
-        * @param $url String: URL
-        * @param $responsecode String: HTTP status code
+        * @param string $url URL
+        * @param string $responsecode HTTP status code
         */
        public function redirect( $url, $responsecode = '302' ) {
                # Strip newlines as a paranoia check for header injection in PHP<5.1.2
@@ -301,8 +301,8 @@ class OutputPage extends ContextSource {
         * Add a new "<meta>" tag
         * To add an http-equiv meta tag, precede the name with "http:"
         *
-        * @param $name String tag name
-        * @param $val String tag value
+        * @param string $name tag name
+        * @param string $val tag value
         */
        function addMeta( $name, $val ) {
                array_push( $this->mMetatags, array( $name, $val ) );
@@ -311,7 +311,7 @@ class OutputPage extends ContextSource {
        /**
         * Add a keyword or a list of keywords in the page header
         *
-        * @param $text String or array of strings
+        * @param string $text or array of strings
         */
        function addKeyword( $text ) {
                if( is_array( $text ) ) {
@@ -326,7 +326,7 @@ class OutputPage extends ContextSource {
         *
         * Note: use setCanonicalUrl() for rel=canonical.
         *
-        * @param $linkarr Array: associative array of attributes.
+        * @param array $linkarr associative array of attributes.
         */
        function addLink( $linkarr ) {
                array_push( $this->mLinktags, $linkarr );
@@ -335,7 +335,7 @@ class OutputPage extends ContextSource {
        /**
         * Add a new \<link\> with "rel" attribute set to "meta"
         *
-        * @param $linkarr Array: associative array mapping attribute names to their
+        * @param array $linkarr associative array mapping attribute names to their
         *                 values, both keys and values will be escaped, and the
         *                 "rel" attribute will be automatically added
         */
@@ -371,7 +371,7 @@ class OutputPage extends ContextSource {
        /**
         * Add raw HTML to the list of scripts (including \<script\> tag, etc.)
         *
-        * @param $script String: raw HTML
+        * @param string $script raw HTML
         */
        function addScript( $script ) {
                $this->mScripts .= $script . "\n";
@@ -380,7 +380,7 @@ class OutputPage extends ContextSource {
        /**
         * Register and add a stylesheet from an extension directory.
         *
-        * @param $url String path to sheet.  Provide either a full url (beginning
+        * @param string $url path to sheet.  Provide either a full url (beginning
         *             with 'http', etc) or a relative path from the document root
         *             (beginning with '/').  Otherwise it behaves identically to
         *             addStyle() and draws from the /skins folder.
@@ -401,9 +401,9 @@ class OutputPage extends ContextSource {
        /**
         * Add a JavaScript file out of skins/common, or a given relative path.
         *
-        * @param $file String: filename in skins/common or complete on-server path
+        * @param string $file filename in skins/common or complete on-server path
         *              (/foo/bar.js)
-        * @param $version String: style version of the file. Defaults to $wgStyleVersion
+        * @param string $version style version of the file. Defaults to $wgStyleVersion
         */
        public function addScriptFile( $file, $version = null ) {
                global $wgStylePath, $wgStyleVersion;
@@ -421,7 +421,7 @@ class OutputPage extends ContextSource {
        /**
         * Add a self-contained script tag with the given contents
         *
-        * @param $script String: JavaScript text, no "<script>" tags
+        * @param string $script JavaScript text, no "<script>" tags
         */
        public function addInlineScript( $script ) {
                $this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n";
@@ -440,7 +440,7 @@ class OutputPage extends ContextSource {
         * Filter an array of modules to remove insufficiently trustworthy members, and modules
         * which are no longer registered (eg a page is cached before an extension is disabled)
         * @param $modules Array
-        * @param $position String if not null, only return modules with this position
+        * @param string $position if not null, only return modules with this position
         * @param $type string
         * @return Array
         */
@@ -462,8 +462,8 @@ class OutputPage extends ContextSource {
        /**
         * Get the list of modules to include on this page
         *
-        * @param $filter Bool whether to filter out insufficiently trustworthy modules
-        * @param $position String if not null, only return modules with this position
+        * @param bool $filter whether to filter out insufficiently trustworthy modules
+        * @param string $position if not null, only return modules with this position
         * @param $param string
         * @return Array of module names
         */
@@ -521,9 +521,11 @@ class OutputPage extends ContextSource {
        }
 
        /**
-        * Add only CSS of one or more modules recognized by the resource loader. Module
-        * styles added through this function will be loaded by the resource loader when
-        * the page loads.
+        * Add only CSS of one or more modules recognized by the resource loader.
+        *
+        * Module styles added through this function will be added using standard link CSS
+        * tags, rather than as a combined Javascript and CSS package. Thus, they will
+        * load when JavaScript is disabled (unless CSS also happens to be disabled).
         *
         * @param $modules Mixed: module name (string) or array of module names
         */
@@ -579,8 +581,8 @@ class OutputPage extends ContextSource {
        /**
         * Add or replace an header item to the output
         *
-        * @param $name String: item name
-        * @param $value String: raw HTML
+        * @param string $name item name
+        * @param string $value raw HTML
         */
        public function addHeadItem( $name, $value ) {
                $this->mHeadItems[$name] = $value;
@@ -589,7 +591,7 @@ class OutputPage extends ContextSource {
        /**
         * Check if the header item $name is already set
         *
-        * @param $name String: item name
+        * @param string $name item name
         * @return Boolean
         */
        public function hasHeadItem( $name ) {
@@ -599,7 +601,7 @@ class OutputPage extends ContextSource {
        /**
         * Set the value of the ETag HTTP header, only used if $wgUseETag is true
         *
-        * @param $tag String: value of "ETag" header
+        * @param string $tag value of "ETag" header
         */
        function setETag( $tag ) {
                $this->mETag = $tag;
@@ -746,7 +748,7 @@ class OutputPage extends ContextSource {
        /**
         * Override the last modified timestamp
         *
-        * @param $timestamp String: new timestamp, in a format readable by
+        * @param string $timestamp new timestamp, in a format readable by
         *        wfTimestamp()
         */
        public function setLastModified( $timestamp ) {
@@ -756,7 +758,7 @@ class OutputPage extends ContextSource {
        /**
         * Set the robot policy for the page: <http://www.robotstxt.org/meta.html>
         *
-        * @param $policy String: the literal string to output as the contents of
+        * @param string $policy the literal string to output as the contents of
         *   the meta tag.  Will be parsed according to the spec and output in
         *   standardized form.
         * @return null
@@ -776,7 +778,7 @@ class OutputPage extends ContextSource {
         * Set the index policy for the page, but leave the follow policy un-
         * touched.
         *
-        * @param $policy string Either 'index' or 'noindex'.
+        * @param string $policy Either 'index' or 'noindex'.
         * @return null
         */
        public function setIndexPolicy( $policy ) {
@@ -790,7 +792,7 @@ class OutputPage extends ContextSource {
         * Set the follow policy for the page, but leave the index policy un-
         * touched.
         *
-        * @param $policy String: either 'follow' or 'nofollow'.
+        * @param string $policy either 'follow' or 'nofollow'.
         * @return null
         */
        public function setFollowPolicy( $policy ) {
@@ -804,7 +806,7 @@ class OutputPage extends ContextSource {
         * Set the new value of the "action text", this will be added to the
         * "HTML title", separated from it with " - ".
         *
-        * @param $text String: new value of the "action text"
+        * @param string $text new value of the "action text"
         */
        public function setPageTitleActionText( $text ) {
                $this->mPageTitleActionText = $text;
@@ -895,9 +897,9 @@ class OutputPage extends ContextSource {
        }
 
        /**
-        * Replace the subtile with $str
+        * Replace the subtitle with $str
         *
-        * @param $str String|Message: new value of the subtitle. String should be safe HTML.
+        * @param string|Message $str new value of the subtitle. String should be safe HTML.
         */
        public function setSubtitle( $str ) {
                $this->clearSubtitle();
@@ -908,7 +910,7 @@ class OutputPage extends ContextSource {
         * Add $str to the subtitle
         *
         * @deprecated in 1.19; use addSubtitle() instead
-        * @param $str String|Message to add to the subtitle
+        * @param string|Message $str to add to the subtitle
         */
        public function appendSubtitle( $str ) {
                $this->addSubtitle( $str );
@@ -917,7 +919,7 @@ class OutputPage extends ContextSource {
        /**
         * Add $str to the subtitle
         *
-        * @param $str String|Message to add to the subtitle. String should be safe HTML.
+        * @param string|Message $str to add to the subtitle. String should be safe HTML.
         */
        public function addSubtitle( $str ) {
                if ( $str instanceof Message ) {
@@ -1029,7 +1031,7 @@ class OutputPage extends ContextSource {
         * for the new version
         * @see addFeedLink()
         *
-        * @param $val String: query to append to feed links or false to output
+        * @param string $val query to append to feed links or false to output
         *        default links
         */
        public function setFeedAppendQuery( $val ) {
@@ -1049,8 +1051,8 @@ class OutputPage extends ContextSource {
        /**
         * Add a feed link to the page header
         *
-        * @param $format String: feed type, should be a key of $wgFeedClasses
-        * @param $href String: URL
+        * @param string $format feed type, should be a key of $wgFeedClasses
+        * @param string $href URL
         */
        public function addFeedLink( $format, $href ) {
                global $wgAdvertisedFeedTypes;
@@ -1134,7 +1136,7 @@ class OutputPage extends ContextSource {
        /**
         * Add new language links
         *
-        * @param $newLinkArray array Associative array mapping language code to the page
+        * @param array $newLinkArray Associative array mapping language code to the page
         *                      name
         */
        public function addLanguageLinks( $newLinkArray ) {
@@ -1144,7 +1146,7 @@ class OutputPage extends ContextSource {
        /**
         * Reset the language links and add new language links
         *
-        * @param $newLinkArray array Associative array mapping language code to the page
+        * @param array $newLinkArray Associative array mapping language code to the page
         *                      name
         */
        public function setLanguageLinks( $newLinkArray ) {
@@ -1163,7 +1165,7 @@ class OutputPage extends ContextSource {
        /**
         * Add an array of categories, with names in the keys
         *
-        * @param $categories Array mapping category name => sort key
+        * @param array $categories mapping category name => sort key
         */
        public function addCategoryLinks( $categories ) {
                global $wgContLang;
@@ -1224,7 +1226,7 @@ class OutputPage extends ContextSource {
        /**
         * Reset the category links (but not the category list) and add $categories
         *
-        * @param $categories Array mapping category name => sort key
+        * @param array $categories mapping category name => sort key
         */
        public function setCategoryLinks( $categories ) {
                $this->mCategoryLinks = array();
@@ -1278,7 +1280,7 @@ class OutputPage extends ContextSource {
        /**
         * Show what level of JavaScript / CSS untrustworthiness is allowed on this page
         * @see ResourceLoaderModule::$origin
-        * @param $type String ResourceLoaderModule TYPE_ constant
+        * @param string $type ResourceLoaderModule TYPE_ constant
         * @return Int ResourceLoaderModule ORIGIN_ class constant
         */
        public function getAllowedModules( $type ) {
@@ -1301,7 +1303,7 @@ class OutputPage extends ContextSource {
        }
 
        /**
-        * As for setAllowedModules(), but don't inadvertantly make the page more accessible
+        * As for setAllowedModules(), but don't inadvertently make the page more accessible
         * @param  $type String
         * @param  $level Int ResourceLoaderModule class constant
         */
@@ -1312,7 +1314,7 @@ class OutputPage extends ContextSource {
        /**
         * Prepend $text to the body HTML
         *
-        * @param $text String: HTML
+        * @param string $text HTML
         */
        public function prependHTML( $text ) {
                $this->mBodytext = $text . $this->mBodytext;
@@ -1321,7 +1323,7 @@ class OutputPage extends ContextSource {
        /**
         * Append $text to the body HTML
         *
-        * @param $text String: HTML
+        * @param string $text HTML
         */
        public function addHTML( $text ) {
                $this->mBodytext .= $text;
@@ -1399,7 +1401,7 @@ class OutputPage extends ContextSource {
         * @param $timestamp Mixed: string, or null
         * @return Mixed: previous value
         */
-       public function setRevisionTimestamp( $timestamp) {
+       public function setRevisionTimestamp( $timestamp ) {
                return wfSetVar( $this->mRevisionTimestamp, $timestamp );
        }
 
@@ -1465,7 +1467,7 @@ class OutputPage extends ContextSource {
         * @param $interface Boolean: is this text in the user interface language?
         */
        public function addWikiText( $text, $linestart = true, $interface = true ) {
-               $title = $this->getTitle(); // Work arround E_STRICT
+               $title = $this->getTitle(); // Work around E_STRICT
                if ( !$title ) {
                        throw new MWException( 'Title is null' );
                }
@@ -1475,7 +1477,7 @@ class OutputPage extends ContextSource {
        /**
         * Add wikitext with a custom Title object
         *
-        * @param $text String: wikitext
+        * @param string $text wikitext
         * @param $title Title object
         * @param $linestart Boolean: is this the start of a line?
         */
@@ -1486,7 +1488,7 @@ class OutputPage extends ContextSource {
        /**
         * Add wikitext with a custom Title object and tidy enabled.
         *
-        * @param $text String: wikitext
+        * @param string $text wikitext
         * @param $title Title object
         * @param $linestart Boolean: is this the start of a line?
         */
@@ -1497,7 +1499,7 @@ class OutputPage extends ContextSource {
        /**
         * Add wikitext with tidy enabled
         *
-        * @param $text String: wikitext
+        * @param string $text wikitext
         * @param $linestart Boolean: is this the start of a line?
         */
        public function addWikiTextTidy( $text, $linestart = true ) {
@@ -1508,7 +1510,7 @@ class OutputPage extends ContextSource {
        /**
         * Add wikitext with a custom Title object
         *
-        * @param $text String: wikitext
+        * @param string $text wikitext
         * @param $title Title object
         * @param $linestart Boolean: is this the start of a line?
         * @param $tidy Boolean: whether to use tidy
@@ -1595,7 +1597,6 @@ class OutputPage extends ContextSource {
                $this->addHTML( $text );
        }
 
-
        /**
         * Add the output of a QuickTemplate to the output buffer
         *
@@ -1741,7 +1742,7 @@ class OutputPage extends ContextSource {
        /**
         * Add an HTTP header that will influence on the cache
         *
-        * @param $header String: header name
+        * @param string $header header name
         * @param $option Array|null
         * @todo FIXME: Document the $option parameter; it appears to be for
         *        X-Vary-Options but what format is acceptable?
@@ -1938,7 +1939,7 @@ class OutputPage extends ContextSource {
        }
 
        /**
-        * Get the message associed with the HTTP response code $code
+        * Get the message associated with the HTTP response code $code
         *
         * @param $code Integer: status code
         * @return String or null: message or null if $code is not in the list of
@@ -2047,7 +2048,7 @@ class OutputPage extends ContextSource {
        /**
         * Actually output something with print().
         *
-        * @param $ins String: the string to output
+        * @param string $ins the string to output
         */
        public function out( $ins ) {
                print $ins;
@@ -2066,8 +2067,8 @@ class OutputPage extends ContextSource {
         * indexing, clear the current text and redirect, set the page's title
         * and optionally an custom HTML title (content of the "<title>" tag).
         *
-        * @param $pageTitle String|Message will be passed directly to setPageTitle()
-        * @param $htmlTitle String|Message will be passed directly to setHTMLTitle();
+        * @param string|Message $pageTitle will be passed directly to setPageTitle()
+        * @param string|Message $htmlTitle will be passed directly to setHTMLTitle();
         *                   optional, if not passed the "<title>" attribute will be
         *                   based on $pageTitle
         */
@@ -2093,7 +2094,7 @@ class OutputPage extends ContextSource {
         *
         * @param $title Mixed: message key (string) for page title, or a Message object
         * @param $msg Mixed: message key (string) for page text, or a Message object
-        * @param $params Array: message parameters; ignored if $msg is a Message object
+        * @param array $params message parameters; ignored if $msg is a Message object
         */
        public function showErrorPage( $title, $msg, $params = array() ) {
                if( !$title instanceof Message ) {
@@ -2114,8 +2115,8 @@ class OutputPage extends ContextSource {
        /**
         * Output a standard permission error page
         *
-        * @param $errors Array: error message keys
-        * @param $action String: action that was denied or null if unknown
+        * @param array $errors error message keys
+        * @param string $action action that was denied or null if unknown
         */
        public function showPermissionsErrorPage( $errors, $action = null ) {
                // For some action (read, edit, create and upload), display a "login to do this action"
@@ -2199,7 +2200,7 @@ class OutputPage extends ContextSource {
        /**
         * Display an error page noting that a given permission bit is required.
         * @deprecated since 1.18, just throw the exception directly
-        * @param $permission String: key required
+        * @param string $permission key required
         * @throws PermissionsError
         */
        public function permissionRequired( $permission ) {
@@ -2218,8 +2219,8 @@ class OutputPage extends ContextSource {
        /**
         * Format a list of error messages
         *
-        * @param $errors Array of arrays returned by Title::getUserPermissionsErrors
-        * @param $action String: action that was denied or null if unknown
+        * @param array $errors of arrays returned by Title::getUserPermissionsErrors
+        * @param string $action action that was denied or null if unknown
         * @return String: the wikitext error-messages, formatted into a list.
         */
        public function formatPermissionsErrorMessage( $errors, $action = null ) {
@@ -2330,7 +2331,7 @@ $templates
        }
 
        /**
-        * Turn off regular page output and return an error reponse
+        * Turn off regular page output and return an error response
         * for when rate limiting has triggered.
         */
        public function rateLimited() {
@@ -2387,8 +2388,8 @@ $templates
         * Add a "return to" link pointing to a specified title
         *
         * @param $title Title to link
-        * @param $query Array query string parameters
-        * @param $text String text of the link (input is not escaped)
+        * @param array $query query string parameters
+        * @param string $text text of the link (input is not escaped)
         * @param $options Options array to pass to Linker
         */
        public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
@@ -2412,7 +2413,7 @@ $templates
         *
         * @param $unused
         * @param $returnto Title or String to return to
-        * @param $returntoquery String: query string for the return to link
+        * @param string $returntoquery query string for the return to link
         */
        public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
                if ( $returnto == null ) {
@@ -2569,9 +2570,9 @@ $templates
        /**
         * TODO: Document
         * @param $modules Array/string with the module name(s)
-        * @param $only String ResourceLoaderModule TYPE_ class constant
+        * @param string $only ResourceLoaderModule TYPE_ class constant
         * @param $useESI boolean
-        * @param $extraQuery Array with extra query parameters to add to each request. array( param => value )
+        * @param array $extraQuery with extra query parameters to add to each request. array( param => value )
         * @param $loadCall boolean If true, output an (asynchronous) mw.loader.load() call rather than a "<script src='...'>" tag
         * @return string html "<script>" and "<style>" tags
         */
@@ -2694,7 +2695,7 @@ $templates
                        }
                        // Special handling for the user group; because users might change their stuff
                        // on-wiki like user pages, or user preferences; we need to find the highest
-                       // timestamp of these user-changable modules so we can ensure cache misses on change
+                       // timestamp of these user-changeable modules so we can ensure cache misses on change
                        // This should NOT be done for the site group (bug 27564) because anons get that too
                        // and we shouldn't be putting timestamps in Squid-cached HTML
                        $version = null;
@@ -2950,7 +2951,6 @@ $templates
                $this->mJsConfigVars[$keys] = $value;
        }
 
-
        /**
         * Get an array containing the variables to be set in mw.config in JavaScript.
         *
@@ -3002,18 +3002,20 @@ $templates
                        implode( "\t", $digitTransTable ),
                );
 
+               $user = $this->getUser();
+
                $vars = array(
                        'wgCanonicalNamespace' => $nsname,
                        'wgCanonicalSpecialPageName' => $canonicalName,
                        'wgNamespaceNumber' => $title->getNamespace(),
-                       'wgPageName' => $title->getPrefixedDBKey(),
+                       'wgPageName' => $title->getPrefixedDBkey(),
                        'wgTitle' => $title->getText(),
                        'wgCurRevisionId' => $latestRevID,
                        'wgArticleId' => $pageID,
                        'wgIsArticle' => $this->isArticle(),
                        'wgAction' => Action::getActionName( $this->getContext() ),
-                       'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(),
-                       'wgUserGroups' => $this->getUser()->getEffectiveGroups(),
+                       'wgUserName' => $user->isAnon() ? null : $user->getName(),
+                       'wgUserGroups' => $user->getEffectiveGroups(),
                        'wgCategories' => $this->getCategories(),
                        'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
                        'wgPageContentLanguage' => $lang->getCode(),
@@ -3022,8 +3024,14 @@ $templates
                        'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
                        'wgMonthNames' => $lang->getMonthNamesArray(),
                        'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
-                       'wgRelevantPageName' => $relevantTitle->getPrefixedDBKey(),
+                       'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
                );
+               if ( $user->isLoggedIn() ) {
+                       $vars['wgUserId'] = $user->getId();
+                       $vars['wgUserEditCount'] = $user->getEditCount();
+                       $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
+                       $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
+               }
                if ( $wgContLang->hasVariants() ) {
                        $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
                }
@@ -3034,7 +3042,7 @@ $templates
                        $vars['wgIsMainPage'] = true;
                }
                if ( $this->mRedirectedFrom ) {
-                       $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBKey();
+                       $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
                }
 
                // Allow extensions to add their custom variables to the mw.config map.
@@ -3072,7 +3080,7 @@ $templates
        }
 
        /**
-        * @param $addContentType bool: Whether "<meta>" specifying content type should be returned
+        * @param bool $addContentType Whether "<meta>" specifying content type should be returned
         *
         * @return array in format "link name or number => 'link html'".
         */
@@ -3213,7 +3221,6 @@ $templates
                        ) );
                }
 
-
                # Language variants
                if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
                        $lang = $this->getTitle()->getPageLanguage();
@@ -3323,7 +3330,7 @@ $templates
 
        /**
         * @param $unused
-        * @param $addContentType bool: Whether "<meta>" specifying content type should be returned
+        * @param bool $addContentType Whether "<meta>" specifying content type should be returned
         *
         * @return string HTML tag links to be put in the header.
         */
@@ -3334,9 +3341,9 @@ $templates
        /**
         * Generate a "<link rel/>" for a feed.
         *
-        * @param $type String: feed type
-        * @param $url String: URL to the feed
-        * @param $text String: value of the "title" attribute
+        * @param string $type feed type
+        * @param string $url URL to the feed
+        * @param string $text value of the "title" attribute
         * @return String: HTML fragment
         */
        private function feedLink( $type, $url, $text ) {
@@ -3352,10 +3359,10 @@ $templates
         * Add a local or specified stylesheet, with the given media options.
         * Meant primarily for internal use...
         *
-        * @param $style String: URL to the file
-        * @param $media String: to specify a media type, 'screen', 'printable', 'handheld' or any.
-        * @param $condition String: for IE conditional comments, specifying an IE version
-        * @param $dir String: set to 'rtl' or 'ltr' for direction-specific sheets
+        * @param string $style URL to the file
+        * @param string $media to specify a media type, 'screen', 'printable', 'handheld' or any.
+        * @param string $condition for IE conditional comments, specifying an IE version
+        * @param string $dir set to 'rtl' or 'ltr' for direction-specific sheets
         */
        public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
                $options = array();
@@ -3376,7 +3383,7 @@ $templates
        /**
         * Adds inline CSS styles
         * @param $style_css Mixed: inline CSS
-        * @param $flip String: Set to 'flip' to flip the CSS if needed
+        * @param string $flip Set to 'flip' to flip the CSS if needed
         */
        public function addInlineStyle( $style_css, $flip = 'noflip' ) {
                if( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
@@ -3393,8 +3400,7 @@ $templates
         * @return string
         */
        public function buildCssLinks() {
-               global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs,
-                       $wgLang, $wgContLang;
+               global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs, $wgContLang;
 
                $this->getSkin()->setupSkinUserCss( $this );
 
@@ -3428,7 +3434,7 @@ $templates
                                // If needed, Janus it first. This is user-supplied CSS, so it's
                                // assumed to be right for the content language directionality.
                                $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
-                               if ( $wgLang->getDir() !== $wgContLang->getDir() ) {
+                               if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
                                        $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
                                }
                                $otherTags .= Html::inlineStyle( $previewedCSS );
@@ -3503,8 +3509,8 @@ $templates
        /**
         * Generate \<link\> tags for stylesheets
         *
-        * @param $style String: URL to the file
-        * @param $options Array: option, can contain 'condition', 'dir', 'media'
+        * @param string $style URL to the file
+        * @param array $options option, can contain 'condition', 'dir', 'media'
         *                 keys
         * @return String: HTML fragment
         */
@@ -3545,7 +3551,7 @@ $templates
        /**
         * Transform "media" attribute based on request parameters
         *
-        * @param $media String: current value of the "media" attribute
+        * @param string $media current value of the "media" attribute
         * @return String: modified value of the "media" attribute, or null to skip
         * this stylesheet
         */
@@ -3570,7 +3576,7 @@ $templates
                                        // Example supported values for $media: 'screen', 'only screen', 'screen and (min-width: 982px)' ),
                                        // Example NOT supported value for $media: '3d-glasses, screen, print and resolution > 90dpi'
                                        //
-                                       // If it's a print request, we never want any kind of screen styesheets
+                                       // If it's a print request, we never want any kind of screen stylesheets
                                        // If it's a handheld request (currently the only other choice with a switch),
                                        // we don't want simple 'screen' but we might want screen queries that
                                        // have a max-width or something, so we'll pass all others on and let the
@@ -3673,7 +3679,7 @@ $templates
         * Include jQuery core. Use this to avoid loading it multiple times
         * before we get a usable script loader.
         *
-        * @param $modules Array: list of jQuery modules which should be loaded
+        * @param array $modules list of jQuery modules which should be loaded
         * @return Array: the list of modules which were not loaded.
         * @since 1.16
         * @deprecated since 1.17