aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers
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/helpers
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/helpers')
-rw-r--r--app/views/helpers/category/update.phtml28
-rw-r--r--app/views/helpers/configure/query.phtml3
-rw-r--r--app/views/helpers/export/opml.phtml10
-rw-r--r--app/views/helpers/extension/configure.phtml3
-rw-r--r--app/views/helpers/extension/details.phtml3
-rw-r--r--app/views/helpers/feed/update.phtml97
-rw-r--r--app/views/helpers/index/normal/entry_bottom.phtml18
-rw-r--r--app/views/helpers/index/normal/entry_header.phtml23
-rw-r--r--app/views/helpers/javascript_vars.phtml22
-rw-r--r--app/views/helpers/stream-footer.phtml4
10 files changed, 117 insertions, 94 deletions
diff --git a/app/views/helpers/category/update.phtml b/app/views/helpers/category/update.phtml
index 68132ad27..36c0abfe8 100644
--- a/app/views/helpers/category/update.phtml
+++ b/app/views/helpers/category/update.phtml
@@ -1,6 +1,9 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
+ if ($this->category === null) {
+ throw new FreshRSS_Context_Exception('Category not initialised!');
+ }
?>
<div class="post">
<h2>
@@ -28,7 +31,7 @@
<div class="form-group">
<label class="group-name" for="position"><?= _t('sub.category.position') ?></label>
<div class="group-controls">
- <input type="number" name="position" id="position" min="1" value="<?= $this->category->attributes('position') ?>" />
+ <input type="number" name="position" id="position" min="1" value="<?= $this->category->attributeInt('position') ?>" />
<p class="help"><?= _i('help') ?> <?= _t('sub.category.position_help') ?></p>
</div>
</div>
@@ -46,7 +49,7 @@
<label class="group-name" for="opml_url"><?= _t('sub.category.opml_url') ?></label>
<div class="group-controls">
<div class="stick">
- <input id="opml_url" name="opml_url" type="url" autocomplete="off" class="long" data-disable-update="refreshOpml" value="<?= $this->category->attributes('opml_url') ?>" />
+ <input id="opml_url" name="opml_url" type="url" autocomplete="off" class="long" data-disable-update="refreshOpml" value="<?= $this->category->attributeString('opml_url') ?>" />
<button type="submit" class="btn" id="refreshOpml" formmethod="post" formaction="<?= _url('category', 'refreshOpml', 'id', $this->category->id()) ?>">
<?= _i('refresh') ?> <?= _t('gen.action.refresh_opml') ?>
</button>
@@ -90,7 +93,8 @@
<legend><?= _t('sub.category.archiving') ?></legend>
<?php
- $archiving = $this->category->attributes('archiving');
+ $archiving = $this->category->attributeArray('archiving');
+ /** @var array<'default'?:bool,'keep_period'?:string,'keep_max'?:int,'keep_min'?:int,'keep_favourites'?:bool,'keep_labels'?:bool,'keep_unreads'?:bool>|null $archiving */
if (empty($archiving)) {
$archiving = [ 'default' => true ];
} else {
@@ -101,7 +105,7 @@
'keep_period_count' => '3',
'keep_period_unit' => 'P1M',
];
- if (!empty($archiving['keep_period'])) {
+ if (!empty($archiving['keep_period']) && is_string($archiving['keep_period'])) {
if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
$volatile['enable_keep_period'] = true;
$volatile['keep_period_count'] = $matches['count'];
@@ -109,21 +113,21 @@
}
}
//Defaults
- if (!isset($archiving['keep_max'])) {
- $archiving['keep_max'] = false;
+ if (!isset($archiving['keep_max']) || !is_int($archiving['keep_max'])) {
+ $archiving['keep_max'] = 0;
}
- if (!isset($archiving['keep_favourites'])) {
+ if (!isset($archiving['keep_min']) || !is_int($archiving['keep_min'])) {
+ $archiving['keep_min'] = 50;
+ }
+ if (!isset($archiving['keep_favourites']) || !is_bool($archiving['keep_favourites'])) {
$archiving['keep_favourites'] = true;
}
- if (!isset($archiving['keep_labels'])) {
+ if (!isset($archiving['keep_labels']) || !is_bool($archiving['keep_labels'])) {
$archiving['keep_labels'] = true;
}
- if (!isset($archiving['keep_unreads'])) {
+ if (!isset($archiving['keep_unreads']) || !is_bool($archiving['keep_unreads'])) {
$archiving['keep_unreads'] = false;
}
- if (!isset($archiving['keep_min'])) {
- $archiving['keep_min'] = 50;
- }
?>
<p class="alert alert-warn">
diff --git a/app/views/helpers/configure/query.phtml b/app/views/helpers/configure/query.phtml
index 0f76bc202..145425271 100644
--- a/app/views/helpers/configure/query.phtml
+++ b/app/views/helpers/configure/query.phtml
@@ -1,6 +1,9 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
+ if ($this->query === null) {
+ throw new FreshRSS_Context_Exception('Query not initialised!');
+ }
?>
<div class="post">
<h2><?= $this->query->getName() ?></h2>
diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml
index 2c3e004fc..ce53bfc02 100644
--- a/app/views/helpers/export/opml.phtml
+++ b/app/views/helpers/export/opml.phtml
@@ -30,7 +30,7 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array {
break;
}
/** @var array<string,string> */
- $xPathSettings = $feed->attributes('xpath');
+ $xPathSettings = $feed->attributeArray('xpath') ?? [];
$outline['frss:xPathItem'] = $xPathSettings['item'] ?? null;
$outline['frss:xPathItemTitle'] = $xPathSettings['itemTitle'] ?? null;
$outline['frss:xPathItemContent'] = $xPathSettings['itemContent'] ?? null;
@@ -56,8 +56,8 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array {
$outline['frss:cssFullContent'] = htmlspecialchars_decode($feed->pathEntries(), ENT_QUOTES);
}
- if ($feed->attributes('path_entries_filter') != '') {
- $outline['frss:cssFullContentFilter'] = $feed->attributes('path_entries_filter');
+ if ($feed->attributeString('path_entries_filter') != '') {
+ $outline['frss:cssFullContentFilter'] = $feed->attributeString('path_entries_filter');
}
// Remove null attributes
@@ -76,7 +76,7 @@ $opml_array = [
'frss' => FreshRSS_Export_Service::FRSS_NAMESPACE,
],
'head' => [
- 'title' => FreshRSS_Context::$system_conf->title,
+ 'title' => FreshRSS_Context::systemConf()->title,
'dateCreated' => new DateTime(),
],
'body' => [],
@@ -90,7 +90,7 @@ if (!empty($this->categories)) {
];
if ($cat->kind() === FreshRSS_Category::KIND_DYNAMIC_OPML) {
- $outline['frss:opmlUrl'] = $cat->attributes('opml_url');
+ $outline['frss:opmlUrl'] = $cat->attributeString('opml_url');
}
$opml_array['body'][] = $outline;
diff --git a/app/views/helpers/extension/configure.phtml b/app/views/helpers/extension/configure.phtml
index 5cf7f9c0a..b714eb553 100644
--- a/app/views/helpers/extension/configure.phtml
+++ b/app/views/helpers/extension/configure.phtml
@@ -4,6 +4,9 @@
if (!Minz_Request::paramBoolean('ajax')) {
$this->partial('aside_configure');
}
+ if ($this->extension === null) {
+ throw new FreshRSS_Context_Exception('Extension not initialised!');
+ }
?>
<div class="post">
<h2>
diff --git a/app/views/helpers/extension/details.phtml b/app/views/helpers/extension/details.phtml
index b8d0d784f..d1f773020 100644
--- a/app/views/helpers/extension/details.phtml
+++ b/app/views/helpers/extension/details.phtml
@@ -1,6 +1,9 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
+ if ($this->ext_details === null) {
+ throw new FreshRSS_Context_Exception('Extension not initialised!');
+ }
$name_encoded = urlencode($this->ext_details->getName());
$ext_enabled = $this->ext_details->isEnabled();
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index af2503256..5d4f1cc4b 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -1,6 +1,9 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
+ if ($this->feed === null) {
+ throw new FreshRSS_Context_Exception('Feed not initialised!');
+ }
?>
<div class="post" id="feed_update">
<h1><?= $this->feed->name() ?></h1>
@@ -184,9 +187,9 @@
<label class="group-name" for="mark_updated_article_unread"><?= _t('conf.reading.mark_updated_article_unread') ?></label>
<div class="group-controls">
<select name="mark_updated_article_unread" id="mark_updated_article_unread" class="w50">
- <option value=""<?= $this->feed->attributes('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
- <option value="0"<?= $this->feed->attributes('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
- <option value="1"<?= $this->feed->attributes('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
+ <option value=""<?= $this->feed->attributeBoolean('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
+ <option value="0"<?= $this->feed->attributeBoolean('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
+ <option value="1"<?= $this->feed->attributeBoolean('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
</select>
</div>
</div>
@@ -195,12 +198,12 @@
<label class="group-name" for="read_when_same_title_in_feed"><?= _t('conf.reading.read.when') ?></label>
<div class="group-controls">
<select name="read_when_same_title_in_feed" id="read_when_same_title_in_feed" class="w50">
- <option value=""<?= $this->feed->attributes('read_when_same_title_in_feed') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
- <option value="0"<?= $this->feed->attributes('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
- <option value="10"<?= $this->feed->attributes('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option>
- <option value="25"<?= $this->feed->attributes('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option>
- <option value="100"<?= $this->feed->attributes('read_when_same_title_in_feed') == 100 ? ' selected="selected"' : '' ?>>100</option>
- <option value="1000"<?= $this->feed->attributes('read_when_same_title_in_feed') == 1000 ? ' selected="selected"' : '' ?>>1 000</option>
+ <option value=""<?= $this->feed->attributeBoolean('read_when_same_title_in_feed') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
+ <option value="0"<?= $this->feed->attributeBoolean('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
+ <option value="10"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option>
+ <option value="25"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option>
+ <option value="100"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 100 ? ' selected="selected"' : '' ?>>100</option>
+ <option value="1000"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 1000 ? ' selected="selected"' : '' ?>>1 000</option>
</select>
<?= _t('conf.reading.read.when_same_title') ?>
</div>
@@ -210,9 +213,9 @@
<label class="group-name" for="read_upon_reception"><?= _t('conf.reading.read.when') ?></label>
<div class="group-controls">
<select name="read_upon_reception" id="read_upon_reception" class="w50">
- <option value=""<?= $this->feed->attributes('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
- <option value="0"<?= $this->feed->attributes('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
- <option value="1"<?= $this->feed->attributes('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
+ <option value=""<?= $this->feed->attributeBoolean('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
+ <option value="0"<?= $this->feed->attributeBoolean('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
+ <option value="1"<?= $this->feed->attributeBoolean('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
</select>
<?= _t('conf.reading.read.upon_reception') ?>
</div>
@@ -222,9 +225,9 @@
<label class="group-name" for="read_upon_gone"><?= _t('conf.reading.read.when') ?></label>
<div class="group-controls">
<select name="read_upon_gone" id="read_upon_gone" class="w50">
- <option value=""<?= $this->feed->attributes('read_upon_gone') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
- <option value="0"<?= $this->feed->attributes('read_upon_gone') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
- <option value="1"<?= $this->feed->attributes('read_upon_gone') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
+ <option value=""<?= $this->feed->attributeBoolean('read_upon_gone') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
+ <option value="0"<?= $this->feed->attributeBoolean('read_upon_gone') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
+ <option value="1"<?= $this->feed->attributeBoolean('read_upon_gone') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
</select>
<?= _t('conf.reading.read.upon_gone') ?>
</div>
@@ -245,7 +248,10 @@
<div class="form-group">
<label class="group-name" for="keep_max_n_unread"><?= _t('conf.reading.read.keep_max_n_unread') ?></label>
<div class="group-controls">
- <input type="number" name="keep_max_n_unread" id="keep_max_n_unread" class="w50" min="1" max="10000000" value="<?= $this->feed->attributes('keep_max_n_unread') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
+ <input type="number" name="keep_max_n_unread" id="keep_max_n_unread" class="w50" min="1" max="10000000"
+ data-leave-validation="<?= $this->feed->attributeInt('keep_max_n_unread') ?>"
+ value="<?= $this->feed->attributeInt('keep_max_n_unread') ?>"
+ placeholder="<?= _t('gen.short.by_default') ?>" />
</div>
</div>
@@ -267,7 +273,8 @@
</div>
</div>
<?php
- $archiving = $this->feed->attributes('archiving');
+ $archiving = $this->feed->attributeArray('archiving');
+ /** @var array<'default'?:bool,'keep_period'?:string,'keep_max'?:int,'keep_min'?:int,'keep_favourites'?:bool,'keep_labels'?:bool,'keep_unreads'?:bool>|null $archiving */
if (empty($archiving)) {
$archiving = [ 'default' => true ];
} else {
@@ -278,7 +285,7 @@
'keep_period_count' => '3',
'keep_period_unit' => 'P1M',
];
- if (!empty($archiving['keep_period'])) {
+ if (!empty($archiving['keep_period']) && is_string($archiving['keep_period'])) {
if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
$volatile['enable_keep_period'] = true;
$volatile['keep_period_count'] = $matches['count'];
@@ -286,19 +293,19 @@
}
}
//Defaults
- if (!isset($archiving['keep_max'])) {
- $archiving['keep_max'] = false;
+ if (!isset($archiving['keep_max']) || !is_int($archiving['keep_max'])) {
+ $archiving['keep_max'] = 0;
}
- if (!isset($archiving['keep_min'])) {
+ if (!isset($archiving['keep_min']) || !is_int($archiving['keep_min'])) {
$archiving['keep_min'] = 50;
}
- if (!isset($archiving['keep_favourites'])) {
+ if (!isset($archiving['keep_favourites']) || !is_bool($archiving['keep_favourites'])) {
$archiving['keep_favourites'] = true;
}
- if (!isset($archiving['keep_labels'])) {
+ if (!isset($archiving['keep_labels']) || !is_bool($archiving['keep_labels'])) {
$archiving['keep_labels'] = true;
}
- if (!isset($archiving['keep_unreads'])) {
+ if (!isset($archiving['keep_unreads']) || !is_bool($archiving['keep_unreads'])) {
$archiving['keep_unreads'] = false;
}
?>
@@ -406,7 +413,7 @@
<fieldset id="html_xpath">
<?php
- $xpath = Minz_Helper::htmlspecialchars_utf8((array)($this->feed->attributes('xpath')));
+ $xpath = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeArray('xpath') ?? []);
?>
<p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.help') ?></p>
<div class="form-group">
@@ -521,7 +528,7 @@
<div class="form-group">
<?php
- $path_entries_filter = Minz_Helper::htmlspecialchars_utf8((string)($this->feed->attributes('path_entries_filter')));
+ $path_entries_filter = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeString('path_entries_filter') ?? '');
?>
<label class="group-name" for="path_entries_filter"><?= _t('sub.feed.css_path_filter') ?></label>
<div class="group-controls">
@@ -537,13 +544,13 @@
<label class="group-name" for="curl_params_cookie"><?= _t('sub.feed.css_cookie') ?></label>
<div class="group-controls">
<input type="text" name="curl_params_cookie" id="curl_params_cookie" class="w100" value="<?=
- is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_COOKIE]) ?
- $this->feed->attributes('curl_params')[CURLOPT_COOKIE] : ''
+ $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_COOKIE]) ?
+ $this->feed->attributeArray('curl_params')[CURLOPT_COOKIE] : ''
?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
<p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_cookie_help') ?></p>
<label for="curl_params_cookiefile">
<input type="checkbox" name="curl_params_cookiefile" id="curl_params_cookiefile" value="1"<?=
- is_array($this->feed->attributes('curl_params')) && isset($this->feed->attributes('curl_params')[CURLOPT_COOKIEFILE]) ?
+ $this->feed->attributeArray('curl_params') !== null && isset($this->feed->attributeArray('curl_params')[CURLOPT_COOKIEFILE]) ?
' checked="checked"' : ''
?> />
<?= _t('sub.feed.accept_cookies') ?>
@@ -556,8 +563,8 @@
<label class="group-name" for="curl_params_redirects"><?= _t('sub.feed.max_http_redir') ?></label>
<div class="group-controls">
<input type="number" name="curl_params_redirects" id="curl_params_redirects" class="w50" min="-1" value="<?=
- is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_MAXREDIRS]) ?
- $this->feed->attributes('curl_params')[CURLOPT_MAXREDIRS] : ''
+ $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_MAXREDIRS]) ?
+ $this->feed->attributeArray('curl_params')[CURLOPT_MAXREDIRS] : ''
?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
<p class="help"><?= _i('help') ?> <?= _t('sub.feed.max_http_redir_help') ?></p>
</div>
@@ -567,9 +574,9 @@
<label class="group-name" for="content_action"><?= _t('sub.feed.content_action') ?></label>
<div class="group-controls">
<select name="content_action" id="content_action" class="w50">
- <option value="replace"<?= 'replace' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option>
- <option value="prepend"<?= 'prepend' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option>
- <option value="append"<?= 'append' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option>
+ <option value="replace"<?= 'replace' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option>
+ <option value="prepend"<?= 'prepend' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option>
+ <option value="append"<?= 'append' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option>
</select>
</div>
</div>
@@ -578,8 +585,8 @@
<label class="group-name" for="curl_params_useragent"><?= _t('sub.feed.useragent') ?></label>
<div class="group-controls">
<input type="text" name="curl_params_useragent" id="curl_params_useragent" class="w100" value="<?=
- is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_USERAGENT]) ?
- $this->feed->attributes('curl_params')[CURLOPT_USERAGENT] : ''
+ $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_USERAGENT]) ?
+ $this->feed->attributeArray('curl_params')[CURLOPT_USERAGENT] : ''
?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
<p class="help"><?= _i('help') ?> <?= _t('sub.feed.useragent_help') ?></p>
</div>
@@ -590,8 +597,8 @@
<div class="group-controls">
<select name="proxy_type" id="proxy_type"><?php
$type = '';
- if (is_array($this->feed->attributes('curl_params')) && isset($this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE])) {
- $type = $this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE];
+ if ($this->feed->attributeArray('curl_params') !== null && isset($this->feed->attributeArray('curl_params')[CURLOPT_PROXYTYPE])) {
+ $type = $this->feed->attributeArray('curl_params')[CURLOPT_PROXYTYPE];
}
foreach(['' => '', 3 => 'NONE', 0 => 'HTTP', 2 => 'HTTPS', 4 => 'SOCKS4', 6 => 'SOCKS4A', 5 => 'SOCKS5', 7 => 'SOCKS5H'] as $k => $v) {
echo '<option value="' . $k . ($type === $k ? '" selected="selected' : '' ) . '">' . $v . '</option>';
@@ -599,8 +606,8 @@
?>
</select>
<input type="text" name="curl_params" id="curl_params" value="<?=
- is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_PROXY]) ?
- $this->feed->attributes('curl_params')[CURLOPT_PROXY] : ''
+ $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_PROXY]) ?
+ $this->feed->attributeArray('curl_params')[CURLOPT_PROXY] : ''
?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
<p class="help"><?= _i('help') ?> <?= _t('sub.feed.proxy_help') ?></p>
</div>
@@ -609,7 +616,7 @@
<div class="form-group">
<label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label>
<div class="group-controls">
- <input type="number" name="timeout" id="timeout" class="w50" min="3" max="900" value="<?= $this->feed->attributes('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
+ <input type="number" name="timeout" id="timeout" class="w50" min="3" max="900" value="<?= $this->feed->attributeInt('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
</div>
</div>
@@ -617,9 +624,9 @@
<label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label>
<div class="group-controls">
<select name="ssl_verify" id="ssl_verify" class="w50">
- <option value=""<?= $this->feed->attributes('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
- <option value="0"<?= $this->feed->attributes('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
- <option value="1"<?= $this->feed->attributes('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
+ <option value=""<?= $this->feed->attributeBoolean('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
+ <option value="0"<?= $this->feed->attributeBoolean('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
+ <option value="1"<?= $this->feed->attributeBoolean('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
</select>
</div>
</div>
@@ -627,7 +634,7 @@
<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="clear_cache">
- <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributes('clear_cache') ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributeBoolean('clear_cache') ? ' checked="checked"' : '' ?> />
<?= _t('sub.feed.clear_cache') ?>
</label>
</div>
diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml
index dba0e44a3..e5bfd7fd0 100644
--- a/app/views/helpers/index/normal/entry_bottom.phtml
+++ b/app/views/helpers/index/normal/entry_bottom.phtml
@@ -1,13 +1,13 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
- $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(FreshRSS_Context::$user_conf->sharing) > 0);
- $bottomline_myLabels = FreshRSS_Context::$user_conf->bottomline_myLabels;
- $bottomline_tags = FreshRSS_Context::$user_conf->bottomline_tags;
- $bottomline_date = FreshRSS_Context::$user_conf->bottomline_date;
- $bottomline_link = FreshRSS_Context::$user_conf->bottomline_link;
+ $bottomline_read = FreshRSS_Context::userConf()->bottomline_read;
+ $bottomline_favorite = FreshRSS_Context::userConf()->bottomline_favorite;
+ $bottomline_sharing = FreshRSS_Context::userConf()->bottomline_sharing && (count(FreshRSS_Context::userConf()->sharing) > 0);
+ $bottomline_myLabels = FreshRSS_Context::userConf()->bottomline_myLabels;
+ $bottomline_tags = FreshRSS_Context::userConf()->bottomline_tags;
+ $bottomline_date = FreshRSS_Context::userConf()->bottomline_date;
+ $bottomline_link = FreshRSS_Context::userConf()->bottomline_link;
?><ul class="horizontal-list bottom"><?php
if (FreshRSS_Auth::hasAccess()) {
if ($bottomline_read) {
@@ -81,8 +81,8 @@
<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) {
+ $title = $this->entry->title() . ' · ' . ($this->feed === null ? '' : $this->feed->name());
+ foreach (FreshRSS_Context::userConf()->sharing as $share_options) {
$share = FreshRSS_Share::get($share_options['type']);
if ($share === null) {
continue;
diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml
index 6a693b0a9..b324a5949 100644
--- a/app/views/helpers/index/normal/entry_header.phtml
+++ b/app/views/helpers/index/normal/entry_header.phtml
@@ -1,15 +1,18 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
- $topline_read = FreshRSS_Context::$user_conf->topline_read;
- $topline_favorite = FreshRSS_Context::$user_conf->topline_favorite;
- $topline_website = FreshRSS_Context::$user_conf->topline_website;
- $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;
+ if ($this->feed === null) {
+ throw new FreshRSS_Context_Exception('Feed not initialised!');
+ }
+ $topline_read = FreshRSS_Context::userConf()->topline_read;
+ $topline_favorite = FreshRSS_Context::userConf()->topline_favorite;
+ $topline_website = FreshRSS_Context::userConf()->topline_website;
+ $topline_thumbnail = FreshRSS_Context::userConf()->topline_thumbnail;
+ $topline_summary = FreshRSS_Context::userConf()->topline_summary;
+ $topline_display_authors = FreshRSS_Context::userConf()->topline_display_authors;
+ $topline_date = FreshRSS_Context::userConf()->topline_date;
+ $topline_link = FreshRSS_Context::userConf()->topline_link;
+ $lazyload = FreshRSS_Context::userConf()->lazyload;
?><ul class="horizontal-list flux_header website<?= $topline_website ?>"><?php
if (FreshRSS_Auth::hasAccess()) {
if ($topline_read) {
@@ -37,7 +40,7 @@
if ($topline_website !== 'none'):
?><li class="item website <?= $topline_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 && '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; ?>
+ <?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; ?>
</a>
</li><?php
endif; ?>
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml
index 38a7751ee..29f78e5ee 100644
--- a/app/views/helpers/javascript_vars.phtml
+++ b/app/views/helpers/javascript_vars.phtml
@@ -1,27 +1,27 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
-$mark = FreshRSS_Context::$user_conf->mark_when;
-$s = FreshRSS_Context::$user_conf->shortcuts;
+$mark = FreshRSS_Context::userConf()->mark_when;
+$s = FreshRSS_Context::userConf()->shortcuts;
$extData = Minz_ExtensionManager::callHook('js_vars', []);
echo htmlspecialchars(json_encode(array(
'context' => array(
'anonymous' => !FreshRSS_Auth::hasAccess(),
'auto_remove_article' => !!FreshRSS_Context::isAutoRemoveAvailable(),
- 'hide_posts' => !(FreshRSS_Context::$user_conf->display_posts || Minz_Request::actionName() === 'reader'),
- 'display_order' => Minz_Request::paramString('order') ?: FreshRSS_Context::$user_conf->sort_order,
- 'display_categories' => FreshRSS_Context::$user_conf->display_categories,
+ 'hide_posts' => !(FreshRSS_Context::userConf()->display_posts || Minz_Request::actionName() === 'reader'),
+ 'display_order' => Minz_Request::paramString('order') ?: FreshRSS_Context::userConf()->sort_order,
+ 'display_categories' => FreshRSS_Context::userConf()->display_categories,
'auto_mark_article' => !!$mark['article'],
'auto_mark_site' => !!$mark['site'],
'auto_mark_scroll' => !!$mark['scroll'],
'auto_mark_focus' => !!$mark['focus'],
- 'auto_load_more' => !!FreshRSS_Context::$user_conf->auto_load_more,
+ 'auto_load_more' => !!FreshRSS_Context::userConf()->auto_load_more,
'auto_actualize_feeds' => Minz_Session::paramBoolean('actualize_feeds'),
- 'does_lazyload' => !!FreshRSS_Context::$user_conf->lazyload ,
- 'sides_close_article' => !!FreshRSS_Context::$user_conf->sides_close_article,
+ 'does_lazyload' => !!FreshRSS_Context::userConf()->lazyload ,
+ 'sides_close_article' => !!FreshRSS_Context::userConf()->sides_close_article,
'sticky_post' => !!FreshRSS_Context::isStickyPostEnabled(),
- 'html5_notif_timeout' => FreshRSS_Context::$user_conf->html5_notif_timeout,
- 'auth_type' => FreshRSS_Context::$system_conf->auth_type,
+ 'html5_notif_timeout' => FreshRSS_Context::userConf()->html5_notif_timeout,
+ 'auth_type' => FreshRSS_Context::systemConf()->auth_type,
'current_view' => Minz_Request::actionName(),
'csrf' => FreshRSS_Auth::csrfToken(),
'mtime' => [
@@ -69,7 +69,7 @@ echo htmlspecialchars(json_encode(array(
'notif_request_failed' => _t('gen.js.feedback.request_failed'),
'category_empty' => _t('gen.js.category_empty'),
'labels_empty' => _t('gen.js.labels_empty'),
- 'language' => FreshRSS_Context::$user_conf->language,
+ 'language' => FreshRSS_Context::userConf()->language,
),
'icons' => array(
'read' => rawurlencode(_i('read')),
diff --git a/app/views/helpers/stream-footer.phtml b/app/views/helpers/stream-footer.phtml
index 41f4315b5..0cbab601a 100644
--- a/app/views/helpers/stream-footer.phtml
+++ b/app/views/helpers/stream-footer.phtml
@@ -32,13 +32,13 @@
<?php } elseif ($hasAccess) { ?>
<?= _t('gen.stream.nothing_to_load') ?><br />
<button id="bigMarkAsRead"
- class="as-link <?= FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : '' ?>"
+ class="as-link <?= FreshRSS_Context::userConf()->reading_confirm ? 'confirm" disabled="disabled' : '' ?>"
form="stream-footer"
formaction="<?= Minz_Url::display($url_mark_read) ?>"
type="submit">
<span class="bigTick">✓</span><br />
<span class="markAllRead"><?= _t('gen.stream.mark_all_read') ?></span><br />
- <?php if (FreshRSS_Context::$user_conf->onread_jump_next) { ?>
+ <?php if (FreshRSS_Context::userConf()->onread_jump_next) { ?>
<span class="jumpNext"><?= _t('conf.reading.jump_next') ?></span>
<?php } ?>
</button>