* 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: Button to instant copy the shortcode of the selected GPX file in the tab track
* Added: different size logos for the plugin store (icon.svg, icon128x128.png and icon256x256.png) [inside ../plugins/wp-gpx-maps/assets]
* Changed: Settings tab is for non-Admin users is not more visible
* Tweak: Help tab is easier to read
* Tweak: Plugin is now complete translatable (Backend + Frontend)
* Tweak: WordPress coding standards
* Upgrade: Leaflet to 1.5.1
* Upgrade: leaflet.fullscreen to 1.4.5
* Upgrade: Chart.min.js to 2.8.0

Many thanks to Kniebremser for its help
This commit is contained in:
bastianonm 2019-06-18 07:09:56 +00:00
parent fd8b314a70
commit b684a1031e
52 changed files with 35275 additions and 18104 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,636 +0,0 @@
/* required styles */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
width: 1600px;
height: 1600px;
-webkit-transform-origin: 0 0;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer {
max-width: none !important;
max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom {
-ms-touch-action: pan-x pan-y;
touch-action: pan-x pan-y;
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
}
.leaflet-container {
-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
z-index: 800;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-vml-shape {
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 800;
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
}
.leaflet-right {
right: 0;
}
.leaflet-bottom {
bottom: 0;
}
.leaflet-left {
left: 0;
}
.leaflet-control {
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
}
/* zoom and fade animations */
.leaflet-fade-anim .leaflet-tile {
will-change: opacity;
}
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
}
.leaflet-zoom-animated {
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
will-change: transform;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
-o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
}
/* cursors */
.leaflet-interactive {
cursor: pointer;
}
.leaflet-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
cursor: crosshair;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
}
/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
pointer-events: none;
}
.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive {
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline: 0;
}
.leaflet-container a {
color: #0078A8;
}
.leaflet-container a.leaflet-active {
outline: 2px solid orange;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
}
/* general typography */
.leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover {
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
}
.leaflet-touch .leaflet-bar a:first-child {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
.leaflet-touch .leaflet-bar a:last-child {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
/* zoom control */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
font-size: 22px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-scrollbar {
overflow-y: scroll;
overflow-x: hidden;
padding-right: 5px;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* Default icon URLs */
.leaflet-default-icon-path {
background-image: url(images/marker-icon.png);
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
}
.leaflet-control-attribution a {
text-decoration: none;
}
.leaflet-control-attribution a:hover {
text-decoration: underline;
}
.leaflet-container .leaflet-control-attribution,
.leaflet-container .leaflet-control-scale {
font-size: 11px;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 19px;
line-height: 1.4;
}
.leaflet-popup-content p {
margin: 18px 0;
}
.leaflet-popup-tip-container {
width: 40px;
height: 20px;
position: absolute;
left: 50%;
margin-left: -20px;
overflow: hidden;
pointer-events: none;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
color: #333;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
border: none;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-popup-tip-container {
margin-top: -1px;
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
position: absolute;
padding: 6px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 3px;
color: #222;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.leaflet-tooltip.leaflet-clickable {
cursor: pointer;
pointer-events: auto;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
position: absolute;
pointer-events: none;
border: 6px solid transparent;
background: transparent;
content: "";
}
/* Directions */
.leaflet-tooltip-bottom {
margin-top: 6px;
}
.leaflet-tooltip-top {
margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
left: 50%;
margin-left: -6px;
}
.leaflet-tooltip-top:before {
bottom: 0;
margin-bottom: -12px;
border-top-color: #fff;
}
.leaflet-tooltip-bottom:before {
top: 0;
margin-top: -12px;
margin-left: -6px;
border-bottom-color: #fff;
}
.leaflet-tooltip-left {
margin-left: -6px;
}
.leaflet-tooltip-right {
margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
top: 50%;
margin-top: -6px;
}
.leaflet-tooltip-left:before {
right: 0;
margin-right: -12px;
border-left-color: #fff;
}
.leaflet-tooltip-right:before {
left: 0;
margin-left: -12px;
border-right-color: #fff;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 696 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 618 B

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,640 @@
/* required styles */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
/* Prevents IE11 from highlighting tiles in blue */
.leaflet-tile::selection {
background: transparent;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
width: 1600px;
height: 1600px;
-webkit-transform-origin: 0 0;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
max-width: none !important;
max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom {
-ms-touch-action: pan-x pan-y;
touch-action: pan-x pan-y;
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
}
.leaflet-container {
-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
z-index: 800;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-vml-shape {
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 800;
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
}
.leaflet-right {
right: 0;
}
.leaflet-bottom {
bottom: 0;
}
.leaflet-left {
left: 0;
}
.leaflet-control {
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
}
/* zoom and fade animations */
.leaflet-fade-anim .leaflet-tile {
will-change: opacity;
}
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
}
.leaflet-zoom-animated {
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
will-change: transform;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
-webkit-transition: none;
-moz-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
}
/* cursors */
.leaflet-interactive {
cursor: pointer;
}
.leaflet-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
cursor: crosshair;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
pointer-events: none;
}
.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline: 0;
}
.leaflet-container a {
color: #0078A8;
}
.leaflet-container a.leaflet-active {
outline: 2px solid orange;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
}
/* general typography */
.leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover {
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
}
.leaflet-touch .leaflet-bar a:first-child {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
.leaflet-touch .leaflet-bar a:last-child {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
/* zoom control */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
font-size: 22px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-scrollbar {
overflow-y: scroll;
overflow-x: hidden;
padding-right: 5px;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* Default icon URLs */
.leaflet-default-icon-path {
background-image: url(images/marker-icon.png);
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
}
.leaflet-control-attribution a {
text-decoration: none;
}
.leaflet-control-attribution a:hover {
text-decoration: underline;
}
.leaflet-container .leaflet-control-attribution,
.leaflet-container .leaflet-control-scale {
font-size: 11px;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 19px;
line-height: 1.4;
}
.leaflet-popup-content p {
margin: 18px 0;
}
.leaflet-popup-tip-container {
width: 40px;
height: 20px;
position: absolute;
left: 50%;
margin-left: -20px;
overflow: hidden;
pointer-events: none;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
color: #333;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
border: none;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-popup-tip-container {
margin-top: -1px;
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
position: absolute;
padding: 6px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 3px;
color: #222;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.leaflet-tooltip.leaflet-clickable {
cursor: pointer;
pointer-events: auto;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
position: absolute;
pointer-events: none;
border: 6px solid transparent;
background: transparent;
content: "";
}
/* Directions */
.leaflet-tooltip-bottom {
margin-top: 6px;
}
.leaflet-tooltip-top {
margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
left: 50%;
margin-left: -6px;
}
.leaflet-tooltip-top:before {
bottom: 0;
margin-bottom: -12px;
border-top-color: #fff;
}
.leaflet-tooltip-bottom:before {
top: 0;
margin-top: -12px;
margin-left: -6px;
border-bottom-color: #fff;
}
.leaflet-tooltip-left {
margin-left: -6px;
}
.leaflet-tooltip-right {
margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
top: 50%;
margin-top: -6px;
}
.leaflet-tooltip-left:before {
right: 0;
margin-right: -12px;
border-left-color: #fff;
}
.leaflet-tooltip-right:before {
left: 0;
margin-left: -12px;
border-right-color: #fff;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,12 +0,0 @@
{
"browser": true,
"curly": true,
"eqeqeq": true,
"undef": true,
"quotmark": "single",
"trailing": true,
"globals": {
"L": true,
"jQuery": true
}
}

View File

@ -1,4 +0,0 @@
.leaflet-control-zoom-fullscreen { background-image: url(icon-fullscreen.png); }
.leaflet-retina .leaflet-control-zoom-fullscreen { background-image: url(icon-fullscreen-2x.png); background-size: 26px 26px; }
.leaflet-container:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }

View File

@ -1,164 +0,0 @@
(function() {
L.Control.FullScreen = L.Control.extend({
options: {
position: 'topleft',
title: 'Full Screen',
forceSeparateButton: false,
forcePseudoFullscreen: false
},
onAdd: function (map) {
var className = 'leaflet-control-zoom-fullscreen', container;
if (map.zoomControl && !this.options.forceSeparateButton) {
container = map.zoomControl._container;
} else {
container = L.DomUtil.create('div', 'leaflet-bar');
}
this._createButton(this.options.title, className, container, this.toggleFullScreen, this);
return container;
},
_createButton: function (title, className, container, fn, context) {
var link = L.DomUtil.create('a', className, container);
link.href = '#';
link.title = title;
L.DomEvent
.addListener(link, 'click', L.DomEvent.stopPropagation)
.addListener(link, 'click', L.DomEvent.preventDefault)
.addListener(link, 'click', fn, context);
L.DomEvent
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(container, fullScreenApi.fullScreenEventName, this._handleEscKey, context);
L.DomEvent
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(document, fullScreenApi.fullScreenEventName, this._handleEscKey, context);
return link;
},
toggleFullScreen: function () {
var map = this._map;
map._exitFired = false;
if (map._isFullscreen) {
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.cancelFullScreen(map._container);
} else {
L.DomUtil.removeClass(map._container, 'leaflet-pseudo-fullscreen');
}
map.invalidateSize();
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;
}
else {
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.requestFullScreen(map._container);
} else {
L.DomUtil.addClass(map._container, 'leaflet-pseudo-fullscreen');
}
map.invalidateSize();
map.fire('enterFullscreen');
map._isFullscreen = true;
}
},
_handleEscKey: function () {
var map = this._map;
if (!fullScreenApi.isFullScreen(map) && !map._exitFired) {
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;
}
}
});
L.Map.addInitHook(function () {
if (this.options.fullscreenControl) {
this.fullscreenControl = L.control.fullscreen(this.options.fullscreenControlOptions);
this.addControl(this.fullscreenControl);
}
});
L.control.fullscreen = function (options) {
return new L.Control.FullScreen(options);
};
/*
Native FullScreen JavaScript API
-------------
Assumes Mozilla naming conventions instead of W3C for now
source : http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/
*/
var
fullScreenApi = {
supportsFullScreen: false,
isFullScreen: function() { return false; },
requestFullScreen: function() {},
cancelFullScreen: function() {},
fullScreenEventName: '',
prefix: ''
},
browserPrefixes = 'webkit moz o ms khtml'.split(' ');
// check for native support
if (typeof document.exitFullscreen !== 'undefined') {
fullScreenApi.supportsFullScreen = true;
} else {
// check for fullscreen support by vendor prefix
for (var i = 0, il = browserPrefixes.length; i < il; i++ ) {
fullScreenApi.prefix = browserPrefixes[i];
if (typeof document[fullScreenApi.prefix + 'CancelFullScreen' ] !== 'undefined' ) {
fullScreenApi.supportsFullScreen = true;
break;
}
}
}
// update methods to do something useful
if (fullScreenApi.supportsFullScreen) {
fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
fullScreenApi.isFullScreen = function() {
switch (this.prefix) {
case '':
return document.fullScreen;
case 'webkit':
return document.webkitIsFullScreen;
default:
return document[this.prefix + 'FullScreen'];
}
};
fullScreenApi.requestFullScreen = function(el) {
return (this.prefix === '') ? el.requestFullscreen() : el[this.prefix + 'RequestFullScreen']();
};
fullScreenApi.cancelFullScreen = function(el) {
return (this.prefix === '') ? document.exitFullscreen() : document[this.prefix + 'CancelFullScreen']();
};
}
// jQuery plugin
if (typeof jQuery !== 'undefined') {
jQuery.fn.requestFullScreen = function() {
return this.each(function() {
var el = jQuery(this);
if (fullScreenApi.supportsFullScreen) {
fullScreenApi.requestFullScreen(el);
}
});
};
}
// export api
window.fullScreenApi = fullScreenApi;
})();

View File

@ -1,22 +0,0 @@
Copyright (c) 2013, Bruno Bergot
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

View File

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Leaflet.Control.FullScreen Demo</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<style type="text/css">
#map { width: 700px; height: 433px; }
.leaflet-control-zoom-fullscreen { background-image: url(icon-fullscreen.png); }
/* on selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
#map:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:-moz-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }
</style>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
<script src="Control.FullScreen.js"></script>
</head>
<body>
<div id="map"></div>
<script>
var base = new L.TileLayer('http://{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
});
var map = new L.Map('map', {
layers: [base],
center: new L.LatLng(48.5, -4.5),
zoom: 5,
fullscreenControl: true,
fullscreenControlOptions: { // optional
title:"Show me the fullscreen !"
}
});
// detect fullscreen toggling
map.on('enterFullscreen', function(){
if(window.console) window.console.log('enterFullscreen');
});
map.on('exitFullscreen', function(){
if(window.console) window.console.log('exitFullscreen');
});
</script>
</body>
</html>

View File

@ -0,0 +1,32 @@
{
"rules": {
"camelcase": 0,
"quotes": [2, "single", "avoid-escape"],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"space-before-function-paren": 2,
"space-in-parens": 2,
"object-curly-spacing": [2, "never"],
"array-bracket-spacing": 2,
"computed-property-spacing": 2,
"space-before-blocks": 2,
"keyword-spacing": 2,
"no-lonely-if": 2,
"comma-style": 2,
"no-underscore-dangle": 0,
"no-constant-condition": 0,
"no-multi-spaces": 0,
"strict": 0,
"key-spacing": 0,
"no-shadow": 0,
"no-unused-vars": 2
},
"globals": {
"L": true,
"module": false,
"define": false,
"require": true
},
"env": {
"browser": true
}
}

View File

@ -0,0 +1,7 @@
{
"commitMessage": "version %s",
"tagName": "%s",
"scripts": {
"postcommit": "git push && git push --tags && npm publish"
}
}

View File

@ -0,0 +1,8 @@
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
.leaflet-retina .fullscreen-icon { background-image: url(icon-fullscreen-2x.png); background-size: 26px 26px; }
/* one selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
.leaflet-container:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-container:-ms-fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-container:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-container:fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }

View File

@ -0,0 +1,202 @@
(function () {
L.Control.FullScreen = L.Control.extend({
options: {
position: 'topleft',
title: 'Full Screen',
titleCancel: 'Exit Full Screen',
forceSeparateButton: false,
forcePseudoFullscreen: false,
fullscreenElement: false
},
onAdd: function (map) {
var className = 'leaflet-control-zoom-fullscreen', container, content = '';
if (map.zoomControl && !this.options.forceSeparateButton) {
container = map.zoomControl._container;
} else {
container = L.DomUtil.create('div', 'leaflet-bar');
}
if (this.options.content) {
content = this.options.content;
} else {
className += ' fullscreen-icon';
}
this._createButton(this.options.title, className, content, container, this.toggleFullScreen, this);
this._map.on('enterFullscreen exitFullscreen', this._toggleTitle, this);
return container;
},
_createButton: function (title, className, content, container, fn, context) {
this.link = L.DomUtil.create('a', className, container);
this.link.href = '#';
this.link.title = title;
this.link.innerHTML = content;
L.DomEvent
.addListener(this.link, 'click', L.DomEvent.stopPropagation)
.addListener(this.link, 'click', L.DomEvent.preventDefault)
.addListener(this.link, 'click', fn, context);
L.DomEvent
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(container, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, context);
L.DomEvent
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(document, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, context);
return this.link;
},
toggleFullScreen: function () {
var map = this._map;
map._exitFired = false;
if (map._isFullscreen) {
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.cancelFullScreen();
} else {
L.DomUtil.removeClass(this.options.fullscreenElement ? this.options.fullscreenElement : map._container, 'leaflet-pseudo-fullscreen');
}
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;
}
else {
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.requestFullScreen(this.options.fullscreenElement ? this.options.fullscreenElement : map._container);
} else {
L.DomUtil.addClass(this.options.fullscreenElement ? this.options.fullscreenElement : map._container, 'leaflet-pseudo-fullscreen');
}
map.fire('enterFullscreen');
map._isFullscreen = true;
}
},
_toggleTitle: function () {
this.link.title = this._map._isFullscreen ? this.options.title : this.options.titleCancel;
},
_handleFullscreenChange: function () {
var map = this._map;
map.invalidateSize();
if (!fullScreenApi.isFullScreen() && !map._exitFired) {
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;
}
}
});
L.Map.addInitHook(function () {
if (this.options.fullscreenControl) {
this.fullscreenControl = L.control.fullscreen(this.options.fullscreenControlOptions);
this.addControl(this.fullscreenControl);
}
});
L.control.fullscreen = function (options) {
return new L.Control.FullScreen(options);
};
/*
Native FullScreen JavaScript API
-------------
Assumes Mozilla naming conventions instead of W3C for now
source : http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/
*/
var
fullScreenApi = {
supportsFullScreen: false,
isFullScreen: function () { return false; },
requestFullScreen: function () {},
cancelFullScreen: function () {},
fullScreenEventName: '',
prefix: ''
},
browserPrefixes = 'webkit moz o ms khtml'.split(' ');
// check for native support
if (typeof document.exitFullscreen !== 'undefined') {
fullScreenApi.supportsFullScreen = true;
} else {
// check for fullscreen support by vendor prefix
for (var i = 0, il = browserPrefixes.length; i < il; i++) {
fullScreenApi.prefix = browserPrefixes[i];
if (typeof document[fullScreenApi.prefix + 'CancelFullScreen'] !== 'undefined') {
fullScreenApi.supportsFullScreen = true;
break;
}
}
if (typeof document['msExitFullscreen'] !== 'undefined') {
fullScreenApi.prefix = 'ms';
fullScreenApi.supportsFullScreen = true;
}
}
// update methods to do something useful
if (fullScreenApi.supportsFullScreen) {
if (fullScreenApi.prefix === 'ms') {
fullScreenApi.fullScreenEventName = 'MSFullscreenChange';
} else {
fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
}
fullScreenApi.isFullScreen = function () {
switch (this.prefix) {
case '':
return document.fullscreen;
case 'webkit':
return document.webkitIsFullScreen;
case 'ms':
return document.msFullscreenElement;
default:
return document[this.prefix + 'FullScreen'];
}
};
fullScreenApi.requestFullScreen = function (el) {
switch (this.prefix) {
case '':
return el.requestFullscreen();
case 'ms':
return el.msRequestFullscreen();
default:
return el[this.prefix + 'RequestFullScreen']();
}
};
fullScreenApi.cancelFullScreen = function () {
switch (this.prefix) {
case '':
return document.exitFullscreen();
case 'ms':
return document.msExitFullscreen();
default:
return document[this.prefix + 'CancelFullScreen']();
}
};
}
// jQuery plugin
if (typeof jQuery !== 'undefined') {
jQuery.fn.requestFullScreen = function () {
return this.each(function () {
var el = jQuery(this);
if (fullScreenApi.supportsFullScreen) {
fullScreenApi.requestFullScreen(el);
}
});
};
}
// export api
window.fullScreenApi = fullScreenApi;
})();

View File

@ -0,0 +1,19 @@
Copyright (c) 2013, Bruno Bergot
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -37,6 +37,8 @@ If your map have a zoomControl the fullscreen button will be added at the bottom
If your map doesn't have a zoomContron the fullscreen button will be added to topleft corner of the map (same as the zoomcontrol). If your map doesn't have a zoomContron the fullscreen button will be added to topleft corner of the map (same as the zoomcontrol).
If you want to use the plugin on a map embedded in an iframe, don't forget to set `allowfullscreen` attribute on your iframe.
__Events and options__: __Events and options__:
``` js ``` js
@ -44,8 +46,11 @@ __Events and options__:
L.control.fullscreen({ L.control.fullscreen({
position: 'topleft', // change the position of the button can be topleft, topright, bottomright or bottomleft, defaut topleft position: 'topleft', // change the position of the button can be topleft, topright, bottomright or bottomleft, defaut topleft
title: 'Show me the fullscreen !', // change the title of the button, default Full Screen title: 'Show me the fullscreen !', // change the title of the button, default Full Screen
titleCancel: 'Exit fullscreen mode', // change the title of the button when fullscreen is on, default Exit Full Screen
content: null, // change the content of the button, can be HTML, default null
forceSeparateButton: true, // force seperate button to detach from zoom buttons, default false forceSeparateButton: true, // force seperate button to detach from zoom buttons, default false
forcePseudoFullscreen: true // force use of pseudo full screen even if full screen API is available, default false forcePseudoFullscreen: true, // force use of pseudo full screen even if full screen API is available, default false
fullscreenElement: false // Dom element to render in full screen, false by default, fallback to map._container
}).addTo(map); }).addTo(map);
// events are fired when entering or exiting fullscreen. // events are fired when entering or exiting fullscreen.

View File

@ -1,7 +1,8 @@
{ {
"name": "leaflet.fullscreen", "name": "leaflet.fullscreen",
"version": "1.1.4", "version": "1.4.5",
"homepage": "https://github.com/brunob/leaflet.fullscreen", "homepage": "https://github.com/brunob/leaflet.fullscreen",
"license": "MIT",
"authors": [ "authors": [
"brunob <brunobergot@gmail.com>" "brunob <brunobergot@gmail.com>"
], ],
@ -12,13 +13,15 @@
"icon-fullscreen.png", "icon-fullscreen.png",
"icon-fullscreen-2x.png" "icon-fullscreen-2x.png"
], ],
"devDependencies": {
"eslint": "2.3.0"
},
"keywords": [ "keywords": [
"leaflet", "leaflet",
"plugins", "plugins",
"maps", "maps",
"fullscreen" "fullscreen"
], ],
"license": "MIT",
"ignore": [ "ignore": [
"**/.*", "**/.*",
"node_modules", "node_modules",

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Leaflet.Control.FullScreen Demo</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
<style type="text/css">
#map { width: 700px; height: 433px; }
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
/* one selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
#map:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:-ms-fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }
</style>
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
<script src="Control.FullScreen.js"></script>
</head>
<body>
<div id="map"></div>
<script>
var base = new L.TileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
maxZoom: 19,
subdomains: 'abcd',
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
});
var map = new L.Map('map', {
layers: [base],
center: new L.LatLng(48.5, -4.5),
zoom: 5,
fullscreenControl: true,
fullscreenControlOptions: { // optional
title:"Show me the fullscreen !",
titleCancel:"Exit fullscreen mode"
}
});
// detect fullscreen toggling
map.on('enterFullscreen', function(){
if(window.console) window.console.log('enterFullscreen');
});
map.on('exitFullscreen', function(){
if(window.console) window.console.log('exitFullscreen');
});
</script>
</body>
</html>

View File

@ -1,10 +1,10 @@
{ {
"name": "leaflet.fullscreen", "name": "leaflet.fullscreen",
"version": "1.1.4", "version": "1.4.5",
"description": "Simple plugin for Leaflet that adds fullscreen button to your maps.", "description": "Simple plugin for Leaflet that adds fullscreen button to your maps.",
"main": "Control.FullScreen.js", "main": "Control.FullScreen.js",
"scripts": { "scripts": {
"test": "jshint Control.FullScreen.js" "test": "eslint --config .eslintrc Control.FullScreen.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -17,7 +17,7 @@
"fullscreen" "fullscreen"
], ],
"devDependencies": { "devDependencies": {
"jshint": "2.5.0" "eslint": "2.3.0"
}, },
"author": "b_b", "author": "b_b",
"license": "MIT License", "license": "MIT License",

BIN
assets/icon-128x128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
assets/icon-256x256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

1
assets/icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="512pt" viewBox="0 0 512 512" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m452 122c-27.601562 0-50 22.402344-50 50v280h100v-280c0-27.609375-22.390625-50-50-50zm0 0" fill="#ececf1"/><path d="m60 122c-27.601562 0-50 22.402344-50 50v280h100c0-10.460938 0-266.328125 0-280 0-27.609375-22.390625-50-50-50zm0 0" fill="#ececf1"/><path d="m260 322h142c0-54.882812 0-108.527344 0-120h-268s91.441406 87.089844 126 120zm0 0" fill="#7fe881"/><path d="m110 262v190c0-27.609375-22.390625-50-50-50s-50 22.390625-50 50c0 29.078125 25.246094 50 52.851562 50h47.148438l126-120zm0 0" fill="#76e2f8"/><path d="m465.320312 403.71875c-33.359374-8.617188-63.320312 16.332031-63.320312 48.28125 0-7.824219 0-35.589844 0-70h-86l-120 120h256c27.621094 0 50-22.378906 50-50 0-24.109375-16.308594-43.019531-36.679688-48.28125zm0 0" fill="#76e2f8"/><path d="m402 322v60h-86l-120 120h-86l126-120-126-120v-60h24s91.441406 87.089844 126 120zm0 0" fill="#fed2a4"/><path d="m256 10c49.710938 0 90 40.289062 90 90 0 24.488281-21.828125 66.089844-43.988281 102-22.832031 37.019531-46.011719 68-46.011719 68s-23.179688-30.980469-46.011719-68c-22.160156-35.910156-43.988281-77.511719-43.988281-102 0-49.710938 40.289062-90 90-90zm0 0" fill="#ff637b"/><path d="m256 60c22.058594 0 40 17.941406 40 40s-17.941406 40-40 40-40-17.941406-40-40 17.941406-40 40-40zm0 0" fill="#ececf1"/><path d="m452 112c-33.144531 0-60 26.847656-60 60v20h-72.3125c24.097656-41.210938 36.3125-72.117188 36.3125-92 0-55.140625-44.859375-100-100-100s-100 44.859375-100 100c0 19.882812 12.214844 50.792969 36.3125 92-8.117188 0-65.292969 0-72.3125 0v-20c0-33.085938-26.914062-60-60-60-33.144531 0-60 26.847656-60 60v56c0 5.523438 4.476562 10 10 10s10-4.476562 10-10v-56c0-22.09375 17.902344-40 40-40 22.054688 0 40 17.945312 40 40v235.316406c-10.621094-9.519531-24.648438-15.316406-40-15.316406-15.355469 0-29.375 5.804688-40 15.328125v-99.328125c0-5.523438-4.476562-10-10-10s-10 4.476562-10 10v144c0 34.308594 29.617188 60 62.851562 60h389.148438c33.085938 0 60-26.914062 60-60v-280c0-33.085938-26.914062-60-60-60zm-40 60c0-22.09375 17.902344-40 40-40 22.054688 0 40 17.945312 40 40v235.042969c-6.875-6.121094-15.152344-10.675781-24.179688-13.003907-20.042968-5.183593-40.664062-.304687-55.820312 13.230469 0-8.550781 0-223.265625 0-235.269531zm-20 140h-128c-33.511719-31.910156-97.515625-92.871094-104.996094-100h45.429688c21.832031 34.875 43.335937 63.691406 43.558594 63.992188 1.890624 2.523437 4.855468 4.007812 8.007812 4.007812s6.117188-1.484375 8.007812-4.007812c.222657-.300782 21.730469-29.117188 43.558594-63.992188h84.433594zm-136-292c44.113281 0 80 35.886719 80 80 0 37.128906-58.570312 122.988281-80 152.988281-21.765625-30.476562-80-116.199219-80-152.988281 0-44.113281 35.886719-80 80-80zm-236 432c0-22.054688 17.945312-40 40-40s40 17.945312 40 40c0 5.523438 4.476562 10 10 10s10-4.476562 10-10v-166.667969l101.5 96.667969-115.5 110h-43.148438c-22.425781 0-42.851562-16.761719-42.851562-40zm222.894531-62.757812c1.984375-1.890626 3.105469-4.507813 3.105469-7.242188s-1.121094-5.355469-3.105469-7.242188l-122.894531-117.042968v-45.714844h10c.683594.652344 118.339844 112.707031 123.105469 117.242188 1.859375 1.769531 4.328125 2.757812 6.894531 2.757812h132v40h-76c-2.652344 0-5.195312 1.054688-7.070312 2.929688l-117.074219 117.070312h-56.855469zm209.105469 102.757812h-231.855469l100-100h71.855469v60c0 5.523438 4.476562 10 10 10s10-4.476562 10-10c0-25.863281 24.21875-45.46875 50.820312-38.597656 16.238282 4.195312 29.179688 19.191406 29.179688 38.597656 0 22.054688-17.945312 40-40 40zm0 0"/><path d="m256 150c27.570312 0 50-22.429688 50-50s-22.429688-50-50-50-50 22.429688-50 50 22.429688 50 50 50zm0-80c16.542969 0 30 13.457031 30 30s-13.457031 30-30 30-30-13.457031-30-30 13.457031-30 30-30zm0 0"/><path d="m10 278c5.519531 0 10-4.480469 10-10s-4.480469-10-10-10-10 4.480469-10 10 4.480469 10 10 10zm0 0"/></svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

62
css/admin-style.css Normal file
View File

@ -0,0 +1,62 @@
/**
* This file contains the style definitions for the admin area
*
* Content:
* --------
* 1. Over the Tabs
* 2. Tab: Tracks
* 3. Tab: Settings
* 4. Tab: Help
*/
/**
* 1.0 Over the Tabs
*/
/**
* 2.0 Tab: Tracks
*/
/**
* 3.0 Tab: Settings
*/
.wpgpxmaps-container-tab-settings {
display: block;
padding: 5px 20px 1px 20px;
}
/**
* 4.0 Tab: Tracks
*/
.wpgpxmaps-container-tab-faq {
display: block;
padding: 5px 20px 1px 20px;
}
.wpgpxmaps-tab-faq {
display: block;
padding: 5px 20px 10px 20px;
}
.wpgpxmaps-container-tab-faq table.widefat {
margin-bottom: 10px;
border-bottom: none;
border-radius: 6px;
}
.wpgpxmaps-container-tab-faq table.widefat tbody tr:hover {
background:#eeeeee;
}
.wpgpxmaps-container-tab-faq table.widefat th,
.wpgpxmaps-container-tab-faq table.widefat td {
padding: 4px 10px;
}
.wpgpxmaps-container-tab-faq table.widefat thead tr th {
font-size: 14px;
}
.wpgpxmaps-container-tab-faq table.widefat td {
width: 200px;
}

13
js/Chart.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -10,9 +10,9 @@ Author URI: http://www.devfarm.it/
var WPGPXMAPS = { var WPGPXMAPS = {
Utils: { Utils: {
// in case of multiple polylines this function divide the points of each polyline
DividePolylinesPoints : function (mapData) // In case of multiple polylines this function divide the points of each polyline.
{ DividePolylinesPoints: function( mapData ) {
var lastCut = 0; var lastCut = 0;
@ -20,17 +20,14 @@ var WPGPXMAPS = {
var _len = mapData.length; var _len = mapData.length;
for (i=0; i < _len; i++) for ( i = 0; i < _len; i++ ) {
{ if ( mapData[i] == null ) {
if (mapData[i] == null)
{
result.push( mapData.slice( lastCut == 0 ? 0 : lastCut + 1, i ) ); result.push( mapData.slice( lastCut == 0 ? 0 : lastCut + 1, i ) );
lastCut = i; lastCut = i;
} }
} }
if ( (_len - 1 ) != lastCut) if ( ( _len - 1 ) != lastCut ) {
{
result.push( mapData.slice( lastCut ) ); result.push( mapData.slice( lastCut ) );
} }
@ -38,14 +35,10 @@ var WPGPXMAPS = {
}, },
GetItemFromArray : function(arr,index) GetItemFromArray: function( arr, index ) {
{ try {
try
{
return arr[index]; return arr[index];
} } catch ( e ) {
catch(e)
{
return [ 0, 0 ]; return [ 0, 0 ];
} }
}, },
@ -54,6 +47,7 @@ var WPGPXMAPS = {
}, },
MapEngines: { MapEngines: {
/* NOT WORKING AND TESTED! old code copy&pate */ /* NOT WORKING AND TESTED! old code copy&pate */
GoogleMaps: function() { GoogleMaps: function() {
this.map = null, this.map = null,
@ -65,33 +59,33 @@ var WPGPXMAPS = {
for ( var type in google.maps.MapTypeId ) { for ( var type in google.maps.MapTypeId ) {
mapTypeIds.push( google.maps.MapTypeId[type] ); mapTypeIds.push( google.maps.MapTypeId[type] );
} }
mapTypeIds.push("OSM1"); mapTypeIds.push( 'OSM1' );
mapTypeIds.push("OSM2"); mapTypeIds.push( 'OSM2' );
mapTypeIds.push("OSM3"); mapTypeIds.push( 'OSM3' );
mapTypeIds.push("OSM4"); mapTypeIds.push( 'OSM4' );
mapTypeIds.push("OSM5"); mapTypeIds.push( 'OSM5' );
mapTypeIds.push("OSM6"); mapTypeIds.push( 'OSM6' );
var ngImageMarkers = []; var ngImageMarkers = [];
switch (mapType) switch ( mapType ) {
{
case 'TERRAIN': { mapType = google.maps.MapTypeId.TERRAIN; break;} case 'TERRAIN': { mapType = google.maps.MapTypeId.TERRAIN; break;}
case 'SATELLITE': { mapType = google.maps.MapTypeId.SATELLITE; break;} case 'SATELLITE': { mapType = google.maps.MapTypeId.SATELLITE; break;}
case 'ROADMAP': { mapType = google.maps.MapTypeId.ROADMAP; break;} case 'ROADMAP': { mapType = google.maps.MapTypeId.ROADMAP; break;}
case 'OSM1': { mapType = "OSM1"; break;} case 'OSM1': { mapType = 'OSM1'; break;}
case 'OSM2': { mapType = "OSM2"; break;} case 'OSM2': { mapType = 'OSM2'; break;}
case 'OSM3': { mapType = "OSM3"; break;} case 'OSM3': { mapType = 'OSM3'; break;}
case 'OSM4': { mapType = "OSM4"; break;} case 'OSM4': { mapType = 'OSM4'; break;}
case 'OSM5': { mapType = "OSM5"; break;} case 'OSM5': { mapType = 'OSM5'; break;}
case 'OSM6': { mapType = "OSM6"; break;} case 'OSM6': { mapType = 'OSM6'; break;}
default: { mapType = google.maps.MapTypeId.HYBRID; break;} default: { mapType = google.maps.MapTypeId.HYBRID; break;}
} }
if ( mapType == "TERRAIN" || mapType == "SATELLITE" || mapType == "ROADMAP" ) if ( mapType == 'TERRAIN' || mapType == 'SATELLITE' || mapType == 'ROADMAP' ) {
{
// google maps // google maps
} else { } else {
// Show OpenStreetMaps credits // Show OpenStreetMaps credits
$( el_osm_credits ).show(); $( el_osm_credits ).show();
} }
@ -106,69 +100,70 @@ var WPGPXMAPS = {
}); });
this.map.mapTypes.set("OSM1", new google.maps.ImageMapType({ this.map.mapTypes.set( 'OSM1', new google.maps.ImageMapType({
getTileUrl: function( coord, zoom ) { getTileUrl: function( coord, zoom ) {
return "https://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; return "https://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + '.png';
}, },
tileSize: new google.maps.Size( 256, 256 ), tileSize: new google.maps.Size( 256, 256 ),
name: "OSM", name: 'OSM',
alt : "Open Street Map", alt: 'Open Street Map',
maxZoom: 18 maxZoom: 18
}) ); }) );
this.map.mapTypes.set("OSM2", new google.maps.ImageMapType({ this.map.mapTypes.set( 'OSM2', new google.maps.ImageMapType({
getTileUrl: function( coord, zoom ) { getTileUrl: function( coord, zoom ) {
if (hasThunderforestApiKey) if ( hasThunderforestApiKey ) {
return "https://a.tile.thunderforest.com/cycle/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey; return "https://a.tile.thunderforest.com/cycle/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey;
else } else {
return "http://a.tile.opencyclemap.org/cycle/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; return "http://a.tile.opencyclemap.org/cycle/" + zoom + "/" + coord.x + "/" + coord.y + '.png';
}
}, },
tileSize: new google.maps.Size( 256, 256 ), tileSize: new google.maps.Size( 256, 256 ),
name: "OCM", name: 'OCM',
alt : "Open Cycle Map", alt: 'Open Cycle Map',
maxZoom: 18 maxZoom: 18
})); }));
this.map.mapTypes.set("OSM4", new google.maps.ImageMapType({ this.map.mapTypes.set( 'OSM4', new google.maps.ImageMapType({
getTileUrl: function( coord, zoom ) { getTileUrl: function( coord, zoom ) {
if (hasThunderforestApiKey) if ( hasThunderforestApiKey ) {
return "https://a.tile.thunderforest.com/transport/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey; return "https://a.tile.thunderforest.com/transport/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey;
else } else {
return "http://a.tile2.opencyclemap.org/transport/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; return "http://a.tile2.opencyclemap.org/transport/" + zoom + "/" + coord.x + "/" + coord.y + '.png';
}
}, },
tileSize: new google.maps.Size(256, 256), tileSize: new google.maps.Size(256, 256),
name: "OCM-Tran", name: 'OCM-Tran',
alt : "Open Cycle Map - Transport", alt: 'Open Cycle Map - Transport',
maxZoom: 18 maxZoom: 18
}) ); }) );
this.map.mapTypes.set("OSM5", new google.maps.ImageMapType({ this.map.mapTypes.set( 'OSM5', new google.maps.ImageMapType({
getTileUrl: function( coord, zoom ) { getTileUrl: function( coord, zoom ) {
if (hasThunderforestApiKey) if ( hasThunderforestApiKey ) {
return "https://a.tile.thunderforest.com/landscape/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey; return "https://a.tile.thunderforest.com/landscape/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey;
else } else {
return "http://a.tile3.opencyclemap.org/landscape/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; return "http://a.tile3.opencyclemap.org/landscape/" + zoom + "/" + coord.x + "/" + coord.y + '.png';
}
}, },
tileSize: new google.maps.Size( 256, 256 ), tileSize: new google.maps.Size( 256, 256 ),
name: "OCM-Land", name: 'OCM-Land',
alt : "Open Cycle Map - Landscape", alt: 'Open Cycle Map - Landscape',
maxZoom: 18 maxZoom: 18
}) ); }) );
this.map.mapTypes.set("OSM6", new google.maps.ImageMapType({ this.map.mapTypes.set( 'OSM6', new google.maps.ImageMapType({
getTileUrl: function( coord, zoom ) { getTileUrl: function( coord, zoom ) {
return "https://tile2.maptoolkit.net/terrain/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; return "https://tile2.maptoolkit.net/terrain/" + zoom + "/" + coord.x + "/" + coord.y + '.png';
}, },
tileSize: new google.maps.Size( 256, 256 ), tileSize: new google.maps.Size( 256, 256 ),
name: "MTK-Terr", name: 'MTK-Terr',
alt : "MapToolKit - Terrain", alt: 'MapToolKit - Terrain',
maxZoom: 18 maxZoom: 18
}) ); }) );
}, },
this.AppPolylines = function( mapData, color1, currentIcon, startIcon, endIcon ) { this.AppPolylines = function( mapData, color1, currentIcon, startIcon, endIcon ) {
var points = []; var points = [];
@ -176,10 +171,8 @@ var WPGPXMAPS = {
var polylinenes = []; var polylinenes = [];
var polyline_number = 0; var polyline_number = 0;
var color = 0; var color = 0;
for (i=0; i < mapData.length; i++) for ( i = 0; i < mapData.length; i++ ) {
{ if (mapData[i] == null) {
if (mapData[i] == null)
{
var poly = new google.maps.Polyline({ var poly = new google.maps.Polyline({
path: points.slice(lastCut,i), path: points.slice(lastCut,i),
@ -191,26 +184,21 @@ var WPGPXMAPS = {
polylinenes.push( poly ); polylinenes.push( poly );
lastCut = i; lastCut = i;
polyline_number = polyline_number +1; polyline_number = polyline_number +1;
//var p = new google.maps.LatLng(mapData[i-1][0], mapData[i-1][1]); //var p = new google.maps.LatLng(mapData[i-1][0], mapData[i-1][1]);
//points.push(p); //points.push(p);
//bounds.extend(p); //bounds.extend(p);
} } else {
else
{
var p = new google.maps.LatLng( mapData[i][0], mapData[i][1]); var p = new google.maps.LatLng( mapData[i][0], mapData[i][1]);
points.push( p ); points.push( p );
bounds.extend( p ); bounds.extend( p );
} }
} }
if (points.length != lastCut) if ( points.length != lastCut ) {
{ if ( polyline_number < color1.length ) {
if ( polyline_number < color1.length)
{
color = color1[polyline_number]; color = color1[polyline_number];
} } else {
else
{
color = color1[color1.length - 1]; color = color1[color1.length - 1];
} }
var poly = new google.maps.Polyline({ var poly = new google.maps.Polyline({
@ -226,8 +214,7 @@ var WPGPXMAPS = {
polyline_number = polyline_number + 1; polyline_number = polyline_number + 1;
} }
if (startIcon != '') if ( startIcon != '' ) {
{
var startIconImage = new google.maps.MarkerImage( startIcon ); var startIconImage = new google.maps.MarkerImage( startIcon );
var startMarker = new google.maps.Marker({ var startMarker = new google.maps.Marker({
position: points[0], position: points[0],
@ -240,8 +227,7 @@ var WPGPXMAPS = {
} }
if (endIcon != '') if ( endIcon != '' ) {
{
var endIconImage = new google.maps.MarkerImage( endIcon ); var endIconImage = new google.maps.MarkerImage( endIcon );
var startMarker = new google.maps.Marker({ var startMarker = new google.maps.Marker({
position: points[ points.length -1 ], position: points[ points.length -1 ],
@ -256,8 +242,7 @@ var WPGPXMAPS = {
var first = WPGPXMAPS.Utils.GetItemFromArray( mapData, 0 ) var first = WPGPXMAPS.Utils.GetItemFromArray( mapData, 0 )
if (currentIcon == '') if ( currentIcon == '' ) {
{
currentIcon = "https://maps.google.com/mapfiles/kml/pal4/icon25.png"; currentIcon = "https://maps.google.com/mapfiles/kml/pal4/icon25.png";
} }
@ -275,30 +260,24 @@ var WPGPXMAPS = {
zIndex: 10 zIndex: 10
}); });
for (i=0; i < polylinenes.length; i++) for ( i = 0; i < polylinenes.length; i++ ) {
{
google.maps.event.addListener( polylinenes[i], 'mouseover', function( event ) { google.maps.event.addListener( polylinenes[i], 'mouseover', function( event ) {
if (marker) if ( marker ) {
{
marker.setPosition( event.latLng ); marker.setPosition( event.latLng );
marker.setTitle( lng.currentPosition ); marker.setTitle( lng.currentPosition );
if (myChart) if ( myChart ) {
{
var l1 = event.latLng.lat(); var l1 = event.latLng.lat();
var l2 = event.latLng.lng(); var l2 = event.latLng.lng();
var ci = getClosestIndex(mapData,l1,l2); var ci = getClosestIndex(mapData,l1,l2);
var activeElements = []; var activeElements = [];
var seriesLen = myChart.data.datasets.length; var seriesLen = myChart.data.datasets.length;
for(var i=0; i<seriesLen;i++) for ( var i = 0; i<seriesLen;i++ ) {
{
activeElements.push( myChart.chart.getDatasetMeta( i ).data[ci] ); activeElements.push( myChart.chart.getDatasetMeta( i ).data[ci] );
} }
if (activeElements.length > 0) if ( activeElements.length > 0) {
{
myChart.options.customLine.x = activeElements[0]._model.x; myChart.options.customLine.x = activeElements[0]._model.x;
if (isNaN(myChart.tooltip._eventPosition)) if ( isNaN( myChart.tooltip._eventPosition ) ) {
{
myChart.tooltip._eventPosition = { myChart.tooltip._eventPosition = {
x: activeElements[0]._model.x, x: activeElements[0]._model.x,
y: activeElements[0]._model.y y: activeElements[0]._model.y
@ -315,14 +294,11 @@ var WPGPXMAPS = {
} }
},
this.AddWaypoints = function( waypoints, waypointIcon ) {
}, },
this.AddWaypoints = function(waypoints, waypointIcon) this.MoveMarkerToPosition = function( LatLon, updateChart ) {
{
},
this.MoveMarkerToPosition = function(LatLon, updateChart)
{
} }
}, },
@ -345,6 +321,7 @@ var WPGPXMAPS = {
// create fullscreen control // create fullscreen control
var fsControl = new L.Control.FullScreen(); var fsControl = new L.Control.FullScreen();
// add fullscreen control to the map // add fullscreen control to the map
this.map.addControl( fsControl ); this.map.addControl( fsControl );
@ -360,48 +337,45 @@ var WPGPXMAPS = {
var defaultMpaLayer = null; var defaultMpaLayer = null;
if (hasThunderforestApiKey) if ( hasThunderforestApiKey ) {
{ baseMaps['Open Cycle Map'] = L.tileLayer( 'https://a.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + ThunderforestApiKey, {
baseMaps["Open Cycle Map"] = L.tileLayer('https://a.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + ThunderforestApiKey, {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
baseMaps["Open Cycle Map - Transport"] = L.tileLayer('https://a.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=' + ThunderforestApiKey, { baseMaps['Open Cycle Map - Transport'] = L.tileLayer( 'https://a.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=' + ThunderforestApiKey, {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
baseMaps["Open Cycle Map - Landscape"] = L.tileLayer('https://a.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + ThunderforestApiKey, { baseMaps['Open Cycle Map - Landscape'] = L.tileLayer( 'https://a.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + ThunderforestApiKey, {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
} } else {
else
{
baseMaps["Open Cycle Map"] = L.tileLayer('http://a.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png', { baseMaps['Open Cycle Map'] = L.tileLayer( 'http://a.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
baseMaps["Open Cycle Map - Transport"] = L.tileLayer('https://a.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png', { baseMaps['Open Cycle Map - Transport'] = L.tileLayer( 'https://a.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
baseMaps["Open Cycle Map - Landscape"] = L.tileLayer('https://a.tile3.opencyclemap.org/landscape/{z}/{x}/{y}.png', { baseMaps['Open Cycle Map - Landscape'] = L.tileLayer( 'https://a.tile3.opencyclemap.org/landscape/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
@ -410,7 +384,7 @@ var WPGPXMAPS = {
} }
baseMaps["Open Street Map"] = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { baseMaps['Open Street Map'] = L.tileLayer( 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
@ -418,21 +392,21 @@ var WPGPXMAPS = {
}); });
baseMaps["MapToolKit - Terrain"] = L.tileLayer('https://tile2.maptoolkit.net/terrain/{z}/{x}/{y}.png', { baseMaps['MapToolKit - Terrain'] = L.tileLayer( 'https://tile2.maptoolkit.net/terrain/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
baseMaps["Humanitarian Map Style"] = L.tileLayer('https://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', { baseMaps['Humanitarian Map Style'] = L.tileLayer( 'https://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
/* /*
baseMaps["Open Ski Map"] = L.tileLayer('http://tiles.skimap.org/openskimap/{z}/{x}/{y}.png', { baseMaps['Open Ski Map'] = L.tileLayer( 'http://tiles.skimap.org/openskimap/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
@ -440,14 +414,14 @@ var WPGPXMAPS = {
}); });
*/ */
baseMaps["Hike & Bike"] = L.tileLayer('http://toolserver.org/tiles/hikebike/{z}/{x}/{y}.png', { baseMaps['Hike & Bike'] = L.tileLayer( 'http://toolserver.org/tiles/hikebike/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
}); });
baseMaps["Open Sea Map"] = L.tileLayer('http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', { baseMaps['Open Sea Map'] = L.tileLayer( 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
@ -455,47 +429,46 @@ var WPGPXMAPS = {
}); });
switch (mapType) switch ( mapType ) {
{
case 'OSM1': { case 'OSM1': {
baseMaps["Open Street Map"].addTo(this.map); baseMaps['Open Street Map'].addTo( this.map );
break; break;
} }
case 'OSM2': { case 'OSM2': {
baseMaps["Open Cycle Map"].addTo(this.map); baseMaps['Open Cycle Map'].addTo( this.map );
break; break;
} }
case 'OSM4': { case 'OSM4': {
baseMaps["Open Cycle Map - Transport"].addTo(this.map); baseMaps['Open Cycle Map - Transport'].addTo( this.map );
break; break;
} }
case 'OSM5': { case 'OSM5': {
baseMaps["Open Cycle Map - Landscape"].addTo(this.map); baseMaps['Open Cycle Map - Landscape'].addTo( this.map );
break; break;
} }
case 'OSM6': { case 'OSM6': {
baseMaps["MapToolKit - Terrain"].addTo(this.map); baseMaps['MapToolKit - Terrain'].addTo( this.map );
break; break;
} }
case 'OSM7': { case 'OSM7': {
baseMaps["Humanitarian Map Style"].addTo(this.map); baseMaps['Humanitarian Map Style'].addTo( this.map );
break; break;
} }
case 'OSM8': { case 'OSM8': {
baseMaps["Open Ski Map"].addTo(this.map); baseMaps['Open Ski Map'].addTo( this.map );
break; break;
} }
case 'OSM9': { case 'OSM9': {
baseMaps["Hike & Bike"].addTo(this.map); baseMaps['Hike & Bike'].addTo( this.map );
break; break;
} }
case 'OSM10': { case 'OSM10': {
baseMaps["Open Sea Map"].addTo(this.map); baseMaps['Open Sea Map'].addTo( this.map );
break; break;
} }
default: { default: {
baseMaps["Open Street Map"].addTo(this.map); baseMaps['Open Street Map'].addTo( this.map );
} }
} }
@ -505,10 +478,9 @@ var WPGPXMAPS = {
this.AppPolylines = function( mapData, color1, currentIcon, startIcon, endIcon ) { this.AppPolylines = function( mapData, color1, currentIcon, startIcon, endIcon ) {
var first = WPGPXMAPS.Utils.GetItemFromArray(mapData,0) var first = WPGPXMAPS.Utils.GetItemFromArray( mapData, 0 );
if (currentIcon == '') if ( currentIcon == '' ) {
{
currentIcon = "https://maps.google.com/mapfiles/kml/pal4/icon25.png"; currentIcon = "https://maps.google.com/mapfiles/kml/pal4/icon25.png";
} }
@ -519,7 +491,7 @@ var WPGPXMAPS = {
}) })
}); });
CurrentPositionMarker.addTo( this.map ); CurrentPositionMarker.addTo( this.map );
CurrentPositionMarker.title = "Start"; CurrentPositionMarker.title = 'Start';
this.CurrentPositionMarker = CurrentPositionMarker; this.CurrentPositionMarker = CurrentPositionMarker;
@ -532,20 +504,14 @@ var WPGPXMAPS = {
this.CenterMap(); this.CenterMap();
for (i=0; i < pointsArray.length; i++) for ( i = 0; i < pointsArray.length; i++ ) {
{
if ( i < color1.length) if ( i < color1.length ) {
{
color = color1[i]; color = color1[i];
} } else {
else
{
color = color1[color1.length - 1]; color = color1[color1.length - 1];
} }
try {
try
{
var polyline = L.polyline( pointsArray[i], {color: color} ).addTo( this.map ); var polyline = L.polyline( pointsArray[i], {color: color} ).addTo( this.map );
this.Polylines.push( polyline ); this.Polylines.push( polyline );
@ -554,14 +520,12 @@ var WPGPXMAPS = {
this.Polylines[i].on('mousemove', function( e ) { this.Polylines[i].on('mousemove', function( e ) {
context.MoveMarkerToPosition( [e.latlng.lat, e.latlng.lng], true ); context.MoveMarkerToPosition( [e.latlng.lat, e.latlng.lng], true );
}); });
} } catch ( err ) {
catch(err) {
} }
} }
if (startIcon != '') if ( startIcon != '' ) {
{
var startMarker = L.marker( mapData[0], {icon: L.icon( { var startMarker = L.marker( mapData[0], {icon: L.icon( {
iconUrl: startIcon, iconUrl: startIcon,
@ -570,13 +534,12 @@ var WPGPXMAPS = {
}) })
}); });
startMarker.addTo( this.map ); startMarker.addTo( this.map );
startMarker.title = "Start"; startMarker.title = 'Start';
} }
if (endIcon != '') if ( endIcon != '' ) {
{
var endMarker = L.marker( mapData[ mapData.length - 1 ], {icon: L.icon( { var endMarker = L.marker( mapData[ mapData.length - 1 ], {icon: L.icon( {
iconUrl: endIcon, iconUrl: endIcon,
@ -585,7 +548,7 @@ var WPGPXMAPS = {
}) })
}); });
endMarker.addTo( this.map ); endMarker.addTo( this.map );
endMarker.title = "End"; endMarker.title = 'End';
} }
@ -648,8 +611,7 @@ var WPGPXMAPS = {
}, },
this.AddWaypoints = function(waypoints, waypointIcon) this.AddWaypoints = function( waypoints, waypointIcon ) {
{
var icon = L.icon({ var icon = L.icon({
iconUrl: 'https://maps.google.com/mapfiles/ms/micons/flag.png', iconUrl: 'https://maps.google.com/mapfiles/ms/micons/flag.png',
@ -657,8 +619,7 @@ var WPGPXMAPS = {
iconAnchor: [16, 16], // point of the icon which will correspond to marker's location iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
}); });
if (waypointIcon!='') if ( waypointIcon!='' ) {
{
icon = L.icon({ icon = L.icon({
iconUrl: 'waypointIcon', iconUrl: 'waypointIcon',
iconSize: [32, 32], // size of the icon iconSize: [32, 32], // size of the icon
@ -685,12 +646,9 @@ var WPGPXMAPS = {
var cnt = ''; var cnt = '';
if (wpt.name=='') if ( wpt.name=='' ) {
{
cnt = "<div>" + unescape( wpt.desc ) + "</div>"; cnt = "<div>" + unescape( wpt.desc ) + "</div>";
} } else {
else
{
cnt = "<div><b>" + wpt.name + "</b><br />" + unescape( wpt.desc ) + "</div>"; cnt = "<div><b>" + wpt.name + "</b><br />" + unescape( wpt.desc ) + "</div>";
} }
@ -717,10 +675,9 @@ var WPGPXMAPS = {
this.EventSelectChart( LatLon ); this.EventSelectChart( LatLon );
}, },
this.CenterMap = function() this.CenterMap = function() {
{
this.map.fitBounds( this.Bounds ); this.map.fitBounds( this.Bounds );
} };
} }
@ -779,40 +736,35 @@ var WPGPXMAPS = {
var l_hr = { suf : "", dec : 0 }; var l_hr = { suf : "", dec : 0 };
var l_cad = { suf : "", dec : 0 }; var l_cad = { suf : "", dec : 0 };
var el = document.getElementById("wpgpxmaps_" + targetId); var el = document.getElementById('wpgpxmaps_' + targetId);
var el_map = document.getElementById("map_" + targetId); var el_map = document.getElementById('map_' + targetId);
var el_chart = document.getElementById("chart_" + targetId); var el_chart = document.getElementById('chart_' + targetId);
var el_report = document.getElementById("report_" + targetId); var el_report = document.getElementById('report_' + targetId);
var el_osm_credits = document.getElementById("wpgpxmaps_" + targetId + "_osm_footer"); var el_osm_credits = document.getElementById('wpgpxmaps_' + targetId + '_osm_footer');
var mapWidth = el_map.style.width; var mapWidth = el_map.style.width;
var map = new WPGPXMAPS.MapEngines.Leaflet(); var map = new WPGPXMAPS.MapEngines.Leaflet();
map.lng = lng; map.lng = lng;
map.init("map_" + targetId, map.init( 'map_' + targetId,
mapType, mapType,
( zoomOnScrollWheel == 'true' ), ( zoomOnScrollWheel == 'true' ),
ThunderforestApiKey); ThunderforestApiKey);
map.EventSelectChart = function(LatLon) map.EventSelectChart = function( LatLon ) {
{
if (myChart) if ( myChart ) {
{
var l1 = LatLon[0]; var l1 = LatLon[0];
var l2 = LatLon[1]; var l2 = LatLon[1];
var ci = getClosestIndex( mapData, l1, l2 ); var ci = getClosestIndex( mapData, l1, l2 );
var activeElements = []; var activeElements = [];
var seriesLen = myChart.data.datasets.length; var seriesLen = myChart.data.datasets.length;
for(var i=0; i<seriesLen;i++) for ( var i = 0; i < seriesLen;i++ ) {
{
activeElements.push( myChart.chart.getDatasetMeta( i ).data[ci]); activeElements.push( myChart.chart.getDatasetMeta( i ).data[ci]);
} }
if (activeElements.length > 0) if ( activeElements.length > 0 ) {
{
myChart.options.customLine.x = activeElements[0]._model.x; myChart.options.customLine.x = activeElements[0]._model.x;
if (isNaN(myChart.tooltip._eventPosition)) if ( isNaN( myChart.tooltip._eventPosition ) ) {
{
myChart.tooltip._eventPosition = { myChart.tooltip._eventPosition = {
x: activeElements[0]._model.x, x: activeElements[0]._model.x,
y: activeElements[0]._model.y y: activeElements[0]._model.y
@ -829,42 +781,36 @@ var WPGPXMAPS = {
//var bounds = new google.maps.LatLngBounds(); //var bounds = new google.maps.LatLngBounds();
if ( usegpsposition == "true" ) if ( usegpsposition == 'true' ) {
{
// Try HTML5 geolocation // Try HTML5 geolocation
if ( navigator.geolocation ) { if ( navigator.geolocation ) {
var context = map; var context = map;
navigator.geolocation.watchPosition(function(position) navigator.geolocation.watchPosition( function( position ) {
{
var radius = position.coords.accuracy / 2; var radius = position.coords.accuracy / 2;
// user position // user position
var pos = [ position.coords.latitude, position.coords.longitude ]; var pos = [ position.coords.latitude, position.coords.longitude ];
if (context.CurrentGPSPositionMarker == null) if ( context.CurrentGPSPositionMarker == null ) {
{ if ( currentpositioncon == '' ) {
if (currentpositioncon == '')
{
currentpositioncon = "https://maps.google.com/mapfiles/kml/pal4/icon25.png"; currentpositioncon = "https://maps.google.com/mapfiles/kml/pal4/icon25.png";
} }
context.CurrentGPSPositionMarker = L.marker(pos, {icon: L.icon({ context.CurrentGPSPositionMarker = L.marker(pos, {icon: L.icon({
iconUrl: currentpositioncon, iconUrl: currentpositioncon,
iconSize: [ 32, 32 ], // size of the icon iconSize: [ 32, 32 ], // size of the icon
iconAnchor: [16, 16], // point of the icon which will correspond to marker's location iconAnchor: [ 16, 16 ] // point of the icon which will correspond to marker's location
}) })
}) })
.addTo( context.map ) .addTo( context.map )
.bindPopup( lng.currentPosition ) .bindPopup( lng.currentPosition )
.openPopup(); .openPopup();
} } else {
else
{
context.CurrentGPSPositionMarker.setLatLng( pos ); context.CurrentGPSPositionMarker.setLatLng( pos );
} }
@ -874,6 +820,7 @@ var WPGPXMAPS = {
}, },
function( e ) { function( e ) {
// some errors // some errors
}, },
{ {
@ -887,8 +834,7 @@ var WPGPXMAPS = {
// Print WayPoints // Print WayPoints
if (!jQuery.isEmptyObject(waypoints) && waypoints.length > 0) if ( ! jQuery.isEmptyObject( waypoints ) && waypoints.length > 0 ) {
{
map.AddWaypoints( waypoints, waypointIcon ); map.AddWaypoints( waypoints, waypointIcon );
} }

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
#, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: wp-gpx-maps\n" "Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-30 14:41+0100\n" "POT-Creation-Date: 2019-06-12 18:57+0200\n"
"PO-Revision-Date: 2012-10-30 14:41+0100\n" "PO-Revision-Date: 2012-10-30 14:41+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -11,82 +12,945 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n" "X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n" "X-Poedit-Basepath: .\n"
"X-Generator: Poedit 2.2.3\n"
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
"X-Poedit-SearchPath-0: ..\n" "X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:467 #: ../wp-gpx-maps.php:53 ../wp-gpx-maps_admin.php:50
#: ../wp-gpx-maps_admin.php:102
msgid "Settings"
msgstr ""
#: ../wp-gpx-maps.php:737
msgid "Altitude" msgid "Altitude"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:468 #: ../wp-gpx-maps.php:738
msgid "Current Position" msgid "Current position"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:469 #: ../wp-gpx-maps.php:739
msgid "Speed" msgid "Speed"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:470 #: ../wp-gpx-maps.php:740
msgid "Grade"
msgstr ""
#: ../wp-gpx-maps.php:741
msgid "Heart rate" msgid "Heart rate"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:471 #: ../wp-gpx-maps.php:742
msgid "Temperature"
msgstr ""
#: ../wp-gpx-maps.php:743
msgid "Cadence" msgid "Cadence"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:472 #: ../wp-gpx-maps.php:744
msgid "Go Full Screen" msgid "Go full screen"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:473 #: ../wp-gpx-maps.php:745
msgid "Exit Full Screen" msgid "Exit full screen"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:474 #: ../wp-gpx-maps.php:746
msgid "Hide Images" msgid "Hide images"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:475 #: ../wp-gpx-maps.php:747
msgid "Show Images" msgid "Show images"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:476 #: ../wp-gpx-maps.php:748
msgid "Back to center" msgid "Back to center"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:489 #: ../wp-gpx-maps.php:761
msgid "Total distance" msgid "Total distance"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:494 #: ../wp-gpx-maps.php:765
msgid "Max elevation" msgid "Max elevation"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:496 #: ../wp-gpx-maps.php:767
msgid "Min elevation" msgid "Min elevation"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:498 #: ../wp-gpx-maps.php:769
msgid "Total climbing" msgid "Total climbing"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:500 #: ../wp-gpx-maps.php:771
msgid "Total descent" msgid "Total descent"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:504 #: ../wp-gpx-maps.php:774
msgid "Average speed" msgid "Average speed"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:509 #: ../wp-gpx-maps.php:777
msgid "Total Time" msgid "Average cadence"
msgstr "" msgstr ""
#: ../wp-gpx-maps.php:525 #: ../wp-gpx-maps.php:780
msgid "Average heart rate"
msgstr ""
#: ../wp-gpx-maps.php:783
msgid "Average temperature"
msgstr ""
#: ../wp-gpx-maps.php:787
msgid "Total time"
msgstr ""
#: ../wp-gpx-maps.php:801 ../wp-gpx-maps_admin_tracks.php:183
msgid "Download" msgid "Download"
msgstr "" msgstr ""
#: ../wp-gpx-maps_admin_settings.php:83 ../wp-gpx-maps_admin_settings.php:151 #: ../wp-gpx-maps_admin.php:49 ../wp-gpx-maps_admin.php:56
#: ../wp-gpx-maps_admin_settings.php:229 ../wp-gpx-maps_admin_settings.php:333 msgid "Tracks"
#: ../wp-gpx-maps_admin_settings.php:364 msgstr ""
#: ../wp-gpx-maps_admin.php:51 ../wp-gpx-maps_admin.php:57
msgid "Help"
msgstr ""
#. translators: Relative path of the GPX folder
#: ../wp-gpx-maps_admin.php:116
#, php-format
msgid "Can not create the folder %1s for GPX files. Please create the folder and make it writable! If not, you will must update the files manually!"
msgstr ""
#. translators: Relative path of the GPX cache folder
#: ../wp-gpx-maps_admin.php:133
#, php-format
msgid "Can not create the cache folder %1s for the GPX files. Please create the folder and make it writable! If not, you will must update the files manually!"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:56 ../wp-gpx-maps_help.php:64
msgid "General"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:62
msgid "Map width:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:71
msgid "Map height:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:80
msgid "Graph height:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:89
msgid "Distance type:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:93
msgid "Normal (default)"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:94
msgid "Flat &#8594; (Only flat distance, don&#8217;t take care of altitude)"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:95
msgid "Climb &#8593; (Only climb distance)"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:102
msgid "Cache:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:109
msgid "Do not use cache"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:117
msgid "GPX Download:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:124 ../wp-gpx-maps_help.php:119
msgid "Allow users to download your GPX file"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:132
msgid "Use browser GPS position:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:139
msgid "Allow users to use browser GPS in order to display their current position on map"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:147
msgid "Thunderforest API Key (Open Cycle Map):"
msgstr ""
#. translators: 1: Link to documentation of Thunderforest API Key's 2: Additional link attribute
#: ../wp-gpx-maps_admin_settings.php:155
msgid "Go to <a href=\"%1$1s\" %2&2s>Thunderforest API Key</a> and signing in to your Thunderforest account."
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:169 ../wp-gpx-maps_admin_settings.php:353
#: ../wp-gpx-maps_admin_settings.php:529 ../wp-gpx-maps_admin_settings.php:747
#: ../wp-gpx-maps_admin_settings.php:815
msgid "Save Changes" msgid "Save Changes"
msgstr "" msgstr ""
#: ../wp-gpx-maps_admin_settings.php:180 ../wp-gpx-maps_help.php:547
msgid "Summary table"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:186
msgid "Summary table:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:193 ../wp-gpx-maps_help.php:566
msgid "Print summary details of your GPX track"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:201
msgid "Total distance:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:208
msgid "Print total distance"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:216
msgid "Max elevation:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:223
msgid "Print max elevation"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:231
msgid "Min elevation:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:238
msgid "Print min elevation"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:246
msgid "Total climbing:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:253
msgid "Print total climbing"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:261
msgid "Total descent:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:268
msgid "Print total descent"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:275
msgid "Average speed:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:282
msgid "Print average speed"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:290
msgid "Average cadence:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:297
msgid "Print average cadence"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:305
msgid "Average heart rate:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:312
msgid "Print average heart rate"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:320
msgid "Average temperature:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:327
msgid "Print average temperature"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:335
msgid "Total time:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:342
msgid "Print total time"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:364 ../wp-gpx-maps_help.php:148
msgid "Map"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:371
msgid "Default map type:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:377 ../wp-gpx-maps_help.php:172
msgid "Open Street Map"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:383 ../wp-gpx-maps_help.php:174
msgid "Open Cycle Map"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:389 ../wp-gpx-maps_help.php:176
msgid "Open Cycle Map - Transport"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:395 ../wp-gpx-maps_help.php:178
msgid "Open Cycle Map - Landscape"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:401 ../wp-gpx-maps_help.php:180
msgid "MapToolKit - Terrain"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:407 ../wp-gpx-maps_help.php:182
msgid "Open Street Map - Humanitarian map style"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:413 ../wp-gpx-maps_help.php:184
msgid "Hike & Bike"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:419 ../wp-gpx-maps_help.php:186
msgid "Open Sea Map"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:427
msgid "Map line color:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:436
msgid "On mouse scroll wheel:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:443
msgid "Enable zoom"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:451
msgid "Waypoints support:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:458
msgid "Show waypoints"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:466
msgid "Start track icon:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:471 ../wp-gpx-maps_admin_settings.php:483
#: ../wp-gpx-maps_admin_settings.php:495 ../wp-gpx-maps_admin_settings.php:507
#: ../wp-gpx-maps_admin_settings.php:519
msgid "(URL to image) Leave empty to hide."
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:478
msgid "End track icon:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:490
msgid "Current position icon:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:502
msgid "Current GPS position icon:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:514
msgid "Custom waypoint icon:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:539
msgid "Chart"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:546
msgid "Altitude:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:553
msgid "Show altitude"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:562
msgid "Altitude line color:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:571
msgid "Unit of measure:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:575 ../wp-gpx-maps_help.php:311
msgid "meters / meters"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:576 ../wp-gpx-maps_help.php:313
msgid "feet / miles"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:577 ../wp-gpx-maps_help.php:315
msgid "meters / kilometers"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:578 ../wp-gpx-maps_help.php:317
msgid "meters / nautical miles"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:579 ../wp-gpx-maps_help.php:319
msgid "meters / miles"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:580 ../wp-gpx-maps_help.php:321
msgid "feet / nautical miles"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:587
msgid "Altitude display offset:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:590 ../wp-gpx-maps_admin_settings.php:638
msgid "From"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:592 ../wp-gpx-maps_admin_settings.php:640
msgid "to"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:594 ../wp-gpx-maps_admin_settings.php:642
msgid "(leave empty for auto scale)"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:600
msgid "Speed:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:603
msgid "Show speed"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:609
msgid "Speed line color:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:618
msgid "Speed unit of measure:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:622 ../wp-gpx-maps_help.php:371
msgid "m/s"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:623 ../wp-gpx-maps_help.php:373
msgid "km/h"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:624 ../wp-gpx-maps_help.php:375
msgid "miles/h"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:625 ../wp-gpx-maps_help.php:377
msgid "min/km"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:626 ../wp-gpx-maps_help.php:379
msgid "min/miles"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:627 ../wp-gpx-maps_help.php:381
msgid "Knots (nautical miles / hour)"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:628 ../wp-gpx-maps_help.php:383
msgid "min/100 meters"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:635
msgid "Speed display offset:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:648
msgid "Heart rate (where aviable):"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:655
msgid "Show heart rate"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:663
msgid "Heart rate line color:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:672
msgid "Temperature (where aviable):"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:679
msgid "Show temperature"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:687
msgid "Temperature line color:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:696
msgid "Cadence (where aviable):"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:703
msgid "Show cadence"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:711
msgid "Cadence line color:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:720
msgid "Grade:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:727
msgid "Show grade - BETA (Grade values depends on your GPS accuracy. If you have a poor GPS accuracy they might be totally wrong!)"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:735
msgid "Grade line color:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:757
msgid "Advanced Options"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:760
msgid "(Do not edit if you don&#8217;t know what you are doing!)"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:767
msgid "Skip GPX points closer than:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:774
msgid "meters"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:782
msgid "Reduce GPX:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:789
msgid "Do not reduce GPX"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:797
msgid "User upload:"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:804
msgid "Allow registered user to upload GPX files"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:30
msgid "Cache is now empty!"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:45
msgid "Choose a file to upload:"
msgstr ""
#. translators: GPX file name
#: ../wp-gpx-maps_admin_tracks.php:57
#, php-format
msgid "The file %1s has been successfully uploaded."
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:63
msgid "There was an error uploading the file, please try again!"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:68
msgid "The file type is not supported!"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:77
msgid "Clear Cache"
msgstr ""
#. translators: Relative path of the GPX folder
#: ../wp-gpx-maps_admin_tracks.php:94
#, php-format
msgid "Your folder for GPX files %1s is not writable. Please change the folder permissions."
msgstr ""
#. translators: GPX file name
#: ../wp-gpx-maps_admin_tracks.php:121
#, php-format
msgid "The file %1s has been successfully deleted."
msgstr ""
#. translators: GPX file name
#: ../wp-gpx-maps_admin_tracks.php:129
#, php-format
msgid "The file %1s could not be deleted."
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:167
msgid "Uploading file..."
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:175
msgid "File"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:181
msgid "Delete"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:185
msgid "Copy shortcode"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:185
msgid "Shortcode:"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:191
msgid "Last modified"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:199
msgid "File size"
msgstr ""
#: ../wp-gpx-maps_admin_tracks.php:209
msgid "Are you sure you want to delete the file?"
msgstr ""
#: ../wp-gpx-maps_help.php:4
msgid "FAQ"
msgstr ""
#: ../wp-gpx-maps_help.php:8
msgid "How can I upload the GPX files?"
msgstr ""
#: ../wp-gpx-maps_help.php:11
msgid "1. Method: Upload the GPX file using the uploader in the tab \"Tracks\"."
msgstr ""
#: ../wp-gpx-maps_help.php:16
msgid "2. Method: Upload the GPX file via FTP to your upload folder:"
msgstr ""
#: ../wp-gpx-maps_help.php:22
msgid "How can I use the GPX files?"
msgstr ""
#: ../wp-gpx-maps_help.php:25
msgid "Go to the tab \"Tracks\" and copy the shortcode from the list and paste it in the page or post."
msgstr ""
#: ../wp-gpx-maps_help.php:30
msgid "You can manually set the relative path to your GPX file. Please use this scheme:"
msgstr ""
#: ../wp-gpx-maps_help.php:36
msgid "Can I also integrate GPX files from other sites?"
msgstr ""
#: ../wp-gpx-maps_help.php:41
msgid "Yes, it&#8217s possible. Please use this scheme:"
msgstr ""
#: ../wp-gpx-maps_help.php:47
msgid "Can I change the attributes for each GPX shortcode?"
msgstr ""
#: ../wp-gpx-maps_help.php:50
msgid "Yes, it&#8217s possible. These changes ignore the default settings for each attribute."
msgstr ""
#: ../wp-gpx-maps_help.php:55
msgid "The Full set of optional attributes can be found below. Please use this scheme:"
msgstr ""
#: ../wp-gpx-maps_help.php:58
msgid "read below all the optional attributes"
msgstr ""
#: ../wp-gpx-maps_help.php:71 ../wp-gpx-maps_help.php:155
#: ../wp-gpx-maps_help.php:270 ../wp-gpx-maps_help.php:492
#: ../wp-gpx-maps_help.php:554 ../wp-gpx-maps_help.php:719
msgid "Shortcode"
msgstr ""
#: ../wp-gpx-maps_help.php:74 ../wp-gpx-maps_help.php:158
#: ../wp-gpx-maps_help.php:273 ../wp-gpx-maps_help.php:495
#: ../wp-gpx-maps_help.php:557 ../wp-gpx-maps_help.php:722
msgid "Description"
msgstr ""
#: ../wp-gpx-maps_help.php:77 ../wp-gpx-maps_help.php:161
#: ../wp-gpx-maps_help.php:276 ../wp-gpx-maps_help.php:498
#: ../wp-gpx-maps_help.php:560 ../wp-gpx-maps_help.php:725
msgid "Possible values"
msgstr ""
#: ../wp-gpx-maps_help.php:83
msgid "relative path to the GPX file"
msgstr ""
#: ../wp-gpx-maps_help.php:92
msgid "Map width"
msgstr ""
#: ../wp-gpx-maps_help.php:95 ../wp-gpx-maps_help.php:104
#: ../wp-gpx-maps_help.php:113
msgid "Value in pixels"
msgstr ""
#: ../wp-gpx-maps_help.php:101
msgid "Map height"
msgstr ""
#: ../wp-gpx-maps_help.php:110
msgid "Graph height"
msgstr ""
#: ../wp-gpx-maps_help.php:123 ../wp-gpx-maps_help.php:136
#: ../wp-gpx-maps_help.php:197 ../wp-gpx-maps_help.php:210
#: ../wp-gpx-maps_help.php:223 ../wp-gpx-maps_help.php:286
#: ../wp-gpx-maps_help.php:299 ../wp-gpx-maps_help.php:346
#: ../wp-gpx-maps_help.php:359 ../wp-gpx-maps_help.php:408
#: ../wp-gpx-maps_help.php:421 ../wp-gpx-maps_help.php:434
#: ../wp-gpx-maps_help.php:447 ../wp-gpx-maps_help.php:460
#: ../wp-gpx-maps_help.php:473 ../wp-gpx-maps_help.php:526
#: ../wp-gpx-maps_help.php:570 ../wp-gpx-maps_help.php:583
#: ../wp-gpx-maps_help.php:596 ../wp-gpx-maps_help.php:609
#: ../wp-gpx-maps_help.php:622 ../wp-gpx-maps_help.php:635
#: ../wp-gpx-maps_help.php:648 ../wp-gpx-maps_help.php:661
#: ../wp-gpx-maps_help.php:674 ../wp-gpx-maps_help.php:687
#: ../wp-gpx-maps_help.php:700 ../wp-gpx-maps_help.php:735
#: ../wp-gpx-maps_help.php:748
msgid "Default is:"
msgstr ""
#: ../wp-gpx-maps_help.php:132
msgid "Do not use cache. If TRUE might be very slow"
msgstr ""
#: ../wp-gpx-maps_help.php:167
msgid "Map type"
msgstr ""
#: ../wp-gpx-maps_help.php:193
msgid "Map line color"
msgstr ""
#: ../wp-gpx-maps_help.php:206
msgid "Zoom on map when mouse scroll wheel"
msgstr ""
#: ../wp-gpx-maps_help.php:219
msgid "Print the GPX waypoints inside the map"
msgstr ""
#: ../wp-gpx-maps_help.php:232
msgid "Start track icon"
msgstr ""
#: ../wp-gpx-maps_help.php:239
msgid "End track icon"
msgstr ""
#: ../wp-gpx-maps_help.php:246
msgid "Current position icon (when mouse hover)"
msgstr ""
#: ../wp-gpx-maps_help.php:253
msgid "Custom waypoint icon"
msgstr ""
#: ../wp-gpx-maps_help.php:263
msgid "Diagram"
msgstr ""
#: ../wp-gpx-maps_help.php:282
msgid "Show elevation data inside the chart"
msgstr ""
#: ../wp-gpx-maps_help.php:295
msgid "Altitude line color"
msgstr ""
#: ../wp-gpx-maps_help.php:308
msgid "Distance / Altitude unit of measure"
msgstr ""
#: ../wp-gpx-maps_help.php:328
msgid "Minimum value for altitude chart"
msgstr ""
#: ../wp-gpx-maps_help.php:335
msgid "Maximum value for altitude chart"
msgstr ""
#: ../wp-gpx-maps_help.php:342
msgid "Show speed inside the chart"
msgstr ""
#: ../wp-gpx-maps_help.php:355
msgid "Speed line color"
msgstr ""
#: ../wp-gpx-maps_help.php:368
msgid "Speed unit of measure"
msgstr ""
#: ../wp-gpx-maps_help.php:390
msgid "Minimum value for speed chart"
msgstr ""
#: ../wp-gpx-maps_help.php:397
msgid "Maximum value for speed chart"
msgstr ""
#: ../wp-gpx-maps_help.php:404
msgid "Show heart rate inside the chart"
msgstr ""
#: ../wp-gpx-maps_help.php:417
msgid "Heart rate line color"
msgstr ""
#: ../wp-gpx-maps_help.php:430
msgid "Show cadence inside the chart"
msgstr ""
#: ../wp-gpx-maps_help.php:443
msgid "Cadence line color"
msgstr ""
#: ../wp-gpx-maps_help.php:456
msgid "Show grade inside the chart"
msgstr ""
#: ../wp-gpx-maps_help.php:469
msgid "Grade line color"
msgstr ""
#: ../wp-gpx-maps_help.php:485
msgid "Pictures"
msgstr ""
#: ../wp-gpx-maps_help.php:504
msgid "NextGen Gallery"
msgstr ""
#: ../wp-gpx-maps_help.php:507
msgid "Gallery ID or a list of Galleries ID separated by a comma"
msgstr ""
#: ../wp-gpx-maps_help.php:513
msgid "NextGen Image"
msgstr ""
#: ../wp-gpx-maps_help.php:516
msgid "Image ID or a list of Images ID separated by a comma"
msgstr ""
#: ../wp-gpx-maps_help.php:522
msgid "Show all images that are attached to post"
msgstr ""
#: ../wp-gpx-maps_help.php:535
msgid "The difference between your GPX tool date and your camera date"
msgstr ""
#: ../wp-gpx-maps_help.php:538
msgid "Value in seconds"
msgstr ""
#: ../wp-gpx-maps_help.php:579
msgid "Print total distance in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:592
msgid "Print max. elevation in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:605
msgid "Print min. elevation in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:618
msgid "Print total climbing in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:631
msgid "Print total descent in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:644
msgid "Print average speed in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:657
msgid "Print average cadence in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:670
msgid "Print average heart rate in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:683
msgid "Print average temperature in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:696
msgid "Print total time in summary table"
msgstr ""
#: ../wp-gpx-maps_help.php:712
msgid "Advanced"
msgstr ""
#: ../wp-gpx-maps_help.php:731
msgid "Skip GPX points closer than XX meters"
msgstr ""
#: ../wp-gpx-maps_help.php:744
msgid "Print all the GPX waypoints without reduce it"
msgstr ""
#: ../wp-gpx-maps_help.php:760
msgid "Bugs, problems, thanks and anything else here!"
msgstr ""
#: ../wp-gpx-maps_utils.php:150
msgid "WP GPX Maps Error: GPX file not found!"
msgstr ""
#: ../wp-gpx-maps_utils.php:539
msgid "WP GPX Maps Error: Can&#8217;t parse xml file!"
msgstr ""

View File

@ -1,31 +1,29 @@
=== WP GPX Maps === === WP GPX Maps ===
Contributors: bastianonm, Stephan Klein, Michel Selerin Contributors: bastianonm, Stephan Klein, Michel Selerin, TosattoSimonePio, Kniebremser
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: 2.0.0 Requires at least: 4.6.0
Tested up to: 4.9.8 Tested up to: 5.2.1
Stable tag: 1.6.07 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.
== Description == == Description ==
This plugin has, as input, the GPX file with the track you've made and as output it shows the map of the track and an interactive altitude graph (where available). This plugin has, as input, the GPX file with the track you've made and as output it shows the map of the track and an interactive altitude graph (where available).
Now on github: https://github.com/devfarm-it/wp-gpx-maps
On github you can contribuite easly with your code
Fully configurable: Fully configurable:
- Custom colors - Custom colors
- Custom icons - Custom icons
- Multiple language support - Multiple language support
Supported charts: Supported charts:
- Altitude - Altitude
- Speed - Speed
- Heart Rate - Heart rate
- Temperature - Temperature
- Cadence - Cadence
- Grade - Grade
@ -33,13 +31,24 @@ Supported charts:
NextGen Gallery Integration: NextGen Gallery Integration:
Display your NextGen Gallery images inside the map! Display your NextGen Gallery images inside the map!
Even if you don't have a gps camera, this plugin can retrive the image position starting from the image date and you gpx file. Even if you don't have a GPS camera, this plugin can retrive the image position starting from the image date and your GPX file.
Post Attachments Integration: Post Attachments Integration:
This version is extended by Stephan Klein (https://klein-gedruckt.de/2015/03/wordpress-plugin-wp-gpx-maps/) and supports displaying all images attached to a post without using NGG. This version is extended by: <a href="https://klein-gedruckt.de/2015/03/wordpress-plugin-wp-gpx-maps/" target="_blank" rel="noopener noreferrer">Stephan Klein</a> and supports displaying all images attached to a post without using NGG.
Translated into 14 languages: Try this plugin: <a href="https://devfarm.it/wp-gpx-maps-demo/" target="_blank" rel="noopener noreferrer">https://devfarm.it/wp-gpx-maps-demo/</a>
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>
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:
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:
- Catalan ca - Catalan ca
- Dutch nl_NL - Dutch nl_NL
@ -60,25 +69,28 @@ Translated into 14 languages:
- Norwegian nb_NO - Norwegian nb_NO
- Japanese ja_JP - Japanese ja_JP
(many thanks to all guys who helped me with the translations) (Many thanks to all guys who helped me with the translations)
- iphone/ipad/ipod Compatible Currently are 222 texts are translatable in the plugin.
Try this plugin: <a href="https://devfarm.it/wp-gpx-maps-demo/">https://devfarm.it/wp-gpx-maps-demo/</a> 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.
If the translation is available via WP Translate, the language file will be deleted in the next version of the plugin.
Please also help with the translation of the readme. The more languages that are available, the wider the spread of the plugin will be.
<a href="http://www.devfarm.it/forums/forum/wp-gpx-maps/">Support Forum</a> Supported GPX namespaces are:
Supported gpx namespaces are:
1. http://www.topografix.com/GPX/1/0 1. http://www.topografix.com/GPX/1/0
1. http://www.topografix.com/GPX/1/1 1. <a href="http://www.topografix.com/GPX/1/1" target="_blank" rel="noopener noreferrer">www.topografix.com/GPX/1/1</a>
1. http://www.garmin.com/xmlschemas/GpxExtensions/v3 1. http://www.garmin.com/xmlschemas/GpxExtensions/v3
1. http://www.garmin.com/xmlschemas/TrackPointExtension/v1 1. http://www.garmin.com/xmlschemas/TrackPointExtension/v1
Thanks to: <a href="http://www.securcube.net/">www.securcube.net</a>, <a href="http://www.devfarm.it/">www.devfarm.it</a> Thanks to: <a href="http://www.securcube.net/" target="_blank" rel="noopener noreferrer">www.securcube.net</a>, <a href="http://www.devfarm.it/" target="_blank" rel="noopener noreferrer">www.devfarm.it</a>
Icons made by <a href="https://www.freepik.com/" target="_blank" rel="noopener noreferrer">Freepik</a> from <a href="https://www.flaticon.com/" target="_blank" rel="noopener noreferrer">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" target="_blank" rel="noopener noreferrer">Creative Commons BY 3.0</a>
== Installation == == Installation ==
@ -90,58 +102,63 @@ Thanks to: <a href="http://www.securcube.net/">www.securcube.net</a>, <a href="h
== Frequently Asked Questions == == Frequently Asked Questions ==
= what are all available shortcode attributes? = = Which shortcode attributes are available? =
The attributes are: You can use the following shortcodes:
1. gpx: relative path to gpx 1. gpx: Relative path to the GPX file
1. width: width in pixels 1. width: Width in pixels
1. mheight: map height 1. mheight: Map height
1. gheight: graph height 1. gheight: Graph height
1. mtype: map available types are: HYBRID, ROADMAP, SATELLITE, TERRAIN, OSM1 (Open Street Map), OSM2 (Open Cycle Map), OSM3 (Hike & Bike), OSM4 (Open Cycle Map - Transport), OSM5 (Open Cycle Map - Landscape), OSM6 (MapToolKit - Terrain) 1. skipcache: Do not use cache. If TRUE might be very slow (default is false)
1. waypoints: print the gpx waypoints inside the map (default is FALSE) 1. download: Allow users to download your GPX file (default is false)
1. donotreducegpx: print all the point without reduce it (default is FALSE) 1. summary: Print summary details of your GPX track (default is false)
1. pointsoffset: skip points closer than XX meters(default is 10) 1. summarytotlen: Print total distance in summary table (default is false)
1. uom: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4, 5 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles) 1. summarymaxele: Print max elevation in summary table (default is false)
1. mlinecolor: map line color (default is #3366cc) 1. summaryminele: Print min Elevation in summary table (default is false)
1. glinecolor: altitude line color (default is #3366cc) 1. summaryeleup: Print total climbing in summary table (default is false)
1. showspeed: show speed inside the chart (default is FALSE) 1. summaryeledown: Print total descent in summary table (default is false)
1. showhr: show heart rate inside the chart (default is FALSE) 1. summaryavgspeed: Print average Speed in summary table (default is false)
1. showele: show elevation data inside the chart (default is TRUE) 1. summarytotaltime: Print total time in summary table (default is false)
1. showcad: show cadence inside the chart (default is FALSE) 1. mtype: Map available types are: HYBRID, ROADMAP, SATELLITE, TERRAIN, OSM1 (Open Street Map), OSM2 (Open Cycle Map), OSM4 (Open Cycle Map - Transport), OSM5 (Open Cycle Map - Landscape), OSM6 (MapToolKit - Terrain), OSM7 (Open Street Map - Humanitarian map style), OSM 9 (Hike & Bike), OSM10 (Open Sea Map)
1. showgrade: show grade inside the chart (default is FALSE) 1. mlinecolor: Map line color (default is #3366cc)
1. glinecolorspeed: speed line color (default is #ff0000) 1. zoomonscrollwheel: Zoom on map when mouse scroll wheel (default is false)
1. glinecolorhr: heart rate line color (default is #ff77bd) 1. waypoints: Print the gpx waypoints inside the map (default is false)
1. glinecolorcad: cadence line color (default is #beecff)
1. glinecolorgrade: grade line color (default is #beecff)
1. uomspeed: unit of measure for speed are: 0, 1, 2, 3, 4, 5 (0 = m/s, 1 = km/h, 2 = miles/h, 3 = min/km, 4 = min/miles, 5 = Nautical Miles/Hour (Knots))
1. chartFrom1: minimun value for altitude chart
1. chartTo1: maxumin value for altitude chart
1. chartFrom2: minimun value for speed chart
1. chartTo2: maxumin value for speed chart
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: Waypoint custom icon
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. glinecolor: Altitude line color (default is #3366cc)
1. chartFrom1: Minimun value for altitude chart
1. chartTo1: Maxumin value for altitude chart
1. showspeed: Show speed inside the chart (default is false)
1. glinecolorspeed: Speed line color (default is #ff0000)
1. uomspeed: Unit of measure for speed (0 = m/s, 1 = km/h, 2 = miles/h, 3 = min/km, 4 = min/miles, 5 = Nautical Miles/Hour (Knots), 6 = min/100 meters)
1. chartFrom2: Minimun value for speed chart
1. chartTo2: Maxumin value for speed chart
1. showhr: Show heart rate inside the chart (default is false)
1. glinecolorhr: Heart rate line color (default is #ff77bd)
1. showatemp: Show temperature inside the chart (default is false)
1. glinecoloratemp: Temperature line color (default is #ff77bd)
1. showcad: Show cadence inside the chart (default is false)
1. glinecolorcad: Cadence line color (default is #beecff)
1. showgrade: Show grade inside the chart (default is false)
1. glinecolorgrade: Grade line color (default is #beecff)
1. nggalleries: NextGen Gallery id or a list of Galleries id separated by a comma 1. nggalleries: NextGen Gallery id or a list of Galleries id separated by a comma
1. ngimages: NextGen Image id or a list of Images id separated by a comma 1. ngimages: NextGen Image id or a list of Images id separated by a comma
1. dtoffset: the difference (in seconds) between your gpx tool date and your camera date 1. attachments: Show all images that are attached to post (default is false)
1. zoomonscrollwheel: zoom on map when mouse scroll wheel 1. dtoffset: The difference (in seconds) between your gpx tool date and your camera date
1. download: Allow users to download your GPX file 1. pointsoffset: Skip points closer than XX meters (default is 10)
1. skipcache: Do not use cache. If TRUE might be very slow (default is FALSE) 1. donotreducegpx: Print all the point without reduce it (default is false)
1. summary: Print summary details of your GPX (default is FALSE)
1. summarytotlen: Print Total distance in summary table (default is FALSE) = What happening if I've a very large GPX files? =
1. summarymaxele: Print Max Elevation in summary table (default is FALSE)
1. summaryminele: Print Min Elevation in summary table (default is FALSE)
1. summaryeleup: Print Total climbing in summary table (default is FALSE)
1. summaryeledown: Print Total descent in summary table (default is FALSE)
1. summaryavgspeed: Print Average Speed in summary table (default is FALSE)
1. summarytotaltime: Print Total time in summary table (default is FALSE)
= What happening if I've a very large gpx? =
This plugin will print a small amout of points to speedup javascript and pageload. This plugin will print a small amout of points to speedup javascript and pageload.
= Is it free? = = Is it free? =
Yes! Yes!
== Screenshots == == Screenshots ==
@ -150,9 +167,22 @@ Yes!
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
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Heart rate
== Changelog == == Changelog ==
= 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 an Admins can see the current values for shortcodes in help tab
* Added: Button to instant copy the shortcode of the selected GPX file in the tab track
* Added: different size logos for the plugin store (icon.svg, icon128x128.png and icon256x256.png) [inside ../plugins/wp-gpx-maps/assets]
* Changed: Settings tab is for non-Admin users is not more visible
* Tweak: Help tab is easier to read
* Tweak: Plugin is now complete translatable (Backend + Frontend)
* Tweak: WordPress coding standards
* Upgrade: Leaflet to 1.5.1
* Upgrade: leaflet.fullscreen to 1.4.5
* Upgrade: Chart.min.js to 2.8.0
= 1.6.07 = = 1.6.07 =
* resolve admin error * resolve admin error
= 1.6.06 = = 1.6.06 =

File diff suppressed because it is too large Load Diff

View File

@ -12,15 +12,28 @@ if ( is_admin() ){
function wpgpxmaps_admin_menu() { function wpgpxmaps_admin_menu() {
if ( current_user_can('manage_options') ){ /*
All roles/capabilities:
https://wordpress.org/support/article/roles-and-capabilities/
*/
if ( current_user_can( 'manage_options' ) ) {
/* Only Administrators and Super 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' ) ) {
/* Contributor Authors and */
$allow_users_upload = get_option( 'wpgpxmaps_allow_users_view' ) === "true";
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' );
}
} }
@ -30,24 +43,21 @@ function wpgpxmaps_admin_menu() {
function wpgpxmaps_ilc_admin_tabs( $current ) { function wpgpxmaps_ilc_admin_tabs( $current ) {
if ( current_user_can( 'manage_options' ) ) {
$tabs = array(
'tracks' => __( 'Tracks', 'wp-gpx-maps' ),
'settings' => __( 'Settings', 'wp-gpx-maps' ),
'help' => __( 'Help', 'wp-gpx-maps' ),
);
} elseif ( current_user_can( 'publish_posts' ) ) {
if (current_user_can('manage_options')) $tabs = array(
'tracks' => __( 'Tracks', 'wp-gpx-maps' ),
{ 'help' => __( 'Help', 'wp-gpx-maps' ),
);
$tabs = array( 'tracks' => 'Tracks', 'settings' => 'Settings', 'help' => "help" );
} }
else if ( current_user_can('publish_posts') ) {
$tabs = array( 'tracks' => 'Tracks', 'help' => "help" );
}
echo '<h2 class="nav-tab-wrapper">'; echo '<h2 class="nav-tab-wrapper">';
foreach ( $tabs as $tab => $name ) { foreach ( $tabs as $tab => $name ) {
@ -74,250 +84,70 @@ function WP_GPX_Maps_html_page() {
$relativeGpxPath = str_replace( "\\","/", $relativeGpxPath ); $relativeGpxPath = str_replace( "\\","/", $relativeGpxPath );
$relativeGpxCachePath = relativeGpxCacheFolderPath();
$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>WP GPX Settings</h2> <h2><?php _e( 'Settings', 'wp-gpx-maps' ); ?></h2>
<?php <?php
if ( file_exists( $realGpxPath ) && is_dir( $realGpxPath ) ) {
/* Directory exist! */
if(file_exists($realGpxPath) && is_dir($realGpxPath)) } else {
{
//dir exsist!
}
else
{
if ( ! @mkdir( $realGpxPath, 0755, true ) ) { if ( ! @mkdir( $realGpxPath, 0755, true ) ) {
echo '<div class=" notice notice-error"><p>';
echo '<div class="error" style="padding:10px"> printf(
/* translators: Relative path of the GPX folder */
Can\'t create <b>'.$realGpxPath.'</b> folder. Please create it and make it writable!<br /> __( 'Can not create the folder %1s for GPX files. Please create the folder and make it writable! If not, you will must update the files manually!', 'wp-gpx-maps' ),
'<span class="code"><strong>' . esc_html( $relativeGpxPath ) . '</strong></span>'
If not, you will must update the file manually! );
echo '</p></div>';
</div>'; }
} }
} if ( file_exists( $cacheGpxPath ) && is_dir( $cacheGpxPath ) ) {
/* Directory exist! */
} else {
if(file_exists($cacheGpxPath) && is_dir($cacheGpxPath))
{
//dir exsist!
}
else
{
if ( ! @mkdir( $cacheGpxPath, 0755, true ) ) { if ( ! @mkdir( $cacheGpxPath, 0755, true ) ) {
echo '<div class=" notice notice-error"><p>';
echo '<div class="error" style="padding:10px"> printf(
/* translators: Relative path of the GPX cache folder */
Can\'t create <b>'.$cacheGpxPath.'</b> folder. Please create it and make it writable!<br /> __( 'Can not create the cache folder %1s for the GPX files. Please create the folder and make it writable! If not, you will must update the files manually!', 'wp-gpx-maps' ),
'<span class="code"><strong>' . esc_html( $relativeGpxCachePath ) . '</strong></span>'
If not, cache will not created and your site could be slower! );
echo '</p></div>';
</div>';
} }
} }
wpgpxmaps_ilc_admin_tabs( $tab ); wpgpxmaps_ilc_admin_tabs( $tab );
if ( $tab == 'tracks' ) {
if ($tab == "tracks")
{
include 'wp-gpx-maps_admin_tracks.php'; include 'wp-gpx-maps_admin_tracks.php';
} } elseif ( $tab == 'settings' ) {
else if ($tab == "settings")
{
include 'wp-gpx-maps_admin_settings.php'; include 'wp-gpx-maps_admin_settings.php';
} elseif ( $tab == 'help' ) {
include 'wp-gpx-maps_help.php';
} }
else if ($tab == "help")
{
?>
<div style="padding:10px;">
<b>The fastest way to use this plugin:</b><br /> upload the file using the uploader in the first tab, than copy the shortcode from the list and paste it in the pages/posts.
<p>You can manually set the relative path to your gpx: <b>[sgpx gpx="<?php echo $relativeGpxPath; ?>&lt gpx file name &gt"]</b>.</p>
<p>You can also use gpx from other sites: <b>[sgpx gpx="http://www.someone.com/somewhere/somefile.gpx"]</b></p>
<hr />
<p>
<i>Full set of attributes:</i> <b>[sgpx gpx="<?php echo $relativeGpxPath; ?>&lt gpx file name &gt" </b>
&nbsp;&nbsp;&nbsp;<em>&gt&gt read below all the optional attributes &lt&lt</em>&nbsp;&nbsp;&nbsp;
<b>]</b>
<ul>
<li><b>gpx</b>: relative path to gpx
</li><li><b>width</b>: width in pixels
</li><li><b>mheight</b>: map height
</li><li><b>gheight</b>: graph height
</li><li><b>mtype</b>: map available types are: HYBRID, ROADMAP, SATELLITE, TERRAIN, OSM1 (Open Street Map), OSM2 (Open Cycle Map), OSM3 (Hike & Bike), OSM4 (Open Cycle Map - Transport), OSM5 (Open Cycle Map - Landscape), OSM6 (MapToolKit - Terrain)
</li><li><b>waypoints</b>: print the gpx waypoints inside the map (default is FALSE)
</li><li><b>donotreducegpx</b>: print all the point without reduce it (default is FALSE)
</li><li><b>pointsoffset</b>: skip points closer than XX meters(default is 10)
</li><li><b>uom</b>: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4, 5 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles)
</li><li><b>mlinecolor</b>: map line color (default is #3366cc)
</li><li><b>glinecolor</b>: altitude line color (default is #3366cc)
</li><li><b>showspeed</b>: show speed inside the chart (default is FALSE)
</li><li><b>showhr</b>: show heart rate inside the chart (default is FALSE)
</li><li><b>showele</b>: show elevation data inside the chart (default is TRUE)
</li><li><b>showcad</b>: show cadence inside the chart (default is FALSE)
</li><li><b>showgrade</b>: show grade inside the chart (default is FALSE)
</li><li><b>glinecolorspeed</b>: speed line color (default is #ff0000)
</li><li><b>glinecolorhr</b>: heart rate line color (default is #ff77bd)
</li><li><b>glinecolorcad</b>: cadence line color (default is #beecff)
</li><li><b>glinecolorgrade</b>: grade line color (default is #beecff)
</li><li><b>uomspeed</b>: unit of measure for speed are: 0, 1, 2, 3, 4, 5 (0 = m/s, 1 = km/h, 2 = miles/h, 3 = min/km, 4 = min/miles, 5 = Nautical Miles/Hour (Knots), 6 = min/100 meters)
</li><li><b>chartFrom1</b>: minimun value for altitude chart
</li><li><b>chartTo1</b>: maxumin value for altitude chart
</li><li><b>chartFrom2</b>: minimun value for speed chart
</li><li><b>chartTo2</b>: maxumin value for speed chart
</li><li><b>startIcon</b>: Start track icon
</li><li><b>endIcon</b>: End track icon
</li><li><b>currentIcon</b>: Current position icon (when mouse hover)
</li><li><b>waypointicon</b>: waypoint custom icon
</li><li><b>nggalleries</b>: NextGen Gallery id or a list of Galleries id separated by a comma
</li><li><b>ngimages</b>: NextGen Image id or a list of Images id separated by a comma
</li><li><b>dtoffset</b>: the difference (in seconds) between your gpx tool date and your camera date
</li><li><b>zoomonscrollwheel</b>: zoom on map when mouse scroll wheel
</li><li><b>download</b>: Allow users to download your GPX file
</li><li><b>skipcache</b>: Do not use cache. If TRUE might be very slow (default is FALSE)
</li><li><b>summary</b>: Print summary details of your GPX (default is FALSE)
</li><li><b>summarytotlen</b>: Print Total distance in summary table (default is FALSE)
</li><li><b>summarymaxele</b>: Print Max Elevation in summary table (default is FALSE)
</li><li><b>summaryminele</b>: Print Min Elevation in summary table (default is FALSE)
</li><li><b>summaryeleup</b>: Print Total climbing in summary table (default is FALSE)
</li><li><b>summaryeledown</b>: Print Total descent in summary table (default is FALSE)
</li><li><b>summaryavgspeed</b>: Print Average Speed in summary table (default is FALSE)
</li><li><b>summaryavgcad</b>: Print Average Cadence in summary table (default is FALSE)
</li><li><b>summaryavghr</b>: Print Average Heart Rate in summary table (default is FALSE)
</li><li><b>summaryavgtemp</b>: Print Average Temperature in summary table (default is FALSE)
</li><li><b>summarytotaltime</b>: Print Total time in summary table (default is FALSE) </li>
</ul>
<p>
<a href="http://devfarm.it/forums/forum/wp-gpx-maps/">Bugs, problems, thanks and anything else here!</a>
</p>
</p>
</div>
<?php
}
} }
?> ?>

View File

@ -1,113 +1,169 @@
<?php <?php
if ( ! current_user_can( 'manage_options' ) ) if ( ! current_user_can( 'manage_options' ) )
return; return;
$po = get_option('wpgpxmaps_pointsoffset'); /* General */
$showW = get_option("wpgpxmaps_show_waypoint"); $distanceType = get_option( 'wpgpxmaps_distance_type' );
$donotreducegpx = get_option("wpgpxmaps_donotreducegpx"); $skipcache = get_option( 'wpgpxmaps_skipcache' );
$download = get_option( 'wpgpxmaps_download' );
$usegpsposition = get_option( 'wpgpxmaps_usegpsposition' );
/* Print Summary Table */
$summary = get_option( 'wpgpxmaps_summary' );
$tot_len = get_option( 'wpgpxmaps_summary_tot_len' );
$max_ele = get_option( 'wpgpxmaps_summary_max_ele' );
$min_ele = get_option( 'wpgpxmaps_summary_min_ele' );
$total_ele_up = get_option( 'wpgpxmaps_summary_total_ele_up' );
$total_ele_down = get_option( 'wpgpxmaps_summary_total_ele_down' );
$avg_speed = get_option( 'wpgpxmaps_summary_avg_speed' );
$avg_cad = get_option( 'wpgpxmaps_summary_avg_cad' );
$avg_hr = get_option( 'wpgpxmaps_summary_avg_hr' );
$avg_temp = get_option( 'wpgpxmaps_summary_avg_temp' );
$total_time = get_option( 'wpgpxmaps_summary_total_time' );
/* Map */
$t = get_option( 'wpgpxmaps_map_type' ); $t = get_option( 'wpgpxmaps_map_type' );
$zoomonscrollwheel = get_option( 'wpgpxmaps_zoomonscrollwheel' );
$showW = get_option( 'wpgpxmaps_show_waypoint' );
/* Diagram */
$showEle = get_option( 'wpgpxmaps_show_elevation' );
$uom = get_option( 'wpgpxmaps_unit_of_measure' ); $uom = get_option( 'wpgpxmaps_unit_of_measure' );
$uomSpeed = get_option('wpgpxmaps_unit_of_measure_speed');
$showEle = get_option("wpgpxmaps_show_elevation");
$showSpeed = get_option( 'wpgpxmaps_show_speed' ); $showSpeed = get_option( 'wpgpxmaps_show_speed' );
$uomSpeed = get_option( 'wpgpxmaps_unit_of_measure_speed' );
$showHr = get_option( 'wpgpxmaps_show_hr' ); $showHr = get_option( 'wpgpxmaps_show_hr' );
$showAtemp = get_option( 'wpgpxmaps_show_atemp' ); $showAtemp = get_option( 'wpgpxmaps_show_atemp' );
$showCad = get_option( 'wpgpxmaps_show_cadence' ); $showCad = get_option( 'wpgpxmaps_show_cadence' );
$showGrade = get_option( 'wpgpxmaps_show_grade' ); $showGrade = get_option( 'wpgpxmaps_show_grade' );
$zoomonscrollwheel = get_option("wpgpxmaps_zoomonscrollwheel"); /* Advanced */
$download = get_option("wpgpxmaps_download"); $po = get_option( 'wpgpxmaps_pointsoffset' );
$skipcache = get_option("wpgpxmaps_skipcache"); $donotreducegpx = get_option( 'wpgpxmaps_donotreducegpx' );
$summary = get_option("wpgpxmaps_summary"); $allow_users_upload = get_option( 'wpgpxmaps_allow_users_view' );
$tot_len = get_option("wpgpxmaps_summary_tot_len");
$min_ele = get_option("wpgpxmaps_summary_min_ele");
$max_ele = get_option("wpgpxmaps_summary_max_ele");
$total_ele_up = get_option("wpgpxmaps_summary_total_ele_up");
$total_ele_down = get_option("wpgpxmaps_summary_total_ele_down");
$avg_speed = get_option("wpgpxmaps_summary_avg_speed");
$avg_cad = get_option("wpgpxmaps_summary_avg_cad");
$avg_hr = get_option("wpgpxmaps_summary_avg_hr");
$avg_temp = get_option("wpgpxmaps_summary_avg_temp");
$total_time = get_option("wpgpxmaps_summary_total_time");
$usegpsposition = get_option("wpgpxmaps_usegpsposition");
$distanceType = get_option("wpgpxmaps_distance_type");
if ( empty( $allow_users_upload ) )
$allow_users_upload = 'false';
if ( empty( $showEle ) ) if ( empty( $showEle ) )
$showEle = "true"; $showEle = 'true';
if ( ! ( $t ) ) if ( ! ( $t ) )
$t = 'HYBRID'; $t = 'HYBRID';
if ( ! ( $po ) ) if ( ! ( $po ) )
$po = 10; $po = 10;
?> ?>
<div id="wpgpxmaps-settings">
<div class="wpgpxmaps-container-tab-settings">
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?> <?php wp_nonce_field( 'update-options' ); ?>
<h3 class="title">General</h3> <h3 class="title">
<?php _e( 'General', 'wp-gpx-maps' ); ?>
</h3>
<table class="form-table"> <table class="form-table">
<tr> <tr>
<th scope="row">Width:</th> <th scope="row">
<?php _e( 'Map width:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_width" type="text" id="wpgpxmaps_width" value="<?php echo get_option( 'wpgpxmaps_width' ); ?>" style="width:50px;" /> <input name="wpgpxmaps_width" type="text" id="wpgpxmaps_width" value="<?php echo get_option( 'wpgpxmaps_width' ); ?>" style="width:50px;" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Map Height:</th> <th scope="row">
<?php _e( 'Map height:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_height" type="text" id="wpgpxmaps_height" value="<?php echo get_option( 'wpgpxmaps_height' ); ?>" style="width:50px;" /> <input name="wpgpxmaps_height" type="text" id="wpgpxmaps_height" value="<?php echo get_option( 'wpgpxmaps_height' ); ?>" style="width:50px;" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Graph Height:</th> <th scope="row">
<?php _e( 'Graph height:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_graph_height" type="text" id="wpgpxmaps_graph_height" value="<?php echo get_option( 'wpgpxmaps_graph_height' ); ?>" style="width:50px;" /> <input name="wpgpxmaps_graph_height" type="text" id="wpgpxmaps_graph_height" value="<?php echo get_option( 'wpgpxmaps_graph_height' ); ?>" style="width:50px;" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Distance type:</th> <th scope="row">
<?php _e( 'Distance type:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<select name='wpgpxmaps_distance_type'> <select name='wpgpxmaps_distance_type'>
<option value="0" <?php if ($distanceType == '0' || $distanceType == '') echo 'selected'; ?>>Normal (default)</option> <option value="0" <?php if ( $distanceType == '0' || $distanceType == '' ) echo 'selected'; ?>><?php _e( 'Normal (default)', 'wp-gpx-maps' ); ?></option>
<option value="1" <?php if ($distanceType == '1') echo 'selected'; ?>>Flat &#8594; (Only flat distance, don't take care of altitude)</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'; ?>>Climb &#8593; (Only climb distance)</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>
<tr> <tr>
<th scope="row">Cache:</th> <th scope="row">
<?php _e( 'Cache:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_skipcache" type="checkbox" value="true" <?php if($skipcache == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Do not use cache</i> <input name="wpgpxmaps_skipcache" type="checkbox" value="true" <?php if ( $skipcache == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Do not use cache', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">GPX Download:</th> <th scope="row">
<?php _e( 'GPX Download:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_download" type="checkbox" value="true" <?php if($download == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Allow users to download your GPX file</i> <input name="wpgpxmaps_download" type="checkbox" value="true" <?php if ( $download == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Allow users to download your GPX file', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Use browser GPS position:</th> <th scope="row">
<?php _e( 'Use browser GPS position:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_usegpsposition" type="checkbox" value="true" <?php if($usegpsposition == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Allow users to use browser GPS in order to display their current position on map</i> <input name="wpgpxmaps_usegpsposition" type="checkbox" value="true" <?php if ( $usegpsposition == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Allow users to use browser GPS in order to display their current position on map', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Thunderforest api key (Open Cycle Map):</th> <th scope="row">
<?php _e( 'Thunderforest API Key (Open Cycle Map):', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_openstreetmap_apikey" type="text" id="wpgpxmaps_openstreetmap_apikey" value="<?php echo get_option('wpgpxmaps_openstreetmap_apikey'); ?>" style="width:400px" /> <em> Go to <a href="http://www.thunderforest.com/docs/apikeys/" target="_blank">Thunderforest API Keys</a> and click &#8216;signing in to your Thunderforest account&#8217; </em> <input name="wpgpxmaps_openstreetmap_apikey" type="text" id="wpgpxmaps_openstreetmap_apikey" value="<?php echo get_option( 'wpgpxmaps_openstreetmap_apikey' ); ?>" style="width:400px" />
<em>
<?php
printf(
/* translators: 1: Link to documentation of Thunderforest API Key's 2: Additional link attribute */
__( 'Go to <a href="%1$1s" %2&2s>Thunderforest API Key</a> and signing in to your Thunderforest account.', 'wp-gpx-maps' ),
esc_url( 'http://www.thunderforest.com/docs/apikeys/' ),
'target="_blank" rel="noopener noreferrer"'
)
?>
</em>
</td> </td>
</tr> </tr>
@ -116,94 +172,182 @@
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_skipcache,wpgpxmaps_distance_type,wpgpxmaps_usegpsposition,wpgpxmaps_openstreetmap_apikey" /> <input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_skipcache,wpgpxmaps_distance_type,wpgpxmaps_usegpsposition,wpgpxmaps_openstreetmap_apikey" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" /> <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-gpx-maps' ); ?>" />
</p> </p>
</form> </form>
<hr /> <hr />
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field( 'update-options' ); ?>
<h3 class="title">
<?php _e( 'Summary table', 'wp-gpx-maps' ); ?>
</h3>
<?php wp_nonce_field('update-options') ?>
<h3 class="title">Summary table</h3>
<table class="form-table"> <table class="form-table">
<tr> <tr>
<th scope="row">Summary table:</th> <th scope="row">
<?php _e( 'Summary table:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary" type="checkbox" value="true" <?php if($summary == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print summary table</i> <input name="wpgpxmaps_summary" type="checkbox" value="true" <?php if ( $summary == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print summary details of your GPX track', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Total distance:</th> <th scope="row">
<?php _e( 'Total distance:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_tot_len" type="checkbox" value="true" <?php if($tot_len == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total distance</i> <input name="wpgpxmaps_summary_tot_len" type="checkbox" value="true" <?php if ( $tot_len == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print total distance', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Max Elevation:</th> <th scope="row">
<?php _e( 'Max elevation:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_max_ele" type="checkbox" value="true" <?php if($max_ele == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Max Elevation</i> <input name="wpgpxmaps_summary_max_ele" type="checkbox" value="true" <?php if ( $max_ele == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print max elevation', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Min Elevation:</th> <th scope="row">
<?php _e( 'Min elevation:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_min_ele" type="checkbox" value="true" <?php if($min_ele == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Min Elevation</i> <input name="wpgpxmaps_summary_min_ele" type="checkbox" value="true" <?php if ( $min_ele == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print min elevation', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Total climbing:</th> <th scope="row">
<?php _e( 'Total climbing:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_total_ele_up" type="checkbox" value="true" <?php if($total_ele_up == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total climbing</i> <input name="wpgpxmaps_summary_total_ele_up" type="checkbox" value="true" <?php if ( $total_ele_up == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print total climbing', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Total Descent:</th> <th scope="row">
<?php _e( 'Total descent:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_total_ele_down" type="checkbox" value="true" <?php if($total_ele_down == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total descent</i> <input name="wpgpxmaps_summary_total_ele_down" type="checkbox" value="true" <?php if ( $total_ele_down == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print total descent', 'wp-gpx-maps' );
?>
</i>
</tr>
<tr>
<th scope="row">
<?php _e( 'Average speed:', 'wp-gpx-maps' ); ?>
</th>
<td>
<input name="wpgpxmaps_summary_avg_speed" type="checkbox" value="true" <?php if ( $avg_speed == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print average speed', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Average Speed:</th> <th scope="row">
<?php _e( 'Average cadence:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_avg_speed" type="checkbox" value="true" <?php if($avg_speed == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Average Speed</i> <input name="wpgpxmaps_summary_avg_cad" type="checkbox" value="true" <?php if ( $avg_cad == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print average cadence', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Average Cadence:</th> <th scope="row">
<?php _e( 'Average heart rate:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_avg_cad" type="checkbox" value="true" <?php if($avg_cad == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Average Cadence</i> <input name="wpgpxmaps_summary_avg_hr" type="checkbox" value="true" <?php if ( $avg_hr == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print average heart rate', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Average Heart Rate:</th> <th scope="row">
<?php _e( 'Average temperature:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_avg_hr" type="checkbox" value="true" <?php if($avg_hr == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Average Heart Rate</i> <input name="wpgpxmaps_summary_avg_temp" type="checkbox" value="true" <?php if ( $avg_temp == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Print average temperature', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Average Temperature:</th> <th scope="row">
<?php _e( 'Total time:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_summary_avg_temp" type="checkbox" value="true" <?php if($avg_temp == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Average Temperature</i> <input name="wpgpxmaps_summary_total_time" type="checkbox" value="true" <?php if ( $total_time == true ) { echo ( 'checked' ); } ?> onchange="this.value = (this.checked)" />
</td> <i>
</tr> <?php
echo ' ';
<tr> _e( 'Print total time', 'wp-gpx-maps' );
<th scope="row">Total time:</th> ?>
<td> </i>
<input name="wpgpxmaps_summary_total_time" type="checkbox" value="true" <?php if($total_time == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Print Total time</i>
</td> </td>
</tr> </tr>
@ -212,86 +356,174 @@
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_summary,wpgpxmaps_summary_tot_len,wpgpxmaps_summary_max_ele,wpgpxmaps_summary_min_ele,wpgpxmaps_summary_total_ele_up,wpgpxmaps_summary_total_ele_down,wpgpxmaps_summary_avg_speed,wpgpxmaps_summary_avg_cad,wpgpxmaps_summary_avg_hr,wpgpxmaps_summary_avg_temp,wpgpxmaps_summary_total_time" /> <input name="page_options" type="hidden" value="wpgpxmaps_summary,wpgpxmaps_summary_tot_len,wpgpxmaps_summary_max_ele,wpgpxmaps_summary_min_ele,wpgpxmaps_summary_total_ele_up,wpgpxmaps_summary_total_ele_down,wpgpxmaps_summary_avg_speed,wpgpxmaps_summary_avg_cad,wpgpxmaps_summary_avg_hr,wpgpxmaps_summary_avg_temp,wpgpxmaps_summary_total_time" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" /> <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-gpx-maps' ); ?>" />
</p> </p>
</form> </form>
<hr /> <hr />
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?> <?php wp_nonce_field( 'update-options' ); ?>
<h3 class="title">Map</h3>
<h3 class="title">
<?php _e( 'Map', 'wp-gpx-maps' ); ?>
</h3>
<table class="form-table"> <table class="form-table">
<tr> <tr>
<th scope="row">On mouse scroll wheel:</th> <th scope="row">
<?php _e( 'Default map type:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_zoomonscrollwheel" type="checkbox" value="true" <?php if($zoomonscrollwheel == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Enable zoom</i> <input type="radio" name="wpgpxmaps_map_type" value="OSM1" <?php if ( $t == 'OSM1' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'Open Street Map', 'wp-gpx-maps' );
?>
<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM2" <?php if ( $t == 'OSM2' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'Open Cycle Map', 'wp-gpx-maps' );
?>
<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM4" <?php if ( $t == 'OSM4' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'Open Cycle Map - Transport', 'wp-gpx-maps' );
?>
<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM5" <?php if ( $t == 'OSM5' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'Open Cycle Map - Landscape', 'wp-gpx-maps' );
?>
<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM6" <?php if ( $t == 'OSM6' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'MapToolKit - Terrain', 'wp-gpx-maps' );
?>
<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM7" <?php if ( $t == 'OSM7' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'Open Street Map - Humanitarian map style', 'wp-gpx-maps' );
?>
<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM9" <?php if ( $t == 'OSM9' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'Hike & Bike', 'wp-gpx-maps' );
?>
<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM10" <?php if ( $t == 'OSM10' ) echo 'checked'; ?>>
<?php
echo ' ';
_e( 'Open Sea Map', 'wp-gpx-maps' );
?>
<br />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Waypoints Support:</th> <th scope="row">
<td> <?php _e( 'Map line color:', 'wp-gpx-maps' ); ?>
<input name="wpgpxmaps_show_waypoint" type="checkbox" value="true" <?php if($showW == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Waypoints</i> </th>
</td>
</tr>
<tr>
<th scope="row">Map line color:</th>
<td> <td>
<input name="wpgpxmaps_map_line_color" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_map_line_color' ); ?>" /> <input name="wpgpxmaps_map_line_color" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_map_line_color' ); ?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Default Map Type:</th> <th scope="row">
<?php _e( 'On mouse scroll wheel:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input type="radio" name="wpgpxmaps_map_type" value="OSM1" <?php if ($t == 'OSM1') echo 'checked'; ?>> Open Street Map<br /> <input name="wpgpxmaps_zoomonscrollwheel" type="checkbox" value="true" <?php if ( $zoomonscrollwheel == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<input type="radio" name="wpgpxmaps_map_type" value="OSM2" <?php if ($t == 'OSM2') echo 'checked'; ?>> Open Cycle Map<br /> <i>
<input type="radio" name="wpgpxmaps_map_type" value="OSM4" <?php if ($t == 'OSM4') echo 'checked'; ?>> Open Cycle Map - Transport<br /> <?php
<input type="radio" name="wpgpxmaps_map_type" value="OSM5" <?php if ($t == 'OSM5') echo 'checked'; ?>> Open Cycle Map - Landscape<br /> echo ' ';
<input type="radio" name="wpgpxmaps_map_type" value="OSM3" <?php if ($t == 'OSM3') echo 'checked'; ?>> Hike & Bike<br /> _e( 'Enable zoom', 'wp-gpx-maps' );
<input type="radio" name="wpgpxmaps_map_type" value="OSM6" <?php if ($t == 'OSM6') echo 'checked'; ?>> MapToolKit - Terrain<br /> ?>
<input type="radio" name="wpgpxmaps_map_type" value="OSM7" <?php if ($t == 'OSM7') echo 'checked'; ?>> Open Street Map - Humanitarian map style<br /> </i>
<input type="radio" name="wpgpxmaps_map_type" value="OSM9" <?php if ($t == 'OSM9') echo 'checked'; ?>> Hike & Bike<br />
<input type="radio" name="wpgpxmaps_map_type" value="OSM10" <?php if ($t == 'OSM10') echo 'checked'; ?>> Open Sea Map<br />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Start Icon:</th> <th scope="row">
<?php _e( 'Waypoints support:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_map_start_icon" value="<?php echo get_option('wpgpxmaps_map_start_icon'); ?>" style="width:400px" /> <em>(Url to image) Leave empty to hide</em> <input name="wpgpxmaps_show_waypoint" type="checkbox" value="true" <?php if ( $showW == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Show waypoints', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">End Icon:</th> <th scope="row">
<?php _e( 'Start track icon:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_map_end_icon" value="<?php echo get_option('wpgpxmaps_map_end_icon'); ?>" style="width:400px" /> <em>(Url to image) Leave empty to hide</em> <input name="wpgpxmaps_map_start_icon" value="<?php echo get_option( 'wpgpxmaps_map_start_icon' ); ?>" style="width:400px" />
<em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Current Position Icon:</th> <th scope="row">
<?php _e( 'End track icon:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_map_current_icon" value="<?php echo get_option('wpgpxmaps_map_current_icon'); ?>" style="width:400px" /> <em>(Url to image) Leave empty for default</em> <input name="wpgpxmaps_map_end_icon" value="<?php echo get_option( 'wpgpxmaps_map_end_icon' ); ?>" style="width:400px" />
<em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Current GPS Position Icon:</th> <th scope="row">
<?php _e( 'Current position icon:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_currentpositioncon" value="<?php echo get_option('wpgpxmaps_currentpositioncon'); ?>" style="width:400px" /> <em>(Url to image) Leave empty for default</em> <input name="wpgpxmaps_map_current_icon" value="<?php echo get_option( 'wpgpxmaps_map_current_icon' ); ?>" style="width:400px" />
<em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Custom Waypoint Icon:</th> <th scope="row">
<?php _e( 'Current GPS position icon:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_map_waypoint_icon" value="<?php echo get_option('wpgpxmaps_map_waypoint_icon'); ?>" style="width:400px" /> <em>(Url to image) Leave empty for default</em> <input name="wpgpxmaps_currentpositioncon" value="<?php echo get_option( 'wpgpxmaps_currentpositioncon' ); ?>" style="width:400px" />
<em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Custom waypoint icon:', 'wp-gpx-maps' ); ?>
</th>
<td>
<input name="wpgpxmaps_map_waypoint_icon" value="<?php echo get_option( 'wpgpxmaps_map_waypoint_icon' ); ?>" style="width:400px" />
<em>
<?php _e( '(URL to image) Leave empty to hide.', 'wp-gpx-maps' ); ?>
</em>
</td> </td>
</tr> </tr>
@ -299,154 +531,216 @@
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_show_waypoint,wpgpxmaps_map_line_color,wpgpxmaps_map_type,wpgpxmaps_map_start_icon,wpgpxmaps_map_end_icon,wpgpxmaps_map_current_icon,wpgpxmaps_zoomonscrollwheel,wpgpxmaps_map_waypoint_icon,wpgpxmaps_currentpositioncon" /> <input name="page_options" type="hidden" value="wpgpxmaps_map_type,wpgpxmaps_map_line_color,wpgpxmaps_zoomonscrollwheel,wpgpxmaps_show_waypoint,wpgpxmaps_map_start_icon,wpgpxmaps_map_end_icon,wpgpxmaps_map_current_icon,wpgpxmaps_currentpositioncon,wpgpxmaps_map_waypoint_icon" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" /> <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-gpx-maps' ); ?>" />
</p> </p>
</form> </form>
<hr /> <hr />
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?> <?php wp_nonce_field( 'update-options' ); ?>
<h3 class="title">Chart</h3>
<h3 class="title">
<?php _e( 'Chart', 'wp-gpx-maps' ); ?>
</h3>
<table class="form-table"> <table class="form-table">
<tr> <tr>
<th scope="row">Show altitude:</th> <th scope="row">
<?php _e( 'Altitude:', 'wp-gpx-maps' ); ?>
</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" /> <i>Show Altitude</i> <input type="checkbox" <?php if ( $showEle == true ){ echo( 'checked' ); } ?> onchange="wpgpxmaps_show_elevation.value = this.checked" onload="wpgpxmaps_show_elevation.value = this.checked" />
<i>
<?php
echo ' ';
_e( 'Show altitude', 'wp-gpx-maps' );
?>
</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>
</tr> </tr>
<tr> <tr>
<tr> <th scope="row">
<th scope="row">Altitude line color:</th> <?php _e( 'Altitude line color:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_graph_line_color" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color' ); ?>" /> <input name="wpgpxmaps_graph_line_color" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color' ); ?>" />
</td> </td>
</tr> </tr>
<th scope="row">Unit of measure:</th> <tr>
<th scope="row">
<?php _e( 'Unit of measure:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<select name='wpgpxmaps_unit_of_measure'> <select name='wpgpxmaps_unit_of_measure'>
<option value="0" <?php if ($uom == '0') echo 'selected'; ?>>meters/meters</option> <option value="0" <?php if ( $uom == '0' ) echo 'selected'; ?>><?php _e( 'meters / meters', 'wp-gpx-maps' ); ?></option>
<option value="1" <?php if ($uom == '1') echo 'selected'; ?>>feet/miles</option> <option value="1" <?php if ( $uom == '1' ) echo 'selected'; ?>><?php _e( 'feet / miles', 'wp-gpx-maps' ); ?></option>
<option value="2" <?php if ($uom == '2') echo 'selected'; ?>>meters/kilometers</option> <option value="2" <?php if ( $uom == '2' ) echo 'selected'; ?>><?php _e( 'meters / kilometers', 'wp-gpx-maps' ); ?></option>
<option value="3" <?php if ($uom == '3') echo 'selected'; ?>>meters/nautical miles</option> <option value="3" <?php if ( $uom == '3' ) echo 'selected'; ?>><?php _e( 'meters / nautical miles', 'wp-gpx-maps' ); ?></option>
<option value="4" <?php if ($uom == '4') echo 'selected'; ?>>meters/miles</option> <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'; ?>>feet/nautical miles</option> <option value="5" <?php if ( $uom == '5' ) echo 'selected'; ?>><?php _e( 'feet / nautical miles', 'wp-gpx-maps' ); ?></option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Altitude display offset:</th> <th scope="row">
<?php _e( 'Altitude display offset:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
From <?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" value="<?php echo get_option( 'wpgpxmaps_graph_offset_from1' ); ?>" style="width:50px;" />
To <?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" value="<?php echo get_option( 'wpgpxmaps_graph_offset_to1' ); ?>" style="width:50px;" />
<em>(leave empty for auto scale)</em> <em><?php _e( '(leave empty for auto scale)', 'wp-gpx-maps' ); ?></em>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Show speed:</th> <th scope="row">
<?php _e( 'Speed:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_show_speed" type="checkbox" value="true" <?php if($showSpeed == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Speed</i> <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>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Speed line color:</th> <th scope="row">
<?php _e( 'Speed line color:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_graph_line_color_speed" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_speed' ); ?>" /> <input name="wpgpxmaps_graph_line_color_speed" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_speed' ); ?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Speed unit of measure:</th> <th scope="row">
<?php _e( 'Speed unit of measure:', 'wp-gpx-maps' ); ?>
</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'; ?>>m/s</option> <option value="0" <?php if ( $uomSpeed == '0' ) echo 'selected'; ?>><?php _e( 'm/s', 'wp-gpx-maps' ); ?></option>
<option value="1" <?php if ($uomSpeed == '1') echo 'selected'; ?>>km/h</option> <option value="1" <?php if ( $uomSpeed == '1' ) echo 'selected'; ?>><?php _e( 'km/h', 'wp-gpx-maps' ); ?></option>
<option value="2" <?php if ($uomSpeed == '2') echo 'selected'; ?>>miles/h</option> <option value="2" <?php if ( $uomSpeed == '2' ) echo 'selected'; ?>><?php _e( 'miles/h', 'wp-gpx-maps' ); ?></option>
<option value="3" <?php if ($uomSpeed == '3') echo 'selected'; ?>>min/km</option> <option value="3" <?php if ( $uomSpeed == '3' ) echo 'selected'; ?>><?php _e( 'min/km', 'wp-gpx-maps' ); ?></option>
<option value="4" <?php if ($uomSpeed == '4') echo 'selected'; ?>>min/miles</option> <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'; ?>>Nautical Miles/Hour (Knots)</option> <option value="6" <?php if ($uomSpeed == '6') echo 'selected'; ?>>min/100 meters</option> <option value="5" <?php if ( $uomSpeed == '5' ) echo 'selected'; ?>><?php _e( 'Knots (nautical miles / hour)', 'wp-gpx-maps' ); ?></option>
<option value="6" <?php if ( $uomSpeed == '6' ) echo 'selected'; ?>><?php _e( 'min/100 meters', 'wp-gpx-maps' ); ?></option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Speed display offset:</th> <th scope="row">
<?php _e( 'Speed display offset:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
From <?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" value="<?php echo get_option( 'wpgpxmaps_graph_offset_from2' ); ?>" style="width:50px;" />
To <?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" value="<?php echo get_option( 'wpgpxmaps_graph_offset_to2' ); ?>" style="width:50px;" />
<em>(leave empty for auto scale)</em> <em><?php _e( '(leave empty for auto scale)', 'wp-gpx-maps' ); ?></em>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Show Heart Rate (where aviable):</th> <th scope="row">
<?php _e( 'Heart rate (where aviable):', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_show_hr" type="checkbox" value="true" <?php if($showHr == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show heart rate</i> <input name="wpgpxmaps_show_hr" type="checkbox" value="true" <?php if ( $showHr == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Show heart rate', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Heart rate line color:</th> <th scope="row">
<?php _e( 'Heart rate line color:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_graph_line_color_hr" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_hr' ); ?>" /> <input name="wpgpxmaps_graph_line_color_hr" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_hr' ); ?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Show Temperature (where aviable):</th> <th scope="row">
<?php _e( 'Temperature (where aviable):', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_show_atemp" type="checkbox" value="true" <?php if($showAtemp == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Temperature</i> <input name="wpgpxmaps_show_atemp" type="checkbox" value="true" <?php if ( $showAtemp == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Show temperature', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Temperature line color:</th> <th scope="row">
<?php _e( 'Temperature line color:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_graph_line_color_atemp" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_atemp' ); ?>" /> <input name="wpgpxmaps_graph_line_color_atemp" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_atemp' ); ?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Show Cadence (where aviable):</th> <th scope="row">
<?php _e( 'Cadence (where aviable):', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_show_cadence" type="checkbox" value="true" <?php if($showCad == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Cadence</i> <input name="wpgpxmaps_show_cadence" type="checkbox" value="true" <?php if ( $showCad == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Show cadence', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Cadence line color:</th> <th scope="row">
<?php _e( 'Cadence line color:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_graph_line_color_cad" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_cad' ); ?>" /> <input name="wpgpxmaps_graph_line_color_cad" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_cad' ); ?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Show Grade:</th> <th scope="row">
<?php _e( 'Grade:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_show_grade" type="checkbox" value="true" <?php if($showGrade == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Show Grade - BETA</i> <input name="wpgpxmaps_show_grade" type="checkbox" value="true" <?php if ( $showGrade == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<br /> <i>
<i>(Grade values depends on your gps accuracy. If you have a poor gps accuracy they might be totally wrong!)</i> <?php
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>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Grade line color:</th> <th scope="row">
<?php _e( 'Grade line color:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_graph_line_color_grade" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_grade' ); ?>" /> <input name="wpgpxmaps_graph_line_color_grade" type="color" data-hex="true" value="<?php echo get_option( 'wpgpxmaps_graph_line_color_grade' ); ?>" />
</td> </td>
@ -455,44 +749,82 @@
</table> </table>
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_unit_of_measure,wpgpxmaps_graph_line_color,wpgpxmaps_show_elevation,wpgpxmaps_show_speed,wpgpxmaps_graph_line_color_speed,wpgpxmaps_show_hr,wpgpxmaps_graph_line_color_hr,wpgpxmaps_unit_of_measure_speed,wpgpxmaps_graph_offset_from1,wpgpxmaps_graph_offset_to1,wpgpxmaps_graph_offset_from2,wpgpxmaps_graph_offset_to2,wpgpxmaps_graph_line_color_cad,wpgpxmaps_show_cadence,wpgpxmaps_show_grade,wpgpxmaps_graph_line_color_grade,wpgpxmaps_show_atemp,wpgpxmaps_graph_line_color_atemp" /> <input name="page_options" type="hidden" value="wpgpxmaps_show_elevation,wpgpxmaps_graph_line_color,wpgpxmaps_unit_of_measure,wpgpxmaps_show_speed,wpgpxmaps_graph_line_color_speed,wpgpxmaps_show_hr,wpgpxmaps_graph_line_color_hr,wpgpxmaps_unit_of_measure_speed,wpgpxmaps_graph_offset_from1,wpgpxmaps_graph_offset_to1,wpgpxmaps_graph_offset_from2,wpgpxmaps_graph_offset_to2,wpgpxmaps_graph_line_color_cad,wpgpxmaps_show_cadence,wpgpxmaps_show_grade,wpgpxmaps_graph_line_color_grade,wpgpxmaps_show_atemp,wpgpxmaps_graph_line_color_atemp" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" /> <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-gpx-maps' ); ?>" />
</p> </p>
</form> </form>
<hr /> <hr />
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?> <?php wp_nonce_field( 'update-options' ); ?>
<h3 class="title">Advanced options <small>(Do not edit if you don't know what you are doing!)</small></h3>
<h3 class="title">
<?php _e( 'Advanced Options', 'wp-gpx-maps' ); ?>
</h3>
<em>
<?php _e( '(Do not edit if you don&#8217;t know what you are doing!)', 'wp-gpx-maps' ); ?>
</em>
<table class="form-table"> <table class="form-table">
<tr> <tr>
<th scope="row"></th> <th scope="row">
<?php _e( 'Skip GPX points closer than:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<i>Skip points closer than </i> <input name="wpgpxmaps_pointsoffset" type="text" id="wpgpxmaps_pointsoffset" value="<?php echo $po ?>" style="width:50px;" /> <i>meters</i>. <input name="wpgpxmaps_pointsoffset" type="text" id="wpgpxmaps_pointsoffset" value="<?php echo $po ?>" style="width:50px;" />
<i>
<?php
echo ' ';
_e( 'meters', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row"></th> <th scope="row">
<?php _e( 'Reduce GPX:', 'wp-gpx-maps' ); ?>
</th>
<td> <td>
<input name="wpgpxmaps_donotreducegpx" type="checkbox" value="true" <?php if($donotreducegpx == true){echo('checked');} ?> onchange="this.value = (this.checked)" /> <i>Do not reduce gpx</i>. <input name="wpgpxmaps_donotreducegpx" type="checkbox" value="true" <?php if ( $donotreducegpx == true ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" />
<i>
<?php
echo ' ';
_e( 'Do not reduce GPX', 'wp-gpx-maps' );
?>
</i>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'User upload:', 'wp-gpx-maps' ); ?>
</th>
<td>
<input name="wpgpxmaps_allow_users_view" type="checkbox" value="true" onchange="this.value = (this.checked)" <?php if ( $allow_users_upload === "true" ) { echo( 'checked' ); } ?>>
<i>
<?php
echo ' ';
_e( 'Allow registered user to upload GPX files', 'wp-gpx-maps' );
?>
</i>
</td> </td>
</tr> </tr>
</table> </table>
<input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_pointsoffset,wpgpxmaps_donotreducegpx" />
<p class="submit"> <p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" /> <input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_donotreducegpx,wpgpxmaps_pointsoffset,wpgpxmaps_allow_users_view" />
<input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-gpx-maps' ); ?>" />
</p> </p>
</form> </form>
<hr /> </div>
</div>

View File

@ -3,25 +3,35 @@
if ( ! ( is_admin() ) ) if ( ! ( is_admin() ) )
return; return;
$is_admin = current_user_can( 'manage_options' ); $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";
$wpgpxmapsUrl = get_admin_url() . "admin.php?page=WP-GPX-Maps";
$gpxRegEx = '/.gpx$/i'; $gpxRegEx = '/.gpx$/i';
if ( isset($_POST['clearcache']) ) if ( current_user_can( 'manage_options' ) ) {
{ $menu_root = 'options-general.php';
} elseif ( current_user_can( 'publish_posts' ) ) {
$menu_root = 'admin.php';
}
if ( isset( $_POST['clearcache'] ) ) {
if ( isset( $_GET['_wpnonce'] ) if ( isset( $_GET['_wpnonce'] )
&& &&
wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_clearcache_nonce' . $entry ) wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_clearcache_nonce' . $entry )
) ) {
{ echo '<div class="notice notice-success"><p>';
echo "Cache is now empty!"; _e( 'Cache is now empty!', 'wp-gpx-maps' );
echo '</p></div>';
wpgpxmaps_recursive_remove_directory( $cacheGpxPath, true ); wpgpxmaps_recursive_remove_directory( $cacheGpxPath, true );
} }
} }
if ( is_writable( $realGpxPath ) ) { if ( is_writable( $realGpxPath ) ) {
@ -29,48 +39,65 @@
?> ?>
<div class="tablenav top"> <div class="tablenav top">
<form enctype="multipart/form-data" method="POST" style="float:left; margin:5px 20px 0 0" action="/wp-admin/options-general.php?page=WP-GPX-Maps">
Choose a file to upload: <input name="uploadedfile[]" type="file" onchange="submitgpx(this);" multiple />
<?php <?php
if ( isset($_FILES['uploadedfile']) ) echo '<form enctype="multipart/form-data" method="POST" style="float:left; margin:5px 20px 0 0" action="' . get_bloginfo( 'wpurl' ) . '/wp-admin/' . $menu_root . '?page=WP-GPX-Maps">';
{ ?>
<?php _e( 'Choose a file to upload:', 'wp-gpx-maps' ); ?> <input name="uploadedfile[]" type="file" onchange="submitgpx(this);" multiple />
<?php
if ( isset( $_FILES['uploadedfile'] ) ) {
$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 "<br />File <b>". $uploadingFileName . "</b> has been uploaded"; echo '<div class="notice notice-success"><p>';
printf(
/* translators: GPX file name */
__( 'The file %1s has been successfully uploaded.', 'wp-gpx-maps' ),
'<span class="code"><strong>' . esc_html( $uploadingFileName ) . '</strong></span>'
);
echo '</p></div>';
} else { } else {
echo "<br />There was an error uploading the file, please try again!"; echo '<div class=" notice notice-error"><p>';
_e( 'There was an error uploading the file, please try again!', 'wp-gpx-maps' );
echo '</p></div>';
} }
} } else {
else echo '<div class="notice notice-warning"><p>';
{ _e( 'The file type is not supported!', 'wp-gpx-maps' );
echo "file not supported!"; echo '</p></div>';
} }
} }
} }
?> ?>
</form> </form>
<form method="POST" style="float:left; margin:5px 20px 0 0" action="/wp-admin/options-general.php?page=WP-GPX-Maps&_wpnonce=<?php echo wp_create_nonce( 'wpgpx_clearcache_nonce' ) ?>" > <form method="POST" style="float:left; margin:5px 20px 0 0" action="<?php echo $wpgpxmapsUrl; ?>&_wpnonce=<?php echo wp_create_nonce( 'wpgpx_clearcache_nonce' ); ?>" >
<input type="submit" name="clearcache" value="Clear Cache" /> <input type="submit" name="clearcache" value="<?php _e( 'Clear Cache', 'wp-gpx-maps' ); ?>" />
</form> </form>
</div> </div>
<?php <?php
} } else {
else
{
?> ?>
<br /> <br />
<br />
<p style='font-size:2em;'>please make <b><?php echo $realGpxPath ?></b> folder writable. </p> <?php echo '<div class=" notice notice-error"><p>'; ?>
<br /> <p style='font-size:2em;'>
<?php
printf(
/* translators: Relative path of the GPX folder */
__( 'Your folder for GPX files %1s is not writable. Please change the folder permissions.', 'wp-gpx-maps' ),
'<span class="code">' . esc_html( $relativeGpxPath ) . '</span>'
);
?>
</p>
<?php echo '</p></div>'; ?>
<br /> <br />
<?php <?php
@ -79,26 +106,33 @@
$myGpxFileNames = array(); $myGpxFileNames = array();
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']) if ( isset($_GET['_wpnonce'])
&& &&
wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_deletefile_nonce_' . $entry ) wp_verify_nonce( $_GET['_wpnonce'], 'wpgpx_deletefile_nonce_' . $entry )
) { ) {
if ( file_exists($realGpxPath ."/". $entry) ) if ( file_exists( $realGpxPath . "/" . $entry ) ) {
{
unlink( $realGpxPath . "/" . $entry ); unlink( $realGpxPath . "/" . $entry );
echo "<br/><b>$entry has been deleted.</b>"; echo '<div class="notice notice-success"><p>';
} printf(
else { /* translators: GPX file name */
echo "<br/><b>Can't delete $entry.</b>"; __( 'The file %1s has been successfully deleted.', 'wp-gpx-maps' ),
'<span class="code"><strong>' . esc_html ( $entry ) . '</strong></span>'
);
echo '</p></div>';
} else {
echo '<div class=" notice notice-error"><p>';
printf(
/* translators: GPX file name */
__( 'The file %1s could not be deleted.', 'wp-gpx-maps' ),
'<span class="code"><strong>' . esc_html ( $entry ) . '</strong></span>'
);
echo '</p></div>';
} }
} } else {
else
{
$myFile = $realGpxPath . "/" . $entry; $myFile = $realGpxPath . "/" . $entry;
$myGpxFileNames[] = array( $myGpxFileNames[] = array(
'name' => $entry, 'name' => $entry,
@ -106,9 +140,7 @@
'lastedit' => filemtime( $myFile ), 'lastedit' => filemtime( $myFile ),
'nonce' => wp_create_nonce( 'wpgpx_deletefile_nonce_' . $entry ), 'nonce' => wp_create_nonce( 'wpgpx_deletefile_nonce_' . $entry ),
); );
} }
} }
} }
closedir( $handle ); closedir( $handle );
@ -116,16 +148,13 @@
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 );
} }
$wpgpxmaps_gpxRelativePath = get_site_url(null, '/wp-content/uploads/gpx/');
?> ?>
<table id="table" class="wp-list-table widefat plugins"></table> <table id="table" class="wp-list-table widefat plugins"></table>
@ -135,7 +164,7 @@
function submitgpx(el) function submitgpx(el)
{ {
var newEl = document.createElement('span'); var newEl = document.createElement('span');
newEl.innerHTML = 'Uploading file...'; newEl.innerHTML = '<?php _e( 'Uploading file...', 'wp-gpx-maps' ); ?>';
el.parentNode.insertBefore(newEl,el.nextSibling); el.parentNode.insertBefore(newEl,el.nextSibling);
el.parentNode.submit() el.parentNode.submit()
} }
@ -143,23 +172,23 @@
jQuery('#table').bootstrapTable({ jQuery('#table').bootstrapTable({
columns: [{ columns: [{
field: 'name', field: 'name',
title: 'File', title: '<?php _e( 'File', 'wp-gpx-maps' ); ?>',
sortable: true, sortable: true,
formatter: function(value, row, index) { formatter: function(value, row, index) {
return [ return [
'<b>' + row.name + '</b><br />', '<b>' + row.name + '</b><br />',
'<a class="delete_gpx_row" href="/wp-admin/options-general.php?page=WP-GPX-Maps&_wpnonce=' + row.nonce + '" >Delete</a>', '<a class="delete_gpx_row" href="<?php echo $wpgpxmapsUrl; ?>&_wpnonce=' + row.nonce + '" ><?php _e( 'Delete', 'wp-gpx-maps' ); ?></a>',
' | ', ' | ',
'<a href="<?php echo $wpgpxmaps_gpxRelativePath ?>' + row.name + '">Download</a>', '<a href="<?php echo $relativeGpxPath; ?>' + row.name + '"><?php _e( 'Download', 'wp-gpx-maps' ); ?></a>',
' | ', ' | ',
'Shortcode: [sgpx gpx="<?php echo $relativeGpxPath ?>' + row.name + '"]', '<a href="#" class="copy-shortcode" title="<?php _e( 'Copy shortcode', 'wp-gpx-maps' ); ?>"><?php _e( 'Shortcode:', 'wp-gpx-maps' ); ?></a> <span class="code"> [sgpx gpx="<?php echo $relativeGpxPath ?>' + row.name + '"]</span>',
].join('') ].join('')
} }
}, { }, {
field: 'lastedit', field: 'lastedit',
title: 'Last modified', title: '<?php _e( 'Last modified', 'wp-gpx-maps' ); ?>',
sortable: true, sortable: true,
formatter: function(value, row, index) { formatter: function(value, row, index) {
var d = new Date(value*1000); var d = new Date(value*1000);
@ -167,17 +196,17 @@
} }
}, { }, {
field: 'size', field: 'size',
title: 'File size', title: '<?php _e( 'File size', 'wp-gpx-maps' ); ?>',
sortable: true, sortable: true,
formatter: function(value, row, index) { return humanFileSize(value); } formatter: function(value, row, index) { return humanFileSize(value); }
}], }],
sortName : 'lastedit', sortName : 'lastedit',
sortOrder : 'desc', sortOrder : 'desc',
data: <?php echo json_encode( $myGpxFileNames ) ?> data: <?php echo wp_json_encode( $myGpxFileNames ); ?>
}); });
jQuery('.delete_gpx_row').click(function(){ jQuery('.delete_gpx_row').click(function(){
return confirm("Are you sure you want to delete?"); return confirm("<?php _e( 'Are you sure you want to delete the file?', 'wp-gpx-maps' ); ?>");
}) })
function humanFileSize(bytes, si) { function humanFileSize(bytes, si) {
@ -196,6 +225,18 @@
return bytes.toFixed(1)+' '+units[u]; return bytes.toFixed(1)+' '+units[u];
} }
jQuery('.copy-shortcode').click(function(e){
var $temp = jQuery("<input>");
jQuery("body").append($temp);
var shortcode = jQuery(this).next().text().trim();
$temp.val(shortcode).select();
document.execCommand("copy");
$temp.remove();
e.preventDefault();
});
</script> </script>

957
wp-gpx-maps_help.php Normal file
View File

@ -0,0 +1,957 @@
<div id="wpgpxmaps-tab-faq">
<div class="wpgpxmaps-container-tab-faq">
<div class="wpgpxmaps-tab-faq">
<h3 class="title"><?php _e( 'FAQ', 'wp-gpx-maps' ); ?></h3>
<p>
<strong><?php _e( 'How can I upload the GPX files?', 'wp-gpx-maps' ); ?></strong>
</p>
<p>
&nbsp; <?php _e( '1. Method: Upload the GPX file using the uploader in the tab "Tracks".', 'wp-gpx-maps' ); ?>
</p>
<p>
&nbsp;
<?php
_e( '2. Method: Upload the GPX file via FTP to your upload folder:', 'wp-gpx-maps' );
echo ' ';
?>
<code><strong> <?php echo $relativeGpxPath; ?> </strong></code>
</p>
<p>
<strong><?php _e( 'How can I use the GPX files?', 'wp-gpx-maps' ); ?></strong>
</p>
<p>
&nbsp; <?php _e( 'Go to the tab "Tracks" and copy the shortcode from the list and paste it in the page or post.', 'wp-gpx-maps' ); ?>
</p>
<p>
&nbsp;
<?php
_e( 'You can manually set the relative path to your GPX file. Please use this scheme:', 'wp-gpx-maps' );
echo ' ';
?>
<code><strong>[sgpx gpx="<?php echo $relativeGpxPath; ?>yourgpxfile.gpx"]</strong></code>
</p>
<p>
<strong><?php _e( 'Can I also integrate GPX files from other sites?', 'wp-gpx-maps' ); ?></strong>
</p>
<p>
&nbsp;
<?php
_e( 'Yes, it&#8217s possible. Please use this scheme:', 'wp-gpx-maps' );
echo ' ';
?>
<code><strong>[sgpx gpx="http://www.someone.com/somewhere/somefile.gpx"]</strong></code>
</p>
<p>
<strong><?php _e( 'Can I change the attributes for each GPX shortcode?', 'wp-gpx-maps' ); ?></strong>
</p>
<p>
&nbsp; <?php _e( 'Yes, it&#8217s possible. These changes ignore the default settings for each attribute.', 'wp-gpx-maps' ); ?>
</p>
<p>
&nbsp;
<?php
_e( 'The Full set of optional attributes can be found below. Please use this scheme:', 'wp-gpx-maps' );
echo ' ';
?>
<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>
</div>
<table class="widefat">
<thead>
<tr>
<th colspan="4">
<strong><?php _e( 'General', 'wp-gpx-maps' ); ?></strong>
</th>
</tr>
<tr>
<th scope="col">
<?php _e( 'Shortcode', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Description', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Possible values', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Current value', 'wp-gpx-maps' ); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>gpx</td>
<td>
<?php _e( 'relative path to the GPX file', 'wp-gpx-maps' ); ?>
</td>
<td>
<code><strong>gpx="/wp-upload dir/gpx/yourgpxfile.gpx"</strong></code>
</td>
<td>
<code><strong>gpx="<?php echo $relativeGpxPath; ?>yourgpxfile.gpx"</strong></code>
</td>
</tr>
<tr>
<td>width</td>
<td>
<?php _e( 'Map width', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php _e( 'Value in percent', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_width' ); ?>
</td>
</tr>
<tr>
<td>mheight</td>
<td>
<?php _e( 'Map height', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php _e( 'Value in pixels', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_height' ); ?>
</td>
</tr>
<tr>
<td>gheight</td>
<td>
<?php _e( 'Graph height', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php _e( 'Value in pixels', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_height' ); ?>
</td>
</tr>
<tr>
<td>download</td>
<td>
<?php _e( 'Allow users to download your GPX file', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_download' ); ?>
</td>
</tr>
<tr>
<td>skipcache</td>
<td>
<?php _e('Do not use cache. If TRUE might be very slow', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_skipcache' ); ?>
</td>
</tr>
</tbody>
</table>
<br />
<table class="widefat">
<thead>
<tr>
<th colspan="4">
<strong><?php _e( 'Map', 'wp-gpx-maps' ); ?></strong>
</th>
</tr>
<tr>
<th scope="col">
<?php _e( 'Shortcode', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Description', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Possible values', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Current value', 'wp-gpx-maps' ); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>mtype</td>
<td>
<?php _e( 'Map type', 'wp-gpx-maps' ); ?>
</td>
<td>
<strong>HYBRID, ROADMAP, SATELLITE, TERRAIN</strong>
<br />
<strong>OSM1</strong> = <?php _e( 'Open Street Map', 'wp-gpx-maps' ); ?>
<br />
<strong>OSM2</strong> = <?php _e( 'Open Cycle Map', 'wp-gpx-maps' ); ?>
<br />
<strong>OSM4</strong> = <?php _e( 'Open Cycle Map - Transport', 'wp-gpx-maps' ); ?>
<br />
<strong>OSM5</strong> = <?php _e( 'Open Cycle Map - Landscape', 'wp-gpx-maps' ); ?>
<br />
<strong>OSM6</strong> = <?php _e( 'MapToolKit - Terrain', 'wp-gpx-maps' ); ?>
<br />
<strong>OSM7</strong> = <?php _e( 'Open Street Map - Humanitarian map style', 'wp-gpx-maps' ); ?>
<br />
<strong>OSM9</strong> = <?php _e( 'Hike & Bike', 'wp-gpx-maps' ); ?>
<br />
<strong>OSM10</strong> = <?php _e( 'Open Sea Map', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_map_type' ); ?>
</td>
</tr>
<tr>
<td>mlinecolor</td>
<td>
<?php _e( 'Map line color', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>#3366cc</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_map_line_color' ); ?>
</td>
</tr>
<tr>
<td>zoomonscrollwheel</td>
<td>
<?php _e( 'Zoom on map when mouse scroll wheel', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_zoomonscrollwheel' ); ?>
</td>
</tr>
<tr>
<td>waypoints</td>
<td>
<?php _e( 'Print the GPX waypoints inside the map', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_show_waypoint' ); ?>
</td>
</tr>
<tr>
<td>startIcon</td>
<td>
<?php _e( 'Start track icon', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_map_start_icon' ); ?>
</td>
</tr>
<tr>
<td>endIcon</td>
<td>
<?php _e( 'End track icon', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_map_end_icon' ); ?>
</td>
</tr>
<tr>
<td>currentIcon</td>
<td>
<?php _e( 'Current position icon (when mouse hover)', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_map_current_icon' ); ?>
</td>
</tr>
<tr>
<td>waypointicon</td>
<td>
<?php _e( 'Custom waypoint icon', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_map_waypoint_icon' ); ?>
</td>
</tr>
</tbody>
</table>
<br />
<table class="widefat">
<thead>
<tr>
<th colspan="4">
<strong><?php _e( 'Diagram', 'wp-gpx-maps' ); ?></strong>
</th>
</tr>
<tr>
<th scope="col">
<?php _e( 'Shortcode', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Description', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Possible values', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Current value', 'wp-gpx-maps' ); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>showele</td>
<td>
<?php _e( 'Show elevation data inside the chart', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>true</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_show_elevation' ); ?>
</td>
</tr>
<tr>
<td>glinecolor</td>
<td>
<?php _e( 'Altitude line color', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>#3366cc</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_line_color' ); ?>
</td>
</tr>
<tr>
<td>uom</td>
<td>
<?php _e( 'Distance / Altitude unit of measure', 'wp-gpx-maps' ); ?>
</td>
<td>
<strong>0</strong> = <?php _e( 'meters / meters', 'wp-gpx-maps' ); ?>
<br />
<strong>1</strong> = <?php _e( 'feet / miles', 'wp-gpx-maps' ); ?>
<br />
<strong>2</strong> = <?php _e( 'meters / kilometers', 'wp-gpx-maps' ); ?>
<br />
<strong>3</strong> = <?php _e( 'meters / nautical miles', 'wp-gpx-maps' ); ?>
<br />
<strong>4</strong> = <?php _e( 'meters / miles', 'wp-gpx-maps' ); ?>
<br />
<strong>5</strong> = <?php _e( 'feet / nautical miles', 'wp-gpx-maps' ); ?>
<br />
</td>
<td>
<?php echo get_option( 'wpgpxmaps_unit_of_measure' ); ?>
</td>
</tr>
<tr>
<td>chartFrom1</td>
<td>
<?php _e( 'Minimum value for altitude chart', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_offset_from1' ); ?>
</td>
</tr>
<tr>
<td>chartTo1</td>
<td>
<?php _e( 'Maximum value for altitude chart', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_offset_to1' ); ?>
</td>
</tr>
<tr>
<td>showspeed</td>
<td>
<?php _e( 'Show speed inside the chart', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_show_speed' ); ?>
</td>
</tr>
<tr>
<td>glinecolorspeed</td>
<td>
<?php _e( 'Speed line color', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>#ff0000</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_line_color_speed' ); ?>
</td>
</tr>
<tr>
<td>uomspeed</td>
<td>
<?php _e( 'Speed unit of measure', 'wp-gpx-maps' ); ?>
</td>
<td>
<strong>0</strong> = <?php _e( 'm/s', 'wp-gpx-maps' ); ?>
<br />
<strong>1</strong> = <?php _e( 'km/h', 'wp-gpx-maps' ); ?>
<br />
<strong>2</strong> = <?php _e( 'miles/h', 'wp-gpx-maps' ); ?>
<br />
<strong>3</strong> = <?php _e( 'min/km', 'wp-gpx-maps' ); ?>
<br />
<strong>4</strong> = <?php _e( 'min/miles', 'wp-gpx-maps' ); ?>
<br />
<strong>5</strong> = <?php _e( 'Knots (nautical miles / hour)', 'wp-gpx-maps' ); ?>
<br />
<strong>6</strong> = <?php _e( 'min/100 meters', 'wp-gpx-maps' ); ?>
<br />
</td>
<td>
<?php echo get_option( 'wpgpxmaps_unit_of_measure_speed' ); ?>
</td>
</tr>
<tr>
<td>chartFrom2</td>
<td>
<?php _e( 'Minimum value for speed chart', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_offset_from2' ); ?>
</td>
</tr>
<tr>
<td>chartTo2</td>
<td>
<?php _e( 'Maximum value for speed chart', 'wp-gpx-maps' ); ?>
</td>
<td></td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_offset_to2' ); ?>
</td>
</tr>
<tr>
<td>showhr</td>
<td>
<?php _e( 'Show heart rate inside the chart', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_show_hr' ); ?>
</td>
</tr>
<tr>
<td>glinecolorhr</td>
<td>
<?php _e( 'Heart rate line color', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>#ff77bd</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_line_color_hr' ); ?>
</td>
</tr>
<td>showatemp</td>
<td>
<?php _e( 'Show temperature inside the chart', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_show_atemp' ); ?>
</td>
</tr>
<tr>
<td>glinecoloratemp</td>
<td>
<?php _e( 'Temperature line color', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>#ff77bd</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_line_color_atemp' ); ?>
</td>
</tr>
<tr>
<td>showcad</td>
<td>
<?php _e( 'Show cadence inside the chart', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_show_cadence' ); ?>
</td>
</tr>
<tr>
<td>glinecolorcad</td>
<td>
<?php _e( 'Cadence line color', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>#beecff</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_line_color_cad' ); ?>
</td>
</tr>
<tr>
<td>showgrade</td>
<td>
<?php _e( 'Show grade inside the chart', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_show_grade' ); ?>
</td>
</tr>
<tr>
<td>glinecolorgrade</td>
<td>
<?php _e( 'Grade line color', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>#beecff</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_graph_line_color_grade' ); ?>
</td>
</tr>
</tbody>
</table>
<br />
<table class="widefat">
<thead>
<tr>
<th colspan="3">
<strong><?php _e( 'Pictures', 'wp-gpx-maps' ); ?></strong>
</th>
</tr>
<tr>
<th scope="col">
<?php _e( 'Shortcode', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Description', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Possible values', 'wp-gpx-maps' ); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>nggalleries</td>
<td>
<?php _e( 'NextGen Gallery', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php _e( 'Gallery ID or a list of Galleries ID separated by a comma', 'wp-gpx-maps' ); ?>
</td>
</tr>
<tr>
<td>ngimages</td>
<td>
<?php _e( 'NextGen Image', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php _e( 'Image ID or a list of Images ID separated by a comma', 'wp-gpx-maps' ); ?>
</td>
</tr>
<tr>
<td>attachments</td>
<td>
<?php _e( 'Show all images that are attached to post', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
</tr>
<tr>
<td>dtoffset</td>
<td>
<?php _e( 'The difference between your GPX tool date and your camera date', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php _e( 'Value in seconds', 'wp-gpx-maps' ); ?>
</td>
</tr>
</tbody>
</table>
<br />
<table class="widefat">
<thead>
<tr>
<th colspan="4">
<strong><?php _e( 'Summary table', 'wp-gpx-maps' ); ?></strong>
</th>
</tr>
<tr>
<th scope="col">
<?php _e( 'Shortcode', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Description', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Possible values', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Current value', 'wp-gpx-maps' ); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>summary</td>
<td>
<?php _e( 'Print summary details of your GPX track', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary' ); ?>
</td>
</tr>
<tr>
<td>summarytotlen</td>
<td>
<?php _e( 'Print total distance in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_tot_len' ); ?>
</td>
</tr>
<tr>
<td>summarymaxele</td>
<td>
<?php _e( 'Print max. elevation in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_max_ele' ); ?>
</td>
</tr>
<tr>
<td>summaryminele</td>
<td>
<?php _e( 'Print min. elevation in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_min_ele' ); ?>
</td>
</tr>
<tr>
<td>summaryeleup</td>
<td>
<?php _e( 'Print total climbing in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_total_ele_up' ); ?>
</td>
</tr>
<tr>
<td>summaryeledown</td>
<td>
<?php _e( 'Print total descent in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_total_ele_down' ); ?>
</td>
</tr>
<tr>
<td>summaryavgspeed</td>
<td>
<?php _e( 'Print average speed in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_avg_speed' ); ?>
</td>
</tr>
<tr>
<td>summaryavgcad</td>
<td>
<?php _e( 'Print average cadence in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_avg_cad' ); ?>
</td>
</tr>
<tr>
<td>summaryavghr</td>
<td>
<?php _e( 'Print average heart rate in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_avg_hr' ); ?>
</td>
</tr>
<tr>
<td>summaryavgtemp</td>
<td>
<?php _e( 'Print average temperature in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_avg_temp' ); ?>
</td>
</tr>
<tr>
<td>summarytotaltime</td>
<td>
<?php _e( 'Print total time in summary table', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_summary_total_time' ); ?>
</td>
</tr>
</tbody>
</table>
<br />
<table class="widefat">
<thead>
<tr>
<th colspan="4">
<strong><?php _e( 'Advanced', 'wp-gpx-maps' ); ?></strong>
</th>
</tr>
<tr>
<th scope="col">
<?php _e( 'Shortcode', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Description', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Possible values', 'wp-gpx-maps' ); ?>
</th>
<th scope="col">
<?php _e( 'Current value', 'wp-gpx-maps' ); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>pointsoffset</td>
<td>
<?php _e( 'Skip GPX points closer than XX meters', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>10</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_pointsoffset' ); ?>
</td>
</tr>
<tr>
<td>donotreducegpx</td>
<td>
<?php _e( 'Print all the GPX waypoints without reduce it', 'wp-gpx-maps' ); ?>
</td>
<td>
<?php
_e( 'Default is:', 'wp-gpx-maps' );
echo ' ';
?>
<strong>false</strong>
</td>
<td>
<?php echo get_option( 'wpgpxmaps_donotreducegpx' ); ?>
</td>
</tr>
</tbody>
</table>
</div>
<p>
<a href="http://devfarm.it/forums/forum/wp-gpx-maps/" target="_blank" rel="noopener noreferrer"><?php _e( 'Bugs, problems, thanks and anything else here!', 'wp-gpx-maps' ); ?></a>
</p>
</div>

View File

@ -2,22 +2,23 @@
require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/file.php' );
require_once("wp-gpx-maps_utils_nggallery.php"); require_once( 'wp-gpx-maps_utils_nggallery.php' );
function wpgpxmaps_getAttachedImages( $dt, $lat, $lon, $dtoffset, &$error ) {
function wpgpxmaps_getAttachedImages($dt, $lat, $lon, $dtoffset, &$error)
{
$result = array(); $result = array();
try { try {
$attachments = get_children( array( $attachments = get_children( array(
'post_parent' => get_the_ID(), 'post_parent' => get_the_ID(),
'post_type' => 'attachment', 'post_type' => 'attachment',
'numberposts' => -1, // show all -1 /* show all -1 */
'numberposts' => -1,
'post_status' => 'inherit', 'post_status' => 'inherit',
'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 ) {
@ -30,33 +31,25 @@
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 ) ) {
else if (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 ) {
$error .= 'Error When Retrieving attached images: $e <br />'; $error .= 'Error When Retrieving attached images: $e <br />';
} }
@ -64,65 +57,67 @@
return $result; return $result;
} }
function wp_gpx_maps_sitePath() function wp_gpx_maps_sitePath() {
{
return substr( substr( __FILE__, 0, strrpos( __FILE__, 'wp-content' ) ), 0, -1 ); return substr( substr( __FILE__, 0, strrpos( __FILE__, 'wp-content' ) ), 0, -1 );
// return substr(get_home_path(), 0, -1); // return substr(get_home_path(), 0, -1);
} }
function gpxFolderPath() function gpxFolderPath() {
{
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
$uploadsPath = $upload_dir['basedir']; $uploadsPath = $upload_dir['basedir'];
if ( current_user_can( 'manage_options' ) ){ if ( current_user_can( 'manage_options' ) ){
$ret = $uploadsPath.DIRECTORY_SEPARATOR."gpx"; $ret = $uploadsPath . DIRECTORY_SEPARATOR . 'gpx';
} }
elseif ( current_user_can( 'publish_posts' ) ) { elseif ( current_user_can( 'publish_posts' ) ) {
global $current_user; global $current_user;
get_currentuserinfo(); wp_get_current_user();
$ret = $uploadsPath.DIRECTORY_SEPARATOR."gpx".DIRECTORY_SEPARATOR.$current_user->user_login; $ret = $uploadsPath . DIRECTORY_SEPARATOR . 'gpx' . DIRECTORY_SEPARATOR . $current_user->user_login;
} }
return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $ret ); return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $ret );
} }
function gpxCacheFolderPath() function gpxCacheFolderPath() {
{
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
$uploadsPath = $upload_dir['basedir']; $uploadsPath = $upload_dir['basedir'];
$ret = $uploadsPath.DIRECTORY_SEPARATOR."gpx".DIRECTORY_SEPARATOR."~cache"; $ret = $uploadsPath . DIRECTORY_SEPARATOR . 'gpx' . DIRECTORY_SEPARATOR . '~cache';
return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $ret ); return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $ret );
} }
function relativeGpxFolderPath() function relativeGpxFolderPath() {
{
$sitePath = wp_gpx_maps_sitePath(); $sitePath = wp_gpx_maps_sitePath();
$realGpxPath = gpxFolderPath(); $realGpxPath = gpxFolderPath();
$ret = str_replace( $sitePath, '', $realGpxPath ) . DIRECTORY_SEPARATOR; $ret = str_replace( $sitePath, '', $realGpxPath ) . DIRECTORY_SEPARATOR;
return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $ret ); return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $ret );
} }
function wpgpxmaps_recursive_remove_directory($directory, $empty=FALSE) function relativeGpxCacheFolderPath() {
{
$sitePath = wp_gpx_maps_sitePath();
$realGpxCachePath = gpxCacheFolderPath();
$ret = str_replace( $sitePath, '', $realGpxCachePath ) . DIRECTORY_SEPARATOR;
return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $ret );
}
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 ) ) {
{ return false;
return FALSE; } elseif ( is_readable( $directory ) ) {
}elseif(is_readable($directory))
{
$handle = opendir( $directory ); $handle = opendir( $directory );
while (FALSE !== ($item = readdir($handle))) while ( false !== ( $item = readdir( $handle ) ) ) {
{ if ( $item != '.' && $item != '..' ) {
if($item != '.' && $item != '..')
{
$path = $directory . '/' . $item; $path = $directory . '/' . $item;
if(is_dir($path)) if ( is_dir( $path ) ) {
{
wpgpxmaps_recursive_remove_directory( $path ); wpgpxmaps_recursive_remove_directory( $path );
} else { } else {
unlink( $path ); unlink( $path );
@ -130,19 +125,16 @@
} }
} }
closedir( $handle ); closedir( $handle );
if($empty == FALSE) if ( $empty == false ) {
{ if ( ! rmdir( $directory ) ) {
if(!rmdir($directory)) return false;
{
return FALSE;
} }
} }
} }
return TRUE; return true;
} }
function wpgpxmaps_getPoints($gpxPath, $gpxOffset = 10, $donotreducegpx, $distancetype) function wpgpxmaps_getPoints( $gpxPath, $gpxOffset = 10, $donotreducegpx, $distancetype ) {
{
$points = array(); $points = array();
$dist = 0; $dist = 0;
@ -152,26 +144,20 @@
$lastEle = 0; $lastEle = 0;
$lastOffset = 0; $lastOffset = 0;
if (file_exists($gpxPath)) if ( file_exists( $gpxPath ) ) {
{
$points = @wpgpxmaps_parseXml( $gpxPath, $gpxOffset, $distancetype ); $points = @wpgpxmaps_parseXml( $gpxPath, $gpxOffset, $distancetype );
} } else {
else echo _e( 'WP GPX Maps Error: GPX file not found!', 'wp-gpx-maps' ) . ' ' . $gpxPath;
{
echo "WP GPX Maps Error: File $gpxPath not found!";
} }
// reduce the points to around 200 to speedup /* Reduce the points to around 200 to speedup */
if ( $donotreducegpx != true) if ( $donotreducegpx != true ) {
{
$count = sizeof( $points->lat ); $count = sizeof( $points->lat );
if ($count>200) if ( $count > 200 ) {
{
$f = round( $count/200 ); $f = round( $count/200 );
if ( $f > 1 ) if ( $f > 1 )
for ( $i = $count; $i > 0;$i-- ) for ( $i = $count; $i > 0;$i-- )
if ($i % $f != 0 && $points->lat[$i] != null) if ( $i % $f != 0 && $points->lat[$i] != null ) {
{
unset( $points->dt[$i] ); unset( $points->dt[$i] );
unset( $points->lat[$i] ); unset( $points->lat[$i] );
unset( $points->lon[$i] ); unset( $points->lon[$i] );
@ -188,8 +174,7 @@
return $points; return $points;
} }
function wpgpxmaps_parseXml($filePath, $gpxOffset, $distancetype) function wpgpxmaps_parseXml( $filePath, $gpxOffset, $distancetype ) {
{
$points = null; $points = null;
@ -218,7 +203,7 @@
$gpx = simplexml_load_file( $filePath ); $gpx = simplexml_load_file( $filePath );
if($gpx === FALSE) if ( $gpx === false )
return; return;
$gpx->registerXPathNamespace( 'a', 'http://www.topografix.com/GPX/1/0' ); $gpx->registerXPathNamespace( 'a', 'http://www.topografix.com/GPX/1/0' );
@ -226,13 +211,11 @@
$gpx->registerXPathNamespace( 'ns3', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1' ); $gpx->registerXPathNamespace( 'ns3', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1' );
$nodes = $gpx->xpath( '//trk | //a:trk | //b:trk ' ); $nodes = $gpx->xpath( '//trk | //a:trk | //b:trk ' );
//normal gpx /* Normal GPX */
if ( count($nodes) > 0 ) if ( count( $nodes ) > 0 ) {
{
foreach($nodes as $_trk) foreach ( $nodes as $_trk ) {
{
$trk = simplexml_load_string( $_trk->asXML() ); $trk = simplexml_load_string( $_trk->asXML() );
@ -250,8 +233,7 @@
$lastOffset = 0; $lastOffset = 0;
$speedBuffer = array(); $speedBuffer = array();
foreach($trkpts as $trkpt) foreach ( $trkpts as $trkpt ) {
{
$lat = $trkpt['lat']; $lat = $trkpt['lat'];
$lon = $trkpt['lon']; $lon = $trkpt['lon'];
@ -263,32 +245,26 @@
$cad = 0; $cad = 0;
$grade = 0; $grade = 0;
if (isset($trkpt->extensions)) if ( isset( $trkpt->extensions ) ) {
{
$arr = json_decode( json_encode($trkpt->extensions) , 1); $arr = json_decode( wp_json_encode( $trkpt->extensions ), 1 );
if (isset($arr['ns3:TrackPointExtension'])) if ( isset( $arr['ns3:TrackPointExtension'] ) ) {
{
$tpe = $arr['ns3:TrackPointExtension']; $tpe = $arr['ns3:TrackPointExtension'];
$hr = @$tpe["ns3:hr"]; $hr = @$tpe["ns3:hr"];
$atemp = @$tpe["ns3:atemp"]; $atemp = @$tpe["ns3:atemp"];
$cad = @$tpe["ns3:cad"]; $cad = @$tpe["ns3:cad"];
} } elseif ( isset( $arr['TrackPointExtension'] ) ) {
else if (isset($arr['TrackPointExtension']))
{
$tpe = $arr['TrackPointExtension']; $tpe = $arr['TrackPointExtension'];
$hr = @$tpe["hr"]; $hr = @$tpe["hr"];
$atemp = @$tpe["atemp"]; $atemp = @$tpe["atemp"];
$cad = @$tpe["cad"]; $cad = @$tpe["cad"];
} }
} }
if ($lastLat == 0 && $lastLon == 0) if ( $lastLat == 0 && $lastLon == 0 ) {
{
//Base Case
/* Base Case */
array_push( $points->dt, strtotime( $time ) ); array_push( $points->dt, strtotime( $time ) );
array_push( $points->lat, (float) $lat ); array_push( $points->lat, (float) $lat );
array_push( $points->lon, (float) $lon ); array_push( $points->lon, (float) $lon );
@ -304,51 +280,39 @@
$lastLon = $lon; $lastLon = $lon;
$lastEle = $ele; $lastEle = $ele;
$lastTime = $time; $lastTime = $time;
} } else {
else
{ /* Normal Case */
//Normal Case
$offset = calculateDistance( (float) $lat, (float) $lon, (float) $ele, (float) $lastLat, (float) $lastLon, (float) $lastEle, $distancetype ); $offset = calculateDistance( (float) $lat, (float) $lon, (float) $ele, (float) $lastLat, (float) $lastLon, (float) $lastEle, $distancetype );
$dist = $dist + $offset; $dist = $dist + $offset;
$points->totalLength = $dist; $points->totalLength = $dist;
if ($speed == 0) if ( $speed == 0 ) {
{
$datediff = (float) my_date_diff( $lastTime, $time ); $datediff = (float) my_date_diff( $lastTime, $time );
if ($datediff>0) if ( $datediff > 0 ) {
{
$speed = $offset / $datediff; $speed = $offset / $datediff;
} }
} }
if ($ele != 0 && $lastEle != 0) if ( $ele != 0 && $lastEle != 0 ) {
{
$deltaEle = (float) ( $ele - $lastEle ); $deltaEle = (float) ( $ele - $lastEle );
if ((float)$ele > (float)$lastEle) if ( (float) $ele > (float) $lastEle ) {
{
$points->totalEleUp += $deltaEle; $points->totalEleUp += $deltaEle;
} } else {
else
{
$points->totalEleDown += $deltaEle; $points->totalEleDown += $deltaEle;
} }
$grade = $deltaEle / $offset * 100; $grade = $deltaEle / $offset * 100;
} }
array_push( $speedBuffer, $speed ); array_push( $speedBuffer, $speed );
if (((float) $offset + (float) $lastOffset) > $gpxOffset) if ( ( (float) $offset + (float) $lastOffset ) > $gpxOffset ) {
{ /* Bigger Offset -> write coordinate */
//Bigger Offset -> write coordinate
$avgSpeed = 0; $avgSpeed = 0;
foreach($speedBuffer as $s) foreach ( $speedBuffer as $s ) {
{
$avgSpeed += $s; $avgSpeed += $s;
} }
@ -368,10 +332,8 @@
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;
} }
} }
@ -421,35 +383,32 @@
$points->maxTime = max( $_time ); $points->maxTime = max( $_time );
$points->minTime = min( $_time ); $points->minTime = min( $_time );
// Calculating Average Speed /* Calculating Average Speed */
$_speed = array_filter( $points->speed ); $_speed = array_filter( $points->speed );
$points->avgSpeed = array_sum( $_speed ) / count( $_speed ); $points->avgSpeed = array_sum( $_speed ) / count( $_speed );
// Calculating Average Cadence /* Calculating Average Cadence */
$_cad = array_filter( $points->cad ); $_cad = array_filter( $points->cad );
$points->avgCad = (float) round( array_sum( $_cad ) / count( $_cad ), 0 ); $points->avgCad = (float) round( array_sum( $_cad ) / count( $_cad ), 0 );
// Calculating Average Heart Rate /* Calculating Average Heart Rate */
$_hr = array_filter( $points->hr ); $_hr = array_filter( $points->hr );
$points->avgHr = (float) round( array_sum( $_hr ) / count( $_hr ), 0 ); $points->avgHr = (float) round( array_sum( $_hr ) / count( $_hr ), 0 );
// Calculating Average Temperature /* Calculating Average Temperature */
$_temp = array_filter( $points->atemp ); $_temp = array_filter( $points->atemp );
$points->avgTemp = (float) round( array_sum( $_temp ) / count( $_temp ), 1 ); $points->avgTemp = (float) round( array_sum( $_temp ) / count( $_temp ), 1 );
} catch (Exception $e) { } } catch ( Exception $e ) {
} }
else } else {
{
// gpx garmin case /* GPX Garmin case */
$gpx->registerXPathNamespace( 'gpxx', 'http://www.garmin.com/xmlschemas/GpxExtensions/v3' ); $gpx->registerXPathNamespace( 'gpxx', 'http://www.garmin.com/xmlschemas/GpxExtensions/v3' );
$nodes = $gpx->xpath( '//gpxx:rpt' ); $nodes = $gpx->xpath( '//gpxx:rpt' );
if ( count($nodes) > 0 ) if ( count( $nodes ) > 0 ) {
{
$lastLat = 0; $lastLat = 0;
$lastLon = 0; $lastLon = 0;
@ -457,15 +416,14 @@
$dist = 0; $dist = 0;
$lastOffset = 0; $lastOffset = 0;
// Garmin case /* GPX Garmin case */
foreach($nodes as $rpt) foreach ( $nodes as $rpt ) {
{
$lat = $rpt['lat']; $lat = $rpt['lat'];
$lon = $rpt['lon']; $lon = $rpt['lon'];
if ($lastLat == 0 && $lastLon == 0) if ( $lastLat == 0 && $lastLon == 0 ) {
{
//Base Case /* Base Case */
array_push( $points->lat, (float) $lat ); array_push( $points->lat, (float) $lat );
array_push( $points->lon, (float) $lon ); array_push( $points->lon, (float) $lon );
array_push( $points->ele, 0 ); array_push( $points->ele, 0 );
@ -477,15 +435,14 @@
array_push( $points->grade, 0 ); array_push( $points->grade, 0 );
$lastLat = $lat; $lastLat = $lat;
$lastLon = $lon; $lastLon = $lon;
} } else {
else
{ /* Base Case */
//Normal Case
$offset = calculateDistance( $lat, $lon, 0, $lastLat, $lastLon, 0, $distancetype ); $offset = calculateDistance( $lat, $lon, 0, $lastLat, $lastLon, 0, $distancetype );
$dist = $dist + $offset; $dist = $dist + $offset;
if (((float) $offset + (float) $lastOffset) > $gpxOffset) if ( ( (float) $offset + (float) $lastOffset ) > $gpxOffset ) {
{
//Bigger Offset -> write coordinate /* Bigger Offset -> write coordinate */
$lastOffset = 0; $lastOffset = 0;
array_push( $points->lat, (float) $lat ); array_push( $points->lat, (float) $lat );
array_push( $points->lon, (float) $lon ); array_push( $points->lon, (float) $lon );
@ -496,10 +453,9 @@
array_push( $points->atemp, 0 ); array_push( $points->atemp, 0 );
array_push( $points->cad, 0 ); array_push( $points->cad, 0 );
array_push( $points->grade, 0 ); array_push( $points->grade, 0 );
} } else {
else
{ /* Smoller Offset -> continue.. */
//Smoller Offset -> continue..
$lastOffset = (float) $lastOffset + (float) $offset; $lastOffset = (float) $lastOffset + (float) $offset;
} }
} }
@ -508,15 +464,11 @@
} }
unset( $nodes ); unset( $nodes );
} } else {
else
{
//gpx strange case
/* GPX Strange case */
$nodes = $gpx->xpath( '//rtept | //a:rtept | //b:rtept' ); $nodes = $gpx->xpath( '//rtept | //a:rtept | //b:rtept' );
if ( count($nodes) > 0 ) if ( count( $nodes ) > 0 ) {
{
$lastLat = 0; $lastLat = 0;
$lastLon = 0; $lastLon = 0;
@ -524,15 +476,14 @@
$dist = 0; $dist = 0;
$lastOffset = 0; $lastOffset = 0;
// Garmin case /* Garmin case */
foreach($nodes as $rtept) foreach ( $nodes as $rtept ) {
{
$lat = $rtept['lat']; $lat = $rtept['lat'];
$lon = $rtept['lon']; $lon = $rtept['lon'];
if ($lastLat == 0 && $lastLon == 0) if ( $lastLat == 0 && $lastLon == 0 ) {
{
//Base Case /* Base Case */
array_push( $points->lat, (float) $lat ); array_push( $points->lat, (float) $lat );
array_push( $points->lon, (float) $lon ); array_push( $points->lon, (float) $lon );
array_push( $points->ele, 0 ); array_push( $points->ele, 0 );
@ -544,15 +495,14 @@
array_push( $points->grade, 0 ); array_push( $points->grade, 0 );
$lastLat = $lat; $lastLat = $lat;
$lastLon = $lon; $lastLon = $lon;
} } else {
else
{ /* Normal Case */
//Normal Case
$offset = calculateDistance( $lat, $lon, 0, $lastLat, $lastLon, 0, $distancetype ); $offset = calculateDistance( $lat, $lon, 0, $lastLat, $lastLon, 0, $distancetype );
$dist = $dist + $offset; $dist = $dist + $offset;
if (((float) $offset + (float) $lastOffset) > $gpxOffset) if ( ( (float) $offset + (float) $lastOffset ) > $gpxOffset ) {
{
//Bigger Offset -> write coordinate /* Bigger Offset -> write coordinate */
$lastOffset = 0; $lastOffset = 0;
array_push( $points->lat, (float) $lat ); array_push( $points->lat, (float) $lat );
array_push( $points->lon, (float) $lon ); array_push( $points->lon, (float) $lon );
@ -563,10 +513,9 @@
array_push( $points->atemp, 0 ); array_push( $points->atemp, 0 );
array_push( $points->cad, 0 ); array_push( $points->cad, 0 );
array_push( $points->grade, 0 ); array_push( $points->grade, 0 );
} } else {
else
{ /* Smoller Offset -> continue.. */
//Smoller Offset -> continue..
$lastOffset= (float) $lastOffset + (float) $offset; $lastOffset= (float) $lastOffset + (float) $offset;
} }
} }
@ -574,26 +523,20 @@
$lastLon = $lon; $lastLon = $lon;
} }
unset( $nodes ); unset( $nodes );
} }
} }
} }
unset( $gpx ); unset( $gpx );
return $points; return $points;
} }
function wpgpxmaps_getWayPoints($gpxPath) function wpgpxmaps_getWayPoints( $gpxPath ) {
{
$points = array(); $points = array();
if (file_exists($gpxPath)) if ( file_exists( $gpxPath ) ) {
{
try { try {
$gpx = simplexml_load_file( $gpxPath ); $gpx = simplexml_load_file( $gpxPath );
} catch ( Exception $e ) { } catch ( Exception $e ) {
echo "WP GPX Maps Error: Cant parse xml file " . $gpxPath; echo _e( 'WP GPX Maps Error: Can&#8217;t parse xml file!', 'wp-gpx-maps' ) . ' ' . $gpxPath;
return $points; return $points;
} }
@ -602,11 +545,9 @@
$nodes = $gpx->xpath( '//wpt | //a:wpt | //b:wpt' ); $nodes = $gpx->xpath( '//wpt | //a:wpt | //b:wpt' );
global $wpdb; global $wpdb;
if ( count($nodes) > 0 ) if ( count( $nodes ) > 0 ) {
{ /* Normal case */
// normal case foreach ( $nodes as $wpt ) {
foreach($nodes as $wpt)
{
$lat = $wpt['lat']; $lat = $wpt['lat'];
$lon = $wpt['lon']; $lon = $wpt['lon'];
$ele = (string) $wpt->ele; $ele = (string) $wpt->ele;
@ -617,8 +558,7 @@
$type = (string) $wpt->type; $type = (string) $wpt->type;
$img = ''; $img = '';
if ($sym) if ( $sym ) {
{
$img_name = 'map-marker-' . $sym; $img_name = 'map-marker-' . $sym;
$query = "SELECT ID FROM {$wpdb->prefix}posts WHERE post_name LIKE '{$img_name}' AND post_type LIKE 'attachment'"; $query = "SELECT ID FROM {$wpdb->prefix}posts WHERE post_name LIKE '{$img_name}' AND post_type LIKE 'attachment'";
$img_id = $wpdb->get_var( $query ); $img_id = $wpdb->get_var( $query );
@ -636,7 +576,7 @@
"desc" => $desc, "desc" => $desc,
"sym" => $sym, "sym" => $sym,
"type" => $type, "type" => $type,
"img" => $img "img" => $img,
)); ));
} }
} }
@ -644,38 +584,36 @@
return $points; return $points;
} }
function toRadians($degrees) function toRadians( $degrees ) {
{
return (float) ( $degrees * 3.1415926535897932385 / 180 ); return (float) ( $degrees * 3.1415926535897932385 / 180 );
} }
function calculateDistance($lat1,$lon1,$ele1,$lat2,$lon2,$ele2,$distancetype) function calculateDistance ( $lat1, $lon1, $ele1, $lat2, $lon2, $ele2, $distancetype ) {
{
if ($distancetype == '2') // climb /* Distance typ: Climb */
{ if ( $distancetype == '2' ) {
return (float) $ele1 - (float) $ele2; return (float) $ele1 - (float) $ele2;
}
else if ($distancetype == '1') // flat /* Distance typ: Flat */
{ } elseif ( $distancetype == '1' ) {
$alpha = (float) sin( (float) toRadians( (float) $lat2 - (float) $lat1 ) / 2 ); $alpha = (float) sin( (float) toRadians( (float) $lat2 - (float) $lat1 ) / 2 );
$beta = (float) sin( (float) toRadians( (float) $lon2 - (float) $lon1 ) / 2 ); $beta = (float) sin( (float) toRadians( (float) $lon2 - (float) $lon1 ) / 2 );
//Distance in meters /* Distance in meters */
$a = (float) ( (float) $alpha * (float) $alpha ) + (float) ( (float) cos( (float) toRadians( $lat1 ) ) * (float) cos( (float) toRadians( $lat2 ) ) * (float) $beta * (float) $beta ); $a = (float) ( (float) $alpha * (float) $alpha ) + (float) ( (float) cos( (float) toRadians( $lat1 ) ) * (float) cos( (float) toRadians( $lat2 ) ) * (float) $beta * (float) $beta );
$dist = 2 * 6369628.75 * (float) atan2( (float) sqrt( (float) $a ), (float) sqrt( 1 - (float) $a ) ); $dist = 2 * 6369628.75 * (float) atan2( (float) sqrt( (float) $a ), (float) sqrt( 1 - (float) $a ) );
return (float) sqrt( (float) pow( (float) $dist, 2 ) + pow( (float) $lat1 - (float) $lat2, 2 ) ); return (float) sqrt( (float) pow( (float) $dist, 2 ) + pow( (float) $lat1 - (float) $lat2, 2 ) );
}
else // normal /* Distance typ: Normal */
{ } else {
$alpha = (float) sin( (float) toRadians( (float) $lat2 - (float) $lat1 ) / 2 ); $alpha = (float) sin( (float) toRadians( (float) $lat2 - (float) $lat1 ) / 2 );
$beta = (float) sin( (float) toRadians( (float) $lon2 - (float) $lon1 ) / 2 ); $beta = (float) sin( (float) toRadians( (float) $lon2 - (float) $lon1 ) / 2 );
//Distance in meters /* Distance in meters */
$a = (float) ( (float) $alpha * (float) $alpha ) + (float) ( (float) cos( (float) toRadians( $lat1 ) ) * (float) cos( (float) toRadians( $lat2 ) ) * (float) $beta * (float) $beta ); $a = (float) ( (float) $alpha * (float) $alpha ) + (float) ( (float) cos( (float) toRadians( $lat1 ) ) * (float) cos( (float) toRadians( $lat2 ) ) * (float) $beta * (float) $beta );
$dist = 2 * 6369628.75 * (float) atan2( (float) sqrt( (float) $a ), (float) sqrt( 1 - (float) $a ) ); $dist = 2 * 6369628.75 * (float) atan2( (float) sqrt( (float) $a ), (float) sqrt( 1 - (float) $a ) );
$d = (float) sqrt( (float) pow( (float) $dist, 2 ) + pow( (float) $lat1 - (float) $lat2, 2 ) ); $d = (float) sqrt( (float) pow( (float) $dist, 2 ) + pow( (float) $lat1 - (float) $lat2, 2 ) );
return sqrt( (float) pow( (float) $ele1 - (float) $ele2, 2 ) + (float) pow( (float) $d, 2 ) ); return sqrt( (float) pow( (float) $ele1 - (float) $ele2, 2 ) + (float) pow( (float) $d, 2 ) );
} }
} }
function my_date_diff( $old_date, $new_date ) { function my_date_diff( $old_date, $new_date ) {
@ -683,7 +621,7 @@
$t1 = strtotime( $new_date ); $t1 = strtotime( $new_date );
$t2 = strtotime( $old_date ); $t2 = strtotime( $old_date );
// milliceconds fix /* Fix for milliceconds */
$t1 += date_getDecimals( $new_date ); $t1 += date_getDecimals( $new_date );
$t2 += date_getDecimals( $old_date ); $t2 += date_getDecimals( $old_date );
@ -692,18 +630,12 @@
return $offset; return $offset;
} }
function date_getDecimals($date) function date_getDecimals( $date ) {
{
if (preg_match('(\.([0-9]{2})Z?)', $date, $matches)) if ( preg_match( '(\.([0-9]{2})Z?)', $date, $matches ) ) {
{
return (float) ( (float) $matches[1] / 100 ); return (float) ( (float) $matches[1] / 100 );
} } else {
else
{
return 0; return 0;
} }
} }
?> ?>

View File

@ -1,31 +1,31 @@
<?php <?php
function wpgpxmaps_isNGGalleryActive() { function wpgpxmaps_isNGGalleryActive() {
if ( ! function_exists( 'is_plugin_active' ) ) { if ( ! function_exists( 'is_plugin_active' ) ) {
require_once( wp_gpx_maps_sitePath() . '/wp-admin/includes/plugin.php' ); require_once( wp_gpx_maps_sitePath() . '/wp-admin/includes/plugin.php' );
} }
return is_plugin_active("nextgen-gallery/nggallery.php"); return is_plugin_active( 'nextgen-gallery/nggallery.php' );
} }
function wpgpxmaps_isNGGalleryProActive() { function wpgpxmaps_isNGGalleryProActive() {
if ( ! function_exists( 'is_plugin_active' ) ) { if ( ! function_exists( 'is_plugin_active' ) ) {
require_once( wp_gpx_maps_sitePath() . '/wp-admin/includes/plugin.php' ); require_once( wp_gpx_maps_sitePath() . '/wp-admin/includes/plugin.php' );
} }
return is_plugin_active("nextgen-gallery-pro/nggallery-pro.php"); return is_plugin_active( 'nextgen-gallery-pro/nggallery-pro.php' );
} }
function getNGGalleryImages( $ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error ) {
function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error)
{
$result = array(); $result = array();
$galids = explode( ',', $ngGalleries ); $galids = explode( ',', $ngGalleries );
$imgids = explode( ',', $ngImages ); $imgids = explode( ',', $ngImages );
if ( ! wpgpxmaps_isNGGalleryActive() ) if ( ! wpgpxmaps_isNGGalleryActive() )
return ''; return '';
try { try {
$pictures = array(); $pictures = array();
foreach ( $galids as $g ) { foreach ( $galids as $g ) {
$pictures = array_merge( $pictures, nggdb::get_gallery( $g ) ); $pictures = array_merge( $pictures, nggdb::get_gallery( $g ) );
@ -33,117 +33,96 @@
foreach ( $imgids as $i ) { foreach ( $imgids as $i ) {
array_push( $pictures, nggdb::find_image( $i ) ); array_push( $pictures, nggdb::find_image( $i ) );
} }
// print_r ($pictures);
foreach ( $pictures as $p ) { foreach ( $pictures as $p ) {
$item = array(); $item = array();
$item["data"] = $p->thumbHTML; $item['data'] = $p->thumbHTML;
if ( is_callable( 'exif_read_data' ) ) {
if (is_callable('exif_read_data'))
{
$exif = @exif_read_data( $p->imagePath ); $exif = @exif_read_data( $p->imagePath );
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 ) ) {
else if (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='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='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >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 */
if ( class_exists( 'C_Component_Registry' ) ) {
if ( class_exists("C_Component_Registry") )
{
$renderer = C_Component_Registry::get_instance()->get_utility( 'I_Displayed_Gallery_Renderer' ); $renderer = C_Component_Registry::get_instance()->get_utility( 'I_Displayed_Gallery_Renderer' );
$params['gallery_ids'] = $ngGalleries; $params['gallery_ids'] = $ngGalleries;
$params['image_ids'] = $ngImages; $params['image_ids'] = $ngImages;
$params['display_type'] = NEXTGEN_GALLERY_BASIC_THUMBNAILS; $params['display_type'] = NEXTGEN_GALLERY_BASIC_THUMBNAILS;
$params['images_per_page'] = 999; $params['images_per_page'] = 999;
// also add js references to get the gallery working /* Salso add js references to get the gallery working */
$dummy = $renderer->display_images( $params, $inner_content ); $dummy = $renderer->display_images( $params, $inner_content );
/* START FIX NEXT GEN GALLERY PRO */ /* START FIX NEXT GEN GALLERY PRO */
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"]);
} }
} }
} }
/* END FIX NEXT GEN GALLERY PRO */ /* END FIX NEXT GEN GALLERY PRO */
} }
/* END FIX NEXT GEN GALLERY 2.x */ /* END FIX NEXT GEN GALLERY 2.x */
} catch ( Exception $e ) { } catch ( Exception $e ) {
$error .= 'Error When Retrieving NextGen Gallery galleries/images: $e <br />'; $error .= 'Error When Retrieving NextGen Gallery galleries/images: $e <br />';
} }
return $result; return $result;
} }
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;
} }
function getExifGps($exifCoord, $hemi) function getExifGps( $exifCoord, $hemi ) {
{
$degrees = count( $exifCoord ) > 0 ? gps2Num( $exifCoord[0] ) : 0; $degrees = count( $exifCoord ) > 0 ? gps2Num( $exifCoord[0] ) : 0;
$minutes = count( $exifCoord ) > 1 ? gps2Num( $exifCoord[1] ) : 0; $minutes = count( $exifCoord ) > 1 ? gps2Num( $exifCoord[1] ) : 0;
$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 ) {
{
$parts = explode( '/', $coordPart ); $parts = explode( '/', $coordPart );
if ( count( $parts ) <= 0 ) if ( count( $parts ) <= 0 )
return 0; return 0;
if ( count( $parts ) == 1 ) if ( count( $parts ) == 1 )
return $parts[0]; return $parts[0];
$lat = floatval( $parts[0] ); $lat = floatval( $parts[0] );
$lon = floatval( $parts[1] ); $lon = floatval( $parts[1] );
if ($lon == 0 ) if ($lon == 0 )
return $lat; return $lat;
return $lat / $lon; return $lat / $lon;
} }
?> ?>