entry_header.phtml 4.7 KB

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