code reorganization

This commit is contained in:
bastianonm 2019-07-02 06:39:27 +00:00
parent b684a1031e
commit 3308c70299
14 changed files with 4310 additions and 624 deletions

View File

@ -7,6 +7,7 @@
* 2. Tab: Tracks * 2. Tab: Tracks
* 3. Tab: Settings * 3. Tab: Settings
* 4. Tab: Help * 4. Tab: Help
*
*/ */
/** /**
@ -16,15 +17,31 @@
/** /**
* 2.0 Tab: Tracks * 2.0 Tab: Tracks
*/ */
#table tbody tr:hover {
background: #eee;
}
/** /**
* 3.0 Tab: Settings * 3.0 Tab: Settings
*/ */
.wpgpxmaps-container-tab-settings { .wpgpxmaps-container-tab-settings {
display: block; display: block;
padding: 5px 20px 1px 20px; padding: 5px 20px 1px 20px;
} }
.wpgpxmaps-container-tab-settings table.form-table input[type="checkbox"] {
margin-top: -4px;
margin-right: 4px;
}
.wpgpxmaps-container-tab-settings table.form-table input[type="radio"] {
margin-right: 4px;
}
.wpgpxmaps-container-tab-settings table.form-table input[type="text"] {
margin-right: 4px;
}
/** /**
* 4.0 Tab: Tracks * 4.0 Tab: Tracks
*/ */
@ -44,8 +61,12 @@
border-radius: 6px; border-radius: 6px;
} }
.wpgpxmaps-container-tab-faq table.widefat tbody tr:hover { .wpgpxmaps-container-tab-faq table.widefat thead th.title {
background:#eeeeee; font-weight: 650;
}
.wpgpxmaps-container-tab-faq table.widefat td {
width: 200px;
} }
.wpgpxmaps-container-tab-faq table.widefat th, .wpgpxmaps-container-tab-faq table.widefat th,
@ -53,10 +74,11 @@
padding: 4px 10px; padding: 4px 10px;
} }
.wpgpxmaps-container-tab-faq table.widefat thead tr th { .wpgpxmaps-container-tab-faq table.widefat tbody tr:hover {
font-size: 14px; background: #eee;
} }
.wpgpxmaps-container-tab-faq table.widefat td {
width: 200px; .wpgpxmaps-container-tab-faq table.widefat thead th {
font-size: 14px;
} }

337
css/bootstrap-table.css vendored Normal file
View File

@ -0,0 +1,337 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* version: 1.13.2
* https://github.com/wenzhixin/bootstrap-table/
*/
.bootstrap-table .table {
margin-bottom: 0 !important;
border-bottom: 1px solid #dddddd;
border-collapse: collapse !important;
border-radius: 1px;
}
.bootstrap-table .table:not(.table-condensed),
.bootstrap-table .table:not(.table-condensed) > tbody > tr > th,
.bootstrap-table .table:not(.table-condensed) > tfoot > tr > th,
.bootstrap-table .table:not(.table-condensed) > thead > tr > td,
.bootstrap-table .table:not(.table-condensed) > tbody > tr > td,
.bootstrap-table .table:not(.table-condensed) > tfoot > tr > td {
padding: 8px;
}
.bootstrap-table .table.table-no-bordered > thead > tr > th {
border-top: none;
}
.bootstrap-table .table.table-no-bordered > thead > tr > th,
.bootstrap-table .table.table-no-bordered > tbody > tr > td {
border-right: 2px solid transparent;
}
.bootstrap-table .table.table-no-bordered > tbody > tr > td:last-child {
border-right: none;
}
.fixed-table-container {
position: relative;
clear: both;
border: 1px solid #dddddd;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
}
.fixed-table-container.table-no-bordered {
border: 1px solid transparent;
}
.fixed-table-footer,
.fixed-table-header {
overflow: hidden;
}
.fixed-table-footer {
border-top: 1px solid #dddddd;
}
.fixed-table-body {
overflow-x: auto;
overflow-y: auto;
height: 100%;
}
.fixed-table-container table {
width: 100%;
}
.fixed-table-container thead th {
height: 0;
padding: 0;
margin: 0;
border-left: 1px solid #dddddd;
}
.fixed-table-container thead th:focus {
outline: 0 solid transparent;
}
.fixed-table-container thead th:first-child:not([data-not-first-th]) {
border-left: none;
border-top-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
}
.fixed-table-container thead th .th-inner,
.fixed-table-container tbody td .th-inner {
padding: 8px;
line-height: 24px;
vertical-align: top;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.fixed-table-container thead th .sortable {
cursor: pointer;
background-position: right;
background-repeat: no-repeat;
padding-right: 30px;
}
.fixed-table-container thead th .both {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC');
}
.fixed-table-container thead th .asc {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
}
.fixed-table-container thead th .desc {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ');
}
.fixed-table-container th.detail {
width: 30px;
}
.fixed-table-container tbody td {
border-left: 1px solid #dddddd;
}
.fixed-table-container tbody tr:first-child td {
border-top: none;
}
.fixed-table-container tbody td:first-child {
border-left: none;
}
/* the same color with .active */
.fixed-table-container tbody .selected td {
background-color: #f5f5f5;
}
.fixed-table-container .bs-checkbox {
text-align: center;
}
.fixed-table-container input[type="radio"],
.fixed-table-container input[type="checkbox"] {
margin: 0 auto !important;
}
.fixed-table-container .no-records-found {
text-align: center;
}
.fixed-table-pagination div.pagination,
.fixed-table-pagination .pagination-detail {
margin-top: 10px;
margin-bottom: 10px;
}
.fixed-table-pagination div.pagination .pagination {
margin: 0;
}
.fixed-table-pagination .pagination a {
padding: 6px 12px;
line-height: 1.428571429;
}
.fixed-table-pagination ul.pagination li.page-intermediate a {
color:#c8c8c8;
}
.fixed-table-pagination ul.pagination li.page-intermediate a:before {
content: '\2B05';
}
.fixed-table-pagination ul.pagination li.page-intermediate a:after {
content: '\27A1';
}
.fixed-table-pagination .pagination-info {
line-height: 34px;
margin-right: 5px;
}
.fixed-table-pagination .btn-group {
position: relative;
display: inline-block;
vertical-align: middle;
}
.fixed-table-pagination .dropup .dropdown-menu {
margin-bottom: 0;
}
.fixed-table-pagination .page-list {
display: inline-block;
}
.fixed-table-toolbar .columns-left {
margin-right: 5px;
}
.fixed-table-toolbar .columns-right {
margin-left: 5px;
}
.fixed-table-toolbar .columns label {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
}
.fixed-table-toolbar .bs-bars,
.fixed-table-toolbar .search,
.fixed-table-toolbar .columns {
position: relative;
margin-top: 10px;
margin-bottom: 10px;
}
.fixed-table-pagination li.disabled a {
pointer-events: none;
cursor: default;
}
.fixed-table-loading {
display: none;
position: absolute;
top: 42px;
right: 0;
bottom: 0;
left: 0;
z-index: 99;
background-color: #fff;
text-align: center;
}
.fixed-table-body .card-view .title {
font-weight: bold;
display: inline-block;
min-width: 30%;
text-align: left !important;
}
/* support bootstrap 2 */
.fixed-table-body thead th .th-inner {
box-sizing: border-box;
}
.table th, .table td {
vertical-align: middle;
box-sizing: border-box;
}
.fixed-table-toolbar .dropdown-menu {
text-align: left;
max-height: 300px;
overflow: auto;
}
.fixed-table-toolbar .btn-group > .btn-group {
display: inline-block;
margin-left: -1px !important;
}
.fixed-table-toolbar .btn-group > .btn-group > .btn {
border-radius: 0;
}
.fixed-table-toolbar .btn-group > .btn-group:first-child > .btn {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.fixed-table-toolbar .btn-group > .btn-group:last-child > .btn {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.bootstrap-table .table > thead > tr > th {
vertical-align: bottom;
border-bottom: 1px solid #ddd;
}
.bootstrap-table .table > thead.thead-dark > tr > th {
border-bottom: 1px solid #212529;
}
/* support bootstrap 3 */
.bootstrap-table .table thead > tr > th {
padding: 0;
margin: 0;
}
.bootstrap-table .fixed-table-footer tbody > tr > td {
padding: 0 !important;
}
.bootstrap-table .fixed-table-footer .table {
border-bottom: none;
border-radius: 0;
padding: 0 !important;
}
.bootstrap-table .pull-right .dropdown-menu {
right: 0;
left: auto;
}
/* calculate scrollbar width */
p.fixed-table-scroll-inner {
width: 100%;
height: 200px;
}
div.fixed-table-scroll-outer {
top: 0;
left: 0;
visibility: hidden;
width: 200px;
height: 150px;
overflow: hidden;
}
/* for get correct heights */
.fixed-table-toolbar:after, .fixed-table-pagination:after {
content: "";
display: block;
clear: both;
}
.bootstrap-table.fullscreen {
position: fixed;
top: 0;
left: 0;
z-index: 1050;
width: 100%!important;
background: #FFF;
}

65
css/output-style.css Normal file
View File

@ -0,0 +1,65 @@
/**
* This file contains the style definitions for the output
*
*/
.wpgpxmaps img,
.entry-content .wpgpxmaps img,
#content .wpgpxmaps img {
width: none;
max-width: none;
margin: 0;
padding: 0;
border: none;
background: none;
}
.wpgpxmaps {
clear: both;
}
.wpgpxmaps .ngimages {
display: none;
}
.wpgpxmaps .myngimages {
position: absolute;
z-index :1;
margin:0;
border: 1px solid #fff;
cursor: pointer;
}
.wpgpxmaps_summary .summarylabel {
font-weight: 400;
}
.wpgpxmaps_summary .summaryvalue {
font-weight: 600;
}
.wpgpxmaps .report {
line-height :120;
}
.wpgpxmaps .gmnoprint div:first-child { }
.wpgpxmaps .wpgpxmaps_osm_footer {
position: absolute;
z-index: 999;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 13px;
margin: 0;
background: #fff;
font-size: 12px;
}
.wpgpxmaps .wpgpxmaps_osm_footer span {
position: absolute;
bottom: 0;
padding: 0 6px 6px 6px;
background: #fff;
vertical-align: baseline;
}

View File

@ -48,7 +48,7 @@ var WPGPXMAPS = {
MapEngines: { MapEngines: {
/* NOT WORKING AND TESTED! old code copy&pate */ /* NOT WORKING AND TESTED! old code copy&paste */
GoogleMaps: function() { GoogleMaps: function() {
this.map = null, this.map = null,
this.EventSelectChart = null, this.EventSelectChart = null,

3223
js/bootstrap-table.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,8 @@ Contributors: bastianonm, Stephan Klein, Michel Selerin, TosattoSimonePio, Knieb
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML
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: 4.6.0 Requires at least: 4.6.0
Tested up to: 5.2.1 Tested up to: 5.2.2
Requires PHP: 5.6.20
Stable tag: 1.7.00 Stable tag: 1.7.00
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.
@ -42,19 +43,19 @@ Try this plugin: <a href="https://devfarm.it/wp-gpx-maps-demo/" target="_blank"
Support: Support:
If you need help, please use: <a href="http://www.devfarm.it/forums/forum/wp-gpx-maps/" target="_blank" rel="noopener noreferrer">www.devfarm.it Support Forum</a> If you need help, please use: <a href="http://www.devfarm.it/forums/forum/wp-gpx-maps/" target="_blank" rel="noopener noreferrer">www.devfarm.it Support Forum</a>
Would you like to help fix bugs or further develop the plugin? On <a href="https://github.com/devfarm-it/wp-gpx-maps" target="_blank" rel="noopener noreferrer">Github</a> you can contribuite easly with your code. Would you like to help fix bugs or further develop the plugin? On <a href="https://github.com/devfarm-it/wp-gpx-maps" target="_blank" rel="noopener noreferrer">Github</a> you can contribuite easly with your code.
Translations: Translations:
Translators are welcome to contribute to the plugin. Please use the <a href="https://translate.wordpress.org/projects/wp-plugins/wp-gpx-maps/)" target="_blank" rel="noopener noreferrer">WordPress translation website</a>. Translators are welcome to contribute to the plugin. Please use the <a href="https://translate.wordpress.org/projects/wp-plugins/wp-gpx-maps/)" target="_blank" rel="noopener noreferrer">WordPress translation website</a>.
The language files in the plugin contain 19 translatable texts for 14 languages: The language files in the plugin contain 18 translatable texts for 13 languages:
- Catalan ca - Catalan ca
- Dutch nl_NL - Dutch nl_NL
- English (default) - English (default)
- French fr_FR - French fr_FR
- German de_DE
- Hungarian hu_HU - Hungarian hu_HU
- Italian it_IT - Italian it_IT
- Norwegian nb_NO - Norwegian nb_NO
@ -71,7 +72,7 @@ The language files in the plugin contain 19 translatable texts for 14 languages:
(Many thanks to all guys who helped me with the translations) (Many thanks to all guys who helped me with the translations)
Currently are 222 texts are translatable in the plugin. Currently are 230 texts are translatable in the plugin.
With your help, the plugin can be translated into any language. For updating the language file you no longer need to wait for a new version of the plugin. With your help, the plugin can be translated into any language. For updating the language file you no longer need to wait for a new version of the plugin.
Are 95% WordPress generates a new language file for your language. Are 95% WordPress generates a new language file for your language.
@ -107,9 +108,9 @@ Icons made by <a href="https://www.freepik.com/" target="_blank" rel="noopener n
You can use the following shortcodes: You can use the following shortcodes:
1. gpx: Relative path to the GPX file 1. gpx: Relative path to the GPX file
1. width: Width in pixels 1. width: Map width (value in percent)
1. mheight: Map height 1. mheight: Map height (value in pixeln)
1. gheight: Graph height 1. gheight: Graph height (value in pixeln)
1. skipcache: Do not use cache. If TRUE might be very slow (default is false) 1. skipcache: Do not use cache. If TRUE might be very slow (default is false)
1. download: Allow users to download your GPX file (default is false) 1. download: Allow users to download your GPX file (default is false)
1. summary: Print summary details of your GPX track (default is false) 1. summary: Print summary details of your GPX track (default is false)
@ -127,7 +128,7 @@ You can use the following shortcodes:
1. startIcon: Start track icon 1. startIcon: Start track icon
1. endIcon: End track icon 1. endIcon: End track icon
1. currentIcon: Current position icon (when mouse hover) 1. currentIcon: Current position icon (when mouse hover)
1. waypointicon: Waypoint custom icon 1. waypointicon: Custom waypoint icon
1. showele: Show elevation data inside the chart (default is true) 1. showele: Show elevation data inside the chart (default is true)
1. uom: Distance/altitude possible unit of measure (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles) 1. uom: Distance/altitude possible unit of measure (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles)
1. glinecolor: Altitude line color (default is #3366cc) 1. glinecolor: Altitude line color (default is #3366cc)
@ -162,8 +163,8 @@ This plugin will print a small amout of points to speedup javascript and pageloa
Yes! Yes!
== Screenshots == == Screenshots ==
1. Simple Gpx 1. Simple GPX
1. Gpx with waypoints 1. GPX with waypoints
1. Admin area - List of tracks 1. Admin area - List of tracks
1. Admin area - Settings 1. Admin area - Settings
1. Altitude & Speed 1. Altitude & Speed
@ -171,6 +172,14 @@ Yes!
== Changelog == == Changelog ==
= X.X.XX
* Added: PHP version notices, WordPress 5.3 requires PHP 5.6.20
* Added: Missing entries for add and delete options
* Changed: Style for output moved in a seperate file
* Tweak: Small design optimizations in the admin area
* Tweak: Small code adjustments (WPCS)
* Upgrade: bootstrap-table to 1.13.2
* Removed: german language file (now over translate.wordpress.org)
= 1.7.00 = = 1.7.00 =
* Added: Authors can upload GPX tracks in a folder called as *your user name*, inside [../wp-upload dir/gpx/[*your user name*] (thanks to wildcomputations) * Added: Authors can upload GPX tracks in a folder called as *your user name*, inside [../wp-upload dir/gpx/[*your user name*] (thanks to wildcomputations)
* Added: Authors an Admins can see the current values for shortcodes in help tab * Added: Authors an Admins can see the current values for shortcodes in help tab

View File

@ -22,7 +22,6 @@ add_shortcode( 'sgpxf', 'handle_WP_GPX_Maps_folder_Shortcodes' );
register_activation_hook( __FILE__, 'WP_GPX_Maps_install' ); register_activation_hook( __FILE__, 'WP_GPX_Maps_install' );
register_deactivation_hook( __FILE__, 'WP_GPX_Maps_remove' ); register_deactivation_hook( __FILE__, 'WP_GPX_Maps_remove' );
add_filter( 'plugin_action_links', 'WP_GPX_Maps_action_links', 10, 2 ); add_filter( 'plugin_action_links', 'WP_GPX_Maps_action_links', 10, 2 );
add_action( 'wp_print_styles', 'print_WP_GPX_Maps_styles' );
add_action( 'wp_enqueue_scripts', 'enqueue_WP_GPX_Maps_scripts' ); add_action( 'wp_enqueue_scripts', 'enqueue_WP_GPX_Maps_scripts' );
add_action( 'admin_enqueue_scripts', 'enqueue_WP_GPX_Maps_scripts_admin' ); add_action( 'admin_enqueue_scripts', 'enqueue_WP_GPX_Maps_scripts_admin' );
add_action( 'plugins_loaded', 'WP_GPX_Maps_lang_init' ); add_action( 'plugins_loaded', 'WP_GPX_Maps_lang_init' );
@ -64,29 +63,38 @@ function enqueue_WP_GPX_Maps_scripts_admin( $hook ) {
if ( strpos( $hook, 'WP-GPX-Maps' ) !== false ) { if ( strpos( $hook, 'WP-GPX-Maps' ) !== false ) {
/* Admin Style CSS */ /* Admin Style CSS */
wp_register_style( 'admin-stye', plugins_url( 'css/admin-style.css', __FILE__ ), array(), '1.0.0' ); wp_register_style( 'admin-style', plugins_url( 'css/admin-style.css', __FILE__ ), array(), '1.0.0' );
wp_enqueue_style( 'admin-stye' ); wp_enqueue_style( 'admin-style' );
/* mColorPicker */ /* mColorPicker */
wp_register_script( 'mColorPicker', plugins_url( '/js/mColorPicker_min.js', __FILE__ ), array(), '1.0 r39' ); wp_register_script( 'mColorPicker', plugins_url( '/js/mColorPicker_min.js', __FILE__ ), array(), '1.0 r39' );
wp_enqueue_script( 'mColorPicker' ); wp_enqueue_script( 'mColorPicker' );
/* bootstrap-table */ /* bootstrap-table */
wp_register_script( 'bootstrap-table', plugins_url( '/js/bootstrap-table.min.js', __FILE__ ), array(), '1.11.1' ); wp_register_script( 'bootstrap-table', plugins_url( '/js/bootstrap-table.js', __FILE__ ), array(), '1.13.2' );
wp_enqueue_script( 'bootstrap-table' ); wp_enqueue_script( 'bootstrap-table' );
wp_register_style( 'bootstrap-table', plugins_url( '/css/bootstrap-table.min.css', __FILE__ ), array(), '1.11.1' ); wp_register_style( 'bootstrap-table', plugins_url( '/css/bootstrap-table.css', __FILE__ ), array(), '1.13.2' );
wp_enqueue_style( 'bootstrap-table' ); wp_enqueue_style( 'bootstrap-table' );
} }
} }
function enqueue_WP_GPX_Maps_scripts() { function enqueue_WP_GPX_Maps_scripts() {
/* leaflet */ /* Output Style CSS */
wp_register_style( 'output-style', plugins_url( 'css/output-style.css', __FILE__ ), array(), '1.0.0' );
wp_enqueue_style( 'output-style' );
/* Leaflet */
wp_register_style( 'leaflet', plugins_url( '/ThirdParties/Leaflet_1.5.1/leaflet.css', __FILE__ ), array(), '1.5.1' ); wp_register_style( 'leaflet', plugins_url( '/ThirdParties/Leaflet_1.5.1/leaflet.css', __FILE__ ), array(), '1.5.1' );
wp_enqueue_style( 'leaflet' ); wp_enqueue_style( 'leaflet' );
/* Leaflet.markercluster */
wp_register_style( 'leaflet.markercluster', plugins_url( '/ThirdParties/Leaflet.markercluster-1.4.1/MarkerCluster.css', __FILE__ ), array(), '1.4.1,' ); wp_register_style( 'leaflet.markercluster', plugins_url( '/ThirdParties/Leaflet.markercluster-1.4.1/MarkerCluster.css', __FILE__ ), array(), '1.4.1,' );
wp_enqueue_style( 'leaflet.markercluster' ); wp_enqueue_style( 'leaflet.markercluster' );
/* Leaflet.Photo */
wp_register_style( 'leaflet.Photo', plugins_url( '/ThirdParties/Leaflet.Photo/Leaflet.Photo.css', __FILE__ ), array(), '0' ); wp_register_style( 'leaflet.Photo', plugins_url( '/ThirdParties/Leaflet.Photo/Leaflet.Photo.css', __FILE__ ), array(), '0' );
wp_enqueue_style( 'leaflet.Photo' ); wp_enqueue_style( 'leaflet.Photo' );
/* Leaflet.fullscreen */
wp_register_style( 'leaflet.fullscreen', plugins_url( '/ThirdParties/leaflet.fullscreen-1.4.5/Control.FullScreen.css', __FILE__ ), array(), '1.5.1' ); wp_register_style( 'leaflet.fullscreen', plugins_url( '/ThirdParties/leaflet.fullscreen-1.4.5/Control.FullScreen.css', __FILE__ ), array(), '1.5.1' );
wp_enqueue_style( 'leaflet.fullscreen' ); wp_enqueue_style( 'leaflet.fullscreen' );
@ -95,11 +103,12 @@ function enqueue_WP_GPX_Maps_scripts() {
wp_register_script( 'leaflet.Photo', plugins_url( '/ThirdParties/Leaflet.Photo/Leaflet.Photo.js', __FILE__ ), array( 'leaflet', 'leaflet.markercluster' ), '0' ); wp_register_script( 'leaflet.Photo', plugins_url( '/ThirdParties/Leaflet.Photo/Leaflet.Photo.js', __FILE__ ), array( 'leaflet', 'leaflet.markercluster' ), '0' );
wp_register_script( 'leaflet.fullscreen', plugins_url( '/ThirdParties/leaflet.fullscreen-1.4.5/Control.FullScreen.js', __FILE__ ), array( 'leaflet' ), '1.4.5' ); wp_register_script( 'leaflet.fullscreen', plugins_url( '/ThirdParties/leaflet.fullscreen-1.4.5/Control.FullScreen.js', __FILE__ ), array( 'leaflet' ), '1.4.5' );
/* chartjs */ /* Chartjs */
wp_register_script( 'chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), '2.8.0' ); wp_register_script( 'chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), '2.8.0' );
wp_register_script( 'WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array( 'jquery', 'leaflet', 'chartjs' ), '1.6.02' ); wp_register_script( 'WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array( 'jquery', 'leaflet', 'chartjs' ), '1.6.02' );
wp_enqueue_script( 'output-style' );
wp_enqueue_script( 'leaflet' ); wp_enqueue_script( 'leaflet' );
wp_enqueue_script( 'leaflet.markercluster' ); wp_enqueue_script( 'leaflet.markercluster' );
wp_enqueue_script( 'leaflet.Photo' ); wp_enqueue_script( 'leaflet.Photo' );
@ -109,72 +118,6 @@ function enqueue_WP_GPX_Maps_scripts() {
wp_enqueue_script( 'WP-GPX-Maps' ); wp_enqueue_script( 'WP-GPX-Maps' );
} }
function print_WP_GPX_Maps_styles() {
?>
<style type="text/css">
.wpgpxmaps {
clear: both;
}
#content .wpgpxmaps img,
.entry-content .wpgpxmaps img,
.wpgpxmaps img {
max-width: none;
width: none;
padding: 0;
background: none;
margin: 0;
border: none;
}
.wpgpxmaps .ngimages {
display: none;
}
.wpgpxmaps .myngimages {
border: 1px solid #fff;
position: absolute;
cursor: pointer;
margin:0;
z-index :1;
}
.wpgpxmaps_summary .summarylabel { }
.wpgpxmaps_summary .summaryvalue {
font-weight: bold;
}
.wpgpxmaps .report {
line-height :120%;
}
.wpgpxmaps .gmnoprint div:first-child { }
.wpgpxmaps .wpgpxmaps_osm_footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 13px;
margin: 0;
z-index: 999;
background: WHITE;
font-size: 12px;
}
.wpgpxmaps .wpgpxmaps_osm_footer span {
background: WHITE;
padding: 0 6px 6px 6px;
vertical-align: baseline;
position: absolute;
bottom: 0;
}
</style>
<?php
}
function wpgpxmaps_findValue( $attr, $attributeName, $optionName, $defaultValue ) { function wpgpxmaps_findValue( $attr, $attributeName, $optionName, $defaultValue ) {
$val = ''; $val = '';
@ -220,7 +163,7 @@ function handle_WP_GPX_Maps_folder_Shortcodes( $attr, $content = '' ) {
$points_graph_dist = ''; $points_graph_dist = '';
$points_graph_ele = ''; $points_graph_ele = '';
if ( is_array ( $points_x_lat ) ) if ( is_array( $points_x_lat ) )
foreach ( array_keys( $points_x_lat ) as $i ) { foreach ( array_keys( $points_x_lat ) as $i ) {
$_lat = (float) $points_x_lat[$i]; $_lat = (float) $points_x_lat[$i];
@ -238,7 +181,7 @@ function handle_WP_GPX_Maps_folder_Shortcodes( $attr, $content = '' ) {
$_dist = (float) $points->dist[$i]; $_dist = (float) $points->dist[$i];
if ( $uom == '1' ) { if ( $uom == '1' ) {
/* miles and feet */ /* feet / miles */
$_dist *= 0.000621371192; $_dist *= 0.000621371192;
$_ele *= 3.2808399; $_ele *= 3.2808399;
@ -247,7 +190,7 @@ function handle_WP_GPX_Maps_folder_Shortcodes( $attr, $content = '' ) {
$_dist = (float) ( $_dist / 1000 ); $_dist = (float) ( $_dist / 1000 );
} elseif ( $uom == '3' ) { } elseif ( $uom == '3' ) {
/* meters / kilometers / nautical miles */ /* meters / nautical miles */
$_dist = (float) ( $_dist / 1000 / 1.852 ); $_dist = (float) ( $_dist / 1000 / 1.852 );
} elseif ( $uom == '4' ) { } elseif ( $uom == '4' ) {
@ -255,7 +198,7 @@ function handle_WP_GPX_Maps_folder_Shortcodes( $attr, $content = '' ) {
$_dist *= 0.000621371192; $_dist *= 0.000621371192;
} elseif ( $uom == '5' ) { } elseif ( $uom == '5' ) {
/* meters / kilometers / nautical miles and feet */ /* feet / nautical miles */
$_dist = (float) ( $_dist / 1000 / 1.852 ); $_dist = (float) ( $_dist / 1000 / 1.852 );
$_ele *= 3.2808399; $_ele *= 3.2808399;
} }
@ -283,7 +226,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$download = wpgpxmaps_findValue( $attr, 'download', 'wpgpxmaps_download', '' ); $download = wpgpxmaps_findValue( $attr, 'download', 'wpgpxmaps_download', '' );
$usegpsposition = wpgpxmaps_findValue( $attr, 'usegpsposition', 'wpgpxmaps_usegpsposition', false ); $usegpsposition = wpgpxmaps_findValue( $attr, 'usegpsposition', 'wpgpxmaps_usegpsposition', false );
/* Print Summary Table */ /* Print Summary Table */
$summary = wpgpxmaps_findValue( $attr, 'summary', 'wpgpxmaps_summary', '' ); $summary = wpgpxmaps_findValue( $attr, 'summary', 'wpgpxmaps_summary', false );
$p_tot_len = wpgpxmaps_findValue( $attr, 'summarytotlen', 'wpgpxmaps_summary_tot_len', false ); $p_tot_len = wpgpxmaps_findValue( $attr, 'summarytotlen', 'wpgpxmaps_summary_tot_len', false );
$p_max_ele = wpgpxmaps_findValue( $attr, 'summarymaxele', 'wpgpxmaps_summary_max_ele', false ); $p_max_ele = wpgpxmaps_findValue( $attr, 'summarymaxele', 'wpgpxmaps_summary_max_ele', false );
$p_min_ele = wpgpxmaps_findValue( $attr, 'summaryminele', 'wpgpxmaps_summary_min_ele', false ); $p_min_ele = wpgpxmaps_findValue( $attr, 'summaryminele', 'wpgpxmaps_summary_min_ele', false );
@ -305,7 +248,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$currentIcon = wpgpxmaps_findValue( $attr, 'currenticon', 'wpgpxmaps_map_current_icon', '' ); $currentIcon = wpgpxmaps_findValue( $attr, 'currenticon', 'wpgpxmaps_map_current_icon', '' );
$waypointIcon = wpgpxmaps_findValue( $attr, 'waypointicon', 'wpgpxmaps_map_waypoint_icon', '' ); $waypointIcon = wpgpxmaps_findValue( $attr, 'waypointicon', 'wpgpxmaps_map_waypoint_icon', '' );
/* Diagram - Elevation */ /* Diagram - Elevation */
$showEle = wpgpxmaps_findValue( $attr, 'showele', 'wpgpxmaps_show_elevation', 'true' ); $showEle = wpgpxmaps_findValue( $attr, 'showele', 'wpgpxmaps_show_elevation', true );
$color_graph = wpgpxmaps_findValue( $attr, 'glinecolor', 'wpgpxmaps_graph_line_color', '#3366cc' ); $color_graph = wpgpxmaps_findValue( $attr, 'glinecolor', 'wpgpxmaps_graph_line_color', '#3366cc' );
$uom = wpgpxmaps_findValue( $attr, 'uom', 'wpgpxmaps_unit_of_measure', '0' ); $uom = wpgpxmaps_findValue( $attr, 'uom', 'wpgpxmaps_unit_of_measure', '0' );
$chartFrom1 = wpgpxmaps_findValue( $attr, 'chartfrom1', 'wpgpxmaps_graph_offset_from1', '' ); $chartFrom1 = wpgpxmaps_findValue( $attr, 'chartfrom1', 'wpgpxmaps_graph_offset_from1', '' );
@ -338,7 +281,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$donotreducegpx = wpgpxmaps_findValue( $attr, 'donotreducegpx', 'wpgpxmaps_donotreducegpx', false ); $donotreducegpx = wpgpxmaps_findValue( $attr, 'donotreducegpx', 'wpgpxmaps_donotreducegpx', false );
$allow_users_upload = wpgpxmaps_findValue( $attr, 'wpgpxmaps_allow_users_upload', 'wpgpxmaps_allow_users_view', false ); $allow_users_upload = wpgpxmaps_findValue( $attr, 'wpgpxmaps_allow_users_upload', 'wpgpxmaps_allow_users_view', false );
$colors_map = "\"" . implode( "\",\"", ( explode( " ", $color_map ) ) ) . "\""; $colors_map = "\"" . implode( "\",\"", ( explode( ' ', $color_map ) ) ) . "\"";
$gpxurl = $gpx; $gpxurl = $gpx;
@ -417,7 +360,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
} }
} }
$isGpxUrl = ( preg_match( '/^(http(s)?\:\/\/)/', trim( $gpx ) ) == 1); $isGpxUrl = ( preg_match( '/^(http(s)?\:\/\/)/', trim( $gpx ) ) == 1 );
if ( ( ! isset( $points_maps ) || $points_maps == '' ) && $gpx != '' ) { if ( ( ! isset( $points_maps ) || $points_maps == '' ) && $gpx != '' ) {
// if (true) { // if (true) {
@ -495,7 +438,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$_dist = (float) $points->dist[$i]; $_dist = (float) $points->dist[$i];
if ( $uom == '1') { if ( $uom == '1') {
/* miles and feet */ /* feet / miles */
$_dist *= 0.000621371192; $_dist *= 0.000621371192;
$_ele *= 3.2808399; $_ele *= 3.2808399;
@ -504,7 +447,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$_dist = (float) ( $_dist / 1000 ); $_dist = (float) ( $_dist / 1000 );
} elseif ( $uom == '3') { } elseif ( $uom == '3') {
/* meters / kilometers / nautical miles */ /* meters / nautical miles */
$_dist = (float) ( $_dist / 1000 / 1.852 ); $_dist = (float) ( $_dist / 1000 / 1.852 );
} elseif ( $uom == '4' ) { } elseif ( $uom == '4' ) {
@ -512,7 +455,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$_dist *= 0.000621371192; $_dist *= 0.000621371192;
} elseif ( $uom == '5' ) { } elseif ( $uom == '5' ) {
/* meters / kilometers / nautical miles and feet */ /* feet / nautical miles */
$_dist = (float) ( $_dist / 1000 / 1.852 ); $_dist = (float) ( $_dist / 1000 / 1.852 );
$_ele *= 3.2808399; $_ele *= 3.2808399;
} }
@ -526,25 +469,25 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
} }
if ( $showHr == true ) { if ( $showHr == true ) {
$points_graph_hr .= number_format( $points->hr[$i], 2, '.', '' ).','; $points_graph_hr .= number_format( $points->hr[$i], 2, '.', '' ) . ',';
} }
if ( $showAtemp == true ) { if ( $showAtemp == true ) {
$points_graph_atemp .= number_format( $points->atemp[$i], 1, '.', '' ).','; $points_graph_atemp .= number_format( $points->atemp[$i], 1, '.', '' ) . ',';
} }
if ( $showCad == true ) { if ( $showCad == true ) {
$points_graph_cad .= number_format( $points->cad[$i], 2, '.', '' ).','; $points_graph_cad .= number_format( $points->cad[$i], 2, '.', '' ) . ',';
} }
if ( $showGrade == true ) { if ( $showGrade == true ) {
$points_graph_grade .= number_format( $points->grade[$i], 2, '.', '' ).','; $points_graph_grade .= number_format( $points->grade[$i], 2, '.', '' ) . ',';
} }
} }
} }
if ( $uom == '1' ) { if ( $uom == '1' ) {
/* miles and feet */ /* feet / miles */
$tot_len = round( $tot_len * 0.000621371192, 2 ) . ' mi'; $tot_len = round( $tot_len * 0.000621371192, 2 ) . ' mi';
$max_ele = round( $max_ele * 3.2808399, 0 ) . ' ft'; $max_ele = round( $max_ele * 3.2808399, 0 ) . ' ft';
$min_ele = round( $min_ele * 3.2808399, 0 ) . ' ft'; $min_ele = round( $min_ele * 3.2808399, 0 ) . ' ft';
@ -560,15 +503,15 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$total_ele_down = round( $total_ele_down, 0 ) . ' m'; $total_ele_down = round( $total_ele_down, 0 ) . ' m';
} elseif ( $uom == '3' ) { } elseif ( $uom == '3' ) {
/* meters / kilometers / nautical miles */ /* meters / nautical miles */
$tot_len = round( $tot_len / 1000/1.852, 2 ) . ' NM'; $tot_len = round( $tot_len / 1000 / 1.852, 2 ) . ' NM';
$max_ele = round( $max_ele, 0 ) . ' m'; $max_ele = round( $max_ele, 0 ) . ' m';
$min_ele = round( $min_ele, 0 ) . ' m'; $min_ele = round( $min_ele, 0 ) . ' m';
$total_ele_up = round( $total_ele_up, 0 ) . ' m'; $total_ele_up = round( $total_ele_up, 0 ) . ' m';
$total_ele_down = round( $total_ele_down, 0 ) . ' m'; $total_ele_down = round( $total_ele_down, 0 ) . ' m';
} elseif ( $uom == '4' ) { } elseif ( $uom == '4' ) {
/* meters / kilometers / nautical miles */ /* meters / miles */
$tot_len = round( $tot_len * 0.000621371192, 2 ) . ' mi'; $tot_len = round( $tot_len * 0.000621371192, 2 ) . ' mi';
$max_ele = round( $max_ele, 0 ) . ' m'; $max_ele = round( $max_ele, 0 ) . ' m';
$min_ele = round( $min_ele, 0 ) . ' m'; $min_ele = round( $min_ele, 0 ) . ' m';
@ -576,8 +519,8 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$total_ele_down = round( $total_ele_down, 0 ) . ' m'; $total_ele_down = round( $total_ele_down, 0 ) . ' m';
} elseif ( $uom == '5' ) { } elseif ( $uom == '5' ) {
/* meters / kilometers / nautical miles and feet */ /* feet / nautical miles */
$tot_len = round( $tot_len / 1000/1.852, 2 ) . ' NM'; $tot_len = round( $tot_len / 1000 / 1.852, 2 ) . ' NM';
$max_ele = round( $max_ele * 3.2808399, 0 ) . ' ft'; $max_ele = round( $max_ele * 3.2808399, 0 ) . ' ft';
$min_ele = round( $min_ele * 3.2808399, 0 ) . ' ft'; $min_ele = round( $min_ele * 3.2808399, 0 ) . ' ft';
$total_ele_up = round( $total_ele_up * 3.2808399, 0 ) . ' ft'; $total_ele_up = round( $total_ele_up * 3.2808399, 0 ) . ' ft';
@ -599,11 +542,11 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$wpoints = wpgpxmaps_getWayPoints( $gpx ); $wpoints = wpgpxmaps_getWayPoints( $gpx );
$waypoints = wp_json_encode( $wpoints ); $waypoints = wp_json_encode( $wpoints );
} }
if ( $showEle == 'false' ) { if ( $showEle == false ) {
$points_graph_ele = ""; $points_graph_ele = '';
} }
$p = "/(,|,null,)$/"; $p = '/(,|,null,)$/';
$points_maps = preg_replace( $p, '', $points_maps ); $points_maps = preg_replace( $p, '', $points_maps );
@ -643,11 +586,11 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$ngimgs_data = ''; $ngimgs_data = '';
if ( $ngGalleries != '' || $ngImages != '' ) { if ( $ngGalleries != '' || $ngImages != '' ) {
$ngimgs = getNGGalleryImages( $ngGalleries, $ngImages, $points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error ); $ngimgs = getNGGalleryImages( $ngGalleries, $ngImages, $points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error );
$ngimgs_data =''; $ngimgs_data = '';
foreach ( $ngimgs as $img ) { foreach ( $ngimgs as $img ) {
$data = $img['data']; $data = $img['data'];
$data = str_replace( "\n", "", $data ); $data = str_replace( '\n', '', $data );
$ngimgs_data .= '<span lat="' . $img['lat'] . '" lon="' . $img['lon'] . '">' . $data . '</span>'; $ngimgs_data .= '<span lat="' . $img['lat'] . '" lon="' . $img['lon'] . '">' . $data . '</span>';
} }
} }
@ -656,7 +599,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$attimgs = wpgpxmaps_getAttachedImages( $points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error ); $attimgs = wpgpxmaps_getAttachedImages( $points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error );
foreach ( $attimgs as $img ) { foreach ( $attimgs as $img ) {
$data = $img['data']; $data = $img['data'];
$data = str_replace( "\n", "", $data ); $data = str_replace( '\n', '', $data );
$ngimgs_data .= '<span lat="' . $img['lat'] . '" lon="' . $img['lon'] . '">' . $data . '</span>'; $ngimgs_data .= '<span lat="' . $img['lat'] . '" lon="' . $img['lon'] . '">' . $data . '</span>';
} }
} }
@ -713,7 +656,7 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#wpgpxmaps_' . $r . '").wpgpxmaps({ jQuery( "#wpgpxmaps_' . $r . '" ).wpgpxmaps( {
targetId : "' . $r . '", targetId : "' . $r . '",
mapType : "' . $mt . '", mapType : "' . $mt . '",
mapData : [' . $points_maps . '], mapData : [' . $points_maps . '],
@ -749,7 +692,8 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
ngImages : [' . $ngImages . '], ngImages : [' . $ngImages . '],
pluginUrl : "' . plugins_url() . '", pluginUrl : "' . plugins_url() . '",
TFApiKey : "' . get_option( 'wpgpxmaps_openstreetmap_apikey' ) . '", TFApiKey : "' . get_option( 'wpgpxmaps_openstreetmap_apikey' ) . '",
langs : { altitude : "' . __( 'Altitude', 'wp-gpx-maps' ) . '", langs : {
altitude : "' . __( 'Altitude', 'wp-gpx-maps' ) . '",
currentPosition : "' . __( 'Current position', 'wp-gpx-maps' ) . '", currentPosition : "' . __( 'Current position', 'wp-gpx-maps' ) . '",
speed : "' . __( 'Speed', 'wp-gpx-maps' ) . '", speed : "' . __( 'Speed', 'wp-gpx-maps' ) . '",
grade : "' . __( 'Grade', 'wp-gpx-maps' ) . '", grade : "' . __( 'Grade', 'wp-gpx-maps' ) . '",
@ -769,43 +713,43 @@ 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'>"; $output .= "<div id='wpgpxmaps_summary_" . $r . "' class='wpgpxmaps_summary'>";
if ( $points_graph_dist != '' && $p_tot_len == 'true' ) { if ( $points_graph_dist != '' && $p_tot_len == true ) {
$output .= "<span class='totlen'><span class='summarylabel'>" . __( 'Total distance', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $tot_len</span></span><br />"; $output .= "<span class='totlen'><span class='summarylabel'>" . __( 'Total distance:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $tot_len</span></span><br />";
} }
if ( $points_graph_ele != ' ' ) { if ( $points_graph_ele != ' ' ) {
if ( $p_max_ele == 'true' ) if ( $p_max_ele == true )
$output .= "<span class='maxele'><span class='summarylabel'>" . __( 'Max elevation', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $max_ele</span></span><br />"; $output .= "<span class='maxele'><span class='summarylabel'>" . __( 'Max elevation:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $max_ele</span></span><br />";
if ( $p_min_ele == 'true' ) if ( $p_min_ele == true )
$output .= "<span class='minele'><span class='summarylabel'>" . __( 'Min elevation', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $min_ele</span></span><br />"; $output .= "<span class='minele'><span class='summarylabel'>" . __( 'Min elevation:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $min_ele</span></span><br />";
if ( $p_total_ele_up == 'true' ) if ( $p_total_ele_up == true )
$output .= "<span class='totaleleup'><span class='summarylabel'>" . __( 'Total climbing', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $total_ele_up</span></span><br />"; $output .= "<span class='totaleleup'><span class='summarylabel'>" . __( 'Total climbing:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $total_ele_up</span></span><br />";
if ( $p_total_ele_down == 'true' ) if ( $p_total_ele_down == true )
$output .= "<span class='totaleledown'><span class='summarylabel'>" . __( 'Total descent', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $total_ele_down</span></span><br />"; $output .= "<span class='totaleledown'><span class='summarylabel'>" . __( 'Total descent:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $total_ele_down</span></span><br />";
} }
if ( $points_graph_speed != '' && $p_avg_speed == 'true' ) { if ( $points_graph_speed != '' && $p_avg_speed == true ) {
$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' ) { 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 />"; $output .= "<span class='avgcad'><span class='summarylabel'>" . __( 'Average cadence:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $avg_cad</span></span><br />";
} }
if ( $points_graph_hr != '' && $p_avg_hr == 'true' ) { if ( $points_graph_hr != '' && $p_avg_hr == true ) {
$output .= "<span class='avghr'><span class='summarylabel'>" . __( 'Average heart rate', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $avg_hr</span></span><br />"; $output .= "<span class='avghr'><span class='summarylabel'>" . __( 'Average heart rate:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $avg_hr</span></span><br />";
} }
if ( $points_graph_atemp != '' && $p_avg_temp == 'true' ) { if ( $points_graph_atemp != '' && $p_avg_temp == true ) {
$output .= "<span class='avgtemp'><span class='summarylabel'>" . __( 'Average temperature', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $avg_temp</span></span><br />"; $output .= "<span class='avgtemp'><span class='summarylabel'>" . __( 'Average temperature:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $avg_temp</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 ) );
$output .= "<span class='totaltime'><span class='summarylabel'>" . __( 'Total time', 'wp-gpx-maps' ) . ":</span><span class='summaryvalue'> $time_diff</span></span><br />"; $output .= "<span class='totaltime'><span class='summarylabel'>" . __( 'Total time:', 'wp-gpx-maps' ) . "</span><span class='summaryvalue'> $time_diff</span></span><br />";
} }
$output .= "</div>"; $output .= '</div>';
} }
/* Print download link */ /* Print download link */
if ( $download == 'true' && $gpxurl != '' ) { if ( $download == true && $gpxurl != '' ) {
if ( $isGpxUrl == true ) { if ( $isGpxUrl == true ) {
} else { } else {
@ -813,24 +757,27 @@ function handle_WP_GPX_Maps_Shortcodes( $attr, $content = '' ) {
$dummy = ( defined( 'WP_SITEURL' ) ) ? WP_SITEURL : get_bloginfo( 'url' ); $dummy = ( defined( 'WP_SITEURL' ) ) ? WP_SITEURL : get_bloginfo( 'url' );
$gpxurl = $dummy . $gpxurl; $gpxurl = $dummy . $gpxurl;
} }
$output .= "<a href='$gpxurl' target='_new' download>" . __( 'Download', 'wp-gpx-maps' ) . "</a>"; $output .= "<a href='$gpxurl' target='_new' download>" . __( 'Download', 'wp-gpx-maps' ) . '</a>';
} }
return $output; return $output;
} }
function convertSeconds( $s ) { function convertSeconds( $s ) {
if ( $s == 0 ) if ( $s == 0 )
return 0; return 0;
$s = 1.0 / $s; $s = 1.0 / $s;
$_sSecT = $s * 60; // sec/km $_sSecT = $s * 60; // sec/km
$_sMin = floor ( $_sSecT / 60 ); $_sMin = floor( $_sSecT / 60 );
$_sSec = $_sSecT - $_sMin * 60; $_sSec = $_sSecT - $_sMin * 60;
return $_sMin + $_sSec / 100; return $_sMin + $_sSec / 100;
} }
function convertSpeed( $speed, $uomspeed, $addUom = false ) { function convertSpeed( $speed, $uomspeed, $addUom = false ) {
$uom = ''; $uom = '';
if ( $uomspeed == '6' ) { if ( $uomspeed == '6' ) {
/* min/100 meters */ /* min/100 meters */
$speed = 1 / $speed * 100 / 60; $speed = 1 / $speed * 100 / 60;
@ -860,6 +807,7 @@ function convertSpeed( $speed, $uomspeed, $addUom = false ) {
/* km/h */ /* km/h */
$speed *= 3.6; $speed *= 3.6;
$uom = ' km/h'; $uom = ' km/h';
} else { } else {
/* dafault m/s */ /* dafault m/s */
$uom = ' m/s'; $uom = ' m/s';
@ -873,38 +821,31 @@ function convertSpeed( $speed, $uomspeed, $addUom = false ) {
} }
function downloadRemoteFile( $remoteFile ) { function downloadRemoteFile( $remoteFile ) {
try { try {
$newfname = tempnam( '/tmp', 'gpx' ); $newfname = tempnam( '/tmp', 'gpx' );
if ( function_exists ( 'file_put_contents' ) ) { if ( function_exists( 'file_put_contents' ) ) {
file_put_contents( $newfname, fopen( $remoteFile, 'r' ) ); file_put_contents( $newfname, fopen( $remoteFile, 'r' ) );
return $newfname; return $newfname;
} }
$file = fopen( $remoteFile, 'rb' );
$file = fopen ( $remoteFile, 'rb' );
if ( $file ) { if ( $file ) {
$newf = fopen ( $newfname, 'wb' ); $newf = fopen( $newfname, 'wb' );
if ( $newf ) if ( $newf )
while ( ! feof( $file ) ) { while ( ! feof( $file ) ) {
fwrite( $newf, fread( $file, 1024 * 8 ), 1024 * 8 ); fwrite( $newf, fread( $file, 1024 * 8 ), 1024 * 8 );
} }
} }
if ( $file ) { if ( $file ) {
fclose( $file ); fclose( $file );
} }
if ( $newf ) { if ( $newf ) {
fclose( $newf ); fclose( $newf );
} }
return $newfname; return $newfname;
} catch ( Exception $e ) { } catch ( Exception $e ) {
print_r( $e ); print_r( $e );
return ''; return '';
} }
} }
@ -912,7 +853,7 @@ function downloadRemoteFile( $remoteFile ) {
function unescape( $value ) { function unescape( $value ) {
$value = str_replace( "'", "\'", $value ); $value = str_replace( "'", "\'", $value );
$value = str_replace( array( "\n", "\r" ), "", $value ); $value = str_replace( array( '\n', '\r' ), '', $value );
return $value; return $value;
} }
@ -922,10 +863,22 @@ function WP_GPX_Maps_install() {
add_option( 'wpgpxmaps_width', '100%', '', 'yes' ); add_option( 'wpgpxmaps_width', '100%', '', 'yes' );
add_option( 'wpgpxmaps_height', '450px', '', 'yes' ); add_option( 'wpgpxmaps_height', '450px', '', 'yes' );
add_option( 'wpgpxmaps_graph_height', '200px', '', 'yes' ); add_option( 'wpgpxmaps_graph_height', '200px', '', 'yes' );
add_option( 'wpgpxmaps_distance_type', '0', '', 'yes' );
add_option( 'wpgpxmaps_skipcache', '', '', 'yes' ); add_option( 'wpgpxmaps_skipcache', '', '', 'yes' );
add_option( 'wpgpxmaps_download', '', '', 'yes' ); add_option( 'wpgpxmaps_download', '', '', 'yes' );
add_option( 'wpgpxmaps_usegpsposition', '', '', 'yes' );
/* Print Summary Table */ /* Print Summary Table */
add_option( 'wpgpxmaps_summary', '', '', 'yes' ); add_option( 'wpgpxmaps_summary', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_tot_len', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_max_ele', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_min_ele', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_total_ele_up', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_total_ele_down', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_avg_speed', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_avg_cad', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_avg_hr', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_avg_temp', '', '', 'yes' );
add_option( 'wpgpxmaps_summary_total_time', '', '', 'yes' );
/* Map */ /* Map */
add_option( 'wpgpxmaps_map_type', 'HYBRID', '', 'yes' ); add_option( 'wpgpxmaps_map_type', 'HYBRID', '', 'yes' );
add_option( 'wpgpxmaps_map_line_color', '#3366cc', '', 'yes' ); add_option( 'wpgpxmaps_map_line_color', '#3366cc', '', 'yes' );
@ -933,9 +886,11 @@ function WP_GPX_Maps_install() {
add_option( 'wpgpxmaps_show_waypoint', '', '', 'yes' ); add_option( 'wpgpxmaps_show_waypoint', '', '', 'yes' );
add_option( 'wpgpxmaps_map_start_icon', '', '', 'yes' ); add_option( 'wpgpxmaps_map_start_icon', '', '', 'yes' );
add_option( 'wpgpxmaps_map_end_icon', '', '', 'yes' ); add_option( 'wpgpxmaps_map_end_icon', '', '', 'yes' );
add_option( 'wpgpxmaps_currentpositioncon', '', '', 'yes' );
add_option( 'wpgpxmaps_map_current_icon', '', '', 'yes' ); add_option( 'wpgpxmaps_map_current_icon', '', '', 'yes' );
add_option( 'wpgpxmaps_map_waypoint_icon', '', '', 'yes' ); add_option( 'wpgpxmaps_map_waypoint_icon', '', '', 'yes' );
/* Diagram - Elevation */ /* Diagram - Elevation */
add_option( 'wpgpxmaps_show_elevation', 'true', '', 'yes' );
add_option( 'wpgpxmaps_graph_line_color', '#3366cc', '', 'yes' ); add_option( 'wpgpxmaps_graph_line_color', '#3366cc', '', 'yes' );
add_option( 'wpgpxmaps_unit_of_measure', '0', '', 'yes' ); add_option( 'wpgpxmaps_unit_of_measure', '0', '', 'yes' );
add_option( 'wpgpxmaps_graph_offset_from1', '', '', 'yes' ); add_option( 'wpgpxmaps_graph_offset_from1', '', '', 'yes' );
@ -956,7 +911,8 @@ function WP_GPX_Maps_install() {
add_option( 'wpgpxmaps_show_cadence', '', '', 'yes' ); add_option( 'wpgpxmaps_show_cadence', '', '', 'yes' );
add_option( 'wpgpxmaps_graph_line_color_cad', '#beecff', '', 'yes' ); add_option( 'wpgpxmaps_graph_line_color_cad', '#beecff', '', 'yes' );
/* Diagram - Grade */ /* Diagram - Grade */
add_option( 'wpgpxmaps_show_grade', '', '', 'yes' );
add_option( 'wpgpxmaps_graph_line_color_grade', '#beecff', '', 'yes' );
/* Pictures */ /* Pictures */
add_option( 'wpgpxmaps_map_nggallery', '', '', 'yes' ); add_option( 'wpgpxmaps_map_nggallery', '', '', 'yes' );
/* Advanced */ /* Advanced */
@ -970,10 +926,22 @@ function WP_GPX_Maps_remove() {
delete_option( 'wpgpxmaps_width' ); delete_option( 'wpgpxmaps_width' );
delete_option( 'wpgpxmaps_graph_height' ); delete_option( 'wpgpxmaps_graph_height' );
delete_option( 'wpgpxmaps_height' ); delete_option( 'wpgpxmaps_height' );
delete_option( 'wpgpxmaps_distance_type' );
delete_option( 'wpgpxmaps_skipcache' ); delete_option( 'wpgpxmaps_skipcache' );
delete_option( 'wpgpxmaps_download' ); delete_option( 'wpgpxmaps_download' );
delete_option( 'wpgpxmaps_usegpsposition' );
/* Print Summary Table */ /* Print Summary Table */
delete_option( 'wpgpxmaps_summary' ); delete_option( 'wpgpxmaps_summary' );
delete_option( 'wpgpxmaps_summary_tot_len' );
delete_option( 'wpgpxmaps_summary_max_ele' );
delete_option( 'wpgpxmaps_summary_min_ele' );
delete_option( 'wpgpxmaps_summary_total_ele_up' );
delete_option( 'wpgpxmaps_summary_total_ele_down' );
delete_option( 'wpgpxmaps_summary_avg_speed' );
delete_option( 'wpgpxmaps_summary_avg_cad' );
delete_option( 'wpgpxmaps_summary_avg_hr' );
delete_option( 'wpgpxmaps_summary_avg_temp' );
delete_option( 'wpgpxmaps_summary_total_time' );
/* Map */ /* Map */
delete_option( 'wpgpxmaps_map_type' ); delete_option( 'wpgpxmaps_map_type' );
delete_option( 'wpgpxmaps_map_line_color' ); delete_option( 'wpgpxmaps_map_line_color' );
@ -981,9 +949,11 @@ function WP_GPX_Maps_remove() {
delete_option( 'wpgpxmaps_show_waypoint' ); delete_option( 'wpgpxmaps_show_waypoint' );
delete_option( 'wpgpxmaps_map_start_icon' ); delete_option( 'wpgpxmaps_map_start_icon' );
delete_option( 'wpgpxmaps_map_end_icon' ); delete_option( 'wpgpxmaps_map_end_icon' );
delete_option( 'wpgpxmaps_currentpositioncon' );
delete_option( 'wpgpxmaps_map_current_icon' ); delete_option( 'wpgpxmaps_map_current_icon' );
delete_option( 'wpgpxmaps_map_waypoint_icon' ); delete_option( 'wpgpxmaps_map_waypoint_icon' );
/* Diagram - Elevation */ /* Diagram - Elevation */
delete_option( 'wpgpxmaps_show_elevation' );
delete_option( 'wpgpxmaps_graph_line_color' ); delete_option( 'wpgpxmaps_graph_line_color' );
delete_option( 'wpgpxmaps_unit_of_measure' ); delete_option( 'wpgpxmaps_unit_of_measure' );
delete_option( 'wpgpxmaps_graph_offset_from1' ); delete_option( 'wpgpxmaps_graph_offset_from1' );
@ -1004,12 +974,11 @@ function WP_GPX_Maps_remove() {
delete_option( 'wpgpxmaps_show_cadence' ); delete_option( 'wpgpxmaps_show_cadence' );
delete_option( 'wpgpxmaps_graph_line_color_cad' ); delete_option( 'wpgpxmaps_graph_line_color_cad' );
/* Diagram - Grade */ /* Diagram - Grade */
delete_option( 'wpgpxmaps_show_grade' );
delete_option( 'wpgpxmaps_graph_line_color_grade' );
/* Pictures */ /* Pictures */
delete_option( 'wpgpxmaps_map_nggallery' ); delete_option( 'wpgpxmaps_map_nggallery' );
/* Advanced */ /* Advanced */
delete_option( 'wpgpxmaps_pointsoffset' ); delete_option( 'wpgpxmaps_pointsoffset' );
delete_option( 'wpgpxmaps_donotreducegpx' ); delete_option( 'wpgpxmaps_donotreducegpx' );
} }
?>

View File

@ -1,57 +1,53 @@
<?php <?php
if ( is_admin() ) { if ( is_admin() ) {
add_action( 'admin_menu', 'wpgpxmaps_admin_menu' ); add_action( 'admin_menu', 'wpgpxmaps_admin_menu' );
} }
/**
* Roles and capabilities
*
* Capabilities for each user role that are relevant to this plugin:
*
* Super Admin: can manage settings; can publish, edit and delete all posts; can upload and delete all GPX files
* Admin: can manage settings; can publish, edit and delete all posts; can upload and delete all GPX files
* Editor: can not manage settings; can publish, edit and delete all posts; can upload and delete all GPX files
* Author: can not manage settings; can publish, edit and delete his own posts; can upload and delete his own files
* Contributor: can not manage settings; can edit and delete his own posts; can not manage GPX files
* Subscriber: can not manage settings; can not manage posts; can not manage GPX files (has read status everywhere)
*
* @see https://wordpress.org/support/article/roles-and-capabilities/
*/
function wpgpxmaps_admin_menu() { function wpgpxmaps_admin_menu() {
/*
All roles/capabilities:
https://wordpress.org/support/article/roles-and-capabilities/
*/
if ( current_user_can( 'manage_options' ) ) { if ( current_user_can( 'manage_options' ) ) {
/* Only Administrators and Super Administrators */ /* Access only for Super Administrators and Administrators */
add_options_page( 'WP GPX Maps', 'WP GPX Maps', 'manage_options', 'WP-GPX-Maps', 'WP_GPX_Maps_html_page' ); add_options_page( 'WP GPX Maps', 'WP GPX Maps', 'manage_options', 'WP-GPX-Maps', 'WP_GPX_Maps_html_page' );
} } elseif ( current_user_can( 'publish_posts' ) ) {
elseif ( current_user_can( 'publish_posts' ) ) { /* Access for Editors and Authors */
/* Contributor Authors and */ /* Contributor Authors and */
$allow_users_upload = get_option( 'wpgpxmaps_allow_users_view' ) === 'true';
$allow_users_upload = get_option( 'wpgpxmaps_allow_users_view' ) === "true"; if ( $allow_users_upload == 1 ) {
if ($allow_users_upload == 1)
{
add_menu_page( 'WP GPX Maps', 'WP GPX Maps', 'publish_posts', 'WP-GPX-Maps', 'WP_GPX_Maps_html_page' ); add_menu_page( 'WP GPX Maps', 'WP GPX Maps', 'publish_posts', 'WP-GPX-Maps', 'WP_GPX_Maps_html_page' );
} }
} }
} }
function wpgpxmaps_ilc_admin_tabs( $current ) { function wpgpxmaps_ilc_admin_tabs( $current ) {
if ( current_user_can( 'manage_options' ) ) { if ( current_user_can( 'manage_options' ) ) {
/* Access for Super Administrators and Administrators */
$tabs = array( $tabs = array(
'tracks' => __( 'Tracks', 'wp-gpx-maps' ), 'tracks' => __( 'Tracks', 'wp-gpx-maps' ),
'settings' => __( 'Settings', 'wp-gpx-maps' ), 'settings' => __( 'Settings', 'wp-gpx-maps' ),
'help' => __( 'Help', 'wp-gpx-maps' ), 'help' => __( 'Help', 'wp-gpx-maps' ),
); );
} elseif ( current_user_can( 'publish_posts' ) ) {
} elseif ( current_user_can( 'publish_posts' ) ) {
/* Access for Editors and Authors */
$tabs = array( $tabs = array(
'tracks' => __( 'Tracks', 'wp-gpx-maps' ), 'tracks' => __( 'Tracks', 'wp-gpx-maps' ),
'help' => __( 'Help', 'wp-gpx-maps' ), 'help' => __( 'Help', 'wp-gpx-maps' ),
@ -61,54 +57,40 @@ function wpgpxmaps_ilc_admin_tabs( $current ) {
echo '<h2 class="nav-tab-wrapper">'; echo '<h2 class="nav-tab-wrapper">';
foreach ( $tabs as $tab => $name ) { foreach ( $tabs as $tab => $name ) {
$class = ( $tab == $current ) ? ' nav-tab-active' : ''; $class = ( $tab == $current ) ? ' nav-tab-active' : '';
echo "<a class='nav-tab$class' href='?page=WP-GPX-Maps&tab=$tab'>$name</a>"; echo "<a class='nav-tab$class' href='?page=WP-GPX-Maps&tab=$tab'>$name</a>";
} }
echo '</h2>'; echo '</h2>';
} }
function WP_GPX_Maps_html_page() { function WP_GPX_Maps_html_page() {
$realGpxPath = gpxFolderPath(); $realGpxPath = gpxFolderPath();
$cacheGpxPath = gpxCacheFolderPath(); $cacheGpxPath = gpxCacheFolderPath();
$relativeGpxPath = relativeGpxFolderPath(); $relativeGpxPath = relativeGpxFolderPath();
$relativeGpxPath = str_replace( '\\', '/', $relativeGpxPath );
$relativeGpxPath = str_replace( "\\","/", $relativeGpxPath );
$relativeGpxCachePath = relativeGpxCacheFolderPath(); $relativeGpxCachePath = relativeGpxCacheFolderPath();
$relativeGpxCachePath = str_replace( '\\', '/', $relativeGpxCachePath );
$relativeGpxCachePath = str_replace( "\\","/", $relativeGpxCachePath );
$tab = $_GET['tab']; $tab = $_GET['tab'];
if ( $tab == '' ) if ( $tab == '' )
$tab = 'tracks'; $tab = 'tracks';
?> ?>
<div id="icon-themes" class="icon32"><br></div> <div id="icon-themes" class="icon32"><br></div>
<h2><?php _e( 'Settings', 'wp-gpx-maps' ); ?></h2> <h2>
<?php _e( 'Settings', 'wp-gpx-maps' ); ?>
</h2>
<?php <?php
if ( file_exists( $realGpxPath ) && is_dir( $realGpxPath ) ) { if ( file_exists( $realGpxPath ) && is_dir( $realGpxPath ) ) {
/* Directory exist! */ /* Directory exist! */
} else { } else {
if ( ! @mkdir( $realGpxPath, 0755, true ) ) { if ( ! @mkdir( $realGpxPath, 0755, true ) ) {
echo '<div class=" notice notice-error"><p>'; echo '<div class=" notice notice-error"><p>';
printf( printf(
@ -119,13 +101,11 @@ function WP_GPX_Maps_html_page() {
echo '</p></div>'; echo '</p></div>';
} }
} }
if ( file_exists( $cacheGpxPath ) && is_dir( $cacheGpxPath ) ) { if ( file_exists( $cacheGpxPath ) && is_dir( $cacheGpxPath ) ) {
/* Directory exist! */ /* Directory exist! */
} else { } else {
if ( ! @mkdir( $cacheGpxPath, 0755, true ) ) { if ( ! @mkdir( $cacheGpxPath, 0755, true ) ) {
echo '<div class=" notice notice-error"><p>'; echo '<div class=" notice notice-error"><p>';
printf( printf(

View File

@ -96,9 +96,15 @@
</th> </th>
<td> <td>
<select name='wpgpxmaps_distance_type'> <select name='wpgpxmaps_distance_type'>
<option value="0" <?php if ( $distanceType == '0' || $distanceType == '' ) echo 'selected'; ?>><?php _e( 'Normal (default)', 'wp-gpx-maps' ); ?></option> <option value="0" <?php if ( $distanceType == '0' || $distanceType == '' ) echo 'selected'; ?>>
<option value="1" <?php if ( $distanceType == '1' ) echo 'selected'; ?>><?php _e( 'Flat &#8594; (Only flat distance, don&#8217;t take care of altitude)', 'wp-gpx-maps' ); ?></option> <?php _e( 'Normal (default)', 'wp-gpx-maps' ); ?>
<option value="2" <?php if ( $distanceType == '2' ) echo 'selected'; ?>><?php _e( 'Climb &#8593; (Only climb distance)', 'wp-gpx-maps' ); ?></option> </option>
<option value="1" <?php if ( $distanceType == '1' ) echo 'selected'; ?>>
<?php _e( 'Flat &#8594; (Only flat distance, don&#8217;t take care of altitude)', 'wp-gpx-maps' ); ?>
</option>
<option value="2" <?php if ( $distanceType == '2' ) echo 'selected'; ?>>
<?php _e( 'Climb &#8593; (Only climb distance)', 'wp-gpx-maps' ); ?>
</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -110,10 +116,7 @@
<td> <td>
<input name="wpgpxmaps_skipcache" type="checkbox" value="true" <?php if ( $skipcache == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_skipcache" type="checkbox" value="true" <?php if ( $skipcache == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Do not use cache', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Do not use cache', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -125,10 +128,7 @@
<td> <td>
<input name="wpgpxmaps_download" type="checkbox" value="true" <?php if ( $download == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_download" type="checkbox" value="true" <?php if ( $download == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Allow users to download your GPX file', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Allow users to download your GPX file', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -140,10 +140,7 @@
<td> <td>
<input name="wpgpxmaps_usegpsposition" type="checkbox" value="true" <?php if ( $usegpsposition == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_usegpsposition" type="checkbox" value="true" <?php if ( $usegpsposition == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Allow users to use browser GPS in order to display their current position on map', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Allow users to use browser GPS in order to display their current position on map', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -194,10 +191,7 @@
<td> <td>
<input name="wpgpxmaps_summary" type="checkbox" value="true" <?php if ( $summary == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary" type="checkbox" value="true" <?php if ( $summary == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print summary details of your GPX track', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print summary details of your GPX track', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -209,10 +203,7 @@
<td> <td>
<input name="wpgpxmaps_summary_tot_len" type="checkbox" value="true" <?php if ( $tot_len == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_tot_len" type="checkbox" value="true" <?php if ( $tot_len == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print total distance', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print total distance', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -224,10 +215,7 @@
<td> <td>
<input name="wpgpxmaps_summary_max_ele" type="checkbox" value="true" <?php if ( $max_ele == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_max_ele" type="checkbox" value="true" <?php if ( $max_ele == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print max elevation', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print max elevation', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -239,10 +227,7 @@
<td> <td>
<input name="wpgpxmaps_summary_min_ele" type="checkbox" value="true" <?php if ( $min_ele == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_min_ele" type="checkbox" value="true" <?php if ( $min_ele == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print min elevation', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print min elevation', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -254,10 +239,7 @@
<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)" /> <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> <i>
<?php <?php _e( 'Print total climbing', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print total climbing', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -269,10 +251,7 @@
<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)" /> <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> <i>
<?php <?php _e( 'Print total descent', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print total descent', 'wp-gpx-maps' );
?>
</i> </i>
</tr> </tr>
@ -283,10 +262,7 @@
<td> <td>
<input name="wpgpxmaps_summary_avg_speed" type="checkbox" value="true" <?php if ( $avg_speed == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_avg_speed" type="checkbox" value="true" <?php if ( $avg_speed == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print average speed', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print average speed', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -298,10 +274,7 @@
<td> <td>
<input name="wpgpxmaps_summary_avg_cad" type="checkbox" value="true" <?php if ( $avg_cad == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_avg_cad" type="checkbox" value="true" <?php if ( $avg_cad == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print average cadence', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print average cadence', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -313,10 +286,7 @@
<td> <td>
<input name="wpgpxmaps_summary_avg_hr" type="checkbox" value="true" <?php if ( $avg_hr == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_avg_hr" type="checkbox" value="true" <?php if ( $avg_hr == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print average heart rate', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print average heart rate', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -328,10 +298,7 @@
<td> <td>
<input name="wpgpxmaps_summary_avg_temp" type="checkbox" value="true" <?php if ( $avg_temp == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_avg_temp" type="checkbox" value="true" <?php if ( $avg_temp == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print average temperature', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print average temperature', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -343,10 +310,7 @@
<td> <td>
<input name="wpgpxmaps_summary_total_time" type="checkbox" value="true" <?php if ( $total_time == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_summary_total_time" type="checkbox" value="true" <?php if ( $total_time == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Print total time', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Print total time', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -379,49 +343,49 @@
<td> <td>
<input type="radio" name="wpgpxmaps_map_type" value="OSM1" <?php if ( $t == 'OSM1' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM1" <?php if ( $t == 'OSM1' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map type */
_e( 'Open Street Map', 'wp-gpx-maps' ); _e( 'Open Street Map', 'wp-gpx-maps' );
?> ?>
<br /> <br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM2" <?php if ( $t == 'OSM2' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM2" <?php if ( $t == 'OSM2' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map provider / map type */
_e( 'Open Cycle Map', 'wp-gpx-maps' ); _e( 'Open Cycle Map', 'wp-gpx-maps' );
?> ?>
<br /> <br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM4" <?php if ( $t == 'OSM4' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM4" <?php if ( $t == 'OSM4' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map provider / map type */
_e( 'Open Cycle Map - Transport', 'wp-gpx-maps' ); _e( 'Open Cycle Map - Transport', 'wp-gpx-maps' );
?> ?>
<br /> <br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM5" <?php if ( $t == 'OSM5' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM5" <?php if ( $t == 'OSM5' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map provider / map type */
_e( 'Open Cycle Map - Landscape', 'wp-gpx-maps' ); _e( 'Open Cycle Map - Landscape', 'wp-gpx-maps' );
?> ?>
<br /> <br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM6" <?php if ( $t == 'OSM6' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM6" <?php if ( $t == 'OSM6' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map provider / map type */
_e( 'MapToolKit - Terrain', 'wp-gpx-maps' ); _e( 'MapToolKit - Terrain', 'wp-gpx-maps' );
?> ?>
<br /> <br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM7" <?php if ( $t == 'OSM7' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM7" <?php if ( $t == 'OSM7' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map provider / map type */
_e( 'Open Street Map - Humanitarian map style', 'wp-gpx-maps' ); _e( 'Open Street Map - Humanitarian map style', 'wp-gpx-maps' );
?> ?>
<br /> <br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM9" <?php if ( $t == 'OSM9' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM9" <?php if ( $t == 'OSM9' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map provider / map type */
_e( 'Hike & Bike', 'wp-gpx-maps' ); _e( 'Hike & Bike', 'wp-gpx-maps' );
?> ?>
<br /> <br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM10" <?php if ( $t == 'OSM10' ) echo 'checked'; ?>> <input type="radio" name="wpgpxmaps_map_type" value="OSM10" <?php if ( $t == 'OSM10' ) echo 'checked'; ?>>
<?php <?php
echo ' '; /* translators: map provider / map type */
_e( 'Open Sea Map', 'wp-gpx-maps' ); _e( 'Open Sea Map', 'wp-gpx-maps' );
?> ?>
<br /> <br />
@ -444,10 +408,7 @@
<td> <td>
<input name="wpgpxmaps_zoomonscrollwheel" type="checkbox" value="true" <?php if ( $zoomonscrollwheel == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_zoomonscrollwheel" type="checkbox" value="true" <?php if ( $zoomonscrollwheel == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Enable zoom', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Enable zoom', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -459,10 +420,7 @@
<td> <td>
<input name="wpgpxmaps_show_waypoint" type="checkbox" value="true" <?php if ( $showW == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_show_waypoint" type="checkbox" value="true" <?php if ( $showW == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Show waypoints', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Show waypoints', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -472,7 +430,7 @@
<?php _e( 'Start track icon:', 'wp-gpx-maps' ); ?> <?php _e( 'Start track icon:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input name="wpgpxmaps_map_start_icon" value="<?php echo get_option( 'wpgpxmaps_map_start_icon' ); ?>" style="width:400px" /> <input name="wpgpxmaps_map_start_icon" type="text" value="<?php echo get_option( 'wpgpxmaps_map_start_icon' ); ?>" style="width:400px" />
<em> <em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?> <?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em> </em>
@ -484,7 +442,7 @@
<?php _e( 'End track icon:', 'wp-gpx-maps' ); ?> <?php _e( 'End track icon:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input name="wpgpxmaps_map_end_icon" value="<?php echo get_option( 'wpgpxmaps_map_end_icon' ); ?>" style="width:400px" /> <input name="wpgpxmaps_map_end_icon" type="text" value="<?php echo get_option( 'wpgpxmaps_map_end_icon' ); ?>" style="width:400px" />
<em> <em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?> <?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em> </em>
@ -496,7 +454,7 @@
<?php _e( 'Current position icon:', 'wp-gpx-maps' ); ?> <?php _e( 'Current position icon:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input name="wpgpxmaps_map_current_icon" value="<?php echo get_option( 'wpgpxmaps_map_current_icon' ); ?>" style="width:400px" /> <input name="wpgpxmaps_map_current_icon" type="text" value="<?php echo get_option( 'wpgpxmaps_map_current_icon' ); ?>" style="width:400px" />
<em> <em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?> <?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em> </em>
@ -508,7 +466,7 @@
<?php _e( 'Current GPS position icon:', 'wp-gpx-maps' ); ?> <?php _e( 'Current GPS position icon:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input name="wpgpxmaps_currentpositioncon" value="<?php echo get_option( 'wpgpxmaps_currentpositioncon' ); ?>" style="width:400px" /> <input name="wpgpxmaps_currentpositioncon" type="text" value="<?php echo get_option( 'wpgpxmaps_currentpositioncon' ); ?>" style="width:400px" />
<em> <em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?> <?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em> </em>
@ -520,7 +478,7 @@
<?php _e( 'Custom waypoint icon:', 'wp-gpx-maps' ); ?> <?php _e( 'Custom waypoint icon:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input name="wpgpxmaps_map_waypoint_icon" value="<?php echo get_option( 'wpgpxmaps_map_waypoint_icon' ); ?>" style="width:400px" /> <input name="wpgpxmaps_map_waypoint_icon" type="text" value="<?php echo get_option( 'wpgpxmaps_map_waypoint_icon' ); ?>" style="width:400px" />
<em> <em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?> <?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em> </em>
@ -553,12 +511,9 @@
<?php _e( 'Altitude:', 'wp-gpx-maps' ); ?> <?php _e( 'Altitude:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input type="checkbox" <?php if ( $showEle == true ){ echo( 'checked' ); } ?> onchange="wpgpxmaps_show_elevation.value = this.checked" onload="wpgpxmaps_show_elevation.value = this.checked" /> <input type="checkbox" <?php if ( $showEle == true ) { echo( 'checked' ); } ?> onchange="wpgpxmaps_show_elevation.value = this.checked" onload="wpgpxmaps_show_elevation.value = this.checked" />
<i> <i>
<?php <?php _e( 'Show altitude', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Show altitude', 'wp-gpx-maps' );
?>
</i> </i>
<input name="wpgpxmaps_show_elevation" type="hidden" value="<?php echo $showEle; ?>"> <input name="wpgpxmaps_show_elevation" type="hidden" value="<?php echo $showEle; ?>">
</td> </td>
@ -579,12 +534,42 @@
</th> </th>
<td> <td>
<select name='wpgpxmaps_unit_of_measure'> <select name='wpgpxmaps_unit_of_measure'>
<option value="0" <?php if ( $uom == '0' ) echo 'selected'; ?>><?php _e( 'meters / meters', 'wp-gpx-maps' ); ?></option> <option value="0" <?php if ( $uom == '0' ) echo 'selected'; ?>>
<option value="1" <?php if ( $uom == '1' ) echo 'selected'; ?>><?php _e( 'feet / miles', 'wp-gpx-maps' ); ?></option> <?php
<option value="2" <?php if ( $uom == '2' ) echo 'selected'; ?>><?php _e( 'meters / kilometers', 'wp-gpx-maps' ); ?></option> /* translators: chart axis labels */
<option value="3" <?php if ( $uom == '3' ) echo 'selected'; ?>><?php _e( 'meters / nautical miles', 'wp-gpx-maps' ); ?></option> _e( 'meters / meters', 'wp-gpx-maps' );
<option value="4" <?php if ( $uom == '4' ) echo 'selected'; ?>><?php _e( 'meters / miles', 'wp-gpx-maps' ); ?></option> ?>
<option value="5" <?php if ( $uom == '5' ) echo 'selected'; ?>><?php _e( 'feet / nautical miles', 'wp-gpx-maps' ); ?></option> </option>
<option value="1" <?php if ( $uom == '1' ) echo 'selected'; ?>>
<?php
/* translators: chart axis labels */
_e( 'feet / miles', 'wp-gpx-maps' );
?>
</option>
<option value="2" <?php if ( $uom == '2' ) echo 'selected'; ?>>
<?php
/* translators: chart axis labels */
_e( 'meters / kilometers', 'wp-gpx-maps' );
?>
</option>
<option value="3" <?php if ( $uom == '3' ) echo 'selected'; ?>>
<?php
/* translators: chart axis labels */
_e( 'meters / nautical miles', 'wp-gpx-maps' );
?>
</option>
<option value="4" <?php if ( $uom == '4' ) echo 'selected'; ?>>
<?php
/* translators: chart axis labels */
_e( 'meters / miles', 'wp-gpx-maps' );
?>
</option>
<option value="5" <?php if ( $uom == '5' ) echo 'selected'; ?>>
<?php
/* translators: chart axis labels */
_e( 'feet / nautical miles', 'wp-gpx-maps' );
?>
</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -595,10 +580,12 @@
</th> </th>
<td> <td>
<?php _e( 'From', 'wp-gpx-maps' ); ?> <?php _e( 'From', 'wp-gpx-maps' ); ?>
<input name="wpgpxmaps_graph_offset_from1" value="<?php echo get_option( 'wpgpxmaps_graph_offset_from1' ); ?>" style="width:50px;" /> <input name="wpgpxmaps_graph_offset_from1" type="text" value="<?php echo get_option( 'wpgpxmaps_graph_offset_from1' ); ?>" style="width:50px;" />
<?php _e( 'to', 'wp-gpx-maps' ); ?> <?php _e( 'to', 'wp-gpx-maps' ); ?>
<input name="wpgpxmaps_graph_offset_to1" value="<?php echo get_option( 'wpgpxmaps_graph_offset_to1' ); ?>" style="width:50px;" /> <input name="wpgpxmaps_graph_offset_to1" type="text" value="<?php echo get_option( 'wpgpxmaps_graph_offset_to1' ); ?>" style="width:50px;" />
<em><?php _e( '(leave empty for auto scale)', 'wp-gpx-maps' ); ?></em> <em>
<?php _e( '(leave empty for auto scale)', 'wp-gpx-maps' ); ?>
</em>
</td> </td>
</tr> </tr>
@ -607,7 +594,10 @@
<?php _e( 'Speed:', 'wp-gpx-maps' ); ?> <?php _e( 'Speed:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input name="wpgpxmaps_show_speed" type="checkbox" value="true" <?php if ( $showSpeed == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /><i><?php echo ' ' ; _e( 'Show speed', 'wp-gpx-maps' ); ?></i> <input name="wpgpxmaps_show_speed" type="checkbox" value="true" <?php if ( $showSpeed == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php _e( 'Show speed', 'wp-gpx-maps' ); ?>
</i>
</td> </td>
</tr> </tr>
@ -626,13 +616,48 @@
</th> </th>
<td> <td>
<select name='wpgpxmaps_unit_of_measure_speed'> <select name='wpgpxmaps_unit_of_measure_speed'>
<option value="0" <?php if ( $uomSpeed == '0' ) echo 'selected'; ?>><?php _e( 'm/s', 'wp-gpx-maps' ); ?></option> <option value="0" <?php if ( $uomSpeed == '0' ) echo 'selected'; ?>>
<option value="1" <?php if ( $uomSpeed == '1' ) echo 'selected'; ?>><?php _e( 'km/h', 'wp-gpx-maps' ); ?></option> <?php
<option value="2" <?php if ( $uomSpeed == '2' ) echo 'selected'; ?>><?php _e( 'miles/h', 'wp-gpx-maps' ); ?></option> /* translators: speed unit of measure */
<option value="3" <?php if ( $uomSpeed == '3' ) echo 'selected'; ?>><?php _e( 'min/km', 'wp-gpx-maps' ); ?></option> _e( 'm/s', 'wp-gpx-maps' );
<option value="4" <?php if ( $uomSpeed == '4' ) echo 'selected'; ?>><?php _e( 'min/miles', 'wp-gpx-maps' ); ?></option> ?>
<option value="5" <?php if ( $uomSpeed == '5' ) echo 'selected'; ?>><?php _e( 'Knots (nautical miles / hour)', 'wp-gpx-maps' ); ?></option> </option>
<option value="6" <?php if ( $uomSpeed == '6' ) echo 'selected'; ?>><?php _e( 'min/100 meters', 'wp-gpx-maps' ); ?></option> <option value="1" <?php if ( $uomSpeed == '1' ) echo 'selected'; ?>>
<?php
/* translators: speed unit of measure */
_e( 'km/h', 'wp-gpx-maps' );
?>
</option>
<option value="2" <?php if ( $uomSpeed == '2' ) echo 'selected'; ?>>
<?php
/* translators: speed unit of measure */
_e( 'miles/h', 'wp-gpx-maps' );
?>
</option>
<option value="3" <?php if ( $uomSpeed == '3' ) echo 'selected'; ?>>
<?php
/* translators: speed unit of measure */
_e( 'min/km', 'wp-gpx-maps' );
?>
</option>
<option value="4" <?php if ( $uomSpeed == '4' ) echo 'selected'; ?>>
<?php
/* translators: speed unit of measure */
_e( 'min/miles', 'wp-gpx-maps' );
?>
</option>
<option value="5" <?php if ( $uomSpeed == '5' ) echo 'selected'; ?>>
<?php
/* translators: speed unit of measure */
_e( 'Knots (nautical miles / hour)', 'wp-gpx-maps' );
?>
</option>
<option value="6" <?php if ( $uomSpeed == '6' ) echo 'selected'; ?>>
<?php
/* translators: speed unit of measure */
_e( 'min/100 meters', 'wp-gpx-maps' );
?>
</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -643,10 +668,12 @@
</th> </th>
<td> <td>
<?php _e( 'From', 'wp-gpx-maps' ); ?> <?php _e( 'From', 'wp-gpx-maps' ); ?>
<input name="wpgpxmaps_graph_offset_from2" value="<?php echo get_option( 'wpgpxmaps_graph_offset_from2' ); ?>" style="width:50px;" /> <input name="wpgpxmaps_graph_offset_from2" type="text" value="<?php echo get_option( 'wpgpxmaps_graph_offset_from2' ); ?>" style="width:50px;" />
<?php _e( 'to', 'wp-gpx-maps' ); ?> <?php _e( 'to', 'wp-gpx-maps' ); ?>
<input name="wpgpxmaps_graph_offset_to2" value="<?php echo get_option( 'wpgpxmaps_graph_offset_to2' ); ?>" style="width:50px;" /> <input name="wpgpxmaps_graph_offset_to2" type="text" value="<?php echo get_option( 'wpgpxmaps_graph_offset_to2' ); ?>" style="width:50px;" />
<em><?php _e( '(leave empty for auto scale)', 'wp-gpx-maps' ); ?></em> <em>
<?php _e( '(leave empty for auto scale)', 'wp-gpx-maps' ); ?>
</em>
</td> </td>
</tr> </tr>
@ -657,10 +684,7 @@
<td> <td>
<input name="wpgpxmaps_show_hr" type="checkbox" value="true" <?php if ( $showHr == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_show_hr" type="checkbox" value="true" <?php if ( $showHr == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Show heart rate', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Show heart rate', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -681,10 +705,7 @@
<td> <td>
<input name="wpgpxmaps_show_atemp" type="checkbox" value="true" <?php if ( $showAtemp == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_show_atemp" type="checkbox" value="true" <?php if ( $showAtemp == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Show temperature', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Show temperature', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -705,10 +726,7 @@
<td> <td>
<input name="wpgpxmaps_show_cadence" type="checkbox" value="true" <?php if ( $showCad == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_show_cadence" type="checkbox" value="true" <?php if ( $showCad == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Show cadence', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Show cadence', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -729,10 +747,7 @@
<td> <td>
<input name="wpgpxmaps_show_grade" type="checkbox" value="true" <?php if ( $showGrade == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_show_grade" type="checkbox" value="true" <?php if ( $showGrade == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Show grade - BETA (Grade values depends on your GPS accuracy. If you have a poor GPS accuracy they might be totally wrong!)', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Show grade - BETA (Grade values depends on your GPS accuracy. If you have a poor GPS accuracy they might be totally wrong!)', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -777,10 +792,7 @@
<td> <td>
<input name="wpgpxmaps_pointsoffset" type="text" id="wpgpxmaps_pointsoffset" value="<?php echo $po ?>" style="width:50px;" /> <input name="wpgpxmaps_pointsoffset" type="text" id="wpgpxmaps_pointsoffset" value="<?php echo $po ?>" style="width:50px;" />
<i> <i>
<?php <?php _e( 'meters', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'meters', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -792,10 +804,7 @@
<td> <td>
<input name="wpgpxmaps_donotreducegpx" type="checkbox" value="true" <?php if ( $donotreducegpx == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <input name="wpgpxmaps_donotreducegpx" type="checkbox" value="true" <?php if ( $donotreducegpx == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i> <i>
<?php <?php _e( 'Do not reduce GPX', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Do not reduce GPX', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>
@ -805,12 +814,9 @@
<?php _e( 'User upload:', 'wp-gpx-maps' ); ?> <?php _e( 'User upload:', 'wp-gpx-maps' ); ?>
</th> </th>
<td> <td>
<input name="wpgpxmaps_allow_users_view" type="checkbox" value="true" onchange="this.value = (this.checked)" <?php if ( $allow_users_upload === "true" ) { echo( 'checked' ); } ?>> <input name="wpgpxmaps_allow_users_view" type="checkbox" value="true" onchange="this.value = (this.checked)" <?php if ( $allow_users_upload === "true" ) { echo( 'checked' ); } ?> />
<i> <i>
<?php <?php _e( 'Allow registered user to upload GPX files', 'wp-gpx-maps' ); ?>
echo ' ';
_e( 'Allow registered user to upload GPX files', 'wp-gpx-maps' );
?>
</i> </i>
</td> </td>
</tr> </tr>

View File

@ -8,10 +8,8 @@ $is_admin = current_user_can( 'publish_posts' );
if ( $is_admin != 1 ) if ( $is_admin != 1 )
return; return;
$allow_users_upload = get_option( 'wpgpxmaps_allow_users_view' ) === "true"; $allow_users_upload = get_option( 'wpgpxmaps_allow_users_view' ) === 'true';
$wpgpxmapsUrl = get_admin_url() . 'admin.php?page=WP-GPX-Maps';
$wpgpxmapsUrl = get_admin_url() . "admin.php?page=WP-GPX-Maps";
$gpxRegEx = '/.gpx$/i'; $gpxRegEx = '/.gpx$/i';
if ( current_user_can( 'manage_options' ) ) { if ( current_user_can( 'manage_options' ) ) {
@ -21,21 +19,15 @@ if ( current_user_can( 'manage_options' ) ) {
} }
if ( isset( $_POST['clearcache'] ) ) { if ( isset( $_POST['clearcache'] ) ) {
if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_clearcache_nonce' . $entry ) ) {
if ( isset( $_GET['_wpnonce'] )
&&
wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_clearcache_nonce' . $entry )
) {
echo '<div class="notice notice-success"><p>'; echo '<div class="notice notice-success"><p>';
_e( 'Cache is now empty!', 'wp-gpx-maps' ); _e( 'Cache is now empty!', 'wp-gpx-maps' );
echo '</p></div>'; echo '</p></div>';
wpgpxmaps_recursive_remove_directory( $cacheGpxPath, true ); wpgpxmaps_recursive_remove_directory( $cacheGpxPath, true );
} }
} }
if ( is_writable( $realGpxPath ) ) { if ( is_writable( $realGpxPath ) ) {
?> ?>
<div class="tablenav top"> <div class="tablenav top">
@ -48,7 +40,7 @@ if ( is_writable( $realGpxPath ) ) {
$total = count( $_FILES['uploadedfile']['name'] ); $total = count( $_FILES['uploadedfile']['name'] );
for ( $i = 0; $i < $total; $i++ ) { for ( $i = 0; $i < $total; $i++ ) {
$uploadingFileName = basename( $_FILES['uploadedfile']['name'][$i] ); $uploadingFileName = basename( $_FILES['uploadedfile']['name'][$i] );
$target_path = $realGpxPath . "/" . $uploadingFileName; $target_path = $realGpxPath . '/' . $uploadingFileName;
if ( preg_match( $gpxRegEx, $target_path ) ) { if ( preg_match( $gpxRegEx, $target_path ) ) {
if ( move_uploaded_file( $_FILES['uploadedfile']['tmp_name'][$i], $target_path ) ) { if ( move_uploaded_file( $_FILES['uploadedfile']['tmp_name'][$i], $target_path ) ) {
echo '<div class="notice notice-success"><p>'; echo '<div class="notice notice-success"><p>';
@ -107,19 +99,14 @@ if ( is_writable( $realGpxPath ) ) {
if ( is_readable ( $realGpxPath ) && $handle = opendir( $realGpxPath ) ) { if ( is_readable ( $realGpxPath ) && $handle = opendir( $realGpxPath ) ) {
while ( false !== ( $entry = readdir( $handle ) ) ) { while ( false !== ( $entry = readdir( $handle ) ) ) {
if ( preg_match( $gpxRegEx, $entry ) ) { if ( preg_match( $gpxRegEx, $entry ) ) {
if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_deletefile_nonce_' . $entry ) ) {
if ( isset($_GET['_wpnonce']) if ( file_exists( $realGpxPath . '/' . $entry ) ) {
&& unlink( $realGpxPath . '/' . $entry );
wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_deletefile_nonce_' . $entry )
) {
if ( file_exists( $realGpxPath . "/" . $entry ) ) {
unlink( $realGpxPath . "/" . $entry );
echo '<div class="notice notice-success"><p>'; echo '<div class="notice notice-success"><p>';
printf( printf(
/* translators: GPX file name */ /* translators: GPX file name */
__( 'The file %1s has been successfully deleted.', 'wp-gpx-maps' ), __( 'The file %1s has been successfully deleted.', 'wp-gpx-maps' ),
'<span class="code"><strong>' . esc_html ( $entry ) . '</strong></span>' '<span class="code"><strong>' . esc_html( $entry ) . '</strong></span>'
); );
echo '</p></div>'; echo '</p></div>';
} else { } else {
@ -127,13 +114,12 @@ if ( is_writable( $realGpxPath ) ) {
printf( printf(
/* translators: GPX file name */ /* translators: GPX file name */
__( 'The file %1s could not be deleted.', 'wp-gpx-maps' ), __( 'The file %1s could not be deleted.', 'wp-gpx-maps' ),
'<span class="code"><strong>' . esc_html ( $entry ) . '</strong></span>' '<span class="code"><strong>' . esc_html( $entry ) . '</strong></span>'
); );
echo '</p></div>'; echo '</p></div>';
} }
} else { } else {
$myFile = $realGpxPath . "/" . $entry; $myFile = $realGpxPath . '/' . $entry;
$myGpxFileNames[] = array( $myGpxFileNames[] = array(
'name' => $entry, 'name' => $entry,
'size' => filesize( $myFile ), 'size' => filesize( $myFile ),
@ -146,10 +132,10 @@ if ( is_writable( $realGpxPath ) ) {
closedir( $handle ); closedir( $handle );
} }
if ( is_readable ( $realGpxPath ) && $handle = opendir( $realGpxPath ) ) { if ( is_readable( $realGpxPath ) && $handle = opendir( $realGpxPath ) ) {
while ( false !== ($entry = readdir( $handle ) ) ) { while ( false !== ( $entry = readdir( $handle ) ) ) {
if ( preg_match( $gpxRegEx, $entry ) ) { if ( preg_match( $gpxRegEx, $entry ) ) {
$filenames[] = $realGpxPath . "/" . $entry; $filenames[] = $realGpxPath . '/' . $entry;
} }
} }
closedir( $handle ); closedir( $handle );
@ -237,11 +223,4 @@ if ( is_readable ( $realGpxPath ) && $handle = opendir( $realGpxPath ) ) {
}); });
</script> </script>
<style>
#table tr:hover {
background:#eeeeee;
}
</style>

View File

@ -59,14 +59,15 @@
?> ?>
<code><strong>[sgpx gpx="<?php echo $relativeGpxPath; ?>yourgpxfile.gpx &lt; <?php _e( 'read below all the optional attributes', 'wp-gpx-maps' ); ?> &gt;"]</strong></code> <code><strong>[sgpx gpx="<?php echo $relativeGpxPath; ?>yourgpxfile.gpx &lt; <?php _e( 'read below all the optional attributes', 'wp-gpx-maps' ); ?> &gt;"]</strong></code>
</p> </p>
<strong><?php _e( 'Note: If no value is displayed in the "Current value" column, the value is "false".', 'wp-gpx-maps' ); ?></strong>
</div> </div>
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
<th colspan="4"> <th class="title" colspan="4">
<strong><?php _e( 'General', 'wp-gpx-maps' ); ?></strong> <?php _e( 'General', 'wp-gpx-maps' ); ?>
</th> </th>
</tr> </tr>
<tr> <tr>
@ -104,6 +105,12 @@
</td> </td>
<td> <td>
<?php _e( 'Value in percent', 'wp-gpx-maps' ); ?> <?php _e( 'Value in percent', 'wp-gpx-maps' ); ?>
<br />
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>100%</strong>
</td> </td>
<td> <td>
<?php echo get_option( 'wpgpxmaps_width' ); ?> <?php echo get_option( 'wpgpxmaps_width' ); ?>
@ -116,6 +123,12 @@
</td> </td>
<td> <td>
<?php _e( 'Value in pixels', 'wp-gpx-maps' ); ?> <?php _e( 'Value in pixels', 'wp-gpx-maps' ); ?>
<br />
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>450px</strong>
</td> </td>
<td> <td>
<?php echo get_option( 'wpgpxmaps_height' ); ?> <?php echo get_option( 'wpgpxmaps_height' ); ?>
@ -128,6 +141,12 @@
</td> </td>
<td> <td>
<?php _e( 'Value in pixels', 'wp-gpx-maps' ); ?> <?php _e( 'Value in pixels', 'wp-gpx-maps' ); ?>
<br />
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>200px</strong>
</td> </td>
<td> <td>
<?php echo get_option( 'wpgpxmaps_graph_height' ); ?> <?php echo get_option( 'wpgpxmaps_graph_height' ); ?>
@ -173,8 +192,8 @@
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
<th colspan="4"> <th class="title" colspan="4">
<strong><?php _e( 'Map', 'wp-gpx-maps' ); ?></strong> <?php _e( 'Map', 'wp-gpx-maps' ); ?>
</th> </th>
</tr> </tr>
<tr> <tr>
@ -199,23 +218,56 @@
<?php _e( 'Map type', 'wp-gpx-maps' ); ?> <?php _e( 'Map type', 'wp-gpx-maps' ); ?>
</td> </td>
<td> <td>
<strong>HYBRID, ROADMAP, SATELLITE, TERRAIN</strong> <?php
/* translators: map type */
_e( 'HYBRID, ROADMAP, SATELLITE, TERRAIN', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM1</strong> = <?php _e( 'Open Street Map', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM1 = Open Street Map', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM2</strong> = <?php _e( 'Open Cycle Map', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM2 = Open Cycle Map', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM4</strong> = <?php _e( 'Open Cycle Map - Transport', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM4 = Open Cycle Map - Transport', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM5</strong> = <?php _e( 'Open Cycle Map - Landscape', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM5 = Open Cycle Map - Landscape', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM6</strong> = <?php _e( 'MapToolKit - Terrain', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM6 = MapToolKit - Terrain', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM7</strong> = <?php _e( 'Open Street Map - Humanitarian map style', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM7 = Open Street Map - Humanitarian map style', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM9</strong> = <?php _e( 'Hike & Bike', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM9 = Hike & Bike', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>OSM10</strong> = <?php _e( 'Open Sea Map', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = map provider / map type */
_e( 'OSM10 = Open Sea Map', 'wp-gpx-maps' );
?>
<br />
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>HYBRID</strong>
</td> </td>
<td> <td>
<?php echo get_option( 'wpgpxmaps_map_type' ); ?> <?php echo get_option( 'wpgpxmaps_map_type' ); ?>
@ -317,8 +369,8 @@
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
<th colspan="4"> <th class="title" colspan="4">
<strong><?php _e( 'Diagram', 'wp-gpx-maps' ); ?></strong> <?php _e( 'Diagram', 'wp-gpx-maps' ); ?>
</th> </th>
</tr> </tr>
<tr> <tr>
@ -375,18 +427,41 @@
<?php _e( 'Distance / Altitude unit of measure', 'wp-gpx-maps' ); ?> <?php _e( 'Distance / Altitude unit of measure', 'wp-gpx-maps' ); ?>
</td> </td>
<td> <td>
<strong>0</strong> = <?php _e( 'meters / meters', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = chart axis labels */
_e( '0 = meters / meters', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>1</strong> = <?php _e( 'feet / miles', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = chart axis labels */
_e( '1 = feet / miles', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>2</strong> = <?php _e( 'meters / kilometers', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = chart axis labels */
_e( '2 = meters / kilometers', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>3</strong> = <?php _e( 'meters / nautical miles', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = chart axis labels */
_e( '3 = meters / nautical miles', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>4</strong> = <?php _e( 'meters / miles', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = chart axis labels */
_e( '4 = meters / miles', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>5</strong> = <?php _e( 'feet / nautical miles', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = chart axis labels */
_e( '5 = feet / nautical miles', 'wp-gpx-maps' );
?>
<br /> <br />
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>0</strong>
</td> </td>
<td> <td>
<?php echo get_option( 'wpgpxmaps_unit_of_measure' ); ?> <?php echo get_option( 'wpgpxmaps_unit_of_measure' ); ?>
@ -450,20 +525,46 @@
<?php _e( 'Speed unit of measure', 'wp-gpx-maps' ); ?> <?php _e( 'Speed unit of measure', 'wp-gpx-maps' ); ?>
</td> </td>
<td> <td>
<strong>0</strong> = <?php _e( 'm/s', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = speed unit of measure */
_e( '0 = m/s', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>1</strong> = <?php _e( 'km/h', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = speed unit of measure */
_e( '1 = km/h', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>2</strong> = <?php _e( 'miles/h', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = speed unit of measure */
_e( '2 = miles/h', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>3</strong> = <?php _e( 'min/km', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = speed unit of measure */
_e( '3 = min/km', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>4</strong> = <?php _e( 'min/miles', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = speed unit of measure */
_e( '4 = min/miles', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>5</strong> = <?php _e( 'Knots (nautical miles / hour)', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = speed unit of measure */
_e( '5 = Knots (nautical miles / hour)', 'wp-gpx-maps' );
?>
<br /> <br />
<strong>6</strong> = <?php _e( 'min/100 meters', 'wp-gpx-maps' ); ?> <?php
/* translators: selection = speed unit of measure */
_e( '6 = min/100 meters', 'wp-gpx-maps' );
?>
<br /> <br />
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>0</strong>
</td> </td>
<td> <td>
<?php echo get_option( 'wpgpxmaps_unit_of_measure_speed' ); ?> <?php echo get_option( 'wpgpxmaps_unit_of_measure_speed' ); ?>
@ -624,8 +725,8 @@
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
<th colspan="3"> <th class="title" colspan="3">
<strong><?php _e( 'Pictures', 'wp-gpx-maps' ); ?></strong> <?php _e( 'Pictures', 'wp-gpx-maps' ); ?>
</th> </th>
</tr> </tr>
<tr> <tr>
@ -689,8 +790,8 @@
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
<th colspan="4"> <th class="title" colspan="4">
<strong><?php _e( 'Summary table', 'wp-gpx-maps' ); ?></strong> <?php _e( 'Summary table', 'wp-gpx-maps' ); ?>
</th> </th>
</tr> </tr>
<tr> <tr>
@ -893,8 +994,8 @@
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
<th colspan="4"> <th class="title" colspan="4">
<strong><?php _e( 'Advanced', 'wp-gpx-maps' ); ?></strong> <?php _e( 'Advanced', 'wp-gpx-maps' ); ?>
</th> </th>
</tr> </tr>
<tr> <tr>

View File

@ -18,7 +18,8 @@ function wpgpxmaps_getAttachedImages( $dt, $lat, $lon, $dtoffset, &$error ) {
'post_mime_type' => 'image', 'post_mime_type' => 'image',
'order' => 'ASC', 'order' => 'ASC',
'orderby' => 'menu_order ASC', 'orderby' => 'menu_order ASC',
)); )
);
foreach ( $attachments as $attachment_id => $attachment ) { foreach ( $attachments as $attachment_id => $attachment ) {
@ -27,27 +28,27 @@ function wpgpxmaps_getAttachedImages( $dt, $lat, $lon, $dtoffset, &$error ) {
$img_metadata = wp_get_attachment_metadata( $attachment_id ); $img_metadata = wp_get_attachment_metadata( $attachment_id );
$item = array(); $item = array();
$item["data"] = wp_get_attachment_link( $attachment_id, array( 105, 105 ) ); $item['data'] = wp_get_attachment_link( $attachment_id, array( 105, 105 ) );
if ( is_callable( 'exif_read_data' ) ) { if ( is_callable( 'exif_read_data' ) ) {
$exif = @exif_read_data( $img_src[0] ); $exif = @exif_read_data( $img_src[0] );
if ( $exif !== false ) { if ( $exif !== false ) {
$item["lon"] = getExifGps( $exif["GPSLongitude"], $exif['GPSLongitudeRef'] ); $item['lon'] = getExifGps( $exif['GPSLongitude'], $exif['GPSLongitudeRef'] );
$item["lat"] = getExifGps( $exif["GPSLatitude"], $exif['GPSLatitudeRef'] ); $item['lat'] = getExifGps( $exif['GPSLatitude'], $exif['GPSLatitudeRef'] );
if ( ( $item["lat"] != 0 ) || ( $item["lon"] != 0 ) ) { if ( ( $item['lat'] != 0 ) || ( $item['lon'] != 0 ) ) {
$result[] = $item; $result[] = $item;
} elseif ( isset( $p->imagedate ) ) { } elseif ( isset( $p->imagedate ) ) {
$_dt = strtotime( $p->imagedate ) + $dtoffset; $_dt = strtotime( $p->imagedate ) + $dtoffset;
$_item = findItemCoordinate( $_dt, $dt, $lat, $lon ); $_item = findItemCoordinate( $_dt, $dt, $lat, $lon );
if ( $_item != null ) { if ( $_item != null ) {
$item["lat"] = $_item["lat"]; $item['lat'] = $_item['lat'];
$item["lon"] = $_item["lon"]; $item['lon'] = $_item['lon'];
$result[] = $item; $result[] = $item;
} }
} }
} }
} else { } else {
$error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting..<br />"; $error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting.<br />";
} }
} }
} catch ( Exception $e ) { } catch ( Exception $e ) {
@ -106,8 +107,7 @@ function relativeGpxCacheFolderPath() {
function wpgpxmaps_recursive_remove_directory( $directory, $empty = false ) { function wpgpxmaps_recursive_remove_directory( $directory, $empty = false ) {
if ( substr( $directory, -1 ) == '/' ) if ( substr( $directory, -1 ) == '/' ) {
{
$directory = substr( $directory, 0, -1 ); $directory = substr( $directory, 0, -1 );
} }
if ( ! file_exists( $directory ) || ! is_dir( $directory ) ) { if ( ! file_exists( $directory ) || ! is_dir( $directory ) ) {
@ -331,7 +331,6 @@ function wpgpxmaps_parseXml( $filePath, $gpxOffset, $distancetype ) {
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 ) );
} else { } else {
/* Smoller Offset -> continue.. */ /* Smoller Offset -> continue.. */
$lastOffset = (float) $lastOffset + (float) $offset; $lastOffset = (float) $lastOffset + (float) $offset;
@ -341,9 +340,7 @@ function wpgpxmaps_parseXml( $filePath, $gpxOffset, $distancetype ) {
$lastLon = $lon; $lastLon = $lon;
$lastEle = $ele; $lastEle = $ele;
$lastTime = $time; $lastTime = $time;
} }
array_push( $points->dt, null ); array_push( $points->dt, null );
array_push( $points->lat, null ); array_push( $points->lat, null );
array_push( $points->lon, null ); array_push( $points->lon, null );
@ -356,13 +353,10 @@ function wpgpxmaps_parseXml( $filePath, $gpxOffset, $distancetype ) {
array_push( $points->grade, null ); array_push( $points->grade, null );
unset( $trkpts ); unset( $trkpts );
} }
unset( $nodes ); unset( $nodes );
try { try {
array_pop( $points->dt, null ); array_pop( $points->dt, null );
array_pop( $points->lat, null ); array_pop( $points->lat, null );
array_pop( $points->lon, null ); array_pop( $points->lon, null );
@ -568,15 +562,15 @@ function wpgpxmaps_getWayPoints( $gpxPath ) {
} }
array_push($points, array( array_push($points, array(
"lat" => (float) $lat, 'lat' => (float) $lat,
"lon" => (float) $lon, 'lon' => (float) $lon,
"ele" => (float) $ele, 'ele' => (float) $ele,
"time" => $time, 'time' => $time,
"name" => $name, 'name' => $name,
"desc" => $desc, 'desc' => $desc,
"sym" => $sym, 'sym' => $sym,
"type" => $type, 'type' => $type,
"img" => $img, 'img' => $img,
)); ));
} }
} }
@ -638,4 +632,3 @@ function date_getDecimals( $date ) {
return 0; return 0;
} }
} }
?>

View File

@ -54,7 +54,7 @@ function getNGGalleryImages( $ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset
} }
} }
} else { } else {
$error .= "Sorry, <a href='https://php.net/manual/en/function.exif-read-data.php' target='_blank' rel='noopener noreferrer'>exif_read_data</a> function not found! check your hosting..<br />"; $error .= "Sorry, <a href='https://php.net/manual/en/function.exif-read-data.php' target='_blank' rel='noopener noreferrer'>exif_read_data</a> function not found! check your hosting.<br />";
} }
} }
/* START FIX NEXT GEN GALLERY 2.x */ /* START FIX NEXT GEN GALLERY 2.x */
@ -72,7 +72,7 @@ function getNGGalleryImages( $ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset
if ( preg_match( "/data-nplmodal-gallery-id=[\"'](.*?)[\"']/", $dummy, $m ) ) { if ( preg_match( "/data-nplmodal-gallery-id=[\"'](.*?)[\"']/", $dummy, $m ) ) {
$galid = $m[1]; $galid = $m[1];
if ( $galid ) { if ( $galid ) {
for( $i = 0; $i < count( $result ); ++$i ) { for ( $i = 0; $i < count( $result ); ++$i ) {
$result[$i]['data'] = str_replace( '%PRO_LIGHTBOX_GALLERY_ID%', $galid, $result[$i]['data'] ); $result[$i]['data'] = str_replace( '%PRO_LIGHTBOX_GALLERY_ID%', $galid, $result[$i]['data'] );
} }
} }
@ -90,9 +90,12 @@ function getNGGalleryImages( $ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset
function findItemCoordinate( $imgdt, $dt, $lat, $lon ) { function findItemCoordinate( $imgdt, $dt, $lat, $lon ) {
foreach ( array_keys( $dt ) as $i ) { foreach ( array_keys( $dt ) as $i ) {
if ( $i!=0 && $imgdt >= $dt[$i-1] && $imgdt <= $dt[$i] ) { if ( $i != 0 && $imgdt >= $dt[$i - 1] && $imgdt <= $dt[$i] ) {
if ( $lat[$i] != 0 && $lon[$i] != 0 ) if ( $lat[$i] != 0 && $lon[$i] != 0 )
return array( 'lat' => $lat[$i], 'lon' => $lon[$i] ); return array(
'lat' => $lat[$i],
'lon' => $lon[$i],
);
} }
} }
return null; return null;
@ -105,7 +108,7 @@ function getExifGps( $exifCoord, $hemi ) {
$seconds = count( $exifCoord ) > 2 ? gps2Num( $exifCoord[2] ) : 0; $seconds = count( $exifCoord ) > 2 ? gps2Num( $exifCoord[2] ) : 0;
$flip = ( $hemi == 'W' or $hemi == 'S' ) ? -1 : 1; $flip = ( $hemi == 'W' or $hemi == 'S' ) ? -1 : 1;
return $flip * ( $degrees + $minutes / 60 + $seconds / 3600); return $flip * ( $degrees + $minutes / 60 + $seconds / 3600 );
} }
function gps2Num( $coordPart ) { function gps2Num( $coordPart ) {
@ -125,4 +128,3 @@ function gps2Num( $coordPart ) {
return $lat; return $lat;
return $lat / $lon; return $lat / $lon;
} }
?>