<?php

/**
 * Plugin Name:       CertaCart EU Product Readiness for WooCommerce
 * Description:       Scan EU product-information gaps and display manufacturer, responsible-person, identifier, and safety details in WooCommerce.
 * Version:           1.0.3
 * Requires at least: 6.6
 * Requires PHP:      8.0
 * Requires Plugins:  woocommerce
 * Author:            CertaCart
 * Text Domain:       certacart-eu-product-readiness
 * Domain Path:       /languages
 * License:           GPL-2.0-or-later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * WC requires at least: 8.5
 * WC tested up to:   11.0
 *
 *
 * @package CertaCart_EU_Product_Readiness
 */
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
if ( !defined( 'CCPR_TESTING' ) && function_exists( 'ccpr_fs' ) ) {
    ccpr_fs()->set_basename( false, __FILE__ );
} else {
    if ( !defined( 'CCPR_TESTING' ) && !function_exists( 'ccpr_fs' ) ) {
        /**
         * Return the shared Freemius SDK instance.
         *
         * @return Freemius
         */
        function ccpr_fs() {
            global $ccpr_fs;
            if ( !isset( $ccpr_fs ) ) {
                require_once __DIR__ . '/vendor/autoload.php';
                $ccpr_fs = fs_dynamic_init( array(
                    'id'               => '37971',
                    'slug'             => 'certacart-eu-product-readiness',
                    'type'             => 'plugin',
                    'public_key'       => 'pk_91308284392b50b4de40f1a444189',
                    'is_premium'       => false,
                    'premium_suffix'   => 'Pro',
                    'has_addons'       => false,
                    'has_paid_plans'   => true,
                    'is_org_compliant' => true,
                    'anonymous_mode'   => true,
                    'menu'             => array(
                        'slug'        => 'ccpr-readiness',
                        'first-path'  => 'admin.php?page=ccpr-readiness',
                        'account'     => false,
                        'contact'     => false,
                        'support'     => false,
                        'affiliation' => false,
                        'pricing'     => false,
                        'addons'      => false,
                        'parent'      => array(
                            'slug' => 'woocommerce',
                        ),
                    ),
                    'is_live'          => true,
                ) );
            }
            return $ccpr_fs;
        }

        ccpr_fs();
        do_action( 'ccpr_fs_loaded' );
    }
    define( 'CCPR_VERSION', '1.0.3' );
    define( 'CCPR_FILE', __FILE__ );
    define( 'CCPR_BASENAME', plugin_basename( __FILE__ ) );
    define( 'CCPR_PATH', plugin_dir_path( __FILE__ ) );
    define( 'CCPR_URL', plugin_dir_url( __FILE__ ) );
    require_once CCPR_PATH . 'includes/class-autoloader.php';
    /* CCPR_PREMIUM_BOOTSTRAP_START */
    if ( !defined( 'CCPR_TESTING' ) ) {
    }
    /* CCPR_PREMIUM_BOOTSTRAP_END */
    if ( !defined( 'CCPR_TESTING' ) && function_exists( 'ccpr_fs' ) ) {
        ccpr_fs()->add_action( 'after_uninstall', array('CertaCart\\EU_Product_Readiness\\Uninstaller', 'uninstall') );
    }
    register_activation_hook( __FILE__, array('CertaCart\\EU_Product_Readiness\\Activator', 'activate') );
    register_deactivation_hook( __FILE__, array('CertaCart\\EU_Product_Readiness\\Deactivator', 'deactivate') );
    add_action( 'before_woocommerce_init', static function () : void {
        if ( class_exists( '\\Automattic\\WooCommerce\\Utilities\\FeaturesUtil' ) ) {
            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
        }
    } );
    add_action( 'plugins_loaded', static function () : void {
        CertaCart\EU_Product_Readiness\Plugin::instance()->boot();
    }, 20 );
}