r96819 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96818‎ | r96819 | r96820 >
Date:23:57, 11 September 2011
Author:jeroendedauw
Status:resolved
Tags:
Comment:
Follow up to r96818;
Modified paths:
  • /trunk/extensions/Survey/specials/SpecialSurvey.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurveyPage.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurveyStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/specials/SpecialSurveyPage.php
@@ -69,6 +69,19 @@
7070 }
7171
7272 /**
 73+ * Shortcut to get user's language.
 74+ * This overrides the getLang method of Specialpage added in MediaWiki 1.18,
 75+ * and returns $wgLang for older versions.
 76+ *
 77+ * @since 0.1
 78+ *
 79+ * @return Language
 80+ */
 81+ public function getLang() {
 82+ return version_compare( $GLOBALS['wgVersion'], '1.18', '>=' ) ? parent::getLang() : $GLOBALS['wgLang'];
 83+ }
 84+
 85+ /**
7386 * Add resource loader modules or use fallback code for
7487 * earlier versions of MediaWiki.
7588 *
@@ -114,7 +127,7 @@
115128 * @param array $links
116129 */
117130 protected function displayNavigation( array $links ) {
118 - $this->getOutput()->addHTML( Html::rawElement( 'p', array(), $GLOBALS['wgLang']->pipeList( $links ) ) );
 131+ $this->getOutput()->addHTML( Html::rawElement( 'p', array(), $this->getLang()->pipeList( $links ) ) );
119132 }
120133
121134 }
Index: trunk/extensions/Survey/specials/SpecialSurveyStats.php
@@ -250,7 +250,7 @@
251251 'surveys-surveystats-question-answer',
252252 'parsemag',
253253 $answer,
254 - $GLOBALS['wgLang']->formatNum( $answerCount )
 254+ $this->getLang()->formatNum( $answerCount )
255255 )
256256 );
257257 }
Index: trunk/extensions/Survey/specials/SpecialSurvey.php
@@ -240,7 +240,7 @@
241241 'id' => 'survey-ratio',
242242 'name' => 'survey-ratio',
243243 'options' => array_flip( array_map(
244 - function( $n ) { return $GLOBALS['wgLang']->formatNum( $n ); },
 244+ function( $n ) { return $this->getLang()->formatNum( $n ); },
245245 array_combine( $nrs, $nrs )
246246 ) ),
247247 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r96820Follow up to r96819;jeroendedauw00:08, 12 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96818Follow up to r96815;jeroendedauw22:49, 11 September 2011

Status & tagging log