You appear to be a bot. Output may be restricted
Description
Format and escape data ready for the CSV file.
Usage
$string = WC_CSV_Exporter::format_data( $data );
Parameters
- $data
- ( string ) required – Data to format.
Returns
string
Source
File name: woocommerce/includes/export/abstract-wc-csv-exporter.php
Lines:
1 to 20 of 20
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 ); }