Merge pull request #21614 from menakas/issue_21511
Trim the import file headers while reading
This commit is contained in:
commit
14ea40cae0
|
@ -70,7 +70,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
$handle = fopen( $this->file, 'r' ); // @codingStandardsIgnoreLine.
|
||||
|
||||
if ( false !== $handle ) {
|
||||
$this->raw_keys = version_compare( PHP_VERSION, '5.3', '>=' ) ? fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'], $this->params['escape'] ) : fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] ); // @codingStandardsIgnoreLine
|
||||
$this->raw_keys = version_compare( PHP_VERSION, '5.3', '>=' ) ? array_map( 'trim', fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'], $this->params['escape'] ) ) : array_map( 'trim', fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] ) ); // @codingStandardsIgnoreLine
|
||||
|
||||
// Remove BOM signature from the first item.
|
||||
if ( isset( $this->raw_keys[0] ) ) {
|
||||
|
|
Loading…
Reference in New Issue