entry_header.phtml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 titleAuthorSummaryDate">
  53. <span class="item-element title<?= (($topline_thumbnail !== 'none') || $topline_summary) ? ' multiline' : '' ?>" dir="auto"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>"><?= $this->entry->title() ?><?php
  54. if ($topline_display_authors):
  55. ?><span class="author"><?php
  56. $authors = $this->entry->authors();
  57. if (is_array($authors)) {
  58. $first = true;
  59. foreach ($authors as $author) {
  60. echo $first ? $author : ', ' . $author;
  61. $first = false;
  62. }
  63. }
  64. ?></span><?php
  65. endif;
  66. ?></a></span>
  67. <?php
  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. <?php if ($topline_date) { ?><span class="item-element date"><time datetime="<?= $this->entry->machineReadableDate() ?>"><?= $this->entry->date() ?></time>&nbsp;</span><?php } ?>
  72. </li>
  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>