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 Gohr * @package de.bitfolge.feedcreator 8*572dd708SAndreas Gohr */ 9*572dd708SAndreas Gohrclass HtmlDescribable 10*572dd708SAndreas Gohr{ 11*572dd708SAndreas Gohr /** 12*572dd708SAndreas Gohr * Indicates whether the description field should be rendered in HTML. 13*572dd708SAndreas Gohr */ 14*572dd708SAndreas Gohr public $descriptionHtmlSyndicated; 15*572dd708SAndreas Gohr 16*572dd708SAndreas Gohr /** 17*572dd708SAndreas Gohr * Indicates whether and to how many characters a description should be truncated. 18*572dd708SAndreas Gohr */ 19*572dd708SAndreas Gohr public $descriptionTruncSize; 20*572dd708SAndreas Gohr 21*572dd708SAndreas Gohr /** @var string the Description */ 22*572dd708SAndreas Gohr public $description; 23*572dd708SAndreas Gohr 24*572dd708SAndreas Gohr /** 25*572dd708SAndreas Gohr * Returns a formatted description field, depending on descriptionHtmlSyndicated and 26*572dd708SAndreas Gohr * $descriptionTruncSize properties 27*572dd708SAndreas Gohr * 28*572dd708SAndreas Gohr * @param bool $overrideSyndicateHtml 29*572dd708SAndreas Gohr * @return string the formatted description 30*572dd708SAndreas Gohr */ 31*572dd708SAndreas Gohr public function getDescription($overrideSyndicateHtml = false) 32*572dd708SAndreas Gohr { 33*572dd708SAndreas Gohr $descriptionField = new FeedHtmlField($this->description); 34*572dd708SAndreas Gohr $descriptionField->syndicateHtml = $overrideSyndicateHtml || $this->descriptionHtmlSyndicated; 35*572dd708SAndreas Gohr $descriptionField->truncSize = $this->descriptionTruncSize; 36*572dd708SAndreas Gohr 37*572dd708SAndreas Gohr return $descriptionField->output(); 38*572dd708SAndreas Gohr } 39*572dd708SAndreas Gohr} 40