コード例 #1
0
ファイル: ajax.php プロジェクト: vanlong200880/uni
function wp_statistics_empty_table_action_callback()
{
    global $WP_Statistics, $wpdb;
    // this is how you get access to the database
    $manage_cap = wp_statistics_validate_capability($WP_Statistics->get_option('manage_capability', 'manage_options'));
    if (current_user_can($manage_cap)) {
        $table_name = $_POST['table-name'];
        if ($table_name) {
            switch ($table_name) {
                case 'useronline':
                    echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_useronline');
                    break;
                case 'visit':
                    echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_visit');
                    break;
                case 'visitors':
                    echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_visitor');
                    break;
                case 'exclusions':
                    echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_exclusions');
                    break;
                case 'pages':
                    echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_pages');
                    break;
                case 'search':
                    echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_search');
                    break;
                case 'all':
                    $result_string = wp_statitiscs_empty_table($wpdb->prefix . 'statistics_useronline');
                    $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_visit');
                    $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_visitor');
                    $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_exclusions');
                    $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_pages');
                    $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_search');
                    echo $result_string;
                    break;
                default:
                    _e('Please select the desired items.', 'wp_statistics');
            }
            $WP_Statistics->Primary_Values();
        } else {
            _e('Please select the desired items.', 'wp_statistics');
        }
    } else {
        _e('Access denied!', 'wp_statistics');
    }
    wp_die();
    // this is required to terminate immediately and return a proper response
}
コード例 #2
0
ファイル: empty.php プロジェクト: dtekcth/datateknologer.se
            break;
        case 'visitors':
            echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_visitor');
            break;
        case 'exclusions':
            echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_exclusions');
            break;
        case 'pages':
            echo wp_statitiscs_empty_table($wpdb->prefix . 'statistics_pages');
            break;
        case 'all':
            $result_string = wp_statitiscs_empty_table($wpdb->prefix . 'statistics_useronline');
            $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_visit');
            $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_visitor');
            $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_exclusions');
            $result_string .= '<br>' . wp_statitiscs_empty_table($wpdb->prefix . 'statistics_pages');
            echo $result_string;
            break;
    }
    $WP_Statistics->Primary_Values();
} else {
    _e('Please select the desired items.', 'wp_statistics');
}
function wp_statitiscs_empty_table($table_name = FALSE)
{
    global $wpdb;
    if ($table_name) {
        $result = $wpdb->query('DELETE FROM ' . $table_name);
        if ($result) {
            return sprintf(__('%s table data deleted successfully.', 'wp_statistics'), '<code>' . $table_name . '</code>');
        }