diff --git a/languages/wp-gpx-maps-bg_BG.mo b/languages/wp-gpx-maps-bg_BG.mo new file mode 100644 index 0000000..5310bc8 Binary files /dev/null and b/languages/wp-gpx-maps-bg_BG.mo differ diff --git a/languages/wp-gpx-maps-bg_BG.po b/languages/wp-gpx-maps-bg_BG.po new file mode 100644 index 0000000..3e52bad --- /dev/null +++ b/languages/wp-gpx-maps-bg_BG.po @@ -0,0 +1,93 @@ +msgid "" +msgstr "" +"Project-Id-Version: wp-gpx-maps\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-10-30 14:41+0100\n" +"PO-Revision-Date: 2013-11-16 23:13+0200\n" +"Last-Translator: Svilen Savov \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-KeywordsList: __;_e\n" +"X-Poedit-Basepath: .\n" +"X-Generator: Poedit 1.5.7\n" +"X-Poedit-SearchPath-0: ..\n" + +#: ../wp-gpx-maps.php:467 +msgid "Altitude" +msgstr "Височина" + +#: ../wp-gpx-maps.php:468 +msgid "Current Position" +msgstr "Текуща Позиция" + +#: ../wp-gpx-maps.php:469 +msgid "Speed" +msgstr "Скорост" + +#: ../wp-gpx-maps.php:470 +msgid "Heart rate" +msgstr "Пулс" + +#: ../wp-gpx-maps.php:471 +msgid "Cadence" +msgstr "Ритъм" + +#: ../wp-gpx-maps.php:472 +msgid "Go Full Screen" +msgstr "Покажи на цял екран" + +#: ../wp-gpx-maps.php:473 +msgid "Exit Full Screen" +msgstr "Изход от цял екран" + +#: ../wp-gpx-maps.php:474 +msgid "Hide Images" +msgstr "Скрий Снимките" + +#: ../wp-gpx-maps.php:475 +msgid "Show Images" +msgstr "Покажи Снкмките" + +#: ../wp-gpx-maps.php:476 +msgid "Back to center" +msgstr "Центрирай" + +#: ../wp-gpx-maps.php:489 +msgid "Total distance" +msgstr "Обща дистанция" + +#: ../wp-gpx-maps.php:494 +msgid "Max elevation" +msgstr "Максимална височина" + +#: ../wp-gpx-maps.php:496 +msgid "Min elevation" +msgstr "Минимална височина" + +#: ../wp-gpx-maps.php:498 +msgid "Total climbing" +msgstr "Общо изкачване" + +#: ../wp-gpx-maps.php:500 +msgid "Total descent" +msgstr "Общо спускане" + +#: ../wp-gpx-maps.php:504 +msgid "Average speed" +msgstr "Средна скорост" + +#: ../wp-gpx-maps.php:509 +msgid "Total Time" +msgstr "Общо Време" + +#: ../wp-gpx-maps.php:525 +msgid "Download" +msgstr "Свали" + +#: ../wp-gpx-maps_admin_settings.php:83 ../wp-gpx-maps_admin_settings.php:151 +#: ../wp-gpx-maps_admin_settings.php:229 ../wp-gpx-maps_admin_settings.php:333 +#: ../wp-gpx-maps_admin_settings.php:364 +msgid "Save Changes" +msgstr "Запази Промените" diff --git a/languages/wp-gpx-maps-ca.mo b/languages/wp-gpx-maps-ca.mo new file mode 100644 index 0000000..373c6a0 Binary files /dev/null and b/languages/wp-gpx-maps-ca.mo differ diff --git a/languages/wp-gpx-maps-ca.po b/languages/wp-gpx-maps-ca.po new file mode 100644 index 0000000..6380bbd --- /dev/null +++ b/languages/wp-gpx-maps-ca.po @@ -0,0 +1,93 @@ +msgid "" +msgstr "" +"Project-Id-Version: wp-gpx-maps\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-10-30 14:41+0100\n" +"PO-Revision-Date: 2013-12-14 21:43+0100\n" +"Last-Translator: edgar \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-KeywordsList: __;_e\n" +"X-Poedit-Basepath: .\n" +"X-Generator: Poedit 1.5.5\n" +"X-Poedit-SearchPath-0: ..\n" + +#: ../wp-gpx-maps.php:467 +msgid "Altitude" +msgstr "Altitud" + +#: ../wp-gpx-maps.php:468 +msgid "Current Position" +msgstr "Posició actual" + +#: ../wp-gpx-maps.php:469 +msgid "Speed" +msgstr "Velocitat" + +#: ../wp-gpx-maps.php:470 +msgid "Heart rate" +msgstr "Ritme cardíac" + +#: ../wp-gpx-maps.php:471 +msgid "Cadence" +msgstr "Cadència" + +#: ../wp-gpx-maps.php:472 +msgid "Go Full Screen" +msgstr "Anar a pantalla completa" + +#: ../wp-gpx-maps.php:473 +msgid "Exit Full Screen" +msgstr "Sortir de pantalla completa" + +#: ../wp-gpx-maps.php:474 +msgid "Hide Images" +msgstr "Amagar imatges" + +#: ../wp-gpx-maps.php:475 +msgid "Show Images" +msgstr "Mostrar imatges" + +#: ../wp-gpx-maps.php:476 +msgid "Back to center" +msgstr "Centrar" + +#: ../wp-gpx-maps.php:489 +msgid "Total distance" +msgstr "Distància total" + +#: ../wp-gpx-maps.php:494 +msgid "Max elevation" +msgstr "Altitud màxima" + +#: ../wp-gpx-maps.php:496 +msgid "Min elevation" +msgstr "Altitud mínima" + +#: ../wp-gpx-maps.php:498 +msgid "Total climbing" +msgstr "Ascensió total" + +#: ../wp-gpx-maps.php:500 +msgid "Total descent" +msgstr "Descens total" + +#: ../wp-gpx-maps.php:504 +msgid "Average speed" +msgstr "Velocitat mitjana" + +#: ../wp-gpx-maps.php:509 +msgid "Total Time" +msgstr "Temps total" + +#: ../wp-gpx-maps.php:525 +msgid "Download" +msgstr "Descarregar" + +#: ../wp-gpx-maps_admin_settings.php:83 ../wp-gpx-maps_admin_settings.php:151 +#: ../wp-gpx-maps_admin_settings.php:229 ../wp-gpx-maps_admin_settings.php:333 +#: ../wp-gpx-maps_admin_settings.php:364 +msgid "Save Changes" +msgstr "Desar canvis" diff --git a/languages/wp-gpx-maps-es_ES.mo b/languages/wp-gpx-maps-es_ES.mo index 145c404..196e494 100644 Binary files a/languages/wp-gpx-maps-es_ES.mo and b/languages/wp-gpx-maps-es_ES.mo differ diff --git a/languages/wp-gpx-maps-es_ES.po b/languages/wp-gpx-maps-es_ES.po index 857f92d..e903af9 100644 --- a/languages/wp-gpx-maps-es_ES.po +++ b/languages/wp-gpx-maps-es_ES.po @@ -3,19 +3,20 @@ msgstr "" "Project-Id-Version: wp-gpx-maps\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-10-30 14:42+0100\n" -"PO-Revision-Date: 2012-10-30 14:42+0100\n" -"Last-Translator: \n" +"PO-Revision-Date: 2013-12-14 21:43+0100\n" +"Last-Translator: edgar \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-KeywordsList: __;_e\n" "X-Poedit-Basepath: .\n" +"X-Generator: Poedit 1.5.5\n" "X-Poedit-SearchPath-0: ..\n" #: ../wp-gpx-maps.php:467 msgid "Altitude" -msgstr "Altura" +msgstr "Altitud" #: ../wp-gpx-maps.php:468 msgid "Current Position" @@ -43,15 +44,15 @@ msgstr "Salir de pantalla completa" #: ../wp-gpx-maps.php:474 msgid "Hide Images" -msgstr "" +msgstr "Ocultar Imágenes" #: ../wp-gpx-maps.php:475 msgid "Show Images" -msgstr "" +msgstr "Mostrar Imágenes" #: ../wp-gpx-maps.php:476 msgid "Back to center" -msgstr "" +msgstr "Centrar" #: ../wp-gpx-maps.php:489 msgid "Total distance" @@ -78,9 +79,8 @@ msgid "Average speed" msgstr "Velocidad media" #: ../wp-gpx-maps.php:509 -#, fuzzy msgid "Total Time" -msgstr "Distancia total" +msgstr "Tiempo total" #: ../wp-gpx-maps.php:525 msgid "Download" diff --git a/readme.txt b/readme.txt index ac36cdb..22f319a 100644 --- a/readme.txt +++ b/readme.txt @@ -4,8 +4,8 @@ Contributors: bastianonm Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML 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 -Tested up to: 3.7.1 -Stable tag: 1.2.4 +Tested up to: 3.8 +Stable tag: 1.2.5 Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. @@ -26,8 +26,9 @@ Even if you don't have a gps camera, this plugin can retrive the image position Old NGGallery Images (without gps data) and gpx: http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/ -Translated into 13 languages: +Translated into 14 languages: +- Catalan ca - Dutch nl_NL - English (default) - French fr_FR @@ -179,6 +180,10 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.2.5 = +* Added Catalan translation, thanks to Edgar +* Updated Spanish translation, thanks to Dani +* Added different types of distance: Normal, Flat (don't consider altitude) and Climb distance = 1.2.4 = * Added Bulgarian translation, thanks to Svilen Savov * Added possibility to hide the elevation chart diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index f98faa5..da458b5 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -3,7 +3,7 @@ Plugin Name: WP-GPX-Maps Plugin URI: http://www.devfarm.it/ Description: Draws a gpx track with altitude graph -Version: 1.2.4 +Version: 1.2.5 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ */ @@ -140,6 +140,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", ""); $download = findValue($attr, "download", "wpgpxmaps_download", ""); $dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0); + $distanceType = findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0); + $skipcache = findValue($attr, "skipcache", "wpgpxmaps_skipcache", ""); $summary = findValue($attr, "summary", "wpgpxmaps_summary", ""); @@ -151,11 +153,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $p_avg_speed = findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false); $p_total_time = findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false); + $colors_map = "\"".implode("\",\"",(explode(" ",$color_map)))."\""; $gpxurl = $gpx; - $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,v1.1.38"; + $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.1.38"; $cacheFileName = md5($cacheFileName); @@ -166,6 +169,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $gpxcache.= DIRECTORY_SEPARATOR.$cacheFileName.".tmp"; + $skipcache=true; + // Try to load cache if (file_exists($gpxcache) && !($skipcache == true)) { @@ -236,7 +241,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') return "No gpx found"; } - $points = getPoints( $gpx, $pointsoffset, $donotreducegpx); + $points = getPoints( $gpx, $pointsoffset, $donotreducegpx, $distanceType); $points_maps = ''; $points_graph_dist = ''; diff --git a/wp-gpx-maps_admin_settings.php b/wp-gpx-maps_admin_settings.php index 01ed7fa..6ecec85 100644 --- a/wp-gpx-maps_admin_settings.php +++ b/wp-gpx-maps_admin_settings.php @@ -33,6 +33,8 @@ $avg_speed = get_option("wpgpxmaps_summary_avg_speed"); $total_time = get_option("wpgpxmaps_summary_total_time"); + $distanceType = get_option("wpgpxmaps_distance_type"); + if (empty($showEle)) $showEle = "true"; @@ -68,6 +70,17 @@ + + Distance type: + + + + + Cache: @@ -84,7 +97,7 @@

- + " />

diff --git a/wp-gpx-maps_utils.php b/wp-gpx-maps_utils.php index eeddf5c..69c7aaa 100644 --- a/wp-gpx-maps_utils.php +++ b/wp-gpx-maps_utils.php @@ -79,7 +79,7 @@ return TRUE; } - function getPoints($gpxPath,$gpxOffset = 10, $donotreducegpx) + function getPoints($gpxPath,$gpxOffset = 10, $donotreducegpx, $distancetype) { $points = array(); @@ -92,7 +92,7 @@ if (file_exists($gpxPath)) { - $points = @parseXml($gpxPath, $gpxOffset); + $points = @parseXml($gpxPath, $gpxOffset, $distancetype); } else { @@ -125,7 +125,7 @@ return $points; } - function parseXml($filePath, $gpxOffset) + function parseXml($filePath, $gpxOffset, $distancetype) { $points = null; @@ -242,7 +242,7 @@ else { //Normal Case - $offset = calculateDistance((float)$lat, (float)$lon, (float)$ele, (float)$lastLat, (float)$lastLon, (float)$lastEle); + $offset = calculateDistance((float)$lat, (float)$lon, (float)$ele, (float)$lastLat, (float)$lastLon, (float)$lastEle, $distancetype); $dist = $dist + $offset; $points->totalLength = $dist; @@ -397,7 +397,7 @@ else { //Normal Case - $offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0); + $offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0, $distancetype); $dist = $dist + $offset; if (((float) $offset + (float) $lastOffset) > $gpxOffset) { @@ -462,7 +462,7 @@ else { //Normal Case - $offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0); + $offset = calculateDistance($lat, $lon, 0,$lastLat, $lastLon, 0, $distancetype); $dist = $dist + $offset; if (((float) $offset + (float) $lastOffset) > $gpxOffset) { @@ -500,7 +500,6 @@ } } - } unset($gpx); @@ -543,15 +542,33 @@ return (float)($degrees * 3.1415926535897932385 / 180); } - function calculateDistance($lat1,$lon1,$ele1,$lat2,$lon2,$ele2) + function calculateDistance($lat1,$lon1,$ele1,$lat2,$lon2,$ele2,$distancetype) { - $alpha = (float)sin((float)toRadians((float) $lat2 - (float) $lat1) / 2); - $beta = (float)sin((float)toRadians((float) $lon2 - (float) $lon1) / 2); - //Distance in meters - $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)); - $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)); + + if ($distancetype == '2') // climb + { + return (float)$ele1 - (float)$ele2; + } + else if ($distancetype == '1') // flat + { + $alpha = (float)sin((float)toRadians((float) $lat2 - (float) $lat1) / 2); + $beta = (float)sin((float)toRadians((float) $lon2 - (float) $lon1) / 2); + //Distance in meters + $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)); + return (float)sqrt((float)pow((float)$dist, 2) + pow((float) $lat1 - (float)$lat2, 2)); + } + else // normal + { + $alpha = (float)sin((float)toRadians((float) $lat2 - (float) $lat1) / 2); + $beta = (float)sin((float)toRadians((float) $lon2 - (float) $lon1) / 2); + //Distance in meters + $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)); + $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)); + } + } function my_date_diff($old_date, $new_date) {