Browse Source

Don't truncate inside an HTML comment!

pull/40/head
Macil Tech 10 years ago
parent
commit
948dfe8555
  1. 5
      inc/display.php

5
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/>');

Loading…
Cancel
Save