Make WordPress Core

Ticket #16448: 16448.diff

File 16448.diff, 1.3 KB (added by solarissmoke, 14 years ago)

Don't mess with smilies in code and pre blocks

  • wp-includes/formatting.php

     
    14751475                // HTML loop taken from texturize function, could possible be consolidated
    14761476                $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
    14771477                $stop = count($textarr);// loop stuff
     1478               
     1479                $tags_to_ignore = array('code', 'pre');
     1480                $inside_ignore_block = '';
     1481               
    14781482                for ($i = 0; $i < $stop; $i++) {
    14791483                        $content = $textarr[$i];
    1480                         if ((strlen($content) > 0) && ('<' != $content[0])) { // If it's not a tag
     1484                       
     1485                        // If we're in an ignore block, wait until we find its closing tag
     1486                        if( ! $inside_ignore_block && preg_match( '/^<(' . implode( '|', $tags_to_ignore ) . ')>/', $content, $matches ) )
     1487                                $inside_ignore_block = $matches[1];
     1488                                         
     1489                        if ( ! $inside_ignore_block && ( strlen($content) > 0 ) && ( '<' != $content[0] ) ) // If it's not a tag
    14811490                                $content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
    1482                         }
     1491                       
     1492                        if( $inside_ignore_block && ( '</' . $inside_ignore_block .'>' == $content ) )
     1493                                $inside_ignore_block = '';
     1494
    14831495                        $output .= $content;
    14841496                }
    14851497        } else {