chore: lint code
This commit is contained in:
parent
7ad975c389
commit
f0c6b07a84
17 changed files with 257 additions and 269 deletions
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Rename file from `config.php` to `class-footnotes-config.php`,
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
* @todo Remove.
|
||||
* @deprecated
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@ class Footnotes_Config {
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @todo Remove.
|
||||
* @deprecated
|
||||
* @deprecated
|
||||
*/
|
||||
const C_STR_PLUGIN_PUBLIC_NAME = '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>';
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Footnotes_Config {
|
|||
*
|
||||
* @since 2.0.4
|
||||
* @todo Remove.
|
||||
* @deprecated
|
||||
* @deprecated
|
||||
*/
|
||||
const C_STR_PLUGIN_HEADING_NAME = '<span class="footnotes_logo_heading footnotes_logo_part1_heading">foot</span><span class="footnotes_logo_heading footnotes_logo_part2_heading">notes</span>';
|
||||
|
||||
|
@ -60,7 +60,7 @@ class Footnotes_Config {
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @todo Remove.
|
||||
* @deprecated
|
||||
* @deprecated
|
||||
*/
|
||||
const C_STR_LOVE_SYMBOL = '<span style="color:#ff6d3b; font-weight:bold;">♥</span>';
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Footnotes_Config {
|
|||
*
|
||||
* @since 2.0.4
|
||||
* @todo Remove.
|
||||
* @deprecated
|
||||
* @deprecated
|
||||
*/
|
||||
const C_STR_LOVE_SYMBOL_HEADING = '<span class="footnotes_heart_heading">♥</span>';
|
||||
|
||||
|
@ -82,7 +82,7 @@ class Footnotes_Config {
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @todo Remove.
|
||||
* @deprecated
|
||||
* @deprecated
|
||||
*/
|
||||
const C_STR_NO_LOVE_SLUG = '[[no footnotes: love]]';
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Rename file from `convert.php` to `class-footnotes-convert.php`,
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -23,8 +23,8 @@ class Footnotes_Convert {
|
|||
/**
|
||||
* Converts an integer into the user-defined counter style for the footnotes.
|
||||
*
|
||||
* @param int $p_int_index Index to be converted.
|
||||
* @param string $p_str_convert_style Counter style to use.
|
||||
* @param int $p_int_index Index to be converted.
|
||||
* @param string $p_str_convert_style Counter style to use.
|
||||
* @return string Converted Index converted to the defined counter style.
|
||||
*
|
||||
* @since 1.5.0
|
||||
|
@ -54,7 +54,7 @@ class Footnotes_Convert {
|
|||
* gootnotes per Page).
|
||||
*
|
||||
* @param int $p_int_value Value to be converted.
|
||||
* @param bool $p_bool_upper_case Whether to convert the value to upper-case.
|
||||
* @param bool $p_bool_upper_case Whether to convert the value to upper-case.
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0-gamma
|
||||
|
@ -86,7 +86,7 @@ class Footnotes_Convert {
|
|||
/**
|
||||
* Converts an integer to a leading-0 integer.
|
||||
*
|
||||
* @param int $p_int_value Value to be converted.
|
||||
* @param int $p_int_value Value to be converted.
|
||||
* @return string Value with a leading zero.
|
||||
*
|
||||
* @since 1.0-gamma
|
||||
|
@ -104,7 +104,7 @@ class Footnotes_Convert {
|
|||
* Converts an integer to a Roman numeral.
|
||||
*
|
||||
* @param int $p_int_value Value to be converted.
|
||||
* @param bool $p_bool_upper_case Whether to convert the value to upper-case.
|
||||
* @param bool $p_bool_upper_case Whether to convert the value to upper-case.
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0-gamma
|
||||
|
@ -148,7 +148,7 @@ class Footnotes_Convert {
|
|||
/**
|
||||
* Converts a string depending on its value to a boolean.
|
||||
*
|
||||
* @param string $p_str_value String to be converted to boolean.
|
||||
* @param string $p_str_value String to be converted to boolean.
|
||||
* @return bool Boolean value represented by the string.
|
||||
*
|
||||
* @since 1.0-beta
|
||||
|
@ -173,7 +173,7 @@ class Footnotes_Convert {
|
|||
/**
|
||||
* Get an HTML array short code depending on Arrow-Array key index.
|
||||
*
|
||||
* @param int $p_int_index Index representing the arrow. If empty, all arrows are specified.
|
||||
* @param int $p_int_index Index representing the arrow. If empty, all arrows are specified.
|
||||
* @return array|string Array of all arrows if index is empty, otherwise HTML tag of a specific arrow.
|
||||
*
|
||||
* @since 1.3.2
|
||||
|
@ -198,7 +198,7 @@ class Footnotes_Convert {
|
|||
/**
|
||||
* Displays a variable.
|
||||
*
|
||||
* @param mixed $p_mixed_value The variable to display.
|
||||
* @param mixed $p_mixed_value The variable to display.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @todo Replace with proper logging/debug functions.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Rename file from `language.php` to `class-footnotes-i18n.php`,
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
*/
|
||||
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-config.php';
|
||||
|
@ -15,7 +15,7 @@ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-
|
|||
/**
|
||||
* Class providing internationalization functionality.
|
||||
*
|
||||
* Loads and defines the internationalization files for this plugin so that it
|
||||
* Loads and defines the internationalization files for this plugin so that it
|
||||
* is ready for translation.
|
||||
*
|
||||
* @link https://translate.wordpress.org/projects/wp-plugins/footnotes/ GlotPress listing
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
/**
|
||||
* Class defining action/filter registration for the plugin.
|
||||
*
|
||||
* Maintain a list of all hooks that are registered throughout the plugin, and
|
||||
* register them with the WordPress API. Call the run function to execute the
|
||||
* Maintain a list of all hooks that are registered throughout the plugin, and
|
||||
* register them with the WordPress API. Call the run function to execute the
|
||||
* list of actions and filters.
|
||||
*
|
||||
* @package footnotes
|
||||
|
@ -56,11 +56,11 @@ class Footnotes_Loader {
|
|||
/**
|
||||
* Add a new action to the collection to be registered with WordPress.
|
||||
*
|
||||
* @param string $hook The name of the WordPress action that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the action is defined.
|
||||
* @param string $callback The name of the function definition on the `$component`.
|
||||
* @param int $priority (optional) The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args (optional) The number of arguments that should be passed to the $callback. Default is 1.
|
||||
* @param string $hook The name of the WordPress action that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the action is defined.
|
||||
* @param string $callback The name of the function definition on the `$component`.
|
||||
* @param int $priority (optional) The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args (optional) The number of arguments that should be passed to the $callback. Default is 1.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
@ -71,11 +71,11 @@ class Footnotes_Loader {
|
|||
/**
|
||||
* Add a new filter to the collection to be registered with WordPress.
|
||||
*
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the `$component`.
|
||||
* @param int $priority (optional) The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args (optional) The number of arguments that should be passed to the $callback. Default is 1.
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the `$component`.
|
||||
* @param int $priority (optional) The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args (optional) The number of arguments that should be passed to the $callback. Default is 1.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
@ -89,11 +89,11 @@ class Footnotes_Loader {
|
|||
*
|
||||
* @access private
|
||||
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the `$component`.
|
||||
* @param int $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the `$callback`.
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the `$component`.
|
||||
* @param int $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the `$callback`.
|
||||
* @return array The collection of actions and filters registered with WordPress.
|
||||
*
|
||||
* @since 2.8.0
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Rename file from `settings.php` to `class-footnotes-settings.php`,
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
*/
|
||||
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-convert.php';
|
||||
|
@ -138,8 +138,8 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Settings container key for the string before the footnote referrer.
|
||||
*
|
||||
* The default footnote referrer surroundings should be square brackets, as
|
||||
* in English or US American typesetting, for better UX thanks to a more
|
||||
* The default footnote referrer surroundings should be square brackets, as
|
||||
* in English or US American typesetting, for better UX thanks to a more
|
||||
* button-like appearance, as well as for stylistic consistency with the
|
||||
* expand-collapse button.
|
||||
*
|
||||
|
@ -191,14 +191,14 @@ class Footnotes_Settings {
|
|||
* @var string
|
||||
*
|
||||
* @since 1.5.4
|
||||
* @todo The mouse-over content truncation should be enabled by default to raise
|
||||
* awareness of the functionality, prevent the screen from being filled on
|
||||
* mouse-over, and allow the use of ‘Continue Reading’ functionality.
|
||||
* @todo The mouse-over content truncation should be enabled by default to raise
|
||||
* awareness of the functionality, prevent the screen from being filled on
|
||||
* mouse-over, and allow the use of ‘Continue Reading’ functionality.
|
||||
*/
|
||||
const C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED = 'footnote_inputfield_custom_mouse_over_box_excerpt_enabled';
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the max. length of
|
||||
* Settings container key for the mouse-over box to define the max. length of
|
||||
* the enabled excerpt.
|
||||
*
|
||||
* The default truncation length is 200 chars.
|
||||
|
@ -215,17 +215,17 @@ class Footnotes_Settings {
|
|||
* These are checkboxes; the keyword `checked` is converted to `true`, whilst
|
||||
* an empty string (the default) is converted to `false`.
|
||||
*
|
||||
* Hooks should all be enabled by default to prevent users from thinking at
|
||||
* first that the feature is broken in post titles (see {@link
|
||||
* Hooks should all be enabled by default to prevent users from thinking at
|
||||
* first that the feature is broken in post titles (see {@link
|
||||
* https://wordpress.org/support/topic/more-feature-ideas/ here} for more
|
||||
* information).
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 1.5.5
|
||||
* @todo In titles, footnotes are still buggy, because WordPress uses the
|
||||
* title string in menus and in the title element, but Footnotes doesn't
|
||||
* delete footnotes in them.
|
||||
* @todo In titles, footnotes are still buggy, because WordPress uses the
|
||||
* title string in menus and in the title element, but Footnotes doesn't
|
||||
* delete footnotes in them.
|
||||
*/
|
||||
const C_STR_EXPERT_LOOKUP_THE_TITLE = 'footnote_inputfield_expert_lookup_the_title';
|
||||
|
||||
|
@ -302,7 +302,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Settings container key for the mouse-over box to define the background color.
|
||||
*
|
||||
* Theme default background color is best, but theme default background color
|
||||
* Theme default background color is best, but theme default background color
|
||||
* doesn't seem to exist.
|
||||
*
|
||||
* The default is currently `#ffffff` with `#000000` as the text color.
|
||||
|
@ -380,7 +380,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Settings container key for the mouse-over box to define the _y_-offset.
|
||||
*
|
||||
* The vertical offset must be negative for the box not to cover the current
|
||||
* The vertical offset must be negative for the box not to cover the current
|
||||
* line of text.
|
||||
*
|
||||
* @var int
|
||||
|
@ -474,7 +474,7 @@ class Footnotes_Settings {
|
|||
* that contain the strings ‘((’ and ‘))’ (i.e., the default footnote
|
||||
* start and end shortcodes), which causes issues with fake footnotes.
|
||||
*
|
||||
* Setting `the_content` priority to 10 instead of `PHP_INT_MAX` makes the
|
||||
* Setting `the_content` priority to 10 instead of `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.
|
||||
*
|
||||
|
@ -482,9 +482,9 @@ class Footnotes_Settings {
|
|||
* YARPP} plugin to display related posts below the Footnotes reference container,
|
||||
* priority needs to be at least 1,200.
|
||||
*
|
||||
* `PHP_INT_MAX` cannot be reset by leaving the number box empty, because
|
||||
* `PHP_INT_MAX` cannot be reset by leaving the number box empty, because
|
||||
* WebKit browsers don't allow it, so we must resort to -1.
|
||||
*
|
||||
*
|
||||
* @var int
|
||||
*
|
||||
* @since 2.0.5
|
||||
|
@ -539,7 +539,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Settings container key to enable the presence of a backlink separator.
|
||||
*
|
||||
* Backlink separators and terminators are often not preferred, but a choice
|
||||
* Backlink separators and terminators are often not preferred, but a choice
|
||||
* should be provided along with the ability to customize.
|
||||
*
|
||||
* @var string
|
||||
|
@ -690,7 +690,7 @@ class Footnotes_Settings {
|
|||
|
||||
/**
|
||||
* Settings container key for basic responsive page layout support options.
|
||||
*
|
||||
*
|
||||
* Whether to concatenate an additional stylesheet.
|
||||
*
|
||||
* @var string
|
||||
|
@ -756,7 +756,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Settings container key for URL wrap option.
|
||||
*
|
||||
* This is made optional because it causes weird line breaks. Unicode-compliant
|
||||
* This is made optional because it causes weird line breaks. Unicode-compliant
|
||||
* browsers break URLs at slashes.
|
||||
*
|
||||
* @var string
|
||||
|
@ -787,14 +787,14 @@ class Footnotes_Settings {
|
|||
* Settings container key to enable display of legacy Custom CSS metaboxes.
|
||||
*
|
||||
* This must be `false` if its setting is contained in the container to be hidden
|
||||
* because when saving, all missing constants are emptied, and {@see
|
||||
Footnotes_Convert::to_bool()} converts empty to `false`.
|
||||
* because when saving, all missing constants are emptied, and {@see
|
||||
* Footnotes_Convert::to_bool()} converts empty to `false`.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.2.2
|
||||
* @since 2.3.0 Swap migration Boolean, meaning ‘show legacy’ instead of
|
||||
* ‘migration complete’, due to storage data structure constraints.
|
||||
* @since 2.3.0 Swap migration Boolean, meaning ‘show legacy’ instead of
|
||||
* ‘migration complete’, due to storage data structure constraints.
|
||||
*/
|
||||
const C_STR_CUSTOM_CSS_LEGACY_ENABLE = 'footnote_inputfield_custom_css_legacy_enable';
|
||||
|
||||
|
@ -806,7 +806,6 @@ class Footnotes_Settings {
|
|||
* @var string
|
||||
*
|
||||
* @since 2.2.5
|
||||
*
|
||||
*/
|
||||
const C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION = 'footnotes_inputfield_alternative_mouse_over_box_position';
|
||||
|
||||
|
@ -905,7 +904,7 @@ class Footnotes_Settings {
|
|||
|
||||
/**
|
||||
* Settings container key for the fragment ID slug in footnotes.
|
||||
|
||||
|
||||
* @var string
|
||||
*
|
||||
* @since 2.3.0
|
||||
|
@ -933,9 +932,9 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Settings container key to enable backlink tooltips.
|
||||
*
|
||||
* When hard links are enabled, clicks on the backlinks are logged in the
|
||||
* When hard links are enabled, clicks on the backlinks are logged in the
|
||||
* browsing history, along with clicks on the referrers.
|
||||
* This tooltip hints to use the backbutton instead, so the history gets
|
||||
* This tooltip hints to use the backbutton instead, so the history gets
|
||||
* streamlined again.
|
||||
* See {@link https://wordpress.org/support/topic/making-it-amp-compatible/#post-13837359
|
||||
* here} for more information.
|
||||
|
@ -961,9 +960,9 @@ class Footnotes_Settings {
|
|||
* The first implementation used a fixed shortcode provided in the changelog,
|
||||
* but footnotes should have freely-configurable shortcodes.
|
||||
*
|
||||
* Tooltips can display another content than the footnote entry in the
|
||||
* reference container. The trigger is a shortcode in the footnote text
|
||||
* separating the tooltip text from the note. That is consistent with what
|
||||
* Tooltips can display another content than the footnote entry in the
|
||||
* reference container. The trigger is a shortcode in the footnote text
|
||||
* separating the tooltip text from the note. That is consistent with what
|
||||
* WordPress does for excerpts.
|
||||
*
|
||||
* @var string
|
||||
|
@ -973,11 +972,11 @@ class Footnotes_Settings {
|
|||
const C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER = 'footnotes_inputfield_tooltip_excerpt_delimiter';
|
||||
|
||||
/**
|
||||
* Settings container key to enable mirroring the tooltip excerpt in the
|
||||
* Settings container key to enable mirroring the tooltip excerpt in the
|
||||
* reference container.
|
||||
*
|
||||
* Tooltips, even jQuery-driven, may be hard to consult on mobiles.
|
||||
* This option allows users to read the tooltip content in the reference
|
||||
* This option allows users to read the tooltip content in the reference
|
||||
* container too. See {@link https://wordpress.org/support/topic/change-tooltip-text/#post-13935050
|
||||
* here} for more information, and {@link https://wordpress.org/support/topic/change-tooltip-text/#post-13935488
|
||||
* here} for why this must not be the default behavior.
|
||||
|
@ -989,7 +988,7 @@ class Footnotes_Settings {
|
|||
const C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE = 'footnotes_inputfield_tooltip_excerpt_mirror_enable';
|
||||
|
||||
/**
|
||||
* Settings container key to configure the tooltip excerpt separator in the
|
||||
* Settings container key to configure the tooltip excerpt separator in the
|
||||
* reference container.
|
||||
*
|
||||
* @var string
|
||||
|
@ -1135,7 +1134,7 @@ class Footnotes_Settings {
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @todo Review. Why are the constants just initialised with these values?
|
||||
* At the very least, we should stop using ‘yes’ to mean `true` etc.
|
||||
* At the very least, we should stop using ‘yes’ to mean `true` etc.
|
||||
*/
|
||||
private $a_arr_default = array(
|
||||
|
||||
|
@ -1357,7 +1356,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Returns the name of a specified Settings Container.
|
||||
*
|
||||
* @param int $p_int_index Settings Container index.
|
||||
* @param int $p_int_index Settings Container index.
|
||||
* @return str Settings Container name.
|
||||
*
|
||||
* @since 1.5.0
|
||||
|
@ -1369,7 +1368,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Returns the default value(s) of a specific Settings Container.
|
||||
*
|
||||
* @param int $p_int_index Settings Container index.
|
||||
* @param int $p_int_index Settings Container index.
|
||||
* @return (string|int)[] Settings Container default value(s).
|
||||
*
|
||||
* @since 1.5.6
|
||||
|
@ -1396,7 +1395,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Loads all settings from specified Settings Containers.
|
||||
*
|
||||
* @param int $p_int_index Settings container index.
|
||||
* @param int $p_int_index Settings container index.
|
||||
* @return (string|int)[] Loaded settings (or defaults if specified container is empty).
|
||||
*
|
||||
* @since 1.5.0
|
||||
|
@ -1426,8 +1425,8 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Updates a whole Setting Container on save.
|
||||
*
|
||||
* @param int $p_int_index Index of the Setting Container.
|
||||
* @param array $p_arr_new_values The new Settings value(s).
|
||||
* @param int $p_int_index Index of the Setting Container.
|
||||
* @param array $p_arr_new_values The new Settings value(s).
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.5.0
|
||||
|
@ -1443,7 +1442,7 @@ class Footnotes_Settings {
|
|||
/**
|
||||
* Returns the value of specified Setting.
|
||||
*
|
||||
* @param string $p_str_key Setting key.
|
||||
* @param string $p_str_key Setting key.
|
||||
* @return string|int|null Setting value, or `null` if setting key is invalid.
|
||||
*
|
||||
* @since 1.5.0
|
||||
|
|
|
@ -2,22 +2,21 @@
|
|||
/**
|
||||
* File providing the `Footnotes_Template` class.
|
||||
*
|
||||
*
|
||||
* @package footnotes
|
||||
* @subpackage includes
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.2.6 Add support for custom templates in sibling folder.
|
||||
* @since 2.8.0 Rename file from `templates.php` to `class-footnotes-templates.php`,
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class defining template rendering.
|
||||
*
|
||||
* Loads a template file, replaces all Placeholders and returns the replaced
|
||||
* Loads a template file, replaces all Placeholders and returns the replaced
|
||||
* file content.
|
||||
|
||||
|
||||
* @package footnotes
|
||||
* @subpackage includes
|
||||
*
|
||||
|
@ -74,9 +73,9 @@ class Footnotes_Template {
|
|||
/**
|
||||
* Class Constructor. Reads and loads the template file without replace any placeholder.
|
||||
*
|
||||
* @param string $p_str_file_type Template file type.
|
||||
* @param string $p_str_file_name Template file name inside the `partials/` directory, without the file extension.
|
||||
* @param string $p_str_extension (optional) Template file extension (default: 'html').
|
||||
* @param string $p_str_file_type Template file type.
|
||||
* @param string $p_str_file_name Template file name inside the `partials/` directory, without the file extension.
|
||||
* @param string $p_str_extension (optional) Template file extension (default: 'html').
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @todo Refactor templating.
|
||||
|
@ -86,9 +85,9 @@ class Footnotes_Template {
|
|||
if ( empty( $p_str_file_type ) || empty( $p_str_file_name ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->plugin_directory = plugin_dir_path( dirname( __FILE__ ) );
|
||||
|
||||
|
||||
$template = $this->get_template( $p_str_file_type, $p_str_file_name, $p_str_extension );
|
||||
if ( $template ) {
|
||||
$this->process_template( $template );
|
||||
|
@ -101,7 +100,7 @@ class Footnotes_Template {
|
|||
/**
|
||||
* Replace all placeholders specified in array.
|
||||
*
|
||||
* @param array $p_arr_placeholders Placeholders (key = placeholder, value = value).
|
||||
* @param array $p_arr_placeholders Placeholders (key = placeholder, value = value).
|
||||
* @return bool `true` on Success, `false` if placeholders invalid.
|
||||
*
|
||||
* @since 1.5.0
|
||||
|
@ -149,7 +148,7 @@ class Footnotes_Template {
|
|||
/**
|
||||
* Process template file.
|
||||
*
|
||||
* @param string $template The template to be processed.
|
||||
* @param string $template The template to be processed.
|
||||
* @return void
|
||||
*
|
||||
* @since 2.4.0d3
|
||||
|
@ -171,9 +170,9 @@ class Footnotes_Template {
|
|||
/**
|
||||
* Get the template.
|
||||
*
|
||||
* @param string $p_str_file_type The file type of the template.
|
||||
* @param string $p_str_file_name The file name of the template.
|
||||
* @param string $p_str_extension The file extension of the template.
|
||||
* @param string $p_str_file_type The file type of the template.
|
||||
* @param string $p_str_file_name The file name of the template.
|
||||
* @param string $p_str_extension The file extension of the template.
|
||||
* @return mixed `false` or the template path
|
||||
*
|
||||
* @since 2.5.0
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
* A class definition that includes attributes and functions used across both the
|
||||
* public-facing side of the site and the admin area.
|
||||
*
|
||||
* @package footnotes
|
||||
* @subpackage includes
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Rename file from `wysiwyg.php` to `class-footnotes-wysiwyg.php`,
|
||||
* rename `class/` sub-directory to `includes/`.
|
||||
* @package footnotes\includes
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Rename file from `init.php` to `class-footnotes.php`, rename
|
||||
* `class/` sub-directory to `includes/`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -18,40 +16,37 @@
|
|||
*
|
||||
* This is used to define internationalization, admin-specific hooks, and
|
||||
* public-facing site hooks.
|
||||
|
||||
* @package footnotes
|
||||
* @subpackage includes
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0
|
||||
|
||||
* @package footnotes\includes
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class Footnotes {
|
||||
/**
|
||||
* The loader that's responsible for maintaining and registering all hooks that power
|
||||
* the plugin.
|
||||
*
|
||||
* @access protected
|
||||
* @var Footnotes_Loader $loader Maintains and registers all hooks for the plugin.
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @var Footnotes_Loader $loader Maintains and registers all hooks for the plugin.
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* The unique identifier of this plugin
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @access protected
|
||||
* @var string $plugin_name The string used to uniquely identify this plugin.
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @var string $plugin_name The string used to uniquely identify this plugin.
|
||||
*/
|
||||
protected $plugin_name;
|
||||
|
||||
/**
|
||||
* The current version of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @access protected
|
||||
* @var string $version The current version of the plugin.
|
||||
* @since 2.8.0
|
||||
* @see PLUGIN_VERSION
|
||||
*
|
||||
* @var string $version The current version of the plugin.
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
|
@ -59,12 +54,13 @@ class Footnotes {
|
|||
* Build the core of the plugin.
|
||||
*
|
||||
* Set the plugin name and the plugin version that can be used throughout the
|
||||
* plugin. Load the dependencies, define the locale, and set the hooks for
|
||||
* plugin. Load the dependencies, define the locale, and set the hooks for
|
||||
* the admin area and the public-facing side of the site.
|
||||
*
|
||||
* @uses PLUGIN_VERSION The plugin version constant.
|
||||
* @since 1.0.0
|
||||
* @see PLUGIN_VERSION The plugin version constant.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( defined( 'PLUGIN_VERSION' ) ) {
|
||||
|
@ -78,7 +74,6 @@ class Footnotes {
|
|||
$this->set_locale();
|
||||
$this->define_admin_hooks();
|
||||
$this->define_public_hooks();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,22 +81,21 @@ class Footnotes {
|
|||
*
|
||||
* Includes the following files that make up the plugin:
|
||||
*
|
||||
* - `Footnotes_Loader`. Orchestrates the hooks of the plugin.
|
||||
* - `Footnotes_i18n`. Defines internationalization functionality.
|
||||
* - `Footnotes_Config`. Defines plugin details.
|
||||
* - `Footnotes_Convert`. Provides conversion methods.
|
||||
* - `Footnotes_Settings`. Defines customisable plugin settings.
|
||||
* - `Footnotes_Template`. Handles template rendering.
|
||||
* - `Footnotes_Admin`. Defines all hooks for the admin area.
|
||||
* - `Footnotes_Public`. Defines all hooks for the public side of the site.
|
||||
* - {@see Footnotes_Loader}: orchestrates the hooks of the plugin;
|
||||
* - {@see Footnotes_i18n}: defines internationalization functionality;
|
||||
* - {@see Footnotes_Config}: defines plugin details;
|
||||
* - {@see Footnotes_Convert}: provides conversion methods;
|
||||
* - {@see Footnotes_Settings}: defines customisable plugin settings;
|
||||
* - {@see Footnotes_Template}: handles template rendering;
|
||||
* - {@see Footnotes_Admin}: defines all hooks for the admin area; and
|
||||
* - {@see Footnotes_Public}: defines all hooks for the public side of the site.
|
||||
*
|
||||
* Creates an instance of the loader which will be used to register the hooks
|
||||
* with WordPress.
|
||||
*
|
||||
* @access private
|
||||
* @uses Footnotes_Loader Loads plugin dependencies.
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @return void
|
||||
*/
|
||||
private function load_dependencies() {
|
||||
|
||||
|
@ -143,13 +137,13 @@ class Footnotes {
|
|||
/**
|
||||
* Define the locale for this plugin for internationalization.
|
||||
*
|
||||
* Uses the {@see Footnotes_i18n} class in order to set the domain and to
|
||||
* Uses {@see Footnotes_i18n} in order to set the domain and to
|
||||
* register the hook with WordPress.
|
||||
*
|
||||
* @access private
|
||||
* @uses Footnotes_i18n Handles initialization functions.
|
||||
* @since 2.8.0
|
||||
* @uses Footnotes_i18n Handles initialization functions.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @return void
|
||||
*/
|
||||
private function set_locale() {
|
||||
|
||||
|
@ -160,14 +154,14 @@ class Footnotes {
|
|||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the admin area functionality of the
|
||||
* Register all of the hooks related to the admin area functionality of the
|
||||
* plugin.
|
||||
*
|
||||
* @access private
|
||||
* @uses Footnotes_Admin Defines admin functionality.
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Moved hook registrations from various classes into `Footnotes_Admin`.
|
||||
* @uses Footnotes_Admin Defines admin functionality.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Moved hook registrations from various classes into `Footnotes_Admin`.
|
||||
* @return void
|
||||
*/
|
||||
private function define_admin_hooks() {
|
||||
|
||||
|
@ -192,13 +186,13 @@ class Footnotes {
|
|||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the public-facing functionality of
|
||||
* Register all of the hooks related to the public-facing functionality of
|
||||
* the plugin.
|
||||
*
|
||||
* @access private
|
||||
* @uses Footnotes_Admin Defines public-facing functionality.
|
||||
* @since 2.8.0
|
||||
* @uses Footnotes_Admin Defines public-facing functionality.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @return void
|
||||
*/
|
||||
private function define_public_hooks() {
|
||||
|
||||
|
@ -213,43 +207,39 @@ class Footnotes {
|
|||
/**
|
||||
* Runs the loader to execute all of the hooks with WordPress.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run() {
|
||||
$this->loader->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the plugin used to uniquely identify it within the
|
||||
* Gets the name of the plugin used to uniquely identify it within the
|
||||
* context of WordPress and to define internationalization functionality.
|
||||
*
|
||||
* @return string The name of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_plugin_name() {
|
||||
public function get_plugin_name(): string {
|
||||
return $this->plugin_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the class that orchestrates the hooks with the plugin.
|
||||
*
|
||||
* @return Footnotes_Loader Orchestrates the hooks of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_loader() {
|
||||
public function get_loader(): Footnotes_Loader {
|
||||
return $this->loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version number of the plugin.
|
||||
*
|
||||
* @return string The version number of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_version() {
|
||||
public function get_version(): string {
|
||||
return $this->version;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue