]> BookStack Code Mirror - bookstack/blob - app/Entities/Models/HasHtmlDescription.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / app / Entities / Models / HasHtmlDescription.php
1 <?php
2
3 namespace BookStack\Entities\Models;
4
5 use BookStack\Util\HtmlContentFilter;
6
7 /**
8  * @property string $description
9  * @property string $description_html
10  */
11 trait HasHtmlDescription
12 {
13     /**
14      * Get the HTML description for this book.
15      */
16     public function descriptionHtml(): string
17     {
18         $html = $this->description_html ?: '<p>' . nl2br(e($this->description)) . '</p>';
19         return HtmlContentFilter::removeScriptsFromHtmlString($html);
20     }
21 }