<?php
	/** @var FreshRSS_View $this */
	$topline_read = FreshRSS_Context::$user_conf->topline_read;
	$topline_favorite = FreshRSS_Context::$user_conf->topline_favorite;
	$topline_thumbnail = FreshRSS_Context::$user_conf->topline_thumbnail;
	$topline_summary = FreshRSS_Context::$user_conf->topline_summary;
	$topline_display_authors = FreshRSS_Context::$user_conf->topline_display_authors;
	$topline_date = FreshRSS_Context::$user_conf->topline_date;
	$topline_link = FreshRSS_Context::$user_conf->topline_link;
	$lazyload = FreshRSS_Context::$user_conf->lazyload;
?><ul class="horizontal-list flux_header"><?php
	if (FreshRSS_Auth::hasAccess()) {
		if ($topline_read) {
			?><li class="item manage"><?php
				$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id()));
				if ($this->entry->isRead()) {
					$arUrl['params']['is_read'] = 0;
				}
				?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
					echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
			?></li><?php
		}
		if ($topline_favorite) {
			?><li class="item manage"><?php
				$arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id()));
				if ($this->entry->isFavorite()) {
					$arUrl['params']['is_favorite'] = 0;
				}
				?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
					echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
			?></li><?php
		}
	}
	?><li class="item website">
		<a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" class="item-element" title="<?= _t('gen.action.filter') ?>: <?= $this->feed->name() ?>">
			<?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $this->feed->name() ?></span>
		</a>
	</li>

	<?php
	if ($topline_thumbnail !== 'none'):
	?><li class="item thumbnail <?= $topline_thumbnail ?> <?= $topline_summary ? '' : 'small' ?>"><?php
		$thumbnail = $this->entry->thumbnail();
		if ($thumbnail != null):
			?><img src="<?= $thumbnail['url'] ?>" class="item-element "<?= $lazyload ? ' loading="lazy"' : '' ?> alt="" /><?php
		endif;
	?></li><?php
	endif; ?>

	<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
		if ($topline_display_authors):
			?><span class="author"><?php
			$authors = $this->entry->authors();
			if (is_array($authors)) {
				$first = true;
				foreach ($authors as $author) {
					echo $first ? $author : ', ' . $author;
					$first = false;
				}
			}
			?></span><?php
		endif;
		if ($topline_summary):
			?><div class="summary"><?= trim(mb_substr(strip_tags($this->entry->content(false)), 0, 500, 'UTF-8')) ?></div><?php
		endif;
	?></a></li>
	<?php if ($topline_date) { ?><li class="item date"><time datetime="<?= $this->entry->machineReadableDate() ?>" class="item-element"><?= $this->entry->date() ?></time>&nbsp;</li><?php } ?>
	<?php if ($topline_link) { ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element" title="<?=
		_t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a></li><?php } ?>
</ul>
