bugfix release 2.1.4 (added features fix issues and are not localized yet)
git-svn-id: https://plugins.svn.wordpress.org/footnotes/tags/2.1.4@2432656 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
2eaf22a30b
commit
665ddda49b
32 changed files with 1511 additions and 602 deletions
|
@ -210,4 +210,4 @@ class MCI_Footnotes_Convert {
|
|||
}
|
||||
echo "<br/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,15 @@
|
|||
* @author Stefan Herndler
|
||||
* @since 1.5.0 12.09.14 10:56
|
||||
*
|
||||
* 2.1.2 added version # of settings.css for cache busting 2020-11-19T1456+0100
|
||||
* 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 optional step argument and support for floating in numbox 2020-12-05T0540+0100
|
||||
*
|
||||
* ############ Please update line 210 after changes to settings.css ###############
|
||||
* ########## fix punctuation-related localization issue in dashboard labels 2020-12-01T0211+0100
|
||||
* ########## this fix reverted for now; restore when updating strings and translations, line 400
|
||||
*
|
||||
* Last modified: 2020-12-06T1654+0100
|
||||
*/
|
||||
|
||||
|
||||
|
@ -203,14 +209,8 @@ abstract class MCI_Footnotes_LayoutEngine {
|
|||
|
||||
// register stylesheet
|
||||
// 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.3'
|
||||
);
|
||||
// UPDATE version # when making changes to settings.css, FOR CACHE BUSTING
|
||||
|
||||
// automated update of version number for cache busting
|
||||
wp_register_style( 'mci-footnotes-admin-styles', plugins_url('footnotes/css/settings.css'), array(), FOOTNOTES_VERSION );
|
||||
|
||||
// add stylesheet to the output
|
||||
wp_enqueue_style('mci-footnotes-admin-styles');
|
||||
|
@ -380,12 +380,25 @@ abstract class MCI_Footnotes_LayoutEngine {
|
|||
* @param string $p_str_SettingName Name of the Settings key to connect the Label with the input/select field.
|
||||
* @param string $p_str_Caption Label caption.
|
||||
* @return string
|
||||
*
|
||||
* Edited 2020-12-01T0159+0100
|
||||
* @since #################### no colon
|
||||
*/
|
||||
protected function addLabel($p_str_SettingName, $p_str_Caption) {
|
||||
if (empty($p_str_Caption)) {
|
||||
return "";
|
||||
}
|
||||
// remove the colon causing localization issues with French,
|
||||
// and with languages not using punctuation at all,
|
||||
// and with languages using other punctuation marks instead of colon,
|
||||
// e.g. Greek using a raised dot.
|
||||
// In French, colon is preceded by a space, forcibly non-breaking,
|
||||
// and narrow per new school.
|
||||
// Add colon to label strings for inclusion in localization.
|
||||
// Colon after label is widely preferred best practice, mandatory per style guides.
|
||||
return sprintf('<label for="%s">%s:</label>', $p_str_SettingName, $p_str_Caption);
|
||||
// ^ here deleted colon 2020-12-01T0156+0100
|
||||
// ########## this fix reverted for now; restore when updating strings and translations
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -488,15 +501,26 @@ abstract class MCI_Footnotes_LayoutEngine {
|
|||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SettingName Name of the Settings key to pre load the input field.
|
||||
* @param int $p_in_Min Minimum value.
|
||||
* @param int $p_int_Max Maximum value.
|
||||
* @param int $p_in_Min Minimum value.
|
||||
* @param int $p_int_Max Maximum value.
|
||||
* @param bool $p_bool_Deci true if 0.1 steps and floating to string, false if integer (default)
|
||||
* @return string
|
||||
*
|
||||
* Edited:
|
||||
* @since 2.1.4 step argument and number_format() to allow decimals 2020-12-03T0631+0100..2020-12-05T2006+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_bool_Deci = false ) {
|
||||
// collect data for given settings field
|
||||
$l_arr_Data = $this->LoadSetting($p_str_SettingName);
|
||||
return sprintf('<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
|
||||
|
||||
if ($p_bool_Deci) {
|
||||
$l_str_Value = number_format($l_arr_Data["value"], 1);
|
||||
return sprintf('<input type="number" name="%s" id="%s" value="%s" step="0.1" min="%d" max="%d"/>',
|
||||
$l_arr_Data["name"], $l_arr_Data["id"], $l_str_Value, $p_in_Min, $p_int_Max);
|
||||
} else {
|
||||
return sprintf('<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
|
||||
$l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_in_Min, $p_int_Max);
|
||||
}
|
||||
}
|
||||
|
||||
} // end of class
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
* @since 1.5.0 14.09.14 14:47
|
||||
*
|
||||
* Edited for:
|
||||
* 2.0.4 2020-11-01T0509+0100
|
||||
* 2.1.0 2020-11-08T2148+0100
|
||||
* 2.1.1 2020-11-16T2152+0100
|
||||
* 2.1.3 2020-11-24T0955+0100
|
||||
* 2.0.4 restore arrow settings 2020-11-01T0509+0100
|
||||
* 2.1.0 read-on button label 2020-11-08T2148+0100
|
||||
* 2.1.1 options for ref container and alternative tooltips 2020-11-16T2152+0100
|
||||
* 2.1.4 settings for ref container, tooltips and scrolling 2020-12-03T0950+0100
|
||||
*
|
||||
* Last modified: 2020-11-24T0955+0100
|
||||
* Last modified: 2020-12-06T1653+0100
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -89,12 +89,13 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
// 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"),
|
||||
$this->addMetaBox("settings", "other", __("Other", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Other"),
|
||||
// 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"),
|
||||
$this->addMetaBox("settings", "other", __("Other", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Other"),
|
||||
|
||||
// This is restored to meet user demand for arrow symbol semantics:
|
||||
$this->addMetaBox("customize", "hyperlink-arrow", __("Hyperlink symbol in the Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "HyperlinkArrow"),
|
||||
// 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"),
|
||||
|
@ -111,6 +112,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*
|
||||
* Completed:
|
||||
* @since 2.1.4: layout and typography options 2020-11-30T0548+0100
|
||||
*/
|
||||
public function ReferenceContainer() {
|
||||
// options for the positioning of the reference container
|
||||
|
@ -119,6 +123,36 @@ 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)
|
||||
);
|
||||
// basic responsive page layout options:
|
||||
$l_arr_PageLayoutOptions = array(
|
||||
"none" => __("Don’t fix the layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"reference-container" => __("to the reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"page-content" => __("to everything after the post title until the reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"main-content" => __("to everything from the post title to the reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
);
|
||||
// options for the separating punctuation between backlinks:
|
||||
// Unicode names are conventionally uppercase.
|
||||
$l_arr_Separators = array(
|
||||
"comma" => __("COMMA", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"semicolon" => __("SEMICOLON", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"en_dash" => __("EN DASH", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
);
|
||||
// options for the terminating punctuation after backlinks:
|
||||
// The Unicode name of RIGHT PARENTHESIS was originally more accurate because it is bidi-mirrored.
|
||||
// The wrong names were enforced in spite of Unicode, that subsequently scrambled to correct.
|
||||
$l_arr_Terminators = array(
|
||||
"period" => __("FULL STOP", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"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),
|
||||
"rem" => __("root em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"em" => __("em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"vw" => __("viewport width", 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),
|
||||
|
@ -136,20 +170,55 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"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->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-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),
|
||||
|
||||
"label-page-layout" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __("Apply basic responsive page layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"page-layout" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_PageLayoutOptions),
|
||||
"notice-page-layout" => __("Most themes don’t need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"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-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-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),
|
||||
"notice-symbol" => __("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),
|
||||
|
||||
"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)
|
||||
"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),
|
||||
"notice-3column" => __("This legacy layout is available if identical footnotes are not combined.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED, __("Add a separator when enumerating backlinks", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"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),
|
||||
"notice-separator" => __("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),
|
||||
"notice-terminator" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"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, true),
|
||||
"width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_WidthUnits),
|
||||
"notice-width" => __("Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"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, true),
|
||||
"max-width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_WidthUnits),
|
||||
"notice-max-width" => __("Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"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
|
||||
|
@ -166,7 +235,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
// define some space for the output
|
||||
$l_str_Space = " ";
|
||||
// options for the combination of identical footnotes
|
||||
$l_arr_CombineIdentical = array(
|
||||
$l_arr_Enable = array(
|
||||
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
);
|
||||
|
@ -198,28 +267,35 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-identical" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, __("Combine identical footnotes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"identical" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_CombineIdentical),
|
||||
|
||||
"label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote tag starts with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart),
|
||||
"short-code-start-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED),
|
||||
|
||||
"label-short-code-end" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __("and ends with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"short-code-end" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_ShortCodeEnd),
|
||||
|
||||
"label-short-code-start-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, ""),
|
||||
"short-code-start-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED),
|
||||
|
||||
"label-short-code-end-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, ""),
|
||||
"short-code-end-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED),
|
||||
|
||||
"label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Counter style", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle),
|
||||
|
||||
// for script showing/hiding user defined text boxes:
|
||||
"short-code-start-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START,
|
||||
"short-code-end-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END,
|
||||
"short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED,
|
||||
"short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
|
||||
|
||||
"label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Counter style", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle),
|
||||
|
||||
// algorithmically combine identicals:
|
||||
"label-identical" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, __("Combine identical footnotes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"identical" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_Enable),
|
||||
|
||||
"label-scroll-offset" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __("Scroll offset", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"scroll-offset" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100),
|
||||
"notice-scroll-offset" => __("per cent from the upper edge of the window", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-scroll-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __("Scroll duration", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"scroll-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000),
|
||||
"notice-scroll-duration" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
|
@ -276,8 +352,15 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-link" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, __("Use the link element for referrers and backlinks", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"link" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, $l_arr_Enabled),
|
||||
|
||||
"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),
|
||||
"notice1-excerpt" => __("This should be disabled.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"notice2-excerpt" => __("In some themes, the Advanced Excerpt plugin is indispensable to display footnotes in excerpts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"notice3-excerpt" => __("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)
|
||||
)
|
||||
|
@ -340,11 +423,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),
|
||||
|
||||
|
@ -355,7 +452,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"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),
|
||||
"excerpt-length" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000),
|
||||
|
||||
"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),
|
||||
|
@ -364,13 +461,43 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position),
|
||||
|
||||
"label-offset-x" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __("Offset X (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -50, 50),
|
||||
"offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -150, 150),
|
||||
"notice-offset-x" => __("Offset (X axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-offset-y" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __("Offset Y (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -50, 50),
|
||||
"offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -150, 150),
|
||||
"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),
|
||||
|
||||
// display durations:
|
||||
|
||||
"label-fade-in-delay" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, __("Fade-in delay", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"fade-in-delay" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000),
|
||||
"notice-fade-in-delay" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-fade-in-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, __("Fade-in duration", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"fade-in-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000),
|
||||
"notice-fade-in-duration" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-fade-out-delay" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, __("Fade-out delay", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"fade-out-delay" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000),
|
||||
"notice-fade-out-delay" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-fade-out-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, __("Fade-out duration", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"fade-out-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000),
|
||||
"notice-fade-out-duration" => __("milliseconds", 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, true),
|
||||
"font-size-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_FontSizeUnits),
|
||||
"notice-font-size" => __("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),
|
||||
|
@ -380,7 +507,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"notice-background" => __("Empty color will use the default background-color defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-border-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __("Border width (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"border-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4),
|
||||
"border-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true),
|
||||
"notice-border-width" => __("Set the width to 0px to hide the border.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-border-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __("Border color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
|
@ -388,13 +515,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"notice-border-color" => __("Empty color will use the default border-color defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-border-radius" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __("Border radius (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"border-radius" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 20),
|
||||
"border-radius" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500),
|
||||
"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),
|
||||
|
@ -416,24 +539,9 @@ 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
|
||||
*/
|
||||
public function HyperlinkArrow() {
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-hyperlink-arrow");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, __("Hyperlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"symbol" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, MCI_Footnotes_Convert::getArrow()),
|
||||
|
||||
"label-user-defined" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED, __("or enter a user defined symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"user-defined" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED),
|
||||
"comment" => __("if set it overrides the hyperlink symbol above", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the custom css box.
|
||||
|
@ -477,7 +585,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
*
|
||||
* 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
|
||||
* 2.1.4 add priority level settings for the other hooks 2020-11-19T1421+0100
|
||||
*/
|
||||
public function lookupHooks() {
|
||||
// load template file
|
||||
|
@ -496,10 +604,8 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"description-1" => __("The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"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 reference container to sit above related posts, the priority level of the_content hook may need to be at most 1200.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"description-5" => __("For Footnotes to work when a glossary plugin is active, a higher priority of 1000 may be needed.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"description-6" => __("For the_content, another good pick with proven efficiency is priority level 10.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"description-7" => __("Usually only the_content should be enabled; widget_text may cause issues in accordions, the_title causes issues in browser tabs.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"description-4" => __("For the_content, this figure needs to be lower than 1200 to make sure that the reference container displays above features inserted by other plugins running at 1200 or a greater/lower level, later in the process.", 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),
|
||||
|
|
|
@ -2,21 +2,19 @@
|
|||
/**
|
||||
* Includes the main Class of the Plugin.
|
||||
*
|
||||
* ******************************************************************************************************
|
||||
* IMPORTANT: In registerPublic() line 163: Please keep plugin version # up to date for cache busting. *
|
||||
* Also in class/dashboard/layout:210 for settings.css *
|
||||
* ******************************************************************************************************
|
||||
*
|
||||
* @filesource
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0 12.09.14 10:56
|
||||
*
|
||||
* Edited for v1.6.5: Replaced deprecated function create_function()
|
||||
* Edited for v2.0.0: Added jQueryUI from Cloudflare 2020-10-26T1907+0100
|
||||
* 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
|
||||
* Edited:
|
||||
* 1.6.5 replace deprecated function create_function()
|
||||
* 2.0.0 add jQueryUI from Cloudflare 2020-10-26T1907+0100
|
||||
* 2.0.3 add versioning of public.css for cache busting 2020-10-29T1413+0100
|
||||
* 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
|
||||
* 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
|
||||
* 2.1.4 optionally enqueue an extra style sheet 2020-12-04T2231+0100
|
||||
*
|
||||
* Continual update of version number for cache busting.
|
||||
* Last modified: 2020-12-06T1655+0100
|
||||
*/
|
||||
|
||||
|
||||
|
@ -135,8 +133,10 @@ class MCI_Footnotes {
|
|||
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');
|
||||
// enqueue jQuery Tools:
|
||||
// redacted jQuery.browser, completed minification; added versioning 2020-11-18T2150+0100
|
||||
// not use '-js' in the handle, is appended automatically
|
||||
wp_enqueue_script('mci-footnotes-jquery-tools', plugins_url('footnotes/js/jquery.tools.min.js'), array(), '1.2.7redacted');
|
||||
|
||||
|
||||
// Alternatively, fetch jQuery UI from cdnjs.cloudflare.com:
|
||||
|
@ -155,13 +155,16 @@ class MCI_Footnotes {
|
|||
|
||||
//### 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.3'
|
||||
);
|
||||
}
|
||||
// up-to-date plugin version number needed for cache busting:
|
||||
// not use '-css' in the handle, is appended automatically;
|
||||
// constant FOOTNOTES_VERSION defined in footnotes.php, media all is default
|
||||
wp_enqueue_style( 'mci-footnotes-public', plugins_url('footnotes/css/public.css'), array(), FOOTNOTES_VERSION, 'all' );
|
||||
|
||||
// optional layout fix by lack of layout support:
|
||||
// since 2.1.4 2020-12-05T1417+0100
|
||||
$l_str_LayoutOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT);
|
||||
if ($l_str_LayoutOption != 'none') {
|
||||
wp_enqueue_style( 'mci-footnotes-layout-' . $l_str_LayoutOption, plugins_url('footnotes/css/layout-' . $l_str_LayoutOption . '.css'), array(), FOOTNOTES_VERSION, 'all' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,19 @@
|
|||
* @since 1.5.0 14.09.14 10:43
|
||||
*
|
||||
* 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.3 fix ref container positioning by priority level 2020-11-17T0205+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
|
||||
* 2.1.3 fix ref container positioning by priority level 2020-11-17T0205+0100
|
||||
* 2.1.4 more settings container keys 2020-12-03T0955+0100
|
||||
*
|
||||
* Last modified: 2020-11-17T0311+0100
|
||||
* Last modified: 2020-12-06T1653+0100
|
||||
*/
|
||||
|
||||
|
||||
|
@ -175,7 +176,7 @@ class MCI_Footnotes_Settings {
|
|||
/**
|
||||
* Settings Container Key for alternative tooltip implementation
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @since 2.1.4
|
||||
* @var string
|
||||
*
|
||||
* 2020-11-11T1817+0100
|
||||
|
@ -373,7 +374,7 @@ class MCI_Footnotes_Settings {
|
|||
const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = "footnote_inputfield_readon_label";
|
||||
|
||||
/**
|
||||
* Settings Container Keys of options fixing default layout
|
||||
* Settings Container Keys for options fixing default layout
|
||||
*
|
||||
* @since 2.1.1
|
||||
* @var string
|
||||
|
@ -381,18 +382,83 @@ class MCI_Footnotes_Settings {
|
|||
* 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";
|
||||
|
||||
/**
|
||||
* Settings Container Keys for hook priority levels
|
||||
*
|
||||
* @since 2.1.1 (the_content)
|
||||
* @since 2.1.2
|
||||
* @var string
|
||||
*
|
||||
* 2020-11-16T0859+0100
|
||||
* 2020-11-20T0620+0100
|
||||
*/
|
||||
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";
|
||||
|
||||
/**
|
||||
* Settings Container Keys for the link element option
|
||||
* Settings Container Keys for backlink typography and layout
|
||||
* Settings Container Keys for tooltip font size
|
||||
* Settings Container Keys for page layout support
|
||||
* Settings Container Keys for scroll offset and duration
|
||||
* Settings Container Keys for tooltip display durations
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @var string|bool|int
|
||||
*
|
||||
* 2020-11-26T1002+0100
|
||||
* 2020-11-30T0427+0100
|
||||
* 2020-12-03T0501+0100
|
||||
* 2020-12-05T0425+0100
|
||||
*/
|
||||
|
||||
// link element option:
|
||||
const C_BOOL_LINK_ELEMENT_ENABLED = "footnote_inputfield_link_element_enabled";
|
||||
|
||||
// backlink typography:
|
||||
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";
|
||||
|
||||
// backlink layout:
|
||||
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";
|
||||
|
||||
// tooltip font size:
|
||||
// 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";
|
||||
|
||||
// page layout support:
|
||||
const C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT = "footnotes_inputfield_page_layout_support";
|
||||
|
||||
// scroll offset and duration:
|
||||
const C_INT_FOOTNOTES_SCROLL_OFFSET = "footnotes_inputfield_scroll_offset";
|
||||
const C_INT_FOOTNOTES_SCROLL_DURATION = "footnotes_inputfield_scroll_duration";
|
||||
|
||||
// tooltip display durations:
|
||||
// called mouse over box not tooltip for consistency
|
||||
const C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY = "footnotes_inputfield_mouse_over_box_fade_in_delay";
|
||||
const C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION = "footnotes_inputfield_mouse_over_box_fade_in_duration";
|
||||
const C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY = "footnotes_inputfield_mouse_over_box_fade_out_delay";
|
||||
const C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION = "footnotes_inputfield_mouse_over_box_fade_out_duration";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -424,28 +490,61 @@ 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_INT_FOOTNOTES_SCROLL_OFFSET => 20,
|
||||
self::C_INT_FOOTNOTES_SCROLL_DURATION => 380,
|
||||
|
||||
self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
|
||||
self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => 'no',
|
||||
self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
|
||||
self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => 'yes',
|
||||
|
||||
// whether to enqueue additional style sheet:
|
||||
self::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT => 'none',
|
||||
|
||||
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 => 'no',
|
||||
self::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => 'no',
|
||||
|
||||
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',
|
||||
// backlink separators and terminators are often not preferred.
|
||||
// but a choice must be provided along with the ability to customize:
|
||||
self::C_BOOL_BACKLINKS_SEPARATOR_ENABLED => 'yes',
|
||||
self::C_STR_BACKLINKS_SEPARATOR_OPTION => 'comma',
|
||||
self::C_STR_BACKLINKS_SEPARATOR_CUSTOM => '',
|
||||
self::C_BOOL_BACKLINKS_TERMINATOR_ENABLED => 'no',
|
||||
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 => 'no',
|
||||
self::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR => '50',
|
||||
self::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT => 'px',
|
||||
|
||||
// set backlinks column max width:
|
||||
self::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED => 'no',
|
||||
self::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR => '140',
|
||||
self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT => 'px',
|
||||
|
||||
// whether a <br /> tag is inserted:
|
||||
self::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED => 'no',
|
||||
|
||||
// whether to use link elements:
|
||||
self::C_BOOL_LINK_ELEMENT_ENABLED => 'yes',
|
||||
|
||||
// excerpt should be disabled:
|
||||
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',
|
||||
|
||||
),
|
||||
|
||||
|
@ -487,6 +586,20 @@ 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,
|
||||
|
||||
// tooltip display durations:
|
||||
// called mouse over box not tooltip for consistency
|
||||
self::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY => 0,
|
||||
self::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION => 200,
|
||||
self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY => 400,
|
||||
self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION => 200,
|
||||
|
||||
// tooltip font size reset to legacy by default since 2.1.4;
|
||||
// was set to inherit since 2.1.1 as it overrode custom CSS,
|
||||
// is moved to settings since 2.1.4 2020-12-04T1023+0100
|
||||
self::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'yes',
|
||||
self::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13,
|
||||
self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px',
|
||||
|
||||
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:
|
||||
|
@ -510,6 +623,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 <https://wordpress.org/support/topic/more-feature-ideas/>
|
||||
|
@ -517,7 +632,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
|
||||
// <https://wordpress.org/support/topic/jquery-comes-up-in-feed-content/#post-13110879>
|
||||
|
@ -526,16 +641,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: <https://github.com/Modernizr/Modernizr/issues/171>
|
||||
// shows "9223372036854780000" instead of 9223372036854775807 in the numbox
|
||||
// empty should be interpreted as PHP_INT_MAX, but a numbox cannot be set to empty:
|
||||
// <https://github.com/Modernizr/Modernizr/issues/171>
|
||||
// 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,
|
||||
|
|
406
class/task.php
406
class/task.php
|
@ -8,17 +8,25 @@
|
|||
*
|
||||
* Edited for v2.0.0 and following.
|
||||
*
|
||||
* 2.0.5: Autoload / infinite scroll support added thanks to code from
|
||||
* 2.0.5 Autoload / infinite scroll support added thanks to code from
|
||||
* @docteurfitness <https://wordpress.org/support/topic/auto-load-post-compatibility-update/>
|
||||
*
|
||||
* 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
|
||||
* 2.1.2: options for the other hooks 2020-11-19T1849+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
|
||||
* 2.1.2 options for the other hooks 2020-11-19T1849+0100
|
||||
* 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
|
||||
* 2.1.4 ref container column width and tooltip font size settings 2020-12-03T0954+0100
|
||||
* 2.1.4 scroll offset and duration settings 2020-12-05T0538+0100
|
||||
* 2.1.4 tooltip display duration settings 2020-12-06T1320+0100
|
||||
*
|
||||
* Last modified: 2020-11-24T0957+0100
|
||||
* Last modified: 2020-12-06T1652+0100
|
||||
*/
|
||||
|
||||
// If called directly, abort:
|
||||
|
@ -142,22 +150,86 @@ 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_bool_ColumnWidthEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED));
|
||||
$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);
|
||||
|
||||
$l_bool_ColumnMaxWidthEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED));
|
||||
$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_ColumnWidthScalar)) {
|
||||
if ($l_str_ColumnWidthUnit == '%') {
|
||||
if ($l_int_ColumnWidthScalar > 100) {
|
||||
$l_int_ColumnWidthScalar = 100;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$l_int_ColumnWidthScalar = 0;
|
||||
}
|
||||
|
||||
if (!empty($l_int_ColumnMaxWidthScalar)) {
|
||||
if ($l_str_ColumnMaxWidthUnit == '%') {
|
||||
if ($l_int_ColumnMaxWidthScalar > 100) {
|
||||
$l_int_ColumnMaxWidthScalar = 100;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$l_int_ColumnMaxWidthScalar = 0;
|
||||
}
|
||||
|
||||
?>
|
||||
<style type="text/css" media="screen">
|
||||
<style type="text/css" media="all">
|
||||
<?php
|
||||
|
||||
// display ref container on home page:
|
||||
if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE))) {
|
||||
echo "\r\n.home .footnotes_reference_container { display: none; }\r\n";
|
||||
echo ".home .footnotes_reference_container { display: none; }\r\n";
|
||||
}
|
||||
|
||||
// ref container first column width:
|
||||
if ( $l_bool_ColumnWidthEnabled || $l_bool_ColumnMaxWidthEnabled ) {
|
||||
echo ".footnote-reference-container { table-layout: fixed; }";
|
||||
echo ".footnote_plugin_index, .footnote_plugin_index_combi {";
|
||||
|
||||
if ( $l_bool_ColumnWidthEnabled ) {
|
||||
echo " width: $l_int_ColumnWidthScalar$l_str_ColumnWidthUnit !important;";
|
||||
}
|
||||
if ( $l_bool_ColumnMaxWidthEnabled ) {
|
||||
echo " max-width: $l_int_ColumnMaxWidthScalar$l_str_ColumnMaxWidthUnit !important;";
|
||||
}
|
||||
echo '}';
|
||||
}
|
||||
|
||||
// tooltip:
|
||||
echo '.footnote_tooltip {';
|
||||
|
||||
echo ' font-size: ';
|
||||
if($l_str_FontSizeEnabled) {
|
||||
echo $l_str_FontSizeScalar . $l_str_FontSizeUnit;
|
||||
} else {
|
||||
echo 'inherit';
|
||||
}
|
||||
echo ' !important;';
|
||||
|
||||
if (!empty($l_str_Color)) {
|
||||
printf(" color: %s !important;", $l_str_Color);
|
||||
}
|
||||
|
@ -443,6 +515,12 @@ class MCI_Footnotes_Task {
|
|||
// get footnote text
|
||||
$l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag));
|
||||
|
||||
// fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element,
|
||||
// to prevent them from hanging out of the tooltip in non-Unicode-compliant user agents
|
||||
// spare however values of the href argument!
|
||||
// see public.css
|
||||
$l_str_FootnoteText = preg_replace( '#(?<!href=.)(https?://[^\\s<]+)#', '<span class="footnote_url_wrap">$1</span>', $l_str_FootnoteText );
|
||||
|
||||
// Text to be displayed instead of the footnote
|
||||
$l_str_FootnoteReplaceText = "";
|
||||
|
||||
|
@ -472,44 +550,59 @@ class MCI_Footnotes_Task {
|
|||
|
||||
// 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';
|
||||
$l_str_SupSpan = 'sup';
|
||||
} else {
|
||||
$l_str_Element = 'span';
|
||||
$l_str_SupSpan = 'span';
|
||||
}
|
||||
|
||||
// determine whether the link element is used, see below in ReferenceContainer()
|
||||
$l_str_LinkSpan = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED)) ? 'a' : '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),
|
||||
"text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "",
|
||||
"post_id" => $l_int_PostId,
|
||||
"id" => $l_int_Index,
|
||||
"link-start" => $l_str_LinkSpan == 'a' ? '<a>' : '',
|
||||
"link-end" => $l_str_LinkSpan == 'a' ? '</a>' : '',
|
||||
"sup-span" => $l_str_SupSpan,
|
||||
"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),
|
||||
"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))) {
|
||||
if (
|
||||
MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) &&
|
||||
!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))
|
||||
) {
|
||||
$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));
|
||||
$l_int_FadeInDelay = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY ));
|
||||
$l_int_FadeInDuration = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ));
|
||||
$l_int_FadeOutDelay = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ));
|
||||
$l_int_FadeOutDuration = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION));
|
||||
|
||||
// fill in 'templates/public/tooltip.html':
|
||||
$l_obj_TemplateTooltip->replace(
|
||||
array(
|
||||
"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,
|
||||
"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,
|
||||
"fade-in-delay" => !empty($l_int_FadeInDelay ) ? $l_int_FadeInDelay : 0,
|
||||
"fade-in-duration" => !empty($l_int_FadeInDuration ) ? $l_int_FadeInDuration : 0,
|
||||
"fade-out-delay" => !empty($l_int_FadeOutDelay ) ? $l_int_FadeOutDelay : 0,
|
||||
"fade-out-duration" => !empty($l_int_FadeOutDuration) ? $l_int_FadeOutDuration : 0,
|
||||
)
|
||||
);
|
||||
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_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent();
|
||||
$l_obj_TemplateTooltip->reload();
|
||||
}
|
||||
}
|
||||
|
@ -544,18 +637,58 @@ class MCI_Footnotes_Task {
|
|||
*/
|
||||
public function ReferenceContainer() {
|
||||
|
||||
// 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
|
||||
// no footnotes have been replaced on this page:
|
||||
if (empty(self::$a_arr_Footnotes)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* INFINITE SCROLL / AUTOLOAD, ARCHIVE VIEW
|
||||
*
|
||||
* Multiple posts are appended to each other, functions and IDs must be disambiguated.
|
||||
* Contributed by @docteurfitness <https://wordpress.org/support/topic/auto-load-post-compatibility-update/>
|
||||
* @since 2.0.5
|
||||
*
|
||||
* post ID to make everything unique wrt infinite scroll and archive view:
|
||||
*/
|
||||
global $l_int_PostId;
|
||||
$l_int_PostId = get_the_id();
|
||||
|
||||
// FOOTNOTE INDEX BACKLINK SYMBOL
|
||||
|
||||
/**
|
||||
* OPTIONAL LINK ELEMENT FOR FOOTNOTE REFERRERS AND BACKLINKS
|
||||
*
|
||||
* STYLING:
|
||||
* Link color is preferred for referrers and backlinks.
|
||||
* Setting a global link color is a common feature in WordPress themes.
|
||||
* CSS does not support identifiers for link colors (color: link | hover | active | visited)
|
||||
* These are only supported as pseudo-classes of the link element.
|
||||
* Hence the link element must be present for styling purposes.
|
||||
* But styling these elements with the link color is not universally preferred.
|
||||
* If not, the very presence of the link elements may need to be avoided.
|
||||
*
|
||||
* FUNCTIONALITY:
|
||||
* Although widely used for that purpose, hyperlinks are disliked for footnote linking.
|
||||
* Browsers may need to be prevented from logging these clicks in the browsing history,
|
||||
* as logging compromises the usability of the 'return to previous' button in browsers.
|
||||
* For that purpose, and for scroll animation, this linking is performed by JavaScript.
|
||||
*
|
||||
* The link elements have been added and are present @since 2.0.0.
|
||||
* Then the link addresses were removed @since 2.0.4.
|
||||
* Then the presence of <a> elements was made optional
|
||||
* @since 2.1.4
|
||||
* 2020-11-25T1306+0100
|
||||
*/
|
||||
$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
|
||||
*
|
||||
* 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))) {
|
||||
|
||||
|
@ -577,32 +710,97 @@ class MCI_Footnotes_Task {
|
|||
|
||||
} else {
|
||||
|
||||
// if it is, set it to empty:
|
||||
$l_str_Arrow = "";
|
||||
$l_str_FootnoteArrow = "";
|
||||
// if it is not, set arrow to empty:
|
||||
$l_str_Arrow = '';
|
||||
$l_str_FootnoteArrow = '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// REFERENCE CONTAINER TABLE ROW TEMPLATE LOAD
|
||||
/**
|
||||
* BACKLINK SEPARATOR
|
||||
*
|
||||
* Initially a comma was appended in this algorithm for enumerations.
|
||||
* The comma in enumerations is not generally preferred.
|
||||
* @since 2.1.4 the separator is optional, has options, and is customizable:
|
||||
*/
|
||||
// check if it is even enabled:
|
||||
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED))) {
|
||||
// if so, check if it is customized:
|
||||
$l_str_Separator = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM);
|
||||
if (empty($l_str_Separator)) {
|
||||
// if it is not, check which option is on:
|
||||
$l_str_SeparatorOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION);
|
||||
switch ($l_str_SeparatorOption) {
|
||||
case 'comma' : $l_str_Separator = ','; break;
|
||||
case 'semicolon': $l_str_Separator = ';'; break;
|
||||
case 'en_dash' : $l_str_Separator = ' –'; break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$l_str_Separator = '';
|
||||
}
|
||||
|
||||
// line breaks for source readability:
|
||||
/**
|
||||
* BACKLINK TERMINATOR
|
||||
*
|
||||
* Initially a dot was appended in the table row template.
|
||||
* @since 2.0.6 a dot after footnote numbers is discarded as not localizable;
|
||||
* making it optional was envisaged.
|
||||
* @since 2.1.4 the terminator is optional, has options, and is customizable:
|
||||
*/
|
||||
// check if it is even enabled:
|
||||
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED))) {
|
||||
// if so, check if it is customized:
|
||||
$l_str_Terminator = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM);
|
||||
if (empty($l_str_Terminator)) {
|
||||
// if it is not, check which option is on:
|
||||
$l_str_TerminatorOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION);
|
||||
switch ($l_str_TerminatorOption) {
|
||||
case 'period' : $l_str_Terminator = '.'; break;
|
||||
case 'parenthesis': $l_str_Terminator = ')'; break;
|
||||
case 'colon' : $l_str_Terminator = ':'; break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$l_str_Terminator = '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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)) ? '<br />' : ' ';
|
||||
|
||||
/**
|
||||
* 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";
|
||||
|
||||
// when combine identical is turned on, another template is needed:
|
||||
|
||||
// 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))) {
|
||||
// In the combined template, identifiers only are clickable.
|
||||
// the combining template allows for backlink clusters and supports cell clicking for single notes:
|
||||
$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):
|
||||
// when 3-column layout is turned on (only available 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):
|
||||
// when switch symbol and index is turned on, and combining and 3-columns are off:
|
||||
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");
|
||||
|
||||
|
@ -615,6 +813,19 @@ class MCI_Footnotes_Task {
|
|||
}
|
||||
}
|
||||
|
||||
// SET SWITCH FLAG INDEPENDENTLY
|
||||
|
||||
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH))) {
|
||||
|
||||
$l_bool_SymbolSwitch = true;
|
||||
|
||||
} else {
|
||||
|
||||
$l_bool_SymbolSwitch = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// FILL IN THE TEMPLATE
|
||||
|
||||
// loop through all footnotes found in the page
|
||||
|
@ -632,7 +843,7 @@ class MCI_Footnotes_Task {
|
|||
|
||||
// INDEX COLUMN WITH ONE BACKLINK PER TABLE ROW
|
||||
|
||||
// Standard behavior appropriate for combine identical TURNED OFF
|
||||
// Standard behavior appropriate for combining identicals turned off
|
||||
|
||||
// generate content of footnote index cell
|
||||
$l_int_FirstFootnoteIndex = ($l_int_Index + 1);
|
||||
|
@ -643,16 +854,15 @@ class MCI_Footnotes_Task {
|
|||
|
||||
|
||||
|
||||
// SUPPORT FOR COMBINE IDENTICAL: COMPOSING ENUMERATED BACKLINKS
|
||||
|
||||
$l_str_FootnoteBacklinks = "";
|
||||
// SUPPORT FOR COMBINING IDENTICALS: COMPOSE ENUMERATED BACKLINKS
|
||||
|
||||
if ( MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) {
|
||||
|
||||
$l_str_FootnoteId = $l_str_FootnoteIndex;
|
||||
|
||||
// in case the footnote is unique:
|
||||
$l_str_FootnoteReference = '<a id="footnote_plugin_reference_';
|
||||
$l_str_FootnoteReference = "<$l_str_LinkSpan";
|
||||
$l_str_FootnoteReference .= ' id="footnote_plugin_reference_';
|
||||
$l_str_FootnoteReference .= $l_int_PostId;
|
||||
$l_str_FootnoteReference .= "_$l_str_FootnoteId\"";
|
||||
$l_str_FootnoteReference .= ' class="footnote_backlink"';
|
||||
|
@ -666,55 +876,69 @@ class MCI_Footnotes_Task {
|
|||
$l_str_FootnoteBacklinks = $l_str_FootnoteReference;
|
||||
$l_str_FootnoteBacklinks .= $l_str_BacklinkEvent;
|
||||
|
||||
// finish both single note and notes cluster:
|
||||
$l_str_FootnoteReference .= ">$l_str_FootnoteArrow$l_str_FootnoteId</a>";
|
||||
$l_str_FootnoteBacklinks .= ">$l_str_FootnoteArrow$l_str_FootnoteId</a>";
|
||||
// continue both single note and notes cluster, depending on switch option status:
|
||||
if ($l_bool_SymbolSwitch) {
|
||||
|
||||
// If that is the only footnote with this text, we’re done.
|
||||
$l_str_FootnoteReference .= ">$l_str_FootnoteId$l_str_FootnoteArrow";
|
||||
$l_str_FootnoteBacklinks .= ">$l_str_FootnoteId$l_str_FootnoteArrow";
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$l_str_FootnoteReference .= ">$l_str_FootnoteArrow$l_str_FootnoteId";
|
||||
$l_str_FootnoteBacklinks .= ">$l_str_FootnoteArrow$l_str_FootnoteId";
|
||||
|
||||
}
|
||||
// If that is the only footnote with this text, we’re nearly 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))) {
|
||||
// check if it isn't the last footnote in the array:
|
||||
if ($l_int_FirstFootnoteIndex < count(self::$a_arr_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++) {
|
||||
// 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]) {
|
||||
// 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] = "";
|
||||
// if so, set the further footnote as empty so it won't be displayed later:
|
||||
self::$a_arr_Footnotes[$l_int_CheckIndex] = "";
|
||||
|
||||
// cancel the event altogether:
|
||||
$l_str_BacklinkEvent = "";
|
||||
// cancel the event altogether:
|
||||
$l_str_BacklinkEvent = "";
|
||||
|
||||
|
||||
// HERE GOES THE FRAGMENT IDENTIFIER AND THE BACKLINK TOO:
|
||||
// add the footnote index to the actual index:
|
||||
// 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));
|
||||
// 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));
|
||||
|
||||
// resume composing the backlinks enumeration:
|
||||
$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_FootnoteId</a>";
|
||||
|
||||
// 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));
|
||||
// resume composing the backlinks enumeration:
|
||||
$l_str_FootnoteBacklinks .= "$l_str_Separator</$l_str_LinkSpan>";
|
||||
$l_str_FootnoteBacklinks .= "$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";
|
||||
$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_bool_SymbolSwitch ? '' : $l_str_FootnoteArrow;
|
||||
$l_str_FootnoteBacklinks .= $l_str_FootnoteId;
|
||||
$l_str_FootnoteBacklinks .= $l_bool_SymbolSwitch ? $l_str_FootnoteArrow : '';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$l_str_FootnoteReference .= "$l_str_Terminator</$l_str_LinkSpan>";
|
||||
$l_str_FootnoteBacklinks .= "$l_str_Terminator</$l_str_LinkSpan>";
|
||||
|
||||
}
|
||||
|
||||
// line wrapping of URLs already fixed, see:
|
||||
// $l_str_FootnoteText = preg_replace( '#(?<!href=.)(https?://[^\\s<]+)#', '<span class="footnote_url_wrap">$1</span>', $l_str_FootnoteText );
|
||||
|
||||
// replace all placeholders in 'templates/public/reference-container-body.html'
|
||||
// or in 'templates/public/reference-container-body-combi.html'
|
||||
// or in 'templates/public/reference-container-body-3column.html'
|
||||
|
@ -727,6 +951,10 @@ 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)),
|
||||
"link-start" => $l_str_LinkSpan == 'a' ? '<a>' : '',
|
||||
"link-end" => $l_str_LinkSpan == 'a' ? '</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',
|
||||
|
@ -741,22 +969,28 @@ class MCI_Footnotes_Task {
|
|||
|
||||
$l_str_Body .= $l_obj_Template->getContent();
|
||||
|
||||
// extra line breaks for page source legibility:
|
||||
// extra line breaks for page source readability:
|
||||
$l_str_Body .= "\r\n\r\n";
|
||||
|
||||
$l_obj_Template->reload();
|
||||
|
||||
}
|
||||
|
||||
// get scroll offset and duration settings:
|
||||
$l_int_ScrollOffset = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET);
|
||||
$l_int_ScrollDuration = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION);
|
||||
|
||||
// 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,
|
||||
"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,
|
||||
"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,
|
||||
"scroll-offset" => ($l_int_ScrollOffset / 100),
|
||||
"scroll-duration" => $l_int_ScrollDuration,
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Reference in a new issue