Show
Ignore:
Timestamp:
04/23/05 15:56:47 (4 years ago)
Author:
mbonetti
Message:

patch to accept malformed xhtml tags, lacking a space between the last
attribute and "/>"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/extlib/kses.php

    r260 r392  
    132132 
    133133  $xhtml_slash = ''; 
    134   if (preg_match('%\s/\s*$%', $attr)) 
     134  if (preg_match('%\s*/\s*$%', $attr)) 
    135135    $xhtml_slash = ' /'; 
    136136 
     
    208208      case 0: # attribute name, href for instance 
    209209 
    210         if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) 
     210        if (preg_match('/^([-a-zA-Z]+)\/?/', $attr, $match)) 
    211211        { 
    212212          $attrname = $match[1]; 
    213213          $working = $mode = 1; 
    214           $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr); 
     214          $attr = preg_replace('/^[-a-zA-Z]+\/?/', '', $attr); 
    215215        } 
    216216 
     
    241241      case 2: # attribute value, a URL after href= for instance 
    242242 
    243         if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) 
     243        if (preg_match('/^"([^"]*)"(\s+|$|\/)/', $attr, $match)) 
    244244         # "value" 
    245245        { 
     
    252252                         'vless' => 'n'); 
    253253          $working = 1; $mode = 0; 
    254           $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr); 
     254          $attr = preg_replace('/^"[^"]*"(\s+|$|\/)/', '', $attr); 
    255255          break; 
    256256        } 
    257257 
    258         if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) 
     258        if (preg_match("/^'([^']*)'(\s+|$|\/)/", $attr, $match)) 
    259259         # 'value' 
    260260        { 
     
    271271        } 
    272272 
    273         if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) 
     273        if (preg_match("%^([^\s\"']+)(\s+|$|\/)%", $attr, $match)) 
    274274         # value 
    275275        {