Automattic\WooCommerce\Admin
ReportExporter::download_export_file
Serve the export file.
Method of the class: ReportExporter{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = ReportExporter::download_export_file();
ReportExporter::download_export_file() ReportExporter::download export file code WC 10.5.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();
}
}