Skip to content

Commit bae4255

Browse files
simplify else branch in get_realtime_pageview_count
1 parent 9b1854a commit bae4255

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Resources/functions/functions.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,10 @@ function get_most_viewed_posts($args = []): array
120120
*/
121121
function get_realtime_pageview_count($since = null): int
122122
{
123-
if (is_numeric($since) || is_int($since)) {
123+
if (is_numeric($since)) {
124124
$since = (int) $since;
125-
} elseif (is_string($since)) {
126-
// $since is relative time string
127-
$since = strtotime($since);
128125
} else {
129-
$since = strtotime('-5 minutes');
126+
$since = strtotime($since ?? '-5 minutes');
130127
}
131128

132129
$counts = (array) get_option('koko_analytics_realtime_pageview_count', []);

0 commit comments

Comments
 (0)