parent
15ad51122d
commit
27964e6587
|
@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
||||||
Tags: maps, gpx, gps, graph, chart, leaflet, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
|
Tags: maps, gpx, gps, graph, chart, leaflet, 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: 4.9.8
|
Tested up to: 4.9.8
|
||||||
Stable tag: 1.6.04
|
Stable tag: 1.6.05
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
@ -153,6 +153,9 @@ Yes!
|
||||||
1. Altitude & Speed & Hearth rate
|
1. Altitude & Speed & Hearth rate
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 1.6.05 =
|
||||||
|
* Added avg cadence (thanks to cyclinggeorgian)
|
||||||
|
* fix cadence in old gpx devices
|
||||||
= 1.6.04 =
|
= 1.6.04 =
|
||||||
* NGG gallery is working
|
* NGG gallery is working
|
||||||
* Getting HR, Cad and Temp working again (thanks to cyclinggeorgian)
|
* Getting HR, Cad and Temp working again (thanks to cyclinggeorgian)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Plugin Name: WP-GPX-Maps
|
* Plugin Name: WP-GPX-Maps
|
||||||
* Plugin URI: http://www.devfarm.it/
|
* Plugin URI: http://www.devfarm.it/
|
||||||
* Description: Draws a GPX track with altitude chart
|
* Description: Draws a GPX track with altitude chart
|
||||||
* Version: 1.6.04
|
* Version: 1.6.05
|
||||||
* Author: Bastianon Massimo
|
* Author: Bastianon Massimo
|
||||||
* Author URI: http://www.devfarm.it/
|
* Author URI: http://www.devfarm.it/
|
||||||
* Text Domain: wp-gpx-maps
|
* Text Domain: wp-gpx-maps
|
||||||
|
@ -280,6 +280,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
$p_total_ele_up = wpgpxmaps_findValue($attr, "summaryeleup", "wpgpxmaps_summary_total_ele_up", false);
|
$p_total_ele_up = wpgpxmaps_findValue($attr, "summaryeleup", "wpgpxmaps_summary_total_ele_up", false);
|
||||||
$p_total_ele_down = wpgpxmaps_findValue($attr, "summaryeledown", "wpgpxmaps_summary_total_ele_down", false);
|
$p_total_ele_down = wpgpxmaps_findValue($attr, "summaryeledown", "wpgpxmaps_summary_total_ele_down", false);
|
||||||
$p_avg_speed = wpgpxmaps_findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false);
|
$p_avg_speed = wpgpxmaps_findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false);
|
||||||
|
$p_avg_cad = wpgpxmaps_findValue($attr, "summaryavgcad", "wpgpxmaps_summary_avg_cad", false);
|
||||||
$p_total_time = wpgpxmaps_findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false);
|
$p_total_time = wpgpxmaps_findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false);
|
||||||
|
|
||||||
$usegpsposition = wpgpxmaps_findValue($attr, "usegpsposition", "wpgpxmaps_usegpsposition", false);
|
$usegpsposition = wpgpxmaps_findValue($attr, "usegpsposition", "wpgpxmaps_usegpsposition", false);
|
||||||
|
@ -296,7 +297,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
} else {
|
} else {
|
||||||
$mtime = 0;
|
$mtime = 0;
|
||||||
}
|
}
|
||||||
$cacheFileName = "$gpx,$mtime,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.9";
|
$cacheFileName = "$gpx,$mtime,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$avg_cad,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.9";
|
||||||
|
|
||||||
$cacheFileName = md5($cacheFileName);
|
$cacheFileName = md5($cacheFileName);
|
||||||
|
|
||||||
|
@ -332,6 +333,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
$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"];
|
||||||
|
$avg_cad = $cache_obj["avg_cad"];
|
||||||
$tot_len = $cache_obj["tot_len"];
|
$tot_len = $cache_obj["tot_len"];
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -354,6 +356,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
$total_ele_up = 0;
|
$total_ele_up = 0;
|
||||||
$total_ele_down = 0;
|
$total_ele_down = 0;
|
||||||
$avg_speed = 0;
|
$avg_speed = 0;
|
||||||
|
$avg_cad = 0;
|
||||||
$tot_len = 0;
|
$tot_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,6 +405,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
$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;
|
||||||
|
$avg_cad = $points->avgCad;
|
||||||
$tot_len = $points->totalLength;
|
$tot_len = $points->totalLength;
|
||||||
|
|
||||||
if (is_array ($points_x_lat))
|
if (is_array ($points_x_lat))
|
||||||
|
@ -637,6 +641,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
"total_ele_up" => $total_ele_up,
|
"total_ele_up" => $total_ele_up,
|
||||||
"total_ele_down" => $total_ele_down,
|
"total_ele_down" => $total_ele_down,
|
||||||
"avg_speed" => $avg_speed,
|
"avg_speed" => $avg_speed,
|
||||||
|
"avg_cad" => $avg_cad,
|
||||||
"tot_len" => $tot_len,
|
"tot_len" => $tot_len,
|
||||||
"max_time" => $max_time,
|
"max_time" => $max_time,
|
||||||
"min_time" => $min_time
|
"min_time" => $min_time
|
||||||
|
@ -744,6 +749,10 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
{
|
{
|
||||||
$output .= "<span class='avgspeed'><span class='summarylabel'>".__("Average speed", "wp-gpx-maps").":</span><span class='summaryvalue'> $avg_speed</span></span><br />";
|
$output .= "<span class='avgspeed'><span class='summarylabel'>".__("Average speed", "wp-gpx-maps").":</span><span class='summaryvalue'> $avg_speed</span></span><br />";
|
||||||
}
|
}
|
||||||
|
if ($points_graph_cad != '' && $p_avg_cad == 'true')
|
||||||
|
{
|
||||||
|
$output .= "<span class='avgcad'><span class='summarylabel'>".__("Average cadence", "wp-gpx-maps").":</span><span class='summaryvalue'> $avg_cad</span></span><br />";
|
||||||
|
}
|
||||||
if ($p_total_time == 'true' && $max_time > 0)
|
if ($p_total_time == 'true' && $max_time > 0)
|
||||||
{
|
{
|
||||||
$time_diff = date("H:i:s", ($max_time - $min_time));
|
$time_diff = date("H:i:s", ($max_time - $min_time));
|
||||||
|
|
|
@ -141,7 +141,7 @@ function WP_GPX_Maps_html_page() {
|
||||||
</li><li><b>summaryminele</b>: Print Min Elevation in summary table (default is FALSE)
|
</li><li><b>summaryminele</b>: Print Min Elevation in summary table (default is FALSE)
|
||||||
</li><li><b>summaryeleup</b>: Print Total climbing in summary table (default is FALSE)
|
</li><li><b>summaryeleup</b>: Print Total climbing in summary table (default is FALSE)
|
||||||
</li><li><b>summaryeledown</b>: Print Total descent in summary table (default is FALSE)
|
</li><li><b>summaryeledown</b>: Print Total descent in summary table (default is FALSE)
|
||||||
</li><li><b>summaryavgspeed</b>: Print Average Speed in summary table (default is FALSE)
|
</li><li><b>summaryavgspeed</b>: Print Average Speed in summary table (default is FALSE)</li><li><b>summaryavgcad</b>: Print Average Cadence in summary table (default is FALSE)
|
||||||
</li><li><b>summarytotaltime</b>: Print Total time in summary table (default is FALSE) </li>
|
</li><li><b>summarytotaltime</b>: Print Total time in summary table (default is FALSE) </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
$max_ele = get_option("wpgpxmaps_summary_max_ele");
|
$max_ele = get_option("wpgpxmaps_summary_max_ele");
|
||||||
$total_ele_up = get_option("wpgpxmaps_summary_total_ele_up");
|
$total_ele_up = get_option("wpgpxmaps_summary_total_ele_up");
|
||||||
$total_ele_down = get_option("wpgpxmaps_summary_total_ele_down");
|
$total_ele_down = get_option("wpgpxmaps_summary_total_ele_down");
|
||||||
$avg_speed = get_option("wpgpxmaps_summary_avg_speed");
|
$avg_speed = get_option("wpgpxmaps_summary_avg_speed"); $avg_cad = get_option("wpgpxmaps_summary_avg_cad");
|
||||||
$total_time = get_option("wpgpxmaps_summary_total_time");
|
$total_time = get_option("wpgpxmaps_summary_total_time");
|
||||||
|
|
||||||
$usegpsposition = get_option("wpgpxmaps_usegpsposition");
|
$usegpsposition = get_option("wpgpxmaps_usegpsposition");
|
||||||
|
@ -152,23 +152,23 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Min Elevation:</th>
|
<th scope="row">Total climbing:</th>
|
||||||
<td>
|
<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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Min Elevation:</th>
|
<th scope="row">Total descent:</th>
|
||||||
<td>
|
<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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Min Elevation:</th>
|
<th scope="row">Average Speed:</th>
|
||||||
<td>
|
<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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr> <tr> <th scope="row">Average Cadence:</th> <td> <input name="wpgpxmaps_summary_avg_cad" type="checkbox" value="true" <?php if($avg_cad == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Average Cadence</i> </td> </tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Total time:</th>
|
<th scope="row">Total time:</th>
|
||||||
<td>
|
<td>
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
|
|
||||||
<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_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 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_avg_cad,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>
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
$points->totalEleUp = 0;
|
$points->totalEleUp = 0;
|
||||||
$points->totalEleDown = 0;
|
$points->totalEleDown = 0;
|
||||||
$points->avgSpeed = 0;
|
$points->avgSpeed = 0;
|
||||||
|
$points->avgCad = 0;
|
||||||
$points->totalLength = 0;
|
$points->totalLength = 0;
|
||||||
|
|
||||||
$gpx = simplexml_load_file($filePath);
|
$gpx = simplexml_load_file($filePath);
|
||||||
|
@ -235,7 +236,6 @@
|
||||||
|
|
||||||
$trk->registerXPathNamespace('a', 'http://www.topografix.com/GPX/1/0');
|
$trk->registerXPathNamespace('a', 'http://www.topografix.com/GPX/1/0');
|
||||||
$trk->registerXPathNamespace('b', 'http://www.topografix.com/GPX/1/1');
|
$trk->registerXPathNamespace('b', 'http://www.topografix.com/GPX/1/1');
|
||||||
$trk->registerXPathNamespace('ns3', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1');
|
|
||||||
|
|
||||||
$trkpts = $trk->xpath('//trkpt | //a:trkpt | //b:trkpt');
|
$trkpts = $trk->xpath('//trkpt | //a:trkpt | //b:trkpt');
|
||||||
|
|
||||||
|
@ -272,6 +272,13 @@
|
||||||
$atemp = @$tpe["ns3:atemp"];
|
$atemp = @$tpe["ns3:atemp"];
|
||||||
$cad = @$tpe["ns3:cad"];
|
$cad = @$tpe["ns3:cad"];
|
||||||
}
|
}
|
||||||
|
else if (isset($arr['gpxtpx:TrackPointExtension']))
|
||||||
|
{
|
||||||
|
$tpe = $arr['gpxtpx:TrackPointExtension'];
|
||||||
|
$hr = @$tpe["gpxtpx:hr"];
|
||||||
|
$atemp = @$tpe["gpxtpx:atemp"];
|
||||||
|
$cad = @$tpe["gpxtpx:cad"];
|
||||||
|
}
|
||||||
else if (isset($arr['TrackPointExtension']))
|
else if (isset($arr['TrackPointExtension']))
|
||||||
{
|
{
|
||||||
$tpe = $arr['TrackPointExtension'];
|
$tpe = $arr['TrackPointExtension'];
|
||||||
|
@ -362,8 +369,6 @@
|
||||||
array_push($points->speed, (float)round($avgSpeed, 1) );
|
array_push($points->speed, (float)round($avgSpeed, 1) );
|
||||||
array_push($points->hr, $hr);
|
array_push($points->hr, $hr);
|
||||||
array_push($points->atemp, $atemp);
|
array_push($points->atemp, $atemp);
|
||||||
|
|
||||||
|
|
||||||
array_push($points->cad, $cad);
|
array_push($points->cad, $cad);
|
||||||
array_push($points->grade, (float)round($grade, 2) );
|
array_push($points->grade, (float)round($grade, 2) );
|
||||||
|
|
||||||
|
@ -415,13 +420,18 @@
|
||||||
$_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);
|
||||||
|
$_cad = array_filter($points->cad);
|
||||||
|
|
||||||
$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->maxTime = max($_time);
|
||||||
$points->minTime = min($_time);
|
$points->minTime = min($_time);
|
||||||
|
|
||||||
|
$points->avgCad = (float)round(array_sum($_cad) / count($_cad), 0);
|
||||||
$points->avgSpeed = array_sum($_speed) / count($_speed);
|
$points->avgSpeed = array_sum($_speed) / count($_speed);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception $e) { }
|
} catch (Exception $e) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue