WC_Admin_Importers::__constructpublicWC 1.0

Constructor.

Method of the class: WC_Admin_Importers{}

No Hooks.

Returns

null. Nothing (null).

Usage

$WC_Admin_Importers = new WC_Admin_Importers();
$WC_Admin_Importers->__construct();

WC_Admin_Importers::__construct() code WC 10.7.0

public function __construct() {
	if ( ! $this->import_allowed() ) {
		return;
	}

	add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
	add_action( 'admin_init', array( $this, 'register_importers' ) );
	add_action( 'admin_head', array( $this, 'hide_from_menus' ) );
	add_action( 'admin_head', array( $this, 'menu_highlight_for_product_import' ) );
	add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
	add_action( 'wp_ajax_woocommerce_do_ajax_product_import', array( $this, 'do_ajax_product_import' ) );
	add_action( 'in_admin_footer', array( $this, 'track_importer_exporter_view' ) );

	/**
	 * Register the WP Posts importer.
	 */
	$wp_posts_importer = wc_get_container()->get( WPPostsImporter::class );
	$wp_posts_importer->register();

	// Register WooCommerce importers.
	$this->importers['product_importer'] = array(
		'menu'       => 'edit.php?post_type=product',
		'name'       => __( 'Product Import', 'woocommerce' ),
		'capability' => 'import',
		'callback'   => array( $this, 'product_importer' ),
	);
}