aboutsummaryrefslogtreecommitdiff
path: root/app/views/index/rss.phtml
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-01-06 19:53:43 +0100
committerGravatar GitHub <noreply@github.com> 2023-01-06 19:53:43 +0100
commit8f9c4143fcc133f28db4c3f618649fb1170e33b4 (patch)
treee41532df88fa10766ce7ad729e4c8b88f616ce27 /app/views/index/rss.phtml
parentaf8480651dea478e2a60dc13b9ea44d364d0f7b7 (diff)
Better enclosures (#4944)
* Better enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/4702 Improvement of https://github.com/FreshRSS/FreshRSS/pull/2898 * A few fixes * Better enclosure titles * Improve thumbnails * Implement thumbnail for HTML+XPath * Avoid duplicate enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/1668 * Fix regex * Add basic support for media:credit And use <figure> for enclosures * Fix link encoding + simplify code * Fix some SimplePie bugs Encoding errors in enclosure links * Remove debugging syslog * Remove debugging syslog * SimplePie fix multiple RSS2 enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/4974 * Improve thumbnails * Performance with yield Avoid generating all enclosures if not used * API keep providing enclosures inside content Clients are typically not showing the enclosures to the users (tested with News+, FeedMe, Readrops, Fluent Reader Lite) * Lint * Fix API output enclosure * Fix API content strcut * API tolerate enclosures without a type
Diffstat (limited to 'app/views/index/rss.phtml')
-rwxr-xr-xapp/views/index/rss.phtml22
1 files changed, 17 insertions, 5 deletions
diff --git a/app/views/index/rss.phtml b/app/views/index/rss.phtml
index 0b07a02f3..0b3dc7955 100755
--- a/app/views/index/rss.phtml
+++ b/app/views/index/rss.phtml
@@ -29,29 +29,41 @@ foreach ($this->entries as $item) {
$authors = $item->authors();
if (is_array($authors)) {
foreach ($authors as $author) {
- echo "\t\t\t" , '<dc:creator>', $author, '</dc:creator>', "\n";
+ echo "\t\t\t", '<dc:creator>', $author, '</dc:creator>', "\n";
}
}
$categories = $item->tags();
if (is_array($categories)) {
foreach ($categories as $category) {
- echo "\t\t\t" , '<category>', $category, '</category>', "\n";
+ echo "\t\t\t", '<category>', $category, '</category>', "\n";
}
}
+ $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['time']) ? '' : '" time="' . $thumbnail['time'])
+ . '" />', "\n";
+ }
$enclosures = $item->enclosures(false);
if (is_array($enclosures)) {
foreach ($enclosures as $enclosure) {
// https://www.rssboard.org/media-rss
- echo "\t\t\t" , '<media:content url="' . $enclosure['url']
+ 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'])
- . '"></media:content>', "\n";
+ . '">'
+ . (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
- echo $item->content();
+ echo $item->content(false);
?>]]></description>
<pubDate><?= date('D, d M Y H:i:s O', $item->date(true)) ?></pubDate>
<guid isPermaLink="false"><?= $item->id() > 0 ? $item->id() : $item->guid() ?></guid>