From 5c6cdfa0e3912f5a4a790253568284a61e3c81d6 Mon Sep 17 00:00:00 2001 From: Proxyconcept Date: Tue, 7 Jun 2011 14:50:45 +0200 Subject: [PATCH 1/3] Skip exception if the API key is missing as it's not required with API v3 --- lib/GMapClient.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/GMapClient.class.php b/lib/GMapClient.class.php index 2cb2900..4bfbd34 100644 --- a/lib/GMapClient.class.php +++ b/lib/GMapClient.class.php @@ -177,6 +177,7 @@ public static function getAPIKeyByDomain($domain, $api_keys = null) } else { + return null; // no exception as the API key is not required with v3 API throw new sfException('No Google Map API key defined in the app.yml file of your application'); } } From 4bdd9d3d55548f38ea55e256352334ec9b91c8c3 Mon Sep 17 00:00:00 2001 From: Proxyconcept Date: Tue, 7 Jun 2011 14:59:36 +0200 Subject: [PATCH 2/3] Javascript don't like numbers with decimal separator other than a dot ! The helper force the en_US locale when writing code --- lib/helper/GMapHelper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/helper/GMapHelper.php b/lib/helper/GMapHelper.php index d528419..372a1f5 100644 --- a/lib/helper/GMapHelper.php +++ b/lib/helper/GMapHelper.php @@ -30,6 +30,9 @@ function include_map_javascript($gMap) $gMap = $gMap->getRawValue(); } + // Force locale temporarily to avoid JS code with comma in decimal numbers + $locale = setlocale(LC_NUMERIC, 0); + setlocale(LC_NUMERIC, 'en_US'); ?> Date: Tue, 7 Jun 2011 16:06:03 +0200 Subject: [PATCH 3/3] Additionnal JS_URL to load the API over HTTPS, getGoogleJsUrl() autodetect which to use --- lib/GMapClient.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/GMapClient.class.php b/lib/GMapClient.class.php index 4bfbd34..bb1017a 100644 --- a/lib/GMapClient.class.php +++ b/lib/GMapClient.class.php @@ -30,6 +30,7 @@ class GMapClient const API_URL = 'http://maps.google.com/maps/geo?'; const JS_URL = 'http://maps.google.com/maps/api/js?sensor=false'; + const JS_URL_SSL = 'https://maps-api-ssl.google.com/maps/api/js?sensor=false'; /** * @@ -267,7 +268,7 @@ public function hasCache() */ public function getGoogleJsUrl($auto_load = true, $language = null, $region = null) { - $js_url = self::JS_URL; + $js_url = sfContext::getInstance()->getRequest()->isSecure() ? self::JS_URL_SSL : self::JS_URL; if ($language !== null) {