-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSemanticMaps.php
More file actions
123 lines (96 loc) · 4.94 KB
/
SemanticMaps.php
File metadata and controls
123 lines (96 loc) · 4.94 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* Initialization file for the Semantic Maps extension.
*
* On MediaWiki.org: http://www.mediawiki.org/wiki/Extension:Semantic_Maps
* Official documentation: http://mapping.referata.com/wiki/Semantic_Maps
* Examples/demo's: http://mapping.referata.com/wiki/Semantic_Maps_examples
*
* @ingroup SemanticMaps
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
/**
* This documentation group collects source code files belonging to Semantic Maps.
*
* Please do not use this group name for other code. If you have an extension to
* Semantic Maps, please use your own group definition.
*
* @defgroup SemanticMaps Semantic Maps
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'Not an entry point.' );
}
if ( version_compare( $wgVersion, '1.18c', '<' ) ) {
die( '<b>Error:</b> 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.' );
}
// Show a warning if Maps is not loaded.
if ( ! defined( 'Maps_VERSION' ) ) {
die( '<b>Error:</b> You need to have <a href="https://www.mediawiki.org/wiki/Extension:Maps">Maps</a> installed in order to use <a href="https://www.mediawiki.org/wiki/Extension:Semantic Maps">Semantic Maps</a>.<br />' );
}
// Version check for SMW, which needs to be at 1.8 or greater.
if ( version_compare( Maps_VERSION, '3.0c', '<' ) ) {
die(
'<b>Error:</b> This version of Semantic Maps needs <a href="https://semantic-mediawiki.org/wiki/Maps">Maps</a> 3.0 or later.
You are currently using version ' . Maps_VERSION . '.
If for any reason you are stuck at Maps 2.0.x, you can use Semantic Maps 2.0.x instead.<br />'
);
}
// Show a warning if Semantic MediaWiki is not loaded.
if ( ! defined( 'SMW_VERSION' ) ) {
die( '<b>Error:</b> You need to have <a href="https://semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Semantic Maps">Semantic Maps</a>.<br />' );
}
// Version check for SMW, which needs to be at 1.8 or greater.
if ( version_compare( SMW_VERSION, '1.8c', '<' ) ) {
die(
'<b>Error:</b> This version of Semantic Maps needs <a href="https://semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a> 1.8 or later.
You are currently using version ' . SMW_VERSION . '.
If for any reason you are stuck at SMW 1.7.x or 1.6.x, you can use Semantic Maps 1.0.x instead.<br />'
);
}
define( 'SM_VERSION', '3.0 alpha' );
$wgExtensionCredits['semantic'][] = array(
'path' => __FILE__,
'name' => 'Semantic Maps',
'version' => SM_VERSION,
'author' => array(
'[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]'
),
'url' => 'https://www.mediawiki.org/wiki/Extension:Semantic_Maps',
'descriptionmsg' => 'semanticmaps-desc'
);
$smgScriptPath = ( $wgExtensionAssetsPath === false ? $wgScriptPath . '/extensions' : $wgExtensionAssetsPath ) . '/SemanticMaps';
$smgDir = __DIR__ . '/';
$smgStyleVersion = $wgStyleVersion . '-' . SM_VERSION;
// Include the settings file.
require_once 'SM_Settings.php';
# (named) Array of String. This array contains the available features for Maps.
# Commenting out the inclusion of any feature will make Maps completely ignore it, and so improve performance.
# Query printers
include_once $smgDir . 'includes/queryprinters/SM_QueryPrinters.php';
# Form imputs
include_once $smgDir . 'includes/forminputs/SM_FormInputs.php';
# Include the mapping services that should be loaded into Semantic Maps.
# Commenting or removing a mapping service will cause Semantic Maps to completely ignore it, and so improve performance.
# Google Maps API v3
include_once $smgDir . 'includes/services/GoogleMaps3/SM_GoogleMaps3.php';
# OpenLayers API
include_once $smgDir . 'includes/services/OpenLayers/SM_OpenLayers.php';
$wgExtensionMessagesFiles['SemanticMaps'] = $smgDir . 'SemanticMaps.i18n.php';
$incDir = __DIR__ . '/includes/';
// Data values
$wgAutoloadClasses['SMGeoCoordsValue'] = $incDir . 'SM_GeoCoordsValue.php';
$wgAutoloadClasses['SMGeoPolygonsValue'] = $incDir . 'SM_GeoPolygonsValue.php';
$wgAutoloadClasses['PolygonHandler'] = $incDir . 'SM_PolygonHandler.php';
// Value descriptions
$wgAutoloadClasses['SMGeoCoordsValueDescription'] = $incDir . 'SM_GeoCoordsValueDescription.php';
$wgAutoloadClasses['SMAreaValueDescription'] = $incDir . 'SM_AreaValueDescription.php';
$wgAutoloadClasses['SemanticMapsHooks'] = __DIR__ . '/SemanticMaps.hooks.php';
// Hook for initializing the Geographical Data types.
$wgHooks['smwInitDatatypes'][] = 'SemanticMapsHooks::initGeoDataTypes';
// Hook for defining the default query printer for queries that ask for geographical coordinates.
$wgHooks['SMWResultFormat'][] = 'SemanticMapsHooks::addGeoCoordsDefaultFormat';
// Hook for adding a Semantic Maps links to the Admin Links extension.
$wgHooks['AdminLinks'][] = 'SemanticMapsHooks::addToAdminLinks';
$wgHooks['UnitTestsList'][] = 'SemanticMapsHooks::registerUnitTests';