forked from wikimedia/mediawiki-extensions-Wikidata.org
/
WikidataOrg.php
78 lines (65 loc) · 2.22 KB
/
WikidataOrg.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
<?php
/**
* Configuration for and customizations to Wikibase
* that are specific to wikidata.org
*
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* ## ##### ##### ## ## ##### ## ##### ## ##
* __ _____ _ _____ ___ _ _____ _
* \ \ / /_ _| |/ /_ _| \ /_\_ _/_\
* \ \/\/ / | || ' < | || |) / _ \| |/ _ \
* \_/\_/ |___|_|\_\___|___/_/ \_\_/_/ \_\
*
*/
/**
* Entry point for for the Wikidata.org extension.
*
* @see README.md
* @see https://github.com/wmde/Wikidata.org
* @license GNU GPL v2+
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'Not an entry point.' );
}
if ( defined( 'WIKIDATA_ORG_VERSION' ) ) {
// Do not initialize more than once.
return 1;
}
define( 'WIKIDATA_ORG_VERSION', '0.1 alpha' );
// This is the path to the autoloader generated by composer in case of a composer install.
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
$GLOBALS['wgMessagesDirs']['Wikidata.org'] = __DIR__ . '/i18n';
$GLOBALS['wgExtensionFunctions'][] = function() {
global $wgExtensionCredits, $wgHooks, $wgResourceModules;
if ( !defined( 'WB_VERSION' ) ) {
throw new Exception( 'The Wikidata.org extension requires Wikibase to be installed.' );
}
$wgExtensionCredits['wikibase'][] = array(
'path' => __DIR__,
'name' => 'Wikidata.org',
'version' => WIKIDATA_ORG_VERSION,
'author' => '[https://www.mediawiki.org/wiki/User:Bene* Bene*]',
'url' => 'https://github.com/wmde/Wikidata.org',
'descriptionmsg' => 'wikidata-org-desc',
'license-name' => 'GPL-2.0+'
);
// Hooks
$wgHooks['BeforePageDisplay'][] = 'WikidataOrg\Hooks::onBeforePageDisplay';
$wgHooks['SkinTemplateOutputPageBeforeExec'][] =
'WikidataOrg\Hooks::onSkinTemplateOutputPageBeforeExec';
// Resource Loader modules
$wgResourceModules = array_merge(
$wgResourceModules,
include __DIR__ . '/resources/Resources.php'
);
};