| 
									
										
										
										
											2023-12-17 23:02:15 +08:00
										 |  |  | <?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 | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2023-12-21 01:40:58 +08:00
										 |  |  |         $html = $this->description_html ?: '<p>' . nl2br(e($this->description)) . '</p>'; | 
					
						
							| 
									
										
										
										
											2023-12-17 23:02:15 +08:00
										 |  |  |         return HtmlContentFilter::removeScriptsFromHtmlString($html); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |