woocommerce/plugins/woocommerce-beta-tester/woocommerce-beta-tester.php

114 lines
3.3 KiB
PHP
Raw Normal View History

<?php
/**
* Plugin Name: WooCommerce Beta Tester
* 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.
2021-12-17 18:13:06 +00:00
* Version: 2.0.5
* Author: WooCommerce
* Author URI: http://woocommerce.com/
* Requires at least: 4.4
2021-09-24 00:26:34 +00:00
* Tested up to: 5.8
* WC requires at least: 3.6.0
2021-09-24 00:26:34 +00:00
* WC tested up to: 5.7.0
2018-06-05 08:37:08 +00:00
* Text Domain: woocommerce-beta-tester
*
* @package WC_Beta_Tester
*/
defined( 'ABSPATH' ) || exit;
// Define WC_BETA_TESTER_FILE.
if ( ! defined( 'WC_BETA_TESTER_FILE' ) ) {
define( 'WC_BETA_TESTER_FILE', __FILE__ );
}
if ( ! defined( 'WC_BETA_TESTER_VERSION' ) ) {
2020-11-20 18:07:13 +00:00
define( 'WC_BETA_TESTER_VERSION', '2.0.2' );
}
/**
* Load text domain before all other code.
*
* @since 2.0.0
*/
function _wc_beta_tester_load_textdomain() {
load_plugin_textdomain( 'woocommerce-beta-tester', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
add_action( 'plugins_loaded', '_wc_beta_tester_load_textdomain' );
/**
* Boostrap plugin.
*/
function _wc_beta_tester_bootstrap() {
// 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();
// Tools.
include dirname( __FILE__ ) . '/includes/class-wc-beta-tester-version-picker.php';
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
// Load admin
require( 'plugin.php' );
}
add_action( 'plugins_loaded', '_wc_beta_tester_bootstrap' );
2022-06-07 03:55:26 +00:00
/**
* Register the JS.
*/
function add_extension_register_script() {
$script_path = '/build/index.js';
$script_asset_path = dirname( __FILE__ ) . '/build/index.asset.php';
$script_asset = file_exists( $script_asset_path )
? require( $script_asset_path )
: array( 'dependencies' => array(), 'version' => filemtime( $script_path ) );
$script_url = plugins_url( $script_path, __FILE__ );
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(
'wp-components'
),
$css_file_version
);
wp_enqueue_style( 'woocommerce-admin-test-helper' );
}
add_action( 'admin_enqueue_scripts', 'add_extension_register_script' );