~ubuntu-branches/ubuntu/saucy/mediawiki-extensions/saucy

« back to all changes in this revision

Viewing changes to dist/mediawiki-extensions-geshi/usr/share/mediawiki-extensions/geshi/SyntaxHighlight_GeSHi.php

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2010-05-04 15:13:35 UTC
  • mfrom: (0.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100504151335-54qeucg3ec108q28
Tags: 2.2
* Added Replaces:/Conflicts: to allow a proper upgrade.
Closes: #580066
* Fixed package descriptions.
Closes: #579667
* Patched mediawiki-extensions-fckeditor to make it work with
  php 5.3. The fix may not be perfect but at least it work.
  Not closing the bug (#579822) for now..

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Syntax highlighting extension for MediaWiki 1.5 using GeSHi
 
4
 * Copyright (C) 2005 Brion Vibber <brion@pobox.com>
 
5
 * http://www.mediawiki.org/
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License along
 
18
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
19
 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
 * http://www.gnu.org/copyleft/gpl.html
 
21
 */
 
22
 
 
23
/**
 
24
 * @addtogroup Extensions
 
25
 * @author Brion Vibber
 
26
 *
 
27
 * This extension wraps the GeSHi highlighter: http://qbnz.com/highlighter/
 
28
 *
 
29
 * Unlike the older GeSHi MediaWiki extension floating around, this makes
 
30
 * use of the new extension parameter support in MediaWiki 1.5 so it only
 
31
 * has to register one tag, <source>.
 
32
 *
 
33
 * A language is specified like: <source lang="c">void main() {}</source>
 
34
 * If you forget, or give an unsupported value, the extension spits out
 
35
 * some help text and a list of all supported languages.
 
36
 *
 
37
 * The extension has been tested with GeSHi 1.0.8 and MediaWiki 1.14a
 
38
 * as of 2008-09-28.
 
39
 */
 
40
 
 
41
if( !defined( 'MEDIAWIKI' ) )
 
42
        die();
 
43
 
 
44
$wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array(
 
45
        'name'           => 'SyntaxHighlight',
 
46
        'svn-date' => '$LastChangedDate: 2008-09-28 10:30:45 -0500 (dim. 28 sept. 2008) $',
 
47
        'svn-revision' => '$LastChangedRevision: 41349 $',
 
48
        'author'         => array( 'Brion Vibber', 'Tim Starling', 'Rob Church', 'Niklas Laxström' ),
 
49
        'description'    => 'Provides syntax highlighting using [http://qbnz.com/highlighter/ GeSHi Highlighter]',
 
50
        'descriptionmsg' => 'syntaxhighlight-desc',
 
51
        'url'            => 'http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi',
 
52
);
 
53
 
 
54
$dir = dirname(__FILE__) . '/';
 
55
$wgExtensionMessagesFiles['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.i18n.php';
 
56
$wgAutoloadClasses['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.class.php';
 
57
$wgHooks['ShowRawCssJs'][] = 'SyntaxHighlight_GeSHi::viewHook';
 
58
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
 
59
        $wgHooks['ParserFirstCallInit'][] = 'efSyntaxHighlight_GeSHiSetup';
 
60
} else {
 
61
        $wgExtensionFunctions[] = 'efSyntaxHighlight_GeSHiSetup';
 
62
}
 
63
 
 
64
/**
 
65
 * Register parser hook
 
66
 */
 
67
function efSyntaxHighlight_GeSHiSetup() {
 
68
        global $wgParser;
 
69
        $wgParser->setHook( 'source', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );
 
70
        return true;
 
71
}