-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwiki2latex.php
executable file
·69 lines (51 loc) · 2.87 KB
/
wiki2latex.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/*
* File: wiki2latex.php
*
* Purpose:
* Registers Wiki2LaTeX to Mediawiki
*
* License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
if ( !defined('MEDIAWIKI') ) {
$msg = 'To install Wiki2LaTeX, put the following line in LocalSettings.php:<br/>';
$msg .= '<tt>require_once( $IP."/extensions/path_to_Wiki2LaTeX_files/wiki2latex.php" );</tt>';
echo $msg;
exit( 1 );
}
define('W2L_VERSION', 'Devel: Jan2013'); //Wiki2LaTeX version
$w2lConfig = array();
$w2lTags = array();
$w2lParserFunctions = array();
// Require the class-files
require_once('w2lTags.php');
require_once('w2lHelper.php');
// Some functions:
require_once('w2lFunctions.php');
$w2lExtensionTags = new Wiki2LaTeXTags();
$w2lHelper = new Wiki2LaTeXHelper();
// load config files
require_once('w2lDefaultConfig.php');
if ( file_exists( dirname(__FILE__).'/w2lConfig.php') ) {
include_once('w2lConfig.php');
}
// Autoload classes
$wgAutoloadClasses['Wiki2LaTeXParser'] = dirname(__FILE__) . '/w2lParser.php';
$wgAutoloadClasses['Wiki2LaTeXCore'] = dirname(__FILE__) . '/w2lCore.php';
$wgAutoloadClasses['Wiki2LaTeXCompiler'] = dirname(__FILE__) . '/w2lLaTeXCompiler.php';
// Connect to hooks
$wgHooks['SkinTemplateContentActions'][] = array(&$w2lHelper); /*This feature was removed completely in version 1.18.0.Maybe it could be removed!![mediawiki.org]*/
$wgHooks['SkinTemplateNavigation'][] = array(&$w2lHelper); /*http://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation */
$wgHooks['UnknownAction'][] = array(&$w2lHelper); /*This hook allows you to add custom actions to MediaWiki. If an action is requested that the software doesn't handle natively, this hook will be called. [Mediawiki.org]. In w2lHelper::onUnknownAction there is the instantiation of Wiki2LaTeXCore.*/
$wgHooks['BeforePageDisplay'][] = array(&$w2lHelper);
$wgHooks['GetPreferences'][] = array(&$w2lHelper);
$wgHooks['ParserFirstCallInit'][] = array(&$w2lExtensionTags, 'Setup'); /* called when the parser initialises for the first time[mediawiki.org]*/
// Internal usage of hooks
$wgHooks['w2lInitParser'][] = array(&$w2lExtensionTags, 'w2lSetup'); //"Wiki2LaTeXTags::w2lSetup"
// Messages.php - multilanguages string
$wgExtensionMessagesFiles['wiki2latex'] = dirname( __FILE__ ) . '/w2lMessages.php';
$wgExtensionFunctions[] = array(&$w2lHelper, 'Setup'); /*This variable is an array that stores functions to be called after most of MediaWiki initialization is complete. It should be used for final step of initialization of extension setup code that needs to perform advanced things, like using global functions and instantiating autoloaded classes.[mediawiki.org]*/