From 2f6aae8455cc47d9b8fe6be9b1fb142326776932 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Sun, 8 Jan 2012 16:47:40 +0000 Subject: [PATCH] --- readme.txt | 6 ++- wp-gpx-maps.php | 91 ++++++++++++++++--------------------------- wp-gpx-maps_Utils.php | 47 +++++++++++++++++++++- wp-gpx-maps_admin.php | 22 ++++------- 4 files changed, 90 insertions(+), 76 deletions(-) diff --git a/readme.txt b/readme.txt index bdace11..e9ae85b 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=basti Tags: maps, gpx, gps, graph, google maps, google chart, track, garmin Requires at least: 2.0.0 Tested up to: 3.3 -Stable tag: 1.1.1 +Stable tag: 1.1.2 License: GPLv2 or later Draws a gpx track with altitude graph @@ -72,6 +72,9 @@ Yes! 2. Admin area == Changelog == += 1.1.2 = +* Improved page load time +* Added compatibility to Wordpress Multisite (WPMU) = 1.1.1 = * minor bug fixes = 1.1.0 = @@ -104,6 +107,7 @@ Yes! * Initial release. == Upgrade Notice == += 1.1.2 = = 1.1.1 = = 1.1.0 = = 1.0.9 = diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index be9fdee..6600b31 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -3,12 +3,14 @@ Plugin Name: WP-GPX-Maps Plugin URI: http://www.darwinner.it/ Description: Draws a gpx track with altitude graph -Version: 1.1.1 +Version: 1.1.2 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ License: GPL */ +//error_reporting (E_ALL); + include 'wp-gpx-maps_Utils.php'; include 'wp-gpx-maps_admin.php'; @@ -36,7 +38,6 @@ function WP_GPX_Maps_action_links($links, $file) { return $links; } - function enqueue_WP_GPX_Maps_scripts() { ?> @@ -49,65 +50,39 @@ function enqueue_WP_GPX_Maps_scripts() registerXPathNamespace('10', 'http://www.topografix.com/GPX/1/0'); $gpx->registerXPathNamespace('11', 'http://www.topografix.com/GPX/1/1'); $gpx->registerXPathNamespace('gpxx', 'http://www.garmin.com/xmlschemas/GpxExtensions/v3'); @@ -49,6 +77,13 @@ if ( count($nodes) > 0 ) { + + $lastLat = 0; + $lastLon = 0; + $lastEle = 0; + $dist = 0; + $lastOffset = 0; + // normal case foreach($nodes as $trkpt) { @@ -84,6 +119,7 @@ $lastLon=$lon; $lastEle=$ele; } + unset($nodes); } else @@ -94,6 +130,12 @@ if ( count($nodes) > 0 ) { + $lastLat = 0; + $lastLon = 0; + $lastEle = 0; + $dist = 0; + $lastOffset = 0; + // Garmin case foreach($nodes as $rpt) { @@ -127,13 +169,14 @@ $lastLat=$lat; $lastLon=$lon; } - + unset($nodes); } else { - echo "Gpx Empty or not supported!"; + echo "Empty Gpx or not supported File!"; } } + unset($gpx); return $points; } diff --git a/wp-gpx-maps_admin.php b/wp-gpx-maps_admin.php index 82a8e9e..e3ae41f 100644 --- a/wp-gpx-maps_admin.php +++ b/wp-gpx-maps_admin.php @@ -10,11 +10,10 @@ if ( is_admin() ){ } function WP_GPX_Maps_html_page() { - - $uploadsPath = substr (__FILE__, 0, strrpos(__FILE__,'wp-content')).DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."uploads"; - $realGpxPath = substr (__FILE__, 0, strrpos(__FILE__,'wp-content')).DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."uploads".DIRECTORY_SEPARATOR."gpx"; + $realGpxPath = gpxFolderPath(); + $relativeGpxPath = relativeGpxFolderPath(); + $relativeGpxPath = str_replace("\\","/", $relativeGpxPath); $gpxRegEx = '/.gpx$/'; - ?>
@@ -28,13 +27,7 @@ function WP_GPX_Maps_html_page() { } else { - - if(!file_exists($uploadsPath)) - { - @mkdir($uploadsPath); - } - - if (!@mkdir($realGpxPath)) { + if (!@mkdir($realGpxPath,755,true)) { echo '
Can\'t create '.$realGpxPath.' folder. Please create it and make it writable!
If not, you will must update the file manually! @@ -54,9 +47,9 @@ function WP_GPX_Maps_html_page() {
The fastest way to use this plugin: upload the file using the uploader below, than put this - shotcode: [sgpx gpx="/wp-content/uploads/gpx/< gpx file name >"] in the pages/posts. + shotcode: [sgpx gpx="< gpx file name >"] in the pages/posts.

- Full set of attributes: [sgpx gpx="/wp-content/uploads/gpx/< gpx file name >" width=100% mheight=450px gheight=200px mtype=SATELLITE waypoints=true donotreducegpx=false pointsoffset=10] + Full set of attributes: [sgpx gpx="< gpx file name >" width=100% mheight=450px gheight=200px mtype=SATELLITE waypoints=true donotreducegpx=false pointsoffset=10]

@@ -115,7 +108,6 @@ function WP_GPX_Maps_html_page() { } } - if ( is_writable ( $realGpxPath ) ){ ?> @@ -194,7 +186,7 @@ function WP_GPX_Maps_html_page() { | Download | - Shortcode: [sgpx gpx="/wp-content/uploads/gpx/"] + Shortcode: [sgpx gpx=""]