Changeset 6102
- Timestamp:
- 09/13/2007 04:11:21 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r6096 r6102 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 } … … 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
Note: See TracChangeset
for help on using the changeset viewer.