function wpmc_wp_ajax_wpmc_scan_do()
{
    ob_start();
    $type = $_POST['type'];
    $data = $_POST['data'];
    $success = 0;
    ob_end_clean();
    foreach ($data as $piece) {
        if ($type == 'file') {
            $success += wpmc_check_file($piece) ? 1 : 0;
        } else {
            if ($type == 'media') {
                $success += wpmc_check_media($piece) ? 1 : 0;
            }
        }
    }
    echo json_encode(array('success' => true, 'result' => array('type' => $type, 'data' => $data, 'success' => $success), 'message' => __("Items checked.", 'wp-media-cleaner')));
    die;
}
예제 #2
0
function wpmc_wp_ajax_wpmc_scan_do()
{
    global $wpmc_debug;
    wpmc_check_db();
    ob_start();
    $type = $_POST['type'];
    $data = $_POST['data'];
    $success = 0;
    ob_end_clean();
    foreach ($data as $piece) {
        if ($type == 'file') {
            if ($wpmc_debug) {
                error_log("check FILE {$piece}");
            }
            $success += wpmc_check_file($piece) ? 1 : 0;
        } elseif ($type == 'media') {
            if ($wpmc_debug) {
                error_log("check MEDIA {$piece}");
            }
            $success += wpmc_check_media($piece) ? 1 : 0;
        }
    }
    echo json_encode(array('success' => true, 'result' => array('type' => $type, 'data' => $data, 'success' => $success), 'message' => __("Items checked.", 'wp-media-cleaner')));
    die;
}