chore: lint code
This commit is contained in:
parent
7ad975c389
commit
f0c6b07a84
17 changed files with 257 additions and 269 deletions
|
@ -52,9 +52,9 @@ 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
*
|
||||
* The Admin. Layouts subpackage is composed of the {@see Footnotes_Layout_Engine}
|
||||
* abstract class, which is extended by the {@see Footnotes_Layout_Settings}
|
||||
* sub-class. The subpackage is initialised at runtime by the {@see
|
||||
* sub-class. The subpackage is initialised at runtime by the {@see
|
||||
* Footnotes_Layout_Init} class.
|
||||
*
|
||||
* @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';
|
||||
|
@ -19,7 +19,7 @@ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-footnotes-la
|
|||
* Class to be extended by page layout sub-classes.
|
||||
*
|
||||
* @abstract
|
||||
|
||||
|
||||
* @package footnotes\admin_layout
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -391,12 +391,12 @@ 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 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
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
*
|
||||
* The Admin. Layouts subpackage is composed of the {@see Footnotes_Layout_Engine}
|
||||
* abstract class, which is extended by the {@see Footnotes_Layout_Settings}
|
||||
* sub-class. The subpackage is initialised at runtime by the {@see
|
||||
* sub-class. The subpackage is initialised at runtime by the {@see
|
||||
* Footnotes_Layout_Init} class.
|
||||
*
|
||||
* @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.
|
||||
|
@ -71,7 +71,7 @@ class Footnotes_Layout_Init {
|
|||
add_action( 'wp_ajax_nopriv_footnotes_get_plugin_info', array( $this, 'get_plugin_meta_information' ) );
|
||||
add_action( 'wp_ajax_footnotes_get_plugin_info', array( $this, 'get_plugin_meta_information' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the required dependencies for the layouts pages.
|
||||
*
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
*
|
||||
* The Admin. Layouts subpackage is composed of the {@see Footnotes_Layout_Engine}
|
||||
* abstract class, which is extended by the {@see Footnotes_Layout_Settings}
|
||||
* sub-class. The subpackage is initialised at runtime by the {@see
|
||||
* sub-class. The subpackage is initialised at runtime by the {@see
|
||||
* Footnotes_Layout_Init} class.
|
||||
*
|
||||
* @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.
|
||||
|
@ -1266,7 +1267,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
|
|||
);
|
||||
|
||||
/*
|
||||
* Call {@see Footnotes_Parser::footnotes_output_head()} function to get
|
||||
* Call {@see Footnotes_Parser::footnotes_output_head()} function to get
|
||||
* the styling of the mouse-over box.
|
||||
*
|
||||
* The name of the callback function ought to be distinct from
|
||||
|
|
|
@ -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,18 +90,18 @@ 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';
|
||||
|
||||
/**
|
||||
* Begins execution of the plugin.
|
||||
*
|
||||
* Since everything within the plugin is registered via hooks, then kicking off
|
||||
* 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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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/`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -167,7 +167,7 @@ class Footnotes_Parser {
|
|||
* @var string
|
||||
*/
|
||||
public static $a_str_link_close_tag = '';
|
||||
|
||||
|
||||
/*
|
||||
* Dedicated tooltip text.
|
||||
*
|
||||
|
@ -222,7 +222,7 @@ class Footnotes_Parser {
|
|||
/**
|
||||
* Footnote delimiter start short code in RegEx format.
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @since 2.4.0
|
||||
* @since 2.6.2 Move from global constant to class property.
|
||||
* @var string
|
||||
*/
|
||||
|
@ -312,10 +312,11 @@ class Footnotes_Parser {
|
|||
/**
|
||||
* Hook for category pages.
|
||||
*
|
||||
* Category pages can have rich HTML content in a term description with
|
||||
* Category pages can have rich HTML content in a term description with
|
||||
* article status.
|
||||
* For this to happen, WordPress' built-in partial HTML blocker needs to
|
||||
* 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 ) {
|
||||
|
@ -1021,7 +1023,7 @@ class Footnotes_Parser {
|
|||
/*
|
||||
* Reference container customized positioning through shortcode.
|
||||
*/
|
||||
|
||||
|
||||
// Append the reference container or insert at shortcode.
|
||||
$l_str_reference_container_position_shortcode = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE );
|
||||
if ( empty( $l_str_reference_container_position_shortcode ) ) {
|
||||
|
@ -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 ) {
|
||||
|
@ -1146,7 +1148,7 @@ class Footnotes_Parser {
|
|||
* If footnotes short codes are unbalanced, and syntax validation is not disabled,
|
||||
* prepend a warning to the content; displays de facto beneath the post title.
|
||||
*/
|
||||
|
||||
|
||||
// If enabled.
|
||||
if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) {
|
||||
|
||||
|
@ -1207,7 +1209,7 @@ class Footnotes_Parser {
|
|||
/*
|
||||
* Patch to allow footnotes in input field labels.
|
||||
*
|
||||
* When the HTML 'input' element 'value' attribute value is derived from
|
||||
* When the HTML 'input' element 'value' attribute value is derived from
|
||||
* 'label', footnotes need to be removed in the value of 'value'.
|
||||
*/
|
||||
$l_str_value_regex = '#(<input [^>]+?value=["\'][^>]+?)' . self::$a_str_start_tag_regex . '[^>]+?' . self::$a_str_end_tag_regex . '#';
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -1670,7 +1663,7 @@ class Footnotes_Parser {
|
|||
/*
|
||||
* Footnote index backlink symbol.
|
||||
*/
|
||||
|
||||
|
||||
// If the backlink symbol is enabled.
|
||||
if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) {
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -1931,7 +1923,7 @@ class Footnotes_Parser {
|
|||
*
|
||||
* @since 2.1.1
|
||||
*/
|
||||
|
||||
|
||||
// Set a flag to check for the combined status of a footnote item.
|
||||
$l_bool_flag_combined = false;
|
||||
|
||||
|
@ -1960,7 +1952,7 @@ class Footnotes_Parser {
|
|||
/*
|
||||
* The click event goes in the table cell if footnote remains single.
|
||||
*/
|
||||
|
||||
|
||||
$l_str_backlink_event = ' onclick="footnote_moveToAnchor_';
|
||||
|
||||
$l_str_backlink_event .= self::$a_int_post_id;
|
||||
|
|
|
@ -21,7 +21,7 @@ class Footnotes_Public {
|
|||
* The ID of this plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
|
||||
|
||||
* @access private
|
||||
* @var string $plugin_name The ID of this plugin.
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@ class Footnotes_Public {
|
|||
* The version of this plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
|
||||
|
||||
* @access private
|
||||
* @var string $version The current version of this plugin.
|
||||
*/
|
||||
|
@ -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 ) {
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ abstract class Footnotes_Widget_Base extends WP_Widget {
|
|||
protected function get_widget_width() {
|
||||
return 250;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registers the child Widget to WordPress.
|
||||
*
|
||||
|
@ -87,5 +87,5 @@ abstract class Footnotes_Widget_Base extends WP_Widget {
|
|||
$l_arr_control_options // Optional Widget Control Options.
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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 “widget area”.', '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;
|
||||
|
|
Reference in a new issue