mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-24 12:45:05 +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
|
@ -27,9 +27,14 @@ class AtomFormat extends FormatAbstract{
|
|||
$entryTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_ATOM, $item['timestamp'])) : '';
|
||||
$entryContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : '';
|
||||
|
||||
$entryEnclosure = '';
|
||||
if(isset($item['enclosure'])){
|
||||
$entryEnclosure = '<link rel="enclosure" href="' . $this->xml_encode($item['enclosure']) . '"/>';
|
||||
$entryEnclosures = '';
|
||||
if(isset($item['enclosures'])){
|
||||
foreach($item['enclosures'] as $enclosure){
|
||||
$entryEnclosures .= '<link rel="enclosure" href="'
|
||||
. $this->xml_encode($enclosure)
|
||||
. '"/>'
|
||||
. PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
$entries .= <<<EOD
|
||||
|
@ -43,7 +48,7 @@ class AtomFormat extends FormatAbstract{
|
|||
<id>{$entryUri}</id>
|
||||
<updated>{$entryTimestamp}</updated>
|
||||
<content type="html">{$entryContent}</content>
|
||||
{$entryEnclosure}
|
||||
{$entryEnclosures}
|
||||
</entry>
|
||||
|
||||
EOD;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue