article.phtml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $entry = $this->entry;
  5. $feed = $this->feed;
  6. ?>
  7. <article class="flux_content" dir="auto">
  8. <div class="content <?= FreshRSS_Context::userConf()->content_width ?>">
  9. <header>
  10. <?php
  11. $favoriteUrl = ['c' => 'entry', 'a' => 'bookmark', 'params' => ['id' => $entry->id()]];
  12. if ($entry->isFavorite()) {
  13. $favoriteUrl['params']['is_favorite'] = 0;
  14. }
  15. $readUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $entry->id()]];
  16. if ($entry->isRead()) {
  17. $readUrl['params']['is_read'] = 0;
  18. }
  19. ?>
  20. <div class="article-header-topline">
  21. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  22. <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($entry->isRead() ? 'read' : 'unread') ?></a>
  23. <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($entry->isFavorite() ? 'starred' : 'non-starred') ?></a>
  24. <?php } ?>
  25. <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
  26. <a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  27. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  28. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  29. endif; ?><span><?= $feed->name() ?></span></a>
  30. <?php } ?>
  31. </div>
  32. <?php
  33. if (in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'h'], true)) {
  34. $this->renderHelper('index/tags');
  35. }
  36. ?>
  37. <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $entry->link() ?>"><?= $entry->title() ?></a></h1>
  38. <?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?>
  39. <div class="subtitle">
  40. <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
  41. <div class="website"><a href="<?= $this->internal_rendering ? $feed->website() : _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  42. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  43. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  44. endif; ?><span><?= $feed->name() ?></span></a></div>
  45. <?php } ?>
  46. <div class="author"><?php
  47. $authors = $entry->authors();
  48. if (is_array($authors)) {
  49. if ($this->internal_rendering):
  50. foreach ($authors as $author): ?>
  51. <?= $author ?>
  52. <?php endforeach;
  53. else:
  54. foreach ($authors as $author): ?>
  55. <a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>">
  56. <?= $author ?>
  57. </a>
  58. <?php endforeach;
  59. endif;
  60. } ?>
  61. </div>
  62. <div class="date">
  63. <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
  64. </div>
  65. </div>
  66. <?php } ?>
  67. </header>
  68. <div class="text">
  69. <?= $entry->content(true) ?>
  70. </div>
  71. <?php
  72. $display_authors_date = in_array(FreshRSS_Context::userConf()->show_author_date, ['b', 'f'], true);
  73. $display_tags = in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'f'], true);
  74. if ($display_authors_date || $display_tags) {
  75. ?>
  76. <footer>
  77. <?php if ($display_authors_date) { ?>
  78. <div class="subtitle">
  79. <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
  80. <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
  81. <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
  82. <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
  83. endif; ?><span><?= $feed->name() ?></span></a></div>
  84. <?php } ?>
  85. <div class="author"><?php
  86. $authors = $entry->authors();
  87. if (is_array($authors)) {
  88. foreach ($authors as $author) {
  89. ?>
  90. <a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>">
  91. <?= $author ?>
  92. </a>
  93. <?php
  94. }
  95. }
  96. ?>
  97. </div>
  98. <div class="date">
  99. <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
  100. </div>
  101. </div>
  102. <?php
  103. }
  104. if ($display_tags) {
  105. $this->renderHelper('index/tags');
  106. }
  107. ?>
  108. </footer>
  109. <?php
  110. } ?>
  111. </div>
  112. </article>