1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-12 01:25:01 +02:00

New e107::isCompatible() method added for checking plugins/themes are compatible with the current version of e107.

New parser method stripBlockTags($html) to remove p, div etc.
{CPAGEBODY: strip=blocks} shortcode option added (uses the method above)
This commit is contained in:
Cameron
2021-01-23 14:20:51 -08:00
parent 85ae08e8ff
commit 17a9aa2822
6 changed files with 138 additions and 4 deletions

View File

@@ -296,7 +296,7 @@ class e_parse
'onwheel', 'oncopy', 'oncut', 'onpaste'
);
private $blockTags = array('pre', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'); // element includes its own line-break.
private $blockTags = array('p', 'pre', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'); // element includes its own line-break.
private $scriptAccess = false; // nobody.
@@ -1364,6 +1364,25 @@ class e_parse
return e107::getBB()->parseBBCodes($text, $postID);
}
/**
* Strips block tags from html.
* ie. <p> <div> <blockquote> <h1> <h2> <h3> etc are removed.
* @param string $text
* @return string
*/
public function stripBlockTags($html)
{
$diff = array_diff($this->allowedTags, $this->blockTags);
$parm = '';
foreach($diff as $tag)
{
$parm .= '<'.$tag.'>';
}
return strip_tags($html, $parm);
}
/**
* Converts the text (presumably retrieved from the database) for HTML output.