Package::init() – Init the package.

You appear to be a bot. Output may be restricted

Description

Init the package.

Only initialize for WP 5.3 or greater.

Usage

Package::init();

Parameters

Returns

void

Source

File name: woocommerce/packages/woocommerce-admin/src/Composer/Package.php
Lines:

1 to 32 of 32
  public static function init() {
    // Avoid double initialization when the feature plugin is in use.
    if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
      self::$active_version = WC_ADMIN_VERSION_NUMBER;

      // Check version after WooCommerce is initialized.
      add_action( 'woocommerce_init', array( __CLASS__, 'check_outdated_wca_plugin' ) );

      // Register a deactivation hook for the feature plugin.
      register_deactivation_hook( WC_ADMIN_PLUGIN_FILE, array( __CLASS__, 'on_deactivation' ) );

      return;
    }

    $feature_plugin_instance = FeaturePlugin::instance();
    $satisfied_dependencies  = is_callable( array( $feature_plugin_instance, 'has_satisfied_dependencies' ) ) && $feature_plugin_instance->has_satisfied_dependencies();
    if ( ! $satisfied_dependencies ) {
      return;
    }

    // Indicate to the feature plugin that the core package exists.
    if ( ! defined( 'WC_ADMIN_PACKAGE_EXISTS' ) ) {
      define( 'WC_ADMIN_PACKAGE_EXISTS', true );
    }

    self::$package_active = true;
    self::$active_version = self::VERSION;
    $feature_plugin_instance->init();

    // Unhook the custom Action Scheduler data store class in active older versions of WC Admin.
    remove_filter( 'action_scheduler_store_class', array( $feature_plugin_instance, 'replace_actionscheduler_store_class' ) );
  }
 

 View on GitHub View on Trac