From b99525b62f543b97521e3d247be7f963d7c7aabf Mon Sep 17 00:00:00 2001 From: Jason Yingling Date: Tue, 26 Nov 2024 21:18:58 -0600 Subject: [PATCH] tagging release 1.1.12 --- easy-footnotes.php | 37 +++++++++++++++++++++++-------------- readme.txt | 7 +++++-- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/easy-footnotes.php b/easy-footnotes.php index 3cf43e3..573b17c 100644 --- a/easy-footnotes.php +++ b/easy-footnotes.php @@ -4,7 +4,7 @@ * Plugin URI: https://jasonyingling.me/easy-footnotes-wordpress/ * Description: Easily add footnotes to your posts with a simple shortcode. * Text Domain: easy-footnotes - * Version: 1.1.11 + * Version: 1.1.12 * Author: Jason Yingling * Author URI: https://jasonyingling.me * License: GPL2 @@ -47,7 +47,7 @@ class easyFootnotes { private $footnoteSettings; - private $version = '1.1.11'; + private $version = '1.1.12'; /** * Constructing the initial plugin options, shortcodes, and hooks. @@ -126,26 +126,35 @@ public function easy_footnote_shortcode( $atts, $content = null ) { $content_id = md5( preg_replace("/[^A-Za-z0-9 ]/", '', wp_strip_all_tags( html_entity_decode( $content ) ) ) ); - /** - * Search for existing footnote for removing duplicate - * Also add the same numbers to duplicate footnotes - */ - if (!isset($this->usedFootnoteNumbers)) { - $this->usedFootnoteNumbers = array(); - } - if (!isset($this->footnoteLookup)) { - $this->footnoteLookup = array(); + if ( isset( $this->footnoteOptions[ 'combine_duplicate_footnotes' ] ) && $this->footnoteOptions[ 'combine_duplicate_footnotes' ] === true ) { + /** + * Search for existing footnote for removing duplicate + * Also add the same numbers to duplicate footnotes + */ + if (!isset($this->usedFootnoteNumbers) ) { + $this->usedFootnoteNumbers = array(); + } + if (!isset($this->footnoteLookup)) { + $this->footnoteLookup = array(); + } } + // If a custom number is provided, use that number and mark it as used if ( ! empty( $atts['num'] ) ) { $footnote_number = intval( $atts['num'] ); $this->usedFootnoteNumbers[] = $footnote_number; // Track custom number $this->footnoteLookup[$content_id] = $footnote_number; $this->footnotes[$footnote_number] = $content; - } elseif ( isset( $this->footnoteLookup[$content_id] ) && isset( $this->footnoteOptions[ 'combine_duplicate_footnotes' ] ) && $this->footnoteOptions[ 'combine_duplicate_footnotes' ] === true ) { - // Use existing footnote number for duplicate content - $footnote_number = $this->footnoteLookup[$content_id]; + } elseif ( isset( $this->footnoteLookup[$content_id] ) ) { + if ( isset( $this->footnoteOptions[ 'combine_duplicate_footnotes' ] ) && $this->footnoteOptions[ 'combine_duplicate_footnotes' ] === true ) { + // Use existing footnote number for duplicate content + $footnote_number = $this->footnoteLookup[$content_id]; + } else { + $this->footnoteCount++; + $footnote_number = $this->footnoteCount; + $this->footnotes[$footnote_number] = $content; + } } else { // Auto-increment for new footnotes, skipping used numbers do { diff --git a/readme.txt b/readme.txt index 12a8395..025fb7f 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: yingling017, twinpictures Donate link: http://jasonyingling.me Tags: footnotes, read, blogging, hover, tooltips, editing, endnotes, Formatting, writing, bibliography, notes, reference Requires at least: 3.0.1 -Tested up to: 6.7 -Stable tag: 1.1.11 +Tested up to: 6.7.1 +Stable tag: 1.1.12 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -76,6 +76,9 @@ This is a hard reset to fix a bug with themes/plugins using `do_shortcode( get_t == Changelog == += 1.1.12 = +* Bugfix for instances where `the_content` is called multiple times in a page. + = 1.1.11 = * Made combined footnote functionality from 1.1.9 enabled by a setting to avoid breaking sites that rely on the old behavior. * Now can be turned on with "Combine duplicate footnotes" setting in Easy Footnotes settings.