Make WordPress Core

Ticket #4409: 4409.diff

File 4409.diff, 1.1 KB (added by mdawaffe, 19 years ago)

possibility

  • wp-includes/kses.php

     
    257257# matches stray ">" characters.
    258258###############################################################################
    259259{
    260         return preg_replace('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%e',
     260        return preg_replace('%((<!--.*?(-->|$))|(<[^<>]*(>|$)|>))%e',
    261261        "wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string);
    262262} # function wp_kses_split
    263263
     
    289289                return '';
    290290        # It's seriously malformed
    291291
     292//      Turns 'foo < br' into 'foo &lt; br';
     293//      if ( false === strpos($string, '>') )
     294//              return str_replace( '<', '&lt;', $string );
     295
    292296        $slash = trim($matches[1]);
    293297        $elem = $matches[2];
    294298        $attrlist = $matches[3];
    295299
    296         if (!@isset($allowed_html[strtolower($elem)]))
     300        if (!@isset($allowed_html[strtolower($elem)])) {
     301                // Turns 'foo < br' into 'foo <br>' like kses did originally
     302                if ( false === strpos($string, '>') )
     303                        return str_replace( '<', '&lt;', $string );
    297304                return '';
     305        }
    298306        # They are using a not allowed HTML element
    299307
    300308        if ($slash != '')