entry_header.phtml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. if ($this->feed === null) {
  5. throw new FreshRSS_Context_Exception('Feed not initialised!');
  6. }
  7. $topline_read = FreshRSS_Context::userConf()->topline_read;
  8. $topline_favorite = FreshRSS_Context::userConf()->topline_favorite;
  9. $topline_website = FreshRSS_Context::userConf()->topline_website;
  10. $topline_thumbnail = FreshRSS_Context::userConf()->topline_thumbnail;
  11. $topline_summary = FreshRSS_Context::userConf()->topline_summary;
  12. $topline_display_authors = FreshRSS_Context::userConf()->topline_display_authors;
  13. $topline_date = FreshRSS_Context::userConf()->topline_date;
  14. $topline_link = FreshRSS_Context::userConf()->topline_link;
  15. $lazyload = FreshRSS_Context::userConf()->lazyload;
  16. ?><ul class="horizontal-list flux_header website<?= $topline_website ?>"><?php
  17. if (FreshRSS_Auth::hasAccess()) {
  18. if ($topline_read) {
  19. ?><li class="item manage"><?php
  20. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id()));
  21. if ($this->entry->isRead()) {
  22. $arUrl['params']['is_read'] = 0;
  23. }
  24. ?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
  25. echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
  26. ?></li><?php
  27. }
  28. if ($topline_favorite) {
  29. ?><li class="item manage"><?php
  30. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id()));
  31. if ($this->entry->isFavorite()) {
  32. $arUrl['params']['is_favorite'] = 0;
  33. }
  34. ?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
  35. echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
  36. ?></li><?php
  37. }
  38. }
  39. if ($topline_website !== 'none'):
  40. ?><li class="item website <?= $topline_website ?>">
  41. <a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" class="item-element" title="<?= _t('gen.action.filter') ?>: <?= $this->feed->name() ?>">
  42. <?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; ?>
  43. </a>
  44. </li><?php
  45. endif; ?>
  46. <?php
  47. if ($topline_thumbnail !== 'none'):
  48. ?><li class="item thumbnail <?= $topline_thumbnail ?> <?= $topline_summary ? '' : 'small' ?>"><?php
  49. $thumbnail = $this->entry->thumbnail();
  50. if ($thumbnail != null):
  51. ?><img src="<?= $thumbnail['url'] ?>" class="item-element "<?= $lazyload ? ' loading="lazy"' : '' ?> alt="" /><?php
  52. endif;
  53. ?></li><?php
  54. endif; ?>
  55. <li class="item title<?= (($topline_thumbnail !== 'none') || $topline_summary) ? ' multiline' : '' ?>" dir="auto"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element"><?= $this->entry->title() ?><?php
  56. if ($topline_display_authors):
  57. ?><span class="author"><?php
  58. $authors = $this->entry->authors();
  59. if (is_array($authors)) {
  60. $first = true;
  61. foreach ($authors as $author) {
  62. echo $first ? $author : ', ' . $author;
  63. $first = false;
  64. }
  65. }
  66. ?></span><?php
  67. endif;
  68. if ($topline_summary):
  69. ?><div class="summary"><?= trim(mb_substr(strip_tags($this->entry->content(false)), 0, 500, 'UTF-8')) ?></div><?php
  70. endif;
  71. ?></a></li>
  72. <?php if ($topline_date) { ?><li class="item date"><time datetime="<?= $this->entry->machineReadableDate() ?>" class="item-element"><?= $this->entry->date() ?></time>&nbsp;</li><?php } ?>
  73. <?php if ($topline_link) { ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element" title="<?=
  74. _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a></li><?php } ?>
  75. </ul>