public static function RunOn($text) { global $wgTidyInternal; $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>' . $text . '</body></html>'; if ($wgTidyInternal) { $correctedtext = Tidy::internal($wrappedtext); } else { $correctedtext = Tidy::external($wrappedtext); } if (is_null($correctedtext)) { wfDebug("Tidy error detected!\n"); return $text . "\n<!-- Tidy found serious XHTML errors -->\n"; } return $correctedtext; }