WC_CSV_Exporter::implode_values()protectedWC 3.2.0

Implode CSV cell values using commas by default, and wrapping values which contain the separator.

Method of the class: WC_CSV_Exporter{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->implode_values( $values );
$values(array) (required)
Values to implode.

Changelog

Since 3.2.0 Introduced.

WC_CSV_Exporter::implode_values() code WC 8.7.0

protected function implode_values( $values ) {
	$values_to_implode = array();

	foreach ( $values as $value ) {
		$value               = (string) is_scalar( $value ) ? html_entity_decode( $value, ENT_QUOTES ) : '';
		$values_to_implode[] = str_replace( ',', '\\,', $value );
	}

	return implode( ', ', $values_to_implode );
}