r55772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55771‎ | r55772 | r55773 >
Date:16:56, 3 September 2009
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.3.4
Modified paths:
  • /trunk/extensions/Maps/Geocoders/Maps_GeonamesGeocoder.php (modified) (history)
  • /trunk/extensions/Maps/Geocoders/Maps_GoogleGeocoder.php (modified) (history)
  • /trunk/extensions/Maps/Geocoders/Maps_YahooGeocoder.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/GoogleMapFunctions.js (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsUtils.php (modified) (history)
  • /trunk/extensions/Maps/Maps.i18n.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_BaseGeocoder.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Settings.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/OpenLayerFunctions.js (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/YahooMapFunctions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/OpenLayers/OpenLayerFunctions.js
@@ -257,7 +257,6 @@
258258 return marker;
259259 }
260260
261 -
262261 function getOLMarkerData(lon, lat, title, label, icon) {
263262 lonLat = new OpenLayers.LonLat(lon, lat);
264263 return {
@@ -268,120 +267,9 @@
269268 };
270269 }
271270
272 -
273271 function initOLSettings(minWidth, minHeight) {
274272 OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
275273 OpenLayers.Util.onImageLoadErrorColor = "transparent";
276274 OpenLayers.Feature.prototype.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {'autoSize': true, 'minSize': new OpenLayers.Size(minWidth, minHeight)});
277275 }
278276
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 @@
2424 die( 'Not an entry point.' );
2525 }
2626
27 -define('Maps_VERSION', '0.3.3');
 27+define('Maps_VERSION', '0.3.4');
2828
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;
3232
3333 // Include the settings file
3434 require_once($egMapsIP . '/Maps_Settings.php');
3535
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+}
3742
3843 $wgExtensionMessagesFiles['Maps'] = $egMapsIP . '/Maps.i18n.php';
3944
@@ -40,18 +45,14 @@
4146 $wgHooks['AdminLinks'][] = 'efMapsAddToAdminLinks';
4247
4348 // 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';
5156
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?
5657 if (empty($egMapsServices)) $egMapsServices = array();
5758
5859 $egMapsServices['googlemaps'] = array(
@@ -108,15 +109,18 @@
109110 $egMapsDefaultService = in_array($egMapsDefaultService, $egMapsAvailableServices) ? $egMapsDefaultService : $egMapsAvailableServices[0];
110111 $egMapsDefaultGeoService = in_array($egMapsDefaultGeoService, $egMapsAvailableGeoServices) ? $egMapsDefaultGeoService : $egMapsAvailableGeoServices[0];
111112
112 - $services_list = implode(', ', array_keys($egMapsServices));
113 -
114113 wfLoadExtensionMessages( 'Maps' );
115114
 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+
116120 $wgExtensionCredits['parserhook'][] = array(
117121 'path' => __FILE__,
118122 'name' => wfMsg('maps_name'),
119123 '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]'),
121125 'url' => 'http://www.mediawiki.org/wiki/Extension:Maps',
122126 'description' => wfMsgExt( 'maps_desc', 'parsemag', $services_list ),
123127 'descriptionmsg' => wfMsgExt( 'maps_desc', 'parsemag', $services_list ),
@@ -140,6 +144,8 @@
141145 }
142146
143147 }
 148+
 149+ return true;
144150 }
145151
146152 /**
@@ -200,7 +206,7 @@
201207 $smw_docu_row = $displaying_data_section->getRow('smw');
202208 wfLoadExtensionMessages('Maps');
203209 $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));
205211 return true;
206212 }
207213
Index: trunk/extensions/Maps/Maps_BaseGeocoder.php
@@ -24,19 +24,80 @@
2525 */
2626 public abstract static function geocode($address);
2727
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);
3137
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);
4040
 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+ }
41102 return $result;
42103 }
43104
Index: trunk/extensions/Maps/Maps_Mapper.php
@@ -167,7 +167,7 @@
168168 */
169169 public static function createJSItemsString(array $items, array $defaultItems = null, $asStrings = true, $toLower = true) {
170170 if (count($items) < 1 && isset($defaultItems)) $items = $defaultItems;
171 - $itemString = $asStrings ? "'" . implode("','", $items) . "'" : implode(",", $items);
 171+ $itemString = $asStrings ? "'" . implode("','", $items) . "'" : implode(',', $items);
172172 if ($toLower) $itemString = strtolower($itemString);
173173 return $itemString;
174174 }
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsUtils.php
@@ -110,7 +110,7 @@
111111 /**
112112 * Add references to the Google Maps API and required JS file to the provided output
113113 *
114 - * @param unknown_type $output
 114+ * @param string $output
115115 */
116116 public static function addGMapDependencies(&$output) {
117117 global $wgJsMimeType, $wgLang;
Index: trunk/extensions/Maps/GoogleMaps/GoogleMapFunctions.js
@@ -130,63 +130,6 @@
131131
132132 return map;
133133 }
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 -}
191134
192135 function getGMarkerData(lat, lon, title, label, icon) {
193136 return {point: new GLatLng(lat, lon), title: title, label: label, icon: icon};
Index: trunk/extensions/Maps/YahooMaps/YahooMapFunctions.js
@@ -103,52 +103,6 @@
104104
105105 return map;
106106 }
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 -}
153107
154108 function getYMarkerData(lat, lon, title, label, icon) {
155109 return {point: new YGeoPoint(lat, lon), title: title, label: label, icon: icon};
Index: trunk/extensions/Maps/Maps.i18n.php
@@ -24,6 +24,10 @@
2525 The map cannot be displayed.',
2626 'maps_geocoding_failed_for' => 'The following {{PLURAL:$2|address|addresses}} could not be geocoded and {{PLURAL:$2|has|have}} been omitted from the map:
2727 $1',
 28+
 29+ 'maps_googlemaps' => 'Google Maps',
 30+ 'maps_yahoomaps' => 'Yahoo! Maps',
 31+ 'maps_openlayers' => 'OpenLayers',
2832 );
2933
3034 /** Message documentation (Message documentation)
Index: trunk/extensions/Maps/Maps_Settings.php
@@ -22,16 +22,27 @@
2323
2424 # Your Google Maps API key. Required for displaying Google Maps, and using the Google Geocoder services.
2525 # 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 = '';
2727
2828 # Your Yahoo! Maps API key. Required for displaying Yahoo! Maps.
2929 # 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 = '';
3131
3232
3333
3434
3535
 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+
3647 # Map services configuration
3748 # Note: You can not use aliases in the setting. Use the main service names.
3849
Index: trunk/extensions/Maps/Geocoders/Maps_GoogleGeocoder.php
@@ -31,7 +31,7 @@
3232 // Create the request url
3333 $requestURL = 'http://maps.google.com/maps/geo?q='.urlencode($address).'&output=csv&key='.urlencode($egGoogleMapsKey);
3434
35 - $result = self::GetCurlResponse($requestURL);
 35+ $result = self::GetResponse($requestURL);
3636
3737 //Check the Google Geocoder API Response code to ensure success
3838 if (substr($result, 0, 3) == "200") {
Index: trunk/extensions/Maps/Geocoders/Maps_GeonamesGeocoder.php
@@ -23,12 +23,12 @@
2424 */
2525 public static function geocode($address) {
2626 // 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';
2828
29 - $result = self::GetCurlResponse($requestURL);
 29+ $result = self::GetResponse($requestURL);
3030
31 - $lon = self::getXmlElementValue($result, "lng");
32 - $lat = self::getXmlElementValue($result, "lat");
 31+ $lon = self::getXmlElementValue($result, 'lng');
 32+ $lat = self::getXmlElementValue($result, 'lat');
3333
3434 // In case one of the values is not found, return false
3535 if (!$lon || !$lat) return false;
Index: trunk/extensions/Maps/Geocoders/Maps_YahooGeocoder.php
@@ -30,7 +30,7 @@
3131 // Create the request url
3232 $requestURL = "http://where.yahooapis.com/v1/places.q('".urlencode($address)."')?appid=".urlencode($egYahooMapsKey)."&format=xml";
3333
34 - $result = self::GetCurlResponse($requestURL);
 34+ $result = self::GetResponse($requestURL);
3535
3636 $lon = self::getXmlElementValue($result, "longitude");
3737 $lat = self::getXmlElementValue($result, "latitude");

Status & tagging log