refactor: finish ‘Referrers and Tooltips’ settings section
This commit is contained in:
parent
b14fbad0e5
commit
1183794170
27 changed files with 1965 additions and 1586 deletions
|
@ -26,7 +26,16 @@ abstract class SettingsGroup {
|
|||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = '';
|
||||
const GROUP_ID = 'undefined';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'undefined';
|
||||
|
||||
/**
|
||||
* The setting classes.
|
||||
|
@ -105,7 +114,7 @@ abstract class SettingsGroup {
|
|||
}
|
||||
}
|
||||
|
||||
public function add_settings_fields(Layout\SettingsPage $component): void {
|
||||
public function add_settings_fields(Layout\SettingsPage $component): void {
|
||||
foreach ($this->settings as $setting) {
|
||||
add_settings_field(
|
||||
$setting->key,
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `AMPCompatSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
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;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
||||
/**
|
||||
* Class defining the AMP compat. settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
* @deprecated
|
||||
*/
|
||||
class AMPCompatSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'amp-compat';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'AMP Compatiblility (unsupported)';
|
||||
|
||||
/**
|
||||
* Settings container key to enable AMP compatibility mode.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const FOOTNOTES_AMP_COMPATIBILITY_ENABLE = array(
|
||||
'key' => 'footnotes_inputfield_amp_compatibility_enable',
|
||||
'name' => 'Enable AMP compatibility mode',
|
||||
'description' => 'The official <a href="https://wordpress.org/plugins/amp/" target="_blank" style="font-style: normal;">AMP-WP</a> plugin is required when this option is enabled. This option enables hard links with configurable scroll offset in % viewport height.',
|
||||
'default_value' => false,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
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 ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `ExcerptsSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
||||
/**
|
||||
* Class defining the footnote exerpts settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class ExcerptsSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'excerpts';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = 'Footnotes in Excerpts';
|
||||
|
||||
/**
|
||||
* Settings container key to look for footnotes in post excerpts.
|
||||
*
|
||||
* @var arrau
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.6.3 Enabled by default.
|
||||
* @since 2.8.0 Move from `Settings` to `ExcerptsSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_IN_EXCERPT = array(
|
||||
'key' => 'footnote_inputfield_search_in_excerpt',
|
||||
'name' => 'Process Footnotes in Excerpts',
|
||||
'default_value' => 'manual',
|
||||
'type' => 'string',
|
||||
'input_type' => 'select',
|
||||
'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'
|
||||
),
|
||||
);
|
||||
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_IN_EXCERPT['key'] => $this->add_setting( self::FOOTNOTES_IN_EXCERPT ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -16,6 +16,11 @@ use footnotes\includes\settings\SettingsSection;
|
|||
use footnotes\includes\settings\general\ReferenceContainerSettingsGroup;
|
||||
use footnotes\includes\settings\general\ScrollingSettingsGroup;
|
||||
use footnotes\includes\settings\general\ShortcodeSettingsGroup;
|
||||
use footnotes\includes\settings\general\NumberingSettingsGroup;
|
||||
use footnotes\includes\settings\general\HardLinksSettingsGroup;
|
||||
use footnotes\includes\settings\general\LoveSettingsGroup;
|
||||
use footnotes\includes\settings\general\ExcerptsSettingsGroup;
|
||||
use footnotes\includes\settings\general\AMPCompatSettingsGroup;
|
||||
|
||||
/**
|
||||
* Class defining general plugin settings.
|
||||
|
@ -55,13 +60,23 @@ class GeneralSettingsSection extends SettingsSection {
|
|||
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';
|
||||
}
|
||||
|
||||
protected function add_settings_groups(): void {
|
||||
$this->settings_groups = array(
|
||||
AMPCompatSettingsGroup::GROUP_ID => new AMPCompatSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
ReferenceContainerSettingsGroup::GROUP_ID => new ReferenceContainerSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
ScrollingSettingsGroup::GROUP_ID => new ScrollingSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
ShortcodeSettingsGroup::GROUP_ID => new ShortcodeSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
NumberingSettingsGroup::GROUP_ID => new NumberingSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
HardLinksSettingsGroup::GROUP_ID => new HardLinksSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
ExcerptsSettingsGroup::GROUP_ID => new ExcerptsSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
LoveSettingsGroup::GROUP_ID => new LoveSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `HardLinksSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the hard links settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class HardLinksSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'hard-links';
|
||||
|
||||
/**
|
||||
* Settings container key to enable hard links.
|
||||
*
|
||||
* When the alternative reference container is enabled, hard links are too.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @since 2.8.0 Move from `Settings` to `HardLinksSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const FOOTNOTES_HARD_LINKS_ENABLE = array(
|
||||
'key' => 'footnotes_inputfield_hard_links_enable',
|
||||
'name' => 'Enable Hard Links',
|
||||
'description' => 'Hard links disable jQuery delays but have the same scroll offset, and allow to share footnotes (accessed if the list is not collapsed by default).',
|
||||
'default_value' => false,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the fragment ID slug in referrers.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @since 2.8.0 Move from `Settings` to `HardLinksSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const REFERRER_FRAGMENT_ID_SLUG = array(
|
||||
'key' => 'footnotes_inputfield_referrer_fragment_id_slug',
|
||||
'name' => 'Fragment Identifier Slug for Footnote Referrers',
|
||||
'description' => 'This will show up in the address bar after clicking on a hard-linked backlink.',
|
||||
'default_value' => 'r',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the fragment ID slug in footnotes.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @since 2.8.0 Move from `Settings` to `HardLinksSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTE_FRAGMENT_ID_SLUG = array(
|
||||
'key' => 'footnotes_inputfield_footnote_fragment_id_slug',
|
||||
'name' => 'Fragment Identifier Slug for Footnotes',
|
||||
'description' => 'This will show up in the address bar after clicking on a hard-linked footnote referrer.',
|
||||
'default_value' => 'f',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the ID separator in fragment IDs.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @since 2.8.0 Move from `Settings` to `HardLinksSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const HARD_LINK_IDS_SEPARATOR = array(
|
||||
'key' => 'footnotes_inputfield_hard_link_ids_separator',
|
||||
'name' => 'ID Separator',
|
||||
'description' => 'May be empty or any string, for example _, - or +, to distinguish post number, container number and footnote number.',
|
||||
'default_value' => '+',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key to enable backlink tooltips.
|
||||
*
|
||||
* When hard links are enabled, clicks on the backlinks are logged in the
|
||||
* browsing history, along with clicks on the referrers.
|
||||
* This tooltip hints to use the backbutton instead, so the history gets
|
||||
* streamlined again.
|
||||
* See {@link https://wordpress.org/support/topic/making-it-amp-compatible/#post-13837359
|
||||
* here} for more information.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `HardLinksSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const FOOTNOTES_BACKLINK_TOOLTIP_ENABLE = array(
|
||||
'key' => 'footnotes_inputfield_backlink_tooltip_enable',
|
||||
'name' => 'Enable Backlink Tooltips',
|
||||
'description' => 'Hard backlinks get ordinary tooltips hinting to use the backbutton instead to keep it usable.',
|
||||
'default_value' => true,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key to configure the backlink tooltip.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `HardLinksSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_BACKLINK_TOOLTIP_TEXT = array(
|
||||
'key' => 'footnotes_inputfield_backlink_tooltip_text',
|
||||
'name' => 'Backlink Tooltip Text',
|
||||
'description' => 'Default text is the keyboard shortcut; may be a localized descriptive hint.',
|
||||
'default_value' => 'Alt + ←',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
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_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 ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
111
src/includes/settings/general/class-love-settings-group.php
Normal file
111
src/includes/settings/general/class-love-settings-group.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `LoveSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
use footnotes\includes\settings\SettingsGroup;
|
||||
|
||||
/**
|
||||
* Class defining the footnote love settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class LoveSettingsGroup extends SettingsGroup {
|
||||
const LOVE_SYMBOL = '<span style="color:#ff6d3b; font-weight:bold;">♥</span>';
|
||||
const PLUGIN_SYMBOL = '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>';
|
||||
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'love';
|
||||
|
||||
/**
|
||||
* Setting group name.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_NAME = self::LOVE_SYMBOL . ' Love';
|
||||
|
||||
/**
|
||||
* Settings container key for the ‘I love footnotes’ text.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_LOVE = array(
|
||||
'key' => 'footnote_inputfield_love',
|
||||
'name' => 'Tell the world you\'re using the plugin!',
|
||||
'default_value' => 'no',
|
||||
'type' => 'string',
|
||||
'input_type' => 'select',
|
||||
'input_options' => array(
|
||||
// Logo only.
|
||||
'text-3' => self::PLUGIN_SYMBOL,
|
||||
// Logo followed by heart symbol.
|
||||
'text-4' => self::PLUGIN_SYMBOL . ' ' . self::LOVE_SYMBOL,
|
||||
// Logo preceded by heart symbol.
|
||||
'text-5' => self::LOVE_SYMBOL . ' ' . self::PLUGIN_SYMBOL,
|
||||
// Translators: 2: heart symbol 1: footnotes logogram.
|
||||
'text-1' => 'I ' . self::LOVE_SYMBOL . ' ' . self::PLUGIN_SYMBOL,
|
||||
// Translators: %s: Footnotes plugin logo.
|
||||
'text-6' => 'This website uses ' . self::PLUGIN_SYMBOL,
|
||||
// Translators: %s: Footnotes plugin logo.
|
||||
'text-7' => 'This website uses the ' . self::PLUGIN_SYMBOL . ' plugin',
|
||||
// Translators: %s: Footnotes plugin logo.
|
||||
'text-2' => 'This website uses the awesome ' . self::PLUGIN_SYMBOL . ' plugin',
|
||||
'random' => 'randomly determined display of either mention',
|
||||
// Translators: 1: Plugin logo.2: heart symbol.
|
||||
'no' => 'no display of any mention in the footer',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the shortcode to NOT display the ‘LOVE ME’ slug
|
||||
* on certain pages.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Config` to `ReferenceContainerSettingsGroup`.
|
||||
* Rename from `NO_LOVE_SLUG` to `FOOTNOTES_NO_LOVE_SLUG`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_NO_LOVE_SLUG = array(
|
||||
'key' => 'footnote_inputfield_no_love_slug',
|
||||
'name' => 'Shortcode to inhibit the display of the ' . self::PLUGIN_SYMBOL . ' mention on specific pages',
|
||||
'default_value' => '[[no footnotes: love]]',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::FOOTNOTES_LOVE['key'] => $this->add_setting( self::FOOTNOTES_LOVE ),
|
||||
self::FOOTNOTES_NO_LOVE_SLUG['key'] => $this->add_setting( self::FOOTNOTES_NO_LOVE_SLUG ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `NumberingSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the footnote numbering settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class NumberingSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'numbering';
|
||||
|
||||
/**
|
||||
* Settings container key for combining identical footnotes.
|
||||
*
|
||||
* @link https://wordpress.org/support/topic/add-support-for-ibid-notation
|
||||
* Support for Ibid. notation added thanks to @meglio.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const COMBINE_IDENTICAL_FOOTNOTES = array(
|
||||
'key' => 'footnote_inputfield_combine_identical',
|
||||
'name' => 'Combine Identical Footnotes',
|
||||
'description' => 'This option may require copy-pasting footnotes in multiple instances. Even when footnotes are combined, footnote numbers keep incrementing. This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system. The Ibid. notation and the op. cit. abbreviation followed by the current page number avoid repeating the footnote content. For changing sources, shortened citations may be used. Repeating full citations is also an opportunity to add details.',
|
||||
'default_value' => true,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the counter style of the footnotes.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `NumberingSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_COUNTER_STYLE = array(
|
||||
'key' => 'footnote_inputfield_counter_style',
|
||||
'name' => 'Numbering Style',
|
||||
'default_value' => 'arabic_plain',
|
||||
'type' => 'string',
|
||||
'input_type' => 'select',
|
||||
'input_options' => array(
|
||||
'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, …)',
|
||||
'romanic' => 'uppercase Roman numerals (I, II, III, IV, V, …)',
|
||||
'roman_low' => 'lowercase Roman numerals (i, ii, iii, iv, v, …)',
|
||||
),
|
||||
);
|
||||
|
||||
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 ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -32,24 +32,6 @@ class ReferenceContainerSettingsGroup extends SettingsGroup {
|
|||
*/
|
||||
const GROUP_ID = 'reference-container';
|
||||
|
||||
/**
|
||||
* Settings container key for combining identical footnotes.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const COMBINE_IDENTICAL_FOOTNOTES = array(
|
||||
'key' => 'footnote_inputfield_combine_identical',
|
||||
'name' => 'Combine Identical Footnotes',
|
||||
'default_value' => true,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the label of the reference container.
|
||||
*
|
||||
|
@ -731,7 +713,6 @@ class ReferenceContainerSettingsGroup extends SettingsGroup {
|
|||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::REFERENCE_CONTAINER_NAME['key'] => $this->add_setting( self::REFERENCE_CONTAINER_NAME ),
|
||||
self::COMBINE_IDENTICAL_FOOTNOTES['key'] => $this->add_setting( self::COMBINE_IDENTICAL_FOOTNOTES ),
|
||||
self::REFERENCE_CONTAINER_NAME['key'] => $this->add_setting( self::REFERENCE_CONTAINER_NAME ),
|
||||
self::REFERENCE_CONTAINER_LABEL_ELEMENT['key'] => $this->add_setting( self::REFERENCE_CONTAINER_LABEL_ELEMENT ),
|
||||
self::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER['key'] => $this->add_setting( self::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ),
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `BacklinkSymbolSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the backlink symbol settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class BacklinkSymbolSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'backlink-symbol';
|
||||
|
||||
/**
|
||||
* Settings container key for the backlink symbol selection.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const HYPERLINK_ARROW = array(
|
||||
'key' => 'footnote_inputfield_custom_hyperlink_symbol',
|
||||
'name' => 'Select the Backlink Symbol',
|
||||
'description' => 'This symbol is used in the reference container. But this setting pre-existed under this tab and cannot be moved to another one.',
|
||||
'default_value' => 0,
|
||||
'type' => 'string',
|
||||
'input_type' => 'select',
|
||||
'input_options' => array(
|
||||
'↑',
|
||||
'↥',
|
||||
'↟',
|
||||
'↩',
|
||||
'↲',
|
||||
'↵',
|
||||
'⇑',
|
||||
'⇡',
|
||||
'⇧',
|
||||
'↑'
|
||||
),
|
||||
//'overridden_by' => self::HYPERLINK_ARROW_USER_DEFINED,
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the user-defined backlink symbol.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `BacklinkSymbolSettingsGroup`.
|
||||
* 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',
|
||||
'enabled_by' => self::HYPERLINK_ARROW
|
||||
);
|
||||
|
||||
protected function add_settings( array|false $options ): void {
|
||||
$this->settings = array(
|
||||
self::HYPERLINK_ARROW['key'] => $this->add_setting( self::HYPERLINK_ARROW ),
|
||||
self::HYPERLINK_ARROW_USER_DEFINED['key'] => $this->add_setting( self::HYPERLINK_ARROW_USER_DEFINED ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -14,9 +14,6 @@ require_once plugin_dir_path( __DIR__ ) . 'class-settings-section.php';
|
|||
|
||||
use footnotes\includes\settings\SettingsSection;
|
||||
|
||||
// Import settings groups.
|
||||
//use footnotes\includes\settings\referrers-and-tooltips\...;
|
||||
|
||||
/**
|
||||
* Class defining plugin referrer and tooltips settings.
|
||||
*
|
||||
|
@ -52,13 +49,30 @@ class ReferrersAndTooltipsSettingsSection 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__ ) . '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';
|
||||
}
|
||||
|
||||
protected function add_settings_groups(): void {
|
||||
$this->settings_groups = array (
|
||||
// Add settings groups.
|
||||
//...::GROUP_ID => new ...($this->options_group_slug, $this->section_slug),
|
||||
BacklinkSymbolSettingsGroup::GROUP_ID => new BacklinkSymbolSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
ReferrersSettingsGroup::GROUP_ID => new ReferrersSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
ReferrersInLabelsSettingsGroup::GROUP_ID => new ReferrersInLabelsSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
TooltipsSettingsGroup::GROUP_ID => new TooltipsSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
TooltipAppearanceSettingsGroup::GROUP_ID => new TooltipAppearanceSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
TooltipDimensionsSettingsGroup::GROUP_ID => new TooltipDimensionsSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
TooltipPositionSettingsGroup::GROUP_ID => new TooltipPositionSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
TooltipTextSettingsGroup::GROUP_ID => new TooltipTextSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
TooltipTimingSettingsGroup::GROUP_ID => new TooltipTimingSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
TooltipTruncationSettingsGroup::GROUP_ID => new TooltipTruncationSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `ReferrersInLabelsSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the referrer in labels settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class ReferrersInLabelsSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'referrers-in-label';
|
||||
|
||||
/**
|
||||
* Settings container key to set the solution of the input element label issue.
|
||||
*
|
||||
* If hard links are not enabled, clicking a referrer in an input element label
|
||||
* toggles the state of the input element the label is connected to.
|
||||
* Beside hard links, other solutions include moving footnotes off the label and
|
||||
* append them, or disconnecting this label from the input element (discouraged).
|
||||
* See {@link https://wordpress.org/support/topic/compatibility-issue-with-wpforms/#post-14212318
|
||||
* here} for more information.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.12
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* @todo Review, remove?
|
||||
*/
|
||||
const FOOTNOTES_LABEL_ISSUE_SOLUTION = array(
|
||||
'key' => 'footnotes_inputfield_label_issue_solution',
|
||||
'name' => 'Solve Input Label Issue',
|
||||
'description' => 'Clicking a footnote referrer in an input element label toggles the input except when hard links are enabled. In jQuery mode, the recommended solution is to move footnotes and append them after the label (option A). Option B is discouraged because disconnecting a label from its input element may compromise accessibility. This option is a last resort in case footnotes must absolutely stay inside the label. (Using jQuery \'event.stopPropagation\' failed.',
|
||||
'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)'
|
||||
),
|
||||
);
|
||||
|
||||
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 ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `ReferrersSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the referrer settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class ReferrersSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'referrers';
|
||||
|
||||
/**
|
||||
* Settings container key for the referrer element.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.1
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = array(
|
||||
'key' => 'footnotes_inputfield_referrer_superscript_tags',
|
||||
'name' => 'Display Footnote Referrers in Superscript',
|
||||
'default_value' => true,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key to enable superscript style normalization.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT = array(
|
||||
'key' => 'footnotes_inputfield_referrers_normal_superscript',
|
||||
'name' => 'Normalize Vertical Alignment and Font Size',
|
||||
'description' => 'Most themes don\'t need this fix.',
|
||||
'default_value' => 'no',
|
||||
'type' => 'string',
|
||||
'input_type' => 'select',
|
||||
'input_options' => array(
|
||||
'no' => 'No',
|
||||
'referrers' => 'Footnote referrers',
|
||||
'all' => 'All superscript elements'
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the string before the footnote referrer.
|
||||
*
|
||||
* The default footnote referrer surroundings should be square brackets, as
|
||||
* in English or US American typesetting, for better UX thanks to a more
|
||||
* button-like appearance, as well as for stylistic consistency with the
|
||||
* expand-collapse button.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_STYLING_BEFORE = array(
|
||||
'key' => 'footnote_inputfield_custom_styling_before',
|
||||
'name' => 'At the Start of the Footnote Referrers',
|
||||
'default_value' => '[',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the string after the footnote referrer.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_STYLING_AFTER = array(
|
||||
'key' => 'footnotes_inputfield_referrers_normal_superscript',
|
||||
'name' => 'At the End of the Footnote Referrers',
|
||||
'default_value' => ']',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const LINK_ELEMENT_ENABLED = array(
|
||||
'key' => 'footnote_inputfield_link_element_enabled',
|
||||
'name' => 'Use the Link Element for Referrers and Backlinks',
|
||||
'description' => 'Please find this setting at the end of the reference container settings. The link element is needed to apply the theme\'s link color.',
|
||||
'default_value' => true,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
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 ),
|
||||
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 ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,236 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `TooltipAppearanceSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the tooltip appearance settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class TooltipAppearanceSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-appearance';
|
||||
|
||||
/**
|
||||
* Settings container key to enable setting the tooltip font size.
|
||||
*
|
||||
* Tooltip font size reset to legacy by default since 2.1.4;
|
||||
* Was set to inherit since 2.1.1 as it overrode custom CSS,
|
||||
* Called mouse over box not tooltip for consistency.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const MOUSE_OVER_BOX_FONT_SIZE_ENABLED = array(
|
||||
'key' => 'footnotes_inputfield_mouse_over_box_font_size_enabled',
|
||||
'name' => 'Set Font Size',
|
||||
'description' => '',
|
||||
'default_value' => '',
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the scalar value of the tooltip font size.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const MOUSE_OVER_BOX_FONT_SIZE_SCALAR = array(
|
||||
'key' => 'footnotes_inputfield_mouse_over_box_font_size_scalar',
|
||||
'name' => 'Font Size',
|
||||
'description' => 'By default, the font size is set to equal the surrounding text.',
|
||||
'default_value' => 13,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 50,
|
||||
'input_min' => 0
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the unit of the tooltip font size.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const MOUSE_OVER_BOX_FONT_SIZE_UNIT = array(
|
||||
'key' => 'footnotes_inputfield_mouse_over_box_font_size_unit',
|
||||
'name' => 'Font Size Unit',
|
||||
'default_value' => 'px',
|
||||
'type' => 'string',
|
||||
'input_type' => 'select',
|
||||
'input_options' => array(
|
||||
'em' => 'em',
|
||||
'rem' => 'rem',
|
||||
'px' => 'pixels',
|
||||
'pt' => 'points',
|
||||
'pc' => 'picas',
|
||||
'mm' => 'millimeters',
|
||||
'%' => 'per cent',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the color.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.6
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_COLOR = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_color',
|
||||
'name' => 'Text Color',
|
||||
'description' => 'To use the current theme\'s default text color, clear or leave empty',
|
||||
'default_value' => '#000000',
|
||||
'type' => 'string',
|
||||
'input_type' => 'color',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the background color.
|
||||
*
|
||||
* Theme default background color is best, but theme default background color
|
||||
* doesn't seem to exist.
|
||||
*
|
||||
* The default is currently `#ffffff` with `#000000` as the text color.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.6
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_background',
|
||||
'name' => 'Background Color',
|
||||
'description' => 'To use the current theme\'s default background color, clear or leave empty',
|
||||
'default_value' => '#ffffff',
|
||||
'type' => 'string',
|
||||
'input_type' => 'color',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the border width.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.6
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_border_width',
|
||||
'name' => 'Border Width',
|
||||
'description' => 'pixels; 0 for borderless',
|
||||
'default_value' => 1,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 4,
|
||||
'input_min' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the border color.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.6
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_border_color',
|
||||
'name' => 'Border Color',
|
||||
'description' => 'To use the current theme\'s default border color, clear or leave empty',
|
||||
'default_value' => '#ffffff',
|
||||
'type' => 'string',
|
||||
'input_type' => 'color',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the border radius.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.6
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_border_radius',
|
||||
'name' => 'Rounded Corner Radius',
|
||||
'description' => 'pixels; 0 for sharp corners',
|
||||
'default_value' => 0,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 500,
|
||||
'input_min' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the box-shadow color.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.8
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_shadow_color',
|
||||
'name' => 'Box Shadow Color',
|
||||
'description' => 'To use the current theme\'s default box shadow color, clear or leave empty',
|
||||
'default_value' => '#666666',
|
||||
'type' => 'string',
|
||||
'input_type' => 'color',
|
||||
);
|
||||
|
||||
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::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 ),
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ),
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `TooltipDimensionsSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the tooltip dimension settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class TooltipDimensionsSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-dimensions';
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the max. width.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.6
|
||||
* @since 2.0.7 Set default width to 450.
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_max_width',
|
||||
'name' => 'Maximum Width',
|
||||
'description' => 'pixels; set to 0 for jQuery tooltips without max width',
|
||||
'default_value' => 450,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for alternative tooltip width.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.2.5
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH = array(
|
||||
'key' => 'footnotes_inputfield_alternative_mouse_over_box_width',
|
||||
'name' => 'Maximum Width (alternative tooltips)',
|
||||
'default_value' => 400,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
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 ),
|
||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH['key'] => $this->add_setting( self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `TooltipPositionSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the tooltip position settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class TooltipPositionSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-position';
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the position.
|
||||
*
|
||||
* The default position should not be lateral because of the risk
|
||||
* the box gets squeezed between note anchor at line end and window edge,
|
||||
* and top because reading at the bottom of the window is more likely.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.7
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_POSITION = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_position',
|
||||
'name' => 'Position',
|
||||
'description' => 'The second column of settings boxes is for the alternative tooltips.',
|
||||
'default_value' => 'top center',
|
||||
'type' => 'string',
|
||||
'input_type' => 'select',
|
||||
'input_options' => array(
|
||||
'top left' => 'top left',
|
||||
'top center' => 'top center',
|
||||
'top right' => 'top right',
|
||||
'center right' => 'center right',
|
||||
'bottom right' => 'bottom right',
|
||||
'bottom center' => 'bottom center',
|
||||
'bottom left' => 'bottom left',
|
||||
'center left' => 'center left',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for alternative tooltip position.
|
||||
*
|
||||
* Fixed-width is for alternative tooltips, cannot reuse `max-width` nor offsets.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.2.5
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION = array(
|
||||
'key' => 'footnotes_inputfield_alternative_mouse_over_box_position',
|
||||
'name' => 'Position (alternative Tooltips)',
|
||||
'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',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the _x_-offset.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.7
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_offset_x',
|
||||
'name' => 'Horizontal Offset',
|
||||
'description' => 'pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position',
|
||||
'default_value' => 0,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for alternative tooltip _x_-offset.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.2.5
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X = array(
|
||||
'key' => 'footnotes_inputfield_alternative_mouse_over_box_offset_x',
|
||||
'name' => 'Horizontal Offset (alternative tooltips)',
|
||||
'description' => 'pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position',
|
||||
'default_value' => -50,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the _y_-offset.
|
||||
*
|
||||
* The vertical offset must be negative for the box not to cover the current
|
||||
* line of text.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.7
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_offset_y',
|
||||
'name' => 'Vertical Offset',
|
||||
'description' => 'pixels; negative value for an upwards offset; alternative tooltips: direction depends on position',
|
||||
'default_value' => -7,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for alternative tooltip _y_-offset.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y = array(
|
||||
'key' => 'footnotes_inputfield_alternative_mouse_over_box_offset_y',
|
||||
'name' => 'Vertical Offset (alternative tooltips)',
|
||||
'description' => 'pixels; negative value for an upwards offset; alternative tooltips: direction depends on position',
|
||||
'default_value' => 24,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
);
|
||||
|
||||
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 ),
|
||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION['key'] => $this->add_setting( self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ),
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ),
|
||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X['key'] => $this->add_setting( self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ),
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ),
|
||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y['key'] => $this->add_setting( self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `TooltipTextSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the tooltip position settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class TooltipTextSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-text';
|
||||
|
||||
/**
|
||||
* Settings container key to configure the tooltip excerpt delimiter.
|
||||
*
|
||||
* The first implementation used a fixed shortcode provided in the changelog,
|
||||
* but footnotes should have freely-configurable shortcodes.
|
||||
*
|
||||
* Tooltips can display another content than the footnote entry in the
|
||||
* reference container. The trigger is a shortcode in the footnote text
|
||||
* separating the tooltip text from the note. That is consistent with what
|
||||
* WordPress does for excerpts.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER = array(
|
||||
'key' => 'footnotes_inputfield_tooltip_excerpt_delimiter',
|
||||
'name' => 'Delimiter for Dedicated Tooltip Text',
|
||||
'description' => 'Tooltips can display another content than the footnote entry in the reference container. The trigger is a shortcode in the footnote text separating the tooltip text from the note. That is consistent with what WordPress does for excerpts. If the delimiter shortcode is present, the tooltip text will be the part before it.',
|
||||
'default_value' => '[[/tooltip]]',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key to enable mirroring the tooltip excerpt in the
|
||||
* reference container.
|
||||
*
|
||||
* Tooltips, even jQuery-driven, may be hard to consult on mobiles.
|
||||
* This option allows users to read the tooltip content in the reference
|
||||
* container too. See {@link https://wordpress.org/support/topic/change-tooltip-text/#post-13935050
|
||||
* here} for more information, and {@link https://wordpress.org/support/topic/change-tooltip-text/#post-13935488
|
||||
* here} for why this must not be the default behavior.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE = array(
|
||||
'key' => 'footnotes_inputfield_tooltip_excerpt_mirror_enable',
|
||||
'name' => 'Mirror the Tooltip in the Reference Container',
|
||||
'description' => 'Tooltips may be harder to use on mobiles. This option allows to read it in the reference container. Tooltips, even jQuery-driven, may be hard to consult on mobiles. This option allows to read the tooltip content in the reference container too.',
|
||||
'default_value' => 'false',
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key to configure the tooltip excerpt separator in the
|
||||
* reference container.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR = array(
|
||||
'key' => 'footnotes_inputfield_tooltip_excerpt_mirror_separator',
|
||||
'name' => 'Separator Between Tooltip Text and Footnote Text',
|
||||
'description' => 'May be a simple space, or a line break <br />, or any string in your language.',
|
||||
'default_value' => ' — ',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
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 ),
|
||||
self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE['key'] => $this->add_setting( self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ),
|
||||
self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR['key'] => $this->add_setting( self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `TooltipTimingSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the tooltip timing settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class TooltipTimingSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-timing';
|
||||
|
||||
/**
|
||||
* Settings container key for tooltip display fade-in delay.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const MOUSE_OVER_BOX_FADE_IN_DELAY = array(
|
||||
'key' => 'footnotes_inputfield_mouse_over_box_fade_in_delay',
|
||||
'name' => 'Fade-in Delay',
|
||||
'description' => 'milliseconds',
|
||||
'default_value' => 0,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 20000,
|
||||
'input_min' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for tooltip display fade-in duration.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const MOUSE_OVER_BOX_FADE_IN_DURATION = array(
|
||||
'key' => 'footnotes_inputfield_mouse_over_box_fade_in_duration',
|
||||
'name' => 'Fade-in Duration',
|
||||
'description' => 'milliseconds',
|
||||
'default_value' => 200,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 20000,
|
||||
'input_min' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for tooltip display fade-out delay.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const MOUSE_OVER_BOX_FADE_OUT_DELAY = array(
|
||||
'key' => 'footnotes_inputfield_mouse_over_box_fade_out_delay',
|
||||
'name' => 'Fade-out Delay',
|
||||
'description' => 'milliseconds',
|
||||
'default_value' => 400,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 20000,
|
||||
'input_min' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for tooltip display fade-out duration.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const MOUSE_OVER_BOX_FADE_OUT_DURATION = array(
|
||||
'key' => 'footnotes_inputfield_mouse_over_box_fade_out_duration',
|
||||
'name' => 'Fade-out Duration',
|
||||
'description' => 'milliseconds',
|
||||
'default_value' => 200,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 20000,
|
||||
'input_min' => 0,
|
||||
);
|
||||
|
||||
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_OUT_DURATION['key'] => $this->add_setting( self::MOUSE_OVER_BOX_FADE_OUT_DURATION ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `TooltipTruncationSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the tooltip truncation settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class TooltipTruncationSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltip-truncation';
|
||||
|
||||
/**
|
||||
* Settings container key to enable tooltip truncation.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
* @todo The mouse-over content truncation should be enabled by default to raise
|
||||
* awareness of the functionality, prevent the screen from being filled on
|
||||
* mouse-over, and allow the use of ‘Continue Reading’ functionality.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_excerpt_enabled',
|
||||
'name' => 'Truncate the Note in the Tooltip',
|
||||
'default_value' => true,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the mouse-over box to define the max. length of
|
||||
* the enabled excerpt.
|
||||
*
|
||||
* The default truncation length is 200 chars.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.4
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_excerpt_length',
|
||||
'name' => 'Maximum Number of Characters in the Tooltip',
|
||||
'description' => 'No weird cuts.',
|
||||
'default_value' => 200,
|
||||
'type' => 'number',
|
||||
'input_type' => 'number',
|
||||
'input_max' => 10000,
|
||||
'input_min' => 3,
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key for the label of the Read-on button in truncated tooltips.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
*/
|
||||
const FOOTNOTES_TOOLTIP_READON_LABEL = array(
|
||||
'key' => 'footnote_inputfield_readon_label',
|
||||
'name' => '\'Read on\' Button Label',
|
||||
'default_value' => 'Continue reading',
|
||||
'type' => 'string',
|
||||
'input_type' => 'text',
|
||||
);
|
||||
|
||||
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 ),
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH ),
|
||||
self::FOOTNOTES_TOOLTIP_READON_LABEL['key'] => $this->add_setting( self::FOOTNOTES_TOOLTIP_READON_LABEL ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* File providing the `TooltipsSettingsGroup` class.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class defining the tooltip settings.
|
||||
*
|
||||
* @package footnotes
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class TooltipsSettingsGroup extends SettingsGroup {
|
||||
/**
|
||||
* Setting group ID.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
const GROUP_ID = 'tooltips';
|
||||
|
||||
/**
|
||||
* Settings container key to enable the mouse-over box.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 1.5.2
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_ENABLED = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_enabled',
|
||||
'name' => 'Display Tooltips',
|
||||
'description' => 'Formatted text boxes allowing hyperlinks, displayed on mouse-over or tap and hold.',
|
||||
'default_value' => true,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings container key to enable the alternative tooltips.
|
||||
*
|
||||
* These alternative tooltips work around a website-related jQuery UI
|
||||
* outage. They are low-script but use the AMP-incompatible `onmouseover`
|
||||
* and `onmouseout` arguments, along with CSS transitions for fade-in/out.
|
||||
* The very small script is inserted after the plugin's internal stylesheet.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 2.1.1
|
||||
* @since 2.8.0 Move from `Settings` to `ReferenceContainerSettingsGroup`.
|
||||
* Convert from `string` to `array`.
|
||||
* Convert setting data type from `string` to `boolean`.
|
||||
*/
|
||||
const FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE = array(
|
||||
'key' => 'footnote_inputfield_custom_mouse_over_box_alternative',
|
||||
'name' => 'Display Alternative Tooltips',
|
||||
'description' => 'Intended to work around a configuration-related tooltip outage. These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes\' internal stylesheet. When this option is enabled, footnotes does not load jQuery UI nor jQuery Tools.',
|
||||
'default_value' => false,
|
||||
'type' => 'boolean',
|
||||
'input_type' => 'checkbox',
|
||||
);
|
||||
|
||||
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 ),
|
||||
self::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE['key'] => $this->add_setting( self::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ),
|
||||
);
|
||||
|
||||
$this->load_values( $options );
|
||||
}
|
||||
}
|
Reference in a new issue