Version Description
[2014-03-16] =
* fixed: German translation (thanks, Carib Design!)
* fixed: some themes (e.g. Evolve) mess up Google Maps directions markers
* fixed: CSS for infowindows with Google Maps Visual Refresh / API v3.15
* changed: removed instructions page, better handled by new homepage for plugin
* changed: bump version of Google Maps API to 3.15
* added: KML cache buster attribute kmlcache
, for dynamically created KML maps
* added: WordPress filter flexmap_shortcode_script
* removed: visualrefresh
attribute doesn't do anything any more (Google Maps API has adopted Visual Refresh as standard)
Download this release
Release Info
Developer | webaware |
Plugin | Flexible Map |
Version | 1.7.3 |
Comparing to | |
See all releases |
Code changes from version 1.7.2.1 to 1.7.3
- class.FlxMapAdmin.php +1 -32
- class.FlxMapPlugin.php +11 -8
- flexible-map.js +56 -17
- flexible-map.min.js +1 -1
- flexible-map.php +3 -21
- i18n/de.js +2 -2
- instructions.html +0 -134
- readme.txt +30 -9
- styles.css +5 -11
class.FlxMapAdmin.php
CHANGED
@@ -5,9 +5,7 @@
|
|
5 |
*/
|
6 |
class FlxMapAdmin {
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
private $plugin;
|
11 |
|
12 |
/**
|
13 |
* @param FlxMapPlugin $plugin
|
@@ -15,34 +13,16 @@ class FlxMapAdmin {
|
|
15 |
public function __construct($plugin) {
|
16 |
$this->plugin = $plugin;
|
17 |
|
18 |
-
// add admin menu items
|
19 |
-
add_action('admin_menu', array($this, 'addAdminMenu'));
|
20 |
-
|
21 |
// add action hook for adding plugin meta links
|
22 |
add_filter('plugin_row_meta', array($this, 'addPluginDetailsLinks'), 10, 2);
|
23 |
}
|
24 |
|
25 |
-
/**
|
26 |
-
* action hook for building admin menu
|
27 |
-
*/
|
28 |
-
public function addAdminMenu() {
|
29 |
-
// register the instructions page, only linked from plugin page
|
30 |
-
global $_registered_pages;
|
31 |
-
|
32 |
-
$hookname = get_plugin_page_hookname(self::MENU_PAGE . '-instructions', '');
|
33 |
-
if (!empty($hookname)) {
|
34 |
-
add_action($hookname, array($this, 'instructions'));
|
35 |
-
$_registered_pages[$hookname] = true;
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
/**
|
40 |
* action hook for adding plugin details links
|
41 |
*/
|
42 |
public function addPluginDetailsLinks($links, $file) {
|
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">' . __('Get help') . '</a>';
|
47 |
$links[] = '<a href="http://wordpress.org/plugins/wp-flexible-map/">' . __('Rating') . '</a>';
|
48 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ">' . __('Donate') . '</a>';
|
@@ -51,15 +31,4 @@ class FlxMapAdmin {
|
|
51 |
return $links;
|
52 |
}
|
53 |
|
54 |
-
/**
|
55 |
-
* show instructions page
|
56 |
-
*/
|
57 |
-
public function instructions() {
|
58 |
-
echo "<div class='wrap'>\n";
|
59 |
-
screen_icon('plugins');
|
60 |
-
echo "<h2>Flexible Map Instructions</h2>\n";
|
61 |
-
|
62 |
-
echo file_get_contents(FLXMAP_PLUGIN_ROOT . 'instructions.html');
|
63 |
-
echo "</div>\n";
|
64 |
-
}
|
65 |
}
|
5 |
*/
|
6 |
class FlxMapAdmin {
|
7 |
|
8 |
+
protected $plugin;
|
|
|
|
|
9 |
|
10 |
/**
|
11 |
* @param FlxMapPlugin $plugin
|
13 |
public function __construct($plugin) {
|
14 |
$this->plugin = $plugin;
|
15 |
|
|
|
|
|
|
|
16 |
// add action hook for adding plugin meta links
|
17 |
add_filter('plugin_row_meta', array($this, 'addPluginDetailsLinks'), 10, 2);
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* action hook for adding plugin details links
|
22 |
*/
|
23 |
public function addPluginDetailsLinks($links, $file) {
|
24 |
// add settings link
|
25 |
if ($file == FLXMAP_PLUGIN_NAME) {
|
|
|
26 |
$links[] = '<a href="http://wordpress.org/support/plugin/wp-flexible-map">' . __('Get help') . '</a>';
|
27 |
$links[] = '<a href="http://wordpress.org/plugins/wp-flexible-map/">' . __('Rating') . '</a>';
|
28 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ">' . __('Donate') . '</a>';
|
31 |
return $links;
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
class.FlxMapPlugin.php
CHANGED
@@ -33,6 +33,7 @@ class FlxMapPlugin {
|
|
33 |
|
34 |
if (is_admin()) {
|
35 |
// kick off the admin handling
|
|
|
36 |
new FlxMapAdmin($this);
|
37 |
}
|
38 |
else {
|
@@ -86,7 +87,7 @@ class FlxMapPlugin {
|
|
86 |
public function actionEnqueueScripts() {
|
87 |
// allow others to override the Google Maps API URL
|
88 |
$protocol = is_ssl() ? 'https' : 'http';
|
89 |
-
$args = apply_filters('flexmap_google_maps_api_args', array('v' => '3.
|
90 |
$apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, "$protocol://maps.google.com/maps/api/js"));
|
91 |
if (!empty($apiURL)) {
|
92 |
wp_register_script('google-maps', $apiURL, false, null, true);
|
@@ -104,7 +105,7 @@ class FlxMapPlugin {
|
|
104 |
* @param string $locale
|
105 |
*/
|
106 |
protected function enqueueLocale($locale) {
|
107 |
-
// check
|
108 |
foreach (array($locale, substr($locale, 0, 2)) as $locale) {
|
109 |
if (file_exists(FLXMAP_PLUGIN_ROOT . "i18n/$locale.js")) {
|
110 |
wp_enqueue_script('flxmap-' . $locale, $this->urlBase . "i18n/$locale.js", array('flxmap'), FLXMAP_PLUGIN_VERSION, true);
|
@@ -292,10 +293,6 @@ HTML;
|
|
292 |
$this->enqueueLocale($locale);
|
293 |
}
|
294 |
|
295 |
-
if (isset($attrs['visualrefresh']) && self::isYes($attrs['visualrefresh'])) {
|
296 |
-
$script .= " f.visualRefresh = true;\n";
|
297 |
-
}
|
298 |
-
|
299 |
// add map based on coordinates, with optional marker coordinates
|
300 |
if (isset($attrs['center']) && self::isCoordinates($attrs['center'])) {
|
301 |
$marker = self::str2js($attrs['center']);
|
@@ -363,6 +360,10 @@ HTML;
|
|
363 |
$script .= " f.targetFix = false;\n";
|
364 |
}
|
365 |
|
|
|
|
|
|
|
|
|
366 |
$kmlfile = self::str2js($attrs['src']);
|
367 |
$script .= " f.showKML(\"$divID\", \"$kmlfile\"";
|
368 |
|
@@ -372,6 +373,9 @@ HTML;
|
|
372 |
$script .= ");\n";
|
373 |
}
|
374 |
|
|
|
|
|
|
|
375 |
if ((defined('DOING_AJAX') && DOING_AJAX) || (isset($attrs['isajax']) && self::isYes($attrs['isajax']))) {
|
376 |
// wrap it up for AJAX load, no event trigger
|
377 |
$html .= <<<HTML
|
@@ -401,7 +405,6 @@ $script window.$varID = f;
|
|
401 |
|
402 |
HTML;
|
403 |
}
|
404 |
-
|
405 |
}
|
406 |
|
407 |
// allow others to change the generated html
|
@@ -433,7 +436,7 @@ HTML;
|
|
433 |
}
|
434 |
else {
|
435 |
// found only digits, so append px
|
436 |
-
$units
|
437 |
}
|
438 |
}
|
439 |
|
33 |
|
34 |
if (is_admin()) {
|
35 |
// kick off the admin handling
|
36 |
+
require FLXMAP_PLUGIN_ROOT . 'class.FlxMapAdmin.php';
|
37 |
new FlxMapAdmin($this);
|
38 |
}
|
39 |
else {
|
87 |
public function actionEnqueueScripts() {
|
88 |
// allow others to override the Google Maps API URL
|
89 |
$protocol = is_ssl() ? 'https' : 'http';
|
90 |
+
$args = apply_filters('flexmap_google_maps_api_args', array('v' => '3.15', 'sensor' => 'false'));
|
91 |
$apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, "$protocol://maps.google.com/maps/api/js"));
|
92 |
if (!empty($apiURL)) {
|
93 |
wp_register_script('google-maps', $apiURL, false, null, true);
|
105 |
* @param string $locale
|
106 |
*/
|
107 |
protected function enqueueLocale($locale) {
|
108 |
+
// check for specific locale first, e.g. 'zh-CN', then for generic locale, e.g. 'zh'
|
109 |
foreach (array($locale, substr($locale, 0, 2)) as $locale) {
|
110 |
if (file_exists(FLXMAP_PLUGIN_ROOT . "i18n/$locale.js")) {
|
111 |
wp_enqueue_script('flxmap-' . $locale, $this->urlBase . "i18n/$locale.js", array('flxmap'), FLXMAP_PLUGIN_VERSION, true);
|
293 |
$this->enqueueLocale($locale);
|
294 |
}
|
295 |
|
|
|
|
|
|
|
|
|
296 |
// add map based on coordinates, with optional marker coordinates
|
297 |
if (isset($attrs['center']) && self::isCoordinates($attrs['center'])) {
|
298 |
$marker = self::str2js($attrs['center']);
|
360 |
$script .= " f.targetFix = false;\n";
|
361 |
}
|
362 |
|
363 |
+
if (isset($attrs['kmlcache']) && preg_match('/^(?:none|\d+\s*minutes?|\d+\s*hours?|\d+\s*days?)$/', $attrs['kmlcache'])) {
|
364 |
+
$script .= " f.kmlcache = \"{$attrs['kmlcache']}\";\n";
|
365 |
+
}
|
366 |
+
|
367 |
$kmlfile = self::str2js($attrs['src']);
|
368 |
$script .= " f.showKML(\"$divID\", \"$kmlfile\"";
|
369 |
|
373 |
$script .= ");\n";
|
374 |
}
|
375 |
|
376 |
+
// allow others to change the generated script
|
377 |
+
$script = apply_filters('flexmap_shortcode_script', $script, $attrs);
|
378 |
+
|
379 |
if ((defined('DOING_AJAX') && DOING_AJAX) || (isset($attrs['isajax']) && self::isYes($attrs['isajax']))) {
|
380 |
// wrap it up for AJAX load, no event trigger
|
381 |
$html .= <<<HTML
|
405 |
|
406 |
HTML;
|
407 |
}
|
|
|
408 |
}
|
409 |
|
410 |
// allow others to change the generated html
|
436 |
}
|
437 |
else {
|
438 |
// found only digits, so append px
|
439 |
+
$units .= 'px';
|
440 |
}
|
441 |
}
|
442 |
|
flexible-map.js
CHANGED
@@ -95,11 +95,6 @@ function FlexibleMap() {
|
|
95 |
zoomControlStyle = zoomControlStyles.small;
|
96 |
}
|
97 |
|
98 |
-
// enable visual refresh, if requested
|
99 |
-
// NB: affect all maps on page!
|
100 |
-
if (this.visualRefresh)
|
101 |
-
google.maps.visualRefresh = true;
|
102 |
-
|
103 |
// create a map
|
104 |
map = new google.maps.Map(document.getElementById(divID), {
|
105 |
mapTypeId: this.mapTypeId,
|
@@ -149,16 +144,16 @@ function FlexibleMap() {
|
|
149 |
this.draggable = true; // support dragging to pan
|
150 |
this.dblclickZoom = true; // support double-click zoom
|
151 |
this.zoom = 16; // zoom level, smaller is closer
|
152 |
-
this.markerTitle =
|
153 |
-
this.markerDescription =
|
154 |
-
this.markerHTML =
|
155 |
-
this.markerLink =
|
156 |
-
this.markerIcon =
|
157 |
this.markerShowInfo = true; // if have infowin for marker, show it immediately
|
158 |
this.markerDirections = false; // show directions link in info window
|
159 |
this.markerDirectionsShow = false; // show directions as soon as page loads
|
160 |
-
this.markerDirectionsDefault =
|
161 |
-
this.markerAddress =
|
162 |
this.targetFix = true; // remove target="_blank" from links on KML map
|
163 |
this.dirService = false;
|
164 |
this.dirRenderer = false;
|
@@ -166,10 +161,10 @@ function FlexibleMap() {
|
|
166 |
this.dirSuppressMarkers = false; // suppress A/B markers on directions route
|
167 |
this.dirShowSteps = true; // show the directions steps (turn-by-turn)
|
168 |
this.dirShowSearch = true; // show the directions form for searching directions
|
169 |
-
this.region =
|
170 |
-
this.locale =
|
171 |
-
this.localeActive =
|
172 |
-
this.
|
173 |
}
|
174 |
|
175 |
FlexibleMap.prototype = (function() {
|
@@ -234,6 +229,50 @@ FlexibleMap.prototype = (function() {
|
|
234 |
|
235 |
})();
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
return {
|
238 |
constructor: FlexibleMap,
|
239 |
|
@@ -304,7 +343,7 @@ FlexibleMap.prototype = (function() {
|
|
304 |
mapDiv = document.getElementById(divID),
|
305 |
varName = mapDiv.getAttribute("data-flxmap"),
|
306 |
map = this.showMap(divID, [0, 0]),
|
307 |
-
kmlLayer = this.loadKmlMap(kmlFileURL);
|
308 |
|
309 |
// set zoom if specified
|
310 |
if (typeof zoom != "undefined") {
|
95 |
zoomControlStyle = zoomControlStyles.small;
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
98 |
// create a map
|
99 |
map = new google.maps.Map(document.getElementById(divID), {
|
100 |
mapTypeId: this.mapTypeId,
|
144 |
this.draggable = true; // support dragging to pan
|
145 |
this.dblclickZoom = true; // support double-click zoom
|
146 |
this.zoom = 16; // zoom level, smaller is closer
|
147 |
+
this.markerTitle = ""; // title for marker info window
|
148 |
+
this.markerDescription = ""; // description for marker info window
|
149 |
+
this.markerHTML = ""; // HTML for marker info window (overrides title and description)
|
150 |
+
this.markerLink = ""; // link for marker title
|
151 |
+
this.markerIcon = ""; // link for marker icon, leave blank for default
|
152 |
this.markerShowInfo = true; // if have infowin for marker, show it immediately
|
153 |
this.markerDirections = false; // show directions link in info window
|
154 |
this.markerDirectionsShow = false; // show directions as soon as page loads
|
155 |
+
this.markerDirectionsDefault = ""; // default from: location for directions
|
156 |
+
this.markerAddress = ""; // address of marker, if given
|
157 |
this.targetFix = true; // remove target="_blank" from links on KML map
|
158 |
this.dirService = false;
|
159 |
this.dirRenderer = false;
|
161 |
this.dirSuppressMarkers = false; // suppress A/B markers on directions route
|
162 |
this.dirShowSteps = true; // show the directions steps (turn-by-turn)
|
163 |
this.dirShowSearch = true; // show the directions form for searching directions
|
164 |
+
this.region = "";
|
165 |
+
this.locale = "en";
|
166 |
+
this.localeActive = "en";
|
167 |
+
this.kmlcache = "none";
|
168 |
}
|
169 |
|
170 |
FlexibleMap.prototype = (function() {
|
229 |
|
230 |
})();
|
231 |
|
232 |
+
/**
|
233 |
+
* add cache buster to KML source link
|
234 |
+
* @param {String} url
|
235 |
+
* @param {String} caching
|
236 |
+
* @return {String}
|
237 |
+
*/
|
238 |
+
function kmlCacheBuster(url, caching) {
|
239 |
+
var milliseconds, buster, multiplier, matches = /^(\d+)\s*(minute|hour|day)s?$/.exec(caching);
|
240 |
+
|
241 |
+
if (matches) {
|
242 |
+
milliseconds = (new Date()).getTime();
|
243 |
+
multiplier = +matches[1];
|
244 |
+
|
245 |
+
switch(matches[2]) {
|
246 |
+
case "minute":
|
247 |
+
// can't be less than 5 minutes
|
248 |
+
if (multiplier < 5) {
|
249 |
+
multiplier = 5;
|
250 |
+
}
|
251 |
+
buster = milliseconds / (60000 * multiplier);
|
252 |
+
break;
|
253 |
+
|
254 |
+
case "hour":
|
255 |
+
buster = milliseconds / (3600000 * multiplier);
|
256 |
+
break;
|
257 |
+
|
258 |
+
case "day":
|
259 |
+
buster = milliseconds / (86400000 * multiplier);
|
260 |
+
break;
|
261 |
+
|
262 |
+
default:
|
263 |
+
buster = false;
|
264 |
+
break;
|
265 |
+
}
|
266 |
+
|
267 |
+
if (buster) {
|
268 |
+
buster = Math.floor(buster);
|
269 |
+
url += (url.indexOf("?") > -1 ? "&" : "?") + "nocache=" + buster;
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
return url;
|
274 |
+
}
|
275 |
+
|
276 |
return {
|
277 |
constructor: FlexibleMap,
|
278 |
|
343 |
mapDiv = document.getElementById(divID),
|
344 |
varName = mapDiv.getAttribute("data-flxmap"),
|
345 |
map = this.showMap(divID, [0, 0]),
|
346 |
+
kmlLayer = this.loadKmlMap(kmlCacheBuster(kmlFileURL, this.kmlcache));
|
347 |
|
348 |
// set zoom if specified
|
349 |
if (typeof zoom != "undefined") {
|
flexible-map.min.js
CHANGED
@@ -2,4 +2,4 @@
|
|
2 |
JavaScript for the WordPress plugin wp-flexible-map
|
3 |
copyright (c) 2011-2014 WebAware Pty Ltd, released under LGPL v2.1
|
4 |
*/
|
5 |
-
;function FlexibleMap(){var e,c,a,d,b=false;this.getMap=function(){return e};this.getCenter=function(){return c};this.setCenter=function(f){c=f;e.setCenter(c)};this.setMarkerLocation=function(f){a=f};this.getMarkerLocation=function(){return a};this.getKmlLayer=function(){return d};this.redrawOnce=function(){if(!b){b=true;this.redraw()}};this.showMap=function(f,h){c=new google.maps.LatLng(h[0],h[1]);var i,g={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,"default":google.maps.ZoomControlStyle.DEFAULT};if(this.zoomControlStyle in g){i=g[this.zoomControlStyle]}else{i=g.small}
|
2 |
JavaScript for the WordPress plugin wp-flexible-map
|
3 |
copyright (c) 2011-2014 WebAware Pty Ltd, released under LGPL v2.1
|
4 |
*/
|
5 |
+
;function FlexibleMap(){var e,c,a,d,b=false;this.getMap=function(){return e};this.getCenter=function(){return c};this.setCenter=function(f){c=f;e.setCenter(c)};this.setMarkerLocation=function(f){a=f};this.getMarkerLocation=function(){return a};this.getKmlLayer=function(){return d};this.redrawOnce=function(){if(!b){b=true;this.redraw()}};this.showMap=function(f,h){c=new google.maps.LatLng(h[0],h[1]);var i,g={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,"default":google.maps.ZoomControlStyle.DEFAULT};if(this.zoomControlStyle in g){i=g[this.zoomControlStyle]}else{i=g.small}e=new google.maps.Map(document.getElementById(f),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:i},draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,center:c,zoom:this.zoom});return e};this.loadKmlMap=function(f){d=new google.maps.KmlLayer({map:e,url:f});google.maps.event.addListenerOnce(d,"defaultviewport_changed",function(){c=d.getDefaultViewport().getCenter()});return d};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.zoomControlStyle="small";this.streetViewControl=false;this.scrollwheel=false;this.draggable=true;this.dblclickZoom=true;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerHTML="";this.markerLink="";this.markerIcon="";this.markerShowInfo=true;this.markerDirections=false;this.markerDirectionsShow=false;this.markerDirectionsDefault="";this.markerAddress="";this.targetFix=true;this.dirService=false;this.dirRenderer=false;this.dirDraggable=false;this.dirSuppressMarkers=false;this.dirShowSteps=true;this.dirShowSearch=true;this.region="";this.locale="en";this.localeActive="en";this.kmlcache="none"}FlexibleMap.prototype=(function(){var d,b;if(document.addEventListener){d=function(f,e,g){f.addEventListener(e,g,false)};b=function(e){e.stopPropagation();e.preventDefault()}}else{if(document.attachEvent){d=function(e,f,g){e.attachEvent("on"+f,function(){g.call(e,window.event)})};b=function(e){e.cancelBubble=true;e.returnValue=0}}}var a=(function(){function e(g){var h=g.charCodeAt(0),f=h.toString(16);if(h<256){return"\\x"+("00"+f).slice(-2)}return"\\u"+("0000"+f).slice(-4)}return function(f){return f.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,e)}})();function c(f,i){var e,g,j,h=/^(\d+)\s*(minute|hour|day)s?$/.exec(i);if(h){e=(new Date()).getTime();j=+h[1];switch(h[2]){case"minute":if(j<5){j=5}g=e/(60000*j);break;case"hour":g=e/(3600000*j);break;case"day":g=e/(86400000*j);break;default:g=false;break}if(g){g=Math.floor(g);f+=(f.indexOf("?")>-1?"&":"?")+"nocache="+g}}return f}return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(e){this.locale=e;if(e in this.i18n){this.localeActive=e}else{e=e.substr(0,2);if(e in this.i18n){this.localeActive=e}else{this.localeActive="en"}}return this.localeActive},gettext:function(f){var e=this.i18n[this.localeActive];if(f in e){return e[f]}return f},showKML:function(e,h,i){if(typeof i!="undefined"){this.zoom=i}var g=this,f=document.getElementById(e),l=f.getAttribute("data-flxmap"),k=this.showMap(e,[0,0]),j=this.loadKmlMap(c(h,this.kmlcache));if(typeof i!="undefined"){google.maps.event.addListenerOnce(k,"zoom_changed",function(){k.setZoom(i);g.zoom=i})}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(k)}google.maps.event.addListener(j,"click",function(r){var p=r.featureData;if(!p._flxmapOnce){p._flxmapOnce=true;if(g.targetFix){var o=/ target="_blank"/ig;p.description=p.description.replace(o,"");p.infoWindowHtml=p.infoWindowHtml.replace(o,"")}if(g.markerDirections){var n=r.latLng,q=n.lat()+","+n.lng()+",'"+a(p.name)+"',true",m='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+l+".showDirections("+q+'); return false;">'+g.gettext("Directions")+"</a>";p.infoWindowHtml=p.infoWindowHtml.replace(/<\/div><\/div>$/i,m+"</div></div>")}}});if(window.opera&&this.markerDirections){d(f,"click",function(m){if(m.target.getAttribute("data-flxmap-fix-opera")){b(m)}})}},showMarker:function(j,h,n){var g=this.showMap(j,h),e=new google.maps.LatLng(n[0],n[1]),r=new google.maps.Marker({map:g,position:e,icon:this.markerIcon});this.setMarkerLocation(e);if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var m,o,t,k,l,q,s=this,f=document.createElement("DIV");f.className="flxmap-infowin";r.setTitle(this.markerTitle);l=document.createElement("DIV");l.className="flxmap-marker-title";l.appendChild(document.createTextNode(this.markerTitle));f.appendChild(l);if(this.markerHTML){l=document.createElement("DIV");l.innerHTML=this.markerHTML;f.appendChild(l)}if(this.markerDescription||this.markerLink){l=document.createElement("DIV");l.className="flxmap-marker-link";if(this.markerDescription){t=this.markerDescription.split("\n");for(m=0,o=t.length;m<o;m++){if(m>0){l.appendChild(document.createElement("BR"))}l.appendChild(document.createTextNode(t[m]))}if(this.markerLink){l.appendChild(document.createElement("BR"))}}if(this.markerLink){q=document.createElement("A");q.href=this.markerLink;q.appendChild(document.createTextNode(this.gettext("Click for details")));l.appendChild(q)}f.appendChild(l)}if(this.markerDirections){l=document.createElement("DIV");l.className="flxmap-directions-link";q=document.createElement("A");q.href="#";q.dataLatitude=n[0];q.dataLongitude=n[1];q.dataTitle=this.markerTitle;d(q,"click",function(i){b(i);s.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle,true)});q.appendChild(document.createTextNode(this.gettext("Directions")));l.appendChild(q);f.appendChild(l)}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(g);if(this.markerDirectionsShow){this.showDirections(n[0],n[1],this.markerTitle,false)}}k=new google.maps.InfoWindow({content:f});if(this.markerShowInfo){google.maps.event.addListenerOnce(g,"tilesloaded",function(){k.open(g,r)})}google.maps.event.addListener(r,"click",function(){k.open(g,r)});var p=function(){s.updateGoogleLink()};google.maps.event.addListener(g,"idle",p);google.maps.event.addListener(g,"center_changed",p);google.maps.event.addListenerOnce(g,"tilesloaded",p)}},showAddress:function(e,f){var g=this,h=new google.maps.Geocoder();this.markerAddress=f;if(this.markerTitle===""){this.markerTitle=f}h.geocode({address:f,region:this.region},function(k,j){if(j==google.maps.GeocoderStatus.OK){var i=k[0].geometry.location,l=[i.lat(),i.lng()];g.showMarker(e,l,l)}else{window.alert("Map address returns error: "+j)}})},updateGoogleLink:function(){if("querySelectorAll" in document){try{var m=this.getMap().getDiv(),g=this.getMarkerLocation(),j=m.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),h=0,f=j.length,k=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+g.lat()+","+g.lng());for(;h<f;h++){j[h].href+="&mrt=loc&iwloc=A&q="+k}}catch(l){}}},redraw:function(){var f=this.getMap(),e=this.getKmlLayer();google.maps.event.trigger(f,"resize");if(e){f.fitBounds(e.getDefaultViewport())}else{f.setCenter(this.getCenter());f.setZoom(this.zoom)}},startDirService:function(e){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!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(l,h,k,e){var f=this;function j(){var m=document.getElementById(f.markerDirectionsDiv),o=document.createElement("form"),n,q,r;while(!!(q=m.lastChild)){m.removeChild(q)}q=document.createElement("p");q.appendChild(document.createTextNode(f.gettext("From")+": "));r=document.createElement("input");r.type="text";r.name="from";r.value=f.markerDirectionsDefault;q.appendChild(r);n=document.createElement("input");n.type="submit";n.value=f.gettext("Get directions");q.appendChild(n);o.appendChild(q);m.appendChild(o);if(typeof o.elements.from=="undefined"){o.elements.from=r}if(e){r.focus()}d(o,"submit",function(p){b(p);var s=this.elements.from.value;if(/\S/.test(s)){i(s)}})}function i(o){var m=(f.markerAddress==="")?new google.maps.LatLng(l,h):f.markerAddress,n={origin:o,region:f.region||"",destination:m,travelMode:google.maps.DirectionsTravelMode.DRIVING};f.dirService.route(n,g)}function g(o,m){var n=google.maps.DirectionsStatus;switch(m){case n.OK:f.dirRenderer.setDirections(o);break;case n.ZERO_RESULTS:window.alert("No route could be found between the origin and destination.");break;case n.OVER_QUERY_LIMIT:window.alert("The webpage has gone over the requests limit in too short a period of time.");break;case n.REQUEST_DENIED:window.alert("The webpage is not allowed to use the directions service.");break;case n.INVALID_REQUEST:window.alert("Invalid directions request.");break;case n.NOT_FOUND:window.alert("Origin or destination was not found.");break;default:window.alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");break}}if(this.markerDirectionsDiv&&this.dirShowSearch){j()}if(this.markerDirectionsDefault){i(this.markerDirectionsDefault)}}}})();
|
flexible-map.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Flexible Map
|
4 |
Plugin URI: http://flexible-map.webaware.net.au/
|
5 |
Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
|
6 |
-
Version: 1.7.
|
7 |
Author: WebAware
|
8 |
Author URI: http://www.webaware.com.au/
|
9 |
*/
|
@@ -33,32 +33,14 @@ if (!defined('FLXMAP_PLUGIN_ROOT')) {
|
|
33 |
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
|
34 |
define('FLXMAP_PLUGIN_VERSION', time());
|
35 |
else
|
36 |
-
define('FLXMAP_PLUGIN_VERSION', '1.7.
|
37 |
|
38 |
// shortcode tags
|
39 |
define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
|
40 |
}
|
41 |
|
42 |
-
/**
|
43 |
-
* autoload classes as/when needed
|
44 |
-
*
|
45 |
-
* @param string $class_name name of class to attempt to load
|
46 |
-
*/
|
47 |
-
function flxmap_autoload($class_name) {
|
48 |
-
static $classMap = array (
|
49 |
-
'FlxMapAdmin' => 'class.FlxMapAdmin.php',
|
50 |
-
'FlxMapPlugin' => 'class.FlxMapPlugin.php',
|
51 |
-
);
|
52 |
-
|
53 |
-
if (isset($classMap[$class_name])) {
|
54 |
-
require FLXMAP_PLUGIN_ROOT . $classMap[$class_name];
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
// register a class (static) method for autoloading required classes
|
59 |
-
spl_autoload_register('flxmap_autoload');
|
60 |
-
|
61 |
// instantiate the plug-in
|
|
|
62 |
$FlxMapPlugin = FlxMapPlugin::getInstance();
|
63 |
|
64 |
/**
|
3 |
Plugin Name: Flexible Map
|
4 |
Plugin URI: http://flexible-map.webaware.net.au/
|
5 |
Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
|
6 |
+
Version: 1.7.3
|
7 |
Author: WebAware
|
8 |
Author URI: http://www.webaware.com.au/
|
9 |
*/
|
33 |
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
|
34 |
define('FLXMAP_PLUGIN_VERSION', time());
|
35 |
else
|
36 |
+
define('FLXMAP_PLUGIN_VERSION', '1.7.3');
|
37 |
|
38 |
// shortcode tags
|
39 |
define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
// instantiate the plug-in
|
43 |
+
require FLXMAP_PLUGIN_ROOT . 'class.FlxMapPlugin.php';
|
44 |
$FlxMapPlugin = FlxMapPlugin::getInstance();
|
45 |
|
46 |
/**
|
i18n/de.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
// German
|
2 |
-
//
|
3 |
|
4 |
if (typeof FlexibleMap != "undefined") {
|
5 |
|
6 |
FlexibleMap.prototype.i18n["de"] = {
|
7 |
-
"Click for details" : "
|
8 |
"Directions" : "Wegbeschreibung",
|
9 |
"From" : "Abfahrtsort",
|
10 |
"Get directions" : "Wegbeschreibung anzeigen"
|
1 |
// German
|
2 |
+
// translation by Carib Design http://profiles.wordpress.org/caribdesign/ -- thanks!
|
3 |
|
4 |
if (typeof FlexibleMap != "undefined") {
|
5 |
|
6 |
FlexibleMap.prototype.i18n["de"] = {
|
7 |
+
"Click for details" : "Für Details klicken",
|
8 |
"Directions" : "Wegbeschreibung",
|
9 |
"From" : "Abfahrtsort",
|
10 |
"Get directions" : "Wegbeschreibung anzeigen"
|
instructions.html
DELETED
@@ -1,134 +0,0 @@
|
|
1 |
-
<style type="text/css">
|
2 |
-
.flxmap-instructions-parameters dt {
|
3 |
-
font-weight: bold;
|
4 |
-
}
|
5 |
-
.flxmap-instructions-parameters dd {
|
6 |
-
margin-left: 1.5em;
|
7 |
-
}
|
8 |
-
.flxmap-instructions-parameters code {
|
9 |
-
font-family: "Liberation Mono", monospace;
|
10 |
-
font-size: 110%;
|
11 |
-
}
|
12 |
-
</style>
|
13 |
-
|
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. A KML file has the advantage that you can have
|
16 |
-
many different markers all on the one map.</p>
|
17 |
-
|
18 |
-
<h3>Parameters for all maps:</h3>
|
19 |
-
<dl class="flxmap-instructions-parameters">
|
20 |
-
<dt>width</dt>
|
21 |
-
<dd>width in pixels, e.g. <em>width="500"</em></dd>
|
22 |
-
<dt>height</dt>
|
23 |
-
<dd>height in pixels, e.g. <em>height="400"</em></dd>
|
24 |
-
<dt>zoom</dt>
|
25 |
-
<dd>zoom level as an integer, larger is closer, e.g. <em>zoom="16"</em></dd>
|
26 |
-
<dt>maptype</dt>
|
27 |
-
<dd>type of map to show, from [roadmap, satellite], e.g. <em>maptype="roadmap"</em>; default=roadmap</dd>
|
28 |
-
<dt>hidemaptype</dt>
|
29 |
-
<dd>hide the map type controls, from [true, false], e.g. <em>hidemaptype="true"</em>; default=false</dd>
|
30 |
-
<dt>hidepanning</dt>
|
31 |
-
<dd>hide the panning controls, from [true, false], e.g. <em>hidepanning="true"</em>; default=true</dd>
|
32 |
-
<dt>hidezooming</dt>
|
33 |
-
<dd>hide the zoom controls, from [true, false], e.g. <em>hidezooming="true"</em>; default=false</dd>
|
34 |
-
<dt>hidestreetview</dt>
|
35 |
-
<dd>hide the street view control, from [true, false], e.g. <em>hidestreetview="true"</em>; default=true</dd>
|
36 |
-
<dt>zoomstyle</dt>
|
37 |
-
<dd>which zoom control style, from [small, large, default]; default=small</dd>
|
38 |
-
<dt>hidescale</dt>
|
39 |
-
<dd>hide the map scale, from [true, false], e.g. <em>hidescale="true"</em>; default=true</dd>
|
40 |
-
<dt>scrollwheel</dt>
|
41 |
-
<dd>enable zoom with mouse scroll wheel, from [true, false], e.g. <em>scrollwheel="true"</em>; default=false</dd>
|
42 |
-
<dt>draggable</dt>
|
43 |
-
<dd>enable dragging to pan, from [true, false], e.g. <em>draggable="true"</em>; default=true</dd>
|
44 |
-
<dt>dblclickzoom</dt>
|
45 |
-
<dd>enable double-clicking to zoom, from [true, false], e.g. <em>dblclickzoom="true"</em>; default=true</dd>
|
46 |
-
<dt>directions</dt>
|
47 |
-
<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, e.g. <em>directions="true", directions="my-dir-id"</em>; default=false</dd>
|
48 |
-
<dt>dirdraggable</dt>
|
49 |
-
<dd>allow directions to be draggable, from [true, false]; default=false</dd>
|
50 |
-
<dt>dirnomarkers</dt>
|
51 |
-
<dd>suppress start and end markers when showing directions, from [true, false]; default=false</dd>
|
52 |
-
<dt>dirshowsteps</dt>
|
53 |
-
<dd>show or suppress directions steps when showing directions, from [true, false]; default=true</dd>
|
54 |
-
<dt>dirshowssearch</dt>
|
55 |
-
<dd>show or suppress directions search form when showing directions, from [true, false]; default=true</dd>
|
56 |
-
<dt>region</dt>
|
57 |
-
<dd>specify region to help localise address searches for street address map and directions, taken from the list of <a target="_blank" href="http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains">ccTLD</a> (without the .), e.g. <em>region="au"</em></dd>
|
58 |
-
<dt>locale</dt>
|
59 |
-
<dd>use a specific locale (language) for messages like the text of the Directions link, e.g. <em>locale="nl-BE"</em></dd>
|
60 |
-
<dt>visualrefresh</dt>
|
61 |
-
<dd>enable <a target="_blank" href="https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh">visual refresh</a>; NB: affects all maps on the page! from [true, false]; default=false</dd>
|
62 |
-
</dl>
|
63 |
-
|
64 |
-
<hr />
|
65 |
-
|
66 |
-
<h3>Additional parameters for centre coordinates map:</h3>
|
67 |
-
<dl class="flxmap-instructions-parameters">
|
68 |
-
<dt>center</dt>
|
69 |
-
<dd>coordinates of centre in latitude,longitude, e.g. <em>center="-34.916721,138.828878"</em></dd>
|
70 |
-
<dt>address</dt>
|
71 |
-
<dd>street address of map centre, e.g. <em>address="116 Beaumont Street Hamilton NSW Australia"</em></dd>
|
72 |
-
<dt>marker</dt>
|
73 |
-
<dd>coordinates of the marker if different from the centre, in latitude,longitude, e.g. <em>marker="-34.916721,138.828878"</em></dd>
|
74 |
-
<dt>title</dt>
|
75 |
-
<dd>title of the marker, displayed in a text bubble, e.g. <em>title="Adelaide Hills"</em></dd>
|
76 |
-
<dt>link</dt>
|
77 |
-
<dd>URL to link from the marker title, e.g. <em>link="http://example.com/"</em></dd>
|
78 |
-
<dt>icon</dt>
|
79 |
-
<dd>URL to icon for the marker, e.g. <em>icon="http://maps.google.com/mapfiles/kml/pal3/icon29.png"</em></dd>
|
80 |
-
<dt>description</dt>
|
81 |
-
<dd>a description of the marker location (can have HTML links), e.g. <em>description="Lorem ipsum dolor sit amet"</em></dd>
|
82 |
-
<dt>html</dt>
|
83 |
-
<dd>some simple HTML to add to the info window, e.g. <em><img src='http://example.com/logo.img' /></em></dd>
|
84 |
-
<dt>directions</dt>
|
85 |
-
<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>
|
86 |
-
<dt>showdirections</dt>
|
87 |
-
<dd>show directions when the map loads</dd>
|
88 |
-
<dt>directionsfrom</dt>
|
89 |
-
<dd>initial from: location for directions</dd>
|
90 |
-
<dt>showinfo</dt>
|
91 |
-
<dd>show the marker's info window when the map loads, from [true, false], e.g. <em>showinfo="true"</em>; default=true</dd>
|
92 |
-
<dt>locale</dt>
|
93 |
-
<dd>use a specific locale (language) for messages like the text of the Directions link, e.g. <em>locale="nl-BE"</em></dd>
|
94 |
-
<dt>region</dt>
|
95 |
-
<dd>specify region to help localise address searches for street address map and directions, taken from the list of <a target="_blank" href="http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains">ccTLD</a> (without the .), e.g. <em>region="au"</em></dd>
|
96 |
-
<dt>Samples:</dt>
|
97 |
-
<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>
|
98 |
-
<dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]</code></dd>
|
99 |
-
<dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="my-dir-div"]</code></dd>
|
100 |
-
</dl>
|
101 |
-
|
102 |
-
<hr />
|
103 |
-
|
104 |
-
<h3>Additional parameters for KML map:</h3>
|
105 |
-
<dl class="flxmap-instructions-parameters">
|
106 |
-
<dt>src</dt>
|
107 |
-
<dd>URL for KML file to load map details from, e.g. <em>src="http://example.com/map.kml"</em></dd>
|
108 |
-
<dt>targetfix</dt>
|
109 |
-
<dd>prevent links from opening in new window, from [true, false], e.g. <em>targetfix="true"</em>; default=true</dd>
|
110 |
-
<dt>Sample:</dt>
|
111 |
-
<dd><code>[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="500" height="400"]</code></dd>
|
112 |
-
</dl>
|
113 |
-
|
114 |
-
<hr />
|
115 |
-
|
116 |
-
<h3>Calling from templates or plugins</h3>
|
117 |
-
|
118 |
-
<p>There is a PHP function `flexmap_show_map()` for theme and plugin developers. All of the same parameters for the shortcode can be passed to the function in an associative array.</p>
|
119 |
-
|
120 |
-
<dl class="flxmap-instructions-parameters">
|
121 |
-
<dt>Sample:</dt>
|
122 |
-
<dd><pre><code>flexmap_show_map(array(
|
123 |
-
'center' => '-34.916721,138.828878',
|
124 |
-
'width' => 500,
|
125 |
-
'height' => 400,
|
126 |
-
'zoom' => 12,
|
127 |
-
'title' => 'Adelaide Hills',
|
128 |
-
'description' => 'The Adelaide Hills are repleat with wineries.',
|
129 |
-
'directions' => 'my-dir-div',
|
130 |
-
'hidepanning' => 'false',
|
131 |
-
'hidescale' => 'false',
|
132 |
-
'maptype' => 'satellite',
|
133 |
-
));</code></pre></dd>
|
134 |
-
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,10 +4,10 @@ Plugin Name: WP Flexible Map
|
|
4 |
Plugin URI: http://flexible-map.webaware.net.au/
|
5 |
Author URI: http://www.webaware.com.au/
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ
|
7 |
-
Tags: google, map, maps, google maps, shortcode, kml
|
8 |
Requires at least: 3.2.1
|
9 |
-
Tested up to: 3.8
|
10 |
-
Stable tag: 1.7.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -32,6 +32,7 @@ Flexible Map allows you to add Google Maps to your WordPress website.
|
|
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
|
|
|
35 |
|
36 |
Click to see [WP Flexible Map in action](http://flexible-map.webaware.net.au/).
|
37 |
|
@@ -47,6 +48,7 @@ Many thanks to the generous efforts of these people for human translations:
|
|
47 |
|
48 |
* Dutch (nl) -- [Ivan Beemster](http://www.lijndiensten.com/)
|
49 |
* French (fr) -- [mister klucha](http://profiles.wordpress.org/mister-klucha/)
|
|
|
50 |
* Greek (el) -- [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)
|
51 |
* Spanish (es) -- [edurramos](http://profiles.wordpress.org/edurramos/)
|
52 |
|
@@ -89,6 +91,7 @@ Either the center or the address paramater is required. If you provide both, the
|
|
89 |
|
90 |
* **src**: the URL for a KML file to load map details from, e.g. *src="http://example.com/map.kml"*
|
91 |
* **targetfix**: prevent links from opening in new window, from [true, false], e.g. *targetfix="true"*; default=true
|
|
|
92 |
|
93 |
*Sample*:
|
94 |
`[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="100%" height="400px"]`
|
@@ -118,7 +121,6 @@ Either the center or the address paramater is required. If you provide both, the
|
|
118 |
* **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
|
119 |
* **region**: specify region to help localise address searches for street address map and directions, taken from the list of [country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) e.g. *region="AU"*
|
120 |
* **locale**: use a specific locale (language) for messages like the text of the Directions link, e.g. *locale="nl-BE"*
|
121 |
-
* **visualrefresh**: enable [visual refresh](https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh); NB: affects all maps on the page! from [true, false]; default=false
|
122 |
|
123 |
= Calling from templates or plugins =
|
124 |
|
@@ -140,11 +142,12 @@ There is a PHP function `flexmap_show_map()` for theme and plugin developers. Al
|
|
140 |
|
141 |
There are also some filter hooks that allow you to change the behaviour of the plugin.
|
142 |
|
143 |
-
* **flexmap_google_maps_api_args**: filter the array of arguments that will be passed to the Google Maps API, e.g. 'v'=>'3.
|
144 |
* **flexmap_google_maps_api_url**: filter the Google Maps API URL, as a string
|
145 |
* **flexmap_shortcode_attrs**: filter the array of shortcode attributes, e.g. change the width and height
|
146 |
* **flexmap_shortcode_styles**: filter the array of inline styles applied to the div wrapping the map, e.g. remove width and height so that it can be specified in the theme's stylesheets
|
147 |
-
* **flexmap_shortcode_html**: filter the generated
|
|
|
148 |
|
149 |
For more information and examples, see [the website](http://flexible-map.webaware.net.au/).
|
150 |
|
@@ -170,7 +173,12 @@ Using a KML file, you can have as many markers on a map as you like, with as muc
|
|
170 |
|
171 |
= Why won't my KML map update when I edit the KML file? =
|
172 |
|
173 |
-
Google Maps API caches the KML file, so it
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
= What parts of KML are supported? =
|
176 |
|
@@ -186,7 +194,7 @@ When you use just centre coordinates for your map, the directions may send peopl
|
|
186 |
|
187 |
= How do I get the maps to use my language? =
|
188 |
|
189 |
-
|
190 |
|
191 |
Google Maps will use the locale information from your web browser to help display maps and directions in your language (see your browser's language settings). If you want to force the Google Maps language for every map on a page, you can use a filter hook. For example, here's how to force the Google Maps language to match the language of the page / post its on (e.g. when using WPML translated content):
|
192 |
|
@@ -276,6 +284,9 @@ The plugin will detect when AJAX is being used via the [WordPress standard metho
|
|
276 |
|
277 |
NB: currently, only AJAX methods that parse script tags will work correctly; this includes some [jQuery methods](http://stackoverflow.com/q/2203762/911083) (but [not all](http://stackoverflow.com/a/2699905/911083)). A future version of the plugin will be more AJAX friendly.
|
278 |
|
|
|
|
|
|
|
279 |
|
280 |
== Screenshots ==
|
281 |
|
@@ -286,6 +297,16 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
|
|
286 |
|
287 |
== Changelog ==
|
288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
= 1.7.2 [2014-01-01] =
|
290 |
* fixed: Spanish translation (thanks, [edurramos](http://profiles.wordpress.org/edurramos/)!)
|
291 |
* fixed: clean up JSHint warnings
|
@@ -328,7 +349,7 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
|
|
328 |
|
329 |
= 1.6.1 [2013-01-29] =
|
330 |
* fixed: infowindow auto-pans on load, to prevent the top of the bubble being cropped
|
331 |
-
* added: WordPress filter
|
332 |
* added: function flexmap_show_map() accepts an attribute "echo", and returns a string without output to screen when "echo"=>"false"
|
333 |
* changed: all scripts now loaded through wp_enqueue_scripts, including language scripts (thanks to a [tip from toscho](http://wordpress.stackexchange.com/a/38335/24260))
|
334 |
* changed: bump version of Google Maps API to 3.11
|
4 |
Plugin URI: http://flexible-map.webaware.net.au/
|
5 |
Author URI: http://www.webaware.com.au/
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ
|
7 |
+
Tags: google, map, maps, google maps, shortcode, google maps shortcode, kml
|
8 |
Requires at least: 3.2.1
|
9 |
+
Tested up to: 3.8.1
|
10 |
+
Stable tag: 1.7.3
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
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
|
35 |
+
* minimal dependencies -- just WordPress and the Google Maps API
|
36 |
|
37 |
Click to see [WP Flexible Map in action](http://flexible-map.webaware.net.au/).
|
38 |
|
48 |
|
49 |
* Dutch (nl) -- [Ivan Beemster](http://www.lijndiensten.com/)
|
50 |
* French (fr) -- [mister klucha](http://profiles.wordpress.org/mister-klucha/)
|
51 |
+
* German (de) -- [Carib Design](http://www.caribdesign.com//)
|
52 |
* Greek (el) -- [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)
|
53 |
* Spanish (es) -- [edurramos](http://profiles.wordpress.org/edurramos/)
|
54 |
|
91 |
|
92 |
* **src**: the URL for a KML file to load map details from, e.g. *src="http://example.com/map.kml"*
|
93 |
* **targetfix**: prevent links from opening in new window, from [true, false], e.g. *targetfix="true"*; default=true
|
94 |
+
* **kmlcache**: ask Google Maps to use a new map instead of cached map, specified in minutes (90 minutes), hours (2 hours), days (1 day), or "none"; minimum 5 minutes, default "none"
|
95 |
|
96 |
*Sample*:
|
97 |
`[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="100%" height="400px"]`
|
121 |
* **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
|
122 |
* **region**: specify region to help localise address searches for street address map and directions, taken from the list of [country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) e.g. *region="AU"*
|
123 |
* **locale**: use a specific locale (language) for messages like the text of the Directions link, e.g. *locale="nl-BE"*
|
|
|
124 |
|
125 |
= Calling from templates or plugins =
|
126 |
|
142 |
|
143 |
There are also some filter hooks that allow you to change the behaviour of the plugin.
|
144 |
|
145 |
+
* **flexmap_google_maps_api_args**: filter the array of arguments that will be passed to the Google Maps API, e.g. `'v'=>'3.exp'`, `'sensor'=>'false'`
|
146 |
* **flexmap_google_maps_api_url**: filter the Google Maps API URL, as a string
|
147 |
* **flexmap_shortcode_attrs**: filter the array of shortcode attributes, e.g. change the width and height
|
148 |
* **flexmap_shortcode_styles**: filter the array of inline styles applied to the div wrapping the map, e.g. remove width and height so that it can be specified in the theme's stylesheets
|
149 |
+
* **flexmap_shortcode_html**: filter the generated HTML, e.g. wrap another div around it, add a link to Google Maps, add some additonal script, etc.
|
150 |
+
* **flexmap_shortcode_script**: filter the generated JavaScript
|
151 |
|
152 |
For more information and examples, see [the website](http://flexible-map.webaware.net.au/).
|
153 |
|
173 |
|
174 |
= Why won't my KML map update when I edit the KML file? =
|
175 |
|
176 |
+
Google Maps API caches the KML file, so it can take a while for your new changes to appear. To force a change, append a URL query parameter with a number (known as a cache buster) and increment the number each time you change the KML file. A nice simple and commonly used parameter name is v (for version), like this: http://example.com/my-map.kml?v=2
|
177 |
+
|
178 |
+
If your map is auto-generated or changes frequently, add the `kmlcache` attribute to ask Google to fetch a new copy periodically. You can specify the interval in minutes (e.g. "90 minutes"), hours (e.g. "2 hours"), or days (e.g. "1 day"). The minimum interval is 5 minutes.
|
179 |
+
|
180 |
+
`[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml?v=2"]
|
181 |
+
[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" kmlcache="8 hours"]`
|
182 |
|
183 |
= What parts of KML are supported? =
|
184 |
|
194 |
|
195 |
= How do I get the maps to use my language? =
|
196 |
|
197 |
+
The plugin uses localised messages for things like the Directions link and the default message on links in info windows. If you have your [WordPress installation set to use your language](http://codex.wordpress.org/WordPress_in_Your_Language), the plugin should automatically pick it up. If you need to force it to pick up your language (or want to offer a different language), use the `locale` attribute, e.g. `locale="ru"` or `locale="zh-TW"`.
|
198 |
|
199 |
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):
|
200 |
|
284 |
|
285 |
NB: currently, only AJAX methods that parse script tags will work correctly; this includes some [jQuery methods](http://stackoverflow.com/q/2203762/911083) (but [not all](http://stackoverflow.com/a/2699905/911083)). A future version of the plugin will be more AJAX friendly.
|
286 |
|
287 |
+
= I have CloudFlare Rocketscript turned on and the map doesn't work =
|
288 |
+
|
289 |
+
Either turn off CloudFlare Rocketscript :) or install the [Flxmap No Rocketscript](https://gist.github.com/webaware/8949605) plugin by loading that file into your website's wp-content/plugins folder and activating through the plugins admin page. Use the plugin if you still want Rocketscript to manage all of your other scripts but leave the Flexible Map scripts alone.
|
290 |
|
291 |
== Screenshots ==
|
292 |
|
297 |
|
298 |
== Changelog ==
|
299 |
|
300 |
+
= 1.7.3 [2014-03-16] =
|
301 |
+
* fixed: German translation (thanks, [Carib Design](http://www.caribdesign.com//)!)
|
302 |
+
* fixed: some themes (e.g. Evolve) mess up Google Maps directions markers
|
303 |
+
* fixed: CSS for infowindows with Google Maps Visual Refresh / API v3.15
|
304 |
+
* changed: removed instructions page, better handled by new homepage for plugin
|
305 |
+
* changed: bump version of Google Maps API to 3.15
|
306 |
+
* added: KML cache buster attribute `kmlcache`, for dynamically created KML maps
|
307 |
+
* added: WordPress filter `flexmap_shortcode_script`
|
308 |
+
* removed: `visualrefresh` attribute doesn't do anything any more (Google Maps API has adopted Visual Refresh as standard)
|
309 |
+
|
310 |
= 1.7.2 [2014-01-01] =
|
311 |
* fixed: Spanish translation (thanks, [edurramos](http://profiles.wordpress.org/edurramos/)!)
|
312 |
* fixed: clean up JSHint warnings
|
349 |
|
350 |
= 1.6.1 [2013-01-29] =
|
351 |
* fixed: infowindow auto-pans on load, to prevent the top of the bubble being cropped
|
352 |
+
* added: WordPress filter `flexmap_google_maps_api_args` for filtering array of arguments before building Google Maps API URL
|
353 |
* added: function flexmap_show_map() accepts an attribute "echo", and returns a string without output to screen when "echo"=>"false"
|
354 |
* changed: all scripts now loaded through wp_enqueue_scripts, including language scripts (thanks to a [tip from toscho](http://wordpress.stackexchange.com/a/38335/24260))
|
355 |
* changed: bump version of Google Maps API to 3.11
|
styles.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/* stop some themes from messing up Google Maps' styling (e.g. twentyeleven, twentythirteen) */
|
2 |
|
3 |
.flxmap-container * {
|
4 |
-webkit-box-sizing: content-box;
|
@@ -14,6 +14,7 @@
|
|
14 |
background-color: transparent !important;
|
15 |
}
|
16 |
|
|
|
17 |
.entry-content .flxmap-directions img.adp-marker {
|
18 |
max-width: none;
|
19 |
-webkit-box-shadow: none;
|
@@ -27,17 +28,10 @@
|
|
27 |
|
28 |
/* some basic styling for info window */
|
29 |
|
30 |
-
.flxmap-infowin {
|
31 |
-
|
32 |
-
color: #333;
|
33 |
}
|
34 |
|
35 |
-
.flxmap-marker-title {
|
36 |
font-weight: bold;
|
37 |
-
font-size: medium;
|
38 |
-
}
|
39 |
-
|
40 |
-
.flxmap-marker-link, .flxmap-directions-link {
|
41 |
-
font-weight: normal;
|
42 |
-
font-size: small;
|
43 |
}
|
1 |
+
/* stop some themes from messing up Google Maps' styling (e.g. twentyeleven, twentytwelve, twentythirteen...) */
|
2 |
|
3 |
.flxmap-container * {
|
4 |
-webkit-box-sizing: content-box;
|
14 |
background-color: transparent !important;
|
15 |
}
|
16 |
|
17 |
+
.site-content .flxmap-directions img.adp-marker,
|
18 |
.entry-content .flxmap-directions img.adp-marker {
|
19 |
max-width: none;
|
20 |
-webkit-box-shadow: none;
|
28 |
|
29 |
/* some basic styling for info window */
|
30 |
|
31 |
+
.gm-style .gm-style-iw .flxmap-infowin {
|
32 |
+
color: #2c2c2c;
|
|
|
33 |
}
|
34 |
|
35 |
+
.gm-style .gm-style-iw .flxmap-marker-title {
|
36 |
font-weight: bold;
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|