This commit is contained in:
parent
1d58f76ab6
commit
135b7d254c
10
readme.txt
10
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
|
Tags: maps, gpx, gps, graph, google maps, google chart, track, garmin
|
||||||
Requires at least: 2.0.0
|
Requires at least: 2.0.0
|
||||||
Tested up to: 3.3
|
Tested up to: 3.3
|
||||||
Stable tag: 1.0.9
|
Stable tag: 1.1.0
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
|
|
||||||
Draws a gpx track with altitude graph
|
Draws a gpx track with altitude graph
|
||||||
|
@ -54,6 +54,10 @@ The attributes are:
|
||||||
|
|
||||||
1. waypoints: print the gpx waypoints inside the map (default is FALSE)
|
1. waypoints: print the gpx waypoints inside the map (default is FALSE)
|
||||||
|
|
||||||
|
1. donotreducegpx: Print all the point without reduce it (default is FALSE)
|
||||||
|
|
||||||
|
1. pointsoffset: Skip points closer than XX meters(default is 10)
|
||||||
|
|
||||||
shortcode with all the attributes : [sgpx gpx=">relative path to your gpx<" width=100% mheight=300px gheight=200px mtype=SATELLITE waypoints=true]
|
shortcode with all the attributes : [sgpx gpx=">relative path to your gpx<" width=100% mheight=300px gheight=200px mtype=SATELLITE waypoints=true]
|
||||||
|
|
||||||
= What happening if I've a very large gpx? =
|
= What happening if I've a very large gpx? =
|
||||||
|
@ -68,6 +72,9 @@ Yes!
|
||||||
2. Admin area
|
2. Admin area
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 1.1.0 =
|
||||||
|
* Added Advanced Setting in the Admin Area
|
||||||
|
* Added the shortcode for every entry in the admin area (easy to copy and paste in your posts)
|
||||||
= 1.0.9 =
|
= 1.0.9 =
|
||||||
* minor bug fixes
|
* minor bug fixes
|
||||||
* Windows/IIS compatibility
|
* Windows/IIS compatibility
|
||||||
|
@ -95,6 +102,7 @@ Yes!
|
||||||
* Initial release.
|
* Initial release.
|
||||||
|
|
||||||
== Upgrade Notice ==
|
== Upgrade Notice ==
|
||||||
|
= 1.1.0 =
|
||||||
= 1.0.9 =
|
= 1.0.9 =
|
||||||
= 1.0.8 =
|
= 1.0.8 =
|
||||||
= 1.0.7 =
|
= 1.0.7 =
|
||||||
|
|
|
@ -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.0.9
|
Version: 1.1.0
|
||||||
Author: Bastianon Massimo
|
Author: Bastianon Massimo
|
||||||
Author URI: http://www.pedemontanadelgrappa.it/
|
Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
License: GPL
|
License: GPL
|
||||||
|
@ -58,6 +58,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
$mt = $attr["mtype"];
|
$mt = $attr["mtype"];
|
||||||
$gh = $attr["gheight"];
|
$gh = $attr["gheight"];
|
||||||
$showW = $attr['waypoints'];
|
$showW = $attr['waypoints'];
|
||||||
|
$donotreducegpx = $attr['donotreducegpx'];
|
||||||
|
$pointsoffset = $attr['pointsoffset'];
|
||||||
|
|
||||||
if ($w == '')
|
if ($w == '')
|
||||||
{
|
{
|
||||||
|
@ -73,15 +75,29 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
{
|
{
|
||||||
$gh = get_option("wpgpxmaps_graph_height");
|
$gh = get_option("wpgpxmaps_graph_height");
|
||||||
}
|
}
|
||||||
|
if ($gh == '')
|
||||||
|
{
|
||||||
|
$gh = "200px";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pointsoffset == '')
|
||||||
|
{
|
||||||
|
$pointsoffset = get_option("wpgpxmaps_pointsoffset");
|
||||||
|
}
|
||||||
|
if ($pointsoffset == '')
|
||||||
|
{
|
||||||
|
$pointsoffset = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($mt == '')
|
if ($mt == '')
|
||||||
{
|
{
|
||||||
$mt = get_option("wpgpxmaps_map_type");
|
$mt = get_option("wpgpxmaps_map_type");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gh == '')
|
if ($donotreducegpx == '')
|
||||||
{
|
{
|
||||||
$gh = "200px";
|
$donotreducegpx = get_option("wpgpxmaps_donotreducegpx");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($showW == '')
|
if ($showW == '')
|
||||||
|
@ -99,7 +115,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
|
|
||||||
$gpx = $sitePath . $gpx;
|
$gpx = $sitePath . $gpx;
|
||||||
|
|
||||||
$points = getPoints( $gpx );
|
$points = getPoints( $gpx, $pointsoffset, $donotreducegpx);
|
||||||
$points_maps = '';
|
$points_maps = '';
|
||||||
$points_graph = '';
|
$points_graph = '';
|
||||||
$waypoints = '';
|
$waypoints = '';
|
||||||
|
@ -155,6 +171,8 @@ function WP_GPX_Maps_install() {
|
||||||
add_option("wpgpxmaps_height", '450px', '', 'yes');
|
add_option("wpgpxmaps_height", '450px', '', 'yes');
|
||||||
add_option('wpgpxmaps_map_type','HYBRID','','yes');
|
add_option('wpgpxmaps_map_type','HYBRID','','yes');
|
||||||
add_option('wpgpxmaps_show_waypoint','','','yes');
|
add_option('wpgpxmaps_show_waypoint','','','yes');
|
||||||
|
add_option('wpgpxmaps_pointsoffset','10','','yes');
|
||||||
|
add_option('wpgpxmaps_donotreducegpx','true','','yes');
|
||||||
}
|
}
|
||||||
|
|
||||||
function WP_GPX_Maps_remove() {
|
function WP_GPX_Maps_remove() {
|
||||||
|
@ -163,6 +181,8 @@ function WP_GPX_Maps_remove() {
|
||||||
delete_option('wpgpxmaps_height');
|
delete_option('wpgpxmaps_height');
|
||||||
delete_option('wpgpxmaps_map_type');
|
delete_option('wpgpxmaps_map_type');
|
||||||
delete_option('wpgpxmaps_show_waypoint');
|
delete_option('wpgpxmaps_show_waypoint');
|
||||||
|
delete_option('wpgpxmaps_pointsoffset');
|
||||||
|
delete_option('wpgpxmaps_donotreducegpx');
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
function getPoints($gpxPath,$gpxOffset = 10)
|
function getPoints($gpxPath,$gpxOffset = 10, $donotreducegpx)
|
||||||
{
|
{
|
||||||
|
|
||||||
$points = array();
|
$points = array();
|
||||||
$dist=0;
|
$dist=0;
|
||||||
|
|
||||||
|
@ -9,12 +10,6 @@
|
||||||
$lastEle=0;
|
$lastEle=0;
|
||||||
$lastOffset=0;
|
$lastOffset=0;
|
||||||
|
|
||||||
//Default Offset = 10 mt
|
|
||||||
if (!($gpxOffset > 0))
|
|
||||||
{
|
|
||||||
$gpxOffset = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($gpxPath))
|
if (file_exists($gpxPath))
|
||||||
{
|
{
|
||||||
$points = parseXml($gpxPath, $gpxOffset);
|
$points = parseXml($gpxPath, $gpxOffset);
|
||||||
|
@ -24,16 +19,24 @@
|
||||||
array_push($points, array((float)0,(float)0,(float)0,(float)0));
|
array_push($points, array((float)0,(float)0,(float)0,(float)0));
|
||||||
echo "File $gpxPath 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);
|
// reduce the points to around 200 to speedup
|
||||||
if ($count>200)
|
if ( $donotreducegpx != true)
|
||||||
{
|
{
|
||||||
$f = round($count/200);
|
|
||||||
if ($f>1)
|
$count=sizeof($points);
|
||||||
for($i=$count;$i>0;$i--)
|
if ($count>200)
|
||||||
if ($i % $f != 0)
|
{
|
||||||
unset($points[$i]);
|
$f = round($count/200);
|
||||||
|
if ($f>1)
|
||||||
|
for($i=$count;$i>0;$i--)
|
||||||
|
if ($i % $f != 0)
|
||||||
|
unset($points[$i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $points;
|
return $points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +80,8 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
echo "j";
|
||||||
|
|
||||||
//Smoller Offset -> continue..
|
//Smoller Offset -> continue..
|
||||||
$lastOffset= (float) $lastOffset + (float) $offset ;
|
$lastOffset= (float) $lastOffset + (float) $offset ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,10 @@ function WP_GPX_Maps_html_page() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$showW = get_option("wpgpxmaps_show_waypoint");
|
$showW = get_option("wpgpxmaps_show_waypoint");
|
||||||
|
$donotreducegpx = get_option("wpgpxmaps_donotreducegpx");
|
||||||
|
$t = get_option('wpgpxmaps_map_type');
|
||||||
|
if (!($t))
|
||||||
|
$t = 'HYBRID';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -50,7 +54,7 @@ function WP_GPX_Maps_html_page() {
|
||||||
<b>The fastest way to use this plugin:</b> upload the file using the uploader below, than put this
|
<b>The fastest way to use this plugin:</b> upload the file using the uploader below, than put this
|
||||||
shotcode: <b>[sgpx gpx="/wp-content/uploads/gpx/< gpx file name >"]</b> in the pages/posts.
|
shotcode: <b>[sgpx gpx="/wp-content/uploads/gpx/< gpx file name >"]</b> in the pages/posts.
|
||||||
<p>
|
<p>
|
||||||
<i>Full set of attributes:</i> <b>[sgpx gpx="/wp-content/uploads/gpx/< gpx file name >" width=100% mheight=450px gheight=200px mtype=SATELLITE waypoints=true]</b>
|
<i>Full set of attributes:</i> <b>[sgpx gpx="/wp-content/uploads/gpx/< gpx file name >" width=100% mheight=450px gheight=200px mtype=SATELLITE waypoints=true donotreducegpx=false pointsoffset=10]</b>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -66,27 +70,31 @@ function WP_GPX_Maps_html_page() {
|
||||||
<i>Maps Height:</i> <input name="wpgpxmaps_height" type="text" id="wpgpxmaps_height" value="<?php echo get_option('wpgpxmaps_height'); ?>" style="width:50px;" />,
|
<i>Maps Height:</i> <input name="wpgpxmaps_height" type="text" id="wpgpxmaps_height" value="<?php echo get_option('wpgpxmaps_height'); ?>" style="width:50px;" />,
|
||||||
<i>Graph Height:</i> <input name="wpgpxmaps_graph_height" type="text" id="wpgpxmaps_graph_height" value="<?php echo get_option('wpgpxmaps_graph_height'); ?>" style="width:50px;" />,
|
<i>Graph Height:</i> <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_show_waypoint" type="checkbox" value="true" <?php if($showW == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Show Waypoints</i>
|
<input name="wpgpxmaps_show_waypoint" type="checkbox" value="true" <?php if($showW == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Show Waypoints</i>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="150" scope="row">Default Map Type:</th>
|
<th scope="row">Default Map Type:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<br />
|
||||||
$t = get_option('wpgpxmaps_map_type');
|
|
||||||
if (!($t))
|
|
||||||
$t = 'HYBRID';
|
|
||||||
?>
|
|
||||||
<input type="radio" name="wpgpxmaps_map_type" value="HYBRID" <?php if ($t == 'HYBRID') echo 'checked'; ?> > HYBRID: transparent layer of major streets on satellite images.<br />
|
<input type="radio" name="wpgpxmaps_map_type" value="HYBRID" <?php if ($t == 'HYBRID') echo 'checked'; ?> > HYBRID: transparent layer of major streets on satellite images.<br />
|
||||||
<input type="radio" name="wpgpxmaps_map_type" value="ROADMAP" <?php if ($t == 'ROADMAP') echo 'checked'; ?>> ROADMAP: normal street map.<br />
|
<input type="radio" name="wpgpxmaps_map_type" value="ROADMAP" <?php if ($t == 'ROADMAP') echo 'checked'; ?>> ROADMAP: normal street map.<br />
|
||||||
<input type="radio" name="wpgpxmaps_map_type" value="SATELLITE" <?php if ($t == 'SATELLITE') echo 'checked'; ?>> SATELLITE: satellite images.<br />
|
<input type="radio" name="wpgpxmaps_map_type" value="SATELLITE" <?php if ($t == 'SATELLITE') echo 'checked'; ?>> SATELLITE: satellite images.<br />
|
||||||
<input type="radio" name="wpgpxmaps_map_type" value="TERRAIN" <?php if ($t == 'TERRAIN') echo 'checked'; ?>> TERRAIN: maps with physical features such as terrain and vegetation.<br />
|
<input type="radio" name="wpgpxmaps_map_type" value="TERRAIN" <?php if ($t == 'TERRAIN') echo 'checked'; ?>> TERRAIN: maps with physical features such as terrain and vegetation.<br />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Advanced options:</th>
|
||||||
|
<td>
|
||||||
|
<br />
|
||||||
|
<b>Do not edit if you don't know what you are doing!</b><br />
|
||||||
|
<i>Skip points closer than </i> <input name="wpgpxmaps_pointsoffset" type="text" id="wpgpxmaps_pointsoffset" value="<?php echo get_option('wpgpxmaps_pointsoffset'); ?>" style="width:50px;" /><i>meters</i>.
|
||||||
|
<input name="wpgpxmaps_donotreducegpx" type="checkbox" value="true" <?php if($donotreducegpx == true){echo('checked');} ?> onchange="this.value = (this.checked)" /><i>Do not reduce gpx</i>.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
<input name="page_options" type="hidden" value="wpgpxmaps_map_type,wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_show_waypoint" />
|
<input name="page_options" type="hidden" value="wpgpxmaps_map_type,wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_show_waypoint,wpgpxmaps_pointsoffset,wpgpxmaps_donotreducegpx" />
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="submit" value="<?php _e('Save Changes') ?>" />
|
<input type="submit" value="<?php _e('Save Changes') ?>" />
|
||||||
|
@ -138,12 +146,6 @@ function WP_GPX_Maps_html_page() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if ( is_readable ( $realGpxPath ) && $handle = opendir($realGpxPath)) {
|
if ( is_readable ( $realGpxPath ) && $handle = opendir($realGpxPath)) {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -173,26 +175,26 @@ function WP_GPX_Maps_html_page() {
|
||||||
{
|
{
|
||||||
$file = $realGpxPath . "/" . $entry;
|
$file = $realGpxPath . "/" . $entry;
|
||||||
?>
|
?>
|
||||||
<tr class="active" id="akismet">
|
<tr>
|
||||||
<td class="plugin-title">
|
<td style="border:none; padding-bottom:0;">
|
||||||
<strong><?php echo $entry; ?></strong>
|
<strong><?php echo $entry; ?></strong>
|
||||||
<div class="row-actions-visible">
|
</td>
|
||||||
<a href="#" onclick="delgpx('<?php echo $entry ?>'); return false;">Delete</a>
|
<td style="border:none; padding-bottom:0;">
|
||||||
|
|
<?php echo date ("F d Y H:i:s.", filemtime( $file ) ) ?>
|
||||||
<a href="../wp-content/uploads/gpx/<?php echo $entry?>">Download</a>
|
</td>
|
||||||
</div>
|
<td style="border:none; padding-bottom:0;">
|
||||||
</td>
|
<?php echo number_format ( filesize( $file ) , 0, '.', ',' ) ?>
|
||||||
<td class="column-description desc">
|
</td>
|
||||||
<div class="plugin-description">
|
</tr>
|
||||||
<p><?php echo date ("F d Y H:i:s.", filemtime( $file ) ) ?></p>
|
<tr>
|
||||||
</div>
|
<td colspan=3 style="padding: 0px 7px 7px 7px;">
|
||||||
</td>
|
<a href="#" onclick="delgpx('<?php echo $entry ?>'); return false;">Delete</a>
|
||||||
<td class="column-description desc">
|
|
|
||||||
<div class="plugin-description">
|
<a href="../wp-content/uploads/gpx/<?php echo $entry?>">Download</a>
|
||||||
<p><?php echo number_format ( filesize( $file ) , 0, '.', ',' ) ?></p>
|
|
|
||||||
</div>
|
Shortcode: [sgpx gpx="/wp-content/uploads/gpx/<?php echo $entry?>"]
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue