Index: tags/extensions/Maps/REL_0_3_2/Maps.php |
— | — | @@ -1,208 +0,0 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Initialization file for the Maps extension.
|
6 | | - * Extension documentation: http://www.mediawiki.org/wiki/Extension:Maps
|
7 | | - *
|
8 | | - * @file Maps.php
|
9 | | - * @ingroup Maps
|
10 | | - *
|
11 | | - * @author Jeroen De Dauw
|
12 | | - */
|
13 | | -
|
14 | | -/**
|
15 | | - * This documenation group collects source code files belonging to Maps.
|
16 | | - *
|
17 | | - * Please do not use this group name for other code. If you have an extension to
|
18 | | - * Maps, please use your own group defenition.
|
19 | | - *
|
20 | | - * @defgroup Maps Maps
|
21 | | - */
|
22 | | -
|
23 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
24 | | - die( 'Not an entry point.' );
|
25 | | -}
|
26 | | -
|
27 | | -define('Maps_VERSION', '0.3.1');
|
28 | | -
|
29 | | -$egMapsScriptPath = $wgScriptPath . '/extensions/Maps';
|
30 | | -$egMapsIP = $IP . '/extensions/Maps';
|
31 | | -$egMapsIncludePath = $wgServer . $egMapsScriptPath;
|
32 | | -
|
33 | | -// Include the settings file
|
34 | | -require_once($egMapsIP . '/Maps_Settings.php');
|
35 | | -
|
36 | | -$wgExtensionFunctions[] = 'efMapsSetup';
|
37 | | -
|
38 | | -$wgExtensionMessagesFiles['Maps'] = $egMapsIP . '/Maps.i18n.php';
|
39 | | -
|
40 | | -$wgHooks['LanguageGetMagic'][] = 'efMapsFunctionMagic';
|
41 | | -$wgHooks['AdminLinks'][] = 'efMapsAddToAdminLinks';
|
42 | | -
|
43 | | -// Autoload the general classes
|
44 | | -$wgAutoloadClasses['MapsMapFeature'] = $egMapsIP . '/Maps_MapFeature.php';
|
45 | | -$wgAutoloadClasses['MapsBaseMap'] = $egMapsIP . '/Maps_BaseMap.php';
|
46 | | -$wgAutoloadClasses['MapsMapper'] = $egMapsIP . '/Maps_Mapper.php';
|
47 | | -$wgAutoloadClasses['MapsParserFunctions'] = $egMapsIP . '/Maps_ParserFunctions.php';
|
48 | | -$wgAutoloadClasses['MapsUtils'] = $egMapsIP . '/Maps_Utils.php';
|
49 | | -$wgAutoloadClasses['MapsGeocoder'] = $egMapsIP . '/Maps_Geocoder.php';
|
50 | | -$wgAutoloadClasses['MapsBaseGeocoder'] = $egMapsIP . '/Maps_BaseGeocoder.php';
|
51 | | -
|
52 | | -// TODO: document
|
53 | | -// TODO: create checks to see what components are avalable for every
|
54 | | -// service to be used in available lists and setting of default service of each component
|
55 | | -// TODO: create feature hook system?
|
56 | | -if (empty($egMapsServices)) $egMapsServices = array();
|
57 | | -
|
58 | | -$egMapsServices['googlemaps'] = array(
|
59 | | - 'pf' => array('class' => 'MapsGoogleMaps', 'file' => 'GoogleMaps/Maps_GoogleMaps.php', 'local' => true),
|
60 | | - 'classes' => array(
|
61 | | - array('class' => 'MapsGoogleMapsUtils', 'file' => 'GoogleMaps/Maps_GoogleMapsUtils.php', 'local' => true)
|
62 | | - ),
|
63 | | - 'aliases' => array('google', 'googlemap', 'gmap', 'gmaps'),
|
64 | | - 'parameters' => array(
|
65 | | - 'type' => array('map-type', 'map type'),
|
66 | | - 'types' => array('map-types', 'map types'),
|
67 | | - 'earth' => array(),
|
68 | | - 'autozoom' => array('auto zoom', 'mouse zoom', 'mousezoom'),
|
69 | | - 'class' => array(),
|
70 | | - 'style' => array()
|
71 | | - )
|
72 | | - );
|
73 | | -
|
74 | | -$egMapsServices['openlayers'] = array(
|
75 | | - 'pf' => array('class' => 'MapsOpenLayers', 'file' => 'OpenLayers/Maps_OpenLayers.php', 'local' => true),
|
76 | | - 'classes' => array(
|
77 | | - array('class' => 'MapsOpenLayersUtils', 'file' => 'OpenLayers/Maps_OpenLayersUtils.php', 'local' => true)
|
78 | | - ),
|
79 | | - 'aliases' => array('layers', 'openlayer'),
|
80 | | - 'parameters' => array(
|
81 | | - 'layers' => array(),
|
82 | | - 'baselayer' => array()
|
83 | | - )
|
84 | | - );
|
85 | | -
|
86 | | -$egMapsServices['yahoomaps'] = array(
|
87 | | - 'pf' => array('class' => 'MapsYahooMaps', 'file' => 'YahooMaps/Maps_YahooMaps.php', 'local' => true),
|
88 | | - 'classes' => array(
|
89 | | - array('class' => 'MapsYahooMapsUtils', 'file' => 'YahooMaps/Maps_YahooMapsUtils.php', 'local' => true)
|
90 | | - ),
|
91 | | - 'aliases' => array('yahoo', 'yahoomap', 'ymap', 'ymaps'),
|
92 | | - 'parameters' => array(
|
93 | | - 'type' => array('map-type'),
|
94 | | - 'types' => array('map-types', 'map types'),
|
95 | | - 'autozoom' => array('auto zoom', 'mouse zoom', 'mousezoom')
|
96 | | - )
|
97 | | - );
|
98 | | -
|
99 | | -/**
|
100 | | - * Initialization function for the Maps extension
|
101 | | - */
|
102 | | -function efMapsSetup() {
|
103 | | - global $wgExtensionCredits, $wgOut, $wgAutoloadClasses, $IP;
|
104 | | - global $egMapsDefaultService, $egMapsAvailableServices, $egMapsServices, $egMapsScriptPath, $egMapsDefaultGeoService, $egMapsAvailableGeoServices, $egMapsIP;
|
105 | | -
|
106 | | - efMapsValidateGoogleMapsKey();
|
107 | | -
|
108 | | - // Make sure the default service is one of the enabled ones
|
109 | | - $egMapsDefaultService = in_array($egMapsDefaultService, $egMapsAvailableServices) ? $egMapsDefaultService : $egMapsAvailableServices[0];
|
110 | | - $egMapsDefaultGeoService = in_array($egMapsDefaultGeoService, $egMapsAvailableGeoServices) ? $egMapsDefaultGeoService : $egMapsAvailableGeoServices[0];
|
111 | | -
|
112 | | - $services_list = implode(', ', array_keys($egMapsServices));
|
113 | | - $services_count = count( $egMapsServices );
|
114 | | -
|
115 | | - wfLoadExtensionMessages( 'Maps' );
|
116 | | -
|
117 | | - $wgExtensionCredits['parserhook'][] = array(
|
118 | | - 'path' => __FILE__,
|
119 | | - 'name' => wfMsg('maps_name'),
|
120 | | - 'version' => Maps_VERSION,
|
121 | | - 'author' => array("[http://bn2vs.com Jeroen De Dauw]", "[http://www.mediawiki.org/wiki/User:Yaron_Koren Yaron Koren]", "Robert Buzink", "Matt Williamson", "[http://www.sergeychernyshev.com Sergey Chernyshev]"),
|
122 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:Maps',
|
123 | | - 'description' => wfMsgExt( 'maps_desc', 'parsemag', $services_list, $services_count ),
|
124 | | - 'descriptionmsg' => wfMsgExt( 'maps_desc', 'parsemag', $services_list, $services_count ),
|
125 | | - );
|
126 | | -
|
127 | | - efMapsAddParserHooks();
|
128 | | -
|
129 | | - $wgOut->addScriptFile($egMapsScriptPath . '/MapUtilityFunctions.js');
|
130 | | -
|
131 | | - foreach ($egMapsServices as $serviceData) {
|
132 | | - if (array_key_exists('pf', $serviceData)) {
|
133 | | - $file = $serviceData['pf']['local'] ? $egMapsIP . '/' . $serviceData['pf']['file'] : $IP . '/extensions/' . $serviceData['pf']['file'];
|
134 | | - $wgAutoloadClasses[$serviceData['pf']['class']] = $file;
|
135 | | - }
|
136 | | -
|
137 | | - if (array_key_exists('classes', $serviceData)) {
|
138 | | - foreach($serviceData['classes'] as $class) {
|
139 | | - $file = $class['local'] ? $egMapsIP . '/' . $class['file'] : $IP . '/extensions/' . $class['file'];
|
140 | | - $wgAutoloadClasses[$class['class']] = $file;
|
141 | | - }
|
142 | | - }
|
143 | | -
|
144 | | - }
|
145 | | -}
|
146 | | -
|
147 | | -/**
|
148 | | - * Adds the parser function hooks
|
149 | | - */
|
150 | | -function efMapsAddParserHooks() {
|
151 | | - global $wgParser;
|
152 | | -
|
153 | | - // A hooks to enable the '#display_point' and '#display_points' parser functions
|
154 | | - $wgParser->setFunctionHook( 'display_point', array('MapsParserFunctions', 'displayPointRender') );
|
155 | | - $wgParser->setFunctionHook( 'display_points', array('MapsParserFunctions', 'displayPointsRender') );
|
156 | | -
|
157 | | - // A hooks to enable the '#display_adress' and '#display_adresses' parser functions
|
158 | | - $wgParser->setFunctionHook( 'display_address', array('MapsParserFunctions', 'displayAddressRender') );
|
159 | | - $wgParser->setFunctionHook( 'display_addresses', array('MapsParserFunctions', 'displayAddressesRender') );
|
160 | | -
|
161 | | - // A hook to enable the geocoder parser functions
|
162 | | - $wgParser->setFunctionHook( 'geocode', array('MapsGeocoder', 'renderGeocoder') );
|
163 | | - $wgParser->setFunctionHook( 'geocodelat' , array('MapsGeocoder', 'renderGeocoderLat') );
|
164 | | - $wgParser->setFunctionHook( 'geocodelng' , array('MapsGeocoder', 'renderGeocoderLng') );
|
165 | | -}
|
166 | | -
|
167 | | -/**
|
168 | | - * Adds the magic words for the parser functions
|
169 | | - */
|
170 | | -function efMapsFunctionMagic( &$magicWords, $langCode ) {
|
171 | | - $magicWords['display_point'] = array( 0, 'display_point' );
|
172 | | - $magicWords['display_points'] = array( 0, 'display_points' );
|
173 | | - $magicWords['display_address'] = array( 0, 'display_address' );
|
174 | | - $magicWords['display_addresses'] = array( 0, 'display_addresses' );
|
175 | | -
|
176 | | - $magicWords['geocode'] = array( 0, 'geocode' );
|
177 | | - $magicWords['geocodelat'] = array ( 0, 'geocodelat' );
|
178 | | - $magicWords['geocodelng'] = array ( 0, 'geocodelng' );
|
179 | | -
|
180 | | - return true; // Unless we return true, other parser functions won't get loaded
|
181 | | -}
|
182 | | -
|
183 | | -/**
|
184 | | - * This function ensures backward compatibility with Semantic Google Maps and other extensions
|
185 | | - * using $wgGoogleMapsKey instead of $egGoogleMapsKey.
|
186 | | - */
|
187 | | -function efMapsValidateGoogleMapsKey() {
|
188 | | - global $egGoogleMapsKey, $wgGoogleMapsKey;
|
189 | | -
|
190 | | - if (strlen($egGoogleMapsKey) < 1 && isset($wgGoogleMapsKey)) $egGoogleMapsKey = $wgGoogleMapsKey;
|
191 | | -}
|
192 | | -
|
193 | | -/**
|
194 | | - * Adds a link to Admin Links page
|
195 | | - */
|
196 | | -function efMapsAddToAdminLinks(&$admin_links_tree) {
|
197 | | - // TODO: move the documentation link to another section - and make it non dependant on SMW?
|
198 | | - $displaying_data_section = $admin_links_tree->getSection(wfMsg('smw_adminlinks_displayingdata'));
|
199 | | - // Escape if SMW hasn't added links
|
200 | | - if (is_null($displaying_data_section))
|
201 | | - return true;
|
202 | | - $smw_docu_row = $displaying_data_section->getRow('smw');
|
203 | | - wfLoadExtensionMessages('Maps');
|
204 | | - $maps_docu_label = wfMsg('adminlinks_documentation', wfMsg('maps_name'));
|
205 | | - $smw_docu_row->addItem(AlItem::newFromExternalLink("http://www.mediawiki.org/wiki/Extension:Maps", $maps_docu_label));
|
206 | | - return true;
|
207 | | -}
|
208 | | -
|
209 | | -
|
Index: tags/extensions/Maps/REL_0_3_2/Maps_Settings.php |
— | — | @@ -1,149 +0,0 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * File defining the settings for the Maps extension
|
6 | | - * More info can be found at http://www.mediawiki.org/wiki/Extension:Maps#Settings
|
7 | | - *
|
8 | | - * NOTICE:
|
9 | | - * Changing one of these settings can be done by copieng or cutting it,
|
10 | | - * and placing it in LocalSettings.php, AFTER the inclusion of Maps.
|
11 | | - *
|
12 | | - * @file Maps_Settings.php
|
13 | | - * @ingroup Maps
|
14 | | - *
|
15 | | - * @author Jeroen De Dauw
|
16 | | - */
|
17 | | -
|
18 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
19 | | - die( 'Not an entry point.' );
|
20 | | -}
|
21 | | -
|
22 | | -# API keys configuration
|
23 | | -
|
24 | | -# Your Google Maps API key. Required for displaying Google Maps, and using the Google Geocoder services.
|
25 | | -# Haven't got an API key yet? Get it here: http://code.google.com/apis/maps/signup.html
|
26 | | -if (empty($egGoogleMapsKey)) $egGoogleMapsKey = "";
|
27 | | -
|
28 | | -# Your Yahoo! Maps API key. Required for displaying Yahoo! Maps.
|
29 | | -# Haven't got an API key yet? Get it here: https://developer.yahoo.com/wsregapp/
|
30 | | -if (empty($egYahooMapsKey)) $egYahooMapsKey = "";
|
31 | | -
|
32 | | -
|
33 | | -
|
34 | | -
|
35 | | -
|
36 | | -# Map services configuration
|
37 | | -# Note: You can not use aliases in the setting. Use the main service names.
|
38 | | -
|
39 | | -# Array of String. Array containing all the mapping services that will be made available to the user.
|
40 | | -# Currently Maps provides the following services: googlemaps, yahoomaps, openlayers
|
41 | | -$egMapsAvailableServices = array('googlemaps', 'yahoomaps', 'openlayers');
|
42 | | -
|
43 | | -# String. The default mapping service, which will be used when no default service is prsent in the
|
44 | | -# $egMapsDefaultServices array for a certain feature. A service that supports all features is recommended.
|
45 | | -# This service needs to be enabled, if not, the first one from the available services will be taken.
|
46 | | -$egMapsDefaultService = 'googlemaps';
|
47 | | -
|
48 | | -# Array of String. The default mapping service for each feature, which will be used when no valid service is provided by the user.
|
49 | | -# Each service needs to be enabled, if not, the first one from the available services will be taken.
|
50 | | -# Note: The default service needs to be available for the feature you set it for, since it's used as a fallback mechanism.
|
51 | | -$egMapsDefaultServices = array('pf' => 'openlayers', 'qp' => 'yahoomaps', 'fi' => 'yahoomaps');
|
52 | | -
|
53 | | -
|
54 | | -
|
55 | | -
|
56 | | -
|
57 | | -# Geocoding services configuration
|
58 | | -
|
59 | | -# Array of String. Array containing all the geocoding services that will be made available to the user.
|
60 | | -# Currently Maps provides the following services: googlemaps, yahoomaps, openlayers
|
61 | | -$egMapsAvailableGeoServices = array('google', 'yahoo');
|
62 | | -
|
63 | | -# String. The default geocoding service, which will be used when no service is provided by the user.
|
64 | | -# This service needs to be enabled, if not, the first one from the available services will be taken.
|
65 | | -$egMapsDefaultGeoService = 'google';
|
66 | | -
|
67 | | -
|
68 | | -
|
69 | | -
|
70 | | -
|
71 | | -# General map properties configuration
|
72 | | -
|
73 | | -# Integer. The default width and height of a map. These values will only be used when the user does not provide them.
|
74 | | -$egMapsMapWidth = 600;
|
75 | | -$egMapsMapHeight = 350;
|
76 | | -
|
77 | | -# Strings. The default coordinates of the marker. This value will only be used when the user does not provide one.
|
78 | | -$egMapsMapLat = '1';
|
79 | | -$egMapsMapLon = '1';
|
80 | | -
|
81 | | -
|
82 | | -
|
83 | | -
|
84 | | -
|
85 | | -# Specific map properties configuration
|
86 | | -
|
87 | | -# Google maps
|
88 | | -
|
89 | | -# String. The Google Maps map name prefix. It can not be identical to the one of another mapping service.
|
90 | | -$egMapsGoogleMapsPrefix = 'map_google';
|
91 | | -
|
92 | | -# Integer. The default zoom of a map. This value will only be used when the user does not provide one.
|
93 | | -$egMapsGoogleMapsZoom = 14;
|
94 | | -
|
95 | | -# Array of String. The Google Maps default map types. This value will only be used when the user does not provide one.
|
96 | | -$egMapsGoogleMapsTypes = array('normal', 'satellite', 'hybrid', 'physical');
|
97 | | -
|
98 | | -# String. The default map type. This value will only be used when the user does not provide one.
|
99 | | -$egMapsGoogleMapsType = 'normal';
|
100 | | -
|
101 | | -# Boolean. The default value for enabling or disabling the autozoom of a map.
|
102 | | -# This value will only be used when the user does not provide one.
|
103 | | -$egMapsGoogleAutozoom = true;
|
104 | | -
|
105 | | -# Array of String. The default controls for Google Maps. This value will only be used when the user does not provide one.
|
106 | | -# Available values: large, small, large-original, small-original, zoom, type, type-menu, overview-map, scale, nav-label
|
107 | | -$egMapsGMapControls = array('large', 'scale', 'type');
|
108 | | -
|
109 | | -
|
110 | | -
|
111 | | -# Yahoo maps
|
112 | | -
|
113 | | -# String. The Yahoo! maps map name prefix. It can not be identical to the one of another mapping service.
|
114 | | -$egMapsYahooMapsPrefix = 'map_yahoo';
|
115 | | -
|
116 | | -# Array of String. The Google Maps default map types. This value will only be used when the user does not provide one.
|
117 | | -$egMapsYahooMapsTypes = array('normal', 'satellite', 'hybrid');
|
118 | | -
|
119 | | -# String. The default map type. This value will only be used when the user does not provide one.
|
120 | | -$egMapsYahooMapsType = 'normal';
|
121 | | -
|
122 | | -# Integer. The default zoom of a map. This value will only be used when the user does not provide one.
|
123 | | -$egMapsYahooMapsZoom = 4;
|
124 | | -
|
125 | | -# Boolean. The default value for enabling or disabling the autozoom of a map.
|
126 | | -# This value will only be used when the user does not provide one.
|
127 | | -$egMapsYahooAutozoom = true;
|
128 | | -
|
129 | | -# Array of String. The default controls for Yahoo! Maps. This value will only be used when the user does not provide one.
|
130 | | -# Available values: type, pan, zoom, zoom-short
|
131 | | -$egMapsYMapControls = array('type', 'pan', 'zoom');
|
132 | | -
|
133 | | -
|
134 | | -
|
135 | | -# OpenLayers
|
136 | | -
|
137 | | -# String. The OpenLayers map name prefix. It can not be identical to the one of another mapping service.
|
138 | | -$egMapsOpenLayersPrefix = 'open_layer';
|
139 | | -
|
140 | | -# Integer. The default zoom of a map. This value will only be used when the user does not provide one.
|
141 | | -$egMapsOpenLayersZoom = 10;
|
142 | | -
|
143 | | -# Array of String. The default controls for Open Layers. This value will only be used when the user does not provide one.
|
144 | | -# Available values: layerswitcher, mouseposition, panzoom, panzoombar, scaleline, navigation, keyboarddefaults, overviewmap, permalink
|
145 | | -# Note: panzoom and panzoombar can NOT be used together
|
146 | | -$egMapsOLControls = array('layerswitcher', 'mouseposition', 'panzoombar', 'scaleline', 'navigation');
|
147 | | -
|
148 | | -# Array of String. The default layers for Open Layers. This value will only be used when the user does not provide one.
|
149 | | -# Available values: google, bing, yahoo, openlayers, nasa
|
150 | | -$egMapsOLLayers = array('openlayers'); |
\ No newline at end of file |