Flexible Map - Version 1.4.1

Version Description

[2012-09-11] = * fixed: targetfix was not stopping KML marker links opening in new window/tab since Google Maps API 3.9

Download this release

Release Info

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

Code changes from version 1.4.0 to 1.4.1

class.FlxMapAdmin.php CHANGED
@@ -43,6 +43,8 @@ class FlxMapAdmin {
43
  // add settings link
44
  if ($file == FLXMAP_PLUGIN_NAME) {
45
  $links[] = '<a href="admin.php?page=' . self::MENU_PAGE . '-instructions">' . __('Instructions') . '</a>';
 
 
46
  $links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ" title="Please consider making a donation to help support maintenance and further development of this plugin.">'
47
  . __('Donate') . '</a>';
48
  }
43
  // add settings link
44
  if ($file == FLXMAP_PLUGIN_NAME) {
45
  $links[] = '<a href="admin.php?page=' . self::MENU_PAGE . '-instructions">' . __('Instructions') . '</a>';
46
+ $links[] = '<a href="http://wordpress.org/support/plugin/wp-flexible-map">' . __('Support') . '</a>';
47
+ $links[] = '<a href="http://wordpress.org/extend/plugins/wp-flexible-map/">' . __('Rate') . '</a>';
48
  $links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ" title="Please consider making a donation to help support maintenance and further development of this plugin.">'
49
  . __('Donate') . '</a>';
50
  }
class.FlxMapPlugin.php CHANGED
@@ -77,7 +77,7 @@ class FlxMapPlugin {
77
  if ($this->loadScripts) {
78
  // load required scripts
79
  $url = parse_url($this->urlBase, PHP_URL_PATH);
80
- $version = 9;
81
 
82
  // allow others to override the Google Maps API URL
83
  $apiURL = apply_filters('flexmap_google_maps_api_url', '//maps.google.com/maps/api/js?v=3.9&amp;sensor=false');
77
  if ($this->loadScripts) {
78
  // load required scripts
79
  $url = parse_url($this->urlBase, PHP_URL_PATH);
80
+ $version = 10;
81
 
82
  // allow others to override the Google Maps API URL
83
  $apiURL = apply_filters('flexmap_google_maps_api_url', '//maps.google.com/maps/api/js?v=3.9&amp;sensor=false');
flexible-map.js CHANGED
@@ -147,9 +147,14 @@ FlexibleMap.prototype = (function() {
147
  }
148
 
149
  // stop links opening in a new window (thanks, Stack Overflow!)
 
150
  if (this.targetFix) {
151
  google.maps.event.addListener(kmlLayer, 'click', function(kmlEvent) {
152
- kmlEvent.featureData.description = kmlEvent.featureData.description.replace(/ target="_blank"/ig, "");
 
 
 
 
153
  });
154
  }
155
  },
147
  }
148
 
149
  // stop links opening in a new window (thanks, Stack Overflow!)
150
+ // NB: since Google Maps API v3.9 the info window HTML is precomposed, so just changing the description won't fix link
151
  if (this.targetFix) {
152
  google.maps.event.addListener(kmlLayer, 'click', function(kmlEvent) {
153
+ var featureData = kmlEvent.featureData,
154
+ reTargetFix = / target="_blank"/ig;
155
+
156
+ featureData.description = featureData.description.replace(reTargetFix, "");
157
+ featureData.infoWindowHtml = featureData.infoWindowHtml.replace(reTargetFix, "");
158
  });
159
  }
160
  },
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=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.markerLink="";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 c,b,a;if(document.addEventListener){c=function(e,d,f){e.addEventListener(d,f,false)};b=function(d){d.stopPropagation();d.preventDefault()};a=function(e,d){var f=document.createEvent("HTMLEvents");f.initEvent(d,true,true);e.dispatchEvent(f)}}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};a=function(e,d){var f=document.createEventObject();f.eventType=d;e.fireEvent("on"+d,f)}}}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""},showKML:function(d,h,e){var g=this.showMap(d,[0,0]),f=new google.maps.KmlLayer(h);f.setMap(g);if(typeof e!="undefined"){google.maps.event.addListenerOnce(g,"tilesloaded",function(){g.setZoom(e)})}if(this.targetFix){google.maps.event.addListener(f,"click",function(i){i.featureData.description=i.featureData.description.replace(/ target="_blank"/ig,"")})}},showMarker:function(g,f,l){var e=this.showMap(g,f),o=new google.maps.Marker({map:e,position:new google.maps.LatLng(l[0],l[1])});if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var k,m,q,h,j,n,p=this,d=document.createElement("DIV");d.className="flxmap-infowin";o.setTitle(this.markerTitle);j=document.createElement("DIV");j.className="flxmap-marker-title";j.appendChild(document.createTextNode(this.markerTitle));d.appendChild(j);if(this.markerDescription||this.markerLink){j=document.createElement("DIV");j.className="flxmap-marker-link";if(this.markerDescription){q=this.markerDescription.split("\n");for(k=0,m=q.length;k<m;k++){if(k>0){j.appendChild(document.createElement("BR"))}j.appendChild(document.createTextNode(q[k]))}if(this.markerLink){j.appendChild(document.createElement("BR"))}}if(this.markerLink){n=document.createElement("A");n.href=this.markerLink;n.appendChild(document.createTextNode(this.gettext("Click for details")));j.appendChild(n)}d.appendChild(j)}if(this.markerDirections){j=document.createElement("DIV");j.className="flxmap-directions-link";n=document.createElement("A");n.href="#";n.dataLatitude=l[0];n.dataLongitude=l[1];n.dataTitle=this.markerTitle;c(n,"click",function(i){b(i);p.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle)});n.appendChild(document.createTextNode(this.gettext("Directions")));j.appendChild(n);d.appendChild(j)}if(this.markerDirections||this.markerDirectionsShow){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)})}if(this.markerDirectionsShow){this.showDirections(l[0],l[1],this.markerTitle)}}h=new google.maps.InfoWindow({content:d});if(this.markerShowInfo){h.open(e,o)}google.maps.event.addListener(o,"click",function(){h.open(e,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)}})},showMap:function(d,e){return new google.maps.Map(document.getElementById(d),{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:new google.maps.LatLng(e[0],e[1]),zoom:this.zoom})},showDirections:function(h,d,j){var e=document.getElementById(this.markerDirections),g=document.createElement("form"),m=this,i=this.region||"",k,f,l;while(!!(f=e.lastChild)){e.removeChild(f)}f=document.createElement("p");f.appendChild(document.createTextNode(this.gettext("From")+": "));l=document.createElement("input");l.type="text";l.name="from";l.value=this.markerDirectionsDefault;f.appendChild(l);k=document.createElement("input");k.type="submit";k.value=this.gettext("Get directions");f.appendChild(k);g.appendChild(f);e.appendChild(g);l.focus();if(typeof g.elements.from=="undefined"){g.elements.from=l}c(g,"submit",function(p){b(p);var q=this.elements.from.value;if(/\S/.test(q)){var n=(m.markerAddress==="")?new google.maps.LatLng(h,d):m.markerAddress,o={origin:q,region:i,destination:n,travelMode:google.maps.DirectionsTravelMode.DRIVING};m.dirService.route(o,function(t,r){var s=google.maps.DirectionsStatus;switch(r){case s.OK:m.dirPanel.setDirections(t);break;case s.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case s.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case s.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case s.INVALID_REQUEST:alert("Invalid directions request.");break;case s.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(l.value){a(g,"submit")}}}})();
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=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.markerLink="";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 c,b,a;if(document.addEventListener){c=function(e,d,f){e.addEventListener(d,f,false)};b=function(d){d.stopPropagation();d.preventDefault()};a=function(e,d){var f=document.createEvent("HTMLEvents");f.initEvent(d,true,true);e.dispatchEvent(f)}}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};a=function(e,d){var f=document.createEventObject();f.eventType=d;e.fireEvent("on"+d,f)}}}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""},showKML:function(d,h,e){var g=this.showMap(d,[0,0]),f=new google.maps.KmlLayer(h);f.setMap(g);if(typeof e!="undefined"){google.maps.event.addListenerOnce(g,"tilesloaded",function(){g.setZoom(e)})}if(this.targetFix){google.maps.event.addListener(f,"click",function(k){var j=k.featureData,i=/ target="_blank"/ig;j.description=j.description.replace(i,"");j.infoWindowHtml=j.infoWindowHtml.replace(i,"")})}},showMarker:function(g,f,l){var e=this.showMap(g,f),o=new google.maps.Marker({map:e,position:new google.maps.LatLng(l[0],l[1])});if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var k,m,q,h,j,n,p=this,d=document.createElement("DIV");d.className="flxmap-infowin";o.setTitle(this.markerTitle);j=document.createElement("DIV");j.className="flxmap-marker-title";j.appendChild(document.createTextNode(this.markerTitle));d.appendChild(j);if(this.markerDescription||this.markerLink){j=document.createElement("DIV");j.className="flxmap-marker-link";if(this.markerDescription){q=this.markerDescription.split("\n");for(k=0,m=q.length;k<m;k++){if(k>0){j.appendChild(document.createElement("BR"))}j.appendChild(document.createTextNode(q[k]))}if(this.markerLink){j.appendChild(document.createElement("BR"))}}if(this.markerLink){n=document.createElement("A");n.href=this.markerLink;n.appendChild(document.createTextNode(this.gettext("Click for details")));j.appendChild(n)}d.appendChild(j)}if(this.markerDirections){j=document.createElement("DIV");j.className="flxmap-directions-link";n=document.createElement("A");n.href="#";n.dataLatitude=l[0];n.dataLongitude=l[1];n.dataTitle=this.markerTitle;c(n,"click",function(i){b(i);p.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle)});n.appendChild(document.createTextNode(this.gettext("Directions")));j.appendChild(n);d.appendChild(j)}if(this.markerDirections||this.markerDirectionsShow){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)})}if(this.markerDirectionsShow){this.showDirections(l[0],l[1],this.markerTitle)}}h=new google.maps.InfoWindow({content:d});if(this.markerShowInfo){h.open(e,o)}google.maps.event.addListener(o,"click",function(){h.open(e,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)}})},showMap:function(d,e){return new google.maps.Map(document.getElementById(d),{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:new google.maps.LatLng(e[0],e[1]),zoom:this.zoom})},showDirections:function(h,d,j){var e=document.getElementById(this.markerDirections),g=document.createElement("form"),m=this,i=this.region||"",k,f,l;while(!!(f=e.lastChild)){e.removeChild(f)}f=document.createElement("p");f.appendChild(document.createTextNode(this.gettext("From")+": "));l=document.createElement("input");l.type="text";l.name="from";l.value=this.markerDirectionsDefault;f.appendChild(l);k=document.createElement("input");k.type="submit";k.value=this.gettext("Get directions");f.appendChild(k);g.appendChild(f);e.appendChild(g);l.focus();if(typeof g.elements.from=="undefined"){g.elements.from=l}c(g,"submit",function(p){b(p);var q=this.elements.from.value;if(/\S/.test(q)){var n=(m.markerAddress==="")?new google.maps.LatLng(h,d):m.markerAddress,o={origin:q,region:i,destination:n,travelMode:google.maps.DirectionsTravelMode.DRIVING};m.dirService.route(o,function(t,r){var s=google.maps.DirectionsStatus;switch(r){case s.OK:m.dirPanel.setDirections(t);break;case s.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case s.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case s.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case s.INVALID_REQUEST:alert("Invalid directions request.");break;case s.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(l.value){a(g,"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.4.0
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.4.1
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
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, maps, google maps, shortcode, kml
8
  Requires at least: 3.0.1
9
- Tested up to: 3.4.1
10
- Stable tag: 1.4.0
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -148,6 +148,9 @@ The initial translations were made using Google Translate, so it's likely that s
148
 
149
  == Changelog ==
150
 
 
 
 
151
  = 1.4.0 [2012-08-22] =
152
  * changed: bump version of Google Maps API to 3.9
153
  * added: allow CSS units in ch, rem, vh, vw, vmin, vmax
6
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ
7
  Tags: google, maps, google maps, shortcode, kml
8
  Requires at least: 3.0.1
9
+ Tested up to: 3.4.2
10
+ Stable tag: 1.4.1
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
148
 
149
  == Changelog ==
150
 
151
+ = 1.4.1 [2012-09-11] =
152
+ * fixed: targetfix was not stopping KML marker links opening in new window/tab since Google Maps API 3.9
153
+
154
  = 1.4.0 [2012-08-22] =
155
  * changed: bump version of Google Maps API to 3.9
156
  * added: allow CSS units in ch, rem, vh, vw, vmin, vmax