From 7ec4369b82632f77035ff92456fe6fb451ebf3b6 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Thu, 17 Dec 2015 10:56:23 +0000 Subject: [PATCH] Version 1.3.9 Versione Retrieve waypoints in JSON, possibility to add a custom marker --- WP-GPX-Maps.js | 2 +- readme.txt | 6 ++- wp-gpx-maps.php | 107 ++++++++++++++++++++++-------------------- wp-gpx-maps_utils.php | 1 - 4 files changed, 62 insertions(+), 54 deletions(-) diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index 8bc854e..280c883 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -1293,4 +1293,4 @@ Author URI: http://www.pedemontanadelgrappa.it/ return Math.sqrt(dLat * dLat + dLon * dLon); } -}( jQuery )); +}( jQuery )); \ No newline at end of file diff --git a/readme.txt b/readme.txt index 2ca00c7..839a0c0 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ === WP GPX Maps === -Contributors: bastianonm, Stephan Klein +Contributors: bastianonm, Stephan Klein, Michel Selerin Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence Requires at least: 2.0.0 Tested up to: 4.3.1 -Stable tag: 1.3.8 +Stable tag: 1.3.9 Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. @@ -195,6 +195,8 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.3.9 = +* Retrieve waypoints in JSON, possibility to add a custom marker (Changed by Michel Selerin) = 1.3.8 = * Improved Google Maps visualization = 1.3.7 = diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 475d6b4..80c8970 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -266,7 +266,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $mtime = 0; } - $cacheFileName = "$gpx,$mtime,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.5"; + $cacheFileName = "$gpx,$mtime,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.9"; $cacheFileName = md5($cacheFileName); @@ -511,12 +511,16 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') } $avg_speed = convertSpeed($avg_speed,$uomspeed,true); - + $waypoints = '[]'; + if ($showW == true) { $wpoints = getWayPoints($gpx); + /* foreach ($wpoints as $p) { $waypoints .= '['.number_format ( (float)$p[0] , 7 , '.' , '' ).','.number_format ( (float)$p[1] , 7 , '.' , '' ).',\''.unescape($p[4]).'\',\''.unescape($p[5]).'\',\''.unescape($p[7]).'\'],'; } + */ + $waypoints = json_encode($wpoints); } if ($showEle == "false") @@ -630,54 +634,57 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') '. $error .' '; // print summary diff --git a/wp-gpx-maps_utils.php b/wp-gpx-maps_utils.php index 81be0ae..503408f 100644 --- a/wp-gpx-maps_utils.php +++ b/wp-gpx-maps_utils.php @@ -584,7 +584,6 @@ $gpx->registerXPathNamespace('10', 'http://www.topografix.com/GPX/1/0'); $gpx->registerXPathNamespace('11', 'http://www.topografix.com/GPX/1/1'); $nodes = $gpx->xpath('//wpt | //10:wpt | //11:wpt'); - global $wpdb; if ( count($nodes) > 0 )