for Bugfix release 2.0.6 rolling back priority fix

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2412164 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2020-11-04 04:15:49 +00:00
parent ddb568805b
commit 9d5dc4f28a
10 changed files with 519 additions and 471 deletions

View file

@ -12,7 +12,7 @@
* Edited for v2.0.3: Added style sheet versioning 2020-10-29T1413+0100
* Edited for v2.0.4: Added jQuery UI from WordPress 2020-11-01T1902+0100
*
* Last modified: 2020-11-02T2003+0100
* Last modified: 2020-11-03T1622+0100
*/
@ -126,6 +126,6 @@ class MCI_Footnotes {
wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__));
// IMPORTANT: up-to-date plugin version number for cache busting.
wp_enqueue_style('mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', '2.0.5');
wp_enqueue_style('mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', '2.0.6');
}
}

View file

@ -6,7 +6,7 @@
* @author Stefan Herndler
* @since 1.5.0 14.09.14 10:43
*
* Edited for v2.0.4 2020-11-01T0333+0100
* Edited for v2.0.4 2020-11-02T2115+0100
*/
@ -20,104 +20,104 @@
*/
class MCI_Footnotes_Settings {
/**
* Settings Container Key for the label of the reference container.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_REFERENCE_CONTAINER_NAME = "footnote_inputfield_references_label";
/**
* Settings Container Key for the label of the reference container.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_REFERENCE_CONTAINER_NAME = "footnote_inputfield_references_label";
/**
* Settings Container Key to collapse the reference container by default.
*
* @author Stefan Herndler
* @since 1.5.0
* @var bool
*/
const C_BOOL_REFERENCE_CONTAINER_COLLAPSE = "footnote_inputfield_collapse_references";
/**
* Settings Container Key to collapse the reference container by default.
*
* @author Stefan Herndler
* @since 1.5.0
* @var bool
*/
const C_BOOL_REFERENCE_CONTAINER_COLLAPSE = "footnote_inputfield_collapse_references";
/**
* Settings Container Key for the positioning of the reference container.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_REFERENCE_CONTAINER_POSITION = "footnote_inputfield_reference_container_place";
/**
* Settings Container Key for the positioning of the reference container.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_REFERENCE_CONTAINER_POSITION = "footnote_inputfield_reference_container_place";
/**
* Settings Container Key to combine identical footnotes.
*
* @author Stefan Herndler
* @since 1.5.0
* @var bool
*/
const C_BOOL_COMBINE_IDENTICAL_FOOTNOTES = "footnote_inputfield_combine_identical";
/**
* Settings Container Key to combine identical footnotes.
*
* @author Stefan Herndler
* @since 1.5.0
* @var bool
*/
const C_BOOL_COMBINE_IDENTICAL_FOOTNOTES = "footnote_inputfield_combine_identical";
/**
* Settings Container Key for the start of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_START = "footnote_inputfield_placeholder_start";
/**
* Settings Container Key for the start of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_START = "footnote_inputfield_placeholder_start";
/**
* Settings Container Key for the end of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_END = "footnote_inputfield_placeholder_end";
/**
* Settings Container Key for the end of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_END = "footnote_inputfield_placeholder_end";
/**
* Settings Container Key for the user defined start of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED = "footnote_inputfield_placeholder_start_user_defined";
/**
* Settings Container Key for the user defined start of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED = "footnote_inputfield_placeholder_start_user_defined";
/**
* Settings Container Key for the user defined end of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED = "footnote_inputfield_placeholder_end_user_defined";
/**
* Settings Container Key for the user defined end of the footnotes short code.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED = "footnote_inputfield_placeholder_end_user_defined";
/**
* Settings Container Key for the counter style of the footnotes.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_COUNTER_STYLE = "footnote_inputfield_counter_style";
/**
* Settings Container Key for the counter style of the footnotes.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_COUNTER_STYLE = "footnote_inputfield_counter_style";
/**
* Settings Container Key for the 'I love footnotes' text.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_LOVE = "footnote_inputfield_love";
/**
* Settings Container Key for the 'I love footnotes' text.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_LOVE = "footnote_inputfield_love";
/**
* Settings Container Key to look for footnotes in post excerpts.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_BOOL_FOOTNOTES_IN_EXCERPT = "footnote_inputfield_search_in_excerpt";
/**
* Settings Container Key to look for footnotes in post excerpts.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_BOOL_FOOTNOTES_IN_EXCERPT = "footnote_inputfield_search_in_excerpt";
/**
* Settings Container Key for the Expert mode.
@ -128,32 +128,32 @@ class MCI_Footnotes_Settings {
*/
const C_BOOL_FOOTNOTES_EXPERT_MODE = "footnote_inputfield_enable_expert_mode";
/**
* Settings Container Key for the styling before the footnotes index.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_STYLING_BEFORE = "footnote_inputfield_custom_styling_before";
/**
* Settings Container Key for the styling before the footnotes index.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_STYLING_BEFORE = "footnote_inputfield_custom_styling_before";
/**
* Settings Container Key for the styling after the footnotes index.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_STYLING_AFTER = "footnote_inputfield_custom_styling_after";
/**
* Settings Container Key for the styling after the footnotes index.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_FOOTNOTES_STYLING_AFTER = "footnote_inputfield_custom_styling_after";
/**
* Settings Container Key for the mouse-over box to be enabled.
*
* @author Stefan Herndler
* @since 1.5.2
* @var string
*/
const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED = "footnote_inputfield_custom_mouse_over_box_enabled";
/**
* Settings Container Key for the mouse-over box to be enabled.
*
* @author Stefan Herndler
* @since 1.5.2
* @var string
*/
const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED = "footnote_inputfield_custom_mouse_over_box_enabled";
/**
* Settings Container Key for the mouse-over box to display only an excerpt.
@ -173,32 +173,32 @@ class MCI_Footnotes_Settings {
*/
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH = "footnote_inputfield_custom_mouse_over_box_excerpt_length";
/**
* Settings Container Key for the mouse-over box to define the positioning.
*
* @author Stefan Herndler
* @since 1.5.7
* @var string
*/
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION = "footnote_inputfield_custom_mouse_over_box_position";
/**
* Settings Container Key for the mouse-over box to define the positioning.
*
* @author Stefan Herndler
* @since 1.5.7
* @var string
*/
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION = "footnote_inputfield_custom_mouse_over_box_position";
/**
* Settings Container Key for the mouse-over box to define the offset (x).
*
* @author Stefan Herndler
* @since 1.5.7
* @var string
*/
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X = "footnote_inputfield_custom_mouse_over_box_offset_x";
/**
* Settings Container Key for the mouse-over box to define the offset (x).
*
* @author Stefan Herndler
* @since 1.5.7
* @var string
*/
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X = "footnote_inputfield_custom_mouse_over_box_offset_x";
/**
* Settings Container Key for the mouse-over box to define the offset (y).
*
* @author Stefan Herndler
* @since 1.5.7
* @var string
*/
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y = "footnote_inputfield_custom_mouse_over_box_offset_y";
/**
* Settings Container Key for the mouse-over box to define the offset (y).
*
* @author Stefan Herndler
* @since 1.5.7
* @var string
*/
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y = "footnote_inputfield_custom_mouse_over_box_offset_y";
/**
* Settings Container Key for the mouse-over box to define the color.
@ -254,41 +254,41 @@ class MCI_Footnotes_Settings {
*/
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH = "footnote_inputfield_custom_mouse_over_box_max_width";
/**
* Settings Container Key for the mouse-over box to define the box-shadow color.
*
* @author Stefan Herndler
* @since 1.5.8
* @var string
*/
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR = "footnote_inputfield_custom_mouse_over_box_shadow_color";
/**
* Settings Container Key for the mouse-over box to define the box-shadow color.
*
* @author Stefan Herndler
* @since 1.5.8
* @var string
*/
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR = "footnote_inputfield_custom_mouse_over_box_shadow_color";
/**
* Settings Container Key for the Hyperlink arrow.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_HYPERLINK_ARROW = "footnote_inputfield_custom_hyperlink_symbol";
/**
* Settings Container Key for the Hyperlink arrow.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_HYPERLINK_ARROW = "footnote_inputfield_custom_hyperlink_symbol";
/**
* Settings Container Key for the user defined Hyperlink arrow.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_HYPERLINK_ARROW_USER_DEFINED = "footnote_inputfield_custom_hyperlink_symbol_user";
/**
* Settings Container Key for the user defined Hyperlink arrow.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_HYPERLINK_ARROW_USER_DEFINED = "footnote_inputfield_custom_hyperlink_symbol_user";
/**
* Settings Container Key for the user defined styling.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_CUSTOM_CSS = "footnote_inputfield_custom_css";
/**
* Settings Container Key for the user defined styling.
*
* @author Stefan Herndler
* @since 1.5.0
* @var string
*/
const C_STR_CUSTOM_CSS = "footnote_inputfield_custom_css";
/**
* Settings Container Key the activation of the_title hook.
@ -344,71 +344,71 @@ class MCI_Footnotes_Settings {
*/
const C_BOOL_EXPERT_LOOKUP_THE_POST = "footnote_inputfield_expert_lookup_the_post";
/**
* Stores a singleton reference of this class.
*
* @author Stefan Herndler
* @since 1.5.0
* @var MCI_Footnotes_Settings
*/
private static $a_obj_Instance = null;
/**
* Stores a singleton reference of this class.
*
* @author Stefan Herndler
* @since 1.5.0
* @var MCI_Footnotes_Settings
*/
private static $a_obj_Instance = null;
/**
* Contains all Settings Container names.
*
* @author Stefan Herndler
* @since 1.5.0
* @var array
*/
private $a_arr_Container = array("footnotes_storage", "footnotes_storage_custom", "footnotes_storage_expert");
/**
* Contains all Settings Container names.
*
* @author Stefan Herndler
* @since 1.5.0
* @var array
*/
private $a_arr_Container = array("footnotes_storage", "footnotes_storage_custom", "footnotes_storage_expert");
/**
* Contains all Default Settings for each Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
* @var array
*/
private $a_arr_Default = array(
"footnotes_storage" => array(
self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => '',
self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
// Identical footnotes should not be combined by default
// as long as the feature raises criticism for malfunctioning:
// <https://wordpress.org/support/topic/too-many-errors-18/>
self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => '',
self::C_STR_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',
self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'yes',
/**
* Contains all Default Settings for each Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
* @var array
*/
private $a_arr_Default = array(
"footnotes_storage" => array(
self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => '',
self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
// Identical footnotes should not be combined by default
// as long as the feature raises criticism for malfunctioning:
// <https://wordpress.org/support/topic/too-many-errors-18/>
self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => '',
self::C_STR_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',
self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'yes',
self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'no'
),
"footnotes_storage_custom" => array(
self::C_STR_FOOTNOTES_STYLING_BEFORE => '',
self::C_STR_FOOTNOTES_STYLING_AFTER => ')',
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
),
"footnotes_storage_custom" => array(
self::C_STR_FOOTNOTES_STYLING_BEFORE => '',
self::C_STR_FOOTNOTES_STYLING_AFTER => ')',
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'no',
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 150,
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top right',
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 10,
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => 10,
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top right',
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 10,
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => 10,
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '',
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#fff7a7',
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1,
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99',
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 3,
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 0,
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666',
self::C_STR_HYPERLINK_ARROW => '&#8593;',
self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
self::C_STR_CUSTOM_CSS => ''
),
// These should all be enabled by default.
// See <https://wordpress.org/support/topic/more-feature-ideas/>
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666',
self::C_STR_HYPERLINK_ARROW => '&#8593;',
self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
self::C_STR_CUSTOM_CSS => ''
),
// These should all be enabled by default.
// See <https://wordpress.org/support/topic/more-feature-ideas/>
"footnotes_storage_expert" => array(
self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => 'yes',
self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'yes',
@ -417,54 +417,54 @@ class MCI_Footnotes_Settings {
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_THE_POST => 'yes'
)
);
);
/**
* Contains all Settings from each Settings container as soon as this class is initialized.
*
* @author Stefan Herndler
* @since 1.5.0
* @var array
*/
private $a_arr_Settings = array();
/**
* Contains all Settings from each Settings container as soon as this class is initialized.
*
* @author Stefan Herndler
* @since 1.5.0
* @var array
*/
private $a_arr_Settings = array();
/**
* Class Constructor. Loads all Settings from each WordPress Settings container.
*
* @author Stefan Herndler
* @since 1.5.0
*/
private function __construct() {
$this->loadAll();
}
/**
* Class Constructor. Loads all Settings from each WordPress Settings container.
*
* @author Stefan Herndler
* @since 1.5.0
*/
private function __construct() {
$this->loadAll();
}
/**
* Returns a singleton of this class.
*
* @author Stefan Herndler
* @since 1.5.0
* @return MCI_Footnotes_Settings
*/
public static function instance() {
// no instance defined yet, load it
if (self::$a_obj_Instance === null) {
self::$a_obj_Instance = new self();
}
// return a singleton of this class
return self::$a_obj_Instance;
}
/**
* Returns a singleton of this class.
*
* @author Stefan Herndler
* @since 1.5.0
* @return MCI_Footnotes_Settings
*/
public static function instance() {
// no instance defined yet, load it
if (self::$a_obj_Instance === null) {
self::$a_obj_Instance = new self();
}
// return a singleton of this class
return self::$a_obj_Instance;
}
/**
* Returns the name of a specified Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
* @param int $p_int_Index Settings Container Array Key Index.
* @return string Settings Container name.
*/
public function getContainer($p_int_Index) {
return $this->a_arr_Container[$p_int_Index];
}
/**
* Returns the name of a specified Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
* @param int $p_int_Index Settings Container Array Key Index.
* @return string Settings Container name.
*/
public function getContainer($p_int_Index) {
return $this->a_arr_Container[$p_int_Index];
}
/**
* Returns the default values of a specific Settings Container.
@ -478,114 +478,114 @@ class MCI_Footnotes_Settings {
return $this->a_arr_Default[$this->a_arr_Container[$p_int_Index]];
}
/**
* Loads all Settings from each Settings container.
*
* @author Stefan Herndler
* @since 1.5.0
*/
private function loadAll() {
// clear current settings
$this->a_arr_Settings = array();
for ($i = 0; $i < count($this->a_arr_Container); $i++) {
// load settings
$this->a_arr_Settings = array_merge($this->a_arr_Settings, $this->Load($i));
}
}
/**
* Loads all Settings from each Settings container.
*
* @author Stefan Herndler
* @since 1.5.0
*/
private function loadAll() {
// clear current settings
$this->a_arr_Settings = array();
for ($i = 0; $i < count($this->a_arr_Container); $i++) {
// load settings
$this->a_arr_Settings = array_merge($this->a_arr_Settings, $this->Load($i));
}
}
/**
* Loads all Settings from specified Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
* @param int $p_int_Index Settings Container Array Key Index.
* @return array Settings loaded from Container of Default Settings if Settings Container is empty (first usage).
*/
private function Load($p_int_Index) {
// load all settings from container
$l_arr_Options = get_option($this->getContainer($p_int_Index));
// load all default settings
$l_arr_Default = $this->a_arr_Default[$this->getContainer($p_int_Index)];
/**
* Loads all Settings from specified Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
* @param int $p_int_Index Settings Container Array Key Index.
* @return array Settings loaded from Container of Default Settings if Settings Container is empty (first usage).
*/
private function Load($p_int_Index) {
// load all settings from container
$l_arr_Options = get_option($this->getContainer($p_int_Index));
// load all default settings
$l_arr_Default = $this->a_arr_Default[$this->getContainer($p_int_Index)];
// no settings found, set them to their default value
if (empty($l_arr_Options)) {
return $l_arr_Default;
}
// iterate through all available settings ( = default values)
foreach($l_arr_Default as $l_str_Key => $l_str_Value) {
// available setting not found in the container
if (!array_key_exists($l_str_Key, $l_arr_Options)) {
// define the setting with its default value
$l_arr_Options[$l_str_Key] = $l_str_Value;
}
}
// iterate through each setting in the container
foreach($l_arr_Options as $l_str_Key => $l_str_Value) {
// remove all whitespace at the beginning and end of a setting
//$l_str_Value = trim($l_str_Value);
// write the sanitized value back to the setting container
$l_arr_Options[$l_str_Key] = $l_str_Value;
}
// return settings loaded from Container
return $l_arr_Options;
}
// no settings found, set them to their default value
if (empty($l_arr_Options)) {
return $l_arr_Default;
}
// iterate through all available settings ( = default values)
foreach($l_arr_Default as $l_str_Key => $l_str_Value) {
// available setting not found in the container
if (!array_key_exists($l_str_Key, $l_arr_Options)) {
// define the setting with its default value
$l_arr_Options[$l_str_Key] = $l_str_Value;
}
}
// iterate through each setting in the container
foreach($l_arr_Options as $l_str_Key => $l_str_Value) {
// remove all whitespace at the beginning and end of a setting
//$l_str_Value = trim($l_str_Value);
// write the sanitized value back to the setting container
$l_arr_Options[$l_str_Key] = $l_str_Value;
}
// return settings loaded from Container
return $l_arr_Options;
}
/**
* Updates a whole Settings container.
*
* @author Stefan Herndler
* @since 1.5.0
* @param int $p_int_Index Index of the Settings container.
* @param array $p_arr_newValues new Settings.
* @return bool
*/
public function saveOptions($p_int_Index, $p_arr_newValues) {
if (update_option($this->getContainer($p_int_Index), $p_arr_newValues)) {
$this->loadAll();
return true;
}
return false;
}
/**
* Updates a whole Settings container.
*
* @author Stefan Herndler
* @since 1.5.0
* @param int $p_int_Index Index of the Settings container.
* @param array $p_arr_newValues new Settings.
* @return bool
*/
public function saveOptions($p_int_Index, $p_arr_newValues) {
if (update_option($this->getContainer($p_int_Index), $p_arr_newValues)) {
$this->loadAll();
return true;
}
return false;
}
/**
* Returns the value of specified Settings name.
*
* @author Stefan Herndler
* @since 1.5.0
* @param string $p_str_Key Settings Array Key name.
* @return mixed Value of the Setting on Success or Null in Settings name is invalid.
*/
public function get($p_str_Key) {
return array_key_exists($p_str_Key, $this->a_arr_Settings) ? $this->a_arr_Settings[$p_str_Key] : null;
}
/**
* Returns the value of specified Settings name.
*
* @author Stefan Herndler
* @since 1.5.0
* @param string $p_str_Key Settings Array Key name.
* @return mixed Value of the Setting on Success or Null in Settings name is invalid.
*/
public function get($p_str_Key) {
return array_key_exists($p_str_Key, $this->a_arr_Settings) ? $this->a_arr_Settings[$p_str_Key] : null;
}
/**
* Deletes each Settings Container and loads the default values for each Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function ClearAll() {
// iterate through each Settings Container
for ($i = 0; $i < count($this->a_arr_Container); $i++) {
// delete the settings container
delete_option($this->getContainer($i));
}
// set settings back to the default values
$this->a_arr_Settings = $this->a_arr_Default;
}
/**
* Deletes each Settings Container and loads the default values for each Settings Container.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function ClearAll() {
// iterate through each Settings Container
for ($i = 0; $i < count($this->a_arr_Container); $i++) {
// delete the settings container
delete_option($this->getContainer($i));
}
// set settings back to the default values
$this->a_arr_Settings = $this->a_arr_Default;
}
/**
* Register all Settings Container for the Plugin Settings Page in the Dashboard.
* Settings Container Label will be the same as the Settings Container Name.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function RegisterSettings() {
// register all settings
for ($i = 0; $i < count($this->a_arr_Container); $i++) {
register_setting($this->getContainer($i), $this->getContainer($i));
}
}
/**
* Register all Settings Container for the Plugin Settings Page in the Dashboard.
* Settings Container Label will be the same as the Settings Container Name.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function RegisterSettings() {
// register all settings
for ($i = 0; $i < count($this->a_arr_Container); $i++) {
register_setting($this->getContainer($i), $this->getContainer($i));
}
}
}

View file

@ -8,7 +8,7 @@
*
* Edited for v2.0.0 and following.
*
* Last modified 2020-11-02T1147+0100
* Last modified 2020-11-04T0505+0100
*/
// If called directly, abort:
@ -56,38 +56,44 @@ class MCI_Footnotes_Task {
* @since 1.5.0
*
* Edited for v2.0.5 2020-11-02T0330+0100
* Edited for v2.0.6 2020-11-04T0504+0100
*
* Explicitly set all priority to default "10" instead of lowest "PHP_INT_MAX",
* especially for the_content, or footnotes wont display beneath the content but
* below other features added by other plugins.
* 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.
* Although the default, 10 seems to suffice.
* Requested by users: <https://wordpress.org/support/topic/change-the-position-5/>
* Documentation: <https://codex.wordpress.org/Plugin_API/#Hook_in_your_Filter>
*
* Still need to assess priority levels, see bug reported in:
* <https://wordpress.org/support/topic/change-the-position-5/#post-13612697>
*
* Rolled back in v2.0.6.
*/
public function registerHooks() {
// append custom css to the header
add_filter('wp_head', array($this, "wp_head"), 10);
add_filter('wp_head', array($this, "wp_head"),PHP_INT_MAX);
// append the love and share me slug to the footer
add_filter('wp_footer', array($this, "wp_footer"), 10);
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"), 10);
add_filter('the_title', array($this, "the_title"),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"), 10);
add_filter('the_content', array($this, "the_content"),PHP_INT_MAX);
}
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"), 10);
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"), 10);
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"), 10);
add_filter('widget_text', array($this, "widget_text"),PHP_INT_MAX);
}
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST))) {
add_filter('the_post', array($this, "the_post"), 10);
add_filter('the_post', array($this, "the_post"),PHP_INT_MAX);
}
// reset stored footnotes when displaying the header
self::$a_arr_Footnotes = array();
@ -443,6 +449,11 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler
* @since 1.5.0
* @return string
*
* Edited for v2.0.6: appended post ID to support autoload / infinite scroll.
* Requested by @docteurfitness: <https://wordpress.org/support/topic/auto-load-post-compatibility-update/>
* Related request: <https://wordpress.org/support/topic/infinite-scroll-does-not-work-anymore-in-wp-5-5/>
* 2020-11-04T0358+0100
*/
public function ReferenceContainer() {
// no footnotes has been replaced on this page
@ -512,7 +523,7 @@ class MCI_Footnotes_Task {
array(
"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;' : '',
"id" => "footnote_references_container",
"id" => "footnote_references_container_" . get_the_id(),
"style" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '',
"content" => $l_str_Body
)

View file

@ -4,9 +4,9 @@
* Created-Date: 15.05.14
* Created-Time: 16:21
* Since: 1.0
* Version: 2.0.5
* Version: 2.0.6
*
* Last modified: 2020-11-02T2050+0100
* Last modified: 2020-11-04T0437+0100
*/
@ -38,9 +38,6 @@
*/
.footnote_plugin_tooltip_text {
vertical-align: top !important;
position: relative !important;
top: 0.6em !important;
cursor: pointer;
z-index: 1;
}
@ -74,11 +71,6 @@ span.footnote_tooltip {
/* Footnotes reference container
*/
.footnote-reference-container {
width: 100%;
border: none;
}
/* label */
.footnote_container_prepare {
display: block !important;
@ -118,19 +110,29 @@ span.footnote_tooltip {
color: #008800;
}
/* footnotes */
/* Table starts here */
.footnote-reference-container {
width: 100%;
border: none;
}
/* footnotes
* class footnote_plugin_link is for backcompat.
* Used in reference-container-body.html
* See <https://wordpress.org/support/topic/change-the-position-5/#post-13617988>
.footnote_plugin_link, */
.footnote_plugin_index,
.footnote_plugin_text {
border:none !important;
text-align: left;
vertical-align: top;
padding: 10px 3px 5px 0;
text-align: left !important;
vertical-align: top !important;
padding: 10px 5px 5px 0 !important;
}
.footnote_plugin_index a,
.footnote_plugin_text a {
text-decoration: none;
text-decoration: none !important;
}
.footnote_plugin_index a:hover,
.footnote_plugin_index:hover,
.footnote_plugin_text a:hover {
text-decoration: underline !important;
}
@ -141,41 +143,34 @@ span.footnote_tooltip {
word-wrap: normal !important;
word-break: unset;
word-break: keep-all !important;
white-space: nowrap;
max-width: 140px;
width: 1px; /*auto-extending column to fit widest*/
white-space: nowrap;
overflow: hidden;
}
.footnote_plugin_text {
width: unset; /*unset width of text column to fix site issues*/
}
/* Responsive*/
@media only screen and (max-width: 768px) {
.footnote_plugin_index {
max-width: 100px;
}
}
.footnote_plugin_text {
width: unset; /*unset width of text column to fix site issues*/
}
/* Footnotes printing style rules
*
* Printing a table, browsers tend to avoid page breaks,
* but it takes a wrapper to avoid a page break before the table
* but it takes a wrapper to avoid a page break before the table.
*
* UI elements (button, arrows) and link styling are removed.
*/
.footnote_container_overall_wrapper {
page-break-inside: avoid;
}
.footnote_container_prepare {
page-break-after: avoid;
}
table.footnote_reference_container td {
display: block;
}
table.footnote_reference_container {
page-break-before: avoid;
page-break-inside: auto;
}
table.footnote_reference_container tr {
page-break-before: auto;
}
@media print {
.footnote_tooltip,
.footnote_reference_container_collapse_button_outfit,
@ -189,7 +184,7 @@ table.footnote_reference_container tr {
color: inherit;
text-decoration: none !important;
}
div.post-meta-edit-link-wrapper { /*hides the Edit button in WP2020*/
div.post-meta-edit-link-wrapper { /* Edit button in WP2020*/
display: none; /*(added as a service)*/
}
}

View file

@ -4,7 +4,7 @@
Plugin URI: https://wordpress.org/plugins/footnotes/
Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
Author: Mark Cheret
Version: 2.0.5
Version: 2.0.6
Author URI: http://cheret.de/plugins/footnotes-2/
Text Domain: footnotes
Domain Path: /languages

View file

@ -4,7 +4,7 @@ Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, referen
Requires at least: 3.9
Tested up to: 5.5
Requires PHP: 5.6
Stable Tag: 2.0.5
Stable Tag: 2.0.6
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -80,7 +80,15 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog ==
= 2.0.6 =
- Bugfix: Rolled back priority fix at the expense of reference container position
- Bugfix: Support for infinite scroll / autoload
- Bugfix: Public style sheet: Footnote referrers: deleted vertical align tweaks for cross-theme and user agent compatibility
- Bugfix: Public style sheet: Reference container: auto-extending column to fit widest, to fix display with short note texts
- Bugfix: Public style sheet: Reference container: IDs: slightly increased left padding
= 2.0.5 =
- Bugfix: Layout: Fixed reference container position through priority level (10)
- Bugfix: Input boxes on public pages
- Bugfix: Get references container close to content, not below all other features
- Bugfix: Public style sheet: Reference container: unset width of text column to fix site issues

View file

@ -1,2 +1,13 @@
<a><sup id="footnote_plugin_tooltip_[[id]]" class="footnote_plugin_tooltip_text" onclick="footnote_moveToAnchor('footnote_plugin_reference_[[id]]');">[[before]][[index]][[after]]</sup></a>
<span class="footnote_tooltip" id="footnote_plugin_tooltip_text_[[id]]">[[text]]</span>
<a
><sup
id="footnote_plugin_tooltip_[[id]]"
class="footnote_plugin_tooltip_text"
onclick="footnote_moveToAnchor('footnote_plugin_reference_[[id]]');"
>[[before]][[index]][[after]]</sup
></a
>
<span
class="footnote_tooltip"
id="footnote_plugin_tooltip_text_[[id]]"
>[[text]]</span
>

View file

@ -1,4 +1,15 @@
<tr>
<td class="footnote_plugin_index" id="footnote_plugin_reference_[[id]]" onclick="footnote_moveToAnchor('footnote_plugin_tooltip_[[id]]');"><a><span class="footnote_plugin_index_arrow">[[arrow]]&#x200A;</span>[[index]].</a></td>
<td class="footnote_plugin_text">[[text]]</td>
<td
class="footnote_plugin_index footnote_plugin_link"
id="footnote_plugin_reference_[[id]]"
onclick="footnote_moveToAnchor('footnote_plugin_tooltip_[[id]]');"
><a
><span
class="footnote_plugin_index_arrow"
>[[arrow]]&#x200A;</span
>[[index]].</a
></td>
<td
class="footnote_plugin_text"
>[[text]]</td>
</tr>

View file

@ -1,47 +1,47 @@
<div class="footnote_container_overall_wrapper">
<div class="footnote_container_prepare">
<p><span
onclick="footnote_expand_reference_container();"
>[[label]]</span><span
class="footnote_reference_container_collapse_button_outfit"
style="[[button-style]]"
>&nbsp;&nbsp;&nbsp;[ <a
id="footnote_reference_container_collapse_button"
onclick="footnote_expand_collapse_reference_container();"
>+</a> ]</span></p>
</div>
<div id="[[id]]" style="[[style]]">
<table class="footnote-reference-container">
<tbody>
[[content]]
</tbody>
</table>
</div>
<div class="footnote_container_prepare">
<p><span
onclick="footnote_expand_reference_container();"
>[[label]]</span><span
class="footnote_reference_container_collapse_button_outfit"
style="[[button-style]]"
>&nbsp;&nbsp;&nbsp;[ <a
id="footnote_reference_container_collapse_button"
onclick="footnote_expand_collapse_reference_container();"
>+</a> ]</span></p>
</div>
<div id="[[id]]" style="[[style]]">
<table class="footnote-reference-container">
<tbody>
[[content]]
</tbody>
</table>
</div>
</div>
<script type="text/javascript">
function footnote_expand_reference_container() {
jQuery('#[[id]]').show();
jQuery('#footnote_reference_container_collapse_button').text('-');
}
function footnote_collapse_reference_container() {
jQuery('#[[id]]').hide();
jQuery('#footnote_reference_container_collapse_button').text('+');
}
function footnote_expand_collapse_reference_container() {
if (jQuery('#[[id]]').is(':hidden')) {
footnote_expand_reference_container();
} else {
footnote_collapse_reference_container();
}
}
function footnote_moveToAnchor(p_str_TargetID) {
footnote_expand_reference_container();
var l_obj_Target = jQuery('#' + p_str_TargetID);
if (l_obj_Target.length) {
jQuery('html, body').animate({
scrollTop: l_obj_Target.offset().top - window.innerHeight * 0.12
},
80);
}
}
function footnote_expand_reference_container() {
jQuery('#[[id]]').show();
jQuery('#footnote_reference_container_collapse_button').text('-');
}
function footnote_collapse_reference_container() {
jQuery('#[[id]]').hide();
jQuery('#footnote_reference_container_collapse_button').text('+');
}
function footnote_expand_collapse_reference_container() {
if (jQuery('#[[id]]').is(':hidden')) {
footnote_expand_reference_container();
} else {
footnote_collapse_reference_container();
}
}
function footnote_moveToAnchor(p_str_TargetID) {
footnote_expand_reference_container();
var l_obj_Target = jQuery('#' + p_str_TargetID);
if (l_obj_Target.length) {
jQuery('html, body').animate({
scrollTop: l_obj_Target.offset().top - window.innerHeight * 0.12
},
80);
}
}
</script>

View file

@ -1 +1,13 @@
<script type="text/javascript"> jQuery("#footnote_plugin_tooltip_[[id]]").tooltip({ tip: "#footnote_plugin_tooltip_text_[[id]]", tipClass: "footnote_tooltip", effect: "fade", predelay: 800, fadeInSpeed: 200, fadeOutSpeed: 2000, position: "[[position]]", relative: true, offset: [[[offset-y]], [[offset-x]]] }); </script>
<script type="text/javascript">
jQuery('#footnote_plugin_tooltip_[[id]]').tooltip({
tip: '#footnote_plugin_tooltip_text_[[id]]',
tipClass: 'footnote_tooltip',
effect: 'fade',
predelay: 800,
fadeInSpeed: 200,
fadeOutSpeed: 2000,
position: '[[position]]',
relative: true,
offset: [[[offset - y]], [[offset - x]]],
});
</script>