PHP Класс WC_Download_Handler

Handle digital downloads.
Автор: WooThemes
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

count_download() публичный статический Метод

Устаревший:
public static count_download ( $download_data )

download() публичный статический Метод

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() публичный статический Метод

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() публичный статический Метод

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() публичный статический Метод

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() публичный статический Метод

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

ie_nocache_headers_fix() публичный статический Метод

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
Результат array

init() публичный статический Метод

Hook in methods.
public static init ( )

parse_file_path() публичный статический Метод

Parse file path and see if its remote or local.
public static parse_file_path ( string $file_path ) : array
$file_path string
Результат array

readfile_chunked() публичный статический Метод

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
Результат boolean Success or fail