reader.phtml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. $this->partial('aside_feed');
  3. $this->partial('nav_menu');
  4. call_user_func($this->callbackBeforeEntries, $this);
  5. $lazyload = FreshRSS_Context::$user_conf->lazyload;
  6. $content_width = FreshRSS_Context::$user_conf->content_width;
  7. ?>
  8. <div id="stream" class="reader">
  9. <div id="new-article">
  10. <a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  11. </div><?php
  12. $lastEntry = null;
  13. $nbEntries = 0;
  14. foreach ($this->entries as $item):
  15. $lastEntry = $item;
  16. $nbEntries++;
  17. ob_flush();
  18. $item = Minz_ExtensionManager::callHook('entry_before_display', $item);
  19. if ($item == null) {
  20. continue;
  21. }
  22. ?><div class="flux<?= !$item->isRead() ? ' not_read' : '' ?><?= $item->isFavorite() ? ' favorite' : '' ?>" id="flux_<?= $item->id() ?>">
  23. <div class="flux_content" dir="auto">
  24. <div class="content <?= $content_width ?>">
  25. <?php
  26. $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feed()); //We most likely already have the feed object in cache
  27. if (empty($feed)) $feed = $item->feed(true);
  28. $favoriteUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id()));
  29. if ($item->isFavorite()) {
  30. $favoriteUrl['params']['is_favorite'] = 0;
  31. }
  32. $readUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id()));
  33. if ($item->isRead()) {
  34. $readUrl['params']['is_read'] = 0;
  35. }
  36. ?>
  37. <a class="read" href="<?= Minz_Url::display($readUrl) ?>">
  38. <?= _i($item->isRead() ? 'read' : 'unread') ?>
  39. </a>
  40. <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>">
  41. <?= _i($item->isFavorite() ? 'starred' : 'non-starred') ?>
  42. </a>
  43. <a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>">
  44. <?php if (FreshRSS_Context::$user_conf->show_favicons): ?>
  45. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" />
  46. <?php endif; ?>
  47. <span><?= $feed->name() ?></span>
  48. </a>
  49. <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $item->link() ?>"><?= $item->title() ?></a></h1>
  50. <div class="author"><?php
  51. $authors = $item->authors();
  52. if (is_array($authors)):
  53. $first = true;
  54. foreach ($authors as $author):
  55. echo $first ? _t('gen.short.by_author') . ' ' : '· ';
  56. $first = false;
  57. ?>
  58. <em><a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(
  59. ['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])
  60. ) ?>"><?= $author ?></a></em>
  61. <?php
  62. endforeach;
  63. echo ' — ';
  64. endif;
  65. ?><time datetime="<?= $item->machineReadableDate() ?>"><?= $item->date() ?></time></div><div class="text">
  66. <?= $item->content() ?>
  67. </div></div>
  68. </div>
  69. </div><?php
  70. endforeach;
  71. if ($nbEntries > 0):
  72. call_user_func($this->callbackBeforePagination, $this, $nbEntries, $lastEntry);
  73. $this->renderHelper('pagination');
  74. ?></div><?php
  75. else:
  76. ob_end_clean(); //Discard the articles headers, as we have no articles
  77. ?>
  78. <div id="stream" class="prompt alert alert-warn reader">
  79. <h2><?= _t('index.feed.empty') ?></h2>
  80. <a href="<?= _url('subscription', 'index') ?>"><?= _t('index.feed.add') ?></a><br /><br />
  81. </div>
  82. <?php endif; ?>