Version Description
- [Note] Can you believe it? It looks like it was yesterday that we were celebrating the new year with our loved ones, and here we are, getting ready to welcome 2017. For our team, 2016 was a very intense year: we celebrated Slimstat's 10th anniversary, released new add-ons, started community outreach initiatives on Facebook and on our website, implemented new features and much more. Now, with a smaller team, we need to find creative ways to keep providing the stellar support service which many of you appreciate so much in your reviews. For this reason, we need to slighly increase the price of our add-ons starting in early 2017. Don't worry, it will still be a very competitive and reasonable price point, affordable even for those of you who cannot spend hundreds of dollars on their website. However we encourage you to take advantage of these few remaining weeks and buy our add-ons today, before prices go up in January!
- [New] You spoke up, we listened. The third-party Browscap data file has been increasing in size over time, forcing some users to uninstall it from their server because it was causing issues with the PHP memory limit set by the administrator. Although Slimstat provides a built-in heuristic function as a workaround for this issue, we wanted to find a better solution. Replacing the obsolete Browscap parser with the shiny new version 3.0, our tests show a big improvement in terms of performance and use of resources. The only caveat is that the new parser requires PHP 5.5 or newer, so please make sure your server environment is compatible before enabling this feature.
- [Update] Minor touches to the look and feel to make our admin color scheme more consistent throughout the various screens.
- [Fix] Uninstall procedure was not deleting the Browscap and MaxMind data files from the server.
- [Fix] Our release highlights, which are usually shown after updating to the latest version, were not disappearing when clicking on the corresponding button.
- [Fix] PHP warning being returned under certain circumstances (thank you, Sasa and computershowtopro).
Download this release
Release Info
Developer | coolmann |
Plugin | Slimstat Analytics |
Version | 4.5 |
Comparing to | |
See all releases |
Code changes from version 4.4.5 to 4.5
- admin/config/maintenance.php +25 -22
- admin/css/slimstat.css +3 -2
- admin/js/slimstat.admin.js +1 -1
- admin/view/index.php +4 -4
- admin/wp-slimstat-admin.php +51 -39
- browscap/browser.php +80 -5
- browscap/uadetector.php +1 -1
- readme.txt +12 -4
- uninstall.php +25 -17
- wp-slimstat.php +17 -65
admin/config/maintenance.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
// Avoid direct access to this piece of code
|
3 |
-
if (!function_exists('add_action') || (!empty($_POST) && !check_admin_referer('maintenance_wp_slimstat','maintenance_wp_slimstat_nonce'))){
|
4 |
-
exit(0);
|
5 |
}
|
6 |
|
7 |
-
|
8 |
wp_slimstat_reports::init();
|
9 |
|
10 |
-
if (!empty($_REQUEST['action'])){
|
11 |
-
switch ($_REQUEST['action']){
|
12 |
case 'activate-indexes':
|
13 |
wp_slimstat::$wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_resource_idx( resource( 20 ) )" );
|
14 |
wp_slimstat::$wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_browser_idx( browser( 10 ) )" );
|
15 |
wp_slimstat::$wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_searchterms_idx( searchterms( 15 ) )" );
|
16 |
-
wp_slimstat_admin::show_alert_message( __( 'Congratulations! Slimstat Analytics is now optimized for <a href="http://www.youtube.com/watch?v=ygE01sOhzz0" target="_blank">ludicrous speed</a>.', 'wp-slimstat' )
|
17 |
break;
|
18 |
|
19 |
case 'activate-sql-debug-mode':
|
@@ -24,7 +24,7 @@ if (!empty($_REQUEST['action'])){
|
|
24 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_resource_idx");
|
25 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_browser_idx");
|
26 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_searchterms_idx");
|
27 |
-
wp_slimstat_admin::show_alert_message( __( 'Indexing has been disabled. Enjoy the extra database space!', 'wp-slimstat' )
|
28 |
break;
|
29 |
|
30 |
case 'deactivate-sql-debug-mode':
|
@@ -40,38 +40,41 @@ if (!empty($_REQUEST['action'])){
|
|
40 |
FROM {$GLOBALS['wpdb']->prefix}slim_stats t1
|
41 |
WHERE ".wp_slimstat_db::get_combined_where('', '*', false));
|
42 |
}
|
43 |
-
wp_slimstat_admin::show_alert_message(intval($rows_affected).' '.__('records deleted from your database.','wp-slimstat')
|
44 |
break;
|
45 |
|
46 |
case 'delete-maxmind':
|
47 |
@unlink( wp_slimstat::$maxmind_path );
|
48 |
-
wp_slimstat_admin::show_alert_message( __( 'The geolocation database has been uninstalled from your server.', 'wp-slimstat' )
|
49 |
break;
|
50 |
|
51 |
case 'download-maxmind':
|
52 |
$error = wp_slimstat::download_maxmind_database();
|
53 |
|
54 |
if (!empty($error)){
|
55 |
-
wp_slimstat_admin::show_alert_message( $error, 'wp-ui-notification
|
56 |
}
|
57 |
else {
|
58 |
-
wp_slimstat_admin::show_alert_message( __( 'The geolocation database has been installed on your server.', 'wp-slimstat')
|
59 |
}
|
60 |
break;
|
61 |
|
62 |
case 'delete-browscap':
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
-
wp_slimstat_admin::show_alert_message( __( 'The Browscap data file has been uninstalled from your server.', 'wp-slimstat' ), 'wp-ui-highlight below-h2' );
|
68 |
break;
|
69 |
|
70 |
case 'download-browscap':
|
71 |
-
$error =
|
72 |
|
73 |
if ( is_array( $error ) ) {
|
74 |
-
wp_slimstat_admin::show_alert_message( $error[ 1 ], ( empty( $error[ 0 ] ) ? 'wp-ui-highlight
|
75 |
}
|
76 |
break;
|
77 |
|
@@ -99,7 +102,7 @@ if (!empty($_REQUEST['action'])){
|
|
99 |
$GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%meta-box-order_slimstat%'");
|
100 |
$GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%metaboxhidden_slimstat%'");
|
101 |
$GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%closedpostboxes_slimstat%'");
|
102 |
-
wp_slimstat_admin::show_alert_message(__('Your reports were successfully restored to their default arrangement.','wp-slimstat')
|
103 |
break;
|
104 |
|
105 |
case 'switch-engine':
|
@@ -109,13 +112,13 @@ if (!empty($_REQUEST['action'])){
|
|
109 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ENGINE = InnoDB");
|
110 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_events ENGINE = InnoDB");
|
111 |
|
112 |
-
wp_slimstat_admin::show_alert_message(__('Your Slimstat tables have been successfully converted to InnoDB.','wp-slimstat')
|
113 |
break;
|
114 |
|
115 |
case 'truncate-archive':
|
116 |
wp_slimstat::$wpdb->query( "DELETE tsa FROM {$GLOBALS[ 'wpdb' ]->prefix}slim_stats_archive tsa" );
|
117 |
wp_slimstat::$wpdb->query( "OPTIMIZE TABLE {$GLOBALS[ 'wpdb' ]->prefix}slim_stats_archive" );
|
118 |
-
wp_slimstat_admin::show_alert_message( __( 'All the archived records were successfully deleted.', 'wp-slimstat' )
|
119 |
break;
|
120 |
|
121 |
case 'truncate-table':
|
@@ -123,7 +126,7 @@ if (!empty($_REQUEST['action'])){
|
|
123 |
wp_slimstat::$wpdb->query( "OPTIMIZE TABLE {$GLOBALS[ 'wpdb' ]->prefix}slim_events" );
|
124 |
wp_slimstat::$wpdb->query( "DELETE t1 FROM {$GLOBALS[ 'wpdb' ]->prefix}slim_stats t1" );
|
125 |
wp_slimstat::$wpdb->query( "OPTIMIZE TABLE {$GLOBALS[ 'wpdb' ]->prefix}slim_stats" );
|
126 |
-
wp_slimstat_admin::show_alert_message( __( 'All the records were successfully deleted.', 'wp-slimstat' )
|
127 |
break;
|
128 |
|
129 |
default:
|
@@ -282,7 +285,7 @@ $slim_browsers_exists =wp_slimstat::$wpdb->get_col( "SHOW TABLES LIKE '{$GLOBALS
|
|
282 |
</tr>
|
283 |
<tr class="alternate">
|
284 |
<th scope="row">
|
285 |
-
<?php if ( !file_exists(
|
286 |
<a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&action=download-browscap"
|
287 |
onclick="return( confirm( '<?php _e( 'Do you want to download and install the Browscap data file from our server?', 'wp-slimstat' ); ?>' ) )"><?php _e( 'Install Browscap', 'wp-slimstat' ); ?></a>
|
288 |
<?php else: ?>
|
1 |
<?php
|
2 |
// Avoid direct access to this piece of code
|
3 |
+
if ( !function_exists( 'add_action' ) || ( !empty( $_POST ) && !check_admin_referer( 'maintenance_wp_slimstat', 'maintenance_wp_slimstat_nonce' ) ) ) {
|
4 |
+
exit( 0 );
|
5 |
}
|
6 |
|
7 |
+
require_once( dirname( dirname( __FILE__ ) ) . '/view/wp-slimstat-reports.php' );
|
8 |
wp_slimstat_reports::init();
|
9 |
|
10 |
+
if ( !empty( $_REQUEST[ 'action' ] ) ) {
|
11 |
+
switch ( $_REQUEST[ 'action' ] ) {
|
12 |
case 'activate-indexes':
|
13 |
wp_slimstat::$wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_resource_idx( resource( 20 ) )" );
|
14 |
wp_slimstat::$wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_browser_idx( browser( 10 ) )" );
|
15 |
wp_slimstat::$wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_searchterms_idx( searchterms( 15 ) )" );
|
16 |
+
wp_slimstat_admin::show_alert_message( __( 'Congratulations! Slimstat Analytics is now optimized for <a href="http://www.youtube.com/watch?v=ygE01sOhzz0" target="_blank">ludicrous speed</a>.', 'wp-slimstat' ) );
|
17 |
break;
|
18 |
|
19 |
case 'activate-sql-debug-mode':
|
24 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_resource_idx");
|
25 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_browser_idx");
|
26 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_searchterms_idx");
|
27 |
+
wp_slimstat_admin::show_alert_message( __( 'Indexing has been disabled. Enjoy the extra database space!', 'wp-slimstat' ) );
|
28 |
break;
|
29 |
|
30 |
case 'deactivate-sql-debug-mode':
|
40 |
FROM {$GLOBALS['wpdb']->prefix}slim_stats t1
|
41 |
WHERE ".wp_slimstat_db::get_combined_where('', '*', false));
|
42 |
}
|
43 |
+
wp_slimstat_admin::show_alert_message( intval( $rows_affected ) . ' ' . __( 'records deleted from your database.', 'wp-slimstat' ) );
|
44 |
break;
|
45 |
|
46 |
case 'delete-maxmind':
|
47 |
@unlink( wp_slimstat::$maxmind_path );
|
48 |
+
wp_slimstat_admin::show_alert_message( __( 'The geolocation database has been uninstalled from your server.', 'wp-slimstat' ) );
|
49 |
break;
|
50 |
|
51 |
case 'download-maxmind':
|
52 |
$error = wp_slimstat::download_maxmind_database();
|
53 |
|
54 |
if (!empty($error)){
|
55 |
+
wp_slimstat_admin::show_alert_message( $error, 'wp-ui-notification' );
|
56 |
}
|
57 |
else {
|
58 |
+
wp_slimstat_admin::show_alert_message( __( 'The geolocation database has been installed on your server.', 'wp-slimstat') );
|
59 |
}
|
60 |
break;
|
61 |
|
62 |
case 'delete-browscap':
|
63 |
+
// Delete the existing folder, if there
|
64 |
+
WP_Filesystem();
|
65 |
+
if ( $GLOBALS[ 'wp_filesystem' ]->rmdir( dirname( slim_browser::$browscap_autoload_path ) . '/', true ) ) {
|
66 |
+
wp_slimstat_admin::show_alert_message( __( 'The Browscap data file has been uninstalled from your server.', 'wp-slimstat' ) );
|
67 |
+
}
|
68 |
+
else {
|
69 |
+
wp_slimstat_admin::show_alert_message( __( 'There was an error deleting the Browscap data folder on your server. Please check your permissions.', 'wp-slimstat' ) );
|
70 |
}
|
|
|
71 |
break;
|
72 |
|
73 |
case 'download-browscap':
|
74 |
+
$error = slim_browser::update_browscap_database( true );
|
75 |
|
76 |
if ( is_array( $error ) ) {
|
77 |
+
wp_slimstat_admin::show_alert_message( $error[ 1 ], ( empty( $error[ 0 ] ) ? 'wp-ui-highlight': 'wp-ui-notification' ) );
|
78 |
}
|
79 |
break;
|
80 |
|
102 |
$GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%meta-box-order_slimstat%'");
|
103 |
$GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%metaboxhidden_slimstat%'");
|
104 |
$GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%closedpostboxes_slimstat%'");
|
105 |
+
wp_slimstat_admin::show_alert_message( __( 'Your reports were successfully restored to their default arrangement.', 'wp-slimstat') );
|
106 |
break;
|
107 |
|
108 |
case 'switch-engine':
|
112 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ENGINE = InnoDB");
|
113 |
wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_events ENGINE = InnoDB");
|
114 |
|
115 |
+
wp_slimstat_admin::show_alert_message( __( 'Your Slimstat tables have been successfully converted to InnoDB.', 'wp-slimstat' ) );
|
116 |
break;
|
117 |
|
118 |
case 'truncate-archive':
|
119 |
wp_slimstat::$wpdb->query( "DELETE tsa FROM {$GLOBALS[ 'wpdb' ]->prefix}slim_stats_archive tsa" );
|
120 |
wp_slimstat::$wpdb->query( "OPTIMIZE TABLE {$GLOBALS[ 'wpdb' ]->prefix}slim_stats_archive" );
|
121 |
+
wp_slimstat_admin::show_alert_message( __( 'All the archived records were successfully deleted.', 'wp-slimstat' ) );
|
122 |
break;
|
123 |
|
124 |
case 'truncate-table':
|
126 |
wp_slimstat::$wpdb->query( "OPTIMIZE TABLE {$GLOBALS[ 'wpdb' ]->prefix}slim_events" );
|
127 |
wp_slimstat::$wpdb->query( "DELETE t1 FROM {$GLOBALS[ 'wpdb' ]->prefix}slim_stats t1" );
|
128 |
wp_slimstat::$wpdb->query( "OPTIMIZE TABLE {$GLOBALS[ 'wpdb' ]->prefix}slim_stats" );
|
129 |
+
wp_slimstat_admin::show_alert_message( __( 'All the records were successfully deleted.', 'wp-slimstat' ) );
|
130 |
break;
|
131 |
|
132 |
default:
|
285 |
</tr>
|
286 |
<tr class="alternate">
|
287 |
<th scope="row">
|
288 |
+
<?php if ( !file_exists( slim_browser::$browscap_autoload_path ) ) : ?>
|
289 |
<a class="button-secondary" href="<?php echo wp_slimstat_admin::$config_url.$current_tab ?>&action=download-browscap"
|
290 |
onclick="return( confirm( '<?php _e( 'Do you want to download and install the Browscap data file from our server?', 'wp-slimstat' ); ?>' ) )"><?php _e( 'Install Browscap', 'wp-slimstat' ); ?></a>
|
291 |
<?php else: ?>
|
admin/css/slimstat.css
CHANGED
@@ -420,9 +420,10 @@
|
|
420 |
|
421 |
/* Settings */
|
422 |
#slimstat-message{
|
423 |
-
|
424 |
clear: both;
|
425 |
-
|
|
|
426 |
padding: 0 10px;
|
427 |
}
|
428 |
#slimstat-message p:before{
|
420 |
|
421 |
/* Settings */
|
422 |
#slimstat-message{
|
423 |
+
background-color: #555;
|
424 |
clear: both;
|
425 |
+
color: #fff;
|
426 |
+
overflow: hidden;
|
427 |
padding: 0 10px;
|
428 |
}
|
429 |
#slimstat-message p:before{
|
admin/js/slimstat.admin.js
CHANGED
@@ -400,7 +400,7 @@ jQuery(function(){
|
|
400 |
// Hide a notice and send the corresponding ajax request to the server
|
401 |
jQuery( document ).on( 'click', '[id^=slimstat-hide-]', function( e ) {
|
402 |
e.preventDefault();
|
403 |
-
jQuery( this ).parents( '.
|
404 |
data = {
|
405 |
action: jQuery( this ).attr('id').replace(/-/g, '_'),
|
406 |
security: jQuery( '#meta-box-order-nonce' ).val()
|
400 |
// Hide a notice and send the corresponding ajax request to the server
|
401 |
jQuery( document ).on( 'click', '[id^=slimstat-hide-]', function( e ) {
|
402 |
e.preventDefault();
|
403 |
+
jQuery( this ).parents( '.slimstat-notice' ).slideUp( 1000 );
|
404 |
data = {
|
405 |
action: jQuery( this ).attr('id').replace(/-/g, '_'),
|
406 |
security: jQuery( '#meta-box-order-nonce' ).val()
|
admin/view/index.php
CHANGED
@@ -118,15 +118,15 @@
|
|
118 |
</form>
|
119 |
<?php
|
120 |
if ( !file_exists( wp_slimstat::$maxmind_path ) && ( empty( wp_slimstat::$settings[ 'no_maxmind_warning' ] ) || wp_slimstat::$settings[ 'no_maxmind_warning' ] != 'yes' ) ) {
|
121 |
-
wp_slimstat_admin::show_alert_message( sprintf( __( "
|
122 |
}
|
123 |
|
124 |
-
if ( !file_exists(
|
125 |
-
wp_slimstat_admin::show_alert_message( sprintf( __( "Install the Browscap <a href='%s'>User Agent Database</a> to accurately determine your visitors' browser and operating system.", 'wp-slimstat' ), self::$config_url . '6#wp-slimstat-external-data-files' ) . '<a id="slimstat-hide-browscap-notice" class="slimstat-font-cancel slimstat-float-right" title="Hide this notice" href="#"></a>', 'wp-ui-notification below-h2' );
|
126 |
}
|
127 |
|
128 |
if ( wp_slimstat::$advanced_cache_exists && ( empty( wp_slimstat::$settings[ 'no_caching_warning' ] ) || wp_slimstat::$settings[ 'no_caching_warning' ] != 'yes' ) && ( empty( wp_slimstat::$settings[ 'javascript_mode' ] ) || wp_slimstat::$settings[ 'javascript_mode' ] != 'yes' ) ) {
|
129 |
-
wp_slimstat_admin::show_alert_message( sprintf( __( "A caching plugin has been detected on your website. Please <a href='%s' target='_blank'>make sure to configure</a> Slimstat Analytics accordingly, to get accurate information.", 'wp-slimstat' ), 'https://slimstat.freshdesk.com/support/solutions/articles/5000528524-i-am-using-w3-total-cache-or-wp-super-cache-hypercache-etc-and-it-looks-like-slimstat-is-not-tra' ) . '<a id="slimstat-hide-caching-notice" class="slimstat-font-cancel slimstat-float-right" title="Hide this notice" href="#"></a>', 'wp-ui-notification below-h2' );
|
130 |
}
|
131 |
|
132 |
$filters_html = wp_slimstat_reports::get_filters_html( wp_slimstat_db::$filters_normalized[ 'columns' ] );
|
118 |
</form>
|
119 |
<?php
|
120 |
if ( !file_exists( wp_slimstat::$maxmind_path ) && ( empty( wp_slimstat::$settings[ 'no_maxmind_warning' ] ) || wp_slimstat::$settings[ 'no_maxmind_warning' ] != 'yes' ) ) {
|
121 |
+
wp_slimstat_admin::show_alert_message( sprintf( __( "<a href='%s'>Install MaxMind's GeoLite DB</a> to determine your visitors' country of origin.", 'wp-slimstat' ), self::$config_url . '6#wp-slimstat-external-data-files' ) . '<a id="slimstat-hide-geolite-notice" class="slimstat-font-cancel slimstat-float-right" title="Hide this notice" href="#"></a>', 'wp-ui-text-notification below-h2' );
|
122 |
}
|
123 |
|
124 |
+
if ( !file_exists( slim_browser::$browscap_autoload_path ) && ( empty( wp_slimstat::$settings[ 'no_browscap_warning' ] ) || wp_slimstat::$settings[ 'no_browscap_warning' ] != 'yes' ) ) {
|
125 |
+
wp_slimstat_admin::show_alert_message( sprintf( __( "Install the Browscap <a href='%s'>User Agent Database</a> to accurately determine your visitors' browser and operating system.", 'wp-slimstat' ), self::$config_url . '6#wp-slimstat-external-data-files' ) . '<a id="slimstat-hide-browscap-notice" class="slimstat-font-cancel slimstat-float-right" title="Hide this notice" href="#"></a>', 'wp-ui-text-notification below-h2' );
|
126 |
}
|
127 |
|
128 |
if ( wp_slimstat::$advanced_cache_exists && ( empty( wp_slimstat::$settings[ 'no_caching_warning' ] ) || wp_slimstat::$settings[ 'no_caching_warning' ] != 'yes' ) && ( empty( wp_slimstat::$settings[ 'javascript_mode' ] ) || wp_slimstat::$settings[ 'javascript_mode' ] != 'yes' ) ) {
|
129 |
+
wp_slimstat_admin::show_alert_message( sprintf( __( "A caching plugin has been detected on your website. Please <a href='%s' target='_blank'>make sure to configure</a> Slimstat Analytics accordingly, to get accurate information.", 'wp-slimstat' ), 'https://slimstat.freshdesk.com/support/solutions/articles/5000528524-i-am-using-w3-total-cache-or-wp-super-cache-hypercache-etc-and-it-looks-like-slimstat-is-not-tra' ) . '<a id="slimstat-hide-caching-notice" class="slimstat-font-cancel slimstat-float-right" title="Hide this notice" href="#"></a>', 'wp-ui-text-notification below-h2' );
|
130 |
}
|
131 |
|
132 |
$filters_html = wp_slimstat_reports::get_filters_html( wp_slimstat_db::$filters_normalized[ 'columns' ] );
|
admin/wp-slimstat-admin.php
CHANGED
@@ -11,7 +11,7 @@ class wp_slimstat_admin {
|
|
11 |
* Init -- Sets things up.
|
12 |
*/
|
13 |
public static function init() {
|
14 |
-
self::$admin_notice = "
|
15 |
self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">Got it, thanks</a>';
|
16 |
|
17 |
// Load language files
|
@@ -91,16 +91,16 @@ class wp_slimstat_admin {
|
|
91 |
self::$config_url = 'admin.php?page=slimconfig&tab=';
|
92 |
|
93 |
// WPMU - New blog created
|
94 |
-
$active_sitewide_plugins = get_site_option('active_sitewide_plugins');
|
95 |
-
if (!empty($active_sitewide_plugins['wp-slimstat/wp-slimstat.php'])){
|
96 |
-
add_action('wpmu_new_blog', array(__CLASS__, 'new_blog'));
|
97 |
}
|
98 |
|
99 |
// WPMU - Blog Deleted
|
100 |
-
add_filter('wpmu_drop_tables', array(__CLASS__, 'drop_tables'), 10, 2);
|
101 |
|
102 |
// Screen options: hide/show panels to customize your view
|
103 |
-
add_filter('screen_settings', array(__CLASS__, 'screen_settings'), 10, 2);
|
104 |
|
105 |
// Display a notice that hightlights this version's features
|
106 |
if ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slimview' ) !== false ) {
|
@@ -120,29 +120,29 @@ class wp_slimstat_admin {
|
|
120 |
add_action( 'admin_bar_menu', array( __CLASS__, 'wp_slimstat_adminbar' ), 100 );
|
121 |
}
|
122 |
|
123 |
-
if (function_exists('is_network_admin') && !is_network_admin()){
|
124 |
// Add the appropriate entries to the admin menu, if this user can view/admin WP SlimStats
|
125 |
-
add_action('admin_menu', array(__CLASS__, 'wp_slimstat_add_view_menu'));
|
126 |
-
add_action('admin_menu', array(__CLASS__, 'wp_slimstat_add_config_menu'));
|
127 |
|
128 |
// Display the column in the Edit Posts / Pages screen
|
129 |
if ( wp_slimstat::$settings[ 'add_posts_column' ] == 'yes' ) {
|
130 |
$post_types = get_post_types( array( 'public' => true, 'show_ui' => true ), 'names' );
|
131 |
-
include_once( dirname(__FILE__) . '/view/wp-slimstat-reports.php' );
|
132 |
-
include_once( dirname(__FILE__) . '/view/wp-slimstat-db.php' );
|
133 |
|
134 |
foreach ( $post_types as $a_post_type ) {
|
135 |
-
add_filter("manage_{$a_post_type}_posts_columns", array(__CLASS__, 'add_column_header'));
|
136 |
-
add_action("manage_{$a_post_type}_posts_custom_column", array(__CLASS__, 'add_post_column'), 10, 2);
|
137 |
}
|
138 |
|
139 |
if ( strpos( $_SERVER['REQUEST_URI'], 'edit.php' ) !== false ) {
|
140 |
-
add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet'));
|
141 |
}
|
142 |
}
|
143 |
|
144 |
// Add some inline CSS to customize the icon associated to SlimStat in the sidebar
|
145 |
-
add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet_icon'));
|
146 |
|
147 |
// Update the table structure and options, if needed
|
148 |
if ( !empty( wp_slimstat::$settings[ 'version' ] ) && wp_slimstat::$settings[ 'version' ] != wp_slimstat::$version ) {
|
@@ -654,6 +654,18 @@ class wp_slimstat_admin {
|
|
654 |
}
|
655 |
// --- END: Updates for version 4.4.5 ---
|
656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
// Now we can update the version stored in the database
|
658 |
wp_slimstat::$settings[ 'version' ] = wp_slimstat::$version;
|
659 |
|
@@ -740,9 +752,9 @@ class wp_slimstat_admin {
|
|
740 |
// end wp_slimstat_userdefined_stylesheet
|
741 |
|
742 |
public static function wp_slimstat_enqueue_scripts( $_hook = '' ) {
|
743 |
-
wp_enqueue_script('dashboard');
|
744 |
-
wp_enqueue_script('jquery-ui-datepicker');
|
745 |
-
wp_enqueue_script('slimstat_admin', plugins_url('/admin/js/slimstat.admin.js', dirname(__FILE__)), array('jquery-ui-dialog'), null, false);
|
746 |
|
747 |
// Pass some information to Javascript
|
748 |
$params = array(
|
@@ -754,7 +766,7 @@ class wp_slimstat_admin {
|
|
754 |
'text_direction' => $GLOBALS[ 'wp_locale' ]->text_direction,
|
755 |
'use_slimscroll' => !empty( wp_slimstat::$settings[ 'use_slimscroll' ] ) ? wp_slimstat::$settings[ 'use_slimscroll' ] : 'yes'
|
756 |
);
|
757 |
-
wp_localize_script('slimstat_admin', 'SlimStatAdminParams', $params);
|
758 |
}
|
759 |
|
760 |
// public static function wp_slimstat_enqueue_config_scripts(){
|
@@ -797,9 +809,9 @@ class wp_slimstat_admin {
|
|
797 |
|
798 |
// Load styles and Javascript needed to make the reports look nice and interactive
|
799 |
foreach($new_entry as $a_entry){
|
800 |
-
add_action('load-'
|
801 |
-
add_action('load-'
|
802 |
-
add_action('load-'
|
803 |
}
|
804 |
|
805 |
return $_s;
|
@@ -894,32 +906,32 @@ class wp_slimstat_admin {
|
|
894 |
/**
|
895 |
* Includes the appropriate panel to view the stats
|
896 |
*/
|
897 |
-
public static function wp_slimstat_include_view(){
|
898 |
-
include(dirname(__FILE__).'/view/index.php');
|
899 |
}
|
900 |
// end wp_slimstat_include_view
|
901 |
|
902 |
/**
|
903 |
* Includes the screen to arrange the reports
|
904 |
*/
|
905 |
-
public static function wp_slimstat_include_layout(){
|
906 |
-
include(dirname(__FILE__).'/view/layout.php');
|
907 |
}
|
908 |
// end wp_slimstat_include_addons
|
909 |
|
910 |
/**
|
911 |
* Includes the screen to manage add-ons
|
912 |
*/
|
913 |
-
public static function wp_slimstat_include_addons(){
|
914 |
-
include(dirname(__FILE__).'/view/addons.php');
|
915 |
}
|
916 |
// end wp_slimstat_include_addons
|
917 |
|
918 |
/**
|
919 |
* Includes the appropriate panel to configure Slimstat
|
920 |
*/
|
921 |
-
public static function wp_slimstat_include_config(){
|
922 |
-
include(dirname(__FILE__).'/config/index.php');
|
923 |
}
|
924 |
// end wp_slimstat_include_config
|
925 |
|
@@ -1022,8 +1034,8 @@ class wp_slimstat_admin {
|
|
1022 |
/**
|
1023 |
* Displays an alert message
|
1024 |
*/
|
1025 |
-
public static function show_alert_message($_message = '', $_type = '
|
1026 |
-
echo "<div id='slimstat-message' class='$_type'><p>$_message</p></div>";
|
1027 |
}
|
1028 |
|
1029 |
/**
|
@@ -1077,23 +1089,23 @@ class wp_slimstat_admin {
|
|
1077 |
* Handles the Ajax requests to load, save or delete existing filters
|
1078 |
*/
|
1079 |
public static function manage_filters(){
|
1080 |
-
check_ajax_referer('meta-box-order', 'security');
|
1081 |
|
1082 |
-
include_once(dirname(__FILE__).'/view/wp-slimstat-reports.php');
|
1083 |
wp_slimstat_reports::init();
|
1084 |
|
1085 |
$saved_filters = get_option( 'slimstat_filters', array() );
|
1086 |
$filter_found = 0;
|
1087 |
|
1088 |
-
switch($_POST['type']){
|
1089 |
case 'save':
|
1090 |
-
$new_filter = unserialize(stripslashes_deep($_POST['filter_array']));
|
1091 |
|
1092 |
// Check if this filter is already saved
|
1093 |
-
foreach ($saved_filters as $a_saved_filter){
|
1094 |
$filter_found = 0;
|
1095 |
|
1096 |
-
if (count($a_saved_filter) != count($new_filter) || count(array_intersect_key($a_saved_filter, $new_filter)) != count($new_filter)){
|
1097 |
$filter_found = 1;
|
1098 |
continue;
|
1099 |
}
|
@@ -1333,7 +1345,7 @@ class wp_slimstat_admin {
|
|
1333 |
$screen->add_help_tab(
|
1334 |
array(
|
1335 |
'id' => 'wp-slimstat-definitions',
|
1336 |
-
'title' => __('Definitions','wp-slimstat'),
|
1337 |
'content' => '
|
1338 |
<ul>
|
1339 |
<li><b>'.__('Pageview','wp-slimstat').'</b>: '.__('A request to load a single HTML file ("page"). This should be contrasted with a "hit", which refers to a request for any file from a web server. Slimstat logs a pageview each time the tracking code is executed','wp-slimstat').'</li>
|
11 |
* Init -- Sets things up.
|
12 |
*/
|
13 |
public static function init() {
|
14 |
+
self::$admin_notice = "Can you believe it? It looks like it was yesterday that we were celebrating the new year with our loved ones, and here we are, getting ready to welcome 2017. For our team, 2016 was a great year: we celebrated Slimstat's 10th anniversary, released new add-ons, started community outreach initiatives on Facebook and on our website, implemented new features and much more. Now, with a smaller team, we need to find creative ways to keep providing our stellar support service, which many of you appreciate so much in your reviews. For this reason, we are going to <strong>increase the cost</strong> of our add-ons in the next few weeks. No worries, it will still be a very competitive and reasonable price point, affordable even for those of you who cannot spend hundreds of dollars on their websites. In the meanwhile, you can use coupon <code>HAPPY2017</code> to get 17% off any purchase to sweeten the deal. This offer expires on January 15, so go <a href='https://www.wp-slimstat.com/addons/' target='_blank'>buy your add-ons today</a>!";
|
15 |
self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">Got it, thanks</a>';
|
16 |
|
17 |
// Load language files
|
91 |
self::$config_url = 'admin.php?page=slimconfig&tab=';
|
92 |
|
93 |
// WPMU - New blog created
|
94 |
+
$active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
|
95 |
+
if ( !empty( $active_sitewide_plugins[ 'wp-slimstat/wp-slimstat.php' ] ) ) {
|
96 |
+
add_action( 'wpmu_new_blog', array( __CLASS__, 'new_blog' ) );
|
97 |
}
|
98 |
|
99 |
// WPMU - Blog Deleted
|
100 |
+
add_filter( 'wpmu_drop_tables', array( __CLASS__, 'drop_tables' ), 10, 2 );
|
101 |
|
102 |
// Screen options: hide/show panels to customize your view
|
103 |
+
add_filter( 'screen_settings', array( __CLASS__, 'screen_settings' ), 10, 2 );
|
104 |
|
105 |
// Display a notice that hightlights this version's features
|
106 |
if ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slimview' ) !== false ) {
|
120 |
add_action( 'admin_bar_menu', array( __CLASS__, 'wp_slimstat_adminbar' ), 100 );
|
121 |
}
|
122 |
|
123 |
+
if ( function_exists( 'is_network_admin' ) && !is_network_admin() ) {
|
124 |
// Add the appropriate entries to the admin menu, if this user can view/admin WP SlimStats
|
125 |
+
add_action( 'admin_menu', array( __CLASS__, 'wp_slimstat_add_view_menu' ) );
|
126 |
+
add_action( 'admin_menu', array( __CLASS__, 'wp_slimstat_add_config_menu' ) );
|
127 |
|
128 |
// Display the column in the Edit Posts / Pages screen
|
129 |
if ( wp_slimstat::$settings[ 'add_posts_column' ] == 'yes' ) {
|
130 |
$post_types = get_post_types( array( 'public' => true, 'show_ui' => true ), 'names' );
|
131 |
+
include_once( dirname( __FILE__ ) . '/view/wp-slimstat-reports.php' );
|
132 |
+
include_once( dirname( __FILE__ ) . '/view/wp-slimstat-db.php' );
|
133 |
|
134 |
foreach ( $post_types as $a_post_type ) {
|
135 |
+
add_filter( "manage_{$a_post_type}_posts_columns", array( __CLASS__, 'add_column_header' ) );
|
136 |
+
add_action( "manage_{$a_post_type}_posts_custom_column", array( __CLASS__, 'add_post_column' ), 10, 2 );
|
137 |
}
|
138 |
|
139 |
if ( strpos( $_SERVER['REQUEST_URI'], 'edit.php' ) !== false ) {
|
140 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'wp_slimstat_stylesheet' ) );
|
141 |
}
|
142 |
}
|
143 |
|
144 |
// Add some inline CSS to customize the icon associated to SlimStat in the sidebar
|
145 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'wp_slimstat_stylesheet_icon' ) );
|
146 |
|
147 |
// Update the table structure and options, if needed
|
148 |
if ( !empty( wp_slimstat::$settings[ 'version' ] ) && wp_slimstat::$settings[ 'version' ] != wp_slimstat::$version ) {
|
654 |
}
|
655 |
// --- END: Updates for version 4.4.5 ---
|
656 |
|
657 |
+
// --- Updates for version 4.5 ---
|
658 |
+
if ( version_compare( wp_slimstat::$settings[ 'version' ], '4.5', '<' ) ) {
|
659 |
+
// Download the new Browscap data structure, if the old one was installed
|
660 |
+
slim_browser::update_browscap_database( true );
|
661 |
+
|
662 |
+
// Clean up after yourself, son!
|
663 |
+
if ( file_exists( wp_slimstat::$upload_dir . '/browscap-db.php' ) ) {
|
664 |
+
@unlink( wp_slimstat::$upload_dir . '/browscap-db.php' );
|
665 |
+
}
|
666 |
+
}
|
667 |
+
// --- END: Updates for version 4.5 ---
|
668 |
+
|
669 |
// Now we can update the version stored in the database
|
670 |
wp_slimstat::$settings[ 'version' ] = wp_slimstat::$version;
|
671 |
|
752 |
// end wp_slimstat_userdefined_stylesheet
|
753 |
|
754 |
public static function wp_slimstat_enqueue_scripts( $_hook = '' ) {
|
755 |
+
wp_enqueue_script( 'dashboard' );
|
756 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
757 |
+
wp_enqueue_script( 'slimstat_admin', plugins_url( '/admin/js/slimstat.admin.js', dirname( __FILE__ ) ), array( 'jquery-ui-dialog' ), null, false );
|
758 |
|
759 |
// Pass some information to Javascript
|
760 |
$params = array(
|
766 |
'text_direction' => $GLOBALS[ 'wp_locale' ]->text_direction,
|
767 |
'use_slimscroll' => !empty( wp_slimstat::$settings[ 'use_slimscroll' ] ) ? wp_slimstat::$settings[ 'use_slimscroll' ] : 'yes'
|
768 |
);
|
769 |
+
wp_localize_script( 'slimstat_admin', 'SlimStatAdminParams', $params );
|
770 |
}
|
771 |
|
772 |
// public static function wp_slimstat_enqueue_config_scripts(){
|
809 |
|
810 |
// Load styles and Javascript needed to make the reports look nice and interactive
|
811 |
foreach($new_entry as $a_entry){
|
812 |
+
add_action( 'load-' . $a_entry, array( __CLASS__, 'wp_slimstat_stylesheet' ) );
|
813 |
+
add_action( 'load-' . $a_entry, array( __CLASS__, 'wp_slimstat_enqueue_scripts' ) );
|
814 |
+
add_action( 'load-' . $a_entry, array( __CLASS__, 'contextual_help' ) );
|
815 |
}
|
816 |
|
817 |
return $_s;
|
906 |
/**
|
907 |
* Includes the appropriate panel to view the stats
|
908 |
*/
|
909 |
+
public static function wp_slimstat_include_view() {
|
910 |
+
include( dirname( __FILE__ ) . '/view/index.php' );
|
911 |
}
|
912 |
// end wp_slimstat_include_view
|
913 |
|
914 |
/**
|
915 |
* Includes the screen to arrange the reports
|
916 |
*/
|
917 |
+
public static function wp_slimstat_include_layout() {
|
918 |
+
include( dirname( __FILE__ ) . '/view/layout.php' );
|
919 |
}
|
920 |
// end wp_slimstat_include_addons
|
921 |
|
922 |
/**
|
923 |
* Includes the screen to manage add-ons
|
924 |
*/
|
925 |
+
public static function wp_slimstat_include_addons() {
|
926 |
+
include( dirname( __FILE__ ) . '/view/addons.php' );
|
927 |
}
|
928 |
// end wp_slimstat_include_addons
|
929 |
|
930 |
/**
|
931 |
* Includes the appropriate panel to configure Slimstat
|
932 |
*/
|
933 |
+
public static function wp_slimstat_include_config() {
|
934 |
+
include( dirname( __FILE__ ) . '/config/index.php' );
|
935 |
}
|
936 |
// end wp_slimstat_include_config
|
937 |
|
1034 |
/**
|
1035 |
* Displays an alert message
|
1036 |
*/
|
1037 |
+
public static function show_alert_message( $_message = '', $_type = 'wp-ui-highlight' ){
|
1038 |
+
echo "<div id='slimstat-message' class='$_type below-h2'><p>$_message</p></div>";
|
1039 |
}
|
1040 |
|
1041 |
/**
|
1089 |
* Handles the Ajax requests to load, save or delete existing filters
|
1090 |
*/
|
1091 |
public static function manage_filters(){
|
1092 |
+
check_ajax_referer( 'meta-box-order', 'security' );
|
1093 |
|
1094 |
+
include_once( dirname( __FILE__ ) . '/view/wp-slimstat-reports.php' );
|
1095 |
wp_slimstat_reports::init();
|
1096 |
|
1097 |
$saved_filters = get_option( 'slimstat_filters', array() );
|
1098 |
$filter_found = 0;
|
1099 |
|
1100 |
+
switch( $_POST[ 'type' ] ) {
|
1101 |
case 'save':
|
1102 |
+
$new_filter = unserialize( stripslashes_deep( $_POST[ 'filter_array' ] ) );
|
1103 |
|
1104 |
// Check if this filter is already saved
|
1105 |
+
foreach ( $saved_filters as $a_saved_filter ) {
|
1106 |
$filter_found = 0;
|
1107 |
|
1108 |
+
if ( count( $a_saved_filter ) != count( $new_filter ) || count( array_intersect_key( $a_saved_filter, $new_filter ) ) != count( $new_filter ) ) {
|
1109 |
$filter_found = 1;
|
1110 |
continue;
|
1111 |
}
|
1345 |
$screen->add_help_tab(
|
1346 |
array(
|
1347 |
'id' => 'wp-slimstat-definitions',
|
1348 |
+
'title' => __( 'Definitions', 'wp-slimstat' ),
|
1349 |
'content' => '
|
1350 |
<ul>
|
1351 |
<li><b>'.__('Pageview','wp-slimstat').'</b>: '.__('A request to load a single HTML file ("page"). This should be contrasted with a "hit", which refers to a request for any file from a web server. Slimstat logs a pageview each time the tracking code is executed','wp-slimstat').'</li>
|
browscap/browser.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
class slim_browser {
|
4 |
public static $browser = array();
|
|
|
5 |
|
6 |
public static function init() {
|
7 |
self::$browser = array(
|
@@ -12,11 +13,14 @@ class slim_browser {
|
|
12 |
'user_agent' => self::_get_user_agent()
|
13 |
);
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
include_once( wp_slimstat::$browscap_path );
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
}
|
22 |
|
@@ -29,7 +33,7 @@ class slim_browser {
|
|
29 |
}
|
30 |
|
31 |
if ( self::$browser[ 'browser' ] == 'Default Browser' ) {
|
32 |
-
|
33 |
self::$browser = slim_uadetector::get_browser( self::$browser[ 'user_agent' ] );
|
34 |
}
|
35 |
|
@@ -37,6 +41,77 @@ class slim_browser {
|
|
37 |
}
|
38 |
// end get_browser
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
protected static function _get_user_agent() {
|
41 |
$user_agent = ( !empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? trim( $_SERVER[ 'HTTP_USER_AGENT' ] ) : '' );
|
42 |
|
2 |
|
3 |
class slim_browser {
|
4 |
public static $browser = array();
|
5 |
+
public static $browscap_autoload_path = '';
|
6 |
|
7 |
public static function init() {
|
8 |
self::$browser = array(
|
13 |
'user_agent' => self::_get_user_agent()
|
14 |
);
|
15 |
|
16 |
+
// Path to the Browscap data and library
|
17 |
+
self::$browscap_autoload_path = wp_slimstat::$upload_dir . '/browscap-db/autoload.php';
|
|
|
18 |
|
19 |
+
if ( file_exists( self::$browscap_autoload_path ) && version_compare( PHP_VERSION, '5.5', '>=' ) ) {
|
20 |
+
$error = self::update_browscap_database( false );
|
21 |
+
require_once( self::$browscap_autoload_path );
|
22 |
+
|
23 |
+
self::$browser = slimBrowscapConnector::get_browser_from_browscap( self::$browser );
|
24 |
}
|
25 |
}
|
26 |
|
33 |
}
|
34 |
|
35 |
if ( self::$browser[ 'browser' ] == 'Default Browser' ) {
|
36 |
+
require_once( plugin_dir_path( __FILE__ ) . 'uadetector.php' );
|
37 |
self::$browser = slim_uadetector::get_browser( self::$browser[ 'user_agent' ] );
|
38 |
}
|
39 |
|
41 |
}
|
42 |
// end get_browser
|
43 |
|
44 |
+
/**
|
45 |
+
* Downloads the Browscap User Agent database from our repository
|
46 |
+
*/
|
47 |
+
public static function update_browscap_database( $_force_download = false ) {
|
48 |
+
if ( version_compare( PHP_VERSION, '5.5', '<' ) ) {
|
49 |
+
return array( 4, __( 'This library requires at least PHP 5.5. Please ask your service provider to upgrade your server accordingly.', 'wp-slimstat' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
// Create the folder, if it doesn't exist
|
53 |
+
if ( !file_exists( wp_slimstat::$upload_dir ) ) {
|
54 |
+
@mkdir( wp_slimstat::$upload_dir );
|
55 |
+
}
|
56 |
+
|
57 |
+
$download_remote_file = $_force_download;
|
58 |
+
$local_version = 0;
|
59 |
+
$browscap_zip = wp_slimstat::$upload_dir . '/browscap-db.zip';
|
60 |
+
|
61 |
+
// Check for updates once a week ( 604800 seconds )
|
62 |
+
if ( false === $download_remote_file && false !== ( $file_stat = @stat( self::$browscap_autoload_path ) ) && ( date( 'U' ) - $file_stat[ 'mtime' ] > 604800 ) && false !== ( $handle = @fopen( self::$browscap_autoload_path, "rb" ) ) ) {
|
63 |
+
|
64 |
+
// Find the version of the local data file
|
65 |
+
while ( ( $buffer = fgets( $handle, 4096 ) ) !== false ) {
|
66 |
+
if ( strpos( $buffer, 'source_version' ) !== false ) {
|
67 |
+
$local_version = filter_var( $buffer, FILTER_SANITIZE_NUMBER_INT );
|
68 |
+
break;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
// Now check the version number on the server
|
73 |
+
$remote_version = file_get_contents( 'http://s3.amazonaws.com/browscap/autoload.txt' );
|
74 |
+
if ( intval( $local_version ) != intval( $remote_version ) ) {
|
75 |
+
$download_remote_file = true;
|
76 |
+
}
|
77 |
+
else {
|
78 |
+
@touch( self::$browscap_autoload_path );
|
79 |
+
}
|
80 |
+
|
81 |
+
fclose( $handle );
|
82 |
+
}
|
83 |
+
|
84 |
+
// Download the most recent version of our pre-processed Browscap database
|
85 |
+
if ( $download_remote_file ) {
|
86 |
+
$response = wp_safe_remote_get( 'http://s3.amazonaws.com/browscap/browscap-db.zip', array( 'timeout' => 300, 'stream' => true, 'filename' => $browscap_zip ) );
|
87 |
+
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
|
88 |
+
@unlink( $browscap_zip );
|
89 |
+
return array( 1, __( 'There was an error downloading the Browscap data file from our server. Please try again later.', 'wp-slimstat' ) );
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( !file_exists( $browscap_zip ) ) {
|
93 |
+
return array( 2, __( 'There was an error saving the Browscap data file on your server. Please check your folder permissions.', 'wp-slimstat' ) );
|
94 |
+
}
|
95 |
+
|
96 |
+
// Init the filesystem API
|
97 |
+
WP_Filesystem();
|
98 |
+
|
99 |
+
// Delete the existing folder, if there
|
100 |
+
$GLOBALS[ 'wp_filesystem' ]->rmdir( dirname( self::$browscap_autoload_path ) . '/', true );
|
101 |
+
|
102 |
+
// We're ready to unzip the file
|
103 |
+
$unzip_done = unzip_file( $browscap_zip, wp_slimstat::$upload_dir );
|
104 |
+
|
105 |
+
if ( !$unzip_done || !file_exists( self::$browscap_autoload_path ) ) {
|
106 |
+
return array( 3, __( 'There was an error uncompressing the Browscap data file on your server. Please check your folder permissions and PHP configuration.', 'wp-slimstat' ) );
|
107 |
+
}
|
108 |
+
|
109 |
+
@unlink( $browscap_zip );
|
110 |
+
}
|
111 |
+
|
112 |
+
return array( 0, __( 'The Browscap data file has been installed on your server.', 'wp-slimstat' ) );
|
113 |
+
}
|
114 |
+
|
115 |
protected static function _get_user_agent() {
|
116 |
$user_agent = ( !empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? trim( $_SERVER[ 'HTTP_USER_AGENT' ] ) : '' );
|
117 |
|
browscap/uadetector.php
CHANGED
@@ -121,7 +121,7 @@ class slim_uadetector {
|
|
121 |
if ( !empty( $match[ 1 ] ) && stristr( $match[ 1 ], 'Version' ) === false ) {
|
122 |
$webkit_info = explode( '/', $match[ 1 ] );
|
123 |
$browser[ 'browser' ] = $webkit_info[ 0 ];
|
124 |
-
$browser[ 'browser_version' ] = floatval( $webkit_info[ 1 ] );
|
125 |
}
|
126 |
}
|
127 |
else if ( preg_match( '#^(E?Links|Lynx|(?:Emacs\-)?w3m)[^a-z0-9]+([0-9\.]+)?#i', $_user_agent, $match ) > 0 || preg_match( '#(?:^|[^a-z0-9])(ActiveWorlds|Dillo|OffByOne)[/\sv\.]*([0-9\.]+)?#i', $_user_agent, $match ) > 0 ) {
|
121 |
if ( !empty( $match[ 1 ] ) && stristr( $match[ 1 ], 'Version' ) === false ) {
|
122 |
$webkit_info = explode( '/', $match[ 1 ] );
|
123 |
$browser[ 'browser' ] = $webkit_info[ 0 ];
|
124 |
+
$browser[ 'browser_version' ] = !empty( $webkit_info[ 1 ] ) ? floatval( $webkit_info[ 1 ] ) : 0;
|
125 |
}
|
126 |
}
|
127 |
else if ( preg_match( '#^(E?Links|Lynx|(?:Emacs\-)?w3m)[^a-z0-9]+([0-9\.]+)?#i', $_user_agent, $match ) > 0 || preg_match( '#(?:^|[^a-z0-9])(ActiveWorlds|Dillo|OffByOne)[/\sv\.]*([0-9\.]+)?#i', $_user_agent, $match ) > 0 ) {
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: analytics, statistics, counter, tracking, reports, wassup, geolocation, on
|
|
5 |
Text Domain: wp-slimstat
|
6 |
Requires at least: 3.8
|
7 |
Tested up to: 4.7
|
8 |
-
Stable tag: 4.
|
9 |
|
10 |
== Description ==
|
11 |
[youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
|
@@ -38,11 +38,11 @@ Slimstat is available in multiple languages: English, Belarusian ([UStarCash](ht
|
|
38 |
|
39 |
= Requirements =
|
40 |
* WordPress 3.8+
|
41 |
-
* PHP 5.2+
|
42 |
* MySQL 5.0.3+
|
43 |
-
* At least
|
44 |
* At least 5 MB of free DB space
|
45 |
-
* At least
|
46 |
* IE9+ or any browser supporting HTML5, to access the reports
|
47 |
|
48 |
== Installation ==
|
@@ -72,6 +72,14 @@ Our knowledge base is available on our [support center](http://docs.wp-slimstat.
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= 4.4.5 =
|
76 |
* [New] We separated errors and notices in the log, to avoid confusion when users were trying to troubleshoot issues with the tracker.
|
77 |
* [Update] Because of old settings stuck in the database, some people were not able to uninstall the Browscap data file as expected.
|
5 |
Text Domain: wp-slimstat
|
6 |
Requires at least: 3.8
|
7 |
Tested up to: 4.7
|
8 |
+
Stable tag: 4.5
|
9 |
|
10 |
== Description ==
|
11 |
[youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
|
38 |
|
39 |
= Requirements =
|
40 |
* WordPress 3.8+
|
41 |
+
* PHP 5.2+ (or 5.5+ if you use the Browscap data file)
|
42 |
* MySQL 5.0.3+
|
43 |
+
* At least 20 MB of free web space
|
44 |
* At least 5 MB of free DB space
|
45 |
+
* At least 32 Mb of free PHP memory for the tracker (peak memory usage)
|
46 |
* IE9+ or any browser supporting HTML5, to access the reports
|
47 |
|
48 |
== Installation ==
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 4.5 =
|
76 |
+
* [Note] Can you believe it? It looks like it was yesterday that we were celebrating the new year with our loved ones, and here we are, getting ready to welcome 2017. For our team, 2016 was a very intense year: we celebrated Slimstat's 10th anniversary, released new add-ons, started community outreach initiatives on Facebook and on our website, implemented new features and much more. Now, with a smaller team, we need to find creative ways to keep providing the stellar support service which many of you appreciate so much in your reviews. For this reason, we need to slighly increase the price of our add-ons starting in early 2017. Don't worry, it will still be a very competitive and reasonable price point, affordable even for those of you who cannot spend hundreds of dollars on their website. However we encourage you to take advantage of these few remaining weeks and [buy our add-ons today](https://www.wp-slimstat.com/addons/), before prices go up in January!
|
77 |
+
* [New] You spoke up, we listened. The third-party Browscap data file has been increasing in size over time, forcing some users to uninstall it from their server because it was causing issues with the PHP memory limit set by the administrator. Although Slimstat provides a built-in heuristic function as a workaround for this issue, we wanted to find a better solution. Replacing the obsolete Browscap parser with the [shiny new version 3.0](https://github.com/browscap/browscap-php), our tests show a big improvement in terms of performance and use of resources. The only caveat is that the new parser **requires PHP 5.5 or newer**, so please make sure your server environment is compatible before enabling this feature.
|
78 |
+
* [Update] Minor touches to the look and feel to make our admin color scheme more consistent throughout the various screens.
|
79 |
+
* [Fix] Uninstall procedure was not deleting the Browscap and MaxMind data files from the server.
|
80 |
+
* [Fix] Our release highlights, which are usually shown after updating to the latest version, were not disappearing when clicking on the corresponding button.
|
81 |
+
* [Fix] PHP warning being returned under certain circumstances (thank you, [Sasa and computershowtopro](https://wordpress.org/support/topic/you-need-to-change-line-340-341-in-the-plugin/#post-8591529)).
|
82 |
+
|
83 |
= 4.4.5 =
|
84 |
* [New] We separated errors and notices in the log, to avoid confusion when users were trying to troubleshoot issues with the tracker.
|
85 |
* [Update] Because of old settings stuck in the database, some people were not able to uninstall the Browscap data file as expected.
|
uninstall.php
CHANGED
@@ -1,36 +1,38 @@
|
|
1 |
<?php
|
2 |
// Avoid direct access to this piece of code
|
3 |
-
if (!defined('WP_UNINSTALL_PLUGIN'))
|
|
|
|
|
4 |
|
5 |
-
$slimstat_options = get_option('slimstat_options', array());
|
6 |
-
if (!empty($slimstat_options['addon_custom_db_dbuser']) && !empty($slimstat_options['addon_custom_db_dbpass']) && !empty($slimstat_options['addon_custom_db_dbname']) && !empty($slimstat_options['addon_custom_db_dbhost'])){
|
7 |
-
$slimstat_wpdb = new wpdb($slimstat_options['addon_custom_db_dbuser'], $slimstat_options['addon_custom_db_dbpass'], $slimstat_options['addon_custom_db_dbname'], $slimstat_options['addon_custom_db_dbhost']);
|
8 |
}
|
9 |
else {
|
10 |
-
$slimstat_wpdb = $GLOBALS['wpdb'];
|
11 |
}
|
12 |
|
13 |
-
if (function_exists('is_multisite') && is_multisite()) {
|
14 |
-
$blogids = $GLOBALS['wpdb']->get_col($GLOBALS['wpdb']->prepare("
|
15 |
SELECT blog_id
|
16 |
-
FROM {$GLOBALS['wpdb']->blogs}
|
17 |
WHERE site_id = %d
|
18 |
AND deleted = 0
|
19 |
-
AND spam = 0", $GLOBALS['wpdb']->siteid));
|
20 |
|
21 |
-
foreach ($blogids as $blog_id) {
|
22 |
-
switch_to_blog($blog_id);
|
23 |
-
slimstat_uninstall($slimstat_wpdb, $slimstat_options);
|
24 |
restore_current_blog();
|
25 |
}
|
26 |
}
|
27 |
-
else{
|
28 |
-
slimstat_uninstall($slimstat_wpdb, $slimstat_options);
|
29 |
}
|
30 |
|
31 |
-
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_browsers");
|
32 |
-
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_screenres");
|
33 |
-
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_content_info");
|
34 |
|
35 |
function slimstat_uninstall($_wpdb = '', $_options = array()){
|
36 |
// Goodbye data...
|
@@ -53,4 +55,10 @@ function slimstat_uninstall($_wpdb = '', $_options = array()){
|
|
53 |
|
54 |
// Remove scheduled autopurge events
|
55 |
wp_clear_scheduled_hook('wp_slimstat_purge');
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
1 |
<?php
|
2 |
// Avoid direct access to this piece of code
|
3 |
+
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
|
7 |
+
$slimstat_options = get_option( 'slimstat_options', array() );
|
8 |
+
if ( !empty( $slimstat_options[ 'addon_custom_db_dbuser' ] ) && !empty( $slimstat_options[ 'addon_custom_db_dbpass' ] ) && !empty( $slimstat_options[ 'addon_custom_db_dbname' ] ) && !empty($slimstat_options[ 'addon_custom_db_dbhost' ] ) ) {
|
9 |
+
$slimstat_wpdb = new wpdb( $slimstat_options[ 'addon_custom_db_dbuser' ], $slimstat_options[ 'addon_custom_db_dbpass' ], $slimstat_options[ 'addon_custom_db_dbname' ], $slimstat_options[ 'addon_custom_db_dbhost' ] );
|
10 |
}
|
11 |
else {
|
12 |
+
$slimstat_wpdb = $GLOBALS[ 'wpdb' ];
|
13 |
}
|
14 |
|
15 |
+
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
16 |
+
$blogids = $GLOBALS[ 'wpdb' ]->get_col( $GLOBALS[ 'wpdb' ]->prepare( "
|
17 |
SELECT blog_id
|
18 |
+
FROM {$GLOBALS[ 'wpdb' ]->blogs}
|
19 |
WHERE site_id = %d
|
20 |
AND deleted = 0
|
21 |
+
AND spam = 0", $GLOBALS[ 'wpdb' ]->siteid ) );
|
22 |
|
23 |
+
foreach ( $blogids as $blog_id ) {
|
24 |
+
switch_to_blog( $blog_id );
|
25 |
+
slimstat_uninstall( $slimstat_wpdb, $slimstat_options );
|
26 |
restore_current_blog();
|
27 |
}
|
28 |
}
|
29 |
+
else {
|
30 |
+
slimstat_uninstall( $slimstat_wpdb, $slimstat_options );
|
31 |
}
|
32 |
|
33 |
+
$slimstat_wpdb->query( "DROP TABLE IF EXISTS {$GLOBALS[ 'wpdb' ]->base_prefix}slim_browsers" );
|
34 |
+
$slimstat_wpdb->query( "DROP TABLE IF EXISTS {$GLOBALS[ 'wpdb' ]->base_prefix}slim_screenres" );
|
35 |
+
$slimstat_wpdb->query( "DROP TABLE IF EXISTS {$GLOBALS[ 'wpdb' ]->base_prefix}slim_content_info" );
|
36 |
|
37 |
function slimstat_uninstall($_wpdb = '', $_options = array()){
|
38 |
// Goodbye data...
|
55 |
|
56 |
// Remove scheduled autopurge events
|
57 |
wp_clear_scheduled_hook('wp_slimstat_purge');
|
58 |
+
|
59 |
+
// Delete the Browscap and MaxMind data files if they exist
|
60 |
+
$upload_path = wp_upload_dir();
|
61 |
+
$upload_path = $upload_path[ 'basedir' ] . '/wp-slimstat/';
|
62 |
+
@unlink( $upload_path . 'maxmind.dat' );
|
63 |
+
@unlink( $upload_path . 'browscap-db.php' );
|
64 |
}
|
wp-slimstat.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Slim Stat Analytics
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-slimstat/
|
5 |
Description: The leading web analytics plugin for WordPress
|
6 |
-
Version: 4.
|
7 |
Author: Jason Crouse
|
8 |
Author URI: http://www.wp-slimstat.com/
|
9 |
Text Domain: wp-slimstat
|
@@ -15,13 +15,14 @@ if ( !empty( wp_slimstat::$settings ) ) {
|
|
15 |
}
|
16 |
|
17 |
class wp_slimstat {
|
18 |
-
public static $version = '4.
|
19 |
public static $settings = array();
|
20 |
public static $options = array(); // To be removed, here just for backward compatibility
|
21 |
|
22 |
public static $wpdb = '';
|
|
|
23 |
public static $maxmind_path = '';
|
24 |
-
|
25 |
public static $advanced_cache_exists = false;
|
26 |
public static $update_checker = array();
|
27 |
public static $raw_post_array = array();
|
@@ -67,16 +68,15 @@ class wp_slimstat {
|
|
67 |
add_filter( 'allowed_http_origins', array(__CLASS__, 'open_cors_admin_ajax' ) );
|
68 |
|
69 |
// Define the folder where to store the geolocation database (shared among sites in a network, by default)
|
70 |
-
self::$
|
|
|
71 |
if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
|
72 |
-
self::$
|
73 |
}
|
74 |
-
self::$
|
75 |
-
self::$
|
76 |
|
77 |
-
|
78 |
-
self::$browscap_path = dirname( self::$maxmind_path ) . '/browscap-db.php';
|
79 |
-
self::$browscap_path = apply_filters( 'slimstat_browscap_path', self::$browscap_path );
|
80 |
|
81 |
// Path to wp-content folder, used to detect caching plugins via advanced-cache.php
|
82 |
if ( file_exists( dirname( dirname( plugin_dir_path( __FILE__ ) ) ) . '/advanced-cache.php' ) ) {
|
@@ -337,7 +337,9 @@ class wp_slimstat {
|
|
337 |
}
|
338 |
else if ( is_array( self::$data_js ) && isset( self::$data_js[ 'res' ] ) ) {
|
339 |
$parsed_permalink = parse_url( base64_decode( self::$data_js[ 'res' ] ) );
|
340 |
-
|
|
|
|
|
341 |
|
342 |
// Was this an internal search?
|
343 |
if ( empty( self::$stat[ 'searchterms' ] ) ) {
|
@@ -421,11 +423,11 @@ class wp_slimstat {
|
|
421 |
}
|
422 |
}
|
423 |
|
424 |
-
self::$stat['username'] = $GLOBALS['current_user']->data->user_login;
|
425 |
-
self::$stat['notes'][] = 'user:' . $GLOBALS[ 'current_user' ]->data->ID;
|
426 |
$not_spam = true;
|
427 |
}
|
428 |
-
elseif (isset($_COOKIE['comment_author_'.COOKIEHASH])){
|
429 |
// Is this a spammer?
|
430 |
$spam_comment = self::$wpdb->get_row( self::$wpdb->prepare( "
|
431 |
SELECT comment_author, COUNT(*) comment_count
|
@@ -1002,7 +1004,7 @@ class wp_slimstat {
|
|
1002 |
}
|
1003 |
|
1004 |
}
|
1005 |
-
elseif ( $identifier > 0 ){
|
1006 |
self::$stat[ 'visit_id' ] = $identifier;
|
1007 |
}
|
1008 |
|
@@ -1174,56 +1176,6 @@ class wp_slimstat {
|
|
1174 |
return '';
|
1175 |
}
|
1176 |
|
1177 |
-
/**
|
1178 |
-
* Downloads the Browscap User Agent database from our repository
|
1179 |
-
*/
|
1180 |
-
public static function update_browscap_database( $_force_download = false ) {
|
1181 |
-
// Create the folder, if it doesn't exist
|
1182 |
-
if ( !file_exists( dirname( self::$browscap_path ) ) ) {
|
1183 |
-
mkdir( dirname( self::$browscap_path ) );
|
1184 |
-
}
|
1185 |
-
|
1186 |
-
$download_flag = $_force_download;
|
1187 |
-
|
1188 |
-
// Check for updates once a week ( 604800 seconds )
|
1189 |
-
if ( false !== ( $file_stat = @stat( self::$browscap_path ) ) && ( date( 'U' ) - $file_stat[ 'mtime' ] > 604800 ) && false !== ( $handle = @fopen( self::$browscap_path, "rb" ) ) ) {
|
1190 |
-
|
1191 |
-
// Find the version of the local data file
|
1192 |
-
while ( ( $buffer = fgets( $handle, 4096 ) ) !== false ) {
|
1193 |
-
if ( strpos( $buffer, 'source_version' ) !== false ) {
|
1194 |
-
$local_version = filter_var( $buffer, FILTER_SANITIZE_NUMBER_INT );
|
1195 |
-
break;
|
1196 |
-
}
|
1197 |
-
}
|
1198 |
-
|
1199 |
-
// Now check the version number on the server
|
1200 |
-
$remote_version = file_get_contents( 'http://s3.amazonaws.com/browscap/version.txt' );
|
1201 |
-
if ( intval( $local_version ) != intval( $remote_version ) ) {
|
1202 |
-
$download_flag = true;
|
1203 |
-
}
|
1204 |
-
else {
|
1205 |
-
touch( self::$browscap_path );
|
1206 |
-
}
|
1207 |
-
|
1208 |
-
fclose( $handle );
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
// Download the most recent version of our pre-processed Browscap database
|
1212 |
-
if ( $download_flag ) {
|
1213 |
-
$response = wp_safe_remote_get( 'http://s3.amazonaws.com/browscap/browscap-db.php', array( 'timeout' => 300, 'stream' => true, 'filename' => self::$browscap_path ) );
|
1214 |
-
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
|
1215 |
-
@unlink( self::$browscap_path );
|
1216 |
-
return array( 1, __( 'There was an error downloading the Browscap data file from our server. Please try again later.', 'wp-slimstat' ) );
|
1217 |
-
}
|
1218 |
-
|
1219 |
-
if ( !file_exists( self::$browscap_path ) ) {
|
1220 |
-
return array( 2, __( 'There was an error saving the Browscap data file on your server. Please check your server permissions.', 'wp-slimstat' ) );
|
1221 |
-
}
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
return array( 0, __( 'The Browscap data file has been installed on your server.', 'wp-slimstat' ) );
|
1225 |
-
}
|
1226 |
-
|
1227 |
public static function slimstat_shortcode( $_attributes = '', $_content = '' ){
|
1228 |
extract( shortcode_atts( array(
|
1229 |
'f' => '', // recent, popular, count
|
3 |
Plugin Name: Slim Stat Analytics
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-slimstat/
|
5 |
Description: The leading web analytics plugin for WordPress
|
6 |
+
Version: 4.5
|
7 |
Author: Jason Crouse
|
8 |
Author URI: http://www.wp-slimstat.com/
|
9 |
Text Domain: wp-slimstat
|
15 |
}
|
16 |
|
17 |
class wp_slimstat {
|
18 |
+
public static $version = '4.5';
|
19 |
public static $settings = array();
|
20 |
public static $options = array(); // To be removed, here just for backward compatibility
|
21 |
|
22 |
public static $wpdb = '';
|
23 |
+
public static $upload_dir = '';
|
24 |
public static $maxmind_path = '';
|
25 |
+
|
26 |
public static $advanced_cache_exists = false;
|
27 |
public static $update_checker = array();
|
28 |
public static $raw_post_array = array();
|
68 |
add_filter( 'allowed_http_origins', array(__CLASS__, 'open_cors_admin_ajax' ) );
|
69 |
|
70 |
// Define the folder where to store the geolocation database (shared among sites in a network, by default)
|
71 |
+
self::$upload_dir = wp_upload_dir();
|
72 |
+
self::$upload_dir = self::$upload_dir[ 'basedir' ];
|
73 |
if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
|
74 |
+
self::$upload_dir = str_replace( '/sites/' . get_current_blog_id(), '', self::$upload_dir );
|
75 |
}
|
76 |
+
self::$upload_dir .= '/wp-slimstat';
|
77 |
+
self::$upload_dir = apply_filters( 'slimstat_maxmind_path', self::$upload_dir );
|
78 |
|
79 |
+
self::$maxmind_path = self::$upload_dir . '/maxmind.dat';
|
|
|
|
|
80 |
|
81 |
// Path to wp-content folder, used to detect caching plugins via advanced-cache.php
|
82 |
if ( file_exists( dirname( dirname( plugin_dir_path( __FILE__ ) ) ) . '/advanced-cache.php' ) ) {
|
337 |
}
|
338 |
else if ( is_array( self::$data_js ) && isset( self::$data_js[ 'res' ] ) ) {
|
339 |
$parsed_permalink = parse_url( base64_decode( self::$data_js[ 'res' ] ) );
|
340 |
+
if ( !empty( $referer ) ) {
|
341 |
+
self::$stat[ 'searchterms' ] = self::_get_search_terms( $referer );
|
342 |
+
}
|
343 |
|
344 |
// Was this an internal search?
|
345 |
if ( empty( self::$stat[ 'searchterms' ] ) ) {
|
423 |
}
|
424 |
}
|
425 |
|
426 |
+
self::$stat[ 'username' ] = $GLOBALS[ 'current_user' ]->data->user_login;
|
427 |
+
self::$stat[ 'notes' ][] = 'user:' . $GLOBALS[ 'current_user' ]->data->ID;
|
428 |
$not_spam = true;
|
429 |
}
|
430 |
+
elseif ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) {
|
431 |
// Is this a spammer?
|
432 |
$spam_comment = self::$wpdb->get_row( self::$wpdb->prepare( "
|
433 |
SELECT comment_author, COUNT(*) comment_count
|
1004 |
}
|
1005 |
|
1006 |
}
|
1007 |
+
elseif ( $identifier > 0 ) {
|
1008 |
self::$stat[ 'visit_id' ] = $identifier;
|
1009 |
}
|
1010 |
|
1176 |
return '';
|
1177 |
}
|
1178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1179 |
public static function slimstat_shortcode( $_attributes = '', $_content = '' ){
|
1180 |
extract( shortcode_atts( array(
|
1181 |
'f' => '', // recent, popular, count
|