This repository was archived by the owner on Jun 9, 2022. It is now read-only.
forked from getkirby-v2/feed-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
40 lines (36 loc) · 2.1 KB
/
template.php
File metadata and controls
40 lines (36 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!-- generator="<?php echo $generator ?>" -->
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><?php echo Xml::encode($title) ?></title>
<link><?php echo Xml::encode($link) ?></link>
<language><?= $languagecode ?></language>
<generator><?php echo c::get('feed.generator', 'Kirby') ?></generator>
<lastBuildDate><?php echo date('r', $modified) ?></lastBuildDate>
<atom:link href="<?php echo Xml::encode($url) ?>" rel="self" type="application/rss+xml" />
<?php if(!empty($description)): ?>
<description><?php echo Xml::encode($description) ?></description>
<?php endif ?>
<?php foreach($items as $item): ?>
<item>
<title><?php echo Xml::encode($item->title()) ?></title>
<link><?php echo Xml::encode($item->url()) ?></link>
<guid><?php echo Xml::encode($item->url()) ?></guid>
<pubDate><?php echo $datefield == 'modified' ? $item->modified('r') : $item->$datefield()->toDate('r') ?></pubDate>
<?php if (!empty($creatorfield)) : ?>
<dc:creator><?= Xml::encode($item->{$creatorfield}()) ?></dc:creator>
<?php endif ?>
<?php if (!empty($enclosurefield) && '' != $item->{$enclosurefield}()) : ?>
<?php if ($enclosureFile = $item->{$enclosurefield}()->toFile()) : ?>
<enclosure url="<?= Xml::encode($enclosureFile->url()) ?>" length="<?= Xml::encode($enclosureFile->size()) ?>" type="<?= Xml::encode($enclosureFile->mime()) ?>" />
<?php endif ?>
<?php endif ?>
<?php if ($itemdescriptionoverride !== false): ?>
<description><![CDATA[<?php echo ($itemdescriptionoverride ? $itemdescriptionoverride($item) : $item->{$descriptionfield}()->kti()) ?>]]></description>
<?php endif ?>
<?php if ($itemtextoverride !== false): ?>
<content><![CDATA[<?php echo ($itemtextoverride ? $itemtextoverride($item) : $item->{$textfield}()->kirbytext()) ?>]]></content>
<?php endif ?>
</item>
<?php endforeach ?>
</channel>
</rss>