-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWikiMaps.php
More file actions
81 lines (71 loc) · 2.9 KB
/
Copy pathWikiMaps.php
File metadata and controls
81 lines (71 loc) · 2.9 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
<?php
/*
* This file is part of the MediaWiki extension Geo
*
* VectorBeta is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* VectorBeta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Geo. If not, see <http://www.gnu.org/licenses/>.
*
* @file
* @ingroup extensions
*/
define( 'NS_MAP', 42 );
define( 'NS_MAP_TALK', 43 );
$wgExtraNamespaces[NS_MAP] = "Map";
$wgExtraNamespaces[NS_MAP_TALK] = "Map_talk";
// autoload extension classes
$autoloadClasses = array (
'GeoJSONContent' => 'includes/GeoJSONContent.php',
'GeoJSONContentHandler' => 'includes/GeoJSONContentHandler.php',
'WikiMapHelpers' => 'includes/WikiMapHelpers.php',
'WikiMapsHooks' => 'includes/WikiMaps.hooks.php',
'SpecialMap' => 'includes/specials/SpecialMap.php',
'ShareMapPhp\SVGRenderer' => 'includes/svgrenderer/SVGRenderer.php'
);
$wgSpecialPages['Map'] = 'SpecialMap';
$wgMessagesDirs['WikiMaps'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['WikiMapsAlias'] = __DIR__ . "/WikiMaps.alias.php";
/**
* Takes a string of JSON data and formats it for readability.
* @param string $json
* @return string|null: Formatted JSON or null if input was invalid.
*/
function efMapBeautifyJson( $json ) {
$decoded = FormatJson::decode( $json, true );
if ( !is_array( $decoded ) ) {
return;
}
return FormatJson::encode( $decoded, true );
}
foreach ( $autoloadClasses as $className => $classFilename ) {
$wgAutoloadClasses[$className] = __DIR__ . "/$classFilename";
}
$wgContentHandlers[ 'GeoJSON' ] = 'GeoJSONContentHandler';
$wgNamespaceContentModels[ NS_MAP ] = 'GeoJSON';
// Enable hooks
$wgHooks[ 'CodeEditorGetPageLanguage' ][] = 'WikiMapsHooks::onCodeEditorGetPageLanguage';
$wgHooks['ParserFirstCallInit'][] = 'WikiMapsHooks::onWikiMapParserInit';
$wgHooks['BeforePageDisplay'][] = 'WikiMapsHooks::onBeforePageDisplay';
// Global variables
$wgWikiMapsTileServer = 'http://{s}.tiles.mapbox.com/v3/jdlrobson.i6l7dh8b/{z}/{x}/{y}.png';
$wgWikiMapsAttribution = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://opendatacommons.org/licenses/odbl/">ODBL</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>';
$wgWikiMapsImagePath = '//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.2/images/';
// ResourceLoader modules
/**
* A boilerplate for resource loader modules
*/
$wgWikiMapsBoilerplate = array(
'localBasePath' => __DIR__,
'remoteExtPath' => 'WikiMaps',
'targets' => array( 'mobile', 'desktop' ),
);
require_once __DIR__ . "/includes/Resources.php";