http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96819

Revision: 96819
Author:   jeroendedauw
Date:     2011-09-11 23:57:47 +0000 (Sun, 11 Sep 2011)
Log Message:
-----------
Follow up to r96818; 

Modified Paths:
--------------
    trunk/extensions/Survey/specials/SpecialSurvey.php
    trunk/extensions/Survey/specials/SpecialSurveyPage.php
    trunk/extensions/Survey/specials/SpecialSurveyStats.php

Modified: trunk/extensions/Survey/specials/SpecialSurvey.php
===================================================================
--- trunk/extensions/Survey/specials/SpecialSurvey.php  2011-09-11 22:49:07 UTC 
(rev 96818)
+++ trunk/extensions/Survey/specials/SpecialSurvey.php  2011-09-11 23:57:47 UTC 
(rev 96819)
@@ -240,7 +240,7 @@
                        'id' => 'survey-ratio',
                        'name' => 'survey-ratio',
                        'options' => array_flip( array_map(
-                               function( $n ) { return 
$GLOBALS['wgLang']->formatNum( $n ); },
+                               function( $n ) { return 
$this->getLang()->formatNum( $n ); },
                                array_combine( $nrs, $nrs )
                        ) ),
                );

Modified: trunk/extensions/Survey/specials/SpecialSurveyPage.php
===================================================================
--- trunk/extensions/Survey/specials/SpecialSurveyPage.php      2011-09-11 
22:49:07 UTC (rev 96818)
+++ trunk/extensions/Survey/specials/SpecialSurveyPage.php      2011-09-11 
23:57:47 UTC (rev 96819)
@@ -69,6 +69,19 @@
        }
        
        /**
+        * Shortcut to get user's language.
+        * This overrides the getLang method of Specialpage added in MediaWiki 
1.18,
+        * and returns $wgLang for older versions.
+        *
+        * @since 0.1
+        * 
+        * @return Language
+        */
+       public function getLang() {
+               return version_compare( $GLOBALS['wgVersion'], '1.18', '>=' ) ? 
parent::getLang() : $GLOBALS['wgLang'];
+       }
+       
+       /**
         * Add resource loader modules or use fallback code for
         * earlier versions of MediaWiki.
         * 
@@ -114,7 +127,7 @@
         * @param array $links
         */
        protected function displayNavigation( array $links ) {
-               $this->getOutput()->addHTML( Html::rawElement( 'p', array(), 
$GLOBALS['wgLang']->pipeList( $links ) ) );
+               $this->getOutput()->addHTML( Html::rawElement( 'p', array(), 
$this->getLang()->pipeList( $links ) ) );
        }
        
 }

Modified: trunk/extensions/Survey/specials/SpecialSurveyStats.php
===================================================================
--- trunk/extensions/Survey/specials/SpecialSurveyStats.php     2011-09-11 
22:49:07 UTC (rev 96818)
+++ trunk/extensions/Survey/specials/SpecialSurveyStats.php     2011-09-11 
23:57:47 UTC (rev 96819)
@@ -250,7 +250,7 @@
                                                
'surveys-surveystats-question-answer',
                                                'parsemag',
                                                $answer,
-                                               $GLOBALS['wgLang']->formatNum( 
$answerCount )
+                                               $this->getLang()->formatNum( 
$answerCount )
                                        )
                                );
                        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to