entry_header.phtml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $topline_read = FreshRSS_Context::userConf()->topline_read;
  5. $topline_favorite = FreshRSS_Context::userConf()->topline_favorite;
  6. $topline_myLabels = FreshRSS_Context::userConf()->topline_myLabels;
  7. $topline_sharing = FreshRSS_Context::userConf()->topline_sharing && count(FreshRSS_Context::userConf()->sharing) > 0;
  8. $topline_website = FreshRSS_Context::userConf()->topline_website;
  9. $topline_thumbnail = FreshRSS_Context::userConf()->topline_thumbnail;
  10. $topline_summary = FreshRSS_Context::userConf()->topline_summary;
  11. $topline_display_authors = FreshRSS_Context::userConf()->topline_display_authors;
  12. $topline_date = FreshRSS_Context::userConf()->topline_date;
  13. $topline_link = FreshRSS_Context::userConf()->topline_link;
  14. $title_opens_website = FreshRSS_Context::userConf()->title_opens_website;
  15. $lazyload = FreshRSS_Context::userConf()->lazyload;
  16. $headerClasses = ['horizontal-list', 'flux_header', 'website' . $topline_website];
  17. if ($topline_thumbnail !== 'none') {
  18. $headerClasses[] = 'has-thumbnail';
  19. }
  20. if ($topline_summary) {
  21. $headerClasses[] = 'has-summary';
  22. }
  23. if ($topline_date) {
  24. $headerClasses[] = 'has-date';
  25. }
  26. if ($this->feed === null || $this->entry === null) {
  27. return;
  28. }
  29. ?><ul class="<?= implode(' ', $headerClasses) ?>" data-website-name="<?= $this->feed->name() ?>" data-article-authors="<?= implode(' · ', $this->entry->authors()) ?>"><?php
  30. if (FreshRSS_Auth::hasAccess()) {
  31. if ($topline_read) {
  32. ?><li class="item manage"><?php
  33. $arUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $this->entry->id()]];
  34. if ($this->entry->isRead()) {
  35. $arUrl['params']['is_read'] = '0';
  36. }
  37. ?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?=
  38. _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
  39. ?></li><?php
  40. }
  41. if ($topline_favorite) {
  42. ?><li class="item manage"><?php
  43. $arUrl = ['c' => 'entry', 'a' => 'bookmark', 'params' => ['id' => $this->entry->id()]];
  44. if ($this->entry->isFavorite()) {
  45. $arUrl['params']['is_favorite'] = '0';
  46. }
  47. ?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?=
  48. _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
  49. ?></li><?php
  50. }
  51. }
  52. if ($topline_website !== 'none'):
  53. ?><li class="item website">
  54. <a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" class="item-element" title="<?= _t('gen.action.filter') ?>: <?= $this->feed->name() ?>">
  55. <?php if (FreshRSS_Context::userConf()->show_favicons && 'name' !== $topline_website): ?><img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><?php if ('icon' !== $topline_website): ?><span class="websiteName"><?= $this->feed->name() ?></span><?php endif; ?>
  56. </a>
  57. </li><?php
  58. endif; ?>
  59. <?php
  60. if ($topline_thumbnail !== 'none'):
  61. ?><li class="item thumbnail <?= $topline_thumbnail ?> <?= $topline_summary ? '' : 'small' ?>"><?php
  62. $thumbnail = $this->entry->thumbnail();
  63. if ($thumbnail != null):
  64. ?><img src="<?= $thumbnail['url'] ?>" class="item-element "<?= $lazyload ? ' loading="lazy"' : '' ?> alt="" /><?php
  65. endif;
  66. ?></li><?php
  67. endif; ?>
  68. <li class="item titleAuthorSummaryDate">
  69. <a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element title" dir="auto"><?= $this->entry->title() ?><?php
  70. if ($topline_display_authors):
  71. ?> <span class="author"><?= implode(' · ', $this->entry->authors()) ?></span><?php
  72. endif;
  73. ?></a>
  74. <?php
  75. if ($topline_summary):
  76. ?><div class="summary"><?= trim(mb_substr(strip_tags($this->entry->content(false)), 0, 500, 'UTF-8')) ?></div><?php
  77. endif; ?>
  78. <?php if ($topline_date) { ?><span class="item-element date"><time datetime="<?= $this->entry->machineReadableDate() ?>"><?= $this->entry->date() ?></time>&nbsp;</span><?php } ?>
  79. </li>
  80. <?php if ($topline_myLabels) { ?>
  81. <li class="item labels">
  82. <div class="item-element dropdown dynamictags">
  83. <div id="dropdown-labels2-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  84. <a class="dropdown-toggle" href="#dropdown-labels2-<?= $this->entry->id() ?>" title="<?= _t('index.menu.mylabels') ?>">
  85. <?= _i('label') ?>
  86. </a>
  87. <?php /* labels_article_template */ ?>
  88. </div>
  89. </li>
  90. <?php } ?>
  91. <?php if ($topline_sharing) { ?>
  92. <li class="item share">
  93. <div class="item-element dropdown">
  94. <div id="dropdown-share2-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  95. <a class="dropdown-toggle" href="#dropdown-share2-<?= $this->entry->id() ?>" title="<?= _t('index.share') ?>">
  96. <?= _i('share') ?>
  97. </a>
  98. <?php /* share_article_template */ ?>
  99. </div>
  100. </li>
  101. <?php } ?>
  102. <?php if ($topline_link) { ?><li class="item link"><?php
  103. if ($title_opens_website) { // The title opens the original website, so this icon opens the article in FreshRSS instead
  104. ?><button type="button" class="item-element as-link" title="<?= _t('gen.action.read_in_freshrss') ?>"><?= _i('view-reader') ?></button><?php
  105. } else {
  106. ?><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element" title="<?=
  107. _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a><?php
  108. }
  109. ?></li><?php } ?>
  110. </ul>