From 0fb5e205c3ffb6805c69d8f497b8c041235fae2e Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Fri, 6 Nov 2020 04:04:30 +0000 Subject: [PATCH] =?UTF-8?q?delta=200=20for=20next=20release:=20v2.0.7d0=20?= =?UTF-8?q?commit=20as=20dev=20version=20needed=20to=20respond=20on=20foru?= =?UTF-8?q?m.=20(v2.0.6=20has=20been=20diffed=20against=202.0.4=20and=20as?= =?UTF-8?q?sessed,=20could=20be=20kept=20in=20production=20as=20well=20giv?= =?UTF-8?q?en=202.0.4=20is=20okay.)=20Hooks=20default=20status=20reset=20t?= =?UTF-8?q?o=20previous,=20in=20case=20that=20matters=20(doesn=E2=80=99t?= =?UTF-8?q?=20on=20my=20WordPress).=20PROBLEM=20WITH=20UNRESPONSIVE=20POSI?= =?UTF-8?q?TION=20SETTING=20UNRESOLVED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2413678 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/init.php | 14 ++-- class/settings.php | 71 +++++++++++++------ class/task.php | 29 ++++---- css/public.css | 4 +- readme.txt | 4 ++ templates/NOTE-FOR-WEBMASTERS.txt | 28 ++++++++ .../public/reference-container-body.html | 2 +- 7 files changed, 113 insertions(+), 39 deletions(-) create mode 100644 templates/NOTE-FOR-WEBMASTERS.txt diff --git a/class/init.php b/class/init.php index 2db91e6..9e09b93 100644 --- a/class/init.php +++ b/class/init.php @@ -12,7 +12,7 @@ * Edited for v2.0.3: Added style sheet versioning 2020-10-29T1413+0100 * Edited for v2.0.4: Added jQuery UI from WordPress 2020-11-01T1902+0100 * - * Last modified: 2020-11-05T1824+0100 + * Last modified: 2020-11-06T0324+0100 */ @@ -125,7 +125,13 @@ class MCI_Footnotes { // 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.6'); - } + // 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.7d0' + ); + } + } diff --git a/class/settings.php b/class/settings.php index ec2e764..24302ef 100644 --- a/class/settings.php +++ b/class/settings.php @@ -6,13 +6,15 @@ * @author Stefan Herndler * @since 1.5.0 14.09.14 10:43 * - * Edited for v2.0.4 2020-11-02T2115+0100 + * Edited for: + * v2.0.4 2020-11-02T2115+0100 + * v2.0.7 2020-11-06T0321+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 @@ -165,7 +167,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 @@ -388,34 +390,63 @@ class MCI_Footnotes_Settings { 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_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_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '', - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#fff7a7', + + // 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', + + // 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 => '', + // 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, + self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99', + + // 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. + // We might wish to enable all these by default, but + // in titles, footnotes are functionally pointless in WordPress. // See "footnotes_storage_expert" => array( - self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => 'yes', + 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' + self::C_BOOL_EXPERT_LOOKUP_THE_POST => '' ) ); diff --git a/class/task.php b/class/task.php index fa9d12c..ed88011 100644 --- a/class/task.php +++ b/class/task.php @@ -11,7 +11,7 @@ * Edited for v2.0.5: Autoload / infinite scroll support added thanks to code from * @docteurfitness * - * Last modified 2020-11-05T0524+0100 + * Last modified 2020-11-06T0425+0100 */ // If called directly, abort: @@ -491,11 +491,12 @@ class MCI_Footnotes_Task { // generate content of footnote index cell $l_str_FirstFootnoteIndex = ($l_str_Index + 1); // wrap each index # in a white-space:nowrap span - $l_str_FootnoteIndex = ''; + $l_str_FootnoteArrowIndex = ''; // wrap the arrow in a @media print { display:hidden } span - $l_str_FootnoteIndex .= '' . $l_str_Arrow . ' '; - // get the index - $l_str_FootnoteIndex .= MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + $l_str_FootnoteArrowIndex .= '' . $l_str_Arrow . ' '; + // get the index; add support for legacy index placeholder: + $l_str_FootnoteArrowIndex .= MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + $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))) { @@ -506,20 +507,24 @@ class MCI_Footnotes_Task { // 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)); + $l_str_FootnoteArrowIndex .= ', ' . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + $l_str_FootnoteIndex .= ', ' . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); } } } - $l_str_FootnoteIndex .= ''; + $l_str_FootnoteArrowIndex .= ''; - // replace all placeholders in the template templates/public/reference-container-body.html + // replace all placeholders in the template templates/public/reference-container-body.html + // The individual arrow and index placeholders are for backcompat $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)), - "index" => $l_str_FootnoteIndex, - "text" => $l_str_FootnoteText + "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, + "arrow-index" => $l_str_FootnoteArrowIndex, + "text" => $l_str_FootnoteText ) ); // extra line breaks for page source legibility: diff --git a/css/public.css b/css/public.css index 8e89433..bcbffb7 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.0.6 + * Version: 2.0.7d0 * - * Last modified: 2020-11-05T1826+0100 + * Last modified: 2020-11-06T0325+0100 */ diff --git a/readme.txt b/readme.txt index 56cf767..1cda949 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.0.7d0 = +- Update: Added backwards compatible support for legacy arrow and index placeholders in template +- Update: Set all hooks defaults back to legacy as in titles, footnotes are functionally pointless + = 2.0.6 = - Update: Autoload / infinite scroll support thanks to @docteurfitness - Bugfix: Layout: Footnote referrers: deleted vertical align tweaks for cross-theme and user agent compatibility diff --git a/templates/NOTE-FOR-WEBMASTERS.txt b/templates/NOTE-FOR-WEBMASTERS.txt new file mode 100644 index 0000000..ca224da --- /dev/null +++ b/templates/NOTE-FOR-WEBMASTERS.txt @@ -0,0 +1,28 @@ +MCI Footnotes WordPress plugin + +NOTE FOR WEBMASTERS + +Added: 2020-11-06T0424+0100 +Last modified: 2020-11-06T0431+0100 + +About the public templates + + +Template "reference-container-body.html" + +class/task.php(481) +css/public.css + +Supported placeholders: + +[[post_id]] makes the footnote ID unique for infinite scroll +[[id]] footnote number (1-based integer) + +[[arrow]] symbol alone, for backwards compatibility +[[index]] footnote index alone (or comma-separated enumeration) for backwards compatibility + +[[arrow-index]] new compound string starting with the arrow hidden in print + wrapping each index in a no-break span, example: + + ↑ 4, 5, 6, 7, 8, 9, 10, +[[text]] diff --git a/templates/public/reference-container-body.html b/templates/public/reference-container-body.html index 8af0475..b58a19a 100755 --- a/templates/public/reference-container-body.html +++ b/templates/public/reference-container-body.html @@ -4,7 +4,7 @@ class="footnote_plugin_index footnote_plugin_link" onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');" >[[index]][[arrow-index]]