normal.phtml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. $display_today = true;
  10. $display_yesterday = true;
  11. $display_others = true;
  12. $hidePosts = !FreshRSS_Context::$user_conf->display_posts;
  13. $lazyload = FreshRSS_Context::$user_conf->lazyload;
  14. $content_width = FreshRSS_Context::$user_conf->content_width;
  15. $today = @strtotime('today');
  16. ?>
  17. <div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
  18. ?><div id="new-article">
  19. <a href="<?php echo Minz_Url::display(Minz_Request::currentRequest()); ?>"><?php echo _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  20. </div><?php
  21. foreach ($this->entries as $item) {
  22. $this->entry = Minz_ExtensionManager::callHook('entry_before_display', $item);
  23. if ($this->entry == null) {
  24. continue;
  25. }
  26. // We most likely already have the feed object in cache
  27. $this->feed = FreshRSS_CategoryDAO::findFeed($this->categories, $this->entry->feed());
  28. if ($this->feed == null) {
  29. $this->feed = $this->entry->feed(true);
  30. if ($this->feed == null) {
  31. $this->feed = FreshRSS_Feed::example();
  32. }
  33. }
  34. if ($display_today && $this->entry->isDay(FreshRSS_Days::TODAY, $today)) {
  35. ?><div class="day" id="day_today"><?php
  36. echo _t('gen.date.today');
  37. ?><span class="date"> — <?php echo timestamptodate(time(), false); ?></span><?php
  38. ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
  39. ?></div><?php
  40. $display_today = false;
  41. }
  42. if ($display_yesterday && $this->entry->isDay(FreshRSS_Days::YESTERDAY, $today)) {
  43. ?><div class="day" id="day_yesterday"><?php
  44. echo _t('gen.date.yesterday');
  45. ?><span class="date"> — <?php echo timestamptodate(time() - 86400, false); ?></span><?php
  46. ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
  47. ?></div><?php
  48. $display_yesterday = false;
  49. }
  50. if ($display_others && $this->entry->isDay(FreshRSS_Days::BEFORE_YESTERDAY, $today)) {
  51. ?><div class="day" id="day_before_yesterday"><?php
  52. echo _t('gen.date.before_yesterday');
  53. ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
  54. ?></div><?php
  55. $display_others = false;
  56. }
  57. ?><div class="flux<?php echo !$this->entry->isRead() ? ' not_read' : '';
  58. ?><?php echo $this->entry->isFavorite() ? ' favorite' : '';
  59. ?>" id="flux_<?php echo $this->entry->id();
  60. ?>" data-feed="<?php echo $this->feed->id();
  61. ?>"><?php
  62. $this->renderHelper('index/normal/entry_header');
  63. ?><div class="flux_content">
  64. <div class="content <?php echo $content_width; ?>">
  65. <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></h1>
  66. <div class="author"><?php
  67. $authors = $this->entry->authors();
  68. if (is_array($authors)):
  69. $first = true;
  70. foreach ($authors as $author):
  71. echo $first ? _t('gen.short.by_author') . ' ' : '· ';
  72. $first = false;
  73. ?>
  74. <em><a href="<?php echo _url('index', 'index', 'search', 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))); ?>"><?php echo $author; ?></a></em>
  75. <?php endforeach; ?>
  76. </div><?php
  77. endif;
  78. echo $lazyload && $hidePosts ? lazyimg($this->entry->content()) : $this->entry->content();
  79. ?>
  80. </div><?php
  81. $this->renderHelper('index/normal/entry_bottom');
  82. ?></div>
  83. </div><?php
  84. }
  85. $this->renderHelper('pagination');
  86. ?></div>
  87. <?php if (FreshRSS_Context::$user_conf->show_nav_buttons) $this->partial('nav_entries'); ?>
  88. <?php } else { ?>
  89. <div id="stream" class="prompt alert alert-warn normal">
  90. <h2><?php echo _t('index.feed.empty'); ?></h2>
  91. <a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('index.feed.add'); ?></a><br /><br />
  92. </div>
  93. <?php } ?>