update trunk/ in vue of urgent bugfix plus feature release 2.5.0

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2452163 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2021-01-07 21:21:29 +00:00
parent 53def2ec48
commit 354b5439f0
27 changed files with 222 additions and 115 deletions

View file

@ -6,7 +6,7 @@
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 14.09.14 14:47 * @since 1.5.0 14.09.14 14:47
* *
* Last modified: 2021-01-02T2335+0100 * Last modified: 2021-01-07T2207+0100
* *
* Edited: * Edited:
* @since 2.0.4 restore arrow settings 2020-11-01T0509+0100 * @since 2.0.4 restore arrow settings 2020-11-01T0509+0100
@ -39,6 +39,8 @@
* @see <https://wordpress.org/support/topic/making-it-amp-compatible/> * @see <https://wordpress.org/support/topic/making-it-amp-compatible/>
* @see <https://wordpress.org/support/topic/footnotes-is-not-amp-compatible/> * @see <https://wordpress.org/support/topic/footnotes-is-not-amp-compatible/>
* @since 2.4.0 footnote shortcode syntax validation 2021-01-01T0624+0100 * @since 2.4.0 footnote shortcode syntax validation 2021-01-01T0624+0100
* @since 2.5.0 Shortcode syntax validation: add more information around the setting, thanks to @andreasra
* @see <https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/>
*/ */
/** /**
@ -98,12 +100,17 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
*/ */
protected function getSections() { protected function getSections() {
$l_arr_Tabs = array(); $l_arr_Tabs = array();
// sync tab name with mirror in task.php:
$l_arr_Tabs[] = $this->addSection("settings", __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true); $l_arr_Tabs[] = $this->addSection("settings", __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true);
// tab name used in public function CustomCSSMigration()
// sync tab name with mirror in public function CustomCSSMigration():
$l_arr_Tabs[] = $this->addSection("customize", __("Referrers and tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true); $l_arr_Tabs[] = $this->addSection("customize", __("Referrers and tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true);
$l_arr_Tabs[] = $this->addSection("expert", __("Scope and priority", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true); $l_arr_Tabs[] = $this->addSection("expert", __("Scope and priority", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true);
$l_arr_Tabs[] = $this->addSection("customcss", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 3, true); $l_arr_Tabs[] = $this->addSection("customcss", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 3, true);
$l_arr_Tabs[] = $this->addSection("how-to", __("Quick start guide", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false); $l_arr_Tabs[] = $this->addSection("how-to", __("Quick start guide", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false);
return $l_arr_Tabs; return $l_arr_Tabs;
} }
@ -132,6 +139,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
protected function getMetaBoxes() { protected function getMetaBoxes() {
$l_arr_MetaBoxes = array(); $l_arr_MetaBoxes = array();
// sync box name with mirror in task.php:
$l_arr_MetaBoxes[] = $this->addMetaBox("settings", "start-end", __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "StartEnd"); $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "start-end", __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "StartEnd");
$l_arr_MetaBoxes[] = $this->addMetaBox("settings", "numbering", __("Footnotes numbering", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Numbering"); $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "numbering", __("Footnotes numbering", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Numbering");
$l_arr_MetaBoxes[] = $this->addMetaBox("settings", "scrolling", __("Scrolling behavior", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Scrolling"); $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "scrolling", __("Scrolling behavior", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Scrolling");
@ -342,6 +350,8 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @see <https://wordpress.org/support/topic/add-support-for-ibid-notation/> * @see <https://wordpress.org/support/topic/add-support-for-ibid-notation/>
* @since 2.4.0 added warning about Block Editor escapement disruption 2021-01-02T2324+0100 * @since 2.4.0 added warning about Block Editor escapement disruption 2021-01-02T2324+0100
* @since 2.4.0 removed the HTML comment tag option 2021-01-02T2325+0100 * @since 2.4.0 removed the HTML comment tag option 2021-01-02T2325+0100
* @since 2.5.0 Shortcode syntax validation: add more information around the setting, thanks to @andreasra
* @see <https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/>
*/ */
public function StartEnd() { public function StartEnd() {
// footnotes start tag short code options: // footnotes start tag short code options:
@ -384,7 +394,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
$l_obj_Template->replace( $l_obj_Template->replace(
array( array(
"description" => __("WARNING: Short codes with closing pointy brackets are disabled in the new WordPress Block Editor that disrupts the traditional balanced escapement applied by WordPress Classic Editor.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "description-escapement" => __("WARNING: Short codes with closing pointy brackets are disabled in the new WordPress Block Editor that disrupts the traditional balanced escapement applied by WordPress Classic Editor.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote start tag short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote start tag short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart), "short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart),
@ -400,10 +410,14 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, "short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED,
"short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, "short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
// option to enable syntax validation: "description-parentheses" => __("WARNING: Although widespread industry standard, the double parentheses are problematic because they may occur in scripts embedded in the content and be mistaken as a short code.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
// option to enable syntax validation, label mirrored in task.php:
"label-syntax" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __("Check for balanced shortcodes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "label-syntax" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __("Check for balanced shortcodes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"syntax" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_Enable), "syntax" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_Enable),
"notice-syntax" => __("In the presence of a lone start tag shortcode, a warning displays below the post title.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "notice-syntax" => __("In the presence of a lone start tag shortcode, a warning displays below the post title.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"description-syntax" => __("If the start tag short code is (( or (((, it will not be reported as unbalanced if the following string contains braces hinting that it is a script.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
) )
); );
// display template with replaced placeholders // display template with replaced placeholders
@ -550,6 +564,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* Edited heading 2020-12-12T1453+0100 * Edited heading 2020-12-12T1453+0100
* @since 2.1.1 more settings and notices, thanks to @nikelaos * @since 2.1.1 more settings and notices, thanks to @nikelaos
* @see <https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13687068> * @see <https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13687068>
* @see <https://wordpress.org/support/topic/jquery-comes-up-in-feed-content/#post-13110879>
* @since 2.2.0 dedicated to the excerpt setting and its notices 2020-12-12T1454+0100 * @since 2.2.0 dedicated to the excerpt setting and its notices 2020-12-12T1454+0100
*/ */
public function Excerpts() { public function Excerpts() {

View file

@ -6,7 +6,7 @@
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 14.09.14 10:43 * @since 1.5.0 14.09.14 10:43
* *
* Last modified: 2021-01-02T2340+0100 * Last modified: 2021-01-07T2206+0100
* *
* Edited: * Edited:
* @since 2.0.4 restore arrow settings 2020-11-02T2115+0100 * @since 2.0.4 restore arrow settings 2020-11-02T2115+0100

View file

@ -8,7 +8,7 @@
* *
* Edited for v2.0.0 and following. * Edited for v2.0.0 and following.
* *
* Last modified: 2021-01-04T1623+0100 * Last modified: 2021-01-07T2219+0100
* *
* @since 2.0.5 Autoload / infinite scroll support added thanks to code from @docteurfitness * @since 2.0.5 Autoload / infinite scroll support added thanks to code from @docteurfitness
* @see <https://wordpress.org/support/topic/auto-load-post-compatibility-update/> * @see <https://wordpress.org/support/topic/auto-load-post-compatibility-update/>
@ -72,6 +72,12 @@
* @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 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 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.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)
* @see <https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/>
*/ */
// If called directly, abort: // If called directly, abort:
@ -251,6 +257,9 @@ class MCI_Footnotes_Task {
* @since 2.1.1 add setting for the_content * @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.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 * 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 * makes the footnotes reference container display beneath the post and above other
* features added by other plugins, e.g. related post lists and social buttons. * features added by other plugins, e.g. related post lists and social buttons.
@ -293,6 +302,7 @@ class MCI_Footnotes_Task {
// custom priority level for reference container relative positioning; default 98: // 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))) { 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); add_filter('the_content', array($this, "the_content"), $p_int_TheContentPriority);
add_filter('term_description', array($this, "the_content"), $p_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))) {
@ -305,6 +315,11 @@ class MCI_Footnotes_Task {
add_filter('widget_text', array($this, "widget_text"), $p_int_WidgetTextPriority); 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 // REMOVED the_post HOOK 2020-11-08T1839+0100
// //
@ -772,6 +787,10 @@ class MCI_Footnotes_Task {
* Edited since 2.0.0 * Edited since 2.0.0
* *
* @since 2.4.0 footnote shortcode syntax validation * @since 2.4.0 footnote shortcode syntax validation
* @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/>
*/ */
public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) { public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) {
@ -805,9 +824,24 @@ class MCI_Footnotes_Task {
// if footnotes short codes are unbalanced, and syntax validation is not disabled, // if footnotes short codes are unbalanced, and syntax validation is not disabled,
// return content with prepended warning: // return content with prepended warning:
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE))) { if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE))) {
// convert the shortcodes to regex syntax conformant:
$l_str_StartTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_StartingTag ); $l_str_StartTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_StartingTag );
$l_str_EndTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_EndingTag ); $l_str_EndTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_EndingTag );
// apply different regex depending on whether start shortcode is double/triple opening parenthesis:
if ( $l_str_StartingTag == '((' || $l_str_StartingTag == '(((' ) {
// this prevents from catching a script containing e.g. a double opening parenthesis:
$l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ')[^\{\}])*?)(' . $l_str_StartTagRegex . '|$)#s';
} else {
// catch all only if the start shortcode is not double/triple opening parenthesis, i.e. is unlikely to occur in scripts:
$l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ').)*?)(' . $l_str_StartTagRegex . '|$)#s'; $l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ').)*?)(' . $l_str_StartTagRegex . '|$)#s';
}
// check syntax and get error locations:
preg_match( $l_str_ValidationRegex, $p_str_Content, $p_arr_ErrorLocation ); preg_match( $l_str_ValidationRegex, $p_str_Content, $p_arr_ErrorLocation );
if ( empty( $p_arr_ErrorLocation ) ) { if ( empty( $p_arr_ErrorLocation ) ) {
self::$l_bool_SyntaxErrorFlag = false; self::$l_bool_SyntaxErrorFlag = false;
@ -815,15 +849,33 @@ class MCI_Footnotes_Task {
// prevent generating and inserting the warning multiple times: // prevent generating and inserting the warning multiple times:
if ( self::$l_bool_SyntaxErrorFlag ) { if ( self::$l_bool_SyntaxErrorFlag ) {
// get plain text string for error location:
$l_str_ErrorSpotString = strip_tags( $p_arr_ErrorLocation[1] ); $l_str_ErrorSpotString = strip_tags( $p_arr_ErrorLocation[1] );
// limit string length to 300 characters:
if ( strlen( $l_str_ErrorSpotString ) > 300 ) {
$l_str_ErrorSpotString = substr( $l_str_ErrorSpotString, 0, 299 ) . '…';
}
// 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 before:", 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>';
// 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 .= '</p><p>';
$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>';
// prepend the warning box to the content:
$p_str_Content = $l_str_SyntaxErrorWarning . $p_str_Content; $p_str_Content = $l_str_SyntaxErrorWarning . $p_str_Content;
// checked, set flag to false to prevent duplicate warning:
self::$l_bool_SyntaxErrorFlag = false; self::$l_bool_SyntaxErrorFlag = false;
return $p_str_Content; return $p_str_Content;

View file

@ -6,7 +6,7 @@
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 14.09.14 10:58 * @since 1.5.0 14.09.14 10:58
* *
* Last modified: 2021-01-02T2352+0100 * Last modified: 2021-01-07T2209+0100
* *
* Edited: * Edited:
* @since 2.0.3 prettify reference container template * @since 2.0.3 prettify reference container template
@ -18,6 +18,8 @@
* @see <https://wordpress.org/support/topic/template-override-filter/> * @see <https://wordpress.org/support/topic/template-override-filter/>
* @since 2.4.0 templates may be in active theme, thanks to @misfist * @since 2.4.0 templates may be in active theme, thanks to @misfist
* @see <https://wordpress.org/support/topic/template-override-filter/#post-13846598> * @see <https://wordpress.org/support/topic/template-override-filter/#post-13846598>
* @since 2.5.0 Enable template location stack, contributed by @misfist
* @see <https://wordpress.org/support/topic/template-override-filter/#post-13864301>
*/ */
@ -231,7 +233,7 @@ class MCI_Footnotes_Template {
$located = trailingslashit( get_template_directory() ) . $template_directory . $template_name; $located = trailingslashit( get_template_directory() ) . $template_directory . $template_name;
/** /**
* Look custom directory * Look in custom directory
*/ */
} elseif ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name ) ) { } elseif ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name ) ) {
$located = trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name; $located = trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name;

View file

@ -5,9 +5,9 @@
* Created-Time: 16:21 * Created-Time: 16:21
* Since: 1.0 * Since: 1.0
* *
* Version: 2.4.0 * Version: 2.5.0
* *
* Last modified: 2021-01-02T1203+0100 * Last modified: 2021-01-07T0851+0100
* *
* *
* Classes added to public.css may be added to the * Classes added to public.css may be added to the
@ -62,17 +62,19 @@ issue with missing content or footnotes, while it may
be hard to detect in long posts and under deadline. be hard to detect in long posts and under deadline.
A validation check displays a warning box below the A validation check displays a warning box below the
post title, populated with the first instance of a post title, populated with 300 characters of contente
content snippet preceded by an unbalanced start tag preceded by the first unbalanced start tag short code.
short code.
@since 2.4.0 @since 2.4.0
@since 2.5.0 improvement increased paragraph number
*/ */
.footnotes_validation_error { .footnotes_validation_error {
border: 4px solid red; border: 4px solid red;
padding: 20px; padding: 20px 40px;
margin: 20px 0;
background: #ff000055; background: #ff000055;
text-align: start;
} }
.footnotes_validation_error p:first-child { .footnotes_validation_error p:first-child {
@ -81,9 +83,18 @@ short code.
text-align: center; text-align: center;
} }
.footnotes_validation_error p:nth-child(2) {
font-size: 16px;
font-style: italic;
}
.footnotes_validation_error p:nth-child(3) {
font-size: 14px;
font-weight: bold;
}
.footnotes_validation_error p:last-child { .footnotes_validation_error p:last-child {
font-size: 12px; font-size: 12px;
text-align: start;
} }
/***************************************************** /*****************************************************

View file

@ -5,9 +5,9 @@
* Created-Time: 16:21 * Created-Time: 16:21
* Since: 1.0 * Since: 1.0
* *
* Version: 2.4.0 * Version: 2.5.0
* *
* Last modified: 2021-01-02T1204+0100 * Last modified: 2021-01-07T1816+0100
*/ */
@ -166,51 +166,54 @@ Hooks and priority levels:
initialized from style attributes in templates initialized from style attributes in templates
IE doesnt support nth child, but these are not critical IE doesnt support nth child, but these are not critical
*/ */
#expert_lookup tr th:first-child, .expert_lookup tr th:first-child,
#expert_lookup tr td:first-child { .expert_lookup tr td:first-child {
width: 170px !important; width: 170px !important;
} }
#expert_lookup tr th:nth-child(2), .expert_lookup tr th:nth-child(2),
#expert_lookup tr td:nth-child(2) { .expert_lookup tr td:nth-child(2) {
width: 65px !important; width: 65px !important;
} }
#expert_lookup tr th:nth-child(3), .expert_lookup tr th:nth-child(3),
#expert_lookup tr td:nth-child(3) { .expert_lookup tr td:nth-child(3) {
width: 200px !important; width: 200px !important;
} }
#expert_lookup tr td:nth-child(3) input { .expert_lookup tr td:nth-child(3) input {
width: 190px; width: 190px;
} }
#expert_lookup tr th:last-child, .expert_lookup tr th:last-child,
#expert_lookup tr td:last-child { .expert_lookup tr td:last-child {
white-space: nowrap; white-space: nowrap;
} }
/* /*
Custom CSS Custom CSS
The number of CSS classes recommended for customization
significantly increased from 4 to 18 as of v2.4.0.
Localized notices are dropped to ease translators task. Localized notices are dropped to ease translators task.
16 CSS classes are listed directly in the template CSS classes are listed directly in the template
templates/dashboard/customize-css.html templates/dashboard/customize-css.html
</p> end tags are omitted per HTML5 standard, to improve For better maintainability and readability of the source
maintainability and readability of the source list. list, the </p> end tags are omitted per HTML5 standard:
<https://stackoverflow.com/questions/8460993/p-end-tag-p-is-not-needed-in-html> <https://stackoverflow.com/questions/8460993/p-end-tag-p-is-not-needed-in-html>
The textarea has monospace font, but no other features The textarea has monospace font, but no other features
helping edit CSS, as tab support and syntactic colors. helping edit CSS, like tab support and syntactic colors.
*/ */
#customize_css_new tr td:first-child { .customize_css_new tr td:first-child {
width: 44% !important; width: 44% !important;
font-weight: normal !important; font-weight: normal !important;
} }
#customize_css_new tr td:first-child span:first-child { .customize_css_new tr td:first-child span:first-child {
font-weight: bold !important; font-weight: bold !important;
} }
#customize_css_new .list { .customize_css_new .list {
padding-top: 10px; padding-top: 10px;
} }
#customize_css_new .list p { .customize_css_new .list p {
font-family: monospace; font-family: monospace;
padding: 0 10px; padding: 0 10px;
text-indent: -10px; text-indent: -10px;

View file

@ -4,12 +4,12 @@
Plugin URI: https://wordpress.org/plugins/footnotes/ 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. 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 Author: Mark Cheret
Version: 2.5.0d0 Version: 2.5.0
Author URI: http://cheret.de/plugins/footnotes-2/ Author URI: http://cheret.de/plugins/footnotes-2/
Text Domain: footnotes Text Domain: footnotes
Domain Path: /languages Domain Path: /languages
*/ */
define( 'FOOTNOTES_VERSION', '2.5.0d0' ); define( 'FOOTNOTES_VERSION', '2.5.0' );
/* /*
Copyright 2020 Mark Cheret (email: mark@cheret.de) Copyright 2020 Mark Cheret (email: mark@cheret.de)

View file

@ -80,17 +80,24 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog == == Changelog ==
= 2.4.0 = = 2.5.0 =
- Bugfix: initialize hard link address as empty to fix undefined variable bug, thanks to @a223123131
- Bugfix: Shortcodes: Dashboard: warning about '&gt;' escapement disruption in WordPress Block Editor
- Bugfix: Shortcodes: Dashboard: remove new option involving HTML comment tags only usable in source mode
- Add: Customization: Enable template location stack, contributed by @misfist - Add: Customization: Enable template location stack, contributed by @misfist
- Bugfix: optimize template load and process according to settings, thanks to @misfist - Bugfix: Hooks: support the term_description hook, thanks to @vitaefit (feature) and @misfist (hook name)
- Bugfix: Shortcode syntax validation: exclude certain cases involving scripts, thanks to @andreasra
- Bugfix: Shortcode syntax validation: complete message with hint about setting, thanks to @andreasra
- Bugfix: Shortcode syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra
- Update: Shortcode syntax validation: add more information around the setting, thanks to @andreasra
- Bugfix: Shortcodes: Dashboard: warning about '&gt;' escapement disruption in WordPress Block Editor
= 2.4.0 =
- Add: Shortcodes: syntax validation for balanced footnote start and end tag short codes - Add: Shortcodes: syntax validation for balanced footnote start and end tag short codes
- Bugfix: initialize hard link address variable to empty to fix 'undefined variable' bug, thanks to @a223123131
- Bugfix: Shortcodes: Dashboard: remove new option involving HTML comment tags only usable in source mode
- Bugfix: optimize template load and process according to settings, thanks to @misfist
- Bugfix: Reference container: Row borders: adapt left padding to the presence of an optional left border - Bugfix: Reference container: Row borders: adapt left padding to the presence of an optional left border
- Bugfix: Reference container: Label: set empty label to U+202F NNBSP for more robustness, thanks to @lukashuggenberg - Bugfix: Reference container: Label: set empty label to U+202F NNBSP for more robustness, thanks to @lukashuggenberg
- Bugfix: Scroll offset: initialize to safer one third window height for more robustness, thanks to @lukashuggenberg - Bugfix: Scroll offset: initialize to safer one third window height for more robustness, thanks to @lukashuggenberg
- Bugfix: Reference container: add class 'footnote_plugin_symbol' to disambiguate repurposed class footnote_plugin_link - Bugfix: Reference container: add class 'footnote_plugin_symbol' to disambiguate repurposed class 'footnote_plugin_link'
= 2.3.0 = = 2.3.0 =
- Add: optional hard links in referrers and backlinks for AMP compatibility, thanks to @psykonevro and @martinneumannat - Add: optional hard links in referrers and backlinks for AMP compatibility, thanks to @psykonevro and @martinneumannat
@ -125,14 +132,15 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
- Add: Customization: support for custom templates in sibling folder (should be filterable function, thanks to @misfist) - Add: Customization: support for custom templates in sibling folder (should be filterable function, thanks to @misfist)
= 2.2.5 = = 2.2.5 =
- Add: Dashboard: Footnotes numbering: add support for Ibid. notation in suggestions for guidance, thanks to @meglio - Bugfix: Dashboard: Footnotes numbering: add missing support for Ibid. notation to suggestions, thanks to @meglio
- Add: Reference container: support options for label element and label bottom border, thanks to @markhillyer - Bugfix: Reference container: Label: not enforce bottom border but make it an option, thanks to @markhillyer
- Bugfix: Reference container: Label: allow to switch from paragraph element to heading, thanks to @markhillyer
- Bugfix: Referernce container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe - Bugfix: Referernce container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe
- Bugfix: Dashboard: Tooltip position/timing settings: include alternative tooltips (for themes not supporting jQuery tooltips) - Bugfix: Dashboard: Tooltip position/timing settings: include alternative tooltips (for themes not supporting jQuery tooltips)
- Bugfix: Dashboard: Tooltip position/timing settings: raise above tooltip truncation settings for better consistency - Bugfix: Dashboard: Tooltip position/timing settings: raise above tooltip truncation settings for better consistency
= 2.2.4 = = 2.2.4 =
- Bugfix: Reference container: Backlink symbol selection: moved back to previous tab “Referrers and tooltips” - Bugfix: Reference container: Backlink symbol selection: move back to previous tab “Referrers and tooltips”
- Bugfix: Custom CSS: make inserting existing in header depend on migration complete checkbox status - Bugfix: Custom CSS: make inserting existing in header depend on migration complete checkbox status
= 2.2.3 = = 2.2.3 =
@ -140,7 +148,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
= 2.2.2 = = 2.2.2 =
- Bugfix: Dashboard: Link element setting only under General settings > Reference container - Bugfix: Dashboard: Link element setting only under General settings > Reference container
- Add: Dashboard: migrate Custom CSS to dedicated new tab, keep legacy until checking a box - Bugfix: Dashboard: Custom CSS: unearth text area and migrate to dedicated tab as designed
- Bugfix: Reference container: edits to optional basic responsive page layout style sheets - Bugfix: Reference container: edits to optional basic responsive page layout style sheets
= 2.2.1 = = 2.2.1 =
@ -148,16 +156,16 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
= 2.2.0 = = 2.2.0 =
- Add: Reference container: support for custom position shortcode, thanks to @hamshe - Add: Reference container: support for custom position shortcode, thanks to @hamshe
- Update: Priority levels: update the notice in the dashboard Priority tab
- Bugfix: Tooltips: add 'important' property to z-index to fix display overlay issue
- Add: Start/end short codes: more predefined options - Add: Start/end short codes: more predefined options
- Add: Numbering styles: lowercase Roman numerals support - Add: Numbering styles: lowercase Roman numerals support
- Update: Dashboard: Tooltip settings: grouped into 3 thematic containers - Update: Priority levels: update the notice in the dashboard Priority tab
- Update: Dashboard: Main settings: grouped into 3 specific containers - Update: Dashboard: Tooltip settings: group into 3 thematic containers
- Update: Dashboard: moved link element option to the Referrers options - Update: Dashboard: Main settings: group into 3 specific containers
- Update: Dashboard: moved URL wrap option to the Reference container options - Update: Dashboard: move link element option to the Referrers options
- Update: Dashboard: grouped both Custom CSS and priority level settings under the same tab - Update: Dashboard: move URL wrap option to the Reference container options
- Update: Dashboard: renamed tab labels 'Referrers and tooltips', 'Priority and CSS' - Update: Dashboard: group both Custom CSS and priority level settings under the same tab
- Update: Dashboard: rename tab labels 'Referrers and tooltips', 'Priority and CSS'
- Bugfix: Tooltips: add 'important' property to z-index to fix display overlay issue
- Bugfix: Localization: correct arguments for plugin textdomain load function - Bugfix: Localization: correct arguments for plugin textdomain load function
- Bugfix: Reference container, tooltips: URL wrap: specifically catch the quotation mark - Bugfix: Reference container, tooltips: URL wrap: specifically catch the quotation mark
- Add: Footnotes mention in the footer: more options - Add: Footnotes mention in the footer: more options
@ -176,13 +184,14 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
- Bugfix: Reference container, tooltips: URL wrap: exclude image source too, thanks to @bjrnet21 - Bugfix: Reference container, tooltips: URL wrap: exclude image source too, thanks to @bjrnet21
= 2.1.4 = = 2.1.4 =
- Add: Dashboard: Main settings: add settings for scroll offset and duration - Bugfix: Scroll offset: make configurable to fix site-dependent issues related to fixed headers
- Add: Dashboard: Tooltip settings: add settings for display delays and fade durations - Bugfix: Scroll duration: make configurable to conform to website content and style requirements
- Add: Styling: Tooltips: fix font size issue by adding font size to settings with legacy as default - Bugfix: Tooltips: make display delays and fade durations configurable to conform to website style
- Add: Reference container: fix theme-dependent layout issues by optionally enqueuing additional style sheet - Bugfix: Styling: Tooltips: fix font size issue by adding font size to settings with legacy as default
- Add: Reference container: fix layout issues by moving backlink column width to settings - Bugfix: Reference container: fix layout by optionally enqueuing additional style sheet (depends on theme)
- Add: Reference container: separating and terminating punctuation optional and customizable - Bugfix: Reference container: fix layout issues by moving backlink column width to settings
- Add: Reference container: Backlinks: optional line breaks to stack enumerations - Bugfix: Reference container: make separating and terminating punctuation optional and configurable
- Bugfix: Reference container: Backlinks: fix stacked enumerations by adding optional line breaks
- Bugfix: Layout: Tooltips: prevent line break in Read-on link label - Bugfix: Layout: Tooltips: prevent line break in Read-on link label
- Bugfix: Styling: Referrers and backlinks: make link elements optional to fix issues - Bugfix: Styling: Referrers and backlinks: make link elements optional to fix issues
- Bugfix: Styling: Referrers: disable hover underline - Bugfix: Styling: Referrers: disable hover underline
@ -265,6 +274,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
- Update: UX: Tooltip: set display predelay to 0 for responsiveness (was 800 since 2.0.0, 400 before) - Update: UX: Tooltip: set display predelay to 0 for responsiveness (was 800 since 2.0.0, 400 before)
- Update: UX: Tooltip: set fade duration to 200ms both ways (was 200 in and 2000 out since 2.0.0, 0 in and 100 out before) - Update: UX: Tooltip: set fade duration to 200ms both ways (was 200 in and 2000 out since 2.0.0, 0 in and 100 out before)
- BUGFIX: Priority level back to PHP_INT_MAX (ref container positioning not this plugins responsibility) - BUGFIX: Priority level back to PHP_INT_MAX (ref container positioning not this plugins responsibility)
- Update: Scroll offset: raise percentage from 12% to a safer 20% inner window height, by lack of configurability
= 2.0.5 = = 2.0.5 =
- Bugfix: Get references container close to content, not below all other features, by priority level 10 - Bugfix: Get references container close to content, not below all other features, by priority level 10
@ -291,6 +301,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
- Bugfix: Print style: prevent a page break just after the reference container label - Bugfix: Print style: prevent a page break just after the reference container label
- Bugfix: Print style: Hide reference collapse button - Bugfix: Print style: Hide reference collapse button
- Update: Layout: Removed padding before reference container label - Update: Layout: Removed padding before reference container label
- Update: Scroll offset: raise percentage from 5% to a safer 12% inner window height, by lack of configurability
= 2.0.2 = = 2.0.2 =
- Bugfix: Restored expand/collapse button of reference container - Bugfix: Restored expand/collapse button of reference container

View file

@ -1,7 +1,7 @@
<div class="footnotes_description"> <div class="footnotes_description">
<p>[[description-css]]</p> <p>[[description-css]]</p>
</div> </div>
<table id="customize_css_migration" class="widefat fixed"> <table class="customize_css_migration widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-css]]</td> <td>[[label-css]]</td>

View file

@ -1,4 +1,4 @@
<table id="customize_css_new" class="widefat fixed"> <table class="customize_css_new widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td><span>[[headline]]</span><br /> <td><span>[[headline]]</span><br />

View file

@ -1,7 +1,7 @@
<div class="footnotes_description"> <div class="footnotes_description">
<p>[[description-css]]</p> <p>[[description-css]]</p>
</div> </div>
<table id="customize_css" class="widefat fixed"> <table class="customize_css widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-css]]</td> <td>[[label-css]]</td>

View file

@ -1,7 +1,7 @@
<div class="footnotes_description"> <div class="footnotes_description">
<p>[[description-symbol]]</p> <p>[[description-symbol]]</p>
</div> </div>
<table id="customize_hyperlink_arrow" class="widefat fixed"> <table class="customize_hyperlink_arrow widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-symbol]]</td> <td>[[label-symbol]]</td>

View file

@ -1,4 +1,4 @@
<table id="customize_superscript" class="widefat fixed"> <table class="customize_superscript widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-superscript]]</td> <td>[[label-superscript]]</td>

View file

@ -1,4 +1,4 @@
<table id="diagnostics" class="widefat fixed"> <table class="diagnostics widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-server]]</td> <td>[[label-server]]</td>

View file

@ -3,7 +3,7 @@
<p>[[description-2]]</p> <p>[[description-2]]</p>
<p>[[description-3]]</p> <p>[[description-3]]</p>
</div> </div>
<table id="expert_lookup" class="widefat fixed"> <table class="expert_lookup widefat fixed">
<thead> <thead>
<tr> <tr>
<th>[[head-hook]]</th> <th>[[head-hook]]</th>

View file

@ -1,4 +1,4 @@
<table id="mouse_over_box_appearance" class="widefat fixed"> <table class="mouse_over_box_appearance widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-font-size]]</td> <td>[[label-font-size]]</td>

View file

@ -1,4 +1,4 @@
<table id="mouse_over_box_display" class="widefat fixed"> <table class="mouse_over_box_display widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-enable]]</td> <td>[[label-enable]]</td>

View file

@ -1,4 +1,4 @@
<table id="mouse_over_box_position" class="widefat fixed"> <table class="mouse_over_box_position widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-position]]</td> <td>[[label-position]]</td>

View file

@ -1,4 +1,4 @@
<table id="mouse_over_box_timing" class="widefat fixed"> <table class="mouse_over_box_timing widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-fade-in-delay]]</td> <td>[[label-fade-in-delay]]</td>

View file

@ -1,4 +1,4 @@
<table id="mouse_over_box_truncation" class="widefat fixed"> <table class="mouse_over_box_truncation widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-truncation]]</td> <td>[[label-truncation]]</td>

View file

@ -1,4 +1,4 @@
<table id="settings_excerpts" class="widefat fixed"> <table class="settings_excerpts widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-excerpts]]</td> <td>[[label-excerpts]]</td>

View file

@ -1,4 +1,4 @@
<table id="settings_love" class="widefat fixed"> <table class="settings_love widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-love]]</td> <td>[[label-love]]</td>

View file

@ -1,4 +1,4 @@
<table id="settings_numbering" class="widefat fixed"> <table class="settings_numbering widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-counter-style]]</td> <td>[[label-counter-style]]</td>

View file

@ -1,4 +1,4 @@
<table id="settings_reference_container" class="widefat fixed"> <table class="settings_reference_container widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-name]]</td> <td>[[label-name]]</td>

View file

@ -1,4 +1,4 @@
<table id="settings_scrolling" class="widefat fixed"> <table class="settings_scrolling widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-scroll-offset]]</td> <td>[[label-scroll-offset]]</td>

View file

@ -1,4 +1,7 @@
<table id="settings_start_end" class="widefat fixed"> <div class="footnotes_description">
<p>[[description-escapement]]</p>
</div>
<table class="settings_start_end widefat fixed">
<tbody> <tbody>
<tr> <tr>
<td>[[label-short-code-start]]</td> <td>[[label-short-code-start]]</td>
@ -14,12 +17,22 @@
<span>[[short-code-end-user]]</span> <span>[[short-code-end-user]]</span>
</td> </td>
</tr> </tr>
</tbody>
</table>
<div class="footnotes_description">
<p>[[description-parentheses]]</p>
</div>
<table class="settings_start_end widefat fixed">
<tbody>
<tr> <tr>
<td>[[label-syntax]]</td> <td>[[label-syntax]]</td>
<td>[[syntax]] <span class="footnotes_notice">[[notice-syntax]]</span></td> <td>[[syntax]] <span class="footnotes_notice">[[notice-syntax]]</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="footnotes_description">
<p>[[description-syntax]]</p>
</div>
<script type="text/javascript"> <script type="text/javascript">
var l_obj_ShortCodeStart = jQuery("#[[short-code-start-id]]"); var l_obj_ShortCodeStart = jQuery("#[[short-code-start-id]]");
var l_obj_ShortCodeEnd = jQuery("#[[short-code-end-id]]"); var l_obj_ShortCodeEnd = jQuery("#[[short-code-end-id]]");

View file

@ -1,6 +1,6 @@
note-for-developers.txt note-for-developers.txt
2020-12-19T0609+0100 2020-12-19T0609+0100
Last modified: 2021-01-01T2249+0100 Last modified: 2021-01-04T1734+0100
Footnotes plugin for WordPress, v2.2.6 and later Footnotes plugin for WordPress, v2.2.6 and later
@ -10,7 +10,7 @@ Support for custom templates
Since v2.2.6, Footnotes supports custom templates. Since v2.2.6, Footnotes supports custom templates.
Custom templates may be loaded from a sibling folder 'footnotes-custom' Custom templates may be loaded from a sibling folder 'footnotes-custom'
or since v2.3.1 from a folder 'templates/footnotes/' in the active theme. or since v2.4.0 from a folder 'templates/footnotes/' in the active theme.
Priority order: Priority order:
1. active theme 1. active theme