Revision: 48527
Author:   tparscal
Date:     2009-03-18 20:09:43 +0000 (Wed, 18 Mar 2009)

Log Message:
-----------
Fixed message loading bug.

Modified Paths:
--------------
    trunk/extensions/CommunityVoice/CommunityVoice.php
    trunk/extensions/CommunityVoice/Modules/Ratings.php

Modified: trunk/extensions/CommunityVoice/CommunityVoice.php
===================================================================
--- trunk/extensions/CommunityVoice/CommunityVoice.php  2009-03-18 20:04:29 UTC 
(rev 48526)
+++ trunk/extensions/CommunityVoice/CommunityVoice.php  2009-03-18 20:09:43 UTC 
(rev 48527)
@@ -59,13 +59,24 @@
 
 abstract class CommunityVoice {
 
-       /* Static Members */
+       /* Private Static Members */
 
-       static private $modules = array(
+       private static $modules = array(
                'Ratings' => array( 'class' => 'CommunityVoiceRatings' )
        );
-       static private $messagesLoaded = false;
+       private static $messagesLoaded = false;
 
+       /* Private Static Functions */
+
+       private static function autoLoadMessages() {
+               // Checks if extension messages have been loaded already
+               if ( !self::$messagesLoaded ) {
+                       // Loads extension messages
+                       wfLoadExtensionMessages( 'CommunityVoice' );
+                       self::$messagesLoaded = true;
+               }
+       }
+
        /* Static Functions */
 
        public static function getModules() {
@@ -124,16 +135,31 @@
                $message,
                $parameter = null
        ) {
-               // Checks if extension messages have been loaded already
-               if ( !self::$messagesLoaded ) {
-                       // Loads extension messages
-                       wfLoadExtensionMessages( 'CommunityVoice' );
-                       self::$messagesLoaded = true;
-               }
+               // Makes sure messages are laoded
+               self::autoLoadMessages();
                // Returns message
                return wfMsg( 'communityvoice-' . $module . '-' . $message, 
$parameter );
        }
 
+       public static function getMessageParse(
+               $module,
+               $message
+       ) {
+               // Makes sure messages are laoded
+               self::autoLoadMessages();
+               // Gets variadic parameters
+               $parameters = func_get_args();
+               // Less the first two
+               array_shift( $parameters );
+               array_shift( $parameters );
+               // Returns message
+               return wfMsgExt(
+                       'communityvoice-' . $module . '-' . $message,
+                       array( 'parsemag' ),
+                       $parameters
+               );
+       }
+       
        /**
         * Adds scripts to document
         */

Modified: trunk/extensions/CommunityVoice/Modules/Ratings.php
===================================================================
--- trunk/extensions/CommunityVoice/Modules/Ratings.php 2009-03-18 20:04:29 UTC 
(rev 48526)
+++ trunk/extensions/CommunityVoice/Modules/Ratings.php 2009-03-18 20:09:43 UTC 
(rev 48527)
@@ -177,7 +177,12 @@
                        'cv_ratings_scale_' . $args['category'] . '_' . 
$args['title']
                );
                // Gets stats message
-               $stats = wfMsgExt( 'communityvoice-ratings-scale-stats', array( 
'parsemag' ),  $wgLang->formatNum( round( $rating, 1 ) ), $wgLang->formatnum( 
$totalVotes ) );
+               $stats = CommunityVoice::getMessageParse(
+                       'ratings',
+                       'scale-stats',
+                       $wgLang->formatNum( round( $rating, 1 ) ),
+                       $wgLang->formatnum( $totalVotes )
+               );
 
                // Begins rating scale
                $htmlOut = Html::open(



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

Reply via email to