|
@ -190,8 +190,11 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) { |
|
|
// remove broken HTML entity at the end (if existent) |
|
|
// remove broken HTML entity at the end (if existent) |
|
|
$body = preg_replace('/&[^;]+$/', '', $body); |
|
|
$body = preg_replace('/&[^;]+$/', '', $body); |
|
|
|
|
|
|
|
|
|
|
|
$tags_no_close_needed = array("colgroup", "dd", "dt", "li", "optgroup", "option", "p", "tbody", "td", "tfoot", "th", "thead", "tr", "br", "img"); |
|
|
|
|
|
|
|
|
// Close any open tags |
|
|
// Close any open tags |
|
|
foreach ($tags as &$tag) { |
|
|
foreach ($tags as &$tag) { |
|
|
|
|
|
if (!in_array($tag, $tags_no_close_needed)) |
|
|
$body .= "</{$tag}>"; |
|
|
$body .= "</{$tag}>"; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|