entry_header.phtml 4.3 KB

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