rss.phtml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php /** @var FreshRSS_View $this */ ?>
  2. <?= '<?xml version="1.0" encoding="UTF-8" ?>'; ?>
  3. <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/"
  4. <?= $this->rss_base == '' ? '' : ' xml:base="' . $this->rss_base . '"' ?>
  5. >
  6. <channel>
  7. <title><?= $this->rss_title ?></title>
  8. <link><?= $this->internal_rendering ? $this->rss_url : Minz_Url::display('', 'html', true) ?></link>
  9. <description><?= _t('index.feed.rss_of', $this->rss_title) ?></description>
  10. <pubDate><?= date('D, d M Y H:i:s O') ?></pubDate>
  11. <lastBuildDate><?= gmdate('D, d M Y H:i:s') ?> GMT</lastBuildDate>
  12. <atom:link href="<?= $this->internal_rendering ? $this->rss_url :
  13. Minz_Url::display($this->rss_url, 'html', true) ?>" rel="self" type="application/rss+xml" />
  14. <?php
  15. /** @var FreshRSS_Entry */
  16. foreach ($this->entries as $item) {
  17. if (!$this->internal_rendering) {
  18. /** @var FreshRSS_Entry */
  19. $item = Minz_ExtensionManager::callHook('entry_before_display', $item);
  20. if ($item == null) {
  21. continue;
  22. }
  23. }
  24. ?>
  25. <item>
  26. <title><?= $item->title() ?></title>
  27. <link><?= $item->link() ?></link>
  28. <?php
  29. $authors = $item->authors();
  30. if (is_array($authors)) {
  31. foreach ($authors as $author) {
  32. echo "\t\t\t" , '<dc:creator>', $author, '</dc:creator>', "\n";
  33. }
  34. }
  35. $categories = $item->tags();
  36. if (is_array($categories)) {
  37. foreach ($categories as $category) {
  38. echo "\t\t\t" , '<category>', $category, '</category>', "\n";
  39. }
  40. }
  41. $enclosures = $item->enclosures(false);
  42. if (is_array($enclosures)) {
  43. foreach ($enclosures as $enclosure) {
  44. // https://www.rssboard.org/media-rss
  45. echo "\t\t\t" , '<media:content url="' . $enclosure['url']
  46. . (empty($enclosure['medium']) ? '' : '" medium="' . $enclosure['medium'])
  47. . (empty($enclosure['type']) ? '' : '" type="' . $enclosure['type'])
  48. . (empty($enclosure['length']) ? '' : '" length="' . $enclosure['length'])
  49. . '"></media:content>', "\n";
  50. }
  51. }
  52. ?>
  53. <description><![CDATA[<?php
  54. echo $item->content();
  55. ?>]]></description>
  56. <pubDate><?= date('D, d M Y H:i:s O', $item->date(true)) ?></pubDate>
  57. <guid isPermaLink="false"><?= $item->id() > 0 ? $item->id() : $item->guid() ?></guid>
  58. </item>
  59. <?php } ?>
  60. </channel>
  61. </rss>