From c6e26c868c9275aca435c3d38dda75fe567f5059 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Fri, 22 Jun 2012 07:41:42 +0000 Subject: [PATCH] --- readme.txt | 2 +- wp-gpx-maps.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/readme.txt b/readme.txt index 6930431..3c71090 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: maps, gpx, gps, graph, chart, google maps, highcharts, 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.4 -Stable tag: 1.1.26 +Stable tag: 1.1.27 License: GPLv2 or later Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 379edf0..fa0f2be 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -3,7 +3,7 @@ Plugin Name: WP-GPX-Maps Plugin URI: http://www.darwinner.it/ Description: Draws a gpx track with altitude graph -Version: 1.1.26 +Version: 1.1.27 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ License: GPL @@ -178,14 +178,16 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $gpx = trim($gpx); - if (strpos($gpxurl, "http://") === 0 || strpos($gpxurl, "https://") === 0) + $isGpxUrl = (preg_match('/^(http(s)?\:\/\/)/', $gpx) == 1); + + if ($isGpxUrl == true) { - $gpx = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $gpx); - $gpx = $sitePath . $gpx; + $gpx = downloadRemoteFile($gpx); } else { - $gpx = downloadRemoteFile($gpx); + $gpx = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $gpx); + $gpx = $sitePath . $gpx; } if ($gpx == '') @@ -363,7 +365,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') if ($download=='true' && $gpxurl != '') { - if (strpos($gpxurl, "http://") === 0 || strpos($gpxurl, "https://") === 0) + if ($isGpxUrl == true) { }