Slimstat Analytics - Version 4.1.5

Version Description

  • [New] Welcome our new partner GetSocial.io, a service that allows you to find your true influencers and understand which users are driving your traffic and conversions through their shares. Our users get free access to their platform through a new report located in the Site Analysis screen.
  • [New] Slimstat can now differentiate between viewport size and screen size (or resolution). Two new reports, hidden by default, will enumerate the most popular of both categories.
  • [Update] We implemented a more flexible way to change the number of results returned by the database API (via filter). Documentation to follow soon.
  • [Update] Reports for Top and Recent Events are back. Go say hi, they will be waiting for you under Slimstat > Site Analysis. If you don't see them, you will need to activate them inside the Screen Options tab.
  • [Update] After the report and data API overhaul, it was now the config panels' turn. We revisited the way they are managed, and consolidated how third party add-ons can add their own parameters. All of our add-ons affected by this change have been updated on our repository.
  • [Update] Third party plugins and add-ons have now an easier way to increase the limit on the number of results returned by the data API.
  • [Update] To avoid confusion when a date filter is set, the Real-Time Log has been renamed Access Log.
  • [Update] Code optimizations in the report library/API: function get_raw_results is about to be deprecated. Please contact us if you're using it and would like to know how to proceed from now on.
  • [Fix] Setting the 'is empty' filter would cause a WordPress warning regarding wpdb->prepare.
  • [Fix] The setting to ignore visitors by username was not being saved as expected (thank you, Romain).
  • [Fix] Custom CSS styles were not being properly enqueued (thank you, Romain).
  • [Fix] Quotes in post titles were being escaped twice (better safe than sorry, right? thank you, Victor).
  • [Fix] Bug affecting the Export to Excel add-on.
Download this release

Release Info

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

Code changes from version 4.1.4.1 to 4.1.5

admin/config/index.php CHANGED
@@ -1,22 +1,148 @@
1
  <?php
2
 
3
  // Avoid direct access to this piece of code
4
- if (!function_exists('add_action')) exit(0);
5
-
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
  }
13
 
14
- echo '<div class="wrap slimstat"><h2>'.__('Settings','wp-slimstat').'</h2><ul class="nav-tabs">'.$slimtabs.'</ul>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- $options_on_this_page = array();
17
- switch ($config_tabs[$current_tab-1]){
18
- case __('General','wp-slimstat'):
19
- $options_on_this_page = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  'general_tracking_header' => array('description' => __('Tracker','wp-slimstat'), 'type' => 'section_header'),
21
  'is_tracking' => array( 'description' => __('Tracking','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Turn the tracker on or off, but keep the reports accessible.','wp-slimstat'), 'custom_label_yes' => __('On','wp-slimstat'), 'custom_label_no' => __('Off','wp-slimstat') ),
22
  'track_admin_pages' => array( 'description' => __('Admin Pages','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Enable this option to track your users' activity within the admin.",'wp-slimstat'), 'custom_label_yes' => __('Track','wp-slimstat'), 'custom_label_no' => __('Do not track','wp-slimstat') ),
@@ -34,20 +160,12 @@ switch ($config_tabs[$current_tab-1]){
34
  'general_database_header' => array('description' => __('Database','wp-slimstat'), 'type' => 'section_header'),
35
  'auto_purge' => array( 'description' => __('Retain data for','wp-slimstat'), 'type' => 'integer', 'long_description' => __("Clean-up log entries older than the number of days specified here above. Enter <strong>0</strong> (number zero) if you want to preserve your data regardless of its age.",'wp-slimstat').(wp_get_schedule('wp_slimstat_purge')?' '.__('Next clean-up on','wp-slimstat').' <strong>'.date_i18n(get_option('date_format').', '.get_option('time_format'), wp_next_scheduled('wp_slimstat_purge')).'</strong>. '.sprintf(__('Entries logged on or before %s will be archived or deleted according to the option here below.','wp-slimstat'), date_i18n(get_option('date_format'), strtotime('-'.wp_slimstat::$options['auto_purge'].' days'))):''), 'after_input_field' => __('days','wp-slimstat') ),
36
  'auto_purge_delete' => array( 'description' => __('Delete records','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('If DB space is not an issue, you can decide to archive older records in another table, instead of deleting them. This way performance is preserved, but you will still be able to access your data at a later time, if needed. Please note that the archive table (<code>wp_slim_stats_archive</code>) will be <strong>deleted</strong> along with all the other tables, when Slimstat is uninstalled. Make sure to backup your data before you proceed.','wp-slimstat') )
37
- );
38
-
39
- // If autopurge = 0, we can unschedule our cron job. If autopurge > 0 and the hook was not scheduled, we schedule it
40
- if (isset($_POST['options']['auto_purge'])){
41
- if ($_POST['options']['auto_purge'] == 0){
42
- wp_clear_scheduled_hook('wp_slimstat_purge');
43
- }
44
- else if (wp_next_scheduled( 'my_schedule_hook' ) == 0){
45
- wp_schedule_event(time(), 'daily', 'wp_slimstat_purge');
46
- }
47
- }
48
- break;
49
- case __('Reports','wp-slimstat'):
50
- $options_on_this_page = array(
51
  'reports_basic_header' => array('description' => __('Formats and Conversions','wp-slimstat'), 'type' => 'section_header'),
52
  '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'),
53
  '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')),
@@ -55,24 +173,26 @@ switch ($config_tabs[$current_tab-1]){
55
  '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')),
56
  'convert_resource_urls_to_titles' => array('description' => __('Use Titles','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Slimstat converts your permalinks into post, page and category titles. Disable this feature if you need to see the URL in your reports.', 'wp-slimstat')),
57
  'convert_ip_addresses' => array('description' => __('Convert IP Addresses','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Display provider names instead of IP addresses.','wp-slimstat')),
58
-
59
  'reports_functionality_header' => array('description' => __('Functionality','wp-slimstat'), 'type' => 'section_header'),
60
  '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')),
61
  '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')),
62
  'rows_to_show' => array('description' => __('Rows to Display','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Specify the number of items in each report.','wp-slimstat')),
63
-
64
  'reports_right_now_header' => array('description' => __('Activity Log','wp-slimstat'), 'type' => 'section_header'),
65
  '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')),
66
  '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')),
67
- // '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')),
68
-
69
  'reports_miscellaneous_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
70
  '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')),
71
- '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'))
72
- );
73
- break;
74
- case __('Filters','wp-slimstat'):
75
- $options_on_this_page = array(
 
 
 
76
  'filters_users_header' => array('description' => __('Visitors and Known Users','wp-slimstat'), 'type' => 'section_header'),
77
  'track_users' => array('description' => __('Track Registered Users','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable this option to track logged in users.','wp-slimstat')),
78
  'ignore_users' => array('description' => __('Blacklist by Username','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the usernames you don't want to track, separated by commas. Please be aware that spaces are <em>not</em> ignored and that usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true),
@@ -96,136 +216,28 @@ switch ($config_tabs[$current_tab-1]){
96
  'filters_miscellaneous_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
97
  'anonymize_ip' => array('description' => __('Enable Privacy Mode','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Mask your visitors' IP addresses to comply with European Privacy Laws.",'wp-slimstat')),
98
  'ignore_prefetch' => array('description' => __('Ignore Prefetch Requests','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Prevent Slimstat from tracking pageviews generated by Firefox's <a href='https://developer.mozilla.org/en/Link_prefetching_FAQ' target='_blank'>Link Prefetching functionality</a>.",'wp-slimstat'))
99
- );
100
-
101
- // Some options need a special treatment
102
- if (isset($_POST['options'])){
103
- if (!empty($_POST['options']['ignore_users'])){
104
- // Make sure all the users exist in the system
105
- $user_array = wp_slimstat::string_to_array($_POST['options']['ignore_users']);
106
- $post_data = trim($_POST['options']['ignore_users']);
107
-
108
- if (is_array($user_array) && !empty($post_data)){
109
- $sql_user_placeholders = implode(', ', array_fill(0, count($user_array), '%s COLLATE utf8_bin'));
110
- if ($GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->users} WHERE user_login IN ($sql_user_placeholders)", $user_array)) == count($user_array)){
111
- wp_slimstat::$options['ignore_users'] = $_POST['options']['ignore_users'];
112
- }
113
- else{
114
- wp_slimstat_admin::$faulty_fields[] = __('Ignore users (username not found)','wp-slimstat');
115
- }
116
- }
117
- }
118
- else{
119
- wp_slimstat::$options['ignore_users'] = '';
120
- }
121
-
122
- if (!empty($_POST['options']['ignore_capabilities'])){
123
- // Make sure all the capabilities exist in the system
124
- $capability_array = wp_slimstat::string_to_array($_POST['options']['ignore_capabilities']);
125
- $capability_not_found = false;
126
- foreach(wp_slimstat::string_to_array($_POST['options']['ignore_capabilities']) as $a_capability){
127
- if (isset($GLOBALS['wp_roles']->role_objects['administrator']->capabilities) && !array_key_exists($a_capability, $GLOBALS['wp_roles']->role_objects['administrator']->capabilities)){
128
- $capability_not_found = true;
129
- break;
130
- }
131
- }
132
-
133
- if (!$capability_not_found){
134
- wp_slimstat::$options['ignore_capabilities'] = $_POST['options']['ignore_capabilities'];
135
- }
136
- else{
137
- wp_slimstat_admin::$faulty_fields[] = __('Invalid capability. Please check <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_new">this page</a> for more information','wp-slimstat');
138
- }
139
- }
140
- else{
141
- wp_slimstat::$options['ignore_capabilities'] = '';
142
- }
143
- }
144
- break;
145
- case __('Permissions','wp-slimstat'):
146
- $options_on_this_page = array(
147
  'permissions_reports_header' => array('description' => __('Reports','wp-slimstat'), 'type' => 'section_header'),
148
  'restrict_authors_view' => array('description' => __('Restrict Authors','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable this option if you want your authors to only see stats related to their own content.','wp-slimstat')),
149
  'capability_can_view' => array('description' => __('Capability','wp-slimstat'), 'type' => 'text', 'long_description' => __("Specify the minimum <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_new'>capability</a> needed to access the reports (default: <code>activate_plugins</code>). If this field is empty, <strong>all your users</strong> (including subscribers) will have access to the reports, unless a 'Read access' whitelist has been specified here below. In this case, the list has precedence over the capability.",'wp-slimstat')),
150
  'can_view' => array('description' => __('Whitelist','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the users who should have access to the reports, separated by commas. Administrators are implicitly allowed, so you don't need to list them in here. Usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true),
151
-
152
  'permissions_config_header' => array('description' => __('Settings','wp-slimstat'), 'type' => 'section_header'),
153
  'capability_can_admin' => array('description' => __('Capability','wp-slimstat'), 'type' => 'text', 'long_description' => __("Specify the minimum <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_new'>capability</a> required to configure Slimstat (default: <code>activate_plugins</code>). The whitelist here below can be used to override this option for specific users.",'wp-slimstat')),
154
  'can_admin' => array('description' => __('Whitelist','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the users who can edit these options, separated by commas. Please be advised that admins <strong>are not</strong> implicitly allowed, so do not forget to include yourself! Usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true)
155
- );
156
-
157
- // Some options need a special treatment
158
- if (isset($_POST['options'])){
159
- if (!empty($_POST['options']['can_view'])){
160
- // Make sure all the users exist in the system
161
- $post_data = trim($_POST['options']['can_view']);
162
- $user_array = wp_slimstat::string_to_array($_POST['options']['can_view']);
163
-
164
- if (is_array($user_array) && !empty($post_data)){
165
- $sql_user_placeholders = implode(', ', array_fill(0, count($user_array), '%s COLLATE utf8_bin'));
166
- if ($GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->users} WHERE user_login IN ($sql_user_placeholders)", $user_array)) == count($user_array)){
167
- wp_slimstat::$options['can_view'] = $_POST['options']['can_view'];
168
- }
169
- else{
170
- wp_slimstat_admin::$faulty_fields[] = __('Read access: username not found','wp-slimstat');
171
- }
172
- }
173
- }
174
- else{
175
- wp_slimstat::$options['can_view'] = '';
176
- }
177
-
178
- if (!empty($_POST['options']['capability_can_view'])){
179
- if (isset($GLOBALS['wp_roles']->role_objects['administrator']->capabilities) && array_key_exists($_POST['options']['capability_can_view'], $GLOBALS['wp_roles']->role_objects['administrator']->capabilities)){
180
- wp_slimstat::$options['capability_can_view'] = $_POST['options']['capability_can_view'];
181
- }
182
- else{
183
- wp_slimstat_admin::$faulty_fields[] = __('Invalid minimum capability. Please check <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_new">this page</a> for more information','wp-slimstat');
184
- }
185
- }
186
- else{
187
- wp_slimstat::$options['capability_can_view'] = '';
188
- }
189
-
190
- if (!empty($_POST['options']['can_admin'])){
191
- // Make sure all the users exist in the system
192
- $post_data = trim($_POST['options']['can_admin']);
193
- $user_array = wp_slimstat::string_to_array($_POST['options']['can_admin']);
194
-
195
- if (is_array($user_array) && !empty($post_data)){
196
- $sql_user_placeholders = implode(', ', array_fill(0, count($user_array), '%s COLLATE utf8_bin'));
197
- if ($GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->users} WHERE user_login IN ($sql_user_placeholders)", $user_array)) == count($user_array)){
198
- wp_slimstat::$options['can_admin'] = $_POST['options']['can_admin'];
199
- }
200
- else{
201
- wp_slimstat_admin::$faulty_fields[] = __('Config access: username not found','wp-slimstat');
202
- }
203
- }
204
- }
205
- else{
206
- wp_slimstat::$options['can_admin'] = '';
207
- }
208
-
209
- if (!empty($_POST['options']['capability_can_admin'])){
210
- if (isset($GLOBALS['wp_roles']->role_objects['administrator']->capabilities) && array_key_exists($_POST['options']['capability_can_admin'], $GLOBALS['wp_roles']->role_objects['administrator']->capabilities)){
211
- wp_slimstat::$options['capability_can_admin'] = $_POST['options']['capability_can_admin'];
212
- }
213
- else{
214
- wp_slimstat_admin::$faulty_fields[] = __('Invalid minimum capability. Please check <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_new">this page</a> for more information','wp-slimstat');
215
- }
216
- }
217
- else{
218
- wp_slimstat::$options['capability_can_admin'] = '';
219
- }
220
- }
221
- break;
222
- case __('Advanced','wp-slimstat'):
223
- $encoded_ci = 'YTo0OntzOjEyOiJjb250ZW50X3R5cGUiO3M6ODoiZXh0ZXJuYWwiO3M6ODoiY2F0ZWdvcnkiO3M6MDoiIjtzOjEwOiJjb250ZW50X2lkIjtpOjA7czo2OiJhdXRob3IiO3M6MTM6ImV4dGVybmFsLXBhZ2UiO30=';
224
- $encoded_ci = $encoded_ci.'.'.md5($encoded_ci.wp_slimstat::$options['secret']);
225
 
226
- $options_on_this_page = array(
 
 
227
  'advanced_tracker_header' => array('description' => __('Tracker','wp-slimstat'), 'type' => 'section_header'),
228
- 'detect_smoothing' => array('description' => __('Detect Smoothing','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Detect if your visitors' browsers support anti-aliasing (font smoothing). This option required Spy Mode to be enabled.",'wp-slimstat')),
229
  'session_duration' => array('description' => __('Session Duration','wp-slimstat'), 'type' => 'integer', 'long_description' => __('How many seconds should a human session last? Google Analytics sets it to 1800 seconds.','wp-slimstat'), 'after_input_field' => __('seconds','wp-slimstat')),
230
  'extend_session' => array('description' => __('Extend Session','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Extend the duration of a session each time the user visits a new page.','wp-slimstat')),
231
  'enable_cdn' => array('description' => __('Enable CDN','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Use <a href='http://www.jsdelivr.com/' target='_blank'>JSDelivr</a>'s CDN, by serving our tracking code from their fast and reliable network (free service).",'wp-slimstat')),
@@ -233,36 +245,49 @@ switch ($config_tabs[$current_tab-1]){
233
 
234
  'advanced_external_pages_header' => array('description' => __('External Pages','wp-slimstat'), 'type' => 'section_header'),
235
  'external_pages_script' => array('type' => 'static', 'skip_update' => 'yes', 'description' => __('Add the following code to all the non-WP pages you want to track, right before the closing BODY tag','wp-slimstat'), 'long_description' => '&lt;script type="text/javascript"&gt;
236
- /* &lt;![CDATA[ */
237
- var SlimStatParams = {
238
- ajaxurl: "'.admin_url('admin-ajax.php').'",
239
- ci: "'.$encoded_ci.'",
240
- extensions_to_track: "'.wp_slimstat::$options['extensions_to_track'].'"
241
- };
242
- /* ]]&gt; */
243
- &lt;/script&gt;
244
- &lt;script type="text/javascript" src="http://cdn.jsdelivr.net/wp/wp-slimstat/trunk/wp-slimstat.js"&gt;&lt;/script&gt;'),
245
  'external_domains' => array('description' => __('Allow External Domains','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("If you are getting an error saying that no 'Access-Control-Allow-Origin' header is present on the requested resource, when using the external tracking code here above, list the domains (complete with scheme, separated by commas) you would like to allow. For example: <code>http://my.domain.ext</code> (no trailing slash). Please see <a href='http://www.w3.org/TR/cors/#security' target='_blank'>this W3 resource</a> for more information on the security implications of allowing CORS requests.",'wp-slimstat')),
246
  'advanced_misc_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
247
  'show_sql_debug' => array('description' => __('Debug Mode','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Display the SQL queries used to retrieve the data.','wp-slimstat')),
248
  'ip_lookup_service' => array('description' => __('IP Lookup','wp-slimstat'), 'type' => 'text', 'long_description' => __('Customize the Geolocation service to be used in the reports.','wp-slimstat')),
249
  'custom_css' => array('description' => __('Custom CSS','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("Paste here your custom stylesheet to personalize the way your reports look. <a href='https://slimstat.freshdesk.com/support/solutions/articles/5000528528-how-can-i-change-the-colors-associated-to-color-coded-pageviews-known-user-known-visitors-search-e' target='_blank'>Check the FAQ</a> for more information on how to use this setting.",'wp-slimstat')),
250
  'enable_ads_network' => array('description' => __('Enable UAN','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Send anonymous data about user agents to our server for analysis. This allows us to contribute to the <a href='http://browscap.org/' target='_blank'>BrowsCap opensource project</a>, and improve the accuracy of Slimstat's browser detection functionality. It also enables our transparent ads network. No worries, your site will not be affected in any way.",'wp-slimstat'))
251
- );
252
- break;
253
- case __('Maintenance','wp-slimstat'):
254
- include_once(dirname(__FILE__).'/maintenance.php');
255
- break;
256
- default:
257
- break;
258
- }
 
 
 
 
259
 
260
- if (has_filter('slimstat_options_on_page')){
261
- $options_on_this_page = apply_filters('slimstat_options_on_page', $options_on_this_page, $current_tab);
 
 
 
262
  }
263
 
264
- if (isset($options_on_this_page)){
265
- wp_slimstat_admin::update_options($options_on_this_page);
266
- wp_slimstat_admin::display_options($options_on_this_page, $current_tab);
 
 
 
 
 
 
267
  }
268
  echo '</div>';
1
  <?php
2
 
3
  // Avoid direct access to this piece of code
4
+ if ( !function_exists( 'add_action' ) ) {
5
+ exit(0);
 
 
 
 
 
 
6
  }
7
 
8
+ // Handle special options
9
+ if (isset($_POST['options']['auto_purge'])){
10
+ if ($_POST['options']['auto_purge'] == 0){
11
+ wp_clear_scheduled_hook('wp_slimstat_purge');
12
+ }
13
+ else if (wp_next_scheduled( 'my_schedule_hook' ) == 0){
14
+ wp_schedule_event(time(), 'daily', 'wp_slimstat_purge');
15
+ }
16
+ }
17
+
18
+ if ( !empty( $_POST[ 'options' ][ 'enable_getsocial' ] ) && $_POST[ 'options' ][ 'enable_getsocial' ] == 'yes' ) {
19
+ $all_posts = get_posts( array( 'posts_per_page' => 100 ) );
20
+ $all_post_urls = array();
21
+
22
+ if ( !empty( $all_posts ) ) {
23
+ foreach( $all_posts as $a_post ) {
24
+ $all_post_urls[] = parse_url( get_permalink( $a_post->ID ), PHP_URL_PATH );
25
+ }
26
+
27
+ $args = json_encode( array(
28
+ 'domain' => parse_url( get_site_url(), PHP_URL_HOST ),
29
+ 'items' => $all_post_urls
30
+ ) );
31
+ wp_remote_post( 'http://api.at.sharescount.com/process', array( 'timeout' => 5, 'body' => $args ) );
32
+ }
33
+ }
34
+
35
+ if (!empty($_POST['options']['ignore_users'])){
36
+ // Make sure all the users exist in the system
37
+ $user_array = wp_slimstat::string_to_array($_POST['options']['ignore_users']);
38
+ $post_data = trim($_POST['options']['ignore_users']);
39
+
40
+ if (is_array($user_array) && !empty($post_data)){
41
+ $sql_user_placeholders = implode(', ', array_fill(0, count($user_array), '%s COLLATE utf8_bin'));
42
+ if ($GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->users} WHERE user_login IN ($sql_user_placeholders)", $user_array)) == count($user_array)){
43
+ wp_slimstat::$options['ignore_users'] = $_POST['options']['ignore_users'];
44
+
45
+ }
46
+ else{
47
+ wp_slimstat_admin::$faulty_fields[] = __('Ignore users (username not found)','wp-slimstat');
48
+ }
49
+ }
50
+ }
51
+ else {
52
+ wp_slimstat::$options['ignore_users'] = '';
53
+ }
54
+
55
+ if (!empty($_POST['options']['ignore_capabilities'])){
56
+ // Make sure all the capabilities exist in the system
57
+ $capability_array = wp_slimstat::string_to_array($_POST['options']['ignore_capabilities']);
58
+ $capability_not_found = false;
59
+ foreach(wp_slimstat::string_to_array($_POST['options']['ignore_capabilities']) as $a_capability){
60
+ if (isset($GLOBALS['wp_roles']->role_objects['administrator']->capabilities) && !array_key_exists($a_capability, $GLOBALS['wp_roles']->role_objects['administrator']->capabilities)){
61
+ $capability_not_found = true;
62
+ break;
63
+ }
64
+ }
65
+
66
+ if (!$capability_not_found){
67
+ wp_slimstat::$options['ignore_capabilities'] = $_POST['options']['ignore_capabilities'];
68
+ }
69
+ else{
70
+ wp_slimstat_admin::$faulty_fields[] = __('Invalid capability. Please check <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_new">this page</a> for more information','wp-slimstat');
71
+ }
72
+ }
73
+ else {
74
+ wp_slimstat::$options['ignore_capabilities'] = '';
75
+ }
76
+
77
+ if (!empty($_POST['options']['can_view'])){
78
+ // Make sure all the users exist in the system
79
+ $post_data = trim($_POST['options']['can_view']);
80
+ $user_array = wp_slimstat::string_to_array($_POST['options']['can_view']);
81
+
82
+ if (is_array($user_array) && !empty($post_data)){
83
+ $sql_user_placeholders = implode(', ', array_fill(0, count($user_array), '%s COLLATE utf8_bin'));
84
+ if ($GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->users} WHERE user_login IN ($sql_user_placeholders)", $user_array)) == count($user_array)){
85
+ wp_slimstat::$options['can_view'] = $_POST['options']['can_view'];
86
+ }
87
+ else{
88
+ wp_slimstat_admin::$faulty_fields[] = __('Read access: username not found','wp-slimstat');
89
+ }
90
+ }
91
+ }
92
+ else {
93
+ wp_slimstat::$options['can_view'] = '';
94
+ }
95
+
96
+ if (!empty($_POST['options']['capability_can_view'])){
97
+ if (isset($GLOBALS['wp_roles']->role_objects['administrator']->capabilities) && array_key_exists($_POST['options']['capability_can_view'], $GLOBALS['wp_roles']->role_objects['administrator']->capabilities)){
98
+ wp_slimstat::$options['capability_can_view'] = $_POST['options']['capability_can_view'];
99
+ }
100
+ else{
101
+ wp_slimstat_admin::$faulty_fields[] = __('Invalid minimum capability. Please check <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_new">this page</a> for more information','wp-slimstat');
102
+ }
103
+ }
104
+ else {
105
+ wp_slimstat::$options['capability_can_view'] = '';
106
+ }
107
+
108
+ if (!empty($_POST['options']['can_admin'])){
109
+ // Make sure all the users exist in the system
110
+ $post_data = trim($_POST['options']['can_admin']);
111
+ $user_array = wp_slimstat::string_to_array($_POST['options']['can_admin']);
112
+
113
+ if (is_array($user_array) && !empty($post_data)){
114
+ $sql_user_placeholders = implode(', ', array_fill(0, count($user_array), '%s COLLATE utf8_bin'));
115
+ if ($GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->users} WHERE user_login IN ($sql_user_placeholders)", $user_array)) == count($user_array)){
116
+ wp_slimstat::$options['can_admin'] = $_POST['options']['can_admin'];
117
+ }
118
+ else{
119
+ wp_slimstat_admin::$faulty_fields[] = __('Config access: username not found','wp-slimstat');
120
+ }
121
+ }
122
+ }
123
+ else {
124
+ wp_slimstat::$options['can_admin'] = '';
125
+ }
126
 
127
+ if (!empty($_POST['options']['capability_can_admin'])){
128
+ if (isset($GLOBALS['wp_roles']->role_objects['administrator']->capabilities) && array_key_exists($_POST['options']['capability_can_admin'], $GLOBALS['wp_roles']->role_objects['administrator']->capabilities)){
129
+ wp_slimstat::$options['capability_can_admin'] = $_POST['options']['capability_can_admin'];
130
+ }
131
+ else{
132
+ wp_slimstat_admin::$faulty_fields[] = __('Invalid minimum capability. Please check <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_new">this page</a> for more information','wp-slimstat');
133
+ }
134
+ }
135
+ else {
136
+ wp_slimstat::$options['capability_can_admin'] = '';
137
+ }
138
+
139
+ $current_tab = empty( $_GET[ 'tab' ] ) ? 1 : intval( $_GET[ 'tab' ] );
140
+
141
+ // Define all the options
142
+ $options = array(
143
+ 1 => array(
144
+ 'title' => __( 'General', 'wp-slimstat' ),
145
+ 'rows' => array(
146
  'general_tracking_header' => array('description' => __('Tracker','wp-slimstat'), 'type' => 'section_header'),
147
  'is_tracking' => array( 'description' => __('Tracking','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Turn the tracker on or off, but keep the reports accessible.','wp-slimstat'), 'custom_label_yes' => __('On','wp-slimstat'), 'custom_label_no' => __('Off','wp-slimstat') ),
148
  'track_admin_pages' => array( 'description' => __('Admin Pages','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Enable this option to track your users' activity within the admin.",'wp-slimstat'), 'custom_label_yes' => __('Track','wp-slimstat'), 'custom_label_no' => __('Do not track','wp-slimstat') ),
160
  'general_database_header' => array('description' => __('Database','wp-slimstat'), 'type' => 'section_header'),
161
  'auto_purge' => array( 'description' => __('Retain data for','wp-slimstat'), 'type' => 'integer', 'long_description' => __("Clean-up log entries older than the number of days specified here above. Enter <strong>0</strong> (number zero) if you want to preserve your data regardless of its age.",'wp-slimstat').(wp_get_schedule('wp_slimstat_purge')?' '.__('Next clean-up on','wp-slimstat').' <strong>'.date_i18n(get_option('date_format').', '.get_option('time_format'), wp_next_scheduled('wp_slimstat_purge')).'</strong>. '.sprintf(__('Entries logged on or before %s will be archived or deleted according to the option here below.','wp-slimstat'), date_i18n(get_option('date_format'), strtotime('-'.wp_slimstat::$options['auto_purge'].' days'))):''), 'after_input_field' => __('days','wp-slimstat') ),
162
  'auto_purge_delete' => array( 'description' => __('Delete records','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('If DB space is not an issue, you can decide to archive older records in another table, instead of deleting them. This way performance is preserved, but you will still be able to access your data at a later time, if needed. Please note that the archive table (<code>wp_slim_stats_archive</code>) will be <strong>deleted</strong> along with all the other tables, when Slimstat is uninstalled. Make sure to backup your data before you proceed.','wp-slimstat') )
163
+ )
164
+ ),
165
+
166
+ 2 => array(
167
+ 'title' => __( 'Reports', 'wp-slimstat' ),
168
+ 'rows' => array(
 
 
 
 
 
 
 
 
169
  'reports_basic_header' => array('description' => __('Formats and Conversions','wp-slimstat'), 'type' => 'section_header'),
170
  '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'),
171
  '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')),
173
  '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')),
174
  'convert_resource_urls_to_titles' => array('description' => __('Use Titles','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Slimstat converts your permalinks into post, page and category titles. Disable this feature if you need to see the URL in your reports.', 'wp-slimstat')),
175
  'convert_ip_addresses' => array('description' => __('Convert IP Addresses','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Display provider names instead of IP addresses.','wp-slimstat')),
176
+
177
  'reports_functionality_header' => array('description' => __('Functionality','wp-slimstat'), 'type' => 'section_header'),
178
  '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')),
179
  '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')),
180
  'rows_to_show' => array('description' => __('Rows to Display','wp-slimstat'), 'type' => 'integer', 'long_description' => __('Specify the number of items in each report.','wp-slimstat')),
181
+
182
  'reports_right_now_header' => array('description' => __('Activity Log','wp-slimstat'), 'type' => 'section_header'),
183
  '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')),
184
  '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')),
185
+
 
186
  'reports_miscellaneous_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
187
  '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')),
188
+ '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')),
189
+ 'enable_getsocial' => array('description' => __( 'Social Analytics', 'wp-slimstat' ), 'type' => 'yesno', 'long_description' => __("Thanks to a <a href='http://getsocial.io/enterprise' target='_blank'>partnership with GetSocial.io</a>, you can access a powerful set of analytics for social media where you can identify top performing posts. Track social sharing to understand which of your posts are generating more engagement. When this option is enabled, Slimstat sends a list of all your posts's URLs to their service for analysis once daily.", 'wp-slimstat' ) )
190
+ )
191
+ ),
192
+
193
+ 3 => array(
194
+ 'title' => __( 'Filters', 'wp-slimstat' ),
195
+ 'rows' => array(
196
  'filters_users_header' => array('description' => __('Visitors and Known Users','wp-slimstat'), 'type' => 'section_header'),
197
  'track_users' => array('description' => __('Track Registered Users','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable this option to track logged in users.','wp-slimstat')),
198
  'ignore_users' => array('description' => __('Blacklist by Username','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the usernames you don't want to track, separated by commas. Please be aware that spaces are <em>not</em> ignored and that usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true),
216
  'filters_miscellaneous_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
217
  'anonymize_ip' => array('description' => __('Enable Privacy Mode','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Mask your visitors' IP addresses to comply with European Privacy Laws.",'wp-slimstat')),
218
  'ignore_prefetch' => array('description' => __('Ignore Prefetch Requests','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Prevent Slimstat from tracking pageviews generated by Firefox's <a href='https://developer.mozilla.org/en/Link_prefetching_FAQ' target='_blank'>Link Prefetching functionality</a>.",'wp-slimstat'))
219
+ )
220
+ ),
221
+
222
+ 4 => array(
223
+ 'title' => __( 'Permissions', 'wp-slimstat' ),
224
+ 'rows' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  'permissions_reports_header' => array('description' => __('Reports','wp-slimstat'), 'type' => 'section_header'),
226
  'restrict_authors_view' => array('description' => __('Restrict Authors','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable this option if you want your authors to only see stats related to their own content.','wp-slimstat')),
227
  'capability_can_view' => array('description' => __('Capability','wp-slimstat'), 'type' => 'text', 'long_description' => __("Specify the minimum <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_new'>capability</a> needed to access the reports (default: <code>activate_plugins</code>). If this field is empty, <strong>all your users</strong> (including subscribers) will have access to the reports, unless a 'Read access' whitelist has been specified here below. In this case, the list has precedence over the capability.",'wp-slimstat')),
228
  'can_view' => array('description' => __('Whitelist','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the users who should have access to the reports, separated by commas. Administrators are implicitly allowed, so you don't need to list them in here. Usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true),
229
+
230
  'permissions_config_header' => array('description' => __('Settings','wp-slimstat'), 'type' => 'section_header'),
231
  'capability_can_admin' => array('description' => __('Capability','wp-slimstat'), 'type' => 'text', 'long_description' => __("Specify the minimum <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_new'>capability</a> required to configure Slimstat (default: <code>activate_plugins</code>). The whitelist here below can be used to override this option for specific users.",'wp-slimstat')),
232
  'can_admin' => array('description' => __('Whitelist','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the users who can edit these options, separated by commas. Please be advised that admins <strong>are not</strong> implicitly allowed, so do not forget to include yourself! Usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true)
233
+ )
234
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
 
236
+ 5 => array(
237
+ 'title' => __( 'Advanced', 'wp-slimstat' ),
238
+ 'rows' => array(
239
  'advanced_tracker_header' => array('description' => __('Tracker','wp-slimstat'), 'type' => 'section_header'),
240
+ 'detect_smoothing' => array('description' => __('Detect Smoothing','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Detect if your visitors' browsers support anti-aliasing (font smoothing). This option requires Stealth Mode to be turned off.",'wp-slimstat')),
241
  'session_duration' => array('description' => __('Session Duration','wp-slimstat'), 'type' => 'integer', 'long_description' => __('How many seconds should a human session last? Google Analytics sets it to 1800 seconds.','wp-slimstat'), 'after_input_field' => __('seconds','wp-slimstat')),
242
  'extend_session' => array('description' => __('Extend Session','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Extend the duration of a session each time the user visits a new page.','wp-slimstat')),
243
  'enable_cdn' => array('description' => __('Enable CDN','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Use <a href='http://www.jsdelivr.com/' target='_blank'>JSDelivr</a>'s CDN, by serving our tracking code from their fast and reliable network (free service).",'wp-slimstat')),
245
 
246
  'advanced_external_pages_header' => array('description' => __('External Pages','wp-slimstat'), 'type' => 'section_header'),
247
  'external_pages_script' => array('type' => 'static', 'skip_update' => 'yes', 'description' => __('Add the following code to all the non-WP pages you want to track, right before the closing BODY tag','wp-slimstat'), 'long_description' => '&lt;script type="text/javascript"&gt;
248
+ /* &lt;![CDATA[ */
249
+ var SlimStatParams = {
250
+ ajaxurl: "'.admin_url('admin-ajax.php').'",
251
+ ci: "YTo0OntzOjEyOiJjb250ZW50X3R5cGUiO3M6ODoiZXh0ZXJuYWwiO3M6ODoiY2F0ZWdvcnkiO3M6MDoiIjtzOjEwOiJjb250ZW50X2lkIjtpOjA7czo2OiJhdXRob3IiO3M6MTM6ImV4dGVybmFsLXBhZ2UiO30=.' . md5('YTo0OntzOjEyOiJjb250ZW50X3R5cGUiO3M6ODoiZXh0ZXJuYWwiO3M6ODoiY2F0ZWdvcnkiO3M6MDoiIjtzOjEwOiJjb250ZW50X2lkIjtpOjA7czo2OiJhdXRob3IiO3M6MTM6ImV4dGVybmFsLXBhZ2UiO30=' . wp_slimstat::$options[ 'secret' ] ).'",
252
+ extensions_to_track: "'.wp_slimstat::$options['extensions_to_track'].'"
253
+ };
254
+ /* ]]&gt; */
255
+ &lt;/script&gt;
256
+ &lt;script type="text/javascript" src="http://cdn.jsdelivr.net/wp/wp-slimstat/trunk/wp-slimstat.js"&gt;&lt;/script&gt;'),
257
  'external_domains' => array('description' => __('Allow External Domains','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("If you are getting an error saying that no 'Access-Control-Allow-Origin' header is present on the requested resource, when using the external tracking code here above, list the domains (complete with scheme, separated by commas) you would like to allow. For example: <code>http://my.domain.ext</code> (no trailing slash). Please see <a href='http://www.w3.org/TR/cors/#security' target='_blank'>this W3 resource</a> for more information on the security implications of allowing CORS requests.",'wp-slimstat')),
258
  'advanced_misc_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
259
  'show_sql_debug' => array('description' => __('Debug Mode','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Display the SQL queries used to retrieve the data.','wp-slimstat')),
260
  'ip_lookup_service' => array('description' => __('IP Lookup','wp-slimstat'), 'type' => 'text', 'long_description' => __('Customize the Geolocation service to be used in the reports.','wp-slimstat')),
261
  'custom_css' => array('description' => __('Custom CSS','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("Paste here your custom stylesheet to personalize the way your reports look. <a href='https://slimstat.freshdesk.com/support/solutions/articles/5000528528-how-can-i-change-the-colors-associated-to-color-coded-pageviews-known-user-known-visitors-search-e' target='_blank'>Check the FAQ</a> for more information on how to use this setting.",'wp-slimstat')),
262
  'enable_ads_network' => array('description' => __('Enable UAN','wp-slimstat'), 'type' => 'yesno', 'long_description' => __("Send anonymous data about user agents to our server for analysis. This allows us to contribute to the <a href='http://browscap.org/' target='_blank'>BrowsCap opensource project</a>, and improve the accuracy of Slimstat's browser detection functionality. It also enables our transparent ads network. No worries, your site will not be affected in any way.",'wp-slimstat'))
263
+ )
264
+ ),
265
+
266
+ 6 => array(
267
+ 'title' => __( 'Maintenance', 'wp-slimstat' ),
268
+ 'include' => dirname(__FILE__).'/maintenance.php'
269
+ ),
270
+
271
+ 7 => array(
272
+ 'title' => __( 'Add-ons', 'wp-slimstat' )
273
+ )
274
+ );
275
 
276
+ $options = apply_filters( 'slimstat_options_on_page', $options );
277
+
278
+ $tabs_html = '';
279
+ foreach ( $options as $a_tab_id => $a_tab_info ) {
280
+ $tabs_html .= "<li class='nav-tab nav-tab".(($current_tab == $a_tab_id)?'-active':'-inactive')."'><a href='".wp_slimstat_admin::$config_url.$a_tab_id."'>{$a_tab_info[ 'title' ]}</a></li>";
281
  }
282
 
283
+ echo '<div class="wrap slimstat"><h2>'.__('Settings','wp-slimstat').'</h2><ul class="nav-tabs">'.$tabs_html.'</ul>';
284
+
285
+ // The maintenance tab has its own separate file
286
+ if ( !empty( $options[ $current_tab ][ 'include' ] ) ) {
287
+ include_once( $options[ $current_tab ][ 'include' ] );
288
+ }
289
+ else if ( !empty( $options[ $current_tab ][ 'rows' ] ) ) {
290
+ wp_slimstat_admin::update_options( $options[ $current_tab ][ 'rows' ] );
291
+ wp_slimstat_admin::display_options( $options[ $current_tab ][ 'rows' ], $current_tab);
292
  }
293
  echo '</div>';
admin/config/maintenance.php CHANGED
@@ -25,17 +25,18 @@ if (!empty($_REQUEST['action'])){
25
 
26
  case 'delete-records':
27
  $rows_affected = 0;
28
- if (key_exists($_POST['f'], wp_slimstat_db::$columns_names)){
 
29
  $rows_affected = wp_slimstat::$wpdb->query("
30
  DELETE t1.*
31
  FROM {$GLOBALS['wpdb']->prefix}slim_stats t1
32
- WHERE ".wp_slimstat_db::$sql_where[ 'columns' ]);
33
  }
34
  wp_slimstat_admin::show_alert_message(intval($rows_affected).' '.__('records deleted from your database.','wp-slimstat'), 'wp-ui-highlight below-h2');
35
  break;
36
 
37
  case 'delete-maxmind':
38
- @unlink(wp_slimstat::$maxmind_path);
39
  wp_slimstat_admin::show_alert_message(__('The geolocation database has been uninstalled from your server.','wp-slimstat'), 'wp-ui-highlight below-h2');
40
  break;
41
 
@@ -207,46 +208,24 @@ $suffixes = array('bytes', 'KB', 'MB', 'GB', 'TB');
207
  <table class="form-table widefat">
208
  <tbody>
209
  <tr>
210
- <td colspan="2" class="slimstat-options-section-header"><?php _e('MaxMind IP to Country','wp-slimstat') ?></td>
211
  </tr>
212
  <tr>
213
- <th scope="row">
214
- <?php if (!file_exists(wp_slimstat::$maxmind_path)): ?>
215
- <a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=download-maxmind"
216
- 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>
217
- <?php else: ?>
218
- <a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=delete-maxmind"
219
- onclick="return(confirm('<?php _e('Do you want to uninstall the geolocation database?','wp-slimstat'); ?>'))"><?php _e("Uninstall GeoLite DB",'wp-slimstat'); ?></a>
220
- <?php endif; ?>
221
- </th>
222
  <td>
223
- <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>
 
224
  </td>
225
-
226
  </tr>
227
  <tr>
228
- <td colspan="2" class="slimstat-options-section-header"><?php _e('Database Information','wp-slimstat') ?></td>
229
  </tr>
230
  <tr>
231
- <th scope="row"><?php _e('Engine','wp-slimstat') ?></th>
232
- <td><?php
233
- echo $details_wp_slim_tables[0]['Engine'];
234
- if (!empty($have_innodb) && $have_innodb[0]['Value'] == 'YES' && $details_wp_slim_tables[0]['Engine'] == 'MyISAM'){
235
- echo ' [<a href="'.wp_slimstat_admin::$config_url.$current_tab.'&amp;action=switch-engine">'.__('switch to InnoDB','wp-slimstat').'</a>]';
236
- }
237
- ?></td>
238
  </tr>
239
- <?php
240
- foreach ($details_wp_slim_tables as $i => $a_table){
241
- $base = ($a_table['Data_length'] != 0)?(log($a_table['Data_length']) / log(1024)):0;
242
- $a_table['Data_length_with_suffix'] = round(pow(1024, $base - floor($base)), 2).' '.$suffixes[floor($base)];
243
-
244
- echo '<tr '.(($i%2==0)?'class="alternate"':'').">
245
- <th scope='row'>{$a_table['Name']}</th>
246
- <td>".$a_table['Data_length_with_suffix'].' ('.number_format($a_table['Rows'], 0).' '.__('records','wp-slimstat').')</td>
247
- </tr>';
248
- }
249
- ?>
250
  <tr>
251
  <td colspan="2" class="slimstat-options-section-header"><?php _e('Data Maintenance','wp-slimstat') ?></td>
252
  </tr>
@@ -331,6 +310,24 @@ $suffixes = array('bytes', 'KB', 'MB', 'GB', 'TB');
331
  <span class="description"><?php _e("Import all the records from the old table structure. No data will be deleted from your database.",'wp-slimstat') ?></span>
332
  </td>
333
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  <tr>
335
  <td colspan="2" class="slimstat-options-section-header"><?php _e('Import and Export','wp-slimstat') ?></td>
336
  </tr>
@@ -347,26 +344,27 @@ $suffixes = array('bytes', 'KB', 'MB', 'GB', 'TB');
347
  </td>
348
  </tr>
349
  <tr>
350
- <td colspan="2" class="slimstat-options-section-header"><?php _e('Debugging','wp-slimstat') ?></td>
351
- </tr>
352
- <tr>
353
- <th scope="row"><?php _e('Tracker Error Code','wp-slimstat') ?></th>
354
- <td>
355
- <?php echo is_array(wp_slimstat::$options['last_tracker_error'])?'<code>'.wp_slimstat::$options['last_tracker_error'][0].' '.wp_slimstat::$options['last_tracker_error'][1].'</code> '.__('recorded on','wp-slimstat').' '.date_i18n(wp_slimstat::$options['date_format'], wp_slimstat::$options['last_tracker_error'][2], true).' @ '.date_i18n(wp_slimstat::$options['time_format'], wp_slimstat::$options['last_tracker_error'][2], true):__('No Errors so far','wp-slimstat'); ?>
356
- <span class="description"><?php _e('The information here above is useful to troubleshoot issues with the tracker. Please include this code when sending a support request.','wp-slimstat') ?></span>
357
- </td>
358
- </tr>
359
- <tr>
360
- <td colspan="2" class="slimstat-options-section-header"><?php _e('Miscellaneous','wp-slimstat') ?></td>
361
  </tr>
362
  <tr>
363
- <th scope="row"><?php _e('Reset Reports','wp-slimstat') ?></th>
364
- <td>
365
- <a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=restore-views"
366
- onclick="return(confirm('<?php _e('Are you sure you want to restore the default arrangement of your reports?','wp-slimstat'); ?>'))"><?php _e('No Panic Button','wp-slimstat'); ?></a>
367
- <span class="description"><?php _e("Reset the default arrangement of your reports. Helpful when, for some reason, reports disappear from your panels or something doesn't look right in your views.",'wp-slimstat') ?></span>
368
- </td>
 
369
  </tr>
370
-
 
 
 
 
 
 
 
 
 
 
371
  </tbody>
372
  </table>
25
 
26
  case 'delete-records':
27
  $rows_affected = 0;
28
+
29
+ if (key_exists($_REQUEST['f'], wp_slimstat_db::$columns_names)){
30
  $rows_affected = wp_slimstat::$wpdb->query("
31
  DELETE t1.*
32
  FROM {$GLOBALS['wpdb']->prefix}slim_stats t1
33
+ WHERE ".wp_slimstat_db::get_combined_where('', '*', false));
34
  }
35
  wp_slimstat_admin::show_alert_message(intval($rows_affected).' '.__('records deleted from your database.','wp-slimstat'), 'wp-ui-highlight below-h2');
36
  break;
37
 
38
  case 'delete-maxmind':
39
+ @unlink( wp_slimstat::$maxmind_path );
40
  wp_slimstat_admin::show_alert_message(__('The geolocation database has been uninstalled from your server.','wp-slimstat'), 'wp-ui-highlight below-h2');
41
  break;
42
 
208
  <table class="form-table widefat">
209
  <tbody>
210
  <tr>
211
+ <td colspan="2" class="slimstat-options-section-header"><?php _e('Debugging','wp-slimstat') ?></td>
212
  </tr>
213
  <tr>
214
+ <th scope="row"><?php _e('Tracker Error Code','wp-slimstat') ?></th>
 
 
 
 
 
 
 
 
215
  <td>
216
+ <?php echo is_array(wp_slimstat::$options['last_tracker_error'])?'<code>'.wp_slimstat::$options['last_tracker_error'][0].' '.wp_slimstat::$options['last_tracker_error'][1].'</code> '.__('recorded on','wp-slimstat').' '.date_i18n(wp_slimstat::$options['date_format'], wp_slimstat::$options['last_tracker_error'][2], true).' @ '.date_i18n(wp_slimstat::$options['time_format'], wp_slimstat::$options['last_tracker_error'][2], true):__('No Errors so far','wp-slimstat'); ?>
217
+ <span class="description"><?php _e('The information here above is useful to troubleshoot issues with the tracker. Please include this code when sending a support request.','wp-slimstat') ?></span>
218
  </td>
 
219
  </tr>
220
  <tr>
221
+ <td colspan="2" class="slimstat-options-section-header"><?php _e('Layout','wp-slimstat') ?></td>
222
  </tr>
223
  <tr>
224
+ <th scope="row"><a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=restore-views" onclick="return(confirm('<?php _e('Are you sure you want to restore the default arrangement of your reports?','wp-slimstat'); ?>'))"><?php _e('No Panic Button','wp-slimstat'); ?></a></th>
225
+ <td>
226
+ <span class="description"><?php _e("Reset the default arrangement of your reports. Helpful when, for some reason, reports disappear from your panels or something doesn't look right in your views.",'wp-slimstat') ?></span>
227
+ </td>
 
 
 
228
  </tr>
 
 
 
 
 
 
 
 
 
 
 
229
  <tr>
230
  <td colspan="2" class="slimstat-options-section-header"><?php _e('Data Maintenance','wp-slimstat') ?></td>
231
  </tr>
310
  <span class="description"><?php _e("Import all the records from the old table structure. No data will be deleted from your database.",'wp-slimstat') ?></span>
311
  </td>
312
  </tr>
313
+ <tr>
314
+ <td colspan="2" class="slimstat-options-section-header"><?php _e('MaxMind IP to Country','wp-slimstat') ?></td>
315
+ </tr>
316
+ <tr>
317
+ <th scope="row">
318
+ <?php if (!file_exists(wp_slimstat::$maxmind_path)): ?>
319
+ <a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=download-maxmind"
320
+ 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>
321
+ <?php else: ?>
322
+ <a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&amp;action=delete-maxmind"
323
+ onclick="return(confirm('<?php _e('Do you want to uninstall the geolocation database?','wp-slimstat'); ?>'))"><?php _e("Uninstall GeoLite DB",'wp-slimstat'); ?></a>
324
+ <?php endif; ?>
325
+ </th>
326
+ <td>
327
+ <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>
328
+ </td>
329
+
330
+ </tr>
331
  <tr>
332
  <td colspan="2" class="slimstat-options-section-header"><?php _e('Import and Export','wp-slimstat') ?></td>
333
  </tr>
344
  </td>
345
  </tr>
346
  <tr>
347
+ <td colspan="2" class="slimstat-options-section-header"><?php _e('Database Information','wp-slimstat') ?></td>
 
 
 
 
 
 
 
 
 
 
348
  </tr>
349
  <tr>
350
+ <th scope="row"><?php _e('Engine','wp-slimstat') ?></th>
351
+ <td><?php
352
+ echo $details_wp_slim_tables[0]['Engine'];
353
+ if (!empty($have_innodb) && $have_innodb[0]['Value'] == 'YES' && $details_wp_slim_tables[0]['Engine'] == 'MyISAM'){
354
+ echo ' [<a href="'.wp_slimstat_admin::$config_url.$current_tab.'&amp;action=switch-engine">'.__('switch to InnoDB','wp-slimstat').'</a>]';
355
+ }
356
+ ?></td>
357
  </tr>
358
+ <?php
359
+ foreach ($details_wp_slim_tables as $i => $a_table){
360
+ $base = ($a_table['Data_length'] != 0)?(log($a_table['Data_length']) / log(1024)):0;
361
+ $a_table['Data_length_with_suffix'] = round(pow(1024, $base - floor($base)), 2).' '.$suffixes[floor($base)];
362
+
363
+ echo '<tr '.(($i%2==0)?'class="alternate"':'').">
364
+ <th scope='row'>{$a_table['Name']}</th>
365
+ <td>".$a_table['Data_length_with_suffix'].' ('.number_format($a_table['Rows'], 0).' '.__('records','wp-slimstat').')</td>
366
+ </tr>';
367
+ }
368
+ ?>
369
  </tbody>
370
  </table>
admin/css/slimstat.css CHANGED
@@ -156,6 +156,10 @@
156
  margin: 0;
157
  padding: 5px 10px;
158
  }
 
 
 
 
159
  .wrap.slimstat .postbox.tall .hndle{
160
  cursor:auto;
161
  }
@@ -271,6 +275,14 @@
271
  display: none;
272
  }
273
 
 
 
 
 
 
 
 
 
274
  /* Single Report: Debug Message */
275
  .debug {
276
  display: none;
156
  margin: 0;
157
  padding: 5px 10px;
158
  }
159
+ .wrap.slimstat .postbox .hndle a{
160
+ font-size: 1em;
161
+ font-weight: 700;
162
+ }
163
  .wrap.slimstat .postbox.tall .hndle{
164
  cursor:auto;
165
  }
275
  display: none;
276
  }
277
 
278
+ /* Single Report: Table */
279
+ [id^=slim_] .widefat th{
280
+ white-space: nowrap;
281
+ }
282
+ [id^=slim_] .widefat td{
283
+ border-bottom: 1px solid #e1e1e1;
284
+ }
285
+
286
  /* Single Report: Debug Message */
287
  .debug {
288
  display: none;
admin/view/right-now.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  // Avoid direct access to this piece of code
3
- if (!function_exists('add_action')) exit(0);
 
 
4
 
5
  // Available icons
6
  $supported_browser_icons = array('Android','Anonymouse','Baiduspider','BlackBerry','BingBot','CFNetwork','Chrome','Chromium','Default Browser','Exabot/BiggerBetter','FacebookExternalHit','FeedBurner','Feedfetcher-Google','Firefox','Internet Archive','Googlebot','Google Bot','Google Feedfetcher','Google Web Preview','IE','IEMobile','iPad','iPhone','iPod Touch','Maxthon','Mediapartners-Google','Microsoft-WebDAV','msnbot','Mozilla','NewsGatorOnline','Netscape','Nokia','Opera','Opera Mini','Opera Mobi','Python','PycURL','Safari','W3C_Validator','WordPress','Yahoo! Slurp','YandexBot');
@@ -9,19 +11,21 @@ $supported_browser_types = array(__('Human','wp-slimstat'),__('Bot/Crawler','wp-
9
 
10
  $plugin_url = plugins_url('', dirname(__FILE__));
11
 
12
- // Set the filters
13
- wp_slimstat_db::$filters_normalized['misc']['limit_results'] = wp_slimstat::$options['number_results_raw_data'];
14
-
15
  // Get the data
16
- $results = wp_slimstat_db::get_recent('*');
 
 
 
 
 
17
 
18
  // Return the results if we are not echoing them (export, email, etc)
19
  if ( isset( $_args[ 'echo' ] ) && $_args[ 'echo' ] === false ) {
20
  return $results;
21
  }
22
 
23
- $count_page_results = count($results);
24
- $count_all_results = wp_slimstat_db::count_records();
25
 
26
  if ($count_page_results == 0){
27
  echo '<p class="nodata">'.__('No data to display','wp-slimstat').'</p>';
@@ -29,7 +33,7 @@ if ($count_page_results == 0){
29
  else {
30
 
31
  // Pagination
32
- echo wp_slimstat_reports::report_pagination( $count_page_results, $count_all_results, true );
33
 
34
  // Show delete button? (only those who can access the settings can see it)
35
  $current_user_can_delete = current_user_can(wp_slimstat::$options['capability_can_admin']);
@@ -167,6 +171,6 @@ else {
167
 
168
  // Pagination
169
  if ($count_page_results > 20){
170
- echo wp_slimstat_reports::report_pagination( $count_page_results, $count_all_results, true );
171
  }
172
  }
1
  <?php
2
  // Avoid direct access to this piece of code
3
+ if ( !function_exists( 'add_action' ) ) {
4
+ exit(0);
5
+ }
6
 
7
  // Available icons
8
  $supported_browser_icons = array('Android','Anonymouse','Baiduspider','BlackBerry','BingBot','CFNetwork','Chrome','Chromium','Default Browser','Exabot/BiggerBetter','FacebookExternalHit','FeedBurner','Feedfetcher-Google','Firefox','Internet Archive','Googlebot','Google Bot','Google Feedfetcher','Google Web Preview','IE','IEMobile','iPad','iPhone','iPod Touch','Maxthon','Mediapartners-Google','Microsoft-WebDAV','msnbot','Mozilla','NewsGatorOnline','Netscape','Nokia','Opera','Opera Mini','Opera Mobi','Python','PycURL','Safari','W3C_Validator','WordPress','Yahoo! Slurp','YandexBot');
11
 
12
  $plugin_url = plugins_url('', dirname(__FILE__));
13
 
 
 
 
14
  // Get the data
15
+ $all_results = wp_slimstat_db::get_recent( wp_slimstat_reports::$reports_info[ 'slim_p7_02' ][ 'callback_args' ] );
16
+ $results = array_slice(
17
+ $all_results,
18
+ wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ],
19
+ wp_slimstat::$options[ 'number_results_raw_data' ]
20
+ );
21
 
22
  // Return the results if we are not echoing them (export, email, etc)
23
  if ( isset( $_args[ 'echo' ] ) && $_args[ 'echo' ] === false ) {
24
  return $results;
25
  }
26
 
27
+ $count_all_results = count( $all_results );
28
+ $count_page_results = count( $results );
29
 
30
  if ($count_page_results == 0){
31
  echo '<p class="nodata">'.__('No data to display','wp-slimstat').'</p>';
33
  else {
34
 
35
  // Pagination
36
+ echo wp_slimstat_reports::report_pagination( $count_page_results, $count_all_results, true, wp_slimstat::$options[ 'number_results_raw_data' ] );
37
 
38
  // Show delete button? (only those who can access the settings can see it)
39
  $current_user_can_delete = current_user_can(wp_slimstat::$options['capability_can_admin']);
171
 
172
  // Pagination
173
  if ($count_page_results > 20){
174
+ echo wp_slimstat_reports::report_pagination( $count_page_results, $count_all_results, true, wp_slimstat::$options[ 'number_results_raw_data' ] );
175
  }
176
  }
admin/view/wp-slimstat-db.php CHANGED
@@ -50,7 +50,7 @@ class wp_slimstat_db {
50
  'browser_version' => array( __( 'Browser Version', 'wp-slimstat' ), 'varchar' ),
51
  'browser_type' => array( __( 'Browser Type', 'wp-slimstat' ), 'int' ),
52
  'user_agent' => array( __( 'User Agent', 'wp-slimstat' ), 'varchar' ),
53
- 'notes' => array( __( 'Pageview Attributes', 'wp-slimstat' ), 'varchar' ),
54
  'server_latency' => array( __( 'Server Latency', 'wp-slimstat' ), 'int' ),
55
  'author' => array( __( 'Post Author', 'wp-slimstat' ), 'varchar' ),
56
  'category' => array( __( 'Post Category ID', 'wp-slimstat' ), 'varchar' ),
@@ -76,9 +76,15 @@ class wp_slimstat_db {
76
  'interval_minutes' => array( __( 'minutes', 'wp-slimstat' ), 'int' ),
77
  'dt' => array( __( 'Unix Timestamp', 'wp-slimstat' ), 'int' ),
78
 
 
 
 
 
 
 
79
  'direction' => array( __( 'Direction', 'wp-slimstat' ), 'varchar' ),
80
- 'limit_results' => array( __( 'Limit Results', 'wp-slimstat' ), 'int' ),
81
- 'start_from' => array( __( 'Start From', 'wp-slimstat' ), 'int' ),
82
 
83
  // Misc Filters
84
  'strtotime' => array( 0, 'int' )
@@ -110,7 +116,7 @@ class wp_slimstat_db {
110
  continue;
111
  }
112
 
113
- $sql_array[] = self::_get_single_where_clause( $a_filter_column, $a_filter_data[ 0 ], $a_filter_data[ 1 ], $_slim_stats_table_alias );
114
  }
115
 
116
  // Flatten array
@@ -121,7 +127,7 @@ class wp_slimstat_db {
121
  return '';
122
  }
123
 
124
- public static function get_combined_where( $_where = '', $_column = '*', $_use_time_range = true, $_slim_stats_table_alias = '' ) {
125
  $dt_with_alias = 'dt';
126
  if ( !empty( $_slim_stats_table_alias ) ) {
127
  $dt_with_alias = $_slim_stats_table_alias . '.' . $dt_with_alias;
@@ -132,12 +138,12 @@ class wp_slimstat_db {
132
  if ( !empty( self::$filters_normalized[ 'columns' ] ) ) {
133
  $_where = self::_get_sql_where( self::$filters_normalized[ 'columns' ], $_slim_stats_table_alias );
134
 
135
- if ($_use_time_range) {
136
  $time_range_condition = "$dt_with_alias BETWEEN " . self::$filters_normalized[ 'utime' ][ 'start' ] . ' AND ' . self::$filters_normalized[ 'utime' ][ 'end' ];
137
  }
138
 
139
  }
140
- elseif ( $_use_time_range ) {
141
  $time_range_condition = "$dt_with_alias BETWEEN " . self::$filters_normalized[ 'utime' ][ 'start' ] . ' AND ' . self::$filters_normalized[ 'utime' ][ 'end' ];
142
  }
143
  else {
@@ -146,9 +152,14 @@ class wp_slimstat_db {
146
  }
147
  else {
148
  if ( $_where != '1=1' && !empty( self::$filters_normalized[ 'columns' ] ) ) {
149
- $_where .= ' AND ' . self::_get_sql_where( self::$filters_normalized[ 'columns' ], $_slim_stats_table_alias );
 
 
 
 
 
150
  }
151
- if ( $_use_time_range ) {
152
  $time_range_condition = "$dt_with_alias BETWEEN " . self::$filters_normalized[ 'utime' ][ 'start' ] . ' AND ' . self::$filters_normalized[ 'utime' ][ 'end' ];
153
  }
154
  }
@@ -160,9 +171,14 @@ class wp_slimstat_db {
160
  $_where = trim( "$_where $time_range_condition" );
161
  }
162
 
163
- if ( !empty( self::$columns_names[ $_column ] ) ) {
164
- $filter_empty = "$_column ".( ( self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NULL' : '= 0' );
165
- $filter_not_empty = "$_column ".( ( self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NOT NULL' : '<> 0' );
 
 
 
 
 
166
 
167
  if ( strpos( $_where, $filter_empty ) === false && strpos( $_where, $filter_not_empty) === false) {
168
  $_where = "$filter_not_empty AND $_where";
@@ -175,9 +191,9 @@ class wp_slimstat_db {
175
  /**
176
  * Translates user-friendly operators into SQL conditions
177
  */
178
- protected static function _get_single_where_clause( $_column = 'id', $_operator = 'equals', $_value = '', $_slim_stats_table_alias = 'b' ) {
179
- $filter_empty = ( self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NULL' : '= 0';
180
- $filter_not_empty = ( self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NOT NULL' : '<> 0';
181
 
182
  $column_with_alias = $_column;
183
  if ( !empty( $_slim_stats_table_alias ) ) {
@@ -224,11 +240,11 @@ class wp_slimstat_db {
224
  break;
225
 
226
  case 'is_empty':
227
- $where = array( "$column_with_alias $filter_empty", array() );
228
  break;
229
 
230
  case 'is_not_empty':
231
- $where = array( "$column_with_alias $filter_not_empty", array() );
232
  break;
233
 
234
  case 'is_greater_than':
@@ -257,7 +273,12 @@ class wp_slimstat_db {
257
  break;
258
  }
259
 
260
- return $GLOBALS[ 'wpdb' ]->prepare( $where[0], $where[1] );
 
 
 
 
 
261
  }
262
 
263
  protected static function _show_debug( $_message = '' ) {
@@ -293,7 +314,7 @@ class wp_slimstat_db {
293
  ),
294
  'misc' => $_init_misc?array(
295
  'direction' => 'DESC',
296
- 'limit_results' => wp_slimstat::$options[ 'rows_to_show' ],
297
  'start_from' => 0
298
  ) : array(),
299
  'utime' => array(
@@ -570,9 +591,9 @@ class wp_slimstat_db {
570
  'SUM(counthits) AS counthits' ) );
571
  }
572
 
573
- public static function count_records( $_column = 'id', $_where = '', $_use_time_range = true ) {
574
  $distinct_column = ( $_column != 'id' ) ? "DISTINCT $_column" : $_column;
575
- $_where = self::get_combined_where( $_where, $_column, $_use_time_range );
576
 
577
  return intval( self::get_var( "
578
  SELECT COUNT($distinct_column) counthits
@@ -736,11 +757,20 @@ class wp_slimstat_db {
736
  SELECT dt
737
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
738
  ORDER BY dt ASC
739
- LIMIT 0,1",
740
  'MIN(dt)' );
741
  }
742
 
743
- public static function get_recent( $_column = '*', $_where = '', $_having = '', $_use_time_range = true, $_as_column = '' ) {
 
 
 
 
 
 
 
 
 
744
  if ( !empty( $_as_column ) ) {
745
  $_column = "$_column AS $_as_column";
746
  }
@@ -748,7 +778,7 @@ class wp_slimstat_db {
748
  $_as_column = $_column;
749
  }
750
 
751
- $_where = self::get_combined_where( $_where, $_column, $_use_time_range );
752
 
753
  if ( $_column == '*' ) {
754
  return self::get_results( "
@@ -756,7 +786,7 @@ class wp_slimstat_db {
756
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
757
  WHERE $_where
758
  ORDER BY dt DESC
759
- LIMIT ".self::$filters_normalized[ 'misc' ][ 'start_from' ].', '.self::$filters_normalized[ 'misc' ][ 'limit_results' ],
760
  $_column,
761
  'dt DESC' );
762
  }
@@ -770,13 +800,40 @@ class wp_slimstat_db {
770
  GROUP BY $_as_column $_having
771
  ) AS ts1 INNER JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON ts1.maxid = t1.id
772
  ORDER BY t1.dt DESC
773
- LIMIT ".self::$filters_normalized[ 'misc' ][ 'start_from' ].', '.self::$filters_normalized[ 'misc' ][ 'limit_results' ],
774
  ( ( !empty( $_as_column ) && $_as_column != $_column ) ? $_as_column : $_column ).', blog_id',
775
  't1.dt DESC' );
776
  }
777
  }
778
-
779
- public static function get_top( $_column = 'id', $_where = '', $_having = '', $_use_time_range = true, $_as_column = '' ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  if ( !empty( $_as_column ) ) {
781
  $_column = "$_column AS $_as_column";
782
  }
@@ -784,7 +841,7 @@ class wp_slimstat_db {
784
  $_as_column = $_column;
785
  }
786
 
787
- $_where = self::get_combined_where( $_where, $_as_column, $_use_time_range );
788
 
789
  return self::get_results( "
790
  SELECT $_column, COUNT(*) counthits
@@ -792,7 +849,7 @@ class wp_slimstat_db {
792
  WHERE $_where
793
  GROUP BY $_as_column $_having
794
  ORDER BY counthits DESC
795
- LIMIT ".self::$filters_normalized[ 'misc' ][ 'start_from' ].', '.self::$filters_normalized[ 'misc' ][ 'limit_results' ],
796
  ( ( !empty( $_as_column ) && $_as_column != $_column ) ? $_as_column : $_column ).', blog_id',
797
  'counthits DESC',
798
  $_column,
@@ -812,10 +869,29 @@ class wp_slimstat_db {
812
  ) AS ts1 JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON ts1.aggrid = t1.id
813
  GROUP BY $_outer_select_column
814
  ORDER BY counthits DESC
815
- LIMIT ".self::$filters_normalized[ 'misc' ][ 'start_from' ].', '.self::$filters_normalized[ 'misc' ][ 'limit_results' ],
816
  $_outer_select_column,
817
  'counthits DESC',
818
  $_outer_select_column,
819
  "$_aggr_function(aggrid), SUM(counthits)" );
820
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  }
50
  'browser_version' => array( __( 'Browser Version', 'wp-slimstat' ), 'varchar' ),
51
  'browser_type' => array( __( 'Browser Type', 'wp-slimstat' ), 'int' ),
52
  'user_agent' => array( __( 'User Agent', 'wp-slimstat' ), 'varchar' ),
53
+ 'notes' => array( __( 'Annotations', 'wp-slimstat' ), 'varchar' ),
54
  'server_latency' => array( __( 'Server Latency', 'wp-slimstat' ), 'int' ),
55
  'author' => array( __( 'Post Author', 'wp-slimstat' ), 'varchar' ),
56
  'category' => array( __( 'Post Category ID', 'wp-slimstat' ), 'varchar' ),
76
  'interval_minutes' => array( __( 'minutes', 'wp-slimstat' ), 'int' ),
77
  'dt' => array( __( 'Unix Timestamp', 'wp-slimstat' ), 'int' ),
78
 
79
+ // Events
80
+ 'event_id' => array( __( 'Event ID', 'wp-slimstat' ), 'int' ),
81
+ 'type' => array( __( 'Type', 'wp-slimstat' ), 'int' ),
82
+ 'event_description' => array( __( 'Event Description', 'wp-slimstat' ), 'varchar' ),
83
+ 'position' => array( __( 'Event Coordinates', 'wp-slimstat' ), 'int' ),
84
+
85
  'direction' => array( __( 'Direction', 'wp-slimstat' ), 'varchar' ),
86
+ 'limit_results' => array( __( 'Max Results', 'wp-slimstat' ), 'int' ),
87
+ 'start_from' => array( __( 'Offset', 'wp-slimstat' ), 'int' ),
88
 
89
  // Misc Filters
90
  'strtotime' => array( 0, 'int' )
116
  continue;
117
  }
118
 
119
+ $sql_array[] = self::get_single_where_clause( $a_filter_column, $a_filter_data[ 0 ], $a_filter_data[ 1 ], $_slim_stats_table_alias );
120
  }
121
 
122
  // Flatten array
127
  return '';
128
  }
129
 
130
+ public static function get_combined_where( $_where = '', $_column = '*', $_use_date_filters = true, $_slim_stats_table_alias = '' ) {
131
  $dt_with_alias = 'dt';
132
  if ( !empty( $_slim_stats_table_alias ) ) {
133
  $dt_with_alias = $_slim_stats_table_alias . '.' . $dt_with_alias;
138
  if ( !empty( self::$filters_normalized[ 'columns' ] ) ) {
139
  $_where = self::_get_sql_where( self::$filters_normalized[ 'columns' ], $_slim_stats_table_alias );
140
 
141
+ if ($_use_date_filters) {
142
  $time_range_condition = "$dt_with_alias BETWEEN " . self::$filters_normalized[ 'utime' ][ 'start' ] . ' AND ' . self::$filters_normalized[ 'utime' ][ 'end' ];
143
  }
144
 
145
  }
146
+ elseif ( $_use_date_filters ) {
147
  $time_range_condition = "$dt_with_alias BETWEEN " . self::$filters_normalized[ 'utime' ][ 'start' ] . ' AND ' . self::$filters_normalized[ 'utime' ][ 'end' ];
148
  }
149
  else {
152
  }
153
  else {
154
  if ( $_where != '1=1' && !empty( self::$filters_normalized[ 'columns' ] ) ) {
155
+ $new_clause = self::_get_sql_where( self::$filters_normalized[ 'columns' ], $_slim_stats_table_alias );
156
+
157
+ // This condition could be empty if it's related to a custom column
158
+ if ( !empty( $new_clause ) ) {
159
+ $_where .= ' AND ' . $new_clause;
160
+ }
161
  }
162
+ if ( $_use_date_filters ) {
163
  $time_range_condition = "$dt_with_alias BETWEEN " . self::$filters_normalized[ 'utime' ][ 'start' ] . ' AND ' . self::$filters_normalized[ 'utime' ][ 'end' ];
164
  }
165
  }
171
  $_where = trim( "$_where $time_range_condition" );
172
  }
173
 
174
+ if ( !empty( $_column ) && !empty( self::$columns_names[ $_column ] ) ) {
175
+ $column_with_alias = $_column;
176
+ if ( !empty( $_slim_stats_table_alias ) ) {
177
+ $column_with_alias = $_slim_stats_table_alias . '.' . $column_with_alias;
178
+ }
179
+
180
+ $filter_empty = "$column_with_alias " . ( ( self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NULL' : '= 0' );
181
+ $filter_not_empty = "$column_with_alias " . ( ( self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NOT NULL' : '<> 0' );
182
 
183
  if ( strpos( $_where, $filter_empty ) === false && strpos( $_where, $filter_not_empty) === false) {
184
  $_where = "$filter_not_empty AND $_where";
191
  /**
192
  * Translates user-friendly operators into SQL conditions
193
  */
194
+ public static function get_single_where_clause( $_column = 'id', $_operator = 'equals', $_value = '', $_slim_stats_table_alias = '' ) {
195
+ $filter_empty = ( !empty( self::$columns_names[ $_column ] ) && self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NULL' : '= 0';
196
+ $filter_not_empty = ( !empty( self::$columns_names[ $_column ] ) && self::$columns_names[ $_column ] [ 1 ] == 'varchar' ) ? 'IS NOT NULL' : '<> 0';
197
 
198
  $column_with_alias = $_column;
199
  if ( !empty( $_slim_stats_table_alias ) ) {
240
  break;
241
 
242
  case 'is_empty':
243
+ $where = array( "$column_with_alias $filter_empty", '' );
244
  break;
245
 
246
  case 'is_not_empty':
247
+ $where = array( "$column_with_alias $filter_not_empty", '' );
248
  break;
249
 
250
  case 'is_greater_than':
273
  break;
274
  }
275
 
276
+ if ( !empty( $where[ 1 ] ) ) {
277
+ return $GLOBALS[ 'wpdb' ]->prepare( $where[ 0 ], $where[ 1 ] );
278
+ }
279
+ else {
280
+ return $where[ 0 ];
281
+ }
282
  }
283
 
284
  protected static function _show_debug( $_message = '' ) {
314
  ),
315
  'misc' => $_init_misc?array(
316
  'direction' => 'DESC',
317
+ 'limit_results' => 1000,
318
  'start_from' => 0
319
  ) : array(),
320
  'utime' => array(
591
  'SUM(counthits) AS counthits' ) );
592
  }
593
 
594
+ public static function count_records( $_column = 'id', $_where = '', $_use_date_filters = true ) {
595
  $distinct_column = ( $_column != 'id' ) ? "DISTINCT $_column" : $_column;
596
+ $_where = self::get_combined_where( $_where, $_column, $_use_date_filters );
597
 
598
  return intval( self::get_var( "
599
  SELECT COUNT($distinct_column) counthits
757
  SELECT dt
758
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
759
  ORDER BY dt ASC
760
+ LIMIT 0, 1",
761
  'MIN(dt)' );
762
  }
763
 
764
+ public static function get_recent( $_column = '*', $_where = '', $_having = '', $_use_date_filters = true, $_as_column = '' ) {
765
+ // This function can be passed individual arguments, or an array of arguments
766
+ if ( is_array( $_column ) ) {
767
+ $_where = !empty( $_column[ 'where' ] ) ? $_column[ 'where' ] : '';
768
+ $_having = !empty( $_column[ 'having' ] ) ? $_column[ 'having' ] : '';
769
+ $_use_date_filters = !empty( $_column[ 'use_date_filters' ] ) ? $_column[ 'use_date_filters' ] : true;
770
+ $_as_column = !empty( $_column[ 'as_column' ] ) ? $_column[ 'as_column' ] : '';
771
+ $_column = $_column[ 'columns' ];
772
+ }
773
+
774
  if ( !empty( $_as_column ) ) {
775
  $_column = "$_column AS $_as_column";
776
  }
778
  $_as_column = $_column;
779
  }
780
 
781
+ $_where = self::get_combined_where( $_where, $_column, $_use_date_filters );
782
 
783
  if ( $_column == '*' ) {
784
  return self::get_results( "
786
  FROM {$GLOBALS['wpdb']->prefix}slim_stats
787
  WHERE $_where
788
  ORDER BY dt DESC
789
+ LIMIT 0, " . self::$filters_normalized[ 'misc' ][ 'limit_results' ],
790
  $_column,
791
  'dt DESC' );
792
  }
800
  GROUP BY $_as_column $_having
801
  ) AS ts1 INNER JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON ts1.maxid = t1.id
802
  ORDER BY t1.dt DESC
803
+ LIMIT 0, " . self::$filters_normalized[ 'misc' ][ 'limit_results' ],
804
  ( ( !empty( $_as_column ) && $_as_column != $_column ) ? $_as_column : $_column ).', blog_id',
805
  't1.dt DESC' );
806
  }
807
  }
808
+
809
+ public static function get_recent_events() {
810
+ if ( empty( self::$filters_normalized[ 'columns' ] ) ) {
811
+ $from = "{$GLOBALS['wpdb']->prefix}slim_events te";
812
+ $where = wp_slimstat_db::get_combined_where( 'te.type > 1', 'notes' );
813
+ }
814
+ else {
815
+ $from = "{$GLOBALS['wpdb']->prefix}slim_events te INNER JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON te.id = t1.id";
816
+ $where = wp_slimstat_db::get_combined_where( 'te.type > 1', 'notes', true, 't1' );
817
+ }
818
+
819
+ return self::get_results( "
820
+ SELECT *
821
+ FROM $from
822
+ WHERE $where
823
+ ORDER BY te.dt DESC"
824
+ );
825
+ }
826
+
827
+ public static function get_top( $_column = 'id', $_where = '', $_having = '', $_use_date_filters = true, $_as_column = '' ){
828
+ // This function can be passed individual arguments, or an array of arguments
829
+ if ( is_array( $_column ) ) {
830
+ $_where = !empty( $_column[ 'where' ] ) ? $_column[ 'where' ] : '';
831
+ $_having = !empty( $_column[ 'having' ] ) ? $_column[ 'having' ] : '';
832
+ $_use_date_filters = !empty( $_column[ 'use_date_filters' ] ) ? $_column[ 'use_date_filters' ] : true;
833
+ $_as_column = !empty( $_column[ 'as_column' ] ) ? $_column[ 'as_column' ] : '';
834
+ $_column = $_column[ 'columns' ];
835
+ }
836
+
837
  if ( !empty( $_as_column ) ) {
838
  $_column = "$_column AS $_as_column";
839
  }
841
  $_as_column = $_column;
842
  }
843
 
844
+ $_where = self::get_combined_where( $_where, $_as_column, $_use_date_filters );
845
 
846
  return self::get_results( "
847
  SELECT $_column, COUNT(*) counthits
849
  WHERE $_where
850
  GROUP BY $_as_column $_having
851
  ORDER BY counthits DESC
852
+ LIMIT 0, " . self::$filters_normalized[ 'misc' ][ 'limit_results' ],
853
  ( ( !empty( $_as_column ) && $_as_column != $_column ) ? $_as_column : $_column ).', blog_id',
854
  'counthits DESC',
855
  $_column,
869
  ) AS ts1 JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON ts1.aggrid = t1.id
870
  GROUP BY $_outer_select_column
871
  ORDER BY counthits DESC
872
+ LIMIT 0, " . self::$filters_normalized[ 'misc' ][ 'limit_results' ],
873
  $_outer_select_column,
874
  'counthits DESC',
875
  $_outer_select_column,
876
  "$_aggr_function(aggrid), SUM(counthits)" );
877
  }
878
+
879
+ public static function get_top_events() {
880
+ if ( empty( self::$filters_normalized[ 'columns' ] ) ) {
881
+ $from = "{$GLOBALS['wpdb']->prefix}slim_events te";
882
+ $where = wp_slimstat_db::get_combined_where( 'te.type > 1', 'notes' );
883
+ }
884
+ else {
885
+ $from = "{$GLOBALS['wpdb']->prefix}slim_events te INNER JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON te.id = t1.id";
886
+ $where = wp_slimstat_db::get_combined_where( 'te.type > 1', 'notes', true, 't1' );
887
+ }
888
+
889
+ return self::get_results( "
890
+ SELECT te.notes, te.type, COUNT(*) counthits
891
+ FROM $from
892
+ WHERE $where
893
+ GROUP BY te.notes, te.type
894
+ ORDER BY counthits DESC"
895
+ );
896
+ }
897
  }
admin/view/wp-slimstat-reports.php CHANGED
@@ -27,8 +27,8 @@ class wp_slimstat_reports {
27
 
28
  // Filters use the following format: browser equals Firefox&&&country contains gb
29
  $filters = array();
30
- if (!empty($_REQUEST['fs']) && is_array($_REQUEST['fs'])){
31
- foreach($_REQUEST['fs'] as $a_request_filter_name => $a_request_filter_value){
32
  $filters[] = "$a_request_filter_name $a_request_filter_value";
33
  }
34
  }
@@ -38,7 +38,7 @@ class wp_slimstat_reports {
38
  $filters[] = "{$_POST[ 'f' ]} {$_POST[ 'o' ]} " . ( isset( $_POST[ 'v' ] ) ? $_POST[ 'v' ] : '' );
39
  }
40
 
41
- foreach ( array('minute', 'hour', 'day', 'month', 'year', 'interval_direction', 'interval', 'interval_hours', 'interval_minutes') as $a_date_time_filter_name ) {
42
  if ( !empty( $_POST[ $a_date_time_filter_name ] ) ) {
43
  $filters[] = "$a_date_time_filter_name equals {$_POST[ $a_date_time_filter_name ]}";
44
  }
@@ -46,8 +46,8 @@ class wp_slimstat_reports {
46
 
47
  // Hidden Filters
48
  if ( wp_slimstat::$options[ 'restrict_authors_view' ] == 'yes' && !current_user_can( 'manage_options' ) ) {
49
- $filters[] = 'author equals '.$GLOBALS['current_user']->user_login;
50
- self::$hidden_filters['author'] = 1;
51
  }
52
 
53
  if ( !empty( $filters ) ) {
@@ -68,21 +68,28 @@ class wp_slimstat_reports {
68
  // - callback : function to use to render the report
69
  // - callback_args : parameters to pass to the function
70
  // - classes : determine the look and feel of this report ( tall, normal, wide, hidden )
71
- // - screens : where should the report appear ( wp-slim-view-1, .., wp-slim-view-4, dashboard, raw ). If 'raw' is used, it means that this report can return an array of rows for other uses ( export, email, etc )
72
  // - tooltip : contextual help to be displayed on hover
73
 
74
- $chart_tooltip = '<strong>'.__( 'Chart controls', 'wp-slimstat' ).'</strong><ul><li>'.__( 'Use your mouse wheel to zoom in and out', 'wp-slimstat' ).'</li><li>'.__( 'While zooming in, drag the chart to move to a different area', 'wp-slimstat' ).'</li><li>'.__( 'Double click on an empty region to reset the zoom level', 'wp-slimstat' ).'</li></ul>';
75
  self::$reports_info = array(
 
 
 
 
 
 
 
76
  'slim_p7_02' => array(
77
  'title' => __( 'Activity', 'wp-slimstat' ),
78
  'callback' => array( __CLASS__, 'show_activity_log' ),
79
  'callback_args' => array(
80
  'type' => 'recent',
81
  'columns' => 'id',
82
- 'raw' => array( __CLASS__, 'get_raw_results' )
83
  ),
84
  'classes' => array( 'full-width', 'tall' ),
85
- 'screens' => array( 'wp-slim-view-1', 'raw' ),
86
  'tooltip' => __( 'Color codes', 'wp-slimstat' ).'</strong><p><span class="little-color-box is-search-engine"></span> '.__( 'From search result page', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-visitor"></span> '.__( 'Known Visitor', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-user"></span> '.__( 'Known Users', 'wp-slimstat' ).'</p><p><span class="little-color-box is-direct"></span> '.__( 'Other Humans', 'wp-slimstat' ).'</p><p><span class="little-color-box"></span> '.__( 'Bot or Crawler', 'wp-slimstat' ).'</p>'
87
  ),
88
 
@@ -116,10 +123,10 @@ class wp_slimstat_reports {
116
  'columns' => 'username',
117
  'where' => 'dt > '. ( date_i18n( 'U' ) - 300 ),
118
  'use_date_filters' => false,
119
- 'raw' => array( __CLASS__, 'get_raw_results' )
120
  ),
121
  'classes' => array( 'normal' ),
122
- 'screens' => array( 'wp-slim-view-2', 'dashboard', 'raw' ),
123
  'tooltip' => __( 'When visitors leave a comment on your blog, WordPress assigns them a cookie. Slimstat leverages this information to identify returning visitors. Please note that visitors also include registered users.', 'wp-slimstat' )
124
  ),
125
  'slim_p1_06' => array(
@@ -128,10 +135,10 @@ class wp_slimstat_reports {
128
  'callback_args' => array(
129
  'type' => 'recent',
130
  'columns' => 'searchterms',
131
- 'raw' => array( __CLASS__, 'get_raw_results' )
132
  ),
133
  'classes' => array( 'normal' ),
134
- 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-5', 'raw' ),
135
  'tooltip' => __( 'Keywords used by your visitors to find your website on a search engine.', 'wp-slimstat' )
136
  ),
137
  'slim_p1_08' => array(
@@ -142,10 +149,10 @@ class wp_slimstat_reports {
142
  'columns' => 'SUBSTRING_INDEX(resource, "' . ( !get_option( 'permalink_structure' ) ? '&' : '?' ) . '", 1)',
143
  'as_column' => 'resource_substring',
144
  'filter_op' => 'contains',
145
- 'raw' => array( __CLASS__, 'get_raw_results' )
146
  ),
147
  'classes' => array( 'normal' ),
148
- 'screens' => array( 'wp-slim-view-2', 'dashboard', 'raw' ),
149
  'tooltip' => __( 'Here a "page" is not just a WordPress page type, but any web page on your website, including posts, products, categories, and so on.', 'wp-slimstat' )
150
  ),
151
  'slim_p1_10' => array(
@@ -155,10 +162,10 @@ class wp_slimstat_reports {
155
  'type' => 'top',
156
  'columns' => 'referer',
157
  'where' => 'referer NOT LIKE "%' . home_url() . '%"',
158
- 'raw' => array( __CLASS__, 'get_raw_results' )
159
  ),
160
  'classes' => array( 'normal' ),
161
- 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-5', 'dashboard', 'raw' )
162
  ),
163
  'slim_p1_11' => array(
164
  'title' => __( 'Top Known Visitors', 'wp-slimstat' ),
@@ -166,10 +173,10 @@ class wp_slimstat_reports {
166
  'callback_args' => array(
167
  'type' => 'top',
168
  'columns' => 'username',
169
- 'raw' => array( __CLASS__, 'get_raw_results' )
170
  ),
171
  'classes' => array( 'normal', 'hidden' ),
172
- 'screens' => array( 'wp-slim-view-2', 'dashboard', 'raw' )
173
  ),
174
  'slim_p1_12' => array(
175
  'title' => __( 'Top Search Terms', 'wp-slimstat' ),
@@ -177,10 +184,10 @@ class wp_slimstat_reports {
177
  'callback_args' => array(
178
  'type' => 'top',
179
  'columns' => 'searchterms',
180
- 'raw' => array( __CLASS__, 'get_raw_results' )
181
  ),
182
  'classes' => array( 'normal' ),
183
- 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-4', 'wp-slim-view-5', 'dashboard', 'raw' )
184
  ),
185
  'slim_p1_13' => array(
186
  'title' => __( 'Top Countries', 'wp-slimstat' ),
@@ -188,10 +195,10 @@ class wp_slimstat_reports {
188
  'callback_args' => array(
189
  'type' => 'top',
190
  'columns' => 'country',
191
- 'raw' => array( __CLASS__, 'get_raw_results' )
192
  ),
193
  'classes' => array( 'normal', 'hidden' ),
194
- 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-3', 'wp-slim-view-5', 'dashboard', 'raw' ),
195
  'tooltip' => __( 'You can configure Slimstat to ignore a specific Country by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat' )
196
  ),
197
  'slim_p1_15' => array(
@@ -209,10 +216,10 @@ class wp_slimstat_reports {
209
  'columns' => 'SUBSTRING(language, 1, 2)',
210
  'as_column' => 'language_substring',
211
  'filter_op' => 'contains',
212
- 'raw' => array( __CLASS__, 'get_raw_results' )
213
  ),
214
  'classes' => array( 'normal', 'hidden' ),
215
- 'screens' => array( 'wp-slim-view-3', 'raw' )
216
  ),
217
 
218
  'slim_p2_01' => array(
@@ -238,21 +245,21 @@ class wp_slimstat_reports {
238
  'callback_args' => array(
239
  'type' => 'top',
240
  'columns' => 'language',
241
- 'raw' => array( __CLASS__, 'get_raw_results' )
242
  ),
243
  'classes' => array( 'normal' ),
244
- 'screens' => array( 'wp-slim-view-3', 'raw' )
245
  ),
246
  'slim_p2_04' => array(
247
- 'title' => __( 'Top Browsers', 'wp-slimstat', 'dashboard' ),
248
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
249
  'callback_args' => array(
250
  'type' => 'top',
251
  'columns' => 'browser, browser_version',
252
- 'raw' => array( __CLASS__, 'get_raw_results' )
253
  ),
254
  'classes' => array( 'normal' ),
255
- 'screens' => array( 'wp-slim-view-3', 'raw' )
256
  ),
257
  'slim_p2_05' => array(
258
  'title' => __( 'Top Service Providers', 'wp-slimstat' ),
@@ -260,10 +267,10 @@ class wp_slimstat_reports {
260
  'callback_args' => array(
261
  'type' => 'top',
262
  'columns' => 'ip',
263
- 'raw' => array( __CLASS__, 'get_raw_results' )
264
  ),
265
  'classes' => array( 'wide', 'hidden' ),
266
- 'screens' => array( 'wp-slim-view-3', 'raw' ),
267
  'tooltip' => __( 'Internet Service Provider: a company which provides other companies or individuals with access to the Internet. Your DSL or cable internet service is provided to you by your ISP.<br><br>You can ignore specific IP addresses by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat' )
268
  ),
269
  'slim_p2_06' => array(
@@ -272,10 +279,10 @@ class wp_slimstat_reports {
272
  'callback_args' => array(
273
  'type' => 'top',
274
  'columns' => 'platform',
275
- 'raw' => array( __CLASS__, 'get_raw_results' )
276
  ),
277
  'classes' => array( 'normal', 'hidden' ),
278
- 'screens' => array( 'wp-slim-view-3', 'raw' ),
279
  'tooltip' => __( 'Internet Service Provider: a company which provides other companies or individuals with access to the Internet. Your DSL or cable internet service is provided to you by your ISP.<br><br>You can ignore specific IP addresses by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat' )
280
  ),
281
  'slim_p2_07' => array(
@@ -283,11 +290,22 @@ class wp_slimstat_reports {
283
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
284
  'callback_args' => array(
285
  'type' => 'top',
286
- 'columns' => 'resolution',
287
- 'raw' => array( __CLASS__, 'get_raw_results' ),
288
  ),
289
  'classes' => array( 'normal' ),
290
- 'screens' => array( 'wp-slim-view-3', 'dashboard', 'raw' )
 
 
 
 
 
 
 
 
 
 
 
291
  ),
292
  'slim_p2_09' => array(
293
  'title' => __( 'Browser Capabilities', 'wp-slimstat' ),
@@ -307,21 +325,21 @@ class wp_slimstat_reports {
307
  'callback_args' => array(
308
  'type' => 'recent',
309
  'columns' => 'country',
310
- 'raw' => array( __CLASS__, 'get_raw_results' )
311
  ),
312
  'classes' => array( 'normal', 'hidden' ),
313
- 'screens' => array( 'wp-slim-view-3', 'wp-slim-view-5', 'raw' )
314
  ),
315
  'slim_p2_14' => array(
316
- 'title' => __( 'Recent Screen Resolutions', 'wp-slimstat' ),
317
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
318
  'callback_args' => array(
319
  'type' => 'recent',
320
  'columns' => 'resolution',
321
- 'raw' => array( __CLASS__, 'get_raw_results' )
322
  ),
323
  'classes' => array( 'normal', 'hidden' ),
324
- 'screens' => array( 'wp-slim-view-3', 'raw' )
325
  ),
326
  'slim_p2_15' => array(
327
  'title' => __( 'Recent Operating Systems', 'wp-slimstat' ),
@@ -329,10 +347,10 @@ class wp_slimstat_reports {
329
  'callback_args' => array(
330
  'type' => 'recent',
331
  'columns' => 'platform',
332
- 'raw' => array( __CLASS__, 'get_raw_results' )
333
  ),
334
  'classes' => array( 'normal', 'hidden' ),
335
- 'screens' => array( 'wp-slim-view-3', 'raw' )
336
  ),
337
  'slim_p2_16' => array(
338
  'title' => __( 'Recent Browsers', 'wp-slimstat' ),
@@ -340,10 +358,10 @@ class wp_slimstat_reports {
340
  'callback_args' => array(
341
  'type' => 'recent',
342
  'columns' => 'browser, browser_version',
343
- 'raw' => array( __CLASS__, 'get_raw_results' )
344
  ),
345
  'classes' => array( 'normal', 'hidden' ),
346
- 'screens' => array( 'wp-slim-view-3', 'raw' )
347
  ),
348
  'slim_p2_17' => array(
349
  'title' => __( 'Recent Languages', 'wp-slimstat' ),
@@ -351,10 +369,10 @@ class wp_slimstat_reports {
351
  'callback_args' => array(
352
  'type' => 'recent',
353
  'columns' => 'language',
354
- 'raw' => array( __CLASS__, 'get_raw_results' )
355
  ),
356
  'classes' => array( 'normal', 'hidden' ),
357
- 'screens' => array( 'wp-slim-view-3', 'raw' )
358
  ),
359
  'slim_p2_18' => array(
360
  'title' => __( 'Top Browser Families', 'wp-slimstat' ),
@@ -362,10 +380,10 @@ class wp_slimstat_reports {
362
  'callback_args' => array(
363
  'type' => 'top',
364
  'columns' => 'browser',
365
- 'raw' => array( __CLASS__, 'get_raw_results' )
366
  ),
367
  'classes' => array( 'normal', 'hidden' ),
368
- 'screens' => array( 'wp-slim-view-3', 'raw' ),
369
  'tooltip' => __( 'This report shows you what user agent families (no version considered) are popular among your visitors.', 'wp-slimstat' )
370
  ),
371
  'slim_p2_19' => array(
@@ -376,10 +394,10 @@ class wp_slimstat_reports {
376
  'columns' => 'CONCAT("p-", SUBSTRING(platform, 1, 3))',
377
  'as_column' => 'platform_substring',
378
  'filter_op' => 'contains',
379
- 'raw' => array( __CLASS__, 'get_raw_results' )
380
  ),
381
  'classes' => array( 'normal' ),
382
- 'screens' => array( 'wp-slim-view-3', 'raw' ),
383
  'tooltip' => __( 'This report shows you what operating system families (no version considered) are popular among your visitors.', 'wp-slimstat' )
384
  ),
385
  'slim_p2_20' => array(
@@ -389,10 +407,10 @@ class wp_slimstat_reports {
389
  'type' => 'recent',
390
  'columns' => 'username',
391
  'where' => 'notes LIKE "%user:%"',
392
- 'raw' => array( __CLASS__, 'get_raw_results' )
393
  ),
394
  'classes' => array( 'normal' ),
395
- 'screens' => array( 'wp-slim-view-3', 'raw' )
396
  ),
397
  'slim_p2_21' => array(
398
  'title' => __( 'Top Users', 'wp-slimstat' ),
@@ -401,10 +419,10 @@ class wp_slimstat_reports {
401
  'type' => 'top',
402
  'columns' => 'username',
403
  'where' => 'notes LIKE "%user:%"',
404
- 'raw' => array( __CLASS__, 'get_raw_results' )
405
  ),
406
  'classes' => array( 'normal', 'hidden' ),
407
- 'screens' => array( 'wp-slim-view-3', 'dashboard', 'raw' )
408
  ),
409
 
410
  'slim_p3_01' => array(
@@ -430,10 +448,10 @@ class wp_slimstat_reports {
430
  'type' => 'top',
431
  'columns' => 'referer',
432
  'where' => "searchterms IS NOT NULL AND referer NOT LIKE '%".home_url()."%'",
433
- 'raw' => array( __CLASS__, 'get_raw_results' )
434
  ),
435
  'classes' => array( 'normal' ),
436
- 'screens' => array( 'wp-slim-view-5', 'dashboard', 'raw' )
437
  ),
438
  'slim_p3_11' => array(
439
  'title' => __( 'Recent Exit Pages', 'wp-slimstat' ),
@@ -441,10 +459,10 @@ class wp_slimstat_reports {
441
  'callback_args' => array(
442
  'type' => 'recent',
443
  'columns' => 'visit_id', // raw_results_to_html knows to display the resource, when the column is visit_id
444
- 'raw' => array( __CLASS__, 'get_raw_results' )
445
  ),
446
  'classes' => array( 'normal' ),
447
- 'screens' => array( 'wp-slim-view-5', 'raw' )
448
  ),
449
 
450
  'slim_p4_01' => array(
@@ -453,11 +471,10 @@ class wp_slimstat_reports {
453
  'callback_args' => array(
454
  'type' => 'recent',
455
  'columns' => 'outbound_resource', // raw_results_to_html knows to display the resource, when the column is visit_id
456
- 'raw' => array( __CLASS__, 'get_raw_results' )
457
  ),
458
- 'callback_raw' => array( __CLASS__, 'get_raw_results' ),
459
  'classes' => array( 'wide' ),
460
- 'screens' => array( 'wp-slim-view-4', 'raw' ),
461
  'tooltip' => ''
462
  ),
463
  'slim_p4_02' => array(
@@ -467,10 +484,10 @@ class wp_slimstat_reports {
467
  'type' => 'recent',
468
  'columns' => 'resource',
469
  'where' => 'content_type = "post"',
470
- 'raw' => array( __CLASS__, 'get_raw_results' )
471
  ),
472
  'classes' => array( 'normal' ),
473
- 'screens' => array( 'wp-slim-view-4', 'raw' )
474
  ),
475
  'slim_p4_03' => array(
476
  'title' => __( 'Recent Bounce Pages', 'wp-slimstat' ),
@@ -480,10 +497,10 @@ class wp_slimstat_reports {
480
  'columns' => 'resource',
481
  'where' => 'content_type <> "404"',
482
  'having' => 'HAVING COUNT(visit_id) => 1',
483
- 'raw' => array( __CLASS__, 'get_raw_results' )
484
  ),
485
  'classes' => array( 'normal', 'hidden' ),
486
- 'screens' => array( 'wp-slim-view-4', 'raw' ),
487
  'tooltip' => __( 'A <em>bounce page</em> is a single-page visit, or visit in which the person left your site from the entrance (landing) page.', 'wp-slimstat' )
488
  ),
489
  'slim_p4_04' => array(
@@ -493,10 +510,10 @@ class wp_slimstat_reports {
493
  'type' => 'recent',
494
  'columns' => 'resource',
495
  'where' => '(resource LIKE "%/feed%" OR resource LIKE "%?feed=>%" OR resource LIKE "%&feed=>%" OR content_type LIKE "%feed%")',
496
- 'raw' => array( __CLASS__, 'get_raw_results' )
497
  ),
498
  'classes' => array( 'normal', 'hidden' ),
499
- 'screens' => array( 'wp-slim-view-4', 'raw' )
500
  ),
501
  'slim_p4_05' => array(
502
  'title' => __( 'Recent Pages Not Found', 'wp-slimstat' ),
@@ -505,10 +522,10 @@ class wp_slimstat_reports {
505
  'type' => 'recent',
506
  'columns' => 'resource',
507
  'where' => '(resource LIKE "[404]%" OR content_type LIKE "%404%")',
508
- 'raw' => array( __CLASS__, 'get_raw_results' )
509
  ),
510
  'classes' => array( 'normal' ),
511
- 'screens' => array( 'wp-slim-view-4', 'raw' )
512
  ),
513
  'slim_p4_06' => array(
514
  'title' => __( 'Recent Internal Searches', 'wp-slimstat' ),
@@ -517,10 +534,10 @@ class wp_slimstat_reports {
517
  'type' => 'recent',
518
  'columns' => 'searchterms',
519
  'where' => 'content_type LIKE "%search%"',
520
- 'raw' => array( __CLASS__, 'get_raw_results' )
521
  ),
522
  'classes' => array( 'normal', 'hidden' ),
523
- 'screens' => array( 'wp-slim-view-4', 'raw' ),
524
  'tooltip' => __( "Searches performed using WordPress' built-in search functionality.", 'wp-slimstat' )
525
  ),
526
  'slim_p4_07' => array(
@@ -530,9 +547,9 @@ class wp_slimstat_reports {
530
  'type' => 'top',
531
  'columns' => 'category',
532
  'where' => 'content_type LIKE "%category%"',
533
- 'raw' => array( __CLASS__, 'get_raw_results' )
534
  ),
535
- 'classes' => array( 'normal', 'raw' ),
536
  'screens' => array( 'wp-slim-view-4', 'dashboard' )
537
  ),
538
 
@@ -543,26 +560,24 @@ class wp_slimstat_reports {
543
  'type' => 'top',
544
  'columns' => 'resource',
545
  'where' => 'content_type = "download"',
546
- 'raw' => array( __CLASS__, 'get_raw_results' )
547
  ),
548
  'classes' => array( 'wide', 'hidden' ),
549
- 'screens' => array( 'wp-slim-view-4', 'raw' ),
550
  'tooltip' => __( 'You can configure Slimstat to track specific file extensions as downloads.', 'wp-slimstat' )
551
  ),
552
- /*
553
- NOTE TO SELF: don't forget to remove from deprecated, when implemented
554
  'slim_p4_10' => array(
555
  'title' => __( 'Recent Events', 'wp-slimstat' ),
556
- 'callback' => array( __CLASS__, 'raw_results_to_html' ),
557
  'callback_args' => array(
558
-
559
- 'raw' => array( __CLASS__, 'get_raw_results' )
 
560
  ),
561
  'classes' => array( 'normal', 'hidden' ),
562
- 'screens' => array( 'wp-slim-view-4', 'raw' ),
563
  'tooltip' => __( 'This report lists any <em>event</em> occurred on your website. Please refer to the FAQ for more information on how to use this functionality.', 'wp-slimstat' )
564
  ),
565
- */
566
  'slim_p4_11' => array(
567
  'title' => __( 'Top Posts', 'wp-slimstat' ),
568
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
@@ -570,10 +585,22 @@ class wp_slimstat_reports {
570
  'type' => 'top',
571
  'columns' => 'resource',
572
  'where' => 'content_type = "post"',
573
- 'raw' => array( __CLASS__, 'get_raw_results' )
574
  ),
575
  'classes' => array( 'normal' ),
576
- 'screens' => array( 'wp-slim-view-4', 'raw' )
 
 
 
 
 
 
 
 
 
 
 
 
577
  ),
578
  'slim_p4_13' => array(
579
  'title' => __( 'Top Internal Searches', 'wp-slimstat' ),
@@ -582,10 +609,10 @@ class wp_slimstat_reports {
582
  'type' => 'top',
583
  'columns' => 'searchterms',
584
  'where' => 'content_type LIKE "%search%"',
585
- 'raw' => array( __CLASS__, 'get_raw_results' )
586
  ),
587
  'classes' => array( 'normal', 'hidden' ),
588
- 'screens' => array( 'wp-slim-view-4', 'raw' )
589
  ),
590
  'slim_p4_15' => array(
591
  'title' => __( 'Recent Categories', 'wp-slimstat' ),
@@ -594,10 +621,10 @@ class wp_slimstat_reports {
594
  'type' => 'recent',
595
  'columns' => 'resource',
596
  'where' => '(content_type => "category" OR content_type => "tag")',
597
- 'raw' => array( __CLASS__, 'get_raw_results' )
598
  ),
599
  'classes' => array( 'normal', 'hidden' ),
600
- 'screens' => array( 'wp-slim-view-4', 'raw' )
601
  ),
602
  'slim_p4_16' => array(
603
  'title' => __( 'Top Pages Not Found', 'wp-slimstat' ),
@@ -606,10 +633,10 @@ class wp_slimstat_reports {
606
  'type' => 'top',
607
  'columns' => 'resource',
608
  'where' => 'content_type LIKE "%404%"',
609
- 'raw' => array( __CLASS__, 'get_raw_results' )
610
  ),
611
  'classes' => array( 'normal' ),
612
- 'screens' => array( 'wp-slim-view-4', 'raw' )
613
  ),
614
  'slim_p4_18' => array(
615
  'title' => __( 'Top Authors', 'wp-slimstat' ),
@@ -617,10 +644,10 @@ class wp_slimstat_reports {
617
  'callback_args' => array(
618
  'type' => 'top',
619
  'columns' => 'author',
620
- 'raw' => array( __CLASS__, 'get_raw_results' )
621
  ),
622
  'classes' => array( 'normal' ),
623
- 'screens' => array( 'wp-slim-view-4', 'dashboard', 'raw' )
624
  ),
625
  'slim_p4_19' => array(
626
  'title' => __( 'Top Tags', 'wp-slimstat' ),
@@ -629,10 +656,10 @@ class wp_slimstat_reports {
629
  'type' => 'top',
630
  'columns' => 'category',
631
  'where' => '(content_type LIKE "%tag%")',
632
- 'raw' => array( __CLASS__, 'get_raw_results' )
633
  ),
634
  'classes' => array( 'normal', 'hidden' ),
635
- 'screens' => array( 'wp-slim-view-4', 'raw' )
636
  ),
637
  'slim_p4_20' => array(
638
  'title' => __( 'Recent Downloads', 'wp-slimstat' ),
@@ -641,10 +668,10 @@ class wp_slimstat_reports {
641
  'type' => 'recent',
642
  'columns' => 'resource',
643
  'where' => 'content_type = "download"',
644
- 'raw' => array( __CLASS__, 'get_raw_results' )
645
  ),
646
  'classes' => array( 'wide', 'hidden' ),
647
- 'screens' => array( 'wp-slim-view-4', 'raw' )
648
  ),
649
  'slim_p4_21' => array(
650
  'title' => __( 'Top Outbound Links', 'wp-slimstat' ),
@@ -652,10 +679,10 @@ class wp_slimstat_reports {
652
  'callback_args' => array(
653
  'type' => 'top',
654
  'columns' => 'outbound_resource',
655
- 'raw' => array( __CLASS__, 'get_raw_results' )
656
  ),
657
  'classes' => array( 'normal', 'hidden' ),
658
- 'screens' => array( 'wp-slim-view-4', 'raw' )
659
  ),
660
  'slim_p4_22' => array(
661
  'title' => __( 'Your Website', 'wp-slimstat' ),
@@ -672,36 +699,36 @@ class wp_slimstat_reports {
672
  'columns' => 'resource',
673
  'where' => 'content_type <> "404"',
674
  'having' => 'HAVING COUNT(visit_id) => 1',
675
- 'raw' => array( __CLASS__, 'get_raw_results' )
676
  ),
677
  'classes' => array( 'normal', 'hidden' ),
678
- 'screens' => array( 'wp-slim-view-4', 'raw' )
679
  ),
680
  'slim_p4_24' => array(
681
  'title' => __( 'Top Exit Pages', 'wp-slimstat' ),
682
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
683
  'callback_args' => array(
684
- 'type' => 'top_aggr',
685
  'columns' => 'visit_id',
686
  'outer_select_column' => 'resource',
687
  'aggr_function' => 'MAX',
688
- 'raw' => array( __CLASS__, 'get_raw_results' )
689
  ),
690
  'classes' => array( 'normal', 'hidden' ),
691
- 'screens' => array( 'wp-slim-view-4', 'raw' )
692
  ),
693
  'slim_p4_25' => array(
694
  'title' => __( 'Top Entry Pages', 'wp-slimstat' ),
695
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
696
  'callback_args' => array(
697
- 'type' => 'top_aggr',
698
  'columns' => 'visit_id',
699
  'outer_select_column' => 'resource',
700
  'aggr_function' => 'MIN',
701
- 'raw' => array( __CLASS__, 'get_raw_results' )
702
  ),
703
  'classes' => array( 'normal', 'hidden' ),
704
- 'screens' => array( 'wp-slim-view-4', 'raw' )
705
  ),
706
 
707
  'slim_p6_01' => array(
@@ -728,8 +755,6 @@ class wp_slimstat_reports {
728
  'slim_p3_09',
729
  'slim_p3_10',
730
  'slim_p4_08',
731
- 'slim_p4_10',
732
- 'slim_p4_12',
733
  'slim_p4_14',
734
  'slim_p4_17'
735
  );
@@ -790,30 +815,34 @@ class wp_slimstat_reports {
790
  echo '</div></div>';
791
  }
792
 
793
- public static function report_pagination( $_count_page_results = 0, $_count_all_results = 0, $_show_refresh_countdown = false ) {
794
- $endpoint = min($_count_all_results, wp_slimstat_db::$filters_normalized['misc']['start_from'] + wp_slimstat_db::$filters_normalized['misc']['limit_results']);
 
 
795
  $pagination_buttons = '';
796
  $direction_prev = is_rtl()?'right':'left';
797
  $direction_next = is_rtl()?'left':'right';
798
 
799
- if ($endpoint + wp_slimstat_db::$filters_normalized['misc']['limit_results'] < $_count_all_results && $_count_page_results > 0){
800
- $startpoint = $_count_all_results - $_count_all_results%wp_slimstat_db::$filters_normalized['misc']['limit_results'];
801
- if ($startpoint == $_count_all_results) $startpoint -= wp_slimstat_db::$filters_normalized['misc']['limit_results'];
 
 
802
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-double-'.$direction_next.'" href="'.wp_slimstat_reports::fs_url('start_from equals '.$startpoint).'"></a> ';
803
  }
804
  if ($endpoint < $_count_all_results && $_count_page_results > 0){
805
- $startpoint = wp_slimstat_db::$filters_normalized['misc']['start_from'] + wp_slimstat_db::$filters_normalized['misc']['limit_results'];
806
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-'.$direction_next.'" href="'.wp_slimstat_reports::fs_url('start_from equals '.$startpoint).'"></a> ';
807
  }
808
  if (wp_slimstat_db::$filters_normalized['misc']['start_from'] > 0){
809
- $startpoint = (wp_slimstat_db::$filters_normalized['misc']['start_from'] > wp_slimstat_db::$filters_normalized['misc']['limit_results'])?wp_slimstat_db::$filters_normalized['misc']['start_from']-wp_slimstat_db::$filters_normalized['misc']['limit_results']:0;
810
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-'.$direction_prev.'" href="'.wp_slimstat_reports::fs_url('start_from equals '.$startpoint).'"></a> ';
811
  }
812
- if (wp_slimstat_db::$filters_normalized['misc']['start_from'] - wp_slimstat_db::$filters_normalized['misc']['limit_results'] > 0){
813
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-double-'.$direction_prev.'" href="'.wp_slimstat_reports::fs_url('start_from equals 0').'"></a> ';
814
  }
815
 
816
- $pagination = '<p class="pagination">'.sprintf(__('Results %s - %s of %s', 'wp-slimstat'), number_format(wp_slimstat_db::$filters_normalized['misc']['start_from']+1, 0, '', wp_slimstat_db::$formats['thousand']), number_format($endpoint, 0, '', wp_slimstat_db::$formats['thousand']), number_format($_count_all_results, 0, '', wp_slimstat_db::$formats['thousand']).(($_count_all_results == 1000)?'+':''));
817
  if ($_show_refresh_countdown && wp_slimstat::$options['refresh_interval'] > 0 && !wp_slimstat_db::$filters_normalized['date']['is_past']){
818
  $pagination .= ' &ndash; '.__('Refresh in','wp-slimstat').' <i class="refresh-timer"></i>';
819
  }
@@ -822,13 +851,8 @@ class wp_slimstat_reports {
822
  echo $pagination;
823
  }
824
 
 
825
  public static function get_raw_results( $_args = array() ) {
826
- // Get ALL the results
827
- $temp_starting = wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ];
828
- $temp_limit_results = wp_slimstat_db::$filters_normalized[ 'misc' ][ 'limit_results' ];
829
- wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ] = 0;
830
- wp_slimstat_db::$filters_normalized[ 'misc' ][ 'limit_results' ] = 1000;
831
-
832
  if ( empty( $_args[ 'type' ] ) ) {
833
  return array();
834
  }
@@ -864,10 +888,6 @@ class wp_slimstat_reports {
864
  break;
865
  }
866
 
867
- // Restore the original filters
868
- wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ] = $temp_starting;
869
- wp_slimstat_db::$filters_normalized[ 'misc' ][ 'limit_results' ] = $temp_limit_results;
870
-
871
  return $all_results;
872
  }
873
 
@@ -877,13 +897,14 @@ class wp_slimstat_reports {
877
  call_user_func( $_args[ 'callback' ] , $_args[ 'callback_args' ] );
878
  }
879
 
880
- public static function raw_results_to_html( $_args = array() ){
 
881
  $all_results = call_user_func( $_args[ 'raw' ] , $_args );
882
 
883
  $results = array_slice(
884
  $all_results,
885
  wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ],
886
- wp_slimstat_db::$filters_normalized[ 'misc' ][ 'limit_results' ]
887
  );
888
 
889
  // Count the results
@@ -933,6 +954,11 @@ class wp_slimstat_reports {
933
  $element_value = $results[$i]['browser'].((isset($results[$i]['browser_version']) && intval($results[$i]['browser_version']) != 0)?' '.$results[$i]['browser_version']:'');
934
  break;
935
 
 
 
 
 
 
936
  case 'country':
937
  $row_details .= '<br>'.__('Country Code','wp-slimstat').": {$results[$i]['country']}";
938
  $element_value = __('c-'.$results[$i]['country'], 'wp-slimstat');
@@ -959,11 +985,6 @@ class wp_slimstat_reports {
959
  $element_value = __( $results[ $i ][ $_args[ 'columns' ] ], 'wp-slimstat');
960
  break;
961
 
962
- case 'category':
963
- $row_details = '<br>'.__( 'Category ID', 'wp-slimstat' ) . ": {$results[ $i ][ $_args[ 'columns' ] ]}";
964
- $element_value = get_cat_name( $results[ $i ][ $_args[ 'columns' ] ] );
965
- break;
966
-
967
  case 'resource':
968
  case 'resource_substring':
969
  $resource_title = self::get_resource_title( $results[ $i ][ $_args[ 'columns' ] ] );
@@ -973,10 +994,13 @@ class wp_slimstat_reports {
973
  $element_value = $resource_title;
974
  break;
975
 
 
 
 
 
976
  case 'searchterms':
977
  if ($_args[ 'type' ] == 'recent'){
978
- $domain = parse_url( $results[$i]['domain'] );
979
- $domain = !empty( $domain['host'] ) ? $domain['host'] : '';
980
 
981
  $row_details = '<br>'.__('Referrer','wp-slimstat').": $domain";
982
  $element_value = self::get_search_terms_info($results[$i]['searchterms'], $results[$i]['referer'], true);
@@ -1000,10 +1024,11 @@ class wp_slimstat_reports {
1000
 
1001
  $element_value = "<a class='slimstat-filter-link' href='".self::fs_url( $_args[ 'columns' ].' '.$_args['filter_op'].' '.$results[$i][ $_args[ 'columns' ] ] )."'>$element_value</a>";
1002
 
1003
- if ( $_args[ 'type' ] == 'recent' ) {
1004
  $row_details = date_i18n(wp_slimstat::$options['date_format'].' '.wp_slimstat::$options['time_format'], $results[$i]['dt'], true).$row_details;
1005
  }
1006
- else{
 
1007
  $percentage = ' <span>'.((self::$pageviews > 0)?number_format(sprintf("%01.2f", (100*$results[$i]['counthits']/self::$pageviews)), 2, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']):0).'%</span>';
1008
  $row_details = __('Hits','wp-slimstat').': '.number_format($results[$i]['counthits'], 0, '', wp_slimstat_db::$formats['thousand']).$row_details;
1009
  }
@@ -1322,7 +1347,7 @@ class wp_slimstat_reports {
1322
  <p><?php self::inline_help(__('A referrer (or referring site) is the site that a visitor previously visited before following a link to your site.','wp-slimstat')) ?>
1323
  <?php _e('Unique Referrers', 'wp-slimstat') ?> <span><?php echo number_format(wp_slimstat_db::count_records('referer', "referer NOT LIKE '%{$_SERVER['SERVER_NAME']}%'"), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
1324
  <p><?php self::inline_help(__("Visitors who visited the site by typing the URL directly into their browser. <em>Direct</em> can also refer to the visitors who clicked on the links from their bookmarks/favorites, untagged links within emails, or links from documents that don't include tracking variables.",'wp-slimstat')) ?>
1325
- <?php _e('Direct Pageviews', 'wp-slimstat') ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', 'resource IS NULL'), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
1326
  <p><?php self::inline_help(__("Visitors who came to your site via searches on Google or some other search engine.",'wp-slimstat')) ?>
1327
  <?php _e('From a search result', 'wp-slimstat') ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', "searchterms IS NOT NULL AND referer IS NOT NULL AND referer NOT LIKE '%".home_url()."%'"), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
1328
  <p><?php self::inline_help(__("The first page that a user views during a session. This is also known as the <em>entrance page</em>. For example, if they search for 'Brooklyn Office Space,' and they land on your home page, it gets counted (for that visit) as a landing page.",'wp-slimstat')) ?>
@@ -1338,7 +1363,52 @@ class wp_slimstat_reports {
1338
  die();
1339
  }
1340
  }
1341
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1342
  public static function show_rankings(){
1343
  $options = array('timeout' => 1, 'headers' => array('Accept' => 'application/json'));
1344
  $site_url_array = parse_url(home_url());
@@ -1424,8 +1494,78 @@ class wp_slimstat_reports {
1424
  }
1425
  }
1426
 
1427
- public static function show_world_map(){
1428
- wp_slimstat_db::$filters_normalized['misc']['limit_results'] = 9999;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1429
  $countries = wp_slimstat_db::get_top('country');
1430
  $data_areas = array('xx'=>'{id:"XX",balloonText:"'.__('c-xx','wp-slimstat').': 0",value:0,color:"#ededed"}','af'=>'{id:"AF",balloonText:"'.__('c-af','wp-slimstat').': 0",value:0,color:"#ededed"}','ax'=>'{id:"AX",balloonText:"'.__('c-ax','wp-slimstat').': 0",value:0,color:"#ededed"}','al'=>'{id:"AL",balloonText:"'.__('c-al','wp-slimstat').': 0",value:0,color:"#ededed"}','dz'=>'{id:"DZ",balloonText:"'.__('c-dz','wp-slimstat').': 0",value:0,color:"#ededed"}','ad'=>'{id:"AD",balloonText:"'.__('c-ad','wp-slimstat').': 0",value:0,color:"#ededed"}','ao'=>'{id:"AO",balloonText:"'.__('c-ao','wp-slimstat').': 0",value:0,color:"#ededed"}','ai'=>'{id:"AI",balloonText:"'.__('c-ai','wp-slimstat').': 0",value:0,color:"#ededed"}','ag'=>'{id:"AG",balloonText:"'.__('c-ag','wp-slimstat').': 0",value:0,color:"#ededed"}','ar'=>'{id:"AR",balloonText:"'.__('c-ar','wp-slimstat').': 0",value:0,color:"#ededed"}','am'=>'{id:"AM",balloonText:"'.__('c-am','wp-slimstat').': 0",value:0,color:"#ededed"}','aw'=>'{id:"AW",balloonText:"'.__('c-aw','wp-slimstat').': 0",value:0,color:"#ededed"}','au'=>'{id:"AU",balloonText:"'.__('c-au','wp-slimstat').': 0",value:0,color:"#ededed"}','at'=>'{id:"AT",balloonText:"'.__('c-at','wp-slimstat').': 0",value:0,color:"#ededed"}','az'=>'{id:"AZ",balloonText:"'.__('c-az','wp-slimstat').': 0",value:0,color:"#ededed"}','bs'=>'{id:"BS",balloonText:"'.__('c-bs','wp-slimstat').': 0",value:0,color:"#ededed"}','bh'=>'{id:"BH",balloonText:"'.__('c-bh','wp-slimstat').': 0",value:0,color:"#ededed"}','bd'=>'{id:"BD",balloonText:"'.__('c-bd','wp-slimstat').': 0",value:0,color:"#ededed"}','bb'=>'{id:"BB",balloonText:"'.__('c-bb','wp-slimstat').': 0",value:0,color:"#ededed"}','by'=>'{id:"BY",balloonText:"'.__('c-by','wp-slimstat').': 0",value:0,color:"#ededed"}','be'=>'{id:"BE",balloonText:"'.__('c-be','wp-slimstat').': 0",value:0,color:"#ededed"}','bz'=>'{id:"BZ",balloonText:"'.__('c-bz','wp-slimstat').': 0",value:0,color:"#ededed"}','bj'=>'{id:"BJ",balloonText:"'.__('c-bj','wp-slimstat').': 0",value:0,color:"#ededed"}','bm'=>'{id:"BM",balloonText:"'.__('c-bm','wp-slimstat').': 0",value:0,color:"#ededed"}','bt'=>'{id:"BT",balloonText:"'.__('c-bt','wp-slimstat').': 0",value:0,color:"#ededed"}','bo'=>'{id:"BO",balloonText:"'.__('c-bo','wp-slimstat').': 0",value:0,color:"#ededed"}','ba'=>'{id:"BA",balloonText:"'.__('c-ba','wp-slimstat').': 0",value:0,color:"#ededed"}','bw'=>'{id:"BW",balloonText:"'.__('c-bw','wp-slimstat').': 0",value:0,color:"#ededed"}','br'=>'{id:"BR",balloonText:"'.__('c-br','wp-slimstat').': 0",value:0,color:"#ededed"}','bn'=>'{id:"BN",balloonText:"'.__('c-bn','wp-slimstat').': 0",value:0,color:"#ededed"}','bg'=>'{id:"BG",balloonText:"'.__('c-bg','wp-slimstat').': 0",value:0,color:"#ededed"}','bf'=>'{id:"BF",balloonText:"'.__('c-bf','wp-slimstat').': 0",value:0,color:"#ededed"}','bi'=>'{id:"BI",balloonText:"'.__('c-bi','wp-slimstat').': 0",value:0,color:"#ededed"}','kh'=>'{id:"KH",balloonText:"'.__('c-kh','wp-slimstat').': 0",value:0,color:"#ededed"}','cm'=>'{id:"CM",balloonText:"'.__('c-cm','wp-slimstat').': 0",value:0,color:"#ededed"}','ca'=>'{id:"CA",balloonText:"'.__('c-ca','wp-slimstat').': 0",value:0,color:"#ededed"}','cv'=>'{id:"CV",balloonText:"'.__('c-cv','wp-slimstat').': 0",value:0,color:"#ededed"}','ky'=>'{id:"KY",balloonText:"'.__('c-ky','wp-slimstat').': 0",value:0,color:"#ededed"}','cf'=>'{id:"CF",balloonText:"'.__('c-cf','wp-slimstat').': 0",value:0,color:"#ededed"}','td'=>'{id:"TD",balloonText:"'.__('c-td','wp-slimstat').': 0",value:0,color:"#ededed"}','cl'=>'{id:"CL",balloonText:"'.__('c-cl','wp-slimstat').': 0",value:0,color:"#ededed"}','cn'=>'{id:"CN",balloonText:"'.__('c-cn','wp-slimstat').': 0",value:0,color:"#ededed"}','co'=>'{id:"CO",balloonText:"'.__('c-co','wp-slimstat').': 0",value:0,color:"#ededed"}','km'=>'{id:"KM",balloonText:"'.__('c-km','wp-slimstat').': 0",value:0,color:"#ededed"}','cg'=>'{id:"CG",balloonText:"'.__('c-cg','wp-slimstat').': 0",value:0,color:"#ededed"}','cd'=>'{id:"CD",balloonText:"'.__('c-cd','wp-slimstat').': 0",value:0,color:"#ededed"}','cr'=>'{id:"CR",balloonText:"'.__('c-cr','wp-slimstat').': 0",value:0,color:"#ededed"}','ci'=>'{id:"CI",balloonText:"'.__('c-ci','wp-slimstat').': 0",value:0,color:"#ededed"}','hr'=>'{id:"HR",balloonText:"'.__('c-hr','wp-slimstat').': 0",value:0,color:"#ededed"}','cu'=>'{id:"CU",balloonText:"'.__('c-cu','wp-slimstat').': 0",value:0,color:"#ededed"}','cy'=>'{id:"CY",balloonText:"'.__('c-cy','wp-slimstat').': 0",value:0,color:"#ededed"}','cz'=>'{id:"CZ",balloonText:"'.__('c-cz','wp-slimstat').': 0",value:0,color:"#ededed"}','dk'=>'{id:"DK",balloonText:"'.__('c-dk','wp-slimstat').': 0",value:0,color:"#ededed"}','dj'=>'{id:"DJ",balloonText:"'.__('c-dj','wp-slimstat').': 0",value:0,color:"#ededed"}','dm'=>'{id:"DM",balloonText:"'.__('c-dm','wp-slimstat').': 0",value:0,color:"#ededed"}','do'=>'{id:"DO",balloonText:"'.__('c-do','wp-slimstat').': 0",value:0,color:"#ededed"}','ec'=>'{id:"EC",balloonText:"'.__('c-ec','wp-slimstat').': 0",value:0,color:"#ededed"}','eg'=>'{id:"EG",balloonText:"'.__('c-eg','wp-slimstat').': 0",value:0,color:"#ededed"}','sv'=>'{id:"SV",balloonText:"'.__('c-sv','wp-slimstat').': 0",value:0,color:"#ededed"}','gq'=>'{id:"GQ",balloonText:"'.__('c-gq','wp-slimstat').': 0",value:0,color:"#ededed"}','er'=>'{id:"ER",balloonText:"'.__('c-er','wp-slimstat').': 0",value:0,color:"#ededed"}','ee'=>'{id:"EE",balloonText:"'.__('c-ee','wp-slimstat').': 0",value:0,color:"#ededed"}','et'=>'{id:"ET",balloonText:"'.__('c-et','wp-slimstat').': 0",value:0,color:"#ededed"}','fo'=>'{id:"FO",balloonText:"'.__('c-fo','wp-slimstat').': 0",value:0,color:"#ededed"}','fk'=>'{id:"FK",balloonText:"'.__('c-fk','wp-slimstat').': 0",value:0,color:"#ededed"}','fj'=>'{id:"FJ",balloonText:"'.__('c-fj','wp-slimstat').': 0",value:0,color:"#ededed"}','fi'=>'{id:"FI",balloonText:"'.__('c-fi','wp-slimstat').': 0",value:0,color:"#ededed"}','fr'=>'{id:"FR",balloonText:"'.__('c-fr','wp-slimstat').': 0",value:0,color:"#ededed"}','gf'=>'{id:"GF",balloonText:"'.__('c-gf','wp-slimstat').': 0",value:0,color:"#ededed"}','ga'=>'{id:"GA",balloonText:"'.__('c-ga','wp-slimstat').': 0",value:0,color:"#ededed"}','gm'=>'{id:"GM",balloonText:"'.__('c-gm','wp-slimstat').': 0",value:0,color:"#ededed"}','ge'=>'{id:"GE",balloonText:"'.__('c-ge','wp-slimstat').': 0",value:0,color:"#ededed"}','de'=>'{id:"DE",balloonText:"'.__('c-de','wp-slimstat').': 0",value:0,color:"#ededed"}','gh'=>'{id:"GH",balloonText:"'.__('c-gh','wp-slimstat').': 0",value:0,color:"#ededed"}','gr'=>'{id:"GR",balloonText:"'.__('c-gr','wp-slimstat').': 0",value:0,color:"#ededed"}','gl'=>'{id:"GL",balloonText:"'.__('c-gl','wp-slimstat').': 0",value:0,color:"#ededed"}','gd'=>'{id:"GD",balloonText:"'.__('c-gd','wp-slimstat').': 0",value:0,color:"#ededed"}','gp'=>'{id:"GP",balloonText:"'.__('c-gp','wp-slimstat').': 0",value:0,color:"#ededed"}','gt'=>'{id:"GT",balloonText:"'.__('c-gt','wp-slimstat').': 0",value:0,color:"#ededed"}','gn'=>'{id:"GN",balloonText:"'.__('c-gn','wp-slimstat').': 0",value:0,color:"#ededed"}','gw'=>'{id:"GW",balloonText:"'.__('c-gw','wp-slimstat').': 0",value:0,color:"#ededed"}','gy'=>'{id:"GY",balloonText:"'.__('c-gy','wp-slimstat').': 0",value:0,color:"#ededed"}','ht'=>'{id:"HT",balloonText:"'.__('c-ht','wp-slimstat').': 0",value:0,color:"#ededed"}','hn'=>'{id:"HN",balloonText:"'.__('c-hn','wp-slimstat').': 0",value:0,color:"#ededed"}','hk'=>'{id:"HK",balloonText:"'.__('c-hk','wp-slimstat').': 0",value:0,color:"#ededed"}','hu'=>'{id:"HU",balloonText:"'.__('c-hu','wp-slimstat').': 0",value:0,color:"#ededed"}','is'=>'{id:"IS",balloonText:"'.__('c-is','wp-slimstat').': 0",value:0,color:"#ededed"}','in'=>'{id:"IN",balloonText:"'.__('c-in','wp-slimstat').': 0",value:0,color:"#ededed"}','id'=>'{id:"ID",balloonText:"'.__('c-id','wp-slimstat').': 0",value:0,color:"#ededed"}','ir'=>'{id:"IR",balloonText:"'.__('c-ir','wp-slimstat').': 0",value:0,color:"#ededed"}','iq'=>'{id:"IQ",balloonText:"'.__('c-iq','wp-slimstat').': 0",value:0,color:"#ededed"}','ie'=>'{id:"IE",balloonText:"'.__('c-ie','wp-slimstat').': 0",value:0,color:"#ededed"}','il'=>'{id:"IL",balloonText:"'.__('c-il','wp-slimstat').': 0",value:0,color:"#ededed"}','it'=>'{id:"IT",balloonText:"'.__('c-it','wp-slimstat').': 0",value:0,color:"#ededed"}','jm'=>'{id:"JM",balloonText:"'.__('c-jm','wp-slimstat').': 0",value:0,color:"#ededed"}','jp'=>'{id:"JP",balloonText:"'.__('c-jp','wp-slimstat').': 0",value:0,color:"#ededed"}','jo'=>'{id:"JO",balloonText:"'.__('c-jo','wp-slimstat').': 0",value:0,color:"#ededed"}','kz'=>'{id:"KZ",balloonText:"'.__('c-kz','wp-slimstat').': 0",value:0,color:"#ededed"}','ke'=>'{id:"KE",balloonText:"'.__('c-ke','wp-slimstat').': 0",value:0,color:"#ededed"}','nr'=>'{id:"NR",balloonText:"'.__('c-nr','wp-slimstat').': 0",value:0,color:"#ededed"}','kp'=>'{id:"KP",balloonText:"'.__('c-kp','wp-slimstat').': 0",value:0,color:"#ededed"}','kr'=>'{id:"KR",balloonText:"'.__('c-kr','wp-slimstat').': 0",value:0,color:"#ededed"}','kv'=>'{id:"KV",balloonText:"'.__('c-kv','wp-slimstat').': 0",value:0,color:"#ededed"}','kw'=>'{id:"KW",balloonText:"'.__('c-kw','wp-slimstat').': 0",value:0,color:"#ededed"}','kg'=>'{id:"KG",balloonText:"'.__('c-kg','wp-slimstat').': 0",value:0,color:"#ededed"}','la'=>'{id:"LA",balloonText:"'.__('c-la','wp-slimstat').': 0",value:0,color:"#ededed"}','lv'=>'{id:"LV",balloonText:"'.__('c-lv','wp-slimstat').': 0",value:0,color:"#ededed"}','lb'=>'{id:"LB",balloonText:"'.__('c-lb','wp-slimstat').': 0",value:0,color:"#ededed"}','ls'=>'{id:"LS",balloonText:"'.__('c-ls','wp-slimstat').': 0",value:0,color:"#ededed"}','lr'=>'{id:"LR",balloonText:"'.__('c-lr','wp-slimstat').': 0",value:0,color:"#ededed"}','ly'=>'{id:"LY",balloonText:"'.__('c-ly','wp-slimstat').': 0",value:0,color:"#ededed"}','li'=>'{id:"LI",balloonText:"'.__('c-li','wp-slimstat').': 0",value:0,color:"#ededed"}','lt'=>'{id:"LT",balloonText:"'.__('c-lt','wp-slimstat').': 0",value:0,color:"#ededed"}','lu'=>'{id:"LU",balloonText:"'.__('c-lu','wp-slimstat').': 0",value:0,color:"#ededed"}','mk'=>'{id:"MK",balloonText:"'.__('c-mk','wp-slimstat').': 0",value:0,color:"#ededed"}','mg'=>'{id:"MG",balloonText:"'.__('c-mg','wp-slimstat').': 0",value:0,color:"#ededed"}','mw'=>'{id:"MW",balloonText:"'.__('c-mw','wp-slimstat').': 0",value:0,color:"#ededed"}','my'=>'{id:"MY",balloonText:"'.__('c-my','wp-slimstat').': 0",value:0,color:"#ededed"}','ml'=>'{id:"ML",balloonText:"'.__('c-ml','wp-slimstat').': 0",value:0,color:"#ededed"}','mt'=>'{id:"MT",balloonText:"'.__('c-mt','wp-slimstat').': 0",value:0,color:"#ededed"}','mq'=>'{id:"MQ",balloonText:"'.__('c-mq','wp-slimstat').': 0",value:0,color:"#ededed"}','mr'=>'{id:"MR",balloonText:"'.__('c-mr','wp-slimstat').': 0",value:0,color:"#ededed"}','mu'=>'{id:"MU",balloonText:"'.__('c-mu','wp-slimstat').': 0",value:0,color:"#ededed"}','mx'=>'{id:"MX",balloonText:"'.__('c-mx','wp-slimstat').': 0",value:0,color:"#ededed"}','md'=>'{id:"MD",balloonText:"'.__('c-md','wp-slimstat').': 0",value:0,color:"#ededed"}','mn'=>'{id:"MN",balloonText:"'.__('c-mn','wp-slimstat').': 0",value:0,color:"#ededed"}','me'=>'{id:"ME",balloonText:"'.__('c-me','wp-slimstat').': 0",value:0,color:"#ededed"}','ms'=>'{id:"MS",balloonText:"'.__('c-ms','wp-slimstat').': 0",value:0,color:"#ededed"}','ma'=>'{id:"MA",balloonText:"'.__('c-ma','wp-slimstat').': 0",value:0,color:"#ededed"}','mz'=>'{id:"MZ",balloonText:"'.__('c-mz','wp-slimstat').': 0",value:0,color:"#ededed"}','mm'=>'{id:"MM",balloonText:"'.__('c-mm','wp-slimstat').': 0",value:0,color:"#ededed"}','na'=>'{id:"NA",balloonText:"'.__('c-na','wp-slimstat').': 0",value:0,color:"#ededed"}','np'=>'{id:"NP",balloonText:"'.__('c-np','wp-slimstat').': 0",value:0,color:"#ededed"}','nl'=>'{id:"NL",balloonText:"'.__('c-nl','wp-slimstat').': 0",value:0,color:"#ededed"}','nc'=>'{id:"NC",balloonText:"'.__('c-nc','wp-slimstat').': 0",value:0,color:"#ededed"}','nz'=>'{id:"NZ",balloonText:"'.__('c-nz','wp-slimstat').': 0",value:0,color:"#ededed"}','ni'=>'{id:"NI",balloonText:"'.__('c-ni','wp-slimstat').': 0",value:0,color:"#ededed"}','ne'=>'{id:"NE",balloonText:"'.__('c-ne','wp-slimstat').': 0",value:0,color:"#ededed"}','ng'=>'{id:"NG",balloonText:"'.__('c-ng','wp-slimstat').': 0",value:0,color:"#ededed"}','no'=>'{id:"NO",balloonText:"'.__('c-no','wp-slimstat').': 0",value:0,color:"#ededed"}','om'=>'{id:"OM",balloonText:"'.__('c-om','wp-slimstat').': 0",value:0,color:"#ededed"}','pk'=>'{id:"PK",balloonText:"'.__('c-pk','wp-slimstat').': 0",value:0,color:"#ededed"}','pw'=>'{id:"PW",balloonText:"'.__('c-pw','wp-slimstat').': 0",value:0,color:"#ededed"}','ps'=>'{id:"PS",balloonText:"'.__('c-ps','wp-slimstat').': 0",value:0,color:"#ededed"}','pa'=>'{id:"PA",balloonText:"'.__('c-pa','wp-slimstat').': 0",value:0,color:"#ededed"}','pg'=>'{id:"PG",balloonText:"'.__('c-pg','wp-slimstat').': 0",value:0,color:"#ededed"}','py'=>'{id:"PY",balloonText:"'.__('c-py','wp-slimstat').': 0",value:0,color:"#ededed"}','pe'=>'{id:"PE",balloonText:"'.__('c-pe','wp-slimstat').': 0",value:0,color:"#ededed"}','ph'=>'{id:"PH",balloonText:"'.__('c-ph','wp-slimstat').': 0",value:0,color:"#ededed"}','pl'=>'{id:"PL",balloonText:"'.__('c-pl','wp-slimstat').': 0",value:0,color:"#ededed"}','pt'=>'{id:"PT",balloonText:"'.__('c-pt','wp-slimstat').': 0",value:0,color:"#ededed"}','pr'=>'{id:"PR",balloonText:"'.__('c-pr','wp-slimstat').': 0",value:0,color:"#ededed"}','qa'=>'{id:"QA",balloonText:"'.__('c-qa','wp-slimstat').': 0",value:0,color:"#ededed"}','re'=>'{id:"RE",balloonText:"'.__('c-re','wp-slimstat').': 0",value:0,color:"#ededed"}','ro'=>'{id:"RO",balloonText:"'.__('c-ro','wp-slimstat').': 0",value:0,color:"#ededed"}','ru'=>'{id:"RU",balloonText:"'.__('c-ru','wp-slimstat').': 0",value:0,color:"#ededed"}','rw'=>'{id:"RW",balloonText:"'.__('c-rw','wp-slimstat').': 0",value:0,color:"#ededed"}','kn'=>'{id:"KN",balloonText:"'.__('c-kn','wp-slimstat').': 0",value:0,color:"#ededed"}','lc'=>'{id:"LC",balloonText:"'.__('c-lc','wp-slimstat').': 0",value:0,color:"#ededed"}','mf'=>'{id:"MF",balloonText:"'.__('c-mf','wp-slimstat').': 0",value:0,color:"#ededed"}','vc'=>'{id:"VC",balloonText:"'.__('c-vc','wp-slimstat').': 0",value:0,color:"#ededed"}','ws'=>'{id:"WS",balloonText:"'.__('c-ws','wp-slimstat').': 0",value:0,color:"#ededed"}','st'=>'{id:"ST",balloonText:"'.__('c-st','wp-slimstat').': 0",value:0,color:"#ededed"}','sa'=>'{id:"SA",balloonText:"'.__('c-sa','wp-slimstat').': 0",value:0,color:"#ededed"}','sn'=>'{id:"SN",balloonText:"'.__('c-sn','wp-slimstat').': 0",value:0,color:"#ededed"}','rs'=>'{id:"RS",balloonText:"'.__('c-rs','wp-slimstat').': 0",value:0,color:"#ededed"}','sl'=>'{id:"SL",balloonText:"'.__('c-sl','wp-slimstat').': 0",value:0,color:"#ededed"}','sg'=>'{id:"SG",balloonText:"'.__('c-sg','wp-slimstat').': 0",value:0,color:"#ededed"}','sk'=>'{id:"SK",balloonText:"'.__('c-sk','wp-slimstat').': 0",value:0,color:"#ededed"}','si'=>'{id:"SI",balloonText:"'.__('c-si','wp-slimstat').': 0",value:0,color:"#ededed"}','sb'=>'{id:"SB",balloonText:"'.__('c-sb','wp-slimstat').': 0",value:0,color:"#ededed"}','so'=>'{id:"SO",balloonText:"'.__('c-so','wp-slimstat').': 0",value:0,color:"#ededed"}','za'=>'{id:"ZA",balloonText:"'.__('c-za','wp-slimstat').': 0",value:0,color:"#ededed"}','gs'=>'{id:"GS",balloonText:"'.__('c-gs','wp-slimstat').': 0",value:0,color:"#ededed"}','es'=>'{id:"ES",balloonText:"'.__('c-es','wp-slimstat').': 0",value:0,color:"#ededed"}','lk'=>'{id:"LK",balloonText:"'.__('c-lk','wp-slimstat').': 0",value:0,color:"#ededed"}','sc'=>'{id:"SC",balloonText:"'.__('c-sc','wp-slimstat').': 0",value:0,color:"#ededed"}','sd'=>'{id:"SD",balloonText:"'.__('c-sd','wp-slimstat').': 0",value:0,color:"#ededed"}','ss'=>'{id:"SS",balloonText:"'.__('c-ss','wp-slimstat').': 0",value:0,color:"#ededed"}','sr'=>'{id:"SR",balloonText:"'.__('c-sr','wp-slimstat').': 0",value:0,color:"#ededed"}','sj'=>'{id:"SJ",balloonText:"'.__('c-sj','wp-slimstat').': 0",value:0,color:"#ededed"}','sz'=>'{id:"SZ",balloonText:"'.__('c-sz','wp-slimstat').': 0",value:0,color:"#ededed"}','se'=>'{id:"SE",balloonText:"'.__('c-se','wp-slimstat').': 0",value:0,color:"#ededed"}','ch'=>'{id:"CH",balloonText:"'.__('c-ch','wp-slimstat').': 0",value:0,color:"#ededed"}','sy'=>'{id:"SY",balloonText:"'.__('c-sy','wp-slimstat').': 0",value:0,color:"#ededed"}','tw'=>'{id:"TW",balloonText:"'.__('c-tw','wp-slimstat').': 0",value:0,color:"#ededed"}','tj'=>'{id:"TJ",balloonText:"'.__('c-tj','wp-slimstat').': 0",value:0,color:"#ededed"}','tz'=>'{id:"TZ",balloonText:"'.__('c-tz','wp-slimstat').': 0",value:0,color:"#ededed"}','th'=>'{id:"TH",balloonText:"'.__('c-th','wp-slimstat').': 0",value:0,color:"#ededed"}','tl'=>'{id:"TL",balloonText:"'.__('c-tl','wp-slimstat').': 0",value:0,color:"#ededed"}','tg'=>'{id:"TG",balloonText:"'.__('c-tg','wp-slimstat').': 0",value:0,color:"#ededed"}','to'=>'{id:"TO",balloonText:"'.__('c-to','wp-slimstat').': 0",value:0,color:"#ededed"}','tt'=>'{id:"TT",balloonText:"'.__('c-tt','wp-slimstat').': 0",value:0,color:"#ededed"}','tn'=>'{id:"TN",balloonText:"'.__('c-tn','wp-slimstat').': 0",value:0,color:"#ededed"}','tr'=>'{id:"TR",balloonText:"'.__('c-tr','wp-slimstat').': 0",value:0,color:"#ededed"}','tm'=>'{id:"TM",balloonText:"'.__('c-tm','wp-slimstat').': 0",value:0,color:"#ededed"}','tc'=>'{id:"TC",balloonText:"'.__('c-tc','wp-slimstat').': 0",value:0,color:"#ededed"}','ug'=>'{id:"UG",balloonText:"'.__('c-ug','wp-slimstat').': 0",value:0,color:"#ededed"}','ua'=>'{id:"UA",balloonText:"'.__('c-ua','wp-slimstat').': 0",value:0,color:"#ededed"}','ae'=>'{id:"AE",balloonText:"'.__('c-ae','wp-slimstat').': 0",value:0,color:"#ededed"}','gb'=>'{id:"GB",balloonText:"'.__('c-gb','wp-slimstat').': 0",value:0,color:"#ededed"}','us'=>'{id:"US",balloonText:"'.__('c-us','wp-slimstat').': 0",value:0,color:"#ededed"}','uy'=>'{id:"UY",balloonText:"'.__('c-uy','wp-slimstat').': 0",value:0,color:"#ededed"}','uz'=>'{id:"UZ",balloonText:"'.__('c-uz','wp-slimstat').': 0",value:0,color:"#ededed"}','vu'=>'{id:"VU",balloonText:"'.__('c-vu','wp-slimstat').': 0",value:0,color:"#ededed"}','ve'=>'{id:"VE",balloonText:"'.__('c-ve','wp-slimstat').': 0",value:0,color:"#ededed"}','vn'=>'{id:"VN",balloonText:"'.__('c-vn','wp-slimstat').': 0",value:0,color:"#ededed"}','vg'=>'{id:"VG",balloonText:"'.__('c-vg','wp-slimstat').': 0",value:0,color:"#ededed"}','vi'=>'{id:"VI",balloonText:"'.__('c-vi','wp-slimstat').': 0",value:0,color:"#ededed"}','eh'=>'{id:"EH",balloonText:"'.__('c-eh','wp-slimstat').': 0",value:0,color:"#ededed"}','ye'=>'{id:"YE",balloonText:"'.__('c-ye','wp-slimstat').': 0",value:0,color:"#ededed"}','zm'=>'{id:"ZM",balloonText:"'.__('c-zm','wp-slimstat').': 0",value:0,color:"#ededed"}','zw'=>'{id:"ZW",balloonText:"'.__('c-zw','wp-slimstat').': 0",value:0,color:"#ededed"}','gg'=>'{id:"GG",balloonText:"'.__('c-gg','wp-slimstat').': 0",value:0,color:"#ededed"}','je'=>'{id:"JE",balloonText:"'.__('c-je','wp-slimstat').': 0",value:0,color:"#ededed"}','im'=>'{id:"IM",balloonText:"'.__('c-im','wp-slimstat').': 0",value:0,color:"#ededed"}','mv'=>'{id:"MV",balloonText:"'.__('c-mv','wp-slimstat').': 0",value:0,color:"#ededed"}');
1431
  $countries_not_represented = array( __('c-eu','wp-slimstat') );
@@ -1733,7 +1873,6 @@ class wp_slimstat_reports {
1733
  'title' => '',
1734
  'callback' => '',
1735
  'callback_args' => array(),
1736
- 'callback_raw' => '',
1737
  'classes' => array(),
1738
  'screens' => array(),
1739
  'tooltip' => ''
@@ -1750,7 +1889,8 @@ class wp_slimstat_reports {
1750
  'filter_op' => 'equals',
1751
  'outer_select_column' => '',
1752
  'aggr_function' => 'MAX',
1753
- 'use_date_filters' => true
 
1754
  ), $_args[ 'callback_args' ] );
1755
 
1756
  return $_args;
27
 
28
  // Filters use the following format: browser equals Firefox&&&country contains gb
29
  $filters = array();
30
+ if ( !empty( $_REQUEST[ 'fs' ] ) && is_array( $_REQUEST[ 'fs' ] ) ) {
31
+ foreach( $_REQUEST[ 'fs' ] as $a_request_filter_name => $a_request_filter_value ) {
32
  $filters[] = "$a_request_filter_name $a_request_filter_value";
33
  }
34
  }
38
  $filters[] = "{$_POST[ 'f' ]} {$_POST[ 'o' ]} " . ( isset( $_POST[ 'v' ] ) ? $_POST[ 'v' ] : '' );
39
  }
40
 
41
+ foreach ( array( 'minute', 'hour', 'day', 'month', 'year', 'interval_direction', 'interval', 'interval_hours', 'interval_minutes' ) as $a_date_time_filter_name ) {
42
  if ( !empty( $_POST[ $a_date_time_filter_name ] ) ) {
43
  $filters[] = "$a_date_time_filter_name equals {$_POST[ $a_date_time_filter_name ]}";
44
  }
46
 
47
  // Hidden Filters
48
  if ( wp_slimstat::$options[ 'restrict_authors_view' ] == 'yes' && !current_user_can( 'manage_options' ) ) {
49
+ $filters[] = 'author equals ' . $GLOBALS[ 'current_user' ]->user_login;
50
+ self::$hidden_filters[ 'author' ] = 1;
51
  }
52
 
53
  if ( !empty( $filters ) ) {
68
  // - callback : function to use to render the report
69
  // - callback_args : parameters to pass to the function
70
  // - classes : determine the look and feel of this report ( tall, normal, wide, hidden )
71
+ // - screens : where should the report appear ( wp-slim-view-1, .., wp-slim-view-4, dashboard )
72
  // - tooltip : contextual help to be displayed on hover
73
 
74
+ $chart_tooltip = '<strong>' . __( 'Chart controls', 'wp-slimstat' ) . '</strong><ul><li>' . __( 'Use your mouse wheel to zoom in and out', 'wp-slimstat' ) . '</li><li>' . __( 'While zooming in, drag the chart to move to a different area', 'wp-slimstat' ) . '</li><li>' . __( 'Double click on an empty region to reset the zoom level', 'wp-slimstat' ) . '</li></ul>';
75
  self::$reports_info = array(
76
+ 'slim_getsocial' => array(
77
+ 'title' => __( 'Social Sharing Analytics <a href="http://getsocial.io/?utm_source=slimstat">powered by GetSocial</a>', 'wp-slimstat' ),
78
+ 'callback' => array( __CLASS__, 'show_getsocial' ),
79
+ 'classes' => array( 'full-width' ),
80
+ 'screens' => array( 'wp-slim-view-4' )
81
+ ),
82
+
83
  'slim_p7_02' => array(
84
  'title' => __( 'Activity', 'wp-slimstat' ),
85
  'callback' => array( __CLASS__, 'show_activity_log' ),
86
  'callback_args' => array(
87
  'type' => 'recent',
88
  'columns' => 'id',
89
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
90
  ),
91
  'classes' => array( 'full-width', 'tall' ),
92
+ 'screens' => array( 'wp-slim-view-1' ),
93
  'tooltip' => __( 'Color codes', 'wp-slimstat' ).'</strong><p><span class="little-color-box is-search-engine"></span> '.__( 'From search result page', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-visitor"></span> '.__( 'Known Visitor', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-user"></span> '.__( 'Known Users', 'wp-slimstat' ).'</p><p><span class="little-color-box is-direct"></span> '.__( 'Other Humans', 'wp-slimstat' ).'</p><p><span class="little-color-box"></span> '.__( 'Bot or Crawler', 'wp-slimstat' ).'</p>'
94
  ),
95
 
123
  'columns' => 'username',
124
  'where' => 'dt > '. ( date_i18n( 'U' ) - 300 ),
125
  'use_date_filters' => false,
126
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
127
  ),
128
  'classes' => array( 'normal' ),
129
+ 'screens' => array( 'wp-slim-view-2', 'dashboard' ),
130
  'tooltip' => __( 'When visitors leave a comment on your blog, WordPress assigns them a cookie. Slimstat leverages this information to identify returning visitors. Please note that visitors also include registered users.', 'wp-slimstat' )
131
  ),
132
  'slim_p1_06' => array(
135
  'callback_args' => array(
136
  'type' => 'recent',
137
  'columns' => 'searchterms',
138
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
139
  ),
140
  'classes' => array( 'normal' ),
141
+ 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-5' ),
142
  'tooltip' => __( 'Keywords used by your visitors to find your website on a search engine.', 'wp-slimstat' )
143
  ),
144
  'slim_p1_08' => array(
149
  'columns' => 'SUBSTRING_INDEX(resource, "' . ( !get_option( 'permalink_structure' ) ? '&' : '?' ) . '", 1)',
150
  'as_column' => 'resource_substring',
151
  'filter_op' => 'contains',
152
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
153
  ),
154
  'classes' => array( 'normal' ),
155
+ 'screens' => array( 'wp-slim-view-2', 'dashboard' ),
156
  'tooltip' => __( 'Here a "page" is not just a WordPress page type, but any web page on your website, including posts, products, categories, and so on.', 'wp-slimstat' )
157
  ),
158
  'slim_p1_10' => array(
162
  'type' => 'top',
163
  'columns' => 'referer',
164
  'where' => 'referer NOT LIKE "%' . home_url() . '%"',
165
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
166
  ),
167
  'classes' => array( 'normal' ),
168
+ 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-5', 'dashboard' )
169
  ),
170
  'slim_p1_11' => array(
171
  'title' => __( 'Top Known Visitors', 'wp-slimstat' ),
173
  'callback_args' => array(
174
  'type' => 'top',
175
  'columns' => 'username',
176
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
177
  ),
178
  'classes' => array( 'normal', 'hidden' ),
179
+ 'screens' => array( 'wp-slim-view-2', 'dashboard' )
180
  ),
181
  'slim_p1_12' => array(
182
  'title' => __( 'Top Search Terms', 'wp-slimstat' ),
184
  'callback_args' => array(
185
  'type' => 'top',
186
  'columns' => 'searchterms',
187
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
188
  ),
189
  'classes' => array( 'normal' ),
190
+ 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-4', 'wp-slim-view-5', 'dashboard' )
191
  ),
192
  'slim_p1_13' => array(
193
  'title' => __( 'Top Countries', 'wp-slimstat' ),
195
  'callback_args' => array(
196
  'type' => 'top',
197
  'columns' => 'country',
198
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
199
  ),
200
  'classes' => array( 'normal', 'hidden' ),
201
+ 'screens' => array( 'wp-slim-view-2', 'wp-slim-view-3', 'wp-slim-view-5', 'dashboard' ),
202
  'tooltip' => __( 'You can configure Slimstat to ignore a specific Country by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat' )
203
  ),
204
  'slim_p1_15' => array(
216
  'columns' => 'SUBSTRING(language, 1, 2)',
217
  'as_column' => 'language_substring',
218
  'filter_op' => 'contains',
219
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
220
  ),
221
  'classes' => array( 'normal', 'hidden' ),
222
+ 'screens' => array( 'wp-slim-view-3' )
223
  ),
224
 
225
  'slim_p2_01' => array(
245
  'callback_args' => array(
246
  'type' => 'top',
247
  'columns' => 'language',
248
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
249
  ),
250
  'classes' => array( 'normal' ),
251
+ 'screens' => array( 'wp-slim-view-3' )
252
  ),
253
  'slim_p2_04' => array(
254
+ 'title' => __( 'Top Browsers', 'wp-slimstat' ),
255
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
256
  'callback_args' => array(
257
  'type' => 'top',
258
  'columns' => 'browser, browser_version',
259
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
260
  ),
261
  'classes' => array( 'normal' ),
262
+ 'screens' => array( 'wp-slim-view-3', 'dashboard' )
263
  ),
264
  'slim_p2_05' => array(
265
  'title' => __( 'Top Service Providers', 'wp-slimstat' ),
267
  'callback_args' => array(
268
  'type' => 'top',
269
  'columns' => 'ip',
270
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
271
  ),
272
  'classes' => array( 'wide', 'hidden' ),
273
+ 'screens' => array( 'wp-slim-view-3' ),
274
  'tooltip' => __( 'Internet Service Provider: a company which provides other companies or individuals with access to the Internet. Your DSL or cable internet service is provided to you by your ISP.<br><br>You can ignore specific IP addresses by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat' )
275
  ),
276
  'slim_p2_06' => array(
279
  'callback_args' => array(
280
  'type' => 'top',
281
  'columns' => 'platform',
282
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
283
  ),
284
  'classes' => array( 'normal', 'hidden' ),
285
+ 'screens' => array( 'wp-slim-view-3' ),
286
  'tooltip' => __( 'Internet Service Provider: a company which provides other companies or individuals with access to the Internet. Your DSL or cable internet service is provided to you by your ISP.<br><br>You can ignore specific IP addresses by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat' )
287
  ),
288
  'slim_p2_07' => array(
290
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
291
  'callback_args' => array(
292
  'type' => 'top',
293
+ 'columns' => 'screen_width, screen_height',
294
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
295
  ),
296
  'classes' => array( 'normal' ),
297
+ 'screens' => array( 'wp-slim-view-3', 'dashboard' )
298
+ ),
299
+ 'slim_p2_08' => array(
300
+ 'title' => __( 'Top Viewport Sizes', 'wp-slimstat' ),
301
+ 'callback' => array( __CLASS__, 'raw_results_to_html' ),
302
+ 'callback_args' => array(
303
+ 'type' => 'top',
304
+ 'columns' => 'resolution',
305
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
306
+ ),
307
+ 'classes' => array( 'normal', 'hidden' ),
308
+ 'screens' => array( 'wp-slim-view-3' )
309
  ),
310
  'slim_p2_09' => array(
311
  'title' => __( 'Browser Capabilities', 'wp-slimstat' ),
325
  'callback_args' => array(
326
  'type' => 'recent',
327
  'columns' => 'country',
328
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
329
  ),
330
  'classes' => array( 'normal', 'hidden' ),
331
+ 'screens' => array( 'wp-slim-view-3', 'wp-slim-view-5' )
332
  ),
333
  'slim_p2_14' => array(
334
+ 'title' => __( 'Recent Viewport Sizes', 'wp-slimstat' ),
335
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
336
  'callback_args' => array(
337
  'type' => 'recent',
338
  'columns' => 'resolution',
339
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
340
  ),
341
  'classes' => array( 'normal', 'hidden' ),
342
+ 'screens' => array( 'wp-slim-view-3' )
343
  ),
344
  'slim_p2_15' => array(
345
  'title' => __( 'Recent Operating Systems', 'wp-slimstat' ),
347
  'callback_args' => array(
348
  'type' => 'recent',
349
  'columns' => 'platform',
350
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
351
  ),
352
  'classes' => array( 'normal', 'hidden' ),
353
+ 'screens' => array( 'wp-slim-view-3' )
354
  ),
355
  'slim_p2_16' => array(
356
  'title' => __( 'Recent Browsers', 'wp-slimstat' ),
358
  'callback_args' => array(
359
  'type' => 'recent',
360
  'columns' => 'browser, browser_version',
361
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
362
  ),
363
  'classes' => array( 'normal', 'hidden' ),
364
+ 'screens' => array( 'wp-slim-view-3' )
365
  ),
366
  'slim_p2_17' => array(
367
  'title' => __( 'Recent Languages', 'wp-slimstat' ),
369
  'callback_args' => array(
370
  'type' => 'recent',
371
  'columns' => 'language',
372
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
373
  ),
374
  'classes' => array( 'normal', 'hidden' ),
375
+ 'screens' => array( 'wp-slim-view-3' )
376
  ),
377
  'slim_p2_18' => array(
378
  'title' => __( 'Top Browser Families', 'wp-slimstat' ),
380
  'callback_args' => array(
381
  'type' => 'top',
382
  'columns' => 'browser',
383
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
384
  ),
385
  'classes' => array( 'normal', 'hidden' ),
386
+ 'screens' => array( 'wp-slim-view-3' ),
387
  'tooltip' => __( 'This report shows you what user agent families (no version considered) are popular among your visitors.', 'wp-slimstat' )
388
  ),
389
  'slim_p2_19' => array(
394
  'columns' => 'CONCAT("p-", SUBSTRING(platform, 1, 3))',
395
  'as_column' => 'platform_substring',
396
  'filter_op' => 'contains',
397
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
398
  ),
399
  'classes' => array( 'normal' ),
400
+ 'screens' => array( 'wp-slim-view-3' ),
401
  'tooltip' => __( 'This report shows you what operating system families (no version considered) are popular among your visitors.', 'wp-slimstat' )
402
  ),
403
  'slim_p2_20' => array(
407
  'type' => 'recent',
408
  'columns' => 'username',
409
  'where' => 'notes LIKE "%user:%"',
410
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
411
  ),
412
  'classes' => array( 'normal' ),
413
+ 'screens' => array( 'wp-slim-view-3' )
414
  ),
415
  'slim_p2_21' => array(
416
  'title' => __( 'Top Users', 'wp-slimstat' ),
419
  'type' => 'top',
420
  'columns' => 'username',
421
  'where' => 'notes LIKE "%user:%"',
422
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
423
  ),
424
  'classes' => array( 'normal', 'hidden' ),
425
+ 'screens' => array( 'wp-slim-view-3', 'dashboard' )
426
  ),
427
 
428
  'slim_p3_01' => array(
448
  'type' => 'top',
449
  'columns' => 'referer',
450
  'where' => "searchterms IS NOT NULL AND referer NOT LIKE '%".home_url()."%'",
451
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
452
  ),
453
  'classes' => array( 'normal' ),
454
+ 'screens' => array( 'wp-slim-view-5', 'dashboard' )
455
  ),
456
  'slim_p3_11' => array(
457
  'title' => __( 'Recent Exit Pages', 'wp-slimstat' ),
459
  'callback_args' => array(
460
  'type' => 'recent',
461
  'columns' => 'visit_id', // raw_results_to_html knows to display the resource, when the column is visit_id
462
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
463
  ),
464
  'classes' => array( 'normal' ),
465
+ 'screens' => array( 'wp-slim-view-5' )
466
  ),
467
 
468
  'slim_p4_01' => array(
471
  'callback_args' => array(
472
  'type' => 'recent',
473
  'columns' => 'outbound_resource', // raw_results_to_html knows to display the resource, when the column is visit_id
474
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
475
  ),
 
476
  'classes' => array( 'wide' ),
477
+ 'screens' => array( 'wp-slim-view-4' ),
478
  'tooltip' => ''
479
  ),
480
  'slim_p4_02' => array(
484
  'type' => 'recent',
485
  'columns' => 'resource',
486
  'where' => 'content_type = "post"',
487
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
488
  ),
489
  'classes' => array( 'normal' ),
490
+ 'screens' => array( 'wp-slim-view-4' )
491
  ),
492
  'slim_p4_03' => array(
493
  'title' => __( 'Recent Bounce Pages', 'wp-slimstat' ),
497
  'columns' => 'resource',
498
  'where' => 'content_type <> "404"',
499
  'having' => 'HAVING COUNT(visit_id) => 1',
500
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
501
  ),
502
  'classes' => array( 'normal', 'hidden' ),
503
+ 'screens' => array( 'wp-slim-view-4' ),
504
  'tooltip' => __( 'A <em>bounce page</em> is a single-page visit, or visit in which the person left your site from the entrance (landing) page.', 'wp-slimstat' )
505
  ),
506
  'slim_p4_04' => array(
510
  'type' => 'recent',
511
  'columns' => 'resource',
512
  'where' => '(resource LIKE "%/feed%" OR resource LIKE "%?feed=>%" OR resource LIKE "%&feed=>%" OR content_type LIKE "%feed%")',
513
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
514
  ),
515
  'classes' => array( 'normal', 'hidden' ),
516
+ 'screens' => array( 'wp-slim-view-4' )
517
  ),
518
  'slim_p4_05' => array(
519
  'title' => __( 'Recent Pages Not Found', 'wp-slimstat' ),
522
  'type' => 'recent',
523
  'columns' => 'resource',
524
  'where' => '(resource LIKE "[404]%" OR content_type LIKE "%404%")',
525
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
526
  ),
527
  'classes' => array( 'normal' ),
528
+ 'screens' => array( 'wp-slim-view-4' )
529
  ),
530
  'slim_p4_06' => array(
531
  'title' => __( 'Recent Internal Searches', 'wp-slimstat' ),
534
  'type' => 'recent',
535
  'columns' => 'searchterms',
536
  'where' => 'content_type LIKE "%search%"',
537
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
538
  ),
539
  'classes' => array( 'normal', 'hidden' ),
540
+ 'screens' => array( 'wp-slim-view-4' ),
541
  'tooltip' => __( "Searches performed using WordPress' built-in search functionality.", 'wp-slimstat' )
542
  ),
543
  'slim_p4_07' => array(
547
  'type' => 'top',
548
  'columns' => 'category',
549
  'where' => 'content_type LIKE "%category%"',
550
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
551
  ),
552
+ 'classes' => array( 'normal' ),
553
  'screens' => array( 'wp-slim-view-4', 'dashboard' )
554
  ),
555
 
560
  'type' => 'top',
561
  'columns' => 'resource',
562
  'where' => 'content_type = "download"',
563
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
564
  ),
565
  'classes' => array( 'wide', 'hidden' ),
566
+ 'screens' => array( 'wp-slim-view-4' ),
567
  'tooltip' => __( 'You can configure Slimstat to track specific file extensions as downloads.', 'wp-slimstat' )
568
  ),
 
 
569
  'slim_p4_10' => array(
570
  'title' => __( 'Recent Events', 'wp-slimstat' ),
571
+ 'callback' => array( __CLASS__, 'show_events' ),
572
  'callback_args' => array(
573
+ 'type' => 'recent',
574
+ 'columns' => 'notes',
575
+ 'raw' => array( 'wp_slimstat_db', 'get_recent_events' )
576
  ),
577
  'classes' => array( 'normal', 'hidden' ),
578
+ 'screens' => array( 'wp-slim-view-4' ),
579
  'tooltip' => __( 'This report lists any <em>event</em> occurred on your website. Please refer to the FAQ for more information on how to use this functionality.', 'wp-slimstat' )
580
  ),
 
581
  'slim_p4_11' => array(
582
  'title' => __( 'Top Posts', 'wp-slimstat' ),
583
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
585
  'type' => 'top',
586
  'columns' => 'resource',
587
  'where' => 'content_type = "post"',
588
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
589
  ),
590
  'classes' => array( 'normal' ),
591
+ 'screens' => array( 'wp-slim-view-4' )
592
+ ),
593
+ 'slim_p4_12' => array(
594
+ 'title' => __( 'Top Events', 'wp-slimstat' ),
595
+ 'callback' => array( __CLASS__, 'show_events' ),
596
+ 'callback_args' => array(
597
+ 'type' => 'top',
598
+ 'columns' => 'notes',
599
+ 'raw' => array( 'wp_slimstat_db', 'get_top_events' )
600
+ ),
601
+ 'classes' => array( 'normal', 'hidden' ),
602
+ 'screens' => array( 'wp-slim-view-4' ),
603
+ 'tooltip' => __( 'This report lists any <em>event</em> occurred on your website. Please refer to the FAQ for more information on how to use this functionality.', 'wp-slimstat' )
604
  ),
605
  'slim_p4_13' => array(
606
  'title' => __( 'Top Internal Searches', 'wp-slimstat' ),
609
  'type' => 'top',
610
  'columns' => 'searchterms',
611
  'where' => 'content_type LIKE "%search%"',
612
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
613
  ),
614
  'classes' => array( 'normal', 'hidden' ),
615
+ 'screens' => array( 'wp-slim-view-4' )
616
  ),
617
  'slim_p4_15' => array(
618
  'title' => __( 'Recent Categories', 'wp-slimstat' ),
621
  'type' => 'recent',
622
  'columns' => 'resource',
623
  'where' => '(content_type => "category" OR content_type => "tag")',
624
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
625
  ),
626
  'classes' => array( 'normal', 'hidden' ),
627
+ 'screens' => array( 'wp-slim-view-4' )
628
  ),
629
  'slim_p4_16' => array(
630
  'title' => __( 'Top Pages Not Found', 'wp-slimstat' ),
633
  'type' => 'top',
634
  'columns' => 'resource',
635
  'where' => 'content_type LIKE "%404%"',
636
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
637
  ),
638
  'classes' => array( 'normal' ),
639
+ 'screens' => array( 'wp-slim-view-4' )
640
  ),
641
  'slim_p4_18' => array(
642
  'title' => __( 'Top Authors', 'wp-slimstat' ),
644
  'callback_args' => array(
645
  'type' => 'top',
646
  'columns' => 'author',
647
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
648
  ),
649
  'classes' => array( 'normal' ),
650
+ 'screens' => array( 'wp-slim-view-4', 'dashboard' )
651
  ),
652
  'slim_p4_19' => array(
653
  'title' => __( 'Top Tags', 'wp-slimstat' ),
656
  'type' => 'top',
657
  'columns' => 'category',
658
  'where' => '(content_type LIKE "%tag%")',
659
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
660
  ),
661
  'classes' => array( 'normal', 'hidden' ),
662
+ 'screens' => array( 'wp-slim-view-4' )
663
  ),
664
  'slim_p4_20' => array(
665
  'title' => __( 'Recent Downloads', 'wp-slimstat' ),
668
  'type' => 'recent',
669
  'columns' => 'resource',
670
  'where' => 'content_type = "download"',
671
+ 'raw' => array( 'wp_slimstat_db', 'get_recent' )
672
  ),
673
  'classes' => array( 'wide', 'hidden' ),
674
+ 'screens' => array( 'wp-slim-view-4' )
675
  ),
676
  'slim_p4_21' => array(
677
  'title' => __( 'Top Outbound Links', 'wp-slimstat' ),
679
  'callback_args' => array(
680
  'type' => 'top',
681
  'columns' => 'outbound_resource',
682
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
683
  ),
684
  'classes' => array( 'normal', 'hidden' ),
685
+ 'screens' => array( 'wp-slim-view-4' )
686
  ),
687
  'slim_p4_22' => array(
688
  'title' => __( 'Your Website', 'wp-slimstat' ),
699
  'columns' => 'resource',
700
  'where' => 'content_type <> "404"',
701
  'having' => 'HAVING COUNT(visit_id) => 1',
702
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
703
  ),
704
  'classes' => array( 'normal', 'hidden' ),
705
+ 'screens' => array( 'wp-slim-view-4' )
706
  ),
707
  'slim_p4_24' => array(
708
  'title' => __( 'Top Exit Pages', 'wp-slimstat' ),
709
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
710
  'callback_args' => array(
711
+ 'type' => 'top',
712
  'columns' => 'visit_id',
713
  'outer_select_column' => 'resource',
714
  'aggr_function' => 'MAX',
715
+ 'raw' => array( 'wp_slimstat_db', 'get_top_aggr' )
716
  ),
717
  'classes' => array( 'normal', 'hidden' ),
718
+ 'screens' => array( 'wp-slim-view-4' )
719
  ),
720
  'slim_p4_25' => array(
721
  'title' => __( 'Top Entry Pages', 'wp-slimstat' ),
722
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
723
  'callback_args' => array(
724
+ 'type' => 'top',
725
  'columns' => 'visit_id',
726
  'outer_select_column' => 'resource',
727
  'aggr_function' => 'MIN',
728
+ 'raw' => array( 'wp_slimstat_db', 'get_top_aggr' )
729
  ),
730
  'classes' => array( 'normal', 'hidden' ),
731
+ 'screens' => array( 'wp-slim-view-4' )
732
  ),
733
 
734
  'slim_p6_01' => array(
755
  'slim_p3_09',
756
  'slim_p3_10',
757
  'slim_p4_08',
 
 
758
  'slim_p4_14',
759
  'slim_p4_17'
760
  );
815
  echo '</div></div>';
816
  }
817
 
818
+ public static function report_pagination( $_count_page_results = 0, $_count_all_results = 0, $_show_refresh_countdown = false, $_results_per_page = -1 ) {
819
+ $_results_per_page = ( $_results_per_page < 0 ) ? wp_slimstat::$options[ 'rows_to_show' ] : $_results_per_page;
820
+
821
+ $endpoint = min($_count_all_results, wp_slimstat_db::$filters_normalized['misc']['start_from'] + $_results_per_page);
822
  $pagination_buttons = '';
823
  $direction_prev = is_rtl()?'right':'left';
824
  $direction_next = is_rtl()?'left':'right';
825
 
826
+ if ($endpoint + $_results_per_page < $_count_all_results && $_count_page_results > 0){
827
+ $startpoint = $_count_all_results - $_count_all_results % $_results_per_page;
828
+ if ($startpoint == $_count_all_results) {
829
+ $startpoint -= $_results_per_page;
830
+ }
831
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-double-'.$direction_next.'" href="'.wp_slimstat_reports::fs_url('start_from equals '.$startpoint).'"></a> ';
832
  }
833
  if ($endpoint < $_count_all_results && $_count_page_results > 0){
834
+ $startpoint = wp_slimstat_db::$filters_normalized['misc']['start_from'] + $_results_per_page;
835
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-'.$direction_next.'" href="'.wp_slimstat_reports::fs_url('start_from equals '.$startpoint).'"></a> ';
836
  }
837
  if (wp_slimstat_db::$filters_normalized['misc']['start_from'] > 0){
838
+ $startpoint = (wp_slimstat_db::$filters_normalized['misc']['start_from'] > $_results_per_page)?wp_slimstat_db::$filters_normalized['misc']['start_from'] - $_results_per_page : 0;
839
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-'.$direction_prev.'" href="'.wp_slimstat_reports::fs_url('start_from equals '.$startpoint).'"></a> ';
840
  }
841
+ if (wp_slimstat_db::$filters_normalized['misc']['start_from'] - $_results_per_page > 0){
842
  $pagination_buttons .= '<a class="button-ajax slimstat-font-angle-double-'.$direction_prev.'" href="'.wp_slimstat_reports::fs_url('start_from equals 0').'"></a> ';
843
  }
844
 
845
+ $pagination = '<p class="pagination">'.sprintf(__('Results %s - %s of %s', 'wp-slimstat'), number_format(wp_slimstat_db::$filters_normalized['misc']['start_from'] + 1, 0, '', wp_slimstat_db::$formats['thousand']), number_format($endpoint, 0, '', wp_slimstat_db::$formats['thousand']), number_format($_count_all_results, 0, '', wp_slimstat_db::$formats['thousand']).(($_count_all_results == 1000)?'+':''));
846
  if ($_show_refresh_countdown && wp_slimstat::$options['refresh_interval'] > 0 && !wp_slimstat_db::$filters_normalized['date']['is_past']){
847
  $pagination .= ' &ndash; '.__('Refresh in','wp-slimstat').' <i class="refresh-timer"></i>';
848
  }
851
  echo $pagination;
852
  }
853
 
854
+ /* FIX ME: This function can be removed, is not used anymore */
855
  public static function get_raw_results( $_args = array() ) {
 
 
 
 
 
 
856
  if ( empty( $_args[ 'type' ] ) ) {
857
  return array();
858
  }
888
  break;
889
  }
890
 
 
 
 
 
891
  return $all_results;
892
  }
893
 
897
  call_user_func( $_args[ 'callback' ] , $_args[ 'callback_args' ] );
898
  }
899
 
900
+ public static function raw_results_to_html( $_args = array() ) {
901
+
902
  $all_results = call_user_func( $_args[ 'raw' ] , $_args );
903
 
904
  $results = array_slice(
905
  $all_results,
906
  wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ],
907
+ wp_slimstat::$options[ 'rows_to_show' ]
908
  );
909
 
910
  // Count the results
954
  $element_value = $results[$i]['browser'].((isset($results[$i]['browser_version']) && intval($results[$i]['browser_version']) != 0)?' '.$results[$i]['browser_version']:'');
955
  break;
956
 
957
+ case 'category':
958
+ $row_details = '<br>'.__( 'Category ID', 'wp-slimstat' ) . ": {$results[ $i ][ $_args[ 'columns' ] ]}";
959
+ $element_value = get_cat_name( $results[ $i ][ $_args[ 'columns' ] ] );
960
+ break;
961
+
962
  case 'country':
963
  $row_details .= '<br>'.__('Country Code','wp-slimstat').": {$results[$i]['country']}";
964
  $element_value = __('c-'.$results[$i]['country'], 'wp-slimstat');
985
  $element_value = __( $results[ $i ][ $_args[ 'columns' ] ], 'wp-slimstat');
986
  break;
987
 
 
 
 
 
 
988
  case 'resource':
989
  case 'resource_substring':
990
  $resource_title = self::get_resource_title( $results[ $i ][ $_args[ 'columns' ] ] );
994
  $element_value = $resource_title;
995
  break;
996
 
997
+ case 'screen_width':
998
+ $element_value = "{$results[ $i ][ $_args[ 'columns' ] ]} x {$results[ $i ][ 'screen_height' ]}";
999
+ break;
1000
+
1001
  case 'searchterms':
1002
  if ($_args[ 'type' ] == 'recent'){
1003
+ $domain = parse_url( $results[ $i ][ 'resource' ], PHP_URL_HOST );
 
1004
 
1005
  $row_details = '<br>'.__('Referrer','wp-slimstat').": $domain";
1006
  $element_value = self::get_search_terms_info($results[$i]['searchterms'], $results[$i]['referer'], true);
1024
 
1025
  $element_value = "<a class='slimstat-filter-link' href='".self::fs_url( $_args[ 'columns' ].' '.$_args['filter_op'].' '.$results[$i][ $_args[ 'columns' ] ] )."'>$element_value</a>";
1026
 
1027
+ if ( !empty($_args['type'] ) && $_args['type'] == 'recent' ) {
1028
  $row_details = date_i18n(wp_slimstat::$options['date_format'].' '.wp_slimstat::$options['time_format'], $results[$i]['dt'], true).$row_details;
1029
  }
1030
+
1031
+ if ( !empty($_args['type'] ) && $_args['type'] == 'top' ) {
1032
  $percentage = ' <span>'.((self::$pageviews > 0)?number_format(sprintf("%01.2f", (100*$results[$i]['counthits']/self::$pageviews)), 2, wp_slimstat_db::$formats['decimal'], wp_slimstat_db::$formats['thousand']):0).'%</span>';
1033
  $row_details = __('Hits','wp-slimstat').': '.number_format($results[$i]['counthits'], 0, '', wp_slimstat_db::$formats['thousand']).$row_details;
1034
  }
1347
  <p><?php self::inline_help(__('A referrer (or referring site) is the site that a visitor previously visited before following a link to your site.','wp-slimstat')) ?>
1348
  <?php _e('Unique Referrers', 'wp-slimstat') ?> <span><?php echo number_format(wp_slimstat_db::count_records('referer', "referer NOT LIKE '%{$_SERVER['SERVER_NAME']}%'"), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
1349
  <p><?php self::inline_help(__("Visitors who visited the site by typing the URL directly into their browser. <em>Direct</em> can also refer to the visitors who clicked on the links from their bookmarks/favorites, untagged links within emails, or links from documents that don't include tracking variables.",'wp-slimstat')) ?>
1350
+ <?php _e('Direct Pageviews', 'wp-slimstat') ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', 'referer IS NULL'), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
1351
  <p><?php self::inline_help(__("Visitors who came to your site via searches on Google or some other search engine.",'wp-slimstat')) ?>
1352
  <?php _e('From a search result', 'wp-slimstat') ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', "searchterms IS NOT NULL AND referer IS NOT NULL AND referer NOT LIKE '%".home_url()."%'"), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
1353
  <p><?php self::inline_help(__("The first page that a user views during a session. This is also known as the <em>entrance page</em>. For example, if they search for 'Brooklyn Office Space,' and they land on your home page, it gets counted (for that visit) as a landing page.",'wp-slimstat')) ?>
1363
  die();
1364
  }
1365
  }
1366
+
1367
+ public static function show_events( $_args = array() ) {
1368
+ $all_results = call_user_func( $_args[ 'raw' ] , $_args );
1369
+
1370
+ $results = array_slice(
1371
+ $all_results,
1372
+ wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ],
1373
+ wp_slimstat::$options[ 'rows_to_show' ]
1374
+ );
1375
+
1376
+ // Count the results
1377
+ $count_page_results = count( $results );
1378
+
1379
+ if ($count_page_results == 0){
1380
+ echo '<p class="nodata">'.__('No data to display','wp-slimstat').'</p>';
1381
+
1382
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1383
+ die();
1384
+ }
1385
+ else{
1386
+ return array();
1387
+ }
1388
+ }
1389
+
1390
+ self::report_pagination( $count_page_results, count( $all_results ) );
1391
+ $is_expanded = ( wp_slimstat::$options['expand_details'] == 'yes' ) ? ' expanded' : '';
1392
+
1393
+ foreach ( $results as $a_result ) {
1394
+ echo "<p>{$a_result[ 'notes' ]} <b class='slimstat-row-details$is_expanded'>" . __( 'Type', 'wp-slimstat' ) . ": {$a_result[ 'type' ]}";
1395
+
1396
+ if ( !empty( $a_result[ 'dt' ] ) ) {
1397
+ $date_time = date_i18n( wp_slimstat::$options[ 'date_format' ] . ' ' . wp_slimstat::$options[ 'time_format' ], $a_result[ 'dt' ], true );
1398
+ echo '<br/>' . __( 'Coordinates', 'wp-slimstat' ) . ": {$a_result[ 'position' ]}<br/>" . __( 'Date', 'wp-slimstat' ) . ": $date_time";
1399
+ }
1400
+ if ( !empty( $a_result[ 'counthits' ] ) ) {
1401
+ echo '<br/>' . __( 'Hits', 'wp-slimstat' ) . ": {$a_result[ 'counthits' ]}";
1402
+ }
1403
+
1404
+ echo "</b></p>";
1405
+ }
1406
+
1407
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1408
+ die();
1409
+ }
1410
+ }
1411
+
1412
  public static function show_rankings(){
1413
  $options = array('timeout' => 1, 'headers' => array('Accept' => 'application/json'));
1414
  $site_url_array = parse_url(home_url());
1494
  }
1495
  }
1496
 
1497
+ public static function show_getsocial() {
1498
+ if ( !empty( $_POST[ 'fs' ][ 'addon_enable_getsocial' ] ) ) {
1499
+ wp_slimstat::$options[ 'enable_getsocial' ] = 'yes';
1500
+
1501
+ // Update the list of posts
1502
+ $all_posts = get_posts( array( 'posts_per_page' => 100 ) );
1503
+ $all_post_urls = array();
1504
+
1505
+ if ( !empty( $all_posts ) ) {
1506
+ foreach( $all_posts as $a_post ) {
1507
+ $all_post_urls[] = parse_url( get_permalink( $a_post->ID ), PHP_URL_PATH );
1508
+ }
1509
+
1510
+ $args = json_encode( array(
1511
+ 'domain' => parse_url( get_site_url(), PHP_URL_HOST ),
1512
+ 'items' => $all_post_urls
1513
+ ) );
1514
+ wp_remote_post( 'http://api.at.sharescount.com/process', array( 'timeout' => 5, 'body' => $args ) );
1515
+ }
1516
+ }
1517
+ if ( wp_slimstat::$options[ 'enable_getsocial' ] == 'yes' ) {
1518
+ $response = wp_remote_get( 'http://api.at.sharescount.com/results/' . parse_url( get_site_url(), PHP_URL_HOST ), array( 'timeout' => 5 ) );
1519
+ if ( is_wp_error( $response ) ) {
1520
+ echo '<p class="nodata">' . __( 'Error contacting the GetSocial endpoint.', 'wp-slimstat' ) . '</p>';
1521
+ }
1522
+ else {
1523
+ // Parse remote HTML file
1524
+ $data = wp_remote_retrieve_body( $response );
1525
+
1526
+ // Check for error
1527
+ if ( is_wp_error( $data ) ) {
1528
+ echo '<p class="nodata">' . __( 'Error decoding the GetSocial payload.', 'wp-slimstat' ) . '</p>';
1529
+ }
1530
+ else {
1531
+ $decoded_data = @json_decode( $data );
1532
+
1533
+ echo '<table class="wp-list-table widefat fixed" cellspacing="0">
1534
+ <thead>
1535
+ <tr>
1536
+ <th scope="col" style="width:45%">Page</th>
1537
+ <th scope="col" style="text-align:center">Facebook</th>
1538
+ <th scope="col" style="text-align:center">Twitter</th>
1539
+ <th scope="col" style="text-align:center">LinkedIn</th>
1540
+ <th scope="col" style="text-align:center">Pinterest</th>
1541
+ <th scope="col" style="text-align:center">Google</th>
1542
+ <th scope="col" style="text-align:center">Total</th>
1543
+ </tr>
1544
+ </thead>';
1545
+ foreach ( $decoded_data as $key => $obj ) {
1546
+ echo "<tr>
1547
+ <td>" . self::get_resource_title( $key ) ."</td>
1548
+ <td style='text-align:center'>" . ( !empty( $obj->facebook ) ? $obj->facebook : 0 ) . "</td>
1549
+ <td style='text-align:center'>" . ( !empty( $obj->twitter ) ? $obj->twitter : 0 ) . "</td>
1550
+ <td style='text-align:center'>" . ( !empty( $obj->linkedin ) ? $obj->linkedin : 0 ) . "</td>
1551
+ <td style='text-align:center'>" . ( !empty( $obj->pinterest ) ? $obj->pinterest : 0 ) . "</td>
1552
+ <td style='text-align:center'>" . ( !empty( $obj->google ) ? $obj->google : 0 ) . "</td>
1553
+ <td style='text-align:center'>" . ( !empty( $obj->total ) ? $obj->total : 0 ) . "</td>";
1554
+ }
1555
+ echo '</table>';
1556
+ }
1557
+ }
1558
+ }
1559
+ else {
1560
+ echo '<p class="nodata">' . __( "Thanks to a partnership with GetSocial.io, you can access your website's<br/>social media metrics and identify your top performing posts.<br/> <a class='button-ajax' title='Enable this functionality' href='".self::fs_url()."&amp;fs%5Baddon_enable_getsocial%5D=yes'>Enable your social sharing report.</a>", 'wp-slimstat' ) . '</p>';
1561
+ }
1562
+
1563
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1564
+ die();
1565
+ }
1566
+ }
1567
+
1568
+ public static function show_world_map() {
1569
  $countries = wp_slimstat_db::get_top('country');
1570
  $data_areas = array('xx'=>'{id:"XX",balloonText:"'.__('c-xx','wp-slimstat').': 0",value:0,color:"#ededed"}','af'=>'{id:"AF",balloonText:"'.__('c-af','wp-slimstat').': 0",value:0,color:"#ededed"}','ax'=>'{id:"AX",balloonText:"'.__('c-ax','wp-slimstat').': 0",value:0,color:"#ededed"}','al'=>'{id:"AL",balloonText:"'.__('c-al','wp-slimstat').': 0",value:0,color:"#ededed"}','dz'=>'{id:"DZ",balloonText:"'.__('c-dz','wp-slimstat').': 0",value:0,color:"#ededed"}','ad'=>'{id:"AD",balloonText:"'.__('c-ad','wp-slimstat').': 0",value:0,color:"#ededed"}','ao'=>'{id:"AO",balloonText:"'.__('c-ao','wp-slimstat').': 0",value:0,color:"#ededed"}','ai'=>'{id:"AI",balloonText:"'.__('c-ai','wp-slimstat').': 0",value:0,color:"#ededed"}','ag'=>'{id:"AG",balloonText:"'.__('c-ag','wp-slimstat').': 0",value:0,color:"#ededed"}','ar'=>'{id:"AR",balloonText:"'.__('c-ar','wp-slimstat').': 0",value:0,color:"#ededed"}','am'=>'{id:"AM",balloonText:"'.__('c-am','wp-slimstat').': 0",value:0,color:"#ededed"}','aw'=>'{id:"AW",balloonText:"'.__('c-aw','wp-slimstat').': 0",value:0,color:"#ededed"}','au'=>'{id:"AU",balloonText:"'.__('c-au','wp-slimstat').': 0",value:0,color:"#ededed"}','at'=>'{id:"AT",balloonText:"'.__('c-at','wp-slimstat').': 0",value:0,color:"#ededed"}','az'=>'{id:"AZ",balloonText:"'.__('c-az','wp-slimstat').': 0",value:0,color:"#ededed"}','bs'=>'{id:"BS",balloonText:"'.__('c-bs','wp-slimstat').': 0",value:0,color:"#ededed"}','bh'=>'{id:"BH",balloonText:"'.__('c-bh','wp-slimstat').': 0",value:0,color:"#ededed"}','bd'=>'{id:"BD",balloonText:"'.__('c-bd','wp-slimstat').': 0",value:0,color:"#ededed"}','bb'=>'{id:"BB",balloonText:"'.__('c-bb','wp-slimstat').': 0",value:0,color:"#ededed"}','by'=>'{id:"BY",balloonText:"'.__('c-by','wp-slimstat').': 0",value:0,color:"#ededed"}','be'=>'{id:"BE",balloonText:"'.__('c-be','wp-slimstat').': 0",value:0,color:"#ededed"}','bz'=>'{id:"BZ",balloonText:"'.__('c-bz','wp-slimstat').': 0",value:0,color:"#ededed"}','bj'=>'{id:"BJ",balloonText:"'.__('c-bj','wp-slimstat').': 0",value:0,color:"#ededed"}','bm'=>'{id:"BM",balloonText:"'.__('c-bm','wp-slimstat').': 0",value:0,color:"#ededed"}','bt'=>'{id:"BT",balloonText:"'.__('c-bt','wp-slimstat').': 0",value:0,color:"#ededed"}','bo'=>'{id:"BO",balloonText:"'.__('c-bo','wp-slimstat').': 0",value:0,color:"#ededed"}','ba'=>'{id:"BA",balloonText:"'.__('c-ba','wp-slimstat').': 0",value:0,color:"#ededed"}','bw'=>'{id:"BW",balloonText:"'.__('c-bw','wp-slimstat').': 0",value:0,color:"#ededed"}','br'=>'{id:"BR",balloonText:"'.__('c-br','wp-slimstat').': 0",value:0,color:"#ededed"}','bn'=>'{id:"BN",balloonText:"'.__('c-bn','wp-slimstat').': 0",value:0,color:"#ededed"}','bg'=>'{id:"BG",balloonText:"'.__('c-bg','wp-slimstat').': 0",value:0,color:"#ededed"}','bf'=>'{id:"BF",balloonText:"'.__('c-bf','wp-slimstat').': 0",value:0,color:"#ededed"}','bi'=>'{id:"BI",balloonText:"'.__('c-bi','wp-slimstat').': 0",value:0,color:"#ededed"}','kh'=>'{id:"KH",balloonText:"'.__('c-kh','wp-slimstat').': 0",value:0,color:"#ededed"}','cm'=>'{id:"CM",balloonText:"'.__('c-cm','wp-slimstat').': 0",value:0,color:"#ededed"}','ca'=>'{id:"CA",balloonText:"'.__('c-ca','wp-slimstat').': 0",value:0,color:"#ededed"}','cv'=>'{id:"CV",balloonText:"'.__('c-cv','wp-slimstat').': 0",value:0,color:"#ededed"}','ky'=>'{id:"KY",balloonText:"'.__('c-ky','wp-slimstat').': 0",value:0,color:"#ededed"}','cf'=>'{id:"CF",balloonText:"'.__('c-cf','wp-slimstat').': 0",value:0,color:"#ededed"}','td'=>'{id:"TD",balloonText:"'.__('c-td','wp-slimstat').': 0",value:0,color:"#ededed"}','cl'=>'{id:"CL",balloonText:"'.__('c-cl','wp-slimstat').': 0",value:0,color:"#ededed"}','cn'=>'{id:"CN",balloonText:"'.__('c-cn','wp-slimstat').': 0",value:0,color:"#ededed"}','co'=>'{id:"CO",balloonText:"'.__('c-co','wp-slimstat').': 0",value:0,color:"#ededed"}','km'=>'{id:"KM",balloonText:"'.__('c-km','wp-slimstat').': 0",value:0,color:"#ededed"}','cg'=>'{id:"CG",balloonText:"'.__('c-cg','wp-slimstat').': 0",value:0,color:"#ededed"}','cd'=>'{id:"CD",balloonText:"'.__('c-cd','wp-slimstat').': 0",value:0,color:"#ededed"}','cr'=>'{id:"CR",balloonText:"'.__('c-cr','wp-slimstat').': 0",value:0,color:"#ededed"}','ci'=>'{id:"CI",balloonText:"'.__('c-ci','wp-slimstat').': 0",value:0,color:"#ededed"}','hr'=>'{id:"HR",balloonText:"'.__('c-hr','wp-slimstat').': 0",value:0,color:"#ededed"}','cu'=>'{id:"CU",balloonText:"'.__('c-cu','wp-slimstat').': 0",value:0,color:"#ededed"}','cy'=>'{id:"CY",balloonText:"'.__('c-cy','wp-slimstat').': 0",value:0,color:"#ededed"}','cz'=>'{id:"CZ",balloonText:"'.__('c-cz','wp-slimstat').': 0",value:0,color:"#ededed"}','dk'=>'{id:"DK",balloonText:"'.__('c-dk','wp-slimstat').': 0",value:0,color:"#ededed"}','dj'=>'{id:"DJ",balloonText:"'.__('c-dj','wp-slimstat').': 0",value:0,color:"#ededed"}','dm'=>'{id:"DM",balloonText:"'.__('c-dm','wp-slimstat').': 0",value:0,color:"#ededed"}','do'=>'{id:"DO",balloonText:"'.__('c-do','wp-slimstat').': 0",value:0,color:"#ededed"}','ec'=>'{id:"EC",balloonText:"'.__('c-ec','wp-slimstat').': 0",value:0,color:"#ededed"}','eg'=>'{id:"EG",balloonText:"'.__('c-eg','wp-slimstat').': 0",value:0,color:"#ededed"}','sv'=>'{id:"SV",balloonText:"'.__('c-sv','wp-slimstat').': 0",value:0,color:"#ededed"}','gq'=>'{id:"GQ",balloonText:"'.__('c-gq','wp-slimstat').': 0",value:0,color:"#ededed"}','er'=>'{id:"ER",balloonText:"'.__('c-er','wp-slimstat').': 0",value:0,color:"#ededed"}','ee'=>'{id:"EE",balloonText:"'.__('c-ee','wp-slimstat').': 0",value:0,color:"#ededed"}','et'=>'{id:"ET",balloonText:"'.__('c-et','wp-slimstat').': 0",value:0,color:"#ededed"}','fo'=>'{id:"FO",balloonText:"'.__('c-fo','wp-slimstat').': 0",value:0,color:"#ededed"}','fk'=>'{id:"FK",balloonText:"'.__('c-fk','wp-slimstat').': 0",value:0,color:"#ededed"}','fj'=>'{id:"FJ",balloonText:"'.__('c-fj','wp-slimstat').': 0",value:0,color:"#ededed"}','fi'=>'{id:"FI",balloonText:"'.__('c-fi','wp-slimstat').': 0",value:0,color:"#ededed"}','fr'=>'{id:"FR",balloonText:"'.__('c-fr','wp-slimstat').': 0",value:0,color:"#ededed"}','gf'=>'{id:"GF",balloonText:"'.__('c-gf','wp-slimstat').': 0",value:0,color:"#ededed"}','ga'=>'{id:"GA",balloonText:"'.__('c-ga','wp-slimstat').': 0",value:0,color:"#ededed"}','gm'=>'{id:"GM",balloonText:"'.__('c-gm','wp-slimstat').': 0",value:0,color:"#ededed"}','ge'=>'{id:"GE",balloonText:"'.__('c-ge','wp-slimstat').': 0",value:0,color:"#ededed"}','de'=>'{id:"DE",balloonText:"'.__('c-de','wp-slimstat').': 0",value:0,color:"#ededed"}','gh'=>'{id:"GH",balloonText:"'.__('c-gh','wp-slimstat').': 0",value:0,color:"#ededed"}','gr'=>'{id:"GR",balloonText:"'.__('c-gr','wp-slimstat').': 0",value:0,color:"#ededed"}','gl'=>'{id:"GL",balloonText:"'.__('c-gl','wp-slimstat').': 0",value:0,color:"#ededed"}','gd'=>'{id:"GD",balloonText:"'.__('c-gd','wp-slimstat').': 0",value:0,color:"#ededed"}','gp'=>'{id:"GP",balloonText:"'.__('c-gp','wp-slimstat').': 0",value:0,color:"#ededed"}','gt'=>'{id:"GT",balloonText:"'.__('c-gt','wp-slimstat').': 0",value:0,color:"#ededed"}','gn'=>'{id:"GN",balloonText:"'.__('c-gn','wp-slimstat').': 0",value:0,color:"#ededed"}','gw'=>'{id:"GW",balloonText:"'.__('c-gw','wp-slimstat').': 0",value:0,color:"#ededed"}','gy'=>'{id:"GY",balloonText:"'.__('c-gy','wp-slimstat').': 0",value:0,color:"#ededed"}','ht'=>'{id:"HT",balloonText:"'.__('c-ht','wp-slimstat').': 0",value:0,color:"#ededed"}','hn'=>'{id:"HN",balloonText:"'.__('c-hn','wp-slimstat').': 0",value:0,color:"#ededed"}','hk'=>'{id:"HK",balloonText:"'.__('c-hk','wp-slimstat').': 0",value:0,color:"#ededed"}','hu'=>'{id:"HU",balloonText:"'.__('c-hu','wp-slimstat').': 0",value:0,color:"#ededed"}','is'=>'{id:"IS",balloonText:"'.__('c-is','wp-slimstat').': 0",value:0,color:"#ededed"}','in'=>'{id:"IN",balloonText:"'.__('c-in','wp-slimstat').': 0",value:0,color:"#ededed"}','id'=>'{id:"ID",balloonText:"'.__('c-id','wp-slimstat').': 0",value:0,color:"#ededed"}','ir'=>'{id:"IR",balloonText:"'.__('c-ir','wp-slimstat').': 0",value:0,color:"#ededed"}','iq'=>'{id:"IQ",balloonText:"'.__('c-iq','wp-slimstat').': 0",value:0,color:"#ededed"}','ie'=>'{id:"IE",balloonText:"'.__('c-ie','wp-slimstat').': 0",value:0,color:"#ededed"}','il'=>'{id:"IL",balloonText:"'.__('c-il','wp-slimstat').': 0",value:0,color:"#ededed"}','it'=>'{id:"IT",balloonText:"'.__('c-it','wp-slimstat').': 0",value:0,color:"#ededed"}','jm'=>'{id:"JM",balloonText:"'.__('c-jm','wp-slimstat').': 0",value:0,color:"#ededed"}','jp'=>'{id:"JP",balloonText:"'.__('c-jp','wp-slimstat').': 0",value:0,color:"#ededed"}','jo'=>'{id:"JO",balloonText:"'.__('c-jo','wp-slimstat').': 0",value:0,color:"#ededed"}','kz'=>'{id:"KZ",balloonText:"'.__('c-kz','wp-slimstat').': 0",value:0,color:"#ededed"}','ke'=>'{id:"KE",balloonText:"'.__('c-ke','wp-slimstat').': 0",value:0,color:"#ededed"}','nr'=>'{id:"NR",balloonText:"'.__('c-nr','wp-slimstat').': 0",value:0,color:"#ededed"}','kp'=>'{id:"KP",balloonText:"'.__('c-kp','wp-slimstat').': 0",value:0,color:"#ededed"}','kr'=>'{id:"KR",balloonText:"'.__('c-kr','wp-slimstat').': 0",value:0,color:"#ededed"}','kv'=>'{id:"KV",balloonText:"'.__('c-kv','wp-slimstat').': 0",value:0,color:"#ededed"}','kw'=>'{id:"KW",balloonText:"'.__('c-kw','wp-slimstat').': 0",value:0,color:"#ededed"}','kg'=>'{id:"KG",balloonText:"'.__('c-kg','wp-slimstat').': 0",value:0,color:"#ededed"}','la'=>'{id:"LA",balloonText:"'.__('c-la','wp-slimstat').': 0",value:0,color:"#ededed"}','lv'=>'{id:"LV",balloonText:"'.__('c-lv','wp-slimstat').': 0",value:0,color:"#ededed"}','lb'=>'{id:"LB",balloonText:"'.__('c-lb','wp-slimstat').': 0",value:0,color:"#ededed"}','ls'=>'{id:"LS",balloonText:"'.__('c-ls','wp-slimstat').': 0",value:0,color:"#ededed"}','lr'=>'{id:"LR",balloonText:"'.__('c-lr','wp-slimstat').': 0",value:0,color:"#ededed"}','ly'=>'{id:"LY",balloonText:"'.__('c-ly','wp-slimstat').': 0",value:0,color:"#ededed"}','li'=>'{id:"LI",balloonText:"'.__('c-li','wp-slimstat').': 0",value:0,color:"#ededed"}','lt'=>'{id:"LT",balloonText:"'.__('c-lt','wp-slimstat').': 0",value:0,color:"#ededed"}','lu'=>'{id:"LU",balloonText:"'.__('c-lu','wp-slimstat').': 0",value:0,color:"#ededed"}','mk'=>'{id:"MK",balloonText:"'.__('c-mk','wp-slimstat').': 0",value:0,color:"#ededed"}','mg'=>'{id:"MG",balloonText:"'.__('c-mg','wp-slimstat').': 0",value:0,color:"#ededed"}','mw'=>'{id:"MW",balloonText:"'.__('c-mw','wp-slimstat').': 0",value:0,color:"#ededed"}','my'=>'{id:"MY",balloonText:"'.__('c-my','wp-slimstat').': 0",value:0,color:"#ededed"}','ml'=>'{id:"ML",balloonText:"'.__('c-ml','wp-slimstat').': 0",value:0,color:"#ededed"}','mt'=>'{id:"MT",balloonText:"'.__('c-mt','wp-slimstat').': 0",value:0,color:"#ededed"}','mq'=>'{id:"MQ",balloonText:"'.__('c-mq','wp-slimstat').': 0",value:0,color:"#ededed"}','mr'=>'{id:"MR",balloonText:"'.__('c-mr','wp-slimstat').': 0",value:0,color:"#ededed"}','mu'=>'{id:"MU",balloonText:"'.__('c-mu','wp-slimstat').': 0",value:0,color:"#ededed"}','mx'=>'{id:"MX",balloonText:"'.__('c-mx','wp-slimstat').': 0",value:0,color:"#ededed"}','md'=>'{id:"MD",balloonText:"'.__('c-md','wp-slimstat').': 0",value:0,color:"#ededed"}','mn'=>'{id:"MN",balloonText:"'.__('c-mn','wp-slimstat').': 0",value:0,color:"#ededed"}','me'=>'{id:"ME",balloonText:"'.__('c-me','wp-slimstat').': 0",value:0,color:"#ededed"}','ms'=>'{id:"MS",balloonText:"'.__('c-ms','wp-slimstat').': 0",value:0,color:"#ededed"}','ma'=>'{id:"MA",balloonText:"'.__('c-ma','wp-slimstat').': 0",value:0,color:"#ededed"}','mz'=>'{id:"MZ",balloonText:"'.__('c-mz','wp-slimstat').': 0",value:0,color:"#ededed"}','mm'=>'{id:"MM",balloonText:"'.__('c-mm','wp-slimstat').': 0",value:0,color:"#ededed"}','na'=>'{id:"NA",balloonText:"'.__('c-na','wp-slimstat').': 0",value:0,color:"#ededed"}','np'=>'{id:"NP",balloonText:"'.__('c-np','wp-slimstat').': 0",value:0,color:"#ededed"}','nl'=>'{id:"NL",balloonText:"'.__('c-nl','wp-slimstat').': 0",value:0,color:"#ededed"}','nc'=>'{id:"NC",balloonText:"'.__('c-nc','wp-slimstat').': 0",value:0,color:"#ededed"}','nz'=>'{id:"NZ",balloonText:"'.__('c-nz','wp-slimstat').': 0",value:0,color:"#ededed"}','ni'=>'{id:"NI",balloonText:"'.__('c-ni','wp-slimstat').': 0",value:0,color:"#ededed"}','ne'=>'{id:"NE",balloonText:"'.__('c-ne','wp-slimstat').': 0",value:0,color:"#ededed"}','ng'=>'{id:"NG",balloonText:"'.__('c-ng','wp-slimstat').': 0",value:0,color:"#ededed"}','no'=>'{id:"NO",balloonText:"'.__('c-no','wp-slimstat').': 0",value:0,color:"#ededed"}','om'=>'{id:"OM",balloonText:"'.__('c-om','wp-slimstat').': 0",value:0,color:"#ededed"}','pk'=>'{id:"PK",balloonText:"'.__('c-pk','wp-slimstat').': 0",value:0,color:"#ededed"}','pw'=>'{id:"PW",balloonText:"'.__('c-pw','wp-slimstat').': 0",value:0,color:"#ededed"}','ps'=>'{id:"PS",balloonText:"'.__('c-ps','wp-slimstat').': 0",value:0,color:"#ededed"}','pa'=>'{id:"PA",balloonText:"'.__('c-pa','wp-slimstat').': 0",value:0,color:"#ededed"}','pg'=>'{id:"PG",balloonText:"'.__('c-pg','wp-slimstat').': 0",value:0,color:"#ededed"}','py'=>'{id:"PY",balloonText:"'.__('c-py','wp-slimstat').': 0",value:0,color:"#ededed"}','pe'=>'{id:"PE",balloonText:"'.__('c-pe','wp-slimstat').': 0",value:0,color:"#ededed"}','ph'=>'{id:"PH",balloonText:"'.__('c-ph','wp-slimstat').': 0",value:0,color:"#ededed"}','pl'=>'{id:"PL",balloonText:"'.__('c-pl','wp-slimstat').': 0",value:0,color:"#ededed"}','pt'=>'{id:"PT",balloonText:"'.__('c-pt','wp-slimstat').': 0",value:0,color:"#ededed"}','pr'=>'{id:"PR",balloonText:"'.__('c-pr','wp-slimstat').': 0",value:0,color:"#ededed"}','qa'=>'{id:"QA",balloonText:"'.__('c-qa','wp-slimstat').': 0",value:0,color:"#ededed"}','re'=>'{id:"RE",balloonText:"'.__('c-re','wp-slimstat').': 0",value:0,color:"#ededed"}','ro'=>'{id:"RO",balloonText:"'.__('c-ro','wp-slimstat').': 0",value:0,color:"#ededed"}','ru'=>'{id:"RU",balloonText:"'.__('c-ru','wp-slimstat').': 0",value:0,color:"#ededed"}','rw'=>'{id:"RW",balloonText:"'.__('c-rw','wp-slimstat').': 0",value:0,color:"#ededed"}','kn'=>'{id:"KN",balloonText:"'.__('c-kn','wp-slimstat').': 0",value:0,color:"#ededed"}','lc'=>'{id:"LC",balloonText:"'.__('c-lc','wp-slimstat').': 0",value:0,color:"#ededed"}','mf'=>'{id:"MF",balloonText:"'.__('c-mf','wp-slimstat').': 0",value:0,color:"#ededed"}','vc'=>'{id:"VC",balloonText:"'.__('c-vc','wp-slimstat').': 0",value:0,color:"#ededed"}','ws'=>'{id:"WS",balloonText:"'.__('c-ws','wp-slimstat').': 0",value:0,color:"#ededed"}','st'=>'{id:"ST",balloonText:"'.__('c-st','wp-slimstat').': 0",value:0,color:"#ededed"}','sa'=>'{id:"SA",balloonText:"'.__('c-sa','wp-slimstat').': 0",value:0,color:"#ededed"}','sn'=>'{id:"SN",balloonText:"'.__('c-sn','wp-slimstat').': 0",value:0,color:"#ededed"}','rs'=>'{id:"RS",balloonText:"'.__('c-rs','wp-slimstat').': 0",value:0,color:"#ededed"}','sl'=>'{id:"SL",balloonText:"'.__('c-sl','wp-slimstat').': 0",value:0,color:"#ededed"}','sg'=>'{id:"SG",balloonText:"'.__('c-sg','wp-slimstat').': 0",value:0,color:"#ededed"}','sk'=>'{id:"SK",balloonText:"'.__('c-sk','wp-slimstat').': 0",value:0,color:"#ededed"}','si'=>'{id:"SI",balloonText:"'.__('c-si','wp-slimstat').': 0",value:0,color:"#ededed"}','sb'=>'{id:"SB",balloonText:"'.__('c-sb','wp-slimstat').': 0",value:0,color:"#ededed"}','so'=>'{id:"SO",balloonText:"'.__('c-so','wp-slimstat').': 0",value:0,color:"#ededed"}','za'=>'{id:"ZA",balloonText:"'.__('c-za','wp-slimstat').': 0",value:0,color:"#ededed"}','gs'=>'{id:"GS",balloonText:"'.__('c-gs','wp-slimstat').': 0",value:0,color:"#ededed"}','es'=>'{id:"ES",balloonText:"'.__('c-es','wp-slimstat').': 0",value:0,color:"#ededed"}','lk'=>'{id:"LK",balloonText:"'.__('c-lk','wp-slimstat').': 0",value:0,color:"#ededed"}','sc'=>'{id:"SC",balloonText:"'.__('c-sc','wp-slimstat').': 0",value:0,color:"#ededed"}','sd'=>'{id:"SD",balloonText:"'.__('c-sd','wp-slimstat').': 0",value:0,color:"#ededed"}','ss'=>'{id:"SS",balloonText:"'.__('c-ss','wp-slimstat').': 0",value:0,color:"#ededed"}','sr'=>'{id:"SR",balloonText:"'.__('c-sr','wp-slimstat').': 0",value:0,color:"#ededed"}','sj'=>'{id:"SJ",balloonText:"'.__('c-sj','wp-slimstat').': 0",value:0,color:"#ededed"}','sz'=>'{id:"SZ",balloonText:"'.__('c-sz','wp-slimstat').': 0",value:0,color:"#ededed"}','se'=>'{id:"SE",balloonText:"'.__('c-se','wp-slimstat').': 0",value:0,color:"#ededed"}','ch'=>'{id:"CH",balloonText:"'.__('c-ch','wp-slimstat').': 0",value:0,color:"#ededed"}','sy'=>'{id:"SY",balloonText:"'.__('c-sy','wp-slimstat').': 0",value:0,color:"#ededed"}','tw'=>'{id:"TW",balloonText:"'.__('c-tw','wp-slimstat').': 0",value:0,color:"#ededed"}','tj'=>'{id:"TJ",balloonText:"'.__('c-tj','wp-slimstat').': 0",value:0,color:"#ededed"}','tz'=>'{id:"TZ",balloonText:"'.__('c-tz','wp-slimstat').': 0",value:0,color:"#ededed"}','th'=>'{id:"TH",balloonText:"'.__('c-th','wp-slimstat').': 0",value:0,color:"#ededed"}','tl'=>'{id:"TL",balloonText:"'.__('c-tl','wp-slimstat').': 0",value:0,color:"#ededed"}','tg'=>'{id:"TG",balloonText:"'.__('c-tg','wp-slimstat').': 0",value:0,color:"#ededed"}','to'=>'{id:"TO",balloonText:"'.__('c-to','wp-slimstat').': 0",value:0,color:"#ededed"}','tt'=>'{id:"TT",balloonText:"'.__('c-tt','wp-slimstat').': 0",value:0,color:"#ededed"}','tn'=>'{id:"TN",balloonText:"'.__('c-tn','wp-slimstat').': 0",value:0,color:"#ededed"}','tr'=>'{id:"TR",balloonText:"'.__('c-tr','wp-slimstat').': 0",value:0,color:"#ededed"}','tm'=>'{id:"TM",balloonText:"'.__('c-tm','wp-slimstat').': 0",value:0,color:"#ededed"}','tc'=>'{id:"TC",balloonText:"'.__('c-tc','wp-slimstat').': 0",value:0,color:"#ededed"}','ug'=>'{id:"UG",balloonText:"'.__('c-ug','wp-slimstat').': 0",value:0,color:"#ededed"}','ua'=>'{id:"UA",balloonText:"'.__('c-ua','wp-slimstat').': 0",value:0,color:"#ededed"}','ae'=>'{id:"AE",balloonText:"'.__('c-ae','wp-slimstat').': 0",value:0,color:"#ededed"}','gb'=>'{id:"GB",balloonText:"'.__('c-gb','wp-slimstat').': 0",value:0,color:"#ededed"}','us'=>'{id:"US",balloonText:"'.__('c-us','wp-slimstat').': 0",value:0,color:"#ededed"}','uy'=>'{id:"UY",balloonText:"'.__('c-uy','wp-slimstat').': 0",value:0,color:"#ededed"}','uz'=>'{id:"UZ",balloonText:"'.__('c-uz','wp-slimstat').': 0",value:0,color:"#ededed"}','vu'=>'{id:"VU",balloonText:"'.__('c-vu','wp-slimstat').': 0",value:0,color:"#ededed"}','ve'=>'{id:"VE",balloonText:"'.__('c-ve','wp-slimstat').': 0",value:0,color:"#ededed"}','vn'=>'{id:"VN",balloonText:"'.__('c-vn','wp-slimstat').': 0",value:0,color:"#ededed"}','vg'=>'{id:"VG",balloonText:"'.__('c-vg','wp-slimstat').': 0",value:0,color:"#ededed"}','vi'=>'{id:"VI",balloonText:"'.__('c-vi','wp-slimstat').': 0",value:0,color:"#ededed"}','eh'=>'{id:"EH",balloonText:"'.__('c-eh','wp-slimstat').': 0",value:0,color:"#ededed"}','ye'=>'{id:"YE",balloonText:"'.__('c-ye','wp-slimstat').': 0",value:0,color:"#ededed"}','zm'=>'{id:"ZM",balloonText:"'.__('c-zm','wp-slimstat').': 0",value:0,color:"#ededed"}','zw'=>'{id:"ZW",balloonText:"'.__('c-zw','wp-slimstat').': 0",value:0,color:"#ededed"}','gg'=>'{id:"GG",balloonText:"'.__('c-gg','wp-slimstat').': 0",value:0,color:"#ededed"}','je'=>'{id:"JE",balloonText:"'.__('c-je','wp-slimstat').': 0",value:0,color:"#ededed"}','im'=>'{id:"IM",balloonText:"'.__('c-im','wp-slimstat').': 0",value:0,color:"#ededed"}','mv'=>'{id:"MV",balloonText:"'.__('c-mv','wp-slimstat').': 0",value:0,color:"#ededed"}');
1571
  $countries_not_represented = array( __('c-eu','wp-slimstat') );
1873
  'title' => '',
1874
  'callback' => '',
1875
  'callback_args' => array(),
 
1876
  'classes' => array(),
1877
  'screens' => array(),
1878
  'tooltip' => ''
1889
  'filter_op' => 'equals',
1890
  'outer_select_column' => '',
1891
  'aggr_function' => 'MAX',
1892
+ 'use_date_filters' => true,
1893
+ 'results_per_page' => wp_slimstat::$options[ 'rows_to_show' ]
1894
  ), $_args[ 'callback_args' ] );
1895
 
1896
  return $_args;
admin/wp-slimstat-admin.php CHANGED
@@ -11,7 +11,8 @@ class wp_slimstat_admin{
11
  */
12
  public static function init(){
13
  if ((wp_slimstat::$options['enable_ads_network'] == 'yes' || wp_slimstat::$options['enable_ads_network'] == 'no')){
14
- self::$admin_notice = "Can you believe it? We just passed 1.5 million downloads! To thank you for your loyalty and continued support, we are offering a 15% discount on all orders (including the bundles!) till the end of the month. Just enter <code>15OFF</code> in the corresponding field at checkout. Are you an existing premium customer? We have an even bigger surprise for you: as a way to thank you for your patience while we updated our extensions to make them compatible with Slimstat 4, we are giving away 50 codes to download one <strong>free</strong> add-on from our store. Including the new ones we're about to announce. Contact us to get your code (please mention your license key in your message).";
 
15
  self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">I got it, thanks</a>';
16
  }
17
  else {
@@ -109,7 +110,10 @@ class wp_slimstat_admin{
109
  add_filter('manage_pages_columns', array(__CLASS__, 'add_column_header'));
110
  add_action('manage_posts_custom_column', array(__CLASS__, 'add_post_column'), 10, 2);
111
  add_action('manage_pages_custom_column', array(__CLASS__, 'add_post_column'), 10, 2);
112
- add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet'));
 
 
 
113
  }
114
 
115
  // Add some inline CSS to customize the icon associated to SlimStat in the sidebar
@@ -202,7 +206,7 @@ class wp_slimstat_admin{
202
  if (function_exists('apply_filters')){
203
  $my_wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']);
204
  }
205
-
206
  // Create the tables
207
  self::init_tables($my_wpdb);
208
 
@@ -564,15 +568,12 @@ class wp_slimstat_admin{
564
  /**
565
  * Loads a custom stylesheet file for the administration panels
566
  */
567
- public static function wp_slimstat_stylesheet($_hook = ''){
568
- if (!empty($_GET['page']) && strpos($_GET['page'], 'wp-slim') === false && $_hook != 'edit.php'){
569
- return;
570
- }
571
- wp_register_style('wp-slimstat', plugins_url('/admin/css/slimstat.css', dirname(__FILE__)));
572
- wp_enqueue_style('wp-slimstat');
573
 
574
- if (!empty($_hook) && !empty(wp_slimstat::$options['custom_css'])){
575
- wp_add_inline_style('wp-slimstat', wp_slimstat::$options['custom_css']);
576
  }
577
  }
578
  // end wp_slimstat_stylesheet
@@ -632,7 +633,7 @@ class wp_slimstat_admin{
632
  $new_entry = array();
633
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
634
  $new_entry[] = add_menu_page(__('SlimStat','wp-slimstat'), __('SlimStat','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
635
- $new_entry[] = add_submenu_page('wp-slim-view-1', __('Real-Time Log','wp-slimstat'), __('Real-Time Log','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
636
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Overview','wp-slimstat'), __('Overview','wp-slimstat'), $minimum_capability, 'wp-slim-view-2', array(__CLASS__, 'wp_slimstat_include_view'));
637
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Audience','wp-slimstat'), __('Audience','wp-slimstat'), $minimum_capability, 'wp-slim-view-3', array(__CLASS__, 'wp_slimstat_include_view'));
638
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Site Analysis','wp-slimstat'), __('Site Analysis','wp-slimstat'), $minimum_capability, 'wp-slim-view-4', array(__CLASS__, 'wp_slimstat_include_view'));
@@ -967,7 +968,7 @@ class wp_slimstat_admin{
967
  }
968
  ?></tbody>
969
  </table>
970
- <?php if ($_current_tab != 7): ?><p class="submit"><input type="submit" value="<?php _e('Save Changes','wp-slimstat') ?>" class="button-primary" name="Submit"></p><?php endif ?>
971
  </form><?php
972
  }
973
 
11
  */
12
  public static function init(){
13
  if ((wp_slimstat::$options['enable_ads_network'] == 'yes' || wp_slimstat::$options['enable_ads_network'] == 'no')){
14
+ self::$admin_notice = "Join us in welcoming our new partner <a href='' target='_blank'>GetSocial.io</a>, a service that allows you to find your true influencers and understand which users are driving your traffic and conversions through their shares. Our users get <strong>free access</strong> to their platform through a new report located in the Site Analysis screen. We hope you will enjoy all the benefits of social media analytics. Please note: by enabling this feature, you agree to have Slimstat send GetSocial your posts' URLs once daily for analysis. No other information is disclosed. You can always opt-out and deactivate this functionality by using the corresponding option under Settings > Reports.";
15
+ // self::$admin_notice = "We are still getting support requests from users having issues with Slimstat because of the Geolite add-on that was distributed a few months ago. If you are still using this separate add-on, we'd like to remind you that Slimstat 4 introduced a new more intuitive way of managing the MaxMind Geolocation database bundled with our software. Actually, the free Geolite plugin <strong>is not compatible</strong> with the latest version of Slimstat, because of the IPv6 support we implemented. We recommend that you uninstall the add-on from your systems, thus improving the overall performance of your website. As usual, do not hesitate to contact us if you have any questions.";
16
  self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">I got it, thanks</a>';
17
  }
18
  else {
110
  add_filter('manage_pages_columns', array(__CLASS__, 'add_column_header'));
111
  add_action('manage_posts_custom_column', array(__CLASS__, 'add_post_column'), 10, 2);
112
  add_action('manage_pages_custom_column', array(__CLASS__, 'add_post_column'), 10, 2);
113
+
114
+ if( strpos( $_SERVER['REQUEST_URI'], '/wp-admin/edit.php' ) !== false ) {
115
+ add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet'));
116
+ }
117
  }
118
 
119
  // Add some inline CSS to customize the icon associated to SlimStat in the sidebar
206
  if (function_exists('apply_filters')){
207
  $my_wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']);
208
  }
209
+
210
  // Create the tables
211
  self::init_tables($my_wpdb);
212
 
568
  /**
569
  * Loads a custom stylesheet file for the administration panels
570
  */
571
+ public static function wp_slimstat_stylesheet( $_hook = '' ) {
572
+ wp_register_style( 'wp-slimstat', plugins_url( '/admin/css/slimstat.css', dirname( __FILE__ ) ) );
573
+ wp_enqueue_style( 'wp-slimstat' );
 
 
 
574
 
575
+ if ( !empty( wp_slimstat::$options[ 'custom_css' ] ) ) {
576
+ wp_add_inline_style( 'wp-slimstat', wp_slimstat::$options[ 'custom_css' ] );
577
  }
578
  }
579
  // end wp_slimstat_stylesheet
633
  $new_entry = array();
634
  if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
635
  $new_entry[] = add_menu_page(__('SlimStat','wp-slimstat'), __('SlimStat','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
636
+ $new_entry[] = add_submenu_page('wp-slim-view-1', __('Access Log','wp-slimstat'), __('Access Log','wp-slimstat'), $minimum_capability, 'wp-slim-view-1', array(__CLASS__, 'wp_slimstat_include_view'));
637
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Overview','wp-slimstat'), __('Overview','wp-slimstat'), $minimum_capability, 'wp-slim-view-2', array(__CLASS__, 'wp_slimstat_include_view'));
638
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Audience','wp-slimstat'), __('Audience','wp-slimstat'), $minimum_capability, 'wp-slim-view-3', array(__CLASS__, 'wp_slimstat_include_view'));
639
  $new_entry[] = add_submenu_page('wp-slim-view-1', __('Site Analysis','wp-slimstat'), __('Site Analysis','wp-slimstat'), $minimum_capability, 'wp-slim-view-4', array(__CLASS__, 'wp_slimstat_include_view'));
968
  }
969
  ?></tbody>
970
  </table>
971
+ <?php if ( empty( $_options[ $_current_tab ][ 'include' ] ) ): ?><p class="submit"><input type="submit" value="<?php _e('Save Changes','wp-slimstat') ?>" class="button-primary" name="Submit"></p><?php endif ?>
972
  </form><?php
973
  }
974
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
- Stable tag: 4.1.4.1
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
@@ -59,6 +59,21 @@ Our knowledge base is available on our [support center](http://docs.wp-slimstat.
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  = 4.1.4.1 =
63
  * [Fix] A bug was preventing our Export to Excel add-on from working as expected under certain circumstances (mainly WPMU-related).
64
 
4
  Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
+ Stable tag: 4.1.5
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
59
 
60
  == Changelog ==
61
 
62
+ = 4.1.5 =
63
+ * [New] Welcome our new partner GetSocial.io, a service that allows you to find your true influencers and understand which users are driving your traffic and conversions through their shares. Our users get free access to their platform through a new report located in the Site Analysis screen.
64
+ * [New] Slimstat can now differentiate between viewport size and screen size (or resolution). Two new reports, hidden by default, will enumerate the most popular of both categories.
65
+ * [Update] We implemented a more flexible way to change the number of results returned by the database API (via filter). Documentation to follow soon.
66
+ * [Update] Reports for Top and Recent Events are back. Go say hi, they will be waiting for you under Slimstat > Site Analysis. If you don't see them, you will need to activate them inside the Screen Options tab.
67
+ * [Update] After the report and data API overhaul, it was now the config panels' turn. We revisited the way they are managed, and consolidated how third party add-ons can add their own parameters. All of our add-ons affected by this change have been updated on our repository.
68
+ * [Update] Third party plugins and add-ons have now an easier way to increase the limit on the number of results returned by the data API.
69
+ * [Update] To avoid confusion when a date filter is set, the Real-Time Log has been renamed Access Log.
70
+ * [Update] Code optimizations in the report library/API: function get_raw_results is about to be deprecated. Please contact us if you're using it and would like to know how to proceed from now on.
71
+ * [Fix] Setting the 'is empty' filter would cause a WordPress warning regarding wpdb->prepare.
72
+ * [Fix] The setting to ignore visitors by username was not being saved as expected (thank you, Romain).
73
+ * [Fix] Custom CSS styles were not being properly enqueued (thank you, Romain).
74
+ * [Fix] Quotes in post titles were being escaped twice (better safe than sorry, right? thank you, Victor).
75
+ * [Fix] Bug affecting the Export to Excel add-on.
76
+
77
  = 4.1.4.1 =
78
  * [Fix] A bug was preventing our Export to Excel add-on from working as expected under certain circumstances (mainly WPMU-related).
79
 
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: 4.1.4.1
7
  Author: Camu
8
  Author URI: http://www.wp-slimstat.com/
9
  */
@@ -11,7 +11,7 @@ Author URI: http://www.wp-slimstat.com/
11
  if ( !empty( wp_slimstat::$options ) ) return true;
12
 
13
  class wp_slimstat {
14
- public static $version = '4.1.4.1';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
@@ -1486,6 +1486,7 @@ class wp_slimstat {
1486
  'show_complete_user_agent_tooltip' => $val_no,
1487
  'no_maxmind_warning' => $val_no,
1488
  'enable_sov' => $val_no,
 
1489
 
1490
  // Filters
1491
  'track_users' => $val_yes,
@@ -1679,9 +1680,25 @@ class wp_slimstat {
1679
  // end wp_slimstat_enqueue_tracking_script
1680
 
1681
  /**
1682
- * Removes old entries from the main table
1683
  */
1684
  public static function wp_slimstat_purge(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1685
  $autopurge_interval = intval( self::$options[ 'auto_purge' ] );
1686
  if ( $autopurge_interval <= 0 ) {
1687
  return;
@@ -1729,7 +1746,7 @@ class wp_slimstat {
1729
  $slimstat_config_url = get_admin_url($GLOBALS['blog_id'], "admin.php?page=wp-slim-config");
1730
 
1731
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-header', 'title' => 'Slimstat', 'href' => "{$slimstat_view_url}wp-slim-view-1"));
1732
- $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel1', 'href' => "{$slimstat_view_url}wp-slim-view-1", 'parent' => 'slimstat-header', 'title' => __('Real-Time Log', 'wp-slimstat')));
1733
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel2', 'href' => "{$slimstat_view_url}wp-slim-view-2", 'parent' => 'slimstat-header', 'title' => __('Overview', 'wp-slimstat')));
1734
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel3', 'href' => "{$slimstat_view_url}wp-slim-view-3", 'parent' => 'slimstat-header', 'title' => __('Audience', 'wp-slimstat')));
1735
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel4', 'href' => "{$slimstat_view_url}wp-slim-view-4", 'parent' => 'slimstat-header', 'title' => __('Site Analysis', 'wp-slimstat')));
3
  Plugin Name: WP Slimstat
4
  Plugin URI: http://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
+ Version: 4.1.5
7
  Author: Camu
8
  Author URI: http://www.wp-slimstat.com/
9
  */
11
  if ( !empty( wp_slimstat::$options ) ) return true;
12
 
13
  class wp_slimstat {
14
+ public static $version = '4.1.5';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
1486
  'show_complete_user_agent_tooltip' => $val_no,
1487
  'no_maxmind_warning' => $val_no,
1488
  'enable_sov' => $val_no,
1489
+ 'enable_getsocial' => $val_no,
1490
 
1491
  // Filters
1492
  'track_users' => $val_yes,
1680
  // end wp_slimstat_enqueue_tracking_script
1681
 
1682
  /**
1683
+ * Removes old entries from the main table and performs other daily tasks
1684
  */
1685
  public static function wp_slimstat_purge(){
1686
+ // Send the updated list of posts to GetSocial, if the corresponding option is enabled
1687
+ $all_posts = get_posts( array( 'posts_per_page' => 100 ) );
1688
+ $all_post_urls = array();
1689
+
1690
+ if ( !empty( $all_posts ) ) {
1691
+ foreach( $all_posts as $a_post ) {
1692
+ $all_post_urls[] = parse_url( get_permalink( $a_post->ID ), PHP_URL_PATH );
1693
+ }
1694
+
1695
+ $args = json_encode( array(
1696
+ 'domain' => parse_url( get_site_url(), PHP_URL_HOST ),
1697
+ 'items' => $all_post_urls
1698
+ ) );
1699
+ wp_remote_post( 'http://api.at.sharescount.com/process', array( 'timeout' => 5, 'body' => $args ) );
1700
+ }
1701
+
1702
  $autopurge_interval = intval( self::$options[ 'auto_purge' ] );
1703
  if ( $autopurge_interval <= 0 ) {
1704
  return;
1746
  $slimstat_config_url = get_admin_url($GLOBALS['blog_id'], "admin.php?page=wp-slim-config");
1747
 
1748
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-header', 'title' => 'Slimstat', 'href' => "{$slimstat_view_url}wp-slim-view-1"));
1749
+ $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel1', 'href' => "{$slimstat_view_url}wp-slim-view-1", 'parent' => 'slimstat-header', 'title' => __('Access Log', 'wp-slimstat')));
1750
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel2', 'href' => "{$slimstat_view_url}wp-slim-view-2", 'parent' => 'slimstat-header', 'title' => __('Overview', 'wp-slimstat')));
1751
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel3', 'href' => "{$slimstat_view_url}wp-slim-view-3", 'parent' => 'slimstat-header', 'title' => __('Audience', 'wp-slimstat')));
1752
  $GLOBALS['wp_admin_bar']->add_menu(array('id' => 'slimstat-panel4', 'href' => "{$slimstat_view_url}wp-slim-view-4", 'parent' => 'slimstat-header', 'title' => __('Site Analysis', 'wp-slimstat')));