Allow newlines/paragraphs for article teasers
authorMarcel Werk <burntime@woltlab.com>
Fri, 3 Mar 2017 13:48:12 +0000 (14:48 +0100)
committerMarcel Werk <burntime@woltlab.com>
Fri, 3 Mar 2017 13:48:12 +0000 (14:48 +0100)
Closes #2225

wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php

index d25ec43b58f3c11ab408e7fa6276ee90271ab8a9..9a0dfc68d7944a11560a4288595862d75bcea295 100644 (file)
@@ -76,12 +76,12 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo
         */
        public function getFormattedTeaser() {
                if ($this->teaser) {
-                       return StringUtil::encodeHTML($this->teaser);
+                       return nl2br(StringUtil::encodeHTML($this->teaser), false);
                }
                else {
                        $htmlInputProcessor = new HtmlInputProcessor();
                        $htmlInputProcessor->processIntermediate($this->content);
-                       return StringUtil::encodeHTML(StringUtil::truncate($htmlInputProcessor->getTextContent(), 500));
+                       return nl2br(StringUtil::encodeHTML(StringUtil::truncate($htmlInputProcessor->getTextContent(), 500)), false);
                }
        }