diff --git a/changelog.txt b/changelog.txt index 98aba58..29bab1f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ *** WooCommerce.com Update Manager Changelog *** +2024-06-10 - version 1.0.3 +* Update - Declare compatibility with WooCommerce cart_checkout_blocks feature. +* Fix - Fix function name conflicts with other plugins. + 2024-04-12 - version 1.0.2 * Update - Plugin name from Woo.com Update Manager to WooCommerce.com Update Manager. diff --git a/includes/class-woo-subscription-data-updater.php b/includes/class-woo-subscription-data-updater.php index 4c5ce16..af4ab8d 100644 --- a/includes/class-woo-subscription-data-updater.php +++ b/includes/class-woo-subscription-data-updater.php @@ -2,9 +2,11 @@ /** * Updates the plugin details stored in transients used for auto-updates. * - * @package Woo\Marketplace + * @package Automattic\WooUpdateManager */ +namespace Automattic\WooUpdateManager; + defined( 'ABSPATH' ) || exit; /** @@ -17,6 +19,7 @@ class Woo_Subscription_Data_Updater { * * @return void */ + public static function load() { add_filter( 'update_woo_com_subscription_details', [ __CLASS__, 'update_plugin_package_url' ], 10, 3 ); } @@ -53,8 +56,8 @@ public static function update_plugin_package_url( $item, $woo_subscription_data, * @return bool True if active subscription found. */ public static function has_active_subscription( $product_id ) { - $auth = WC_Helper_Options::get( 'auth' ); - $subscriptions = WC_Helper::get_subscriptions(); + $auth = \WC_Helper_Options::get( 'auth' ); + $subscriptions = \WC_Helper::get_subscriptions(); if ( empty( $auth['site_id'] ) || empty( $subscriptions ) ) { return false; diff --git a/woo-update-manager.php b/woo-update-manager.php index 43ef309..469d33d 100644 --- a/woo-update-manager.php +++ b/woo-update-manager.php @@ -11,11 +11,13 @@ * Woo: 18734003407318:e4367d0e8d424278fd7049e7d7b567a6 * Requires at least: 6.0 * Requires PHP: 7.3 - * Version: 1.0.2 + * Version: 1.0.3 * * @package Woo\UpdateManager */ +namespace Automattic\WooUpdateManager; + use Automattic\WooCommerce\Utilities\FeaturesUtil; defined( 'ABSPATH' ) || exit; @@ -35,21 +37,22 @@ function clear_update_transients() { /** * Register activation hook to clear update transients. */ -register_activation_hook( __FILE__, 'clear_update_transients' ); +register_activation_hook( __FILE__, __NAMESPACE__ . '\clear_update_transients' ); /** * Register de-activation hook to clear update transients. */ -register_deactivation_hook( __FILE__, 'clear_update_transients' ); +register_deactivation_hook( __FILE__, __NAMESPACE__ . '\clear_update_transients' ); /** * Declare compatibility for HPOS compatibility. */ -function declare_hpos_compatibility() { +function declare_wc_feature_compatibility() { if ( class_exists( FeaturesUtil::class ) ) { FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); + FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true ); } } -add_action( 'before_woocommerce_init', 'declare_hpos_compatibility' ); +add_action( 'before_woocommerce_init', __NAMESPACE__ . '\declare_wc_feature_compatibility' );