Index: trunk/extensions/Survey/specials/SpecialSurveyPage.php |
— | — | @@ -69,6 +69,19 @@ |
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
| 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 | + /** |
73 | 86 | * Add resource loader modules or use fallback code for |
74 | 87 | * earlier versions of MediaWiki. |
75 | 88 | * |
— | — | @@ -114,7 +127,7 @@ |
115 | 128 | * @param array $links |
116 | 129 | */ |
117 | 130 | 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 ) ) ); |
119 | 132 | } |
120 | 133 | |
121 | 134 | } |
Index: trunk/extensions/Survey/specials/SpecialSurveyStats.php |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | 'surveys-surveystats-question-answer', |
252 | 252 | 'parsemag', |
253 | 253 | $answer, |
254 | | - $GLOBALS['wgLang']->formatNum( $answerCount ) |
| 254 | + $this->getLang()->formatNum( $answerCount ) |
255 | 255 | ) |
256 | 256 | ); |
257 | 257 | } |
Index: trunk/extensions/Survey/specials/SpecialSurvey.php |
— | — | @@ -240,7 +240,7 @@ |
241 | 241 | 'id' => 'survey-ratio', |
242 | 242 | 'name' => 'survey-ratio', |
243 | 243 | 'options' => array_flip( array_map( |
244 | | - function( $n ) { return $GLOBALS['wgLang']->formatNum( $n ); }, |
| 244 | + function( $n ) { return $this->getLang()->formatNum( $n ); }, |
245 | 245 | array_combine( $nrs, $nrs ) |
246 | 246 | ) ), |
247 | 247 | ); |