WC_Product_Download
in package
implements
ArrayAccess
Product download class.
Interfaces, Classes and Traits
- ArrayAccess
Table of Contents
- $data : array<string|int, mixed>
- Data array.
- file_exists() : bool
- Validate file exists.
- get_allowed_mime_types() : array<string|int, mixed>
- Get allowed mime types.
- get_data() : array<string|int, mixed>
- Returns all data for this object.
- get_enabled() : bool
- Get status of the download.
- get_file() : string
- Get file.
- get_file_extension() : string
- Get file extension.
- get_file_type() : string
- Get file type.
- get_id() : string
- Get id.
- get_name() : string
- Get name.
- get_previous_hash() : string
- Get previous_hash.
- get_type_of_file_path() : string
- Get type of file path set.
- is_allowed_filetype() : bool
- Check if file is allowed.
- offsetExists() : bool
- OffsetExists.
- offsetGet() : mixed
- OffsetGet.
- offsetSet() : mixed
- OffsetSet.
- offsetUnset() : mixed
- OffsetUnset.
- set_enabled() : mixed
- Sets the status of the download to enabled (true) or disabled (false).
- set_file() : mixed
- Set file.
- set_id() : mixed
- Set ID.
- set_name() : mixed
- Set name.
- set_previous_hash() : mixed
- Set previous_hash.
- approved_directory_checks() : mixed
- Confirms that the download exists within an approved directory.
- raise_invalid_file_exception() : void
- Convenience method, allows us to re-use the same exception messaging from different areas.
Properties
$data
Data array.
protected
array<string|int, mixed>
$data
= array('id' => '', 'name' => '', 'file' => '', 'enabled' => rue)
Tags
Methods
file_exists()
Validate file exists.
public
file_exists() : bool
Return values
bool —get_allowed_mime_types()
Get allowed mime types.
public
get_allowed_mime_types() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_data()
Returns all data for this object.
public
get_data() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_enabled()
Get status of the download.
public
get_enabled() : bool
Return values
bool —get_file()
Get file.
public
get_file() : string
Return values
string —get_file_extension()
Get file extension.
public
get_file_extension() : string
Return values
string —get_file_type()
Get file type.
public
get_file_type() : string
Return values
string —get_id()
Get id.
public
get_id() : string
Return values
string —get_name()
Get name.
public
get_name() : string
Return values
string —get_previous_hash()
Get previous_hash.
public
get_previous_hash() : string
Tags
Return values
string —get_type_of_file_path()
Get type of file path set.
public
get_type_of_file_path([string $file_path = '' ]) : string
Parameters
- $file_path : string = ''
-
optional.
Return values
string — absolute, relative, or shortcode.is_allowed_filetype()
Check if file is allowed.
public
is_allowed_filetype() : bool
Return values
bool —offsetExists()
OffsetExists.
public
offsetExists(string $offset) : bool
Parameters
- $offset : string
-
Offset.
Return values
bool —offsetGet()
OffsetGet.
public
offsetGet(string $offset) : mixed
Parameters
- $offset : string
-
Offset.
Return values
mixed —offsetSet()
OffsetSet.
public
offsetSet(string $offset, mixed $value) : mixed
Parameters
- $offset : string
-
Offset.
- $value : mixed
-
Offset value.
Return values
mixed —offsetUnset()
OffsetUnset.
public
offsetUnset(string $offset) : mixed
Parameters
- $offset : string
-
Offset.
Return values
mixed —set_enabled()
Sets the status of the download to enabled (true) or disabled (false).
public
set_enabled([bool $enabled = true ]) : mixed
Parameters
- $enabled : bool = true
-
True indicates the downloadable file is enabled, false indicates it is disabled.
Return values
mixed —set_file()
Set file.
public
set_file(string $value) : mixed
Parameters
- $value : string
-
File URL/Path.
Return values
mixed —set_id()
Set ID.
public
set_id(string $value) : mixed
Parameters
- $value : string
-
Download ID.
Return values
mixed —set_name()
Set name.
public
set_name(string $value) : mixed
Parameters
- $value : string
-
Download name.
Return values
mixed —set_previous_hash()
Set previous_hash.
public
set_previous_hash(string $value) : mixed
Parameters
- $value : string
-
Previous hash.
Tags
Return values
mixed —approved_directory_checks()
Confirms that the download exists within an approved directory.
private
approved_directory_checks([bool $auto_add_to_approved_directory_list = true ]) : mixed
If it is not within an approved directory but the current user has sufficient capabilities, then the method will try to add the download's directory to the approved directory list.
Parameters
- $auto_add_to_approved_directory_list : bool = true
-
If the download is not already in the approved directory list, automatically add it if possible.
Tags
Return values
mixed —raise_invalid_file_exception()
Convenience method, allows us to re-use the same exception messaging from different areas.
private
raise_invalid_file_exception(string $download_file) : void
Parameters
- $download_file : string