r111192 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111191‎ | r111192 | r111193 >
Date:19:46, 10 February 2012
Author:ialex
Status:ok
Tags:
Comment:
* Use local context instead of global variables
* Same for messages
* Pass the Message object to OutputPage::setPageTitle() and OutputPage::setSubtitle()
* Fixed casing of OutputPage::setPageTitle()
Modified paths:
  • /trunk/phase3/includes/specials/SpecialJavaScriptTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialJavaScriptTest.php
@@ -44,26 +44,24 @@
4545
4646 // No framework specified
4747 if ( $par == '' ) {
48 - $out->setPagetitle( wfMsgHtml( 'javascripttest' ) );
 48+ $out->setPageTitle( $this->msg( 'javascripttest' ) );
4949 $summary = $this->wrapSummaryHtml(
50 - wfMsgHtml( 'javascripttest-pagetext-noframework' ) . $this->getFrameworkListHtml(),
 50+ $this->msg( 'javascripttest-pagetext-noframework' )->escaped() . $this->getFrameworkListHtml(),
5151 'noframework'
5252 );
5353 $out->addHtml( $summary );
5454
5555 // Matched! Display proper title and initialize the framework
5656 } elseif ( isset( self::$frameworks[$framework] ) ) {
57 - $out->setPagetitle( wfMsgHtml( 'javascripttest-title', wfMsgHtml( "javascripttest-$framework-name" ) ) );
58 - $out->setSubtitle(
59 - wfMessage( 'javascripttest-backlink' )->rawParams( Linker::linkKnown( $this->getTitle() ) )->escaped()
60 - );
 57+ $out->setPageTitle( $this->msg( 'javascripttest-title', $this->msg( "javascripttest-$framework-name" )->plain() ) );
 58+ $out->setSubtitle( $this->msg( 'javascripttest-backlink' )->rawParams( Linker::linkKnown( $this->getTitle() ) ) );
6159 $this->{self::$frameworks[$framework]}();
6260
6361 // Framework not found, display error
6462 } else {
65 - $out->setPagetitle( wfMsgHtml( 'javascripttest' ) );
 63+ $out->setPageTitle( $this->msg( 'javascripttest' ) );
6664 $summary = $this->wrapSummaryHtml( '<p class="error">'
67 - . wfMsgHtml( 'javascripttest-pagetext-unknownframework', $par )
 65+ . $this->msg( 'javascripttest-pagetext-unknownframework', $par )->escaped()
6866 . '</p>'
6967 . $this->getFrameworkListHtml(),
7068 'unknownframework'
@@ -82,11 +80,11 @@
8381 $list .= Html::rawElement(
8482 'li',
8583 array(),
86 - Linker::link( $this->getTitle( $framework ), wfMsgHtml( "javascripttest-$framework-name" ) )
 84+ Linker::link( $this->getTitle( $framework ), $this->msg( "javascripttest-$framework-name" )->escaped() )
8785 );
8886 }
8987 $list .= '</ul>';
90 - $msg = wfMessage( 'javascripttest-pagetext-frameworks' )->rawParams( $list )->parseAsBlock();
 88+ $msg = $this->msg( 'javascripttest-pagetext-frameworks' )->rawParams( $list )->parseAsBlock();
9189
9290 return $msg;
9391 }
@@ -114,7 +112,7 @@
115113 * Initialize the page for QUnit.
116114 */
117115 private function initQUnitTesting() {
118 - global $wgJavaScriptTestConfig, $wgLang;
 116+ global $wgJavaScriptTestConfig;
119117
120118 $out = $this->getOutput();
121119
@@ -122,11 +120,11 @@
123121 $qunitTestModules = $out->getResourceLoader()->getTestModuleNames( 'qunit' );
124122 $out->addModules( $qunitTestModules );
125123
126 - $summary = wfMessage( 'javascripttest-qunit-intro' )
 124+ $summary = $this->msg( 'javascripttest-qunit-intro' )
127125 ->params( $wgJavaScriptTestConfig['qunit']['documentation'] )
128126 ->parseAsBlock();
129 - $header = wfMessage( 'javascripttest-qunit-heading' )->escaped();
130 - $userDir = $wgLang->getDir();
 127+ $header = $this->msg( 'javascripttest-qunit-heading' )->escaped();
 128+ $userDir = $this->getLanguage()->getDir();
131129
132130 $baseHtml = <<<HTML
133131 <div class="mw-content-ltr">

Status & tagging log