Index: trunk/extensions/CommunityVoice/CommunityVoice.php |
— | — | @@ -59,13 +59,24 @@ |
60 | 60 | |
61 | 61 | abstract class CommunityVoice { |
62 | 62 | |
63 | | - /* Static Members */ |
| 63 | + /* Private Static Members */ |
64 | 64 | |
65 | | - static private $modules = array( |
| 65 | + private static $modules = array( |
66 | 66 | 'Ratings' => array( 'class' => 'CommunityVoiceRatings' ) |
67 | 67 | ); |
68 | | - static private $messagesLoaded = false; |
| 68 | + private static $messagesLoaded = false; |
69 | 69 | |
| 70 | + /* Private Static Functions */ |
| 71 | + |
| 72 | + private static function autoLoadMessages() { |
| 73 | + // Checks if extension messages have been loaded already |
| 74 | + if ( !self::$messagesLoaded ) { |
| 75 | + // Loads extension messages |
| 76 | + wfLoadExtensionMessages( 'CommunityVoice' ); |
| 77 | + self::$messagesLoaded = true; |
| 78 | + } |
| 79 | + } |
| 80 | + |
70 | 81 | /* Static Functions */ |
71 | 82 | |
72 | 83 | public static function getModules() { |
— | — | @@ -124,16 +135,31 @@ |
125 | 136 | $message, |
126 | 137 | $parameter = null |
127 | 138 | ) { |
128 | | - // Checks if extension messages have been loaded already |
129 | | - if ( !self::$messagesLoaded ) { |
130 | | - // Loads extension messages |
131 | | - wfLoadExtensionMessages( 'CommunityVoice' ); |
132 | | - self::$messagesLoaded = true; |
133 | | - } |
| 139 | + // Makes sure messages are laoded |
| 140 | + self::autoLoadMessages(); |
134 | 141 | // Returns message |
135 | 142 | return wfMsg( 'communityvoice-' . $module . '-' . $message, $parameter ); |
136 | 143 | } |
137 | 144 | |
| 145 | + public static function getMessageParse( |
| 146 | + $module, |
| 147 | + $message |
| 148 | + ) { |
| 149 | + // Makes sure messages are laoded |
| 150 | + self::autoLoadMessages(); |
| 151 | + // Gets variadic parameters |
| 152 | + $parameters = func_get_args(); |
| 153 | + // Less the first two |
| 154 | + array_shift( $parameters ); |
| 155 | + array_shift( $parameters ); |
| 156 | + // Returns message |
| 157 | + return wfMsgExt( |
| 158 | + 'communityvoice-' . $module . '-' . $message, |
| 159 | + array( 'parsemag' ), |
| 160 | + $parameters |
| 161 | + ); |
| 162 | + } |
| 163 | + |
138 | 164 | /** |
139 | 165 | * Adds scripts to document |
140 | 166 | */ |
Index: trunk/extensions/CommunityVoice/Modules/Ratings.php |
— | — | @@ -177,7 +177,12 @@ |
178 | 178 | 'cv_ratings_scale_' . $args['category'] . '_' . $args['title'] |
179 | 179 | ); |
180 | 180 | // Gets stats message |
181 | | - $stats = wfMsgExt( 'communityvoice-ratings-scale-stats', array( 'parsemag' ), $wgLang->formatNum( round( $rating, 1 ) ), $wgLang->formatnum( $totalVotes ) ); |
| 181 | + $stats = CommunityVoice::getMessageParse( |
| 182 | + 'ratings', |
| 183 | + 'scale-stats', |
| 184 | + $wgLang->formatNum( round( $rating, 1 ) ), |
| 185 | + $wgLang->formatnum( $totalVotes ) |
| 186 | + ); |
182 | 187 | |
183 | 188 | // Begins rating scale |
184 | 189 | $htmlOut = Html::open( |