entry_header.phtml 4.9 KB

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