reader.phtml 3.2 KB

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