mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
htmlpurify MDL-22654 Implemented solution to fix issues rising from HTML purify normalising line breaks
This commit is contained in:
parent
4ad6e3f475
commit
8ac11ff286
@ -252,8 +252,10 @@ class HTMLPurifier_Lexer
|
||||
public function normalize($html, $config, $context) {
|
||||
|
||||
// normalize newlines to \n
|
||||
$html = str_replace("\r\n", "\n", $html);
|
||||
$html = str_replace("\r", "\n", $html);
|
||||
if ($config->get('Output.Newline')!=="\n") {
|
||||
$html = str_replace("\r\n", "\n", $html);
|
||||
$html = str_replace("\r", "\n", $html);
|
||||
}
|
||||
|
||||
if ($config->get('HTML.Trusted')) {
|
||||
// escape convoluted CDATA
|
||||
|
@ -4,5 +4,6 @@ Changes:
|
||||
* HMLTModule/Text.php - added <nolink>, <tex>, <lang> and <algebra> tags
|
||||
* HMLTModule/XMLCommonAttributes.php - remove xml:lang - needed for multilang
|
||||
* AttrDef/Lang.php - relax lang check - needed for multilang
|
||||
* Lexer.php - Subverted line break normalisation (requires setting: Output.Newline to \n)
|
||||
|
||||
skodak
|
||||
|
@ -1496,6 +1496,7 @@ function purify_html($text) {
|
||||
if ($purifier === false) {
|
||||
require_once $CFG->libdir.'/htmlpurifier/HTMLPurifier.safe-includes.php';
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('Output.Newline', "\n");
|
||||
$config->set('Core.ConvertDocumentToFragment', true);
|
||||
$config->set('Core.Encoding', 'UTF-8');
|
||||
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
|
||||
|
Loading…
x
Reference in New Issue
Block a user