WC_CSV_Exporter::format_data( string $data )
Format and escape data ready for the CSV file.
Description Description
Parameters Parameters
- $data
-
(Required) Data to format.
Return Return
(string)
Source Source
File: includes/export/abstract-wc-csv-exporter.php
public function format_data( $data ) { if ( ! is_scalar( $data ) ) { if ( is_a( $data, 'WC_Datetime' ) ) { $data = $data->date( 'Y-m-d G:i:s' ); } else { $data = ''; // Not supported. } } elseif ( is_bool( $data ) ) { $data = $data ? 1 : 0; } $use_mb = function_exists( 'mb_convert_encoding' ); if ( $use_mb ) { $encoding = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true ); $data = 'UTF-8' === $encoding ? $data : utf8_encode( $data ); } return $this->escape_data( $data ); }
Changelog Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |