--- formatting.php.org Fri Feb 22 18:23:52 2008
+++ formatting.php Fri Feb 22 18:21:16 2008
@@ -55,7 +55,7 @@
$pee = $pee . "\n"; // just to make things a little easier, pad the end
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
// Space things out a little
- $allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
+ $allblocks = '(?:code|table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
@@ -80,6 +80,13 @@
if (strpos($pee, '<pre') !== false)
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
+ $pee = preg_replace('| {4}|', str_repeat('&nbsp;',4), $pee);
+ $pee = str_replace('\\', '\\\\', $pee);
+ $pee = preg_replace(
+ '|<code>.*?</code>|se'
+ , "str_replace(array('<p>', '</p>'), array('', '<br /><br />'), '$0')"
+ , $pee);
+ $pee = StripSlashes($pee);
return $pee;
}