Documentation

Footnotes_Parser
in package

Searches and replaces the footnotes and generates the reference container.

Tags
since
1.5.0
since
2.8.0

Rename class from Footnotes_Task to Footnotes_Parser.

Table of Contents

$a_arr_footnotes  : array<string|int, mixed>
Contains all footnotes found in the searched content.
$a_bool_allow_love_me  : bool
Flag if the display of 'LOVE FOOTNOTES' is allowed on the current public page.
$a_bool_hard_links_enabled  : bool
Hard links for AMP compatibility.
$a_bool_mirror_tooltip_text  : bool
Whether to mirror the tooltip text in the reference container.
$a_bool_syntax_error_flag  : bool
Footnote delimiter syntax validation enabled.
$a_int_post_id  : int
Autoload a.k.a. infinite scroll, or archive view.
$a_int_reference_container_id  : int
Multiple reference containers in content and widgets.
$a_int_scroll_offset  : int
Scroll offset.
$a_int_tooltip_shortcode_length  : int
The tooltip delimiter shortcode length.
$a_str_end_tag  : str
Footnote delimiter end short code.
$a_str_end_tag_regex  : str
Footnote delimiter end short code in regex format.
$a_str_footnote_link_slug  : str
The footnote slug.
$a_str_link_close_tag  : str
The closing tag.
$a_str_link_open_tag  : str
The opening tag.
$a_str_link_span  : str
The span element name.
$a_str_post_container_id_compound  : str
Contains the concatenated fragment ID base.
$a_str_prefix  : string
Prefix for the Footnote html element ID.
$a_str_referrer_link_slug  : str
The referrer slug.
$a_str_start_tag  : str
Footnote delimiter start short code.
$a_str_start_tag_regex  : str
Footnote delimiter start short code in regex format.
$a_str_tooltip_shortcode  : str
The tooltip delimiter shortcode.
$a_str_link_ids_separator  : str
The slug and identifier separator.
__construct()  : mixed
Initialize the class and set its properties.
exec()  : string
Replaces all footnotes that occur in the given content.
footnotes_in_content()  : string
Replaces footnotes in the content of the current page/post.
footnotes_in_excerpt()  : string
Processes existing excerpt or replaces it with a new one generated on the basis of the post.
footnotes_in_title()  : string
Replaces footnotes in the post/page title.
footnotes_in_widget_text()  : string
Replaces footnotes in the content of the current widget.
footnotes_in_widget_title()  : string
Replaces footnotes in the widget title.
footnotes_output_footer()  : mixed
Displays the 'LOVE FOOTNOTES' slug if enabled.
footnotes_output_head()  : mixed
Outputs the custom css to the header of the public page.
generate_excerpt()  : string
Generates excerpt on the basis of the post.
generate_excerpt_with_footnotes()  : string
Generates excerpt with footnotes on the basis of the post.
reference_container()  : string
Generates the reference container.
register_hooks()  : mixed
Register WordPress hooks to replace Footnotes in the content of a public page.
search()  : string
Replaces all footnotes in the given content and appends them to the static property.
unify_delimiters()  : mixed
Brings the delimiters and unifies their various HTML escapement schemas.

Properties

$a_arr_footnotes

Contains all footnotes found in the searched content.

public static array<string|int, mixed> $a_arr_footnotes = array()
Tags
since
1.5.0

$a_bool_allow_love_me

Flag if the display of 'LOVE FOOTNOTES' is allowed on the current public page.

public static bool $a_bool_allow_love_me = rue
Tags
since
1.5.0

Hard links for AMP compatibility.

public static bool $a_bool_hard_links_enabled = alse
Tags
since
2.0.0

Bugfix: footnote links script independent.

  • Bugfix: Referrers and backlinks: remove hard links to streamline browsing history, thanks to @theroninjedi47 bug report.
since
2.0.4
  • Adding: Referrers and backlinks: optional hard links for AMP compatibility, thanks to @psykonevro issue report, thanks to @martinneumannat issue report and code contribution.
since
2.3.0
reporter

@theroninjedi47

reporter

@psykonevro

link
https://wordpress.org/support/topic/hyperlinked-footnotes-creating-excessive-back-history/
link
https://wordpress.org/support/topic/making-it-amp-compatible/
link
https://wordpress.org/support/topic/footnotes-is-not-amp-compatible/
contributor

@martinneumannat

$a_bool_mirror_tooltip_text

Whether to mirror the tooltip text in the reference container.

public static bool $a_bool_mirror_tooltip_text = alse
Tags
since
2.5.2

$a_bool_syntax_error_flag

Footnote delimiter syntax validation enabled.

public static bool $a_bool_syntax_error_flag = rue
  • Adding: Footnote delimiters: syntax validation for balanced footnote start and end tag short codes.
Tags
since
2.4.0

$a_int_tooltip_shortcode_length

The tooltip delimiter shortcode length.

public static int $a_int_tooltip_shortcode_length = 12
Tags
since
2.5.2

$a_str_end_tag

Footnote delimiter end short code.

public static str $a_str_end_tag = ''
Tags
since
1.5.0

(constant, variable)

since
2.6.2

(property)

$a_str_end_tag_regex

Footnote delimiter end short code in regex format.

public static str $a_str_end_tag_regex = ''
Tags
since
2.4.0

(variable)

since
2.6.2

(property)

The footnote slug.

public static str $a_str_footnote_link_slug = 'f'
Tags
since
2.3.0

The closing tag.

public static str $a_str_link_close_tag = ''
Tags
since
2.3.0

The opening tag.

public static str $a_str_link_open_tag = ''
Tags
since
2.3.0

The span element name.

public static str $a_str_link_span = 'span'
Tags
since
2.3.0

$a_str_post_container_id_compound

Contains the concatenated fragment ID base.

public static str $a_str_post_container_id_compound = ''
Tags
since
2.3.0

$a_str_prefix

Prefix for the Footnote html element ID.

public static string $a_str_prefix = ''
Tags
since
1.5.8

The referrer slug.

public static str $a_str_referrer_link_slug = 'r'
Tags
since
2.3.0

$a_str_start_tag

Footnote delimiter start short code.

public static str $a_str_start_tag = ''
Tags
since
1.5.0

(constant, variable)

since
2.6.2

(property)

$a_str_start_tag_regex

Footnote delimiter start short code in regex format.

public static str $a_str_start_tag_regex = ''
Tags
since
2.4.0

(variable)

since
2.6.2

(property)

$a_str_tooltip_shortcode

The tooltip delimiter shortcode.

public static str $a_str_tooltip_shortcode = '[[/tooltip]]'
Tags
since
2.5.2

The slug and identifier separator.

private static str $a_str_link_ids_separator = '+'
Tags
since
2.3.0

Methods

__construct()

Initialize the class and set its properties.

public __construct() : mixed
Tags
since
2.8.0
Return values
mixed

exec()

Replaces all footnotes that occur in the given content.

public exec(string $p_str_content[, bool $p_bool_output_references = false ][, bool $p_bool_hide_footnotes_text = false ]) : string
Parameters
$p_str_content : string

Any string that may contain footnotes to be replaced.

$p_bool_output_references : bool = false

Appends the Reference Container to the output if set to true, default true.

$p_bool_hide_footnotes_text : bool = false

Hide footnotes found in the string.

Tags
since
1.5.0
Return values
string

footnotes_in_content()

Replaces footnotes in the content of the current page/post.

public footnotes_in_content(string $p_str_content) : string
Parameters
$p_str_content : string

Page/Post content.

Tags
since
1.5.0
  • Adding: Reference container: optionally per section by shortcode, thanks to @grflukas issue report.
since
2.7.0
reporter

@grflukas

link
https://wordpress.org/support/topic/multiple-reference-containers-in-single-post/
Return values
string

$p_str_content Content with replaced footnotes.

footnotes_in_excerpt()

Processes existing excerpt or replaces it with a new one generated on the basis of the post.

public footnotes_in_excerpt(string $p_str_excerpt) : string
Parameters
$p_str_excerpt : string

Excerpt content.

Tags
since
1.5.0
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.
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.

reporter

@mfessler

link
https://github.com/markcheret/footnotes/issues/65
Return values
string

$p_str_excerpt Processed or new excerpt.

footnotes_in_title()

Replaces footnotes in the post/page title.

public footnotes_in_title(string $p_str_content) : string
Parameters
$p_str_content : string

Title.

Tags
since
1.5.0
Return values
string

$p_str_content Title with replaced footnotes.

footnotes_in_widget_text()

Replaces footnotes in the content of the current widget.

public footnotes_in_widget_text(string $p_str_content) : string
Parameters
$p_str_content : string

Widget content.

Tags
since
1.5.0
Return values
string

$p_str_content Content with replaced footnotes.

footnotes_in_widget_title()

Replaces footnotes in the widget title.

public footnotes_in_widget_title(string $p_str_content) : string
Parameters
$p_str_content : string

Widget content.

Tags
since
1.5.0
Return values
string

$p_str_content Content with replaced footnotes.

Displays the 'LOVE FOOTNOTES' slug if enabled.

public footnotes_output_footer() : mixed
Tags
since
1.5.0
since
2.2.0

More options.

Return values
mixed

footnotes_output_head()

Outputs the custom css to the header of the public page.

public footnotes_output_head() : mixed
Tags
since
1.5.0
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: Tooltips: optional alternative JS implementation with CSS transitions to fix configuration-related outage, thanks to @andreasra feedback.

since
2.1.3

raise settings priority to override theme stylesheets

since
2.1.4

Bugfix: Tooltips: Styling: fix font size issue by adding font size to settings with legacy as default.

since
2.1.4

Bugfix: Reference container: fix layout issues by moving backlink column width to settings.

since
2.2.5

Bugfix: Reference container: Label: make bottom border an option, thanks to @markhillyer issue report.

since
2.2.5

Bugfix: Reference container: Label: option to select paragraph or heading element, thanks to @markhillyer issue report.

since
2.3.0

Bugfix: Reference container: convert top padding to margin and make it a setting, thanks to @hamshe bug report.

since
2.5.4

Bugfix: Referrers: optional fixes to vertical alignment, font size and position (static) for in-theme consistency and cross-theme stability, thanks to @tomturowski bug report.

Return values
mixed

generate_excerpt()

Generates excerpt on the basis of the post.

public generate_excerpt(string $p_str_content) : string
  • Bugfix: Excerpts: debug the 'No' option by generating excerpts on the basis of the post without footnotes, thanks to @nikelaos @markcheret @martinneumannat bug reports.
Parameters
$p_str_content : string

The post.

Tags
reporter

@nikelaos

reporter

@markcheret

reporter

@martinneumannat

link
https://wordpress.org/support/topic/jquery-comes-up-in-feed-content/
link
https://wordpress.org/support/topic/doesnt-work-with-mailpoet/
link
https://wordpress.org/support/topic/footnotes-now-appear-in-summaries-even-though-this-is-marked-no/
link
https://wordpress.org/support/topic/problem-with-footnotes-in-excerpts-of-the-blog-page/
link
https://developer.wordpress.org/reference/functions/wp_trim_excerpt/
link
https://developer.wordpress.org/reference/functions/wp_trim_words/
since
2.6.2
Return values
string

$p_str_content An excerpt of the post. Applies full WordPress excerpt processing.

generate_excerpt_with_footnotes()

Generates excerpt with footnotes on the basis of the post.

public generate_excerpt_with_footnotes(string $p_str_content) : string
  • Bugfix: Excerpts: debug the 'Yes' option by generating excerpts with footnotes on the basis of the posts, thanks to @nikelaos @martinneumannat bug reports.
Parameters
$p_str_content : string

The post.

Tags
reporter

@nikelaos

reporter

@martinneumannat

reporter

@scroom

reporter

@copylefter

reporter

@lagoon24

link
https://wordpress.org/support/topic/jquery-comes-up-in-feed-content/
link
https://wordpress.org/support/topic/doesnt-work-with-mailpoet/
link
https://wordpress.org/support/topic/problem-with-footnotes-in-excerpts-of-the-blog-page/
link
https://wordpress.org/support/topic/update-crashed-my-website-3/
link
https://wordpress.org/support/topic/update-crashed-my-website-3/#post-14259151
link
https://wordpress.org/support/topic/update-crashed-my-website-3/#post-14259396
link
https://wordpress.org/plugins/advanced-excerpt/
since
2.6.3
  • Bugfix: Process: remove trailing comma after last argument in multiline function calls for PHP < 7.3, thanks to @scroom @copylefter @lagoon24 bug reports.
since
2.6.4
see
self::generate_excerpt()

Uses information and some code from Advanced Excerpt.

Return values
string

$p_str_content An excerpt of the post. Does not apply full WordPress excerpt processing.

reference_container()

Generates the reference container.

public reference_container() : string
Tags
since
1.5.0
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

since
2.0.6

Bugfix: Reference container: fix line breaking behavior in footnote number clusters.

since
2.0.4

Bugfix: restore the arrow select and backlink symbol input settings

since
2.1.1

Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report.

since
2.1.1

Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback.

Return values
string

register_hooks()

Register WordPress hooks to replace Footnotes in the content of a public page.

public register_hooks() : mixed
Tags
since
1.5.0
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 plugin’s 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.7

Bugfix: Set priority level back to 10 assuming it is unproblematic.

since
2.0.8

Bugfix: Priority level back to PHP_INT_MAX (need to get in touch with other plugins).

since
2.1.0

UPDATE: Hooks: remove 'the_post', the plugin stops supporting this hook.

since
2.1.1

Bugfix: Dashboard: priority level setting for the_content hook, thanks to @imeson bug report.

since
2.1.2

Bugfix: Dashboard: priority level settings for all other hooks, thanks to @nikelaos bug report.

since
2.5.0

Bugfix: Hooks: support footnotes on category pages, thanks to @vitaefit bug report, thanks to @misfist code contribution.

since
2.5.1

Bugfix: Hooks: support footnotes in Popup Maker popups, thanks to @squatcher bug report.

Return values
mixed

Replaces all footnotes in the given content and appends them to the static property.

public search(string $p_str_content, bool $p_bool_hide_footnotes_text) : string
Parameters
$p_str_content : string

Any content to be searched for footnotes.

$p_bool_hide_footnotes_text : bool

Hide footnotes found in the string.

Tags
since
1.5.0
since
2.0.0

various.

since
2.4.0

Adding: Footnote delimiters: syntax validation for balanced footnote start and end tag short codes.

since
2.5.0

Bugfix: Footnote delimiters: Syntax validation: exclude certain cases involving scripts, thanks to @andreasra bug report.

since
2.5.0

Bugfix: Footnote delimiters: Syntax validation: complete message with hint about setting, thanks to @andreasra bug report.

since
2.5.0

Bugfix: Footnote delimiters: Syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra bug report.

  • Bugfix: Footnote delimiter short codes: debug closing pointy brackets in the Block Editor by accounting for unbalanced HTML escapement, thanks to @patrick_here @alifarahani8000 bug reports.
since
2.5.13
reporter

@patrick_here

reporter

@alifarahani8000

link
https://wordpress.org/support/topic/how-to-add-footnotes-shortcode-in-elementor/
link
https://wordpress.org/support/topic/after-version-2-5-10-the-ref-or-tags-are-not-longer-working/
Return values
string

unify_delimiters()

Brings the delimiters and unifies their various HTML escapement schemas.

public unify_delimiters(string $p_str_content) : mixed
Parameters
$p_str_content : string

TODO.

  • Bugfix: Footnote delimiter short codes: fix numbering bug by cross-editor HTML escapement schema unification, thanks to @patrick_here @alifarahani8000 @gova bug reports.
Tags
reporter

@patrick_here

reporter

@alifarahani8000

reporter

@gova

link
https://wordpress.org/support/topic/how-to-add-footnotes-shortcode-in-elementor/
link
https://wordpress.org/support/topic/after-version-2-5-10-the-ref-or-tags-are-not-longer-working/
link
https://wordpress.org/support/topic/footnotes-content-number-not-sequential/
since
2.1.14

While the Classic Editor (visual mode) escapes both pointy brackets, the Block Editor enforces balanced escapement only in code editor mode when the opening tag is already escaped. In visual mode, the Block Editor does not escape the greater-than sign.

Return values
mixed

Search results