mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-31 07:09:34 +02:00
[formats] Fix enclosures
All bridges failed due to missing 'enclosures' element in the items array. With this commit all formats (ATOM, RSS and HTML) provide support for a single 'enclosure' element
This commit is contained in:
parent
3a2cb9ea1e
commit
42cbc2e889
3 changed files with 22 additions and 8 deletions
|
@ -30,9 +30,12 @@ class MrssFormat extends FormatAbstract {
|
|||
$itemUri = isset($item['uri']) ? $this->xml_encode($item['uri']) : '';
|
||||
$itemTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_RFC2822, $item['timestamp'])) : '';
|
||||
$itemContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : '';
|
||||
$entryEnclosures = "";
|
||||
foreach($item['enclosures'] as $enclosure)
|
||||
$entryEnclosures .= "<enclosure url=\"".$this->xml_encode($enclosure)."\"/>";
|
||||
|
||||
$entryEnclosure = '';
|
||||
if(isset($item['enclosure'])){
|
||||
$entryEnclosure = '<enclosure url="' . $this->xml_encode($item['enclosure']) . '"/>';
|
||||
}
|
||||
|
||||
$items .= <<<EOD
|
||||
|
||||
<item>
|
||||
|
@ -42,7 +45,7 @@ class MrssFormat extends FormatAbstract {
|
|||
<pubDate>{$itemTimestamp}</pubDate>
|
||||
<description>{$itemContent}</description>
|
||||
<author>{$itemAuthor}</author>
|
||||
{$entryEnclosures}
|
||||
{$entryEnclosure}
|
||||
</item>
|
||||
|
||||
EOD;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue