From f79818194899a53adb903edfa81ffbcb207d3c53 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Mon, 10 Nov 2014 14:49:40 -0800 Subject: [PATCH] Don't overwrite existing value of $wgSyntaxHighlightModels Currently extensions that want to add their model to $wgSyntaxHighlightModels must do so in an extension function since they don't want to assume that their extension is loaded after SyntaxHighlight GeSHi is. But by not overwriting the array during initialization, extensions don't have to worry about load order. Also require a minimum of MW 1.24 which removed support for register_globals. Change-Id: I15c56690d156e90991aa86a3d79dbeaeb18dd6fd --- SyntaxHighlight_GeSHi.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SyntaxHighlight_GeSHi.php b/SyntaxHighlight_GeSHi.php index caf3b302..de2c76bd 100644 --- a/SyntaxHighlight_GeSHi.php +++ b/SyntaxHighlight_GeSHi.php @@ -36,6 +36,11 @@ if( !defined( 'MEDIAWIKI' ) ) { die(); } +if ( version_compare( $wgVersion, '1.24', '<' ) ) { + die( "This version of SyntaxHighlight GeSHi requires MediaWiki 1.24" ); +} + + $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array( 'path' => __FILE__, 'name' => 'SyntaxHighlight', @@ -70,10 +75,8 @@ $wgResourceModules['ext.geshi.local'] = array( 'class' => 'ResourceLoaderGeSHiLo * Map content models to the corresponding language names to be used with the highlighter. * Pages with one of the given content models will automatically be highlighted. */ -$wgSyntaxHighlightModels = array( - CONTENT_MODEL_CSS => 'css', - CONTENT_MODEL_JAVASCRIPT => 'javascript', -); +$wgSyntaxHighlightModels[CONTENT_MODEL_CSS] = 'css'; +$wgSyntaxHighlightModels[CONTENT_MODEL_JAVASCRIPT] = 'javascript'; /** * Register parser hook