article.phtml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. // used only in Reading view and html.phtml
  3. declare(strict_types=1);
  4. /** @var FreshRSS_View $this */
  5. $entry = $this->entry;
  6. $feed = $this->feed;
  7. if ($feed === null || $entry === null) {
  8. return;
  9. }
  10. ?>
  11. <article class="flux_content content_<?= FreshRSS_Context::userConf()->content_width ?>" dir="auto">
  12. <div class="content">
  13. <header>
  14. <?php
  15. $favoriteUrl = ['c' => 'entry', 'a' => 'bookmark', 'params' => ['id' => $entry->id()]];
  16. if ($entry->isFavorite()) {
  17. $favoriteUrl['params']['is_favorite'] = '0';
  18. }
  19. $readUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $entry->id()]];
  20. if ($entry->isRead()) {
  21. $readUrl['params']['is_read'] = '0';
  22. }
  23. ?>
  24. <div class="article-header-topline horizontal-list">
  25. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  26. <?php if (FreshRSS_Context::userConf()->topline_read && FreshRSS_Context::userConf()->show_article_icons == 't') { ?>
  27. <div class="item manage">
  28. <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($entry->isRead() ? 'read' : 'unread') ?></a>
  29. </div>
  30. <?php } ?>
  31. <?php if (FreshRSS_Context::userConf()->topline_favorite && FreshRSS_Context::userConf()->show_article_icons == 't') { ?>
  32. <div class="item manage">
  33. <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($entry->isFavorite() ? 'starred' : 'non-starred') ?></a>
  34. </div>
  35. <?php } ?>
  36. <?php } ?>
  37. <div class="item">
  38. <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
  39. <a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  40. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  41. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  42. endif; ?><span><?= $feed->name() ?></span></a>
  43. <?php } ?>
  44. </div>
  45. <?php
  46. if (FreshRSS_Context::userConf()->topline_link && FreshRSS_Context::userConf()->show_article_icons == 't') { ?>
  47. <div class="item link">
  48. <a target="_blank" rel="noreferrer" href="<?= $entry->link() ?>" class="item-element" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a>
  49. </div>
  50. <?php } ?>
  51. </div>
  52. <?php
  53. if (in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'h'], true)) {
  54. $this->renderHelper('index/tags');
  55. }
  56. ?>
  57. <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $entry->link() ?>"><?= $entry->title() ?></a></h1>
  58. <?php if (in_array(FreshRSS_Context::userConf()->show_author_date, ['h','b'], true)) { ?>
  59. <div class="subtitle horizontal-list">
  60. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  61. <?php if (FreshRSS_Context::userConf()->topline_read && FreshRSS_Context::userConf()->show_article_icons == 'a') { ?>
  62. <div class="item manage">
  63. <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($entry->isRead() ? 'read' : 'unread') ?></a>
  64. </div>
  65. <?php } ?>
  66. <?php if (FreshRSS_Context::userConf()->topline_favorite && FreshRSS_Context::userConf()->show_article_icons == 'a') { ?>
  67. <div class="item manage">
  68. <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($entry->isFavorite() ? 'starred' : 'non-starred') ?></a>
  69. </div>
  70. <?php } ?>
  71. <?php } ?>
  72. <div class="item">
  73. <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
  74. <span class="website"><a href="<?= $this->internal_rendering ? $feed->website() : _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  75. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  76. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  77. endif; ?><span><?= $feed->name() ?></span></a></span>
  78. <?php }
  79. if (!empty($entry->authors())) {
  80. $this->renderHelper('index/authors');
  81. if ($this->feed === null || $this->entry === null) {
  82. throw new Exception('Unexpected side effect!'); // Should never occur. Only for PHPStan
  83. }
  84. }
  85. ?>
  86. </div>
  87. <div class="item date">
  88. <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
  89. </div>
  90. <?php
  91. if (FreshRSS_Context::userConf()->topline_link && FreshRSS_Context::userConf()->show_article_icons == 'a') { ?>
  92. <div class="item link">
  93. <a target="_blank" rel="noreferrer" href="<?= $entry->link() ?>" class="item-element" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a>
  94. </div>
  95. <?php } ?>
  96. </div>
  97. <?php } ?>
  98. </header>
  99. <div class="text">
  100. <?= $entry->content(true) ?>
  101. </div>
  102. <?php
  103. $display_authors_date = in_array(FreshRSS_Context::userConf()->show_author_date, ['b', 'f'], true);
  104. $display_tags = in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'f'], true);
  105. if ($display_authors_date || $display_tags) {
  106. ?>
  107. <footer>
  108. <?php if ($display_authors_date) { ?>
  109. <div class="subtitle">
  110. <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
  111. <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  112. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  113. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  114. endif; ?><span><?= $feed->name() ?></span></a></div>
  115. <?php }
  116. $this->renderHelper('index/authors');
  117. ?>
  118. <div class="date">
  119. <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
  120. </div>
  121. </div>
  122. <?php
  123. }
  124. if ($display_tags) {
  125. $this->renderHelper('index/tags');
  126. }
  127. ?>
  128. </footer>
  129. <?php
  130. } ?>
  131. </div>
  132. <footer>
  133. <ul class="horizontal-list bottom">
  134. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  135. <?php if (FreshRSS_Context::userConf()->bottomline_read) { ?>
  136. <li class="item manage">
  137. <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($entry->isRead() ? 'read' : 'unread') ?></a>
  138. </li>
  139. <?php } ?>
  140. <?php if (FreshRSS_Context::userConf()->bottomline_favorite) { ?>
  141. <li class="item manage">
  142. <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($entry->isFavorite() ? 'starred' : 'non-starred') ?></a>
  143. </li>
  144. <?php } ?>
  145. <?php } ?>
  146. <li class="item share"></li>
  147. <?php
  148. if (FreshRSS_Context::userConf()->bottomline_date) {
  149. ?>
  150. <li class="item date">
  151. <time datetime="<?= $entry->machineReadableDate() ?>" class="item-element"><?= $entry->date() ?></time>&nbsp;
  152. </li>
  153. <?php
  154. }
  155. if (FreshRSS_Context::userConf()->bottomline_link) { ?>
  156. <li class="item link">
  157. <a target="_blank" rel="noreferrer" href="<?= $entry->link() ?>" class="item-element" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a>
  158. </li>
  159. <?php } ?>
  160. </ul>
  161. </footer>
  162. </article>