[formats] Allow multiple enclosures

All formats now support multiple enclosures. RSS
will show a warning if more than one enclosure
is used since many feed reader don't support
multiple enclosures with RSS (also not clearly
specified in the specification)
This commit is contained in:
logmanoriginal 2016-11-12 22:04:42 +01:00
parent 14c689e7a3
commit 72f40fbd75
3 changed files with 44 additions and 15 deletions

View file

@ -30,11 +30,21 @@ class HtmlFormat extends FormatAbstract {
. '</div>';
}
$entryEnclosure = '';
if(isset($item['enclosure'])){
$entryEnclosure = '<div class="enclosure"><a href="'
. $this->sanitizeHtml($item['enclosure'])
. '">enclosure</a><div>';
$entryEnclosures = '';
if(isset($item['enclosures'])){
$entryEnclosures = '<div class="attachments"><p>Attachments:</p>';
foreach($item['enclosures'] as $enclosure){
$url = $this->sanitizeHtml($enclosure);
$entryEnclosures .= '<li class="enclosure"><a href="'
. $url
. '">'
. substr($url, strrpos($url, '/') + 1)
. '</a></li>';
}
$entryEnclosures .= '</div>';
}
$entries .= <<<EOD
@ -44,7 +54,7 @@ class HtmlFormat extends FormatAbstract {
{$entryTimestamp}
{$entryAuthor}
{$entryContent}
{$entryEnclosure}
{$entryEnclosures}
</section>
EOD;