Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php |
— | — | @@ -50,6 +50,7 @@ |
51 | 51 | 'url' => 'http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi', |
52 | 52 | ); |
53 | 53 | |
| 54 | +$wgSyntaxHighlightDefaultLang = null; //Change this in LocalSettings.php |
54 | 55 | $dir = dirname(__FILE__) . '/'; |
55 | 56 | $wgExtensionMessagesFiles['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.i18n.php'; |
56 | 57 | $wgAutoloadClasses['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.class.php'; |
Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | * @return string |
23 | 23 | */ |
24 | 24 | public static function parserHook( $text, $args = array(), $parser ) { |
| 25 | + global $wgSyntaxHighlightDefaultLang; |
25 | 26 | self::initialise(); |
26 | 27 | $text = rtrim( $text ); |
27 | 28 | // Don't trim leading spaces away, just the linefeeds |
— | — | @@ -29,7 +30,12 @@ |
30 | 31 | if( isset( $args['lang'] ) ) { |
31 | 32 | $lang = strtolower( $args['lang'] ); |
32 | 33 | } else { |
33 | | - return self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) ); |
| 34 | + // language is not specified. Check if default exists, if yes, use it. |
| 35 | + if ( !is_null($wgSyntaxHighlightDefaultLang) ) { |
| 36 | + $lang = strtolower($wgSyntaxHighlightDefaultLang); |
| 37 | + } else { |
| 38 | + return self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) ); |
| 39 | + } |
34 | 40 | } |
35 | 41 | if( !preg_match( '/^[a-z_0-9-]*$/', $lang ) ) |
36 | 42 | return self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) ); |