Index: trunk/extensions/Maps/OpenLayers/OpenLayerFunctions.js |
— | — | @@ -257,7 +257,6 @@ |
258 | 258 | return marker; |
259 | 259 | } |
260 | 260 | |
261 | | - |
262 | 261 | function getOLMarkerData(lon, lat, title, label, icon) { |
263 | 262 | lonLat = new OpenLayers.LonLat(lon, lat); |
264 | 263 | return { |
— | — | @@ -268,120 +267,9 @@ |
269 | 268 | }; |
270 | 269 | } |
271 | 270 | |
272 | | - |
273 | 271 | function initOLSettings(minWidth, minHeight) { |
274 | 272 | OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3; |
275 | 273 | OpenLayers.Util.onImageLoadErrorColor = "transparent"; |
276 | 274 | OpenLayers.Feature.prototype.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {'autoSize': true, 'minSize': new OpenLayers.Size(minWidth, minHeight)}); |
277 | 275 | } |
278 | 276 | |
279 | | -/** |
280 | | - * This function holds spesific functionallity for the Open Layers form input of Semantic Maps |
281 | | - * TODO: Refactor as much code as possible to non specific functions |
282 | | - */ |
283 | | -function makeFormInputOpenLayer(mapName, locationFieldName, lat, lon, zoom, marker_lat, marker_lon, layers, controls) { |
284 | | - var markers = Array(); |
285 | | - |
286 | | - // Show a starting marker only if marker coordinates are provided |
287 | | - if (marker_lat != null && marker_lon != null) { |
288 | | - markers.push(getOLMarkerData(marker_lon, marker_lat, '', '')); |
289 | | - } |
290 | | - |
291 | | - // Click event handler for updating the location of the marker |
292 | | - // TODO / FIXME: This will probably cause problems when used for multiple maps on one page. |
293 | | - OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { |
294 | | - defaultHandlerOptions: { |
295 | | - 'single': true, |
296 | | - 'double': false, |
297 | | - 'pixelTolerance': 0, |
298 | | - 'stopSingle': false, |
299 | | - 'stopDouble': false |
300 | | - }, |
301 | | - |
302 | | - initialize: function(options) { |
303 | | - this.handlerOptions = OpenLayers.Util.extend( |
304 | | - {}, this.defaultHandlerOptions |
305 | | - ); |
306 | | - OpenLayers.Control.prototype.initialize.apply( |
307 | | - this, arguments |
308 | | - ); |
309 | | - this.handler = new OpenLayers.Handler.Click( |
310 | | - this, { |
311 | | - 'click': this.trigger |
312 | | - }, this.handlerOptions |
313 | | - ); |
314 | | - }, |
315 | | - |
316 | | - trigger: function(e) { |
317 | | - replaceMarker(mapName, map.getLonLatFromViewPortPx(e.xy)); |
318 | | - document.getElementById(locationFieldName).value = convertLatToDMS(map.getLonLatFromViewPortPx(e.xy).lat)+', '+convertLngToDMS(map.getLonLatFromViewPortPx(e.xy).lon); |
319 | | - } |
320 | | - |
321 | | - }); |
322 | | - |
323 | | - var clickHanler = new OpenLayers.Control.Click(); |
324 | | - controls.push(clickHanler); |
325 | | - |
326 | | - var map = initOpenLayer(mapName, lon, lat, zoom, layers, controls, markers); |
327 | | - |
328 | | - // Make the map variable available for other functions |
329 | | - if (!window.OLMaps) window.OLMaps = new Object; |
330 | | - eval("window.OLMaps." + mapName + " = map;"); |
331 | | -} |
332 | | - |
333 | | - |
334 | | -/** |
335 | | - * This function holds spesific functionallity for the Open Layers form input of Semantic Maps |
336 | | - * TODO: Refactor as much code as possible to non specific functions |
337 | | - */ |
338 | | -function showOLAddress(address, mapName, outputElementName, notFoundFormat) { |
339 | | - |
340 | | - var map = OLMaps[mapName]; |
341 | | - var geocoder = new GClientGeocoder(); |
342 | | - |
343 | | - geocoder.getLatLng(address, |
344 | | - function(point) { |
345 | | - if (!point) { |
346 | | - window.alert(address + ' ' + notFoundFormat); |
347 | | - } else { |
348 | | - var loc = new OpenLayers.LonLat(point.x, point.y); |
349 | | - |
350 | | - replaceMarker(mapName, loc); |
351 | | - document.getElementById(outputElementName).value = convertLatToDMS(point.y) + ', ' + convertLngToDMS(point.x); |
352 | | - } |
353 | | - } |
354 | | - ); |
355 | | - |
356 | | -} |
357 | | - |
358 | | -/** |
359 | | - * Remove all markers from an OL map (that's in window.OLMaps), and pplace a new one. |
360 | | - * |
361 | | - * @param mapName Name of the map as in OLMaps[mapName]. |
362 | | - * @param newLocation The location for the new marker. |
363 | | - * @return |
364 | | - */ |
365 | | -function replaceMarker(mapName, newLocation) { |
366 | | - var map = OLMaps[mapName]; |
367 | | - var markerLayer = map.getLayer('markerLayer'); |
368 | | - |
369 | | - removeMarkers(markerLayer); |
370 | | - markerLayer.addMarker(getOLMarker(markerLayer, getOLMarkerData(newLocation.lon, newLocation.lat, '', ''), map.getProjectionObject())); |
371 | | - |
372 | | - map.panTo(newLocation); |
373 | | -} |
374 | | - |
375 | | -/** |
376 | | - * Removes all markers from a marker layer. |
377 | | - * |
378 | | - * @param markerLayer The layer to remove all markers from. |
379 | | - * @return |
380 | | - */ |
381 | | -function removeMarkers(markerLayer) { |
382 | | - var markerCollection = markerLayer.markers; |
383 | | - |
384 | | - for (i in markerCollection) { |
385 | | - markerLayer.removeMarker(markerCollection[i]); |
386 | | - } |
387 | | -} |
388 | | - |
Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -23,16 +23,21 @@ |
24 | 24 | die( 'Not an entry point.' ); |
25 | 25 | } |
26 | 26 | |
27 | | -define('Maps_VERSION', '0.3.3'); |
| 27 | +define('Maps_VERSION', '0.3.4'); |
28 | 28 | |
29 | | -$egMapsScriptPath = $wgScriptPath . '/extensions/Maps'; |
30 | | -$egMapsIP = $IP . '/extensions/Maps'; |
31 | | -$egMapsIncludePath = $wgServer . $egMapsScriptPath; |
| 29 | +$egMapsScriptPath = $wgScriptPath . '/extensions/Maps'; |
| 30 | +$egMapsIP = $IP . '/extensions/Maps'; |
| 31 | +$egMapsIncludePath = $wgServer . $egMapsScriptPath; |
32 | 32 | |
33 | 33 | // Include the settings file |
34 | 34 | require_once($egMapsIP . '/Maps_Settings.php'); |
35 | 35 | |
36 | | -$wgExtensionFunctions[] = 'efMapsSetup'; |
| 36 | +// Add the extensions initializing function |
| 37 | +if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
| 38 | + $wgHooks['ParserFirstCallInit'][] = 'efMapsSetup'; |
| 39 | +} else { |
| 40 | + $wgExtensionFunctions[] = 'efMapsSetup'; // Legacy support |
| 41 | +} |
37 | 42 | |
38 | 43 | $wgExtensionMessagesFiles['Maps'] = $egMapsIP . '/Maps.i18n.php'; |
39 | 44 | |
— | — | @@ -40,18 +45,14 @@ |
41 | 46 | $wgHooks['AdminLinks'][] = 'efMapsAddToAdminLinks'; |
42 | 47 | |
43 | 48 | // 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'; |
| 49 | +$wgAutoloadClasses['MapsMapFeature'] = $egMapsIP . '/Maps_MapFeature.php'; |
| 50 | +$wgAutoloadClasses['MapsBaseMap'] = $egMapsIP . '/Maps_BaseMap.php'; |
| 51 | +$wgAutoloadClasses['MapsMapper'] = $egMapsIP . '/Maps_Mapper.php'; |
| 52 | +$wgAutoloadClasses['MapsParserFunctions'] = $egMapsIP . '/Maps_ParserFunctions.php'; |
| 53 | +$wgAutoloadClasses['MapsUtils'] = $egMapsIP . '/Maps_Utils.php'; |
| 54 | +$wgAutoloadClasses['MapsGeocoder'] = $egMapsIP . '/Maps_Geocoder.php'; |
| 55 | +$wgAutoloadClasses['MapsBaseGeocoder'] = $egMapsIP . '/Maps_BaseGeocoder.php'; |
51 | 56 | |
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 | 57 | if (empty($egMapsServices)) $egMapsServices = array(); |
57 | 58 | |
58 | 59 | $egMapsServices['googlemaps'] = array( |
— | — | @@ -108,15 +109,18 @@ |
109 | 110 | $egMapsDefaultService = in_array($egMapsDefaultService, $egMapsAvailableServices) ? $egMapsDefaultService : $egMapsAvailableServices[0]; |
110 | 111 | $egMapsDefaultGeoService = in_array($egMapsDefaultGeoService, $egMapsAvailableGeoServices) ? $egMapsDefaultGeoService : $egMapsAvailableGeoServices[0]; |
111 | 112 | |
112 | | - $services_list = implode(', ', array_keys($egMapsServices)); |
113 | | - |
114 | 113 | wfLoadExtensionMessages( 'Maps' ); |
115 | 114 | |
| 115 | + // Creation of a list of internationalized service names |
| 116 | + $services = array(); |
| 117 | + foreach (array_keys($egMapsServices) as $name) $services[] = wfMsg('maps_'.$name); |
| 118 | + $services_list = implode(', ', $services); |
| 119 | + |
116 | 120 | $wgExtensionCredits['parserhook'][] = array( |
117 | 121 | 'path' => __FILE__, |
118 | 122 | 'name' => wfMsg('maps_name'), |
119 | 123 | 'version' => Maps_VERSION, |
120 | | - '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]"), |
| 124 | + '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]'), |
121 | 125 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Maps', |
122 | 126 | 'description' => wfMsgExt( 'maps_desc', 'parsemag', $services_list ), |
123 | 127 | 'descriptionmsg' => wfMsgExt( 'maps_desc', 'parsemag', $services_list ), |
— | — | @@ -140,6 +144,8 @@ |
141 | 145 | } |
142 | 146 | |
143 | 147 | } |
| 148 | + |
| 149 | + return true; |
144 | 150 | } |
145 | 151 | |
146 | 152 | /** |
— | — | @@ -200,7 +206,7 @@ |
201 | 207 | $smw_docu_row = $displaying_data_section->getRow('smw'); |
202 | 208 | wfLoadExtensionMessages('Maps'); |
203 | 209 | $maps_docu_label = wfMsg('adminlinks_documentation', wfMsg('maps_name')); |
204 | | - $smw_docu_row->addItem(AlItem::newFromExternalLink("http://www.mediawiki.org/wiki/Extension:Maps", $maps_docu_label)); |
| 210 | + $smw_docu_row->addItem(AlItem::newFromExternalLink('http://www.mediawiki.org/wiki/Extension:Maps', $maps_docu_label)); |
205 | 211 | return true; |
206 | 212 | } |
207 | 213 | |
Index: trunk/extensions/Maps/Maps_BaseGeocoder.php |
— | — | @@ -24,19 +24,80 @@ |
25 | 25 | */ |
26 | 26 | public abstract static function geocode($address); |
27 | 27 | |
28 | | - protected static function GetCurlResponse($requestURL) { |
29 | | - //Set up a CURL request, telling it not to spit back headers, and to throw out a user agent. |
30 | | - $ch = curl_init(); |
| 28 | + /** |
| 29 | + * Returns the content of the requested file, or false when the connection fails |
| 30 | + * |
| 31 | + * @param string $requestURL |
| 32 | + * @return string or false |
| 33 | + */ |
| 34 | + protected static function GetResponse($requestURL) { |
| 35 | + // Attempt to get CURL response |
| 36 | + $response = self::GetCurlResponse($requestURL); |
31 | 37 | |
32 | | - curl_setopt($ch, CURLOPT_URL, $requestURL); |
33 | | - curl_setopt($ch, CURLOPT_HEADER, 0); //Change this to a 1 to return headers |
34 | | - curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]); |
35 | | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
36 | | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
37 | | - |
38 | | - $result = curl_exec($ch); |
39 | | - curl_close($ch); |
| 38 | + // Attempt to get response using fopen when the CURL request failed |
| 39 | + if (!$response) $response = self::GetUrlResponse($requestURL); |
40 | 40 | |
| 41 | + return $response; |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * Attempts to get the contents of a file via cURL request and |
| 46 | + * returns it, or false when the attempt fails. |
| 47 | + * |
| 48 | + * @param string $requestURL |
| 49 | + * @return string or false |
| 50 | + */ |
| 51 | + protected static function GetCurlResponse($requestURL) { |
| 52 | + if (function_exists("curl_init")) { |
| 53 | + try { |
| 54 | + //Set up a CURL request, telling it not to spit back headers, and to throw out a user agent. |
| 55 | + $ch = curl_init(); |
| 56 | + |
| 57 | + curl_setopt($ch, CURLOPT_URL, $requestURL); |
| 58 | + curl_setopt($ch, CURLOPT_HEADER, 0); //Change this to a 1 to return headers |
| 59 | + curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); |
| 60 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
| 61 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 62 | + |
| 63 | + $result = curl_exec($ch); |
| 64 | + curl_close($ch); |
| 65 | + |
| 66 | + return $result; |
| 67 | + } |
| 68 | + catch(Exception $ex) { |
| 69 | + return false; |
| 70 | + } |
| 71 | + } |
| 72 | + else { |
| 73 | + return false; |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Attempts to get the contents of a file via fopen and |
| 79 | + * returns it, or false when the attempt fails. |
| 80 | + * |
| 81 | + * @param string $requestURL |
| 82 | + * @return string or false |
| 83 | + */ |
| 84 | + protected static function GetUrlResponse($requestURL) { |
| 85 | + if (function_exists('fopen')) { |
| 86 | + try { |
| 87 | + if ($handle = fopen($requestURL, 'r')) { |
| 88 | + $result = fread($handle, 10000); |
| 89 | + fclose($handle); |
| 90 | + } |
| 91 | + else { // When the request fails, return false |
| 92 | + $result = false; |
| 93 | + } |
| 94 | + } |
| 95 | + catch(Exception $ex) { |
| 96 | + $result = false; |
| 97 | + } |
| 98 | + } |
| 99 | + else { |
| 100 | + $result = false; |
| 101 | + } |
41 | 102 | return $result; |
42 | 103 | } |
43 | 104 | |
Index: trunk/extensions/Maps/Maps_Mapper.php |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | */ |
169 | 169 | public static function createJSItemsString(array $items, array $defaultItems = null, $asStrings = true, $toLower = true) { |
170 | 170 | if (count($items) < 1 && isset($defaultItems)) $items = $defaultItems; |
171 | | - $itemString = $asStrings ? "'" . implode("','", $items) . "'" : implode(",", $items); |
| 171 | + $itemString = $asStrings ? "'" . implode("','", $items) . "'" : implode(',', $items); |
172 | 172 | if ($toLower) $itemString = strtolower($itemString); |
173 | 173 | return $itemString; |
174 | 174 | } |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsUtils.php |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | /** |
112 | 112 | * Add references to the Google Maps API and required JS file to the provided output |
113 | 113 | * |
114 | | - * @param unknown_type $output |
| 114 | + * @param string $output |
115 | 115 | */ |
116 | 116 | public static function addGMapDependencies(&$output) { |
117 | 117 | global $wgJsMimeType, $wgLang; |
Index: trunk/extensions/Maps/GoogleMaps/GoogleMapFunctions.js |
— | — | @@ -130,63 +130,6 @@ |
131 | 131 | |
132 | 132 | return map; |
133 | 133 | } |
134 | | - |
135 | | -/** |
136 | | - * This function holds spesific functionallity for the Google Maps form input of Semantic Maps |
137 | | - * TODO: Refactor as much code as possible to non specific functions |
138 | | - */ |
139 | | -function makeFormInputGoogleMap(mapName, locationFieldName, width, height, lat, lon, zoom, type, types, controls, scrollWheelZoom, marker_lat, marker_lon) { |
140 | | - if (GBrowserIsCompatible()) { // TODO: This function should probably be used after the loading of the G Maps API |
141 | | - var map = createGoogleMap(document.getElementById(mapName), new GSize(width, height), new GLatLng(lat, lon), zoom, type, types, controls, scrollWheelZoom, [getGMarkerData(marker_lat, marker_lon, '', '', '')]); |
142 | | - |
143 | | - // Show a starting marker only if marker coordinates are provided |
144 | | - if (marker_lat != null && marker_lon != null) { |
145 | | - map.addOverlay(new GMarker(new GLatLng(marker_lat, marker_lon))); |
146 | | - } |
147 | | - |
148 | | - // Click event handler for updating the location of the marker |
149 | | - GEvent.addListener(map, "click", |
150 | | - function(overlay, point) { |
151 | | - if (overlay) { |
152 | | - map.removeOverlay(overlay); |
153 | | - } else { |
154 | | - map.clearOverlays(); |
155 | | - document.getElementById(locationFieldName).value = convertLatToDMS(point.y)+', '+convertLngToDMS(point.x); |
156 | | - map.addOverlay(new GMarker(point)); |
157 | | - map.panTo(point); |
158 | | - } |
159 | | - } |
160 | | - ); |
161 | | - |
162 | | - // Make the map variable available for other functions |
163 | | - if (!window.GMaps) window.GMaps = new Object; |
164 | | - eval("window.GMaps." + mapName + " = map;"); |
165 | | - } |
166 | | -} |
167 | | - |
168 | | -/** |
169 | | - * This function holds spesific functionallity for the Google Maps form input of Semantic Maps |
170 | | - * TODO: Refactor as much code as possible to non specific functions |
171 | | - */ |
172 | | -function showGAddress(address, mapName, outputElementName, notFoundFormat) { |
173 | | - var map = GMaps[mapName]; |
174 | | - var geocoder = new GClientGeocoder(); |
175 | | - |
176 | | - geocoder.getLatLng(address, |
177 | | - function(point) { |
178 | | - if (!point) { |
179 | | - window.alert(address + ' ' + notFoundFormat); |
180 | | - } else { |
181 | | - map.clearOverlays(); |
182 | | - map.setCenter(point, 14); |
183 | | - var marker = new GMarker(point); |
184 | | - map.addOverlay(marker); |
185 | | - document.getElementById(outputElementName).value = convertLatToDMS(point.y) + ', ' + convertLngToDMS(point.x); |
186 | | - } |
187 | | - } |
188 | | - ); |
189 | | - |
190 | | -} |
191 | 134 | |
192 | 135 | function getGMarkerData(lat, lon, title, label, icon) { |
193 | 136 | return {point: new GLatLng(lat, lon), title: title, label: label, icon: icon}; |
Index: trunk/extensions/Maps/YahooMaps/YahooMapFunctions.js |
— | — | @@ -103,52 +103,6 @@ |
104 | 104 | |
105 | 105 | return map; |
106 | 106 | } |
107 | | - |
108 | | -/** |
109 | | - * This function holds spesific functionallity for the Yahoo! Maps form input of Semantic Maps |
110 | | - * TODO: Refactor as much code as possible to non specific functions |
111 | | - */ |
112 | | -function makeFormInputYahooMap(mapName, locationFieldName, lat, lon, zoom, type, types, controls, scrollWheelZoom, marker_lat, marker_lon) { |
113 | | - var map = createYahooMap(document.getElementById(mapName), new YGeoPoint(lat, lon), zoom, type, types, controls, scrollWheelZoom, [getYMarkerData(marker_lat, marker_lon, '', '', '')]); |
114 | | - |
115 | | - // Show a starting marker only if marker coordinates are provided |
116 | | - if (marker_lat != null && marker_lon != null) { |
117 | | - map.addOverlay(createYMarker(new YGeoPoint(marker_lat, marker_lon))); |
118 | | - } |
119 | | - |
120 | | - // Click event handler for updating the location of the marker |
121 | | - YEvent.Capture(map, EventsList.MouseClick, |
122 | | - function(_e, point) { |
123 | | - var loc = new YGeoPoint(point.Lat, point.Lon) |
124 | | - map.removeMarkersAll(); |
125 | | - document.getElementById(locationFieldName).value = convertLatToDMS(point.Lat)+', '+convertLngToDMS(point.Lon); |
126 | | - map.addMarker(loc); |
127 | | - map.panToLatLon(loc); |
128 | | - } |
129 | | - ); |
130 | | - |
131 | | - // Make the map variable available for other functions |
132 | | - if (!window.YMaps) window.YMaps = new Object; |
133 | | - eval("window.YMaps." + mapName + " = map;"); |
134 | | -} |
135 | | - |
136 | | -/** |
137 | | - * This function holds spesific functionallity for the Yahoo! Maps form input of Semantic Maps |
138 | | - * TODO: Refactor as much code as possible to non specific functions |
139 | | - */ |
140 | | -function showYAddress(address, mapName, outputElementName, notFoundFormat) { |
141 | | - var map = YMaps[mapName]; |
142 | | - |
143 | | - map.removeMarkersAll(); |
144 | | - map.drawZoomAndCenter(address); |
145 | | - |
146 | | - YEvent.Capture(map, EventsList.onEndGeoCode, |
147 | | - function(resultObj) { |
148 | | - map.addOverlay(new YMarker(resultObj.GeoPoint)); |
149 | | - document.getElementById(outputElementName).value = convertLatToDMS(resultObj.GeoPoint.Lat) + ', ' + convertLngToDMS(resultObj.GeoPoint.Lon); |
150 | | - } |
151 | | - ); |
152 | | -} |
153 | 107 | |
154 | 108 | function getYMarkerData(lat, lon, title, label, icon) { |
155 | 109 | return {point: new YGeoPoint(lat, lon), title: title, label: label, icon: icon}; |
Index: trunk/extensions/Maps/Maps.i18n.php |
— | — | @@ -24,6 +24,10 @@ |
25 | 25 | The map cannot be displayed.', |
26 | 26 | 'maps_geocoding_failed_for' => 'The following {{PLURAL:$2|address|addresses}} could not be geocoded and {{PLURAL:$2|has|have}} been omitted from the map: |
27 | 27 | $1', |
| 28 | + |
| 29 | + 'maps_googlemaps' => 'Google Maps', |
| 30 | + 'maps_yahoomaps' => 'Yahoo! Maps', |
| 31 | + 'maps_openlayers' => 'OpenLayers', |
28 | 32 | ); |
29 | 33 | |
30 | 34 | /** Message documentation (Message documentation) |
Index: trunk/extensions/Maps/Maps_Settings.php |
— | — | @@ -22,16 +22,27 @@ |
23 | 23 | |
24 | 24 | # Your Google Maps API key. Required for displaying Google Maps, and using the Google Geocoder services. |
25 | 25 | # Haven't got an API key yet? Get it here: http://code.google.com/apis/maps/signup.html |
26 | | -if (empty($egGoogleMapsKey)) $egGoogleMapsKey = ""; |
| 26 | +if (empty($egGoogleMapsKey)) $egGoogleMapsKey = ''; |
27 | 27 | |
28 | 28 | # Your Yahoo! Maps API key. Required for displaying Yahoo! Maps. |
29 | 29 | # Haven't got an API key yet? Get it here: https://developer.yahoo.com/wsregapp/ |
30 | | -if (empty($egYahooMapsKey)) $egYahooMapsKey = ""; |
| 30 | +if (empty($egYahooMapsKey)) $egYahooMapsKey = ''; |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | |
| 36 | +# Map features configuration |
| 37 | +# (named) Array of String. This array contains the available features for Maps. |
| 38 | +# The array element name contains an abbriviation, used for code references, |
| 39 | +# and in the service data arrays, the value is the human readible version for displaying purpouses. |
| 40 | +if (empty($egMapsAvailableFeatures)) $egMapsAvailableFeatures = array(); |
| 41 | +$egMapsAvailableFeatures['pf'] = 'Parser Function'; |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
36 | 47 | # Map services configuration |
37 | 48 | # Note: You can not use aliases in the setting. Use the main service names. |
38 | 49 | |
Index: trunk/extensions/Maps/Geocoders/Maps_GoogleGeocoder.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | // Create the request url |
33 | 33 | $requestURL = 'http://maps.google.com/maps/geo?q='.urlencode($address).'&output=csv&key='.urlencode($egGoogleMapsKey); |
34 | 34 | |
35 | | - $result = self::GetCurlResponse($requestURL); |
| 35 | + $result = self::GetResponse($requestURL); |
36 | 36 | |
37 | 37 | //Check the Google Geocoder API Response code to ensure success |
38 | 38 | if (substr($result, 0, 3) == "200") { |
Index: trunk/extensions/Maps/Geocoders/Maps_GeonamesGeocoder.php |
— | — | @@ -23,12 +23,12 @@ |
24 | 24 | */ |
25 | 25 | public static function geocode($address) { |
26 | 26 | // Create the request url |
27 | | - $requestURL = "http://ws.geonames.org/search?q=". urlencode($address) ."&maxRows=1&style=SHORT"; |
| 27 | + $requestURL = 'http://ws.geonames.org/search?q='. urlencode($address) .'&maxRows=1&style=SHORT'; |
28 | 28 | |
29 | | - $result = self::GetCurlResponse($requestURL); |
| 29 | + $result = self::GetResponse($requestURL); |
30 | 30 | |
31 | | - $lon = self::getXmlElementValue($result, "lng"); |
32 | | - $lat = self::getXmlElementValue($result, "lat"); |
| 31 | + $lon = self::getXmlElementValue($result, 'lng'); |
| 32 | + $lat = self::getXmlElementValue($result, 'lat'); |
33 | 33 | |
34 | 34 | // In case one of the values is not found, return false |
35 | 35 | if (!$lon || !$lat) return false; |
Index: trunk/extensions/Maps/Geocoders/Maps_YahooGeocoder.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | // Create the request url |
32 | 32 | $requestURL = "http://where.yahooapis.com/v1/places.q('".urlencode($address)."')?appid=".urlencode($egYahooMapsKey)."&format=xml"; |
33 | 33 | |
34 | | - $result = self::GetCurlResponse($requestURL); |
| 34 | + $result = self::GetResponse($requestURL); |
35 | 35 | |
36 | 36 | $lon = self::getXmlElementValue($result, "longitude"); |
37 | 37 | $lat = self::getXmlElementValue($result, "latitude"); |