diff --git a/class/config.php b/class/config.php index 35634b4..3f60574 100644 --- a/class/config.php +++ b/class/config.php @@ -14,14 +14,14 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Config { +class Footnotes_Config { /** * Internal Plugin name. * * @since 1.5.0 * @var string */ - const C_STR_PLUGIN_NAME = 'footnotes'; + const PLUGIN_NAME = 'footnotes'; /** * Public Plugin name. @@ -31,7 +31,7 @@ class MCI_Footnotes_Config { * * edited classes for v2.0.4 */ - const C_STR_PLUGIN_PUBLIC_NAME = ''; + const PLUGIN_PUBLIC_NAME = ''; /** * Public Plugin name for dashboard heading @@ -45,7 +45,7 @@ class MCI_Footnotes_Config { * @since 2.0.4 * @var string */ - const C_STR_PLUGIN_HEADING_NAME = 'footnotes'; + const PLUGIN_HEADING_NAME = 'footnotes'; /** * Html tag for the LOVE symbol. @@ -53,7 +53,7 @@ class MCI_Footnotes_Config { * @since 1.5.0 * @var string */ - const C_STR_LOVE_SYMBOL = ''; + const LOVE_SYMBOL = ''; /** * HTML code for the 'love' symbol used in dashboard heading @@ -61,7 +61,7 @@ class MCI_Footnotes_Config { * @since 2.0.4 * @var string */ - const C_STR_LOVE_SYMBOL_HEADING = ''; + const LOVE_SYMBOL_HEADING = ''; /** * Short code to DON'T display the 'LOVE ME' slug on certain pages. @@ -69,5 +69,5 @@ class MCI_Footnotes_Config { * @since 1.5.0 * @var string */ - const C_STR_NO_LOVE_SLUG = '[[no footnotes: love]]'; + const NO_LOVE_SLUG = '[[no footnotes: love]]'; } diff --git a/class/convert.php b/class/convert.php index d1da59a..868c165 100644 --- a/class/convert.php +++ b/class/convert.php @@ -14,34 +14,34 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Convert { +class Footnotes_Convert { /** * Converts a integer into the user-defined counter style for the footnotes. * * @since 1.5.0 - * @param int $p_int_index Index to be converted. - * @param string $p_str_convert_style Style of the new/converted Index. + * @param int $index Index to be converted. + * @param string $convert_style Style of the new/converted Index. * @return string Converted Index as string in the defined counter style. * * Edited: * @since 2.2.0 lowercase Roman numerals supported */ - public static function index( $p_int_index, $p_str_convert_style = 'arabic_plain' ) { - switch ( $p_str_convert_style ) { + public static function index( $index, $convert_style = 'arabic_plain' ) { + switch ( $convert_style ) { case 'romanic': - return self::to_romanic( $p_int_index, true ); + return self::to_romanic( $index, true ); case 'roman_low': - return self::to_romanic( $p_int_index, false ); + return self::to_romanic( $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 $p_int_index; + return $index; } } @@ -50,62 +50,62 @@ class MCI_Footnotes_Convert { * Function available from A to ZZ ( means 676 footnotes at 1 page possible). * * @since 1.0-gamma - * @param int $p_int_value Value/Index to be converted. - * @param bool $p_bool_upper_case True to convert the value to upper case letter, otherwise to lower case. + * @param int $value Value/Index to be converted. + * @param bool $upper_case True to convert the value to upper case letter, otherwise to lower case. * @return string */ - private static function to_latin( $p_int_value, $p_bool_upper_case ) { + private static function to_latin( $value, $upper_case ) { // 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. * * @since 1.0-gamma - * @param int $p_int_value Value/Index to be converted. + * @param int $value Value/Index to be converted. * @return string Value with a leading zero. */ - private static function to_arabic_leading( $p_int_value ) { + private static function to_arabic_leading( $value ) { // 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 romanic letter. * * @since 1.0-gamma - * @param int $p_int_value Value/Index to be converted. - * @param bool $p_bool_upper_case Whether to uppercase. + * @param int $value Value/Index to be converted. + * @param bool $upper_case Whether to uppercase. * @return string * * Edited: * @since 2.2.0 optionally lowercase (code from Latin) */ - private static function to_romanic( $p_int_value, $p_bool_upper_case ) { + private static function to_romanic( $value, $upper_case ) { // Table containing all necessary romanic letters. - $l_arr_romanic_letters = array( + $romanic_letters = array( 'M' => 1000, 'CM' => 900, 'D' => 500, @@ -121,36 +121,36 @@ class MCI_Footnotes_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_romanic_letters as $l_str_romanic => $l_int_arabic ) { - if ( $p_int_value >= $l_int_arabic ) { - $p_int_value -= $l_int_arabic; - $l_str_return .= $l_str_romanic; + while ( $value > 0 ) { + foreach ( $romanic_letters as $romanic => $arabic ) { + if ( $value >= $arabic ) { + $value -= $arabic; + $return .= $romanic; break; } } } // Return romanic 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. * * @since 1.0-beta - * @param string $p_str_value String to be converted to boolean. + * @param string $value String to be converted to boolean. * @return bool Boolean representing the string. */ - public static function to_bool( $p_str_value ) { + public static function to_bool( $value ) { // 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': @@ -166,22 +166,22 @@ class MCI_Footnotes_Convert { * Get a html Array short code depending on Arrow-Array key index. * * @since 1.3.2 - * @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 array|string Array of all Arrows if Index is empty otherwise html tag of a specific arrow. */ - public static function get_arrow( $p_int_index = -1 ) { + public static function get_arrow( $index = -1 ) { // Define all possible arrows. - $l_arr_arrows = array( '↑', '↥', '↟', '↩', '↲', '↵', '⇑', '⇡', '⇧', '↑' ); + $arrows = array( '↑', '↥', '↟', '↩', '↲', '↵', '⇑', '⇡', '⇧', '↑' ); // Convert index to an integer. - if ( ! is_int( $p_int_index ) ) { - $p_int_index = intval( $p_int_index ); + if ( ! is_int( $index ) ) { + $index = intval( $index ); } // Return the whole arrow array. - if ( $p_int_index < 0 || $p_int_index > count( $l_arr_arrows ) ) { - return $l_arr_arrows; + if ( $index < 0 || $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 diff --git a/class/dashboard/init.php b/class/dashboard/init.php index 64d24ad..2c28904 100644 --- a/class/dashboard/init.php +++ b/class/dashboard/init.php @@ -12,7 +12,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Layout_Init { +class Footnotes_Layout_Init { /** * Slug for the Plugin main menu. @@ -20,7 +20,7 @@ class MCI_Footnotes_Layout_Init { * @since 1.5.0 * @var string */ - const C_STR_MAIN_MENU_SLUG = 'footnotes'; + const MAIN_MENU_SLUG = 'footnotes'; /** * Plugin main menu name. @@ -28,7 +28,7 @@ class MCI_Footnotes_Layout_Init { * @since 1.5.0 * @var string */ - const C_STR_MAIN_MENU_TITLE = 'ManFisher'; + const MAIN_MENU_TITLE = 'ManFisher'; /** * Contains the settings layoutEngine @@ -44,7 +44,7 @@ class MCI_Footnotes_Layout_Init { * @since 1.5.0 */ public function __construct() { - $this->settings_page = new MCI_Footnotes_Layout_Settings(); + $this->settings_page = new Footnotes_Layout_Settings(); // Register hooks/actions. add_action( 'admin_menu', array( $this, 'register_options_submenu' ) ); @@ -60,7 +60,7 @@ class MCI_Footnotes_Layout_Init { * @since 1.5.0 */ public function initialize_settings() { - MCI_Footnotes_Settings::instance()->register_settings(); + Footnotes_Settings::instance()->register_settings(); $this->settings_page->register_sections(); } @@ -74,7 +74,7 @@ class MCI_Footnotes_Layout_Init { add_submenu_page( 'options-general.php', 'footnotes Settings', - self::C_STR_MAIN_MENU_SLUG, + self::MAIN_MENU_SLUG, 'manage_options', 'footnotes', array( $this->settings_page, 'display_content' ) @@ -93,53 +93,53 @@ class MCI_Footnotes_Layout_Init { // 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 ); - 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 ); + 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 ) ? intval( $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 ) ? intval( $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/class/dashboard/layout.php b/class/dashboard/layout.php index a147ef5..9003758 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -19,7 +19,7 @@ * * @since 1.5.0 */ -abstract class MCI_Footnotes_Layout_Engine { +abstract class Footnotes_Layout_Engine { /** * Stores the Hook connection string for the child sub page. @@ -27,7 +27,7 @@ abstract class MCI_Footnotes_Layout_Engine { * @since 1.5.0 * @var null|string */ - protected $a_str_sub_page_hook = null; + protected $sub_page_hook = null; /** * Stores all Sections for the child sub page. @@ -35,7 +35,7 @@ abstract class MCI_Footnotes_Layout_Engine { * @since 1.5.0 * @var array */ - protected $a_arr_sections = array(); + protected $sections = array(); /** * Returns a Priority index. Lower numbers have a higher Priority. @@ -81,18 +81,18 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns an array describing a sub page section. * * @since 1.5.0 - * @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 Should a Submit Button be displayed for this section, default: true. + * @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 Should a Submit Button be displayed for this section, default: true. * @return array Array describing the section. */ - protected function add_section( $p_str_id, $p_str_title, $p_int_settings_container_index, $p_bool_has_submit_button = true ) { + protected function add_section( $id, $title, $settings_container_index, $has_submit_button = true ) { return array( - 'id' => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '-' . $p_str_id, - 'title' => $p_str_title, - 'submit' => $p_bool_has_submit_button, - 'container' => $p_int_settings_container_index, + 'id' => Footnotes_Config::PLUGIN_NAME . '-' . $id, + 'title' => $title, + 'submit' => $has_submit_button, + 'container' => $settings_container_index, ); } @@ -100,18 +100,18 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns an array describing a meta box. * * @since 1.5.0 - * @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 meta box description to be able to append a meta box to the output. */ - protected function add_meta_box( $p_str_section_id, $p_str_id, $p_str_title, $p_str_callback_function_name ) { + protected function add_meta_box( $section_id, $id, $title, $callback_function_name ) { return array( - 'parent' => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '-' . $p_str_section_id, - 'id' => $p_str_id, - 'title' => $p_str_title, - 'callback' => $p_str_callback_function_name, + 'parent' => Footnotes_Config::PLUGIN_NAME . '-' . $section_id, + 'id' => $id, + 'title' => $title, + 'callback' => $callback_function_name, ); } @@ -123,20 +123,20 @@ abstract class MCI_Footnotes_Layout_Engine { public function register_sub_page() { global $submenu; - if ( array_key_exists( plugin_basename( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG ), $submenu ) ) { - foreach ( $submenu[ plugin_basename( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG ) ] as $l_arr_sub_menu ) { - if ( plugin_basename( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ) === $l_arr_sub_menu[2] ) { - remove_submenu_page( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ); + if ( array_key_exists( plugin_basename( Footnotes_Layout_Init::MAIN_MENU_SLUG ), $submenu ) ) { + foreach ( $submenu[ plugin_basename( Footnotes_Layout_Init::MAIN_MENU_SLUG ) ] as $sub_menu ) { + if ( plugin_basename( Footnotes_Layout_Init::MAIN_MENU_SLUG . $this->get_sub_page_slug() ) === $sub_menu[2] ) { + remove_submenu_page( Footnotes_Layout_Init::MAIN_MENU_SLUG, Footnotes_Layout_Init::MAIN_MENU_SLUG . $this->get_sub_page_slug() ); } } } - $this->a_str_sub_page_hook = add_submenu_page( - MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, + $this->sub_page_hook = add_submenu_page( + Footnotes_Layout_Init::MAIN_MENU_SLUG, $this->get_sub_page_title(), $this->get_sub_page_title(), 'manage_options', - MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(), + Footnotes_Layout_Init::MAIN_MENU_SLUG . $this->get_sub_page_slug(), array( $this, 'display_content' ) ); } @@ -147,16 +147,16 @@ abstract class MCI_Footnotes_Layout_Engine { * @since 1.5.0 */ public function register_sections() { - 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'], '', array( $this, 'Description' ), - $l_arr_section['id'] + $section['id'] ); - $this->register_meta_boxes( $l_arr_section['id'] ); + $this->register_meta_boxes( $section['id'] ); } } @@ -164,19 +164,19 @@ abstract class MCI_Footnotes_Layout_Engine { * Registers all Meta boxes for a sub page. * * @since 1.5.0 - * @param string $p_str_parent_id Parent section unique id. + * @param string $parent_id Parent section unique id. */ - private function register_meta_boxes( $p_str_parent_id ) { + private function register_meta_boxes( $parent_id ) { // 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' ); } @@ -211,11 +211,11 @@ abstract class MCI_Footnotes_Layout_Engine { */ if ( true === PRODUCTION_ENV ) { - wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_FOOTNOTES_VERSION ); + wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), FOOTNOTES_VERSION ); } else { - wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), C_STR_FOOTNOTES_VERSION ); + wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), FOOTNOTES_VERSION ); } @@ -234,17 +234,17 @@ abstract class MCI_Footnotes_Layout_Engine { // TODO: add nonce verification. // Get the current section. - reset( $this->a_arr_sections ); - $l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections ); - $l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ]; + reset( $this->sections ); + $active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $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 ) ) { if ( 'save' === $_POST['save-settings'] ) { unset( $_POST['save-settings'] ); unset( $_POST['submit'] ); - $l_bool_settings_updated = $this->save_settings(); + $settings_updated = $this->save_settings(); } } @@ -252,19 +252,19 @@ abstract class MCI_Footnotes_Layout_Engine { echo '
'; echo '
'; - if ( $l_bool_settings_updated ) { + if ( $settings_updated ) { echo sprintf( '
%s
', __( 'Settings saved', 'footnotes' ) ); } @@ -272,11 +272,11 @@ abstract class MCI_Footnotes_Layout_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 '
'; @@ -287,7 +287,7 @@ abstract class MCI_Footnotes_Layout_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 ''; } @@ -301,25 +301,25 @@ abstract class MCI_Footnotes_Layout_Engine { * @return bool */ private function save_settings() { - $l_arr_new_settings = array(); + $new_settings = array(); // TODO: add nonce verification. // Get current section. - reset( $this->a_arr_sections ); - $l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections ); - $l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ]; + reset( $this->sections ); + $active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->sections ); + $active_section = $this->sections[ $active_section_id ]; - foreach ( MCI_Footnotes_Settings::instance()->get_defaults( $l_arr_active_section['container'] ) as $l_str_key => $l_mixed_value ) { - if ( array_key_exists( $l_str_key, $_POST ) ) { - $l_arr_new_settings[ $l_str_key ] = wp_unslash( $_POST[ $l_str_key ] ); + foreach ( Footnotes_Settings::instance()->get_defaults( $active_section['container'] ) as $key => $l_mixed_value ) { + if ( array_key_exists( $key, $_POST ) ) { + $new_settings[ $key ] = wp_unslash( $_POST[ $key ] ); } else { // Setting is not defined in the POST array, define it to avoid the Default value. - $l_arr_new_settings[ $l_str_key ] = ''; + $new_settings[ $key ] = ''; } } // Update settings. - return MCI_Footnotes_Settings::instance()->save_options( $l_arr_active_section['container'], $l_arr_new_settings ); + return Footnotes_Settings::instance()->save_options( $active_section['container'], $new_settings ); } // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing @@ -336,7 +336,7 @@ abstract class MCI_Footnotes_Layout_Engine { * Loads specific setting and returns an array with the keys [id, name, value]. * * @since 1.5.0 - * @param string $p_str_setting_key_name Settings Array key name. + * @param string $setting_key_name Settings Array key name. * @return array Contains Settings ID, Settings Name and Settings Value. * * @since 2.5.11 Remove escapement function. @@ -354,14 +354,14 @@ abstract class MCI_Footnotes_Layout_Engine { * This is the only instance of esc_|kses|sanitize in the pre-2.5.11 codebase. * Removing this did not fix the quotation mark backslash escapement bug. */ - protected function load_setting( $p_str_setting_key_name ) { + protected function load_setting( $setting_key_name ) { // Get current section. - reset( $this->a_arr_sections ); - $p_arr_return = array(); - $p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name ); - $p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name ); - $p_arr_return['value'] = esc_attr( MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name ) ); - return $p_arr_return; + reset( $this->sections ); + $return = array(); + $return['id'] = sprintf( '%s', $setting_key_name ); + $return['name'] = sprintf( '%s', $setting_key_name ); + $return['value'] = esc_attr( Footnotes_Settings::instance()->get( $setting_key_name ) ); + return $return; } /** @@ -388,23 +388,23 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns a simple text inside html text. * * @since 1.5.0 - * @param string $p_str_text Message to be surrounded with simple html tag (span). + * @param string $text Message to be surrounded with simple html tag (span). * @return string */ - protected function add_text( $p_str_text ) { - return sprintf( '%s', $p_str_text ); + protected function add_text( $text ) { + return sprintf( '%s', $text ); } /** * Returns the html tag for an input/select label. * * @since 1.5.0 - * @param string $p_str_setting_name Name of the Settings key to connect the Label with the input/select field. - * @param string $p_str_caption Label caption. + * @param string $setting_name Name of the Settings key to connect the Label with the input/select field. + * @param string $caption Label caption. * @return string */ - protected function add_label( $p_str_setting_name, $p_str_caption ) { - if ( empty( $p_str_caption ) ) { + protected function add_label( $setting_name, $caption ) { + if ( empty( $caption ) ) { return ''; } @@ -418,34 +418,34 @@ abstract class MCI_Footnotes_Layout_Engine { * label is widely preferred best practice, mandatory per * [style guides](https://softwareengineering.stackexchange.com/questions/234546/colons-in-internationalized-ui). */ - return sprintf( '', $p_str_setting_name, $p_str_caption ); + return sprintf( '', $setting_name, $caption ); } /** * Returns the html tag for an input [type = text]. * * @since 1.5.0 - * @param string $p_str_setting_name Name of the Settings key to pre load the input field. - * @param int $p_str_max_length Maximum length of the input, default 999 characters. - * @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 Name of the Settings key to pre load the input field. + * @param int $max_length Maximum length of the input, default 999 characters. + * @param bool $readonly Set the input to be read only, default false. + * @param bool $hidden Set the input to be hidden, default false. * @return string */ - protected function add_text_box( $p_str_setting_name, $p_str_max_length = 999, $p_bool_readonly = false, $p_bool_hidden = false ) { - $l_str_style = ''; + protected function add_text_box( $setting_name, $max_length = 999, $readonly = false, $hidden = false ) { + $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,17 +453,17 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns the html tag for an input [type = checkbox]. * * @since 1.5.0 - * @param string $p_str_setting_name Name of the Settings key to pre load the input field. + * @param string $setting_name Name of the Settings key to pre load the input field. * @return string */ - protected function add_checkbox( $p_str_setting_name ) { + protected function add_checkbox( $setting_name ) { // 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'], - MCI_Footnotes_Convert::to_bool( $l_arr_data['value'] ) ? 'checked="checked"' : '' + $data['name'], + $data['id'], + Footnotes_Convert::to_bool( $data['value'] ) ? 'checked="checked"' : '' ); } @@ -477,33 +477,33 @@ abstract class MCI_Footnotes_Layout_Engine { * @reporter @lolzim * * @since 2.5.13 - * @param string $p_str_setting_name Name of the Settings key to pre select the current value. - * @param array $p_arr_options Possible options to be selected. + * @param string $setting_name Name of the Settings key to pre select the current value. + * @param array $options Possible options to be selected. * @return string * * @since 2.5.15 Bugfix: Dashboard: General settings: Footnote start and end short codes: debug select box for shortcodes with pointy brackets. * @since 2.6.1 Restore esc_attr() in load_setting(), remove htmlspecialchars() here. */ - protected function add_select_box( $p_str_setting_name, $p_arr_options ) { + protected function add_select_box( $setting_name, $options ) { // 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 ); + $select_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 ) { + $select_options .= sprintf( '', - $l_str_value, + $value, // Only check for equality, not identity, WRT backlink symbol arrows. - $l_str_value == $l_arr_data['value'] ? 'selected' : '', - $l_str_caption + $value == $data['value'] ? 'selected' : '', + $caption ); } return sprintf( '', - $l_arr_data['name'], - $l_arr_data['id'], - $l_str_options + $data['name'], + $data['id'], + $select_options ); } @@ -511,17 +511,17 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns the html tag for a text area. * * @since 1.5.0 - * @param string $p_str_setting_name Name of the Settings key to pre fill the text area. + * @param string $setting_name Name of the Settings key to pre fill the text area. * @return string */ - protected function add_textarea( $p_str_setting_name ) { + protected function add_textarea( $setting_name ) { // 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,17 +529,17 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns the html tag for an input [type = text] with color selection class. * * @since 1.5.6 - * @param string $p_str_setting_name Name of the Settings key to pre load the input field. + * @param string $setting_name Name of the Settings key to pre load the input field. * @return string */ - protected function add_color_selection( $p_str_setting_name ) { + protected function add_color_selection( $setting_name ) { // 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'] ); } @@ -547,37 +547,37 @@ abstract class MCI_Footnotes_Layout_Engine { * Returns the html tag for an input [type = num]. * * @since 1.5.0 - * @param string $p_str_setting_name Name of the Settings key to pre load the input field. + * @param string $setting_name Name of the Settings key to pre load the input field. * @param int $p_in_min Minimum value. - * @param int $p_int_max Maximum value. - * @param bool $p_bool_deci true if 0.1 steps and floating to string, false if integer (default). + * @param int $max Maximum value. + * @param bool $deci true if 0.1 steps and floating to string, false if integer (default). * @return string * * Edited: * @since 2.1.4 step argument and number_format() to allow decimals .. */ - protected function add_num_box( $p_str_setting_name, $p_in_min, $p_int_max, $p_bool_deci = false ) { + protected function add_num_box( $setting_name, $p_in_min, $max, $deci = false ) { // 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 ); } else { 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/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index 419e1c8..101054e 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -45,7 +45,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { +class Footnotes_Layout_Settings extends Footnotes_Layout_Engine { /** * Returns a Priority index. Lower numbers have a higher Priority. @@ -64,7 +64,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { * @return string */ protected function get_sub_page_slug() { - return '-' . MCI_Footnotes_Config::C_STR_PLUGIN_NAME; + return '-' . Footnotes_Config::PLUGIN_NAME; } /** @@ -74,7 +74,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { * @return string */ protected function get_sub_page_title() { - return MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME; + return Footnotes_Config::PLUGIN_PUBLIC_NAME; } /** @@ -90,19 +90,19 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { * @since 2.1.6 removed if statement around expert tab */ protected function get_sections() { - $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' ), null, 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' ), null, false ); - return $l_arr_tabs; + return $tabs; } /** @@ -127,42 +127,42 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { * @since 2.1.6 / 2.2.0 tabs reordered and renamed */ protected function get_meta_boxes() { - $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', MCI_Footnotes_Config::C_STR_PLUGIN_HEADING_NAME . ' ' . MCI_Footnotes_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_Config::PLUGIN_HEADING_NAME . ' ' . Footnotes_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 ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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 ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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; } /** @@ -174,22 +174,22 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function amp_compat() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-amp' ); + $template = new Footnotes_Template( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ), - 'amp' => $this->add_checkbox( MCI_Footnotes_Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ), + 'label-amp' => $this->add_label( Footnotes_Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ), + 'amp' => $this->add_checkbox( Footnotes_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' ), '' . MCI_Footnotes_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_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 } @@ -206,7 +206,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function reference_container() { // Options for the label element. - $l_arr_label_element = array( + $label_element = array( 'p' => __( 'paragraph', 'footnotes' ), 'h2' => __( 'heading 2', 'footnotes' ), 'h3' => __( 'heading 3', 'footnotes' ), @@ -215,20 +215,20 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_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' ), @@ -238,14 +238,14 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { // The Unicode name of RIGHT PARENTHESIS was originally more accurate because. // 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' ), @@ -253,120 +253,120 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-reference-container' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'settings-reference-container' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-name' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __( 'Heading:', 'footnotes' ) ), - 'name' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME ), + 'label-name' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_NAME, __( 'Heading:', 'footnotes' ) ), + 'name' => $this->add_text_box( Footnotes_Settings::REFERENCE_CONTAINER_NAME ), - 'label-element' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading\'s HTML element:', 'footnotes' ) ), - 'element' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, $l_arr_label_element ), + 'label-element' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading\'s HTML element:', 'footnotes' ) ), + 'element' => $this->add_select_box( Footnotes_Settings::REFERENCE_CONTAINER_LABEL_ELEMENT, $label_element ), - 'label-border' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __( 'Border under the heading:', 'footnotes' ) ), - 'border' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $l_arr_enabled ), + 'label-border' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __( 'Border under the heading:', 'footnotes' ) ), + 'border' => $this->add_select_box( Footnotes_Settings::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $enabled ), - 'label-collapse' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, __( 'Collapse by default:', 'footnotes' ) ), - 'collapse' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, $l_arr_enabled ), + 'label-collapse' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_COLLAPSE, __( 'Collapse by default:', 'footnotes' ) ), + 'collapse' => $this->add_select_box( Footnotes_Settings::REFERENCE_CONTAINER_COLLAPSE, $enabled ), - 'label-script' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __( 'Script mode:', 'footnotes' ) ), - 'script' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, $l_arr_script_mode ), + 'label-script' => $this->add_label( Footnotes_Settings::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __( 'Script mode:', 'footnotes' ) ), + 'script' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ), - 'position' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_positions ), + 'label-position' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ), + 'position' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ), - 'shortcode' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE ), + 'label-shortcode' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ), + 'shortcode' => $this->add_text_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ), - 'section' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ), + 'label-section' => $this->add_label( Footnotes_Settings::FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ), + 'section' => $this->add_text_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ), - 'startpage' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_enabled ), + 'label-startpage' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ), + 'startpage' => $this->add_select_box( Footnotes_Settings::REFERENCE_CONTAINER_START_PAGE_ENABLE, $enabled ), - 'label-margin-top' => $this->add_label( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, __( 'Top margin:', 'footnotes' ) ), - 'margin-top' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, -500, 500 ), + 'label-margin-top' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_TOP_MARGIN, __( 'Top margin:', 'footnotes' ) ), + 'margin-top' => $this->add_num_box( Footnotes_Settings::REFERENCE_CONTAINER_TOP_MARGIN, -500, 500 ), 'notice-margin-top' => __( 'pixels; may be negative', 'footnotes' ), - 'label-margin-bottom' => $this->add_label( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, __( 'Bottom margin:', 'footnotes' ) ), - 'margin-bottom' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500 ), + 'label-margin-bottom' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_BOTTOM_MARGIN, __( 'Bottom margin:', 'footnotes' ) ), + 'margin-bottom' => $this->add_num_box( Footnotes_Settings::REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500 ), 'notice-margin-bottom' => __( 'pixels; may be negative', 'footnotes' ), - 'label-page-layout' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __( 'Apply basic responsive page layout:', 'footnotes' ) ), - 'page-layout' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_page_layout_options ), + 'label-page-layout' => $this->add_label( Footnotes_Settings::FOOTNOTES_PAGE_LAYOUT_SUPPORT, __( 'Apply basic responsive page layout:', 'footnotes' ) ), + 'page-layout' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, __( 'Allow URLs to line-wrap anywhere:', 'footnotes' ) ), - 'url-wrap' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_enabled ), + 'label-url-wrap' => $this->add_label( Footnotes_Settings::FOOTNOTE_URL_WRAP_ENABLED, __( 'Allow URLs to line-wrap anywhere:', 'footnotes' ) ), + 'url-wrap' => $this->add_select_box( Footnotes_Settings::FOOTNOTE_URL_WRAP_ENABLED, $enabled ), 'notice-url-wrap' => __( 'Unicode-conformant browsers don\'t need this fix.', 'footnotes' ), - 'label-symbol' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __( 'Display a backlink symbol:', 'footnotes' ) ), - 'symbol-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_enabled ), + 'label-symbol' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __( 'Display a backlink symbol:', 'footnotes' ) ), + 'symbol-enable' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __( 'Symbol appended, not prepended:', 'footnotes' ) ), - 'switch' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_enabled ), + 'label-switch' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __( 'Symbol appended, not prepended:', 'footnotes' ) ), + 'switch' => $this->add_select_box( Footnotes_Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $enabled ), - 'label-3column' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __( 'Backlink symbol in an extra column:', 'footnotes' ) ), - '3column' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_enabled ), + 'label-3column' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __( 'Backlink symbol in an extra column:', 'footnotes' ) ), + '3column' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __( 'Borders around the table rows:', 'footnotes' ) ), - 'row-borders' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $l_arr_enabled ), + 'label-row-borders' => $this->add_label( Footnotes_Settings::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __( 'Borders around the table rows:', 'footnotes' ) ), + 'row-borders' => $this->add_select_box( Footnotes_Settings::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $enabled ), - 'label-separator' => $this->add_label( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, __( 'Add a separator when enumerating backlinks:', 'footnotes' ) ), - 'separator-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, $l_arr_enabled ), - 'separator-options' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION, $l_arr_separators ), - 'separator-custom' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM ), + 'label-separator' => $this->add_label( Footnotes_Settings::BACKLINKS_SEPARATOR_ENABLED, __( 'Add a separator when enumerating backlinks:', 'footnotes' ) ), + 'separator-enable' => $this->add_select_box( Footnotes_Settings::BACKLINKS_SEPARATOR_ENABLED, $enabled ), + 'separator-options' => $this->add_select_box( Footnotes_Settings::BACKLINKS_SEPARATOR_OPTION, $separators ), + 'separator-custom' => $this->add_text_box( Footnotes_Settings::BACKLINKS_SEPARATOR_CUSTOM ), 'notice-separator' => __( 'Your input overrides the selection.', 'footnotes' ), - 'label-terminator' => $this->add_label( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, __( 'Add a terminal punctuation to backlinks:', 'footnotes' ) ), - 'terminator-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, $l_arr_enabled ), - 'terminator-options' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION, $l_arr_terminators ), - 'terminator-custom' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM ), + 'label-terminator' => $this->add_label( Footnotes_Settings::BACKLINKS_TERMINATOR_ENABLED, __( 'Add a terminal punctuation to backlinks:', 'footnotes' ) ), + 'terminator-enable' => $this->add_select_box( Footnotes_Settings::BACKLINKS_TERMINATOR_ENABLED, $enabled ), + 'terminator-options' => $this->add_select_box( Footnotes_Settings::BACKLINKS_TERMINATOR_OPTION, $terminators ), + 'terminator-custom' => $this->add_text_box( Footnotes_Settings::BACKLINKS_TERMINATOR_CUSTOM ), 'notice-terminator' => __( 'Your input overrides the selection.', 'footnotes' ), - 'label-width' => $this->add_label( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, __( 'Set backlinks column width:', 'footnotes' ) ), - 'width-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_enabled ), - 'width-scalar' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true ), - 'width-unit' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_width_units ), + 'label-width' => $this->add_label( Footnotes_Settings::BACKLINKS_COLUMN_WIDTH_ENABLED, __( 'Set backlinks column width:', 'footnotes' ) ), + 'width-enable' => $this->add_select_box( Footnotes_Settings::BACKLINKS_COLUMN_WIDTH_ENABLED, $enabled ), + 'width-scalar' => $this->add_num_box( Footnotes_Settings::BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true ), + 'width-unit' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __( 'Set backlinks column maximum width:', 'footnotes' ) ), - 'max-width-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_enabled ), - 'max-width-scalar' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true ), - 'max-width-unit' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_width_units ), + 'label-max-width' => $this->add_label( Footnotes_Settings::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __( 'Set backlinks column maximum width:', 'footnotes' ) ), + 'max-width-enable' => $this->add_select_box( Footnotes_Settings::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $enabled ), + 'max-width-scalar' => $this->add_num_box( Footnotes_Settings::BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true ), + 'max-width-unit' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, __( 'Stack backlinks when enumerating:', 'footnotes' ) ), - 'line-break' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_enabled ), + 'label-line-break' => $this->add_label( Footnotes_Settings::BACKLINKS_LINE_BREAKS_ENABLED, __( 'Stack backlinks when enumerating:', 'footnotes' ) ), + 'line-break' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), - 'link' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, $l_arr_enabled ), + 'label-link' => $this->add_label( Footnotes_Settings::LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), + 'link' => $this->add_select_box( Footnotes_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 } @@ -388,7 +388,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function start_end() { // Footnotes start tag short code options. - $l_arr_shortcode_start = array( + $shortcode_start = array( '((' => '((', '(((' => '(((', '{{' => '{{', @@ -402,7 +402,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { 'userdefined' => __( 'custom short code', 'footnotes' ), ); // Footnotes end tag short code options. - $l_arr_shortcode_end = array( + $shortcode_end = array( '))' => '))', ')))' => ')))', '}}' => '}}', @@ -416,37 +416,37 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-start-end' ); + $template = new Footnotes_Template( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ), - 'short-code-start' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ), - 'short-code-start-user' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ), + 'label-short-code-start' => $this->add_label( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ), + 'short-code-start' => $this->add_select_box( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START, $shortcode_start ), + 'short-code-start-user' => $this->add_text_box( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ), - 'label-short-code-end' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __( 'Footnote end tag short code:', 'footnotes' ) ), - 'short-code-end' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_shortcode_end ), - 'short-code-end-user' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ), + 'label-short-code-end' => $this->add_label( Footnotes_Settings::FOOTNOTES_SHORT_CODE_END, __( 'Footnote end tag short code:', 'footnotes' ) ), + 'short-code-end' => $this->add_select_box( Footnotes_Settings::FOOTNOTES_SHORT_CODE_END, $shortcode_end ), + 'short-code-end-user' => $this->add_text_box( Footnotes_Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ), // For script showing/hiding user defined text boxes. - 'short-code-start-id' => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, - 'short-code-end-id' => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, - 'short-code-start-user-id' => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, - 'short-code-end-user-id' => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, + 'short-code-start-id' => Footnotes_Settings::FOOTNOTES_SHORT_CODE_START, + 'short-code-end-id' => Footnotes_Settings::FOOTNOTES_SHORT_CODE_END, + 'short-code-start-user-id' => Footnotes_Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED, + 'short-code-end-user-id' => Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __( 'Check for balanced shortcodes:', 'footnotes' ) ), - 'syntax' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_enable ), + 'label-syntax' => $this->add_label( Footnotes_Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __( 'Check for balanced shortcodes:', 'footnotes' ) ), + 'syntax' => $this->add_select_box( Footnotes_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' ), @@ -454,7 +454,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -465,33 +465,33 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function numbering() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-numbering' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'settings-numbering' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-counter-style' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __( 'Numbering style:', 'footnotes' ) ), - 'counter-style' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_counter_style ), + 'label-counter-style' => $this->add_label( Footnotes_Settings::FOOTNOTES_COUNTER_STYLE, __( 'Numbering style:', 'footnotes' ) ), + 'counter-style' => $this->add_select_box( Footnotes_Settings::FOOTNOTES_COUNTER_STYLE, $counter_style ), // Algorithmically combine identicals. - 'label-identical' => $this->add_label( MCI_Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, __( 'Combine identical footnotes:', 'footnotes' ) ), - 'identical' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_enable ), + 'label-identical' => $this->add_label( Footnotes_Settings::COMBINE_IDENTICAL_FOOTNOTES, __( 'Combine identical footnotes:', 'footnotes' ) ), + 'identical' => $this->add_select_box( Footnotes_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' ), @@ -499,7 +499,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -511,51 +511,51 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function scrolling() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-scrolling' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'settings-scrolling' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-scroll-css' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ), - 'scroll-css' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, $l_arr_enable ), + 'label-scroll-css' => $this->add_label( Footnotes_Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ), + 'scroll-css' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ), - 'scroll-offset' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100 ), + 'label-scroll-offset' => $this->add_label( Footnotes_Settings::FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ), + 'scroll-offset' => $this->add_num_box( Footnotes_Settings::FOOTNOTES_SCROLL_OFFSET, 0, 100 ), 'notice-scroll-offset' => __( 'per cent viewport height from the upper edge', 'footnotes' ), - 'label-scroll-duration' => $this->add_label( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ), - 'scroll-duration' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000 ), + 'label-scroll-duration' => $this->add_label( Footnotes_Settings::FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ), + 'scroll-duration' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ), - 'scroll-asymmetricity' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $l_arr_enable ), + 'label-scroll-asymmetricity' => $this->add_label( Footnotes_Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ), + 'scroll-asymmetricity' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ), - 'scroll-down-duration' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ), + 'label-scroll-down-duration' => $this->add_label( Footnotes_Settings::FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ), + 'scroll-down-duration' => $this->add_num_box( Footnotes_Settings::FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ), 'notice-scroll-down-duration' => __( 'milliseconds', 'footnotes' ), - 'label-scroll-down-delay' => $this->add_label( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ), - 'scroll-down-delay' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ), + 'label-scroll-down-delay' => $this->add_label( Footnotes_Settings::FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ), + 'scroll-down-delay' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ), - 'scroll-up-delay' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ), + 'label-scroll-up-delay' => $this->add_label( Footnotes_Settings::FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ), + 'scroll-up-delay' => $this->add_num_box( Footnotes_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 } @@ -568,47 +568,47 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function hard_links() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-hard-links' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'settings-hard-links' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-hard-links' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, __( 'Enable hard links:', 'footnotes' ) ), - 'hard-links' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, $l_arr_enable ), + 'label-hard-links' => $this->add_label( Footnotes_Settings::FOOTNOTES_HARD_LINKS_ENABLE, __( 'Enable hard links:', 'footnotes' ) ), + 'hard-links' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnotes:', 'footnotes' ) ), - 'footnote' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG ), + 'label-footnote' => $this->add_label( Footnotes_Settings::FOOTNOTE_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnotes:', 'footnotes' ) ), + 'footnote' => $this->add_text_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnote referrers:', 'footnotes' ) ), - 'referrer' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG ), + 'label-referrer' => $this->add_label( Footnotes_Settings::REFERRER_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnote referrers:', 'footnotes' ) ), + 'referrer' => $this->add_text_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR, __( 'ID separator:', 'footnotes' ) ), - 'separator' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR ), + 'label-separator' => $this->add_label( Footnotes_Settings::HARD_LINK_IDS_SEPARATOR, __( 'ID separator:', 'footnotes' ) ), + 'separator' => $this->add_text_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ), - 'backlink-tooltips' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_enable ), + 'label-backlink-tooltips' => $this->add_label( Footnotes_Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ), + 'backlink-tooltips' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ), - 'backlink-tooltip-text' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ), + 'label-backlink-tooltip-text' => $this->add_label( Footnotes_Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ), + 'backlink-tooltip-text' => $this->add_text_box( Footnotes_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 } @@ -623,42 +623,42 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function love() { // Options for the acknowledgment display in the footer. - $l_arr_love = array( + $love = array( // Logo only. - 'text-3' => sprintf( '%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-3' => sprintf( '%s', Footnotes_Config::PLUGIN_PUBLIC_NAME ), // Logo followed by heart symbol. - 'text-4' => sprintf( '%s %s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL ), + 'text-4' => sprintf( '%s %s', Footnotes_Config::PLUGIN_PUBLIC_NAME, Footnotes_Config::LOVE_SYMBOL ), // Logo preceded by heart symbol. - 'text-5' => sprintf( '%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-5' => sprintf( '%s %s', Footnotes_Config::LOVE_SYMBOL, Footnotes_Config::PLUGIN_PUBLIC_NAME ), // Translators: 2: heart symbol 1: footnotes logogram. - 'text-1' => sprintf( __( 'I %2$s %1$s', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL ), + 'text-1' => sprintf( __( 'I %2$s %1$s', 'footnotes' ), Footnotes_Config::PLUGIN_PUBLIC_NAME, Footnotes_Config::LOVE_SYMBOL ), // Translators: %s: Footnotes plugin logo. - 'text-6' => sprintf( __( 'This website uses %s.', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-6' => sprintf( __( 'This website uses %s.', 'footnotes' ), Footnotes_Config::PLUGIN_PUBLIC_NAME ), // Translators: %s: Footnotes plugin logo. - 'text-7' => sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-7' => sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), Footnotes_Config::PLUGIN_PUBLIC_NAME ), // Translators: %s: Footnotes plugin logo. - 'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), + 'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), Footnotes_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' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL ), + 'no' => sprintf( __( 'no display of any "%1$s %2$s" mention in the footer', 'footnotes' ), Footnotes_Config::PLUGIN_PUBLIC_NAME, Footnotes_Config::LOVE_SYMBOL ), ); // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-love' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'settings-love' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( // Translators: %s: Footnotes plugin logo. - 'label-love' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ), - 'love' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_love ), + 'label-love' => $this->add_label( Footnotes_Settings::FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), Footnotes_Config::PLUGIN_PUBLIC_NAME ) ), + 'love' => $this->add_select_box( Footnotes_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' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ), - 'no-love' => $this->add_text( MCI_Footnotes_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_Config::PLUGIN_PUBLIC_NAME ) ), + 'no-love' => $this->add_text( Footnotes_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 } @@ -675,28 +675,28 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function excerpts() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'settings-excerpts' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'settings-excerpts' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-excerpts' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ), - 'excerpts' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, $l_arr_excerpt_mode ), + 'label-excerpts' => $this->add_label( Footnotes_Settings::FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ), + 'excerpts' => $this->add_select_box( Footnotes_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' ), '' . MCI_Footnotes_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_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 } @@ -711,41 +711,41 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function superscript() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'customize-superscript' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'customize-superscript' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-superscript' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __( 'Display footnote referrers in superscript:', 'footnotes' ) ), - 'superscript' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_enabled ), + 'label-superscript' => $this->add_label( Footnotes_Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __( 'Display footnote referrers in superscript:', 'footnotes' ) ), + 'superscript' => $this->add_select_box( Footnotes_Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $enabled ), - 'label-normalize' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ), - 'normalize' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $l_arr_normalize_superscript ), + 'label-normalize' => $this->add_label( Footnotes_Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ), + 'normalize' => $this->add_select_box( Footnotes_Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $normalize_superscript ), 'notice-normalize' => __( 'Most themes don\'t need this fix.', 'footnotes' ), - 'label-before' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ), - 'before' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE ), + 'label-before' => $this->add_label( Footnotes_Settings::FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ), + 'before' => $this->add_text_box( Footnotes_Settings::FOOTNOTES_STYLING_BEFORE ), - 'label-after' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __( 'At the end of the footnote referrers:', 'footnotes' ) ), - 'after' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER ), + 'label-after' => $this->add_label( Footnotes_Settings::FOOTNOTES_STYLING_AFTER, __( 'At the end of the footnote referrers:', 'footnotes' ) ), + 'after' => $this->add_text_box( Footnotes_Settings::FOOTNOTES_STYLING_AFTER ), - 'label-link' => $this->add_label( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), + 'label-link' => $this->add_label( Footnotes_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 } @@ -756,25 +756,25 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function label_solution() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'configure-label-solution' ); + $template = new Footnotes_Template( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ), - 'selection' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, $l_arr_issue_solutions ), + 'label-selection' => $this->add_label( Footnotes_Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ), + 'selection' => $this->add_select_box( Footnotes_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 } @@ -789,32 +789,32 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function mouseover_box() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-display' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'mouse-over-box-display' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-enable' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __( 'Display tooltips:', 'footnotes' ) ), - 'enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_enabled ), + 'label-enable' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __( 'Display tooltips:', 'footnotes' ) ), + 'enable' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __( 'Display alternative tooltips:', 'footnotes' ) ), - 'alternative' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_enabled ), + 'label-alternative' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __( 'Display alternative tooltips:', 'footnotes' ) ), + 'alternative' => $this->add_select_box( Footnotes_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' ), '' . MCI_Footnotes_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_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 } @@ -826,7 +826,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function mouseover_box_position() { // 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' ), @@ -837,7 +837,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_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' ), @@ -845,31 +845,31 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-position' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'mouse-over-box-position' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-position' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __( 'Position:', 'footnotes' ) ), - 'position' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_position ), - 'position-alternative' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $l_arr_alternative_position ), + 'label-position' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION, __( 'Position:', 'footnotes' ) ), + 'position' => $this->add_select_box( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION, $position ), + 'position-alternative' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __( 'Horizontal offset:', 'footnotes' ) ), - 'offset-x' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), - 'offset-x-alternative' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), + 'label-offset-x' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __( 'Horizontal offset:', 'footnotes' ) ), + 'offset-x' => $this->add_num_box( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), + 'offset-x-alternative' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __( 'Vertical offset:', 'footnotes' ) ), - 'offset-y' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), - 'offset-y-alternative' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), + 'label-offset-y' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __( 'Vertical offset:', 'footnotes' ) ), + 'offset-y' => $this->add_num_box( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), + 'offset-y-alternative' => $this->add_num_box( Footnotes_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 } @@ -881,21 +881,21 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function mouseover_box_dimensions() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-dimensions' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'mouse-over-box-dimensions' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-max-width' => $this->add_label( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __( 'Maximum width:', 'footnotes' ) ), - 'max-width' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280 ), - 'width' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280 ), + 'label-max-width' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __( 'Maximum width:', 'footnotes' ) ), + 'max-width' => $this->add_num_box( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280 ), + 'width' => $this->add_num_box( Footnotes_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 } @@ -907,32 +907,32 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function mouseover_box_timing() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-timing' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'mouse-over-box-timing' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-fade-in-delay' => $this->add_label( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, __( 'Fade-in delay:', 'footnotes' ) ), - 'fade-in-delay' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000 ), + 'label-fade-in-delay' => $this->add_label( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DELAY, __( 'Fade-in delay:', 'footnotes' ) ), + 'fade-in-delay' => $this->add_num_box( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000 ), 'notice-fade-in-delay' => __( 'milliseconds', 'footnotes' ), - 'label-fade-in-duration' => $this->add_label( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, __( 'Fade-in duration:', 'footnotes' ) ), - 'fade-in-duration' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000 ), + 'label-fade-in-duration' => $this->add_label( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DURATION, __( 'Fade-in duration:', 'footnotes' ) ), + 'fade-in-duration' => $this->add_num_box( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000 ), 'notice-fade-in-duration' => __( 'milliseconds', 'footnotes' ), - 'label-fade-out-delay' => $this->add_label( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, __( 'Fade-out delay:', 'footnotes' ) ), - 'fade-out-delay' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000 ), + 'label-fade-out-delay' => $this->add_label( Footnotes_Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY, __( 'Fade-out delay:', 'footnotes' ) ), + 'fade-out-delay' => $this->add_num_box( Footnotes_Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000 ), 'notice-fade-out-delay' => __( 'milliseconds', 'footnotes' ), - 'label-fade-out-duration' => $this->add_label( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, __( 'Fade-out duration:', 'footnotes' ) ), - 'fade-out-duration' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000 ), + 'label-fade-out-duration' => $this->add_label( Footnotes_Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION, __( 'Fade-out duration:', 'footnotes' ) ), + 'fade-out-duration' => $this->add_num_box( Footnotes_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 } @@ -943,33 +943,33 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function mouseover_box_truncation() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-truncation' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'mouse-over-box-truncation' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-truncation' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __( 'Truncate the note in the tooltip:', 'footnotes' ) ), - 'truncation' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_enabled ), + 'label-truncation' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __( 'Truncate the note in the tooltip:', 'footnotes' ) ), + 'truncation' => $this->add_select_box( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $enabled ), - 'label-max-length' => $this->add_label( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __( 'Maximum number of characters in the tooltip:', 'footnotes' ) ), - 'max-length' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000 ), + 'label-max-length' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __( 'Maximum number of characters in the tooltip:', 'footnotes' ) ), + 'max-length' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ), - 'readon' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ), + 'label-readon' => $this->add_label( Footnotes_Settings::FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ), + 'readon' => $this->add_text_box( Footnotes_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 } @@ -980,29 +980,29 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function mouseover_box_text() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-text' ); + $template = new Footnotes_Template( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __( 'Delimiter for dedicated tooltip text:', 'footnotes' ) ), - 'delimiter' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ), + 'label-delimiter' => $this->add_label( Footnotes_Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __( 'Delimiter for dedicated tooltip text:', 'footnotes' ) ), + 'delimiter' => $this->add_text_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __( 'Mirror the tooltip in the reference container:', 'footnotes' ) ), - 'mirror' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $l_arr_enabled ), + 'label-mirror' => $this->add_label( Footnotes_Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __( 'Mirror the tooltip in the reference container:', 'footnotes' ) ), + 'mirror' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __( 'Separator between tooltip text and footnote text:', 'footnotes' ) ), - 'separator' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ), + 'label-separator' => $this->add_label( Footnotes_Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __( 'Separator between tooltip text and footnote text:', 'footnotes' ) ), + 'separator' => $this->add_text_box( Footnotes_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' ), @@ -1011,7 +1011,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1022,12 +1022,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function mouseover_box_appearance() { // 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' ), @@ -1038,42 +1038,42 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-appearance' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'mouse-over-box-appearance' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-font-size' => $this->add_label( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __( 'Set font size:', 'footnotes' ) ), - 'font-size-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_enabled ), - 'font-size-scalar' => $this->add_num_box( MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true ), - 'font-size-unit' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_font_size_units ), + 'label-font-size' => $this->add_label( Footnotes_Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __( 'Set font size:', 'footnotes' ) ), + 'font-size-enable' => $this->add_select_box( Footnotes_Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $enabled ), + 'font-size-scalar' => $this->add_num_box( Footnotes_Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true ), + 'font-size-unit' => $this->add_select_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ), - 'color' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ), + 'label-color' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ), + 'color' => $this->add_color_selection( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ), - 'background' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ), + 'label-background' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ), + 'background' => $this->add_color_selection( Footnotes_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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ), - 'border-width' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ), + 'label-border-width' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ), + 'border-width' => $this->add_num_box( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ), 'notice-border-width' => __( 'pixels; 0 for borderless', 'footnotes' ), - 'label-border-color' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ), - 'border-color' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ), + 'label-border-color' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ), + 'border-color' => $this->add_color_selection( Footnotes_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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ), - 'border-radius' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500 ), + 'label-border-radius' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ), + 'border-radius' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ), - 'box-shadow-color' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ), + 'label-box-shadow-color' => $this->add_label( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ), + 'box-shadow-color' => $this->add_color_selection( Footnotes_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' ) ), @@ -1081,7 +1081,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1111,20 +1111,20 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function hyperlink_arrow() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'customize-hyperlink-arrow' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'customize-hyperlink-arrow' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-symbol' => $this->add_label( MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, __( 'Select or input the backlink symbol:', 'footnotes' ) ), - 'symbol-options' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, MCI_Footnotes_Convert::get_arrow() ), - 'symbol-custom' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED ), + 'label-symbol' => $this->add_label( Footnotes_Settings::HYPERLINK_ARROW, __( 'Select or input the backlink symbol:', 'footnotes' ) ), + 'symbol-options' => $this->add_select_box( Footnotes_Settings::HYPERLINK_ARROW, Footnotes_Convert::get_arrow() ), + 'symbol-custom' => $this->add_text_box( Footnotes_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 } @@ -1144,12 +1144,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function custom_css() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'customize-css' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'customize-css' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-css' => $this->add_label( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), - 'css' => $this->add_textarea( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS ), + 'label-css' => $this->add_label( Footnotes_Settings::CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), + 'css' => $this->add_textarea( Footnotes_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 @@ -1157,22 +1157,22 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { // Localized notices are dropped to ease translators' task. // "label-class-1" => ".footnote_plugin_tooltip_text",. - // "class-1" => $this->add_text(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),. + // "class-1" => $this->add_text(__("superscript, Footnotes index", Footnotes_Config::PLUGIN_NAME)),. // "label-class-2" => ".footnote_tooltip",. - // "class-2" => $this->add_text(__("mouse-over box, tooltip for each superscript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),. + // "class-2" => $this->add_text(__("mouse-over box, tooltip for each superscript", Footnotes_Config::PLUGIN_NAME)),. // "label-class-3" => ".footnote_plugin_index",. - // "class-3" => $this->add_text(__("1st column of the Reference Container, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),. + // "class-3" => $this->add_text(__("1st column of the Reference Container, Footnotes index", Footnotes_Config::PLUGIN_NAME)),. // "label-class-4" => ".footnote_plugin_text",. - // "class-4" => $this->add_text(__("2nd column of the Reference Container, Footnote text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)). + // "class-4" => $this->add_text(__("2nd column of the Reference Container, Footnote text", Footnotes_Config::PLUGIN_NAME)). // phpcs:enable ) ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1184,22 +1184,22 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function custom_css_migration() { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'customize-css-migration' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'customize-css-migration' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'label-css' => $this->add_label( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), - 'css' => $this->add_textarea( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS ), + 'label-css' => $this->add_label( Footnotes_Settings::CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), + 'css' => $this->add_textarea( Footnotes_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( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, 'Show legacy Custom CSS settings containers:' ), - 'show-legacy' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, $l_arr_enabled ), + 'label-show-legacy' => $this->add_label( Footnotes_Settings::CUSTOM_CSS_LEGACY_ENABLE, 'Show legacy Custom CSS settings containers:' ), + 'show-legacy' => $this->add_select_box( Footnotes_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' ) ), @@ -1208,7 +1208,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1219,11 +1219,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function custom_css_new() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'customize-css-new' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'customize-css-new' ); // Replace all placeholders. - $l_obj_template->replace( + $template->replace( array( - 'css' => $this->add_textarea( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_NEW ), + 'css' => $this->add_textarea( Footnotes_Settings::CUSTOM_CSS_NEW ), 'headline' => $this->add_text( __( 'Recommended CSS classes:', 'footnotes' ) ), @@ -1231,7 +1231,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { ); // Display template with replaced placeholders. // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -1255,10 +1255,10 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function lookup_hooks() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'expert-lookup' ); + $template = new Footnotes_Template( Footnotes_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. @@ -1272,35 +1272,35 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { 'head-numbox' => __( 'Priority level', 'footnotes' ), 'head-url' => __( 'WordPress documentation', 'footnotes' ), - 'label-the-title' => $this->add_label( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_TITLE, 'the_title' ), - 'the-title' => $this->add_checkbox( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ), - 'priority-the-title' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-the-title' => $this->add_label( Footnotes_Settings::EXPERT_LOOKUP_THE_TITLE, 'the_title' ), + 'the-title' => $this->add_checkbox( Footnotes_Settings::EXPERT_LOOKUP_THE_TITLE ), + 'priority-the-title' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT, 'the_content' ), - 'the-content' => $this->add_checkbox( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ), - 'priority-the-content' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-the-content' => $this->add_label( Footnotes_Settings::EXPERT_LOOKUP_THE_CONTENT, 'the_content' ), + 'the-content' => $this->add_checkbox( Footnotes_Settings::EXPERT_LOOKUP_THE_CONTENT ), + 'priority-the-content' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT, 'the_excerpt' ), - 'the-excerpt' => $this->add_checkbox( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ), - 'priority-the-excerpt' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-the-excerpt' => $this->add_label( Footnotes_Settings::EXPERT_LOOKUP_THE_EXCERPT, 'the_excerpt' ), + 'the-excerpt' => $this->add_checkbox( Footnotes_Settings::EXPERT_LOOKUP_THE_EXCERPT ), + 'priority-the-excerpt' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE, 'widget_title' ), - 'widget-title' => $this->add_checkbox( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ), - 'priority-widget-title' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-widget-title' => $this->add_label( Footnotes_Settings::EXPERT_LOOKUP_WIDGET_TITLE, 'widget_title' ), + 'widget-title' => $this->add_checkbox( Footnotes_Settings::EXPERT_LOOKUP_WIDGET_TITLE ), + 'priority-widget-title' => $this->add_num_box( Footnotes_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( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT, 'widget_text' ), - 'widget-text' => $this->add_checkbox( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ), - 'priority-widget-text' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), + 'label-widget-text' => $this->add_label( Footnotes_Settings::EXPERT_LOOKUP_WIDGET_TEXT, 'widget_text' ), + 'widget-text' => $this->add_checkbox( Footnotes_Settings::EXPERT_LOOKUP_WIDGET_TEXT ), + 'priority-widget-text' => $this->add_num_box( Footnotes_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 } @@ -1315,15 +1315,15 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { public function Help() { global $g_obj_mci_footnotes; // Load footnotes starting and end tag. - $l_arr_footnote_starting_tag = $this->load_setting( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); - $l_arr_footnote_ending_tag = $this->load_setting( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); + $footnote_starting_tag = $this->load_setting( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START ); + $footnote_ending_tag = $this->load_setting( Footnotes_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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $l_arr_footnote_ending_tag = $this->load_setting( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $footnote_starting_tag = $this->load_setting( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $footnote_ending_tag = $this->load_setting( Footnotes_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 ' . @@ -1336,20 +1336,20 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'how-to-help' ); + $template = new Footnotes_Template( Footnotes_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' => $g_obj_mci_footnotes->a_obj_task->exec( $l_str_example, true ), + 'example' => $g_obj_mci_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' ), '', '' ), ) @@ -1369,11 +1369,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { * When this callback function was renamed, this call went unnoticed. * @see class/task.php */ - $g_obj_mci_footnotes->a_obj_task->footnotes_output_head(); + $g_obj_mci_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 } @@ -1384,16 +1384,16 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine { */ public function donate() { // Load template file. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'how-to-donate' ); + $template = new Footnotes_Template( Footnotes_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/class/init.php b/class/init.php index 896dbc6..ce236c3 100644 --- a/class/init.php +++ b/class/init.php @@ -13,7 +13,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes { +class Footnotes { /** * The Plugin task. @@ -21,7 +21,7 @@ class MCI_Footnotes { * @since 1.5.0 * @var Task $task The Plugin task. */ - public $a_obj_task = null; + public $task = null; /** * Flag for using tooltips. @@ -30,7 +30,7 @@ class MCI_Footnotes { * * @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. @@ -46,7 +46,7 @@ class MCI_Footnotes { * @contributor Patrizia Lutz @misfist * @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. @@ -68,7 +68,7 @@ class MCI_Footnotes { * * @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. @@ -86,7 +86,7 @@ class MCI_Footnotes { * @var str 'js' Plain JavaScript. * 'jquery' Use jQuery libraries. */ - public static $a_str_script_mode = 'js'; + public static $script_mode = 'js'; /** * Executes the Plugin. @@ -105,9 +105,9 @@ class MCI_Footnotes { */ public function run() { // Register language. - MCI_Footnotes_Language::register_hooks(); + Footnotes_Language::register_hooks(); // Register Button hooks. - MCI_Footnotes_WYSIWYG::register_hooks(); + Footnotes_WYSIWYG::register_hooks(); // Register general hooks. Hooks::register_hooks(); @@ -153,7 +153,7 @@ class MCI_Footnotes { * Also, the visibility of initialize_widgets() is not private any longer. */ public function initialize_widgets() { - register_widget( 'MCI_Footnotes_Widget_Reference_container' ); + register_widget( 'Footnotes_Widget_Reference_container' ); } /** @@ -162,7 +162,7 @@ class MCI_Footnotes { * @since 1.5.0 */ private function initialize_dashboard() { - new MCI_Footnotes_Layout_Init(); + new Footnotes_Layout_Init(); } /** @@ -171,8 +171,8 @@ class MCI_Footnotes { * @since 1.5.0 */ private function initialize_task() { - $this->a_obj_task = new MCI_Footnotes_Task(); - $this->a_obj_task->register_hooks(); + $this->task = new Footnotes_Task(); + $this->task->register_hooks(); } /** @@ -200,10 +200,10 @@ class MCI_Footnotes { * The condition about tooltips was missing, only the not-alternative-tooltips part was present. */ // Set conditions re-used for stylesheet enqueuing and in class/task.php. - self::$a_bool_amp_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) ); - self::$a_bool_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); - self::$a_bool_alternative_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); - self::$a_str_script_mode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); + self::$amp_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) ); + self::$tooltips_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); + self::$alternative_tooltips_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); + self::$script_mode = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); /** * Enqueues the jQuery library registered by WordPress. @@ -220,15 +220,15 @@ class MCI_Footnotes { * 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. @@ -329,58 +329,58 @@ class MCI_Footnotes { * Plugin version number is needed for busting browser caches after each plugin update. * * @since 2.1.4 automate passing version number for cache busting. - * The constant C_STR_FOOTNOTES_VERSION is defined at start of footnotes.php. + * The constant FOOTNOTES_VERSION is defined at start of footnotes.php. * * The media scope argument 'all' is the default. * No need to use '-css' in the handle, as this is appended automatically. */ // 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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT ); - switch ( $l_str_page_layout_option ) { + $page_layout_option = Footnotes_Settings::instance()->get( Footnotes_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( - 'mci-footnotes-' . $l_str_tooltip_mode_long . '-pagelayout-' . $l_str_page_layout_option, + 'mci-footnotes-' . $tooltip_mode_long . '-pagelayout-' . $page_layout_option, plugins_url( - MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'brpl' . $l_str_layout_mode . '.min.css' + Footnotes_Config::PLUGIN_NAME . '/css/footnotes-' . $tooltip_mode_short . 'brpl' . $layout_mode . '.min.css' ), array(), - C_STR_FOOTNOTES_VERSION, + FOOTNOTES_VERSION, 'all' ); @@ -395,7 +395,7 @@ class MCI_Footnotes { */ wp_enqueue_style( 'mci-footnotes-common', - plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-common.css' ), + plugins_url( Footnotes_Config::PLUGIN_NAME . '/css/dev-common.css' ), array(), filemtime( plugin_dir_path( @@ -405,7 +405,7 @@ class MCI_Footnotes { ); wp_enqueue_style( 'mci-footnotes-tooltips', - plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), + plugins_url( Footnotes_Config::PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), filemtime( plugin_dir_path( @@ -414,10 +414,10 @@ class MCI_Footnotes { ) ); - if ( self::$a_bool_amp_enabled ) { + if ( self::$amp_enabled ) { wp_enqueue_style( 'mci-footnotes-amp', - plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-amp-tooltips.css' ), + plugins_url( Footnotes_Config::PLUGIN_NAME . '/css/dev-amp-tooltips.css' ), array(), filemtime( plugin_dir_path( @@ -427,10 +427,10 @@ class MCI_Footnotes { ); } - if ( self::$a_bool_alternative_tooltips_enabled ) { + if ( self::$alternative_tooltips_enabled ) { wp_enqueue_style( 'mci-footnotes-alternative', - plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), + plugins_url( Footnotes_Config::PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), filemtime( plugin_dir_path( @@ -440,18 +440,18 @@ class MCI_Footnotes { ); } - $l_str_page_layout_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT ); - if ( 'none' !== $l_str_page_layout_option ) { + $page_layout_option = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_PAGE_LAYOUT_SUPPORT ); + if ( 'none' !== $page_layout_option ) { wp_enqueue_style( - 'mci-footnotes-layout-' . $l_str_page_layout_option, + 'mci-footnotes-layout-' . $page_layout_option, plugins_url( - MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_page_layout_option . '.css' + Footnotes_Config::PLUGIN_NAME . '/css/dev-layout-' . $page_layout_option . '.css' ), array(), filemtime( plugin_dir_path( dirname( __FILE__, 1 ) - ) . 'css/dev-layout-' . $l_str_page_layout_option . '.css' + ) . 'css/dev-layout-' . $page_layout_option . '.css' ), 'all' ); diff --git a/class/language.php b/class/language.php index d7064da..8b52ad0 100644 --- a/class/language.php +++ b/class/language.php @@ -15,7 +15,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Language { +class Footnotes_Language { /** * Register WordPress Hook. @@ -23,7 +23,7 @@ class MCI_Footnotes_Language { * @since 1.5.0 */ public static function register_hooks() { - add_action( 'plugins_loaded', array( 'MCI_Footnotes_Language', 'load_text_domain' ) ); + add_action( 'plugins_loaded', array( 'Footnotes_Language', 'load_text_domain' ) ); } /** @@ -72,7 +72,7 @@ class MCI_Footnotes_Language { * Loads a specific text domain. * * @since 1.5.1 - * @param string $p_str_language_code Language Code to load a specific text domain. + * @param string $language_code Language Code to load a specific text domain. * @return bool * * @@ -87,11 +87,11 @@ class MCI_Footnotes_Language { * “The .mo file should be named based on the text domain with a dash, and then the locale exactly.” * @see wp-includes/l10n.php:857 */ - private static function load( $p_str_language_code ) { + private static function load( $language_code ) { return load_plugin_textdomain( - MCI_Footnotes_Config::C_STR_PLUGIN_NAME, + Footnotes_Config::PLUGIN_NAME, false, - MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages' + Footnotes_Config::PLUGIN_NAME . '/languages' ); } } diff --git a/class/settings.php b/class/settings.php index a54ff03..2c8da3e 100644 --- a/class/settings.php +++ b/class/settings.php @@ -18,7 +18,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Settings { +class Footnotes_Settings { /** * Settings container key for the label of the reference container. @@ -26,7 +26,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -34,9 +34,9 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str * The string is converted to Boolean false if 'no', true if 'yes'. - * @see MCI_Footnotes_Convert::to_bool() + * @see Footnotes_Convert::to_bool() */ - 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. @@ -44,7 +44,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -52,7 +52,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -60,7 +60,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -68,7 +68,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -76,7 +76,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -84,7 +84,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -92,7 +92,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -107,7 +107,7 @@ class MCI_Footnotes_Settings { * @since 2.0.4 * @var str */ - 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. @@ -115,7 +115,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -130,10 +130,10 @@ class MCI_Footnotes_Settings { * @link https://github.com/markcheret/footnotes/issues/65 * * @since 2.7.0 - * @see C_STR_EXPERT_LOOKUP_THE_EXCERPT + * @see EXPERT_LOOKUP_THE_EXCERPT * @var str Default 'manual'. */ - 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. @@ -148,7 +148,7 @@ class MCI_Footnotes_Settings { * - for better UX thanks to a more button-like appearance; * - for stylistic consistency with the expand-collapse button. */ - 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. @@ -156,7 +156,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - 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. @@ -166,7 +166,7 @@ class MCI_Footnotes_Settings { * * @since 1.3.0 Adding: new settings tab for custom CSS settings. */ - 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. @@ -174,7 +174,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var str */ - const C_STR_FOOTNOTES_LOVE = 'footnote_inputfield_love'; + const FOOTNOTES_LOVE = 'footnote_inputfield_love'; /** * Settings container key to enable the mouse-over box. @@ -182,7 +182,7 @@ class MCI_Footnotes_Settings { * @since 1.5.2 * @var str */ - 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. @@ -194,7 +194,7 @@ class MCI_Footnotes_Settings { * to raise awareness of the functionality and to prevent the screen * from being filled at mouse-over, and to allow the Continue reading. */ - 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 the enabled excerpt. @@ -204,7 +204,7 @@ class MCI_Footnotes_Settings { * * @since 2.0.7 Increase default truncation length from 150 to 200 chars. */ - 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. @@ -223,7 +223,7 @@ class MCI_Footnotes_Settings { * uses the title string in menus and in the title element, but * Footnotes doesn’t delete footnotes therein. */ - 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. @@ -231,7 +231,7 @@ class MCI_Footnotes_Settings { * @since 1.5.5 * @var str */ - 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. @@ -255,10 +255,10 @@ class MCI_Footnotes_Settings { * @link https://wordpress.org/support/topic/update-crashed-my-website-3/#post-14260969 * * @since 2.6.5 - * @see C_STR_FOOTNOTES_IN_EXCERPT + * @see FOOTNOTES_IN_EXCERPT * @var str */ - 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. @@ -266,7 +266,7 @@ class MCI_Footnotes_Settings { * @since 1.5.5 * @var str */ - 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. @@ -279,7 +279,7 @@ class MCI_Footnotes_Settings { * it must be enabled if multiple reference containers are desired, as * in Elementor toggles. */ - 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,7 +292,7 @@ class MCI_Footnotes_Settings { * Since the removal of the the_post hook, the tab is no danger zone any longer. * All users, not experts only, need to be able to control relative positioning. */ - 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. @@ -305,10 +305,10 @@ class MCI_Footnotes_Settings { * @link https://wordpress.org/support/topic/tooltip-not-showing-on-dark-theme-with-white-text/ * * @since 2.6.1 - * @see C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND + * @see FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND * @var str */ - 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. @@ -330,10 +330,10 @@ class MCI_Footnotes_Settings { * But theme default background color doesn’t seem to exist. * @link https://wordpress.org/support/topic/problem-with-footnotes-in-excerpts-of-the-blog-page/#post-14241849 * @since 2.6.1 default #ffffff again along with #000000 as font color. - * @see C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR + * @see FOOTNOTES_MOUSE_OVER_BOX_COLOR * @var str */ - 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. @@ -341,7 +341,7 @@ class MCI_Footnotes_Settings { * @since 1.5.6 * @var int */ - 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. @@ -349,7 +349,7 @@ class MCI_Footnotes_Settings { * @since 1.5.6 * @var str */ - 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. @@ -359,7 +359,7 @@ class MCI_Footnotes_Settings { * * @since 2.0.7 The mouse over box corners mustn’t be rounded as that is outdated. */ - 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. @@ -370,7 +370,7 @@ class MCI_Footnotes_Settings { * @since 2.0.7 Set default width 450. * The width should be limited to start with, for the box to have shape. */ - 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. @@ -382,7 +382,7 @@ class MCI_Footnotes_Settings { * the box gets squeezed between note anchor at line end and window edge, * and top because reading at the bottom of the window is more likely. */ - 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 offset (x). @@ -390,7 +390,7 @@ class MCI_Footnotes_Settings { * @since 1.5.7 * @var int */ - 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 offset (y). @@ -401,7 +401,7 @@ class MCI_Footnotes_Settings { * The vertical offset must be negative for the box not to cover * The current line of text (web coordinates origin is top left). */ - 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. @@ -409,7 +409,7 @@ class MCI_Footnotes_Settings { * @since 1.5.8 * @var str */ - 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. @@ -422,7 +422,7 @@ class MCI_Footnotes_Settings { * @since 2.1.0 * @var str */ - 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. @@ -440,7 +440,7 @@ class MCI_Footnotes_Settings { * and onmouseout arguments, along with CSS transitions for fade-in/out. * The very small script is inserted after Footnotes’ internal stylesheet. */ - 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. @@ -453,7 +453,7 @@ class MCI_Footnotes_Settings { * @since 2.1.1 * @var str */ - 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. @@ -466,7 +466,7 @@ class MCI_Footnotes_Settings { * @since 2.1.1 * @var str */ - 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. @@ -479,7 +479,7 @@ class MCI_Footnotes_Settings { * @since 2.1.1 * @var str */ - 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. @@ -489,7 +489,7 @@ class MCI_Footnotes_Settings { * @since 2.1.1 * @var str */ - 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. @@ -502,7 +502,7 @@ class MCI_Footnotes_Settings { * @since 2.1.1 * @var str */ - 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. @@ -545,14 +545,14 @@ class MCI_Footnotes_Settings { * features added by other plugins, e.g. related post lists and social buttons. * * For YARPP to display related posts below the Footnotes reference container, - * priority needs to be at least 1200 (i.e. 0 =< $l_int_the_content_priority =< 1200). + * priority needs to be at least 1200 (i.e. 0 =< $the_content_priority =< 1200). * * PHP_INT_MAX cannot be reset by leaving the number box empty. because browsers * (WebKit) don’t allow it, so we must resort to -1. * @link https://github.com/Modernizr/Modernizr/issues/171 * @var int */ - 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. @@ -565,7 +565,7 @@ class MCI_Footnotes_Settings { * @since 2.1.2 * @var int */ - 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. @@ -573,7 +573,7 @@ class MCI_Footnotes_Settings { * @since 2.1.2 * @var int */ - 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. @@ -581,7 +581,7 @@ class MCI_Footnotes_Settings { * @since 2.1.2 * @var int */ - 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. @@ -589,7 +589,7 @@ class MCI_Footnotes_Settings { * @since 2.1.2 * @var int */ - 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. @@ -602,7 +602,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -618,7 +618,7 @@ class MCI_Footnotes_Settings { * Backlink separators and terminators are often not preferred. * But a choice must be provided along with the ability to customize. */ - 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. @@ -626,7 +626,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -634,7 +634,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -642,7 +642,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -650,7 +650,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -658,7 +658,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -666,7 +666,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -674,7 +674,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - 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. @@ -682,7 +682,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -690,7 +690,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -698,7 +698,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - 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. @@ -706,7 +706,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -715,7 +715,7 @@ class MCI_Footnotes_Settings { * @var str * 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. @@ -727,7 +727,7 @@ class MCI_Footnotes_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. @@ -735,7 +735,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var flo */ - 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. @@ -743,7 +743,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var str */ - 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. @@ -752,7 +752,7 @@ class MCI_Footnotes_Settings { * @var str * Whether to concatenate an additional stylesheet. */ - 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. @@ -762,7 +762,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - const C_INT_FOOTNOTES_SCROLL_OFFSET = 'footnotes_inputfield_scroll_offset'; + const FOOTNOTES_SCROLL_OFFSET = 'footnotes_inputfield_scroll_offset'; /** * Settings container key for scroll duration. @@ -772,7 +772,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - 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. @@ -780,7 +780,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - 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. @@ -788,7 +788,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - 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. @@ -796,7 +796,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - 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. @@ -804,7 +804,7 @@ class MCI_Footnotes_Settings { * @since 2.1.4 * @var int */ - 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. @@ -815,7 +815,7 @@ class MCI_Footnotes_Settings { * @since 2.1.6 * @var str */ - 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. @@ -828,7 +828,7 @@ class MCI_Footnotes_Settings { * @since 2.2.0 * @var str */ - 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. @@ -838,7 +838,7 @@ class MCI_Footnotes_Settings { * @since 2.2.2 * @var str */ - 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. @@ -853,7 +853,7 @@ class MCI_Footnotes_Settings { * The Boolean must be false if its setting is contained in the container to be hidden, * because when saving, all missing constants are emptied, and to_bool() converts empty to false. */ - 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. @@ -863,7 +863,7 @@ class MCI_Footnotes_Settings { * * Fixed width is for alternative tooltips, cannot reuse max-width nor offsets. */ - 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. @@ -871,7 +871,7 @@ class MCI_Footnotes_Settings { * @since 2.2.5 * @var int */ - 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. @@ -879,7 +879,7 @@ class MCI_Footnotes_Settings { * @since 2.2.5 * @var int */ - 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. @@ -887,7 +887,7 @@ class MCI_Footnotes_Settings { * @since 2.2.5 * @var int */ - 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'; /** @@ -901,7 +901,7 @@ class MCI_Footnotes_Settings { * @since 2.2.5 * @var str */ - 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. @@ -914,7 +914,7 @@ class MCI_Footnotes_Settings { * @since 2.2.5 * @var str */ - 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. @@ -927,7 +927,7 @@ class MCI_Footnotes_Settings { * @since 2.2.10 * @var str */ - 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. @@ -940,7 +940,7 @@ class MCI_Footnotes_Settings { * @since 2.3.0 * @var int */ - 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. @@ -953,7 +953,7 @@ class MCI_Footnotes_Settings { * @since 2.3.0 * @var int */ - 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. @@ -971,7 +971,7 @@ class MCI_Footnotes_Settings { * * When the alternative reference container is enabled, hard links are too. */ - 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. @@ -979,7 +979,7 @@ class MCI_Footnotes_Settings { * @since 2.3.0 * @var str */ - 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. @@ -987,7 +987,7 @@ class MCI_Footnotes_Settings { * @since 2.3.0 * @var str */ - 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. @@ -995,7 +995,7 @@ class MCI_Footnotes_Settings { * @since 2.3.0 * @var str */ - 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. @@ -1003,7 +1003,7 @@ class MCI_Footnotes_Settings { * @since 2.4.0 * @var str */ - 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. @@ -1021,7 +1021,7 @@ class MCI_Footnotes_Settings { * This tooltip hints to use the backbutton instead, so the history gets streamlined again. * @link https://wordpress.org/support/topic/making-it-amp-compatible/#post-13837359 */ - 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. @@ -1034,7 +1034,7 @@ class MCI_Footnotes_Settings { * @since 2.5.4 * @var str */ - 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. @@ -1055,7 +1055,7 @@ class MCI_Footnotes_Settings { * the footnote text separating the tooltip text from the note. * That is consistent with what WordPress does for excerpts. */ - 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 reference container. @@ -1069,7 +1069,7 @@ class MCI_Footnotes_Settings { * But this must not be the default behavior. * @link https://wordpress.org/support/topic/change-tooltip-text/#post-13935488 */ - 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 reference container. @@ -1077,7 +1077,7 @@ class MCI_Footnotes_Settings { * @since 2.5.4 * @var str */ - 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. @@ -1090,7 +1090,7 @@ class MCI_Footnotes_Settings { * @since 2.5.4 * @var str */ - 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. @@ -1103,7 +1103,7 @@ class MCI_Footnotes_Settings { * @since 2.5.6 * @var str */ - 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. @@ -1124,7 +1124,7 @@ class MCI_Footnotes_Settings { * @since 2.6.0 (release) * @var str */ - 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. @@ -1132,7 +1132,7 @@ class MCI_Footnotes_Settings { * @since 2.5.11 * @var str */ - 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. @@ -1140,7 +1140,7 @@ class MCI_Footnotes_Settings { * @since 2.5.11 * @var int */ - 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. @@ -1148,7 +1148,7 @@ class MCI_Footnotes_Settings { * @since 2.5.11 * @var int */ - 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. @@ -1156,7 +1156,7 @@ class MCI_Footnotes_Settings { * @since 2.5.11 * @var int */ - 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. @@ -1169,7 +1169,7 @@ class MCI_Footnotes_Settings { * append them, or disconnecting this label from the input element (discouraged). * @link https://wordpress.org/support/topic/compatibility-issue-with-wpforms/#post-14212318 */ - 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. @@ -1186,7 +1186,7 @@ class MCI_Footnotes_Settings { * @var str * Native smooth scrolling only works in recent browsers. */ - 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. @@ -1199,7 +1199,7 @@ class MCI_Footnotes_Settings { * @since 2.7.0 * @var str */ - const C_STR_FOOTNOTE_SECTION_SHORTCODE = 'footnotes_inputfield_section_shortcode'; + const FOOTNOTE_SECTION_SHORTCODE = 'footnotes_inputfield_section_shortcode'; /** @@ -1210,9 +1210,9 @@ class MCI_Footnotes_Settings { * Stores a singleton reference of this class. * * @since 1.5.0 - * @var MCI_Footnotes_Settings + * @var Footnotes_Settings */ - private static $a_obj_instance = null; + private static $instance = null; /** * Contains all Settings Container names. @@ -1225,7 +1225,7 @@ class MCI_Footnotes_Settings { * * These are the storage container names, one per dashboard tab. */ - private $a_arr_container = array( + private $container = array( 'footnotes_storage', 'footnotes_storage_custom', 'footnotes_storage_expert', @@ -1240,86 +1240,86 @@ class MCI_Footnotes_Settings { * * Comments are moved to constant docblocks. */ - private $a_arr_default = array( + private $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', ), @@ -1327,64 +1327,64 @@ class MCI_Footnotes_Settings { 'footnotes_storage_custom' => array( // Backlink symbol. - self::C_STR_HYPERLINK_ARROW => '↑', - self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '', + self::HYPERLINK_ARROW => '↑', + 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 => '', ), @@ -1392,20 +1392,20 @@ class MCI_Footnotes_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, ), @@ -1413,10 +1413,10 @@ class MCI_Footnotes_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 => '', ), @@ -1428,7 +1428,7 @@ class MCI_Footnotes_Settings { * @since 1.5.0 * @var array */ - private $a_arr_settings = array(); + private $settings = array(); /** * Class Constructor. Loads all Settings from each WordPress Settings container. @@ -1443,37 +1443,37 @@ class MCI_Footnotes_Settings { * Returns a singleton of this class. * * @since 1.5.0 - * @return MCI_Footnotes_Settings + * @return Footnotes_Settings */ public static function instance() { // 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. * * @since 1.5.0 - * @param int $p_int_index Settings Container Array Key Index. + * @param int $index Settings Container Array Key Index. * @return str Settings Container name. */ - public function get_container( $p_int_index ) { - return $this->a_arr_container[ $p_int_index ]; + public function get_container( $index ) { + return $this->container[ $index ]; } /** * Returns the default values of a specific Settings Container. * * @since 1.5.6 - * @param int $p_int_index Settings Container Aray Key Index. + * @param int $index Settings Container Aray Key Index. * @return array */ - public function get_defaults( $p_int_index ) { - return $this->a_arr_default[ $this->a_arr_container[ $p_int_index ] ]; + public function get_defaults( $index ) { + return $this->default[ $this->container[ $index ] ]; } /** @@ -1483,11 +1483,11 @@ class MCI_Footnotes_Settings { */ private function load_all() { // 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 ) ); } } @@ -1502,41 +1502,41 @@ class MCI_Footnotes_Settings { * @link https://wordpress.org/support/topic/leading-space-in-footnotes-tag/ * * @since 1.5.2 - * @param int $p_int_index Settings container array key index. + * @param int $index Settings container array key index. * @return array Settings loaded from defaults if container is empty (first usage). */ - private function load( $p_int_index ) { + private function load( $index ) { // 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 Settings container. * * @since 1.5.0 - * @param int $p_int_index Index of the Settings container. - * @param array $p_arr_new_values new Settings. + * @param int $index Index of the Settings container. + * @param array $new_values new Settings. * @return bool */ - public function save_options( $p_int_index, $p_arr_new_values ) { - if ( update_option( $this->get_container( $p_int_index ), $p_arr_new_values ) ) { + public function save_options( $index, $new_values ) { + if ( update_option( $this->get_container( $index ), $new_values ) ) { $this->load_all(); return true; } @@ -1547,11 +1547,11 @@ class MCI_Footnotes_Settings { * Returns the value of specified Settings name. * * @since 1.5.0 - * @param string $p_str_key Settings Array Key name. + * @param string $key Settings Array Key name. * @return mixed Value of the Setting on Success or Null in Settings name is invalid. */ - public function get( $p_str_key ) { - return array_key_exists( $p_str_key, $this->a_arr_settings ) ? $this->a_arr_settings[ $p_str_key ] : null; + public function get( $key ) { + return array_key_exists( $key, $this->settings ) ? $this->settings[ $key ] : null; } /** @@ -1566,13 +1566,13 @@ class MCI_Footnotes_Settings { */ public function clear_all() { // Iterate through each Settings Container. - $num_settings = count( $this->a_arr_container ); + $num_settings = count( $this->container ); for ( $i = 0; $i < $num_settings; $i++ ) { // Delete the settings container. delete_option( $this->get_container( $i ) ); } // Set settings back to the default values. - $this->a_arr_settings = $this->a_arr_default; + $this->settings = $this->default; } /** @@ -1583,7 +1583,7 @@ class MCI_Footnotes_Settings { */ public function register_settings() { // 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/class/task.php b/class/task.php index db61494..3a43798 100644 --- a/class/task.php +++ b/class/task.php @@ -92,7 +92,7 @@ if ( ! defined( 'ABSPATH' ) ) { * * @since 1.5.0 */ -class MCI_Footnotes_Task { +class Footnotes_Task { /** * Contains all footnotes found in the searched content. @@ -100,7 +100,7 @@ class MCI_Footnotes_Task { * @since 1.5.0 * @var array */ - public static $a_arr_footnotes = array(); + public static $footnotes = array(); /** * Flag if the display of 'LOVE FOOTNOTES' is allowed on the current public page. @@ -108,7 +108,7 @@ class MCI_Footnotes_Task { * @since 1.5.0 * @var bool */ - public static $a_bool_allow_love_me = true; + public static $allow_love_me = true; /** * Prefix for the Footnote html element ID. @@ -116,7 +116,7 @@ class MCI_Footnotes_Task { * @since 1.5.8 * @var string */ - public static $a_str_prefix = ''; + public static $prefix = ''; /** * Autoload a.k.a. infinite scroll, or archive view. @@ -135,7 +135,7 @@ class MCI_Footnotes_Task { * As multiple posts are appended to each other, functions and fragment IDs must be disambiguated. * post ID to make everything unique wrt infinite scroll and archive view. */ - public static $a_int_post_id = 0; + public static $post_id = 0; /** * Multiple reference containers in content and widgets. @@ -153,7 +153,7 @@ class MCI_Footnotes_Task { * as they may occur when the widget_text hook is active and the page * is built with Elementor and has an accordion or similar toggle sections. */ - public static $a_int_reference_container_id = 1; + public static $reference_container_id = 1; /** * Hard links for AMP compatibility. @@ -179,7 +179,7 @@ class MCI_Footnotes_Task { * @var bool * A property because used both in search() and reference_container(). */ - public static $a_bool_hard_links_enabled = false; + public static $hard_links_enabled = false; /** * The referrer slug. @@ -187,7 +187,7 @@ class MCI_Footnotes_Task { * @since 2.3.0 * @var str */ - public static $a_str_referrer_link_slug = 'r'; + public static $referrer_link_slug = 'r'; /** * The footnote slug. @@ -195,7 +195,7 @@ class MCI_Footnotes_Task { * @since 2.3.0 * @var str */ - public static $a_str_footnote_link_slug = 'f'; + public static $footnote_link_slug = 'f'; /** * The slug and identifier separator. @@ -203,7 +203,7 @@ class MCI_Footnotes_Task { * @since 2.3.0 * @var str */ - private static $a_str_link_ids_separator = '+'; + private static $link_ids_separator = '+'; /** * Contains the concatenated fragment ID base. @@ -211,7 +211,7 @@ class MCI_Footnotes_Task { * @since 2.3.0 * @var str */ - public static $a_str_post_container_id_compound = ''; + public static $post_container_id_compound = ''; /** * Scroll offset. @@ -232,7 +232,7 @@ class MCI_Footnotes_Task { * Scroll offset may now need to get into inline CSS. * Hence it needs to be loaded twice, because priority levels may not match. */ - public static $a_int_scroll_offset = 34; + public static $scroll_offset = 34; /** * Optional link element for footnote referrers and backlinks @@ -274,7 +274,7 @@ class MCI_Footnotes_Task { * Yet styling these elements with the link color is not universally preferred, so that * the very presence of these link elements may need to be avoided. * - * @see self::$a_bool_hard_links_enabled + * @see self::$hard_links_enabled * A property because used both in search() and reference_container(). */ @@ -284,7 +284,7 @@ class MCI_Footnotes_Task { * @since 2.3.0 * @var str */ - public static $a_str_link_span = 'span'; + public static $link_span = 'span'; /** * The opening tag. @@ -292,7 +292,7 @@ class MCI_Footnotes_Task { * @since 2.3.0 * @var str */ - public static $a_str_link_open_tag = ''; + public static $link_open_tag = ''; /** * The closing tag. @@ -300,7 +300,7 @@ class MCI_Footnotes_Task { * @since 2.3.0 * @var str */ - public static $a_str_link_close_tag = ''; + public static $link_close_tag = ''; /** * Dedicated tooltip text. @@ -324,7 +324,7 @@ class MCI_Footnotes_Task { * @since 2.5.2 * @var str */ - public static $a_str_tooltip_shortcode = '[[/tooltip]]'; + public static $tooltip_shortcode = '[[/tooltip]]'; /** * The tooltip delimiter shortcode length. @@ -332,7 +332,7 @@ class MCI_Footnotes_Task { * @since 2.5.2 * @var int */ - public static $a_int_tooltip_shortcode_length = 12; + public static $tooltip_shortcode_length = 12; /** * Whether to mirror the tooltip text in the reference container. @@ -340,7 +340,7 @@ class MCI_Footnotes_Task { * @since 2.5.2 * @var bool */ - public static $a_bool_mirror_tooltip_text = false; + public static $mirror_tooltip_text = false; /** * Footnote delimiter start short code. @@ -349,7 +349,7 @@ class MCI_Footnotes_Task { * @since 2.6.2 (property) * @var str */ - public static $a_str_start_tag = ''; + public static $start_tag = ''; /** * Footnote delimiter end short code. @@ -358,7 +358,7 @@ class MCI_Footnotes_Task { * @since 2.6.2 (property) * @var str */ - public static $a_str_end_tag = ''; + public static $end_tag = ''; /** * Footnote delimiter start short code in regex format. @@ -367,7 +367,7 @@ class MCI_Footnotes_Task { * @since 2.6.2 (property) * @var str */ - public static $a_str_start_tag_regex = ''; + public static $start_tag_regex = ''; /** * Footnote delimiter end short code in regex format. @@ -376,7 +376,7 @@ class MCI_Footnotes_Task { * @since 2.6.2 (property) * @var str */ - public static $a_str_end_tag_regex = ''; + public static $end_tag_regex = ''; /** * Footnote delimiter syntax validation enabled. @@ -395,7 +395,7 @@ class MCI_Footnotes_Task { * is considered a design flaw, and the feature is released as a bug fix after overdue 2.3.0 * released in urgency to provide AMP compat before 2021. */ - public static $a_bool_syntax_error_flag = true; + public static $syntax_error_flag = true; /** * Register WordPress Hooks to replace Footnotes in the content of a public page. @@ -418,18 +418,18 @@ class MCI_Footnotes_Task { public function register_hooks() { // Get values from settings. - $l_int_the_title_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ) ); - $l_int_the_content_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ) ); - $l_int_the_excerpt_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ) ); - $l_int_widget_title_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ) ); - $l_int_widget_text_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL ) ); + $the_title_priority = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ) ); + $the_content_priority = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ) ); + $the_excerpt_priority = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ) ); + $widget_title_priority = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ) ); + $widget_text_priority = intval( Footnotes_Settings::instance()->get( Footnotes_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( 'wp_head', array( $this, 'footnotes_output_head' ), PHP_INT_MAX ); @@ -437,13 +437,13 @@ class MCI_Footnotes_Task { // Append the love and share me slug to the footer. add_filter( 'wp_footer', array( $this, 'footnotes_output_footer' ), PHP_INT_MAX ); - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ) ) ) { - add_filter( 'the_title', array( $this, 'footnotes_in_title' ), $l_int_the_title_priority ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_THE_TITLE ) ) ) { + add_filter( 'the_title', array( $this, 'footnotes_in_title' ), $the_title_priority ); } // Configurable priority level for reference container relative positioning; default 98. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ) ) ) { - add_filter( 'the_content', array( $this, 'footnotes_in_content' ), $l_int_the_content_priority ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_THE_CONTENT ) ) ) { + add_filter( 'the_content', array( $this, 'footnotes_in_content' ), $the_content_priority ); /** * Hook for category pages. @@ -462,7 +462,7 @@ class MCI_Footnotes_Task { * For this to happen, WordPress’ built-in partial HTML blocker needs to be disabled. * @link https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/ */ - add_filter( 'term_description', array( $this, 'footnotes_in_content' ), $l_int_the_content_priority ); + add_filter( 'term_description', array( $this, 'footnotes_in_content' ), $the_content_priority ); /** * Hook for popup maker popups. @@ -474,7 +474,7 @@ class MCI_Footnotes_Task { * * @since 2.5.1 */ - add_filter( 'pum_popup_content', array( $this, 'footnotes_in_content' ), $l_int_the_content_priority ); + add_filter( 'pum_popup_content', array( $this, 'footnotes_in_content' ), $the_content_priority ); } /** @@ -485,16 +485,16 @@ class MCI_Footnotes_Task { * @since 2.6.2 The hook 'get_the_excerpt' is readded when attempting to debug excerpt handling. * @since 2.6.6 The hook 'get_the_excerpt' is removed again because it seems to cause issues in some themes. */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ) ) ) { - add_filter( 'the_excerpt', array( $this, 'footnotes_in_excerpt' ), $l_int_the_excerpt_priority ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_THE_EXCERPT ) ) ) { + add_filter( 'the_excerpt', array( $this, 'footnotes_in_excerpt' ), $the_excerpt_priority ); } - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ) ) ) { - add_filter( 'widget_title', array( $this, 'footnotes_in_widget_title' ), $l_int_widget_title_priority ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_WIDGET_TITLE ) ) ) { + add_filter( 'widget_title', array( $this, 'footnotes_in_widget_title' ), $widget_title_priority ); } - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ) ) ) { - add_filter( 'widget_text', array( $this, 'footnotes_in_widget_text' ), $l_int_widget_text_priority ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::EXPERT_LOOKUP_WIDGET_TEXT ) ) ) { + add_filter( 'widget_text', array( $this, 'footnotes_in_widget_text' ), $widget_text_priority ); } /** @@ -561,8 +561,8 @@ class MCI_Footnotes_Task { */ // 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; } /** @@ -599,7 +599,7 @@ class MCI_Footnotes_Task { * @since 2.5.12 * Native smooth scrolling only works in recent browsers. */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING ) ) ) { echo "html {scroll-behavior: smooth;}\r\n"; } @@ -616,9 +616,9 @@ class MCI_Footnotes_Task { * 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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ); - if ( 'no' !== $l_str_normalize_superscript ) { - if ( 'all' === $l_str_normalize_superscript ) { + $normalize_superscript = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ); + if ( 'no' !== $normalize_superscript ) { + if ( 'all' === $normalize_superscript ) { echo 'sup {'; } else { echo '.footnote_plugin_tooltip_text {'; @@ -636,7 +636,7 @@ class MCI_Footnotes_Task { * * @since 2.1.1 */ - if ( ! MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE ) ) ) { + if ( ! Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_START_PAGE_ENABLE ) ) ) { echo ".home .footnotes_reference_container { display: none; }\r\n"; } @@ -651,12 +651,12 @@ class MCI_Footnotes_Task { * * @since 2.3.0 */ - $l_int_reference_container_top_margin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN ) ); - $l_int_reference_container_bottom_margin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN ) ); + $reference_container_top_margin = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_TOP_MARGIN ) ); + $reference_container_bottom_margin = intval( Footnotes_Settings::instance()->get( Footnotes_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"; /** @@ -670,9 +670,9 @@ class MCI_Footnotes_Task { * * @since 2.2.5 */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) { echo '.footnote_container_prepare > '; - echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT ); + echo Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_LABEL_ELEMENT ); echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n"; } @@ -691,7 +691,7 @@ class MCI_Footnotes_Task { * issues as browsers won’t reload these style sheets after settings are * changed while the version string is not. */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE ) ) ) { echo '.footnotes_table, .footnotes_plugin_reference_row {'; echo 'border: 1px solid #060606;'; echo " !important;}\r\n"; @@ -701,45 +701,45 @@ class MCI_Footnotes_Task { } // Ref container first column width and max-width. - $l_bool_column_width_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED ) ); - $l_bool_column_max_width_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED ) ); + $column_width_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_COLUMN_WIDTH_ENABLED ) ); + $column_max_width_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR ); - $l_str_column_width_unit = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT ); + if ( $column_width_enabled ) { + $column_width_scalar = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_COLUMN_WIDTH_SCALAR ); + $column_width_unit = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_COLUMN_WIDTH_UNIT ); - if ( ! empty( $l_int_column_width_scalar ) ) { - if ( '%' === $l_str_column_width_unit ) { - if ( $l_int_column_width_scalar > 100 ) { - $l_int_column_width_scalar = 100; + if ( ! empty( $column_width_scalar ) ) { + if ( '%' === $column_width_unit ) { + if ( $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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR ); - $l_str_column_max_width_unit = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT ); + if ( $column_max_width_enabled ) { + $column_max_width_scalar = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_COLUMN_MAX_WIDTH_SCALAR ); + $column_max_width_unit = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_COLUMN_MAX_WIDTH_UNIT ); - if ( ! empty( $l_int_column_max_width_scalar ) ) { - if ( '%' === $l_str_column_max_width_unit ) { - if ( $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 ) { + if ( $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"; @@ -754,24 +754,24 @@ class MCI_Footnotes_Task { * * @since 2.5.6 hard links are always enabled when the alternative reference container is. */ - self::$a_bool_hard_links_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE ) ); + self::$hard_links_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_HARD_LINKS_ENABLE ) ); // Correct hard links enabled status depending on AMP compatible or alternative reference container enabled status. - if ( MCI_Footnotes::$a_bool_amp_enabled || 'jquery' !== MCI_Footnotes::$a_str_script_mode ) { - self::$a_bool_hard_links_enabled = true; + if ( Footnotes::$amp_enabled || 'jquery' !== Footnotes::$script_mode ) { + self::$hard_links_enabled = true; } - self::$a_int_scroll_offset = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ) ); - if ( self::$a_bool_hard_links_enabled ) { + self::$scroll_offset = intval( Footnotes_Settings::instance()->get( Footnotes_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 ( MCI_Footnotes::$a_bool_tooltips_enabled ) { + if ( Footnotes::$tooltips_enabled ) { echo '.footnote_tooltip {'; /** @@ -782,9 +782,9 @@ class MCI_Footnotes_Task { * @since 2.1.4 */ echo ' font-size: '; - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) { - echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR ); - echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) { + echo Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR ); + echo Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FONT_SIZE_UNIT ); } else { echo 'inherit'; } @@ -793,51 +793,51 @@ class MCI_Footnotes_Task { /* * Tooltip Text color. */ - $l_str_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ); - if ( ! empty( $l_str_color ) ) { - printf( ' color: %s !important;', $l_str_color ); + $color = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR ); + if ( ! empty( $color ) ) { + printf( ' color: %s !important;', $color ); } /* * Tooltip Background color. */ - $l_str_background = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); - if ( ! empty( $l_str_background ) ) { - printf( ' background-color: %s !important;', $l_str_background ); + $background = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); + if ( ! empty( $background ) ) { + printf( ' background-color: %s !important;', $background ); } /* * Tooltip Border width. */ - $l_int_border_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); - if ( ! empty( $l_int_border_width ) && intval( $l_int_border_width ) > 0 ) { - printf( ' border-width: %dpx !important; border-style: solid !important;', $l_int_border_width ); + $border_width = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); + if ( ! empty( $border_width ) && intval( $border_width ) > 0 ) { + printf( ' border-width: %dpx !important; border-style: solid !important;', $border_width ); } /* * Tooltip Border color. */ - $l_str_border_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 = Footnotes_Settings::instance()->get( Footnotes_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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); - if ( ! empty( $l_int_border_radius ) && intval( $l_int_border_radius ) > 0 ) { - printf( ' border-radius: %dpx !important;', $l_int_border_radius ); + $border_radius = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); + if ( ! empty( $border_radius ) && intval( $border_radius ) > 0 ) { + printf( ' border-radius: %dpx !important;', $border_radius ); } /* * Tooltip Shadow color. */ - $l_str_box_shadow_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 = Footnotes_Settings::instance()->get( Footnotes_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 ); } /** @@ -851,7 +851,7 @@ class MCI_Footnotes_Task { * * @since 2.2.5 */ - if ( ! MCI_Footnotes::$a_bool_alternative_tooltips_enabled && ! MCI_Footnotes::$a_bool_amp_enabled ) { + if ( ! Footnotes::$alternative_tooltips_enabled && ! Footnotes::$amp_enabled ) { /** * Dimensions of jQuery tooltips. @@ -860,9 +860,9 @@ class MCI_Footnotes_Task { * * @see templates/public/tooltip.html. */ - $l_int_max_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); - if ( ! empty( $l_int_max_width ) && intval( $l_int_max_width ) > 0 ) { - printf( ' max-width: %dpx !important;', $l_int_max_width ); + $max_width = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); + if ( ! empty( $max_width ) && intval( $max_width ) > 0 ) { + printf( ' max-width: %dpx !important;', $max_width ); } echo "}\r\n"; @@ -877,12 +877,12 @@ class MCI_Footnotes_Task { * * @see 'Determine shrink width if alternative tooltips are enabled'. */ - $l_int_alternative_tooltip_width = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ) ); + $alternative_tooltip_width = intval( Footnotes_Settings::instance()->get( Footnotes_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. @@ -890,35 +890,35 @@ class MCI_Footnotes_Task { * @see dev-amp-tooltips.css. * @see dev-tooltips-alternative.css. */ - $l_str_alternative_position = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); - $l_int_offset_x = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ) ); + $alternative_position = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); + $offset_x = intval( Footnotes_Settings::instance()->get( Footnotes_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 ) ? $l_int_offset_x : 0 ) . 'px;'; + if ( 'top left' === $alternative_position || 'bottom left' === $alternative_position ) { + echo ' right: ' . ( ! empty( $offset_x ) ? $offset_x : 0 ) . 'px;'; } else { - echo ' left: ' . ( ! empty( $l_int_offset_x ) ? $l_int_offset_x : 0 ) . 'px;'; + echo ' left: ' . ( ! empty( $offset_x ) ? $offset_x : 0 ) . 'px;'; } - $l_int_offset_y = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ) ); + $offset_y = intval( Footnotes_Settings::instance()->get( Footnotes_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 ) ? $l_int_offset_y : 0 ) . 'px;'; + if ( 'top left' === $alternative_position || 'top right' === $alternative_position ) { + echo ' bottom: ' . ( ! empty( $offset_y ) ? $offset_y : 0 ) . 'px;'; } else { - echo ' top: ' . ( ! empty( $l_int_offset_y ) ? $l_int_offset_y : 0 ) . 'px;'; + echo ' top: ' . ( ! empty( $offset_y ) ? $offset_y : 0 ) . 'px;'; } echo "}\r\n"; /* * Timing. */ - $l_int_fade_in_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY ) ); - $l_int_fade_in_delay = ! empty( $l_int_fade_in_delay ) ? $l_int_fade_in_delay : '0'; - $l_int_fade_in_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ) ); - $l_int_fade_in_duration = ! empty( $l_int_fade_in_duration ) ? $l_int_fade_in_duration : '0'; - $l_int_fade_out_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ) ); - $l_int_fade_out_delay = ! empty( $l_int_fade_out_delay ) ? $l_int_fade_out_delay : '0'; - $l_int_fade_out_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION ) ); - $l_int_fade_out_duration = ! empty( $l_int_fade_out_duration ) ? $l_int_fade_out_duration : '0'; + $fade_in_delay = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ) ); + $fade_in_delay = ! empty( $fade_in_delay ) ? $fade_in_delay : '0'; + $fade_in_duration = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ) ); + $fade_in_duration = ! empty( $fade_in_duration ) ? $fade_in_duration : '0'; + $fade_out_delay = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ) ); + $fade_out_delay = ! empty( $fade_out_delay ) ? $fade_out_delay : '0'; + $fade_out_duration = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ) ); + $fade_out_duration = ! empty( $fade_out_duration ) ? $fade_out_duration : '0'; /** * AMP compatible tooltips. @@ -927,16 +927,16 @@ class MCI_Footnotes_Task { * * @see dev-amp-tooltips.css. */ - if ( MCI_Footnotes::$a_bool_amp_enabled ) { + if ( Footnotes::$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"; /** @@ -949,13 +949,13 @@ class MCI_Footnotes_Task { } 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"; } } @@ -971,11 +971,11 @@ class MCI_Footnotes_Task { * Set custom CSS to override settings, not conversely. * Legacy Custom CSS is used until it’s set to disappear after dashboard tab migration. */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) { - echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::CUSTOM_CSS_LEGACY_ENABLE ) ) ) { + echo Footnotes_Settings::instance()->get( Footnotes_Settings::CUSTOM_CSS ); echo "\r\n"; } - echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_NEW ); + echo Footnotes_Settings::instance()->get( Footnotes_Settings::CUSTOM_CSS_NEW ); // Insert end tag without switching out of PHP. echo "\r\n\r\n"; @@ -992,7 +992,7 @@ class MCI_Footnotes_Task { * The script for alternative tooltips is printed formatted, not minified, * for transparency. It isn’t indented though (the PHP open tag neither). */ - if ( MCI_Footnotes::$a_bool_alternative_tooltips_enabled ) { + if ( Footnotes::$alternative_tooltips_enabled ) { // Start internal script. ?> @@ -1019,66 +1019,66 @@ class MCI_Footnotes_Task { * @since 2.2.0 More options. */ public function footnotes_output_footer() { - if ( 'footer' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) { + if ( 'footer' === Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_POSITION ) ) { echo $this->reference_container(); } // Get setting for love and share this plugin. - $l_str_love_me_index = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE ); + $love_me_index = Footnotes_Settings::instance()->get( Footnotes_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', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ); + $linked_name = sprintf( '%s', Footnotes_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, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL ); + $love_me_text = sprintf( __( 'I %2$s %1$s', 'footnotes' ), $linked_name, Footnotes_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, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL ); + $love_me_text = sprintf( '%1$s %2$s', $linked_name, Footnotes_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', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_linked_name ); + $love_me_text = sprintf( '%1$s %2$s', Footnotes_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 = sprintf( '%s', $l_str_linked_name ); + $love_me_text = sprintf( '%s', $linked_name ); break; } - echo sprintf( '
%s
', $l_str_love_me_text ); + echo sprintf( '
%s
', $love_me_text ); } /** * Replaces footnotes in the post/page title. * * @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( $p_str_content ) { + public function footnotes_in_title( $content ) { // Appends the reference container if set to "post_end". - return $this->exec( $p_str_content, false ); + return $this->exec( $content, false ); } /** @@ -1092,41 +1092,41 @@ class MCI_Footnotes_Task { * @link https://wordpress.org/support/topic/multiple-reference-containers-in-single-post/ * * @since 2.7.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( $p_str_content ) { + public function footnotes_in_content( $content ) { - $l_str_ref_container_position = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ); - $l_str_footnote_section_shortcode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ); - $l_int_footnote_section_shortcode_length = strlen( $l_str_footnote_section_shortcode ); + $ref_container_position = Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_POSITION ); + $footnote_section_shortcode = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTE_SECTION_SHORTCODE ); + $footnote_section_shortcode_length = strlen( $footnote_section_shortcode ); - if ( strpos( $p_str_content, $l_str_footnote_section_shortcode ) === false ) { + if ( strpos( $content, $footnote_section_shortcode ) === false ) { // 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, $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 ( strpos( $l_str_rest_content, $l_str_footnote_section_shortcode ) !== false ); - $l_arr_sections_raw[] = $l_str_rest_content; + $section_end = strpos( $rest_content, $footnote_section_shortcode ); + $sections_raw[] = substr( $rest_content, 0, $section_end ); + $rest_content = substr( $rest_content, $section_end + $footnote_section_shortcode_length ); + } while ( strpos( $rest_content, $footnote_section_shortcode ) !== false ); + $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 ); } - $p_str_content = implode( $l_arr_sections_processed ); - return $p_str_content; + $content = implode( $sections_processed ); + return $content; } } @@ -1135,8 +1135,8 @@ class MCI_Footnotes_Task { * Processes existing excerpt or replaces it with a new one generated on the basis of the post. * * @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. * @since 2.6.2 Debug No option. * @since 2.6.3 Debug Yes option, the setting becomes fully effective. * @@ -1150,17 +1150,17 @@ class MCI_Footnotes_Task { * But issue #65 brought up that manual excerpts can include processable footnotes. * Default 'manual' is fallback and is backward compatible with the initial setup. */ - public function footnotes_in_excerpt( $p_str_excerpt ) { - $l_str_excerpt_mode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT ); + public function footnotes_in_excerpt( $excerpt ) { + $excerpt_mode = Footnotes_Settings::instance()->get( Footnotes_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 ); } } @@ -1180,41 +1180,41 @@ class MCI_Footnotes_Task { * @link https://wordpress.org/support/topic/problem-with-footnotes-in-excerpts-of-the-blog-page/ * * @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. * Applies full WordPress excerpt processing. * @link https://developer.wordpress.org/reference/functions/wp_trim_excerpt/ * @link https://developer.wordpress.org/reference/functions/wp_trim_words/ */ - public function generate_excerpt( $p_str_content ) { + public function generate_excerpt( $content ) { // 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; } /** @@ -1243,103 +1243,103 @@ class MCI_Footnotes_Task { * @link https://wordpress.org/support/topic/update-crashed-my-website-3/#post-14259396 * * @since 2.6.4 - * @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. * Does not apply full WordPress excerpt processing. * @see self::generate_excerpt() * Uses information and some code from Advanced Excerpt. * @link https://wordpress.org/plugins/advanced-excerpt/ */ - public function generate_excerpt_with_footnotes( $p_str_content ) { + public function generate_excerpt_with_footnotes( $content ) { // 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 = '@' . mt_rand( 100000000, 2147483647 ) . '@'; - $p_str_content = preg_replace( - '#' . self::$a_str_start_tag_regex . '.+?' . self::$a_str_end_tag_regex . '#', - $l_int_placeholder, - $p_str_content + $placeholder = '@' . mt_rand( 100000000, 2147483647 ) . '@'; + $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; } @@ -1347,25 +1347,25 @@ class MCI_Footnotes_Task { * Replaces footnotes in the widget title. * * @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( $p_str_content ) { + public function footnotes_in_widget_title( $content ) { // Appends the reference container if set to "post_end". - return $this->exec( $p_str_content, false ); + return $this->exec( $content, false ); } /** * Replaces footnotes in the content of the current widget. * * @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( $p_str_content ) { + public function footnotes_in_widget_text( $content ) { // phpcs:disable WordPress.PHP.YodaConditions.NotYoda // Appends the reference container if set to "post_end". - return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ? true : false ); + return $this->exec( $content, 'post_end' === Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_POSITION ) ? true : false ); // phpcs:enable WordPress.PHP.YodaConditions.NotYoda } @@ -1373,15 +1373,15 @@ class MCI_Footnotes_Task { * Replaces all footnotes that occur in the given content. * * @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. * @return string */ - public function exec( $p_str_content, $p_bool_output_references = false, $p_bool_hide_footnotes_text = false ) { + public function exec( $content, $output_references = false, $hide_footnotes_text = false ) { // 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. @@ -1401,43 +1401,43 @@ class MCI_Footnotes_Task { * @since 2.2.5 */ // Append the reference container or insert at shortcode. - $l_str_reference_container_position_shortcode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 = Footnotes_Settings::instance()->get( Footnotes_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, $l_str_reference_container_position_shortcode ) ) { + if ( strpos( $content, $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, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG ) ) { - self::$a_bool_allow_love_me = false; - $p_str_content = str_replace( MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, '', $p_str_content ); + if ( strpos( $content, Footnotes_Config::NO_LOVE_SLUG ) ) { + self::$allow_love_me = false; + $content = str_replace( Footnotes_Config::NO_LOVE_SLUG, '', $content ); } // Return the content with replaced footnotes and optional reference container appended. - return $p_str_content; + return $content; } /** * Brings the delimiters and unifies their various HTML escapement schemas. * - * @param string $p_str_content TODO. + * @param string $content TODO. * * - Bugfix: Footnote delimiter short codes: fix numbering bug by cross-editor HTML escapement schema unification, thanks to @patrick_here @alifarahani8000 @gova bug reports. * @@ -1456,69 +1456,69 @@ class MCI_Footnotes_Task { * when the opening tag is already escaped. In visual mode, the Block Editor * does not escape the greater-than sign. */ - public function unify_delimiters( $p_str_content ) { + public function unify_delimiters( $content ) { // Get footnotes start and end tag short codes. - $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); - $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); - if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) { - $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $starting_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START ); + $ending_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SHORT_CODE_END ); + if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) { + $starting_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $ending_tag = Footnotes_Settings::instance()->get( Footnotes_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; } /** * Replaces all footnotes in the given content and appends them to the static property. * * @since 1.5.0 - * @param string $p_str_content Any content to be searched for footnotes. - * @param bool $p_bool_hide_footnotes_text Hide footnotes found in the string. + * @param string $content Any content to be searched for footnotes. + * @param bool $hide_footnotes_text Hide footnotes found in the string. * @return string * * @since 2.0.0 various. @@ -1537,10 +1537,10 @@ class MCI_Footnotes_Task { * * @since 2.5.13 */ - public function search( $p_str_content, $p_bool_hide_footnotes_text ) { + public function search( $content, $hide_footnotes_text ) { // 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. @@ -1561,59 +1561,59 @@ class MCI_Footnotes_Task { * prepend a warning to the content; displays de facto beneath the post title. */ // If enabled. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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; } } @@ -1630,11 +1630,11 @@ class MCI_Footnotes_Task { * 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. @@ -1644,15 +1644,15 @@ class MCI_Footnotes_Task { * @since 2.5.12 * @link https://wordpress.org/support/topic/compatibility-issue-with-wpforms/#post-14212318 */ - $l_str_label_issue_solution = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION ); + $label_issue_solution = Footnotes_Settings::instance()->get( Footnotes_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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG ); - self::$a_str_footnote_link_slug = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG ); - self::$a_str_link_ids_separator = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR ); + self::$referrer_link_slug = Footnotes_Settings::instance()->get( Footnotes_Settings::REFERRER_FRAGMENT_ID_SLUG ); + self::$footnote_link_slug = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTE_FRAGMENT_ID_SLUG ); + self::$link_ids_separator = Footnotes_Settings::instance()->get( Footnotes_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 = MCI_Footnotes_Convert::index( $l_int_footnote_index, MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); + if ( ! $hide_footnotes_text ) { + $index = Footnotes_Convert::index( $footnote_index, Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_COUNTER_STYLE ) ); // Display only a truncated footnote text if option enabled. - $l_bool_enable_excerpt = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) ); - $l_int_max_length = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH ) ); + $enable_excerpt = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) ); + $max_length = intval( Footnotes_Settings::instance()->get( Footnotes_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. @@ -1959,51 +1959,51 @@ class MCI_Footnotes_Task { * 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 ( MCI_Footnotes::$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 ( Footnotes::$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 ( MCI_Footnotes::$a_bool_amp_enabled ) { + if ( Footnotes::$amp_enabled ) { // If the reference container is also collapsed by default. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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. @@ -2015,9 +2015,9 @@ class MCI_Footnotes_Task { * * @since 2.1.0 */ - $l_str_excerpt_text .= MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ); + $excerpt_text .= Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_TOOLTIP_READON_LABEL ); - $l_str_excerpt_text .= self::$a_bool_hard_links_enabled ? '' : ''; + $excerpt_text .= self::$hard_links_enabled ? '' : ''; } } @@ -2032,38 +2032,38 @@ class MCI_Footnotes_Task { * @since 2.1.1 * Define the HTML element to use for the referrers. */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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 { @@ -2078,24 +2078,24 @@ class MCI_Footnotes_Task { * @since 2.4.0 * 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 ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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 ( MCI_Footnotes::$a_bool_tooltips_enabled ) { - $l_str_tooltip_content = $l_bool_has_tooltip_text ? $l_str_tooltip_text : $l_str_excerpt_text; + if ( Footnotes::$tooltips_enabled ) { + $tooltip_content = $has_tooltip_text ? $tooltip_text : $excerpt_text; } else { - $l_str_tooltip_content = ''; + $tooltip_content = ''; } /** @@ -2103,76 +2103,76 @@ class MCI_Footnotes_Task { * * @since 2.5.6 */ - $l_str_tooltip_style = ''; - if ( MCI_Footnotes::$a_bool_alternative_tooltips_enabled && MCI_Footnotes::$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 ( Footnotes::$alternative_tooltips_enabled && Footnotes::$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 'templates/public/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' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE ), - 'index' => $l_int_index, - 'after' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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' => Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_STYLING_BEFORE ), + 'index' => $index, + 'after' => Footnotes_Settings::instance()->get( Footnotes_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 ( MCI_Footnotes::$a_bool_tooltips_enabled && ! MCI_Footnotes::$a_bool_amp_enabled && ! MCI_Footnotes::$a_bool_alternative_tooltips_enabled ) { + if ( Footnotes::$tooltips_enabled && ! Footnotes::$amp_enabled && ! Footnotes::$alternative_tooltips_enabled ) { - $l_int_offset_y = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ) ); - $l_int_offset_x = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ) ); - $l_int_fade_in_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY ) ); - $l_int_fade_in_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ) ); - $l_int_fade_out_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ) ); - $l_int_fade_out_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION ) ); + $offset_y = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ) ); + $offset_x = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ) ); + $fade_in_delay = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ) ); + $fade_in_duration = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ) ); + $fade_out_delay = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ) ); + $fade_out_duration = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ) ); // Fill in 'templates/public/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' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION ), - 'offset-y' => ! empty( $l_int_offset_y ) ? $l_int_offset_y : 0, - 'offset-x' => ! empty( $l_int_offset_x ) ? $l_int_offset_x : 0, - 'fade-in-delay' => ! empty( $l_int_fade_in_delay ) ? $l_int_fade_in_delay : 0, - 'fade-in-duration' => ! empty( $l_int_fade_in_duration ) ? $l_int_fade_in_duration : 0, - 'fade-out-delay' => ! empty( $l_int_fade_out_delay ) ? $l_int_fade_out_delay : 0, - 'fade-out-duration' => ! empty( $l_int_fade_out_duration ) ? $l_int_fade_out_duration : 0, + 'post_id' => self::$post_id, + 'container_id' => self::$reference_container_id, + 'note_id' => $index, + 'position' => Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION ), + 'offset-y' => ! empty( $offset_y ) ? $offset_y : 0, + 'offset-x' => ! empty( $offset_x ) ? $offset_x : 0, + 'fade-in-delay' => ! empty( $fade_in_delay ) ? $fade_in_delay : 0, + 'fade-in-duration' => ! empty( $fade_in_duration ) ? $fade_in_duration : 0, + 'fade-out-delay' => ! empty( $fade_out_delay ) ? $fade_out_delay : 0, + 'fade-out-duration' => ! empty( $fade_out_duration ) ? $fade_out_duration : 0, ) ); - $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++; } /** @@ -2229,12 +2229,12 @@ class MCI_Footnotes_Task { * 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; } /** @@ -2253,7 +2253,7 @@ class MCI_Footnotes_Task { public function reference_container() { // No footnotes have been replaced on this page. - if ( empty( self::$a_arr_footnotes ) ) { + if ( empty( self::$footnotes ) ) { return ''; } @@ -2268,29 +2268,29 @@ class MCI_Footnotes_Task { * @since 2.1.1 */ // If the backlink symbol is enabled. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) { // Get html arrow. - $l_str_arrow = MCI_Footnotes_Convert::get_arrow( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW ) ); + $arrow = Footnotes_Convert::get_arrow( Footnotes_Settings::instance()->get( Footnotes_Settings::HYPERLINK_ARROW ) ); // Set html arrow to the first one if invalid index defined. - if ( is_array( $l_str_arrow ) ) { - $l_str_arrow = MCI_Footnotes_Convert::get_arrow( 0 ); + if ( is_array( $arrow ) ) { + $arrow = Footnotes_Convert::get_arrow( 0 ); } // Get user defined arrow. - $l_str_arrow_user_defined = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 = Footnotes_Settings::instance()->get( Footnotes_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 = ''; } @@ -2309,30 +2309,30 @@ class MCI_Footnotes_Task { * Initially an appended comma was hard-coded in this algorithm for enumerations. * The comma in enumerations is not universally preferred. */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_SEPARATOR_ENABLED ) ) ) { // Check if it is input-configured. - $l_str_separator = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM ); + $separator = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_SEPARATOR_CUSTOM ); - if ( empty( $l_str_separator ) ) { + if ( empty( $separator ) ) { // If it is not, check which option is on. - $l_str_separator_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION ); - switch ( $l_str_separator_option ) { + $separator_option = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_SEPARATOR_OPTION ); + switch ( $separator_option ) { case 'comma': - $l_str_separator = ','; + $separator = ','; break; case 'semicolon': - $l_str_separator = ';'; + $separator = ';'; break; case 'en_dash': - $l_str_separator = ' –'; + $separator = ' –'; break; } } } else { - $l_str_separator = ''; + $separator = ''; } /** @@ -2344,30 +2344,30 @@ class MCI_Footnotes_Task { * making it optional was envisaged. * @since 2.1.4 the terminator is optional, has options, and is configurable. */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_TERMINATOR_ENABLED ) ) ) { // Check if it is input-configured. - $l_str_terminator = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM ); + $terminator = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_TERMINATOR_CUSTOM ); - if ( empty( $l_str_terminator ) ) { + if ( empty( $terminator ) ) { // If it is not, check which option is on. - $l_str_terminator_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION ); - switch ( $l_str_terminator_option ) { + $terminator_option = Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_TERMINATOR_OPTION ); + switch ( $terminator_option ) { case 'period': - $l_str_terminator = '.'; + $terminator = '.'; break; case 'parenthesis': - $l_str_terminator = ')'; + $terminator = ')'; break; case 'colon': - $l_str_terminator = ':'; + $terminator = ':'; break; } } } else { - $l_str_terminator = ''; + $terminator = ''; } /** @@ -2382,7 +2382,7 @@ class MCI_Footnotes_Task { * 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 = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED ) ) ? '
' : ' '; + $line_break = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::BACKLINKS_LINE_BREAKS_ENABLED ) ) ? '
' : ' '; /** * Line breaks for source readability. @@ -2391,7 +2391,7 @@ class MCI_Footnotes_Task { * 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. @@ -2400,33 +2400,33 @@ class MCI_Footnotes_Task { * * @since 2.1.1 */ - $l_bool_combine_identical_footnotes = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES ) ); + $combine_identical_footnotes = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::COMBINE_IDENTICAL_FOOTNOTES ) ); // AMP compatibility requires a full set of AMP compatible table row templates. - if ( MCI_Footnotes::$a_bool_amp_enabled ) { + if ( Footnotes::$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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container-body-combi' ); + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'amp-reference-container-body-combi' ); } else { // When 3-column layout is turned on (only available if combining is turned off). - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container-body-3column' ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'amp-reference-container-body-3column' ); } else { // When switch symbol and index is turned on, and combining and 3-columns are off. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container-body-switch' ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'amp-reference-container-body-switch' ); } else { // Default is the standard template. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container-body' ); + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'amp-reference-container-body' ); } } @@ -2434,27 +2434,27 @@ class MCI_Footnotes_Task { } else { // 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 MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-combi' ); + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'reference-container-body-combi' ); } else { // When 3-column layout is turned on (only available if combining is turned off). - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-3column' ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'reference-container-body-3column' ); } else { // When switch symbol and index is turned on, and combining and 3-columns are off. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-switch' ); + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'reference-container-body-switch' ); } else { // Default is the standard template. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body' ); + $template = new Footnotes_Template( Footnotes_Template::PUBLIC, 'reference-container-body' ); } } @@ -2476,27 +2476,27 @@ class MCI_Footnotes_Task { * * @since 2.1.4 */ - $l_bool_symbol_switch = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ); + $symbol_switch = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_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 = MCI_Footnotes_Convert::index( ( $l_int_index + 1 ), MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); + $footnote_id = Footnotes_Convert::index( ( $index + 1 ), Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_COUNTER_STYLE ) ); /** * Case of only one backlink per table row. @@ -2504,9 +2504,9 @@ class MCI_Footnotes_Task { * 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. @@ -2521,38 +2521,38 @@ class MCI_Footnotes_Task { * This tooltip hints to use the backbutton instead, so the history gets streamlined again. * @link https://wordpress.org/support/topic/making-it-amp-compatible/#post-13837359 */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { - $l_str_use_backbutton_hint = ' title="'; - $l_str_use_backbutton_hint .= MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ); - $l_str_use_backbutton_hint .= '"'; + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { + $use_backbutton_hint = ' title="'; + $use_backbutton_hint .= Footnotes_Settings::instance()->get( Footnotes_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; + $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; // Compose optional opening link tag with optional hard link, mandatory for instance. - self::$a_str_link_open_tag = ''; - $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 = MCI_Footnotes_Convert::index( ( $l_int_check_index + 1 ), MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); + $footnote_id = Footnotes_Convert::index( ( $check_index + 1 ), Footnotes_Settings::instance()->get( Footnotes_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 = ! $l_int_tooltip_text_length ? false : true; - 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 = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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 = ! $tooltip_text_length ? false : true; + if ( $has_tooltip_text ) { + $not_tooltip_text = substr( $footnote_text, ( $tooltip_text_length + self::$tooltip_shortcode_length ) ); + self::$mirror_tooltip_text = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) ); + if ( self::$mirror_tooltip_text ) { + $tooltip_text = substr( $footnote_text, 0, $tooltip_text_length ); + $reference_text_introducer = Footnotes_Settings::instance()->get( Footnotes_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' => MCI_Footnotes_Convert::index( $l_int_first_footnote_index, MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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' => Footnotes_Convert::index( $first_footnote_index, Footnotes_Settings::instance()->get( Footnotes_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 = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ) ); + self::$scroll_offset = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SCROLL_OFFSET ) ); // Streamline. - $l_bool_collapse_default = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) ); + $collapse_default = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_COLLAPSE ) ); /** * Reference container label. @@ -2783,81 +2783,81 @@ class MCI_Footnotes_Task { * 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 = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME ); + $reference_container_label = Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_NAME ); // Select the reference container template. // Whether AMP compatibility mode is enabled. - if ( MCI_Footnotes::$a_bool_amp_enabled ) { + if ( Footnotes::$amp_enabled ) { // Whether the reference container is collapsed by default. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_COLLAPSE ) ) ) { // Load 'templates/public/amp-reference-container-collapsed.html'. - $l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container-collapsed' ); + $template_container = new Footnotes_Template( Footnotes_Template::PUBLIC, 'amp-reference-container-collapsed' ); } else { // Load 'templates/public/amp-reference-container.html'. - $l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container' ); + $template_container = new Footnotes_Template( Footnotes_Template::PUBLIC, 'amp-reference-container' ); } - } elseif ( 'js' === MCI_Footnotes::$a_str_script_mode ) { + } elseif ( 'js' === Footnotes::$script_mode ) { // Load 'templates/public/js-reference-container.html'. - $l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'js-reference-container' ); + $template_container = new Footnotes_Template( Footnotes_Template::PUBLIC, 'js-reference-container' ); } else { // Load 'templates/public/reference-container.html'. - $l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container' ); + $template_container = new Footnotes_Template( Footnotes_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' === MCI_Footnotes::$a_str_script_mode ) { + if ( 'jquery' === Footnotes::$script_mode ) { - $l_int_scroll_offset = ( self::$a_int_scroll_offset / 100 ); - $l_int_scroll_up_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION ) ); + $scroll_offset = ( self::$scroll_offset / 100 ); + $scroll_up_duration = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SCROLL_DURATION ) ); - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY ) ) ) { + if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY ) ) ) { - $l_int_scroll_down_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION ) ); + $scroll_down_duration = intval( Footnotes_Settings::instance()->get( Footnotes_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 = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY ) ); - $l_int_scroll_up_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY ) ); + $scroll_down_delay = intval( Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SCROLL_DOWN_DELAY ) ); + $scroll_up_delay = intval( Footnotes_Settings::instance()->get( Footnotes_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' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_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' => Footnotes_Settings::instance()->get( Footnotes_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/class/template.php b/class/template.php index 7bf970f..a40ef7e 100644 --- a/class/template.php +++ b/class/template.php @@ -16,7 +16,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Template { +class Footnotes_Template { /** * Directory name for dashboard templates. @@ -24,7 +24,7 @@ class MCI_Footnotes_Template { * @since 1.5.0 * @var string */ - const C_STR_DASHBOARD = 'dashboard'; + const DASHBOARD = 'dashboard'; /** * Directory name for public templates. @@ -32,7 +32,7 @@ class MCI_Footnotes_Template { * @since 1.5.0 * @var string */ - const C_STR_PUBLIC = 'public'; + const PUBLIC = 'public'; /** * Contains the content of the template after initialize. @@ -40,7 +40,7 @@ class MCI_Footnotes_Template { * @since 1.5.0 * @var string */ - private $a_str_original_content = ''; + private $original_content = ''; /** * Contains the content of the template after initialize with replaced place holders. @@ -48,7 +48,7 @@ class MCI_Footnotes_Template { * @since 1.5.0 * @var string */ - private $a_str_replaced_content = ''; + private $replaced_content = ''; /** * Plugin Directory @@ -63,9 +63,9 @@ class MCI_Footnotes_Template { * Class Constructor. Reads and loads the template file without replace any placeholder. * * @since 1.5.0 - * @param string $p_str_file_type Template file type (take a look on the Class constants). - * @param string $p_str_file_name Template file name inside the Template directory without the file extension. - * @param string $p_str_extension Optional Template file extension (default: html). + * @param string $file_type Template file type (take a look on the Class constants). + * @param string $file_name Template file name inside the Template directory without the file extension. + * @param string $extension Optional Template file extension (default: html). * * - Adding: Templates: support for custom templates in sibling folder, thanks to @misfist issue report. * @@ -74,9 +74,9 @@ class MCI_Footnotes_Template { * @reporter @misfist * @link https://wordpress.org/support/topic/template-override-filter/ */ - public function __construct( $p_str_file_type, $p_str_file_name, $p_str_extension = 'html' ) { + public function __construct( $file_type, $file_name, $extension = 'html' ) { // No template file type and/or file name set. - if ( empty( $p_str_file_type ) || empty( $p_str_file_name ) ) { + if ( empty( $file_type ) || empty( $file_name ) ) { return; } @@ -92,7 +92,7 @@ class MCI_Footnotes_Template { * * @since 2.4.0d3 */ - $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 { @@ -105,21 +105,21 @@ class MCI_Footnotes_Template { * Replace all placeholders specified in array. * * @since 1.5.0 - * @param array $p_arr_placeholders Placeholders (key = placeholder, value = value). + * @param array $placeholders Placeholders (key = placeholder, value = value). * @return bool True on Success, False if Placeholders invalid. */ - public function replace( $p_arr_placeholders ) { + public function replace( $placeholders ) { // 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 . ']]', $l_str_value, $this->a_str_replaced_content ); + foreach ( $placeholders as $placeholder => $value ) { + $this->replaced_content = str_replace( '[[' . $placeholder . ']]', $value, $this->replaced_content ); } // Success. return true; @@ -131,7 +131,7 @@ class MCI_Footnotes_Template { * @since 1.5.0 */ public function reload() { - $this->a_str_replaced_content = $this->a_str_original_content; + $this->replaced_content = $this->original_content; } /** @@ -141,7 +141,7 @@ class MCI_Footnotes_Template { * @return string Template content with replaced placeholders. */ public function get_content() { - return $this->a_str_replaced_content; + return $this->replaced_content; } /** @@ -160,14 +160,14 @@ class MCI_Footnotes_Template { */ public function process_template( $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(); } @@ -182,12 +182,12 @@ class MCI_Footnotes_Template { * @contributor @misfist * @link https://wordpress.org/support/topic/template-override-filter/#post-13864301 * - * @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 mixed false | template path */ - public function get_template( $p_str_file_type, $p_str_file_name, $p_str_extension = 'html' ) { + public function get_template( $file_type, $file_name, $extension = 'html' ) { $located = false; /** @@ -200,7 +200,7 @@ class MCI_Footnotes_Template { */ $template_directory = apply_filters( 'mci_footnotes_template_directory', 'footnotes/templates/' ); $custom_directory = apply_filters( 'mci_footnotes_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. diff --git a/class/widgets/base.php b/class/widgets/base.php index d45e234..bfedeff 100644 --- a/class/widgets/base.php +++ b/class/widgets/base.php @@ -18,7 +18,7 @@ * @author Stefan Herndler * @since 1.5.0 */ -abstract class MCI_Footnotes_Widget_Base extends WP_Widget { +abstract class Footnotes_Widget_Base extends WP_Widget { /** * Returns an unique ID as string used for the Widget Base ID. @@ -64,14 +64,14 @@ abstract class MCI_Footnotes_Widget_Base extends WP_Widget { * @since 1.6.4 * @contributor @dartiss * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/widgets/base.php?rev=1445720 - * “The called constructor method for WP_Widget in MCI_Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.” + * “The called constructor method for WP_Widget in Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.” */ 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(), ); @@ -79,8 +79,8 @@ abstract class MCI_Footnotes_Widget_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/class/widgets/reference-container.php b/class/widgets/reference-container.php index 082b90f..eba6940 100644 --- a/class/widgets/reference-container.php +++ b/class/widgets/reference-container.php @@ -12,7 +12,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base { +class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base { /** * Returns an unique ID as string used for the Widget Base ID. @@ -31,7 +31,7 @@ class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base * @return string */ protected function get_name() { - return MCI_Footnotes_Config::C_STR_PLUGIN_NAME; + return Footnotes_Config::PLUGIN_NAME; } /** @@ -69,9 +69,9 @@ class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base public function widget( $args, $instance ) { global $g_obj_mci_footnotes; // Reference container positioning is set to "widget area". - if ( 'widget' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) { + if ( 'widget' === Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_POSITION ) ) { // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $g_obj_mci_footnotes->a_obj_task->reference_container(); + echo $g_obj_mci_footnotes->task->reference_container(); // phpcs:enable } } diff --git a/class/wysiwyg.php b/class/wysiwyg.php index 3579e3c..8645209 100644 --- a/class/wysiwyg.php +++ b/class/wysiwyg.php @@ -12,7 +12,7 @@ * * @since 1.5.0 */ -class MCI_Footnotes_WYSIWYG { +class Footnotes_WYSIWYG { /** * Registers Button hooks. @@ -28,16 +28,16 @@ class MCI_Footnotes_WYSIWYG { * @return void */ public static function register_hooks() { - add_filter( 'mce_buttons', array( 'MCI_Footnotes_WYSIWYG', 'new_visual_editor_button' ) ); - add_action( 'admin_print_footer_scripts', array( 'MCI_Footnotes_WYSIWYG', 'new_plain_text_editor_button' ) ); + add_filter( 'mce_buttons', array( 'Footnotes_WYSIWYG', 'new_visual_editor_button' ) ); + add_action( 'admin_print_footer_scripts', array( 'Footnotes_WYSIWYG', 'new_plain_text_editor_button' ) ); - add_filter( 'mce_external_plugins', array( 'MCI_Footnotes_WYSIWYG', 'include_scripts' ) ); + add_filter( 'mce_external_plugins', array( 'Footnotes_WYSIWYG', 'include_scripts' ) ); // phpcs:disable // 'footnotes_getTags' must match its instance in wysiwyg-editor.js. // 'footnotes_getTags' must match its instance in editor-button.html. - add_action( 'wp_ajax_nopriv_footnotes_getTags', array( 'MCI_Footnotes_WYSIWYG', 'ajax_callback' ) ); - add_action( 'wp_ajax_footnotes_getTags', array( 'MCI_Footnotes_WYSIWYG', 'ajax_callback' ) ); + add_action( 'wp_ajax_nopriv_footnotes_getTags', array( 'Footnotes_WYSIWYG', 'ajax_callback' ) ); + add_action( 'wp_ajax_footnotes_getTags', array( 'Footnotes_WYSIWYG', 'ajax_callback' ) ); // phpcs:enable } @@ -46,12 +46,12 @@ class MCI_Footnotes_WYSIWYG { * Append a new Button to the WYSIWYG editor of Posts and Pages. * * @since 1.5.0 - * @param array $p_arr_buttons pre defined Buttons from WordPress. + * @param array $buttons pre defined Buttons from WordPress. * @return array */ - public static function new_visual_editor_button( $p_arr_buttons ) { - array_push( $p_arr_buttons, MCI_Footnotes_Config::C_STR_PLUGIN_NAME ); - return $p_arr_buttons; + public static function new_visual_editor_button( $buttons ) { + array_push( $buttons, Footnotes_Config::PLUGIN_NAME ); + return $buttons; } /** @@ -60,9 +60,9 @@ class MCI_Footnotes_WYSIWYG { * @since 1.5.0 */ public static function new_plain_text_editor_button() { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'editor-button' ); + $template = new Footnotes_Template( Footnotes_Template::DASHBOARD, 'editor-button' ); // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $l_obj_template->get_content(); + echo $template->get_content(); // phpcs:enable } @@ -70,12 +70,12 @@ class MCI_Footnotes_WYSIWYG { * Includes the Plugins WYSIWYG editor script. * * @since 1.5.0 - * @param array $p_arr_plugins Scripts to be included to the editor. + * @param array $plugins Scripts to be included to the editor. * @return array */ - public static function include_scripts( $p_arr_plugins ) { - $p_arr_plugins[ MCI_Footnotes_Config::C_STR_PLUGIN_NAME ] = plugins_url( '/../js/wysiwyg-editor.js', __FILE__ ); - return $p_arr_plugins; + public static function include_scripts( $plugins ) { + $plugins[ Footnotes_Config::PLUGIN_NAME ] = plugins_url( '/../js/wysiwyg-editor.js', __FILE__ ); + return $plugins; } /** @@ -86,16 +86,16 @@ class MCI_Footnotes_WYSIWYG { */ public static function ajax_callback() { // Get start and end tag for the footnotes short code. - $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); - $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); - if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) { - $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $starting_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START ); + $ending_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SHORT_CODE_END ); + if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) { + $starting_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $ending_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } echo 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/footnotes.php b/footnotes.php index 66d307d..bbf3f6e 100755 --- a/footnotes.php +++ b/footnotes.php @@ -23,7 +23,7 @@ * @since 2.5.3 (Hungarian) * @var str */ -define( 'C_STR_FOOTNOTES_VERSION', '2.7.1' ); +define( 'FOOTNOTES_VERSION', '2.7.1' ); /** * Defines the current environment ('development' or 'production'). @@ -108,10 +108,10 @@ define( 'PRODUCTION_ENV', false ); require_once dirname( __FILE__ ) . '/includes.php'; // Add Plugin Links to the "installed plugins" page. -$l_str_plugin_file = 'footnotes/footnotes.php'; -add_filter( "plugin_action_links_{$l_str_plugin_file}", array( 'Hooks', 'get_plugin_links' ), 10, 2 ); +$plugin_file = 'footnotes/footnotes.php'; +add_filter( "plugin_action_links_{$plugin_file}", array( 'Hooks', 'get_plugin_links' ), 10, 2 ); // Initialize the Plugin. -$g_obj_mci_footnotes = new MCI_Footnotes(); +$g_obj_mci_footnotes = new Footnotes(); // Run the Plugin. $g_obj_mci_footnotes->run(); diff --git a/includes.php b/includes.php index 00ebb6c..01f0321 100644 --- a/includes.php +++ b/includes.php @@ -12,24 +12,24 @@ * * @author Stefan Herndler * @since 1.5.0 - * @param string $p_str_directory Absolute Directory path to lookup for `*.php` files. + * @param string $directory Absolute Directory path to lookup for `*.php` files. */ -function mci_footnotes_require_php_files( $p_str_directory ) { +function mci_footnotes_require_php_files( $directory ) { // Append slash at the end of the Directory if not exist. - if ( '/' !== substr( $p_str_directory, -1 ) ) { - $p_str_directory .= '/'; + if ( '/' !== substr( $directory, -1 ) ) { + $directory .= '/'; } // Get all PHP files inside Directory. - $l_arr_files = scandir( $p_str_directory ); + $files = scandir( $directory ); // Iterate through each class. - foreach ( $l_arr_files as $l_str_file_name ) { + foreach ( $files as $file_name ) { // Skip all non-PHP files. - if ( '.php' !== strtolower( substr( $l_str_file_name, -4 ) ) ) { + if ( '.php' !== strtolower( substr( $file_name, -4 ) ) ) { continue; } // phpcs:disable Generic.Commenting.DocComment.MissingShort /** @noinspection PhpIncludeInspection */ - require_once $p_str_directory . $l_str_file_name; + require_once $directory . $file_name; // phpcs:enable } }