2015-07-14 17:35:57 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Plugin Name: WooCommerce Beta Tester
|
2017-06-19 14:28:17 +00:00
|
|
|
* Plugin URI: https://github.com/woocommerce/woocommerce-beta-tester
|
2018-06-25 11:05:54 +00:00
|
|
|
* Description: Run bleeding edge versions of WooCommerce. This will replace your installed version of WooCommerce with the latest tagged release - use with caution, and not on production sites.
|
2023-08-23 20:51:43 +00:00
|
|
|
* Version: 2.2.4
|
2018-06-04 19:21:02 +00:00
|
|
|
* Author: WooCommerce
|
2017-06-19 14:28:17 +00:00
|
|
|
* Author URI: http://woocommerce.com/
|
2022-06-21 19:26:15 +00:00
|
|
|
* Requires at least: 5.8
|
|
|
|
* Tested up to: 6.0
|
2022-10-07 17:29:02 +00:00
|
|
|
* WC requires at least: 6.7
|
|
|
|
* WC tested up to: 7.0
|
2018-06-05 08:37:08 +00:00
|
|
|
* Text Domain: woocommerce-beta-tester
|
2023-08-11 00:51:01 +00:00
|
|
|
* Woo: 18734002351694:04192c15b62a4ce6f5fa69df608aa3aa
|
2018-06-05 08:37:08 +00:00
|
|
|
*
|
2018-06-04 19:21:02 +00:00
|
|
|
* @package WC_Beta_Tester
|
2015-07-14 17:35:57 +00:00
|
|
|
*/
|
2018-06-04 19:21:02 +00:00
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
2015-07-14 17:35:57 +00:00
|
|
|
|
2023-01-12 01:16:01 +00:00
|
|
|
|
|
|
|
if ( defined( 'WP_CLI' ) ) {
|
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-wc-beta-tester-cli.php';
|
|
|
|
WP_CLI::add_command( 'wc-beta-tester', WC_Beta_Tester_CLI::class );
|
|
|
|
}
|
|
|
|
|
2018-06-06 08:02:45 +00:00
|
|
|
// Define WC_BETA_TESTER_FILE.
|
|
|
|
if ( ! defined( 'WC_BETA_TESTER_FILE' ) ) {
|
|
|
|
define( 'WC_BETA_TESTER_FILE', __FILE__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! defined( 'WC_BETA_TESTER_VERSION' ) ) {
|
2023-08-23 20:51:43 +00:00
|
|
|
define( 'WC_BETA_TESTER_VERSION', '2.2.4' ); // WRCS: DEFINED_VERSION.
|
2018-06-06 08:02:45 +00:00
|
|
|
}
|
|
|
|
|
2015-07-22 22:34:43 +00:00
|
|
|
/**
|
2018-06-05 19:45:06 +00:00
|
|
|
* Load text domain before all other code.
|
|
|
|
*
|
|
|
|
* @since 2.0.0
|
2015-07-22 22:34:43 +00:00
|
|
|
*/
|
2018-06-05 19:45:06 +00:00
|
|
|
function _wc_beta_tester_load_textdomain() {
|
|
|
|
load_plugin_textdomain( 'woocommerce-beta-tester', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
|
|
|
}
|
2015-07-14 17:35:57 +00:00
|
|
|
|
2018-06-05 19:45:06 +00:00
|
|
|
add_action( 'plugins_loaded', '_wc_beta_tester_load_textdomain' );
|
2018-06-04 19:21:02 +00:00
|
|
|
|
2018-06-05 19:45:06 +00:00
|
|
|
/**
|
2023-05-08 07:55:09 +00:00
|
|
|
* Bootstrap plugin.
|
2018-06-05 19:45:06 +00:00
|
|
|
*/
|
|
|
|
function _wc_beta_tester_bootstrap() {
|
2015-07-14 18:31:22 +00:00
|
|
|
|
2018-06-05 19:45:06 +00:00
|
|
|
// Check if WooCommerce is enabled.
|
|
|
|
if ( ! class_exists( 'WooCommerce' ) ) {
|
|
|
|
include dirname( __FILE__ ) . '/includes/class-wc-beta-tester-admin-notices.php';
|
|
|
|
$notices = new WC_Beta_Tester_Admin_Notices();
|
|
|
|
|
|
|
|
add_action( 'admin_notices', array( $notices, 'woocoommerce_not_installed' ) );
|
|
|
|
} elseif ( ! class_exists( 'WC_Beta_Tester' ) ) {
|
|
|
|
include dirname( __FILE__ ) . '/includes/class-wc-beta-tester.php';
|
|
|
|
// Settings.
|
2020-11-03 18:27:32 +00:00
|
|
|
include dirname( __FILE__ ) . '/includes/class-wc-beta-tester-channel.php';
|
|
|
|
include dirname( __FILE__ ) . '/includes/class-wc-beta-tester-import-export.php';
|
|
|
|
new WC_Beta_Tester_Import_Export();
|
2018-06-06 13:52:26 +00:00
|
|
|
// Tools.
|
|
|
|
include dirname( __FILE__ ) . '/includes/class-wc-beta-tester-version-picker.php';
|
2015-07-14 18:31:22 +00:00
|
|
|
|
2018-06-05 19:45:06 +00:00
|
|
|
register_activation_hook( __FILE__, array( 'WC_Beta_Tester', 'activate' ) );
|
|
|
|
|
|
|
|
add_action( 'admin_init', array( 'WC_Beta_Tester', 'instance' ) );
|
|
|
|
}
|
2022-06-07 03:55:26 +00:00
|
|
|
|
2022-06-21 19:26:15 +00:00
|
|
|
// Load admin.
|
2023-01-12 01:16:01 +00:00
|
|
|
require 'plugin.php';
|
2015-07-22 22:34:43 +00:00
|
|
|
}
|
2018-06-05 19:45:06 +00:00
|
|
|
|
|
|
|
add_action( 'plugins_loaded', '_wc_beta_tester_bootstrap' );
|
2022-06-07 03:55:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the JS.
|
|
|
|
*/
|
|
|
|
function add_extension_register_script() {
|
2023-06-21 07:14:20 +00:00
|
|
|
if ( ! defined( 'WC_ADMIN_APP' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2022-06-07 03:55:26 +00:00
|
|
|
$script_path = '/build/index.js';
|
|
|
|
$script_asset_path = dirname( __FILE__ ) . '/build/index.asset.php';
|
|
|
|
$script_asset = file_exists( $script_asset_path )
|
2023-01-12 01:16:01 +00:00
|
|
|
? require $script_asset_path
|
2022-06-21 19:26:15 +00:00
|
|
|
: array(
|
|
|
|
'dependencies' => array(),
|
|
|
|
'version' => filemtime( $script_path ),
|
|
|
|
);
|
2023-01-12 01:16:01 +00:00
|
|
|
$script_url = plugins_url( $script_path, __FILE__ );
|
2022-06-07 03:55:26 +00:00
|
|
|
|
2023-05-05 08:10:26 +00:00
|
|
|
$script_asset['dependencies'][] = WC_ADMIN_APP; // Add WCA as a dependency to ensure it loads first.
|
|
|
|
|
2022-06-07 03:55:26 +00:00
|
|
|
wp_register_script(
|
|
|
|
'woocommerce-admin-test-helper',
|
|
|
|
$script_url,
|
|
|
|
$script_asset['dependencies'],
|
|
|
|
$script_asset['version'],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
wp_enqueue_script( 'woocommerce-admin-test-helper' );
|
|
|
|
|
|
|
|
$css_file_version = filemtime( dirname( __FILE__ ) . '/build/index.css' );
|
|
|
|
|
|
|
|
wp_register_style(
|
|
|
|
'wp-components',
|
|
|
|
plugins_url( 'dist/components/style.css', __FILE__ ),
|
|
|
|
array(),
|
|
|
|
$css_file_version
|
|
|
|
);
|
|
|
|
|
|
|
|
wp_register_style(
|
|
|
|
'woocommerce-admin-test-helper',
|
|
|
|
plugins_url( '/build/index.css', __FILE__ ),
|
|
|
|
// Add any dependencies styles may have, such as wp-components.
|
|
|
|
array(
|
2022-06-21 19:26:15 +00:00
|
|
|
'wp-components',
|
2022-06-07 03:55:26 +00:00
|
|
|
),
|
|
|
|
$css_file_version
|
|
|
|
);
|
|
|
|
|
|
|
|
wp_enqueue_style( 'woocommerce-admin-test-helper' );
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action( 'admin_enqueue_scripts', 'add_extension_register_script' );
|
2023-05-25 08:06:06 +00:00
|
|
|
|
|
|
|
add_action(
|
|
|
|
'before_woocommerce_init',
|
|
|
|
function() {
|
|
|
|
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
|
|
|
|
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
|
|
|
|
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'product_block_editor', __FILE__, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2023-06-20 06:54:49 +00:00
|
|
|
|
|
|
|
// Initialize the live branches feature.
|
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-wc-beta-tester-live-branches.php';
|