development 2.1.1d9 last fixes for evaluation project-side / user-side

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2419624 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2020-11-16 20:57:15 +00:00
parent d2e72d37ee
commit 3e4453929a
17 changed files with 308 additions and 166 deletions

View file

@ -7,8 +7,11 @@
* @since 1.5.0 14.09.14 14:47
*
* Edited for:
* v2.0.4 2020-11-01T0509+0100
* v2.1.0 2020-11-08T2148+0100
* 2.0.4 2020-11-01T0509+0100
* 2.1.0 2020-11-08T2148+0100
* 2.1.1 2020-11-16T2152+0100
*
* Last modified: 2020-11-16T2152+0100
*/
/**
@ -82,7 +85,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
*/
protected function getMetaBoxes() {
return array(
// Change string "%s styling" to "Footnotes styling":
// Change string "%s styling" to "Footnotes styling" to fix layout in WPv5.5:
$this->addMetaBox("settings", "styling", __("Footnotes styling", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Styling"),
$this->addMetaBox("settings", "reference-container", __("References Container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer"),
// Leave intact since this is not localized:
@ -115,20 +118,34 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"post_end" => __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"widget" => __("in the widget area", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
);
// options for Yes/No select box:
$l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
);
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-reference-container");
// replace all placeholders
$l_obj_Template->replace(
array(
"label-readon" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __("Read on button label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"readon" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL),
"label-name" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __("References label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"name" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME),
"label-collapse" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, __("Collapse references by default", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"collapse" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE),
"collapse" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, $l_arr_Enabled),
"label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __("Display a backlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"symbol" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_Enabled),
"label-startpage" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __("Display on start page too", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"startpage" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_Enabled),
"label-3column" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __("Three-column layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"3column" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_Enabled),
"label-switch" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __("Symbol appended, not prepended", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"switch" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_Enabled),
"label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __("Where shall the reference container appear", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions)
@ -247,7 +264,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @since 1.5.0
*/
public function Other() {
// options for the Footnotes to be replaced in excerpt
// options for Yes/No select box:
$l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
@ -275,11 +292,19 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @since 1.5.0
*/
public function Superscript() {
// options for Yes/No select box:
$l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
);
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-superscript");
// replace all placeholders
$l_obj_Template->replace(
array(
"label-superscript" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __("Enable superscript footnote referrers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"superscript" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_Enabled),
"label-before" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __("Before Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
@ -298,7 +323,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @since 1.5.2
*/
public function MouseOverBox() {
// options for the Footnotes to be replaced in excerpt
// options for Yes/No select box:
$l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
@ -331,6 +356,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"label-excerpt-length" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __("Maximum characters for the excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"excerpt-length" => $this->addTextBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH),
"label-readon" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __("Read on button label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"readon" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL),
"label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position),
@ -383,8 +411,10 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @since 1.5.0
*
* Edited heading for v2.0.4
* The former 'hyperlink arrow' became 'prepended arrow' in v2.0.3 after
* a user complaint about missing backlinking semantics of the footnote number.
*
* The former 'hyperlink arrow', incompatible with combined identical footnotes,
* became 'prepended arrow' in v2.0.3 after a user complaint about missing backlinking semantics
* of the footnote number.
*/
public function HyperlinkArrow() {
// load template file

View file

@ -119,29 +119,37 @@ class MCI_Footnotes {
//### SCRIPTS
// // enqueue the jQuery plugin registered by WordPress:
// wp_enqueue_script( 'jquery' );
//
// // enqueue jQuery UI libraries registered by WordPress, needed for tooltips:
// wp_enqueue_script( 'jquery-ui-core' );
// wp_enqueue_script( 'jquery-ui-widget' );
// wp_enqueue_script( 'jquery-ui-position' );
// wp_enqueue_script( 'jquery-ui-tooltip' );
//
// // enqueue jQuery Tools:
// wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__));
// These are only enqueued if the jQuery tooltips are enabled.
// If alternative tooltips are enabled, these libraries are not needed.
// Scroll animation doesnt seem to need even jQuery Core or it gets it from elsewhere.
if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) {
// enqueue the jQuery plugin registered by WordPress:
wp_enqueue_script( 'jquery' );
// enqueue jQuery UI libraries registered by WordPress, needed for tooltips:
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-widget' );
wp_enqueue_script( 'jquery-ui-position' );
wp_enqueue_script( 'jquery-ui-tooltip' );
// enqueue jQuery Tools:
wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__));
// Alternatively, fetch jQuery UI from cdnjs.cloudflare.com:
// Used to add jQuery UI following @vonpiernik:
// <https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762>:
// This was enabled in Footnotes v2.0.0 through v2.0.3.
// Re-added for 2.0.9d1 / 2.1.1d0 to look whether it can fix a broken tooltip display. 2020-11-07T1601+0100/2020-11-08T2246+0100
//wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, false ); // in header 2020-11-09T2003+0100
//wp_enqueue_script( 'jQueryUI' );
// This is then needed instead of the above first instance:
// Add jQuery Tools and finish adding jQueryUI: 2020-11-08T1638+0100/2020-11-08T2246+0100
//wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']);
// Alternatively, fetch jQuery UI from cdnjs.cloudflare.com:
// Used to add jQuery UI following @vonpiernik:
// <https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762>:
// This was enabled in Footnotes v2.0.0 through v2.0.3.
// Re-added for 2.0.9d1 / 2.1.1d0 to look whether it can fix a broken tooltip display. 2020-11-07T1601+0100/2020-11-08T2246+0100
//wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, false ); // in header 2020-11-09T2003+0100
//wp_enqueue_script( 'jQueryUI' );
// This is then needed instead of the above first instance:
// Add jQuery Tools and finish adding jQueryUI: 2020-11-08T1638+0100/2020-11-08T2246+0100
//wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']);
}
//### STYLES
@ -151,7 +159,7 @@ class MCI_Footnotes {
'mci-footnotes-css-public',
plugins_url('../css/public.css', __FILE__),
'',
'2.1.1d8'
'2.1.1d9'
);
}

View file

@ -7,12 +7,17 @@
* @since 1.5.0 14.09.14 10:43
*
* Edited for:
* v2.0.4 2020-11-02T2115+0100
* v2.0.7 2020-11-06T1342+0100
* v2.1.0 2020-11-08T2149+0100
* V2.2.0 2020-11-11T1819+0100
* 2.0.4 restore arrow settings 2020-11-02T2115+0100
* 2.0.7 remove hook the_post 2020-11-06T1342+0100
* 2.1.0 add read-on button label customization 2020-11-08T2149+0100
* 2.1.1 fix tooltips on site by alternative 2020-11-11T1819+0100
* 2.1.1 fix disabling backlink symbol 2020-11-16T2021+0100
* 2.1.1 fix superscript by making it optional
* 2.1.1 fix start pages by option to hide ref container
* 2.1.1 fix ref container by option restoring 3-column layout
* 2.1.1 fix ref container by option to switch index/symbol 2020-11-16T2022+0100
*
* Last modified: 2020-11-12T1936+0100
* Last modified: 2020-11-16T2153+0100
*/
@ -29,13 +34,27 @@ class MCI_Footnotes_Settings {
/**
* Settings Container Key for the label of the 'Read on' button in truncated tooltips
*
* @since 2.0.9
* @since 2.1.0
* @var string
*
* 2020-11-08T2106+0100
*/
const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = "footnote_inputfield_readon_label";
/**
* Settings Container Keys of 5 options fixing default layout
*
* @since 2.1.1
* @var string
*
* 2020-11-16T0859+0100
*/
const C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = "footnotes_inputfield_referrer_superscript_tags";
const C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE = "footnotes_inputfield_reference_container_backlink_symbol_enable";
const C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE = "footnotes_inputfield_reference_container_start_page_enable";
const C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE = "footnotes_inputfield_reference_container_3column_layout_enable";
const C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH = "footnotes_inputfield_reference_container_backlink_symbol_switch";
/**
* Settings Container Key for the label of the reference container.
*
@ -387,8 +406,9 @@ class MCI_Footnotes_Settings {
* @var array
*/
private $a_arr_Default = array(
"footnotes_storage" => array(
self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading',
self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => '',
self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
@ -396,6 +416,12 @@ class MCI_Footnotes_Settings {
// as long as the feature raises criticism for malfunctioning:
// <https://wordpress.org/support/topic/too-many-errors-18/>
self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => '',
self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes',
self::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes',
self::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => '',
self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => '',
self::C_STR_FOOTNOTES_SHORT_CODE_START => '((',
self::C_STR_FOOTNOTES_SHORT_CODE_END => '))',
self::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '',
@ -405,8 +431,13 @@ class MCI_Footnotes_Settings {
self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'yes',
self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'no'
),
"footnotes_storage_custom" => array(
self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading',
self::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes',
// The default footnote referrer surroundings should be square brackets:
// * as in English typesetting;
// * for better UX thanks to a more button-like appearance;
@ -454,15 +485,17 @@ class MCI_Footnotes_Settings {
self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
self::C_STR_CUSTOM_CSS => ''
),
// These should all be enabled by default to prevent users from
"footnotes_storage_expert" => array(
// Titles should all be enabled by default to prevent users from
// thinking at first that the feature is broken in post titles.
// See <https://wordpress.org/support/topic/more-feature-ideas/>
// In titles, footnotes are functionally pointless in WordPress.
"footnotes_storage_expert" => array(
self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => 'yes',
// Yet in titles, footnotes are functionally pointless in WordPress.
self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => '',
self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => 'yes',
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => '',
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => 'yes',
)
);

View file

@ -14,8 +14,9 @@
* 2.0.9: DISABLED the_post HOOK 2020-11-08T1839+0100
* 2.1.0: promoted the 'Continue reading' button from localization to customization 2020-11-08T2146+0100
* 2.1.1: combining identical footnotes: fixed dead links 2020-11-14T2233+0100
* 2.1.1: options fixing ref container layout and referrer vertical alignment 2020-11-16T2024+0100
*
* Last modified 2020-11-14T2233+0100
* Last modified 2020-11-16T2151+0100
*/
// If called directly, abort:
@ -121,6 +122,11 @@ class MCI_Footnotes_Task {
<style type="text/css" media="screen">
<?php
echo MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS);
if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE))) {
echo "\r\n.home .footnotes_reference_container { display: none; }\r\n";
}
echo '.footnote_tooltip {';
if (!empty($l_str_Color)) {
printf(" color: %s;", $l_str_Color);
@ -406,7 +412,7 @@ class MCI_Footnotes_Task {
// 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_int_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
@ -418,17 +424,31 @@ class MCI_Footnotes_Task {
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, ' '));
$l_str_ExcerptText .= '&nbsp;&#x2026; ' . '<span class="footnote_tooltip_continue" onclick="footnote_moveToAnchor_' . $l_int_PostId . '(\'footnote_plugin_reference_' . $l_int_PostId . '_' . $l_int_Index . '\');">' . MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL) . '</span>';
$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 .= '&nbsp;&#x2026; ';
$l_str_ExcerptText .= '<span class="footnote_tooltip_continue" ';
$l_str_ExcerptText .= 'onclick="footnote_moveToAnchor_' . $l_int_PostId;
$l_str_ExcerptText .= '(\'footnote_plugin_reference_' . $l_int_PostId;
$l_str_ExcerptText .= '_' . $l_int_Index . '\');">';
$l_str_ExcerptText .= MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL);
$l_str_ExcerptText .= '</span>';
}
}
// define the HTML element to use for the referrers:
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_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_int_Index,
"element" => $l_str_Element,
"before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
"index" => $l_int_Index,
"after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER),
@ -502,16 +522,31 @@ class MCI_Footnotes_Task {
// FOOTNOTE INDEX BACKLINK SYMBOL
// 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;
// check if arrow is not disabled:
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_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 = '<span class="footnote_index_arrow">';
$l_str_FootnoteArrow .= $l_str_Arrow . '</span>';
} else {
// if it is, set it to empty:
$l_str_Arrow = "";
$l_str_FootnoteArrow = "";
}
@ -519,13 +554,31 @@ class MCI_Footnotes_Task {
// line breaks for source readability:
$l_str_Body = "\r\n\r\n";
// When combine identical is turned on, another template is needed:
// 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 {
// In the standard template the whole cell is clickable.
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body");
// 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_STR_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_STR_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
@ -550,45 +603,35 @@ class MCI_Footnotes_Task {
// generate content of footnote index cell
$l_int_FirstFootnoteIndex = ($l_int_Index + 1);
// wrap each index # in a white-space:nowrap span
$l_str_FootnoteArrowIndex = '<span class="footnote_index_item">';
// wrap the arrow in a @media print { display:hidden } span (re-used below):
$l_str_FootnoteArrow = '<span class="footnote_index_arrow">';
$l_str_FootnoteArrow .= $l_str_Arrow . '&#x200A;</span>';
// and add it:
$l_str_FootnoteArrowIndex .= $l_str_FootnoteArrow;
// 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));
// add the footnote index string to arrow-index string:
// (span closing tag is added after the if statement)
$l_str_FootnoteArrowIndex .= $l_str_FootnoteIndex;
$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 = "";
// NOW FIRST START from zero again, because the above is useless for
// enumerating backlinks. The dedicated template uses a new placeholder:
if ( MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) {
$l_str_FootnoteId = $l_str_FootnoteIndex;
$l_str_FootnoteId = $l_str_FootnoteIndex;
$l_str_FootnoteBacklinks = '<a id="footnote_plugin_reference_';
$l_str_FootnoteBacklinks .= $l_int_PostId;
$l_str_FootnoteBacklinks .= "_$l_str_FootnoteId";
$l_str_FootnoteBacklinks .= '" class="footnote_backlink" ';
$l_str_FootnoteBacklinks .= 'onclick="footnote_moveToAnchor_' . $l_int_PostId;
$l_str_FootnoteBacklinks .= "('footnote_plugin_tooltip_$l_int_PostId";
$l_str_FootnoteBacklinks .= "_$l_str_FootnoteId');\">";
$l_str_FootnoteBacklinks .= $l_str_FootnoteArrow;
$l_str_FootnoteBacklinks .= $l_str_FootnoteId . '</a>';
// The dedicated template enumerating backlinks uses a new placeholder:
// If this is the only footnote with that text, were done.
$l_str_FootnoteBacklinks = '<a id="footnote_plugin_reference_';
$l_str_FootnoteBacklinks .= $l_int_PostId;
$l_str_FootnoteBacklinks .= "_$l_str_FootnoteId";
$l_str_FootnoteBacklinks .= '" class="footnote_backlink" ';
$l_str_FootnoteBacklinks .= 'onclick="footnote_moveToAnchor_' . $l_int_PostId;
$l_str_FootnoteBacklinks .= "('footnote_plugin_tooltip_$l_int_PostId";
$l_str_FootnoteBacklinks .= "_$l_str_FootnoteId');\">";
$l_str_FootnoteBacklinks .= $l_str_FootnoteArrow;
$l_str_FootnoteBacklinks .= $l_str_FootnoteId . '</a>';
// If that is the only footnote with this text, were done.
}
// CHECK IF COMBINE IDENTICAL IS TURNED ON, and
@ -622,22 +665,15 @@ class MCI_Footnotes_Task {
$l_str_FootnoteBacklinks .= $l_str_FootnoteArrow;
$l_str_FootnoteBacklinks .= $l_str_FootnoteId . '</a>';
// below is not used:
$l_str_FootnoteArrowIndex .= ',</span> <span class="footnote_index_item">' . MCI_Footnotes_Convert::Index(($l_int_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
// this legacy neither:
$l_str_FootnoteIndex .= ', ' . MCI_Footnotes_Convert::Index(($l_int_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
// 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));
}
}
}
// close the outer span FOR WHEN COMBINE IDENTICAL IS TURNED OFF:
$l_str_FootnoteArrowIndex .= '</span>';
// replace all placeholders in 'templates/public/reference-container-body.html'
// or in 'templates/public/reference-container-body-combi.html'
// The individual arrow and index placeholders are for backcompat.
$l_obj_Template->replace(
array(
// placeholder used in all templates:
@ -646,19 +682,19 @@ class MCI_Footnotes_Task {
// 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)),
"arrow-index" => $l_str_FootnoteArrowIndex,
// used in standard layout WITH COMBINED IDENTICALS TURNED ON:
"backlinks" => $l_str_FootnoteBacklinks,
// Legacy placeholders for use in legacy layout templates:
"arrow" => $l_str_Arrow,
"arrow" => $l_str_FootnoteArrow,
"index" => $l_str_FootnoteIndex,
)
);
// extra line breaks for page source legibility:
$l_str_Body .= $l_obj_Template->getContent();
// extra line breaks for page source legibility:
$l_str_Body .= "\r\n\r\n";
$l_obj_Template->reload();

View file

@ -4,9 +4,9 @@
* Created-Date: 15.05.14
* Created-Time: 16:21
* Since: 1.0
* Version: 2.1.1d8
* Version: 2.1.1d9
*
* Last modified: 2020-11-16T1424+0100
* Last modified: 2020-11-16T2150+0100
*/
@ -54,7 +54,8 @@ templates/public/footnote-alternative.html
.main-content .footnote_referrer a:link,
.footnote_plugin_tooltip_text {
text-decoration: none !important;
border-bottom: none !important;
border-bottom: none !important;
line-height: 0;
cursor: pointer;
}
.footnote_referrer:hover,
@ -193,11 +194,12 @@ 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 6px 5px 0 !important;
padding: 5px 6px 10px 0 !important;
}
.footnote_backlink,
.footnote_backlink:link,
@ -220,11 +222,13 @@ reference-container-body.html
width: 2em; /*auto-extending column to fit widest*/
}
.footnote_backlink,
.footnote_index_item {
.footnote_plugin_link {
white-space: nowrap;
}
.footnote_backlink {
.footnote_index,
.footnote_backlink,
.footnote_plugin_index.pointer {
cursor: pointer;
}
@ -251,7 +255,7 @@ UI elements - expand button, arrows - are hidden in print;
link styling is reverted so as to not gray out referrers/numbers.
*/
.footnote_container_wrapper {
.footnotes_reference_container {
page-break-inside: avoid;
}

View file

@ -4,9 +4,9 @@
* Created-Date: 15.05.14
* Created-Time: 16:21
* Since: 1.0
* Version: 2.1.1d8
* Version: 2.1.1d9
*
* Last modified: 2020-11-16T1423+0100
* Last modified: 2020-11-16T2050+0100
*/

View file

@ -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.1d8
Version: 2.1.1d9
Author URI: http://cheret.de/plugins/footnotes-2/
Text Domain: footnotes
Domain Path: /languages

View file

@ -80,22 +80,32 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog ==
= 2.1.1d9 =
- Bugfix: Layout: Footnote referrers: select box to make superscript optional wrt themes w/o support
- Bugfix: Layout: Footnote referrers: new fix for line height
- Bugfix: Layout: Reference container: Backlink symbol: select box to disable instead of space character
- Bugfix: Layout: Reference container: option to restore 3-column layout when combined are turned off
- Bugfix: Layout: Reference container: option to APpend symbol in 2-column when combined are turned off
- Bugfix: Layout: Reference container: fix start pages by an option to hide the reference container
- Bugfix: Layout: Reference container: Table rows: fix top and bottom padding
- Bugfix: Libraries: made script loads depend on tooltip implementation option
= 2.1.1d8 =
- Bugfix: Libraries: commented out all script loads to check if it fixes a theme incompatibility
= 2.1.1d7 =
- Bugfix: Combining identical footnotes: fixed dead links
- Bugfix: Combining identical footnotes: fix dead links, ensure referrer-backlink bijectivity
= 2.1.1d6 =
- Bugfix: UI: Tooltips: fixed line breaking for hyperlinked URLs in Unicode-non-compliant user agents
- Update: Libraries: completed minification of jQuery Tools
- Bugfix: UI: Tooltips: fix line breaking for hyperlinked URLs in Unicode-non-compliant user agents
- Update: Libraries: complete minification of jQuery Tools
= 2.1.1d5 =
- Add: UI: Tooltips: Alternative implementation: added CSS animation
- Add: UI: Tooltips: Alternative implementation: add CSS animation
= 2.1.1d4 =
- Add: UI: Tooltips: added delay (400ms) before fade-out to improve usability of links and Read-on button
- Update: Libraries: jQuery Tools: redacted jQuery.browser function use in js/jquery.tools.min.js
- Add: UI: Tooltips: add delay (400ms) before fade-out to improve usability of links and Read-on button
- Update: Libraries: jQuery Tools: redact jQuery.browser function use in js/jquery.tools.min.js
= 2.1.1d3 =
- Add: UI: Tooltips: experimental optional alternative CSS/JS implementation
@ -105,10 +115,10 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
= 2.1.1d1 =
- Bugfix: Libraries: jQuery UI: load in header not in footer in case it matters for fixing tooltips
- Bugfix: Layout: Ref container: Footnote number links: disabled bottom border for theme compatibility
- Bugfix: Layout: Ref container: Footnote number links: disable bottom border for theme compatibility
= 2.1.1d0
- Bugfix: Libraries: jQuery UI: switched to third party to look whether it can fix a broken tooltip display 2020-11-07T1604+0100/2020-11-08T2242+0100
- Bugfix: Libraries: jQuery UI: switch to third party to look whether it can fix a broken tooltip display 2020-11-07T1604+0100/2020-11-08T2242+0100
= 2.1.0 =
- Add: UI: Tooltip: made 'Continue reading' button label customizable
@ -161,7 +171,8 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
- Update: Prepended transitional up arrow to backlinking footnote numbers after a user complaint about missing backlinking semantics of the footnote number
- Bugfix: Fragment IDs: Prepended post ID to footnote number
- Bugfix: Feed plugin version in style sheet query string for cache busting
- Bugfix: Print style: Hide reference collapse button when printing
- Bugfix: Print style: prevent a page break just after the reference container label
- Bugfix: Print style: Hide reference collapse button
- Update: Layout: Removed padding before reference container label
= 2.0.2 =

View file

@ -1,13 +1,13 @@
<table class="widefat fixed">
<tbody>
<tr>
<td>[[label-enable]]</td>
<td>[[enable]]</td>
</tr>
<tr>
<td>[[label-alternative]]</td>
<td>[[alternative]]</td>
</tr>
<tbody>
<tr>
<td>[[label-enable]]</td>
<td>[[enable]]</td>
</tr>
<tr>
<td>[[label-alternative]]</td>
<td>[[alternative]]</td>
</tr>
<tr>
<td>[[label-activate-excerpt]]</td>
<td>[[activate-excerpt]]</td>
@ -16,18 +16,22 @@
<td>[[label-excerpt-length]]</td>
<td>[[excerpt-length]]</td>
</tr>
<tr>
<td>[[label-position]]</td>
<td>[[position]]</td>
</tr>
<tr>
<td>[[label-offset-x]]</td>
<td>[[offset-x]] <em>[[notice-offset-x]]</em></td>
</tr>
<tr>
<td>[[label-offset-y]]</td>
<td>[[offset-y]] <em>[[notice-offset-y]]</em></td>
</tr>
<tr>
<td>[[label-readon]]</td>
<td>[[readon]]</td>
</tr>
<tr>
<td>[[label-position]]</td>
<td>[[position]]</td>
</tr>
<tr>
<td>[[label-offset-x]]</td>
<td>[[offset-x]] <em>[[notice-offset-x]]</em></td>
</tr>
<tr>
<td>[[label-offset-y]]</td>
<td>[[offset-y]] <em>[[notice-offset-y]]</em></td>
</tr>
<tr>
<td>[[label-color]]</td>
<td>[[color]] <em>[[notice-color]]</em></td>
@ -52,9 +56,9 @@
<td>[[label-max-width]]</td>
<td>[[max-width]] <em>[[notice-max-width]]</em></td>
</tr>
<tr>
<td>[[label-box-shadow-color]]</td>
<td>[[box-shadow-color]] <em>[[notice-box-shadow-color]]</em></td>
</tr>
</tbody>
<tr>
<td>[[label-box-shadow-color]]</td>
<td>[[box-shadow-color]] <em>[[notice-box-shadow-color]]</em></td>
</tr>
</tbody>
</table>

View file

@ -1,5 +1,9 @@
<table class="widefat fixed">
<tbody>
<tr>
<td>[[label-superscript]]</td>
<td>[[superscript]]</td>
</tr>
<tr>
<td>[[label-before]]</td>
<td>[[before]]</td>
@ -9,4 +13,4 @@
<td>[[after]]</td>
</tr>
</tbody>
</table>
</table>

View file

@ -1,10 +1,5 @@
<table class="widefat fixed">
<tbody>
<tr>
<td>[[label-readon]]</td>
<td>[[readon]]</td>
<td>(Quick fix, will be moved to its place.)</td>
</tr>
<tr>
<td>[[label-name]]</td>
<td>[[name]]</td>
@ -13,9 +8,25 @@
<td>[[label-collapse]]</td>
<td>[[collapse]]</td>
</tr>
<tr>
<td>[[label-3column]]</td>
<td>[[3column]]</td>
</tr>
<tr>
<td>[[label-symbol]]</td>
<td>[[symbol]]</td>
</tr>
<tr>
<td>[[label-switch]]</td>
<td>[[switch]]</td>
</tr>
<tr>
<td>[[label-position]]</td>
<td>[[position]]</td>
</tr>
<tr>
<td>[[label-startpage]]</td>
<td>[[startpage]]</td>
</tr>
</tbody>
</table>

View file

@ -2,11 +2,11 @@
class="footnote_referrer relative"
onmouseover="footnoteTooltipShow('footnote_plugin_tooltip_text_[[post_id]]_[[id]]')"
onmouseout="footnoteTooltipHide('footnote_plugin_tooltip_text_[[post_id]]_[[id]]')"
><a><sup
><a><[[element]]
id="footnote_plugin_tooltip_[[post_id]]_[[id]]"
class="footnote_plugin_tooltip_text"
onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_reference_[[post_id]]_[[id]]');"
>[[before]][[index]][[after]]</sup
>[[before]][[index]][[after]]</[[element]]
></a><span
id="footnote_plugin_tooltip_text_[[post_id]]_[[id]]"
class="footnote_tooltip position hidden"

View file

@ -1,10 +1,10 @@
<span
class="footnote_referrer"
><a><sup
><a><[[element]]
id="footnote_plugin_tooltip_[[post_id]]_[[id]]"
class="footnote_plugin_tooltip_text"
onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_reference_[[post_id]]_[[id]]');"
>[[before]][[index]][[after]]</sup
>[[before]][[index]][[after]]</[[element]]
></a><span
id="footnote_plugin_tooltip_text_[[post_id]]_[[id]]"
class="footnote_tooltip"

View file

@ -3,13 +3,15 @@
class="footnote_plugin_index"
><span
id="footnote_plugin_reference_[[post_id]]_[[id]]"
class="footnote_index"
onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');"
>[[index]]</span
>[[index]].</span
></td>
<td
class="footnote_plugin_link"
><span
onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');"
class="footnote_backlink"
>[[arrow]]</span
></td>
<td

View file

@ -1,9 +1,8 @@
<tr>
<td
id="footnote_plugin_reference_[[post_id]]_[[id]]"
class="footnote_plugin_index"
class="footnote_plugin_index pointer"
onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');"
style="cursor: pointer;"
><span
class="footnote_plugin_link"
>[[index]].[[arrow]]</span

View file

@ -1,12 +1,11 @@
<tr>
<td
id="footnote_plugin_reference_[[post_id]]_[[id]]"
class="footnote_plugin_index"
class="footnote_plugin_index pointer"
onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_tooltip_[[post_id]]_[[id]]');"
style="cursor: pointer;"
><a
class="footnote_plugin_link"
>[[arrow-index]]</a
>[[arrow]][[index]]</a
></td>
<td
class="footnote_plugin_text"

View file

@ -1,12 +1,13 @@
<div
class="speaker-mute footnote_container_wrapper"
class="speaker-mute footnotes_reference_container"
>
<div
class="footnote_container_prepare"
><p
><span
onclick="footnote_expand_reference_container_[[post_id]]();"
>[[label]]</span
class="footnote_reference_container_label"
onclick="footnote_expand_reference_container_[[post_id]]();"
>[[label]]</span
><span
class="footnote_reference_container_collapse_button"
style="[[button-style]]"