diff --git a/class/init.php b/class/init.php
index dfb5df0..aac8a03 100644
--- a/class/init.php
+++ b/class/init.php
@@ -151,7 +151,7 @@ class MCI_Footnotes {
'mci-footnotes-css-public',
plugins_url('../css/public.css', __FILE__),
'',
- '2.1.1d6'
+ '2.1.1d7'
);
}
diff --git a/class/task.php b/class/task.php
index 55cd4b9..2c97628 100644
--- a/class/task.php
+++ b/class/task.php
@@ -8,13 +8,14 @@
*
* Edited for v2.0.0 and following.
*
- * Edited for v2.0.5: Autoload / infinite scroll support added thanks to code from
+ * 2.0.5: Autoload / infinite scroll support added thanks to code from
* @docteurfitness
*
- * Edited for v2.0.9: DISABLED the_post HOOK 2020-11-08T1839+0100
- * Edited for v2.1.0: Promoted the 'Continue reading' button from localization to customization 2020-11-08T2146+0100
+ * 2.0.9: DISABLED the_post HOOK 2020-11-08T1839+0100
+ * 2.1.0: promoted the 'Continue reading' button from localization to customization 2020-11-08T2146+0100
+ * 2.1.1: combining identical footnotes: fixed dead links 2020-11-14T2233+0100
*
- * Last modified 2020-11-08T2146+0100
+ * Last modified 2020-11-14T2233+0100
*/
// If called directly, abort:
@@ -339,17 +340,17 @@ class MCI_Footnotes_Task {
* @return string
*/
public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) {
-
+
// post ID to make everything unique wrt infinite scroll and archive view
- global $l_int_PostID;
- $l_int_PostID = get_the_id();
-
+ global $l_int_PostId;
+ $l_int_PostId = get_the_id();
+
// contains the index for the next footnote on this page
- $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1;
-
+ $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1;
+
// contains the starting position for the lookup of a footnote
- $l_int_PosStart = 0;
-
+ $l_int_PosStart = 0;
+
// 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_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END);
@@ -397,39 +398,39 @@ class MCI_Footnotes_Task {
break;
}
// calculate the length of the footnote
- $l_int_Length = $l_int_PosEnd - $l_int_PosStart;
-
+ $l_int_Length = $l_int_PosEnd - $l_int_PosStart;
+
// get footnote text
- $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag));
-
+ $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag));
+
// Text to be displayed instead of the footnote
- $l_str_FootnoteReplaceText = "";
-
+ $l_str_FootnoteReplaceText = "";
+
// display the footnote as mouse-over box
if (!$p_bool_HideFootnotesText) {
- $l_str_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
+ $l_int_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
// display only an excerpt of the footnotes text if enabled
$l_str_ExcerptText = $l_str_FootnoteText;
$l_bool_EnableExcerpt = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED));
- $l_int_MaxLength = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH));
-
+ $l_int_MaxLength = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH));
+
if ($l_bool_EnableExcerpt) {
$l_str_DummyText = strip_tags($l_str_FootnoteText);
if (is_int($l_int_MaxLength) && strlen($l_str_DummyText) > $l_int_MaxLength) {
$l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength);
$l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' '));
- $l_str_ExcerptText .= ' … ' . '';
+ $l_str_ExcerptText .= ' … ' . '';
}
}
- // fill the footnotes template templates/public/footnote.html
+ // fill in 'templates/public/footnote.html':
$l_obj_Template->replace(
array(
- "post_id" => $l_int_PostID,
- "id" => $l_str_Index,
+ "post_id" => $l_int_PostId,
+ "id" => $l_int_Index,
"before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
- "index" => $l_str_Index,
+ "index" => $l_int_Index,
"after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER),
"text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "",
)
@@ -442,11 +443,11 @@ class MCI_Footnotes_Task {
$l_int_OffsetY = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y));
$l_int_OffsetX = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X));
- // fill in the tooltip template templates/public/tooltip.html
+ // fill in 'templates/public/tooltip.html':
$l_obj_TemplateTooltip->replace(
array(
- "post_id" => $l_int_PostID,
- "id" => $l_str_Index,
+ "post_id" => $l_int_PostId,
+ "id" => $l_int_Index,
"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-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0,
@@ -459,8 +460,8 @@ class MCI_Footnotes_Task {
}
}
// replace the footnote with the template
- $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag));
-
+ $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag));
+
// add footnote only if not empty
if (!empty($l_str_FootnoteText)) {
// set footnote to the output box at the end
@@ -483,16 +484,24 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler
* @since 1.5.0
* @return string
+ *
+ * Edited for 2.0.6: fixed line breaking behavior in footnote # clusters
+ * Edited for 2.1.1: fixed fragment IDs and backlinks with combine identical turned on 2020-11-14T1808+0100
*/
public function ReferenceContainer() {
- // post ID to make everything unique wrt infinite scroll and archive view
- global $l_int_PostID;
- $l_int_PostID = get_the_id();
-
+
+ // post ID to make everything unique wrt infinite scroll and archive view:
+ global $l_int_PostId;
+ $l_int_PostId = get_the_id();
+
// no footnotes has been replaced on this page
if (empty(self::$a_arr_Footnotes)) {
return "";
}
+
+
+ // FOOTNOTE INDEX BACKLINK SYMBOL
+
// get html arrow
$l_str_Arrow = MCI_Footnotes_Convert::getArrow(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW));
// set html arrow to the first one if invalid index defined
@@ -505,79 +514,162 @@ class MCI_Footnotes_Task {
$l_str_Arrow = $l_str_ArrowUserDefined;
}
- // load template file
- $l_str_Body = "";
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body");
+
+ // REFERENCE CONTAINER TABLE ROW TEMPLATE LOAD
+
+ // line breaks for source readability:
+ $l_str_Body = "\r\n\r\n";
+ // When combine identical 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))) {
+ // In the combined template, identifiers only are clickable.
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-combi");
+ } else {
+ // In the standard template the whole cell is clickable.
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body");
+ }
+
+ // FILL IN THE TEMPLATE
// loop through all footnotes found in the page
- for ($l_str_Index = 0; $l_str_Index < count(self::$a_arr_Footnotes); $l_str_Index++) {
-
+ for ($l_int_Index = 0; $l_int_Index < count(self::$a_arr_Footnotes); $l_int_Index++) {
+
+ // TEXT COLUMN
+
// get footnote text
- $l_str_FootnoteText = self::$a_arr_Footnotes[$l_str_Index];
+ $l_str_FootnoteText = self::$a_arr_Footnotes[$l_int_Index];
// if footnote is empty, get to the next one
+ // With combine identical turned on, identicals will be deleted and are skipped:
if (empty($l_str_FootnoteText)) {
continue;
}
+
+ // INDEX COLUMN WITH ONE BACKLINK PER TABLE ROW
+
+ // Standard behavior appropriate for combine identical TURNED OFF
+
// generate content of footnote index cell
- $l_str_FirstFootnoteIndex = ($l_str_Index + 1);
-
+ $l_int_FirstFootnoteIndex = ($l_int_Index + 1);
+
// wrap each index # in a white-space:nowrap span
$l_str_FootnoteArrowIndex = ' ';
- // replace all placeholders in the template templates/public/reference-container-body.html
- // The individual arrow and index placeholders are for backcompat
+ // replace all placeholders in 'templates/public/reference-container-body.html'
+ // or in 'templates/public/reference-container-body-combi.html'
+ // The individual arrow and index placeholders are for backcompat.
$l_obj_Template->replace(
array(
- "post_id" => $l_int_PostID,
- "id" => MCI_Footnotes_Convert::Index($l_str_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)),
- "arrow-index" => $l_str_FootnoteArrowIndex,
+ // placeholder used in all templates:
"text" => $l_str_FootnoteText,
- // Legacy placeholders:
+
+ // used in standard layout W/O COMBINED FOOTNOTES:
+ "post_id" => $l_int_PostId,
+ "id" => MCI_Footnotes_Convert::Index($l_int_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)),
+ "arrow-index" => $l_str_FootnoteArrowIndex,
+
+ // used in standard layout WITH COMBINED IDENTICALS TURNED ON:
+ "backlinks" => $l_str_FootnoteBacklinks,
+
+ // Legacy placeholders for use in legacy layout templates:
"arrow" => $l_str_Arrow,
"index" => $l_str_FootnoteIndex,
)
);
+
// extra line breaks for page source legibility:
- $footnote_item_temp = $l_obj_Template->getContent();
- $footnote_item_temp .= "\r\n\r\n";
- $l_str_Body .= $footnote_item_temp;
+ $l_str_Body .= $l_obj_Template->getContent();
+ $l_str_Body .= "\r\n\r\n";
+
$l_obj_Template->reload();
+
}
- // load template file 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->replace(
array(
- "post_id" => $l_int_PostID,
+ "post_id" => $l_int_PostId,
"label" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME),
"button-style" => !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '',
"style" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '',
diff --git a/css/public.css b/css/public.css
index 2a09e90..869b135 100755
--- a/css/public.css
+++ b/css/public.css
@@ -4,9 +4,9 @@
* Created-Date: 15.05.14
* Created-Time: 16:21
* Since: 1.0
- * Version: 2.1.1d6
+ * Version: 2.1.1d7
*
- * Last modified: 2020-11-13T1746+0100
+ * Last modified: 2020-11-14T2229+0100
*/
@@ -192,37 +192,42 @@ footnotes
reference-container-body.html
*/
.footnote_plugin_index,
+.footnote_plugin_index_combi,
.footnote_plugin_text {
border:none !important;
text-align: left !important;
vertical-align: top !important;
padding: 10px 6px 5px 0 !important;
}
+.footnote_backlink,
+.footnote_backlink:link,
.footnote_plugin_link,
.footnote_plugin_link:link,
+.main-content .footnote_backlink,
+.main-content .footnote_backlink:link,
.main-content .footnote_plugin_link,
.main-content .footnote_plugin_link:link {
text-decoration: none !important;
border-bottom: none !important;
}
+.footnote_backlink:hover,
.footnote_plugin_index:hover,
.footnote_plugin_text a:hover {
text-decoration: underline !important;
}
.footnote_plugin_index {
- cursor: pointer;
- overflow-wrap: unset;
- word-wrap: unset;
- word-wrap: normal !important;
- word-break: unset;
- word-break: keep-all !important;
max-width: 140px;
width: 2em; /*auto-extending column to fit widest*/
- overflow: hidden;
}
+.footnote_backlink,
.footnote_index_item {
white-space: nowrap;
}
+
+.footnote_backlink {
+ cursor: pointer;
+}
+
.footnote_plugin_text {
width: unset; /*unset width of text column to fix site issues*/
}
diff --git a/css/settings.css b/css/settings.css
index 468e434..efb0bc9 100755
--- a/css/settings.css
+++ b/css/settings.css
@@ -4,9 +4,9 @@
* Created-Date: 15.05.14
* Created-Time: 16:21
* Since: 1.0
- * Version: 2.1.1d6
+ * Version: 2.1.1d7
*
- * Last modified: 2020-11-13T1748+0100
+ * Last modified: 2020-11-14T2228+0100
*/
diff --git a/footnotes.php b/footnotes.php
index f20ce90..5a34f7b 100755
--- a/footnotes.php
+++ b/footnotes.php
@@ -4,7 +4,7 @@
Plugin URI: https://wordpress.org/plugins/footnotes/
Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
Author: Mark Cheret
- Version: 2.1.1d6
+ Version: 2.1.1d7
Author URI: http://cheret.de/plugins/footnotes-2/
Text Domain: footnotes
Domain Path: /languages
diff --git a/readme.txt b/readme.txt
index 6b47328..e7e721e 100755
--- a/readme.txt
+++ b/readme.txt
@@ -80,8 +80,12 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog ==
+= 2.1.1d7 =
+- Bugfix: Combining identical footnotes: fixed dead links
+
= 2.1.1d6 =
-- Bugfix: UI: Tooltips: fixed line breaking for URLs by allowing to break long URLs anywhere
+- Bugfix: UI: Tooltips: fixed line breaking for hyperlinked URLs in Unicode-non-compliant user agents
+- Update: Libraries: completed minification of jQuery Tools
= 2.1.1d5 =
- Add: UI: Tooltips: Alternative implementation: added CSS animation
@@ -98,7 +102,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
= 2.1.1d1 =
- Bugfix: Libraries: jQuery UI: load in header not in footer in case it matters for fixing tooltips
-- Bugfix: Layout: Ref container: Footnote numbers: disabled bottom border for theme compatibility
+- Bugfix: Layout: Ref container: Footnote number links: disabled bottom border for theme compatibility
= 2.1.1d0
- Bugfix: Libraries: jQuery UI: switched to third party to look whether it can fix a broken tooltip display 2020-11-07T1604+0100/2020-11-08T2242+0100
@@ -122,7 +126,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
= 2.0.6 =
- Update: Autoload / infinite scroll support thanks to @docteurfitness
- Bugfix: Layout: Footnote referrers: deleted vertical align tweaks, for cross-theme and user agent compatibility
-- Bugfix: Layout: Reference container: fixed line break behavior in footnote # clusters
+- Bugfix: Layout: Reference container: fixed line breaking behavior in footnote # clusters
- Bugfix: Layout: Reference container: auto-extending column to fit widest, to fix display with short note texts
- Bugfix: Layout: Reference container: IDs: slightly increased left padding
- Bugfix: Translations: fixed spelling error and erroneously changed word in en_GB and en_US
diff --git a/templates/public/reference-container-body-combi.html b/templates/public/reference-container-body-combi.html
new file mode 100644
index 0000000..ebb49b4
--- /dev/null
+++ b/templates/public/reference-container-body-combi.html
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/templates/public/reference-container-body.html b/templates/public/reference-container-body.html
index eedad5c..359c6cd 100755
--- a/templates/public/reference-container-body.html
+++ b/templates/public/reference-container-body.html
@@ -1,11 +1,12 @@