Ticket #1170: bug1170_functions-formatting2.diff
File bug1170_functions-formatting2.diff, 1.3 KB (added by , 20 years ago) |
---|
-
wp-includes/functions-formatting.php
392 392 } 393 393 394 394 $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = ''; 395 $single_tags = array('br', 'hr', 'img', 'input'); //Known single-entity/self-closing tags 396 $nestable_tags = array('blockquote', 'div', 'span'); //Tags that can be immediately nested within themselves 395 397 396 398 # WP bug fix for comments - in case you REALLY meant to type '< !--' 397 399 $text = str_replace('< !--', '< !--', $text); … … 442 444 if((substr($regex[2],-1) == '/') || ($tag == '')) { 443 445 } 444 446 // ElseIf it's a known single-entity tag but it doesn't close itself, do so 445 elseif ( $tag == 'br' || $tag == 'img' || $tag == 'hr' || $tag == 'input') {447 elseif ( in_array($tag, $single_tags) ) { 446 448 $regex[2] .= '/'; 447 449 } else { // Push the tag onto the stack 448 450 // If the top of the stack is the same as the tag we want to push, close previous tag 449 if (($stacksize > 0) && ($tag != 'div') && ($tagstack[$stacksize - 1] == $tag)) {451 if (($stacksize > 0) && !in_array($tag, $nestable_tags) && ($tagstack[$stacksize - 1] == $tag)) { 450 452 $tagqueue = '</' . array_pop ($tagstack) . '>'; 451 453 $stacksize--; 452 454 }