Flexible Map - Version 1.0.4a

Version Description

Download this release

Release Info

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

Code changes from version 1.0.3 to 1.0.4a

class.FlxMapPlugin.php CHANGED
@@ -73,7 +73,7 @@ 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=4';
77
 
78
  echo <<<HTML
79
  <script src="$url"></script>
@@ -112,10 +112,10 @@ HTML;
112
  }
113
 
114
  $html = <<<HTML
115
- <div id="$divID" class='flxmap-container' style="width: {$width}px; height: ${height}px;"></div>$divDirections
116
  <script>
117
  //<![CDATA[
118
- (function (w, fn) {
119
  if (w.addEventListener) w.addEventListener("DOMContentLoaded", fn, false);
120
  else if (w.attachEvent) w.attachEvent("onload", fn);
121
  })(window, function() {
@@ -123,18 +123,46 @@ HTML;
123
 
124
  HTML;
125
 
126
- if (!(isset($attrs['hideMapType']) && self::isYes($attrs['hideMapType']))) {
127
- $html .= " f.mapTypeControl = true;\n";
128
  }
129
 
130
- if ($directions) {
131
- $html .= " f.markerDirections = \"$divDirectionsID\";\n";
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
 
134
  if (isset($attrs['showinfo']) && self::isNo($attrs['showinfo'])) {
135
  $html .= " f.markerShowInfo = false;\n";
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  if (isset($attrs['maptype'])) {
139
  $html .= " f.mapTypeId = \"{$attrs['maptype']}\";\n";
140
  }
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=5';
77
 
78
  echo <<<HTML
79
  <script src="$url"></script>
112
  }
113
 
114
  $html = <<<HTML
115
+ <div id="$divID" class='flxmap-container' style="width:{$width}px;height:${height}px;"></div>$divDirections
116
  <script>
117
  //<![CDATA[
118
+ (function(w, fn) {
119
  if (w.addEventListener) w.addEventListener("DOMContentLoaded", fn, false);
120
  else if (w.attachEvent) w.attachEvent("onload", fn);
121
  })(window, function() {
123
 
124
  HTML;
125
 
126
+ if (isset($attrs['hidemaptype']) && self::isYes($attrs['hidemaptype'])) {
127
+ $html .= " f.mapTypeControl = false;\n";
128
  }
129
 
130
+ if (isset($attrs['hidescale']) && self::isNo($attrs['hidescale'])) {
131
+ $html .= " f.scaleControl = true;\n";
132
+ }
133
+
134
+ if (isset($attrs['hidepanning']) && self::isNo($attrs['hidepanning'])) {
135
+ $html .= " f.panControl = true;\n";
136
+ }
137
+
138
+ if (isset($attrs['hidezooming']) && self::isYes($attrs['hidezooming'])) {
139
+ $html .= " f.zoomControl = false;\n";
140
+ }
141
+
142
+ if (isset($attrs['hidestreetview']) && self::isNo($attrs['hidestreetview'])) {
143
+ $html .= " f.streetViewControl = true;\n";
144
  }
145
 
146
  if (isset($attrs['showinfo']) && self::isNo($attrs['showinfo'])) {
147
  $html .= " f.markerShowInfo = false;\n";
148
  }
149
 
150
+ if (isset($attrs['scrollwheel']) && self::isYes($attrs['scrollwheel'])) {
151
+ $html .= " f.scrollwheel = true;\n";
152
+ }
153
+
154
+ if (isset($attrs['draggable']) && self::isNo($attrs['draggable'])) {
155
+ $html .= " f.draggable = false;\n";
156
+ }
157
+
158
+ if (isset($attrs['dblclickzoom']) && self::isNo($attrs['dblclickzoom'])) {
159
+ $html .= " f.dblclickZoom = false;\n";
160
+ }
161
+
162
+ if ($directions) {
163
+ $html .= " f.markerDirections = \"$divDirectionsID\";\n";
164
+ }
165
+
166
  if (isset($attrs['maptype'])) {
167
  $html .= " f.mapTypeId = \"{$attrs['maptype']}\";\n";
168
  }
flexible-map.js CHANGED
@@ -6,10 +6,14 @@ copyright (c) 2011-2012 WebAware Pty Ltd, released under LGPL v2.1
6
  function FlexibleMap() {
7
  // set map defaults
8
  this.mapTypeId = google.maps.MapTypeId.ROADMAP;
9
- this.mapTypeControl = false; // no control for changing map type
10
  this.scaleControl = false; // no control for changing scale
 
 
11
  this.streetViewControl = false; // no control for street view
12
  this.scrollwheel = false; // no scroll wheel zoom
 
 
13
  this.zoom = 16; // zoom level, smaller is closer
14
  this.markerTitle = ''; // title for marker info window
15
  this.markerDescription = ''; // description for marker info window
@@ -90,6 +94,9 @@ FlexibleMap.prototype = (function() {
90
 
91
  container.style.fontFamily = "Arial,Helvetica,sans-serif";
92
 
 
 
 
93
  // heading for info window
94
  element = document.createElement("DIV");
95
  element.style.fontWeight = "bold";
@@ -169,13 +176,13 @@ FlexibleMap.prototype = (function() {
169
 
170
  this.markerAddress = address;
171
 
172
- if (this.markerTitle == "")
173
  this.markerTitle = address;
174
 
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 {
@@ -195,6 +202,10 @@ FlexibleMap.prototype = (function() {
195
  mapTypeId: this.mapTypeId,
196
  mapTypeControl: this.mapTypeControl,
197
  scaleControl: this.scaleControl,
 
 
 
 
198
  scrollwheel: this.scrollwheel,
199
  streetViewControl: this.streetViewControl,
200
  navigationControlOptions: this.navigationControlOptions,
@@ -249,7 +260,7 @@ FlexibleMap.prototype = (function() {
249
 
250
  // only process if something was entered to search on
251
  if (/\S/.test(from)) {
252
- var dest = (self.markerAddress == "") ? new google.maps.LatLng(latitude, longitude) : self.markerAddress,
253
  request = {
254
  origin: from,
255
  region: region,
6
  function FlexibleMap() {
7
  // set map defaults
8
  this.mapTypeId = google.maps.MapTypeId.ROADMAP;
9
+ this.mapTypeControl = true; // no control for changing map type
10
  this.scaleControl = false; // no control for changing scale
11
+ this.panControl = false; // no control for panning
12
+ this.zoomControl = true; // show control for zooming
13
  this.streetViewControl = false; // no control for street view
14
  this.scrollwheel = false; // no scroll wheel zoom
15
+ this.draggable = true; // support dragging to pan
16
+ this.dblclickZoom = true; // support double-click zoom
17
  this.zoom = 16; // zoom level, smaller is closer
18
  this.markerTitle = ''; // title for marker info window
19
  this.markerDescription = ''; // description for marker info window
94
 
95
  container.style.fontFamily = "Arial,Helvetica,sans-serif";
96
 
97
+ // add tooltip title for marker
98
+ point.setTitle(this.markerTitle);
99
+
100
  // heading for info window
101
  element = document.createElement("DIV");
102
  element.style.fontWeight = "bold";
176
 
177
  this.markerAddress = address;
178
 
179
+ if (this.markerTitle === "")
180
  this.markerTitle = address;
181
 
182
  geocoder.geocode({address: address}, function(results, status) {
183
  if (status == google.maps.GeocoderStatus.OK) {
184
  var location = results[0].geometry.location,
185
+ centre = [ location.lat(), location.lng() ];
186
  self.showMarker(divID, centre, centre);
187
  }
188
  else {
202
  mapTypeId: this.mapTypeId,
203
  mapTypeControl: this.mapTypeControl,
204
  scaleControl: this.scaleControl,
205
+ panControl: this.panControl,
206
+ zoomControl: this.zoomControl,
207
+ draggable: this.draggable,
208
+ disableDoubleClickZoom: !this.dblclickZoom,
209
  scrollwheel: this.scrollwheel,
210
  streetViewControl: this.streetViewControl,
211
  navigationControlOptions: this.navigationControlOptions,
260
 
261
  // only process if something was entered to search on
262
  if (/\S/.test(from)) {
263
+ var dest = (self.markerAddress === "") ? new google.maps.LatLng(latitude, longitude) : self.markerAddress,
264
  request = {
265
  origin: from,
266
  region: region,
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){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}})}})}}})();
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.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";n.setTitle(this.markerTitle);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.lat(),g.lng()];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,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(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.3
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.4
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
instructions.html CHANGED
@@ -14,12 +14,38 @@
14
  <p>To add a Flexible Map to a post or a page, add a shortcode [flexiblemap] and give it some useful parameters.</p>
15
  <p>Map can either be specified using centre coordinates, or by loading a KML file.</p>
16
 
17
- <h3>Parameters for centre coordinates map:</h3>
18
  <dl class="flxmap-instructions-parameters">
19
  <dt>width</dt>
20
  <dd>width in pixels, e.g. <em>width=&quot;500&quot;</em></dd>
21
  <dt>height</dt>
22
  <dd>height in pixels, e.g. <em>height=&quot;400&quot;</em></dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  <dt>center</dt>
24
  <dd>coordinates of centre in latitude,longitude, e.g. <em>center=&quot;-34.916721,138.828878&quot;</em></dd>
25
  <dt>marker</dt>
@@ -32,12 +58,8 @@
32
  <dd>a description of the marker location (can have HTML links), e.g. <em>description=&quot;Lorem ipsum dolor sit amet&quot;</em></dd>
33
  <dt>directions</dt>
34
  <dd>show directions link in text bubble; by default, directions will be displayed underneath map, but you can specify the element ID for directions here.</dd>
35
- <dt>zoom</dt>
36
- <dd>zoom level as an integer, larger is closer, e.g. <em>zoom=&quot;16&quot;</em></dd>
37
- <dt>maptype</dt>
38
- <dd>type of map to show, from [roadmap, satellite], e.g. <em>maptype=&quot;roadmap&quot;</em></dd>
39
- <dt>hideMapType</dt>
40
- <dd>hide the map type controls, from [true, false], e.g. <em>hideMapType=&quot;true&quot;</em></dd>
41
  <dt>Samples:</dt>
42
  <dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]</code></dd>
43
  <dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]</code></dd>
@@ -46,22 +68,11 @@
46
 
47
  <hr />
48
 
49
- <h3>Parameters for KML map:</h3>
50
  <dl class="flxmap-instructions-parameters">
51
- <dt>width</dt>
52
- <dd>width in pixels, e.g. <em>width=&quot;500&quot;</em></dd>
53
- <dt>height</dt>
54
- <dd>height in pixels, e.g. <em>height=&quot;400&quot;</em></dd>
55
  <dt>src</dt>
56
  <dd>URL for KML file to load map details from, e.g. <em>src=&quot;http://example.com/map.kml&quot;</em></dd>
57
- <dt>zoom</dt>
58
- <dd>zoom level as an integer, larger is closer, e.g. <em>zoom=&quot;16&quot;</em></dd>
59
- <dt>maptype</dt>
60
- <dd>type of map to show, from [roadmap, satellite], e.g. <em>maptype=&quot;roadmap&quot;</em></dd>
61
- <dt>hideMapType</dt>
62
- <dd>hide the map type controls, from [true, false], e.g. <em>hideMapType=&quot;true&quot;</em></dd>
63
- <dt>Sample:</dt>
64
- <dd><code>[flexiblemap src="http://code.google.com/apis/kml/documentation/KML_Samples.kml" width="500" height="400"]</code></dd>
65
  </dl>
66
 
67
  <hr />
14
  <p>To add a Flexible Map to a post or a page, add a shortcode [flexiblemap] and give it some useful parameters.</p>
15
  <p>Map can either be specified using centre coordinates, or by loading a KML file.</p>
16
 
17
+ <h3>Parameters for all maps:</h3>
18
  <dl class="flxmap-instructions-parameters">
19
  <dt>width</dt>
20
  <dd>width in pixels, e.g. <em>width=&quot;500&quot;</em></dd>
21
  <dt>height</dt>
22
  <dd>height in pixels, e.g. <em>height=&quot;400&quot;</em></dd>
23
+ <dt>zoom</dt>
24
+ <dd>zoom level as an integer, larger is closer, e.g. <em>zoom=&quot;16&quot;</em></dd>
25
+ <dt>maptype</dt>
26
+ <dd>type of map to show, from [roadmap, satellite], e.g. <em>maptype=&quot;roadmap&quot;</em>; default=roadmap</dd>
27
+ <dt>hidemaptype</dt>
28
+ <dd>hide the map type controls, from [true, false], e.g. <em>hidemaptype=&quot;true&quot;</em>; default=false</dd>
29
+ <dt>hidepanning</dt>
30
+ <dd>hide the panning controls, from [true, false], e.g. <em>hidepanning=&quot;true&quot;</em>; default=true</dd>
31
+ <dt>hidezooming</dt>
32
+ <dd>hide the zoom controls, from [true, false], e.g. <em>hidezooming=&quot;true&quot;</em>; default=false</dd>
33
+ <dt>hidestreetview</dt>
34
+ <dd>hide the street view control, from [true, false], e.g. <em>hidestreetview=&quot;true&quot;</em>; default=true</dd>
35
+ <dt>hidescale</dt>
36
+ <dd>hide the map scale, from [true, false], e.g. <em>hidescale=&quot;true&quot;</em>; default=true</dd>
37
+ <dt>scrollwheel</dt>
38
+ <dd>enable zoom with mouse scroll wheel, from [true, false], e.g. <em>scrollwheel=&quot;true&quot;</em>; default=false</dd>
39
+ <dt>draggable</dt>
40
+ <dd>enable dragging to pan, from [true, false], e.g. <em>draggable=&quot;true&quot;</em>; default=true</dd>
41
+ <dt>dblclickzoom</dt>
42
+ <dd>enable double-clicking to zoom, from [true, false], e.g. <em>dblclickzoom=&quot;true&quot;</em>; default=true</dd>
43
+ </dl>
44
+
45
+ <hr />
46
+
47
+ <h3>Additional parameters for centre coordinates map:</h3>
48
+ <dl class="flxmap-instructions-parameters">
49
  <dt>center</dt>
50
  <dd>coordinates of centre in latitude,longitude, e.g. <em>center=&quot;-34.916721,138.828878&quot;</em></dd>
51
  <dt>marker</dt>
58
  <dd>a description of the marker location (can have HTML links), e.g. <em>description=&quot;Lorem ipsum dolor sit amet&quot;</em></dd>
59
  <dt>directions</dt>
60
  <dd>show directions link in text bubble; by default, directions will be displayed underneath map, but you can specify the element ID for directions here.</dd>
61
+ <dt>showinfo</dt>
62
+ <dd>show the marker's info window when the map loads, from [true, false], e.g. <em>showinfo=&quot;true&quot;</em>; default=true</dd>
 
 
 
 
63
  <dt>Samples:</dt>
64
  <dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]</code></dd>
65
  <dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]</code></dd>
68
 
69
  <hr />
70
 
71
+ <h3>Additional parameters for KML map:</h3>
72
  <dl class="flxmap-instructions-parameters">
 
 
 
 
73
  <dt>src</dt>
74
  <dd>URL for KML file to load map details from, e.g. <em>src=&quot;http://example.com/map.kml&quot;</em></dd>
75
+ <dd><code>[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="500" height="400"]</code></dd>
 
 
 
 
 
 
 
76
  </dl>
77
 
78
  <hr />
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.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
 
@@ -44,12 +44,25 @@ There are two ways to load maps with this plugin:
44
 
45
  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.
46
 
47
- = Parameters for centre coordinates or street address map =
48
-
49
- 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!)
50
 
51
  * **width**: width in pixels, e.g. *width="500"*
52
  * **height**: height in pixels, e.g. *height="400"*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  * **center**: coordinates of centre in latitude,longitude, e.g. *center="-34.916721,138.828878"*
54
  * **address**: street address of map centre, e.g. *address="116 Beaumont Street Hamilton NSW Australia"*
55
  * **marker**: coordinates of the marker if different from the centre, in latitude,longitude, e.g. *marker="-34.916721,138.828878"*
@@ -57,9 +70,7 @@ Either the center or the address paramater is required. If you provide both, the
57
  * **link**: URL to link from the marker title, e.g. *link="http://example.com/"*
58
  * **description**: a description of the marker location (can have HTML links), e.g. *description="Lorem ipsum dolor sit amet"*
59
  * **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.
60
- * **zoom**: zoom level as an integer, larger is closer, e.g. *zoom="16"*
61
- * **maptype**: type of map to show, from [roadmap, satellite], e.g. *maptype="roadmap"*
62
- * **hideMapType**: hide the map type controls, from [true, false], e.g. *hideMapType="true"*
63
 
64
  *Samples*:
65
  `[flexiblemap center="-34.916721,138.828878" width="500" height="400" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]
@@ -67,17 +78,12 @@ Either the center or the address paramater is required. If you provide both, the
67
  [flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]
68
  [flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="my-dir-div"]`
69
 
70
- = Parameters for KML map =
71
 
72
- * **width**: width in pixels, e.g. *width="500"*
73
- * **height**: height in pixels, e.g. *height="400"*
74
  * **src**: the URL for a KML file to load map details from, e.g. *src="http://example.com/map.kml"*
75
- * **zoom**: zoom level as an integer, larger is closer, e.g. *zoom="16"*
76
- * **maptype**: type of map to show, from [roadmap, satellite], e.g. *maptype="roadmap"*
77
- * **hideMapType**: hide the map type controls, from [true, false], e.g. *hideMapType="true"*
78
 
79
  *Sample*:
80
- `[flexiblemap src="http://code.google.com/apis/kml/documentation/KML_Samples.kml" width="500" height="400"]`
81
 
82
  = Calling from templates or plugins =
83
 
@@ -108,8 +114,17 @@ When you use a street address instead of centre coordinates, you are effectively
108
 
109
  When you use just centre coordinates for your map, the directions may send people to the location *opposite* your location! Yes, I know... anyway, if you specify both the centre coordinates and the street address, the map will be centred correctly and the directions will be to your address.
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
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.4a
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
 
44
 
45
  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.
46
 
47
+ = Parameters for all maps =
 
 
48
 
49
  * **width**: width in pixels, e.g. *width="500"*
50
  * **height**: height in pixels, e.g. *height="400"*
51
+ * **zoom**: zoom level as an integer, larger is closer, e.g. *zoom="16"*
52
+ * **maptype**: type of map to show, from [roadmap, satellite], e.g. *maptype="roadmap"*; default=roadmap
53
+ * **hidemaptype**: hide the map type controls, from [true, false], e.g. *hidemaptype="true"*; default=false
54
+ * **hidepanning**: hide the panning controls, from [true, false], e.g. *hidepanning="true"*; default=true
55
+ * **hidezooming**: hide the zoom controls, from [true, false], e.g. *hidezooming="true"*; default=false
56
+ * **hidestreetview**: hide the street view control, from [true, false], e.g. *hidestreetview="true"*; default=true
57
+ * **hidescale**: hide the map scale, from [true, false], e.g. *hidescale="true"*; default=true
58
+ * **scrollwheel**: enable zoom with mouse scroll wheel, from [true, false], e.g. *scrollwheel="true"*; default=false
59
+ * **draggable**: enable dragging to pan, from [true, false], e.g. *draggable="true"*; default=true
60
+ * **dblclickzoom**: enable double-clicking to zoom, from [true, false], e.g. *dblclickzoom="true"*; default=true
61
+
62
+ = Additional parameters for centre coordinates or street address map =
63
+
64
+ 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!)
65
+
66
  * **center**: coordinates of centre in latitude,longitude, e.g. *center="-34.916721,138.828878"*
67
  * **address**: street address of map centre, e.g. *address="116 Beaumont Street Hamilton NSW Australia"*
68
  * **marker**: coordinates of the marker if different from the centre, in latitude,longitude, e.g. *marker="-34.916721,138.828878"*
70
  * **link**: URL to link from the marker title, e.g. *link="http://example.com/"*
71
  * **description**: a description of the marker location (can have HTML links), e.g. *description="Lorem ipsum dolor sit amet"*
72
  * **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.
73
+ * **showinfo**: show the marker's info window when the map loads, from [true, false], e.g. *showinfo="true"*; default=true
 
 
74
 
75
  *Samples*:
76
  `[flexiblemap center="-34.916721,138.828878" width="500" height="400" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]
78
  [flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]
79
  [flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="my-dir-div"]`
80
 
81
+ = Additional parameters for KML map =
82
 
 
 
83
  * **src**: the URL for a KML file to load map details from, e.g. *src="http://example.com/map.kml"*
 
 
 
84
 
85
  *Sample*:
86
+ `[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="500" height="400"]`
87
 
88
  = Calling from templates or plugins =
89
 
114
 
115
  When you use just centre coordinates for your map, the directions may send people to the location *opposite* your location! Yes, I know... anyway, if you specify both the centre coordinates and the street address, the map will be centred correctly and the directions will be to your address.
116
 
117
+ = Why won't my KML map update when I edit the KML file? =
118
+
119
+ Google Maps API caches the KML file, so it often won't get your new changes. To force a change, append a URL query parameter with a number and increment the number each time your change the KML file. A nice simple and commonly used parameter name is v (for version), like this: .../my-map.kml?v=2
120
+
121
  == Changelog ==
122
 
123
+ = 1.0.4 [2012-03-06] =
124
+ * fixed: use LatLng methods to access latitude/longitude, instead of (ever changing) Google Maps API private members
125
+ * added: tooltip on markers in non-KML maps
126
+ * added: options to disable pan control, zoom control, drag to pan, double-click to zoom
127
+
128
  = 1.0.3 [2012-02-27] =
129
  * fixed: address query updated to work with Google Maps v3.8 (so using address for centre marker works again)
130
  * fixed: tied Google Maps API to v3.8 so newer versions don't break plugin, and will keep updated as API changes