diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index 215cef1..e4433ee 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -337,9 +337,24 @@ abstract class MCI_Footnotes_Layout_Engine { /** * Loads specific setting and returns an array with the keys [id, name, value]. * - * @since 1.5.0 + * @since 1.5.0 * @param string $p_str_setting_key_name Settings Array key name. * @return array Contains Settings ID, Settings Name and Settings Value. + * + * @since 2.5.11 Remove escapement function. + * When refactoring the codebase after 2.5.8, all and every output was escaped. + * After noticing that the plugin was broken, all escapement functions were removed. + * @link https://github.com/markcheret/footnotes/pull/50/commits/25c3f2f12eb5de1079e9215bf624ec4289b095a5 + * @link https://github.com/markcheret/footnotes/pull/50#issuecomment-787624123 + * In that process, this instance of esc_attr() was removed too, so the plugin was + * broken again. + * @link https://github.com/markcheret/footnotes/pull/50/commits/25c3f2f12eb5de1079e9215bf624ec4289b095a5#diff-a8ed6e859c32a18fc10bbbad3b4dd8ce7f43f2378d29471c7638e314ab30f1bdL349-L354 + * + * @since 2.5.15 To fix it, the data was escaped in add_select_box() instead. + * @since 2.6.1 Restore esc_attr() in load_setting(). + * @see add_select_box() + * This is the only instance of esc_|kses|sanitize in the pre-2.5.11 codebase. + * Removing this did not fix the quotation mark backslash escapement bug. */ protected function load_setting( $p_str_setting_key_name ) { // Get current section. @@ -347,7 +362,7 @@ abstract class MCI_Footnotes_Layout_Engine { $p_arr_return = array(); $p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name ); $p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name ); - $p_arr_return['value'] = MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name ); + $p_arr_return['value'] = esc_attr( MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name ) ); return $p_arr_return; } @@ -467,6 +482,9 @@ abstract class MCI_Footnotes_Layout_Engine { * @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. * @return string + * + * @since 2.5.15 Bugfix: Dashboard: General settings: Footnote start and end short codes: debug select box for shortcodes with pointy brackets. + * @since 2.6.1 Restore esc_attr() in load_setting(), remove htmlspecialchars() here. */ protected function add_select_box( $p_str_setting_name, $p_arr_options ) { // Collect data for given settings field. @@ -478,9 +496,8 @@ abstract class MCI_Footnotes_Layout_Engine { $l_str_options .= sprintf( '', $l_str_value, - // 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_value == $l_arr_data['value'] ? 'selected' : '', $l_str_caption ); } diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index d055570..728c262 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -170,6 +170,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { * Displays the AMP compatibility mode option. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) */ public function amp_compat() { @@ -1084,21 +1085,21 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { * Displays all settings for the backlink symbol. * * @since 1.5.0 - * + * * - Update: **symbol for backlinks** removed; hyperlink moved to the reference number. - * + * * @since 2.0.0 * The former 'hyperlink arrow' is incompatible with combined identical footnotes. * * - Update: Reference container: clarify backlink semantics by prepended transitional up arrow, thanks to @mmallett issue report. - * + * * @since 2.0.3 - * + * * - Update: Restore arrow settings to customize or disable the now prepended arrow symbol, thanks to @mmallett issue report. - * + * * @since 2.0.4 * @date 2020-11-02T2115+0100 - * + * * @reporter @mmallett * @link https://wordpress.org/support/topic/mouse-over-broken/#post-13593037 * @@ -1345,7 +1346,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { 'example-string' => '
' . __( 'will be displayed as:', 'footnotes' ), 'example' => $g_obj_mci_footnotes->a_obj_task->exec( $l_str_example, true ), // Translators: 1: ; 2: . - 'information' => sprintf( __( 'For further information please check out our %1$ssupport forum%2$s on WordPress.org.', 'footnotes' ), '', '' ), + 'information' => sprintf( __( 'For further information please check out our %1$ssupport forum%2$s on WordPress.org.', 'footnotes' ), '', '' ), ) ); // Call wp_head function to get the Styling of the mouse-over box. diff --git a/class/hooks.php b/class/hooks.php index f5c90d1..8e44a82 100644 --- a/class/hooks.php +++ b/class/hooks.php @@ -76,7 +76,7 @@ class MCI_Footnotes_Hooks { */ public static function plugin_links( $p_arr_links, $p_str_plugin_file_name ) { // Append link to the WordPress Plugin page. - $p_arr_links[] = sprintf( '%s', __( 'Support', 'footnotes' ) ); + $p_arr_links[] = sprintf( '%s', __( 'Support', 'footnotes' ) ); // Append link to the settings page. $p_arr_links[] = sprintf( '%s', admin_url( 'admin.php?page=mfmmf-footnotes' ), __( 'Settings', 'footnotes' ) ); // Append link to the PayPal donate function. diff --git a/class/init.php b/class/init.php index 7ff790d..650c0dc 100644 --- a/class/init.php +++ b/class/init.php @@ -84,6 +84,7 @@ class MCI_Footnotes { * - Adding: Reference container: get expanding and collapsing to work also in AMP compatibility mode, thanks to @westonruter code contribution. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * @contributor @milindmore22 * @link @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933 @@ -434,11 +435,11 @@ class MCI_Footnotes { */ wp_enqueue_style( 'mci-footnotes-common', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-common.css' ), array(), C_STR_PACKAGE_VERSION ); wp_enqueue_style( 'mci-footnotes-tooltips', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), C_STR_PACKAGE_VERSION ); - + if ( self::$a_bool_amp_enabled ) { wp_enqueue_style( 'mci-footnotes-amp', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-amp-tooltips.css' ), array(), C_STR_PACKAGE_VERSION ); } - + if ( self::$a_bool_alternative_tooltips_enabled ) { wp_enqueue_style( 'mci-footnotes-alternative', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), C_STR_PACKAGE_VERSION ); } diff --git a/class/settings.php b/class/settings.php index 43829ac..cd28d99 100644 --- a/class/settings.php +++ b/class/settings.php @@ -288,6 +288,14 @@ class MCI_Footnotes_Settings { * Settings container key for the mouse-over box to define the color. * * @since 1.5.6 + * + * - Bugfix: Tooltips: Styling: Font color: set to black for maximum contrast with respect to white default background, thanks to 4msc bug report. + * + * @reporter @4msc + * @link https://wordpress.org/support/topic/tooltip-not-showing-on-dark-theme-with-white-text/ + * + * @since 2.6.1 + * @see C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND * @var str */ const C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR = 'footnote_inputfield_custom_mouse_over_box_color'; @@ -296,6 +304,11 @@ class MCI_Footnotes_Settings { * Settings container key for the mouse-over box to define the background color. * * @since 1.5.6 + * @since 1.2.5..1.5.5 #fff7a7 hard-coded. + * @since 1.5.6..2.0.6 #fff7a7 setting default. + * The mouse over box shouldn’t feature a colored background. + * By default, due to diverging user preferences. White is neutral. + * @since 2.0.7..2.5.10 #ffffff setting default. * * - Bugfix: Tooltips: Styling: Background color: empty default value to adopt theme background, thanks to 4msc bug report. * @@ -303,15 +316,11 @@ class MCI_Footnotes_Settings { * @link https://wordpress.org/support/topic/tooltip-not-showing-on-dark-theme-with-white-text/ * * @since 2.5.11 - * - * The mouse over box shouldn’t feature a colored background. - * By default, due to diverging user preferences. White is neutral. * Theme default background color is best. - * - * @since 1.2.5..1.5.5 #fff7a7 hard-coded. - * @since 1.5.6..2.0.6 #fff7a7 setting default. - * @since 2.0.7..2.5.10 #ffffff setting default. - * + * But theme default background color doesn’t seem to exist. + * @link https://wordpress.org/support/topic/problem-with-footnotes-in-excerpts-of-the-blog-page/#post-14241849 + * @since 2.6.1 default #ffffff again along with #000000 as font color. + * @see C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR * @var str */ const C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND = 'footnote_inputfield_custom_mouse_over_box_background'; @@ -515,15 +524,15 @@ class MCI_Footnotes_Settings { * * @since 2.1.1 * @date 2020-11-16T0859+0100 - * + * * - Bugfix: Priority levels: set the_content priority level to 98 to prevent plugin conflict, thanks to @marthalindeman bug report. - * + * * @reporter @marthalindeman * @link https://wordpress.org/support/topic/code-showing-up-in-references/ - * + * * @since 2.1.6 * @date 2020-12-10T0447+0100 - * + * * Priority level of the_content and of widget_text as the only relevant * hooks must be less than 99 because social buttons may yield scripts * that contain the strings '((' and '))', i.e. the default footnote @@ -542,7 +551,7 @@ class MCI_Footnotes_Settings { * @var int */ const C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_content_priority_level'; - + /** * Settings container key for 'the_title' hook priority level. * @@ -586,9 +595,9 @@ class MCI_Footnotes_Settings { /** * Settings container key for the link element option. - * + * * - Bugfix: Referrers and backlinks: Styling: make link elements optional to fix issues, thanks to @docteurfitness issue report and code contribution. - * + * * @contributor @docteurfitness * @link https://wordpress.org/support/topic/update-2-1-3/#post-13704194 * @@ -599,9 +608,9 @@ class MCI_Footnotes_Settings { /** * Settings container key to enable the presence of a backlink separator. - * + * * - Bugfix: Reference container: make separating and terminating punctuation optional and configurable, thanks to @docteurfitness issue report and code contribution. - * + * * @contributor @docteurfitness * @link https://wordpress.org/support/topic/update-2-1-3/#post-13704194 * @@ -822,8 +831,8 @@ class MCI_Footnotes_Settings { * Settings container key for reference container position shortcode. * * - Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report. - * - * @reporter @hamshe + * + * @reporter @hamshe * @link https://wordpress.org/support/topic/reference-container-in-elementor/ * * @since 2.2.0 @@ -836,8 +845,8 @@ class MCI_Footnotes_Settings { * Settings container key for the Custom CSS migrated to a dedicated tab. * * - Update: Dashboard: Custom CSS: unearth text area and migrate to dedicated tab as designed. - * - * @since 2.2.2 + * + * @since 2.2.2 * @date 2020-12-15T0520+0100 * @var str */ @@ -851,7 +860,7 @@ class MCI_Footnotes_Settings { * @var str * * - Bugfix: Dashboard: Custom CSS: swap migration Boolean, meaning 'show legacy' instead of 'migration complete', due to storage data structure constraints. - * + * * @since 2.3.0 * @date 2020-12-27T1233+0100 * @@ -983,7 +992,7 @@ class MCI_Footnotes_Settings { * @since 2.3.0 * @date 2020-12-29T0914+0100 * @var str - * + * * When the alternative reference container is enabled, hard links are too. */ const C_STR_FOOTNOTES_HARD_LINKS_ENABLE = 'footnotes_inputfield_hard_links_enable'; @@ -1140,6 +1149,7 @@ class MCI_Footnotes_Settings { * @link https://github.com/markcheret/footnotes/issues/48#issuecomment-799582394 * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * @var str */ const C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE = 'footnotes_inputfield_amp_compatibility_enable'; @@ -1379,8 +1389,8 @@ class MCI_Footnotes_Settings { self::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13, self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px', - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '', - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '', + self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '#000000', + self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff', self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1, self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99', self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0, @@ -1495,14 +1505,18 @@ class MCI_Footnotes_Settings { } /** - * Loads all Settings from specified Settings Container. + * Loads all settings from specified settings container. * * @since 1.5.0 - * @param int $p_int_index Settings Container Array Key Index. - * @return array Settings loaded from Container of Default Settings if Settings Container is empty (first usage). * - * @since ditched trimming whitespace from text box content in response to user request. - * @link https://wordpress.org/support/topic/leading-space-in-footnotes-tag/#post-5347966 + * - Bugfix: Removed the 'trim' function to allow leading and trailing whitespace in settings text boxes, thanks to @compasscare bug report. + * + * @reporter @compasscare + * @link https://wordpress.org/support/topic/leading-space-in-footnotes-tag/ + * + * @since 1.5.2 + * @param int $p_int_index Settings container array key index. + * @return array Settings loaded from defaults if container is empty (first usage). */ private function load( $p_int_index ) { // Load all settings from container. @@ -1522,14 +1536,6 @@ class MCI_Footnotes_Settings { $l_arr_options[ $l_str_key ] = $l_str_value; } } - // Iterate through each setting in the container. - foreach ( $l_arr_options as $l_str_key => $l_str_value ) { - // Remove all whitespace at the beginning and end of a setting. - // Trimming whitespace is ditched. - // $l_str_value = trim($l_str_value);. - // Write the sanitized value back to the setting container. - $l_arr_options[ $l_str_key ] = $l_str_value; - } // Return settings loaded from Container. return $l_arr_options; } diff --git a/css/dev-amp-tooltips.css b/css/dev-amp-tooltips.css index 1e4c3ac..b04413c 100644 --- a/css/dev-amp-tooltips.css +++ b/css/dev-amp-tooltips.css @@ -1,18 +1,19 @@ /* span.footnote_tooltip { /** * Position. - * + * * Values are defined by internal CSS. * @see class/task.php */ diff --git a/footnotes.php b/footnotes.php index 394c1bb..b3a03ac 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.6.0 - * Version: 2.6.0 + * Package V.: 2.6.1 + * Version: 2.6.1 * 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-25T1552+0100 + * @lastmodified 2021-03-27T0647+0100 */ -define( 'C_STR_PACKAGE_VERSION', '2.6.0' ); +define( 'C_STR_PACKAGE_VERSION', '2.6.1' ); /** * 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 85dba8a..8bff3a6 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.6.0" + version : "2.6.1" }; } }); diff --git a/readme.txt b/readme.txt index 4af301e..5fd9f9f 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.6.0 -Version: 2.6.0 +Package Version: 2.6.1 +Version: 2.6.1 Stable Tag: 2.6.0 CAUTION: THE S. T. FIELD IS PARSED FOR RELEASE CONFIGURATION. License: GPLv3 or later @@ -80,6 +80,10 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == += 2.6.1 = +- Bugfix: Tooltips: Styling: Font color: set to black for maximum contrast with respect to white default background, thanks to 4msc bug report. +- Bugfix: Tooltips: Styling: Background color: set default value back to white because empty doesn’t work out as expected. + = 2.6.0 = - Adding: Reference container: get expanding and collapsing to work also in AMP compatibility mode, thanks to @westonruter code contribution. - Adding: Tooltips: make display work purely by style rules for AMP compatibility, thanks to @milindmore22 code contribution. @@ -518,7 +522,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** - Update: Removed unnecessary hidden inputs from the Settings page - Update: Merged public CSS files to reduce the output and improve the performance - Update: Translations (EN and DE) -- Bugfix: Removed the 'trim' function to allow whitespaces at the beginning and end of each setting +- Bugfix: Removed the 'trim' function to allow leading and trailing whitespace in settings text boxes, thanks to @compasscare bug report. - Bugfix: Convert the footnotes short code to HTML special chars when adding them into the page/post editor (visual and text) - Bugfix: Detailed error messages if other Plugins can't be loaded. Also added empty strings as default values to avoid 'undefined' diff --git a/templates/public/amp-footnote-expand.html b/templates/public/amp-footnote-expand.html index 45b84f7..c411e43 100644 --- a/templates/public/amp-footnote-expand.html +++ b/templates/public/amp-footnote-expand.html @@ -7,6 +7,7 @@ * - Adding: Reference container: get expanding and collapsing to work also in AMP compatibility mode, thanks to @westonruter code contribution. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * @contributor @milindmore22 * @link @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933 diff --git a/templates/public/amp-footnote.html b/templates/public/amp-footnote.html index 134c2dc..f96832b 100644 --- a/templates/public/amp-footnote.html +++ b/templates/public/amp-footnote.html @@ -6,6 +6,7 @@ * - Bugfix: Tooltips: enable accessibility by keyboard navigation, thanks to @westonruter code contribution. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * @contributor @milindmore22 * @link @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933 diff --git a/templates/public/amp-reference-container-body-3column.html b/templates/public/amp-reference-container-body-3column.html index 79a3441..28aac1c 100644 --- a/templates/public/amp-reference-container-body-3column.html +++ b/templates/public/amp-reference-container-body-3column.html @@ -3,6 +3,7 @@ * AMP compatible table row template with legacy extra column for backlink symbol, uncombined footnotes. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * - Bugfix: Reference container: apply web semantics to improve readability for assistive technologies, thanks to @derivationfr issue report and code contribution. * diff --git a/templates/public/amp-reference-container-body-combi.html b/templates/public/amp-reference-container-body-combi.html index 36302ee..bbf7822 100644 --- a/templates/public/amp-reference-container-body-combi.html +++ b/templates/public/amp-reference-container-body-combi.html @@ -3,6 +3,7 @@ * AMP compatible table row template with the ability to have combined footnotes. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * - Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report. * diff --git a/templates/public/amp-reference-container-body-switch.html b/templates/public/amp-reference-container-body-switch.html index 945c783..6086225 100644 --- a/templates/public/amp-reference-container-body-switch.html +++ b/templates/public/amp-reference-container-body-switch.html @@ -3,6 +3,7 @@ * AMP compatible table row template for uncombined footnotes with the backlink symbol appended. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * - Bugfix: Reference container: option to append symbol (prepended by default), thanks to @spaceling code contribution. * diff --git a/templates/public/amp-reference-container-body.html b/templates/public/amp-reference-container-body.html index f3b0212..b909a6c 100755 --- a/templates/public/amp-reference-container-body.html +++ b/templates/public/amp-reference-container-body.html @@ -3,6 +3,7 @@ * AMP compatible table row default template for uncombined footnotes. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * - Bugfix: Reference container: apply web semantics to improve readability for assistive technologies, thanks to @derivationfr issue report and code contribution. * diff --git a/templates/public/amp-reference-container-collapsed.html b/templates/public/amp-reference-container-collapsed.html index 772ebfa..41210bf 100644 --- a/templates/public/amp-reference-container-collapsed.html +++ b/templates/public/amp-reference-container-collapsed.html @@ -5,6 +5,7 @@ * - Adding: Reference container: get expanding and collapsing to work also in AMP compatibility mode, thanks to @westonruter code contribution. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * @contributor @westonruter * @link https://github.com/markcheret/footnotes/issues/48#issuecomment-799580854 diff --git a/templates/public/amp-reference-container.html b/templates/public/amp-reference-container.html index b025551..c50d264 100644 --- a/templates/public/amp-reference-container.html +++ b/templates/public/amp-reference-container.html @@ -5,6 +5,7 @@ * - Adding: Reference container: get expanding and collapsing to work also in AMP compatibility mode, thanks to @westonruter code contribution. * * @since 2.5.11 (draft) + * @since 2.6.0 (release) * * @contributor @westonruter * @link https://github.com/markcheret/footnotes/issues/48#issuecomment-799580854