Slimstat Analytics - Version 4.8.5

Version Description

  • [New] Introduced option to not track pageviews based on the ACCEPT-LANGUAGE header sent by the browser.
  • [New] Introduced option to display a pageview count instead of the percentage in Top reports.
  • [New] Introduced two new reports under the Audience tab: Tob Bots and Top Human Browsers.
  • [Update] Removed the option to hide reports on tabs, as it was confusing users who couldn't find them. Now you can simply use the Customizer to arrange your reports, and place the ones you don't need in the Inactive box.
  • [Update] Rewritten the code that manages which reports are displayed on which screen (Customizer), streamlined data structures and optimized their use. Please update all the add-ons to the latest version available. Don't hesitate to contact us if you have any questions!
  • [Fix] The HTML markup in the opt-out message field was being stripped out (thank you, paulmcmanus).
  • [Fix] Reports could not be properly deleted in the Customizer, if the Slimstat menu was displayed in the Admin Bar.
  • [Fix] A fatal error thrown by the Maxmind library when the data file is corrupted has been addressed.
  • [Fix] The icon filename for Windows 8.1 was incorrect (thank you, Dimitri)
Download this release

Release Info

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

Code changes from version 4.8.4.1 to 4.8.5

CHANGELOG.md CHANGED
@@ -1,4 +1,15 @@
1
  ## Changelog ##
 
 
 
 
 
 
 
 
 
 
 
2
  ### 4.8.4.1 ###
3
  * [Note] As anticipated a few weeks ago, this update drops the information about your visitors' browser plugins, which had been deprecated as not useful and oftentimes unreliable. Please make sure to backup your Slimstat tables if you need to preserve this information for some reason.
4
  * [Update] We received quite a few messages complaining about our decision to change the default position of the Slimstat menu from the sidebar to the admin bar. We are rolling back this change, and we apologize for any confusion this might have caused.
1
  ## Changelog ##
2
+ ### 4.8.5 ###
3
+ * [New] Introduced option to not track pageviews based on the ACCEPT-LANGUAGE header sent by the browser.
4
+ * [New] Introduced option to display a pageview count instead of the percentage in Top reports.
5
+ * [New] Introduced two new reports under the Audience tab: Tob Bots and Top Human Browsers.
6
+ * [Update] Removed the option to hide reports on tabs, as it was confusing users who couldn't find them. Now you can simply use the Customizer to arrange your reports, and place the ones you don't need in the Inactive box.
7
+ * [Update] Rewritten the code that manages which reports are displayed on which screen (Customizer), streamlined data structures and optimized their use. Please update all the add-ons to the latest version available. Don't hesitate to contact us if you have any questions!
8
+ * [Fix] The HTML markup in the opt-out message field was being stripped out (thank you, [paulmcmanus](https://wordpress.org/support/topic/saving-settings-flips-opt-out-message-to-plain-text/)).
9
+ * [Fix] Reports could not be properly deleted in the Customizer, if the Slimstat menu was displayed in the Admin Bar.
10
+ * [Fix] A fatal error thrown by the Maxmind library when the data file is corrupted has been addressed.
11
+ * [Fix] The icon filename for Windows 8.1 was incorrect (thank you, Dimitri)
12
+
13
  ### 4.8.4.1 ###
14
  * [Note] As anticipated a few weeks ago, this update drops the information about your visitors' browser plugins, which had been deprecated as not useful and oftentimes unreliable. Please make sure to backup your Slimstat tables if you need to preserve this information for some reason.
15
  * [Update] We received quite a few messages complaining about our decision to change the default position of the Slimstat menu from the sidebar to the admin bar. We are rolling back this change, and we apologize for any confusion this might have caused.
admin/assets/css/admin.css CHANGED
@@ -553,9 +553,6 @@
553
  margin: 0 10px 10px 0;
554
  min-width: 285px;
555
  }
556
- .slimstat-layout .postbox.invisible h3 {
557
- color: #ccc;
558
- }
559
  .slimstat-layout h3 {
560
  border: 0;
561
  font-weight: 300;
553
  margin: 0 10px 10px 0;
554
  min-width: 285px;
555
  }
 
 
 
556
  .slimstat-layout h3 {
557
  border: 0;
558
  font-weight: 300;
admin/assets/images/platforms/{win8-1.png → win8.1.png} RENAMED
File without changes
admin/assets/js/admin.js CHANGED
@@ -245,7 +245,8 @@ jQuery( function() {
245
  //
246
 
247
  // Clone and delete report placeholders
248
- jQuery( '.slimstat-layout .slimstat-header-buttons a' ).on( 'click', function() {
 
249
  if ( jQuery( this ).hasClass( 'slimstat-font-docs' ) ) {
250
  jQuery( this ).removeClass( 'slimstat-font-docs' ).addClass( 'slimstat-font-trash' ).parents( '.postbox' ).clone( true ).appendTo( jQuery( this ).parents( '.meta-box-sortables' ) );
251
  jQuery( this ).removeClass( 'slimstat-font-trash' ).addClass( 'slimstat-font-docs' );
@@ -261,7 +262,7 @@ jQuery( function() {
261
  var data = {
262
  action: 'meta-box-order',
263
  _ajax_nonce: jQuery( '#meta-box-order-nonce' ).val(),
264
- page: 'slimstat_page_slimlayout',
265
  page_columns: 0
266
  };
267
 
245
  //
246
 
247
  // Clone and delete report placeholders
248
+ jQuery( '.slimstat-layout .slimstat-header-buttons a' ).on( 'click', function( e ) {
249
+ e.preventDefault();
250
  if ( jQuery( this ).hasClass( 'slimstat-font-docs' ) ) {
251
  jQuery( this ).removeClass( 'slimstat-font-docs' ).addClass( 'slimstat-font-trash' ).parents( '.postbox' ).clone( true ).appendTo( jQuery( this ).parents( '.meta-box-sortables' ) );
252
  jQuery( this ).removeClass( 'slimstat-font-trash' ).addClass( 'slimstat-font-docs' );
262
  var data = {
263
  action: 'meta-box-order',
264
  _ajax_nonce: jQuery( '#meta-box-order-nonce' ).val(),
265
+ page: SlimStatAdminParams.page_location + '_page_slimlayout',
266
  page_columns: 0
267
  };
268
 
admin/config/index.php CHANGED
@@ -215,7 +215,8 @@ $settings = array(
215
  ),
216
  'opt_out_message' => array(
217
  'title' => __( 'Opt-out Message', 'wp-slimstat' ),
218
- 'type'=> 'textarea', 'rows' => 4,
 
219
  'use_tag_list' => false,
220
  'use_code_editor' => 'htmlmixed',
221
  'description'=> __( "Customize the message displayed to your visitors here below. Match your website styles and layout by adding the appropriate HTML markup to your message.", 'wp-slimstat' )
@@ -282,7 +283,7 @@ $settings = array(
282
  'type'=> 'section_header'
283
  ),
284
  'external_pages_script' => array(
285
- 'type'=> 'static', 'skip_update' => 'yes',
286
  'title' => __( 'Add the following code to all the non-WordPress pages you would like to track, right before the closing BODY tag. Please make sure to change the protocol of all the URLs to HTTPS, if you external site is using a secure channel.', 'wp-slimstat' ),
287
  'use_tag_list' => false,
288
  'description'=> '<script type="text/javascript">
@@ -323,43 +324,37 @@ var SlimStatParams = {
323
  'after_input_field' => __( 'days', 'wp-slimstat' ),
324
  'description' => __( 'Default number of days in the time window used to generate all the reports. We set it to 4 weeks so that the comparison charts will overlap nicely (i.e. Monday over Monday) for a more meaningful analysis. This value is ignored if the option here above is turned on.', 'wp-slimstat' )
325
  ),
326
- 'async_load' => array(
327
- 'title' => __( 'Async Mode', 'wp-slimstat' ),
328
- 'type' => 'toggle',
329
- 'description' => __( 'Activate this feature if your reports take a while to load. It breaks down the load on your server into multiple smaller requests, thus avoiding memory issues and performance problems.', 'wp-slimstat' )
330
- ),
331
  'rows_to_show' => array(
332
  'title' => __( 'Rows to Display', 'wp-slimstat' ),
333
  'type' => 'integer',
334
  'after_input_field' => __( 'rows', 'wp-slimstat' ),
335
  'description' => __( 'Define the number of rows to display in Top and Recent reports. You can adjust this number to improve your server performance.', 'wp-slimstat' )
336
  ),
337
- 'limit_results' => array(
338
- 'title' => __( 'SQL Limit', 'wp-slimstat' ),
339
- 'type' => 'integer',
340
- 'after_input_field' => __( 'rows', 'wp-slimstat' ),
341
- 'description' => __( "You can limit the number of records that each SQL query will take into consideration when crunching aggregate values (maximum, average, etc). You might need to adjust this value if you're getting an error saying that you exceeded your PHP memory limit while accessing the statistics.", 'wp-slimstat' )
342
- ),
343
  'ip_lookup_service' => array(
344
  'title' => __( 'IP Geolocation', 'wp-slimstat' ),
345
  'type'=> 'text',
346
  'description'=> __( 'Customize the URL of the geolocation service to be used in the Access Log. Default value: <code>https://www.infosniper.net/?ip_address=</code>', 'wp-slimstat' )
347
  ),
348
  'comparison_chart' => array(
349
- 'title' => __( 'Comparison Chart', 'wp-slimstat'),
350
  'type'=> 'toggle',
351
- 'description'=> __( "Slimstat displays two sets of charts, allowing you to compare the current time window with the previous one. Disable this option if you find those four charts confusing, and prefer seeing only the selected time range. Please keep in mind that you can always temporarily hide one series by clicking on the corresponding entry in the ", 'wp-slimstat' )
352
  ),
353
  'show_display_name' => array(
354
- 'title' => __( 'Use Display Name', 'wp-slimstat'),
355
  'type'=> 'toggle',
356
  'description'=> __( 'By default, users are listed by their usernames. Enable this option to show their display names instead.', 'wp-slimstat' )
357
  ),
358
  'convert_resource_urls_to_titles' => array(
359
- 'title' => __( 'Use Titles', 'wp-slimstat' ),
360
  'type'=> 'toggle',
361
  'description'=> __( 'For improved legibility, most reports list post and page titles instead of their permalinks. Use this option to change this behavior.', 'wp-slimstat' )
362
  ),
 
 
 
 
 
363
  'convert_ip_addresses' => array(
364
  'title' => __( 'Show Hostnames', 'wp-slimstat' ),
365
  'type'=> 'toggle',
@@ -418,6 +413,17 @@ var SlimStatParams = {
418
  'type'=> 'toggle',
419
  'description'=> __( 'Enable this option if you want to see the full user agent string when hovering over each browser icon in the Access Log and elsewhere.', 'wp-slimstat' )
420
  ),
 
 
 
 
 
 
 
 
 
 
 
421
  'enable_sov' => array(
422
  'title' => __( 'Enable SOV', 'wp-slimstat' ),
423
  'type'=> 'toggle',
@@ -472,7 +478,12 @@ var SlimStatParams = {
472
  'ignore_countries' => array(
473
  'title' => __( 'Countries', 'wp-slimstat' ),
474
  'type'=> 'textarea',
475
- 'description'=> __( 'Enter a list of lowercase <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" target="_blank">ISO 3166-1 country codes</a> (i.e.: <code>en-us, it, es</code>) that should not be tracked. Please note: this field does not allow wildcards.', 'wp-slimstat' )
 
 
 
 
 
476
  ),
477
  'ignore_browsers' => array(
478
  'title' => __( 'User Agents', 'wp-slimstat' ),
215
  ),
216
  'opt_out_message' => array(
217
  'title' => __( 'Opt-out Message', 'wp-slimstat' ),
218
+ 'type'=> 'textarea',
219
+ 'rows' => 4,
220
  'use_tag_list' => false,
221
  'use_code_editor' => 'htmlmixed',
222
  'description'=> __( "Customize the message displayed to your visitors here below. Match your website styles and layout by adding the appropriate HTML markup to your message.", 'wp-slimstat' )
283
  'type'=> 'section_header'
284
  ),
285
  'external_pages_script' => array(
286
+ 'type'=> 'readonly',
287
  'title' => __( 'Add the following code to all the non-WordPress pages you would like to track, right before the closing BODY tag. Please make sure to change the protocol of all the URLs to HTTPS, if you external site is using a secure channel.', 'wp-slimstat' ),
288
  'use_tag_list' => false,
289
  'description'=> '&lt;script type="text/javascript"&gt;
324
  'after_input_field' => __( 'days', 'wp-slimstat' ),
325
  'description' => __( 'Default number of days in the time window used to generate all the reports. We set it to 4 weeks so that the comparison charts will overlap nicely (i.e. Monday over Monday) for a more meaningful analysis. This value is ignored if the option here above is turned on.', 'wp-slimstat' )
326
  ),
 
 
 
 
 
327
  'rows_to_show' => array(
328
  'title' => __( 'Rows to Display', 'wp-slimstat' ),
329
  'type' => 'integer',
330
  'after_input_field' => __( 'rows', 'wp-slimstat' ),
331
  'description' => __( 'Define the number of rows to display in Top and Recent reports. You can adjust this number to improve your server performance.', 'wp-slimstat' )
332
  ),
 
 
 
 
 
 
333
  'ip_lookup_service' => array(
334
  'title' => __( 'IP Geolocation', 'wp-slimstat' ),
335
  'type'=> 'text',
336
  'description'=> __( 'Customize the URL of the geolocation service to be used in the Access Log. Default value: <code>https://www.infosniper.net/?ip_address=</code>', 'wp-slimstat' )
337
  ),
338
  'comparison_chart' => array(
339
+ 'title' => __( 'Comparison Chart', 'wp-slimstat' ),
340
  'type'=> 'toggle',
341
+ 'description'=> __( "Slimstat displays two sets of charts, allowing you to compare the current time window with the previous one. Disable this option if you find those four charts confusing, and prefer seeing only the selected time range. Please keep in mind that you can always temporarily hide one series by clicking on the corresponding entry in the legend.", 'wp-slimstat' )
342
  ),
343
  'show_display_name' => array(
344
+ 'title' => __( 'Use Display Name', 'wp-slimstat' ),
345
  'type'=> 'toggle',
346
  'description'=> __( 'By default, users are listed by their usernames. Enable this option to show their display names instead.', 'wp-slimstat' )
347
  ),
348
  'convert_resource_urls_to_titles' => array(
349
+ 'title' => __( 'Display Titles', 'wp-slimstat' ),
350
  'type'=> 'toggle',
351
  'description'=> __( 'For improved legibility, most reports list post and page titles instead of their permalinks. Use this option to change this behavior.', 'wp-slimstat' )
352
  ),
353
+ 'show_hits' => array(
354
+ 'title' => __( 'Display Hits', 'wp-slimstat' ),
355
+ 'type'=> 'toggle',
356
+ 'description'=> __( 'By default, Top and Recent reports display the percentage of pageviews compared to the total for each entry, and the actual number of hits on hover in a tooltip. Enable this feature if you prefer to see the number of hits directly and the percentage in the tooltip.', 'wp-slimstat' )
357
+ ),
358
  'convert_ip_addresses' => array(
359
  'title' => __( 'Show Hostnames', 'wp-slimstat' ),
360
  'type'=> 'toggle',
413
  'type'=> 'toggle',
414
  'description'=> __( 'Enable this option if you want to see the full user agent string when hovering over each browser icon in the Access Log and elsewhere.', 'wp-slimstat' )
415
  ),
416
+ 'async_load' => array(
417
+ 'title' => __( 'Async Mode', 'wp-slimstat' ),
418
+ 'type' => 'toggle',
419
+ 'description' => __( 'Activate this feature if your reports take a while to load. It breaks down the load on your server into multiple smaller requests, thus avoiding memory issues and performance problems.', 'wp-slimstat' )
420
+ ),
421
+ 'limit_results' => array(
422
+ 'title' => __( 'SQL Limit', 'wp-slimstat' ),
423
+ 'type' => 'integer',
424
+ 'after_input_field' => __( 'rows', 'wp-slimstat' ),
425
+ 'description' => __( "You can limit the number of records that each SQL query will take into consideration when crunching aggregate values (maximum, average, etc). You might need to adjust this value if you're getting an error saying that you exceeded your PHP memory limit while accessing the statistics.", 'wp-slimstat' )
426
+ ),
427
  'enable_sov' => array(
428
  'title' => __( 'Enable SOV', 'wp-slimstat' ),
429
  'type'=> 'toggle',
478
  'ignore_countries' => array(
479
  'title' => __( 'Countries', 'wp-slimstat' ),
480
  'type'=> 'textarea',
481
+ 'description'=> __( 'Enter a list of lowercase <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" target="_blank">ISO 3166-1 country codes</a> (i.e.: <code>us, it, es</code>) that should not be tracked. Please note: this field does not allow wildcards.', 'wp-slimstat' )
482
+ ),
483
+ 'ignore_languages' => array(
484
+ 'title' => __( 'Languages', 'wp-slimstat' ),
485
+ 'type'=> 'textarea',
486
+ 'description'=> __( 'Enter a list of lowercase <a href="http://www.lingoes.net/en/translator/langcode.htm" target="_blank">ISO 639-1 language codes</a> (i.e.: <code>en-us, fr-ca, zh-cn</code>) that should not be tracked. Please note: this field does not allow wildcards.', 'wp-slimstat' )
487
  ),
488
  'ignore_browsers' => array(
489
  'title' => __( 'User Agents', 'wp-slimstat' ),
admin/index.php CHANGED
@@ -3,7 +3,9 @@
3
  class wp_slimstat_admin {
4
  public static $screens_info = array();
5
  public static $config_url = '';
 
6
  public static $faulty_fields = array();
 
7
 
8
  protected static $admin_notice = '';
9
  protected static $data_for_column = array(
@@ -16,7 +18,7 @@ class wp_slimstat_admin {
16
  * Init -- Sets things up.
17
  */
18
  public static function init() {
19
- self::$admin_notice = "We recently received an email from one of our users suggesting that we replace the line charts currently used to display reports over a timeline with <strong>bar charts</strong>, because 'the number of pageviews and IPs are discrete numbers, hence they should also be presented as discrete numbers', according to him. What do you think? Please let us know by <a href='https://support.wp-slimstat.com/' target='_blank'>sending us a message</a> on our support platform. Thank you.";
20
  // self::$admin_notice = "In this day and age where every single social media platform knows our individual whereabouts on the Interwebs, we have been doing some research to implement what techies out there call <a href='https://amiunique.org/fp' target='_blank'>browser fingerprinting</a>. With this technique, it is not necessary to install any form of cookie on the user browser to collect a fingerprint. This means that the act of fingerprinting a specific browser is stateless and transparent, and thus much more accurate on average than relying on cookies. We are already wearing our lab coats and are hard at work to identify ways to leverage <a href='https://github.com/Valve/fingerprintjs2' target='_blank'>tools like Fingerprint2</a> in Slimstat. This will also allow the tracker to record things like the user's timezone: wouldn't it be nice to know what time it was for the user who was visiting your website? Of course, if you have Privacy Mode enabled, this feature will not be used, in compliance with GDPR and other international privacy laws. Stay tuned!";
21
 
22
  // Load language files
@@ -79,6 +81,16 @@ class wp_slimstat_admin {
79
  // Settings URL
80
  self::$config_url = 'admin.php?page=slimconfig&amp;tab=';
81
 
 
 
 
 
 
 
 
 
 
 
82
  // WPMU - New blog created
83
  $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
84
  if ( !empty( $active_sitewide_plugins[ 'wp-slimstat/wp-slimstat.php' ] ) ) {
@@ -88,9 +100,6 @@ class wp_slimstat_admin {
88
  // WPMU - Blog Deleted
89
  add_filter( 'wpmu_drop_tables', array( __CLASS__, 'drop_tables' ), 10, 2 );
90
 
91
- // Screen options: hide/show panels to customize your view
92
- add_filter( 'screen_settings', array( __CLASS__, 'screen_settings' ), 10, 2 );
93
-
94
  // Display a notice that hightlights this version's features
95
  if ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slimview' ) !== false ) {
96
  if ( !empty( self::$admin_notice ) && wp_slimstat::$settings[ 'notice_latest_news' ] == 'on' && is_super_admin() ) {
@@ -145,14 +154,14 @@ class wp_slimstat_admin {
145
  }
146
 
147
  // Load the library of functions to generate the reports
148
- if ( ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slimview' ) !== false ) || ( !empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'slimstat_load_report' ) ) {
149
  include_once( plugin_dir_path( __FILE__ ) . 'view/wp-slimstat-reports.php' );
150
  wp_slimstat_reports::init();
151
 
152
  if ( !empty( $_POST[ 'report_id' ] ) ) {
153
  $report_id = sanitize_title( $_POST[ 'report_id' ], 'slim_p0_00' );
154
 
155
- if ( !empty( wp_slimstat_reports::$reports_info[ $report_id ] ) ) {
156
  add_action( 'wp_ajax_slimstat_load_report', array( 'wp_slimstat_reports', 'callback_wrapper' ), 10, 2 );
157
  }
158
  }
@@ -166,6 +175,7 @@ class wp_slimstat_admin {
166
  add_action( 'admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_enqueue_scripts' ) );
167
  add_action( 'admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet' ) );
168
  }
 
169
  add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_dashboard_widgets' ) );
170
  }
171
 
@@ -351,25 +361,6 @@ class wp_slimstat_admin {
351
  public static function update_tables_and_options() {
352
  $my_wpdb = apply_filters( 'slimstat_custom_wpdb', $GLOBALS[ 'wpdb' ] );
353
 
354
- // --- Updates for version 4.7.8 ---
355
- if ( version_compare( wp_slimstat::$settings[ 'version' ], '4.7.8', '<' ) ) {
356
- // The Geolocation screen has been removed, and the World Map has been moved to the Audience tab
357
- $page_location = ( wp_slimstat::$settings[ 'use_separate_menu' ] == 'no' ) ? 'slimstat' : 'admin';
358
- $user_reports = get_user_option( "meta-box-order_{$page_location}_page_slimlayout", $GLOBALS[ 'current_user' ]->ID );
359
-
360
- if ( !empty( $user_reports[ 'slimview6' ] ) ) {
361
- if ( !empty( $user_reports[ 'slimview3' ] ) ) {
362
- $user_reports[ 'slimview3' ] = $user_reports[ 'slimview3' ] . ',' . $user_reports[ 'slimview6' ];
363
- }
364
- else {
365
- $user_reports[ 'slimview3' ] = $user_reports[ 'slimview6' ];
366
- }
367
- }
368
-
369
- update_user_option( $GLOBALS[ 'current_user' ]->ID, "meta-box-order_{$page_location}_page_slimlayout", $user_reports );
370
- }
371
- // --- END: Updates for version 4.7.8 ---
372
-
373
  // --- Updates for version 4.7.8.2 ---
374
  if ( version_compare( wp_slimstat::$settings[ 'version' ], '4.7.8.2', '<' ) ) {
375
  wp_slimstat::$settings[ 'opt_out_message' ] = '<p style="display:block;position:fixed;left:0;bottom:0;margin:0;padding:1em 2em;background-color:#eee;width:100%;z-index:99999;">This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.<br><br><a href="#" onclick="javascript:SlimStat.optout(event, false);">Accept</a> or <a href="#" onclick="javascript:SlimStat.optout(event, true);">Deny</a></p>';
@@ -455,21 +446,13 @@ class wp_slimstat_admin {
455
  return;
456
  }
457
 
 
458
  include_once( plugin_dir_path( __FILE__ ) . 'view/wp-slimstat-reports.php' );
459
  wp_slimstat_reports::init();
460
 
461
- if ( !empty( wp_slimstat_reports::$user_reports[ 'dashboard' ] ) ) {
462
- $dashboard_reports = explode( ',', wp_slimstat_reports::$user_reports[ 'dashboard' ] );
463
- foreach ( $dashboard_reports as $a_report_id ) {
464
- wp_add_dashboard_widget( $a_report_id, wp_slimstat_reports::$reports_info[ $a_report_id ][ 'title' ], array( 'wp_slimstat_reports', 'callback_wrapper' ) );
465
- }
466
- }
467
- else {
468
- foreach ( wp_slimstat_reports::$reports_info as $a_report_id => $a_report_info ) {
469
- if ( in_array( 'dashboard', $a_report_info[ 'screens' ] ) ) {
470
- // When called this way, callback_wrapper receives just the report_id as the SECOND parameter
471
- wp_add_dashboard_widget( $a_report_id, $a_report_info[ 'title' ], array( 'wp_slimstat_reports', 'callback_wrapper' ) );
472
- }
473
  }
474
  }
475
  }
@@ -531,7 +514,7 @@ class wp_slimstat_admin {
531
  wp_enqueue_script( 'jquery-ui-datepicker' );
532
 
533
  // Enqueue the built-in code editor to use on the Settings
534
- if ( !empty( $_REQUEST[ 'page' ] ) && $_REQUEST[ 'page' ] == 'slimconfig' ) {
535
  wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
536
  }
537
 
@@ -541,7 +524,8 @@ class wp_slimstat_admin {
541
  $params = array(
542
  'async_load' => !empty( wp_slimstat::$settings[ 'async_load' ] ) ? wp_slimstat::$settings[ 'async_load' ] : 'no',
543
  'datepicker_image' => plugins_url( '/admin/assets/images/datepicker.png', dirname( __FILE__ ) ),
544
- 'refresh_interval' => intval( wp_slimstat::$settings[ 'refresh_interval' ] )
 
545
  );
546
  wp_localize_script( 'slimstat_admin', 'SlimStatAdminParams', $params );
547
  }
@@ -573,10 +557,9 @@ class wp_slimstat_admin {
573
  }
574
 
575
  $current_user = wp_get_current_user();
576
- $user_reports = get_user_option( "meta-box-order_{$page_location}_page_slimlayout", $current_user->ID );
577
 
578
  foreach ( self::$screens_info as $a_screen_id => $a_screen_info ) {
579
- if ( $a_screen_info[ 'show_in_sidebar' ] && ( !is_array( $user_reports ) || !empty( $user_reports[ $a_screen_id ] ) || !$a_screen_info[ 'is_report_group' ] ) ) {
580
  $new_entry[] = add_submenu_page( $parent, $a_screen_info[ 'title' ], $a_screen_info[ 'title' ], $minimum_capability, $a_screen_id, $a_screen_info[ 'callback' ] );
581
  }
582
  }
@@ -848,40 +831,6 @@ class wp_slimstat_admin {
848
  }
849
  // END: hide_addons
850
 
851
- /**
852
- * Displays a tab to customize this user's screen options (what boxes to see/hide)
853
- */
854
- public static function screen_settings( $_current = '', $_screen ) {
855
- if ( strpos( $_screen->id, 'page_slimview' ) === false ) {
856
- return $_current;
857
- }
858
-
859
- $current = '<form id="adv-settings" action="" method="post"><h5>' . __( 'Show on screen', 'wp-slimstat') . '</h5><div class="metabox-prefs">';
860
-
861
- // The Reports Library wp_slimstat_reports has already been loaded at this point
862
- foreach( wp_slimstat_reports::$reports_info as $a_report_id => $a_report_info ) {
863
- if ( !is_array( $a_report_info[ 'classes' ] ) ) {
864
- continue;
865
- }
866
-
867
- $checked = !in_array( 'hidden', $a_report_info[ 'classes' ] ) ? ' checked="checked"' : '';
868
-
869
- $current .= "
870
- <label for='$a_report_id-hide'>
871
- <input class='hide-postbox-tog' name='$a_report_id-hide' type='checkbox' id='$a_report_id-hide' value='$a_report_id'$checked />{$a_report_info[ 'title' ]}
872
- </label>";
873
- }
874
- $current .= wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', true, false ) . "</div></form>";
875
-
876
- // Some panels don't have any screen options
877
- if ( strpos( $current, 'label' ) === false) {
878
- return $_current;
879
- }
880
-
881
- return $current;
882
- }
883
- // END: screen_settings
884
-
885
  /**
886
  * Displays an alert message
887
  */
@@ -1041,14 +990,13 @@ class wp_slimstat_admin {
1041
  'after_input_field' => '',
1042
  'custom_label_yes' => '',
1043
  'custom_label_no' => '',
1044
- 'readonly' => false,
1045
  'use_tag_list' => true,
1046
  'use_code_editor' => '',
1047
  'select_values' => array(),
1048
  'default_value' => ''
1049
  ), $_setting_info );
1050
 
1051
- $is_readonly = ( !empty( $_setting_info[ 'readonly' ] ) && $_setting_info[ 'readonly' ] === true ) ? ' readonly' : '';
1052
  $use_tag_list = ( empty( $is_readonly ) && !empty( $_setting_info[ 'use_tag_list' ] ) && $_setting_info[ 'use_tag_list' ] === true ) ? ' slimstat-taglist' : '';
1053
  $use_code_editor = ( empty( $is_readonly ) && !empty( $_setting_info[ 'use_code_editor' ] ) ) ? ' data-code-editor="' . $_setting_info[ 'use_code_editor' ] . '"': '';
1054
 
@@ -1070,7 +1018,7 @@ class wp_slimstat_admin {
1070
  echo '<td colspan="2" class="slimstat-options-section-header" id="wp-slimstat-' . sanitize_title( $_setting_info[ 'title' ] ) . '">' . $_setting_info[ 'title' ] . '</td>';
1071
  break;
1072
 
1073
- case 'static':
1074
  echo '<td colspan="2">' . $_setting_info[ 'title' ] . '<textarea rows="7" class="large-text code" readonly>' . $_setting_info[ 'description' ] . '</textarea></td>';
1075
  break;
1076
 
@@ -1176,7 +1124,7 @@ class wp_slimstat_admin {
1176
 
1177
  foreach( $_settings as $_setting_slug => $_setting_info ) {
1178
  // Some options require a special treatment and are updated somewhere else
1179
- if ( isset( $_setting_info[ 'skip_update' ] ) || isset( $_setting_info[ 'readonly' ] ) || $_setting_info[ 'type' ] == 'section_header' || $_setting_info[ 'type' ] == 'plain-text' ) {
1180
  continue;
1181
  }
1182
 
@@ -1185,7 +1133,7 @@ class wp_slimstat_admin {
1185
  wp_slimstat::$settings[ $_setting_slug ] = 'no';
1186
  }
1187
  else if ( isset( $_POST[ 'options' ][ $_setting_slug ] ) ) {
1188
- wp_slimstat::$settings[ $_setting_slug ] = sanitize_text_field( $_POST[ 'options' ][ $_setting_slug ] );
1189
  }
1190
 
1191
  // If the Network Settings add-on is enabled, there might be a switch to decide if this option needs to override what single sites have set
3
  class wp_slimstat_admin {
4
  public static $screens_info = array();
5
  public static $config_url = '';
6
+ public static $current_screen = 'slimview1';
7
  public static $faulty_fields = array();
8
+ public static $page_location = 'slimstat';
9
 
10
  protected static $admin_notice = '';
11
  protected static $data_for_column = array(
18
  * Init -- Sets things up.
19
  */
20
  public static function init() {
21
+ self::$admin_notice = "Recently, we asked our users to help us decide if we should replace line charts with bar charts, and... the people of Slimstat have spoken! Based on the feedback we received, users were more or less evenly split between the two options, so we've decided that we'll provide both options. Yes, you read that right. We are going to add a new set of reports using the bar chart view, and then let admins choose which ones to display via the Customizer. It will even be possible to mix and match charts, if that's what you prefer. In order to prepare for this new feature, we rewrote the code that manages which reports are displayed on which screen (via the Customizer), streamlined data structures and optimized their use. Please update all the add-ons to the latest version available. Don't hesitate to contact us if you have any questions!";
22
  // self::$admin_notice = "In this day and age where every single social media platform knows our individual whereabouts on the Interwebs, we have been doing some research to implement what techies out there call <a href='https://amiunique.org/fp' target='_blank'>browser fingerprinting</a>. With this technique, it is not necessary to install any form of cookie on the user browser to collect a fingerprint. This means that the act of fingerprinting a specific browser is stateless and transparent, and thus much more accurate on average than relying on cookies. We are already wearing our lab coats and are hard at work to identify ways to leverage <a href='https://github.com/Valve/fingerprintjs2' target='_blank'>tools like Fingerprint2</a> in Slimstat. This will also allow the tracker to record things like the user's timezone: wouldn't it be nice to know what time it was for the user who was visiting your website? Of course, if you have Privacy Mode enabled, this feature will not be used, in compliance with GDPR and other international privacy laws. Stay tuned!";
23
 
24
  // Load language files
81
  // Settings URL
82
  self::$config_url = 'admin.php?page=slimconfig&amp;tab=';
83
 
84
+ // Current Screen
85
+ if ( !empty( $_REQUEST[ 'page' ] ) && array_key_exists( $_REQUEST[ 'page' ], self::$screens_info ) ) {
86
+ self::$current_screen = $_REQUEST[ 'page' ];
87
+ }
88
+
89
+ // Page Location
90
+ if ( wp_slimstat::$settings[ 'use_separate_menu' ] != 'no' ) {
91
+ self::$page_location = 'admin';
92
+ }
93
+
94
  // WPMU - New blog created
95
  $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
96
  if ( !empty( $active_sitewide_plugins[ 'wp-slimstat/wp-slimstat.php' ] ) ) {
100
  // WPMU - Blog Deleted
101
  add_filter( 'wpmu_drop_tables', array( __CLASS__, 'drop_tables' ), 10, 2 );
102
 
 
 
 
103
  // Display a notice that hightlights this version's features
104
  if ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slimview' ) !== false ) {
105
  if ( !empty( self::$admin_notice ) && wp_slimstat::$settings[ 'notice_latest_news' ] == 'on' && is_super_admin() ) {
154
  }
155
 
156
  // Load the library of functions to generate the reports
157
+ if ( ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slim' ) === 0 ) || ( !empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'slimstat_load_report' ) ) {
158
  include_once( plugin_dir_path( __FILE__ ) . 'view/wp-slimstat-reports.php' );
159
  wp_slimstat_reports::init();
160
 
161
  if ( !empty( $_POST[ 'report_id' ] ) ) {
162
  $report_id = sanitize_title( $_POST[ 'report_id' ], 'slim_p0_00' );
163
 
164
+ if ( !empty( wp_slimstat_reports::$reports[ $report_id ] ) ) {
165
  add_action( 'wp_ajax_slimstat_load_report', array( 'wp_slimstat_reports', 'callback_wrapper' ), 10, 2 );
166
  }
167
  }
175
  add_action( 'admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_enqueue_scripts' ) );
176
  add_action( 'admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet' ) );
177
  }
178
+
179
  add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_dashboard_widgets' ) );
180
  }
181
 
361
  public static function update_tables_and_options() {
362
  $my_wpdb = apply_filters( 'slimstat_custom_wpdb', $GLOBALS[ 'wpdb' ] );
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  // --- Updates for version 4.7.8.2 ---
365
  if ( version_compare( wp_slimstat::$settings[ 'version' ], '4.7.8.2', '<' ) ) {
366
  wp_slimstat::$settings[ 'opt_out_message' ] = '<p style="display:block;position:fixed;left:0;bottom:0;margin:0;padding:1em 2em;background-color:#eee;width:100%;z-index:99999;">This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.<br><br><a href="#" onclick="javascript:SlimStat.optout(event, false);">Accept</a> or <a href="#" onclick="javascript:SlimStat.optout(event, true);">Deny</a></p>';
446
  return;
447
  }
448
 
449
+ // The Reports library is only loaded on the plugin's screens
450
  include_once( plugin_dir_path( __FILE__ ) . 'view/wp-slimstat-reports.php' );
451
  wp_slimstat_reports::init();
452
 
453
+ if ( !empty( wp_slimstat_reports::$user_reports[ 'dashboard' ] ) && is_array( wp_slimstat_reports::$user_reports[ 'dashboard' ] ) ) {
454
+ foreach ( wp_slimstat_reports::$user_reports[ 'dashboard' ] as $a_report_id ) {
455
+ wp_add_dashboard_widget( $a_report_id, wp_slimstat_reports::$reports[ $a_report_id ][ 'title' ], array( 'wp_slimstat_reports', 'callback_wrapper' ) );
 
 
 
 
 
 
 
 
 
456
  }
457
  }
458
  }
514
  wp_enqueue_script( 'jquery-ui-datepicker' );
515
 
516
  // Enqueue the built-in code editor to use on the Settings
517
+ if ( self::$current_screen ) {
518
  wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
519
  }
520
 
524
  $params = array(
525
  'async_load' => !empty( wp_slimstat::$settings[ 'async_load' ] ) ? wp_slimstat::$settings[ 'async_load' ] : 'no',
526
  'datepicker_image' => plugins_url( '/admin/assets/images/datepicker.png', dirname( __FILE__ ) ),
527
+ 'refresh_interval' => intval( wp_slimstat::$settings[ 'refresh_interval' ] ),
528
+ 'page_location' => self::$page_location
529
  );
530
  wp_localize_script( 'slimstat_admin', 'SlimStatAdminParams', $params );
531
  }
557
  }
558
 
559
  $current_user = wp_get_current_user();
 
560
 
561
  foreach ( self::$screens_info as $a_screen_id => $a_screen_info ) {
562
+ if ( $a_screen_info[ 'show_in_sidebar' ] ) {
563
  $new_entry[] = add_submenu_page( $parent, $a_screen_info[ 'title' ], $a_screen_info[ 'title' ], $minimum_capability, $a_screen_id, $a_screen_info[ 'callback' ] );
564
  }
565
  }
831
  }
832
  // END: hide_addons
833
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
834
  /**
835
  * Displays an alert message
836
  */
990
  'after_input_field' => '',
991
  'custom_label_yes' => '',
992
  'custom_label_no' => '',
 
993
  'use_tag_list' => true,
994
  'use_code_editor' => '',
995
  'select_values' => array(),
996
  'default_value' => ''
997
  ), $_setting_info );
998
 
999
+ $is_readonly = ( $_setting_info[ 'type' ] === 'readonly' ) ? ' readonly' : '';
1000
  $use_tag_list = ( empty( $is_readonly ) && !empty( $_setting_info[ 'use_tag_list' ] ) && $_setting_info[ 'use_tag_list' ] === true ) ? ' slimstat-taglist' : '';
1001
  $use_code_editor = ( empty( $is_readonly ) && !empty( $_setting_info[ 'use_code_editor' ] ) ) ? ' data-code-editor="' . $_setting_info[ 'use_code_editor' ] . '"': '';
1002
 
1018
  echo '<td colspan="2" class="slimstat-options-section-header" id="wp-slimstat-' . sanitize_title( $_setting_info[ 'title' ] ) . '">' . $_setting_info[ 'title' ] . '</td>';
1019
  break;
1020
 
1021
+ case 'readonly':
1022
  echo '<td colspan="2">' . $_setting_info[ 'title' ] . '<textarea rows="7" class="large-text code" readonly>' . $_setting_info[ 'description' ] . '</textarea></td>';
1023
  break;
1024
 
1124
 
1125
  foreach( $_settings as $_setting_slug => $_setting_info ) {
1126
  // Some options require a special treatment and are updated somewhere else
1127
+ if ( $_setting_info[ 'type' ] == 'readonly' || $_setting_info[ 'type' ] == 'section_header' || $_setting_info[ 'type' ] == 'plain-text' ) {
1128
  continue;
1129
  }
1130
 
1133
  wp_slimstat::$settings[ $_setting_slug ] = 'no';
1134
  }
1135
  else if ( isset( $_POST[ 'options' ][ $_setting_slug ] ) ) {
1136
+ wp_slimstat::$settings[ $_setting_slug ] = !empty( $_setting_info[ 'use_code_editor' ] ) ? $_POST[ 'options' ][ $_setting_slug ] : sanitize_text_field( $_POST[ 'options' ][ $_setting_slug ] );
1137
  }
1138
 
1139
  // If the Network Settings add-on is enabled, there might be a switch to decide if this option needs to override what single sites have set
admin/view/index.php CHANGED
@@ -146,18 +146,9 @@
146
  <div class="meta-box-sortables">
147
  <form method="get" action=""><input type="hidden" id="meta-box-order-nonce" name="meta-box-order-nonce" value="<?php echo wp_create_nonce('meta-box-order') ?>" /></form><?php
148
 
149
- foreach( wp_slimstat_reports::$reports_info as $a_report_id => $a_report_info ) {
150
- if ( !is_array( $a_report_info[ 'classes' ] ) ) {
151
- continue;
152
- }
153
-
154
  wp_slimstat_reports::report_header( $a_report_id );
155
-
156
- // Third party reports can add their own methods via the callback parameter
157
- if ( !in_array( 'hidden', $a_report_info[ 'classes' ] ) ) {
158
- wp_slimstat_reports::callback_wrapper( array( 'id' => $a_report_id ) );
159
- }
160
-
161
  wp_slimstat_reports::report_footer();
162
  }
163
  ?></div>
146
  <div class="meta-box-sortables">
147
  <form method="get" action=""><input type="hidden" id="meta-box-order-nonce" name="meta-box-order-nonce" value="<?php echo wp_create_nonce('meta-box-order') ?>" /></form><?php
148
 
149
+ foreach( wp_slimstat_reports::$user_reports[ wp_slimstat_admin::$current_screen ] as $a_report_id ) {
 
 
 
 
150
  wp_slimstat_reports::report_header( $a_report_id );
151
+ wp_slimstat_reports::callback_wrapper( array( 'id' => $a_report_id ) );
 
 
 
 
 
152
  wp_slimstat_reports::report_footer();
153
  }
154
  ?></div>
admin/view/layout.php CHANGED
@@ -1,18 +1,4 @@
1
  <?php
2
- include_once( dirname(__FILE__) . '/wp-slimstat-reports.php' );
3
- wp_slimstat_reports::init();
4
-
5
- // Get default report placements
6
- $report_locations = array(
7
- 'inactive' => array(),
8
- 'dashboard' => array(),
9
- 'slimview1' => array(),
10
- 'slimview2' => array(),
11
- 'slimview3' => array(),
12
- 'slimview4' => array(),
13
- 'slimview5' => array()
14
- );
15
-
16
  $is_report_reset = false;
17
  if ( !empty( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'restore-views' ) {
18
  $GLOBALS[ 'wpdb' ]->query( "DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%meta-box-order_admin_page_slimlayout%'" );
@@ -23,33 +9,11 @@
23
  $is_report_reset = true;
24
  }
25
 
26
- if ( empty( wp_slimstat_reports::$user_reports ) || $is_report_reset ) {
27
- foreach ( wp_slimstat_reports::$reports_info as $a_report_id => $a_report_info ) {
28
- if ( !empty( $a_report_info[ 'screens' ] ) ) {
29
- foreach ( $a_report_info[ 'screens' ] as $a_report_screen ) {
30
- if ( isset( $report_locations[ $a_report_screen ] ) ) {
31
- $report_locations[ $a_report_screen ][] = $a_report_id;
32
- }
33
- }
34
- }
35
- }
36
- }
37
- else {
38
- foreach ( $report_locations as $a_location_id => $a_location_list ) {
39
- if ( !empty( wp_slimstat_reports::$user_reports[ $a_location_id ] ) ) {
40
- $report_locations[ $a_location_id ] = explode( ',', wp_slimstat_reports::$user_reports[ $a_location_id ] );
41
- }
42
- else {
43
- $report_locations[ $a_location_id ] = array();
44
- }
45
- }
46
- }
47
 
48
  // Keep track of multiple occurrences of the same report, to allow users to delete duplicates
49
  $already_seen = array();
50
-
51
- $current_user = wp_get_current_user();
52
- $page_location = ( wp_slimstat::$settings[ 'use_separate_menu' ] == 'no' ) ? 'slimstat' : 'admin';
53
  ?>
54
 
55
  <div class="wrap slimstat-layout">
@@ -68,19 +32,13 @@
68
 
69
  <a href="admin.php?page=slimlayout&&amp;action=restore-views" class="button"><?php _e( 'Reset Layout', 'wp-slimstat' ) ?></a>
70
 
71
- <?php foreach ( $report_locations as $a_location_id => $a_location_list ): $hidden_reports = get_user_option( "metaboxhidden_{$page_location}_page_{$a_location_id}", $current_user->ID ); if ( !is_array( $hidden_reports ) ) $hidden_reports = array(); ?>
 
72
  <div id="postbox-container-<?php echo $a_location_id ?>" class="postbox-container">
73
  <h2 class="slimstat-options-section-header"><?php echo wp_slimstat_admin::$screens_info[ $a_location_id ][ 'title' ] ?></h2>
74
  <div id="<?php echo $a_location_id ?>-sortables" class="meta-box-sortables"><?php
75
- if ( $a_location_id != 'inactive' ) {
76
- $move_to_inactive = ' <a class="slimstat-font-minus-circled" href="#" title="' . __( 'Move to Inactive', 'wp-slimstat' ) . '"></a>';
77
- }
78
- else {
79
- $move_to_inactive = '';
80
- }
81
-
82
  foreach( $a_location_list as $a_report_id ) {
83
- if ( empty( wp_slimstat_reports::$reports_info[ $a_report_id ] ) ) {
84
  continue;
85
  }
86
 
@@ -95,17 +53,17 @@
95
  }
96
 
97
  $placeholder_classes = '';
98
- if ( ( in_array( 'hidden', wp_slimstat_reports::$reports_info[ $a_report_id ][ 'classes' ] ) && empty( $hidden_reports ) ) || in_array( $a_report_id, $hidden_reports ) ) {
99
- $placeholder_classes = ' invisible';
100
  }
101
 
102
  echo "
103
  <div class='postbox$placeholder_classes' id='$a_report_id'>
104
  <div class='slimstat-header-buttons'>
105
  <a class='slimstat-font-$icon' href='#' title='$title'></a>
106
- $move_to_inactive
107
  </div>
108
- <h3 class='hndle'>" . wp_slimstat_reports::$reports_info[ $a_report_id ][ 'title' ] . "</h3>
109
  </div>";
110
  } ?>
111
  </div>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  $is_report_reset = false;
3
  if ( !empty( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'restore-views' ) {
4
  $GLOBALS[ 'wpdb' ]->query( "DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%meta-box-order_admin_page_slimlayout%'" );
9
  $is_report_reset = true;
10
  }
11
 
12
+ include_once( dirname(__FILE__) . '/wp-slimstat-reports.php' );
13
+ wp_slimstat_reports::init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  // Keep track of multiple occurrences of the same report, to allow users to delete duplicates
16
  $already_seen = array();
 
 
 
17
  ?>
18
 
19
  <div class="wrap slimstat-layout">
32
 
33
  <a href="admin.php?page=slimlayout&&amp;action=restore-views" class="button"><?php _e( 'Reset Layout', 'wp-slimstat' ) ?></a>
34
 
35
+ <?php foreach ( wp_slimstat_reports::$user_reports as $a_location_id => $a_location_list ): ?>
36
+
37
  <div id="postbox-container-<?php echo $a_location_id ?>" class="postbox-container">
38
  <h2 class="slimstat-options-section-header"><?php echo wp_slimstat_admin::$screens_info[ $a_location_id ][ 'title' ] ?></h2>
39
  <div id="<?php echo $a_location_id ?>-sortables" class="meta-box-sortables"><?php
 
 
 
 
 
 
 
40
  foreach( $a_location_list as $a_report_id ) {
41
+ if ( empty( wp_slimstat_reports::$reports[ $a_report_id ] ) ) {
42
  continue;
43
  }
44
 
53
  }
54
 
55
  $placeholder_classes = '';
56
+ if ( is_array( wp_slimstat_reports::$reports[ $a_report_id ][ 'classes' ] ) ) {
57
+ $placeholder_classes = ' ' . implode( ' ', wp_slimstat_reports::$reports[ $a_report_id ][ 'classes' ] );
58
  }
59
 
60
  echo "
61
  <div class='postbox$placeholder_classes' id='$a_report_id'>
62
  <div class='slimstat-header-buttons'>
63
  <a class='slimstat-font-$icon' href='#' title='$title'></a>
64
+ " . ( ( $a_location_id != 'inactive' ) ? ' <a class="slimstat-font-minus-circled" href="#" title="' . __( 'Move to Inactive', 'wp-slimstat' ) . '"></a>' : '' ) . "
65
  </div>
66
+ <h3 class='hndle'>" . wp_slimstat_reports::$reports[ $a_report_id ][ 'title' ] . "</h3>
67
  </div>";
68
  } ?>
69
  </div>
admin/view/right-now.php CHANGED
@@ -15,7 +15,7 @@ $plugin_url = plugins_url( '', dirname( __FILE__ ) );
15
 
16
  // Get the data
17
  wp_slimstat_db::$debug_message = '';
18
- $all_results = wp_slimstat_db::get_recent( wp_slimstat_reports::$reports_info[ 'slim_p7_02' ][ 'callback_args' ] );
19
  $results = array_slice(
20
  $all_results,
21
  wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ],
15
 
16
  // Get the data
17
  wp_slimstat_db::$debug_message = '';
18
+ $all_results = wp_slimstat_db::get_recent( wp_slimstat_reports::$reports[ 'slim_p7_02' ][ 'callback_args' ] );
19
  $results = array_slice(
20
  $all_results,
21
  wp_slimstat_db::$filters_normalized[ 'misc' ][ 'start_from' ],
admin/view/wp-slimstat-db.php CHANGED
@@ -177,7 +177,9 @@ class wp_slimstat_db {
177
  self::$filters_normalized = self::init_filters( $filters_raw );
178
 
179
  // Retrieve data that will be used by multiple reports
180
- self::$pageviews = wp_slimstat_db::count_records();
 
 
181
  }
182
  // end init
183
 
177
  self::$filters_normalized = self::init_filters( $filters_raw );
178
 
179
  // Retrieve data that will be used by multiple reports
180
+ if ( !empty( $_REQUEST[ 'page' ] ) && !in_array( $_REQUEST[ 'page' ], array( 'slimlayout', 'slimadddons' ) ) ) {
181
+ self::$pageviews = wp_slimstat_db::count_records();
182
+ }
183
  }
184
  // end init
185
 
admin/view/wp-slimstat-reports.php CHANGED
@@ -1,17 +1,14 @@
1
  <?php
2
 
3
  class wp_slimstat_reports {
4
-
5
- // Structures to store all the information about what screens and reports are available
6
- public static $reports_info = array();
7
  public static $user_reports = array();
8
  public static $resource_titles = array();
9
 
10
  /**
11
  * Initalize class properties
12
  */
13
- public static function init(){
14
-
15
  // Include and initialize the API to interact with the database
16
  include_once( 'wp-slimstat-db.php' );
17
  wp_slimstat_db::init();
@@ -22,13 +19,13 @@ class wp_slimstat_reports {
22
  // - title : report name
23
  // - callback : function to use to render the report
24
  // - callback_args : parameters to pass to the function
25
- // - classes : determine the look and feel of this report ( tall, large, extralarge, full-width, hidden )
26
- // - screens : where should the report appear ( slimview1, .., slimview4, dashboard )
27
  // - tooltip : contextual help to be displayed on hover
28
 
29
  $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></ul>';
30
 
31
- self::$reports_info = array(
32
  'slim_p7_02' => array(
33
  'title' => __( 'Access Log', 'wp-slimstat' ),
34
  'callback' => array( __CLASS__, 'show_access_log' ),
@@ -38,7 +35,7 @@ class wp_slimstat_reports {
38
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
39
  ),
40
  'classes' => array( 'full-width', 'tall' ),
41
- 'screens' => array( 'slimview1', 'dashboard' ),
42
  '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> ' . __( 'Has Left Comments', 'wp-slimstat' ) . '</p><p><span class="little-color-box is-known-user"></span> ' . __( 'WP User', 'wp-slimstat' ) . '</p><p><span class="little-color-box is-direct"></span> ' . __( 'Other Human', 'wp-slimstat' ) . '</p><p><span class="little-color-box"></span> ' . __( 'Bot or Crawler', 'wp-slimstat' ) . '</p>'
43
  ),
44
 
@@ -57,7 +54,7 @@ class wp_slimstat_reports {
57
  )
58
  ),
59
  'classes' => array( 'extralarge', 'chart' ),
60
- 'screens' => array( 'slimview2', 'dashboard' ),
61
  'tooltip' => $chart_tooltip
62
  ),
63
  'slim_p1_03' => array(
@@ -67,7 +64,7 @@ class wp_slimstat_reports {
67
  'raw' => array( 'wp_slimstat_db', 'get_overview_summary' )
68
  ),
69
  'classes' => array( 'normal' ),
70
- 'screens' => array( 'slimview2', 'dashboard' )
71
  ),
72
  'slim_p1_04' => array(
73
  'title' => __( 'Currently Online', 'wp-slimstat' ),
@@ -80,7 +77,7 @@ class wp_slimstat_reports {
80
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
81
  ),
82
  'classes' => array( 'normal' ),
83
- 'screens' => array( 'slimview2', 'dashboard' )
84
  ),
85
  'slim_p1_06' => array(
86
  'title' => __( 'Recent Search Terms', 'wp-slimstat' ),
@@ -93,7 +90,7 @@ class wp_slimstat_reports {
93
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
94
  ),
95
  'classes' => array( 'normal' ),
96
- 'screens' => array( 'slimview2', 'slimview5' ),
97
  'tooltip' => __( 'Keywords used by your visitors to find your website on a search engine.', 'wp-slimstat' )
98
  ),
99
  'slim_p1_08' => array(
@@ -107,7 +104,7 @@ class wp_slimstat_reports {
107
  'raw' => array( 'wp_slimstat_db', 'get_top' )
108
  ),
109
  'classes' => array( 'normal' ),
110
- 'screens' => array( 'slimview2', 'dashboard' ),
111
  'tooltip' => __( 'Here a "page" is not just a WordPress page type, but any webpage on your site, including posts, products, categories, and any other custom post type. For example, you can set the corresponding filter where Resource Content Type equals cpt:you_cpt_slug_here to get top web pages for a specific custom post type you have.', 'wp-slimstat' )
112
  ),
113
  'slim_p1_10' => array(
@@ -122,7 +119,7 @@ class wp_slimstat_reports {
122
  'raw' => array( 'wp_slimstat_db', 'get_top' )
123
  ),
124
  'classes' => array( 'normal' ),
125
- 'screens' => array( 'slimview2', 'slimview5', 'dashboard' )
126
  ),
127
  'slim_p1_11' => array(
128
  'title' => __( 'Top Known Visitors', 'wp-slimstat' ),
@@ -132,8 +129,8 @@ class wp_slimstat_reports {
132
  'columns' => 'username',
133
  'raw' => array( 'wp_slimstat_db', 'get_top' )
134
  ),
135
- 'classes' => array( 'normal', 'hidden' ),
136
- 'screens' => array( 'slimview2', 'dashboard' )
137
  ),
138
  'slim_p1_12' => array(
139
  'title' => __( 'Top Search Terms', 'wp-slimstat' ),
@@ -145,7 +142,7 @@ class wp_slimstat_reports {
145
  'raw' => array( 'wp_slimstat_db', 'get_top' )
146
  ),
147
  'classes' => array( 'normal' ),
148
- 'screens' => array( 'slimview2', 'slimview4', 'slimview5', 'dashboard' )
149
  ),
150
  'slim_p1_13' => array(
151
  'title' => __( 'Top Countries', 'wp-slimstat' ),
@@ -155,9 +152,9 @@ class wp_slimstat_reports {
155
  'columns' => 'country',
156
  'raw' => array( 'wp_slimstat_db', 'get_top' )
157
  ),
158
- 'classes' => array( 'normal', 'hidden' ),
159
- 'screens' => array( 'slimview2', 'slimview3', 'slimview5', 'dashboard' ),
160
- 'tooltip' => __( 'You can configure Slimstat to not track specific Countries by setting the corresponding filter in Settings > Slimstat > Filters.', 'wp-slimstat' )
161
  ),
162
  'slim_p1_15' => array(
163
  'title' => __( 'Rankings', 'wp-slimstat' ),
@@ -165,8 +162,8 @@ class wp_slimstat_reports {
165
  'callback_args' => array(
166
  'id' => 'slim_p1_15'
167
  ),
168
- 'classes' => array( 'normal', 'hidden' ),
169
- 'screens' => array( 'slimview2' ),
170
  'tooltip' => __( "Slimstat retrieves live information from Alexa, Facebook and Mozscape, to measures your site's rankings. Values are updated every 12 hours. Please enter your personal access ID in the settings to access your personalized Mozscape data.", 'wp-slimstat' )
171
  ),
172
  'slim_p1_17' => array(
@@ -179,8 +176,8 @@ class wp_slimstat_reports {
179
  'filter_op' => 'contains',
180
  'raw' => array( 'wp_slimstat_db', 'get_top' )
181
  ),
182
- 'classes' => array( 'normal', 'hidden' ),
183
- 'screens' => array( 'slimview3' )
184
  ),
185
  'slim_p1_18' => array(
186
  'title' => __( 'Users Currently Online', 'wp-slimstat' ),
@@ -192,11 +189,11 @@ class wp_slimstat_reports {
192
  'use_date_filters' => false,
193
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
194
  ),
195
- 'classes' => array( 'normal', 'hidden' ),
196
- 'screens' => array( 'slimview2', 'dashboard' ),
197
  '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' )
198
  ),
199
- 'slim_p1_19_01' => array( // Chart Reports need to always have a _01 suffix to tell our custom "refresh" code to avoid fading the chart, which apparently doesn't work
200
  'title' => __( 'Search Terms', 'wp-slimstat' ),
201
  'callback' => array( __CLASS__, 'show_chart' ),
202
  'callback_args' => array(
@@ -212,7 +209,7 @@ class wp_slimstat_reports {
212
  )
213
  ),
214
  'classes' => array( 'extralarge', 'chart' ),
215
- 'screens' => array( 'slimview2' ),
216
  'tooltip' => $chart_tooltip
217
  ),
218
  'slim_p1_20' => array(
@@ -225,7 +222,7 @@ class wp_slimstat_reports {
225
  'raw' => array( 'wp_slimstat_db', 'get_top' )
226
  ),
227
  'classes' => array( 'normal' ),
228
- 'screens' => array( 'slimview2', 'slimview5', 'dashboard' )
229
  ),
230
 
231
  'slim_p2_01' => array(
@@ -244,7 +241,7 @@ class wp_slimstat_reports {
244
  )
245
  ),
246
  'classes' => array( 'extralarge', 'chart' ),
247
- 'screens' => array( 'slimview3' ),
248
  'tooltip' => $chart_tooltip
249
  ),
250
  'slim_p2_02' => array(
@@ -254,7 +251,7 @@ class wp_slimstat_reports {
254
  'raw' => array( 'wp_slimstat_db', 'get_visitors_summary' )
255
  ),
256
  'classes' => array( 'normal' ),
257
- 'screens' => array( 'slimview3', 'dashboard' ),
258
  'tooltip' => __( 'Where not otherwise specified, the metrics in this report are referred to human visitors.', 'wp-slimstat' )
259
  ),
260
  'slim_p2_03' => array(
@@ -266,10 +263,10 @@ class wp_slimstat_reports {
266
  'raw' => array( 'wp_slimstat_db', 'get_top' )
267
  ),
268
  'classes' => array( 'normal' ),
269
- 'screens' => array( 'slimview3' )
270
  ),
271
  'slim_p2_04' => array(
272
- 'title' => __( 'Top Browsers', 'wp-slimstat' ),
273
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
274
  'callback_args' => array(
275
  'type' => 'top',
@@ -277,7 +274,8 @@ class wp_slimstat_reports {
277
  'raw' => array( 'wp_slimstat_db', 'get_top' )
278
  ),
279
  'classes' => array( 'normal' ),
280
- 'screens' => array( 'slimview3', 'dashboard' )
 
281
  ),
282
  'slim_p2_05' => array(
283
  'title' => __( 'Top Service Providers', 'wp-slimstat' ),
@@ -287,8 +285,8 @@ class wp_slimstat_reports {
287
  'columns' => 'ip',
288
  'raw' => array( 'wp_slimstat_db', 'get_top' )
289
  ),
290
- 'classes' => array( 'extralarge', 'hidden' ),
291
- 'screens' => array( 'slimview3' ),
292
  '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' )
293
  ),
294
  'slim_p2_06' => array(
@@ -299,8 +297,8 @@ class wp_slimstat_reports {
299
  'columns' => 'platform',
300
  'raw' => array( 'wp_slimstat_db', 'get_top' )
301
  ),
302
- 'classes' => array( 'normal', 'hidden' ),
303
- 'screens' => array( 'slimview3' ),
304
  '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' )
305
  ),
306
  'slim_p2_07' => array(
@@ -313,7 +311,7 @@ class wp_slimstat_reports {
313
  'raw' => array( 'wp_slimstat_db', 'get_top' )
314
  ),
315
  'classes' => array( 'normal' ),
316
- 'screens' => array( 'slimview3', 'dashboard' )
317
  ),
318
  'slim_p2_08' => array(
319
  'title' => __( 'Top Viewport Sizes', 'wp-slimstat' ),
@@ -323,8 +321,8 @@ class wp_slimstat_reports {
323
  'columns' => 'resolution',
324
  'raw' => array( 'wp_slimstat_db', 'get_top' )
325
  ),
326
- 'classes' => array( 'normal', 'hidden' ),
327
- 'screens' => array( 'slimview3' )
328
  ),
329
  'slim_p2_09' => array(
330
  'title' => __( 'Browser Capabilities', 'wp-slimstat' ),
@@ -332,8 +330,8 @@ class wp_slimstat_reports {
332
  'callback_args' => array(
333
  'raw' => array( 'wp_slimstat_db', 'get_plugins' )
334
  ),
335
- 'classes' => array( 'normal', 'hidden' ),
336
- 'screens' => array( 'slimview3' )
337
  ),
338
  'slim_p2_12' => array(
339
  'title' => __( 'Visit Duration', 'wp-slimstat' ),
@@ -341,8 +339,8 @@ class wp_slimstat_reports {
341
  'callback_args' => array(
342
  'raw' => array( 'wp_slimstat_db', 'get_visits_duration' )
343
  ),
344
- 'classes' => array( 'normal', 'hidden' ),
345
- 'screens' => array( 'slimview3' ),
346
  'tooltip' => __( 'All values represent the percentages of pageviews within the corresponding time range.', 'wp-slimstat' )
347
  ),
348
  'slim_p2_13' => array(
@@ -353,8 +351,8 @@ class wp_slimstat_reports {
353
  'columns' => 'country',
354
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
355
  ),
356
- 'classes' => array( 'normal', 'hidden' ),
357
- 'screens' => array( 'slimview3', 'slimview5' )
358
  ),
359
  'slim_p2_14' => array(
360
  'title' => __( 'Recent Viewport Sizes', 'wp-slimstat' ),
@@ -364,8 +362,8 @@ class wp_slimstat_reports {
364
  'columns' => 'resolution',
365
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
366
  ),
367
- 'classes' => array( 'normal', 'hidden' ),
368
- 'screens' => array( 'slimview3' )
369
  ),
370
  'slim_p2_15' => array(
371
  'title' => __( 'Recent Operating Systems', 'wp-slimstat' ),
@@ -375,8 +373,8 @@ class wp_slimstat_reports {
375
  'columns' => 'platform',
376
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
377
  ),
378
- 'classes' => array( 'normal', 'hidden' ),
379
- 'screens' => array( 'slimview3' )
380
  ),
381
  'slim_p2_16' => array(
382
  'title' => __( 'Recent Browsers', 'wp-slimstat' ),
@@ -386,8 +384,8 @@ class wp_slimstat_reports {
386
  'columns' => 'browser, browser_version',
387
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
388
  ),
389
- 'classes' => array( 'normal', 'hidden' ),
390
- 'screens' => array( 'slimview3' )
391
  ),
392
  'slim_p2_17' => array(
393
  'title' => __( 'Recent Languages', 'wp-slimstat' ),
@@ -397,8 +395,8 @@ class wp_slimstat_reports {
397
  'columns' => 'language',
398
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
399
  ),
400
- 'classes' => array( 'normal', 'hidden' ),
401
- 'screens' => array( 'slimview3' )
402
  ),
403
  'slim_p2_18' => array(
404
  'title' => __( 'Top Browser Families', 'wp-slimstat' ),
@@ -408,8 +406,8 @@ class wp_slimstat_reports {
408
  'columns' => 'browser',
409
  'raw' => array( 'wp_slimstat_db', 'get_top' )
410
  ),
411
- 'classes' => array( 'normal', 'hidden' ),
412
- 'screens' => array( 'slimview3' ),
413
  'tooltip' => __( 'This report shows you what user agent families (no version considered) are popular among your visitors.', 'wp-slimstat' )
414
  ),
415
  'slim_p2_19' => array(
@@ -423,7 +421,7 @@ class wp_slimstat_reports {
423
  'raw' => array( 'wp_slimstat_db', 'get_top' )
424
  ),
425
  'classes' => array( 'normal' ),
426
- 'screens' => array( 'slimview3' ),
427
  'tooltip' => __( 'This report shows you what operating system families (no version considered) are popular among your visitors.', 'wp-slimstat' )
428
  ),
429
  'slim_p2_20' => array(
@@ -436,7 +434,7 @@ class wp_slimstat_reports {
436
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
437
  ),
438
  'classes' => array( 'normal' ),
439
- 'screens' => array( 'slimview3' )
440
  ),
441
  'slim_p2_21' => array(
442
  'title' => __( 'Top Users', 'wp-slimstat' ),
@@ -447,10 +445,10 @@ class wp_slimstat_reports {
447
  'where' => 'notes LIKE "%user:%"',
448
  'raw' => array( 'wp_slimstat_db', 'get_top' )
449
  ),
450
- 'classes' => array( 'normal', 'hidden' ),
451
- 'screens' => array( 'slimview3', 'dashboard' )
452
  ),
453
- 'slim_p2_22_01' => array( // Chart Reports need to always have a _01 suffix to tell our custom "refresh" code to avoid fading the chart, which apparently doesn't work
454
  'title' => __( 'Users', 'wp-slimstat' ),
455
  'callback' => array( __CLASS__, 'show_chart' ),
456
  'callback_args' => array(
@@ -465,9 +463,33 @@ class wp_slimstat_reports {
465
  )
466
  ),
467
  'classes' => array( 'extralarge', 'chart' ),
468
- 'screens' => array( 'slimview3' ),
469
  'tooltip' => $chart_tooltip
470
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
 
472
  'slim_p3_01' => array(
473
  'title' => __( 'Traffic Sources', 'wp-slimstat' ),
@@ -485,7 +507,7 @@ class wp_slimstat_reports {
485
  )
486
  ),
487
  'classes' => array( 'extralarge', 'chart' ),
488
- 'screens' => array( 'slimview5' ),
489
  'tooltip' => $chart_tooltip
490
  ),
491
  'slim_p3_02' => array(
@@ -495,7 +517,7 @@ class wp_slimstat_reports {
495
  'raw' => array( 'wp_slimstat_db', 'get_traffic_sources_summary' )
496
  ),
497
  'classes' => array( 'normal' ),
498
- 'screens' => array( 'slimview5' )
499
  ),
500
  'slim_p3_06' => array(
501
  'title' => __( 'Top Referring Search Engines', 'wp-slimstat' ),
@@ -509,7 +531,7 @@ class wp_slimstat_reports {
509
  'raw' => array( 'wp_slimstat_db', 'get_top' )
510
  ),
511
  'classes' => array( 'normal' ),
512
- 'screens' => array( 'slimview5', 'dashboard' )
513
  ),
514
 
515
  'slim_p4_01' => array(
@@ -521,7 +543,7 @@ class wp_slimstat_reports {
521
  'raw' => array( 'wp_slimstat_db', 'get_recent_outbound' )
522
  ),
523
  'classes' => array( 'large' ),
524
- 'screens' => array( 'slimview4' ),
525
  'tooltip' => ''
526
  ),
527
  'slim_p4_02' => array(
@@ -534,7 +556,7 @@ class wp_slimstat_reports {
534
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
535
  ),
536
  'classes' => array( 'normal' ),
537
- 'screens' => array( 'slimview4' )
538
  ),
539
  'slim_p4_04' => array(
540
  'title' => __( 'Recent Feeds', 'wp-slimstat' ),
@@ -545,8 +567,8 @@ class wp_slimstat_reports {
545
  'where' => '(resource LIKE "%/feed%" OR resource LIKE "%?feed=>%" OR resource LIKE "%&feed=>%" OR content_type LIKE "%feed%")',
546
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
547
  ),
548
- 'classes' => array( 'normal', 'hidden' ),
549
- 'screens' => array( 'slimview4' )
550
  ),
551
  'slim_p4_05' => array(
552
  'title' => __( 'Recent Pages Not Found', 'wp-slimstat' ),
@@ -558,7 +580,7 @@ class wp_slimstat_reports {
558
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
559
  ),
560
  'classes' => array( 'normal' ),
561
- 'screens' => array( 'slimview4' )
562
  ),
563
  'slim_p4_06' => array(
564
  'title' => __( 'Recent Internal Searches', 'wp-slimstat' ),
@@ -569,8 +591,8 @@ class wp_slimstat_reports {
569
  'where' => 'content_type LIKE "%search%" AND searchterms <> "" AND searchterms IS NOT NULL',
570
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
571
  ),
572
- 'classes' => array( 'normal', 'hidden' ),
573
- 'screens' => array( 'slimview4' ),
574
  'tooltip' => __( "Searches performed using WordPress' built-in search functionality.", 'wp-slimstat' )
575
  ),
576
  'slim_p4_07' => array(
@@ -583,9 +605,8 @@ class wp_slimstat_reports {
583
  'raw' => array( 'wp_slimstat_db', 'get_top' )
584
  ),
585
  'classes' => array( 'normal' ),
586
- 'screens' => array( 'slimview4', 'dashboard' )
587
  ),
588
-
589
  'slim_p4_09' => array(
590
  'title' => __( 'Top Downloads', 'wp-slimstat' ),
591
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
@@ -596,8 +617,8 @@ class wp_slimstat_reports {
596
  'raw' => array( 'wp_slimstat_db', 'get_top' ),
597
  'criteria' => 'swap'
598
  ),
599
- 'classes' => array( 'large', 'hidden' ),
600
- 'screens' => array( 'slimview4' ),
601
  'tooltip' => __( 'You can configure Slimstat to track specific file extensions as downloads.', 'wp-slimstat' )
602
  ),
603
  'slim_p4_10' => array(
@@ -608,8 +629,8 @@ class wp_slimstat_reports {
608
  'columns' => 'notes',
609
  'raw' => array( 'wp_slimstat_db', 'get_recent_events' )
610
  ),
611
- 'classes' => array( 'normal', 'hidden' ),
612
- 'screens' => array( 'slimview4' ),
613
  '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' )
614
  ),
615
  'slim_p4_11' => array(
@@ -619,10 +640,10 @@ class wp_slimstat_reports {
619
  'type' => 'top',
620
  'columns' => 'resource',
621
  'where' => 'content_type = "post"',
622
- 'raw' => array( 'wp_slimstat_db', 'get_top' )
623
  ),
624
  'classes' => array( 'normal' ),
625
- 'screens' => array( 'slimview4' )
626
  ),
627
  'slim_p4_12' => array(
628
  'title' => __( 'Top Events', 'wp-slimstat' ),
@@ -632,8 +653,8 @@ class wp_slimstat_reports {
632
  'columns' => 'notes',
633
  'raw' => array( 'wp_slimstat_db', 'get_top_events' )
634
  ),
635
- 'classes' => array( 'normal', 'hidden' ),
636
- 'screens' => array( 'slimview4' ),
637
  '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' )
638
  ),
639
  'slim_p4_13' => array(
@@ -645,8 +666,8 @@ class wp_slimstat_reports {
645
  'where' => 'content_type LIKE "%search%" AND searchterms <> "" AND searchterms IS NOT NULL',
646
  'raw' => array( 'wp_slimstat_db', 'get_top' )
647
  ),
648
- 'classes' => array( 'normal', 'hidden' ),
649
- 'screens' => array( 'slimview4' )
650
  ),
651
  'slim_p4_15' => array(
652
  'title' => __( 'Recent Categories', 'wp-slimstat' ),
@@ -657,8 +678,8 @@ class wp_slimstat_reports {
657
  'where' => '(content_type = "category" OR content_type = "tag")',
658
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
659
  ),
660
- 'classes' => array( 'normal', 'hidden' ),
661
- 'screens' => array( 'slimview4' )
662
  ),
663
  'slim_p4_16' => array(
664
  'title' => __( 'Top Pages Not Found', 'wp-slimstat' ),
@@ -670,7 +691,7 @@ class wp_slimstat_reports {
670
  'raw' => array( 'wp_slimstat_db', 'get_top' )
671
  ),
672
  'classes' => array( 'normal' ),
673
- 'screens' => array( 'slimview4' )
674
  ),
675
  'slim_p4_18' => array(
676
  'title' => __( 'Top Authors', 'wp-slimstat' ),
@@ -681,7 +702,7 @@ class wp_slimstat_reports {
681
  'raw' => array( 'wp_slimstat_db', 'get_top' )
682
  ),
683
  'classes' => array( 'normal' ),
684
- 'screens' => array( 'slimview4', 'dashboard' )
685
  ),
686
  'slim_p4_19' => array(
687
  'title' => __( 'Top Tags', 'wp-slimstat' ),
@@ -692,8 +713,8 @@ class wp_slimstat_reports {
692
  'where' => '(content_type LIKE "%tag%")',
693
  'raw' => array( 'wp_slimstat_db', 'get_top' )
694
  ),
695
- 'classes' => array( 'normal', 'hidden' ),
696
- 'screens' => array( 'slimview4' )
697
  ),
698
  'slim_p4_20' => array(
699
  'title' => __( 'Recent Downloads', 'wp-slimstat' ),
@@ -704,8 +725,8 @@ class wp_slimstat_reports {
704
  'where' => 'content_type = "download"',
705
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
706
  ),
707
- 'classes' => array( 'large', 'hidden' ),
708
- 'screens' => array( 'slimview4' )
709
  ),
710
  'slim_p4_21' => array(
711
  'title' => __( 'Top Outbound Links', 'wp-slimstat' ),
@@ -716,8 +737,8 @@ class wp_slimstat_reports {
716
  'raw' => array( 'wp_slimstat_db', 'get_top_outbound' ),
717
  'criteria' => 'swap'
718
  ),
719
- 'classes' => array( 'normal', 'hidden' ),
720
- 'screens' => array( 'slimview4', 'dashboard' ),
721
  ),
722
  'slim_p4_22' => array(
723
  'title' => __( 'Your Website', 'wp-slimstat' ),
@@ -725,8 +746,8 @@ class wp_slimstat_reports {
725
  'callback_args' => array(
726
  'raw' => array( 'wp_slimstat_db', 'get_your_blog' )
727
  ),
728
- 'classes' => array( 'normal', 'hidden' ),
729
- 'screens' => array( 'slimview4' ),
730
  'tooltip' => __( 'Your content at a glance: posts, comments, pingbacks, etc. Please note that this report is not affected by the filters set here above.', 'wp-slimstat' )
731
  ),
732
  'slim_p4_23' => array(
@@ -739,8 +760,8 @@ class wp_slimstat_reports {
739
  'having' => 'HAVING COUNT(visit_id) = 1',
740
  'raw' => array( 'wp_slimstat_db', 'get_top' )
741
  ),
742
- 'classes' => array( 'normal', 'hidden' ),
743
- 'screens' => array( 'slimview4' )
744
  ),
745
  'slim_p4_24' => array(
746
  'title' => __( 'Top Exit Pages', 'wp-slimstat' ),
@@ -752,8 +773,8 @@ class wp_slimstat_reports {
752
  'aggr_function' => 'MAX',
753
  'raw' => array( 'wp_slimstat_db', 'get_top_aggr' )
754
  ),
755
- 'classes' => array( 'large', 'hidden' ),
756
- 'screens' => array( 'slimview4', 'dashboard' )
757
  ),
758
  'slim_p4_25' => array(
759
  'title' => __( 'Top Entry Pages', 'wp-slimstat' ),
@@ -765,10 +786,10 @@ class wp_slimstat_reports {
765
  'aggr_function' => 'MIN',
766
  'raw' => array( 'wp_slimstat_db', 'get_top_aggr' )
767
  ),
768
- 'classes' => array( 'large', 'hidden' ),
769
- 'screens' => array( 'slimview4' )
770
  ),
771
- 'slim_p4_26_01' => array( // Chart Reports need to always have a _01 suffix to tell our custom "refresh" code to avoid fading the chart, which apparently doesn't work
772
  'title' => __( 'Pages with Outbound Links', 'wp-slimstat' ),
773
  'callback' => array( __CLASS__, 'show_chart' ),
774
  'callback_args' => array(
@@ -783,7 +804,7 @@ class wp_slimstat_reports {
783
  )
784
  ),
785
  'classes' => array( 'extralarge', 'chart' ),
786
- 'screens' => array( 'slimview4' ),
787
  'tooltip' => $chart_tooltip
788
  ),
789
  'slim_p4_27' => array(
@@ -795,7 +816,7 @@ class wp_slimstat_reports {
795
  'raw' => array( 'wp_slimstat_db', 'get_group_by' )
796
  ),
797
  'classes' => array( 'large' ),
798
- 'screens' => array( 'slimview4' )
799
  ),
800
  'slim_p6_01' => array(
801
  'title' => __( 'World Map', 'wp-slimstat' ),
@@ -804,13 +825,13 @@ class wp_slimstat_reports {
804
  'id' => 'slim_p6_01'
805
  ),
806
  'classes' => array( 'full-width', 'tall' ),
807
- 'screens' => array( 'slimview1' ),
808
  'tooltip' => __( 'Dots on the map represent the most recent pageviews geolocated by City. This feature is only available by enabling the corresponding precision level in the settings.', 'wp-slimstat' )
809
  )
810
  );
811
 
812
  if ( wp_slimstat::$settings[ 'geolocation_country' ] != 'on' ) {
813
- self::$reports_info [ 'slim_p2_23' ] = array(
814
  'title' => __( 'Top Cities', 'wp-slimstat' ),
815
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
816
  'callback_args' => array(
@@ -820,101 +841,69 @@ class wp_slimstat_reports {
820
  'raw' => array( 'wp_slimstat_db', 'get_top' )
821
  ),
822
  'classes' => array( 'normal' ),
823
- 'screens' => array( 'slimview3' )
824
  );
825
  }
826
 
827
  // Allow third party tools to manipulate this list here above: please use unique report IDs that don't interfere with built-in ones, if you add your own custom report
828
- self::$reports_info = apply_filters( 'slimstat_reports_info', self::$reports_info );
829
-
830
- // Define what reports have been deprecated over time, to remove them from the user's settings
831
- $deprecated_reports = array(
832
- 'slim_p1_02' => 1,
833
- 'slim_p1_05' => 1,
834
- 'slim_p1_18' => 1,
835
- 'slim_p2_10' => 1,
836
- 'slim_p3_03' => 1,
837
- 'slim_p3_04' => 1,
838
- 'slim_p3_05' => 1,
839
- 'slim_p3_08' => 1,
840
- 'slim_p3_09' => 1,
841
- 'slim_p3_10' => 1,
842
- 'slim_p4_08' => 1,
843
- 'slim_p4_14' => 1,
844
- 'slim_p4_17' => 1,
845
- 'slim_getsocial' => 1
846
- );
847
 
848
- // Retrieve this user's list of active reports,
849
  $current_user = wp_get_current_user();
850
- $page_location = ( wp_slimstat::$settings[ 'use_separate_menu' ] == 'no' ) ? 'slimstat' : 'admin';
851
 
852
  // Superadmins can customize the layout at network level, to override per-site settings
853
- self::$user_reports = get_user_option( "meta-box-order_{$page_location}_page_slimlayout-network", 1 );
854
 
855
- // No network-wide settings exist
856
  if ( empty( self::$user_reports ) ) {
857
- self::$user_reports = get_user_option( "meta-box-order_{$page_location}_page_slimlayout", $current_user->ID );
858
  }
859
 
860
- // We store page titles in a transient for improved performance
861
- self::$resource_titles = get_transient( 'slimstat_resource_titles' );
862
- if ( self::$resource_titles === false ) {
863
- self::$resource_titles = array();
864
- }
865
 
866
- // Do this only if we are in one of our screens (no dashboard!)
867
- if ( is_admin() && !empty( $_REQUEST[ 'page' ] ) && strpos( $_REQUEST[ 'page' ], 'slimview' ) !== false ) {
868
-
869
- // If this list is not empty, we rearrange the order of our reports
870
- if ( !empty( self::$user_reports[ $_REQUEST[ 'page' ] ] ) ) {
871
- $user_reports_intersect = array_flip( explode( ',', self::$user_reports[ $_REQUEST[ 'page' ] ] ) );
872
- self::$reports_info = array_intersect_key( array_merge( $user_reports_intersect, self::$reports_info ), $user_reports_intersect );
873
- }
874
- else {
875
- foreach ( self::$reports_info as $a_report_id => $a_report_info ) {
876
- if ( !in_array( $_REQUEST[ 'page' ], $a_report_info[ 'screens' ] ) ) {
877
- unset( self::$reports_info[ $a_report_id ] );
878
- }
879
- }
880
  }
 
 
 
 
 
 
 
 
 
 
 
 
881
 
882
- // Remove deprecated reports
883
- self::$reports_info = array_diff_key( self::$reports_info, $deprecated_reports );
884
-
885
- $hidden_reports = get_user_option( "metaboxhidden_{$page_location}_page_{$_REQUEST['page']}", $current_user->ID );
886
-
887
- // If this list is not empty, use it instead of the predefined visibility
888
- if ( is_array( $hidden_reports ) ) {
889
- foreach ( self::$reports_info as $a_report_id => $a_report_info ) {
890
- if ( in_array( $a_report_id, $hidden_reports ) ) {
891
- if ( is_array( self::$reports_info[ $a_report_id ][ 'classes' ] ) && !in_array( 'hidden', $a_report_info[ 'classes' ] ) ) {
892
- self::$reports_info[ $a_report_id ][ 'classes' ][] = 'hidden';
893
- }
894
- }
895
- else if ( is_array( self::$reports_info[ $a_report_id ][ 'classes' ] ) ) {
896
- self::$reports_info[ $a_report_id ][ 'classes' ] = array_diff( self::$reports_info[ $a_report_id ][ 'classes' ], array( 'hidden' ) );
897
- }
898
  }
899
  }
900
  }
901
- // If we are on the WP Dashboard page, all the reports are 'visible': WP will take care of honoring the Screen Options settings for that page
902
- else if ( !empty( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], 'slimlayout' ) === false ) {
903
- foreach ( self::$reports_info as $a_report_id => $a_report_info ) {
904
- if ( is_array( self::$reports_info[ $a_report_id ][ 'classes' ] ) ) {
905
- self::$reports_info[ $a_report_id ][ 'classes' ] = array_diff( self::$reports_info[ $a_report_id ][ 'classes' ], array( 'hidden' ) );
906
- }
907
- }
908
  }
909
  }
910
  // end init
911
 
912
  public static function report_header( $_report_id = '' ) {
913
- if ( empty( self::$reports_info[ $_report_id ] ) ) {
914
  return false;
915
  }
916
 
917
- $header_classes = !empty( self::$reports_info[ $_report_id ][ 'classes' ] ) ? implode( ' ', self::$reports_info[ $_report_id ][ 'classes' ] ) : '';
918
  $header_buttons = '';
919
  $header_tooltip = '';
920
 
@@ -928,10 +917,10 @@ class wp_slimstat_reports {
928
  // Allow third-party code to add more buttons
929
  $header_buttons = apply_filters( 'slimstat_report_header_buttons', $header_buttons, $_report_id );
930
  $header_buttons = '<div class="slimstat-header-buttons">' . $header_buttons . '</div>';
931
- $header_tooltip = !empty( self::$reports_info[ $_report_id ][ 'tooltip' ] ) ? '<i class="slimstat-tooltip-trigger corner"><span class="slimstat-tooltip-content">' . self::$reports_info[ $_report_id ][ 'tooltip' ] . '</span></i>' : '';
932
  }
933
 
934
- echo "<div class='postbox $header_classes' id='$_report_id'>{$header_buttons} <h3 data-report-id='{$_report_id}'>" . self::$reports_info[ $_report_id ][ 'title' ] . " {$header_tooltip}</h3><div class='inside'>";
935
  }
936
 
937
  public static function report_footer(){
@@ -1163,7 +1152,7 @@ class wp_slimstat_reports {
1163
  $percentage_value = ( ( wp_slimstat_db::$pageviews > 0 ) ? number_format_i18n( sprintf( "%01.2f", ( 100 * $results[ $i ][ 'counthits' ] / wp_slimstat_db::$pageviews ) ), 2 ) : 0 );
1164
  $counthits = number_format_i18n( $results[ $i ][ 'counthits' ] );
1165
 
1166
- if ( !empty( $_args[ 'criteria' ] ) && $_args[ 'criteria' ] == 'swap' ) {
1167
  $percentage = ' <span>' . $counthits . '</span>';
1168
  $row_details = __('Hits','wp-slimstat') . ': ' . ( ( $column_not_calculated != 'outbound_resource' ) ? $percentage_value . '%' . ( !empty( $row_details ) ? '<br>' : '' ) . $row_details : '' );
1169
  }
@@ -1733,17 +1722,7 @@ class wp_slimstat_reports {
1733
  }
1734
 
1735
  $request_uri = admin_url( 'admin.php' );
1736
-
1737
- $request_page = 'slimview1';
1738
- if ( !empty( $_REQUEST[ 'page' ] ) ) {
1739
- if ( !array_key_exists( $_REQUEST[ 'page' ], wp_slimstat_admin::$screens_info ) ) {
1740
- return '';
1741
- }
1742
-
1743
- $request_page = $_REQUEST[ 'page' ];
1744
- }
1745
-
1746
- $request_uri .= '?page=' . $request_page;
1747
 
1748
  // Avoid XSS attacks ( why would the owner try to hack into his/her own website though? )
1749
  if ( !empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
@@ -1888,21 +1867,16 @@ class wp_slimstat_reports {
1888
  $report_id = $_args[ 'id' ];
1889
  }
1890
 
1891
- // Honor the 'hidden' attribute, but not on the WP Dashboard ( empty( $_args[ 'id' ] ) )
1892
- // if ( empty( $report_id ) || in_array( 'hidden', self::$reports_info[ $report_id ][ 'classes' ] ) ) {
1893
- // return array();
1894
- // }
1895
-
1896
- if ( !empty( self::$reports_info[ $report_id ] ) && is_array( self::$reports_info[ $report_id ] ) ) {
1897
  // Default values
1898
  $_args = array_merge( array(
1899
  'title' => '',
1900
  'callback' => '',
1901
  'callback_args' => array(),
1902
  'classes' => array(),
1903
- 'screens' => array(),
1904
  'tooltip' => ''
1905
- ), self::$reports_info[ $report_id ] );
1906
  }
1907
 
1908
  // Default callback args
1
  <?php
2
 
3
  class wp_slimstat_reports {
4
+ public static $reports = array(); // Structures to store all the information about what screens and reports are available
 
 
5
  public static $user_reports = array();
6
  public static $resource_titles = array();
7
 
8
  /**
9
  * Initalize class properties
10
  */
11
+ public static function init() {
 
12
  // Include and initialize the API to interact with the database
13
  include_once( 'wp-slimstat-db.php' );
14
  wp_slimstat_db::init();
19
  // - title : report name
20
  // - callback : function to use to render the report
21
  // - callback_args : parameters to pass to the function
22
+ // - classes : determine the look and feel of this report ( tall, large, extralarge, full-width )
23
+ // - locations : where should the report appear ( slimview1, .., slimview4, dashboard )
24
  // - tooltip : contextual help to be displayed on hover
25
 
26
  $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></ul>';
27
 
28
+ self::$reports = array(
29
  'slim_p7_02' => array(
30
  'title' => __( 'Access Log', 'wp-slimstat' ),
31
  'callback' => array( __CLASS__, 'show_access_log' ),
35
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
36
  ),
37
  'classes' => array( 'full-width', 'tall' ),
38
+ 'locations' => array( 'slimview1', 'dashboard' ),
39
  '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> ' . __( 'Has Left Comments', 'wp-slimstat' ) . '</p><p><span class="little-color-box is-known-user"></span> ' . __( 'WP User', 'wp-slimstat' ) . '</p><p><span class="little-color-box is-direct"></span> ' . __( 'Other Human', 'wp-slimstat' ) . '</p><p><span class="little-color-box"></span> ' . __( 'Bot or Crawler', 'wp-slimstat' ) . '</p>'
40
  ),
41
 
54
  )
55
  ),
56
  'classes' => array( 'extralarge', 'chart' ),
57
+ 'locations' => array( 'slimview2', 'dashboard' ),
58
  'tooltip' => $chart_tooltip
59
  ),
60
  'slim_p1_03' => array(
64
  'raw' => array( 'wp_slimstat_db', 'get_overview_summary' )
65
  ),
66
  'classes' => array( 'normal' ),
67
+ 'locations' => array( 'slimview2', 'dashboard' )
68
  ),
69
  'slim_p1_04' => array(
70
  'title' => __( 'Currently Online', 'wp-slimstat' ),
77
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
78
  ),
79
  'classes' => array( 'normal' ),
80
+ 'locations' => array( 'slimview2', 'dashboard' )
81
  ),
82
  'slim_p1_06' => array(
83
  'title' => __( 'Recent Search Terms', 'wp-slimstat' ),
90
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
91
  ),
92
  'classes' => array( 'normal' ),
93
+ 'locations' => array( 'slimview2', 'slimview5' ),
94
  'tooltip' => __( 'Keywords used by your visitors to find your website on a search engine.', 'wp-slimstat' )
95
  ),
96
  'slim_p1_08' => array(
104
  'raw' => array( 'wp_slimstat_db', 'get_top' )
105
  ),
106
  'classes' => array( 'normal' ),
107
+ 'locations' => array( 'slimview2', 'dashboard' ),
108
  'tooltip' => __( 'Here a "page" is not just a WordPress page type, but any webpage on your site, including posts, products, categories, and any other custom post type. For example, you can set the corresponding filter where Resource Content Type equals cpt:you_cpt_slug_here to get top web pages for a specific custom post type you have.', 'wp-slimstat' )
109
  ),
110
  'slim_p1_10' => array(
119
  'raw' => array( 'wp_slimstat_db', 'get_top' )
120
  ),
121
  'classes' => array( 'normal' ),
122
+ 'locations' => array( 'slimview2', 'slimview5', 'dashboard' )
123
  ),
124
  'slim_p1_11' => array(
125
  'title' => __( 'Top Known Visitors', 'wp-slimstat' ),
129
  'columns' => 'username',
130
  'raw' => array( 'wp_slimstat_db', 'get_top' )
131
  ),
132
+ 'classes' => array( 'normal' ),
133
+ 'locations' => array( 'slimview2', 'dashboard' )
134
  ),
135
  'slim_p1_12' => array(
136
  'title' => __( 'Top Search Terms', 'wp-slimstat' ),
142
  'raw' => array( 'wp_slimstat_db', 'get_top' )
143
  ),
144
  'classes' => array( 'normal' ),
145
+ 'locations' => array( 'slimview2', 'slimview4', 'slimview5', 'dashboard' )
146
  ),
147
  'slim_p1_13' => array(
148
  'title' => __( 'Top Countries', 'wp-slimstat' ),
152
  'columns' => 'country',
153
  'raw' => array( 'wp_slimstat_db', 'get_top' )
154
  ),
155
+ 'classes' => array( 'normal' ),
156
+ 'locations' => array( 'slimview2', 'slimview3', 'slimview5', 'dashboard' ),
157
+ 'tooltip' => __( 'You can configure Slimstat to not track specific Countries by setting the corresponding filter in Slimstat > Settings > Exclusions.', 'wp-slimstat' )
158
  ),
159
  'slim_p1_15' => array(
160
  'title' => __( 'Rankings', 'wp-slimstat' ),
162
  'callback_args' => array(
163
  'id' => 'slim_p1_15'
164
  ),
165
+ 'classes' => array( 'normal' ),
166
+ 'locations' => array( 'inactive' ),
167
  'tooltip' => __( "Slimstat retrieves live information from Alexa, Facebook and Mozscape, to measures your site's rankings. Values are updated every 12 hours. Please enter your personal access ID in the settings to access your personalized Mozscape data.", 'wp-slimstat' )
168
  ),
169
  'slim_p1_17' => array(
176
  'filter_op' => 'contains',
177
  'raw' => array( 'wp_slimstat_db', 'get_top' )
178
  ),
179
+ 'classes' => array( 'normal' ),
180
+ 'locations' => array( 'inactive' )
181
  ),
182
  'slim_p1_18' => array(
183
  'title' => __( 'Users Currently Online', 'wp-slimstat' ),
189
  'use_date_filters' => false,
190
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
191
  ),
192
+ 'classes' => array( 'normal' ),
193
+ 'locations' => array( 'slimview2', 'dashboard' ),
194
  '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' )
195
  ),
196
+ 'slim_p1_19_01' => array(
197
  'title' => __( 'Search Terms', 'wp-slimstat' ),
198
  'callback' => array( __CLASS__, 'show_chart' ),
199
  'callback_args' => array(
209
  )
210
  ),
211
  'classes' => array( 'extralarge', 'chart' ),
212
+ 'locations' => array( 'slimview2' ),
213
  'tooltip' => $chart_tooltip
214
  ),
215
  'slim_p1_20' => array(
222
  'raw' => array( 'wp_slimstat_db', 'get_top' )
223
  ),
224
  'classes' => array( 'normal' ),
225
+ 'locations' => array( 'slimview2', 'slimview5', 'dashboard' )
226
  ),
227
 
228
  'slim_p2_01' => array(
241
  )
242
  ),
243
  'classes' => array( 'extralarge', 'chart' ),
244
+ 'locations' => array( 'slimview3' ),
245
  'tooltip' => $chart_tooltip
246
  ),
247
  'slim_p2_02' => array(
251
  'raw' => array( 'wp_slimstat_db', 'get_visitors_summary' )
252
  ),
253
  'classes' => array( 'normal' ),
254
+ 'locations' => array( 'slimview3', 'dashboard' ),
255
  'tooltip' => __( 'Where not otherwise specified, the metrics in this report are referred to human visitors.', 'wp-slimstat' )
256
  ),
257
  'slim_p2_03' => array(
263
  'raw' => array( 'wp_slimstat_db', 'get_top' )
264
  ),
265
  'classes' => array( 'normal' ),
266
+ 'locations' => array( 'slimview3' )
267
  ),
268
  'slim_p2_04' => array(
269
+ 'title' => __( 'Top User Agents', 'wp-slimstat' ),
270
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
271
  'callback_args' => array(
272
  'type' => 'top',
274
  'raw' => array( 'wp_slimstat_db', 'get_top' )
275
  ),
276
  'classes' => array( 'normal' ),
277
+ 'locations' => array( 'slimview3', 'dashboard' ),
278
+ 'tooltip' => __( 'This report includes all types of clients, both bots and humans.', 'wp-slimstat' )
279
  ),
280
  'slim_p2_05' => array(
281
  'title' => __( 'Top Service Providers', 'wp-slimstat' ),
285
  'columns' => 'ip',
286
  'raw' => array( 'wp_slimstat_db', 'get_top' )
287
  ),
288
+ 'classes' => array( 'extralarge' ),
289
+ 'locations' => array( 'inactive' ),
290
  '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' )
291
  ),
292
  'slim_p2_06' => array(
297
  'columns' => 'platform',
298
  'raw' => array( 'wp_slimstat_db', 'get_top' )
299
  ),
300
+ 'classes' => array( 'normal' ),
301
+ 'locations' => array( 'inactive' ),
302
  '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' )
303
  ),
304
  'slim_p2_07' => array(
311
  'raw' => array( 'wp_slimstat_db', 'get_top' )
312
  ),
313
  'classes' => array( 'normal' ),
314
+ 'locations' => array( 'slimview3', 'dashboard' )
315
  ),
316
  'slim_p2_08' => array(
317
  'title' => __( 'Top Viewport Sizes', 'wp-slimstat' ),
321
  'columns' => 'resolution',
322
  'raw' => array( 'wp_slimstat_db', 'get_top' )
323
  ),
324
+ 'classes' => array( 'normal', ),
325
+ 'locations' => array( 'inactive' )
326
  ),
327
  'slim_p2_09' => array(
328
  'title' => __( 'Browser Capabilities', 'wp-slimstat' ),
330
  'callback_args' => array(
331
  'raw' => array( 'wp_slimstat_db', 'get_plugins' )
332
  ),
333
+ 'classes' => array( 'normal' ),
334
+ 'locations' => array( 'inactive' )
335
  ),
336
  'slim_p2_12' => array(
337
  'title' => __( 'Visit Duration', 'wp-slimstat' ),
339
  'callback_args' => array(
340
  'raw' => array( 'wp_slimstat_db', 'get_visits_duration' )
341
  ),
342
+ 'classes' => array( 'normal' ),
343
+ 'locations' => array( 'slimview3' ),
344
  'tooltip' => __( 'All values represent the percentages of pageviews within the corresponding time range.', 'wp-slimstat' )
345
  ),
346
  'slim_p2_13' => array(
351
  'columns' => 'country',
352
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
353
  ),
354
+ 'classes' => array( 'normal' ),
355
+ 'locations' => array( 'inactive' )
356
  ),
357
  'slim_p2_14' => array(
358
  'title' => __( 'Recent Viewport Sizes', 'wp-slimstat' ),
362
  'columns' => 'resolution',
363
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
364
  ),
365
+ 'classes' => array( 'normal' ),
366
+ 'locations' => array( 'inactive' )
367
  ),
368
  'slim_p2_15' => array(
369
  'title' => __( 'Recent Operating Systems', 'wp-slimstat' ),
373
  'columns' => 'platform',
374
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
375
  ),
376
+ 'classes' => array( 'normal' ),
377
+ 'locations' => array( 'inactive' )
378
  ),
379
  'slim_p2_16' => array(
380
  'title' => __( 'Recent Browsers', 'wp-slimstat' ),
384
  'columns' => 'browser, browser_version',
385
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
386
  ),
387
+ 'classes' => array( 'normal' ),
388
+ 'locations' => array( 'inactive' )
389
  ),
390
  'slim_p2_17' => array(
391
  'title' => __( 'Recent Languages', 'wp-slimstat' ),
395
  'columns' => 'language',
396
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
397
  ),
398
+ 'classes' => array( 'normal' ),
399
+ 'locations' => array( 'inactive' )
400
  ),
401
  'slim_p2_18' => array(
402
  'title' => __( 'Top Browser Families', 'wp-slimstat' ),
406
  'columns' => 'browser',
407
  'raw' => array( 'wp_slimstat_db', 'get_top' )
408
  ),
409
+ 'classes' => array( 'normal' ),
410
+ 'locations' => array( 'inactive' ),
411
  'tooltip' => __( 'This report shows you what user agent families (no version considered) are popular among your visitors.', 'wp-slimstat' )
412
  ),
413
  'slim_p2_19' => array(
421
  'raw' => array( 'wp_slimstat_db', 'get_top' )
422
  ),
423
  'classes' => array( 'normal' ),
424
+ 'locations' => array( 'slimview3' ),
425
  'tooltip' => __( 'This report shows you what operating system families (no version considered) are popular among your visitors.', 'wp-slimstat' )
426
  ),
427
  'slim_p2_20' => array(
434
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
435
  ),
436
  'classes' => array( 'normal' ),
437
+ 'locations' => array( 'slimview3' )
438
  ),
439
  'slim_p2_21' => array(
440
  'title' => __( 'Top Users', 'wp-slimstat' ),
445
  'where' => 'notes LIKE "%user:%"',
446
  'raw' => array( 'wp_slimstat_db', 'get_top' )
447
  ),
448
+ 'classes' => array( 'normal' ),
449
+ 'locations' => array( 'slimview3', 'dashboard' )
450
  ),
451
+ 'slim_p2_22_01' => array(
452
  'title' => __( 'Users', 'wp-slimstat' ),
453
  'callback' => array( __CLASS__, 'show_chart' ),
454
  'callback_args' => array(
463
  )
464
  ),
465
  'classes' => array( 'extralarge', 'chart' ),
466
+ 'locations' => array( 'slimview3' ),
467
  'tooltip' => $chart_tooltip
468
  ),
469
+ 'slim_p2_24' => array(
470
+ 'title' => __( 'Top Bots', 'wp-slimstat' ),
471
+ 'callback' => array( __CLASS__, 'raw_results_to_html' ),
472
+ 'callback_args' => array(
473
+ 'type' => 'top',
474
+ 'columns' => 'browser, browser_version',
475
+ 'where' => 'browser_type == 1',
476
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
477
+ ),
478
+ 'classes' => array( 'normal' ),
479
+ 'locations' => array( 'slimview3' )
480
+ ),
481
+ 'slim_p2_25' => array(
482
+ 'title' => __( 'Top Human Browsers', 'wp-slimstat' ),
483
+ 'callback' => array( __CLASS__, 'raw_results_to_html' ),
484
+ 'callback_args' => array(
485
+ 'type' => 'top',
486
+ 'columns' => 'browser, browser_version',
487
+ 'where' => 'browser_type != 1',
488
+ 'raw' => array( 'wp_slimstat_db', 'get_top' )
489
+ ),
490
+ 'classes' => array( 'normal' ),
491
+ 'locations' => array( 'slimview3' )
492
+ ),
493
 
494
  'slim_p3_01' => array(
495
  'title' => __( 'Traffic Sources', 'wp-slimstat' ),
507
  )
508
  ),
509
  'classes' => array( 'extralarge', 'chart' ),
510
+ 'locations' => array( 'slimview5' ),
511
  'tooltip' => $chart_tooltip
512
  ),
513
  'slim_p3_02' => array(
517
  'raw' => array( 'wp_slimstat_db', 'get_traffic_sources_summary' )
518
  ),
519
  'classes' => array( 'normal' ),
520
+ 'locations' => array( 'slimview5' )
521
  ),
522
  'slim_p3_06' => array(
523
  'title' => __( 'Top Referring Search Engines', 'wp-slimstat' ),
531
  'raw' => array( 'wp_slimstat_db', 'get_top' )
532
  ),
533
  'classes' => array( 'normal' ),
534
+ 'locations' => array( 'slimview5', 'dashboard' )
535
  ),
536
 
537
  'slim_p4_01' => array(
543
  'raw' => array( 'wp_slimstat_db', 'get_recent_outbound' )
544
  ),
545
  'classes' => array( 'large' ),
546
+ 'locations' => array( 'slimview4' ),
547
  'tooltip' => ''
548
  ),
549
  'slim_p4_02' => array(
556
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
557
  ),
558
  'classes' => array( 'normal' ),
559
+ 'locations' => array( 'slimview4' )
560
  ),
561
  'slim_p4_04' => array(
562
  'title' => __( 'Recent Feeds', 'wp-slimstat' ),
567
  'where' => '(resource LIKE "%/feed%" OR resource LIKE "%?feed=>%" OR resource LIKE "%&feed=>%" OR content_type LIKE "%feed%")',
568
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
569
  ),
570
+ 'classes' => array( 'normal' ),
571
+ 'locations' => array( 'inactive' )
572
  ),
573
  'slim_p4_05' => array(
574
  'title' => __( 'Recent Pages Not Found', 'wp-slimstat' ),
580
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
581
  ),
582
  'classes' => array( 'normal' ),
583
+ 'locations' => array( 'slimview4' )
584
  ),
585
  'slim_p4_06' => array(
586
  'title' => __( 'Recent Internal Searches', 'wp-slimstat' ),
591
  'where' => 'content_type LIKE "%search%" AND searchterms <> "" AND searchterms IS NOT NULL',
592
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
593
  ),
594
+ 'classes' => array( 'normal' ),
595
+ 'locations' => array( 'slimview4' ),
596
  'tooltip' => __( "Searches performed using WordPress' built-in search functionality.", 'wp-slimstat' )
597
  ),
598
  'slim_p4_07' => array(
605
  'raw' => array( 'wp_slimstat_db', 'get_top' )
606
  ),
607
  'classes' => array( 'normal' ),
608
+ 'locations' => array( 'slimview4', 'dashboard' )
609
  ),
 
610
  'slim_p4_09' => array(
611
  'title' => __( 'Top Downloads', 'wp-slimstat' ),
612
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
617
  'raw' => array( 'wp_slimstat_db', 'get_top' ),
618
  'criteria' => 'swap'
619
  ),
620
+ 'classes' => array( 'large' ),
621
+ 'locations' => array( 'slimview4' ),
622
  'tooltip' => __( 'You can configure Slimstat to track specific file extensions as downloads.', 'wp-slimstat' )
623
  ),
624
  'slim_p4_10' => array(
629
  'columns' => 'notes',
630
  'raw' => array( 'wp_slimstat_db', 'get_recent_events' )
631
  ),
632
+ 'classes' => array( 'normal' ),
633
+ 'locations' => array( 'inactive' ),
634
  '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' )
635
  ),
636
  'slim_p4_11' => array(
640
  'type' => 'top',
641
  'columns' => 'resource',
642
  'where' => 'content_type = "post"',
643
+ 'raw' => array( 'wp_slimstat_db', 'get_top' ),
644
  ),
645
  'classes' => array( 'normal' ),
646
+ 'locations' => array( 'slimview4' )
647
  ),
648
  'slim_p4_12' => array(
649
  'title' => __( 'Top Events', 'wp-slimstat' ),
653
  'columns' => 'notes',
654
  'raw' => array( 'wp_slimstat_db', 'get_top_events' )
655
  ),
656
+ 'classes' => array( 'normal' ),
657
+ 'locations' => array( 'slimview4' ),
658
  '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' )
659
  ),
660
  'slim_p4_13' => array(
666
  'where' => 'content_type LIKE "%search%" AND searchterms <> "" AND searchterms IS NOT NULL',
667
  'raw' => array( 'wp_slimstat_db', 'get_top' )
668
  ),
669
+ 'classes' => array( 'normal' ),
670
+ 'locations' => array( 'slimview4' )
671
  ),
672
  'slim_p4_15' => array(
673
  'title' => __( 'Recent Categories', 'wp-slimstat' ),
678
  'where' => '(content_type = "category" OR content_type = "tag")',
679
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
680
  ),
681
+ 'classes' => array( 'normal' ),
682
+ 'locations' => array( 'inactive' )
683
  ),
684
  'slim_p4_16' => array(
685
  'title' => __( 'Top Pages Not Found', 'wp-slimstat' ),
691
  'raw' => array( 'wp_slimstat_db', 'get_top' )
692
  ),
693
  'classes' => array( 'normal' ),
694
+ 'locations' => array( 'slimview4' )
695
  ),
696
  'slim_p4_18' => array(
697
  'title' => __( 'Top Authors', 'wp-slimstat' ),
702
  'raw' => array( 'wp_slimstat_db', 'get_top' )
703
  ),
704
  'classes' => array( 'normal' ),
705
+ 'locations' => array( 'slimview4', 'dashboard' )
706
  ),
707
  'slim_p4_19' => array(
708
  'title' => __( 'Top Tags', 'wp-slimstat' ),
713
  'where' => '(content_type LIKE "%tag%")',
714
  'raw' => array( 'wp_slimstat_db', 'get_top' )
715
  ),
716
+ 'classes' => array( 'normal' ),
717
+ 'locations' => array( 'inactive' )
718
  ),
719
  'slim_p4_20' => array(
720
  'title' => __( 'Recent Downloads', 'wp-slimstat' ),
725
  'where' => 'content_type = "download"',
726
  'raw' => array( 'wp_slimstat_db', 'get_recent' )
727
  ),
728
+ 'classes' => array( 'large' ),
729
+ 'locations' => array( 'inactive' )
730
  ),
731
  'slim_p4_21' => array(
732
  'title' => __( 'Top Outbound Links', 'wp-slimstat' ),
737
  'raw' => array( 'wp_slimstat_db', 'get_top_outbound' ),
738
  'criteria' => 'swap'
739
  ),
740
+ 'classes' => array( 'normal' ),
741
+ 'locations' => array( 'slimview4', 'dashboard' ),
742
  ),
743
  'slim_p4_22' => array(
744
  'title' => __( 'Your Website', 'wp-slimstat' ),
746
  'callback_args' => array(
747
  'raw' => array( 'wp_slimstat_db', 'get_your_blog' )
748
  ),
749
+ 'classes' => array( 'normal' ),
750
+ 'locations' => array( 'inactive' ),
751
  'tooltip' => __( 'Your content at a glance: posts, comments, pingbacks, etc. Please note that this report is not affected by the filters set here above.', 'wp-slimstat' )
752
  ),
753
  'slim_p4_23' => array(
760
  'having' => 'HAVING COUNT(visit_id) = 1',
761
  'raw' => array( 'wp_slimstat_db', 'get_top' )
762
  ),
763
+ 'classes' => array( 'normal' ),
764
+ 'locations' => array( 'slimview4' )
765
  ),
766
  'slim_p4_24' => array(
767
  'title' => __( 'Top Exit Pages', 'wp-slimstat' ),
773
  'aggr_function' => 'MAX',
774
  'raw' => array( 'wp_slimstat_db', 'get_top_aggr' )
775
  ),
776
+ 'classes' => array( 'large' ),
777
+ 'locations' => array( 'slimview4', 'dashboard' )
778
  ),
779
  'slim_p4_25' => array(
780
  'title' => __( 'Top Entry Pages', 'wp-slimstat' ),
786
  'aggr_function' => 'MIN',
787
  'raw' => array( 'wp_slimstat_db', 'get_top_aggr' )
788
  ),
789
+ 'classes' => array( 'large' ),
790
+ 'locations' => array( 'slimview4' )
791
  ),
792
+ 'slim_p4_26_01' => array(
793
  'title' => __( 'Pages with Outbound Links', 'wp-slimstat' ),
794
  'callback' => array( __CLASS__, 'show_chart' ),
795
  'callback_args' => array(
804
  )
805
  ),
806
  'classes' => array( 'extralarge', 'chart' ),
807
+ 'locations' => array( 'slimview4' ),
808
  'tooltip' => $chart_tooltip
809
  ),
810
  'slim_p4_27' => array(
816
  'raw' => array( 'wp_slimstat_db', 'get_group_by' )
817
  ),
818
  'classes' => array( 'large' ),
819
+ 'locations' => array( 'slimview4' )
820
  ),
821
  'slim_p6_01' => array(
822
  'title' => __( 'World Map', 'wp-slimstat' ),
825
  'id' => 'slim_p6_01'
826
  ),
827
  'classes' => array( 'full-width', 'tall' ),
828
+ 'locations' => array( 'slimview1' ),
829
  'tooltip' => __( 'Dots on the map represent the most recent pageviews geolocated by City. This feature is only available by enabling the corresponding precision level in the settings.', 'wp-slimstat' )
830
  )
831
  );
832
 
833
  if ( wp_slimstat::$settings[ 'geolocation_country' ] != 'on' ) {
834
+ self::$reports[ 'slim_p2_23' ] = array(
835
  'title' => __( 'Top Cities', 'wp-slimstat' ),
836
  'callback' => array( __CLASS__, 'raw_results_to_html' ),
837
  'callback_args' => array(
841
  'raw' => array( 'wp_slimstat_db', 'get_top' )
842
  ),
843
  'classes' => array( 'normal' ),
844
+ 'locations' => array( 'slimview3' )
845
  );
846
  }
847
 
848
  // Allow third party tools to manipulate this list here above: please use unique report IDs that don't interfere with built-in ones, if you add your own custom report
849
+ self::$reports = apply_filters( 'slimstat_reports_info', self::$reports );
850
+ $merge_reports = array_keys( self::$reports );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
 
852
+ // Retrieve this user's custom report assignment (Customizer)
853
  $current_user = wp_get_current_user();
 
854
 
855
  // Superadmins can customize the layout at network level, to override per-site settings
856
+ self::$user_reports = get_user_option( 'meta-box-order_' . wp_slimstat_admin::$page_location . '_page_slimlayout-network', 1 );
857
 
858
+ // No network-wide settings found
859
  if ( empty( self::$user_reports ) ) {
860
+ self::$user_reports = get_user_option( 'meta-box-order_' . wp_slimstat_admin::$page_location . '_page_slimlayout', $current_user->ID );
861
  }
862
 
863
+ // Do we have any new reports not listed in this user's settings?
864
+ if ( !empty( self::$user_reports ) && is_array( self::$user_reports ) ) {
865
+ $flat_user_reports = array_filter( explode( ',', implode( ',', self::$user_reports ) ) );
866
+ $merge_reports = array_diff( array_filter( array_keys( self::$reports ) ), $flat_user_reports );
 
867
 
868
+ // Now let's explode all the lists
869
+ foreach ( self::$user_reports as $a_location => $a_report_list ) {
870
+ self::$user_reports[ $a_location ] = explode( ',', $a_report_list );
 
 
 
 
 
 
 
 
 
 
 
871
  }
872
+ }
873
+ else {
874
+ self::$user_reports = array(
875
+ 'slimview1' => array(),
876
+ 'slimview2' => array(),
877
+ 'slimview3' => array(),
878
+ 'slimview4' => array(),
879
+ 'slimview5' => array(),
880
+ 'dashboard' => array(),
881
+ 'inactive' => array()
882
+ );
883
+ }
884
 
885
+ foreach ( $merge_reports as $a_report_id ) {
886
+ if ( !empty( self::$reports[ $a_report_id ][ 'locations' ] ) && is_array( self::$reports[ $a_report_id ][ 'locations' ] ) ) {
887
+ foreach ( self::$reports[ $a_report_id ][ 'locations' ] as $a_report_location ) {
888
+ self::$user_reports[ $a_report_location ][] = $a_report_id;
 
 
 
 
 
 
 
 
 
 
 
 
889
  }
890
  }
891
  }
892
+
893
+ // We store page titles in a transient for improved performance
894
+ self::$resource_titles = get_transient( 'slimstat_resource_titles' );
895
+ if ( self::$resource_titles === false ) {
896
+ self::$resource_titles = array();
 
 
897
  }
898
  }
899
  // end init
900
 
901
  public static function report_header( $_report_id = '' ) {
902
+ if ( empty( self::$reports[ $_report_id ] ) ) {
903
  return false;
904
  }
905
 
906
+ $header_classes = !empty( self::$reports[ $_report_id ][ 'classes' ] ) ? implode( ' ', self::$reports[ $_report_id ][ 'classes' ] ) : '';
907
  $header_buttons = '';
908
  $header_tooltip = '';
909
 
917
  // Allow third-party code to add more buttons
918
  $header_buttons = apply_filters( 'slimstat_report_header_buttons', $header_buttons, $_report_id );
919
  $header_buttons = '<div class="slimstat-header-buttons">' . $header_buttons . '</div>';
920
+ $header_tooltip = !empty( self::$reports[ $_report_id ][ 'tooltip' ] ) ? '<i class="slimstat-tooltip-trigger corner"><span class="slimstat-tooltip-content">' . self::$reports[ $_report_id ][ 'tooltip' ] . '</span></i>' : '';
921
  }
922
 
923
+ echo "<div class='postbox $header_classes' id='$_report_id'>{$header_buttons} <h3 data-report-id='{$_report_id}'>" . self::$reports[ $_report_id ][ 'title' ] . " {$header_tooltip}</h3><div class='inside'>";
924
  }
925
 
926
  public static function report_footer(){
1152
  $percentage_value = ( ( wp_slimstat_db::$pageviews > 0 ) ? number_format_i18n( sprintf( "%01.2f", ( 100 * $results[ $i ][ 'counthits' ] / wp_slimstat_db::$pageviews ) ), 2 ) : 0 );
1153
  $counthits = number_format_i18n( $results[ $i ][ 'counthits' ] );
1154
 
1155
+ if ( ( !empty( $_args[ 'criteria' ] ) && $_args[ 'criteria' ] == 'swap' ) || wp_slimstat::$settings[ 'show_hits' ] == 'on' ) {
1156
  $percentage = ' <span>' . $counthits . '</span>';
1157
  $row_details = __('Hits','wp-slimstat') . ': ' . ( ( $column_not_calculated != 'outbound_resource' ) ? $percentage_value . '%' . ( !empty( $row_details ) ? '<br>' : '' ) . $row_details : '' );
1158
  }
1722
  }
1723
 
1724
  $request_uri = admin_url( 'admin.php' );
1725
+ $request_uri .= '?page=' . wp_slimstat_admin::$current_screen;
 
 
 
 
 
 
 
 
 
 
1726
 
1727
  // Avoid XSS attacks ( why would the owner try to hack into his/her own website though? )
1728
  if ( !empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
1867
  $report_id = $_args[ 'id' ];
1868
  }
1869
 
1870
+ if ( !empty( self::$reports[ $report_id ] ) && is_array( self::$reports[ $report_id ] ) ) {
 
 
 
 
 
1871
  // Default values
1872
  $_args = array_merge( array(
1873
  'title' => '',
1874
  'callback' => '',
1875
  'callback_args' => array(),
1876
  'classes' => array(),
1877
+ 'locations' => array(),
1878
  'tooltip' => ''
1879
+ ), self::$reports[ $report_id ] );
1880
  }
1881
 
1882
  // Default callback args
readme.txt CHANGED
@@ -6,7 +6,7 @@ Text Domain: wp-slimstat
6
  Requires at least: 3.8
7
  Requires PHP: 5.2
8
  Tested up to: 5.2
9
- Stable tag: 4.8.4.1
10
 
11
  == Description ==
12
  [youtube https://www.youtube.com/watch?v=zEKP9yC8x6g]
@@ -61,6 +61,17 @@ Our knowledge base is available on our [support center](https://docs.wp-slimstat
61
  5. **Responsive layout** - Keep an eye on your reports on the go
62
 
63
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
64
  = 4.8.4.1 =
65
  * [Note] As anticipated a few weeks ago, this update drops the information about your visitors' browser plugins, which had been deprecated as not useful and oftentimes unreliable. Please make sure to backup your Slimstat tables if you need to preserve this information for some reason.
66
  * [Update] We received quite a few messages complaining about our decision to change the default position of the Slimstat menu from the sidebar to the admin bar. We are rolling back this change, and we apologize for any confusion this might have caused.
6
  Requires at least: 3.8
7
  Requires PHP: 5.2
8
  Tested up to: 5.2
9
+ Stable tag: 4.8.5
10
 
11
  == Description ==
12
  [youtube https://www.youtube.com/watch?v=zEKP9yC8x6g]
61
  5. **Responsive layout** - Keep an eye on your reports on the go
62
 
63
  == Changelog ==
64
+ = 4.8.5 =
65
+ * [New] Introduced option to not track pageviews based on the ACCEPT-LANGUAGE header sent by the browser.
66
+ * [New] Introduced option to display a pageview count instead of the percentage in Top reports.
67
+ * [New] Introduced two new reports under the Audience tab: Tob Bots and Top Human Browsers.
68
+ * [Update] Removed the option to hide reports on tabs, as it was confusing users who couldn't find them. Now you can simply use the Customizer to arrange your reports, and place the ones you don't need in the Inactive box.
69
+ * [Update] Rewritten the code that manages which reports are displayed on which screen (Customizer), streamlined data structures and optimized their use. Please update all the add-ons to the latest version available. Don't hesitate to contact us if you have any questions!
70
+ * [Fix] The HTML markup in the opt-out message field was being stripped out (thank you, [paulmcmanus](https://wordpress.org/support/topic/saving-settings-flips-opt-out-message-to-plain-text/)).
71
+ * [Fix] Reports could not be properly deleted in the Customizer, if the Slimstat menu was displayed in the Admin Bar.
72
+ * [Fix] A fatal error thrown by the Maxmind library when the data file is corrupted has been addressed.
73
+ * [Fix] The icon filename for Windows 8.1 was incorrect (thank you, Dimitri)
74
+
75
  = 4.8.4.1 =
76
  * [Note] As anticipated a few weeks ago, this update drops the information about your visitors' browser plugins, which had been deprecated as not useful and oftentimes unreliable. Please make sure to backup your Slimstat tables if you need to preserve this information for some reason.
77
  * [Update] We received quite a few messages complaining about our decision to change the default position of the Slimstat menu from the sidebar to the admin bar. We are rolling back this change, and we apologize for any confusion this might have caused.
wp-slimstat.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: https://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
- Version: 4.8.4.1
7
  Author: Jason Crouse
8
  Author URI: https://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
@@ -15,7 +15,7 @@ if ( !empty( wp_slimstat::$settings ) ) {
15
  }
16
 
17
  class wp_slimstat {
18
- public static $version = '4.8.4.1';
19
  public static $settings = array();
20
 
21
  public static $wpdb = '';
@@ -535,9 +535,22 @@ class wp_slimstat {
535
  // Language
536
  self::$stat[ 'language' ] = self::_get_language();
537
 
 
 
 
 
 
 
538
  // Geolocation
539
  include_once ( plugin_dir_path( __FILE__ ) . 'vendor/maxmind.php' );
540
- $geolocation_data = maxmind_geolite2_connector::get_geolocation_info( self::$stat[ 'ip' ] );
 
 
 
 
 
 
 
541
 
542
  if ( !empty( $geolocation_data[ 'country' ][ 'iso_code' ] ) ) {
543
 
@@ -561,6 +574,12 @@ class wp_slimstat {
561
 
562
  unset( $geolocation_data );
563
 
 
 
 
 
 
 
564
  // Anonymize IP Address?
565
  if ( self::$settings[ 'anonymize_ip' ] == 'on' ) {
566
  // IPv4 or IPv6
@@ -578,12 +597,6 @@ class wp_slimstat {
578
  }
579
  }
580
 
581
- // Is this country blacklisted?
582
- if ( !empty( self::$stat[ 'country' ] ) && !empty( self::$settings[ 'ignore_countries' ] ) && stripos( self::$settings[ 'ignore_countries' ], self::$stat[ 'country' ] ) !== false ) {
583
- self::$stat['id'] = -308;
584
- return $_argument;
585
- }
586
-
587
  // Mark or ignore Firefox/Safari prefetching requests (X-Moz: Prefetch and X-purpose: Preview)
588
  if ( ( isset( $_SERVER[ 'HTTP_X_MOZ' ] ) && ( strtolower( $_SERVER[ 'HTTP_X_MOZ' ] ) == 'prefetch' ) ) ||
589
  ( isset( $_SERVER[ 'HTTP_X_PURPOSE' ] ) && ( strtolower( $_SERVER[ 'HTTP_X_PURPOSE' ] ) == 'preview' ) ) ) {
@@ -668,7 +681,7 @@ class wp_slimstat {
668
  }
669
  }
670
 
671
- // Is this a new visitor?
672
  $set_cookie = apply_filters( 'slimstat_set_visit_cookie', ( !empty( self::$settings[ 'set_tracker_cookie' ] ) && self::$settings[ 'set_tracker_cookie' ] == 'on' ) );
673
  if ( $set_cookie ) {
674
  if ( empty( self::$stat[ 'visit_id' ] ) && !empty( self::$stat[ 'id' ] ) ) {
@@ -790,7 +803,7 @@ class wp_slimstat {
790
  /**
791
  * Extracts the accepted language from browser headers
792
  */
793
- protected static function _get_language(){
794
  if ( isset( $_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ] ) ) {
795
 
796
  // Capture up to the first delimiter (, found in Safari)
@@ -1314,18 +1327,18 @@ class wp_slimstat {
1314
  break;
1315
 
1316
  case 'widget':
1317
- if ( empty( wp_slimstat_reports::$reports_info[ $w ] ) ) {
1318
  return __( 'Invalid Report ID', 'wp-slimstat' );
1319
  }
1320
 
1321
  wp_register_style( 'wp-slimstat-frontend', plugins_url( '/admin/assets/css/slimstat.css', __FILE__ ) );
1322
  wp_enqueue_style( 'wp-slimstat-frontend' );
1323
 
1324
- wp_slimstat_reports::$reports_info[ $w ][ 'callback_args' ][ 'is_widget' ] = true;
1325
 
1326
  ob_start();
1327
  echo wp_slimstat_reports::report_header( $w );
1328
- call_user_func( wp_slimstat_reports::$reports_info[ $w ][ 'callback' ], wp_slimstat_reports::$reports_info[ $w ][ 'callback_args' ] );
1329
  wp_slimstat_reports::report_footer();
1330
  $output = ob_get_contents();
1331
  ob_end_clean();
@@ -1625,11 +1638,10 @@ class wp_slimstat {
1625
  // -----------------------------------------------------------------------
1626
 
1627
  // Reports - Functionality
1628
- 'posts_column_day_interval' => 28,
1629
  'use_current_month_timespan' => 'no',
1630
- 'async_load' => 'no',
1631
  'rows_to_show' => '20',
1632
- 'limit_results' => '1000',
1633
  'ip_lookup_service' => 'https://www.infosniper.net/?ip_address=',
1634
  'comparison_chart' => 'on',
1635
  'show_display_name' => 'no',
@@ -1647,6 +1659,8 @@ class wp_slimstat {
1647
  'mozcom_access_id' => '',
1648
  'mozcom_secret_key' => '',
1649
  'show_complete_user_agent_tooltip' => 'no',
 
 
1650
  'enable_sov' => 'no',
1651
 
1652
  // Exclusions
@@ -1660,6 +1674,7 @@ class wp_slimstat {
1660
  'ignore_users' => '',
1661
  'ignore_ip' => '',
1662
  'ignore_countries' => '',
 
1663
  'ignore_browsers' => '',
1664
  'ignore_platforms' => '',
1665
  'ignore_capabilities' => '',
@@ -1964,7 +1979,7 @@ class slimstat_widget extends WP_Widget {
1964
  $slimstat_widget_id = !empty( $instance[ 'slimstat_widget_id' ] ) ? $instance[ 'slimstat_widget_id' ] : '';
1965
  $slimstat_widget_filters = !empty( $instance[ 'slimstat_widget_filters' ] ) ? $instance[ 'slimstat_widget_filters' ] : '';
1966
 
1967
- foreach ( wp_slimstat_reports::$reports_info as $a_report_id => $a_report_info ) {
1968
  $select_options .= "<option value='$a_report_id' " . ( ( $slimstat_widget_id == $a_report_id ) ? 'selected="selected"' : '' ) . ">{$a_report_info[ 'title' ]}</option>";
1969
  }
1970
  ?>
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: https://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
+ Version: 4.8.5
7
  Author: Jason Crouse
8
  Author URI: https://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
15
  }
16
 
17
  class wp_slimstat {
18
+ public static $version = '4.8.5';
19
  public static $settings = array();
20
 
21
  public static $wpdb = '';
535
  // Language
536
  self::$stat[ 'language' ] = self::_get_language();
537
 
538
+ // Is this language blacklisted?
539
+ if ( !empty( self::$stat[ 'language' ] ) && !empty( self::$settings[ 'ignore_languages' ] ) && stripos( self::$settings[ 'ignore_languages' ], self::$stat[ 'language' ] ) !== false ) {
540
+ self::$stat[ 'id' ] = -317;
541
+ return $_argument;
542
+ }
543
+
544
  // Geolocation
545
  include_once ( plugin_dir_path( __FILE__ ) . 'vendor/maxmind.php' );
546
+ try {
547
+ $geolocation_data = maxmind_geolite2_connector::get_geolocation_info( self::$stat[ 'ip' ] );
548
+ }
549
+ catch( Exception $e ) {
550
+ self::$stat[ 'id' ] = -314;
551
+ self::_set_error_array( __( 'Invalid MaxMind data file. Please <a target="_blank" href="https://slimstat.freshdesk.com/support/solutions/articles/12000039798-how-to-manually-install-the-maxmind-geolocation-data-file-">follow these steps</a> to download it manually.', 'wp-slimstat' ) );
552
+ return $_argument;
553
+ }
554
 
555
  if ( !empty( $geolocation_data[ 'country' ][ 'iso_code' ] ) ) {
556
 
574
 
575
  unset( $geolocation_data );
576
 
577
+ // Is this country blacklisted?
578
+ if ( !empty( self::$stat[ 'country' ] ) && !empty( self::$settings[ 'ignore_countries' ] ) && stripos( self::$settings[ 'ignore_countries' ], self::$stat[ 'country' ] ) !== false ) {
579
+ self::$stat[ 'id' ] = -308;
580
+ return $_argument;
581
+ }
582
+
583
  // Anonymize IP Address?
584
  if ( self::$settings[ 'anonymize_ip' ] == 'on' ) {
585
  // IPv4 or IPv6
597
  }
598
  }
599
 
 
 
 
 
 
 
600
  // Mark or ignore Firefox/Safari prefetching requests (X-Moz: Prefetch and X-purpose: Preview)
601
  if ( ( isset( $_SERVER[ 'HTTP_X_MOZ' ] ) && ( strtolower( $_SERVER[ 'HTTP_X_MOZ' ] ) == 'prefetch' ) ) ||
602
  ( isset( $_SERVER[ 'HTTP_X_PURPOSE' ] ) && ( strtolower( $_SERVER[ 'HTTP_X_PURPOSE' ] ) == 'preview' ) ) ) {
681
  }
682
  }
683
 
684
+ // Does this visitor have a visit_id cookie?
685
  $set_cookie = apply_filters( 'slimstat_set_visit_cookie', ( !empty( self::$settings[ 'set_tracker_cookie' ] ) && self::$settings[ 'set_tracker_cookie' ] == 'on' ) );
686
  if ( $set_cookie ) {
687
  if ( empty( self::$stat[ 'visit_id' ] ) && !empty( self::$stat[ 'id' ] ) ) {
803
  /**
804
  * Extracts the accepted language from browser headers
805
  */
806
+ protected static function _get_language() {
807
  if ( isset( $_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ] ) ) {
808
 
809
  // Capture up to the first delimiter (, found in Safari)
1327
  break;
1328
 
1329
  case 'widget':
1330
+ if ( empty( wp_slimstat_reports::$reports[ $w ] ) ) {
1331
  return __( 'Invalid Report ID', 'wp-slimstat' );
1332
  }
1333
 
1334
  wp_register_style( 'wp-slimstat-frontend', plugins_url( '/admin/assets/css/slimstat.css', __FILE__ ) );
1335
  wp_enqueue_style( 'wp-slimstat-frontend' );
1336
 
1337
+ wp_slimstat_reports::$reports[ $w ][ 'callback_args' ][ 'is_widget' ] = true;
1338
 
1339
  ob_start();
1340
  echo wp_slimstat_reports::report_header( $w );
1341
+ call_user_func( wp_slimstat_reports::$reports[ $w ][ 'callback' ], wp_slimstat_reports::$reports[ $w ][ 'callback_args' ] );
1342
  wp_slimstat_reports::report_footer();
1343
  $output = ob_get_contents();
1344
  ob_end_clean();
1638
  // -----------------------------------------------------------------------
1639
 
1640
  // Reports - Functionality
 
1641
  'use_current_month_timespan' => 'no',
1642
+ 'posts_column_day_interval' => 28,
1643
  'rows_to_show' => '20',
1644
+ 'show_hits' => 'no',
1645
  'ip_lookup_service' => 'https://www.infosniper.net/?ip_address=',
1646
  'comparison_chart' => 'on',
1647
  'show_display_name' => 'no',
1659
  'mozcom_access_id' => '',
1660
  'mozcom_secret_key' => '',
1661
  'show_complete_user_agent_tooltip' => 'no',
1662
+ 'async_load' => 'no',
1663
+ 'limit_results' => '1000',
1664
  'enable_sov' => 'no',
1665
 
1666
  // Exclusions
1674
  'ignore_users' => '',
1675
  'ignore_ip' => '',
1676
  'ignore_countries' => '',
1677
+ 'ignore_languages' => '',
1678
  'ignore_browsers' => '',
1679
  'ignore_platforms' => '',
1680
  'ignore_capabilities' => '',
1979
  $slimstat_widget_id = !empty( $instance[ 'slimstat_widget_id' ] ) ? $instance[ 'slimstat_widget_id' ] : '';
1980
  $slimstat_widget_filters = !empty( $instance[ 'slimstat_widget_filters' ] ) ? $instance[ 'slimstat_widget_filters' ] : '';
1981
 
1982
+ foreach ( wp_slimstat_reports::$reports as $a_report_id => $a_report_info ) {
1983
  $select_options .= "<option value='$a_report_id' " . ( ( $slimstat_widget_id == $a_report_id ) ? 'selected="selected"' : '' ) . ">{$a_report_info[ 'title' ]}</option>";
1984
  }
1985
  ?>