/msU", "", $content); # Replace any "MAC-Enter" to Unix style # $content=preg_replace("/\r/", "\n", $content); # Remove all whitespaces before linebreaks # $content=preg_replace("/[ \t]+\n/", "\n", $content); # Remove multiple linebreaks # $content=preg_replace("/\n+/", "\n", $content); # Remove any useless linebreak (will produce one-line-code, hard to read!) # $content=preg_replace("/\s+/", " ", $content); } ## ## Code Cleanup with tidy (uses php5-tidy) ## see also: http://tidy.sourceforge.net/docs/quickref.html ## if (!$isFeed) { $config = array( 'char-encoding' => 'utf8', # character encoding for input and output 'newline' => 'LF', # use LF, CRLF or CR 'output-xhtml' => true, # generate output in xhtml (not html4) 'add-xml-decl' => true, # starting with XML declaration # 'doctype' => 'strict', # doctype declaration (strict produces xhtml1.0 strict, not xhtml1.1) 'tidy-mark' => false, # add a meta element to indicate that the document has been tidied # 'css-prefix' => 'tidy', # prefix to use for new styles rules (e.g. with clean option) # 'clean' => true, # strip out old tags and attributes replacing them by style rules 'drop-empty-paras' => true, # specifies if Tidy should discard empty paragraphs 'drop-proprietary-attributes' => true, # strip out proprietary attributes, such as MS data binding attributes 'hide-comments' => true, # remove any comments 'indent' => true, # indent block-level tags 'indent-attributes' => false, # indent block-level tags 'vertical-space' => true, # add some empty lines for readability 'wrap' => '0', # the right margin used for line wrapping (0 = disabled) ); $content=tidy_parse_string($content, $config, "utf8"); tidy_clean_repair($content); } ## ## Output ## echo $content; ?>