From 3e4453929ad0b5520c0c4de4d9d21531b45bc8e9 Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Mon, 16 Nov 2020 20:57:15 +0000 Subject: [PATCH] development 2.1.1d9 last fixes for evaluation project-side / user-side git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2419624 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/dashboard/subpage-main.php | 52 ++++-- class/init.php | 52 +++--- class/settings.php | 57 +++++-- class/task.php | 150 +++++++++++------- css/public.css | 18 ++- css/settings.css | 4 +- footnotes.php | 2 +- readme.txt | 29 ++-- .../dashboard/customize-mouse-over-box.html | 56 ++++--- .../dashboard/customize-superscript.html | 6 +- .../settings-reference-container.html | 21 ++- templates/public/footnote-alternative.html | 4 +- templates/public/footnote.html | 4 +- .../reference-container-body-3column.html | 4 +- .../reference-container-body-switch.html | 3 +- .../public/reference-container-body.html | 5 +- templates/public/reference-container.html | 7 +- 17 files changed, 308 insertions(+), 166 deletions(-) diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index 645b8a2..40bf24c 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -7,8 +7,11 @@ * @since 1.5.0 14.09.14 14:47 * * Edited for: - * v2.0.4 2020-11-01T0509+0100 - * v2.1.0 2020-11-08T2148+0100 + * 2.0.4 2020-11-01T0509+0100 + * 2.1.0 2020-11-08T2148+0100 + * 2.1.1 2020-11-16T2152+0100 + * + * Last modified: 2020-11-16T2152+0100 */ /** @@ -82,7 +85,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { */ protected function getMetaBoxes() { return array( - // Change string "%s styling" to "Footnotes styling": + // Change string "%s styling" to "Footnotes styling" to fix layout in WPv5.5: $this->addMetaBox("settings", "styling", __("Footnotes styling", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Styling"), $this->addMetaBox("settings", "reference-container", __("References Container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer"), // Leave intact since this is not localized: @@ -115,20 +118,34 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "post_end" => __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "widget" => __("in the widget area", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) ); + // options for Yes/No select box: + $l_arr_Enabled = array( + "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); // load template file $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-reference-container"); // replace all placeholders $l_obj_Template->replace( array( - "label-readon" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __("‘Read on’ button label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "readon" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL), - "label-name" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __("References label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "name" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME), "label-collapse" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, __("Collapse references by default", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "collapse" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE), + "collapse" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, $l_arr_Enabled), + + "label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __("Display a backlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "symbol" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_Enabled), + + "label-startpage" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __("Display on start page too", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "startpage" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_Enabled), + + "label-3column" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __("Three-column layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "3column" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_Enabled), + + "label-switch" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __("Symbol appended, not prepended", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "switch" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_Enabled), "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __("Where shall the reference container appear", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions) @@ -247,7 +264,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { * @since 1.5.0 */ public function Other() { - // options for the Footnotes to be replaced in excerpt + // options for Yes/No select box: $l_arr_Enabled = array( "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) @@ -275,11 +292,19 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { * @since 1.5.0 */ public function Superscript() { + // options for Yes/No select box: + $l_arr_Enabled = array( + "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); // load template file $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-superscript"); // replace all placeholders $l_obj_Template->replace( array( + "label-superscript" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __("Enable superscript footnote referrers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "superscript" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_Enabled), + "label-before" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __("Before Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), @@ -298,7 +323,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { * @since 1.5.2 */ public function MouseOverBox() { - // options for the Footnotes to be replaced in excerpt + // options for Yes/No select box: $l_arr_Enabled = array( "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) @@ -331,6 +356,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "label-excerpt-length" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __("Maximum characters for the excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "excerpt-length" => $this->addTextBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH), + "label-readon" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __("‘Read on’ button label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "readon" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL), + "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position), @@ -383,8 +411,10 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { * @since 1.5.0 * * Edited heading for v2.0.4 - * The former 'hyperlink arrow' became 'prepended arrow' in v2.0.3 after - * a user complaint about missing backlinking semantics of the footnote number. + * + * The former 'hyperlink arrow', incompatible with combined identical footnotes, + * became 'prepended arrow' in v2.0.3 after a user complaint about missing backlinking semantics + * of the footnote number. */ public function HyperlinkArrow() { // load template file diff --git a/class/init.php b/class/init.php index 7b28f0e..85dafce 100644 --- a/class/init.php +++ b/class/init.php @@ -119,29 +119,37 @@ class MCI_Footnotes { //### SCRIPTS -// // enqueue the jQuery plugin registered by WordPress: -// wp_enqueue_script( 'jquery' ); -// -// // enqueue jQuery UI libraries registered by WordPress, needed for tooltips: -// wp_enqueue_script( 'jquery-ui-core' ); -// wp_enqueue_script( 'jquery-ui-widget' ); -// wp_enqueue_script( 'jquery-ui-position' ); -// wp_enqueue_script( 'jquery-ui-tooltip' ); -// -// // enqueue jQuery Tools: -// wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__)); + // These are only enqueued if the jQuery tooltips are enabled. + // If alternative tooltips are enabled, these libraries are not needed. + // Scroll animation doesn’t seem to need even jQuery Core or it gets it from elsewhere. + + if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) { + + // enqueue the jQuery plugin registered by WordPress: + wp_enqueue_script( 'jquery' ); + + // enqueue jQuery UI libraries registered by WordPress, needed for tooltips: + wp_enqueue_script( 'jquery-ui-core' ); + wp_enqueue_script( 'jquery-ui-widget' ); + wp_enqueue_script( 'jquery-ui-position' ); + wp_enqueue_script( 'jquery-ui-tooltip' ); + + // enqueue jQuery Tools: + wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__)); - // Alternatively, fetch jQuery UI from cdnjs.cloudflare.com: - // Used to add jQuery UI following @vonpiernik: - // : - // This was enabled in Footnotes v2.0.0 through v2.0.3. - // Re-added for 2.0.9d1 / 2.1.1d0 to look whether it can fix a broken tooltip display. 2020-11-07T1601+0100/2020-11-08T2246+0100 - //wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, false ); // in header 2020-11-09T2003+0100 - //wp_enqueue_script( 'jQueryUI' ); - // This is then needed instead of the above first instance: - // Add jQuery Tools and finish adding jQueryUI: 2020-11-08T1638+0100/2020-11-08T2246+0100 - //wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']); + // Alternatively, fetch jQuery UI from cdnjs.cloudflare.com: + // Used to add jQuery UI following @vonpiernik: + // : + // This was enabled in Footnotes v2.0.0 through v2.0.3. + // Re-added for 2.0.9d1 / 2.1.1d0 to look whether it can fix a broken tooltip display. 2020-11-07T1601+0100/2020-11-08T2246+0100 + //wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, false ); // in header 2020-11-09T2003+0100 + //wp_enqueue_script( 'jQueryUI' ); + // This is then needed instead of the above first instance: + // Add jQuery Tools and finish adding jQueryUI: 2020-11-08T1638+0100/2020-11-08T2246+0100 + //wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']); + + } //### STYLES @@ -151,7 +159,7 @@ class MCI_Footnotes { 'mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', - '2.1.1d8' + '2.1.1d9' ); } diff --git a/class/settings.php b/class/settings.php index 41bafca..8901da2 100644 --- a/class/settings.php +++ b/class/settings.php @@ -7,12 +7,17 @@ * @since 1.5.0 14.09.14 10:43 * * Edited for: - * v2.0.4 2020-11-02T2115+0100 - * v2.0.7 2020-11-06T1342+0100 - * v2.1.0 2020-11-08T2149+0100 - * V2.2.0 2020-11-11T1819+0100 + * 2.0.4 restore arrow settings 2020-11-02T2115+0100 + * 2.0.7 remove hook the_post 2020-11-06T1342+0100 + * 2.1.0 add read-on button label customization 2020-11-08T2149+0100 + * 2.1.1 fix tooltips on site by alternative 2020-11-11T1819+0100 + * 2.1.1 fix disabling backlink symbol 2020-11-16T2021+0100 + * 2.1.1 fix superscript by making it optional + * 2.1.1 fix start pages by option to hide ref container + * 2.1.1 fix ref container by option restoring 3-column layout + * 2.1.1 fix ref container by option to switch index/symbol 2020-11-16T2022+0100 * - * Last modified: 2020-11-12T1936+0100 + * Last modified: 2020-11-16T2153+0100 */ @@ -29,13 +34,27 @@ class MCI_Footnotes_Settings { /** * Settings Container Key for the label of the 'Read on' button in truncated tooltips * - * @since 2.0.9 + * @since 2.1.0 * @var string * * 2020-11-08T2106+0100 */ const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = "footnote_inputfield_readon_label"; + /** + * Settings Container Keys of 5 options fixing default layout + * + * @since 2.1.1 + * @var string + * + * 2020-11-16T0859+0100 + */ + const C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = "footnotes_inputfield_referrer_superscript_tags"; + const C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE = "footnotes_inputfield_reference_container_backlink_symbol_enable"; + const C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE = "footnotes_inputfield_reference_container_start_page_enable"; + const C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE = "footnotes_inputfield_reference_container_3column_layout_enable"; + const C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH = "footnotes_inputfield_reference_container_backlink_symbol_switch"; + /** * Settings Container Key for the label of the reference container. * @@ -387,8 +406,9 @@ class MCI_Footnotes_Settings { * @var array */ private $a_arr_Default = array( + "footnotes_storage" => array( - self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading', + self::C_STR_REFERENCE_CONTAINER_NAME => 'References', self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => '', self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end', @@ -396,6 +416,12 @@ class MCI_Footnotes_Settings { // as long as the feature raises criticism for malfunctioning: // self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => '', + + self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes', + self::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes', + self::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => '', + self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => '', + self::C_STR_FOOTNOTES_SHORT_CODE_START => '((', self::C_STR_FOOTNOTES_SHORT_CODE_END => '))', self::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '', @@ -405,8 +431,13 @@ class MCI_Footnotes_Settings { self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'yes', self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'no' ), + "footnotes_storage_custom" => array( + self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading', + + self::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes', + // The default footnote referrer surroundings should be square brackets: // * as in English typesetting; // * for better UX thanks to a more button-like appearance; @@ -454,15 +485,17 @@ class MCI_Footnotes_Settings { self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '', self::C_STR_CUSTOM_CSS => '' ), - // These should all be enabled by default to prevent users from + + "footnotes_storage_expert" => array( + + // Titles should all be enabled by default to prevent users from // thinking at first that the feature is broken in post titles. // See - // In titles, footnotes are functionally pointless in WordPress. - "footnotes_storage_expert" => array( - self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => 'yes', + // Yet in titles, footnotes are functionally pointless in WordPress. + self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => '', self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'yes', self::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT => 'yes', - self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => 'yes', + self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => '', self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => 'yes', ) ); diff --git a/class/task.php b/class/task.php index 2c97628..0e3133e 100644 --- a/class/task.php +++ b/class/task.php @@ -14,8 +14,9 @@ * 2.0.9: DISABLED the_post HOOK 2020-11-08T1839+0100 * 2.1.0: promoted the 'Continue reading' button from localization to customization 2020-11-08T2146+0100 * 2.1.1: combining identical footnotes: fixed dead links 2020-11-14T2233+0100 + * 2.1.1: options fixing ref container layout and referrer vertical alignment 2020-11-16T2024+0100 * - * Last modified 2020-11-14T2233+0100 + * Last modified 2020-11-16T2151+0100 */ // If called directly, abort: @@ -121,6 +122,11 @@ class MCI_Footnotes_Task {