entry_header.phtml 4.9 KB

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