Ticket #1170: 1170.diff
File 1170.diff, 1.3 KB (added by , 17 years ago) |
---|
-
wp-includes/formatting.php
439 439 return $text; 440 440 441 441 $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = ''; 442 $single_tags = array('br', 'hr', 'img', 'input'); //Known single-entity/self-closing tags 443 $nestable_tags = array('blockquote', 'div', 'span'); //Tags that can be immediately nested within themselves 442 444 443 445 # WP bug fix for comments - in case you REALLY meant to type '< !--' 444 446 $text = str_replace('< !--', '< !--', $text); … … 489 491 if((substr($regex[2],-1) == '/') || ($tag == '')) { 490 492 } 491 493 // ElseIf it's a known single-entity tag but it doesn't close itself, do so 492 elseif ( $tag == 'br' || $tag == 'img' || $tag == 'hr' || $tag == 'input') {494 elseif ( in_array($tag, $single_tags) ) { 493 495 $regex[2] .= '/'; 494 496 } else { // Push the tag onto the stack 495 497 // If the top of the stack is the same as the tag we want to push, close previous tag 496 if (($stacksize > 0) && ($tag != 'div') && ($tagstack[$stacksize - 1] == $tag)) {498 if (($stacksize > 0) && !in_array($tag, $nestable_tags) && ($tagstack[$stacksize - 1] == $tag)) { 497 499 $tagqueue = '</' . array_pop ($tagstack) . '>'; 498 500 $stacksize--; 499 501 }