refactor: finish refactoring
This commit is contained in:
parent
facda599bb
commit
fbb00fab2f
30 changed files with 599 additions and 108 deletions
|
@ -21,7 +21,6 @@ require_once plugin_dir_path( dirname( __FILE__, 2 ) ) . 'includes/class-setting
|
|||
|
||||
use footnotes\includes\{Template, Settings, Parser, Config, Convert};
|
||||
use footnotes\general\General;
|
||||
use const footnotes\settings\general\ReferenceContainerSettingsGroup\{COMBINE_IDENTICAL_FOOTNOTES};
|
||||
|
||||
/**
|
||||
* Provides the abstract class to be extended for page layouts.
|
||||
|
|
|
@ -15,13 +15,6 @@ namespace footnotes\includes;
|
|||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
|
||||
/**
|
||||
* Provides data conversion methods.
|
||||
*
|
||||
* @todo Move to {@see Loader}.
|
||||
*/
|
||||
require_once plugin_dir_path( __DIR__ ) . 'includes/class-convert.php';
|
||||
|
||||
use footnotes\includes\settings\general\GeneralSettingsSection;
|
||||
use footnotes\includes\settings\referrersandtooltips\ReferrersAndTooltipsSettingsSection;
|
||||
use footnotes\includes\settings\scopeandpriority\ScopeAndPrioritySettingsSection;
|
||||
|
@ -62,10 +55,6 @@ class Settings {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
public $settings_sections = array();
|
||||
|
||||
/**********************************************************************
|
||||
* SETTINGS STORAGE.
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
* Loads all Settings from each WordPress Settings Container.
|
||||
|
@ -88,6 +77,9 @@ class Settings {
|
|||
*
|
||||
* Includes the following files that make up the plugin:
|
||||
*
|
||||
* - {@see SettingsSection}: defines a section of settings groups;
|
||||
* - {@see SettingsGroup}: defines a group of settings;
|
||||
* - {@see Setting}: defines a single setting;
|
||||
* - {@see GeneralSettingsSection}: provides general plugin settings;
|
||||
* - {@see ReferrersAndTooltipsSettingsSection}: provides settings for
|
||||
* customising the plugin's created referrers and tooltips;
|
||||
|
@ -100,6 +92,10 @@ 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';
|
||||
|
@ -148,7 +144,7 @@ class Settings {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve a setting's defaultvalue by its key.
|
||||
* Retrieve a setting's default value by its key.
|
||||
*
|
||||
* @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.
|
||||
|
@ -167,6 +163,28 @@ class Settings {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a setting's value by its key.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of a specified Settings Container.
|
||||
|
|
|
@ -76,6 +76,11 @@ class Setting {
|
|||
*/
|
||||
protected mixed $value;
|
||||
|
||||
/**
|
||||
* Constructs the setting.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function __construct(
|
||||
/**
|
||||
* Setting group ID.
|
||||
|
@ -204,7 +209,8 @@ class Setting {
|
|||
/**
|
||||
* The plugin settings object.
|
||||
*
|
||||
* @access private
|
||||
* @var Settings
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
private Settings $settings
|
||||
|
@ -214,6 +220,15 @@ class Setting {
|
|||
register_setting( $this->options_group_slug, $this->key, $this->get_setting_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the args for registering the settings with WordPress.
|
||||
*
|
||||
* @see register_setting()
|
||||
*
|
||||
* @return array The setting field args.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_setting_args(): array {
|
||||
return array (
|
||||
'type' => $this->type,
|
||||
|
@ -223,7 +238,13 @@ class Setting {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the args for rendering setting fields on the admin. dashboard.
|
||||
*
|
||||
* @see add_settings_field()
|
||||
*
|
||||
* @return array The setting field args.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_setting_field_args(): array {
|
||||
return array (
|
||||
|
@ -239,6 +260,15 @@ class Setting {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a setting is enabled and/or overridden.
|
||||
*
|
||||
* @return ?bool 'True' if the setting is disabled or overridden.
|
||||
* 'False' if it could be, but isn't currently.
|
||||
* 'None' if the setting is not enabled/overridden by another.
|
||||
*
|
||||
* @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);
|
||||
|
@ -261,36 +291,68 @@ class Setting {
|
|||
} else return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slug of the setting's options group.
|
||||
*
|
||||
* @return string The options group slug.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_options_group_slug(): string {
|
||||
return $this->options_group_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slug of the setting's section.
|
||||
*
|
||||
* @return string The section slug.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_section_slug(): string {
|
||||
return $this->section_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the value of the setting.
|
||||
*
|
||||
* @return mixed The value of the setting, or the default value if none is set. 'None' if neither are set.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_value(): mixed {
|
||||
return $this->value ?? $this->default_value ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the default value of the setting.
|
||||
*
|
||||
* @return mixed The default value of the setting. 'None' if one is not set.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_default_value(): mixed {
|
||||
return $this->default_value ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the input options of the setting.
|
||||
*
|
||||
* @return ?array The possible options of the setting. 'None' if no options are set.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_input_options(): ?array {
|
||||
return $this->input_options ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the setting.
|
||||
*
|
||||
* @param mixed $value The new value to set.
|
||||
* @return bool 'True' if the value was successfully set. 'False' otherwise.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function set_value(mixed $value): bool {
|
||||
$this->value = $value;
|
||||
|
|
|
@ -11,7 +11,7 @@ declare(strict_types=1);
|
|||
namespace footnotes\includes\settings;
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\admin\layout as Layout;
|
||||
use footnotes\admin\layout\SettingsPage;
|
||||
|
||||
/**
|
||||
* Class defining a group of plugin settings within a section.
|
||||
|
@ -56,6 +56,11 @@ abstract class SettingsGroup {
|
|||
*/
|
||||
protected array $settings;
|
||||
|
||||
/**
|
||||
* Constructs the settings section.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function __construct(
|
||||
/**
|
||||
* Setting options group slug.
|
||||
|
@ -88,12 +93,38 @@ abstract class SettingsGroup {
|
|||
$this->add_settings( get_option( $this->options_group_slug ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the required dependencies.
|
||||
*
|
||||
* Include the following files that provide the settings for this plugin:
|
||||
*
|
||||
* - {@see Setting}: defines individual settings.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
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<string,mixed>|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;
|
||||
|
||||
/**
|
||||
* Constructs settings from the provided details.
|
||||
*
|
||||
* @param array<string,mixed> $setting The setting details.
|
||||
* @return Setting The constructed setting object.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
protected function add_setting(array $setting): Setting {
|
||||
extract( $setting );
|
||||
|
||||
|
@ -116,17 +147,33 @@ abstract class SettingsGroup {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the values for this settings group.
|
||||
*
|
||||
* @param array<string,mixed>|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.
|
||||
*/
|
||||
protected function load_values(array|false $options): void {
|
||||
if ( ! $options ) return;
|
||||
|
||||
// TODO remove unfound settings from option
|
||||
foreach ( $options as $setting_key => $setting_value ) {
|
||||
if ( array_key_exists( $setting_key, $this->settings ) )
|
||||
$this->settings[$setting_key]->set_value( $setting_value );
|
||||
}
|
||||
}
|
||||
|
||||
public function add_settings_fields(Layout\SettingsPage $component): void {
|
||||
/**
|
||||
* Adds all the settings fields for this group to the admin. dashboard.
|
||||
*
|
||||
* @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) {
|
||||
add_settings_field(
|
||||
$setting->key,
|
||||
|
@ -139,6 +186,9 @@ abstract class SettingsGroup {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Settings::get_setting()
|
||||
*/
|
||||
public function get_setting(string $setting_key): ?Setting {
|
||||
foreach ($this->settings as $setting) {
|
||||
if ($setting->key === $setting_key) return $setting;
|
||||
|
@ -146,7 +196,10 @@ abstract class SettingsGroup {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see SettingsSection::get_options()
|
||||
*/
|
||||
public function get_options(): array {
|
||||
$options = array();
|
||||
|
||||
|
@ -157,6 +210,9 @@ abstract class SettingsGroup {
|
|||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Settings::get_setting_value()
|
||||
*/
|
||||
public function get_setting_value(string $setting_key) {
|
||||
$setting = $this->get_setting($setting_key);
|
||||
|
||||
|
@ -164,6 +220,9 @@ abstract class SettingsGroup {
|
|||
else return $setting->value ?? $setting->default_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Settings::set_setting_value()
|
||||
*/
|
||||
public function set_setting_value(string $setting_key, $value): bool {
|
||||
return $this->get_setting($setting_key)->set_value($value);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the (new) `SettingsSection` class.
|
||||
* File providing the `SettingsSection` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
|
@ -10,10 +10,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings;
|
||||
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
use footnotes\admin\layout as Layout;
|
||||
|
||||
/**
|
||||
* Class defining plugin settings.
|
||||
* Abstract class defining a section of plugin settings.
|
||||
*
|
||||
* @abstract
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
|
@ -55,6 +58,15 @@ abstract class SettingsSection {
|
|||
*/
|
||||
protected array $settings_groups;
|
||||
|
||||
/**
|
||||
* Load the required dependencies.
|
||||
*
|
||||
* Include the following files that provide the settings for this section:
|
||||
*
|
||||
* - {@see Setting}: defines a setting.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
protected function load_dependencies(): void {
|
||||
require_once plugin_dir_path( __DIR__ ) . 'settings/class-setting.php';
|
||||
}
|
||||
|
@ -88,24 +100,57 @@ abstract class SettingsSection {
|
|||
echo "<hr>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the settings groups for this settings section.
|
||||
*
|
||||
* @abstract
|
||||
* @return void
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
protected abstract function add_settings_groups(): void;
|
||||
|
||||
public function get_options_group_slug(): string {
|
||||
return $this->options_group_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the settings section slug.
|
||||
*
|
||||
* @return string The section slug.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_section_slug(): string {
|
||||
return $this->section_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the settings section title.
|
||||
*
|
||||
* @return string The section title.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_title(): string {
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function get_settings_group(string $group_id) {
|
||||
return $this->settings_groups[$group_id];
|
||||
/**
|
||||
* Gets a settings groups from this section by its ID.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
@ -116,6 +161,13 @@ abstract class SettingsSection {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an options group from the values of the settings in this section.
|
||||
*
|
||||
* @return array The options group.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function get_options(): array {
|
||||
$options = array();
|
||||
|
||||
|
@ -126,6 +178,9 @@ abstract class SettingsSection {
|
|||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Settings::get_setting_value()
|
||||
*/
|
||||
public function get_setting_value(string $setting_key) {
|
||||
$setting = $this->get_setting($setting_key);
|
||||
|
||||
|
@ -133,6 +188,9 @@ abstract class SettingsSection {
|
|||
else return $setting->value ?? $setting->default_value ?? trigger_error("No default value found for ".$setting_key.".", E_USER_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Settings::set_setting_value()
|
||||
*/
|
||||
public function set_setting_value(string $setting_key, $value): ?bool {
|
||||
$setting = $this->get_setting($setting_key);
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\customcss;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -30,7 +28,16 @@ class CustomCSSSettingsGroup extends SettingsGroup {
|
|||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'custom-css';
|
||||
public const GROUP_ID = 'custom-css';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Custom CSS';
|
||||
|
||||
/**
|
||||
* Settings container key for the Custom CSS.
|
||||
|
@ -41,13 +48,31 @@ class CustomCSSSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const CUSTOM_CSS = array(
|
||||
public const CUSTOM_CSS = array(
|
||||
'key' => 'footnote_inputfield_custom_css_new',
|
||||
'name' => 'Your Existing Custom CSS Code',
|
||||
'type' => 'string',
|
||||
'input_type' => 'textarea',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Load the required dependencies.
|
||||
*
|
||||
* 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 {
|
||||
$this->settings = array(
|
||||
self::CUSTOM_CSS['key'] => $this->add_setting( self::CUSTOM_CSS ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\customcss;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-section.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
|
||||
use footnotes\includes\settings\SettingsSection;
|
||||
|
@ -34,6 +32,15 @@ class CustomCSSSettingsSection extends SettingsSection {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function __construct(
|
||||
$options_group_slug,
|
||||
$section_slug,
|
||||
|
@ -57,13 +64,28 @@ class CustomCSSSettingsSection extends SettingsSection {
|
|||
|
||||
$this->load_options_group();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the required dependencies.
|
||||
*
|
||||
* Include the following files that provide the settings for this section:
|
||||
*
|
||||
* - {@see SettingsSection}: defines a settings section; and
|
||||
* - {@see CustomCSSSettingsGroup}.
|
||||
*
|
||||
* @see SettingsSection::load_dependencies()
|
||||
*/
|
||||
protected function load_dependencies(): void {
|
||||
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';
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -11,8 +11,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Footnotes;
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
|
@ -42,7 +40,7 @@ class AMPCompatSettingsGroup extends SettingsGroup {
|
|||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'AMP Compatiblility (unsupported)';
|
||||
const GROUP_NAME = 'AMP Compatiblility (deprecated)';
|
||||
|
||||
/**
|
||||
* Settings container key to enable AMP compatibility mode.
|
||||
|
@ -63,6 +61,9 @@ class AMPCompatSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_AMP_COMPATIBILITY_ENABLE['key'] => $this->add_setting( self::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Footnotes;
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
|
@ -64,7 +62,10 @@ class ExcerptsSettingsGroup extends SettingsGroup {
|
|||
'manual' => 'Yes but run the process only to display tooltips in manual excerpts with footnote short codes'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_IN_EXCERPT['key'] => $this->add_setting( self::FOOTNOTES_IN_EXCERPT ),
|
||||
|
|
|
@ -10,10 +10,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-section.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
|
||||
use footnotes\includes\settings\SettingsSection;
|
||||
|
||||
use footnotes\includes\settings\general\ReferenceContainerSettingsGroup;
|
||||
|
@ -41,6 +38,15 @@ class GeneralSettingsSection extends SettingsSection {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function __construct(
|
||||
$options_group_slug,
|
||||
$section_slug,
|
||||
|
@ -65,6 +71,23 @@ class GeneralSettingsSection extends SettingsSection {
|
|||
$this->load_options_group();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the required dependencies.
|
||||
*
|
||||
* Include the following files that provide the settings for this section:
|
||||
*
|
||||
* - {@see SettingsSection}: defines a settings section;
|
||||
* - {@see AMPCompatSettingsGroup};
|
||||
* - {@see ReferenceContainerSettingsGroup};
|
||||
* - {@see ScrollingSettingsGroup};
|
||||
* - {@see ShortcodeSettingsGroup};
|
||||
* - {@see NumberingSettingsGroup};
|
||||
* - {@see HardLinksSettingsGroup};
|
||||
* - {@see ExcerptsSettingsGroup}; and
|
||||
* - {@see LoveSettingsGroup}.
|
||||
*
|
||||
* @see SettingsSection::load_dependencies()
|
||||
*/
|
||||
protected function load_dependencies(): void {
|
||||
parent::load_dependencies();
|
||||
|
||||
|
@ -77,7 +100,10 @@ class GeneralSettingsSection extends SettingsSection {
|
|||
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';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see SettingsSection::add_settings_groups()
|
||||
*/
|
||||
protected function add_settings_groups(): void {
|
||||
$this->settings_groups = array(
|
||||
AMPCompatSettingsGroup::GROUP_ID => new AMPCompatSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class HardLinksSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'hard-links';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'URL Fragment ID Configuration';
|
||||
|
||||
/**
|
||||
* Settings container key to enable hard links.
|
||||
|
@ -150,7 +157,10 @@ class HardLinksSettingsGroup extends SettingsGroup {
|
|||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Footnotes;
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
|
@ -24,7 +22,22 @@ use footnotes\includes\settings\SettingsGroup;
|
|||
* @since 2.8.0
|
||||
*/
|
||||
class LoveSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* The HTML 'love' symbol.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const LOVE_SYMBOL = '<span style="color:#ff6d3b; font-weight:bold;">♥</span>';
|
||||
|
||||
/**
|
||||
* The HTML Plugin logogram.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const PLUGIN_SYMBOL = '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>';
|
||||
|
||||
/**
|
||||
|
@ -43,7 +56,7 @@ class LoveSettingsGroup extends SettingsGroup {
|
|||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = self::LOVE_SYMBOL . ' Love';
|
||||
const GROUP_NAME = self::PLUGIN_SYMBOL . ' ' . self::LOVE_SYMBOL;
|
||||
|
||||
/**
|
||||
* Settings container key for the ‘I love footnotes’ text.
|
||||
|
@ -99,7 +112,10 @@ class LoveSettingsGroup extends SettingsGroup {
|
|||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class NumberingSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'numbering';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Footnotes Numbering';
|
||||
|
||||
/**
|
||||
* Settings container key for combining identical footnotes.
|
||||
|
@ -78,7 +85,10 @@ class NumberingSettingsGroup extends SettingsGroup {
|
|||
'roman_low' => 'lowercase Roman numerals (i, ii, iii, iv, v, …)',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class ReferenceContainerSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'reference-container';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Reference Container';
|
||||
|
||||
/**
|
||||
* Settings container key for the label of the reference container.
|
||||
|
@ -680,7 +687,10 @@ class ReferenceContainerSettingsGroup extends SettingsGroup {
|
|||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::REFERENCE_CONTAINER_NAME['key'] => $this->add_setting( self::REFERENCE_CONTAINER_NAME ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class ScrollingSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'scrolling';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Scrolling Behavior';
|
||||
|
||||
/**
|
||||
* Settings container key to enable CSS smooth scrolling.
|
||||
|
@ -172,7 +179,10 @@ class ScrollingSettingsGroup extends SettingsGroup {
|
|||
'input_min' => 0,
|
||||
'enabled_by' => self::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_CSS_SMOOTH_SCROLLING['key'] => $this->add_setting( self::FOOTNOTES_CSS_SMOOTH_SCROLLING ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\general;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class ShortcodeSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'shortcode';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Footnote Start and End Short Codes';
|
||||
|
||||
/**
|
||||
* Settings container key to enable shortcode syntax validation.
|
||||
|
@ -141,7 +148,10 @@ class ShortcodeSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'text',
|
||||
'enabled_by' => self::FOOTNOTES_SHORT_CODE_END,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE['key'] => $this->add_setting( self::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class BacklinkSymbolSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'backlink-symbol';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Backlink Symbol';
|
||||
|
||||
/**
|
||||
* Settings container key for the backlink symbol selection.
|
||||
|
@ -80,7 +87,10 @@ class BacklinkSymbolSettingsGroup extends SettingsGroup {
|
|||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,10 +10,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-section.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
|
||||
use footnotes\includes\settings\SettingsSection;
|
||||
|
||||
/**
|
||||
|
@ -32,6 +29,15 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function __construct(
|
||||
$options_group_slug,
|
||||
$section_slug,
|
||||
|
@ -56,6 +62,25 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
|
|||
$this->load_options_group();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the required dependencies.
|
||||
*
|
||||
* Include the following files that provide the settings for this section:
|
||||
*
|
||||
* - {@see SettingsSection}: defines a section of settings;
|
||||
* - {@see BacklinkSymbolSettingsGroup};
|
||||
* - {@see ReferrersSettingsGroup};
|
||||
* - {@see ReferrersInLabelsSettingsGroup};
|
||||
* - {@see TooltipsSettingsGroup};
|
||||
* - {@see TooltipAppearanceSettingsGroup};
|
||||
* - {@see TooltipDimensionsSettingsGroup};
|
||||
* - {@see TooltipPositionSettingsGroup};
|
||||
* - {@see TooltipTextSettingsGroup};
|
||||
* - {@see TooltipTimingSettingsGroup}; and
|
||||
* - {@see TooltipTruncationSettingsGroup}.
|
||||
*
|
||||
* @see SettingsSection::load_dependencies()
|
||||
*/
|
||||
protected function load_dependencies(): void {
|
||||
parent::load_dependencies();
|
||||
|
||||
|
@ -71,6 +96,9 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
|
|||
require_once plugin_dir_path( __DIR__ ) . 'referrers-and-tooltips/class-tooltip-truncation-settings-group.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class ReferrersInLabelsSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'referrers-in-label';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Referrers in Labels';
|
||||
|
||||
/**
|
||||
* Settings container key to set the solution of the input element label issue.
|
||||
|
@ -62,7 +69,10 @@ class ReferrersInLabelsSettingsGroup extends SettingsGroup {
|
|||
'disconnect' => 'B. Labels with footnotes are disconnected from input element (discouraged)'
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_LABEL_ISSUE_SOLUTION['key'] => $this->add_setting( self::FOOTNOTES_LABEL_ISSUE_SOLUTION ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class ReferrersSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'referrers';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Referrers';
|
||||
|
||||
/**
|
||||
* Settings container key for the referrer element.
|
||||
|
@ -131,6 +138,9 @@ class ReferrersSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS['key'] => $this->add_setting( self::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-appearance';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Tooltip Appearance';
|
||||
|
||||
/**
|
||||
* Settings container key to enable setting the tooltip font size.
|
||||
|
@ -209,7 +216,10 @@ class TooltipAppearanceSettingsGroup extends SettingsGroup {
|
|||
'type' => 'string',
|
||||
'input_type' => 'color',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class TooltipDimensionsSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-dimensions';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Tooltip Dimensions';
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the max. width.
|
||||
|
@ -70,6 +77,9 @@ class TooltipDimensionsSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class TooltipPositionSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-position';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Tooltip Position';
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the position.
|
||||
|
@ -164,6 +171,9 @@ class TooltipPositionSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_POSITION['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_POSITION ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class TooltipTextSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-text';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Tooltip Text';
|
||||
|
||||
/**
|
||||
* Settings container key to configure the tooltip excerpt delimiter.
|
||||
|
@ -103,6 +110,9 @@ class TooltipTextSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER['key'] => $this->add_setting( self::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class TooltipTimingSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-timing';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Tooltip Timing';
|
||||
|
||||
/**
|
||||
* Settings container key for tooltip display fade-in delay.
|
||||
|
@ -112,6 +119,9 @@ class TooltipTimingSettingsGroup extends SettingsGroup {
|
|||
'input_min' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class TooltipTruncationSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-truncation';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Tooltip Truncation';
|
||||
|
||||
/**
|
||||
* Settings container key to enable tooltip truncation.
|
||||
|
@ -93,6 +100,9 @@ class TooltipTruncationSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\referrersandtooltips;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -31,6 +29,15 @@ class TooltipsSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltips';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Tooltips';
|
||||
|
||||
/**
|
||||
* Settings container key to enable the mouse-over box.
|
||||
|
@ -75,6 +82,9 @@ class TooltipsSettingsGroup extends SettingsGroup {
|
|||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see SettingsGroup::add_settings()
|
||||
*/
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_ENABLED['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ),
|
||||
|
|
|
@ -10,10 +10,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\scopeandpriority;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-section.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
|
||||
use footnotes\includes\settings\SettingsSection;
|
||||
|
||||
use footnotes\includes\settings\scopeandpriority\WordPressHooksSettingsGroup;
|
||||
|
@ -34,6 +31,15 @@ class ScopeAndPrioritySettingsSection extends SettingsSection {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function __construct(
|
||||
$options_group_slug,
|
||||
$section_slug,
|
||||
|
@ -58,12 +64,25 @@ class ScopeAndPrioritySettingsSection extends SettingsSection {
|
|||
$this->load_options_group();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the required dependencies.
|
||||
*
|
||||
* Include the following files that provide the settings for this section:
|
||||
*
|
||||
* - {@see SettingsSection}: defines a settings section; and
|
||||
* - {@see WordPressHooksSettingsGroup}.
|
||||
*
|
||||
* @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';
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace footnotes\includes\settings\scopeandpriority;
|
||||
|
||||
require_once plugin_dir_path( __DIR__ ) . 'class-settings-group.php';
|
||||
|
||||
use footnotes\includes\Settings;
|
||||
use footnotes\includes\settings\Setting;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
@ -30,7 +28,16 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'wordpress-hooks';
|
||||
public const GROUP_ID = 'wordpress-hooks';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'WordPress Hooks with Priority Level';
|
||||
|
||||
/**
|
||||
* Settings container key to enable the `the_title` hook.
|
||||
|
@ -53,7 +60,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* title string in menus and in the title element, but Footnotes doesn't
|
||||
* delete footnotes in them.
|
||||
*/
|
||||
const EXPERT_LOOKUP_THE_TITLE = array(
|
||||
public const EXPERT_LOOKUP_THE_TITLE = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_the_title',
|
||||
'name' => '<code>the_title()</code>',
|
||||
'description' => '<a href="https://developer.wordpress.org/reference/hooks/the_title/" target="_blank">https://developer.wordpress.org/reference/hooks/the_title/</a>',
|
||||
|
@ -71,7 +78,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `int` to `array`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL = array(
|
||||
public const EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_the_title_priority_level',
|
||||
'name' => '<code>the_title()</code> Priority Level',
|
||||
'description' => 'The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features. 9223372036854775807 is lowest priority, 0 is highest. To set priority level to lowest, set it to -1, interpreted as 9223372036854775807, the constant <code>PHP_INT_MAX</code>.',
|
||||
|
@ -92,7 +99,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_THE_CONTENT = array(
|
||||
public const EXPERT_LOOKUP_THE_CONTENT = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_the_content',
|
||||
'name' => '<code>the_content()</code>',
|
||||
'description' => '<a href="https://developer.wordpress.org/reference/hooks/the_content/" target="_blank">https://developer.wordpress.org/reference/hooks/the_content/</a>',
|
||||
|
@ -126,7 +133,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `int` to `array`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL = array(
|
||||
public const EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_the_content_priority_level',
|
||||
'name' => '<code>the_content()</code> Priority Level',
|
||||
'description' => 'The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features. 9223372036854775807 is lowest priority, 0 is highest. To set priority level to lowest, set it to -1, interpreted as 9223372036854775807, the constant <code>PHP_INT_MAX</code>. For <code>the_content</code>, this figure must be lower than 99 so that certain strings added by a plugin running at 99 may not be mistaken as a footnote. This makes also sure that the reference container displays above a feature inserted by a plugin running at 1200.',
|
||||
|
@ -148,7 +155,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_THE_EXCERPT = array(
|
||||
public const EXPERT_LOOKUP_THE_EXCERPT = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_the_excerpt',
|
||||
'name' => '<code>the_excerpt()</code>',
|
||||
'description' => '<a href="https://developer.wordpress.org/reference/hooks/the_excerpt/" target="_blank">https://developer.wordpress.org/reference/hooks/the_excerpt/</a>',
|
||||
|
@ -166,7 +173,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `int` to `array`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL = array(
|
||||
public const EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_the_excerpt_priority_level',
|
||||
'name' => '<code>the_excerpt()</code> Priority Level',
|
||||
'description' => 'The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features. 9223372036854775807 is lowest priority, 0 is highest. To set priority level to lowest, set it to -1, interpreted as 9223372036854775807, the constant <code>PHP_INT_MAX</code>.',
|
||||
|
@ -187,7 +194,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_WIDGET_TITLE = array(
|
||||
public const EXPERT_LOOKUP_WIDGET_TITLE = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_widget_title',
|
||||
'name' => '<code>widget_title()</code>',
|
||||
'description' => '<a href="https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title" target="_blank">https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title</a>',
|
||||
|
@ -205,7 +212,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `int` to `array`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL = array(
|
||||
public const EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_widget_title_priority_level',
|
||||
'name' => '<code>widget_title()</code> Priority Level',
|
||||
'description' => 'The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features. 9223372036854775807 is lowest priority, 0 is highest. To set priority level to lowest, set it to -1, interpreted as 9223372036854775807, the constant <code>PHP_INT_MAX</code>.',
|
||||
|
@ -231,7 +238,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_WIDGET_TEXT = array(
|
||||
public const EXPERT_LOOKUP_WIDGET_TEXT = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_widget_text',
|
||||
'name' => '<code>widget_text()</code>',
|
||||
'description' => '<a href="https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text" target="_blank">https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text</a>. The <code>widget_text()</code> hook must be enabled either when footnotes are present in theme text widgets, or when Elementor accordions or toggles shall have a reference container per section. If they should not, this hook must be disabled.',
|
||||
|
@ -249,7 +256,7 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `int` to `array`.
|
||||
*/
|
||||
const EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL = array(
|
||||
public const EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL = array(
|
||||
'key' => 'footnote_inputfield_expert_lookup_widget_text_priority_level',
|
||||
'name' => '<code>widget_text()</code> Priority Level',
|
||||
'description' => 'The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features. 9223372036854775807 is lowest priority, 0 is highest. To set priority level to lowest, set it to -1, interpreted as 9223372036854775807, the constant <code>PHP_INT_MAX</code>.',
|
||||
|
@ -260,6 +267,9 @@ class WordPressHooksSettingsGroup extends SettingsGroup {
|
|||
'input_min' => -1,
|
||||
);
|
||||
|
||||
/**
|
||||
* @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 ),
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
namespace footnotes\general;
|
||||
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/settings/general/class-reference-container-settings-group.php';
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/settings/general/class-scrolling-settings-group.php';
|
||||
|
||||
use footnotes\includes\{Footnotes, Convert, Settings};
|
||||
|
||||
|
|
Reference in a new issue