reader.phtml 2.8 KB

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