diff options
| author | 2024-11-28 17:11:04 +0100 | |
|---|---|---|
| committer | 2024-11-28 17:11:04 +0100 | |
| commit | 15745d42b779ad14efde2932ab116f45eee39246 (patch) | |
| tree | 2528a36184d8152d4f2d90dc73df680f84bbe1d1 /app/views/helpers | |
| parent | 604b186638276203c8495a3ee86da0cc240ab4d0 (diff) | |
Upgrade code to php 8.1 (#6748)
* revert
Fix code indentation
Fix code
Upgrade code to php 8.1
* fix remarques
* code review
* code review
* code review
* Apply suggestions from code review
* code review
* Fixes
* Many remainging updates of array syntax
* Lost case 'reading-list'
* Uneeded PHPDoc
---------
Co-authored-by: Luc Sanchez <l.sanchez-prestataire@alptis.fr>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/views/helpers')
| -rw-r--r-- | app/views/helpers/export/articles.phtml | 8 | ||||
| -rw-r--r-- | app/views/helpers/feed/update.phtml | 4 | ||||
| -rw-r--r-- | app/views/helpers/javascript_vars.phtml | 30 | ||||
| -rw-r--r-- | app/views/helpers/logs_pagination.phtml | 10 |
4 files changed, 26 insertions, 26 deletions
diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml index f62573dd4..20001fb59 100644 --- a/app/views/helpers/export/articles.phtml +++ b/app/views/helpers/export/articles.phtml @@ -5,18 +5,18 @@ $username = Minz_User::name() ?? Minz_User::INTERNAL_USER; $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; -$articles = array( +$articles = [ 'id' => 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type, 'title' => $this->list_title, 'author' => $username, - 'items' => array(), -); + 'items' => [], +]; echo rtrim(json_encode($articles, $options) ?: '', " ]}\n\r\t"), "\n"; $first = true; if (empty($this->entryIdsTagNames)) { - $this->entryIdsTagNames = array(); + $this->entryIdsTagNames = []; } foreach ($this->entries as $entry) { diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index c9f8fea62..b6ae16f34 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -129,11 +129,11 @@ <div class="group-controls"> <select class="w50" name="ttl" id="ttl" required="required"><?php $found = false; - foreach (array(FreshRSS_Feed::TTL_DEFAULT => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', + foreach ([FreshRSS_Feed::TTL_DEFAULT => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h', 36000 => '10h', 43200 => '12h', 64800 => '18h', 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d', - 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo') as $v => $t) { + 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo'] as $v => $t) { echo '<option value="' . $v . ($this->feed->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>'; if ($this->feed->ttl() == $v) { $found = true; diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 54ba2917f..db6e8cf3b 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -4,8 +4,8 @@ declare(strict_types=1); $mark = FreshRSS_Context::userConf()->mark_when; $s = FreshRSS_Context::userConf()->shortcuts; $extData = Minz_ExtensionManager::callHook('js_vars', []); -echo htmlspecialchars(json_encode(array( - 'context' => array( +echo htmlspecialchars(json_encode([ + 'context' => [ 'anonymous' => !FreshRSS_Auth::hasAccess(), 'auto_remove_article' => !!FreshRSS_Context::isAutoRemoveAvailable(), 'hide_posts' => !(FreshRSS_Context::userConf()->display_posts || Minz_Request::actionName() === 'reader'), @@ -30,8 +30,8 @@ echo htmlspecialchars(json_encode(array( 'feed.js' => @filemtime(PUBLIC_PATH . '/scripts/feed.js'), ], 'version' => FRESHRSS_VERSION, - ), - 'shortcuts' => array( + ], + 'shortcuts' => [ 'actualize' => @$s['actualize'], 'mark_read' => @$s['mark_read'], 'mark_favorite' => @$s['mark_favorite'], @@ -55,15 +55,15 @@ echo htmlspecialchars(json_encode(array( 'reading_view' => @$s['reading_view'], 'rss_view' => @$s['rss_view'], 'toggle_media' => @$s['toggle_media'], - ), - 'urls' => array( + ], + 'urls' => [ 'index' => _url('index', 'index'), - 'login' => Minz_Url::display(array('c' => 'auth', 'a' => 'login'), 'php'), - 'logout' => Minz_Url::display(array('c' => 'auth', 'a' => 'logout'), 'php'), + 'login' => Minz_Url::display(['c' => 'auth', 'a' => 'login'], 'php'), + 'logout' => Minz_Url::display(['c' => 'auth', 'a' => 'logout'], 'php'), 'help' => FRESHRSS_WIKI, - 'shortcuts' => Minz_Url::display(array('c' => 'configure', 'a' => 'shortcut'), 'php'), - ), - 'i18n' => array( + 'shortcuts' => Minz_Url::display(['c' => 'configure', 'a' => 'shortcut'], 'php'), + ], + 'i18n' => [ 'confirmation_default' => _t('gen.js.confirm_action'), 'notif_title_articles' => _t('gen.js.feedback.title_new_articles'), 'notif_body_new_articles' => _t('gen.js.feedback.body_new_articles'), @@ -72,10 +72,10 @@ echo htmlspecialchars(json_encode(array( 'category_empty' => _t('gen.js.category_empty'), 'labels_empty' => _t('gen.js.labels_empty'), 'language' => FreshRSS_Context::userConf()->language, - ), - 'icons' => array( + ], + 'icons' => [ 'read' => rawurlencode(_i('read')), 'unread' => rawurlencode(_i('unread')), - ), + ], 'extensions' => $extData, -), JSON_UNESCAPED_UNICODE) ?: '', ENT_NOQUOTES, 'UTF-8'); +], JSON_UNESCAPED_UNICODE) ?: '', ENT_NOQUOTES, 'UTF-8'); diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml index 309a80e6b..77e3f3c82 100644 --- a/app/views/helpers/logs_pagination.phtml +++ b/app/views/helpers/logs_pagination.phtml @@ -13,14 +13,14 @@ $params[$getteur] = 1; ?> <li class="item pager-first"> - <a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>">« <?= _t('conf.logs.pagination.first') ?></a> + <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>">« <?= _t('conf.logs.pagination.first') ?></a> </li> <?php $params[$getteur] = $this->currentPage - 1; ?> <li class="item pager-previous"> <?php if ($this->currentPage > 1) { ?> - <a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>">‹ <?= _t('conf.logs.pagination.previous') ?></a> + <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>">‹ <?= _t('conf.logs.pagination.previous') ?></a> <?php } ?> </li> @@ -39,7 +39,7 @@ $class = ' active'; $aria = 'true'; } ?> - <li class="item<?= $class ?>"><a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>" aria-current="<?= $aria ?>"><?= $i ?></a></li> + <li class="item<?= $class ?>"><a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>" aria-current="<?= $aria ?>"><?= $i ?></a></li> <?php } } ?> @@ -52,13 +52,13 @@ <li class="item pager-next"> <?php if ($this->currentPage < $this->nbPage) { ?> - <a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>"><?= _t('conf.logs.pagination.next') ?> ›</a> + <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>"><?= _t('conf.logs.pagination.next') ?> ›</a> <?php } ?> </li> <?php $params[$getteur] = $this->nbPage; ?> <li class="item pager-last"> - <a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>"><?= _t('conf.logs.pagination.last') ?> »</a> + <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>"><?= _t('conf.logs.pagination.last') ?> »</a> </li> </ul> </nav> |
