WC_Product_Download::is_allowed_filetype() public WC 1.0
Check if file is allowed.
{} Это метод класса: WC_Product_Download{}
Хуков нет.
Возвращает
true/false.
Использование
$WC_Product_Download = new WC_Product_Download(); $WC_Product_Download->is_allowed_filetype();
Код WC_Product_Download::is_allowed_filetype() WC Product Download::is allowed filetype WC 5.0.0
public function is_allowed_filetype() {
$file_path = $this->get_file();
// File types for URL-based files located on the server should get validated.
$is_file_on_server = false;
if ( false !== stripos( $file_path, network_site_url( '/', 'https' ) ) ||
false !== stripos( $file_path, network_site_url( '/', 'http' ) ) ||
false !== stripos( $file_path, site_url( '/', 'https' ) ) ||
false !== stripos( $file_path, site_url( '/', 'http' ) )
) {
$is_file_on_server = true;
}
if ( ! $is_file_on_server && 'relative' !== $this->get_type_of_file_path() ) {
return true;
}
return ! $this->get_file_extension() || in_array( $this->get_file_type(), $this->get_allowed_mime_types(), true );
}