Slimstat Analytics - Version 4.9.0.1

Version Description

  • [Fix] Entries in the Top Referring Domains report were pointing to broken links (thank you, s7ech).
  • [Fix] The new Browscap Library requires at least PHP 7.4, up from 7.1. (thank you, Daniel Jaraud).
Download this release

Release Info

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

Code changes from version 4.9 to 4.9.0.1

CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
  ## Changelog ##
 
 
 
 
 
2
  ### 4.9 ###
3
  * [New] Browscap Library is now bundled with the main plugin, only definition files are downloaded dynamically.
4
  * [New] Support MaxMind License Key for GeoLite2 database downloads.
@@ -61,21 +66,3 @@
61
  * [Fix] When the plugin was network activated on a group of existing blogs, the tables used to store all the records were not initialized as expected, under given circumstances.
62
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
63
  * [Fix] Emptying one of the settings and saving did not produce the desired effect.
64
-
65
- ### 4.8.6.2 ###
66
- * [Update] We tweaked the SQL query to retrieve 'recent' results, and added a GROUP BY clause to remove duplicates. This might affect some custom reports you might have created, so please don't hesitate to contact us if you have any question or experience any issues.
67
- * [Fix] The button to delete all the records from the database was not working as expected (thank you, [Softfully](https://wordpress.org/support/topic/delete-all-records-doesnt-work/)).
68
-
69
- ### 4.8.6.1 ###
70
- * [Fix] A regression bug was introduced in 4.8.6, affecting some of the shortcodes and reports.
71
-
72
- ### 4.8.6 ###
73
- * [New] Slimstat can now track most WordPress redirects and mark them with the appropriate content type.
74
- * [Update] The GDPR compliance through third-party tools is now more flexible and allows admins to specify name/value pairs so that the cookie must CONTAIN the given string.
75
- * [Update] Simplified code that manages the sidebar menu.
76
- * [Update] Reorganized code that manages the plugin options.
77
- * [Update] Rewrote the portion of code that manages tracker errors, which are now saved in a separate field in the database.
78
- * [Update] Reintroduced feature to hide certain report pages when no reports are assigned to them.
79
- * [Update] Decrease the number of database requests needed to record a new pageview.
80
- * [Fix] Entries with a trailing slash and ones without were being listed as separate in Top Web Pages.
81
- * [Fix] Typo in one of the conditions definining the Top Bots report.
1
  ## Changelog ##
2
+
3
+ ### 4.9.0.1 ###
4
+ * [Fix] Entries in the Top Referring Domains report were pointing to broken links (thank you, [s7ech](https://github.com/slimstat/wp-slimstat/issues/21)).
5
+ * [Fix] The new Browscap Library requires at least PHP 7.4, up from 7.1. (thank you, [Daniel Jaraud](https://github.com/slimstat/wp-slimstat/issues/22)).
6
+
7
  ### 4.9 ###
8
  * [New] Browscap Library is now bundled with the main plugin, only definition files are downloaded dynamically.
9
  * [New] Support MaxMind License Key for GeoLite2 database downloads.
66
  * [Fix] When the plugin was network activated on a group of existing blogs, the tables used to store all the records were not initialized as expected, under given circumstances.
67
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
68
  * [Fix] Emptying one of the settings and saving did not produce the desired effect.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -12,33 +12,19 @@ The leading web analytics plugin for WordPress. Track returning customers and re
12
  * **Geolocation**: identify your visitors by city and country, browser type and operating system (courtesy of [MaxMind](https://www.maxmind.com/) and [Browscap](https://browscap.org)).
13
  * **World Map**: see where your visitors are coming from, even on your mobile device (courtesy of [amMap](https://www.ammap.com/)).
14
 
15
- ### Premium Add-ons ###
16
- Visit [our website](https://www.wp-slimstat.com/addons/) for a list of available extensions.
17
-
18
  ### Contribute ###
19
  Slimstat Analytics is an open source project, dependent in large part on community support. You can fork our [Github repository](https://github.com/slimstat/wp-slimstat) and submit code enhancements, bugfixes or provide localization files to let our plugin speak even more languages. [This page](https://www.paypal.com/cgi-bin/webscr?cmd###_s-xclick&hosted_button_id###BNJR5EZNY3W38)
20
  is for those who would like to donate money - be it once, be it regularly, be it a small or a big amount. Everything is set up for an easy donation process.
21
  Try it out, you'll be amazed how good it feels! If you're on a tight budget, and coding is not your thing, please consider writing [a review](https://wordpress.org/support/plugin/wp-slimstat/reviews/#new-post) for Slimstat as a token of appreciation for our hard work!
22
 
23
  ### Requirements ###
24
- * WordPress 4.9+
25
  * PHP 7.4+
26
  * MySQL 5.0.3+
27
- * At least 40 MB of free web space
28
- * At least 5 MB of free DB space
29
  * At least 32 Mb of free PHP memory for the tracker (peak memory usage)
30
 
31
- ## Installation ##
32
- 1. In your WordPress admin, go to Plugins > Add New
33
- 2. Search for limstat Analytics
34
- 3. Click on **Install Now** next to Slimstat Analytics and then activate the plugin
35
- 4. Make sure your template calls `wp_footer()` or the equivalent hook somewhere (possibly just before the `</body>` tag)
36
- 5. If your `wp-admin` folder is not publicly accessible, make sure to check our [knowledge base](https://docs.wp-slimstat.com/) to see if there's anything else you need to do
37
-
38
- ## Please note ##
39
- * If you decide to uninstall Slimstat Analytics, all the stats will be **PERMANENTLY** deleted from your database if you enable the 'Delete Data on Uninstall' setting. In this case, make sure to setup a database backup (wp_slim_*) to avoid losing your data.
40
- * If you are upgrading from a version prior to 4.0, please [install version 4.0](https://downloads.wordpress.org/plugin/wp-slimstat.4.0.zip) first to upgrade the database structure and download the new Geolocation data.
41
-
42
  ## Frequently Asked Questions ##
43
- Our knowledge base is available on our [support center](https://docs.wp-slimstat.com/) website.
44
 
12
  * **Geolocation**: identify your visitors by city and country, browser type and operating system (courtesy of [MaxMind](https://www.maxmind.com/) and [Browscap](https://browscap.org)).
13
  * **World Map**: see where your visitors are coming from, even on your mobile device (courtesy of [amMap](https://www.ammap.com/)).
14
 
 
 
 
15
  ### Contribute ###
16
  Slimstat Analytics is an open source project, dependent in large part on community support. You can fork our [Github repository](https://github.com/slimstat/wp-slimstat) and submit code enhancements, bugfixes or provide localization files to let our plugin speak even more languages. [This page](https://www.paypal.com/cgi-bin/webscr?cmd###_s-xclick&hosted_button_id###BNJR5EZNY3W38)
17
  is for those who would like to donate money - be it once, be it regularly, be it a small or a big amount. Everything is set up for an easy donation process.
18
  Try it out, you'll be amazed how good it feels! If you're on a tight budget, and coding is not your thing, please consider writing [a review](https://wordpress.org/support/plugin/wp-slimstat/reviews/#new-post) for Slimstat as a token of appreciation for our hard work!
19
 
20
  ### Requirements ###
21
+ * WordPress 5.6+
22
  * PHP 7.4+
23
  * MySQL 5.0.3+
24
+ * At least 5 MB of free web space (240 MB if you plan on using the external libraries for geolocation and browser detection)
25
+ * At least 10 MB of free DB space
26
  * At least 32 Mb of free PHP memory for the tracker (peak memory usage)
27
 
 
 
 
 
 
 
 
 
 
 
 
28
  ## Frequently Asked Questions ##
29
+ An extensive knowledge base is available on our [website](https://www.wp-slimstat.com/).
30
 
admin/config/index.php CHANGED
@@ -582,12 +582,12 @@ var SlimStatParams = { ajaxurl: "' . admin_url( 'admin-ajax.php' ) . '" };
582
  )
583
  );
584
 
585
- // This option can only be added if this site is running PHP 7.1+
586
- if ( version_compare( PHP_VERSION, '7.1', '>=' ) ) {
587
  $enable_browscap = array( 'enable_browscap' => array(
588
  'title' => __( 'Browscap Library', 'wp-slimstat' ),
589
  'type'=> 'toggle',
590
- 'description'=> __( "We are contributing to the <a href='https://browscap.org/' target='_blank'>Browscap Capabilities Project</a>, which we use to decode your visitors' user agent string into browser name and operating system. We use an <a href='https://github.com/slimstat/browscap-cache' target='_blank'>optimized version of their data structure</a>, for improved performance. When enabled, Slimstat uses this library in addition to the built-in heuristic function, to determine your visitors' browser information. Updates are downloaded automatically every two weeks, when available.", 'wp-slimstat' ) . ( !empty( slim_browser::$browscap_local_version ) ? ' ' . sprintf( __( 'You are currently using version %s.', 'wp-slimstat' ), '<strong>' . slim_browser::$browscap_local_version . '</strong>' ) : '' )
591
  ) );
592
 
593
  $settings[ 6 ][ 'rows' ] = array_slice( $settings[ 6 ][ 'rows' ], 0, 7, true) + $enable_browscap + array_slice($settings[ 6 ][ 'rows' ], 7, NULL, true );
@@ -675,7 +675,7 @@ if ( !empty( $settings ) && !empty( $_REQUEST[ 'slimstat_update_settings' ] ) &&
675
  }
676
  else {
677
  // Some users have reported that a directory is created, instead of a file
678
- $is_deleted = @rmdir( $maxmind_path );
679
 
680
  if ( $is_deleted ) {
681
  $save_messages[] = __( 'The geolocation database has been uninstalled from your server.', 'wp-slimstat' );
@@ -693,18 +693,13 @@ if ( !empty( $settings ) && !empty( $_REQUEST[ 'slimstat_update_settings' ] ) &&
693
  if ( $_POST[ 'options' ][ 'enable_browscap' ] == 'on' && wp_slimstat::$settings[ 'enable_browscap' ] == 'no' ) {
694
  $error = slim_browser::update_browscap_database( true );
695
 
696
- if ( !is_array( $error ) ) {
697
- $save_messages[] = __( 'The Browscap library has been installed on your server.', 'wp-slimstat' );
698
  wp_slimstat::$settings[ 'enable_browscap' ] = 'on';
699
  }
700
- else {
701
- $save_messages[] = $error[ 1 ];
702
- }
703
  }
704
  else if ( $_POST[ 'options' ][ 'enable_browscap' ] == 'no' && wp_slimstat::$settings[ 'enable_browscap' ] == 'on' ) {
705
- WP_Filesystem();
706
-
707
- if ( $GLOBALS[ 'wp_filesystem' ]->rmdir( wp_slimstat::$upload_dir . '/browscap-cache-master/', true ) ) {
708
  $save_messages[] = __( 'The Browscap data file has been uninstalled from your server.', 'wp-slimstat' );
709
  wp_slimstat::$settings[ 'enable_browscap' ] = 'no';
710
  }
@@ -716,7 +711,10 @@ if ( !empty( $settings ) && !empty( $_REQUEST[ 'slimstat_update_settings' ] ) &&
716
 
717
  // All other options
718
  foreach( $_POST[ 'options' ] as $a_post_slug => $a_post_value ) {
719
- if ( empty( $settings[ $current_tab ][ 'rows' ][ $a_post_slug ] ) || !empty( $settings[ $current_tab ][ 'rows' ][ $a_post_slug ][ 'readonly' ] ) || in_array( $settings[ $current_tab ][ 'rows' ][ $a_post_slug ][ 'type' ], array( 'section_header', 'plain-text' ) ) ) {
 
 
 
720
  continue;
721
  }
722
 
582
  )
583
  );
584
 
585
+ // This option can only be added if this site is running PHP 7.4+
586
+ if ( version_compare( PHP_VERSION, '7.4', '>=' ) ) {
587
  $enable_browscap = array( 'enable_browscap' => array(
588
  'title' => __( 'Browscap Library', 'wp-slimstat' ),
589
  'type'=> 'toggle',
590
+ 'description'=> __( "We are contributing to the <a href='https://browscap.org/' target='_blank'>Browscap Capabilities Project</a>, which we use to decode your visitors' user agent string into browser name and operating system. We use an <a href='https://github.com/slimstat/browscap-cache' target='_blank'>optimized version of their data structure</a>, for improved performance. When enabled, Slimstat uses this library in addition to the built-in heuristic function, to determine your visitors' browser information. Updates are downloaded automatically every week, when available.", 'wp-slimstat' ) . ( !empty( slim_browser::$browscap_local_version ) ? ' ' . sprintf( __( 'You are currently using version %s.', 'wp-slimstat' ), '<strong>' . slim_browser::$browscap_local_version . '</strong>' ) : '' )
591
  ) );
592
 
593
  $settings[ 6 ][ 'rows' ] = array_slice( $settings[ 6 ][ 'rows' ], 0, 7, true) + $enable_browscap + array_slice($settings[ 6 ][ 'rows' ], 7, NULL, true );
675
  }
676
  else {
677
  // Some users have reported that a directory is created, instead of a file
678
+ $is_deleted = wp_slimstat_admin::rmdir( $maxmind_path );
679
 
680
  if ( $is_deleted ) {
681
  $save_messages[] = __( 'The geolocation database has been uninstalled from your server.', 'wp-slimstat' );
693
  if ( $_POST[ 'options' ][ 'enable_browscap' ] == 'on' && wp_slimstat::$settings[ 'enable_browscap' ] == 'no' ) {
694
  $error = slim_browser::update_browscap_database( true );
695
 
696
+ if ( $error[ 0 ] == 0 ) {
 
697
  wp_slimstat::$settings[ 'enable_browscap' ] = 'on';
698
  }
699
+ $save_messages[] = $error[ 1 ];
 
 
700
  }
701
  else if ( $_POST[ 'options' ][ 'enable_browscap' ] == 'no' && wp_slimstat::$settings[ 'enable_browscap' ] == 'on' ) {
702
+ if ( wp_slimstat_admin::rmdir( wp_slimstat::$upload_dir . '/browscap-cache-master' ) ) {
 
 
703
  $save_messages[] = __( 'The Browscap data file has been uninstalled from your server.', 'wp-slimstat' );
704
  wp_slimstat::$settings[ 'enable_browscap' ] = 'no';
705
  }
711
 
712
  // All other options
713
  foreach( $_POST[ 'options' ] as $a_post_slug => $a_post_value ) {
714
+ if ( empty( $settings[ $current_tab ][ 'rows' ][ $a_post_slug ] ) ||
715
+ !empty( $settings[ $current_tab ][ 'rows' ][ $a_post_slug ][ 'readonly' ] ) ||
716
+ in_array( $settings[ $current_tab ][ 'rows' ][ $a_post_slug ][ 'type' ], array( 'section_header', 'plain-text' ) ) ||
717
+ in_array( $a_post_slug, array( 'enable_maxmind', 'enable_browscap' ) ) ) {
718
  continue;
719
  }
720
 
admin/index.php CHANGED
@@ -489,6 +489,9 @@ class wp_slimstat_admin {
489
 
490
  if ( !empty( wp_slimstat_reports::$user_reports[ 'dashboard' ] ) && is_array( wp_slimstat_reports::$user_reports[ 'dashboard' ] ) ) {
491
  foreach ( wp_slimstat_reports::$user_reports[ 'dashboard' ] as $a_report_id ) {
 
 
 
492
  wp_add_dashboard_widget( $a_report_id, wp_slimstat_reports::$reports[ $a_report_id ][ 'title' ], array( 'wp_slimstat_reports', 'callback_wrapper' ) );
493
  }
494
  }
@@ -892,6 +895,32 @@ class wp_slimstat_admin {
892
  }
893
  // END: delete_pageview
894
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
895
  /**
896
  * Handles the Ajax requests to load, save or delete existing filters
897
  */
489
 
490
  if ( !empty( wp_slimstat_reports::$user_reports[ 'dashboard' ] ) && is_array( wp_slimstat_reports::$user_reports[ 'dashboard' ] ) ) {
491
  foreach ( wp_slimstat_reports::$user_reports[ 'dashboard' ] as $a_report_id ) {
492
+ if ( empty( wp_slimstat_reports::$reports[ $a_report_id ] ) ) {
493
+ continue;
494
+ }
495
  wp_add_dashboard_widget( $a_report_id, wp_slimstat_reports::$reports[ $a_report_id ][ 'title' ], array( 'wp_slimstat_reports', 'callback_wrapper' ) );
496
  }
497
  }
895
  }
896
  // END: delete_pageview
897
 
898
+ /**
899
+ * Deletes a given pageview from the database
900
+ */
901
+ public static function rmdir( $path ) {
902
+ if ( !file_exists( $path ) ) {
903
+ return true;
904
+ }
905
+
906
+ if ( !is_dir( $path ) ) {
907
+ return unlink( $path );
908
+ }
909
+
910
+ foreach ( scandir( $path ) as $a_item ) {
911
+ if ( $a_item == '.' || $a_item == '..' ) {
912
+ continue;
913
+ }
914
+
915
+ if ( !wp_slimstat_admin::rmdir( $path . DIRECTORY_SEPARATOR . $a_item ) ) {
916
+ return false;
917
+ }
918
+ }
919
+
920
+ return rmdir( $path );
921
+ }
922
+ // END: delete_pageview
923
+
924
  /**
925
  * Handles the Ajax requests to load, save or delete existing filters
926
  */
admin/view/index.php CHANGED
@@ -147,6 +147,11 @@
147
  <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
148
 
149
  foreach( wp_slimstat_reports::$user_reports[ wp_slimstat_admin::$current_screen ] as $a_report_id ) {
 
 
 
 
 
150
  wp_slimstat_reports::report_header( $a_report_id );
151
  wp_slimstat_reports::callback_wrapper( array( 'id' => $a_report_id ) );
152
  wp_slimstat_reports::report_footer();
147
  <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
148
 
149
  foreach( wp_slimstat_reports::$user_reports[ wp_slimstat_admin::$current_screen ] as $a_report_id ) {
150
+ // A report could have been deprecated...
151
+ if ( empty( wp_slimstat_reports::$reports[ $a_report_id ] ) ) {
152
+ continue;
153
+ }
154
+
155
  wp_slimstat_reports::report_header( $a_report_id );
156
  wp_slimstat_reports::callback_wrapper( array( 'id' => $a_report_id ) );
157
  wp_slimstat_reports::report_footer();
admin/view/wp-slimstat-reports.php CHANGED
@@ -226,18 +226,6 @@ class wp_slimstat_reports {
226
  'locations' => array( 'slimview2' ),
227
  'tooltip' => $chart_tooltip
228
  ),
229
- 'slim_p1_20' => array(
230
- 'title' => __('Top Referring URLs', 'wp-slimstat'),
231
- 'callback' => array( __CLASS__, 'raw_results_to_html' ),
232
- 'callback_args' => array(
233
- 'type' => 'top',
234
- 'columns' => 'referer',
235
- 'where' => 'referer NOT LIKE "%' . str_replace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ) . '%"',
236
- 'raw' => array( 'wp_slimstat_db', 'get_top' )
237
- ),
238
- 'classes' => array( 'normal' ),
239
- 'locations' => array( 'slimview2', 'slimview5', 'dashboard' )
240
- ),
241
 
242
  'slim_p2_01' => array(
243
  'title' => __( 'Human Visits', 'wp-slimstat' ),
@@ -533,20 +521,6 @@ class wp_slimstat_reports {
533
  'classes' => array( 'normal' ),
534
  'locations' => array( 'slimview5' )
535
  ),
536
- 'slim_p3_06' => array(
537
- 'title' => __( 'Top Referring Search Engines', 'wp-slimstat' ),
538
- 'callback' => array( __CLASS__, 'raw_results_to_html' ),
539
- 'callback_args' => array(
540
- 'type' => 'top',
541
- 'columns' => 'REPLACE( SUBSTRING_INDEX( SUBSTRING_INDEX( SUBSTRING_INDEX( referer, "://", -1 ), "/", 1 ), ".", -5 ), "www.", "" )',
542
- 'as_column' => 'referer',
543
- 'filter_op' => 'contains',
544
- 'where' => 'searchterms IS NOT NULL AND searchterms <> "" AND searchterms <> "_" AND referer NOT LIKE "%' . str_replace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ) . '%"',
545
- 'raw' => array( 'wp_slimstat_db', 'get_top' )
546
- ),
547
- 'classes' => array( 'normal' ),
548
- 'locations' => array( 'slimview5', 'dashboard' )
549
- ),
550
 
551
  'slim_p4_01' => array(
552
  'title' => __( 'Recent Outbound Links', 'wp-slimstat' ),
@@ -1177,7 +1151,10 @@ class wp_slimstat_reports {
1177
 
1178
  if ( $_args[ 'columns' ] == 'referer' && !empty( $_args[ 'type' ] ) && $_args[ 'type' ] == 'top' ) {
1179
  $element_url = htmlentities( $results[ $i ][ 'referer' ], ENT_QUOTES, 'UTF-8' );
1180
- $element_value = '<a target="_blank" class="slimstat-font-logout" title="'.__('Open this URL in a new window','wp-slimstat').'" href="'.$element_url.'"></a> '.$element_value;
 
 
 
1181
  }
1182
 
1183
  if ( is_admin() && !empty( $results[ $i ][ 'ip' ]) && $_args[ 'columns' ] != 'ip' && wp_slimstat::$settings[ 'convert_ip_addresses' ] != 'on' ) {
226
  'locations' => array( 'slimview2' ),
227
  'tooltip' => $chart_tooltip
228
  ),
 
 
 
 
 
 
 
 
 
 
 
 
229
 
230
  'slim_p2_01' => array(
231
  'title' => __( 'Human Visits', 'wp-slimstat' ),
521
  'classes' => array( 'normal' ),
522
  'locations' => array( 'slimview5' )
523
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
 
525
  'slim_p4_01' => array(
526
  'title' => __( 'Recent Outbound Links', 'wp-slimstat' ),
1151
 
1152
  if ( $_args[ 'columns' ] == 'referer' && !empty( $_args[ 'type' ] ) && $_args[ 'type' ] == 'top' ) {
1153
  $element_url = htmlentities( $results[ $i ][ 'referer' ], ENT_QUOTES, 'UTF-8' );
1154
+ if ( strpos( $element_url, 'http' ) === false ) {
1155
+ $element_url = 'https://' . $element_url;
1156
+ }
1157
+ $element_value = '<a target="_blank" class="slimstat-font-logout" title="' . __( 'Open this URL in a new window', 'wp-slimstat' ) . '" href="'.$element_url.'"></a> '.$element_value;
1158
  }
1159
 
1160
  if ( is_admin() && !empty( $results[ $i ][ 'ip' ]) && $_args[ 'columns' ] != 'ip' && wp_slimstat::$settings[ 'convert_ip_addresses' ] != 'on' ) {
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: coolmann, toxicum
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BNJR5EZNY3W38
4
  Tags: analytics, statistics, counter, tracking, reports, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress, power stats, hit
5
  Text Domain: wp-slimstat
6
- Requires at least: 4.9
7
  Requires PHP: 7.4+
8
- Tested up to: 5.9
9
- Stable tag: 4.9
10
 
11
  == Description ==
12
  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.
@@ -22,20 +22,19 @@ The leading web analytics plugin for WordPress. Track returning customers and re
22
  * **Geolocation**: identify your visitors by city and country, browser type and operating system (courtesy of [MaxMind](https://www.maxmind.com/) and [Browscap](https://browscap.org)).
23
  * **World Map**: see where your visitors are coming from, even on your mobile device (courtesy of [amMap](https://www.ammap.com/)).
24
 
25
- = Premium Add-ons =
26
- Visit [our website](https://www.wp-slimstat.com/addons/) for a list of available extensions.
27
-
28
  = Contribute =
29
- Slimstat Analytics is an open source project, dependent in large part on community support. You can fork our [Github repository](https://github.com/slimstat/wp-slimstat) and submit code enhancements, bugfixes or provide localization files to let our plugin speak even more languages. [This page](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BNJR5EZNY3W38)
30
- is for those who would like to donate money - be it once, be it regularly, be it a small or a big amount. Everything is set up for an easy donation process.
 
 
31
  Try it out, you'll be amazed how good it feels! If you're on a tight budget, and coding is not your thing, please consider writing [a review](https://wordpress.org/support/plugin/wp-slimstat/reviews/#new-post) for Slimstat as a token of appreciation for our hard work!
32
 
33
  = Requirements =
34
  * WordPress 5.0+
35
  * PHP 7.4+
36
  * MySQL 5.0.3+
37
- * At least 40 MB of free web space
38
- * At least 5 MB of free DB space
39
  * At least 32 Mb of free PHP memory for the tracker (peak memory usage)
40
 
41
  == Installation ==
@@ -43,14 +42,12 @@ Try it out, you'll be amazed how good it feels! If you're on a tight budget, and
43
  2. Search for limstat Analytics
44
  3. Click on **Install Now** next to Slimstat Analytics and then activate the plugin
45
  4. Make sure your template calls `wp_footer()` or the equivalent hook somewhere (possibly just before the `</body>` tag)
46
- 5. If your `wp-admin` folder is not publicly accessible, make sure to check our [knowledge base](https://docs.wp-slimstat.com/) to see if there's anything else you need to do
47
 
48
  == Please note ==
49
  * If you decide to uninstall Slimstat Analytics, all the stats will be **PERMANENTLY** deleted from your database. Make sure to setup a database backup (wp_slim_*) to avoid losing your data.
50
- * If you are upgrading from a version prior to 4.0, please [install version 4.0](https://downloads.wordpress.org/plugin/wp-slimstat.4.0.zip) first to upgrade the database structure and download the new Geolocation data.
51
 
52
  == Frequently Asked Questions ==
53
- Our knowledge base is available on our [support center](https://docs.wp-slimstat.com/) website.
54
 
55
  == Screenshots ==
56
  1. **Overview** - Your website traffic at a glance
@@ -60,6 +57,10 @@ Our knowledge base is available on our [support center](https://docs.wp-slimstat
60
  5. **Responsive layout** - Keep an eye on your reports on the go
61
 
62
  == Changelog ==
 
 
 
 
63
  = 4.9 =
64
  * [New] Browscap Library is now bundled with the main plugin, only definition files are downloaded dynamically.
65
  * [New] Support MaxMind License Key for GeoLite2 database downloads.
@@ -121,22 +122,4 @@ Our knowledge base is available on our [support center](https://docs.wp-slimstat
121
  * [Fix] The button to delete all the records from the database was not working as expected (thank you, [Softfully](https://wordpress.org/support/topic/delete-all-records-doesnt-work/)).
122
  * [Fix] When the plugin was network activated on a group of existing blogs, the tables used to store all the records were not initialized as expected, under given circumstances.
123
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
124
- * [Fix] Emptying one of the settings and saving did not produce the desired effect.
125
-
126
- = 4.8.6.2 =
127
- * [Update] We tweaked the SQL query to retrieve 'recent' results, and added a GROUP BY clause to remove duplicates. This might affect some custom reports you might have created, so please don't hesitate to contact us if you have any question or experience any issues.
128
- * [Fix] The button to delete all the records from the database was not working as expected (thank you, [Softfully](https://wordpress.org/support/topic/delete-all-records-doesnt-work/)).
129
-
130
- = 4.8.6.1 =
131
- * [Fix] A regression bug was introduced in 4.8.6, affecting some of the shortcodes and reports.
132
-
133
- = 4.8.6 =
134
- * [New] Slimstat can now track most WordPress redirects and mark them with the appropriate content type.
135
- * [Update] The GDPR compliance through third-party tools is now more flexible and allows admins to specify name/value pairs so that the cookie must CONTAIN the given string.
136
- * [Update] Simplified code that manages the sidebar menu.
137
- * [Update] Reorganized code that manages the plugin options.
138
- * [Update] Rewrote the portion of code that manages tracker errors, which are now saved in a separate field in the database.
139
- * [Update] Reintroduced feature to hide certain report pages when no reports are assigned to them.
140
- * [Update] Decrease the number of database requests needed to record a new pageview.
141
- * [Fix] Entries with a trailing slash and ones without were being listed as separate in Top Web Pages.
142
- * [Fix] Typo in one of the conditions definining the Top Bots report.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BNJR5EZNY3W38
4
  Tags: analytics, statistics, counter, tracking, reports, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress, power stats, hit
5
  Text Domain: wp-slimstat
6
+ Requires at least: 5.6
7
  Requires PHP: 7.4+
8
+ Tested up to: 5.9.1
9
+ Stable tag: 4.9.0.1
10
 
11
  == Description ==
12
  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.
22
  * **Geolocation**: identify your visitors by city and country, browser type and operating system (courtesy of [MaxMind](https://www.maxmind.com/) and [Browscap](https://browscap.org)).
23
  * **World Map**: see where your visitors are coming from, even on your mobile device (courtesy of [amMap](https://www.ammap.com/)).
24
 
 
 
 
25
  = Contribute =
26
+ Slimstat Analytics is an open source project, dependent in large part on community support. You can fork our [Github repository](https://github.com/slimstat/wp-slimstat) and submit code enhancements, bugfixes or provide localization files to let our plugin speak even more languages.
27
+
28
+ [This page](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BNJR5EZNY3W38) is for those who would like to donate money - be it once, be it regularly, be it a small or a big amount. Everything is set up for an easy donation process.
29
+
30
  Try it out, you'll be amazed how good it feels! If you're on a tight budget, and coding is not your thing, please consider writing [a review](https://wordpress.org/support/plugin/wp-slimstat/reviews/#new-post) for Slimstat as a token of appreciation for our hard work!
31
 
32
  = Requirements =
33
  * WordPress 5.0+
34
  * PHP 7.4+
35
  * MySQL 5.0.3+
36
+ * At least 5 MB of free web space (240 MB if you plan on using the external libraries for geolocation and browser detection)
37
+ * At least 10 MB of free DB space
38
  * At least 32 Mb of free PHP memory for the tracker (peak memory usage)
39
 
40
  == Installation ==
42
  2. Search for limstat Analytics
43
  3. Click on **Install Now** next to Slimstat Analytics and then activate the plugin
44
  4. Make sure your template calls `wp_footer()` or the equivalent hook somewhere (possibly just before the `</body>` tag)
 
45
 
46
  == Please note ==
47
  * If you decide to uninstall Slimstat Analytics, all the stats will be **PERMANENTLY** deleted from your database. Make sure to setup a database backup (wp_slim_*) to avoid losing your data.
 
48
 
49
  == Frequently Asked Questions ==
50
+ An extensive knowledge base is available on our [website](https://www.wp-slimstat.com/).
51
 
52
  == Screenshots ==
53
  1. **Overview** - Your website traffic at a glance
57
  5. **Responsive layout** - Keep an eye on your reports on the go
58
 
59
  == Changelog ==
60
+ = 4.9.0.1 =
61
+ * [Fix] Entries in the Top Referring Domains report were pointing to broken links (thank you, [s7ech](https://github.com/slimstat/wp-slimstat/issues/21)).
62
+ * [Fix] The new Browscap Library requires at least PHP 7.4, up from 7.1. (thank you, [Daniel Jaraud](https://github.com/slimstat/wp-slimstat/issues/22)).
63
+
64
  = 4.9 =
65
  * [New] Browscap Library is now bundled with the main plugin, only definition files are downloaded dynamically.
66
  * [New] Support MaxMind License Key for GeoLite2 database downloads.
122
  * [Fix] The button to delete all the records from the database was not working as expected (thank you, [Softfully](https://wordpress.org/support/topic/delete-all-records-doesnt-work/)).
123
  * [Fix] When the plugin was network activated on a group of existing blogs, the tables used to store all the records were not initialized as expected, under given circumstances.
124
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
125
+ * [Fix] Emptying one of the settings and saving did not produce the desired effect.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/browscap.php CHANGED
@@ -5,18 +5,18 @@ class slim_browser {
5
  public static $browscap_local_version = 0;
6
 
7
  public static function init() {
8
- // Init Autoload Path
9
  // Determine the local version of the data file
10
  if ( file_exists( wp_slimstat::$upload_dir . '/browscap-cache-master/version.txt' ) ) {
11
  self::$browscap_local_version = @file_get_contents( wp_slimstat::$upload_dir . '/browscap-cache-master/version.txt' );
12
  if ( false === self::$browscap_local_version ) {
13
  return array( 4, __( 'The Browscap Cache folder could not be opened on your filesystem. Please check your server permissions and try again.', 'wp-slimstat' ) );
14
  }
 
 
 
15
  }
16
 
17
- self::$browscap_local_version = intval( filter_var( self::$browscap_local_version, FILTER_SANITIZE_NUMBER_INT ) );
18
-
19
- if ( version_compare( PHP_VERSION, '7.1', '>=' ) ) {
20
  self::update_browscap_database( false );
21
  require_once( plugin_dir_path( __FILE__ ) . 'browscap-php/composer/autoload_real.php' );
22
  }
@@ -38,7 +38,9 @@ class slim_browser {
38
  return $browser;
39
  }
40
 
41
- $browser = self::get_browser_from_browscap( $browser, wp_slimstat::$upload_dir . '/browscap-cache-master/' );
 
 
42
 
43
  if ( $browser[ 'browser' ] == 'Default Browser' ) {
44
  require_once( plugin_dir_path( __FILE__ ) . 'uadetector.php' );
@@ -100,8 +102,8 @@ class slim_browser {
100
  * Downloads the Browscap User Agent database from our repository
101
  */
102
  public static function update_browscap_database( $_force_download = false ) {
103
- if ( version_compare( PHP_VERSION, '7.1', '<' ) ) {
104
- return array( 1, __( 'This library requires at least PHP 7.1. Please ask your service provider to upgrade your server accordingly.', 'wp-slimstat' ) );
105
  }
106
 
107
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
@@ -150,8 +152,7 @@ class slim_browser {
150
  return array( 5, __( 'There was an error checking the remote library version. Please try again later.', 'wp-slimstat' ) );
151
  }
152
 
153
- $remote_version = intval( wp_remote_retrieve_body( $response ) );
154
- $download_remote_file = ( self::$browscap_local_version < $remote_version );
155
  }
156
  else {
157
  return array( 0, __( 'Your version of the library does not need to be updated.', 'wp-slimstat' ) );
@@ -163,35 +164,24 @@ class slim_browser {
163
  $response = wp_safe_remote_get( 'https://github.com/slimstat/browscap-cache/archive/master.zip', array( 'timeout' => 300, 'stream' => true, 'filename' => $browscap_zip ) );
164
 
165
  if ( !file_exists( $browscap_zip ) ) {
166
- wp_slimstat::$settings[ 'browscap_last_modified' ] = $current_timestamp;
167
  return array( 6, __( 'There was an error saving the Browscap data file on your server. Please check your folder permissions.', 'wp-slimstat' ) );
168
  }
169
 
170
  if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
171
  @unlink( $browscap_zip );
172
- wp_slimstat::$settings[ 'browscap_last_modified' ] = $current_timestamp;
173
  return array( 7, __( 'There was an error downloading the Browscap data file from our server. Please try again later.', 'wp-slimstat' ) );
174
  }
175
 
176
- // Init the filesystem API
177
- require_once( ABSPATH . '/wp-admin/includes/file.php' );
178
- if ( !function_exists( 'wp_filesystem' ) ) {
179
- @unlink( $browscap_zip );
180
- wp_slimstat::$settings[ 'browscap_last_modified' ] = $current_timestamp;
181
- return array( 8, __( 'Could not initialize the WP Filesystem API. Please check your folder permissions and PHP configuration.', 'wp-slimstat' ) );
182
- }
183
-
184
- wp_filesystem();
185
-
186
- // Delete the existing folder, if present
187
- $GLOBALS[ 'wp_filesystem' ]->rmdir( wp_slimstat::$upload_dir . '/browscap-cache-master/', true );
188
 
189
  // We're ready to unzip the file
190
- $unzip_done = unzip_file( $browscap_zip, wp_slimstat::$upload_dir );
 
 
 
191
 
192
- if ( !$unzip_done || !file_exists( wp_slimstat::$upload_dir . '/browscap-cache-master/version.txt' ) ) {
193
- $GLOBALS[ 'wp_filesystem' ]->rmdir( wp_slimstat::$upload_dir . '/browscap-cache-master/', true );
194
- wp_slimstat::$settings[ 'browscap_last_modified' ] = $current_timestamp;
195
  return array( 9, __( 'There was an error uncompressing the Browscap data file on your server. Please check your folder permissions and PHP configuration.', 'wp-slimstat' ) );
196
  }
197
 
5
  public static $browscap_local_version = 0;
6
 
7
  public static function init() {
 
8
  // Determine the local version of the data file
9
  if ( file_exists( wp_slimstat::$upload_dir . '/browscap-cache-master/version.txt' ) ) {
10
  self::$browscap_local_version = @file_get_contents( wp_slimstat::$upload_dir . '/browscap-cache-master/version.txt' );
11
  if ( false === self::$browscap_local_version ) {
12
  return array( 4, __( 'The Browscap Cache folder could not be opened on your filesystem. Please check your server permissions and try again.', 'wp-slimstat' ) );
13
  }
14
+ else {
15
+ self::$browscap_local_version = trim( self::$browscap_local_version );
16
+ }
17
  }
18
 
19
+ if ( version_compare( PHP_VERSION, '7.4', '>=' ) ) {
 
 
20
  self::update_browscap_database( false );
21
  require_once( plugin_dir_path( __FILE__ ) . 'browscap-php/composer/autoload_real.php' );
22
  }
38
  return $browser;
39
  }
40
 
41
+ if ( wp_slimstat::$settings[ 'enable_browscap' ] == 'on' && version_compare( PHP_VERSION, '7.4', '>=' ) ) {
42
+ $browser = self::get_browser_from_browscap( $browser, wp_slimstat::$upload_dir . '/browscap-cache-master/' );
43
+ }
44
 
45
  if ( $browser[ 'browser' ] == 'Default Browser' ) {
46
  require_once( plugin_dir_path( __FILE__ ) . 'uadetector.php' );
102
  * Downloads the Browscap User Agent database from our repository
103
  */
104
  public static function update_browscap_database( $_force_download = false ) {
105
+ if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
106
+ return array( 1, __( 'This library requires at least PHP 7.4. Please ask your service provider to upgrade your server accordingly.', 'wp-slimstat' ) );
107
  }
108
 
109
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
152
  return array( 5, __( 'There was an error checking the remote library version. Please try again later.', 'wp-slimstat' ) );
153
  }
154
 
155
+ $download_remote_file = ( self::$browscap_local_version != trim( wp_remote_retrieve_body( $response ) ) );
 
156
  }
157
  else {
158
  return array( 0, __( 'Your version of the library does not need to be updated.', 'wp-slimstat' ) );
164
  $response = wp_safe_remote_get( 'https://github.com/slimstat/browscap-cache/archive/master.zip', array( 'timeout' => 300, 'stream' => true, 'filename' => $browscap_zip ) );
165
 
166
  if ( !file_exists( $browscap_zip ) ) {
 
167
  return array( 6, __( 'There was an error saving the Browscap data file on your server. Please check your folder permissions.', 'wp-slimstat' ) );
168
  }
169
 
170
  if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
171
  @unlink( $browscap_zip );
 
172
  return array( 7, __( 'There was an error downloading the Browscap data file from our server. Please try again later.', 'wp-slimstat' ) );
173
  }
174
 
175
+ // Delete the folder, if it exists
176
+ wp_slimstat_admin::rmdir( wp_slimstat::$upload_dir . '/browscap-cache-master/' );
 
 
 
 
 
 
 
 
 
 
177
 
178
  // We're ready to unzip the file
179
+ $ziplib = new ZipArchive;
180
+ if ( $ziplib->open( $browscap_zip ) === TRUE ) {
181
+ $ziplib->extractTo( wp_slimstat::$upload_dir );
182
+ $ziplib->close();
183
 
184
+ } else {
 
 
185
  return array( 9, __( 'There was an error uncompressing the Browscap data file on your server. Please check your folder permissions and PHP configuration.', 'wp-slimstat' ) );
186
  }
187
 
wp-slimstat.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: https://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
- Version: 4.9
7
  Author: Jason Crouse
8
  Author URI: https://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
10
  Domain Path: /languages
11
- Requires PHP: 5.5
12
  */
13
 
14
  if ( !empty( wp_slimstat::$settings ) ) {
@@ -16,7 +16,7 @@ if ( !empty( wp_slimstat::$settings ) ) {
16
  }
17
 
18
  class wp_slimstat {
19
- public static $version = '4.9';
20
  public static $settings = array();
21
 
22
  public static $wpdb = '';
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: https://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
+ Version: 4.9.0.1
7
  Author: Jason Crouse
8
  Author URI: https://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
10
  Domain Path: /languages
11
+ Requires PHP: 7.4
12
  */
13
 
14
  if ( !empty( wp_slimstat::$settings ) ) {
16
  }
17
 
18
  class wp_slimstat {
19
+ public static $version = '4.9.0.1';
20
  public static $settings = array();
21
 
22
  public static $wpdb = '';