plugin updates

This commit is contained in:
Tony Volpe
2024-06-17 14:48:11 -04:00
parent ecc5fbf831
commit 3751a5a1a6
1318 changed files with 91130 additions and 52250 deletions

View File

@@ -10,6 +10,8 @@ defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
use Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController;
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonCacheInvalidator;
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonRequestHandler;
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
use Automattic\WooCommerce\Internal\DownloadPermissionsAdjuster;
use Automattic\WooCommerce\Internal\Features\FeaturesController;
@@ -39,7 +41,7 @@ final class WooCommerce {
*
* @var string
*/
public $version = '8.8.3';
public $version = '8.9.3';
/**
* WooCommerce Schema version.
@@ -246,7 +248,9 @@ final class WooCommerce {
add_action( 'init', array( 'WC_Emails', 'init_transactional_emails' ) );
add_action( 'init', array( $this, 'add_image_sizes' ) );
add_action( 'init', array( $this, 'load_rest_api' ) );
add_action( 'init', array( 'WC_Site_Tracking', 'init' ) );
if ( $this->is_request( 'admin' ) || ( $this->is_rest_api_request() && ! $this->is_store_api_request() ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
add_action( 'init', array( 'WC_Site_Tracking', 'init' ) );
}
add_action( 'switch_blog', array( $this, 'wpdb_table_fix' ), 0 );
add_action( 'activated_plugin', array( $this, 'activated_plugin' ) );
add_action( 'deactivated_plugin', array( $this, 'deactivated_plugin' ) );
@@ -255,11 +259,6 @@ final class WooCommerce {
add_action( 'woocommerce_installed', array( $this, 'add_woocommerce_remote_variant' ) );
add_action( 'woocommerce_updated', array( $this, 'add_woocommerce_remote_variant' ) );
if ( Features::is_enabled( 'launch-your-store' ) ) {
add_action( 'woocommerce_newly_installed', array( $this, 'add_lys_default_values' ) );
add_action( 'woocommerce_updated', array( $this, 'add_lys_default_values' ) );
}
// These classes set up hooks on instantiation.
$container = wc_get_container();
$container->get( ProductDownloadDirectories::class );
@@ -276,6 +275,8 @@ final class WooCommerce {
$container->get( WebhookUtil::class );
$container->get( Marketplace::class );
$container->get( TimeUtil::class );
$container->get( ComingSoonCacheInvalidator::class );
$container->get( ComingSoonRequestHandler::class );
/**
* These classes have a register method for attaching hooks.
@@ -314,35 +315,6 @@ final class WooCommerce {
}
}
/**
* Set default option values for launch your store task.
*/
public function add_lys_default_values() {
$is_new_install = current_action() === 'woocommerce_newly_installed';
$coming_soon = $is_new_install ? 'yes' : 'no';
$launch_status = $is_new_install ? 'unlaunched' : 'launched';
$store_pages_only = WCAdminHelper::is_site_fresh() ? 'no' : 'yes';
$private_link = 'yes';
$share_key = wp_generate_password( 32, false );
if ( false === get_option( 'woocommerce_coming_soon', false ) ) {
update_option( 'woocommerce_coming_soon', $coming_soon );
}
if ( false === get_option( 'woocommerce_store_pages_only', false ) ) {
update_option( 'woocommerce_store_pages_only', $store_pages_only );
}
if ( false === get_option( 'woocommerce_private_link', false ) ) {
update_option( 'woocommerce_private_link', $private_link );
}
if ( false === get_option( 'woocommerce_share_key', false ) ) {
update_option( 'woocommerce_share_key', $share_key );
}
if ( false === get_option( 'launch-status', false ) ) {
update_option( 'launch-status', $launch_status );
}
}
/**
* Ensures fatal errors are logged so they can be picked up in the status report.
*
@@ -431,7 +403,6 @@ final class WooCommerce {
* The SSR in the name is preserved for bw compatibility, as this was initially used in System Status Report.
*/
$this->define( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE', 'none' );
}
/**
@@ -492,6 +463,19 @@ final class WooCommerce {
return apply_filters( 'woocommerce_is_rest_api_request', $is_rest_api_request );
}
/**
* Returns true if the request is a store REST API request.
*
* @return bool
*/
public function is_store_api_request() {
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
return false;
}
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
return false !== strpos( $_SERVER['REQUEST_URI'], trailingslashit( rest_get_url_prefix() ) . 'wc/store/' );
}
/**
* Load REST API.
*/
@@ -1023,7 +1007,7 @@ final class WooCommerce {
* @param string $filename The filename of the activated plugin.
*/
public function activated_plugin( $filename ) {
include_once dirname( __FILE__ ) . '/admin/helper/class-wc-helper.php';
include_once __DIR__ . '/admin/helper/class-wc-helper.php';
if ( '/woocommerce.php' === substr( $filename, -16 ) ) {
set_transient( 'woocommerce_activated_plugin', $filename );
@@ -1039,7 +1023,7 @@ final class WooCommerce {
* @param string $filename The filename of the deactivated plugin.
*/
public function deactivated_plugin( $filename ) {
include_once dirname( __FILE__ ) . '/admin/helper/class-wc-helper.php';
include_once __DIR__ . '/admin/helper/class-wc-helper.php';
WC_Helper::deactivated_plugin( $filename );
}