Files
FreshRSS/app/views/index/rss.phtml
Alexandre Alapetite 1fe66ad020 Implement Web scraping "HTML + XPath" (#4220)
* More PHP type hints for Fever
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4201
Related to https://github.com/FreshRSS/FreshRSS/issues/4200

* Detail

* Draft

* Progress

* More draft

* Fix thumbnail PHP type hint
https://github.com/FreshRSS/FreshRSS/issues/4215

* More types

* A bit more

* Refactor FreshRSS_Entry::fromArray

* Progress

* Starts to work

* Categories

* Fonctional

* Layout update

* Fix relative URLs

* Cache system

* Forgotten files

* Remove a debug line

* Automatic form validation of XPath expressions

* data-leave-validation

* Fix reload action

* Simpler examples

* Fix column type for PostgreSQL

* Enforce HTTP encoding

* Readme

* Fix get full content

* target="_blank"

* gitignore

* htmlspecialchars_utf8

* Implement HTML <base>
And fix/revert `xml:base` support in SimplePie e49c578817

* SimplePie upstream PR merged
https://github.com/simplepie/simplepie/pull/723
2022-02-28 20:22:43 +01:00

63 lines
2.3 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";
}
}
$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'])
. '"></media:content>', "\n";
}
}
?>
<description><![CDATA[<?php
echo $item->content();
?>]]></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>