PHPIDS
Current file: /home/mario/workspace/php-ids.org/trunk/lib/IDS/vendors/htmlpurifier/HTMLPurifier/Strategy/ValidateAttributes.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 12 / 12
 
HTMLPurifier_Strategy_ValidateAttributes
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 12 / 12
 public function execute($tokens, $config, $context)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 11 / 11


       1                 : <?php                                                                                                                
       2                 :                                                                                                                      
       3                 : /**                                                                                                                  
       4                 :  * Validate all attributes in the tokens.                                                                            
       5                 :  */                                                                                                                  
       6                 :                                                                                                                      
       7               1 : class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy                                         
       8                 : {                                                                                                                    
       9                 :                                                                                                                      
      10                 :     public function execute($tokens, $config, $context) {                                                            
      11                 :                                                                                                                      
      12                 :         // setup validator                                                                                           
      13               2 :         $validator = new HTMLPurifier_AttrValidator();                                                               
      14                 :                                                                                                                      
      15               2 :         $token = false;                                                                                              
      16               2 :         $context->register('CurrentToken', $token);                                                                  
      17                 :                                                                                                                      
      18               2 :         foreach ($tokens as $key => $token) {                                                                        
      19                 :                                                                                                                      
      20                 :             // only process tokens that have attributes,                                                             
      21                 :             //   namely start and empty tags                                                                         
      22               2 :             if (!$token instanceof HTMLPurifier_Token_Start && !$token instanceof HTMLPurifier_Token_Empty) continue;
      23                 :                                                                                                                      
      24                 :             // skip tokens that are armored                                                                          
      25               2 :             if (!empty($token->armor['ValidateAttributes'])) continue;                                               
      26                 :                                                                                                                      
      27                 :             // note that we have no facilities here for removing tokens                                              
      28               2 :             $validator->validateToken($token, $config, $context);                                                    
      29                 :                                                                                                                      
      30               2 :             $tokens[$key] = $token; // for PHP 4                                                                     
      31               2 :         }                                                                                                            
      32               2 :         $context->destroy('CurrentToken');                                                                           
      33                 :                                                                                                                      
      34               2 :         return $tokens;                                                                                              
      35                 :     }                                                                                                                
      36                 :                                                                                                                      
      37                 : }                                                                                                                    
      38                 :                                                                                                                      

Generated by PHPUnit 3.3.1 and Xdebug 2.0.2 at Thu Sep 25 18:42:10 CEST 2008.