also convert an ending </div> into a newline when converting html to text

This commit is contained in:
james 2010-03-30 04:39:56 +00:00
parent 3fce787126
commit cbab7c7fa8

View File

@ -1306,6 +1306,8 @@ function format_duration($seconds, $granularity = 2)
function getTextFromHtml($html) {
//first, replace an </p> with </p><br />
$text=str_replace("</p>","</p><br />",$html);
//next, replace a </div> with </div><br />
$text=str_replace("</div>","</div><br />",$html);
//now replace any <br /> with newlines
$text=eregi_replace('<br[[:space:]]*/?[[:space:]]*>',chr(13).chr(10),$text);
//and strip the rest of the tags