Added Thunderforest Api Key on settings: for OpenCycleMap
This commit is contained in:
parent
030b1fe45b
commit
29d00aa301
|
@ -2,7 +2,7 @@
|
||||||
Plugin Name: WP-GPX-Maps
|
Plugin Name: WP-GPX-Maps
|
||||||
Plugin URI: http://www.devfarm.it/
|
Plugin URI: http://www.devfarm.it/
|
||||||
Description: Draws a gpx track with altitude graph
|
Description: Draws a gpx track with altitude graph
|
||||||
Version: 1.3.9
|
Version: 1.3.14
|
||||||
Author: Bastianon Massimo
|
Author: Bastianon Massimo
|
||||||
Author URI: http://www.pedemontanadelgrappa.it/
|
Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
*/
|
*/
|
||||||
|
@ -122,6 +122,9 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
var pluginUrl = params.pluginUrl;
|
var pluginUrl = params.pluginUrl;
|
||||||
var usegpsposition = params.usegpsposition;
|
var usegpsposition = params.usegpsposition;
|
||||||
var currentpositioncon= params.currentpositioncon;
|
var currentpositioncon= params.currentpositioncon;
|
||||||
|
var ThunderforestApiKey = params.TFApiKey;
|
||||||
|
|
||||||
|
var hasThunderforestApiKey = (ThunderforestApiKey + '').length > 0;
|
||||||
|
|
||||||
// Unit of measure settings
|
// Unit of measure settings
|
||||||
var l_s;
|
var l_s;
|
||||||
|
@ -195,7 +198,10 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
|
|
||||||
map.mapTypes.set("OSM2", new google.maps.ImageMapType({
|
map.mapTypes.set("OSM2", new google.maps.ImageMapType({
|
||||||
getTileUrl: function(coord, zoom) {
|
getTileUrl: function(coord, zoom) {
|
||||||
return "http://a.tile.opencyclemap.org/cycle/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
|
if (hasThunderforestApiKey)
|
||||||
|
return "http://a.tile.thunderforest.com/cycle/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey;
|
||||||
|
else
|
||||||
|
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",
|
||||||
|
@ -205,7 +211,10 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
|
|
||||||
map.mapTypes.set("OSM4", new google.maps.ImageMapType({
|
map.mapTypes.set("OSM4", new google.maps.ImageMapType({
|
||||||
getTileUrl: function(coord, zoom) {
|
getTileUrl: function(coord, zoom) {
|
||||||
return "http://a.tile2.opencyclemap.org/transport/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
|
if (hasThunderforestApiKey)
|
||||||
|
return "http://a.tile.thunderforest.com/transport/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey;
|
||||||
|
else
|
||||||
|
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",
|
||||||
|
@ -215,7 +224,10 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
|
|
||||||
map.mapTypes.set("OSM5", new google.maps.ImageMapType({
|
map.mapTypes.set("OSM5", new google.maps.ImageMapType({
|
||||||
getTileUrl: function(coord, zoom) {
|
getTileUrl: function(coord, zoom) {
|
||||||
return "http://a.tile3.opencyclemap.org/landscape/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
|
if (hasThunderforestApiKey)
|
||||||
|
return "http://a.tile.thunderforest.com/landscape/" + zoom + "/" + coord.x + "/" + coord.y + ".png?apikey=" + ThunderforestApiKey;
|
||||||
|
else
|
||||||
|
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",
|
||||||
|
@ -938,10 +950,7 @@ Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graphSpeed != '') {
|
if (graphSpeed != '') {
|
||||||
if (unitspeed == '6') /* min/100m */
|
if (unitspeed == '6') /* min/100m */ { l_s = { suf : "min/100m", dec : 2 }; }
|
||||||
{
|
|
||||||
l_s = { suf : "min/100m", dec : 2 };
|
|
||||||
}
|
|
||||||
else if (unitspeed == '5') /* knots */
|
else if (unitspeed == '5') /* knots */
|
||||||
{
|
{
|
||||||
l_s = { suf : "knots", dec : 2 };
|
l_s = { suf : "knots", dec : 2 };
|
||||||
|
|
|
@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
||||||
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
|
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
|
||||||
Requires at least: 2.0.0
|
Requires at least: 2.0.0
|
||||||
Tested up to: 4.7.2
|
Tested up to: 4.7.2
|
||||||
Stable tag: 1.3.13
|
Stable tag: 1.3.14
|
||||||
|
|
||||||
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
|
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
|
||||||
|
|
||||||
|
@ -153,7 +153,10 @@ Yes!
|
||||||
1. Altitude & Speed
|
1. Altitude & Speed
|
||||||
1. Altitude & Speed & Hearth rate
|
1. Altitude & Speed & Hearth rate
|
||||||
|
|
||||||
== Changelog === 1.3.13 =
|
== Changelog ==
|
||||||
|
= 1.3.14 =
|
||||||
|
* Added Thunderforest Api Key on settings: for OpenCycleMap
|
||||||
|
= 1.3.13 =
|
||||||
* Added google maps api key on settings
|
* Added google maps api key on settings
|
||||||
* Removed parameter 'sensor' on google maps js
|
* Removed parameter 'sensor' on google maps js
|
||||||
* Added unit of measure of speed for swimmers: min/100 meters
|
* Added unit of measure of speed for swimmers: min/100 meters
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Plugin Name: WP-GPX-Maps
|
Plugin Name: WP-GPX-Maps
|
||||||
Plugin URI: http://www.devfarm.it/
|
Plugin URI: http://www.devfarm.it/
|
||||||
Description: Draws a GPX track with altitude chart
|
Description: Draws a GPX track with altitude chart
|
||||||
Version: 1.3.13
|
Version: 1.3.14
|
||||||
Author: Bastianon Massimo
|
Author: Bastianon Massimo
|
||||||
Author URI: http://www.pedemontanadelgrappa.it/
|
Author URI: http://www.pedemontanadelgrappa.it/
|
||||||
*/
|
*/
|
||||||
|
@ -51,7 +51,7 @@ function enqueue_WP_GPX_Maps_scripts()
|
||||||
wp_enqueue_script( 'jquery' ); if ($wpgpxmaps_googlemapsv3_apikey) { wp_enqueue_script( 'googlemaps', '//maps.googleapis.com/maps/api/js?key='.$wpgpxmaps_googlemapsv3_apikey, null, null); } else { wp_enqueue_script( 'googlemaps', '//maps.googleapis.com/maps/api/js', null, null); }
|
wp_enqueue_script( 'jquery' ); if ($wpgpxmaps_googlemapsv3_apikey) { wp_enqueue_script( 'googlemaps', '//maps.googleapis.com/maps/api/js?key='.$wpgpxmaps_googlemapsv3_apikey, null, null); } else { wp_enqueue_script( 'googlemaps', '//maps.googleapis.com/maps/api/js', null, null); }
|
||||||
|
|
||||||
wp_enqueue_script( 'highcharts', "//code.highcharts.com/3.0.10/highcharts.js", array('jquery'), "3.0.10", true);
|
wp_enqueue_script( 'highcharts', "//code.highcharts.com/3.0.10/highcharts.js", array('jquery'), "3.0.10", true);
|
||||||
wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.13");
|
wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.14");
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_WP_GPX_Maps_styles()
|
function print_WP_GPX_Maps_styles()
|
||||||
|
@ -669,6 +669,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
||||||
ngGalleries : ['.$ngGalleries.'],
|
ngGalleries : ['.$ngGalleries.'],
|
||||||
ngImages : ['.$ngImages.'],
|
ngImages : ['.$ngImages.'],
|
||||||
pluginUrl : "'.plugins_url().'",
|
pluginUrl : "'.plugins_url().'",
|
||||||
|
TFApiKey : "'.get_option('wpgpxmaps_openstreetmap_apikey').'",
|
||||||
langs : { altitude : "'.__("Altitude", "wp-gpx-maps").'",
|
langs : { altitude : "'.__("Altitude", "wp-gpx-maps").'",
|
||||||
currentPosition : "'.__("Current Position", "wp-gpx-maps").'",
|
currentPosition : "'.__("Current Position", "wp-gpx-maps").'",
|
||||||
speed : "'.__("Speed", "wp-gpx-maps").'",
|
speed : "'.__("Speed", "wp-gpx-maps").'",
|
||||||
|
@ -744,8 +745,7 @@ function convertSeconds($s){
|
||||||
|
|
||||||
function convertSpeed($speed,$uomspeed, $addUom = false){
|
function convertSpeed($speed,$uomspeed, $addUom = false){
|
||||||
$uom = '';
|
$uom = '';
|
||||||
if ($uomspeed == '6') /* min/100 meters */
|
if ($uomspeed == '6') /* min/100 meters */ {
|
||||||
{
|
|
||||||
$speed = 1 / $speed * 100 / 60 ;
|
$speed = 1 / $speed * 100 / 60 ;
|
||||||
$uom = " min/100m";
|
$uom = " min/100m";
|
||||||
} else if ($uomspeed == '5') /* knots */ {
|
} else if ($uomspeed == '5') /* knots */ {
|
||||||
|
@ -766,6 +766,7 @@ function convertSpeed($speed,$uomspeed, $addUom = false){
|
||||||
} else /* dafault m/s */ {
|
} else /* dafault m/s */ {
|
||||||
$uom = " m/s";
|
$uom = " m/s";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($addUom == true) {
|
if ($addUom == true) {
|
||||||
return number_format ( $speed , 2 , '.' , '' ) . $uom;
|
return number_format ( $speed , 2 , '.' , '' ) . $uom;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
$total_time = get_option("wpgpxmaps_summary_total_time");
|
$total_time = get_option("wpgpxmaps_summary_total_time");
|
||||||
|
|
||||||
$usegpsposition = get_option("wpgpxmaps_usegpsposition");
|
$usegpsposition = get_option("wpgpxmaps_usegpsposition");
|
||||||
$distanceType = get_option("wpgpxmaps_distance_type"); $distanceType = get_option("wpgpxmaps_googlemapsv3_apikey");
|
$distanceType = get_option("wpgpxmaps_distance_type");
|
||||||
|
|
||||||
if (empty($showEle))
|
if (empty($showEle))
|
||||||
$showEle = "true";
|
$showEle = "true";
|
||||||
|
@ -102,11 +102,23 @@
|
||||||
<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>Allow users to use browser GPS in order to display their current position on map</i>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr> <th scope="row">Google maps api key:</th> <td> <input name="wpgpxmaps_googlemapsv3_apikey" type="text" id="wpgpxmaps_googlemapsv3_apikey" value="<?php echo get_option('wpgpxmaps_googlemapsv3_apikey'); ?>" style="width:400px" /> <em> Go to the <a href="https://developers.google.com/maps/documentation/javascript/" target="_blank">Google API Console</a> and click ‘Get A Key’ </em> </td> </tr> </table>
|
<tr>
|
||||||
|
<th scope="row">Google maps api key:</th>
|
||||||
|
<td>
|
||||||
|
<input name="wpgpxmaps_googlemapsv3_apikey" type="text" id="wpgpxmaps_googlemapsv3_apikey" value="<?php echo get_option('wpgpxmaps_googlemapsv3_apikey'); ?>" style="width:400px" /> <em> Go to the <a href="https://developers.google.com/maps/documentation/javascript/" target="_blank">Google API Console</a> and click ‘Get A Key’ </em>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Thunderforest api key (Open Cycle Map):</th>
|
||||||
|
<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 ‘signing in to your Thunderforest account’ </em>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download,wpgpxmaps_skipcache,wpgpxmaps_distance_type,wpgpxmaps_usegpsposition,wpgpxmaps_googlemapsv3_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_googlemapsv3_apikey,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>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue