mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
If HTML Tidy is available, use it to clean HTML content
This commit is contained in:
parent
40a89ac81e
commit
9e17bd1faa
@ -56,6 +56,16 @@ abstract class bo_merge
|
||||
*/
|
||||
public $export_limit;
|
||||
|
||||
|
||||
/**
|
||||
* Configuration for HTML Tidy to clean up any HTML content that is kept
|
||||
*/
|
||||
public static $tidy_config = array(
|
||||
'clean' => true,
|
||||
'output-xhtml' => true,
|
||||
'show-body-only' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -723,6 +733,10 @@ abstract class bo_merge
|
||||
// remove all html tags, evtl. included
|
||||
if (is_string($value) && (strpos($value,'<') !== false))
|
||||
{
|
||||
// Clean HTML, if it's being kept
|
||||
if($replace_tags && extension_loaded('tidy')) {
|
||||
$value = tidy_repair_string($value, self::$tidy_config);
|
||||
}
|
||||
// replace </p> and <br /> with CRLF (remove <p> and CRLF)
|
||||
$value = str_replace(array("\r","\n",'<p>','</p>','<br />'),array('','','',"\r\n","\r\n"),$value);
|
||||
$value = strip_tags($value,implode('',$replace_tags));
|
||||
|
Loading…
Reference in New Issue
Block a user