Index: trunk/phase3/includes/specials/SpecialVersion.php |
— | — | @@ -27,23 +27,26 @@ |
28 | 28 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
29 | 29 | */ |
30 | 30 | class SpecialVersion extends SpecialPage { |
31 | | - private $firstExtOpened = false; |
| 31 | + |
| 32 | + protected $firstExtOpened = false; |
32 | 33 | |
33 | | - static $viewvcUrls = array( |
| 34 | + protected static $extensionTypes = false; |
| 35 | + |
| 36 | + protected static $viewvcUrls = array( |
34 | 37 | 'svn+ssh://svn.wikimedia.org/svnroot/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki', |
35 | 38 | 'http://svn.wikimedia.org/svnroot/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki', |
36 | 39 | # Doesn't work at the time of writing but maybe some day: |
37 | 40 | 'https://svn.wikimedia.org/viewvc/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki', |
38 | 41 | ); |
39 | 42 | |
40 | | - function __construct(){ |
| 43 | + public function __construct(){ |
41 | 44 | parent::__construct( 'Version' ); |
42 | 45 | } |
43 | 46 | |
44 | 47 | /** |
45 | 48 | * main() |
46 | 49 | */ |
47 | | - function execute( $par ) { |
| 50 | + public function execute( $par ) { |
48 | 51 | global $wgOut, $wgSpecialVersionShowHooks, $wgContLang; |
49 | 52 | |
50 | 53 | $this->setHeaders(); |
— | — | @@ -210,20 +213,36 @@ |
211 | 214 | * @return array |
212 | 215 | */ |
213 | 216 | public static function getExtensionTypes() { |
214 | | - $extensionTypes = array( |
215 | | - 'specialpage' => wfMsg( 'version-specialpages' ), |
216 | | - 'parserhook' => wfMsg( 'version-parserhooks' ), |
217 | | - 'variable' => wfMsg( 'version-variables' ), |
218 | | - 'media' => wfMsg( 'version-mediahandlers' ), |
219 | | - 'other' => wfMsg( 'version-other' ), |
220 | | - ); |
| 217 | + if ( self::$extensionTypes === false ) { |
| 218 | + self::$extensionTypes = array( |
| 219 | + 'specialpage' => wfMsg( 'version-specialpages' ), |
| 220 | + 'parserhook' => wfMsg( 'version-parserhooks' ), |
| 221 | + 'variable' => wfMsg( 'version-variables' ), |
| 222 | + 'media' => wfMsg( 'version-mediahandlers' ), |
| 223 | + 'other' => wfMsg( 'version-other' ), |
| 224 | + ); |
| 225 | + |
| 226 | + wfRunHooks( 'ExtensionTypes', array( &self::$extensionTypes ) ); |
| 227 | + } |
221 | 228 | |
222 | | - wfRunHooks( 'ExtensionTypes', array( &$extensionTypes ) ); |
223 | | - |
224 | | - return $extensionTypes; |
| 229 | + return self::$extensionTypes; |
225 | 230 | } |
226 | 231 | |
227 | 232 | /** |
| 233 | + * Returns the internationalized name for an extension type. |
| 234 | + * |
| 235 | + * @since 1.17 |
| 236 | + * |
| 237 | + * @param $type String |
| 238 | + * |
| 239 | + * @return string |
| 240 | + */ |
| 241 | + public static function getExtensionTypeName( $type ) { |
| 242 | + $types = self::getExtensionTypes(); |
| 243 | + return $types[$type]; |
| 244 | + } |
| 245 | + |
| 246 | + /** |
228 | 247 | * Generate wikitext showing extensions name, URL, author and description. |
229 | 248 | * |
230 | 249 | * @return String: Wikitext |