diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index 523a8ea..215cef1 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -458,11 +458,11 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns the html tag for a select box. * * @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 - * + * * @since 2.5.13 * @param string $p_str_setting_name Name of the Settings key to pre select the current value. * @param array $p_arr_options Possible options to be selected. @@ -478,9 +478,9 @@ abstract class MCI_Footnotes_Layout_Engine { $l_str_options .= sprintf( '', $l_str_value, - - // Only check for equality, not identity, WRT arrows. - $l_str_value == $l_arr_data['value'] ? 'selected' : '', + // Now we need to escape the data, WRT shortcodes with pointy brackets. + // Only check for equality, not identity, WRT backlink symbol arrows. + $l_str_value == htmlspecialchars( $l_arr_data['value'] ) ? 'selected' : '', $l_str_caption ); } diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index c4879fd..849477c 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -422,6 +422,8 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { // Replace all placeholders. $l_obj_template->replace( array( + // Translators: The 2 placeholders are the <ref></ref> and <fn></fn> 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' ), '<ref></ref>', '<fn></fn>' ), '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 ), diff --git a/class/task.php b/class/task.php index ac8c0aa..04c8854 100644 --- a/class/task.php +++ b/class/task.php @@ -1263,10 +1263,6 @@ class MCI_Footnotes_Task { if ( empty( $l_str_starting_tag ) || empty( $l_str_ending_tag ) ) { 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. @@ -1284,15 +1280,14 @@ class MCI_Footnotes_Task { * * @since 2.1.14 * While the Classic Editor (visual mode) escapes both pointy brackets, - * the Block Editor enforces balanced escapement only in text mode. In - * visual mode, the Block Editor does not escape the greater-than sign. + * the Block Editor enforces balanced escapement only in code editor mode + * 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 ) ) { $l_str_harmonized_start_tag = '{[(|fnote_stt|)]}'; $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. // The footnote has been added in the Block Editor code editor (doesn’t work in Classic Editor text mode). @@ -1312,9 +1307,16 @@ class MCI_Footnotes_Task { // Update the delimiter shortcodes. $l_str_starting_tag = $l_str_harmonized_start_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 ) ? ' ' : $l_str_reference_container_label, 'button-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, 'scroll-offset' => $l_int_scroll_offset, 'scroll-down-delay' => $l_int_scroll_down_delay, diff --git a/footnotes.php b/footnotes.php index 4e06780..fb10233 100755 --- a/footnotes.php +++ b/footnotes.php @@ -4,8 +4,8 @@ * 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. * Author: Mark Cheret - * Package V.: 2.5.14 - * Version: 2.5.14 + * Package V.: 2.5.15 + * Version: 2.5.15 * CAUTION: THIS V. FIELD IS PARSED FOR UPDATE CONFIGURATION. * Author URI: https://cheret.org/footnotes/ * Text Domain: footnotes @@ -21,9 +21,9 @@ * @since 2.1.4 * @since 2.5.3 (Hungarian) * @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). * @see Full docblock below next. diff --git a/js/wysiwyg-editor.js b/js/wysiwyg-editor.js index 0c6539e..c802cb7 100644 --- a/js/wysiwyg-editor.js +++ b/js/wysiwyg-editor.js @@ -69,7 +69,7 @@ author : 'Mark Cheret', authorurl : 'https://cheret.org/footnotes/', infourl : 'https://wordpress.org/plugins/footnotes/', - version : "2.5.14" + version : "2.5.15" }; } }); diff --git a/readme.txt b/readme.txt index 7b38cee..a18fb8a 100755 --- a/readme.txt +++ b/readme.txt @@ -4,8 +4,8 @@ Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, referen Requires at least: 3.9 Tested up to: 5.7 Requires PHP: 5.6 -Package Version: 2.5.14 -Version: 2.5.14 +Package Version: 2.5.15 +Version: 2.5.15 Stable Tag: 2.5.10 CAUTION: THE S. T. FIELD IS PARSED FOR RELEASE CONFIGURATION. License: GPLv3 or later @@ -80,12 +80,16 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == 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 = - 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. = 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. - Update: Dashboard: General settings: Footnote start and end short codes: update information about short codes using pointy brackets. diff --git a/templates/dashboard/settings-start-end.html b/templates/dashboard/settings-start-end.html index bb56b21..cf3744a 100644 --- a/templates/dashboard/settings-start-end.html +++ b/templates/dashboard/settings-start-end.html @@ -1,3 +1,6 @@ +
+

[[description-escapement]]

+