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