development 2.3.1d1 for forum
git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2448961 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
919e76bdef
commit
3096e8f3b4
6 changed files with 69 additions and 33 deletions
|
@ -38,7 +38,7 @@
|
|||
* @see <https://wordpress.org/support/topic/footnotes-is-not-amp-compatible/>
|
||||
* @since 2.3.1 footnote shortcode syntax validation 2021-01-01T0624+0100
|
||||
*
|
||||
* Last modified: 2021-01-01T0639+0100
|
||||
* Last modified: 2021-01-01T1241+0100
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -400,7 +400,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
// option to enable syntax validation:
|
||||
"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),
|
||||
"notice-syntax" => __("In the presence of an unclosed opening 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),
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
* @since 2.3.0 swap Custom CSS migration Boolean from 'migration complete' to 'show legacy' 2020-12-27T1243+0100
|
||||
* @since 2.3.1 syntax validation for balanced footnote start and end tags 2021-01-01T0227+0100
|
||||
*
|
||||
* Last modified: 2021-01-01T0642+0100
|
||||
* Last modified: 2021-01-01T1239+0100
|
||||
*/
|
||||
|
||||
// If called directly, abort:
|
||||
|
@ -212,8 +212,7 @@ class MCI_Footnotes_Task {
|
|||
* @since 2.3.1
|
||||
* @var bool
|
||||
*/
|
||||
public static $l_bool_SyntaxErrorFlag = false;
|
||||
public static $l_bool_SyntaxErrorShow = true;
|
||||
public static $l_bool_SyntaxErrorFlag = true;
|
||||
|
||||
|
||||
|
||||
|
@ -748,6 +747,8 @@ class MCI_Footnotes_Task {
|
|||
* @return string
|
||||
*
|
||||
* Edited since 2.0.0
|
||||
*
|
||||
* @since 2.3.1 footnote shortcode syntax validation
|
||||
*/
|
||||
public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) {
|
||||
|
||||
|
@ -786,21 +787,21 @@ class MCI_Footnotes_Task {
|
|||
$l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ').)*?)(' . $l_str_StartTagRegex . '|$)#s';
|
||||
preg_match( $l_str_ValidationRegex, $p_str_Content, $p_arr_ErrorLocation );
|
||||
if ( empty( $p_arr_ErrorLocation ) ) {
|
||||
self::$l_bool_SyntaxErrorShow = false;
|
||||
self::$l_bool_SyntaxErrorFlag = false;
|
||||
}
|
||||
|
||||
// prevent generating and inserting the warning multiple times:
|
||||
if ( self::$l_bool_SyntaxErrorShow ) {
|
||||
if ( self::$l_bool_SyntaxErrorFlag ) {
|
||||
$l_str_ErrorSpotString = strip_tags($p_arr_ErrorLocation[1]);
|
||||
|
||||
$l_str_SyntaxErrorWarning = '<div class="footnotes_validation_error"><p>';
|
||||
$l_str_SyntaxErrorWarning .= 'WARNING: unbalanced footnote start tag short code before:';
|
||||
$l_str_SyntaxErrorWarning .= __("WARNING: unbalanced footnote start tag short code before:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
|
||||
$l_str_SyntaxErrorWarning .= '</p><p>“';
|
||||
$l_str_SyntaxErrorWarning .= $l_str_ErrorSpotString;
|
||||
$l_str_SyntaxErrorWarning .= '”</p></div>';
|
||||
|
||||
$p_str_Content = $l_str_SyntaxErrorWarning . $p_str_Content;
|
||||
self::$l_bool_SyntaxErrorShow = false;
|
||||
self::$l_bool_SyntaxErrorFlag = false;
|
||||
|
||||
return $p_str_Content;
|
||||
}
|
||||
|
|
|
@ -9,11 +9,13 @@
|
|||
* 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 in fixed location, while failing to add filter thanks to @misfist 2020-12-19T0606+0100
|
||||
* @see <https://wordpress.org/support/topic/template-override-filter/#post-13811141>
|
||||
*
|
||||
* Last modified: 2020-12-20T0200+0100
|
||||
*
|
||||
* @since 2.2.6 support for custom templates in fixed location, while failing to add filter thanks to @misfist 2020-12-19T0606+0100
|
||||
* @see <https://wordpress.org/support/topic/template-override-filter/>
|
||||
* @since 2.3.1 templates may be in active theme, thanks to @misfist
|
||||
* @see <https://wordpress.org/support/topic/template-override-filter/#post-13846598>
|
||||
*
|
||||
* Last modified: 2021-01-01T2214+0100
|
||||
*/
|
||||
|
||||
|
||||
|
@ -74,11 +76,14 @@ class MCI_Footnotes_Template {
|
|||
* Edited:
|
||||
* @since 2.0.3 further minify template content
|
||||
* @since 2.0.4 regex to delete multiple spaces
|
||||
*
|
||||
* @since 2.2.6 support for custom templates 2020-12-19T0606+0100
|
||||
* @see <https://wordpress.org/support/topic/template-override-filter/>
|
||||
*
|
||||
* @since 2.2.6 regex to delete a space before a closing pointy bracket
|
||||
*
|
||||
* @since 2.3.0 support for custom templates 2020-12-19T0606+0100
|
||||
* @see <https://wordpress.org/support/topic/template-override-filter/#post-13811141>
|
||||
*
|
||||
* @since 2.3.0 regex to delete space before >
|
||||
* @since 2.3.1 look for custom template in the active theme
|
||||
* @see <https://wordpress.stackexchange.com/questions/220942/how-to-get-the-active-themes-slug>
|
||||
*/
|
||||
public function __construct($p_str_FileType, $p_str_FileName, $p_str_Extension = "html") {
|
||||
// no template file type and/or file name set
|
||||
|
@ -86,17 +91,28 @@ class MCI_Footnotes_Template {
|
|||
return;
|
||||
}
|
||||
|
||||
// First look for a custom template:
|
||||
|
||||
// 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;
|
||||
|
||||
// else load template from the active theme:
|
||||
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 <https://wordpress.stackexchange.com/questions/220942/how-to-get-the-active-themes-slug>
|
||||
$l_str_TemplateFile .= get_stylesheet();
|
||||
$l_str_TemplateFile .= "/templates/footnotes/" . $p_str_FileName . "." . $p_str_Extension;
|
||||
|
||||
// else load internal template:
|
||||
// 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 absolute path to the specified template file
|
||||
$l_str_TemplateFile = dirname(__FILE__) . "/../templates/" . $p_str_FileType . "/" . $p_str_FileName . "." . $p_str_Extension;
|
||||
|
||||
// do nothing if template file does not exist:
|
||||
if (!file_exists($l_str_TemplateFile)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue