From b44faa8e7370df3fe51afb3c1c423e89331b5138 Mon Sep 17 00:00:00 2001 From: Joe Hawes Date: Wed, 5 Feb 2025 09:35:52 -0800 Subject: [PATCH] v1.5.2 - Map data bug fix --- Waymark.php | 2 +- inc/Admin/Waymark_Meta.php | 5 +- inc/Admin/Waymark_Settings.php | 2 +- inc/Helpers/Waymark_Helper.php | 264 +++++++++------------------------ inc/Waymark_Config.php | 2 +- languages/waymark-en_CA.po | 2 +- languages/waymark-en_GB.po | 2 +- languages/waymark-es_ES.po | 2 +- languages/waymark-fr_CA.po | 2 +- languages/waymark-ja_JP.po | 2 +- languages/waymark-sv_SE.po | 2 +- languages/waymark-uk_UA.po | 2 +- languages/waymark-zh_CN.po | 2 +- languages/waymark.pot | 28 ++-- package.json | 2 +- readme.md | 6 +- readme.txt | 6 +- 17 files changed, 109 insertions(+), 224 deletions(-) diff --git a/Waymark.php b/Waymark.php index bb1fb497..19d9a7ca 100644 --- a/Waymark.php +++ b/Waymark.php @@ -4,7 +4,7 @@ Plugin Name: Waymark Plugin URI: https://www.waymark.dev/ Description: Mapping with WordPress made easy. With Waymark enabled, click on the "Maps" link in the sidebar to create and edit Maps. Once you are happy with your Map, copy the Waymark shortcode and add it to your content. -Version: 1.5.1 +Version: 1.5.2 Text Domain: waymark Author: Joe Hawes Author URI: https://www.morehawes.ca/ diff --git a/inc/Admin/Waymark_Meta.php b/inc/Admin/Waymark_Meta.php index 4e52a8f9..ac87c6ab 100644 --- a/inc/Admin/Waymark_Meta.php +++ b/inc/Admin/Waymark_Meta.php @@ -54,6 +54,9 @@ public function post_updated() { switch ($post->post_type) { //Map case 'waymark_map': + // Add slashes + $post_data = wp_slash($post_data); + $Map = new Waymark_Map; $Map->set_data($post_data); $Map->save_meta($post->ID); @@ -159,7 +162,7 @@ public function get_map_form() { Waymark_JS::add_editor($Map->get_geojson()); // Map Form (inc. Meta) - echo wp_kses($Map->create_form(), Waymark_Helper::parameter_allowed_html()); + echo wp_kses($Map->create_form(), Waymark_Helper::allowable_tags('parameter')); // translators: %s: Link to Waymark Settings echo '

' . sprintf(wp_kses(__('You can manage Meta fields in Settings.', 'waymark'), ['a' => ['href' => []]]), esc_url(admin_url('edit.php?post_type=waymark_map&page=waymark-settings&tab=meta'))) . '

'; diff --git a/inc/Admin/Waymark_Settings.php b/inc/Admin/Waymark_Settings.php index 874dbfde..51053fc4 100644 --- a/inc/Admin/Waymark_Settings.php +++ b/inc/Admin/Waymark_Settings.php @@ -1634,7 +1634,7 @@ public function create_input($field) { $set_value = null; } - echo wp_kses(Waymark_Input::create_field($field, $set_value, false), Waymark_Helper::parameter_allowed_html()); + echo wp_kses(Waymark_Input::create_field($field, $set_value, false), Waymark_Helper::allowable_tags('parameter')); } public function section_text($args) { diff --git a/inc/Helpers/Waymark_Helper.php b/inc/Helpers/Waymark_Helper.php index 928a246b..20c0b084 100644 --- a/inc/Helpers/Waymark_Helper.php +++ b/inc/Helpers/Waymark_Helper.php @@ -1476,206 +1476,80 @@ public static function get_overlay_properties() { return array_merge($default, $extra); } -/* - -
Create additional input fields that appear underneath the Map Editor. Any Meta that has been input is displayed on the Map Details page, and can also be displayed by the Shortcode.
-
- -
Meta Title - -
-
- - ?
-
- -
Meta Default - -
-
- - ?
-
- -
Meta Tip - -
-
- - ?
-
- -
Meta Type - -
-
- - ?
-
- -
Meta Options - -
-
- - ?
-
- -
Meta Group - -
-
- - ?
-
- -
Meta In Shortcode? - -
-
- - ?
-
- -
Meta In Submissions? - -
-
- - ?
-
- -
-
- - -
-

Groups

-
Create groups to organise your Map Meta. Meta in the same group will be displayed together when editing and viewing Maps.
-
- -
Group Title - -
-
- - ?
-
- -
-
- -
- -
-
-
-

Properties

-
Read GeoJSON feature properties when importing.

If Waymark finds data for the property keys below it will stored when it is imported. These can be automatically appended to the Overlay Description, or accessed programatically the layer.feature.properties Object.
-
- -
Property Key - -
-
- - ?
-
- -
Property Title - -
-
- - ?
-
- - -*/ - public static function parameter_allowed_html() { - return [ - 'div' => [ - 'id' => [], - 'class' => [], - 'title' => [], - ], - 'legend' => [ - 'title' => [], - ], - 'link' => [ - 'rel' => [], - 'href' => [], - 'media' => [], - 'id' => [], - ], - 'textarea' => [ - 'class' => [], - 'name' => [], - 'data-id' => [], - 'rows' => [], - 'cols' => [], - 'id' => [], - ], - 'a' => [ - 'data-title' => [], - 'href' => [], - 'onclick' => [], - 'class' => [], - ], - 'label' => [ - 'for' => [], - 'class' => [], - ], - 'input' => [ - 'type' => [], - 'name' => [], - 'data-id' => [], - 'value' => [], - 'class' => [], - 'id' => [], - ], - 'select' => [ - 'multiple' => [], - 'class' => [], - 'name' => [], - 'data-id' => [], - 'data-multi-value' => [], - ], - 'option' => [ - 'value' => [], - 'selected' => [], - ], - 'button' => [ - 'type' => [], - 'class' => [], - 'data-id' => [], - ], - 'span' => [ - 'class' => [], - ], - 'small' => [ - 'class' => [], - ], - ]; + return; } public static function allowable_tags($kind = '') { switch ($kind) { + case 'parameter': + return [ + 'div' => [ + 'id' => [], + 'class' => [], + 'title' => [], + ], + 'legend' => [ + 'title' => [], + ], + 'link' => [ + 'rel' => [], + 'href' => [], + 'media' => [], + 'id' => [], + ], + 'textarea' => [ + 'class' => [], + 'name' => [], + 'data-id' => [], + 'rows' => [], + 'cols' => [], + 'id' => [], + ], + 'a' => [ + 'data-title' => [], + 'href' => [], + 'onclick' => [], + 'class' => [], + ], + 'label' => [ + 'for' => [], + 'class' => [], + ], + 'input' => [ + 'type' => [], + 'name' => [], + 'data-id' => [], + 'value' => [], + 'class' => [], + 'id' => [], + ], + 'select' => [ + 'multiple' => [], + 'class' => [], + 'name' => [], + 'data-id' => [], + 'data-multi-value' => [], + ], + 'option' => [ + 'value' => [], + 'selected' => [], + ], + 'button' => [ + 'type' => [], + 'class' => [], + 'data-id' => [], + ], + 'span' => [ + 'class' => [], + ], + 'small' => [ + 'class' => [], + ], + ]; + + break; + case 'kml': return [ 'kml' => [ diff --git a/inc/Waymark_Config.php b/inc/Waymark_Config.php index f23c29fd..5bc4ac6f 100644 --- a/inc/Waymark_Config.php +++ b/inc/Waymark_Config.php @@ -11,7 +11,7 @@ public static function init() { 'plugin_name' => 'Waymark', 'plugin_name_short' => 'Waymark', 'custom_types' => [], - 'plugin_version' => '1.5.1', + 'plugin_version' => '1.5.2', 'nonce_string' => 'Waymark_Nonce', 'site_url' => 'https://www.waymark.dev/', 'directory_url' => 'https://wordpress.org/support/plugin/waymark/', diff --git a/languages/waymark-en_CA.po b/languages/waymark-en_CA.po index 1a7dd16e..3a6fa42e 100644 --- a/languages/waymark-en_CA.po +++ b/languages/waymark-en_CA.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-18 00:24:31+00:00\n" "PO-Revision-Date: 2024-01-23 10:12-0800\n" diff --git a/languages/waymark-en_GB.po b/languages/waymark-en_GB.po index cd376669..1cff582a 100644 --- a/languages/waymark-en_GB.po +++ b/languages/waymark-en_GB.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-18 00:24:31+00:00\n" "PO-Revision-Date: 2024-01-23 08:47-0800\n" diff --git a/languages/waymark-es_ES.po b/languages/waymark-es_ES.po index 50eddeae..7bd56819 100644 --- a/languages/waymark-es_ES.po +++ b/languages/waymark-es_ES.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-18 00:24:31+00:00\n" "PO-Revision-Date: 2024-01-23 10:19-0800\n" diff --git a/languages/waymark-fr_CA.po b/languages/waymark-fr_CA.po index 8712b4ab..cb9232f7 100644 --- a/languages/waymark-fr_CA.po +++ b/languages/waymark-fr_CA.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-18 00:24:31+00:00\n" "PO-Revision-Date: 2024-01-23 10:17-0800\n" diff --git a/languages/waymark-ja_JP.po b/languages/waymark-ja_JP.po index 02cd63b9..11062560 100644 --- a/languages/waymark-ja_JP.po +++ b/languages/waymark-ja_JP.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-23 14:32:30+00:00\n" "PO-Revision-Date: 2024-01-23 10:42-0800\n" diff --git a/languages/waymark-sv_SE.po b/languages/waymark-sv_SE.po index 3f1e496d..98460d42 100644 --- a/languages/waymark-sv_SE.po +++ b/languages/waymark-sv_SE.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-18 00:24:31+00:00\n" "PO-Revision-Date: 2024-01-23 10:18-0800\n" diff --git a/languages/waymark-uk_UA.po b/languages/waymark-uk_UA.po index a45da288..61172c06 100644 --- a/languages/waymark-uk_UA.po +++ b/languages/waymark-uk_UA.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-18 00:24:31+00:00\n" "PO-Revision-Date: 2024-01-23 10:18-0800\n" diff --git a/languages/waymark-zh_CN.po b/languages/waymark-zh_CN.po index 513be213..7d44583e 100644 --- a/languages/waymark-zh_CN.po +++ b/languages/waymark-zh_CN.po @@ -2,7 +2,7 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" "POT-Creation-Date: 2024-01-23 14:32:30+00:00\n" "PO-Revision-Date: 2024-01-23 10:25-0800\n" diff --git a/languages/waymark.pot b/languages/waymark.pot index b65a9f43..53245ba3 100644 --- a/languages/waymark.pot +++ b/languages/waymark.pot @@ -2,9 +2,9 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: Waymark 1.5.1\n" +"Project-Id-Version: Waymark 1.5.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n" -"POT-Creation-Date: 2025-02-02 23:36:51+00:00\n" +"POT-Creation-Date: 2025-02-05 17:30:40+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -97,21 +97,21 @@ msgstr "" msgid "Help" msgstr "" -#: inc/Admin/Waymark_Meta.php:74 +#: inc/Admin/Waymark_Meta.php:77 msgid "Download the Overlays added to this Map in the selected format." msgstr "" -#: inc/Admin/Waymark_Meta.php:114 +#: inc/Admin/Waymark_Meta.php:117 msgid "" "Add this Map to your content with this Shortcode. Click here for more " "details." msgstr "" -#: inc/Admin/Waymark_Meta.php:122 +#: inc/Admin/Waymark_Meta.php:125 msgid "Image Location Detection Not Supported!" msgstr "" -#: inc/Admin/Waymark_Meta.php:125 +#: inc/Admin/Waymark_Meta.php:128 #. translators: %s: Link to PHP EXIF Extension documentation msgid "" "Your hosting environment does not currently have the PHP " @@ -119,24 +119,24 @@ msgid "" "metadata. Try asking your host to enable it." msgstr "" -#: inc/Admin/Waymark_Meta.php:128 inc/Admin/Waymark_Settings.php:881 +#: inc/Admin/Waymark_Meta.php:131 inc/Admin/Waymark_Settings.php:881 #: inc/Admin/Waymark_Settings.php:950 #. translators: The option for reading from a file msgid "Read from File" msgstr "" -#: inc/Admin/Waymark_Meta.php:129 +#: inc/Admin/Waymark_Meta.php:132 msgid "" "You can read Lines and Markers from GPX, KML and GeoJSON files (most " "mapping apps will be able to export to one of these)." msgstr "" -#: inc/Admin/Waymark_Meta.php:131 inc/Admin/Waymark_Settings.php:144 +#: inc/Admin/Waymark_Meta.php:134 inc/Admin/Waymark_Settings.php:144 #: inc/Admin/Waymark_Settings.php:318 inc/Admin/Waymark_Settings.php:436 msgid "Types" msgstr "" -#: inc/Admin/Waymark_Meta.php:134 +#: inc/Admin/Waymark_Meta.php:137 #. translators: %s: Link to Waymark Settings msgid "" "Types allow you to control how Overlays (Markers, Lines and Shapes) are " @@ -144,7 +144,7 @@ msgid "" "target=\"_blank\">Waymark > Settings." msgstr "" -#: inc/Admin/Waymark_Meta.php:136 inc/Admin/Waymark_Settings.php:74 +#: inc/Admin/Waymark_Meta.php:139 inc/Admin/Waymark_Settings.php:74 #: inc/Admin/Waymark_Settings.php:82 inc/Admin/Waymark_Settings.php:89 #: inc/Admin/Waymark_Settings.php:101 inc/Admin/Waymark_Settings.php:116 #. translators: The title of the field for the name of the Basemap @@ -155,7 +155,7 @@ msgstr "" msgid "Basemap" msgstr "" -#: inc/Admin/Waymark_Meta.php:139 +#: inc/Admin/Waymark_Meta.php:142 #. translators: %s: Link to Waymark Settings msgid "" "Add and edit Basemaps in Waymark > " @@ -163,11 +163,11 @@ msgid "" "specified in the shortcode like this: %2$s" msgstr "" -#: inc/Admin/Waymark_Meta.php:141 +#: inc/Admin/Waymark_Meta.php:144 msgid "Read the Docs" msgstr "" -#: inc/Admin/Waymark_Meta.php:165 +#: inc/Admin/Waymark_Meta.php:168 #. translators: %s: Link to Waymark Settings msgid "You can manage Meta fields in Settings." msgstr "" diff --git a/package.json b/package.json index 22337ecb..dccd0e4c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Waymark", - "version": "1.5.1", + "version": "1.5.2", "description": "Waymark for WordPress", "author": "Joe Hawes", "main": "Gruntfile.js", diff --git a/readme.md b/readme.md index bf2170c4..4a7f526f 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ **Requires at least:** 4.6 **Tested up to:** 6.7 **Requires PHP:** 5.2 -**Stable tag:** 1.5.1 +**Stable tag:** 1.5.2 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -191,6 +191,10 @@ Built on the shoulders of giants, [thank you](https://www.waymark.dev/docs/thank ## Changelog ## +### 1.5.2 ### + +- Fixed a bug where Map data was being lost when editing a Map. Thanks to [hogg66](https://wordpress.org/support/users/hogg66/) for [reporting this](https://wordpress.org/support/topic/map-reverts-to-empty-default-when-i-add-a-new-marker/). + ### 1.5.1 ### - Improved escaping of Shortcode attributes. diff --git a/readme.txt b/readme.txt index 11dc562c..c586bdaa 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: GIS, Map maker, GPX, Track, Elevation Requires at least: 4.6 Tested up to: 6.7 Requires PHP: 5.2 -Stable tag: 1.5.1 +Stable tag: 1.5.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -173,6 +173,10 @@ Built on the shoulders of giants, [thank you](https://www.waymark.dev/docs/thank == Changelog == += 1.5.2 = + +- Fixed a bug where Map data was being lost when editing a Map. Thanks to [hogg66](https://wordpress.org/support/users/hogg66/) for [reporting this](https://wordpress.org/support/topic/map-reverts-to-empty-default-when-i-add-a-new-marker/). + = 1.5.1 = - Improved escaping of Shortcode attributes.