<?php

/**
 * Plugin Name: Spending Limits for WooCommerce
 * Plugin URI: https://wpgenie.org
 * Description: Spending Limits for WooCommerce is an extension for WooCommerce which enables you to limit spending for customer.
 * Version: 1.1.7
 * Author: wpgenie
 * Author URI: https://wpgenie.org/
 * License: GPL-2.0+
 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
 * Requires Plugins: woocommerce
 * Requires at least: 5.0
 * WC requires at least: 8.9
 * WC tested up to: 11.0
 * Text Domain: spending-limits-for-woocommerce
 * Domain Path: /languages
 *
 * @package    Spending_Limits_For_Woocommerce
 */
if ( !defined( 'WPINC' ) ) {
    die;
}
/**
 * Current plugin version.
 */
define( 'SPENDING_LIMITS_FOR_WOOCOMMERCE_VERSION', '1.1.7' );
define( 'SPENDING_LIMITS_FOR_WOOCOMMERCE_DB_VERSION', '1.0' );
if ( function_exists( 'slfw_fs' ) ) {
    slfw_fs()->set_basename( false, __FILE__ );
} else {
    if ( !function_exists( 'slfw_fs' ) ) {
        /**
         * Create a helper function for easy SDK access.
         */
        function slfw_fs() {
            global $slfw_fs;
            if ( !isset( $slfw_fs ) ) {
                // Include Freemius SDK.
                require_once __DIR__ . '/freemius/start.php';
                $slfw_fs = fs_dynamic_init( array(
                    'id'               => '17053',
                    'slug'             => 'spending-limits-for-woocommerce',
                    'type'             => 'plugin',
                    'public_key'       => 'pk_33a02d929247e5b0c18fd1a8656f1',
                    'is_premium'       => false,
                    'premium_suffix'   => 'Professional',
                    'has_addons'       => false,
                    'has_paid_plans'   => true,
                    'trial'            => array(
                        'days'               => 3,
                        'is_require_payment' => true,
                    ),
                    'menu'             => array(
                        'support' => true,
                    ),
                    'is_live'          => true,
                    'is_org_compliant' => true,
                ) );
            }
            return $slfw_fs;
        }

        // Init Freemius.
        $fs = slfw_fs();
        // Signal that SDK was initiated.
        do_action( 'slfw_fs_loaded' );
    }
    /**
     * The code that runs during plugin activation.
     * This action is documented in includes/class-spending-limits-for-woocommerce-activator.php
     */
    function activate_spending_limits_for_woocommerce() {
        require_once plugin_dir_path( __FILE__ ) . 'includes/class-spending-limits-for-woocommerce-activator.php';
        Spending_Limits_For_Woocommerce_Activator::activate();
    }

    register_activation_hook( __FILE__, 'activate_spending_limits_for_woocommerce' );
    /**
     * The core plugin class that is used to define internationalization,
     * admin-specific hooks, and public-facing site hooks.
     */
    require plugin_dir_path( __FILE__ ) . 'includes/class-spending-limits-for-woocommerce.php';
    /**
     * Begins execution of the plugin.
     *
     * Since everything within the plugin is registered via hooks,
     * then kicking off the plugin from this point in the file does
     * not affect the page life cycle.
     *
     * @since    1.0.0
     */
    function run_spending_limits_for_woocommerce() {
        $plugin = new Spending_Limits_For_Woocommerce();
        $plugin->run();
    }

    run_spending_limits_for_woocommerce();
    add_action( 'before_woocommerce_init', function () {
        if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
        }
    } );
}