| 1 |
<?php |
| 2 |
/** |
| 3 |
* WholesaleX |
| 4 |
* |
| 5 |
* @link https://www.wpxpo.com/ |
| 6 |
* @since 1.0.0 |
| 7 |
* @package WholesaleX |
| 8 |
* |
| 9 |
* Plugin Name: WholesaleX – B2B & Wholesale Prices with Bulk Order Form for WooCommerce |
| 10 |
* Plugin URI: https://getwholesalex.com/?utm_source=plugin_details&utm_medium=home_page&utm_campaign=wholesalex-DB |
| 11 |
* Description: The WholesaleX plugin is a brand-new, highly-promising WooCommerce B2B solution to set up a conversion-focused B2B store for selling wholesale products. It offers everything required to operate an effective B2B store. |
| 12 |
* Version: 3.0.7 |
| 13 |
* Author: Wholesale Team |
| 14 |
* Author URI: https://getwholesalex.com/ |
| 15 |
* License: GPLv3 |
| 16 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 17 |
* Text Domain: wholesalex |
| 18 |
* Domain Path: /languages |
| 19 |
* Requires Plugins: woocommerce |
| 20 |
* WC requires at least: 4.0 |
| 21 |
* WC tested up to: 9.1 |
| 22 |
*/ |
| 23 |
|
| 24 |
// If this file is called directly, abort. |
| 25 |
if ( ! defined( 'ABSPATH' ) ) { |
| 26 |
die; |
| 27 |
} |
| 28 |
|
| 29 |
// Plugin Defined. |
| 30 |
define( 'WHOLESALEX_VER', '3.0.7' ); |
| 31 |
define( 'WHOLESALEX_URL', plugin_dir_url( __FILE__ ) ); |
| 32 |
define( 'WHOLESALEX_BASE', plugin_basename( __FILE__ ) ); |
| 33 |
define( 'WHOLESALEX_PATH', plugin_dir_path( __FILE__ ) ); |
| 34 |
|
| 35 |
/** |
| 36 |
* Check if WooCommerce is active. |
| 37 |
* |
| 38 |
* @return bool |
| 39 |
*/ |
| 40 |
function wholesalex_is_woocommerce_active() { |
| 41 |
if ( ! function_exists( 'is_plugin_active' ) ) { |
| 42 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 43 |
} |
| 44 |
|
| 45 |
return is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
/** |
| 50 |
* To Set Plugin is Compatible for WC Custom Order Table (HPOS) Feature. |
| 51 |
* |
| 52 |
* @since 1.5.0 |
| 53 |
*/ |
| 54 |
add_action( |
| 55 |
'before_woocommerce_init', |
| 56 |
function () { |
| 57 |
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { |
| 58 |
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); |
| 59 |
} |
| 60 |
} |
| 61 |
); |
| 62 |
|
| 63 |
/** |
| 64 |
* Declare incompatibility with Cart & Checkout Blocks. |
| 65 |
* |
| 66 |
* @since 1.5.0 |
| 67 |
*/ |
| 68 |
add_action( |
| 69 |
'before_woocommerce_init', |
| 70 |
function () { |
| 71 |
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { |
| 72 |
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true ); |
| 73 |
} |
| 74 |
} |
| 75 |
); |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
if ( ! function_exists( 'wholesalex' ) ) { |
| 80 |
/** |
| 81 |
* Common Function. |
| 82 |
*/ |
| 83 |
function wholesalex() { |
| 84 |
include_once WHOLESALEX_PATH . 'includes/Functions.php'; |
| 85 |
return new \WHOLESALEX\Functions(); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* Begins Execution of the Plugin. |
| 91 |
*/ |
| 92 |
function wholesalex_run() { |
| 93 |
require_once WHOLESALEX_PATH . 'includes/class-wholesalex-scripts.php'; |
| 94 |
|
| 95 |
require_once WHOLESALEX_PATH . 'includes/menu/class-wholesalex-setup-wizard.php'; |
| 96 |
new \WHOLESALEX\WHOLESALEX_Setup_Wizard(); |
| 97 |
|
| 98 |
// NOTICE DELETED FROM HERE. |
| 99 |
if ( wholesalex_is_woocommerce_active() ) { |
| 100 |
include_once WHOLESALEX_PATH . 'includes/class-wholesalex-initialization.php'; |
| 101 |
new WholesaleX_Initialization(); |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
wholesalex_run(); |
| 106 |
/** |
| 107 |
* The code that runs during plugin activation. |
| 108 |
*/ |
| 109 |
function wholesalex_activate_action() { |
| 110 |
if ( ! wholesalex_is_woocommerce_active() ) { |
| 111 |
deactivate_plugins( WHOLESALEX_BASE ); |
| 112 |
wp_die( |
| 113 |
esc_html__( 'WholesaleX requires WooCommerce to be installed and active. Please activate WooCommerce first.', 'wholesalex' ), |
| 114 |
esc_html__( 'Plugin dependency check failed', 'wholesalex' ), |
| 115 |
array( 'back_link' => true ) |
| 116 |
); |
| 117 |
} |
| 118 |
|
| 119 |
require_once WHOLESALEX_PATH . 'includes/class-wholesalex-activator.php'; |
| 120 |
new \WHOLESALEX\Activator(); |
| 121 |
} |
| 122 |
|
| 123 |
/** |
| 124 |
* The code that runs during plugin deactivation. |
| 125 |
*/ |
| 126 |
function wholesalex_deactivate_action() { |
| 127 |
require_once WHOLESALEX_PATH . 'includes/class-wholesalex-deactivator.php'; |
| 128 |
WholesaleX_Deactivator::deactivate(); |
| 129 |
} |
| 130 |
register_activation_hook( __FILE__, 'wholesalex_activate_action' ); |
| 131 |
register_deactivation_hook( __FILE__, 'wholesalex_deactivate_action' ); |
| 132 |
|