Move ParserFirstCallInit hook into static function

Change-Id: Iddaa86a53ad5977e61a0493d48173a8fdd7d3cfd
This commit is contained in:
Kunal Mehta 2015-05-02 23:29:25 -07:00
parent cc256601de
commit 4165dd5ae7
2 changed files with 10 additions and 10 deletions

View file

@ -22,7 +22,7 @@ call_user_func( function() {
$GLOBALS['wgMessagesDirs']['ImageMap'] = __DIR__ . '/i18n';
$GLOBALS['wgExtensionMessagesFiles']['ImageMap'] = $dir . 'ImageMap.i18n.php';
$GLOBALS['wgAutoloadClasses']['ImageMap'] = $dir . 'ImageMap_body.php';
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'wfSetupImageMap';
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'ImageMap::onParserFirstCallInit';
$GLOBALS['wgExtensionCredits']['parserhook']['ImageMap'] = array(
'path' => __FILE__,
@ -34,12 +34,3 @@ call_user_func( function() {
$GLOBALS['wgParserTestFiles'][] = $dir . 'imageMapParserTests.txt';
} );
/**
* @param $parser Parser
* @return bool
*/
function wfSetupImageMap( &$parser ) {
$parser->setHook( 'imagemap', array( 'ImageMap', 'render' ) );
return true;
}

View file

@ -28,6 +28,15 @@ class ImageMap {
const TOP_LEFT = 3;
const NONE = 4;
/**
* @param Parser $parser
* @return bool
*/
public static function onParserFirstCallInit( Parser &$parser ) {
$parser->setHook( 'imagemap', array( 'ImageMap', 'render' ) );
return true;
}
/**
* @param $input
* @param $params