diff options
| author | wn_ <invalid@email.com> | 2024-12-15 18:14:42 +0000 |
|---|---|---|
| committer | wn_ <invalid@email.com> | 2024-12-15 18:39:03 +0000 |
| commit | f9b2291c28e7036276134aac84ec456fbd297d30 (patch) | |
| tree | 82299fdc13a4e0950126c0ec889d4a9e020748f6 | |
| parent | 119c7f13dcb9b91368304e3affd0219108ec490f (diff) | |
Don't bother passing unused arguments to 'TimeHelper::make_local_datetime()'.
There's no point in passing '$long' unless '$no_smart_dt' is set to 'true'.
| -rw-r--r-- | classes/Counters.php | 2 | ||||
| -rw-r--r-- | classes/Digest.php | 3 | ||||
| -rw-r--r-- | classes/Feeds.php | 10 | ||||
| -rw-r--r-- | classes/Pref_Feeds.php | 8 | ||||
| -rw-r--r-- | classes/Pref_Filters.php | 2 | ||||
| -rw-r--r-- | classes/Pref_Prefs.php | 4 | ||||
| -rw-r--r-- | classes/Pref_System.php | 2 | ||||
| -rw-r--r-- | classes/Pref_Users.php | 10 | ||||
| -rw-r--r-- | classes/TimeHelper.php | 5 | ||||
| -rw-r--r-- | include/functions.php | 2 |
10 files changed, 24 insertions, 24 deletions
diff --git a/classes/Counters.php b/classes/Counters.php index 535c8b32b..e20657947 100644 --- a/classes/Counters.php +++ b/classes/Counters.php @@ -183,7 +183,7 @@ class Counters { while ($line = $sth->fetch()) { $id = $line["id"]; - $last_updated = TimeHelper::make_local_datetime($line['last_updated'], false); + $last_updated = TimeHelper::make_local_datetime($line['last_updated']); if (Feeds::_has_icon($id)) { $ts = filemtime(Feeds::_get_icon_file($id)); diff --git a/classes/Digest.php b/classes/Digest.php index 7e5e660b6..3ce2693f3 100644 --- a/classes/Digest.php +++ b/classes/Digest.php @@ -153,8 +153,7 @@ class Digest array_push($affected_ids, $line["ref_id"]); - $updated = TimeHelper::make_local_datetime($line['last_updated'], false, - $user_id); + $updated = TimeHelper::make_local_datetime($line['last_updated'], owner_uid: $user_id); if (Prefs::get(Prefs::ENABLE_FEED_CATS, $user_id)) { $line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title']; diff --git a/classes/Feeds.php b/classes/Feeds.php index 5c0999e2b..3eab4e9f8 100644 --- a/classes/Feeds.php +++ b/classes/Feeds.php @@ -152,7 +152,7 @@ class Feeds extends Handler_Protected { $feed_title = $qfh_ret[1]; $feed_site_url = $qfh_ret[2]; $last_error = $qfh_ret[3]; - $last_updated = TimeHelper::make_local_datetime($qfh_ret[4], false); + $last_updated = TimeHelper::make_local_datetime($qfh_ret[4]); $highlight_words = $qfh_ret[5]; $reply['first_id'] = $qfh_ret[6]; $reply['is_vfeed'] = $qfh_ret[7]; @@ -337,11 +337,11 @@ class Feeds extends Handler_Protected { $line["enclosures"] = [ 'formatted' => '', 'entries' => [] ]; } - $line["updated_long"] = TimeHelper::make_local_datetime($line["updated"],true); - $line["updated"] = TimeHelper::make_local_datetime($line["updated"], false, null, false, true); + $line["updated_long"] = TimeHelper::make_local_datetime($line["updated"]); + $line["updated"] = TimeHelper::make_local_datetime($line["updated"], eta_min: true); $line['imported'] = T_sprintf("Imported at %s", - TimeHelper::make_local_datetime($line["date_entered"], false)); + TimeHelper::make_local_datetime($line['date_entered'])); if ($line["tag_cache"]) $tags = explode(",", $line["tag_cache"]); @@ -416,7 +416,7 @@ class Feeds extends Handler_Protected { $sth->execute([$_SESSION['uid']]); $row = $sth->fetch(); - $last_updated = TimeHelper::make_local_datetime($row["last_updated"], false); + $last_updated = TimeHelper::make_local_datetime($row['last_updated']); $reply['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated); diff --git a/classes/Pref_Feeds.php b/classes/Pref_Feeds.php index b8edd3eb7..537cc3c86 100644 --- a/classes/Pref_Feeds.php +++ b/classes/Pref_Feeds.php @@ -103,7 +103,7 @@ class Pref_Feeds extends Handler_Protected { 'param' => T_sprintf( _ngettext("(%d article / %s)", "(%d articles / %s)", $feed->num_articles), $feed->num_articles, - TimeHelper::make_local_datetime($feed->last_updated, true)), + TimeHelper::make_local_datetime($feed->last_updated)), 'updates_disabled' => (int)($feed->update_interval < 0), ]); } @@ -290,7 +290,7 @@ class Pref_Feeds extends Handler_Protected { 'param' => T_sprintf( _ngettext("(%d article / %s)", "(%d articles / %s)", $feed->num_articles), $feed->num_articles, - TimeHelper::make_local_datetime($feed->last_updated, true)), + TimeHelper::make_local_datetime($feed->last_updated)), 'unread' => -1, 'type' => 'feed', 'updates_disabled' => (int)($feed->update_interval < 0), @@ -333,7 +333,7 @@ class Pref_Feeds extends Handler_Protected { 'param' => T_sprintf( _ngettext("(%d article / %s)", "(%d articles / %s)", $feed->num_articles), $feed->num_articles, - TimeHelper::make_local_datetime($feed->last_updated, true)), + TimeHelper::make_local_datetime($feed->last_updated)), 'unread' => -1, 'type' => 'feed', 'updates_disabled' => (int)($feed->update_interval < 0), @@ -1161,7 +1161,7 @@ class Pref_Feeds extends Handler_Protected { ->find_array(); foreach ($inactive_feeds as $inactive_feed) { - $inactive_feed['last_article'] = TimeHelper::make_local_datetime($inactive_feed['last_article'], false); + $inactive_feed['last_article'] = TimeHelper::make_local_datetime($inactive_feed['last_article']); } print json_encode($inactive_feeds); diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php index 46180e0cb..811644758 100644 --- a/classes/Pref_Filters.php +++ b/classes/Pref_Filters.php @@ -276,7 +276,7 @@ class Pref_Filters extends Handler_Protected { 'name' => $name[0], 'param' => $name[1], 'checkbox' => false, - 'last_triggered' => $filter->last_triggered ? TimeHelper::make_local_datetime($filter->last_triggered, false) : null, + 'last_triggered' => $filter->last_triggered ? TimeHelper::make_local_datetime($filter->last_triggered) : null, 'enabled' => sql_bool_to_bool($filter->enabled), 'rules' => $this->_get_rules_list($filter->id) ]; diff --git a/classes/Pref_Prefs.php b/classes/Pref_Prefs.php index 7d1c0e9eb..94c38c177 100644 --- a/classes/Pref_Prefs.php +++ b/classes/Pref_Prefs.php @@ -1520,10 +1520,10 @@ class Pref_Prefs extends Handler_Protected { <?= htmlspecialchars($pass["title"]) ?> </td> <td class='text-muted'> - <?= TimeHelper::make_local_datetime($pass['created'], false) ?> + <?= TimeHelper::make_local_datetime($pass['created']) ?> </td> <td class='text-muted'> - <?= TimeHelper::make_local_datetime($pass['last_used'], false) ?> + <?= TimeHelper::make_local_datetime($pass['last_used']) ?> </td> </tr> <?php } ?> diff --git a/classes/Pref_System.php b/classes/Pref_System.php index 885eabdac..225fc49b9 100644 --- a/classes/Pref_System.php +++ b/classes/Pref_System.php @@ -143,7 +143,7 @@ class Pref_System extends Handler_Administrative { <td class='errstr'><?= $line["errstr"] . "\n" . $line["context"] ?></td> <td class='login'><?= $line["login"] ?></td> <td class='timestamp'> - <?= TimeHelper::make_local_datetime($line["created_at"], false) ?> + <?= TimeHelper::make_local_datetime($line['created_at']) ?> </td> </tr> <?php } ?> diff --git a/classes/Pref_Users.php b/classes/Pref_Users.php index 4b51cfd12..ef44dad30 100644 --- a/classes/Pref_Users.php +++ b/classes/Pref_Users.php @@ -35,11 +35,9 @@ class Pref_Users extends Handler_Administrative { if ($row = $sth->fetch()) { - $last_login = TimeHelper::make_local_datetime( - $row["last_login"], true); + $last_login = TimeHelper::make_local_datetime($row['last_login']); - $created = TimeHelper::make_local_datetime( - $row["created"], true); + $created = TimeHelper::make_local_datetime($row['created']); $stored_articles = $row["stored_articles"]; @@ -282,8 +280,8 @@ class Pref_Users extends Handler_Administrative { </td> <td><?= $access_level_names[$user["access_level"]] ?></td> <td><?= $user["num_feeds"] ?></td> - <td class='text-muted'><?= TimeHelper::make_local_datetime($user["created"], false) ?></td> - <td class='text-muted'><?= TimeHelper::make_local_datetime($user["last_login"], false) ?></td> + <td class='text-muted'><?= TimeHelper::make_local_datetime($user['created']) ?></td> + <td class='text-muted'><?= TimeHelper::make_local_datetime($user['last_login']) ?></td> </tr> <?php } ?> </table> diff --git a/classes/TimeHelper.php b/classes/TimeHelper.php index 5b140e913..c39391eea 100644 --- a/classes/TimeHelper.php +++ b/classes/TimeHelper.php @@ -26,7 +26,10 @@ class TimeHelper { } } - static function make_local_datetime(?string $timestamp, bool $long, ?int $owner_uid = null, + /** + * @param bool $long Whether to display the datetime in a 'long' format. Only used if $no_smart_dt is true. + */ + static function make_local_datetime(?string $timestamp, bool $long = false, ?int $owner_uid = null, bool $no_smart_dt = false, bool $eta_min = false): string { if (!$owner_uid) $owner_uid = $_SESSION['uid']; diff --git a/include/functions.php b/include/functions.php index 5e906a977..20c986265 100644 --- a/include/functions.php +++ b/include/functions.php @@ -253,7 +253,7 @@ } /** @deprecated by TimeHelper::make_local_datetime() */ - function make_local_datetime(string $timestamp, bool $long, ?int $owner_uid = null, bool $no_smart_dt = false, bool $eta_min = false): string { + function make_local_datetime(string $timestamp, bool $long = false, ?int $owner_uid = null, bool $no_smart_dt = false, bool $eta_min = false): string { return TimeHelper::make_local_datetime($timestamp, $long, $owner_uid, $no_smart_dt, $eta_min); } |