From 7ad975c3896759f09a54aa6ffe773c1110a7740d Mon Sep 17 00:00:00 2001
From: Rumperuu
Date: Fri, 30 Apr 2021 18:03:15 +0100
Subject: [PATCH] docs: update docblocks
---
src/admin/class-footnotes-admin.php | 66 +-
src/admin/class-footnotes-wysiwyg.php | 52 +-
.../layout/class-footnotes-layout-engine.php | 330 +++---
.../layout/class-footnotes-layout-init.php | 65 +-
.../class-footnotes-layout-settings.php | 278 ++---
src/includes/class-footnotes-config.php | 6 +-
src/includes/class-footnotes-convert.php | 6 +-
src/includes/class-footnotes-i18n.php | 3 +-
src/includes/class-footnotes-loader.php | 2 +-
src/includes/class-footnotes-settings.php | 990 +++++++---------
src/includes/class-footnotes-template.php | 3 +-
src/includes/class-footnotes.php | 3 +-
src/public/class-footnotes-parser.php | 1037 ++++-------------
src/public/class-footnotes-public.php | 120 +-
.../widget/class-footnotes-widget-base.php | 64 +-
...s-footnotes-widget-reference-container.php | 67 +-
16 files changed, 1168 insertions(+), 1924 deletions(-)
diff --git a/src/admin/class-footnotes-admin.php b/src/admin/class-footnotes-admin.php
index 05f1ad8..2809853 100644
--- a/src/admin/class-footnotes-admin.php
+++ b/src/admin/class-footnotes-admin.php
@@ -1,56 +1,62 @@
get_sections() as $l_arr_section ) {
@@ -174,10 +215,12 @@ abstract class Footnotes_Layout_Engine {
}
/**
- * Registers all Meta boxes for a sub page.
+ * Registers all Meta boxes for a sub-page.
*
- * @since 1.5.0
- * @param string $p_str_parent_id Parent section unique id.
+ * @access private
+ * @param string $p_str_parent_id Parent section unique ID.
+ *
+ * @since 1.5.0
*/
private function register_meta_boxes( $p_str_parent_id ) {
// Iterate through each meta box.
@@ -196,12 +239,14 @@ abstract class Footnotes_Layout_Engine {
}
/**
- * Append javascript and css files for specific sub page.
+ * Append JavaScript and CSS files for specific sub-page.
+ *
+ * @access private
*
* @since 1.5.0
+ * @todo Move to {@see Footnotes_Admin}.
*/
private function append_scripts() {
- // TODO: Move to `Footnotes_Admin`.
wp_enqueue_script( 'postbox' );
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' );
@@ -209,15 +254,14 @@ abstract class Footnotes_Layout_Engine {
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
/**
- * Displays the content of specific sub page.
+ * Displays the content of specific sub-page.
*
* @since 1.5.0
+ * @todo Review nonce verification.
*/
public function display_content() {
$this->append_scripts();
- // TODO: add nonce verification.
-
// Get the current section.
reset( $this->a_arr_sections );
$l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections );
@@ -276,14 +320,17 @@ abstract class Footnotes_Layout_Engine {
echo '});';
echo '';
}
- // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
+ // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
/**
- * Save all Plugin settings.
+ * Save all plugin settings.
*
- * @since 1.5.0
- * @return bool
+ * @access private
+ * @return bool `true` on save success, else `false`.
+ *
+ * @since 1.5.0
+ * @todo Review nonce verification.
*/
private function save_settings() {
$l_arr_new_settings = array();
@@ -309,35 +356,31 @@ abstract class Footnotes_Layout_Engine {
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
/**
- * Output the Description of a section. May be overwritten in any section.
+ * Output the description of a section. May be overwritten in any section.
*
- * @since 1.5.0
+ * @since 1.5.0
+ * @todo Required? Should be `abstract`?
*/
public function description() {
// Default no description will be displayed.
}
/**
- * Loads specific setting and returns an array with the keys [id, name, value].
+ * Loads a specified setting.
*
- * @since 1.5.0
- * @param string $p_str_setting_key_name Settings Array key name.
- * @return array Contains Settings ID, Settings Name and Settings Value.
+ * @access protected
+ * @param string $p_str_setting_key_name Setting key.
+ * @return array {
+ * A configurable setting.
*
- * @since 2.5.11 Remove escapement function.
- * When refactoring the codebase after 2.5.8, all and every output was escaped.
- * After noticing that the plugin was broken, all escapement functions were removed.
- * @link https://github.com/markcheret/footnotes/pull/50/commits/25c3f2f12eb5de1079e9215bf624ec4289b095a5
- * @link https://github.com/markcheret/footnotes/pull/50#issuecomment-787624123
- * In that process, this instance of esc_attr() was removed too, so the plugin was
- * broken again.
- * @link https://github.com/markcheret/footnotes/pull/50/commits/25c3f2f12eb5de1079e9215bf624ec4289b095a5#diff-a8ed6e859c32a18fc10bbbad3b4dd8ce7f43f2378d29471c7638e314ab30f1bdL349-L354
+ * @type string $id Setting key.
+ * @type string $name Setting name.
+ * @type string $value Setting value.
+ * }
*
- * @since 2.5.15 To fix it, the data was escaped in add_select_box() instead.
- * @since 2.6.1 Restore esc_attr() in load_setting().
- * @see add_select_box()
- * This is the only instance of esc_|kses|sanitize in the pre-2.5.11 codebase.
- * Removing this did not fix the quotation mark backslash escapement bug.
+ * @since 1.5.0
+ * @since 2.5.11 Broken due to accidental removal of `esc_attr()` call.
+ * @since 2.6.1 Restore `esc_attr()` call.
*/
protected function load_setting( $p_str_setting_key_name ) {
// Get current section.
@@ -348,45 +391,31 @@ abstract class Footnotes_Layout_Engine {
$p_arr_return['value'] = esc_attr( Footnotes_Settings::instance()->get( $p_str_setting_key_name ) );
return $p_arr_return;
}
-
+
/**
- * Returns a line break to start a new line.
+ * Returns a simple text inside HTML `` element.
+ *
+ * @access protected
+ * @param string $p_str_text Message to be surrounded with `` tags.
+ * @return string
*
* @since 1.5.0
- * @return string
- */
- protected function add_newline() {
- return ' ';
- }
-
- /**
- * Returns a line break to have a space between two lines.
- *
- * @since 1.5.0
- * @return string
- */
- protected function add_line_space() {
- return '
';
- }
-
- /**
- * Returns a simple text inside html text.
- *
- * @since 1.5.0
- * @param string $p_str_text Message to be surrounded with simple html tag (span).
- * @return string
+ * @todo Refactor HTML generation.
*/
protected function add_text( $p_str_text ) {
return sprintf( '%s', $p_str_text );
}
/**
- * Returns the html tag for an input/select label.
+ * Returns the HTML tag for an ``/`
|
]*>)#', '#(|
]*>)#' );
@@ -2048,11 +1549,7 @@ class Footnotes_Parser {
$l_str_tooltip_content = '';
}
- /**
- * Determine shrink width if alternative tooltips are enabled.
- *
- * @since 2.5.6
- */
+ // Determine shrink width if alternative tooltips are enabled.
$l_str_tooltip_style = '';
if ( Footnotes_Public::$a_bool_alternative_tooltips_enabled && Footnotes_Public::$a_bool_tooltips_enabled ) {
$l_int_tooltip_length = strlen( wp_strip_all_tags( $l_str_tooltip_content ) );
@@ -2125,29 +1622,10 @@ class Footnotes_Parser {
$l_int_footnote_index++;
}
- /**
+ /*
* Fixes a partial footnotes process outage happening when tooltips are truncated or disabled.
* Fixed a footnotes numbering bug happening under de facto rare circumstances.
*
- * - Bugfix: Fixed occasional bug where footnote ordering could be out of sequence
- *
- * @since 1.6.4
- * @committer @dartiss
- * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/task.php?rev=1445718 @dartiss’ class/task.php
- * @link https://plugins.trac.wordpress.org/log/footnotes/trunk/class/task.php?rev=1445718 @dartiss re-added class/task.php
- * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class?rev=1445711 class/ w/o task.php
- * @link https://plugins.trac.wordpress.org/changeset/1445711/footnotes/trunk/class @dartiss deleted class/task.php
- * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/task.php?rev=1026210 @aricura’s latest class/task.php
- *
- * - Bugfix: Process: fix numbering bug impacting footnote #2 with footnote #1 close to start, thanks to @rumperuu bug report, thanks to @lolzim code contribution.
- *
- * @reporter @rumperuu
- * @link https://wordpress.org/support/topic/footnotes-numbered-incorrectly/
- *
- * @contributor @lolzim
- * @link https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-14062032
- *
- * @since 2.5.5
* This assignment was overridden by another one, causing the algorithm to jump back
* near the post start to a position calculated as the sum of the length of the last
* footnote and the length of the last footnote replace text.
@@ -2157,18 +1635,6 @@ class Footnotes_Parser {
* Deleting both lines instead, to resume the search at the position where it left off,
* would have prevented also the following bug.
*
- * - Bugfix: Process: fix issue that caused some footnotes to not be processed, thanks to @docteurfitness @rkupadhya @offpeakdesign bug reports.
- *
- * @reporter @docteurfitness
- * @link https://wordpress.org/support/topic/problem-since-footnotes-2-5-14/
- *
- * @reporter @rkupadhya
- * @link https://wordpress.org/support/topic/adjacent-footnotes-not-working-sometimes/
- *
- * @reporter @offpeakdesign
- * @link https://wordpress.org/support/topic/character-limit-bug/
- *
- * @since 2.6.6
* The origin of the bug was present since the beginning (v1.0.0).
* For v1.3.2 the wrong code was refactored but remained wrong,
* and was unaffected by the v1.5.0 refactoring.
@@ -2190,15 +1656,9 @@ class Footnotes_Parser {
/**
* Generates the reference container.
*
- * @since 1.5.0
- * @return string
+ * @since 1.5.0
*
- * @since 2.0.0 Update: remove backlink symbol along with column 2 of the reference container
- * @since 2.0.3 Bugfix: prepend an arrow on user request
- * @since 2.0.6 Bugfix: Reference container: fix line breaking behavior in footnote number clusters.
- * @since 2.0.4 Bugfix: restore the arrow select and backlink symbol input settings
- * @since 2.1.1 Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report.
- * @since 2.1.1 Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback.
+ * @return string
*/
public function reference_container() {
@@ -2207,16 +1667,10 @@ class Footnotes_Parser {
return '';
}
- /**
+ /*
* Footnote index backlink symbol.
- *
- * - Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback.
- *
- * @reporter @spaceling
- * @link https://wordpress.org/support/topic/change-the-position-5/page/2/#post-13671138
- *
- * @since 2.1.1
*/
+
// If the backlink symbol is enabled.
if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) {
@@ -2244,18 +1698,9 @@ class Footnotes_Parser {
}
- /**
+ /*
* Backlink separator.
*
- * - Bugfix: Reference container: make separating and terminating punctuation optional and configurable, thanks to @docteurfitness issue report and code contribution.
- *
- * @reporter @docteurfitness
- * @link https://wordpress.org/support/topic/update-2-1-3/
- *
- * @contributor @docteurfitness
- * @link https://wordpress.org/support/topic/update-2-1-3/#post-13704194
- *
- * @since 2.1.4
* Initially an appended comma was hard-coded in this algorithm for enumerations.
* The comma in enumerations is not universally preferred.
*/
@@ -2285,14 +1730,10 @@ class Footnotes_Parser {
$l_str_separator = '';
}
- /**
+ /*
* Backlink terminator.
*
* Initially a dot was appended in the table row template.
- *
- * @since 2.0.6 a dot after footnote numbers is discarded as not localizable;
- * making it optional was envisaged.
- * @since 2.1.4 the terminator is optional, has options, and is configurable.
*/
if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED ) ) ) {
@@ -2320,13 +1761,9 @@ class Footnotes_Parser {
$l_str_terminator = '';
}
- /**
+ /*
* Line breaks.
*
- * - Bugfix: Reference container: Backlinks: fix stacked enumerations by adding optional line breaks.
- *
- * @since 2.1.4
- *
* The backlinks of combined footnotes are generally preferred in an enumeration.
* But when few footnotes are identical, stacking the items in list form is better.
* Variable number length and proportional character width require explicit line breaks.
@@ -2334,7 +1771,7 @@ class Footnotes_Parser {
*/
$l_str_line_break = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED ) ) ? ' ' : ' ';
- /**
+ /*
* Line breaks for source readability.
*
* For maintenance and support, table rows in the reference container should be
@@ -2343,12 +1780,8 @@ class Footnotes_Parser {
*/
$l_str_body = "\r\n\r\n";
- /**
+ /*
* Reference container table row template load.
- *
- * - Bugfix: Reference container: option to restore pre-2.0.0 layout with the backlink symbol in an extra column.
- *
- * @since 2.1.1
*/
$l_bool_combine_identical_footnotes = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES ) );
@@ -2411,20 +1844,8 @@ class Footnotes_Parser {
}
}
- /**
+ /*
* Switch backlink symbol and footnote number.
- *
- * - Bugfix: Reference container: option to append symbol (prepended by default), thanks to @spaceling code contribution.
- *
- * @since 2.1.1
- *
- * @contributor @spaceling
- * @link https://wordpress.org/support/topic/change-the-position-5/#post-13615994
- *
- *
- * - Bugfix: Reference container: Backlink symbol: support for appending when combining identicals is on.
- *
- * @since 2.1.4
*/
$l_bool_symbol_switch = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) );
@@ -2458,18 +1879,14 @@ class Footnotes_Parser {
if ( self::$a_bool_hard_links_enabled ) {
- /**
+ /*
* Use-Backbutton-Hint tooltip, optional and configurable.
*
- * - Update: Reference container: Hard backlinks (optional): optional configurable tooltip hinting to use the backbutton instead, thanks to @theroninjedi47 bug report.
- *
- * @reporter @theroninjedi47
- * @link https://wordpress.org/support/topic/hyperlinked-footnotes-creating-excessive-back-history/
- *
- * @since 2.5.4
* When hard links are enabled, clicks on the backlinks are logged in the browsing history.
* This tooltip hints to use the backbutton instead, so the history gets streamlined again.
* @link https://wordpress.org/support/topic/making-it-amp-compatible/#post-13837359
+ *
+ * @since 2.5.4
*/
if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) {
$l_str_use_backbutton_hint = ' title="';
@@ -2505,19 +1922,16 @@ class Footnotes_Parser {
$l_str_footnote_anchor_element = '';
}
- /**
+ /*
* Support for combining identicals: compose enumerated backlinks.
*
- * - Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report.
- *
- * @reporter @happyches
- * @link https://wordpress.org/support/topic/custom-css-for-jumbled-references/
- *
- * @since 2.1.1
* Prepare to have single footnotes, where the click event and
* optional hard link need to be set to cover the table cell,
* for better usability and UX.
+ *
+ * @since 2.1.1
*/
+
// Set a flag to check for the combined status of a footnote item.
$l_bool_flag_combined = false;
@@ -2546,7 +1960,7 @@ class Footnotes_Parser {
/*
* The click event goes in the table cell if footnote remains single.
*/
- // Reverted wrong linting.
+
$l_str_backlink_event = ' onclick="footnote_moveToAnchor_';
$l_str_backlink_event .= self::$a_int_post_id;
@@ -2721,14 +2135,9 @@ class Footnotes_Parser {
// Streamline.
$l_bool_collapse_default = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) );
- /**
+ /*
* Reference container label.
*
- * - Bugfix: Reference container: Label: set empty label to U+202F NNBSP for more robustness, thanks to @lukashuggenberg feedback.
- *
- * @reporter @lukashuggenberg
- *
- * @since 2.4.0
* Themes may drop-cap a first letter of initial paragraphs, like this label.
* In case of empty label that would apply to the left half button character.
* Hence the point in setting an empty label to U+202F NARROW NO-BREAK SPACE.
diff --git a/src/public/class-footnotes-public.php b/src/public/class-footnotes-public.php
index 7df55d1..c169c00 100644
--- a/src/public/class-footnotes-public.php
+++ b/src/public/class-footnotes-public.php
@@ -2,101 +2,106 @@
/**
* The public-facing functionality of the plugin.
*
- * @since 2.8.0
- *
- * @package footnotes
- * @subpackage public
+ * @package footnotes\public
+ * @since 2.8.0
*/
/**
- * The public-facing functionality of the plugin.
+ * Class provide all admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and enqueues all public-facing stylesheets
* and JavaScript.
*
- * @package footnotes
- * @subpackage public
+ * @package footnotes\public
+ * @since 2.8.0
*/
class Footnotes_Public {
/**
* The ID of this plugin.
*
- * @since 2.8.0
- * @access private
- * @var string $plugin_name The ID of this plugin.
+ * @since 2.8.0
+
+ * @access private
+ * @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
- * @since 2.8.0
- * @access private
- * @var string $version The current version of this plugin.
+ * @since 2.8.0
+
+ * @access private
+ * @var string $version The current version of this plugin.
*/
private $version;
/**
* The reference container widget.
*
- * @since 2.8.0
- * @var Footnotes_Widget_Reference_Container $reference_container_widget The reference container widget
+ * @since 2.8.0
+ *
+ * @var Footnotes_Widget_Reference_Container $reference_container_widget The reference container widget
*/
private $reference_container_widget;
/**
* The footnote parser.
*
- * @since 1.5.0
- * @since 2.8.0 Moved from `Footnotes` to `Footnotes_Public` class.
- * @var Footnote_Parser $task The Plugin task.
+ * @since 1.5.0
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
+ *
+ * @var Footnotes_Parser $task The Plugin task.
*/
public $a_obj_task = null;
/**
* Flag for using tooltips.
*
- * @since 2.4.0
- * @since 2.8.0 Moved from `Footnotes` to `Footnotes_Public` class.
- * @var bool $tooltips_enabled Whether tooltips are enabled or not.
+ * @since 2.4.0
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
+ *
+ * @var bool $tooltips_enabled Whether tooltips are enabled or not.
*/
public static $a_bool_tooltips_enabled = false;
/**
* Allows to determine whether alternative tooltips are enabled.
*
- * @since 2.1.1
- * @since 2.8.0 Moved from `Footnotes` to `Footnotes_Public` class.
- * @var bool
+ * @since 2.1.1
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
+ *
+ * @var bool
*/
public static $a_bool_alternative_tooltips_enabled = false;
/**
* Allows to determine whether AMP compatibility mode is enabled.
*
- * @since 2.6.0 (release)
- * @since 2.8.0 Moved from `Footnotes` to `Footnotes_Public` class.
- * @var bool
+ * @since 2.6.0
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
+ *
+ * @var bool
*/
public static $a_bool_amp_enabled = false;
/**
* Allows to determine the script mode among jQuery or plain JS.
*
- * @since 2.5.6
- * @since 2.8.0 Moved from `Footnotes` to `Footnotes_Public` class.
- * @var str 'js' Plain JavaScript.
- * 'jquery' Use jQuery libraries.
+ * @since 2.5.6
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
+ *
+ * @var string ‘js’ to use plain JavaScript, ‘jquery’ to use jQuery.
*/
public static $a_str_script_mode = 'js';
/**
* 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.
+ * @since 2.8.0
+ * @param string $plugin_name The name of this plugin.
+ * @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
@@ -118,11 +123,10 @@ class Footnotes_Public {
* Include the following files that provide the public-facing functionality
* of this plugin:
*
- * - `Footnotes_Parser`. Parses Posts and Pages for footnote shortcodes.
- * - `Footnotes_Widget_Reference_Container`. Defines the Reference Container widget.
+ * - {@see Footnotes_Parser}: parses Posts and Pages for footnote shortcodes; and
+ * - {@see Footnotes_Widget_Reference_Container}: defines the Reference Container widget.
*
- * @since 2.8.0
- * @access private
+ * @since 2.8.0
*/
private function load_dependencies() {
// TODO: neaten up and document once placements and names are settled.
@@ -141,12 +145,12 @@ class Footnotes_Public {
/**
* Register the stylesheets for the public-facing side of the site.
*
- * Enables enqueuing the formatted individual stylesheets if `PRODCUTION_ENV`
- * is true (set in `footnotes.php`).
+ * Enables enqueuing the formatted individual stylesheets if {@see PRODUCTION_ENV}
+ * is `true`.
*
- * @since 1.5.0
- * @since 2.5.5 Change stylesheet scheme.
- * @since 2.8.0 Moved from `Footnotes` to `Footnotes_Public` class.
+ * @since 1.5.0
+ * @since 2.5.5 Change stylesheet schema.
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
*/
public function enqueue_styles() {
if ( PRODUCTION_ENV ) {
@@ -207,22 +211,20 @@ class Footnotes_Public {
/**
* Register the JavaScript for the public-facing side of the site.
*
- * @since 1.5.0
- * @since 2.0.0 Add jQueryUI dependency.
- * @since 2.1.2 Add jQuery Tools dependency.
- * @since 2.5.6 Add jQuery dependency.
- * @since 2.8.0 Moved from `Footnotes` to `Footnotes_Public` class.
+ * @since 1.5.0
+ * @since 2.0.0 Add jQueryUI dependency.
+ * @since 2.1.2 Add jQuery Tools dependency.
+ * @since 2.5.6 Add jQuery dependency.
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
*/
public function enqueue_scripts() {
- /**
+ /*
* Enqueues the jQuery library registered by WordPress.
*
* As jQuery is also used for animated scrolling, it was loaded by default.
* The function `wp_enqueue_script()` avoids loading the same library multiple times.
* After adding the alternative reference container, jQuery has become optional,
* but still enabled by default.
- *
- * @since 2.5.6
*/
if ( ! self::$a_bool_amp_enabled ) {
@@ -233,24 +235,20 @@ class Footnotes_Public {
}
if ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) {
- /**
+ /*
* Enqueues the jQuery Tools library shipped with the plugin.
*
- * Redacted jQuery.browser, completed minification;
+ * Redacted `jQuery.browser`, completed minification;
* see full header in `public/js/jquery.tools.js`.
- * No '-js' in the handle, is appended automatically.
+ * No ‘-js’ in the handle, is appended automatically.
* Deferring to the footer breaks jQuery tooltip display.
- *
- * @since 2.1.2
*/
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jquery.tools' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.js', array(), '1.2.7.redacted.2', false );
- /**
+ /*
* Enqueues some jQuery UI libraries registered by WordPress.
*
* If alternative tooltips are enabled, these libraries are not needed.
- *
- * @since 2.0.0
*/
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-widget' );
@@ -265,8 +263,8 @@ class Footnotes_Public {
/**
* Register the widget(s) for the public-facing side of the site.
*
- * @since 1.5.0
- * @since 2.8.0 Moved to `Footnotes_Public` class.
+ * @since 1.5.0
+ * @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}.
*/
public function register_widgets() {
register_widget( $this->reference_container_widget );
diff --git a/src/public/widget/class-footnotes-widget-base.php b/src/public/widget/class-footnotes-widget-base.php
index e7b8e63..584d6b8 100644
--- a/src/public/widget/class-footnotes-widget-base.php
+++ b/src/public/widget/class-footnotes-widget-base.php
@@ -1,73 +1,74 @@
echo the Widget Content
- * **public function form($instance)** -> echo the Settings of the Widget
+ * Base class to be extended by all widget sub-classes.
*
- * @author Stefan Herndler
- * @since 1.5.0
+ * Any sub-class must override the appropriate method(s) provided by
+ * {@link https://developer.wordpress.org/reference/classes/wp_widget/#description `WP_Widget`}.
*
- * @package footnotes
- * @subpackage public_widget
+ * @abstract
+ *
+ * @package footnotes\public\widget
+ * @since 1.5.0
+ * @todo Review implemenation of Widgets API.
*/
abstract class Footnotes_Widget_Base extends WP_Widget {
/**
* Returns an unique ID as string used for the Widget Base ID.
*
- * @since 1.5.0
- * @return string
+ * @abstract
+ * @since 1.5.0
+ *
+ * @return string
*/
abstract protected function get_id();
/**
* Returns the Public name of child Widget to be displayed in the Configuration page.
*
- * @since 1.5.0
- * @return string
+ * @abstract
+ * @since 1.5.0
+ *
+ * @return string
*/
abstract protected function get_name();
/**
* Returns the Description of the child widget.
*
- * @since 1.5.0
- * @return string
+ * @abstract
+ * @since 1.5.0
+ *
+ * @return string
*/
abstract protected function get_description();
/**
* Returns the width of the Widget. Default width is 250 pixel.
*
- * @since 1.5.0
- * @return int
+ * @since 1.5.0
+ *
+ * @return int
*/
protected function get_widget_width() {
return 250;
}
-
+
/**
- * Class Constructor. Registers the child Widget to WordPress.
+ * Registers the child Widget to WordPress.
*
- * @since 1.5.0
- *
- * - Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution.
- *
- * @since 1.6.4
- * @contributor @dartiss
- * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/widgets/base.php?rev=1445720
- * “The called constructor method for WP_Widget in Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.”
+ * @since 1.5.0
*/
public function __construct() {
$l_arr_widget_options = array(
@@ -86,4 +87,5 @@ abstract class Footnotes_Widget_Base extends WP_Widget {
$l_arr_control_options // Optional Widget Control Options.
);
}
+
}
diff --git a/src/public/widget/class-footnotes-widget-reference-container.php b/src/public/widget/class-footnotes-widget-reference-container.php
index faf6216..d4bd527 100644
--- a/src/public/widget/class-footnotes-widget-reference-container.php
+++ b/src/public/widget/class-footnotes-widget-reference-container.php
@@ -1,11 +1,13 @@
plugin_name;
@@ -63,34 +71,35 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
/**
* Returns the Description of the child widget.
*
- * @since 1.5.0
- * @return string
+ * @see Footnotes_Widget_Base::get_description()
+ * @since 1.5.0
*
- * Edit: curly quotes 2.2.0
+ * @return string
*/
protected function get_description() {
- return __( 'The widget defines the position of the reference container if set to “widget area”.', 'footnotes' );
+ return __( 'The widget defines the position of the reference container if set to “widget area”.', 'footnotes' );
}
/**
* Outputs the Settings of the Widget.
*
- * @since 1.5.0
- * @param mixed $instance The instance of the widget.
- * @return void
+ * @link https://developer.wordpress.org/reference/classes/wp_widget/form/ `WP_Widget::form()`
+ * @since 1.5.0
*
- * Edit: curly quotes 2.2.0
+ * @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 “widget area”.', 'footnotes' );
+ echo __( 'The widget defines the position of the reference container if set to “widget area”.', 'footnotes' );
}
/**
* Outputs the Content of the Widget.
*
- * @since 1.5.0
- * @param mixed $args The widget's arguments.
- * @param mixed $instance The instance of the widget.
+ * @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.
*/
public function widget( $args, $instance ) {
global $footnotes;