mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-22 11:44:39 +02:00
[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:
parent
14c689e7a3
commit
72f40fbd75
3 changed files with 44 additions and 15 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue