Merge changes I97273c52,I560d766f
[lhc/web/wiklou.git] / includes / parser / Tidy.php
index 5cc1b0f..4994d3e 100644 (file)
@@ -68,9 +68,9 @@ class MWTidyWrapper {
                $wrappedtext = preg_replace( '!<(link|meta)([^>]*?)(/{0,1}>)!', '<html-$1$2$3', $wrappedtext );
 
                // Wrap the whole thing in a doctype and body for Tidy.
-               $wrappedtext = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'.
-                       ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>'.
-                       '<head><title>test</title></head><body>'.$wrappedtext.'</body></html>';
+               $wrappedtext = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' .
+                       ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>' .
+                       '<head><title>test</title></head><body>' . $wrappedtext . '</body></html>';
 
                return $wrappedtext;
        }
@@ -260,24 +260,24 @@ class MWTidy {
 
                        wfProfileOut( __METHOD__ );
                        return $tidy->errorBuffer;
+               }
+
+               $tidy->cleanRepair();
+               $retval = $tidy->getStatus();
+               if ( $retval == 2 ) {
+                       // 2 is magic number for fatal error
+                       // http://www.php.net/manual/en/function.tidy-get-status.php
+                       $cleansource = null;
                } else {
-                       $tidy->cleanRepair();
-                       $retval = $tidy->getStatus();
-                       if ( $retval == 2 ) {
-                               // 2 is magic number for fatal error
-                               // http://www.php.net/manual/en/function.tidy-get-status.php
-                               $cleansource = null;
-                       } else {
-                               $cleansource = tidy_get_output( $tidy );
-                               if ( $wgDebugTidy && $retval > 0 ) {
-                                       $cleansource .= "<!--\nTidy reports:\n" .
-                                               str_replace( '-->', '--&gt;', $tidy->errorBuffer ) .
-                                               "\n-->";
-                               }
+                       $cleansource = tidy_get_output( $tidy );
+                       if ( $wgDebugTidy && $retval > 0 ) {
+                               $cleansource .= "<!--\nTidy reports:\n" .
+                                       str_replace( '-->', '--&gt;', $tidy->errorBuffer ) .
+                                       "\n-->";
                        }
-
-                       wfProfileOut( __METHOD__ );
-                       return $cleansource;
                }
+
+               wfProfileOut( __METHOD__ );
+               return $cleansource;
        }
 }