Automattic\WooCommerce\Admin

ReportExporter::download_export_file()public staticWC 1.0

Serve the export file.

Метод класса: ReportExporter{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = ReportExporter::download_export_file();

Код ReportExporter::download_export_file() WC 8.7.0

public static function download_export_file() {
	// @todo - add nonce? (nonces are good for 24 hours)
	if (
		isset( $_GET['action'] ) &&
		! empty( $_GET['filename'] ) &&
		self::DOWNLOAD_EXPORT_ACTION === wp_unslash( $_GET['action'] ) && // WPCS: input var ok, sanitization ok.
		current_user_can( 'view_woocommerce_reports' )
	) {
		$exporter = new ReportCSVExporter();
		$exporter->set_filename( wp_unslash( $_GET['filename'] ) ); // WPCS: input var ok, sanitization ok.
		$exporter->export();
	}
}