PHPIDS
Current file: /home/mario/workspace/php-ids.org/trunk/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLModule/Legacy.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% 80 / 80
 
HTMLPurifier_HTMLModule_Legacy
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 80 / 80
 public function __construct()
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 79 / 79


       1                 : <?php                                                                              
       2                 :                                                                                    
       3                 : /**                                                                                
       4                 :  * XHTML 1.1 Legacy module defines elements that were previously                   
       5                 :  * deprecated.                                                                     
       6                 :  *                                                                                 
       7                 :  * @note Not all legacy elements have been implemented yet, which                  
       8                 :  *       is a bit of a reverse problem as compared to browsers! In                 
       9                 :  *       addition, this legacy module may implement a bit more than                
      10                 :  *       mandated by XHTML 1.1.                                                    
      11                 :  *                                                                                 
      12                 :  * This module can be used in combination with TransformToStrict in order          
      13                 :  * to transform as many deprecated elements as possible, but retain                
      14                 :  * questionably deprecated elements that do not have good alternatives             
      15                 :  * as well as transform elements that don't have an implementation.                
      16                 :  * See docs/ref-strictness.txt for more details.                                   
      17                 :  */                                                                                
      18                 :                                                                                    
      19               1 : class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule               
      20                 : {                                                                                  
      21                 :                                                                                    
      22                 :     public $name = 'Legacy';                                                       
      23                 :                                                                                    
      24                 :     public function __construct() {                                                
      25                 :                                                                                    
      26               1 :         $this->addElement('basefont', 'Inline', 'Empty', false, array(             
      27               1 :             'color' => 'Color',                                                    
      28               1 :             'face' => 'Text', // extremely broad, we should                        
      29               1 :             'size' => 'Text', // tighten it                                        
      30                 :             'id' => 'ID'                                                           
      31               1 :         ));                                                                        
      32               1 :         $this->addElement('center', 'Block', 'Flow', 'Common');                    
      33               1 :         $this->addElement('dir', 'Block', 'Required: li', 'Common', array(         
      34                 :             'compact' => 'Bool#compact'                                            
      35               1 :         ));                                                                        
      36               1 :         $this->addElement('font', 'Inline', 'Inline', array('Core', 'I18N'), array(
      37               1 :             'color' => 'Color',                                                    
      38               1 :             'face' => 'Text', // extremely broad, we should                        
      39               1 :             'size' => 'Text', // tighten it                                        
      40               1 :         ));                                                                        
      41               1 :         $this->addElement('menu', 'Block', 'Required: li', 'Common', array(        
      42                 :             'compact' => 'Bool#compact'                                            
      43               1 :         ));                                                                        
      44               1 :         $this->addElement('s', 'Inline', 'Inline', 'Common');                      
      45               1 :         $this->addElement('strike', 'Inline', 'Inline', 'Common');                 
      46               1 :         $this->addElement('u', 'Inline', 'Inline', 'Common');                      
      47                 :                                                                                    
      48                 :         // setup modifications to old elements                                     
      49                 :                                                                                    
      50               1 :         $align = 'Enum#left,right,center,justify';                                 
      51                 :                                                                                    
      52               1 :         $address = $this->addBlankElement('address');                              
      53               1 :         $address->content_model = 'Inline | #PCDATA | p';                          
      54               1 :         $address->content_model_type = 'optional';                                 
      55               1 :         $address->child = false;                                                   
      56                 :                                                                                    
      57               1 :         $blockquote = $this->addBlankElement('blockquote');                        
      58               1 :         $blockquote->content_model = 'Flow | #PCDATA';                             
      59               1 :         $blockquote->content_model_type = 'optional';                              
      60               1 :         $blockquote->child = false;                                                
      61                 :                                                                                    
      62               1 :         $br = $this->addBlankElement('br');                                        
      63               1 :         $br->attr['clear'] = 'Enum#left,all,right,none';                           
      64                 :                                                                                    
      65               1 :         $caption = $this->addBlankElement('caption');                              
      66               1 :         $caption->attr['align'] = 'Enum#top,bottom,left,right';                    
      67                 :                                                                                    
      68               1 :         $div = $this->addBlankElement('div');                                      
      69               1 :         $div->attr['align'] = $align;                                              
      70                 :                                                                                    
      71               1 :         $dl = $this->addBlankElement('dl');                                        
      72               1 :         $dl->attr['compact'] = 'Bool#compact';                                     
      73                 :                                                                                    
      74               1 :         for ($i = 1; $i <= 6; $i++) {                                              
      75               1 :             $h = $this->addBlankElement("h$i");                                    
      76               1 :             $h->attr['align'] = $align;                                            
      77               1 :         }                                                                          
      78                 :                                                                                    
      79               1 :         $hr = $this->addBlankElement('hr');                                        
      80               1 :         $hr->attr['align'] = $align;                                               
      81               1 :         $hr->attr['noshade'] = 'Bool#noshade';                                     
      82               1 :         $hr->attr['size'] = 'Pixels';                                              
      83               1 :         $hr->attr['width'] = 'Length';                                             
      84                 :                                                                                    
      85               1 :         $img = $this->addBlankElement('img');                                      
      86               1 :         $img->attr['align'] = 'Enum#top,middle,bottom,left,right';                 
      87               1 :         $img->attr['border'] = 'Pixels';                                           
      88               1 :         $img->attr['hspace'] = 'Pixels';                                           
      89               1 :         $img->attr['vspace'] = 'Pixels';                                           
      90                 :                                                                                    
      91                 :         // figure out this integer business                                        
      92                 :                                                                                    
      93               1 :         $li = $this->addBlankElement('li');                                        
      94               1 :         $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();                   
      95               1 :         $li->attr['type']  = 'Enum#s:1,i,I,a,A,disc,square,circle';                
      96                 :                                                                                    
      97               1 :         $ol = $this->addBlankElement('ol');                                        
      98               1 :         $ol->attr['compact'] = 'Bool#compact';                                     
      99               1 :         $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();                   
     100               1 :         $ol->attr['type'] = 'Enum#s:1,i,I,a,A';                                    
     101                 :                                                                                    
     102               1 :         $p = $this->addBlankElement('p');                                          
     103               1 :         $p->attr['align'] = $align;                                                
     104                 :                                                                                    
     105               1 :         $pre = $this->addBlankElement('pre');                                      
     106               1 :         $pre->attr['width'] = 'Number';                                            
     107                 :                                                                                    
     108                 :         // script omitted                                                          
     109                 :                                                                                    
     110               1 :         $table = $this->addBlankElement('table');                                  
     111               1 :         $table->attr['align'] = 'Enum#left,center,right';                          
     112               1 :         $table->attr['bgcolor'] = 'Color';                                         
     113                 :                                                                                    
     114               1 :         $tr = $this->addBlankElement('tr');                                        
     115               1 :         $tr->attr['bgcolor'] = 'Color';                                            
     116                 :                                                                                    
     117               1 :         $th = $this->addBlankElement('th');                                        
     118               1 :         $th->attr['bgcolor'] = 'Color';                                            
     119               1 :         $th->attr['height'] = 'Length';                                            
     120               1 :         $th->attr['nowrap'] = 'Bool#nowrap';                                       
     121               1 :         $th->attr['width'] = 'Length';                                             
     122                 :                                                                                    
     123               1 :         $td = $this->addBlankElement('td');                                        
     124               1 :         $td->attr['bgcolor'] = 'Color';                                            
     125               1 :         $td->attr['height'] = 'Length';                                            
     126               1 :         $td->attr['nowrap'] = 'Bool#nowrap';                                       
     127               1 :         $td->attr['width'] = 'Length';                                             
     128                 :                                                                                    
     129               1 :         $ul = $this->addBlankElement('ul');                                        
     130               1 :         $ul->attr['compact'] = 'Bool#compact';                                     
     131               1 :         $ul->attr['type'] = 'Enum#square,disc,circle';                             
     132                 :                                                                                    
     133               1 :     }                                                                              
     134                 :                                                                                    
     135                 : }                                                                                  
     136                 :                                                                                    

Generated by PHPUnit 3.2.20 and Xdebug 2.0.3 at Sat Jun 7 16:15:42 CEST 2008.