aboutsummaryrefslogtreecommitdiff
path: root/app/views/index
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-12-18 17:59:16 +0100
committerGravatar GitHub <noreply@github.com> 2023-12-18 17:59:16 +0100
commita80a5f48a16e7d232168a7aaa68e9a1804235ce1 (patch)
treea515b88592629dea7e83b96e26e2452d3f98a98e /app/views/index
parent6bb45a87268157aab961a6a4a728d9a9bbe043b0 (diff)
Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8 And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels * Revert wrong replace in comment * Fix PHPStan level 8 * Update PHPStan and other dev dependencies * Remove obsolete comment * noVariableVariables and towards bleedingEdge https://github.com/phpstan/phpstan-strict-rules https://phpstan.org/blog/what-is-bleeding-edge * More bleedingEdge * A bit more PHPStan level 9 * More PHPStan level 9 * Prepare for booleansInConditions Ignore int and null * Revert wrong line * More fixes * Fix keep_max_n_unread * Stricter attribute functions * Stricter callHooks and more PHPStan level 9 * More typing * A tiny more
Diffstat (limited to 'app/views/index')
-rw-r--r--app/views/index/about.phtml4
-rw-r--r--app/views/index/global.phtml6
-rw-r--r--app/views/index/normal.phtml35
-rw-r--r--app/views/index/reader.phtml28
-rw-r--r--app/views/index/rss.phtml2
5 files changed, 39 insertions, 36 deletions
diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml
index 5ee1729cd..1c41cf4d6 100644
--- a/app/views/index/about.phtml
+++ b/app/views/index/about.phtml
@@ -33,8 +33,8 @@
<?= FRESHRSS_VERSION ?>
<?php
- $env = FreshRSS_Context::$system_conf->environment;
- if ($env !== 'production' && FreshRSS_Context::$user_conf->is_admin) { ?>
+ $env = FreshRSS_Context::systemConf()->environment;
+ if ($env !== 'production' && FreshRSS_Context::userConf()->is_admin) { ?>
<h2>data/config.php</h2>
<code>'environment' => '<?= $env; ?>'</code><br />
<?php
diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml
index 0ddc22e11..6a46ec2ca 100644
--- a/app/views/index/global.phtml
+++ b/app/views/index/global.phtml
@@ -6,7 +6,7 @@
$class = '';
$state_unread = false;
- if (FreshRSS_Context::$user_conf->hide_read_feeds &&
+ if (FreshRSS_Context::userConf()->hide_read_feeds &&
FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
!FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
$class = ' state_unread';
@@ -62,7 +62,7 @@
?>
<li id="f_<?= $feed->id() ?>" class="item feed<?= $error_class, $empty_class, $mute_class ?>" title="<?= $error_title, $empty_title ?>"
data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>">
- <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
<a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?= Minz_Url::display($url_base) ?>"><?= $feed->name() ?></a>
</li>
<?php } ?>
@@ -82,6 +82,6 @@
<div id="overlay">
<a class="close" href="#"><?= _i('close') ?></a>
- <div id="panel"<?= FreshRSS_Context::$user_conf->display_posts ? '' : ' class="hide_posts"' ?>>
+ <div id="panel"<?= FreshRSS_Context::userConf()->display_posts ? '' : ' class="hide_posts"' ?>>
</div>
</div>
diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml
index 0d484f518..42c2e0072 100644
--- a/app/views/index/normal.phtml
+++ b/app/views/index/normal.phtml
@@ -11,10 +11,10 @@ call_user_func($this->callbackBeforeEntries, $this);
$display_today = true;
$display_yesterday = true;
$display_others = true;
-$hidePosts = !FreshRSS_Context::$user_conf->display_posts;
-$lazyload = FreshRSS_Context::$user_conf->lazyload;
-$content_width = FreshRSS_Context::$user_conf->content_width;
-$MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
+$hidePosts = !FreshRSS_Context::userConf()->display_posts;
+$lazyload = FreshRSS_Context::userConf()->lazyload;
+$content_width = FreshRSS_Context::userConf()->content_width;
+$MAX_TAGS_DISPLAYED = FreshRSS_Context::userConf()->show_tags_max;
$useKeepUnreadImportant = !FreshRSS_Context::isImportant() && !FreshRSS_Context::isFeed();
$today = @strtotime('today');
@@ -74,12 +74,15 @@ $today = @strtotime('today');
?>" data-priority="<?= $this->feed->priority()
?>"><?php
$this->renderHelper('index/normal/entry_header');
+ if ($this->feed === null) {
+ throw new FreshRSS_Context_Exception('Feed not initialised!');
+ }
$tags = null;
$firstTags = array();
$remainingTags = array();
- if (FreshRSS_Context::$user_conf->show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b') {
+ if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b') {
$tags = $this->entry->tags();
if (!empty($tags)) {
if ($MAX_TAGS_DISPLAYED > 0) {
@@ -93,14 +96,14 @@ $today = @strtotime('today');
?><article class="flux_content" dir="auto">
<div class="content <?= $content_width ?>">
<header>
- <?php if (FreshRSS_Context::$user_conf->show_feed_name === 't') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
<div class="website"><a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::$user_conf->show_favicons): ?>
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
<img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php
endif; ?><span><?= $this->feed->name() ?></span></a>
</div>
<?php } ?>
- <?php if (FreshRSS_Context::$user_conf->show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'b') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'b') { ?>
<div class="tags">
<?php
if (!empty($tags)) {
@@ -132,11 +135,11 @@ $today = @strtotime('today');
<?php
} ?>
<h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $this->entry->link() ?>" title="<?= _t('conf.shortcut.see_on_website')?>"><?= $this->entry->title() ?></a></h1>
- <?php if (FreshRSS_Context::$user_conf->show_author_date === 'h' || FreshRSS_Context::$user_conf->show_author_date === 'b') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?>
<div class="subtitle">
- <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
<div class="website"><a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::$user_conf->show_favicons): ?>
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
<img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php
endif; ?><span><?= $this->feed->name() ?></span></a>
</div>
@@ -164,8 +167,8 @@ $today = @strtotime('today');
echo $lazyload && $hidePosts ? lazyimg($this->entry->content(true)) : $this->entry->content(true);
?></div>
<?php
- $display_authors_date = FreshRSS_Context::$user_conf->show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b';
- $display_tags = FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b';
+ $display_authors_date = FreshRSS_Context::userConf()->show_author_date === 'f' || FreshRSS_Context::userConf()->show_author_date === 'b';
+ $display_tags = FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b';
if ($display_authors_date || $display_tags) {
?>
@@ -173,9 +176,9 @@ $today = @strtotime('today');
<?php
if ($display_authors_date) { ?>
<div class="subtitle">
- <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
<div class="website"><a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::$user_conf->show_favicons): ?>
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
<img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php
endif; ?><span><?= $this->feed->name() ?></span></a>
</div>
@@ -266,4 +269,4 @@ $today = @strtotime('today');
<?= _i('close') ?>
</a>
-<?php if ($nbEntries > 0 && FreshRSS_Context::$user_conf->show_nav_buttons) $this->partial('nav_entries'); ?>
+<?php if ($nbEntries > 0 && FreshRSS_Context::userConf()->show_nav_buttons) $this->partial('nav_entries'); ?>
diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml
index dc90a144a..f2d7ab46b 100644
--- a/app/views/index/reader.phtml
+++ b/app/views/index/reader.phtml
@@ -8,9 +8,9 @@ if (!Minz_Request::paramBoolean('ajax')) {
call_user_func($this->callbackBeforeEntries, $this);
-$lazyload = FreshRSS_Context::$user_conf->lazyload;
-$content_width = FreshRSS_Context::$user_conf->content_width;
-$MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
+$lazyload = FreshRSS_Context::userConf()->lazyload;
+$content_width = FreshRSS_Context::userConf()->content_width;
+$MAX_TAGS_DISPLAYED = FreshRSS_Context::userConf()->show_tags_max;
?>
<main id="stream" class="reader">
<h1 class="title_hidden"><?= _t('conf.reading.view.reader') ?></h1>
@@ -35,7 +35,7 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
$firstTags = array();
$remainingTags = array();
- if (FreshRSS_Context::$user_conf->show_tags == 'h' || FreshRSS_Context::$user_conf->show_tags == 'f' || FreshRSS_Context::$user_conf->show_tags == 'b') {
+ if (FreshRSS_Context::userConf()->show_tags == 'h' || FreshRSS_Context::userConf()->show_tags == 'f' || FreshRSS_Context::userConf()->show_tags == 'b') {
$tags = $this->entry->tags();
if (!empty($tags)) {
if ($MAX_TAGS_DISPLAYED > 0) {
@@ -69,15 +69,15 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
<a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($item->isRead() ? 'read' : 'unread') ?></a>
<a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($item->isFavorite() ? 'starred' : 'non-starred') ?></a>
<?php } ?>
- <?php if (FreshRSS_Context::$user_conf->show_feed_name === 't') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
<a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::$user_conf->show_favicons): ?>
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
<img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
endif; ?><span><?= $feed->name() ?></span></a>
<?php } ?>
</div>
- <?php if (FreshRSS_Context::$user_conf->show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'b') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'b') { ?>
<div class="tags">
<?php
if (!empty($tags)) {
@@ -109,11 +109,11 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
<?php } ?>
<h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $item->link() ?>"><?= $item->title() ?></a></h1>
- <?php if (FreshRSS_Context::$user_conf->show_author_date === 'h' || FreshRSS_Context::$user_conf->show_author_date === 'b') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?>
<div class="subtitle">
- <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
<div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::$user_conf->show_favicons): ?>
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
<img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
endif; ?><span><?= $feed->name() ?></span></a></div>
<?php } ?>
@@ -141,17 +141,17 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
<?= $item->content(true) ?>
</div>
<?php
- $display_authors_date = FreshRSS_Context::$user_conf->show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b';
- $display_tags = FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b';
+ $display_authors_date = FreshRSS_Context::userConf()->show_author_date === 'f' || FreshRSS_Context::userConf()->show_author_date === 'b';
+ $display_tags = FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b';
if ($display_authors_date || $display_tags) {
?>
<footer>
<?php if ($display_authors_date) { ?>
<div class="subtitle">
- <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?>
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
<div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::$user_conf->show_favicons): ?>
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
<img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
endif; ?><span><?= $feed->name() ?></span></a></div>
<?php } ?>
diff --git a/app/views/index/rss.phtml b/app/views/index/rss.phtml
index a10aa806b..0205b0703 100644
--- a/app/views/index/rss.phtml
+++ b/app/views/index/rss.phtml
@@ -47,7 +47,7 @@ foreach ($this->entries as $item) {
echo "\t\t\t", '<media:thumbnail url="' . $thumbnail['url']
. (empty($thumbnail['width']) ? '' : '" width="' . $thumbnail['width'])
. (empty($thumbnail['height']) ? '' : '" height="' . $thumbnail['height'])
- . (empty($thumbnail['time']) ? '' : '" time="' . $thumbnail['time'])
+ . (empty($thumbnail['type']) ? '' : '" type="' . $thumbnail['type'])
. '" />', "\n";
}
$enclosures = $item->enclosures(false);