reader.phtml 2.8 KB

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