some cleanup on save
authorGabriel Wicke <gwicke@users.mediawiki.org>
Fri, 9 Apr 2004 16:22:12 +0000 (16:22 +0000)
committerGabriel Wicke <gwicke@users.mediawiki.org>
Fri, 9 Apr 2004 16:22:12 +0000 (16:22 +0000)
includes/Parser.php

index 3c7b67a..eb3c613 100644 (file)
@@ -1786,7 +1786,16 @@ class Parser
                }
                
                $stripState = false;
-               $text = str_replace("\r\n", "\n", $text);
+               $pairs = array(
+                       "\r\n" => "\n",
+                       );
+               $text = str_replace(array_keys($pairs), array_values($pairs), $text);
+               // now with regexes
+               $pairs = array(
+                       "/<br.+(clear|break)=[\"']?(all|both)[\"']?\\/?>/i" => '<br style="clear:both;"/>',
+                       "/<br *?>/i" => "<br/>",
+               );
+               $text = preg_replace(array_keys($pairs), array_values($pairs), $text);
                $text = $this->strip( $text, $stripState, false );
                $text = $this->pstPass2( $text, $user );
                $text = $this->unstrip( $text, $stripState );