From 043f2531ab38cf83a0976f4ecbfa6bc51293426a Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Sat, 28 Nov 2020 09:58:23 +0000 Subject: [PATCH] development 2.1.4d4 for testing and Forum git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2427643 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/convert.php | 2 +- class/dashboard/layout.php | 2 +- class/dashboard/subpage-main.php | 21 ++++++-- class/init.php | 2 +- class/settings.php | 48 +++++++++++------ class/task.php | 54 ++++++++++++++++--- css/public.css | 4 +- css/settings.css | 4 +- footnotes.php | 2 +- readme.txt | 4 ++ .../settings-reference-container.html | 12 +++++ .../reference-container-body-3column.html | 26 ++++----- .../reference-container-body-combi.html | 2 +- .../reference-container-body-switch.html | 2 +- .../public/reference-container-body.html | 2 +- 15 files changed, 136 insertions(+), 51 deletions(-) diff --git a/class/convert.php b/class/convert.php index 090189a..3f8232b 100644 --- a/class/convert.php +++ b/class/convert.php @@ -210,4 +210,4 @@ class MCI_Footnotes_Convert { } echo "
"; } -} \ No newline at end of file +} diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index 519f056..35748d8 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -207,7 +207,7 @@ abstract class MCI_Footnotes_LayoutEngine { 'mci-footnotes-admin-styles', plugins_url('../../css/settings.css', __FILE__), '', - '2.1.4d3' + '2.1.4d4' ); // UPDATE version # when making changes to settings.css, FOR CACHE BUSTING diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index 3000360..7f8a786 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -11,9 +11,9 @@ * 2.1.0 2020-11-08T2148+0100 * 2.1.1 2020-11-16T2152+0100 * 2.1.3 2020-11-24T0955+0100 - * 2.1.4 2020-11-26T1052+0100 + * 2.1.4 2020-11-28T1050+0100 * - * Last modified: 2020-11-26T1052+0100 + * Last modified: 2020-11-28T1050+0100 */ /** @@ -125,6 +125,10 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) ); + // options for the punctuation used as separator or terminator: + $l_arr_Punctuation = array( + "none" => __("none", 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"); @@ -150,7 +154,16 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "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) + "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions), + + "label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR, __("Separator to use when enumerating backlinks", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "separator" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR, $l_arr_Punctuation), + + "label-terminator" => $this->addLabel(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR, __("Punctuation after a single backlink", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "terminator" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR, $l_arr_Punctuation), + + "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), ) ); // display template with replaced placeholders @@ -500,7 +513,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "description-2" => __("Default 9223372036854775807 is lowest priority, 0 is highest", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "description-3" => __("To restore default priority, set to -1, interpreted as 9223372036854775807, the constant PHP_INT_MAX", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "description-4" => __("For the_content, this figure needs to be lower than 1200 to make sure that a feature inserted by another plugin running at 1200 displays below the reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "description-5" => __("For Elementor accordions, the widget_text hook must be disabled", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "description-5" => __("The widget_text hook must be disabled, because a footnotes container is inserted at the bottom of each widget, but multiple containers in a page are not disambiguated", 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), diff --git a/class/init.php b/class/init.php index fd494b7..d0cff99 100644 --- a/class/init.php +++ b/class/init.php @@ -160,7 +160,7 @@ class MCI_Footnotes { 'mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', - '2.1.4d3' + '2.1.4d4' ); } diff --git a/class/settings.php b/class/settings.php index 3b6252c..f41436d 100644 --- a/class/settings.php +++ b/class/settings.php @@ -404,13 +404,17 @@ class MCI_Footnotes_Settings { /** * Settings Container Keys for the link element option + * Settings Container Keys for backlink typography and layout * * @since 2.1.4 * @var string * * 2020-11-26T1002+0100 */ - const C_BOOL_LINK_ELEMENT_ENABLED = "footnote_inputfield_link_element_enabled"; + const C_BOOL_LINK_ELEMENT_ENABLED = "footnote_inputfield_link_element_enabled"; + const C_STR_BACKLINKS_SEPARATOR = "footnotes_inputfield_backlinks_separator"; + const C_STR_BACKLINKS_TERMINATOR = "footnotes_inputfield_backlinks_terminator"; + const C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED = "footnotes_inputfield_backlinks_line_breaks_enabled"; @@ -443,6 +447,12 @@ class MCI_Footnotes_Settings { "footnotes_storage" => array( + self::C_STR_FOOTNOTES_SHORT_CODE_START => '((', + self::C_STR_FOOTNOTES_SHORT_CODE_END => '))', + self::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '', + self::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '', + self::C_STR_FOOTNOTES_COUNTER_STYLE => 'arabic_plain', + self::C_STR_REFERENCE_CONTAINER_NAME => 'References', self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => 'no', self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end', @@ -453,20 +463,24 @@ class MCI_Footnotes_Settings { self::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => 'no', self::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => 'no', - self::C_BOOL_LINK_ELEMENT_ENABLED => 'yes', + // hex character reference and Unicode name (defined in all-caps): + // self::C_STR_BACKLINKS_TERMINATOR => '. FULL STOP', + // self::C_STR_BACKLINKS_SEPARATOR => ', COMMA', + self::C_STR_BACKLINKS_SEPARATOR => 'none', + self::C_STR_BACKLINKS_TERMINATOR => 'none', - self::C_STR_FOOTNOTES_SHORT_CODE_START => '((', - self::C_STR_FOOTNOTES_SHORT_CODE_END => '))', - self::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '', - self::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '', - self::C_STR_FOOTNOTES_COUNTER_STYLE => 'arabic_plain', - self::C_STR_FOOTNOTES_LOVE => 'no', + // whether a
tag is inserted: + self::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED => 'no', + + self::C_BOOL_LINK_ELEMENT_ENABLED => 'yes', self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'no', // since removal of the_post hook, expert mode is no danger zone // not for experts only; raising awareness about relative positioning // changed default to 'yes': - self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'yes' + self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'yes', + + self::C_STR_FOOTNOTES_LOVE => 'no', ), @@ -531,6 +545,8 @@ class MCI_Footnotes_Settings { "footnotes_storage_expert" => array( + // checkboxes + // Titles should all be enabled by default to prevent users from // thinking at first that the feature is broken in post titles. // See @@ -538,7 +554,7 @@ class MCI_Footnotes_Settings { self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => '', // This is the only useful one: - self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'yes', + self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'checked', // And the_excerpt is disabled by default following @nikelaos in // @@ -547,16 +563,18 @@ class MCI_Footnotes_Settings { self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => '', - // disabled by default because of issues with footnotes in Elementor accordions: + // The widget_text hook must be disabled, because a footnotes container is inserted + // at the bottom of each widget, but multiple containers in a page are not disambiguated. + // E.g. enabling this causes issues with footnotes in Elementor accordions. self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => '', // 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: + // shows "9223372036854780000" instead of 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 => 10, + self::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => 1000, 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 8090f17..d1f38ea 100644 --- a/class/task.php +++ b/class/task.php @@ -20,8 +20,10 @@ * 2.1.4: fix line wrapping of URLs based on pattern, not link element 2020-11-25T0837+0100 * 2.1.4: fix issues with link elements by making them optional 2020-11-26T1051+0100 * 2.1.4: support appending arrow when combining identicals is on 2020-11-26T1633+0100 + * 2.1.4: disable or select backlink separator and terminator 2020-11-28T1048+0100 + * 2.1.4: optional line breaks to stack enumerated backlinks 2020-11-28T1049+0100 * - * Last modified: 2020-11-26T1706+0100 + * Last modified: 2020-11-28T1049+0100 */ // If called directly, abort: @@ -604,8 +606,13 @@ class MCI_Footnotes_Task { $l_str_LinkSpan = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED)) ? 'a' : 'span'; - // FOOTNOTE INDEX BACKLINK SYMBOL - + /** + * FOOTNOTE INDEX BACKLINK SYMBOL + * + * The backlink symbol has been removed for 2.0.0 along with column 2 of the reference container. + * On user request, an arrow is prepended @since 2.0.3, and the setting is restored @since 2.0.4. + * @since 2.1.1 a select box allows to disable the symbol instead of customizing it to invisible. + */ // 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))) { @@ -628,17 +635,47 @@ class MCI_Footnotes_Task { } else { // if it is not, set arrow to empty: - $l_str_Arrow = ""; - $l_str_FootnoteArrow = ""; + $l_str_Arrow = ''; + $l_str_FootnoteArrow = ''; } - // REFERENCE CONTAINER TABLE ROW TEMPLATE LOAD + /** + * BACKLINK TERMINATORS AND SEPARATORS + * + * Initially a dot was appended in the table row template, and a comma for enumerations. + * @since 2.0.6 a dot after footnote numbers is discarded as not localizable; making it + * optional was envisaged. The comma in enumerations is not generally preferred either. + */ + if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR) == 'none') { + $l_str_Separator = ''; + } + if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR) == 'none') { + $l_str_Terminator = ''; + } - // line breaks for source readability: + + /** + * LINE BREAKS + * + * The backlinks of combined footnotes are generally preferred in an enumeration. + * But when few footnotes are identical, stacking the items in list form is better. + * Variable number length and proportional character width require explicit line breaks. + * Otherwise, an ordinary space character offering a line break opportunity is inserted. + */ + $l_str_LineBreak = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED)) ? '
' : ' '; + + /** + * For maintenance and support, table rows in the reference container should be + * separated by an empty line. So we add these line breaks for source readability. + * Before the first table row (breaks between rows are ~200 lines below): + */ $l_str_Body = "\r\n\r\n"; + + // REFERENCE CONTAINER TABLE ROW TEMPLATE LOAD + // when combining identical footnotes 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))) { // the combining template allows for backlink clusters and supports cell clicking for single notes: @@ -769,7 +806,7 @@ class MCI_Footnotes_Task { $l_str_FootnoteId = MCI_Footnotes_Convert::Index(($l_int_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); // resume composing the backlinks enumeration: - $l_str_FootnoteBacklinks .= ", <$l_str_LinkSpan"; + $l_str_FootnoteBacklinks .= "$l_str_Separator$l_str_LineBreak<$l_str_LinkSpan"; $l_str_FootnoteBacklinks .= ' id="footnote_plugin_reference_'; $l_str_FootnoteBacklinks .= $l_int_PostId; $l_str_FootnoteBacklinks .= "_$l_str_FootnoteId"; @@ -807,6 +844,7 @@ class MCI_Footnotes_Task { "link-start" => $l_str_LinkSpan == 'a' ? '' : '', "link-end" => $l_str_LinkSpan == 'a' ? '' : '', "link-span" => $l_str_LinkSpan, + "terminator" => $l_str_Terminator, // used in standard layout WITH COMBINED IDENTICALS TURNED ON: "pointer" => empty($l_str_BacklinkEvent) ? '' : ' pointer', diff --git a/css/public.css b/css/public.css index 7431a4b..2912a6f 100755 --- a/css/public.css +++ b/css/public.css @@ -4,9 +4,9 @@ * Created-Date: 15.05.14 * Created-Time: 16:21 * Since: 1.0 - * Version: 2.1.4d3 + * Version: 2.1.4d4 * - * Last modified: 2020-11-26T1805+0100 + * Last modified: 2020-11-28T1051+0100 */ diff --git a/css/settings.css b/css/settings.css index 7303da5..73e9445 100755 --- a/css/settings.css +++ b/css/settings.css @@ -4,9 +4,9 @@ * Created-Date: 15.05.14 * Created-Time: 16:21 * Since: 1.0 - * Version: 2.1.4d3 + * Version: 2.1.4d4 * - * Last modified: 2020-11-26T1804+0100 + * Last modified: 2020-11-28T1051+0100 */ diff --git a/footnotes.php b/footnotes.php index 46c9b04..5ae6b9b 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.1.4d3 + Version: 2.1.4d4 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages diff --git a/readme.txt b/readme.txt index fec3ffd..bd17914 100755 --- a/readme.txt +++ b/readme.txt @@ -80,6 +80,10 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == += 2.1.4d4 = +- Bugfix: Reference container: Backlinks: disable separators and terminators +- Bugfix: Reference container: Backlinks: optional line breaks to stack enumerations + = 2.1.4d3 = - Bugfix: Reference container: Backlink symbol: support for appending when combining identicals is on - Bugfix: Reference container: Backlinks: deprioritize hover underline to ease customization diff --git a/templates/dashboard/settings-reference-container.html b/templates/dashboard/settings-reference-container.html index aba25af..b68dd86 100644 --- a/templates/dashboard/settings-reference-container.html +++ b/templates/dashboard/settings-reference-container.html @@ -20,6 +20,18 @@ [[label-switch]] [[switch]] + + [[label-terminator]] + [[terminator]] + + + [[label-separator]] + [[separator]] + + + [[label-linebreak]] + [[linebreak]] + [[label-position]] [[position]] diff --git a/templates/public/reference-container-body-3column.html b/templates/public/reference-container-body-3column.html index 1738c25..2b853ac 100644 --- a/templates/public/reference-container-body-3column.html +++ b/templates/public/reference-container-body-3column.html @@ -1,20 +1,20 @@ <[[link-span]] - id="footnote_plugin_reference_[[post_id]]_[[id]]" - class="footnote_index" - onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');" - >[[index]]. - <[[link-span]] + id="footnote_plugin_reference_[[post_id]]_[[id]]" + class="footnote_index" + onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');" + >[[index]][[terminator]]<[[link-span]] - onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');" - class="footnote_backlink" - >[[arrow]] - <[[link-span]] + onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');" + class="footnote_backlink" + >[[arrow]][[text]] diff --git a/templates/public/reference-container-body-combi.html b/templates/public/reference-container-body-combi.html index 57cd36d..d6d667d 100644 --- a/templates/public/reference-container-body-combi.html +++ b/templates/public/reference-container-body-combi.html @@ -2,7 +2,7 @@ [[backlinks]] + >[[backlinks]][[terminator]] [[text]] diff --git a/templates/public/reference-container-body-switch.html b/templates/public/reference-container-body-switch.html index 4b8505b..7d0bbae 100644 --- a/templates/public/reference-container-body-switch.html +++ b/templates/public/reference-container-body-switch.html @@ -5,7 +5,7 @@ onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');" ><[[link-span]] class="footnote_plugin_link" - >[[index]].[[arrow]][[index]][[terminator]][[arrow]] <[[link-span]] class="footnote_plugin_link" - >[[arrow]][[index]][[arrow]][[index]][[terminator]]