Permalink
Browse files

Fixed Reverse geocode bug

  • Loading branch information...
1 parent 8076e8d commit 6c0d9c2ee79b965249dcb884627146891e7076f2 @tonydspaniard committed Dec 19, 2011
Showing with 6 additions and 8 deletions.
  1. +5 −7 extensions/EGMap/EGMapClient.php
  2. +1 −1 helpers/ECurrencyHelper/ECurrencyHelper.php
@@ -195,12 +195,10 @@ public function setGeoCodingTemplate($template)
public function getGeocodingInfo($address, $format = 'csv')
{
- $apiUrl = CChoiceFormat::format($this->geoCodingInfotemplate, array('{api}' => self::API_URL,
- '{format}' => $format,
- '{key}' => $this->getAPIKey(),
- '{address}' => urlencode($address)));
-
- $apiURL = self::API_URL . '&output=' . $format . '&key=' . $this->getAPIKey() . '&q=' . urlencode($address);
+ $apiUrl = str_replace(
+ array('{api}','{format}','{key}','{address}'),
+ array(self::API_URL, $format, $this->getAPIKey(), urlencode($address)),
+ $this->geoCodingInfotemplate);
if (function_exists('curl_version'))
{
@@ -213,7 +211,7 @@ public function getGeocodingInfo($address, $format = 'csv')
curl_close($ch);
}
else // no CUrl, try differently
- $raw_data = file_get_contents($apiURL);
+ $raw_data = file_get_contents($apiUrl);
return $raw_data;
}
@@ -421,7 +421,7 @@ private function _request($url)
*/
private function _curl_exec_follow($ch, $maxredirections = 5)
{
- if (init_get('open_basedir') == '' && ini_get('safe_mode') == 'Off')
+ if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off')
{
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $maxredirections > 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, $maxredirections);

0 comments on commit 6c0d9c2

Please sign in to comment.