forked from kannera/TermBank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Termbank.php
92 lines (77 loc) · 2.83 KB
/
Termbank.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
87
88
89
90
91
<?php
if ( !defined( 'MEDIAWIKI' ) ) die();
/**
* An extension that provides facilities to tieteentermipankki.fi
*
* @file
* @ingroup Extensions
*
* @author Niklas Laxström
* @copyright Copyright © 2012
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*/
/**
* Extension credits properties.
*/
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
'name' => 'Termbank',
'version' => '2011-12-18',
'author' => 'Niklas Laxström',
//'descriptionmsg' => 'termbank-desc',
//'url' => 'http://tieteentermipankki.fi',
);
$dir = dirname( __FILE__ ) . '/';
$wgExtensionMessagesFiles['Termbank'] = $dir . 'Termbank.i18n.php';
$wgExtensionMessagesFiles['Termbank-alias'] = $dir . 'Termbank.alias.php';
$wgExtensionMessagesFiles['TermbankNamespaces'] = $dir . '/Termbank.namespaces.php';
$wgAutoloadClasses['SpecialPrivateData'] = "$dir/SpecialPrivateData.php";
$wgAutoloadClasses['TemplateParser'] = "$dir/TemplateParser.php";
$wgAutoloadClasses['ResourceLoaderTermbankModule'] = "$dir/ResourceLoaderTermbankModule.php";
$wgSpecialPages['PrivateData'] = 'SpecialPrivateData';
$wgSpecialPageGroups['PrivateData'] = 'wiki';
$resourcePaths = array(
'localBasePath' => dirname( __FILE__ ),
'remoteExtPath' => 'Termbank'
);
// Client-side resource modules
$wgResourceModules['ext.termbank'] = array(
'styles' => 'resources/ext.termbank.css',
'position' => 'top',
) + $resourcePaths;
$wgResourceModules['ext.termbank.privatedata'] = array(
'styles' => 'resources/ext.termbank.privatedata.css',
'scripts' => 'resources/ext.termbank.privatedata.js',
'dependencies' => 'mediawiki.util',
) + $resourcePaths;
$wgResourceModules['ext.termbank.workgroups'] = array(
'class' => 'ResourceLoaderTermbankModule',
);
$wgHooks['LoadExtensionSchemaUpdates'][] = 'efTermbankSchema';
function efTermbankSchema( $updater ) {
$dir = dirname( __FILE__ ) . '/';
$updater->addExtensionUpdate( array( 'addTable', 'privatedata', "$dir/privatedata.sql", true ) );
return true;
}
$wgHooks['BeforePageDisplay'][] = 'efTermbankModules';
function efTermbankModules( $out, $skin ) {
$out->addModules( 'ext.termbank' );
$out->addModules( 'ext.termbank.privatedata' );
return true;
}
$wgHooks['LinkBegin'][] = 'efTermbankLinkAnnotator';
function efTermbankLinkAnnotator( $dummy, $target, &$html, &$customAttribs, &$query, &$options, &$ret ) {
if ( $target && $target->getNamespace() >= 1100 && count( $query ) === 0 ) {
if ( isset( $customAttribs['class'] ) ) {
$customAttribs['class'] .= " ns-" . $target->getNamespace();
} else {
$customAttribs['class'] = " ns-" . $target->getNamespace();
}
}
return true;
}
$wgHooks['BeforePageDisplay'][] = 'efTermbankCSSGenerator';
function efTermbankCSSGenerator( $out, $skin ) {
$out->addModules( 'ext.termbank.workgroups' );
return true;
}