commit
e5f1ca92b1
14 changed files with 414 additions and 230 deletions
|
@ -209,16 +209,15 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
* automated update of version number for cache busting.
|
||||
* No need to use '-styles' in the handle, as '-css' is appended automatically.
|
||||
*/
|
||||
wp_register_style(
|
||||
'mci-footnotes-admin',
|
||||
plugins_url( 'footnotes/css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css' ),
|
||||
array(),
|
||||
( PRODUCTION_ENV ) ? C_STR_PACKAGE_VERSION : filemtime(
|
||||
plugin_dir_path(
|
||||
dirname( __FILE__, 2 )
|
||||
) . 'css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css'
|
||||
)
|
||||
);
|
||||
if ( true === PRODUCTION_ENV ) {
|
||||
|
||||
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_FOOTNOTES_VERSION );
|
||||
|
||||
} else {
|
||||
|
||||
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), C_STR_FOOTNOTES_VERSION );
|
||||
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'mci-footnotes-admin' );
|
||||
}
|
||||
|
@ -339,6 +338,21 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
* @since 1.5.0
|
||||
* @param string $p_str_setting_key_name Settings Array key name.
|
||||
* @return array Contains Settings ID, Settings Name and Settings Value.
|
||||
*
|
||||
* @since 2.5.11 Remove escapement function.
|
||||
* When refactoring the codebase after 2.5.8, all and every output was escaped.
|
||||
* After noticing that the plugin was broken, all escapement functions were removed.
|
||||
* @link https://github.com/markcheret/footnotes/pull/50/commits/25c3f2f12eb5de1079e9215bf624ec4289b095a5
|
||||
* @link https://github.com/markcheret/footnotes/pull/50#issuecomment-787624123
|
||||
* In that process, this instance of esc_attr() was removed too, so the plugin was
|
||||
* broken again.
|
||||
* @link https://github.com/markcheret/footnotes/pull/50/commits/25c3f2f12eb5de1079e9215bf624ec4289b095a5#diff-a8ed6e859c32a18fc10bbbad3b4dd8ce7f43f2378d29471c7638e314ab30f1bdL349-L354
|
||||
*
|
||||
* @since 2.5.15 To fix it, the data was escaped in add_select_box() instead.
|
||||
* @since 2.6.1 Restore esc_attr() in load_setting().
|
||||
* @see add_select_box()
|
||||
* This is the only instance of esc_|kses|sanitize in the pre-2.5.11 codebase.
|
||||
* Removing this did not fix the quotation mark backslash escapement bug.
|
||||
*/
|
||||
protected function load_setting( $p_str_setting_key_name ) {
|
||||
// Get current section.
|
||||
|
@ -346,7 +360,7 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
$p_arr_return = array();
|
||||
$p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name );
|
||||
$p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name );
|
||||
$p_arr_return['value'] = MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name );
|
||||
$p_arr_return['value'] = esc_attr( MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name ) );
|
||||
return $p_arr_return;
|
||||
}
|
||||
|
||||
|
@ -457,20 +471,31 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
* Returns the html tag for a select box.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* - Bugfix: Dashboard: Referrers and tooltips: Backlink symbol: debug select box by reverting identity check to equality check, thanks to @lolzim bug report.
|
||||
*
|
||||
* @reporter @lolzim
|
||||
*
|
||||
* @since 2.5.13
|
||||
* @param string $p_str_setting_name Name of the Settings key to pre select the current value.
|
||||
* @param array $p_arr_options Possible options to be selected.
|
||||
* @return string
|
||||
*
|
||||
* @since 2.5.15 Bugfix: Dashboard: General settings: Footnote start and end short codes: debug select box for shortcodes with pointy brackets.
|
||||
* @since 2.6.1 Restore esc_attr() in load_setting(), remove htmlspecialchars() here.
|
||||
*/
|
||||
protected function add_select_box( $p_str_setting_name, $p_arr_options ) {
|
||||
// Collect data for given settings field.
|
||||
$l_arr_data = $this->load_setting( $p_str_setting_name );
|
||||
$l_str_options = '';
|
||||
|
||||
// Loop through all array keys.
|
||||
foreach ( $p_arr_options as $l_str_value => $l_str_caption ) {
|
||||
$l_str_options .= sprintf(
|
||||
'<option value="%s" %s>%s</option>',
|
||||
$l_str_value,
|
||||
$l_str_value === $l_arr_data['value'] ? 'selected' : '',
|
||||
// Only check for equality, not identity, WRT backlink symbol arrows.
|
||||
$l_str_value == $l_arr_data['value'] ? 'selected' : '',
|
||||
$l_str_caption
|
||||
);
|
||||
}
|
||||
|
@ -528,7 +553,8 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
* @param bool $p_bool_deci true if 0.1 steps and floating to string, false if integer (default).
|
||||
* @return string
|
||||
*
|
||||
* @since 2.1.4 step argument and number_format() to allow decimals.
|
||||
* Edited:
|
||||
* @since 2.1.4 step argument and number_format() to allow decimals ..
|
||||
*/
|
||||
protected function add_num_box( $p_str_setting_name, $p_in_min, $p_int_max, $p_bool_deci = false ) {
|
||||
// Collect data for given settings field.
|
||||
|
|
|
@ -159,7 +159,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
}
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-new', __( 'Custom CSS', 'footnotes' ), 'custom_css_new' );
|
||||
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'help', __( 'Brief introduction in how to use the plugin', 'footnotes' ), 'help' );
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'help', __( 'Brief introduction: How to use the plugin', 'footnotes' ), 'help' );
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'donate', __( 'Help us to improve our Plugin', 'footnotes' ), 'donate' );
|
||||
|
||||
return $l_arr_meta_boxes;
|
||||
|
@ -287,12 +287,16 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-position' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ),
|
||||
'position' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_positions ),
|
||||
// Translators: %s: at the end of the post.
|
||||
'notice-position' => sprintf( __( 'To use the position shortcode, please set the position to: %s', 'footnotes' ), '<span style="font-style: normal;">' . __( 'at the end of the post', 'footnotes' ) . '</span>' ),
|
||||
'notice-position' => sprintf( __( 'To use the position or section shortcode, please set the position to: %s', 'footnotes' ), '<span style="font-style: normal;">' . __( 'at the end of the post', 'footnotes' ) . '</span>' ),
|
||||
|
||||
'label-shortcode' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ),
|
||||
'shortcode' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE ),
|
||||
'notice-shortcode' => __( 'If present in the content, any shortcode in this text box will be replaced with the reference container.', 'footnotes' ),
|
||||
|
||||
'label-section' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ),
|
||||
'section' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ),
|
||||
'notice-section' => __( 'If present in the content, any shortcode in this text box will delimit a section terminated by a reference container.', 'footnotes' ),
|
||||
|
||||
'label-startpage' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ),
|
||||
'startpage' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_enabled ),
|
||||
|
||||
|
@ -357,7 +361,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-link' => $this->add_label( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ),
|
||||
'link' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, $l_arr_enabled ),
|
||||
'notice-link' => __( 'The link element is needed to apply the theme\'s link color.', 'footnotes' ),
|
||||
'description-link' => __( 'If the link element is not desired for styling, a simple span is used instead when the above is set to No. The link addresses have been removed. Else footnote clicks are logged in the browsing history and make the back button unusable.', 'footnotes' ),
|
||||
'description-link' => __( 'If the link element is not desired for styling, a simple span is used instead when the above is set to No.', 'footnotes' ),
|
||||
)
|
||||
);
|
||||
// Display template with replaced placeholders.
|
||||
|
@ -422,8 +426,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Replace all placeholders.
|
||||
$l_obj_template->replace(
|
||||
array(
|
||||
// Translators: The 2 placeholders are the <ref></ref> and <fn></fn> shortcodes.
|
||||
'description-escapement' => sprintf( __( 'The problems with shortcodes with pointy brackets have been solved. We apologize for the longlasting bugs making the %1$s and %2$s shortcodes close to unusable.', 'footnotes' ), '<ref></ref>', '<fn></fn>' ),
|
||||
'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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ),
|
||||
'short-code-start' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ),
|
||||
|
@ -470,12 +473,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
);
|
||||
// Options for the numbering style of the footnotes.
|
||||
$l_arr_counter_style = array(
|
||||
'arabic_plain' => __( 'plain Arabic numbers', 'footnotes' ) . $l_str_space . '1, 2, 3, 4, 5, ...',
|
||||
'arabic_leading' => __( 'zero-padded Arabic numbers', 'footnotes' ) . $l_str_space . '01, 02, 03, 04, 05, ...',
|
||||
'latin_low' => __( 'lowercase Latin letters', 'footnotes' ) . $l_str_space . 'a, b, c, d, e, ...',
|
||||
'latin_high' => __( 'uppercase Latin letters', 'footnotes' ) . $l_str_space . 'A, B, C, D, E, ...',
|
||||
'romanic' => __( 'uppercase Roman numerals', 'footnotes' ) . $l_str_space . 'I, II, III, IV, V, ...',
|
||||
'roman_low' => __( 'lowercase Roman numerals', 'footnotes' ) . $l_str_space . 'i, ii, iii, iv, v, ...',
|
||||
'arabic_plain' => __( 'plain Arabic numbers', 'footnotes' ) . $l_str_space . '1, 2, 3, 4, 5, …',
|
||||
'arabic_leading' => __( 'zero-padded Arabic numbers', 'footnotes' ) . $l_str_space . '01, 02, 03, 04, 05, …',
|
||||
'latin_low' => __( 'lowercase Latin letters', 'footnotes' ) . $l_str_space . 'a, b, c, d, e, …',
|
||||
'latin_high' => __( 'uppercase Latin letters', 'footnotes' ) . $l_str_space . 'A, B, C, D, E, …',
|
||||
'romanic' => __( 'uppercase Roman numerals', 'footnotes' ) . $l_str_space . 'I, II, III, IV, V, …',
|
||||
'roman_low' => __( 'lowercase Roman numerals', 'footnotes' ) . $l_str_space . 'i, ii, iii, iv, v, …',
|
||||
);
|
||||
|
||||
// Load template file.
|
||||
|
@ -595,7 +598,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Enable backlink tooltips.
|
||||
'label-backlink-tooltips' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ),
|
||||
'backlink-tooltips' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_enable ),
|
||||
'notice-backlink-tooltips' => __( 'Hard backlinks get ordinary tooltips hinting to use the backbutton instead.', 'footnotes' ),
|
||||
'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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ),
|
||||
'backlink-tooltip-text' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ),
|
||||
|
@ -648,7 +651,6 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Translators: %s: Footnotes plugin logo.
|
||||
'label-love' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ),
|
||||
'love' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_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' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ),
|
||||
'no-love' => $this->add_text( MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG ),
|
||||
|
@ -661,7 +663,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Displays the excerpt setting.
|
||||
* Displays the footnotes in excerpt setting.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
|
@ -672,10 +674,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
* @since 2.2.0 dedicated to the excerpt setting and its notices
|
||||
*/
|
||||
public function excerpts() {
|
||||
// Options for Yes/No select box.
|
||||
$l_arr_enabled = array(
|
||||
'yes' => __( 'Yes', 'footnotes' ),
|
||||
'no' => __( 'No', 'footnotes' ),
|
||||
// Options for options select box.
|
||||
$l_arr_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.
|
||||
|
@ -683,12 +686,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Replace all placeholders.
|
||||
$l_obj_template->replace(
|
||||
array(
|
||||
'label-excerpts' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, __( 'Display footnotes in excerpts:', 'footnotes' ) ),
|
||||
'excerpts' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, $l_arr_enabled ),
|
||||
'notice-excerpts' => __( 'For this setting to be effective, the hook the_excerpt must be enabled under Scope and priority.', 'footnotes' ),
|
||||
// Translators: %s: link text 'Advanced Excerpt' linked to the plugin's WordPress.org front page.
|
||||
'label-excerpts' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ),
|
||||
'excerpts' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, $l_arr_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( __( 'Both to display footnotes and to not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to ensure that footnotes are handled and don\'t impact the excerpt length.', 'footnotes' ), '<span style="font-style: normal;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
'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;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
)
|
||||
);
|
||||
// Display template with replaced placeholders.
|
||||
|
@ -1302,9 +1305,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Displays a short introduction of the Plugin.
|
||||
* Displays a short introduction to the Plugin.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @since 2.7.0 Sanitize Lorem Ipsum filler text.
|
||||
* @link https://blog.prototypr.io/why-testing-with-real-content-is-better-than-lorem-ipsum-c7c79586ee72
|
||||
*/
|
||||
public function Help() {
|
||||
global $g_obj_mci_footnotes;
|
||||
|
@ -1318,18 +1324,18 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
$l_arr_footnote_ending_tag = $this->load_setting( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
|
||||
}
|
||||
$l_str_example = 'Hello' . $l_arr_footnote_starting_tag['value'] .
|
||||
'Lorem ipsum dolor sit amet, consetetur sadipscing ' .
|
||||
'elitr, sed diam nonumy eirmod tempor invidunt ut ' .
|
||||
'labore et dolore magna aliquyam erat, sed diam ' .
|
||||
'voluptua. At vero eos et accusam et justo duo dolores ' .
|
||||
'et ea rebum. Stet clita kasd gubergren, no sea ' .
|
||||
'takimata sanctus est Lorem ipsum dolor sit amet. ' .
|
||||
'Lorem ipsum dolor sit amet, consetetur sadipscing ' .
|
||||
'elitr, sed diam nonumy eirmod tempor invidunt ut ' .
|
||||
'labore et dolore magna aliquyam erat, sed diam ' .
|
||||
'voluptua. At vero eos et accusam et justo duo ' .
|
||||
'dolores et ea rebum. Stet clita kasd gubergren, no ' .
|
||||
'sea takimata sanctus est Lorem ipsum dolor sit amet.' .
|
||||
'Sed ut perspiciatis, unde omnis iste natus error ' .
|
||||
'sit voluptatem accusantium doloremque laudantium, ' .
|
||||
'totam rem aperiam eaque ipsa, quae ab illo ' .
|
||||
'inventore veritatis et quasi architecto beatae ' .
|
||||
'vitae dicta sunt, explicabo. Nemo enim ipsam ' .
|
||||
'voluptatem, quia voluptas sit, aspernatur aut ' .
|
||||
'odit aut fugit, sed quia consequuntur magni ' .
|
||||
'dolores eos, qui ratione voluptatem sequi nesciunt, ' .
|
||||
'neque porro quisquam est, qui dolorem ipsum, quia ' .
|
||||
'dolor sit amet, consectetur, adipisci velit, sed ' .
|
||||
'quia non numquam eius modi tempora incidunt, ut ' .
|
||||
'labore et dolore magnam aliquam quaerat voluptatem.' .
|
||||
$l_arr_footnote_ending_tag['value'] . ' World!';
|
||||
|
||||
// Load template file.
|
||||
|
@ -1339,17 +1345,32 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
array(
|
||||
'label-start' => __( 'Start your footnote with the following short code:', 'footnotes' ),
|
||||
'start' => $l_arr_footnote_starting_tag['value'],
|
||||
'label-end' => __( '...and end your footnote with this short code:', 'footnotes' ),
|
||||
'label-end' => __( '…and end your footnote with this short code:', 'footnotes' ),
|
||||
'end' => $l_arr_footnote_ending_tag['value'],
|
||||
'example-code' => $l_str_example,
|
||||
'example-string' => '<br/>' . __( 'will be displayed as:', 'footnotes' ),
|
||||
'example' => $g_obj_mci_footnotes->a_obj_task->exec( $l_str_example, true ),
|
||||
// Translators: 1: <a>; 2: </a>.
|
||||
'information' => sprintf( __( 'For further information please check out our %1$ssupport forum%2$s on WordPress.org.', 'footnotes' ), '<a href="https://wordpress.org/support/plugin/footnotes" target="_blank" class="footnote_plugin">', '</a>' ),
|
||||
// Translators: %1$s, %2$s: anchor element with hyperlink to the Support Forum.
|
||||
'information' => sprintf( __( 'For further information please check out our %1$sSupport Forum%2$s on WordPress.org.', 'footnotes' ), '<a href="https://wordpress.org/support/plugin/footnotes" target="_blank" class="footnote_plugin">', '</a>' ),
|
||||
)
|
||||
);
|
||||
// Call wp_head function to get the Styling of the mouse-over box.
|
||||
|
||||
/**
|
||||
* Call footnotes_output_head function to get the Styling of the mouse-over box.
|
||||
*
|
||||
* - Bugfix: Dashboard: debug the 'Quick start guide' tab, thanks to @rumperuu bug report.
|
||||
*
|
||||
* @reporter @rumperuu
|
||||
* @link https://github.com/markcheret/footnotes/issues/71
|
||||
*
|
||||
* @since 2.7.0
|
||||
* The name of the callback function ought to be distinct from
|
||||
* the name of the filtered function.
|
||||
* When this callback function was renamed, this call went unnoticed.
|
||||
* @see class/task.php
|
||||
*/
|
||||
$g_obj_mci_footnotes->a_obj_task->footnotes_output_head();
|
||||
|
||||
// Display template with replaced placeholders.
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo $l_obj_template->get_content();
|
||||
|
@ -1376,4 +1397,3 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// phpcs:enable
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* @filesource
|
||||
* @package footnotes
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -51,7 +49,7 @@ class MCI_Footnotes_Hooks {
|
|||
* @since 1.5.0
|
||||
*
|
||||
* @since 2.2.0 this function is not called any longer when deleting the plugin.
|
||||
* Note: clear_all() didn’t actually work.
|
||||
* Note: clear_all() didn't actually work.
|
||||
* @see class/settings.php
|
||||
*/
|
||||
public static function uninstall_plugin() {
|
||||
|
|
|
@ -84,7 +84,7 @@ class MCI_Footnotes {
|
|||
* @since 2.6.0 (release)
|
||||
*
|
||||
* @contributor @milindmore22
|
||||
* @link @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
*
|
||||
* @contributor @westonruter
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785419655
|
||||
|
@ -354,7 +354,7 @@ class MCI_Footnotes {
|
|||
* Plugin version number is needed for busting browser caches after each plugin update.
|
||||
*
|
||||
* @since 2.1.4 automate passing version number for cache busting.
|
||||
* The constant C_STR_PACKAGE_VERSION is defined at start of footnotes.php.
|
||||
* The constant C_STR_FOOTNOTES_VERSION is defined at start of footnotes.php.
|
||||
*
|
||||
* The media scope argument 'all' is the default.
|
||||
* No need to use '-css' in the handle, as this is appended automatically.
|
||||
|
@ -405,7 +405,7 @@ class MCI_Footnotes {
|
|||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'brpl' . $l_str_layout_mode . '.min.css'
|
||||
),
|
||||
array(),
|
||||
C_STR_PACKAGE_VERSION,
|
||||
C_STR_FOOTNOTES_VERSION,
|
||||
'all'
|
||||
);
|
||||
|
||||
|
|
|
@ -209,15 +209,16 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
* automated update of version number for cache busting.
|
||||
* No need to use '-styles' in the handle, as '-css' is appended automatically.
|
||||
*/
|
||||
if ( true === PRODUCTION_ENV ) {
|
||||
|
||||
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_PACKAGE_VERSION );
|
||||
|
||||
} else {
|
||||
|
||||
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), C_STR_PACKAGE_VERSION );
|
||||
|
||||
}
|
||||
wp_register_style(
|
||||
'mci-footnotes-admin',
|
||||
plugins_url( 'footnotes/css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css' ),
|
||||
array(),
|
||||
( PRODUCTION_ENV ) ? C_STR_PACKAGE_VERSION : filemtime(
|
||||
plugin_dir_path(
|
||||
dirname( __FILE__, 2 )
|
||||
) . 'css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css'
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_style( 'mci-footnotes-admin' );
|
||||
}
|
||||
|
@ -360,7 +361,7 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
$p_arr_return = array();
|
||||
$p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name );
|
||||
$p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name );
|
||||
$p_arr_return['value'] = esc_attr( MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name ) );
|
||||
$p_arr_return['value'] = MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name );
|
||||
return $p_arr_return;
|
||||
}
|
||||
|
||||
|
@ -553,7 +554,6 @@ abstract class MCI_Footnotes_Layout_Engine {
|
|||
* @param bool $p_bool_deci true if 0.1 steps and floating to string, false if integer (default).
|
||||
* @return string
|
||||
*
|
||||
* Edited:
|
||||
* @since 2.1.4 step argument and number_format() to allow decimals.
|
||||
*/
|
||||
protected function add_num_box( $p_str_setting_name, $p_in_min, $p_int_max, $p_bool_deci = false ) {
|
||||
|
|
|
@ -120,7 +120,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
*
|
||||
* @since 2.0.4 to reflect changes in meta box label display since WPv5.5
|
||||
* spans need position:fixed and become unlocalizable
|
||||
* fix: logo is kept only in the label that doesn’t need to be translated:
|
||||
* fix: logo is kept only in the label that doesn't need to be translated:
|
||||
* Change string "%s styling" to "Footnotes styling" to fix layout in WPv5.5
|
||||
* @see details in class/config.php
|
||||
*
|
||||
|
@ -159,7 +159,8 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
}
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-new', __( 'Custom CSS', 'footnotes' ), 'custom_css_new' );
|
||||
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'help', __( 'Brief introduction in how to use the plugin', 'footnotes' ), 'help' );
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'help', __( 'Brief introduction: How to use the plugin', 'footnotes' ), 'help' );
|
||||
|
||||
$l_arr_meta_boxes[] = $this->add_meta_box( 'how-to', 'donate', __( 'Help us to improve our Plugin', 'footnotes' ), 'donate' );
|
||||
|
||||
return $l_arr_meta_boxes;
|
||||
|
@ -178,13 +179,13 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Replace all placeholders.
|
||||
$l_obj_template->replace(
|
||||
array(
|
||||
// Translators: '%s' is the link text 'AMP-WP' linked to the plugin’s front page on WordPress.org.
|
||||
// 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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ),
|
||||
'amp' => $this->add_checkbox( MCI_Footnotes_Settings::C_STR_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;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
'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;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
)
|
||||
);
|
||||
// Display template with replaced placeholders.
|
||||
|
@ -236,7 +237,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
);
|
||||
// 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.
|
||||
// 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.
|
||||
$l_arr_terminators = array(
|
||||
'period' => __( 'FULL STOP', 'footnotes' ),
|
||||
|
@ -271,7 +272,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-name' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __( 'Heading:', 'footnotes' ) ),
|
||||
'name' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME ),
|
||||
|
||||
'label-element' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading’s HTML element:', 'footnotes' ) ),
|
||||
'label-element' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading\'s HTML element:', 'footnotes' ) ),
|
||||
'element' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, $l_arr_label_element ),
|
||||
|
||||
'label-border' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __( 'Border under the heading:', 'footnotes' ) ),
|
||||
|
@ -287,12 +288,16 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-position' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ),
|
||||
'position' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_positions ),
|
||||
// Translators: %s: at the end of the post.
|
||||
'notice-position' => sprintf( __( 'To use the position shortcode, please set the position to: %s', 'footnotes' ), '<span style="font-style: normal;">' . __( 'at the end of the post', 'footnotes' ) . '</span>' ),
|
||||
'notice-position' => sprintf( __( 'To use the position or section shortcode, please set the position to: %s', 'footnotes' ), '<span style="font-style: normal;">' . __( 'at the end of the post', 'footnotes' ) . '</span>' ),
|
||||
|
||||
'label-shortcode' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ),
|
||||
'shortcode' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE ),
|
||||
'notice-shortcode' => __( 'If present in the content, any shortcode in this text box will be replaced with the reference container.', 'footnotes' ),
|
||||
|
||||
'label-section' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ),
|
||||
'section' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ),
|
||||
'notice-section' => __( 'If present in the content, any shortcode in this text box will delimit a section terminated by a reference container.', 'footnotes' ),
|
||||
|
||||
'label-startpage' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ),
|
||||
'startpage' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_enabled ),
|
||||
|
||||
|
@ -306,11 +311,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
|
||||
'label-page-layout' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __( 'Apply basic responsive page layout:', 'footnotes' ) ),
|
||||
'page-layout' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_page_layout_options ),
|
||||
'notice-page-layout' => __( 'Most themes don’t need this fix.', 'footnotes' ),
|
||||
'notice-page-layout' => __( 'Most themes don\'t need this fix.', 'footnotes' ),
|
||||
|
||||
'label-url-wrap' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, __( 'Allow URLs to line-wrap anywhere:', 'footnotes' ) ),
|
||||
'url-wrap' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_enabled ),
|
||||
'notice-url-wrap' => __( 'Unicode-conformant browsers don’t need this fix.', 'footnotes' ),
|
||||
'notice-url-wrap' => __( 'Unicode-conformant browsers don\'t need this fix.', 'footnotes' ),
|
||||
|
||||
'label-symbol' => $this->add_label( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __( 'Display a backlink symbol:', 'footnotes' ) ),
|
||||
'symbol-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_enabled ),
|
||||
|
@ -342,13 +347,13 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'width-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_enabled ),
|
||||
'width-scalar' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true ),
|
||||
'width-unit' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_width_units ),
|
||||
'notice-width' => __( 'Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ),
|
||||
'notice-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ),
|
||||
|
||||
'label-max-width' => $this->add_label( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __( 'Set backlinks column maximum width:', 'footnotes' ) ),
|
||||
'max-width-enable' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_enabled ),
|
||||
'max-width-scalar' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true ),
|
||||
'max-width-unit' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_width_units ),
|
||||
'notice-max-width' => __( 'Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ),
|
||||
'notice-max-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ),
|
||||
|
||||
'label-line-break' => $this->add_label( MCI_Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, __( 'Stack backlinks when enumerating:', 'footnotes' ) ),
|
||||
'line-break' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_enabled ),
|
||||
|
@ -356,7 +361,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
|
||||
'label-link' => $this->add_label( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ),
|
||||
'link' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, $l_arr_enabled ),
|
||||
'notice-link' => __( 'The link element is needed to apply the theme’s link color.', 'footnotes' ),
|
||||
'notice-link' => __( 'The link element is needed to apply the theme\'s link color.', 'footnotes' ),
|
||||
'description-link' => __( 'If the link element is not desired for styling, a simple span is used instead when the above is set to No. The link addresses have been removed. Else footnote clicks are logged in the browsing history and make the back button unusable.', 'footnotes' ),
|
||||
)
|
||||
);
|
||||
|
@ -446,7 +451,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'syntax' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_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' ),
|
||||
'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.
|
||||
|
@ -470,12 +475,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
);
|
||||
// Options for the numbering style of the footnotes.
|
||||
$l_arr_counter_style = array(
|
||||
'arabic_plain' => __( 'plain Arabic numbers', 'footnotes' ) . $l_str_space . '1, 2, 3, 4, 5, …',
|
||||
'arabic_leading' => __( 'zero-padded Arabic numbers', 'footnotes' ) . $l_str_space . '01, 02, 03, 04, 05, …',
|
||||
'latin_low' => __( 'lowercase Latin letters', 'footnotes' ) . $l_str_space . 'a, b, c, d, e, …',
|
||||
'latin_high' => __( 'uppercase Latin letters', 'footnotes' ) . $l_str_space . 'A, B, C, D, E, …',
|
||||
'romanic' => __( 'uppercase Roman numerals', 'footnotes' ) . $l_str_space . 'I, II, III, IV, V, …',
|
||||
'roman_low' => __( 'lowercase Roman numerals', 'footnotes' ) . $l_str_space . 'i, ii, iii, iv, v, …',
|
||||
'arabic_plain' => __( 'plain Arabic numbers', 'footnotes' ) . $l_str_space . '1, 2, 3, 4, 5, ...',
|
||||
'arabic_leading' => __( 'zero-padded Arabic numbers', 'footnotes' ) . $l_str_space . '01, 02, 03, 04, 05, ...',
|
||||
'latin_low' => __( 'lowercase Latin letters', 'footnotes' ) . $l_str_space . 'a, b, c, d, e, ...',
|
||||
'latin_high' => __( 'uppercase Latin letters', 'footnotes' ) . $l_str_space . 'A, B, C, D, E, ...',
|
||||
'romanic' => __( 'uppercase Roman numerals', 'footnotes' ) . $l_str_space . 'I, II, III, IV, V, ...',
|
||||
'roman_low' => __( 'lowercase Roman numerals', 'footnotes' ) . $l_str_space . 'i, ii, iii, iv, v, ...',
|
||||
);
|
||||
|
||||
// Load template file.
|
||||
|
@ -595,7 +600,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Enable backlink tooltips.
|
||||
'label-backlink-tooltips' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ),
|
||||
'backlink-tooltips' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_enable ),
|
||||
'notice-backlink-tooltips' => __( 'Hard backlinks get ordinary tooltips hinting to use the backbutton instead.', 'footnotes' ),
|
||||
'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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ),
|
||||
'backlink-tooltip-text' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ),
|
||||
|
@ -637,7 +642,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), MCI_Footnotes_Config::C_STR_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' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL ),
|
||||
'no' => sprintf( __( 'no display of any "%1$s %2$s" mention in the footer', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL ),
|
||||
);
|
||||
|
||||
// Load template file.
|
||||
|
@ -646,7 +651,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
$l_obj_template->replace(
|
||||
array(
|
||||
// Translators: %s: Footnotes plugin logo.
|
||||
'label-love' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf( __( 'Tell the world you’re using %s:', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ),
|
||||
'label-love' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ),
|
||||
'love' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_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' ), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ),
|
||||
|
@ -660,7 +665,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Displays the excerpt setting.
|
||||
* Displays the footnotes in excerpt setting.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
|
@ -671,10 +676,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
* @since 2.2.0 dedicated to the excerpt setting and its notices
|
||||
*/
|
||||
public function excerpts() {
|
||||
// Options for Yes/No select box.
|
||||
$l_arr_enabled = array(
|
||||
'yes' => __( 'Yes', 'footnotes' ),
|
||||
'no' => __( 'No', 'footnotes' ),
|
||||
// Options for options select box.
|
||||
$l_arr_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.
|
||||
|
@ -685,9 +691,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-excerpts' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, __( 'Display footnotes in excerpts:', 'footnotes' ) ),
|
||||
'excerpts' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, $l_arr_enabled ),
|
||||
'notice-excerpts' => __( 'For this setting to be effective, the hook the_excerpt must be enabled under Scope and priority.', 'footnotes' ),
|
||||
// Translators: %s: link text 'Advanced Excerpt' linked to the plugin’s WordPress.org front page.
|
||||
// Translators: %s: link text 'Advanced Excerpt' linked to the plugin's WordPress.org front page.
|
||||
// Translators: %s: Footnotes plugin logo.
|
||||
'description-excerpts' => sprintf( __( 'Both to display footnotes and to not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to ensure that footnotes are handled and don’t impact the excerpt length.', 'footnotes' ), '<span style="font-style: normal;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
'description-excerpts' => sprintf( __( 'Both to display footnotes and to not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to ensure that footnotes are handled and don\'t impact the excerpt length.', 'footnotes' ), '<span style="font-style: normal;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
)
|
||||
);
|
||||
// Display template with replaced placeholders.
|
||||
|
@ -727,7 +733,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
|
||||
'label-normalize' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ),
|
||||
'normalize' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $l_arr_normalize_superscript ),
|
||||
'notice-normalize' => __( 'Most themes don’t need this fix.', 'footnotes' ),
|
||||
'notice-normalize' => __( 'Most themes don\'t need this fix.', 'footnotes' ),
|
||||
|
||||
'label-before' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ),
|
||||
'before' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE ),
|
||||
|
@ -736,7 +742,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'after' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER ),
|
||||
|
||||
'label-link' => $this->add_label( MCI_Footnotes_Settings::C_STR_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' ),
|
||||
'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.
|
||||
|
@ -754,7 +760,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Options for the input label issue solution.
|
||||
$l_arr_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' ),
|
||||
'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.
|
||||
|
@ -762,10 +768,10 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// Replace all placeholders.
|
||||
$l_obj_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' ),
|
||||
'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( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ),
|
||||
'selection' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, $l_arr_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' ),
|
||||
'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.
|
||||
|
@ -804,7 +810,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'alternative' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_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;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
'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;">' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
|
||||
|
||||
)
|
||||
);
|
||||
|
@ -958,7 +964,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
// The feature trims back until the last full word.
|
||||
'notice-max-length' => __( 'No weird cuts.', 'footnotes' ),
|
||||
|
||||
'label-readon' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __( '‘Read on’ button label:', 'footnotes' ) ),
|
||||
'label-readon' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ),
|
||||
'readon' => $this->add_text_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ),
|
||||
|
||||
)
|
||||
|
@ -1048,12 +1054,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-color' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ),
|
||||
'color' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_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' ) ),
|
||||
'notice-color' => sprintf( __( 'To use the current theme\'s default text color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
|
||||
|
||||
'label-background' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ),
|
||||
'background' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_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' ) ),
|
||||
'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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ),
|
||||
'border-width' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ),
|
||||
|
@ -1062,7 +1068,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-border-color' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ),
|
||||
'border-color' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_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' ) ),
|
||||
'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( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ),
|
||||
'border-radius' => $this->add_num_box( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500 ),
|
||||
|
@ -1071,7 +1077,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
'label-box-shadow-color' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ),
|
||||
'box-shadow-color' => $this->add_color_selection( MCI_Footnotes_Settings::C_STR_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' ) ),
|
||||
'notice-box-shadow-color' => sprintf( __( 'To use the current theme\'s default box shadow color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
|
||||
|
||||
)
|
||||
);
|
||||
|
@ -1150,7 +1156,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
|
||||
// phpcs:disable Squiz.PHP.CommentedOutCode.Found
|
||||
// CSS classes are listed in the template.
|
||||
// Localized notices are dropped to ease translators’ task.
|
||||
// Localized notices are dropped to ease translators' task.
|
||||
|
||||
// "label-class-1" => ".footnote_plugin_tooltip_text",.
|
||||
// "class-1" => $this->add_text(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),.
|
||||
|
@ -1301,9 +1307,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Displays a short introduction of the Plugin.
|
||||
* Displays a short introduction to the Plugin.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @since 2.7.0 Sanitize Lorem Ipsum filler text.
|
||||
* @link https://blog.prototypr.io/why-testing-with-real-content-is-better-than-lorem-ipsum-c7c79586ee72
|
||||
*/
|
||||
public function Help() {
|
||||
global $g_obj_mci_footnotes;
|
||||
|
@ -1317,18 +1326,18 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
$l_arr_footnote_ending_tag = $this->load_setting( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
|
||||
}
|
||||
$l_str_example = 'Hello' . $l_arr_footnote_starting_tag['value'] .
|
||||
'Lorem ipsum dolor sit amet, consetetur sadipscing ' .
|
||||
'elitr, sed diam nonumy eirmod tempor invidunt ut ' .
|
||||
'labore et dolore magna aliquyam erat, sed diam ' .
|
||||
'voluptua. At vero eos et accusam et justo duo dolores ' .
|
||||
'et ea rebum. Stet clita kasd gubergren, no sea ' .
|
||||
'takimata sanctus est Lorem ipsum dolor sit amet. ' .
|
||||
'Lorem ipsum dolor sit amet, consetetur sadipscing ' .
|
||||
'elitr, sed diam nonumy eirmod tempor invidunt ut ' .
|
||||
'labore et dolore magna aliquyam erat, sed diam ' .
|
||||
'voluptua. At vero eos et accusam et justo duo ' .
|
||||
'dolores et ea rebum. Stet clita kasd gubergren, no ' .
|
||||
'sea takimata sanctus est Lorem ipsum dolor sit amet.' .
|
||||
'Sed ut perspiciatis, unde omnis iste natus error ' .
|
||||
'sit voluptatem accusantium doloremque laudantium, ' .
|
||||
'totam rem aperiam eaque ipsa, quae ab illo ' .
|
||||
'inventore veritatis et quasi architecto beatae ' .
|
||||
'vitae dicta sunt, explicabo. Nemo enim ipsam ' .
|
||||
'voluptatem, quia voluptas sit, aspernatur aut ' .
|
||||
'odit aut fugit, sed quia consequuntur magni ' .
|
||||
'dolores eos, qui ratione voluptatem sequi nesciunt, ' .
|
||||
'neque porro quisquam est, qui dolorem ipsum, quia ' .
|
||||
'dolor sit amet, consectetur, adipisci velit, sed ' .
|
||||
'quia non numquam eius modi tempora incidunt, ut ' .
|
||||
'labore et dolore magnam aliquam quaerat voluptatem.' .
|
||||
$l_arr_footnote_ending_tag['value'] . ' World!';
|
||||
|
||||
// Load template file.
|
||||
|
@ -1338,17 +1347,32 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
|||
array(
|
||||
'label-start' => __( 'Start your footnote with the following short code:', 'footnotes' ),
|
||||
'start' => $l_arr_footnote_starting_tag['value'],
|
||||
'label-end' => __( '…and end your footnote with this short code:', 'footnotes' ),
|
||||
'label-end' => __( '...and end your footnote with this short code:', 'footnotes' ),
|
||||
'end' => $l_arr_footnote_ending_tag['value'],
|
||||
'example-code' => $l_str_example,
|
||||
'example-string' => '<br/>' . __( 'will be displayed as:', 'footnotes' ),
|
||||
'example' => $g_obj_mci_footnotes->a_obj_task->exec( $l_str_example, true ),
|
||||
// Translators: 1: <a>; 2: </a>.
|
||||
'information' => sprintf( __( 'For further information please check out our %1$ssupport forum%2$s on WordPress.org.', 'footnotes' ), '<a href="https://wordpress.org/support/plugin/footnotes" target="_blank" class="footnote_plugin">', '</a>' ),
|
||||
// Translators: %1$s, %2$s: anchor element with hyperlink to the Support Forum.
|
||||
'information' => sprintf( __( 'For further information please check out our %1$sSupport Forum%2$s on WordPress.org.', 'footnotes' ), '<a href="https://wordpress.org/support/plugin/footnotes" target="_blank" class="footnote_plugin">', '</a>' ),
|
||||
)
|
||||
);
|
||||
// Call wp_head function to get the Styling of the mouse-over box.
|
||||
$g_obj_mci_footnotes->a_obj_task->wp_head();
|
||||
|
||||
/**
|
||||
* Call footnotes_output_head function to get the Styling of the mouse-over box.
|
||||
*
|
||||
* - Bugfix: Dashboard: debug the 'Quick start guide' tab, thanks to @rumperuu bug report.
|
||||
*
|
||||
* @reporter @rumperuu
|
||||
* @link https://github.com/markcheret/footnotes/issues/71
|
||||
*
|
||||
* @since 2.7.0
|
||||
* The name of the callback function ought to be distinct from
|
||||
* the name of the filtered function.
|
||||
* When this callback function was renamed, this call went unnoticed.
|
||||
* @see class/task.php
|
||||
*/
|
||||
$g_obj_mci_footnotes->a_obj_task->footnotes_output_head();
|
||||
|
||||
// Display template with replaced placeholders.
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo $l_obj_template->get_content();
|
||||
|
|
|
@ -120,16 +120,18 @@ class MCI_Footnotes_Settings {
|
|||
/**
|
||||
* Settings container key to look for footnotes in post excerpts.
|
||||
*
|
||||
* - Bugfix: Hooks: disable the_excerpt hook by default to fix issues, thanks to @nikelaos bug report.
|
||||
*
|
||||
* @reporter @nikelaos
|
||||
* @link https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13687068
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.6.2 Debug No option.
|
||||
* @since 2.6.3 Enable by default after debugging both Yes and No options.
|
||||
*
|
||||
* - Bugfix: Excerpts: make excerpt handling backward compatible, thanks to @mfessler bug report.
|
||||
*
|
||||
* @reporter @mfessler
|
||||
* @link https://github.com/markcheret/footnotes/issues/65
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @see C_STR_EXPERT_LOOKUP_THE_EXCERPT
|
||||
* @var str
|
||||
* @var str Default 'manual'.
|
||||
*/
|
||||
const C_STR_FOOTNOTES_IN_EXCERPT = 'footnote_inputfield_search_in_excerpt';
|
||||
|
||||
|
@ -1111,7 +1113,7 @@ class MCI_Footnotes_Settings {
|
|||
* - Adding: Reference container: get expanding and collapsing to work also in AMP compatibility mode, thanks to @westonruter code contribution.
|
||||
*
|
||||
* @contributor @milindmore22
|
||||
* @link @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
*
|
||||
* @contributor @westonruter
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785419655
|
||||
|
@ -1181,10 +1183,24 @@ class MCI_Footnotes_Settings {
|
|||
* @link https://wordpress.org/support/topic/compatibility-issue-with-wpforms/#post-14214720
|
||||
*
|
||||
* @since 2.5.12
|
||||
* @var str
|
||||
* Native smooth scrolling only works in recent browsers.
|
||||
*/
|
||||
const C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING = 'footnotes_inputfield_css_smooth_scrolling';
|
||||
|
||||
/**
|
||||
* Settings container key for the footnote section shortcode.
|
||||
*
|
||||
* - Adding: Reference container: optionally per section by shortcode, thanks to @grflukas issue report.
|
||||
*
|
||||
* @reporter @grflukas
|
||||
* @link https://wordpress.org/support/topic/multiple-reference-containers-in-single-post/
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @var str
|
||||
*/
|
||||
const C_STR_FOOTNOTE_SECTION_SHORTCODE = 'footnotes_inputfield_section_shortcode';
|
||||
|
||||
|
||||
/**
|
||||
* SETTINGS STORAGE.
|
||||
|
@ -1266,6 +1282,7 @@ class MCI_Footnotes_Settings {
|
|||
self::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE => 'jquery',
|
||||
self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
|
||||
self::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE => '[[references]]',
|
||||
self::C_STR_FOOTNOTE_SECTION_SHORTCODE => '[[/footnotesection]]',
|
||||
self::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes',
|
||||
self::C_INT_REFERENCE_CONTAINER_TOP_MARGIN => 24,
|
||||
self::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN => 0,
|
||||
|
@ -1296,7 +1313,7 @@ class MCI_Footnotes_Settings {
|
|||
self::C_STR_LINK_ELEMENT_ENABLED => 'yes',
|
||||
|
||||
// Footnotes in excerpts.
|
||||
self::C_STR_FOOTNOTES_IN_EXCERPT => 'yes',
|
||||
self::C_STR_FOOTNOTES_IN_EXCERPT => 'manual',
|
||||
|
||||
// Footnotes love.
|
||||
self::C_STR_FOOTNOTES_LOVE => 'no',
|
||||
|
|
100
class/task.php
100
class/task.php
|
@ -477,13 +477,22 @@ class MCI_Footnotes_Task {
|
|||
add_filter( 'pum_popup_content', array( $this, 'footnotes_in_content' ), $l_int_the_content_priority );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a filter to the excerpt hook.
|
||||
*
|
||||
* @since 1.5.0 The hook 'get_the_excerpt' is filtered too.
|
||||
* @since 1.5.5 The hook 'get_the_excerpt' is removed but not documented in changelog or docblock.
|
||||
* @since 2.6.2 The hook 'get_the_excerpt' is readded when attempting to debug excerpt handling.
|
||||
* @since 2.6.6 The hook 'get_the_excerpt' is removed again because it seems to cause issues in some themes.
|
||||
*/
|
||||
if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ) ) ) {
|
||||
add_filter( 'the_excerpt', array( $this, 'footnotes_in_excerpt' ), $l_int_the_excerpt_priority );
|
||||
add_filter( 'get_the_excerpt', array( $this, 'footnotes_in_excerpt' ), $l_int_the_excerpt_priority );
|
||||
}
|
||||
|
||||
if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ) ) ) {
|
||||
add_filter( 'widget_title', array( $this, 'footnotes_in_widget_title' ), $l_int_widget_title_priority );
|
||||
}
|
||||
|
||||
if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ) ) ) {
|
||||
add_filter( 'widget_text', array( $this, 'footnotes_in_widget_text' ), $l_int_widget_text_priority );
|
||||
}
|
||||
|
@ -1076,32 +1085,82 @@ class MCI_Footnotes_Task {
|
|||
* Replaces footnotes in the content of the current page/post.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* - Adding: Reference container: optionally per section by shortcode, thanks to @grflukas issue report.
|
||||
*
|
||||
* @reporter @grflukas
|
||||
* @link https://wordpress.org/support/topic/multiple-reference-containers-in-single-post/
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @param string $p_str_content Page/Post content.
|
||||
* @return string $p_str_content Content with replaced footnotes.
|
||||
*/
|
||||
public function footnotes_in_content( $p_str_content ) {
|
||||
|
||||
$l_str_ref_container_position = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION );
|
||||
$l_str_footnote_section_shortcode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE );
|
||||
$l_int_footnote_section_shortcode_length = strlen( $l_str_footnote_section_shortcode );
|
||||
|
||||
if ( strpos( $p_str_content, $l_str_footnote_section_shortcode ) === false ) {
|
||||
|
||||
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda
|
||||
// Appends the reference container if set to "post_end".
|
||||
return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) );
|
||||
return $this->exec( $p_str_content, 'post_end' === $l_str_ref_container_position );
|
||||
// phpcs:enable WordPress.PHP.YodaConditions.NotYoda
|
||||
|
||||
} else {
|
||||
|
||||
$l_str_rest_content = $p_str_content;
|
||||
$l_arr_sections_raw = array();
|
||||
$l_arr_sections_processed = array();
|
||||
|
||||
do {
|
||||
$l_int_section_end = strpos( $l_str_rest_content, $l_str_footnote_section_shortcode );
|
||||
$l_arr_sections_raw[] = substr( $l_str_rest_content, 0, $l_int_section_end );
|
||||
$l_str_rest_content = substr( $l_str_rest_content, $l_int_section_end + $l_int_footnote_section_shortcode_length );
|
||||
} while ( strpos( $l_str_rest_content, $l_str_footnote_section_shortcode ) !== false );
|
||||
$l_arr_sections_raw[] = $l_str_rest_content;
|
||||
|
||||
foreach ( $l_arr_sections_raw as $l_str_section ) {
|
||||
$l_arr_sections_processed[] = self::exec( $l_str_section, true );
|
||||
}
|
||||
|
||||
$p_str_content = implode( $l_arr_sections_processed );
|
||||
return $p_str_content;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces existing excerpt with a new one generated on the basis of the post.
|
||||
* Processes existing excerpt or replaces it with a new one generated on the basis of the post.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_excerpt Excerpt content.
|
||||
* @return string $p_str_excerpt Excerpt as-is.
|
||||
* The input was already the processed excerpt, no more footnotes to search.
|
||||
* @return string $p_str_excerpt Processed or new excerpt.
|
||||
* @since 2.6.2 Debug No option.
|
||||
* @since 2.6.3 Debug Yes option, the setting becomes fully effective.
|
||||
*
|
||||
* - Bugfix: Excerpts: make excerpt handling backward compatible, thanks to @mfessler bug report.
|
||||
*
|
||||
* @reporter @mfessler
|
||||
* @link https://github.com/markcheret/footnotes/issues/65
|
||||
*
|
||||
* @since 2.7.0
|
||||
* The input was already the processed excerpt, no more footnotes to search.
|
||||
* But issue #65 brought up that manual excerpts can include processable footnotes.
|
||||
* Default 'manual' is fallback and is backward compatible with the initial setup.
|
||||
*/
|
||||
public function footnotes_in_excerpt( $p_str_excerpt ) {
|
||||
if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT ) ) ) {
|
||||
$l_str_excerpt_mode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT );
|
||||
|
||||
if ( 'yes' === $l_str_excerpt_mode ) {
|
||||
return $this->generate_excerpt_with_footnotes( $p_str_excerpt );
|
||||
} else {
|
||||
|
||||
} elseif ( 'no' === $l_str_excerpt_mode ) {
|
||||
return $this->generate_excerpt( $p_str_excerpt );
|
||||
|
||||
} else {
|
||||
return $this->exec( $p_str_excerpt );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2117,7 +2176,8 @@ class MCI_Footnotes_Task {
|
|||
}
|
||||
|
||||
/**
|
||||
* Fixes a footnotes numbering bug (happening under de facto rare circumstances).
|
||||
* Fixes a partial footnotes process outage happening when tooltips are truncated or disabled.
|
||||
* Fixed a footnotes numbering bug happening under de facto rare circumstances.
|
||||
*
|
||||
* - Bugfix: Fixed occasional bug where footnote ordering could be out of sequence
|
||||
*
|
||||
|
@ -2143,12 +2203,30 @@ class MCI_Footnotes_Task {
|
|||
* footnote and the length of the last footnote replace text.
|
||||
* A bug disturbing the order of the footnotes depending on the text before the first
|
||||
* footnote, the length of the first footnote and the length of the templates for the
|
||||
* footnote and the tooltip. Moreover, it was causing non-trivial process garbage.
|
||||
* footnote and the tooltip.
|
||||
* Deleting both lines instead, to resume the search at the position where it left off,
|
||||
* would have prevented also the following bug.
|
||||
*
|
||||
* - Bugfix: Process: fix issue that caused some footnotes to not be processed, thanks to @docteurfitness @rkupadhya @offpeakdesign bug reports.
|
||||
*
|
||||
* @since 2.6.6
|
||||
* Fix bug that caused some footnotes to not be processed.
|
||||
* @reporter @docteurfitness
|
||||
* @link https://wordpress.org/support/topic/problem-since-footnotes-2-5-14/
|
||||
*
|
||||
* @reporter @rkupadhya
|
||||
* @link https://wordpress.org/support/topic/adjacent-footnotes-not-working-sometimes/
|
||||
*
|
||||
* @reporter @offpeakdesign
|
||||
* @link https://wordpress.org/support/topic/character-limit-bug/
|
||||
*
|
||||
* @since 2.6.6
|
||||
* The origin of the bug was present since the beginning (v1.0.0).
|
||||
* For v1.3.2 the wrong code was refactored but remained wrong,
|
||||
* and was unaffected by the v1.5.0 refactoring.
|
||||
* The reason why the numbering disorder reverted to a partial process outage
|
||||
* since 2.5.14 is that with this version, the plugin stopped processing the
|
||||
* content multiple times, and started unifying the shortcodes instead, to fix
|
||||
* the numbering disorder affecting delimiter shortcodes with pointy brackets
|
||||
* and mixed escapement schemas.
|
||||
*/
|
||||
// Add offset to the new starting position.
|
||||
$l_int_pos_start += strlen( $l_str_footnote_replace_text );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Plugin URI: https://wordpress.org/plugins/footnotes/
|
||||
* Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
|
||||
* Author: Mark Cheret
|
||||
* Version: 2.6.5
|
||||
* Version: 2.7.0
|
||||
* Author URI: https://cheret.org/footnotes/
|
||||
* Text Domain: footnotes
|
||||
* Domain Path: /languages
|
||||
|
@ -13,6 +13,33 @@
|
|||
* @copyright 2021 Mark Cheret (email: mark@cheret.de)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Package Version number for stylesheet cache busting.
|
||||
*
|
||||
* Please keep this string in sync with the 'Version' (not 'Package V.').
|
||||
* Please mirror the 'Version' also in js/wysiwyg-editor.js.
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @since 2.5.3 (Hungarian)
|
||||
* @var str
|
||||
* @lastmodified 2021-04-14T2351+0200
|
||||
*/
|
||||
define( 'C_STR_FOOTNOTES_VERSION', '2.7.0' );
|
||||
|
||||
/**
|
||||
* Defines the current environment ('development' or 'production').
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @var bool
|
||||
* @see Full docblock below next.
|
||||
*
|
||||
* In production, a minified CSS file tailored to the settings is enqueued.
|
||||
*
|
||||
* Developing stylesheets is meant to be easier when this is set to false.
|
||||
* WARNING: This facility designed for development must NOT be used in production.
|
||||
*/
|
||||
define( 'PRODUCTION_ENV', false );
|
||||
|
||||
/**
|
||||
* - Bugfix: Codebase: revert to 2.5.8, thanks to @little-shiva @watershare @adjayabdg @staho @frav8 @voregnev @dsl225 @alexclassroom @a223123131 @codldmac bug reports.
|
||||
*
|
||||
|
@ -89,17 +116,3 @@ add_filter( "plugin_action_links_{$l_str_plugin_file}", array( 'MCI_Footnotes_Ho
|
|||
$g_obj_mci_footnotes = new MCI_Footnotes();
|
||||
// Run the Plugin.
|
||||
$g_obj_mci_footnotes->run();
|
||||
|
||||
/**
|
||||
* Sets the stylesheet enqueuing mode for production.
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @var bool
|
||||
* @see class/init.php
|
||||
*
|
||||
* In production, a minified CSS file tailored to the settings is enqueued.
|
||||
*
|
||||
* Developing stylesheets is meant to be easier when this is set to false.
|
||||
* WARNING: This facility designed for development must NOT be used in production.
|
||||
*/
|
||||
define( 'PRODUCTION_ENV', false );
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
author : 'Mark Cheret',
|
||||
authorurl : 'https://cheret.org/footnotes/',
|
||||
infourl : 'https://wordpress.org/plugins/footnotes/',
|
||||
version : '2.6.5'
|
||||
version : '2.7.0'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
12
readme.txt
12
readme.txt
|
@ -3,8 +3,8 @@ Contributors: mark.cheret, lolzim, rumperuu, aricura, misfist, ericakfranz, mili
|
|||
Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing
|
||||
Requires at least: 3.9
|
||||
Tested up to: 5.7
|
||||
Requires PHP: 5.6
|
||||
Stable Tag: 2.6.5
|
||||
Requires PHP: 7.0
|
||||
Stable Tag: 2.7.0
|
||||
License: GPLv3 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
@ -77,9 +77,13 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 2.7.0 =
|
||||
- Adding: Reference container: optionally per section by shortcode, thanks to @grflukas issue report.
|
||||
- Bugfix: Excerpts: make excerpt handling backward compatible, thanks to @mfessler bug report.
|
||||
- Bugfix: Dashboard: debug the 'Quick start guide' tab, thanks to @rumperuu bug report.
|
||||
|
||||
= 2.6.6 =
|
||||
- Bugfix: Process: fix issue that caused some footnotes to not be processed, thanks to @docteurfitness bug report.
|
||||
- Bugfix: Display: fix characters that had been mis-encoded.
|
||||
- Bugfix: Process: fix issue that caused some footnotes to not be processed, thanks to @docteurfitness @rkupadhya @offpeakdesign bug reports.
|
||||
|
||||
= 2.6.5 =
|
||||
- Bugfix: Editor buttons: debug button by reverting name change in PHP file while JS file and HTML template remained unsynced, thanks to @gova bug report.
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
<td>[[label-shortcode]]</td>
|
||||
<td>[[shortcode]] <span class="footnotes_notice">[[notice-shortcode]]</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[[label-section]]</td>
|
||||
<td>[[section]] <span class="footnotes_notice">[[notice-section]]</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[[label-startpage]]</td>
|
||||
<td>[[startpage]]</td>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* @since 2.6.0 (release)
|
||||
*
|
||||
* @contributor @milindmore22
|
||||
* @link @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
*
|
||||
* @contributor @westonruter
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785419655
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @since 2.6.0 (release)
|
||||
*
|
||||
* @contributor @milindmore22
|
||||
* @link @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785306933
|
||||
*
|
||||
* @contributor @westonruter
|
||||
* @link https://github.com/ampproject/amp-wp/issues/5913#issuecomment-785419655
|
||||
|
|
Reference in a new issue