This commit is contained in:
Savetheinternet 2011-04-15 04:59:04 +10:00
parent 81851e64f3
commit 21d97bab29
2 changed files with 7 additions and 4 deletions

View file

@ -98,9 +98,12 @@
)));
}
function pm_snippet($body) {
function pm_snippet($body, $len=null) {
global $config;
if(!isset($len))
$len = $config['mod']['snippet_length'];
// Replace line breaks with some whitespace
$body = str_replace('<br/>', ' ', $body);
@ -110,7 +113,7 @@
// Unescape HTML characters, to avoid splitting them in half
$body = html_entity_decode_utf8($body);
$body = substr($body, 0, $config['mod']['snippet_length']) . (strlen($body) > $config['mod']['snippet_length'] ? '…' : '');
$body = substr($body, 0, $len) . (strlen($body) > $len ? '…' : '');
// Re-escape the characters.
return '<em>' . utf8tohtml($body) . '</em>';