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 | |
| 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')
| -rw-r--r-- | app/views/auth/index.phtml | 2 | ||||
| -rw-r--r-- | app/views/auth/register.phtml | 2 | ||||
| -rw-r--r-- | app/views/configure/archiving.phtml | 4 | ||||
| -rw-r--r-- | app/views/entry/bookmark.phtml | 12 | ||||
| -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 | ||||
| -rw-r--r-- | app/views/index/global.phtml | 4 | ||||
| -rw-r--r-- | app/views/javascript/nbUnreadsPerFeed.phtml | 8 | ||||
| -rw-r--r-- | app/views/javascript/nonce.phtml | 2 | ||||
| -rw-r--r-- | app/views/stats/idle.phtml | 2 | ||||
| -rw-r--r-- | app/views/stats/index.phtml | 8 | ||||
| -rw-r--r-- | app/views/stats/repartition.phtml | 12 | ||||
| -rw-r--r-- | app/views/subscription/bookmarklet.phtml | 4 | ||||
| -rw-r--r-- | app/views/user/profile.phtml | 2 |
16 files changed, 57 insertions, 57 deletions
diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml index e41223609..ebdd8a992 100644 --- a/app/views/auth/index.phtml +++ b/app/views/auth/index.phtml @@ -57,7 +57,7 @@ FreshRSS_Context::systemConf()->unsafe_autologin_enabled ? ' checked="checked"' : '', FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::systemConf()->unsafe_autologin_enabled ?>"/> <?= _t('admin.auth.unsafe_autologin') ?> - <kbd><?= Minz_Url::display(array('c' => 'auth', 'a' => 'login', 'params' => array('u' => 'alice', 'p' => '1234')), 'html', true) ?></kbd> + <kbd><?= Minz_Url::display(['c' => 'auth', 'a' => 'login', 'params' => ['u' => 'alice', 'p' => '1234']], 'html', true) ?></kbd> </label> </div> </div> diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml index 953b07b0d..fee221708 100644 --- a/app/views/auth/register.phtml +++ b/app/views/auth/register.phtml @@ -69,7 +69,7 @@ <div class="form-group form-group-actions"> <?php $redirect_url = urlencode(Minz_Url::display( - array('c' => 'index', 'a' => 'index'), + ['c' => 'index', 'a' => 'index'], 'php', true )); ?> diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 7ab8a2d9a..61095205e 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -19,11 +19,11 @@ <div class="group-controls"> <select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?= FreshRSS_Context::userConf()->ttl_default ?>"><?php $found = false; - foreach (array(1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', + foreach ([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') as $v => $t) { + 604800 => '1wk'] as $v => $t) { echo '<option value="' . $v . (FreshRSS_Context::userConf()->ttl_default == $v ? '" selected="selected' : '') . '">' . $t . '</option>'; if (FreshRSS_Context::userConf()->ttl_default == $v) { $found = true; diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml index 192e805a0..81647352c 100644 --- a/app/views/entry/bookmark.phtml +++ b/app/views/entry/bookmark.phtml @@ -4,16 +4,16 @@ declare(strict_types=1); header('Content-Type: application/json; charset=UTF-8'); -$url = array( +$url = [ 'c' => Minz_Request::controllerName(), 'a' => Minz_Request::actionName(), 'params' => $_GET, -); +]; $url['params']['is_favorite'] = (Minz_Request::paramTernary('is_favorite') ?? true) ? '0' : '1'; FreshRSS::loadStylesAndScripts(); -echo json_encode(array( - 'url' => str_ireplace('&', '&', Minz_Url::display($url)), - 'icon' => _i($url['params']['is_favorite'] === '1' ? 'non-starred' : 'starred') - )); +echo json_encode([ + 'url' => str_ireplace('&', '&', Minz_Url::display($url)), + 'icon' => _i($url['params']['is_favorite'] === '1' ? 'non-starred' : 'starred') +]); 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> diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml index decde4cce..72916f1a0 100644 --- a/app/views/index/global.phtml +++ b/app/views/index/global.phtml @@ -42,11 +42,11 @@ $params = $_GET; unset($params['c']); unset($params['a']); - $url_base = array( + $url_base = [ 'c' => 'index', 'a' => 'normal', 'params' => $params, - ); + ]; $unreadArticles = 0; diff --git a/app/views/javascript/nbUnreadsPerFeed.phtml b/app/views/javascript/nbUnreadsPerFeed.phtml index f82893f13..12993d297 100644 --- a/app/views/javascript/nbUnreadsPerFeed.phtml +++ b/app/views/javascript/nbUnreadsPerFeed.phtml @@ -2,10 +2,10 @@ declare(strict_types=1); /** @var FreshRSS_ViewJavascript $this */ -$result = array( - 'feeds' => array(), - 'tags' => array(), -); +$result = [ + 'feeds' => [], + 'tags' => [], +]; foreach ($this->categories as $cat) { foreach ($cat->feeds() as $feed) { $result['feeds'][$feed->id()] = $feed->nbNotRead(); diff --git a/app/views/javascript/nonce.phtml b/app/views/javascript/nonce.phtml index e7dceb339..ee1e3ecb5 100644 --- a/app/views/javascript/nonce.phtml +++ b/app/views/javascript/nonce.phtml @@ -1,4 +1,4 @@ <?php declare(strict_types=1); /** @var FreshRSS_ViewJavascript $this */ -echo json_encode(array('salt1' => $this->salt1, 'nonce' => $this->nonce)); +echo json_encode(['salt1' => $this->salt1, 'nonce' => $this->nonce]); diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml index 0c3ebc38f..cfef022c6 100644 --- a/app/views/stats/idle.phtml +++ b/app/views/stats/idle.phtml @@ -12,7 +12,7 @@ <?php $current_url = Minz_Url::display( - array('c' => 'stats', 'a' => 'idle'), + ['c' => 'stats', 'a' => 'idle'], 'php', true ); $nothing = true; diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index b24b859b8..0d144fcd5 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -102,12 +102,12 @@ <canvas id="statsFeedsPerCategory"></canvas> <script class="jsonData-stats" type="application/json"> <?php - echo json_encode(array( + echo json_encode([ 'canvasID' => 'statsFeedsPerCategory', 'charttype' => 'doughnut', 'data' => $this->feedByCategory['data'], 'labels' => $this->feedByCategory['label'], - ), JSON_UNESCAPED_UNICODE); + ], JSON_UNESCAPED_UNICODE); ?></script> </div> </div> @@ -118,12 +118,12 @@ <canvas id="statsEntriesPerCategory"></canvas> <script class="jsonData-stats" type="application/json"> <?php - echo json_encode(array( + echo json_encode([ 'canvasID' => 'statsEntriesPerCategory', 'charttype' => 'doughnut', 'data' => $this->entryByCategory['data'], 'labels' => $this->entryByCategory['label'], - ), JSON_UNESCAPED_UNICODE); + ], JSON_UNESCAPED_UNICODE); ?></script> </div> </div> diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index dd4ff9b29..c8edbf338 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -60,13 +60,13 @@ <canvas id="statsEntriesPerHour"></canvas> <script class="jsonData-stats" type="application/json"> <?php - echo json_encode(array( + echo json_encode([ 'canvasID' => 'statsEntriesPerHour', 'charttype' => 'bar', 'data' => $this->repartitionHour, 'label' => _t('admin.stats.entry_count'), 'xAxisLabels' => $this->hours24Labels - ), JSON_UNESCAPED_UNICODE); + ], JSON_UNESCAPED_UNICODE); ?></script> </div> </div> @@ -77,13 +77,13 @@ <canvas id="statsEntriesPerDayOfWeek"></canvas> <script class="jsonData-stats" type="application/json"> <?php - echo json_encode(array( + echo json_encode([ 'canvasID' => 'statsEntriesPerDayOfWeek', 'charttype' => 'bar', 'data' => $this->repartitionDayOfWeek, 'label' => _t('admin.stats.entry_count'), 'xAxisLabels' => $this->days, - ), JSON_UNESCAPED_UNICODE); + ], JSON_UNESCAPED_UNICODE); ?></script> </div> </div> @@ -94,13 +94,13 @@ <canvas id="statsEntriesPerMonth"></canvas> <script class="jsonData-stats" type="application/json"> <?php - echo json_encode(array( + echo json_encode([ 'canvasID' => 'statsEntriesPerMonth', 'charttype' => 'bar', 'data' => $this->repartitionMonth, 'label' => _t('admin.stats.entry_count'), 'xAxisLabels' => $this->months, - ), JSON_UNESCAPED_UNICODE); + ], JSON_UNESCAPED_UNICODE); ?></script> </div> </div> diff --git a/app/views/subscription/bookmarklet.phtml b/app/views/subscription/bookmarklet.phtml index d96f8a35b..0ea81b153 100644 --- a/app/views/subscription/bookmarklet.phtml +++ b/app/views/subscription/bookmarklet.phtml @@ -12,10 +12,10 @@ <h2><?= _t('sub.bookmarklet.title') ?></h2> <p><a class="btn btn-important" href="javascript:(function(){var%20url%20=%20location.href;var%20otherWindow=window.open('about:blank','_blank');otherWindow.opener=null;otherWindow.location='<?= - Minz_Url::display(array('c' => 'feed', 'a' => 'add'), 'html', true) ?>&url_rss='+encodeURIComponent(url);})();"><?= _t('sub.bookmarklet.label') ?></a></p> + Minz_Url::display(['c' => 'feed', 'a' => 'add'], 'html', true) ?>&url_rss='+encodeURIComponent(url);})();"><?= _t('sub.bookmarklet.label') ?></a></p> <?= _t('sub.bookmarklet.documentation') ?> <h2><?= _t('sub.api.title') ?></h2> <p><?= _t('sub.api.documentation') ?></p> - <kbd><?= Minz_Url::display(array('c' => 'feed', 'a' => 'add'), 'html', true) ?>&url_rss=%s</kbd> + <kbd><?= Minz_Url::display(['c' => 'feed', 'a' => 'add'], 'html', true) ?>&url_rss=%s</kbd> </main> diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml index b2e8a7d7b..1c410334d 100644 --- a/app/views/user/profile.phtml +++ b/app/views/user/profile.phtml @@ -124,7 +124,7 @@ <div class="group-controls"> <?php $redirect_url = urlencode(Minz_Url::display( - array('c' => 'user', 'a' => 'profile'), + ['c' => 'user', 'a' => 'profile'], 'php', true )); ?> |
