/,
- // to avoid the useless and UGLY last bottom-margin :-))
- $str=preg_replace('#^\s*#m','',$str);// strip all spaces from empty lines
- $str=preg_replace('#[\r\n]#',' ',$str);// strip all "wrap chars"
- $str=preg_replace('#(|||
)#i','$1'.N,$str);// now add a newline after every and so on
- $str=rtrim($str);// trim the newline at the end of the whole text block in order for the next preg_replace to match against $ as end of the whole text block
- $str=preg_replace(['#]*>(.*)
$#i', '#]*>(.*)
$#i', '#$#i', '#]*>(.*)
$#i'],['$1
', '$1
', '', '$1
'],$str);
+ $str=preg_replace('#]*>\s*
#is','',$str);
+ $str=preg_replace(['#]*>(.*)
#i','#]>(.*)
#i'],['
$1
','
$1
'],$str);
+ $str=strip_tags($str,'
');
+ $str=preg_replace('#<([^>]*)\s(style|class)="[^"]*"([^>]*)>#i','<$1$3>',$str);
+ $str=preg_replace(['#]*>#i','##i'],['
','
'],$str);
+ $str=preg_replace(['#<([ou])l[^>]*>#i','#([ou])l>#i'],['
<$1l class="nobott">','$1l>
'],$str);
+ $str=preg_replace(['#
\s+
#i','#^(
)+#i','#(
){3,}#i','#(
)+$#i','#([ou])l>\s*(
)+#i','#
\s*(
)+#i'],['
','','
','','$1l>
','
'],$str);
+ // this part below is to try and assign the css "nobott" css class to a possible closing /, to avoid the useless and UGLY last bottom-margin :-)
+ $str=preg_replace(['#]*>(.*)
$#i','#$#i'],['$1
',''],$str);
return $str;
}