-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathSemanticGlossary.php
57 lines (45 loc) · 1.25 KB
/
SemanticGlossary.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
<?php
use SG\HookRegistry;
use SMW\ApplicationFactory;
/**
* Class SemanticGlossary
*
* @ingroup Skins
*/
class SemanticGlossary {
/**
* @since 2.0
*/
public static function initExtension() {
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
// Load Extension:Lingo - but only if not already loaded
if ( ! class_exists( 'Lingo\Lingo' ) ) {
// must NOT use ExtensionRegistry::getInstance() to avoid recursion!
$registry = new ExtensionRegistry();
if ( file_exists( __DIR__ . '/extensions/Lingo/extension.json' ) ) {
$registry->load( __DIR__ . '/extensions/Lingo/extension.json' );
} else {
$registry->load( $GLOBALS[ 'wgExtensionDirectory' ] . '/Lingo/extension.json' );
}
}
$GLOBALS[ 'wgexLingoBackend' ] = 'SG\LingoBackendAdapter';
$GLOBALS[ 'wgExtensionFunctions' ][] = function () {
$hookRegistry = new HookRegistry();
$hookRegistry->register();
};
}
/**
* @since 2.0
*
* @return string|null
*/
public static function getVersion() {
$extensionData = ExtensionRegistry::getInstance()->getAllThings();
if ( isset( $extensionData['Semantic Glossary'] ) ) {
return $extensionData['Semantic Glossary']['version'];
}
return null;
}
}