forked from SemanticMediaWiki/SemanticMaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SemanticMaps.php
91 lines (71 loc) · 2.86 KB
/
SemanticMaps.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
/**
* Initialization file for the Semantic Maps extension.
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'Not an entry point.' );
}
if ( defined( 'SM_VERSION' ) ) {
// Do not initialize more than once.
return 1;
}
define( 'SM_VERSION', '3.2' );
if ( version_compare( $GLOBALS['wgVersion'], '1.19c', '<' ) ) {
throw new Exception( 'This version of Semantic Maps requires MediaWiki 1.18 or above;'
. 'use Semantic Maps 1.0.x for MediaWiki 1.17 and Semantic Maps 0.7.x for older versions.' );
}
if ( !defined( 'Maps_VERSION' ) && is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
include_once( __DIR__ . '/vendor/autoload.php' );
}
if ( !defined( 'Maps_VERSION' ) ) {
throw new Exception( 'You need to have Maps installed in order to use Semantic Maps' );
}
$GLOBALS['wgExtensionCredits']['semantic'][] = array(
'path' => __FILE__,
'name' => 'Semantic Maps',
'version' => SM_VERSION,
'author' => array(
'[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]'
),
'url' => 'https://github.com/SemanticMediaWiki/SemanticMaps/blob/master/README.md#semantic-maps',
'descriptionmsg' => 'semanticmaps-desc',
'license-name' => 'GPL-2.0+'
);
// Include the settings file.
require_once 'SM_Settings.php';
include_once __DIR__ . '/src/queryprinters/SM_QueryPrinters.php';
$GLOBALS['wgResourceModules']['ext.sm.forminputs'] = array(
'dependencies' => array( 'ext.maps.coord' ),
'localBasePath' => __DIR__ . '/src/forminputs',
'remoteExtPath' => 'SemanticMaps/src/forminputs',
'group' => 'ext.semanticmaps',
'scripts' => array(
'jquery.mapforminput.js'
),
'messages' => array(
'semanticmaps_enteraddresshere',
'semanticmaps-updatemap',
'semanticmaps_lookupcoordinates',
'semanticmaps-forminput-remove',
'semanticmaps-forminput-add',
'semanticmaps-forminput-locations'
)
);
include_once __DIR__ . '/src/services/GoogleMaps3/SM_GoogleMaps3.php';
include_once __DIR__ . '/src/services/Leaflet/SM_Leaflet.php';
$GLOBALS['wgHooks']['MappingServiceLoad'][] = function() {
MapsMappingServices::registerServiceFeature( 'openlayers', 'qp', 'SMMapPrinter' );
return true;
};
$GLOBALS['wgMessagesDirs']['SemanticMaps'] = __DIR__ . '/i18n';
$GLOBALS['wgExtensionMessagesFiles']['SemanticMaps'] = __DIR__ . '/SemanticMaps.i18n.php';
// Hook for initializing the Geographical Data types.
$GLOBALS['wgHooks']['SMW::DataType::initTypes'][] = 'SemanticMapsHooks::initGeoDataTypes';
// Hook for defining the default query printer for queries that ask for geographical coordinates.
$GLOBALS['wgHooks']['SMWResultFormat'][] = 'SemanticMapsHooks::addGeoCoordsDefaultFormat';
// Hook for adding a Semantic Maps links to the Admin Links extension.
$GLOBALS['wgHooks']['AdminLinks'][] = 'SemanticMapsHooks::addToAdminLinks';
$GLOBALS['wgHooks']['sfFormPrinterSetup'][] = 'SemanticMaps\FormInputsSetup::run';