r94554 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94553‎ | r94554 | r94555 >
Date:19:39, 15 August 2011
Author:reedy
Status:ok
Tags:
Comment:
Use local context rather than global
Modified paths:
  • /trunk/extensions/UserDebugInfo/SpecialUserDebugInfo.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UserDebugInfo/SpecialUserDebugInfo.php
@@ -11,22 +11,23 @@
1212
1313 public function execute( $subpage ) {
1414 $this->setHeaders();
15 - global $wgOut;
16 - $wgOut->addHTML( Xml::openElement( 'table', array( 'class' => 'wikitable' ) ) );
1715
18 - $wgOut->addHTML( '<thead>' );
19 - $wgOut->addHTML( '<tr>' );
20 - $wgOut->addHTML( '<th>' );
21 - $wgOut->addWikiMsg( 'userdebuginfo-key' );
22 - $wgOut->addHTML( '</th>' );
23 - $wgOut->addHTML( '<th>' );
24 - $wgOut->addWikiMsg( 'userdebuginfo-value' );
25 - $wgOut->addHTML( '</th>' );
26 - $wgOut->addHTML( '</tr>' );
27 - $wgOut->addHTML( '</thead>' );
 16+ $out = $this->getOutput();
 17+ $out->addHTML( Xml::openElement( 'table', array( 'class' => 'wikitable' ) ) );
2818
29 - $wgOut->addHTML( '<tbody>' );
 19+ $out->addHTML( '<thead>' );
 20+ $out->addHTML( '<tr>' );
 21+ $out->addHTML( '<th>' );
 22+ $out->addWikiMsg( 'userdebuginfo-key' );
 23+ $out->addHTML( '</th>' );
 24+ $out->addHTML( '<th>' );
 25+ $out->addWikiMsg( 'userdebuginfo-value' );
 26+ $out->addHTML( '</th>' );
 27+ $out->addHTML( '</tr>' );
 28+ $out->addHTML( '</thead>' );
3029
 30+ $out->addHTML( '<tbody>' );
 31+
3132 $this->printRow( 'userdebuginfo-useragent', htmlspecialchars( $_SERVER['HTTP_USER_AGENT'] ) );
3233
3334 if ( isset( $_SERVER['REMOTE_HOST'] ) ) {
@@ -36,8 +37,8 @@
3738 $this->printRow( 'userdebuginfo-remoteaddr', wfGetIP() );
3839 $this->printRow( 'userdebuginfo-language', htmlspecialchars( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) );
3940
40 - $wgOut->addHTML( '</tbody>' );
41 - $wgOut->addHTML( '</table>' );
 41+ $out->addHTML( '</tbody>' );
 42+ $out->addHTML( '</table>' );
4243 }
4344
4445 /**
@@ -45,17 +46,17 @@
4647 * @param $value string Text to output
4748 */
4849 private function printRow( $key, $value ) {
49 - global $wgOut;
50 - $wgOut->addHTML( '<tr>' );
51 - $wgOut->addHTML( '<td>' );
52 - $wgOut->addWikiMsg( $key );
53 - $wgOut->addHTML( '</td>' );
 50+ $out = $this->getOutput();
 51+ $out->addHTML( '<tr>' );
 52+ $out->addHTML( '<td>' );
 53+ $out->addWikiMsg( $key );
 54+ $out->addHTML( '</td>' );
5455
55 - $wgOut->addHTML( '<td>' );
56 - $wgOut->addHTML( $value );
57 - $wgOut->addHTML( '</td>' );
 56+ $out->addHTML( '<td>' );
 57+ $out->addHTML( $value );
 58+ $out->addHTML( '</td>' );
5859
59 - $wgOut->addHTML( '</tr>' );
 60+ $out->addHTML( '</tr>' );
6061 }
6162 }
6263

Status & tagging log