<?php
/*
Plugin Name: VBULKiT - Bulk Edit Variations for WooCommerce
Plugin URI: https://ithemelandco.com/plugins/woocommerce-bulk-variations-editing
Description: Editing Date in WordPress is very painful. Be professionals with managing data in the reliable and flexible way by WooCommerce Bulk Product Editor.
Author: iThemelandco
Tested up to: 7.0
Requires PHP: 8.0.3
Tags: woocommerce,woocommerce bulk edit,bulk edit,bulk,variations bulk editor
Text Domain: ithemeland-bulk-variation-editing-for-woocommerce
Domain Path: /languages
Requires Plugins: woocommerce
WC tested up to: 9.8.2
WC requires at least: 3.9
Requires at least: 5.3
Version: 2.1.0
License: GPLv3
Author URI: https://www.ithemelandco.com
*/

use iwbvel\classes\bootstrap\IWBVEL;

defined('ABSPATH') || exit();

if (defined('IWBVEL_NAME')) {
    return false;
}

require_once __DIR__ . '/vendor/autoload.php';

define('IWBVEL_NAME', 'ithemeland-bulk-variation-editing-for-woocommerce');
define('IWBVEL_LABEL', 'VBULKiT - Bulk Edit Variations for WooCommerce');
define('IWBVEL_DESCRIPTION', 'Be professionals with managing data in the reliable and flexible way!');
define('IWBVEL_DIR', trailingslashit(plugin_dir_path(__FILE__)));
define('IWBVEL_PLUGIN_MAIN_PAGE', admin_url('admin.php?page=iwbve'));
define('IWBVEL_URL', trailingslashit(plugin_dir_url(__FILE__)));
define('IWBVEL_LIB_DIR', trailingslashit(IWBVEL_DIR . 'classes/lib'));
define('IWBVEL_VIEWS_DIR', trailingslashit(IWBVEL_DIR . 'views'));
define('IWBVEL_LANGUAGES_DIR', dirname(plugin_basename(__FILE__)) . '/languages/');
define('IWBVEL_FW_DIR', trailingslashit(IWBVEL_DIR . 'framework'));
define('IWBVEL_FW_URL', trailingslashit(IWBVEL_URL . 'framework'));
define('IWBVEL_ASSETS_DIR', trailingslashit(IWBVEL_DIR . 'assets'));
define('IWBVEL_ASSETS_URL', trailingslashit(IWBVEL_URL . 'assets'));
define('IWBVEL_CSS_URL', trailingslashit(IWBVEL_ASSETS_URL . 'css'));
define('IWBVEL_IMAGES_URL', trailingslashit(IWBVEL_ASSETS_URL . 'images'));
define('IWBVEL_JS_URL', trailingslashit(IWBVEL_ASSETS_URL . 'js'));
define('IWBVEL_VERSION', '2.1.0');
define('IWBVEL_PRO_LINK', 'https://ithemelandco.com/plugins/woocommerce-variations-bulk-edit?utm_source=free_plugins&amp;utm_medium=plugin_links&amp;utm_campaign=user-lite-buy#pricing');

register_activation_hook(__FILE__, ['iwbvel\classes\bootstrap\IWBVEL', 'activate']);
register_deactivation_hook(__FILE__, ['iwbvel\classes\bootstrap\IWBVEL', 'deactivate']);

add_action('init', ['iwbvel\classes\bootstrap\IWBVEL', 'iwbvel_wp_init']);

// compatible with woocommerce custom order tables
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);
    }
});

add_action('plugins_loaded', function () {
    if (IWBVEL::is_initable()) {
        IWBVEL::init();
    } else {
        if (isset($_GET['page']) && $_GET['page'] == 'iwbve' && !defined('IWBVE_NAME')) { //phpcs:ignore
            header("Location: " . admin_url('index.php'));
            die();
        }
    }
}, 99999);
