ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
HTMLPurifier_Strategy_ValidateAttributes Class Reference

Validate all attributes in the tokens. More...

+ Inheritance diagram for HTMLPurifier_Strategy_ValidateAttributes:
+ Collaboration diagram for HTMLPurifier_Strategy_ValidateAttributes:

Public Member Functions

 execute ($tokens, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_Strategy
 execute ($tokens, $config, $context)
 Executes the strategy on the tokens. More...
 

Detailed Description

Validate all attributes in the tokens.

Definition at line 7 of file ValidateAttributes.php.

Member Function Documentation

◆ execute()

HTMLPurifier_Strategy_ValidateAttributes::execute (   $tokens,
  $config,
  $context 
)
Parameters
HTMLPurifier_Token[]$tokens
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
HTMLPurifier_Token[]

Definition at line 16 of file ValidateAttributes.php.

17  {
18  // setup validator
19  $validator = new HTMLPurifier_AttrValidator();
20 
21  $token = false;
22  $context->register('CurrentToken', $token);
23 
24  foreach ($tokens as $key => $token) {
25 
26  // only process tokens that have attributes,
27  // namely start and empty tags
28  if (!$token instanceof HTMLPurifier_Token_Start && !$token instanceof HTMLPurifier_Token_Empty) {
29  continue;
30  }
31 
32  // skip tokens that are armored
33  if (!empty($token->armor['ValidateAttributes'])) {
34  continue;
35  }
36 
37  // note that we have no facilities here for removing tokens
38  $validator->validateToken($token, $config, $context);
39  }
40  $context->destroy('CurrentToken');
41  return $tokens;
42  }
Validates the attributes of a token.
Concrete start token class.
Definition: Start.php:6
Concrete empty token class.
Definition: Empty.php:6

The documentation for this class was generated from the following file: