normal.phtml 3.3 KB

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