aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/index/normal/entry_bottom.phtml
blob: 290a6f35f0a13d2c0691290be376414c303ea9eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
	/** @var FreshRSS_View $this */
	$sharing = array();
	if (FreshRSS_Auth::hasAccess()) {
		$sharing = FreshRSS_Context::$user_conf->sharing;
	}

	$bottomline_read = FreshRSS_Context::$user_conf->bottomline_read;
	$bottomline_favorite = FreshRSS_Context::$user_conf->bottomline_favorite;
	$bottomline_sharing = FreshRSS_Context::$user_conf->bottomline_sharing && (count($sharing) > 0);
	$bottomline_labels = true;	//TODO
	$bottomline_tags = FreshRSS_Context::$user_conf->bottomline_tags;
	$bottomline_date = FreshRSS_Context::$user_conf->bottomline_date;
	$bottomline_link = FreshRSS_Context::$user_conf->bottomline_link;
?><ul class="horizontal-list bottom"><?php
	if (FreshRSS_Auth::hasAccess()) {
		if ($bottomline_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 ($bottomline_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
		}
	}
	// @phpstan-ignore-next-line
	if ($bottomline_labels) {
	?><li class="item labels">
		<div class="item-element dropdown dynamictags">
			<div id="dropdown-labels-<?= $this->entry->id() ?>" class="dropdown-target"></div>
			<a class="dropdown-toggle" href="#dropdown-labels-<?= $this->entry->id() ?>">
				<?= _i('label') ?><?= _t('index.menu.tags') ?>
			</a>
			<ul class="dropdown-menu dropdown-menu-scrollable scrollbar-thin">
				<li class="dropdown-header">
					<?= _t('index.menu.tags') ?>
					<?php if (FreshRSS_Auth::hasAccess()) { ?>
						<a href="<?= _url('tag', 'index') ?>"><?= _i('configure') ?></a>
					<?php } ?>
				</li>
				<!-- Ajax -->
			</ul>
			<a class="dropdown-close" href="#close">❌</a>
		</div>
	</li><?php
	}
	$tags = $bottomline_tags ? $this->entry->tags() : null;
	if (!empty($tags)) {
	?><li class="item tags">
		<div class="item-element dropdown">
			<div id="dropdown-tags-<?= $this->entry->id() ?>" class="dropdown-target"></div>
			<a class="dropdown-toggle" href="#dropdown-tags-<?= $this->entry->id() ?>">
				<?= _i('tag') ?><?= _t('index.tag.related') ?>
			</a>
			<ul class="dropdown-menu">
				<?php
				foreach ($tags as $tag) {
					?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>"><?= $tag ?></a></li><?php
				} ?>
			</ul>
			<a class="dropdown-close" href="#close">❌</a>
		</div>
	</li><?php
	}
	?><li class="item share"><?php
			if ($bottomline_sharing) {
		?><div class="item-element dropdown">
			<div id="dropdown-share-<?= $this->entry->id() ?>" class="dropdown-target"></div>
			<a class="dropdown-toggle" href="#dropdown-share-<?= $this->entry->id() ?>">
				<?= _i('share') ?><?= _t('index.share') ?>
			</a>

			<ul class="dropdown-menu">
				<li class="dropdown-header"><?= _t('index.share') ?> <a href="<?= _url('configure', 'integration') ?>"><?= _i('configure') ?></a></li><?php
					$id = $this->entry->id();
					$link = $this->entry->link();
					$title = $this->entry->title() . ' · ' . $this->feed->name();
					foreach (FreshRSS_Context::$user_conf->sharing as $share_options) {
						$share = FreshRSS_Share::get($share_options['type']);
						if ($share === null) {
							continue;
						}
						$cssClass = $share->isDeprecated() ? ' error' : '';
						$share_options['id'] = $id;
						$share_options['link'] = $link;
						$share_options['title'] = $title;
						$share->update($share_options);
				?><li class="item share<?= $cssClass ?>">
					<?php if ('GET' === $share->method()) {
						if ($share->HTMLtag() !== 'button') {?>
						<a target="_blank" rel="noreferrer" href="<?= $share->url() ?>" data-type="<?= $share->type() ?>"><?= $share->name() ?></a>
						<?php } else { ?>
						<button type="button" class="as-link" data-url="<?= $share->url() ?>" data-type="<?= $share->type() ?>" data-title="<?= htmlspecialchars($title) ?>"><?= $share->name() ?></button>
						<?php
						}
					} else {?>
						<a href="POST"><?= $share->name() ?></a>
						<form method="POST" action="<?= $share->url() ?>" disabled="disabled">
							<input type="hidden" value="<?= $link ?>" name="<?= $share->field() ?>"/>
						</form>
					<?php } ?>
				</li><?php
					}
			?></ul>
			<a class="dropdown-close" href="#close">❌</a>
		</div>
		<?php } ?>
	</li><?php
	if ($bottomline_date) {
		?><li class="item date"><time datetime="<?= $this->entry->machineReadableDate() ?>" class="item-element"><?= $this->entry->date() ?></time>&nbsp;</li><?php
	}
	if ($bottomline_link) {
		?><li class="item link"><a target="_blank" class="item-element" rel="noreferrer" href="<?= $this->entry->link() ?>" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a></li><?php
	} ?>
</ul>