Release urgent feature 2.7.0 in response to request from user @grflukas.

https://wordpress.org/support/topic/multiple-reference-containers-in-single-post/
Bundled with two bugfixes.
https://github.com/markcheret/footnotes/issues/65
https://github.com/markcheret/footnotes/issues/71
Last release directly to SVN.
= 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.

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2515217 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2021-04-14 23:10:29 +00:00
parent dc225809ba
commit a02cdacb7f
12 changed files with 189 additions and 83 deletions

View file

@ -213,11 +213,11 @@ abstract class MCI_Footnotes_Layout_Engine {
*/
if ( true === C_BOOL_CSS_PRODUCTION_MODE ) {
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_PACKAGE_VERSION );
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_PACKAGE_VERSION );
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), C_STR_FOOTNOTES_VERSION );
}

View file

@ -160,7 +160,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;
@ -288,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 ),
@ -358,7 +362,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 themes 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.
@ -423,8 +427,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 &lt;ref&gt;&lt;/ref&gt; and &lt;fn&gt;&lt;/fn&gt; shortcodes.
'description-escapement' => sprintf( __( 'The problems with shortcodes with pointy brackets have been solved. We apologize for the longlasting bugs making the %s and %s shortcodes close to unusable.', 'footnotes' ), '&lt;ref&gt;&lt;/ref&gt;', '&lt;fn&gt;&lt;/fn&gt;' ),
'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 ),
@ -596,7 +599,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 ),
@ -661,7 +664,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 +675,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
* @since 2.2.0 dedicated to the excerpt setting and its notices 2020-12-12T1454+0100
*/
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 +687,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' ),
'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 plugins 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 dont 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.
@ -1304,9 +1308,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;
@ -1320,19 +1327,19 @@ 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.' .
$l_arr_footnote_ending_tag['value'] . ' World!';
'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.
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'how-to-help' );
@ -1346,12 +1353,27 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
'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();

View file

@ -6,8 +6,6 @@
* @package footnotes
* @since 1.5.0
* @date 12.09.14 10:56
*
* @since 2.2.0 (TBD) 2020-12-12T1223+0100
*/
/**
@ -52,6 +50,7 @@ class MCI_Footnotes_Hooks {
* @since 1.5.0
*
* @since 2.2.0 this function is not called any longer when deleting the plugin.
* @date 2020-12-12T1223+0100
* Note: clear_all() didnt actually work.
* @see class/settings.php
*/

View file

@ -87,7 +87,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
@ -366,7 +366,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.
* @date 2020-11-30T0646+0100
* 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.
@ -419,7 +419,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'
);
@ -433,15 +433,15 @@ class MCI_Footnotes {
*
* This optional layout fix is useful by lack of layout support.
*/
wp_enqueue_style( 'mci-footnotes-common', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-common.css' ), array(), C_STR_PACKAGE_VERSION );
wp_enqueue_style( 'mci-footnotes-tooltips', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), C_STR_PACKAGE_VERSION );
wp_enqueue_style( 'mci-footnotes-common', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-common.css' ), array(), C_STR_FOOTNOTES_VERSION );
wp_enqueue_style( 'mci-footnotes-tooltips', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), C_STR_FOOTNOTES_VERSION );
if ( self::$a_bool_amp_enabled ) {
wp_enqueue_style( 'mci-footnotes-amp', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-amp-tooltips.css' ), array(), C_STR_PACKAGE_VERSION );
wp_enqueue_style( 'mci-footnotes-amp', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-amp-tooltips.css' ), array(), C_STR_FOOTNOTES_VERSION );
}
if ( self::$a_bool_alternative_tooltips_enabled ) {
wp_enqueue_style( 'mci-footnotes-alternative', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), C_STR_PACKAGE_VERSION );
wp_enqueue_style( 'mci-footnotes-alternative', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), C_STR_FOOTNOTES_VERSION );
}
$l_str_page_layout_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT );
@ -452,7 +452,7 @@ class MCI_Footnotes {
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_page_layout_option . '.css'
),
array(),
C_STR_PACKAGE_VERSION,
C_STR_FOOTNOTES_VERSION,
'all'
);
}

View file

@ -122,16 +122,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';
@ -1154,7 +1156,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
@ -1224,10 +1226,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.
@ -1309,6 +1325,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,
@ -1339,7 +1356,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',

View file

@ -490,13 +490,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 );
add_filter( '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 );
}
@ -1095,32 +1104,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 ) {
// 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 ) );
// phpcs:enable WordPress.PHP.YodaConditions.NotYoda
$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' === $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 );
}
}

View file

@ -4,8 +4,8 @@
* 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
* Package V.: 2.6.6
* Version: 2.6.6
* Package V.: 2.7.0
* Version: 2.7.0
* CAUTION: THIS V. FIELD IS PARSED FOR UPDATE CONFIGURATION.
* Author URI: https://cheret.org/footnotes/
* Text Domain: footnotes
@ -16,14 +16,14 @@
/**
* Package Version number for stylesheet cache busting.
*
* Please keep this string in sync with the PACKAGE Version ('Package V.').
* Please mirror the 'Version' (NOT 'Package V.') in js/wysiwyg-editor.js.
* 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-13T1011+0200
* @lastmodified 2021-04-14T2351+0200
*/
define( 'C_STR_PACKAGE_VERSION', '2.6.6' );
define( 'C_STR_FOOTNOTES_VERSION', '2.7.0' );
/**
* Enables toggling the stylesheet enqueuing mode from production (true) to development (false).
* @see Full docblock below next.

View file

@ -69,7 +69,7 @@
author : 'Mark Cheret',
authorurl : 'https://cheret.org/footnotes/',
infourl : 'https://wordpress.org/plugins/footnotes/',
version : '2.6.6'
version : '2.7.0'
};
}
});

View file

@ -4,9 +4,9 @@ Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, referen
Requires at least: 3.9
Tested up to: 5.7
Requires PHP: 7.0
Package Version: 2.6.6
Version: 2.6.6
Stable Tag: 2.6.6
Package Version: 2.7.0
Version: 2.7.0
Stable Tag: 2.7.0
CAUTION: THE S. T. FIELD IS PARSED FOR RELEASE CONFIGURATION.
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -80,6 +80,11 @@ 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 @rkupadhya @offpeakdesign bug reports.

View file

@ -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>

View file

@ -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

View file

@ -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