Flexible Map - Version 1.7.2

Version Description

[2014-01-01] = * fixed: Spanish translation (thanks, edurramos!) * fixed: clean up JSHint warnings * changed: Slovenian translation refresh from Google Translate (human translators wanted!) * changed: plugin homepage, better documentation and examples, will develop as time permits!

Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.2

Files changed (8) hide show
  1. .jshintrc +14 -0
  2. class.FlxMapPlugin.php +3 -7
  3. flexible-map.js +11 -8
  4. flexible-map.min.js +1 -1
  5. flexible-map.php +2 -2
  6. i18n/es.js +4 -4
  7. i18n/sl.js +3 -3
  8. readme.txt +65 -52
.jshintrc ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "es3": true,
3
+ "immed": true,
4
+ "latedef": "nofunc",
5
+ "nonew": true,
6
+ "undef": true,
7
+ "unused": true,
8
+
9
+ // globals
10
+ "browser": true,
11
+ "globals": {
12
+ "google": false
13
+ }
14
+ }
class.FlxMapPlugin.php CHANGED
@@ -104,15 +104,11 @@ class FlxMapPlugin {
104
  * @param string $locale
105
  */
106
  protected function enqueueLocale($locale) {
107
- // check for specific locale first, e.g. 'zh-CN'
108
- if (file_exists(FLXMAP_PLUGIN_ROOT . "i18n/$locale.js")) {
109
- wp_enqueue_script('flxmap-' . $locale, $this->urlBase . "i18n/$locale.js", array('flxmap'), FLXMAP_PLUGIN_VERSION, true);
110
- }
111
- else {
112
- // not found, so check for generic locale, e.g. 'zh'
113
- $locale = substr($locale, 0, 2);
114
  if (file_exists(FLXMAP_PLUGIN_ROOT . "i18n/$locale.js")) {
115
  wp_enqueue_script('flxmap-' . $locale, $this->urlBase . "i18n/$locale.js", array('flxmap'), FLXMAP_PLUGIN_VERSION, true);
 
116
  }
117
  }
118
  }
104
  * @param string $locale
105
  */
106
  protected function enqueueLocale($locale) {
107
+ // check first for specific locale first, e.g. 'zh-CN', then for generic locale, e.g. 'zh'
108
+ foreach (array($locale, substr($locale, 0, 2)) as $locale) {
 
 
 
 
 
109
  if (file_exists(FLXMAP_PLUGIN_ROOT . "i18n/$locale.js")) {
110
  wp_enqueue_script('flxmap-' . $locale, $this->urlBase . "i18n/$locale.js", array('flxmap'), FLXMAP_PLUGIN_VERSION, true);
111
+ break;
112
  }
113
  }
114
  }
flexible-map.js CHANGED
@@ -4,6 +4,8 @@ copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
 
6
  function FlexibleMap() {
 
 
7
  // instance-private members with accessors
8
  var map, // google.maps.Map object
9
  centre, // google.maps.LatLng object for map centre
@@ -171,6 +173,7 @@ function FlexibleMap() {
171
  }
172
 
173
  FlexibleMap.prototype = (function() {
 
174
 
175
  var addEventListener, stopEvent;
176
 
@@ -466,7 +469,7 @@ FlexibleMap.prototype = (function() {
466
 
467
  // find Google link and append marker info, modern browsers only!
468
  // NB: Google link is set before initial map idle event, and reset each time the map centre changes
469
- function googleLink() { self.updateGoogleLink(); }
470
  google.maps.event.addListener(map, "idle", googleLink);
471
  google.maps.event.addListener(map, "center_changed", googleLink);
472
  google.maps.event.addListenerOnce(map, "tilesloaded", googleLink);
@@ -495,7 +498,7 @@ FlexibleMap.prototype = (function() {
495
  self.showMarker(divID, centre, centre);
496
  }
497
  else {
498
- alert("Map address returns error: " + status);
499
  }
500
  });
501
  },
@@ -655,27 +658,27 @@ FlexibleMap.prototype = (function() {
655
  break;
656
 
657
  case DirectionsStatus.ZERO_RESULTS:
658
- alert("No route could be found between the origin and destination.");
659
  break;
660
 
661
  case DirectionsStatus.OVER_QUERY_LIMIT:
662
- alert("The webpage has gone over the requests limit in too short a period of time.");
663
  break;
664
 
665
  case DirectionsStatus.REQUEST_DENIED:
666
- alert("The webpage is not allowed to use the directions service.");
667
  break;
668
 
669
  case DirectionsStatus.INVALID_REQUEST:
670
- alert("Invalid directions request.");
671
  break;
672
 
673
  case DirectionsStatus.NOT_FOUND:
674
- alert("Origin or destination was not found.");
675
  break;
676
 
677
  default:
678
- alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");
679
  break;
680
  }
681
  }
4
  */
5
 
6
  function FlexibleMap() {
7
+ "use strict";
8
+
9
  // instance-private members with accessors
10
  var map, // google.maps.Map object
11
  centre, // google.maps.LatLng object for map centre
173
  }
174
 
175
  FlexibleMap.prototype = (function() {
176
+ "use strict";
177
 
178
  var addEventListener, stopEvent;
179
 
469
 
470
  // find Google link and append marker info, modern browsers only!
471
  // NB: Google link is set before initial map idle event, and reset each time the map centre changes
472
+ var googleLink = function() { self.updateGoogleLink(); };
473
  google.maps.event.addListener(map, "idle", googleLink);
474
  google.maps.event.addListener(map, "center_changed", googleLink);
475
  google.maps.event.addListenerOnce(map, "tilesloaded", googleLink);
498
  self.showMarker(divID, centre, centre);
499
  }
500
  else {
501
+ window.alert("Map address returns error: " + status);
502
  }
503
  });
504
  },
658
  break;
659
 
660
  case DirectionsStatus.ZERO_RESULTS:
661
+ window.alert("No route could be found between the origin and destination.");
662
  break;
663
 
664
  case DirectionsStatus.OVER_QUERY_LIMIT:
665
+ window.alert("The webpage has gone over the requests limit in too short a period of time.");
666
  break;
667
 
668
  case DirectionsStatus.REQUEST_DENIED:
669
+ window.alert("The webpage is not allowed to use the directions service.");
670
  break;
671
 
672
  case DirectionsStatus.INVALID_REQUEST:
673
+ window.alert("Invalid directions request.");
674
  break;
675
 
676
  case DirectionsStatus.NOT_FOUND:
677
+ window.alert("Origin or destination was not found.");
678
  break;
679
 
680
  default:
681
+ window.alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");
682
  break;
683
  }
684
  }
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 e,c,a,d,b=false;this.getMap=function(){return e};this.getCenter=function(){return c};this.setCenter=function(f){c=f;e.setCenter(c)};this.setMarkerLocation=function(f){a=f};this.getMarkerLocation=function(){return a};this.getKmlLayer=function(){return d};this.redrawOnce=function(){if(!b){b=true;this.redraw()}};this.showMap=function(f,h){c=new google.maps.LatLng(h[0],h[1]);var i,g={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,"default":google.maps.ZoomControlStyle.DEFAULT};if(this.zoomControlStyle in g){i=g[this.zoomControlStyle]}else{i=g.small}if(this.visualRefresh){google.maps.visualRefresh=true}e=new google.maps.Map(document.getElementById(f),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:i},draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,center:c,zoom:this.zoom});return e};this.loadKmlMap=function(f){d=new google.maps.KmlLayer({map:e,url:f});google.maps.event.addListenerOnce(d,"defaultviewport_changed",function(){c=d.getDefaultViewport().getCenter()});return d};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.zoomControlStyle="small";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.dirService=false;this.dirRenderer=false;this.dirDraggable=false;this.dirSuppressMarkers=false;this.dirShowSteps=true;this.dirShowSearch=true;this.region="";this.locale="en";this.localeActive="en";this.visualRefresh=false}FlexibleMap.prototype=(function(){var c,b;if(document.addEventListener){c=function(e,d,f){e.addEventListener(d,f,false)};b=function(d){d.stopPropagation();d.preventDefault()}}else{if(document.attachEvent){c=function(d,e,f){d.attachEvent("on"+e,function(){f.call(d,window.event)})};b=function(d){d.cancelBubble=true;d.returnValue=0}}}var a=(function(){function d(f){var g=f.charCodeAt(0),e=g.toString(16);if(g<256){return"\\x"+("00"+e).slice(-2)}return"\\u"+("0000"+e).slice(-4)}return function(e){return e.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,d)}})();return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(d){this.locale=d;if(d in this.i18n){this.localeActive=d}else{d=d.substr(0,2);if(d in this.i18n){this.localeActive=d}else{this.localeActive="en"}}return this.localeActive},gettext:function(e){var d=this.i18n[this.localeActive];if(e in d){return d[e]}return e},showKML:function(d,g,h){if(typeof h!="undefined"){this.zoom=h}var f=this,e=document.getElementById(d),k=e.getAttribute("data-flxmap"),j=this.showMap(d,[0,0]),i=this.loadKmlMap(g);if(typeof h!="undefined"){google.maps.event.addListenerOnce(j,"zoom_changed",function(){j.setZoom(h);f.zoom=h})}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(j)}google.maps.event.addListener(i,"click",function(q){var o=q.featureData;if(!o._flxmapOnce){o._flxmapOnce=true;if(f.targetFix){var n=/ target="_blank"/ig;o.description=o.description.replace(n,"");o.infoWindowHtml=o.infoWindowHtml.replace(n,"")}if(f.markerDirections){var m=q.latLng,p=m.lat()+","+m.lng()+",'"+a(o.name)+"',true",l='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+k+".showDirections("+p+'); return false;">'+f.gettext("Directions")+"</a>";o.infoWindowHtml=o.infoWindowHtml.replace(/<\/div><\/div>$/i,l+"</div></div>")}}});if(window.opera&&this.markerDirections){c(e,"click",function(l){if(l.target.getAttribute("data-flxmap-fix-opera")){b(l)}})}},showMarker:function(h,g,m){var f=this.showMap(h,g),d=new google.maps.LatLng(m[0],m[1]),q=new google.maps.Marker({map:f,position:d,icon:this.markerIcon});this.setMarkerLocation(d);if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var l,n,s,j,k,p,r=this,e=document.createElement("DIV");e.className="flxmap-infowin";q.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){s=this.markerDescription.split("\n");for(l=0,n=s.length;l<n;l++){if(l>0){k.appendChild(document.createElement("BR"))}k.appendChild(document.createTextNode(s[l]))}if(this.markerLink){k.appendChild(document.createElement("BR"))}}if(this.markerLink){p=document.createElement("A");p.href=this.markerLink;p.appendChild(document.createTextNode(this.gettext("Click for details")));k.appendChild(p)}e.appendChild(k)}if(this.markerDirections){k=document.createElement("DIV");k.className="flxmap-directions-link";p=document.createElement("A");p.href="#";p.dataLatitude=m[0];p.dataLongitude=m[1];p.dataTitle=this.markerTitle;c(p,"click",function(i){b(i);r.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle,true)});p.appendChild(document.createTextNode(this.gettext("Directions")));k.appendChild(p);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,q)})}google.maps.event.addListener(q,"click",function(){j.open(f,q)});function o(){r.updateGoogleLink()}google.maps.event.addListener(f,"idle",o);google.maps.event.addListener(f,"center_changed",o);google.maps.event.addListenerOnce(f,"tilesloaded",o)}},showAddress:function(d,e){var f=this,g=new google.maps.Geocoder();this.markerAddress=e;if(this.markerTitle===""){this.markerTitle=e}g.geocode({address:e,region:this.region},function(j,i){if(i==google.maps.GeocoderStatus.OK){var h=j[0].geometry.location,k=[h.lat(),h.lng()];f.showMarker(d,k,k)}else{alert("Map address returns error: "+i)}})},updateGoogleLink:function(){if("querySelectorAll" in document){try{var l=this.getMap().getDiv(),f=this.getMarkerLocation(),h=l.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),g=0,d=h.length,j=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+f.lat()+","+f.lng());for(;g<d;g++){h[g].href+="&mrt=loc&iwloc=A&q="+j}}catch(k){}}},redraw:function(){var e=this.getMap(),d=this.getKmlLayer();google.maps.event.trigger(e,"resize");if(d){e.fitBounds(d.getDefaultViewport())}else{e.setCenter(this.getCenter());e.setZoom(this.zoom)}},startDirService:function(d){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirRenderer){this.dirRenderer=new google.maps.DirectionsRenderer({map:d,draggable:this.dirDraggable,suppressMarkers:this.dirSuppressMarkers,panel:this.dirShowSteps?document.getElementById(this.markerDirectionsDiv):null})}},showDirections:function(k,g,j,d){var e=this;function i(){var l=document.getElementById(e.markerDirectionsDiv),n=document.createElement("form"),m,o,q;while(!!(o=l.lastChild)){l.removeChild(o)}o=document.createElement("p");o.appendChild(document.createTextNode(e.gettext("From")+": "));q=document.createElement("input");q.type="text";q.name="from";q.value=e.markerDirectionsDefault;o.appendChild(q);m=document.createElement("input");m.type="submit";m.value=e.gettext("Get directions");o.appendChild(m);n.appendChild(o);l.appendChild(n);if(typeof n.elements.from=="undefined"){n.elements.from=q}if(d){q.focus()}c(n,"submit",function(p){b(p);var r=this.elements.from.value;if(/\S/.test(r)){h(r)}})}function h(n){var l=(e.markerAddress==="")?new google.maps.LatLng(k,g):e.markerAddress,m={origin:n,region:e.region||"",destination:l,travelMode:google.maps.DirectionsTravelMode.DRIVING};e.dirService.route(m,f)}function f(n,l){var m=google.maps.DirectionsStatus;switch(l){case m.OK:e.dirRenderer.setDirections(n);break;case m.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case m.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case m.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case m.INVALID_REQUEST:alert("Invalid directions request.");break;case m.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(this.markerDirectionsDiv&&this.dirShowSearch){i()}if(this.markerDirectionsDefault){h(this.markerDirectionsDefault)}}}})();
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 e,c,a,d,b=false;this.getMap=function(){return e};this.getCenter=function(){return c};this.setCenter=function(f){c=f;e.setCenter(c)};this.setMarkerLocation=function(f){a=f};this.getMarkerLocation=function(){return a};this.getKmlLayer=function(){return d};this.redrawOnce=function(){if(!b){b=true;this.redraw()}};this.showMap=function(f,h){c=new google.maps.LatLng(h[0],h[1]);var i,g={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,"default":google.maps.ZoomControlStyle.DEFAULT};if(this.zoomControlStyle in g){i=g[this.zoomControlStyle]}else{i=g.small}if(this.visualRefresh){google.maps.visualRefresh=true}e=new google.maps.Map(document.getElementById(f),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:i},draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,center:c,zoom:this.zoom});return e};this.loadKmlMap=function(f){d=new google.maps.KmlLayer({map:e,url:f});google.maps.event.addListenerOnce(d,"defaultviewport_changed",function(){c=d.getDefaultViewport().getCenter()});return d};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.zoomControlStyle="small";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.dirService=false;this.dirRenderer=false;this.dirDraggable=false;this.dirSuppressMarkers=false;this.dirShowSteps=true;this.dirShowSearch=true;this.region="";this.locale="en";this.localeActive="en";this.visualRefresh=false}FlexibleMap.prototype=(function(){var c,b;if(document.addEventListener){c=function(e,d,f){e.addEventListener(d,f,false)};b=function(d){d.stopPropagation();d.preventDefault()}}else{if(document.attachEvent){c=function(d,e,f){d.attachEvent("on"+e,function(){f.call(d,window.event)})};b=function(d){d.cancelBubble=true;d.returnValue=0}}}var a=(function(){function d(f){var g=f.charCodeAt(0),e=g.toString(16);if(g<256){return"\\x"+("00"+e).slice(-2)}return"\\u"+("0000"+e).slice(-4)}return function(e){return e.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,d)}})();return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(d){this.locale=d;if(d in this.i18n){this.localeActive=d}else{d=d.substr(0,2);if(d in this.i18n){this.localeActive=d}else{this.localeActive="en"}}return this.localeActive},gettext:function(e){var d=this.i18n[this.localeActive];if(e in d){return d[e]}return e},showKML:function(d,g,h){if(typeof h!="undefined"){this.zoom=h}var f=this,e=document.getElementById(d),k=e.getAttribute("data-flxmap"),j=this.showMap(d,[0,0]),i=this.loadKmlMap(g);if(typeof h!="undefined"){google.maps.event.addListenerOnce(j,"zoom_changed",function(){j.setZoom(h);f.zoom=h})}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(j)}google.maps.event.addListener(i,"click",function(q){var o=q.featureData;if(!o._flxmapOnce){o._flxmapOnce=true;if(f.targetFix){var n=/ target="_blank"/ig;o.description=o.description.replace(n,"");o.infoWindowHtml=o.infoWindowHtml.replace(n,"")}if(f.markerDirections){var m=q.latLng,p=m.lat()+","+m.lng()+",'"+a(o.name)+"',true",l='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+k+".showDirections("+p+'); return false;">'+f.gettext("Directions")+"</a>";o.infoWindowHtml=o.infoWindowHtml.replace(/<\/div><\/div>$/i,l+"</div></div>")}}});if(window.opera&&this.markerDirections){c(e,"click",function(l){if(l.target.getAttribute("data-flxmap-fix-opera")){b(l)}})}},showMarker:function(h,g,m){var f=this.showMap(h,g),d=new google.maps.LatLng(m[0],m[1]),q=new google.maps.Marker({map:f,position:d,icon:this.markerIcon});this.setMarkerLocation(d);if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var l,n,s,j,k,p,r=this,e=document.createElement("DIV");e.className="flxmap-infowin";q.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){s=this.markerDescription.split("\n");for(l=0,n=s.length;l<n;l++){if(l>0){k.appendChild(document.createElement("BR"))}k.appendChild(document.createTextNode(s[l]))}if(this.markerLink){k.appendChild(document.createElement("BR"))}}if(this.markerLink){p=document.createElement("A");p.href=this.markerLink;p.appendChild(document.createTextNode(this.gettext("Click for details")));k.appendChild(p)}e.appendChild(k)}if(this.markerDirections){k=document.createElement("DIV");k.className="flxmap-directions-link";p=document.createElement("A");p.href="#";p.dataLatitude=m[0];p.dataLongitude=m[1];p.dataTitle=this.markerTitle;c(p,"click",function(i){b(i);r.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle,true)});p.appendChild(document.createTextNode(this.gettext("Directions")));k.appendChild(p);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,q)})}google.maps.event.addListener(q,"click",function(){j.open(f,q)});var o=function(){r.updateGoogleLink()};google.maps.event.addListener(f,"idle",o);google.maps.event.addListener(f,"center_changed",o);google.maps.event.addListenerOnce(f,"tilesloaded",o)}},showAddress:function(d,e){var f=this,g=new google.maps.Geocoder();this.markerAddress=e;if(this.markerTitle===""){this.markerTitle=e}g.geocode({address:e,region:this.region},function(j,i){if(i==google.maps.GeocoderStatus.OK){var h=j[0].geometry.location,k=[h.lat(),h.lng()];f.showMarker(d,k,k)}else{window.alert("Map address returns error: "+i)}})},updateGoogleLink:function(){if("querySelectorAll" in document){try{var l=this.getMap().getDiv(),f=this.getMarkerLocation(),h=l.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),g=0,d=h.length,j=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+f.lat()+","+f.lng());for(;g<d;g++){h[g].href+="&mrt=loc&iwloc=A&q="+j}}catch(k){}}},redraw:function(){var e=this.getMap(),d=this.getKmlLayer();google.maps.event.trigger(e,"resize");if(d){e.fitBounds(d.getDefaultViewport())}else{e.setCenter(this.getCenter());e.setZoom(this.zoom)}},startDirService:function(d){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirRenderer){this.dirRenderer=new google.maps.DirectionsRenderer({map:d,draggable:this.dirDraggable,suppressMarkers:this.dirSuppressMarkers,panel:this.dirShowSteps?document.getElementById(this.markerDirectionsDiv):null})}},showDirections:function(k,g,j,d){var e=this;function i(){var l=document.getElementById(e.markerDirectionsDiv),n=document.createElement("form"),m,o,q;while(!!(o=l.lastChild)){l.removeChild(o)}o=document.createElement("p");o.appendChild(document.createTextNode(e.gettext("From")+": "));q=document.createElement("input");q.type="text";q.name="from";q.value=e.markerDirectionsDefault;o.appendChild(q);m=document.createElement("input");m.type="submit";m.value=e.gettext("Get directions");o.appendChild(m);n.appendChild(o);l.appendChild(n);if(typeof n.elements.from=="undefined"){n.elements.from=q}if(d){q.focus()}c(n,"submit",function(p){b(p);var r=this.elements.from.value;if(/\S/.test(r)){h(r)}})}function h(n){var l=(e.markerAddress==="")?new google.maps.LatLng(k,g):e.markerAddress,m={origin:n,region:e.region||"",destination:l,travelMode:google.maps.DirectionsTravelMode.DRIVING};e.dirService.route(m,f)}function f(n,l){var m=google.maps.DirectionsStatus;switch(l){case m.OK:e.dirRenderer.setDirections(n);break;case m.ZERO_RESULTS:window.alert("No route could be found between the origin and destination.");break;case m.OVER_QUERY_LIMIT:window.alert("The webpage has gone over the requests limit in too short a period of time.");break;case m.REQUEST_DENIED:window.alert("The webpage is not allowed to use the directions service.");break;case m.INVALID_REQUEST:window.alert("Invalid directions request.");break;case m.NOT_FOUND:window.alert("Origin or destination was not found.");break;default:window.alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");break}}if(this.markerDirectionsDiv&&this.dirShowSearch){i()}if(this.markerDirectionsDefault){h(this.markerDirectionsDefault)}}}})();
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.7.1
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
@@ -33,7 +33,7 @@ if (!defined('FLXMAP_PLUGIN_ROOT')) {
33
  if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
34
  define('FLXMAP_PLUGIN_VERSION', time());
35
  else
36
- define('FLXMAP_PLUGIN_VERSION', '1.7.1');
37
 
38
  // shortcode tags
39
  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.7.2
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
33
  if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
34
  define('FLXMAP_PLUGIN_VERSION', time());
35
  else
36
+ define('FLXMAP_PLUGIN_VERSION', '1.7.2');
37
 
38
  // shortcode tags
39
  define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
i18n/es.js CHANGED
@@ -1,13 +1,13 @@
1
  // Spanish
2
- // from Google Translate -- please help improve this translation
3
 
4
  if (typeof FlexibleMap != "undefined") {
5
 
6
  FlexibleMap.prototype.i18n["es"] = {
7
  "Click for details" : "Haga clic para más detalles",
8
- "Directions" : "Instrucciones",
9
- "From" : "Lugar de salida",
10
- "Get directions" : "Obtener direcciones"
11
  };
12
 
13
  }
1
  // Spanish
2
+ // translation by edurramos http://wordpress.org/support/profile/edurramos -- thanks!
3
 
4
  if (typeof FlexibleMap != "undefined") {
5
 
6
  FlexibleMap.prototype.i18n["es"] = {
7
  "Click for details" : "Haga clic para más detalles",
8
+ "Directions" : "Cómo llegar",
9
+ "From" : "Desde",
10
+ "Get directions" : "Obtener ruta"
11
  };
12
 
13
  }
i18n/sl.js CHANGED
@@ -4,10 +4,10 @@
4
  if (typeof FlexibleMap != "undefined") {
5
 
6
  FlexibleMap.prototype.i18n["sl"] = {
7
- "Click for details" : "Kliknite za podrobnosti",
8
- "Directions" : "smeri",
9
  "From" : "Kraj odhoda",
10
- "Get directions" : "Pridobite zemljevid navodila"
11
  };
12
 
13
  }
4
  if (typeof FlexibleMap != "undefined") {
5
 
6
  FlexibleMap.prototype.i18n["sl"] = {
7
+ "Click for details" : "Klikni za podrobnosti",
8
+ "Directions" : "Navodila",
9
  "From" : "Kraj odhoda",
10
+ "Get directions" : "Navodila za pot"
11
  };
12
 
13
  }
readme.txt CHANGED
@@ -1,17 +1,17 @@
1
  === WP Flexible Map ===
2
  Contributors: webaware
3
  Plugin Name: WP Flexible Map
4
- Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/
5
  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.6.1
10
- Stable tag: 1.7.1
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
14
- Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
15
 
16
  == Description ==
17
 
@@ -33,7 +33,7 @@ Flexible Map allows you to add Google Maps to your WordPress website.
33
  * optional directions link for info window
34
  * directions can be dropped into any div element with an ID
35
 
36
- Click to see [WP Flexible Map in action](http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/).
37
 
38
  = Sponsorships =
39
 
@@ -46,8 +46,9 @@ Thanks for sponsoring new features on WP Flexible Maps!
46
  Many thanks to the generous efforts of these people for human translations:
47
 
48
  * Dutch (nl) -- [Ivan Beemster](http://www.lijndiensten.com/)
49
- * French (fr) -- [mister klucha](http://wordpress.org/support/profile/mister-klucha)
50
  * Greek (el) -- [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)
 
51
 
52
  The initial translations for all other languages were made using Google Translate, so it's likely that some will be truly awful! Please help by editing the .js file for your language in the i18n folder, and tell me about it in the [support forum](http://wordpress.org/support/plugin/wp-flexible-map).
53
 
@@ -62,34 +63,9 @@ There are two ways to load maps with this plugin:
62
  * specify the map's coordinates or street address
63
  * specify the URL to a KML file (e.g. from Google Earth)
64
 
65
- To add a Flexible Map to a post or a page, add a shortcode [flexiblemap] and give it some useful parameters. A map can either be specified using centre coordinates or street address, or by loading a KML file.
66
 
67
- = Parameters for all maps =
68
-
69
- * **width**: width in pixels or valid CSS units, e.g. *width="100%"*
70
- * **height**: height in pixels or valid CSS units, e.g. *height="400px"*
71
- * **id**: the CSS id of the container div (instead of a random generated unique ID), e.g. *id="my_map"*
72
- * **zoom**: zoom level as an integer, larger is closer, e.g. *zoom="16"*
73
- * **maptype**: type of map to show, from [roadmap, satellite], e.g. *maptype="roadmap"*; default=roadmap
74
- * **hidemaptype**: hide the map type controls, from [true, false], e.g. *hidemaptype="true"*; default=false
75
- * **hidepanning**: hide the panning controls, from [true, false], e.g. *hidepanning="true"*; default=true
76
- * **hidezooming**: hide the zoom controls, from [true, false], e.g. *hidezooming="true"*; default=false
77
- * **hidestreetview**: hide the street view control, from [true, false], e.g. *hidestreetview="true"*; default=true
78
- * **hidescale**: hide the map scale, from [true, false], e.g. *hidescale="true"*; default=true
79
- * **zoomstyle**: which zoom control style, from [small, large, default]; default=small
80
- * **scrollwheel**: enable zoom with mouse scroll wheel, from [true, false], e.g. *scrollwheel="true"*; default=false
81
- * **draggable**: enable dragging to pan, from [true, false], e.g. *draggable="true"*; default=true
82
- * **dblclickzoom**: enable double-clicking to zoom, from [true, false], e.g. *dblclickzoom="true"*; default=true
83
- * **directions**: show directions link in text bubble; by default, directions will be displayed underneath map, but you can specify the element ID for directions here, e.g. *directions="true", directions="my-dir-id"*; default=false
84
- * **dirdraggable**: allow directions to be draggable, from [true, false]; default=false
85
- * **dirnomarkers**: suppress start and end markers when showing directions, from [true, false]; default=false
86
- * **dirshowsteps**: show or suppress directions steps when showing directions, from [true, false]; default=true
87
- * **dirshowssearch**: show or suppress directions search form when showing directions, from [true, false]; default=true
88
- * **region**: specify region to help localise address searches for street address map and directions, taken from the list of [ccTLD](http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains) (without the .), e.g. *region="au"*
89
- * **locale**: use a specific locale (language) for messages like the text of the Directions link, e.g. *locale="nl-BE"*
90
- * **visualrefresh**: enable [visual refresh](https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh); NB: affects all maps on the page! from [true, false]; default=false
91
-
92
- = Additional parameters for centre coordinates or street address map =
93
 
94
  Either the center or the address paramater is required. If you provide both, the centre coordinates will be used for the map centre, but directions will use the street address. (This will prevent directions from telling people how to get to the destination opposite yours!)
95
 
@@ -101,9 +77,7 @@ Either the center or the address paramater is required. If you provide both, the
101
  * **icon**: URL to icon for the marker, e.g. *icon="http://maps.google.com/mapfiles/kml/pal3/icon29.png"*
102
  * **description**: a description of the marker location (can have HTML links), e.g. *description="Lorem ipsum dolor sit amet"*
103
  * **html**: some simple HTML to add to the info window, e.g. *`<img src='http://example.com/logo.img' />`*
104
- * **showinfo**: show the marker's info window when the map loads, from [true, false], e.g. *showinfo="true"*; default=true <dt>html</dt>
105
- * **showdirections**: show directions when the map loads, e.g. *showdirections="true"*; default=false
106
- * **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
107
 
108
  *Samples*:
109
  `[flexiblemap center="-34.916721,138.828878" width="100%" height="400px" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]
@@ -111,7 +85,7 @@ Either the center or the address paramater is required. If you provide both, the
111
  [flexiblemap center="-32.891058,151.538042" title="Mount Sugarloaf" directions="true"]
112
  [flexiblemap center="-32.918827,151.806164" title="Nobby's Head" directions="my-dir-div"]`
113
 
114
- = Additional parameters for KML map =
115
 
116
  * **src**: the URL for a KML file to load map details from, e.g. *src="http://example.com/map.kml"*
117
  * **targetfix**: prevent links from opening in new window, from [true, false], e.g. *targetfix="true"*; default=true
@@ -119,9 +93,36 @@ Either the center or the address paramater is required. If you provide both, the
119
  *Sample*:
120
  `[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="100%" height="400px"]`
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  = Calling from templates or plugins =
123
 
124
- There is a PHP function `flexmap_show_map()` for theme and plugin developers. All of the same parameters for the shortcode can be passed to the function in an associative array. If you want it to return the map as a string without output to screen, add "echo"=>"false" to array of attributes.
125
 
126
  *Sample*:
127
  `flexmap_show_map(array(
@@ -145,7 +146,7 @@ There are also some filter hooks that allow you to change the behaviour of the p
145
  * **flexmap_shortcode_styles**: filter the array of inline styles applied to the div wrapping the map, e.g. remove width and height so that it can be specified in the theme's stylesheets
146
  * **flexmap_shortcode_html**: filter the generated html, e.g. wrap another div around it, add a link to Google Maps, add some additonal script, etc.
147
 
148
- For more information and examples, see [the website](http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/).
149
 
150
  == Frequently Asked Questions ==
151
 
@@ -157,6 +158,12 @@ If Google Maps is telling you this:
157
 
158
  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.
159
 
 
 
 
 
 
 
160
  = Can I add multiple markers to a map? =
161
 
162
  Using a KML file, you can have as many markers on a map as you like, with as much detail in the info windows. With KML you can also change marker icons and add other nice features. You can generate your KML file from an application like Google Earth, or you can create it yourself (in a text editor or with your own programming). [Learn more about KML](https://developers.google.com/kml/).
@@ -169,9 +176,9 @@ Google Maps API caches the KML file, so it often won't get your new changes. To
169
 
170
  The Google Maps API supports many commonly used KML elements, but has some restrictions. Read about [Google Maps support for KML](https://developers.google.com/kml/documentation/mapsSupport) in the developers' guide, and also see the list of [KML elements supported in Google Maps](https://developers.google.com/kml/documentation/kmlelementsinmaps).
171
 
172
- = Why won't the map show my place when I use the address parameter? =
173
 
174
- When you use a street address instead of centre coordinates, you are effectively searching Google Maps for your location. Try being very specific about your address, including your town / city, state / province, and country to make sure Google can find where you mean. You can also specify your region with the `region` parameter to help Google Maps refine its search. If the marker is still in the wrong place, you might need to specify the location using centre coordinates instead.
175
 
176
  = How can I use centre coordinates for the map and have directions to my address? =
177
 
@@ -179,7 +186,7 @@ When you use just centre coordinates for your map, the directions may send peopl
179
 
180
  = How do I get the maps to use my language? =
181
 
182
- Since version 1.1.0, this plugin now uses localised messages for things like the Directions link and the default message on links in info windows. If you have your [WordPress installation set to use your language](http://codex.wordpress.org/WordPress_in_Your_Language), the plugin should automatically pick it up. If you need to force it to pick up your language (or want to offer a different language), use the `locale` parameter, e.g. `locale="ru"` or `locale="zh-TW"`.
183
 
184
  Google Maps will use the locale information from your web browser to help display maps and directions in your language (see your browser's language settings). If you want to force the Google Maps language for every map on a page, you can use a filter hook. For example, here's how to force the Google Maps language to match the language of the page / post its on (e.g. when using WPML translated content):
185
 
@@ -265,7 +272,7 @@ To make it load locale scripts as well, e.g. for French and Chinese language tex
265
 
266
  `flexmap_load_scripts(array('fr', 'zh'));`
267
 
268
- The plugin will detect when AJAX is being used via the [WordPress standard method](http://codex.wordpress.org/AJAX_in_Plugins), and adjust accordingly (but you still need to load the scripts as above). If another method is used, add `isajax='true'` to the shortcode parameters.
269
 
270
  NB: currently, only AJAX methods that parse script tags will work correctly; this includes some [jQuery methods](http://stackoverflow.com/q/2203762/911083) (but [not all](http://stackoverflow.com/a/2699905/911083)). A future version of the plugin will be more AJAX friendly.
271
 
@@ -279,6 +286,12 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
279
 
280
  == Changelog ==
281
 
 
 
 
 
 
 
282
  = 1.7.1 [2013-10-13] =
283
  * fixed: Google link was showing marker at centre, not at marker location when marker != centre
284
 
@@ -288,16 +301,16 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
288
  * fixed: KML map zoom sometimes doesn't happen on first page visit
289
  * fixed: some themes (e.g. twentythirteen) mess up Google Maps directions markers
290
  * fixed: Google link opens maps without marker (NB: <= IE8 not supported)
291
- * added: `dirshowsteps` parameter, to allow directions steps (i.e. turn-by-turn steps) to be turned off
292
- * added: `dirshowssearch` parameter, to allow directions search form to be turned off
293
- * added: `zoomstyle` parameter, to allow large or small zoom controls
294
- * added: `visualrefresh` parameter, to enable [visual refresh](https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh) for all maps on the page
295
  * added: default CSS sets info window text color to #333
296
  * changed: bump version of Google Maps API to 3.13
297
 
298
  = 1.6.5 [2013-07-19] =
299
  * fixed: stop twentythirteen theme stuffing up Google Maps infowindows with its too-promiscuous box-sizing rules
300
- * added: `dirdraggable` and `dirnomarkers` parameters
301
 
302
  = 1.6.4 [2013-06-14] =
303
  * fixed: can set directions=false and showdirections=true
@@ -311,7 +324,7 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
311
 
312
  = 1.6.2 [2013-03-04] =
313
  * fixed: CSS fix for themes that muck up Google Maps images by specifying background colour on images without being selective
314
- * added: icon parameter to set marker icon on centre / address maps
315
 
316
  = 1.6.1 [2013-01-29] =
317
  * fixed: infowindow auto-pans on load, to prevent the top of the bubble being cropped
@@ -326,7 +339,7 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
326
  * fixed: no auto-focus on directions search field, thus no auto-scroll page to last directions search field!
327
 
328
  = 1.5.3 [2012-11-30] =
329
- * fixed: when parameters showdirections or directionsfrom were specified, but not directions, the directions panel was not added to page and a JavaScript error was generated
330
  * changed: bump version of Google Maps API to 3.10
331
 
332
  = 1.5.2 [2012-10-12] =
@@ -390,8 +403,8 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
390
  * fixed: tied Google Maps API to v3.8 so newer versions don't break plugin, and will keep updated as API changes
391
 
392
  = 1.0.2 [2012-02-04] =
393
- * added: address parameter as alternative to center coordinates
394
- * added: use address parameter for directions, if given (so that directions match address)
395
  * changed: readme improved a little
396
  * changed: refactored code for DRY (don't repeat yourself)
397
 
1
  === WP Flexible Map ===
2
  Contributors: webaware
3
  Plugin Name: WP Flexible Map
4
+ Plugin URI: http://flexible-map.webaware.net.au/
5
  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.8
10
+ Stable tag: 1.7.2
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
14
+ Embed Google Maps in pages and posts, either by centre coordinates or street address, or by URL to a Google Earth KML file.
15
 
16
  == Description ==
17
 
33
  * optional directions link for info window
34
  * directions can be dropped into any div element with an ID
35
 
36
+ Click to see [WP Flexible Map in action](http://flexible-map.webaware.net.au/).
37
 
38
  = Sponsorships =
39
 
46
  Many thanks to the generous efforts of these people for human translations:
47
 
48
  * Dutch (nl) -- [Ivan Beemster](http://www.lijndiensten.com/)
49
+ * French (fr) -- [mister klucha](http://profiles.wordpress.org/mister-klucha/)
50
  * Greek (el) -- [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)
51
+ * Spanish (es) -- [edurramos](http://profiles.wordpress.org/edurramos/)
52
 
53
  The initial translations for all other languages were made using Google Translate, so it's likely that some will be truly awful! Please help by editing the .js file for your language in the i18n folder, and tell me about it in the [support forum](http://wordpress.org/support/plugin/wp-flexible-map).
54
 
63
  * specify the map's coordinates or street address
64
  * specify the URL to a KML file (e.g. from Google Earth)
65
 
66
+ To add a Flexible Map to a post or a page, add a shortcode [flexiblemap] and give it some useful attributes. A map can either be specified using centre coordinates or street address, or by loading a KML file.
67
 
68
+ = Attributes for centre coordinates or street address map =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  Either the center or the address paramater is required. If you provide both, the centre coordinates will be used for the map centre, but directions will use the street address. (This will prevent directions from telling people how to get to the destination opposite yours!)
71
 
77
  * **icon**: URL to icon for the marker, e.g. *icon="http://maps.google.com/mapfiles/kml/pal3/icon29.png"*
78
  * **description**: a description of the marker location (can have HTML links), e.g. *description="Lorem ipsum dolor sit amet"*
79
  * **html**: some simple HTML to add to the info window, e.g. *`<img src='http://example.com/logo.img' />`*
80
+ * **showinfo**: show the marker's info window when the map loads, from [true, false], e.g. *showinfo="false"*; default=true
 
 
81
 
82
  *Samples*:
83
  `[flexiblemap center="-34.916721,138.828878" width="100%" height="400px" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]
85
  [flexiblemap center="-32.891058,151.538042" title="Mount Sugarloaf" directions="true"]
86
  [flexiblemap center="-32.918827,151.806164" title="Nobby's Head" directions="my-dir-div"]`
87
 
88
+ = Attributes for KML map =
89
 
90
  * **src**: the URL for a KML file to load map details from, e.g. *src="http://example.com/map.kml"*
91
  * **targetfix**: prevent links from opening in new window, from [true, false], e.g. *targetfix="true"*; default=true
93
  *Sample*:
94
  `[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="100%" height="400px"]`
95
 
96
+ = Attributes for all maps =
97
+
98
+ * **width**: width in pixels or valid CSS units, e.g. *width="100%"*
99
+ * **height**: height in pixels or valid CSS units, e.g. *height="400px"*
100
+ * **id**: the CSS id of the container div (instead of a random generated unique ID), e.g. *id="my_map"*
101
+ * **zoom**: zoom level as an integer, larger is closer, e.g. *zoom="16"*
102
+ * **maptype**: type of map to show, from [roadmap, satellite, hybrid, terrain], e.g. *maptype="satellite"*; default=roadmap
103
+ * **hidemaptype**: hide the map type controls, from [true, false], e.g. *hidemaptype="true"*; default=false
104
+ * **hidepanning**: hide the panning controls, from [true, false], e.g. *hidepanning="true"*; default=true
105
+ * **hidezooming**: hide the zoom controls, from [true, false], e.g. *hidezooming="true"*; default=false
106
+ * **hidestreetview**: hide the street view control, from [true, false], e.g. *hidestreetview="true"*; default=true
107
+ * **hidescale**: hide the map scale, from [true, false], e.g. *hidescale="true"*; default=true
108
+ * **zoomstyle**: which zoom control style, from [small, large, default]; default=small
109
+ * **scrollwheel**: enable zoom with mouse scroll wheel, from [true, false], e.g. *scrollwheel="true"*; default=false
110
+ * **draggable**: enable dragging to pan, from [true, false], e.g. *draggable="true"*; default=true
111
+ * **dblclickzoom**: enable double-clicking to zoom, from [true, false], e.g. *dblclickzoom="true"*; default=true
112
+ * **directions**: show directions link in text bubble; by default, directions will be displayed underneath map, but you can specify the element ID for directions here, e.g. *directions="true", directions="my-dir-id"*; default=false
113
+ * **dirdraggable**: allow directions to be draggable, from [true, false]; default=false
114
+ * **dirnomarkers**: suppress start and end markers when showing directions, from [true, false]; default=false
115
+ * **dirshowsteps**: show or suppress directions steps when showing directions, from [true, false]; default=true
116
+ * **dirshowssearch**: show or suppress directions search form when showing directions, from [true, false]; default=true
117
+ * **showdirections**: show directions when the map loads, e.g. *showdirections="true"*; default=false
118
+ * **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
119
+ * **region**: specify region to help localise address searches for street address map and directions, taken from the list of [country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) e.g. *region="AU"*
120
+ * **locale**: use a specific locale (language) for messages like the text of the Directions link, e.g. *locale="nl-BE"*
121
+ * **visualrefresh**: enable [visual refresh](https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh); NB: affects all maps on the page! from [true, false]; default=false
122
+
123
  = Calling from templates or plugins =
124
 
125
+ There is a PHP function `flexmap_show_map()` for theme and plugin developers. All of the same attributes for the shortcode can be passed to the function in an associative array. If you want it to return the map as a string without output to screen, add "echo"=>"false" to array of attributes.
126
 
127
  *Sample*:
128
  `flexmap_show_map(array(
146
  * **flexmap_shortcode_styles**: filter the array of inline styles applied to the div wrapping the map, e.g. remove width and height so that it can be specified in the theme's stylesheets
147
  * **flexmap_shortcode_html**: filter the generated html, e.g. wrap another div around it, add a link to Google Maps, add some additonal script, etc.
148
 
149
+ For more information and examples, see [the website](http://flexible-map.webaware.net.au/).
150
 
151
  == Frequently Asked Questions ==
152
 
158
 
159
  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.
160
 
161
+ = Where are the settings? =
162
+
163
+ There are none! You just need to add some attributes to your shortcode telling the map what to do.
164
+
165
+ Of course, in WordPress there is a plugin for everything :) so if you *want* settings, please install the [Flexible Map Options plugin](http://wordpress.org/plugins/wp-flexible-map-options/). That plugin lets you set some defaults so that if you use the same attributes over and over, you can put them all in one place.
166
+
167
  = Can I add multiple markers to a map? =
168
 
169
  Using a KML file, you can have as many markers on a map as you like, with as much detail in the info windows. With KML you can also change marker icons and add other nice features. You can generate your KML file from an application like Google Earth, or you can create it yourself (in a text editor or with your own programming). [Learn more about KML](https://developers.google.com/kml/).
176
 
177
  The Google Maps API supports many commonly used KML elements, but has some restrictions. Read about [Google Maps support for KML](https://developers.google.com/kml/documentation/mapsSupport) in the developers' guide, and also see the list of [KML elements supported in Google Maps](https://developers.google.com/kml/documentation/kmlelementsinmaps).
178
 
179
+ = Why won't the map show my place when I use the address attribute? =
180
 
181
+ When you use a street address instead of centre coordinates, you are effectively searching Google Maps for your location. Try being very specific about your address, including your town / city, state / province, and country to make sure Google can find where you mean. You can also specify your region with the `region` attribute to help Google Maps refine its search. If the marker is still in the wrong place, you might need to specify the location using centre coordinates instead.
182
 
183
  = How can I use centre coordinates for the map and have directions to my address? =
184
 
186
 
187
  = How do I get the maps to use my language? =
188
 
189
+ Since version 1.1.0, this plugin now uses localised messages for things like the Directions link and the default message on links in info windows. If you have your [WordPress installation set to use your language](http://codex.wordpress.org/WordPress_in_Your_Language), the plugin should automatically pick it up. If you need to force it to pick up your language (or want to offer a different language), use the `locale` attribute, e.g. `locale="ru"` or `locale="zh-TW"`.
190
 
191
  Google Maps will use the locale information from your web browser to help display maps and directions in your language (see your browser's language settings). If you want to force the Google Maps language for every map on a page, you can use a filter hook. For example, here's how to force the Google Maps language to match the language of the page / post its on (e.g. when using WPML translated content):
192
 
272
 
273
  `flexmap_load_scripts(array('fr', 'zh'));`
274
 
275
+ The plugin will detect when AJAX is being used via the [WordPress standard method](http://codex.wordpress.org/AJAX_in_Plugins), and adjust accordingly (but you still need to load the scripts as above). If another method is used, add `isajax='true'` to the shortcode attributes.
276
 
277
  NB: currently, only AJAX methods that parse script tags will work correctly; this includes some [jQuery methods](http://stackoverflow.com/q/2203762/911083) (but [not all](http://stackoverflow.com/a/2699905/911083)). A future version of the plugin will be more AJAX friendly.
278
 
286
 
287
  == Changelog ==
288
 
289
+ = 1.7.2 [2014-01-01] =
290
+ * fixed: Spanish translation (thanks, [edurramos](http://profiles.wordpress.org/edurramos/)!)
291
+ * fixed: clean up JSHint warnings
292
+ * changed: Slovenian translation refresh from Google Translate (human translators wanted!)
293
+ * changed: plugin homepage, better documentation and examples, will develop as time permits!
294
+
295
  = 1.7.1 [2013-10-13] =
296
  * fixed: Google link was showing marker at centre, not at marker location when marker != centre
297
 
301
  * fixed: KML map zoom sometimes doesn't happen on first page visit
302
  * fixed: some themes (e.g. twentythirteen) mess up Google Maps directions markers
303
  * fixed: Google link opens maps without marker (NB: <= IE8 not supported)
304
+ * added: `dirshowsteps` attribute, to allow directions steps (i.e. turn-by-turn steps) to be turned off
305
+ * added: `dirshowssearch` attribute, to allow directions search form to be turned off
306
+ * added: `zoomstyle` attribute, to allow large or small zoom controls
307
+ * added: `visualrefresh` attribute, to enable [visual refresh](https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh) for all maps on the page
308
  * added: default CSS sets info window text color to #333
309
  * changed: bump version of Google Maps API to 3.13
310
 
311
  = 1.6.5 [2013-07-19] =
312
  * fixed: stop twentythirteen theme stuffing up Google Maps infowindows with its too-promiscuous box-sizing rules
313
+ * added: `dirdraggable` and `dirnomarkers` attributes
314
 
315
  = 1.6.4 [2013-06-14] =
316
  * fixed: can set directions=false and showdirections=true
324
 
325
  = 1.6.2 [2013-03-04] =
326
  * fixed: CSS fix for themes that muck up Google Maps images by specifying background colour on images without being selective
327
+ * added: icon attribute to set marker icon on centre / address maps
328
 
329
  = 1.6.1 [2013-01-29] =
330
  * fixed: infowindow auto-pans on load, to prevent the top of the bubble being cropped
339
  * fixed: no auto-focus on directions search field, thus no auto-scroll page to last directions search field!
340
 
341
  = 1.5.3 [2012-11-30] =
342
+ * fixed: when attributes showdirections or directionsfrom were specified, but not directions, the directions panel was not added to page and a JavaScript error was generated
343
  * changed: bump version of Google Maps API to 3.10
344
 
345
  = 1.5.2 [2012-10-12] =
403
  * fixed: tied Google Maps API to v3.8 so newer versions don't break plugin, and will keep updated as API changes
404
 
405
  = 1.0.2 [2012-02-04] =
406
+ * added: address attribute as alternative to center coordinates
407
+ * added: use address attribute for directions, if given (so that directions match address)
408
  * changed: readme improved a little
409
  * changed: refactored code for DRY (don't repeat yourself)
410