示例#1
0
function wp_statistics_dbmaint_event()
{
    global $wpdb, $WP_Statistics;
    require_once plugin_dir_path(__FILE__) . '/includes/functions/purge.php';
    $purge_days = intval($WP_Statistics->get_option('schedule_dbmaint_days', FALSE));
    wp_statistics_purge_data($purge_days);
}
示例#2
0
function wp_statistics_purge_data_action_callback()
{
    global $WP_Statistics, $wpdb;
    // this is how you get access to the database
    require $WP_Statistics->plugin_dir . '/includes/functions/purge.php';
    $manage_cap = wp_statistics_validate_capability($WP_Statistics->get_option('manage_capability', 'manage_options'));
    if (current_user_can($manage_cap)) {
        $purge_days = 0;
        if (array_key_exists('purge-days', $_POST)) {
            // Get the number of days to purge data before.
            $purge_days = intval($_POST['purge-days']);
        }
        echo wp_statistics_purge_data($purge_days);
    } else {
        _e('Access denied!', 'wp_statistics');
    }
    wp_die();
    // this is required to terminate immediately and return a proper response
}
示例#3
0
<?php 
require '../../../../../wp-blog-header.php';
require '../functions/purge.php';
if (!is_super_admin()) {
    wp_die(__('Access denied!', 'wp_statistics'));
}
$purge_days = 0;
if (array_key_exists('purge_days', $_POST)) {
    // Get the number of days to purge data before.
    $purge_days = intval($_POST['purge_days']);
}
echo wp_statistics_purge_data($purge_days);