From 205764f91af0506bb50747176213da9b2c5441a9 Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Sun, 2 May 2021 20:46:44 +0100 Subject: [PATCH] refactor: remove Hungarian notation FINALLY close #34 --- src/admin/class-wysiwyg.php | 34 +- src/admin/layout/class-engine.php | 274 ++-- src/admin/layout/class-init.php | 56 +- src/admin/layout/class-settings.php | 716 ++++---- src/includes/class-config.php | 10 +- src/includes/class-convert.php | 112 +- src/includes/class-i18n.php | 2 +- src/includes/class-settings.php | 492 +++--- src/includes/class-template.php | 62 +- src/public/class-general.php | 66 +- src/public/class-parser.php | 1438 ++++++++--------- src/public/widget/class-base.php | 8 +- .../widget/class-reference-container.php | 4 +- 13 files changed, 1637 insertions(+), 1637 deletions(-) diff --git a/src/admin/class-wysiwyg.php b/src/admin/class-wysiwyg.php index 55069dc..d250763 100644 --- a/src/admin/class-wysiwyg.php +++ b/src/admin/class-wysiwyg.php @@ -30,15 +30,15 @@ class WYSIWYG { /** * Append a new Button to the WYSIWYG editor of Posts and Pages. * - * @param string[] $p_arr_buttons Already-defined editor buttons. + * @param string[] $buttons Already-defined editor buttons. * @return string[] * * @since 1.5.0 * @todo Should this be `static`? */ - public static function new_visual_editor_button( array $p_arr_buttons ): array { - $p_arr_buttons[] = 'footnotes'; - return $p_arr_buttons; + public static function new_visual_editor_button( array $buttons ): array { + $buttons[] = 'footnotes'; + return $buttons; } /** @@ -47,24 +47,24 @@ class WYSIWYG { * @since 1.5.0 */ public static function new_plain_text_editor_button(): void { - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'editor-button' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'editor-button' ); // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } /** * Includes the Plugins WYSIWYG editor script. * - * @param string[] $p_arr_plugins Scripts to be included by the editor. + * @param string[] $plugins Scripts to be included by the editor. * @return string[] * * @since 1.5.0 * @todo Should this be `static`? */ - public static function include_scripts( array $p_arr_plugins ): array { - $p_arr_plugins['footnotes'] = plugins_url( '/../admin/js/wysiwyg-editor' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.js', __FILE__ ); - return $p_arr_plugins; + public static function include_scripts( array $plugins ): array { + $plugins['footnotes'] = plugins_url( '/../admin/js/wysiwyg-editor' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.js', __FILE__ ); + return $plugins; } /** @@ -75,16 +75,16 @@ class WYSIWYG { */ public static function ajax_callback(): void { // Get start and end tag for the footnotes short code. - $l_str_starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); - $l_str_ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); - if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) { - $l_str_starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $l_str_ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START ); + $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END ); + if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) { + $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } echo wp_json_encode( array( - 'start' => htmlspecialchars( $l_str_starting_tag ), - 'end' => htmlspecialchars( $l_str_ending_tag ), + 'start' => htmlspecialchars( $starting_tag ), + 'end' => htmlspecialchars( $ending_tag ), ) ); exit; diff --git a/src/admin/layout/class-engine.php b/src/admin/layout/class-engine.php index 8ed60d5..5e44069 100644 --- a/src/admin/layout/class-engine.php +++ b/src/admin/layout/class-engine.php @@ -49,7 +49,7 @@ abstract class Engine { * * @since 1.5.0 */ - protected ?string $a_str_sub_page_hook = null; + protected ?string $sub_page_hook = null; /** * Stores all Sections for the child sub-page. @@ -59,7 +59,7 @@ abstract class Engine { * * @since 1.5.0 */ - protected array $a_arr_sections = array(); + protected array $sections = array(); /** * Returns a Priority index. Lower numbers have a higher priority. @@ -114,10 +114,10 @@ abstract class 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 + * @param string $id Unique ID suffix. + * @param string $title Title of the section. + * @param int $settings_container_index Settings Container index. + * @param bool $has_submit_button Whether a ‘Submit’ button should * be displayed for this section. Default `true`. * @return array { * A dashboard section. @@ -131,12 +131,12 @@ abstract class Engine { * @since 1.5.0 * @todo Refactor sections into their own class? */ - protected function add_section( string $p_str_id, string $p_str_title, int $p_int_settings_container_index, bool $p_bool_has_submit_button = true ): array { + protected function add_section( string $id, string $title, int $settings_container_index, bool $has_submit_button = true ): array { return array( - 'id' => $this->plugin_name . '-' . $p_str_id, - 'title' => $p_str_title, - 'submit' => $p_bool_has_submit_button, - 'container' => $p_int_settings_container_index, + 'id' => $this->plugin_name . '-' . $id, + 'title' => $title, + 'submit' => $has_submit_button, + 'container' => $settings_container_index, ); } @@ -144,10 +144,10 @@ abstract class 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 $section_id Parent section ID. + * @param string $id Unique ID suffix. + * @param string $title Title for the meta box. + * @param string $callback_function_name Class method name for callback. * @return array { * A dashboard meta box. * @@ -161,12 +161,12 @@ abstract class Engine { * @todo Refactor meta boxes into their own class? * @todo Pass actual functions rather than strings? */ - protected function add_meta_box( string $p_str_section_id, string $p_str_id, string $p_str_title, string $p_str_callback_function_name ): array { + protected function add_meta_box( string $section_id, string $id, string $title, string $callback_function_name ): array { return array( - 'parent' => $this->plugin_name . '-' . $p_str_section_id, - 'id' => $p_str_id, - 'title' => $p_str_title, - 'callback' => $p_str_callback_function_name, + 'parent' => $this->plugin_name . '-' . $section_id, + 'id' => $id, + 'title' => $title, + 'callback' => $callback_function_name, ); } @@ -178,20 +178,20 @@ abstract class Engine { public function register_sub_page(): void { global $submenu; - if ( array_key_exists( plugin_basename( Init::C_STR_MAIN_MENU_SLUG ), $submenu ) ) { - foreach ( $submenu[ plugin_basename( Init::C_STR_MAIN_MENU_SLUG ) ] as $l_arr_sub_menu ) { - if ( plugin_basename( Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ) === $l_arr_sub_menu[2] ) { - remove_submenu_page( Init::C_STR_MAIN_MENU_SLUG, Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ); + if ( array_key_exists( plugin_basename( Init::MAIN_MENU_SLUG ), $submenu ) ) { + foreach ( $submenu[ plugin_basename( Init::MAIN_MENU_SLUG ) ] as $sub_menu ) { + if ( plugin_basename( Init::MAIN_MENU_SLUG . $this->get_sub_page_slug() ) === $sub_menu[2] ) { + remove_submenu_page( Init::MAIN_MENU_SLUG, Init::MAIN_MENU_SLUG . $this->get_sub_page_slug() ); } } } - $this->a_str_sub_page_hook = add_submenu_page( - Init::C_STR_MAIN_MENU_SLUG, + $this->sub_page_hook = add_submenu_page( + Init::MAIN_MENU_SLUG, $this->get_sub_page_title(), $this->get_sub_page_title(), 'manage_options', - Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(), + Init::MAIN_MENU_SLUG . $this->get_sub_page_slug(), fn() => $this->display_content() ); } @@ -202,16 +202,16 @@ abstract class Engine { * @since 1.5.0 */ public function register_sections(): void { - foreach ( $this->get_sections() as $l_arr_section ) { + foreach ( $this->get_sections() as $section ) { // Append tab to the tab-array. - $this->a_arr_sections[ $l_arr_section['id'] ] = $l_arr_section; + $this->sections[ $section['id'] ] = $section; add_settings_section( - $l_arr_section['id'], + $section['id'], '', fn() => $this->description(), - $l_arr_section['id'] + $section['id'] ); - $this->register_meta_boxes( $l_arr_section['id'] ); + $this->register_meta_boxes( $section['id'] ); } } @@ -219,21 +219,21 @@ abstract class Engine { * Registers all Meta boxes for a sub-page. * * @access private - * @param string $p_str_parent_id Parent section unique ID. + * @param string $parent_id Parent section unique ID. * * @since 1.5.0 */ - private function register_meta_boxes( string $p_str_parent_id ): void { + private function register_meta_boxes( string $parent_id ): void { // Iterate through each meta box. - foreach ( $this->get_meta_boxes() as $l_arr_meta_box ) { - if ( $p_str_parent_id !== $l_arr_meta_box['parent'] ) { + foreach ( $this->get_meta_boxes() as $meta_box ) { + if ( $parent_id !== $meta_box['parent'] ) { continue; } add_meta_box( - $p_str_parent_id . '-' . $l_arr_meta_box['id'], - $l_arr_meta_box['title'], - array( $this, $l_arr_meta_box['callback'] ), - $p_str_parent_id, + $parent_id . '-' . $meta_box['id'], + $meta_box['title'], + array( $this, $meta_box['callback'] ), + $parent_id, 'main' ); } @@ -262,33 +262,33 @@ abstract class Engine { */ public function display_content(): void { $this->append_scripts(); - $l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->a_arr_sections ); - $l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ]; + $active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->sections ); + $active_section = $this->sections[ $active_section_id ]; // Store settings. - $l_bool_settings_updated = false; + $settings_updated = false; if ( array_key_exists( 'save-settings', $_POST ) && 'save' === $_POST['save-settings'] ) { unset( $_POST['save-settings'] ); unset( $_POST['submit'] ); - $l_bool_settings_updated = $this->save_settings(); + $settings_updated = $this->save_settings(); } // Display all sections and highlight the active section. echo '
'; echo '
'; - if ( $l_bool_settings_updated ) { + if ( $settings_updated ) { echo sprintf( '
%s
', __( 'Settings saved', 'footnotes' ) ); } @@ -296,11 +296,11 @@ abstract class Engine { echo '
'; echo ''; // Outputs the settings field of the active section. - do_settings_sections( $l_arr_active_section['id'] ); - do_meta_boxes( $l_arr_active_section['id'], 'main', null ); + do_settings_sections( $active_section['id'] ); + do_meta_boxes( $active_section['id'], 'main', null ); // Add submit button to active section if defined. - if ( $l_arr_active_section['submit'] ) { + if ( $active_section['submit'] ) { submit_button(); } echo '
'; @@ -311,7 +311,7 @@ abstract class Engine { echo 'jQuery(document).ready(function ($) {'; echo 'jQuery(".footnotes-color-picker").wpColorPicker();'; echo "jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');"; - echo "postboxes.add_postbox_toggles('" . $this->a_str_sub_page_hook . "');"; + echo "postboxes.add_postbox_toggles('" . $this->sub_page_hook . "');"; echo '});'; echo ''; } @@ -328,15 +328,15 @@ abstract class Engine { * @todo Review nonce verification. */ private function save_settings(): bool { - $l_arr_new_settings = array(); - $l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->a_arr_sections ); - $l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ]; + $new_settings = array(); + $active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->sections ); + $active_section = $this->sections[ $active_section_id ]; - foreach ( array_keys( Includes\Settings::instance()->get_defaults( $l_arr_active_section['container'] ) ) as $l_str_key ) { - $l_arr_new_settings[ $l_str_key ] = array_key_exists( $l_str_key, $_POST ) ? wp_unslash( $_POST[ $l_str_key ] ) : ''; + foreach ( array_keys( Includes\Settings::instance()->get_defaults( $active_section['container'] ) ) as $key ) { + $new_settings[ $key ] = array_key_exists( $key, $_POST ) ? wp_unslash( $_POST[ $key ] ) : ''; } // Update settings. - return Includes\Settings::instance()->save_options( $l_arr_active_section['container'], $l_arr_new_settings ); + return Includes\Settings::instance()->save_options( $active_section['container'], $new_settings ); } // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing @@ -354,7 +354,7 @@ abstract class Engine { * Loads a specified setting. * * @access protected - * @param string $p_str_setting_key_name Setting key. + * @param string $setting_key_name Setting key. * @return array { * A configurable setting. * @@ -367,41 +367,41 @@ abstract class Engine { * @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( string $p_str_setting_key_name ): array { + protected function load_setting( string $setting_key_name ): array { // Get current section. - reset( $this->a_arr_sections ); - $p_arr_return = array(); - $p_arr_return['id'] = $p_str_setting_key_name; - $p_arr_return['name'] = $p_str_setting_key_name; - $p_arr_return['value'] = esc_attr( Includes\Settings::instance()->get( $p_str_setting_key_name ) ); - return $p_arr_return; + reset( $this->sections ); + $return = array(); + $return['id'] = $setting_key_name; + $return['name'] = $setting_key_name; + $return['value'] = esc_attr( Includes\Settings::instance()->get( $setting_key_name ) ); + return $return; } /** * Returns a simple text inside a 'span' element. * * @access protected - * @param string $p_str_text Message to be surrounded with `` tags. + * @param string $text Message to be surrounded with `` tags. * * @since 1.5.0 * @todo Refactor HTML generation. */ - protected function add_text( string $p_str_text ): string { - return sprintf( '%s', $p_str_text ); + protected function add_text( string $text ): string { + return sprintf( '%s', $text ); } /** * Returns the HTML tag for a 'label' element. * * @access protected - * @param string $p_str_setting_name Settings key. - * @param string $p_str_caption Label caption. + * @param string $setting_name Settings key. + * @param string $caption Label caption. * * @since 1.5.0 * @todo Refactor HTML generation. */ - protected function add_label( string $p_str_setting_name, string $p_str_caption ): string { - if ( empty( $p_str_caption ) ) { + protected function add_label( string $setting_name, string $caption ): string { + if ( empty( $caption ) ) { return ''; } @@ -416,36 +416,36 @@ abstract class Engine { * {@link https://softwareengineering.stackexchange.com/questions/234546/colons-in-internationalized-ui * style guides}. */ - return sprintf( '', $p_str_setting_name, $p_str_caption ); + return sprintf( '', $setting_name, $caption ); } /** * 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 $setting_name Setting key. + * @param int $max_length Maximum length of the input. Default length 999 chars. + * @param bool $readonly Set the input to be read only. Default `false`. + * @param bool $hidden Set the input to be hidden. Default `false`. * * @since 1.5.0 * @todo Refactor HTML generation. */ - protected function add_text_box( string $p_str_setting_name, int $p_str_max_length = 999, bool $p_bool_readonly = false, bool $p_bool_hidden = false ): string { - $l_str_style = ''; + protected function add_text_box( string $setting_name, int $max_length = 999, bool $readonly = false, bool $hidden = false ): string { + $style = ''; // Collect data for given settings field. - $l_arr_data = $this->load_setting( $p_str_setting_name ); - if ( $p_bool_hidden ) { - $l_str_style .= 'display:none;'; + $data = $this->load_setting( $setting_name ); + if ( $hidden ) { + $style .= 'display:none;'; } return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - $p_str_max_length, - $l_str_style, - $l_arr_data['value'], - $p_bool_readonly ? 'readonly="readonly"' : '' + $data['name'], + $data['id'], + $max_length, + $style, + $data['value'], + $readonly ? 'readonly="readonly"' : '' ); } @@ -453,19 +453,19 @@ abstract class Engine { * Constructs the HTML for a checkbox 'input' element. * * @access protected - * @param string $p_str_setting_name Setting key. + * @param string $setting_name Setting key. * * @since 1.5.0 * @todo Refactor HTML generation. */ - protected function add_checkbox( string $p_str_setting_name ): string { + protected function add_checkbox( string $setting_name ): string { // Collect data for given settings field. - $l_arr_data = $this->load_setting( $p_str_setting_name ); + $data = $this->load_setting( $setting_name ); return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - Includes\Convert::to_bool( $l_arr_data['value'] ) ? 'checked="checked"' : '' + $data['name'], + $data['id'], + Includes\Convert::to_bool( $data['value'] ) ? 'checked="checked"' : '' ); } @@ -473,34 +473,34 @@ abstract class Engine { * Constructs the HTML for a 'select' element. * * @access protected - * @param string $p_str_setting_name Setting key. - * @param array $p_arr_options Possible options. + * @param string $setting_name Setting key. + * @param array $options Possible options. * * @since 1.5.0 * @todo Refactor HTML generation. */ - protected function add_select_box( string $p_str_setting_name, array $p_arr_options ): string { + protected function add_select_box( string $setting_name, array $options ): string { // Collect data for given settings field. - $l_arr_data = $this->load_setting( $p_str_setting_name ); - $l_str_options = ''; + $data = $this->load_setting( $setting_name ); + $options = ''; // Loop through all array keys. - foreach ( $p_arr_options as $l_str_value => $l_str_caption ) { - $l_str_options .= sprintf( + foreach ( $options as $value => $caption ) { + $options .= sprintf( '', - $l_str_value, + $value, // Only check for equality, not identity, WRT backlink symbol arrows. // phpcs:disable WordPress.PHP.StrictComparisons.LooseComparison - $l_str_value == $l_arr_data['value'] ? 'selected' : '', + $value == $data['value'] ? 'selected' : '', // phpcs:enable WordPress.PHP.StrictComparisons.LooseComparison - $l_str_caption + $caption ); } return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - $l_str_options + $data['name'], + $data['id'], + $options ); } @@ -508,19 +508,19 @@ abstract class Engine { * Constructs the HTML for a 'textarea' element. * * @access protected - * @param string $p_str_setting_name Setting key. + * @param string $setting_name Setting key. * * @since 1.5.0 * @todo Refactor HTML generation. */ - protected function add_textarea( $p_str_setting_name ): string { + protected function add_textarea( $setting_name ): string { // Collect data for given settings field. - $l_arr_data = $this->load_setting( $p_str_setting_name ); + $data = $this->load_setting( $setting_name ); return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - $l_arr_data['value'] + $data['name'], + $data['id'], + $data['value'] ); } @@ -529,20 +529,20 @@ abstract class Engine { * class. * * @access protected - * @param string $p_str_setting_name Setting key. + * @param string $setting_name Setting key. * * @since 1.5.6 * @todo Refactor HTML generation. * @todo Use proper colorpicker element. */ - protected function add_color_selection( string $p_str_setting_name ): string { + protected function add_color_selection( string $setting_name ): string { // Collect data for given settings field. - $l_arr_data = $this->load_setting( $p_str_setting_name ); + $data = $this->load_setting( $setting_name ); return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - $l_arr_data['value'] + $data['name'], + $data['id'], + $data['value'] ); } @@ -550,36 +550,36 @@ abstract class Engine { * Constructs the HTML for numeric 'input' element. * * @access protected - * @param string $p_str_setting_name Setting key. + * @param string $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 int $max Maximum value. + * @param bool $deci `true` if float, `false` if integer. Default `false`. * * @since 1.5.0 * @todo Refactor HTML generation. */ - protected function add_num_box( string $p_str_setting_name, int $p_in_min, int $p_int_max, bool $p_bool_deci = false ): string { + protected function add_num_box( string $setting_name, int $p_in_min, int $max, bool $deci = false ): string { // Collect data for given settings field. - $l_arr_data = $this->load_setting( $p_str_setting_name ); + $data = $this->load_setting( $setting_name ); - if ( $p_bool_deci ) { - $l_str_value = number_format( floatval( $l_arr_data['value'] ), 1 ); + if ( $deci ) { + $value = number_format( floatval( $data['value'] ), 1 ); return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - $l_str_value, + $data['name'], + $data['id'], + $value, $p_in_min, - $p_int_max + $max ); } return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - $l_arr_data['value'], + $data['name'], + $data['id'], + $data['value'], $p_in_min, - $p_int_max + $max ); } diff --git a/src/admin/layout/class-init.php b/src/admin/layout/class-init.php index 16f057a..ae41125 100644 --- a/src/admin/layout/class-init.php +++ b/src/admin/layout/class-init.php @@ -34,7 +34,7 @@ class Init { * * @since 1.5.0 */ - const C_STR_MAIN_MENU_SLUG = 'footnotes'; + const MAIN_MENU_SLUG = 'footnotes'; /** * Contains the settings page. @@ -136,9 +136,9 @@ class Init { add_submenu_page( 'options-general.php', 'footnotes Settings', - \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME, + \footnotes\includes\Config::PLUGIN_PUBLIC_NAME, 'manage_options', - self::C_STR_MAIN_MENU_SLUG, + self::MAIN_MENU_SLUG, fn() => $this->settings_page->display_content() ); $this->settings_page->register_sub_page(); @@ -151,58 +151,58 @@ class Init { * @since 1.5.0 */ public function get_plugin_meta_information(): void { - $l_str_plugin_name = null; + $plugin_name = null; // TODO: add nonce verification? // Get plugin internal name from POST data. if ( isset( $_POST['plugin'] ) ) { - $l_str_plugin_name = wp_unslash( $_POST['plugin'] ); + $plugin_name = wp_unslash( $_POST['plugin'] ); } - if ( empty( $l_str_plugin_name ) ) { + if ( empty( $plugin_name ) ) { echo wp_json_encode( array( 'error' => 'Plugin name invalid.' ) ); exit; } - $l_str_url = 'https://api.wordpress.org/plugins/info/1.0/' . $l_str_plugin_name . '.json'; + $url = 'https://api.wordpress.org/plugins/info/1.0/' . $plugin_name . '.json'; // Call URL and collect data. - $l_arr_response = wp_remote_get( $l_str_url ); + $response = wp_remote_get( $url ); // Check if response is valid. - if ( is_wp_error( $l_arr_response ) ) { + if ( is_wp_error( $response ) ) { echo wp_json_encode( array( 'error' => 'Error receiving Plugin Information from WordPress.' ) ); exit; } - if ( ! array_key_exists( 'body', $l_arr_response ) ) { + if ( ! array_key_exists( 'body', $response ) ) { echo wp_json_encode( array( 'error' => 'Error reading WordPress API response message.' ) ); exit; } // Get the body of the response. - $l_str_response = $l_arr_response['body']; + $response = $response['body']; // Get plugin object. - $l_arr_plugin = json_decode( $l_str_response, true, 512, JSON_THROW_ON_ERROR ); - if ( empty( $l_arr_plugin ) ) { - echo wp_json_encode( array( 'error' => 'Error reading Plugin meta information.
URL: ' . $l_str_url . '
Response: ' . $l_str_response ) ); + $plugin = json_decode( $response, true, 512, JSON_THROW_ON_ERROR ); + if ( empty( $plugin ) ) { + echo wp_json_encode( array( 'error' => 'Error reading Plugin meta information.
URL: ' . $url . '
Response: ' . $response ) ); exit; } - $l_int_num_ratings = array_key_exists( 'num_ratings', $l_arr_plugin ) ? (int) $l_arr_plugin['num_ratings'] : 0; - $l_int_rating = array_key_exists( 'rating', $l_arr_plugin ) ? floatval( $l_arr_plugin['rating'] ) : 0.0; - $l_int_stars = round( 5 * $l_int_rating / 100.0, 1 ); + $num_ratings = array_key_exists( 'num_ratings', $plugin ) ? (int) $plugin['num_ratings'] : 0; + $rating = array_key_exists( 'rating', $plugin ) ? floatval( $plugin['rating'] ) : 0.0; + $stars = round( 5 * $rating / 100.0, 1 ); // Return Plugin information as JSON encoded string. echo wp_json_encode( array( 'error' => '', - 'PluginDescription' => array_key_exists( 'short_description', $l_arr_plugin ) ? html_entity_decode( $l_arr_plugin['short_description'] ) : 'Error reading Plugin information', - 'PluginAuthor' => array_key_exists( 'author', $l_arr_plugin ) ? html_entity_decode( $l_arr_plugin['author'] ) : 'unknown', - 'PluginRatingText' => $l_int_stars . ' ' . __( 'rating based on', 'footnotes' ) . ' ' . $l_int_num_ratings . ' ' . __( 'ratings', 'footnotes' ), - 'PluginRating1' => $l_int_stars >= 0.5 ? 'star-full' : 'star-empty', - 'PluginRating2' => $l_int_stars >= 1.5 ? 'star-full' : 'star-empty', - 'PluginRating3' => $l_int_stars >= 2.5 ? 'star-full' : 'star-empty', - 'PluginRating4' => $l_int_stars >= 3.5 ? 'star-full' : 'star-empty', - 'PluginRating5' => $l_int_stars >= 4.5 ? 'star-full' : 'star-empty', - 'PluginRating' => $l_int_num_ratings, - 'PluginLastUpdated' => array_key_exists( 'last_updated', $l_arr_plugin ) ? $l_arr_plugin['last_updated'] : 'unknown', - 'PluginDownloads' => array_key_exists( 'downloaded', $l_arr_plugin ) ? $l_arr_plugin['downloaded'] : '---', + 'PluginDescription' => array_key_exists( 'short_description', $plugin ) ? html_entity_decode( $plugin['short_description'] ) : 'Error reading Plugin information', + 'PluginAuthor' => array_key_exists( 'author', $plugin ) ? html_entity_decode( $plugin['author'] ) : 'unknown', + 'PluginRatingText' => $stars . ' ' . __( 'rating based on', 'footnotes' ) . ' ' . $num_ratings . ' ' . __( 'ratings', 'footnotes' ), + 'PluginRating1' => $stars >= 0.5 ? 'star-full' : 'star-empty', + 'PluginRating2' => $stars >= 1.5 ? 'star-full' : 'star-empty', + 'PluginRating3' => $stars >= 2.5 ? 'star-full' : 'star-empty', + 'PluginRating4' => $stars >= 3.5 ? 'star-full' : 'star-empty', + 'PluginRating5' => $stars >= 4.5 ? 'star-full' : 'star-empty', + 'PluginRating' => $num_ratings, + 'PluginLastUpdated' => array_key_exists( 'last_updated', $plugin ) ? $plugin['last_updated'] : 'unknown', + 'PluginDownloads' => array_key_exists( 'downloaded', $plugin ) ? $plugin['downloaded'] : '---', ) ); exit; diff --git a/src/admin/layout/class-settings.php b/src/admin/layout/class-settings.php index 64f0010..b5dc4ce 100644 --- a/src/admin/layout/class-settings.php +++ b/src/admin/layout/class-settings.php @@ -74,7 +74,7 @@ class Settings extends Engine { * @return string */ protected function get_sub_page_title(): string { - return \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME; + return \footnotes\includes\Config::PLUGIN_PUBLIC_NAME; } /** @@ -87,19 +87,19 @@ class Settings extends Engine { * @since 2.1.6 Remove conditional rendering of ‘Expert’ tab. */ protected function get_sections(): array { - $l_arr_tabs = array(); + $tabs = array(); // Sync tab name with mirror in task.php. - $l_arr_tabs[] = $this->add_section( 'settings', __( 'General settings', 'footnotes' ), 0, true ); + $tabs[] = $this->add_section( 'settings', __( 'General settings', 'footnotes' ), 0, true ); // Sync tab name with mirror in public function custom_css_migration(). - $l_arr_tabs[] = $this->add_section( 'customize', __( 'Referrers and tooltips', 'footnotes' ), 1, true ); + $tabs[] = $this->add_section( 'customize', __( 'Referrers and tooltips', 'footnotes' ), 1, true ); - $l_arr_tabs[] = $this->add_section( 'expert', __( 'Scope and priority', 'footnotes' ), 2, true ); - $l_arr_tabs[] = $this->add_section( 'customcss', __( 'Custom CSS', 'footnotes' ), 3, true ); - $l_arr_tabs[] = $this->add_section( 'how-to', __( 'Quick start guide', 'footnotes' ), 4, false ); + $tabs[] = $this->add_section( 'expert', __( 'Scope and priority', 'footnotes' ), 2, true ); + $tabs[] = $this->add_section( 'customcss', __( 'Custom CSS', 'footnotes' ), 3, true ); + $tabs[] = $this->add_section( 'how-to', __( 'Quick start guide', 'footnotes' ), 4, false ); - return $l_arr_tabs; + return $tabs; } /** @@ -113,42 +113,42 @@ class Settings extends Engine { * @since 2.2.0 Re-order and rename tabs. */ protected function get_meta_boxes(): array { - $l_arr_meta_boxes = array(); + $meta_boxes = array(); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'amp-compat', __( 'AMP compatibility', 'footnotes' ), 'amp_compat' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'start-end', __( 'Footnote start and end short codes', 'footnotes' ), 'start_end' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'numbering', __( 'Footnotes numbering', 'footnotes' ), 'numbering' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'scrolling', __( 'Scrolling behavior', 'footnotes' ), 'scrolling' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'hard-links', __( 'URL fragment ID configuration', 'footnotes' ), 'hard_links' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'reference-container', __( 'Reference container', 'footnotes' ), 'reference_container' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'excerpts', __( 'Footnotes in excerpts', 'footnotes' ), 'excerpts' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'love', \footnotes\includes\Config::C_STR_PLUGIN_HEADING_NAME . ' ' . \footnotes\includes\Config::C_STR_LOVE_SYMBOL_HEADING, 'love' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'amp-compat', __( 'AMP compatibility', 'footnotes' ), 'amp_compat' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'start-end', __( 'Footnote start and end short codes', 'footnotes' ), 'start_end' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'numbering', __( 'Footnotes numbering', 'footnotes' ), 'numbering' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'scrolling', __( 'Scrolling behavior', 'footnotes' ), 'scrolling' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'hard-links', __( 'URL fragment ID configuration', 'footnotes' ), 'hard_links' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'reference-container', __( 'Reference container', 'footnotes' ), 'reference_container' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'excerpts', __( 'Footnotes in excerpts', 'footnotes' ), 'excerpts' ); + $meta_boxes[] = $this->add_meta_box( 'settings', 'love', \footnotes\includes\Config::PLUGIN_HEADING_NAME . ' ' . \footnotes\includes\Config::LOVE_SYMBOL_HEADING, 'love' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'hyperlink-arrow', __( 'Backlink symbol', 'footnotes' ), 'hyperlink_arrow' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'superscript', __( 'Referrers', 'footnotes' ), 'superscript' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'label-solution', __( 'Referrers in labels', 'footnotes' ), 'label_solution' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box', __( 'Tooltips', 'footnotes' ), 'mouseover_box' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-position', __( 'Tooltip position', 'footnotes' ), 'mouseover_box_position' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-dimensions', __( 'Tooltip dimensions', 'footnotes' ), 'mouseover_box_dimensions' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-timing', __( 'Tooltip timing', 'footnotes' ), 'mouseover_box_timing' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-truncation', __( 'Tooltip truncation', 'footnotes' ), 'mouseover_box_truncation' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-text', __( 'Tooltip text', 'footnotes' ), 'mouseover_box_text' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-appearance', __( 'Tooltip appearance', 'footnotes' ), 'mouseover_box_appearance' ); - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) { - $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'custom-css', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'hyperlink-arrow', __( 'Backlink symbol', 'footnotes' ), 'hyperlink_arrow' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'superscript', __( 'Referrers', 'footnotes' ), 'superscript' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'label-solution', __( 'Referrers in labels', 'footnotes' ), 'label_solution' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box', __( 'Tooltips', 'footnotes' ), 'mouseover_box' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-position', __( 'Tooltip position', 'footnotes' ), 'mouseover_box_position' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-dimensions', __( 'Tooltip dimensions', 'footnotes' ), 'mouseover_box_dimensions' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-timing', __( 'Tooltip timing', 'footnotes' ), 'mouseover_box_timing' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-truncation', __( 'Tooltip truncation', 'footnotes' ), 'mouseover_box_truncation' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-text', __( 'Tooltip text', 'footnotes' ), 'mouseover_box_text' ); + $meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-appearance', __( 'Tooltip appearance', 'footnotes' ), 'mouseover_box_appearance' ); + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS_LEGACY_ENABLE ) ) ) { + $meta_boxes[] = $this->add_meta_box( 'customize', 'custom-css', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css' ); } - $l_arr_meta_boxes[] = $this->add_meta_box( 'expert', 'lookup', __( 'WordPress hooks with priority level', 'footnotes' ), 'lookup_hooks' ); + $meta_boxes[] = $this->add_meta_box( 'expert', 'lookup', __( 'WordPress hooks with priority level', 'footnotes' ), 'lookup_hooks' ); - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) { - $l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-migration', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css_migration' ); + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS_LEGACY_ENABLE ) ) ) { + $meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-migration', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css_migration' ); } - $l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-new', __( 'Custom CSS', 'footnotes' ), 'custom_css_new' ); + $meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-new', __( 'Custom CSS', 'footnotes' ), 'custom_css_new' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'help', __( 'Brief introduction: How to use the plugin', 'footnotes' ), 'help' ); - $l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'donate', __( 'Help us to improve our Plugin', 'footnotes' ), 'donate' ); + $meta_boxes[] = $this->add_meta_box( 'how-to', 'help', __( 'Brief introduction: How to use the plugin', 'footnotes' ), 'help' ); + $meta_boxes[] = $this->add_meta_box( 'how-to', 'donate', __( 'Help us to improve our Plugin', 'footnotes' ), 'donate' ); - return $l_arr_meta_boxes; + return $meta_boxes; } /** @@ -159,22 +159,22 @@ class Settings extends Engine { public function amp_compat(): void { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-amp' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-amp' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( // Translators: '%s' is the link text 'AMP-WP' linked to the plugin's front page on WordPress.org. 'description-1-amp' => sprintf( __( 'The official %s plugin is required when this option is enabled.', 'footnotes' ), 'AMP-WP' ), - 'label-amp' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ), - 'amp' => $this->add_checkbox( \footnotes\includes\Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ), + 'label-amp' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ), + 'amp' => $this->add_checkbox( \footnotes\includes\Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ), 'notice-amp' => __( 'This option enables hard links with configurable scroll offset in % viewport height.', 'footnotes' ), // Translators: '%s' is the logogram of the 'Footnotes' plugin. - 'description-2-amp' => sprintf( __( '%s is becoming AMP compatible when this box is checked. Styled tooltips are displayed with fade-in/fade-out effect if enabled, and the reference container expands also on clicking a referrer if it\'s collapsed by default.', 'footnotes' ), '' . \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME . '' ), + 'description-2-amp' => sprintf( __( '%s is becoming AMP compatible when this box is checked. Styled tooltips are displayed with fade-in/fade-out effect if enabled, and the reference container expands also on clicking a referrer if it\'s collapsed by default.', 'footnotes' ), '' . \footnotes\includes\Config::PLUGIN_PUBLIC_NAME . '' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -186,7 +186,7 @@ class Settings extends Engine { public function reference_container(): void { // Options for the label element. - $l_arr_label_element = array( + $label_element = array( 'p' => __( 'paragraph', 'footnotes' ), 'h2' => __( 'heading 2', 'footnotes' ), 'h3' => __( 'heading 3', 'footnotes' ), @@ -195,20 +195,20 @@ class Settings extends Engine { 'h6' => __( 'heading 6', 'footnotes' ), ); // Options for the positioning of the reference container. - $l_arr_positions = array( + $positions = array( 'post_end' => __( 'at the end of the post', 'footnotes' ), 'widget' => __( 'in the widget area', 'footnotes' ), 'footer' => __( 'in the footer', 'footnotes' ), ); // Basic responsive page layout options. - $l_arr_page_layout_options = array( + $page_layout_options = array( 'none' => __( 'No', 'footnotes' ), 'reference-container' => __( 'to the reference container exclusively', 'footnotes' ), 'entry-content' => __( 'to the div element starting below the post title', 'footnotes' ), 'main-content' => __( 'to the main element including the post title', 'footnotes' ), ); // Options for the separating punctuation between backlinks. - $l_arr_separators = array( + $separators = array( // Unicode character names are conventionally uppercase. 'comma' => __( 'COMMA', 'footnotes' ), 'semicolon' => __( 'SEMICOLON', 'footnotes' ), @@ -221,14 +221,14 @@ class Settings extends Engine { * This character is bidi-mirrored. Let's use the Unicode 1.0 name. * The wrong names were enforced in spite of Unicode, that subsequently scrambled to correct. */ - $l_arr_terminators = array( + $terminators = array( 'period' => __( 'FULL STOP', 'footnotes' ), // Unicode 1.0 name of RIGHT PARENTHESIS (represented as a left parenthesis in right-to-left scripts). 'parenthesis' => __( 'CLOSING PARENTHESIS', 'footnotes' ), 'colon' => __( 'COLON', 'footnotes' ), ); // Options for the first column width (per cent is a ratio, not a unit). - $l_arr_width_units = array( + $width_units = array( '%' => __( 'per cent', 'footnotes' ), 'px' => __( 'pixels', 'footnotes' ), 'rem' => __( 'root em', 'footnotes' ), @@ -236,120 +236,120 @@ class Settings extends Engine { 'vw' => __( 'viewport width', 'footnotes' ), ); // Options for reference container script mode. - $l_arr_script_mode = array( + $script_mode = array( 'jquery' => __( 'jQuery', 'footnotes' ), 'js' => __( 'plain JavaScript', 'footnotes' ), ); // Options for Yes/No select box. - $l_arr_enabled = array( + $enabled = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-reference-container' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-reference-container' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-name' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_NAME, __( 'Heading:', 'footnotes' ) ), - 'name' => $this->add_text_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_NAME ), + 'label-name' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_NAME, __( 'Heading:', 'footnotes' ) ), + 'name' => $this->add_text_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_NAME ), - 'label-element' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading\'s HTML element:', 'footnotes' ) ), - 'element' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, $l_arr_label_element ), + 'label-element' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading\'s HTML element:', 'footnotes' ) ), + 'element' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_ELEMENT, $label_element ), - 'label-border' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __( 'Border under the heading:', 'footnotes' ) ), - 'border' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $l_arr_enabled ), + 'label-border' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __( 'Border under the heading:', 'footnotes' ) ), + 'border' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $enabled ), - 'label-collapse' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, __( 'Collapse by default:', 'footnotes' ) ), - 'collapse' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, $l_arr_enabled ), + 'label-collapse' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE, __( 'Collapse by default:', 'footnotes' ) ), + 'collapse' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE, $enabled ), - 'label-script' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __( 'Script mode:', 'footnotes' ) ), - 'script' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, $l_arr_script_mode ), + 'label-script' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __( 'Script mode:', 'footnotes' ) ), + 'script' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, $script_mode ), 'notice-script' => __( 'The plain JavaScript mode will enable hard links with configurable scroll offset.', 'footnotes' ), - 'label-position' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ), - 'position' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_positions ), + 'label-position' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ), + 'position' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION, $positions ), // Translators: %s: at the end of the post. 'notice-position' => sprintf( __( 'To use the position or section shortcode, please set the position to: %s', 'footnotes' ), '' . __( 'at the end of the post', 'footnotes' ) . '' ), - 'label-shortcode' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ), - 'shortcode' => $this->add_text_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE ), + 'label-shortcode' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ), + 'shortcode' => $this->add_text_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION_SHORTCODE ), 'notice-shortcode' => __( 'If present in the content, any shortcode in this text box will be replaced with the reference container.', 'footnotes' ), - 'label-section' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ), - 'section' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ), + 'label-section' => $this->add_label( \footnotes\includes\Settings::FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ), + 'section' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTE_SECTION_SHORTCODE ), 'notice-section' => __( 'If present in the content, any shortcode in this text box will delimit a section terminated by a reference container.', 'footnotes' ), - 'label-startpage' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ), - 'startpage' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_enabled ), + 'label-startpage' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ), + 'startpage' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_START_PAGE_ENABLE, $enabled ), - 'label-margin-top' => $this->add_label( \footnotes\includes\Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, __( 'Top margin:', 'footnotes' ) ), - 'margin-top' => $this->add_num_box( \footnotes\includes\Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, -500, 500 ), + 'label-margin-top' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_TOP_MARGIN, __( 'Top margin:', 'footnotes' ) ), + 'margin-top' => $this->add_num_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_TOP_MARGIN, -500, 500 ), 'notice-margin-top' => __( 'pixels; may be negative', 'footnotes' ), - 'label-margin-bottom' => $this->add_label( \footnotes\includes\Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, __( 'Bottom margin:', 'footnotes' ) ), - 'margin-bottom' => $this->add_num_box( \footnotes\includes\Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500 ), + 'label-margin-bottom' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_BOTTOM_MARGIN, __( 'Bottom margin:', 'footnotes' ) ), + 'margin-bottom' => $this->add_num_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500 ), 'notice-margin-bottom' => __( 'pixels; may be negative', 'footnotes' ), - 'label-page-layout' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __( 'Apply basic responsive page layout:', 'footnotes' ) ), - 'page-layout' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_page_layout_options ), + 'label-page-layout' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_PAGE_LAYOUT_SUPPORT, __( 'Apply basic responsive page layout:', 'footnotes' ) ), + 'page-layout' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_PAGE_LAYOUT_SUPPORT, $page_layout_options ), 'notice-page-layout' => __( 'Most themes don\'t need this fix.', 'footnotes' ), - 'label-url-wrap' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, __( 'Allow URLs to line-wrap anywhere:', 'footnotes' ) ), - 'url-wrap' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_enabled ), + 'label-url-wrap' => $this->add_label( \footnotes\includes\Settings::FOOTNOTE_URL_WRAP_ENABLED, __( 'Allow URLs to line-wrap anywhere:', 'footnotes' ) ), + 'url-wrap' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTE_URL_WRAP_ENABLED, $enabled ), 'notice-url-wrap' => __( 'Unicode-conformant browsers don\'t need this fix.', 'footnotes' ), - 'label-symbol' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __( 'Display a backlink symbol:', 'footnotes' ) ), - 'symbol-enable' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_enabled ), + 'label-symbol' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __( 'Display a backlink symbol:', 'footnotes' ) ), + 'symbol-enable' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $enabled ), 'notice-symbol' => __( 'Please choose or input the symbol at the top of the next dashboard tab.', 'footnotes' ), - 'label-switch' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __( 'Symbol appended, not prepended:', 'footnotes' ) ), - 'switch' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_enabled ), + 'label-switch' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __( 'Symbol appended, not prepended:', 'footnotes' ) ), + 'switch' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $enabled ), - 'label-3column' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __( 'Backlink symbol in an extra column:', 'footnotes' ) ), - '3column' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_enabled ), + 'label-3column' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __( 'Backlink symbol in an extra column:', 'footnotes' ) ), + '3column' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $enabled ), 'notice-3column' => __( 'This legacy layout is available if identical footnotes are not combined.', 'footnotes' ), - 'label-row-borders' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __( 'Borders around the table rows:', 'footnotes' ) ), - 'row-borders' => $this->add_select_box( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $l_arr_enabled ), + 'label-row-borders' => $this->add_label( \footnotes\includes\Settings::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __( 'Borders around the table rows:', 'footnotes' ) ), + 'row-borders' => $this->add_select_box( \footnotes\includes\Settings::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $enabled ), - 'label-separator' => $this->add_label( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, __( 'Add a separator when enumerating backlinks:', 'footnotes' ) ), - 'separator-enable' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, $l_arr_enabled ), - 'separator-options' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_OPTION, $l_arr_separators ), - 'separator-custom' => $this->add_text_box( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM ), + 'label-separator' => $this->add_label( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_ENABLED, __( 'Add a separator when enumerating backlinks:', 'footnotes' ) ), + 'separator-enable' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_ENABLED, $enabled ), + 'separator-options' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_OPTION, $separators ), + 'separator-custom' => $this->add_text_box( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_CUSTOM ), 'notice-separator' => __( 'Your input overrides the selection.', 'footnotes' ), - 'label-terminator' => $this->add_label( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, __( 'Add a terminal punctuation to backlinks:', 'footnotes' ) ), - 'terminator-enable' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, $l_arr_enabled ), - 'terminator-options' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_OPTION, $l_arr_terminators ), - 'terminator-custom' => $this->add_text_box( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM ), + 'label-terminator' => $this->add_label( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_ENABLED, __( 'Add a terminal punctuation to backlinks:', 'footnotes' ) ), + 'terminator-enable' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_ENABLED, $enabled ), + 'terminator-options' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_OPTION, $terminators ), + 'terminator-custom' => $this->add_text_box( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_CUSTOM ), 'notice-terminator' => __( 'Your input overrides the selection.', 'footnotes' ), - 'label-width' => $this->add_label( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, __( 'Set backlinks column width:', 'footnotes' ) ), - 'width-enable' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_enabled ), - 'width-scalar' => $this->add_num_box( \footnotes\includes\Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true ), - 'width-unit' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_width_units ), + 'label-width' => $this->add_label( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_ENABLED, __( 'Set backlinks column width:', 'footnotes' ) ), + 'width-enable' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_ENABLED, $enabled ), + 'width-scalar' => $this->add_num_box( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true ), + 'width-unit' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_UNIT, $width_units ), 'notice-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ), - 'label-max-width' => $this->add_label( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __( 'Set backlinks column maximum width:', 'footnotes' ) ), - 'max-width-enable' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_enabled ), - 'max-width-scalar' => $this->add_num_box( \footnotes\includes\Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true ), - 'max-width-unit' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_width_units ), + 'label-max-width' => $this->add_label( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __( 'Set backlinks column maximum width:', 'footnotes' ) ), + 'max-width-enable' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $enabled ), + 'max-width-scalar' => $this->add_num_box( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true ), + 'max-width-unit' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $width_units ), 'notice-max-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ), - 'label-line-break' => $this->add_label( \footnotes\includes\Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, __( 'Stack backlinks when enumerating:', 'footnotes' ) ), - 'line-break' => $this->add_select_box( \footnotes\includes\Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_enabled ), + 'label-line-break' => $this->add_label( \footnotes\includes\Settings::BACKLINKS_LINE_BREAKS_ENABLED, __( 'Stack backlinks when enumerating:', 'footnotes' ) ), + 'line-break' => $this->add_select_box( \footnotes\includes\Settings::BACKLINKS_LINE_BREAKS_ENABLED, $enabled ), 'notice-line-break' => __( 'This option adds a line break before each added backlink when identical footnotes are combined.', 'footnotes' ), - 'label-link' => $this->add_label( \footnotes\includes\Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), - 'link' => $this->add_select_box( \footnotes\includes\Settings::C_STR_LINK_ELEMENT_ENABLED, $l_arr_enabled ), + 'label-link' => $this->add_label( \footnotes\includes\Settings::LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), + 'link' => $this->add_select_box( \footnotes\includes\Settings::LINK_ELEMENT_ENABLED, $enabled ), 'notice-link' => __( 'The link element is needed to apply the theme\'s link color.', 'footnotes' ), 'description-link' => __( 'If the link element is not desired for styling, a simple span is used instead when the above is set to No.', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -360,7 +360,7 @@ class Settings extends Engine { */ public function start_end(): void { // Footnotes start tag short code options. - $l_arr_shortcode_start = array( + $shortcode_start = array( '((' => '((', '(((' => '(((', '{{' => '{{', @@ -374,7 +374,7 @@ class Settings extends Engine { 'userdefined' => __( 'custom short code', 'footnotes' ), ); // Footnotes end tag short code options. - $l_arr_shortcode_end = array( + $shortcode_end = array( '))' => '))', ')))' => ')))', '}}' => '}}', @@ -388,37 +388,37 @@ class Settings extends Engine { 'userdefined' => __( 'custom short code', 'footnotes' ), ); // Options for the syntax validation. - $l_arr_enable = array( + $enable = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-start-end' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-start-end' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( 'description-escapement' => __( 'When delimiters with pointy brackets are used, the diverging escapement schemas will be unified before footnotes are processed.', 'footnotes' ), - 'label-short-code-start' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ), - 'short-code-start' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ), - 'short-code-start-user' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ), + 'label-short-code-start' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ), + 'short-code-start' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START, $shortcode_start ), + 'short-code-start-user' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ), - 'label-short-code-end' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __( 'Footnote end tag short code:', 'footnotes' ) ), - 'short-code-end' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_shortcode_end ), - 'short-code-end-user' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ), + 'label-short-code-end' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END, __( 'Footnote end tag short code:', 'footnotes' ) ), + 'short-code-end' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END, $shortcode_end ), + 'short-code-end-user' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ), // For script showing/hiding user defined text boxes. - 'short-code-start-id' => \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START, - 'short-code-end-id' => \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END, - 'short-code-start-user-id' => \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, - 'short-code-end-user-id' => \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, + 'short-code-start-id' => \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START, + 'short-code-end-id' => \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END, + 'short-code-start-user-id' => \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED, + 'short-code-end-user-id' => \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED, 'description-parentheses' => __( 'WARNING: Although widespread industry standard, the double parentheses are problematic because they may occur in scripts embedded in the content and be mistaken as a short code.', 'footnotes' ), // Option to enable syntax validation, label mirrored in task.php. - 'label-syntax' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __( 'Check for balanced shortcodes:', 'footnotes' ) ), - 'syntax' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_enable ), + 'label-syntax' => $this->add_label( \footnotes\includes\Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __( 'Check for balanced shortcodes:', 'footnotes' ) ), + 'syntax' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $enable ), 'notice-syntax' => __( 'In the presence of a lone start tag shortcode, a warning displays below the post title.', 'footnotes' ), 'description-syntax' => __( 'If the start tag short code is \'((\' or \'(((\', it will not be reported as unbalanced if the following string contains braces hinting that it is a script.', 'footnotes' ), @@ -426,7 +426,7 @@ class Settings extends Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -437,33 +437,33 @@ class Settings extends Engine { */ public function numbering(): void { // Define some space for the output. - $l_str_space = '     '; + $space = '     '; // Options for the combination of identical footnotes. - $l_arr_enable = array( + $enable = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Options for the numbering style of the footnotes. - $l_arr_counter_style = array( - 'arabic_plain' => __( 'plain Arabic numbers', 'footnotes' ) . $l_str_space . '1, 2, 3, 4, 5, …', - 'arabic_leading' => __( 'zero-padded Arabic numbers', 'footnotes' ) . $l_str_space . '01, 02, 03, 04, 05, …', - 'latin_low' => __( 'lowercase Latin letters', 'footnotes' ) . $l_str_space . 'a, b, c, d, e, …', - 'latin_high' => __( 'uppercase Latin letters', 'footnotes' ) . $l_str_space . 'A, B, C, D, E, …', - 'romanic' => __( 'uppercase Roman numerals', 'footnotes' ) . $l_str_space . 'I, II, III, IV, V, …', - 'roman_low' => __( 'lowercase Roman numerals', 'footnotes' ) . $l_str_space . 'i, ii, iii, iv, v, …', + $counter_style = array( + 'arabic_plain' => __( 'plain Arabic numbers', 'footnotes' ) . $space . '1, 2, 3, 4, 5, …', + 'arabic_leading' => __( 'zero-padded Arabic numbers', 'footnotes' ) . $space . '01, 02, 03, 04, 05, …', + 'latin_low' => __( 'lowercase Latin letters', 'footnotes' ) . $space . 'a, b, c, d, e, …', + 'latin_high' => __( 'uppercase Latin letters', 'footnotes' ) . $space . 'A, B, C, D, E, …', + 'romanic' => __( 'uppercase Roman numerals', 'footnotes' ) . $space . 'I, II, III, IV, V, …', + 'roman_low' => __( 'lowercase Roman numerals', 'footnotes' ) . $space . 'i, ii, iii, iv, v, …', ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-numbering' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-numbering' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-counter-style' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __( 'Numbering style:', 'footnotes' ) ), - 'counter-style' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_counter_style ), + 'label-counter-style' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE, __( 'Numbering style:', 'footnotes' ) ), + 'counter-style' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE, $counter_style ), // Algorithmically combine identicals. - 'label-identical' => $this->add_label( \footnotes\includes\Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, __( 'Combine identical footnotes:', 'footnotes' ) ), - 'identical' => $this->add_select_box( \footnotes\includes\Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_enable ), + 'label-identical' => $this->add_label( \footnotes\includes\Settings::COMBINE_IDENTICAL_FOOTNOTES, __( 'Combine identical footnotes:', 'footnotes' ) ), + 'identical' => $this->add_select_box( \footnotes\includes\Settings::COMBINE_IDENTICAL_FOOTNOTES, $enable ), 'notice-identical' => __( 'This option may require copy-pasting footnotes in multiple instances.', 'footnotes' ), // Support for Ibid. notation added thanks to @meglio in . 'description-identical' => __( 'Even when footnotes are combined, footnote numbers keep incrementing. This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system. The Ibid. notation and the op. cit. abbreviation followed by the current page number avoid repeating the footnote content. For changing sources, shortened citations may be used. Repeating full citations is also an opportunity to add details.', 'footnotes' ), @@ -471,7 +471,7 @@ class Settings extends Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -483,51 +483,51 @@ class Settings extends Engine { public function scrolling(): void { // Options for enabling scroll duration asymmetricity. - $l_arr_enable = array( + $enable = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-scrolling' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-scrolling' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-scroll-css' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ), - 'scroll-css' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, $l_arr_enable ), + 'label-scroll-css' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ), + 'scroll-css' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING, $enable ), 'notice-scroll-css' => __( 'May slightly disturb jQuery scrolling and is therefore disabled by default. Works in recent browsers.', 'footnotes' ), - 'label-scroll-offset' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ), - 'scroll-offset' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100 ), + 'label-scroll-offset' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ), + 'scroll-offset' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_SCROLL_OFFSET, 0, 100 ), 'notice-scroll-offset' => __( 'per cent viewport height from the upper edge', 'footnotes' ), - 'label-scroll-duration' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ), - 'scroll-duration' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000 ), + 'label-scroll-duration' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ), + 'scroll-duration' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION, 0, 20000 ), 'notice-scroll-duration' => __( 'milliseconds. If asymmetric scroll durations are enabled, this is the scroll-up duration.', 'footnotes' ), // Enable scroll duration asymmetricity. - 'label-scroll-asymmetricity' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ), - 'scroll-asymmetricity' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $l_arr_enable ), + 'label-scroll-asymmetricity' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ), + 'scroll-asymmetricity' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $enable ), 'notice-scroll-asymmetricity' => __( 'With this option enabled, scrolling up may take longer than down, or conversely.', 'footnotes' ), - 'label-scroll-down-duration' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ), - 'scroll-down-duration' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ), + 'label-scroll-down-duration' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ), + 'scroll-down-duration' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ), 'notice-scroll-down-duration' => __( 'milliseconds', 'footnotes' ), - 'label-scroll-down-delay' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ), - 'scroll-down-delay' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ), + 'label-scroll-down-delay' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ), + 'scroll-down-delay' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ), 'notice-scroll-down-delay' => __( 'milliseconds. Useful to see the effect on input elements when referrers without hard links are clicked in form labels.', 'footnotes' ), - 'label-scroll-up-delay' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ), - 'scroll-up-delay' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ), + 'label-scroll-up-delay' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ), + 'scroll-up-delay' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ), 'notice-scroll-up-delay' => __( 'milliseconds. Less useful than the scroll-down delay.', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -539,47 +539,47 @@ class Settings extends Engine { public function hard_links(): void { // Options for enabling hard links for AMP compat. - $l_arr_enable = array( + $enable = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-hard-links' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-hard-links' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-hard-links' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, __( 'Enable hard links:', 'footnotes' ) ), - 'hard-links' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, $l_arr_enable ), + 'label-hard-links' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_HARD_LINKS_ENABLE, __( 'Enable hard links:', 'footnotes' ) ), + 'hard-links' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_HARD_LINKS_ENABLE, $enable ), 'notice-hard-links' => __( 'Hard links disable jQuery delays but have the same scroll offset, and allow to share footnotes (accessed if the list is not collapsed by default).', 'footnotes' ), - 'label-footnote' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnotes:', 'footnotes' ) ), - 'footnote' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG ), + 'label-footnote' => $this->add_label( \footnotes\includes\Settings::FOOTNOTE_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnotes:', 'footnotes' ) ), + 'footnote' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTE_FRAGMENT_ID_SLUG ), 'notice-footnote' => __( 'This will show up in the address bar after clicking on a hard-linked footnote referrer.', 'footnotes' ), - 'label-referrer' => $this->add_label( \footnotes\includes\Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnote referrers:', 'footnotes' ) ), - 'referrer' => $this->add_text_box( \footnotes\includes\Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG ), + 'label-referrer' => $this->add_label( \footnotes\includes\Settings::REFERRER_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnote referrers:', 'footnotes' ) ), + 'referrer' => $this->add_text_box( \footnotes\includes\Settings::REFERRER_FRAGMENT_ID_SLUG ), 'notice-referrer' => __( 'This will show up in the address bar after clicking on a hard-linked backlink.', 'footnotes' ), - 'label-separator' => $this->add_label( \footnotes\includes\Settings::C_STR_HARD_LINK_IDS_SEPARATOR, __( 'ID separator:', 'footnotes' ) ), - 'separator' => $this->add_text_box( \footnotes\includes\Settings::C_STR_HARD_LINK_IDS_SEPARATOR ), + 'label-separator' => $this->add_label( \footnotes\includes\Settings::HARD_LINK_IDS_SEPARATOR, __( 'ID separator:', 'footnotes' ) ), + 'separator' => $this->add_text_box( \footnotes\includes\Settings::HARD_LINK_IDS_SEPARATOR ), 'notice-separator' => __( 'May be empty or any string, for example _, - or +, to distinguish post number, container number and footnote number.', 'footnotes' ), // Enable backlink tooltips. - 'label-backlink-tooltips' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ), - 'backlink-tooltips' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_enable ), + 'label-backlink-tooltips' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ), + 'backlink-tooltips' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $enable ), 'notice-backlink-tooltips' => __( 'Hard backlinks get ordinary tooltips hinting to use the backbutton instead to keep it usable.', 'footnotes' ), - 'label-backlink-tooltip-text' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ), - 'backlink-tooltip-text' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ), + 'label-backlink-tooltip-text' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ), + 'backlink-tooltip-text' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT ), 'notice-backlink-tooltip-text' => __( 'Default text is the keyboard shortcut; may be a localized descriptive hint.', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -590,42 +590,42 @@ class Settings extends Engine { */ public function love(): void { // Options for the acknowledgment display in the footer. - $l_arr_love = array( + $love = array( // Logo only. - 'text-3' => \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME, + 'text-3' => \footnotes\includes\Config::PLUGIN_PUBLIC_NAME, // Logo followed by heart symbol. - 'text-4' => sprintf( '%s %s', \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME, \footnotes\includes\Config::C_STR_LOVE_SYMBOL ), + 'text-4' => sprintf( '%s %s', \footnotes\includes\Config::PLUGIN_PUBLIC_NAME, \footnotes\includes\Config::LOVE_SYMBOL ), // Logo preceded by heart symbol. - 'text-5' => sprintf( '%s %s', \footnotes\includes\Config::C_STR_LOVE_SYMBOL, \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-5' => sprintf( '%s %s', \footnotes\includes\Config::LOVE_SYMBOL, \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ), // Translators: 2: heart symbol 1: footnotes logogram. - 'text-1' => sprintf( __( 'I %2$s %1$s', 'footnotes' ), \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME, \footnotes\includes\Config::C_STR_LOVE_SYMBOL ), + 'text-1' => sprintf( __( 'I %2$s %1$s', 'footnotes' ), \footnotes\includes\Config::PLUGIN_PUBLIC_NAME, \footnotes\includes\Config::LOVE_SYMBOL ), // Translators: %s: Footnotes plugin logo. - 'text-6' => sprintf( __( 'This website uses %s.', 'footnotes' ), \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-6' => sprintf( __( 'This website uses %s.', 'footnotes' ), \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ), // Translators: %s: Footnotes plugin logo. - 'text-7' => sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-7' => sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ), // Translators: %s: Footnotes plugin logo. - 'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ), 'random' => __( 'randomly determined display of either mention', 'footnotes' ), // Translators: 1: Plugin logo.2: heart symbol. - 'no' => sprintf( __( 'no display of any "%1$s %2$s" mention in the footer', 'footnotes' ), \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME, \footnotes\includes\Config::C_STR_LOVE_SYMBOL ), + 'no' => sprintf( __( 'no display of any "%1$s %2$s" mention in the footer', 'footnotes' ), \footnotes\includes\Config::PLUGIN_PUBLIC_NAME, \footnotes\includes\Config::LOVE_SYMBOL ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-love' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-love' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( // Translators: %s: Footnotes plugin logo. - 'label-love' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME ) ), - 'love' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_LOVE, $l_arr_love ), + 'label-love' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ) ), + 'love' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_LOVE, $love ), // Translators: %s: Footnotes plugin logo. - 'label-no-love' => $this->add_text( sprintf( __( 'Shortcode to inhibit the display of the %s mention on specific pages:', 'footnotes' ), \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME ) ), - 'no-love' => $this->add_text( \footnotes\includes\Config::C_STR_NO_LOVE_SLUG ), + 'label-no-love' => $this->add_text( sprintf( __( 'Shortcode to inhibit the display of the %s mention on specific pages:', 'footnotes' ), \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ) ), + 'no-love' => $this->add_text( \footnotes\includes\Config::NO_LOVE_SLUG ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -636,28 +636,28 @@ class Settings extends Engine { */ public function excerpts(): void { // Options for options select box. - $l_arr_excerpt_mode = array( + $excerpt_mode = array( 'yes' => __( 'Yes, generate excerpts from posts with effectively processed footnotes and other markup', 'footnotes' ), 'no' => __( 'No, generate excerpts from posts but remove all footnotes and output plain text', 'footnotes' ), 'manual' => __( 'Yes but run the process only to display tooltips in manual excerpts with footnote short codes', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'settings-excerpts' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'settings-excerpts' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-excerpts' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ), - 'excerpts' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_IN_EXCERPT, $l_arr_excerpt_mode ), + 'label-excerpts' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ), + 'excerpts' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_IN_EXCERPT, $excerpt_mode ), 'notice-excerpts' => __( 'If the_excerpt is enabled.', 'footnotes' ), // Translators: %s: link text 'Advanced Excerpt' linked to the plugin\'s WordPress.org front page. // Translators: %s: Footnotes plugin logo. - 'description-excerpts' => sprintf( __( 'To not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to be able to remove the footnotes. Else, footnotes may be processed in manual excerpts OR processed based on the posts. — For this setting to be effective, the hook the_excerpt must be enabled under Scope and priority.', 'footnotes' ), '' . \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME . '' ), + 'description-excerpts' => sprintf( __( 'To not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to be able to remove the footnotes. Else, footnotes may be processed in manual excerpts OR processed based on the posts. — For this setting to be effective, the hook the_excerpt must be enabled under Scope and priority.', 'footnotes' ), '' . \footnotes\includes\Config::PLUGIN_PUBLIC_NAME . '' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -668,41 +668,41 @@ class Settings extends Engine { */ public function superscript(): void { // Options for Yes/No select box. - $l_arr_enabled = array( + $enabled = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Options for superscript normalize scope. - $l_arr_normalize_superscript = array( + $normalize_superscript = array( 'no' => __( 'No', 'footnotes' ), 'referrers' => __( 'Footnote referrers', 'footnotes' ), 'all' => __( 'All superscript elements', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'customize-superscript' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'customize-superscript' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-superscript' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __( 'Display footnote referrers in superscript:', 'footnotes' ) ), - 'superscript' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_enabled ), + 'label-superscript' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __( 'Display footnote referrers in superscript:', 'footnotes' ) ), + 'superscript' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $enabled ), - 'label-normalize' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ), - 'normalize' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $l_arr_normalize_superscript ), + 'label-normalize' => $this->add_label( \footnotes\includes\Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ), + 'normalize' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $normalize_superscript ), 'notice-normalize' => __( 'Most themes don\'t need this fix.', 'footnotes' ), - 'label-before' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ), - 'before' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_STYLING_BEFORE ), + 'label-before' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ), + 'before' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_STYLING_BEFORE ), - 'label-after' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_STYLING_AFTER, __( 'At the end of the footnote referrers:', 'footnotes' ) ), - 'after' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_STYLING_AFTER ), + 'label-after' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_STYLING_AFTER, __( 'At the end of the footnote referrers:', 'footnotes' ) ), + 'after' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_STYLING_AFTER ), - 'label-link' => $this->add_label( \footnotes\includes\Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), + 'label-link' => $this->add_label( \footnotes\includes\Settings::LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), 'notice-link' => __( 'Please find this setting at the end of the reference container settings. The link element is needed to apply the theme\'s link color.', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -713,25 +713,25 @@ class Settings extends Engine { */ public function label_solution(): void { // Options for the input label issue solution. - $l_arr_issue_solutions = array( + $issue_solutions = array( 'none' => __( '0. No problem or solved otherwise', 'footnotes' ), 'move' => __( 'A. Footnotes are moved out and appended after the label\'s end (recommended)', 'footnotes' ), 'disconnect' => __( 'B. Labels with footnotes are disconnected from input element (discouraged)', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'configure-label-solution' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'configure-label-solution' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( 'description-1-selection' => __( 'Clicking a footnote referrer in an input element label toggles the input except when hard links are enabled. In jQuery mode, the recommended solution is to move footnotes and append them after the label (option A).', 'footnotes' ), - 'label-selection' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ), - 'selection' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, $l_arr_issue_solutions ), + 'label-selection' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ), + 'selection' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION, $issue_solutions ), 'description-2-selection' => __( 'Option B is discouraged because disconnecting a label from its input element may compromise accessibility. This option is a last resort in case footnotes must absolutely stay inside the label. (Using jQuery \'event.stopPropagation\' failed.)', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -742,32 +742,32 @@ class Settings extends Engine { */ public function mouseover_box(): void { // Options for Yes/No select box. - $l_arr_enabled = array( + $enabled = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'mouse-over-box-display' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'mouse-over-box-display' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-enable' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __( 'Display tooltips:', 'footnotes' ) ), - 'enable' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_enabled ), + 'label-enable' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __( 'Display tooltips:', 'footnotes' ) ), + 'enable' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $enabled ), 'notice-enable' => __( 'Formatted text boxes allowing hyperlinks, displayed on mouse-over or tap and hold.', 'footnotes' ), - 'label-alternative' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __( 'Display alternative tooltips:', 'footnotes' ) ), - 'alternative' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_enabled ), + 'label-alternative' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __( 'Display alternative tooltips:', 'footnotes' ) ), + 'alternative' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $enabled ), 'notice-alternative' => __( 'Intended to work around a configuration-related tooltip outage.', 'footnotes' ), // Translators: %s: Footnotes plugin logo. - 'description-alternative' => sprintf( __( 'These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes\' internal stylesheet. When this option is enabled, %s does not load jQuery UI nor jQuery Tools.', 'footnotes' ), '' . \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME . '' ), + 'description-alternative' => sprintf( __( 'These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes\' internal stylesheet. When this option is enabled, %s does not load jQuery UI nor jQuery Tools.', 'footnotes' ), '' . \footnotes\includes\Config::PLUGIN_PUBLIC_NAME . '' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -779,7 +779,7 @@ class Settings extends Engine { public function mouseover_box_position(): void { // Options for the Mouse-over box position. - $l_arr_position = array( + $position = array( 'top left' => __( 'top left', 'footnotes' ), 'top center' => __( 'top center', 'footnotes' ), 'top right' => __( 'top right', 'footnotes' ), @@ -790,7 +790,7 @@ class Settings extends Engine { 'center left' => __( 'center left', 'footnotes' ), ); // Options for the alternative Mouse-over box position. - $l_arr_alternative_position = array( + $alternative_position = array( 'top left' => __( 'top left', 'footnotes' ), 'top right' => __( 'top right', 'footnotes' ), 'bottom right' => __( 'bottom right', 'footnotes' ), @@ -798,31 +798,31 @@ class Settings extends Engine { ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'mouse-over-box-position' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'mouse-over-box-position' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-position' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __( 'Position:', 'footnotes' ) ), - 'position' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_position ), - 'position-alternative' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $l_arr_alternative_position ), + 'label-position' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION, __( 'Position:', 'footnotes' ) ), + 'position' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION, $position ), + 'position-alternative' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $alternative_position ), 'notice-position' => __( 'The second column of settings boxes is for the alternative tooltips.', 'footnotes' ), - 'label-offset-x' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __( 'Horizontal offset:', 'footnotes' ) ), - 'offset-x' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), - 'offset-x-alternative' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), + 'label-offset-x' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __( 'Horizontal offset:', 'footnotes' ) ), + 'offset-x' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), + 'offset-x-alternative' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), 'notice-offset-x' => __( 'pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position', 'footnotes' ), - 'label-offset-y' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __( 'Vertical offset:', 'footnotes' ) ), - 'offset-y' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), - 'offset-y-alternative' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), + 'label-offset-y' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __( 'Vertical offset:', 'footnotes' ) ), + 'offset-y' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), + 'offset-y-alternative' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), 'notice-offset-y' => __( 'pixels; negative value for an upwards offset; alternative tooltips: direction depends on position', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -834,21 +834,21 @@ class Settings extends Engine { public function mouseover_box_dimensions(): void { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'mouse-over-box-dimensions' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'mouse-over-box-dimensions' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-max-width' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __( 'Maximum width:', 'footnotes' ) ), - 'max-width' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280 ), - 'width' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280 ), + 'label-max-width' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __( 'Maximum width:', 'footnotes' ) ), + 'max-width' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280 ), + 'width' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280 ), 'notice-max-width' => __( 'pixels; set to 0 for jQuery tooltips without max width; alternative tooltips are given the value in the second box as fixed width.', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -860,32 +860,32 @@ class Settings extends Engine { public function mouseover_box_timing(): void { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'mouse-over-box-timing' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'mouse-over-box-timing' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-fade-in-delay' => $this->add_label( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, __( 'Fade-in delay:', 'footnotes' ) ), - 'fade-in-delay' => $this->add_num_box( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000 ), + 'label-fade-in-delay' => $this->add_label( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DELAY, __( 'Fade-in delay:', 'footnotes' ) ), + 'fade-in-delay' => $this->add_num_box( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000 ), 'notice-fade-in-delay' => __( 'milliseconds', 'footnotes' ), - 'label-fade-in-duration' => $this->add_label( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, __( 'Fade-in duration:', 'footnotes' ) ), - 'fade-in-duration' => $this->add_num_box( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000 ), + 'label-fade-in-duration' => $this->add_label( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DURATION, __( 'Fade-in duration:', 'footnotes' ) ), + 'fade-in-duration' => $this->add_num_box( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000 ), 'notice-fade-in-duration' => __( 'milliseconds', 'footnotes' ), - 'label-fade-out-delay' => $this->add_label( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, __( 'Fade-out delay:', 'footnotes' ) ), - 'fade-out-delay' => $this->add_num_box( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000 ), + 'label-fade-out-delay' => $this->add_label( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY, __( 'Fade-out delay:', 'footnotes' ) ), + 'fade-out-delay' => $this->add_num_box( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000 ), 'notice-fade-out-delay' => __( 'milliseconds', 'footnotes' ), - 'label-fade-out-duration' => $this->add_label( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, __( 'Fade-out duration:', 'footnotes' ) ), - 'fade-out-duration' => $this->add_num_box( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000 ), + 'label-fade-out-duration' => $this->add_label( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION, __( 'Fade-out duration:', 'footnotes' ) ), + 'fade-out-duration' => $this->add_num_box( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000 ), 'notice-fade-out-duration' => __( 'milliseconds', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -896,33 +896,33 @@ class Settings extends Engine { */ public function mouseover_box_truncation(): void { // Options for Yes/No select box. - $l_arr_enabled = array( + $enabled = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'mouse-over-box-truncation' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'mouse-over-box-truncation' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-truncation' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __( 'Truncate the note in the tooltip:', 'footnotes' ) ), - 'truncation' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_enabled ), + 'label-truncation' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __( 'Truncate the note in the tooltip:', 'footnotes' ) ), + 'truncation' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $enabled ), - 'label-max-length' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __( 'Maximum number of characters in the tooltip:', 'footnotes' ) ), - 'max-length' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000 ), + 'label-max-length' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __( 'Maximum number of characters in the tooltip:', 'footnotes' ) ), + 'max-length' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000 ), // The feature trims back until the last full word. 'notice-max-length' => __( 'No weird cuts.', 'footnotes' ), - 'label-readon' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ), - 'readon' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ), + 'label-readon' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ), + 'readon' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_READON_LABEL ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -933,29 +933,29 @@ class Settings extends Engine { */ public function mouseover_box_text(): void { // Options for Yes/No select box. - $l_arr_enabled = array( + $enabled = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'mouse-over-box-text' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'mouse-over-box-text' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( 'description-delimiter' => __( '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.', 'footnotes' ), - 'label-delimiter' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __( 'Delimiter for dedicated tooltip text:', 'footnotes' ) ), - 'delimiter' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ), + 'label-delimiter' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __( 'Delimiter for dedicated tooltip text:', 'footnotes' ) ), + 'delimiter' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ), 'notice-delimiter' => __( 'If the delimiter shortcode is present, the tooltip text will be the part before it.', 'footnotes' ), - 'label-mirror' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __( 'Mirror the tooltip in the reference container:', 'footnotes' ) ), - 'mirror' => $this->add_select_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $l_arr_enabled ), + 'label-mirror' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __( 'Mirror the tooltip in the reference container:', 'footnotes' ) ), + 'mirror' => $this->add_select_box( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $enabled ), 'notice-mirror' => __( 'Tooltips may be harder to use on mobiles. This option allows to read it in the reference container.', 'footnotes' ), - 'label-separator' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __( 'Separator between tooltip text and footnote text:', 'footnotes' ) ), - 'separator' => $this->add_text_box( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ), + 'label-separator' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __( 'Separator between tooltip text and footnote text:', 'footnotes' ) ), + 'separator' => $this->add_text_box( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ), 'notice-separator' => __( 'May be a simple space, or a line break <br />, or any string in your language.', 'footnotes' ), 'description-mirror' => __( 'Tooltips, even jQuery-driven, may be hard to consult on mobiles. This option allows to read the tooltip content in the reference container too.', 'footnotes' ), @@ -964,7 +964,7 @@ class Settings extends Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -975,12 +975,12 @@ class Settings extends Engine { */ public function mouseover_box_appearance(): void { // Options for Yes/No select box. - $l_arr_enabled = array( + $enabled = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Options for the font size unit. - $l_arr_font_size_units = array( + $font_size_units = array( 'em' => __( 'em', 'footnotes' ), 'rem' => __( 'rem', 'footnotes' ), 'px' => __( 'pixels', 'footnotes' ), @@ -991,42 +991,42 @@ class Settings extends Engine { ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'mouse-over-box-appearance' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'mouse-over-box-appearance' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-font-size' => $this->add_label( \footnotes\includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __( 'Set font size:', 'footnotes' ) ), - 'font-size-enable' => $this->add_select_box( \footnotes\includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_enabled ), - 'font-size-scalar' => $this->add_num_box( \footnotes\includes\Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true ), - 'font-size-unit' => $this->add_select_box( \footnotes\includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_font_size_units ), + 'label-font-size' => $this->add_label( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __( 'Set font size:', 'footnotes' ) ), + 'font-size-enable' => $this->add_select_box( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $enabled ), + 'font-size-scalar' => $this->add_num_box( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true ), + 'font-size-unit' => $this->add_select_box( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_UNIT, $font_size_units ), 'notice-font-size' => __( 'By default, the font size is set to equal the surrounding text.', 'footnotes' ), - 'label-color' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ), - 'color' => $this->add_color_selection( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ), + 'label-color' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ), + 'color' => $this->add_color_selection( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR ), // Translators: %s: Clear or leave empty. 'notice-color' => sprintf( __( 'To use the current theme\'s default text color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), - 'label-background' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ), - 'background' => $this->add_color_selection( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ), + 'label-background' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ), + 'background' => $this->add_color_selection( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ), // Translators: %s: Clear or leave empty. 'notice-background' => sprintf( __( 'To use the current theme\'s default background color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), - 'label-border-width' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ), - 'border-width' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ), + 'label-border-width' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ), + 'border-width' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ), 'notice-border-width' => __( 'pixels; 0 for borderless', 'footnotes' ), - 'label-border-color' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ), - 'border-color' => $this->add_color_selection( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ), + 'label-border-color' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ), + 'border-color' => $this->add_color_selection( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ), // Translators: %s: Clear or leave empty. 'notice-border-color' => sprintf( __( 'To use the current theme\'s default border color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), - 'label-border-radius' => $this->add_label( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ), - 'border-radius' => $this->add_num_box( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500 ), + 'label-border-radius' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ), + 'border-radius' => $this->add_num_box( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500 ), 'notice-border-radius' => __( 'pixels; 0 for sharp corners', 'footnotes' ), - 'label-box-shadow-color' => $this->add_label( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ), - 'box-shadow-color' => $this->add_color_selection( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ), + 'label-box-shadow-color' => $this->add_label( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ), + 'box-shadow-color' => $this->add_color_selection( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ), // Translators: %s: Clear or leave empty. 'notice-box-shadow-color' => sprintf( __( 'To use the current theme\'s default box shadow color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), @@ -1034,7 +1034,7 @@ class Settings extends Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1045,20 +1045,20 @@ class Settings extends Engine { */ public function hyperlink_arrow(): void { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'customize-hyperlink-arrow' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'customize-hyperlink-arrow' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-symbol' => $this->add_label( \footnotes\includes\Settings::C_STR_HYPERLINK_ARROW, __( 'Select or input the backlink symbol:', 'footnotes' ) ), - 'symbol-options' => $this->add_select_box( \footnotes\includes\Settings::C_STR_HYPERLINK_ARROW, Includes\Convert::get_arrow() ), - 'symbol-custom' => $this->add_text_box( \footnotes\includes\Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED ), + 'label-symbol' => $this->add_label( \footnotes\includes\Settings::HYPERLINK_ARROW, __( 'Select or input the backlink symbol:', 'footnotes' ) ), + 'symbol-options' => $this->add_select_box( \footnotes\includes\Settings::HYPERLINK_ARROW, Includes\Convert::get_arrow() ), + 'symbol-custom' => $this->add_text_box( \footnotes\includes\Settings::HYPERLINK_ARROW_USER_DEFINED ), 'notice-symbol' => __( 'Your input overrides the selection.', 'footnotes' ), 'description-symbol' => __( 'This symbol is used in the reference container. But this setting pre-existed under this tab and cannot be moved to another one.', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1069,12 +1069,12 @@ class Settings extends Engine { */ public function custom_css() { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'customize-css' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'customize-css' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-css' => $this->add_label( \footnotes\includes\Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), - 'css' => $this->add_textarea( \footnotes\includes\Settings::C_STR_CUSTOM_CSS ), + 'label-css' => $this->add_label( \footnotes\includes\Settings::CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), + 'css' => $this->add_textarea( \footnotes\includes\Settings::CUSTOM_CSS ), 'description-css' => __( 'Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area under the new tab.', 'footnotes' ), // phpcs:disable Squiz.PHP.CommentedOutCode.Found @@ -1097,7 +1097,7 @@ class Settings extends Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1110,22 +1110,22 @@ class Settings extends Engine { public function custom_css_migration(): void { // Options for Yes/No select box. - $l_arr_enabled = array( + $enabled = array( 'yes' => __( 'Yes', 'footnotes' ), 'no' => __( 'No', 'footnotes' ), ); // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'customize-css-migration' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'customize-css-migration' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-css' => $this->add_label( \footnotes\includes\Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), - 'css' => $this->add_textarea( \footnotes\includes\Settings::C_STR_CUSTOM_CSS ), + 'label-css' => $this->add_label( \footnotes\includes\Settings::CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), + 'css' => $this->add_textarea( \footnotes\includes\Settings::CUSTOM_CSS ), 'description-css' => __( 'Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area below. Set Show legacy to No. Save twice.', 'footnotes' ), - 'label-show-legacy' => $this->add_label( \footnotes\includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, 'Show legacy Custom CSS settings containers:' ), - 'show-legacy' => $this->add_select_box( \footnotes\includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, $l_arr_enabled ), + 'label-show-legacy' => $this->add_label( \footnotes\includes\Settings::CUSTOM_CSS_LEGACY_ENABLE, 'Show legacy Custom CSS settings containers:' ), + 'show-legacy' => $this->add_select_box( \footnotes\includes\Settings::CUSTOM_CSS_LEGACY_ENABLE, $enabled ), 'notice-show-legacy' => __( 'Please set to No when you are done migrating, for the legacy Custom CSS containers to disappear.', 'footnotes' ), // Translators: %s: Referres and tooltips. 'description-show-legacy' => sprintf( __( 'The legacy Custom CSS under the %s tab and its mirror here are emptied, and the select box saved as No, when the settings tab is saved while the settings container is not displayed.', 'footnotes' ), __( 'Referrers and tooltips', 'footnotes' ) ), @@ -1134,7 +1134,7 @@ class Settings extends Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1145,11 +1145,11 @@ class Settings extends Engine { */ public function custom_css_new(): void { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'customize-css-new' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'customize-css-new' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'css' => $this->add_textarea( \footnotes\includes\Settings::C_STR_CUSTOM_CSS_NEW ), + 'css' => $this->add_textarea( \footnotes\includes\Settings::CUSTOM_CSS_NEW ), 'headline' => $this->add_text( __( 'Recommended CSS classes:', 'footnotes' ) ), @@ -1157,7 +1157,7 @@ class Settings extends Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1175,10 +1175,10 @@ class Settings extends Engine { */ public function lookup_hooks(): void { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'expert-lookup' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'expert-lookup' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( 'description-1' => __( 'The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features.', 'footnotes' ), // Translators: 1: 99; 2: 1200. @@ -1192,35 +1192,35 @@ class Settings extends Engine { 'head-numbox' => __( 'Priority level', 'footnotes' ), 'head-url' => __( 'WordPress documentation', 'footnotes' ), - 'label-the-title' => $this->add_label( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_TITLE, 'the_title' ), - 'the-title' => $this->add_checkbox( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ), - 'priority-the-title' => $this->add_num_box( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-the-title' => $this->add_label( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_TITLE, 'the_title' ), + 'the-title' => $this->add_checkbox( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_TITLE ), + 'priority-the-title' => $this->add_num_box( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'url-the-title' => 'https://developer.wordpress.org/reference/hooks/the_title/', - 'label-the-content' => $this->add_label( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT, 'the_content' ), - 'the-content' => $this->add_checkbox( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ), - 'priority-the-content' => $this->add_num_box( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-the-content' => $this->add_label( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_CONTENT, 'the_content' ), + 'the-content' => $this->add_checkbox( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_CONTENT ), + 'priority-the-content' => $this->add_num_box( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'url-the-content' => 'https://developer.wordpress.org/reference/hooks/the_content/', - 'label-the-excerpt' => $this->add_label( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT, 'the_excerpt' ), - 'the-excerpt' => $this->add_checkbox( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ), - 'priority-the-excerpt' => $this->add_num_box( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-the-excerpt' => $this->add_label( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_EXCERPT, 'the_excerpt' ), + 'the-excerpt' => $this->add_checkbox( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_EXCERPT ), + 'priority-the-excerpt' => $this->add_num_box( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'url-the-excerpt' => 'https://developer.wordpress.org/reference/functions/the_excerpt/', - 'label-widget-title' => $this->add_label( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE, 'widget_title' ), - 'widget-title' => $this->add_checkbox( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ), - 'priority-widget-title' => $this->add_num_box( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-widget-title' => $this->add_label( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TITLE, 'widget_title' ), + 'widget-title' => $this->add_checkbox( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TITLE ), + 'priority-widget-title' => $this->add_num_box( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'url-widget-title' => 'https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title', - 'label-widget-text' => $this->add_label( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT, 'widget_text' ), - 'widget-text' => $this->add_checkbox( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ), - 'priority-widget-text' => $this->add_num_box( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-widget-text' => $this->add_label( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TEXT, 'widget_text' ), + 'widget-text' => $this->add_checkbox( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TEXT ), + 'priority-widget-text' => $this->add_num_box( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'url-widget-text' => 'https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text', ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1234,15 +1234,15 @@ class Settings extends Engine { $footnotes = new General\General( $this->plugin_name, 'foo' ); // Load footnotes starting and end tag. - $l_arr_footnote_starting_tag = $this->load_setting( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); - $l_arr_footnote_ending_tag = $this->load_setting( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); + $footnote_starting_tag = $this->load_setting( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START ); + $footnote_ending_tag = $this->load_setting( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END ); - if ( 'userdefined' === $l_arr_footnote_starting_tag['value'] || 'userdefined' === $l_arr_footnote_ending_tag['value'] ) { + if ( 'userdefined' === $footnote_starting_tag['value'] || 'userdefined' === $footnote_ending_tag['value'] ) { // Load user defined starting and end tag. - $l_arr_footnote_starting_tag = $this->load_setting( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $l_arr_footnote_ending_tag = $this->load_setting( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $footnote_starting_tag = $this->load_setting( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $footnote_ending_tag = $this->load_setting( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } - $l_str_example = 'Hello' . $l_arr_footnote_starting_tag['value'] . + $example = 'Hello' . $footnote_starting_tag['value'] . 'Sed ut perspiciatis, unde omnis iste natus error ' . 'sit voluptatem accusantium doloremque laudantium, ' . 'totam rem aperiam eaque ipsa, quae ab illo ' . @@ -1255,20 +1255,20 @@ class Settings extends Engine { 'dolor sit amet, consectetur, adipisci velit, sed ' . 'quia non numquam eius modi tempora incidunt, ut ' . 'labore et dolore magnam aliquam quaerat voluptatem.' . - $l_arr_footnote_ending_tag['value'] . ' World!'; + $footnote_ending_tag['value'] . ' World!'; // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'how-to-help' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'how-to-help' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( 'label-start' => __( 'Start your footnote with the following short code:', 'footnotes' ), - 'start' => $l_arr_footnote_starting_tag['value'], + 'start' => $footnote_starting_tag['value'], 'label-end' => __( '…and end your footnote with this short code:', 'footnotes' ), - 'end' => $l_arr_footnote_ending_tag['value'], - 'example-code' => $l_str_example, + 'end' => $footnote_ending_tag['value'], + 'example-code' => $example, 'example-string' => '
' . __( 'will be displayed as:', 'footnotes' ), - 'example' => $footnotes->a_obj_task->exec( $l_str_example, true ), + 'example' => $footnotes->task->exec( $example, true ), // Translators: %1$s, %2$s: anchor element with hyperlink to the Support Forum. 'information' => sprintf( __( 'For further information please check out our %1$sSupport Forum%2$s on WordPress.org.', 'footnotes' ), '', '' ), ) @@ -1282,11 +1282,11 @@ class Settings extends Engine { * the name of the filtered function. * When this callback function was renamed, this call went unnoticed. */ - $footnotes->a_obj_task->footnotes_output_head(); + $footnotes->task->footnotes_output_head(); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1297,16 +1297,16 @@ class Settings extends Engine { */ public function donate(): void { // Load template file. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_DASHBOARD, 'how-to-donate' ); + $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'how-to-donate' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( 'caption' => __( 'Donate now', 'footnotes' ), ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } } diff --git a/src/includes/class-config.php b/src/includes/class-config.php index 8f93d29..5b1786f 100644 --- a/src/includes/class-config.php +++ b/src/includes/class-config.php @@ -55,7 +55,7 @@ class Config { * * @var string */ - const C_STR_PLUGIN_PUBLIC_NAME = ''; + const PLUGIN_PUBLIC_NAME = ''; /** * Public plugin name for use as a dashboard heading. @@ -72,7 +72,7 @@ class Config { * * @var string */ - const C_STR_PLUGIN_HEADING_NAME = 'footnotes'; + const PLUGIN_HEADING_NAME = 'footnotes'; /** * HTML element for the ‘love’ symbol. @@ -83,7 +83,7 @@ class Config { * * @var string */ - const C_STR_LOVE_SYMBOL = ''; + const LOVE_SYMBOL = ''; /** * HTML element for the ‘love’ symbol used in dashboard heading @@ -94,7 +94,7 @@ class Config { * * @var string */ - const C_STR_LOVE_SYMBOL_HEADING = ''; + const LOVE_SYMBOL_HEADING = ''; /** * Shortcode to NOT display the ‘LOVE ME’ slug on certain pages. @@ -105,5 +105,5 @@ class Config { * * @var string */ - const C_STR_NO_LOVE_SLUG = '[[no footnotes: love]]'; + const NO_LOVE_SLUG = '[[no footnotes: love]]'; } diff --git a/src/includes/class-convert.php b/src/includes/class-convert.php index 59b955c..73dc048 100644 --- a/src/includes/class-convert.php +++ b/src/includes/class-convert.php @@ -22,27 +22,27 @@ class 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 $index Index to be converted. + * @param string $convert_style Counter style to use. * @return string The index converted to the defined counter style. * * @since 1.5.0 */ - public static function index( int $p_int_index, string $p_str_convert_style = 'arabic_plain' ): string { - switch ( $p_str_convert_style ) { + public static function index( int $index, string $convert_style = 'arabic_plain' ): string { + switch ( $convert_style ) { case 'roman': - return self::to_roman( $p_int_index, true ); + return self::to_roman( $index, true ); case 'roman_low': - return self::to_roman( $p_int_index, false ); + return self::to_roman( $index, false ); case 'latin_high': - return self::to_latin( $p_int_index, true ); + return self::to_latin( $index, true ); case 'latin_low': - return self::to_latin( $p_int_index, false ); + return self::to_latin( $index, false ); case 'arabic_leading': - return self::to_arabic_leading( $p_int_index ); + return self::to_arabic_leading( $index ); case 'arabic_plain': default: - return (string) $p_int_index; + return (string) $index; } } @@ -52,63 +52,63 @@ class Convert { * This function works from values A–ZZ (meaning there is a limit of 676 * 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 int $value Value to be converted. + * @param bool $upper_case Whether to convert the value to upper-case. * * @since 1.0-gamma * @todo Replace with built-in char casting. */ - private static function to_latin( int $p_int_value, bool $p_bool_upper_case ): string { + private static function to_latin( int $value, bool $upper_case ): string { // Output string. - $l_str_return = ''; - $l_int_offset = 0; + $return = ''; + $offset = 0; // Check if the value is higher then 26 = Z. - while ( $p_int_value > 26 ) { + while ( $value > 26 ) { // Increase offset and reduce counter. - $l_int_offset++; - $p_int_value -= 26; + $offset++; + $value -= 26; } // If offset set (more then Z), then add a new letter in front. - if ( $l_int_offset > 0 ) { - $l_str_return = chr( $l_int_offset + 64 ); + if ( $offset > 0 ) { + $return = chr( $offset + 64 ); } // Add the origin letter. - $l_str_return .= chr( $p_int_value + 64 ); + $return .= chr( $value + 64 ); // Return the latin character representing the integer. - if ( $p_bool_upper_case ) { - return strtoupper( $l_str_return ); + if ( $upper_case ) { + return strtoupper( $return ); } - return strtolower( $l_str_return ); + return strtolower( $return ); } /** * Converts an integer to a leading-0 integer. * - * @param int $p_int_value Value to be converted. + * @param int $value Value to be converted. * @return string Value with a leading zero. * * @since 1.0-gamma * @todo Replace with built-in string formatting. */ - private static function to_arabic_leading( int $p_int_value ): string { + private static function to_arabic_leading( int $value ): string { // Add a leading 0 if number lower then 10. - if ( $p_int_value < 10 ) { - return '0' . $p_int_value; + if ( $value < 10 ) { + return '0' . $value; } - return $p_int_value; + return $value; } /** * 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 int $value Value to be converted. + * @param bool $upper_case Whether to convert the value to upper-case. * * @since 1.0-gamma */ - private static function to_roman( int $p_int_value, bool $p_bool_upper_case ): string { + private static function to_roman( int $value, bool $upper_case ): string { // Table containing all necessary roman letters. - $l_arr_roman_numerals = array( + $roman_numerals = array( 'M' => 1000, 'CM' => 900, 'D' => 500, @@ -124,38 +124,38 @@ class Convert { 'I' => 1, ); // Return value. - $l_str_return = ''; + $return = ''; // Iterate through integer value until it is reduced to 0. - while ( $p_int_value > 0 ) { - foreach ( $l_arr_roman_numerals as $l_str_roman => $l_int_arabic ) { - if ( $p_int_value >= $l_int_arabic ) { - $p_int_value -= $l_int_arabic; - $l_str_return .= $l_str_roman; + while ( $value > 0 ) { + foreach ( $roman_numerals as $roman => $arabic ) { + if ( $value >= $arabic ) { + $value -= $arabic; + $return .= $roman; break; } } } // Return roman letters as string. - if ( $p_bool_upper_case ) { - return strtoupper( $l_str_return ); + if ( $upper_case ) { + return strtoupper( $return ); } - return strtolower( $l_str_return ); + return strtolower( $return ); } /** * Converts a string depending on its value to a boolean. * - * @param string $p_str_value String to be converted to boolean. + * @param string $value String to be converted to boolean. * @return bool Boolean value represented by the string. * * @since 1.0-beta * @todo Replace with built-in type casting. */ - public static function to_bool( string $p_str_value ): bool { + public static function to_bool( string $value ): bool { // Convert string to lower-case to make it easier. - $p_str_value = strtolower( $p_str_value ); + $value = strtolower( $value ); // Check if string seems to contain a "true" value. - switch ( $p_str_value ) { + switch ( $value ) { case 'checked': case 'yes': case 'true': @@ -170,29 +170,29 @@ class 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 $index Index representing the arrow. If empty, all arrows are specified. * @return string|string[] Array of all arrows if index is empty, otherwise HTML tag of a specific arrow. * * @since 1.3.2 * @todo Review. * @todo Single return type. */ - public static function get_arrow( int $p_int_index = -1 ): string|array { + public static function get_arrow( int $index = -1 ): string|array { // Define all possible arrows. - $l_arr_arrows = array( '↑', '↥', '↟', '↩', '↲', '↵', '⇑', '⇡', '⇧', '↑' ); + $arrows = array( '↑', '↥', '↟', '↩', '↲', '↵', '⇑', '⇡', '⇧', '↑' ); // Convert index to an integer. - if ( ! is_int( $p_int_index ) ) { - $p_int_index = (int) $p_int_index; + if ( ! is_int( $index ) ) { + $index = (int) $index; } // Return the whole arrow array. - if ( $p_int_index < 0 ) { - return $l_arr_arrows; + if ( $index < 0 ) { + return $arrows; } - if ( $p_int_index > count( $l_arr_arrows ) ) { - return $l_arr_arrows; + if ( $index > count( $arrows ) ) { + return $arrows; } // Return a single arrow. - return $l_arr_arrows[ $p_int_index ]; + return $arrows[ $index ]; } // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_dump, WordPress.PHP.DevelopmentFunctions.error_log_print_r diff --git a/src/includes/class-i18n.php b/src/includes/class-i18n.php index c01d116..e63d8d5 100644 --- a/src/includes/class-i18n.php +++ b/src/includes/class-i18n.php @@ -32,7 +32,7 @@ class i18n { * Load the plugin text domain for translation. * * @since 1.5.1 - * @since 2.8.0 Rename from `load()` to `load_plugin_textdomain()`. Remove unused `$p_str_language_code` parameter. + * @since 2.8.0 Rename from `load()` to `load_plugin_textdomain()`. Remove unused `$language_code` parameter. * * @return void */ diff --git a/src/includes/class-settings.php b/src/includes/class-settings.php index 50591de..4f295f9 100644 --- a/src/includes/class-settings.php +++ b/src/includes/class-settings.php @@ -35,7 +35,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_REFERENCE_CONTAINER_NAME = 'footnote_inputfield_references_label'; + const REFERENCE_CONTAINER_NAME = 'footnote_inputfield_references_label'; /** * Settings container key to collapse the reference container by default. @@ -47,7 +47,7 @@ class Settings { * @since 1.5.0 * @todo Refactor to use sane typing. */ - const C_STR_REFERENCE_CONTAINER_COLLAPSE = 'footnote_inputfield_collapse_references'; + const REFERENCE_CONTAINER_COLLAPSE = 'footnote_inputfield_collapse_references'; /** * Settings container key for the position of the reference container. @@ -56,7 +56,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_REFERENCE_CONTAINER_POSITION = 'footnote_inputfield_reference_container_place'; + const REFERENCE_CONTAINER_POSITION = 'footnote_inputfield_reference_container_place'; /** * Settings container key for combining identical footnotes. @@ -65,7 +65,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_COMBINE_IDENTICAL_FOOTNOTES = 'footnote_inputfield_combine_identical'; + const COMBINE_IDENTICAL_FOOTNOTES = 'footnote_inputfield_combine_identical'; /** * Settings container key for the short code of the footnote's start. @@ -74,7 +74,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_SHORT_CODE_START = 'footnote_inputfield_placeholder_start'; + const FOOTNOTES_SHORT_CODE_START = 'footnote_inputfield_placeholder_start'; /** * Settings container key for the short code of the footnote's end. @@ -83,7 +83,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_SHORT_CODE_END = 'footnote_inputfield_placeholder_end'; + const FOOTNOTES_SHORT_CODE_END = 'footnote_inputfield_placeholder_end'; /** * Settings container key for the user-defined short code of the footnotes start. @@ -92,7 +92,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED = 'footnote_inputfield_placeholder_start_user_defined'; + const FOOTNOTES_SHORT_CODE_START_USER_DEFINED = 'footnote_inputfield_placeholder_start_user_defined'; /** * Settings container key for the user-defined short code of the footnotes end. @@ -101,7 +101,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED = 'footnote_inputfield_placeholder_end_user_defined'; + const FOOTNOTES_SHORT_CODE_END_USER_DEFINED = 'footnote_inputfield_placeholder_end_user_defined'; /** * Settings container key for the counter style of the footnotes. @@ -110,7 +110,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_COUNTER_STYLE = 'footnote_inputfield_counter_style'; + const FOOTNOTES_COUNTER_STYLE = 'footnote_inputfield_counter_style'; /** * Settings container key for the backlink symbol selection. @@ -119,7 +119,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_HYPERLINK_ARROW = 'footnote_inputfield_custom_hyperlink_symbol'; + const HYPERLINK_ARROW = 'footnote_inputfield_custom_hyperlink_symbol'; /** * Settings container key for the user-defined backlink symbol. @@ -128,18 +128,18 @@ class Settings { * * @since 1.5.0 */ - const C_STR_HYPERLINK_ARROW_USER_DEFINED = 'footnote_inputfield_custom_hyperlink_symbol_user'; + const HYPERLINK_ARROW_USER_DEFINED = 'footnote_inputfield_custom_hyperlink_symbol_user'; /** * Settings container key to look for footnotes in post excerpts. * - * @see C_STR_EXPERT_LOOKUP_THE_EXCERPT + * @see EXPERT_LOOKUP_THE_EXCERPT * @var string * * @since 1.5.0 * @since 2.6.3 Enabled by default. */ - const C_STR_FOOTNOTES_IN_EXCERPT = 'footnote_inputfield_search_in_excerpt'; + const FOOTNOTES_IN_EXCERPT = 'footnote_inputfield_search_in_excerpt'; /** * Settings container key for the string before the footnote referrer. @@ -153,7 +153,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_STYLING_BEFORE = 'footnote_inputfield_custom_styling_before'; + const FOOTNOTES_STYLING_BEFORE = 'footnote_inputfield_custom_styling_before'; /** * Settings container key for the string after the footnote referrer. @@ -162,7 +162,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_STYLING_AFTER = 'footnote_inputfield_custom_styling_after'; + const FOOTNOTES_STYLING_AFTER = 'footnote_inputfield_custom_styling_after'; /** * Settings container key for the Custom CSS. @@ -171,7 +171,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_CUSTOM_CSS = 'footnote_inputfield_custom_css'; + const CUSTOM_CSS = 'footnote_inputfield_custom_css'; /** * Settings container key for the ‘I love footnotes’ text. @@ -180,7 +180,7 @@ class Settings { * * @since 1.5.0 */ - const C_STR_FOOTNOTES_LOVE = 'footnote_inputfield_love'; + const FOOTNOTES_LOVE = 'footnote_inputfield_love'; /** * Settings container key to enable the mouse-over box. @@ -189,7 +189,7 @@ class Settings { * * @since 1.5.2 */ - const C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED = 'footnote_inputfield_custom_mouse_over_box_enabled'; + const FOOTNOTES_MOUSE_OVER_BOX_ENABLED = 'footnote_inputfield_custom_mouse_over_box_enabled'; /** * Settings container key to enable tooltip truncation. @@ -201,7 +201,7 @@ class Settings { * 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'; + const 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 @@ -213,7 +213,7 @@ class Settings { * * @since 1.5.4 */ - const C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH = 'footnote_inputfield_custom_mouse_over_box_excerpt_length'; + const FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH = 'footnote_inputfield_custom_mouse_over_box_excerpt_length'; /** * Settings container key to enable the `the_title` hook. @@ -233,7 +233,7 @@ class Settings { * 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'; + const EXPERT_LOOKUP_THE_TITLE = 'footnote_inputfield_expert_lookup_the_title'; /** * Settings container key to enable the `the_content` hook. @@ -242,19 +242,19 @@ class Settings { * * @since 1.5.5 */ - const C_STR_EXPERT_LOOKUP_THE_CONTENT = 'footnote_inputfield_expert_lookup_the_content'; + const EXPERT_LOOKUP_THE_CONTENT = 'footnote_inputfield_expert_lookup_the_content'; /** * Settings container key to enable the `the_excerpt` hook. * * @var string * - * @see C_STR_FOOTNOTES_IN_EXCERPT + * @see FOOTNOTES_IN_EXCERPT * * @since 1.5.5 * @since 2.6.3 Enable by default. */ - const C_STR_EXPERT_LOOKUP_THE_EXCERPT = 'footnote_inputfield_expert_lookup_the_excerpt'; + const EXPERT_LOOKUP_THE_EXCERPT = 'footnote_inputfield_expert_lookup_the_excerpt'; /** * Settings container key to enable the `widget_title` hook. @@ -263,7 +263,7 @@ class Settings { * * @since 1.5.5 */ - const C_STR_EXPERT_LOOKUP_WIDGET_TITLE = 'footnote_inputfield_expert_lookup_widget_title'; + const EXPERT_LOOKUP_WIDGET_TITLE = 'footnote_inputfield_expert_lookup_widget_title'; /** * Settings container key to enable the `widget_text` hook. @@ -277,7 +277,7 @@ class Settings { * * @since 1.5.5 */ - const C_STR_EXPERT_LOOKUP_WIDGET_TEXT = 'footnote_inputfield_expert_lookup_widget_text'; + const EXPERT_LOOKUP_WIDGET_TEXT = 'footnote_inputfield_expert_lookup_widget_text'; /** * Settings container key for the Expert mode. @@ -292,18 +292,18 @@ class Settings { * @deprecated * @todo Un-deprecate. */ - const C_STR_FOOTNOTES_EXPERT_MODE = 'footnote_inputfield_enable_expert_mode'; + const FOOTNOTES_EXPERT_MODE = 'footnote_inputfield_enable_expert_mode'; /** * Settings container key for the mouse-over box to define the color. * * @var string * - * @see C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND + * @see FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND * * @since 1.5.6 */ - const C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR = 'footnote_inputfield_custom_mouse_over_box_color'; + const FOOTNOTES_MOUSE_OVER_BOX_COLOR = 'footnote_inputfield_custom_mouse_over_box_color'; /** * Settings container key for the mouse-over box to define the background color. @@ -315,11 +315,11 @@ class Settings { * * @var string * - * @see C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR + * @see FOOTNOTES_MOUSE_OVER_BOX_COLOR * * @since 1.5.6 */ - const C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND = 'footnote_inputfield_custom_mouse_over_box_background'; + const FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND = 'footnote_inputfield_custom_mouse_over_box_background'; /** * Settings container key for the mouse-over box to define the border width. @@ -328,7 +328,7 @@ class Settings { * * @since 1.5.6 */ - const C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH = 'footnote_inputfield_custom_mouse_over_box_border_width'; + const FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH = 'footnote_inputfield_custom_mouse_over_box_border_width'; /** * Settings container key for the mouse-over box to define the border color. @@ -337,7 +337,7 @@ class Settings { * * @since 1.5.6 */ - const C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR = 'footnote_inputfield_custom_mouse_over_box_border_color'; + const FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR = 'footnote_inputfield_custom_mouse_over_box_border_color'; /** * Settings container key for the mouse-over box to define the border radius. @@ -346,7 +346,7 @@ class Settings { * * @since 1.5.6 */ - const C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS = 'footnote_inputfield_custom_mouse_over_box_border_radius'; + const FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS = 'footnote_inputfield_custom_mouse_over_box_border_radius'; /** * Settings container key for the mouse-over box to define the max. width. @@ -359,7 +359,7 @@ class Settings { * * @since 1.5.6 */ - const C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH = 'footnote_inputfield_custom_mouse_over_box_max_width'; + const FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH = 'footnote_inputfield_custom_mouse_over_box_max_width'; /** * Settings container key for the mouse-over box to define the position. @@ -372,7 +372,7 @@ class Settings { * * @since 1.5.7 */ - const C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION = 'footnote_inputfield_custom_mouse_over_box_position'; + const FOOTNOTES_MOUSE_OVER_BOX_POSITION = 'footnote_inputfield_custom_mouse_over_box_position'; /** * Settings container key for the mouse-over box to define the _x_-offset. @@ -381,7 +381,7 @@ class Settings { * * @since 1.5.7 */ - const C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X = 'footnote_inputfield_custom_mouse_over_box_offset_x'; + const FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X = 'footnote_inputfield_custom_mouse_over_box_offset_x'; /** * Settings container key for the mouse-over box to define the _y_-offset. @@ -393,7 +393,7 @@ class Settings { * * @since 1.5.7 */ - const C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y = 'footnote_inputfield_custom_mouse_over_box_offset_y'; + const FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y = 'footnote_inputfield_custom_mouse_over_box_offset_y'; /** * Settings container key for the mouse-over box to define the box-shadow color. @@ -402,7 +402,7 @@ class Settings { * * @since 1.5.8 */ - const C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR = 'footnote_inputfield_custom_mouse_over_box_shadow_color'; + const FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR = 'footnote_inputfield_custom_mouse_over_box_shadow_color'; /** * Settings container key for the label of the Read-on button in truncated tooltips. @@ -411,7 +411,7 @@ class Settings { * * @since 2.1.0 */ - const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = 'footnote_inputfield_readon_label'; + const FOOTNOTES_TOOLTIP_READON_LABEL = 'footnote_inputfield_readon_label'; /** * Settings container key to enable the alternative tooltips. @@ -425,7 +425,7 @@ class Settings { * * @since 2.1.1 */ - const C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE = 'footnote_inputfield_custom_mouse_over_box_alternative'; + const FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE = 'footnote_inputfield_custom_mouse_over_box_alternative'; /** * Settings container key for the referrer element. @@ -434,7 +434,7 @@ class Settings { * * @since 2.1.1 */ - const C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = 'footnotes_inputfield_referrer_superscript_tags'; + const FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = 'footnotes_inputfield_referrer_superscript_tags'; /** * Settings container key to enable the display of a backlink symbol. @@ -443,7 +443,7 @@ class Settings { * * @since 2.1.1 */ - const C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE = 'footnotes_inputfield_reference_container_backlink_symbol_enable'; + const REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE = 'footnotes_inputfield_reference_container_backlink_symbol_enable'; /** * Settings container key to not display the reference container on the homepage. @@ -452,7 +452,7 @@ class Settings { * * @since 2.1.1 */ - const C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE = 'footnotes_inputfield_reference_container_start_page_enable'; + const REFERENCE_CONTAINER_START_PAGE_ENABLE = 'footnotes_inputfield_reference_container_start_page_enable'; /** * Settings container key to enable the legacy layout of the reference container. @@ -461,7 +461,7 @@ class Settings { * * @since 2.1.1 */ - const C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE = 'footnotes_inputfield_reference_container_3column_layout_enable'; + const REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE = 'footnotes_inputfield_reference_container_3column_layout_enable'; /** * Settings container key to get the backlink symbol switch side. @@ -470,7 +470,7 @@ class Settings { * * @since 2.1.1 */ - const C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH = 'footnotes_inputfield_reference_container_backlink_symbol_switch'; + const REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH = 'footnotes_inputfield_reference_container_backlink_symbol_switch'; /** * Settings container key for `the_content` hook priority level. @@ -495,7 +495,7 @@ class Settings { * * @since 2.0.5 */ - const C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_content_priority_level'; + const EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_content_priority_level'; /** * Settings container key for `the_title` hook priority level. @@ -504,7 +504,7 @@ class Settings { * * @since 2.1.2 */ - const C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_title_priority_level'; + const EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_title_priority_level'; /** * Settings container key for `widget_title` hook priority level. @@ -513,7 +513,7 @@ class Settings { * * @since 2.1.2 */ - const C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_widget_title_priority_level'; + const EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_widget_title_priority_level'; /** * Settings container key for `widget_text` hook priority level. @@ -522,7 +522,7 @@ class Settings { * * @since 2.1.2 */ - const C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_widget_text_priority_level'; + const EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_widget_text_priority_level'; /** * Settings container key for `the_excerpt` hook priority level. @@ -531,7 +531,7 @@ class Settings { * * @since 2.1.2 */ - const C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_excerpt_priority_level'; + const EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_excerpt_priority_level'; /** * Settings container key for the link element option. @@ -540,7 +540,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_LINK_ELEMENT_ENABLED = 'footnote_inputfield_link_element_enabled'; + const LINK_ELEMENT_ENABLED = 'footnote_inputfield_link_element_enabled'; /** * Settings container key to enable the presence of a backlink separator. @@ -552,7 +552,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_SEPARATOR_ENABLED = 'footnotes_inputfield_backlinks_separator_enabled'; + const BACKLINKS_SEPARATOR_ENABLED = 'footnotes_inputfield_backlinks_separator_enabled'; /** * Settings container key for the backlink separator options. @@ -561,7 +561,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_SEPARATOR_OPTION = 'footnotes_inputfield_backlinks_separator_option'; + const BACKLINKS_SEPARATOR_OPTION = 'footnotes_inputfield_backlinks_separator_option'; /** * Settings container key for a custom backlink separator. @@ -570,7 +570,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_SEPARATOR_CUSTOM = 'footnotes_inputfield_backlinks_separator_custom'; + const BACKLINKS_SEPARATOR_CUSTOM = 'footnotes_inputfield_backlinks_separator_custom'; /** * Settings container key to enable the presence of a backlink terminator. @@ -579,7 +579,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_TERMINATOR_ENABLED = 'footnotes_inputfield_backlinks_terminator_enabled'; + const BACKLINKS_TERMINATOR_ENABLED = 'footnotes_inputfield_backlinks_terminator_enabled'; /** * Settings container key for the backlink terminator options. @@ -588,7 +588,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_TERMINATOR_OPTION = 'footnotes_inputfield_backlinks_terminator_option'; + const BACKLINKS_TERMINATOR_OPTION = 'footnotes_inputfield_backlinks_terminator_option'; /** * Settings container key for a custom backlink terminator. @@ -597,7 +597,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_TERMINATOR_CUSTOM = 'footnotes_inputfield_backlinks_terminator_custom'; + const BACKLINKS_TERMINATOR_CUSTOM = 'footnotes_inputfield_backlinks_terminator_custom'; /** * Settings container key to enable the backlinks column width. @@ -606,7 +606,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED = 'footnotes_inputfield_backlinks_column_width_enabled'; + const BACKLINKS_COLUMN_WIDTH_ENABLED = 'footnotes_inputfield_backlinks_column_width_enabled'; /** * Settings container key for the backlinks column width scalar. @@ -615,7 +615,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR = 'footnotes_inputfield_backlinks_column_width_scalar'; + const BACKLINKS_COLUMN_WIDTH_SCALAR = 'footnotes_inputfield_backlinks_column_width_scalar'; /** * Settings container key for the backlinks column width unit. @@ -624,7 +624,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_COLUMN_WIDTH_UNIT = 'footnotes_inputfield_backlinks_column_width_unit'; + const BACKLINKS_COLUMN_WIDTH_UNIT = 'footnotes_inputfield_backlinks_column_width_unit'; /** * Settings container key to enable a max width for the backlinks column. @@ -633,7 +633,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED = 'footnotes_inputfield_backlinks_column_max_width_enabled'; + const BACKLINKS_COLUMN_MAX_WIDTH_ENABLED = 'footnotes_inputfield_backlinks_column_max_width_enabled'; /** * Settings container key for the backlinks column max width scalar. @@ -642,7 +642,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR = 'footnotes_inputfield_backlinks_column_max_width_scalar'; + const BACKLINKS_COLUMN_MAX_WIDTH_SCALAR = 'footnotes_inputfield_backlinks_column_max_width_scalar'; /** * Settings container key for the backlinks column max width unit. @@ -651,7 +651,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT = 'footnotes_inputfield_backlinks_column_max_width_unit'; + const BACKLINKS_COLUMN_MAX_WIDTH_UNIT = 'footnotes_inputfield_backlinks_column_max_width_unit'; /** * Settings container key to enable line breaks between backlinks. @@ -661,7 +661,7 @@ class Settings { * @since 2.1.4 * Whether a
tag is inserted. */ - const C_STR_BACKLINKS_LINE_BREAKS_ENABLED = 'footnotes_inputfield_backlinks_line_breaks_enabled'; + const BACKLINKS_LINE_BREAKS_ENABLED = 'footnotes_inputfield_backlinks_line_breaks_enabled'; /** * Settings container key to enable setting the tooltip font size. @@ -674,7 +674,7 @@ class Settings { * Was set to inherit since 2.1.1 as it overrode custom CSS, * Called mouse over box not tooltip for consistency. */ - const C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED = 'footnotes_inputfield_mouse_over_box_font_size_enabled'; + const MOUSE_OVER_BOX_FONT_SIZE_ENABLED = 'footnotes_inputfield_mouse_over_box_font_size_enabled'; /** * Settings container key for the scalar value of the tooltip font size. @@ -683,7 +683,7 @@ class Settings { * * @since 2.1.4 */ - const C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR = 'footnotes_inputfield_mouse_over_box_font_size_scalar'; + const MOUSE_OVER_BOX_FONT_SIZE_SCALAR = 'footnotes_inputfield_mouse_over_box_font_size_scalar'; /** * Settings container key for the unit of the tooltip font size. @@ -692,7 +692,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT = 'footnotes_inputfield_mouse_over_box_font_size_unit'; + const MOUSE_OVER_BOX_FONT_SIZE_UNIT = 'footnotes_inputfield_mouse_over_box_font_size_unit'; /** * Settings container key for basic responsive page layout support options. @@ -703,7 +703,7 @@ class Settings { * * @since 2.1.4 */ - const C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT = 'footnotes_inputfield_page_layout_support'; + const FOOTNOTES_PAGE_LAYOUT_SUPPORT = 'footnotes_inputfield_page_layout_support'; /** * Settings container key for scroll offset. @@ -712,7 +712,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_FOOTNOTES_SCROLL_OFFSET = 'footnotes_inputfield_scroll_offset'; + const FOOTNOTES_SCROLL_OFFSET = 'footnotes_inputfield_scroll_offset'; /** * Settings container key for scroll duration. @@ -721,7 +721,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_FOOTNOTES_SCROLL_DURATION = 'footnotes_inputfield_scroll_duration'; + const FOOTNOTES_SCROLL_DURATION = 'footnotes_inputfield_scroll_duration'; /** * Settings container key for tooltip display fade-in delay. @@ -730,7 +730,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY = 'footnotes_inputfield_mouse_over_box_fade_in_delay'; + const MOUSE_OVER_BOX_FADE_IN_DELAY = 'footnotes_inputfield_mouse_over_box_fade_in_delay'; /** * Settings container key for tooltip display fade-in duration. @@ -739,7 +739,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION = 'footnotes_inputfield_mouse_over_box_fade_in_duration'; + const MOUSE_OVER_BOX_FADE_IN_DURATION = 'footnotes_inputfield_mouse_over_box_fade_in_duration'; /** * Settings container key for tooltip display fade-out delay. @@ -748,7 +748,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY = 'footnotes_inputfield_mouse_over_box_fade_out_delay'; + const MOUSE_OVER_BOX_FADE_OUT_DELAY = 'footnotes_inputfield_mouse_over_box_fade_out_delay'; /** * Settings container key for tooltip display fade-out duration. @@ -757,7 +757,7 @@ class Settings { * * @since 2.1.4 */ - const C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION = 'footnotes_inputfield_mouse_over_box_fade_out_duration'; + const MOUSE_OVER_BOX_FADE_OUT_DURATION = 'footnotes_inputfield_mouse_over_box_fade_out_duration'; /** * Settings container key for URL wrap option. @@ -769,7 +769,7 @@ class Settings { * * @since 2.1.6 */ - const C_STR_FOOTNOTE_URL_WRAP_ENABLED = 'footnote_inputfield_url_wrap_enabled'; + const FOOTNOTE_URL_WRAP_ENABLED = 'footnote_inputfield_url_wrap_enabled'; /** * Settings container key for reference container position shortcode. @@ -778,7 +778,7 @@ class Settings { * * @since 2.2.0 */ - const C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE = 'footnote_inputfield_reference_container_position_shortcode'; + const REFERENCE_CONTAINER_POSITION_SHORTCODE = 'footnote_inputfield_reference_container_position_shortcode'; /** * Settings container key for the Custom CSS migrated to a dedicated tab. @@ -787,7 +787,7 @@ class Settings { * * @since 2.2.2 */ - const C_STR_CUSTOM_CSS_NEW = 'footnote_inputfield_custom_css_new'; + const CUSTOM_CSS_NEW = 'footnote_inputfield_custom_css_new'; /** * Settings container key to enable display of legacy Custom CSS metaboxes. @@ -802,7 +802,7 @@ class Settings { * @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'; + const CUSTOM_CSS_LEGACY_ENABLE = 'footnote_inputfield_custom_css_legacy_enable'; /** * Settings container key for alternative tooltip position. @@ -813,7 +813,7 @@ class Settings { * * @since 2.2.5 */ - const C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION = 'footnotes_inputfield_alternative_mouse_over_box_position'; + const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION = 'footnotes_inputfield_alternative_mouse_over_box_position'; /** * Settings container key for alternative tooltip _x_-offset. @@ -822,7 +822,7 @@ class Settings { * * @since 2.2.5 */ - const C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X = 'footnotes_inputfield_alternative_mouse_over_box_offset_x'; + const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X = 'footnotes_inputfield_alternative_mouse_over_box_offset_x'; /** * Settings container key for alternative tooltip _y_-offset. @@ -831,7 +831,7 @@ class Settings { * * @since 2.2.5 */ - const C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y = 'footnotes_inputfield_alternative_mouse_over_box_offset_y'; + const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y = 'footnotes_inputfield_alternative_mouse_over_box_offset_y'; /** * Settings container key for alternative tooltip width. @@ -840,7 +840,7 @@ class Settings { * * @since 2.2.5 */ - const C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH = 'footnotes_inputfield_alternative_mouse_over_box_width'; + const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH = 'footnotes_inputfield_alternative_mouse_over_box_width'; /** @@ -850,7 +850,7 @@ class Settings { * * @since 2.2.5 */ - const C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT = 'footnotes_inputfield_reference_container_label_element'; + const REFERENCE_CONTAINER_LABEL_ELEMENT = 'footnotes_inputfield_reference_container_label_element'; /** * Settings container key to enable the reference container label bottom border. @@ -859,7 +859,7 @@ class Settings { * * @since 2.2.5 */ - const C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER = 'footnotes_inputfield_reference_container_label_bottom_border'; + const REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER = 'footnotes_inputfield_reference_container_label_bottom_border'; /** * Settings container key to enable reference container table row borders. @@ -868,7 +868,7 @@ class Settings { * * @since 2.2.10 */ - const C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE = 'footnotes_inputfield_reference_container_row_borders_enable'; + const REFERENCE_CONTAINER_ROW_BORDERS_ENABLE = 'footnotes_inputfield_reference_container_row_borders_enable'; /** * Settings container key for reference container top margin. @@ -877,7 +877,7 @@ class Settings { * * @since 2.3.0 */ - const C_INT_REFERENCE_CONTAINER_TOP_MARGIN = 'footnotes_inputfield_reference_container_top_margin'; + const REFERENCE_CONTAINER_TOP_MARGIN = 'footnotes_inputfield_reference_container_top_margin'; /** * Settings container key for reference container bottom margin. @@ -886,7 +886,7 @@ class Settings { * * @since 2.3.0 */ - const C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN = 'footnotes_inputfield_reference_container_bottom_margin'; + const REFERENCE_CONTAINER_BOTTOM_MARGIN = 'footnotes_inputfield_reference_container_bottom_margin'; /** * Settings container key to enable hard links. @@ -897,7 +897,7 @@ class Settings { * * @since 2.3.0 */ - const C_STR_FOOTNOTES_HARD_LINKS_ENABLE = 'footnotes_inputfield_hard_links_enable'; + const FOOTNOTES_HARD_LINKS_ENABLE = 'footnotes_inputfield_hard_links_enable'; /** * Settings container key for the fragment ID slug in referrers. @@ -906,7 +906,7 @@ class Settings { * * @since 2.3.0 */ - const C_STR_REFERRER_FRAGMENT_ID_SLUG = 'footnotes_inputfield_referrer_fragment_id_slug'; + const REFERRER_FRAGMENT_ID_SLUG = 'footnotes_inputfield_referrer_fragment_id_slug'; /** * Settings container key for the fragment ID slug in footnotes. @@ -915,7 +915,7 @@ class Settings { * * @since 2.3.0 */ - const C_STR_FOOTNOTE_FRAGMENT_ID_SLUG = 'footnotes_inputfield_footnote_fragment_id_slug'; + const FOOTNOTE_FRAGMENT_ID_SLUG = 'footnotes_inputfield_footnote_fragment_id_slug'; /** * Settings container key for the ID separator in fragment IDs. @@ -924,7 +924,7 @@ class Settings { * * @since 2.3.0 */ - const C_STR_HARD_LINK_IDS_SEPARATOR = 'footnotes_inputfield_hard_link_ids_separator'; + const HARD_LINK_IDS_SEPARATOR = 'footnotes_inputfield_hard_link_ids_separator'; /** * Settings container key to enable shortcode syntax validation. @@ -933,7 +933,7 @@ class Settings { * * @since 2.4.0 */ - const C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE = 'footnotes_inputfield_shortcode_syntax_validation_enable'; + const FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE = 'footnotes_inputfield_shortcode_syntax_validation_enable'; /** * Settings container key to enable backlink tooltips. @@ -949,7 +949,7 @@ class Settings { * * @since 2.5.4 */ - const C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE = 'footnotes_inputfield_backlink_tooltip_enable'; + const FOOTNOTES_BACKLINK_TOOLTIP_ENABLE = 'footnotes_inputfield_backlink_tooltip_enable'; /** * Settings container key to configure the backlink tooltip. @@ -958,7 +958,7 @@ class Settings { * * @since 2.5.4 */ - const C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT = 'footnotes_inputfield_backlink_tooltip_text'; + const FOOTNOTES_BACKLINK_TOOLTIP_TEXT = 'footnotes_inputfield_backlink_tooltip_text'; /** * Settings container key to configure the tooltip excerpt delimiter. @@ -975,7 +975,7 @@ class Settings { * * @since 2.5.4 */ - const C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER = 'footnotes_inputfield_tooltip_excerpt_delimiter'; + const FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER = 'footnotes_inputfield_tooltip_excerpt_delimiter'; /** * Settings container key to enable mirroring the tooltip excerpt in the @@ -991,7 +991,7 @@ class Settings { * * @since 2.5.4 */ - const C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE = 'footnotes_inputfield_tooltip_excerpt_mirror_enable'; + const FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE = 'footnotes_inputfield_tooltip_excerpt_mirror_enable'; /** * Settings container key to configure the tooltip excerpt separator in the @@ -1001,7 +1001,7 @@ class Settings { * * @since 2.5.4 */ - const C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR = 'footnotes_inputfield_tooltip_excerpt_mirror_separator'; + const FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR = 'footnotes_inputfield_tooltip_excerpt_mirror_separator'; /** * Settings container key to enable superscript style normalization. @@ -1010,7 +1010,7 @@ class Settings { * * @since 2.5.4 */ - const C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT = 'footnotes_inputfield_referrers_normal_superscript'; + const FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT = 'footnotes_inputfield_referrers_normal_superscript'; /** * Settings container key to select the script mode for the reference container. @@ -1019,7 +1019,7 @@ class Settings { * * @since 2.5.6 */ - const C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE = 'footnotes_inputfield_reference_container_script_mode'; + const FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE = 'footnotes_inputfield_reference_container_script_mode'; /** * Settings container key to enable AMP compatibility mode. @@ -1028,7 +1028,7 @@ class Settings { * * @since 2.6.0 */ - const C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE = 'footnotes_inputfield_amp_compatibility_enable'; + const FOOTNOTES_AMP_COMPATIBILITY_ENABLE = 'footnotes_inputfield_amp_compatibility_enable'; /** * Settings container key for scroll duration asymmetricity. @@ -1037,7 +1037,7 @@ class Settings { * * @since 2.5.11 */ - const C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY = 'footnotes_inputfield_scroll_duration_asymmetricity'; + const FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY = 'footnotes_inputfield_scroll_duration_asymmetricity'; /** * Settings container key for scroll-down duration. @@ -1046,7 +1046,7 @@ class Settings { * * @since 2.5.11 */ - const C_INT_FOOTNOTES_SCROLL_DOWN_DURATION = 'footnotes_inputfield_scroll_down_duration'; + const FOOTNOTES_SCROLL_DOWN_DURATION = 'footnotes_inputfield_scroll_down_duration'; /** * Settings container key for scroll-down delay. @@ -1055,7 +1055,7 @@ class Settings { * * @since 2.5.11 */ - const C_INT_FOOTNOTES_SCROLL_DOWN_DELAY = 'footnotes_inputfield_scroll_down_delay'; + const FOOTNOTES_SCROLL_DOWN_DELAY = 'footnotes_inputfield_scroll_down_delay'; /** * Settings container key for scroll-up delay. @@ -1064,7 +1064,7 @@ class Settings { * * @since 2.5.11 */ - const C_INT_FOOTNOTES_SCROLL_UP_DELAY = 'footnotes_inputfield_scroll_up_delay'; + const FOOTNOTES_SCROLL_UP_DELAY = 'footnotes_inputfield_scroll_up_delay'; /** * Settings container key to set the solution of the input element label issue. @@ -1081,7 +1081,7 @@ class Settings { * @since 2.5.12 * @todo Review, remove? */ - const C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION = 'footnotes_inputfield_label_issue_solution'; + const FOOTNOTES_LABEL_ISSUE_SOLUTION = 'footnotes_inputfield_label_issue_solution'; /** * Settings container key to enable CSS smooth scrolling. @@ -1092,7 +1092,7 @@ class Settings { * * @since 2.5.12 */ - const C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING = 'footnotes_inputfield_css_smooth_scrolling'; + const FOOTNOTES_CSS_SMOOTH_SCROLLING = 'footnotes_inputfield_css_smooth_scrolling'; /** * Settings container key for the footnote section shortcode. @@ -1101,7 +1101,7 @@ class Settings { * * @since 2.7.0 */ - const C_STR_FOOTNOTE_SECTION_SHORTCODE = 'footnotes_inputfield_section_shortcode'; + const FOOTNOTE_SECTION_SHORTCODE = 'footnotes_inputfield_section_shortcode'; /********************************************************************** * SETTINGS STORAGE. @@ -1111,7 +1111,7 @@ class Settings { * * @since 1.5.0 */ - private static ?\footnotes\includes\Settings $a_obj_instance = null; + private static ?\footnotes\includes\Settings $instance = null; /** * Contains all Settings Container names. @@ -1122,7 +1122,7 @@ class Settings { * * @since 1.5.0 */ - private array $a_arr_container = array( + private array $container = array( 'footnotes_storage', 'footnotes_storage_custom', 'footnotes_storage_expert', @@ -1139,86 +1139,86 @@ class Settings { * * @var (string|int)[] */ - private array $a_arr_default = array( + private array $default = array( // General settings. 'footnotes_storage' => array( // AMP compatibility. - self::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE => '', + self::FOOTNOTES_AMP_COMPATIBILITY_ENABLE => '', // Footnote start and end short codes. - self::C_STR_FOOTNOTES_SHORT_CODE_START => '((', - self::C_STR_FOOTNOTES_SHORT_CODE_END => '))', - self::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '', - self::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '', - self::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE => 'yes', + self::FOOTNOTES_SHORT_CODE_START => '((', + self::FOOTNOTES_SHORT_CODE_END => '))', + self::FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '', + self::FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '', + self::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE => 'yes', // Footnotes numbering. - self::C_STR_FOOTNOTES_COUNTER_STYLE => 'arabic_plain', - self::C_STR_COMBINE_IDENTICAL_FOOTNOTES => 'yes', + self::FOOTNOTES_COUNTER_STYLE => 'arabic_plain', + self::COMBINE_IDENTICAL_FOOTNOTES => 'yes', // Scrolling behavior. - self::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING => 'no', - self::C_INT_FOOTNOTES_SCROLL_OFFSET => 20, - self::C_INT_FOOTNOTES_SCROLL_DURATION => 380, - self::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY => 'no', - self::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION => 150, - self::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY => 0, - self::C_INT_FOOTNOTES_SCROLL_UP_DELAY => 0, - self::C_STR_FOOTNOTES_HARD_LINKS_ENABLE => 'no', - self::C_STR_REFERRER_FRAGMENT_ID_SLUG => 'r', - self::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG => 'f', - self::C_STR_HARD_LINK_IDS_SEPARATOR => '+', - self::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE => 'yes', - self::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT => 'Alt+ ←', + self::FOOTNOTES_CSS_SMOOTH_SCROLLING => 'no', + self::FOOTNOTES_SCROLL_OFFSET => 20, + self::FOOTNOTES_SCROLL_DURATION => 380, + self::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY => 'no', + self::FOOTNOTES_SCROLL_DOWN_DURATION => 150, + self::FOOTNOTES_SCROLL_DOWN_DELAY => 0, + self::FOOTNOTES_SCROLL_UP_DELAY => 0, + self::FOOTNOTES_HARD_LINKS_ENABLE => 'no', + self::REFERRER_FRAGMENT_ID_SLUG => 'r', + self::FOOTNOTE_FRAGMENT_ID_SLUG => 'f', + self::HARD_LINK_IDS_SEPARATOR => '+', + self::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE => 'yes', + self::FOOTNOTES_BACKLINK_TOOLTIP_TEXT => 'Alt+ ←', // Reference container. - self::C_STR_REFERENCE_CONTAINER_NAME => 'References', - self::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT => 'p', - self::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER => 'yes', - self::C_STR_REFERENCE_CONTAINER_COLLAPSE => 'no', - self::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE => 'jquery', - self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end', - self::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE => '[[references]]', - self::C_STR_FOOTNOTE_SECTION_SHORTCODE => '[[/footnotesection]]', - self::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes', - self::C_INT_REFERENCE_CONTAINER_TOP_MARGIN => 24, - self::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN => 0, - self::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT => 'none', - self::C_STR_FOOTNOTE_URL_WRAP_ENABLED => 'yes', - self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes', - self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => 'no', - self::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => 'no', - self::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE => 'no', + self::REFERENCE_CONTAINER_NAME => 'References', + self::REFERENCE_CONTAINER_LABEL_ELEMENT => 'p', + self::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER => 'yes', + self::REFERENCE_CONTAINER_COLLAPSE => 'no', + self::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE => 'jquery', + self::REFERENCE_CONTAINER_POSITION => 'post_end', + self::REFERENCE_CONTAINER_POSITION_SHORTCODE => '[[references]]', + self::FOOTNOTE_SECTION_SHORTCODE => '[[/footnotesection]]', + self::REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes', + self::REFERENCE_CONTAINER_TOP_MARGIN => 24, + self::REFERENCE_CONTAINER_BOTTOM_MARGIN => 0, + self::FOOTNOTES_PAGE_LAYOUT_SUPPORT => 'none', + self::FOOTNOTE_URL_WRAP_ENABLED => 'yes', + self::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes', + self::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => 'no', + self::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => 'no', + self::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE => 'no', - self::C_STR_BACKLINKS_SEPARATOR_ENABLED => 'yes', - self::C_STR_BACKLINKS_SEPARATOR_OPTION => 'comma', - self::C_STR_BACKLINKS_SEPARATOR_CUSTOM => '', + self::BACKLINKS_SEPARATOR_ENABLED => 'yes', + self::BACKLINKS_SEPARATOR_OPTION => 'comma', + self::BACKLINKS_SEPARATOR_CUSTOM => '', - self::C_STR_BACKLINKS_TERMINATOR_ENABLED => 'no', - self::C_STR_BACKLINKS_TERMINATOR_OPTION => 'full_stop', - self::C_STR_BACKLINKS_TERMINATOR_CUSTOM => '', + self::BACKLINKS_TERMINATOR_ENABLED => 'no', + self::BACKLINKS_TERMINATOR_OPTION => 'full_stop', + self::BACKLINKS_TERMINATOR_CUSTOM => '', - self::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED => 'no', - self::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR => '50', - self::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT => 'px', + self::BACKLINKS_COLUMN_WIDTH_ENABLED => 'no', + self::BACKLINKS_COLUMN_WIDTH_SCALAR => '50', + self::BACKLINKS_COLUMN_WIDTH_UNIT => 'px', - self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED => 'no', - self::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR => '140', - self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT => 'px', + self::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED => 'no', + self::BACKLINKS_COLUMN_MAX_WIDTH_SCALAR => '140', + self::BACKLINKS_COLUMN_MAX_WIDTH_UNIT => 'px', - self::C_STR_BACKLINKS_LINE_BREAKS_ENABLED => 'no', - self::C_STR_LINK_ELEMENT_ENABLED => 'yes', + self::BACKLINKS_LINE_BREAKS_ENABLED => 'no', + self::LINK_ELEMENT_ENABLED => 'yes', // Footnotes in excerpts. - self::C_STR_FOOTNOTES_IN_EXCERPT => 'manual', + self::FOOTNOTES_IN_EXCERPT => 'manual', // Footnotes love. - self::C_STR_FOOTNOTES_LOVE => 'no', + self::FOOTNOTES_LOVE => 'no', // Deprecated. - self::C_STR_FOOTNOTES_EXPERT_MODE => 'yes', + self::FOOTNOTES_EXPERT_MODE => 'yes', ), @@ -1226,64 +1226,64 @@ class Settings { 'footnotes_storage_custom' => array( // Backlink symbol. - self::C_STR_HYPERLINK_ARROW => 0, - self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '', + self::HYPERLINK_ARROW => 0, + self::HYPERLINK_ARROW_USER_DEFINED => '', // Referrers. - self::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes', - self::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT => 'no', - self::C_STR_FOOTNOTES_STYLING_BEFORE => '[', - self::C_STR_FOOTNOTES_STYLING_AFTER => ']', + self::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes', + self::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT => 'no', + self::FOOTNOTES_STYLING_BEFORE => '[', + self::FOOTNOTES_STYLING_AFTER => ']', // Referrers in labels. - self::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION => 'none', + self::FOOTNOTES_LABEL_ISSUE_SOLUTION => 'none', // Tooltips. - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes', - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'no', + self::FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes', + self::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'no', // Tooltip position. - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center', - self::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION => 'top right', - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0, - self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X => -50, - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7, - self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y => 24, + self::FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center', + self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION => 'top right', + self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0, + self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X => -50, + self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7, + self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y => 24, // Tooltip dimensions. - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450, - self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH => 400, + self::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450, + self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH => 400, // Tooltip timing. - self::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY => 0, - self::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION => 200, - self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY => 400, - self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION => 200, + self::MOUSE_OVER_BOX_FADE_IN_DELAY => 0, + self::MOUSE_OVER_BOX_FADE_IN_DURATION => 200, + self::MOUSE_OVER_BOX_FADE_OUT_DELAY => 400, + self::MOUSE_OVER_BOX_FADE_OUT_DURATION => 200, // Tooltip truncation. - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes', - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200, - self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading', + self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes', + self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200, + self::FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading', // Tooltip text. - self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER => '[[/tooltip]]', - self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE => 'no', - self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR => ' — ', + self::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER => '[[/tooltip]]', + self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE => 'no', + self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR => ' — ', // Tooltip appearance. - self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'yes', - self::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13, - self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px', + self::MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'yes', + self::MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13, + self::MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px', - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '#000000', - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff', - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1, - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99', - self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0, - self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666', + self::FOOTNOTES_MOUSE_OVER_BOX_COLOR => '#000000', + self::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff', + self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1, + self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99', + self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0, + self::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666', // Your existing Custom CSS code. - self::C_STR_CUSTOM_CSS => '', + self::CUSTOM_CSS => '', ), @@ -1291,20 +1291,20 @@ class Settings { 'footnotes_storage_expert' => array( // WordPress hooks with priority level. - self::C_STR_EXPERT_LOOKUP_THE_TITLE => '', - self::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX, + self::EXPERT_LOOKUP_THE_TITLE => '', + self::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX, - self::C_STR_EXPERT_LOOKUP_THE_CONTENT => 'checked', - self::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => 98, + self::EXPERT_LOOKUP_THE_CONTENT => 'checked', + self::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => 98, - self::C_STR_EXPERT_LOOKUP_THE_EXCERPT => '', - self::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL => PHP_INT_MAX, + self::EXPERT_LOOKUP_THE_EXCERPT => '', + self::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL => PHP_INT_MAX, - self::C_STR_EXPERT_LOOKUP_WIDGET_TITLE => '', - self::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL => PHP_INT_MAX, + self::EXPERT_LOOKUP_WIDGET_TITLE => '', + self::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL => PHP_INT_MAX, - self::C_STR_EXPERT_LOOKUP_WIDGET_TEXT => '', - self::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL => 98, + self::EXPERT_LOOKUP_WIDGET_TEXT => '', + self::EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL => 98, ), @@ -1312,10 +1312,10 @@ class Settings { 'footnotes_storage_custom_css' => array( // Your existing Custom CSS code. - self::C_STR_CUSTOM_CSS_LEGACY_ENABLE => 'yes', + self::CUSTOM_CSS_LEGACY_ENABLE => 'yes', // Custom CSS. - self::C_STR_CUSTOM_CSS_NEW => '', + self::CUSTOM_CSS_NEW => '', ), @@ -1329,7 +1329,7 @@ class Settings { * @since 1.5.0 * @todo Create `PreferencesSet` class. */ - private array $a_arr_settings = array(); + private array $settings = array(); /** * Loads all Settings from each WordPress Settings Container. @@ -1348,35 +1348,35 @@ class Settings { */ public static function instance(): self { // No instance defined yet, load it. - if ( ! self::$a_obj_instance ) { - self::$a_obj_instance = new self(); + if ( ! self::$instance ) { + self::$instance = new self(); } // Return a singleton of this class. - return self::$a_obj_instance; + return self::$instance; } /** * Returns the name of a specified Settings Container. * - * @param int $p_int_index Settings Container index. + * @param int $index Settings Container index. * @return string Settings Container name. * * @since 1.5.0 */ - public function get_container( int $p_int_index ): string { - return $this->a_arr_container[ $p_int_index ]; + public function get_container( int $index ): string { + return $this->container[ $index ]; } /** * Returns the default value(s) of a specific Settings Container. * - * @param int $p_int_index Settings Container index. + * @param int $index Settings Container index. * @return (string|int)[] Settings Container default value(s). * * @since 1.5.6 */ - public function get_defaults( int $p_int_index ): array { - return $this->a_arr_default[ $this->a_arr_container[ $p_int_index ] ]; + public function get_defaults( int $index ): array { + return $this->default[ $this->container[ $index ] ]; } /** @@ -1386,54 +1386,54 @@ class Settings { */ private function load_all(): void { // Clear current settings. - $this->a_arr_settings = array(); - $num_settings = count( $this->a_arr_container ); + $this->settings = array(); + $num_settings = count( $this->container ); for ( $i = 0; $i < $num_settings; $i++ ) { // Load settings. - $this->a_arr_settings = array_merge( $this->a_arr_settings, $this->load( $i ) ); + $this->settings = array_merge( $this->settings, $this->load( $i ) ); } } /** * Loads all settings from specified Settings Containers. * - * @param int $p_int_index Settings container index. + * @param int $index Settings container index. * @return (string|int)[] Loaded settings (or defaults if specified container is empty). * * @since 1.5.0 */ - private function load( int $p_int_index ): array { + private function load( int $index ): array { // Load all settings from container. - $l_arr_options = get_option( $this->get_container( $p_int_index ) ); + $options = get_option( $this->get_container( $index ) ); // Load all default settings. - $l_arr_default = $this->a_arr_default[ $this->get_container( $p_int_index ) ]; + $default = $this->default[ $this->get_container( $index ) ]; // No settings found, set them to their default value. - if ( empty( $l_arr_options ) ) { - return $l_arr_default; + if ( empty( $options ) ) { + return $default; } // Iterate through all available settings ( = default values). - foreach ( $l_arr_default as $l_str_key => $l_str_value ) { + foreach ( $default as $key => $value ) { // Available setting not found in the container. - if ( ! array_key_exists( $l_str_key, $l_arr_options ) ) { + if ( ! array_key_exists( $key, $options ) ) { // Define the setting with its default value. - $l_arr_options[ $l_str_key ] = $l_str_value; + $options[ $key ] = $value; } } // Return settings loaded from Container. - return $l_arr_options; + return $options; } /** * 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 $index Index of the Setting Container. + * @param array $new_values The new Settings value(s). * * @since 1.5.0 */ - public function save_options( int $p_int_index, array $p_arr_new_values ): bool { - if ( update_option( $this->get_container( $p_int_index ), $p_arr_new_values ) ) { + public function save_options( int $index, array $new_values ): bool { + if ( update_option( $this->get_container( $index ), $new_values ) ) { $this->load_all(); return true; } @@ -1443,14 +1443,14 @@ class Settings { /** * Returns the value of specified Setting. * - * @param string $p_str_key Setting key. + * @param string $key Setting key. * @return string|int|null Setting value, or `null` if setting key is invalid. * * @since 1.5.0 * @todo Add return type. */ - public function get( string $p_str_key ) { - return $this->a_arr_settings[ $p_str_key ] ?? null; + public function get( string $key ) { + return $this->settings[ $key ] ?? null; } /** @@ -1462,7 +1462,7 @@ class Settings { */ public function register_settings(): void { // Register all settings. - $num_settings = count( $this->a_arr_container ); + $num_settings = count( $this->container ); for ( $i = 0; $i < $num_settings; $i++ ) { register_setting( $this->get_container( $i ), $this->get_container( $i ) ); } diff --git a/src/includes/class-template.php b/src/includes/class-template.php index 95b97a8..6865dda 100644 --- a/src/includes/class-template.php +++ b/src/includes/class-template.php @@ -36,7 +36,7 @@ class Template { * * @var string */ - const C_STR_DASHBOARD = 'admin/partials'; + const DASHBOARD = 'admin/partials'; /** * Directory name for public partials. @@ -45,21 +45,21 @@ class Template { * * @var string */ - const C_STR_PUBLIC = 'public/partials'; + const PUBLIC = 'public/partials'; /** * Contains the content of the template after initialize. * * @since 1.5.0 */ - private ?string $a_str_original_content = ''; + private ?string $original_content = ''; /** * Contains the content of the template after initialize with replaced place holders. * * @since 1.5.0 */ - private string $a_str_replaced_content = ''; + private string $replaced_content = ''; /** * Plugin Directory @@ -74,22 +74,22 @@ class Template { * @since 1.5.0 * @todo Refactor templating. * - * @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 $file_type Template file type. + * @param string $file_name Template file name inside the `partials/` directory, without the file extension. + * @param string $extension (optional) Template file extension (default: 'html'). * @return void */ - public function __construct( string $p_str_file_type, string $p_str_file_name, string $p_str_extension = 'html' ) { + public function __construct( string $file_type, string $file_name, string $extension = 'html' ) { // No template file type and/or file name set. - if ( empty( $p_str_file_type ) ) { + if ( empty( $file_type ) ) { return; } - if ( empty( $p_str_file_name ) ) { + if ( empty( $file_name ) ) { return; } $this->plugin_directory = plugin_dir_path( __DIR__ ); - $template = $this->get_template( $p_str_file_type, $p_str_file_name, $p_str_extension ); + $template = $this->get_template( $file_type, $file_name, $extension ); if ( $template ) { $this->process_template( $template ); } else { @@ -104,21 +104,21 @@ class Template { * @since 1.5.0 * @todo Refactor templating. * - * @param string[] $p_arr_placeholders Placeholders (key = placeholder, value = value). + * @param string[] $placeholders Placeholders (key = placeholder, value = value). * @return bool `true` on Success, `false` if placeholders invalid. */ - public function replace( array $p_arr_placeholders ): bool { + public function replace( array $placeholders ): bool { // No placeholders set. - if ( empty( $p_arr_placeholders ) ) { + if ( empty( $placeholders ) ) { return false; } // Template content is empty. - if ( empty( $this->a_str_replaced_content ) ) { + if ( empty( $this->replaced_content ) ) { return false; } // Iterate through each placeholder and replace it with its value. - foreach ( $p_arr_placeholders as $l_str_placeholder => $l_str_value ) { - $this->a_str_replaced_content = str_replace( '[[' . $l_str_placeholder . ']]', (string) $l_str_value, $this->a_str_replaced_content ); + foreach ( $placeholders as $placeholder => $value ) { + $this->replaced_content = str_replace( '[[' . $placeholder . ']]', (string) $value, $this->replaced_content ); } // Success. return true; @@ -133,7 +133,7 @@ class Template { * @return void */ public function reload() { - $this->a_str_replaced_content = $this->a_str_original_content; + $this->replaced_content = $this->original_content; } /** @@ -145,7 +145,7 @@ class Template { * @return string Template content with replaced placeholders. */ public function get_content(): string { - return $this->a_str_replaced_content; + return $this->replaced_content; } /** @@ -159,14 +159,14 @@ class Template { */ public function process_template( string $template ) { // phpcs:disable WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents - $this->a_str_original_content = preg_replace( '##s', '', file_get_contents( $template ) ); + $this->original_content = preg_replace( '##s', '', file_get_contents( $template ) ); // phpcs:enable - $this->a_str_original_content = preg_replace( '#/\*\*.+?\*/#s', '', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( "\n", '', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( "\r", '', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( "\t", ' ', $this->a_str_original_content ); - $this->a_str_original_content = preg_replace( '# +#', ' ', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( ' >', '>', $this->a_str_original_content ); + $this->original_content = preg_replace( '#/\*\*.+?\*/#s', '', $this->original_content ); + $this->original_content = str_replace( "\n", '', $this->original_content ); + $this->original_content = str_replace( "\r", '', $this->original_content ); + $this->original_content = str_replace( "\t", ' ', $this->original_content ); + $this->original_content = preg_replace( '# +#', ' ', $this->original_content ); + $this->original_content = str_replace( ' >', '>', $this->original_content ); $this->reload(); } @@ -177,12 +177,12 @@ class Template { * @todo Refactor templating. * @todo Single return type. * - * @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 $file_type The file type of the template. + * @param string $file_name The file name of the template. + * @param string $extension The file extension of the template. * @return string|bool `false` or the template path */ - public function get_template( string $p_str_file_type, string $p_str_file_name, string $p_str_extension = 'html' ): string|bool { + public function get_template( string $file_type, string $file_name, string $extension = 'html' ): string|bool { $located = false; /* @@ -195,7 +195,7 @@ class Template { */ $template_directory = apply_filters( '', 'footnotes/' ); $custom_directory = apply_filters( 'custom_template_directory', 'footnotes-custom/' ); - $template_name = $p_str_file_type . '/' . $p_str_file_name . '.' . $p_str_extension; + $template_name = $file_type . '/' . $file_name . '.' . $extension; // Look in active theme. if ( file_exists( trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name ) ) { diff --git a/src/public/class-general.php b/src/public/class-general.php index fd1d8aa..3835ba0 100644 --- a/src/public/class-general.php +++ b/src/public/class-general.php @@ -61,7 +61,7 @@ class General { * * @var Parser $task The Plugin task. */ - public ?Parser $a_obj_task = null; + public ?Parser $task = null; /** * Flag for using tooltips. @@ -71,7 +71,7 @@ class General { * * @var bool $tooltips_enabled Whether tooltips are enabled or not. */ - public static $a_bool_tooltips_enabled = false; + public static $tooltips_enabled = false; /** * Allows to determine whether alternative tooltips are enabled. @@ -81,7 +81,7 @@ class General { * * @var bool */ - public static $a_bool_alternative_tooltips_enabled = false; + public static $alternative_tooltips_enabled = false; /** * Allows to determine whether AMP compatibility mode is enabled. @@ -91,7 +91,7 @@ class General { * * @var bool */ - public static $a_bool_amp_enabled = false; + public static $amp_enabled = false; /** * Allows to determine the script mode among jQuery or plain JS. @@ -101,7 +101,7 @@ class General { * * @var string ‘js’ to use plain JavaScript, ‘jquery’ to use jQuery. */ - public static $a_str_script_mode = 'js'; + public static $script_mode = 'js'; /** * Initialize the class and set its properties. @@ -118,10 +118,10 @@ class General { $this->load_dependencies(); // Set conditions re-used for stylesheet enqueuing and in class/task.php. - self::$a_bool_amp_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) ); - self::$a_bool_tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); - self::$a_bool_alternative_tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); - self::$a_str_script_mode = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); + self::$amp_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) ); + self::$tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); + self::$alternative_tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); + self::$script_mode = Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); } /** @@ -146,7 +146,7 @@ class General { $this->reference_container_widget = new Widget\Reference_Container( $this->plugin_name ); - $this->a_obj_task = new Parser(); + $this->task = new Parser(); } /** @@ -162,53 +162,53 @@ class General { public function enqueue_styles(): void { if ( PRODUCTION_ENV ) { // Set tooltip mode for use in stylesheet name. - if ( self::$a_bool_tooltips_enabled ) { + if ( self::$tooltips_enabled ) { - if ( self::$a_bool_amp_enabled ) { - $l_str_tooltip_mode_short = 'ampt'; - $l_str_tooltip_mode_long = 'amp-tooltips'; + if ( self::$amp_enabled ) { + $tooltip_mode_short = 'ampt'; + $tooltip_mode_long = 'amp-tooltips'; - } elseif ( self::$a_bool_alternative_tooltips_enabled ) { - $l_str_tooltip_mode_short = 'altt'; - $l_str_tooltip_mode_long = 'alternative-tooltips'; + } elseif ( self::$alternative_tooltips_enabled ) { + $tooltip_mode_short = 'altt'; + $tooltip_mode_long = 'alternative-tooltips'; } else { - $l_str_tooltip_mode_short = 'jqtt'; - $l_str_tooltip_mode_long = 'jquery-tooltips'; + $tooltip_mode_short = 'jqtt'; + $tooltip_mode_long = 'jquery-tooltips'; } } else { - $l_str_tooltip_mode_short = 'nott'; - $l_str_tooltip_mode_long = 'no-tooltips'; + $tooltip_mode_short = 'nott'; + $tooltip_mode_long = 'no-tooltips'; } // Set basic responsive page layout mode for use in stylesheet name. - $l_str_page_layout_option = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT ); - switch ( $l_str_page_layout_option ) { + $page_layout_option = Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_PAGE_LAYOUT_SUPPORT ); + switch ( $page_layout_option ) { case 'reference-container': - $l_str_layout_mode = '1'; + $layout_mode = '1'; break; case 'entry-content': - $l_str_layout_mode = '2'; + $layout_mode = '2'; break; case 'main-content': - $l_str_layout_mode = '3'; + $layout_mode = '3'; break; case 'none': default: - $l_str_layout_mode = '0'; + $layout_mode = '0'; break; } // Enqueue the tailored united minified stylesheet. wp_enqueue_style( - "footnotes-{$l_str_tooltip_mode_long}-pagelayout-{$l_str_page_layout_option}", - plugin_dir_url( __FILE__ ) . "css/footnotes-{$l_str_tooltip_mode_short}brpl{$l_str_layout_mode}.min.css", + "footnotes-{$tooltip_mode_long}-pagelayout-{$page_layout_option}", + plugin_dir_url( __FILE__ ) . "css/footnotes-{$tooltip_mode_short}brpl{$layout_mode}.min.css", array(), ( PRODUCTION_ENV ) ? $this->version : filemtime( plugin_dir_path( __FILE__ - ) . "css/footnotes-{$l_str_tooltip_mode_short}brpl{$l_str_layout_mode}.min.css" + ) . "css/footnotes-{$tooltip_mode_short}brpl{$layout_mode}.min.css" ), 'all' ); @@ -247,15 +247,15 @@ class General { * After adding the alternative reference container, jQuery has become optional, * but still enabled by default. */ - if ( ! self::$a_bool_amp_enabled ) { + if ( ! self::$amp_enabled ) { - if ( 'jquery' === self::$a_str_script_mode || ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) ) { + if ( 'jquery' === self::$script_mode || ( self::$tooltips_enabled && ! self::$alternative_tooltips_enabled ) ) { wp_enqueue_script( 'jquery' ); } - if ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) { + if ( self::$tooltips_enabled && ! self::$alternative_tooltips_enabled ) { /* * Enqueues the jQuery Tools library shipped with the plugin. * diff --git a/src/public/class-parser.php b/src/public/class-parser.php index b2ea843..902fda6 100644 --- a/src/public/class-parser.php +++ b/src/public/class-parser.php @@ -30,21 +30,21 @@ class Parser { * @since 1.5.0 * @var string[] */ - public static array $a_arr_footnotes = array(); + public static array $footnotes = array(); /** * Flag if the display of 'LOVE FOOTNOTES' is allowed on the current public page. * * @since 1.5.0 */ - public static bool $a_bool_allow_love_me = true; + public static bool $allow_love_me = true; /** * Prefix for the Footnote html element ID. * * @since 1.5.8 */ - public static string $a_str_prefix = ''; + public static string $prefix = ''; /** * Autoload a.k.a. infinite scroll, or archive view. @@ -54,7 +54,7 @@ class Parser { * * @since 2.0.6 */ - public static int $a_int_post_id = 0; + public static int $post_id = 0; /** * Multiple reference containers in content and widgets. @@ -66,7 +66,7 @@ class Parser { * @since 2.2.9 * @var int Incremented every time after a reference container is inserted. */ - public static int $a_int_reference_container_id = 1; + public static int $reference_container_id = 1; /** * Hard links for AMP compatibility. @@ -75,7 +75,7 @@ class Parser { * * @since 2.0.0 */ - public static bool $a_bool_hard_links_enabled = false; + public static bool $hard_links_enabled = false; /** * The referrer slug. @@ -83,7 +83,7 @@ class Parser { * @since 2.3.0 * @var string */ - public static $a_str_referrer_link_slug = 'r'; + public static $referrer_link_slug = 'r'; /** * The footnote slug. @@ -92,7 +92,7 @@ class Parser { * * @var string */ - public static $a_str_footnote_link_slug = 'f'; + public static $footnote_link_slug = 'f'; /** * The slug and identifier separator. @@ -101,7 +101,7 @@ class Parser { * * @var string */ - private static $a_str_link_ids_separator = '+'; + private static $link_ids_separator = '+'; /** * Contains the concatenated fragment ID base. @@ -110,7 +110,7 @@ class Parser { * * @var string */ - public static $a_str_post_container_id_compound = ''; + public static $post_container_id_compound = ''; /** * Scroll offset. @@ -121,7 +121,7 @@ class Parser { * * @since 2.1.4 */ - public static int $a_int_scroll_offset = 34; + public static int $scroll_offset = 34; /* * Optional link element for footnote referrers and backlinks @@ -147,7 +147,7 @@ class Parser { * @since 2.3.0 * @todo Remove. */ - public static string $a_str_link_span = 'span'; + public static string $link_span = 'span'; /** * The opening tag. @@ -155,7 +155,7 @@ class Parser { * @since 2.3.0 * @todo Remove. */ - public static string $a_str_link_open_tag = ''; + public static string $link_open_tag = ''; /** * The closing tag. @@ -163,7 +163,7 @@ class Parser { * @since 2.3.0 * @todo Remove. */ - public static string $a_str_link_close_tag = ''; + public static string $link_close_tag = ''; /* * Dedicated tooltip text. @@ -180,21 +180,21 @@ class Parser { * @since 2.5.2 * @var string */ - public static $a_str_tooltip_shortcode = '[[/tooltip]]'; + public static $tooltip_shortcode = '[[/tooltip]]'; /** * The tooltip delimiter shortcode length. * * @since 2.5.2 */ - public static int $a_int_tooltip_shortcode_length = 12; + public static int $tooltip_shortcode_length = 12; /** * Whether to mirror the tooltip text in the reference container. * * @since 2.5.2 */ - public static bool $a_bool_mirror_tooltip_text = false; + public static bool $mirror_tooltip_text = false; /** * Footnote delimiter start short code. @@ -202,7 +202,7 @@ class Parser { * @since 1.5.0 * @since 2.6.2 Move from constant to class property. */ - public static string|int $a_str_start_tag = ''; + public static string|int $start_tag = ''; /** * Footnote delimiter end short code. @@ -210,7 +210,7 @@ class Parser { * @since 1.5.0 * @since 2.6.2 Move from constant to class property. */ - public static string|int $a_str_end_tag = ''; + public static string|int $end_tag = ''; /** * Footnote delimiter start short code in RegEx format. @@ -218,7 +218,7 @@ class Parser { * @since 2.4.0 * @since 2.6.2 Move from global constant to class property. */ - public static ?string $a_str_start_tag_regex = ''; + public static ?string $start_tag_regex = ''; /** * Footnote delimiter end short code in RegEx format. @@ -226,7 +226,7 @@ class Parser { * @since 2.4.0 * @since 2.6.2 Move from global constant to class property. */ - public static ?string $a_str_end_tag_regex = ''; + public static ?string $end_tag_regex = ''; /** * Footnote delimiter syntax validation enabled. @@ -241,7 +241,7 @@ class Parser { * * @since 2.4.0 */ - public static bool $a_bool_syntax_error_flag = true; + public static bool $syntax_error_flag = true; /** * Initialize the class and set its properties. @@ -272,18 +272,18 @@ class Parser { */ public function register_hooks(): void { // Get values from settings. - $l_int_the_title_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ); - $l_int_the_content_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ); - $l_int_the_excerpt_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ); - $l_int_widget_title_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ); - $l_int_widget_text_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL ); + $the_title_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ); + $the_content_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ); + $the_excerpt_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ); + $widget_title_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ); + $widget_text_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL ); // PHP_INT_MAX can be set by -1. - $l_int_the_title_priority = ( -1 === $l_int_the_title_priority ) ? PHP_INT_MAX : $l_int_the_title_priority; - $l_int_the_content_priority = ( -1 === $l_int_the_content_priority ) ? PHP_INT_MAX : $l_int_the_content_priority; - $l_int_the_excerpt_priority = ( -1 === $l_int_the_excerpt_priority ) ? PHP_INT_MAX : $l_int_the_excerpt_priority; - $l_int_widget_title_priority = ( -1 === $l_int_widget_title_priority ) ? PHP_INT_MAX : $l_int_widget_title_priority; - $l_int_widget_text_priority = ( -1 === $l_int_widget_text_priority ) ? PHP_INT_MAX : $l_int_widget_text_priority; + $the_title_priority = ( -1 === $the_title_priority ) ? PHP_INT_MAX : $the_title_priority; + $the_content_priority = ( -1 === $the_content_priority ) ? PHP_INT_MAX : $the_content_priority; + $the_excerpt_priority = ( -1 === $the_excerpt_priority ) ? PHP_INT_MAX : $the_excerpt_priority; + $widget_title_priority = ( -1 === $widget_title_priority ) ? PHP_INT_MAX : $widget_title_priority; + $widget_text_priority = ( -1 === $widget_text_priority ) ? PHP_INT_MAX : $widget_text_priority; // Append custom css to the header. add_filter( @@ -299,20 +299,20 @@ class Parser { PHP_INT_MAX ); - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_TITLE ) ) ) { add_filter( 'the_title', - fn( string $p_str_content): string => $this->footnotes_in_title( $p_str_content ), - $l_int_the_title_priority + fn( string $content): string => $this->footnotes_in_title( $content ), + $the_title_priority ); } // Configurable priority level for reference container relative positioning; default 98. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_CONTENT ) ) ) { add_filter( 'the_content', - fn( string $p_str_content): string => $this->footnotes_in_content( $p_str_content ), - $l_int_the_content_priority + fn( string $content): string => $this->footnotes_in_content( $content ), + $the_content_priority ); /** @@ -329,8 +329,8 @@ class Parser { */ add_filter( 'term_description', - fn( string $p_str_content): string => $this->footnotes_in_content( $p_str_content ), - $l_int_the_content_priority + fn( string $content): string => $this->footnotes_in_content( $content ), + $the_content_priority ); /** @@ -345,12 +345,12 @@ class Parser { */ add_filter( 'pum_popup_content', - fn( string $p_str_content): string => $this->footnotes_in_content( $p_str_content ), - $l_int_the_content_priority + fn( string $content): string => $this->footnotes_in_content( $content ), + $the_content_priority ); } - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_EXCERPT ) ) ) { /** * Adds a filter to the excerpt hook. * @@ -361,36 +361,36 @@ class Parser { */ add_filter( 'the_excerpt', - fn( string $p_str_excerpt): string => $this->footnotes_in_excerpt( $p_str_excerpt ), - $l_int_the_excerpt_priority + fn( string $excerpt): string => $this->footnotes_in_excerpt( $excerpt ), + $the_excerpt_priority ); } - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TITLE ) ) ) { /** * TODO */ add_filter( 'widget_title', - fn( string $p_str_content): string => $this->footnotes_in_widget_title( $p_str_content ), - $l_int_widget_title_priority + fn( string $content): string => $this->footnotes_in_widget_title( $content ), + $widget_title_priority ); } - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TEXT ) ) ) { /** * TODO */ add_filter( 'widget_text', - fn( string $p_str_content): string => $this->footnotes_in_widget_text( $p_str_content ), - $l_int_widget_text_priority + fn( string $content): string => $this->footnotes_in_widget_text( $content ), + $widget_text_priority ); } // Reset stored footnotes when displaying the header. - self::$a_arr_footnotes = array(); - self::$a_bool_allow_love_me = true; + self::$footnotes = array(); + self::$allow_love_me = true; } /** @@ -409,7 +409,7 @@ class Parser { * * Native smooth scrolling only works in recent browsers. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING ) ) ) { echo "html {scroll-behavior: smooth;}\r\n"; } @@ -419,9 +419,9 @@ class Parser { * Cannot be included in external stylesheet, as it is only optional. * The scope is variable too: referrers only, or all superscript elements. */ - $l_str_normalize_superscript = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ); - if ( 'no' !== $l_str_normalize_superscript ) { - if ( 'all' === $l_str_normalize_superscript ) { + $normalize_superscript = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ); + if ( 'no' !== $normalize_superscript ) { + if ( 'all' === $normalize_superscript ) { echo 'sup {'; } else { echo '.footnote_plugin_tooltip_text {'; @@ -430,24 +430,24 @@ class Parser { } // Reference container display on home page. - if ( ! Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE ) ) ) { + if ( ! Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_START_PAGE_ENABLE ) ) ) { echo ".home .footnotes_reference_container { display: none; }\r\n"; } // Reference container top and bottom margins. - $l_int_reference_container_top_margin = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN ); - $l_int_reference_container_bottom_margin = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN ); + $reference_container_top_margin = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_TOP_MARGIN ); + $reference_container_bottom_margin = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BOTTOM_MARGIN ); echo '.footnotes_reference_container {margin-top: '; - echo empty( $l_int_reference_container_top_margin ) ? '0' : $l_int_reference_container_top_margin; + echo empty( $reference_container_top_margin ) ? '0' : $reference_container_top_margin; echo 'px !important; margin-bottom: '; - echo empty( $l_int_reference_container_bottom_margin ) ? '0' : $l_int_reference_container_bottom_margin; + echo empty( $reference_container_bottom_margin ) ? '0' : $reference_container_bottom_margin; echo "px !important;}\r\n"; // Reference container label bottom border. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) { echo '.footnote_container_prepare > '; - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT ); + echo Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_ELEMENT ); echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n"; } @@ -460,7 +460,7 @@ class Parser { * issues as browsers won’t reload these style sheets after settings are * changed while the version string is not. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE ) ) ) { echo '.footnotes_table, .footnotes_plugin_reference_row {'; echo 'border: 1px solid #060606;'; echo " !important;}\r\n"; @@ -470,123 +470,123 @@ class Parser { } // Ref container first column width and max-width. - $l_bool_column_width_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED ) ); - $l_bool_column_max_width_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED ) ); + $column_width_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_ENABLED ) ); + $column_max_width_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED ) ); - if ( $l_bool_column_width_enabled || $l_bool_column_max_width_enabled ) { + if ( $column_width_enabled || $column_max_width_enabled ) { echo '.footnote-reference-container { table-layout: fixed; }'; echo '.footnote_plugin_index, .footnote_plugin_index_combi {'; - if ( $l_bool_column_width_enabled ) { - $l_int_column_width_scalar = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR ); - $l_str_column_width_unit = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT ); + if ( $column_width_enabled ) { + $column_width_scalar = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_SCALAR ); + $column_width_unit = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_UNIT ); - if ( ! empty( $l_int_column_width_scalar ) ) { - if ( '%' === $l_str_column_width_unit && $l_int_column_width_scalar > 100 ) { - $l_int_column_width_scalar = 100; + if ( ! empty( $column_width_scalar ) ) { + if ( '%' === $column_width_unit && $column_width_scalar > 100 ) { + $column_width_scalar = 100; } } else { - $l_int_column_width_scalar = 0; + $column_width_scalar = 0; } - echo ' width: ' . $l_int_column_width_scalar . $l_str_column_width_unit . ' !important;'; + echo ' width: ' . $column_width_scalar . $column_width_unit . ' !important;'; } - if ( $l_bool_column_max_width_enabled ) { - $l_int_column_max_width_scalar = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR ); - $l_str_column_max_width_unit = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT ); + if ( $column_max_width_enabled ) { + $column_max_width_scalar = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_SCALAR ); + $column_max_width_unit = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_UNIT ); - if ( ! empty( $l_int_column_max_width_scalar ) ) { - if ( '%' === $l_str_column_max_width_unit && $l_int_column_max_width_scalar > 100 ) { - $l_int_column_max_width_scalar = 100; + if ( ! empty( $column_max_width_scalar ) ) { + if ( '%' === $column_max_width_unit && $column_max_width_scalar > 100 ) { + $column_max_width_scalar = 100; } } else { - $l_int_column_max_width_scalar = 0; + $column_max_width_scalar = 0; } - echo ' max-width: ' . $l_int_column_max_width_scalar . $l_str_column_max_width_unit . ' !important;'; + echo ' max-width: ' . $column_max_width_scalar . $column_max_width_unit . ' !important;'; } echo "}\r\n"; } // Hard links scroll offset. - self::$a_bool_hard_links_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE ) ); + self::$hard_links_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_HARD_LINKS_ENABLE ) ); // Correct hard links enabled status depending on AMP-compatible or alternative reference container enabled status. - if ( General::$a_bool_amp_enabled || 'jquery' !== General::$a_str_script_mode ) { - self::$a_bool_hard_links_enabled = true; + if ( General::$amp_enabled || 'jquery' !== General::$script_mode ) { + self::$hard_links_enabled = true; } - self::$a_int_scroll_offset = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ); - if ( self::$a_bool_hard_links_enabled ) { + self::$scroll_offset = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_OFFSET ); + if ( self::$hard_links_enabled ) { echo '.footnote_referrer_anchor, .footnote_item_anchor {bottom: '; - echo self::$a_int_scroll_offset; + echo self::$scroll_offset; echo "vh;}\r\n"; } // Tooltips. - if ( General::$a_bool_tooltips_enabled ) { + if ( General::$tooltips_enabled ) { echo '.footnote_tooltip {'; // Tooltip appearance: Tooltip font size. echo ' font-size: '; - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) { - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR ); - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT ); + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) { + echo Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR ); + echo Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_UNIT ); } else { echo 'inherit'; } echo ' !important;'; // Tooltip Text color. - $l_str_color = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ); - if ( ! empty( $l_str_color ) ) { - printf( ' color: %s !important;', $l_str_color ); + $color = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR ); + if ( ! empty( $color ) ) { + printf( ' color: %s !important;', $color ); } // Tooltip Background color. - $l_str_background = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); - if ( ! empty( $l_str_background ) ) { - printf( ' background-color: %s !important;', $l_str_background ); + $background = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); + if ( ! empty( $background ) ) { + printf( ' background-color: %s !important;', $background ); } // Tooltip Border width. - $l_int_border_width = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); - if ( ! empty( $l_int_border_width ) && (int) $l_int_border_width > 0 ) { - printf( ' border-width: %dpx !important; border-style: solid !important;', $l_int_border_width ); + $border_width = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); + if ( ! empty( $border_width ) && (int) $border_width > 0 ) { + printf( ' border-width: %dpx !important; border-style: solid !important;', $border_width ); } // Tooltip Border color. - $l_str_border_color = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ); - if ( ! empty( $l_str_border_color ) ) { - printf( ' border-color: %s !important;', $l_str_border_color ); + $border_color = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ); + if ( ! empty( $border_color ) ) { + printf( ' border-color: %s !important;', $border_color ); } // Tooltip Corner radius. - $l_int_border_radius = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); - if ( ! empty( $l_int_border_radius ) && (int) $l_int_border_radius > 0 ) { - printf( ' border-radius: %dpx !important;', $l_int_border_radius ); + $border_radius = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); + if ( ! empty( $border_radius ) && (int) $border_radius > 0 ) { + printf( ' border-radius: %dpx !important;', $border_radius ); } // Tooltip Shadow color. - $l_str_box_shadow_color = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ); - if ( ! empty( $l_str_box_shadow_color ) ) { - printf( ' -webkit-box-shadow: 2px 2px 11px %s;', $l_str_box_shadow_color ); - printf( ' -moz-box-shadow: 2px 2px 11px %s;', $l_str_box_shadow_color ); - printf( ' box-shadow: 2px 2px 11px %s;', $l_str_box_shadow_color ); + $box_shadow_color = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ); + if ( ! empty( $box_shadow_color ) ) { + printf( ' -webkit-box-shadow: 2px 2px 11px %s;', $box_shadow_color ); + printf( ' -moz-box-shadow: 2px 2px 11px %s;', $box_shadow_color ); + printf( ' box-shadow: 2px 2px 11px %s;', $box_shadow_color ); } // Tooltip position, dimensions and timing. - if ( ! General::$a_bool_alternative_tooltips_enabled && ! General::$a_bool_amp_enabled ) { + if ( ! General::$alternative_tooltips_enabled && ! General::$amp_enabled ) { /* * Dimensions of jQuery tooltips. * * Position and timing of jQuery tooltips are script-defined. */ - $l_int_max_width = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); - if ( ! empty( $l_int_max_width ) && (int) $l_int_max_width > 0 ) { - printf( ' max-width: %dpx !important;', $l_int_max_width ); + $max_width = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); + if ( ! empty( $max_width ) && (int) $max_width > 0 ) { + printf( ' max-width: %dpx !important;', $max_width ); } echo "}\r\n"; @@ -595,57 +595,57 @@ class Parser { echo "}\r\n"; // Dimensions. - $l_int_alternative_tooltip_width = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ); + $alternative_tooltip_width = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ); echo '.footnote_tooltip.position {'; echo ' width: max-content; '; // Set also as max-width wrt short tooltip shrinking. - echo ' max-width: ' . $l_int_alternative_tooltip_width . 'px;'; + echo ' max-width: ' . $alternative_tooltip_width . 'px;'; // Position. - $l_str_alternative_position = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); - $l_int_offset_x = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ); + $alternative_position = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); + $offset_x = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ); - if ( 'top left' === $l_str_alternative_position || 'bottom left' === $l_str_alternative_position ) { - echo ' right: ' . ( empty( $l_int_offset_x ) ? 0 : $l_int_offset_x ) . 'px;'; + if ( 'top left' === $alternative_position || 'bottom left' === $alternative_position ) { + echo ' right: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;'; } else { - echo ' left: ' . ( empty( $l_int_offset_x ) ? 0 : $l_int_offset_x ) . 'px;'; + echo ' left: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;'; } - $l_int_offset_y = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ); + $offset_y = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ); - if ( 'top left' === $l_str_alternative_position || 'top right' === $l_str_alternative_position ) { - echo ' bottom: ' . ( empty( $l_int_offset_y ) ? 0 : $l_int_offset_y ) . 'px;'; + if ( 'top left' === $alternative_position || 'top right' === $alternative_position ) { + echo ' bottom: ' . ( empty( $offset_y ) ? 0 : $offset_y ) . 'px;'; } else { - echo ' top: ' . ( empty( $l_int_offset_y ) ? 0 : $l_int_offset_y ) . 'px;'; + echo ' top: ' . ( empty( $offset_y ) ? 0 : $offset_y ) . 'px;'; } echo "}\r\n"; // Timing. - $l_int_fade_in_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY ); - $l_int_fade_in_delay = empty( $l_int_fade_in_delay ) ? '0' : $l_int_fade_in_delay; - $l_int_fade_in_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ); - $l_int_fade_in_duration = empty( $l_int_fade_in_duration ) ? '0' : $l_int_fade_in_duration; - $l_int_fade_out_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ); - $l_int_fade_out_delay = empty( $l_int_fade_out_delay ) ? '0' : $l_int_fade_out_delay; - $l_int_fade_out_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION ); - $l_int_fade_out_duration = empty( $l_int_fade_out_duration ) ? '0' : $l_int_fade_out_duration; + $fade_in_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ); + $fade_in_delay = empty( $fade_in_delay ) ? '0' : $fade_in_delay; + $fade_in_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ); + $fade_in_duration = empty( $fade_in_duration ) ? '0' : $fade_in_duration; + $fade_out_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ); + $fade_out_delay = empty( $fade_out_delay ) ? '0' : $fade_out_delay; + $fade_out_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ); + $fade_out_duration = empty( $fade_out_duration ) ? '0' : $fade_out_duration; /* * AMP-compatible tooltips. * * To streamline internal CSS, immutable rules are in external stylesheet. */ - if ( General::$a_bool_amp_enabled ) { + if ( General::$amp_enabled ) { echo 'span.footnote_referrer > span.footnote_tooltip {'; - echo 'transition-delay: ' . $l_int_fade_out_delay . 'ms;'; - echo 'transition-duration: ' . $l_int_fade_out_duration . 'ms;'; + echo 'transition-delay: ' . $fade_out_delay . 'ms;'; + echo 'transition-duration: ' . $fade_out_duration . 'ms;'; echo "}\r\n"; echo 'span.footnote_referrer:focus-within > span.footnote_tooltip, span.footnote_referrer:hover > span.footnote_tooltip {'; - echo 'transition-delay: ' . $l_int_fade_in_delay . 'ms;'; - echo 'transition-duration: ' . $l_int_fade_in_duration . 'ms;'; + echo 'transition-delay: ' . $fade_in_delay . 'ms;'; + echo 'transition-duration: ' . $fade_in_duration . 'ms;'; echo "}\r\n"; /* @@ -656,13 +656,13 @@ class Parser { } else { echo '.footnote_tooltip.hidden {'; - echo 'transition-delay: ' . $l_int_fade_out_delay . 'ms;'; - echo 'transition-duration: ' . $l_int_fade_out_duration . 'ms;'; + echo 'transition-delay: ' . $fade_out_delay . 'ms;'; + echo 'transition-duration: ' . $fade_out_duration . 'ms;'; echo "}\r\n"; echo '.footnote_tooltip.shown {'; - echo 'transition-delay: ' . $l_int_fade_in_delay . 'ms;'; - echo 'transition-duration: ' . $l_int_fade_in_duration . 'ms;'; + echo 'transition-delay: ' . $fade_in_delay . 'ms;'; + echo 'transition-duration: ' . $fade_in_duration . 'ms;'; echo "}\r\n"; } } @@ -674,11 +674,11 @@ class Parser { * Set custom CSS to override settings, not conversely. * Legacy Custom CSS is used until it’s set to disappear after dashboard tab migration. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) { - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_CUSTOM_CSS ); + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS_LEGACY_ENABLE ) ) ) { + echo Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS ); echo "\r\n"; } - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_CUSTOM_CSS_NEW ); + echo Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS_NEW ); // Insert end tag without switching out of PHP. echo "\r\n\r\n"; @@ -689,7 +689,7 @@ class Parser { * The script for alternative tooltips is printed formatted, not minified, * for transparency. It isn’t indented though (the PHP open tag neither). */ - if ( General::$a_bool_alternative_tooltips_enabled ) { + if ( General::$alternative_tooltips_enabled ) { // Start internal script. ?> @@ -715,54 +715,54 @@ class Parser { * @since 1.5.0 */ public function footnotes_output_footer(): void { - if ( 'footer' === Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) { + if ( 'footer' === Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION ) ) { echo $this->reference_container(); } // Get setting for love and share this plugin. - $l_str_love_me_index = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_LOVE ); + $love_me_index = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_LOVE ); // Check if the admin allows to add a link to the footer. - if ( empty( $l_str_love_me_index ) || 'no' === strtolower( $l_str_love_me_index ) || ! self::$a_bool_allow_love_me ) { + if ( empty( $love_me_index ) || 'no' === strtolower( $love_me_index ) || ! self::$allow_love_me ) { return; } // Set a hyperlink to the word "footnotes" in the Love slug. - $l_str_linked_name = sprintf( '%s', \footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME ); + $linked_name = sprintf( '%s', \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ); // Get random love me text. - if ( 'random' === strtolower( $l_str_love_me_index ) ) { - $l_str_love_me_index = 'text-' . wp_rand( 1, 7 ); + if ( 'random' === strtolower( $love_me_index ) ) { + $love_me_index = 'text-' . wp_rand( 1, 7 ); } - switch ( $l_str_love_me_index ) { + switch ( $love_me_index ) { // Options named wrt backcompat, simplest is default. case 'text-1': /* Translators: 2: Link to plugin page 1: Love heart symbol */ - $l_str_love_me_text = sprintf( __( 'I %2$s %1$s', 'footnotes' ), $l_str_linked_name, \footnotes\includes\Config::C_STR_LOVE_SYMBOL ); + $love_me_text = sprintf( __( 'I %2$s %1$s', 'footnotes' ), $linked_name, \footnotes\includes\Config::LOVE_SYMBOL ); break; case 'text-2': /* Translators: %s: Link to plugin page */ - $l_str_love_me_text = sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), $l_str_linked_name ); + $love_me_text = sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), $linked_name ); break; case 'text-4': /* Translators: 1: Link to plugin page 2: Love heart symbol */ - $l_str_love_me_text = sprintf( '%1$s %2$s', $l_str_linked_name, \footnotes\includes\Config::C_STR_LOVE_SYMBOL ); + $love_me_text = sprintf( '%1$s %2$s', $linked_name, \footnotes\includes\Config::LOVE_SYMBOL ); break; case 'text-5': /* Translators: 1: Love heart symbol 2: Link to plugin page */ - $l_str_love_me_text = sprintf( '%1$s %2$s', \footnotes\includes\Config::C_STR_LOVE_SYMBOL, $l_str_linked_name ); + $love_me_text = sprintf( '%1$s %2$s', \footnotes\includes\Config::LOVE_SYMBOL, $linked_name ); break; case 'text-6': /* Translators: %s: Link to plugin page */ - $l_str_love_me_text = sprintf( __( 'This website uses %s.', 'footnotes' ), $l_str_linked_name ); + $love_me_text = sprintf( __( 'This website uses %s.', 'footnotes' ), $linked_name ); break; case 'text-7': /* Translators: %s: Link to plugin page */ - $l_str_love_me_text = sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), $l_str_linked_name ); + $love_me_text = sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), $linked_name ); break; case 'text-3': default: /* Translators: %s: Link to plugin page */ - $l_str_love_me_text = $l_str_linked_name; + $love_me_text = $linked_name; break; } - echo sprintf( '
%s
', $l_str_love_me_text ); + echo sprintf( '
%s
', $love_me_text ); } /** @@ -770,12 +770,12 @@ class Parser { * * @since 1.5.0 * - * @param string $p_str_content Title. - * @return string $p_str_content Title with replaced footnotes. + * @param string $content Title. + * @return string $content Title with replaced footnotes. */ - public function footnotes_in_title( string $p_str_content ): string { + public function footnotes_in_title( string $content ): string { // Appends the reference container if set to "post_end". - return $this->exec( $p_str_content, false ); + return $this->exec( $content, false ); } /** @@ -783,39 +783,39 @@ class Parser { * * @since 1.5.0 * - * @param string $p_str_content Page/Post content. - * @return string $p_str_content Content with replaced footnotes. + * @param string $content Page/Post content. + * @return string $content Content with replaced footnotes. */ - public function footnotes_in_content( string $p_str_content ): string { + public function footnotes_in_content( string $content ): string { - $l_str_ref_container_position = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION ); - $l_str_footnote_section_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ); - $l_int_footnote_section_shortcode_length = strlen( $l_str_footnote_section_shortcode ); + $ref_container_position = Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION ); + $footnote_section_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_SECTION_SHORTCODE ); + $footnote_section_shortcode_length = strlen( $footnote_section_shortcode ); - if ( ! str_contains( $p_str_content, (string) $l_str_footnote_section_shortcode ) ) { + if ( ! str_contains( $content, (string) $footnote_section_shortcode ) ) { // phpcs:disable WordPress.PHP.YodaConditions.NotYoda // Appends the reference container if set to "post_end". - return $this->exec( $p_str_content, 'post_end' === $l_str_ref_container_position ); + return $this->exec( $content, 'post_end' === $ref_container_position ); // phpcs:enable WordPress.PHP.YodaConditions.NotYoda } else { - $l_str_rest_content = $p_str_content; - $l_arr_sections_raw = array(); - $l_arr_sections_processed = array(); + $rest_content = $content; + $sections_raw = array(); + $sections_processed = array(); do { - $l_int_section_end = strpos( $l_str_rest_content, (string) $l_str_footnote_section_shortcode ); - $l_arr_sections_raw[] = substr( $l_str_rest_content, 0, $l_int_section_end ); - $l_str_rest_content = substr( $l_str_rest_content, $l_int_section_end + $l_int_footnote_section_shortcode_length ); - } while ( str_contains( $l_str_rest_content, (string) $l_str_footnote_section_shortcode ) ); - $l_arr_sections_raw[] = $l_str_rest_content; + $section_end = strpos( $rest_content, (string) $footnote_section_shortcode ); + $sections_raw[] = substr( $rest_content, 0, $section_end ); + $rest_content = substr( $rest_content, $section_end + $footnote_section_shortcode_length ); + } while ( str_contains( $rest_content, (string) $footnote_section_shortcode ) ); + $sections_raw[] = $rest_content; - foreach ( $l_arr_sections_raw as $l_str_section ) { - $l_arr_sections_processed[] = self::exec( $l_str_section, true ); + foreach ( $sections_raw as $section ) { + $sections_processed[] = self::exec( $section, true ); } - return implode( $l_arr_sections_processed ); + return implode( $sections_processed ); } } @@ -829,20 +829,20 @@ class Parser { * * @since 1.5.0 * - * @param string $p_str_excerpt Excerpt content. - * @return string $p_str_excerpt Processed or new excerpt. + * @param string $excerpt Excerpt content. + * @return string $excerpt Processed or new excerpt. */ - public function footnotes_in_excerpt( string $p_str_excerpt ): string { - $l_str_excerpt_mode = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_IN_EXCERPT ); + public function footnotes_in_excerpt( string $excerpt ): string { + $excerpt_mode = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_IN_EXCERPT ); - if ( 'yes' === $l_str_excerpt_mode ) { - return $this->generate_excerpt_with_footnotes( $p_str_excerpt ); + if ( 'yes' === $excerpt_mode ) { + return $this->generate_excerpt_with_footnotes( $excerpt ); - } elseif ( 'no' === $l_str_excerpt_mode ) { - return $this->generate_excerpt( $p_str_excerpt ); + } elseif ( 'no' === $excerpt_mode ) { + return $this->generate_excerpt( $excerpt ); } else { - return $this->exec( $p_str_excerpt ); + return $this->exec( $excerpt ); } } @@ -856,38 +856,38 @@ class Parser { * * @since 2.6.2 * - * @param string $p_str_content The post. - * @return string $p_str_content An excerpt of the post. + * @param string $content The post. + * @return string $content An excerpt of the post. */ - public function generate_excerpt( string $p_str_content ): string { + public function generate_excerpt( string $content ): string { // Discard existing excerpt and start on the basis of the post. - $p_str_content = get_the_content( get_the_id() ); + $content = get_the_content( get_the_id() ); // Get footnote delimiter shortcodes and unify them. - $p_str_content = self::unify_delimiters( $p_str_content ); + $content = self::unify_delimiters( $content ); // Remove footnotes. - $p_str_content = preg_replace( '#' . self::$a_str_start_tag_regex . '.+?' . self::$a_str_end_tag_regex . '#', '', $p_str_content ); + $content = preg_replace( '#' . self::$start_tag_regex . '.+?' . self::$end_tag_regex . '#', '', $content ); // Apply WordPress excerpt processing. - $p_str_content = strip_shortcodes( $p_str_content ); - $p_str_content = excerpt_remove_blocks( $p_str_content ); + $content = strip_shortcodes( $content ); + $content = excerpt_remove_blocks( $content ); // Here the footnotes would be processed as part of WordPress content processing. - $p_str_content = apply_filters( 'the_content', $p_str_content ); + $content = apply_filters( 'the_content', $content ); // According to Advanced Excerpt, this is some kind of precaution against malformed CDATA in RSS feeds. - $p_str_content = str_replace( ']]>', ']]>', $p_str_content ); + $content = str_replace( ']]>', ']]>', $content ); - $l_int_excerpt_length = (int) _x( '55', 'excerpt_length' ); - $l_int_excerpt_length = (int) apply_filters( 'excerpt_length', $l_int_excerpt_length ); - $l_str_excerpt_more = apply_filters( 'excerpt_more', ' […]' ); + $excerpt_length = (int) _x( '55', 'excerpt_length' ); + $excerpt_length = (int) apply_filters( 'excerpt_length', $excerpt_length ); + $excerpt_more = apply_filters( 'excerpt_more', ' […]' ); // Function wp_trim_words() calls wp_strip_all_tags() that wrecks the footnotes. - $p_str_content = wp_trim_words( $p_str_content, $l_int_excerpt_length, $l_str_excerpt_more ); + $content = wp_trim_words( $content, $excerpt_length, $excerpt_more ); - return $p_str_content; + return $content; } /** @@ -901,99 +901,99 @@ class Parser { * * @since 2.6.3 * - * @param string $p_str_content The post. - * @return string $p_str_content An excerpt of the post. + * @param string $content The post. + * @return string $content An excerpt of the post. */ - public function generate_excerpt_with_footnotes( string $p_str_content ): string { + public function generate_excerpt_with_footnotes( string $content ): string { // Discard existing excerpt and start on the basis of the post. - $p_str_content = get_the_content( get_the_id() ); + $content = get_the_content( get_the_id() ); // Get footnote delimiter shortcodes and unify them. - $p_str_content = self::unify_delimiters( $p_str_content ); + $content = self::unify_delimiters( $content ); // Apply WordPress excerpt processing. - $p_str_content = strip_shortcodes( $p_str_content ); - $p_str_content = excerpt_remove_blocks( $p_str_content ); + $content = strip_shortcodes( $content ); + $content = excerpt_remove_blocks( $content ); // But do not process footnotes at this point; do only this. - $p_str_content = str_replace( ']]>', ']]>', $p_str_content ); + $content = str_replace( ']]>', ']]>', $content ); // Prepare the excerpt length argument. - $l_int_excerpt_length = (int) _x( '55', 'excerpt_length' ); - $l_int_excerpt_length = (int) apply_filters( 'excerpt_length', $l_int_excerpt_length ); + $excerpt_length = (int) _x( '55', 'excerpt_length' ); + $excerpt_length = (int) apply_filters( 'excerpt_length', $excerpt_length ); // Prepare the Read-on string. - $l_str_excerpt_more = apply_filters( 'excerpt_more', ' […]' ); + $excerpt_more = apply_filters( 'excerpt_more', ' […]' ); // Safeguard the footnotes. preg_match_all( - '#' . self::$a_str_start_tag_regex . '.+?' . self::$a_str_end_tag_regex . '#', - $p_str_content, - $p_arr_saved_footnotes + '#' . self::$start_tag_regex . '.+?' . self::$end_tag_regex . '#', + $content, + $saved_footnotes ); // Prevent the footnotes from altering the excerpt: previously hard-coded '5ED84D6'. - $l_int_placeholder = '@' . wp_rand( 100_000_000, 2_147_483_647 ) . '@'; - $p_str_content = preg_replace( - '#' . self::$a_str_start_tag_regex . '.+?' . self::$a_str_end_tag_regex . '#', - $l_int_placeholder, - $p_str_content + $placeholder = '@' . wp_rand( 100_000_000, 2_147_483_647 ) . '@'; + $content = preg_replace( + '#' . self::$start_tag_regex . '.+?' . self::$end_tag_regex . '#', + $placeholder, + $content ); // Replace line breaking markup with a separator. - $l_str_separator = ' '; - $p_str_content = preg_replace( '#
#', $l_str_separator, $p_str_content ); - $p_str_content = preg_replace( '#
#', $l_str_separator, $p_str_content ); - $p_str_content = preg_replace( '#<(p|li|div)[^>]*>#', $l_str_separator, $p_str_content ); - $p_str_content = preg_replace( '#' . $l_str_separator . '#', '', $p_str_content, 1 ); - $p_str_content = preg_replace( '##', '', $p_str_content ); - $p_str_content = preg_replace( '#[\r\n]#', '', $p_str_content ); + $separator = ' '; + $content = preg_replace( '#
#', $separator, $content ); + $content = preg_replace( '#
#', $separator, $content ); + $content = preg_replace( '#<(p|li|div)[^>]*>#', $separator, $content ); + $content = preg_replace( '#' . $separator . '#', '', $content, 1 ); + $content = preg_replace( '##', '', $content ); + $content = preg_replace( '#[\r\n]#', '', $content ); // To count words like Advanced Excerpt does it. - $l_arr_tokens = array(); - $l_str_output = ''; - $l_int_counter = 0; + $tokens = array(); + $output = ''; + $counter = 0; // Tokenize into tags and words as in Advanced Excerpt. - preg_match_all( '#(<[^>]+>|[^<>\s]+)\s*#u', $p_str_content, $l_arr_tokens ); + preg_match_all( '#(<[^>]+>|[^<>\s]+)\s*#u', $content, $tokens ); // Count words following one option of Advanced Excerpt. - foreach ( $l_arr_tokens[0] as $l_str_token ) { + foreach ( $tokens[0] as $token ) { - if ( $l_int_counter >= $l_int_excerpt_length ) { + if ( $counter >= $excerpt_length ) { break; } // If token is not a tag, increment word count. - if ( '<' !== $l_str_token[0] ) { - $l_int_counter++; + if ( '<' !== $token[0] ) { + $counter++; } // Append the token to the output. - $l_str_output .= $l_str_token; + $output .= $token; } // Complete unbalanced markup, used by Advanced Excerpt. - $p_str_content = force_balance_tags( $l_str_output ); + $content = force_balance_tags( $output ); // Readd footnotes in excerpt. - $l_int_index = 0; - while ( 0 !== preg_match( '#' . $l_int_placeholder . '#', $p_str_content ) ) { - $p_str_content = preg_replace( - '#' . $l_int_placeholder . '#', - $p_arr_saved_footnotes[0][ $l_int_index ], - $p_str_content, + $index = 0; + while ( 0 !== preg_match( '#' . $placeholder . '#', $content ) ) { + $content = preg_replace( + '#' . $placeholder . '#', + $saved_footnotes[0][ $index ], + $content, 1 ); - $l_int_index++; + $index++; } // Append the Read-on string as in wp_trim_words(). - $p_str_content .= $l_str_excerpt_more; + $content .= $excerpt_more; // Process readded footnotes without appending the reference container. - $p_str_content = self::exec( $p_str_content, false ); + $content = self::exec( $content, false ); - return $p_str_content; + return $content; } @@ -1002,12 +1002,12 @@ class Parser { * * @since 1.5.0 * - * @param string $p_str_content Widget content. - * @return string $p_str_content Content with replaced footnotes. + * @param string $content Widget content. + * @return string $content Content with replaced footnotes. */ - public function footnotes_in_widget_title( string $p_str_content ): string { + public function footnotes_in_widget_title( string $content ): string { // Appends the reference container if set to "post_end". - return $this->exec( $p_str_content, false ); + return $this->exec( $content, false ); } /** @@ -1015,13 +1015,13 @@ class Parser { * * @since 1.5.0 * - * @param string $p_str_content Widget content. - * @return string $p_str_content Content with replaced footnotes. + * @param string $content Widget content. + * @return string $content Content with replaced footnotes. */ - public function footnotes_in_widget_text( string $p_str_content ): string { + public function footnotes_in_widget_text( string $content ): string { // phpcs:disable WordPress.PHP.YodaConditions.NotYoda // Appends the reference container if set to "post_end". - return $this->exec( $p_str_content, 'post_end' === Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ); + return $this->exec( $content, 'post_end' === Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION ) ); // phpcs:enable WordPress.PHP.YodaConditions.NotYoda } @@ -1030,51 +1030,51 @@ class 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 $content Any string that may contain footnotes to be replaced. + * @param bool $output_references Appends the Reference Container to the output if set to true, default true. + * @param bool $hide_footnotes_text Hide footnotes found in the string. */ - public function exec( string $p_str_content, bool $p_bool_output_references = false, bool $p_bool_hide_footnotes_text = false ): string { + public function exec( string $content, bool $output_references = false, bool $hide_footnotes_text = false ): string { // Process content. - $p_str_content = $this->search( $p_str_content, $p_bool_hide_footnotes_text ); + $content = $this->search( $content, $hide_footnotes_text ); /* * Reference container customized positioning through shortcode. */ // Append the reference container or insert at shortcode. - $l_str_reference_container_position_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE ); - if ( empty( $l_str_reference_container_position_shortcode ) ) { - $l_str_reference_container_position_shortcode = '[[references]]'; + $reference_container_position_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION_SHORTCODE ); + if ( empty( $reference_container_position_shortcode ) ) { + $reference_container_position_shortcode = '[[references]]'; } - if ( $p_bool_output_references ) { + if ( $output_references ) { - if ( strpos( $p_str_content, (string) $l_str_reference_container_position_shortcode ) ) { + if ( strpos( $content, (string) $reference_container_position_shortcode ) ) { - $p_str_content = str_replace( $l_str_reference_container_position_shortcode, $this->reference_container(), $p_str_content ); + $content = str_replace( $reference_container_position_shortcode, $this->reference_container(), $content ); } else { - $p_str_content .= $this->reference_container(); + $content .= $this->reference_container(); } // Increment the container ID. - self::$a_int_reference_container_id++; + self::$reference_container_id++; } // Delete position shortcode should any remain. - $p_str_content = str_replace( $l_str_reference_container_position_shortcode, '', $p_str_content ); + $content = str_replace( $reference_container_position_shortcode, '', $content ); // Take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found. - if ( strpos( $p_str_content, \footnotes\includes\Config::C_STR_NO_LOVE_SLUG ) ) { - self::$a_bool_allow_love_me = false; - $p_str_content = str_replace( \footnotes\includes\Config::C_STR_NO_LOVE_SLUG, '', $p_str_content ); + if ( strpos( $content, \footnotes\includes\Config::NO_LOVE_SLUG ) ) { + self::$allow_love_me = false; + $content = str_replace( \footnotes\includes\Config::NO_LOVE_SLUG, '', $content ); } // Return the content with replaced footnotes and optional reference container appended. - return $p_str_content; + return $content; } /** @@ -1087,63 +1087,63 @@ class Parser { * * @since 2.1.14 * - * @param string $p_str_content The footnote, including delimiters. + * @param string $content The footnote, including delimiters. */ - public function unify_delimiters( string $p_str_content ): string { + public function unify_delimiters( string $content ): string { // Get footnotes start and end tag short codes. - $l_str_starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); - $l_str_ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); - if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) { - $l_str_starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $l_str_ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START ); + $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END ); + if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) { + $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } // If any footnotes short code is empty, return the content without changes. - if ( empty( $l_str_starting_tag ) || empty( $l_str_ending_tag ) ) { - return $p_str_content; + if ( empty( $starting_tag ) || empty( $ending_tag ) ) { + return $content; } - if ( preg_match( '#[&"\'<>]#', $l_str_starting_tag . $l_str_ending_tag ) ) { + if ( preg_match( '#[&"\'<>]#', $starting_tag . $ending_tag ) ) { - $l_str_harmonized_start_tag = '{[(|fnote_stt|)]}'; - $l_str_harmonized_end_tag = '{[(|fnote_end|)]}'; + $harmonized_start_tag = '{[(|fnote_stt|)]}'; + $harmonized_end_tag = '{[(|fnote_end|)]}'; // Harmonize footnotes without escaping any HTML special characters in delimiter shortcodes. // The footnote has been added in the Block Editor code editor (doesn’t work in Classic Editor text mode). - $p_str_content = str_replace( $l_str_starting_tag, $l_str_harmonized_start_tag, $p_str_content ); - $p_str_content = str_replace( $l_str_ending_tag, $l_str_harmonized_end_tag, $p_str_content ); + $content = str_replace( $starting_tag, $harmonized_start_tag, $content ); + $content = str_replace( $ending_tag, $harmonized_end_tag, $content ); // Harmonize footnotes while escaping HTML special characters in delimiter shortcodes. // The footnote has been added in the Classic Editor visual mode. - $p_str_content = str_replace( htmlspecialchars( $l_str_starting_tag ), $l_str_harmonized_start_tag, $p_str_content ); - $p_str_content = str_replace( htmlspecialchars( $l_str_ending_tag ), $l_str_harmonized_end_tag, $p_str_content ); + $content = str_replace( htmlspecialchars( $starting_tag ), $harmonized_start_tag, $content ); + $content = str_replace( htmlspecialchars( $ending_tag ), $harmonized_end_tag, $content ); // Harmonize footnotes while escaping HTML special characters except greater-than sign in delimiter shortcodes. // The footnote has been added in the Block Editor visual mode. - $p_str_content = str_replace( str_replace( '>', '>', htmlspecialchars( $l_str_starting_tag ) ), $l_str_harmonized_start_tag, $p_str_content ); - $p_str_content = str_replace( str_replace( '>', '>', htmlspecialchars( $l_str_ending_tag ) ), $l_str_harmonized_end_tag, $p_str_content ); + $content = str_replace( str_replace( '>', '>', htmlspecialchars( $starting_tag ) ), $harmonized_start_tag, $content ); + $content = str_replace( str_replace( '>', '>', htmlspecialchars( $ending_tag ) ), $harmonized_end_tag, $content ); // Assign the delimiter shortcodes. - self::$a_str_start_tag = $l_str_harmonized_start_tag; - self::$a_str_end_tag = $l_str_harmonized_end_tag; + self::$start_tag = $harmonized_start_tag; + self::$end_tag = $harmonized_end_tag; // Assign the regex-conformant shortcodes. - self::$a_str_start_tag_regex = '\{\[\(\|fnote_stt\|\)\]\}'; - self::$a_str_end_tag_regex = '\{\[\(\|fnote_end\|\)\]\}'; + self::$start_tag_regex = '\{\[\(\|fnote_stt\|\)\]\}'; + self::$end_tag_regex = '\{\[\(\|fnote_end\|\)\]\}'; } else { // Assign the delimiter shortcodes. - self::$a_str_start_tag = $l_str_starting_tag; - self::$a_str_end_tag = $l_str_ending_tag; + self::$start_tag = $starting_tag; + self::$end_tag = $ending_tag; // Make shortcodes conform to regex syntax. - self::$a_str_start_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', self::$a_str_start_tag ); - self::$a_str_end_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', self::$a_str_end_tag ); + self::$start_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', self::$start_tag ); + self::$end_tag_regex = preg_replace( '#([\(\)\{\}\[\]\|\*\.\?\!])#', '\\\\$1', self::$end_tag ); } - return $p_str_content; + return $content; } /** @@ -1153,13 +1153,13 @@ class Parser { * @todo Refactor to parse DOM rather than using RegEx. * @todo Decompose. * - * @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 string $content Any content to be parsed for footnotes. + * @param bool $hide_footnotes_text Hide footnotes found in the string. */ - public function search( string $p_str_content, bool $p_bool_hide_footnotes_text ): string { + public function search( string $content, bool $hide_footnotes_text ): string { // Get footnote delimiter shortcodes and unify them. - $p_str_content = self::unify_delimiters( $p_str_content ); + $content = self::unify_delimiters( $content ); /* * Checks for balanced footnote delimiters; delimiter syntax validation. @@ -1169,59 +1169,59 @@ class Parser { */ // If enabled. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) { // Apply different regex depending on whether start shortcode is double/triple opening parenthesis. - if ( '((' === self::$a_str_start_tag || '(((' === self::$a_str_start_tag ) { + if ( '((' === self::$start_tag || '(((' === self::$start_tag ) { // This prevents from catching a script containing e.g. a double opening parenthesis. - $l_str_validation_regex = '#' . self::$a_str_start_tag_regex . '(((?!' . self::$a_str_end_tag_regex . ')[^\{\}])*?)(' . self::$a_str_start_tag_regex . '|$)#s'; + $validation_regex = '#' . self::$start_tag_regex . '(((?!' . self::$end_tag_regex . ')[^\{\}])*?)(' . self::$start_tag_regex . '|$)#s'; } else { // Catch all only if the start shortcode is not double/triple opening parenthesis, i.e. is unlikely to occur in scripts. - $l_str_validation_regex = '#' . self::$a_str_start_tag_regex . '(((?!' . self::$a_str_end_tag_regex . ').)*?)(' . self::$a_str_start_tag_regex . '|$)#s'; + $validation_regex = '#' . self::$start_tag_regex . '(((?!' . self::$end_tag_regex . ').)*?)(' . self::$start_tag_regex . '|$)#s'; } // Check syntax and get error locations. - preg_match( $l_str_validation_regex, $p_str_content, $p_arr_error_location ); - if ( empty( $p_arr_error_location ) ) { - self::$a_bool_syntax_error_flag = false; + preg_match( $validation_regex, $content, $error_location ); + if ( empty( $error_location ) ) { + self::$syntax_error_flag = false; } // Prevent generating and inserting the warning multiple times. - if ( self::$a_bool_syntax_error_flag ) { + if ( self::$syntax_error_flag ) { // Get plain text string for error location. - $l_str_error_spot_string = wp_strip_all_tags( $p_arr_error_location[1] ); + $error_spot_string = wp_strip_all_tags( $error_location[1] ); // Limit string length to 300 characters. - if ( strlen( $l_str_error_spot_string ) > 300 ) { - $l_str_error_spot_string = substr( $l_str_error_spot_string, 0, 299 ) . '…'; + if ( strlen( $error_spot_string ) > 300 ) { + $error_spot_string = substr( $error_spot_string, 0, 299 ) . '…'; } // Compose warning box. - $l_str_syntax_error_warning = '

'; - $l_str_syntax_error_warning .= __( 'WARNING: unbalanced footnote start tag short code found.', 'footnotes' ); - $l_str_syntax_error_warning .= '

'; + $syntax_error_warning = '

'; + $syntax_error_warning .= __( 'WARNING: unbalanced footnote start tag short code found.', 'footnotes' ); + $syntax_error_warning .= '

'; // Syntax validation setting in the dashboard under the General settings tab. /* Translators: 1: General Settings 2: Footnote start and end short codes 3: Check for balanced shortcodes */ - $l_str_syntax_error_warning .= sprintf( __( 'If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %1$s > %2$s > %3$s.', 'footnotes' ), __( 'General settings', 'footnotes' ), __( 'Footnote start and end short codes', 'footnotes' ), __( 'Check for balanced shortcodes', 'footnotes' ) ); + $syntax_error_warning .= sprintf( __( 'If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %1$s > %2$s > %3$s.', 'footnotes' ), __( 'General settings', 'footnotes' ), __( 'Footnote start and end short codes', 'footnotes' ), __( 'Check for balanced shortcodes', 'footnotes' ) ); - $l_str_syntax_error_warning .= '

'; - $l_str_syntax_error_warning .= __( 'Unbalanced start tag short code found before:', 'footnotes' ); - $l_str_syntax_error_warning .= '

“'; - $l_str_syntax_error_warning .= $l_str_error_spot_string; - $l_str_syntax_error_warning .= '”

'; + $syntax_error_warning .= '

'; + $syntax_error_warning .= __( 'Unbalanced start tag short code found before:', 'footnotes' ); + $syntax_error_warning .= '

“'; + $syntax_error_warning .= $error_spot_string; + $syntax_error_warning .= '”

'; // Prepend the warning box to the content. - $p_str_content = $l_str_syntax_error_warning . $p_str_content; + $content = $syntax_error_warning . $content; // Checked, set flag to false to prevent duplicate warning. - self::$a_bool_syntax_error_flag = false; + self::$syntax_error_flag = false; - return $p_str_content; + return $content; } } @@ -1231,22 +1231,22 @@ class Parser { * 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 = '#(]+?value=["\'][^>]+?)' . self::$a_str_start_tag_regex . '[^>]+?' . self::$a_str_end_tag_regex . '#'; + $value_regex = '#(]+?value=["\'][^>]+?)' . self::$start_tag_regex . '[^>]+?' . self::$end_tag_regex . '#'; do { - $p_str_content = preg_replace( $l_str_value_regex, '$1', $p_str_content ); - } while ( preg_match( $l_str_value_regex, $p_str_content ) ); + $content = preg_replace( $value_regex, '$1', $content ); + } while ( preg_match( $value_regex, $content ) ); // Optionally moves footnotes outside at the end of the label element. - $l_str_label_issue_solution = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION ); + $label_issue_solution = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION ); - if ( 'move' === $l_str_label_issue_solution ) { + if ( 'move' === $label_issue_solution ) { - $l_str_move_regex = '#(
', - $l_str_footnote_text + $footnote_text ); } // Text to be displayed instead of the footnote. - $l_str_footnote_replace_text = ''; + $footnote_replace_text = ''; // Whether hard links are enabled. - if ( self::$a_bool_hard_links_enabled ) { + if ( self::$hard_links_enabled ) { // Get the configurable parts. - self::$a_str_referrer_link_slug = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG ); - self::$a_str_footnote_link_slug = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG ); - self::$a_str_link_ids_separator = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_HARD_LINK_IDS_SEPARATOR ); + self::$referrer_link_slug = Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERRER_FRAGMENT_ID_SLUG ); + self::$footnote_link_slug = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_FRAGMENT_ID_SLUG ); + self::$link_ids_separator = Includes\Settings::instance()->get( \footnotes\includes\Settings::HARD_LINK_IDS_SEPARATOR ); // Streamline ID concatenation. - self::$a_str_post_container_id_compound = self::$a_str_link_ids_separator; - self::$a_str_post_container_id_compound .= self::$a_int_post_id; - self::$a_str_post_container_id_compound .= self::$a_str_link_ids_separator; - self::$a_str_post_container_id_compound .= self::$a_int_reference_container_id; - self::$a_str_post_container_id_compound .= self::$a_str_link_ids_separator; + self::$post_container_id_compound = self::$link_ids_separator; + self::$post_container_id_compound .= self::$post_id; + self::$post_container_id_compound .= self::$link_ids_separator; + self::$post_container_id_compound .= self::$reference_container_id; + self::$post_container_id_compound .= self::$link_ids_separator; } // Display the footnote referrers and the tooltips. - if ( ! $p_bool_hide_footnotes_text ) { - $l_int_index = Includes\Convert::index( $l_int_footnote_index, Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); + if ( ! $hide_footnotes_text ) { + $index = Includes\Convert::index( $footnote_index, Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ); // Display only a truncated footnote text if option enabled. - $l_bool_enable_excerpt = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) ); - $l_int_max_length = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH ); + $enable_excerpt = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) ); + $max_length = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH ); // Define excerpt text as footnote text by default. - $l_str_excerpt_text = $l_str_footnote_text; + $excerpt_text = $footnote_text; /* * Tooltip truncation. @@ -1432,56 +1432,56 @@ class Parser { * This is equivalent to the WordPress default excerpt generation, i.e. without a * custom excerpt and without a delimiter. But WordPress does word count, usually 55. */ - if ( General::$a_bool_tooltips_enabled && $l_bool_enable_excerpt ) { - $l_str_dummy_text = wp_strip_all_tags( $l_str_footnote_text ); - if ( is_int( $l_int_max_length ) && strlen( $l_str_dummy_text ) > $l_int_max_length ) { - $l_str_excerpt_text = substr( $l_str_dummy_text, 0, $l_int_max_length ); - $l_str_excerpt_text = substr( $l_str_excerpt_text, 0, strrpos( $l_str_excerpt_text, ' ' ) ); - $l_str_excerpt_text .= ' … <'; - $l_str_excerpt_text .= self::$a_bool_hard_links_enabled ? 'a' : 'span'; - $l_str_excerpt_text .= ' class="footnote_tooltip_continue" '; + if ( General::$tooltips_enabled && $enable_excerpt ) { + $dummy_text = wp_strip_all_tags( $footnote_text ); + if ( is_int( $max_length ) && strlen( $dummy_text ) > $max_length ) { + $excerpt_text = substr( $dummy_text, 0, $max_length ); + $excerpt_text = substr( $excerpt_text, 0, strrpos( $excerpt_text, ' ' ) ); + $excerpt_text .= ' … <'; + $excerpt_text .= self::$hard_links_enabled ? 'a' : 'span'; + $excerpt_text .= ' class="footnote_tooltip_continue" '; // If AMP compatibility mode is enabled. - if ( General::$a_bool_amp_enabled ) { + if ( General::$amp_enabled ) { // If the reference container is also collapsed by default. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE ) ) ) { - $l_str_excerpt_text .= ' on="tap:footnote_references_container_'; - $l_str_excerpt_text .= self::$a_int_post_id . '_' . self::$a_int_reference_container_id; - $l_str_excerpt_text .= '.toggleClass(class=collapsed, force=false),footnotes_container_button_plus_'; - $l_str_excerpt_text .= self::$a_int_post_id . '_' . self::$a_int_reference_container_id; - $l_str_excerpt_text .= '.toggleClass(class=collapsed, force=true),footnotes_container_button_minus_'; - $l_str_excerpt_text .= self::$a_int_post_id . '_' . self::$a_int_reference_container_id; - $l_str_excerpt_text .= '.toggleClass(class=collapsed, force=false)"'; + $excerpt_text .= ' on="tap:footnote_references_container_'; + $excerpt_text .= self::$post_id . '_' . self::$reference_container_id; + $excerpt_text .= '.toggleClass(class=collapsed, force=false),footnotes_container_button_plus_'; + $excerpt_text .= self::$post_id . '_' . self::$reference_container_id; + $excerpt_text .= '.toggleClass(class=collapsed, force=true),footnotes_container_button_minus_'; + $excerpt_text .= self::$post_id . '_' . self::$reference_container_id; + $excerpt_text .= '.toggleClass(class=collapsed, force=false)"'; } } else { // Don’t add onclick event in AMP compatibility mode. // Reverted wrong linting. - $l_str_excerpt_text .= ' onclick="footnote_moveToReference_' . self::$a_int_post_id; - $l_str_excerpt_text .= '_' . self::$a_int_reference_container_id; - $l_str_excerpt_text .= '(\'footnote_plugin_reference_' . self::$a_int_post_id; - $l_str_excerpt_text .= '_' . self::$a_int_reference_container_id; - $l_str_excerpt_text .= "_$l_int_index');\""; + $excerpt_text .= ' onclick="footnote_moveToReference_' . self::$post_id; + $excerpt_text .= '_' . self::$reference_container_id; + $excerpt_text .= '(\'footnote_plugin_reference_' . self::$post_id; + $excerpt_text .= '_' . self::$reference_container_id; + $excerpt_text .= "_$index');\""; } // If enabled, add the hard link fragment ID. - if ( self::$a_bool_hard_links_enabled ) { + if ( self::$hard_links_enabled ) { - $l_str_excerpt_text .= ' href="#'; - $l_str_excerpt_text .= self::$a_str_footnote_link_slug; - $l_str_excerpt_text .= self::$a_str_post_container_id_compound; - $l_str_excerpt_text .= $l_int_index; - $l_str_excerpt_text .= '"'; + $excerpt_text .= ' href="#'; + $excerpt_text .= self::$footnote_link_slug; + $excerpt_text .= self::$post_container_id_compound; + $excerpt_text .= $index; + $excerpt_text .= '"'; } - $l_str_excerpt_text .= '>'; + $excerpt_text .= '>'; // Configurable read-on button label. - $l_str_excerpt_text .= Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ); + $excerpt_text .= Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_READON_LABEL ); - $l_str_excerpt_text .= self::$a_bool_hard_links_enabled ? '' : '
'; + $excerpt_text .= self::$hard_links_enabled ? '' : ''; } } @@ -1490,38 +1490,38 @@ class Parser { * * Define the HTML element to use for the referrers. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ) ) ) { - $l_str_sup_span = 'sup'; + $sup_span = 'sup'; } else { - $l_str_sup_span = 'span'; + $sup_span = 'span'; } // Whether hard links are enabled. - if ( self::$a_bool_hard_links_enabled ) { + if ( self::$hard_links_enabled ) { - self::$a_str_link_span = 'a'; - self::$a_str_link_close_tag = ''; - // Self::$a_str_link_open_tag will be defined as needed. + self::$link_span = 'a'; + self::$link_close_tag = ''; + // Self::$link_open_tag will be defined as needed. // Compose hyperlink address (leading space is in template). - $l_str_footnote_link_argument = 'href="#'; - $l_str_footnote_link_argument .= self::$a_str_footnote_link_slug; - $l_str_footnote_link_argument .= self::$a_str_post_container_id_compound; - $l_str_footnote_link_argument .= $l_int_index; - $l_str_footnote_link_argument .= '" class="footnote_hard_link"'; + $footnote_link_argument = 'href="#'; + $footnote_link_argument .= self::$footnote_link_slug; + $footnote_link_argument .= self::$post_container_id_compound; + $footnote_link_argument .= $index; + $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. */ - $l_str_referrer_anchor_element = ''; + $referrer_anchor_element = ''; } else { /* @@ -1529,105 +1529,105 @@ class Parser { * * If no hyperlink nor offset anchor is needed, initialize as empty. */ - $l_str_footnote_link_argument = ''; - $l_str_referrer_anchor_element = ''; + $footnote_link_argument = ''; + $referrer_anchor_element = ''; // The link element is set independently as it may be needed for styling. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_LINK_ELEMENT_ENABLED ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::LINK_ELEMENT_ENABLED ) ) ) { - self::$a_str_link_span = 'a'; - self::$a_str_link_open_tag = ''; - self::$a_str_link_close_tag = ''; + self::$link_span = 'a'; + self::$link_open_tag = ''; + self::$link_close_tag = ''; } } // Determine tooltip content. - if ( General::$a_bool_tooltips_enabled ) { - $l_str_tooltip_content = $l_bool_has_tooltip_text ? $l_str_tooltip_text : $l_str_excerpt_text; + if ( General::$tooltips_enabled ) { + $tooltip_content = $has_tooltip_text ? $tooltip_text : $excerpt_text; /* * Ensures paragraph separation * * Ensures that footnotes containing paragraph separators get displayed correctly. */ - $l_arr_paragraph_splitters = array( '#(

|]*>)#', '#(
|]*>)#' ); - $l_str_tooltip_content = preg_replace( $l_arr_paragraph_splitters, '
', $l_str_tooltip_content ); + $paragraph_splitters = array( '#(

|]*>)#', '#(|]*>)#' ); + $tooltip_content = preg_replace( $paragraph_splitters, '
', $tooltip_content ); } else { - $l_str_tooltip_content = ''; + $tooltip_content = ''; } // Determine shrink width if alternative tooltips are enabled. - $l_str_tooltip_style = ''; - if ( General::$a_bool_alternative_tooltips_enabled && General::$a_bool_tooltips_enabled ) { - $l_int_tooltip_length = strlen( wp_strip_all_tags( $l_str_tooltip_content ) ); - if ( $l_int_tooltip_length < 70 ) { - $l_str_tooltip_style = ' style="width: '; - $l_str_tooltip_style .= ( $l_int_tooltip_length * .7 ); - $l_str_tooltip_style .= 'em;"'; + $tooltip_style = ''; + if ( General::$alternative_tooltips_enabled && General::$tooltips_enabled ) { + $tooltip_length = strlen( wp_strip_all_tags( $tooltip_content ) ); + if ( $tooltip_length < 70 ) { + $tooltip_style = ' style="width: '; + $tooltip_style .= ( $tooltip_length * .7 ); + $tooltip_style .= 'em;"'; } } // Fill in 'public/partials/footnote.html'. - $l_obj_template->replace( + $template->replace( array( - 'link-span' => self::$a_str_link_span, - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'note_id' => $l_int_index, - 'hard-link' => $l_str_footnote_link_argument, - 'sup-span' => $l_str_sup_span, - 'before' => Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_STYLING_BEFORE ), - 'index' => $l_int_index, - 'after' => Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_STYLING_AFTER ), - 'anchor-element' => $l_str_referrer_anchor_element, - 'style' => $l_str_tooltip_style, - 'text' => $l_str_tooltip_content, + 'link-span' => self::$link_span, + 'post_id' => self::$post_id, + 'container_id' => self::$reference_container_id, + 'note_id' => $index, + 'hard-link' => $footnote_link_argument, + 'sup-span' => $sup_span, + 'before' => Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_STYLING_BEFORE ), + 'index' => $index, + 'after' => Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_STYLING_AFTER ), + 'anchor-element' => $referrer_anchor_element, + 'style' => $tooltip_style, + 'text' => $tooltip_content, ) ); - $l_str_footnote_replace_text = $l_obj_template->get_content(); + $footnote_replace_text = $template->get_content(); // Reset the template. - $l_obj_template->reload(); + $template->reload(); // If tooltips are enabled but neither AMP nor alternative are. - if ( General::$a_bool_tooltips_enabled && ! General::$a_bool_amp_enabled && ! General::$a_bool_alternative_tooltips_enabled ) { + if ( General::$tooltips_enabled && ! General::$amp_enabled && ! General::$alternative_tooltips_enabled ) { - $l_int_offset_y = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ); - $l_int_offset_x = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ); - $l_int_fade_in_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY ); - $l_int_fade_in_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ); - $l_int_fade_out_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ); - $l_int_fade_out_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION ); + $offset_y = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ); + $offset_x = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ); + $fade_in_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ); + $fade_in_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ); + $fade_out_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ); + $fade_out_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ); // Fill in 'public/partials/tooltip.html'. - $l_obj_template_tooltip->replace( + $template_tooltip->replace( array( - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'note_id' => $l_int_index, - 'position' => Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION ), - 'offset-y' => empty( $l_int_offset_y ) ? 0 : $l_int_offset_y, - 'offset-x' => empty( $l_int_offset_x ) ? 0 : $l_int_offset_x, - 'fade-in-delay' => empty( $l_int_fade_in_delay ) ? 0 : $l_int_fade_in_delay, - 'fade-in-duration' => empty( $l_int_fade_in_duration ) ? 0 : $l_int_fade_in_duration, - 'fade-out-delay' => empty( $l_int_fade_out_delay ) ? 0 : $l_int_fade_out_delay, - 'fade-out-duration' => empty( $l_int_fade_out_duration ) ? 0 : $l_int_fade_out_duration, + 'post_id' => self::$post_id, + 'container_id' => self::$reference_container_id, + 'note_id' => $index, + 'position' => Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION ), + 'offset-y' => empty( $offset_y ) ? 0 : $offset_y, + 'offset-x' => empty( $offset_x ) ? 0 : $offset_x, + 'fade-in-delay' => empty( $fade_in_delay ) ? 0 : $fade_in_delay, + 'fade-in-duration' => empty( $fade_in_duration ) ? 0 : $fade_in_duration, + 'fade-out-delay' => empty( $fade_out_delay ) ? 0 : $fade_out_delay, + 'fade-out-duration' => empty( $fade_out_duration ) ? 0 : $fade_out_duration, ) ); - $l_str_footnote_replace_text .= $l_obj_template_tooltip->get_content(); - $l_obj_template_tooltip->reload(); + $footnote_replace_text .= $template_tooltip->get_content(); + $template_tooltip->reload(); } } // Replace the footnote with the template. - $p_str_content = substr_replace( $p_str_content, $l_str_footnote_replace_text, $l_int_pos_start, $l_int_length + strlen( self::$a_str_end_tag ) ); + $content = substr_replace( $content, $footnote_replace_text, $pos_start, $length + strlen( self::$end_tag ) ); // Add footnote only if not empty. - if ( ! empty( $l_str_footnote_text ) ) { + if ( ! empty( $footnote_text ) ) { // Set footnote to the output box at the end. - self::$a_arr_footnotes[] = $l_str_footnote_text; + self::$footnotes[] = $footnote_text; // Increase footnote index. - $l_int_footnote_index++; + $footnote_index++; } /* @@ -1653,12 +1653,12 @@ class Parser { * and mixed escapement schemas. */ // Add offset to the new starting position. - $l_int_pos_start += strlen( $l_str_footnote_replace_text ); + $pos_start += strlen( $footnote_replace_text ); } while ( true ); // Return content. - return $p_str_content; + return $content; } /** @@ -1668,9 +1668,9 @@ class Parser { */ public function reference_container(): string { - $l_str_use_backbutton_hint = null; + $use_backbutton_hint = null; // No footnotes have been replaced on this page. - if ( empty( self::$a_arr_footnotes ) ) { + if ( empty( self::$footnotes ) ) { return ''; } @@ -1679,29 +1679,29 @@ class Parser { */ // If the backlink symbol is enabled. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) { // Get html arrow. - $l_str_arrow = Includes\Convert::get_arrow( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_HYPERLINK_ARROW ) ); + $arrow = Includes\Convert::get_arrow( Includes\Settings::instance()->get( \footnotes\includes\Settings::HYPERLINK_ARROW ) ); // Set html arrow to the first one if invalid index defined. - if ( is_array( $l_str_arrow ) ) { - $l_str_arrow = Includes\Convert::get_arrow( 0 ); + if ( is_array( $arrow ) ) { + $arrow = Includes\Convert::get_arrow( 0 ); } // Get user defined arrow. - $l_str_arrow_user_defined = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED ); - if ( ! empty( $l_str_arrow_user_defined ) ) { - $l_str_arrow = $l_str_arrow_user_defined; + $arrow_user_defined = Includes\Settings::instance()->get( \footnotes\includes\Settings::HYPERLINK_ARROW_USER_DEFINED ); + if ( ! empty( $arrow_user_defined ) ) { + $arrow = $arrow_user_defined; } // Wrap the arrow in a @media print { display:hidden } span. - $l_str_footnote_arrow = ''; - $l_str_footnote_arrow .= $l_str_arrow . ''; + $footnote_arrow = ''; + $footnote_arrow .= $arrow . ''; } else { // If the backlink symbol isn’t enabled, set it to empty. - $l_str_arrow = ''; - $l_str_footnote_arrow = ''; + $arrow = ''; + $footnote_arrow = ''; } @@ -1711,22 +1711,22 @@ class Parser { * Initially an appended comma was hard-coded in this algorithm for enumerations. * The comma in enumerations is not universally preferred. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_ENABLED ) ) ) { - if ( empty( $l_str_separator ) ) { + if ( empty( $separator ) ) { // If it is not, check which option is on. - $l_str_separator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_OPTION ); - $l_str_separator = match ($l_str_separator_option) { + $separator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_OPTION ); + $separator = match ($separator_option) { 'comma' => ',', 'semicolon' => ';', 'en_dash' => ' –', - default => Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM ), + default => Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_CUSTOM ), }; } } else { - $l_str_separator = ''; + $separator = ''; } /* @@ -1734,22 +1734,22 @@ class Parser { * * Initially a dot was appended in the table row template. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_ENABLED ) ) ) { - if ( empty( $l_str_terminator ) ) { + if ( empty( $terminator ) ) { // If it is not, check which option is on. - $l_str_terminator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_OPTION ); - $l_str_terminator = match ($l_str_terminator_option) { + $terminator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_OPTION ); + $terminator = match ($terminator_option) { 'period' => '.', 'parenthesis' => ')', 'colon' => ':', - default => Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM ), + default => Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_CUSTOM ), }; } } else { - $l_str_terminator = ''; + $terminator = ''; } /* @@ -1760,7 +1760,7 @@ class Parser { * Variable number length and proportional character width require explicit line breaks. * Otherwise, an ordinary space character offering a line break opportunity is inserted. */ - $l_str_line_break = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED ) ) ? '
' : ' '; + $line_break = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_LINE_BREAKS_ENABLED ) ) ? '
' : ' '; /* * Line breaks for source readability. @@ -1769,67 +1769,67 @@ class Parser { * separated by an empty line. So we add these line breaks for source readability. * Before the first table row (breaks between rows are ~200 lines below). */ - $l_str_body = "\r\n\r\n"; + $body = "\r\n\r\n"; /* * Reference container table row template load. */ - $l_bool_combine_identical_footnotes = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES ) ); + $combine_identical_footnotes = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::COMBINE_IDENTICAL_FOOTNOTES ) ); // AMP compatibility requires a full set of AMP compatible table row templates. - if ( General::$a_bool_amp_enabled ) { + if ( General::$amp_enabled ) { // When combining identical footnotes is turned on, another template is needed. - if ( $l_bool_combine_identical_footnotes ) { + if ( $combine_identical_footnotes ) { // The combining template allows for backlink clusters and supports cell clicking for single notes. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'amp-reference-container-body-combi' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'amp-reference-container-body-3column' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'amp-reference-container-body-switch' ); + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body-combi' ); + } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body-3column' ); + } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body-switch' ); } else { // Default is the standard template. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'amp-reference-container-body' ); + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body' ); } - } elseif ( $l_bool_combine_identical_footnotes ) { + } elseif ( $combine_identical_footnotes ) { // The combining template allows for backlink clusters and supports cell clicking for single notes. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'reference-container-body-combi' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'reference-container-body-3column' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'reference-container-body-switch' ); + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body-combi' ); + } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body-3column' ); + } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body-switch' ); } else { // Default is the standard template. - $l_obj_template = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'reference-container-body' ); + $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body' ); } /* * Switch backlink symbol and footnote number. */ - $l_bool_symbol_switch = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ); + $symbol_switch = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ); // Loop through all footnotes found in the page. - $num_footnotes = count( self::$a_arr_footnotes ); - for ( $l_int_index = 0; $l_int_index < $num_footnotes; $l_int_index++ ) { + $num_footnotes = count( self::$footnotes ); + for ( $index = 0; $index < $num_footnotes; $index++ ) { // Get footnote text. - $l_str_footnote_text = self::$a_arr_footnotes[ $l_int_index ]; + $footnote_text = self::$footnotes[ $index ]; // If footnote is empty, go to the next one;. // With combine identicals turned on, identicals will be deleted and are skipped. - if ( empty( $l_str_footnote_text ) ) { + if ( empty( $footnote_text ) ) { continue; } // Generate content of footnote index cell. - $l_int_first_footnote_index = ( $l_int_index + 1 ); + $first_footnote_index = ( $index + 1 ); // Get the footnote index string and. // Keep supporting legacy index placeholder. - $l_str_footnote_id = Includes\Convert::index( ( $l_int_index + 1 ), Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); + $footnote_id = Includes\Convert::index( ( $index + 1 ), Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ); /** * Case of only one backlink per table row. @@ -1837,9 +1837,9 @@ class Parser { * If enabled, and for the case the footnote is single, compose hard link. */ // Define anyway. - $l_str_hard_link_address = ''; + $hard_link_address = ''; - if ( self::$a_bool_hard_links_enabled ) { + if ( self::$hard_links_enabled ) { /* * Use-Backbutton-Hint tooltip, optional and configurable. * @@ -1849,35 +1849,35 @@ class Parser { * * @since 2.5.4 */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { - $l_str_use_backbutton_hint = ' title="'; - $l_str_use_backbutton_hint .= Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ); - $l_str_use_backbutton_hint .= '"'; + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { + $use_backbutton_hint = ' title="'; + $use_backbutton_hint .= Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT ); + $use_backbutton_hint .= '"'; } else { - $l_str_use_backbutton_hint = ''; + $use_backbutton_hint = ''; } /** * Compose fragment ID anchor with offset, for use in reference container. * Empty span, child of empty span, to avoid tall dotted rectangles in browser. */ - $l_str_footnote_anchor_element = ''; + $footnote_anchor_element = ''; // Compose optional hard link address. - $l_str_hard_link_address = ' href="#'; - $l_str_hard_link_address .= self::$a_str_referrer_link_slug; - $l_str_hard_link_address .= self::$a_str_post_container_id_compound; - $l_str_hard_link_address .= $l_str_footnote_id . '"'; - $l_str_hard_link_address .= $l_str_use_backbutton_hint; - self::$a_str_link_open_tag = ' class="footnote_hard_back_link">'; + $hard_link_address = ' href="#'; + $hard_link_address .= self::$referrer_link_slug; + $hard_link_address .= self::$post_container_id_compound; + $hard_link_address .= $footnote_id . '"'; + $hard_link_address .= $use_backbutton_hint; + self::$link_open_tag = ' class="footnote_hard_back_link">'; } else { // Define as empty, too. - $l_str_footnote_anchor_element = ''; + $footnote_anchor_element = ''; } /* @@ -1891,207 +1891,207 @@ class Parser { */ // Set a flag to check for the combined status of a footnote item. - $l_bool_flag_combined = false; + $flag_combined = false; // Set otherwise unused variables as empty to avoid screwing up the placeholder array. - $l_str_backlink_event = ''; - $l_str_footnote_backlinks = ''; - $l_str_footnote_reference = ''; + $backlink_event = ''; + $footnote_backlinks = ''; + $footnote_reference = ''; - if ( $l_bool_combine_identical_footnotes ) { + if ( $combine_identical_footnotes ) { // ID, optional hard link address, and class. - $l_str_footnote_reference = '<' . self::$a_str_link_span; - $l_str_footnote_reference .= ' id="footnote_plugin_reference_'; - $l_str_footnote_reference .= self::$a_int_post_id; - $l_str_footnote_reference .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_reference .= "_$l_str_footnote_id\""; - if ( self::$a_bool_hard_links_enabled ) { - $l_str_footnote_reference .= ' href="#'; - $l_str_footnote_reference .= self::$a_str_referrer_link_slug; - $l_str_footnote_reference .= self::$a_str_post_container_id_compound; - $l_str_footnote_reference .= $l_str_footnote_id . '"'; - $l_str_footnote_reference .= $l_str_use_backbutton_hint; + $footnote_reference = '<' . self::$link_span; + $footnote_reference .= ' id="footnote_plugin_reference_'; + $footnote_reference .= self::$post_id; + $footnote_reference .= '_' . self::$reference_container_id; + $footnote_reference .= "_$footnote_id\""; + if ( self::$hard_links_enabled ) { + $footnote_reference .= ' href="#'; + $footnote_reference .= self::$referrer_link_slug; + $footnote_reference .= self::$post_container_id_compound; + $footnote_reference .= $footnote_id . '"'; + $footnote_reference .= $use_backbutton_hint; } - $l_str_footnote_reference .= ' class="footnote_backlink"'; + $footnote_reference .= ' class="footnote_backlink"'; /* * The click event goes in the table cell if footnote remains single. */ - $l_str_backlink_event = ' onclick="footnote_moveToAnchor_'; + $backlink_event = ' onclick="footnote_moveToAnchor_'; - $l_str_backlink_event .= self::$a_int_post_id; - $l_str_backlink_event .= '_' . self::$a_int_reference_container_id; - $l_str_backlink_event .= "('footnote_plugin_tooltip_"; - $l_str_backlink_event .= self::$a_int_post_id; - $l_str_backlink_event .= '_' . self::$a_int_reference_container_id; - $l_str_backlink_event .= "_$l_str_footnote_id');\""; + $backlink_event .= self::$post_id; + $backlink_event .= '_' . self::$reference_container_id; + $backlink_event .= "('footnote_plugin_tooltip_"; + $backlink_event .= self::$post_id; + $backlink_event .= '_' . self::$reference_container_id; + $backlink_event .= "_$footnote_id');\""; // The dedicated template enumerating backlinks uses another variable. - $l_str_footnote_backlinks = $l_str_footnote_reference; + $footnote_backlinks = $footnote_reference; // Append the click event right to the backlink item for enumerations;. // Else it goes in the table cell. - $l_str_footnote_backlinks .= $l_str_backlink_event . '>'; - $l_str_footnote_reference .= '>'; + $footnote_backlinks .= $backlink_event . '>'; + $footnote_reference .= '>'; // Append the optional offset anchor for hard links. - if ( self::$a_bool_hard_links_enabled ) { - $l_str_footnote_reference .= $l_str_footnote_anchor_element; - $l_str_footnote_backlinks .= $l_str_footnote_anchor_element; + if ( self::$hard_links_enabled ) { + $footnote_reference .= $footnote_anchor_element; + $footnote_backlinks .= $footnote_anchor_element; } // Continue both single note and notes cluster, depending on switch option status. - if ( $l_bool_symbol_switch ) { + if ( $symbol_switch ) { - $l_str_footnote_reference .= "$l_str_footnote_id$l_str_footnote_arrow"; - $l_str_footnote_backlinks .= "$l_str_footnote_id$l_str_footnote_arrow"; + $footnote_reference .= "$footnote_id$footnote_arrow"; + $footnote_backlinks .= "$footnote_id$footnote_arrow"; } else { - $l_str_footnote_reference .= "$l_str_footnote_arrow$l_str_footnote_id"; - $l_str_footnote_backlinks .= "$l_str_footnote_arrow$l_str_footnote_id"; + $footnote_reference .= "$footnote_arrow$footnote_id"; + $footnote_backlinks .= "$footnote_arrow$footnote_id"; } // If that is the only footnote with this text, we’re almost done.. // Check if it isn't the last footnote in the array. - if ( $l_int_first_footnote_index < count( self::$a_arr_footnotes ) ) { + if ( $first_footnote_index < count( self::$footnotes ) ) { // Get all footnotes that haven't passed yet. - $num_footnotes = count( self::$a_arr_footnotes ); - for ( $l_int_check_index = $l_int_first_footnote_index; $l_int_check_index < $num_footnotes; $l_int_check_index++ ) { + $num_footnotes = count( self::$footnotes ); + for ( $check_index = $first_footnote_index; $check_index < $num_footnotes; $check_index++ ) { // Check if a further footnote is the same as the actual one. - if ( self::$a_arr_footnotes[ $l_int_check_index ] === $l_str_footnote_text ) { + if ( self::$footnotes[ $check_index ] === $footnote_text ) { // If so, set the further footnote as empty so it won't be displayed later. - self::$a_arr_footnotes[ $l_int_check_index ] = ''; + self::$footnotes[ $check_index ] = ''; // Set the flag to true for the combined status. - $l_bool_flag_combined = true; + $flag_combined = true; // Update the footnote ID. - $l_str_footnote_id = Includes\Convert::index( ( $l_int_check_index + 1 ), Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); + $footnote_id = Includes\Convert::index( ( $check_index + 1 ), Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ); // Resume composing the backlinks enumeration. - $l_str_footnote_backlinks .= "$l_str_separator'; - $l_str_footnote_backlinks .= $l_str_line_break; - $l_str_footnote_backlinks .= '<' . self::$a_str_link_span; - $l_str_footnote_backlinks .= ' id="footnote_plugin_reference_'; - $l_str_footnote_backlinks .= self::$a_int_post_id; - $l_str_footnote_backlinks .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_backlinks .= "_$l_str_footnote_id\""; + $footnote_backlinks .= "$separator'; + $footnote_backlinks .= $line_break; + $footnote_backlinks .= '<' . self::$link_span; + $footnote_backlinks .= ' id="footnote_plugin_reference_'; + $footnote_backlinks .= self::$post_id; + $footnote_backlinks .= '_' . self::$reference_container_id; + $footnote_backlinks .= "_$footnote_id\""; // Insert the optional hard link address. - if ( self::$a_bool_hard_links_enabled ) { - $l_str_footnote_backlinks .= ' href="#'; - $l_str_footnote_backlinks .= self::$a_str_referrer_link_slug; - $l_str_footnote_backlinks .= self::$a_str_post_container_id_compound; - $l_str_footnote_backlinks .= $l_str_footnote_id . '"'; - $l_str_footnote_backlinks .= $l_str_use_backbutton_hint; + if ( self::$hard_links_enabled ) { + $footnote_backlinks .= ' href="#'; + $footnote_backlinks .= self::$referrer_link_slug; + $footnote_backlinks .= self::$post_container_id_compound; + $footnote_backlinks .= $footnote_id . '"'; + $footnote_backlinks .= $use_backbutton_hint; } - $l_str_footnote_backlinks .= ' class="footnote_backlink"'; + $footnote_backlinks .= ' class="footnote_backlink"'; // Reverted wrong linting. - $l_str_footnote_backlinks .= ' onclick="footnote_moveToAnchor_'; + $footnote_backlinks .= ' onclick="footnote_moveToAnchor_'; - $l_str_footnote_backlinks .= self::$a_int_post_id; - $l_str_footnote_backlinks .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_backlinks .= "('footnote_plugin_tooltip_"; - $l_str_footnote_backlinks .= self::$a_int_post_id; - $l_str_footnote_backlinks .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_backlinks .= "_$l_str_footnote_id');\">"; + $footnote_backlinks .= self::$post_id; + $footnote_backlinks .= '_' . self::$reference_container_id; + $footnote_backlinks .= "('footnote_plugin_tooltip_"; + $footnote_backlinks .= self::$post_id; + $footnote_backlinks .= '_' . self::$reference_container_id; + $footnote_backlinks .= "_$footnote_id');\">"; // Append the offset anchor for optional hard links. - if ( self::$a_bool_hard_links_enabled ) { - $l_str_footnote_backlinks .= ''; + if ( self::$hard_links_enabled ) { + $footnote_backlinks .= ''; } - $l_str_footnote_backlinks .= $l_bool_symbol_switch ? '' : $l_str_footnote_arrow; - $l_str_footnote_backlinks .= $l_str_footnote_id; - $l_str_footnote_backlinks .= $l_bool_symbol_switch ? $l_str_footnote_arrow : ''; + $footnote_backlinks .= $symbol_switch ? '' : $footnote_arrow; + $footnote_backlinks .= $footnote_id; + $footnote_backlinks .= $symbol_switch ? $footnote_arrow : ''; } } } // Append terminator and end tag. - $l_str_footnote_reference .= $l_str_terminator . ''; - $l_str_footnote_backlinks .= $l_str_terminator . ''; + $footnote_reference .= $terminator . ''; + $footnote_backlinks .= $terminator . ''; } // Line wrapping of URLs already fixed, see above. // Get reference container item text if tooltip text goes separate. - $l_int_tooltip_text_length = strpos( $l_str_footnote_text, self::$a_str_tooltip_shortcode ); - $l_bool_has_tooltip_text = (bool) $l_int_tooltip_text_length; - if ( $l_bool_has_tooltip_text ) { - $l_str_not_tooltip_text = substr( $l_str_footnote_text, ( $l_int_tooltip_text_length + self::$a_int_tooltip_shortcode_length ) ); - self::$a_bool_mirror_tooltip_text = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) ); - if ( self::$a_bool_mirror_tooltip_text ) { - $l_str_tooltip_text = substr( $l_str_footnote_text, 0, $l_int_tooltip_text_length ); - $l_str_reference_text_introducer = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ); - $l_str_reference_text = $l_str_tooltip_text . $l_str_reference_text_introducer . $l_str_not_tooltip_text; + $tooltip_text_length = strpos( $footnote_text, self::$tooltip_shortcode ); + $has_tooltip_text = (bool) $tooltip_text_length; + if ( $has_tooltip_text ) { + $not_tooltip_text = substr( $footnote_text, ( $tooltip_text_length + self::$tooltip_shortcode_length ) ); + self::$mirror_tooltip_text = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) ); + if ( self::$mirror_tooltip_text ) { + $tooltip_text = substr( $footnote_text, 0, $tooltip_text_length ); + $reference_text_introducer = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ); + $reference_text = $tooltip_text . $reference_text_introducer . $not_tooltip_text; } else { - $l_str_reference_text = $l_str_not_tooltip_text; + $reference_text = $not_tooltip_text; } } else { - $l_str_reference_text = $l_str_footnote_text; + $reference_text = $footnote_text; } // Replace all placeholders in table row template. - $l_obj_template->replace( + $template->replace( array( // Placeholder used in all templates. - 'text' => $l_str_reference_text, + 'text' => $reference_text, // Used in standard layout W/O COMBINED FOOTNOTES. - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'note_id' => Includes\Convert::index( $l_int_first_footnote_index, Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ), - 'link-start' => self::$a_str_link_open_tag, - 'link-end' => self::$a_str_link_close_tag, - 'link-span' => self::$a_str_link_span, - 'terminator' => $l_str_terminator, - 'anchor-element' => $l_str_footnote_anchor_element, - 'hard-link' => $l_str_hard_link_address, + 'post_id' => self::$post_id, + 'container_id' => self::$reference_container_id, + 'note_id' => Includes\Convert::index( $first_footnote_index, Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ), + 'link-start' => self::$link_open_tag, + 'link-end' => self::$link_close_tag, + 'link-span' => self::$link_span, + 'terminator' => $terminator, + 'anchor-element' => $footnote_anchor_element, + 'hard-link' => $hard_link_address, // Used in standard layout WITH COMBINED IDENTICALS TURNED ON. - 'pointer' => $l_bool_flag_combined ? '' : ' pointer', - 'event' => $l_bool_flag_combined ? '' : $l_str_backlink_event, - 'backlinks' => $l_bool_flag_combined ? $l_str_footnote_backlinks : $l_str_footnote_reference, + 'pointer' => $flag_combined ? '' : ' pointer', + 'event' => $flag_combined ? '' : $backlink_event, + 'backlinks' => $flag_combined ? $footnote_backlinks : $footnote_reference, // Legacy placeholders for use in legacy layout templates. - 'arrow' => $l_str_footnote_arrow, - 'index' => $l_str_footnote_id, + 'arrow' => $footnote_arrow, + 'index' => $footnote_id, ) ); - $l_str_body .= $l_obj_template->get_content(); + $body .= $template->get_content(); // Extra line breaks for page source readability. - $l_str_body .= "\r\n\r\n"; + $body .= "\r\n\r\n"; - $l_obj_template->reload(); + $template->reload(); } // Call again for robustness when priority levels don’t match any longer. - self::$a_int_scroll_offset = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ); + self::$scroll_offset = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_OFFSET ); // Streamline. - $l_bool_collapse_default = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) ); + $collapse_default = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE ) ); /* * Reference container label. @@ -2100,81 +2100,81 @@ class Parser { * 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. */ - $l_str_reference_container_label = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_NAME ); + $reference_container_label = Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_NAME ); // Select the reference container template. // Whether AMP compatibility mode is enabled. - if ( General::$a_bool_amp_enabled ) { + if ( General::$amp_enabled ) { // Whether the reference container is collapsed by default. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE ) ) ) { // Load 'public/partials/amp-reference-container-collapsed.html'. - $l_obj_template_container = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'amp-reference-container-collapsed' ); + $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-collapsed' ); } else { // Load 'public/partials/amp-reference-container.html'. - $l_obj_template_container = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'amp-reference-container' ); + $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container' ); } - } elseif ( 'js' === General::$a_str_script_mode ) { + } elseif ( 'js' === General::$script_mode ) { // Load 'public/partials/js-reference-container.html'. - $l_obj_template_container = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'js-reference-container' ); + $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'js-reference-container' ); } else { // Load 'public/partials/reference-container.html'. - $l_obj_template_container = new Includes\Template( \footnotes\includes\Template::C_STR_PUBLIC, 'reference-container' ); + $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container' ); } - $l_int_scroll_offset = ''; - $l_int_scroll_down_delay = ''; - $l_int_scroll_down_duration = ''; - $l_int_scroll_up_delay = ''; - $l_int_scroll_up_duration = ''; + $scroll_offset = ''; + $scroll_down_delay = ''; + $scroll_down_duration = ''; + $scroll_up_delay = ''; + $scroll_up_duration = ''; - if ( 'jquery' === General::$a_str_script_mode ) { + if ( 'jquery' === General::$script_mode ) { - $l_int_scroll_offset = ( self::$a_int_scroll_offset / 100 ); - $l_int_scroll_up_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DURATION ); + $scroll_offset = ( self::$scroll_offset / 100 ); + $scroll_up_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION ); - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY ) ) ) { + if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY ) ) ) { - $l_int_scroll_down_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION ); + $scroll_down_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DURATION ); } else { - $l_int_scroll_down_duration = $l_int_scroll_up_duration; + $scroll_down_duration = $scroll_up_duration; } - $l_int_scroll_down_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY ); - $l_int_scroll_up_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY ); + $scroll_down_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DELAY ); + $scroll_up_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_UP_DELAY ); } - $l_obj_template_container->replace( + $template_container->replace( array( - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'element' => Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT ), - 'name' => empty( $l_str_reference_container_label ) ? ' ' : $l_str_reference_container_label, - 'button-style' => $l_bool_collapse_default ? '' : 'display: none;', - 'style' => $l_bool_collapse_default ? 'display: none;' : '', - 'caption' => ( empty( $l_str_reference_container_label ) || ' ' === $l_str_reference_container_label ) ? 'References' : $l_str_reference_container_label, - 'content' => $l_str_body, - 'scroll-offset' => $l_int_scroll_offset, - 'scroll-down-delay' => $l_int_scroll_down_delay, - 'scroll-down-duration' => $l_int_scroll_down_duration, - 'scroll-up-delay' => $l_int_scroll_up_delay, - 'scroll-up-duration' => $l_int_scroll_up_duration, + 'post_id' => self::$post_id, + 'container_id' => self::$reference_container_id, + 'element' => Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_ELEMENT ), + 'name' => empty( $reference_container_label ) ? ' ' : $reference_container_label, + 'button-style' => $collapse_default ? '' : 'display: none;', + 'style' => $collapse_default ? 'display: none;' : '', + 'caption' => ( empty( $reference_container_label ) || ' ' === $reference_container_label ) ? 'References' : $reference_container_label, + 'content' => $body, + 'scroll-offset' => $scroll_offset, + 'scroll-down-delay' => $scroll_down_delay, + 'scroll-down-duration' => $scroll_down_duration, + 'scroll-up-delay' => $scroll_up_delay, + 'scroll-up-duration' => $scroll_up_duration, ) ); // Free all found footnotes if reference container will be displayed. - self::$a_arr_footnotes = array(); + self::$footnotes = array(); - return $l_obj_template_container->get_content(); + return $template_container->get_content(); } } diff --git a/src/public/widget/class-base.php b/src/public/widget/class-base.php index 324f356..f075943 100644 --- a/src/public/widget/class-base.php +++ b/src/public/widget/class-base.php @@ -77,11 +77,11 @@ abstract class Base extends \WP_Widget { * @since 1.5.0 */ public function __construct() { - $l_arr_widget_options = array( + $widget_options = array( 'classname' => __CLASS__, 'description' => $this->get_description(), ); - $l_arr_control_options = array( + $control_options = array( 'id_base' => strtolower( $this->get_id() ), 'width' => $this->get_widget_width(), ); @@ -89,8 +89,8 @@ abstract class Base extends \WP_Widget { parent::__construct( strtolower( $this->get_id() ), // Unique ID for the widget, has to be lowercase. $this->get_name(), // Plugin name to be displayed. - $l_arr_widget_options, // Optional Widget Options. - $l_arr_control_options // Optional Widget Control Options. + $widget_options, // Optional Widget Options. + $control_options // Optional Widget Control Options. ); } diff --git a/src/public/widget/class-reference-container.php b/src/public/widget/class-reference-container.php index 52061e6..97f07b5 100644 --- a/src/public/widget/class-reference-container.php +++ b/src/public/widget/class-reference-container.php @@ -111,9 +111,9 @@ class Reference_Container extends Base { public function widget( $args, $instance ) { global $footnotes; // Reference container positioning is set to "widget area". - if ( 'widget' === Includes\Settings::instance()->get( Includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) { + if ( 'widget' === Includes\Settings::instance()->get( Includes\Settings::REFERENCE_CONTAINER_POSITION ) ) { // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $footnotes->a_obj_task->reference_container(); + echo $footnotes->task->reference_container(); // phpcs:enable } }