-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathRssEntry.php
22 lines (21 loc) · 1.06 KB
/
RssEntry.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?
use function Safe\filesize;
use function Safe\preg_replace;
/**
* @var Ebook $entry
*/
?>
<item>
<title><?= Formatter::EscapeXml($entry->Title) ?>, by <?= Formatter::EscapeXml(strip_tags($entry->AuthorsHtml)) ?></title>
<link><?= SITE_URL . Formatter::EscapeXml($entry->Url) ?></link>
<description><?= Formatter::EscapeXml($entry->Description) ?></description>
<pubDate><?= $entry->EbookCreated?->format(Enums\DateTimeFormat::Rss->value) ?></pubDate>
<guid><?= Formatter::EscapeXml(preg_replace('/^url:/ius', '', $entry->Identifier)) ?></guid>
<? foreach($entry->Tags as $tag){ ?>
<category domain="https://standardebooks.org/vocab/subjects"><?= Formatter::EscapeXml($tag->Name) ?></category>
<? } ?>
<media:thumbnail url="<?= SITE_URL . $entry->Url ?>/downloads/cover-thumbnail.jpg" height="525" width="350"/>
<? if($entry->EpubUrl !== null){ ?>
<enclosure url="<?= SITE_URL . Formatter::EscapeXml($entry->EpubUrl) ?>" length="<?= filesize(WEB_ROOT . $entry->EpubUrl) ?>" type="application/epub+zip" /> <? /* Only one <enclosure> is allowed */ ?>
<? } ?>
</item>