1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-05 05:37:49 +02:00

Make newline normalization optional.

This commit is contained in:
Tomasz Muras
2010-09-10 21:51:55 +01:00
committed by Edward Z. Yang
parent 632bf2bbd4
commit 9573f0933d
8 changed files with 42 additions and 8 deletions

View File

@@ -0,0 +1,9 @@
HTML.NewlineNormalization
TYPE: bool
VERSION: 4.2.0
DEFAULT: true
--DESCRIPTION--
<p>
Whether or not to normalize newlines.
</p>
--# vim: et sw=4 sts=4

View File

@@ -263,8 +263,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('HTML.NewlineNormalization')) {
$html = str_replace("\r\n", "\n", $html);
$html = str_replace("\r", "\n", $html);
}
if ($config->get('HTML.Trusted')) {
// escape convoluted CDATA

View File

@@ -125,8 +125,6 @@ class HTML5 {
const EOF = 5;
public function __construct($data) {
$data = str_replace("\r\n", "\n", $data);
$data = str_replace("\r", null, $data);
$this->data = $data;
$this->char = -1;