From 0c8922918d6ec0299836ba384416af4375485f30 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Tue, 31 Jul 2012 14:34:27 +0000 Subject: [PATCH] --- languages/wp-gpx-maps-de_DE.mo | Bin 0 -> 1138 bytes languages/wp-gpx-maps-de_DE.po | 79 +++++++++++++++++++ readme.txt | 43 ++++++++-- wp-gpx-maps.php | 139 ++++++++++++++++++++------------- wp-gpx-maps_admin_settings.php | 84 +++++++++++++++++++- wp-gpx-maps_utils.php | 16 ++++ 6 files changed, 297 insertions(+), 64 deletions(-) create mode 100644 languages/wp-gpx-maps-de_DE.mo create mode 100644 languages/wp-gpx-maps-de_DE.po diff --git a/languages/wp-gpx-maps-de_DE.mo b/languages/wp-gpx-maps-de_DE.mo new file mode 100644 index 0000000000000000000000000000000000000000..bb67c54e28987a97e35befd9ba9175c95589caba GIT binary patch literal 1138 zcmZvaKW`H;7{(2h0-^ks5JE6`1R00R<_la!RImYiRn*YCZ4Y`;G)j=f?^@ zecsifz5&*eGXwg(m&XSFUV%RE19$=a40?ZGK=1n-cn#kTh}C3|Q$iituTWEZpK8bs@k%UpM3y!BdpA=j6CNb0-BLPY0~wMHU}R4z>!kNr zH|Zt?PArFFjf{oEGVf+0%6g(LGh0}tEHzHlY@|XlpGQ_S(=spAA2mhAP~VWK!eg0F z6-!g1ct=c4^HQliefwsyR4gJ)YPNT(nX(^K~F7wGzuz^Pk;yS{jh=s`lTiX2; z6RYM3+aT7;Ig6JG;;z!6ind7M2@IkehMwi5ci7yP%PC3dkQP}>lcc4R5VlniJKjQ@ zpsm<}I9npK^RFJ7MYSdB4V<7`_RHNDs9http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/ + +Translated into 7 languages: +- English (default) +- Italian it_IT +- German de_DE +- Spanish es_ES +- Dutch nl_NL +- Swedish sv_SE +- Turkish tr_TR +(many thanks to all the guys who helped me with the translations) + - iphone/ipad/ipod Compatible Try this plugin: http://www.pedemontanadelgrappa.it/category/mappe/ -Thanks to: www.securcube.net, www.darwinner.it, www.pedemontanadelgrappa.it, - -Plugin page - Support Forum Supported gpx namespaces are: @@ -44,6 +52,8 @@ Supported gpx namespaces are: 1. http://www.garmin.com/xmlschemas/TrackPointExtension/v1 +Thanks to: www.securcube.net, www.darwinner.it, www.pedemontanadelgrappa.it, + == Installation == 1. Use the classic wordpress plugin installer or copy the plugins folder to the `/wp-content/plugins/` directory @@ -118,10 +128,25 @@ The attributes are: 1. download: Allow users to download your GPX file -1. summary: Print symmary details of your GPX (default is FALSE) - 1. dtoffset: the difference (in seconds) between your gpx tool date and your camera date +1. skipcache: Do not use cache. If TRUE might be very slow (default is FALSE) + +1. summary: Print summary details of your GPX (default is FALSE) + +1. summarytotlen: Print Total distance in summary table (default is FALSE) + +1. summarymaxele: Print Max Elevation in summary table (default is FALSE) + +1. summaryminele: Print Min Elevation in summary table (default is FALSE) + +1. summaryeleup: Print Total climbing in summary table (default is FALSE) + +1. summaryeledown: Print Total descent in summary table (default is FALSE) + +1. summaryavgspeed: Print Average Speed in summary table (default is FALSE) + +1. summarytotaltime: Print Total time in summary table (default is FALSE) = What happening if I've a very large gpx? = This plugin will print a small amout of points to speedup javascript and pageload. @@ -138,6 +163,10 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.1.32 = +* You can exclude cache (slower and not recommended) +* You can decide what show in the summary table +* German translation (thanks to Ali) = 1.1.31 = * Fixed fullscreen map image slideshow = 1.1.30 = diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 0a07642..661c378 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.31 +Version: 1.1.32 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ License: GPL @@ -133,14 +133,23 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", ""); $ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", ""); $download = findValue($attr, "download", "wpgpxmaps_download", ""); - $summary = findValue($attr, "summary", "wpgpxmaps_summary", ""); $dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0); + $skipcache = findValue($attr, "skipcache", "wpgpxmaps_skipcache", ""); + + $summary = findValue($attr, "summary", "wpgpxmaps_summary", ""); + $p_tot_len = findValue($attr, "summarytotlen", "wpgpxmaps_summary_tot_len", false); + $p_max_ele = findValue($attr, "summarymaxele", "wpgpxmaps_summary_max_ele", false); + $p_min_ele = findValue($attr, "summaryminele", "wpgpxmaps_summary_min_ele", false); + $p_total_ele_up = findValue($attr, "summaryeleup", "wpgpxmaps_summary_total_ele_up", false); + $p_total_ele_down = findValue($attr, "summaryeledown", "wpgpxmaps_summary_total_ele_down", false); + $p_avg_speed = findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false); + $p_total_time = findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false); $r = rand(1,5000000); $gpxurl = $gpx; - $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uomspeed,$uom,v1.1.30"; + $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uomspeed,$uom,v1.1.32"; $cacheFileName = md5($cacheFileName); @@ -153,8 +162,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') // Try to load cache - if (file_exists($gpxcache)) + if (file_exists($gpxcache) && !($skipcache == true)) { + try { $cache_str = file_get_contents($gpxcache); $cache_obj = unserialize($cache_str); @@ -170,6 +180,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $waypoints = $cache_obj["waypoints"]; $max_ele = $cache_obj["max_ele"]; $min_ele = $cache_obj["min_ele"]; + $max_time = $cache_obj["max_time"]; + $min_time = $cache_obj["min_time"]; $total_ele_up = $cache_obj["total_ele_up"]; $total_ele_down = $cache_obj["total_ele_down"]; $avg_speed = $cache_obj["avg_speed"]; @@ -188,6 +200,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $waypoints= ''; $max_ele = 0; $min_ele = 0; + $max_time = 0; + $min_time = 0; $total_ele_up = 0; $total_ele_down = 0; $avg_speed = 0; @@ -235,6 +249,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $max_ele = $points->maxEle; $min_ele = $points->minEle; + $max_time = $points->maxTime; + $min_time = $points->minTime; $total_ele_up = $points->totalEleUp; $total_ele_down = $points->totalEleDown; $avg_speed = $points->avgSpeed; @@ -383,28 +399,32 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') } } - @file_put_contents($gpxcache, - serialize(array( "points_maps" => $points_maps, - "points_x_time" => $points_x_time, - "points_x_lat" => $points_x_lat, - "points_x_lon" => $points_x_lon, - "points_graph_dist" => $points_graph_dist, - "points_graph_ele" => $points_graph_ele, - "points_graph_speed" => $points_graph_speed, - "points_graph_hr" => $points_graph_hr, - "points_graph_cad" => $points_graph_cad, - "waypoints" => $waypoints, - "max_ele" => $max_ele, - "min_ele" => $min_ele, - "total_ele_up" => $total_ele_up, - "total_ele_down" => $total_ele_down, - "avg_speed" => $avg_speed, - "tot_len" => $tot_len - ) - ), - LOCK_EX); - - @chmod($gpxcache,0755); + if (!($skipcache == true)) + { + @file_put_contents($gpxcache, + serialize(array( "points_maps" => $points_maps, + "points_x_time" => $points_x_time, + "points_x_lat" => $points_x_lat, + "points_x_lon" => $points_x_lon, + "points_graph_dist" => $points_graph_dist, + "points_graph_ele" => $points_graph_ele, + "points_graph_speed" => $points_graph_speed, + "points_graph_hr" => $points_graph_hr, + "points_graph_cad" => $points_graph_cad, + "waypoints" => $waypoints, + "max_ele" => $max_ele, + "min_ele" => $min_ele, + "total_ele_up" => $total_ele_up, + "total_ele_down" => $total_ele_down, + "avg_speed" => $avg_speed, + "tot_len" => $tot_len, + "max_time" => $max_time, + "min_time" => $min_time + ) + ), + LOCK_EX); + @chmod($gpxcache,0755); + } if ($gh == "0" || $gh == "0px") { @@ -462,42 +482,51 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') }); '; - // print summary - if ($summary=='true' && ( $points_graph_speed != '' || $points_graph_ele != '' || $points_graph_dist != '') ) + // print summary + if ($summary=='true' && ( $points_graph_speed != '' || $points_graph_ele != '' || $points_graph_dist != '') ) + { + + $output .= "
"; + if ($points_graph_dist != '' && $p_tot_len == 'true') { - - $output .= "
"; - if ($points_graph_dist != '') - { - $output .= "".__("Total distance", "wp-gpx-maps").": $tot_len
"; - } - if ($points_graph_ele != '') - { + $output .= "".__("Total distance", "wp-gpx-maps").": $tot_len
"; + } + if ($points_graph_ele != '') + { + if ($p_max_ele == 'true') $output .= "".__("Max elevation", "wp-gpx-maps").": $max_ele
"; + if ($p_min_ele == 'true') $output .= "".__("Min elevation", "wp-gpx-maps").": $min_ele
"; + if ($p_total_ele_up == 'true') $output .= "".__("Total climbing", "wp-gpx-maps").": $total_ele_up
"; + if ($p_total_ele_down == 'true') $output .= "".__("Total descent", "wp-gpx-maps").": $total_ele_down
"; - } - if ($points_graph_speed != '') - { - $output .= "".__("Average speed", "wp-gpx-maps").": $avg_speed
"; - } - $output .= "
"; } - - // print download link - if ($download=='true' && $gpxurl != '') + if ($points_graph_speed != '' && $p_avg_speed == 'true') { - if ($isGpxUrl == true) - { - - } - else - { - $gpxurl = get_bloginfo('url').$gpxurl; - } - $output.="".__("Download", "wp-gpx-maps").""; + $output .= "".__("Average speed", "wp-gpx-maps").": $avg_speed
"; } + if ($p_total_time == 'true' && $max_time > 0) + { + $time_diff = date("H:i:s", ($max_time - $min_time)); + $output .= "".__("Total Time", "wp-gpx-maps").": $time_diff
"; + } + $output .= "
"; + } + + // print download link + if ($download=='true' && $gpxurl != '') + { + if ($isGpxUrl == true) + { + + } + else + { + $gpxurl = get_bloginfo('url').$gpxurl; + } + $output.="".__("Download", "wp-gpx-maps").""; + } return $output; } @@ -602,6 +631,7 @@ function WP_GPX_Maps_install() { add_option('wpgpxmaps_zoomonscrollwheel','','','yes'); add_option('wpgpxmaps_download','','','yes'); add_option('wpgpxmaps_summary','','','yes'); + add_option('wpgpxmaps_skipcache','','','yes'); } function WP_GPX_Maps_remove() { @@ -634,6 +664,7 @@ function WP_GPX_Maps_remove() { delete_option('wpgpxmaps_zoomonscrollwheel'); delete_option('wpgpxmaps_download'); delete_option('wpgpxmaps_summary'); + delete_option('wpgpxmaps_skipcache'); } ?> diff --git a/wp-gpx-maps_admin_settings.php b/wp-gpx-maps_admin_settings.php index e0a2fcc..2cc3da5 100644 --- a/wp-gpx-maps_admin_settings.php +++ b/wp-gpx-maps_admin_settings.php @@ -20,7 +20,16 @@ $showCad = get_option('wpgpxmaps_show_cadence'); $zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel"); $download = get_option("wpgpxmaps_download"); - $summary = get_option("wpgpxmaps_summary"); + $skipcache = get_option("wpgpxmaps_skipcache"); + + $summary = get_option("wpgpxmaps_summary"); + $tot_len = get_option("wpgpxmaps_summary_tot_len"); + $min_ele = get_option("wpgpxmaps_summary_min_ele"); + $max_ele = get_option("wpgpxmaps_summary_max_ele"); + $total_ele_up = get_option("wpgpxmaps_summary_total_ele_up"); + $total_ele_down = get_option("wpgpxmaps_summary_total_ele_down"); + $avg_speed = get_option("wpgpxmaps_summary_avg_speed"); + $total_time = get_option("wpgpxmaps_summary_total_time"); if (!($t)) $t = 'HYBRID'; @@ -54,29 +63,98 @@ + + Cache: + + onchange="this.value = (this.checked)" /> Do not use cache + + GPX Download: onchange="this.value = (this.checked)" /> Allow users to download your GPX file - + + + +

+ + + " /> +

+ + + +
+ +
+ + + +

Summary table

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Summary table: onchange="this.value = (this.checked)" /> Print summary table
Total distance: + onchange="this.value = (this.checked)" /> Print Total distance +
Max Elevation: + onchange="this.value = (this.checked)" /> Print Max Elevation +
Min Elevation: + onchange="this.value = (this.checked)" /> Print Min Elevation +
Min Elevation: + onchange="this.value = (this.checked)" /> Print Total climbing +
Min Elevation: + onchange="this.value = (this.checked)" /> Print Total descent +
Min Elevation: + onchange="this.value = (this.checked)" /> Print Average Speed +
Total time: + onchange="this.value = (this.checked)" /> Print Total time +

- + " />

+
+
diff --git a/wp-gpx-maps_utils.php b/wp-gpx-maps_utils.php index 1a36ccf..ab399b3 100644 --- a/wp-gpx-maps_utils.php +++ b/wp-gpx-maps_utils.php @@ -127,6 +127,8 @@ $points->speed = array(); $points->hr = array(); $points->cad = array(); + $points->maxTime = 0; + $points->minTime = 0; $points->maxEle = 0; $points->minEle = 0; $points->totalEleUp = 0; @@ -302,12 +304,26 @@ unset($nodes); try { + + array_pop($points->dt, null); + array_pop($points->lat, null); + array_pop($points->lon, null); + array_pop($points->ele, null); + array_pop($points->dist, null); + array_pop($points->speed, null); + array_pop($points->hr, null); + array_pop($points->cad, null); + + $_time = array_filter($points->dt); $_ele = array_filter($points->ele); $_dist = array_filter($points->dist); $_speed = array_filter($points->speed); $points->maxEle = max($_ele); $points->minEle = min($_ele); $points->totalLength = max($_dist); + $points->maxTime = max($_time); + $points->minTime = min($_time); + $points->avgSpeed = array_sum($_speed) / count($_speed); } catch (Exception $e) { }