escape string on exporter compound metadata #391

This commit is contained in:
vnmedeiros 2020-07-08 16:28:31 -03:00
parent 785e156681
commit 9c4daee525
3 changed files with 5 additions and 7 deletions

View File

@ -109,9 +109,7 @@ class CSV extends Exporter {
return $result;
}, $initial_values);
$temp = implode($delimiter, $assoc_arr);
$array_meta[] = $temp;
//$array_meta[] = "${enclosure}${temp}${enclosure}";
$array_meta[] = $this->str_putcsv($assoc_arr, $delimiter, $enclosure);
}
return implode($multivalued_delimiter, $array_meta);
}
@ -266,11 +264,11 @@ class CSV extends Exporter {
}
}
function str_putcsv($item, $delimiter = ',', $enclosure = '"') {
function str_putcsv($input, $delimiter = ',', $enclosure = '"') {
// Open a memory "file" for read/write...
$fp = fopen('php://temp', 'r+');
fputcsv($fp, $item, $delimiter, $enclosure);
fputcsv($fp, $input, $delimiter, $enclosure);
rewind($fp);
//Getting detailed stats to check filesize:
$fstats = fstat($fp);

View File

@ -195,7 +195,7 @@ class CSV extends Importer {
$childrenValue = str_getcsv($metadatumValue, $this->get_option('delimiter'), $this->get_option('enclosure'));
if ( sizeof($childrenHeaders) != sizeof($childrenValue) ) {
$this->add_error_log(' Mismatch count headers childrens and row columns ');
$this->add_error_log('Mismatch count headers childrens and row columns. file value:' . $metadatumValue);
return false;
}
$tmp = [];

View File

@ -76,7 +76,7 @@ class Item_Metadata extends Repository {
else
delete_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id() );
} elseif ( is_int( $item_metadata->get_meta_id() ) ) {
update_metadata_by_mid( 'post', $item_metadata->get_meta_id(), wp_slash( $item_metadata->get_value() ) );
update_metadata_by_mid( 'post', $item_metadata->get_meta_id(), $item_metadata->get_value() );
} else {
/**