public static function download($file, $status = 200, $headers = array())
    {
        require_once ABSPATH.'wp-admin/includes/file.php';

        WP_Filesystem();

        global $wp_filesystem;

        $fileData = $wp_filesystem->get_contents($file);

        $downloadHeader['Content-Description'] = 'File Transfer';
        $downloadHeader['Content-Type'] = 'application/octet-stream';
        $downloadHeader['Content-Disposition'] = 'attachment; filename='.basename($file);
        $downloadHeader['Content-Transfer-Encoding'] = 'binary';
        $downloadHeader['Expires'] = '0';
        $downloadHeader['Cache-Control'] = 'must-revalidate';
        $downloadHeader['Pragma'] = 'public';
        $downloadHeader['Content-Length'] = filesize($file);

        $response = new Response($fileData, 200, $downloadHeader);
        $response->send();
    }
public static function download($file, $status = 200, $headers = array())
    {
        require_once ABSPATH.'wp-admin/includes/file.php';

        WP_Filesystem();

        global $wp_filesystem;

        $fileData = $wp_filesystem->get_contents($file);

        $downloadHeader['Content-Description'] = 'File Transfer';
        $downloadHeader['Content-Type'] = 'application/octet-stream';
        $downloadHeader['Content-Disposition'] = 'attachment; filename='.basename($file);
        $downloadHeader['Content-Transfer-Encoding'] = 'binary';
        $downloadHeader['Expires'] = '0';
        $downloadHeader['Cache-Control'] = 'must-revalidate';
        $downloadHeader['Pragma'] = 'public';
        $downloadHeader['Content-Length'] = filesize($file);

        $response = new Response($fileData, 200, $downloadHeader);
        $response->send();
    }
public static function download ( $ file , $ status = 200 , $ headers = array ( ) ) { require_once ABSPATH . 'wp-admin/includes/file.php' ; WP_Filesystem ( ) ; global $ wp_filesystem ; $ fileData = $ wp_filesystem -> get_contents ( $ file ) ; $ downloadHeader [ 'Content-Description' ] = 'File Transfer' ; $ downloadHeader [ 'Content-Type' ] = 'application/octet-stream' ; $ downloadHeader [ 'Content-Disposition' ] = 'attachment; filename=' . basename ( $ file ) ; $ downloadHeader [ 'Content-Transfer-Encoding' ] = 'binary' ; $ downloadHeader [ 'Expires' ] = '0' ; $ downloadHeader [ 'Cache-Control' ] = 'must-revalidate' ; $ downloadHeader [ 'Pragma' ] = 'public' ; $ downloadHeader [ 'Content-Length' ] = filesize ( $ file ) ; $ response = new Response ( $ fileData , 200 , $ downloadHeader ) ; $ response -> send ( ) ; }
Generate download file.

@param string $file
@param int    $status
@param array  $headers
Generate download file .