Merge fixes to ?preload= from /branches/conrad/ (cf. bug 5210, r62864, r62035)
[lhc/web/wiklou.git] / includes / specials / SpecialVersion.php
index c9fd892..7da6023 100644 (file)
@@ -20,7 +20,7 @@ class SpecialVersion extends SpecialPage {
        );
 
        function __construct(){
-               parent::__construct( 'Version' );       
+               parent::__construct( 'Version' );
        }
 
        /**
@@ -63,7 +63,7 @@ class SpecialVersion extends SpecialPage {
                $ret .= '<div dir="ltr">';
                $ret .= "__NOTOC__
                This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
-               copyright © 2001-2009 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
+               copyright © 2001-2010 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
                Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
                Niklas Laxström, Domas Mituzas, Rob Church, Yuri Astrakhan, Aryeh Gregor,
                Aaron Schulz, Andrew Garrett, Raimond Spekking, Alexandre Emsenhuber,
@@ -126,7 +126,7 @@ class SpecialVersion extends SpecialPage {
         *
         * @return mixed
         */
-       public static function getVersion( $flags = ''  ) {
+       public static function getVersion( $flags = '' ) {
                global $wgVersion, $IP;
                wfProfileIn( __METHOD__ );
 
@@ -136,7 +136,7 @@ class SpecialVersion extends SpecialPage {
                } elseif( $flags === 'nodb' ) {
                        $version = "$wgVersion (r{$info['checkout-rev']})";
                } else {
-                       $version = $wgVersion . 
+                       $version = $wgVersion . ' ' .
                                wfMsg( 
                                        'version-svn-revision', 
                                        isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
@@ -197,7 +197,7 @@ class SpecialVersion extends SpecialPage {
 
                foreach ( $extensionTypes as $type => $text ) {
                        if ( isset ( $wgExtensionCredits[$type] ) && count ( $wgExtensionCredits[$type] ) ) {
-                               $out .= $this->openExtType( $text );
+                               $out .= $this->openExtType( $text, 'credits-' . $type );
 
                                usort( $wgExtensionCredits[$type], array( $this, 'compare' ) );
 
@@ -208,24 +208,24 @@ class SpecialVersion extends SpecialPage {
                }
 
                if ( count( $wgExtensionFunctions ) ) {
-                       $out .= $this->openExtType( wfMsg( 'version-extension-functions' ) );
+                       $out .= $this->openExtType( wfMsg( 'version-extension-functions' ), 'extension-functions' );
                        $out .= '<tr><td colspan="4">' . $this->listToText( $wgExtensionFunctions ) . "</td></tr>\n";
                }
 
                if ( $cnt = count( $tags = $wgParser->getTags() ) ) {
                        for ( $i = 0; $i < $cnt; ++$i )
                                $tags[$i] = "&lt;{$tags[$i]}&gt;";
-                       $out .= $this->openExtType( wfMsg( 'version-parser-extensiontags' ) );
+                       $out .= $this->openExtType( wfMsg( 'version-parser-extensiontags' ), 'parser-tags' );
                        $out .= '<tr><td colspan="4">' . $this->listToText( $tags ). "</td></tr>\n";
                }
 
                if( $cnt = count( $fhooks = $wgParser->getFunctionHooks() ) ) {
-                       $out .= $this->openExtType( wfMsg( 'version-parser-function-hooks' ) );
+                       $out .= $this->openExtType( wfMsg( 'version-parser-function-hooks' ), 'parser-function-hooks' );
                        $out .= '<tr><td colspan="4">' . $this->listToText( $fhooks ) . "</td></tr>\n";
                }
 
                if ( count( $wgSkinExtensionFunctions ) ) {
-                       $out .= $this->openExtType( wfMsg( 'version-skin-extension-functions' ) );
+                       $out .= $this->openExtType( wfMsg( 'version-skin-extension-functions' ), 'skin-extension-functions' );
                        $out .= '<tr><td colspan="4">' . $this->listToText( $wgSkinExtensionFunctions ) . "</td></tr>\n";
                }
                $out .= Xml::closeElement( 'table' );
@@ -307,7 +307,7 @@ class SpecialVersion extends SpecialPage {
                }
                $author = isset ( $extension['author'] ) ? $extension['author'] : array();
                $extDescAuthor = "<td>$description</td>
-                       <td>" . $this->listToText( (array)$author ) . "</td>
+                       <td>" . $this->listToText( (array)$author, false ) . "</td>
                        </tr>\n";
                return $extNameVer . $extDescAuthor;
        }
@@ -341,19 +341,20 @@ class SpecialVersion extends SpecialPage {
                        return '';
        }
 
-       private function openExtType($text, $name = null) {
+       private function openExtType( $text, $name = null ) {
                $opt = array( 'colspan' => 4 );
                $out = '';
 
-               if(!$this->firstExtOpened) {
+               if( !$this->firstExtOpened ) {
                        // Insert a spacing line
                        $out .= '<tr class="sv-space">' . Xml::element( 'td', $opt ) . "</tr>\n";
                }
                $this->firstExtOpened = false;
 
-               if($name) { $opt['id'] = "sv-$name"; }
+               if( $name )
+                       $opt['id'] = "sv-$name";
 
-               $out .= "<tr>" . Xml::element( 'th', $opt, $text) . "</tr>\n";
+               $out .= "<tr>" . Xml::element( 'th', $opt, $text ) . "</tr>\n";
                return $out;
        }
 
@@ -368,9 +369,10 @@ class SpecialVersion extends SpecialPage {
 
        /**
         * @param array $list
+        * @param bool $sort
         * @return string
         */
-       function listToText( $list ) {
+       function listToText( $list, $sort = true ) {
                $cnt = count( $list );
 
                if ( $cnt == 1 ) {
@@ -380,7 +382,9 @@ class SpecialVersion extends SpecialPage {
                        return '';
                } else {
                        global $wgLang;
-                       sort( $list );
+                       if ( $sort ) {
+                               sort( $list );
+                       }
                        return $wgLang->listToText( array_map( array( __CLASS__, 'arrayToString' ), $list ) );
                }
        }