WC_Product_Download::get_type_of_file_path()
Get type of file path set.
Метод класса: WC_Product_Download{}
Хуков нет.
Возвращает
Строку
. absolute, relative, or shortcode.
Использование
$WC_Product_Download = new WC_Product_Download(); $WC_Product_Download->get_type_of_file_path( $file_path );
- $file_path(строка)
- optional.
По умолчанию: ''
Код WC_Product_Download::get_type_of_file_path() WC Product Download::get type of file path WC 7.3.0
public function get_type_of_file_path( $file_path = '' ) { $file_path = $file_path ? $file_path : $this->get_file(); $parsed_url = wp_parse_url( $file_path ); if ( $parsed_url && isset( $parsed_url['host'] ) && // Absolute url means that it has a host. ( // Theoretically we could permit any scheme (like ftp as well), but that has not been the case before. So we allow none or http(s). ! isset( $parsed_url['scheme'] ) || in_array( $parsed_url['scheme'], array( 'http', 'https' ), true ) ) ) { return 'absolute'; } elseif ( '[' === substr( $file_path, 0, 1 ) && ']' === substr( $file_path, -1 ) ) { return 'shortcode'; } else { return 'relative'; } }