Ticket #2059: 2059.diff
File 2059.diff, 1.1 KB (added by , 17 years ago) |
---|
-
wp-includes/formatting.php
44 44 return $output; 45 45 } 46 46 47 function clean_pre($text) { 47 // Accepts matches array from preg_replace_callback in wpautop() 48 // or a string 49 function clean_pre($matches) { 50 if ( is_array($matches) ) 51 $text = $matches[1] . $matches[2] . "</pre>"; 52 else 53 $text = $matches; 54 48 55 $text = str_replace('<br />', '', $text); 49 56 $text = str_replace('<p>', "\n", $text); 50 57 $text = str_replace('</p>', '', $text); 58 51 59 return $text; 52 60 } 53 61 … … 78 86 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee); 79 87 $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee); 80 88 if (strpos($pee, '<pre') !== false) 81 $pee = preg_replace ('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);89 $pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee ); 82 90 $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); 83 91 84 92 return $pee;