Changeset 3181 for trunk/modules
- Timestamp:
- 07/21/2008 12:01:21 PM (4 months ago)
- Files:
-
- 1 modified
-
trunk/modules/gmaps/libraries/Gmap.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/gmaps/libraries/Gmap.php
r3180 r3181 19 19 * @return string 20 20 */ 21 public static function api_ur i($component = 'jsapi', $parameters = NULL)21 public static function api_url($component = 'jsapi', $parameters = NULL) 22 22 { 23 if (empty($parameters['key']))24 {25 // Set the API key26 $parameters['key'] = Kohana::config('gmaps.api_key');27 }28 29 23 if (empty($parameters['ie'])) 30 24 { … … 39 33 } 40 34 41 return html::specialchars('http://www.google.com/'.$component.'?'.http_build_query($parameters), FALSE); 35 if (empty($parameters['key'])) 36 { 37 // Set the API key last 38 $parameters['key'] = Kohana::config('gmaps.api_key'); 39 } 40 41 return 'http://www.google.com/'.$component.'?'.http_build_query($parameters); 42 42 } 43 43 … … 87 87 else 88 88 { 89 // Set the XML URL 90 $xml = Gmap::api_url('maps/geo', array('output' => 'xml', 'q' => rawurlencode($address))); 91 89 92 // Disable error reporting while fetching the feed 90 93 $ER = error_reporting(~E_NOTICE); 91 94 92 95 // Load the XML 93 $xml = simplexml_load_file 94 ( 95 'http://maps.google.com/maps/geo?'. 96 '&output=xml'. 97 '&oe=utf-8'. 98 '&key='.Kohana::config('gmaps.api_key'). // Get the API key 99 '&q='.rawurlencode($address) // Send the address URL encoded 100 ); 96 $xml = simplexml_load_file($xml); 101 97 102 98 if (is_object($xml) AND ($xml instanceof SimpleXMLElement) AND (int) $xml->Response->Status->code === 200) … … 163 159 } 164 160 165 return Gmap::api_ur i('staticmap', $parameters);161 return Gmap::api_url('staticmap', $parameters); 166 162 } 167 163
