mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 06:07:26 +02:00
Quality control, improve a little documentation and fix UTF-8 unfriendliness in the Generator.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@138 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -13,6 +13,7 @@ class HTMLPurifier_Generator
|
||||
}
|
||||
|
||||
function generateFromToken($token) {
|
||||
if (!isset($token->type)) return '';
|
||||
if ($token->type == 'start') {
|
||||
$attr = $this->generateAttributes($token->attributes);
|
||||
return '<' . $token->name . ($attr ? ' ' : '') . $attr . '>';
|
||||
@@ -25,7 +26,7 @@ class HTMLPurifier_Generator
|
||||
return '<' . $token->name . ($attr ? ' ' : '') . $attr . ' />';
|
||||
|
||||
} elseif ($token->type == 'text') {
|
||||
return htmlentities($token->data, ENT_COMPAT, 'UTF-8');
|
||||
return htmlspecialchars($token->data, ENT_COMPAT, 'UTF-8');
|
||||
|
||||
} else {
|
||||
return '';
|
||||
@@ -36,7 +37,7 @@ class HTMLPurifier_Generator
|
||||
function generateAttributes($assoc_array_of_attributes) {
|
||||
$html = '';
|
||||
foreach ($assoc_array_of_attributes as $key => $value) {
|
||||
$html .= $key.'="'.htmlentities($value, ENT_COMPAT, 'UTF-8').'" ';
|
||||
$html .= $key.'="'.htmlspecialchars($value, ENT_COMPAT, 'UTF-8').'" ';
|
||||
}
|
||||
return rtrim($html);
|
||||
}
|
||||
|
Reference in New Issue
Block a user