Slimstat Analytics - Version 3.9.8.1

Version Description

  • [Note] After further discussing with the repo moderators the incompatibility issue regarding the license under which MaxMind GeoLite is released, we were able to implement a much easier way to enable the geolocation functionality in Slimstat. There's no need to download a separate plugin anymore! Just go to Slimstat > Settings > Maintenance tab, and click on Install GeoLite DB. Of course, you can always deactivate this feature by clicking on the corresponding button under the Maintenance tab.
  • [Note] If you had downloaded and installed our Get Country add-on, you can now uninstall it from your server. We apologize for any inconvenience this might have caused.
  • [New] A warning message is now displayed on the reports screens to remind you to install the GeoLite database. You can hide this message by enabling the corresponding option under Slimstat > Settings > Reports tab > Miscellaneous section.
  • [Update] Some of the Settings screens have been cleaned up and reorganized
  • [Update] Cleaned up the interface for better readability
  • [Update] Removed banner from our partner ManageWP
Download this release

Release Info

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

Code changes from version 3.9.8 to 3.9.8.1

admin/config/index.php CHANGED
@@ -6,7 +6,7 @@ if (!function_exists('add_action')) exit(0);
6
  // Define the tabs
7
  $slimtabs = '';
8
  $current_tab = empty($_GET['tab'])?1:intval($_GET['tab']);
9
- $config_tabs = apply_filters('slimstat_config_tabs', array(__('General','wp-slimstat'),__('Views','wp-slimstat'),__('Filters','wp-slimstat'),__('Permissions','wp-slimstat'),__('Advanced','wp-slimstat'),has_filter('slimstat_options_on_page')?__('Add-ons','wp-slimstat'):'none',__('Maintenance','wp-slimstat')));
10
  foreach ($config_tabs as $a_tab_id => $a_tab_name){
11
  if ($a_tab_name != 'none') $slimtabs .= "<li class='nav-tab nav-tab".(($current_tab == $a_tab_id+1)?'-active':'-inactive')."'><a href='".wp_slimstat_admin::$config_url.($a_tab_id+1)."'>$a_tab_name</a></li>";
12
  }
@@ -44,28 +44,30 @@ switch ($config_tabs[$current_tab-1]){
44
  }
45
  }
46
  break;
47
- case __('Views','wp-slimstat'):
48
  $options_on_this_page = array(
49
- 'views_basic_header' => array('description' => __('Data and Formats','wp-slimstat'), 'type' => 'section_header'),
50
- 'convert_ip_addresses' => array('description' => __('Convert IP Addresses','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Display provider names instead of IP addresses.','wp-slimstat')),
51
  'use_european_separators' => array('description' => __('Number Format','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Choose the number format you want to use for your reports.','wp-slimstat'), 'custom_label_yes' => '1.234,56', 'custom_label_no' => '1,234.56'),
52
- 'enable_sov' => array('description' => __('Enable SOV','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('In linguistic typology, a subject-object-verb (SOV) language is one in which the subject, object, and verb of a sentence appear in that order, like in Japanese.','wp-slimstat')),
53
- 'show_display_name' => array('description' => __('Show Display Name','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('By default, users are listed by their usernames. Use this option to visualize their display names instead.','wp-slimstat')),
54
- 'show_complete_user_agent_tooltip' => array('description' => __('Show User Agent','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Choose if you want to see the browser name or a complete user agent string when hovering on browser icons.','wp-slimstat')),
55
- 'convert_resource_urls_to_titles' => array('description' => __('Show Titles','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Slimstat converts your permalinks into post and page titles. Disable this feature if you need to see the URL in your reports.','wp-slimstat')),
56
  'date_format' => array('description' => __('Date Format','wp-slimstat'), 'type' => 'text', 'long_description' => __("<a href='http://php.net/manual/en/function.date.php' target='_blank'>PHP Format</a> to use when displaying a pageview's date.",'wp-slimstat')),
57
  'time_format' => array('description' => __('Time Format','wp-slimstat'), 'type' => 'text', 'long_description' => __("<a href='http://php.net/manual/en/function.date.php' target='_blank'>PHP Format</a> to use when displaying a pageview's time.",'wp-slimstat')),
 
 
 
58
 
59
- 'views_functionality_header' => array('description' => __('Functionality','wp-slimstat'), 'type' => 'section_header'),
60
  'async_load' => array('description' => __('Asynchronous Views','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Load all the reports dynamically. It makes the reports render faster, but it increases the load on your server.','wp-slimstat')),
61
  'use_slimscroll' => array('description' => __('SlimScroll','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable SlimScroll, a slick jQuery library that replaces the built-in browser scrollbar.','wp-slimstat')),
62
  'expand_details' => array('description' => __('Expand Details','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Expand each row's details by default, insted of on mousehover.",'wp-slimstat')),
63
  'rows_to_show' => array('description' => __('Rows to Display','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Specify the number of items in each report.','wp-slimstat')),
64
 
65
- 'views_right_now_header' => array('description' => __('Activity Log','wp-slimstat'), 'type' => 'section_header'),
66
  'refresh_interval' => array('description' => __('Live Stream','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Enable the Live view, which refreshes the Activity Log every X seconds. Enter <strong>0</strong> (number zero) to deactivate this feature.','wp-slimstat'), 'after_input_field' => __('seconds','wp-slimstat')),
67
  'number_results_raw_data' => array('description' => __('Rows to Display','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Specify the number of items in the Activity Log.','wp-slimstat')),
68
- 'include_outbound_links_right_now' => array('description' => __('Activity Log Extended','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Choose if you want to see outbound links listed in the Activity Log. It might slow down the rendering of this report.','wp-slimstat'))
 
 
 
 
69
  );
70
  break;
71
  case __('Filters','wp-slimstat'):
6
  // Define the tabs
7
  $slimtabs = '';
8
  $current_tab = empty($_GET['tab'])?1:intval($_GET['tab']);
9
+ $config_tabs = apply_filters('slimstat_config_tabs', array(__('General','wp-slimstat'),__('Reports','wp-slimstat'),__('Filters','wp-slimstat'),__('Permissions','wp-slimstat'),__('Advanced','wp-slimstat'),has_filter('slimstat_options_on_page')?__('Add-ons','wp-slimstat'):'none',__('Maintenance','wp-slimstat')));
10
  foreach ($config_tabs as $a_tab_id => $a_tab_name){
11
  if ($a_tab_name != 'none') $slimtabs .= "<li class='nav-tab nav-tab".(($current_tab == $a_tab_id+1)?'-active':'-inactive')."'><a href='".wp_slimstat_admin::$config_url.($a_tab_id+1)."'>$a_tab_name</a></li>";
12
  }
44
  }
45
  }
46
  break;
47
+ case __('Reports','wp-slimstat'):
48
  $options_on_this_page = array(
49
+ 'reports_basic_header' => array('description' => __('Formats and Conversions','wp-slimstat'), 'type' => 'section_header'),
 
50
  'use_european_separators' => array('description' => __('Number Format','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Choose the number format you want to use for your reports.','wp-slimstat'), 'custom_label_yes' => '1.234,56', 'custom_label_no' => '1,234.56'),
 
 
 
 
51
  'date_format' => array('description' => __('Date Format','wp-slimstat'), 'type' => 'text', 'long_description' => __("<a href='http://php.net/manual/en/function.date.php' target='_blank'>PHP Format</a> to use when displaying a pageview's date.",'wp-slimstat')),
52
  'time_format' => array('description' => __('Time Format','wp-slimstat'), 'type' => 'text', 'long_description' => __("<a href='http://php.net/manual/en/function.date.php' target='_blank'>PHP Format</a> to use when displaying a pageview's time.",'wp-slimstat')),
53
+ 'show_display_name' => array('description' => __('Use Display Name','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('By default, users are listed by their usernames. Use this option to visualize their display names instead.','wp-slimstat')),
54
+ 'convert_resource_urls_to_titles' => array('description' => __('Use Post Titles','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Slimstat converts your permalinks into post and page titles. Disable this feature if you need to see the URL in your reports.','wp-slimstat')),
55
+ 'convert_ip_addresses' => array('description' => __('Convert IP Addresses','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Display provider names instead of IP addresses.','wp-slimstat')),
56
 
57
+ 'reports_functionality_header' => array('description' => __('Functionality','wp-slimstat'), 'type' => 'section_header'),
58
  'async_load' => array('description' => __('Asynchronous Views','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Load all the reports dynamically. It makes the reports render faster, but it increases the load on your server.','wp-slimstat')),
59
  'use_slimscroll' => array('description' => __('SlimScroll','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable SlimScroll, a slick jQuery library that replaces the built-in browser scrollbar.','wp-slimstat')),
60
  'expand_details' => array('description' => __('Expand Details','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Expand each row's details by default, insted of on mousehover.",'wp-slimstat')),
61
  'rows_to_show' => array('description' => __('Rows to Display','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Specify the number of items in each report.','wp-slimstat')),
62
 
63
+ 'reports_right_now_header' => array('description' => __('Activity Log','wp-slimstat'), 'type' => 'section_header'),
64
  'refresh_interval' => array('description' => __('Live Stream','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Enable the Live view, which refreshes the Activity Log every X seconds. Enter <strong>0</strong> (number zero) to deactivate this feature.','wp-slimstat'), 'after_input_field' => __('seconds','wp-slimstat')),
65
  'number_results_raw_data' => array('description' => __('Rows to Display','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Specify the number of items in the Activity Log.','wp-slimstat')),
66
+ // 'include_outbound_links_right_now' => array('description' => __('Activity Log Extended','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Choose if you want to see outbound links listed in the Activity Log. It might slow down the rendering of this report.','wp-slimstat')),
67
+
68
+ 'reports_miscellaneous_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
69
+ 'show_complete_user_agent_tooltip' => array('description' => __('Show User Agent','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Choose if you want to see the browser name or a complete user agent string when hovering on browser icons.','wp-slimstat')),
70
+ 'enable_sov' => array('description' => __('Enable SOV','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('In linguistic typology, a subject-object-verb (SOV) language is one in which the subject, object, and verb of a sentence appear in that order, like in Japanese.','wp-slimstat'))
71
  );
72
  break;
73
  case __('Filters','wp-slimstat'):
admin/config/maintenance.php CHANGED
@@ -9,18 +9,22 @@ wp_slimstat_reports::init();
9
 
10
  if (!empty($_REQUEST['action'])){
11
  switch ($_REQUEST['action']){
12
- case 'switch-engine':
13
- $have_innodb = wp_slimstat::$wpdb->get_results("SHOW VARIABLES LIKE 'have_innodb'", ARRAY_A);
14
- if ($have_innodb[0]['Value'] != 'YES') return;
15
-
16
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ENGINE = InnoDB");
17
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_outbound ENGINE = InnoDB");
18
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_browsers ENGINE = InnoDB");
19
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_screenres ENGINE = InnoDB");
20
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_content_info ENGINE = InnoDB");
21
-
22
- wp_slimstat_admin::show_alert_message(__('Your Slimstat tables have been successfully converted to InnoDB.','wp-slimstat'), 'updated below-h2');
 
 
 
23
  break;
 
24
  case 'delete-records':
25
  $rows_affected = 0;
26
  if (key_exists($_POST['f'], wp_slimstat_reports::$dropdown_filter_names)){
@@ -29,20 +33,35 @@ if (!empty($_REQUEST['action'])){
29
  FROM '.wp_slimstat_db::$sql_filters['from']['all'].'
30
  WHERE 1=1 '.wp_slimstat_db::$sql_filters['where']['all']);
31
  }
32
- wp_slimstat_admin::show_alert_message(intval($rows_affected).' '.__('records deleted from your database.','wp-slimstat'), 'updated below-h2');
33
  break;
34
- case 'truncate-table':
35
- wp_slimstat::$wpdb->query("DELETE tob FROM {$GLOBALS['wpdb']->prefix}slim_outbound tob");
36
- wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_outbound");
37
- wp_slimstat::$wpdb->query("DELETE t1 FROM {$GLOBALS['wpdb']->prefix}slim_stats t1");
38
- wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_stats");
39
- wp_slimstat_admin::show_alert_message(__('All the records were successfully deleted.','wp-slimstat'), 'updated below-h2');
40
  break;
41
- case 'truncate-archive':
42
- wp_slimstat::$wpdb->query("DELETE tsa FROM {$GLOBALS['wpdb']->prefix}slim_stats_archive tsa");
43
- wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_stats_archive");
44
- wp_slimstat_admin::show_alert_message(__('All the archived records were successfully deleted.','wp-slimstat'), 'updated below-h2');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  break;
 
46
  case 'restore-archived-records':
47
  wp_slimstat::$wpdb->query("
48
  INSERT INTO {$GLOBALS['wpdb']->prefix}slim_stats (ip, other_ip, user, language, country, domain, referer, resource, searchterms, browser_id, screenres_id, content_info_id, plugins, notes, visit_id, server_latency, page_performance, dt)
@@ -50,36 +69,43 @@ if (!empty($_REQUEST['action'])){
50
  FROM {$GLOBALS['wpdb']->prefix}slim_stats_archive tsa");
51
  wp_slimstat::$wpdb->query("DELETE tsa FROM {$GLOBALS['wpdb']->prefix}slim_stats_archive tsa");
52
  wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_stats_archive");
53
- wp_slimstat_admin::show_alert_message(__('All the archived records were successfully restored.','wp-slimstat'), 'updated below-h2');
54
  break;
 
55
  case 'restore-views':
56
  $GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%slim%'");
57
- wp_slimstat_admin::show_alert_message(__('Your reports were successfully restored to their default arrangement.','wp-slimstat'), 'updated below-h2');
58
  break;
59
- case 'activate-indexes':
60
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX stats_resource_idx(resource(20))");
61
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX stats_browser_idx(browser_id)");
62
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_browsers ADD INDEX browser_all_idx(browser,version,platform,css_version,type)");
63
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_screenres ADD INDEX screenres_all_idx(resolution,colordepth,antialias)");
64
- wp_slimstat_admin::show_alert_message(__('Congrats! Slimstat is now optimized for <a href="http://www.youtube.com/watch?v=ygE01sOhzz0" target="_blank">ludicrous speed</a>.','wp-slimstat'), 'updated below-h2');
 
 
 
 
 
 
65
  break;
66
- case 'deactivate-indexes':
67
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX stats_resource_idx");
68
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX stats_browser_idx");
69
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_browsers DROP INDEX browser_all_idx");
70
- wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_screenres DROP INDEX screenres_all_idx");
71
- wp_slimstat_admin::show_alert_message(__('Indexing has been successfully disabled. Enjoy the extra database space!','wp-slimstat'), 'updated below-h2');
72
  break;
73
- case 'import-settings':
74
- $new_options = @unserialize(stripslashes($_POST['import-slimstat-settings']));
75
- $new_options = array_intersect_key($new_options, wp_slimstat::$options);
76
- if (!empty($new_options)){
77
- foreach ($new_options as $a_option_name => $a_option_value){
78
- wp_slimstat::$options[$a_option_name] = $a_option_value;
79
- }
80
- }
81
  break;
 
82
  default:
 
83
  }
84
  }
85
 
@@ -99,6 +125,24 @@ $suffixes = array('bytes', 'KB', 'MB', 'GB', 'TB');
99
 
100
  <table class="form-table widefat">
101
  <tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  <tr>
103
  <td colspan="2" class="slimstat-options-section-header"><?php _e('Database Information','wp-slimstat') ?></td>
104
  </tr>
9
 
10
  if (!empty($_REQUEST['action'])){
11
  switch ($_REQUEST['action']){
12
+ case 'activate-indexes':
13
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX stats_resource_idx(resource(20))");
14
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX stats_browser_idx(browser_id)");
15
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_browsers ADD INDEX browser_all_idx(browser,version,platform,css_version,type)");
16
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_screenres ADD INDEX screenres_all_idx(resolution,colordepth,antialias)");
17
+ wp_slimstat_admin::show_alert_message(__('Congrats! Slimstat is now optimized for <a href="http://www.youtube.com/watch?v=ygE01sOhzz0" target="_blank">ludicrous speed</a>.','wp-slimstat'), 'wp-ui-highlight below-h2');
18
+ break;
19
+
20
+ case 'deactivate-indexes':
21
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX stats_resource_idx");
22
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX stats_browser_idx");
23
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_browsers DROP INDEX browser_all_idx");
24
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_screenres DROP INDEX screenres_all_idx");
25
+ wp_slimstat_admin::show_alert_message(__('Indexing has been disabled. Enjoy the extra database space!','wp-slimstat'), 'wp-ui-highlight below-h2');
26
  break;
27
+
28
  case 'delete-records':
29
  $rows_affected = 0;
30
  if (key_exists($_POST['f'], wp_slimstat_reports::$dropdown_filter_names)){
33
  FROM '.wp_slimstat_db::$sql_filters['from']['all'].'
34
  WHERE 1=1 '.wp_slimstat_db::$sql_filters['where']['all']);
35
  }
36
+ wp_slimstat_admin::show_alert_message(intval($rows_affected).' '.__('records deleted from your database.','wp-slimstat'), 'wp-ui-highlight below-h2');
37
  break;
38
+
39
+ case 'delete-maxmind':
40
+ @unlink(wp_slimstat::$maxmind_path);
41
+ wp_slimstat_admin::show_alert_message(__('The geolocation database has been uninstalled from your server.','wp-slimstat'), 'wp-ui-highlight below-h2');
 
 
42
  break;
43
+
44
+ case 'download-maxmind':
45
+ $error = wp_slimstat::download_maxmind_database();
46
+
47
+ if (!empty($error)){
48
+ wp_slimstat_admin::show_alert_message($error, 'wp-ui-notification below-h2');
49
+ }
50
+ else {
51
+ wp_slimstat_admin::show_alert_message(__('The geolocation database has been installed on your server.','wp-slimstat'), 'wp-ui-highlight below-h2');
52
+ }
53
+ break;
54
+
55
+ case 'import-settings':
56
+ $new_options = @unserialize(stripslashes($_POST['import-slimstat-settings']));
57
+ $new_options = array_intersect_key($new_options, wp_slimstat::$options);
58
+ if (!empty($new_options)){
59
+ foreach ($new_options as $a_option_name => $a_option_value){
60
+ wp_slimstat::$options[$a_option_name] = $a_option_value;
61
+ }
62
+ }
63
  break;
64
+
65
  case 'restore-archived-records':
66
  wp_slimstat::$wpdb->query("
67
  INSERT INTO {$GLOBALS['wpdb']->prefix}slim_stats (ip, other_ip, user, language, country, domain, referer, resource, searchterms, browser_id, screenres_id, content_info_id, plugins, notes, visit_id, server_latency, page_performance, dt)
69
  FROM {$GLOBALS['wpdb']->prefix}slim_stats_archive tsa");
70
  wp_slimstat::$wpdb->query("DELETE tsa FROM {$GLOBALS['wpdb']->prefix}slim_stats_archive tsa");
71
  wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_stats_archive");
72
+ wp_slimstat_admin::show_alert_message(__('All the archived records were successfully restored.','wp-slimstat'), 'wp-ui-highlight below-h2');
73
  break;
74
+
75
  case 'restore-views':
76
  $GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%slim%'");
77
+ wp_slimstat_admin::show_alert_message(__('Your reports were successfully restored to their default arrangement.','wp-slimstat'), 'wp-ui-highlight below-h2');
78
  break;
79
+
80
+ case 'switch-engine':
81
+ $have_innodb = wp_slimstat::$wpdb->get_results("SHOW VARIABLES LIKE 'have_innodb'", ARRAY_A);
82
+ if ($have_innodb[0]['Value'] != 'YES') return;
83
+
84
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ENGINE = InnoDB");
85
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_outbound ENGINE = InnoDB");
86
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_browsers ENGINE = InnoDB");
87
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_screenres ENGINE = InnoDB");
88
+ wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_content_info ENGINE = InnoDB");
89
+
90
+ wp_slimstat_admin::show_alert_message(__('Your Slimstat tables have been successfully converted to InnoDB.','wp-slimstat'), 'wp-ui-highlight below-h2');
91
  break;
92
+
93
+ case 'truncate-archive':
94
+ wp_slimstat::$wpdb->query("DELETE tsa FROM {$GLOBALS['wpdb']->prefix}slim_stats_archive tsa");
95
+ wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_stats_archive");
96
+ wp_slimstat_admin::show_alert_message(__('All the archived records were successfully deleted.','wp-slimstat'), 'wp-ui-highlight below-h2');
 
97
  break;
98
+
99
+ case 'truncate-table':
100
+ wp_slimstat::$wpdb->query("DELETE tob FROM {$GLOBALS['wpdb']->prefix}slim_outbound tob");
101
+ wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_outbound");
102
+ wp_slimstat::$wpdb->query("DELETE t1 FROM {$GLOBALS['wpdb']->prefix}slim_stats t1");
103
+ wp_slimstat::$wpdb->query("OPTIMIZE TABLE {$GLOBALS['wpdb']->prefix}slim_stats");
104
+ wp_slimstat_admin::show_alert_message(__('All the records were successfully deleted.','wp-slimstat'), 'wp-ui-highlight below-h2');
 
105
  break;
106
+
107
  default:
108
+ break;
109
  }
110
  }
111
 
125
 
126
  <table class="form-table widefat">
127
  <tbody>
128
+ <tr>
129
+ <td colspan="2" class="slimstat-options-section-header"><?php _e('MaxMind IP to Country','wp-slimstat') ?></td>
130
+ </tr>
131
+ <tr>
132
+ <th scope="row">
133
+ <?php if (!file_exists(wp_slimstat::$maxmind_path)): ?>
134
+ <a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=download-maxmind"
135
+ onclick="return(confirm('<?php _e('Do you want to download and install the geolocation database from MaxMind\'s server?','wp-slimstat'); ?>'))"><?php _e("Install GeoLite DB",'wp-slimstat'); ?></a>
136
+ <?php else: ?>
137
+ <a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=delete-maxmind"
138
+ onclick="return(confirm('<?php _e('Do you want to uninstall the geolocation database?','wp-slimstat'); ?>'))"><?php _e("Uninstall GeoLite DB",'wp-slimstat'); ?></a>
139
+ <?php endif; ?>
140
+ </th>
141
+ <td>
142
+ <span class="description"><?php _e("The <a href='http://dev.maxmind.com/geoip/legacy/geolite/' target='_blank'>MaxMind GeoLite library</a> used to geolocate visitors is released under the Creative Commons BY-SA 3.0 license, and cannot be directly bundled with the plugin because of license incompatibility issues. We are mandated to have the user take an affirmative action in order to enable this functionality.",'wp-slimstat') ?></span>
143
+ </td>
144
+
145
+ </tr>
146
  <tr>
147
  <td colspan="2" class="slimstat-options-section-header"><?php _e('Database Information','wp-slimstat') ?></td>
148
  </tr>
admin/css/slimstat.css CHANGED
@@ -6,6 +6,9 @@
6
  [id^=slim_] a.slimstat-delete-entry{
7
  color: #bbb;
8
  }
 
 
 
9
 
10
  /* Admin Notice */
11
  .slimstat-notice{
@@ -15,9 +18,6 @@
15
  float: left;
16
  width: 97%;
17
  }
18
- #slimstat-hide-admin-notice{
19
- float: right;
20
- }
21
  .slimstat-notice .fixed-height {
22
  height: 120px;
23
  margin-bottom: 20px;
@@ -174,15 +174,19 @@
174
 
175
  /* Single Report: Header and Header Buttons - Pagination */
176
  [id^=slim_] p.pagination{
177
- background-color: #c0c0c0;
178
- color: #fff;
 
 
 
 
179
  }
180
  [id^=slim_] p.pagination a{
181
- color: #fff;
182
  float: right;
183
  }
184
  [id^=slim_] p.pagination a:hover{
185
- text-shadow: 0 0 3px #000;
186
  }
187
 
188
  /* Single Report: Inside */
@@ -404,9 +408,11 @@
404
  margin-right: 10px;
405
  vertical-align: bottom;
406
  }
 
 
 
407
  #slimstat-message p{
408
- font-size: 16px;
409
- line-height: .8em;
410
  }
411
  #slimstat-message a{
412
  color: #fc0;
6
  [id^=slim_] a.slimstat-delete-entry{
7
  color: #bbb;
8
  }
9
+ .slimstat-float-right{
10
+ float: right;
11
+ }
12
 
13
  /* Admin Notice */
14
  .slimstat-notice{
18
  float: left;
19
  width: 97%;
20
  }
 
 
 
21
  .slimstat-notice .fixed-height {
22
  height: 120px;
23
  margin-bottom: 20px;
174
 
175
  /* Single Report: Header and Header Buttons - Pagination */
176
  [id^=slim_] p.pagination{
177
+ background-color: #e0e0e0;
178
+ border-bottom: 1px solid #cde;
179
+ border-top: 1px solid #cde;
180
+ color: #444;
181
+ line-height: 1em;
182
+ min-height: 5px;
183
  }
184
  [id^=slim_] p.pagination a{
185
+ color: #444;
186
  float: right;
187
  }
188
  [id^=slim_] p.pagination a:hover{
189
+ text-shadow: 0 0 2px #000;
190
  }
191
 
192
  /* Single Report: Inside */
408
  margin-right: 10px;
409
  vertical-align: bottom;
410
  }
411
+ #slimstat-message.wp-ui-notification p:before{
412
+ content: "\f160";
413
+ }
414
  #slimstat-message p{
415
+ line-height: 1em;
 
416
  }
417
  #slimstat-message a{
418
  color: #fc0;
admin/js/slimstat.admin.js CHANGED
@@ -390,7 +390,7 @@ jQuery(function(){
390
  // Hide Admin Notice
391
  jQuery(document).on('click', '#slimstat-hide-admin-notice', function(e){
392
  e.preventDefault();
393
- jQuery('.updated.slimstat-notice').slideUp(1000);
394
  data = {action: 'slimstat_hide_admin_notice', security: jQuery('#meta-box-order-nonce').val()};
395
  jQuery.ajax({
396
  url: ajaxurl,
@@ -399,6 +399,19 @@ jQuery(function(){
399
  data: data
400
  });
401
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
402
 
403
  // Enable ads on click
404
  jQuery(document).on('click', '#slimstat-enable-ads-toggle', function(e){
390
  // Hide Admin Notice
391
  jQuery(document).on('click', '#slimstat-hide-admin-notice', function(e){
392
  e.preventDefault();
393
+ jQuery(this).parents('.updated.slimstat-notice').slideUp(1000);
394
  data = {action: 'slimstat_hide_admin_notice', security: jQuery('#meta-box-order-nonce').val()};
395
  jQuery.ajax({
396
  url: ajaxurl,
399
  data: data
400
  });
401
  });
402
+
403
+ // Hide GeoLite Notice
404
+ jQuery(document).on('click', '#slimstat-hide-geolite-notice', function(e){
405
+ e.preventDefault();
406
+ jQuery(this).parents('.wp-ui-notification').slideUp(1000);
407
+ data = {action: 'slimstat_hide_geolite_notice', security: jQuery('#meta-box-order-nonce').val()};
408
+ jQuery.ajax({
409
+ url: ajaxurl,
410
+ type: 'post',
411
+ async: true,
412
+ data: data
413
+ });
414
+ });
415
 
416
  // Enable ads on click
417
  jQuery(document).on('click', '#slimstat-enable-ads-toggle', function(e){
admin/view/index.php CHANGED
@@ -126,8 +126,11 @@
126
  <input type="hidden" name="fs[<?php echo $a_key ?>]" class="slimstat-post-filter" value="equals <?php echo htmlspecialchars($a_value) ?>"/>
127
  <?php endif; endforeach; ?>
128
  </form>
129
-
130
  <?php
 
 
 
 
131
  $filters_html = wp_slimstat_reports::get_filters_html(wp_slimstat_db::$filters_normalized['columns']);
132
  if (!empty($filters_html)){
133
  echo "<div id='slimstat-current-filters'>$filters_html</div>";
126
  <input type="hidden" name="fs[<?php echo $a_key ?>]" class="slimstat-post-filter" value="equals <?php echo htmlspecialchars($a_value) ?>"/>
127
  <?php endif; endforeach; ?>
128
  </form>
 
129
  <?php
130
+ if (!file_exists(wp_slimstat::$maxmind_path) && wp_slimstat::$options['no_maxmind_warning'] != 'yes'){
131
+ wp_slimstat_admin::show_alert_message(sprintf(__("Install MaxMind's <a href='%s'>GeoLite DB</a> to determine your visitors' country of origin.",'wp-slimstat'), self::$config_url.'7').'<a id="slimstat-hide-geolite-notice" class="slimstat-font-cancel slimstat-float-right" title="Hide this notice" href="#"></a>', 'wp-ui-notification below-h2');
132
+ }
133
+
134
  $filters_html = wp_slimstat_reports::get_filters_html(wp_slimstat_db::$filters_normalized['columns']);
135
  if (!empty($filters_html)){
136
  echo "<div id='slimstat-current-filters'>$filters_html</div>";
admin/view/right-now.php CHANGED
@@ -12,9 +12,9 @@ $plugin_url = plugins_url('', dirname(__FILE__));
12
  // Set the filters
13
  $tables_to_join = 'tb.browser,tb.version,tb.platform,tb.css_version,tb.type,tb.user_agent,tci.content_type,tci.category,tci.author,tci.content_id';
14
  wp_slimstat_db::$filters_normalized['misc']['limit_results'] = wp_slimstat::$options['number_results_raw_data'];
15
- if (wp_slimstat::$options['include_outbound_links_right_now'] == 'yes'){
16
  $tables_to_join .= ',tob.outbound_domain,tob.outbound_resource';
17
- }
18
 
19
  // Report Header
20
  if (empty($_POST['report_id'])){
12
  // Set the filters
13
  $tables_to_join = 'tb.browser,tb.version,tb.platform,tb.css_version,tb.type,tb.user_agent,tci.content_type,tci.category,tci.author,tci.content_id';
14
  wp_slimstat_db::$filters_normalized['misc']['limit_results'] = wp_slimstat::$options['number_results_raw_data'];
15
+ //if (wp_slimstat::$options['include_outbound_links_right_now'] == 'yes'){
16
  $tables_to_join .= ',tob.outbound_domain,tob.outbound_resource';
17
+ //}
18
 
19
  // Report Header
20
  if (empty($_POST['report_id'])){
admin/view/wp-slimstat-reports.php CHANGED
@@ -54,7 +54,7 @@ class wp_slimstat_reports {
54
  'slim_p1_13' => __('Top Countries','wp-slimstat'),
55
  'slim_p1_15' => __('Rankings','wp-slimstat'),
56
  'slim_p1_17' => __('Top Language Families','wp-slimstat'),
57
- 'slim_p1_18' => __('Our Team Recommends','wp-slimstat'),
58
  'slim_p2_01' => __('Human Visits (chart)','wp-slimstat'),
59
  'slim_p2_02' => __('Audience Overview','wp-slimstat'),
60
  'slim_p2_03' => __('Top Languages','wp-slimstat'),
@@ -132,7 +132,7 @@ class wp_slimstat_reports {
132
  $all_existing_reports = array(
133
  0 => array(),
134
  1 => array('slim_p7_02'),
135
- 2 => array('slim_p1_01','slim_p1_18','slim_p1_02','slim_p1_03','slim_p1_04','slim_p1_11','slim_p1_12','slim_p1_05','slim_p1_08','slim_p1_10','slim_p1_13','slim_p1_15','slim_p1_17'),
136
  3 => array('slim_p2_01','slim_p2_02','slim_p2_03','slim_p2_04','slim_p2_06','slim_p2_05','slim_p2_07','slim_p2_09','slim_p2_10','slim_p2_12','slim_p2_13','slim_p2_14','slim_p2_15','slim_p2_16','slim_p2_17','slim_p2_18','slim_p2_19','slim_p2_20','slim_p2_21'),
137
  4 => array('slim_p4_01','slim_p4_22','slim_p1_06','slim_p4_07','slim_p4_02','slim_p4_03','slim_p4_05','slim_p4_04','slim_p4_06','slim_p4_08','slim_p4_12','slim_p4_13','slim_p4_14','slim_p4_15','slim_p4_16','slim_p4_17','slim_p4_18','slim_p4_11','slim_p4_10','slim_p4_19','slim_p4_20','slim_p4_21','slim_p4_23','slim_p4_24','slim_p4_25'),
138
  5 => array('slim_p3_01','slim_p3_02','slim_p3_03','slim_p3_04','slim_p3_06','slim_p3_05','slim_p3_08','slim_p3_10','slim_p3_09','slim_p3_11'),
@@ -154,11 +154,14 @@ class wp_slimstat_reports {
154
  self::$hidden_reports = get_user_option("metaboxhidden_{$page_location}", $user->ID);
155
  }
156
 
 
 
 
157
  // Default values
158
  if (self::$hidden_reports === false){
159
  switch(self::$current_tab){
160
  case 2:
161
- self::$hidden_reports = array('slim_p1_02', 'slim_p1_11', 'slim_p1_12', 'slim_p1_13','slim_p1_17');
162
  break;
163
  case 3:
164
  self::$hidden_reports = array('slim_p2_05', 'slim_p2_07', 'slim_p2_09', 'slim_p2_13', 'slim_p2_14', 'slim_p2_15', 'slim_p2_16', 'slim_p2_17', 'slim_p2_18', 'slim_p2_19', 'slim_p2_20', 'slim_p2_21');
@@ -405,10 +408,6 @@ class wp_slimstat_reports {
405
  return $wrapped_text;
406
  }
407
 
408
- public static function manage_wp(){
409
- echo '<a href="https://managewp.com/?utm_source=A&utm_medium=Banner&utm_content=mwp_banner_25_300x250&utm_campaign=A&utm_mrl=2844"><img src="https://managewp.com/banners/affiliate/mwp_banner_25_300x250.gif" style="width:100%;height:auto;"/></a>';
410
- }
411
-
412
  public static function show_results($_type = 'recent', $_id = 'p0', $_column = 'id', $_args = array()){
413
  // Initialize default values, if not specified
414
  $_args = array_merge(array('custom_where' => '', 'more_columns' => '', 'join_tables' => '', 'having_clause' => '', 'order_by' => '', 'total_for_percentage' => 0, 'as_column' => '', 'filter_op' => 'equals', 'use_date_filters' => true), $_args);
@@ -1221,7 +1220,7 @@ class wp_slimstat_reports {
1221
  self::show_results('popular', $_report_id, 'SUBSTRING(t1.language, 1, 2)', array('total_for_percentage' => $current_pageviews, 'as_column' => 'language', 'filter_op' => 'contains'));
1222
  break;
1223
  case 'slim_p1_18':
1224
- self::manage_wp();
1225
  break;
1226
  case 'slim_p2_02':
1227
  self::show_visitors_summary($_report_id, wp_slimstat_db::count_records('visit_id > 0 AND tb.type <> 1', 'id'), wp_slimstat_db::count_records('t1.visit_id > 0 AND tb.type <> 1', 'visit_id'));
54
  'slim_p1_13' => __('Top Countries','wp-slimstat'),
55
  'slim_p1_15' => __('Rankings','wp-slimstat'),
56
  'slim_p1_17' => __('Top Language Families','wp-slimstat'),
57
+ 'slim_p1_18' => __('Our Team Recommends','wp-slimstat'), // to be removed: managewp
58
  'slim_p2_01' => __('Human Visits (chart)','wp-slimstat'),
59
  'slim_p2_02' => __('Audience Overview','wp-slimstat'),
60
  'slim_p2_03' => __('Top Languages','wp-slimstat'),
132
  $all_existing_reports = array(
133
  0 => array(),
134
  1 => array('slim_p7_02'),
135
+ 2 => array('slim_p1_01','slim_p1_02','slim_p1_03','slim_p1_04','slim_p1_11','slim_p1_12','slim_p1_05','slim_p1_08','slim_p1_10','slim_p1_13','slim_p1_15','slim_p1_17'),
136
  3 => array('slim_p2_01','slim_p2_02','slim_p2_03','slim_p2_04','slim_p2_06','slim_p2_05','slim_p2_07','slim_p2_09','slim_p2_10','slim_p2_12','slim_p2_13','slim_p2_14','slim_p2_15','slim_p2_16','slim_p2_17','slim_p2_18','slim_p2_19','slim_p2_20','slim_p2_21'),
137
  4 => array('slim_p4_01','slim_p4_22','slim_p1_06','slim_p4_07','slim_p4_02','slim_p4_03','slim_p4_05','slim_p4_04','slim_p4_06','slim_p4_08','slim_p4_12','slim_p4_13','slim_p4_14','slim_p4_15','slim_p4_16','slim_p4_17','slim_p4_18','slim_p4_11','slim_p4_10','slim_p4_19','slim_p4_20','slim_p4_21','slim_p4_23','slim_p4_24','slim_p4_25'),
138
  5 => array('slim_p3_01','slim_p3_02','slim_p3_03','slim_p3_04','slim_p3_06','slim_p3_05','slim_p3_08','slim_p3_10','slim_p3_09','slim_p3_11'),
154
  self::$hidden_reports = get_user_option("metaboxhidden_{$page_location}", $user->ID);
155
  }
156
 
157
+ // Remove deprecated reports
158
+ self::$all_reports = array_diff(self::$all_reports, array('slim_p1_18'));
159
+
160
  // Default values
161
  if (self::$hidden_reports === false){
162
  switch(self::$current_tab){
163
  case 2:
164
+ self::$hidden_reports = array('slim_p1_02', 'slim_p1_11', 'slim_p1_12', 'slim_p1_13','slim_p1_17', 'slim_p1_18');
165
  break;
166
  case 3:
167
  self::$hidden_reports = array('slim_p2_05', 'slim_p2_07', 'slim_p2_09', 'slim_p2_13', 'slim_p2_14', 'slim_p2_15', 'slim_p2_16', 'slim_p2_17', 'slim_p2_18', 'slim_p2_19', 'slim_p2_20', 'slim_p2_21');
408
  return $wrapped_text;
409
  }
410
 
 
 
 
 
411
  public static function show_results($_type = 'recent', $_id = 'p0', $_column = 'id', $_args = array()){
412
  // Initialize default values, if not specified
413
  $_args = array_merge(array('custom_where' => '', 'more_columns' => '', 'join_tables' => '', 'having_clause' => '', 'order_by' => '', 'total_for_percentage' => 0, 'as_column' => '', 'filter_op' => 'equals', 'use_date_filters' => true), $_args);
1220
  self::show_results('popular', $_report_id, 'SUBSTRING(t1.language, 1, 2)', array('total_for_percentage' => $current_pageviews, 'as_column' => 'language', 'filter_op' => 'contains'));
1221
  break;
1222
  case 'slim_p1_18':
1223
+ // self::manage_wp();
1224
  break;
1225
  case 'slim_p2_02':
1226
  self::show_visitors_summary($_report_id, wp_slimstat_db::count_records('visit_id > 0 AND tb.type <> 1', 'id'), wp_slimstat_db::count_records('t1.visit_id > 0 AND tb.type <> 1', 'visit_id'));
admin/wp-slimstat-admin.php CHANGED
@@ -12,7 +12,7 @@ class wp_slimstat_admin{
12
  */
13
  public static function init(){
14
  if ((wp_slimstat::$options['enable_ads_network'] == 'yes' || wp_slimstat::$options['enable_ads_network'] == 'no')){
15
- self::$admin_notice = "The team who manages the WordPress Plugin Repository notified us that since the <a href='http://dev.maxmind.com/geoip/legacy/geolite/' target='_blank'>MaxMind GeoLite library</a> used by Slimstat to geolocate visitors is released under the Creative Commons BY-SA 3.0 license, it violates the repository guidelines, and cannot be bundled with the plugin any longer. We were required to remove the code and alter the plugin so that this functionality becomes optional. We apologize for the inconvenience. However, the only immediate consequence is that your visitors' country will not be identified; everything else will still work as usual. You can download the geolocation DB as a <a href='http://slimstat.getused.to.it/downloads/get-country/' target='_blank'>separate add-on</a> on our store, free of charge. Don't forget to enter your license key in the corresponding field under Slimstat > Add-ons, to receive free updates!";
16
 
17
  // 3.9.9 self::$admin_notice = "Happy birthday, Slimstat. Nine years ago version 0.8.7 was released to the public, starting the unbelievable journey that has taken us here today. We would like to thank all the 25,000 users who appreciate and support our work in many great ways. We wouldn't have more than 1.3 million downloads, 4.8 out of 5 overall rating, 16 add-ons, video tutorials, etc... if it weren't for you!";
18
  }
@@ -139,6 +139,7 @@ class wp_slimstat_admin{
139
  if (defined('DOING_AJAX') && DOING_AJAX){
140
  add_action('wp_ajax_slimstat_load_report', array('wp_slimstat_reports', 'show_report_wrapper'));
141
  add_action('wp_ajax_slimstat_hide_admin_notice', array(__CLASS__, 'hide_admin_notice'));
 
142
  add_action('wp_ajax_slimstat_manage_filters', array(__CLASS__, 'manage_filters'));
143
  add_action('wp_ajax_slimstat_delete_pageview', array(__CLASS__, 'delete_pageview'));
144
  add_action('wp_ajax_slimstat_enable_ads_feature', array(__CLASS__, 'enable_ads_feature'));
@@ -507,12 +508,10 @@ class wp_slimstat_admin{
507
  wp_slimstat::$options['capability_can_view'] = empty(wp_slimstat::$options['capability_can_view'])?'read':wp_slimstat::$options['capability_can_view'];
508
 
509
  // If this user is whitelisted, we use the minimum capability
 
510
  if (strpos(wp_slimstat::$options['can_view'], $GLOBALS['current_user']->user_login) === false){
511
  $minimum_capability = wp_slimstat::$options['capability_can_view'];
512
  }
513
- else{
514
- $minimum_capability = 'read';
515
- }
516
 
517
  $new_entry = array();
518
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
@@ -527,12 +526,10 @@ class wp_slimstat_admin{
527
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Add-ons','wp-slimstat'), __('Add-ons','wp-slimstat'), $minimum_capability, 'wp-slim-addons', array(__CLASS__, 'wp_slimstat_include_addons'));
528
  }
529
  else{
 
530
  if (!is_admin_bar_showing()){
531
  $new_entry[] = add_submenu_page('index.php', __('SlimStat','wp-slimstat'), __('SlimStat','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
532
  }
533
- else{
534
- $new_entry[] = add_submenu_page('admin.php', __('SlimStat','wp-slimstat'), __('SlimStat','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
535
- }
536
 
537
  // Let's tell WordPress that these page exist, without showing them
538
  $new_entry[] = add_submenu_page('admin.php', __('Overview','wp-slimstat'), __('Overview','wp-slimstat'), $minimum_capability, 'wp-slim-view-2', array(__CLASS__, 'wp_slimstat_include_view'));
@@ -562,19 +559,15 @@ class wp_slimstat_admin{
562
  wp_slimstat::$options['capability_can_admin'] = empty(wp_slimstat::$options['capability_can_admin'])?'activate_plugins':wp_slimstat::$options['capability_can_admin'];
563
 
564
  // If this user is whitelisted, we use the minimum capability
 
565
  if ((strpos(wp_slimstat::$options['can_admin'], $GLOBALS['current_user']->user_login) === false) && ($GLOBALS['current_user']->user_login != 'slimstatadmin')){
566
  $minimum_capability = wp_slimstat::$options['capability_can_admin'];
567
  }
568
- else{
569
- $minimum_capability = 'read';
570
- }
571
 
 
572
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
573
  $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'));
574
  }
575
- else{
576
- $new_entry = add_submenu_page(null, __('Settings','wp-slimstat'), __('Settings','wp-slimstat'), $minimum_capability, 'wp-slim-config', array(__CLASS__, 'wp_slimstat_include_config'));
577
- }
578
 
579
  // Load styles and Javascript needed to make the reports look nice and interactive
580
  add_action('load-'.$new_entry, array(__CLASS__, 'wp_slimstat_stylesheet'));
@@ -680,14 +673,14 @@ class wp_slimstat_admin{
680
  * Displays an alert message
681
  */
682
  public static function show_alert_message($_message = '', $_type = 'update'){
683
- echo "<div id='slimstat-message' class='wp-ui-highlight'><p>$_message</p></div>";
684
  }
685
 
686
  /**
687
  * Displays a message related to the current version of Slimstat
688
  */
689
  public static function show_admin_notice(){
690
- echo '<div class="updated slimstat-notice" style="padding:10px"><span>'.self::$admin_notice.'</span> <a id="slimstat-hide-admin-notice" class="slimstat-font-cancel" title="'.__('Hide this notice','wp-slimstat').'" href="#"></a></div>';
691
  }
692
 
693
  /**
@@ -698,6 +691,14 @@ class wp_slimstat_admin{
698
  die();
699
  }
700
 
 
 
 
 
 
 
 
 
701
  /**
702
  * Handles the Ajax requests to load, save or delete existing filters
703
  */
@@ -800,10 +801,10 @@ class wp_slimstat_admin{
800
  }
801
 
802
  if (!empty(self::$faulty_fields)){
803
- self::show_alert_message(__('There was an error updating the following options:','wp-slimstat').' '.implode(', ', self::$faulty_fields), 'updated below-h2');
804
  }
805
  else{
806
- self::show_alert_message(__('Your changes have been saved.','wp-slimstat'), 'updated below-h2');
807
  }
808
  }
809
 
12
  */
13
  public static function init(){
14
  if ((wp_slimstat::$options['enable_ads_network'] == 'yes' || wp_slimstat::$options['enable_ads_network'] == 'no')){
15
+ self::$admin_notice = "After further discussing with the repo moderators the incompatibility issue regarding the license under which MaxMind GeoLite is released, we were able to implement a much easier way to enable the geolocation functionality in Slimstat. There's no need to use our Get Country add-on anymore! If you are currently using it, feel free to <strong>uninstall it from your server</strong> to improve the tracker's performance. As usual, do not hesitate to contact our support team if you have any question.";
16
 
17
  // 3.9.9 self::$admin_notice = "Happy birthday, Slimstat. Nine years ago version 0.8.7 was released to the public, starting the unbelievable journey that has taken us here today. We would like to thank all the 25,000 users who appreciate and support our work in many great ways. We wouldn't have more than 1.3 million downloads, 4.8 out of 5 overall rating, 16 add-ons, video tutorials, etc... if it weren't for you!";
18
  }
139
  if (defined('DOING_AJAX') && DOING_AJAX){
140
  add_action('wp_ajax_slimstat_load_report', array('wp_slimstat_reports', 'show_report_wrapper'));
141
  add_action('wp_ajax_slimstat_hide_admin_notice', array(__CLASS__, 'hide_admin_notice'));
142
+ add_action('wp_ajax_slimstat_hide_geolite_notice', array(__CLASS__, 'hide_geolite_notice'));
143
  add_action('wp_ajax_slimstat_manage_filters', array(__CLASS__, 'manage_filters'));
144
  add_action('wp_ajax_slimstat_delete_pageview', array(__CLASS__, 'delete_pageview'));
145
  add_action('wp_ajax_slimstat_enable_ads_feature', array(__CLASS__, 'enable_ads_feature'));
508
  wp_slimstat::$options['capability_can_view'] = empty(wp_slimstat::$options['capability_can_view'])?'read':wp_slimstat::$options['capability_can_view'];
509
 
510
  // If this user is whitelisted, we use the minimum capability
511
+ $minimum_capability = 'read';
512
  if (strpos(wp_slimstat::$options['can_view'], $GLOBALS['current_user']->user_login) === false){
513
  $minimum_capability = wp_slimstat::$options['capability_can_view'];
514
  }
 
 
 
515
 
516
  $new_entry = array();
517
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
526
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Add-ons','wp-slimstat'), __('Add-ons','wp-slimstat'), $minimum_capability, 'wp-slim-addons', array(__CLASS__, 'wp_slimstat_include_addons'));
527
  }
528
  else{
529
+ $new_entry[] = add_submenu_page('admin.php', __('SlimStat','wp-slimstat'), __('SlimStat','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
530
  if (!is_admin_bar_showing()){
531
  $new_entry[] = add_submenu_page('index.php', __('SlimStat','wp-slimstat'), __('SlimStat','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
532
  }
 
 
 
533
 
534
  // Let's tell WordPress that these page exist, without showing them
535
  $new_entry[] = add_submenu_page('admin.php', __('Overview','wp-slimstat'), __('Overview','wp-slimstat'), $minimum_capability, 'wp-slim-view-2', array(__CLASS__, 'wp_slimstat_include_view'));
559
  wp_slimstat::$options['capability_can_admin'] = empty(wp_slimstat::$options['capability_can_admin'])?'activate_plugins':wp_slimstat::$options['capability_can_admin'];
560
 
561
  // If this user is whitelisted, we use the minimum capability
562
+ $minimum_capability = 'read';
563
  if ((strpos(wp_slimstat::$options['can_admin'], $GLOBALS['current_user']->user_login) === false) && ($GLOBALS['current_user']->user_login != 'slimstatadmin')){
564
  $minimum_capability = wp_slimstat::$options['capability_can_admin'];
565
  }
 
 
 
566
 
567
+ $new_entry = add_submenu_page(null, __('Settings','wp-slimstat'), __('Settings','wp-slimstat'), $minimum_capability, 'wp-slim-config', array(__CLASS__, 'wp_slimstat_include_config'));
568
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
569
  $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'));
570
  }
 
 
 
571
 
572
  // Load styles and Javascript needed to make the reports look nice and interactive
573
  add_action('load-'.$new_entry, array(__CLASS__, 'wp_slimstat_stylesheet'));
673
  * Displays an alert message
674
  */
675
  public static function show_alert_message($_message = '', $_type = 'update'){
676
+ echo "<div id='slimstat-message' class='$_type'><p>$_message</p></div>";
677
  }
678
 
679
  /**
680
  * Displays a message related to the current version of Slimstat
681
  */
682
  public static function show_admin_notice(){
683
+ echo '<div class="updated slimstat-notice" style="padding:10px"><span>'.self::$admin_notice.'</span> <a id="slimstat-hide-admin-notice" class="slimstat-font-cancel slimstat-float-right" title="'.__('Hide this notice','wp-slimstat').'" href="#"></a></div>';
684
  }
685
 
686
  /**
691
  die();
692
  }
693
 
694
+ /**
695
+ * Handles the Ajax request to hide the geolite notice
696
+ */
697
+ public static function hide_geolite_notice(){
698
+ wp_slimstat::$options['no_maxmind_warning'] = 'yes';
699
+ die();
700
+ }
701
+
702
  /**
703
  * Handles the Ajax requests to load, save or delete existing filters
704
  */
801
  }
802
 
803
  if (!empty(self::$faulty_fields)){
804
+ self::show_alert_message(__('There was an error updating the following options:','wp-slimstat').' '.implode(', ', self::$faulty_fields), 'wp-ui-highlight below-h2');
805
  }
806
  else{
807
+ self::show_alert_message(__('Your changes have been saved.','wp-slimstat'), 'wp-ui-highlight below-h2');
808
  }
809
  }
810
 
{databases → browscap}/browscap-1.php RENAMED
File without changes
{databases → browscap}/browscap-2.php RENAMED
File without changes
{databases → browscap}/browscap-3.php RENAMED
File without changes
{databases → browscap}/browscap-4.php RENAMED
File without changes
{databases → browscap}/browscap-5.php RENAMED
File without changes
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: 3.9.8
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
@@ -16,14 +16,6 @@ Stable tag: 3.9.8
16
  * Available in multiple languages: English, Chinese (沐熙工作室), Farsi ([Dean](http://www.mangallery.net)), French (Michael Bastin, Jean-Michel Venet, Yves Pouplard, Henrick Kac), German (TechnoViel), Italian, Japanese (h_a_l_f), Portuguese, Russian ([Vitaly](http://www.visbiz.org/)), Spanish ([WebHostingHub](http://www.webhostinghub.com/)), Swedish (Per Soderman). Is your language missing or incomplete? [Contact Us](http://support.getused.to.it/) if you would like to share your localization.
17
  * World Map that works on your mobile device, too (courtesy of [amMap](http://www.ammap.com/)).
18
 
19
- = Track countries by IP Address =
20
- Starting from Slimstat 3.9.8, we removed the functionality that allows the tracker to identify a visitor's country based on his IP address.
21
- The team who manages the WordPress Plugin Repository notified us that since the [MaxMind GeoLite library](http://dev.maxmind.com/geoip/legacy/geolite/)
22
- used by our plugin to geolocate visitors is released under the Creative Commons BY-SA 3.0 license, it violates the repository guidelines, and cannot
23
- be bundled with the code. We were required to remove it and alter the plugin so that this functionality becomes optional. By default, your visitors' country
24
- will be set to Unknown. You can download the geolocation DB as a [separate add-on](http://slimstat.getused.to.it/downloads/get-country/) on our website, free of charge,
25
- to restore this feature. Don't forget to enter your license key in the corresponding field under Slimstat > Add-ons, to receive free updates!
26
-
27
  = What are people saying about Slimstat? =
28
  * One of the 15+ Cool Free SEO Plugins for WordPress - [udesign](http://www.pixeldetail.com/wordpress/free-seo-plugins-for-wordpress/)
29
  * Thanks you for such an excellent plugin. I am using it to kick Jetpack out of all the wordpress installations that I manage for myself and others - [robertwagnervt](http://wordpress.org/support/topic/plugin-wp-slimstat-excellent-but-some-errors-on-activating)
@@ -48,12 +40,13 @@ Visit [our website](http://slimstat.getused.to.it/addons/) for a list of availab
48
 
49
  == Installation ==
50
 
51
- 0. **If you are upgrading from 2.8.4 or earlier, you MUST first install version 3.0 (deactivate/activate) and then upgrade to the latest release available**
52
  1. In your WordPress admin, go to Plugins > Add New
53
  2. Search for WP Slimstat
54
- 3. Click on **Install Now** under WP Slimstat
55
  4. Make sure your template calls `wp_footer()` or the equivalent hook somewhere (possibly just before the `</body>` tag)
56
- 5. If your `wp-admin` folder is not publicly accessible, make sure to check the [FAQs](http://wordpress.org/extend/plugins/wp-slimstat/faq/) to see if there's anything else you need to do
 
57
 
58
  Please note: if you decide to uninstall Slimstat, all the stats will be **PERMANENTLY** deleted from your database. Make sure to setup a database backup (wp_slim_*) to avoid losing your data.
59
 
@@ -71,6 +64,14 @@ Our knowledge base is available on our [support center](https://slimstat.freshde
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
74
  = 3.9.8 =
75
  * [Note] The team who manages the WordPress Plugin Repository notified us that since the [MaxMind GeoLite library](http://dev.maxmind.com/geoip/legacy/geolite/) used by Slimstat to geolocate visitors is released under the Creative Commons BY-SA 3.0 license, it violates the repository guidelines, and cannot be bundled with the plugin. We were required to remove the code and alter the plugin so that this functionality becomes optional. We apologize for the inconvenience. However, the only immediate consequence is that your visitors' country will not be identified; everything else will still work as usual. You can download the geolocation DB as a [separate add-on](http://slimstat.getused.to.it/downloads/get-country/) on our store, free of charge. Don't forget to enter your license key in the corresponding field under Slimstat > Add-ons, to receive free updates!
76
  * [New] A few new options under Slimstat > Settings > General tab > WordPress Integration section, allow you to have more control over the information displayed in the Posts admin screen (thank you, Brad).
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: 3.9.8.1
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
16
  * Available in multiple languages: English, Chinese (沐熙工作室), Farsi ([Dean](http://www.mangallery.net)), French (Michael Bastin, Jean-Michel Venet, Yves Pouplard, Henrick Kac), German (TechnoViel), Italian, Japanese (h_a_l_f), Portuguese, Russian ([Vitaly](http://www.visbiz.org/)), Spanish ([WebHostingHub](http://www.webhostinghub.com/)), Swedish (Per Soderman). Is your language missing or incomplete? [Contact Us](http://support.getused.to.it/) if you would like to share your localization.
17
  * World Map that works on your mobile device, too (courtesy of [amMap](http://www.ammap.com/)).
18
 
 
 
 
 
 
 
 
 
19
  = What are people saying about Slimstat? =
20
  * One of the 15+ Cool Free SEO Plugins for WordPress - [udesign](http://www.pixeldetail.com/wordpress/free-seo-plugins-for-wordpress/)
21
  * Thanks you for such an excellent plugin. I am using it to kick Jetpack out of all the wordpress installations that I manage for myself and others - [robertwagnervt](http://wordpress.org/support/topic/plugin-wp-slimstat-excellent-but-some-errors-on-activating)
40
 
41
  == Installation ==
42
 
43
+ 0. **If you are upgrading from 2.8.4 or earlier, you MUST first install [version 3.0](https://downloads.wordpress.org/plugin/wp-slimstat.3.0.zip) (deactivate/activate) and then upgrade to the latest release available**
44
  1. In your WordPress admin, go to Plugins > Add New
45
  2. Search for WP Slimstat
46
+ 3. Click on **Install Now** under WP Slimstat and then activate the plugin
47
  4. Make sure your template calls `wp_footer()` or the equivalent hook somewhere (possibly just before the `</body>` tag)
48
+ 5. Go to Slimstat > Settings > Maintenance tab > MaxMind IP to Country section and click on "Install GeoLite DB" to detect your visitors' countries based on their IP addresses
49
+ 6. If your `wp-admin` folder is not publicly accessible, make sure to check the [FAQs](http://wordpress.org/extend/plugins/wp-slimstat/faq/) to see if there's anything else you need to do
50
 
51
  Please note: if you decide to uninstall Slimstat, all the stats will be **PERMANENTLY** deleted from your database. Make sure to setup a database backup (wp_slim_*) to avoid losing your data.
52
 
64
 
65
  == Changelog ==
66
 
67
+ = 3.9.8.1 =
68
+ * [Note] After further discussing with the repo moderators the incompatibility issue regarding the license under which MaxMind GeoLite is released, we were able to implement a much easier way to enable the geolocation functionality in Slimstat. There's no need to download a separate plugin anymore! Just go to Slimstat > Settings > Maintenance tab, and click on Install GeoLite DB. Of course, you can always deactivate this feature by clicking on the corresponding button under the Maintenance tab.
69
+ * [Note] If you had downloaded and installed our Get Country add-on, you can now *uninstall* it from your server. We apologize for any inconvenience this might have caused.
70
+ * [New] A warning message is now displayed on the reports screens to remind you to install the GeoLite database. You can hide this message by enabling the corresponding option under Slimstat > Settings > Reports tab > Miscellaneous section.
71
+ * [Update] Some of the Settings screens have been cleaned up and reorganized
72
+ * [Update] Cleaned up the interface for better readability
73
+ * [Update] Removed banner from our partner ManageWP
74
+
75
  = 3.9.8 =
76
  * [Note] The team who manages the WordPress Plugin Repository notified us that since the [MaxMind GeoLite library](http://dev.maxmind.com/geoip/legacy/geolite/) used by Slimstat to geolocate visitors is released under the Creative Commons BY-SA 3.0 license, it violates the repository guidelines, and cannot be bundled with the plugin. We were required to remove the code and alter the plugin so that this functionality becomes optional. We apologize for the inconvenience. However, the only immediate consequence is that your visitors' country will not be identified; everything else will still work as usual. You can download the geolocation DB as a [separate add-on](http://slimstat.getused.to.it/downloads/get-country/) on our store, free of charge. Don't forget to enter your license key in the corresponding field under Slimstat > Add-ons, to receive free updates!
77
  * [New] A few new options under Slimstat > Settings > General tab > WordPress Integration section, allow you to have more control over the information displayed in the Posts admin screen (thank you, Brad).
wp-slimstat.php CHANGED
@@ -3,7 +3,7 @@
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: 3.9.8
7
  Author: Camu
8
  Author URI: http://slimstat.getused.to.it/
9
  */
@@ -11,10 +11,11 @@ Author URI: http://slimstat.getused.to.it/
11
  if (!empty(wp_slimstat::$options)) return true;
12
 
13
  class wp_slimstat{
14
- public static $version = '3.9.8';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
 
18
 
19
  protected static $data_js = array('id' => -1);
20
  protected static $stat = array();
@@ -50,7 +51,16 @@ class wp_slimstat{
50
  add_action('wp_slimstat_purge', array(__CLASS__, 'wp_slimstat_purge'));
51
 
52
  // Allow external domains on CORS requests
53
- add_filter( 'allowed_http_origins', array(__CLASS__, 'open_cors_admin_ajax' ) );
 
 
 
 
 
 
 
 
 
54
 
55
  // Enable the tracker (both server- and client-side)
56
  if (!is_admin() || self::$options['track_admin_pages'] == 'yes'){
@@ -493,16 +503,67 @@ class wp_slimstat{
493
  */
494
  public static function get_country($_ipnum = 0){
495
  $float_ipnum = (float)sprintf("%u", $_ipnum);
 
496
 
497
  // Is this a RFC1918 (local) IP?
498
  if ($float_ipnum == 2130706433 || // 127.0.0.1
499
  ($float_ipnum >= 167772160 && $float_ipnum <= 184549375) || // 10.0.0.1 - 10.255.255.255
500
  ($float_ipnum >= 2886729728 && $float_ipnum <= 2887778303) || // 172.16.0.1 - 172.31.255.255
501
  ($float_ipnum >= 3232235521 && $float_ipnum <= 3232301055) ){ // 192.168.0.1 - 192.168.255.255
502
- return 'xy';
503
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
504
 
505
- return apply_filters('slimstat_get_country', 'xx', $_ipnum);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  }
507
  // end get_country
508
 
@@ -707,7 +768,7 @@ class wp_slimstat{
707
  }
708
 
709
  for($idx_cache = 1; $idx_cache <= 5; $idx_cache++){
710
- @include(plugin_dir_path( __FILE__ )."databases/browscap-$idx_cache.php");
711
 
712
  foreach ($patterns as $pattern => $pattern_data){
713
  if (preg_match($pattern . 'i', $_SERVER['HTTP_USER_AGENT'], $matches)){
@@ -1120,6 +1181,22 @@ class wp_slimstat{
1120
  return $_allowed_origins;
1121
  }
1122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1123
  /**
1124
  * Converts a series of comma separated values into an array
1125
  */
@@ -1158,21 +1235,22 @@ class wp_slimstat{
1158
  'auto_purge' => 0,
1159
 
1160
  // Views
1161
- 'convert_ip_addresses' => $val_no,
1162
  'use_european_separators' => $val_yes,
1163
- 'enable_sov' => $val_no,
1164
- 'show_display_name' => $val_no,
1165
- 'show_complete_user_agent_tooltip' => $val_no,
1166
- 'convert_resource_urls_to_titles' => $val_yes,
1167
  'date_format' => ($val_yes == 'null')?'':'m-d-y',
1168
  'time_format' => ($val_yes == 'null')?'':'h:i a',
 
 
 
1169
  'async_load' => $val_no,
1170
  'use_slimscroll' => $val_yes,
1171
  'expand_details' => $val_no,
1172
  'rows_to_show' => ($val_yes == 'null')?'0':'20',
1173
  'refresh_interval' => ($val_yes == 'null')?'0':'60',
1174
  'number_results_raw_data' => ($val_yes == 'null')?'0':'50',
1175
- 'include_outbound_links_right_now' => $val_yes,
 
 
 
1176
 
1177
  // Filters
1178
  'track_users' => $val_yes,
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: 3.9.8.1
7
  Author: Camu
8
  Author URI: http://slimstat.getused.to.it/
9
  */
11
  if (!empty(wp_slimstat::$options)) return true;
12
 
13
  class wp_slimstat{
14
+ public static $version = '3.9.8.1';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
18
+ public static $maxmind_path = '';
19
 
20
  protected static $data_js = array('id' => -1);
21
  protected static $stat = array();
51
  add_action('wp_slimstat_purge', array(__CLASS__, 'wp_slimstat_purge'));
52
 
53
  // Allow external domains on CORS requests
54
+ add_filter('allowed_http_origins', array(__CLASS__, 'open_cors_admin_ajax'));
55
+
56
+ // Define the folder where to store the geolocation database
57
+ self::$maxmind_path = wp_upload_dir();
58
+
59
+ // Create the folder, if it doesn't exist
60
+ if (!file_exists(self::$maxmind_path['basedir'].'/wp-slimstat/')){
61
+ mkdir(self::$maxmind_path['basedir'].'/wp-slimstat/');
62
+ }
63
+ self::$maxmind_path = self::$maxmind_path['basedir'].'/wp-slimstat/maxmind.dat.gz';
64
 
65
  // Enable the tracker (both server- and client-side)
66
  if (!is_admin() || self::$options['track_admin_pages'] == 'yes'){
503
  */
504
  public static function get_country($_ipnum = 0){
505
  $float_ipnum = (float)sprintf("%u", $_ipnum);
506
+ $country_output = 'xx';
507
 
508
  // Is this a RFC1918 (local) IP?
509
  if ($float_ipnum == 2130706433 || // 127.0.0.1
510
  ($float_ipnum >= 167772160 && $float_ipnum <= 184549375) || // 10.0.0.1 - 10.255.255.255
511
  ($float_ipnum >= 2886729728 && $float_ipnum <= 2887778303) || // 172.16.0.1 - 172.31.255.255
512
  ($float_ipnum >= 3232235521 && $float_ipnum <= 3232301055) ){ // 192.168.0.1 - 192.168.255.255
513
+ $country_output = 'xy';
514
  }
515
+ else {
516
+ $country_codes = array("","ap","eu","ad","ae","af","ag","ai","al","am","cw","ao","aq","ar","as","at","au","aw","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","sx","ga","gb","gd","ge","gf","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","in","io","iq","ir","is","it","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","st","sv","sy","sz","tc","td","tf","tg","th","tj","tk","tm","tn","to","tl","tr","tt","tv","tw","tz","ua","ug","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","ye","yt","rs","za","zm","me","zw","a1","a2","o1","ax","gg","im","je","bl","mf","bq","ss","o1");
517
+ if (file_exists(self::$maxmind_path) && ($handle = gzopen(self::$maxmind_path, "rb"))){
518
+
519
+ // Do we need to update the file?
520
+ if (false !== ($file_stat = stat(self::$maxmind_path))){
521
+
522
+ // Is the database more than 30 days old?
523
+ if ((date('U') - $file_stat['mtime'] > 2629740)){
524
+ fclose($handle);
525
+ @unlink(self::$maxmind_path);
526
+
527
+ self::download_maxmind_database();
528
 
529
+ if (false === ($handle = gzopen(self::$maxmind_path, "rb"))){
530
+ return apply_filters('slimstat_get_country', 'xx', $_ipnum);
531
+ }
532
+ }
533
+ }
534
+
535
+ $offset = 0;
536
+ for ($depth = 31; $depth >= 0; --$depth) {
537
+ if (fseek($handle, 6 * $offset, SEEK_SET) != 0){
538
+ break;
539
+ }
540
+ $buf = fread($handle, 6);
541
+ $x = array(0,0);
542
+ for ($i = 0; $i < 2; ++$i) {
543
+ for ($j = 0; $j < 3; ++$j) {
544
+ $x[$i] += ord(substr($buf, 3 * $i + $j, 1)) << ($j * 8);
545
+ }
546
+ }
547
+
548
+ if ($_ipnum & (1 << $depth)) {
549
+ if ($x[1] >= 16776960 && !empty($country_codes[$x[1] - 16776960])) {
550
+ $country_output = $country_codes[$x[1] - 16776960];
551
+ break;
552
+ }
553
+ $offset = $x[1];
554
+ } else {
555
+ if ($x[0] >= 16776960 && !empty($country_codes[$x[0] - 16776960])) {
556
+ $country_output = $country_codes[$x[0] - 16776960];
557
+ break;
558
+ }
559
+ $offset = $x[0];
560
+ }
561
+ }
562
+ fclose($handle);
563
+ }
564
+ }
565
+
566
+ return apply_filters('slimstat_get_country', $country_output, $_ipnum);
567
  }
568
  // end get_country
569
 
768
  }
769
 
770
  for($idx_cache = 1; $idx_cache <= 5; $idx_cache++){
771
+ @include(plugin_dir_path( __FILE__ )."browscap/browscap-$idx_cache.php");
772
 
773
  foreach ($patterns as $pattern => $pattern_data){
774
  if (preg_match($pattern . 'i', $_SERVER['HTTP_USER_AGENT'], $matches)){
1181
  return $_allowed_origins;
1182
  }
1183
 
1184
+ /**
1185
+ * Downloads the MaxMind geolocation database from their repository
1186
+ */
1187
+ public static function download_maxmind_database(){
1188
+ // Download the most recent database directly from MaxMind's repository
1189
+ $maxmind_tmp = download_url('http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz', 5);
1190
+
1191
+ if (is_wp_error($maxmind_tmp)){
1192
+ return __('There was an error downloading the MaxMind Geolite DB:','wp-slimstat').' '.$maxmind_tmp->get_error_message();
1193
+ }
1194
+
1195
+ copy($maxmind_tmp, self::$maxmind_path);
1196
+ @unlink($maxmind_tmp);
1197
+ return '';
1198
+ }
1199
+
1200
  /**
1201
  * Converts a series of comma separated values into an array
1202
  */
1235
  'auto_purge' => 0,
1236
 
1237
  // Views
 
1238
  'use_european_separators' => $val_yes,
 
 
 
 
1239
  'date_format' => ($val_yes == 'null')?'':'m-d-y',
1240
  'time_format' => ($val_yes == 'null')?'':'h:i a',
1241
+ 'show_display_name' => $val_no,
1242
+ 'convert_resource_urls_to_titles' => $val_yes,
1243
+ 'convert_ip_addresses' => $val_no,
1244
  'async_load' => $val_no,
1245
  'use_slimscroll' => $val_yes,
1246
  'expand_details' => $val_no,
1247
  'rows_to_show' => ($val_yes == 'null')?'0':'20',
1248
  'refresh_interval' => ($val_yes == 'null')?'0':'60',
1249
  'number_results_raw_data' => ($val_yes == 'null')?'0':'50',
1250
+ // 'include_outbound_links_right_now' => $val_yes,
1251
+ 'show_complete_user_agent_tooltip' => $val_no,
1252
+ 'no_maxmind_warning' => $val_no,
1253
+ 'enable_sov' => $val_no,
1254
 
1255
  // Filters
1256
  'track_users' => $val_yes,