article.phtml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. ?>
  8. <article class="flux_content" dir="auto">
  9. <div class="content <?= FreshRSS_Context::userConf()->content_width ?>">
  10. <header>
  11. <?php
  12. $favoriteUrl = ['c' => 'entry', 'a' => 'bookmark', 'params' => ['id' => $entry->id()]];
  13. if ($entry->isFavorite()) {
  14. $favoriteUrl['params']['is_favorite'] = '0';
  15. }
  16. $readUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $entry->id()]];
  17. if ($entry->isRead()) {
  18. $readUrl['params']['is_read'] = '0';
  19. }
  20. ?>
  21. <div class="article-header-topline horizontal-list">
  22. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  23. <?php if (FreshRSS_Context::userConf()->topline_read && FreshRSS_Context::userConf()->show_article_icons == 't') { ?>
  24. <div class="item manage">
  25. <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($entry->isRead() ? 'read' : 'unread') ?></a>
  26. </div>
  27. <?php } ?>
  28. <?php if (FreshRSS_Context::userConf()->topline_favorite && FreshRSS_Context::userConf()->show_article_icons == 't') { ?>
  29. <div class="item manage">
  30. <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($entry->isFavorite() ? 'starred' : 'non-starred') ?></a>
  31. </div>
  32. <?php } ?>
  33. <?php } ?>
  34. <div class="item">
  35. <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
  36. <a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  37. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  38. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  39. endif; ?><span><?= $feed->name() ?></span></a>
  40. <?php } ?>
  41. </div>
  42. <?php
  43. if (FreshRSS_Context::userConf()->topline_link && FreshRSS_Context::userConf()->show_article_icons == 't') { ?>
  44. <div class="item link">
  45. <a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a>
  46. </div>
  47. <?php } ?>
  48. </div>
  49. <?php
  50. if (in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'h'], true)) {
  51. $this->renderHelper('index/tags');
  52. }
  53. ?>
  54. <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $entry->link() ?>"><?= $entry->title() ?></a></h1>
  55. <?php if (in_array(FreshRSS_Context::userConf()->show_author_date, ['h','b'], true)) { ?>
  56. <div class="subtitle horizontal-list">
  57. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  58. <?php if (FreshRSS_Context::userConf()->topline_read && FreshRSS_Context::userConf()->show_article_icons == 'a') { ?>
  59. <div class="item manage">
  60. <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($entry->isRead() ? 'read' : 'unread') ?></a>
  61. </div>
  62. <?php } ?>
  63. <?php if (FreshRSS_Context::userConf()->topline_favorite && FreshRSS_Context::userConf()->show_article_icons == 'a') { ?>
  64. <div class="item manage">
  65. <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($entry->isFavorite() ? 'starred' : 'non-starred') ?></a>
  66. </div>
  67. <?php } ?>
  68. <?php } ?>
  69. <div class="item">
  70. <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
  71. <span class="website"><a href="<?= $this->internal_rendering ? $feed->website() : _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  72. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  73. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  74. endif; ?><span><?= $feed->name() ?></span></a></span>
  75. <?php }
  76. $authors = $entry->authors();
  77. if (!empty($authors) && is_array($authors)) { ?>
  78. <div class="author">
  79. <?= _t('gen.short.by_author') ?>
  80. <?php
  81. foreach ($authors as $author) {
  82. $href = Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:"' . htmlspecialchars_decode($author, ENT_QUOTES) . '"']));
  83. ?>
  84. <a href="<?= $href ?>" title="<?= _t('gen.action.filter') ?>"><?= $author ?></a>
  85. <?php } ?>
  86. </div>
  87. <?php } ?>
  88. </div>
  89. <div class="item date">
  90. <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
  91. </div>
  92. <?php
  93. if (FreshRSS_Context::userConf()->topline_link && FreshRSS_Context::userConf()->show_article_icons == 'a') { ?>
  94. <div class="item link">
  95. <a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a>
  96. </div>
  97. <?php } ?>
  98. </div>
  99. <?php } ?>
  100. </header>
  101. <div class="text">
  102. <?= $entry->content(true) ?>
  103. </div>
  104. <?php
  105. $display_authors_date = in_array(FreshRSS_Context::userConf()->show_author_date, ['b', 'f'], true);
  106. $display_tags = in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'f'], true);
  107. if ($display_authors_date || $display_tags) {
  108. ?>
  109. <footer>
  110. <?php if ($display_authors_date) { ?>
  111. <div class="subtitle">
  112. <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
  113. <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  114. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  115. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  116. endif; ?><span><?= $feed->name() ?></span></a></div>
  117. <?php } ?>
  118. <div class="author"><?php
  119. $authors = $entry->authors();
  120. if (is_array($authors)) {
  121. foreach ($authors as $author) {
  122. ?>
  123. <a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>">
  124. <?= $author ?>
  125. </a>
  126. <?php
  127. }
  128. }
  129. ?>
  130. </div>
  131. <div class="date">
  132. <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
  133. </div>
  134. </div>
  135. <?php
  136. }
  137. if ($display_tags) {
  138. $this->renderHelper('index/tags');
  139. }
  140. ?>
  141. </footer>
  142. <?php
  143. } ?>
  144. </div>
  145. </article>