stable bugfix release 2.1.2: priority level settings for all other hooks, preventing them from being zeroed at save == URGENCY
git-svn-id: https://plugins.svn.wordpress.org/footnotes/tags/2.1.2@2421553 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
362d9e60c6
commit
65668e0754
28 changed files with 1479 additions and 728 deletions
|
@ -6,7 +6,12 @@
|
|||
* @author Stefan Herndler
|
||||
* @since 1.5.0 14.09.14 14:47
|
||||
*
|
||||
* Edited for v2.0.4 2020-11-01T0509+0100
|
||||
* Edited for:
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -80,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:
|
||||
|
@ -113,6 +118,11 @@ 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");
|
||||
|
@ -123,7 +133,19 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"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_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-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-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)
|
||||
|
@ -242,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)
|
||||
|
@ -270,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_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __("Enable superscript for footnote referrers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"superscript" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_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),
|
||||
|
||||
|
@ -293,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)
|
||||
|
@ -317,12 +347,18 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"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),
|
||||
|
||||
"label-alternative" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __("Use alternative tooltip implementation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_Enabled),
|
||||
|
||||
"label-activate-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __("Display only an excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"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),
|
||||
|
||||
"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),
|
||||
|
||||
|
@ -375,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
|
||||
|
@ -435,40 +473,56 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.5
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
public function lookupHooks() {
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup");
|
||||
|
||||
// replace all placeholders
|
||||
// priority level was 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>
|
||||
// define -1 as PHP_INT_MAX instead
|
||||
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
|
||||
"description" => __("The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features. Default 9223372036854775807 or -1 is lowest priority, 0 is highest. For the reference container to sit above related posts, the priority level of the_content hook may need to be at most 1200. For Footnotes to work when a glossary plugin is active, a higher priority of 1000 may be needed. Another priority level for the_content with proven efficiency is 10.", 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),
|
||||
"head-numbox" => __("Priority level", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"head-url" => __("WordPress documentation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-the-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE, "the_title"),
|
||||
"the-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE),
|
||||
"url-the-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_title",
|
||||
"priority-the-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX),
|
||||
"url-the-title" => "https://developer.wordpress.org/reference/hooks/the_title/",
|
||||
|
||||
"label-the-content" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT, "the_content"),
|
||||
"the-content" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT),
|
||||
"url-the-content" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content",
|
||||
|
||||
"priority-the-content" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
|
||||
"url-the-content" => "https://developer.wordpress.org/reference/hooks/the_content/",
|
||||
|
||||
"label-the-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT, "the_excerpt"),
|
||||
"the-excerpt" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT),
|
||||
"url-the-excerpt" => "http://codex.wordpress.org/Function_Reference/the_excerpt",
|
||||
|
||||
"priority-the-excerpt" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
|
||||
"url-the-excerpt" => "https://developer.wordpress.org/reference/functions/the_excerpt/",
|
||||
|
||||
"label-widget-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE, "widget_title"),
|
||||
"widget-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE),
|
||||
"url-widget-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title",
|
||||
|
||||
"priority-widget-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX),
|
||||
"url-widget-title" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title",
|
||||
|
||||
"label-widget-text" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT, "widget_text"),
|
||||
"widget-text" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT),
|
||||
"url-widget-text" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text",
|
||||
|
||||
"label-post-object" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST, "the_post"),
|
||||
"post-object" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST),
|
||||
"url-post-object" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_post"
|
||||
"priority-widget-text" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
|
||||
"url-widget-text" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text",
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
|
|
Reference in a new issue