r81530 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81529‎ | r81530 | r81531 >
Date:17:11, 4 February 2011
Author:ialex
Status:ok
Tags:
Comment:
Use ParserFirstCallInit hook to register parser tags
Modified paths:
  • /trunk/extensions/Aggregator/Aggregator.php (modified) (history)
  • /trunk/extensions/AmazonPlus/AmazonPlus.php (modified) (history)
  • /trunk/extensions/Chemistry/ChemFunctions.php (modified) (history)
  • /trunk/extensions/Citation/Citation.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Chemistry/ChemFunctions.php
@@ -43,11 +43,11 @@
4444
4545 $wgExtensionMessagesFiles['ChemFunctions'] = dirname( __FILE__ ) . '/ChemFunctions.i18n.php';
4646
47 -$wgExtensionFunctions[] = "wfChemFormExtension";
 47+$wgHooks['ParserFirstCallInit'][] = 'wfChemFormExtension';
4848
49 -function wfChemFormExtension() {
50 - global $wgParser;
51 - $wgParser->setHook( "chemform", "RenderChemForm" );
 49+function wfChemFormExtension( $parser ) {
 50+ $parser->setHook( "chemform", "RenderChemForm" );
 51+ return true;
5252 }
5353
5454 function RenderChemForm( $input, $argv ) {
Index: trunk/extensions/AmazonPlus/AmazonPlus.php
@@ -83,9 +83,8 @@
8484 define( 'AMAZONPLUS_USED', 3 );
8585
8686 # Set up the tag extension
87 -function efAmazonPlusSetup() {
88 - global $wgParser;
89 - $wgParser->setHook( 'amazon', 'efAmazonPlusRender' );
 87+function efAmazonPlusSetup( $parser ) {
 88+ $parser->setHook( 'amazon', 'efAmazonPlusRender' );
9089 wfLoadExtensionMessages( 'AmazonPlus' );
9190 return true;
9291 }
Index: trunk/extensions/Citation/Citation.php
@@ -13,12 +13,12 @@
1414 $wgHooks['ParserBeforeTidy'][] = 'citation_hooker';
1515 $wgHooks['ParserClearState'][] = 'citation_clear_state';
1616
17 -$wgExtensionFunctions[] = "wfCitation";
 17+$wgHooks['ParserFirstCallInit'][] = "wfCitation";
1818
19 -function wfCitation() {
20 - global $wgParser ;
21 - $wgParser->setHook( "citation" , 'parse_citation' ) ;
22 - $wgParser->isMainParser = true ;
 19+function wfCitation( $parser ) {
 20+ $parser->setHook( "citation" , 'parse_citation' ) ;
 21+ $parser->isMainParser = true ;
 22+ return true;
2323 }
2424
2525 $wgCitationCache = array() ;
Index: trunk/extensions/Aggregator/Aggregator.php
@@ -18,10 +18,14 @@
1919
2020 $wgExtensionFunctions[] = 'wfAggregatorSetup';
2121
 22+$wgHooks['ParserFirstCallInit'][] = 'wfAggregatorOnParserFirstCallInit';
 23+
 24+function wfAggregatorOnParserFirstCallInit( $parser ) {
 25+ $parser->setHook( 'aggregator', 'wfAggregatorHook' );
 26+ return true;
 27+}
 28+
2229 function wfAggregatorSetup() {
23 - global $wgParser;
24 - $wgParser->setHook( 'aggregator', 'wfAggregatorHook' );
25 -
2630 // Magpie
2731 if ( defined( 'MAGPIE_OUTPUT_ENCODING' ) ) {
2832 if ( stricmp( MAGPIE_OUTPUT_ENCODING, 'UTF-8' ) ) {

Status & tagging log