This commit is contained in:
bastianonm 2012-07-31 14:34:27 +00:00
parent f557801d12
commit 0c8922918d
6 changed files with 297 additions and 64 deletions

Binary file not shown.

View File

@ -0,0 +1,79 @@
msgid ""
msgstr ""
"Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-25 11:54+0100\n"
"PO-Revision-Date: 2012-06-25 11:55+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:420
msgid "Altitude"
msgstr "Höhe"
#: ../wp-gpx-maps.php:421
msgid "Current Position"
msgstr "Aktuelle Position"
#: ../wp-gpx-maps.php:422
msgid "Speed"
msgstr "Geschwindigkeit"
#: ../wp-gpx-maps.php:423
msgid "Heart rate"
msgstr "Herzfrequenz"
#: ../wp-gpx-maps.php:424
msgid "Cadence"
msgstr "Trittfrequenz"
#: ../wp-gpx-maps.php:425
msgid "Go Full Screen"
msgstr "Vollbildansicht"
#: ../wp-gpx-maps.php:426
msgid "Exit Full Screen"
msgstr "Vollbildansicht beenden"
#: ../wp-gpx-maps.php:439
msgid "Total distance"
msgstr "Distanz"
#: ../wp-gpx-maps.php:443
msgid "Max elevation"
msgstr "Maximale Höhe"
#: ../wp-gpx-maps.php:444
msgid "Min elevation"
msgstr "Minimale Höhe"
#: ../wp-gpx-maps.php:445
msgid "Total climbing"
msgstr "Gesamtanstieg"
#: ../wp-gpx-maps.php:446
msgid "Total descent"
msgstr "Gesamtabstieg"
#: ../wp-gpx-maps.php:450
msgid "Average speed"
msgstr "Durchschnittsgeschwindigkeit"
#: ../wp-gpx-maps.php:466
msgid "Download"
msgstr "Download"
#: ../wp-gpx-maps_admin_settings.php:75
#: ../wp-gpx-maps_admin_settings.php:151
#: ../wp-gpx-maps_admin_settings.php:255
#: ../wp-gpx-maps_admin_settings.php:286
msgid "Save Changes"
msgstr "Änderungen speichern"

View File

@ -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 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 Requires at least: 2.0.0
Tested up to: 3.4 Tested up to: 3.4
Stable tag: 1.1.31 Stable tag: 1.1.32
License: GPLv2 or later License: GPLv2 or later
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -24,14 +24,22 @@ NextGen Gallery Integration:
Display your NextGen Gallery images inside the map! Display your NextGen Gallery images inside the map!
Even if you don't have a gps camera, this plugin can retrive the image position starting from the image date and you gpx file. Even if you don't have a gps camera, this plugin can retrive the image position starting from the image date and you gpx file.
Old NGGallery Images (without gps data) and gpx: <a href="http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/">http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/</a>
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 - iphone/ipad/ipod Compatible
Try this plugin: <a href="http://www.pedemontanadelgrappa.it/category/mappe/">http://www.pedemontanadelgrappa.it/category/mappe/</a> Try this plugin: <a href="http://www.pedemontanadelgrappa.it/category/mappe/">http://www.pedemontanadelgrappa.it/category/mappe/</a>
Thanks to: <a href="http://www.securcube.net/">www.securcube.net</a>, <a href="http://www.darwinner.it/">www.darwinner.it</a>, <a href="http://www.pedemontanadelgrappa.it/">www.pedemontanadelgrappa.it</a>,
<a href="http://www.darwinner.it/featured/wp-gpx-maps/">Plugin page</a>
<a href="http://www.darwinner.it/forums/forum/wp-gpx-maps/">Support Forum</a> <a href="http://www.darwinner.it/forums/forum/wp-gpx-maps/">Support Forum</a>
Supported gpx namespaces are: Supported gpx namespaces are:
@ -44,6 +52,8 @@ Supported gpx namespaces are:
1. http://www.garmin.com/xmlschemas/TrackPointExtension/v1 1. http://www.garmin.com/xmlschemas/TrackPointExtension/v1
Thanks to: <a href="http://www.securcube.net/">www.securcube.net</a>, <a href="http://www.darwinner.it/">www.darwinner.it</a>, <a href="http://www.pedemontanadelgrappa.it/">www.pedemontanadelgrappa.it</a>,
== Installation == == Installation ==
1. Use the classic wordpress plugin installer or copy the plugins folder to the `/wp-content/plugins/` directory 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. 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. 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? = = What happening if I've a very large gpx? =
This plugin will print a small amout of points to speedup javascript and pageload. This plugin will print a small amout of points to speedup javascript and pageload.
@ -138,6 +163,10 @@ Yes!
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Hearth rate
== Changelog == == 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 = = 1.1.31 =
* Fixed fullscreen map image slideshow * Fixed fullscreen map image slideshow
= 1.1.30 = = 1.1.30 =

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.darwinner.it/ Plugin URI: http://www.darwinner.it/
Description: Draws a gpx track with altitude graph Description: Draws a gpx track with altitude graph
Version: 1.1.31 Version: 1.1.32
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/ Author URI: http://www.pedemontanadelgrappa.it/
License: GPL License: GPL
@ -133,14 +133,23 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", ""); $ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", "");
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", ""); $ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
$download = findValue($attr, "download", "wpgpxmaps_download", ""); $download = findValue($attr, "download", "wpgpxmaps_download", "");
$summary = findValue($attr, "summary", "wpgpxmaps_summary", "");
$dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0); $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); $r = rand(1,5000000);
$gpxurl = $gpx; $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); $cacheFileName = md5($cacheFileName);
@ -153,8 +162,9 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
// Try to load cache // Try to load cache
if (file_exists($gpxcache)) if (file_exists($gpxcache) && !($skipcache == true))
{ {
try { try {
$cache_str = file_get_contents($gpxcache); $cache_str = file_get_contents($gpxcache);
$cache_obj = unserialize($cache_str); $cache_obj = unserialize($cache_str);
@ -170,6 +180,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$waypoints = $cache_obj["waypoints"]; $waypoints = $cache_obj["waypoints"];
$max_ele = $cache_obj["max_ele"]; $max_ele = $cache_obj["max_ele"];
$min_ele = $cache_obj["min_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_up = $cache_obj["total_ele_up"];
$total_ele_down = $cache_obj["total_ele_down"]; $total_ele_down = $cache_obj["total_ele_down"];
$avg_speed = $cache_obj["avg_speed"]; $avg_speed = $cache_obj["avg_speed"];
@ -188,6 +200,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$waypoints= ''; $waypoints= '';
$max_ele = 0; $max_ele = 0;
$min_ele = 0; $min_ele = 0;
$max_time = 0;
$min_time = 0;
$total_ele_up = 0; $total_ele_up = 0;
$total_ele_down = 0; $total_ele_down = 0;
$avg_speed = 0; $avg_speed = 0;
@ -235,6 +249,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$max_ele = $points->maxEle; $max_ele = $points->maxEle;
$min_ele = $points->minEle; $min_ele = $points->minEle;
$max_time = $points->maxTime;
$min_time = $points->minTime;
$total_ele_up = $points->totalEleUp; $total_ele_up = $points->totalEleUp;
$total_ele_down = $points->totalEleDown; $total_ele_down = $points->totalEleDown;
$avg_speed = $points->avgSpeed; $avg_speed = $points->avgSpeed;
@ -383,28 +399,32 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
} }
} }
@file_put_contents($gpxcache, if (!($skipcache == true))
serialize(array( "points_maps" => $points_maps, {
"points_x_time" => $points_x_time, @file_put_contents($gpxcache,
"points_x_lat" => $points_x_lat, serialize(array( "points_maps" => $points_maps,
"points_x_lon" => $points_x_lon, "points_x_time" => $points_x_time,
"points_graph_dist" => $points_graph_dist, "points_x_lat" => $points_x_lat,
"points_graph_ele" => $points_graph_ele, "points_x_lon" => $points_x_lon,
"points_graph_speed" => $points_graph_speed, "points_graph_dist" => $points_graph_dist,
"points_graph_hr" => $points_graph_hr, "points_graph_ele" => $points_graph_ele,
"points_graph_cad" => $points_graph_cad, "points_graph_speed" => $points_graph_speed,
"waypoints" => $waypoints, "points_graph_hr" => $points_graph_hr,
"max_ele" => $max_ele, "points_graph_cad" => $points_graph_cad,
"min_ele" => $min_ele, "waypoints" => $waypoints,
"total_ele_up" => $total_ele_up, "max_ele" => $max_ele,
"total_ele_down" => $total_ele_down, "min_ele" => $min_ele,
"avg_speed" => $avg_speed, "total_ele_up" => $total_ele_up,
"tot_len" => $tot_len "total_ele_down" => $total_ele_down,
) "avg_speed" => $avg_speed,
), "tot_len" => $tot_len,
LOCK_EX); "max_time" => $max_time,
"min_time" => $min_time
@chmod($gpxcache,0755); )
),
LOCK_EX);
@chmod($gpxcache,0755);
}
if ($gh == "0" || $gh == "0px") if ($gh == "0" || $gh == "0px")
{ {
@ -462,42 +482,51 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
}); });
</script>'; </script>';
// print summary // print summary
if ($summary=='true' && ( $points_graph_speed != '' || $points_graph_ele != '' || $points_graph_dist != '') ) if ($summary=='true' && ( $points_graph_speed != '' || $points_graph_ele != '' || $points_graph_dist != '') )
{
$output .= "<div id='wpgpxmaps_summary_".$r."' class='wpgpxmaps_summary'>";
if ($points_graph_dist != '' && $p_tot_len == 'true')
{ {
$output .= "<span class='summarylabel'>".__("Total distance", "wp-gpx-maps").":</span><span class='summaryvalue'> $tot_len</span><br />";
$output .= "<div id='wpgpxmaps_summary_".$r."' class='wpgpxmaps_summary'>"; }
if ($points_graph_dist != '') if ($points_graph_ele != '')
{ {
$output .= "<span class='summarylabel'>".__("Total distance", "wp-gpx-maps").":</span><span class='summaryvalue'> $tot_len</span><br />"; if ($p_max_ele == 'true')
}
if ($points_graph_ele != '')
{
$output .= "<span class='summarylabel'>".__("Max elevation", "wp-gpx-maps").":</span><span class='summaryvalue'> $max_ele</span><br />"; $output .= "<span class='summarylabel'>".__("Max elevation", "wp-gpx-maps").":</span><span class='summaryvalue'> $max_ele</span><br />";
if ($p_min_ele == 'true')
$output .= "<span class='summarylabel'>".__("Min elevation", "wp-gpx-maps").":</span><span class='summaryvalue'> $min_ele</span><br />"; $output .= "<span class='summarylabel'>".__("Min elevation", "wp-gpx-maps").":</span><span class='summaryvalue'> $min_ele</span><br />";
if ($p_total_ele_up == 'true')
$output .= "<span class='summarylabel'>".__("Total climbing", "wp-gpx-maps").":</span><span class='summaryvalue'> $total_ele_up</span><br />"; $output .= "<span class='summarylabel'>".__("Total climbing", "wp-gpx-maps").":</span><span class='summaryvalue'> $total_ele_up</span><br />";
if ($p_total_ele_down == 'true')
$output .= "<span class='summarylabel'>".__("Total descent", "wp-gpx-maps").":</span><span class='summaryvalue'> $total_ele_down</span><br />"; $output .= "<span class='summarylabel'>".__("Total descent", "wp-gpx-maps").":</span><span class='summaryvalue'> $total_ele_down</span><br />";
}
if ($points_graph_speed != '')
{
$output .= "<span class='summarylabel'>".__("Average speed", "wp-gpx-maps").":</span><span class='summaryvalue'> $avg_speed</span><br />";
}
$output .= "</div>";
} }
if ($points_graph_speed != '' && $p_avg_speed == 'true')
// print download link
if ($download=='true' && $gpxurl != '')
{ {
if ($isGpxUrl == true) $output .= "<span class='summarylabel'>".__("Average speed", "wp-gpx-maps").":</span><span class='summaryvalue'> $avg_speed</span><br />";
{
}
else
{
$gpxurl = get_bloginfo('url').$gpxurl;
}
$output.="<a href='$gpxurl' target='_new'>".__("Download", "wp-gpx-maps")."</a>";
} }
if ($p_total_time == 'true' && $max_time > 0)
{
$time_diff = date("H:i:s", ($max_time - $min_time));
$output .= "<span class='summarylabel'>".__("Total Time", "wp-gpx-maps").":</span><span class='summaryvalue'> $time_diff</span><br />";
}
$output .= "</div>";
}
// print download link
if ($download=='true' && $gpxurl != '')
{
if ($isGpxUrl == true)
{
}
else
{
$gpxurl = get_bloginfo('url').$gpxurl;
}
$output.="<a href='$gpxurl' target='_new'>".__("Download", "wp-gpx-maps")."</a>";
}
return $output; return $output;
} }
@ -602,6 +631,7 @@ function WP_GPX_Maps_install() {
add_option('wpgpxmaps_zoomonscrollwheel','','','yes'); add_option('wpgpxmaps_zoomonscrollwheel','','','yes');
add_option('wpgpxmaps_download','','','yes'); add_option('wpgpxmaps_download','','','yes');
add_option('wpgpxmaps_summary','','','yes'); add_option('wpgpxmaps_summary','','','yes');
add_option('wpgpxmaps_skipcache','','','yes');
} }
function WP_GPX_Maps_remove() { function WP_GPX_Maps_remove() {
@ -634,6 +664,7 @@ function WP_GPX_Maps_remove() {
delete_option('wpgpxmaps_zoomonscrollwheel'); delete_option('wpgpxmaps_zoomonscrollwheel');
delete_option('wpgpxmaps_download'); delete_option('wpgpxmaps_download');
delete_option('wpgpxmaps_summary'); delete_option('wpgpxmaps_summary');
delete_option('wpgpxmaps_skipcache');
} }
?> ?>

View File

@ -20,7 +20,16 @@
$showCad = get_option('wpgpxmaps_show_cadence'); $showCad = get_option('wpgpxmaps_show_cadence');
$zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel"); $zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel");
$download = get_option("wpgpxmaps_download"); $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)) if (!($t))
$t = 'HYBRID'; $t = 'HYBRID';
@ -54,29 +63,98 @@
<input name="wpgpxmaps_graph_height" type="text" id="wpgpxmaps_graph_height" value="<?php echo get_option('wpgpxmaps_graph_height'); ?>" style="width:50px;" /> <input name="wpgpxmaps_graph_height" type="text" id="wpgpxmaps_graph_height" value="<?php echo get_option('wpgpxmaps_graph_height'); ?>" style="width:50px;" />
</td> </td>
</tr> </tr>
<tr>
<th scope="row">Cache:</th>
<td>
<input name="wpgpxmaps_skipcache" type="checkbox" value="true" <?php if($skipcache == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Do not use cache</i>
</td>
</tr>
<tr> <tr>
<th scope="row">GPX Download:</th> <th scope="row">GPX Download:</th>
<td> <td>
<input name="wpgpxmaps_download" type="checkbox" value="true" <?php if($download == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Allow users to download your GPX file</i> <input name="wpgpxmaps_download" type="checkbox" value="true" <?php if($download == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Allow users to download your GPX file</i>
</td> </td>
</tr> </tr>
</table>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_skipcache" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p>
</form>
<hr />
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<h3 class="title">Summary table</h3>
<table class="form-table">
<tr> <tr>
<th scope="row">Summary table:</th> <th scope="row">Summary table:</th>
<td> <td>
<input name="wpgpxmaps_summary" type="checkbox" value="true" <?php if($summary == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print summary table</i> <input name="wpgpxmaps_summary" type="checkbox" value="true" <?php if($summary == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print summary table</i>
</td> </td>
</tr> </tr>
<tr>
<th scope="row">Total distance:</th>
<td>
<input name="wpgpxmaps_summary_tot_len" type="checkbox" value="true" <?php if($tot_len == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total distance</i>
</td>
</tr>
<tr>
<th scope="row">Max Elevation:</th>
<td>
<input name="wpgpxmaps_summary_max_ele" type="checkbox" value="true" <?php if($max_ele == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Max Elevation</i>
</td>
</tr>
<tr>
<th scope="row">Min Elevation:</th>
<td>
<input name="wpgpxmaps_summary_min_ele" type="checkbox" value="true" <?php if($min_ele == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Min Elevation</i>
</td>
</tr>
<tr>
<th scope="row">Min Elevation:</th>
<td>
<input name="wpgpxmaps_summary_total_ele_up" type="checkbox" value="true" <?php if($total_ele_up == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total climbing</i>
</td>
</tr>
<tr>
<th scope="row">Min Elevation:</th>
<td>
<input name="wpgpxmaps_summary_total_ele_down" type="checkbox" value="true" <?php if($total_ele_down == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total descent</i>
</td>
</tr>
<tr>
<th scope="row">Min Elevation:</th>
<td>
<input name="wpgpxmaps_summary_avg_speed" type="checkbox" value="true" <?php if($avg_speed == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Average Speed</i>
</td>
</tr>
<tr>
<th scope="row">Total time:</th>
<td>
<input name="wpgpxmaps_summary_total_time" type="checkbox" value="true" <?php if($total_time == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total time</i>
</td>
</tr>
</table> </table>
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_summary" /> <input name="page_options" type="hidden" value="wpgpxmaps_summary,wpgpxmaps_summary_tot_len,wpgpxmaps_summary_max_ele,wpgpxmaps_summary_min_ele,wpgpxmaps_summary_total_ele_up,wpgpxmaps_summary_total_ele_down,wpgpxmaps_summary_avg_speed,wpgpxmaps_summary_total_time" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" /> <input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p> </p>
</form> </form>
<hr /> <hr />
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?> <?php wp_nonce_field('update-options') ?>

View File

@ -127,6 +127,8 @@
$points->speed = array(); $points->speed = array();
$points->hr = array(); $points->hr = array();
$points->cad = array(); $points->cad = array();
$points->maxTime = 0;
$points->minTime = 0;
$points->maxEle = 0; $points->maxEle = 0;
$points->minEle = 0; $points->minEle = 0;
$points->totalEleUp = 0; $points->totalEleUp = 0;
@ -302,12 +304,26 @@
unset($nodes); unset($nodes);
try { 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); $_ele = array_filter($points->ele);
$_dist = array_filter($points->dist); $_dist = array_filter($points->dist);
$_speed = array_filter($points->speed); $_speed = array_filter($points->speed);
$points->maxEle = max($_ele); $points->maxEle = max($_ele);
$points->minEle = min($_ele); $points->minEle = min($_ele);
$points->totalLength = max($_dist); $points->totalLength = max($_dist);
$points->maxTime = max($_time);
$points->minTime = min($_time);
$points->avgSpeed = array_sum($_speed) / count($_speed); $points->avgSpeed = array_sum($_speed) / count($_speed);
} catch (Exception $e) { } } catch (Exception $e) { }