Slimstat Analytics - Version 4.1.2

Version Description

  • [Note] A few weeks ago we started hitting the limits imposed on our site by our existing hosting provider. It was clearly time to find a new home for Slimstat. We've been working on migrating our web platform (website and add-on repository API) to a new more powerful server, and a new domain: wp-slimstat.com.
  • [Note] Our dev team has released updates for our premium add-ons Export to Excel, Email Reports and User Overview, which are now fully compatible with Slimstat 4. Go get your copy today.
  • [Update] More adjustments to streamline the report API and make it easier for our users to add new custom reports.
  • [Update] Restored the following reports: Recent/Top Downloads, Recent/Top Outbound Links, Top Entry Pages, Top Exit Pages.
  • [Fix] Bug preventing some outbound links to be properly tracked.
  • [Fix] In a Windows Server environment, the way the checkboxes are added under Screen Options was creating some issues (thank you, Rafael Ortman).
  • [Fix] Post and page titles were not being displayed when the corresponding option was set
Download this release

Release Info

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

Code changes from version 4.1.1 to 4.1.2

admin/config/addons.php CHANGED
@@ -25,6 +25,7 @@ if (!is_array($list_addons)){
25
  echo '<p>'.__('There was an error decoding the add-ons list from the server. Please try again later.','wp-slimstat').'</p></div>';
26
  return;
27
  }
 
28
  ?>
29
 
30
  <div class="wrap slimstat">
@@ -32,8 +33,8 @@ if (!is_array($list_addons)){
32
  <p><?php _e('Add-ons extend the functionality of Slimstat in many interesting ways. We offer both free and premium (paid) extensions. Each add-on can be installed as a separate plugin, which will receive regular updates via the WordPress Plugins panel. In order to be notified when a new version of a premium add-on is available, please enter the <strong>license key</strong> you received when you purchased it.','wp-slimstat') ?>
33
  <?php
34
  if (empty($_GET['force_refresh'])){
35
-
36
- printf(__('This list is cached daily on your server: <a href="%s&amp;force_refresh=true">click here</a> to clear the cache.','wp-slimstat'), $_SERVER['REQUEST_URI']);
37
  }
38
  ?>
39
  </p>
@@ -52,12 +53,16 @@ if (!is_array($list_addons)){
52
  <th scope="row" class="plugin-title">
53
  <strong><a target="_blank" href="<?php echo $a_addon['download_url'] ?>"><?php echo $a_addon['name'] ?></a></strong>
54
  <div class="row-actions-visible"><?php
55
- if (is_plugin_active($a_addon['slug'].'/index.php') || is_plugin_active($a_addon['slug'].'/'.$a_addon['slug'].'.php')){
56
- echo 'Latest Version: '.$a_addon['version'].'<br/>Installed and Active';
 
 
 
 
57
  $at_least_one_add_on_active = true;
58
  }
59
  else{
60
- echo 'Latest Version: '.$a_addon['version'].'<br/>Price: '.(is_numeric($a_addon['price'])?'$'.$a_addon['price']:$a_addon['price']);
61
  } ?>
62
  </div>
63
  </th>
25
  echo '<p>'.__('There was an error decoding the add-ons list from the server. Please try again later.','wp-slimstat').'</p></div>';
26
  return;
27
  }
28
+
29
  ?>
30
 
31
  <div class="wrap slimstat">
33
  <p><?php _e('Add-ons extend the functionality of Slimstat in many interesting ways. We offer both free and premium (paid) extensions. Each add-on can be installed as a separate plugin, which will receive regular updates via the WordPress Plugins panel. In order to be notified when a new version of a premium add-on is available, please enter the <strong>license key</strong> you received when you purchased it.','wp-slimstat') ?>
34
  <?php
35
  if (empty($_GET['force_refresh'])){
36
+ echo ' ';
37
+ printf(__('This list is refreshed once daily: <a href="%s&amp;force_refresh=true">click here</a> to clear the cache.','wp-slimstat'), $_SERVER['REQUEST_URI']);
38
  }
39
  ?>
40
  </p>
53
  <th scope="row" class="plugin-title">
54
  <strong><a target="_blank" href="<?php echo $a_addon['download_url'] ?>"><?php echo $a_addon['name'] ?></a></strong>
55
  <div class="row-actions-visible"><?php
56
+ if ( !empty( $a_addon['version'] ) ) {
57
+ echo 'Version: '.$a_addon['version'].'<br/>';
58
+ }
59
+
60
+ if ( $is_active ){
61
+ echo 'Installed and Active';
62
  $at_least_one_add_on_active = true;
63
  }
64
  else{
65
+ echo 'Price: '.(is_numeric($a_addon['price'])?'$'.$a_addon['price']:$a_addon['price']);
66
  } ?>
67
  </div>
68
  </th>
admin/css/slimstat.css CHANGED
@@ -137,9 +137,11 @@
137
  .wrap.slimstat .postbox.wide{
138
  width:65.8%
139
  }
 
 
 
140
  .wrap.slimstat .postbox.tall{
141
  height:661px;
142
- width:100%;
143
  }
144
 
145
  .sortable-placeholder{
137
  .wrap.slimstat .postbox.wide{
138
  width:65.8%
139
  }
140
+ .wrap.slimstat .postbox.full-width{
141
+ width:99%
142
+ }
143
  .wrap.slimstat .postbox.tall{
144
  height:661px;
 
145
  }
146
 
147
  .sortable-placeholder{
admin/view/index.php CHANGED
@@ -142,14 +142,14 @@
142
  <form method="get" action=""><input type="hidden" id="meta-box-order-nonce" name="meta-box-order-nonce" value="<?php echo wp_create_nonce('meta-box-order') ?>" /></form><?php
143
 
144
  foreach( wp_slimstat_reports::$reports_info as $a_report_id => $a_report_info ) {
145
- if ( empty( $a_report_info[ 'screens' ] ) || !in_array( $_GET[ 'page' ], $a_report_info[ 'screens' ] ) ) {
146
  continue;
147
  }
148
 
149
  wp_slimstat_reports::report_header( $a_report_id );
150
 
151
- // Third party reports will extend wp_slimstat_reports and add their own methods
152
- call_user_func( array( 'wp_slimstat_reports', 'callback_wrapper' ), array( 'id' => $a_report_id ) );
153
 
154
  wp_slimstat_reports::report_footer();
155
  }
142
  <form method="get" action=""><input type="hidden" id="meta-box-order-nonce" name="meta-box-order-nonce" value="<?php echo wp_create_nonce('meta-box-order') ?>" /></form><?php
143
 
144
  foreach( wp_slimstat_reports::$reports_info as $a_report_id => $a_report_info ) {
145
+ if ( empty( $a_report_info[ 'screens' ] ) || !in_array( $_GET[ 'page' ], $a_report_info[ 'screens' ] ) || in_array( 'hidden', $a_report_info[ 'classes' ] ) ) {
146
  continue;
147
  }
148
 
149
  wp_slimstat_reports::report_header( $a_report_id );
150
 
151
+ // Third party reports can add their own methods via the callback parameter
152
+ wp_slimstat_reports::callback_wrapper( array( 'id' => $a_report_id ) );
153
 
154
  wp_slimstat_reports::report_footer();
155
  }
admin/view/wp-slimstat-db.php CHANGED
@@ -76,6 +76,7 @@ class wp_slimstat_db {
76
  'interval_minutes' => array( __( 'minutes', 'wp-slimstat' ), 'int' ),
77
  'dt' => array( __( 'Unix Timestamp', 'wp-slimstat' ), 'int' ),
78
 
 
79
  'limit_results' => array( __( 'Limit Results', 'wp-slimstat' ), 'int' ),
80
  'start_from' => array( __( 'Start From', 'wp-slimstat' ), 'int' ),
81
 
@@ -83,6 +84,9 @@ class wp_slimstat_db {
83
  'strtotime' => array( 0, 'int' )
84
  ), self::$columns_names );
85
 
 
 
 
86
  // Hook for the... filters
87
  $_filters = apply_filters( 'slimstat_db_pre_filters', $_filters );
88
 
@@ -246,7 +250,7 @@ class wp_slimstat_db {
246
  echo "<p class='debug'>$_message</p>";
247
  }
248
 
249
- protected static function _get_results( $_sql = '', $_select_no_aggregate_values = '', $_order_by = '', $_group_by = '', $_aggregate_values_add = '' ) {
250
  $_sql = apply_filters( 'slimstat_get_results_sql', $_sql, $_select_no_aggregate_values, $_order_by, $_group_by, $_aggregate_values_add );
251
 
252
  if ( wp_slimstat::$options[ 'show_sql_debug' ] == 'yes' ) {
@@ -256,7 +260,7 @@ class wp_slimstat_db {
256
  return wp_slimstat::$wpdb->get_results( $_sql, ARRAY_A );
257
  }
258
 
259
- protected static function _get_var( $_sql = '', $_aggregate_value = '' ) {
260
  $_sql = apply_filters( 'slimstat_get_var_sql', $_sql, $_aggregate_value );
261
 
262
  if ( wp_slimstat::$options[ 'show_sql_debug' ] == 'yes' ) {
@@ -274,6 +278,7 @@ class wp_slimstat_db {
274
  'is_past' => false
275
  ),
276
  'misc' => $_init_misc?array(
 
277
  'limit_results' => wp_slimstat::$options[ 'rows_to_show' ],
278
  'start_from' => 0
279
  ) : array(),
@@ -382,6 +387,7 @@ class wp_slimstat_db {
382
  $filters_normalized[ 'date' ][ $a_filter[ 1 ] ] = in_array( $a_filter[ 3 ], array( 'plus', 'minus' ) ) ? $a_filter[ 3 ] : 'plus';
383
  break;
384
 
 
385
  case 'limit_results':
386
  case 'start_from':
387
  $filters_normalized[ 'misc' ][ $a_filter[ 1 ] ] = str_replace( '\\', '', htmlspecialchars_decode( $a_filter[ 3 ] ) );
@@ -521,7 +527,7 @@ class wp_slimstat_db {
521
  public static function count_bouncing_pages() {
522
  $where = self::get_combined_where( 'visit_id > 0 AND content_type <> "404"', 'resource' );
523
 
524
- return intval( self::_get_var( "
525
  SELECT COUNT(*) counthits
526
  FROM (
527
  SELECT resource, visit_id
@@ -536,7 +542,7 @@ class wp_slimstat_db {
536
  public static function count_exit_pages() {
537
  $where = self::get_combined_where( 'visit_id > 0', 'resource' );
538
 
539
- return intval( self::_get_var( "
540
  SELECT COUNT(*) counthits
541
  FROM (
542
  SELECT resource, dt
@@ -552,7 +558,7 @@ class wp_slimstat_db {
552
  $distinct_column = ( $_column != 'id' ) ? "DISTINCT $_column" : $_column;
553
  $_where = self::get_combined_where( $_where, $_column, $_use_time_range );
554
 
555
- return intval( self::_get_var( "
556
  SELECT COUNT($distinct_column) counthits
557
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
558
  WHERE $_where",
@@ -562,7 +568,7 @@ class wp_slimstat_db {
562
  public static function count_records_having( $_column = 'id', $_where = '', $_having = '' ) {
563
  $_where = self::get_combined_where( $_where, $_column );
564
 
565
- return intval( self::_get_var( "
566
  SELECT COUNT(*) counthits FROM (
567
  SELECT $_column
568
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
@@ -633,7 +639,7 @@ class wp_slimstat_db {
633
  $group_by_string";
634
 
635
  // Get the data
636
- $results = self::_get_results( $sql, 'blog_id', '', $group_by_string, 'SUM(first_metric) AS first_metric, SUM(second_metric) AS second_metric' );
637
 
638
  // Fill the output array
639
  $output[ 'current' ][ 'label' ] = '';
@@ -696,7 +702,7 @@ class wp_slimstat_db {
696
  public static function get_max_and_average_pages_per_visit() {
697
  $where = self::get_combined_where( 'visit_id > 0' );
698
 
699
- return self::_get_results( "
700
  SELECT AVG(ts1.counthits) AS avghits, MAX(ts1.counthits) AS maxhits FROM (
701
  SELECT count(ip) counthits, visit_id
702
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
@@ -710,7 +716,7 @@ class wp_slimstat_db {
710
  }
711
 
712
  public static function get_oldest_visit() {
713
- return self::_get_var( "
714
  SELECT dt
715
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
716
  ORDER BY dt ASC
@@ -729,7 +735,7 @@ class wp_slimstat_db {
729
  $_where = self::get_combined_where( $_where, $_column, $_use_time_range );
730
 
731
  if ( $_column == '*' ) {
732
- return self::_get_results( "
733
  SELECT *
734
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
735
  WHERE $_where
@@ -739,7 +745,7 @@ class wp_slimstat_db {
739
  'dt DESC' );
740
  }
741
  else {
742
- return self::_get_results( "
743
  SELECT t1.*
744
  FROM (
745
  SELECT $_column, MAX(id) maxid
@@ -764,7 +770,7 @@ class wp_slimstat_db {
764
 
765
  $_where = self::get_combined_where( $_where, $_as_column, $_use_time_range );
766
 
767
- return self::_get_results( "
768
  SELECT $_column, COUNT(*) counthits
769
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
770
  WHERE $_where
@@ -777,23 +783,23 @@ class wp_slimstat_db {
777
  'SUM(counthits) AS counthits' );
778
  }
779
 
780
- public static function get_top_complete( $_column = 'id', $_where = '', $_outer_select_column = '', $_aggr_function = 'MAX' ) {
781
  $_where = self::get_combined_where( $_where, $_column );
782
 
783
- return self::_get_results( "
784
- SELECT $_outer_select_column, ts1.maxid, COUNT(*) counthits
785
  FROM (
786
- SELECT $_column, $_aggr_function(id) maxid
787
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
788
  WHERE $_where
789
  GROUP BY $_column
790
- ) AS ts1 JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON ts1.maxid = t1.id
791
  GROUP BY $_outer_select_column
792
  ORDER BY counthits DESC
793
  LIMIT ".self::$filters_normalized[ 'misc' ][ 'start_from' ].', '.self::$filters_normalized[ 'misc' ][ 'limit_results' ],
794
- $column_for_select,
795
  'counthits DESC',
796
- $column_for_select,
797
- 'MAX(maxid), SUM(counthits)' );
798
  }
799
  }
76
  'interval_minutes' => array( __( 'minutes', 'wp-slimstat' ), 'int' ),
77
  'dt' => array( __( 'Unix Timestamp', 'wp-slimstat' ), 'int' ),
78
 
79
+ 'direction' => array( __( 'Direction', 'wp-slimstat' ), 'varchar' ),
80
  'limit_results' => array( __( 'Limit Results', 'wp-slimstat' ), 'int' ),
81
  'start_from' => array( __( 'Start From', 'wp-slimstat' ), 'int' ),
82
 
84
  'strtotime' => array( 0, 'int' )
85
  ), self::$columns_names );
86
 
87
+ // Allow third party plugins to add even more column names to the array
88
+ self::$all_columns_names = apply_filters( 'slimstat_column_names', self::$all_columns_names );
89
+
90
  // Hook for the... filters
91
  $_filters = apply_filters( 'slimstat_db_pre_filters', $_filters );
92
 
250
  echo "<p class='debug'>$_message</p>";
251
  }
252
 
253
+ public static function get_results( $_sql = '', $_select_no_aggregate_values = '', $_order_by = '', $_group_by = '', $_aggregate_values_add = '' ) {
254
  $_sql = apply_filters( 'slimstat_get_results_sql', $_sql, $_select_no_aggregate_values, $_order_by, $_group_by, $_aggregate_values_add );
255
 
256
  if ( wp_slimstat::$options[ 'show_sql_debug' ] == 'yes' ) {
260
  return wp_slimstat::$wpdb->get_results( $_sql, ARRAY_A );
261
  }
262
 
263
+ public static function get_var( $_sql = '', $_aggregate_value = '' ) {
264
  $_sql = apply_filters( 'slimstat_get_var_sql', $_sql, $_aggregate_value );
265
 
266
  if ( wp_slimstat::$options[ 'show_sql_debug' ] == 'yes' ) {
278
  'is_past' => false
279
  ),
280
  'misc' => $_init_misc?array(
281
+ 'direction' => 'DESC',
282
  'limit_results' => wp_slimstat::$options[ 'rows_to_show' ],
283
  'start_from' => 0
284
  ) : array(),
387
  $filters_normalized[ 'date' ][ $a_filter[ 1 ] ] = in_array( $a_filter[ 3 ], array( 'plus', 'minus' ) ) ? $a_filter[ 3 ] : 'plus';
388
  break;
389
 
390
+ case 'direction':
391
  case 'limit_results':
392
  case 'start_from':
393
  $filters_normalized[ 'misc' ][ $a_filter[ 1 ] ] = str_replace( '\\', '', htmlspecialchars_decode( $a_filter[ 3 ] ) );
527
  public static function count_bouncing_pages() {
528
  $where = self::get_combined_where( 'visit_id > 0 AND content_type <> "404"', 'resource' );
529
 
530
+ return intval( self::get_var( "
531
  SELECT COUNT(*) counthits
532
  FROM (
533
  SELECT resource, visit_id
542
  public static function count_exit_pages() {
543
  $where = self::get_combined_where( 'visit_id > 0', 'resource' );
544
 
545
+ return intval( self::get_var( "
546
  SELECT COUNT(*) counthits
547
  FROM (
548
  SELECT resource, dt
558
  $distinct_column = ( $_column != 'id' ) ? "DISTINCT $_column" : $_column;
559
  $_where = self::get_combined_where( $_where, $_column, $_use_time_range );
560
 
561
+ return intval( self::get_var( "
562
  SELECT COUNT($distinct_column) counthits
563
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
564
  WHERE $_where",
568
  public static function count_records_having( $_column = 'id', $_where = '', $_having = '' ) {
569
  $_where = self::get_combined_where( $_where, $_column );
570
 
571
+ return intval( self::get_var( "
572
  SELECT COUNT(*) counthits FROM (
573
  SELECT $_column
574
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
639
  $group_by_string";
640
 
641
  // Get the data
642
+ $results = self::get_results( $sql, 'blog_id', '', $group_by_string, 'SUM(first_metric) AS first_metric, SUM(second_metric) AS second_metric' );
643
 
644
  // Fill the output array
645
  $output[ 'current' ][ 'label' ] = '';
702
  public static function get_max_and_average_pages_per_visit() {
703
  $where = self::get_combined_where( 'visit_id > 0' );
704
 
705
+ return self::get_results( "
706
  SELECT AVG(ts1.counthits) AS avghits, MAX(ts1.counthits) AS maxhits FROM (
707
  SELECT count(ip) counthits, visit_id
708
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
716
  }
717
 
718
  public static function get_oldest_visit() {
719
+ return self::get_var( "
720
  SELECT dt
721
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
722
  ORDER BY dt ASC
735
  $_where = self::get_combined_where( $_where, $_column, $_use_time_range );
736
 
737
  if ( $_column == '*' ) {
738
+ return self::get_results( "
739
  SELECT *
740
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
741
  WHERE $_where
745
  'dt DESC' );
746
  }
747
  else {
748
+ return self::get_results( "
749
  SELECT t1.*
750
  FROM (
751
  SELECT $_column, MAX(id) maxid
770
 
771
  $_where = self::get_combined_where( $_where, $_as_column, $_use_time_range );
772
 
773
+ return self::get_results( "
774
  SELECT $_column, COUNT(*) counthits
775
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
776
  WHERE $_where
783
  'SUM(counthits) AS counthits' );
784
  }
785
 
786
+ public static function get_top_aggr( $_column = 'id', $_where = '', $_outer_select_column = '', $_aggr_function = 'MAX' ) {
787
  $_where = self::get_combined_where( $_where, $_column );
788
 
789
+ return self::get_results( "
790
+ SELECT $_outer_select_column, ts1.aggrid, COUNT(*) counthits
791
  FROM (
792
+ SELECT $_column, $_aggr_function(id) aggrid
793
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
794
  WHERE $_where
795
  GROUP BY $_column
796
+ ) AS ts1 JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON ts1.aggrid = t1.id
797
  GROUP BY $_outer_select_column
798
  ORDER BY counthits DESC
799
  LIMIT ".self::$filters_normalized[ 'misc' ][ 'start_from' ].', '.self::$filters_normalized[ 'misc' ][ 'limit_results' ],
800
+ $_outer_select_column,
801
  'counthits DESC',
802
+ $_outer_select_column,
803
+ "$_aggr_function(aggrid), SUM(counthits)" );
804
  }
805
  }
admin/view/wp-slimstat-reports.php CHANGED
@@ -50,8 +50,6 @@ class wp_slimstat_reports {
50
  self::$hidden_filters['author'] = 1;
51
  }
52
 
53
- // Allow third-party add-ons to modify filters before they are used
54
- $filters = apply_filters( 'slimstat_modify_admin_filters', $filters );
55
  if ( !empty( $filters ) ) {
56
  $filters = implode( '&&&', $filters );
57
  }
@@ -83,7 +81,7 @@ class wp_slimstat_reports {
83
  'columns' => 'id',
84
  'raw' => array( __CLASS__, 'get_raw_results' )
85
  ),
86
- 'classes' => array( 'tall' ),
87
  'screens' => array( 'wp-slim-view-1', 'raw' ),
88
  'tooltip' => __( 'Color codes', 'wp-slimstat' ).'</strong><p><span class="little-color-box is-search-engine"></span> '.__( 'From search result page', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-visitor"></span> '.__( 'Known Visitor', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-user"></span> '.__( 'Known Users', 'wp-slimstat' ).'</p><p><span class="little-color-box is-direct"></span> '.__( 'Other Humans', 'wp-slimstat' ).'</p><p><span class="little-color-box"></span> '.__( 'Bot or Crawler', 'wp-slimstat' ).'</p>'
89
  ),
@@ -453,16 +451,19 @@ class wp_slimstat_reports {
453
  'screens' => array( 'wp-slim-view-5', 'raw' )
454
  ),
455
 
456
- /*
457
  'slim_p4_01' => array(
458
  'title' => __( 'Recent Outbound Links', 'wp-slimstat' ),
459
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
 
 
 
 
 
460
  'callback_raw' => array( __CLASS__, 'get_raw_results' ),
461
  'classes' => array( 'wide' ),
462
  'screens' => array( 'wp-slim-view-4', 'raw' ),
463
  'tooltip' => ''
464
  ),
465
- */
466
  'slim_p4_02' => array(
467
  'title' => __( 'Recent Posts', 'wp-slimstat' ),
468
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
@@ -538,18 +539,22 @@ class wp_slimstat_reports {
538
  'classes' => array( 'normal', 'raw' ),
539
  'screens' => array( 'wp-slim-view-4', 'dashboard' )
540
  ),
541
- /*
542
- NOTE TO SELF: don't forget to remove from deprecated, when implemented
543
  'slim_p4_09' => array(
544
  'title' => __( 'Top Downloads', 'wp-slimstat' ),
545
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
546
  'callback_args' => array(
 
 
 
547
  'raw' => array( __CLASS__, 'get_raw_results' )
548
  ),
549
- 'classes' => array( 'normal', 'hidden' ),
550
  'screens' => array( 'wp-slim-view-4', 'raw' ),
551
  'tooltip' => __( 'You can configure Slimstat to track specific file extensions as downloads.', 'wp-slimstat' )
552
  ),
 
 
553
  'slim_p4_10' => array(
554
  'title' => __( 'Recent Events', 'wp-slimstat' ),
555
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
@@ -637,7 +642,9 @@ class wp_slimstat_reports {
637
  'title' => __( 'Recent Downloads', 'wp-slimstat' ),
638
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
639
  'callback_args' => array(
640
-
 
 
641
  'raw' => array( __CLASS__, 'get_raw_results' )
642
  ),
643
  'classes' => array( 'wide', 'hidden' ),
@@ -647,7 +654,8 @@ class wp_slimstat_reports {
647
  'title' => __( 'Top Outbound Links', 'wp-slimstat' ),
648
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
649
  'callback_args' => array(
650
-
 
651
  'raw' => array( __CLASS__, 'get_raw_results' )
652
  ),
653
  'classes' => array( 'normal', 'hidden' ),
@@ -673,12 +681,11 @@ class wp_slimstat_reports {
673
  'classes' => array( 'normal', 'hidden' ),
674
  'screens' => array( 'wp-slim-view-4', 'raw' )
675
  ),
676
- /* NOTE TO SELF: remove them from deprecated, when reimplemented
677
  'slim_p4_24' => array(
678
  'title' => __( 'Top Exit Pages', 'wp-slimstat' ),
679
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
680
  'callback_args' => array(
681
- 'type' => 'top_complete',
682
  'columns' => 'visit_id',
683
  'outer_select_column' => 'resource',
684
  'aggr_function' => 'MAX',
@@ -691,7 +698,7 @@ class wp_slimstat_reports {
691
  'title' => __( 'Top Entry Pages', 'wp-slimstat' ),
692
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
693
  'callback_args' => array(
694
- 'type' => 'top_complete',
695
  'columns' => 'visit_id',
696
  'outer_select_column' => 'resource',
697
  'aggr_function' => 'MIN',
@@ -700,7 +707,6 @@ class wp_slimstat_reports {
700
  'classes' => array( 'normal', 'hidden' ),
701
  'screens' => array( 'wp-slim-view-4', 'raw' )
702
  ),
703
- */
704
 
705
  'slim_p6_01' => array(
706
  'title' => __( 'World Map', 'wp-slimstat' ),
@@ -725,16 +731,11 @@ class wp_slimstat_reports {
725
  'slim_p3_08',
726
  'slim_p3_09',
727
  'slim_p3_10',
728
- 'slim_p4_01',
729
  'slim_p4_08',
730
- 'slim_p4_09',
731
  'slim_p4_10',
732
  'slim_p4_12',
733
  'slim_p4_14',
734
- 'slim_p4_17',
735
- 'slim_p4_20',
736
- 'slim_p4_24',
737
- 'slim_p4_25'
738
  );
739
 
740
  // Retrieve this user's list of active reports,
@@ -816,7 +817,7 @@ class wp_slimstat_reports {
816
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-double-'.$direction_prev.'" href="'.wp_slimstat_reports::fs_url('start_from equals 0').'"></a> ';
817
  }
818
 
819
- $pagination = '<p class="pagination">'.sprintf(__('Results %s - %s of %s', 'wp-slimstat'), number_format(wp_slimstat_db::$filters_normalized['misc']['start_from']+1, 0, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']), number_format($endpoint, 0, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']), number_format($_count_all_results, 0, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']).(($_count_all_results == 1000)?'+':''));
820
  if ($_show_refresh_countdown && wp_slimstat::$options['refresh_interval'] > 0 && !wp_slimstat_db::$filters_normalized['date']['is_past']){
821
  $pagination .= ' &ndash; '.__('Refresh in','wp-slimstat').' <i class="refresh-timer"></i>';
822
  }
@@ -849,7 +850,6 @@ class wp_slimstat_reports {
849
  'use_date_filters' => true
850
  ), $_args );
851
 
852
-
853
  switch ( $_args[ 'type' ] ) {
854
  case 'recent':
855
  $all_results = wp_slimstat_db::get_recent( $_args[ 'columns' ], $_args[ 'where' ], $_args[ 'having' ], $_args[ 'use_date_filters' ], $_args['as_column'] );
@@ -859,8 +859,8 @@ class wp_slimstat_reports {
859
  $all_results = wp_slimstat_db::get_top( $_args[ 'columns' ], $_args['where'], $_args['having'], $_args[ 'use_date_filters' ], $_args['as_column'] );
860
  break;
861
 
862
- case 'top_complete':
863
- $all_results = wp_slimstat_db::get_top_complete( $_args[ 'columns' ], $_args['where'], $_args['outer_select_column'], $_args['aggr_function'] );
864
  break;
865
 
866
  default:
@@ -905,11 +905,15 @@ class wp_slimstat_reports {
905
  }
906
 
907
  // Some reports use aliases for column names
908
- if ( !empty( $_args['as_column'] ) ) {
909
  $_args[ 'columns' ] = $_args[ 'as_column' ];
910
  }
 
 
 
 
911
  // Some reports query more than one column
912
- else if ( strpos( $_args[ 'columns' ], ',' ) !== false ) {
913
  $_args[ 'columns' ] = explode( ',', $_args[ 'columns' ] );
914
  $_args[ 'columns' ] = trim( $_args[ 'columns' ][ 0 ] );
915
  }
@@ -967,23 +971,25 @@ class wp_slimstat_reports {
967
  $element_value = $results[$i]['ip'];
968
  }
969
  break;
 
970
  case 'language':
971
  $row_details = '<br>'.__('Language Code','wp-slimstat').": {$results[$i]['language']}";
972
  $element_value = __('l-'.$results[$i]['language'], 'wp-slimstat');
973
  break;
 
974
  case 'platform':
975
  $row_details = '<br>'.__('OS Code','wp-slimstat').": {$results[$i]['platform']}";
976
  $element_value = __($results[$i]['platform'], 'wp-slimstat');
977
  break;
 
978
  case 'resource':
979
- if ( !empty( $permalinks_enabled ) ) {
980
- $a_result[ 'resource' ] = strtok( $a_result[ 'resource' ], '?' );
 
981
  }
982
- $post_id = url_to_postid(strtok($results[$i]['resource'], '?'));
983
-
984
- if ($post_id > 0) $row_details = '<br>'.htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8');
985
- $element_value = self::get_resource_title($results[$i]['resource']);
986
  break;
 
987
  case 'searchterms':
988
  if ($_args[ 'type' ] == 'recent'){
989
  $domain = parse_url( $results[$i]['domain'] );
@@ -1016,7 +1022,7 @@ class wp_slimstat_reports {
1016
  }
1017
  else{
1018
  $percentage = ' <span>'.((self::$pageviews > 0)?number_format(sprintf("%01.2f", (100*$results[$i]['counthits']/self::$pageviews)), 2, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']):0).'%</span>';
1019
- $row_details = __('Hits','wp-slimstat').': '.number_format($results[$i]['counthits'], 0, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']).$row_details;
1020
  }
1021
 
1022
  // Some columns require a special post-treatment
@@ -1162,7 +1168,7 @@ class wp_slimstat_reports {
1162
 
1163
  public static function show_about_wpslimstat() { ?>
1164
 
1165
- <p><?php _e('Dataset Size', 'wp-slimstat') ?> <span><?php echo number_format( wp_slimstat_db::count_records('id', '1=1', false), 0, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']).' '; _e( 'records', 'wp-slimstat' ); ?></span></p>
1166
  <p><?php _e('DB Size', 'wp-slimstat') ?> <span><?php echo wp_slimstat_db::get_data_size() ?></span></p>
1167
  <p><?php _e('Tracking Active', 'wp-slimstat') ?> <span><?php _e(ucfirst(wp_slimstat::$options['is_tracking']), 'wp-slimstat') ?></span></p>
1168
  <p><?php _e('Javascript Mode', 'wp-slimstat') ?> <span><?php _e(ucfirst(wp_slimstat::$options['javascript_mode']), 'wp-slimstat') ?></span></p>
@@ -1180,7 +1186,7 @@ class wp_slimstat_reports {
1180
  $days_in_range = ceil( ( wp_slimstat_db::$filters_normalized[ 'utime' ][ 'end' ] - wp_slimstat_db::$filters_normalized[ 'utime' ][ 'start' ] ) / 86400 ); ?>
1181
 
1182
  <p><?php self::inline_help(__('A request to load a single HTML file. Slimstat logs a "pageview" each time the tracking code is executed.','wp-slimstat'));
1183
- _e('Pageviews', 'wp-slimstat'); ?> <span><?php echo number_format(self::$pageviews, 0, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']) ?></span></p>
1184
  <p><?php _e('Days in Range', 'wp-slimstat') ?> <span><?php echo $days_in_range ?></span></p>
1185
  <p><?php self::inline_help(__('How many pages have been visited on average every day during the current period.','wp-slimstat'));
1186
  _e('Average Daily Pageviews', 'wp-slimstat') ?> <span><?php echo number_format( intval( self::$pageviews/$days_in_range ), 0, '', wp_slimstat_db::$formats['thousand'] ) ?></span></p>
@@ -1632,9 +1638,12 @@ class wp_slimstat_reports {
1632
  */
1633
  public static function get_resource_title($_resource = ''){
1634
  if (wp_slimstat::$options['convert_resource_urls_to_titles'] == 'yes'){
1635
- $post_id = url_to_postid(strtok($_resource, '?'));
1636
- if ($post_id > 0){
1637
- return get_the_title($post_id);
 
 
 
1638
  }
1639
  }
1640
  return htmlentities(urldecode($_resource), ENT_QUOTES, 'UTF-8');
50
  self::$hidden_filters['author'] = 1;
51
  }
52
 
 
 
53
  if ( !empty( $filters ) ) {
54
  $filters = implode( '&&&', $filters );
55
  }
81
  'columns' => 'id',
82
  'raw' => array( __CLASS__, 'get_raw_results' )
83
  ),
84
+ 'classes' => array( 'full-width', 'tall' ),
85
  'screens' => array( 'wp-slim-view-1', 'raw' ),
86
  'tooltip' => __( 'Color codes', 'wp-slimstat' ).'</strong><p><span class="little-color-box is-search-engine"></span> '.__( 'From search result page', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-visitor"></span> '.__( 'Known Visitor', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-user"></span> '.__( 'Known Users', 'wp-slimstat' ).'</p><p><span class="little-color-box is-direct"></span> '.__( 'Other Humans', 'wp-slimstat' ).'</p><p><span class="little-color-box"></span> '.__( 'Bot or Crawler', 'wp-slimstat' ).'</p>'
87
  ),
451
  'screens' => array( 'wp-slim-view-5', 'raw' )
452
  ),
453
 
 
454
  'slim_p4_01' => array(
455
  'title' => __( 'Recent Outbound Links', 'wp-slimstat' ),
456
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
457
+ 'callback_args' => array(
458
+ 'type' => 'recent',
459
+ 'columns' => 'outbound_resource', // raw_results_to_html knows to display the resource, when the column is visit_id
460
+ 'raw' => array( __CLASS__, 'get_raw_results' )
461
+ ),
462
  'callback_raw' => array( __CLASS__, 'get_raw_results' ),
463
  'classes' => array( 'wide' ),
464
  'screens' => array( 'wp-slim-view-4', 'raw' ),
465
  'tooltip' => ''
466
  ),
 
467
  'slim_p4_02' => array(
468
  'title' => __( 'Recent Posts', 'wp-slimstat' ),
469
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
539
  'classes' => array( 'normal', 'raw' ),
540
  'screens' => array( 'wp-slim-view-4', 'dashboard' )
541
  ),
542
+
 
543
  'slim_p4_09' => array(
544
  'title' => __( 'Top Downloads', 'wp-slimstat' ),
545
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
546
  'callback_args' => array(
547
+ 'type' => 'top',
548
+ 'columns' => 'resource',
549
+ 'where' => 'content_type = "download"',
550
  'raw' => array( __CLASS__, 'get_raw_results' )
551
  ),
552
+ 'classes' => array( 'wide', 'hidden' ),
553
  'screens' => array( 'wp-slim-view-4', 'raw' ),
554
  'tooltip' => __( 'You can configure Slimstat to track specific file extensions as downloads.', 'wp-slimstat' )
555
  ),
556
+ /*
557
+ NOTE TO SELF: don't forget to remove from deprecated, when implemented
558
  'slim_p4_10' => array(
559
  'title' => __( 'Recent Events', 'wp-slimstat' ),
560
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
642
  'title' => __( 'Recent Downloads', 'wp-slimstat' ),
643
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
644
  'callback_args' => array(
645
+ 'type' => 'recent',
646
+ 'columns' => 'resource',
647
+ 'where' => 'content_type = "download"',
648
  'raw' => array( __CLASS__, 'get_raw_results' )
649
  ),
650
  'classes' => array( 'wide', 'hidden' ),
654
  'title' => __( 'Top Outbound Links', 'wp-slimstat' ),
655
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
656
  'callback_args' => array(
657
+ 'type' => 'top',
658
+ 'columns' => 'outbound_resource',
659
  'raw' => array( __CLASS__, 'get_raw_results' )
660
  ),
661
  'classes' => array( 'normal', 'hidden' ),
681
  'classes' => array( 'normal', 'hidden' ),
682
  'screens' => array( 'wp-slim-view-4', 'raw' )
683
  ),
 
684
  'slim_p4_24' => array(
685
  'title' => __( 'Top Exit Pages', 'wp-slimstat' ),
686
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
687
  'callback_args' => array(
688
+ 'type' => 'top_aggr',
689
  'columns' => 'visit_id',
690
  'outer_select_column' => 'resource',
691
  'aggr_function' => 'MAX',
698
  'title' => __( 'Top Entry Pages', 'wp-slimstat' ),
699
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
700
  'callback_args' => array(
701
+ 'type' => 'top_aggr',
702
  'columns' => 'visit_id',
703
  'outer_select_column' => 'resource',
704
  'aggr_function' => 'MIN',
707
  'classes' => array( 'normal', 'hidden' ),
708
  'screens' => array( 'wp-slim-view-4', 'raw' )
709
  ),
 
710
 
711
  'slim_p6_01' => array(
712
  'title' => __( 'World Map', 'wp-slimstat' ),
731
  'slim_p3_08',
732
  'slim_p3_09',
733
  'slim_p3_10',
 
734
  'slim_p4_08',
 
735
  'slim_p4_10',
736
  'slim_p4_12',
737
  'slim_p4_14',
738
+ 'slim_p4_17'
 
 
 
739
  );
740
 
741
  // Retrieve this user's list of active reports,
817
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-double-'.$direction_prev.'" href="'.wp_slimstat_reports::fs_url('start_from equals 0').'"></a> ';
818
  }
819
 
820
+ $pagination = '<p class="pagination">'.sprintf(__('Results %s - %s of %s', 'wp-slimstat'), number_format(wp_slimstat_db::$filters_normalized['misc']['start_from']+1, 0, '', wp_slimstat_db::$formats['thousand']), number_format($endpoint, 0, '', wp_slimstat_db::$formats['thousand']), number_format($_count_all_results, 0, '', wp_slimstat_db::$formats['thousand']).(($_count_all_results == 1000)?'+':''));
821
  if ($_show_refresh_countdown && wp_slimstat::$options['refresh_interval'] > 0 && !wp_slimstat_db::$filters_normalized['date']['is_past']){
822
  $pagination .= ' &ndash; '.__('Refresh in','wp-slimstat').' <i class="refresh-timer"></i>';
823
  }
850
  'use_date_filters' => true
851
  ), $_args );
852
 
 
853
  switch ( $_args[ 'type' ] ) {
854
  case 'recent':
855
  $all_results = wp_slimstat_db::get_recent( $_args[ 'columns' ], $_args[ 'where' ], $_args[ 'having' ], $_args[ 'use_date_filters' ], $_args['as_column'] );
859
  $all_results = wp_slimstat_db::get_top( $_args[ 'columns' ], $_args['where'], $_args['having'], $_args[ 'use_date_filters' ], $_args['as_column'] );
860
  break;
861
 
862
+ case 'top_aggr':
863
+ $all_results = wp_slimstat_db::get_top_aggr( $_args[ 'columns' ], $_args['where'], $_args['outer_select_column'], $_args['aggr_function'] );
864
  break;
865
 
866
  default:
905
  }
906
 
907
  // Some reports use aliases for column names
908
+ if ( !empty( $_args[ 'as_column' ] ) ) {
909
  $_args[ 'columns' ] = $_args[ 'as_column' ];
910
  }
911
+ else if ( !empty( $_args[ 'outer_select_column' ] ) ) {
912
+ $_args[ 'columns' ] = $_args[ 'outer_select_column' ];
913
+ }
914
+
915
  // Some reports query more than one column
916
+ if ( strpos( $_args[ 'columns' ], ',' ) !== false ) {
917
  $_args[ 'columns' ] = explode( ',', $_args[ 'columns' ] );
918
  $_args[ 'columns' ] = trim( $_args[ 'columns' ][ 0 ] );
919
  }
971
  $element_value = $results[$i]['ip'];
972
  }
973
  break;
974
+
975
  case 'language':
976
  $row_details = '<br>'.__('Language Code','wp-slimstat').": {$results[$i]['language']}";
977
  $element_value = __('l-'.$results[$i]['language'], 'wp-slimstat');
978
  break;
979
+
980
  case 'platform':
981
  $row_details = '<br>'.__('OS Code','wp-slimstat').": {$results[$i]['platform']}";
982
  $element_value = __($results[$i]['platform'], 'wp-slimstat');
983
  break;
984
+
985
  case 'resource':
986
+ $resource_title = self::get_resource_title( $results[ $i ][ 'resource' ] );
987
+ if ( $resource_title != $results[ $i ][ 'resource' ] ) {
988
+ $row_details = '<br>'.htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8');
989
  }
990
+ $element_value = $resource_title;
 
 
 
991
  break;
992
+
993
  case 'searchterms':
994
  if ($_args[ 'type' ] == 'recent'){
995
  $domain = parse_url( $results[$i]['domain'] );
1022
  }
1023
  else{
1024
  $percentage = ' <span>'.((self::$pageviews > 0)?number_format(sprintf("%01.2f", (100*$results[$i]['counthits']/self::$pageviews)), 2, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']):0).'%</span>';
1025
+ $row_details = __('Hits','wp-slimstat').': '.number_format($results[$i]['counthits'], 0, '', wp_slimstat_db::$formats['thousand']).$row_details;
1026
  }
1027
 
1028
  // Some columns require a special post-treatment
1168
 
1169
  public static function show_about_wpslimstat() { ?>
1170
 
1171
+ <p><?php _e('Dataset Size', 'wp-slimstat') ?> <span><?php echo number_format( wp_slimstat_db::count_records('id', '1=1', false), 0, '', wp_slimstat_db::$formats['thousand']).' '; _e( 'records', 'wp-slimstat' ); ?></span></p>
1172
  <p><?php _e('DB Size', 'wp-slimstat') ?> <span><?php echo wp_slimstat_db::get_data_size() ?></span></p>
1173
  <p><?php _e('Tracking Active', 'wp-slimstat') ?> <span><?php _e(ucfirst(wp_slimstat::$options['is_tracking']), 'wp-slimstat') ?></span></p>
1174
  <p><?php _e('Javascript Mode', 'wp-slimstat') ?> <span><?php _e(ucfirst(wp_slimstat::$options['javascript_mode']), 'wp-slimstat') ?></span></p>
1186
  $days_in_range = ceil( ( wp_slimstat_db::$filters_normalized[ 'utime' ][ 'end' ] - wp_slimstat_db::$filters_normalized[ 'utime' ][ 'start' ] ) / 86400 ); ?>
1187
 
1188
  <p><?php self::inline_help(__('A request to load a single HTML file. Slimstat logs a "pageview" each time the tracking code is executed.','wp-slimstat'));
1189
+ _e('Pageviews', 'wp-slimstat'); ?> <span><?php echo number_format(self::$pageviews, 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
1190
  <p><?php _e('Days in Range', 'wp-slimstat') ?> <span><?php echo $days_in_range ?></span></p>
1191
  <p><?php self::inline_help(__('How many pages have been visited on average every day during the current period.','wp-slimstat'));
1192
  _e('Average Daily Pageviews', 'wp-slimstat') ?> <span><?php echo number_format( intval( self::$pageviews/$days_in_range ), 0, '', wp_slimstat_db::$formats['thousand'] ) ?></span></p>
1638
  */
1639
  public static function get_resource_title($_resource = ''){
1640
  if (wp_slimstat::$options['convert_resource_urls_to_titles'] == 'yes'){
1641
+ if ( get_option( 'permalink_structure' , false ) ) {
1642
+ $_resource = strtok($_resource, '?');
1643
+ }
1644
+ $post_id = url_to_postid( $_resource );
1645
+ if ( $post_id > 0 ) {
1646
+ return get_the_title( $post_id );
1647
  }
1648
  }
1649
  return htmlentities(urldecode($_resource), ENT_QUOTES, 'UTF-8');
admin/wp-slimstat-admin.php CHANGED
@@ -11,7 +11,7 @@ class wp_slimstat_admin{
11
  */
12
  public static function init(){
13
  if ((wp_slimstat::$options['enable_ads_network'] == 'yes' || wp_slimstat::$options['enable_ads_network'] == 'no')){
14
- self::$admin_notice = "Our dev team is moving forward with their effort to give Slimstat's source code a good scrub. After cleaning up the database library, it was now the report library's turn. Again, if you developed your own custom report, you will probably need to update your code to make it work with our new library. We are going to update our online documentation in the next few days. By the way, we'd like to hear from you: have you noticed any performance improvements after switching to Slimstat 4.0? Let us know through the forum or contant our support team.";
15
  self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">I got it, thanks</a>';
16
  }
17
  else {
@@ -122,7 +122,7 @@ class wp_slimstat_admin{
122
  }
123
 
124
  // Load the library of functions to generate the reports
125
- if ((!empty($_GET['page']) && strpos($_GET['page'], 'wp-slim-view') !== false) || (!empty($_POST['action']) && $_POST['action'] == 'slimstat_load_report')){
126
  include_once(dirname(__FILE__).'/view/wp-slimstat-reports.php');
127
  wp_slimstat_reports::init();
128
 
@@ -663,12 +663,10 @@ class wp_slimstat_admin{
663
  $minimum_capability = wp_slimstat::$options['capability_can_admin'];
664
  }
665
 
 
666
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
667
  $new_entry = add_submenu_page('wp-slim-view-1', __('Settings','wp-slimstat'), __('Settings','wp-slimstat'), $minimum_capability, 'wp-slim-config', array(__CLASS__, 'wp_slimstat_include_config'));
668
  }
669
- else {
670
- $new_entry = add_submenu_page('admin.php', __('Settings','wp-slimstat'), __('Settings','wp-slimstat'), $minimum_capability, 'wp-slim-config', array(__CLASS__, 'wp_slimstat_include_config'));
671
- }
672
 
673
  // Load styles and Javascript needed to make the reports look nice and interactive
674
  add_action('load-'.$new_entry, array(__CLASS__, 'wp_slimstat_stylesheet'));
11
  */
12
  public static function init(){
13
  if ((wp_slimstat::$options['enable_ads_network'] == 'yes' || wp_slimstat::$options['enable_ads_network'] == 'no')){
14
+ self::$admin_notice = "A few weeks ago we started hitting the limits imposed on our site by our existing hosting provider. It was clearly time to find a new home for Slimstat. We've been working on migrating our web platform (website and add-on repository API) to a new more powerful server, and a new domain: <a href='http://www.wp-slimstat.com' target='_blank'>wp-slimstat.com</a>. Our dev team has also released updates for our premium add-ons Export to Excel, Email Reports and User Overview, which are now fully compatible with Slimstat 4. Go get your copy today.";
15
  self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">I got it, thanks</a>';
16
  }
17
  else {
122
  }
123
 
124
  // Load the library of functions to generate the reports
125
+ if ( ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'wp-slim-view' ) !== false ) || (!empty($_POST['action']) && $_POST['action'] == 'slimstat_load_report')){
126
  include_once(dirname(__FILE__).'/view/wp-slimstat-reports.php');
127
  wp_slimstat_reports::init();
128
 
663
  $minimum_capability = wp_slimstat::$options['capability_can_admin'];
664
  }
665
 
666
+ $new_entry = add_submenu_page(null, __('Settings','wp-slimstat'), __('Settings','wp-slimstat'), $minimum_capability, 'wp-slim-config', array(__CLASS__, 'wp_slimstat_include_config'));
667
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
668
  $new_entry = add_submenu_page('wp-slim-view-1', __('Settings','wp-slimstat'), __('Settings','wp-slimstat'), $minimum_capability, 'wp-slim-config', array(__CLASS__, 'wp_slimstat_include_config'));
669
  }
 
 
 
670
 
671
  // Load styles and Javascript needed to make the reports look nice and interactive
672
  add_action('load-'.$new_entry, array(__CLASS__, 'wp_slimstat_stylesheet'));
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
- Stable tag: 4.1.1
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
@@ -59,6 +59,15 @@ Our knowledge base is available on our [support center](http://docs.wp-slimstat.
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
 
62
  = 4.1.1 =
63
  * [Note] We are starting to hit the limits imposed by our current hosting provider, so it's time to move to a new more reliable server farm. We will be migrating our platform in the next few weeks, and this might cause some downtime for those trying to buy our premium add-ons. We apologize for the inconvenience.
64
  * [Update] Minor adjustments to our codebase to make Slimstat easily extensible. Now you can quickly add your own reports by just passing some simple information to the plugin. More information soon available on our knowledge base website.
@@ -156,82 +165,6 @@ Our knowledge base is available on our [support center](http://docs.wp-slimstat.
156
  * [Update] More data layer updates introduced in wp_slimstat_db. Keep an eye on your custom add-ons!
157
  * [Fix] Pagination was not working as expected when a date range was set in the filters (thank you, [nick-v](https://wordpress.org/support/topic/paging-is-broke))
158
 
159
- = 3.9.4 =
160
- * [Note] The URL of the CDN has changed, and is now using the official WordPress repository as a source: cdn.jsdelivr.net/wp/wp-slimstat/trunk/wp-slimstat.js - Please update your "external" tracking codes accordingly.
161
- * [Note] The structure of the array **wp_slimstat_db::$sql_filters** has changed! Please make sure to update your custom code accordingly. Feel free to [contact us](http://support.wp-slimstat.com) for more information.
162
- * [New] The wait is over. Our heatmap add-on is finally [available on our store](http://www.wp-slimstat.com/downloads/heatmap/)! We would like to thank all those who provided helpful feedback to improve this initial release!
163
- * [New] Our [knowledge base](http://docs.wp-slimstat.com/) has been extended with a list of all the actions and filters available in Slimstat.
164
- * [Fix] The Add-on update checker had a bug preventing the functionality to work as expected. Please make sure to get the latest version of your premium add-ons!
165
- * [Fix] Date intervals were not accurate because of a bug related to calculating timezones in MySQL (thank you, [Chrisssssi](https://wordpress.org/support/topic/conflicting-data)).
166
- * [Fix] Line height of report rows has been added to avoid conflicts with other plugins tweaking this parameter in the admin (thank you, [yk11](https://wordpress.org/support/topic/widgets-bottom-is-cut-off)).
167
-
168
- = 3.9.3 =
169
- * [Note] We're starting to work on a completely redesigned data layer, which will require less SQL resources and offer a much needed performance improvement. Stay tuned.
170
- * [New] Three new settings to turn off the tracker completely on specific links (internal and external), by class name, rel attribute or simply by URL.
171
- * [Update] MaxMind GeoLite IP has been updated to the latest version (2015-01-06).
172
- * [Fix] Bug affecting our add-ons setting page, in some specific circumstances (thank you, Erik).
173
-
174
- = 3.9.2 =
175
- * [New] Welcome our recommended partner, [ManageWP](https://managewp.com/?utm_source=A&utm_medium=Banner&utm_content=mwp_banner_25_300x250&utm_campaign=A&utm_mrl=2844). You will get a 10% discount on their products using our affiliation link.
176
- * [Fix] XSS Vulnerability introduced by the new Save Filters functionality (thank you, [Ryan](https://wpvulndb.com/vulnerabilities/7744)).
177
-
178
- = 3.9.1 =
179
- * [New] Quickly delete single pageviews in the Real-Time Log screen
180
- * [New] Option to fix an issue occurring when the DB server and the website are in different timezones. Please disable this option if your charts seem to be off!
181
- * [New] Using the new [WP Proxy CDN feature](https://github.com/jsdelivr/jsdelivr/issues/2632). Please contact us if you notice any problems with this new option, as this feature is still being tested.
182
- * [Update] Reintroduced the NO PANIC button under Settings > Maintenance > Miscellaneous
183
- * [Fix] Conflict with WP-Jalali, which forces date_i18n to return not western numerals but their Farsi representation
184
-
185
- = 3.9 =
186
- * [Note] Announcing our latest add-on: heatmaps! Get your free copy of our beta: contact our support team today.
187
- * [New] Section under Settings > Filters that allows you to specify what links you want to "leave alone", so that the tracker doesn't interfere with your lightbox treatments.
188
- * [New] You can now turn on the option to collect mouse coordinates for internal links, which will be used to draw the heatmap on your pages.
189
- * [New] Operator "is included in" has been added to search matches in lists of strings (see [W3resources](http://www.w3resource.com/mysql/string-functions/mysql-find_in_set-function.php), thank you [pchrisl](https://github.com/27pchrisl/wp-slimstat/commit/5a5bc3b8c21ec16445292d8674d669c37c2a08b4))
190
- * [New] Added new reports: Top Bounce Pages, Top Exit Pages, Recent Exit Pages (thank you, [Random Dev](https://wordpress.org/support/topic/no-visitor-path-through-site-wslimstat))
191
- * [Update] Partial overhaul of the javascript tracker. We reintroduced the new algorithm to track pageviews, which now avoids the problem of triggering the popup blocker on links opening in a new tab.
192
- * [Update] Added browser and operating system to Spy View report
193
- * [Update] MaxMind GeoLite IP has been updated to the latest version (2014-12-02)
194
- * [Fix] Bug in archiving old pageviews under certain circumstances (thank you, Thomas)
195
- * [Fix] Added max height to overlay, for those who have very long lists of saved filters
196
- * [Fix] The button to reset date filters was not being displayed in some cases (thank you, [RangerPretzel](https://wordpress.org/support/topic/custom-data-range-in-slimstat-produces-charts-with-days-that-have-0-pageviews))
197
- * [Fix] Charts were not accurate when a custom interval was selected and the mysql server's timezone was different from the web server timezone (thank you, [RangerPretzel](https://wordpress.org/support/topic/custom-data-range-in-slimstat-produces-charts-with-days-that-have-0-pageviews))
198
-
199
- = 3.8.5 =
200
- * [Update] Show notices only to admin users (thank you, [thisismyway](https://wordpress.org/support/topic/hide-notifications-for-non-admins))
201
- * [Fix] The javascript tracker had been changed to deal with popup blocker issues, but the new code was causing even more problems to other people. Implemented a synchronous solution to make everybody happy! (thank you, bishoph)
202
-
203
- = 3.8.4 =
204
- * [New] You can now archive old pageviews, instead of deleting them
205
- * [Update] Code optimizations to the Javascript tracker (and a bugfix - thank you, [themadproducer](https://wordpress.org/support/topic/external-links-problem))
206
- * [Fix] Fixed a corrupted browscap data file (thank you, [crzyhrse](https://wordpress.org/support/topic/clobbered-my-sites-again))
207
- * [Fix] Do not refresh the Real-Time log if a date filter is set (thank you, [asylum119](https://wordpress.org/support/topic/viewing-yesterdays-stats-still-auto-refreshes))
208
-
209
- = 3.8.3 =
210
- * [Update] Browscap v5035 - November 4, 2014 (this should fix all the issues with recent Firefox versions)
211
- * [Fix] The originating IP address was not being ignored, if it was the same as the IP address (thank you, [morcom](https://wordpress.org/support/topic/real-time-log-originating-ip-on-all-entries))
212
- * [Fix] Visits in map were not correctly displayed (thank you, [psn](https://wordpress.org/support/topic/numbers-of-visit-in-maps-shows-zero))
213
-
214
- = 3.8.2 =
215
- * [New] You can now load, save and delete filters (or "goal conversions", in Google's terminology). Please test this new functionality and let us know if you find any bugs!
216
- * [Update] Added new WordPress filter hooks to initialize the arrays storing the data about the pageview (thank you, Tayyab)
217
- * [Update] [AmMap](http://www.amcharts.com/download/) version 3.11.3
218
- * [Update] MaxMind GeoLite IP has been updated to the latest version (2014-11-05)
219
- * [Fix] Bug affecting links opening in a new tab/window (target=_blank). Our thanks go to all the users who helped us troubleshoot the issue!
220
- * [Fix] Backward compatibility of new date/time filters with old ones
221
- * [Fix] Issue with counters on Posts/Pages screen (thank you, [vaguiners](https://wordpress.org/support/topic/0-visits-in-every-post-in-list-of-post-after-update))
222
- * [Fix] Warning about undefined array index in date/time filters (thank you, Chris)
223
- * [Fix] Some tooltips were being displayed outside of the browser viewport (thank you, Vitaly)
224
-
225
- = 3.8.1 =
226
- * It was only released on Github to solve a critical bug affecting external links
227
-
228
- = 3.8 =
229
- * [New] We increased the filter granularity to the minute, so that now you can see who visited your website between 9 am and 10.34 am (thank you, [berserk77](https://wordpress.org/support/topic/need-help-with-some-filtering-features))
230
- * [New] If admin is served over HTTPS but IP lookup service is not, don't use inline overlay dialog (thank you, [509tyler](https://wordpress.org/support/topic/https-overlay-suggestion))
231
- * [Update] Javascript libraries: qTip v2.2.1 and SlimScroll 1.3.3
232
- * [Fix] Outbound links from within the admin were not tracked as expected (thank you [mobilemindtech](https://wordpress.org/support/topic/outbound-links-problem-in-version-374))
233
- * [Fix] Firewall Fix add-on was not tracking the originating ip's country as expected (thank you, JeanLuc)
234
-
235
  == Special Thanks To ==
236
 
237
  * [Vitaly](http://www.visbiz.org/), who volunteers quite a lot of time for QA, testing, and for his Russian localization.
4
  Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
+ Stable tag: 4.1.2
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
59
 
60
  == Changelog ==
61
 
62
+ = 4.1.2 =
63
+ * [Note] A few weeks ago we started hitting the limits imposed on our site by our existing hosting provider. It was clearly time to find a new home for Slimstat. We've been working on migrating our web platform (website and add-on repository API) to a new more powerful server, and a new domain: [wp-slimstat.com](http://www.wp-slimstat.com).
64
+ * [Note] Our dev team has released updates for our premium add-ons Export to Excel, Email Reports and User Overview, which are now fully compatible with Slimstat 4. Go get your copy today.
65
+ * [Update] More adjustments to streamline the report API and make it easier for our users to add new custom reports.
66
+ * [Update] Restored the following reports: Recent/Top Downloads, Recent/Top Outbound Links, Top Entry Pages, Top Exit Pages.
67
+ * [Fix] Bug preventing some outbound links to be properly tracked.
68
+ * [Fix] In a Windows Server environment, the way the checkboxes are added under Screen Options was creating some issues (thank you, Rafael Ortman).
69
+ * [Fix] Post and page titles were not being displayed when the corresponding option was set
70
+
71
  = 4.1.1 =
72
  * [Note] We are starting to hit the limits imposed by our current hosting provider, so it's time to move to a new more reliable server farm. We will be migrating our platform in the next few weeks, and this might cause some downtime for those trying to buy our premium add-ons. We apologize for the inconvenience.
73
  * [Update] Minor adjustments to our codebase to make Slimstat easily extensible. Now you can quickly add your own reports by just passing some simple information to the plugin. More information soon available on our knowledge base website.
165
  * [Update] More data layer updates introduced in wp_slimstat_db. Keep an eye on your custom add-ons!
166
  * [Fix] Pagination was not working as expected when a date range was set in the filters (thank you, [nick-v](https://wordpress.org/support/topic/paging-is-broke))
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  == Special Thanks To ==
169
 
170
  * [Vitaly](http://www.visbiz.org/), who volunteers quite a lot of time for QA, testing, and for his Russian localization.
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"]},director:{substrings:["Shockwave","Director"],active_x_strings:["SWCtl.SWCtl"]},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"]},real:{substrings:["RealPlayer"],active_x_strings:["rmocx.RealPlayer G2 Control","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)"]},silverlight:{substrings:["Silverlight"],active_x_strings:["AgControl.AgControl"]}},_utf8_encode:function(e){var t,n,i="";for(e=e.replace(/\r\n/g,"\n"),t=0;t<e.length;t++)n=e.charCodeAt(t),128>n?i+=String.fromCharCode(n):n>127&&2048>n?(i+=String.fromCharCode(n>>6|192),i+=String.fromCharCode(63&n|128)):(i+=String.fromCharCode(n>>12|224),i+=String.fromCharCode(n>>6&63|128),i+=String.fromCharCode(63&n|128));return i},_base64_encode:function(e){var t,n,i,a,r,s,o,l="",d=0;for(e=SlimStat._utf8_encode(e);d<e.length;)t=e.charCodeAt(d++),n=e.charCodeAt(d++),i=e.charCodeAt(d++),a=t>>2,r=(3&t)<<4|n>>4,s=(15&n)<<2|i>>6,o=63&i,isNaN(n)?s=o=64:isNaN(i)&&(o=64),l=l+SlimStat._base64_key_str.charAt(a)+SlimStat._base64_key_str.charAt(r)+SlimStat._base64_key_str.charAt(s)+this._base64_key_str.charAt(o);return l},_detect_single_plugin_not_ie:function(e){var t,n,i,a;for(i in navigator.plugins){t=""+navigator.plugins[i].name+navigator.plugins[i].description,n=0;for(a in SlimStat._plugins[e].substrings)-1!=t.indexOf(SlimStat._plugins[e].substrings[a])&&n++;if(n==SlimStat._plugins[e].substrings.length)return!0}return!1},_detect_single_plugin_ie:function(e){var t;for(t in SlimStat._plugins[e].active_x_strings)try{return new ActiveXObject(SlimStat._plugins[e].active_x_strings[t]),!0}catch(n){return!1}},_detect_single_plugin:function(e){return this.detect=navigator.plugins.length?this._detect_single_plugin_not_ie:this._detect_single_plugin_ie,this.detect(e)},detect_plugins:function(){var e="",t=[];for(e in SlimStat._plugins)SlimStat._detect_single_plugin(e)&&t.push(e);return t.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},send_to_server:function(e,t){if("undefined"==typeof SlimStatParams.ajaxurl||"undefined"==typeof e)return"function"==typeof t&&t(),!1;try{window.XMLHttpRequest?request=new XMLHttpRequest:window.ActiveXObject&&(request=new ActiveXObject("Microsoft.XMLHTTP"))}catch(n){return"function"==typeof t&&t(),!1}return slimstat_data_with_client_info=e+"&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(),request?(request.open("POST",SlimStatParams.ajaxurl,!0),request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),request.send(slimstat_data_with_client_info),request.onreadystatechange=function(){4==request.readyState&&("undefined"==typeof SlimStatParams.id?(parsed_id=parseInt(request.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStat._id=request.responseText)):SlimStat._id=SlimStatParams.id,"function"==typeof t&&t())},!0):!1},ss_track:function(e,t,n,i){if(e||(e=window.event),type="undefined"==typeof t?0:parseInt(t),note_array=[],parsed_id=parseInt(SlimStat._id),isNaN(parsed_id)||parsed_id<=0)return"function"==typeof i&&i(),!1;if(node="undefined"!=typeof e.target?e.target:"undefined"!=typeof e.srcElement?e.srcElement:!1,!node)return"function"==typeof i&&i(),!1;switch(3==node.nodeType&&(node=node.parentNode),parent_node=node.parentNode,resource_url="",node.nodeName){case"FORM":node.action.length>0&&(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.length>0){resource_url=parent_node.action;break}default:if("A"!=node.nodeName){if("function"==typeof node.getAttribute&&"undefined"!=node.getAttribute("id")&&node.getAttribute("id").length){resource_url=node.getAttribute("id");break}for(;"undefined"!=typeof node.parentNode&&null!=node.parentNode&&"A"!=node.nodeName&&"BODY"!=node.nodeName;)node=node.parentNode}"undefined"!=typeof node.hash&&node.hash.length>0&&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")&&null!=node.getAttribute("title")&&node.getAttribute("title").length>0&&note_array.push("Title:"+node.getAttribute("title")),"undefined"!=typeof node.getAttribute("id")&&null!=node.getAttribute("id")&&node.getAttribute("id").length>0&&note_array.push("ID:"+node.getAttribute("id")))}return pos_x=-1,pos_y=-1,position="","undefined"!=typeof e.pageX&&"undefined"!=typeof e.pageY?(pos_x=e.pageX,pos_y=e.pageY):"undefined"!=typeof e.clientX&&"undefined"!=typeof e.clientY&&"undefined"!=typeof document.body.scrollLeft&&"undefined"!=typeof document.documentElement.scrollLeft&&"undefined"!=typeof document.body.scrollTop&&"undefined"!=typeof document.documentElement.scrollTop&&(pos_x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,pos_y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),pos_x>0&&pos_y>0&&(position=pos_x+","+pos_y),event_description=e.type,"click"!=e.type&&"undefined"!=typeof e.which&&(event_description+="keypress"==e.type?"; keypress:"+String.fromCharCode(parseInt(e.which)):"; which:"+e.which),"undefined"!=typeof n&&n.length>0&&note_array.push(n),note_string=SlimStat._base64_encode(note_array.join(", ")),requested_op="update",1==type&&(resource_url=SlimStat._base64_encode(resource_url.substring(resource_url.indexOf(location.hostname)+location.hostname.length)),requested_op="add"),SlimStat.send_to_server("action=slimtrack&op="+requested_op+"&id="+SlimStat._id+"&ty="+type+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+resource_url+"&pos="+position+"&des="+SlimStat._base64_encode(event_description)+"&no="+note_string,i),!0},add_event:function(e,t,n){e&&e.addEventListener?e.addEventListener(t,n,!1):e&&e.attachEvent?(e["e"+t+n]=n,e[t+n]=function(){e["e"+t+n](window.event)},e.attachEvent("on"+t,e[t+n])):e["on"+t]=e["e"+t+n]},event_fire:function(e,t){var n=e;if(document.createEvent){var i=document.createEvent("MouseEvents");i.initEvent(t,!0,!1),n.dispatchEvent(i)}else if(document.createEventObject){var i=document.createEventObject();n.fireEvent("on"+t,i)}},in_array:function(e,t){for(var n=0;n<t.length;n++)if(t[n].trim()==e)return!0;return!1},in_array_substring:function(e,t){for(var n=0;n<t.length;n++)if(-1!=e.indexOf(t[n].trim()))return!0;return!1}};SlimStat.add_event(window,"load",function(){if("undefined"==typeof SlimStatParams.disable_outbound_tracking){all_links=document.getElementsByTagName("a");for(var e="undefined"!=typeof SlimStatParams.extensions_to_track&&SlimStatParams.extensions_to_track.length>0?SlimStatParams.extensions_to_track.split(","):[],t="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_ignore&&SlimStatParams.outbound_classes_rel_href_to_ignore.length>0?SlimStatParams.outbound_classes_rel_href_to_ignore.split(","):[],n="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_not_track&&SlimStatParams.outbound_classes_rel_href_to_not_track.length>0?SlimStatParams.outbound_classes_rel_href_to_not_track.split(","):[],i=0;i<all_links.length;i++)!function(){var a=all_links[i];if(a.slimstat_actual_click=!1,a.slimstat_type=!a.href||a.hostname!=location.hostname&&-1!=a.href.indexOf("://")?0:2,a.slimstat_track_me=!0,a.slimstat_callback=!0,2!=a.slimstat_type||"undefined"!=typeof SlimStatParams.track_internal_links&&"false"!=SlimStatParams.track_internal_links||(a.slimstat_track_me=!1),a.slimstat_track_me&&(t.length>0||n.length>0)){classes_current_link="undefined"!=typeof a.className&&a.className.length>0?a.className.split(" "):[];for(var r=0;r<classes_current_link.length;r++)if(SlimStat.in_array_substring(classes_current_link[r],t)&&(a.slimstat_callback=!1),SlimStat.in_array_substring(classes_current_link[r],n)){a.slimstat_track_me=!1;break}a.slimstat_track_me&&"undefined"!=typeof a.attributes.rel&&a.attributes.rel.value.length>0&&(SlimStat.in_array_substring(a.attributes.rel.value,t)&&(a.slimstat_callback=!1),SlimStat.in_array_substring(a.attributes.rel.value,n)&&(a.slimstat_track_me=!1)),a.slimstat_track_me&&"undefined"!=typeof a.href&&a.href.length>0&&(SlimStat.in_array_substring(a.href,t)&&(a.slimstat_callback=!1),SlimStat.in_array_substring(a.href,n)&&(a.slimstat_track_me=!1))}e.length>0&&2==a.slimstat_type&&a.pathname.indexOf(".")>0&&(extension_current_link=a.pathname.split(".").pop().replace(/[\/\-]/g,""),a.slimstat_track_me=SlimStat.in_array(extension_current_link,e),a.slimstat_type=1),a.slimstat_track_me&&a.target&&!a.target.match(/^_(self|parent|top)$/i)&&(a.slimstat_callback=!1),a.setAttribute("data-slimstat-tracking",a.slimstat_track_me),a.setAttribute("data-slimstat-callback",a.slimstat_callback),SlimStat.add_event(a,"click",function(e){this.slimstat_track_me&&!this.slimstat_actual_click&&(this.slimstat_callback?("function"==typeof e.preventDefault&&e.preventDefault(),this.slimstat_actual_click=!0,SlimStat.ss_track(e,this.slimstat_type,"",function(){SlimStat.event_fire(a,"click")})):SlimStat.ss_track(e,this.slimstat_type,"",function(){}))})}()}});var slimstat_data="action=slimtrack";"undefined"!=typeof SlimStatParams.id&&parseInt(SlimStatParams.id)>0?slimstat_data+="&op=update&id="+SlimStatParams.id:"undefined"!=typeof SlimStatParams.ci&&(slimstat_data+="&op=add&id="+SlimStatParams.ci+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href)),slimstat_data.length&&SlimStat.add_event(window,"load",function(){setTimeout(function(){SlimStat.send_to_server(slimstat_data)},0)});
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"]},director:{substrings:["Shockwave","Director"],active_x_strings:["SWCtl.SWCtl"]},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"]},real:{substrings:["RealPlayer"],active_x_strings:["rmocx.RealPlayer G2 Control","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)"]},silverlight:{substrings:["Silverlight"],active_x_strings:["AgControl.AgControl"]}},_utf8_encode:function(e){var t,n,i="";for(e=e.replace(/\r\n/g,"\n"),t=0;t<e.length;t++)n=e.charCodeAt(t),128>n?i+=String.fromCharCode(n):n>127&&2048>n?(i+=String.fromCharCode(n>>6|192),i+=String.fromCharCode(63&n|128)):(i+=String.fromCharCode(n>>12|224),i+=String.fromCharCode(n>>6&63|128),i+=String.fromCharCode(63&n|128));return i},_base64_encode:function(e){var t,n,i,a,r,s,o,l="",d=0;for(e=SlimStat._utf8_encode(e);d<e.length;)t=e.charCodeAt(d++),n=e.charCodeAt(d++),i=e.charCodeAt(d++),a=t>>2,r=(3&t)<<4|n>>4,s=(15&n)<<2|i>>6,o=63&i,isNaN(n)?s=o=64:isNaN(i)&&(o=64),l=l+SlimStat._base64_key_str.charAt(a)+SlimStat._base64_key_str.charAt(r)+SlimStat._base64_key_str.charAt(s)+this._base64_key_str.charAt(o);return l},_detect_single_plugin_not_ie:function(e){var t,n,i,a;for(i in navigator.plugins){t=""+navigator.plugins[i].name+navigator.plugins[i].description,n=0;for(a in SlimStat._plugins[e].substrings)-1!=t.indexOf(SlimStat._plugins[e].substrings[a])&&n++;if(n==SlimStat._plugins[e].substrings.length)return!0}return!1},_detect_single_plugin_ie:function(e){var t;for(t in SlimStat._plugins[e].active_x_strings)try{return new ActiveXObject(SlimStat._plugins[e].active_x_strings[t]),!0}catch(n){return!1}},_detect_single_plugin:function(e){return this.detect=navigator.plugins.length?this._detect_single_plugin_not_ie:this._detect_single_plugin_ie,this.detect(e)},detect_plugins:function(){var e="",t=[];for(e in SlimStat._plugins)SlimStat._detect_single_plugin(e)&&t.push(e);return t.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},send_to_server:function(e,t){if("undefined"==typeof SlimStatParams.ajaxurl||"undefined"==typeof e)return"function"==typeof t&&t(),!1;try{window.XMLHttpRequest?request=new XMLHttpRequest:window.ActiveXObject&&(request=new ActiveXObject("Microsoft.XMLHTTP"))}catch(n){return"function"==typeof t&&t(),!1}return slimstat_data_with_client_info=e+"&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(),request?(request.open("POST",SlimStatParams.ajaxurl,!0),request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),request.send(slimstat_data_with_client_info),request.onreadystatechange=function(){4==request.readyState&&("undefined"==typeof SlimStatParams.id?(parsed_id=parseInt(request.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStat._id=request.responseText)):SlimStat._id=SlimStatParams.id,"function"==typeof t&&t())},!0):!1},ss_track:function(e,t,n,i){if(e||(e=window.event),type="undefined"==typeof t?0:parseInt(t),note_array=[],parsed_id=parseInt(SlimStat._id),isNaN(parsed_id)||parsed_id<=0)return"function"==typeof i&&i(),!1;if(node="undefined"!=typeof e.target?e.target:"undefined"!=typeof e.srcElement?e.srcElement:!1,!node)return"function"==typeof i&&i(),!1;switch(3==node.nodeType&&(node=node.parentNode),parent_node=node.parentNode,resource_url="",node.nodeName){case"FORM":node.action.length>0&&(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.length>0){resource_url=parent_node.action;break}default:if("A"!=node.nodeName){if("function"==typeof node.getAttribute&&"undefined"!=node.getAttribute("id")&&node.getAttribute("id").length){resource_url=node.getAttribute("id");break}for(;"undefined"!=typeof node.parentNode&&null!=node.parentNode&&"A"!=node.nodeName&&"BODY"!=node.nodeName;)node=node.parentNode}"undefined"!=typeof node.hash&&node.hash.length>0&&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")&&null!=node.getAttribute("title")&&node.getAttribute("title").length>0&&note_array.push("Title:"+node.getAttribute("title")),"undefined"!=typeof node.getAttribute("id")&&null!=node.getAttribute("id")&&node.getAttribute("id").length>0&&note_array.push("ID:"+node.getAttribute("id")))}return pos_x=-1,pos_y=-1,position="","undefined"!=typeof e.pageX&&"undefined"!=typeof e.pageY?(pos_x=e.pageX,pos_y=e.pageY):"undefined"!=typeof e.clientX&&"undefined"!=typeof e.clientY&&"undefined"!=typeof document.body.scrollLeft&&"undefined"!=typeof document.documentElement.scrollLeft&&"undefined"!=typeof document.body.scrollTop&&"undefined"!=typeof document.documentElement.scrollTop&&(pos_x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,pos_y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),pos_x>0&&pos_y>0&&(position=pos_x+","+pos_y),event_description=e.type,"click"!=e.type&&"undefined"!=typeof e.which&&(event_description+="keypress"==e.type?"; keypress:"+String.fromCharCode(parseInt(e.which)):"; which:"+e.which),"undefined"!=typeof n&&n.length>0&&note_array.push(n),note_string=SlimStat._base64_encode(note_array.join(", ")),requested_op="update",1==type&&(resource_url=SlimStat._base64_encode(resource_url.substring(resource_url.indexOf(location.hostname)+location.hostname.length)),requested_op="add"),SlimStat.send_to_server("action=slimtrack&op="+requested_op+"&id="+SlimStat._id+"&ty="+type+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(resource_url)+"&pos="+position+"&des="+SlimStat._base64_encode(event_description)+"&no="+note_string,i),!0},add_event:function(e,t,n){e&&e.addEventListener?e.addEventListener(t,n,!1):e&&e.attachEvent?(e["e"+t+n]=n,e[t+n]=function(){e["e"+t+n](window.event)},e.attachEvent("on"+t,e[t+n])):e["on"+t]=e["e"+t+n]},event_fire:function(e,t){var n=e;if(document.createEvent){var i=document.createEvent("MouseEvents");i.initEvent(t,!0,!1),n.dispatchEvent(i)}else if(document.createEventObject){var i=document.createEventObject();n.fireEvent("on"+t,i)}},in_array:function(e,t){for(var n=0;n<t.length;n++)if(t[n].trim()==e)return!0;return!1},in_array_substring:function(e,t){for(var n=0;n<t.length;n++)if(-1!=e.indexOf(t[n].trim()))return!0;return!1}};SlimStat.add_event(window,"load",function(){if("undefined"==typeof SlimStatParams.disable_outbound_tracking){all_links=document.getElementsByTagName("a");for(var e="undefined"!=typeof SlimStatParams.extensions_to_track&&SlimStatParams.extensions_to_track.length>0?SlimStatParams.extensions_to_track.split(","):[],t="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_ignore&&SlimStatParams.outbound_classes_rel_href_to_ignore.length>0?SlimStatParams.outbound_classes_rel_href_to_ignore.split(","):[],n="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_not_track&&SlimStatParams.outbound_classes_rel_href_to_not_track.length>0?SlimStatParams.outbound_classes_rel_href_to_not_track.split(","):[],i=0;i<all_links.length;i++)!function(){var a=all_links[i];if(a.slimstat_actual_click=!1,a.slimstat_type=!a.href||a.hostname!=location.hostname&&-1!=a.href.indexOf("://")?0:2,a.slimstat_track_me=!0,a.slimstat_callback=!0,2!=a.slimstat_type||"undefined"!=typeof SlimStatParams.track_internal_links&&"false"!=SlimStatParams.track_internal_links||(a.slimstat_track_me=!1),a.slimstat_track_me&&(t.length>0||n.length>0)){classes_current_link="undefined"!=typeof a.className&&a.className.length>0?a.className.split(" "):[];for(var r=0;r<classes_current_link.length;r++)if(SlimStat.in_array_substring(classes_current_link[r],t)&&(a.slimstat_callback=!1),SlimStat.in_array_substring(classes_current_link[r],n)){a.slimstat_track_me=!1;break}a.slimstat_track_me&&"undefined"!=typeof a.attributes.rel&&a.attributes.rel.value.length>0&&(SlimStat.in_array_substring(a.attributes.rel.value,t)&&(a.slimstat_callback=!1),SlimStat.in_array_substring(a.attributes.rel.value,n)&&(a.slimstat_track_me=!1)),a.slimstat_track_me&&"undefined"!=typeof a.href&&a.href.length>0&&(SlimStat.in_array_substring(a.href,t)&&(a.slimstat_callback=!1),SlimStat.in_array_substring(a.href,n)&&(a.slimstat_track_me=!1))}e.length>0&&2==a.slimstat_type&&a.pathname.indexOf(".")>0&&(extension_current_link=a.pathname.split(".").pop().replace(/[\/\-]/g,""),a.slimstat_track_me=SlimStat.in_array(extension_current_link,e),a.slimstat_type=1),a.slimstat_track_me&&a.target&&!a.target.match(/^_(self|parent|top)$/i)&&(a.slimstat_callback=!1),a.setAttribute("data-slimstat-tracking",a.slimstat_track_me),a.setAttribute("data-slimstat-callback",a.slimstat_callback),SlimStat.add_event(a,"click",function(e){this.slimstat_track_me&&!this.slimstat_actual_click&&(this.slimstat_callback?("function"==typeof e.preventDefault&&e.preventDefault(),this.slimstat_actual_click=!0,SlimStat.ss_track(e,this.slimstat_type,"",function(){SlimStat.event_fire(a,"click")})):SlimStat.ss_track(e,this.slimstat_type,"",function(){}))})}()}});var slimstat_data="action=slimtrack";"undefined"!=typeof SlimStatParams.id&&parseInt(SlimStatParams.id)>0?slimstat_data+="&op=update&id="+SlimStatParams.id:"undefined"!=typeof SlimStatParams.ci&&(slimstat_data+="&op=add&id="+SlimStatParams.ci+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href)),slimstat_data.length&&SlimStat.add_event(window,"load",function(){setTimeout(function(){SlimStat.send_to_server(slimstat_data)},0)});
wp-slimstat.php CHANGED
@@ -3,15 +3,15 @@
3
  Plugin Name: WP Slimstat
4
  Plugin URI: http://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
- Version: 4.1.1
7
  Author: Camu
8
- Author URI: http://slimstat.getused.to.it/
9
  */
10
 
11
  if (!empty(wp_slimstat::$options)) return true;
12
 
13
  class wp_slimstat{
14
- public static $version = '4.1.1';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
@@ -31,8 +31,8 @@ class wp_slimstat{
31
  public static function init(){
32
 
33
  // Load all the settings
34
- self::$options = (is_network_admin() && (empty($_GET['page']) || strpos($_GET['page'], 'wp-slim-view') === false))?get_site_option('slimstat_options', array()):get_option('slimstat_options', array());
35
- self::$options = array_merge(self::init_options(), self::$options);
36
 
37
  // Allow third party tools to edit the options
38
  self::$options = apply_filters('slimstat_init_options', self::$options);
@@ -166,8 +166,8 @@ class wp_slimstat{
166
  'dt' => date_i18n('U')
167
  );
168
 
169
- if (!empty(self::$data_js['res'])){
170
- $event_info['type'] = abs(intval(self::$data_js['type']));
171
  }
172
  if (!empty(self::$data_js['des'])){
173
  $event_info['event_description'] = strip_tags(trim(base64_decode(self::$data_js['des'])));
@@ -226,8 +226,13 @@ class wp_slimstat{
226
  }
227
 
228
  // Fix Google Images referring domain
229
- if ( ( strpos(self::$stat[ 'referer' ], 'www.google' ) !== false ) && ( strpos( self::$stat[ 'referer' ], '/imgres?' ) !== false ) ) {
230
- self::$stat[ 'referer' ] = str_replace( 'www.google', 'images.google', self::$stat[ 'referer' ] );
 
 
 
 
 
231
  }
232
 
233
  // Is this referer blacklisted?
3
  Plugin Name: WP Slimstat
4
  Plugin URI: http://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
+ Version: 4.1.2
7
  Author: Camu
8
+ Author URI: http://www.wp-slimstat.com/
9
  */
10
 
11
  if (!empty(wp_slimstat::$options)) return true;
12
 
13
  class wp_slimstat{
14
+ public static $version = '4.1.2';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
31
  public static function init(){
32
 
33
  // Load all the settings
34
+ self::$options = ( is_network_admin() && ( empty($_GET[ 'page' ] ) || strpos( $_GET[ 'page' ], 'wp-slim-view' ) === false ) ) ? get_site_option( 'slimstat_options', array() ) : get_option( 'slimstat_options', array() );
35
+ self::$options = array_merge( self::init_options(), self::$options );
36
 
37
  // Allow third party tools to edit the options
38
  self::$options = apply_filters('slimstat_init_options', self::$options);
166
  'dt' => date_i18n('U')
167
  );
168
 
169
+ if (!empty(self::$data_js['ty'])){
170
+ $event_info['type'] = abs(intval(self::$data_js['ty']));
171
  }
172
  if (!empty(self::$data_js['des'])){
173
  $event_info['event_description'] = strip_tags(trim(base64_decode(self::$data_js['des'])));
226
  }
227
 
228
  // Fix Google Images referring domain
229
+ if ( strpos(self::$stat[ 'referer' ], 'www.google' ) !== false ) {
230
+ if ( strpos( self::$stat[ 'referer' ], '/imgres?' ) !== false ) {
231
+ self::$stat[ 'referer' ] = str_replace( 'www.google', 'images.google', self::$stat[ 'referer' ] );
232
+ }
233
+ if ( strpos( self::$stat[ 'referer' ], '/url?' ) !== false ) {
234
+ self::$stat[ 'referer' ] = str_replace( '/url?', '/search?', self::$stat[ 'referer' ] );
235
+ }
236
  }
237
 
238
  // Is this referer blacklisted?