From b903b84edb96fca1740d6a9bbd545a8c5c6a4f98 Mon Sep 17 00:00:00 2001 From: AlexTech01 <72891399+AlexTech01@users.noreply.github.com> Date: Sun, 3 Apr 2022 08:54:45 -0500 Subject: [PATCH] Change is_file_valid_csv to wc_is_file_valid_csv This pull request replaces the class-specific is_file_valid_csv() function with the global wc_is_file_valid_csv() function as requested by the todo that was previously above the is_file_valid_csv() function on the previous line 89. --- .../class-wc-product-csv-importer-controller.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php b/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php index 848b36ad77b..97acf002e73 100644 --- a/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php +++ b/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php @@ -86,7 +86,6 @@ class WC_Product_CSV_Importer_Controller { /** * Check whether a file is a valid CSV file. * - * @todo Replace this method with wc_is_file_valid_csv() function. * @param string $file File path. * @param bool $check_path Whether to also check the file is located in a valid location (Default: true). * @return bool @@ -98,17 +97,7 @@ class WC_Product_CSV_Importer_Controller { * @param bool $check_import_file_path If the import file path should be checked. * @param string $file Path of the file to be checked. */ - if ( $check_path && apply_filters( 'woocommerce_product_csv_importer_check_import_file_path', true, $file ) && 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; + return wc_is_file_valid_csv($file, $check_path); } /**