reader.phtml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
  45. <span><?= $feed->name() ?></span>
  46. </a>
  47. <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $item->link() ?>"><?= $item->title() ?></a></h1>
  48. <div class="author"><?php
  49. $authors = $item->authors();
  50. if (is_array($authors)):
  51. $first = true;
  52. foreach ($authors as $author):
  53. echo $first ? _t('gen.short.by_author') . ' ' : '· ';
  54. $first = false;
  55. ?>
  56. <em><a href="<?= _url('index', 'index', 'search', 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))) ?>"><?= $author ?></a></em>
  57. <?php
  58. endforeach;
  59. echo ' — ';
  60. endif;
  61. ?><time datetime="<?= $item->machineReadableDate() ?>"><?= $item->date() ?></time></div><div class="text">
  62. <?= $item->content() ?>
  63. </div></div>
  64. </div>
  65. </div><?php
  66. endforeach;
  67. if ($nbEntries > 0):
  68. call_user_func($this->callbackBeforePagination, $this, $nbEntries, $lastEntry);
  69. $this->renderHelper('pagination');
  70. ?></div><?php
  71. else:
  72. ob_end_clean(); //Discard the articles headers, as we have no articles
  73. ?>
  74. <div id="stream" class="prompt alert alert-warn reader">
  75. <h2><?= _t('index.feed.empty') ?></h2>
  76. <a href="<?= _url('subscription', 'index') ?>"><?= _t('index.feed.add') ?></a><br /><br />
  77. </div>
  78. <?php endif; ?>