1
0
Fork 0
forked from blallo/rss-bridge

Merge pull request #427 from mro/feature/enclosure

Revive enclosures.
This commit is contained in:
Teromene 2016-11-08 21:24:44 +00:00 committed by GitHub
commit 51e9298a2b
2 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,9 @@ class AtomFormat extends FormatAbstract{
$entryUri = isset($item['uri']) ? $this->xml_encode($item['uri']) : ''; $entryUri = isset($item['uri']) ? $this->xml_encode($item['uri']) : '';
$entryTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_ATOM, $item['timestamp'])) : ''; $entryTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_ATOM, $item['timestamp'])) : '';
$entryContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : ''; $entryContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : '';
$entryEnclosures = "";
foreach($item['enclosures'] as $enclosure)
$entryEnclosures .= "<link rel=\"enclosure\" href=\"".$this->xml_encode($enclosure)."\"/>";
$entries .= <<<EOD $entries .= <<<EOD
<entry> <entry>
@ -37,6 +40,7 @@ class AtomFormat extends FormatAbstract{
<id>{$entryUri}</id> <id>{$entryUri}</id>
<updated>{$entryTimestamp}</updated> <updated>{$entryTimestamp}</updated>
<content type="html">{$entryContent}</content> <content type="html">{$entryContent}</content>
{$entryEnclosures}
</entry> </entry>
EOD; EOD;

View file

@ -30,6 +30,9 @@ class MrssFormat extends FormatAbstract {
$itemUri = isset($item['uri']) ? $this->xml_encode($item['uri']) : ''; $itemUri = isset($item['uri']) ? $this->xml_encode($item['uri']) : '';
$itemTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_RFC2822, $item['timestamp'])) : ''; $itemTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_RFC2822, $item['timestamp'])) : '';
$itemContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : ''; $itemContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : '';
$entryEnclosures = "";
foreach($item['enclosures'] as $enclosure)
$entryEnclosures .= "<enclosure url=\"".xml_encode($enclosure)."\"/>";
$items .= <<<EOD $items .= <<<EOD
<item> <item>
@ -39,6 +42,7 @@ class MrssFormat extends FormatAbstract {
<pubDate>{$itemTimestamp}</pubDate> <pubDate>{$itemTimestamp}</pubDate>
<description>{$itemContent}</description> <description>{$itemContent}</description>
<author>{$itemAuthor}</author> <author>{$itemAuthor}</author>
{$entryEnclosures}
</item> </item>
EOD; EOD;