mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-09 07:36:40 +02:00
[2.0.1] Implement haphazard error collection for AttrValidator.
- Error collector / Language can take arrays and listify them - AttrValidator takes token by reference - Formatted errors now have their severity <strong> - 100 test-cases! W00t! git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1250 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -91,7 +91,7 @@ class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
|
||||
$definition->info[$token->name]->required_attr &&
|
||||
($token->name != 'img' || $remove_invalid_img) // ensure config option still works
|
||||
) {
|
||||
$token = $attr_validator->validateToken($token, $config, $context);
|
||||
$attr_validator->validateToken($token, $config, $context);
|
||||
$ok = true;
|
||||
foreach ($definition->info[$token->name]->required_attr as $name) {
|
||||
if (!isset($token->attr[$name])) {
|
||||
|
@@ -27,6 +27,9 @@ class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy
|
||||
// setup validator
|
||||
$validator = new HTMLPurifier_AttrValidator();
|
||||
|
||||
$token = false;
|
||||
$context->register('CurrentToken', $token);
|
||||
|
||||
foreach ($tokens as $key => $token) {
|
||||
|
||||
// only process tokens that have attributes,
|
||||
@@ -36,7 +39,8 @@ class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy
|
||||
// skip tokens that are armored
|
||||
if (!empty($token->armor['ValidateAttributes'])) continue;
|
||||
|
||||
$tokens[$key] = $validator->validateToken($token, $config, $context);
|
||||
// note that we have no facilities here for removing tokens
|
||||
$validator->validateToken($token, $config, $context);
|
||||
}
|
||||
|
||||
$context->destroy('IDAccumulator');
|
||||
|
Reference in New Issue
Block a user