LLMS_Meta_Box_Voucher_Export::array_to_csv( $data, $delimiter = ',', $enclosure = '"' )
Contents
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.voucher.export.php
public static function array_to_csv( $data, $delimiter = ',', $enclosure = '"' ) { $handle = fopen( 'php://temp', 'r+' ); $contents = ''; $names = array(); foreach ( $data[0] as $name => $item ) { $names[] = $name; } fputcsv( $handle, $names, $delimiter, $enclosure ); foreach ( $data as $line ) { fputcsv( $handle, $line, $delimiter, $enclosure ); } rewind( $handle ); while ( ! feof( $handle ) ) { $contents .= fread( $handle, 8192 ); } fclose( $handle ); return $contents; }
Expand full source code Collapse full source code View on GitHub