WC_Product_CSV_Importer_Controller::dispatch()publicWC 1.0

Dispatch current step and show correct view.

Method of the class: WC_Product_CSV_Importer_Controller{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Product_CSV_Importer_Controller = new WC_Product_CSV_Importer_Controller();
$WC_Product_CSV_Importer_Controller->dispatch();

WC_Product_CSV_Importer_Controller::dispatch() code WC 9.8.2

public function dispatch() {
	$output = '';

	try {
		// phpcs:ignore WordPress.Security.NonceVerification.Missing
		if ( ! empty( $_POST['save_step'] ) && ! empty( $this->steps[ $this->step ]['handler'] ) ) {
			if ( is_callable( $this->steps[ $this->step ]['handler'] ) ) {
				call_user_func( $this->steps[ $this->step ]['handler'], $this );
			}
		}

		ob_start();

		if ( is_callable( $this->steps[ $this->step ]['view'] ) ) {
			call_user_func( $this->steps[ $this->step ]['view'], $this );
		}

		$output = ob_get_clean();
	} catch ( \Exception $e ) {
		$this->add_error( $e->getMessage() );
	}

	$this->output_header();
	$this->output_steps();
	$this->output_errors();
	echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- output is HTML we've generated ourselves.
	$this->output_footer();
}