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
BIN
settings.ods
BIN
settings.ods
Binary file not shown.
|
@ -473,6 +473,17 @@ abstract class Engine {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function add_input_color( array $args ): void {
|
||||||
|
extract( $args );
|
||||||
|
|
||||||
|
echo sprintf(
|
||||||
|
'<input type="color" name="%s" id="%s"%s/>',
|
||||||
|
$name,
|
||||||
|
$name,
|
||||||
|
$disabled ? ' disabled': ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* NEW METHODS END
|
* NEW METHODS END
|
||||||
|
|
|
@ -95,6 +95,10 @@ class Init {
|
||||||
Settings::instance()->register_settings();
|
Settings::instance()->register_settings();
|
||||||
|
|
||||||
Settings::instance()->settings_sections['general']->add_settings_section();
|
Settings::instance()->settings_sections['general']->add_settings_section();
|
||||||
|
Settings::instance()->settings_sections['referrers_and_tooltips']->add_settings_section();
|
||||||
|
Settings::instance()->settings_sections['scope_and_priority']->add_settings_section();
|
||||||
|
Settings::instance()->settings_sections['custom_css']->add_settings_section();
|
||||||
|
|
||||||
$this->settings->add_settings_sections();
|
$this->settings->add_settings_sections();
|
||||||
$this->settings->add_settings_fields();
|
$this->settings->add_settings_fields();
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,70 +89,6 @@ class SettingsPage extends Engine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_general_settings_fields(): void {
|
|
||||||
// Options for the label element.
|
|
||||||
$label_element_options = array(
|
|
||||||
'p' => __( 'paragraph', 'footnotes' ),
|
|
||||||
'h2' => __( 'heading 2', 'footnotes' ),
|
|
||||||
'h3' => __( 'heading 3', 'footnotes' ),
|
|
||||||
'h4' => __( 'heading 4', 'footnotes' ),
|
|
||||||
'h5' => __( 'heading 5', 'footnotes' ),
|
|
||||||
'h6' => __( 'heading 6', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for the positioning of the reference container.
|
|
||||||
$positions_options = array(
|
|
||||||
'post_end' => __( 'at the end of the post', 'footnotes' ),
|
|
||||||
'widget' => __( 'in the widget area', 'footnotes' ),
|
|
||||||
'footer' => __( 'in the footer', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Basic responsive page layout options.
|
|
||||||
$page_layout_options = array(
|
|
||||||
'none' => __( 'No', 'footnotes' ),
|
|
||||||
'reference-container' => __( 'to the reference container exclusively', 'footnotes' ),
|
|
||||||
'entry-content' => __( 'to the div element starting below the post title', 'footnotes' ),
|
|
||||||
'main-content' => __( 'to the main element including the post title', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Options for the separating punctuation between backlinks.
|
|
||||||
$separators_options = array(
|
|
||||||
// Unicode character names are conventionally uppercase.
|
|
||||||
'comma' => __( 'COMMA', 'footnotes' ),
|
|
||||||
'semicolon' => __( 'SEMICOLON', 'footnotes' ),
|
|
||||||
'en_dash' => __( 'EN DASH', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Options for the terminating punctuation after backlinks.
|
|
||||||
* The Unicode name of RIGHT PARENTHESIS was originally more accurate because.
|
|
||||||
* This character is bidi-mirrored. Let's use the Unicode 1.0 name.
|
|
||||||
* The wrong names were enforced in spite of Unicode, that subsequently scrambled to correct.
|
|
||||||
*/
|
|
||||||
$terminators_options = array(
|
|
||||||
'period' => __( 'FULL STOP', 'footnotes' ),
|
|
||||||
// Unicode 1.0 name of RIGHT PARENTHESIS (represented as a left parenthesis in right-to-left scripts).
|
|
||||||
'parenthesis' => __( 'CLOSING PARENTHESIS', 'footnotes' ),
|
|
||||||
'colon' => __( 'COLON', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for the first column width (per cent is a ratio, not a unit).
|
|
||||||
$width_units_options = array(
|
|
||||||
'%' => __( 'per cent', 'footnotes' ),
|
|
||||||
'px' => __( 'pixels', 'footnotes' ),
|
|
||||||
'rem' => __( 'root em', 'footnotes' ),
|
|
||||||
'em' => __( 'em', 'footnotes' ),
|
|
||||||
'vw' => __( 'viewport width', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for reference container script mode.
|
|
||||||
$script_mode_options = array(
|
|
||||||
'jquery' => __( 'jQuery', 'footnotes' ),
|
|
||||||
'js' => __( 'plain JavaScript', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for Yes/No select box.
|
|
||||||
$enabled_options = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setting_field_callback( array $args ): void {
|
public function setting_field_callback( array $args ): void {
|
||||||
if (isset($args['type'])) {
|
if (isset($args['type'])) {
|
||||||
echo $args['description'] . '</td><td>';
|
echo $args['description'] . '</td><td>';
|
||||||
|
@ -170,6 +106,9 @@ class SettingsPage extends Engine {
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
$this->add_input_checkbox($args);
|
$this->add_input_checkbox($args);
|
||||||
return;
|
return;
|
||||||
|
case 'color':
|
||||||
|
$this->add_input_color($args);
|
||||||
|
return;
|
||||||
default: trigger_error("Unknown setting type.", E_USER_ERROR);
|
default: trigger_error("Unknown setting type.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
} else trigger_error("No setting type.", E_USER_ERROR);
|
} else trigger_error("No setting type.", E_USER_ERROR);
|
||||||
|
@ -179,742 +118,6 @@ class SettingsPage extends Engine {
|
||||||
* NEW METHODS END
|
* NEW METHODS END
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays the AMP compatibility mode option.
|
|
||||||
*
|
|
||||||
* @since 2.6.0 (release)
|
|
||||||
*/
|
|
||||||
public function amp_compat(): void {
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'settings-amp' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
// Translators: '%s' is the link text 'AMP-WP' linked to the plugin's front page on WordPress.org.
|
|
||||||
'description-1-amp' => sprintf( __( 'The official %s plugin is required when this option is enabled.', 'footnotes' ), '<a href="https://wordpress.org/plugins/amp/" target="_blank" style="font-style: normal;">AMP-WP</a>' ),
|
|
||||||
'label-amp' => $this->add_label( Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ),
|
|
||||||
'amp' => $this->add_checkbox( Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ),
|
|
||||||
'notice-amp' => __( 'This option enables hard links with configurable scroll offset in % viewport height.', 'footnotes' ),
|
|
||||||
// Translators: '%s' is the logogram of the 'Footnotes' plugin.
|
|
||||||
'description-2-amp' => sprintf( __( '%s is becoming AMP compatible when this box is checked. Styled tooltips are displayed with fade-in/fade-out effect if enabled, and the reference container expands also on clicking a referrer if it\'s collapsed by default.', 'footnotes' ), '<span style="font-style: normal;">' . Config::PLUGIN_PUBLIC_NAME . '</span>' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays all options for the footnotes start and end tag short codes.
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
public function start_end(): void {
|
|
||||||
// Footnotes start tag short code options.
|
|
||||||
$shortcode_start = array(
|
|
||||||
'((' => '((',
|
|
||||||
'(((' => '(((',
|
|
||||||
'{{' => '{{',
|
|
||||||
'{{{' => '{{{',
|
|
||||||
'[n]' => '[n]',
|
|
||||||
'[fn]' => '[fn]',
|
|
||||||
htmlspecialchars( '<fn>' ) => htmlspecialchars( '<fn>' ),
|
|
||||||
'[ref]' => '[ref]',
|
|
||||||
htmlspecialchars( '<ref>' ) => htmlspecialchars( '<ref>' ),
|
|
||||||
// Custom (user-defined) start and end tags bracketing the footnote text inline.
|
|
||||||
'userdefined' => __( 'custom short code', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Footnotes end tag short code options.
|
|
||||||
$shortcode_end = array(
|
|
||||||
'))' => '))',
|
|
||||||
')))' => ')))',
|
|
||||||
'}}' => '}}',
|
|
||||||
'}}}' => '}}}',
|
|
||||||
'[/n]' => '[/n]',
|
|
||||||
'[/fn]' => '[/fn]',
|
|
||||||
htmlspecialchars( '</fn>' ) => htmlspecialchars( '</fn>' ),
|
|
||||||
'[/ref]' => '[/ref]',
|
|
||||||
htmlspecialchars( '</ref>' ) => htmlspecialchars( '</ref>' ),
|
|
||||||
// Custom (user-defined) start and end tags bracketing the footnote text inline.
|
|
||||||
'userdefined' => __( 'custom short code', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for the syntax validation.
|
|
||||||
$enable = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'settings-start-end' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
'description-escapement' => __( 'When delimiters with pointy brackets are used, the diverging escapement schemas will be unified before footnotes are processed.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-short-code-start' => $this->add_label( Settings::FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ),
|
|
||||||
'short-code-start' => $this->add_select_box( Settings::FOOTNOTES_SHORT_CODE_START, $shortcode_start ),
|
|
||||||
'short-code-start-user' => $this->add_text_box( Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED ),
|
|
||||||
|
|
||||||
'label-short-code-end' => $this->add_label( Settings::FOOTNOTES_SHORT_CODE_END, __( 'Footnote end tag short code:', 'footnotes' ) ),
|
|
||||||
'short-code-end' => $this->add_select_box( Settings::FOOTNOTES_SHORT_CODE_END, $shortcode_end ),
|
|
||||||
'short-code-end-user' => $this->add_text_box( Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED ),
|
|
||||||
|
|
||||||
// For script showing/hiding user defined text boxes.
|
|
||||||
'short-code-start-id' => Settings::FOOTNOTES_SHORT_CODE_START,
|
|
||||||
'short-code-end-id' => Settings::FOOTNOTES_SHORT_CODE_END,
|
|
||||||
'short-code-start-user-id' => Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED,
|
|
||||||
'short-code-end-user-id' => Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
|
|
||||||
|
|
||||||
'description-parentheses' => __( 'WARNING: Although widespread industry standard, the double parentheses are problematic because they may occur in scripts embedded in the content and be mistaken as a short code.', 'footnotes' ),
|
|
||||||
|
|
||||||
// Option to enable syntax validation, label mirrored in task.php.
|
|
||||||
'label-syntax' => $this->add_label( Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __( 'Check for balanced shortcodes:', 'footnotes' ) ),
|
|
||||||
'syntax' => $this->add_select_box( Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $enable ),
|
|
||||||
'notice-syntax' => __( 'In the presence of a lone start tag shortcode, a warning displays below the post title.', 'footnotes' ),
|
|
||||||
|
|
||||||
'description-syntax' => __( 'If the start tag short code is \'((\' or \'(((\', it will not be reported as unbalanced if the following string contains braces hinting that it is a script.', 'footnotes' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays all options for the footnotes numbering.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function numbering(): void {
|
|
||||||
// Define some space for the output.
|
|
||||||
$space = ' ';
|
|
||||||
// Options for the combination of identical footnotes.
|
|
||||||
$enable = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for the numbering style of the footnotes.
|
|
||||||
$counter_style = array(
|
|
||||||
'arabic_plain' => __( 'plain Arabic numbers', 'footnotes' ) . $space . '1, 2, 3, 4, 5, …',
|
|
||||||
'arabic_leading' => __( 'zero-padded Arabic numbers', 'footnotes' ) . $space . '01, 02, 03, 04, 05, …',
|
|
||||||
'latin_low' => __( 'lowercase Latin letters', 'footnotes' ) . $space . 'a, b, c, d, e, …',
|
|
||||||
'latin_high' => __( 'uppercase Latin letters', 'footnotes' ) . $space . 'A, B, C, D, E, …',
|
|
||||||
'romanic' => __( 'uppercase Roman numerals', 'footnotes' ) . $space . 'I, II, III, IV, V, …',
|
|
||||||
'roman_low' => __( 'lowercase Roman numerals', 'footnotes' ) . $space . 'i, ii, iii, iv, v, …',
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'settings-numbering' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
'label-counter-style' => $this->add_label( Settings::FOOTNOTES_COUNTER_STYLE, __( 'Numbering style:', 'footnotes' ) ),
|
|
||||||
'counter-style' => $this->add_select_box( Settings::FOOTNOTES_COUNTER_STYLE, $counter_style ),
|
|
||||||
|
|
||||||
// Algorithmically combine identicals.
|
|
||||||
'label-identical' => $this->add_label( COMBINE_IDENTICAL_FOOTNOTES, __( 'Combine identical footnotes:', 'footnotes' ) ),
|
|
||||||
'identical' => $this->add_select_box( COMBINE_IDENTICAL_FOOTNOTES, $enable ),
|
|
||||||
'notice-identical' => __( 'This option may require copy-pasting footnotes in multiple instances.', 'footnotes' ),
|
|
||||||
// Support for Ibid. notation added thanks to @meglio in <https://wordpress.org/support/topic/add-support-for-ibid-notation/>.
|
|
||||||
'description-identical' => __( 'Even when footnotes are combined, footnote numbers keep incrementing. This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system. The Ibid. notation and the op. cit. abbreviation followed by the current page number avoid repeating the footnote content. For changing sources, shortened citations may be used. Repeating full citations is also an opportunity to add details.', 'footnotes' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays all options for the scrolling behavior.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function scrolling(): void {
|
|
||||||
|
|
||||||
// Options for enabling scroll duration asymmetricity.
|
|
||||||
$enable = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'settings-scrolling' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-scroll-css' => $this->add_label( Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ),
|
|
||||||
'scroll-css' => $this->add_select_box( Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING, $enable ),
|
|
||||||
'notice-scroll-css' => __( 'May slightly disturb jQuery scrolling and is therefore disabled by default. Works in recent browsers.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-scroll-offset' => $this->add_label( Settings::FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ),
|
|
||||||
'scroll-offset' => $this->add_num_box( Settings::FOOTNOTES_SCROLL_OFFSET, 0, 100 ),
|
|
||||||
'notice-scroll-offset' => __( 'per cent viewport height from the upper edge', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-scroll-duration' => $this->add_label( Settings::FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ),
|
|
||||||
'scroll-duration' => $this->add_num_box( Settings::FOOTNOTES_SCROLL_DURATION, 0, 20000 ),
|
|
||||||
'notice-scroll-duration' => __( 'milliseconds. If asymmetric scroll durations are enabled, this is the scroll-up duration.', 'footnotes' ),
|
|
||||||
|
|
||||||
// Enable scroll duration asymmetricity.
|
|
||||||
'label-scroll-asymmetricity' => $this->add_label( Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ),
|
|
||||||
'scroll-asymmetricity' => $this->add_select_box( Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $enable ),
|
|
||||||
'notice-scroll-asymmetricity' => __( 'With this option enabled, scrolling up may take longer than down, or conversely.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-scroll-down-duration' => $this->add_label( Settings::FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ),
|
|
||||||
'scroll-down-duration' => $this->add_num_box( Settings::FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ),
|
|
||||||
'notice-scroll-down-duration' => __( 'milliseconds', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-scroll-down-delay' => $this->add_label( Settings::FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ),
|
|
||||||
'scroll-down-delay' => $this->add_num_box( Settings::FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ),
|
|
||||||
'notice-scroll-down-delay' => __( 'milliseconds. Useful to see the effect on input elements when referrers without hard links are clicked in form labels.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-scroll-up-delay' => $this->add_label( Settings::FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ),
|
|
||||||
'scroll-up-delay' => $this->add_num_box( Settings::FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ),
|
|
||||||
'notice-scroll-up-delay' => __( 'milliseconds. Less useful than the scroll-down delay.', 'footnotes' ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays all options for the fragment identifier configuration.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function hard_links(): void {
|
|
||||||
|
|
||||||
// Options for enabling hard links for AMP compat.
|
|
||||||
$enable = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'settings-hard-links' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-hard-links' => $this->add_label( Settings::FOOTNOTES_HARD_LINKS_ENABLE, __( 'Enable hard links:', 'footnotes' ) ),
|
|
||||||
'hard-links' => $this->add_select_box( Settings::FOOTNOTES_HARD_LINKS_ENABLE, $enable ),
|
|
||||||
'notice-hard-links' => __( 'Hard links disable jQuery delays but have the same scroll offset, and allow to share footnotes (accessed if the list is not collapsed by default).', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-footnote' => $this->add_label( Settings::FOOTNOTE_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnotes:', 'footnotes' ) ),
|
|
||||||
'footnote' => $this->add_text_box( Settings::FOOTNOTE_FRAGMENT_ID_SLUG ),
|
|
||||||
'notice-footnote' => __( 'This will show up in the address bar after clicking on a hard-linked footnote referrer.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-referrer' => $this->add_label( Settings::REFERRER_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnote referrers:', 'footnotes' ) ),
|
|
||||||
'referrer' => $this->add_text_box( Settings::REFERRER_FRAGMENT_ID_SLUG ),
|
|
||||||
'notice-referrer' => __( 'This will show up in the address bar after clicking on a hard-linked backlink.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-separator' => $this->add_label( Settings::HARD_LINK_IDS_SEPARATOR, __( 'ID separator:', 'footnotes' ) ),
|
|
||||||
'separator' => $this->add_text_box( Settings::HARD_LINK_IDS_SEPARATOR ),
|
|
||||||
'notice-separator' => __( 'May be empty or any string, for example _, - or +, to distinguish post number, container number and footnote number.', 'footnotes' ),
|
|
||||||
|
|
||||||
// Enable backlink tooltips.
|
|
||||||
'label-backlink-tooltips' => $this->add_label( Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ),
|
|
||||||
'backlink-tooltips' => $this->add_select_box( Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $enable ),
|
|
||||||
'notice-backlink-tooltips' => __( 'Hard backlinks get ordinary tooltips hinting to use the backbutton instead to keep it usable.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-backlink-tooltip-text' => $this->add_label( Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ),
|
|
||||||
'backlink-tooltip-text' => $this->add_text_box( Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT ),
|
|
||||||
'notice-backlink-tooltip-text' => __( 'Default text is the keyboard shortcut; may be a localized descriptive hint.', 'footnotes' ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays all settings for ‘I love Footnotes’ note.
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
public function love(): void {
|
|
||||||
// Options for the acknowledgment display in the footer.
|
|
||||||
$love = array(
|
|
||||||
// Logo only.
|
|
||||||
'text-3' => Config::PLUGIN_PUBLIC_NAME,
|
|
||||||
// Logo followed by heart symbol.
|
|
||||||
'text-4' => sprintf( '%s %s', Config::PLUGIN_PUBLIC_NAME, Config::LOVE_SYMBOL ),
|
|
||||||
// Logo preceded by heart symbol.
|
|
||||||
'text-5' => sprintf( '%s %s', Config::LOVE_SYMBOL, Config::PLUGIN_PUBLIC_NAME ),
|
|
||||||
// Translators: 2: heart symbol 1: footnotes logogram.
|
|
||||||
'text-1' => sprintf( __( 'I %2$s %1$s', 'footnotes' ), Config::PLUGIN_PUBLIC_NAME, Config::LOVE_SYMBOL ),
|
|
||||||
// Translators: %s: Footnotes plugin logo.
|
|
||||||
'text-6' => sprintf( __( 'This website uses %s.', 'footnotes' ), Config::PLUGIN_PUBLIC_NAME ),
|
|
||||||
// Translators: %s: Footnotes plugin logo.
|
|
||||||
'text-7' => sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), Config::PLUGIN_PUBLIC_NAME ),
|
|
||||||
// Translators: %s: Footnotes plugin logo.
|
|
||||||
'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), Config::PLUGIN_PUBLIC_NAME ),
|
|
||||||
'random' => __( 'randomly determined display of either mention', 'footnotes' ),
|
|
||||||
// Translators: 1: Plugin logo.2: heart symbol.
|
|
||||||
'no' => sprintf( __( 'no display of any "%1$s %2$s" mention in the footer', 'footnotes' ), Config::PLUGIN_PUBLIC_NAME, Config::LOVE_SYMBOL ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'settings-love' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
// Translators: %s: Footnotes plugin logo.
|
|
||||||
'label-love' => $this->add_label( Settings::FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), Config::PLUGIN_PUBLIC_NAME ) ),
|
|
||||||
'love' => $this->add_select_box( Settings::FOOTNOTES_LOVE, $love ),
|
|
||||||
// Translators: %s: Footnotes plugin logo.
|
|
||||||
'label-no-love' => $this->add_text( sprintf( __( 'Shortcode to inhibit the display of the %s mention on specific pages:', 'footnotes' ), Config::PLUGIN_PUBLIC_NAME ) ),
|
|
||||||
'no-love' => $this->add_text( Config::NO_LOVE_SLUG ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays the footnotes in excerpt setting.
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
public function excerpts(): void {
|
|
||||||
// Options for options select box.
|
|
||||||
$excerpt_mode = array(
|
|
||||||
'yes' => __( 'Yes, generate excerpts from posts with effectively processed footnotes and other markup', 'footnotes' ),
|
|
||||||
'no' => __( 'No, generate excerpts from posts but remove all footnotes and output plain text', 'footnotes' ),
|
|
||||||
'manual' => __( 'Yes but run the process only to display tooltips in manual excerpts with footnote short codes', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'settings-excerpts' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
'label-excerpts' => $this->add_label( Settings::FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ),
|
|
||||||
'excerpts' => $this->add_select_box( Settings::FOOTNOTES_IN_EXCERPT, $excerpt_mode ),
|
|
||||||
'notice-excerpts' => __( 'If the_excerpt is enabled.', 'footnotes' ),
|
|
||||||
// Translators: %s: link text 'Advanced Excerpt' linked to the plugin\'s WordPress.org front page.
|
|
||||||
// Translators: %s: Footnotes plugin logo.
|
|
||||||
'description-excerpts' => sprintf( __( 'To not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to be able to remove the footnotes. Else, footnotes may be processed in manual excerpts OR processed based on the posts. — For this setting to be effective, the hook the_excerpt must be enabled under Scope and priority.', 'footnotes' ), '<span style="font-style: normal;">' . Config::PLUGIN_PUBLIC_NAME . '</span>' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays all settings for the footnote referrers.
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
public function superscript(): void {
|
|
||||||
// Options for Yes/No select box.
|
|
||||||
$enabled = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for superscript normalize scope.
|
|
||||||
$normalize_superscript = array(
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
'referrers' => __( 'Footnote referrers', 'footnotes' ),
|
|
||||||
'all' => __( 'All superscript elements', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'customize-superscript' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
'label-superscript' => $this->add_label( Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __( 'Display footnote referrers in superscript:', 'footnotes' ) ),
|
|
||||||
'superscript' => $this->add_select_box( Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $enabled ),
|
|
||||||
|
|
||||||
'label-normalize' => $this->add_label( Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ),
|
|
||||||
'normalize' => $this->add_select_box( Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $normalize_superscript ),
|
|
||||||
'notice-normalize' => __( 'Most themes don\'t need this fix.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-before' => $this->add_label( Settings::FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ),
|
|
||||||
'before' => $this->add_text_box( Settings::FOOTNOTES_STYLING_BEFORE ),
|
|
||||||
|
|
||||||
'label-after' => $this->add_label( Settings::FOOTNOTES_STYLING_AFTER, __( 'At the end of the footnote referrers:', 'footnotes' ) ),
|
|
||||||
'after' => $this->add_text_box( Settings::FOOTNOTES_STYLING_AFTER ),
|
|
||||||
|
|
||||||
'label-link' => $this->add_label( Settings::LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ),
|
|
||||||
'notice-link' => __( 'Please find this setting at the end of the reference container settings. The link element is needed to apply the theme\'s link color.', 'footnotes' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays the setting for the input label issue solution.
|
|
||||||
*
|
|
||||||
* @since 2.5.12
|
|
||||||
*/
|
|
||||||
public function label_solution(): void {
|
|
||||||
// Options for the input label issue solution.
|
|
||||||
$issue_solutions = array(
|
|
||||||
'none' => __( '0. No problem or solved otherwise', 'footnotes' ),
|
|
||||||
'move' => __( 'A. Footnotes are moved out and appended after the label\'s end (recommended)', 'footnotes' ),
|
|
||||||
'disconnect' => __( 'B. Labels with footnotes are disconnected from input element (discouraged)', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'configure-label-solution' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
'description-1-selection' => __( 'Clicking a footnote referrer in an input element label toggles the input except when hard links are enabled. In jQuery mode, the recommended solution is to move footnotes and append them after the label (option A).', 'footnotes' ),
|
|
||||||
'label-selection' => $this->add_label( Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ),
|
|
||||||
'selection' => $this->add_select_box( Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION, $issue_solutions ),
|
|
||||||
'description-2-selection' => __( 'Option B is discouraged because disconnecting a label from its input element may compromise accessibility. This option is a last resort in case footnotes must absolutely stay inside the label. (Using jQuery \'event.stopPropagation\' failed.)', 'footnotes' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays enabled status for the footnotes mouse-over box.
|
|
||||||
*
|
|
||||||
* @since 1.5.2
|
|
||||||
*/
|
|
||||||
public function mouseover_box(): void {
|
|
||||||
// Options for Yes/No select box.
|
|
||||||
$enabled = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'mouse-over-box-display' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-enable' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __( 'Display tooltips:', 'footnotes' ) ),
|
|
||||||
'enable' => $this->add_select_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $enabled ),
|
|
||||||
'notice-enable' => __( 'Formatted text boxes allowing hyperlinks, displayed on mouse-over or tap and hold.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-alternative' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __( 'Display alternative tooltips:', 'footnotes' ) ),
|
|
||||||
'alternative' => $this->add_select_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $enabled ),
|
|
||||||
'notice-alternative' => __( 'Intended to work around a configuration-related tooltip outage.', 'footnotes' ),
|
|
||||||
// Translators: %s: Footnotes plugin logo.
|
|
||||||
'description-alternative' => sprintf( __( 'These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes\' internal stylesheet. When this option is enabled, %s does not load jQuery UI nor jQuery Tools.', 'footnotes' ), '<span style="font-style: normal;">' . Config::PLUGIN_PUBLIC_NAME . '</span>' ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays position settings for the footnotes mouse-over box.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function mouseover_box_position(): void {
|
|
||||||
|
|
||||||
// Options for the Mouse-over box position.
|
|
||||||
$position = array(
|
|
||||||
'top left' => __( 'top left', 'footnotes' ),
|
|
||||||
'top center' => __( 'top center', 'footnotes' ),
|
|
||||||
'top right' => __( 'top right', 'footnotes' ),
|
|
||||||
'center right' => __( 'center right', 'footnotes' ),
|
|
||||||
'bottom right' => __( 'bottom right', 'footnotes' ),
|
|
||||||
'bottom center' => __( 'bottom center', 'footnotes' ),
|
|
||||||
'bottom left' => __( 'bottom left', 'footnotes' ),
|
|
||||||
'center left' => __( 'center left', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for the alternative Mouse-over box position.
|
|
||||||
$alternative_position = array(
|
|
||||||
'top left' => __( 'top left', 'footnotes' ),
|
|
||||||
'top right' => __( 'top right', 'footnotes' ),
|
|
||||||
'bottom right' => __( 'bottom right', 'footnotes' ),
|
|
||||||
'bottom left' => __( 'bottom left', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'mouse-over-box-position' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-position' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION, __( 'Position:', 'footnotes' ) ),
|
|
||||||
'position' => $this->add_select_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION, $position ),
|
|
||||||
'position-alternative' => $this->add_select_box( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $alternative_position ),
|
|
||||||
'notice-position' => __( 'The second column of settings boxes is for the alternative tooltips.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-offset-x' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __( 'Horizontal offset:', 'footnotes' ) ),
|
|
||||||
'offset-x' => $this->add_num_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ),
|
|
||||||
'offset-x-alternative' => $this->add_num_box( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ),
|
|
||||||
'notice-offset-x' => __( 'pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-offset-y' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __( 'Vertical offset:', 'footnotes' ) ),
|
|
||||||
'offset-y' => $this->add_num_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ),
|
|
||||||
'offset-y-alternative' => $this->add_num_box( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ),
|
|
||||||
'notice-offset-y' => __( 'pixels; negative value for an upwards offset; alternative tooltips: direction depends on position', 'footnotes' ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays dimensions setting for the footnotes mouse-over box.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function mouseover_box_dimensions(): void {
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'mouse-over-box-dimensions' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-max-width' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __( 'Maximum width:', 'footnotes' ) ),
|
|
||||||
'max-width' => $this->add_num_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280 ),
|
|
||||||
'width' => $this->add_num_box( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280 ),
|
|
||||||
'notice-max-width' => __( 'pixels; set to 0 for jQuery tooltips without max width; alternative tooltips are given the value in the second box as fixed width.', 'footnotes' ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays timing settings for the footnotes mouse-over box.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function mouseover_box_timing(): void {
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'mouse-over-box-timing' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-fade-in-delay' => $this->add_label( Settings::MOUSE_OVER_BOX_FADE_IN_DELAY, __( 'Fade-in delay:', 'footnotes' ) ),
|
|
||||||
'fade-in-delay' => $this->add_num_box( Settings::MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000 ),
|
|
||||||
'notice-fade-in-delay' => __( 'milliseconds', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-fade-in-duration' => $this->add_label( Settings::MOUSE_OVER_BOX_FADE_IN_DURATION, __( 'Fade-in duration:', 'footnotes' ) ),
|
|
||||||
'fade-in-duration' => $this->add_num_box( Settings::MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000 ),
|
|
||||||
'notice-fade-in-duration' => __( 'milliseconds', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-fade-out-delay' => $this->add_label( Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY, __( 'Fade-out delay:', 'footnotes' ) ),
|
|
||||||
'fade-out-delay' => $this->add_num_box( Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000 ),
|
|
||||||
'notice-fade-out-delay' => __( 'milliseconds', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-fade-out-duration' => $this->add_label( Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION, __( 'Fade-out duration:', 'footnotes' ) ),
|
|
||||||
'fade-out-duration' => $this->add_num_box( Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000 ),
|
|
||||||
'notice-fade-out-duration' => __( 'milliseconds', 'footnotes' ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays truncation settings for the footnotes mouse-over box.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function mouseover_box_truncation(): void {
|
|
||||||
// Options for Yes/No select box.
|
|
||||||
$enabled = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'mouse-over-box-truncation' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-truncation' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __( 'Truncate the note in the tooltip:', 'footnotes' ) ),
|
|
||||||
'truncation' => $this->add_select_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $enabled ),
|
|
||||||
|
|
||||||
'label-max-length' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __( 'Maximum number of characters in the tooltip:', 'footnotes' ) ),
|
|
||||||
'max-length' => $this->add_num_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000 ),
|
|
||||||
// The feature trims back until the last full word.
|
|
||||||
'notice-max-length' => __( 'No weird cuts.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-readon' => $this->add_label( Settings::FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ),
|
|
||||||
'readon' => $this->add_text_box( Settings::FOOTNOTES_TOOLTIP_READON_LABEL ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays dedicated tooltip text settings for the footnotes mouse-over box.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function mouseover_box_text(): void {
|
|
||||||
// Options for Yes/No select box.
|
|
||||||
$enabled = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'mouse-over-box-text' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'description-delimiter' => __( 'Tooltips can display another content than the footnote entry in the reference container. The trigger is a shortcode in the footnote text separating the tooltip text from the note. That is consistent with what WordPress does for excerpts.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-delimiter' => $this->add_label( Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __( 'Delimiter for dedicated tooltip text:', 'footnotes' ) ),
|
|
||||||
'delimiter' => $this->add_text_box( Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ),
|
|
||||||
'notice-delimiter' => __( 'If the delimiter shortcode is present, the tooltip text will be the part before it.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-mirror' => $this->add_label( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __( 'Mirror the tooltip in the reference container:', 'footnotes' ) ),
|
|
||||||
'mirror' => $this->add_select_box( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $enabled ),
|
|
||||||
'notice-mirror' => __( 'Tooltips may be harder to use on mobiles. This option allows to read it in the reference container.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-separator' => $this->add_label( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __( 'Separator between tooltip text and footnote text:', 'footnotes' ) ),
|
|
||||||
'separator' => $this->add_text_box( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ),
|
|
||||||
'notice-separator' => __( 'May be a simple space, or a line break <br />, or any string in your language.', 'footnotes' ),
|
|
||||||
|
|
||||||
'description-mirror' => __( 'Tooltips, even jQuery-driven, may be hard to consult on mobiles. This option allows to read the tooltip content in the reference container too.', 'footnotes' ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays style settings for the footnotes mouse-over box.
|
|
||||||
*
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public function mouseover_box_appearance(): void {
|
|
||||||
// Options for Yes/No select box.
|
|
||||||
$enabled = array(
|
|
||||||
'yes' => __( 'Yes', 'footnotes' ),
|
|
||||||
'no' => __( 'No', 'footnotes' ),
|
|
||||||
);
|
|
||||||
// Options for the font size unit.
|
|
||||||
$font_size_units = array(
|
|
||||||
'em' => __( 'em', 'footnotes' ),
|
|
||||||
'rem' => __( 'rem', 'footnotes' ),
|
|
||||||
'px' => __( 'pixels', 'footnotes' ),
|
|
||||||
'pt' => __( 'points', 'footnotes' ),
|
|
||||||
'pc' => __( 'picas', 'footnotes' ),
|
|
||||||
'mm' => __( 'millimeters', 'footnotes' ),
|
|
||||||
'%' => __( 'per cent', 'footnotes' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'mouse-over-box-appearance' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
|
|
||||||
'label-font-size' => $this->add_label( Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __( 'Set font size:', 'footnotes' ) ),
|
|
||||||
'font-size-enable' => $this->add_select_box( Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $enabled ),
|
|
||||||
'font-size-scalar' => $this->add_num_box( Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true ),
|
|
||||||
'font-size-unit' => $this->add_select_box( Settings::MOUSE_OVER_BOX_FONT_SIZE_UNIT, $font_size_units ),
|
|
||||||
'notice-font-size' => __( 'By default, the font size is set to equal the surrounding text.', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-color' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ),
|
|
||||||
'color' => $this->add_color_selection( Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR ),
|
|
||||||
// Translators: %s: Clear or leave empty.
|
|
||||||
'notice-color' => sprintf( __( 'To use the current theme\'s default text color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
|
|
||||||
|
|
||||||
'label-background' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ),
|
|
||||||
'background' => $this->add_color_selection( Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ),
|
|
||||||
// Translators: %s: Clear or leave empty.
|
|
||||||
'notice-background' => sprintf( __( 'To use the current theme\'s default background color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
|
|
||||||
|
|
||||||
'label-border-width' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ),
|
|
||||||
'border-width' => $this->add_num_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ),
|
|
||||||
'notice-border-width' => __( 'pixels; 0 for borderless', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-border-color' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ),
|
|
||||||
'border-color' => $this->add_color_selection( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ),
|
|
||||||
// Translators: %s: Clear or leave empty.
|
|
||||||
'notice-border-color' => sprintf( __( 'To use the current theme\'s default border color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
|
|
||||||
|
|
||||||
'label-border-radius' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ),
|
|
||||||
'border-radius' => $this->add_num_box( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500 ),
|
|
||||||
'notice-border-radius' => __( 'pixels; 0 for sharp corners', 'footnotes' ),
|
|
||||||
|
|
||||||
'label-box-shadow-color' => $this->add_label( Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ),
|
|
||||||
'box-shadow-color' => $this->add_color_selection( Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ),
|
|
||||||
// Translators: %s: Clear or leave empty.
|
|
||||||
'notice-box-shadow-color' => sprintf( __( 'To use the current theme\'s default box shadow color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays all settings for the backlink symbol.
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
public function hyperlink_arrow(): void {
|
|
||||||
// Load template file.
|
|
||||||
$template = new Template( Template::DASHBOARD, 'customize-hyperlink-arrow' );
|
|
||||||
// Replace all placeholders.
|
|
||||||
$template->replace(
|
|
||||||
array(
|
|
||||||
'label-symbol' => $this->add_label( Settings::HYPERLINK_ARROW, __( 'Select or input the backlink symbol:', 'footnotes' ) ),
|
|
||||||
'symbol-options' => $this->add_select_box( Settings::HYPERLINK_ARROW, Convert::get_arrow() ),
|
|
||||||
'symbol-custom' => $this->add_text_box( Settings::HYPERLINK_ARROW_USER_DEFINED ),
|
|
||||||
'notice-symbol' => __( 'Your input overrides the selection.', 'footnotes' ),
|
|
||||||
'description-symbol' => __( 'This symbol is used in the reference container. But this setting pre-existed under this tab and cannot be moved to another one.', 'footnotes' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Display template with replaced placeholders.
|
|
||||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $template->get_content();
|
|
||||||
// phpcs:enable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the Custom CSS box.
|
* Displays the Custom CSS box.
|
||||||
*
|
*
|
||||||
|
@ -1218,7 +421,6 @@ class SettingsPage extends Engine {
|
||||||
$meta_boxes = array();
|
$meta_boxes = array();
|
||||||
|
|
||||||
$meta_boxes[] = $this->add_meta_box( 'settings', 'amp-compat', __( 'AMP compatibility', 'footnotes' ), 'amp_compat' );
|
$meta_boxes[] = $this->add_meta_box( 'settings', 'amp-compat', __( 'AMP compatibility', 'footnotes' ), 'amp_compat' );
|
||||||
$meta_boxes[] = $this->add_meta_box( 'settings', 'start-end', __( 'Footnote start and end short codes', 'footnotes' ), 'start_end' );
|
|
||||||
$meta_boxes[] = $this->add_meta_box( 'settings', 'numbering', __( 'Footnotes numbering', 'footnotes' ), 'numbering' );
|
$meta_boxes[] = $this->add_meta_box( 'settings', 'numbering', __( 'Footnotes numbering', 'footnotes' ), 'numbering' );
|
||||||
$meta_boxes[] = $this->add_meta_box( 'settings', 'scrolling', __( 'Scrolling behavior', 'footnotes' ), 'scrolling' );
|
$meta_boxes[] = $this->add_meta_box( 'settings', 'scrolling', __( 'Scrolling behavior', 'footnotes' ), 'scrolling' );
|
||||||
$meta_boxes[] = $this->add_meta_box( 'settings', 'hard-links', __( 'URL fragment ID configuration', 'footnotes' ), 'hard_links' );
|
$meta_boxes[] = $this->add_meta_box( 'settings', 'hard-links', __( 'URL fragment ID configuration', 'footnotes' ), 'hard_links' );
|
||||||
|
@ -1226,7 +428,6 @@ class SettingsPage extends Engine {
|
||||||
$meta_boxes[] = $this->add_meta_box( 'settings', 'excerpts', __( 'Footnotes in excerpts', 'footnotes' ), 'excerpts' );
|
$meta_boxes[] = $this->add_meta_box( 'settings', 'excerpts', __( 'Footnotes in excerpts', 'footnotes' ), 'excerpts' );
|
||||||
$meta_boxes[] = $this->add_meta_box( 'settings', 'love', Config::PLUGIN_HEADING_NAME . ' ' . Config::LOVE_SYMBOL_HEADING, 'love' );
|
$meta_boxes[] = $this->add_meta_box( 'settings', 'love', Config::PLUGIN_HEADING_NAME . ' ' . Config::LOVE_SYMBOL_HEADING, 'love' );
|
||||||
|
|
||||||
$meta_boxes[] = $this->add_meta_box( 'customize', 'hyperlink-arrow', __( 'Backlink symbol', 'footnotes' ), 'hyperlink_arrow' );
|
|
||||||
$meta_boxes[] = $this->add_meta_box( 'customize', 'superscript', __( 'Referrers', 'footnotes' ), 'superscript' );
|
$meta_boxes[] = $this->add_meta_box( 'customize', 'superscript', __( 'Referrers', 'footnotes' ), 'superscript' );
|
||||||
$meta_boxes[] = $this->add_meta_box( 'customize', 'label-solution', __( 'Referrers in labels', 'footnotes' ), 'label_solution' );
|
$meta_boxes[] = $this->add_meta_box( 'customize', 'label-solution', __( 'Referrers in labels', 'footnotes' ), 'label_solution' );
|
||||||
$meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box', __( 'Tooltips', 'footnotes' ), 'mouseover_box' );
|
$meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box', __( 'Tooltips', 'footnotes' ), 'mouseover_box' );
|
||||||
|
|
|
@ -114,8 +114,9 @@ class Core {
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*/
|
*/
|
||||||
public function get_plugin_name(): string {
|
public function get_plugin_name(bool $html = false): string {
|
||||||
return $this->plugin_name;
|
if ( ! $html ) return $this->plugin_name;
|
||||||
|
else return '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,7 @@ use footnotes\includes\settings\customcss\CustomCSSSettingsSection;
|
||||||
* @package footnotes
|
* @package footnotes
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 2.8.0 Renamed class from `Footnotes_Settings` to `Settings`.
|
* @since 2.8.0 Renamed class from `Footnotes_Settings` to `Settings`.
|
||||||
* Moved under `footnotes\includes` namespace.
|
* Moved under `footnotes\includes` namespace.
|
||||||
*/
|
*/
|
||||||
class Settings {
|
class Settings {
|
||||||
/**
|
/**
|
||||||
|
@ -51,73 +51,6 @@ class Settings {
|
||||||
'vw' => 'viewport width',
|
'vw' => 'viewport width',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the counter style of the footnotes.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_COUNTER_STYLE = 'footnote_inputfield_counter_style';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the backlink symbol selection.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const HYPERLINK_ARROW = 'footnote_inputfield_custom_hyperlink_symbol';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the user-defined backlink symbol.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const HYPERLINK_ARROW_USER_DEFINED = 'footnote_inputfield_custom_hyperlink_symbol_user';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to look for footnotes in post excerpts.
|
|
||||||
*
|
|
||||||
* @see EXPERT_LOOKUP_THE_EXCERPT
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
* @since 2.6.3 Enabled by default.
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_IN_EXCERPT = 'footnote_inputfield_search_in_excerpt';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 string
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_STYLING_BEFORE = 'footnote_inputfield_custom_styling_before';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the string after the footnote referrer.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_STYLING_AFTER = 'footnote_inputfield_custom_styling_after';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings container key for the Custom CSS.
|
* Settings container key for the Custom CSS.
|
||||||
*
|
*
|
||||||
|
@ -127,53 +60,7 @@ class Settings {
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
||||||
*/
|
*/
|
||||||
const CUSTOM_CSS = 'footnote_inputfield_custom_css';
|
const CUSTOM_CSS = 'footnote_inputfield_custom_css';
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the ‘I love footnotes’ text.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_LOVE = 'footnote_inputfield_love';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to enable the mouse-over box.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.2
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_ENABLED = 'footnote_inputfield_custom_mouse_over_box_enabled';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to enable tooltip truncation.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.4
|
|
||||||
* @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.
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED = 'footnote_inputfield_custom_mouse_over_box_excerpt_enabled';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the max. length of
|
|
||||||
* the enabled excerpt.
|
|
||||||
*
|
|
||||||
* The default truncation length is 200 chars.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 1.5.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH = 'footnote_inputfield_custom_mouse_over_box_excerpt_length';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings container key to enable the `the_title` hook.
|
* Settings container key to enable the `the_title` hook.
|
||||||
*
|
*
|
||||||
|
@ -243,65 +130,6 @@ class Settings {
|
||||||
*/
|
*/
|
||||||
const EXPERT_LOOKUP_WIDGET_TEXT = 'footnote_inputfield_expert_lookup_widget_text';
|
const EXPERT_LOOKUP_WIDGET_TEXT = 'footnote_inputfield_expert_lookup_widget_text';
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the color.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @see FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND
|
|
||||||
*
|
|
||||||
* @since 1.5.6
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_COLOR = 'footnote_inputfield_custom_mouse_over_box_color';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the background color.
|
|
||||||
*
|
|
||||||
* 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 string
|
|
||||||
*
|
|
||||||
* @see FOOTNOTES_MOUSE_OVER_BOX_COLOR
|
|
||||||
*
|
|
||||||
* @since 1.5.6
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND = 'footnote_inputfield_custom_mouse_over_box_background';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the border width.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 1.5.6
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH = 'footnote_inputfield_custom_mouse_over_box_border_width';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the border color.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.6
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR = 'footnote_inputfield_custom_mouse_over_box_border_color';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the border radius.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 1.5.6
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS = 'footnote_inputfield_custom_mouse_over_box_border_radius';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings container key for the mouse-over box to define the max. width.
|
* Settings container key for the mouse-over box to define the max. width.
|
||||||
*
|
*
|
||||||
|
@ -316,88 +144,6 @@ class Settings {
|
||||||
*/
|
*/
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH = 'footnote_inputfield_custom_mouse_over_box_max_width';
|
const FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH = 'footnote_inputfield_custom_mouse_over_box_max_width';
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the position.
|
|
||||||
*
|
|
||||||
* 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 string
|
|
||||||
*
|
|
||||||
* @since 1.5.7
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_POSITION = 'footnote_inputfield_custom_mouse_over_box_position';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the _x_-offset.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 1.5.7
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X = 'footnote_inputfield_custom_mouse_over_box_offset_x';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the _y_-offset.
|
|
||||||
*
|
|
||||||
* The vertical offset must be negative for the box not to cover the current
|
|
||||||
* line of text.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 1.5.7
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y = 'footnote_inputfield_custom_mouse_over_box_offset_y';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the mouse-over box to define the box-shadow color.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 1.5.8
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR = 'footnote_inputfield_custom_mouse_over_box_shadow_color';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the label of the Read-on button in truncated tooltips.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.1.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_TOOLTIP_READON_LABEL = 'footnote_inputfield_readon_label';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 string
|
|
||||||
*
|
|
||||||
* @since 2.1.1
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE = 'footnote_inputfield_custom_mouse_over_box_alternative';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the referrer element.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.1.1
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS = 'footnotes_inputfield_referrer_superscript_tags';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings container key to get the backlink symbol switch side.
|
* Settings container key to get the backlink symbol switch side.
|
||||||
*
|
*
|
||||||
|
@ -473,80 +219,6 @@ class Settings {
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
||||||
*/
|
*/
|
||||||
const EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_excerpt_priority_level';
|
const EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL = 'footnote_inputfield_expert_lookup_the_excerpt_priority_level';
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to enable setting the tooltip font size.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.1.4
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const MOUSE_OVER_BOX_FONT_SIZE_ENABLED = 'footnotes_inputfield_mouse_over_box_font_size_enabled';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the scalar value of the tooltip font size.
|
|
||||||
*
|
|
||||||
* @var float
|
|
||||||
*
|
|
||||||
* @since 2.1.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const MOUSE_OVER_BOX_FONT_SIZE_SCALAR = 'footnotes_inputfield_mouse_over_box_font_size_scalar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the unit of the tooltip font size.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.1.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const MOUSE_OVER_BOX_FONT_SIZE_UNIT = 'footnotes_inputfield_mouse_over_box_font_size_unit';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for tooltip display fade-in delay.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 2.1.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const MOUSE_OVER_BOX_FADE_IN_DELAY = 'footnotes_inputfield_mouse_over_box_fade_in_delay';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for tooltip display fade-in duration.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 2.1.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const MOUSE_OVER_BOX_FADE_IN_DURATION = 'footnotes_inputfield_mouse_over_box_fade_in_duration';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for tooltip display fade-out delay.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 2.1.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const MOUSE_OVER_BOX_FADE_OUT_DELAY = 'footnotes_inputfield_mouse_over_box_fade_out_delay';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for tooltip display fade-out duration.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 2.1.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const MOUSE_OVER_BOX_FADE_OUT_DURATION = 'footnotes_inputfield_mouse_over_box_fade_out_duration';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings container key for reference container position shortcode.
|
* Settings container key for reference container position shortcode.
|
||||||
|
@ -584,201 +256,6 @@ class Settings {
|
||||||
*/
|
*/
|
||||||
const CUSTOM_CSS_LEGACY_ENABLE = 'footnote_inputfield_custom_css_legacy_enable';
|
const CUSTOM_CSS_LEGACY_ENABLE = 'footnote_inputfield_custom_css_legacy_enable';
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for alternative tooltip position.
|
|
||||||
*
|
|
||||||
* Fixed-width is for alternative tooltips, cannot reuse `max-width` nor offsets.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.2.5
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION = 'footnotes_inputfield_alternative_mouse_over_box_position';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for alternative tooltip _x_-offset.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 2.2.5
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X = 'footnotes_inputfield_alternative_mouse_over_box_offset_x';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for alternative tooltip _y_-offset.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 2.2.5
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y = 'footnotes_inputfield_alternative_mouse_over_box_offset_y';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for alternative tooltip width.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*
|
|
||||||
* @since 2.2.5
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH = 'footnotes_inputfield_alternative_mouse_over_box_width';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to enable hard links.
|
|
||||||
*
|
|
||||||
* When the alternative reference container is enabled, hard links are too.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.3.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_HARD_LINKS_ENABLE = 'footnotes_inputfield_hard_links_enable';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the fragment ID slug in referrers.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.3.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const REFERRER_FRAGMENT_ID_SLUG = 'footnotes_inputfield_referrer_fragment_id_slug';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the fragment ID slug in footnotes.
|
|
||||||
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.3.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTE_FRAGMENT_ID_SLUG = 'footnotes_inputfield_footnote_fragment_id_slug';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key for the ID separator in fragment IDs.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.3.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const HARD_LINK_IDS_SEPARATOR = 'footnotes_inputfield_hard_link_ids_separator';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 string
|
|
||||||
*
|
|
||||||
* @since 2.5.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_BACKLINK_TOOLTIP_ENABLE = 'footnotes_inputfield_backlink_tooltip_enable';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to configure the backlink tooltip.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.5.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_BACKLINK_TOOLTIP_TEXT = 'footnotes_inputfield_backlink_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 string
|
|
||||||
*
|
|
||||||
* @since 2.5.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER = 'footnotes_inputfield_tooltip_excerpt_delimiter';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 string
|
|
||||||
*
|
|
||||||
* @since 2.5.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE = 'footnotes_inputfield_tooltip_excerpt_mirror_enable';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to configure the tooltip excerpt separator in the
|
|
||||||
* reference container.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.5.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR = 'footnotes_inputfield_tooltip_excerpt_mirror_separator';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to enable superscript style normalization.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.5.4
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT = 'footnotes_inputfield_referrers_normal_superscript';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings container key to enable AMP compatibility mode.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @since 2.6.0
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_AMP_COMPATIBILITY_ENABLE = 'footnotes_inputfield_amp_compatibility_enable';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 string
|
|
||||||
*
|
|
||||||
* @since 2.5.12
|
|
||||||
* @todo Review, remove?
|
|
||||||
* @todo Move to `SettingsSection`/`SettingsGroup`.
|
|
||||||
*/
|
|
||||||
const FOOTNOTES_LABEL_ISSUE_SOLUTION = 'footnotes_inputfield_label_issue_solution';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all Settings option group slugs.
|
* Contains all Settings option group slugs.
|
||||||
*
|
*
|
||||||
|
@ -805,94 +282,13 @@ class Settings {
|
||||||
* @since 2.8.0 Rename from `default` to `default_settings`.
|
* @since 2.8.0 Rename from `default` to `default_settings`.
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*
|
*
|
||||||
* @todo Delete.
|
* @todo Delete once moved to `SettingsSection`/`SettingsGroup`s.
|
||||||
*/
|
*/
|
||||||
private array $default_settings = array(
|
private array $default_settings = array(
|
||||||
|
|
||||||
// General settings.
|
|
||||||
'footnotes_storage' => array(
|
|
||||||
|
|
||||||
// AMP compatibility.
|
|
||||||
self::FOOTNOTES_AMP_COMPATIBILITY_ENABLE => '',
|
|
||||||
|
|
||||||
// Footnotes numbering.
|
|
||||||
self::FOOTNOTES_COUNTER_STYLE => 'arabic_plain',
|
|
||||||
//self::COMBINE_IDENTICAL_FOOTNOTES => 'yes',
|
|
||||||
|
|
||||||
self::FOOTNOTES_HARD_LINKS_ENABLE => 'no',
|
|
||||||
self::REFERRER_FRAGMENT_ID_SLUG => 'r',
|
|
||||||
self::FOOTNOTE_FRAGMENT_ID_SLUG => 'f',
|
|
||||||
self::HARD_LINK_IDS_SEPARATOR => '+',
|
|
||||||
self::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE => 'yes',
|
|
||||||
self::FOOTNOTES_BACKLINK_TOOLTIP_TEXT => 'Alt+ ←',
|
|
||||||
|
|
||||||
// Footnotes in excerpts.
|
|
||||||
self::FOOTNOTES_IN_EXCERPT => 'manual',
|
|
||||||
|
|
||||||
// Footnotes love.
|
|
||||||
self::FOOTNOTES_LOVE => 'no',
|
|
||||||
),
|
|
||||||
|
|
||||||
// Referrers and tooltips.
|
// Referrers and tooltips.
|
||||||
'footnotes_storage_custom' => array(
|
'footnotes_storage_custom' => array(
|
||||||
|
|
||||||
// Backlink symbol.
|
|
||||||
self::HYPERLINK_ARROW => 0,
|
|
||||||
self::HYPERLINK_ARROW_USER_DEFINED => '',
|
|
||||||
|
|
||||||
// Referrers.
|
|
||||||
self::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes',
|
|
||||||
self::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT => 'no',
|
|
||||||
self::FOOTNOTES_STYLING_BEFORE => '[',
|
|
||||||
self::FOOTNOTES_STYLING_AFTER => ']',
|
|
||||||
|
|
||||||
// Referrers in labels.
|
|
||||||
self::FOOTNOTES_LABEL_ISSUE_SOLUTION => 'none',
|
|
||||||
|
|
||||||
// Tooltips.
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'no',
|
|
||||||
|
|
||||||
// Tooltip position.
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center',
|
|
||||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION => 'top right',
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0,
|
|
||||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X => -50,
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7,
|
|
||||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y => 24,
|
|
||||||
|
|
||||||
// Tooltip dimensions.
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450,
|
|
||||||
self::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH => 400,
|
|
||||||
|
|
||||||
// Tooltip timing.
|
|
||||||
self::MOUSE_OVER_BOX_FADE_IN_DELAY => 0,
|
|
||||||
self::MOUSE_OVER_BOX_FADE_IN_DURATION => 200,
|
|
||||||
self::MOUSE_OVER_BOX_FADE_OUT_DELAY => 400,
|
|
||||||
self::MOUSE_OVER_BOX_FADE_OUT_DURATION => 200,
|
|
||||||
|
|
||||||
// Tooltip truncation.
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes',
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200,
|
|
||||||
self::FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading',
|
|
||||||
|
|
||||||
// Tooltip text.
|
|
||||||
self::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER => '[[/tooltip]]',
|
|
||||||
self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE => 'no',
|
|
||||||
self::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR => ' — ',
|
|
||||||
|
|
||||||
// Tooltip appearance.
|
|
||||||
self::MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'yes',
|
|
||||||
self::MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13,
|
|
||||||
self::MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px',
|
|
||||||
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_COLOR => '#000000',
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff',
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1,
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99',
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0,
|
|
||||||
self::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666',
|
|
||||||
|
|
||||||
// Your existing Custom CSS code.
|
// Your existing Custom CSS code.
|
||||||
self::CUSTOM_CSS => '',
|
self::CUSTOM_CSS => '',
|
||||||
|
|
||||||
|
@ -940,7 +336,7 @@ class Settings {
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*
|
*
|
||||||
* @todo Delete.
|
* @todo Delete once all `SettingsSection`/`SettingsGroup`s set up.
|
||||||
*/
|
*/
|
||||||
public array $settings = array();
|
public array $settings = array();
|
||||||
|
|
||||||
|
@ -1072,7 +468,6 @@ class Settings {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function load_options_group(): void {
|
protected function load_options_group(): void {
|
||||||
$options_group = get_option($this->options_group_slug);
|
$options_group = get_option($this->options_group_slug);
|
||||||
|
|
||||||
|
@ -1131,6 +526,7 @@ class Settings {
|
||||||
// Return a singleton of this class.
|
// Return a singleton of this class.
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all settings from each option group.
|
* Loads all settings from each option group.
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,7 +26,16 @@ abstract class SettingsGroup {
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @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.
|
* 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) {
|
foreach ($this->settings as $setting) {
|
||||||
add_settings_field(
|
add_settings_field(
|
||||||
$setting->key,
|
$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\ReferenceContainerSettingsGroup;
|
||||||
use footnotes\includes\settings\general\ScrollingSettingsGroup;
|
use footnotes\includes\settings\general\ScrollingSettingsGroup;
|
||||||
use footnotes\includes\settings\general\ShortcodeSettingsGroup;
|
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.
|
* 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-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-scrolling-settings-group.php';
|
||||||
require_once plugin_dir_path( __DIR__ ) . 'general/class-shortcode-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 {
|
protected function add_settings_groups(): void {
|
||||||
$this->settings_groups = array(
|
$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 ),
|
ReferenceContainerSettingsGroup::GROUP_ID => new ReferenceContainerSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||||
ScrollingSettingsGroup::GROUP_ID => new ScrollingSettingsGroup( $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 ),
|
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';
|
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.
|
* 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 {
|
protected function add_settings( array|false $options ): void {
|
||||||
$this->settings = array(
|
$this->settings = array(
|
||||||
self::REFERENCE_CONTAINER_NAME['key'] => $this->add_setting( self::REFERENCE_CONTAINER_NAME ),
|
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_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_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 ),
|
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;
|
use footnotes\includes\settings\SettingsSection;
|
||||||
|
|
||||||
// Import settings groups.
|
|
||||||
//use footnotes\includes\settings\referrers-and-tooltips\...;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining plugin referrer and tooltips settings.
|
* Class defining plugin referrer and tooltips settings.
|
||||||
*
|
*
|
||||||
|
@ -52,13 +49,30 @@ class ReferrersAndTooltipsSettingsSection extends SettingsSection {
|
||||||
protected function load_dependencies(): void {
|
protected function load_dependencies(): void {
|
||||||
parent::load_dependencies();
|
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 {
|
protected function add_settings_groups(): void {
|
||||||
$this->settings_groups = array (
|
$this->settings_groups = array (
|
||||||
// Add settings groups.
|
BacklinkSymbolSettingsGroup::GROUP_ID => new BacklinkSymbolSettingsGroup( $this->options_group_slug, $this->section_slug ),
|
||||||
//...::GROUP_ID => new ...($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 );
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,13 +11,16 @@ declare(strict_types=1);
|
||||||
namespace footnotes\general;
|
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-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};
|
use footnotes\includes\{Footnotes, Convert, Settings};
|
||||||
|
|
||||||
use const footnotes\includes\settings\general\ReferenceContainerSettingsGroup\{
|
/**
|
||||||
FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE,
|
* @todo Replace with constant imports.
|
||||||
FOOTNOTES_PAGE_LAYOUT_SUPPORT
|
*/
|
||||||
};
|
use footnotes\includes\settings\general\ReferenceContainerSettingsGroup;
|
||||||
|
use footnotes\includes\settings\general\AMPCompatSettingsGroup;
|
||||||
|
use footnotes\includes\settings\referrersandtooltips\TooltipsSettingsGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class provide all public-facing functionality of the plugin.
|
* Class provide all public-facing functionality of the plugin.
|
||||||
|
@ -125,10 +128,10 @@ class General {
|
||||||
$this->load_dependencies();
|
$this->load_dependencies();
|
||||||
|
|
||||||
// Set conditions re-used for stylesheet enqueuing and in class/task.php.
|
// Set conditions re-used for stylesheet enqueuing and in class/task.php.
|
||||||
self::$amp_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) );
|
self::$amp_enabled = Settings::instance()->get_setting( AMPCompatSettingsGroup::FOOTNOTES_AMP_COMPATIBILITY_ENABLE['key'] )->get_value();
|
||||||
self::$tooltips_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
|
self::$tooltips_enabled = Settings::instance()->get_setting( TooltipsSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_ENABLED['key'] )->get_value();
|
||||||
self::$alternative_tooltips_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
|
self::$alternative_tooltips_enabled = Settings::instance()->get_setting( TooltipsSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE['key'] )->get_value();
|
||||||
self::$script_mode = Settings::instance()->get( 'foo'/*FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE*/ );
|
self::$script_mode = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE['key'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +158,7 @@ class General {
|
||||||
|
|
||||||
$this->task = new Parser();
|
$this->task = new Parser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the stylesheets for the public-facing side of the site.
|
* Register the stylesheets for the public-facing side of the site.
|
||||||
*
|
*
|
||||||
|
|
|
@ -14,37 +14,30 @@ declare(strict_types=1);
|
||||||
namespace footnotes\general;
|
namespace footnotes\general;
|
||||||
|
|
||||||
use footnotes\includes\{Settings, Convert, Template};
|
use footnotes\includes\{Settings, Convert, Template};
|
||||||
use const footnotes\includes\settings\general\ReferenceContainerSettingsGroup\{
|
|
||||||
COMBINE_IDENTICAL_FOOTNOTES,
|
/**
|
||||||
REFERENCE_CONTAINER_NAME,
|
* @todo Replace with constant imports.
|
||||||
REFERENCE_CONTAINER_LABEL_ELEMENT,
|
*/
|
||||||
REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER,
|
use footnotes\includes\settings\general\{
|
||||||
REFERENCE_CONTAINER_COLLAPSE,
|
ExcerptsSettingsGroup,
|
||||||
REFERENCE_CONTAINER_START_PAGE_ENABLE,
|
HardLinksSettingsGroup,
|
||||||
REFERENCE_CONTAINER_TOP_MARGIN,
|
LoveSettingsGroup,
|
||||||
REFERENCE_CONTAINER_BOTTOM_MARGIN,
|
NumberingSettingsGroup,
|
||||||
REFERENCE_CONTAINER_ROW_BORDERS_ENABLE,
|
ReferenceContainerSettingsGroup,
|
||||||
BACKLINKS_COLUMN_WIDTH_ENABLED,
|
ScrollingSettingsGroup,
|
||||||
BACKLINKS_COLUMN_WIDTH_SCALAR,
|
ShortcodeSettingsGroup,
|
||||||
BACKLINKS_COLUMN_WIDTH_UNIT,
|
};
|
||||||
BACKLINKS_COLUMN_MAX_WIDTH_ENABLED,
|
use footnotes\includes\settings\referrersandtooltips\{
|
||||||
BACKLINKS_COLUMN_MAX_WIDTH_SCALAR,
|
BacklinkSymbolSettingsGroup,
|
||||||
BACKLINKS_COLUMN_MAX_WIDTH_UNIT,
|
ReferrersSettingsGroup,
|
||||||
REFERENCE_CONTAINER_POSITION,
|
ReferrersInLabelsSettingsGroup,
|
||||||
FOOTNOTE_SECTION_SHORTCODE,
|
TooltipsSettingsGroup,
|
||||||
REFERENCE_CONTAINER_POSITION_SHORTCODE,
|
TooltipAppearanceSettingsGroup,
|
||||||
FOOTNOTE_URL_WRAP_ENABLED,
|
TooltipDimensionsSettingsGroup,
|
||||||
LINK_ELEMENT_ENABLED,
|
TooltipPositionSettingsGroup,
|
||||||
REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE,
|
TooltipTextSettingsGroup,
|
||||||
REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH,
|
TooltipTimingSettingsGroup,
|
||||||
BACKLINKS_SEPARATOR_ENABLED,
|
TooltipTruncationSettingsGroup
|
||||||
BACKLINKS_SEPARATOR_OPTION,
|
|
||||||
BACKLINKS_SEPARATOR_CUSTOM,
|
|
||||||
BACKLINKS_TERMINATOR_ENABLED,
|
|
||||||
BACKLINKS_TERMINATOR_OPTION,
|
|
||||||
BACKLINKS_TERMINATOR_CUSTOM,
|
|
||||||
REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE,
|
|
||||||
BACKLINKS_LINE_BREAKS_ENABLED
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -441,7 +434,7 @@ class Parser {
|
||||||
*
|
*
|
||||||
* Native smooth scrolling only works in recent browsers.
|
* Native smooth scrolling only works in recent browsers.
|
||||||
*/
|
*/
|
||||||
if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_CSS_SMOOTH_SCROLLING ) ) ) {
|
if ( Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_CSS_SMOOTH_SCROLLING['key'] )->get_value() ) {
|
||||||
echo "html {scroll-behavior: smooth;}\r\n";
|
echo "html {scroll-behavior: smooth;}\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +444,7 @@ class Parser {
|
||||||
* Cannot be included in external stylesheet, as it is only optional.
|
* Cannot be included in external stylesheet, as it is only optional.
|
||||||
* The scope is variable too: referrers only, or all superscript elements.
|
* The scope is variable too: referrers only, or all superscript elements.
|
||||||
*/
|
*/
|
||||||
$normalize_superscript = Settings::instance()->get( Settings::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT );
|
$normalize_superscript = Settings::instance()->get_setting( ReferrersSettingsGroup::FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT['key'] )->get_value();
|
||||||
if ( 'no' !== $normalize_superscript ) {
|
if ( 'no' !== $normalize_superscript ) {
|
||||||
if ( 'all' === $normalize_superscript ) {
|
if ( 'all' === $normalize_superscript ) {
|
||||||
echo 'sup {';
|
echo 'sup {';
|
||||||
|
@ -462,14 +455,14 @@ class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference container display on home page.
|
// Reference container display on home page.
|
||||||
if ( ! Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_START_PAGE_ENABLE['key'] ) ) ) {
|
if ( ! ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_START_PAGE_ENABLE['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
echo ".home .footnotes_reference_container { display: none; }\r\n";
|
echo ".home .footnotes_reference_container { display: none; }\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference container top and bottom margins.
|
// Reference container top and bottom margins.
|
||||||
$reference_container_top_margin = (int) Settings::instance()->get( REFERENCE_CONTAINER_TOP_MARGIN['key'] );
|
$reference_container_top_margin = (int) Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_TOP_MARGIN['key'] )->get_value();
|
||||||
$reference_container_bottom_margin = (int) Settings::instance()->get( REFERENCE_CONTAINER_BOTTOM_MARGIN['key'] );
|
$reference_container_bottom_margin = (int) Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_BOTTOM_MARGIN['key'] )->get_value();
|
||||||
echo '.footnotes_reference_container {margin-top: ';
|
echo '.footnotes_reference_container {margin-top: ';
|
||||||
echo empty( $reference_container_top_margin ) ? '0' : $reference_container_top_margin;
|
echo empty( $reference_container_top_margin ) ? '0' : $reference_container_top_margin;
|
||||||
echo 'px !important; margin-bottom: ';
|
echo 'px !important; margin-bottom: ';
|
||||||
|
@ -477,9 +470,9 @@ class Parser {
|
||||||
echo "px !important;}\r\n";
|
echo "px !important;}\r\n";
|
||||||
|
|
||||||
// Reference container label bottom border.
|
// Reference container label bottom border.
|
||||||
if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER['key'] )->get_value() ) ) {
|
||||||
echo '.footnote_container_prepare > ';
|
echo '.footnote_container_prepare > ';
|
||||||
echo Settings::instance()->get( REFERENCE_CONTAINER_LABEL_ELEMENT );
|
echo Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_LABEL_ELEMENT['key'] )->get_value() ;
|
||||||
echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n";
|
echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +485,7 @@ class Parser {
|
||||||
* issues as browsers won’t reload these style sheets after settings are
|
* issues as browsers won’t reload these style sheets after settings are
|
||||||
* changed while the version string is not.
|
* changed while the version string is not.
|
||||||
*/
|
*/
|
||||||
if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_ROW_BORDERS_ENABLE['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_ROW_BORDERS_ENABLE['key'] )->get_value() ) ) {
|
||||||
echo '.footnotes_table, .footnotes_plugin_reference_row {';
|
echo '.footnotes_table, .footnotes_plugin_reference_row {';
|
||||||
echo 'border: 1px solid #060606;';
|
echo 'border: 1px solid #060606;';
|
||||||
echo " !important;}\r\n";
|
echo " !important;}\r\n";
|
||||||
|
@ -502,16 +495,16 @@ class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref container first column width and max-width.
|
// Ref container first column width and max-width.
|
||||||
$column_width_enabled = Convert::to_bool( Settings::instance()->get( BACKLINKS_COLUMN_WIDTH_ENABLED['key'] ) );
|
$column_width_enabled = ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_COLUMN_WIDTH_ENABLED['key'] )->get_value() );
|
||||||
$column_max_width_enabled = Convert::to_bool( Settings::instance()->get( BACKLINKS_COLUMN_MAX_WIDTH_ENABLED['key'] ) );
|
$column_max_width_enabled = ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_COLUMN_MAX_WIDTH_ENABLED['key'] )->get_value() );
|
||||||
|
|
||||||
if ( $column_width_enabled || $column_max_width_enabled ) {
|
if ( $column_width_enabled || $column_max_width_enabled ) {
|
||||||
echo '.footnote-reference-container { table-layout: fixed; }';
|
echo '.footnote-reference-container { table-layout: fixed; }';
|
||||||
echo '.footnote_plugin_index, .footnote_plugin_index_combi {';
|
echo '.footnote_plugin_index, .footnote_plugin_index_combi {';
|
||||||
|
|
||||||
if ( $column_width_enabled ) {
|
if ( $column_width_enabled ) {
|
||||||
$column_width_scalar = Settings::instance()->get( BACKLINKS_COLUMN_WIDTH_SCALAR['key'] );
|
$column_width_scalar = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_COLUMN_WIDTH_SCALAR['key'] )->get_value();
|
||||||
$column_width_unit = Settings::instance()->get( BACKLINKS_COLUMN_WIDTH_UNIT['key'] );
|
$column_width_unit = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_COLUMN_WIDTH_UNIT['key'] )->get_value();
|
||||||
|
|
||||||
if ( ! empty( $column_width_scalar ) ) {
|
if ( ! empty( $column_width_scalar ) ) {
|
||||||
if ( '%' === $column_width_unit && $column_width_scalar > 100 ) {
|
if ( '%' === $column_width_unit && $column_width_scalar > 100 ) {
|
||||||
|
@ -525,8 +518,8 @@ class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $column_max_width_enabled ) {
|
if ( $column_max_width_enabled ) {
|
||||||
$column_max_width_scalar = Settings::instance()->get( BACKLINKS_COLUMN_MAX_WIDTH_SCALAR['key'] );
|
$column_max_width_scalar = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_COLUMN_MAX_WIDTH_SCALAR['key'] )->get_value();
|
||||||
$column_max_width_unit = Settings::instance()->get( BACKLINKS_COLUMN_MAX_WIDTH_UNIT['key'] );
|
$column_max_width_unit = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_COLUMN_MAX_WIDTH_UNIT['key'] )->get_value();
|
||||||
|
|
||||||
if ( ! empty( $column_max_width_scalar ) ) {
|
if ( ! empty( $column_max_width_scalar ) ) {
|
||||||
if ( '%' === $column_max_width_unit && $column_max_width_scalar > 100 ) {
|
if ( '%' === $column_max_width_unit && $column_max_width_scalar > 100 ) {
|
||||||
|
@ -543,14 +536,14 @@ class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hard links scroll offset.
|
// Hard links scroll offset.
|
||||||
self::$hard_links_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_HARD_LINKS_ENABLE ) );
|
self::$hard_links_enabled = Settings::instance()->get_setting( HardLinksSettingsGroup::FOOTNOTES_HARD_LINKS_ENABLE['key'] )->get_value();
|
||||||
|
|
||||||
// Correct hard links enabled status depending on AMP-compatible or alternative reference container enabled status.
|
// Correct hard links enabled status depending on AMP-compatible or alternative reference container enabled status.
|
||||||
if ( General::$amp_enabled || 'jquery' !== General::$script_mode ) {
|
if ( General::$amp_enabled || 'jquery' !== General::$script_mode ) {
|
||||||
self::$hard_links_enabled = true;
|
self::$hard_links_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$scroll_offset = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_OFFSET );
|
self::$scroll_offset = (int)Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_SCROLL_OFFSET['key'] )->get_value();
|
||||||
if ( self::$hard_links_enabled ) {
|
if ( self::$hard_links_enabled ) {
|
||||||
echo '.footnote_referrer_anchor, .footnote_item_anchor {bottom: ';
|
echo '.footnote_referrer_anchor, .footnote_item_anchor {bottom: ';
|
||||||
echo self::$scroll_offset;
|
echo self::$scroll_offset;
|
||||||
|
@ -563,46 +556,46 @@ class Parser {
|
||||||
|
|
||||||
// Tooltip appearance: Tooltip font size.
|
// Tooltip appearance: Tooltip font size.
|
||||||
echo ' font-size: ';
|
echo ' font-size: ';
|
||||||
if ( Convert::to_bool( Settings::instance()->get( Settings::MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) {
|
if ( Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::MOUSE_OVER_BOX_FONT_SIZE_ENABLED['key'] )->get_value() ) {
|
||||||
echo Settings::instance()->get( Settings::MOUSE_OVER_BOX_FONT_SIZE_SCALAR );
|
echo Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::MOUSE_OVER_BOX_FONT_SIZE_SCALAR['key'] )->get_value();
|
||||||
echo Settings::instance()->get( Settings::MOUSE_OVER_BOX_FONT_SIZE_UNIT );
|
echo Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::MOUSE_OVER_BOX_FONT_SIZE_UNIT['key'] )->get_value();
|
||||||
} else {
|
} else {
|
||||||
echo 'inherit';
|
echo 'inherit';
|
||||||
}
|
}
|
||||||
echo ' !important;';
|
echo ' !important;';
|
||||||
|
|
||||||
// Tooltip Text color.
|
// Tooltip Text color.
|
||||||
$color = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_COLOR );
|
$color = Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_COLOR['key'] )->get_value();
|
||||||
if ( ! empty( $color ) ) {
|
if ( ! empty( $color ) ) {
|
||||||
printf( ' color: %s !important;', $color );
|
printf( ' color: %s !important;', $color );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip Background color.
|
// Tooltip Background color.
|
||||||
$background = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND );
|
$background = Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND['key'] )->get_value();
|
||||||
if ( ! empty( $background ) ) {
|
if ( ! empty( $background ) ) {
|
||||||
printf( ' background-color: %s !important;', $background );
|
printf( ' background-color: %s !important;', $background );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip Border width.
|
// Tooltip Border width.
|
||||||
$border_width = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH );
|
$border_width = Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH['key'] )->get_value();
|
||||||
if ( ! empty( $border_width ) && (int) $border_width > 0 ) {
|
if ( ! empty( $border_width ) && (int) $border_width > 0 ) {
|
||||||
printf( ' border-width: %dpx !important; border-style: solid !important;', $border_width );
|
printf( ' border-width: %dpx !important; border-style: solid !important;', $border_width );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip Border color.
|
// Tooltip Border color.
|
||||||
$border_color = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR );
|
$border_color = Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR['key'] )->get_value();
|
||||||
if ( ! empty( $border_color ) ) {
|
if ( ! empty( $border_color ) ) {
|
||||||
printf( ' border-color: %s !important;', $border_color );
|
printf( ' border-color: %s !important;', $border_color );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip Corner radius.
|
// Tooltip Corner radius.
|
||||||
$border_radius = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS );
|
$border_radius = Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS['key'] )->get_value();
|
||||||
if ( ! empty( $border_radius ) && (int) $border_radius > 0 ) {
|
if ( ! empty( $border_radius ) && (int) $border_radius > 0 ) {
|
||||||
printf( ' border-radius: %dpx !important;', $border_radius );
|
printf( ' border-radius: %dpx !important;', $border_radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip Shadow color.
|
// Tooltip Shadow color.
|
||||||
$box_shadow_color = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR );
|
$box_shadow_color = Settings::instance()->get_setting( TooltipAppearanceSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR['key'] )->get_value();
|
||||||
if ( ! empty( $box_shadow_color ) ) {
|
if ( ! empty( $box_shadow_color ) ) {
|
||||||
printf( ' -webkit-box-shadow: 2px 2px 11px %s;', $box_shadow_color );
|
printf( ' -webkit-box-shadow: 2px 2px 11px %s;', $box_shadow_color );
|
||||||
printf( ' -moz-box-shadow: 2px 2px 11px %s;', $box_shadow_color );
|
printf( ' -moz-box-shadow: 2px 2px 11px %s;', $box_shadow_color );
|
||||||
|
@ -616,7 +609,7 @@ class Parser {
|
||||||
*
|
*
|
||||||
* Position and timing of jQuery tooltips are script-defined.
|
* Position and timing of jQuery tooltips are script-defined.
|
||||||
*/
|
*/
|
||||||
$max_width = Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH );
|
$max_width = Settings::instance()->get_setting( TooltipDimensionsSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH['key'] )->get_value();
|
||||||
if ( ! empty( $max_width ) && (int) $max_width > 0 ) {
|
if ( ! empty( $max_width ) && (int) $max_width > 0 ) {
|
||||||
printf( ' max-width: %dpx !important;', $max_width );
|
printf( ' max-width: %dpx !important;', $max_width );
|
||||||
}
|
}
|
||||||
|
@ -627,7 +620,7 @@ class Parser {
|
||||||
echo "}\r\n";
|
echo "}\r\n";
|
||||||
|
|
||||||
// Dimensions.
|
// Dimensions.
|
||||||
$alternative_tooltip_width = (int) Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH );
|
$alternative_tooltip_width = (int) Settings::instance()->get_setting( TooltipDimensionsSettingsGroup::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH['key'] )->get_value();
|
||||||
echo '.footnote_tooltip.position {';
|
echo '.footnote_tooltip.position {';
|
||||||
echo ' width: max-content; ';
|
echo ' width: max-content; ';
|
||||||
|
|
||||||
|
@ -635,8 +628,8 @@ class Parser {
|
||||||
echo ' max-width: ' . $alternative_tooltip_width . 'px;';
|
echo ' max-width: ' . $alternative_tooltip_width . 'px;';
|
||||||
|
|
||||||
// Position.
|
// Position.
|
||||||
$alternative_position = Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION );
|
$alternative_position = Settings::instance()->get_setting( TooltipPositionSettingsGroup::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION['key'] )->get_value();
|
||||||
$offset_x = (int) Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X );
|
$offset_x = (int) Settings::instance()->get_setting( TooltipPositionSettingsGroup::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X['key'] )->get_value();
|
||||||
|
|
||||||
if ( 'top left' === $alternative_position || 'bottom left' === $alternative_position ) {
|
if ( 'top left' === $alternative_position || 'bottom left' === $alternative_position ) {
|
||||||
echo ' right: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;';
|
echo ' right: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;';
|
||||||
|
@ -644,7 +637,7 @@ class Parser {
|
||||||
echo ' left: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;';
|
echo ' left: ' . ( empty( $offset_x ) ? 0 : $offset_x ) . 'px;';
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset_y = (int) Settings::instance()->get( Settings::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y );
|
$offset_y = (int) Settings::instance()->get_setting( TooltipPositionSettingsGroup::FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y['key'] )->get_value();
|
||||||
|
|
||||||
if ( 'top left' === $alternative_position || 'top right' === $alternative_position ) {
|
if ( 'top left' === $alternative_position || 'top right' === $alternative_position ) {
|
||||||
echo ' bottom: ' . ( empty( $offset_y ) ? 0 : $offset_y ) . 'px;';
|
echo ' bottom: ' . ( empty( $offset_y ) ? 0 : $offset_y ) . 'px;';
|
||||||
|
@ -654,13 +647,13 @@ class Parser {
|
||||||
echo "}\r\n";
|
echo "}\r\n";
|
||||||
|
|
||||||
// Timing.
|
// Timing.
|
||||||
$fade_in_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DELAY );
|
$fade_in_delay = Settings::instance()->get_setting( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_IN_DELAY['key'] )->get_value();
|
||||||
$fade_in_delay = empty( $fade_in_delay ) ? '0' : $fade_in_delay;
|
$fade_in_delay = empty( $fade_in_delay ) ? '0' : $fade_in_delay;
|
||||||
$fade_in_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DURATION );
|
$fade_in_duration = Settings::instance()->get_setting( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_IN_DURATION['key'] )->get_value();
|
||||||
$fade_in_duration = empty( $fade_in_duration ) ? '0' : $fade_in_duration;
|
$fade_in_duration = empty( $fade_in_duration ) ? '0' : $fade_in_duration;
|
||||||
$fade_out_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY );
|
$fade_out_delay = Settings::instance()->get_setting( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_OUT_DELAY['key'] )->get_value();
|
||||||
$fade_out_delay = empty( $fade_out_delay ) ? '0' : $fade_out_delay;
|
$fade_out_delay = empty( $fade_out_delay ) ? '0' : $fade_out_delay;
|
||||||
$fade_out_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION );
|
$fade_out_duration = Settings::instance()->get_setting( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_OUT_DURATION['key'] )->get_value();
|
||||||
$fade_out_duration = empty( $fade_out_duration ) ? '0' : $fade_out_duration;
|
$fade_out_duration = empty( $fade_out_duration ) ? '0' : $fade_out_duration;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -743,11 +736,11 @@ class Parser {
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public function footnotes_output_footer(): void {
|
public function footnotes_output_footer(): void {
|
||||||
if ( 'footer' === Settings::instance()->get( REFERENCE_CONTAINER_POSITION['key'] ) ) {
|
if ( 'footer' === Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_POSITION['key'] )->get_value() ) {
|
||||||
echo $this->reference_container();
|
echo $this->reference_container();
|
||||||
}
|
}
|
||||||
// Get setting for love and share this plugin.
|
// Get setting for love and share this plugin.
|
||||||
$love_me_index = Settings::instance()->get( Settings::FOOTNOTES_LOVE );
|
$love_me_index = Settings::instance()->get_setting( LoveSettingsGroup::FOOTNOTES_LOVE['key'] )->get_value();
|
||||||
// Check if the admin allows to add a link to the footer.
|
// Check if the admin allows to add a link to the footer.
|
||||||
if ( empty( $love_me_index ) || 'no' === strtolower( $love_me_index ) || ! self::$allow_love_me ) {
|
if ( empty( $love_me_index ) || 'no' === strtolower( $love_me_index ) || ! self::$allow_love_me ) {
|
||||||
return;
|
return;
|
||||||
|
@ -816,8 +809,8 @@ class Parser {
|
||||||
*/
|
*/
|
||||||
public function footnotes_in_content( string $content ): string {
|
public function footnotes_in_content( string $content ): string {
|
||||||
|
|
||||||
$ref_container_position = Settings::instance()->get( REFERENCE_CONTAINER_POSITION['key'] );
|
$ref_container_position = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_POSITION['key'] )->get_value();
|
||||||
$footnote_section_shortcode = Settings::instance()->get( FOOTNOTE_SECTION_SHORTCODE['key'] );
|
$footnote_section_shortcode = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::FOOTNOTE_SECTION_SHORTCODE['key'] )->get_value();
|
||||||
$footnote_section_shortcode_length = strlen( $footnote_section_shortcode );
|
$footnote_section_shortcode_length = strlen( $footnote_section_shortcode );
|
||||||
|
|
||||||
// TODO: Replace with `str_contains()`, but currently breaks Rector downgrade.
|
// TODO: Replace with `str_contains()`, but currently breaks Rector downgrade.
|
||||||
|
@ -865,7 +858,7 @@ class Parser {
|
||||||
* @return string $excerpt Processed or new excerpt.
|
* @return string $excerpt Processed or new excerpt.
|
||||||
*/
|
*/
|
||||||
public function footnotes_in_excerpt( string $excerpt ): string {
|
public function footnotes_in_excerpt( string $excerpt ): string {
|
||||||
$excerpt_mode = Settings::instance()->get( Settings::FOOTNOTES_IN_EXCERPT );
|
$excerpt_mode = Settings::instance()->get_setting( ExcerptsSettingsGroup::FOOTNOTES_IN_EXCERPT['key'] )->get_value();
|
||||||
|
|
||||||
if ( 'yes' === $excerpt_mode ) {
|
if ( 'yes' === $excerpt_mode ) {
|
||||||
return $this->generate_excerpt_with_footnotes( $excerpt );
|
return $this->generate_excerpt_with_footnotes( $excerpt );
|
||||||
|
@ -1053,7 +1046,7 @@ class Parser {
|
||||||
public function footnotes_in_widget_text( string $content ): string {
|
public function footnotes_in_widget_text( string $content ): string {
|
||||||
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda
|
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda
|
||||||
// Appends the reference container if set to "post_end".
|
// Appends the reference container if set to "post_end".
|
||||||
return $this->exec( $content, 'post_end' === Settings::instance()->get( REFERENCE_CONTAINER_POSITION['key'] ) );
|
return $this->exec( $content, 'post_end' === Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_POSITION['key'] )->get_value() );
|
||||||
// phpcs:enable WordPress.PHP.YodaConditions.NotYoda
|
// phpcs:enable WordPress.PHP.YodaConditions.NotYoda
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1060,6 @@ class Parser {
|
||||||
* @param bool $hide_footnotes_text Hide footnotes found in the string.
|
* @param bool $hide_footnotes_text Hide footnotes found in the string.
|
||||||
*/
|
*/
|
||||||
public function exec( string $content, bool $output_references = false, bool $hide_footnotes_text = false ): string {
|
public function exec( string $content, bool $output_references = false, bool $hide_footnotes_text = false ): string {
|
||||||
|
|
||||||
// Process content.
|
// Process content.
|
||||||
$content = $this->search( $content, $hide_footnotes_text );
|
$content = $this->search( $content, $hide_footnotes_text );
|
||||||
|
|
||||||
|
@ -1076,7 +1068,7 @@ class Parser {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Append the reference container or insert at shortcode.
|
// Append the reference container or insert at shortcode.
|
||||||
$reference_container_position_shortcode = Settings::instance()->get( REFERENCE_CONTAINER_POSITION_SHORTCODE['key'] );
|
$reference_container_position_shortcode = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_POSITION_SHORTCODE['key'] )->get_value();
|
||||||
if ( empty( $reference_container_position_shortcode ) ) {
|
if ( empty( $reference_container_position_shortcode ) ) {
|
||||||
$reference_container_position_shortcode = '[[references]]';
|
$reference_container_position_shortcode = '[[references]]';
|
||||||
}
|
}
|
||||||
|
@ -1124,11 +1116,11 @@ class Parser {
|
||||||
public function unify_delimiters( string $content ): string {
|
public function unify_delimiters( string $content ): string {
|
||||||
|
|
||||||
// Get footnotes start and end tag short codes.
|
// Get footnotes start and end tag short codes.
|
||||||
$starting_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_START );
|
$starting_tag = Settings::instance()->get_setting( ShortcodeSettingsGroup::FOOTNOTES_SHORT_CODE_START )->get_value();
|
||||||
$ending_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_END );
|
$ending_tag = Settings::instance()->get_setting( ShortcodeSettingsGroup::FOOTNOTES_SHORT_CODE_END )->get_value();
|
||||||
if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) {
|
if ( 'userdefined' === $starting_tag || 'userdefined' === $ending_tag ) {
|
||||||
$starting_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_START_USER_DEFINED );
|
$starting_tag = Settings::instance()->get_setting( ShortcodeSettingsGroup::FOOTNOTES_SHORT_CODE_START_USER_DEFINED )->get_value();
|
||||||
$ending_tag = Settings::instance()->get( Settings::FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
|
$ending_tag = Settings::instance()->get_setting( ShortcodeSettingsGroup::FOOTNOTES_SHORT_CODE_END_USER_DEFINED )->get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any footnotes short code is empty, return the content without changes.
|
// If any footnotes short code is empty, return the content without changes.
|
||||||
|
@ -1192,6 +1184,8 @@ class Parser {
|
||||||
|
|
||||||
// Get footnote delimiter shortcodes and unify them.
|
// Get footnote delimiter shortcodes and unify them.
|
||||||
$content = self::unify_delimiters( $content );
|
$content = self::unify_delimiters( $content );
|
||||||
|
print_r('FOO');
|
||||||
|
print_r($content);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks for balanced footnote delimiters; delimiter syntax validation.
|
* Checks for balanced footnote delimiters; delimiter syntax validation.
|
||||||
|
@ -1201,7 +1195,7 @@ class Parser {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// If enabled.
|
// If enabled.
|
||||||
if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) {
|
if ( Settings::instance()->get_setting( ShortcodeSettingsGroup::FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE['key'] ->get_value()) ) {
|
||||||
|
|
||||||
// Apply different regex depending on whether start shortcode is double/triple opening parenthesis.
|
// Apply different regex depending on whether start shortcode is double/triple opening parenthesis.
|
||||||
if ( '((' === self::$start_tag || '(((' === self::$start_tag ) {
|
if ( '((' === self::$start_tag || '(((' === self::$start_tag ) {
|
||||||
|
@ -1270,7 +1264,7 @@ class Parser {
|
||||||
} while ( preg_match( $value_regex, $content ) );
|
} while ( preg_match( $value_regex, $content ) );
|
||||||
|
|
||||||
// Optionally moves footnotes outside at the end of the label element.
|
// Optionally moves footnotes outside at the end of the label element.
|
||||||
$label_issue_solution = Settings::instance()->get( Settings::FOOTNOTES_LABEL_ISSUE_SOLUTION );
|
$label_issue_solution = Settings::instance()->get_setting( ReferrersInLabelsSettingsGroup::FOOTNOTES_LABEL_ISSUE_SOLUTION['key'] )->get_value();
|
||||||
|
|
||||||
if ( 'move' === $label_issue_solution ) {
|
if ( 'move' === $label_issue_solution ) {
|
||||||
|
|
||||||
|
@ -1341,7 +1335,7 @@ class Parser {
|
||||||
if ( General::$amp_enabled ) {
|
if ( General::$amp_enabled ) {
|
||||||
|
|
||||||
// Whether first clicking a referrer needs to expand the reference container.
|
// Whether first clicking a referrer needs to expand the reference container.
|
||||||
if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_COLLAPSE['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
// Load 'public/partials/amp-footnote-expand.html'.
|
// Load 'public/partials/amp-footnote-expand.html'.
|
||||||
$template = new Template( Template::PUBLIC, 'amp-footnote-expand' );
|
$template = new Template( Template::PUBLIC, 'amp-footnote-expand' );
|
||||||
|
@ -1392,7 +1386,7 @@ class Parser {
|
||||||
$footnote_text = substr( $content, $pos_start + strlen( self::$start_tag ), $length - strlen( self::$start_tag ) );
|
$footnote_text = substr( $content, $pos_start + strlen( self::$start_tag ), $length - strlen( self::$start_tag ) );
|
||||||
|
|
||||||
// Get tooltip text if present.
|
// Get tooltip text if present.
|
||||||
self::$tooltip_shortcode = Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER );
|
self::$tooltip_shortcode = Settings::instance()->get_setting( TooltipTextSettingsGroup::FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER['key'] )->get_value();
|
||||||
self::$tooltip_shortcode_length = strlen( self::$tooltip_shortcode );
|
self::$tooltip_shortcode_length = strlen( self::$tooltip_shortcode );
|
||||||
$tooltip_text_length = strpos( $footnote_text, (string) self::$tooltip_shortcode );
|
$tooltip_text_length = strpos( $footnote_text, (string) self::$tooltip_shortcode );
|
||||||
$has_tooltip_text = (bool) $tooltip_text_length;
|
$has_tooltip_text = (bool) $tooltip_text_length;
|
||||||
|
@ -1416,7 +1410,7 @@ class Parser {
|
||||||
*
|
*
|
||||||
* TODO: Split into own method.
|
* TODO: Split into own method.
|
||||||
*/
|
*/
|
||||||
if ( Convert::to_bool( Settings::instance()->get( FOOTNOTE_URL_WRAP_ENABLED['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::FOOTNOTE_URL_WRAP_ENABLED['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
$footnote_text = preg_replace(
|
$footnote_text = preg_replace(
|
||||||
'#(?<![-\w\.!~\*\'\(\);]=[\'"])(?<![-\w\.!~\*\'\(\);]=[\'"] )(?<![-\w\.!~\*\'\(\);]=[\'"] )(?<![-\w\.!~\*\'\(\);]=)(?<!/)((ht|f)tps?://[^\\s<]+)#',
|
'#(?<![-\w\.!~\*\'\(\);]=[\'"])(?<![-\w\.!~\*\'\(\);]=[\'"] )(?<![-\w\.!~\*\'\(\);]=[\'"] )(?<![-\w\.!~\*\'\(\);]=)(?<!/)((ht|f)tps?://[^\\s<]+)#',
|
||||||
|
@ -1432,9 +1426,9 @@ class Parser {
|
||||||
if ( self::$hard_links_enabled ) {
|
if ( self::$hard_links_enabled ) {
|
||||||
|
|
||||||
// Get the configurable parts.
|
// Get the configurable parts.
|
||||||
self::$referrer_link_slug = Settings::instance()->get( Settings::REFERRER_FRAGMENT_ID_SLUG );
|
self::$referrer_link_slug = Settings::instance()->get_setting( HardLinksSettingsGroup::REFERRER_FRAGMENT_ID_SLUG['key'] )->get_value();
|
||||||
self::$footnote_link_slug = Settings::instance()->get( Settings::FOOTNOTE_FRAGMENT_ID_SLUG );
|
self::$footnote_link_slug = Settings::instance()->get_setting( HardLinksSettingsGroup::FOOTNOTE_FRAGMENT_ID_SLUG['key'] )->get_value();
|
||||||
self::$link_ids_separator = Settings::instance()->get( Settings::HARD_LINK_IDS_SEPARATOR );
|
self::$link_ids_separator = Settings::instance()->get_setting( HardLinksSettingsGroup::HARD_LINK_IDS_SEPARATOR['key'] )->get_value();
|
||||||
|
|
||||||
// Streamline ID concatenation.
|
// Streamline ID concatenation.
|
||||||
self::$post_container_id_compound = self::$link_ids_separator;
|
self::$post_container_id_compound = self::$link_ids_separator;
|
||||||
|
@ -1447,11 +1441,11 @@ class Parser {
|
||||||
|
|
||||||
// Display the footnote referrers and the tooltips.
|
// Display the footnote referrers and the tooltips.
|
||||||
if ( ! $hide_footnotes_text ) {
|
if ( ! $hide_footnotes_text ) {
|
||||||
$index = Convert::index( $footnote_index, Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) );
|
$index = Convert::index( $footnote_index, Settings::instance()->get_setting( NumberingSettingsGroup::FOOTNOTES_COUNTER_STYLE['key'] )->get_value() );
|
||||||
|
|
||||||
// Display only a truncated footnote text if option enabled.
|
// Display only a truncated footnote text if option enabled.
|
||||||
$enable_excerpt = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) );
|
$enable_excerpt = Settings::instance()->get_setting( TooltipTruncationSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED['key'] )->get_value();
|
||||||
$max_length = (int) Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH );
|
$max_length = Settings::instance()->get_setting( TooltipTruncationSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH['key'] )->get_value();
|
||||||
|
|
||||||
// Define excerpt text as footnote text by default.
|
// Define excerpt text as footnote text by default.
|
||||||
$excerpt_text = $footnote_text;
|
$excerpt_text = $footnote_text;
|
||||||
|
@ -1477,7 +1471,7 @@ class Parser {
|
||||||
if ( General::$amp_enabled ) {
|
if ( General::$amp_enabled ) {
|
||||||
|
|
||||||
// If the reference container is also collapsed by default.
|
// If the reference container is also collapsed by default.
|
||||||
if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_COLLAPSE['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
$excerpt_text .= ' on="tap:footnote_references_container_';
|
$excerpt_text .= ' on="tap:footnote_references_container_';
|
||||||
$excerpt_text .= self::$post_id . '_' . self::$reference_container_id;
|
$excerpt_text .= self::$post_id . '_' . self::$reference_container_id;
|
||||||
|
@ -1511,7 +1505,7 @@ class Parser {
|
||||||
$excerpt_text .= '>';
|
$excerpt_text .= '>';
|
||||||
|
|
||||||
// Configurable read-on button label.
|
// Configurable read-on button label.
|
||||||
$excerpt_text .= Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_READON_LABEL );
|
$excerpt_text .= Settings::instance()->get_setting( TooltipTruncationSettingsGroup::FOOTNOTES_TOOLTIP_READON_LABEL['key'] )->get_value();
|
||||||
|
|
||||||
$excerpt_text .= self::$hard_links_enabled ? '</a>' : '</span>';
|
$excerpt_text .= self::$hard_links_enabled ? '</a>' : '</span>';
|
||||||
}
|
}
|
||||||
|
@ -1522,7 +1516,7 @@ class Parser {
|
||||||
*
|
*
|
||||||
* Define the HTML element to use for the referrers.
|
* Define the HTML element to use for the referrers.
|
||||||
*/
|
*/
|
||||||
if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ) ) ) {
|
if ( Settings::instance()->get_setting( ReferrersSettingsGroup::FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS['key'] )->get_value() ) {
|
||||||
|
|
||||||
$sup_span = 'sup';
|
$sup_span = 'sup';
|
||||||
|
|
||||||
|
@ -1565,7 +1559,7 @@ class Parser {
|
||||||
$referrer_anchor_element = '';
|
$referrer_anchor_element = '';
|
||||||
|
|
||||||
// The link element is set independently as it may be needed for styling.
|
// The link element is set independently as it may be needed for styling.
|
||||||
if ( Convert::to_bool( Settings::instance()->get( LINK_ELEMENT_ENABLED['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::LINK_ELEMENT_ENABLED['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
self::$link_span = 'a';
|
self::$link_span = 'a';
|
||||||
self::$link_open_tag = '<a>';
|
self::$link_open_tag = '<a>';
|
||||||
|
@ -1609,9 +1603,9 @@ class Parser {
|
||||||
'note_id' => $index,
|
'note_id' => $index,
|
||||||
'hard-link' => $footnote_link_argument,
|
'hard-link' => $footnote_link_argument,
|
||||||
'sup-span' => $sup_span,
|
'sup-span' => $sup_span,
|
||||||
'before' => Settings::instance()->get( Settings::FOOTNOTES_STYLING_BEFORE ),
|
'before' => Settings::instance()->get_setting( ReferrersSettingsGroup::FOOTNOTES_STYLING_BEFORE['key'] )->get_value(),
|
||||||
'index' => $index,
|
'index' => $index,
|
||||||
'after' => Settings::instance()->get( Settings::FOOTNOTES_STYLING_AFTER ),
|
'after' => Settings::instance()->get_setting( ReferrersSettingsGroup::FOOTNOTES_STYLING_AFTER['key'] )->get_value(),
|
||||||
'anchor-element' => $referrer_anchor_element,
|
'anchor-element' => $referrer_anchor_element,
|
||||||
'style' => $tooltip_style,
|
'style' => $tooltip_style,
|
||||||
'text' => $tooltip_content,
|
'text' => $tooltip_content,
|
||||||
|
@ -1625,12 +1619,12 @@ class Parser {
|
||||||
// If tooltips are enabled but neither AMP nor alternative are.
|
// If tooltips are enabled but neither AMP nor alternative are.
|
||||||
if ( General::$tooltips_enabled && ! General::$amp_enabled && ! General::$alternative_tooltips_enabled ) {
|
if ( General::$tooltips_enabled && ! General::$amp_enabled && ! General::$alternative_tooltips_enabled ) {
|
||||||
|
|
||||||
$offset_y = (int) Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y );
|
$offset_y = Settings::instance()->get_setting( TooltipPositionSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y['key'] )->get_value();
|
||||||
$offset_x = (int) Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X );
|
$offset_x = Settings::instance()->get_setting( TooltipPositionSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X['key'] )->get_value();
|
||||||
$fade_in_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DELAY );
|
$fade_in_delay = Settings::instance()->get_setting( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_IN_DELAY['key'] )->get_value();
|
||||||
$fade_in_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_IN_DURATION );
|
$fade_in_duration = Settings::instance()->get_setting( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_IN_DURATION['key'] )->get_value();
|
||||||
$fade_out_delay = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DELAY );
|
$fade_out_delay = Settings::instance()->get_settingget( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_OUT_DELAY['key'] )->get_value();
|
||||||
$fade_out_duration = (int) Settings::instance()->get( Settings::MOUSE_OVER_BOX_FADE_OUT_DURATION );
|
$fade_out_duration = Settings::instance()->get_setting( TooltipTimingSettingsGroup::MOUSE_OVER_BOX_FADE_OUT_DURATION['key'] )->get_value();
|
||||||
|
|
||||||
// Fill in 'public/partials/tooltip.html'.
|
// Fill in 'public/partials/tooltip.html'.
|
||||||
$template_tooltip->replace(
|
$template_tooltip->replace(
|
||||||
|
@ -1638,7 +1632,7 @@ class Parser {
|
||||||
'post_id' => self::$post_id,
|
'post_id' => self::$post_id,
|
||||||
'container_id' => self::$reference_container_id,
|
'container_id' => self::$reference_container_id,
|
||||||
'note_id' => $index,
|
'note_id' => $index,
|
||||||
'position' => Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_POSITION ),
|
'position' => Settings::instance()->get_setting( TooltipPositionSettingsGroup::FOOTNOTES_MOUSE_OVER_BOX_POSITION['key'] )->get_value(),
|
||||||
'offset-y' => empty( $offset_y ) ? 0 : $offset_y,
|
'offset-y' => empty( $offset_y ) ? 0 : $offset_y,
|
||||||
'offset-x' => empty( $offset_x ) ? 0 : $offset_x,
|
'offset-x' => empty( $offset_x ) ? 0 : $offset_x,
|
||||||
'fade-in-delay' => empty( $fade_in_delay ) ? 0 : $fade_in_delay,
|
'fade-in-delay' => empty( $fade_in_delay ) ? 0 : $fade_in_delay,
|
||||||
|
@ -1711,16 +1705,16 @@ class Parser {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// If the backlink symbol is enabled.
|
// If the backlink symbol is enabled.
|
||||||
if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
// Get html arrow.
|
// Get html arrow.
|
||||||
$arrow = Convert::get_arrow( Settings::instance()->get( Settings::HYPERLINK_ARROW ) );
|
$arrow = Convert::get_arrow( Settings::instance()->get_setting( BacklinkSymbolSettingsGroup::HYPERLINK_ARROW['key'] )->get_value() );
|
||||||
// Set html arrow to the first one if invalid index defined.
|
// Set html arrow to the first one if invalid index defined.
|
||||||
if ( is_array( $arrow ) ) {
|
if ( is_array( $arrow ) ) {
|
||||||
$arrow = Convert::get_arrow( 0 );
|
$arrow = Convert::get_arrow( 0 );
|
||||||
}
|
}
|
||||||
// Get user defined arrow.
|
// Get user defined arrow.
|
||||||
$arrow_user_defined = Settings::instance()->get( Settings::HYPERLINK_ARROW_USER_DEFINED );
|
$arrow_user_defined = Settings::instance()->get_setting( BacklinkSymbolSettingsGroup::HYPERLINK_ARROW_USER_DEFINED['key'] )->get_value();
|
||||||
if ( ! empty( $arrow_user_defined ) ) {
|
if ( ! empty( $arrow_user_defined ) ) {
|
||||||
$arrow = $arrow_user_defined;
|
$arrow = $arrow_user_defined;
|
||||||
}
|
}
|
||||||
|
@ -1743,12 +1737,12 @@ class Parser {
|
||||||
* Initially an appended comma was hard-coded in this algorithm for enumerations.
|
* Initially an appended comma was hard-coded in this algorithm for enumerations.
|
||||||
* The comma in enumerations is not universally preferred.
|
* The comma in enumerations is not universally preferred.
|
||||||
*/
|
*/
|
||||||
if ( Convert::to_bool( Settings::instance()->get( BACKLINKS_SEPARATOR_ENABLED['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_SEPARATOR_ENABLED['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
if ( empty( $separator ) ) {
|
if ( empty( $separator ) ) {
|
||||||
|
|
||||||
// If it is not, check which option is on.
|
// If it is not, check which option is on.
|
||||||
$separator_option = Settings::instance()->get( BACKLINKS_SEPARATOR_OPTION['key'] );
|
$separator_option = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_SEPARATOR_OPTION['key'] )->get_value();
|
||||||
// TODO: replace with `match` (but currently it breaks the Rector
|
// TODO: replace with `match` (but currently it breaks the Rector
|
||||||
// downgrade to PHP 7.4.
|
// downgrade to PHP 7.4.
|
||||||
// https://github.com/rectorphp/rector/issues/6315
|
// https://github.com/rectorphp/rector/issues/6315
|
||||||
|
@ -1763,7 +1757,7 @@ class Parser {
|
||||||
$separator = ' –';
|
$separator = ' –';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$separator = Settings::instance()->get( BACKLINKS_SEPARATOR_CUSTOM['key'] );
|
$separator = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_SEPARATOR_CUSTOM['key'] )->get_value();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1777,12 +1771,12 @@ class Parser {
|
||||||
*
|
*
|
||||||
* Initially a dot was appended in the table row template.
|
* Initially a dot was appended in the table row template.
|
||||||
*/
|
*/
|
||||||
if ( Convert::to_bool( Settings::instance()->get( BACKLINKS_TERMINATOR_ENABLED['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_TERMINATOR_ENABLED['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
if ( empty( $terminator ) ) {
|
if ( empty( $terminator ) ) {
|
||||||
|
|
||||||
// If it is not, check which option is on.
|
// If it is not, check which option is on.
|
||||||
$terminator_option = Settings::instance()->get( BACKLINKS_TERMINATOR_OPTION['key'] );
|
$terminator_option = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_TERMINATOR_OPTION['key'] )->get_value();
|
||||||
// TODO: replace with `match` (but currently it breaks the Rector
|
// TODO: replace with `match` (but currently it breaks the Rector
|
||||||
// downgrade to PHP 7.4.
|
// downgrade to PHP 7.4.
|
||||||
// https://github.com/rectorphp/rector/issues/6315
|
// https://github.com/rectorphp/rector/issues/6315
|
||||||
|
@ -1797,7 +1791,7 @@ class Parser {
|
||||||
$terminator = ':';
|
$terminator = ':';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$terminator = Settings::instance()->get( BACKLINKS_TERMINATOR_CUSTOM['key'] );
|
$terminator = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_TERMINATOR_CUSTOM['key'] )->get_value();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1814,7 +1808,7 @@ class Parser {
|
||||||
* Variable number length and proportional character width require explicit line breaks.
|
* Variable number length and proportional character width require explicit line breaks.
|
||||||
* Otherwise, an ordinary space character offering a line break opportunity is inserted.
|
* Otherwise, an ordinary space character offering a line break opportunity is inserted.
|
||||||
*/
|
*/
|
||||||
$line_break = Convert::to_bool( Settings::instance()->get( BACKLINKS_LINE_BREAKS_ENABLED['key'] ) ) ? '<br />' : ' ';
|
$line_break = ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::BACKLINKS_LINE_BREAKS_ENABLED['key'] )->get_value() ) ? '<br />' : ' ';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Line breaks for source readability.
|
* Line breaks for source readability.
|
||||||
|
@ -1828,7 +1822,7 @@ class Parser {
|
||||||
/*
|
/*
|
||||||
* Reference container table row template load.
|
* Reference container table row template load.
|
||||||
*/
|
*/
|
||||||
$combine_identical_footnotes = Convert::to_bool( Settings::instance()->get( COMBINE_IDENTICAL_FOOTNOTES['key'] ) );
|
$combine_identical_footnotes = ( Settings::instance()->get_setting( NumberingSettingsGroup::COMBINE_IDENTICAL_FOOTNOTES['key'] )->get_value() );
|
||||||
|
|
||||||
// AMP compatibility requires a full set of AMP compatible table row templates.
|
// AMP compatibility requires a full set of AMP compatible table row templates.
|
||||||
if ( General::$amp_enabled ) {
|
if ( General::$amp_enabled ) {
|
||||||
|
@ -1836,9 +1830,9 @@ class Parser {
|
||||||
if ( $combine_identical_footnotes ) {
|
if ( $combine_identical_footnotes ) {
|
||||||
// The combining template allows for backlink clusters and supports cell clicking for single notes.
|
// The combining template allows for backlink clusters and supports cell clicking for single notes.
|
||||||
$template = new Template( Template::PUBLIC, 'amp-reference-container-body-combi' );
|
$template = new Template( Template::PUBLIC, 'amp-reference-container-body-combi' );
|
||||||
} elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE['key'] ) ) ) {
|
} elseif ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE['key'] )->get_value() ) ) {
|
||||||
$template = new Template( Template::PUBLIC, 'amp-reference-container-body-3column' );
|
$template = new Template( Template::PUBLIC, 'amp-reference-container-body-3column' );
|
||||||
} elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] ) ) ) {
|
} elseif ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] )->get_value() ) ) {
|
||||||
$template = new Template( Template::PUBLIC, 'amp-reference-container-body-switch' );
|
$template = new Template( Template::PUBLIC, 'amp-reference-container-body-switch' );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1849,9 +1843,9 @@ class Parser {
|
||||||
} elseif ( $combine_identical_footnotes ) {
|
} elseif ( $combine_identical_footnotes ) {
|
||||||
// The combining template allows for backlink clusters and supports cell clicking for single notes.
|
// The combining template allows for backlink clusters and supports cell clicking for single notes.
|
||||||
$template = new Template( Template::PUBLIC, 'reference-container-body-combi' );
|
$template = new Template( Template::PUBLIC, 'reference-container-body-combi' );
|
||||||
} elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE['key'] ) ) ) {
|
} elseif ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE['key'] )->get_value() ) ) {
|
||||||
$template = new Template( Template::PUBLIC, 'reference-container-body-3column' );
|
$template = new Template( Template::PUBLIC, 'reference-container-body-3column' );
|
||||||
} elseif ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] ) ) ) {
|
} elseif ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] )->get_value() ) ) {
|
||||||
$template = new Template( Template::PUBLIC, 'reference-container-body-switch' );
|
$template = new Template( Template::PUBLIC, 'reference-container-body-switch' );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1863,7 +1857,7 @@ class Parser {
|
||||||
/*
|
/*
|
||||||
* Switch backlink symbol and footnote number.
|
* Switch backlink symbol and footnote number.
|
||||||
*/
|
*/
|
||||||
$symbol_switch = Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] ) );
|
$symbol_switch = ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH['key'] )->get_value() );
|
||||||
|
|
||||||
// Loop through all footnotes found in the page.
|
// Loop through all footnotes found in the page.
|
||||||
$num_footnotes = count( self::$footnotes );
|
$num_footnotes = count( self::$footnotes );
|
||||||
|
@ -1883,7 +1877,7 @@ class Parser {
|
||||||
|
|
||||||
// Get the footnote index string and.
|
// Get the footnote index string and.
|
||||||
// Keep supporting legacy index placeholder.
|
// Keep supporting legacy index placeholder.
|
||||||
$footnote_id = Convert::index( ( $index + 1 ), Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) );
|
$footnote_id = Convert::index( $index + 1, Settings::instance()->get_setting( NumberingSettingsGroup::FOOTNOTES_COUNTER_STYLE['key'] )->get_value() );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Case of only one backlink per table row.
|
* Case of only one backlink per table row.
|
||||||
|
@ -1903,9 +1897,9 @@ class Parser {
|
||||||
*
|
*
|
||||||
* @since 2.5.4
|
* @since 2.5.4
|
||||||
*/
|
*/
|
||||||
if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) {
|
if ( Settings::instance()->get_setting( HardLinksSettingsGroup::FOOTNOTES_BACKLINK_TOOLTIP_ENABLE['key'] )->get_value() ) {
|
||||||
$use_backbutton_hint = ' title="';
|
$use_backbutton_hint = ' title="';
|
||||||
$use_backbutton_hint .= Settings::instance()->get( Settings::FOOTNOTES_BACKLINK_TOOLTIP_TEXT );
|
$use_backbutton_hint .= Settings::instance()->get_setting( HardLinksSettingsGroup::FOOTNOTES_BACKLINK_TOOLTIP_TEXT['key'] )->get_value();
|
||||||
$use_backbutton_hint .= '"';
|
$use_backbutton_hint .= '"';
|
||||||
} else {
|
} else {
|
||||||
$use_backbutton_hint = '';
|
$use_backbutton_hint = '';
|
||||||
|
@ -2028,7 +2022,7 @@ class Parser {
|
||||||
$flag_combined = true;
|
$flag_combined = true;
|
||||||
|
|
||||||
// Update the footnote ID.
|
// Update the footnote ID.
|
||||||
$footnote_id = Convert::index( ( $check_index + 1 ), Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) );
|
$footnote_id = Convert::index( ( $check_index + 1 ), Settings::instance()->get_setting( NumberingSettingsGroup::FOOTNOTES_COUNTER_STYLE['key'] )->get_value() );
|
||||||
|
|
||||||
// Resume composing the backlinks enumeration.
|
// Resume composing the backlinks enumeration.
|
||||||
$footnote_backlinks .= "$separator</";
|
$footnote_backlinks .= "$separator</";
|
||||||
|
@ -2091,10 +2085,10 @@ class Parser {
|
||||||
$has_tooltip_text = (bool) $tooltip_text_length;
|
$has_tooltip_text = (bool) $tooltip_text_length;
|
||||||
if ( $has_tooltip_text ) {
|
if ( $has_tooltip_text ) {
|
||||||
$not_tooltip_text = substr( $footnote_text, ( $tooltip_text_length + self::$tooltip_shortcode_length ) );
|
$not_tooltip_text = substr( $footnote_text, ( $tooltip_text_length + self::$tooltip_shortcode_length ) );
|
||||||
self::$mirror_tooltip_text = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) );
|
self::$mirror_tooltip_text = Settings::instance()->get_setting( TooltipTextSettingsGroup::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE['key'] )->get_value();
|
||||||
if ( self::$mirror_tooltip_text ) {
|
if ( self::$mirror_tooltip_text ) {
|
||||||
$tooltip_text = substr( $footnote_text, 0, $tooltip_text_length );
|
$tooltip_text = substr( $footnote_text, 0, $tooltip_text_length );
|
||||||
$reference_text_introducer = Settings::instance()->get( Settings::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR );
|
$reference_text_introducer = Settings::instance()->get_setting( TooltipTextSettingsGroup::FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR['key'] )->get_value();
|
||||||
$reference_text = $tooltip_text . $reference_text_introducer . $not_tooltip_text;
|
$reference_text = $tooltip_text . $reference_text_introducer . $not_tooltip_text;
|
||||||
} else {
|
} else {
|
||||||
$reference_text = $not_tooltip_text;
|
$reference_text = $not_tooltip_text;
|
||||||
|
@ -2113,7 +2107,7 @@ class Parser {
|
||||||
// Used in standard layout W/O COMBINED FOOTNOTES.
|
// Used in standard layout W/O COMBINED FOOTNOTES.
|
||||||
'post_id' => self::$post_id,
|
'post_id' => self::$post_id,
|
||||||
'container_id' => self::$reference_container_id,
|
'container_id' => self::$reference_container_id,
|
||||||
'note_id' => Convert::index( $first_footnote_index, Settings::instance()->get( Settings::FOOTNOTES_COUNTER_STYLE ) ),
|
'note_id' => Convert::index( $first_footnote_index, Settings::instance()->get_setting( NumberingSettingsGroup::FOOTNOTES_COUNTER_STYLE['key'] )->get_value() ),
|
||||||
'link-start' => self::$link_open_tag,
|
'link-start' => self::$link_open_tag,
|
||||||
'link-end' => self::$link_close_tag,
|
'link-end' => self::$link_close_tag,
|
||||||
'link-span' => self::$link_span,
|
'link-span' => self::$link_span,
|
||||||
|
@ -2141,11 +2135,11 @@ class Parser {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call again for robustness when priority levels don’t match any longer.
|
// Call again for robustness when priority levels don't match any longer.
|
||||||
self::$scroll_offset = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_OFFSET );
|
self::$scroll_offset = Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_SCROLL_OFFSET['key'] )->get_value();
|
||||||
|
|
||||||
// Streamline.
|
// Streamline.
|
||||||
$collapse_default = Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) );
|
$collapse_default = ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_COLLAPSE['key'] )->get_value() );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reference container label.
|
* Reference container label.
|
||||||
|
@ -2154,14 +2148,14 @@ class Parser {
|
||||||
* In case of empty label that would apply to the left half button character.
|
* In case of empty label that would apply to the left half button character.
|
||||||
* Hence the point in setting an empty label to U+202F NARROW NO-BREAK SPACE.
|
* Hence the point in setting an empty label to U+202F NARROW NO-BREAK SPACE.
|
||||||
*/
|
*/
|
||||||
$reference_container_label = Settings::instance()->get( REFERENCE_CONTAINER_NAME['key'] );
|
$reference_container_label = Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_NAME['key'] )->get_value();
|
||||||
|
|
||||||
// Select the reference container template.
|
// Select the reference container template.
|
||||||
// Whether AMP compatibility mode is enabled.
|
// Whether AMP compatibility mode is enabled.
|
||||||
if ( General::$amp_enabled ) {
|
if ( General::$amp_enabled ) {
|
||||||
|
|
||||||
// Whether the reference container is collapsed by default.
|
// Whether the reference container is collapsed by default.
|
||||||
if ( Convert::to_bool( Settings::instance()->get( REFERENCE_CONTAINER_COLLAPSE['key'] ) ) ) {
|
if ( ( Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_COLLAPSE['key'] )->get_value() ) ) {
|
||||||
|
|
||||||
// Load 'public/partials/amp-reference-container-collapsed.html'.
|
// Load 'public/partials/amp-reference-container-collapsed.html'.
|
||||||
$template_container = new Template( Template::PUBLIC, 'amp-reference-container-collapsed' );
|
$template_container = new Template( Template::PUBLIC, 'amp-reference-container-collapsed' );
|
||||||
|
@ -2191,11 +2185,11 @@ class Parser {
|
||||||
if ( 'jquery' === General::$script_mode ) {
|
if ( 'jquery' === General::$script_mode ) {
|
||||||
|
|
||||||
$scroll_offset = ( self::$scroll_offset / 100 );
|
$scroll_offset = ( self::$scroll_offset / 100 );
|
||||||
$scroll_up_duration = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DURATION );
|
$scroll_up_duration = Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_SCROLL_DURATION['key'] )->get_value();
|
||||||
|
|
||||||
if ( Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY ) ) ) {
|
if ( Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY['key'] )->get_value() ) {
|
||||||
|
|
||||||
$scroll_down_duration = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DOWN_DURATION );
|
$scroll_down_duration = Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_SCROLL_DOWN_DURATION['key'] )->get_value();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -2203,8 +2197,8 @@ class Parser {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scroll_down_delay = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_DOWN_DELAY );
|
$scroll_down_delay = Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_SCROLL_DOWN_DELAY['key'] )->get_value();
|
||||||
$scroll_up_delay = (int) Settings::instance()->get( Settings::FOOTNOTES_SCROLL_UP_DELAY );
|
$scroll_up_delay = Settings::instance()->get_setting( ScrollingSettingsGroup::FOOTNOTES_SCROLL_UP_DELAY['key'] )->get_value();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2212,7 +2206,7 @@ class Parser {
|
||||||
array(
|
array(
|
||||||
'post_id' => self::$post_id,
|
'post_id' => self::$post_id,
|
||||||
'container_id' => self::$reference_container_id,
|
'container_id' => self::$reference_container_id,
|
||||||
'element' => Settings::instance()->get( REFERENCE_CONTAINER_LABEL_ELEMENT ),
|
'element' => Settings::instance()->get_setting( ReferenceContainerSettingsGroup::REFERENCE_CONTAINER_LABEL_ELEMENT ),
|
||||||
'name' => empty( $reference_container_label ) ? ' ' : $reference_container_label,
|
'name' => empty( $reference_container_label ) ? ' ' : $reference_container_label,
|
||||||
'button-style' => $collapse_default ? '' : 'display: none;',
|
'button-style' => $collapse_default ? '' : 'display: none;',
|
||||||
'style' => $collapse_default ? 'display: none;' : '',
|
'style' => $collapse_default ? 'display: none;' : '',
|
||||||
|
|
Reference in a new issue