From 9dc1e9870418a54f834c2e546e1c549c3662c4e8 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Tue, 12 Apr 2011 18:02:20 +1000 Subject: PM inbox --- inc/display.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'inc/display.php') diff --git a/inc/display.php b/inc/display.php index 72983a49..c0d2dde1 100644 --- a/inc/display.php +++ b/inc/display.php @@ -92,6 +92,24 @@ ))); } + function pm_snippet($body) { + global $config; + + // Replace line breaks with some whitespace + $body = str_replace('
', ' ', $body); + + // Strip tags + $body = strip_tags($body); + + // 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'] ? '…' : ''); + + // Re-escape the characters. + return '' . utf8tohtml($body) . ''; + } + function confirmLink($text, $title, $confirm, $href) { global $config, $mod; if($config['mod']['server-side_confirm']) -- cgit v1.3