diff options
| author | Macil Tech <maciltech@gmail.com> | 2013-01-14 19:11:55 -0600 |
|---|---|---|
| committer | Macil Tech <maciltech@gmail.com> | 2013-01-18 18:26:25 -0600 |
| commit | 948dfe8555e06b2f900a92678faff918c2ab95b6 (patch) | |
| tree | 6c3aba68c624e354d7f04a830f280b4964da313c /inc/display.php | |
| parent | 46f50248f01c03bb4fefd181c5e5ac594fac4774 (diff) | |
Don't truncate inside an HTML comment!
Diffstat (limited to 'inc/display.php')
| -rw-r--r-- | inc/display.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/inc/display.php b/inc/display.php index 6394c711..f4e1151e 100644 --- a/inc/display.php +++ b/inc/display.php @@ -155,6 +155,11 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) { $max_lines = $config['body_truncate']; if ($max_chars === false) $max_chars = $config['body_truncate_char']; + + // We don't want to risk truncating in the middle of an HTML comment. + // It's easiest just to remove them all first. + $body = preg_replace('/<!--.*?-->/s', '', $body); + $original_body = $body; $lines = substr_count($body, '<br/>'); |
