Merge "Enable $wgVectorUseIconWatch by default."
[lhc/web/wiklou.git] / includes / Skin.php
index 3e6b72f..a4cb9f4 100644 (file)
@@ -56,17 +56,19 @@ abstract class Skin extends ContextSource {
 
                        $skinDir = dir( $wgStyleDirectory );
 
-                       # while code from www.php.net
-                       while ( false !== ( $file = $skinDir->read() ) ) {
-                               // Skip non-PHP files, hidden files, and '.dep' includes
-                               $matches = array();
-
-                               if ( preg_match( '/^([^.]*)\.php$/', $file, $matches ) ) {
-                                       $aSkin = $matches[1];
-                                       $wgValidSkinNames[strtolower( $aSkin )] = $aSkin;
+                       if ( $skinDir !== false && $skinDir !== null ) {
+                               # while code from www.php.net
+                               while ( false !== ( $file = $skinDir->read() ) ) {
+                                       // Skip non-PHP files, hidden files, and '.dep' includes
+                                       $matches = array();
+
+                                       if ( preg_match( '/^([^.]*)\.php$/', $file, $matches ) ) {
+                                               $aSkin = $matches[1];
+                                               $wgValidSkinNames[strtolower( $aSkin )] = $aSkin;
+                                       }
                                }
+                               $skinDir->close();
                        }
-                       $skinDir->close();
                        $skinsInitialised = true;
                        wfProfileOut( __METHOD__ . '-init' );
                }
@@ -107,7 +109,7 @@ abstract class Skin extends ContextSource {
         * Normalize a skin preference value to a form that can be loaded.
         * If a skin can't be found, it will fall back to the configured
         * default (or the old 'Classic' skin if that's broken).
-        * @param $key String: 'monobook', 'standard', etc.
+        * @param string $key 'monobook', 'standard', etc.
         * @return string
         */
        static function normalizeKey( $key ) {
@@ -148,7 +150,7 @@ abstract class Skin extends ContextSource {
 
        /**
         * Factory method for loading a skin of a given type
-        * @param $key String: 'monobook', 'standard', etc.
+        * @param string $key 'monobook', 'standard', etc.
         * @return Skin
         */
        static function &newFromKey( $key ) {
@@ -167,7 +169,7 @@ abstract class Skin extends ContextSource {
                                require_once( "{$wgStyleDirectory}/{$skinName}.php" );
                        }
 
-                       # Check if we got if not failback to default skin
+                       # Check if we got if not fallback to default skin
                        if ( !MWInit::classExists( $className ) ) {
                                # DO NOT die if the class isn't found. This breaks maintenance
                                # scripts and can cause a user account to be unrecoverable
@@ -481,8 +483,8 @@ abstract class Skin extends ContextSource {
        }
 
        /**
-        * Render the array as a serie of links.
-        * @param $tree Array: categories tree returned by Title::getParentCategoryTree
+        * Render the array as a series of links.
+        * @param array $tree categories tree returned by Title::getParentCategoryTree
         * @return String separated by >, terminate with "\n"
         */
        function drawCategoryBrowser( $tree ) {
@@ -850,9 +852,9 @@ abstract class Skin extends ContextSource {
        }
 
        /**
-        * Renders a $wgFooterIcons icon acording to the method's arguments
-        * @param $icon Array: The icon to build the html for, see $wgFooterIcons for the format of this array
-        * @param $withImage Bool|String: Whether to use the icon's image or output a text-only footericon
+        * Renders a $wgFooterIcons icon according to the method's arguments
+        * @param array $icon The icon to build the html for, see $wgFooterIcons for the format of this array
+        * @param bool|String $withImage Whether to use the icon's image or output a text-only footericon
         * @return String HTML
         */
        function makeFooterIcon( $icon, $withImage = 'withImage' ) {
@@ -968,7 +970,7 @@ abstract class Skin extends ContextSource {
         * Return a fully resolved style path url to images or styles stored in the common folder.
         * This method returns a url resolved using the configured skin style path
         * and includes the style version inside of the url.
-        * @param $name String: The name or path of a skin resource file
+        * @param string $name The name or path of a skin resource file
         * @return String The fully resolved style path url including styleversion
         */
        function getCommonStylePath( $name ) {
@@ -977,10 +979,10 @@ abstract class Skin extends ContextSource {
        }
 
        /**
-        * Return a fully resolved style path url to images or styles stored in the curent skins's folder.
+        * Return a fully resolved style path url to images or styles stored in the current skins's folder.
         * This method returns a url resolved using the configured skin style path
         * and includes the style version inside of the url.
-        * @param $name String: The name or path of a skin resource file
+        * @param string $name The name or path of a skin resource file
         * @return String The fully resolved style path url including styleversion
         */
        function getSkinStylePath( $name ) {
@@ -1007,8 +1009,8 @@ abstract class Skin extends ContextSource {
         * If $proto is set to null, make a local URL. Otherwise, make a full
         * URL with the protocol specified.
         *
-        * @param $name string Name of the Special page
-        * @param $urlaction string Query to append
+        * @param string $name Name of the Special page
+        * @param string $urlaction Query to append
         * @param $proto Protocol to use or null for a local URL
         * @return String
         */
@@ -1101,7 +1103,7 @@ abstract class Skin extends ContextSource {
 
        /**
         * Make URL details where the article exists (or at least it's convenient to think so)
-        * @param $name String Article name
+        * @param string $name Article name
         * @param $urlaction String
         * @return Array
         */
@@ -1252,7 +1254,7 @@ abstract class Skin extends ContextSource {
                                                }
 
                                                global $wgExternalLinkTarget;
-                                               if ( $wgExternalLinkTarget) {
+                                               if ( $wgExternalLinkTarget ) {
                                                        $extraAttribs['target'] = $wgExternalLinkTarget;
                                                }
                                        } else {
@@ -1381,7 +1383,7 @@ abstract class Skin extends ContextSource {
        /**
         * Get a cached notice
         *
-        * @param $name String: message name, or 'default' for $wgSiteNotice
+        * @param string $name message name, or 'default' for $wgSiteNotice
         * @return String: HTML fragment
         */
        private function getCachedNotice( $name ) {
@@ -1489,9 +1491,9 @@ abstract class Skin extends ContextSource {
         *
         * @param $nt      Title  The title being linked to (may not be the same as
         *   $wgTitle, if the section is included from a template)
-        * @param $section string The designation of the section being pointed to,
+        * @param string $section The designation of the section being pointed to,
         *   to be included in the link, like "&section=$section"
-        * @param $tooltip string The tooltip to use for the link: will be escaped
+        * @param string $tooltip The tooltip to use for the link: will be escaped
         *   and wrapped in the 'editsectionhint' message
         * @param $lang    string Language code
         * @return         string HTML to use for edit link
@@ -1549,14 +1551,15 @@ abstract class Skin extends ContextSource {
         * Use PHP's magic __call handler to intercept legacy calls to the linker
         * for backwards compatibility.
         *
-        * @param $fname String Name of called method
-        * @param $args Array Arguments to the method
+        * @param string $fname Name of called method
+        * @param array $args Arguments to the method
         * @throws MWException
         * @return mixed
         */
        function __call( $fname, $args ) {
                $realFunction = array( 'Linker', $fname );
                if ( is_callable( $realFunction ) ) {
+                       wfDeprecated( get_class( $this ) . '::' . $fname, '1.21' );
                        return call_user_func_array( $realFunction, $args );
                } else {
                        $className = get_class( $this );