forked from blallo/rss-bridge
Merge branch 'MultipleEnclosures' of https://github.com/logmanoriginal/rss-bridge
This commit is contained in:
commit
5edba3a1aa
4 changed files with 52 additions and 16 deletions
|
@ -70,12 +70,19 @@ a.backlink, a.backlink:link, a.backlink:visited, a.itemtitle, a.itemtitle:link,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
section > div.content {
|
section > div.content, section > div.attachments {
|
||||||
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
section > div.attachments > li.enclosure {
|
||||||
|
|
||||||
|
list-style-type: circle;
|
||||||
|
list-style-position: inside;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
section > time, section > p.author {
|
section > time, section > p.author {
|
||||||
|
|
||||||
color: #888;
|
color: #888;
|
||||||
|
|
|
@ -27,9 +27,14 @@ class AtomFormat extends FormatAbstract{
|
||||||
$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'])) : '';
|
||||||
|
|
||||||
$entryEnclosure = '';
|
$entryEnclosures = '';
|
||||||
if(isset($item['enclosure'])){
|
if(isset($item['enclosures'])){
|
||||||
$entryEnclosure = '<link rel="enclosure" href="' . $this->xml_encode($item['enclosure']) . '"/>';
|
foreach($item['enclosures'] as $enclosure){
|
||||||
|
$entryEnclosures .= '<link rel="enclosure" href="'
|
||||||
|
. $this->xml_encode($enclosure)
|
||||||
|
. '"/>'
|
||||||
|
. PHP_EOL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$entries .= <<<EOD
|
$entries .= <<<EOD
|
||||||
|
@ -43,7 +48,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>
|
||||||
{$entryEnclosure}
|
{$entryEnclosures}
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
EOD;
|
EOD;
|
||||||
|
|
|
@ -30,11 +30,21 @@ class HtmlFormat extends FormatAbstract {
|
||||||
. '</div>';
|
. '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$entryEnclosure = '';
|
$entryEnclosures = '';
|
||||||
if(isset($item['enclosure'])){
|
if(isset($item['enclosures'])){
|
||||||
$entryEnclosure = '<div class="enclosure"><a href="'
|
$entryEnclosures = '<div class="attachments"><p>Attachments:</p>';
|
||||||
. $this->sanitizeHtml($item['enclosure'])
|
|
||||||
. '">enclosure</a><div>';
|
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
|
$entries .= <<<EOD
|
||||||
|
@ -44,7 +54,7 @@ class HtmlFormat extends FormatAbstract {
|
||||||
{$entryTimestamp}
|
{$entryTimestamp}
|
||||||
{$entryAuthor}
|
{$entryAuthor}
|
||||||
{$entryContent}
|
{$entryContent}
|
||||||
{$entryEnclosure}
|
{$entryEnclosures}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
EOD;
|
EOD;
|
||||||
|
|
|
@ -31,9 +31,23 @@ class MrssFormat extends FormatAbstract {
|
||||||
$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'])) : '';
|
||||||
|
|
||||||
$entryEnclosure = '';
|
$entryEnclosuresWarning = '';
|
||||||
if(isset($item['enclosure'])){
|
$entryEnclosures = '';
|
||||||
$entryEnclosure = '<enclosure url="' . $this->xml_encode($item['enclosure']) . '"/>';
|
if(isset($item['enclosures'])){
|
||||||
|
$entryEnclosures .= '<enclosure url="'
|
||||||
|
. $this->xml_encode($item['enclosures'][0])
|
||||||
|
. '"/>';
|
||||||
|
|
||||||
|
if(count($item['enclosures']) > 1){
|
||||||
|
$entryEnclosures .= PHP_EOL;
|
||||||
|
$entryEnclosuresWarning = '<br>Warning:
|
||||||
|
Some media files might not be shown to you. Consider using the ATOM format instead!';
|
||||||
|
foreach($item['enclosures'] as $enclosure){
|
||||||
|
$entryEnclosures .= '<atom:link rel="enclosure" href="'
|
||||||
|
. $enclosure . '" />'
|
||||||
|
. PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$items .= <<<EOD
|
$items .= <<<EOD
|
||||||
|
@ -43,9 +57,9 @@ class MrssFormat extends FormatAbstract {
|
||||||
<link>{$itemUri}</link>
|
<link>{$itemUri}</link>
|
||||||
<guid isPermaLink="true">{$itemUri}</guid>
|
<guid isPermaLink="true">{$itemUri}</guid>
|
||||||
<pubDate>{$itemTimestamp}</pubDate>
|
<pubDate>{$itemTimestamp}</pubDate>
|
||||||
<description>{$itemContent}</description>
|
<description>{$itemContent}{$entryEnclosuresWarning}</description>
|
||||||
<author>{$itemAuthor}</author>
|
<author>{$itemAuthor}</author>
|
||||||
{$entryEnclosure}
|
{$entryEnclosures}
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
EOD;
|
EOD;
|
||||||
|
|
Loading…
Reference in a new issue