WC_Product_CSV_Importer_Controller::is_file_valid_csv() public WC 1.0
Check whether a file is a valid CSV file.
{} Это метод класса: WC_Product_CSV_Importer_Controller{}
Хуки из метода
Возвращает
true/false.
Использование
$result = WC_Product_CSV_Importer_Controller::is_file_valid_csv( $file, $check_path );
- $file(строка) (обязательный)
- File path.
- $check_path(true/false)
- Whether to also check the file is located in a valid location (Default: true).
По умолчанию: true
Код WC_Product_CSV_Importer_Controller::is_file_valid_csv() WC Product CSV Importer Controller::is file valid csv WC 4.9.1
public static function is_file_valid_csv( $file, $check_path = true ) {
if ( $check_path && apply_filters( 'woocommerce_product_csv_importer_check_import_file_path', true ) && false !== stripos( $file, '://' ) ) {
return false;
}
$valid_filetypes = self::get_valid_csv_filetypes();
$filetype = wp_check_filetype( $file, $valid_filetypes );
if ( in_array( $filetype['type'], $valid_filetypes, true ) ) {
return true;
}
return false;
}