From 95ed6631e24c8825c834d31d700d5273db2fbbf7 Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Thu, 3 Dec 2020 07:55:27 +0000 Subject: [PATCH] update trunk for upcoming 2.1.4, thanks for testing 2.1.4d7 to be shared on Forum too git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2430720 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/dashboard/layout.php | 21 +++-- class/dashboard/subpage-main.php | 76 ++++++++++++++----- class/settings.php | 48 +++++++++--- class/task.php | 66 +++++++++++++++- css/public.css | 49 +++++++----- css/settings.css | 42 ++++++---- footnotes.php | 4 +- readme.txt | 5 +- .../dashboard/customize-mouse-over-box.html | 12 ++- templates/dashboard/expert-lookup.html | 4 +- templates/dashboard/settings-other.html | 25 +++--- .../settings-reference-container.html | 36 ++++++--- 12 files changed, 285 insertions(+), 103 deletions(-) diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index e4d77eb..68e9a7e 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -9,10 +9,10 @@ * Edited: * 2.1.2 add versioning of settings.css for cache busting 2020-11-19T1456+0100 * 2.1.4 automate passing version number for cache busting 2020-11-30T0648+0100 - * 2.1.4 fix punctuation issue in dashboard labels 2020-12-01T0211+0100 + * 2.1.4 started fixing punctuation-related localization issue in dashboard labels 2020-12-01T0211+0100 * ########## this fix reverted for now; restore when updating strings and translations * - * Last modified: 2020-12-01T0439+0100 + * Last modified: 2020-12-01T1559+0100 */ @@ -386,7 +386,7 @@ abstract class MCI_Footnotes_LayoutEngine { * @return string * * Edited 2020-12-01T0159+0100 - * @since 2.1.4 no colon + * @since #################### no colon */ protected function addLabel($p_str_SettingName, $p_str_Caption) { if (empty($p_str_Caption)) { @@ -401,7 +401,8 @@ abstract class MCI_Footnotes_LayoutEngine { // Eventually add colon to label strings for inclusion in localization. // Else drop colons after labels. return sprintf('', $p_str_SettingName, $p_str_Caption); - // ^ here deleted colon 2020-12-01T0156+0100 + // ^ here deleted colon 2020-12-01T0156+0100 + // ########## this fix reverted for now; restore when updating strings and translations } /** @@ -507,12 +508,16 @@ abstract class MCI_Footnotes_LayoutEngine { * @param int $p_in_Min Minimum value. * @param int $p_int_Max Maximum value. * @return string + * + * Edited: + * @since 2.1.4 step argument and %f to allow decimals 2020-12-03T0631+0100 */ - protected function addNumBox($p_str_SettingName, $p_in_Min, $p_int_Max) { + protected function addNumBox($p_str_SettingName, $p_in_Min, $p_int_Max, $p_flo_Step = 1) { // collect data for given settings field - $l_arr_Data = $this->LoadSetting($p_str_SettingName); - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_in_Min, $p_int_Max); + $l_arr_Data = $this->LoadSetting($p_str_SettingName); + + return sprintf('', + $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_flo_Step, $p_in_Min, $p_int_Max); } } // end of class diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index cb432eb..e7cdb81 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -94,9 +94,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { // Leave intact since this is not localized: $this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_HEADING_NAME . ' ' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL_HEADING, "Love"), - // The HyperlinkArrow meta box ceased for 2.0.0 - // The HyperlinkArrow meta box was restored for 2.0.4 to meet user demand for arrow symbol semantics - // The HyperlinkArrow meta box ceased for 2.1.4 as its content is moved to Settings > Reference container > Display a backlink symbol + // The HyperlinkArrow meta box ceased for 2.0.0 + // The HyperlinkArrow meta box was restored for 2.0.4 to meet user demand for arrow symbol semantics + // The HyperlinkArrow meta box ceased for 2.1.4 as its content is moved to Settings > Reference container > Display a backlink symbol $this->addMetaBox("customize", "superscript", __("Superscript layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript"), $this->addMetaBox("customize", "mouse-over-box", __("Mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBox"), $this->addMetaBox("customize", "custom-css", __("Add custom CSS to the public page", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"), @@ -139,6 +139,13 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "parenthesis" => __("CLOSING PARENTHESIS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "colon" => __("COLON", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) ); + // options for the first column width (per cent is a ratio, not a unit): + $l_arr_WidthUnits = array( + "%" => __("per cent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "px" => __("pixels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "em" => __("em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "rem" => __("rem", 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), @@ -163,11 +170,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "symbol-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_Enabled), "symbol-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, MCI_Footnotes_Convert::getArrow()), "symbol-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED), - "symbol-comment" => __("Your input overrides the selection", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "symbol-comment" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "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), - + "switch" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_Enabled), + "label-3column" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __("Backlink symbol in an extra column", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "3column" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_Enabled), "3column-comment" => __("This legacy layout is available if identical footnotes are not combined.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), @@ -179,16 +186,26 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "separator-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED, $l_arr_Enabled), "separator-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION, $l_arr_Separators), "separator-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM), - "separator-comment" => __("Your input overrides the selection", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "separator-comment" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "label-terminator" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED, __("Add a terminal punctuation to backlinks", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "terminator-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED, $l_arr_Enabled), "terminator-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION, $l_arr_Terminators), "terminator-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM), - "terminator-comment" => __("Your input overrides the selection", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "terminator-comment" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "label-linebreak" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, __("Stack backlinks when enumerating", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "linebreak" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_Enabled), + "label-width" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED, __("Set backlinks column width", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "width-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_Enabled), + "width-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, 0.1), + "width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_WidthUnits), + + "label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __("Set backlinks column maximum width", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "max-width-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_Enabled), + "max-width-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, 0.1), + "max-width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_WidthUnits), + + "label-line-break" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, __("Stack backlinks when enumerating", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "line-break" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_Enabled), ) ); // display template with replaced placeholders @@ -319,8 +336,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "label-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Allow footnotes on Summarized Posts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled), - "excerpt-comment1" => __("This should be disabled, and the Advanced Excerpt plugin used instead.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "excerpt-comment2" => __("Footnotes cannot be disabled in excerpts. A workaround is to avoid footnotes in the first 55 words.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "excerpt-comment1" => __("This should be disabled.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "excerpt-comment2" => __("In some themes, the Advanced Excerpt plugin is indispensable to display footnotes in excerpts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "excerpt-comment3" => __("Footnotes cannot be disabled in excerpts. A workaround is to avoid footnotes in the first 55 words.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "label-expert-mode" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, __("Enable the Expert mode", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "expert-mode" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, $l_arr_Enabled) @@ -384,11 +402,25 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "center left" => __("center left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) ); + // options for the font size unit: + $l_arr_FontSizeUnits = array( + "em" => __("em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "rem" => __("rem", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "px" => __("pixels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "pt" => __("points", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "pc" => __("picas", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "mm" => __("millimeters", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "%" => __("per cent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + ); + // load template file $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-mouse-over-box"); // replace all placeholders $l_obj_Template->replace( array( + + // tooltip settings: + "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), @@ -415,6 +447,18 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -50, 50), "notice-offset-y" => __("Offset (Y axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __("Max. width (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "max-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280), + "notice-max-width" => __("Set the max-width to 0px to disable this setting.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + + // tooltip styling: + + "label-font-size" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __("Set font size", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "font-size-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_Enabled), + "font-size-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, 0.1), + "font-size-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_FontSizeUnits), + "font-size-comment" => __("By default, the font size is set to equal the surrounding text.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "label-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __("Color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR), "notice-color" => __("Empty color will use the default color defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), @@ -435,10 +479,6 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "border-radius" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 20), "notice-border-radius" => __("Set the radius to 0px to avoid a radius.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __("Max. width (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "max-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280), - "notice-max-width" => __("Set the max-width to 0px to disable this setting.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "label-box-shadow-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __("Box shadow color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "box-shadow-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR), "notice-box-shadow-color" => __("Empty color will use the default box shadow defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), @@ -460,8 +500,8 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { * 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. - * - * @since 2.1.4 moved to Settings > Reference container > Display a backlink symbol + * + * @since 2.1.4 moved to Settings > Reference container > Display a backlink symbol */ /** diff --git a/class/settings.php b/class/settings.php index a31b500..3110764 100644 --- a/class/settings.php +++ b/class/settings.php @@ -405,21 +405,35 @@ class MCI_Footnotes_Settings { /** * Settings Container Keys for the link element option * Settings Container Keys for backlink typography and layout + * Settings Container Keys for tooltip font size * * @since 2.1.4 - * @var string|bool + * @var string|bool|int * * 2020-11-26T1002+0100 - * 2020-11-30T0427+0100 + * 2020-11-30T0427+0100 + * 2020-12-03T0501+0100 */ - const C_BOOL_LINK_ELEMENT_ENABLED = "footnote_inputfield_link_element_enabled"; - const C_BOOL_BACKLINKS_SEPARATOR_ENABLED = "footnotes_inputfield_backlinks_separator_enabled"; - const C_STR_BACKLINKS_SEPARATOR_OPTION = "footnotes_inputfield_backlinks_separator_option"; - const C_STR_BACKLINKS_SEPARATOR_CUSTOM = "footnotes_inputfield_backlinks_separator_custom"; - const C_BOOL_BACKLINKS_TERMINATOR_ENABLED = "footnotes_inputfield_backlinks_terminator_enabled"; - const C_STR_BACKLINKS_TERMINATOR_OPTION = "footnotes_inputfield_backlinks_terminator_option"; - const C_STR_BACKLINKS_TERMINATOR_CUSTOM = "footnotes_inputfield_backlinks_terminator_custom"; - const C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED = "footnotes_inputfield_backlinks_line_breaks_enabled"; + const C_BOOL_LINK_ELEMENT_ENABLED = "footnote_inputfield_link_element_enabled"; + + const C_BOOL_BACKLINKS_SEPARATOR_ENABLED = "footnotes_inputfield_backlinks_separator_enabled"; + const C_STR_BACKLINKS_SEPARATOR_OPTION = "footnotes_inputfield_backlinks_separator_option"; + const C_STR_BACKLINKS_SEPARATOR_CUSTOM = "footnotes_inputfield_backlinks_separator_custom"; + const C_BOOL_BACKLINKS_TERMINATOR_ENABLED = "footnotes_inputfield_backlinks_terminator_enabled"; + const C_STR_BACKLINKS_TERMINATOR_OPTION = "footnotes_inputfield_backlinks_terminator_option"; + const C_STR_BACKLINKS_TERMINATOR_CUSTOM = "footnotes_inputfield_backlinks_terminator_custom"; + const C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED = "footnotes_inputfield_backlinks_column_width_enabled"; + const C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR = "footnotes_inputfield_backlinks_column_width_scalar"; + const C_STR_BACKLINKS_COLUMN_WIDTH_UNIT = "footnotes_inputfield_backlinks_column_width_unit"; + const C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED = "footnotes_inputfield_backlinks_column_max_width_enabled"; + const C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR = "footnotes_inputfield_backlinks_column_max_width_scalar"; + const C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT = "footnotes_inputfield_backlinks_column_max_width_unit"; + const C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED = "footnotes_inputfield_backlinks_line_breaks_enabled"; + + // called mouse over box not tooltip for consistency: + const C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED = "footnotes_inputfield_mouse_over_box_font_size_enabled"; + const C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR = "footnotes_inputfield_mouse_over_box_font_size_scalar"; + const C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT = "footnotes_inputfield_mouse_over_box_font_size_unit"; @@ -477,6 +491,16 @@ class MCI_Footnotes_Settings { self::C_STR_BACKLINKS_TERMINATOR_OPTION => 'full_stop', self::C_STR_BACKLINKS_TERMINATOR_CUSTOM => '', + // set backlinks column width: + self::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED => 'yes', + self::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR => '2', + self::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT => 'em', + + // set backlinks column max width: + self::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED => 'yes', + self::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR => '140', + self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT => 'px', + // whether a
tag is inserted: self::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED => 'no', @@ -530,6 +554,10 @@ class MCI_Footnotes_Settings { // the current line of text (web coordinates origin is top left): self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7, + self::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'no', + self::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR => '0.6', + self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'em', + self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '', // The mouse over box shouldn’t feature a colored background // by default, due to diverging user preferences. White is neutral: diff --git a/class/task.php b/class/task.php index 65440f9..e328272 100644 --- a/class/task.php +++ b/class/task.php @@ -147,22 +147,84 @@ class MCI_Footnotes_Task { * @since 1.5.0 */ public function wp_head() { + + // tooltip: + $l_str_FontSizeEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED)); + $l_str_FontSizeScalar = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR); + $l_str_FontSizeUnit = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT); + $l_str_Color = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR); $l_str_Background = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND); + $l_int_BorderWidth = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH); $l_str_BorderColor = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR); $l_int_BorderRadius = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS); + $l_int_MaxWidth = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH); + $l_str_BoxShadowColor = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR); + + // ref container first column width: + $l_int_ColumnWidthScalar = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR); + $l_str_ColumnWidthUnit = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT); + + if (!empty($l_int_ColumnWidthScalar)) { + if ($l_str_ColumnWidthUnit == '%') { + if ($l_int_ColumnWidthScalar > 100) { + $l_int_ColumnWidthScalar = 100; + } + } + } else { + $l_int_ColumnWidthScalar = 0; + } + + // ref container first column max width: + $l_int_ColumnMaxWidthScalar = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR); + $l_str_ColumnMaxWidthUnit = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT); + + if (!empty($l_int_ColumnMaxWidthScalar)) { + if ($l_str_ColumnMaxWidthUnit == '%') { + if ($l_int_ColumnMaxWidthScalar > 100) { + $l_int_ColumnMaxWidthScalar = 100; + } + } + } else { + $l_int_ColumnMaxWidthScalar = 0; + } + ?> -