chore: lint code

This commit is contained in:
Ben Goldsworthy 2021-05-01 19:22:41 +01:00
parent 7ad975c389
commit f0c6b07a84
17 changed files with 257 additions and 269 deletions

View file

@ -53,8 +53,8 @@ class Footnotes_Admin {
/**
* Initialize the class and set its properties.
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*
* @since 2.8.0
*/
@ -140,7 +140,7 @@ class Footnotes_Admin {
/**
* Appends the Plugin links for display in the dashboard Plugins page.
*
* @param string[] $links The default set of links to display.
* @param string[] $links The default set of links to display.
* @return string[] The full set of links to display.
*
* @since 1.5.0

View file

@ -10,7 +10,7 @@
* @package footnotes\admin
* @since 1.5.0
* @since 2.8.0 Rename file from `wysiwyg.php` to `class-footnotes-wysiwyg.php`,
* move from `class/` sub-directory to `admin/`.
* move from `class/` sub-directory to `admin/`.
*/
/**
@ -47,7 +47,7 @@ class Footnotes_WYSIWYG {
/**
* Append a new Button to the WYSIWYG editor of Posts and Pages.
*
* @param string[] $p_arr_buttons Already-defined editor buttons.
* @param string[] $p_arr_buttons Already-defined editor buttons.
* @return string[]
*
* @since 1.5.0
@ -73,7 +73,7 @@ class Footnotes_WYSIWYG {
/**
* Includes the Plugins WYSIWYG editor script.
*
* @param string[] $p_arr_plugins Scripts to be included by the editor.
* @param string[] $p_arr_plugins Scripts to be included by the editor.
* @return string[]
*
* @since 1.5.0

View file

@ -10,7 +10,7 @@
* @package footnotes\admin_layout
* @since 1.5.0
* @since 2.8.0 Rename file from `layout.php` to `class-footnotes-layout-engine.php`,
* rename `dashboard/` sub-directory to `layout/`.
* rename `dashboard/` sub-directory to `layout/`.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-footnotes-layout-init.php';
@ -113,11 +113,11 @@ abstract class Footnotes_Layout_Engine {
* Returns an array describing a sub-page section.
*
* @access protected
* @param string $p_str_id Unique ID suffix.
* @param string $p_str_title Title of the section.
* @param int $p_int_settings_container_index Settings Container index.
* @param bool $p_bool_has_submit_button Whether a Submit button should
* be displayed for this section. Default `true`.
* @param string $p_str_id Unique ID suffix.
* @param string $p_str_title Title of the section.
* @param int $p_int_settings_container_index Settings Container index.
* @param bool $p_bool_has_submit_button Whether a Submit button should
* be displayed for this section. Default `true`.
* @return array {
* A dashboard section.
*
@ -143,10 +143,10 @@ abstract class Footnotes_Layout_Engine {
* Returns an array describing a meta box.
*
* @access protected
* @param string $p_str_section_id Parent section ID.
* @param string $p_str_id Unique ID suffix.
* @param string $p_str_title Title for the meta box.
* @param string $p_str_callback_function_name Class method name for callback.
* @param string $p_str_section_id Parent section ID.
* @param string $p_str_id Unique ID suffix.
* @param string $p_str_title Title for the meta box.
* @param string $p_str_callback_function_name Class method name for callback.
* @return array {
* A dashboard meta box.
*
@ -218,7 +218,7 @@ abstract class Footnotes_Layout_Engine {
* Registers all Meta boxes for a sub-page.
*
* @access private
* @param string $p_str_parent_id Parent section unique ID.
* @param string $p_str_parent_id Parent section unique ID.
*
* @since 1.5.0
*/
@ -369,7 +369,7 @@ abstract class Footnotes_Layout_Engine {
* Loads a specified setting.
*
* @access protected
* @param string $p_str_setting_key_name Setting key.
* @param string $p_str_setting_key_name Setting key.
* @return array {
* A configurable setting.
*
@ -396,7 +396,7 @@ abstract class Footnotes_Layout_Engine {
* Returns a simple text inside HTML `<span>` element.
*
* @access protected
* @param string $p_str_text Message to be surrounded with `<span>` tags.
* @param string $p_str_text Message to be surrounded with `<span>` tags.
* @return string
*
* @since 1.5.0
@ -410,8 +410,8 @@ abstract class Footnotes_Layout_Engine {
* Returns the HTML tag for an `<input>`/`<select>` label.
*
* @access protected
* @param string $p_str_setting_name Settings key.
* @param string $p_str_caption Label caption.
* @param string $p_str_setting_name Settings key.
* @param string $p_str_caption Label caption.
* @return string
*
* @since 1.5.0
@ -440,10 +440,10 @@ abstract class Footnotes_Layout_Engine {
* Constructs the HTML for a text `<input>` element.
*
* @access protected
* @param string $p_str_setting_name Setting key.
* @param int $p_str_max_length Maximum length of the input. Default length 999 chars.
* @param bool $p_bool_readonly Set the input to be read only. Default `false`.
* @param bool $p_bool_hidden Set the input to be hidden. Default `false`.
* @param string $p_str_setting_name Setting key.
* @param int $p_str_max_length Maximum length of the input. Default length 999 chars.
* @param bool $p_bool_readonly Set the input to be read only. Default `false`.
* @param bool $p_bool_hidden Set the input to be hidden. Default `false`.
* @return string
*
* @since 1.5.0
@ -471,7 +471,7 @@ abstract class Footnotes_Layout_Engine {
* Constructs the HTML for a checkbox `<input>` element.
*
* @access protected
* @param string $p_str_setting_name Setting key.
* @param string $p_str_setting_name Setting key.
* @return string
*
* @since 1.5.0
@ -492,7 +492,7 @@ abstract class Footnotes_Layout_Engine {
* Constructs the HTML for a `<select>` element.
*
* @access protected
* @param string $p_str_setting_name Setting key.
* @param string $p_str_setting_name Setting key.
* @param array $p_arr_options Possible options.
* @return string
*
@ -528,7 +528,7 @@ abstract class Footnotes_Layout_Engine {
* Constructs the HTML for a `<textarea>` element.
*
* @access protected
* @param string $p_str_setting_name Setting key.
* @param string $p_str_setting_name Setting key.
* @return string
*
* @since 1.5.0
@ -550,7 +550,7 @@ abstract class Footnotes_Layout_Engine {
* class.
*
* @access protected
* @param string $p_str_setting_name Setting key.
* @param string $p_str_setting_name Setting key.
* @return string
*
* @since 1.5.6
@ -572,10 +572,10 @@ abstract class Footnotes_Layout_Engine {
* Constructs the HTML for numeric `<input>` element.
*
* @access protected
* @param string $p_str_setting_name Setting key.
* @param int $p_in_min Minimum value.
* @param int $p_int_max Maximum value.
* @param bool $p_bool_deci `true` if float, `false` if integer. Default `false`.
* @param string $p_str_setting_name Setting key.
* @param int $p_in_min Minimum value.
* @param int $p_int_max Maximum value.
* @param bool $p_bool_deci `true` if float, `false` if integer. Default `false`.
* @return string
*
* @since 1.5.0

View file

@ -10,7 +10,7 @@
* @package footnotes\admin_layout
* @since 1.5.0
* @since 2.8.0 Rename file from `init.php` to `class-footnotes-layout-init.php`,
* rename `dashboard/` sub-directory to `layout/`.
* rename `dashboard/` sub-directory to `layout/`.
*/
/**
@ -52,7 +52,7 @@ class Footnotes_Layout_Init {
/**
* Initializes all WordPress hooks for the Plugin Settings.
*
* @param string $plugin_name The name of the plugin.
* @param string $plugin_name The name of the plugin.
*
* @since 1.5.0
* @since 2.8.0 Added `$plugin_name` parameter.

View file

@ -10,7 +10,7 @@
* @package footnotes\admin_layout
* @since 1.5.0
* @since 2.8.0 Rename file from `subpage-main.php` to `class-footnotes-layout-settings.php`,
* rename `dashboard/` sub-directory to `layout/`.
* rename `dashboard/` sub-directory to `layout/`.
*/
/**
@ -32,7 +32,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
* Initialize the class and set its properties.
*
* @since 2.8.0
* @param string $plugin_name The name of this plugin.
* @param string $plugin_name The name of this plugin.
*/
public function __construct( $plugin_name ) {
$this->plugin_name = $plugin_name;
@ -74,7 +74,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
* Returns an array of all registered sections for the sub-page.
*
* @see Footnotes_Layout_Engine::add_section() For more information on the
* section array format.
* section array format.
* @return array[] All of the registered sections.
*
* @since 1.5.0
@ -100,7 +100,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
* Returns an array of all registered meta boxes for each section of the sub-page.
*
* @see Footnotes_Layout_Engine::add_meta_box() For more information on the
* meta box array format.
* meta box array format.
* @return array[] All of the registered meta boxes.
*
* @since 1.5.0
@ -208,6 +208,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
'semicolon' => __( 'SEMICOLON', 'footnotes' ),
'en_dash' => __( 'EN DASH', 'footnotes' ),
);
/*
* Options for the terminating punctuation after backlinks.
* The Unicode name of RIGHT PARENTHESIS was originally more accurate because.

View file

@ -10,7 +10,6 @@
* @package footnotes
* @license GPL-3.0-only
* @copyright 2021 Mark Cheret (email: mark@cheret.de)
*
* @since 1.0.0
*
* @wordpress-plugin
@ -34,48 +33,56 @@ if ( ! defined( 'WPINC' ) ) {
}
/**
* The current plugin version.
* The plugin version.
*
* @link https://github.com/markcheret/footnotes/wiki/Versioning Versioning Guide
*
* @global string PLUGIN_VERSION
*
* @since 2.1.4
* @since 2.1.4
* @todo Draw from envfile rather than hard-coding.
* @var string PLUGIN_VERSION The version of this instance of the plugin.
*/
define( 'PLUGIN_VERSION', '2.8.0d' );
/**
* The current environment ('development' or 'production').
* The environment that the plugin is configured for.
*
* This primarily affects whether minified or unminified files are requested.
* This primarily affects whether minified or unminified CSS/JS files are
* requested.
*
* @global bool PRODUCTION_ENV
*
* @since 2.5.5
* @since 2.5.5
* @todo Draw from envfile rather than hard-coding.
* @todo Replace with string for >2 environment options.
* @var bool PRODUCTION_ENV Whether the plugin is running in production mode or not. Default `false`.
*/
define( 'PRODUCTION_ENV', false );
/**
* Triggers during plugin activation.
* Handles the activation of the plugin.
*
* @uses Footnotes_Activator::activate() Method called on plugin activation.
*
* @since 2.8.0
* @since 2.8.0
* @see Footnotes_Activator::activate()
*/
function activate_footnotes() {
/**
* Provides plugin activation functionality.
*/
require_once plugin_dir_path( __FILE__ ) . 'includes/class-footnotes-activator.php';
Footnotes_Activator::activate();
}
/**
* Triggers during plugin deactivation.
* Handles the deactivation of the plugin.
*
* @uses Footnotes_Deactivator::deactivate() Method called on plugin deactivation.
*
* @since 2.8.0
* @since 2.8.0
* @see Footnotes_Deactivator::deactivate()
*/
function deactivate_plugin_name() {
function deactivate_footnotes() {
/**
* Provides plugin deactivation functionality.
*/
require_once plugin_dir_path( __FILE__ ) . 'includes/class-footnotes-deactivator.php';
Footnotes_Deactivator::deactivate();
}
@ -83,8 +90,8 @@ register_activation_hook( __FILE__, 'activate_footnotes' );
register_deactivation_hook( __FILE__, 'deactivate_footnotes' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
* The core plugin class that defines internationalization, admin-specific and
* public-facing site hooks and functionality.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-footnotes.php';
@ -94,7 +101,7 @@ require plugin_dir_path( __FILE__ ) . 'includes/class-footnotes.php';
* Since everything within the plugin is registered via hooks, then kicking off
* the plugin from this point in the file does not affect the page life cycle.
*
* @since 2.8.0
* @since 2.8.0
*/
function run_footnotes() {
global $footnotes;

View file

@ -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;">&hearts;</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">&hearts;</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]]';
}

View file

@ -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.

View file

@ -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';

View file

@ -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

View file

@ -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';
@ -192,8 +192,8 @@ class Footnotes_Settings {
*
* @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.
* 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';
@ -224,8 +224,8 @@ class Footnotes_Settings {
*
* @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.
* 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';
@ -788,13 +788,13 @@ class Footnotes_Settings {
*
* 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`.
* 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.
* 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';
@ -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

View file

@ -2,14 +2,13 @@
/**
* 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/`.
*/
/**
@ -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.
@ -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

View file

@ -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/`.
*/
/**
@ -19,39 +17,36 @@
* 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;
@ -62,9 +57,10 @@ class Footnotes {
* 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() {
@ -163,11 +157,11 @@ class Footnotes {
* 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() {
@ -195,10 +189,10 @@ class Footnotes {
* 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,7 +207,9 @@ 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();
@ -223,33 +219,27 @@ class Footnotes {
* 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;
}
}

View file

@ -6,7 +6,7 @@
* @since 1.5.0
* @since 2.0.5 Enable all hoooks by default.
* @since 2.8.0 Rename file from `task.php` to `class-footnotes-parser.php`,
* move from `class/` sub-directory to `public/`.
* move from `class/` sub-directory to `public/`.
*/
/**
@ -316,6 +316,7 @@ class Footnotes_Parser {
* article status.
* For this to happen, WordPress' built-in partial HTML blocker needs to
* be disabled.
*
* @link https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/
*
* @since 2.5.0
@ -556,7 +557,6 @@ class Footnotes_Parser {
// Tooltip position, dimensions and timing.
if ( ! Footnotes_Public::$a_bool_alternative_tooltips_enabled && ! Footnotes_Public::$a_bool_amp_enabled ) {
/*
* Dimensions of jQuery tooltips.
*
@ -748,7 +748,7 @@ class Footnotes_Parser {
*
* @since 1.5.0
*
* @param string $p_str_content Title.
* @param string $p_str_content Title.
* @return string $p_str_content Title with replaced footnotes.
*/
public function footnotes_in_title( $p_str_content ) {
@ -761,7 +761,7 @@ class Footnotes_Parser {
*
* @since 1.5.0
*
* @param string $p_str_content Page/Post content.
* @param string $p_str_content Page/Post content.
* @return string $p_str_content Content with replaced footnotes.
*/
public function footnotes_in_content( $p_str_content ) {
@ -809,7 +809,7 @@ class Footnotes_Parser {
*
* @since 1.5.0
*
* @param string $p_str_excerpt Excerpt content.
* @param string $p_str_excerpt Excerpt content.
* @return string $p_str_excerpt Processed or new excerpt.
*/
public function footnotes_in_excerpt( $p_str_excerpt ) {
@ -830,12 +830,13 @@ class Footnotes_Parser {
* Generates excerpt on the basis of the post.
*
* Applies full WordPress excerpt processing.
*
* @link https://developer.wordpress.org/reference/functions/wp_trim_excerpt/
* @link https://developer.wordpress.org/reference/functions/wp_trim_words/
*
* @since 2.6.2
*
* @param string $p_str_content The post.
* @param string $p_str_content The post.
* @return string $p_str_content An excerpt of the post.
*/
public function generate_excerpt( $p_str_content ) {
@ -873,13 +874,14 @@ class Footnotes_Parser {
* Generates excerpt with footnotes on the basis of the post.
*
* Does not apply full WordPress excerpt processing.
*
* @see self::generate_excerpt()
* Uses information and some code from Advanced Excerpt.
* @link https://wordpress.org/plugins/advanced-excerpt/
*
* @since 2.6.3
*
* @param string $p_str_content The post.
* @param string $p_str_content The post.
* @return string $p_str_content An excerpt of the post.
*/
public function generate_excerpt_with_footnotes( $p_str_content ) {
@ -980,7 +982,7 @@ class Footnotes_Parser {
*
* @since 1.5.0
*
* @param string $p_str_content Widget content.
* @param string $p_str_content Widget content.
* @return string $p_str_content Content with replaced footnotes.
*/
public function footnotes_in_widget_title( $p_str_content ) {
@ -993,7 +995,7 @@ class Footnotes_Parser {
*
* @since 1.5.0
*
* @param string $p_str_content Widget content.
* @param string $p_str_content Widget content.
* @return string $p_str_content Content with replaced footnotes.
*/
public function footnotes_in_widget_text( $p_str_content ) {
@ -1008,9 +1010,9 @@ class Footnotes_Parser {
*
* @since 1.5.0
*
* @param string $p_str_content Any string that may contain footnotes to be replaced.
* @param bool $p_bool_output_references Appends the Reference Container to the output if set to true, default true.
* @param bool $p_bool_hide_footnotes_text Hide footnotes found in the string.
* @param string $p_str_content Any string that may contain footnotes to be replaced.
* @param bool $p_bool_output_references Appends the Reference Container to the output if set to true, default true.
* @param bool $p_bool_hide_footnotes_text Hide footnotes found in the string.
* @return string
*/
public function exec( $p_str_content, $p_bool_output_references = false, $p_bool_hide_footnotes_text = false ) {
@ -1066,7 +1068,7 @@ class Footnotes_Parser {
*
* @since 2.1.14
*
* @param string $p_str_content The footnote, including delimiters.
* @param string $p_str_content The footnote, including delimiters.
*/
public function unify_delimiters( $p_str_content ) {
@ -1132,7 +1134,7 @@ class Footnotes_Parser {
* @todo Refactor to parse DOM rather than using RegEx.
*
* @param string $p_str_content Any content to be parsed for footnotes.
* @param bool $p_bool_hide_footnotes_text Hide footnotes found in the string.
* @param bool $p_bool_hide_footnotes_text Hide footnotes found in the string.
* @return string
*/
public function search( $p_str_content, $p_bool_hide_footnotes_text ) {
@ -1461,16 +1463,7 @@ class Footnotes_Parser {
$l_str_excerpt_text .= '>';
/**
* Configurable read-on button label.
*
* - Adding: Tooltips: Read-on button: Label: configurable instead of localizable, thanks to @rovanov example provision.
*
* @reporter @rovanov
* @link https://wordpress.org/support/topic/offset-x-axis-and-offset-y-axis-does-not-working/
*
* @since 2.1.0
*/
// Configurable read-on button label.
$l_str_excerpt_text .= Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL );
$l_str_excerpt_text .= self::$a_bool_hard_links_enabled ? '</a>' : '</span>';
@ -1505,7 +1498,7 @@ class Footnotes_Parser {
$l_str_footnote_link_argument .= $l_int_index;
$l_str_footnote_link_argument .= '" class="footnote_hard_link"';
/**
/*
* Compose fragment ID anchor with offset, for use in reference container.
* Empty span, child of empty span, to avoid tall dotted rectangles in browser.
*/
@ -1516,7 +1509,6 @@ class Footnotes_Parser {
$l_str_referrer_anchor_element .= '" class="footnote_referrer_anchor"></span></span>';
} else {
/*
* Initialize hard link variables when hard links are disabled.
*
@ -1538,6 +1530,7 @@ class Footnotes_Parser {
// Determine tooltip content.
if ( Footnotes_Public::$a_bool_tooltips_enabled ) {
$l_str_tooltip_content = $l_bool_has_tooltip_text ? $l_str_tooltip_text : $l_str_excerpt_text;
/*
* Ensures paragraph separation
*
@ -1878,7 +1871,6 @@ class Footnotes_Parser {
$l_str_hard_link_address = '';
if ( self::$a_bool_hard_links_enabled ) {
/*
* Use-Backbutton-Hint tooltip, optional and configurable.
*

View file

@ -100,8 +100,8 @@ class Footnotes_Public {
* Initialize the class and set its properties.
*
* @since 2.8.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {

View file

@ -37,7 +37,7 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
*
* @since 2.8.0
*
* @param string $plugin_name The name of this plugin.
* @param string $plugin_name The name of this plugin.
*/
public function __construct( $plugin_name ) {
parent::__construct();
@ -86,7 +86,7 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
* @link https://developer.wordpress.org/reference/classes/wp_widget/form/ `WP_Widget::form()`
* @since 1.5.0
*
* @param mixed $instance The instance of the widget.
* @param mixed $instance The instance of the widget.
*/
public function form( $instance ) {
echo __( 'The widget defines the position of the reference container if set to &ldquo;widget area&rdquo;.', 'footnotes' );
@ -98,8 +98,8 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
* @link https://developer.wordpress.org/reference/classes/wp_widget/widget/ `WP_Widget::widget()`
* @since 1.5.0
*
* @param mixed $args The widget's arguments.
* @param mixed $instance The instance of the widget.
* @param mixed $args The widget's arguments.
* @param mixed $instance The instance of the widget.
*/
public function widget( $args, $instance ) {
global $footnotes;