-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathExternBib.php
86 lines (74 loc) · 2.65 KB
/
ExternBib.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* Main code that connects Mediawiki to the ExternBib extension.
*
* @package ExternBib
* @author Olaf Lenz
* @author Michael Kuron
* @copyright 2011-2013,2016 The Authors
* @license https://opensource.org/licenses/BSD-3-Clause New BSD License
* @link https://github.com/olenz/externbib
*/
if (!defined('MEDIAWIKI')) die();
// Interface to mediawiki
$wgExternBibCredits =
array(
'name' => 'ExternBib',
'version' => '2.0',
'author' => 'Olaf Lenz, David Schwörer, Christopher Wagner',
'url' => 'https://github.com/olenz/externbib',
'description' => 'Cite an external bibtex file.',
'descriptionmsg' => 'externbib-desc',
);
$wgExtensionCredits['parserhook'][] = $wgExternBibCredits;
$wgExtensionCredits['specialpage'][] = $wgExternBibCredits;
$dir = dirname(__FILE__) . '/';
// directly load ExternBib.class.php, as an instance will be created anyway
require_once($dir . 'ExternBib.class.php');
$wgExtensionMessagesFiles['ExternBib'] = $dir . 'ExternBib.i18n.php';
$wgExtensionFunctions[] = 'efExternBibSetup';
$wgAutoloadClasses['SpecialExternBibSearch'] = $dir . 'SpecialExternBibSearch.php';
$wgSpecialPages['ExternBibSearch'] = 'SpecialExternBibSearch';
$wgSpecialPageGroups['ExternBibSearch'] = 'other';
$wgAutoloadClasses['SpecialExternBibShowEntry'] = $dir . 'SpecialExternBibShowEntry.php';
$wgSpecialPages['ExternBibShowEntry'] = 'SpecialExternBibShowEntry';
$wgSpecialPageGroups['ExternBibShowEntry'] = 'other';
// defaults
if (!isset($wgExternBibDBFiles))
$wgExternBibDBFiles = "$dir/test/externbib.db";
if (!isset($wgExternBibFileDirs))
$wgExternBibFileDirs ="$dir/test/pdf" ;
if (!isset($wgExternBibFileBaseURLs))
$wgExternBibFileBaseURLs = "extensions/ExternBib/test/pdf";
if (!isset($wgExternBibDOIBaseURL))
$wgExternBibDOIBaseURL = "https://doi.org";
if (!isset($wgExternBibEPrintBaseURL))
$wgExternBibEPrintBaseURL = "https://arxiv.org/abs";
if (!isset($wgExternBibDefaultFormat)) {
$wgExternBibDefaultFormat = array();
$wgExternBibDefaultFormat["filelink"] = true;
}
// setup the module
function efExternBibSetup() {
global $wgParser,
$wgExternBib,
$wgExternBibDBFiles,
$wgExternBibFileDirs,
$wgExternBibFileBaseURLs,
$wgExternBibDOIBaseURL,
$wgExternBibEPrintBaseURL,
$wgExternBibDefaultFormat;
$wgExternBib = new ExternBib(
$wgExternBibDBFiles,
$wgExternBibFileDirs,
$wgExternBibFileBaseURLs,
$wgExternBibDOIBaseURL,
$wgExternBibEPrintBaseURL,
$wgExternBibDefaultFormat
);
// register the tags
$wgParser->setHook("bibentry", array($wgExternBib, 'bibentry'));
$wgParser->setHook("bibsearch", array($wgExternBib, 'bibsearch'));
return true;
}
?>