r51494 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51493‎ | r51494 | r51495 >
Date:08:51, 5 June 2009
Author:ialex
Status:deferred
Tags:
Comment:
* removed useless ?>
* use $wgExtensionMessagesFiles and wfLoadExtensionMessages() rather than loading message at each request
* svn:eol-style native
Modified paths:
  • /trunk/extensions/StockCharts/README (modified) (history)
  • /trunk/extensions/StockCharts/StockCharts.i18n.php (modified) (history)
  • /trunk/extensions/StockCharts/StockCharts.php (modified) (history)
  • /trunk/extensions/StockCharts/StockCharts_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/StockCharts/StockCharts_body.php
@@ -102,6 +102,7 @@
103103
104104 // ticker is a required param
105105 if( !$ticker ) {
 106+ wfLoadExtensionMessages( 'StockCharts' );
106107 $error = '<span style="color: red; font-weight: bold;">' . wfMsg('stockchart_missingticker') . '</span>';
107108 return false;
108109 }
@@ -171,6 +172,3 @@
172173 return $embedCode;
173174 }
174175 }
175 -
176 -
177 -?>
Index: trunk/extensions/StockCharts/StockCharts.i18n.php
@@ -5,10 +5,9 @@
66 * @addtogroup Extensions
77 */
88
9 -$wgStockChartsMessages = array();
 9+$messages = array();
1010
11 -$wgStockChartsMessages['en'] = array(
 11+$messages['en'] = array(
1212 'stockchart_missingticker' => 'To embed a stock chart, you need to at least specify a ticker, like this: &lt;stockchart ticker="AAPL"/&gt;',
1313 );
1414
15 -?>
Property changes on: trunk/extensions/StockCharts/README
___________________________________________________________________
Name: svn:eol-style
1615 + native
Index: trunk/extensions/StockCharts/StockCharts.php
@@ -22,25 +22,18 @@
2323
2424 $wgExtensionCredits['parserhook'][] = array(
2525 'name' => 'StockCharts',
 26+ 'path' => __FILE__,
2627 'author' => 'Brendan Meutzner, Anton Zolotkov, Roger Fong',
2728 'description' => 'Adds <nowiki><stockchart ticker="AAPL"/></nowiki> tag for an interactive financial stock chart.',
2829 'url' => 'http://www.mediawiki.org/wiki/Extension:StockCharts',
2930 );
3031
3132 # Internationalisation file
32 -require_once( 'StockCharts.i18n.php' );
 33+$wgExtensionMessagesFiles['StockCharts'] = dirname( __FILE__ ) . '/StockCharts.i18n.php';
3334
3435 $wgAutoloadClasses['StockCharts'] = dirname( __FILE__ ) . '/StockCharts_body.php';
3536
36 -
37 -
3837 function efStockCharts() {
39 - # Add messages
40 - global $wgMessageCache, $wgStockChartsMessages;
41 - foreach( $wgStockChartsMessages as $language => $messages ) {
42 - $wgMessageCache->addMessages( $messages, $language );
43 - }
44 -
4538 global $wgParser;
4639 $wgParser->setHook('stockchart', array('StockCharts', 'renderTagExtension')); // hook for <stockchart ../>
4740 $wgParser->setFunctionHook('stockchart', array('StockCharts', 'renderParserFunction')); // hook for {{#stockchart ..}}
@@ -50,6 +43,3 @@
5144 $magicWords['stockchart'] = array( 0, 'stockchart' );
5245 return true;
5346 }
54 -
55 -
56 -?>

Status & tagging log