WC_CSV_Exporter::send_headers()publicWC 3.1.0

Set the export headers.

Method of the class: WC_CSV_Exporter{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_CSV_Exporter = new WC_CSV_Exporter();
$WC_CSV_Exporter->send_headers();

Changelog

Since 3.1.0 Introduced.

WC_CSV_Exporter::send_headers() code WC 9.4.2

public function send_headers() {
	if ( function_exists( 'gc_enable' ) ) {
		gc_enable(); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.gc_enableFound
	}
	if ( function_exists( 'apache_setenv' ) ) {
		@apache_setenv( 'no-gzip', 1 ); // @codingStandardsIgnoreLine
	}
	@ini_set( 'zlib.output_compression', 'Off' ); // @codingStandardsIgnoreLine
	@ini_set( 'output_buffering', 'Off' ); // @codingStandardsIgnoreLine
	@ini_set( 'output_handler', '' ); // @codingStandardsIgnoreLine
	ignore_user_abort( true );
	wc_set_time_limit( 0 );
	wc_nocache_headers();
	header( 'Content-Type: text/csv; charset=utf-8' );
	header( 'Content-Disposition: attachment; filename=' . $this->get_filename() );
	header( 'Pragma: no-cache' );
	header( 'Expires: 0' );
}