reader.phtml 3.0 KB

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