Statify - Version 1.8.0

Version Description

Download this release

Release Info

Developer patrickrobrecht
Plugin Icon 128x128 Statify
Version 1.8.0
Comparing to
See all releases

Code changes from version 1.7.2 to 1.8.0

CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
  # Changelog
2
  All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
3
 
 
 
 
 
 
 
4
  ## 1.7.2
5
  * Prevent JavaScript tracking from raising 400 for logged-in users, if tracking is disabled (#159)
6
  * Use `wp_die()` instead of header and exit for AJAX requests (#160)
1
  # Changelog
2
  All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
3
 
4
+ ## 1.8.0
5
+ * Fix date offset in dashboard widget in WP 5.3+ environments with mixed timezones (#167)
6
+ * Allow to deactivate the nonce check during JavaScript tracking (#168)
7
+ * Add support for "disallowed_keys" option instead of "blacklist_keys" in WordPress 5.5 (#174)
8
+ * Add refresh button in the dashboard, increase caching time (#157)
9
+
10
  ## 1.7.2
11
  * Prevent JavaScript tracking from raising 400 for logged-in users, if tracking is disabled (#159)
12
  * Use `wp_die()` instead of header and exit for AJAX requests (#160)
inc/class-statify-dashboard.php CHANGED
@@ -264,14 +264,18 @@ class Statify_Dashboard extends Statify {
264
  * @since 0.1.0
265
  * @version 1.4.0
266
  *
267
- * @return array $data Data from cache or DB
 
 
268
  */
269
- public static function get_stats() {
270
 
271
- // Get from cache.
272
- $data = get_transient( 'statify_data' );
273
- if ( $data ) {
274
- return $data;
 
 
275
  }
276
 
277
  // Get from DB.
@@ -288,7 +292,7 @@ class Statify_Dashboard extends Statify {
288
  set_transient(
289
  'statify_data',
290
  $data,
291
- MINUTE_IN_SECONDS * 4
292
  );
293
 
294
  return $data;
264
  * @since 0.1.0
265
  * @version 1.4.0
266
  *
267
+ * @param bool $force_refresh If true, the data is recalculated, otherwise the cached value is used if available.
268
+ *
269
+ * @return array $data stats data from cache or database
270
  */
271
+ public static function get_stats( $force_refresh = false ) {
272
 
273
+ // Get from cache if enabled.
274
+ if ( ! $force_refresh ) {
275
+ $data_from_cache = get_transient( 'statify_data' );
276
+ if ( $data_from_cache ) {
277
+ return $data_from_cache;
278
+ }
279
  }
280
 
281
  // Get from DB.
292
  set_transient(
293
  'statify_data',
294
  $data,
295
+ MINUTE_IN_SECONDS * 15
296
  );
297
 
298
  return $data;
inc/class-statify-frontend.php CHANGED
@@ -30,29 +30,27 @@ class Statify_Frontend extends Statify {
30
  * @return boolean
31
  */
32
  public static function track_visit( $is_snippet = false ) {
33
-
34
- // Check of JS snippet is configured.
35
- $use_snippet = self::$_options['snippet'];
36
-
37
  // Set target & referrer.
38
  $target = null;
39
  $referrer = null;
40
- if ( $use_snippet && $is_snippet ) {
 
 
 
 
41
  if ( isset( $_REQUEST['statify_target'] ) ) {
42
  $target = filter_var( wp_unslash( $_REQUEST['statify_target'] ), FILTER_SANITIZE_URL );
43
  }
44
  if ( isset( $_REQUEST['statify_referrer'] ) ) {
45
  $referrer = filter_var( wp_unslash( $_REQUEST['statify_referrer'] ), FILTER_SANITIZE_URL );
46
  }
47
- } elseif ( ! $use_snippet ) {
48
  if ( isset( $_SERVER['REQUEST_URI'] ) ) {
49
  $target = filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ), FILTER_SANITIZE_URL );
50
  }
51
  if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
52
  $referrer = filter_var( wp_unslash( $_SERVER['HTTP_REFERER'] ), FILTER_SANITIZE_URL );
53
  }
54
- } else {
55
- return false;
56
  }
57
 
58
  // Fallbacks for uninitialized or omitted target and referrer values.
@@ -127,12 +125,17 @@ class Statify_Frontend extends Statify {
127
  * @return void
128
  */
129
  public static function track_visit_ajax() {
130
- // Check AJAX referrer.
131
- check_ajax_referer( 'statify_track' );
132
  // Only do something if snippet use is actually configured.
133
- if ( self::$_options['snippet'] ) {
134
- self::track_visit( true );
 
 
 
 
 
135
  }
 
 
136
  }
137
 
138
  /**
@@ -255,17 +258,17 @@ class Statify_Frontend extends Statify {
255
  }
256
 
257
  /**
258
- * Compare the referrer url to the blacklist data.
259
  * De/activate this feature via settings in the Dashboard widget.
260
  *
261
  * @since 1.5.0
262
  * @version 1.6.3
263
  *
264
- * @return boolean TRUE of referrer matches blacklist entry and should thus be excluded.
265
  */
266
  private static function check_referrer() {
267
 
268
- // Return false if the blacklist filter is inactive.
269
  if ( ! self::$_options['blacklist'] ) {
270
  return false;
271
  }
@@ -288,9 +291,9 @@ class Statify_Frontend extends Statify {
288
  return false;
289
  }
290
 
291
- // Finally compare referrer against the blacklist.
292
- $blacklist = self::get_blacklist_keys();
293
- foreach ( $blacklist as $item ) {
294
  if ( strpos( $referrer, $item ) !== false ) {
295
  return true;
296
  }
@@ -300,21 +303,28 @@ class Statify_Frontend extends Statify {
300
  }
301
 
302
  /**
303
- * Get a array from the blacklist option of 'Settings' - 'Discussion' - 'Comment Blacklist'.
304
  *
305
  * @since 2016-12-21
 
306
  *
307
  * @return array
308
  */
309
- private static function get_blacklist_keys() {
 
 
 
 
 
 
310
 
311
- $blacklist = trim( get_option( 'blacklist_keys' ) );
312
 
313
- if ( empty( $blacklist ) ) {
314
  return array();
315
  }
316
 
317
- return (array) explode( "\n", $blacklist );
318
  }
319
 
320
  /**
@@ -364,9 +374,8 @@ class Statify_Frontend extends Statify {
364
  * @version 1.4.1
365
  */
366
  public static function wp_footer() {
367
-
368
  // Skip by option.
369
- if ( ! self::$_options['snippet'] ) {
370
  return;
371
  }
372
 
@@ -407,7 +416,7 @@ class Statify_Frontend extends Statify {
407
  }
408
 
409
  // Analytics script is only relevant, if "JS" tracking is enabled, to prevent double tracking.
410
- if ( self::$_options['snippet'] ) {
411
  $analytics['statify'] = array(
412
  'type' => '',
413
  'attributes' => array(),
30
  * @return boolean
31
  */
32
  public static function track_visit( $is_snippet = false ) {
 
 
 
 
33
  // Set target & referrer.
34
  $target = null;
35
  $referrer = null;
36
+ if ( self::is_javascript_tracking_enabled() ) {
37
+ if ( ! $is_snippet ) {
38
+ return false;
39
+ }
40
+
41
  if ( isset( $_REQUEST['statify_target'] ) ) {
42
  $target = filter_var( wp_unslash( $_REQUEST['statify_target'] ), FILTER_SANITIZE_URL );
43
  }
44
  if ( isset( $_REQUEST['statify_referrer'] ) ) {
45
  $referrer = filter_var( wp_unslash( $_REQUEST['statify_referrer'] ), FILTER_SANITIZE_URL );
46
  }
47
+ } else {
48
  if ( isset( $_SERVER['REQUEST_URI'] ) ) {
49
  $target = filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ), FILTER_SANITIZE_URL );
50
  }
51
  if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
52
  $referrer = filter_var( wp_unslash( $_SERVER['HTTP_REFERER'] ), FILTER_SANITIZE_URL );
53
  }
 
 
54
  }
55
 
56
  // Fallbacks for uninitialized or omitted target and referrer values.
125
  * @return void
126
  */
127
  public static function track_visit_ajax() {
 
 
128
  // Only do something if snippet use is actually configured.
129
+ if ( ! self::is_javascript_tracking_enabled() ) {
130
+ return;
131
+ }
132
+
133
+ // Check AJAX referrer.
134
+ if ( Statify::TRACKING_METHOD_JAVASCRIPT_WITH_NONCE_CHECK === self::$_options['snippet'] ) {
135
+ check_ajax_referer( 'statify_track' );
136
  }
137
+
138
+ self::track_visit( true );
139
  }
140
 
141
  /**
258
  }
259
 
260
  /**
261
+ * Compare the referrer URL to the disallowed keys list.
262
  * De/activate this feature via settings in the Dashboard widget.
263
  *
264
  * @since 1.5.0
265
  * @version 1.6.3
266
  *
267
+ * @return boolean TRUE of referrer matches disallowed keys entry and should thus be excluded.
268
  */
269
  private static function check_referrer() {
270
 
271
+ // Return false if the disallowed-keys filter (formerly blacklist) is inactive.
272
  if ( ! self::$_options['blacklist'] ) {
273
  return false;
274
  }
291
  return false;
292
  }
293
 
294
+ // Finally compare referrer against the disallowed keys.
295
+ $disallowed_keys = self::get_disallowed_keys();
296
+ foreach ( $disallowed_keys as $item ) {
297
  if ( strpos( $referrer, $item ) !== false ) {
298
  return true;
299
  }
303
  }
304
 
305
  /**
306
+ * Get a array from the disallowed_keys option of 'Settings' - 'Discussion' - 'Disallowed Comment Keys'.
307
  *
308
  * @since 2016-12-21
309
+ * @since 1.7.3 Renamed to "get_disallowed_keys" to match WP 5.5. wording.
310
  *
311
  * @return array
312
  */
313
+ private static function get_disallowed_keys() {
314
+ $disallowed_keys = get_option( 'disallowed_keys' );
315
+
316
+ if ( false === $disallowed_keys ) {
317
+ // WordPress < 5.5 uses the old key.
318
+ $disallowed_keys = get_option( 'blacklist_keys' );
319
+ }
320
 
321
+ $disallowed_keys = trim( $disallowed_keys );
322
 
323
+ if ( empty( $disallowed_keys ) ) {
324
  return array();
325
  }
326
 
327
+ return (array) explode( "\n", $disallowed_keys );
328
  }
329
 
330
  /**
374
  * @version 1.4.1
375
  */
376
  public static function wp_footer() {
 
377
  // Skip by option.
378
+ if ( ! self::is_javascript_tracking_enabled() ) {
379
  return;
380
  }
381
 
416
  }
417
 
418
  // Analytics script is only relevant, if "JS" tracking is enabled, to prevent double tracking.
419
+ if ( self::is_javascript_tracking_enabled() ) {
420
  $analytics['statify'] = array(
421
  'type' => '',
422
  'attributes' => array(),
inc/class-statify-settings.php CHANGED
@@ -8,7 +8,7 @@
8
  * @since 1.7
9
  */
10
 
11
- // Quit ic accessed directly..
12
  defined( 'ABSPATH' ) || exit;
13
 
14
  /**
@@ -43,7 +43,7 @@ class Statify_Settings {
43
  );
44
  add_settings_field(
45
  'statify-snippet',
46
- __( 'Tracking via JavaScript', 'statify' ),
47
  array( __CLASS__, 'options_snippet' ),
48
  'statify',
49
  'statify-global',
@@ -99,7 +99,7 @@ class Statify_Settings {
99
  );
100
  add_settings_field(
101
  'statify-skip-referrer',
102
- __( 'Blacklisted referrers', 'statify' ),
103
  array( __CLASS__, 'options_skip_blacklist' ),
104
  'statify',
105
  'statify-skip',
@@ -135,10 +135,32 @@ class Statify_Settings {
135
  */
136
  public static function options_snippet() {
137
  ?>
138
- <input id="statify-snippet" type="checkbox" name="statify[snippet]" value="1" <?php checked( Statify::$_options['snippet'], 1 ); ?>>
139
- (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'No', 'statify' ); ?>)
140
- <br>
141
- <p class="description"><?php esc_html_e( 'This option is strongly recommended if caching or AMP is in use.', 'statify' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  <?php
143
  }
144
 
@@ -218,7 +240,7 @@ class Statify_Settings {
218
  }
219
 
220
  /**
221
- * Option to skip tracking for blacklisted referrers.
222
  *
223
  * @return void
224
  */
@@ -226,8 +248,7 @@ class Statify_Settings {
226
  ?>
227
  <input id="statify-skip-referrer" type="checkbox" name="statify[blacklist]" value="1"<?php checked( Statify::$_options['blacklist'] ); ?>>
228
  (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'No', 'statify' ); ?>)
229
- <br>
230
- <p class="description"><?php esc_html_e( 'Enabling this option excludes any views with referrers listed in the comment blacklist.', 'statify' ); ?></p>
231
  <?php
232
  }
233
 
@@ -240,7 +261,6 @@ class Statify_Settings {
240
  ?>
241
  <input id="statify-skip-logged_in" type="checkbox" name="statify[skip][logged_in]" value="1"<?php checked( Statify::$_options['skip']['logged_in'] ); ?>>
242
  (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'Yes', 'statify' ); ?>)
243
- <br>
244
  <p class="description"><?php esc_html_e( 'Enabling this option excludes any views of logged-in users from tracking.', 'statify' ); ?></p>
245
  <?php
246
  }
@@ -288,8 +308,23 @@ class Statify_Settings {
288
  $res['limit'] = 100;
289
  }
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  // Get checkbox values.
292
- foreach ( array( 'today', 'snippet', 'blacklist', 'show_totals' ) as $o ) {
293
  $res[ $o ] = isset( $options[ $o ] ) && 1 === (int) $options[ $o ] ? 1 : 0;
294
  }
295
  $res['skip']['logged_in'] = isset( $options['skip']['logged_in'] ) && 1 === (int) $options['skip']['logged_in'] ? 1 : 0;
8
  * @since 1.7
9
  */
10
 
11
+ // Quit if accessed directly..
12
  defined( 'ABSPATH' ) || exit;
13
 
14
  /**
43
  );
44
  add_settings_field(
45
  'statify-snippet',
46
+ __( 'Tracking method', 'statify' ),
47
  array( __CLASS__, 'options_snippet' ),
48
  'statify',
49
  'statify-global',
99
  );
100
  add_settings_field(
101
  'statify-skip-referrer',
102
+ __( 'Disallowed referrers', 'statify' ),
103
  array( __CLASS__, 'options_skip_blacklist' ),
104
  'statify',
105
  'statify-skip',
135
  */
136
  public static function options_snippet() {
137
  ?>
138
+ <p>
139
+ <?php self::show_snippet_option( Statify::TRACKING_METHOD_DEFAULT, __( 'Default tracking', 'statify' ) ); ?>
140
+ <br>
141
+ <?php self::show_snippet_option( Statify::TRACKING_METHOD_JAVASCRIPT_WITH_NONCE_CHECK, __( 'JavaScript based tracking with nonce check', 'statify' ) ); ?>
142
+ <br>
143
+ <?php self::show_snippet_option( Statify::TRACKING_METHOD_JAVASCRIPT_WITHOUT_NONCE_CHECK, __( 'JavaScript based tracking without nonce check', 'statify' ) ); ?>
144
+ </p>
145
+ <p class="description">
146
+ <?php esc_html_e( 'JavaScript based tracking is strongly recommended if caching or AMP is in use.', 'statify' ); ?>
147
+ <?php esc_html_e( 'Disable the nonce check if the caching time is longer than the nonce time or you miss views due to 403 Forbidden errors.', 'statify' ); ?>
148
+ </p>
149
+ <?php
150
+ }
151
+
152
+ /**
153
+ * Outputs the input radio for an option.
154
+ *
155
+ * @param int $value the value for the input radio.
156
+ * @param string $label the label.
157
+ */
158
+ private static function show_snippet_option( $value, $label ) {
159
+ ?>
160
+ <label>
161
+ <input name="statify[snippet]" type="radio" value="<?php echo esc_html( $value ); ?>>" <?php checked( Statify::$_options['snippet'], $value ); ?>>
162
+ <?php echo esc_html( $label ); ?>
163
+ </label>
164
  <?php
165
  }
166
 
240
  }
241
 
242
  /**
243
+ * Option to skip tracking for disallowed referrers.
244
  *
245
  * @return void
246
  */
248
  ?>
249
  <input id="statify-skip-referrer" type="checkbox" name="statify[blacklist]" value="1"<?php checked( Statify::$_options['blacklist'] ); ?>>
250
  (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'No', 'statify' ); ?>)
251
+ <p class="description"><?php esc_html_e( 'Enabling this option excludes any views with referrers listed in the list of disallowed comment keys.', 'statify' ); ?></p>
 
252
  <?php
253
  }
254
 
261
  ?>
262
  <input id="statify-skip-logged_in" type="checkbox" name="statify[skip][logged_in]" value="1"<?php checked( Statify::$_options['skip']['logged_in'] ); ?>>
263
  (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'Yes', 'statify' ); ?>)
 
264
  <p class="description"><?php esc_html_e( 'Enabling this option excludes any views of logged-in users from tracking.', 'statify' ); ?></p>
265
  <?php
266
  }
308
  $res['limit'] = 100;
309
  }
310
 
311
+ if ( isset( $options['snippet'] ) ) {
312
+ $method = (int) $options['snippet'];
313
+ if ( in_array(
314
+ $method,
315
+ array(
316
+ Statify::TRACKING_METHOD_DEFAULT,
317
+ Statify::TRACKING_METHOD_JAVASCRIPT_WITH_NONCE_CHECK,
318
+ Statify::TRACKING_METHOD_JAVASCRIPT_WITHOUT_NONCE_CHECK,
319
+ ),
320
+ true
321
+ ) ) {
322
+ $res['snippet'] = $method;
323
+ }
324
+ }
325
+
326
  // Get checkbox values.
327
+ foreach ( array( 'today', 'blacklist', 'show_totals' ) as $o ) {
328
  $res[ $o ] = isset( $options[ $o ] ) && 1 === (int) $options[ $o ] ? 1 : 0;
329
  }
330
  $res['skip']['logged_in'] = isset( $options['skip']['logged_in'] ) && 1 === (int) $options['skip']['logged_in'] ? 1 : 0;
inc/class-statify.php CHANGED
@@ -17,6 +17,9 @@ defined( 'ABSPATH' ) || exit;
17
  * @since 0.1.0
18
  */
19
  class Statify {
 
 
 
20
 
21
  /**
22
  * Plugin options.
@@ -26,26 +29,6 @@ class Statify {
26
  */
27
  public static $_options;
28
 
29
- /**
30
- * Class constructor
31
- *
32
- * @since 0.1.0
33
- * @deprecated As of 1.7 use static method init() to initialize the plugin.
34
- */
35
- public function __construct() {
36
- self::init();
37
- }
38
-
39
- /**
40
- * Class self initialize.
41
- *
42
- * @since 0.1.0
43
- * @deprecated As of 1.7 use init() to initialize the plugin.
44
- */
45
- public static function instance() {
46
- self::init();
47
- }
48
-
49
  /**
50
  * Plugin initialization.
51
  *
@@ -102,4 +85,39 @@ class Statify {
102
  }
103
  }
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
17
  * @since 0.1.0
18
  */
19
  class Statify {
20
+ const TRACKING_METHOD_DEFAULT = 0;
21
+ const TRACKING_METHOD_JAVASCRIPT_WITH_NONCE_CHECK = 1;
22
+ const TRACKING_METHOD_JAVASCRIPT_WITHOUT_NONCE_CHECK = 2;
23
 
24
  /**
25
  * Plugin options.
29
  */
30
  public static $_options;
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  /**
33
  * Plugin initialization.
34
  *
85
  }
86
  }
87
  }
88
+
89
+ /**
90
+ * Get a readable date from YYYY-MM-DD database date.
91
+ *
92
+ * This function is designed as a wrapper around date_i18n() or wp_date(), if the latter is available (#166).
93
+ *
94
+ * @param string $date Raw date in "YYYY-MM-DD" format.
95
+ *
96
+ * @return string Parsed date in WP default format.
97
+ *
98
+ * @since 1.7.3
99
+ */
100
+ public static function parse_date( $date ) {
101
+ if ( function_exists( 'wp_date' ) ) { // Exists since WP 5.3.
102
+ return wp_date( get_option( 'date_format' ), strtotime( $date ) );
103
+ }
104
+
105
+ return date_i18n( get_option( 'date_format' ), strtotime( $date ) );
106
+ }
107
+
108
+ /**
109
+ * Check JavaScript tracking.
110
+ *
111
+ * @return bool true if and only if one of the JavaScript tracking options is enabled.
112
+ */
113
+ public static function is_javascript_tracking_enabled() {
114
+ return in_array(
115
+ self::$_options['snippet'],
116
+ array(
117
+ self::TRACKING_METHOD_JAVASCRIPT_WITH_NONCE_CHECK,
118
+ self::TRACKING_METHOD_JAVASCRIPT_WITHOUT_NONCE_CHECK,
119
+ ),
120
+ true
121
+ );
122
+ }
123
  }
readme.txt CHANGED
@@ -3,9 +3,9 @@
3
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW
4
  * Tags: analytics, dashboard, pageviews, privacy, statistics, stats, visits, web stats, widget
5
  * Requires at least: 4.7
6
- * Tested up to: 5.4
7
  * Requires PHP: 5.2
8
- * Stable tag: 1.7.2
9
  * License: GPLv3 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -64,6 +64,7 @@ If you've problems or think you’ve found a bug (e.g. you’re experiencing une
64
  * previews
65
  * views by logged in users (unless tracking is activated via the settings page)
66
  * error pages
 
67
 
68
  This behavior can be modified with the `statify__skip_tracking` hook.
69
 
@@ -115,7 +116,13 @@ has to be added to the theme's `functions.php`. The condition has modified such
115
  ## Changelog ##
116
  You can find the full changelog in [our GitHub repository](https://github.com/pluginkollektiv/statify/blob/master/CHANGELOG.md).
117
 
118
- ## 1.7.2
 
 
 
 
 
 
119
  * Prevent JavaScript tracking from raising 400 for logged-in users, if tracking is disabled (#159)
120
  * Use `wp_die()` instead of header and exit for AJAX requests (#160)
121
  * Fix 1 day offset between display range and number of days evaluated in top lists (#162)
@@ -148,15 +155,8 @@ For the complete changelog, check out our [GitHub repository](https://github.com
148
 
149
  ## Upgrade Notice ##
150
 
151
- ### 1.7.2 ###
152
- This release fixes some bugs. It is recommended for all users.
153
-
154
- ### 1.7.1 ###
155
- This release fixes some bugs introduced with version 1.7.0. It is recommended for all users.
156
-
157
- ### 1.7.0 ###
158
- JavaScript tracking has been changed to use the WordPress AJAX endpoint.
159
- If you are using Statify without modifications, you are all set. Custom logic however might require adjustments (see snippet.js for reference).
160
 
161
 
162
  ## Screenshots ##
3
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW
4
  * Tags: analytics, dashboard, pageviews, privacy, statistics, stats, visits, web stats, widget
5
  * Requires at least: 4.7
6
+ * Tested up to: 5.5
7
  * Requires PHP: 5.2
8
+ * Stable tag: 1.8.0
9
  * License: GPLv3 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
64
  * previews
65
  * views by logged in users (unless tracking is activated via the settings page)
66
  * error pages
67
+ * favicon (as of WP 5.4)
68
 
69
  This behavior can be modified with the `statify__skip_tracking` hook.
70
 
116
  ## Changelog ##
117
  You can find the full changelog in [our GitHub repository](https://github.com/pluginkollektiv/statify/blob/master/CHANGELOG.md).
118
 
119
+ ### 1.8.0
120
+ * Fix date offset in dashboard widget in WP 5.3+ environments with mixed timezones (#167)
121
+ * Allow to deactivate the nonce check during JavaScript tracking (#168)
122
+ * Add support for "disallowed_keys" option instead of "blacklist_keys" in WordPress 5.5 (#174)
123
+ * Add refresh button in the dashboard, increase caching time (#157)
124
+
125
+ ### 1.7.2
126
  * Prevent JavaScript tracking from raising 400 for logged-in users, if tracking is disabled (#159)
127
  * Use `wp_die()` instead of header and exit for AJAX requests (#160)
128
  * Fix 1 day offset between display range and number of days evaluated in top lists (#162)
155
 
156
  ## Upgrade Notice ##
157
 
158
+ ### 1.8.0 ###
159
+ Some minor improvements. The most important one: This version offers to deactivate the nonce check for JavaScript tracking (recommend if a caching plugin with a long caching time is used).
 
 
 
 
 
 
 
160
 
161
 
162
  ## Screenshots ##
statify.php CHANGED
@@ -7,7 +7,7 @@
7
  * Author URI: https://pluginkollektiv.org
8
  * Plugin URI: https://wordpress.org/plugins/statify/
9
  * License: GPLv3 or later
10
- * Version: 1.7.2
11
  *
12
  * @package WordPress
13
  */
@@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit;
20
  define( 'STATIFY_FILE', __FILE__ );
21
  define( 'STATIFY_DIR', dirname( __FILE__ ) );
22
  define( 'STATIFY_BASE', plugin_basename( __FILE__ ) );
23
- define( 'STATIFY_VERSION', '1.7.2' );
24
 
25
 
26
  /* Hooks */
7
  * Author URI: https://pluginkollektiv.org
8
  * Plugin URI: https://wordpress.org/plugins/statify/
9
  * License: GPLv3 or later
10
+ * Version: 1.8.0
11
  *
12
  * @package WordPress
13
  */
20
  define( 'STATIFY_FILE', __FILE__ );
21
  define( 'STATIFY_DIR', dirname( __FILE__ ) );
22
  define( 'STATIFY_BASE', plugin_basename( __FILE__ ) );
23
+ define( 'STATIFY_VERSION', '1.8.0' );
24
 
25
 
26
  /* Hooks */
views/widget-front.php CHANGED
@@ -11,7 +11,8 @@
11
  class_exists( 'Statify' ) || exit;
12
 
13
  // Get stats.
14
- $stats = Statify_Dashboard::get_stats(); ?>
 
15
 
16
  <div id="statify_chart">
17
  <?php if ( empty( $stats['visits'] ) ) { ?>
@@ -22,7 +23,7 @@ $stats = Statify_Dashboard::get_stats(); ?>
22
  <table id="statify_chart_data">
23
  <?php foreach ( (array) $stats['visits'] as $visit ) { ?>
24
  <tr>
25
- <th><?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $visit['date'] ) ) ); ?></th>
26
  <td><?php echo (int) $visit['count']; ?></td>
27
  </tr>
28
  <?php } ?>
@@ -83,7 +84,6 @@ $stats = Statify_Dashboard::get_stats(); ?>
83
  <?php } ?>
84
 
85
 
86
-
87
  <?php if ( ! empty( $stats['visit_totals'] ) ) { ?>
88
  <div class="table total">
89
  <p class="sub">
@@ -105,10 +105,15 @@ $stats = Statify_Dashboard::get_stats(); ?>
105
  </td>
106
  <td class="t">
107
  <?php esc_html_e( 'since', 'statify' ); ?>
108
- <?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $stats['visit_totals']['since_beginning']['date'] ) ) ); ?>
109
  </td>
110
  </tr>
111
  </table>
112
  </div>
113
  </div>
114
  <?php } ?>
 
 
 
 
 
11
  class_exists( 'Statify' ) || exit;
12
 
13
  // Get stats.
14
+ $refresh = isset( $_POST['statify-fresh'] ) && check_admin_referer( 'statify-dashboard-refresh' );
15
+ $stats = Statify_Dashboard::get_stats( $refresh ); ?>
16
 
17
  <div id="statify_chart">
18
  <?php if ( empty( $stats['visits'] ) ) { ?>
23
  <table id="statify_chart_data">
24
  <?php foreach ( (array) $stats['visits'] as $visit ) { ?>
25
  <tr>
26
+ <th><?php echo esc_html( Statify::parse_date( $visit['date'] ) ); ?></th>
27
  <td><?php echo (int) $visit['count']; ?></td>
28
  </tr>
29
  <?php } ?>
84
  <?php } ?>
85
 
86
 
 
87
  <?php if ( ! empty( $stats['visit_totals'] ) ) { ?>
88
  <div class="table total">
89
  <p class="sub">
105
  </td>
106
  <td class="t">
107
  <?php esc_html_e( 'since', 'statify' ); ?>
108
+ <?php echo esc_html( Statify::parse_date( $stats['visit_totals']['since_beginning']['date'] ) ); ?>
109
  </td>
110
  </tr>
111
  </table>
112
  </div>
113
  </div>
114
  <?php } ?>
115
+
116
+ <form method="post" class="clear">
117
+ <?php wp_nonce_field( 'statify-dashboard-refresh' ); ?>
118
+ <button class="button button-primary" name="statify-fresh"><?php esc_html_e( 'Refresh', 'statify' ); ?></button>
119
+ </form>