|
|
@@ -41,28 +41,38 @@ foreach ($this->entries as $item) {
|
|
|
echo "\t\t\t", '<category>', $category, '</category>', "\n";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ $enclosures = iterator_to_array($item->enclosures(false));
|
|
|
$thumbnail = $item->thumbnail(false);
|
|
|
if (!empty($thumbnail['url'])) {
|
|
|
// https://www.rssboard.org/media-rss#media-thumbnails
|
|
|
echo "\t\t\t", '<media:thumbnail url="' . $thumbnail['url']
|
|
|
. (empty($thumbnail['width']) ? '' : '" width="' . $thumbnail['width'])
|
|
|
. (empty($thumbnail['height']) ? '' : '" height="' . $thumbnail['height'])
|
|
|
- . (empty($thumbnail['type']) ? '' : '" type="' . $thumbnail['type'])
|
|
|
+ . (empty($thumbnail['time']) ? '' : '" time="' . $thumbnail['time'])
|
|
|
. '" />', "\n";
|
|
|
+ // Mostly for MailChimp + Feedbro which do not support <media:thumbnail> https://mailchimp.com/help/rss-merge-tags/
|
|
|
+ $thumbnail['medium'] ??= 'image';
|
|
|
+ array_unshift($enclosures, $thumbnail);
|
|
|
}
|
|
|
- $enclosures = $item->enclosures(false);
|
|
|
- if (is_iterable($enclosures)) {
|
|
|
- foreach ($enclosures as $enclosure) {
|
|
|
- // https://www.rssboard.org/media-rss
|
|
|
- echo "\t\t\t", '<media:content url="' . $enclosure['url']
|
|
|
- . (empty($enclosure['medium']) ? '' : '" medium="' . $enclosure['medium'])
|
|
|
- . (empty($enclosure['type']) ? '' : '" type="' . $enclosure['type'])
|
|
|
- . (empty($enclosure['length']) ? '' : '" length="' . $enclosure['length'])
|
|
|
- . '">'
|
|
|
- . (empty($enclosure['title']) ? '' : '<media:title type="html">' . $enclosure['title'] . '</media:title>')
|
|
|
- . (empty($enclosure['credit']) ? '' : '<media:credit>' . $enclosure['credit'] . '</media:credit>')
|
|
|
- . '</media:content>', "\n";
|
|
|
+
|
|
|
+ $urls = [];
|
|
|
+ foreach ($enclosures as $enclosure) {
|
|
|
+ if (empty($enclosure['url']) || isset($urls[$enclosure['url']])) {
|
|
|
+ continue;
|
|
|
}
|
|
|
+ $urls[$enclosure['url']] = true;
|
|
|
+ // https://www.rssboard.org/media-rss
|
|
|
+ echo "\t\t\t", '<media:content url="' . $enclosure['url']
|
|
|
+ . (empty($enclosure['medium']) ? '' : '" medium="' . $enclosure['medium'])
|
|
|
+ . (empty($enclosure['type']) ? '' : '" type="' . $enclosure['type'])
|
|
|
+ . (empty($enclosure['length']) ? '' : '" length="' . $enclosure['length'])
|
|
|
+ . (empty($enclosure['height']) ? '' : '" height="' . $enclosure['height'])
|
|
|
+ . (empty($enclosure['width']) ? '' : '" width="' . $enclosure['width'])
|
|
|
+ . '">'
|
|
|
+ . (empty($enclosure['title']) ? '' : '<media:title type="html">' . $enclosure['title'] . '</media:title>')
|
|
|
+ . (empty($enclosure['credit']) ? '' : '<media:credit>' . $enclosure['credit'] . '</media:credit>')
|
|
|
+ . '</media:content>', "\n";
|
|
|
}
|
|
|
?>
|
|
|
<description><![CDATA[<?php
|