From 49bb66b8bdfbcfa4cd8a2c1f4136ed02c5e6974b Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Tue, 19 Jan 2021 23:45:34 +0000 Subject: [PATCH] urgent release 2.5.2 git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2459302 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/task.php | 73 +++++++++++++++++---- css/public.css | 4 +- css/settings.css | 4 +- footnotes.php | 4 +- languages/{de_AT.mo => footnotes-de_AT.mo} | Bin languages/{de_AT.po => footnotes-de_AT.po} | 0 languages/{de_DE.mo => footnotes-de_DE.mo} | Bin languages/{de_DE.po => footnotes-de_DE.po} | 0 languages/{en_GB.mo => footnotes-en_GB.mo} | Bin languages/{en_GB.po => footnotes-en_GB.po} | 0 languages/{en_US.mo => footnotes-en_US.mo} | Bin languages/{en_US.po => footnotes-en_US.po} | 0 languages/{es_ES.mo => footnotes-es_ES.mo} | Bin languages/{es_ES.po => footnotes-es_ES.po} | 0 languages/{fr_FR.mo => footnotes-fr_FR.mo} | Bin languages/{fr_FR.po => footnotes-fr_FR.po} | 0 readme.txt | 6 +- 17 files changed, 73 insertions(+), 18 deletions(-) rename languages/{de_AT.mo => footnotes-de_AT.mo} (100%) rename languages/{de_AT.po => footnotes-de_AT.po} (100%) rename languages/{de_DE.mo => footnotes-de_DE.mo} (100%) rename languages/{de_DE.po => footnotes-de_DE.po} (100%) rename languages/{en_GB.mo => footnotes-en_GB.mo} (100%) rename languages/{en_GB.po => footnotes-en_GB.po} (100%) rename languages/{en_US.mo => footnotes-en_US.mo} (100%) rename languages/{en_US.po => footnotes-en_US.po} (100%) rename languages/{es_ES.mo => footnotes-es_ES.mo} (100%) rename languages/{es_ES.po => footnotes-es_ES.po} (100%) rename languages/{fr_FR.mo => footnotes-fr_FR.mo} (100%) rename languages/{fr_FR.po => footnotes-fr_FR.po} (100%) diff --git a/class/task.php b/class/task.php index c3ad10b..92aa096 100644 --- a/class/task.php +++ b/class/task.php @@ -8,7 +8,7 @@ * * Edited for v2.0.0 and following. * - * Last modified: 2021-01-18T2119+0100 + * Last modified: 2021-01-19T2354+0100 * * @since 2.0.5 debug autoload / infinite scroll through added post ID, contributed by @docteurfitness * @see @@ -119,6 +119,8 @@ * * @since 2.5.1 Hooks: support for footnotes in Popup Maker popups, thanks to @squatcher bug report * @see + * + * @since 2.6.0 Tooltips: possible to display dedicated content, thanks to @jbj2199 feature request */ // If called directly, abort: @@ -195,6 +197,8 @@ class MCI_Footnotes_Task { public static $l_int_ReferenceContainerId = 1; /** + * TEMPLATE PROCESS OPTIMIZATION + * * Load tooltip inline script only if jQuery tooltips are enabled * Streamline process depending on tooltip enabled status * @@ -206,7 +210,7 @@ class MCI_Footnotes_Task { public static $l_bool_AlternativeTooltipsEnabled = false; /** - * Hard links for AMP + * HARD LINKS FOR AMP * * Optional hard links in referrers and backlinks for AMP compatibility * @@ -264,6 +268,23 @@ class MCI_Footnotes_Task { public static $l_str_LinkOpenTag = ''; public static $l_str_LinkCloseTag = ''; + /** + * DEDICATED TOOLTIP TEXT + * + * Tooltips can display another content than the footnote entry + * in the reference container. The trigger is a shortcode in + * the footnote text separating the tooltip text from the note. + * + * @thanksto @jbj2199 feature request + * @see + * @since 2.6.0d1 + * @timestamp 2021-01-19T2223+0100 + */ + public static $a_bool_HasTooltipText = false; + public static $a_str_TooltipShortcode = '[[/tooltip]]'; + public static $a_int_TooltipTextLength = 0; + public static $a_int_TooltipShortcodeLength = 12; + /** * SYNTAX VALIDATION * @@ -383,9 +404,9 @@ class MCI_Footnotes_Task { } - // REMOVED the_post HOOK 2020-11-08T1839+0100 - // - // + // REMOVED the_post HOOK + // 2020-11-08T1839+0100 + // @since 2.0.9 // reset stored footnotes when displaying the header @@ -807,10 +828,13 @@ class MCI_Footnotes_Task { // append the reference container or insert at shortcode: $l_str_ReferenceContainerPositionShortcode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE); + if ( empty( $l_str_ReferenceContainerPositionShortcode ) ) { + $l_str_ReferenceContainerPositionShortcode = '[[references]]'; + } - if ($p_bool_OutputReferences) { + if ( $p_bool_OutputReferences ) { - if (strpos( $p_str_Content, $l_str_ReferenceContainerPositionShortcode ) !== false ) { + if ( strpos( $p_str_Content, $l_str_ReferenceContainerPositionShortcode ) !== false ) { $p_str_Content = str_replace( $l_str_ReferenceContainerPositionShortcode, $this->ReferenceContainer(), $p_str_Content ); @@ -986,6 +1010,16 @@ class MCI_Footnotes_Task { // get footnote text $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); + // get tooltip text if present: + self::$a_str_TooltipShortcode = '[[/tooltip]]'; // grab from DB + self::$a_int_TooltipShortcodeLength = strlen( self::$a_str_TooltipShortcode ); + self::$a_int_TooltipTextLength = strpos( $l_str_FootnoteText, self::$a_str_TooltipShortcode ); + self::$a_bool_HasTooltipText = self::$a_int_TooltipTextLength === false ? false : true; + if ( self::$a_bool_HasTooltipText ) { + $l_str_TooltipText = substr( $l_str_FootnoteText, 0, self::$a_int_TooltipTextLength ); + } else { + $l_str_TooltipText = ''; + } /** * URL line wrap @@ -1131,6 +1165,13 @@ class MCI_Footnotes_Task { } } + // determine tooltip content: + if ( self::$l_bool_TooltipsEnabled ) { + $l_str_TooltipContent = self::$a_bool_HasTooltipText ? $l_str_TooltipText : $l_str_ExcerptText; + } else { + $l_str_TooltipContent = ''; + } + // fill in 'templates/public/footnote.html': $l_obj_Template->replace( array( @@ -1144,7 +1185,7 @@ class MCI_Footnotes_Task { "index" => $l_int_Index, "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER), "anchor-element" => $l_str_ReferrerAnchorElement, - "text" => self::$l_bool_TooltipsEnabled ? $l_str_ExcerptText : "", + "text" => $l_str_TooltipContent, ) ); $l_str_FootnoteReplaceText = $l_obj_Template->getContent(); @@ -1373,8 +1414,9 @@ class MCI_Footnotes_Task { // get footnote text $l_str_FootnoteText = self::$a_arr_Footnotes[$l_int_Index]; - // if footnote is empty, get to the next one - // With combine identical turned on, identicals will be deleted and are skipped: + + // if footnote is empty, go to the next one; + // With combine identicals turned on, identicals will be deleted and are skipped: if (empty($l_str_FootnoteText)) { continue; } @@ -1554,6 +1596,15 @@ class MCI_Footnotes_Task { // line wrapping of URLs already fixed, see above + // get reference container item text if tooltip text goes separate: + self::$a_int_TooltipTextLength = strpos( $l_str_FootnoteText, self::$a_str_TooltipShortcode ); + self::$a_bool_HasTooltipText = self::$a_int_TooltipTextLength === false ? false : true; + if ( self::$a_bool_HasTooltipText ) { + $l_str_ReferenceText = substr( $l_str_FootnoteText, ( self::$a_int_TooltipTextLength + self::$a_int_TooltipShortcodeLength ) ); + } else { + $l_str_ReferenceText = $l_str_FootnoteText; + } + // replace all placeholders in 'templates/public/reference-container-body.html' // or in 'templates/public/reference-container-body-combi.html' // or in 'templates/public/reference-container-body-3column.html' @@ -1562,7 +1613,7 @@ class MCI_Footnotes_Task { array( // placeholder used in all templates: - "text" => $l_str_FootnoteText, + "text" => $l_str_ReferenceText, // used in standard layout W/O COMBINED FOOTNOTES: "post_id" => self::$l_int_PostId, diff --git a/css/public.css b/css/public.css index 94386ac..ee29e07 100755 --- a/css/public.css +++ b/css/public.css @@ -6,9 +6,9 @@ * Since: 1.0 */ -/* Version: 2.5.1 +/* Version: 2.5.2 -Last modified: 2021-01-18T2228+0100 +Last modified: 2021-01-20T0007+0100 Classes recommended for Custom CSS are listed in diff --git a/css/settings.css b/css/settings.css index 367322e..a886481 100755 --- a/css/settings.css +++ b/css/settings.css @@ -5,9 +5,9 @@ * Created-Time: 16:21 * Since: 1.0 * - * Version: 2.5.1 + * Version: 2.5.2 * - * Last modified: 2021-01-18T2051+0100 + * Last modified: 2021-01-20T0007+0100 */ diff --git a/footnotes.php b/footnotes.php index b08b810..14d6a9a 100755 --- a/footnotes.php +++ b/footnotes.php @@ -4,12 +4,12 @@ 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.5.1 + Version: 2.5.2 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages */ -define( 'FOOTNOTES_VERSION', '2.5.1' ); +define( 'FOOTNOTES_VERSION', '2.5.2' ); /* Copyright 2020 Mark Cheret (email: mark@cheret.de) diff --git a/languages/de_AT.mo b/languages/footnotes-de_AT.mo similarity index 100% rename from languages/de_AT.mo rename to languages/footnotes-de_AT.mo diff --git a/languages/de_AT.po b/languages/footnotes-de_AT.po similarity index 100% rename from languages/de_AT.po rename to languages/footnotes-de_AT.po diff --git a/languages/de_DE.mo b/languages/footnotes-de_DE.mo similarity index 100% rename from languages/de_DE.mo rename to languages/footnotes-de_DE.mo diff --git a/languages/de_DE.po b/languages/footnotes-de_DE.po similarity index 100% rename from languages/de_DE.po rename to languages/footnotes-de_DE.po diff --git a/languages/en_GB.mo b/languages/footnotes-en_GB.mo similarity index 100% rename from languages/en_GB.mo rename to languages/footnotes-en_GB.mo diff --git a/languages/en_GB.po b/languages/footnotes-en_GB.po similarity index 100% rename from languages/en_GB.po rename to languages/footnotes-en_GB.po diff --git a/languages/en_US.mo b/languages/footnotes-en_US.mo similarity index 100% rename from languages/en_US.mo rename to languages/footnotes-en_US.mo diff --git a/languages/en_US.po b/languages/footnotes-en_US.po similarity index 100% rename from languages/en_US.po rename to languages/footnotes-en_US.po diff --git a/languages/es_ES.mo b/languages/footnotes-es_ES.mo similarity index 100% rename from languages/es_ES.mo rename to languages/footnotes-es_ES.mo diff --git a/languages/es_ES.po b/languages/footnotes-es_ES.po similarity index 100% rename from languages/es_ES.po rename to languages/footnotes-es_ES.po diff --git a/languages/fr_FR.mo b/languages/footnotes-fr_FR.mo similarity index 100% rename from languages/fr_FR.mo rename to languages/footnotes-fr_FR.mo diff --git a/languages/fr_FR.po b/languages/footnotes-fr_FR.po similarity index 100% rename from languages/fr_FR.po rename to languages/footnotes-fr_FR.po diff --git a/readme.txt b/readme.txt index 780b217..7f46b47 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, referen Requires at least: 3.9 Tested up to: 5.6 Requires PHP: 5.6 -Stable Tag: 2.5.1 +Stable Tag: 2.5.2 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -79,6 +79,10 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == += 2.5.2 = +- Update: Tooltips: possible to display dedicated content before `[[/tooltip]]`, thanks to @jbj2199 feature request +- Bugfix: Localization: plugin language file name changes effective in version control system + = 2.5.1 = - Bugfix: Hooks: support for footnotes in Popup Maker popups, thanks to @squatcher bug report - Bugfix: Reference container: click on label expands but also collapses, thanks to @ahmadword bug report