Debug shortcode setting v2.5.15 unreleased with Stable Tag 2.5.10.

Needs to be shared on the Forum as a follow-up ASAP in several threads.
This is another bug introduced while linting the codebase after 2.5.10.
= 2.5.15 =
- Bugfix: Dashboard: General settings: Footnote start and end short codes: debug select box for shortcodes with pointy brackets.
- Update: Dashboard: General settings: Footnote start and end short codes: add information about pointy brackets.

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2503174 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2021-03-25 10:47:35 +00:00
parent 35b2611500
commit 5281825e51
7 changed files with 37 additions and 26 deletions

View file

@ -459,7 +459,7 @@ abstract class MCI_Footnotes_Layout_Engine {
* *
* @since 1.5.0 * @since 1.5.0
* *
* - Bugfix: Dashboard: Backlink symbol: debug select box by reverting identity check to equality check, thanks to @lolzim bug report. * - Bugfix: Dashboard: Referrers and tooltips: Backlink symbol: debug select box by reverting identity check to equality check, thanks to @lolzim bug report.
* *
* @reporter @lolzim * @reporter @lolzim
* *
@ -478,9 +478,9 @@ abstract class MCI_Footnotes_Layout_Engine {
$l_str_options .= sprintf( $l_str_options .= sprintf(
'<option value="%s" %s>%s</option>', '<option value="%s" %s>%s</option>',
$l_str_value, $l_str_value,
// Now we need to escape the data, WRT shortcodes with pointy brackets.
// Only check for equality, not identity, WRT arrows. // Only check for equality, not identity, WRT backlink symbol arrows.
$l_str_value == $l_arr_data['value'] ? 'selected' : '', $l_str_value == htmlspecialchars( $l_arr_data['value'] ) ? 'selected' : '',
$l_str_caption $l_str_caption
); );
} }

View file

@ -422,6 +422,8 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
// Translators: The 2 placeholders are the &lt;ref&gt;&lt;/ref&gt; and &lt;fn&gt;&lt;/fn&gt; shortcodes.
'description-escapement' => sprintf( __( 'The problems with shortcodes with pointy brackets have been solved. We apologize for the longlasting bugs making the %s and %s shortcodes close to unusable.', 'footnotes' ), '&lt;ref&gt;&lt;/ref&gt;', '&lt;fn&gt;&lt;/fn&gt;' ),
'label-short-code-start' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ), 'label-short-code-start' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ),
'short-code-start' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ), 'short-code-start' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ),

View file

@ -1264,10 +1264,6 @@ class MCI_Footnotes_Task {
return $p_str_content; return $p_str_content;
} }
// Make shortcodes conform to regex syntax.
$l_str_start_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', $l_str_starting_tag );
$l_str_end_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', $l_str_ending_tag );
/** /**
* Harmonize the various HTML escapement schemas if applicable. * Harmonize the various HTML escapement schemas if applicable.
* *
@ -1284,15 +1280,14 @@ class MCI_Footnotes_Task {
* *
* @since 2.1.14 * @since 2.1.14
* While the Classic Editor (visual mode) escapes both pointy brackets, * While the Classic Editor (visual mode) escapes both pointy brackets,
* the Block Editor enforces balanced escapement only in text mode. In * the Block Editor enforces balanced escapement only in code editor mode
* visual mode, the Block Editor does not escape the greater-than sign. * when the opening tag is already escaped. In visual mode, the Block Editor
* does not escape the greater-than sign.
*/ */
if ( preg_match( '#[&"\'<>]#', $l_str_starting_tag . $l_str_ending_tag ) ) { if ( preg_match( '#[&"\'<>]#', $l_str_starting_tag . $l_str_ending_tag ) ) {
$l_str_harmonized_start_tag = '{[(|fnote_stt|)]}'; $l_str_harmonized_start_tag = '{[(|fnote_stt|)]}';
$l_str_harmonized_end_tag = '{[(|fnote_end|)]}'; $l_str_harmonized_end_tag = '{[(|fnote_end|)]}';
$l_str_harmonized_start_tag_regex = '\{\[\(\|fnote_stt\|\)\]\}';
$l_str_harmonized_end_tag_regex = '\{\[\(\|fnote_end\|\)\]\}';
// Harmonize footnotes without escaping any HTML special characters in delimiter shortcodes. // Harmonize footnotes without escaping any HTML special characters in delimiter shortcodes.
// The footnote has been added in the Block Editor code editor (doesnt work in Classic Editor text mode). // The footnote has been added in the Block Editor code editor (doesnt work in Classic Editor text mode).
@ -1312,9 +1307,16 @@ class MCI_Footnotes_Task {
// Update the delimiter shortcodes. // Update the delimiter shortcodes.
$l_str_starting_tag = $l_str_harmonized_start_tag; $l_str_starting_tag = $l_str_harmonized_start_tag;
$l_str_ending_tag = $l_str_harmonized_end_tag; $l_str_ending_tag = $l_str_harmonized_end_tag;
$l_str_start_tag_regex = $l_str_harmonized_start_tag_regex;
$l_str_end_tag_regex = $l_str_harmonized_end_tag_regex;
// Assign the regex-conformant shortcodes.
$l_str_start_tag_regex = '\{\[\(\|fnote_stt\|\)\]\}';
$l_str_end_tag_regex = '\{\[\(\|fnote_end\|\)\]\}';
} else {
// Make shortcodes conform to regex syntax.
$l_str_start_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', $l_str_starting_tag );
$l_str_end_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', $l_str_ending_tag );
} }
/** /**
@ -2585,7 +2587,7 @@ class MCI_Footnotes_Task {
'name' => empty( $l_str_reference_container_label ) ? '&#x202F;' : $l_str_reference_container_label, 'name' => empty( $l_str_reference_container_label ) ? '&#x202F;' : $l_str_reference_container_label,
'button-style' => ! $l_bool_collapse_default ? 'display: none;' : '', 'button-style' => ! $l_bool_collapse_default ? 'display: none;' : '',
'style' => $l_bool_collapse_default ? 'display: none;' : '', 'style' => $l_bool_collapse_default ? 'display: none;' : '',
'caption' => empty( $l_str_reference_container_label ) ? 'References' : $l_str_reference_container_label, 'caption' => ( empty( $l_str_reference_container_label ) || '' === $l_str_reference_container_label ) ? 'References' : $l_str_reference_container_label,
'content' => $l_str_body, 'content' => $l_str_body,
'scroll-offset' => $l_int_scroll_offset, 'scroll-offset' => $l_int_scroll_offset,
'scroll-down-delay' => $l_int_scroll_down_delay, 'scroll-down-delay' => $l_int_scroll_down_delay,

View file

@ -4,8 +4,8 @@
* Plugin URI: https://wordpress.org/plugins/footnotes/ * Plugin URI: https://wordpress.org/plugins/footnotes/
* Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine. * Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
* Author: Mark Cheret * Author: Mark Cheret
* Package V.: 2.5.14 * Package V.: 2.5.15
* Version: 2.5.14 * Version: 2.5.15
* CAUTION: THIS V. FIELD IS PARSED FOR UPDATE CONFIGURATION. * CAUTION: THIS V. FIELD IS PARSED FOR UPDATE CONFIGURATION.
* Author URI: https://cheret.org/footnotes/ * Author URI: https://cheret.org/footnotes/
* Text Domain: footnotes * Text Domain: footnotes
@ -21,9 +21,9 @@
* @since 2.1.4 * @since 2.1.4
* @since 2.5.3 (Hungarian) * @since 2.5.3 (Hungarian)
* @var str * @var str
* @lastmodified 2021-03-25T0349+0100 * @lastmodified 2021-03-25T1138+0100
*/ */
define( 'C_STR_PACKAGE_VERSION', '2.5.14' ); define( 'C_STR_PACKAGE_VERSION', '2.5.15' );
/** /**
* Enables toggling the stylesheet enqueuing mode from production (true) to development (false). * Enables toggling the stylesheet enqueuing mode from production (true) to development (false).
* @see Full docblock below next. * @see Full docblock below next.

View file

@ -69,7 +69,7 @@
author : 'Mark Cheret', author : 'Mark Cheret',
authorurl : 'https://cheret.org/footnotes/', authorurl : 'https://cheret.org/footnotes/',
infourl : 'https://wordpress.org/plugins/footnotes/', infourl : 'https://wordpress.org/plugins/footnotes/',
version : "2.5.14" version : "2.5.15"
}; };
} }
}); });

View file

@ -4,8 +4,8 @@ Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, referen
Requires at least: 3.9 Requires at least: 3.9
Tested up to: 5.7 Tested up to: 5.7
Requires PHP: 5.6 Requires PHP: 5.6
Package Version: 2.5.14 Package Version: 2.5.15
Version: 2.5.14 Version: 2.5.15
Stable Tag: 2.5.10 Stable Tag: 2.5.10
CAUTION: THE S. T. FIELD IS PARSED FOR RELEASE CONFIGURATION. CAUTION: THE S. T. FIELD IS PARSED FOR RELEASE CONFIGURATION.
License: GPLv3 or later License: GPLv3 or later
@ -80,12 +80,16 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog == == Changelog ==
= 2.5.15 =
- Bugfix: Dashboard: General settings: Footnote start and end short codes: debug select box for shortcodes with pointy brackets.
- Update: Dashboard: General settings: Footnote start and end short codes: add information about pointy brackets.
= 2.5.14 = = 2.5.14 =
- Bugfix: Footnote delimiter short codes: fix numbering bug by cross-editor HTML escapement schema harmonization, thanks to @patrick_here @alifarahani8000 @gova bug reports. - Bugfix: Footnote delimiter short codes: fix numbering bug by cross-editor HTML escapement schema harmonization, thanks to @patrick_here @alifarahani8000 @gova bug reports.
- Update: Dashboard: General settings: Footnote start and end short codes: delete comment on pointy brackets. - Update: Dashboard: General settings: Footnote start and end short codes: delete comment on pointy brackets.
= 2.5.13 = = 2.5.13 =
- Bugfix: Dashboard: Backlink symbol: debug select box by reverting identity check to equality check, thanks to @lolzim bug report. - Bugfix: Dashboard: Referrers and tooltips: Backlink symbol: debug select box by reverting identity check to equality check, thanks to @lolzim bug report.
- Bugfix: Footnote delimiter short codes: debug closing pointy brackets in the Block Editor by accounting for unbalanced HTML escapement. - Bugfix: Footnote delimiter short codes: debug closing pointy brackets in the Block Editor by accounting for unbalanced HTML escapement.
- Update: Dashboard: General settings: Footnote start and end short codes: update information about short codes using pointy brackets. - Update: Dashboard: General settings: Footnote start and end short codes: update information about short codes using pointy brackets.

View file

@ -1,3 +1,6 @@
<div class="footnotes_description">
<p>[[description-escapement]]</p>
</div>
<table class="settings_start_end widefat fixed"> <table class="settings_start_end widefat fixed">
<tbody> <tbody>
<tr> <tr>