]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Section notices should not take up too much space.
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 10 Nov 2013 23:47:09 +0000 (00:47 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 10 Nov 2013 23:47:41 +0000 (00:47 +0100)
No configuration options for the max amount of characters yet.

lib/noticesection.php

index 4c6aeb3b5dd3520eebb15b06f3ad980729454748..35423e4f9bd35728319ce7c8b320b1ff78637ddc 100644 (file)
@@ -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');