Automattic\WooCommerce

Packages::load_packages()public staticWC 1.0

Callback for WordPress init hook.

Метод класса: Packages{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$result = Packages::on_init();

Код Packages::load_packages() WC 8.7.0

public static function on_init() {
	self::deactivate_merged_packages();
	self::initialize_packages();
}

/**
 * Checks a package exists by looking for it's directory.
 *
 * @param string $package Package name.
 * @return boolean
 */
public static function package_exists( $package ) {
	return file_exists( dirname( __DIR__ ) . '/packages/' . $package );
}

/**
 * Deactivates merged feature plugins.
 *
 * Once a feature plugin is merged into WooCommerce Core it should be deactivated. This method will
 * ensure that a plugin gets deactivated. Note that for the first request it will still be active,
 * and as such, there may be some odd behavior. This is unlikely to cause any issues though
 * because it will be deactivated on the request that updates or activates WooCommerce.
 */
protected static function deactivate_merged_packages() {
	// Developers may need to be able to run merged feature plugins alongside merged packages for testing purposes.
	if ( Constants::is_true( 'WC_ALLOW_MERGED_FEATURE_PLUGINS' ) ) {
		return;
	}

	// Scroll through all of the active plugins and disable them if they're merged packages.