1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 03:10:09 +02:00

Hacky full docuement parse thingy removed from DOMLex, fixes barfing on full HTML documents.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@328 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-27 22:06:58 +00:00
parent 24cde9c891
commit 7588068b7b
2 changed files with 3 additions and 6 deletions

View File

@@ -37,7 +37,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
if (!$config) $config = HTMLPurifier_Config::createDefault();
if ($config->get('Core', 'AcceptFullDocuments')) {
$is_full = $this->extractBody($string, true);
$string = $this->extractBody($string);
}
$doc = new DOMDocument();
@@ -55,9 +55,8 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
// clean it into well-formed UTF-8 string
$string = $this->cleanUTF8($string);
if (!$is_full) {
// preprocess string, essential for UTF-8
$string =
$string =
'<!DOCTYPE html '.
'PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'.
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.
@@ -65,7 +64,6 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
'<meta http-equiv="Content-Type" content="text/html;'.
' charset=utf-8" />'.
'</head><body><div>'.$string.'</div></body></html>';
}
@$doc->loadHTML($string); // mute all errors, handle it transparently