PHP Class WC_Download_Handler

Handle digital downloads.
Author: WooThemes
Afficher le fichier Open project: woocommerce/woocommerce Class Usage Examples

Méthodes publiques

Méthode Description
count_download ( $download_data )
download ( string $file_path, integer $product_id ) Download a file - hook into init function.
download_file_force ( string $file_path, string $filename ) Force download - this is the default method.
download_file_redirect ( string $file_path, string $filename = '' ) Redirect to a file to start the download.
download_file_xsendfile ( string $file_path, string $filename ) Download a file using X-Sendfile, X-Lighttpd-Sendfile, or X-Accel-Redirect if available.
download_product ( ) Check if we need to download a file and check validity.
ie_nocache_headers_fix ( array $headers ) : array Filter headers for IE to fix issues over SSL.
init ( ) Hook in methods.
parse_file_path ( string $file_path ) : array Parse file path and see if its remote or local.
readfile_chunked ( string $file ) : boolean readfile_chunked.

Private Methods

Méthode Description
check_download_expiry ( WC_Customer_Download $download ) Check if the download has expired.
check_download_login_required ( WC_Customer_Download $download ) Check if a download requires the user to login first.
check_downloads_remaining ( WC_Customer_Download $download ) Check if there are downloads remaining.
check_order_is_valid ( WC_Customer_Download $download ) Check if an order is valid for downloading from.
check_server_config ( ) Check and set certain server config variables to ensure downloads work as intended.
clean_buffers ( ) Clean all output buffers.
download_error ( string $message, string $title = '', integer $status = 404 ) Die with an error message if the download fails.
download_headers ( string $file_path, string $filename ) Set headers for the download.
get_download_content_type ( string $file_path ) : string Get content type of a download.

Method Details

count_download() public static méthode

Deprecation:
public static count_download ( $download_data )

download() public static méthode

Download a file - hook into init function.
public static download ( string $file_path, integer $product_id )
$file_path string URL to file
$product_id integer of the product being downloaded

download_file_force() public static méthode

Force download - this is the default method.
public static download_file_force ( string $file_path, string $filename )
$file_path string
$filename string

download_file_redirect() public static méthode

Redirect to a file to start the download.
public static download_file_redirect ( string $file_path, string $filename = '' )
$file_path string
$filename string

download_file_xsendfile() public static méthode

Download a file using X-Sendfile, X-Lighttpd-Sendfile, or X-Accel-Redirect if available.
public static download_file_xsendfile ( string $file_path, string $filename )
$file_path string
$filename string

download_product() public static méthode

Check if we need to download a file and check validity.
public static download_product ( )

ie_nocache_headers_fix() public static méthode

IE bug prevents download via SSL when Cache Control and Pragma no-cache headers set.
public static ie_nocache_headers_fix ( array $headers ) : array
$headers array
Résultat array

init() public static méthode

Hook in methods.
public static init ( )

parse_file_path() public static méthode

Parse file path and see if its remote or local.
public static parse_file_path ( string $file_path ) : array
$file_path string
Résultat array

readfile_chunked() public static méthode

Reads file in chunks so big downloads are possible without changing PHP.INI - http://codeigniter.com/wiki/Download_helper_for_large_files/.
public static readfile_chunked ( string $file ) : boolean
$file string
Résultat boolean Success or fail