1: <?php
2:
3: 4: 5:
6:
7: class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy
8: {
9:
10: public function execute($tokens, $config, $context) {
11:
12:
13: $validator = new HTMLPurifier_AttrValidator();
14:
15: $token = false;
16: $context->register('CurrentToken', $token);
17:
18: foreach ($tokens as $key => $token) {
19:
20:
21:
22: if (!$token instanceof HTMLPurifier_Token_Start && !$token instanceof HTMLPurifier_Token_Empty) continue;
23:
24:
25: if (!empty($token->armor['ValidateAttributes'])) continue;
26:
27:
28: $validator->validateToken($token, $config, $context);
29:
30: $tokens[$key] = $token;
31: }
32: $context->destroy('CurrentToken');
33:
34: return $tokens;
35: }
36:
37: }
38:
39:
40: