Flexible Map - Version 1.0.3

Version Description

[2012-02-27] = * fixed: address query updated to work with Google Maps v3.8 (so using address for centre marker works again) * fixed: tied Google Maps API to v3.8 so newer versions don't break plugin, and will keep updated as API changes

Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.3

class.FlxMapPlugin.php CHANGED
@@ -73,11 +73,11 @@ class FlxMapPlugin {
73
  public function actionFooter() {
74
  if ($this->loadScripts) {
75
  // load required scripts
76
- $url = parse_url("{$this->urlBase}/flexible-map.min.js", PHP_URL_PATH) . '?v=3';
77
 
78
  echo <<<HTML
79
  <script src="$url"></script>
80
- <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
81
 
82
  HTML;
83
  }
73
  public function actionFooter() {
74
  if ($this->loadScripts) {
75
  // load required scripts
76
+ $url = parse_url("{$this->urlBase}/flexible-map.min.js", PHP_URL_PATH) . '?v=4';
77
 
78
  echo <<<HTML
79
  <script src="$url"></script>
80
+ <script src="http://maps.google.com/maps/api/js?v=3.8&amp;sensor=false"></script>
81
 
82
  HTML;
83
  }
flexible-map.js CHANGED
@@ -80,6 +80,9 @@ FlexibleMap.prototype = (function() {
80
  position: new google.maps.LatLng(marker[0], marker[1])
81
  });
82
 
 
 
 
83
  if (this.markerTitle) {
84
  var i, len, lines, infowin, element, a,
85
  self = this,
@@ -172,7 +175,7 @@ FlexibleMap.prototype = (function() {
172
  geocoder.geocode({address: address}, function(results, status) {
173
  if (status == google.maps.GeocoderStatus.OK) {
174
  var location = results[0].geometry.location,
175
- centre = [ location.Oa, location.Pa ];
176
  self.showMarker(divID, centre, centre);
177
  }
178
  else {
80
  position: new google.maps.LatLng(marker[0], marker[1])
81
  });
82
 
83
+ if (!this.markerTitle)
84
+ this.markerTitle = this.markerAddress;
85
+
86
  if (this.markerTitle) {
87
  var i, len, lines, infowin, element, a,
88
  self = this,
175
  geocoder.geocode({address: address}, function(results, status) {
176
  if (status == google.maps.GeocoderStatus.OK) {
177
  var location = results[0].geometry.location,
178
+ centre = [ location.Sa, location.Ta ];
179
  self.showMarker(divID, centre, centre);
180
  }
181
  else {
flexible-map.min.js CHANGED
@@ -2,4 +2,4 @@
2
  JavaScript for the WordPress plugin wp-flexible-map
3
  copyright (c) 2011-2012 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
- function FlexibleMap(){this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=false;this.scaleControl=false;this.streetViewControl=false;this.scrollwheel=false;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerLink="";this.markerShowInfo=true;this.markerDirections=false;this.markerAddress="";this.navigationControlOptions={style:google.maps.NavigationControlStyle.SMALL};this.dirService=false;this.dirPanel=false;this.region=false}FlexibleMap.prototype=(function(){var b,a;if(document.addEventListener){b=function(d,c,e){d.addEventListener(c,e,false)};a=function(c){c.stopPropagation();c.preventDefault()}}else{if(document.attachEvent){b=function(c,d,e){c.attachEvent("on"+d,function(){e.call(c,window.event)})};a=function(c){c.cancelBubble=true;c.returnValue=0}}}return{constructor:FlexibleMap,showKML:function(c,g,d){var f=this.showMap(c,[0,0]),e=new google.maps.KmlLayer(g);e.setMap(f);if(typeof d!="undefined"){google.maps.event.addListenerOnce(f,"tilesloaded",function(){f.setZoom(d)})}google.maps.event.addListener(e,"click",function(h){h.featureData.description=h.featureData.description.replace(/ target="_blank"/ig,"")})},showMarker:function(f,e,k){var d=this.showMap(f,e),n=new google.maps.Marker({map:d,position:new google.maps.LatLng(k[0],k[1])});if(this.markerTitle){var j,l,p,g,h,m,o=this,c=document.createElement("DIV");c.style.fontFamily="Arial,Helvetica,sans-serif";h=document.createElement("DIV");h.style.fontWeight="bold";h.style.fontSize="medium";h.appendChild(document.createTextNode(this.markerTitle));c.appendChild(h);if(this.markerDescription||this.markerLink){h=document.createElement("DIV");h.style.fontSize="small";if(this.markerDescription){p=this.markerDescription.split("\n");for(j=0,l=p.length;j<l;j++){if(j>0){h.appendChild(document.createElement("BR"))}h.appendChild(document.createTextNode(p[j]))}if(this.markerLink){h.appendChild(document.createElement("BR"))}}if(this.markerLink){m=document.createElement("A");m.href=this.markerLink;m.appendChild(document.createTextNode("Click for details"));h.appendChild(m)}c.appendChild(h)}if(this.markerDirections){h=document.createElement("DIV");h.style.fontSize="small";m=document.createElement("A");m.href="#";m.dataLatitude=k[0];m.dataLongitude=k[1];m.dataTitle=this.markerTitle;b(m,"click",function(i){a(i);o.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle)});m.appendChild(document.createTextNode("Directions"));h.appendChild(m);c.appendChild(h);if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirPanel){this.dirPanel=new google.maps.DirectionsRenderer({map:d,panel:document.getElementById(this.markerDirections)})}}g=new google.maps.InfoWindow({content:c});if(this.markerShowInfo){g.open(d,n)}google.maps.event.addListener(n,"click",function(){g.open(d,n)})}},showAddress:function(c,d){var e=this,f=new google.maps.Geocoder();this.markerAddress=d;if(this.markerTitle==""){this.markerTitle=d}f.geocode({address:d},function(i,h){if(h==google.maps.GeocoderStatus.OK){var g=i[0].geometry.location,j=[g.Oa,g.Pa];e.showMarker(c,j,j)}else{alert("Map address returns error: "+h)}})},showMap:function(c,d){return new google.maps.Map(document.getElementById(c),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,scrollwheel:this.scrollwheel,streetViewControl:this.streetViewControl,navigationControlOptions:this.navigationControlOptions,center:new google.maps.LatLng(d[0],d[1]),zoom:this.zoom})},showDirections:function(g,c,i){var d=document.getElementById(this.markerDirections),f=document.createElement("form"),l=this,h=this.region||"",j,e,k;while(!!(e=d.lastChild)){d.removeChild(e)}e=document.createElement("p");e.appendChild(document.createTextNode("From: "));k=document.createElement("input");k.type="text";k.name="from";e.appendChild(k);j=document.createElement("input");j.type="submit";j.value="Get directions";e.appendChild(j);f.appendChild(e);d.appendChild(f);k.focus();if(typeof f.elements.from=="undefined"){f.elements.from=k}b(f,"submit",function(o){a(o);var p=this.elements.from.value;if(/\S/.test(p)){var m=(l.markerAddress=="")?new google.maps.LatLng(g,c):l.markerAddress,n={origin:p,region:h,destination:m,travelMode:google.maps.DirectionsTravelMode.DRIVING};l.dirService.route(n,function(s,q){var r=google.maps.DirectionsStatus;switch(q){case r.OK:l.dirPanel.setDirections(s);break;case r.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case r.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case r.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case r.INVALID_REQUEST:alert("Invalid directions request.");break;case r.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}})}})}}})();
2
  JavaScript for the WordPress plugin wp-flexible-map
3
  copyright (c) 2011-2012 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
+ function FlexibleMap(){this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=false;this.scaleControl=false;this.streetViewControl=false;this.scrollwheel=false;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerLink="";this.markerShowInfo=true;this.markerDirections=false;this.markerAddress="";this.navigationControlOptions={style:google.maps.NavigationControlStyle.SMALL};this.dirService=false;this.dirPanel=false;this.region=false}FlexibleMap.prototype=(function(){var b,a;if(document.addEventListener){b=function(d,c,e){d.addEventListener(c,e,false)};a=function(c){c.stopPropagation();c.preventDefault()}}else{if(document.attachEvent){b=function(c,d,e){c.attachEvent("on"+d,function(){e.call(c,window.event)})};a=function(c){c.cancelBubble=true;c.returnValue=0}}}return{constructor:FlexibleMap,showKML:function(c,g,d){var f=this.showMap(c,[0,0]),e=new google.maps.KmlLayer(g);e.setMap(f);if(typeof d!="undefined"){google.maps.event.addListenerOnce(f,"tilesloaded",function(){f.setZoom(d)})}google.maps.event.addListener(e,"click",function(h){h.featureData.description=h.featureData.description.replace(/ target="_blank"/ig,"")})},showMarker:function(f,e,k){var d=this.showMap(f,e),n=new google.maps.Marker({map:d,position:new google.maps.LatLng(k[0],k[1])});if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var j,l,p,g,h,m,o=this,c=document.createElement("DIV");c.style.fontFamily="Arial,Helvetica,sans-serif";h=document.createElement("DIV");h.style.fontWeight="bold";h.style.fontSize="medium";h.appendChild(document.createTextNode(this.markerTitle));c.appendChild(h);if(this.markerDescription||this.markerLink){h=document.createElement("DIV");h.style.fontSize="small";if(this.markerDescription){p=this.markerDescription.split("\n");for(j=0,l=p.length;j<l;j++){if(j>0){h.appendChild(document.createElement("BR"))}h.appendChild(document.createTextNode(p[j]))}if(this.markerLink){h.appendChild(document.createElement("BR"))}}if(this.markerLink){m=document.createElement("A");m.href=this.markerLink;m.appendChild(document.createTextNode("Click for details"));h.appendChild(m)}c.appendChild(h)}if(this.markerDirections){h=document.createElement("DIV");h.style.fontSize="small";m=document.createElement("A");m.href="#";m.dataLatitude=k[0];m.dataLongitude=k[1];m.dataTitle=this.markerTitle;b(m,"click",function(i){a(i);o.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle)});m.appendChild(document.createTextNode("Directions"));h.appendChild(m);c.appendChild(h);if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirPanel){this.dirPanel=new google.maps.DirectionsRenderer({map:d,panel:document.getElementById(this.markerDirections)})}}g=new google.maps.InfoWindow({content:c});if(this.markerShowInfo){g.open(d,n)}google.maps.event.addListener(n,"click",function(){g.open(d,n)})}},showAddress:function(c,d){var e=this,f=new google.maps.Geocoder();this.markerAddress=d;if(this.markerTitle==""){this.markerTitle=d}f.geocode({address:d},function(i,h){if(h==google.maps.GeocoderStatus.OK){var g=i[0].geometry.location,j=[g.Sa,g.Ta];e.showMarker(c,j,j)}else{alert("Map address returns error: "+h)}})},showMap:function(c,d){return new google.maps.Map(document.getElementById(c),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,scrollwheel:this.scrollwheel,streetViewControl:this.streetViewControl,navigationControlOptions:this.navigationControlOptions,center:new google.maps.LatLng(d[0],d[1]),zoom:this.zoom})},showDirections:function(g,c,i){var d=document.getElementById(this.markerDirections),f=document.createElement("form"),l=this,h=this.region||"",j,e,k;while(!!(e=d.lastChild)){d.removeChild(e)}e=document.createElement("p");e.appendChild(document.createTextNode("From: "));k=document.createElement("input");k.type="text";k.name="from";e.appendChild(k);j=document.createElement("input");j.type="submit";j.value="Get directions";e.appendChild(j);f.appendChild(e);d.appendChild(f);k.focus();if(typeof f.elements.from=="undefined"){f.elements.from=k}b(f,"submit",function(o){a(o);var p=this.elements.from.value;if(/\S/.test(p)){var m=(l.markerAddress=="")?new google.maps.LatLng(g,c):l.markerAddress,n={origin:p,region:h,destination:m,travelMode:google.maps.DirectionsTravelMode.DRIVING};l.dirService.route(n,function(s,q){var r=google.maps.DirectionsStatus;switch(q){case r.OK:l.dirPanel.setDirections(s);break;case r.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case r.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case r.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case r.INVALID_REQUEST:alert("Invalid directions request.");break;case r.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}})}})}}})();
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.0.2
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
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.0.3
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
readme.txt CHANGED
@@ -6,7 +6,7 @@ Author URI: http://www.webaware.com.au/
6
  Tags: google, maps, shortcode, kml
7
  Requires at least: 3.0.1
8
  Tested up to: 3.3.1
9
- Stable tag: 1.0.2
10
 
11
  Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
12
 
@@ -110,6 +110,10 @@ When you use just centre coordinates for your map, the directions may send peopl
110
 
111
  == Changelog ==
112
 
 
 
 
 
113
  = 1.0.2 [2012-02-04] =
114
  * added: address parameter as alternative to center coordinates
115
  * added: use address parameter for directions, if given (so that directions match address)
6
  Tags: google, maps, shortcode, kml
7
  Requires at least: 3.0.1
8
  Tested up to: 3.3.1
9
+ Stable tag: 1.0.3
10
 
11
  Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
12
 
110
 
111
  == Changelog ==
112
 
113
+ = 1.0.3 [2012-02-27] =
114
+ * fixed: address query updated to work with Google Maps v3.8 (so using address for centre marker works again)
115
+ * fixed: tied Google Maps API to v3.8 so newer versions don't break plugin, and will keep updated as API changes
116
+
117
  = 1.0.2 [2012-02-04] =
118
  * added: address parameter as alternative to center coordinates
119
  * added: use address parameter for directions, if given (so that directions match address)