r94413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94412‎ | r94413 | r94414 >
Date:14:53, 13 August 2011
Author:ialex
Status:ok
Tags:
Comment:
Use local context instead of global variables
Modified paths:
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -49,11 +49,12 @@
5050 * main()
5151 */
5252 public function execute( $par ) {
53 - global $wgOut, $wgSpecialVersionShowHooks, $wgRequest;
 53+ global $wgSpecialVersionShowHooks;
5454
5555 $this->setHeaders();
5656 $this->outputHeader();
57 - $wgOut->allowClickjacking();
 57+ $out = $this->getOutput();
 58+ $out->allowClickjacking();
5859
5960 $text =
6061 $this->getMediaWikiCredits() .
@@ -63,10 +64,10 @@
6465 $text .= $this->getWgHooks();
6566 }
6667
67 - $wgOut->addWikiText( $text );
68 - $wgOut->addHTML( $this->IPInfo() );
 68+ $out->addWikiText( $text );
 69+ $out->addHTML( $this->IPInfo() );
6970
70 - if ( $wgRequest->getVal( 'easteregg' ) ) {
 71+ if ( $this->getRequest()->getVal( 'easteregg' ) ) {
7172 if ( $this->showEasterEgg() ) {
7273 // TODO: put something interesting here
7374 }
@@ -357,11 +358,10 @@
358359 * Callback to sort extensions by type.
359360 */
360361 function compare( $a, $b ) {
361 - global $wgLang;
362362 if( $a['name'] === $b['name'] ) {
363363 return 0;
364364 } else {
365 - return $wgLang->lc( $a['name'] ) > $wgLang->lc( $b['name'] )
 365+ return $this->getLang()->lc( $a['name'] ) > $this->getLang()->lc( $b['name'] )
366366 ? 1
367367 : -1;
368368 }
@@ -542,11 +542,10 @@
543543 } elseif ( $cnt == 0 ) {
544544 return '';
545545 } else {
546 - global $wgLang;
547546 if ( $sort ) {
548547 sort( $list );
549548 }
550 - return $wgLang->listToText( array_map( array( __CLASS__, 'arrayToString' ), $list ) );
 549+ return $this->getLang()->listToText( array_map( array( __CLASS__, 'arrayToString' ), $list ) );
551550 }
552551 }
553552

Status & tagging log