mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
- Don't let tidy wrap lines - line breaks don't go inside tags
- If tidy reports errors, strip all tags so we should get some sort of openable file
This commit is contained in:
parent
b633044a46
commit
ae1b9c8a64
@ -68,6 +68,7 @@ abstract class bo_merge
|
|||||||
'quote-ampersand' => false, // Prevent double encoding
|
'quote-ampersand' => false, // Prevent double encoding
|
||||||
'quote-nbsp' => true, // XSLT can handle spaces easier
|
'quote-nbsp' => true, // XSLT can handle spaces easier
|
||||||
'preserve-entities' => true,
|
'preserve-entities' => true,
|
||||||
|
'wrap' => 0, // Wrapping can break output
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -741,7 +742,18 @@ abstract class bo_merge
|
|||||||
{
|
{
|
||||||
// Clean HTML, if it's being kept
|
// Clean HTML, if it's being kept
|
||||||
if($replace_tags && extension_loaded('tidy')) {
|
if($replace_tags && extension_loaded('tidy')) {
|
||||||
$value = tidy_repair_string($value, self::$tidy_config);
|
$tidy = new tidy();
|
||||||
|
$cleaned = $tidy->repairString($value, self::$tidy_config);
|
||||||
|
// Found errors. Strip it all so there's some output
|
||||||
|
if($tidy->getStatus() == 2)
|
||||||
|
{
|
||||||
|
error_log($tidy->errorBuffer);
|
||||||
|
$value = strip_tags($value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$value = $cleaned;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// replace </p> and <br /> with CRLF (remove <p> and CRLF)
|
// 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 = str_replace(array("\r","\n",'<p>','</p>','<br />'),array('','','',"\r\n","\r\n"),$value);
|
||||||
|
Loading…
Reference in New Issue
Block a user