reader.phtml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. $this->partial('aside_feed');
  3. $this->partial('nav_menu');
  4. if (!empty($this->entries)) {
  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="<?php echo Minz_Url::display(Minz_Request::currentRequest()); ?>"><?php echo _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  11. </div>
  12. <?php 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 class="website" 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 } ?>