WC_Product_CSV_Importer_Controller::__construct
Constructor.
Method of the class: WC_Product_CSV_Importer_Controller{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WC_Product_CSV_Importer_Controller = new WC_Product_CSV_Importer_Controller(); $WC_Product_CSV_Importer_Controller->__construct();
WC_Product_CSV_Importer_Controller::__construct() WC Product CSV Importer Controller:: construct code WC 10.3.3
public function __construct() {
$default_steps = array(
'upload' => array(
'name' => __( 'Upload CSV file', 'woocommerce' ),
'view' => array( $this, 'upload_form' ),
'handler' => array( $this, 'upload_form_handler' ),
),
'mapping' => array(
'name' => __( 'Column mapping', 'woocommerce' ),
'view' => array( $this, 'mapping_form' ),
'handler' => '',
),
'import' => array(
'name' => __( 'Import', 'woocommerce' ),
'view' => array( $this, 'import' ),
'handler' => '',
),
'done' => array(
'name' => __( 'Done!', 'woocommerce' ),
'view' => array( $this, 'done' ),
'handler' => '',
),
);
$this->steps = apply_filters( 'woocommerce_product_csv_importer_steps', $default_steps );
// phpcs:disable WordPress.Security.NonceVerification.Recommended
$this->step = isset( $_REQUEST['step'] ) ? sanitize_key( $_REQUEST['step'] ) : current( array_keys( $this->steps ) );
$this->file = isset( $_REQUEST['file'] ) ? wc_clean( wp_unslash( $_REQUEST['file'] ) ) : '';
$this->update_existing = isset( $_REQUEST['update_existing'] ) ? (bool) $_REQUEST['update_existing'] : false;
$this->delimiter = ! empty( $_REQUEST['delimiter'] ) ? wc_clean( wp_unslash( $_REQUEST['delimiter'] ) ) : ',';
$this->map_preferences = isset( $_REQUEST['map_preferences'] ) ? (bool) $_REQUEST['map_preferences'] : false;
$this->character_encoding = isset( $_REQUEST['character_encoding'] ) ? wc_clean( wp_unslash( $_REQUEST['character_encoding'] ) ) : 'UTF-8';
// phpcs:enable
// Import mappings for CSV data.
include_once __DIR__ . '/mappings/mappings.php';
if ( $this->map_preferences ) {
add_filter( 'woocommerce_csv_product_import_mapped_columns', array( $this, 'auto_map_user_preferences' ), 9999 );
}
}