| 1 | Index: wp-includes/formatting.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/formatting.php (revision 17378) |
|---|
| 4 | +++ wp-includes/formatting.php (working copy) |
|---|
| 5 | @@ -1475,11 +1475,23 @@ |
|---|
| 6 | // HTML loop taken from texturize function, could possible be consolidated |
|---|
| 7 | $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between |
|---|
| 8 | $stop = count($textarr);// loop stuff |
|---|
| 9 | + |
|---|
| 10 | + $tags_to_ignore = array('code', 'pre'); |
|---|
| 11 | + $inside_ignore_block = ''; |
|---|
| 12 | + |
|---|
| 13 | for ($i = 0; $i < $stop; $i++) { |
|---|
| 14 | $content = $textarr[$i]; |
|---|
| 15 | - if ((strlen($content) > 0) && ('<' != $content[0])) { // If it's not a tag |
|---|
| 16 | + |
|---|
| 17 | + // If we're in an ignore block, wait until we find its closing tag |
|---|
| 18 | + if( ! $inside_ignore_block && preg_match( '/^<(' . implode( '|', $tags_to_ignore ) . ')>/', $content, $matches ) ) |
|---|
| 19 | + $inside_ignore_block = $matches[1]; |
|---|
| 20 | + |
|---|
| 21 | + if ( ! $inside_ignore_block && ( strlen($content) > 0 ) && ( '<' != $content[0] ) ) // If it's not a tag |
|---|
| 22 | $content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content); |
|---|
| 23 | - } |
|---|
| 24 | + |
|---|
| 25 | + if( $inside_ignore_block && ( '</' . $inside_ignore_block .'>' == $content ) ) |
|---|
| 26 | + $inside_ignore_block = ''; |
|---|
| 27 | + |
|---|
| 28 | $output .= $content; |
|---|
| 29 | } |
|---|
| 30 | } else { |
|---|