From 3eecaaf8fe1ee4110a7047af47cdc0deb3bbd96e Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 2 Nov 2018 09:48:11 +0100 Subject: [PATCH] Changed time() to current_time( ) all to fix timezone issues The UTC offset was omitted by the WP date query, so the UTC timestamp returned by time() was compared to a local timestamp. --- includes/class-scliveticker-widget.php | 2 +- includes/class-scliveticker.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/class-scliveticker-widget.php b/includes/class-scliveticker-widget.php index c381ad5..04e1cc4 100644 --- a/includes/class-scliveticker-widget.php +++ b/includes/class-scliveticker-widget.php @@ -73,7 +73,7 @@ class SCLiveticker_Widget extends WP_Widget { echo ' sclt-widget-ajax" ' . 'data-sclt-ticker="' . esc_attr( $category ) . '" ' . 'data-sclt-limit="' . esc_attr( $count ) . '" ' - . 'data-sclt-last="' . esc_attr( time() ); + . 'data-sclt-last="' . esc_attr( current_time( 'timestamp' ) ); } echo '">'; diff --git a/includes/class-scliveticker.php b/includes/class-scliveticker.php index 1106c78..3f11733 100644 --- a/includes/class-scliveticker.php +++ b/includes/class-scliveticker.php @@ -203,7 +203,7 @@ class SCLiveticker { $output .= ' sclt-ticker-ajax" ' . 'data-sclt-ticker="' . $ticker . '" ' . 'data-sclt-limit="' . $limit . '" ' - . 'data-sclt-last="' . time(); + . 'data-sclt-last="' . current_time( 'timestamp' ); } $output .= '">'; @@ -350,13 +350,13 @@ class SCLiveticker { $res[] = array( 'w' => $slug, 'h' => $out, - 't' => time(), + 't' => current_time( 'timestamp' ), ); } else { $res[] = array( 's' => $slug, 'h' => $out, - 't' => time(), + 't' => current_time( 'timestamp' ), ); } }