entry_header.phtml 3.7 KB

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