r79578 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79577‎ | r79578 | r79579 >
Date:13:52, 4 January 2011
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
LabeledSectionTransclusion: Use ParserFirstCallInit instead of $wgParser
Modified paths:
  • /trunk/extensions/LabeledSectionTransclusion/lst.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LabeledSectionTransclusion/lst.php
@@ -21,7 +21,7 @@
2222 # Standard initialisation code
2323 ##
2424
25 -$wgExtensionFunctions[] = array( 'LabeledSectionTransclusion', "setup" );
 25+$wgHooks['ParserFirstCallInit'][] = 'LabeledSectionTransclusion::setup';
2626 $wgHooks['LanguageGetMagic'][] = 'LabeledSectionTransclusion::setupMagic';
2727
2828 $wgExtensionCredits['parserhook'][] = array(
@@ -40,17 +40,15 @@
4141
4242 class LabeledSectionTransclusion {
4343
44 - static function setup()
 44+ static function setup( $parser )
4545 {
46 - global $wgParser;
47 -
48 - $wgParser->setHook( 'section', array( __CLASS__, 'noop' ) );
49 - if ( defined( get_class( $wgParser ) . '::SFH_OBJECT_ARGS' ) ) {
50 - $wgParser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncIncludeObj' ), SFH_OBJECT_ARGS );
51 - $wgParser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExcludeObj' ), SFH_OBJECT_ARGS );
 46+ $parser->setHook( 'section', array( __CLASS__, 'noop' ) );
 47+ if ( defined( get_class( $parser ) . '::SFH_OBJECT_ARGS' ) ) {
 48+ $parser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncIncludeObj' ), SFH_OBJECT_ARGS );
 49+ $parser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExcludeObj' ), SFH_OBJECT_ARGS );
5250 } else {
53 - $wgParser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncInclude' ) );
54 - $wgParser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExclude' ) );
 51+ $parser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncInclude' ) );
 52+ $parser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExclude' ) );
5553 }
5654 }
5755

Follow-up revisions

RevisionCommit summaryAuthorDate
r797201.17: MFT r79578, r79591, r79593, r79595, r79649, r79650, r79651, r79653, r79...catrope14:48, 6 January 2011

Comments

#Comment by Reedy (talk | contribs)   06:35, 7 January 2011

Missing return true;

Fixed in r79810

Status & tagging log