(bug 41729) Move section edit links to after the headings
[lhc/web/wiklou.git] / includes / Skin.php
index a34afb6..cc957c4 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' );
                }
@@ -79,7 +81,7 @@ abstract class Skin extends ContextSource {
         */
        static function getSkinNameMessages() {
                $messages = array();
-               foreach( self::getSkinNames() as $skinKey => $skinName ) {
+               foreach ( self::getSkinNames() as $skinKey => $skinName ) {
                        $messages[] = "skinname-$skinKey";
                }
                return $messages;
@@ -129,7 +131,6 @@ abstract class Skin extends ContextSource {
                // in the user preferences.
                $fallback = array(
                        0 => $wgDefaultSkin,
-                       1 => 'nostalgia',
                        2 => 'cologneblue'
                );
 
@@ -290,7 +291,7 @@ abstract class Skin extends ContextSource {
                        return $this->mRelevantUser;
                }
                $title = $this->getRelevantTitle();
-               if( $title->hasSubjectNamespace( NS_USER ) ) {
+               if ( $title->hasSubjectNamespace( NS_USER ) ) {
                        $rootUser = $title->getRootText();
                        if ( User::isIP( $rootUser ) ) {
                                $this->mRelevantUser = User::newFromName( $rootUser, false );
@@ -667,7 +668,7 @@ abstract class Skin extends ContextSource {
 
                                                if ( $c > 1 ) {
                                                        $subpages .= $wgLang->getDirMarkEntity() . $this->msg( 'pipe-separator' )->escaped();
-                                               } else  {
+                                               } else {
                                                        $subpages .= '< ';
                                                }
 
@@ -1014,7 +1015,7 @@ abstract class Skin extends ContextSource {
         */
        static function makeSpecialUrl( $name, $urlaction = '', $proto = null ) {
                $title = SpecialPage::getSafeTitleFor( $name );
-               if( is_null( $proto ) ) {
+               if ( is_null( $proto ) ) {
                        return $title->getLocalURL( $urlaction );
                } else {
                        return $title->getFullURL( $urlaction, false, $proto );
@@ -1391,17 +1392,17 @@ abstract class Skin extends ContextSource {
 
                $needParse = false;
 
-               if( $name === 'default' ) {
+               if ( $name === 'default' ) {
                        // special case
                        global $wgSiteNotice;
                        $notice = $wgSiteNotice;
-                       if( empty( $notice ) ) {
+                       if ( empty( $notice ) ) {
                                wfProfileOut( __METHOD__ );
                                return false;
                        }
                } else {
                        $msg = $this->msg( $name )->inContentLanguage();
-                       if( $msg->isDisabled() ) {
+                       if ( $msg->isDisabled() ) {
                                wfProfileOut( __METHOD__ );
                                return false;
                        }
@@ -1411,8 +1412,8 @@ abstract class Skin extends ContextSource {
                // Use the extra hash appender to let eg SSL variants separately cache.
                $key = wfMemcKey( $name . $wgRenderHashAppend );
                $cachedNotice = $parserMemc->get( $key );
-               if( is_array( $cachedNotice ) ) {
-                       if( md5( $notice ) == $cachedNotice['hash'] ) {
+               if ( is_array( $cachedNotice ) ) {
+                       if ( md5( $notice ) == $cachedNotice['hash'] ) {
                                $notice = $cachedNotice['html'];
                        } else {
                                $needParse = true;
@@ -1532,14 +1533,14 @@ abstract class Skin extends ContextSource {
                        # DoEditSectionLink: it can't change the brackets or the span.)
                        $result = wfMessage( 'editsection-brackets' )->rawParams( $result )
                                ->inLanguage( $lang )->escaped();
-                       return "<span class=\"editsection\">$result</span>";
+                       return "<span class=\"mw-editsection\">$result</span>";
                }
 
                # Add the brackets and the span, and *then* run the nice new hook, with
                # clean and non-redundant arguments.
                $result = wfMessage( 'editsection-brackets' )->rawParams( $link )
                        ->inLanguage( $lang )->escaped();
-               $result = "<span class=\"editsection\">$result</span>";
+               $result = "<span class=\"mw-editsection\">$result</span>";
 
                wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) );
                return $result;
@@ -1557,6 +1558,7 @@ abstract class Skin extends ContextSource {
        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 );