mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-22 11:48:28 +00:00
ed5d67e609
To ensure consistenent behaviour before/after changes. Added tests to cover.
22 lines
473 B
PHP
22 lines
473 B
PHP
<?php
|
|
|
|
namespace BookStack\Entities\Models;
|
|
|
|
use BookStack\Util\HtmlContentFilter;
|
|
|
|
/**
|
|
* @property string $description
|
|
* @property string $description_html
|
|
*/
|
|
trait HasHtmlDescription
|
|
{
|
|
/**
|
|
* Get the HTML description for this book.
|
|
*/
|
|
public function descriptionHtml(): string
|
|
{
|
|
$html = $this->description_html ?: '<p>' . nl2br(e($this->description)) . '</p>';
|
|
return HtmlContentFilter::removeScriptsFromHtmlString($html);
|
|
}
|
|
}
|