update with last changes (2.6.0d0)

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2456650 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2021-01-14 22:56:43 +00:00
parent d3ccc658e8
commit 1c7debbaf5
8 changed files with 197 additions and 97 deletions

View file

@ -5,11 +5,16 @@
* @author Stefan Herndler
* @since 1.5.0 14.09.14 17:47
*
* Edited for:
* 2.0.0 PHP-related bug fix thanks to @matkus 2020-10-26T1609+0100
* 2.1.6 conform to WordPress plugin language file name scheme 2020-12-08T1931+0100
* Edited:
*
* Last modified: 2020-12-25T0344+0100
* @since 2.0.0 PHP-related bug fix thanks to @matkus2 code contribution 2020-10-26T1609+0100
* @see <https://wordpress.org/support/topic/error-missing-parameter-if-using-php-7-1-or-later/>
* @see <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
* @see <https://wordpress.org/support/topic/more-feature-ideas/>
*
* Last modified: 2021-01-10T1755+0100
*/
/**
@ -35,7 +40,7 @@ class MCI_Footnotes_Language {
* @author Stefan Herndler
* @since 1.5.0
*
* @since 2.0.0 PHP 7.1 related bug fix thanks to @matkus
* @since 2.0.0 PHP 7.1 related bug fix thanks to @matkus2 code contribution
* @see <https://wordpress.org/support/topic/error-missing-parameter-if-using-php-7-1-or-later/>
* @see <https://www.php.net/manual/en/migration71.incompatible.php>
*/
@ -58,16 +63,20 @@ class MCI_Footnotes_Language {
* @param string $p_str_LanguageCode Language Code to load a specific text domain.
* @return bool
*
* Edited for:
* 2.1.6 conform to WordPress plugin language file name scheme by using load_plugin_textdomain()
* Edited:
* @since 2.1.6 conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report
* @see <https://wordpress.org/support/topic/more-feature-ideas/>
* That is done by using load_plugin_textdomain()
* @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,
false, // This argument only fills the gap left by a deprecated argument (since WP2.7).
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages' // The plugin basedir is provided; trailing slash will be clipped.
// This argument only fills the gap left by a deprecated argument (since WP2.7):
false,
// The plugin basedir is provided; trailing slash would be clipped:
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages'
);
}
}

View file

@ -6,39 +6,64 @@
* @author Stefan Herndler
* @since 1.5.0 14.09.14 10:43
*
* Last modified: 2021-01-07T2206+0100
* Last modified: 2021-01-12T2217+0100
*
* Edited:
*
* @since 2.0.4 restore arrow settings 2020-11-02T2115+0100
*
* @since 2.0.7 remove hook the_post 2020-11-06T1342+0100
*
* @since 2.1.0 add read-on button label customization 2020-11-08T2149+0100
*
* @since 2.1.1 fix tooltips on site by alternative 2020-11-11T1819+0100
*
* @since 2.1.1 fix disabling backlink symbol 2020-11-16T2021+0100
*
* @since 2.1.1 fix superscript by making it optional
*
* @since 2.1.1 fix start pages by option to hide ref container, thanks to @dragon013
* @see <https://wordpress.org/support/topic/possible-to-hide-it-from-start-page/>
*
* @since 2.1.1 fix ref container by option restoring 3-column layout
*
* @since 2.1.1 fix ref container by option to switch index/symbol 2020-11-16T2022+0100
*
* @since 2.1.3 excerpt hook: disable by default, thanks to @nikelaos
* @see <https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13687068>
*
* @since 2.1.3 fix ref container positioning by priority level 2020-11-17T0205+0100
*
* @since 2.1.4 more settings container keys 2020-12-03T0955+0100
*
* @since 2.1.6 option to disable URL line wrapping 2020-12-09T1606+0100
*
* @since 2.1.6 set default priority level of the_content to 98 to prevent plugin conflict, thanks to @marthalindeman 2020-12-10T0447+0100
*
* @since 2.2.0 reference container custom position shortcode, thanks to @hamshe 2020-12-13T2056+0100
* @see <https://wordpress.org/support/topic/reference-container-in-elementor/>
*
* @since 2.2.2 Custom CSS settings container migration 2020-12-15T0709+0100
*
* @since 2.2.4 move backlink symbol selection under previous tab 2020-12-16T1256+0100
*
* @since 2.2.5 alternative tooltip position settings 2020-12-17T0907+0100
*
* @since 2.2.5 options for reference container label element and bottom border, thanks to @markhillyer 2020-12-18T1455+0100
* @see <https://wordpress.org/support/topic/how-do-i-eliminate-the-horizontal-line-beneath-the-reference-container-heading/>
*
* @since 2.2.9 set default priority level of widget_text to 98 like for the_content (since 2.1.6), thanks to @marthalindeman 2020-12-25T1646+0100
*
* @since 2.2.10 reference container row border option, thanks to @noobishh 2020-12-25T2316+0100
* @see <https://wordpress.org/support/topic/borders-25/>
*
* @since 2.3.0 reference container: settings for top (and bottom) margin, thanks to @hamshe
* @see <https://wordpress.org/support/topic/reference-container-in-elementor/#post-13786635>
*
* @since 2.3.0 swap Custom CSS migration Boolean from 'migration complete' to 'show legacy' 2020-12-27T1243+0100
*
* @since 2.3.0 referrers, reference container: settings for anchor slugs 2020-12-31T1429+0100
*
* @since 2.4.0 footnote shortcode syntax validation 2021-01-01T0624+0100
*/
@ -566,18 +591,18 @@ class MCI_Footnotes_Settings {
const C_STR_FOOTNOTE_FRAGMENT_ID_SLUG = "footnotes_inputfield_footnote_fragment_id_slug";
const C_STR_HARD_LINK_IDS_SEPARATOR = "footnotes_inputfield_hard_link_ids_separator";
/**
* Settings container key for shortcode syntax validation
*
* @since 2.4.0
* @var bool
*
* 2021-01-01T0616+0100
*/
const C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE = "footnotes_inputfield_shortcode_syntax_validation_enable";
/**
* Settings container key for shortcode syntax validation
*
* @since 2.4.0
* @var bool
*
* 2021-01-01T0616+0100
*/
const C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE = "footnotes_inputfield_shortcode_syntax_validation_enable";
/**
* SETTINGS STORAGE
*/
@ -922,6 +947,9 @@ class MCI_Footnotes_Settings {
* @since 1.5.0
* @param int $p_int_Index Settings Container Array Key Index.
* @return array Settings loaded from Container of Default Settings if Settings Container is empty (first usage).
*
* @since ditched trimming whitespace from text box content in response to user request.
* @see <https://wordpress.org/support/topic/leading-space-in-footnotes-tag/#post-5347966>
*/
private function Load($p_int_Index) {
// load all settings from container
@ -944,6 +972,7 @@ class MCI_Footnotes_Settings {
// iterate through each setting in the container
foreach($l_arr_Options as $l_str_Key => $l_str_Value) {
// remove all whitespace at the beginning and end of a setting
// trimming whitespace is ditched:
//$l_str_Value = trim($l_str_Value);
// write the sanitized value back to the setting container
$l_arr_Options[$l_str_Key] = $l_str_Value;

View file

@ -10,73 +10,111 @@
*
* Last modified: 2021-01-07T2219+0100
*
* @since 2.0.5 Autoload / infinite scroll support added thanks to code from @docteurfitness
* @since 2.0.5 debug autoload / infinite scroll through added post ID, contributed by @docteurfitness
* @see <https://wordpress.org/support/topic/auto-load-post-compatibility-update/>
*
* @since 2.0.9 DISABLED the_post HOOK 2020-11-08T1839+0100
* @since 2.0.9 REMOVED the_post HOOK 2020-11-08T1839+0100
*
* @since 2.1.0 promote the 'Continue reading' button from localization to configuration 2020-11-08T2146+0100
*
* @since 2.1.1 combining identical footnotes: fixed dead links, thanks to @happyches 2020-11-14T2233+0100
* @see <https://wordpress.org/support/topic/custom-css-for-jumbled-references/>
*
* @since 2.1.1 fix start pages by option to hide ref container, thanks to @dragon013
* @see <https://wordpress.org/support/topic/possible-to-hide-it-from-start-page/>
*
* @since 2.1.1 options fixing ref container layout and referrer vertical alignment 2020-11-16T2024+0100
*
* @since 2.1.1 priority level option fixing ref container relative position, thanks to june01, @spaceling, @imeson 2020-11-17T0254+0100
* @see <https://wordpress.org/support/topic/change-the-position-5/>
*
* @since 2.1.2 priority level settings for all other hooks, thanks to @nikelaos 2020-11-19T1849+0100
* @see <https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13676705>
*
* @since 2.1.4 fix line wrapping of URLs based on pattern, not link element 2020-11-25T0837+0100
*
* @since 2.1.4 fix issues with link elements by making them optional 2020-11-26T1051+0100
*
* @since 2.1.4 support appending arrow when combining identicals is on 2020-11-26T1633+0100
*
* @since 2.1.4 disable or select backlink separator and terminator 2020-11-28T1048+0100
*
* @since 2.1.4 optional line breaks to stack enumerated backlinks 2020-11-28T1049+0100
*
* @since 2.1.4 ref container column width and tooltip font size settings 2020-12-03T0954+0100
*
* @since 2.1.4 scroll offset and duration settings 2020-12-05T0538+0100
*
* @since 2.1.4 tooltip display duration settings 2020-12-06T1320+0100
*
* @since 2.1.5 URL wrap: exclude image source too, thanks to @bjrnet21
* @see <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 2020-12-09T1606+0100
*
* @since 2.1.6 add catch-all exclusion to fix URL line wrapping, thanks to @a223123131 2020-12-09T1921+0100
* @see <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 2020-12-13T2058+0100
* @see <https://wordpress.org/support/topic/reference-container-in-elementor/>
*
* @since 2.2.3 custom CSS from new setting in header after legacy 2020-12-15T1128+0100
* @since 2.2.5 connected alternative tooltips to position and timing settings 2020-12-18T1113+0100
*
* @since 2.2.5 connect alternative tooltips to position and timing settings 2020-12-18T1113+0100
*
* @since 2.2.5 delete unused position shortcode when ref container in widget or footer, thanks to @hamshe 2020-12-18T1437+0100
* @see <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 2020-12-18T1447+0100
* @see <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 2020-12-23T0409+0100
* @see <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 2020-12-23T1046+0100
* @see <https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/>
* @see <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 2020-12-23T1108+0100
*
* @since 2.2.9 URL wrap: account for RFC 2396 allowed characters in parameter names 2020-12-24T1956+0100
* @see <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 2020-12-25T0338+0100
* @see <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 2020-12-25T1251+0100
*
* @since 2.2.10 URL wrap: support also file transfer protocol URLs 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 2020-12-25T2304+0100
* @see <https://wordpress.org/support/topic/borders-25/>
*
* @since 2.3.0 Reference container: convert top padding to margin and make it a setting, thanks to @hamshe
* @see <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 and @martinneumannat
* @see <https://wordpress.org/support/topic/making-it-amp-compatible/>
* @see <https://wordpress.org/support/topic/footnotes-is-not-amp-compatible/>
*
* @since 2.3.0 swap Custom CSS migration Boolean from 'migration complete' to 'show legacy' 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 scroll offset to a safety default value 34 right in the properties section 2021-01-03T2056+0100
*
* @since 2.4.0 initialize scroll offset variable to 34 as a more robust default, thanks to @lukashuggenberg 2021-01-04T0504+0100
*
* @since 2.4.0 set empty reference container label to NNBSP to make it more robust, thanks to @lukashuggenberg 2021-01-04T0504+0100
*
* @since 2.4.0 optimize template load and process, thanks to @misfist 2021-01-04T1355+0100
*
* @since 2.4.0 initialize hard link address as empty to fix undefined variable bug, thanks to @a223123131 2021-01-04T1622+0100
*
* @since 2.5.0 Shortcode syntax validation: exclude certain cases involving scripts, thanks to @andreasra 2021-01-07T0824+0100
* @since 2.5.0 Shortcode syntax validation: complete message with hint about setting, thanks to @andreasra
* @since 2.5.0 Shortcode syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra
* @see <https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/>
* @since 2.5.0 Hooks: support the term_description hook, thanks to @vitaefit (feature) and @misfist (hook name)
*
* @since 2.5.0 Hooks: support the term_description hook, thanks to @vitaefit (bug report) and @misfist (hook name)
* @see <https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/>
*/
@ -252,13 +290,26 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler
* @since 1.5.0
*
* Edited for:
* Edited:
*
* the_post hook:
* @since 1.5.4 added the_post hook in response to user request for custom post types
* @see <https://wordpress.org/support/topic/doesnt-work-in-custon-post-types/#post-5339110>
*
* @since 2.0.9 removed the_post hook after its default enabling caused multiple issues 2020-11-08T1839+0100
* @see <https://wordpress.org/support/topic/change-the-position-5/page/2/#post-13630114
* @see <https://wordpress.org/support/topic/footnotes-appearing-in-header/#post-13630303>
* @see <https://wordpress.org/support/topic/footnotes-appearing-in-header/page/2/#post-13630799>
* @see <https://wordpress.org/support/topic/no-footnotes-anymore/#post-13813233>
*
* Category pages:
* @since 2.5.0 support for the term_description hook, thanks to @vitaefit bug report, thanks to @misfist code contribution
* @see <https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/>
*
* Priority level:
* @since 2.0.5 through v2.0.7 changes to priority 2020-11-02T0330+0100..2020-11-06T1344+0100
* @since 2.1.1 add setting for the_content
* @since 2.1.2 add settings for 4 other hooks 2020-11-19T1248+0100
*
* @since 2.5.0 support for the term_description hook, thanks to @vitaefit (feature) and @misfist (hook name)
* @see <https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/>
*
* Setting the_content priority to "10" instead of PHP_INT_MAX i.e. 9223372036854775807
* makes the footnotes reference container display beneath the post and above other
@ -302,6 +353,9 @@ class MCI_Footnotes_Task {
// custom priority level for reference container relative positioning; default 98:
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT))) {
add_filter('the_content', array($this, "the_content"), $p_int_TheContentPriority);
// HOOK FOR CATEGORY PAGES:
// 2021-01-05T1402+0100
// see <https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/#post-13866617>
add_filter('term_description', array($this, "the_content"), $p_int_TheContentPriority);
}
@ -315,11 +369,6 @@ class MCI_Footnotes_Task {
add_filter('widget_text', array($this, "widget_text"), $p_int_WidgetTextPriority);
}
// HOOK FOR CATEGORY PAGES:
// 2021-01-05T1402+0100
// see <https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/#post-13866617>
// add_filter('term_description', array($this, "the_content"), $p_int_TheContentPriority);
// REMOVED the_post HOOK 2020-11-08T1839+0100
//
@ -790,7 +839,7 @@ class MCI_Footnotes_Task {
* @since 2.5.0 Shortcode syntax validation: exclude certain cases involving scripts, thanks to @andreasra 2021-01-07T0824+0100
* @since 2.5.0 Shortcode syntax validation: complete message with hint about setting, thanks to @andreasra
* @since 2.5.0 Shortcode syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra
* @see <https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/>
* @see <https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/>
*/
public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) {
@ -799,7 +848,7 @@ class MCI_Footnotes_Task {
// contains the index for the next footnote on this page
$l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1;
// contains the starting position for the lookup of a footnote
$l_int_PosStart = 0;