2014-09-14 20:32:59 +00:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Includes the Settings class to handle all Plugin settings.
|
|
|
|
|
*
|
|
|
|
|
* @filesource
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.0 14.09.14 10:43
|
2020-11-17 02:14:21 +00:00
|
|
|
|
*
|
2020-11-06 04:04:30 +00:00
|
|
|
|
* Edited for:
|
2020-12-03 17:38:14 +00:00
|
|
|
|
* 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
|
2020-12-06 16:30:14 +00:00
|
|
|
|
* 2.1.4 more settings container keys 2020-12-03T0955+0100
|
2020-11-17 02:14:21 +00:00
|
|
|
|
*
|
2020-12-06 16:30:14 +00:00
|
|
|
|
* Last modified: 2020-12-06T1653+0100
|
2014-09-14 20:32:59 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The class loads all Settings from each WordPress Settings container.
|
2020-11-06 04:04:30 +00:00
|
|
|
|
* It a Setting is not defined yet, the default value will be used.
|
2014-09-14 20:32:59 +00:00
|
|
|
|
* Each Setting will be validated and sanitized when loaded from the container.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.0
|
|
|
|
|
*/
|
|
|
|
|
class MCI_Footnotes_Settings {
|
|
|
|
|
|
2020-11-08 21:21:24 +00:00
|
|
|
|
|
2020-11-16 20:57:15 +00:00
|
|
|
|
/**
|
2020-11-17 02:14:21 +00:00
|
|
|
|
* SETTINGS CONTAINER KEY DEFINITIONS
|
2020-11-16 20:57:15 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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 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 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 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 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 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";
|
2014-09-14 20:32:59 +00:00
|
|
|
|
|
2014-10-08 21:36:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the Expert mode.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.5
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_FOOTNOTES_EXPERT_MODE = "footnote_inputfield_enable_expert_mode";
|
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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 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";
|
2014-10-01 20:57:16 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for alternative tooltip implementation
|
|
|
|
|
*
|
2020-12-06 16:30:14 +00:00
|
|
|
|
* @since 2.1.4
|
2020-11-11 20:49:44 +00:00
|
|
|
|
* @var string
|
2020-11-17 02:14:21 +00:00
|
|
|
|
*
|
2020-11-11 20:49:44 +00:00
|
|
|
|
* 2020-11-11T1817+0100
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE = "footnote_inputfield_custom_mouse_over_box_alternative";
|
|
|
|
|
|
2014-10-07 11:32:25 +00:00
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the mouse-over box to display only an excerpt.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.4
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED = "footnote_inputfield_custom_mouse_over_box_excerpt_enabled";
|
|
|
|
|
|
|
|
|
|
/**
|
2020-11-06 04:04:30 +00:00
|
|
|
|
* Settings Container Key for the mouse-over box to define the max. length of the enabled excerpt.
|
2014-10-07 11:32:25 +00:00
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.4
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH = "footnote_inputfield_custom_mouse_over_box_excerpt_length";
|
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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 (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";
|
2014-10-13 17:06:54 +00:00
|
|
|
|
|
2014-10-11 12:27:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the mouse-over box to define the color.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.6
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR = "footnote_inputfield_custom_mouse_over_box_color";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the mouse-over box to define the background color.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.6
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND = "footnote_inputfield_custom_mouse_over_box_background";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the mouse-over box to define the border width.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.6
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH = "footnote_inputfield_custom_mouse_over_box_border_width";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the mouse-over box to define the border color.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.6
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR = "footnote_inputfield_custom_mouse_over_box_border_color";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the mouse-over box to define the border radius.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.6
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS = "footnote_inputfield_custom_mouse_over_box_border_radius";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the mouse-over box to define the max width.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.6
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH = "footnote_inputfield_custom_mouse_over_box_max_width";
|
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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 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";
|
2014-09-14 20:32:59 +00:00
|
|
|
|
|
2014-10-08 21:36:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key the activation of the_title hook.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.5
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_EXPERT_LOOKUP_THE_TITLE = "footnote_inputfield_expert_lookup_the_title";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key the activation of the_content hook.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.5
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_EXPERT_LOOKUP_THE_CONTENT = "footnote_inputfield_expert_lookup_the_content";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key the activation of the_excerpt hook.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.5
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_EXPERT_LOOKUP_THE_EXCERPT = "footnote_inputfield_expert_lookup_the_excerpt";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key the activation of widget_title hook.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.5
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE = "footnote_inputfield_expert_lookup_widget_title";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key the activation of widget_text hook.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.5
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT = "footnote_inputfield_expert_lookup_widget_text";
|
|
|
|
|
|
2020-11-17 02:14:21 +00:00
|
|
|
|
/**
|
|
|
|
|
* Settings Container Key for the label of the 'Read on' button in truncated tooltips
|
|
|
|
|
*
|
|
|
|
|
* @since 2.1.0
|
|
|
|
|
* @var string
|
|
|
|
|
*
|
|
|
|
|
* 2020-11-08T2106+0100
|
|
|
|
|
*/
|
|
|
|
|
const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = "footnote_inputfield_readon_label";
|
|
|
|
|
|
|
|
|
|
/**
|
2020-11-26 09:54:41 +00:00
|
|
|
|
* Settings Container Keys for options fixing default layout
|
2020-11-17 02:14:21 +00:00
|
|
|
|
*
|
|
|
|
|
* @since 2.1.1
|
|
|
|
|
* @var string
|
|
|
|
|
*
|
|
|
|
|
* 2020-11-16T0859+0100
|
|
|
|
|
*/
|
2020-11-20 05:40:03 +00:00
|
|
|
|
const C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = "footnotes_inputfield_referrer_superscript_tags";
|
2020-11-17 02:14:21 +00:00
|
|
|
|
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";
|
|
|
|
|
|
2020-11-26 09:54:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
2020-11-17 02:14:21 +00:00
|
|
|
|
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";
|
|
|
|
|
|
2020-11-26 09:54:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* Settings Container Keys for the link element option
|
2020-11-28 09:58:23 +00:00
|
|
|
|
* Settings Container Keys for backlink typography and layout
|
2020-12-03 07:55:27 +00:00
|
|
|
|
* Settings Container Keys for tooltip font size
|
2020-12-06 12:46:45 +00:00
|
|
|
|
* Settings Container Keys for page layout support
|
2020-12-05 04:48:09 +00:00
|
|
|
|
* Settings Container Keys for scroll offset and duration
|
2020-12-06 12:46:45 +00:00
|
|
|
|
* Settings Container Keys for tooltip display durations
|
2020-11-26 09:54:41 +00:00
|
|
|
|
*
|
2020-12-06 16:30:14 +00:00
|
|
|
|
* @since 2.1.4
|
2020-12-03 07:55:27 +00:00
|
|
|
|
* @var string|bool|int
|
2020-11-26 09:54:41 +00:00
|
|
|
|
*
|
|
|
|
|
* 2020-11-26T1002+0100
|
2020-12-03 07:55:27 +00:00
|
|
|
|
* 2020-11-30T0427+0100
|
|
|
|
|
* 2020-12-03T0501+0100
|
2020-12-06 12:46:45 +00:00
|
|
|
|
* 2020-12-05T0425+0100
|
2020-11-26 09:54:41 +00:00
|
|
|
|
*/
|
2020-12-06 12:46:45 +00:00
|
|
|
|
|
|
|
|
|
// link element option:
|
2020-12-03 07:55:27 +00:00
|
|
|
|
const C_BOOL_LINK_ELEMENT_ENABLED = "footnote_inputfield_link_element_enabled";
|
|
|
|
|
|
2020-12-06 12:46:45 +00:00
|
|
|
|
// backlink typography:
|
2020-12-03 07:55:27 +00:00
|
|
|
|
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";
|
2020-12-06 12:46:45 +00:00
|
|
|
|
|
|
|
|
|
// backlink layout:
|
2020-12-03 07:55:27 +00:00
|
|
|
|
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";
|
|
|
|
|
|
2020-12-06 12:46:45 +00:00
|
|
|
|
// tooltip font size:
|
|
|
|
|
// called mouse over box not tooltip for consistency
|
2020-12-03 07:55:27 +00:00
|
|
|
|
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";
|
2020-11-26 09:54:41 +00:00
|
|
|
|
|
2020-12-06 12:46:45 +00:00
|
|
|
|
// page layout support:
|
|
|
|
|
const C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT = "footnotes_inputfield_page_layout_support";
|
|
|
|
|
|
|
|
|
|
// scroll offset and duration:
|
2020-12-05 04:48:09 +00:00
|
|
|
|
const C_INT_FOOTNOTES_SCROLL_OFFSET = "footnotes_inputfield_scroll_offset";
|
|
|
|
|
const C_INT_FOOTNOTES_SCROLL_DURATION = "footnotes_inputfield_scroll_duration";
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-12-06 12:46:45 +00:00
|
|
|
|
// 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";
|
|
|
|
|
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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 Default Settings for each Settings Container.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.0
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
private $a_arr_Default = array(
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
"footnotes_storage" => array(
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-28 09:58:23 +00:00
|
|
|
|
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',
|
2020-12-06 12:46:45 +00:00
|
|
|
|
self::C_INT_FOOTNOTES_SCROLL_OFFSET => 20,
|
|
|
|
|
self::C_INT_FOOTNOTES_SCROLL_DURATION => 380,
|
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
|
2020-11-20 05:40:03 +00:00
|
|
|
|
self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => 'no',
|
2020-11-05 02:34:35 +00:00
|
|
|
|
self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
|
2020-11-20 05:40:03 +00:00
|
|
|
|
self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => 'yes',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-12-04 22:51:29 +00:00
|
|
|
|
// whether to enqueue additional style sheet:
|
|
|
|
|
self::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT => 'none',
|
|
|
|
|
|
2020-11-17 02:14:21 +00:00
|
|
|
|
self::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes',
|
|
|
|
|
self::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes',
|
2020-11-20 05:40:03 +00:00
|
|
|
|
self::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => 'no',
|
|
|
|
|
self::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => 'no',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-30 06:17:43 +00:00
|
|
|
|
// 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 => '',
|
2020-11-26 09:54:41 +00:00
|
|
|
|
|
2020-12-03 07:55:27 +00:00
|
|
|
|
// set backlinks column width:
|
2020-12-03 17:38:14 +00:00
|
|
|
|
self::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED => 'no',
|
|
|
|
|
self::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR => '50',
|
|
|
|
|
self::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT => 'px',
|
2020-12-03 07:55:27 +00:00
|
|
|
|
|
|
|
|
|
// set backlinks column max width:
|
2020-12-03 17:38:14 +00:00
|
|
|
|
self::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED => 'no',
|
2020-12-03 07:55:27 +00:00
|
|
|
|
self::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR => '140',
|
|
|
|
|
self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT => 'px',
|
|
|
|
|
|
2020-11-28 09:58:23 +00:00
|
|
|
|
// whether a <br /> tag is inserted:
|
|
|
|
|
self::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED => 'no',
|
|
|
|
|
|
2020-12-04 22:51:29 +00:00
|
|
|
|
// whether to use link elements:
|
2020-11-28 09:58:23 +00:00
|
|
|
|
self::C_BOOL_LINK_ELEMENT_ENABLED => 'yes',
|
2020-12-04 22:51:29 +00:00
|
|
|
|
|
|
|
|
|
// excerpt should be disabled:
|
2020-11-24 09:22:27 +00:00
|
|
|
|
self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'no',
|
2020-11-24 11:01:34 +00:00
|
|
|
|
|
2020-11-20 05:40:03 +00:00
|
|
|
|
// 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':
|
2020-11-28 09:58:23 +00:00
|
|
|
|
self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'yes',
|
|
|
|
|
|
|
|
|
|
self::C_STR_FOOTNOTES_LOVE => 'no',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
),
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
"footnotes_storage_custom" => array(
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-16 20:57:15 +00:00
|
|
|
|
self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
|
|
|
|
self::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes',
|
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// The default footnote referrer surroundings should be square brackets:
|
2020-11-20 05:40:03 +00:00
|
|
|
|
// * with respect to baseline footnote referrers new option;
|
|
|
|
|
// * as in English or US American typesetting;
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// * for better UX thanks to a more button-like appearance;
|
2020-11-20 05:40:03 +00:00
|
|
|
|
// * for stylistic consistency with the expand-collapse button;
|
2020-11-11 20:49:44 +00:00
|
|
|
|
self::C_STR_FOOTNOTES_STYLING_BEFORE => '[',
|
|
|
|
|
self::C_STR_FOOTNOTES_STYLING_AFTER => ']',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
|
2020-11-24 11:01:34 +00:00
|
|
|
|
|
2020-11-20 05:40:03 +00:00
|
|
|
|
// alternative, low-script tooltips using CSS for transitions
|
|
|
|
|
// in response to user demand for website with jQuery UI outage
|
|
|
|
|
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'no',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// The mouse over content truncation should be enabled by default
|
|
|
|
|
// to raise awareness of the functionality and to prevent the screen
|
|
|
|
|
// from being filled at mouse-over, and to allow the Continue reading:
|
|
|
|
|
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// The truncation length is raised from 150 to 200 chars:
|
|
|
|
|
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200,
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// The default position should not be lateral because of the risk
|
|
|
|
|
// the box gets squeezed between note anchor at line end and window edge,
|
|
|
|
|
// and top because reading at the bottom of the window is more likely:
|
|
|
|
|
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0,
|
2020-11-17 02:14:21 +00:00
|
|
|
|
// The vertical offset must be negative for the box not to cover
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// the current line of text (web coordinates origin is top left):
|
|
|
|
|
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7,
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-12-06 12:46:45 +00:00
|
|
|
|
// 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,
|
|
|
|
|
|
2020-12-06 16:30:14 +00:00
|
|
|
|
// tooltip font size reset to legacy by default since 2.1.4;
|
2020-12-04 09:31:52 +00:00
|
|
|
|
// was set to inherit since 2.1.1 as it overrode custom CSS,
|
2020-12-06 16:30:14 +00:00
|
|
|
|
// is moved to settings since 2.1.4 2020-12-04T1023+0100
|
2020-12-04 09:31:52 +00:00
|
|
|
|
self::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'yes',
|
2020-12-06 12:46:45 +00:00
|
|
|
|
self::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13,
|
2020-12-04 09:31:52 +00:00
|
|
|
|
self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px',
|
2020-12-03 07:55:27 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
// The mouse over box shouldn’t feature a colored background
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// by default, due to diverging user preferences. White is neutral:
|
|
|
|
|
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2014-10-11 12:27:00 +00:00
|
|
|
|
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1,
|
2020-11-11 20:49:44 +00:00
|
|
|
|
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// The mouse over box corners mustn’t be rounded as that is outdated:
|
|
|
|
|
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0,
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-11 20:49:44 +00:00
|
|
|
|
// The width should be limited to start with, for the box to have shape:
|
|
|
|
|
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450,
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666',
|
|
|
|
|
self::C_STR_HYPERLINK_ARROW => '↑',
|
|
|
|
|
self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
|
|
|
|
|
self::C_STR_CUSTOM_CSS => ''
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
),
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-16 20:57:15 +00:00
|
|
|
|
"footnotes_storage_expert" => array(
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-28 09:58:23 +00:00
|
|
|
|
// checkboxes
|
|
|
|
|
|
2020-11-17 02:14:21 +00:00
|
|
|
|
// 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/>
|
2020-11-24 11:01:34 +00:00
|
|
|
|
// Yet in titles, footnotes are functionally pointless in WordPress.
|
|
|
|
|
self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => '',
|
|
|
|
|
|
|
|
|
|
// This is the only useful one:
|
2020-11-28 09:58:23 +00:00
|
|
|
|
self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'checked',
|
2020-11-24 11:01:34 +00:00
|
|
|
|
|
|
|
|
|
// And the_excerpt is disabled by default following @nikelaos in
|
|
|
|
|
// <https://wordpress.org/support/topic/jquery-comes-up-in-feed-content/#post-13110879>
|
|
|
|
|
// <https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13687068>
|
|
|
|
|
self::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT => '',
|
|
|
|
|
|
|
|
|
|
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => '',
|
|
|
|
|
|
2020-11-28 09:58:23 +00:00
|
|
|
|
// 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.
|
2020-11-24 09:22:27 +00:00
|
|
|
|
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => '',
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-20 05:40:03 +00:00
|
|
|
|
// initially hard-coded default
|
2020-11-28 09:58:23 +00:00
|
|
|
|
// 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>
|
2020-11-20 05:40:03 +00:00
|
|
|
|
// define -1 as PHP_INT_MAX instead
|
2020-11-17 02:14:21 +00:00
|
|
|
|
self::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX,
|
2020-11-28 09:58:23 +00:00
|
|
|
|
self::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => 1000,
|
2020-11-17 02:14:21 +00:00
|
|
|
|
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,
|
|
|
|
|
|
2014-10-08 21:36:35 +00:00
|
|
|
|
)
|
2020-11-17 02:14:21 +00:00
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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];
|
|
|
|
|
}
|
2014-09-14 20:32:59 +00:00
|
|
|
|
|
2014-10-11 12:27:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* Returns the default values of a specific Settings Container.
|
|
|
|
|
*
|
|
|
|
|
* @author Stefan Herndler
|
|
|
|
|
* @since 1.5.6
|
|
|
|
|
* @param int $p_int_Index Settings Container Aray Key Index.
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getDefaults($p_int_Index) {
|
|
|
|
|
return $this->a_arr_Default[$this->a_arr_Container[$p_int_Index]];
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-05 02:34:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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)];
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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));
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-01 05:41:22 +00:00
|
|
|
|
}
|