diff --git a/src/admin/class-admin.php b/src/admin/class-admin.php
index e4e01ce..f599201 100644
--- a/src/admin/class-admin.php
+++ b/src/admin/class-admin.php
@@ -60,14 +60,14 @@ class Admin {
* @see Footnotes::$version
*/
private string $version,
-
+
/**
* The plugin settings object.
*
* @access private
* @since 2.8.0
*/
- private Settings $settings
+ private Settings $settings
) {
$this->load_dependencies();
diff --git a/src/admin/layout/class-engine.php b/src/admin/layout/class-engine.php
index 946ac3b..1e882ab 100644
--- a/src/admin/layout/class-engine.php
+++ b/src/admin/layout/class-engine.php
@@ -106,20 +106,8 @@ abstract class Engine {
$this->settings->settings_sections['scope_and_priority']->get_section_slug() => $this->settings->settings_sections['scope_and_priority'],
$this->settings->settings_sections['custom_css']->get_section_slug() => $this->settings->settings_sections['custom_css'],
);
-
- /*foreach ( $this->get_sections() as $section ) {
- // Append tab to the tab-array.
- $this->sections[ $section['id'] ] = $section;
- add_settings_section(
- $section['id'],
- '',
- fn() => $this->description(),
- 'footnotes'
- );
- $this->add_settings_fields();
- //$this->register_meta_boxes( $section['id'] );
- }*/
}
+
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
/**
* Displays the content of specific sub-page.
@@ -129,14 +117,14 @@ abstract class Engine {
*/
public function display_content(): void {
// check user capabilities
- if ( ! current_user_can( 'manage_options' ) ) {
- return;
- }
-
- $active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->sections );
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ $active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->sections );
$active_section = $this->sections[ $active_section_id ];
-
- // Store settings.
+
+ // Store settings.
$settings_updated = false;
if ( array_key_exists( 'save-settings', $_POST ) ) {
if ( 'save' === $_POST['save-settings'] ) {
@@ -145,50 +133,51 @@ abstract class Engine {
$settings_updated = $this->save_settings();
}
}
-
- ?>
-
-
-
- sections as $section_slug => $section ): ?>
+
+ ?>
+ ', __( 'Settings saved', 'footnotes' ) );
}
-
+
// show error/update messages
settings_errors( 'footnotes_messages' );
?>
-
-
-
+
+
+ %s', $setting_name, $caption );
}
-
+
/**************************************************************************
* NEW METHODS
**************************************************************************/
-
+
/**
* Constructs the HTML for a text 'input' element.
*
@@ -387,7 +376,7 @@ abstract class Engine {
*/
protected function add_input_text( array $args ): void {
extract( $args );
-
+
echo ( sprintf(
'',
$name,
@@ -395,11 +384,11 @@ abstract class Engine {
$max_length ?? 999,
$style ?? '',
$value,
- isset($readonly) ? ' readonly="readonly"' : '',
- $disabled ? ' disabled': ''
+ isset( $readonly ) ? ' readonly="readonly"' : '',
+ $disabled ? ' disabled' : ''
) );
- }
-
+ }
+
/**
* Constructs the HTML for a 'textarea' element.
*
@@ -411,18 +400,18 @@ abstract class Engine {
*/
protected function add_textarea( array $args ): void {
extract( $args );
-
+
echo ( sprintf(
'',
$name,
$name,
$style ?? '',
- isset($readonly) ? ' readonly="readonly"' : '',
- $disabled ? ' disabled': '',
+ isset( $readonly ) ? ' readonly="readonly"' : '',
+ $disabled ? ' disabled' : '',
$value,
) );
}
-
+
/**
* Constructs the HTML for a numeric 'input' element.
*
@@ -436,17 +425,17 @@ abstract class Engine {
*/
protected function add_input_number( array $args ): void {
extract( $args );
-
+
echo ( sprintf(
'',
$name,
$name,
- isset($max) ? ' max="'.$max.'"' : '',
- isset($min) ? ' min="'.$min.'"' : '',
- is_float($value) ? number_format( $value, 1 ) : $value,
- is_float($value) ? ' step="0.1"' : '',
- isset($readonly) ? ' readonly="readonly"' : '',
- $disabled ? ' disabled': ''
+ isset( $max ) ? ' max="' . $max . '"' : '',
+ isset( $min ) ? ' min="' . $min . '"' : '',
+ is_float( $value ) ? number_format( $value, 1 ) : $value,
+ is_float( $value ) ? ' step="0.1"' : '',
+ isset( $readonly ) ? ' readonly="readonly"' : '',
+ $disabled ? ' disabled' : ''
) );
}
@@ -462,9 +451,11 @@ abstract class Engine {
*/
protected function add_select( array $args ): void {
extract( $args );
-
- if (!isset($options)) trigger_error("No options passed to 'select' element.", E_USER_ERROR);
-
+
+ if ( ! isset( $options ) ) {
+ trigger_error( "No options passed to 'select' element.", E_USER_ERROR );
+ }
+
$select_options = '';
// Loop through all array keys.
foreach ( $options as $option_value => $option_text ) {
@@ -479,16 +470,16 @@ abstract class Engine {
$option_text
);
}
-
+
echo ( sprintf(
'',
$name,
$name,
- $disabled ? ' disabled': '',
+ $disabled ? ' disabled' : '',
$select_options
) );
}
-
+
/**
* Constructs the HTML for a checkbox 'input' element.
*
@@ -501,16 +492,16 @@ abstract class Engine {
*/
protected function add_input_checkbox( array $args ): void {
extract( $args );
-
+
echo sprintf(
'',
$name,
$name,
$value ? ' checked="checked"' : '',
- $disabled ? ' disabled': ''
+ $disabled ? ' disabled' : ''
);
}
-
+
/**
* Constructs the HTML for a color 'input' element.
*
@@ -523,19 +514,19 @@ abstract class Engine {
*/
protected function add_input_color( array $args ): void {
extract( $args );
-
+
echo sprintf(
'',
$name,
$name,
- $disabled ? ' disabled': ''
+ $disabled ? ' disabled' : ''
);
}
-
+
/******************************
- * OLD METHODS
- ******************************/
-
+ * OLD METHODS
+ ******************************/
+
/**
* Registers all Meta boxes for a sub-page.
*
@@ -573,9 +564,9 @@ abstract class Engine {
wp_enqueue_script( 'wp-color-picker' );
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
-
+
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
-
+
/**
* Save plugin settings.
*
@@ -594,7 +585,7 @@ abstract class Engine {
foreach ( array_keys( $active_section->get_options() ) as $setting_key ) {
$new_settings[ $setting_key ] = array_key_exists( $setting_key, $_POST ) ? wp_unslash( $_POST[ $setting_key ] ) : '';
}
-
+
// Update settings.
return $this->settings->save_options_group( $active_section->get_options_group_slug(), $new_settings );
}
diff --git a/src/admin/layout/class-init.php b/src/admin/layout/class-init.php
index 22fb22f..f41d0a3 100644
--- a/src/admin/layout/class-init.php
+++ b/src/admin/layout/class-init.php
@@ -61,14 +61,14 @@ class Init {
* @since 2.8.0
*/
private string $plugin_name,
-
+
/**
* The plugin settings object.
*
* @access private
* @since 2.8.0
*/
- private Settings $settings
+ private Settings $settings
) {
$this->load_dependencies();
@@ -99,12 +99,12 @@ class Init {
*
* @since 1.5.0
*/
- public function initialize_settings(): void {
+ public function initialize_settings(): void {
$this->settings->settings_sections['general']->add_settings_section();
$this->settings->settings_sections['referrers_and_tooltips']->add_settings_section();
$this->settings->settings_sections['scope_and_priority']->add_settings_section();
$this->settings->settings_sections['custom_css']->add_settings_section();
-
+
$this->settings_page->add_settings_sections();
$this->settings_page->add_settings_fields();
}
diff --git a/src/admin/layout/class-settings-page.php b/src/admin/layout/class-settings-page.php
index c3db793..1b8d2e0 100644
--- a/src/admin/layout/class-settings-page.php
+++ b/src/admin/layout/class-settings-page.php
@@ -53,16 +53,16 @@ class SettingsPage extends Engine {
* @since 2.8.0
*/
protected string $plugin_name,
-
+
/**
* The plugin settings object.
*
* @access private
* @since 2.8.0
*/
- protected Settings $settings
- ) {
- }
+ protected Settings $settings
+ ) {
+ }
/**
* Returns a priority index.
@@ -75,67 +75,71 @@ class SettingsPage extends Engine {
public function get_priority(): int {
return 10;
}
-
+
/**************************************************************************
* NEW METHODS
**************************************************************************/
-
+
public function add_settings_fields(): void {
$active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->sections );
$active_section = $this->sections[ $active_section_id ];
-
- switch ($active_section->get_section_slug()) {
+
+ switch ( $active_section->get_section_slug() ) {
case 'footnotes-settings':
- $this->settings->settings_sections['general']->add_settings_fields($this);
+ $this->settings->settings_sections['general']->add_settings_fields( $this );
break;
case 'footnotes-customize':
- $this->settings->settings_sections['referrers_and_tooltips']->add_settings_fields($this);
+ $this->settings->settings_sections['referrers_and_tooltips']->add_settings_fields( $this );
break;
case 'footnotes-expert':
- $this->settings->settings_sections['scope_and_priority']->add_settings_fields($this);
+ $this->settings->settings_sections['scope_and_priority']->add_settings_fields( $this );
break;
case 'footnotes-customcss':
- $this->settings->settings_sections['custom_css']->add_settings_fields($this);
+ $this->settings->settings_sections['custom_css']->add_settings_fields( $this );
break;
case 'footnotes-how-to':
- print_r("Demo goes here");
+ print_r( 'Demo goes here' );
break;
- default: print_r("ERR: section not found");
- }
+ default:
+ print_r( 'ERR: section not found' );
+ }
}
-
- public function setting_field_callback( array $args ): void {
- if (isset($args['type'])) {
+
+ public function setting_field_callback( array $args ): void {
+ if ( isset( $args['type'] ) ) {
echo $args['description'] . '';
-
- switch($args['type']) {
+
+ switch ( $args['type'] ) {
case 'text':
- $this->add_input_text($args);
+ $this->add_input_text( $args );
return;
case 'textarea':
- $this->add_textarea($args);
+ $this->add_textarea( $args );
return;
case 'number':
- $this->add_input_number($args);
+ $this->add_input_number( $args );
return;
case 'select':
- $this->add_select($args);
+ $this->add_select( $args );
return;
case 'checkbox':
- $this->add_input_checkbox($args);
+ $this->add_input_checkbox( $args );
return;
case 'color':
- $this->add_input_color($args);
+ $this->add_input_color( $args );
return;
- default: trigger_error("Unknown setting type.", E_USER_ERROR);
+ default:
+ trigger_error( 'Unknown setting type.', E_USER_ERROR );
}
- } else trigger_error("No setting type.", E_USER_ERROR);
+ } else {
+ trigger_error( 'No setting type.', E_USER_ERROR );
+ }
}
/**************************************************************************
* NEW METHODS END
**************************************************************************/
-
+
/**
* Displays a short introduction to the plugin.
*
diff --git a/src/includes/class-convert.php b/src/includes/class-convert.php
index e3a7b3f..3fa62a4 100644
--- a/src/includes/class-convert.php
+++ b/src/includes/class-convert.php
@@ -55,9 +55,11 @@ class Convert {
* @since 1.0-beta
* @todo Replace with built-in type casting.
*/
- public static function to_bool( string|null $value ): bool {
- if (!$value) return false;
-
+ public static function to_bool( ?string $value ): bool {
+ if ( ! $value ) {
+ return false;
+ }
+
// Convert string to lower-case to make it easier.
$value = strtolower( $value );
// Check if string seems to contain a "true" value.
@@ -86,7 +88,7 @@ class Convert {
public static function get_arrow( int $index = -1 ): string|array {
// Define all possible arrows.
$arrows = array( '↑', '↥', '↟', '↩', '↲', '↵', '⇑', '⇡', '⇧', '↑' );
-
+
// Return the whole arrow array.
if ( $index < 0 ) {
return $arrows;
diff --git a/src/includes/class-core.php b/src/includes/class-core.php
index 7da8aa1..aa52c15 100644
--- a/src/includes/class-core.php
+++ b/src/includes/class-core.php
@@ -74,7 +74,7 @@ class Core {
* @var string $version The current version of the plugin.
*/
protected string $version;
-
+
/**
* The plugin settings object.
*
@@ -101,7 +101,7 @@ class Core {
$this->load_dependencies();
$this->set_locale();
- $this->settings = new Settings();
+ $this->settings = new Settings();
$this->define_admin_hooks();
$this->define_public_hooks();
}
@@ -123,9 +123,12 @@ class Core {
*
* @since 2.8.0
*/
- public function get_plugin_name(bool $html = false): string {
- if ( ! $html ) return $this->plugin_name;
- else return '';
+ public function get_plugin_name( bool $html = false ): string {
+ if ( ! $html ) {
+ return $this->plugin_name;
+ } else {
+ return '';
+ }
}
/**
@@ -145,7 +148,7 @@ class Core {
public function get_version(): string {
return $this->version;
}
-
+
/**
* Load the required dependencies for this plugin.
*
diff --git a/src/includes/class-settings.php b/src/includes/class-settings.php
index a4ec9f7..a454393 100644
--- a/src/includes/class-settings.php
+++ b/src/includes/class-settings.php
@@ -46,7 +46,7 @@ class Settings {
'footnotes_storage_expert',
'footnotes_storage_custom_css',
);
-
+
/**
* Contains each section of settings.
*
@@ -61,17 +61,17 @@ class Settings {
*
* @since 1.5.0
*/
- public function __construct() {
+ public function __construct() {
$this->load_dependencies();
-
+
$this->settings_sections = array(
- 'general' => new GeneralSettingsSection('footnotes_storage', 'footnotes-settings', 'General Settings', $this ),
- 'referrers_and_tooltips' => new ReferrersAndTooltipsSettingsSection('footnotes_storage_custom', 'footnotes-customize', 'Referrers and Tooltips', $this),
- 'scope_and_priority' => new ScopeAndPrioritySettingsSection('footnotes_storage_expert', 'footnotes-expert', 'Scope and Priority', $this),
- 'custom_css' => new CustomCSSSettingsSection('footnotes_storage_custom_css', 'footnotes-customcss', 'Custom CSS', $this),
+ 'general' => new GeneralSettingsSection( 'footnotes_storage', 'footnotes-settings', 'General Settings', $this ),
+ 'referrers_and_tooltips' => new ReferrersAndTooltipsSettingsSection( 'footnotes_storage_custom', 'footnotes-customize', 'Referrers and Tooltips', $this ),
+ 'scope_and_priority' => new ScopeAndPrioritySettingsSection( 'footnotes_storage_expert', 'footnotes-expert', 'Scope and Priority', $this ),
+ 'custom_css' => new CustomCSSSettingsSection( 'footnotes_storage_custom_css', 'footnotes-customcss', 'Custom CSS', $this ),
);
}
-
+
/**
* Load the required dependencies for this file.
*
@@ -92,40 +92,42 @@ class Settings {
* @return void
*/
protected function load_dependencies(): void {
- require_once plugin_dir_path( __DIR__ ) . 'includes/settings/class-settings-section.php';
- require_once plugin_dir_path( __DIR__ ) . 'includes/settings/class-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'includes/settings/class-setting.php';
-
- require_once plugin_dir_path( __DIR__ ) . 'includes/settings/general/class-general-settings-section.php';
- require_once plugin_dir_path( __DIR__ ) . 'includes/settings/referrers-and-tooltips/class-referrers-and-tooltips-settings-section.php';
- require_once plugin_dir_path( __DIR__ ) . 'includes/settings/scope-and-priority/class-scope-and-priority-settings-section.php';
- require_once plugin_dir_path( __DIR__ ) . 'includes/settings/custom-css/class-custom-css-settings-section.php';
+ require_once plugin_dir_path( __DIR__ ) . 'includes/settings/class-settingssection.php';
+ require_once plugin_dir_path( __DIR__ ) . 'includes/settings/class-settingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'includes/settings/class-setting.php';
+
+ require_once plugin_dir_path( __DIR__ ) . 'includes/settings/general/class-generalsettingssection.php';
+ require_once plugin_dir_path( __DIR__ ) . 'includes/settings/referrers-and-tooltips/class-referrersandtooltipssettingssection.php';
+ require_once plugin_dir_path( __DIR__ ) . 'includes/settings/scope-and-priority/class-scopeandprioritysettingssection.php';
+ require_once plugin_dir_path( __DIR__ ) . 'includes/settings/custom-css/class-customcsssettingssection.php';
}
-
+
/**
* Retrieve a setting by its key.
*
- * @param string $setting_key The key of the setting to search for.
+ * @param string $setting_key The key of the setting to search for.
* @return ?Setting Either the setting object, or `null` if none exists.
*
* @since 2.8.0
*
* @todo This is an _O(n)_ linear search. Explore more scaleable alternatives.
*/
- public function get_setting( string $setting_key ): ?Setting {
- foreach ($this->settings_sections as $settings_section) {
- $setting = $settings_section->get_setting($setting_key);
-
- if ($setting) return $setting;
+ public function get_setting( string $setting_key ): ?Setting {
+ foreach ( $this->settings_sections as $settings_section ) {
+ $setting = $settings_section->get_setting( $setting_key );
+
+ if ( $setting ) {
+ return $setting;
+ }
}
-
+
return null;
}
-
+
/**
* Retrieve a setting's value by its key.
*
- * @param string $setting_key The key of the setting to search for.
+ * @param string $setting_key The key of the setting to search for.
* @return mixed Either the setting's value, or `null` if the setting does not exist.
*
* @since 2.8.0
@@ -133,20 +135,22 @@ class Settings {
* @todo This is an _O(n)_ linear search. Explore more scaleable alternatives.
* @todo How to handle settings with a value of `null`?
*/
- public function get_setting_value( string $setting_key ): mixed {
- foreach ($this->settings_sections as $settings_section) {
- $setting = $settings_section->get_setting($setting_key);
-
- if ($setting) return $setting->get_value();
+ public function get_setting_value( string $setting_key ): mixed {
+ foreach ( $this->settings_sections as $settings_section ) {
+ $setting = $settings_section->get_setting( $setting_key );
+
+ if ( $setting ) {
+ return $setting->get_value();
+ }
}
-
+
return null;
}
-
+
/**
* Retrieve a setting's default value by its key.
*
- * @param string $setting_key The key of the setting to search for.
+ * @param string $setting_key The key of the setting to search for.
* @return mixed Either the setting's default value, or `null` if the setting does not exist.
*
* @since 2.8.0
@@ -154,20 +158,22 @@ class Settings {
* @todo This is an _O(n)_ linear search. Explore more scaleable alternatives.
* @todo How to handle settings with a default value of `null`?
*/
- public function get_setting_default_value( string $setting_key ): mixed {
- foreach ($this->settings_sections as $settings_section) {
- $setting = $settings_section->get_setting($setting_key);
-
- if ($setting) return $setting->get_default_value();
+ public function get_setting_default_value( string $setting_key ): mixed {
+ foreach ( $this->settings_sections as $settings_section ) {
+ $setting = $settings_section->get_setting( $setting_key );
+
+ if ( $setting ) {
+ return $setting->get_default_value();
+ }
}
-
+
return null;
}
-
+
/**
* Set a setting's value by its key.
*
- * @param string $setting_key The key of the setting to search for.
+ * @param string $setting_key The key of the setting to search for.
* @param mixed $setting_value The new value to set.
* @return mixed 'True' if the value was successfully set. 'False' otherwise.
*
@@ -176,13 +182,15 @@ class Settings {
* @todo This is an _O(n)_ linear search. Explore more scaleable alternatives.
* @todo How to handle settings with a value of `null`?
*/
- public function set_setting_value( string $setting_key, mixed $setting_value ): ?bool {
- foreach ($this->settings_sections as $settings_section) {
- $setting = $settings_section->get_setting($setting_key);
-
- if ($setting) return $setting->set_value( $setting_value );
+ public function set_setting_value( string $setting_key, $setting_value ): ?bool {
+ foreach ( $this->settings_sections as $settings_section ) {
+ $setting = $settings_section->get_setting( $setting_key );
+
+ if ( $setting ) {
+ return $setting->set_value( $setting_value );
+ }
}
-
+
return false;
}
@@ -202,7 +210,7 @@ class Settings {
/**
* Updates a whole Setting Container on save.
*
- * @param string $options_group_slug Options group slug to save.
+ * @param string $options_group_slug Options group slug to save.
* @param array $new_values The new Settings value(s).
*
* @since 1.5.0
@@ -210,8 +218,8 @@ class Settings {
*/
public function save_options_group( string $options_group_slug, array $new_values ): bool {
if ( update_option( $options_group_slug, $new_values ) ) {
- foreach ($this->settings_sections as $settings_section) {
- if ($settings_section->get_options_group_slug() === $options_group_slug) {
+ foreach ( $this->settings_sections as $settings_section ) {
+ if ( $settings_section->get_options_group_slug() === $options_group_slug ) {
$settings_section->load_options_group();
}
}
@@ -219,7 +227,7 @@ class Settings {
}
return false;
}
-
+
/**
* Loads all settings from each option group.
*
@@ -227,16 +235,16 @@ class Settings {
* @since 2.8.0 Renamed from `load_all()` to `load_options_groups()`.
*/
protected function load_options_groups(): void {
- foreach ($this->options_group_slug as $options_group_slug) {
- $options_group = get_option($options_group_slug);
-
- if (!! $options_group) {
- foreach ($this->settings_sections as $settings_section) {
- if ($settings_section->get_options_group_slug() === $options_group_slug) {
- $settings_section->load_options_group();
- }
- }
- }
+ foreach ( $this->options_group_slug as $options_group_slug ) {
+ $options_group = get_option( $options_group_slug );
+
+ if ( ! ! $options_group ) {
+ foreach ( $this->settings_sections as $settings_section ) {
+ if ( $settings_section->get_options_group_slug() === $options_group_slug ) {
+ $settings_section->load_options_group();
+ }
+ }
+ }
}
}
}
diff --git a/src/includes/settings/class-setting.php b/src/includes/settings/class-setting.php
index 0fa08a6..eb301ed 100644
--- a/src/includes/settings/class-setting.php
+++ b/src/includes/settings/class-setting.php
@@ -18,7 +18,7 @@ use footnotes\includes\{Core, Settings};
* @package footnotes
* @since 2.8.0
*/
-class Setting {
+class Setting {
/**
* Options for the custom width units (per cent is a ratio, not a unit).
*
@@ -33,7 +33,7 @@ class Setting {
'em' => 'em',
'vw' => 'viewport width',
);
-
+
/**
* Options for the custom font size units (per cent is a ratio, not a unit).
*
@@ -41,16 +41,16 @@ class Setting {
*
* @since 2.8.0
*/
- const FONT_SIZE_UNIT_OPTIONS = array(
- 'em' => 'em',
- 'rem' => 'rem',
- 'px' => 'pixels',
- 'pt' => 'points',
- 'pc' => 'picas',
- 'mm' => 'millimeters',
- '%' => 'per cent',
+ const FONT_SIZE_UNIT_OPTIONS = array(
+ 'em' => 'em',
+ 'rem' => 'rem',
+ 'px' => 'pixels',
+ 'pt' => 'points',
+ 'pc' => 'picas',
+ 'mm' => 'millimeters',
+ '%' => 'per cent',
);
-
+
/**
* Options for the HTML text elements.
*
@@ -59,14 +59,14 @@ class Setting {
* @since 2.8.0
*/
const TEXT_ELEMENT_OPTIONS = array(
- 'p' => 'paragraph',
- 'h2' => 'heading 2',
- 'h3' => 'heading 3',
- 'h4' => 'heading 4',
- 'h5' => 'heading 5',
- 'h6' => 'heading 6',
+ 'p' => 'paragraph',
+ 'h2' => 'heading 2',
+ 'h3' => 'heading 3',
+ 'h4' => 'heading 4',
+ 'h5' => 'heading 5',
+ 'h6' => 'heading 6',
);
-
+
/**
* Setting value.
*
@@ -74,7 +74,7 @@ class Setting {
*
* @since 2.8.0
*/
- protected mixed $value;
+ protected $value;
/**
* Constructs the setting.
@@ -97,7 +97,7 @@ class Setting {
*
* @since 2.8.0
*/
- private string $options_group_slug,
+ private string $options_group_slug,
/**
* Setting section slug.
*
@@ -106,7 +106,7 @@ class Setting {
* @since 2.8.0
*/
private string $section_slug,
-
+
/**
* Setting slug.
*
@@ -124,7 +124,7 @@ class Setting {
* @since 2.8.0
*/
public string $name,
-
+
/**
* Setting description.
*
@@ -133,7 +133,7 @@ class Setting {
* @since 2.8.0
*/
public ?string $description,
-
+
/**
* Setting default value.
*
@@ -142,7 +142,7 @@ class Setting {
* @since 2.8.0
*/
private mixed $default_value,
-
+
/**
* Setting data type.
*
@@ -151,7 +151,7 @@ class Setting {
* @since 2.8.0
*/
private string $type,
-
+
/**
* Setting input field type.
*
@@ -160,7 +160,7 @@ class Setting {
* @since 2.8.0
*/
private string $input_type,
-
+
/**
* Setting input field options (for 'select' inputs).
*
@@ -169,7 +169,7 @@ class Setting {
* @since 2.8.0
*/
private ?array $input_options,
-
+
/**
* Setting input field max. value (for 'number' inputs).
*
@@ -178,7 +178,7 @@ class Setting {
* @since 2.8.0
*/
private int|float|null $input_max,
-
+
/**
* Setting input field min. value (for 'number' inputs).
*
@@ -187,7 +187,7 @@ class Setting {
* @since 2.8.0
*/
private int|float|null $input_min,
-
+
/**
* The setting for whether this setting is enabled or not.
*
@@ -196,7 +196,7 @@ class Setting {
* @since 2.8.0
*/
private ?string $enabled_by,
-
+
/**
* Any setting that overrides this setting.
*
@@ -204,8 +204,8 @@ class Setting {
*
* @since 2.8.0
*/
- private ?string $overridden_by,
-
+ private ?string $overridden_by,
+
/**
* The plugin settings object.
*
@@ -216,10 +216,10 @@ class Setting {
private Settings $settings
) {
$this->value = $this->default_value;
-
- register_setting( $this->options_group_slug, $this->key, $this->get_setting_args());
+
+ register_setting( $this->options_group_slug, $this->key, $this->get_setting_args() );
}
-
+
/**
* Get the args for registering the settings with WordPress.
*
@@ -230,13 +230,13 @@ class Setting {
* @since 2.8.0
*/
public function get_setting_args(): array {
- return array (
- 'type' => $this->type,
+ return array(
+ 'type' => $this->type,
'description' => $this->description,
- 'default' => $this->default_value,
+ 'default' => $this->default_value,
);
}
-
+
/**
* Get the args for rendering setting fields on the admin. dashboard.
*
@@ -247,19 +247,19 @@ class Setting {
* @since 2.8.0
*/
public function get_setting_field_args(): array {
- return array (
- 'name' => $this->key,
- 'label_for' => $this->key,
- 'value' => $this->value,
+ return array(
+ 'name' => $this->key,
+ 'label_for' => $this->key,
+ 'value' => $this->value,
'description' => $this->description,
- 'type' => $this->input_type,
- 'options' => $this->input_options,
- 'max' => $this->input_max,
- 'min' => $this->input_min,
- 'disabled' => $this->is_disabled_or_overridden()
+ 'type' => $this->input_type,
+ 'options' => $this->input_options,
+ 'max' => $this->input_max,
+ 'min' => $this->input_min,
+ 'disabled' => $this->is_disabled_or_overridden(),
);
}
-
+
/**
* Check whether a setting is enabled and/or overridden.
*
@@ -269,28 +269,36 @@ class Setting {
*
* @since 2.8.0
*/
- private function is_disabled_or_overridden(): ?bool {
- if (isset($this->enabled_by)) {
- $enabled_by_value = $this->settings->get_setting_value($this->enabled_by);
- $is_enabled = (isset($enabled_by_value) || 'userdefined' === $enabled_by_value);
+ private function is_disabled_or_overridden(): ?bool {
+ if ( isset( $this->enabled_by ) ) {
+ $enabled_by_value = $this->settings->get_setting_value( $this->enabled_by );
+ $is_enabled = ( isset( $enabled_by_value ) || 'userdefined' === $enabled_by_value );
}
-
- if (isset($this->overridden_by)) {
- $overridden_by_value = $this->settings->get_setting_value($this->overridden_by);
- $is_overridden = !(null === $overridden_by_value || '' === $overridden_by_value);
+
+ if ( isset( $this->overridden_by ) ) {
+ $overridden_by_value = $this->settings->get_setting_value( $this->overridden_by );
+ $is_overridden = ! ( null === $overridden_by_value || '' === $overridden_by_value );
+ }
+
+ if ( isset( $is_enabled ) || isset( $is_overridden ) ) {
+ if ( isset( $is_enabled ) && ! $is_enabled ) {
+ return true;
+ }
+
+ if ( isset( $is_enabled ) && $is_enabled && ( isset( $is_overridden ) && ! $is_overridden ) ) {
+ return false;
+ }
+
+ if ( isset( $is_overridden ) && $is_overridden ) {
+ return true;
+ }
+
+ return false;
+ } else {
+ return null;
}
-
- if (isset($is_enabled) || isset($is_overridden)) {
- if (isset($is_enabled) && !$is_enabled) return true;
-
- if (isset($is_enabled) && $is_enabled && (isset($is_overridden) && !$is_overridden)) return false;
-
- if (isset($is_overridden) && $is_overridden) return true;
-
- return false;
- } else return null;
}
-
+
/**
* Gets the slug of the setting's options group.
*
@@ -301,7 +309,7 @@ class Setting {
public function get_options_group_slug(): string {
return $this->options_group_slug;
}
-
+
/**
* Gets the slug of the setting's section.
*
@@ -312,7 +320,7 @@ class Setting {
public function get_section_slug(): string {
return $this->section_slug;
}
-
+
/**
* Gets the value of the setting.
*
@@ -323,7 +331,7 @@ class Setting {
public function get_value(): mixed {
return $this->value ?? $this->default_value ?? null;
}
-
+
/**
* Gets the default value of the setting.
*
@@ -334,7 +342,7 @@ class Setting {
public function get_default_value(): mixed {
return $this->default_value ?? null;
}
-
+
/**
* Gets the input options of the setting.
*
@@ -345,7 +353,7 @@ class Setting {
public function get_input_options(): ?array {
return $this->input_options ?? null;
}
-
+
/**
* Sets the value of the setting.
*
@@ -354,7 +362,7 @@ class Setting {
*
* @since 2.8.0
*/
- public function set_value(mixed $value): bool {
+ public function set_value( $value ): bool {
$this->value = $value;
return true;
}
diff --git a/src/includes/settings/class-settings-group.php b/src/includes/settings/class-settingsgroup.php
similarity index 58%
rename from src/includes/settings/class-settings-group.php
rename to src/includes/settings/class-settingsgroup.php
index 1d50b67..8fdbef0 100644
--- a/src/includes/settings/class-settings-group.php
+++ b/src/includes/settings/class-settingsgroup.php
@@ -16,10 +16,14 @@ use footnotes\admin\layout\SettingsPage;
/**
* Class defining a group of plugin settings within a section.
*
+ * NB: the concept of a 'settings group' is just a semantic aide for developers,
+ * it has no relevance within WordPress itself, which only recognises settings
+ * sections and options groups.
+ *
* @package footnotes
* @since 2.8.0
*/
-abstract class SettingsGroup {
+abstract class SettingsGroup {
/**
* Setting group ID.
*
@@ -28,7 +32,7 @@ abstract class SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'undefined';
-
+
/**
* Setting group name.
*
@@ -37,7 +41,7 @@ abstract class SettingsGroup {
* @since 2.8.0
*/
const GROUP_NAME = 'undefined';
-
+
/**
* The setting classes.
*
@@ -46,7 +50,7 @@ abstract class SettingsGroup {
* @since 2.8.0
*/
protected array $setting_classes;
-
+
/**
* The settings in this group.
*
@@ -55,7 +59,7 @@ abstract class SettingsGroup {
* @since 2.8.0
*/
protected array $settings;
-
+
/**
* Constructs the settings section.
*
@@ -69,8 +73,8 @@ abstract class SettingsGroup {
*
* @since 2.8.0
*/
- protected string $options_group_slug,
-
+ protected string $options_group_slug,
+
/**
* Setting section slug.
*
@@ -79,7 +83,7 @@ abstract class SettingsGroup {
* @since 2.8.0
*/
protected string $section_slug,
-
+
/**
* The plugin settings object.
*
@@ -87,12 +91,12 @@ abstract class SettingsGroup {
* @since 2.8.0
*/
protected Settings $settings_obj
- ) {
+ ) {
$this->load_dependencies();
-
+
$this->add_settings( get_option( $this->options_group_slug ) );
}
-
+
/**
* Load the required dependencies.
*
@@ -105,32 +109,32 @@ abstract class SettingsGroup {
protected function load_dependencies(): void {
require_once plugin_dir_path( __DIR__ ) . 'settings/class-setting.php';
}
-
+
/**
* Add the settings for this settings group.
*
* @abstract
- * @param array|false $options Saved values for the settings in this group. 'False' if none exist.
+ * @param array|false $options Saved values for the settings in this group. 'False' if none exist.
* @return void
*
* @since 2.8.0
*/
- protected abstract function add_settings(array|false $options): void;
-
+ abstract protected function add_settings( array|false $options): void;
+
/**
* Constructs settings from the provided details.
*
- * @param array $setting The setting details.
+ * @param array $setting The setting details.
* @return Setting The constructed setting object.
*
* @since 2.8.0
*/
- protected function add_setting(array $setting): Setting {
+ protected function add_setting( array $setting ): Setting {
extract( $setting );
-
+
return new Setting(
- self::GROUP_ID,
- $this->options_group_slug,
+ self::GROUP_ID,
+ $this->options_group_slug,
$this->section_slug,
$key,
$name,
@@ -146,84 +150,100 @@ abstract class SettingsGroup {
$this->settings_obj
);
}
-
+
/**
* Load the values for this settings group.
*
- * @param array|false $options Saved values for the settings in this group. 'False' if none exist.
+ * @param array|false $options Saved values for the settings in this group. 'False' if none exist.
* @return void
*
* @since 2.8.0
- * @todo Remove settings from options group when not found.
+ * @todo Remove settings from options group when not found.
*/
- protected function load_values(array|false $options): void {
- if ( ! $options ) return;
-
+ protected function load_values( array|false $options ): void {
+ if ( ! $options ) {
+ return;
+ }
+
foreach ( $options as $setting_key => $setting_value ) {
- if ( array_key_exists( $setting_key, $this->settings ) )
- $this->settings[$setting_key]->set_value( $setting_value );
- }
+ if ( array_key_exists( $setting_key, $this->settings ) ) {
+ $this->settings[ $setting_key ]->set_value( $setting_value );
+ }
+ }
}
-
+
/**
* Adds all the settings fields for this group to the admin. dashboard.
*
- * @param SettingsPage $component The admin. dashboard settings page.
+ * @param SettingsPage $component The admin. dashboard settings page.
* @return void
*
* @since 2.8.0
*/
- public function add_settings_fields(SettingsPage $component): void {
- foreach ($this->settings as $setting) {
+ public function add_settings_fields( SettingsPage $component ): void {
+ foreach ( $this->settings as $setting ) {
add_settings_field(
- $setting->key,
+ $setting->key,
__( $setting->name, 'footnotes' ),
- array ($component, 'setting_field_callback'),
+ array( $component, 'setting_field_callback' ),
'footnotes',
$setting->get_section_slug(),
$setting->get_setting_field_args()
);
}
}
-
+
/**
+ * Retrieve a setting by its key.
+ *
* @see Settings::get_setting()
*/
- public function get_setting(string $setting_key): ?Setting {
- foreach ($this->settings as $setting) {
- if ($setting->key === $setting_key) return $setting;
+ public function get_setting( string $setting_key ): ?Setting {
+ foreach ( $this->settings as $setting ) {
+ if ( $setting->key === $setting_key ) {
+ return $setting;
+ }
}
-
+
return null;
}
-
+
/**
+ * Creates an options group from the values of the settings in this section.
+ *
* @see SettingsSection::get_options()
*/
public function get_options(): array {
$options = array();
-
- foreach ($this->settings as $setting) {
- $options[$setting->key] = $setting->get_value();
+
+ foreach ( $this->settings as $setting ) {
+ $options[ $setting->key ] = $setting->get_value();
}
-
+
return $options;
}
/**
+ * Get a setting's value by its key.
+ *
* @see Settings::get_setting_value()
*/
- public function get_setting_value(string $setting_key) {
- $setting = $this->get_setting($setting_key);
+ public function get_setting_value( string $setting_key ) {
+ $setting = $this->get_setting( $setting_key );
- if (! $setting) return null;
- else return $setting->value ?? $setting->default_value;
+ if ( ! $setting ) {
+ return null;
+ } else {
+ return $setting->value ?? $setting->default_value;
+ }
}
/**
+ * Set a setting's value by its key.
+ *
* @see Settings::set_setting_value()
*/
- public function set_setting_value(string $setting_key, $value): bool {
- return $this->get_setting($setting_key)->set_value($value);
+ public function set_setting_value( string $setting_key, $value ): bool {
+ return $this->get_setting( $setting_key )->set_value( $value );
}
}
diff --git a/src/includes/settings/class-settings-section.php b/src/includes/settings/class-settingssection.php
similarity index 58%
rename from src/includes/settings/class-settings-section.php
rename to src/includes/settings/class-settingssection.php
index 03be3a4..7b4b079 100644
--- a/src/includes/settings/class-settings-section.php
+++ b/src/includes/settings/class-settingssection.php
@@ -21,7 +21,7 @@ use footnotes\admin\layout as Layout;
* @package footnotes
* @since 2.8.0
*/
-abstract class SettingsSection {
+abstract class SettingsSection {
/**
* Setting options group slug.
*
@@ -30,7 +30,7 @@ abstract class SettingsSection {
* @since 2.8.0
*/
protected string $options_group_slug;
-
+
/**
* Settings section slug.
*
@@ -39,7 +39,7 @@ abstract class SettingsSection {
* @since 2.8.0
*/
protected string $section_slug = '';
-
+
/**
* Settings section title.
*
@@ -48,7 +48,7 @@ abstract class SettingsSection {
* @since 2.8.0
*/
protected string $title = '';
-
+
/**
* The groups of settings within this section.
*
@@ -57,7 +57,7 @@ abstract class SettingsSection {
* @since 2.8.0
*/
protected array $settings_groups;
-
+
/**
* Load the required dependencies.
*
@@ -70,36 +70,36 @@ abstract class SettingsSection {
protected function load_dependencies(): void {
require_once plugin_dir_path( __DIR__ ) . 'settings/class-setting.php';
}
-
+
public function load_options_group(): void {
- $options_group = get_option($this->options_group_slug);
-
- if (!! $options_group) {
- foreach ($options_group as $setting_key => $setting_value) {
- $this->set_setting_value($setting_key, $setting_value);
+ $options_group = get_option( $this->options_group_slug );
+
+ if ( ! ! $options_group ) {
+ foreach ( $options_group as $setting_key => $setting_value ) {
+ $this->set_setting_value( $setting_key, $setting_value );
}
}
}
-
+
public function add_settings_section(): void {
add_settings_section(
- $this->section_slug,
- __( $this->title, 'footnotes'),
- array($this, 'setting_section_callback'),
+ $this->section_slug,
+ __( $this->title, 'footnotes' ),
+ array( $this, 'setting_section_callback' ),
'footnotes'
);
}
-
- public function add_settings_fields($component): void {
- foreach($this->settings_groups as $settings_group) {
- $settings_group->add_settings_fields($component);
+
+ public function add_settings_fields( $component ): void {
+ foreach ( $this->settings_groups as $settings_group ) {
+ $settings_group->add_settings_fields( $component );
}
}
-
+
public function setting_section_callback(): void {
- echo " ";
+ echo ' ';
}
-
+
/**
* Add the settings groups for this settings section.
*
@@ -108,12 +108,12 @@ abstract class SettingsSection {
*
* @since 2.8.0
*/
- protected abstract function add_settings_groups(): void;
-
+ abstract protected function add_settings_groups(): void;
+
public function get_options_group_slug(): string {
return $this->options_group_slug;
}
-
+
/**
* Gets the settings section slug.
*
@@ -124,7 +124,7 @@ abstract class SettingsSection {
public function get_section_slug(): string {
return $this->section_slug;
}
-
+
/**
* Gets the settings section title.
*
@@ -135,32 +135,36 @@ abstract class SettingsSection {
public function get_title(): string {
return $this->title;
}
-
+
/**
* Gets a settings groups from this section by its ID.
*
- * @param string group_id The ID of the settings group.
+ * @param string $group_id The ID of the settings group.
* @return ?SettingsGroup The section group. 'None' if none found.
*
* @since 2.8.0
*/
- public function get_settings_group(string $group_id): ?SettingsGroup {
- return $this->settings_groups[$group_id] ?? null;
+ public function get_settings_group( string $group_id ): ?SettingsGroup {
+ return $this->settings_groups[ $group_id ] ?? null;
}
-
+
/**
+ * Retrieve a setting by its key.
+ *
* @see Settings::get_setting()
*/
- public function get_setting(string $setting_key): ?Setting {
- foreach ($this->settings_groups as $settings_group) {
- $setting = $settings_group->get_setting($setting_key);
-
- if ($setting) return $setting;
+ public function get_setting( string $setting_key ): ?Setting {
+ foreach ( $this->settings_groups as $settings_group ) {
+ $setting = $settings_group->get_setting( $setting_key );
+
+ if ( $setting ) {
+ return $setting;
+ }
}
-
+
return null;
}
-
+
/**
* Creates an options group from the values of the settings in this section.
*
@@ -170,31 +174,41 @@ abstract class SettingsSection {
*/
public function get_options(): array {
$options = array();
-
- foreach ($this->settings_groups as $settings_group) {
- $options = array_merge($options, $settings_group->get_options());
+
+ foreach ( $this->settings_groups as $settings_group ) {
+ $options = array_merge( $options, $settings_group->get_options() );
}
-
+
return $options;
}
/**
+ * Retrieve a setting's default value by its key.
+ *
* @see Settings::get_setting_value()
*/
- public function get_setting_value(string $setting_key) {
- $setting = $this->get_setting($setting_key);
+ public function get_setting_value( string $setting_key ) {
+ $setting = $this->get_setting( $setting_key );
- if (! $setting) return null;
- else return $setting->value ?? $setting->default_value ?? trigger_error("No default value found for ".$setting_key.".", E_USER_ERROR);
+ if ( ! $setting ) {
+ return null;
+ } else {
+ return $setting->value ?? $setting->default_value ?? trigger_error( 'No default value found for ' . $setting_key . '.', E_USER_ERROR );
+ }
}
/**
+ * Set a setting's value by its key.
+ *
* @see Settings::set_setting_value()
*/
- public function set_setting_value(string $setting_key, $value): ?bool {
- $setting = $this->get_setting($setting_key);
-
- if (! $setting) return null;
- else return $setting->set_value($value);
+ public function set_setting_value( string $setting_key, $value ): ?bool {
+ $setting = $this->get_setting( $setting_key );
+
+ if ( ! $setting ) {
+ return null;
+ } else {
+ return $setting->set_value( $value );
+ }
}
}
diff --git a/src/includes/settings/custom-css/class-custom-css-settings-group.php b/src/includes/settings/custom-css/class-customcsssettingsgroup.php
similarity index 67%
rename from src/includes/settings/custom-css/class-custom-css-settings-group.php
rename to src/includes/settings/custom-css/class-customcsssettingsgroup.php
index db44342..e6dc1a8 100644
--- a/src/includes/settings/custom-css/class-custom-css-settings-group.php
+++ b/src/includes/settings/custom-css/class-customcsssettingsgroup.php
@@ -29,7 +29,7 @@ class CustomCSSSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
public const GROUP_ID = 'custom-css';
-
+
/**
* Setting group name.
*
@@ -49,28 +49,15 @@ class CustomCSSSettingsGroup extends SettingsGroup {
* Convert from `string` to `array`.
*/
public const CUSTOM_CSS = array(
- 'key' => 'footnote_inputfield_custom_css_new',
- 'name' => 'Your Existing Custom CSS Code',
- 'type' => 'string',
- 'input_type' => 'textarea',
+ 'key' => 'footnote_inputfield_custom_css_new',
+ 'name' => 'Your Existing Custom CSS Code',
+ 'type' => 'string',
+ 'input_type' => 'textarea',
);
-
+
/**
- * Load the required dependencies.
+ * Add the settings for this settings group.
*
- * Include the following files that provide the settings for this plugin:
- *
- * - {@see SettingsGroup}: defines a group of settings.
- *
- * @see SettingsGroup::load_dependencies()
- */
- protected function load_dependencies(): void {
- parent::load_dependencies();
-
- require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
- }
-
- /**
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/custom-css/class-custom-css-settings-section.php b/src/includes/settings/custom-css/class-customcsssettingssection.php
similarity index 70%
rename from src/includes/settings/custom-css/class-custom-css-settings-section.php
rename to src/includes/settings/custom-css/class-customcsssettingssection.php
index 347a023..5f96d8a 100644
--- a/src/includes/settings/custom-css/class-custom-css-settings-section.php
+++ b/src/includes/settings/custom-css/class-customcsssettingssection.php
@@ -22,7 +22,7 @@ use footnotes\includes\settings\customcss\CustomCSSSettingsGroup;
* @package footnotes
* @since 2.8.0
*/
-class CustomCSSSettingsSection extends SettingsSection {
+class CustomCSSSettingsSection extends SettingsSection {
/**
* The groups of settings within this section.
*
@@ -31,13 +31,13 @@ class CustomCSSSettingsSection extends SettingsSection {
* @since 2.8.0
*/
protected array $settings_groups;
-
+
/**
* Constructs the settings section.
*
- * @param string options_group_slug The slug of the settings section's options group.
- * @param string section_slug The slug of the settings section.
- * @param string title The name of the settings section.
+ * @param string $options_group_slug The slug of the settings section's options group.
+ * @param string $section_slug The slug of the settings section.
+ * @param string $title The name of the settings section.
*
* @since 2.8.0
*/
@@ -45,7 +45,7 @@ class CustomCSSSettingsSection extends SettingsSection {
$options_group_slug,
$section_slug,
$title,
-
+
/**
* The plugin settings object.
*
@@ -55,12 +55,12 @@ class CustomCSSSettingsSection extends SettingsSection {
private Settings $settings
) {
$this->options_group_slug = $options_group_slug;
- $this->section_slug = $section_slug;
- $this->title = $title;
-
+ $this->section_slug = $section_slug;
+ $this->title = $title;
+
$this->load_dependencies();
-
- $this->add_settings_groups(get_option( $this->options_group_slug ));
+
+ $this->add_settings_groups( get_option( $this->options_group_slug ) );
$this->load_options_group();
}
@@ -76,19 +76,19 @@ class CustomCSSSettingsSection extends SettingsSection {
* @see SettingsSection::load_dependencies()
*/
protected function load_dependencies(): void {
- parent::load_dependencies();
+ parent::load_dependencies();
- require_once plugin_dir_path( __DIR__ ) . 'class-settings-section.php';
-
- require_once plugin_dir_path( __DIR__ ) . 'custom-css/class-custom-css-settings-group.php';
+ require_once plugin_dir_path( __DIR__ ) . 'custom-css/class-customcsssettingsgroup.php';
}
-
+
/**
+ * Add the settings groups for this settings section.
+ *
* @see SettingsSection::add_settings_groups()
*/
protected function add_settings_groups(): void {
- $this->settings_groups = array (
- CustomCSSSettingsGroup::GROUP_ID => new CustomCSSSettingsGroup($this->options_group_slug, $this->section_slug, $this->settings ),
+ $this->settings_groups = array(
+ CustomCSSSettingsGroup::GROUP_ID => new CustomCSSSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
);
}
}
diff --git a/src/includes/settings/general/class-amp-compat-settings-group.php b/src/includes/settings/general/class-ampcompatsettingsgroup.php
similarity index 97%
rename from src/includes/settings/general/class-amp-compat-settings-group.php
rename to src/includes/settings/general/class-ampcompatsettingsgroup.php
index 142ffde..484b537 100644
--- a/src/includes/settings/general/class-amp-compat-settings-group.php
+++ b/src/includes/settings/general/class-ampcompatsettingsgroup.php
@@ -32,7 +32,7 @@ class AMPCompatSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'amp-compat';
-
+
/**
* Setting group name.
*
@@ -60,8 +60,10 @@ class AMPCompatSettingsGroup extends SettingsGroup {
'type' => 'boolean',
'input_type' => 'checkbox',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/general/class-excerpts-settings-group.php b/src/includes/settings/general/class-excerptssettingsgroup.php
similarity index 94%
rename from src/includes/settings/general/class-excerpts-settings-group.php
rename to src/includes/settings/general/class-excerptssettingsgroup.php
index a908d64..96d503b 100644
--- a/src/includes/settings/general/class-excerpts-settings-group.php
+++ b/src/includes/settings/general/class-excerptssettingsgroup.php
@@ -22,7 +22,7 @@ use footnotes\includes\settings\SettingsGroup;
* @since 2.8.0
*/
class ExcerptsSettingsGroup extends SettingsGroup {
- /**
+ /**
* Setting group ID.
*
* @var string
@@ -30,7 +30,7 @@ class ExcerptsSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'excerpts';
-
+
/**
* Setting group name.
*
@@ -59,11 +59,13 @@ class ExcerptsSettingsGroup extends SettingsGroup {
'input_options' => array(
'yes' => 'Yes, generate excerpts from posts with effectively processed footnotes and other markup',
'no' => 'No, generate excerpts from posts but remove all footnotes and output plain text',
- 'manual' => 'Yes but run the process only to display tooltips in manual excerpts with footnote short codes'
+ 'manual' => 'Yes but run the process only to display tooltips in manual excerpts with footnote short codes',
),
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/general/class-general-settings-section.php b/src/includes/settings/general/class-generalsettingssection.php
similarity index 85%
rename from src/includes/settings/general/class-general-settings-section.php
rename to src/includes/settings/general/class-generalsettingssection.php
index 6a6f346..5f40fbd 100644
--- a/src/includes/settings/general/class-general-settings-section.php
+++ b/src/includes/settings/general/class-generalsettingssection.php
@@ -41,9 +41,9 @@ class GeneralSettingsSection extends SettingsSection {
/**
* Constructs the settings section.
*
- * @param string options_group_slug The slug of the settings section's options group.
- * @param string section_slug The slug of the settings section.
- * @param string title The name of the settings section.
+ * @param string $options_group_slug The slug of the settings section's options group.
+ * @param string $section_slug The slug of the settings section.
+ * @param string $title The name of the settings section.
*
* @since 2.8.0
*/
@@ -51,7 +51,7 @@ class GeneralSettingsSection extends SettingsSection {
$options_group_slug,
$section_slug,
$title,
-
+
/**
* The plugin settings object.
*
@@ -91,17 +91,19 @@ class GeneralSettingsSection extends SettingsSection {
protected function load_dependencies(): void {
parent::load_dependencies();
- require_once plugin_dir_path( __DIR__ ) . 'general/class-reference-container-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'general/class-scrolling-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'general/class-shortcode-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'general/class-numbering-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'general/class-hard-links-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'general/class-love-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'general/class-excerpts-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'general/class-amp-compat-settings-group.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-referencecontainersettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-scrollingsettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-shortcodesettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-numberingsettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-hardlinkssettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-lovesettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-excerptssettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'general/class-ampcompatsettingsgroup.php';
}
-
+
/**
+ * Add the settings groups for this settings section.
+ *
* @see SettingsSection::add_settings_groups()
*/
protected function add_settings_groups(): void {
diff --git a/src/includes/settings/general/class-hard-links-settings-group.php b/src/includes/settings/general/class-hardlinkssettingsgroup.php
similarity index 89%
rename from src/includes/settings/general/class-hard-links-settings-group.php
rename to src/includes/settings/general/class-hardlinkssettingsgroup.php
index de20c77..ac0a8fb 100644
--- a/src/includes/settings/general/class-hard-links-settings-group.php
+++ b/src/includes/settings/general/class-hardlinkssettingsgroup.php
@@ -29,7 +29,7 @@ class HardLinksSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'hard-links';
-
+
/**
* Setting group name.
*
@@ -157,18 +157,20 @@ class HardLinksSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'text',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
$this->settings = array(
- self::FOOTNOTES_HARD_LINKS_ENABLE['key'] => $this->add_setting( self::FOOTNOTES_HARD_LINKS_ENABLE ),
- self::REFERRER_FRAGMENT_ID_SLUG['key'] => $this->add_setting( self::REFERRER_FRAGMENT_ID_SLUG ),
- self::FOOTNOTE_FRAGMENT_ID_SLUG['key'] => $this->add_setting( self::FOOTNOTE_FRAGMENT_ID_SLUG ),
- self::HARD_LINK_IDS_SEPARATOR['key'] => $this->add_setting( self::HARD_LINK_IDS_SEPARATOR ),
+ self::FOOTNOTES_HARD_LINKS_ENABLE['key'] => $this->add_setting( self::FOOTNOTES_HARD_LINKS_ENABLE ),
+ self::REFERRER_FRAGMENT_ID_SLUG['key'] => $this->add_setting( self::REFERRER_FRAGMENT_ID_SLUG ),
+ self::FOOTNOTE_FRAGMENT_ID_SLUG['key'] => $this->add_setting( self::FOOTNOTE_FRAGMENT_ID_SLUG ),
+ self::HARD_LINK_IDS_SEPARATOR['key'] => $this->add_setting( self::HARD_LINK_IDS_SEPARATOR ),
self::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE['key'] => $this->add_setting( self::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ),
- self::FOOTNOTES_BACKLINK_TOOLTIP_TEXT['key'] => $this->add_setting( self::FOOTNOTES_BACKLINK_TOOLTIP_TEXT ),
+ self::FOOTNOTES_BACKLINK_TOOLTIP_TEXT['key'] => $this->add_setting( self::FOOTNOTES_BACKLINK_TOOLTIP_TEXT ),
);
$this->load_values( $options );
diff --git a/src/includes/settings/general/class-love-settings-group.php b/src/includes/settings/general/class-lovesettingsgroup.php
similarity index 95%
rename from src/includes/settings/general/class-love-settings-group.php
rename to src/includes/settings/general/class-lovesettingsgroup.php
index 9aee495..402491f 100644
--- a/src/includes/settings/general/class-love-settings-group.php
+++ b/src/includes/settings/general/class-lovesettingsgroup.php
@@ -30,7 +30,7 @@ class LoveSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const LOVE_SYMBOL = '♥';
-
+
/**
* The HTML Plugin logogram.
*
@@ -39,7 +39,7 @@ class LoveSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const PLUGIN_SYMBOL = '';
-
+
/**
* Setting group ID.
*
@@ -48,7 +48,7 @@ class LoveSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'love';
-
+
/**
* Setting group name.
*
@@ -74,7 +74,7 @@ class LoveSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'select',
'input_options' => array(
- // Logo only.
+ // Logo only.
'text-3' => self::PLUGIN_SYMBOL,
// Logo followed by heart symbol.
'text-4' => self::PLUGIN_SYMBOL . ' ' . self::LOVE_SYMBOL,
@@ -93,9 +93,9 @@ class LoveSettingsGroup extends SettingsGroup {
'no' => 'no display of any mention in the footer',
),
);
-
+
/**
- * Settings container key for the shortcode to NOT display the ‘LOVE ME’ slug
+ * Settings container key for the shortcode to NOT display the ‘LOVE ME’ slug
* on certain pages.
*
* @var array
@@ -112,13 +112,15 @@ class LoveSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'text',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
$this->settings = array(
- self::FOOTNOTES_LOVE['key'] => $this->add_setting( self::FOOTNOTES_LOVE ),
+ self::FOOTNOTES_LOVE['key'] => $this->add_setting( self::FOOTNOTES_LOVE ),
self::FOOTNOTES_NO_LOVE_SLUG['key'] => $this->add_setting( self::FOOTNOTES_NO_LOVE_SLUG ),
);
diff --git a/src/includes/settings/general/class-numbering-settings-group.php b/src/includes/settings/general/class-numberingsettingsgroup.php
similarity index 92%
rename from src/includes/settings/general/class-numbering-settings-group.php
rename to src/includes/settings/general/class-numberingsettingsgroup.php
index 714ac63..80e3ed6 100644
--- a/src/includes/settings/general/class-numbering-settings-group.php
+++ b/src/includes/settings/general/class-numberingsettingsgroup.php
@@ -29,7 +29,7 @@ class NumberingSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'numbering';
-
+
/**
* Setting group name.
*
@@ -42,7 +42,7 @@ class NumberingSettingsGroup extends SettingsGroup {
/**
* Settings container key for combining identical footnotes.
*
- * @link https://wordpress.org/support/topic/add-support-for-ibid-notation
+ * @link https://wordpress.org/support/topic/add-support-for-ibid-notation
* Support for Ibid. notation added thanks to @meglio.
*
* @var array
@@ -60,7 +60,7 @@ class NumberingSettingsGroup extends SettingsGroup {
'type' => 'boolean',
'input_type' => 'checkbox',
);
-
+
/**
* Settings container key for the counter style of the footnotes.
*
@@ -77,7 +77,7 @@ class NumberingSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'select',
'input_options' => array(
- 'arabic_plain' => 'plain Arabic numbers (1, 2, 3, 4, 5, …)',
+ 'arabic_plain' => 'plain Arabic numbers (1, 2, 3, 4, 5, …)',
'arabic_leading' => 'zero-padded Arabic numbers (01, 02, 03, 04, 05, …)',
'latin_low' => 'lowercase Latin letters (a, b, c, d, e, …)',
'latin_high' => 'uppercase Latin letters (A, B, C, D, E, …)',
@@ -85,14 +85,16 @@ class NumberingSettingsGroup extends SettingsGroup {
'roman_low' => 'lowercase Roman numerals (i, ii, iii, iv, v, …)',
),
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
$this->settings = array(
self::COMBINE_IDENTICAL_FOOTNOTES['key'] => $this->add_setting( self::COMBINE_IDENTICAL_FOOTNOTES ),
- self::FOOTNOTES_COUNTER_STYLE['key'] => $this->add_setting( self::FOOTNOTES_COUNTER_STYLE ),
+ self::FOOTNOTES_COUNTER_STYLE['key'] => $this->add_setting( self::FOOTNOTES_COUNTER_STYLE ),
);
$this->load_values( $options );
diff --git a/src/includes/settings/general/class-reference-container-settings-group.php b/src/includes/settings/general/class-referencecontainersettingsgroup.php
similarity index 99%
rename from src/includes/settings/general/class-reference-container-settings-group.php
rename to src/includes/settings/general/class-referencecontainersettingsgroup.php
index 0ee04c4..0a6a235 100644
--- a/src/includes/settings/general/class-reference-container-settings-group.php
+++ b/src/includes/settings/general/class-referencecontainersettingsgroup.php
@@ -29,7 +29,7 @@ class ReferenceContainerSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'reference-container';
-
+
/**
* Setting group name.
*
@@ -71,7 +71,7 @@ class ReferenceContainerSettingsGroup extends SettingsGroup {
'default_value' => 'p',
'type' => 'string',
'input_type' => 'select',
- 'input_options' => Setting::TEXT_ELEMENT_OPTIONS
+ 'input_options' => Setting::TEXT_ELEMENT_OPTIONS,
);
/**
@@ -687,8 +687,10 @@ class ReferenceContainerSettingsGroup extends SettingsGroup {
'type' => 'boolean',
'input_type' => 'checkbox',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/general/class-scrolling-settings-group.php b/src/includes/settings/general/class-scrollingsettingsgroup.php
similarity index 99%
rename from src/includes/settings/general/class-scrolling-settings-group.php
rename to src/includes/settings/general/class-scrollingsettingsgroup.php
index b39d2c0..fc9f951 100644
--- a/src/includes/settings/general/class-scrolling-settings-group.php
+++ b/src/includes/settings/general/class-scrollingsettingsgroup.php
@@ -29,7 +29,7 @@ class ScrollingSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'scrolling';
-
+
/**
* Setting group name.
*
@@ -179,8 +179,10 @@ class ScrollingSettingsGroup extends SettingsGroup {
'input_min' => 0,
'enabled_by' => self::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY,
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/general/class-shortcode-settings-group.php b/src/includes/settings/general/class-shortcodesettingsgroup.php
similarity index 99%
rename from src/includes/settings/general/class-shortcode-settings-group.php
rename to src/includes/settings/general/class-shortcodesettingsgroup.php
index 111d157..fc46ee4 100644
--- a/src/includes/settings/general/class-shortcode-settings-group.php
+++ b/src/includes/settings/general/class-shortcodesettingsgroup.php
@@ -29,7 +29,7 @@ class ShortcodeSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'shortcode';
-
+
/**
* Setting group name.
*
@@ -148,8 +148,10 @@ class ShortcodeSettingsGroup extends SettingsGroup {
'input_type' => 'text',
'enabled_by' => self::FOOTNOTES_SHORT_CODE_END,
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/referrers-and-tooltips/class-backlink-symbol-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-backlinksymbolsettingsgroup.php
similarity index 78%
rename from src/includes/settings/referrers-and-tooltips/class-backlink-symbol-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-backlinksymbolsettingsgroup.php
index 46e6624..b391e25 100644
--- a/src/includes/settings/referrers-and-tooltips/class-backlink-symbol-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-backlinksymbolsettingsgroup.php
@@ -29,7 +29,7 @@ class BacklinkSymbolSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'backlink-symbol';
-
+
/**
* Setting group name.
*
@@ -56,21 +56,21 @@ class BacklinkSymbolSettingsGroup extends SettingsGroup {
'default_value' => 0,
'type' => 'number',
'input_type' => 'select',
- 'input_options' => array(
- '↑',
- '↥',
- '↟',
- '↩',
- '↲',
- '↵',
- '⇑',
- '⇡',
- '⇧',
- '↑'
- ),
+ 'input_options' => array(
+ '↑',
+ '↥',
+ '↟',
+ '↩',
+ '↲',
+ '↵',
+ '⇑',
+ '⇡',
+ '⇧',
+ '↑',
+ ),
'overridden_by' => self::HYPERLINK_ARROW_USER_DEFINED,
);
-
+
/**
* Settings container key for the user-defined backlink symbol.
*
@@ -81,19 +81,21 @@ class BacklinkSymbolSettingsGroup extends SettingsGroup {
* Convert from `string` to `array`.
*/
const HYPERLINK_ARROW_USER_DEFINED = array(
- 'key' => 'footnote_inputfield_custom_hyperlink_symbol_user',
- 'name' => 'Input the Backlink Symbol',
- 'description' => 'Your input overrides the selection.',
- 'type' => 'string',
- 'input_type' => 'text',
+ 'key' => 'footnote_inputfield_custom_hyperlink_symbol_user',
+ 'name' => 'Input the Backlink Symbol',
+ 'description' => 'Your input overrides the selection.',
+ 'type' => 'string',
+ 'input_type' => 'text',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
$this->settings = array(
- self::HYPERLINK_ARROW['key'] => $this->add_setting( self::HYPERLINK_ARROW ),
+ self::HYPERLINK_ARROW['key'] => $this->add_setting( self::HYPERLINK_ARROW ),
self::HYPERLINK_ARROW_USER_DEFINED['key'] => $this->add_setting( self::HYPERLINK_ARROW_USER_DEFINED ),
);
diff --git a/src/includes/settings/referrers-and-tooltips/class-referrers-and-tooltips-settings-section.php b/src/includes/settings/referrers-and-tooltips/class-referrersandtooltipssettingssection.php
similarity index 67%
rename from src/includes/settings/referrers-and-tooltips/class-referrers-and-tooltips-settings-section.php
rename to src/includes/settings/referrers-and-tooltips/class-referrersandtooltipssettingssection.php
index 894687d..bd5a72f 100644
--- a/src/includes/settings/referrers-and-tooltips/class-referrers-and-tooltips-settings-section.php
+++ b/src/includes/settings/referrers-and-tooltips/class-referrersandtooltipssettingssection.php
@@ -19,7 +19,7 @@ use footnotes\includes\settings\SettingsSection;
* @package footnotes
* @since 2.8.0
*/
-class ReferrersAndTooltipsSettingsSection extends SettingsSection {
+class ReferrersAndTooltipsSettingsSection extends SettingsSection {
/**
* The groups of settings within this section.
*
@@ -28,13 +28,13 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
* @since 2.8.0
*/
protected array $settings_groups;
-
+
/**
* Constructs the settings section.
*
- * @param string options_group_slug The slug of the settings section's options group.
- * @param string section_slug The slug of the settings section.
- * @param string title The name of the settings section.
+ * @param string $options_group_slug The slug of the settings section's options group.
+ * @param string $section_slug The slug of the settings section.
+ * @param string $title The name of the settings section.
*
* @since 2.8.0
*/
@@ -42,7 +42,7 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
$options_group_slug,
$section_slug,
$title,
-
+
/**
* The plugin settings object.
*
@@ -52,16 +52,16 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
private Settings $settings
) {
$this->options_group_slug = $options_group_slug;
- $this->section_slug = $section_slug;
- $this->title = $title;
-
+ $this->section_slug = $section_slug;
+ $this->title = $title;
+
$this->load_dependencies();
-
- $this->add_settings_groups(get_option( $this->options_group_slug ));
+
+ $this->add_settings_groups( get_option( $this->options_group_slug ) );
$this->load_options_group();
}
-
+
/**
* Load the required dependencies.
*
@@ -82,34 +82,36 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
* @see SettingsSection::load_dependencies()
*/
protected function load_dependencies(): void {
- parent::load_dependencies();
-
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-backlink-symbol-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-referrers-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-referrers-in-labels-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltips-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltip-appearance-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltip-dimensions-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltip-position-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltip-text-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltip-timing-settings-group.php';
- require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltip-truncation-settings-group.php';
+ parent::load_dependencies();
+
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-backlinksymbolsettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-referrerssettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-referrersinlabelssettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltipssettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltipappearancesettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltipdimensionssettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltippositionsettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltiptextsettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltiptimingsettingsgroup.php';
+ require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltiptruncationsettingsgroup.php';
}
-
+
/**
+ * Add the settings groups for this settings section.
+ *
* @see SettingsSection::add_settings_groups()
*/
protected function add_settings_groups(): void {
- $this->settings_groups = array (
- BacklinkSymbolSettingsGroup::GROUP_ID => new BacklinkSymbolSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
- ReferrersSettingsGroup::GROUP_ID => new ReferrersSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
+ $this->settings_groups = array(
+ BacklinkSymbolSettingsGroup::GROUP_ID => new BacklinkSymbolSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
+ ReferrersSettingsGroup::GROUP_ID => new ReferrersSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
ReferrersInLabelsSettingsGroup::GROUP_ID => new ReferrersInLabelsSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
- TooltipsSettingsGroup::GROUP_ID => new TooltipsSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
+ TooltipsSettingsGroup::GROUP_ID => new TooltipsSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
TooltipAppearanceSettingsGroup::GROUP_ID => new TooltipAppearanceSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
TooltipDimensionsSettingsGroup::GROUP_ID => new TooltipDimensionsSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
- TooltipPositionSettingsGroup::GROUP_ID => new TooltipPositionSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
- TooltipTextSettingsGroup::GROUP_ID => new TooltipTextSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
- TooltipTimingSettingsGroup::GROUP_ID => new TooltipTimingSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
+ TooltipPositionSettingsGroup::GROUP_ID => new TooltipPositionSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
+ TooltipTextSettingsGroup::GROUP_ID => new TooltipTextSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
+ TooltipTimingSettingsGroup::GROUP_ID => new TooltipTimingSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
TooltipTruncationSettingsGroup::GROUP_ID => new TooltipTruncationSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
);
}
diff --git a/src/includes/settings/referrers-and-tooltips/class-referrers-in-labels-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-referrersinlabelssettingsgroup.php
similarity index 88%
rename from src/includes/settings/referrers-and-tooltips/class-referrers-in-labels-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-referrersinlabelssettingsgroup.php
index 35fc504..27ec2fc 100644
--- a/src/includes/settings/referrers-and-tooltips/class-referrers-in-labels-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-referrersinlabelssettingsgroup.php
@@ -29,7 +29,7 @@ class ReferrersInLabelsSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'referrers-in-label';
-
+
/**
* Setting group name.
*
@@ -63,14 +63,16 @@ class ReferrersInLabelsSettingsGroup extends SettingsGroup {
'default_value' => 'none',
'type' => 'string',
'input_type' => 'select',
- 'input_options' => array(
- 'none' => '0. No problem or solved otherwise',
- 'move' => 'A. Footnotes are moved out and appended after the label\'s end (recommended)',
- 'disconnect' => 'B. Labels with footnotes are disconnected from input element (discouraged)'
+ 'input_options' => array(
+ 'none' => '0. No problem or solved otherwise',
+ 'move' => 'A. Footnotes are moved out and appended after the label\'s end (recommended)',
+ 'disconnect' => 'B. Labels with footnotes are disconnected from input element (discouraged)',
),
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/referrers-and-tooltips/class-referrers-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-referrerssettingsgroup.php
similarity index 91%
rename from src/includes/settings/referrers-and-tooltips/class-referrers-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-referrerssettingsgroup.php
index cc09780..5851acb 100644
--- a/src/includes/settings/referrers-and-tooltips/class-referrers-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-referrerssettingsgroup.php
@@ -29,7 +29,7 @@ class ReferrersSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'referrers';
-
+
/**
* Setting group name.
*
@@ -56,7 +56,7 @@ class ReferrersSettingsGroup extends SettingsGroup {
'type' => 'boolean',
'input_type' => 'checkbox',
);
-
+
/**
* Settings container key to enable superscript style normalization.
*
@@ -73,13 +73,13 @@ class ReferrersSettingsGroup extends SettingsGroup {
'default_value' => 'no',
'type' => 'string',
'input_type' => 'select',
- 'input_options' => array(
- 'no' => 'No',
- 'referrers' => 'Footnote referrers',
- 'all' => 'All superscript elements'
+ 'input_options' => array(
+ 'no' => 'No',
+ 'referrers' => 'Footnote referrers',
+ 'all' => 'All superscript elements',
),
);
-
+
/**
* Settings container key for the string before the footnote referrer.
*
@@ -101,7 +101,7 @@ class ReferrersSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'text',
);
-
+
/**
* Settings container key for the string after the footnote referrer.
*
@@ -118,7 +118,7 @@ class ReferrersSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'text',
);
-
+
/**
* Settings container key
*
@@ -137,8 +137,10 @@ class ReferrersSettingsGroup extends SettingsGroup {
'type' => 'boolean',
'input_type' => 'checkbox',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
@@ -146,8 +148,8 @@ class ReferrersSettingsGroup extends SettingsGroup {
self::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS['key'] => $this->add_setting( self::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ),
self::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT['key'] => $this->add_setting( self::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ),
self::FOOTNOTES_STYLING_BEFORE['key'] => $this->add_setting( self::FOOTNOTES_STYLING_BEFORE ),
- self::FOOTNOTES_STYLING_AFTER['key'] => $this->add_setting( self::FOOTNOTES_STYLING_AFTER ),
- self::LINK_ELEMENT_ENABLED['key'] => $this->add_setting( self::LINK_ELEMENT_ENABLED ),
+ self::FOOTNOTES_STYLING_AFTER['key'] => $this->add_setting( self::FOOTNOTES_STYLING_AFTER ),
+ self::LINK_ELEMENT_ENABLED['key'] => $this->add_setting( self::LINK_ELEMENT_ENABLED ),
);
$this->load_values( $options );
diff --git a/src/includes/settings/referrers-and-tooltips/class-tooltip-appearance-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-tooltipappearancesettingsgroup.php
similarity index 92%
rename from src/includes/settings/referrers-and-tooltips/class-tooltip-appearance-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-tooltipappearancesettingsgroup.php
index a39ef01..a6cbd74 100644
--- a/src/includes/settings/referrers-and-tooltips/class-tooltip-appearance-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-tooltipappearancesettingsgroup.php
@@ -29,7 +29,7 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'tooltip-appearance';
-
+
/**
* Setting group name.
*
@@ -79,7 +79,7 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
'type' => 'number',
'input_type' => 'number',
'input_max' => 50.0,
- 'input_min' => 0.0
+ 'input_min' => 0.0,
);
/**
@@ -97,7 +97,7 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
'default_value' => 'px',
'type' => 'string',
'input_type' => 'select',
- 'input_options' => Setting::FONT_SIZE_UNIT_OPTIONS
+ 'input_options' => Setting::FONT_SIZE_UNIT_OPTIONS,
);
/**
@@ -140,7 +140,7 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'color',
);
-
+
/**
* Settings container key for the mouse-over box to define the border width.
*
@@ -157,8 +157,8 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
'default_value' => 1.0,
'type' => 'number',
'input_type' => 'number',
- 'input_max' => 4.0,
- 'input_min' => 0.0,
+ 'input_max' => 4.0,
+ 'input_min' => 0.0,
);
/**
@@ -178,7 +178,7 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'color',
);
-
+
/**
* Settings container key for the mouse-over box to define the border radius.
*
@@ -195,8 +195,8 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
'default_value' => 0,
'type' => 'number',
'input_type' => 'number',
- 'input_max' => 500,
- 'input_min' => 0,
+ 'input_max' => 500,
+ 'input_min' => 0,
);
/**
@@ -216,16 +216,18 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'color',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
$this->settings = array(
self::MOUSE_OVER_BOX_FONT_SIZE_ENABLED['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FONT_SIZE_ENABLED ),
- self::MOUSE_OVER_BOX_FONT_SIZE_SCALAR['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FONT_SIZE_SCALAR ),
- self::MOUSE_OVER_BOX_FONT_SIZE_UNIT['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FONT_SIZE_UNIT ),
- self::FOOTNOTES_MOUSE_OVER_BOX_COLOR['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_COLOR ),
+ self::MOUSE_OVER_BOX_FONT_SIZE_SCALAR['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FONT_SIZE_SCALAR ),
+ self::MOUSE_OVER_BOX_FONT_SIZE_UNIT['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FONT_SIZE_UNIT ),
+ self::FOOTNOTES_MOUSE_OVER_BOX_COLOR['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_COLOR ),
self::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ),
self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ),
self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ),
diff --git a/src/includes/settings/referrers-and-tooltips/class-tooltip-dimensions-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-tooltipdimensionssettingsgroup.php
similarity index 97%
rename from src/includes/settings/referrers-and-tooltips/class-tooltip-dimensions-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-tooltipdimensionssettingsgroup.php
index 130f257..eefa8e8 100644
--- a/src/includes/settings/referrers-and-tooltips/class-tooltip-dimensions-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-tooltipdimensionssettingsgroup.php
@@ -29,7 +29,7 @@ class TooltipDimensionsSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'tooltip-dimensions';
-
+
/**
* Setting group name.
*
@@ -59,7 +59,7 @@ class TooltipDimensionsSettingsGroup extends SettingsGroup {
'type' => 'number',
'input_type' => 'number',
);
-
+
/**
* Settings container key for alternative tooltip width.
*
@@ -76,8 +76,10 @@ class TooltipDimensionsSettingsGroup extends SettingsGroup {
'type' => 'number',
'input_type' => 'number',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/referrers-and-tooltips/class-tooltip-position-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-tooltippositionsettingsgroup.php
similarity index 96%
rename from src/includes/settings/referrers-and-tooltips/class-tooltip-position-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-tooltippositionsettingsgroup.php
index 2d9b72c..9cc8e7b 100644
--- a/src/includes/settings/referrers-and-tooltips/class-tooltip-position-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-tooltippositionsettingsgroup.php
@@ -29,7 +29,7 @@ class TooltipPositionSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'tooltip-position';
-
+
/**
* Setting group name.
*
@@ -59,7 +59,7 @@ class TooltipPositionSettingsGroup extends SettingsGroup {
'default_value' => 'top center',
'type' => 'string',
'input_type' => 'select',
- 'input_options' => array(
+ 'input_options' => array(
'top left' => 'top left',
'top center' => 'top center',
'top right' => 'top right',
@@ -88,11 +88,11 @@ class TooltipPositionSettingsGroup extends SettingsGroup {
'default_value' => 'top right',
'type' => 'string',
'input_type' => 'select',
- 'input_options' => array(
- 'top left' => 'top left',
- 'top right' => 'top right',
- 'bottom right' => 'bottom right',
- 'bottom left' => 'bottom left',
+ 'input_options' => array(
+ 'top left' => 'top left',
+ 'top right' => 'top right',
+ 'bottom right' => 'bottom right',
+ 'bottom left' => 'bottom left',
),
);
@@ -170,8 +170,10 @@ class TooltipPositionSettingsGroup extends SettingsGroup {
'type' => 'number',
'input_type' => 'number',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/referrers-and-tooltips/class-tooltips-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-tooltipssettingsgroup.php
similarity index 98%
rename from src/includes/settings/referrers-and-tooltips/class-tooltips-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-tooltipssettingsgroup.php
index 0dac43c..c6c5198 100644
--- a/src/includes/settings/referrers-and-tooltips/class-tooltips-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-tooltipssettingsgroup.php
@@ -29,7 +29,7 @@ class TooltipsSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'tooltips';
-
+
/**
* Setting group name.
*
@@ -81,8 +81,10 @@ class TooltipsSettingsGroup extends SettingsGroup {
'type' => 'boolean',
'input_type' => 'checkbox',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/referrers-and-tooltips/class-tooltip-text-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-tooltiptextsettingsgroup.php
similarity index 98%
rename from src/includes/settings/referrers-and-tooltips/class-tooltip-text-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-tooltiptextsettingsgroup.php
index 788a19a..7d218b3 100644
--- a/src/includes/settings/referrers-and-tooltips/class-tooltip-text-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-tooltiptextsettingsgroup.php
@@ -29,7 +29,7 @@ class TooltipTextSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'tooltip-text';
-
+
/**
* Setting group name.
*
@@ -109,8 +109,10 @@ class TooltipTextSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'text',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/referrers-and-tooltips/class-tooltip-timing-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-tooltiptimingsettingsgroup.php
similarity index 89%
rename from src/includes/settings/referrers-and-tooltips/class-tooltip-timing-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-tooltiptimingsettingsgroup.php
index e7709fe..559873f 100644
--- a/src/includes/settings/referrers-and-tooltips/class-tooltip-timing-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-tooltiptimingsettingsgroup.php
@@ -29,7 +29,7 @@ class TooltipTimingSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'tooltip-timing';
-
+
/**
* Setting group name.
*
@@ -118,15 +118,17 @@ class TooltipTimingSettingsGroup extends SettingsGroup {
'input_max' => 20000,
'input_min' => 0,
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
$this->settings = array(
- self::MOUSE_OVER_BOX_FADE_IN_DELAY['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_IN_DELAY ),
- self::MOUSE_OVER_BOX_FADE_IN_DURATION['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_IN_DURATION ),
- self::MOUSE_OVER_BOX_FADE_OUT_DELAY['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_OUT_DELAY ),
+ self::MOUSE_OVER_BOX_FADE_IN_DELAY['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_IN_DELAY ),
+ self::MOUSE_OVER_BOX_FADE_IN_DURATION['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_IN_DURATION ),
+ self::MOUSE_OVER_BOX_FADE_OUT_DELAY['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_OUT_DELAY ),
self::MOUSE_OVER_BOX_FADE_OUT_DURATION['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_OUT_DURATION ),
);
diff --git a/src/includes/settings/referrers-and-tooltips/class-tooltip-truncation-settings-group.php b/src/includes/settings/referrers-and-tooltips/class-tooltiptruncationsettingsgroup.php
similarity index 98%
rename from src/includes/settings/referrers-and-tooltips/class-tooltip-truncation-settings-group.php
rename to src/includes/settings/referrers-and-tooltips/class-tooltiptruncationsettingsgroup.php
index bd59873..8a98ac1 100644
--- a/src/includes/settings/referrers-and-tooltips/class-tooltip-truncation-settings-group.php
+++ b/src/includes/settings/referrers-and-tooltips/class-tooltiptruncationsettingsgroup.php
@@ -29,7 +29,7 @@ class TooltipTruncationSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
const GROUP_ID = 'tooltip-truncation';
-
+
/**
* Setting group name.
*
@@ -99,8 +99,10 @@ class TooltipTruncationSettingsGroup extends SettingsGroup {
'type' => 'string',
'input_type' => 'text',
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
diff --git a/src/includes/settings/scope-and-priority/class-scope-and-priority-settings-section.php b/src/includes/settings/scope-and-priority/class-scopeandprioritysettingssection.php
similarity index 69%
rename from src/includes/settings/scope-and-priority/class-scope-and-priority-settings-section.php
rename to src/includes/settings/scope-and-priority/class-scopeandprioritysettingssection.php
index bb08222..c6b47fb 100644
--- a/src/includes/settings/scope-and-priority/class-scope-and-priority-settings-section.php
+++ b/src/includes/settings/scope-and-priority/class-scopeandprioritysettingssection.php
@@ -21,7 +21,7 @@ use footnotes\includes\settings\scopeandpriority\WordPressHooksSettingsGroup;
* @package footnotes
* @since 2.8.0
*/
-class ScopeAndPrioritySettingsSection extends SettingsSection {
+class ScopeAndPrioritySettingsSection extends SettingsSection {
/**
* The groups of settings within this section.
*
@@ -30,13 +30,13 @@ class ScopeAndPrioritySettingsSection extends SettingsSection {
* @since 2.8.0
*/
protected array $settings_groups;
-
+
/**
* Constructs the settings section.
*
- * @param string options_group_slug The slug of the settings section's options group.
- * @param string section_slug The slug of the settings section.
- * @param string title The name of the settings section.
+ * @param string $options_group_slug The slug of the settings section's options group.
+ * @param string $section_slug The slug of the settings section.
+ * @param string $title The name of the settings section.
*
* @since 2.8.0
*/
@@ -44,7 +44,7 @@ class ScopeAndPrioritySettingsSection extends SettingsSection {
$options_group_slug,
$section_slug,
$title,
-
+
/**
* The plugin settings object.
*
@@ -54,16 +54,16 @@ class ScopeAndPrioritySettingsSection extends SettingsSection {
private Settings $settings
) {
$this->options_group_slug = $options_group_slug;
- $this->section_slug = $section_slug;
- $this->title = $title;
-
+ $this->section_slug = $section_slug;
+ $this->title = $title;
+
$this->load_dependencies();
-
- $this->add_settings_groups(get_option( $this->options_group_slug ));
+
+ $this->add_settings_groups( get_option( $this->options_group_slug ) );
$this->load_options_group();
}
-
+
/**
* Load the required dependencies.
*
@@ -75,17 +75,19 @@ class ScopeAndPrioritySettingsSection extends SettingsSection {
* @see SettingsSection::load_dependencies()
*/
protected function load_dependencies(): void {
- parent::load_dependencies();
-
- require_once plugin_dir_path( __DIR__ ) . 'scope-and-priority/class-wordpress-hooks-settings-group.php';
+ parent::load_dependencies();
+
+ require_once plugin_dir_path( __DIR__ ) . 'scope-and-priority/class-wordpresshookssettingsgroup.php';
}
-
+
/**
+ * Add the settings groups for this settings section.
+ *
* @see SettingsSection::add_settings_groups()
*/
protected function add_settings_groups(): void {
- $this->settings_groups = array (
- WordPressHooksSettingsGroup::GROUP_ID => new WordPressHooksSettingsGroup($this->options_group_slug, $this->section_slug, $this->settings ),
+ $this->settings_groups = array(
+ WordPressHooksSettingsGroup::GROUP_ID => new WordPressHooksSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
);
}
}
diff --git a/src/includes/settings/scope-and-priority/class-wordpress-hooks-settings-group.php b/src/includes/settings/scope-and-priority/class-wordpresshookssettingsgroup.php
similarity index 96%
rename from src/includes/settings/scope-and-priority/class-wordpress-hooks-settings-group.php
rename to src/includes/settings/scope-and-priority/class-wordpresshookssettingsgroup.php
index 76b09f7..f8a2fca 100644
--- a/src/includes/settings/scope-and-priority/class-wordpress-hooks-settings-group.php
+++ b/src/includes/settings/scope-and-priority/class-wordpresshookssettingsgroup.php
@@ -29,7 +29,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
* @since 2.8.0
*/
public const GROUP_ID = 'wordpress-hooks';
-
+
/**
* Setting group name.
*
@@ -183,7 +183,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
'input_max' => PHP_INT_MAX,
'input_min' => -1,
);
-
+
/**
* Settings container key to enable the `widget_title` hook.
*
@@ -266,21 +266,23 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
'input_max' => PHP_INT_MAX,
'input_min' => -1,
);
-
+
/**
+ * Add the settings for this settings group.
+ *
* @see SettingsGroup::add_settings()
*/
protected function add_settings( array|false $options ): void {
$this->settings = array(
- self::EXPERT_LOOKUP_THE_TITLE['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_TITLE ),
+ self::EXPERT_LOOKUP_THE_TITLE['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_TITLE ),
self::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ),
- self::EXPERT_LOOKUP_THE_CONTENT['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_CONTENT ),
+ self::EXPERT_LOOKUP_THE_CONTENT['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_CONTENT ),
self::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ),
- self::EXPERT_LOOKUP_THE_EXCERPT['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_EXCERPT ),
+ self::EXPERT_LOOKUP_THE_EXCERPT['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_EXCERPT ),
self::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL['key'] => $this->add_setting( self::EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ),
self::EXPERT_LOOKUP_WIDGET_TITLE['key'] => $this->add_setting( self::EXPERT_LOOKUP_WIDGET_TITLE ),
self::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL['key'] => $this->add_setting( self::EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ),
- self::EXPERT_LOOKUP_WIDGET_TEXT['key'] => $this->add_setting( self::EXPERT_LOOKUP_WIDGET_TEXT ),
+ self::EXPERT_LOOKUP_WIDGET_TEXT['key'] => $this->add_setting( self::EXPERT_LOOKUP_WIDGET_TEXT ),
self::EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL['key'] => $this->add_setting( self::EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL ),
);
diff --git a/src/public/class-general.php b/src/public/class-general.php
index a01943d..a921da8 100644
--- a/src/public/class-general.php
+++ b/src/public/class-general.php
@@ -12,9 +12,7 @@ namespace footnotes\general;
use footnotes\includes\{Footnotes, Convert, Settings};
-/**
- * @todo Replace with constant imports.
- */
+/* TODO Replace with constant imports. */
use footnotes\includes\settings\general\ReferenceContainerSettingsGroup;
use footnotes\includes\settings\general\AMPCompatSettingsGroup;
use footnotes\includes\settings\referrersandtooltips\TooltipsSettingsGroup;
@@ -115,15 +113,15 @@ class General {
* @see Footnotes::$version
*/
private string $version,
-
+
/**
* The plugin settings object.
*
* @access private
* @since 2.8.0
*/
- private Settings $settings
- ) {
+ private Settings $settings
+ ) {
$this->load_dependencies();
@@ -156,9 +154,9 @@ class General {
$this->reference_container_widget = new Widget\Reference_Container( $this->plugin_name );
- $this->task = new Parser($this->settings);
+ $this->task = new Parser( $this->settings );
}
-
+
/**
* Register the stylesheets for the public-facing side of the site.
*
diff --git a/src/public/class-parser.php b/src/public/class-parser.php
index eb58957..cc8571e 100644
--- a/src/public/class-parser.php
+++ b/src/public/class-parser.php
@@ -15,29 +15,27 @@ namespace footnotes\general;
use footnotes\includes\{Settings, Config, Convert, Template};
-/**
- * @todo Replace with constant imports.
- */
+/* TODO Replace with constant imports. */
use footnotes\includes\settings\general\{
- ExcerptsSettingsGroup,
- HardLinksSettingsGroup,
- LoveSettingsGroup,
- NumberingSettingsGroup,
- ReferenceContainerSettingsGroup,
- ScrollingSettingsGroup,
- ShortcodeSettingsGroup,
+ ExcerptsSettingsGroup,
+ HardLinksSettingsGroup,
+ LoveSettingsGroup,
+ NumberingSettingsGroup,
+ ReferenceContainerSettingsGroup,
+ ScrollingSettingsGroup,
+ ShortcodeSettingsGroup,
};
use footnotes\includes\settings\referrersandtooltips\{
- BacklinkSymbolSettingsGroup,
- ReferrersSettingsGroup,
- ReferrersInLabelsSettingsGroup,
- TooltipsSettingsGroup,
- TooltipAppearanceSettingsGroup,
- TooltipDimensionsSettingsGroup,
- TooltipPositionSettingsGroup,
- TooltipTextSettingsGroup,
- TooltipTimingSettingsGroup,
- TooltipTruncationSettingsGroup
+ BacklinkSymbolSettingsGroup,
+ ReferrersSettingsGroup,
+ ReferrersInLabelsSettingsGroup,
+ TooltipsSettingsGroup,
+ TooltipAppearanceSettingsGroup,
+ TooltipDimensionsSettingsGroup,
+ TooltipPositionSettingsGroup,
+ TooltipTextSettingsGroup,
+ TooltipTimingSettingsGroup,
+ TooltipTruncationSettingsGroup
};
use footnotes\includes\settings\scopeandpriority\WordPressHooksSettingsGroup;
use footnotes\includes\settings\customcss\CustomCSSSettingsGroup;
@@ -49,7 +47,7 @@ use footnotes\includes\settings\customcss\CustomCSSSettingsGroup;
* @since 1.5.0
* @since 2.8.0 Rename class from `Footnotes_Task` to `Parser`.
*/
-class Parser {
+class Parser {
/**
* Contains all footnotes found in the searched content.
*
@@ -276,15 +274,15 @@ class Parser {
* @todo Reorganise dependencies.
* @todo Move call to `register_hooks()` to {@see General}.
*/
- public function __construct(
+ public function __construct(
/**
* The plugin settings object.
*
* @access private
* @since 2.8.0
*/
- private Settings $settings
- ) {
+ private Settings $settings
+ ) {
// TODO: Reorg dependencies.
require_once plugin_dir_path( __DIR__ ) . 'includes/class-config.php';
require_once plugin_dir_path( __DIR__ ) . 'includes/class-convert.php';
@@ -481,7 +479,7 @@ class Parser {
// Reference container label bottom border.
if ( ( $this->settings->get_setting_value( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER['key'] ) ) ) {
echo '.footnote_container_prepare > ';
- echo $this->settings->get_setting_value( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_LABEL_ELEMENT['key'] ) ;
+ echo $this->settings->get_setting_value( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_LABEL_ELEMENT['key'] );
echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n";
}
@@ -545,7 +543,7 @@ class Parser {
}
// Hard links scroll offset.
- // TODO: remove cast
+ // TODO: remove cast.
self::$hard_links_enabled = (bool) $this->settings->get_setting_value( HardLinksSettingsGroup::FOOTNOTES_HARD_LINKS_ENABLE['key'] );
// Correct hard links enabled status depending on AMP-compatible or alternative reference container enabled status.
@@ -721,7 +719,7 @@ class Parser {
* for transparency. It isn’t indented though (the PHP open tag neither).
*/
if ( General::$alternative_tooltips_enabled ) {
- echo ('
+ echo ( '
- ');
+ ' );
};
}
@@ -820,7 +818,7 @@ class Parser {
$footnote_section_shortcode_length = strlen( $footnote_section_shortcode );
// TODO: Replace with `str_contains()`, but currently breaks Rector downgrade.
- // https://github.com/rectorphp/rector/issues/6315
+ // .
if ( ! strpos( $content, (string) $footnote_section_shortcode ) ) {
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda
@@ -838,8 +836,8 @@ class Parser {
$section_end = strpos( $rest_content, (string) $footnote_section_shortcode );
$sections_raw[] = substr( $rest_content, 0, $section_end );
$rest_content = substr( $rest_content, $section_end + $footnote_section_shortcode_length );
- // TODO: Replace with `str_contains()`, but currently breaks Rector downgrade.
- // https://github.com/rectorphp/rector/issues/6315
+ // TODO: Replace with `str_contains()`, but currently breaks Rector downgrade.
+ // .
} while ( strpos( $rest_content, (string) $footnote_section_shortcode ) );
$sections_raw[] = $rest_content;
@@ -1199,7 +1197,7 @@ class Parser {
*/
// If enabled.
- if ( $this->settings->get_setting( ShortcodeSettingsGroup::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE['key']) ->get_value() ) {
+ if ( $this->settings->get_setting( ShortcodeSettingsGroup::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE['key'] )->get_value() ) {
// Apply different regex depending on whether start shortcode is double/triple opening parenthesis.
if ( '((' === self::$start_tag || '(((' === self::$start_tag ) {
@@ -1709,12 +1707,12 @@ class Parser {
*/
// If the backlink symbol is enabled.
- if ( $this->settings->get_setting_value( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE['key'] )) {
- $arrow_setting = $this->settings->get_setting( BacklinkSymbolSettingsGroup::HYPERLINK_ARROW['key']);
-
+ if ( $this->settings->get_setting_value( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE['key'] ) ) {
+ $arrow_setting = $this->settings->get_setting( BacklinkSymbolSettingsGroup::HYPERLINK_ARROW['key'] );
+
// Get html arrow.
- $arrow = $arrow_setting->get_input_options()[$arrow_setting->get_value() || 0];
-
+ $arrow = $arrow_setting->get_input_options()[ $arrow_setting->get_value() || 0 ];
+
// Get user defined arrow.
$arrow_user_defined = $this->settings->get_setting_value( BacklinkSymbolSettingsGroup::HYPERLINK_ARROW_USER_DEFINED['key'] );
if ( ! empty( $arrow_user_defined ) ) {
@@ -1745,10 +1743,9 @@ class Parser {
// If it is not, check which option is on.
$separator_option = $this->settings->get_setting_value( ReferenceContainerSettingsGroup::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
- switch ($separator_option) {
+ // TODO: replace with `match` (but currently it breaks the Rector downgrade to PHP 7.4.
+ // .
+ switch ( $separator_option ) {
case 'comma':
$separator = ',';
break;
@@ -1779,10 +1776,9 @@ class Parser {
// If it is not, check which option is on.
$terminator_option = $this->settings->get_setting_value( ReferenceContainerSettingsGroup::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
- switch ($terminator_option) {
+ // TODO: replace with `match` (but currently it breaks the Rector downgrade to PHP 7.4.
+ // .
+ switch ( $terminator_option ) {
case 'period':
$terminator = '.';
break;
@@ -2138,7 +2134,7 @@ class Parser {
}
// Call again for robustness when priority levels don't match any longer.
- // TODO: remove cast
+ // TODO: remove cast.
self::$scroll_offset = (int) $this->settings->get_setting_value( ScrollingSettingsGroup::FOOTNOTES_SCROLL_OFFSET['key'] );
// Streamline.
|