From 0879535bb4075e743a792496f0271402e933cd18 Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Fri, 1 Jan 2021 21:59:05 +0000 Subject: [PATCH] development 2.3.1d2 (correct) for forum git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2448967 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/template.php | 22 +++++++++++----------- footnotes.php | 4 ++-- templates/note-for-developers.txt | 7 ++++++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/class/template.php b/class/template.php index ce5786b..edc15b5 100644 --- a/class/template.php +++ b/class/template.php @@ -15,7 +15,7 @@ * @since 2.3.1 templates may be in active theme, thanks to @misfist * @see * - * Last modified: 2021-01-01T2214+0100 + * Last modified: 2021-01-01T2246+0100 */ @@ -82,8 +82,8 @@ class MCI_Footnotes_Template { * * @since 2.2.6 regex to delete a space before a closing pointy bracket * - * @since 2.3.1 look for custom template in the active theme - * @see + * @since 2.3.1 look for custom template in the active theme first, thanks to @misfist + * @see */ public function __construct($p_str_FileType, $p_str_FileName, $p_str_Extension = "html") { // no template file type and/or file name set @@ -91,17 +91,17 @@ class MCI_Footnotes_Template { return; } - // First look for a custom template in a 'footnotes-custom' sibling folder: - $l_str_TemplateFile = dirname(__FILE__) . "/../../footnotes-custom/templates/" . $p_str_FileType . "/" . $p_str_FileName . "." . $p_str_Extension; + // First try to load the template from the active theme in 'templates/footnotes/': + $l_str_TemplateFile = dirname(__FILE__) . "/../../../themes/"; + // get active theme dir name (parent theme unlikely to contain custom templates): + // see + $l_str_TemplateFile .= get_stylesheet(); + $l_str_TemplateFile .= "/templates/footnotes/" . $p_str_FileName . "." . $p_str_Extension; - // else load template from the active theme: + // else look for a custom template in a 'footnotes-custom' sibling folder: if (!file_exists($l_str_TemplateFile)) { - $l_str_TemplateFile = dirname(__FILE__) . "/../../../themes/"; - // get active theme dir name (parent theme unlikely to contain custom templates): - // see - $l_str_TemplateFile .= get_stylesheet(); - $l_str_TemplateFile .= "/templates/footnotes/" . $p_str_FileName . "." . $p_str_Extension; + $l_str_TemplateFile = dirname(__FILE__) . "/../../footnotes-custom/templates/" . $p_str_FileType . "/" . $p_str_FileName . "." . $p_str_Extension; // else load internal template: if (!file_exists($l_str_TemplateFile)) { diff --git a/footnotes.php b/footnotes.php index 9629b71..1c53bee 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.3.1d1 + Version: 2.3.1d2 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages */ -define( 'FOOTNOTES_VERSION', '2.3.1d1' ); +define( 'FOOTNOTES_VERSION', '2.3.1d2' ); /* Copyright 2020 Mark Cheret (email: mark@cheret.de) diff --git a/templates/note-for-developers.txt b/templates/note-for-developers.txt index dc54ea6..db0dd37 100644 --- a/templates/note-for-developers.txt +++ b/templates/note-for-developers.txt @@ -1,6 +1,6 @@ note-for-developers.txt 2020-12-19T0609+0100 -Last modified: 2021-01-01T2212+0100 +Last modified: 2021-01-01T2249+0100 Footnotes plugin for WordPress, v2.2.6 and later @@ -12,6 +12,11 @@ Since v2.2.6, Footnotes supports custom templates. 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. +Priority order: + 1. active theme + 2. sibling folder + 3. internal + See footnotes/class/template.php:67..116