1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-25 16:00:22 +01:00

Don't require closing tag for tags that don't need it.

This commit is contained in:
Macil Tech 2012-08-16 09:05:19 -05:00
parent 83feb4ce94
commit 36af0af624

View File

@ -190,9 +190,12 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) {
// remove broken HTML entity at the end (if existent)
$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
foreach ($tags as &$tag) {
$body .= "</{$tag}>";
if (!in_array($tag, $tags_no_close_needed))
$body .= "</{$tag}>";
}
} else {
// remove broken HTML entity at the end (if existent)