|
Function html2text ($ str ){
$ Str = preg_replace ("/<style .*? </Style>/is "," ", $ str); $ str = preg_replace ("/<script .*? </Script>/is "," ", $ str );
$ Str = preg_replace ("/<br s */? />/I "," n ", $ str );
$ Str = preg_replace ("/</? P>/I "," nn ", $ str );
$ Str = preg_replace ("/</? Td>/I "," n ", $ str );
$ Str = preg_replace ("/</? Div>/I "," n ", $ str );
$ Str = preg_replace ("/</? Blockquote>/I "," n ", $ str );
$ Str = preg_replace ("/</? Li>/I "," n ", $ str );
$ Str = preg_replace ("/& nbsp;/I", "", $ str );
$ Str = preg_replace ("/& nbsp/I", "", $ str );
$ Str = preg_replace ("/& amp;/I", "&", $ str );
$ Str = preg_replace ("/& amp/I", "&", $ str );
$ Str = preg_replace ("/& lt;/I", "<", $ str );
$ Str = preg_replace ("/& lt/I", "<", $ str );
$ Str = preg_replace ("/& ldquo;/I", '"', $ str );
$ Str = preg_replace ("/& ldquo/I", '"', $ str );
$ Str = preg_replace ("/& lsquo;/I", "'", $ str );
$ Str = preg_replace ("/& lsquo/I", "'", $ str );
$ Str = preg_replace ("/& rsquo;/I", "'", $ str );
$ Str = preg_replace ("/& rsquo/I", "'", $ str );
$ Str = preg_replace ("/& gt;/I", ">", $ str );
$ Str = preg_replace ("/& gt/I", ">", $ str );
$ Str = preg_replace ("/& rdquo;/I", '"', $ str );
$ Str = preg_replace ("/& rdquo/I", '"', $ str );
$ Str = strip_tags ($ str );
$ Str = html_entity_decode ($ str, ENT_QUOTES, "UTF-8 ");
$ Str = preg_replace ("/& amp ("/&#.*?; /I "," ", $ str );
Return $ str;
} |