From 65668e0754c64725e61881512d7d266aa65563cb Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Thu, 19 Nov 2020 14:03:48 +0000 Subject: [PATCH] stable bugfix release 2.1.2: priority level settings for all other hooks, preventing them from being zeroed at save == URGENCY git-svn-id: https://plugins.svn.wordpress.org/footnotes/tags/2.1.2@2421553 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/dashboard/init.php | 5 +- class/dashboard/layout.php | 21 +- class/dashboard/subpage-main.php | 92 +++- class/init.php | 103 +++-- class/settings.php | 159 ++++++- class/task.php | 389 ++++++++++++---- css/public.css | 218 ++++++--- css/settings.css | 48 +- footnotes.php | 2 +- js/jquery.tools.js | 431 ++++++++++++++++++ js/jquery.tools.min.js | 394 +--------------- languages/en_GB.mo | Bin 9608 -> 9608 bytes languages/en_GB.po | 4 +- languages/en_US.mo | Bin 9600 -> 9600 bytes languages/en_US.po | 4 +- readme.txt | 74 ++- .../dashboard/customize-mouse-over-box.html | 54 ++- .../dashboard/customize-superscript.html | 6 +- templates/dashboard/expert-lookup.html | 62 +-- .../settings-reference-container.html | 18 +- templates/public/footnote-alternative.html | 16 + templates/public/footnote.html | 18 +- .../reference-container-body-3column.html | 21 + .../reference-container-body-combi.html | 8 + .../reference-container-body-switch.html | 13 + .../public/reference-container-body.html | 10 +- templates/public/reference-container.html | 36 +- templates/public/tooltip.html | 1 + 28 files changed, 1479 insertions(+), 728 deletions(-) create mode 100644 js/jquery.tools.js create mode 100644 templates/public/footnote-alternative.html create mode 100644 templates/public/reference-container-body-3column.html create mode 100644 templates/public/reference-container-body-combi.html create mode 100644 templates/public/reference-container-body-switch.html diff --git a/class/dashboard/init.php b/class/dashboard/init.php index 19dacd6..1b54b10 100644 --- a/class/dashboard/init.php +++ b/class/dashboard/init.php @@ -89,7 +89,8 @@ class MCI_Footnotes_Layout_Init { * Registers all sub menu pages for the new main menu. * * @author Stefan Herndler - * @since 2.0.2 + * @since 1.5.0 + * Claimed it was added for 2.0.2 while already present since 1.5.0 2020-11-19T1201+0100 * @see http://codex.wordpress.org/Function_Reference/add_menu_page */ public function registerMainMenu() { @@ -209,4 +210,4 @@ class MCI_Footnotes_Layout_Init { ); exit; } -} \ No newline at end of file +} diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index 4c925c2..e4e89c0 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -5,6 +5,10 @@ * @filesource * @author Stefan Herndler * @since 1.5.0 12.09.14 10:56 + * + * Updated for 2.1.2 added version # of settings.css for cache busting + * ############ update line 200 after changes to settings.css + * Last modified 2020-11-19T1456+0100 */ @@ -194,9 +198,20 @@ abstract class MCI_Footnotes_LayoutEngine { // add WordPress color picker layout wp_enqueue_style('wp-color-picker'); // add WordPress color picker function - wp_enqueue_script('wp-color-picker'); + wp_enqueue_script('wp-color-picker'); + + // register stylesheet - wp_register_style('mci-footnotes-admin-styles', plugins_url('../../css/settings.css', __FILE__)); + // added version after changes started to settings.css from 2.1.2 on: + wp_register_style( + 'mci-footnotes-admin-styles', + plugins_url('../../css/settings.css', __FILE__), + '', + '2.1.2' + ); + // UPDATE version # when making changes to settings.css, FOR CACHE BUSTING + + // add stylesheet to the output wp_enqueue_style('mci-footnotes-admin-styles'); } @@ -484,4 +499,4 @@ abstract class MCI_Footnotes_LayoutEngine { $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_in_Min, $p_int_Max); } -} // end of class \ No newline at end of file +} // end of class diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index 8904a33..7dcef9b 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -6,7 +6,12 @@ * @author Stefan Herndler * @since 1.5.0 14.09.14 14:47 * - * Edited for v2.0.4 2020-11-01T0509+0100 + * Edited for: + * 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 */ /** @@ -80,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: @@ -113,6 +118,11 @@ 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"); @@ -123,7 +133,19 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "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_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __("Display a backlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "symbol" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_Enabled), + + "label-startpage" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE, __("Display on start page too", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "startpage" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_Enabled), + + "label-3column" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __("Three-column layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "3column" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_Enabled), + + "label-switch" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __("Symbol appended, not prepended", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "switch" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_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) @@ -242,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) @@ -270,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_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __("Enable superscript for footnote referrers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "superscript" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_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), @@ -293,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) @@ -317,12 +347,18 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Enable the mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled), + "label-alternative" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __("Use alternative tooltip implementation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_Enabled), + "label-activate-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __("Display only an excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "activate-excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_Enabled), "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), @@ -375,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 @@ -435,40 +473,56 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { * * @author Stefan Herndler * @since 1.5.5 + * + * Edited for: + * 2.1.1 add priority level setting for the_content 2020-11-16T2152+0100 + * 2.2.0 add priority level settings for the other hooks 2020-11-19T1421+0100 */ public function lookupHooks() { // load template file $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup"); + // replace all placeholders + // priority level was initially hard-coded default + // shows "9223372036854775807" in the numbox + // empty should be interpreted as PHP_INT_MAX, + // but a numbox cannot be set to empty: + // define -1 as PHP_INT_MAX instead + $l_obj_Template->replace( array( + + "description" => __("The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features. Default 9223372036854775807 or -1 is lowest priority, 0 is highest. For the reference container to sit above related posts, the priority level of the_content hook may need to be at most 1200. For Footnotes to work when a glossary plugin is active, a higher priority of 1000 may be needed. Another priority level for the_content with proven efficiency is 10.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "head-hook" => __("WordPress hook function name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "head-checkbox" => __("Activate", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "head-numbox" => __("Priority level", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "head-url" => __("WordPress documentation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "label-the-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE, "the_title"), "the-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE), - "url-the-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_title", + "priority-the-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX), + "url-the-title" => "https://developer.wordpress.org/reference/hooks/the_title/", "label-the-content" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT, "the_content"), "the-content" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT), - "url-the-content" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content", - + "priority-the-content" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX), + "url-the-content" => "https://developer.wordpress.org/reference/hooks/the_content/", + "label-the-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT, "the_excerpt"), "the-excerpt" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT), - "url-the-excerpt" => "http://codex.wordpress.org/Function_Reference/the_excerpt", - + "priority-the-excerpt" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX), + "url-the-excerpt" => "https://developer.wordpress.org/reference/functions/the_excerpt/", + "label-widget-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE, "widget_title"), "widget-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE), - "url-widget-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title", - + "priority-widget-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX), + "url-widget-title" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title", + "label-widget-text" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT, "widget_text"), "widget-text" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT), - "url-widget-text" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text", - - "label-post-object" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST, "the_post"), - "post-object" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST), - "url-post-object" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_post" + "priority-widget-text" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX), + "url-widget-text" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text", ) ); // display template with replaced placeholders diff --git a/class/init.php b/class/init.php index cd8242c..d4dcb1a 100644 --- a/class/init.php +++ b/class/init.php @@ -1,18 +1,21 @@ initializeDashboard(); // initialize the Plugin Task $this->initializeTask(); - + // Register all Public Stylesheets and Scripts add_action('init', array($this, 'registerPublic')); // Enqueue all Public Stylesheets and Scripts @@ -65,14 +68,14 @@ class MCI_Footnotes { * * @author Stefan Herndler * @since 1.5.0 - * - * Edited for 1.6.5: replaced deprecated function create_function() - * - * Contributed by Felipe Lavín Z. Thankfully acknowledged. - * - * create_function() was deprecated in PHP 7.2: - * - * See also: + * + * Edited for 1.6.5: replaced deprecated function create_function() + * + * Contributed by Felipe Lavín Z. Thankfully acknowledged. + * + * create_function() was deprecated in PHP 7.2: + * + * See also: */ public function initializeWidgets() { register_widget("MCI_Footnotes_Widget_ReferenceContainer"); @@ -104,28 +107,60 @@ class MCI_Footnotes { * * @author Stefan Herndler * @since 1.5.0 - * - * Updated for v2.0.4 by adding jQueryUI from WordPress following @check2020de: + * + * Updated for v2.0.0 adding jQuery UI + * Updated for v2.0.4 by adding jQuery UI from WordPress following @check2020de: * * See - * + * * jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released. */ public function registerPublic() { - - // add the jQuery plugin (already registered by WordPress) - wp_enqueue_script( 'jquery' ); - // Add jQueryUI: 'no need to enqueue -core, because dependencies are set' - wp_enqueue_script( 'jquery-ui-widget' ); - wp_enqueue_script( 'jquery-ui-mouse' ); - wp_enqueue_script( 'jquery-ui-accordion' ); - wp_enqueue_script( 'jquery-ui-autocomplete' ); - wp_enqueue_script( 'jquery-ui-slider' ); - - // Add jQuery tools: - wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__)); - - // IMPORTANT: up-to-date plugin version number for cache busting. - wp_enqueue_style('mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', '2.0.5rc1'); + + //### SCRIPTS + + // 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: redacted jQuery.browser, completed minification; added versioning 2020-11-18T2150+0100 + wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), '', '2.1.1'); + + + // 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 + + // IMPORTANT: up-to-date plugin version number NEEDED FOR CACHE BUSTING: + wp_enqueue_style( + 'mci-footnotes-css-public', + plugins_url('../css/public.css', __FILE__), + '', + '2.1.2' + ); } + } diff --git a/class/settings.php b/class/settings.php index ec2e764..ed46e23 100644 --- a/class/settings.php +++ b/class/settings.php @@ -5,14 +5,26 @@ * @filesource * @author Stefan Herndler * @since 1.5.0 14.09.14 10:43 - * - * Edited for v2.0.4 2020-11-02T2115+0100 + * + * Edited for: + * 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 + * 2.1.1 fix ref container positioning by priority level 2020-11-17T0205+0100 + * + * Last modified: 2020-11-17T0311+0100 */ /** * The class loads all Settings from each WordPress Settings container. - * It a Setting is not defined yet the default value will be used. + * It a Setting is not defined yet, the default value will be used. * Each Setting will be validated and sanitized when loaded from the container. * * @author Stefan Herndler @@ -20,6 +32,11 @@ */ class MCI_Footnotes_Settings { + + /** + * SETTINGS CONTAINER KEY DEFINITIONS + */ + /** * Settings Container Key for the label of the reference container. * @@ -155,6 +172,16 @@ class MCI_Footnotes_Settings { */ const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED = "footnote_inputfield_custom_mouse_over_box_enabled"; + /** + * Settings Container Key for alternative tooltip implementation + * + * @since 2.2.0 + * @var string + * + * 2020-11-11T1817+0100 + */ + const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE = "footnote_inputfield_custom_mouse_over_box_alternative"; + /** * Settings Container Key for the mouse-over box to display only an excerpt. * @@ -165,7 +192,7 @@ class MCI_Footnotes_Settings { const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED = "footnote_inputfield_custom_mouse_over_box_excerpt_enabled"; /** - * Settings Container Key for the mouse-over box to define the max. length of the enabled expert. + * Settings Container Key for the mouse-over box to define the max. length of the enabled excerpt. * * @author Stefan Herndler * @since 1.5.4 @@ -336,13 +363,37 @@ class MCI_Footnotes_Settings { const C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT = "footnote_inputfield_expert_lookup_widget_text"; /** - * Settings Container Key the activation of the_post hook. + * Settings Container Key for the label of the 'Read on' button in truncated tooltips * - * @author Stefan Herndler - * @since 1.5.5 + * @since 2.1.0 * @var string + * + * 2020-11-08T2106+0100 */ - const C_BOOL_EXPERT_LOOKUP_THE_POST = "footnote_inputfield_expert_lookup_the_post"; + const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = "footnote_inputfield_readon_label"; + + /** + * Settings Container Keys of options fixing default layout + * + * @since 2.1.1 + * @var string + * + * 2020-11-16T0859+0100 + */ + const C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = "footnotes_inputfield_referrer_superscript_tags"; + + const C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE = "footnotes_inputfield_reference_container_backlink_symbol_enable"; + const C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE = "footnotes_inputfield_reference_container_start_page_enable"; + const C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE = "footnotes_inputfield_reference_container_3column_layout_enable"; + const C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH = "footnotes_inputfield_reference_container_backlink_symbol_switch"; + + const C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL = "footnote_inputfield_expert_lookup_the_title_priority_level"; + const C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL = "footnote_inputfield_expert_lookup_the_content_priority_level"; + const C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL = "footnote_inputfield_expert_lookup_the_excerpt_priority_level"; + const C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL = "footnote_inputfield_expert_lookup_widget_title_priority_level"; + const C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL = "footnote_inputfield_expert_lookup_widget_text_priority_level"; + + /** * Stores a singleton reference of this class. @@ -370,14 +421,22 @@ class MCI_Footnotes_Settings { * @var array */ private $a_arr_Default = array( + "footnotes_storage" => array( + self::C_STR_REFERENCE_CONTAINER_NAME => 'References', self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => '', self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end', - // Identical footnotes should not be combined by default + // Identical footnotes should not be combined by default // as long as the feature raises criticism for malfunctioning: // self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => '', + + self::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes', + self::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes', + self::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => '', + self::C_BOOL_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 => '', @@ -386,37 +445,89 @@ class MCI_Footnotes_Settings { self::C_STR_FOOTNOTES_LOVE => 'no', self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'yes', self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'no' + ), + "footnotes_storage_custom" => array( - self::C_STR_FOOTNOTES_STYLING_BEFORE => '', - self::C_STR_FOOTNOTES_STYLING_AFTER => ')', + + self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading', + + self::C_BOOL_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; + // * for stylistic consistency with the expand-collapse button + self::C_STR_FOOTNOTES_STYLING_BEFORE => '[', + self::C_STR_FOOTNOTES_STYLING_AFTER => ']', + self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes', - self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'no', - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 150, - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top right', - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 10, - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => 10, + self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => '', + + // The mouse over content truncation should be enabled by default + // to raise awareness of the functionality and to prevent the screen + // from being filled at mouse-over, and to allow the Continue reading: + self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes', + + // The truncation length is raised from 150 to 200 chars: + self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200, + + // The default position should not be lateral because of the risk + // the box gets squeezed between note anchor at line end and window edge, + // and top because reading at the bottom of the window is more likely: + self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center', + + self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0, + // The vertical offset must be negative for the box not to cover + // the current line of text (web coordinates origin is top left): + self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7, + self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '', - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#fff7a7', + // The mouse over box shouldn’t feature a colored background + // by default, due to diverging user preferences. White is neutral: + 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 => 3, - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 0, + + // The mouse over box corners mustn’t be rounded as that is outdated: + self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0, + + // The width should be limited to start with, for the box to have shape: + self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450, + self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666', self::C_STR_HYPERLINK_ARROW => '↑', self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '', self::C_STR_CUSTOM_CSS => '' + ), - // These should all be enabled by default. - // See + "footnotes_storage_expert" => array( - self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => 'yes', + + // Titles should all be enabled by default to prevent users from + // thinking at first that the feature is broken in post titles. + // See + // 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', - self::C_BOOL_EXPERT_LOOKUP_THE_POST => 'yes' + + // initially hard-coded default + // shows "9223372036854775807" in the numbox + // empty should be interpreted as PHP_INT_MAX, + // but a numbox cannot be set to empty: + // define -1 as PHP_INT_MAX instead + self::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX, + self::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => PHP_INT_MAX, + self::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL => PHP_INT_MAX, + self::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL => PHP_INT_MAX, + self::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL => PHP_INT_MAX, + ) + ); /** diff --git a/class/task.php b/class/task.php index 5586204..5bba169 100644 --- a/class/task.php +++ b/class/task.php @@ -5,13 +5,19 @@ * @filesource * @author Stefan Herndler * @since 1.5.0 - * + * * Edited for v2.0.0 and following. - * - * Edited for v2.0.5: Autoload / infinite scroll support added thanks to code from + * + * 2.0.5: Autoload / infinite scroll support added thanks to code from * @docteurfitness - * - * Last modified 2020-11-05T0524+0100 + * + * 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 + * 2.1.1: option fixing ref container relative position 2020-11-17T0254+0100 + * + * Last modified 2020-11-18T0138+0100 */ // If called directly, abort: @@ -57,20 +63,37 @@ class MCI_Footnotes_Task { * * @author Stefan Herndler * @since 1.5.0 - * - * Edited for v2.0.5 2020-11-02T0330+0100 2020-11-04T2006+0100 - * - * Explicitly setting all priority to (default) "10" instead of lowest "PHP_INT_MAX", - * especially for the_content, makes the footnotes reference container display - * beneath the content and above other features added by other plugins. + * + * Edited for: + * 2.0.5 through v2.0.7 changes to priority 2020-11-02T0330+0100..2020-11-06T1344+0100 + * 2.2.0 add settings for all hooks 2020-11-19T1248+0100 + * + * Explicitly setting the_content priority to "10" instead of lowest "PHP_INT_MAX", + * makes the footnotes reference container display beneath the post and above other + * features added by other plugins, e.g. related post lists and social buttons. * Requested by users: * Documentation: * - * But then, the blog engine calls this plugin in the editor, as reported in: - * - * + * Default remains PHP_INT_MAX. + * PHP_INT_MAX can be reset by leaving the number box empty. */ public function registerHooks() { + + // get values from settings: + $p_int_TheTitlePriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL)); + $p_int_TheContentPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL)); + $p_int_TheExcerptPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL)); + $p_int_WidgetTitlePriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL)); + $p_int_WidgetTextPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL)); + + // PHP_INT_MAX can be set leaving the input field empty: + $p_int_TheTitlePriority = !empty($p_int_TheTitlePriority ) ? $p_int_TheTitlePriority : PHP_INT_MAX; + $p_int_TheContentPriority = !empty($p_int_TheContentPriority ) ? $p_int_TheContentPriority : PHP_INT_MAX; + $p_int_TheExcerptPriority = !empty($p_int_TheExcerptPriority ) ? $p_int_TheExcerptPriority : PHP_INT_MAX; + $p_int_WidgetTitlePriority = !empty($p_int_WidgetTitlePriority) ? $p_int_WidgetTitlePriority : PHP_INT_MAX; + $p_int_WidgetTextPriority = !empty($p_int_WidgetTextPriority ) ? $p_int_WidgetTextPriority : PHP_INT_MAX; + + // append custom css to the header add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX); @@ -78,23 +101,30 @@ class MCI_Footnotes_Task { add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX); if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE))) { - add_filter('the_title', array($this, "the_title"), PHP_INT_MAX); - } + add_filter('the_title', array($this, "the_title"), $p_int_TheTitlePriority); + } + + // custom priority level for reference container relative positioning; default PHP_INT_MAX: if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT))) { - add_filter('the_content', array($this, "the_content"), PHP_INT_MAX); - } + add_filter('the_content', array($this, "the_content"), $p_int_TheContentPriority); + } + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT))) { - add_filter('the_excerpt', array($this, "the_excerpt"), PHP_INT_MAX); + add_filter('the_excerpt', array($this, "the_excerpt"), $p_int_TheExcerptPriority); } if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE))) { - add_filter('widget_title', array($this, "widget_title"), PHP_INT_MAX); + add_filter('widget_title', array($this, "widget_title"), $p_int_WidgetTitlePriority); } if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT))) { - add_filter('widget_text', array($this, "widget_text"), PHP_INT_MAX); - } - if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST))) { - add_filter('the_post', array($this, "the_post"), PHP_INT_MAX); - } + add_filter('widget_text', array($this, "widget_text"), $p_int_WidgetTextPriority); + } + + + // REMOVED the_post HOOK 2020-11-08T1839+0100 + // + // + + // reset stored footnotes when displaying the header self::$a_arr_Footnotes = array(); self::$a_bool_AllowLoveMe = true; @@ -118,7 +148,12 @@ class MCI_Footnotes_Task { - get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) { + echo '\r\n"; + }; } /** @@ -325,13 +372,17 @@ class MCI_Footnotes_Task { * @return string */ public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) { - // post ID to make everything unique wrt archive view and infinite scroll - global $l_int_PostID; - $l_int_PostID = get_the_id(); + + // post ID to make everything unique wrt infinite scroll and archive view + global $l_int_PostId; + $l_int_PostId = get_the_id(); + // contains the index for the next footnote on this page $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1; + // contains the starting position for the lookup of a footnote $l_int_PosStart = 0; + // get start and end tag for the footnotes short code $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); @@ -351,7 +402,11 @@ class MCI_Footnotes_Task { if (!$p_bool_HideFootnotesText) { // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote"); + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote-alternative"); + } else { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote"); + } $l_obj_TemplateTooltip = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "tooltip"); } else { $l_obj_Template = null; @@ -376,63 +431,83 @@ class MCI_Footnotes_Task { } // calculate the length of the footnote $l_int_Length = $l_int_PosEnd - $l_int_PosStart; + // get footnote text $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); + // Text to be displayed instead of the footnote $l_str_FootnoteReplaceText = ""; - // display the footnote as mouse-over box + + // display the footnote referrers and the tooltips: if (!$p_bool_HideFootnotesText) { - $l_str_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + $l_int_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); // display only an excerpt of the footnotes text if enabled $l_str_ExcerptText = $l_str_FootnoteText; $l_bool_EnableExcerpt = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED)); $l_int_MaxLength = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH)); + if ($l_bool_EnableExcerpt) { $l_str_DummyText = strip_tags($l_str_FootnoteText); if (is_int($l_int_MaxLength) && strlen($l_str_DummyText) > $l_int_MaxLength) { - $l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength); - $l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' ')); - // Removed hyperlink navigation on user request, but left element for style. - $l_str_ExcerptText .= ' … ' . sprintf(__("%scontinue%s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '', ''); + $l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength); + $l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' ')); + $l_str_ExcerptText .= ' … '; + $l_str_ExcerptText .= ''; + $l_str_ExcerptText .= MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL); + $l_str_ExcerptText .= ''; } } - // fill the footnotes template templates/public/footnote.html + // define the HTML element to use for the referrers: + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS))) { + $l_str_Element = 'sup'; + } else { + $l_str_Element = 'span'; + } + + // fill in 'templates/public/footnote.html': $l_obj_Template->replace( array( - "post_id" => $l_int_PostID, - "id" => $l_str_Index, + "post_id" => $l_int_PostId, + "id" => $l_int_Index, + "element" => $l_str_Element, "before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), - "index" => $l_str_Index, + "index" => $l_int_Index, "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER), "text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "", ) ); $l_str_FootnoteReplaceText = $l_obj_Template->getContent(); - + // reset the template $l_obj_Template->reload(); if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED))) { $l_int_OffsetY = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y)); $l_int_OffsetX = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X)); - - // fill in the tooltip template templates/public/tooltip.html + + // fill in 'templates/public/tooltip.html': $l_obj_TemplateTooltip->replace( array( - "post_id" => $l_int_PostID, - "id" => $l_str_Index, + "post_id" => $l_int_PostId, + "id" => $l_int_Index, "position" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION), "offset-y" => !empty($l_int_OffsetY) ? $l_int_OffsetY : 0, - "offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0 + "offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0, ) ); - $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); + if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) { + $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); + } $l_obj_TemplateTooltip->reload(); } } // replace the footnote with the template $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag)); + // add footnote only if not empty if (!empty($l_str_FootnoteText)) { // set footnote to the output box at the end @@ -455,88 +530,218 @@ class MCI_Footnotes_Task { * @author Stefan Herndler * @since 1.5.0 * @return string + * + * Edited for 2.0.6: fixed line breaking behavior in footnote # clusters + * Edited for 2.1.1: fixed fragment IDs and backlinks with combine identical turned on 2020-11-14T1808+0100 */ public function ReferenceContainer() { - // post ID to make everything unique wrt archive view and infinite scroll - global $l_int_PostID; - $l_int_PostID = get_the_id(); + + // post ID to make everything unique wrt infinite scroll and archive view: + global $l_int_PostId; + $l_int_PostId = get_the_id(); + // no footnotes has been replaced on this page if (empty(self::$a_arr_Footnotes)) { return ""; } - // get html arrow - $l_str_Arrow = MCI_Footnotes_Convert::getArrow(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW)); - // set html arrow to the first one if invalid index defined - if (is_array($l_str_Arrow)) { - $l_str_Arrow = MCI_Footnotes_Convert::getArrow(0); - } - // get user defined arrow - $l_str_ArrowUserDefined = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED); - if (!empty($l_str_ArrowUserDefined)) { - $l_str_Arrow = $l_str_ArrowUserDefined; + + + // FOOTNOTE INDEX BACKLINK SYMBOL + + // check if arrow is enabled: + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE))) { + + // get html arrow + $l_str_Arrow = MCI_Footnotes_Convert::getArrow(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW)); + // set html arrow to the first one if invalid index defined + if (is_array($l_str_Arrow)) { + $l_str_Arrow = MCI_Footnotes_Convert::getArrow(0); + } + // get user defined arrow + $l_str_ArrowUserDefined = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED); + if (!empty($l_str_ArrowUserDefined)) { + $l_str_Arrow = $l_str_ArrowUserDefined; + } + + // wrap the arrow in a @media print { display:hidden } span: + $l_str_FootnoteArrow = ''; + $l_str_FootnoteArrow .= $l_str_Arrow . ''; + + } else { + + // if it is, set it to empty: + $l_str_Arrow = ""; + $l_str_FootnoteArrow = ""; + } - // load template file - $l_str_Body = ""; - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body"); + + // REFERENCE CONTAINER TABLE ROW TEMPLATE LOAD + + // line breaks for source readability: + $l_str_Body = "\r\n\r\n"; + + // when combine identical is turned on, another template is needed: + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { + // In the combined template, identifiers only are clickable. + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-combi"); + + } else { + + // when 3-column layout is turned on (only valid if combining is turned off): + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE))) { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-3column"); + + } else { + + // when switch symbol and index is turned on (only valid if 3-column is disabled): + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH))) { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-switch"); + + } else { + + // default is the standard template: + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body"); + + } + } + } + + // FILL IN THE TEMPLATE // loop through all footnotes found in the page - for ($l_str_Index = 0; $l_str_Index < count(self::$a_arr_Footnotes); $l_str_Index++) { + for ($l_int_Index = 0; $l_int_Index < count(self::$a_arr_Footnotes); $l_int_Index++) { + + // TEXT COLUMN + // get footnote text - $l_str_FootnoteText = self::$a_arr_Footnotes[$l_str_Index]; + $l_str_FootnoteText = self::$a_arr_Footnotes[$l_int_Index]; // if footnote is empty, get to the next one + // With combine identical turned on, identicals will be deleted and are skipped: if (empty($l_str_FootnoteText)) { continue; } - // get footnote index - $l_str_FirstFootnoteIndex = ($l_str_Index + 1); - $l_str_FootnoteIndex = MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); - // check if it isn't the last footnote in the array - if ($l_str_FirstFootnoteIndex < count(self::$a_arr_Footnotes) && MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { - // get all footnotes that I haven't passed yet - for ($l_str_CheckIndex = $l_str_FirstFootnoteIndex; $l_str_CheckIndex < count(self::$a_arr_Footnotes); $l_str_CheckIndex++) { - // check if a further footnote is the same as the actual one - if ($l_str_FootnoteText == self::$a_arr_Footnotes[$l_str_CheckIndex]) { - // set the further footnote as empty so it won't be displayed later - self::$a_arr_Footnotes[$l_str_CheckIndex] = ""; - // add the footnote index to the actual index - $l_str_FootnoteIndex .= ", " . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + // INDEX COLUMN WITH ONE BACKLINK PER TABLE ROW + + // Standard behavior appropriate for combine identical TURNED OFF + + // generate content of footnote index cell + $l_int_FirstFootnoteIndex = ($l_int_Index + 1); + + // get the footnote index string and + // keep supporting legacy index placeholder: + $l_str_FootnoteIndex = MCI_Footnotes_Convert::Index(($l_int_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + + + + // SUPPORT FOR COMBINE IDENTICAL: COMPOSING ENUMERATED BACKLINKS + + $l_str_FootnoteBacklinks = ""; + + if ( MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { + + $l_str_FootnoteId = $l_str_FootnoteIndex; + + // The dedicated template enumerating backlinks uses a new placeholder: + + $l_str_FootnoteBacklinks = '"; + $l_str_FootnoteBacklinks .= $l_str_FootnoteArrow; + $l_str_FootnoteBacklinks .= $l_str_FootnoteId . ''; + + // If that is the only footnote with this text, we’re done. + + } + + + // CHECK IF COMBINE IDENTICAL IS TURNED ON, and + // check if it isn't the last footnote in the array: + if ($l_int_FirstFootnoteIndex < count(self::$a_arr_Footnotes) && MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { + + // get all footnotes that haven't passed yet: + for ($l_int_CheckIndex = $l_int_FirstFootnoteIndex; $l_int_CheckIndex < count(self::$a_arr_Footnotes); $l_int_CheckIndex++) { + + // check if a further footnote is the same as the actual one: + if ($l_str_FootnoteText == self::$a_arr_Footnotes[$l_int_CheckIndex]) { + + // if so, set the further footnote as empty so it won't be displayed later: + self::$a_arr_Footnotes[$l_int_CheckIndex] = ""; + + + // HERE GOES THE FRAGMENT IDENTIFIER AND THE BACKLINK TOO: + // add the footnote index to the actual index: + + // update the footnote ID: + $l_str_FootnoteId = MCI_Footnotes_Convert::Index(($l_int_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + + // keep on composing the backlinks enumeration: + $l_str_FootnoteBacklinks .= ', "; + $l_str_FootnoteBacklinks .= $l_str_FootnoteArrow; + $l_str_FootnoteBacklinks .= $l_str_FootnoteId . ''; + + // this legacy is not used: + //$l_str_FootnoteIndex .= ', ' . MCI_Footnotes_Convert::Index(($l_int_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + } } } - // replace all placeholders in the template templates/public/reference-container-body.html + + // replace all placeholders in 'templates/public/reference-container-body.html' + // or in 'templates/public/reference-container-body-combi.html' $l_obj_Template->replace( array( - "post_id" => $l_int_PostID, - "id" => MCI_Footnotes_Convert::Index($l_str_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), - "arrow" => $l_str_Arrow, - "index" => $l_str_FootnoteIndex, - "text" => $l_str_FootnoteText + // placeholder used in all templates: + "text" => $l_str_FootnoteText, + + // used in standard layout W/O COMBINED FOOTNOTES: + "post_id" => $l_int_PostId, + "id" => MCI_Footnotes_Convert::Index($l_int_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), + + // used in standard layout WITH COMBINED IDENTICALS TURNED ON: + "backlinks" => $l_str_FootnoteBacklinks, + + // Legacy placeholders for use in legacy layout templates: + "arrow" => $l_str_FootnoteArrow, + "index" => $l_str_FootnoteIndex, ) ); + + $l_str_Body .= $l_obj_Template->getContent(); + // extra line breaks for page source legibility: - $footnote_item_temp = $l_obj_Template->getContent(); - $footnote_item_temp .= "\r\n\r\n"; - $l_str_Body .= $footnote_item_temp; + $l_str_Body .= "\r\n\r\n"; + $l_obj_Template->reload(); + } - // load template file templates/public/reference-container.html + // load 'templates/public/reference-container.html': $l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container"); $l_obj_TemplateContainer->replace( array( - "post_id" => $l_int_PostID, + "post_id" => $l_int_PostId, "label" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME), "button-style" => !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', "style" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', - "content" => $l_str_Body + "content" => $l_str_Body, ) ); // free all found footnotes if reference container will be displayed self::$a_arr_Footnotes = array(); - + return $l_obj_TemplateContainer->getContent(); } } diff --git a/css/public.css b/css/public.css index 64c0ff8..10db703 100755 --- a/css/public.css +++ b/css/public.css @@ -4,17 +4,19 @@ * Created-Date: 15.05.14 * Created-Time: 16:21 * Since: 1.0 - * Version: 2.0.6 + * Version: 2.1.2 * - * Last modified: 2020-11-04T2131+0100 + * Last modified: 2020-11-19T1444+0100 */ -/* MCI Footnotes logo - * - * The classes with 'heading' fix display in dashboard - * See class/config.php and css/settings.css - */ +/*‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +MCI Footnotes logo +The classes with 'heading' fix display in dashboard + +class/config.php +css/settings.css +*/ .footnotes_logo, .footnotes_logo:hover, @@ -31,51 +33,116 @@ color: #545f5a; } -/* Inline footnote referrers - * aka superscript footnote anchors - * - * Class footnote_plugin_tooltip_text is the referrer and surroundings - */ +/*‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +Footnote referrers and tooltips +templates/public/footnote.html +templates/public/footnote-alternative.html + +.footnote_referrer = enclosing +.footnote_plugin_tooltip_text = inner +.footnote_tooltip = inner +*/ + +.footnote_referrer, +.footnote_referrer a, +.footnote_referrer:link, +.footnote_referrer a:link, +.main-content .footnote_referrer, +.main-content .footnote_referrer a, +.main-content .footnote_referrer:link, +.main-content .footnote_referrer a:link, .footnote_plugin_tooltip_text { + text-decoration: none !important; + border-bottom: none !important; + line-height: 0; cursor: pointer; - z-index: 1; -} -.footnote_plugin_tooltip_text { - display: inline-block; - text-decoration: none; } +.footnote_referrer:hover, +.footnote_referrer a:hover, .footnote_plugin_tooltip_text:hover { text-decoration: underline; + font-weight: inherit; } -/* tooltip infobox */ - -span.footnote_tooltip { - font-size: inherit; +.footnote_tooltip { + display: none; + z-index: 999; + cursor: auto; text-align: left; + padding: 12px; line-height: 1.2em; - z-index: 99; + font-size: inherit; + font-weight: normal; + font-style: normal; } -.continue { +.footnote_tooltip a { + word-wrap: anywhere; +} + +/* +alternative tooltip implementation +*/ +.footnote_referrer.relative { + position: relative; +} +.footnote_tooltip.position { + display: unset; + position: absolute; + bottom: 24px; + left: -50px; + width: 400px; +} +/* +fade-in parameters +*/ +.footnote_tooltip.shown { + visibility: visible; + opacity: 1; + transition-property: visibility opacity; + transition-duration: 200ms; + transition-timing-function: linear; + transition-delay: 0ms; +} +/* +fade-out parameters +*/ +.footnote_tooltip.hidden { + visibility: hidden; + opacity: 0; + transition-property: visibility opacity; + transition-duration: 200ms; + transition-timing-function: linear; + transition-delay: 400ms; +} + +/* +Read-on button +*/ +.footnote_tooltip_continue { font-style: italic; color: green; text-decoration: none !important; cursor: pointer; } -.continue:hover { +.footnote_tooltip_continue:hover { color: blue; text-decoration: underline !important; } -/* Footnotes reference container - */ -/* label */ +/*‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +Footnote references container + +templates/public/reference-container.html +*/ + +/* +label +*/ .footnote_container_prepare { display: block !important; padding-top: 24px !important; - margin-bottom: -5px; } .footnote_container_prepare > p { line-height: 1.3 !important; @@ -98,84 +165,111 @@ span.footnote_tooltip { font-size: 1.5em !important; } -/* collapse button */ -/* fully clickable, not sign only */ +/* +collapse button +fully clickable, not sign only +*/ .footnote_reference_container_collapse_button { cursor: pointer; + padding-left: .5em; + font-size: 1.3em !important; + vertical-align: 2px; } .footnote_container_prepare > p > span:last-child a { text-decoration: none !important; } -.footnote_container_prepare > p > span:last-child a:hover { - text-decoration: underline; - color: #008800; -} -/* Table starts here */ +/* +table +*/ .footnote-reference-container { width: 100%; border: none; } -/* footnotes - * class footnote_plugin_link is for backcompat. - * Used in reference-container-body.html - * See -.footnote_plugin_link, */ +/* +footnotes +reference-container-body.html +*/ .footnote_plugin_index, +.footnote_plugin_index_combi, +.footnote_plugin_link, .footnote_plugin_text { border:none !important; text-align: left !important; vertical-align: top !important; - padding: 10px 5px 5px 0 !important; + padding: 5px 6px 10px 0 !important; } -.footnote_plugin_index a, -.footnote_plugin_text a { +.footnote_backlink, +.footnote_backlink:link, +.footnote_plugin_link, +.footnote_plugin_link:link, +.main-content .footnote_backlink, +.main-content .footnote_backlink:link, +.main-content .footnote_plugin_link, +.main-content .footnote_plugin_link:link { text-decoration: none !important; + border-bottom: none !important; } +/* +These rules when enabled cause the backlink to take an overline +when hovered in some themes, not in others: .footnote_plugin_index:hover, +.footnote_plugin_index.pointer:hover, +*/ +.footnote_backlink:hover, +.footnote_plugin_index_combi:hover, +.footnote_plugin_link:hover, .footnote_plugin_text a:hover { + text-decoration: unset; text-decoration: underline !important; } .footnote_plugin_index { - cursor: pointer; - overflow-wrap: unset; - word-wrap: unset; - word-wrap: normal !important; - word-break: unset; - word-break: keep-all !important; max-width: 140px; - width: 1px; /*auto-extending column to fit widest*/ - white-space: nowrap; - overflow: hidden; + width: 2em; /*auto-extending column to fit widest*/ } +.footnote_backlink, +.footnote_plugin_link { + white-space: nowrap; +} + +.footnote_index, +.footnote_backlink, +.footnote_plugin_index.pointer { + cursor: pointer; +} + .footnote_plugin_text { width: unset; /*unset width of text column to fix site issues*/ } -/* Responsive*/ +/* +Responsive +*/ @media only screen and (max-width: 768px) { .footnote_plugin_index { max-width: 100px; } } -/* Footnotes printing style rules - * - * Printing a table, browsers tend to avoid page breaks, - * but it takes a wrapper to avoid a page break before the table. - * - * UI elements (button, arrows) and link styling are removed. +/*‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +Footnotes printing style rules + +Printing a table, browsers tend to avoid page breaks, +but it takes a wrapper to avoid a page break before the table. + +UI elements - expand button, arrows - are hidden in print; +link styling is reverted so as to not gray out referrers/numbers. */ -.footnote_container_overall_wrapper { +.footnotes_reference_container { page-break-inside: avoid; } @media print { .footnote_tooltip, .footnote_reference_container_collapse_button, - .footnote_plugin_index_arrow { + .footnote_index_arrow { display: none; } .footnote_plugin_tooltip_text { @@ -185,7 +279,7 @@ span.footnote_tooltip { color: inherit; text-decoration: none !important; } - div.post-meta-edit-link-wrapper { /* Edit button in WP2020*/ + div.post-meta-edit-link-wrapper { /*Edit button in WP2020*/ display: none; /*(added as a service)*/ } } diff --git a/css/settings.css b/css/settings.css index 7d86001..7e0c235 100755 --- a/css/settings.css +++ b/css/settings.css @@ -4,8 +4,9 @@ * Created-Date: 15.05.14 * Created-Time: 16:21 * Since: 1.0 - * Version: 2.0.4 - * Last modified: 2020-11-01T0415+0100 + * Version: 2.1.2 + * + * Last modified: 2020-11-19T1445+0100 */ @@ -37,8 +38,16 @@ left: 96px; } - -input[type=text], input[type=password], textarea, select { +/* +On User Request: limited to a number of IDs to not affect all dashboards + +*/ +#footnote_inputfield_placeholder_start_user_defined, +#footnote_inputfield_placeholder_end_user_defined, +#footnote_inputfield_readon_label, +#footnote_inputfield_references_label, +#footnote_inputfield_custom_css +/*input[type=text], input[type=password], textarea, select*/ { padding-left: 8px !important; padding-right: 8px !important; width: 80% !important; @@ -90,3 +99,34 @@ span.footnote_highlight_placeholder { margin: 20px auto !important; text-align: center !important; } + +/* +initialized from style attributes in templates +IE doesn’t support nth child, but these are not critical +*/ +.expert-lookup tr th:first-child, +.expert-lookup tr td:first-child { + width: 170px !important; +} +.expert-lookup tr th:nth-child(2), +.expert-lookup tr td:nth-child(2) { + width: 65px !important; +} +.expert-lookup tr th:nth-child(3), +.expert-lookup tr td:nth-child(3) { + width: 200px !important; +} +.expert-lookup tr td:nth-child(3) input { + width: 190px; +} +.expert-lookup tr th:last-child, +.expert-lookup tr td:last-child { + white-space: nowrap; +} + +.footnotes-description { + padding: 0 10px; +} +.footnotes-description p { + font-size: 1.4em; +} diff --git a/footnotes.php b/footnotes.php index a3f4c54..e7de7f1 100755 --- a/footnotes.php +++ b/footnotes.php @@ -4,7 +4,7 @@ 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 - Version: 2.0.4 + Version: 2.1.2 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages diff --git a/js/jquery.tools.js b/js/jquery.tools.js new file mode 100644 index 0000000..71448ef --- /dev/null +++ b/js/jquery.tools.js @@ -0,0 +1,431 @@ +/*! + * jQuery Tools v1.2.7 - The missing UI library for the Web + * + * toolbox/toolbox.expose.js + * toolbox/toolbox.flashembed.js + * toolbox/toolbox.history.js + * toolbox/toolbox.mousewheel.js + * tooltip/tooltip.js + * tooltip/tooltip.dynamic.js + * tooltip/tooltip.slide.js + * + * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. + * + * http://flowplayer.org/tools/ + * + * jquery.event.wheel.js - rev 1 + * Copyright (c) 2008, Three Dub Media (http://threedubmedia.com) + * Liscensed under the MIT License (MIT-LICENSE.txt) + * http://www.opensource.org/licenses/mit-license.php + * Created: 2008-07-01 | Updated: 2008-07-14 + * + * ----- + * + * Added checks whether jQuery.browser exists 2020-10-26T2005+0100 + * + * + * Removed usage of jQuery browser check function 2020-11-12T0127+0100 + * ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + * See also on the Forum: , + * lastly + * + * #1 (54) This was only a tweak to adjust width and height in Internet Explorer. + * + * #2 (226) This was only for very old Internet Explorer (older than IE8). + * + * #3 (266) This was only about a naming convention of Firefox: 'DOMMouseScroll' vs 'mousewheel', + * or 'mousemove' in very old Firefox (older than v1.9). + * When making jQuery.browser optional, an 'if(a.browser)' condition was added around. + * + * #4 (293) This disabled fade-in for Internet Explorer other than FadeIE. + * + * #5 (296) This disabled fade-out for Internet Explorer other than FadeIE. + * + * #6 (420) This disabled slide-fade for Internet Explorer. + * Browsers not supporting an effect simply don’t execute it, they won’t throw an error. + * + * Re-formatted minified file. Last modified: 2020-11-13T0444+0100 + */ +(function (a) { + a.tools = a.tools || {version: "v1.2.7"}; + var b; + b = a.tools.expose = {conf: {maskId: "exposeMask", loadSpeed: "slow", closeSpeed: "fast", closeOnClick: !0, closeOnEsc: !0, zIndex: 9998, opacity: .8, startOpacity: 0, color: "#fff", onLoad: null, onClose: null}}; + function c() { + /*if (a.browser && a.browser.msie) { + var b = a(document).height(), c = a(window).height(); + return[window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, b - c < 20 ? c : b] + }*/ + return[a(document).width(), a(document).height()] + } + + function d(b) { + if (b)return b.call(a.mask) + } + + var e, f, g, h, i; + a.mask = {load: function (j, k) { + if (g)return this; + typeof j == "string" && (j = {color: j}), j = j || h, h = j = a.extend(a.extend({}, b.conf), j), e = a("#" + j.maskId), e.length || (e = a("
").attr("id", j.maskId), a("body").append(e)); + var l = c(); + e.css({position: "absolute", top: 0, left: 0, width: l[0], height: l[1], display: "none", opacity: j.startOpacity, zIndex: j.zIndex}), j.color && e.css("backgroundColor", j.color); + if (d(j.onBeforeLoad) === !1)return this; + j.closeOnEsc && a(document).on("keydown.mask", function (b) { + b.keyCode == 27 && a.mask.close(b) + }), j.closeOnClick && e.on("click.mask", function (b) { + a.mask.close(b) + }), a(window).on("resize.mask", function () { + a.mask.fit() + }), k && k.length && (i = k.eq(0).css("zIndex"), a.each(k, function () { + var b = a(this); + /relative|absolute|fixed/i.test(b.css("position")) || b.css("position", "relative") + }), f = k.css({zIndex: Math.max(j.zIndex + 1, i == "auto" ? 0 : i)})), e.css({display: "block"}).fadeTo(j.loadSpeed, j.opacity, function () { + a.mask.fit(), d(j.onLoad), g = "full" + }), g = !0; + return this + }, close: function () { + if (g) { + if (d(h.onBeforeClose) === !1)return this; + e.fadeOut(h.closeSpeed, function () { + d(h.onClose), f && f.css({zIndex: i}), g = !1 + }), a(document).off("keydown.mask"), e.off("click.mask"), a(window).off("resize.mask") + } + return this + }, fit: function () { + if (g) { + var a = c(); + e.css({width: a[0], height: a[1]}) + } + }, getMask: function () { + return e + }, isLoaded: function (a) { + return a ? g == "full" : g + }, getConf: function () { + return h + }, getExposed: function () { + return f + }}, a.fn.mask = function (b) { + a.mask.load(b); + return this + }, a.fn.expose = function (b) { + a.mask.load(b, this); + return this + } +})(jQuery); +(function () { + var a = document.all, b = "http://www.adobe.com/go/getflashplayer", c = typeof jQuery == "function", d = /(\d+)[^\d]+(\d+)[^\d]*(\d*)/, e = {width: "100%", height: "100%", id: "_" + ("" + Math.random()).slice(9), allowfullscreen: !0, allowscriptaccess: "always", quality: "high", version: [3, 0], onFail: null, expressInstall: null, w3c: !1, cachebusting: !1}; + window.attachEvent && window.attachEvent("onbeforeunload", function () { + __flash_unloadHandler = function () { + }, __flash_savedUnloadHandler = function () { + } + }); + function f(a, b) { + if (b)for (var c in b)b.hasOwnProperty(c) && (a[c] = b[c]); + return a + } + + function g(a, b) { + var c = []; + for (var d in a)a.hasOwnProperty(d) && (c[d] = b(a[d])); + return c + } + + window.flashembed = function (a, b, c) { + typeof a == "string" && (a = document.getElementById(a.replace("#", ""))); + if (a) { + typeof b == "string" && (b = {src: b}); + return new j(a, f(f({}, e), b), c) + } + }; + var h = f(window.flashembed, {conf: e, getVersion: function () { + var a, b; + try { + b = navigator.plugins["Shockwave Flash"].description.slice(16) + } catch (c) { + try { + a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"), b = a && a.GetVariable("$version") + } catch (e) { + try { + a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"), b = a && a.GetVariable("$version") + } catch (f) { + } + } + } + b = d.exec(b); + return b ? [b[1], b[3]] : [0, 0] + }, asString: function (a) { + if (a === null || a === undefined)return null; + var b = typeof a; + b == "object" && a.push && (b = "array"); + switch (b) { + case"string": + a = a.replace(new RegExp("([\"\\\\])", "g"), "\\$1"), a = a.replace(/^\s?(\d+\.?\d*)%/, "$1pct"); + return"\"" + a + "\""; + case"array": + return"[" + g(a,function (a) { + return h.asString(a) + }).join(",") + "]"; + case"function": + return"\"function()\""; + case"object": + var c = []; + for (var d in a)a.hasOwnProperty(d) && c.push("\"" + d + "\":" + h.asString(a[d])); + return"{" + c.join(",") + "}" + } + return String(a).replace(/\s/g, " ").replace(/\'/g, "\"") + }, getHTML: function (b, c) { + b = f({}, b); + var d = ""; + b.width = b.height = b.id = b.w3c = b.src = null, b.onFail = b.version = b.expressInstall = null; + for (var e in b)b[e] && (d += ""); + var g = ""; + if (c) { + for (var i in c)if (c[i]) { + var j = c[i]; + g += i + "=" + encodeURIComponent(/function|object/.test(typeof j) ? h.asString(j) : j) + "&" + } + g = g.slice(0, -1), d += "" + } + d += ""; + return d + }, isSupported: function (a) { + return i[0] > a[0] || i[0] == a[0] && i[1] >= a[1] + }}), i = h.getVersion(); + + function j(c, d, e) { + if (h.isSupported(d.version))c.innerHTML = h.getHTML(d, e); else if (d.expressInstall && h.isSupported([6, 65]))c.innerHTML = h.getHTML(f(d, {src: d.expressInstall}), {MMredirectURL: location.href, MMplayerType: "PlugIn", MMdoctitle: document.title}); else { + c.innerHTML.replace(/\s/g, "") || (c.innerHTML = "

Flash version " + d.version + " or greater is required

" + (i[0] > 0 ? "Your version is " + i : "You have no flash plugin installed") + "

" + (c.tagName == "A" ? "

Click here to download latest version

" : "

Download latest version from here

"), c.tagName == "A" && (c.onclick = function () { + location.href = b + })); + if (d.onFail) { + var g = d.onFail.call(this); + typeof g == "string" && (c.innerHTML = g) + } + } + a && (window[d.id] = document.getElementById(d.id)), f(this, {getRoot: function () { + return c + }, getOptions: function () { + return d + }, getConf: function () { + return e + }, getApi: function () { + return c.firstChild + }}) + } + + c && (jQuery.tools = jQuery.tools || {version: "v1.2.7"}, jQuery.tools.flashembed = {conf: e}, jQuery.fn.flashembed = function (a, b) { + return this.each(function () { + jQuery(this).data("flashembed", flashembed(this, a, b)) + }) + }) +})(); +(function (a) { + var b, c, d, e; + a.tools = a.tools || {version: "v1.2.7"}, a.tools.history = {init: function (g) { + e || (/*a.browser && a.browser.msie && a.browser.version < "8" ? c || (c = a("