Skip to content

Commit

Permalink
v1.5.2 - Map data bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
morehawes committed Feb 5, 2025
1 parent 32c6260 commit b44faa8
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 224 deletions.
2 changes: 1 addition & 1 deletion Waymark.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
5 changes: 4 additions & 1 deletion inc/Admin/Waymark_Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 '<p>' . sprintf(wp_kses(__('You can manage Meta fields in <a href="%s">Settings</a>.', 'waymark'), ['a' => ['href' => []]]), esc_url(admin_url('edit.php?post_type=waymark_map&page=waymark-settings&tab=meta'))) . '</p>';
Expand Down
2 changes: 1 addition & 1 deletion inc/Admin/Waymark_Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
264 changes: 69 additions & 195 deletions inc/Helpers/Waymark_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1476,206 +1476,80 @@ public static function get_overlay_properties() {
return array_merge($default, $extra);
}

/*
<div class="waymark-settings-section-description"><span class="waymark-lead">Create additional input fields that appear underneath the Map Editor. Any Meta that has been input is displayed on the <a href="https://www.waymark.dev/map/route-map/">Map Details</a> page, and can also be displayed by the Shortcode.</span></div>
<div class="waymark-repeatable" data-count="0">
<table class="form-table">
<tr class="waymark-uneditable"><th scope="row"><u>Meta</u> Title</th><td>
<!-- START meta_title Input -->
<div class="waymark-control-group waymark-control-type-text waymark-uneditable meta_title-container">
<div class="waymark-controls">
<input class="waymark-input waymark-input-meta_title" type="text" name="Waymark_Settings[meta][inputs][meta_title]" data-id="meta_title" value="Description" />
<a data-title="The title appears next to the input field." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_title Input -->
</td></tr><tr><th scope="row"><span class="waymark-invisible">Meta</span> Default</th><td>
<!-- START meta_default Input -->
<div class="waymark-control-group waymark-control-type-text meta_default-container">
<div class="waymark-controls">
<input class="waymark-input waymark-input-meta_default" type="text" name="Waymark_Settings[meta][inputs][meta_default]" data-id="meta_default" value="" />
<a data-title="The default value for the input field. For Select and Multi-Select enter the option/comma-separated options to be selected by default." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_default Input -->
</td></tr><tr><th scope="row"><span class="waymark-invisible">Meta</span> Tip</th><td>
<!-- START meta_tip Input -->
<div class="waymark-control-group waymark-control-type-text meta_tip-container">
<div class="waymark-controls">
<input class="waymark-input waymark-input-meta_tip" type="text" name="Waymark_Settings[meta][inputs][meta_tip]" data-id="meta_tip" value="The Description you enter here will be displayed on the Map Details page." />
<a data-title="A tip provides additional information about an input field... just like this!" href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_tip Input -->
</td></tr><tr><th scope="row"><span class="waymark-invisible">Meta</span> Type</th><td>
<!-- START meta_type Input -->
<div class="waymark-control-group waymark-control-type-select meta_type-container">
<div class="waymark-controls">
<select data-multi-value="textarea_rich" class="waymark-input waymark-input-meta_type" name="Waymark_Settings[meta][inputs][meta_type]" data-id="meta_type">
<option value="text">Text</option>
<option value="textarea">Textarea</option>
<option value="textarea_rich" selected="selected">Rich Text</option>
<option value="select">Select</option>
<option value="select_multi">Multi-Select</option>
</select>
<a data-title="The type of input field to use." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_type Input -->
</td></tr><tr><th scope="row"><span class="waymark-invisible">Meta</span> Options</th><td>
<!-- START meta_options Input -->
<div class="waymark-control-group waymark-control-type-text meta_options-container">
<div class="waymark-controls">
<input class="waymark-input waymark-input-meta_options" type="text" name="Waymark_Settings[meta][inputs][meta_options]" data-id="meta_options" value="" />
<a data-title="A comma-separated list of options for the input." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_options Input -->
</td></tr><tr class="waymark-hidden"><th scope="row"><span class="waymark-invisible">Meta</span> Group</th><td>
<!-- START meta_group Input -->
<div class="waymark-control-group waymark-control-type-select waymark-hidden meta_group-container">
<div class="waymark-controls">
<select data-multi-value="" class="waymark-input waymark-input-meta_group" name="Waymark_Settings[meta][inputs][meta_group]" data-id="meta_group">
<option value="" selected="selected"></option>
</select>
<a data-title="Which group this Meta belongs to (if any). Meta in the same group will be displayed together when editing and viewing Maps. Meta not in a group will be displayed above any groups." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_group Input -->
</td></tr><tr><th scope="row"><span class="waymark-invisible">Meta</span> In Shortcode?</th><td>
<!-- START meta_shortcode Input -->
<div class="waymark-control-group waymark-control-type-boolean waymark-short-input meta_shortcode-container">
<div class="waymark-controls">
<select data-multi-value="0" class="waymark-input waymark-input-meta_shortcode" name="Waymark_Settings[meta][inputs][meta_shortcode]" data-id="meta_shortcode">
<option value="1">Yes</option>
<option value="0" selected="selected">No</option>
</select>
<a data-title="Whether this content should be displayed when embedding a Map using the Shortcode." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_shortcode Input -->
</td></tr><tr class=" waymark-hidden"><th scope="row"><span class="waymark-invisible">Meta</span> In Submissions?</th><td>
<!-- START meta_submission Input -->
<div class="waymark-control-group waymark-control-type-boolean waymark-hidden waymark-short-input meta_submission-container">
<div class="waymark-controls">
<select data-multi-value="0" class="waymark-input waymark-input-meta_submission" name="Waymark_Settings[meta][inputs][meta_submission]" data-id="meta_submission">
<option value="1">Yes</option>
<option value="0" selected="selected">No</option>
</select>
<a data-title="Make this Meta available in front-end Submissions?" href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END meta_submission Input -->
</td></tr> </table>
</div>
<div class="waymark-settings-section-footer"><small><b>Pro Tip!</b> The first listed will be used as the default. Drag to re-order, remove all to restore defaults.</small></div>
</div>
<div class="waymark-settings-section waymark-settings-section-groups">
<h2>Groups</h2>
<div class="waymark-settings-section-description"><span class="waymark-lead">Create groups to organise your Map Meta. Meta in the same group will be displayed together when editing and viewing Maps.</span></div>
<div class="waymark-repeatable" data-count="0">
<table class="form-table">
<tr><th scope="row"><u>Group</u> Title</th><td>
<!-- START group_title Input -->
<div class="waymark-control-group waymark-control-type-text group_title-container">
<div class="waymark-controls">
<input class="waymark-input waymark-input-group_title" type="text" name="Waymark_Settings[meta][groups][group_title]" data-id="group_title" value="" />
<a data-title="The title appears above the Meta in that group." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END group_title Input -->
</td></tr> </table>
</div>
<div class="waymark-settings-section-footer"><small><b>Pro Tip!</b> Drag to re-order, remove all to disable groups.</small></div>
</div>
</div>
<div class="waymark-settings-tab waymark-settings-tab-properties">
<div class="waymark-settings-tab-description"></div>
<div class="waymark-settings-section waymark-settings-section-props">
<h2>Properties</h2>
<div class="waymark-settings-section-description"><span class="waymark-lead">Read <b><a href="https://geojson.org/">GeoJSON</a></b> feature properties when importing.</span><br /><br />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 <code>layer.feature.properties</code> Object.</div>
<div class="waymark-repeatable" data-count="0">
<table class="form-table">
<tr><th scope="row"><u>Property</u> Key</th><td>
<!-- START property_key Input -->
<div class="waymark-control-group waymark-control-type-text property_key-container">
<div class="waymark-controls">
<input class="waymark-input waymark-input-property_key" type="text" name="Waymark_Settings[properties][props][property_key]" data-id="property_key" value="" />
<a data-title="This is the key associated with the data you are trying to access, i.e. &quot;properties&quot;: {&quot;property_key&quot;: &quot;Some content here&quot;}." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END property_key Input -->
</td></tr><tr><th scope="row"><u><span class="waymark-invisible">Property</span></u> Title</th><td>
<!-- START property_title Input -->
<div class="waymark-control-group waymark-control-type-text property_title-container">
<div class="waymark-controls">
<input class="waymark-input waymark-input-property_title" type="text" name="Waymark_Settings[properties][props][property_title]" data-id="property_title" value="" />
<a data-title="The value for this property will be added to the Overlay Description under this title." href="#" onclick="return false;" class="waymark-tooltip">?</a> </div>
</div>
<!-- END property_title Input -->
*/

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' => [
Expand Down
2 changes: 1 addition & 1 deletion inc/Waymark_Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-en_CA.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-fr_CA.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-ja_JP.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-sv_SE.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-uk_UA.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion languages/waymark-zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit b44faa8

Please sign in to comment.