WC_Product_CSV_Importer::parse_images_field()
Parse images list from a CSV. Images can be filenames or URLs.
Метод класса: WC_Product_CSV_Importer{}
Хуки из метода
Возвращает
Массив
.
Использование
$WC_Product_CSV_Importer = new WC_Product_CSV_Importer(); $WC_Product_CSV_Importer->parse_images_field( $value );
- $value(строка) (обязательный)
- Field value.
Код WC_Product_CSV_Importer::parse_images_field() WC Product CSV Importer::parse images field WC 7.7.2
public function parse_images_field( $value ) { if ( empty( $value ) ) { return array(); } $images = array(); $separator = apply_filters( 'woocommerce_product_import_image_separator', ',' ); foreach ( $this->explode_values( $value, $separator ) as $image ) { if ( stristr( $image, '://' ) ) { $images[] = esc_url_raw( $image ); } else { $images[] = sanitize_file_name( $image ); } } return $images; }