summaryrefslogtreecommitdiff
path: root/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php')
-rw-r--r--extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php36
1 files changed, 16 insertions, 20 deletions
diff --git a/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php b/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
index 5372342d..da33ebee 100644
--- a/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
+++ b/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
@@ -1,6 +1,6 @@
<?php
/**
- * Syntax highlighting extension for MediaWiki 1.5 using GeSHi
+ * Syntax highlighting extension for MediaWiki using GeSHi
* Copyright (C) 2005 Brion Vibber <brion@pobox.com>
* http://www.mediawiki.org/
*
@@ -27,10 +27,6 @@
*
* This extension wraps the GeSHi highlighter: http://qbnz.com/highlighter/
*
- * Unlike the older GeSHi MediaWiki extension floating around, this makes
- * use of the new extension parameter support in MediaWiki 1.5 so it only
- * has to register one tag, <source>.
- *
* A language is specified like: <source lang="c">void main() {}</source>
* If you forget, or give an unsupported value, the extension spits out
* some help text and a list of all supported languages.
@@ -52,23 +48,22 @@ $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array(
$wgSyntaxHighlightDefaultLang = null;
$wgSyntaxHighlightKeywordLinks = false;
-$dir = dirname(__FILE__) . '/';
+$dir = __DIR__ . '/';
+$wgMessagesDirs['SyntaxHighlight_GeSHi'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.i18n.php';
-$wgAutoloadClasses['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.class.php';
-$wgHooks['ParserFirstCallInit'][] = 'efSyntaxHighlight_GeSHiSetup';
-$wgHooks['ExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hSpecialVersion_GeSHi';
-//if ( defined( 'MW_SUPPORTS_CONTENTHANDLER' ) ) {
- // since MW 1.21
-// $wgHooks['ContentGetParserOutput'][] = 'SyntaxHighlight_GeSHi::renderHook';
-//} else {
- // B/C until 1.20
- $wgHooks['ShowRawCssJs'][] = 'SyntaxHighlight_GeSHi::viewHook';
-//}
+$wgAutoloadClasses['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.class.php';
+$wgAutoloadClasses['ResourceLoaderGeSHiModule'] = $dir . 'ResourceLoaderGeSHiModule.php';
+$wgAutoloadClasses['ResourceLoaderGeSHiLocalModule'] = $dir . 'ResourceLoaderGeSHiLocalModule.php';
+$wgHooks['ExtensionTypes'][] = 'SyntaxHighlight_GeSHi::extensionTypes';
+$wgHooks['ResourceLoaderRegisterModules'][] = 'SyntaxHighlight_GeSHi::resourceLoaderRegisterModules';
+$wgHooks['ContentGetParserOutput'][] = 'SyntaxHighlight_GeSHi::renderHook';
-$wgAutoloadClasses['HighlightGeSHilocal'] = $dir . 'SyntaxHighlight_GeSHi.local.php';
-$wgResourceModules['ext.geshi.local'] = array( 'class' => 'HighlightGeSHilocal' );
+// Module to load MediaWiki:Geshi.css.
+$wgResourceModules['ext.geshi.local'] = array( 'class' => 'ResourceLoaderGeSHiLocalModule' );
+// More modules are defined by SyntaxHighlight_GeSHi::resourceLoaderRegisterModules,
+// one for each supported language. The general name template is 'ext.geshi.language.<lang>'.
/**
* Map content models to the corresponding language names to be used with the highlighter.
@@ -83,9 +78,10 @@ $wgSyntaxHighlightModels = array(
* Register parser hook
*
* @param $parser Parser
+ * @return bool
*/
-function efSyntaxHighlight_GeSHiSetup( &$parser ) {
+$wgHooks['ParserFirstCallInit'][] = function ( &$parser ) {
$parser->setHook( 'source', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );
$parser->setHook( 'syntaxhighlight', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );
return true;
-}
+};