From c8f0c0e35000f74869870ad378b0c0c45ed9bf27 Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Sat, 19 Dec 2020 06:18:56 +0000 Subject: [PATCH] development update 2.3.0d0 needed in response to user request on forum git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2442742 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/dashboard/subpage-main.php | 2 +- class/settings.php | 2 +- class/task.php | 20 ++++++++++---------- class/template.php | 30 +++++++++++++++++++++++++----- footnotes.php | 4 ++-- readme.txt | 3 +++ templates/note-for-developers.txt | 23 +++++++++++++++++++++++ 7 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 templates/note-for-developers.txt diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index 0120ced..5b3eb88 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -557,7 +557,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { * * Edited: * @since 2.2.0 5 parts to address increased settings number - * @since 2.2.5 added position settings container for the alternative tooltips + * @since 2.2.5 added position settings for the alternative tooltips */ public function MouseOverBox() { // options for Yes/No select box: diff --git a/class/settings.php b/class/settings.php index 3089ae1..b4dac3f 100644 --- a/class/settings.php +++ b/class/settings.php @@ -26,7 +26,7 @@ * 2.2.2 Custom CSS settings container migration 2020-12-15T0709+0100 * 2.2.4 move backlink symbol selection under previous tab 2020-12-16T1256+0100 * 2.2.5 alternative tooltip position settings 2020-12-17T0907+0100 - * 2.2.5 options for reference container label element, thanks to @markhillyer 2020-12-18T1455+0100 + * 2.2.5 options for reference container label element and bottom border, thanks to @markhillyer 2020-12-18T1455+0100 * @see * * Last modified: 2020-12-18T1632+0100 diff --git a/class/task.php b/class/task.php index f47ae6d..cd8b35a 100644 --- a/class/task.php +++ b/class/task.php @@ -40,7 +40,7 @@ * 2.2.5 options for label element and label bottom border, thanks to @markhillyer 2020-12-18T1447+0100 * @see * - * Last modified: 2020-12-18T1627+0100 + * Last modified: 2020-12-18T1751+0100 */ // If called directly, abort: @@ -168,8 +168,8 @@ class MCI_Footnotes_Task { * 2.1.1 script for alternative tooltips * 2.1.3 raise settings priority to override theme style sheets * 2.1.4 tootip font size and backlink column width settings - * 2.2.5 options for label element and label bottom border, thanks to @markhillyer 2020-12-18T1447+0100 - * @see + * 2.2.5 options for label element and label bottom border, thanks to @markhillyer 2020-12-18T1447+0100 + * @see */ public function wp_head() { @@ -179,14 +179,14 @@ class MCI_Footnotes_Task { // display ref container on home page: if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE))) { echo ".home .footnotes_reference_container { display: none; }\r\n"; - } - - // ref container label bottom border: + } + + // ref 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 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"; - } + } // ref container first column width and max-width: $l_bool_ColumnWidthEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED)); @@ -528,7 +528,7 @@ class MCI_Footnotes_Task { * Edited: * @since 2.2.0 insert reference container at shortcode, thanks to @hamshe 2020-12-13T2057+0100 * @see - * + * * @since 2.2.5 delete unused position shortcode, when position is widget or footer, thanks to @hamshe 2020-12-18T1434+0100 * @see */ @@ -1106,7 +1106,7 @@ class MCI_Footnotes_Task { // streamline: $l_bool_CollapseDefault = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)); - + // 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( diff --git a/class/template.php b/class/template.php index cc47091..1692ced 100644 --- a/class/template.php +++ b/class/template.php @@ -5,8 +5,14 @@ * @filesource * @author Stefan Herndler * @since 1.5.0 14.09.14 10:58 + * + * Edited: + * @since 2.0.3 further minify template content + * @since 2.0.4 regex to delete multiple spaces * - * Last modified: 2020-11-01T0347+0100 + * @since 2.3.0 support for custom templates 2020-12-19T0606+0100 + * + * Last modified: 2020-12-19T0713+0100 */ @@ -63,18 +69,32 @@ class MCI_Footnotes_Template { * @param string $p_str_FileType Template file type (take a look on the Class constants). * @param string $p_str_FileName Template file name inside the Template directory without the file extension. * @param string $p_str_Extension Optional Template file extension (default: html) + * + * Edited: + * @since 2.0.3 further minify template content + * @since 2.0.4 regex to delete multiple spaces + * + * @since 2.3.0 support for custom templates 2020-12-19T0606+0100 */ public function __construct($p_str_FileType, $p_str_FileName, $p_str_Extension = "html") { // no template file type and/or file name set if (empty($p_str_FileType) || empty($p_str_FileName)) { return; } - // get absolute path to the specified template file - $l_str_TemplateFile = dirname(__FILE__) . "/../templates/" . $p_str_FileType . "/" . $p_str_FileName . "." . $p_str_Extension; - // Template file does not exist + + // First look for a custom template: + + $l_str_TemplateFile = dirname(__FILE__) . "/../../footnotes-custom/templates/" . $p_str_FileType . "/" . $p_str_FileName . "." . $p_str_Extension; if (!file_exists($l_str_TemplateFile)) { - return; + + // get absolute path to the specified template file + $l_str_TemplateFile = dirname(__FILE__) . "/../templates/" . $p_str_FileType . "/" . $p_str_FileName . "." . $p_str_Extension; + // Template file does not exist + if (!file_exists($l_str_TemplateFile)) { + return; + } } + // get Template file content $this->a_str_OriginalContent = str_replace("\n", "", file_get_contents($l_str_TemplateFile)); $this->a_str_OriginalContent = str_replace("\r", "", $this->a_str_OriginalContent); diff --git a/footnotes.php b/footnotes.php index 34dabc6..2c2b76d 100755 --- a/footnotes.php +++ b/footnotes.php @@ -4,12 +4,12 @@ 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.2.5 + Version: 2.3.0d0 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages */ -define( 'FOOTNOTES_VERSION', '2.2.5' ); +define( 'FOOTNOTES_VERSION', '2.3.0d0' ); /* Copyright 2020 Mark Cheret (email: mark@cheret.de) diff --git a/readme.txt b/readme.txt index efc26e5..d111220 100755 --- a/readme.txt +++ b/readme.txt @@ -80,6 +80,9 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == += 2.3.0d0 = +- Add: Customization: support for custom templates + = 2.2.5 = - Add: Dashboard: Footnotes numbering: add support for Ibid. notation in suggestions for guidance, thanks to @meglio - Add: Reference container: support options for label element and label bottom border, thanks to @markhillyer diff --git a/templates/note-for-developers.txt b/templates/note-for-developers.txt new file mode 100644 index 0000000..74b7b93 --- /dev/null +++ b/templates/note-for-developers.txt @@ -0,0 +1,23 @@ +note-for-developers.txt +2020-12-19T0609+0100 +Last modified: 2020-12-19T0706+0100 + +Footnotes plugin for WordPress, v2.3.0 and later + +Support for custom templates +‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +Since v2.3.0, Footnotes can process custom templates. + +To use custom templates, please make a sibling of the "footnotes" folder called "footnotes-custom" containing just the content of templates/public/ with the same structure. + +Existing homonymous templates on the path wp-content/plugins/footnotes-custom/templates/public/ are loaded instead of their counterparts in wp-content/plugins/footnotes/templates/public/. + +The new location does not need to contain all templates. +E.g. for custom tooltips, you need only one or both of these: + +footnotes-custom +└── templates + └── public + ├── footnote.html + └── tooltip.html