Slimstat Analytics - Version 4.6.7

Version Description

  • [Update] Same-domain referrers are now tracked by default, when Slimstat is activated for the first time. Pre-existing installations are not affected. This change will allow us to introduce new features as suggested by one of our users. Stay tuned.
  • [Update] Every first of the month we get at least one or two support requests from alarmed users who think their data has disappeared. Some of them end up leaving negative reviews because of this. The fundamental misunderstanding was related to the fact that Slimstat uses the CURRENT MONTH time span as the default range for calculating its reports and metrics. So every first of the month all the reports can look "empty" because there is not much data to be crunched. In order to address this problem, we've changed the default time range from the current month to the last 20 days. Hopefully this will avoid further negative reviews in the future!
  • [Fix] There was an incompatibility issue between our premium add-ons Custom DB and Network Settings, causing the network-wide configuration to be reset when a new blog was being created in the network.
  • [Fix] The tracker was not working as expected if the blacklist by usernames contained a @ character (thank you, Eugenio).
  • [Fix] A bug was affecting the way the geolocation function would calculate the country parameter from certain given IP addresses (thank you, Carsten).
  • [Fix] Links with "javascript:" value were being tracked as outbound clicks (thank you, Luna).
Download this release

Release Info

Developer coolmann
Plugin Icon 128x128 Slimstat Analytics
Version 4.6.7
Comparing to
See all releases

Code changes from version 4.6.6 to 4.6.7

admin/view/index.php CHANGED
@@ -54,9 +54,9 @@
54
  <div class="dropdown">
55
  <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals 0') ?>"><?php _e('Today','wp-slimstat') ?></a>
56
  <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d', mktime(0, 0, 0, date_i18n('m'), date_i18n('d')-1, date_i18n('Y'))).'&&&month equals '.date_i18n('m', mktime(0, 0, 0, date_i18n('m'), date_i18n('d')-1, date_i18n('Y'))).'&&&year equals '.date_i18n('Y', mktime(0, 0, 0, date_i18n('m'), date_i18n('d')-1, date_i18n('Y'))).'&&&interval equals 0') ?>"><?php _e('Yesterday','wp-slimstat') ?></a>
57
- <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals 7&&&interval_direction equals minus') ?>"><?php _e('Last 7 Days','wp-slimstat') ?></a>
58
- <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals 60&&&interval_direction equals minus') ?>"><?php _e('Last 60 Days','wp-slimstat') ?></a>
59
- <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals 90&&&interval_direction equals minus') ?>"><?php _e('Last 90 Days','wp-slimstat') ?></a>
60
  <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals 0&&&month equals 0&&&year equals '.date_i18n('Y').'&&&interval equals 0') ?>"><?php _e('This Year So Far','wp-slimstat') ?></a>
61
  <strong><?php _e('Date Range','wp-slimstat') ?></strong>
62
 
@@ -98,8 +98,8 @@
98
 
99
  <label for="slimstat-filter-interval_direction">Direction</label>
100
  <select name="interval_direction" class="short" id="slimstat-filter-interval_direction">
101
- <option value="minus" <?php selected(wp_slimstat_db::$filters_normalized['date']['interval_direction'], 'minus') ?>>-</option>
102
- <option value="plus" <?php selected(wp_slimstat_db::$filters_normalized['date']['interval_direction'], 'plus') ?>>+</option>
103
  </select>
104
 
105
  <label for="slimstat-filter-interval">Days in interval</label>
@@ -120,7 +120,7 @@
120
  !empty(wp_slimstat_db::$filters_normalized['date']['interval']) ||
121
  !empty(wp_slimstat_db::$filters_normalized['date']['interval_hours']) ||
122
  !empty(wp_slimstat_db::$filters_normalized['date']['interval_minutes'])): ?>
123
- <a class="slimstat-filter-link button-secondary noslimstat" href="<?php echo wp_slimstat_reports::fs_url('minute equals 0&&&hour equals 0&&&day equals 0&&&month equals '.date_i18n('n').'&&&year equals 0&&&interval_direction equals plus&&&interval equals 0&&&interval_hours equals 0&&&interval_minutes equals 0') ?>"><?php _e('Reset Filters','wp-slimstat') ?></a>
124
  <?php endif ?>
125
  </div>
126
  </fieldset><!-- .slimstat-date-filters -->
54
  <div class="dropdown">
55
  <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals 0') ?>"><?php _e('Today','wp-slimstat') ?></a>
56
  <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d', mktime(0, 0, 0, date_i18n('m'), date_i18n('d')-1, date_i18n('Y'))).'&&&month equals '.date_i18n('m', mktime(0, 0, 0, date_i18n('m'), date_i18n('d')-1, date_i18n('Y'))).'&&&year equals '.date_i18n('Y', mktime(0, 0, 0, date_i18n('m'), date_i18n('d')-1, date_i18n('Y'))).'&&&interval equals 0') ?>"><?php _e('Yesterday','wp-slimstat') ?></a>
57
+ <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals 7&&&interval_direction equals 0') ?>"><?php _e('Last 7 Days','wp-slimstat') ?></a>
58
+ <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url( 'hour equals 0&&&day equals ' . date_i18n( 'd' ) . '&&&month equals ' . date_i18n( 'm' ) . '&&&year equals ' . date_i18n( 'Y' ) . '&&&interval equals 60&&&interval_direction equals 0' ) ?>"><?php _e( 'Last 60 Days', 'wp-slimstat' ) ?></a>
59
+ <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url( 'hour equals 0&&&day equals 0&&&month equals ' . date_i18n( 'm' ) . '&&&year equals ' . date_i18n( 'Y' ) . '&&&interval equals 0&&&interval_direction equals 0' ) ?>"><?php _e( 'This month so far', 'wp-slimstat' ) ?></a>
60
  <a class="slimstat-filter-link slimstat-date-choice noslimstat" href="<?php echo wp_slimstat_reports::fs_url('hour equals 0&&&day equals 0&&&month equals 0&&&year equals '.date_i18n('Y').'&&&interval equals 0') ?>"><?php _e('This Year So Far','wp-slimstat') ?></a>
61
  <strong><?php _e('Date Range','wp-slimstat') ?></strong>
62
 
98
 
99
  <label for="slimstat-filter-interval_direction">Direction</label>
100
  <select name="interval_direction" class="short" id="slimstat-filter-interval_direction">
101
+ <option value="0" <?php selected( wp_slimstat_db::$filters_normalized[ 'date' ][ 'interval_direction' ], 0 ) ?>>-</option>
102
+ <option value="1" <?php selected( wp_slimstat_db::$filters_normalized[ 'date' ][ 'interval_direction' ], 1 ) ?>>+</option>
103
  </select>
104
 
105
  <label for="slimstat-filter-interval">Days in interval</label>
120
  !empty(wp_slimstat_db::$filters_normalized['date']['interval']) ||
121
  !empty(wp_slimstat_db::$filters_normalized['date']['interval_hours']) ||
122
  !empty(wp_slimstat_db::$filters_normalized['date']['interval_minutes'])): ?>
123
+ <a class="slimstat-filter-link button-secondary noslimstat" href="<?php echo wp_slimstat_reports::fs_url('minute equals 0&&&hour equals 0&&&day equals 0&&&month equals 0&&&year equals 0&&&interval_direction equals 1&&&interval equals 0&&&interval_hours equals 0&&&interval_minutes equals 0') ?>"><?php _e('Reset Filters','wp-slimstat') ?></a>
124
  <?php endif ?>
125
  </div>
126
  </fieldset><!-- .slimstat-date-filters -->
admin/view/wp-slimstat-db.php CHANGED
@@ -344,7 +344,7 @@ class wp_slimstat_db {
344
  $filters_normalized = array(
345
  'columns' => array(),
346
  'date' => array(
347
- 'interval_direction' => '',
348
  'is_past' => false
349
  ),
350
  'misc' => $_init_misc?array(
@@ -354,8 +354,7 @@ class wp_slimstat_db {
354
  ) : array(),
355
  'utime' => array(
356
  'start' => 0,
357
- 'end' => 0,
358
- 'type' => 'm'
359
  )
360
  );
361
 
@@ -451,12 +450,12 @@ class wp_slimstat_db {
451
  $intval_filter = intval( $a_filter[ 3 ] );
452
  $filters_normalized[ 'date' ][ $a_filter[ 1 ] ] = abs( $intval_filter );
453
  if ( $intval_filter < 0 ) {
454
- $filters_normalized[ 'date' ][ 'interval_direction' ] = 'minus';
455
  }
456
  break;
457
 
458
  case 'interval_direction':
459
- $filters_normalized[ 'date' ][ $a_filter[ 1 ] ] = in_array( $a_filter[ 3 ], array( 'plus', 'minus' ) ) ? $a_filter[ 3 ] : 'plus';
460
  break;
461
 
462
  case 'direction':
@@ -486,12 +485,12 @@ class wp_slimstat_db {
486
  if ( empty( $filters_normalized[ 'date' ][ 'interval' ] ) && empty( $filters_normalized[ 'date' ][ 'interval_hours' ] ) && empty( $filters_normalized[ 'date' ][ 'interval_minutes' ] ) ) {
487
  if ( !empty( $filters_normalized[ 'date' ][ 'minute' ] ) ) {
488
  $filters_normalized[ 'utime' ][ 'start' ] = mktime(
489
- !empty( $filters_normalized[ 'date' ][ 'hour' ] )?$filters_normalized[ 'date' ][ 'hour' ]:0,
490
  $filters_normalized[ 'date' ][ 'minute' ],
491
  0,
492
- !empty( $filters_normalized[ 'date' ][ 'month' ] )?$filters_normalized[ 'date' ][ 'month' ]:date_i18n( 'n' ),
493
- !empty( $filters_normalized[ 'date' ][ 'day' ] )?$filters_normalized[ 'date' ][ 'day' ]:date_i18n( 'j' ),
494
- !empty( $filters_normalized[ 'date' ][ 'year' ] )?$filters_normalized[ 'date' ][ 'year' ]:date_i18n( 'Y' )
495
  );
496
  $filters_normalized[ 'utime' ][ 'end' ] = $filters_normalized[ 'utime' ][ 'start' ] + 60;
497
  $filters_normalized[ 'utime' ][ 'type' ] = 'H';
@@ -501,9 +500,9 @@ class wp_slimstat_db {
501
  $filters_normalized[ 'date' ][ 'hour' ],
502
  0,
503
  0,
504
- !empty( $filters_normalized[ 'date' ][ 'month' ] )?$filters_normalized[ 'date' ][ 'month' ]:date_i18n( 'n' ),
505
- !empty( $filters_normalized[ 'date' ][ 'day' ] )?$filters_normalized[ 'date' ][ 'day' ]:date_i18n( 'j' ),
506
- !empty( $filters_normalized[ 'date' ][ 'year' ] )?$filters_normalized[ 'date' ][ 'year' ]:date_i18n( 'Y' )
507
  );
508
  $filters_normalized[ 'utime' ][ 'end' ] = $filters_normalized[ 'utime' ][ 'start' ] + 3599;
509
  $filters_normalized[ 'utime' ][ 'type' ] = 'H';
@@ -522,30 +521,47 @@ class wp_slimstat_db {
522
  }
523
  else if( !empty( $filters_normalized[ 'date' ][ 'year' ] ) && empty( $filters_normalized[ 'date' ][ 'month' ] ) ) {
524
  $filters_normalized[ 'utime' ][ 'start' ] = mktime( 0, 0, 0, 1, 1, $filters_normalized[ 'date' ][ 'year' ] );
525
- $filters_normalized[ 'utime' ][ 'end' ] = mktime( 0, 0, 0, 1, 1, $filters_normalized[ 'date' ][ 'year' ]+1 )-1;
526
  $filters_normalized[ 'utime' ][ 'type' ] = 'Y';
527
  }
528
- else {
529
  $filters_normalized[ 'utime' ][ 'start' ] = mktime(
530
  0,
531
  0,
532
  0,
533
- !empty( $filters_normalized[ 'date' ][ 'month' ] )?$filters_normalized[ 'date' ][ 'month' ]:date_i18n( 'n' ),
534
  1,
535
- !empty( $filters_normalized[ 'date' ][ 'year' ] )?$filters_normalized[ 'date' ][ 'year' ]:date_i18n( 'Y' )
536
  );
537
 
538
  $filters_normalized[ 'utime' ][ 'end' ] = strtotime(
539
- ( !empty( $filters_normalized[ 'date' ][ 'year' ] )?$filters_normalized[ 'date' ][ 'year' ]:date_i18n( 'Y' ) ).'-'.
540
- ( !empty( $filters_normalized[ 'date' ][ 'month' ] )?$filters_normalized[ 'date' ][ 'month' ]:date_i18n( 'n' ) ).
541
  '-01 00:00 +1 month UTC'
542
- )-1;
543
  $filters_normalized[ 'utime' ][ 'type' ] = 'm';
544
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  }
546
  else { // An interval was specified
547
  $filters_normalized[ 'utime' ][ 'type' ] = 'interval';
548
- $sign = ( $filters_normalized[ 'date' ][ 'interval_direction' ] == 'plus' ) ? '+' : '-';
 
 
549
 
550
  $filters_normalized[ 'utime' ][ 'start' ] = mktime(
551
  !empty( $filters_normalized[ 'date' ][ 'hour' ] ) ? $filters_normalized[ 'date' ][ 'hour' ] : 0,
@@ -556,14 +572,14 @@ class wp_slimstat_db {
556
  !empty( $filters_normalized[ 'date' ][ 'year' ] ) ? $filters_normalized[ 'date' ][ 'year' ] : date_i18n( 'Y' )
557
  );
558
 
559
- $filters_normalized[ 'utime' ][ 'end' ] = $filters_normalized[ 'utime' ][ 'start' ] + intval( $sign.(
560
  ( !empty( $filters_normalized[ 'date' ][ 'interval' ] ) ? intval( $filters_normalized[ 'date' ][ 'interval' ] ) : 0 ) * 86400 +
561
  ( !empty( $filters_normalized[ 'date' ][ 'interval_hours' ] ) ? intval( $filters_normalized[ 'date' ][ 'interval_hours' ] ) : 0 ) * 3600 +
562
  ( !empty( $filters_normalized[ 'date' ][ 'interval_minutes' ] ) ? intval( $filters_normalized[ 'date' ][ 'interval_minutes' ] ) : 0 ) * 60
563
  ) );
564
 
565
  // Swap boundaries if we're going back in time
566
- if ( $filters_normalized[ 'date' ][ 'interval_direction' ] == 'minus' ) {
567
  $adjustment = ( abs( $filters_normalized[ 'utime' ][ 'start' ] - $filters_normalized[ 'utime' ][ 'end' ] ) < 86400 ) ? 0 : 86400;
568
  list( $filters_normalized[ 'utime' ][ 'start' ], $filters_normalized[ 'utime' ][ 'end' ] ) = array( $filters_normalized[ 'utime' ][ 'end' ] + $adjustment, $filters_normalized[ 'utime' ][ 'start' ] + $adjustment );
569
  }
344
  $filters_normalized = array(
345
  'columns' => array(),
346
  'date' => array(
347
+ 'interval_direction' => 0,
348
  'is_past' => false
349
  ),
350
  'misc' => $_init_misc?array(
354
  ) : array(),
355
  'utime' => array(
356
  'start' => 0,
357
+ 'end' => 0
 
358
  )
359
  );
360
 
450
  $intval_filter = intval( $a_filter[ 3 ] );
451
  $filters_normalized[ 'date' ][ $a_filter[ 1 ] ] = abs( $intval_filter );
452
  if ( $intval_filter < 0 ) {
453
+ $filters_normalized[ 'date' ][ 'interval_direction' ] = 0;
454
  }
455
  break;
456
 
457
  case 'interval_direction':
458
+ $filters_normalized[ 'date' ][ $a_filter[ 1 ] ] = in_array( $a_filter[ 3 ], array( 0, 1 ) ) ? $a_filter[ 3 ] : 1;
459
  break;
460
 
461
  case 'direction':
485
  if ( empty( $filters_normalized[ 'date' ][ 'interval' ] ) && empty( $filters_normalized[ 'date' ][ 'interval_hours' ] ) && empty( $filters_normalized[ 'date' ][ 'interval_minutes' ] ) ) {
486
  if ( !empty( $filters_normalized[ 'date' ][ 'minute' ] ) ) {
487
  $filters_normalized[ 'utime' ][ 'start' ] = mktime(
488
+ !empty( $filters_normalized[ 'date' ][ 'hour' ] ) ? $filters_normalized[ 'date' ][ 'hour' ] : 0,
489
  $filters_normalized[ 'date' ][ 'minute' ],
490
  0,
491
+ !empty( $filters_normalized[ 'date' ][ 'month' ] ) ? $filters_normalized[ 'date' ][ 'month' ] : date_i18n( 'n' ),
492
+ !empty( $filters_normalized[ 'date' ][ 'day' ] ) ? $filters_normalized[ 'date' ][ 'day' ] : date_i18n( 'j' ),
493
+ !empty( $filters_normalized[ 'date' ][ 'year' ] ) ? $filters_normalized[ 'date' ][ 'year' ] : date_i18n( 'Y' )
494
  );
495
  $filters_normalized[ 'utime' ][ 'end' ] = $filters_normalized[ 'utime' ][ 'start' ] + 60;
496
  $filters_normalized[ 'utime' ][ 'type' ] = 'H';
500
  $filters_normalized[ 'date' ][ 'hour' ],
501
  0,
502
  0,
503
+ !empty( $filters_normalized[ 'date' ][ 'month' ] ) ? $filters_normalized[ 'date' ][ 'month' ] : date_i18n( 'n' ),
504
+ !empty( $filters_normalized[ 'date' ][ 'day' ] ) ? $filters_normalized[ 'date' ][ 'day' ] : date_i18n( 'j' ),
505
+ !empty( $filters_normalized[ 'date' ][ 'year' ] ) ? $filters_normalized[ 'date' ][ 'year' ] : date_i18n( 'Y' )
506
  );
507
  $filters_normalized[ 'utime' ][ 'end' ] = $filters_normalized[ 'utime' ][ 'start' ] + 3599;
508
  $filters_normalized[ 'utime' ][ 'type' ] = 'H';
521
  }
522
  else if( !empty( $filters_normalized[ 'date' ][ 'year' ] ) && empty( $filters_normalized[ 'date' ][ 'month' ] ) ) {
523
  $filters_normalized[ 'utime' ][ 'start' ] = mktime( 0, 0, 0, 1, 1, $filters_normalized[ 'date' ][ 'year' ] );
524
+ $filters_normalized[ 'utime' ][ 'end' ] = mktime( 0, 0, 0, 1, 1, $filters_normalized[ 'date' ][ 'year' ] + 1 ) - 1;
525
  $filters_normalized[ 'utime' ][ 'type' ] = 'Y';
526
  }
527
+ else if ( !empty( $filters_normalized[ 'date' ][ 'month' ] ) ) {
528
  $filters_normalized[ 'utime' ][ 'start' ] = mktime(
529
  0,
530
  0,
531
  0,
532
+ !empty( $filters_normalized[ 'date' ][ 'month' ] ) ? $filters_normalized[ 'date' ][ 'month' ] : date_i18n( 'n' ),
533
  1,
534
+ !empty( $filters_normalized[ 'date' ][ 'year' ] ) ? $filters_normalized[ 'date' ][ 'year' ] : date_i18n( 'Y' )
535
  );
536
 
537
  $filters_normalized[ 'utime' ][ 'end' ] = strtotime(
538
+ ( !empty( $filters_normalized[ 'date' ][ 'year' ] ) ? $filters_normalized[ 'date' ][ 'year' ] : date_i18n( 'Y' ) ) . '-' .
539
+ ( !empty( $filters_normalized[ 'date' ][ 'month' ] ) ? $filters_normalized[ 'date' ][ 'month' ] : date_i18n( 'n' ) ) .
540
  '-01 00:00 +1 month UTC'
541
+ ) - 1;
542
  $filters_normalized[ 'utime' ][ 'type' ] = 'm';
543
  }
544
+ else {
545
+ $filters_normalized[ 'utime' ][ 'end' ] = mktime(
546
+ date_i18n( 'H' ),
547
+ date_i18n( 'i' ),
548
+ date_i18n( 's' ),
549
+ !empty( $filters_normalized[ 'date' ][ 'month' ] ) ? $filters_normalized[ 'date' ][ 'month' ] : date_i18n( 'n' ),
550
+ !empty( $filters_normalized[ 'date' ][ 'month' ] ) ? $filters_normalized[ 'date' ][ 'day' ] : date_i18n( 'd' ),
551
+ !empty( $filters_normalized[ 'date' ][ 'year' ] ) ? $filters_normalized[ 'date' ][ 'year' ] : date_i18n( 'Y' )
552
+ );
553
+
554
+ $filters_normalized[ 'utime' ][ 'start' ] = $filters_normalized[ 'utime' ][ 'end' ] - 2592000;
555
+ $filters_normalized[ 'utime' ][ 'type' ] = 'interval';
556
+ $filters_normalized[ 'date' ][ 'interval' ] = isset( $filters_normalized[ 'date' ][ 'interval' ] ) ? $filters_normalized[ 'date' ][ 'interval' ] : 30;
557
+ $filters_normalized[ 'date' ][ 'interval_direction' ] = 0;
558
+ }
559
  }
560
  else { // An interval was specified
561
  $filters_normalized[ 'utime' ][ 'type' ] = 'interval';
562
+
563
+ // Interval Direction: 0 = past, 1 = future
564
+ $sign = ( $filters_normalized[ 'date' ][ 'interval_direction' ] == 0 ) ? '-' : '+';
565
 
566
  $filters_normalized[ 'utime' ][ 'start' ] = mktime(
567
  !empty( $filters_normalized[ 'date' ][ 'hour' ] ) ? $filters_normalized[ 'date' ][ 'hour' ] : 0,
572
  !empty( $filters_normalized[ 'date' ][ 'year' ] ) ? $filters_normalized[ 'date' ][ 'year' ] : date_i18n( 'Y' )
573
  );
574
 
575
+ $filters_normalized[ 'utime' ][ 'end' ] = $filters_normalized[ 'utime' ][ 'start' ] + intval( $sign . (
576
  ( !empty( $filters_normalized[ 'date' ][ 'interval' ] ) ? intval( $filters_normalized[ 'date' ][ 'interval' ] ) : 0 ) * 86400 +
577
  ( !empty( $filters_normalized[ 'date' ][ 'interval_hours' ] ) ? intval( $filters_normalized[ 'date' ][ 'interval_hours' ] ) : 0 ) * 3600 +
578
  ( !empty( $filters_normalized[ 'date' ][ 'interval_minutes' ] ) ? intval( $filters_normalized[ 'date' ][ 'interval_minutes' ] ) : 0 ) * 60
579
  ) );
580
 
581
  // Swap boundaries if we're going back in time
582
+ if ( $filters_normalized[ 'date' ][ 'interval_direction' ] == 0 ) {
583
  $adjustment = ( abs( $filters_normalized[ 'utime' ][ 'start' ] - $filters_normalized[ 'utime' ][ 'end' ] ) < 86400 ) ? 0 : 86400;
584
  list( $filters_normalized[ 'utime' ][ 'start' ], $filters_normalized[ 'utime' ][ 'end' ] ) = array( $filters_normalized[ 'utime' ][ 'end' ] + $adjustment, $filters_normalized[ 'utime' ][ 'start' ] + $adjustment );
585
  }
admin/view/wp-slimstat-reports.php CHANGED
@@ -20,24 +20,24 @@ class wp_slimstat_reports {
20
  $filters = array();
21
  if ( !empty( $_REQUEST[ 'fs' ] ) && is_array( $_REQUEST[ 'fs' ] ) ) {
22
  foreach( $_REQUEST[ 'fs' ] as $a_request_filter_name => $a_request_filter_value ) {
23
- $filters[] = "$a_request_filter_name $a_request_filter_value";
24
  }
25
  }
26
 
27
  // Fields and drop downs
28
  if ( !empty( $_POST[ 'f' ] ) && !empty( $_POST[ 'o' ] ) ) {
29
- $filters[] = "{$_POST[ 'f' ]} {$_POST[ 'o' ]} " . ( isset( $_POST[ 'v' ] ) ? $_POST[ 'v' ] : '' );
30
  }
31
 
32
  foreach ( array( 'minute', 'hour', 'day', 'month', 'year', 'interval_direction', 'interval', 'interval_hours', 'interval_minutes' ) as $a_date_time_filter_name ) {
33
- if ( !empty( $_POST[ $a_date_time_filter_name ] ) ) {
34
- $filters[] = "$a_date_time_filter_name equals {$_POST[ $a_date_time_filter_name ]}";
35
  }
36
  }
37
 
38
  // Hidden Filters
39
  if ( wp_slimstat::$settings[ 'restrict_authors_view' ] == 'yes' && !current_user_can( 'manage_options' ) && !empty( $GLOBALS[ 'current_user' ]->user_login ) ) {
40
- $filters[] = 'author equals ' . $GLOBALS[ 'current_user' ]->user_login;
41
  self::$hidden_filters[ 'author' ] = 1;
42
  }
43
 
@@ -1280,6 +1280,12 @@ class wp_slimstat_reports {
1280
  }
1281
  }
1282
 
 
 
 
 
 
 
1283
  // Enqueue all the Javascript and styles
1284
  $path_slimstat = dirname( dirname( __FILE__ ) );
1285
  wp_enqueue_script( 'slimstat_amcharts', plugins_url( '/admin/js/amcharts/amcharts.js', $path_slimstat ), array(), null, false );
20
  $filters = array();
21
  if ( !empty( $_REQUEST[ 'fs' ] ) && is_array( $_REQUEST[ 'fs' ] ) ) {
22
  foreach( $_REQUEST[ 'fs' ] as $a_request_filter_name => $a_request_filter_value ) {
23
+ $filters[ htmlspecialchars( $a_request_filter_name ) ] = "$a_request_filter_name $a_request_filter_value";
24
  }
25
  }
26
 
27
  // Fields and drop downs
28
  if ( !empty( $_POST[ 'f' ] ) && !empty( $_POST[ 'o' ] ) ) {
29
+ $filters[ htmlspecialchars( $_POST[ 'f' ] ) ] = "{$_POST[ 'f' ]} {$_POST[ 'o' ]} " . ( isset( $_POST[ 'v' ] ) ? $_POST[ 'v' ] : '' );
30
  }
31
 
32
  foreach ( array( 'minute', 'hour', 'day', 'month', 'year', 'interval_direction', 'interval', 'interval_hours', 'interval_minutes' ) as $a_date_time_filter_name ) {
33
+ if ( isset( $_POST[ $a_date_time_filter_name ] ) ) {
34
+ $filters[ $a_date_time_filter_name ] = "$a_date_time_filter_name equals " . intval( $_POST[ $a_date_time_filter_name ] );
35
  }
36
  }
37
 
38
  // Hidden Filters
39
  if ( wp_slimstat::$settings[ 'restrict_authors_view' ] == 'yes' && !current_user_can( 'manage_options' ) && !empty( $GLOBALS[ 'current_user' ]->user_login ) ) {
40
+ $filters[ 'author' ] = 'author equals ' . $GLOBALS[ 'current_user' ]->user_login;
41
  self::$hidden_filters[ 'author' ] = 1;
42
  }
43
 
1280
  }
1281
  }
1282
 
1283
+
1284
+ //<div class="one-third"></div>
1285
+ //<div class="one-third"></div>
1286
+ //<div class="one-third"></div>
1287
+ // return 0;
1288
+
1289
  // Enqueue all the Javascript and styles
1290
  $path_slimstat = dirname( dirname( __FILE__ ) );
1291
  wp_enqueue_script( 'slimstat_amcharts', plugins_url( '/admin/js/amcharts/amcharts.js', $path_slimstat ), array(), null, false );
admin/wp-slimstat-admin.php CHANGED
@@ -11,7 +11,9 @@ class wp_slimstat_admin {
11
  * Init -- Sets things up.
12
  */
13
  public static function init() {
14
- self::$admin_notice = "Three. Million. Downloads. Can you believe it? Just a few days ago we passed this monumental milestone, and it's all thanks to all of you! We have one of the best user communities out there, no doubt abou that. Your support has taken our plugin to the next level: your feedback, your support requests, your reviews. Every little bit of information has helped us create the piece of code you all enjoy on a daily basis. A real team effort. With a team of more than one hundred thousand people. Keep up the good work.";
 
 
15
 
16
  self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">Got it, thanks</a>';
17
 
@@ -213,7 +215,7 @@ class wp_slimstat_admin {
213
  switch_to_blog( $_blog_id );
214
  self::init_environment();
215
  restore_current_blog();
216
- wp_slimstat::$settings = get_option( 'slimstat_options', array() );
217
  }
218
  // end new_blog
219
 
11
  * Init -- Sets things up.
12
  */
13
  public static function init() {
14
+ self::$admin_notice = "Every first of the month we get at least one or two support requests from alarmed users who think their data has disappeared. Some of them end up leaving <a href='https://wordpress.org/support/topic/limited-service/' target='_blank'>negative reviews</a> because of this, which really sends the wrong message about our plugin. The fundamental misunderstanding has been related to the fact that Slimstat uses the <strong>current month</strong> as the default time range for calculating its reports and metrics. So every first of the month all the reports can look <strong>empty</strong> because there is not much data to be crunched, since the month has just started. In order to address this problem, we've changed the default time range from the current month to the last 20 days. Hopefully this will avoid further negative reviews and take care of those recurring misunderstandings. Please feel free to contact our support team if you have any questions.";
15
+
16
+ // "This has been an incredible year so far for our team. To celebrate all the great achievements, we've decided to launch our Summer Madness Discounts season. From June to September we are offering a crazy FIFTY PERCENT discount on all our premium add-ons. Including the bundles! Extend Slimstat with features like Excel exports, email reports, heatmaps and more, for just a fraction of the price you would normally pay. Not only: if you purchased a premium add-on in April or May, you are eligible for getting back FIFTY PERCENT of what you paid in discounts on future purchases. <strong>ON TOP</strong> of the Summer Madness Discount. Stack both to get basically free add-ons for your website! Please <a href='http://support.wp-slimstat.com' target='_blank'>contact us</a> to get your personal RollBack coupon today or for any questions you might have regarding this promo!"
17
 
18
  self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">Got it, thanks</a>';
19
 
215
  switch_to_blog( $_blog_id );
216
  self::init_environment();
217
  restore_current_blog();
218
+ // wp_slimstat::$settings = get_option( 'slimstat_options', array() );
219
  }
220
  // end new_blog
221
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: analytics, statistics, counter, tracking, reports, wassup, geolocation, on
5
  Text Domain: wp-slimstat
6
  Requires at least: 3.8
7
  Tested up to: 4.8
8
- Stable tag: 4.6.6
9
 
10
  == Description ==
11
  The leading web analytics plugin for WordPress. Track returning customers and registered users, monitor Javascript events, detect intrusions, analyze email campaigns. Thousands of WordPress sites are already using it.
@@ -71,6 +71,14 @@ Our knowledge base is available on our [support center](http://docs.wp-slimstat.
71
  5. **Responsive layout** - Keep an eye on your reports on the go
72
 
73
  == Changelog ==
 
 
 
 
 
 
 
 
74
  = 4.6.6 =
75
  * [New] Super administrators can now decide what reports users will see, and their arrangement both on the dashboard and Slimstat screens (thank you, [ac1643](https://wordpress.org/support/topic/specifying-the-settings-by-user/)). You will need our premium add-on [Network Analysis](https://www.wp-slimstat.com/downloads/network-view/) to unlock this feature.
76
  * [Fix] The `post_link` shortcode attribute was not working as expected when downloads were being listed (thank you, [tophr](https://wordpress.org/support/topic/top-downloads-shortcodewidget-not-working-as-expected)).
5
  Text Domain: wp-slimstat
6
  Requires at least: 3.8
7
  Tested up to: 4.8
8
+ Stable tag: 4.6.7
9
 
10
  == Description ==
11
  The leading web analytics plugin for WordPress. Track returning customers and registered users, monitor Javascript events, detect intrusions, analyze email campaigns. Thousands of WordPress sites are already using it.
71
  5. **Responsive layout** - Keep an eye on your reports on the go
72
 
73
  == Changelog ==
74
+ = 4.6.7 =
75
+ * [Update] Same-domain referrers are now tracked by default, when Slimstat is activated for the first time. Pre-existing installations are not affected. This change will allow us to introduce new features as suggested [by one of our users](https://wordpress.org/support/topic/can-we-see-top-visitor-path/). Stay tuned.
76
+ * [Update] Every first of the month we get at least one or two support requests from alarmed users who think their data has disappeared. Some of them end up leaving [negative reviews](https://wordpress.org/support/topic/limited-service/) because of this. The fundamental misunderstanding was related to the fact that Slimstat uses the CURRENT MONTH time span as the default range for calculating its reports and metrics. So every first of the month all the reports can look "empty" because there is not much data to be crunched. In order to address this problem, we've changed the default time range from the current month to the last 20 days. Hopefully this will avoid further negative reviews in the future!
77
+ * [Fix] There was an incompatibility issue between our premium add-ons Custom DB and Network Settings, causing the network-wide configuration to be reset when a new blog was being created in the network.
78
+ * [Fix] The tracker was not working as expected if the blacklist by usernames contained a @ character (thank you, Eugenio).
79
+ * [Fix] A bug was affecting the way the geolocation function would calculate the country parameter from certain given IP addresses (thank you, Carsten).
80
+ * [Fix] Links with "javascript:" value were being tracked as outbound clicks (thank you, [Luna](https://wordpress.org/support/topic/javascriptvoid0-2)).
81
+
82
  = 4.6.6 =
83
  * [New] Super administrators can now decide what reports users will see, and their arrangement both on the dashboard and Slimstat screens (thank you, [ac1643](https://wordpress.org/support/topic/specifying-the-settings-by-user/)). You will need our premium add-on [Network Analysis](https://www.wp-slimstat.com/downloads/network-view/) to unlock this feature.
84
  * [Fix] The `post_link` shortcode attribute was not working as expected when downloads were being listed (thank you, [tophr](https://wordpress.org/support/topic/top-downloads-shortcodewidget-not-working-as-expected)).
wp-slimstat.js CHANGED
@@ -298,7 +298,7 @@ var SlimStat = {
298
  if ( "undefined" != typeof node.hash && node.hash && node.hostname == location.hostname ) {
299
  resource_url = node.hash;
300
  }
301
- else if ( "undefined" != typeof node.href ) {
302
  resource_url = node.href;
303
  }
304
 
@@ -381,7 +381,7 @@ SlimStat.add_event( window, "load", function() {
381
  // 1: download
382
  // 2: internal (track coordinates only)
383
 
384
- linktype = ( all_links[ i ].href && ( all_links[ i ].hostname == location.hostname || all_links[ i ].href.indexOf( '://' ) == -1 ) ) ? 2 : 0;
385
  tracking = 1;
386
 
387
  // Do not track links with given class names...
298
  if ( "undefined" != typeof node.hash && node.hash && node.hostname == location.hostname ) {
299
  resource_url = node.hash;
300
  }
301
+ else if ( "undefined" != typeof node.href && node.href.indexOf( 'javascript:' ) == -1 ) {
302
  resource_url = node.href;
303
  }
304
 
381
  // 1: download
382
  // 2: internal (track coordinates only)
383
 
384
+ linktype = ( all_links[ i ].href && ( all_links[ i ].hostname == location.hostname || all_links[ i ].href.indexOf( '://' ) == -1 ) || all_links[ i ].href.indexOf( 'javascript:' ) == -1 ) ? 2 : 0;
385
  tracking = 1;
386
 
387
  // Do not track links with given class names...
wp-slimstat.min.js CHANGED
@@ -1 +1 @@
1
- var SlimStat={_id:"undefined"!=typeof SlimStatParams.id?SlimStatParams.id:"-1.0",_base64_key_str:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_plugins:{acrobat:{substrings:["Adobe","Acrobat"],active_x_strings:["AcroPDF.PDF","PDF.PDFCtrl.5"]},pdfviewer:{substrings:["PDF"],active_x_strings:["AcroPDF.PDF"]},flash:{substrings:["Shockwave","Flash"],active_x_strings:["ShockwaveFlash.ShockwaveFlash"]},mediaplayer:{substrings:["Windows Media"],active_x_strings:["WMPlayer.OCX"]},quicktime:{substrings:["QuickTime"],active_x_strings:["QuickTime.QuickTime"]},silverlight:{substrings:["Silverlight"],active_x_strings:["AgControl.AgControl"]}},_utf8_encode:function(a){var b,c,d="";for(a=a.replace(/\r\n/g,"\n"),b=0;b<a.length;b++)c=a.charCodeAt(b),c<128?d+=String.fromCharCode(c):c>127&&c<2048?(d+=String.fromCharCode(c>>6|192),d+=String.fromCharCode(63&c|128)):(d+=String.fromCharCode(c>>12|224),d+=String.fromCharCode(c>>6&63|128),d+=String.fromCharCode(63&c|128));return d},_base64_encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=SlimStat._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+SlimStat._base64_key_str.charAt(e)+SlimStat._base64_key_str.charAt(f)+SlimStat._base64_key_str.charAt(g)+SlimStat._base64_key_str.charAt(h);return i},_detect_single_plugin_not_ie:function(a){var c,d,e,f;for(e in navigator.plugins){c=""+navigator.plugins[e].name+navigator.plugins[e].description,d=0;for(f in SlimStat._plugins[a].substrings)c.indexOf(SlimStat._plugins[a].substrings[f])!=-1&&d++;if(d==SlimStat._plugins[a].substrings.length)return!0}return!1},_detect_single_plugin_ie:function(a){var b="",c=!1;for(b in SlimStat._plugins[a].active_x_strings)try{new ActiveXObject(SlimStat._plugins[a].active_x_strings[b]),c=!0}catch(a){}return c},_detect_single_plugin:function(a){return navigator.plugins.length?this.detect=SlimStat._detect_single_plugin_not_ie:this.detect=SlimStat._detect_single_plugin_ie,this.detect(a)},detect_plugins:function(){var a,b=[];for(a in SlimStat._plugins)SlimStat._detect_single_plugin(a)&&b.push(a);return"function"==typeof navigator.javaEnabled&&navigator.javaEnabled()&&b.push("java"),b.join(",")},get_page_performance:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},"undefined"==typeof slim_performance.timing?0:slim_performance.timing.loadEventEnd-slim_performance.timing.responseEnd},get_server_latency:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},"undefined"==typeof slim_performance.timing?0:slim_performance.timing.responseEnd-slim_performance.timing.connectEnd},add_event:function(a,b,c){a&&a.addEventListener?a.addEventListener(b,c,!1):a&&a.attachEvent?(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event)},a.attachEvent("on"+b,a[b+c])):a["on"+b]=a["e"+b+c]},in_array:function(a,b){for(var c=0;c<b.length;c++)if(b[c].trim()==a)return!0;return!1},in_array_substring:function(a,b){for(var c=0;c<b.length;c++)if(a.indexOf(b[c].trim())!=-1)return!0;return!1},send_to_server:function(a,b){if("undefined"==typeof SlimStatParams.ajaxurl||"undefined"==typeof a)return!1;if("undefined"==typeof b&&(b=!0),slimstat_data_with_client_info=a+"&sw="+screen.width+"&sh="+screen.height+"&bw="+window.innerWidth+"&bh="+window.innerHeight+"&sl="+SlimStat.get_server_latency()+"&pp="+SlimStat.get_page_performance()+"&pl="+SlimStat.detect_plugins(),b&&navigator.sendBeacon)navigator.sendBeacon(SlimStatParams.ajaxurl,slimstat_data_with_client_info);else{try{window.XMLHttpRequest?request=new XMLHttpRequest:window.ActiveXObject&&(request=new ActiveXObject("Microsoft.XMLHTTP"))}catch(a){return!1}if(request)return request.open("POST",SlimStatParams.ajaxurl,!0),request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),request.setRequestHeader("X-Requested-With","XMLHttpRequest"),request.send(slimstat_data_with_client_info),request.onreadystatechange=function(){4==request.readyState&&(parsed_id=parseInt(request.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStat._id=request.responseText))},!0}return!1},ss_track:function(a,b,c,d){if(a=a?a:window.event,b="undefined"==typeof b?0:parseInt(b),note_array=[],"undefined"==typeof d&&(d=!0),parsed_id=parseInt(SlimStat._id),isNaN(parsed_id)||parsed_id<=0)return!1;if(node="undefined"!=typeof a.target?a.target:"undefined"!=typeof a.srcElement&&a.srcElement,!node)return!1;switch(3==node.nodeType&&(node=node.parentNode),parent_node=node.parentNode,resource_url="",node.nodeName){case"FORM":"undefined"!=typeof node.action&&node.action&&(resource_url=node.action);break;case"INPUT":for(;"undefined"!=typeof parent_node&&"FORM"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;if("undefined"!=typeof parent_node.action&&parent_node.action){resource_url=parent_node.action;break}default:if("A"!=node.nodeName)for(;"undefined"!=typeof node.parentNode&&null!=node.parentNode&&"A"!=node.nodeName&&"BODY"!=node.nodeName;)node=node.parentNode;"undefined"!=typeof node.hash&&node.hash&&node.hostname==location.hostname?resource_url=node.hash:"undefined"!=typeof node.href&&(resource_url=node.href),"function"==typeof node.getAttribute&&("undefined"!=typeof node.getAttribute("title")&&node.getAttribute("title")&&note_array.push("Title:"+node.getAttribute("title")),"undefined"!=typeof node.getAttribute("id")&&node.getAttribute("id")&&note_array.push("ID:"+node.getAttribute("id")))}return pos_x=-1,pos_y=-1,position="","undefined"!=typeof a.pageX&&"undefined"!=typeof a.pageY?(pos_x=a.pageX,pos_y=a.pageY):"undefined"!=typeof a.clientX&&"undefined"!=typeof a.clientY&&"undefined"!=typeof document.body.scrollLeft&&"undefined"!=typeof document.documentElement.scrollLeft&&"undefined"!=typeof document.body.scrollTop&&"undefined"!=typeof document.documentElement.scrollTop&&(pos_x=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,pos_y=a.clientY+document.body.scrollTop+document.documentElement.scrollTop),pos_x>0&&pos_y>0&&(position=pos_x+","+pos_y),event_description=a.type,"keypress"==a.type?event_description+="; keypress:"+String.fromCharCode(parseInt(a.which)):"click"==a.type&&(event_description+="; which:"+a.which),"undefined"!=typeof c&&c&&note_array.push(c),note_string=SlimStat._base64_encode(note_array.join(", ")),requested_op="add",1==b?resource_url=resource_url.substring(resource_url.indexOf(location.hostname)+location.hostname.length):0!=b&&2!=b||(requested_op="update"),SlimStat.send_to_server("action=slimtrack&op="+requested_op+"&id="+SlimStat._id+"&ty="+b+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(resource_url)+"&pos="+position+"&des="+SlimStat._base64_encode(event_description)+"&no="+note_string,d),!0}};"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),SlimStat.add_event(window,"load",function(){all_links=document.getElementsByTagName("a");for(var a="undefined"!=typeof SlimStatParams.extensions_to_track&&SlimStatParams.extensions_to_track?SlimStatParams.extensions_to_track.split(","):[],b="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_not_track&&SlimStatParams.outbound_classes_rel_href_to_not_track?SlimStatParams.outbound_classes_rel_href_to_not_track.split(","):[],c=0;c<all_links.length;c++){if(linktype=!all_links[c].href||all_links[c].hostname!=location.hostname&&all_links[c].href.indexOf("://")!=-1?0:2,tracking=1,b.length>0){if(1==tracking){classes_current_link="undefined"!=typeof all_links[c].className&&all_links[c].className?all_links[c].className.split(" "):[];for(var d=0;d<classes_current_link.length;d++)if(SlimStat.in_array_substring(classes_current_link[d],b)){tracking=0;break}}1==tracking&&"undefined"!=typeof all_links[c].attributes.rel&&all_links[c].attributes.rel.value&&SlimStat.in_array_substring(all_links[c].attributes.rel.value,b)&&(tracking=0),1==tracking&&"undefined"!=typeof all_links[c].href&&all_links[c].href&&SlimStat.in_array_substring(all_links[c].href,b)&&(tracking=0)}extension_current_link=all_links[c].pathname.split(/[?#]/)[0].split(".").pop().replace(/[\/\-]/g,""),2==linktype&&a.length>0&&SlimStat.in_array(extension_current_link,a)&&(tracking=1,linktype=1),all_links[c].setAttribute("data-slimstat",(linktype<<1)+tracking),SlimStat.add_event(all_links[c],"click",function(a){link_info=parseInt(this.getAttribute("data-slimstat")),isNaN(link_info)&&(link_info=0),link_info&!0&&SlimStat.ss_track(a,link_info>>1,"")})}});var slimstat_data="",use_beacon=!0;"undefined"!=typeof SlimStatParams.id&&parseInt(SlimStatParams.id)>0?slimstat_data="action=slimtrack&op=update&id="+SlimStatParams.id:"undefined"!=typeof SlimStatParams.ci&&(slimstat_data="action=slimtrack&op=add&id="+SlimStatParams.ci+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href),use_beacon=!1),slimstat_data.length>0&&SlimStat.add_event(window,"load",function(){setTimeout(function(){SlimStat.send_to_server(slimstat_data,"")},0)});
1
+ var SlimStat={_id:void 0!==SlimStatParams.id?SlimStatParams.id:"-1.0",_base64_key_str:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_plugins:{acrobat:{substrings:["Adobe","Acrobat"],active_x_strings:["AcroPDF.PDF","PDF.PDFCtrl.5"]},pdfviewer:{substrings:["PDF"],active_x_strings:["AcroPDF.PDF"]},flash:{substrings:["Shockwave","Flash"],active_x_strings:["ShockwaveFlash.ShockwaveFlash"]},mediaplayer:{substrings:["Windows Media"],active_x_strings:["WMPlayer.OCX"]},quicktime:{substrings:["QuickTime"],active_x_strings:["QuickTime.QuickTime"]},silverlight:{substrings:["Silverlight"],active_x_strings:["AgControl.AgControl"]}},_utf8_encode:function(a){var b,c,d="";for(a=a.replace(/\r\n/g,"\n"),b=0;b<a.length;b++)c=a.charCodeAt(b),c<128?d+=String.fromCharCode(c):c>127&&c<2048?(d+=String.fromCharCode(c>>6|192),d+=String.fromCharCode(63&c|128)):(d+=String.fromCharCode(c>>12|224),d+=String.fromCharCode(c>>6&63|128),d+=String.fromCharCode(63&c|128));return d},_base64_encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=SlimStat._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+SlimStat._base64_key_str.charAt(e)+SlimStat._base64_key_str.charAt(f)+SlimStat._base64_key_str.charAt(g)+SlimStat._base64_key_str.charAt(h);return i},_detect_single_plugin_not_ie:function(a){var c,d,e,f;for(e in navigator.plugins){c=""+navigator.plugins[e].name+navigator.plugins[e].description,d=0;for(f in SlimStat._plugins[a].substrings)-1!=c.indexOf(SlimStat._plugins[a].substrings[f])&&d++;if(d==SlimStat._plugins[a].substrings.length)return!0}return!1},_detect_single_plugin_ie:function(a){var b="",c=!1;for(b in SlimStat._plugins[a].active_x_strings)try{new ActiveXObject(SlimStat._plugins[a].active_x_strings[b]),c=!0}catch(a){}return c},_detect_single_plugin:function(a){return navigator.plugins.length?this.detect=SlimStat._detect_single_plugin_not_ie:this.detect=SlimStat._detect_single_plugin_ie,this.detect(a)},detect_plugins:function(){var a,b=[];for(a in SlimStat._plugins)SlimStat._detect_single_plugin(a)&&b.push(a);return"function"==typeof navigator.javaEnabled&&navigator.javaEnabled()&&b.push("java"),b.join(",")},get_page_performance:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},void 0===slim_performance.timing?0:slim_performance.timing.loadEventEnd-slim_performance.timing.responseEnd},get_server_latency:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},void 0===slim_performance.timing?0:slim_performance.timing.responseEnd-slim_performance.timing.connectEnd},add_event:function(a,b,c){a&&a.addEventListener?a.addEventListener(b,c,!1):a&&a.attachEvent?(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event)},a.attachEvent("on"+b,a[b+c])):a["on"+b]=a["e"+b+c]},in_array:function(a,b){for(var c=0;c<b.length;c++)if(b[c].trim()==a)return!0;return!1},in_array_substring:function(a,b){for(var c=0;c<b.length;c++)if(-1!=a.indexOf(b[c].trim()))return!0;return!1},send_to_server:function(a,b){if(void 0===SlimStatParams.ajaxurl||void 0===a)return!1;if(void 0===b&&(b=!0),slimstat_data_with_client_info=a+"&sw="+screen.width+"&sh="+screen.height+"&bw="+window.innerWidth+"&bh="+window.innerHeight+"&sl="+SlimStat.get_server_latency()+"&pp="+SlimStat.get_page_performance()+"&pl="+SlimStat.detect_plugins(),b&&navigator.sendBeacon)navigator.sendBeacon(SlimStatParams.ajaxurl,slimstat_data_with_client_info);else{try{window.XMLHttpRequest?request=new XMLHttpRequest:window.ActiveXObject&&(request=new ActiveXObject("Microsoft.XMLHTTP"))}catch(a){return!1}if(request)return request.open("POST",SlimStatParams.ajaxurl,!0),request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),request.setRequestHeader("X-Requested-With","XMLHttpRequest"),request.send(slimstat_data_with_client_info),request.onreadystatechange=function(){4==request.readyState&&(parsed_id=parseInt(request.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStat._id=request.responseText))},!0}return!1},ss_track:function(a,b,c,d){if(a=a||window.event,b=void 0===b?0:parseInt(b),note_array=[],void 0===d&&(d=!0),parsed_id=parseInt(SlimStat._id),isNaN(parsed_id)||parsed_id<=0)return!1;if(node=void 0!==a.target?a.target:void 0!==a.srcElement&&a.srcElement,!node)return!1;switch(3==node.nodeType&&(node=node.parentNode),parent_node=node.parentNode,resource_url="",node.nodeName){case"FORM":void 0!==node.action&&node.action&&(resource_url=node.action);break;case"INPUT":for(;"undefined"!=typeof parent_node&&"FORM"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;if(void 0!==parent_node.action&&parent_node.action){resource_url=parent_node.action;break}default:if("A"!=node.nodeName)for(;void 0!==node.parentNode&&null!=node.parentNode&&"A"!=node.nodeName&&"BODY"!=node.nodeName;)node=node.parentNode;void 0!==node.hash&&node.hash&&node.hostname==location.hostname?resource_url=node.hash:void 0!==node.href&&-1==node.href.indexOf("javascript:")&&(resource_url=node.href),"function"==typeof node.getAttribute&&(void 0!==node.getAttribute("title")&&node.getAttribute("title")&&note_array.push("Title:"+node.getAttribute("title")),void 0!==node.getAttribute("id")&&node.getAttribute("id")&&note_array.push("ID:"+node.getAttribute("id")))}return pos_x=-1,pos_y=-1,position="",void 0!==a.pageX&&void 0!==a.pageY?(pos_x=a.pageX,pos_y=a.pageY):void 0!==a.clientX&&void 0!==a.clientY&&void 0!==document.body.scrollLeft&&void 0!==document.documentElement.scrollLeft&&void 0!==document.body.scrollTop&&void 0!==document.documentElement.scrollTop&&(pos_x=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,pos_y=a.clientY+document.body.scrollTop+document.documentElement.scrollTop),pos_x>0&&pos_y>0&&(position=pos_x+","+pos_y),event_description=a.type,"keypress"==a.type?event_description+="; keypress:"+String.fromCharCode(parseInt(a.which)):"click"==a.type&&(event_description+="; which:"+a.which),void 0!==c&&c&&note_array.push(c),note_string=SlimStat._base64_encode(note_array.join(", ")),requested_op="add",1==b?resource_url=resource_url.substring(resource_url.indexOf(location.hostname)+location.hostname.length):0!=b&&2!=b||(requested_op="update"),SlimStat.send_to_server("action=slimtrack&op="+requested_op+"&id="+SlimStat._id+"&ty="+b+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(resource_url)+"&pos="+position+"&des="+SlimStat._base64_encode(event_description)+"&no="+note_string,d),!0}};"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),SlimStat.add_event(window,"load",function(){all_links=document.getElementsByTagName("a");for(var a=void 0!==SlimStatParams.extensions_to_track&&SlimStatParams.extensions_to_track?SlimStatParams.extensions_to_track.split(","):[],b=void 0!==SlimStatParams.outbound_classes_rel_href_to_not_track&&SlimStatParams.outbound_classes_rel_href_to_not_track?SlimStatParams.outbound_classes_rel_href_to_not_track.split(","):[],c=0;c<all_links.length;c++){if(linktype=all_links[c].href&&(all_links[c].hostname==location.hostname||-1==all_links[c].href.indexOf("://"))||-1==all_links[c].href.indexOf("javascript:")?2:0,tracking=1,b.length>0){if(1==tracking){classes_current_link=void 0!==all_links[c].className&&all_links[c].className?all_links[c].className.split(" "):[];for(var d=0;d<classes_current_link.length;d++)if(SlimStat.in_array_substring(classes_current_link[d],b)){tracking=0;break}}1==tracking&&void 0!==all_links[c].attributes.rel&&all_links[c].attributes.rel.value&&SlimStat.in_array_substring(all_links[c].attributes.rel.value,b)&&(tracking=0),1==tracking&&void 0!==all_links[c].href&&all_links[c].href&&SlimStat.in_array_substring(all_links[c].href,b)&&(tracking=0)}extension_current_link=all_links[c].pathname.split(/[?#]/)[0].split(".").pop().replace(/[\/\-]/g,""),2==linktype&&a.length>0&&SlimStat.in_array(extension_current_link,a)&&(tracking=1,linktype=1),all_links[c].setAttribute("data-slimstat",(linktype<<1)+tracking),SlimStat.add_event(all_links[c],"click",function(a){link_info=parseInt(this.getAttribute("data-slimstat")),isNaN(link_info)&&(link_info=0),!0&link_info&&SlimStat.ss_track(a,link_info>>1,"")})}});var slimstat_data="",use_beacon=!0;void 0!==SlimStatParams.id&&parseInt(SlimStatParams.id)>0?slimstat_data="action=slimtrack&op=update&id="+SlimStatParams.id:void 0!==SlimStatParams.ci&&(slimstat_data="action=slimtrack&op=add&id="+SlimStatParams.ci+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href),use_beacon=!1),slimstat_data.length>0&&SlimStat.add_event(window,"load",function(){setTimeout(function(){SlimStat.send_to_server(slimstat_data,"")},0)});
wp-slimstat.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: http://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
- Version: 4.6.6
7
  Author: Jason Crouse
8
  Author URI: http://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
@@ -15,7 +15,7 @@ if ( !empty( wp_slimstat::$settings ) ) {
15
  }
16
 
17
  class wp_slimstat {
18
- public static $version = '4.6.6';
19
  public static $settings = array();
20
  public static $options = array(); // To be removed, here just for backward compatibility
21
 
@@ -490,7 +490,7 @@ class wp_slimstat {
490
 
491
  // Country and Language
492
  self::$stat[ 'language' ] = self::_get_language();
493
- self::$stat[ 'country' ] = self::get_country(self::$stat[ 'ip' ]);
494
 
495
  // Anonymize IP Address?
496
  if ( self::$settings[ 'anonymize_ip' ] == 'yes' ) {
@@ -633,18 +633,19 @@ class wp_slimstat {
633
  * Searches for the country code associated to a given IP address
634
  */
635
  public static function get_country( $_ip_address = '0.0.0.0' ){
636
- $float_ipnum = (float) sprintf( "%u", bindec( self::dtr_pton( $_ip_address ) ) );
637
  $country_output = 'xx';
638
 
639
  // Is this a RFC1918 (local) IP?
640
- if ($float_ipnum == 2130706433 || // 127.0.0.1
641
- ($float_ipnum >= 167772160 && $float_ipnum <= 184549375) || // 10.0.0.1 - 10.255.255.255
642
- ($float_ipnum >= 2886729728 && $float_ipnum <= 2887778303) || // 172.16.0.1 - 172.31.255.255
643
- ($float_ipnum >= 3232235521 && $float_ipnum <= 3232301055) ){ // 192.168.0.1 - 192.168.255.255
644
  $country_output = 'xy';
645
  }
646
  else {
647
  $country_codes = array("","ap","eu","ad","ae","af","ag","ai","al","am","cw","ao","aq","ar","as","at","au","aw","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","sx","ga","gb","gd","ge","gf","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","in","io","iq","ir","is","it","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","st","sv","sy","sz","tc","td","tf","tg","th","tj","tk","tm","tn","to","tl","tr","tt","tv","tw","tz","ua","ug","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","ye","yt","rs","za","zm","me","zw","a1","a2","o1","ax","gg","im","je","bl","mf","bq","ss","o1");
 
648
  if ( file_exists( self::$maxmind_path ) && ( $handle = fopen( self::$maxmind_path, "rb" ) ) ) {
649
 
650
  // Do we need to update the file?
@@ -663,11 +664,11 @@ class wp_slimstat {
663
  }
664
 
665
  $offset = 0;
666
- for ($depth = 31; $depth >= 0; --$depth) {
667
- if (fseek($handle, 6 * $offset, SEEK_SET) != 0){
668
  break;
669
  }
670
- $buf = fread($handle, 6);
671
  $x = array(0,0);
672
  for ($i = 0; $i < 2; ++$i) {
673
  for ($j = 0; $j < 3; ++$j) {
@@ -675,7 +676,7 @@ class wp_slimstat {
675
  }
676
  }
677
 
678
- if ( $float_ipnum & ( 1 << $depth ) ) {
679
  if ($x[1] >= 16776960 && !empty($country_codes[$x[1] - 16776960])) {
680
  $country_output = $country_codes[$x[1] - 16776960];
681
  break;
@@ -692,7 +693,6 @@ class wp_slimstat {
692
  fclose($handle);
693
  }
694
  }
695
-
696
  return apply_filters( 'slimstat_get_country', $country_output, $_ip_address );
697
  }
698
  // end get_country
@@ -771,7 +771,7 @@ class wp_slimstat {
771
  $ip_array = array( '', '' );
772
 
773
  if ( !empty( $_SERVER[ 'REMOTE_ADDR' ] ) && filter_var( $_SERVER[ 'REMOTE_ADDR' ], FILTER_VALIDATE_IP ) !== false ) {
774
- $ip_array[ 0 ] = $_SERVER["REMOTE_ADDR"];
775
  }
776
 
777
  $originating_ip_headers = array( 'X-Forwarded-For', 'HTTP_X_FORWARDED_FOR', 'CF-Connecting-IP', 'HTTP_CLIENT_IP', 'HTTP_X_REAL_IP', 'HTTP_FORWARDED', 'HTTP_X_FORWARDED' );
@@ -852,7 +852,7 @@ class wp_slimstat {
852
  }
853
 
854
  if ( !empty( $_url[ 'host' ] ) ) {
855
- preg_match( "/($regex_match)./i", $_url[ 'host' ], $matches );
856
  }
857
 
858
  if ( !empty( $matches[ 1 ] ) ) {
@@ -1107,7 +1107,7 @@ class wp_slimstat {
1107
 
1108
  protected static function _is_blacklisted( $_needles = array(), $_haystack_string = '', $_return_error_code = array( 0, '', false ) ) {
1109
  foreach ( self::string_to_array( $_haystack_string ) as $a_item ) {
1110
- $pattern = str_replace( array( '\*', '\!' ) , array( '(.*)', '.' ), preg_quote( $a_item, '/' ) );
1111
 
1112
  if ( !is_array( $_needles ) ) {
1113
  $_needles = array( $_needles );
@@ -1445,7 +1445,7 @@ class wp_slimstat {
1445
  // Tracker
1446
  'do_not_track_outbound_classes_rel_href' => 'noslimstat,ab-item',
1447
  'extensions_to_track' => 'pdf,doc,xls,zip',
1448
- 'track_same_domain_referers' => 'no',
1449
  'session_duration' => 1800,
1450
  'extend_session' => 'no',
1451
  'enable_cdn' => 'yes',
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: http://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
+ Version: 4.6.7
7
  Author: Jason Crouse
8
  Author URI: http://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
15
  }
16
 
17
  class wp_slimstat {
18
+ public static $version = '4.6.7';
19
  public static $settings = array();
20
  public static $options = array(); // To be removed, here just for backward compatibility
21
 
490
 
491
  // Country and Language
492
  self::$stat[ 'language' ] = self::_get_language();
493
+ self::$stat[ 'country' ] = self::get_country( self::$stat[ 'ip' ] );
494
 
495
  // Anonymize IP Address?
496
  if ( self::$settings[ 'anonymize_ip' ] == 'yes' ) {
633
  * Searches for the country code associated to a given IP address
634
  */
635
  public static function get_country( $_ip_address = '0.0.0.0' ){
636
+ $ipnum = ip2long( $_ip_address );
637
  $country_output = 'xx';
638
 
639
  // Is this a RFC1918 (local) IP?
640
+ if ( $ipnum == 2130706433 || // 127.0.0.1
641
+ ( $ipnum >= 167772160 && $ipnum <= 184549375 ) || // 10.0.0.1 - 10.255.255.255
642
+ ( $ipnum >= 2886729728 && $ipnum <= 2887778303 ) || // 172.16.0.1 - 172.31.255.255
643
+ ( $ipnum >= 3232235521 && $ipnum <= 3232301055 ) ) { // 192.168.0.1 - 192.168.255.255
644
  $country_output = 'xy';
645
  }
646
  else {
647
  $country_codes = array("","ap","eu","ad","ae","af","ag","ai","al","am","cw","ao","aq","ar","as","at","au","aw","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","sx","ga","gb","gd","ge","gf","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","in","io","iq","ir","is","it","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","st","sv","sy","sz","tc","td","tf","tg","th","tj","tk","tm","tn","to","tl","tr","tt","tv","tw","tz","ua","ug","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","ye","yt","rs","za","zm","me","zw","a1","a2","o1","ax","gg","im","je","bl","mf","bq","ss","o1");
648
+
649
  if ( file_exists( self::$maxmind_path ) && ( $handle = fopen( self::$maxmind_path, "rb" ) ) ) {
650
 
651
  // Do we need to update the file?
664
  }
665
 
666
  $offset = 0;
667
+ for ( $depth = 31; $depth >= 0; --$depth ) {
668
+ if ( fseek($handle, 6 * $offset, SEEK_SET ) != 0 ) {
669
  break;
670
  }
671
+ $buf = fread( $handle, 6 );
672
  $x = array(0,0);
673
  for ($i = 0; $i < 2; ++$i) {
674
  for ($j = 0; $j < 3; ++$j) {
676
  }
677
  }
678
 
679
+ if ( $ipnum & ( 1 << $depth ) ) {
680
  if ($x[1] >= 16776960 && !empty($country_codes[$x[1] - 16776960])) {
681
  $country_output = $country_codes[$x[1] - 16776960];
682
  break;
693
  fclose($handle);
694
  }
695
  }
 
696
  return apply_filters( 'slimstat_get_country', $country_output, $_ip_address );
697
  }
698
  // end get_country
771
  $ip_array = array( '', '' );
772
 
773
  if ( !empty( $_SERVER[ 'REMOTE_ADDR' ] ) && filter_var( $_SERVER[ 'REMOTE_ADDR' ], FILTER_VALIDATE_IP ) !== false ) {
774
+ $ip_array[ 0 ] = $_SERVER[ 'REMOTE_ADDR' ];
775
  }
776
 
777
  $originating_ip_headers = array( 'X-Forwarded-For', 'HTTP_X_FORWARDED_FOR', 'CF-Connecting-IP', 'HTTP_CLIENT_IP', 'HTTP_X_REAL_IP', 'HTTP_FORWARDED', 'HTTP_X_FORWARDED' );
852
  }
853
 
854
  if ( !empty( $_url[ 'host' ] ) ) {
855
+ preg_match( "~($regex_match).~i", $_url[ 'host' ], $matches );
856
  }
857
 
858
  if ( !empty( $matches[ 1 ] ) ) {
1107
 
1108
  protected static function _is_blacklisted( $_needles = array(), $_haystack_string = '', $_return_error_code = array( 0, '', false ) ) {
1109
  foreach ( self::string_to_array( $_haystack_string ) as $a_item ) {
1110
+ $pattern = str_replace( array( '\*', '\!' ) , array( '(.*)', '.' ), preg_quote( $a_item, '@' ) );
1111
 
1112
  if ( !is_array( $_needles ) ) {
1113
  $_needles = array( $_needles );
1445
  // Tracker
1446
  'do_not_track_outbound_classes_rel_href' => 'noslimstat,ab-item',
1447
  'extensions_to_track' => 'pdf,doc,xls,zip',
1448
+ 'track_same_domain_referers' => 'yes',
1449
  'session_duration' => 1800,
1450
  'extend_session' => 'no',
1451
  'enable_cdn' => 'yes',