<?php

/**
 * The plugin bootstrap file
 *
 * This file is read by WordPress to generate the plugin information in the plugin
 * admin area. This file also includes all of the dependencies used by the plugin,
 * registers the activation and deactivation functions, and defines a function
 * that starts the plugin.
 *
 * @link              https://wpconfiguratorbuilder.com/
 * @since             1.0.0
 * @package           wcb-configurator-builder
 *
 * @wordpress-plugin
 * Plugin Name: 	  WCB | WP Configurator Builder
 * Plugin URI:        https://wordpress.org/plugins/wcb-configurator-builder/
 * Description:       Create customizable products with ease; custom product fields, real-time updates, stackable image layers, and more!
 * Version:           1.5.0
 * Requires at least: 6.0
 * Tested up to:      6.9
 * Author:            Dons Digital
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       wcb-configurator-builder
 * Domain Path:       /languages
 *
 */
// If this file is called directly, abort.
if ( !defined( 'WPINC' ) ) {
    die;
}
if ( function_exists( 'wpcb_fs' ) ) {
    wpcb_fs()->set_basename( false, __FILE__ );
} else {
    if ( !function_exists( 'wpcb_fs' ) ) {
        // Create a helper function for easy SDK access.
        function wpcb_fs() {
            global $wpcb_fs;
            if ( !isset( $wpcb_fs ) ) {
                // Include Freemius SDK.
                require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
                $wpcb_fs = fs_dynamic_init( array(
                    'id'               => '17505',
                    'slug'             => 'wcb-configurator-builder',
                    'premium_slug'     => 'wcb-configurator-builder-pro',
                    'type'             => 'plugin',
                    'public_key'       => 'pk_272ac9be9941b9db1bc00b3a5db9f',
                    'is_premium'       => false,
                    'premium_suffix'   => 'PRO',
                    'has_addons'       => false,
                    'has_paid_plans'   => true,
                    'trial'            => array(
                        'days'               => 14,
                        'is_require_payment' => false,
                    ),
                    'has_affiliation'  => 'selected',
                    'menu'             => array(
                        'slug'        => 'edit.php?post_type=wpcb_configuration',
                        'first-path'  => 'edit.php?post_type=wpcb_configuration&page=setup',
                        'contact'     => false,
                        'support'     => false,
                        'affiliation' => false,
                    ),
                    'is_live'          => true,
                    'is_org_compliant' => true,
                ) );
            }
            return $wpcb_fs;
        }

    }
    // Init Freemius.
    wpcb_fs();
    wpcb_fs()->add_filter( 'contact_url', function ( $url ) {
        return 'https://wpconfiguratorbuilder.com/support/';
    } );
    /**
     * Currently plugin version.
     * Start at version 1.0.0 and use SemVer - https://semver.org
     * Rename this for your plugin and update it as you release new versions.
     */
    define( 'WPCB_VERSION', '1.5.0' );
    define( 'WPCB_BASE', plugin_dir_path( __FILE__ ) );
    define( 'WPCB_BASE_URL', plugin_dir_url( __FILE__ ) );
    define( 'WPCB_UPLOAD_DIR', '/wpcb_files' );
    define( 'WPCB_UPLOAD_TEMP_DIR', '/wpcb_files/temp' );
    define( 'Carbon_Fields\\COMPACT_INPUT', true );
    /**
     * The code that runs during plugin activation.
     * This action is documented in includes/class-wpcb-activator.php
     */
    function wpcb_activate() {
        require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpcb-activator.php';
        WPCB_Activator::activate();
    }

    /**
     * The code that runs during plugin deactivation.
     * This action is documented in includes/class-wpcb-deactivator.php
     */
    function wpcb_deactivate() {
        require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpcb-deactivator.php';
        WPCB_Deactivator::deactivate();
    }

    register_activation_hook( __FILE__, 'wpcb_activate' );
    register_deactivation_hook( __FILE__, 'wpcb_deactivate' );
    /**
     * 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-wpcb.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
     */
    if ( 'strings' === get_option( '_wpcb_translation_type' ) ) {
        define( 'WPCB_STRING_TRANSLATION', true );
    }
    $plugin = new WPCB();
    if ( file_exists( plugin_dir_path( __FILE__ ) . 'pro/wpcb-pro.php' ) ) {
        // Include PRO features.
        require plugin_dir_path( __FILE__ ) . 'pro/wpcb-pro.php';
    }
    // Signal that SDK was initiated.
    do_action( 'wpcb_fs_loaded' );
}