Index: trunk/phase3/includes/SpecialVersion.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -/** |
| 3 | +/**#@+ |
4 | 4 | * Give information about the version of MediaWiki, PHP, the DB and extensions |
5 | 5 | * |
6 | 6 | * @package MediaWiki |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | class SpecialVersion { |
23 | 23 | /** |
24 | 24 | * @var object |
| 25 | + * @access private |
25 | 26 | */ |
26 | 27 | var $langObj; |
27 | 28 | |
— | — | @@ -32,14 +33,28 @@ |
33 | 34 | $this->langObj = setupLangObj( 'LanguageEn' ); |
34 | 35 | $this->langObj->initEncoding(); |
35 | 36 | } |
36 | | - |
| 37 | + |
| 38 | + /** |
| 39 | + * main() |
| 40 | + */ |
37 | 41 | function execute() { |
38 | 42 | global $wgOut; |
39 | 43 | |
40 | | - $wgOut->addWikiText( $this->MediaWikiCredits() . $this->extensionCredits() . $this->wgHooks() ); |
| 44 | + $wgOut->addWikiText( |
| 45 | + $this->MediaWikiCredits() . |
| 46 | + $this->extensionCredits() . |
| 47 | + $this->wgHooks() |
| 48 | + ); |
41 | 49 | $wgOut->addHTML( $this->IPInfo() ); |
42 | 50 | } |
43 | 51 | |
| 52 | + /**#@+ |
| 53 | + * @access private |
| 54 | + */ |
| 55 | + |
| 56 | + /** |
| 57 | + * @static |
| 58 | + */ |
44 | 59 | function MediaWikiCredits() { |
45 | 60 | global $wgVersion; |
46 | 61 | |
— | — | @@ -87,12 +102,15 @@ |
88 | 103 | 'variable' => 'Variables', |
89 | 104 | 'other' => 'Other', |
90 | 105 | ); |
91 | | - wfRunHooks( 'SpecialVersionExtensionTypes', array( &$extensionTypes ) ); |
| 106 | + wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) ); |
92 | 107 | |
93 | 108 | $out = "\n* Extensions:\n"; |
94 | 109 | foreach ( $extensionTypes as $type => $text ) { |
95 | 110 | if ( count( @$wgExtensionCredits[$type] ) ) { |
96 | 111 | $out .= "** $text:\n"; |
| 112 | + |
| 113 | + usort( $wgExtensionCredits[$type], array( $this, 'compare' ) ); |
| 114 | + |
97 | 115 | foreach ( $wgExtensionCredits[$type] as $extension ) { |
98 | 116 | wfSuppressWarnings(); |
99 | 117 | $out .= $this->formatCredits( |
— | — | @@ -120,6 +138,13 @@ |
121 | 139 | return $out; |
122 | 140 | } |
123 | 141 | |
| 142 | + function compare( $a, $b ) { |
| 143 | + if ( $a['name'] === $b['name'] ) |
| 144 | + return 0; |
| 145 | + else |
| 146 | + return $this->langObj->lc( $a['name'] ) > $this->langObj->lc( $b['name'] ) ? 1 : -1; |
| 147 | + } |
| 148 | + |
124 | 149 | function formatCredits( $name, $version = null, $author = null, $url = null, $description = null) { |
125 | 150 | $ret = '*** '; |
126 | 151 | if ( isset( $url ) ) |
— | — | @@ -143,16 +168,26 @@ |
144 | 169 | function wgHooks() { |
145 | 170 | global $wgHooks; |
146 | 171 | |
| 172 | + $myWgHooks = $wgHooks; |
| 173 | + ksort( $myWgHooks ); |
| 174 | + |
147 | 175 | $ret = "* Hooks:\n"; |
148 | | - foreach ($wgHooks as $hook => $hooks) |
149 | | - $ret .= "** $hook: " . $this->langObj->listToText( $hooks ) . "\n"; |
150 | | - |
| 176 | + foreach ($myWgHooks as $hook => $hooks) |
| 177 | + $ret .= "** $hook:" . $this->langObj->listToText( $hooks ) . "\n"; |
| 178 | + |
151 | 179 | return $ret; |
152 | 180 | } |
153 | 181 | |
| 182 | + /** |
| 183 | + * @static |
| 184 | + */ |
154 | 185 | function IPInfo() { |
155 | | - $ip = str_replace( '--', ' - - ', htmlspecialchars( wfGetIP() ) ); |
| 186 | + $ip = str_replace( '--', '-', htmlspecialchars( wfGetIP() ) ); |
156 | 187 | return "<!-- visited from $ip -->\n"; |
157 | 188 | } |
| 189 | + |
| 190 | + /**#@-*/ |
158 | 191 | } |
| 192 | + |
| 193 | +/**#@-*/ |
159 | 194 | ?> |