traceability update 2.5.4d3

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2471020 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2021-02-08 18:04:15 +00:00
parent cee486702c
commit 4d884e22a0
11 changed files with 398 additions and 253 deletions

View file

@ -5,20 +5,20 @@
* @filesource
* @author Stefan Herndler
* @since 1.5.0 12.09.14 10:56
*
*
* @since 1.6.5 Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution
* @since 1.6.5 Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution
* @since 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution
*
* @lastmodified 2021-02-06T0304+0100
*
* @since 1.6.5 Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution.
* @since 1.6.5 Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution.
* @since 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
*
* @since 2.0.3 add versioning of public.css for cache busting 2020-10-29T1413+0100
* @since 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
* @since 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
* @since 2.1.4 optionally enqueue an extra style sheet 2020-12-04T2231+0100
*
* Last modified: 2021-01-31T0755+0100
*/
/**
* Entry point of the Plugin. Loads the Dashboard and executes the Task.
*
@ -41,13 +41,16 @@ class MCI_Footnotes {
*
* @author Stefan Herndler
* @since 1.5.0
*
*
* - Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution.
*
* @since 1.6.5
*
* @contributor @felipelavinz
* @link https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
*
* Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution
* @since 1.6.5
*
* @contributor @felipelavinz
* @link https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
* @see initializeWidgets()
*/
public function run() {
// register language
@ -76,29 +79,32 @@ class MCI_Footnotes {
* @author Stefan Herndler
* @since 1.5.0
*
*
* - Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution
*
* Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution
* @since 1.6.5
*
* @contributor @felipelavinz
* @link https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
*
* @reporter @psykonevro
* @link https://wordpress.org/support/topic/bug-function-create_function-is-deprecated/
* @link https://wordpress.org/support/topic/deprecated-function-create_function-14/
*
* @reporter @daliasued
* @link https://wordpress.org/support/topic/deprecated-function-create_function-14/#post-13312853
* @since 1.6.5
*
* @contributor @felipelavinz
* @link https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
*
* @reporter @psykonevro
* @link https://wordpress.org/support/topic/bug-function-create_function-is-deprecated/
* @link https://wordpress.org/support/topic/deprecated-function-create_function-14/
*
* @reporter @daliasued
* @link https://wordpress.org/support/topic/deprecated-function-create_function-14/#post-13312853
*
* create_function() was deprecated in PHP 7.2.0 and removed in PHP 8.0.0.
* @link https://www.php.net/manual/en/function.create-function.php
* @link https://www.php.net/manual/en/function.create-function.php
*
* The fix is to move add_action() above into run(),
* and use the bare register_widget() here.
* @see run()
*
* The fix is to move add_action() above into run(),
* and use the bare register_widget() here.
* And declare initializeWidgets() public, not private.
* Also, the visibility of initializeWidgets() is not private any longer.
*/
public function initializeWidgets() {
register_widget("MCI_Footnotes_Widget_ReferenceContainer");
register_widget( "MCI_Footnotes_Widget_ReferenceContainer" );
}
/**
@ -128,14 +134,21 @@ class MCI_Footnotes {
* @author Stefan Herndler
* @since 1.5.0
*
* @since 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution
* Updated for v2.0.0 adding jQuery UI
*
* - Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
*
* @since 2.0.0
* Updated for v2.0.4 by adding jQuery UI from WordPress following @check2020de:
* <https://wordpress.org/support/topic/gdpr-issue-with-jquery/>
* See <https://wordpress.stackexchange.com/questions/273986/correct-way-to-enqueue-jquery-ui>
*
* jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released.
*/
* jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released.
* @since 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
* @since 2.0.3 add versioning of public.css for cache busting 2020-10-29T1413+0100
* @since 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
* @since 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
* @since 2.1.4 optionally enqueue an extra style sheet 2020-12-04T2231+0100
*/
public function registerPublic() {
//### SCRIPTS
@ -143,12 +156,12 @@ class MCI_Footnotes {
// These are only enqueued if the jQuery tooltips are enabled.
// If alternative tooltips are enabled, these libraries are not needed.
// Scroll animation doesnt seem to need even jQuery Core or it gets it from elsewhere.
// @since 2.0.0 add jQueryUI from Cloudflare 2020-10-26T1907+0100
// @since 2.0.3 add versioning of public.css for cache busting 2020-10-29T1413+0100
// @since 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
// @since 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
// @since 2.1.4 optionally enqueue an extra style sheet 2020-12-04T2231+0100
// @since 2.0.0 add jQueryUI from Cloudflare 2020-10-26T1907+0100
// @since 2.0.3 add versioning of public.css for cache busting 2020-10-29T1413+0100
// @since 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
// @since 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
// @since 2.1.4 optionally enqueue an extra style sheet 2020-12-04T2231+0100
if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) {
// enqueue the jQuery plugin registered by WordPress:
@ -166,9 +179,9 @@ class MCI_Footnotes {
// added versioning 2020-11-18T2150+0100
// not use '-js' in the handle, is appended automatically
wp_enqueue_script(
'mci-footnotes-jquery-tools',
plugins_url('footnotes/js/jquery.tools.min.js'),
array(),
'mci-footnotes-jquery-tools',
plugins_url('footnotes/js/jquery.tools.min.js'),
array(),
'1.2.7.redacted.2'
);

View file

@ -1,23 +1,20 @@
<?php
/**
*
* Loads text domain of current or default language for localization.
*
* @filesource
* @author Stefan Herndler
* @since 1.5.0 14.09.14 17:47
*
* Edited:
*
* @since 2.0.0 PHP-related bug fix thanks to @matkus2 code contribution 2020-10-26T1609+0100
* @link https://wordpress.org/support/topic/error-missing-parameter-if-using-php-7-1-or-later/
* @link https://www.php.net/manual/en/migration71.incompatible.php
*
* @since 2.1.6 conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report 2020-12-08T1931+0100
* @link https://wordpress.org/support/topic/more-feature-ideas/
*
* Last modified: 2021-01-10T1755+0100
*
*
* @lastmodified 2021-02-06T1352+0100
*
* @since 2.0.0 Bugfix: Localization: correct function call apply_filters() with all required arguments after PHP 7.1 promoted warning to error, thanks to @matkus2 bug report and code contribution.
* @since 2.1.6 Bugfix: Localization: conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report.
*/
/**
* Loads text domain of current or default language for localization.
*
* @author Stefan Herndler
* @since 1.5.0
@ -35,24 +32,47 @@ class MCI_Footnotes_Language {
}
/**
* Loads the text domain for current WordPress language if exists. Otherwise fallback "en_GB" will be loaded.
* Loads the text domain for current WordPress language if exists.
* Otherwise fallback "en_GB" will be loaded.
*
* @author Stefan Herndler
* @since 1.5.0
*
* @since 2.0.0 PHP 7.1 related bug fix thanks to @matkus2 code contribution
*
*
* - Bugfix: Correct function call apply_filters() with all required arguments after PHP 7.1 promoted warning to error, thanks to @matkus2 bug report and code contribution.
*
* @since 2.0.0
* @datetime 2020-10-26T1609+0100
*
* @contributor @matkus2
* @link https://wordpress.org/support/topic/error-missing-parameter-if-using-php-7-1-or-later/
*
* Add 3rd (empty) argument in apply_filters() to prevent PHP from throwing an error:
* “Fatal error: Uncaught ArgumentCountError: Too few arguments to function apply_filters()
*
* Yet get_locale() is defined w/o parameters in wp-includes/l10n.php:30, and
* apply_filters() is defined as apply_filters( $tag, $value ) in wp-includes/plugin.php:181.
* @link https://developer.wordpress.org/reference/functions/apply_filters/
*
* But apply_filters() is defined with a 3rd parameter (and w/o the first one) in
* wp-includes/class-wp-hook.php:264, as public function apply_filters( $value, $args ).
*
* Taking it all together, probably the full function definition would be:
* public function apply_filters( $tag, $value, $args ).
* In the case of get_locale(), $args is empty.
*
* The bug was lurking in WP. PHP 7.1 promoted the warning to an error.
* @link https://www.php.net/manual/en/migration71.incompatible.php
* @link https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.too-few-arguments-exception
*/
public static function loadTextDomain() {
// language file with localization exists
if (self::load(apply_filters('plugin_locale', get_locale(), ''))) {
// added 3rd (empty) parameter to prevent "Fatal error: Uncaught ArgumentCountError: Too few arguments […]"
// 2020-10-26T1609+0100
// if language file with localization exists:
if ( self::load( apply_filters( 'plugin_locale', get_locale(), '' ) ) ) {
return;
}
// fall back to British English:
self::load("en_GB");
// else fall back to British English:
self::load( "en_GB" );
}
/**
@ -62,21 +82,27 @@ class MCI_Footnotes_Language {
* @since 1.5.1
* @param string $p_str_LanguageCode Language Code to load a specific text domain.
* @return bool
*
* Edited:
* @since 2.1.6 conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report
*
*
* - Bugfix: Localization: conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report.
*
* @since 2.1.6
* @datetime 2020-12-08T1931+0100
*
* @reporter @nikelaos
* @link https://wordpress.org/support/topic/more-feature-ideas/
* That is done by using load_plugin_textdomain()
*
* That is done by using load_plugin_textdomain():
* “The .mo file should be named based on the text domain with a dash, and then the locale exactly.
* @see wp-includes/l10n.php:857
* “The .mo file should be named based on the text domain with a dash, and then the locale exactly.
*/
private static function load($p_str_LanguageCode) {
return load_plugin_textdomain(
MCI_Footnotes_Config::C_STR_PLUGIN_NAME,
// This argument only fills the gap left by a deprecated argument (since WP2.7):
false,
false,
// The plugin basedir is provided; trailing slash would be clipped:
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages'
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages'
);
}
}

View file

@ -16,7 +16,7 @@
* @since 2.0.6 Bugfix: Priority level back to PHP_INT_MAX (ref container positioning not this plugins responsibility).
* @since 2.0.7 BUGFIX: Hooks: Default-disable 'the_post', thanks to @spaceling @@markcheret @nyamachi @whichgodsaves @spiralofhope2 @mmallett @andreasra @widecast @ymorin007 @tashi1es bug reports.
* @since 2.0.9 Bugfix: Remove the_post hook 2020-11-08T1839+0100.
* @since 2.1.0 Add: Tooltips: Read-on button: Label: configurable instead of localizable.
* @since 2.1.0 Adding: Tooltips: Read-on button: Label: configurable instead of localizable.
* @since 2.1.1 Bugfix: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report.
* @since 2.1.1 Bugfix: Reference container: fix start pages by making its display optional, thanks to @dragon013 bug report.
* @since 2.1.1 Bugfix: Referrers: new setting for vertical align: superscript (default) or baseline (optional), thanks to @cwbayer bug report.
@ -49,60 +49,60 @@
* @since 2.1.4 Bugfix: Reference container: Backlink symbol: support for appending when combining identicals is on.
* @since 2.1.4 Reference container: Backlinks: fix line breaking with respect to separators and terminators.
*
* @since 2.1.5 URL wrap: exclude image source too, thanks to @bjrnet21
* @since 2.1.5 URL wrap: exclude image source too, thanks to @bjrnet21 bug report
* @link https://wordpress.org/support/topic/2-1-4-breaks-on-my-site-images-dont-show/
*
* @since 2.1.6 option to disable URL line wrapping
* @since 2.1.6 option to disable URL line wrapping
* @datetime 2020-12-09T1606+0100
*
* @since 2.1.6 add catch-all exclusion to fix URL line wrapping, thanks to @a223123131
* @since 2.1.6 add catch-all exclusion to fix URL line wrapping, thanks to @a223123131 bug report
* @datetime 2020-12-09T1921+0100
* @link https://wordpress.org/support/topic/broken-layout-starting-version-2-1-4/
*
* @since 2.2.0 support for custom position shortcode for reference container, thanks to @hamshe
* @since 2.2.0 Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report.
* @datetime 2020-12-13T2058+0100
* @link https://wordpress.org/support/topic/reference-container-in-elementor/
*
* @since 2.2.3 custom CSS from new setting in header after legacy
* @since 2.2.3 custom CSS from new setting in header after legacy
* @datetime 2020-12-15T1128+0100
*
* @since 2.2.5 connect alternative tooltips to position and timing settings
* @since 2.2.5 connect alternative tooltips to position and timing settings
* @datetime 2020-12-18T1113+0100
*
* @since 2.2.5 delete unused position shortcode when ref container in widget or footer, thanks to @hamshe
* @since 2.2.5 delete unused position shortcode when ref container in widget or footer, thanks to @hamshe bug report
* @datetime 2020-12-18T1437+0100
* @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13784126
*
* @since 2.2.5 options for label element and label bottom border, thanks to @markhillyer
* @since 2.2.5 options for label element and label bottom border, thanks to @markhillyer support request
* @datetime 2020-12-18T1447+0100
* @link https://wordpress.org/support/topic/how-do-i-eliminate-the-horizontal-line-beneath-the-reference-container-heading/
*
* @since 2.2.6 URL wrap: make the quotation mark optional in the exclusion regex, thanks to @spiralofhope2
* @since 2.2.6 URL wrap: make the quotation mark optional in the exclusion regex, thanks to @spiralofhope2 bug report
* @datetime 2020-12-23T0409+0100
* @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/
*
* @since 2.2.7 revert that change in the exclusion regex, thanks to @rjl20, @spaceling, @friedrichnorth, @bernardzit
* @since 2.2.7 revert that change in the exclusion regex, thanks to @rjl20, @spaceling, @friedrichnorth, @bernardzit bug reports
* @datetime 2020-12-23T1046+0100
* @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/
* @link https://wordpress.org/support/topic/footnotes-dont-show-after-update-to-2-2-6/
*
* @since 2.2.8 URL wrap: correct lookbehind by duplicating it with and without quotation mark class
* @since 2.2.8 URL wrap: correct lookbehind by duplicating it with and without quotation mark class
* @datetime 2020-12-23T1108+0100
*
* @since 2.2.9 URL wrap: account for RFC 2396 allowed characters in parameter names
* @since 2.2.9 URL wrap: account for RFC 2396 allowed characters in parameter names
* @datetime 2020-12-24T1956+0100
* @link https://stackoverflow.com/questions/814700/http-url-allowed-characters-in-parameter-names
*
* @since 2.2.9 Reference containers, widget_text hook: support for multiple containers in a page, thanks to @justbecuz bug report
* @link https://wordpress.org/support/topic/reset-footnotes-to-1/#post-13662830
*
* @since 2.2.9 URL wrap: exclude URLs also where the equals sign is preceded by an entity or character reference
* @since 2.2.9 URL wrap: exclude URLs also where the equals sign is preceded by an entity or character reference
* @datetime 2020-12-25T1251+0100
*
* @since 2.2.10 URL wrap: support also file transfer protocol URLs
* @since 2.2.10 URL wrap: support also file transfer protocol URLs
* @datetime 2020-12-25T2220+0100
*
* @since 2.2.10 Reference container: add option for table borders to revert 2.0.0/2.0.1 change made on user request, thanks to @noobishh
* @since 2.2.10 Reference container: add option for table borders to revert 2.0.0/2.0.1 change made on user request, thanks to @noobishh
* @datetime 2020-12-25T2304+0100
* @link https://wordpress.org/support/topic/borders-25/
*
@ -110,7 +110,7 @@
* @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13786635
*
* @since 2.3.0 optional hard links in referrers and backlinks for AMP compatibility, thanks to @psykonevro bug report, thanks to @martinneumannat code contribution
* @since 2.3.0 swap Custom CSS migration Boolean from 'migration complete' to 'show legacy'
* @since 2.3.0 swap Custom CSS migration Boolean from 'migration complete' to 'show legacy'
* @datetime 2020-12-27T1243+0100
* @since 2.4.0 syntax validation for balanced footnote start and end tags 2021-01-01T0227+0100
* @since 2.4.0 initialize scroll offset variable to 34 as a more robust default, thanks to @lukashuggenberg 2021-01-04T0504+0100
@ -174,7 +174,7 @@ class MCI_Footnotes_Task {
public static $a_str_Prefix = "";
/**
* INFINITE SCROLL / AUTOLOAD OR ARCHIVE VIEW
* Infinite scroll / autoload or archive view
*
* - Bugfix: Infinite scroll: debug autoload by adding post ID, thanks to @docteurfitness code contribution
*
@ -193,7 +193,7 @@ class MCI_Footnotes_Task {
public static $a_int_PostId = 0;
/**
* MULTIPLE REFERENCE CONTAINERS IN CONTENT AND WIDGETS
* Multiple reference containers in content and widgets
*
* - Bugfix: Reference containers, widget_text hook: support for multiple containers in a page, thanks to @justbecuz bug report
*
@ -214,7 +214,7 @@ class MCI_Footnotes_Task {
public static $a_int_ReferenceContainerId = 1;
/**
* TEMPLATE PROCESS OPTIMIZATION
* Template process optimization
*
* - Bugfix: Performance: optimize template load and process according to settings, thanks to @misfist code contribution
*
@ -236,7 +236,7 @@ class MCI_Footnotes_Task {
public static $a_bool_AlternativeTooltipsEnabled = false;
/**
* HARD LINKS FOR AMP
* Hard links for AMP
*
* - Bugfix: Optional hard links in referrers and backlinks for AMP compatibility, thanks to @psykonevro bug report, thanks to @martinneumannat code contribution.
*
@ -265,7 +265,7 @@ class MCI_Footnotes_Task {
public static $a_str_PostContainerIdCompound = '';
/**
* SCROLL OFFSET
* Scroll offset
*
* @since 2.4.0
* @datetime 2021-01-03T2055+0100
@ -278,13 +278,14 @@ class MCI_Footnotes_Task {
public static $a_int_ScrollOffset = 34;
/**
* OPTIONAL LINK ELEMENT FOR FOOTNOTE REFERRERS AND BACKLINKS
* Optional link element for footnote referrers and backlinks
*
* @since 2.3.0
* @datetime 2020-12-30T2313+0100
* @var str
*
* STYLING:
* # Styling
*
* Link color is preferred for referrers and backlinks.
* Setting a global link color is a common feature in WordPress themes.
* CSS does not support identifiers for link colors (color: link | hover | active | visited)
@ -293,7 +294,8 @@ class MCI_Footnotes_Task {
* But styling these elements with the link color is not universally preferred.
* If not, the very presence of the link elements may need to be avoided.
*
* FUNCTIONALITY:
* # Functionality
*
* Although widely used for that purpose, hyperlinks are disliked for footnote linking.
* Browsers may need to be prevented from logging these clicks in the browsing history,
* as logging compromises the usability of the 'return to previous' button in browsers.
@ -321,7 +323,7 @@ class MCI_Footnotes_Task {
public static $a_str_LinkCloseTag = '';
/**
* DEDICATED TOOLTIP TEXT
* Dedicated tooltip text
*
* - Bugfix: Tooltips: ability to display dedicated content, thanks to @jbj2199 bug report
*
@ -341,14 +343,13 @@ class MCI_Footnotes_Task {
public static $a_int_TooltipShortcodeLength = 12;
/**
* SYNTAX VALIDATION
* Footnote delimiter syntax validation
*
* @since 2.4.0
* @var bool
*
* This part of the algorithm first checks for balanced footnote opening and closing tag
* short codes. The first encountered error triggers the display of a warning below the
* post title and cancellation of further parsing.
* The algorithm first checks for balanced footnote opening and closing tag short codes.
* The first encountered error triggers the display of a warning below the post title.
*
* Unbalanced short codes have caused significant trouble because they are hard to detect.
* Any compiler or other tool reports syntax errors in the first place. Footnotes exception
@ -369,7 +370,7 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler
* @since 1.5.0
*
* @since 1.5.4 Add: Hooks: support 'the_post' in response to user request for custom post types.
* @since 1.5.4 Adding: Hooks: support 'the_post' in response to user request for custom post types.
* @since 2.0.5 Bugfix: Reference container: fix relative position through priority level, thanks to @june01 @imeson @spaceling bug reports, thanks to @spaceling code contribution.
* @since 2.0.5 Update: Hooks: Default-enable all hooks to prevent footnotes from seeming broken in some parts.
* @since 2.0.6 Bugfix: Priority level back to PHP_INT_MAX (ref container positioning not this plugins responsibility).
@ -385,7 +386,7 @@ class MCI_Footnotes_Task {
public function registerHooks() {
/**
* PRIORITY LEVELS
* Priority levels
*
* - Bugfix: Reference container: fix relative position through priority level, thanks to @june01 @imeson @spaceling bug reports, thanks to @spaceling code contribution.
*
@ -463,10 +464,10 @@ class MCI_Footnotes_Task {
add_filter('the_content', array($this, "the_content"), $l_int_TheContentPriority);
/**
* HOOK FOR CATEGORY PAGES
* Hook for category pages
*
* -Bugfix: Hooks: support footnotes on category pages, thanks to @vitaefit bug report, thanks to @misfist code contribution
*
*
* @since 2.5.0
* @datetime 2021-01-05T1402+0100
*
@ -483,10 +484,10 @@ class MCI_Footnotes_Task {
add_filter('term_description', array($this, "the_content"), $l_int_TheContentPriority);
/**
* HOOK FOR POPUP MAKER POPUPS
* Hook for popup maker popups
*
* - Bugfix: Hooks: support footnotes in Popup Maker popups, thanks to @squatcher bug report
*
*
* @since 2.5.1
* @datetime 2021-01-18T2038+0100
*
@ -508,9 +509,9 @@ class MCI_Footnotes_Task {
/**
* THE the_post HOOK
* The the_post hook
*
* - Add: Hooks: support 'the_post' in response to user request for custom post types.
* - Adding: Hooks: support 'the_post' in response to user request for custom post types.
*
* @since 1.5.4
* @accountable @aricura
@ -600,12 +601,12 @@ class MCI_Footnotes_Task {
echo "\r\n<style type=\"text/css\" media=\"all\">\r\n";
/**
* REF CONTAINER DISPLAY ON HOME PAGE
* Reference container display on home page
*
* - Bugfix: Reference container: fix start pages by making its display optional, thanks to @dragon013 bug report.
*
*
* @since 2.1.1
*
*
* @reporter @dragon013
* @link https://wordpress.org/support/topic/possible-to-hide-it-from-start-page/
*/
@ -844,7 +845,7 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler
* @since 1.5.0
*
*
*
* @since 2.2.0 more options 2020-12-11T0506+0100
*/
public function wp_footer() {
@ -985,25 +986,9 @@ class MCI_Footnotes_Task {
* @param bool $p_bool_HideFootnotesText Hide footnotes found in the string.
* @return string
*
*
* @since 2.2.0 Add: Reference container: support for custom position shortcode, thanks to @hamshe feature request.
* @since 2.2.5 Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report.
*
* - Add: Reference container: support for custom position shortcode, thanks to @hamshe feature request.
*
* @since 2.2.0
* @datetime 2020-12-13T2057+0100
*
* @reporter @hamshe
* @link https://wordpress.org/support/topic/reference-container-in-elementor/
*
* - Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report.
*
* @since 2.2.5
* @datetime 2020-12-18T1434+0100
*
* @reporter @hamshe
* @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13784126
* @since 2.2.0 Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report.
* @since 2.2.5 Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report.
*/
public function exec($p_str_Content, $p_bool_OutputReferences = false, $p_bool_HideFootnotesText = false) {
@ -1012,6 +997,27 @@ class MCI_Footnotes_Task {
// replace all footnotes in the content, settings are NOT converted to html characters
$p_str_Content = $this->search($p_str_Content, false, $p_bool_HideFootnotesText);
/**
* Reference container customized positioning through shortcode
*
* - Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report.
*
* @since 2.2.0
* @datetime 2020-12-13T2057+0100
*
* @reporter @hamshe
* @link https://wordpress.org/support/topic/reference-container-in-elementor/
*
*
* - Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report.
*
* @since 2.2.5
* @datetime 2020-12-18T1434+0100
*
* @reporter @hamshe
* @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13784126
*
*/
// 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 ) ) {
@ -1212,7 +1218,7 @@ class MCI_Footnotes_Task {
}
/**
* URL WRAP
* URL line wrapping for Unicode non conformant browsers
*
* Fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element,
* to prevent them from hanging out of the tooltip or extending the reference container
@ -1288,9 +1294,9 @@ class MCI_Footnotes_Task {
$l_str_ExcerptText = $l_str_FootnoteText;
/**
* TOOLTIP TRUNCATION
* Tooltip truncation
*
* - Add: Tooltips: Read-on button: Label: configurable instead of localizable.
* - Adding: Tooltips: Read-on button: Label: configurable instead of localizable.
*
* @since 2.1.0
* @datetime 2020-11-08T2146+0100
@ -1331,7 +1337,7 @@ class MCI_Footnotes_Task {
}
/**
* REFERRERS ELEMENT SUPERSCRIPT OR BASELINE
* Referrers element superscript or baseline
*
* Referrers: new setting for vertical align: superscript (default) or baseline (optional), thanks to @cwbayer bug report
* @since 2.1.1
@ -1483,7 +1489,7 @@ class MCI_Footnotes_Task {
/**
* FOOTNOTE INDEX BACKLINK SYMBOL
* Footnote index backlink symbol
*
* @since 2.0.0 Update: remove backlink symbol along with column 2 of the reference container
* @since 2.0.3 Bugfix: prepend an arrow on user request
@ -1526,7 +1532,7 @@ class MCI_Footnotes_Task {
/**
* BACKLINK SEPARATOR
* Backlink separator
*
* Initially a comma was appended in this algorithm for enumerations.
* The comma in enumerations is not generally preferred.
@ -1556,7 +1562,7 @@ class MCI_Footnotes_Task {
}
/**
* BACKLINK TERMINATOR
* Backlink terminator
*
* Initially a dot was appended in the table row template.
* @since 2.0.6 a dot after footnote numbers is discarded as not localizable;
@ -1588,7 +1594,7 @@ class MCI_Footnotes_Task {
/**
* LINE BREAKS
* Line breaks
*
* The backlinks of combined footnotes are generally preferred in an enumeration.
* But when few footnotes are identical, stacking the items in list form is better.
@ -1606,7 +1612,7 @@ class MCI_Footnotes_Task {
/**
* REFERENCE CONTAINER TABLE ROW TEMPLATE LOAD
* Reference container table row template load
*
* Reference container: option to restore 3-column layout (combining identicals turned off)
* @since 2.1.1
@ -1640,7 +1646,7 @@ class MCI_Footnotes_Task {
}
/**
* SWITCH BACKLINK SYMBOL AND FOOTNOTE NUMBER
* Switch backlink symbol and footnote number
*
* - Bugfix: Reference container: option to append symbol (prepended by default), thanks to @spaceling code contribution.
*
@ -1710,7 +1716,7 @@ class MCI_Footnotes_Task {
/**
* SUPPORT FOR COMBINING IDENTICALS: COMPOSE ENUMERATED BACKLINKS
* Support for combining identicals: compose enumerated backlinks
*
* Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity
* @reporter @happyches bug report

View file

@ -6,20 +6,26 @@
* @author Stefan Herndler
* @since 1.5.0 14.09.14 10:58
*
* Last modified: 2021-01-07T2209+0100
*
* @lastmodified 2021-02-06T0604+0100
*
* Edited:
* @since 2.0.3 prettify reference container template
* @since 2.0.3 further minify template content
* @since 2.0.4 regex to delete multiple spaces
* @since 2.0.3 replace tab with a space
* @since 2.0.3 replace 2 spaces with 1
* @since 2.0.4 collapse multiple spaces
* @since 2.0.6 prettify other templates (footnote, tooltip script, ref container row)
* @since 2.2.6 delete a space before a closing pointy bracket
*
* @since 2.2.6 support for custom templates in fixed location, while failing to add filter thanks to @misfist 2020-12-19T0606+0100
* @link https://wordpress.org/support/topic/template-override-filter/
*
* @since 2.4.0 templates may be in active theme, thanks to @misfist
* @link https://wordpress.org/support/topic/template-override-filter/#post-13846598
*
* @since 2.5.0 Enable template location stack, contributed by @misfist
* @link https://wordpress.org/support/topic/template-override-filter/#post-13864301
*
* @since 2.5.4 collapse HTML comments and PHP/JS docblocks (only)
*/
@ -87,15 +93,10 @@ class MCI_Footnotes_Template {
* @param string $p_str_FileName Template file name inside the Template directory without the file extension.
* @param string $p_str_Extension Optional Template file extension (default: html)
*
* Edited:
* @since 2.0.3 further minify template content
* @since 2.0.4 regex to delete multiple spaces
*
*
* @since 2.2.6 support for custom templates 2020-12-19T0606+0100
* @link https://wordpress.org/support/topic/template-override-filter/
*
* @since 2.2.6 delete a space before a closing pointy bracket
*
* @since 2.4.0 look for custom template in the active theme first, thanks to @misfist
* @link https://wordpress.org/support/topic/template-override-filter/#post-13846598
*/
@ -184,9 +185,18 @@ class MCI_Footnotes_Template {
*
* @param string $template
* @return void
*
*
* @since 2.0.3 replace tab with a space
* @since 2.0.3 replace 2 spaces with 1
* @since 2.0.4 collapse multiple spaces
* @since 2.2.6 delete a space before a closing pointy bracket
* @since 2.5.4 collapse HTML comments and PHP/JS docblocks (only)
*/
public function process_template( $template ) {
$this->a_str_OriginalContent = str_replace( "\n", "", file_get_contents( $template ) );
$this->a_str_OriginalContent = preg_replace( '#<!--.+?-->#s', " ", file_get_contents( $template ) );
$this->a_str_OriginalContent = preg_replace( '#/\*\*.+?\*/#s', " ", $this->a_str_OriginalContent );
$this->a_str_OriginalContent = str_replace( "\n", "", $this->a_str_OriginalContent );
$this->a_str_OriginalContent = str_replace( "\r", "", $this->a_str_OriginalContent );
$this->a_str_OriginalContent = str_replace( "\t", " ", $this->a_str_OriginalContent );
$this->a_str_OriginalContent = preg_replace( '# +#', " ", $this->a_str_OriginalContent );