Rebase to 2.5.7

This commit is contained in:
Ben Goldsworthy 2021-02-27 08:12:17 +00:00
commit f5b2e1f30f

View file

@ -6,7 +6,6 @@
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* *
*
* @lastmodified 2021-02-20T0438+0100 * @lastmodified 2021-02-20T0438+0100
* *
* @since 2.0.0 Bugfix: various. * @since 2.0.0 Bugfix: various.
@ -124,7 +123,7 @@ class MCI_Footnotes_Task {
* @since 1.5.8 * @since 1.5.8
* @var string * @var string
*/ */
public static $a_str_Prefix = ""; public static $a_str_Prefix = '';
/** /**
* Infinite scroll / autoload or archive view * Infinite scroll / autoload or archive view
@ -430,20 +429,19 @@ class MCI_Footnotes_Task {
$l_int_WidgetTitlePriority = ( $l_int_WidgetTitlePriority == -1 ) ? PHP_INT_MAX : $l_int_WidgetTitlePriority; $l_int_WidgetTitlePriority = ( $l_int_WidgetTitlePriority == -1 ) ? PHP_INT_MAX : $l_int_WidgetTitlePriority;
$l_int_WidgetTextPriority = ( $l_int_WidgetTextPriority == -1 ) ? PHP_INT_MAX : $l_int_WidgetTextPriority; $l_int_WidgetTextPriority = ( $l_int_WidgetTextPriority == -1 ) ? PHP_INT_MAX : $l_int_WidgetTextPriority;
// append custom css to the header // append custom css to the header
add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX); add_filter( 'wp_head', array( $this, 'wp_head' ), PHP_INT_MAX );
// append the love and share me slug to the footer // append the love and share me slug to the footer
add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX); add_filter( 'wp_footer', array( $this, 'wp_footer' ), PHP_INT_MAX );
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE ) ) ) {
add_filter('the_title', array($this, "the_title"), $l_int_TheTitlePriority); add_filter( 'the_title', array( $this, 'the_title' ), $l_int_TheTitlePriority );
} }
// configurable priority level for reference container relative positioning; default 98: // configurable 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 ) ) ) { 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"), $l_int_TheContentPriority); add_filter( 'the_content', array( $this, 'the_content' ), $l_int_TheContentPriority );
/** /**
* Hook for category pages * Hook for category pages
@ -463,7 +461,7 @@ class MCI_Footnotes_Task {
* For this to happen, WordPress built-in partial HTML blocker needs to be disabled. * For this to happen, WordPress built-in partial HTML blocker needs to be disabled.
* @link https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/ * @link https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/
*/ */
add_filter('term_description', array($this, "the_content"), $l_int_TheContentPriority); add_filter( 'term_description', array( $this, 'the_content' ), $l_int_TheContentPriority );
/** /**
* Hook for popup maker popups * Hook for popup maker popups
@ -476,20 +474,19 @@ class MCI_Footnotes_Task {
* @reporter @squatcher * @reporter @squatcher
* @link https://wordpress.org/support/topic/footnotes-use-in-popup-maker/ * @link https://wordpress.org/support/topic/footnotes-use-in-popup-maker/
*/ */
add_filter('pum_popup_content', array($this, "the_content"), $l_int_TheContentPriority); add_filter( 'pum_popup_content', array( $this, 'the_content' ), $l_int_TheContentPriority );
} }
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT ) ) ) {
add_filter('the_excerpt', array($this, "the_excerpt"), $l_int_TheExcerptPriority); add_filter( 'the_excerpt', array( $this, 'the_excerpt' ), $l_int_TheExcerptPriority );
} }
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE ) ) ) {
add_filter('widget_title', array($this, "widget_title"), $l_int_WidgetTitlePriority); add_filter( 'widget_title', array( $this, 'widget_title' ), $l_int_WidgetTitlePriority );
} }
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT ) ) ) {
add_filter('widget_text', array($this, "widget_text"), $l_int_WidgetTextPriority); add_filter( 'widget_text', array( $this, 'widget_text' ), $l_int_WidgetTextPriority );
} }
/** /**
* The the_post hook * The the_post hook
* *
@ -567,7 +564,6 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @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: 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.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.3 raise settings priority to override theme stylesheets
@ -600,9 +596,9 @@ class MCI_Footnotes_Task {
$l_str_NormalizeSuperscript = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT ); $l_str_NormalizeSuperscript = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT );
if ( $l_str_NormalizeSuperscript !== 'no' ) { if ( $l_str_NormalizeSuperscript !== 'no' ) {
if ( $l_str_NormalizeSuperscript === 'all' ) { if ( $l_str_NormalizeSuperscript === 'all' ) {
echo "sup {"; echo 'sup {';
} else { } else {
echo ".footnote_plugin_tooltip_text {"; echo '.footnote_plugin_tooltip_text {';
} }
echo "vertical-align: super; font-size: smaller; position: static;}\r\n"; echo "vertical-align: super; font-size: smaller; position: static;}\r\n";
} }
@ -633,9 +629,9 @@ class MCI_Footnotes_Task {
*/ */
$l_int_ReferenceContainerTopMargin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN ) ); $l_int_ReferenceContainerTopMargin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN ) );
$l_int_ReferenceContainerBottomMargin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN ) ); $l_int_ReferenceContainerBottomMargin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN ) );
echo ".footnotes_reference_container {margin-top: "; echo '.footnotes_reference_container {margin-top: ';
echo empty( $l_int_ReferenceContainerTopMargin ) ? '0' : $l_int_ReferenceContainerTopMargin; echo empty( $l_int_ReferenceContainerTopMargin ) ? '0' : $l_int_ReferenceContainerTopMargin;
echo "px !important; margin-bottom: "; echo 'px !important; margin-bottom: ';
echo empty( $l_int_ReferenceContainerBottomMargin ) ? '0' : $l_int_ReferenceContainerBottomMargin; echo empty( $l_int_ReferenceContainerBottomMargin ) ? '0' : $l_int_ReferenceContainerBottomMargin;
echo "px !important;}\r\n"; echo "px !important;}\r\n";
@ -650,10 +646,9 @@ class MCI_Footnotes_Task {
* *
* @reporter @markhillyer * @reporter @markhillyer
* @link https://wordpress.org/support/topic/how-do-i-eliminate-the-horizontal-line-beneath-the-reference-container-heading/ * @link https://wordpress.org/support/topic/how-do-i-eliminate-the-horizontal-line-beneath-the-reference-container-heading/
*
*/ */
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) {
echo ".footnote_container_prepare > "; echo '.footnote_container_prepare > ';
echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT ); echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT );
echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n"; echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n";
} }
@ -670,11 +665,11 @@ class MCI_Footnotes_Task {
* @link https://wordpress.org/support/topic/borders-25/ * @link https://wordpress.org/support/topic/borders-25/
*/ */
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE ) ) ) {
echo ".footnotes_table, .footnotes_plugin_reference_row {"; echo '.footnotes_table, .footnotes_plugin_reference_row {';
echo "border: 1px solid #060606;"; echo 'border: 1px solid #060606;';
echo " !important;}\r\n"; echo " !important;}\r\n";
// adapt left padding to the presence of a border: // adapt left padding to the presence of a border:
echo ".footnote_plugin_index, .footnote_plugin_index_combi {"; echo '.footnote_plugin_index, .footnote_plugin_index_combi {';
echo "padding-left: 6px !important}\r\n"; echo "padding-left: 6px !important}\r\n";
} }
@ -683,8 +678,8 @@ class MCI_Footnotes_Task {
$l_bool_ColumnMaxWidthEnabled = MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED ) ); $l_bool_ColumnMaxWidthEnabled = MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED ) );
if ( $l_bool_ColumnWidthEnabled || $l_bool_ColumnMaxWidthEnabled ) { if ( $l_bool_ColumnWidthEnabled || $l_bool_ColumnMaxWidthEnabled ) {
echo ".footnote-reference-container { table-layout: fixed; }"; echo '.footnote-reference-container { table-layout: fixed; }';
echo ".footnote_plugin_index, .footnote_plugin_index_combi {"; echo '.footnote_plugin_index, .footnote_plugin_index_combi {';
if ( $l_bool_ColumnWidthEnabled ) { if ( $l_bool_ColumnWidthEnabled ) {
@ -735,7 +730,6 @@ class MCI_Footnotes_Task {
* @since 2.5.6 hard links are always enabled when the alternative reference container is. * @since 2.5.6 hard links are always enabled when the alternative reference container is.
*/ */
self::$a_bool_HardLinksEnable = MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_HARD_LINKS_ENABLE ) ); self::$a_bool_HardLinksEnable = MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_HARD_LINKS_ENABLE ) );
// correct hard links enabled status depending on alternative reference container enabled status: // correct hard links enabled status depending on alternative reference container enabled status:
$l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); $l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE );
if ( $l_str_ScriptMode != 'jquery' ) { if ( $l_str_ScriptMode != 'jquery' ) {
@ -744,7 +738,7 @@ class MCI_Footnotes_Task {
self::$a_int_ScrollOffset = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ) ); self::$a_int_ScrollOffset = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ) );
if ( self::$a_bool_HardLinksEnable ) { if ( self::$a_bool_HardLinksEnable ) {
echo ".footnote_referrer_anchor, .footnote_item_anchor {bottom: "; echo '.footnote_referrer_anchor, .footnote_item_anchor {bottom: ';
echo self::$a_int_ScrollOffset; echo self::$a_int_ScrollOffset;
echo "vh;}\r\n"; echo "vh;}\r\n";
} }
@ -779,42 +773,41 @@ class MCI_Footnotes_Task {
// text color: // text color:
$l_str_Color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ); $l_str_Color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR );
if ( ! empty( $l_str_Color ) ) { if ( ! empty( $l_str_Color ) ) {
printf(" color: %s !important;", $l_str_Color); printf( ' color: %s !important;', $l_str_Color );
} }
// background color: // background color:
$l_str_Background = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); $l_str_Background = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND );
if ( ! empty( $l_str_Background ) ) { if ( ! empty( $l_str_Background ) ) {
printf(" background-color: %s !important;", $l_str_Background); printf( ' background-color: %s !important;', $l_str_Background );
} }
// border width: // border width:
$l_int_BorderWidth = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); $l_int_BorderWidth = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH );
if ( ! empty( $l_int_BorderWidth ) && intval( $l_int_BorderWidth ) > 0 ) { if ( ! empty( $l_int_BorderWidth ) && intval( $l_int_BorderWidth ) > 0 ) {
printf(" border-width: %dpx !important; border-style: solid !important;", $l_int_BorderWidth); printf( ' border-width: %dpx !important; border-style: solid !important;', $l_int_BorderWidth );
} }
// border color: // border color:
$l_str_BorderColor = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ); $l_str_BorderColor = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR );
if ( ! empty( $l_str_BorderColor ) ) { if ( ! empty( $l_str_BorderColor ) ) {
printf(" border-color: %s !important;", $l_str_BorderColor); printf( ' border-color: %s !important;', $l_str_BorderColor );
} }
// corner radius: // corner radius:
$l_int_BorderRadius = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); $l_int_BorderRadius = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS );
if ( ! empty( $l_int_BorderRadius ) && intval( $l_int_BorderRadius ) > 0 ) { if ( ! empty( $l_int_BorderRadius ) && intval( $l_int_BorderRadius ) > 0 ) {
printf(" border-radius: %dpx !important;", $l_int_BorderRadius); printf( ' border-radius: %dpx !important;', $l_int_BorderRadius );
} }
// shadow color: // shadow color:
$l_str_BoxShadowColor = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ); $l_str_BoxShadowColor = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR );
if ( ! empty( $l_str_BoxShadowColor ) ) { if ( ! empty( $l_str_BoxShadowColor ) ) {
printf(" -webkit-box-shadow: 2px 2px 11px %s;", $l_str_BoxShadowColor); printf( ' -webkit-box-shadow: 2px 2px 11px %s;', $l_str_BoxShadowColor );
printf(" -moz-box-shadow: 2px 2px 11px %s;", $l_str_BoxShadowColor); printf( ' -moz-box-shadow: 2px 2px 11px %s;', $l_str_BoxShadowColor );
printf(" box-shadow: 2px 2px 11px %s;", $l_str_BoxShadowColor); printf( ' box-shadow: 2px 2px 11px %s;', $l_str_BoxShadowColor );
} }
/** /**
* Tooltip position and timing * Tooltip position and timing
* *
@ -835,7 +828,7 @@ class MCI_Footnotes_Task {
// tooltip position: // tooltip position:
$l_int_MaxWidth = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); $l_int_MaxWidth = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH );
if ( ! empty( $l_int_MaxWidth ) && intval( $l_int_MaxWidth ) > 0 ) { if ( ! empty( $l_int_MaxWidth ) && intval( $l_int_MaxWidth ) > 0 ) {
printf(" max-width: %dpx !important;", $l_int_MaxWidth); printf( ' max-width: %dpx !important;', $l_int_MaxWidth );
} }
echo "}\r\n"; echo "}\r\n";
@ -845,10 +838,10 @@ class MCI_Footnotes_Task {
// dimensions: // dimensions:
$l_int_AlternativeTooltipWidth = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ) ); $l_int_AlternativeTooltipWidth = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ) );
echo ".footnote_tooltip.position {"; echo '.footnote_tooltip.position {';
echo " width: " . $l_int_AlternativeTooltipWidth . 'px;'; echo ' width: ' . $l_int_AlternativeTooltipWidth . 'px;';
// set also as max-width wrt short tooltip shrinking: // set also as max-width wrt short tooltip shrinking:
echo " max-width: " . $l_int_AlternativeTooltipWidth . 'px;'; echo ' max-width: ' . $l_int_AlternativeTooltipWidth . 'px;';
// position: // position:
$l_str_AlternativePosition = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); $l_str_AlternativePosition = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION );
@ -946,34 +939,48 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* *
*
* @since 2.2.0 more options 2020-12-11T0506+0100 * @since 2.2.0 more options 2020-12-11T0506+0100
*/ */
public function wp_footer() { public function wp_footer() {
if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") { if ( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) == 'footer' ) {
echo $this->ReferenceContainer(); echo $this->ReferenceContainer();
} }
// get setting for love and share this plugin // get setting for love and share this plugin
$l_str_LoveMeIndex = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE ); $l_str_LoveMeIndex = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE );
// check if the admin allows to add a link to the footer // check if the admin allows to add a link to the footer
if (empty($l_str_LoveMeIndex) || strtolower($l_str_LoveMeIndex) == "no" || !self::$a_bool_AllowLoveMe) { if ( empty( $l_str_LoveMeIndex ) || strtolower( $l_str_LoveMeIndex ) == 'no' || ! self::$a_bool_AllowLoveMe ) {
return; return;
} }
// set a hyperlink to the word "footnotes" in the Love slug // set a hyperlink to the word "footnotes" in the Love slug
$l_str_LinkedName = sprintf( '<a href="https://wordpress.org/plugins/footnotes/" target="_blank" style="text-decoration:none;">%s</a>', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ); $l_str_LinkedName = sprintf( '<a href="https://wordpress.org/plugins/footnotes/" target="_blank" style="text-decoration:none;">%s</a>', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME );
// get random love me text // get random love me text
if (strtolower($l_str_LoveMeIndex) == "random") { if ( strtolower( $l_str_LoveMeIndex ) == 'random' ) {
$l_str_LoveMeIndex = "text-" . rand(1,7); $l_str_LoveMeIndex = 'text-' . rand( 1, 7 );
} }
switch ( $l_str_LoveMeIndex ) { switch ( $l_str_LoveMeIndex ) {
// options named wrt backcompat, simplest is default: // options named wrt backcompat, simplest is default:
case "text-1": $l_str_LoveMeText = sprintf(__('I %2$s %1$s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL); break; case 'text-1':
case "text-2": $l_str_LoveMeText = sprintf(__('This website uses the awesome %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break; $l_str_LoveMeText = sprintf( __( 'I %2$s %1$s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ), $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL );
case "text-4": $l_str_LoveMeText = sprintf('%s %s', $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL); break; break;
case "text-5": $l_str_LoveMeText = sprintf('%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName); break; case 'text-2':
case "text-6": $l_str_LoveMeText = sprintf(__('This website uses %s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break; $l_str_LoveMeText = sprintf( __( 'This website uses the awesome %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ), $l_str_LinkedName );
case "text-7": $l_str_LoveMeText = sprintf(__('This website uses the %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break; break;
case "text-3": default: $l_str_LoveMeText = sprintf('%s', $l_str_LinkedName); break; case 'text-4':
$l_str_LoveMeText = sprintf( '%s %s', $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL );
break;
case 'text-5':
$l_str_LoveMeText = sprintf( '%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName );
break;
case 'text-6':
$l_str_LoveMeText = sprintf( __( 'This website uses %s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ), $l_str_LinkedName );
break;
case 'text-7':
$l_str_LoveMeText = sprintf( __( 'This website uses the %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ), $l_str_LinkedName );
break;
case 'text-3':
default:
$l_str_LoveMeText = sprintf( '%s', $l_str_LinkedName );
break;
} }
echo sprintf( '<div style="text-align:center; color:#acacac;">%s</div>', $l_str_LoveMeText ); echo sprintf( '<div style="text-align:center; color:#acacac;">%s</div>', $l_str_LoveMeText );
} }
@ -1019,8 +1026,9 @@ class MCI_Footnotes_Task {
* the time its the blog engine processing the post for display and appending the refs. * the time its the blog engine processing the post for display and appending the refs.
*/ */
self::$a_arr_Footnotes = array(); self::$a_arr_Footnotes = array();
// appends the reference container if set to "post_end" // appends the reference container if set to "post_end"
return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); return $this->exec( $p_str_Content, MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) == 'post_end' ? true : false );
} }
/** /**
@ -1058,7 +1066,7 @@ class MCI_Footnotes_Task {
*/ */
public function widget_text( $p_str_Content ) { public function widget_text( $p_str_Content ) {
// appends the reference container if set to "post_end" // appends the reference container if set to "post_end"
return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); return $this->exec( $p_str_Content, MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) == 'post_end' ? true : false );
} }
/** /**
@ -1106,7 +1114,6 @@ class MCI_Footnotes_Task {
* @param bool $p_bool_HideFootnotesText Hide footnotes found in the string. * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string.
* @return string * @return string
* *
*
* @since 2.2.0 Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report. * @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. * @since 2.2.5 Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report.
*/ */
@ -1136,7 +1143,6 @@ class MCI_Footnotes_Task {
* *
* @reporter @hamshe * @reporter @hamshe
* @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13784126 * @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13784126
*
*/ */
// append the reference container or insert at shortcode: // 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 ); $l_str_ReferenceContainerPositionShortcode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE );
@ -1166,7 +1172,7 @@ class MCI_Footnotes_Task {
// take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found // take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found
if ( strpos( $p_str_Content, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG ) !== false ) { if ( strpos( $p_str_Content, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG ) !== false ) {
self::$a_bool_AllowLoveMe = false; self::$a_bool_AllowLoveMe = false;
$p_str_Content = str_replace(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, "", $p_str_Content); $p_str_Content = str_replace( MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, '', $p_str_Content );
} }
// return the content with replaced footnotes and optional reference container appended: // return the content with replaced footnotes and optional reference container appended:
return $p_str_Content; return $p_str_Content;
@ -1202,7 +1208,7 @@ class MCI_Footnotes_Task {
// get start and end tag for the footnotes short code // get start and end tag for the footnotes short code
$l_str_StartingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START );
$l_str_EndingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END );
if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") { if ( $l_str_StartingTag == 'userdefined' || $l_str_EndingTag == 'userdefined' ) {
$l_str_StartingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED );
$l_str_EndingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
} }
@ -1276,14 +1282,14 @@ class MCI_Footnotes_Task {
// compose warning box: // compose warning box:
$l_str_SyntaxErrorWarning = '<div class="footnotes_validation_error"><p>'; $l_str_SyntaxErrorWarning = '<div class="footnotes_validation_error"><p>';
$l_str_SyntaxErrorWarning .= __("WARNING: unbalanced footnote start tag short code found.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME); $l_str_SyntaxErrorWarning .= __( 'WARNING: unbalanced footnote start tag short code found.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME );
$l_str_SyntaxErrorWarning .= '</p><p>'; $l_str_SyntaxErrorWarning .= '</p><p>';
// syntax validation setting in the dashboard under the General settings tab: // syntax validation setting in the dashboard under the General settings tab:
$l_str_SyntaxErrorWarning .= sprintf( __("If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %s &gt; %s &gt; %s.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Check for balanced shortcodes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) ); $l_str_SyntaxErrorWarning .= sprintf( __( 'If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %1$s &gt; %2$s &gt; %3$s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ), __( 'General settings', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ), __( 'Footnote start and end short codes', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ), __( 'Check for balanced shortcodes', MCI_Footnotes_Config::C_STR_PLUGIN_NAME ) );
$l_str_SyntaxErrorWarning .= '</p><p>'; $l_str_SyntaxErrorWarning .= '</p><p>';
$l_str_SyntaxErrorWarning .= __("Unbalanced start tag short code found before:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME); $l_str_SyntaxErrorWarning .= __( 'Unbalanced start tag short code found before:', MCI_Footnotes_Config::C_STR_PLUGIN_NAME );
$l_str_SyntaxErrorWarning .= '</p><p>“'; $l_str_SyntaxErrorWarning .= '</p><p>“';
$l_str_SyntaxErrorWarning .= $l_str_ErrorSpotString; $l_str_SyntaxErrorWarning .= $l_str_ErrorSpotString;
$l_str_SyntaxErrorWarning .= '”</p></div>'; $l_str_SyntaxErrorWarning .= '”</p></div>';
@ -1298,15 +1304,14 @@ class MCI_Footnotes_Task {
} }
} }
// load referrer templates if footnotes text not hidden: // load referrer templates if footnotes text not hidden:
if ( ! $p_bool_HideFootnotesText ) { if ( ! $p_bool_HideFootnotesText ) {
// load footnote referrer template file: // load footnote referrer template file:
if ( self::$a_bool_AlternativeTooltipsEnabled ) { if ( self::$a_bool_AlternativeTooltipsEnabled ) {
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote-alternative"); $l_obj_Template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'footnote-alternative' );
} else { } else {
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote"); $l_obj_Template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'footnote' );
} }
/** /**
@ -1322,9 +1327,8 @@ class MCI_Footnotes_Task {
// load tooltip inline script if jQuery tooltips are enabled: // load tooltip inline script if jQuery tooltips are enabled:
if ( self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled ) { if ( self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled ) {
$l_obj_TemplateTooltip = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "tooltip"); $l_obj_TemplateTooltip = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'tooltip' );
} }
} else { } else {
$l_obj_Template = null; $l_obj_Template = null;
$l_obj_TemplateTooltip = null; $l_obj_TemplateTooltip = null;
@ -1334,7 +1338,9 @@ class MCI_Footnotes_Task {
do { do {
// get first occurrence of the footnote start tag short code: // get first occurrence of the footnote start tag short code:
$i_int_LenContent = strlen( $p_str_Content ); $i_int_LenContent = strlen( $p_str_Content );
if ($l_int_PosStart > $i_int_LenContent) $l_int_PosStart = $i_int_LenContent; if ( $l_int_PosStart > $i_int_LenContent ) {
$l_int_PosStart = $i_int_LenContent;
}
$l_int_PosStart = strpos( $p_str_Content, $l_str_StartingTag, $l_int_PosStart ); $l_int_PosStart = strpos( $p_str_Content, $l_str_StartingTag, $l_int_PosStart );
// no short code found, stop here // no short code found, stop here
if ( $l_int_PosStart === false ) { if ( $l_int_PosStart === false ) {
@ -1457,7 +1463,6 @@ class MCI_Footnotes_Task {
* @reporter @bernardzit * @reporter @bernardzit
* @link https://wordpress.org/support/topic/footnotes-dont-show-after-update-to-2-2-6/#post-13826029 * @link https://wordpress.org/support/topic/footnotes-dont-show-after-update-to-2-2-6/#post-13826029
* *
*
* @since 2.2.8 Bugfix: Reference container, tooltips: URL wrap: correctly make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. * @since 2.2.8 Bugfix: Reference container, tooltips: URL wrap: correctly make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report.
* @date 2020-12-23T1107+0100 * @date 2020-12-23T1107+0100
* *
@ -1508,7 +1513,7 @@ class MCI_Footnotes_Task {
} }
// Text to be displayed instead of the footnote // Text to be displayed instead of the footnote
$l_str_FootnoteReplaceText = ""; $l_str_FootnoteReplaceText = '';
// whether hard links are enabled: // whether hard links are enabled:
if ( self::$a_bool_HardLinksEnable ) { if ( self::$a_bool_HardLinksEnable ) {
@ -1601,6 +1606,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 * Referrers: new setting for vertical align: superscript (default) or baseline (optional), thanks to @cwbayer bug report
*
* @since 2.1.1 * @since 2.1.1
* *
* @reporter @cwbayer * @reporter @cwbayer
@ -1694,18 +1700,18 @@ class MCI_Footnotes_Task {
// fill in 'templates/public/footnote.html': // fill in 'templates/public/footnote.html':
$l_obj_Template->replace( $l_obj_Template->replace(
array( array(
"link-span" => self::$a_str_LinkSpan, 'link-span' => self::$a_str_LinkSpan,
"post_id" => self::$a_int_PostId, 'post_id' => self::$a_int_PostId,
"container_id" => self::$a_int_ReferenceContainerId, 'container_id' => self::$a_int_ReferenceContainerId,
"note_id" => $l_int_Index, 'note_id' => $l_int_Index,
"hard-link" => $l_str_FootnoteLinkArgument, 'hard-link' => $l_str_FootnoteLinkArgument,
"sup-span" => $l_str_SupSpan, 'sup-span' => $l_str_SupSpan,
"before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), 'before' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE ),
"index" => $l_int_Index, 'index' => $l_int_Index,
"after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER), 'after' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER ),
"anchor-element" => $l_str_ReferrerAnchorElement, 'anchor-element' => $l_str_ReferrerAnchorElement,
"style" => $l_str_TooltipStyle, 'style' => $l_str_TooltipStyle,
"text" => $l_str_TooltipContent, 'text' => $l_str_TooltipContent,
) )
); );
$l_str_FootnoteReplaceText = $l_obj_Template->getContent(); $l_str_FootnoteReplaceText = $l_obj_Template->getContent();
@ -1726,16 +1732,16 @@ class MCI_Footnotes_Task {
// fill in 'templates/public/tooltip.html': // fill in 'templates/public/tooltip.html':
$l_obj_TemplateTooltip->replace( $l_obj_TemplateTooltip->replace(
array( array(
"post_id" => self::$a_int_PostId, 'post_id' => self::$a_int_PostId,
"container_id" => self::$a_int_ReferenceContainerId, 'container_id' => self::$a_int_ReferenceContainerId,
"note_id" => $l_int_Index, 'note_id' => $l_int_Index,
"position" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION), 'position' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION ),
"offset-y" => !empty($l_int_OffsetY) ? $l_int_OffsetY : 0, 'offset-y' => ! empty( $l_int_OffsetY ) ? $l_int_OffsetY : 0,
"offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0, 'offset-x' => ! empty( $l_int_OffsetX ) ? $l_int_OffsetX : 0,
"fade-in-delay" => !empty($l_int_FadeInDelay ) ? $l_int_FadeInDelay : 0, 'fade-in-delay' => ! empty( $l_int_FadeInDelay ) ? $l_int_FadeInDelay : 0,
"fade-in-duration" => !empty($l_int_FadeInDuration ) ? $l_int_FadeInDuration : 0, 'fade-in-duration' => ! empty( $l_int_FadeInDuration ) ? $l_int_FadeInDuration : 0,
"fade-out-delay" => !empty($l_int_FadeOutDelay ) ? $l_int_FadeOutDelay : 0, 'fade-out-delay' => ! empty( $l_int_FadeOutDelay ) ? $l_int_FadeOutDelay : 0,
"fade-out-duration" => !empty($l_int_FadeOutDuration) ? $l_int_FadeOutDuration : 0, 'fade-out-duration' => ! empty( $l_int_FadeOutDuration ) ? $l_int_FadeOutDuration : 0,
) )
); );
$l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent();
@ -1812,10 +1818,9 @@ class MCI_Footnotes_Task {
// no footnotes have been replaced on this page: // no footnotes have been replaced on this page:
if ( empty( self::$a_arr_Footnotes ) ) { if ( empty( self::$a_arr_Footnotes ) ) {
return ""; return '';
} }
/** /**
* Footnote index backlink symbol * Footnote index backlink symbol
* *
@ -1854,7 +1859,6 @@ class MCI_Footnotes_Task {
} }
/** /**
* Backlink separator * Backlink separator
* *
@ -1882,12 +1886,17 @@ class MCI_Footnotes_Task {
// if it is not, check which option is on: // if it is not, check which option is on:
$l_str_SeparatorOption = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION ); $l_str_SeparatorOption = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION );
switch ( $l_str_SeparatorOption ) { switch ( $l_str_SeparatorOption ) {
case 'comma' : $l_str_Separator = ','; break; case 'comma':
case 'semicolon': $l_str_Separator = ';'; break; $l_str_Separator = ',';
case 'en_dash' : $l_str_Separator = '&nbsp;&#x2013;'; break; break;
case 'semicolon':
$l_str_Separator = ';';
break;
case 'en_dash':
$l_str_Separator = '&nbsp;&#x2013;';
break;
} }
} }
} else { } else {
$l_str_Separator = ''; $l_str_Separator = '';
@ -1897,6 +1906,7 @@ class MCI_Footnotes_Task {
* Backlink terminator * Backlink terminator
* *
* Initially a dot was appended in the table row template. * Initially a dot was appended in the table row template.
*
* @since 2.0.6 a dot after footnote numbers is discarded as not localizable; * @since 2.0.6 a dot after footnote numbers is discarded as not localizable;
* making it optional was envisaged. * making it optional was envisaged.
* @since 2.1.4 the terminator is optional, has options, and is configurable: * @since 2.1.4 the terminator is optional, has options, and is configurable:
@ -1911,18 +1921,22 @@ class MCI_Footnotes_Task {
// if it is not, check which option is on: // if it is not, check which option is on:
$l_str_TerminatorOption = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION ); $l_str_TerminatorOption = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION );
switch ( $l_str_TerminatorOption ) { switch ( $l_str_TerminatorOption ) {
case 'period' : $l_str_Terminator = '.'; break; case 'period':
case 'parenthesis': $l_str_Terminator = ')'; break; $l_str_Terminator = '.';
case 'colon' : $l_str_Terminator = ':'; break; break;
case 'parenthesis':
$l_str_Terminator = ')';
break;
case 'colon':
$l_str_Terminator = ':';
break;
} }
} }
} else { } else {
$l_str_Terminator = ''; $l_str_Terminator = '';
} }
/** /**
* Line breaks * Line breaks
* *
@ -1945,7 +1959,6 @@ class MCI_Footnotes_Task {
*/ */
$l_str_Body = "\r\n\r\n"; $l_str_Body = "\r\n\r\n";
/** /**
* Reference container table row template load * Reference container table row template load
* *
@ -1958,24 +1971,24 @@ class MCI_Footnotes_Task {
// when combining identical footnotes is turned on, another template is needed: // when combining identical footnotes is turned on, another template is needed:
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES ) ) ) {
// the combining template allows for backlink clusters and supports cell clicking for single notes: // the combining template allows for backlink clusters and supports cell clicking for single notes:
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-combi"); $l_obj_Template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-combi' );
} else { } else {
// when 3-column layout is turned on (only available if combining is turned off): // when 3-column layout is turned on (only available if combining is turned off):
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) {
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-3column"); $l_obj_Template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-3column' );
} else { } else {
// when switch symbol and index is turned on, and combining and 3-columns are off: // when switch symbol and index is turned on, and combining and 3-columns are off:
if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) {
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-switch"); $l_obj_Template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-switch' );
} else { } else {
// default is the standard template: // default is the standard template:
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body"); $l_obj_Template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body' );
} }
} }
@ -2077,7 +2090,6 @@ class MCI_Footnotes_Task {
$l_str_FootnoteAnchorElement = ''; $l_str_FootnoteAnchorElement = '';
} }
/** /**
* Support for combining identicals: compose enumerated backlinks * Support for combining identicals: compose enumerated backlinks
* *
@ -2127,7 +2139,6 @@ class MCI_Footnotes_Task {
$l_str_BacklinkEvent .= '_' . self::$a_int_ReferenceContainerId; $l_str_BacklinkEvent .= '_' . self::$a_int_ReferenceContainerId;
$l_str_BacklinkEvent .= "_$l_str_FootnoteId');\""; $l_str_BacklinkEvent .= "_$l_str_FootnoteId');\"";
// the dedicated template enumerating backlinks uses another variable: // the dedicated template enumerating backlinks uses another variable:
$l_str_FootnoteBacklinks = $l_str_FootnoteReference; $l_str_FootnoteBacklinks = $l_str_FootnoteReference;
@ -2167,7 +2178,7 @@ class MCI_Footnotes_Task {
if ( $l_str_FootnoteText == self::$a_arr_Footnotes[ $l_int_CheckIndex ] ) { if ( $l_str_FootnoteText == self::$a_arr_Footnotes[ $l_int_CheckIndex ] ) {
// if so, set the further footnote as empty so it won't be displayed later: // if so, set the further footnote as empty so it won't be displayed later:
self::$a_arr_Footnotes[$l_int_CheckIndex] = ""; self::$a_arr_Footnotes[ $l_int_CheckIndex ] = '';
// set the flag to true for the combined status: // set the flag to true for the combined status:
$l_bool_FlagCombined = true; $l_bool_FlagCombined = true;
@ -2250,27 +2261,27 @@ class MCI_Footnotes_Task {
array( array(
// placeholder used in all templates: // placeholder used in all templates:
"text" => $l_str_ReferenceText, 'text' => $l_str_ReferenceText,
// used in standard layout W/O COMBINED FOOTNOTES: // used in standard layout W/O COMBINED FOOTNOTES:
"post_id" => self::$a_int_PostId, 'post_id' => self::$a_int_PostId,
"container_id" => self::$a_int_ReferenceContainerId, 'container_id' => self::$a_int_ReferenceContainerId,
"note_id" => MCI_Footnotes_Convert::Index($l_int_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), 'note_id' => MCI_Footnotes_Convert::Index( $l_int_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ),
"link-start" => self::$a_str_LinkOpenTag, 'link-start' => self::$a_str_LinkOpenTag,
"link-end" => self::$a_str_LinkCloseTag, 'link-end' => self::$a_str_LinkCloseTag,
"link-span" => self::$a_str_LinkSpan, 'link-span' => self::$a_str_LinkSpan,
"terminator" => $l_str_Terminator, 'terminator' => $l_str_Terminator,
"anchor-element" => $l_str_FootnoteAnchorElement, 'anchor-element' => $l_str_FootnoteAnchorElement,
"hard-link" => $l_str_HardLinkAddress, 'hard-link' => $l_str_HardLinkAddress,
// used in standard layout WITH COMBINED IDENTICALS TURNED ON: // used in standard layout WITH COMBINED IDENTICALS TURNED ON:
"pointer" => $l_bool_FlagCombined ? '' : ' pointer', 'pointer' => $l_bool_FlagCombined ? '' : ' pointer',
"event" => $l_bool_FlagCombined ? '' : $l_str_BacklinkEvent, 'event' => $l_bool_FlagCombined ? '' : $l_str_BacklinkEvent,
"backlinks" => $l_bool_FlagCombined ? $l_str_FootnoteBacklinks : $l_str_FootnoteReference, 'backlinks' => $l_bool_FlagCombined ? $l_str_FootnoteBacklinks : $l_str_FootnoteReference,
// Legacy placeholders for use in legacy layout templates: // Legacy placeholders for use in legacy layout templates:
"arrow" => $l_str_FootnoteArrow, 'arrow' => $l_str_FootnoteArrow,
"index" => $l_str_FootnoteId, 'index' => $l_str_FootnoteId,
) )
); );
@ -2319,26 +2330,25 @@ class MCI_Footnotes_Task {
* @link https://wordpress.org/support/topic/footnotes-wp-rocket/#post-14076188 * @link https://wordpress.org/support/topic/footnotes-wp-rocket/#post-14076188
*/ */
$l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); $l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE );
if ( $l_str_ScriptMode == 'jquery' ) { if ( $l_str_ScriptMode == 'jquery' ) {
// load 'templates/public/reference-container.html': // load 'templates/public/reference-container.html':
$l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container"); $l_obj_TemplateContainer = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container' );
} else { } else {
// load 'templates/public/js-reference-container.html': // load 'templates/public/js-reference-container.html':
$l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "js-reference-container"); $l_obj_TemplateContainer = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'js-reference-container' );
} }
$l_obj_TemplateContainer->replace( $l_obj_TemplateContainer->replace(
array( array(
"post_id" => self::$a_int_PostId, 'post_id' => self::$a_int_PostId,
"container_id" => self::$a_int_ReferenceContainerId, 'container_id' => self::$a_int_ReferenceContainerId,
"element" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT), 'element' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT ),
"name" => empty($l_str_ReferenceContainerLabel) ? '&#x202F;' : $l_str_ReferenceContainerLabel, 'name' => empty( $l_str_ReferenceContainerLabel ) ? '&#x202F;' : $l_str_ReferenceContainerLabel,
"button-style" => !$l_bool_CollapseDefault ? 'display: none;' : '', 'button-style' => ! $l_bool_CollapseDefault ? 'display: none;' : '',
"style" => $l_bool_CollapseDefault ? 'display: none;' : '', 'style' => $l_bool_CollapseDefault ? 'display: none;' : '',
"content" => $l_str_Body, 'content' => $l_str_Body,
"scroll-offset" => (self::$a_int_ScrollOffset / 100), 'scroll-offset' => ( self::$a_int_ScrollOffset / 100 ),
"scroll-duration" => intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION)), 'scroll-duration' => intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION ) ),
) )
); );