diff --git a/readme.txt b/readme.txt index 82823c2..17e64e8 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.0.8 +Stable tag: 1.0.9 License: GPLv2 or later Draws a gpx track with altitude graph @@ -68,6 +68,9 @@ Yes! 2. Admin area == Changelog == += 1.0.9 = +* Minor bug fix +* Windows/IIS compatibility = 1.0.8 = * New icons (from google maps) * Added interactivity over the map @@ -92,6 +95,7 @@ Yes! * Initial release. == Upgrade Notice == += 1.0.9 = = 1.0.8 = = 1.0.7 = * Added waypoints support. To enable this feature please check the plugin settings diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index fbc91ee..03dbe80 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.0.8 +Version: 1.0.9 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ License: GPL @@ -58,7 +58,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $mt = $attr["mtype"]; $gh = $attr["gheight"]; $showW = $attr['waypoints']; - + if ($w == '') { $w = get_option("wpgpxmaps_width"); @@ -91,9 +91,15 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $r = rand(1,5000000); + $sitePath = substr (__FILE__, 0, strrpos(__FILE__,'wp-content')).DIRECTORY_SEPARATOR; + $gpx = trim($gpx); - $points = getPoints($gpx); + $gpx = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $gpx); + + $gpx = $sitePath . $gpx; + + $points = getPoints( $gpx ); $points_maps = ''; $points_graph = ''; $waypoints = ''; diff --git a/wp-gpx-maps_Utils.php b/wp-gpx-maps_Utils.php index dac2dd4..a5f990f 100644 --- a/wp-gpx-maps_Utils.php +++ b/wp-gpx-maps_Utils.php @@ -14,17 +14,15 @@ { $gpxOffset = 10; } - - $realGpxPath = substr (__FILE__, 0, strrpos(__FILE__,'/wp-content/')).$gpxPath; - if (file_exists($realGpxPath)) + if (file_exists($gpxPath)) { - $points = parseXml($realGpxPath, $gpxOffset); + $points = parseXml($gpxPath, $gpxOffset); } else { array_push($points, array((float)0,(float)0,(float)0,(float)0)); - echo "File $realGpxPath not found!"; + echo "File $gpxPath not found!"; } // riduco l'array a circa 200 punti per non appensantire la pagina(mappa e grafico)! $count=sizeof($points); @@ -143,11 +141,10 @@ function getWayPoints($gpxPath) { $points = array(); - $realGpxPath = substr (__FILE__, 0, strrpos(__FILE__,'/wp-content/')).$gpxPath; - if (file_exists($realGpxPath)) + if (file_exists($gpxPath)) { $points = array(); - $gpx = simplexml_load_file($realGpxPath); + $gpx = simplexml_load_file($gpxPath); $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'); diff --git a/wp-gpx-maps_admin.php b/wp-gpx-maps_admin.php index 20991a4..c6c70e8 100644 --- a/wp-gpx-maps_admin.php +++ b/wp-gpx-maps_admin.php @@ -11,7 +11,8 @@ if ( is_admin() ){ function WP_GPX_Maps_html_page() { - $realGpxPath = substr (__FILE__, 0, strrpos(__FILE__,'/wp-content/'))."/wp-content/uploads/gpx"; + $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"; $gpxRegEx = '/.gpx$/'; ?> @@ -27,7 +28,13 @@ function WP_GPX_Maps_html_page() { } else { - if (!@mkdir($dir)) { + + if(!file_exists($uploadsPath)) + { + @mkdir($uploadsPath); + } + + if (!@mkdir($realGpxPath)) { echo '
Can\'t create '.$realGpxPath.' folder. Please create it and make it writable!
If not, you will must update the file manually! @@ -57,9 +64,9 @@ function WP_GPX_Maps_html_page() { Width: , Maps Height: , - Graph Height: , + Graph Height: , onchange="this.value = (this.checked)" />Show Waypoints - + @@ -98,8 +105,10 @@ function WP_GPX_Maps_html_page() { } } - if ( is_readable ( $realGpxPath ) && $handle = opendir($realGpxPath)) { -?> + + if ( is_writable ( $realGpxPath ) ){ + + ?>
@@ -123,7 +132,21 @@ function WP_GPX_Maps_html_page() { } ?>
-
+
+ + + + + +