Version Description
Download this release
Release Info
Developer | webaware |
Plugin | Flexible Map |
Version | 1.16.0 |
Comparing to | |
See all releases |
Code changes from version 1.15.0 to 1.16.0
- changelog.md +8 -0
- flexible-map.php +2 -2
- includes/class.FlxMapAdmin.php +2 -0
- includes/class.FlxMapPlugin.php +27 -16
- js/flexible-map.js +51 -6
- js/flexible-map.min.js +1 -1
- readme.txt +17 -18
- views/settings-form.php +9 -0
changelog.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2 |
|
3 |
## Changelog
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
### 1.15.0
|
6 |
|
7 |
Released 2018-07-21
|
2 |
|
3 |
## Changelog
|
4 |
|
5 |
+
### 1.16.0
|
6 |
+
|
7 |
+
Released 2018-09-07
|
8 |
+
|
9 |
+
* added: setting that prevents the plugin from loading the Google Maps API; useful for preventing conflicts
|
10 |
+
* added: attribute [gesturehandling](https://flexible-map.webaware.net.au/manual/attribute-reference/#attr-gesturehandling) for smarter handling of the scroll wheel, drag to pan, double-click to zoom; default = cooperative
|
11 |
+
* deprecated: attributes `scrollwheel`, `draggable`, `dblclickzoom` are supported but not recommended; please use `gesturehandling` instead
|
12 |
+
|
13 |
### 1.15.0
|
14 |
|
15 |
Released 2018-07-21
|
flexible-map.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Flexible Map
|
4 |
Plugin URI: https://flexible-map.webaware.net.au/
|
5 |
Description: Embed Google Maps shortcodes in pages and posts, either by centre coordinates or street address, or by URL to a Google Earth KML file. <a href="https://flexible-map.webaware.net.au/manual/getting-started/">Get started</a> with a simple shortcode. See the <a href="https://flexible-map.webaware.net.au/manual/attribute-reference/">complete attribute reference</a> for more details.
|
6 |
-
Version: 1.
|
7 |
Author: WebAware
|
8 |
Author URI: https://shop.webaware.com.au/
|
9 |
Text Domain: wp-flexible-map
|
@@ -37,7 +37,7 @@ define('FLXMAP_PLUGIN_FILE', __FILE__);
|
|
37 |
define('FLXMAP_PLUGIN_ROOT', dirname(__FILE__) . '/');
|
38 |
define('FLXMAP_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
|
39 |
define('FLXMAP_PLUGIN_OPTIONS', 'flexible_map');
|
40 |
-
define('FLXMAP_PLUGIN_VERSION', '1.
|
41 |
|
42 |
// shortcode tags
|
43 |
define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
|
3 |
Plugin Name: Flexible Map
|
4 |
Plugin URI: https://flexible-map.webaware.net.au/
|
5 |
Description: Embed Google Maps shortcodes in pages and posts, either by centre coordinates or street address, or by URL to a Google Earth KML file. <a href="https://flexible-map.webaware.net.au/manual/getting-started/">Get started</a> with a simple shortcode. See the <a href="https://flexible-map.webaware.net.au/manual/attribute-reference/">complete attribute reference</a> for more details.
|
6 |
+
Version: 1.16.0
|
7 |
Author: WebAware
|
8 |
Author URI: https://shop.webaware.com.au/
|
9 |
Text Domain: wp-flexible-map
|
37 |
define('FLXMAP_PLUGIN_ROOT', dirname(__FILE__) . '/');
|
38 |
define('FLXMAP_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
|
39 |
define('FLXMAP_PLUGIN_OPTIONS', 'flexible_map');
|
40 |
+
define('FLXMAP_PLUGIN_VERSION', '1.16.0');
|
41 |
|
42 |
// shortcode tags
|
43 |
define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
|
includes/class.FlxMapAdmin.php
CHANGED
@@ -48,6 +48,7 @@ class FlxMapAdmin {
|
|
48 |
$options = wp_parse_args($options, array(
|
49 |
'apiKey' => '',
|
50 |
'apiServerKey' => '',
|
|
|
51 |
));
|
52 |
|
53 |
require FLXMAP_PLUGIN_ROOT . 'views/settings-form.php';
|
@@ -63,6 +64,7 @@ class FlxMapAdmin {
|
|
63 |
|
64 |
$output['apiKey'] = trim(strip_tags($input['apiKey']));
|
65 |
$output['apiServerKey'] = trim(strip_tags($input['apiServerKey']));
|
|
|
66 |
|
67 |
return $output;
|
68 |
}
|
48 |
$options = wp_parse_args($options, array(
|
49 |
'apiKey' => '',
|
50 |
'apiServerKey' => '',
|
51 |
+
'noAPI' => 0,
|
52 |
));
|
53 |
|
54 |
require FLXMAP_PLUGIN_ROOT . 'views/settings-form.php';
|
64 |
|
65 |
$output['apiKey'] = trim(strip_tags($input['apiKey']));
|
66 |
$output['apiServerKey'] = trim(strip_tags($input['apiServerKey']));
|
67 |
+
$output['noAPI'] = !empty($input['noAPI']);
|
68 |
|
69 |
return $output;
|
70 |
}
|
includes/class.FlxMapPlugin.php
CHANGED
@@ -86,20 +86,22 @@ class FlxMapPlugin {
|
|
86 |
public function enqueueScripts() {
|
87 |
$options = get_option(FLXMAP_PLUGIN_OPTIONS, array());
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
98 |
}
|
99 |
|
100 |
$min = SCRIPT_DEBUG ? '' : '.min';
|
101 |
$ver = SCRIPT_DEBUG ? time() : FLXMAP_PLUGIN_VERSION;
|
102 |
-
wp_register_script('flxmap', plugins_url("js/flexible-map$min.js", FLXMAP_PLUGIN_FILE), array(
|
103 |
|
104 |
// theme writers: you can remove this stylesheet by calling wp_dequeue_script('flxmap');
|
105 |
wp_enqueue_style('flxmap', plugins_url('css/styles.css', FLXMAP_PLUGIN_FILE), false, $ver);
|
@@ -253,16 +255,21 @@ HTML;
|
|
253 |
$script .= " f.markerShowInfo = false;\n";
|
254 |
}
|
255 |
|
256 |
-
if (isset($attrs['
|
257 |
-
$script .= " f.
|
258 |
}
|
|
|
|
|
|
|
|
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
|
264 |
-
|
265 |
-
|
|
|
266 |
}
|
267 |
|
268 |
if (isset($attrs['directions'])) {
|
@@ -488,6 +495,10 @@ HTML;
|
|
488 |
$html = apply_filters('flexmap_shortcode_html', $html, $attrs);
|
489 |
|
490 |
// enqueue scripts
|
|
|
|
|
|
|
|
|
491 |
wp_enqueue_script('flxmap');
|
492 |
if ($this->locale != '' && $this->locale != 'en_US') {
|
493 |
$this->enqueueLocale($this->locale);
|
86 |
public function enqueueScripts() {
|
87 |
$options = get_option(FLXMAP_PLUGIN_OPTIONS, array());
|
88 |
|
89 |
+
if (empty($options['noAPI'])) {
|
90 |
+
$args = array('v' => '3.32');
|
91 |
+
if (!empty($options['apiKey'])) {
|
92 |
+
$args['key'] = $options['apiKey'];
|
93 |
+
}
|
94 |
+
$args = apply_filters('flexmap_google_maps_api_args', $args);
|
95 |
|
96 |
+
$apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, 'https://maps.google.com/maps/api/js'));
|
97 |
+
if (!empty($apiURL)) {
|
98 |
+
wp_register_script('google-maps', $apiURL, false, null, true);
|
99 |
+
}
|
100 |
}
|
101 |
|
102 |
$min = SCRIPT_DEBUG ? '' : '.min';
|
103 |
$ver = SCRIPT_DEBUG ? time() : FLXMAP_PLUGIN_VERSION;
|
104 |
+
wp_register_script('flxmap', plugins_url("js/flexible-map$min.js", FLXMAP_PLUGIN_FILE), array(), $ver, true);
|
105 |
|
106 |
// theme writers: you can remove this stylesheet by calling wp_dequeue_script('flxmap');
|
107 |
wp_enqueue_style('flxmap', plugins_url('css/styles.css', FLXMAP_PLUGIN_FILE), false, $ver);
|
255 |
$script .= " f.markerShowInfo = false;\n";
|
256 |
}
|
257 |
|
258 |
+
if (isset($attrs['gesturehandling']) && preg_match('/cooperative|greedy|none|auto/i', $attrs['gesturehandling'])) {
|
259 |
+
$script .= sprintf(" f.gestureHandling = '%s';\n", strtolower(trim($attrs['gesturehandling'])));
|
260 |
}
|
261 |
+
else {
|
262 |
+
if (isset($attrs['scrollwheel']) && self::isYes($attrs['scrollwheel'])) {
|
263 |
+
$script .= " f.scrollwheel = true;\n";
|
264 |
+
}
|
265 |
|
266 |
+
if (isset($attrs['draggable']) && self::isNo($attrs['draggable'])) {
|
267 |
+
$script .= " f.draggable = false;\n";
|
268 |
+
}
|
269 |
|
270 |
+
if (isset($attrs['dblclickzoom']) && self::isNo($attrs['dblclickzoom'])) {
|
271 |
+
$script .= " f.dblclickZoom = false;\n";
|
272 |
+
}
|
273 |
}
|
274 |
|
275 |
if (isset($attrs['directions'])) {
|
495 |
$html = apply_filters('flexmap_shortcode_html', $html, $attrs);
|
496 |
|
497 |
// enqueue scripts
|
498 |
+
$options = get_option(FLXMAP_PLUGIN_OPTIONS, array());
|
499 |
+
if (empty($options['noAPI'])) {
|
500 |
+
wp_enqueue_script('google-maps');
|
501 |
+
}
|
502 |
wp_enqueue_script('flxmap');
|
503 |
if ($this->locale != '' && $this->locale != 'en_US') {
|
504 |
$this->enqueueLocale($this->locale);
|
js/flexible-map.js
CHANGED
@@ -15,6 +15,52 @@ window.FlexibleMap = function() {
|
|
15 |
kmlLayer, // if map has a KML layer, this is the layer object
|
16 |
hasRedrawn = false; // boolean, whether map has been asked to redrawOnce() already
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* get the Google Maps API Map object
|
20 |
* @return {google.maps.Map}
|
@@ -138,12 +184,10 @@ window.FlexibleMap = function() {
|
|
138 |
zoomControl: this.zoomControl,
|
139 |
zoomControlOptions: { style: zoomControlStyle },
|
140 |
fullscreenControl: this.fullscreen,
|
141 |
-
draggable: this.draggable,
|
142 |
-
disableDoubleClickZoom: !this.dblclickZoom,
|
143 |
-
scrollwheel: this.scrollwheel,
|
144 |
center: centre,
|
145 |
zoom: this.zoom
|
146 |
};
|
|
|
147 |
|
148 |
// select which map types for map type control, if specified as comma-separated list of map type IDs
|
149 |
if (this.mapTypeIds) {
|
@@ -218,9 +262,10 @@ window.FlexibleMap = function() {
|
|
218 |
this.zoomControlStyle = "small"; // from "small", "large", "default"
|
219 |
this.streetViewControl = false; // no control for street view
|
220 |
this.fullscreen = true; // show control for full-screen view
|
221 |
-
this.
|
222 |
-
this.
|
223 |
-
this.
|
|
|
224 |
this.zoom = 16; // zoom level, smaller is closer
|
225 |
this.markerTitle = ""; // title for marker info window
|
226 |
this.markerDescription = ""; // description for marker info window
|
15 |
kmlLayer, // if map has a KML layer, this is the layer object
|
16 |
hasRedrawn = false; // boolean, whether map has been asked to redrawOnce() already
|
17 |
|
18 |
+
/**
|
19 |
+
* set gesture handling options, with legacy support for draggable, dblclickZoom, scrollwheel
|
20 |
+
* set to "cooperative" if none of the settings are given
|
21 |
+
* @link https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.gestureHandling
|
22 |
+
* @param {Object} mapOptions
|
23 |
+
* @param {FlexibleMap} flexibleMap
|
24 |
+
* @return {Object}
|
25 |
+
*/
|
26 |
+
function getGestureHandling(mapOptions, flexibleMap) {
|
27 |
+
if (flexibleMap.gestureHandling !== undefined) {
|
28 |
+
mapOptions.gestureHandling = flexibleMap.gestureHandling;
|
29 |
+
}
|
30 |
+
else if (flexibleMap.draggable === undefined && flexibleMap.dblclickZoom === undefined && flexibleMap.scrollwheel === undefined) {
|
31 |
+
mapOptions.gestureHandling = "cooperative";
|
32 |
+
}
|
33 |
+
else {
|
34 |
+
// legacy support; deprecated
|
35 |
+
var draggable = (flexibleMap.draggable === undefined) ? true : flexibleMap.draggable; // default true, i.e. enable draggable
|
36 |
+
var disableDblclickZoom = (flexibleMap.dblclickZoom === undefined) ? false : !flexibleMap.draggable; // default true, i.e. enable double-click zoom
|
37 |
+
var scrollwheel = (flexibleMap.scrollwheel === undefined) ? false : flexibleMap.scrollwheel; // default false, i.e. dinable scrollwheel
|
38 |
+
|
39 |
+
// ----------------+-----------+------------------------+------------
|
40 |
+
// gestureHandling | draggable | disableDoubleClickZoom | scrollwheel
|
41 |
+
// ----------------+-----------+------------------------+------------
|
42 |
+
// cooperative | true | false | ctrl+ |
|
43 |
+
// greedy | true | false | true |
|
44 |
+
// auto | ???? | false | ???? |
|
45 |
+
// none | false | true | false |
|
46 |
+
// ----------------+-----------+------------------------+------------
|
47 |
+
|
48 |
+
if (!draggable && disableDblclickZoom && !scrollwheel) {
|
49 |
+
mapOptions.gestureHandling = "none";
|
50 |
+
}
|
51 |
+
else if (draggable && !disableDblclickZoom && scrollwheel) {
|
52 |
+
mapOptions.gestureHandling = "greedy";
|
53 |
+
}
|
54 |
+
else {
|
55 |
+
mapOptions.draggable = draggable;
|
56 |
+
mapOptions.disableDoubleClickZoom = disableDblclickZoom;
|
57 |
+
mapOptions.scrollwheel = scrollwheel;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
return mapOptions;
|
62 |
+
}
|
63 |
+
|
64 |
/**
|
65 |
* get the Google Maps API Map object
|
66 |
* @return {google.maps.Map}
|
184 |
zoomControl: this.zoomControl,
|
185 |
zoomControlOptions: { style: zoomControlStyle },
|
186 |
fullscreenControl: this.fullscreen,
|
|
|
|
|
|
|
187 |
center: centre,
|
188 |
zoom: this.zoom
|
189 |
};
|
190 |
+
mapOptions = getGestureHandling(mapOptions, this);
|
191 |
|
192 |
// select which map types for map type control, if specified as comma-separated list of map type IDs
|
193 |
if (this.mapTypeIds) {
|
262 |
this.zoomControlStyle = "small"; // from "small", "large", "default"
|
263 |
this.streetViewControl = false; // no control for street view
|
264 |
this.fullscreen = true; // show control for full-screen view
|
265 |
+
this.gestureHandling = undefined; // defaults to cooperative
|
266 |
+
this.scrollwheel = undefined; // deprecated; use gestureHandling instead
|
267 |
+
this.draggable = undefined; // deprecated; use gestureHandling instead
|
268 |
+
this.dblclickZoom = undefined; // deprecated; use gestureHandling instead
|
269 |
this.zoom = 16; // zoom level, smaller is closer
|
270 |
this.markerTitle = ""; // title for marker info window
|
271 |
this.markerDescription = ""; // description for marker info window
|
js/flexible-map.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
// Flexible Map
|
2 |
// https://flexible-map.webaware.net.au/
|
3 |
|
4 |
-
window.FlexibleMap=function(){"use strict";var n,a,t,i,r,o,e=!1;this.getMap=function(){return n},this.getCenter=function(){return a},this.setCenter=function(e){a=e,n.setCenter(a)},this.setMarkerLocation=function(e){t=e},this.getMarkerLocation=function(){return t},this.setMarkerPoint=function(e){i=e},this.getMarkerPoint=function(){return i},this.setMarkerInfowin=function(e){r=e},this.getMarkerInfowin=function(){return r},this.getKmlLayer=function(){return o},this.redrawOnce=function(){e||(e=!0,this.redraw())},this.showMap=function(e,t){a=new google.maps.LatLng(t[0],t[1]);var i,r={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,default:google.maps.ZoomControlStyle.DEFAULT},o=r.small;return this.zoomControlStyle in r&&(o=r[this.zoomControlStyle]),i={mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:o},fullscreenControl:this.fullscreen,draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,center:a,zoom:this.zoom},this.mapTypeIds&&(i.mapTypeControlOptions={mapTypeIds:this.mapTypeIds.split(",")}),n=new google.maps.Map(document.getElementById(e),i),this.mapTypeId in this.mapTypes&&n.mapTypes.set(this.mapTypeId,this.mapTypes[this.mapTypeId]._styled_map),n},this.loadKmlMap=function(e){var t=this,i={map:n,url:e};return this.kmlCentre&&(i.preserveViewport=!0,i.center=new google.maps.LatLng(this.kmlCentre[0],this.kmlCentre[1])),o=new google.maps.KmlLayer(i),google.maps.event.addListenerOnce(o,"defaultviewport_changed",this.kmlCentre?function(){t.setCenter(new google.maps.LatLng(t.kmlCentre[0],t.kmlCentre[1]))}:function(){a=o.getDefaultViewport().getCenter()}),o},!this.localised&&"flxmap"in window&&this.localise(),this.mapTypeId=google.maps.MapTypeId.ROADMAP,this.mapTypeControl=!0,this.scaleControl=!1,this.panControl=!1,this.zoomControl=!0,this.zoomControlStyle="small",this.streetViewControl=!1,this.fullscreen=!0,this.scrollwheel=!1,this.draggable=!0,this.dblclickZoom=!0,this.zoom=16,this.markerTitle="",this.markerDescription="",this.markerHTML="",this.markerLink="",this.markerLinkTarget="",this.markerLinkText=!1,this.markerIcon="",this.markerShowInfo=!0,this.markerAnimation="drop",this.markerDirections=!1,this.markerDirectionsShow=!1,this.markerDirectionsDefault="",this.markerAddress="",this.targetFix=!0,this.dirService=!1,this.dirRenderer=!1,this.dirDraggable=!1,this.dirSuppressMarkers=!1,this.dirShowSteps=!0,this.dirShowSearch=!0,this.dirTravelMode="driving",this.dirUnitSystem=void 0,this.region="",this.locale="en",this.localeActive=!1,this.kmlCentre=!1,this.kmlcache="none"},FlexibleMap.prototype=function(){"use strict";var k,v,w;document.addEventListener?(k=function(e,t,i){e.addEventListener(t,i,!1)},v=function(e){e.stopPropagation(),e.preventDefault()}):document.attachEvent&&(k=function(e,t,i){e.attachEvent("on"+t,function(){i.call(e,window.event)})},v=function(e){e.cancelBubble=!0,e.returnValue=0}),w="undefined"!=typeof MutationObserver?function(i,e){var r=document.getElementById(e).parentNode;function o(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}o(r)&&new MutationObserver(function(e,t){o(r)||(i.redrawOnce(),t.disconnect())}).observe(r,{attributes:!0,attributeFilter:["style"]})}:function(){};var l=function(){function t(e){var t=e.charCodeAt(0),i=t.toString(16);return t<256?"\\x"+("00"+i).slice(-2):"\\u"+("0000"+i).slice(-4)}return function(e){return e.replace(/[\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,t)}}();return{constructor:FlexibleMap,i18n:{},mapTypes:{},localised:!1,localise:function(){var e,t;if("i18n"in flxmap&&(FlexibleMap.prototype.i18n=flxmap.i18n),"mapTypes"in flxmap){for(e in t=flxmap.mapTypes)t[e]._styled_map=new google.maps.StyledMapType(t[e].styles,t[e].options);FlexibleMap.prototype.mapTypes=t}FlexibleMap.prototype.localised=!0},setlocale:function(e){return(this.locale=e)in this.i18n?this.localeActive=e:e.substr(0,2)in this.i18n?this.localeActive=e:this.localeActive=!1,this.localeActive},gettext:function(e){var t=this.localeActive;return t&&e in this.i18n[t]?this.i18n[t][e]:e},showKML:function(e,t,i){void 0!==i&&(this.zoom=i);var a=this,r=document.getElementById(e),s=r.getAttribute("data-flxmap"),o=this.showMap(e,[0,0]),n=this.loadKmlMap(function(e,t){var i,r,o,n=/^(\d+)\s*(minute|hour|day)s?$/.exec(t);if(n){switch(i=(new Date).getTime(),o=+n[1],n[2]){case"minute":o<5&&(o=5),r=i/(6e4*o);break;case"hour":r=i/(36e5*o);break;case"day":r=i/(864e5*o);break;default:r=!1}r&&(r=Math.floor(r),e+=(-1<e.indexOf("?")?"&":"?")+"nocache="+r)}return e}(t,this.kmlcache));w(this,e),void 0!==i&&google.maps.event.addListenerOnce(o,"zoom_changed",function(){o.setZoom(i),a.zoom=i}),(this.markerDirections||this.markerDirectionsShow)&&this.startDirService(o),google.maps.event.addListener(n,"click",function(e){var t=e.featureData;if(!t._flxmapOnce){if(t._flxmapOnce=!0,a.targetFix&&t.description){var i=/ target="_blank"/gi;t.description=t.description.replace(i,""),t.infoWindowHtml=t.infoWindowHtml.replace(i,"")}if(a.markerDirections){var r=e.latLng,o=r.lat()+","+r.lng()+",'"+l(t.name)+"',true",n='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+s+".showDirections("+o+'); return false;">'+a.gettext("Directions")+"</a>";t.infoWindowHtml=t.infoWindowHtml.replace(/<\/div><\/div>$/i,n+"</div></div>")}}}),window.opera&&this.markerDirections&&k(r,"click",function(e){e.target.getAttribute("data-flxmap-fix-opera")&&v(e)})},showMarker:function(e,t,i){var r=this.showMap(e,t),o=new google.maps.LatLng(i[0],i[1]),n={map:r,position:o,icon:this.markerIcon},a=google.maps.Animation;switch(this.markerAnimation){case"drop":n.animation=a.DROP;break;case"bounce":n.animation=a.BOUNCE}var s=new google.maps.Marker(n);if(this.setMarkerPoint(s),this.setMarkerLocation(o),w(this,e),this.markerTitle||(this.markerTitle=this.markerAddress),this.markerTitle||this.markerHTML||this.markerDescription||this.markerLink||this.markerDirections){var l,c,d,m,h,p,u=this,g=document.createElement("DIV");if(g.className="flxmap-infowin",(h=document.createElement("DIV")).className="flxmap-marker-title",this.markerTitle&&(h.appendChild(document.createTextNode(this.markerTitle)),s.setTitle(this.markerTitle)),g.appendChild(h),this.markerHTML&&((h=document.createElement("DIV")).innerHTML=this.markerHTML,g.appendChild(h)),this.markerDescription||this.markerLink){if((h=document.createElement("DIV")).className="flxmap-marker-link",this.markerDescription){for(l=0,c=(d=this.markerDescription.split("\n")).length;l<c;l++)0<l&&h.appendChild(document.createElement("BR")),h.appendChild(document.createTextNode(d[l]));this.markerLink&&h.appendChild(document.createElement("BR"))}this.markerLink&&((p=document.createElement("A")).href=this.markerLink,this.markerLinkTarget&&(p.target=this.markerLinkTarget),p.appendChild(document.createTextNode(this.markerLinkText||this.gettext("Click for details"))),h.appendChild(p)),g.appendChild(h)}this.markerDirections&&((h=document.createElement("DIV")).className="flxmap-directions-link",(p=document.createElement("A")).href="#",p.dataLatitude=i[0],p.dataLongitude=i[1],k(p,"click",function(e){v(e),u.showDirections(this.dataLatitude,this.dataLongitude,!0)}),p.appendChild(document.createTextNode(this.gettext("Directions"))),h.appendChild(p),g.appendChild(h)),m=new google.maps.InfoWindow({content:g}),this.setMarkerInfowin(m),this.markerShowInfo&&google.maps.event.addListenerOnce(r,"tilesloaded",function(){m.open(r,s)}),google.maps.event.addListener(s,"click",function(){m.open(r,s)});var f=function(){u.updateGoogleLink()};google.maps.event.addListener(r,"idle",f),google.maps.event.addListener(r,"center_changed",f),google.maps.event.addListenerOnce(r,"tilesloaded",f)}(this.markerDirections||this.markerDirectionsShow)&&(this.startDirService(r),this.markerDirectionsShow&&this.showDirections(i[0],i[1],!1))},showAddress:function(o,e){var n=this,t=new google.maps.Geocoder;this.markerAddress=e,""===this.markerTitle&&(this.markerTitle=e),t.geocode({address:e,region:this.region},function(e,t){if(t===google.maps.GeocoderStatus.OK){var i=e[0].geometry.location,r=[i.lat(),i.lng()];n.showMarker(o,r,r)}else window.alert("Map address returns error: "+t)})},updateGoogleLink:function(){if("querySelectorAll"in document)try{for(var e=this.getMap().getDiv(),t=this.getMarkerLocation(),i=e.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),r=0,o=i.length,n=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+t.lat()+","+t.lng());r<o;r++)i[r].href+="&mrt=loc&iwloc=A&q="+n}catch(e){}},redraw:function(){var e=this.getMap(),t=this.getKmlLayer();if(google.maps.event.trigger(e,"resize"),t)e.fitBounds(t.getDefaultViewport());else{e.setCenter(this.getCenter()),e.setZoom(this.zoom);var i=this.getMarkerInfowin();i&&i.open(e,this.getMarkerPoint())}},startDirService:function(e){this.dirService||(this.dirService=new google.maps.DirectionsService),this.dirRenderer||(this.dirRenderer=new google.maps.DirectionsRenderer({map:e,draggable:this.dirDraggable,suppressMarkers:this.dirSuppressMarkers,panel:this.dirShowSteps?document.getElementById(this.markerDirectionsDiv):null}))},showDirections:function(i,r,n){var a=this;function s(e){var t={origin:e,destination:""===a.markerAddress?new google.maps.LatLng(i,r):a.markerAddress};switch(a.region&&(t.region=a.region),a.dirTravelMode){case"bicycling":t.travelMode=google.maps.TravelMode.BICYCLING;break;case"driving":t.travelMode=google.maps.TravelMode.DRIVING;break;case"transit":t.travelMode=google.maps.TravelMode.TRANSIT;break;case"walking":t.travelMode=google.maps.TravelMode.WALKING}switch(a.dirUnitSystem){case"imperial":t.unitSystem=google.maps.UnitSystem.IMPERIAL;break;case"metric":t.unitSystem=google.maps.UnitSystem.METRIC}a.dirService.route(t,o)}function o(e,t){var i=google.maps.DirectionsStatus;switch(t){case i.OK:a.dirRenderer.setDirections(e);break;case i.ZERO_RESULTS:window.alert("No route could be found between the origin and destination.");break;case i.OVER_QUERY_LIMIT:window.alert("The webpage has gone over the requests limit in too short a period of time.");break;case i.REQUEST_DENIED:window.alert("The webpage is not allowed to use the directions service.");break;case i.INVALID_REQUEST:window.alert("Invalid directions request.");break;case i.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.")}}this.markerDirectionsDiv&&this.dirShowSearch&&function(){var e,t,i,r=document.getElementById(a.markerDirectionsDiv),o=document.createElement("form");for(t=r.lastChild;t;t=r.lastChild)r.removeChild(t);(t=document.createElement("p")).appendChild(document.createTextNode(a.gettext("From")+": ")),(i=document.createElement("input")).type="text",i.name="from",i.value=a.markerDirectionsDefault,t.appendChild(i),(e=document.createElement("input")).type="submit",e.value=a.gettext("Get directions"),t.appendChild(e),o.appendChild(t),r.appendChild(o),void 0===o.elements.from&&(o.elements.from=i),n&&i.focus(),k(o,"submit",function(e){v(e);var t=this.elements.from.value;/\S/.test(t)&&s(t)})}(),this.markerDirectionsDefault&&s(this.markerDirectionsDefault)}}}();
|
1 |
// Flexible Map
|
2 |
// https://flexible-map.webaware.net.au/
|
3 |
|
4 |
+
window.FlexibleMap=function(){"use strict";var n,a,t,i,r,o,e=!1;this.getMap=function(){return n},this.getCenter=function(){return a},this.setCenter=function(e){a=e,n.setCenter(a)},this.setMarkerLocation=function(e){t=e},this.getMarkerLocation=function(){return t},this.setMarkerPoint=function(e){i=e},this.getMarkerPoint=function(){return i},this.setMarkerInfowin=function(e){r=e},this.getMarkerInfowin=function(){return r},this.getKmlLayer=function(){return o},this.redrawOnce=function(){e||(e=!0,this.redraw())},this.showMap=function(e,t){a=new google.maps.LatLng(t[0],t[1]);var i,r={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,default:google.maps.ZoomControlStyle.DEFAULT},o=r.small;return this.zoomControlStyle in r&&(o=r[this.zoomControlStyle]),i=function(e,t){if(void 0!==t.gestureHandling)e.gestureHandling=t.gestureHandling;else if(void 0===t.draggable&&void 0===t.dblclickZoom&&void 0===t.scrollwheel)e.gestureHandling="cooperative";else{var i=void 0===t.draggable||t.draggable,r=void 0!==t.dblclickZoom&&!t.draggable,o=void 0!==t.scrollwheel&&t.scrollwheel;i||!r||o?i&&!r&&o?e.gestureHandling="greedy":(e.draggable=i,e.disableDoubleClickZoom=r,e.scrollwheel=o):e.gestureHandling="none"}return e}(i={mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:o},fullscreenControl:this.fullscreen,center:a,zoom:this.zoom},this),this.mapTypeIds&&(i.mapTypeControlOptions={mapTypeIds:this.mapTypeIds.split(",")}),n=new google.maps.Map(document.getElementById(e),i),this.mapTypeId in this.mapTypes&&n.mapTypes.set(this.mapTypeId,this.mapTypes[this.mapTypeId]._styled_map),n},this.loadKmlMap=function(e){var t=this,i={map:n,url:e};return this.kmlCentre&&(i.preserveViewport=!0,i.center=new google.maps.LatLng(this.kmlCentre[0],this.kmlCentre[1])),o=new google.maps.KmlLayer(i),google.maps.event.addListenerOnce(o,"defaultviewport_changed",this.kmlCentre?function(){t.setCenter(new google.maps.LatLng(t.kmlCentre[0],t.kmlCentre[1]))}:function(){a=o.getDefaultViewport().getCenter()}),o},!this.localised&&"flxmap"in window&&this.localise(),this.mapTypeId=google.maps.MapTypeId.ROADMAP,this.mapTypeControl=!0,this.scaleControl=!1,this.panControl=!1,this.zoomControl=!0,this.zoomControlStyle="small",this.streetViewControl=!1,this.fullscreen=!0,this.gestureHandling=void 0,this.scrollwheel=void 0,this.draggable=void 0,this.dblclickZoom=void 0,this.zoom=16,this.markerTitle="",this.markerDescription="",this.markerHTML="",this.markerLink="",this.markerLinkTarget="",this.markerLinkText=!1,this.markerIcon="",this.markerShowInfo=!0,this.markerAnimation="drop",this.markerDirections=!1,this.markerDirectionsShow=!1,this.markerDirectionsDefault="",this.markerAddress="",this.targetFix=!0,this.dirService=!1,this.dirRenderer=!1,this.dirDraggable=!1,this.dirSuppressMarkers=!1,this.dirShowSteps=!0,this.dirShowSearch=!0,this.dirTravelMode="driving",this.dirUnitSystem=void 0,this.region="",this.locale="en",this.localeActive=!1,this.kmlCentre=!1,this.kmlcache="none"},FlexibleMap.prototype=function(){"use strict";var k,v,w;document.addEventListener?(k=function(e,t,i){e.addEventListener(t,i,!1)},v=function(e){e.stopPropagation(),e.preventDefault()}):document.attachEvent&&(k=function(e,t,i){e.attachEvent("on"+t,function(){i.call(e,window.event)})},v=function(e){e.cancelBubble=!0,e.returnValue=0}),w="undefined"!=typeof MutationObserver?function(i,e){var r=document.getElementById(e).parentNode;function o(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}o(r)&&new MutationObserver(function(e,t){o(r)||(i.redrawOnce(),t.disconnect())}).observe(r,{attributes:!0,attributeFilter:["style"]})}:function(){};var l=function(){function t(e){var t=e.charCodeAt(0),i=t.toString(16);return t<256?"\\x"+("00"+i).slice(-2):"\\u"+("0000"+i).slice(-4)}return function(e){return e.replace(/[\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,t)}}();return{constructor:FlexibleMap,i18n:{},mapTypes:{},localised:!1,localise:function(){var e,t;if("i18n"in flxmap&&(FlexibleMap.prototype.i18n=flxmap.i18n),"mapTypes"in flxmap){for(e in t=flxmap.mapTypes)t[e]._styled_map=new google.maps.StyledMapType(t[e].styles,t[e].options);FlexibleMap.prototype.mapTypes=t}FlexibleMap.prototype.localised=!0},setlocale:function(e){return(this.locale=e)in this.i18n?this.localeActive=e:e.substr(0,2)in this.i18n?this.localeActive=e:this.localeActive=!1,this.localeActive},gettext:function(e){var t=this.localeActive;return t&&e in this.i18n[t]?this.i18n[t][e]:e},showKML:function(e,t,i){void 0!==i&&(this.zoom=i);var a=this,r=document.getElementById(e),s=r.getAttribute("data-flxmap"),o=this.showMap(e,[0,0]),n=this.loadKmlMap(function(e,t){var i,r,o,n=/^(\d+)\s*(minute|hour|day)s?$/.exec(t);if(n){switch(i=(new Date).getTime(),o=+n[1],n[2]){case"minute":o<5&&(o=5),r=i/(6e4*o);break;case"hour":r=i/(36e5*o);break;case"day":r=i/(864e5*o);break;default:r=!1}r&&(r=Math.floor(r),e+=(-1<e.indexOf("?")?"&":"?")+"nocache="+r)}return e}(t,this.kmlcache));w(this,e),void 0!==i&&google.maps.event.addListenerOnce(o,"zoom_changed",function(){o.setZoom(i),a.zoom=i}),(this.markerDirections||this.markerDirectionsShow)&&this.startDirService(o),google.maps.event.addListener(n,"click",function(e){var t=e.featureData;if(!t._flxmapOnce){if(t._flxmapOnce=!0,a.targetFix&&t.description){var i=/ target="_blank"/gi;t.description=t.description.replace(i,""),t.infoWindowHtml=t.infoWindowHtml.replace(i,"")}if(a.markerDirections){var r=e.latLng,o=r.lat()+","+r.lng()+",'"+l(t.name)+"',true",n='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+s+".showDirections("+o+'); return false;">'+a.gettext("Directions")+"</a>";t.infoWindowHtml=t.infoWindowHtml.replace(/<\/div><\/div>$/i,n+"</div></div>")}}}),window.opera&&this.markerDirections&&k(r,"click",function(e){e.target.getAttribute("data-flxmap-fix-opera")&&v(e)})},showMarker:function(e,t,i){var r=this.showMap(e,t),o=new google.maps.LatLng(i[0],i[1]),n={map:r,position:o,icon:this.markerIcon},a=google.maps.Animation;switch(this.markerAnimation){case"drop":n.animation=a.DROP;break;case"bounce":n.animation=a.BOUNCE}var s=new google.maps.Marker(n);if(this.setMarkerPoint(s),this.setMarkerLocation(o),w(this,e),this.markerTitle||(this.markerTitle=this.markerAddress),this.markerTitle||this.markerHTML||this.markerDescription||this.markerLink||this.markerDirections){var l,d,c,m,h,p,g=this,u=document.createElement("DIV");if(u.className="flxmap-infowin",(h=document.createElement("DIV")).className="flxmap-marker-title",this.markerTitle&&(h.appendChild(document.createTextNode(this.markerTitle)),s.setTitle(this.markerTitle)),u.appendChild(h),this.markerHTML&&((h=document.createElement("DIV")).innerHTML=this.markerHTML,u.appendChild(h)),this.markerDescription||this.markerLink){if((h=document.createElement("DIV")).className="flxmap-marker-link",this.markerDescription){for(l=0,d=(c=this.markerDescription.split("\n")).length;l<d;l++)0<l&&h.appendChild(document.createElement("BR")),h.appendChild(document.createTextNode(c[l]));this.markerLink&&h.appendChild(document.createElement("BR"))}this.markerLink&&((p=document.createElement("A")).href=this.markerLink,this.markerLinkTarget&&(p.target=this.markerLinkTarget),p.appendChild(document.createTextNode(this.markerLinkText||this.gettext("Click for details"))),h.appendChild(p)),u.appendChild(h)}this.markerDirections&&((h=document.createElement("DIV")).className="flxmap-directions-link",(p=document.createElement("A")).href="#",p.dataLatitude=i[0],p.dataLongitude=i[1],k(p,"click",function(e){v(e),g.showDirections(this.dataLatitude,this.dataLongitude,!0)}),p.appendChild(document.createTextNode(this.gettext("Directions"))),h.appendChild(p),u.appendChild(h)),m=new google.maps.InfoWindow({content:u}),this.setMarkerInfowin(m),this.markerShowInfo&&google.maps.event.addListenerOnce(r,"tilesloaded",function(){m.open(r,s)}),google.maps.event.addListener(s,"click",function(){m.open(r,s)});var f=function(){g.updateGoogleLink()};google.maps.event.addListener(r,"idle",f),google.maps.event.addListener(r,"center_changed",f),google.maps.event.addListenerOnce(r,"tilesloaded",f)}(this.markerDirections||this.markerDirectionsShow)&&(this.startDirService(r),this.markerDirectionsShow&&this.showDirections(i[0],i[1],!1))},showAddress:function(o,e){var n=this,t=new google.maps.Geocoder;this.markerAddress=e,""===this.markerTitle&&(this.markerTitle=e),t.geocode({address:e,region:this.region},function(e,t){if(t===google.maps.GeocoderStatus.OK){var i=e[0].geometry.location,r=[i.lat(),i.lng()];n.showMarker(o,r,r)}else window.alert("Map address returns error: "+t)})},updateGoogleLink:function(){if("querySelectorAll"in document)try{for(var e=this.getMap().getDiv(),t=this.getMarkerLocation(),i=e.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),r=0,o=i.length,n=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+t.lat()+","+t.lng());r<o;r++)i[r].href+="&mrt=loc&iwloc=A&q="+n}catch(e){}},redraw:function(){var e=this.getMap(),t=this.getKmlLayer();if(google.maps.event.trigger(e,"resize"),t)e.fitBounds(t.getDefaultViewport());else{e.setCenter(this.getCenter()),e.setZoom(this.zoom);var i=this.getMarkerInfowin();i&&i.open(e,this.getMarkerPoint())}},startDirService:function(e){this.dirService||(this.dirService=new google.maps.DirectionsService),this.dirRenderer||(this.dirRenderer=new google.maps.DirectionsRenderer({map:e,draggable:this.dirDraggable,suppressMarkers:this.dirSuppressMarkers,panel:this.dirShowSteps?document.getElementById(this.markerDirectionsDiv):null}))},showDirections:function(i,r,n){var a=this;function s(e){var t={origin:e,destination:""===a.markerAddress?new google.maps.LatLng(i,r):a.markerAddress};switch(a.region&&(t.region=a.region),a.dirTravelMode){case"bicycling":t.travelMode=google.maps.TravelMode.BICYCLING;break;case"driving":t.travelMode=google.maps.TravelMode.DRIVING;break;case"transit":t.travelMode=google.maps.TravelMode.TRANSIT;break;case"walking":t.travelMode=google.maps.TravelMode.WALKING}switch(a.dirUnitSystem){case"imperial":t.unitSystem=google.maps.UnitSystem.IMPERIAL;break;case"metric":t.unitSystem=google.maps.UnitSystem.METRIC}a.dirService.route(t,o)}function o(e,t){var i=google.maps.DirectionsStatus;switch(t){case i.OK:a.dirRenderer.setDirections(e);break;case i.ZERO_RESULTS:window.alert("No route could be found between the origin and destination.");break;case i.OVER_QUERY_LIMIT:window.alert("The webpage has gone over the requests limit in too short a period of time.");break;case i.REQUEST_DENIED:window.alert("The webpage is not allowed to use the directions service.");break;case i.INVALID_REQUEST:window.alert("Invalid directions request.");break;case i.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.")}}this.markerDirectionsDiv&&this.dirShowSearch&&function(){var e,t,i,r=document.getElementById(a.markerDirectionsDiv),o=document.createElement("form");for(t=r.lastChild;t;t=r.lastChild)r.removeChild(t);(t=document.createElement("p")).appendChild(document.createTextNode(a.gettext("From")+": ")),(i=document.createElement("input")).type="text",i.name="from",i.value=a.markerDirectionsDefault,t.appendChild(i),(e=document.createElement("input")).type="submit",e.value=a.gettext("Get directions"),t.appendChild(e),o.appendChild(t),r.appendChild(o),void 0===o.elements.from&&(o.elements.from=i),n&&i.focus(),k(o,"submit",function(e){v(e);var t=this.elements.from.value;/\S/.test(t)&&s(t)})}(),this.markerDirectionsDefault&&s(this.markerDirectionsDefault)}}}();
|
readme.txt
CHANGED
@@ -7,12 +7,12 @@ Donate link: https://shop.webaware.com.au/donations/?donation_for=Flexible+Map
|
|
7 |
Tags: google, map, maps, google maps, kml
|
8 |
Requires at least: 4.0
|
9 |
Tested up to: 4.9
|
10 |
-
Stable tag: 1.
|
11 |
Requires PHP: 5.3
|
12 |
License: GPLv2 or later
|
13 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
14 |
|
15 |
-
Embed Google Maps shortcodes in pages and posts, either by
|
16 |
|
17 |
## Description
|
18 |
|
@@ -21,14 +21,14 @@ Flexible Map allows you to add Google Maps to your WordPress website with simple
|
|
21 |
### Features
|
22 |
|
23 |
* three ways to load a map:
|
24 |
-
* by
|
25 |
* by street address
|
26 |
* by URL to a Google Earth KML file
|
27 |
* simple shortcode for adding maps to pages/posts
|
28 |
* PHP function `flexmap_show_map()` for theme and plugin developers
|
29 |
* supports multiple maps on a page/post
|
30 |
* supports responsive design -- specify width / height in percent
|
31 |
-
* map marker doesn't have to be the
|
32 |
* optional description for info window
|
33 |
* optional directions link for info window
|
34 |
* directions can be dropped into any div element with an ID
|
@@ -67,7 +67,7 @@ The initial translations for all other languages were made using Google Translat
|
|
67 |
|
68 |
### Privacy
|
69 |
|
70 |
-
Flexible Map embeds Google Maps into your web pages. Please review Google's [Privacy and Personal Information](https://cloud.google.com/maps-platform/terms/maps-controller-terms/) for information about how that affects your website's
|
71 |
|
72 |
The Flexible Map plugin itself does not collect any personally identifying information, and does not set any cookies itself.
|
73 |
|
@@ -83,7 +83,7 @@ There are two ways to load maps with this plugin:
|
|
83 |
* specify the map's coordinates or street address
|
84 |
* specify the URL to a KML file (e.g. from Google Earth)
|
85 |
|
86 |
-
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
|
87 |
|
88 |
[Get started with Flexible Map](https://flexible-map.webaware.net.au/manual/getting-started/).
|
89 |
[Read the manual online](https://flexible-map.webaware.net.au/manual/).
|
@@ -127,15 +127,15 @@ The Google Maps API supports many commonly used KML elements, but has some restr
|
|
127 |
|
128 |
### Why won't the map show my place when I use the address attribute?
|
129 |
|
130 |
-
When you use a street address instead of
|
131 |
|
132 |
-
### How can I use
|
133 |
|
134 |
-
When you use just
|
135 |
|
136 |
### How do I get the maps to use my language?
|
137 |
|
138 |
-
The plugin uses
|
139 |
|
140 |
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):
|
141 |
|
@@ -228,19 +228,18 @@ Either turn off CloudFlare Rocketscript :) or install the [Flxmap No Rocketscrip
|
|
228 |
|
229 |
## Upgrade Notice
|
230 |
|
231 |
-
### 1.
|
232 |
|
233 |
-
|
234 |
|
235 |
## Changelog
|
236 |
|
237 |
The full changelog can be found [on GitHub](https://github.com/webaware/flexible-map/blob/master/changelog.md). Recent entries:
|
238 |
|
239 |
-
### 1.
|
240 |
|
241 |
-
Released 2018-07
|
242 |
|
243 |
-
*
|
244 |
-
*
|
245 |
-
*
|
246 |
-
* added: attribute `markeranimation` for setting how a single marker is added to the map - drop, bounce, none; defaults to drop
|
7 |
Tags: google, map, maps, google maps, kml
|
8 |
Requires at least: 4.0
|
9 |
Tested up to: 4.9
|
10 |
+
Stable tag: 1.16.0
|
11 |
Requires PHP: 5.3
|
12 |
License: GPLv2 or later
|
13 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
14 |
|
15 |
+
Embed Google Maps shortcodes in pages and posts, either by center coordinates or street address, or by URL to a Google Earth KML file.
|
16 |
|
17 |
## Description
|
18 |
|
21 |
### Features
|
22 |
|
23 |
* three ways to load a map:
|
24 |
+
* by center coordinates
|
25 |
* by street address
|
26 |
* by URL to a Google Earth KML file
|
27 |
* simple shortcode for adding maps to pages/posts
|
28 |
* PHP function `flexmap_show_map()` for theme and plugin developers
|
29 |
* supports multiple maps on a page/post
|
30 |
* supports responsive design -- specify width / height in percent
|
31 |
+
* map marker doesn't have to be the center of the map
|
32 |
* optional description for info window
|
33 |
* optional directions link for info window
|
34 |
* directions can be dropped into any div element with an ID
|
67 |
|
68 |
### Privacy
|
69 |
|
70 |
+
Flexible Map embeds Google Maps into your web pages. Please review Google's [Privacy and Personal Information](https://cloud.google.com/maps-platform/terms/maps-controller-terms/) for information about how that affects your website's Privacy Policy. By using this plugin, you are agreeing to the terms of use for Google Maps.
|
71 |
|
72 |
The Flexible Map plugin itself does not collect any personally identifying information, and does not set any cookies itself.
|
73 |
|
83 |
* specify the map's coordinates or street address
|
84 |
* specify the URL to a KML file (e.g. from Google Earth)
|
85 |
|
86 |
+
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 center coordinates or street address, or by loading a KML file.
|
87 |
|
88 |
[Get started with Flexible Map](https://flexible-map.webaware.net.au/manual/getting-started/).
|
89 |
[Read the manual online](https://flexible-map.webaware.net.au/manual/).
|
127 |
|
128 |
### Why won't the map show my place when I use the address attribute?
|
129 |
|
130 |
+
When you use a street address instead of center 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 center coordinates instead.
|
131 |
|
132 |
+
### How can I use center coordinates for the map and have directions to my address?
|
133 |
|
134 |
+
When you use just center coordinates for your map, the directions may send people to the location *opposite* your location! Yes, I know... anyway, if you specify both the center coordinates and the street address, the map will be centered correctly and the directions will be to your address.
|
135 |
|
136 |
### How do I get the maps to use my language?
|
137 |
|
138 |
+
The plugin uses localized 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](https://codex.wordpress.org/Installing_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"`.
|
139 |
|
140 |
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):
|
141 |
|
228 |
|
229 |
## Upgrade Notice
|
230 |
|
231 |
+
### 1.16.0
|
232 |
|
233 |
+
added setting that prevents the plugin from loading the Google Maps API; deprecated attributes `scrollwheel`, `draggable`, `dblclickzoom`, please use `gesturehandling` instead
|
234 |
|
235 |
## Changelog
|
236 |
|
237 |
The full changelog can be found [on GitHub](https://github.com/webaware/flexible-map/blob/master/changelog.md). Recent entries:
|
238 |
|
239 |
+
### 1.16.0
|
240 |
|
241 |
+
Released 2018-09-07
|
242 |
|
243 |
+
* added: setting that prevents the plugin from loading the Google Maps API; useful for preventing conflicts
|
244 |
+
* added: attribute [gesturehandling](https://flexible-map.webaware.net.au/manual/attribute-reference/#attr-gesturehandling) for smarter handling of the scroll wheel, drag to pan, double-click to zoom; default = cooperative
|
245 |
+
* deprecated: attributes `scrollwheel`, `draggable`, `dblclickzoom` are supported but not recommended; please use `gesturehandling` instead
|
|
views/settings-form.php
CHANGED
@@ -34,6 +34,15 @@ if (!defined('ABSPATH')) {
|
|
34 |
</td>
|
35 |
</tr>
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
</table>
|
38 |
|
39 |
<?php submit_button(); ?>
|
34 |
</td>
|
35 |
</tr>
|
36 |
|
37 |
+
<tr valign="top">
|
38 |
+
<th scope="row"><?php echo esc_html_x("Don't Load API", 'settings', 'wp-flexible-map'); ?></th>
|
39 |
+
<td>
|
40 |
+
<input type="checkbox" name="flexible_map[noAPI]" id="flexible_map_noAPI"<?php checked(!empty($options['noAPI'])); ?> />
|
41 |
+
<label for="flexible_map_noAPI"><?php echo esc_html_x("don't load the Google Maps API script", 'settings', 'wp-flexible-map'); ?></label>
|
42 |
+
<p><?php echo esc_html_x('Tick this when your theme or another plugin is already loading the Google Maps API, causing a conflict.', 'settings', 'wp-flexible-map'); ?></p>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
|
46 |
</table>
|
47 |
|
48 |
<?php submit_button(); ?>
|