Automattic\WooCommerce\Internal\Features

FeaturesController::__constructpublicWC 1.0

Creates a new instance of the class.

Method of the class: FeaturesController{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

FeaturesController::__construct() code WC 9.8.5

public function __construct() {
	// In principle, register_additional_features is triggered manually from within class-woocommerce
	// right before before_woocommerce_init is fired (this is needed for the features to be visible
	// to plugins executing declare_compatibility).
	// However we add additional checks/hookings here to support unit tests and possible overlooked/future
	// DI container/class instantiation nuances.
	if ( ! $this->registered_additional_features_via_action ) {
		if ( did_action( 'before_woocommerce_init' ) ) {
			// Needed for unit tests, where 'before_woocommerce_init' will have been fired already at this point.
			$this->register_additional_features();
		} else {
			// This needs to have a higher $priority than the 'before_woocommerce_init' hooked by plugins that declare compatibility.
			add_filter( 'before_woocommerce_init', array( $this, 'register_additional_features' ), -9999, 0 );
		}
	}

	if ( did_action( 'init' ) ) {
		// Needed for unit tests, where 'init' will have been fired already at this point.
		$this->start_listening_for_option_changes();
	} else {
		add_filter( 'init', array( $this, 'start_listening_for_option_changes' ), 10, 0 );
	}

	add_filter( 'woocommerce_get_sections_advanced', array( $this, 'add_features_section' ), 10, 1 );
	add_filter( 'woocommerce_get_settings_advanced', array( $this, 'add_feature_settings' ), 10, 2 );
	add_filter( 'deactivated_plugin', array( $this, 'handle_plugin_deactivation' ), 10, 1 );
	add_filter( 'all_plugins', array( $this, 'filter_plugins_list' ), 10, 1 );
	add_action( 'admin_notices', array( $this, 'display_notices_in_plugins_page' ), 10, 0 );
	add_action( 'load-plugins.php', array( $this, 'maybe_invalidate_cached_plugin_data' ) );
	add_action( 'after_plugin_row', array( $this, 'handle_plugin_list_rows' ), 10, 2 );
	add_action( 'current_screen', array( $this, 'enqueue_script_to_fix_plugin_list_html' ), 10, 1 );
	add_filter( 'views_plugins', array( $this, 'handle_plugins_page_views_list' ), 10, 1 );
	add_filter( 'woocommerce_admin_shared_settings', array( $this, 'set_change_feature_enable_nonce' ), 20, 1 );
	add_action( 'admin_init', array( $this, 'change_feature_enable_from_query_params' ), 20, 0 );
	add_action( self::FEATURE_ENABLED_CHANGED_ACTION, array( $this, 'display_email_improvements_feedback_notice' ), 10, 2 );
}