From e3dc79481de184d619f7f9a256783c984c3952ee Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 21 Jun 2019 15:03:28 +0100 Subject: [PATCH] Init the blocks library using autoloading --- composer.json | 2 +- composer.lock | 21 ++++++++++++++------- includes/class-woocommerce.php | 5 +++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index b25a53db056..8799d4f29fa 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "require": { "composer/installers": "1.6.0", "woocommerce/woocommerce-rest-api": "dev-test/jetpack-autoloader", - "woocommerce/woocommerce-blocks": "dev-add/build-config", + "woocommerce/woocommerce-blocks": "dev-refactor/php-classes", "automattic/jetpack-autoloader": "^1" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 90201ec5eb5..3ab58aabc6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b26e3ab11a27accf12e540dc6cb540a4", + "content-hash": "f269789179494befeb7caf0cb7bb29eb", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -164,16 +164,16 @@ }, { "name": "woocommerce/woocommerce-blocks", - "version": "dev-add/build-config", + "version": "dev-refactor/php-classes", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git", - "reference": "be2a243d0e999af6f4318f7b242cdac2565d36d8" + "reference": "52e2cd8ba1462c40febd5408994996872e2610d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/be2a243d0e999af6f4318f7b242cdac2565d36d8", - "reference": "be2a243d0e999af6f4318f7b242cdac2565d36d8", + "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/52e2cd8ba1462c40febd5408994996872e2610d5", + "reference": "52e2cd8ba1462c40febd5408994996872e2610d5", "shasum": "" }, "require": { @@ -184,9 +184,16 @@ "woocommerce/woocommerce-sniffs": "0.0.6" }, "type": "wordpress-plugin", + "extra": { + "scripts-description": { + "phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer", + "phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier" + } + }, "autoload": { "psr-4": { - "WooCommerce\\Blocks\\": "src/" + "WooCommerce\\Blocks\\": "src/", + "WooCommerce\\Blocks\\Tests\\": "tests/php/" } }, "notification-url": "https://packagist.org/downloads/", @@ -195,7 +202,7 @@ ], "description": "Feature plugin for the WooCommerce Gutenberg Products block", "homepage": "https://woocommerce.com/", - "time": "2019-06-20T14:53:51+00:00" + "time": "2019-06-20T09:39:04+00:00" }, { "name": "woocommerce/woocommerce-rest-api", diff --git a/includes/class-woocommerce.php b/includes/class-woocommerce.php index 181fc6ab96f..f45b3636ae8 100644 --- a/includes/class-woocommerce.php +++ b/includes/class-woocommerce.php @@ -540,6 +540,11 @@ final class WooCommerce { $this->deprecated_hook_handlers['actions'] = new WC_Deprecated_Action_Hooks(); $this->deprecated_hook_handlers['filters'] = new WC_Deprecated_Filter_Hooks(); + // Init any packages. + if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) { + \Automattic\WooCommerce\Blocks\Library::instance()->init(); + } + // Classes/actions loaded for the frontend and for ajax requests. if ( $this->is_request( 'frontend' ) ) { wc_load_cart();