diff --git a/src/admin/class-admin.php b/src/admin/class-admin.php index c9d02a0..dca4f23 100644 --- a/src/admin/class-admin.php +++ b/src/admin/class-admin.php @@ -15,7 +15,7 @@ declare(strict_types=1); namespace footnotes\admin; -use footnotes\includes as Includes; +use footnotes\includes\Footnotes; /** * Class provide all admin-specific functionality of the plugin. @@ -47,7 +47,7 @@ class Admin { * * @access private * @since 2.8.0 - * @see Includes\Footnotes::$plugin_name + * @see Footnotes::$plugin_name */ private string $plugin_name, @@ -56,7 +56,7 @@ class Admin { * * @access private * @since 2.8.0 - * @see Includes\Footnotes::$version + * @see Footnotes::$version */ private string $version ) { diff --git a/src/admin/class-wysiwyg.php b/src/admin/class-wysiwyg.php index d250763..77c8cd6 100644 --- a/src/admin/class-wysiwyg.php +++ b/src/admin/class-wysiwyg.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace footnotes\admin; -use footnotes\includes as Includes; +use footnotes\includes\{Settings, Template}; /** * Class providing WYSIWYG editor intergration for the plugin. @@ -47,7 +47,7 @@ class WYSIWYG { * @since 1.5.0 */ public static function new_plain_text_editor_button(): void { - $template = new Includes\Template( \footnotes\includes\Template::DASHBOARD, 'editor-button' ); + $template = new Template( Template::DASHBOARD, 'editor-button' ); // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped echo $template->get_content(); // phpcs:enable @@ -75,11 +75,11 @@ class WYSIWYG { */ public static function ajax_callback(): void { // Get start and end tag for the footnotes short code. - $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START ); - $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END ); + $starting_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_START ); + $ending_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_END ); if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) { - $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $starting_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $ending_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } echo wp_json_encode( array( diff --git a/src/admin/layout/class-engine.php b/src/admin/layout/class-engine.php index 5aa289b..8340987 100644 --- a/src/admin/layout/class-engine.php +++ b/src/admin/layout/class-engine.php @@ -9,15 +9,15 @@ * * @package footnotes * @since 1.5.0 - * @since 2.8.0 Rename file from `layout.php` to `class-footnotes-layout-engine.php`, - * rename `dashboard/` sub-directory to `layout/`. + * @since 2.8.0 Rename file from `layout.php` to `class-engine.php`, + * rename `dashboard/` sub-directory to `layout/`. */ declare(strict_types=1); namespace footnotes\admin\layout; -use footnotes\includes as Includes; +use footnotes\includes\{Settings, Convert, Admin}; require_once plugin_dir_path( __DIR__ ) . 'layout/class-init.php'; @@ -100,7 +100,7 @@ abstract class Engine { * @since 1.5.0 */ public function add_settings_sections(): void { - $this->sections[Includes\Settings::instance()->general_settings->get_section_slug()] = Includes\Settings::instance()->general_settings; + $this->sections[Settings::instance()->settings_sections['general']->get_section_slug()] = Settings::instance()->settings_sections['general']; /*foreach ( $this->get_sections() as $section ) { // Append tab to the tab-array. @@ -366,7 +366,7 @@ abstract class Engine { $return = array(); $return['id'] = $setting_key_name; $return['name'] = $setting_key_name; - $return['value'] = esc_attr( Includes\Settings::instance()->get( $setting_key_name ) ); + $return['value'] = esc_attr( Settings::instance()->get( $setting_key_name ) ); return $return; } @@ -469,7 +469,7 @@ abstract class Engine { '', $data['name'], $data['id'], - Includes\Convert::to_bool( $data['value'] ) ? 'checked="checked"' : '' + Convert::to_bool( $data['value'] ) ? 'checked="checked"' : '' ); } @@ -640,7 +640,7 @@ abstract class Engine { * @access private * * @since 1.5.0 - * @todo Move to {@see Includes\Admin}. + * @todo Move to {@see Admin}. */ private function append_scripts(): void { wp_enqueue_script( 'postbox' ); @@ -663,11 +663,11 @@ abstract class Engine { $active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->sections ); $active_section = $this->sections[ $active_section_id ]; - foreach ( array_keys( Includes\Settings::instance()->get_defaults( $active_section['container'] ) ) as $key ) { + foreach ( array_keys( Settings::instance()->get_defaults( $active_section['container'] ) ) as $key ) { $new_settings[ $key ] = array_key_exists( $key, $_POST ) ? wp_unslash( $_POST[ $key ] ) : ''; } // Update settings. - return Includes\Settings::instance()->save_options( $active_section['container'], $new_settings ); + return Settings::instance()->save_options( $active_section['container'], $new_settings ); } } diff --git a/src/admin/layout/class-init.php b/src/admin/layout/class-init.php index 08a0dee..5fb8c08 100644 --- a/src/admin/layout/class-init.php +++ b/src/admin/layout/class-init.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace footnotes\admin\layout; -use footnotes\includes as Includes; +use footnotes\includes\{Settings, Config}; /** * Class to initialise all defined page layouts. @@ -43,7 +43,7 @@ class Init { * * @since 1.5.0 */ - private Settings $settings; + private SettingsPage $settings; /** * Initializes all WordPress hooks for the Plugin Settings. @@ -64,7 +64,7 @@ class Init { ) { $this->load_dependencies(); - $this->settings = new Settings( $this->plugin_name ); + $this->settings = new SettingsPage( $this->plugin_name ); // Register hooks/actions. add_action( @@ -92,9 +92,9 @@ class Init { * @since 1.5.0 */ public function initialize_settings(): void { - Includes\Settings::instance()->register_settings(); + Settings::instance()->register_settings(); - Includes\Settings::instance()->general_settings->add_settings_section(); + Settings::instance()->settings_sections['general']->add_settings_section(); $this->settings->add_settings_sections(); $this->settings->add_settings_fields(); } @@ -108,7 +108,7 @@ class Init { public function register_options_submenu(): void { add_options_page( 'footnotes Settings', - \footnotes\includes\Config::PLUGIN_PUBLIC_NAME, + Config::PLUGIN_PUBLIC_NAME, 'manage_options', self::MAIN_MENU_SLUG, fn() => $this->settings->display_content() @@ -184,8 +184,8 @@ class Init { * * Include the following files that make up the plugin: * - * - {@see Includes\Config}: defines plugin constants; - * - {@see Includes\Settings}: defines configurable plugin settings; and + * - {@see Config}: defines plugin constants; + * - {@see Settings}: defines configurable plugin settings; and * - {@see Settings}: defines the plugin settings page. * * @access private @@ -206,7 +206,7 @@ class Init { /** * Represents the plugin settings dashboard page. */ - require_once plugin_dir_path( __DIR__ ) . 'layout/class-settings.php'; + require_once plugin_dir_path( __DIR__ ) . 'layout/class-settings-page.php'; } // phpcs:enable WordPress.Security.NonceVerification.Missing } diff --git a/src/includes/class-activator.php b/src/includes/class-activator.php index 63a7d1a..d6291f5 100644 --- a/src/includes/class-activator.php +++ b/src/includes/class-activator.php @@ -6,8 +6,8 @@ * the admin- and the public-facing sides of the plugin. * * The primary entry point is {@see Footnotes}, which uses {@see Loader} - * to initialise {@see i18n} for internationalization, {@see Admin\Admin} for - * admin-specific functionality and {@see General\General} for public-facing + * to initialise {@see i18n} for internationalization, {@see Admin} for + * admin-specific functionality and {@see General} for public-facing * functionality. * * It also includes various utility classes: @@ -29,6 +29,9 @@ declare(strict_types=1); namespace footnotes\includes; +use footnotes\admin\Admin; +use footnotes\general\General; + /** * Class providing action(s) on plugin activation. * diff --git a/src/includes/class-config.php b/src/includes/class-config.php index 5b1786f..3190425 100644 --- a/src/includes/class-config.php +++ b/src/includes/class-config.php @@ -6,8 +6,8 @@ * the admin- and the public-facing sides of the plugin. * * The primary entry point is {@see Footnotes}, which uses {@see Loader} - * to initialise {@see i18n} for internationalization, {@see Admin\Admin} for - * admin-specific functionality and {@see General\General} for public-facing + * to initialise {@see i18n} for internationalization, {@see Admin} for + * admin-specific functionality and {@see General} for public-facing * functionality. * * It also includes various utility classes: @@ -33,6 +33,9 @@ declare(strict_types=1); namespace footnotes\includes; +use footnotes\admin\Admin; +use footnotes\general\General; + /** * Class defining plugin constants. * diff --git a/src/includes/class-core.php b/src/includes/class-core.php index 2c1ed31..12a9e9b 100644 --- a/src/includes/class-core.php +++ b/src/includes/class-core.php @@ -6,8 +6,8 @@ * the admin- and the public-facing sides of the plugin. * * The primary entry point is {@see Footnotes}, which uses {@see Loader} - * to initialise {@see i18n} for internationalization, {@see Admin\Admin} for - * admin-specific functionality and {@see General\General} for public-facing + * to initialise {@see i18n} for internationalization, {@see Admin} for + * admin-specific functionality and {@see General} for public-facing * functionality. * * It also includes various utility classes: @@ -31,8 +31,8 @@ declare(strict_types=1); namespace footnotes\includes; -use footnotes\general as General; -use footnotes\admin as Admin; +use footnotes\admin\Admin; +use footnotes\general\General; /** * Class providing core plugin functionality. @@ -43,7 +43,7 @@ use footnotes\admin as Admin; * @package footnotes * @since 1.5.0 * @since 2.8.0 Renamed class from `Footnotes` to `Core`. - * Moved under `footnotes\includes` namespace. + * Moved under `footnotes\includes` namespace. */ class Core { /** @@ -54,7 +54,7 @@ class Core { * * @var Loader $loader Maintains and registers all hooks for the plugin. */ - protected \footnotes\includes\Loader $loader; + protected Loader $loader; /** * The unique identifier of this plugin @@ -146,8 +146,8 @@ class Core { * - {@see Convert}: provides conversion methods; * - {@see Settings}: defines customisable plugin settings; * - {@see Template}: handles template rendering; - * - {@see Admin\Admin}: defines all hooks for the admin area; and - * - {@see General\Public}: defines all hooks for the public side of the site. + * - {@see Admin}: defines all hooks for the admin area; and + * - {@see General}: defines all hooks for the public side of the site. * * Creates an instance of the loader which will be used to register the hooks * with WordPress. @@ -215,14 +215,14 @@ class Core { * plugin. * * @since 1.5.0 - * @since 2.8.0 Moved hook registrations from various classes into `Admin\Admin`. - * @see Admin\Admin Defines admin functionality. + * @since 2.8.0 Moved hook registrations from various classes into `Admin`. + * @see Admin Defines admin functionality. * * @return void */ private function define_admin_hooks() { - $admin = new Admin\Admin( $this->get_plugin_name(), $this->get_version() ); + $admin = new Admin( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_styles' ); $this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_scripts' ); @@ -246,13 +246,13 @@ class Core { * the plugin. * * @since 2.8.0 - * @see General\General Defines public-facing functionality. + * @see General Defines public-facing functionality. * * @return void */ private function define_public_hooks() { - $general = new General\General( $this->get_plugin_name(), $this->get_version() ); + $general = new General( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( 'wp_enqueue_scripts', $general, 'enqueue_styles' ); $this->loader->add_action( 'wp_enqueue_scripts', $general, 'enqueue_scripts' ); diff --git a/src/includes/class-settings.php b/src/includes/class-settings.php index 587597a..5888b8a 100644 --- a/src/includes/class-settings.php +++ b/src/includes/class-settings.php @@ -12,6 +12,8 @@ declare(strict_types=1); namespace footnotes\includes; +use footnotes\includes\settings\Setting; + /** * Provides data conversion methods. * @@ -19,7 +21,12 @@ namespace footnotes\includes; */ require_once plugin_dir_path( __DIR__ ) . 'includes/class-convert.php'; -use footnotes\includes\settings\GeneralSettingsSection; +use footnotes\includes\settings\{ + GeneralSettingsSection, + ReferrersAndTooltipsSettingsSection, + ScopeAndPrioritySettingsSection, + CustomCSSSettingsSection +}; /** * Class defining configurable plugin settings. diff --git a/src/includes/settings/class-setting.php b/src/includes/settings/class-setting.php index 0ca69f0..4d2f6a8 100644 --- a/src/includes/settings/class-setting.php +++ b/src/includes/settings/class-setting.php @@ -10,13 +10,15 @@ declare(strict_types=1); namespace footnotes\includes\settings; +use footnotes\includes\Settings; + /** * Class defining a configurable plugin setting. * * @package footnotes * @since 2.8.0 */ -class Setting { +class Setting { /** * Setting value. * diff --git a/src/includes/settings/general/class-reference-container-settings-group.php b/src/includes/settings/general/class-reference-container-settings-group.php index 5580b9c..89fbf74 100644 --- a/src/includes/settings/general/class-reference-container-settings-group.php +++ b/src/includes/settings/general/class-reference-container-settings-group.php @@ -12,9 +12,9 @@ namespace footnotes\includes\settings\general; require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php'; +use footnotes\includes\Settings; use footnotes\includes\settings\Setting; use footnotes\includes\settings\SettingsGroup; -use footnotes\admin\layout\Settings as SettingsLayout; /** * Class defining the reference container settings. diff --git a/src/public/class-general.php b/src/public/class-general.php index f584bc4..d836c78 100644 --- a/src/public/class-general.php +++ b/src/public/class-general.php @@ -10,7 +10,12 @@ declare(strict_types=1); namespace footnotes\general; -use footnotes\includes as Includes; +use footnotes\includes\{Footnotes, Convert, Settings}; + +use const footnotes\includes\settings\general\ReferenceContainerSettingsGroup\{ + FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, + FOOTNOTES_PAGE_LAYOUT_SUPPORT +}; /** * Class provide all public-facing functionality of the plugin. @@ -56,7 +61,7 @@ class General { * The footnote parser. * * @since 1.5.0 - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. * @todo Review null init. * * @var Parser $task The Plugin task. @@ -67,7 +72,7 @@ class General { * Flag for using tooltips. * * @since 2.4.0 - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. * * @var bool $tooltips_enabled Whether tooltips are enabled or not. */ @@ -77,7 +82,7 @@ class General { * Allows to determine whether alternative tooltips are enabled. * * @since 2.1.1 - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. * * @var bool */ @@ -87,7 +92,7 @@ class General { * Allows to determine whether AMP compatibility mode is enabled. * * @since 2.6.0 - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. * * @var bool */ @@ -97,7 +102,7 @@ class General { * Allows to determine the script mode among jQuery or plain JS. * * @since 2.5.6 - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. * * @var string ‘js’ to use plain JavaScript, ‘jquery’ to use jQuery. */ @@ -118,10 +123,10 @@ class General { $this->load_dependencies(); // Set conditions re-used for stylesheet enqueuing and in class/task.php. - self::$amp_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) ); - self::$tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); - self::$alternative_tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); - self::$script_mode = Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); + self::$amp_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) ); + self::$tooltips_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); + self::$alternative_tooltips_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); + self::$script_mode = Settings::instance()->get( 'foo'/*FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE*/ ); } /** @@ -157,7 +162,7 @@ class General { * * @since 1.5.0 * @since 2.5.5 Change stylesheet schema. - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. */ public function enqueue_styles(): void { if ( PRODUCTION_ENV ) { @@ -183,7 +188,7 @@ class General { } // Set basic responsive page layout mode for use in stylesheet name. - $page_layout_option = Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_PAGE_LAYOUT_SUPPORT ); + $page_layout_option = Settings::instance()->get( FOOTNOTES_PAGE_LAYOUT_SUPPORT ); switch ( $page_layout_option ) { case 'reference-container': $layout_mode = '1'; @@ -236,7 +241,7 @@ class General { * @since 2.0.0 Add jQueryUI dependency. * @since 2.1.2 Add jQuery Tools dependency. * @since 2.5.6 Add jQuery dependency. - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. */ public function enqueue_scripts(): void { /* @@ -285,7 +290,7 @@ class General { * Register the widget(s) for the public-facing side of the site. * * @since 1.5.0 - * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}. + * @since 2.8.0 Moved from {@see Footnotes} to {@see General}. */ public function register_widgets(): void { register_widget( $this->reference_container_widget ); diff --git a/src/public/class-parser.php b/src/public/class-parser.php index 41c5c5b..5d103a1 100644 --- a/src/public/class-parser.php +++ b/src/public/class-parser.php @@ -13,7 +13,39 @@ declare(strict_types=1); namespace footnotes\general; -use footnotes\includes as Includes; +use footnotes\includes\{Settings, Convert, Template}; +use const footnotes\includes\settings\general\ReferenceContainerSettingsGroup\{ + COMBINE_IDENTICAL_FOOTNOTES, + REFERENCE_CONTAINER_NAME, + REFERENCE_CONTAINER_LABEL_ELEMENT, + REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, + REFERENCE_CONTAINER_COLLAPSE, + REFERENCE_CONTAINER_START_PAGE_ENABLE, + REFERENCE_CONTAINER_TOP_MARGIN, + REFERENCE_CONTAINER_BOTTOM_MARGIN, + REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, + BACKLINKS_COLUMN_WIDTH_ENABLED, + BACKLINKS_COLUMN_WIDTH_SCALAR, + BACKLINKS_COLUMN_WIDTH_UNIT, + BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, + BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, + BACKLINKS_COLUMN_MAX_WIDTH_UNIT, + REFERENCE_CONTAINER_POSITION, + FOOTNOTE_SECTION_SHORTCODE, + REFERENCE_CONTAINER_POSITION_SHORTCODE, + FOOTNOTE_URL_WRAP_ENABLED, + LINK_ELEMENT_ENABLED, + REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, + REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, + BACKLINKS_SEPARATOR_ENABLED, + BACKLINKS_SEPARATOR_OPTION, + BACKLINKS_SEPARATOR_CUSTOM, + BACKLINKS_TERMINATOR_ENABLED, + BACKLINKS_TERMINATOR_OPTION, + BACKLINKS_TERMINATOR_CUSTOM, + REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, + BACKLINKS_LINE_BREAKS_ENABLED +}; /** * Searches and replaces the footnotes and generates the reference container. @@ -272,11 +304,11 @@ class Parser { */ public function register_hooks(): void { // Get values from settings. - $the_title_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ); - $the_content_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ); - $the_excerpt_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ); - $widget_title_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ); - $widget_text_priority = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL ); + $the_title_priority = (int) Settings::instance()->get( Settings::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ); + $the_content_priority = (int) Settings::instance()->get( Settings::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ); + $the_excerpt_priority = (int) Settings::instance()->get( Settings::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ); + $widget_title_priority = (int) Settings::instance()->get( Settings::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ); + $widget_text_priority = (int) Settings::instance()->get( Settings::EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL ); // PHP_INT_MAX can be set by -1. $the_title_priority = ( -1 === $the_title_priority ) ? PHP_INT_MAX : $the_title_priority; @@ -299,7 +331,7 @@ class Parser { PHP_INT_MAX ); - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_TITLE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::EXPERT_LOOKUP_THE_TITLE ) ) ) { add_filter( 'the_title', fn( string $content): string => $this->footnotes_in_title( $content ), @@ -308,7 +340,7 @@ class Parser { } // Configurable priority level for reference container relative positioning; default 98. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_CONTENT ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::EXPERT_LOOKUP_THE_CONTENT ) ) ) { add_filter( 'the_content', fn( string $content): string => $this->footnotes_in_content( $content ), @@ -350,7 +382,7 @@ class Parser { ); } - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_THE_EXCERPT ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::EXPERT_LOOKUP_THE_EXCERPT ) ) ) { /** * Adds a filter to the excerpt hook. * @@ -366,7 +398,7 @@ class Parser { ); } - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TITLE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::EXPERT_LOOKUP_WIDGET_TITLE ) ) ) { /** * TODO */ @@ -377,7 +409,7 @@ class Parser { ); } - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::EXPERT_LOOKUP_WIDGET_TEXT ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::EXPERT_LOOKUP_WIDGET_TEXT ) ) ) { /** * TODO */ @@ -409,7 +441,7 @@ class Parser { * * Native smooth scrolling only works in recent browsers. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING ) ) ) { echo "html {scroll-behavior: smooth;}\r\n"; } @@ -419,7 +451,7 @@ class Parser { * Cannot be included in external stylesheet, as it is only optional. * The scope is variable too: referrers only, or all superscript elements. */ - $normalize_superscript = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ); + $normalize_superscript = Settings::instance()->get( Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ); if ( 'no' !== $normalize_superscript ) { if ( 'all' === $normalize_superscript ) { echo 'sup {'; @@ -430,14 +462,14 @@ class Parser { } // Reference container display on home page. - if ( ! Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_START_PAGE_ENABLE ) ) ) { + if ( ! Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_START_PAGE_ENABLE['key'] ) ) ) { echo ".home .footnotes_reference_container { display: none; }\r\n"; } // Reference container top and bottom margins. - $reference_container_top_margin = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_TOP_MARGIN ); - $reference_container_bottom_margin = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BOTTOM_MARGIN ); + $reference_container_top_margin = (int) Settings::instance()->get( REFERENCE_CONTAINER_TOP_MARGIN['key'] ); + $reference_container_bottom_margin = (int) Settings::instance()->get( REFERENCE_CONTAINER_BOTTOM_MARGIN['key'] ); echo '.footnotes_reference_container {margin-top: '; echo empty( $reference_container_top_margin ) ? '0' : $reference_container_top_margin; echo 'px !important; margin-bottom: '; @@ -445,9 +477,9 @@ class Parser { echo "px !important;}\r\n"; // Reference container label bottom border. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER['key'] ) ) ) { echo '.footnote_container_prepare > '; - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_ELEMENT ); + echo Settings::instance()->get( REFERENCE_CONTAINER_LABEL_ELEMENT ); echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n"; } @@ -460,7 +492,7 @@ class Parser { * issues as browsers won’t reload these style sheets after settings are * changed while the version string is not. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_ROW_BORDERS_ENABLE['key'] ) ) ) { echo '.footnotes_table, .footnotes_plugin_reference_row {'; echo 'border: 1px solid #060606;'; echo " !important;}\r\n"; @@ -470,16 +502,16 @@ class Parser { } // Ref container first column width and max-width. - $column_width_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_ENABLED ) ); - $column_max_width_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED ) ); + $column_width_enabled = Convert::to_bool( Settings::instance()->get( BACKLINKS_COLUMN_WIDTH_ENABLED['key'] ) ); + $column_max_width_enabled = Convert::to_bool( Settings::instance()->get( BACKLINKS_COLUMN_MAX_WIDTH_ENABLED['key'] ) ); if ( $column_width_enabled || $column_max_width_enabled ) { echo '.footnote-reference-container { table-layout: fixed; }'; echo '.footnote_plugin_index, .footnote_plugin_index_combi {'; if ( $column_width_enabled ) { - $column_width_scalar = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_SCALAR ); - $column_width_unit = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_WIDTH_UNIT ); + $column_width_scalar = Settings::instance()->get( BACKLINKS_COLUMN_WIDTH_SCALAR['key'] ); + $column_width_unit = Settings::instance()->get( BACKLINKS_COLUMN_WIDTH_UNIT['key'] ); if ( ! empty( $column_width_scalar ) ) { if ( '%' === $column_width_unit && $column_width_scalar > 100 ) { @@ -493,8 +525,8 @@ class Parser { } if ( $column_max_width_enabled ) { - $column_max_width_scalar = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_SCALAR ); - $column_max_width_unit = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_COLUMN_MAX_WIDTH_UNIT ); + $column_max_width_scalar = Settings::instance()->get( BACKLINKS_COLUMN_MAX_WIDTH_SCALAR['key'] ); + $column_max_width_unit = Settings::instance()->get( BACKLINKS_COLUMN_MAX_WIDTH_UNIT['key'] ); if ( ! empty( $column_max_width_scalar ) ) { if ( '%' === $column_max_width_unit && $column_max_width_scalar > 100 ) { @@ -511,14 +543,14 @@ class Parser { } // Hard links scroll offset. - self::$hard_links_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_HARD_LINKS_ENABLE ) ); + self::$hard_links_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_HARD_LINKS_ENABLE ) ); // Correct hard links enabled status depending on AMP-compatible or alternative reference container enabled status. if ( General::$amp_enabled || 'jquery' !== General::$script_mode ) { self::$hard_links_enabled = true; } - self::$scroll_offset = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_OFFSET ); + self::$scroll_offset = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_OFFSET ); if ( self::$hard_links_enabled ) { echo '.footnote_referrer_anchor, .footnote_item_anchor {bottom: '; echo self::$scroll_offset; @@ -531,46 +563,46 @@ class Parser { // Tooltip appearance: Tooltip font size. echo ' font-size: '; - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) { - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR ); - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FONT_SIZE_UNIT ); + if ( Convert::to_bool( Settings::instance()->get( Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) { + echo Settings::instance()->get( Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR ); + echo Settings::instance()->get( Settings::MOUSE_OVER_BOX_FONT_SIZE_UNIT ); } else { echo 'inherit'; } echo ' !important;'; // Tooltip Text color. - $color = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR ); + $color = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR ); if ( ! empty( $color ) ) { printf( ' color: %s !important;', $color ); } // Tooltip Background color. - $background = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); + $background = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); if ( ! empty( $background ) ) { printf( ' background-color: %s !important;', $background ); } // Tooltip Border width. - $border_width = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); + $border_width = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); if ( ! empty( $border_width ) && (int) $border_width > 0 ) { printf( ' border-width: %dpx !important; border-style: solid !important;', $border_width ); } // Tooltip Border color. - $border_color = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ); + $border_color = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ); if ( ! empty( $border_color ) ) { printf( ' border-color: %s !important;', $border_color ); } // Tooltip Corner radius. - $border_radius = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); + $border_radius = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); if ( ! empty( $border_radius ) && (int) $border_radius > 0 ) { printf( ' border-radius: %dpx !important;', $border_radius ); } // Tooltip Shadow color. - $box_shadow_color = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ); + $box_shadow_color = Settings::instance()->get( 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 ); @@ -584,7 +616,7 @@ class Parser { * * Position and timing of jQuery tooltips are script-defined. */ - $max_width = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); + $max_width = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); if ( ! empty( $max_width ) && (int) $max_width > 0 ) { printf( ' max-width: %dpx !important;', $max_width ); } @@ -595,7 +627,7 @@ class Parser { echo "}\r\n"; // Dimensions. - $alternative_tooltip_width = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ); + $alternative_tooltip_width = (int) Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ); echo '.footnote_tooltip.position {'; echo ' width: max-content; '; @@ -603,8 +635,8 @@ class Parser { echo ' max-width: ' . $alternative_tooltip_width . 'px;'; // Position. - $alternative_position = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); - $offset_x = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ); + $alternative_position = Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); + $offset_x = (int) Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ); if ( 'top left' === $alternative_position || 'bottom left' === $alternative_position ) { echo ' right: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;'; @@ -612,7 +644,7 @@ class Parser { echo ' left: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;'; } - $offset_y = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ); + $offset_y = (int) Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ); if ( 'top left' === $alternative_position || 'top right' === $alternative_position ) { echo ' bottom: ' . ( empty( $offset_y ) ? 0 : $offset_y ) . 'px;'; @@ -622,13 +654,13 @@ class Parser { echo "}\r\n"; // Timing. - $fade_in_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ); + $fade_in_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ); $fade_in_delay = empty( $fade_in_delay ) ? '0' : $fade_in_delay; - $fade_in_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ); + $fade_in_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ); $fade_in_duration = empty( $fade_in_duration ) ? '0' : $fade_in_duration; - $fade_out_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ); + $fade_out_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ); $fade_out_delay = empty( $fade_out_delay ) ? '0' : $fade_out_delay; - $fade_out_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ); + $fade_out_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ); $fade_out_duration = empty( $fade_out_duration ) ? '0' : $fade_out_duration; /* @@ -674,11 +706,11 @@ class Parser { * Set custom CSS to override settings, not conversely. * Legacy Custom CSS is used until it’s set to disappear after dashboard tab migration. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS_LEGACY_ENABLE ) ) ) { - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS ); + if ( Convert::to_bool( Settings::instance()->get( Settings::CUSTOM_CSS_LEGACY_ENABLE ) ) ) { + echo Settings::instance()->get( Settings::CUSTOM_CSS ); echo "\r\n"; } - echo Includes\Settings::instance()->get( \footnotes\includes\Settings::CUSTOM_CSS_NEW ); + echo Settings::instance()->get( Settings::CUSTOM_CSS_NEW ); // Insert end tag without switching out of PHP. echo "\r\n\r\n"; @@ -711,17 +743,17 @@ class Parser { * @since 1.5.0 */ public function footnotes_output_footer(): void { - if ( 'footer' === Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION ) ) { + if ( 'footer' === Settings::instance()->get( REFERENCE_CONTAINER_POSITION['key'] ) ) { echo $this->reference_container(); } // Get setting for love and share this plugin. - $love_me_index = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_LOVE ); + $love_me_index = Settings::instance()->get( Settings::FOOTNOTES_LOVE ); // Check if the admin allows to add a link to the footer. 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. - $linked_name = sprintf( '%s', \footnotes\includes\Config::PLUGIN_PUBLIC_NAME ); + $linked_name = sprintf( '%s', Config::PLUGIN_PUBLIC_NAME ); // Get random love me text. if ( 'random' === strtolower( $love_me_index ) ) { $love_me_index = 'text-' . wp_rand( 1, 7 ); @@ -730,7 +762,7 @@ class Parser { // Options named wrt backcompat, simplest is default. case 'text-1': /* Translators: 2: Link to plugin page 1: Love heart symbol */ - $love_me_text = sprintf( __( 'I %2$s %1$s', 'footnotes' ), $linked_name, \footnotes\includes\Config::LOVE_SYMBOL ); + $love_me_text = sprintf( __( 'I %2$s %1$s', 'footnotes' ), $linked_name, Config::LOVE_SYMBOL ); break; case 'text-2': /* Translators: %s: Link to plugin page */ @@ -738,11 +770,11 @@ class Parser { break; case 'text-4': /* Translators: 1: Link to plugin page 2: Love heart symbol */ - $love_me_text = sprintf( '%1$s %2$s', $linked_name, \footnotes\includes\Config::LOVE_SYMBOL ); + $love_me_text = sprintf( '%1$s %2$s', $linked_name, Config::LOVE_SYMBOL ); break; case 'text-5': /* Translators: 1: Love heart symbol 2: Link to plugin page */ - $love_me_text = sprintf( '%1$s %2$s', \footnotes\includes\Config::LOVE_SYMBOL, $linked_name ); + $love_me_text = sprintf( '%1$s %2$s', Config::LOVE_SYMBOL, $linked_name ); break; case 'text-6': /* Translators: %s: Link to plugin page */ @@ -784,8 +816,8 @@ class Parser { */ public function footnotes_in_content( string $content ): string { - $ref_container_position = Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION ); - $footnote_section_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_SECTION_SHORTCODE ); + $ref_container_position = Settings::instance()->get( REFERENCE_CONTAINER_POSITION['key'] ); + $footnote_section_shortcode = Settings::instance()->get( FOOTNOTE_SECTION_SHORTCODE['key'] ); $footnote_section_shortcode_length = strlen( $footnote_section_shortcode ); // TODO: Replace with `str_contains()`, but currently breaks Rector downgrade. @@ -833,7 +865,7 @@ class Parser { * @return string $excerpt Processed or new excerpt. */ public function footnotes_in_excerpt( string $excerpt ): string { - $excerpt_mode = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_IN_EXCERPT ); + $excerpt_mode = Settings::instance()->get( Settings::FOOTNOTES_IN_EXCERPT ); if ( 'yes' === $excerpt_mode ) { return $this->generate_excerpt_with_footnotes( $excerpt ); @@ -1021,7 +1053,7 @@ class Parser { public function footnotes_in_widget_text( string $content ): string { // phpcs:disable WordPress.PHP.YodaConditions.NotYoda // Appends the reference container if set to "post_end". - return $this->exec( $content, 'post_end' === Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION ) ); + return $this->exec( $content, 'post_end' === Settings::instance()->get( REFERENCE_CONTAINER_POSITION['key'] ) ); // phpcs:enable WordPress.PHP.YodaConditions.NotYoda } @@ -1044,7 +1076,7 @@ class Parser { */ // Append the reference container or insert at shortcode. - $reference_container_position_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_POSITION_SHORTCODE ); + $reference_container_position_shortcode = Settings::instance()->get( REFERENCE_CONTAINER_POSITION_SHORTCODE['key'] ); if ( empty( $reference_container_position_shortcode ) ) { $reference_container_position_shortcode = '[[references]]'; } @@ -1069,9 +1101,9 @@ class Parser { $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( $content, \footnotes\includes\Config::NO_LOVE_SLUG ) ) { + if ( strpos( $content, Config::NO_LOVE_SLUG ) ) { self::$allow_love_me = false; - $content = str_replace( \footnotes\includes\Config::NO_LOVE_SLUG, '', $content ); + $content = str_replace( Config::NO_LOVE_SLUG, '', $content ); } // Return the content with replaced footnotes and optional reference container appended. return $content; @@ -1092,11 +1124,11 @@ class Parser { public function unify_delimiters( string $content ): string { // Get footnotes start and end tag short codes. - $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START ); - $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END ); + $starting_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_START ); + $ending_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_END ); if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) { - $starting_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $ending_tag = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); + $starting_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); + $ending_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } // If any footnotes short code is empty, return the content without changes. @@ -1169,7 +1201,7 @@ class Parser { */ // If enabled. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) { // Apply different regex depending on whether start shortcode is double/triple opening parenthesis. if ( '((' === self::$start_tag || '(((' === self::$start_tag ) { @@ -1238,7 +1270,7 @@ class Parser { } while ( preg_match( $value_regex, $content ) ); // Optionally moves footnotes outside at the end of the label element. - $label_issue_solution = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION ); + $label_issue_solution = Settings::instance()->get( Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION ); if ( 'move' === $label_issue_solution ) { @@ -1309,29 +1341,29 @@ class Parser { if ( General::$amp_enabled ) { // Whether first clicking a referrer needs to expand the reference container. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) ) ) { // Load 'public/partials/amp-footnote-expand.html'. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-footnote-expand' ); + $template = new Template( Template::PUBLIC, 'amp-footnote-expand' ); } else { // Load 'public/partials/amp-footnote.html'. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-footnote' ); + $template = new Template( Template::PUBLIC, 'amp-footnote' ); } } elseif ( General::$alternative_tooltips_enabled ) { // Load 'public/partials/footnote-alternative.html'. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'footnote-alternative' ); + $template = new Template( Template::PUBLIC, 'footnote-alternative' ); // Else jQuery tooltips are enabled. } else { // Load 'public/partials/footnote.html'. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'footnote' ); + $template = new Template( Template::PUBLIC, 'footnote' ); // Load tooltip inline script. - $template_tooltip = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'tooltip' ); + $template_tooltip = new Template( Template::PUBLIC, 'tooltip' ); } } @@ -1360,7 +1392,7 @@ class Parser { $footnote_text = substr( $content, $pos_start + strlen( self::$start_tag ), $length - strlen( self::$start_tag ) ); // Get tooltip text if present. - self::$tooltip_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ); + self::$tooltip_shortcode = Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ); self::$tooltip_shortcode_length = strlen( self::$tooltip_shortcode ); $tooltip_text_length = strpos( $footnote_text, (string) self::$tooltip_shortcode ); $has_tooltip_text = (bool) $tooltip_text_length; @@ -1384,7 +1416,7 @@ class Parser { * * TODO: Split into own method. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_URL_WRAP_ENABLED ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( FOOTNOTE_URL_WRAP_ENABLED['key'] ) ) ) { $footnote_text = preg_replace( '#(?get( \footnotes\includes\Settings::REFERRER_FRAGMENT_ID_SLUG ); - self::$footnote_link_slug = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTE_FRAGMENT_ID_SLUG ); - self::$link_ids_separator = Includes\Settings::instance()->get( \footnotes\includes\Settings::HARD_LINK_IDS_SEPARATOR ); + self::$referrer_link_slug = Settings::instance()->get( Settings::REFERRER_FRAGMENT_ID_SLUG ); + self::$footnote_link_slug = Settings::instance()->get( Settings::FOOTNOTE_FRAGMENT_ID_SLUG ); + self::$link_ids_separator = Settings::instance()->get( Settings::HARD_LINK_IDS_SEPARATOR ); // Streamline ID concatenation. self::$post_container_id_compound = self::$link_ids_separator; @@ -1415,11 +1447,11 @@ class Parser { // Display the footnote referrers and the tooltips. if ( ! $hide_footnotes_text ) { - $index = Includes\Convert::index( $footnote_index, Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ); + $index = Convert::index( $footnote_index, Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) ); // Display only a truncated footnote text if option enabled. - $enable_excerpt = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) ); - $max_length = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH ); + $enable_excerpt = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) ); + $max_length = (int) Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH ); // Define excerpt text as footnote text by default. $excerpt_text = $footnote_text; @@ -1445,7 +1477,7 @@ class Parser { if ( General::$amp_enabled ) { // If the reference container is also collapsed by default. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) ) ) { $excerpt_text .= ' on="tap:footnote_references_container_'; $excerpt_text .= self::$post_id . '_' . self::$reference_container_id; @@ -1479,7 +1511,7 @@ class Parser { $excerpt_text .= '>'; // Configurable read-on button label. - $excerpt_text .= Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_READON_LABEL ); + $excerpt_text .= Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_READON_LABEL ); $excerpt_text .= self::$hard_links_enabled ? '' : ''; } @@ -1490,7 +1522,7 @@ class Parser { * * Define the HTML element to use for the referrers. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ) ) ) { $sup_span = 'sup'; @@ -1533,7 +1565,7 @@ class Parser { $referrer_anchor_element = ''; // The link element is set independently as it may be needed for styling. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::LINK_ELEMENT_ENABLED ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( LINK_ELEMENT_ENABLED['key'] ) ) ) { self::$link_span = 'a'; self::$link_open_tag = ''; @@ -1577,9 +1609,9 @@ class Parser { 'note_id' => $index, 'hard-link' => $footnote_link_argument, 'sup-span' => $sup_span, - 'before' => Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_STYLING_BEFORE ), + 'before' => Settings::instance()->get( Settings::FOOTNOTES_STYLING_BEFORE ), 'index' => $index, - 'after' => Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_STYLING_AFTER ), + 'after' => Settings::instance()->get( Settings::FOOTNOTES_STYLING_AFTER ), 'anchor-element' => $referrer_anchor_element, 'style' => $tooltip_style, 'text' => $tooltip_content, @@ -1593,12 +1625,12 @@ class Parser { // If tooltips are enabled but neither AMP nor alternative are. if ( General::$tooltips_enabled && ! General::$amp_enabled && ! General::$alternative_tooltips_enabled ) { - $offset_y = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ); - $offset_x = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ); - $fade_in_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ); - $fade_in_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ); - $fade_out_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ); - $fade_out_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ); + $offset_y = (int) Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ); + $offset_x = (int) Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ); + $fade_in_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DELAY ); + $fade_in_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DURATION ); + $fade_out_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY ); + $fade_out_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION ); // Fill in 'public/partials/tooltip.html'. $template_tooltip->replace( @@ -1606,7 +1638,7 @@ class Parser { 'post_id' => self::$post_id, 'container_id' => self::$reference_container_id, 'note_id' => $index, - 'position' => Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION ), + 'position' => Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION ), 'offset-y' => empty( $offset_y ) ? 0 : $offset_y, 'offset-x' => empty( $offset_x ) ? 0 : $offset_x, 'fade-in-delay' => empty( $fade_in_delay ) ? 0 : $fade_in_delay, @@ -1679,16 +1711,16 @@ class Parser { */ // If the backlink symbol is enabled. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE['key'] ) ) ) { // Get html arrow. - $arrow = Includes\Convert::get_arrow( Includes\Settings::instance()->get( \footnotes\includes\Settings::HYPERLINK_ARROW ) ); + $arrow = Convert::get_arrow( Settings::instance()->get( Settings::HYPERLINK_ARROW ) ); // Set html arrow to the first one if invalid index defined. if ( is_array( $arrow ) ) { - $arrow = Includes\Convert::get_arrow( 0 ); + $arrow = Convert::get_arrow( 0 ); } // Get user defined arrow. - $arrow_user_defined = Includes\Settings::instance()->get( \footnotes\includes\Settings::HYPERLINK_ARROW_USER_DEFINED ); + $arrow_user_defined = Settings::instance()->get( Settings::HYPERLINK_ARROW_USER_DEFINED ); if ( ! empty( $arrow_user_defined ) ) { $arrow = $arrow_user_defined; } @@ -1711,12 +1743,12 @@ class Parser { * Initially an appended comma was hard-coded in this algorithm for enumerations. * The comma in enumerations is not universally preferred. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_ENABLED ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( BACKLINKS_SEPARATOR_ENABLED['key'] ) ) ) { if ( empty( $separator ) ) { // If it is not, check which option is on. - $separator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_OPTION ); + $separator_option = Settings::instance()->get( BACKLINKS_SEPARATOR_OPTION['key'] ); // TODO: replace with `match` (but currently it breaks the Rector // downgrade to PHP 7.4. // https://github.com/rectorphp/rector/issues/6315 @@ -1731,7 +1763,7 @@ class Parser { $separator = ' –'; break; default: - $separator = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_SEPARATOR_CUSTOM ); + $separator = Settings::instance()->get( BACKLINKS_SEPARATOR_CUSTOM['key'] ); break; } } @@ -1745,12 +1777,12 @@ class Parser { * * Initially a dot was appended in the table row template. */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_ENABLED ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( BACKLINKS_TERMINATOR_ENABLED['key'] ) ) ) { if ( empty( $terminator ) ) { // If it is not, check which option is on. - $terminator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_OPTION ); + $terminator_option = Settings::instance()->get( BACKLINKS_TERMINATOR_OPTION['key'] ); // TODO: replace with `match` (but currently it breaks the Rector // downgrade to PHP 7.4. // https://github.com/rectorphp/rector/issues/6315 @@ -1765,7 +1797,7 @@ class Parser { $terminator = ':'; break; default: - $terminator = Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_TERMINATOR_CUSTOM ); + $terminator = Settings::instance()->get( BACKLINKS_TERMINATOR_CUSTOM['key'] ); break; } } @@ -1782,7 +1814,7 @@ class Parser { * Variable number length and proportional character width require explicit line breaks. * Otherwise, an ordinary space character offering a line break opportunity is inserted. */ - $line_break = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::BACKLINKS_LINE_BREAKS_ENABLED ) ) ? '
' : ' '; + $line_break = Convert::to_bool( Settings::instance()->get( BACKLINKS_LINE_BREAKS_ENABLED['key'] ) ) ? '
' : ' '; /* * Line breaks for source readability. @@ -1796,42 +1828,42 @@ class Parser { /* * Reference container table row template load. */ - $combine_identical_footnotes = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::COMBINE_IDENTICAL_FOOTNOTES ) ); + $combine_identical_footnotes = Convert::to_bool( Settings::instance()->get( COMBINE_IDENTICAL_FOOTNOTES['key'] ) ); // AMP compatibility requires a full set of AMP compatible table row templates. if ( General::$amp_enabled ) { // When combining identical footnotes is turned on, another template is needed. if ( $combine_identical_footnotes ) { // The combining template allows for backlink clusters and supports cell clicking for single notes. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body-combi' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body-3column' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body-switch' ); + $template = new Template( Template::PUBLIC, 'amp-reference-container-body-combi' ); + } elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE['key'] ) ) ) { + $template = new Template( Template::PUBLIC, 'amp-reference-container-body-3column' ); + } elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] ) ) ) { + $template = new Template( Template::PUBLIC, 'amp-reference-container-body-switch' ); } else { // Default is the standard template. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-body' ); + $template = new Template( Template::PUBLIC, 'amp-reference-container-body' ); } } elseif ( $combine_identical_footnotes ) { // The combining template allows for backlink clusters and supports cell clicking for single notes. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body-combi' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body-3column' ); - } elseif ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body-switch' ); + $template = new Template( Template::PUBLIC, 'reference-container-body-combi' ); + } elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE['key'] ) ) ) { + $template = new Template( Template::PUBLIC, 'reference-container-body-3column' ); + } elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] ) ) ) { + $template = new Template( Template::PUBLIC, 'reference-container-body-switch' ); } else { // Default is the standard template. - $template = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container-body' ); + $template = new Template( Template::PUBLIC, 'reference-container-body' ); } /* * Switch backlink symbol and footnote number. */ - $symbol_switch = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ); + $symbol_switch = Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] ) ); // Loop through all footnotes found in the page. $num_footnotes = count( self::$footnotes ); @@ -1851,7 +1883,7 @@ class Parser { // Get the footnote index string and. // Keep supporting legacy index placeholder. - $footnote_id = Includes\Convert::index( ( $index + 1 ), Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ); + $footnote_id = Convert::index( ( $index + 1 ), Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) ); /** * Case of only one backlink per table row. @@ -1871,9 +1903,9 @@ class Parser { * * @since 2.5.4 */ - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { $use_backbutton_hint = ' title="'; - $use_backbutton_hint .= Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT ); + $use_backbutton_hint .= Settings::instance()->get( Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT ); $use_backbutton_hint .= '"'; } else { $use_backbutton_hint = ''; @@ -1996,7 +2028,7 @@ class Parser { $flag_combined = true; // Update the footnote ID. - $footnote_id = Includes\Convert::index( ( $check_index + 1 ), Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ); + $footnote_id = Convert::index( ( $check_index + 1 ), Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) ); // Resume composing the backlinks enumeration. $footnote_backlinks .= "$separatorget( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) ); + self::$mirror_tooltip_text = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) ); if ( self::$mirror_tooltip_text ) { $tooltip_text = substr( $footnote_text, 0, $tooltip_text_length ); - $reference_text_introducer = Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ); + $reference_text_introducer = Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ); $reference_text = $tooltip_text . $reference_text_introducer . $not_tooltip_text; } else { $reference_text = $not_tooltip_text; @@ -2081,7 +2113,7 @@ class Parser { // Used in standard layout W/O COMBINED FOOTNOTES. 'post_id' => self::$post_id, 'container_id' => self::$reference_container_id, - 'note_id' => Includes\Convert::index( $first_footnote_index, Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_COUNTER_STYLE ) ), + 'note_id' => Convert::index( $first_footnote_index, Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) ), 'link-start' => self::$link_open_tag, 'link-end' => self::$link_close_tag, 'link-span' => self::$link_span, @@ -2110,10 +2142,10 @@ class Parser { } // Call again for robustness when priority levels don’t match any longer. - self::$scroll_offset = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_OFFSET ); + self::$scroll_offset = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_OFFSET ); // Streamline. - $collapse_default = Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE ) ); + $collapse_default = Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) ); /* * Reference container label. @@ -2122,32 +2154,32 @@ class Parser { * In case of empty label that would apply to the left half button character. * Hence the point in setting an empty label to U+202F NARROW NO-BREAK SPACE. */ - $reference_container_label = Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_NAME ); + $reference_container_label = Settings::instance()->get( REFERENCE_CONTAINER_NAME['key'] ); // Select the reference container template. // Whether AMP compatibility mode is enabled. if ( General::$amp_enabled ) { // Whether the reference container is collapsed by default. - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_COLLAPSE ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) ) ) { // Load 'public/partials/amp-reference-container-collapsed.html'. - $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container-collapsed' ); + $template_container = new Template( Template::PUBLIC, 'amp-reference-container-collapsed' ); } else { // Load 'public/partials/amp-reference-container.html'. - $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'amp-reference-container' ); + $template_container = new Template( Template::PUBLIC, 'amp-reference-container' ); } } elseif ( 'js' === General::$script_mode ) { // Load 'public/partials/js-reference-container.html'. - $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'js-reference-container' ); + $template_container = new Template( Template::PUBLIC, 'js-reference-container' ); } else { // Load 'public/partials/reference-container.html'. - $template_container = new Includes\Template( \footnotes\includes\Template::PUBLIC, 'reference-container' ); + $template_container = new Template( Template::PUBLIC, 'reference-container' ); } $scroll_offset = ''; @@ -2159,11 +2191,11 @@ class Parser { if ( 'jquery' === General::$script_mode ) { $scroll_offset = ( self::$scroll_offset / 100 ); - $scroll_up_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION ); + $scroll_up_duration = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DURATION ); - if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY ) ) ) { + if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY ) ) ) { - $scroll_down_duration = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DURATION ); + $scroll_down_duration = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DOWN_DURATION ); } else { @@ -2171,8 +2203,8 @@ class Parser { } - $scroll_down_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_DOWN_DELAY ); - $scroll_up_delay = (int) Includes\Settings::instance()->get( \footnotes\includes\Settings::FOOTNOTES_SCROLL_UP_DELAY ); + $scroll_down_delay = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DOWN_DELAY ); + $scroll_up_delay = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_UP_DELAY ); } @@ -2180,7 +2212,7 @@ class Parser { array( 'post_id' => self::$post_id, 'container_id' => self::$reference_container_id, - 'element' => Includes\Settings::instance()->get( \footnotes\includes\Settings::REFERENCE_CONTAINER_LABEL_ELEMENT ), + 'element' => Settings::instance()->get( REFERENCE_CONTAINER_LABEL_ELEMENT ), 'name' => empty( $reference_container_label ) ? ' ' : $reference_container_label, 'button-style' => $collapse_default ? '' : 'display: none;', 'style' => $collapse_default ? 'display: none;' : '', diff --git a/src/public/widget/class-reference-container.php b/src/public/widget/class-reference-container.php index 97f07b5..0816439 100644 --- a/src/public/widget/class-reference-container.php +++ b/src/public/widget/class-reference-container.php @@ -15,7 +15,8 @@ namespace footnotes\general\Widget; -use footnotes\includes as Includes; +use footnotes\includes\{Footnotes, Settings}; +use const footnotes\includes\settings\general\ReferenceContainerSettingsGroup\REFERENCE_CONTAINER_POSITION; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'widget/class-base.php'; @@ -34,7 +35,7 @@ class Reference_Container extends Base { * * @access private * @since 2.8.0 - * @see Includes\Footnotes::$plugin_name + * @see Footnotes::$plugin_name * @var string $plugin_name The ID of this plugin. */ private string $plugin_name; @@ -111,7 +112,7 @@ class Reference_Container extends Base { public function widget( $args, $instance ) { global $footnotes; // Reference container positioning is set to "widget area". - if ( 'widget' === Includes\Settings::instance()->get( Includes\Settings::REFERENCE_CONTAINER_POSITION ) ) { + if ( 'widget' === Settings::instance()->get( REFERENCE_CONTAINER_POSITION ) ) { // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped echo $footnotes->task->reference_container(); // phpcs:enable