Wasn’t actually rolled out! So, 2.1.2 gets deleted; wasn’t ready, BTW… Waiting for 2.2.0 to complete!

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2421833 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2020-11-19 20:34:45 +00:00
parent ef544eb760
commit 0520655f1c
11 changed files with 79 additions and 173 deletions

View file

@ -64,35 +64,27 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler
* @since 1.5.0
*
* Edited for:
* 2.0.5 through v2.0.7 changes to priority 2020-11-02T0330+0100..2020-11-06T1344+0100
* 2.2.0 add settings for all hooks 2020-11-19T1248+0100
* Edited for v2.0.5 through v2.0.7 2020-11-02T0330+0100..2020-11-06T1344+0100
*
* Explicitly setting the_content priority to "10" instead of lowest "PHP_INT_MAX",
* makes the footnotes reference container display beneath the post and above other
* features added by other plugins, e.g. related post lists and social buttons.
* Explicitly setting all priority to (default) "10" instead of lowest "PHP_INT_MAX",
* especially for the_content, makes the footnotes reference container display
* beneath the content and above other features added by other plugins.
* Requested by users: <https://wordpress.org/support/topic/change-the-position-5/>
* Documentation: <https://codex.wordpress.org/Plugin_API/#Hook_in_your_Filter>
*
* Default remains PHP_INT_MAX.
* PHP_INT_MAX can be reset by leaving the number box empty.
*
* But this change is suspected to cause issues and needs to be assessed!
* See <https://wordpress.org/support/topic/change-the-position-5/#post-13612697>
*/
public function registerHooks() {
// get values from settings:
$p_int_TheTitlePriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL));
$p_int_TheContentPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL));
$p_int_TheExcerptPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL));
$p_int_WidgetTitlePriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL));
$p_int_WidgetTextPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL));
// PHP_INT_MAX can be set leaving the input field empty:
$p_int_TheTitlePriority = !empty($p_int_TheTitlePriority ) ? $p_int_TheTitlePriority : PHP_INT_MAX;
$p_int_TheContentPriority = !empty($p_int_TheContentPriority ) ? $p_int_TheContentPriority : PHP_INT_MAX;
$p_int_TheExcerptPriority = !empty($p_int_TheExcerptPriority ) ? $p_int_TheExcerptPriority : PHP_INT_MAX;
$p_int_WidgetTitlePriority = !empty($p_int_WidgetTitlePriority) ? $p_int_WidgetTitlePriority : PHP_INT_MAX;
$p_int_WidgetTextPriority = !empty($p_int_WidgetTextPriority ) ? $p_int_WidgetTextPriority : PHP_INT_MAX;
// first compute values from settings:
// for now only the_content is supported for customization:
$p_int_TheContentPriority = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL);
// PHP_INT_MAX can be set using the value -1:
if ( $p_int_TheContentPriority == -1 ) {
$p_int_TheContentPriority = PHP_INT_MAX;
}
// append custom css to the header
add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX);
@ -101,30 +93,25 @@ class MCI_Footnotes_Task {
add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX);
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE))) {
add_filter('the_title', array($this, "the_title"), $p_int_TheTitlePriority);
add_filter('the_title', array($this, "the_title"), PHP_INT_MAX);
}
// custom priority level for reference container relative positioning; default PHP_INT_MAX:
// SET PRIORITY LEVEL TO CUSTOM FOR PAGE LAYOUT; DEFAULT PHP_INT_MAX:
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT))) {
add_filter('the_content', array($this, "the_content"), $p_int_TheContentPriority);
}
}
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT))) {
add_filter('the_excerpt', array($this, "the_excerpt"), $p_int_TheExcerptPriority);
add_filter('the_excerpt', array($this, "the_excerpt"), PHP_INT_MAX);
}
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE))) {
add_filter('widget_title', array($this, "widget_title"), $p_int_WidgetTitlePriority);
add_filter('widget_title', array($this, "widget_title"), PHP_INT_MAX);
}
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT))) {
add_filter('widget_text', array($this, "widget_text"), $p_int_WidgetTextPriority);
}
// REMOVED the_post HOOK 2020-11-08T1839+0100
add_filter('widget_text', array($this, "widget_text"), PHP_INT_MAX);
}
// DISABLED the_post HOOK 2020-11-08T1839+0100
//
//
//
// reset stored footnotes when displaying the header
self::$a_arr_Footnotes = array();
self::$a_bool_AllowLoveMe = true;