'error' ] ); } ); return; } /** * Autoload. */ $autoload_path = __DIR__ . '/vendor/autoload.php'; if ( file_exists( $autoload_path ) && ! class_exists( '\AcquiredComForWooCommerce\Plugin' ) ) { require $autoload_path; } /** * Initialization. */ function init() : void { /** * Check if WooCommerce is active. */ if ( ! class_exists( 'woocommerce' ) ) { add_action( 'admin_notices', function() { wp_admin_notice( /* translators: %s is URL link. */ sprintf( esc_html__( 'Acquired.com for WooCommerce requires WooCommerce to be installed and active. You can download %s here.', 'acquired-com-for-woocommerce' ), 'WooCommerce' ), [ 'type' => 'error' ] ); } ); return; } /** * Check if WooCommerce is at the required version. */ if ( ! defined( '\WC_VERSION' ) || version_compare( constant( 'WC_VERSION' ), ACFW_WC_VERSION, '<' ) ) { add_action( 'admin_notices', function() { wp_admin_notice( sprintf( /* translators: %s: Required PHP version */ esc_html__( 'Acquired.com for WooCommerce requires WooCommerce version %s or higher. Please upgrade your WooCommerce version.', 'acquired-com-for-woocommerce' ), ACFW_WC_VERSION ), [ 'type' => 'error' ] ); } ); return; } static $initialized; if ( ! $initialized ) { $container = require __DIR__ . '/src/bootstrap.php'; $plugin = $container->get( Plugin::class ); $initialized = true; /** * The hook fired after the plugin bootstrap with the plugin as a parameter. */ do_action( 'acfw_init', $plugin ); } } /** * Initialize the plugin. */ add_action( 'plugins_loaded', function () { init(); } ); /** * Activation hook. */ register_activation_hook( __FILE__, function() { init(); /** * The hook fired in register_activation_hook. */ do_action( 'acfw_activate' ); } ); /** * Deactivation hook. */ register_deactivation_hook( __FILE__, function() { init(); /** * The hook fired in register_deactivation_hook. */ do_action( 'acfw_deactivate' ); } ); } )(); // @codeCoverageIgnoreEnd