mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-15 02:24:07 +00:00
Patches for bugs 20490 and 20491 by Juliano F. Ravasi (improper use of the ParserFirstCallInit hook). If we want to drop support for 1.11, that can be done in a subsequent commit.
This commit is contained in:
parent
3ebcee7285
commit
0355a57d41
|
@ -59,15 +59,20 @@ $wgHooks['SpecialVersionExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hSpecialVer
|
|||
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
|
||||
$wgHooks['ParserFirstCallInit'][] = 'efSyntaxHighlight_GeSHiSetup';
|
||||
} else {
|
||||
$wgExtensionFunctions[] = 'efSyntaxHighlight_GeSHiSetup';
|
||||
$wgExtensionFunctions[] = 'efSyntaxHighlight_GeSHiSetup_legacy';
|
||||
}
|
||||
|
||||
/**
|
||||
* Register parser hook
|
||||
*/
|
||||
function efSyntaxHighlight_GeSHiSetup() {
|
||||
global $wgParser;
|
||||
$wgParser->setHook( 'source', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );
|
||||
$wgParser->setHook( 'syntaxhighlight', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );
|
||||
function efSyntaxHighlight_GeSHiSetup( &$parser ) {
|
||||
$parser->setHook( 'source', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );
|
||||
$parser->setHook( 'syntaxhighlight', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Provided for pre-1.12 MediaWiki compatibility. */
|
||||
function efSyntaxHighlight_GeSHiSetup_legacy() {
|
||||
global $wgParser;
|
||||
return efSyntaxHighlight_GeSHiSetup( $wgParser );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue