Flexible Map - Version 1.6.4

Version Description

[2013-06-14] = * fixed: can set directions=false and showdirections=true * fixed: space before colon in fr translation (thanks, mister klucha!) * added: load unminified script if SCRIPT_DEBUG is defined / true * changed: clicking directions link sets focus on From: address again * changed: bump version of Google Maps API to 3.12

Download this release

Release Info

Developer webaware
Plugin Icon 128x128 Flexible Map
Version 1.6.4
Comparing to
See all releases

Code changes from version 1.6.3 to 1.6.4

class.FlxMapPlugin.php CHANGED
@@ -86,13 +86,14 @@ class FlxMapPlugin {
86
  public function actionEnqueueScripts() {
87
  // allow others to override the Google Maps API URL
88
  $protocol = is_ssl() ? 'https' : 'http';
89
- $args = apply_filters('flexmap_google_maps_api_args', array('v' => '3.11', 'sensor' => 'false'));
90
  $apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, "$protocol://maps.google.com/maps/api/js"));
91
  if (!empty($apiURL)) {
92
  wp_register_script('google-maps', $apiURL, false, null, true);
93
  }
94
 
95
- wp_register_script('flxmap', $this->urlBase . 'flexible-map.min.js', array('google-maps'), FLXMAP_PLUGIN_VERSION, true);
 
96
 
97
  // theme writers: you can remove this stylesheet by calling wp_dequeue_script('flxmap');
98
  wp_enqueue_style('flxmap', $this->urlBase . 'styles.css', false, FLXMAP_PLUGIN_VERSION);
@@ -167,9 +168,13 @@ class FlxMapPlugin {
167
  }
168
 
169
  // test for any conditions that show directions (thus requiring the directions div)
170
- $directions = FALSE;
 
171
  if (isset($attrs['directions']) && !self::isNo($attrs['directions'])) {
172
  $directions = true;
 
 
 
173
  }
174
  if (isset($attrs['showdirections']) && self::isYes($attrs['showdirections'])) {
175
  $directions = true;
@@ -180,14 +185,9 @@ class FlxMapPlugin {
180
 
181
  // build the directions div, if required
182
  $divDirections = '';
183
- if ($directions) {
184
- if (isset($attrs['directions']) && !self::isYes($attrs['directions'])) {
185
- $divDirectionsID = self::str2js($attrs['directions']);
186
- }
187
- else {
188
- $divDirectionsID = "$divID-dir";
189
- $divDirections = "\n<div id='$divDirectionsID' class='flxmap-directions'></div>";
190
- }
191
  }
192
 
193
  $html = <<<HTML
@@ -233,8 +233,17 @@ HTML;
233
  $script .= " f.dblclickZoom = false;\n";
234
  }
235
 
 
 
 
 
 
 
 
 
 
236
  if ($directions) {
237
- $script .= " f.markerDirections = \"$divDirectionsID\";\n";
238
  }
239
 
240
  if (isset($attrs['showdirections']) && self::isYes($attrs['showdirections'])) {
@@ -245,6 +254,10 @@ HTML;
245
  $script .= " f.markerDirectionsDefault = \"{$this->str2js($attrs['directionsfrom'])}\";\n";
246
  }
247
 
 
 
 
 
248
  if (isset($attrs['maptype'])) {
249
  $script .= " f.mapTypeId = \"{$this->str2js($attrs['maptype'])}\";\n";
250
  }
86
  public function actionEnqueueScripts() {
87
  // allow others to override the Google Maps API URL
88
  $protocol = is_ssl() ? 'https' : 'http';
89
+ $args = apply_filters('flexmap_google_maps_api_args', array('v' => '3.12', 'sensor' => 'false'));
90
  $apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, "$protocol://maps.google.com/maps/api/js"));
91
  if (!empty($apiURL)) {
92
  wp_register_script('google-maps', $apiURL, false, null, true);
93
  }
94
 
95
+ $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
96
+ wp_register_script('flxmap', "{$this->urlBase}flexible-map$min.js", array('google-maps'), FLXMAP_PLUGIN_VERSION, true);
97
 
98
  // theme writers: you can remove this stylesheet by calling wp_dequeue_script('flxmap');
99
  wp_enqueue_style('flxmap', $this->urlBase . 'styles.css', false, FLXMAP_PLUGIN_VERSION);
168
  }
169
 
170
  // test for any conditions that show directions (thus requiring the directions div)
171
+ $directions = false;
172
+ $divDirectionsID = $divDirectionsID = '';
173
  if (isset($attrs['directions']) && !self::isNo($attrs['directions'])) {
174
  $directions = true;
175
+ if (!self::isYes($attrs['directions'])) {
176
+ $divDirectionsID = self::str2js($attrs['directions']);
177
+ }
178
  }
179
  if (isset($attrs['showdirections']) && self::isYes($attrs['showdirections'])) {
180
  $directions = true;
185
 
186
  // build the directions div, if required
187
  $divDirections = '';
188
+ if ($directions && empty($divDirectionsID)) {
189
+ $divDirectionsID = "$divID-dir";
190
+ $divDirections = "\n<div id='$divDirectionsID' class='flxmap-directions'></div>";
 
 
 
 
 
191
  }
192
 
193
  $html = <<<HTML
233
  $script .= " f.dblclickZoom = false;\n";
234
  }
235
 
236
+ if (isset($attrs['directions'])) {
237
+ if (self::isNo($attrs['directions'])) {
238
+ $script .= " f.markerDirections = false;\n";
239
+ }
240
+ else {
241
+ $script .= " f.markerDirections = true;\n";
242
+ }
243
+ }
244
+
245
  if ($directions) {
246
+ $script .= " f.markerDirectionsDiv = \"$divDirectionsID\";\n";
247
  }
248
 
249
  if (isset($attrs['showdirections']) && self::isYes($attrs['showdirections'])) {
254
  $script .= " f.markerDirectionsDefault = \"{$this->str2js($attrs['directionsfrom'])}\";\n";
255
  }
256
 
257
+ if (isset($attrs['directions']) && self::isNo($attrs['directions'])) {
258
+ $script .= " f.markerDirectionsInfo = false;\n";
259
+ }
260
+
261
  if (isset($attrs['maptype'])) {
262
  $script .= " f.mapTypeId = \"{$this->str2js($attrs['maptype'])}\";\n";
263
  }
flexible-map.js CHANGED
@@ -281,7 +281,7 @@ FlexibleMap.prototype = (function() {
281
  }
282
 
283
  // add a directions service if needed
284
- if (this.markerDirections) {
285
  this.startDirService(map);
286
  }
287
 
@@ -306,7 +306,7 @@ FlexibleMap.prototype = (function() {
306
  // if we're showing directions, add directions link to marker description
307
  if (self.markerDirections) {
308
  var latLng = kmlEvent.latLng,
309
- params = latLng.lat() + ',' + latLng.lng() + ",'" + encodeJS(featureData.name) + "'",
310
  a = '<br /><a href="#" data-flxmap-fix-opera="1" onclick="' + varName + '.showDirections(' + params + '); return false;">' + self.gettext("Directions") + '</a>';
311
 
312
  featureData.infoWindowHtml = featureData.infoWindowHtml.replace(/<\/div><\/div>$/i, a + "</div></div>");
@@ -399,7 +399,7 @@ FlexibleMap.prototype = (function() {
399
  a.dataTitle = this.markerTitle;
400
  addEventListener(a, "click", function(event) {
401
  stopEvent(event);
402
- self.showDirections(this.dataLatitude, this.dataLongitude, this.dataTitle);
403
  });
404
  a.appendChild(document.createTextNode(this.gettext("Directions")));
405
  element.appendChild(a);
@@ -412,7 +412,7 @@ FlexibleMap.prototype = (function() {
412
 
413
  // show directions immediately if required
414
  if (this.markerDirectionsShow) {
415
- this.showDirections(marker[0], marker[1], this.markerTitle);
416
  }
417
  }
418
 
@@ -487,7 +487,7 @@ FlexibleMap.prototype = (function() {
487
  if (!this.dirPanel) {
488
  this.dirPanel = new google.maps.DirectionsRenderer({
489
  map: map,
490
- panel: document.getElementById(this.markerDirections)
491
  });
492
  }
493
  },
@@ -497,9 +497,10 @@ FlexibleMap.prototype = (function() {
497
  * @param {Number} latitude
498
  * @param {Number} longitude
499
  * @param {String} title
 
500
  */
501
- showDirections: function(latitude, longitude, title) {
502
- var panel = document.getElementById(this.markerDirections),
503
  form = document.createElement("form"),
504
  self = this,
505
  region = this.region || '',
@@ -523,7 +524,11 @@ FlexibleMap.prototype = (function() {
523
  p.appendChild(input);
524
  form.appendChild(p);
525
  panel.appendChild(form);
526
- //~ from.focus(); // -- removed because causing problems autofocusing on elements and scrolling the page!
 
 
 
 
527
 
528
  // hack to fix IE<=7 name weirdness for dynamically created form elements;
529
  // see http://msdn.microsoft.com/en-us/library/ms534184.aspx but have a hanky ready
281
  }
282
 
283
  // add a directions service if needed
284
+ if (this.markerDirections || this.markerDirectionsShow) {
285
  this.startDirService(map);
286
  }
287
 
306
  // if we're showing directions, add directions link to marker description
307
  if (self.markerDirections) {
308
  var latLng = kmlEvent.latLng,
309
+ params = latLng.lat() + ',' + latLng.lng() + ",'" + encodeJS(featureData.name) + "',true",
310
  a = '<br /><a href="#" data-flxmap-fix-opera="1" onclick="' + varName + '.showDirections(' + params + '); return false;">' + self.gettext("Directions") + '</a>';
311
 
312
  featureData.infoWindowHtml = featureData.infoWindowHtml.replace(/<\/div><\/div>$/i, a + "</div></div>");
399
  a.dataTitle = this.markerTitle;
400
  addEventListener(a, "click", function(event) {
401
  stopEvent(event);
402
+ self.showDirections(this.dataLatitude, this.dataLongitude, this.dataTitle, true);
403
  });
404
  a.appendChild(document.createTextNode(this.gettext("Directions")));
405
  element.appendChild(a);
412
 
413
  // show directions immediately if required
414
  if (this.markerDirectionsShow) {
415
+ this.showDirections(marker[0], marker[1], this.markerTitle, false);
416
  }
417
  }
418
 
487
  if (!this.dirPanel) {
488
  this.dirPanel = new google.maps.DirectionsRenderer({
489
  map: map,
490
+ panel: document.getElementById(this.markerDirectionsDiv)
491
  });
492
  }
493
  },
497
  * @param {Number} latitude
498
  * @param {Number} longitude
499
  * @param {String} title
500
+ * @param {bool} focus [optional]
501
  */
502
+ showDirections: function(latitude, longitude, title, focus) {
503
+ var panel = document.getElementById(this.markerDirectionsDiv),
504
  form = document.createElement("form"),
505
  self = this,
506
  region = this.region || '',
524
  p.appendChild(input);
525
  form.appendChild(p);
526
  panel.appendChild(form);
527
+
528
+ // only focus when asked, to prevent problems autofocusing on elements and scrolling the page!
529
+ if (focus) {
530
+ from.focus();
531
+ }
532
 
533
  // hack to fix IE<=7 name weirdness for dynamically created form elements;
534
  // see http://msdn.microsoft.com/en-us/library/ms534184.aspx but have a hanky ready
flexible-map.min.js CHANGED
@@ -2,4 +2,4 @@
2
  JavaScript for the WordPress plugin wp-flexible-map
3
  copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
- function FlexibleMap(){var d,b,c,a=false;this.getMap=function(){return d};this.getCenter=function(){return b};this.setCenter=function(e){b=e;d.setCenter(b)};this.getKmlLayer=function(){return c};this.redrawOnce=function(){if(!a){a=true;this.redraw()}};this.showMap=function(e,f){b=new google.maps.LatLng(f[0],f[1]);d=new google.maps.Map(document.getElementById(e),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,zoomControl:this.zoomControl,draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,streetViewControl:this.streetViewControl,navigationControlOptions:this.navigationControlOptions,center:b,zoom:this.zoom});return d};this.loadKmlMap=function(e){c=new google.maps.KmlLayer(e);c.setMap(d);google.maps.event.addListenerOnce(c,"defaultviewport_changed",function(){b=c.getDefaultViewport().getCenter()});return c};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.streetViewControl=false;this.scrollwheel=false;this.draggable=true;this.dblclickZoom=true;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerHTML="";this.markerLink="";this.markerIcon="";this.markerShowInfo=true;this.markerDirections=false;this.markerDirectionsShow=false;this.markerDirectionsDefault="";this.markerAddress="";this.targetFix=true;this.navigationControlOptions={style:google.maps.NavigationControlStyle.SMALL};this.dirService=false;this.dirPanel=false;this.region="";this.locale="en";this.localeActive="en"}FlexibleMap.prototype=(function(){var d,c,b;if(document.addEventListener){d=function(f,e,g){f.addEventListener(e,g,false)};c=function(e){e.stopPropagation();e.preventDefault()};b=function(f,e){var g=document.createEvent("HTMLEvents");g.initEvent(e,true,true);f.dispatchEvent(g)}}else{if(document.attachEvent){d=function(e,f,g){e.attachEvent("on"+f,function(){g.call(e,window.event)})};c=function(e){e.cancelBubble=true;e.returnValue=0};b=function(f,e){var g=document.createEventObject();g.eventType=e;f.fireEvent("on"+e,g)}}}var a=(function(){function e(g){var h=g.charCodeAt(0),f=h.toString(16);if(h<256){return"\\x"+("00"+f).slice(-2)}return"\\u"+("0000"+f).slice(-4)}return function(f){return f.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,e)}})();return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(e){this.locale=e;if(e in this.i18n){this.localeActive=e}else{e=e.substr(0,2);if(e in this.i18n){this.localeActive=e}else{this.localeActive="en"}}return this.localeActive},gettext:function(f){var e=this.i18n[this.localeActive];if(f in e){return e[f]}return f},showKML:function(e,h,i){var g=this,f=document.getElementById(e),l=f.getAttribute("data-flxmap"),k=this.showMap(e,[0,0]),j=this.loadKmlMap(h);if(typeof i!="undefined"){google.maps.event.addListenerOnce(k,"tilesloaded",function(){k.setZoom(i);g.zoom=i})}if(this.markerDirections){this.startDirService(k)}google.maps.event.addListener(j,"click",function(r){var p=r.featureData;if(!p._flxmapOnce){p._flxmapOnce=true;if(g.targetFix){var o=/ target="_blank"/ig;p.description=p.description.replace(o,"");p.infoWindowHtml=p.infoWindowHtml.replace(o,"")}if(g.markerDirections){var n=r.latLng,q=n.lat()+","+n.lng()+",'"+a(p.name)+"'",m='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+l+".showDirections("+q+'); return false;">'+g.gettext("Directions")+"</a>";p.infoWindowHtml=p.infoWindowHtml.replace(/<\/div><\/div>$/i,m+"</div></div>")}}});if(window.opera&&this.markerDirections){d(f,"click",function(m){if(m.target.getAttribute("data-flxmap-fix-opera")){c(m)}})}},showMarker:function(h,g,m){var f=this.showMap(h,g),p=new google.maps.Marker({map:f,position:new google.maps.LatLng(m[0],m[1]),icon:this.markerIcon});if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var l,n,r,j,k,o,q=this,e=document.createElement("DIV");e.className="flxmap-infowin";p.setTitle(this.markerTitle);k=document.createElement("DIV");k.className="flxmap-marker-title";k.appendChild(document.createTextNode(this.markerTitle));e.appendChild(k);if(this.markerHTML){k=document.createElement("DIV");k.innerHTML=this.markerHTML;e.appendChild(k)}if(this.markerDescription||this.markerLink){k=document.createElement("DIV");k.className="flxmap-marker-link";if(this.markerDescription){r=this.markerDescription.split("\n");for(l=0,n=r.length;l<n;l++){if(l>0){k.appendChild(document.createElement("BR"))}k.appendChild(document.createTextNode(r[l]))}if(this.markerLink){k.appendChild(document.createElement("BR"))}}if(this.markerLink){o=document.createElement("A");o.href=this.markerLink;o.appendChild(document.createTextNode(this.gettext("Click for details")));k.appendChild(o)}e.appendChild(k)}if(this.markerDirections){k=document.createElement("DIV");k.className="flxmap-directions-link";o=document.createElement("A");o.href="#";o.dataLatitude=m[0];o.dataLongitude=m[1];o.dataTitle=this.markerTitle;d(o,"click",function(i){c(i);q.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle)});o.appendChild(document.createTextNode(this.gettext("Directions")));k.appendChild(o);e.appendChild(k)}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(f);if(this.markerDirectionsShow){this.showDirections(m[0],m[1],this.markerTitle)}}j=new google.maps.InfoWindow({content:e});if(this.markerShowInfo){google.maps.event.addListenerOnce(f,"tilesloaded",function(){j.open(f,p)})}google.maps.event.addListener(p,"click",function(){j.open(f,p)})}},showAddress:function(e,f){var g=this,h=new google.maps.Geocoder();this.markerAddress=f;if(this.markerTitle===""){this.markerTitle=f}h.geocode({address:f,region:this.region},function(k,j){if(j==google.maps.GeocoderStatus.OK){var i=k[0].geometry.location,l=[i.lat(),i.lng()];g.showMarker(e,l,l)}else{alert("Map address returns error: "+j)}})},redraw:function(){var f=this.getMap(),e=this.getKmlLayer();google.maps.event.trigger(f,"resize");if(e){f.fitBounds(e.getDefaultViewport())}else{f.setCenter(this.getCenter());f.setZoom(this.zoom)}},startDirService:function(e){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirPanel){this.dirPanel=new google.maps.DirectionsRenderer({map:e,panel:document.getElementById(this.markerDirections)})}},showDirections:function(i,e,k){var f=document.getElementById(this.markerDirections),h=document.createElement("form"),n=this,j=this.region||"",l,g,m;while(!!(g=f.lastChild)){f.removeChild(g)}g=document.createElement("p");g.appendChild(document.createTextNode(this.gettext("From")+": "));m=document.createElement("input");m.type="text";m.name="from";m.value=this.markerDirectionsDefault;g.appendChild(m);l=document.createElement("input");l.type="submit";l.value=this.gettext("Get directions");g.appendChild(l);h.appendChild(g);f.appendChild(h);if(typeof h.elements.from=="undefined"){h.elements.from=m}d(h,"submit",function(q){c(q);var r=this.elements.from.value;if(/\S/.test(r)){var o=(n.markerAddress==="")?new google.maps.LatLng(i,e):n.markerAddress,p={origin:r,region:j,destination:o,travelMode:google.maps.DirectionsTravelMode.DRIVING};n.dirService.route(p,function(u,s){var t=google.maps.DirectionsStatus;switch(s){case t.OK:n.dirPanel.setDirections(u);break;case t.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case t.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case t.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case t.INVALID_REQUEST:alert("Invalid directions request.");break;case t.NOT_FOUND:alert("Origin or destination was not found.");break;default:alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");break}})}});if(m.value){b(h,"submit")}}}})();
2
  JavaScript for the WordPress plugin wp-flexible-map
3
  copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
+ ;function FlexibleMap(){var d,b,c,a=false;this.getMap=function(){return d};this.getCenter=function(){return b};this.setCenter=function(e){b=e;d.setCenter(b)};this.getKmlLayer=function(){return c};this.redrawOnce=function(){if(!a){a=true;this.redraw()}};this.showMap=function(e,f){b=new google.maps.LatLng(f[0],f[1]);d=new google.maps.Map(document.getElementById(e),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,zoomControl:this.zoomControl,draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,streetViewControl:this.streetViewControl,navigationControlOptions:this.navigationControlOptions,center:b,zoom:this.zoom});return d};this.loadKmlMap=function(e){c=new google.maps.KmlLayer(e);c.setMap(d);google.maps.event.addListenerOnce(c,"defaultviewport_changed",function(){b=c.getDefaultViewport().getCenter()});return c};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.streetViewControl=false;this.scrollwheel=false;this.draggable=true;this.dblclickZoom=true;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerHTML="";this.markerLink="";this.markerIcon="";this.markerShowInfo=true;this.markerDirections=false;this.markerDirectionsShow=false;this.markerDirectionsDefault="";this.markerAddress="";this.targetFix=true;this.navigationControlOptions={style:google.maps.NavigationControlStyle.SMALL};this.dirService=false;this.dirPanel=false;this.region="";this.locale="en";this.localeActive="en"}FlexibleMap.prototype=(function(){var d,c,b;if(document.addEventListener){d=function(f,e,g){f.addEventListener(e,g,false)};c=function(e){e.stopPropagation();e.preventDefault()};b=function(f,e){var g=document.createEvent("HTMLEvents");g.initEvent(e,true,true);f.dispatchEvent(g)}}else{if(document.attachEvent){d=function(e,f,g){e.attachEvent("on"+f,function(){g.call(e,window.event)})};c=function(e){e.cancelBubble=true;e.returnValue=0};b=function(f,e){var g=document.createEventObject();g.eventType=e;f.fireEvent("on"+e,g)}}}var a=(function(){function e(g){var h=g.charCodeAt(0),f=h.toString(16);if(h<256){return"\\x"+("00"+f).slice(-2)}return"\\u"+("0000"+f).slice(-4)}return function(f){return f.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,e)}})();return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(e){this.locale=e;if(e in this.i18n){this.localeActive=e}else{e=e.substr(0,2);if(e in this.i18n){this.localeActive=e}else{this.localeActive="en"}}return this.localeActive},gettext:function(f){var e=this.i18n[this.localeActive];if(f in e){return e[f]}return f},showKML:function(e,h,i){var g=this,f=document.getElementById(e),l=f.getAttribute("data-flxmap"),k=this.showMap(e,[0,0]),j=this.loadKmlMap(h);if(typeof i!="undefined"){google.maps.event.addListenerOnce(k,"tilesloaded",function(){k.setZoom(i);g.zoom=i})}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(k)}google.maps.event.addListener(j,"click",function(r){var p=r.featureData;if(!p._flxmapOnce){p._flxmapOnce=true;if(g.targetFix){var o=/ target="_blank"/ig;p.description=p.description.replace(o,"");p.infoWindowHtml=p.infoWindowHtml.replace(o,"")}if(g.markerDirections){var n=r.latLng,q=n.lat()+","+n.lng()+",'"+a(p.name)+"',true",m='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+l+".showDirections("+q+'); return false;">'+g.gettext("Directions")+"</a>";p.infoWindowHtml=p.infoWindowHtml.replace(/<\/div><\/div>$/i,m+"</div></div>")}}});if(window.opera&&this.markerDirections){d(f,"click",function(m){if(m.target.getAttribute("data-flxmap-fix-opera")){c(m)}})}},showMarker:function(h,g,m){var f=this.showMap(h,g),p=new google.maps.Marker({map:f,position:new google.maps.LatLng(m[0],m[1]),icon:this.markerIcon});if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var l,n,r,j,k,o,q=this,e=document.createElement("DIV");e.className="flxmap-infowin";p.setTitle(this.markerTitle);k=document.createElement("DIV");k.className="flxmap-marker-title";k.appendChild(document.createTextNode(this.markerTitle));e.appendChild(k);if(this.markerHTML){k=document.createElement("DIV");k.innerHTML=this.markerHTML;e.appendChild(k)}if(this.markerDescription||this.markerLink){k=document.createElement("DIV");k.className="flxmap-marker-link";if(this.markerDescription){r=this.markerDescription.split("\n");for(l=0,n=r.length;l<n;l++){if(l>0){k.appendChild(document.createElement("BR"))}k.appendChild(document.createTextNode(r[l]))}if(this.markerLink){k.appendChild(document.createElement("BR"))}}if(this.markerLink){o=document.createElement("A");o.href=this.markerLink;o.appendChild(document.createTextNode(this.gettext("Click for details")));k.appendChild(o)}e.appendChild(k)}if(this.markerDirections){k=document.createElement("DIV");k.className="flxmap-directions-link";o=document.createElement("A");o.href="#";o.dataLatitude=m[0];o.dataLongitude=m[1];o.dataTitle=this.markerTitle;d(o,"click",function(i){c(i);q.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle,true)});o.appendChild(document.createTextNode(this.gettext("Directions")));k.appendChild(o);e.appendChild(k)}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(f);if(this.markerDirectionsShow){this.showDirections(m[0],m[1],this.markerTitle,false)}}j=new google.maps.InfoWindow({content:e});if(this.markerShowInfo){google.maps.event.addListenerOnce(f,"tilesloaded",function(){j.open(f,p)})}google.maps.event.addListener(p,"click",function(){j.open(f,p)})}},showAddress:function(e,f){var g=this,h=new google.maps.Geocoder();this.markerAddress=f;if(this.markerTitle===""){this.markerTitle=f}h.geocode({address:f,region:this.region},function(k,j){if(j==google.maps.GeocoderStatus.OK){var i=k[0].geometry.location,l=[i.lat(),i.lng()];g.showMarker(e,l,l)}else{alert("Map address returns error: "+j)}})},redraw:function(){var f=this.getMap(),e=this.getKmlLayer();google.maps.event.trigger(f,"resize");if(e){f.fitBounds(e.getDefaultViewport())}else{f.setCenter(this.getCenter());f.setZoom(this.zoom)}},startDirService:function(e){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirPanel){this.dirPanel=new google.maps.DirectionsRenderer({map:e,panel:document.getElementById(this.markerDirectionsDiv)})}},showDirections:function(i,e,l,o){var f=document.getElementById(this.markerDirectionsDiv),h=document.createElement("form"),n=this,j=this.region||"",k,g,m;while(!!(g=f.lastChild)){f.removeChild(g)}g=document.createElement("p");g.appendChild(document.createTextNode(this.gettext("From")+": "));m=document.createElement("input");m.type="text";m.name="from";m.value=this.markerDirectionsDefault;g.appendChild(m);k=document.createElement("input");k.type="submit";k.value=this.gettext("Get directions");g.appendChild(k);h.appendChild(g);f.appendChild(h);if(o){m.focus()}if(typeof h.elements.from=="undefined"){h.elements.from=m}d(h,"submit",function(r){c(r);var s=this.elements.from.value;if(/\S/.test(s)){var p=(n.markerAddress==="")?new google.maps.LatLng(i,e):n.markerAddress,q={origin:s,region:j,destination:p,travelMode:google.maps.DirectionsTravelMode.DRIVING};n.dirService.route(q,function(v,t){var u=google.maps.DirectionsStatus;switch(t){case u.OK:n.dirPanel.setDirections(v);break;case u.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case u.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case u.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case u.INVALID_REQUEST:alert("Invalid directions request.");break;case u.NOT_FOUND:alert("Origin or destination was not found.");break;default:alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");break}})}});if(m.value){b(h,"submit")}}}})();
flexible-map.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Flexible Map
4
  Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/
5
  Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
6
- Version: 1.6.3
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
@@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
  if (!defined('FLXMAP_PLUGIN_ROOT')) {
29
  define('FLXMAP_PLUGIN_ROOT', dirname(__FILE__) . '/');
30
  define('FLXMAP_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
31
- define('FLXMAP_PLUGIN_VERSION', '1.6.3');
32
 
33
  // shortcode tags
34
  define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
3
  Plugin Name: Flexible Map
4
  Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/
5
  Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
6
+ Version: 1.6.4
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
28
  if (!defined('FLXMAP_PLUGIN_ROOT')) {
29
  define('FLXMAP_PLUGIN_ROOT', dirname(__FILE__) . '/');
30
  define('FLXMAP_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
31
+ define('FLXMAP_PLUGIN_VERSION', '1.6.4');
32
 
33
  // shortcode tags
34
  define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
i18n/fr.js CHANGED
@@ -1,12 +1,15 @@
1
  // French
2
  // from Google Translate -- please help improve this translation
3
 
 
 
 
4
  if (typeof FlexibleMap != "undefined") {
5
 
6
  FlexibleMap.prototype.i18n["fr"] = {
7
  "Click for details" : "Cliquez pour plus de détails",
8
  "Directions" : "Itinéraire",
9
- "From" : "Lieu de départ",
10
  "Get directions" : "Itinéraire"
11
  };
12
 
1
  // French
2
  // from Google Translate -- please help improve this translation
3
 
4
+ // feedback from user:
5
+ // "space":"space", colon can't be close to text (ref http://goo.gl/A2DgH)
6
+
7
  if (typeof FlexibleMap != "undefined") {
8
 
9
  FlexibleMap.prototype.i18n["fr"] = {
10
  "Click for details" : "Cliquez pour plus de détails",
11
  "Directions" : "Itinéraire",
12
+ "From" : "Lieu de départ ",
13
  "Get directions" : "Itinéraire"
14
  };
15
 
instructions.html CHANGED
@@ -57,6 +57,8 @@ many different markers all on the one map.</p>
57
  <dd>title of the marker, displayed in a text bubble, e.g. <em>title=&quot;Adelaide Hills&quot;</em></dd>
58
  <dt>link</dt>
59
  <dd>URL to link from the marker title, e.g. <em>link=&quot;http://example.com/&quot;</em></dd>
 
 
60
  <dt>description</dt>
61
  <dd>a description of the marker location (can have HTML links), e.g. <em>description=&quot;Lorem ipsum dolor sit amet&quot;</em></dd>
62
  <dt>html</dt>
57
  <dd>title of the marker, displayed in a text bubble, e.g. <em>title=&quot;Adelaide Hills&quot;</em></dd>
58
  <dt>link</dt>
59
  <dd>URL to link from the marker title, e.g. <em>link=&quot;http://example.com/&quot;</em></dd>
60
+ <dt>icon</dt>
61
+ <dd>URL to icon for the marker, e.g. <em>icon="http://maps.google.com/mapfiles/kml/pal3/icon29.png"</em></dd>
62
  <dt>description</dt>
63
  <dd>a description of the marker location (can have HTML links), e.g. <em>description=&quot;Lorem ipsum dolor sit amet&quot;</em></dd>
64
  <dt>html</dt>
readme.txt CHANGED
@@ -6,8 +6,8 @@ Author URI: http://www.webaware.com.au/
6
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ
7
  Tags: google, map, maps, google maps, shortcode, kml
8
  Requires at least: 3.2.1
9
- Tested up to: 3.5.1
10
- Stable tag: 1.6.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -84,7 +84,7 @@ Either the center or the address paramater is required. If you provide both, the
84
  * **icon**: URL to icon for the marker, e.g. *icon="http://maps.google.com/mapfiles/kml/pal3/icon29.png"*
85
  * **description**: a description of the marker location (can have HTML links), e.g. *description="Lorem ipsum dolor sit amet"*
86
  * **html**: some simple HTML to add to the info window, e.g. *`<img src='http://example.com/logo.img' />`*
87
- * **showinfo**: show the marker's info window when the map loads, from [true, false], e.g. *showinfo="true"*; default=true <dt>html</dt>
88
  * **showdirections**: show directions when the map loads, e.g. *showdirections="true"*; default=false
89
  * **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
90
 
@@ -138,7 +138,7 @@ If Google Maps is telling you this:
138
 
139
  > The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".
140
 
141
- then something on your website is stripping the query strings on scripts. It's probably a misguided attempt to make your website more secure, and it's a dumb idea. Some so-called "security" plugins do this, and I've heard of a theme doing it too. You need to find out what is doing it and fixing it, or removing it. Start by deactivating plugins that pretend to enhance security and retest, then try switching your theme to twentytwelve to see if its the theme.
142
 
143
  = Can I add multiple markers to a map? =
144
 
@@ -175,7 +175,22 @@ When you hide the map in a tab, and then click on the tab to reveal its contents
175
  `<script>
176
  jQuery(function($) {
177
 
178
- $('div.ui-tabs').bind('tabsshow', function(event, ui) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  $("#" + ui.panel.id + " div.flxmap-container").each(function() {
180
  var flxmap = window[this.getAttribute("data-flxmap")];
181
  flxmap.redrawOnce();
@@ -238,6 +253,13 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
238
 
239
  == Changelog ==
240
 
 
 
 
 
 
 
 
241
  = 1.6.3 [2013-03-14] =
242
  * fixed: HTML description now works for address-based maps (thanks, [John Sundberg](http://profiles.wordpress.org/bhwebworks/)!)
243
 
6
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ
7
  Tags: google, map, maps, google maps, shortcode, kml
8
  Requires at least: 3.2.1
9
+ Tested up to: 3.5.2
10
+ Stable tag: 1.6.4
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
84
  * **icon**: URL to icon for the marker, e.g. *icon="http://maps.google.com/mapfiles/kml/pal3/icon29.png"*
85
  * **description**: a description of the marker location (can have HTML links), e.g. *description="Lorem ipsum dolor sit amet"*
86
  * **html**: some simple HTML to add to the info window, e.g. *`<img src='http://example.com/logo.img' />`*
87
+ * **showinfo**: show the marker's info window when the map loads, from [true, false], e.g. *showinfo="true"*; default=true <dt>html</dt>
88
  * **showdirections**: show directions when the map loads, e.g. *showdirections="true"*; default=false
89
  * **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
90
 
138
 
139
  > The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".
140
 
141
+ then something on your website is stripping the query strings on scripts. It's probably a misguided attempt to make your website more secure, and it's a dumb idea. Some so-called "security" plugins do this, and I've heard of a theme doing it too. You need to find out what is doing it and fix it, or remove it. Start by deactivating plugins that pretend to enhance security and retest, then try switching your theme to twentytwelve to see if the theme is the problem.
142
 
143
  = Can I add multiple markers to a map? =
144
 
175
  `<script>
176
  jQuery(function($) {
177
 
178
+ $("body").bind("tabsactivate", function(event, ui) {
179
+ $("#" + ui.newPanel[0].id + " div.flxmap-container").each(function() {
180
+ var flxmap = window[this.getAttribute("data-flxmap")];
181
+ flxmap.redrawOnce();
182
+ });
183
+ });
184
+
185
+ });
186
+ </script>`
187
+
188
+ For jQuery versions 1.8 or older:
189
+
190
+ `<script>
191
+ jQuery(function($) {
192
+
193
+ $("body").bind("tabsshow", function(event, ui) {
194
  $("#" + ui.panel.id + " div.flxmap-container").each(function() {
195
  var flxmap = window[this.getAttribute("data-flxmap")];
196
  flxmap.redrawOnce();
253
 
254
  == Changelog ==
255
 
256
+ = 1.6.4 [2013-06-14] =
257
+ * fixed: can set directions=false and showdirections=true
258
+ * fixed: space before colon in fr translation (thanks, [mister klucha](http://wordpress.org/support/profile/mister-klucha)!)
259
+ * added: load unminified script if SCRIPT_DEBUG is defined / true
260
+ * changed: clicking directions link sets focus on From: address again
261
+ * changed: bump version of Google Maps API to 3.12
262
+
263
  = 1.6.3 [2013-03-14] =
264
  * fixed: HTML description now works for address-based maps (thanks, [John Sundberg](http://profiles.wordpress.org/bhwebworks/)!)
265