* Use local context instead of global variables
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 10 Feb 2012 19:46:04 +0000 (19:46 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 10 Feb 2012 19:46:04 +0000 (19:46 +0000)
* Same for messages
* Pass the Message object to OutputPage::setPageTitle() and OutputPage::setSubtitle()
* Fixed casing of OutputPage::setPageTitle()

includes/specials/SpecialJavaScriptTest.php

index 8722118..7162393 100644 (file)
@@ -44,26 +44,24 @@ class SpecialJavaScriptTest extends SpecialPage {
 
                // No framework specified
                if ( $par == '' ) {
-                       $out->setPagetitle( wfMsgHtml( 'javascripttest' ) );
+                       $out->setPageTitle( $this->msg( 'javascripttest' ) );
                        $summary = $this->wrapSummaryHtml(
-                               wfMsgHtml( 'javascripttest-pagetext-noframework' ) . $this->getFrameworkListHtml(),
+                               $this->msg( 'javascripttest-pagetext-noframework' )->escaped() . $this->getFrameworkListHtml(),
                                'noframework'
                        );
                        $out->addHtml( $summary );
 
                // Matched! Display proper title and initialize the framework
                } elseif ( isset( self::$frameworks[$framework] ) ) {
-                       $out->setPagetitle( wfMsgHtml( 'javascripttest-title', wfMsgHtml( "javascripttest-$framework-name" ) ) );
-                       $out->setSubtitle(
-                               wfMessage( 'javascripttest-backlink' )->rawParams( Linker::linkKnown( $this->getTitle() ) )->escaped()
-                       );
+                       $out->setPageTitle( $this->msg( 'javascripttest-title', $this->msg( "javascripttest-$framework-name" )->plain() ) );
+                       $out->setSubtitle( $this->msg( 'javascripttest-backlink' )->rawParams( Linker::linkKnown( $this->getTitle() ) ) );
                        $this->{self::$frameworks[$framework]}();
 
                // Framework not found, display error
                } else {
-                       $out->setPagetitle( wfMsgHtml( 'javascripttest' ) );
+                       $out->setPageTitle( $this->msg( 'javascripttest' ) );
                        $summary = $this->wrapSummaryHtml( '<p class="error">'
-                               . wfMsgHtml( 'javascripttest-pagetext-unknownframework', $par )
+                               . $this->msg( 'javascripttest-pagetext-unknownframework', $par )->escaped()
                                . '</p>'
                                . $this->getFrameworkListHtml(),
                                'unknownframework'
@@ -82,11 +80,11 @@ class SpecialJavaScriptTest extends SpecialPage {
                        $list .= Html::rawElement(
                                'li',
                                array(),
-                               Linker::link( $this->getTitle( $framework ), wfMsgHtml( "javascripttest-$framework-name" ) )
+                               Linker::link( $this->getTitle( $framework ), $this->msg( "javascripttest-$framework-name" )->escaped() )
                        );
                }
                $list .= '</ul>';
-               $msg = wfMessage( 'javascripttest-pagetext-frameworks' )->rawParams( $list )->parseAsBlock();
+               $msg = $this->msg( 'javascripttest-pagetext-frameworks' )->rawParams( $list )->parseAsBlock();
 
                return $msg;
        }
@@ -114,7 +112,7 @@ class SpecialJavaScriptTest extends SpecialPage {
         * Initialize the page for QUnit.
         */
        private function initQUnitTesting() {
-               global $wgJavaScriptTestConfig, $wgLang;
+               global $wgJavaScriptTestConfig;
 
                $out = $this->getOutput();
 
@@ -122,11 +120,11 @@ class SpecialJavaScriptTest extends SpecialPage {
                $qunitTestModules = $out->getResourceLoader()->getTestModuleNames( 'qunit' );
                $out->addModules( $qunitTestModules );
 
-               $summary = wfMessage( 'javascripttest-qunit-intro' )
+               $summary = $this->msg( 'javascripttest-qunit-intro' )
                        ->params( $wgJavaScriptTestConfig['qunit']['documentation'] )
                        ->parseAsBlock();
-               $header = wfMessage( 'javascripttest-qunit-heading' )->escaped();
-               $userDir = $wgLang->getDir();
+               $header = $this->msg( 'javascripttest-qunit-heading' )->escaped();
+               $userDir = $this->getLanguage()->getDir();
 
                $baseHtml = <<<HTML
 <div class="mw-content-ltr">