1*572dd708SAndreas Gohr<?php 2*572dd708SAndreas Gohr 3*572dd708SAndreas Gohr/** 4*572dd708SAndreas Gohr * An HtmlDescribable is an item within a feed that can have a description that may 5*572dd708SAndreas Gohr * include HTML markup. 6*572dd708SAndreas Gohr */ 7*572dd708SAndreas Gohrclass HtmlDescribable 8*572dd708SAndreas Gohr{ 9*572dd708SAndreas Gohr /** 10*572dd708SAndreas Gohr * Indicates whether the description field should be rendered in HTML. 11*572dd708SAndreas Gohr */ 12*572dd708SAndreas Gohr public $descriptionHtmlSyndicated; 13*572dd708SAndreas Gohr 14*572dd708SAndreas Gohr /** 15*572dd708SAndreas Gohr * Indicates whether and to how many characters a description should be truncated. 16*572dd708SAndreas Gohr */ 17*572dd708SAndreas Gohr public $descriptionTruncSize; 18*572dd708SAndreas Gohr 19*572dd708SAndreas Gohr /** @var string the Description */ 20*572dd708SAndreas Gohr public $description; 21*572dd708SAndreas Gohr 22*572dd708SAndreas Gohr /** 23*572dd708SAndreas Gohr * Returns a formatted description field, depending on descriptionHtmlSyndicated and 24*572dd708SAndreas Gohr * $descriptionTruncSize properties 25*572dd708SAndreas Gohr * 26*572dd708SAndreas Gohr * @param bool $overrideSyndicateHtml 27*572dd708SAndreas Gohr * @return string the formatted description 28*572dd708SAndreas Gohr */ 29*572dd708SAndreas Gohr public function getDescription($overrideSyndicateHtml = false) 30*572dd708SAndreas Gohr { 31*572dd708SAndreas Gohr $descriptionField = new FeedHtmlField($this->description); 32*572dd708SAndreas Gohr $descriptionField->syndicateHtml = $overrideSyndicateHtml || $this->descriptionHtmlSyndicated; 33*572dd708SAndreas Gohr $descriptionField->truncSize = $this->descriptionTruncSize; 34*572dd708SAndreas Gohr 35*572dd708SAndreas Gohr return $descriptionField->output(); 36*572dd708SAndreas Gohr } 37*572dd708SAndreas Gohr} 38