Remove constants and unhook old blocks plugin (https://github.com/woocommerce/woocommerce-blocks/pull/757)

This commit is contained in:
Mike Jolley 2019-07-22 16:20:51 +01:00 committed by GitHub
parent d8b459b312
commit eb4b8f426e
2 changed files with 5 additions and 12 deletions

View File

@ -158,9 +158,9 @@ class Assets {
protected static function get_file_version( $file ) {
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
$file = trim( $file, '/' );
return filemtime( WGPB_ABSPATH . $file );
return filemtime( \Automattic\WooCommerce\Blocks\Package::get_path() . '/' . $file );
}
return WGPB_VERSION;
return \Automattic\WooCommerce\Blocks\Package::get_version();
}
/**

View File

@ -35,14 +35,14 @@ class Package {
if ( true === self::$did_init || ! self::has_dependencies() ) {
return;
}
self::$did_init = true;
self::remove_core_blocks();
if ( ! self::is_built() ) {
return self::add_build_notice();
}
self::define_constants();
self::remove_core_blocks();
Library::init();
Assets::init();
RestApi::init();
@ -104,14 +104,6 @@ class Package {
);
}
/**
* Define plugin constants.
*/
protected static function define_constants() {
define( 'WGPB_VERSION', self::VERSION );
define( 'WGPB_ABSPATH', self::get_path() . '/' );
}
/**
* Remove core blocks (for 3.6 and below).
*/
@ -121,6 +113,7 @@ class Package {
remove_action( 'init', array( 'WC_Block_Library', 'register_assets' ) );
remove_filter( 'block_categories', array( 'WC_Block_Library', 'add_block_category' ) );
remove_action( 'admin_print_footer_scripts', array( 'WC_Block_Library', 'print_script_settings' ), 1 );
remove_action( 'init', array( 'WGPB_Block_Library', 'init' ) );
}
}