From 20618fdf99e55f4f85b96e15dc593b55f76f4ea0 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Thu, 17 Apr 2014 12:17:50 +0000 Subject: [PATCH] * fix: http/https javascript registration * fix: full screen map css issue --- WP-GPX-Maps.js | 3 ++- readme.txt | 15 +++++++++------ wp-gpx-maps.php | 23 ++++++----------------- wp-gpx-maps_utils.php | 23 +++++++++-------------- 4 files changed, 26 insertions(+), 38 deletions(-) diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index a7d5890..ce82415 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -266,7 +266,8 @@ Author URI: http://www.pedemontanadelgrappa.it/ css('left', 0). css("width", '100%'). css("height", '100%'). - css("z-index", '100'); + css("z-index", '100'), + css("z-index", '100000'); jQuery("#wpadminbar").each(function(){ jQuery(mapDiv).css('top', jQuery(this).height()); }); diff --git a/readme.txt b/readme.txt index 54d6669..b3735c9 100644 --- a/readme.txt +++ b/readme.txt @@ -4,8 +4,8 @@ Contributors: bastianonm 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: 3.8 -Stable tag: 1.3.0 +Tested up to: 3.9 +Stable tag: 1.3.1 Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. @@ -19,12 +19,12 @@ Fully configurable: - Multiple language support Supported charts: -- Altitude +- Altitude - Speed - Heart Rate -- Temperature -- Cadence -- Grade +- Temperature +- Cadence +- Grade NextGen Gallery Integration: @@ -187,6 +187,9 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.3.1 = +* fix: http/https javascript registration +* fix: full screen map css issue = 1.3.0 = * Speed improvement * Rewritten js classes diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 6100852..a675773 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -2,8 +2,8 @@ /* Plugin Name: WP-GPX-Maps Plugin URI: http://www.devfarm.it/ -Description: Draws a gpx track with altitude graph -Version: 1.3.0 +Description: Draws a GPX track with altitude chart +Version: 1.3.1 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ */ @@ -48,21 +48,10 @@ function WP_GPX_Maps_action_links($links, $file) { function enqueue_WP_GPX_Maps_scripts() { - wp_enqueue_script( 'jquery' ); - - wp_deregister_script( 'googlemaps' ); - wp_register_script( 'googlemaps', 'https://maps.googleapis.com/maps/api/js?sensor=false&v=3.9', null, null); - wp_enqueue_script( 'googlemaps' ); - - wp_deregister_script( 'highcharts' ); - wp_register_script( 'highcharts', "http://code.highcharts.com/highcharts.js", array('jquery'), "2.3.3", true); - wp_enqueue_script( 'highcharts' ); - - wp_deregister_script( 'WP-GPX-Maps' ); - wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.0"); - wp_enqueue_script( 'WP-GPX-Maps' ); - + wp_enqueue_script( 'googlemaps', '//maps.googleapis.com/maps/api/js?sensor=false', null, null); + wp_enqueue_script( 'highcharts', "//code.highcharts.com/highcharts.js", array('jquery'), "2.3.3", true); + wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.0"); } function print_WP_GPX_Maps_scripts() @@ -474,7 +463,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') } $avg_speed = convertSpeed($avg_speed,$uomspeed,true); - + if ($showW == true) { $wpoints = getWayPoints($gpx); foreach ($wpoints as $p) { diff --git a/wp-gpx-maps_utils.php b/wp-gpx-maps_utils.php index 509bc89..fba363a 100644 --- a/wp-gpx-maps_utils.php +++ b/wp-gpx-maps_utils.php @@ -79,7 +79,7 @@ return TRUE; } - function getPoints($gpxPath,$gpxOffset = 10, $donotreducegpx, $distancetype) + function getPoints($gpxPath, $gpxOffset = 10, $donotreducegpx, $distancetype) { $points = array(); @@ -96,7 +96,7 @@ } else { - echo "File $gpxPath not found!"; + echo "WP GPX Maps Error: File $gpxPath not found!"; } // reduce the points to around 200 to speedup @@ -160,8 +160,6 @@ $gpx->registerXPathNamespace('11', 'http://www.topografix.com/GPX/1/1'); $gpx->registerXPathNamespace('gpxtpx', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1'); - $count_wpt = count( $gpx->xpath('//wpt | //10:wpt | //11:wpt') ); - $nodes = $gpx->xpath('//trk | //10:trk | //11:trk'); //normal gpx @@ -510,15 +508,7 @@ unset($nodes); } - else - { - - if ($count_wpt == 0) - { - echo "Empty Gpx or not supported File!"; - } - } } } @@ -532,8 +522,13 @@ $points = array(); if (file_exists($gpxPath)) { - $points = array(); - $gpx = simplexml_load_file($gpxPath); + try { + $gpx = simplexml_load_file($gpxPath); + } catch (Exception $e) { + echo "WP GPX Maps Error: Cant parse xml file " . $gpxPath; + return $points; + } + $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');