mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-03-21 15:52:03 -04:00
* 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
75 lines
3.0 KiB
PHTML
Executable File
75 lines
3.0 KiB
PHTML
Executable File
<?php /** @var FreshRSS_View $this */ ?>
|
|
<?= '<?xml version="1.0" encoding="UTF-8" ?>'; ?>
|
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"
|
|
<?= $this->rss_base == '' ? '' : ' xml:base="' . $this->rss_base . '"' ?>
|
|
>
|
|
<channel>
|
|
<title><?= $this->rss_title ?></title>
|
|
<link><?= $this->internal_rendering ? $this->rss_url : Minz_Url::display('', 'html', true) ?></link>
|
|
<description><?= _t('index.feed.rss_of', $this->rss_title) ?></description>
|
|
<pubDate><?= date('D, d M Y H:i:s O') ?></pubDate>
|
|
<lastBuildDate><?= gmdate('D, d M Y H:i:s') ?> GMT</lastBuildDate>
|
|
<atom:link href="<?= $this->internal_rendering ? $this->rss_url :
|
|
Minz_Url::display($this->rss_url, 'html', true) ?>" rel="self" type="application/rss+xml" />
|
|
<?php
|
|
/** @var FreshRSS_Entry */
|
|
foreach ($this->entries as $item) {
|
|
if (!$this->internal_rendering) {
|
|
/** @var FreshRSS_Entry */
|
|
$item = Minz_ExtensionManager::callHook('entry_before_display', $item);
|
|
if ($item == null) {
|
|
continue;
|
|
}
|
|
}
|
|
?>
|
|
<item>
|
|
<title><?= $item->title() ?></title>
|
|
<link><?= $item->link() ?></link>
|
|
<?php
|
|
$authors = $item->authors();
|
|
if (is_array($authors)) {
|
|
foreach ($authors as $author) {
|
|
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";
|
|
}
|
|
}
|
|
$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']
|
|
. (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";
|
|
}
|
|
}
|
|
?>
|
|
<description><![CDATA[<?php
|
|
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>
|
|
</item>
|
|
<?php } ?>
|
|
|
|
</channel>
|
|
</rss>
|