From a987db2c553fd8e41dff2b3e65ef8503cc9848a6 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 11 Nov 2013 00:47:09 +0100 Subject: [PATCH] Section notices should not take up too much space. No configuration options for the max amount of characters yet. --- lib/noticesection.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/noticesection.php b/lib/noticesection.php index 4c6aeb3b5d..35423e4f9b 100644 --- a/lib/noticesection.php +++ b/lib/noticesection.php @@ -50,6 +50,8 @@ define('NOTICES_PER_SECTION', 6); class NoticeSection extends Section { + protected $maxchars = 140; + function showContent() { $notices = $this->getNotices(); @@ -98,7 +100,9 @@ class NoticeSection extends Section $this->out->elementEnd('span'); $this->out->elementStart('p', 'entry-content'); - $this->out->raw($notice->rendered); + $this->out->text(mb_strlen($notice->content) > $this->maxchars + ? mb_substr($notice->content, 0, $this->maxchars) . '…' + : $notice->content); $this->out->elementEnd('p'); $this->out->elementStart('div', 'entry_content');