chore: lint code
This commit is contained in:
parent
7ad975c389
commit
f0c6b07a84
17 changed files with 257 additions and 269 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
* @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.
|
||||
*
|
||||
* @global bool PRODUCTION_ENV
|
||||
* This primarily affects whether minified or unminified CSS/JS files are
|
||||
* requested.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @uses Footnotes_Activator::activate() Method called on plugin activation.
|
||||
* Handles the activation of the plugin.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @uses Footnotes_Deactivator::deactivate() Method called on plugin deactivation.
|
||||
* Handles the deactivation of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @see Footnotes_Deactivator::deactivate()
|
||||
*/
|
||||
function deactivate_footnotes() {
|
||||
/**
|
||||
* Provides plugin deactivation functionality.
|
||||
*/
|
||||
function deactivate_plugin_name() {
|
||||
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';
|
||||
|
||||
|
|
|
@ -788,7 +788,7 @@ 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
|
||||
*
|
||||
|
@ -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';
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
/**
|
||||
* File providing the `Footnotes_Template` class.
|
||||
*
|
||||
*
|
||||
* @package footnotes
|
||||
* @subpackage includes
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* @package footnotes\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/`.
|
||||
* @since 2.8.0 Rename file from `init.php` to `class-footnotes.php`, rename
|
||||
* `class/` sub-directory to `includes/`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -19,21 +17,17 @@
|
|||
* This is used to define internationalization, admin-specific hooks, and
|
||||
* public-facing site hooks.
|
||||
|
||||
* @package footnotes
|
||||
* @subpackage includes
|
||||
*
|
||||
* @package footnotes\includes
|
||||
* @since 1.5.0
|
||||
* @since 2.8.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
|
||||
*
|
||||
* @var Footnotes_Loader $loader Maintains and registers all hooks for the plugin.
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
|
@ -41,7 +35,7 @@ class Footnotes {
|
|||
* The unique identifier of this plugin
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @access protected
|
||||
*
|
||||
* @var string $plugin_name The string used to uniquely identify this plugin.
|
||||
*/
|
||||
protected $plugin_name;
|
||||
|
@ -50,7 +44,8 @@ class Footnotes {
|
|||
* The current version of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @access protected
|
||||
* @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.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
* @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.
|
||||
*
|
||||
* @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
|
||||
* @since 2.8.0
|
||||
* @uses Footnotes_Admin Defines public-facing functionality.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @return void
|
||||
*/
|
||||
private function define_public_hooks() {
|
||||
|
||||
|
@ -214,6 +208,8 @@ class Footnotes {
|
|||
* Runs the loader to execute all of the hooks with WordPress.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public function get_version() {
|
||||
public function get_version(): string {
|
||||
return $this->version;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
@ -830,6 +830,7 @@ 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/
|
||||
*
|
||||
|
@ -873,6 +874,7 @@ 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/
|
||||
|
@ -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.
|
||||
*
|
||||
|
|
Reference in a new issue