window.location.href="' . admin_url() . 'plugins.php";'; } } if ( array_key_exists( 'wps_reset_plugin', $_POST ) ) { if ( is_super_admin() ) { GLOBAL $wpdb, $WP_Statistics; $default_options = $WP_Statistics->Default_Options(); $excluded_defaults = array( 'force_robot_update', 'robot_list' ); // Handle multi site implementations if ( is_multisite() ) { // Loop through each of the sites. $sites = $WP_Statistics->get_wp_sites_list(); foreach ( $sites as $blog_id ) { switch_to_blog( $blog_id ); // Delete the wp_statistics option. update_option( 'wp_statistics', array() ); // Delete the user options. $wpdb->query( "DELETE FROM {$wpdb->prefix}usermeta WHERE meta_key LIKE 'wp_statistics%'" ); $WP_Statistics->load_options(); // Set some intelligent defaults. foreach ( $default_options as $key => $value ) { if ( ! in_array( $key, $excluded_defaults ) && false === $WP_Statistics->get_option( $key ) ) { $WP_Statistics->store_option( $key, $value ); } } $WP_Statistics->save_options(); } restore_current_blog(); } else { // Delete the wp_statistics option. update_option( 'wp_statistics', array() ); // Delete the user options. $wpdb->query( "DELETE FROM {$wpdb->prefix}usermeta WHERE meta_key LIKE 'wp_statistics%'" ); $WP_Statistics->load_options(); // Set some intelligent defaults. foreach ( $default_options as $key => $value ) { if ( ! in_array( $key, $excluded_defaults ) && false === $WP_Statistics->get_option( $key ) ) { $WP_Statistics->store_option( $key, $value ); } } $WP_Statistics->save_options(); } // We need to reload the page after we reset the options but it's too late to do it through a HTTP redirect so do a // JavaScript redirect instead. echo ''; } } } ?>