auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions

View File

@@ -8,6 +8,7 @@
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Admin\RemoteInboxNotifications as PromotionRuleEngine;
use Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\RuleEvaluator;
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -315,16 +316,16 @@ class WC_Admin_Addons {
if ( 'storefront' === $template ) {
if ( 'storefront' === $stylesheet ) {
$url = 'https://woo.com/product-category/themes/storefront-child-theme-themes/';
$url = 'https://woocommerce.com/product-category/themes/storefront-child-theme-themes/';
$text = __( 'Need a fresh look? Try Storefront child themes', 'woocommerce' );
$utm_content = 'nostorefrontchildtheme';
} else {
$url = 'https://woo.com/product-category/themes/storefront-child-theme-themes/';
$url = 'https://woocommerce.com/product-category/themes/storefront-child-theme-themes/';
$text = __( 'View more Storefront child themes', 'woocommerce' );
$utm_content = 'hasstorefrontchildtheme';
}
} else {
$url = 'https://woo.com/storefront/';
$url = 'https://woocommerce.com/storefront/';
$text = __( 'Need a theme? Try Storefront', 'woocommerce' );
$utm_content = 'nostorefront';
}
@@ -1014,11 +1015,11 @@ class WC_Admin_Addons {
wp_kses_post(
/* translators: a url */
__(
'To start growing your business, head over to <a href="%s">Woo.com</a>, where you\'ll find the most popular WooCommerce extensions.',
'To start growing your business, head over to <a href="%s">WooCommerce.com</a>, where you\'ll find the most popular WooCommerce extensions.',
'woocommerce'
)
),
'https://woo.com/products/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=connectionerror'
'https://woocommerce.com/products/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=connectionerror'
);
?>
</p>
@@ -1075,7 +1076,7 @@ class WC_Admin_Addons {
// Check for existence of promotions and evaluate out if we should show them.
if ( ! empty( $promotions ) ) {
foreach ( $promotions as $promo_id => $promotion ) {
$evaluator = new PromotionRuleEngine\RuleEvaluator();
$evaluator = new RuleEvaluator();
$passed = $evaluator->evaluate( $promotion->rules );
if ( ! $passed ) {
unset( $promotions[ $promo_id ] );
@@ -1546,7 +1547,7 @@ class WC_Admin_Addons {
}
/**
* Make wp_safe_remote_get request to Woo.com endpoint.
* Make wp_safe_remote_get request to WooCommerce.com endpoint.
* Optionally pass user auth token, locale or country.
*
* @param string $url URL to request.

View File

@@ -586,7 +586,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
'wc-admin-' . $script_name,
WCAdminAssets::get_url( $script_path_name . '/' . $script_name, 'js' ),
$script_assets['dependencies'],
WCAdminAssets::get_file_version( 'js' ),
WCAdminAssets::get_file_version( 'js', $script_assets['version'] ),
true
);
}

View File

@@ -8,6 +8,7 @@
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Admin\Features\Features;
use Automattic\WooCommerce\Utilities\OrderUtil;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
@@ -81,23 +82,49 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
private function get_top_seller() {
global $wpdb;
$query = array();
$query['fields'] = "SELECT SUM( order_item_meta.meta_value ) as qty, order_item_meta_2.meta_value as product_id
FROM {$wpdb->posts} as posts";
$query['join'] = "INNER JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_id ";
$query['join'] .= "INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id ";
$query['join'] .= "INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id ";
$query['where'] = "WHERE posts.post_type IN ( '" . implode( "','", wc_get_order_types( 'order-count' ) ) . "' ) ";
$query['where'] .= "AND posts.post_status IN ( 'wc-" . implode( "','wc-", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "' ) ";
$hpos_enabled = OrderUtil::custom_orders_table_usage_is_enabled();
$orders_table = OrderUtil::get_table_for_orders();
$orders_column_id = $hpos_enabled ? 'id' : 'ID';
$orders_column_type = $hpos_enabled ? 'type' : 'post_type';
$orders_column_status = $hpos_enabled ? 'status' : 'post_status';
$orders_column_date = $hpos_enabled ? 'date_created_gmt' : 'post_date_gmt';
$query = array();
$query['fields'] = "SELECT SUM( order_item_meta.meta_value ) as qty, order_item_meta_2.meta_value as product_id FROM {$orders_table} AS orders";
$query['join'] = "INNER JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON orders.{$orders_column_id} = order_id ";
$query['join'] .= "INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id ";
$query['join'] .= "INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id ";
$query['where'] = "WHERE orders.{$orders_column_type} IN ( '" . implode( "','", wc_get_order_types( 'order-count' ) ) . "' ) ";
/**
* Allows modifying the order statuses used in the top seller query inside the dashboard status widget.
*
* @since 2.2.0
*
* @param string[] $order_statuses Order statuses.
*/
$order_statuses = apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) );
$query['where'] .= "AND orders.{$orders_column_status} IN ( 'wc-" . implode( "','wc-", $order_statuses ) . "' ) ";
$query['where'] .= "AND order_item_meta.meta_key = '_qty' ";
$query['where'] .= "AND order_item_meta_2.meta_key = '_product_id' ";
$query['where'] .= "AND posts.post_date >= '" . gmdate( 'Y-m-01', current_time( 'timestamp' ) ) . "' ";
$query['where'] .= "AND posts.post_date <= '" . gmdate( 'Y-m-d H:i:s', current_time( 'timestamp' ) ) . "' ";
$query['where'] .= "AND orders.{$orders_column_date} >= '" . gmdate( 'Y-m-01', current_time( 'timestamp' ) ) . "' "; // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested
$query['where'] .= "AND orders.{$orders_column_date} <= '" . gmdate( 'Y-m-d H:i:s', current_time( 'timestamp' ) ) . "' "; // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested
$query['groupby'] = 'GROUP BY product_id';
$query['orderby'] = 'ORDER BY qty DESC';
$query['limits'] = 'LIMIT 1';
return $wpdb->get_row( implode( ' ', apply_filters( 'woocommerce_dashboard_status_widget_top_seller_query', $query ) ) ); //phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
/**
* Allows modification of the query to determine the top seller product in the dashboard status widget.
*
* @since 2.2.0
*
* @param array $query SQL query parts.
*/
$query = apply_filters( 'woocommerce_dashboard_status_widget_top_seller_query', $query );
$sql = implode( ' ', $query );
return $wpdb->get_row( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
}
/**
@@ -202,9 +229,9 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
$processing_count = 0;
foreach ( wc_get_order_types( 'order-count' ) as $type ) {
$counts = (array) wp_count_posts( $type );
$on_hold_count += isset( $counts['wc-on-hold'] ) ? $counts['wc-on-hold'] : 0;
$processing_count += isset( $counts['wc-processing'] ) ? $counts['wc-processing'] : 0;
$counts = OrderUtil::get_count_for_type( $type );
$on_hold_count += $counts['wc-on-hold'];
$processing_count += $counts['wc-processing'];
}
?>
<li class="processing-orders">

View File

@@ -45,16 +45,16 @@ class WC_Admin_Help {
'<p>' . sprintf(
/* translators: %s: Documentation URL */
__( 'Should you need help understanding, using, or extending WooCommerce, <a href="%s">please read our documentation</a>. You will find all kinds of resources including snippets, tutorials and much more.', 'woocommerce' ),
'https://woo.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'
'https://woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'
) . '</p>' .
'<p>' . sprintf(
/* translators: %s: Forum URL */
__( 'For further assistance with WooCommerce core, use the <a href="%1$s">community forum</a>. For help with premium extensions sold on Woo.com, <a href="%2$s">open a support request at Woo.com</a>.', 'woocommerce' ),
__( 'For further assistance with WooCommerce core, use the <a href="%1$s">community forum</a>. For help with premium extensions sold on WooCommerce.com, <a href="%2$s">open a support request at WooCommerce.com</a>.', 'woocommerce' ),
'https://wordpress.org/support/plugin/woocommerce',
'https://woo.com/my-account/create-a-ticket/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin'
'https://woocommerce.com/my-account/create-a-ticket/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin'
) . '</p>' .
'<p>' . __( 'Before asking for help, we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' .
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System status', 'woocommerce' ) . '</a> <a href="https://wordpress.org/support/plugin/woocommerce" class="button">' . __( 'Community forum', 'woocommerce' ) . '</a> <a href="https://woo.com/my-account/create-a-ticket/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin" class="button">' . __( 'Woo.com support', 'woocommerce' ) . '</a></p>',
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System status', 'woocommerce' ) . '</a> <a href="https://wordpress.org/support/plugin/woocommerce" class="button">' . __( 'Community forum', 'woocommerce' ) . '</a> <a href="https://woocommerce.com/my-account/create-a-ticket/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin" class="button">' . __( 'WooCommerce.com support', 'woocommerce' ) . '</a></p>',
)
);
@@ -73,11 +73,11 @@ class WC_Admin_Help {
$screen->set_help_sidebar(
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
'<p><a href="https://woo.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' .
'<p><a href="https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' .
'<p><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">' . __( 'WordPress.org project', 'woocommerce' ) . '</a></p>' .
'<p><a href="https://github.com/woocommerce/woocommerce/" target="_blank">' . __( 'GitHub project', 'woocommerce' ) . '</a></p>' .
'<p><a href="https://woo.com/product-category/themes/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official themes', 'woocommerce' ) . '</a></p>' .
'<p><a href="https://woo.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official extensions', 'woocommerce' ) . '</a></p>'
'<p><a href="https://woocommerce.com/product-category/themes/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official themes', 'woocommerce' ) . '</a></p>' .
'<p><a href="https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official extensions', 'woocommerce' ) . '</a></p>'
);
}
}

View File

@@ -15,8 +15,11 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class WC_Admin_Marketplace_Promotions {
const TRANSIENT_NAME = 'woocommerce_marketplace_promotions';
const SCHEDULED_ACTION_HOOK = 'woocommerce_marketplace_fetch_promotions';
const TRANSIENT_NAME = 'woocommerce_marketplace_promotions';
const SCHEDULED_ACTION_HOOK = 'woocommerce_marketplace_fetch_promotions';
const PROMOTIONS_API_URL = 'https://woocommerce.com/wp-json/wccom-extensions/3.0/promotions';
const SCHEDULED_ACTION_INTERVAL = 12 * HOUR_IN_SECONDS;
/**
* The user's locale, for example en_US.
*
@@ -26,69 +29,74 @@ class WC_Admin_Marketplace_Promotions {
/**
* On all admin pages, schedule an action to fetch promotions data.
* Add menu badge to WooCommerce Extensions item if the promotions
* API requests one.
* Shows notice and adds menu badge to WooCommerce Extensions item
* if the promotions API requests them.
*
* WC_Admin calls this method when it is instantiated during
* is_admin requests.
*
* @return void
*/
public static function init_marketplace_promotions() {
public static function init() {
/**
* Filter to suppress the requests for and showing of marketplace promotions.
*
* @since 8.8
*/
if ( apply_filters( 'woocommerce_marketplace_suppress_promotions', false ) ) {
return;
}
register_deactivation_hook( WC_PLUGIN_FILE, array( __CLASS__, 'clear_scheduled_event' ) );
// Add the callback for our scheduled action.
if ( ! has_action( self::SCHEDULED_ACTION_HOOK, array( __CLASS__, 'fetch_marketplace_promotions' ) ) ) {
add_action( self::SCHEDULED_ACTION_HOOK, array( __CLASS__, 'fetch_marketplace_promotions' ) );
}
if ( self::is_admin_page() ) {
// Schedule the action twice a day, starting now.
if ( false === wp_next_scheduled( self::SCHEDULED_ACTION_HOOK ) ) {
wp_schedule_event( time(), 'twicedaily', self::SCHEDULED_ACTION_HOOK );
}
self::$locale = ( self::$locale ?? get_user_locale() ) ?? 'en_US';
self::maybe_show_bubble_promotions();
if ( is_admin() ) {
add_action( 'init', array( __CLASS__, 'schedule_promotion_fetch' ), 12 );
}
register_deactivation_hook( WC_PLUGIN_FILE, array( __CLASS__, 'clear_scheduled_event' ) );
}
/**
* Check if the request is for an admin page, and not ajax.
* We may want to add a menu bubble to WooCommerce Extensions
* on any admin page, as the user may view the WooCommerce flyout
* menu.
*
* @return bool
*/
private static function is_admin_page(): bool {
if (
( defined( 'DOING_AJAX' ) && DOING_AJAX )
|| ! is_admin()
defined( 'DOING_AJAX' ) && DOING_AJAX
|| defined( 'DOING_CRON' ) && DOING_CRON
|| defined( 'WP_CLI' ) && WP_CLI
) {
return false;
return;
}
return true;
self::$locale = ( self::$locale ?? get_user_locale() ) ?? 'en_US';
self::maybe_show_bubble_promotions();
}
/**
* Get promotions to show in the Woo in-app marketplace.
* Only run on selected pages in the main WooCommerce menu in wp-admin.
* Loads promotions in transient with one day life.
* Schedule the action to fetch promotions data.
*/
public static function schedule_promotion_fetch() {
// Schedule the action twice a day using Action Scheduler.
if (
function_exists( 'as_has_scheduled_action' )
&& function_exists( 'as_schedule_recurring_action' )
&& false === as_has_scheduled_action( self::SCHEDULED_ACTION_HOOK )
) {
as_schedule_recurring_action( time(), self::SCHEDULED_ACTION_INTERVAL, self::SCHEDULED_ACTION_HOOK );
}
}
/**
* Get promotions to show in the Woo in-app marketplace and load them into a transient
* with a 12-hour life. Run as a recurring scheduled action.
*
* @return void
*/
public static function fetch_marketplace_promotions() {
$url = 'https://woo.com/wp-json/wccom-extensions/3.0/promotions';
$promotions = get_transient( self::TRANSIENT_NAME );
if ( false !== $promotions ) {
return;
}
// Fetch promotions from the API.
$fetch_options = array(
'auth' => true,
'country' => true,
);
$raw_promotions = WC_Admin_Addons::fetch( $url, $fetch_options );
$raw_promotions = WC_Admin_Addons::fetch( self::PROMOTIONS_API_URL, $fetch_options );
// phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores
if ( is_wp_error( $raw_promotions ) ) {
@@ -111,21 +119,21 @@ class WC_Admin_Marketplace_Promotions {
}
$promotions = json_decode( wp_remote_retrieve_body( $raw_promotions ), true );
if ( empty( $promotions ) || ! is_array( $promotions ) ) {
if ( ! is_array( $promotions ) ) {
$promotions = array();
/**
* Allows connection error to be handled.
*
* @since 8.7
*/
do_action( 'woocommerce_page_wc-addons_connection_error', 'Empty or malformed response' );
do_action( 'woocommerce_page_wc-addons_connection_error', 'Malformed response' );
}
// phpcs:enable WordPress.NamingConventions.ValidHookName.UseUnderscores
if ( $promotions ) {
// Filter out any expired promotions.
$promotions = self::get_active_promotions( $promotions );
set_transient( self::TRANSIENT_NAME, $promotions, DAY_IN_SECONDS );
}
// Filter out any expired promotions.
$active_promotions = self::get_active_promotions( $promotions );
set_transient( self::TRANSIENT_NAME, $active_promotions, 12 * HOUR_IN_SECONDS );
}
/**
@@ -242,11 +250,11 @@ class WC_Admin_Marketplace_Promotions {
* Adds a bubble to the menu item.
*
* @param array $menu_items Arrays representing items in nav menu.
* @param ?array $promotion Data about a promotion from the Woo.com API.
* @param ?array $promotion Data about a promotion from the WooCommerce.com API.
*
* @return array
*/
public static function filter_marketplace_menu_items( $menu_items, $promotion = array() ) {
public static function filter_marketplace_menu_items( $menu_items, $promotion = array() ): array {
if ( ! isset( $promotion['menu_item_id'] ) || ! isset( $promotion['content'] ) ) {
return $menu_items;
}
@@ -256,7 +264,7 @@ class WC_Admin_Marketplace_Promotions {
&& $promotion['menu_item_id'] === $menu_item['id']
) {
$bubble_text = $promotion['content'][ self::$locale ] ?? ( $promotion['content']['en_US'] ?? __( 'Sale', 'woocommerce' ) );
$menu_items[ $index ]['title'] = $menu_item['title'] . self::append_bubble( $bubble_text );
$menu_items[ $index ]['title'] = self::append_bubble( $menu_item['title'], $bubble_text );
break;
}
@@ -268,12 +276,19 @@ class WC_Admin_Marketplace_Promotions {
/**
* Return the markup for a menu item bubble with a given text.
*
* @param string $bubble_text Text of bubble.
* @param string $menu_item_text Text of menu item we want to change.
* @param string $bubble_text Text of bubble.
*
* @return string
*/
private static function append_bubble( $bubble_text ) {
return ' <span class="awaiting-mod update-plugins remaining-tasks-badge woocommerce-task-list-remaining-tasks-badge">' . esc_html( $bubble_text ) . '</span>';
private static function append_bubble( string $menu_item_text, string $bubble_text ): string {
// Strip out update count bubble added by Marketplace::get_marketplace_update_count_html.
$menu_item_text = preg_replace( '|<span class="update-plugins count-[\d]+">[A-z0-9 <>="-]+</span>|', '', $menu_item_text );
return $menu_item_text
. '<span class="awaiting-mod update-plugins remaining-tasks-badge woocommerce-task-list-remaining-tasks-badge">'
. esc_html( $bubble_text )
. '</span>';
}
/**
@@ -282,7 +297,13 @@ class WC_Admin_Marketplace_Promotions {
* @return void
*/
public static function clear_scheduled_event() {
$timestamp = wp_next_scheduled( self::SCHEDULED_ACTION_HOOK );
wp_unschedule_event( $timestamp, self::SCHEDULED_ACTION_HOOK );
if ( function_exists( 'as_unschedule_all_actions' ) ) {
as_unschedule_all_actions( self::SCHEDULED_ACTION_HOOK );
}
}
}
// Fetch list of promotions from WooCommerce.com for WooCommerce admin UI.
if ( ! has_action( 'init', array( 'WC_Admin_Marketplace_Promotions', 'init' ) ) ) {
add_action( 'init', array( 'WC_Admin_Marketplace_Promotions', 'init' ), 11 );
}

View File

@@ -10,6 +10,7 @@ use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods;
use Automattic\WooCommerce\Internal\Utilities\Users;
use Automattic\WooCommerce\Internal\Utilities\WebhookUtil;
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
defined( 'ABSPATH' ) || exit;
@@ -21,7 +22,10 @@ class WC_Admin_Notices {
use AccessiblePrivateMethods;
/**
* Stores notices.
* Local notices cache.
*
* DON'T manipulate this field directly!
* Always use get_notices and set_notices instead.
*
* @var array
*/
@@ -48,10 +52,18 @@ class WC_Admin_Notices {
);
/**
* Constructor.
* Stores a flag indicating if the code is running in a multisite setup.
*
* @var bool
*/
private static bool $is_multisite;
/**
* Initializes the class.
*/
public static function init() {
self::$notices = get_option( 'woocommerce_admin_notices', array() );
self::$is_multisite = is_multisite();
self::set_notices( get_option( 'woocommerce_admin_notices', array() ) );
add_action( 'switch_theme', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
@@ -85,26 +97,50 @@ class WC_Admin_Notices {
}
/**
* Store notices to DB
* Store the locally cached notices to DB.
*/
public static function store_notices() {
update_option( 'woocommerce_admin_notices', self::get_notices() );
}
/**
* Get notices
* Get the value of the locally cached notices array for the current site.
*
* @return array
*/
public static function get_notices() {
return self::$notices;
if ( ! self::$is_multisite ) {
return self::$notices;
}
$blog_id = get_current_blog_id();
$notices = self::$notices[ $blog_id ] ?? null;
if ( ! is_null( $notices ) ) {
return $notices;
}
self::$notices[ $blog_id ] = get_option( 'woocommerce_admin_notices', array() );
return self::$notices[ $blog_id ];
}
/**
* Remove all notices.
* Set the locally cached notices array for the current site.
*
* @param array $notices New value for the locally cached notices array.
*/
private static function set_notices( array $notices ) {
if ( self::$is_multisite ) {
self::$notices[ get_current_blog_id() ] = $notices;
} else {
self::$notices = $notices;
}
}
/**
* Remove all notices from the locally cached notices array.
*/
public static function remove_all_notices() {
self::$notices = array();
self::set_notices( array() );
}
/**
@@ -150,7 +186,7 @@ class WC_Admin_Notices {
wpautop( __( 'The WooCommerce Legacy REST API, <a href="%1$s">currently enabled in this site</a>, will be removed in WooCommerce 9.0. <a target="_blank" href="%2$s">A separate WooCommerce extension is available</a> to keep it enabled. <b><a target="_blank" href="%3$s">Learn more about this change.</a></b>', 'woocommerce' ) ),
admin_url( 'admin.php?page=wc-settings&tab=advanced&section=legacy_api' ),
'https://wordpress.org/plugins/woocommerce-legacy-rest-api/',
'https://developer.woo.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
)
)
);
@@ -170,7 +206,7 @@ class WC_Admin_Notices {
wpautop( __( 'The WooCommerce Legacy REST API will be removed in WooCommerce 9.0, and this will cause <a href="%1$s">webhooks on this site that are configured to use the Legacy REST API</a> to stop working. <a target="_blank" href="%2$s">A separate WooCommerce extension is available</a> to allow these webhooks to keep using the Legacy REST API without interruption. You can also edit these webhooks to use the current REST API version to generate the payload instead. <b><a target="_blank" href="%3$s">Learn more about this change.</a></b>', 'woocommerce' ) ),
admin_url( 'admin.php?page=wc-settings&tab=advanced&section=webhooks&legacy=true' ),
'https://wordpress.org/plugins/woocommerce-legacy-rest-api/',
'https://developer.woo.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
)
)
);
@@ -182,7 +218,7 @@ class WC_Admin_Notices {
* or if the Legacy REST API extension is installed, and remove the notice about Legacy webhooks
* if no such webhooks exist anymore or if the Legacy REST API extension is installed.
*
* TODO: Change this method in WooCommerce 9.0 so that the notice gets removed if the Legacy REST API extension is installed and active.
* TODO: Change this method in WooCommerce 9.0 so that the notice get removed if the Legacy REST API extension is installed and active.
*/
private static function maybe_remove_legacy_api_removal_notice() {
$plugin_is_active = is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' );
@@ -194,6 +230,11 @@ class WC_Admin_Notices {
if ( self::has_notice( 'legacy_webhooks_unsupported_in_woo_90' ) && ( $plugin_is_active || 0 === wc_get_container()->get( WebhookUtil::class )->get_legacy_webhooks_count() ) ) {
self::remove_notice( 'legacy_webhooks_unsupported_in_woo_90' );
}
if ( self::has_notice( 'legacy_rest_api_is_incompatible_with_hpos' ) &&
! ( 'yes' === get_option( 'woocommerce_api_enabled' ) && 'yes' === get_option( CustomOrdersTableController::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION ) ) ) {
self::remove_notice( 'legacy_rest_api_is_incompatible_with_hpos' );
}
}
// phpcs:enable Generic.Commenting.Todo.TaskFound
@@ -205,7 +246,7 @@ class WC_Admin_Notices {
* @param bool $force_save Force saving inside this method instead of at the 'shutdown'.
*/
public static function add_notice( $name, $force_save = false ) {
self::$notices = array_unique( array_merge( self::get_notices(), array( $name ) ) );
self::set_notices( array_unique( array_merge( self::get_notices(), array( $name ) ) ) );
if ( $force_save ) {
// Adding early save to prevent more race conditions with notices.
@@ -220,7 +261,7 @@ class WC_Admin_Notices {
* @param bool $force_save Force saving inside this method instead of at the 'shutdown'.
*/
public static function remove_notice( $name, $force_save = false ) {
self::$notices = array_diff( self::get_notices(), array( $name ) );
self::set_notices( array_diff( self::get_notices(), array( $name ) ) );
delete_option( 'woocommerce_admin_notice_' . $name );
if ( $force_save ) {
@@ -229,6 +270,28 @@ class WC_Admin_Notices {
}
}
/**
* Remove a given set of notices.
*
* An array of notice names or a regular expression string can be passed, in the later case
* all the notices whose name matches the regular expression will be removed.
*
* @param array|string $names_array_or_regex An array of notice names, or a string representing a regular expression.
* @param bool $force_save Force saving inside this method instead of at the 'shutdown'.
* @return void
*/
public static function remove_notices( $names_array_or_regex, $force_save = false ) {
if ( ! is_array( $names_array_or_regex ) ) {
$names_array_or_regex = array_filter( self::get_notices(), fn( $notice_name ) => 1 === preg_match( $names_array_or_regex, $notice_name ) );
}
self::set_notices( array_diff( self::get_notices(), $names_array_or_regex ) );
if ( $force_save ) {
// Adding early save to prevent more race conditions with notices.
self::store_notices();
}
}
/**
* See if a notice is being shown.
*
@@ -244,12 +307,12 @@ class WC_Admin_Notices {
* Hide a notice if the GET variable is set.
*/
public static function hide_notices() {
if ( isset( $_GET['wc-hide-notice'] ) && isset( $_GET['_wc_notice_nonce'] ) ) { // WPCS: input var ok, CSRF ok.
if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wc_notice_nonce'] ) ), 'woocommerce_hide_notices_nonce' ) ) { // WPCS: input var ok, CSRF ok.
if ( isset( $_GET['wc-hide-notice'] ) && isset( $_GET['_wc_notice_nonce'] ) ) {
if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wc_notice_nonce'] ) ), 'woocommerce_hide_notices_nonce' ) ) {
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
}
$notice_name = sanitize_text_field( wp_unslash( $_GET['wc-hide-notice'] ) ); // WPCS: input var ok, CSRF ok.
$notice_name = sanitize_text_field( wp_unslash( $_GET['wc-hide-notice'] ) );
/**
* Filter the capability required to dismiss a given notice.
@@ -356,7 +419,7 @@ class WC_Admin_Notices {
$notice_html = get_option( 'woocommerce_admin_notice_' . $notice );
if ( $notice_html ) {
include dirname( __FILE__ ) . '/views/html-notice-custom.php';
include __DIR__ . '/views/html-notice-custom.php';
}
}
}
@@ -376,13 +439,14 @@ class WC_Admin_Notices {
if ( WC_Install::needs_db_update() ) {
$next_scheduled_date = WC()->queue()->get_next( 'woocommerce_run_update_callback', null, 'woocommerce-db-updates' );
if ( $next_scheduled_date || ! empty( $_GET['do_update_woocommerce'] ) ) { // WPCS: input var ok, CSRF ok.
include dirname( __FILE__ ) . '/views/html-notice-updating.php';
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( $next_scheduled_date || ! empty( $_GET['do_update_woocommerce'] ) ) {
include __DIR__ . '/views/html-notice-updating.php';
} else {
include dirname( __FILE__ ) . '/views/html-notice-update.php';
include __DIR__ . '/views/html-notice-update.php';
}
} else {
include dirname( __FILE__ ) . '/views/html-notice-updated.php';
include __DIR__ . '/views/html-notice-updated.php';
}
}
@@ -427,7 +491,7 @@ class WC_Admin_Notices {
}
if ( $outdated ) {
include dirname( __FILE__ ) . '/views/html-notice-template-check.php';
include __DIR__ . '/views/html-notice-template-check.php';
} else {
self::remove_notice( 'template_files' );
}
@@ -450,7 +514,7 @@ class WC_Admin_Notices {
}
if ( $enabled ) {
include dirname( __FILE__ ) . '/views/html-notice-legacy-shipping.php';
include __DIR__ . '/views/html-notice-legacy-shipping.php';
} else {
self::remove_notice( 'template_files' );
}
@@ -460,12 +524,13 @@ class WC_Admin_Notices {
* No shipping methods.
*/
public static function no_shipping_methods_notice() {
if ( wc_shipping_enabled() && ( empty( $_GET['page'] ) || empty( $_GET['tab'] ) || 'wc-settings' !== $_GET['page'] || 'shipping' !== $_GET['tab'] ) ) { // WPCS: input var ok, CSRF ok.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( wc_shipping_enabled() && ( empty( $_GET['page'] ) || empty( $_GET['tab'] ) || 'wc-settings' !== $_GET['page'] || 'shipping' !== $_GET['tab'] ) ) {
$product_count = wp_count_posts( 'product' );
$method_count = wc_get_shipping_method_count();
if ( $product_count->publish > 0 && 0 === $method_count ) {
include dirname( __FILE__ ) . '/views/html-notice-no-shipping-methods.php';
include __DIR__ . '/views/html-notice-no-shipping-methods.php';
}
if ( $method_count > 0 ) {
@@ -478,7 +543,7 @@ class WC_Admin_Notices {
* Notice shown when regenerating thumbnails background process is running.
*/
public static function regenerating_thumbnails_notice() {
include dirname( __FILE__ ) . '/views/html-notice-regenerating-thumbnails.php';
include __DIR__ . '/views/html-notice-regenerating-thumbnails.php';
}
/**
@@ -489,7 +554,7 @@ class WC_Admin_Notices {
return;
}
include dirname( __FILE__ ) . '/views/html-notice-secure-connection.php';
include __DIR__ . '/views/html-notice-secure-connection.php';
}
/**
@@ -504,7 +569,7 @@ class WC_Admin_Notices {
return;
}
include dirname( __FILE__ ) . '/views/html-notice-regenerating-lookup-table.php';
include __DIR__ . '/views/html-notice-regenerating-lookup-table.php';
}
/**
@@ -591,7 +656,7 @@ class WC_Admin_Notices {
return;
}
include dirname( __FILE__ ) . '/views/html-notice-maxmind-license-key.php';
include __DIR__ . '/views/html-notice-maxmind-license-key.php';
}
/**
@@ -605,7 +670,7 @@ class WC_Admin_Notices {
return;
}
include dirname( __FILE__ ) . '/views/html-notice-redirect-only-download.php';
include __DIR__ . '/views/html-notice-redirect-only-download.php';
}
/**
@@ -619,7 +684,7 @@ class WC_Admin_Notices {
return;
}
include dirname( __FILE__ ) . '/views/html-notice-uploads-directory-is-unprotected.php';
include __DIR__ . '/views/html-notice-uploads-directory-is-unprotected.php';
}
/**
@@ -634,7 +699,7 @@ class WC_Admin_Notices {
self::remove_notice( 'base_tables_missing' );
}
include dirname( __FILE__ ) . '/views/html-notice-base-table-missing.php';
include __DIR__ . '/views/html-notice-base-table-missing.php';
}
/**

View File

@@ -782,7 +782,7 @@ class WC_Admin_Post_Types {
if ( $post && absint( $post->ID ) === $shop_page_id ) {
echo '<div class="notice notice-info">';
/* translators: %s: URL to read more about the shop page. */
echo '<p>' . sprintf( wp_kses_post( __( 'This is the WooCommerce shop page. The shop page is a special archive that lists your products. <a href="%s">You can read more about this here</a>.', 'woocommerce' ) ), 'https://woo.com/document/woocommerce-pages/#section-4' ) . '</p>';
echo '<p>' . sprintf( wp_kses_post( __( 'This is the WooCommerce shop page. The shop page is a special archive that lists your products. <a href="%s">You can read more about this here</a>.', 'woocommerce' ) ), 'https://woocommerce.com/document/woocommerce-pages/#section-4' ) . '</p>';
echo '</div>';
}
}

View File

@@ -57,6 +57,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
$settings[] = include __DIR__ . '/settings/class-wc-settings-accounts.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-emails.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-integrations.php';
if ( \Automattic\WooCommerce\Admin\Features\Features::is_enabled( 'launch-your-store' ) ) {
$settings[] = include __DIR__ . '/settings/class-wc-settings-site-visibility.php';
}
$settings[] = include __DIR__ . '/settings/class-wc-settings-advanced.php';
self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings );
@@ -764,6 +767,15 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
<?php
break;
case 'slotfill_placeholder':
?>
<div
id="<?php echo esc_attr( $value['id'] ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>"
>
</div>
<?php
break;
// Default: run an action.
default:
do_action( 'woocommerce_admin_field_' . $value['type'], $value );

View File

@@ -350,7 +350,7 @@ class WC_Admin_Setup_Wizard {
<?php do_action( 'admin_head' ); ?>
</head>
<body class="wc-setup wp-core-ui <?php echo esc_attr( 'wc-setup-step__' . $this->step ); ?> <?php echo esc_attr( $wp_version_class ); ?>">
<h1 class="wc-logo"><a href="https://woo.com/"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/woocommerce_logo.png" alt="<?php esc_attr_e( 'WooCommerce', 'woocommerce' ); ?>" /></a></h1>
<h1 class="wc-logo"><a href="https://woocommerce.com/"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/woocommerce_logo.png" alt="<?php esc_attr_e( 'WooCommerce', 'woocommerce' ); ?>" /></a></h1>
<?php
}
@@ -443,7 +443,7 @@ class WC_Admin_Setup_Wizard {
?>
<div class="wc-setup-step__new_onboarding-wrapper">
<p class="wc-setup-step__new_onboarding-welcome"><?php esc_html_e( 'Welcome to', 'woocommerce' ); ?></p>
<h1 class="wc-logo"><a href="https://woo.com/"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/woocommerce_logo.png" alt="<?php esc_attr_e( 'WooCommerce', 'woocommerce' ); ?>" /></a></h1>
<h1 class="wc-logo"><a href="https://woocommerce.com/"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/woocommerce_logo.png" alt="<?php esc_attr_e( 'WooCommerce', 'woocommerce' ); ?>" /></a></h1>
<p><?php esc_html_e( 'Get your store up and running more quickly with our new and improved setup experience', 'woocommerce' ); ?></p>
<form method="post" class="activate-new-onboarding">
@@ -630,7 +630,7 @@ class WC_Admin_Setup_Wizard {
),
)
),
'https://woo.com/usage-tracking/'
'https://woocommerce.com/usage-tracking/'
);
?>
</p>
@@ -1114,7 +1114,7 @@ class WC_Admin_Setup_Wizard {
)
),
esc_attr__( 'A live rate is the exact cost to ship an order, quoted directly from the shipping carrier.', 'woocommerce' ),
'https://woo.com/product-category/woocommerce-extensions/shipping-methods/shipping-carriers/'
'https://woocommerce.com/product-category/woocommerce-extensions/shipping-methods/shipping-carriers/'
);
?>
</p>
@@ -1377,27 +1377,27 @@ class WC_Admin_Setup_Wizard {
$stripe_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Accept debit and credit cards in 135+ currencies, methods such as Alipay, and one-touch checkout with Apple Pay. <a href="%s" target="_blank">Learn more</a>.', 'woocommerce' ),
'https://woo.com/products/stripe/'
'https://woocommerce.com/products/stripe/'
) . '</p>';
$paypal_checkout_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Safe and secure payments using credit cards or your customer\'s PayPal account. <a href="%s" target="_blank">Learn more</a>.', 'woocommerce' ),
'https://woo.com/products/woocommerce-gateway-paypal-checkout/'
'https://woocommerce.com/products/woocommerce-gateway-paypal-checkout/'
) . '</p>';
$klarna_checkout_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Full checkout experience with pay now, pay later and slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
'https://woo.com/products/klarna-checkout/'
'https://woocommerce.com/products/klarna-checkout/'
) . '</p>';
$klarna_payments_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
'https://woo.com/products/klarna-payments/ '
'https://woocommerce.com/products/klarna-payments/ '
) . '</p>';
$square_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place. <a href="%s" target="_blank">Learn more about Square</a>.', 'woocommerce' ),
'https://woo.com/products/square/'
'https://woocommerce.com/products/square/'
) . '</p>';
return array(
@@ -1893,7 +1893,7 @@ class WC_Admin_Setup_Wizard {
'description' => sprintf(
/* translators: %s: theme name. */
__(
'Design your store with deep WooCommerce integration. If toggled on, well install <a href="https://woo.com/storefront/" target="_blank" rel="noopener noreferrer">Storefront</a>, and your current theme <em>%s</em> will be deactivated.',
'Design your store with deep WooCommerce integration. If toggled on, well install <a href="https://woocommerce.com/storefront/" target="_blank" rel="noopener noreferrer">Storefront</a>, and your current theme <em>%s</em> will be deactivated.',
'woocommerce'
),
$theme_name
@@ -2221,10 +2221,10 @@ class WC_Admin_Setup_Wizard {
WC_Admin_Notices::remove_notice( 'install', true );
$user_email = $this->get_current_user_email();
$docs_url = 'https://woo.com/documentation/plugins/woocommerce/getting-started/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin';
$docs_url = 'https://woocommerce.com/documentation/plugins/woocommerce/getting-started/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin';
$help_text = sprintf(
/* translators: %1$s: link to docs */
__( 'Visit Woo.com to learn more about <a href="%1$s" target="_blank">getting started</a>.', 'woocommerce' ),
__( 'Visit WooCommerce.com to learn more about <a href="%1$s" target="_blank">getting started</a>.', 'woocommerce' ),
$docs_url
);
?>

View File

@@ -39,9 +39,6 @@ class WC_Admin {
if ( isset( $_GET['page'] ) && 'wc-addons' === $_GET['page'] ) {
add_filter( 'admin_body_class', array( 'WC_Admin_Addons', 'filter_admin_body_classes' ) );
}
// Fetch list of promotions from Woo.com for WooCommerce admin UI. We need to fire earlier than admin_init so we can filter menu items.
add_action( 'woocommerce_init', array( 'WC_Admin_Marketplace_Promotions', 'init_marketplace_promotions' ) );
}
/**
@@ -80,9 +77,6 @@ class WC_Admin {
// Marketplace suggestions & related REST API.
include_once __DIR__ . '/marketplace-suggestions/class-wc-marketplace-suggestions.php';
include_once __DIR__ . '/marketplace-suggestions/class-wc-marketplace-updater.php';
// Marketplace promotions.
include_once __DIR__ . '/class-wc-admin-marketplace-promotions.php';
}
/**

View File

@@ -5,6 +5,8 @@
* @package WooCommerce\Admin\Helper
*/
use Automattic\WooCommerce\Internal\Admin\Marketplace;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -14,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* The main entry-point for all things related to the Helper.
* The Helper manages the connection between the store and
* an account on Woo.com.
* an account on WooCommerce.com.
*/
class WC_Helper_Admin {
@@ -48,21 +50,29 @@ class WC_Helper_Admin {
$installed_products
);
$woo_connect_notice_type = WC_Helper_Updater::get_woo_connect_notice_type();
$settings['wccomHelper'] = array(
'isConnected' => WC_Helper::is_site_connected(),
'connectURL' => self::get_connection_url(),
'userEmail' => $auth_user_email,
'userAvatar' => get_avatar_url( $auth_user_email, array( 'size' => '48' ) ),
'storeCountry' => wc_get_base_location()['country'],
'inAppPurchaseURLParams' => WC_Admin_Addons::get_in_app_purchase_url_params(),
'installedProducts' => $installed_products,
'isConnected' => WC_Helper::is_site_connected(),
'connectURL' => self::get_connection_url(),
'userEmail' => $auth_user_email,
'userAvatar' => get_avatar_url( $auth_user_email, array( 'size' => '48' ) ),
'storeCountry' => wc_get_base_location()['country'],
'inAppPurchaseURLParams' => WC_Admin_Addons::get_in_app_purchase_url_params(),
'installedProducts' => $installed_products,
'wooUpdateManagerInstalled' => WC_Woo_Update_Manager_Plugin::is_plugin_installed(),
'wooUpdateManagerActive' => WC_Woo_Update_Manager_Plugin::is_plugin_active(),
'wooUpdateManagerInstallUrl' => WC_Woo_Update_Manager_Plugin::generate_install_url(),
'wooUpdateManagerPluginSlug' => WC_Woo_Update_Manager_Plugin::WOO_UPDATE_MANAGER_SLUG,
'wooUpdateCount' => WC_Helper_Updater::get_updates_count_based_on_site_status(),
'woocomConnectNoticeType' => $woo_connect_notice_type,
);
return $settings;
}
/**
* Generates the URL for connecting or disconnecting the store to/from Woo.com.
* Generates the URL for connecting or disconnecting the store to/from WooCommerce.com.
* Approach taken from existing helper code that isn't exposed.
*
* @return string
@@ -116,7 +126,7 @@ class WC_Helper_Admin {
}
/**
* Fetch featured products from Woo.com and serve them
* Fetch featured products from WooCommerce.com and serve them
* as JSON.
*/
public static function get_featured() {

View File

@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* WC_Helper_API Class
*
* Provides a communication interface with the Woo.com Helper API.
* Provides a communication interface with the WooCommerce.com Helper API.
*/
class WC_Helper_API {
/**
@@ -67,6 +67,61 @@ class WC_Helper_API {
return wp_safe_remote_request( $url, $args );
}
/**
* Create signature for a request.
*
* @param string $access_token_secret The access token secret.
* @param string $url The URL to add the access token and signature to.
* @param string $method The request method.
* @param array $body The body of the request.
* @return string The signature.
*/
private static function create_request_signature( string $access_token_secret, string $url, string $method, $body = null ): string {
$request_uri = wp_parse_url( $url, PHP_URL_PATH );
$query_string = wp_parse_url( $url, PHP_URL_QUERY );
if ( is_string( $query_string ) ) {
$request_uri .= '?' . $query_string;
}
$data = array(
'host' => wp_parse_url( $url, PHP_URL_HOST ),
'request_uri' => $request_uri,
'method' => $method,
);
if ( ! empty( $body ) ) {
$data['body'] = $body;
}
return hash_hmac( 'sha256', wp_json_encode( $data ), $access_token_secret );
}
/**
* Add the access token and signature to the provided URL.
*
* @param string $url The URL to add the access token and signature to.
* @return string
*/
public static function add_auth_parameters( string $url ): string {
$auth = WC_Helper_Options::get( 'auth' );
if ( empty( $auth['access_token'] ) || empty( $auth['access_token_secret'] ) ) {
return false;
}
$signature = self::create_request_signature( (string) $auth['access_token_secret'], $url, 'GET' );
return add_query_arg(
array(
'token' => $auth['access_token'],
'signature' => $signature,
),
$url
);
}
/**
* Adds authentication headers to an HTTP request.
*
@@ -81,24 +136,13 @@ class WC_Helper_API {
return false;
}
$request_uri = parse_url( $url, PHP_URL_PATH );
$query_string = parse_url( $url, PHP_URL_QUERY );
if ( is_string( $query_string ) ) {
$request_uri .= '?' . $query_string;
}
$data = array(
'host' => parse_url( $url, PHP_URL_HOST ),
'request_uri' => $request_uri,
'method' => ! empty( $args['method'] ) ? $args['method'] : 'GET',
$signature = self::create_request_signature(
(string) $auth['access_token_secret'],
$url,
! empty( $args['method'] ) ? $args['method'] : 'GET',
$args['body'] ?? null
);
if ( ! empty( $args['body'] ) ) {
$data['body'] = $args['body'];
}
$signature = hash_hmac( 'sha256', json_encode( $data ), $auth['access_token_secret'] );
if ( empty( $args['headers'] ) ) {
$args['headers'] = array();
}

View File

@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* WC_Helper_Orders_API
*
* Pings Woo.com to create an order and pull in the necessary data to start the installation process.
* Pings WooCommerce.com to create an order and pull in the necessary data to start the installation process.
*/
class WC_Helper_Orders_API {
/**
@@ -59,7 +59,7 @@ class WC_Helper_Orders_API {
}
/**
* Core function to create an order on Woo.com. Pings the API and catches the exceptions if any.
* Core function to create an order on WooCommerce.com. Pings the API and catches the exceptions if any.
*
* @param WP_REST_Request $request Request object.
*

View File

@@ -300,7 +300,10 @@ class WC_Helper_Subscriptions_API {
);
}
$install_url = WC_Helper::get_subscription_install_url( $subscription['product_key'] );
$install_url = WC_Helper::get_subscription_install_url(
$subscription['product_key'],
$subscription['product_slug']
);
if ( ! $install_url ) {
wp_send_json_error(

View File

@@ -1,6 +1,6 @@
<?php
/**
* The update helper for Woo.com plugins.
* The update helper for WooCommerce.com plugins.
*
* @class WC_Helper_Updater
* @package WooCommerce\Admin\Helper
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* WC_Helper_Updater Class
*
* Contains the logic to fetch available updates and hook into Core's update
* routines to serve Woo.com-provided packages.
* routines to serve WooCommerce.com-provided packages.
*/
class WC_Helper_Updater {
@@ -26,6 +26,16 @@ class WC_Helper_Updater {
add_action( 'pre_set_site_transient_update_themes', array( __CLASS__, 'transient_update_themes' ), 21, 1 );
add_action( 'upgrader_process_complete', array( __CLASS__, 'upgrader_process_complete' ) );
add_action( 'upgrader_pre_download', array( __CLASS__, 'block_expired_updates' ), 10, 2 );
add_action( 'plugins_loaded', array( __CLASS__, 'add_hook_for_modifying_update_notices' ) );
}
/**
* Add the hook for modifying default WPCore update notices on the plugins management page.
*/
public static function add_hook_for_modifying_update_notices() {
if ( ! WC_Woo_Update_Manager_Plugin::is_plugin_active() || ! WC_Helper::is_site_connected() ) {
add_action( 'load-plugins.php', array( __CLASS__, 'setup_update_plugins_messages' ), 11 );
}
}
/**
@@ -53,21 +63,25 @@ class WC_Helper_Updater {
'plugin' => $filename,
'new_version' => $data['version'],
'url' => $data['url'],
'package' => $data['package'],
'package' => '',
'upgrade_notice' => $data['upgrade_notice'],
);
/**
* Filters the Woo plugin data before saving it in transient used for updates.
*
* @since 8.7.0
*
* @param array $item Plugin item to modify.
* @param array $data Subscription data fetched from Helper API for the plugin.
* @param int $product_id Woo product id assigned to the plugin.
*/
$item = apply_filters( 'update_woo_com_subscription_details', $item, $data, $plugin['_product_id'] );
if ( isset( $data['requires_php'] ) ) {
$item['requires_php'] = $data['requires_php'];
}
// We don't want to deliver a valid upgrade package when their subscription has expired.
// To avoid the generic "no_package" error that empty strings give, we will store an
// indication of expiration for the `upgrader_pre_download` filter to error on.
if ( ! self::_has_active_subscription( $plugin['_product_id'] ) ) {
$item['package'] = 'woocommerce-com-expired-' . $plugin['_product_id'];
}
if ( $transient instanceof stdClass ) {
if ( version_compare( $plugin['Version'], $data['version'], '<' ) ) {
$transient->response[ $filename ] = (object) $item;
@@ -89,7 +103,7 @@ class WC_Helper_Updater {
/**
* Runs on pre_set_site_transient_update_themes, provides custom
* packages for Woo.com-hosted extensions.
* packages for WooCommerce.com-hosted extensions.
*
* @param object $transient The update_themes transient object.
*
@@ -113,9 +127,16 @@ class WC_Helper_Updater {
'package' => '',
);
if ( self::_has_active_subscription( $theme['_product_id'] ) ) {
$item['package'] = $data['package'];
}
/**
* Filters the Woo plugin data before saving it in transient used for updates.
*
* @since 8.7.0
*
* @param array $item Plugin item to modify.
* @param array $data Subscription data fetched from Helper API for the plugin.
* @param int $product_id Woo product id assigned to the plugin.
*/
$item = apply_filters( 'update_woo_com_subscription_details', $item, $data, $theme['_product_id'] );
if ( version_compare( $theme['Version'], $data['version'], '<' ) ) {
$transient->response[ $slug ] = $item;
@@ -128,6 +149,88 @@ class WC_Helper_Updater {
return $transient;
}
/**
* Runs on load-plugins.php, adds a hook to show a custom plugin update message for WooCommerce.com hosted plugins.
*
* @return void.
*/
public static function setup_update_plugins_messages() {
$is_site_connected = WC_Helper::is_site_connected();
foreach ( WC_Helper::get_local_woo_plugins() as $plugin ) {
$filename = $plugin['_filename'];
if ( $is_site_connected ) {
add_action( 'in_plugin_update_message-' . $filename, array( __CLASS__, 'add_install_marketplace_plugin_message' ), 10, 2 );
} else {
add_action( 'in_plugin_update_message-' . $filename, array( __CLASS__, 'add_connect_woocom_plugin_message' ) );
}
}
}
/**
* Runs on in_plugin_update_message-{file-name}, show a message to connect to woocommerce.com for unconnected stores
*
* @return void.
*/
public static function add_connect_woocom_plugin_message() {
$connect_page_url = add_query_arg(
array(
'page' => 'wc-admin',
'tab' => 'my-subscriptions',
'path' => rawurlencode( '/extensions' ),
),
admin_url( 'admin.php' )
);
printf(
wp_kses(
/* translators: 1: Woo Update Manager plugin install URL */
__( ' <a href="%1$s" class="woocommerce-connect-your-store">Connect your store</a> to woocommerce.com to update.', 'woocommerce' ),
array(
'a' => array(
'href' => array(),
'class' => array(),
),
)
),
esc_url( $connect_page_url ),
);
}
/**
* Runs on in_plugin_update_message-{file-name}, show a message to install the Woo Marketplace plugin, on plugin update notification,
* if the Woo Marketplace plugin isn't already installed.
*
* @param object $plugin_data TAn array of plugin metadata.
* @param object $response An object of metadata about the available plugin update.
*
* @return void.
*/
public static function add_install_marketplace_plugin_message( $plugin_data, $response ) {
if ( ! empty( $response->package ) || WC_Woo_Update_Manager_Plugin::is_plugin_active() ) {
return;
}
if ( ! WC_Woo_Update_Manager_Plugin::is_plugin_installed() ) {
printf(
wp_kses(
/* translators: 1: Woo Update Manager plugin install URL */
__( ' <a href="%1$s">Install WooCommerce.com Update Manager</a> to update.', 'woocommerce' ),
array(
'a' => array(
'href' => array(),
),
)
),
esc_url( WC_Woo_Update_Manager_Plugin::generate_install_url() ),
);
return;
}
if ( ! WC_Woo_Update_Manager_Plugin::is_plugin_active() ) {
echo esc_html_e( ' Activate WooCommerce.com Update Manager to update.', 'woocommerce' );
}
}
/**
* Get update data for all plugins.
*
@@ -236,15 +339,20 @@ class WC_Helper_Updater {
}
// Scan local plugins which may or may not have a subscription.
$plugins = WC_Helper::get_local_woo_plugins();
$active_woo_plugins = array_intersect( array_keys( $plugins ), get_option( 'active_plugins', array() ) );
$plugins = WC_Helper::get_local_woo_plugins();
$active_woo_plugins = array_intersect( array_keys( $plugins ), get_option( 'active_plugins', array() ) );
/*
* Use only plugins that are subscribed to the automatic translations updates.
*/
$active_for_translations = array_filter(
$active_woo_plugins,
function( $plugin ) use ( $plugins ) {
function ( $plugin ) use ( $plugins ) {
/**
* Filters the plugins that are subscribed to the automatic translations updates.
*
* @since 3.7.0
*/
return apply_filters( 'woocommerce_translations_updates_for_' . $plugins[ $plugin ]['slug'], false );
}
);
@@ -267,16 +375,16 @@ class WC_Helper_Updater {
);
foreach ( $active_for_translations as $active_plugin ) {
$plugin = $plugins[ $active_plugin ];
$plugin = $plugins[ $active_plugin ];
$request_body['plugins'][ $plugin['slug'] ] = array( 'version' => $plugin['Version'] );
}
$raw_response = wp_remote_post(
'https://translate.wordpress.com/api/translations-updates/woocommerce',
array(
'body' => json_encode( $request_body ),
'headers' => array( 'Content-Type: application/json' ),
'timeout' => $timeout,
'body' => wp_json_encode( $request_body ),
'headers' => array( 'Content-Type: application/json' ),
'timeout' => $timeout,
)
);
@@ -349,13 +457,22 @@ class WC_Helper_Updater {
'errors' => array(),
);
$request = WC_Helper_API::post(
'update-check',
array(
'body' => wp_json_encode( array( 'products' => $payload ) ),
'authenticated' => true,
)
);
if ( WC_Helper::is_site_connected() ) {
$request = WC_Helper_API::post(
'update-check',
array(
'body' => wp_json_encode( array( 'products' => $payload ) ),
'authenticated' => true,
)
);
} else {
$request = WC_Helper_API::post(
'update-check-public',
array(
'body' => wp_json_encode( array( 'products' => $payload ) ),
)
);
}
if ( wp_remote_retrieve_response_code( $request ) !== 200 ) {
$data['errors'][] = 'http-error';
@@ -367,44 +484,6 @@ class WC_Helper_Updater {
return $data['products'];
}
/**
* Check for an active subscription.
*
* Checks a given product id against all subscriptions on
* the current site. Returns true if at least one active
* subscription is found.
*
* @param int $product_id The product id to look for.
*
* @return bool True if active subscription found.
*/
private static function _has_active_subscription( $product_id ) {
if ( ! isset( $auth ) ) {
$auth = WC_Helper_Options::get( 'auth' );
}
if ( ! isset( $subscriptions ) ) {
$subscriptions = WC_Helper::get_subscriptions();
}
if ( empty( $auth['site_id'] ) || empty( $subscriptions ) ) {
return false;
}
// Check for an active subscription.
foreach ( $subscriptions as $subscription ) {
if ( $subscription['product_id'] != $product_id ) {
continue;
}
if ( in_array( absint( $auth['site_id'] ), $subscription['connections'] ) ) {
return true;
}
}
return false;
}
/**
* Get the number of products that have updates.
*
@@ -441,7 +520,7 @@ class WC_Helper_Updater {
}
if ( version_compare( $plugin['Version'], $update_data[ $plugin['_product_id'] ]['version'], '<' ) ) {
$count++;
++$count;
}
}
@@ -452,26 +531,81 @@ class WC_Helper_Updater {
}
if ( version_compare( $theme['Version'], $update_data[ $theme['_product_id'] ]['version'], '<' ) ) {
$count++;
++$count;
}
}
set_transient( $cache_key, $count, 12 * HOUR_IN_SECONDS );
return $count;
}
/**
* Get the update count to based on the status of the site.
*
* @return int
*/
public static function get_updates_count_based_on_site_status() {
if ( ! WC_Helper::is_site_connected() ) {
return 0;
}
$count = self::get_updates_count() ?? 0;
if ( ! WC_Woo_Update_Manager_Plugin::is_plugin_installed() || ! WC_Woo_Update_Manager_Plugin::is_plugin_active() ) {
++$count;
}
return $count;
}
/**
* Get the type of woo connect notice to be shown in the WC Settings and Marketplace pages.
* - If a store is connected to woocommerce.com or has no installed woo plugins, return 'none'.
* - If a store has installed woo plugins but no updates, return 'short'.
* - If a store has an installed woo plugin with update, return 'long'.
*
* @return string The notice type, 'none', 'short', or 'long'.
*/
public static function get_woo_connect_notice_type() {
if ( WC_Helper::is_site_connected() ) {
return 'none';
}
$woo_plugins = WC_Helper::get_local_woo_plugins();
if ( empty( $woo_plugins ) ) {
return 'none';
}
$update_data = self::get_update_data();
if ( empty( $update_data ) ) {
return 'short';
}
// Scan local plugins.
foreach ( $woo_plugins as $plugin ) {
if ( empty( $update_data[ $plugin['_product_id'] ] ) ) {
continue;
}
if ( version_compare( $plugin['Version'], $update_data[ $plugin['_product_id'] ]['version'], '<' ) ) {
return 'long';
}
}
return 'short';
}
/**
* Return the updates count markup.
*
* @return string Updates count markup, empty string if no updates avairable.
*/
public static function get_updates_count_html() {
$count = self::get_updates_count();
if ( ! $count ) {
return '';
}
$count = self::get_updates_count_based_on_site_status();
$count_html = sprintf( '<span class="update-plugins count-%d"><span class="update-count">%d</span></span>', $count, number_format_i18n( $count ) );
return $count_html;
}
@@ -516,7 +650,7 @@ class WC_Helper_Updater {
return new WP_Error(
'woocommerce_subscription_expired',
sprintf(
// translators: %s: URL of Woo.com subscriptions tab.
// translators: %s: URL of WooCommerce.com subscriptions tab.
__( 'Please visit the <a href="%s" target="_blank">subscriptions page</a> and renew to continue receiving updates.', 'woocommerce' ),
esc_url( admin_url( 'admin.php?page=wc-addons&section=helper' ) )
)

View File

@@ -54,14 +54,15 @@ class WC_Helper {
* Include supporting helper classes.
*/
protected static function includes() {
include_once dirname( __FILE__ ) . '/class-wc-helper-options.php';
include_once dirname( __FILE__ ) . '/class-wc-helper-api.php';
include_once dirname( __FILE__ ) . '/class-wc-helper-updater.php';
include_once dirname( __FILE__ ) . '/class-wc-helper-plugin-info.php';
include_once dirname( __FILE__ ) . '/class-wc-helper-compat.php';
include_once dirname( __FILE__ ) . '/class-wc-helper-admin.php';
include_once dirname( __FILE__ ) . '/class-wc-helper-subscriptions-api.php';
include_once dirname( __FILE__ ) . '/class-wc-helper-orders-api.php';
include_once __DIR__ . '/class-wc-helper-options.php';
include_once __DIR__ . '/class-wc-helper-api.php';
include_once __DIR__ . '/class-wc-woo-update-manager-plugin.php';
include_once __DIR__ . '/class-wc-helper-updater.php';
include_once __DIR__ . '/class-wc-plugin-api-updater.php';
include_once __DIR__ . '/class-wc-helper-compat.php';
include_once __DIR__ . '/class-wc-helper-admin.php';
include_once __DIR__ . '/class-wc-helper-subscriptions-api.php';
include_once __DIR__ . '/class-wc-helper-orders-api.php';
}
/**
@@ -169,7 +170,7 @@ class WC_Helper {
}
$subscription['download_primary'] = true;
$subscription['download_url'] = 'https://woo.com/my-account/downloads/';
$subscription['download_url'] = 'https://woocommerce.com/my-account/downloads/';
if ( ! $subscription['local']['installed'] && ! empty( $updates[ $subscription['product_id'] ] ) ) {
$subscription['download_url'] = $updates[ $subscription['product_id'] ]['package'];
}
@@ -225,7 +226,7 @@ class WC_Helper {
'message' => sprintf( __( 'This subscription has expired. Please <strong>renew</strong> to receive updates and support.', 'woocommerce' ) ),
'button_label' => __( 'Renew', 'woocommerce' ),
'button_url' => self::add_utm_params_to_url_for_subscription_link(
'https://woo.com/my-account/my-subscriptions/',
'https://woocommerce.com/my-account/my-subscriptions/',
'renew'
),
'status' => 'expired',
@@ -240,7 +241,7 @@ class WC_Helper {
'message' => __( 'Subscription is <strong>expiring</strong> soon.', 'woocommerce' ),
'button_label' => __( 'Enable auto-renew', 'woocommerce' ),
'button_url' => self::add_utm_params_to_url_for_subscription_link(
'https://woo.com/my-account/my-subscriptions/',
'https://woocommerce.com/my-account/my-subscriptions/',
'auto-renew'
),
'status' => 'expired',
@@ -254,7 +255,7 @@ class WC_Helper {
'message' => sprintf( __( 'This subscription is expiring soon. Please <strong>renew</strong> to continue receiving updates and support.', 'woocommerce' ) ),
'button_label' => __( 'Renew', 'woocommerce' ),
'button_url' => self::add_utm_params_to_url_for_subscription_link(
'https://woo.com/my-account/my-subscriptions/',
'https://woocommerce.com/my-account/my-subscriptions/',
'renew'
),
'status' => 'expired',
@@ -316,7 +317,7 @@ class WC_Helper {
} else {
$action = array(
/* translators: 1: subscriptions docs 2: subscriptions docs */
'message' => sprintf( __( 'To receive updates and support for this extension, you need to <strong>purchase</strong> a new subscription or consolidate your extensions to one connected account by <strong><a href="%1$s" title="Sharing Docs">sharing</a> or <a href="%2$s" title="Transferring Docs">transferring</a></strong> this extension to this connected account.', 'woocommerce' ), 'https://woo.com/document/managing-woocommerce-com-subscriptions/#section-10', 'https://woo.com/document/managing-woocommerce-com-subscriptions/#section-5' ),
'message' => sprintf( __( 'To receive updates and support for this extension, you need to <strong>purchase</strong> a new subscription or consolidate your extensions to one connected account by <strong><a href="%1$s" title="Sharing Docs">sharing</a> or <a href="%2$s" title="Transferring Docs">transferring</a></strong> this extension to this connected account.', 'woocommerce' ), 'https://woocommerce.com/document/managing-woocommerce-com-subscriptions/#section-10', 'https://woocommerce.com/document/managing-woocommerce-com-subscriptions/#section-5' ),
'button_label' => __( 'Purchase', 'woocommerce' ),
'button_url' => self::add_utm_params_to_url_for_subscription_link(
$data['_product_url'],
@@ -354,7 +355,7 @@ class WC_Helper {
/**
* Add tracking parameters to buttons (Renew, Purchase, etc.) on subscriptions page
*
* @param string $url URL to product page or to https://woo.com/my-account/my-subscriptions/.
* @param string $url URL to product page or to https://woocommerce.com/my-account/my-subscriptions/.
* @param string $utm_content value of utm_content query parameter used for tracking
*
* @return string URL including utm parameters for tracking
@@ -615,14 +616,14 @@ class WC_Helper {
case 'helper-connected':
$notices[] = array(
'message' => __( 'You have successfully connected your store to Woo.com', 'woocommerce' ),
'message' => __( 'You have successfully connected your store to WooCommerce.com', 'woocommerce' ),
'type' => 'updated',
);
break;
case 'helper-disconnected':
$notices[] = array(
'message' => __( 'You have successfully disconnected your store from Woo.com', 'woocommerce' ),
'message' => __( 'You have successfully disconnected your store from WooCommerce.com', 'woocommerce' ),
'type' => 'updated',
);
break;
@@ -832,6 +833,7 @@ class WC_Helper {
)
)
: '',
'wum-installed' => WC_Woo_Update_Manager_Plugin::is_plugin_installed() ? '1' : '0',
),
WC_Helper_API::url( 'oauth/authorize' )
);
@@ -841,7 +843,7 @@ class WC_Helper {
}
/**
* Return from Woo.com OAuth flow.
* Return from WooCommerce.com OAuth flow.
*/
private static function _helper_auth_return() {
if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'connect' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
@@ -910,7 +912,7 @@ class WC_Helper {
WC_Tracker::send_tracking_data( true );
}
// If connecting through in-app purchase, redirects back to Woo.com
// If connecting through in-app purchase, redirects back to WooCommerce.com
// for product installation.
if ( ! empty( $_GET['wccom-install-url'] ) ) {
wp_redirect( wp_unslash( $_GET['wccom-install-url'] ) );
@@ -930,7 +932,7 @@ class WC_Helper {
}
/**
* Disconnect from Woo.com, clear OAuth tokens.
* Disconnect from WooCommerce.com, clear OAuth tokens.
*/
private static function _helper_auth_disconnect() {
if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'disconnect' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
@@ -1193,34 +1195,18 @@ class WC_Helper {
* Get a subscriptions install URL.
*
* @param string $product_key Subscription product key.
* @param string $product_slug Subscription product slug.
* @return string
*/
public static function get_subscription_install_url( $product_key ) {
$install_url_response = WC_Helper_API::post(
'install-url',
public static function get_subscription_install_url( $product_key, $product_slug ) {
$install_url = add_query_arg(
array(
'authenticated' => true,
'body' => wp_json_encode(
array(
'product_key' => $product_key,
'wc_version' => WC()->version,
)
),
)
'product-key' => rawurlencode( $product_key ),
),
self::get_install_base_url() . "{$product_slug}/"
);
$code = wp_remote_retrieve_response_code( $install_url_response );
if ( 200 !== $code ) {
self::log( sprintf( 'Install URL API call returned a non-200 response code (%d)', $code ) );
return '';
}
$body = json_decode( wp_remote_retrieve_body( $install_url_response ), true );
if ( empty( $body['data']['url'] ) ) {
self::log( sprintf( 'Install URL API call returned an invalid body: %s', wp_remote_retrieve_body( $install_url_response ) ) );
return '';
}
return $body['data']['url'];
return WC_Helper_API::add_auth_parameters( $install_url );
}
/**
@@ -1517,6 +1503,8 @@ class WC_Helper {
$source = 'inbox-notes';
elseif ( stripos( $request_uri, 'admin-ajax.php' ) ) :
$source = 'heartbeat-api';
elseif ( stripos( $request_uri, 'installer' ) ) :
$source = 'wccom-site-installer';
elseif ( defined( 'WP_CLI' ) && WP_CLI ) :
$source = 'wc-cli';
endif;
@@ -2257,6 +2245,22 @@ class WC_Helper {
self::_flush_subscriptions_cache();
self::_flush_updates_cache();
}
/**
* Get base URL for plugin auto installer.
*
* @return string
*/
public static function get_install_base_url() {
/**
* Filter the base URL used to install the Woo hosted plugins.
*
* @since 8.7.0
*/
$woo_com_base_url = apply_filters( 'woo_com_base_url', 'https://woocommerce.com/' );
return $woo_com_base_url . 'auto-install-init/';
}
}
WC_Helper::load();

View File

@@ -1,21 +1,17 @@
<?php
/**
* WooCommerce Admin Helper Plugin Info
* Updates the Product API response from WP.org.
*
* @class WC_Plugin_Api_Updater
* @package WooCommerce\Admin\Helper
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
defined( 'ABSPATH' ) || exit;
/**
* WC_Helper_Plugin_Info Class
*
* Provides the "View Information" core modals with data for Woo.com
* hosted extensions.
* Class WC_Plugin_Api_Updater
*/
class WC_Helper_Plugin_Info {
class WC_Plugin_Api_Updater {
/**
* Loads the class, runs on init.
@@ -38,7 +34,8 @@ class WC_Helper_Plugin_Info {
if ( 'plugin_information' !== $action ) {
return $response;
}
return self::maybe_override_products_api( $response, $action, $args );
return self::override_products_api_response( $response, $action, $args );
}
/**
@@ -52,7 +49,8 @@ class WC_Helper_Plugin_Info {
if ( 'theme_information' !== $action ) {
return $response;
}
return self::maybe_override_products_api( $response, $action, $args );
return self::override_products_api_response( $response, $action, $args );
}
/**
@@ -62,12 +60,12 @@ class WC_Helper_Plugin_Info {
* @param string $action The requested action.
* @param object $args Arguments passed to the API.
*/
public static function maybe_override_products_api( $response, $action, $args ) {
public static function override_products_api_response( $response, $action, $args ) {
if ( empty( $args->slug ) ) {
return $response;
}
// Only for slugs that start with woo-
// Only for slugs that start with woocommerce-com-.
if ( 0 !== strpos( $args->slug, 'woocommerce-com-' ) ) {
return $response;
}
@@ -105,4 +103,4 @@ class WC_Helper_Plugin_Info {
}
}
WC_Helper_Plugin_Info::load();
WC_Plugin_Api_Updater::load();

View File

@@ -0,0 +1,130 @@
<?php
/**
* A utility class for Woo Update Manager plugin.
*
* @class WC_Woo_Update_Manager_Plugin
* @package WooCommerce\Admin\Helper
*/
use Automattic\WooCommerce\Admin\PageController;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Helper_Plugin Class
*
* Contains the logic to manage the Woo Update Manager plugin.
*/
class WC_Woo_Update_Manager_Plugin {
const WOO_UPDATE_MANAGER_PLUGIN_MAIN_FILE = 'woo-update-manager/woo-update-manager.php';
const WOO_UPDATE_MANAGER_DOWNLOAD_URL = 'https://woocommerce.com/product-download/woo-update-manager';
const WOO_UPDATE_MANAGER_SLUG = 'woo-update-manager';
/**
* Loads the class, runs on init.
*
* @return void
*/
public static function load(): void {
add_action( 'admin_notices', array( __CLASS__, 'show_woo_update_manager_install_notice' ) );
}
/**
* Check if the Woo Update Manager plugin is active.
*
* @return bool
*/
public static function is_plugin_active(): bool {
return is_plugin_active_for_network( self::WOO_UPDATE_MANAGER_PLUGIN_MAIN_FILE ) || is_plugin_active( self::WOO_UPDATE_MANAGER_PLUGIN_MAIN_FILE );
}
/**
* Check if the Woo Update Manager plugin is installed.
*
* @return bool
*/
public static function is_plugin_installed(): bool {
return file_exists( WP_PLUGIN_DIR . '/' . self::WOO_UPDATE_MANAGER_PLUGIN_MAIN_FILE );
}
/**
* Generate the URL to install the Woo Update Manager plugin.
*
* @return string
*/
public static function generate_install_url(): string {
$install_url = WC_Helper::get_install_base_url() . self::WOO_UPDATE_MANAGER_SLUG . '/';
return WC_Helper_API::add_auth_parameters( $install_url );
}
/**
* Get the id of the Woo Update Manager plugin.
*
* @return int
*/
public static function get_plugin_slug(): string {
return self::WOO_UPDATE_MANAGER_SLUG;
}
/**
* Show a notice on the WC admin pages to install or activate the Woo Update Manager plugin.
*
* @return void
*/
public static function show_woo_update_manager_install_notice(): void {
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
if ( ! WC_Helper::is_site_connected() ) {
return;
}
if ( ! PageController::is_admin_or_embed_page() ) {
return;
}
if ( self::is_plugin_installed() && self::is_plugin_active() ) {
return;
}
if ( ! self::is_plugin_installed() ) {
if ( self::install_admin_notice_dismissed() ) {
return;
}
include __DIR__ . '/views/html-notice-woo-updater-not-installed.php';
return;
}
if ( self::activate_admin_notice_dismissed() ) {
return;
}
include __DIR__ . '/views/html-notice-woo-updater-not-activated.php';
}
/**
* Check if the installation notice has been dismissed.
*
* @return bool
*/
protected static function install_admin_notice_dismissed(): bool {
return get_user_meta( get_current_user_id(), 'dismissed_woo_updater_not_installed_notice', true );
}
/**
* Check if the activation notice has been dismissed.
*
* @return bool
*/
protected static function activate_admin_notice_dismissed(): bool {
return get_user_meta( get_current_user_id(), 'dismissed_woo_updater_not_activated_notice', true );
}
}
WC_Woo_Update_Manager_Plugin::load();

View File

@@ -21,9 +21,9 @@
<?php
printf(
wp_kses(
/* translators: Introduction to list of Woo.com extensions the merchant has subscriptions for. */
/* translators: Introduction to list of WooCommerce.com extensions the merchant has subscriptions for. */
__(
'Below is a list of extensions available on your Woo.com account. To receive extension updates please make sure the extension is installed, and its subscription activated and connected to your Woo.com account. Extensions can be activated from the <a href="%s">Plugins</a> screen.',
'Below is a list of extensions available on your WooCommerce.com account. To receive extension updates please make sure the extension is installed, and its subscription activated and connected to your WooCommerce.com account. Extensions can be activated from the <a href="%s">Plugins</a> screen.',
'woocommerce'
),
array(
@@ -135,7 +135,7 @@
</td>
<td class="wp-list-table__ext-actions">
<?php if ( ! $subscription['active'] && $subscription['maxed'] ) : ?>
<a class="button" href="https://woo.com/my-account/my-subscriptions/" target="_blank"><?php esc_html_e( 'Upgrade', 'woocommerce' ); ?></a>
<a class="button" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php esc_html_e( 'Upgrade', 'woocommerce' ); ?></a>
<?php elseif ( ! $subscription['local']['installed'] && ! $subscription['expired'] ) : ?>
<a class="button <?php echo empty( $subscription['download_primary'] ) ? 'button-secondary' : ''; ?>" href="<?php echo esc_url( $subscription['download_url'] ); ?>" target="_blank"><?php esc_html_e( 'Download', 'woocommerce' ); ?></a>
<?php elseif ( $subscription['active'] ) : ?>
@@ -190,7 +190,7 @@
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="3"><em><?php esc_html_e( 'Could not find any subscriptions on your Woo.com account', 'woocommerce' ); ?></td>
<td colspan="3"><em><?php esc_html_e( 'Could not find any subscriptions on your WooCommerce.com account', 'woocommerce' ); ?></td>
</tr>
<?php endif; ?>
</tbody>
@@ -198,7 +198,7 @@
<?php if ( ! empty( $no_subscriptions ) ) : ?>
<h2><?php esc_html_e( 'Installed Extensions without a Subscription', 'woocommerce' ); ?></h2>
<p>Below is a list of Woo.com products available on your site - but are either out-dated or do not have a valid subscription.</p>
<p>Below is a list of WooCommerce.com products available on your site - but are either out-dated or do not have a valid subscription.</p>
<table class="wp-list-table widefat fixed striped">
<?php /* Extensions without a subscription. */ ?>

View File

@@ -0,0 +1,26 @@
<?php
/**
* Helper Admin Notice - Woo Updater Plugin is not activated.
*
* @package WooCommerce\Views
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="message" class="error woocommerce-message">
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'woo_updater_not_activated' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: 1: WP plugin management URL */
__(
'Please <a href="%1$s">activate the WooCommerce.com Update Manager</a> to continue receiving the updates and streamlined support included in your WooCommerce.com subscriptions.',
'woocommerce'
),
esc_url( admin_url( 'plugins.php' ) ),
)
);
?>
</p>
</div>

View File

@@ -0,0 +1,27 @@
<?php
/**
* Helper Admin Notice - Woo Updater Plugin is not Installed.
*
* @package WooCommerce\Views
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="message" class="error woocommerce-message">
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'woo_updater_not_installed' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: 1: Woo Update Manager plugin install URL 2: Woo Update Manager plugin download URL */
__(
'Please <a href="%1$s">Install the WooCommerce.com Update Manager</a> to continue receiving the updates and streamlined support included in your WooCommerce.com subscriptions. Alternatively, you can <a href="%2$s">download</a> and install it manually.',
'woocommerce'
),
esc_url( WC_Woo_Update_Manager_Plugin::generate_install_url() ),
esc_url( WC_Woo_Update_Manager_Plugin::WOO_UPDATE_MANAGER_DOWNLOAD_URL )
)
);
?>
</p>
</div>

View File

@@ -1,6 +1,6 @@
<?php
/**
* Admin -> WooCommerce -> Extensions -> Woo.com Subscriptions main page.
* Admin -> WooCommerce -> Extensions -> WooCommerce.com Subscriptions main page.
*
* @package WooCommerce\Views
*/
@@ -23,7 +23,7 @@ defined( 'ABSPATH' ) || exit();
<?php endif; ?>
<h2><?php esc_html_e( 'Manage your subscriptions, get important product notifications, and updates, all from the convenience of your WooCommerce dashboard', 'woocommerce' ); ?></h2>
<p><?php esc_html_e( 'Once connected, your Woo.com purchases will be listed here.', 'woocommerce' ); ?></p>
<p><?php esc_html_e( 'Once connected, your WooCommerce.com purchases will be listed here.', 'woocommerce' ); ?></p>
<p><a class="button button-primary button-helper-connect" href="<?php echo esc_url( $connect_url ); ?>"><?php esc_html_e( 'Connect', 'woocommerce' ); ?></a></p>
</div>
</div>

View File

@@ -3,12 +3,12 @@
<a class="button button-update" href="<?php echo esc_url( $refresh_url ); ?>"><span class="dashicons dashicons-image-rotate"></span> <?php esc_html_e( 'Update', 'woocommerce' ); ?></a>
<div class="user-info">
<header>
<p><?php esc_html_e( 'Connected to Woo.com', 'woocommerce' ); ?> <span class="chevron dashicons dashicons-arrow-down-alt2"></span></p>
<p><?php esc_html_e( 'Connected to WooCommerce.com', 'woocommerce' ); ?> <span class="chevron dashicons dashicons-arrow-down-alt2"></span></p>
</header>
<section>
<p><?php echo get_avatar( $auth_user_data['email'], 48 ); ?> <?php echo esc_html( $auth_user_data['email'] ); ?></p>
<div class="actions">
<a class="" href="https://woo.com/my-account/my-subscriptions/" target="_blank"><span class="dashicons dashicons-admin-generic"></span> <?php esc_html_e( 'My Subscriptions', 'woocommerce' ); ?></a>
<a class="" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><span class="dashicons dashicons-admin-generic"></span> <?php esc_html_e( 'My Subscriptions', 'woocommerce' ); ?></a>
<a class="" href="<?php echo esc_url( $disconnect_url ); ?>"><span class="dashicons dashicons-no"></span> <?php esc_html_e( 'Disconnect', 'woocommerce' ); ?></a>
</div>
</section>

View File

@@ -21,7 +21,7 @@ defined( 'ABSPATH' ) || exit(); ?>
<?php
$count_html = WC_Helper_Updater::get_updates_count_html();
/* translators: %s: Woo.com Subscriptions tab count HTML. */
/* translators: %s: WooCommerce.com Subscriptions tab count HTML. */
$menu_title = sprintf( __( 'My Subscriptions %s', 'woocommerce' ), $count_html );
?>
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=helper' ) ); ?>" class="nav-tab nav-tab-active"><?php echo wp_kses_post( $menu_title ); ?></a>

View File

@@ -45,7 +45,7 @@ class WC_Admin_List_Table_Coupons extends WC_Admin_List_Table {
echo '<div class="woocommerce-BlankState">';
echo '<h2 class="woocommerce-BlankState-message">' . esc_html__( 'Coupons are a great way to offer discounts and rewards to your customers. They will appear here once created.', 'woocommerce' ) . '</h2>';
echo '<a class="woocommerce-BlankState-cta button-primary button" href="' . esc_url( admin_url( 'post-new.php?post_type=shop_coupon' ) ) . '">' . esc_html__( 'Create your first coupon', 'woocommerce' ) . '</a>';
echo '<a class="woocommerce-BlankState-cta button" target="_blank" href="https://woo.com/document/coupon-management/?utm_source=blankslate&utm_medium=product&utm_content=couponsdoc&utm_campaign=woocommerceplugin">' . esc_html__( 'Learn more about coupons', 'woocommerce' ) . '</a>';
echo '<a class="woocommerce-BlankState-cta button" target="_blank" href="https://woocommerce.com/document/coupon-management/?utm_source=blankslate&utm_medium=product&utm_content=couponsdoc&utm_campaign=woocommerceplugin">' . esc_html__( 'Learn more about coupons', 'woocommerce' ) . '</a>';
echo '</div>';
}

View File

@@ -40,6 +40,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
add_filter( 'views_edit-product', array( $this, 'product_views' ) );
add_filter( 'get_search_query', array( $this, 'search_label' ) );
add_filter( 'posts_clauses', array( $this, 'posts_clauses' ), 10, 2 );
add_action( 'manage_product_posts_custom_column', array( $this, 'add_sample_product_badge' ), 9, 2 );
}
/**
@@ -658,4 +659,19 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
return $pieces;
}
/**
* Add a sample product badge to the product list table.
*
* @param string $column_name Column name.
* @param int $post_id Post ID.
*
* @since 8.8.0
*/
public function add_sample_product_badge( $column_name, $post_id ) {
$is_sample_product = 'product' === get_post_type( $post_id ) && get_post_meta( $post_id, '_headstart_post', true );
if ( $is_sample_product && 'name' === $column_name ) {
echo '<span class="sample-product-badge" style="margin-right: 6px;border-radius: 4px; background: #F6F7F7; padding: 4px; color: #3C434A;font-size: 12px;font-style: normal;font-weight: 400;line-height: 16px; height: 24px;">' . esc_html__( 'Sample', 'woocommerce' ) . '</span>';
}
}
}

View File

@@ -18,12 +18,12 @@ if ( ! defined( 'ABSPATH' ) ) {
WC_Marketplace_Suggestions::render_suggestions_container( 'product-edit-meta-tab-footer' );
?>
<div class="marketplace-suggestions-metabox-nosuggestions-placeholder hidden">
<img src="https://woo.com/wp-content/plugins/wccom-plugins/marketplace-suggestions/icons/get_more_options.svg" class="marketplace-suggestion-icon">
<img src="https://woocommerce.com/wp-content/plugins/wccom-plugins/marketplace-suggestions/icons/get_more_options.svg" class="marketplace-suggestion-icon">
<div class="marketplace-suggestion-placeholder-content">
<h4><?php esc_html_e( 'Enhance your products', 'woocommerce' ); ?></h4>
<p><?php esc_html_e( 'Extensions can add new functionality to your product pages that make your store stand out', 'woocommerce' ); ?></p>
</div>
<a href="https://woo.com/product-category/woocommerce-extensions/?utm_source=editproduct&amp;utm_campaign=marketplacesuggestions&amp;utm_medium=product" target="blank" class="button"><?php esc_html_e( 'Browse the Marketplace', 'woocommerce' ); ?></a><br />
<a href="https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=editproduct&amp;utm_campaign=marketplacesuggestions&amp;utm_medium=product" target="blank" class="button"><?php esc_html_e( 'Browse the Marketplace', 'woocommerce' ); ?></a><br />
<a class="marketplace-suggestion-manage-link" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced&section=woocommerce_com' ) ); ?>"><?php esc_html_e( 'Manage suggestions', 'woocommerce' ); ?></a>
</div>
</div>

View File

@@ -104,7 +104,7 @@ class WC_Meta_Box_Coupon_Data {
'id' => 'free_shipping',
'label' => __( 'Allow free shipping', 'woocommerce' ),
// translators: %s: URL to free shipping document.
'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://woo.com/document/free-shipping/' ),
'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://woocommerce.com/document/free-shipping/' ),
'value' => wc_bool_to_string( $coupon->get_free_shipping( 'edit' ) ),
)
);

View File

@@ -199,7 +199,7 @@ class WC_Meta_Box_Order_Actions {
*/
private static function get_available_order_actions_for_order( $order ) {
$actions = array(
'send_order_details' => __( 'Email invoice / order details to customer', 'woocommerce' ),
'send_order_details' => __( 'Send order details to customer', 'woocommerce' ),
'send_order_details_admin' => __( 'Resend new order notification', 'woocommerce' ),
'regenerate_download_permissions' => __( 'Regenerate download permissions', 'woocommerce' ),
);

View File

@@ -37,10 +37,17 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( 'select' === $attribute_taxonomy->attribute_type ) {
$attribute_orderby = ! empty( $attribute_taxonomy->attribute_orderby ) ? $attribute_taxonomy->attribute_orderby : 'name';
/**
* Filter the length (number of terms) rendered in the list.
*
* @since 8.8.0
* @param int $term_limit The maximum number of terms to display in the list.
*/
$term_limit = absint( apply_filters( 'woocommerce_admin_terms_metabox_datalimit', 50 ) );
?>
<select multiple="multiple"
data-minimum_input_length="0"
data-limit="50" data-return_id="id"
data-limit="<?php echo esc_attr( $term_limit ); ?>" data-return_id="id"
data-placeholder="<?php esc_attr_e( 'Select values', 'woocommerce' ); ?>"
data-orderby="<?php echo esc_attr( $attribute_orderby ); ?>"
class="multiselect attribute_values wc-taxonomy-term-search"

View File

@@ -124,7 +124,7 @@ defined( 'ABSPATH' ) || exit;
printf(
/* translators: 1: opening link tag, 2: closing link tag. */
esc_html__( 'The indicated downloads have been disabled (invalid location or filetype&mdash;%1$slearn more%2$s).', 'woocommerce' ),
'<a href="https://woo.com/document/approved-download-directories" target="_blank">',
'<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
'</a>'
);
?>

View File

@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="inline notice woocommerce-message show_if_variable">
<img class="info-icon" src="<?php echo esc_url( $info_img_url ); ?>" />
<p>
<?php echo esc_html_e( 'Settings below apply to all variations without manual stock management enabled. ', 'woocommerce' ); ?> <a target="_blank" href="https://woo.com/document/variable-product/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a>
<?php echo esc_html_e( 'Settings below apply to all variations without manual stock management enabled. ', 'woocommerce' ); ?> <a target="_blank" href="https://woocommerce.com/document/variable-product/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a>
</p>
</div>
<?php

View File

@@ -27,7 +27,7 @@ $arrow_img_url = WC_ADMIN_IMAGES_FOLDER_URL . '/product_data/no-variati
/* translators: %1$s: url for attributes tab, %2$s: url for variable product documentation */
__( 'Add some attributes in the <a class="variations-add-attributes-link" href="%1$s">Attributes</a> tab to generate variations. Make sure to check the <b>Used for variations</b> box. <a class="variations-learn-more-link" href="%2$s" target="_blank" rel="noreferrer">Learn more</a>', 'woocommerce' ),
esc_url( '#product_attributes' ),
esc_url( 'https://woo.com/document/variable-product/' )
esc_url( 'https://woocommerce.com/document/variable-product/' )
)
);
?>

View File

@@ -450,7 +450,7 @@ defined( 'ABSPATH' ) || exit;
printf(
/* translators: 1: opening link tag, 2: closing link tag. */
esc_html__( 'The indicated downloads have been disabled (invalid location or filetype&mdash;%1$slearn more%2$s).', 'woocommerce' ),
'<a href="https://woo.com/document/approved-download-directories" target="_blank">',
'<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
'</a>'
);
?>

View File

@@ -130,7 +130,7 @@ class WC_Notes_Run_Db_Update {
array(
'name' => 'update-db_learn-more',
'label' => __( 'Learn more about updates', 'woocommerce' ),
'url' => 'https://woo.com/document/how-to-update-woocommerce/',
'url' => 'https://woocommerce.com/document/how-to-update-woocommerce/',
'status' => 'unactioned',
'primary' => false,
),

View File

@@ -41,7 +41,7 @@ $untested_plugins_msg = sprintf(
</table>
</div>
<p><?php esc_html_e( 'We strongly recommend creating a backup of your site before updating.', 'woocommerce' ); ?> <a href="https://woo.com/2017/05/create-use-backups-woocommerce/" target="_blank"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a></p>
<p><?php esc_html_e( 'We strongly recommend creating a backup of your site before updating.', 'woocommerce' ); ?> <a href="https://woocommerce.com/2017/05/create-use-backups-woocommerce/" target="_blank"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a></p>
<?php if ( current_user_can( 'update_plugins' ) ) : ?>
<div class="actions">

View File

@@ -5,6 +5,8 @@
* @package WooCommerce\Admin
*/
use Automattic\WooCommerce\Admin\Features\Features;
defined( 'ABSPATH' ) || exit;
/**
@@ -41,7 +43,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'keys' => __( 'REST API', 'woocommerce' ),
'webhooks' => __( 'Webhooks', 'woocommerce' ),
'legacy_api' => __( 'Legacy API', 'woocommerce' ),
'woocommerce_com' => __( 'Woo.com', 'woocommerce' ),
'woocommerce_com' => __( 'WooCommerce.com', 'woocommerce' ),
);
}
@@ -153,7 +155,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'checkboxgroup' => 'start',
'show_if_checked' => 'option',
/* Translators: %s Docs URL. */
'desc_tip' => sprintf( __( 'Force SSL (HTTPS) on the checkout pages (<a href="%s" target="_blank">an SSL Certificate is required</a>).', 'woocommerce' ), 'https://woo.com/document/ssl-and-https/#section-3' ),
'desc_tip' => sprintf( __( 'Force SSL (HTTPS) on the checkout pages (<a href="%s" target="_blank">an SSL Certificate is required</a>).', 'woocommerce' ), 'https://woocommerce.com/document/ssl-and-https/#section-3' ),
),
'unforce_ssl_checkout' => array(
@@ -322,12 +324,12 @@ class WC_Settings_Advanced extends WC_Settings_Page {
}
/**
* Get settings for the Woo.com section.
* Get settings for the WooCommerce.com section.
*
* @return array
*/
protected function get_settings_for_woocommerce_com_section() {
$tracking_info_text = sprintf( '<a href="%s" target="_blank">%s</a>', 'https://woo.com/usage-tracking', esc_html__( 'Woo.com Usage Tracking Documentation', 'woocommerce' ) );
$tracking_info_text = sprintf( '<a href="%s" target="_blank">%s</a>', 'https://woocommerce.com/usage-tracking', esc_html__( 'WooCommerce.com Usage Tracking Documentation', 'woocommerce' ) );
$settings =
array(
@@ -335,7 +337,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'title' => esc_html__( 'Usage Tracking', 'woocommerce' ),
'type' => 'title',
'id' => 'tracking_options',
'desc' => __( 'Gathering usage data allows us to make WooCommerce better — your store will be considered as we evaluate new features, judge the quality of an update, or determine if an improvement makes sense.', 'woocommerce' ),
'desc' => __( 'Gathering usage data allows us to tailor your store setup experience, offer more relevant content, and help make WooCommerce better for everyone.', 'woocommerce' ),
),
array(
'title' => __( 'Enable tracking', 'woocommerce' ),
@@ -361,7 +363,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
array(
'title' => __( 'Show Suggestions', 'woocommerce' ),
'desc' => __( 'Display suggestions within WooCommerce', 'woocommerce' ),
'desc_tip' => esc_html__( 'Leave this box unchecked if you do not want to pull suggested extensions from Woo.com. You will see a static list of extensions instead.', 'woocommerce' ),
'desc_tip' => esc_html__( 'Leave this box unchecked if you do not want to pull suggested extensions from WooCommerce.com. You will see a static list of extensions instead.', 'woocommerce' ),
'id' => 'woocommerce_show_marketplace_suggestions',
'type' => 'checkbox',
'checkboxgroup' => 'start',
@@ -400,7 +402,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
),
'https://wordpress.org/plugins/woocommerce-legacy-rest-api/',
admin_url( 'admin.php?page=wc-status&tab=logs' ),
'https://developer.woo.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
);
}

View File

@@ -49,7 +49,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
/* translators: %1$s: Link to WP Mail Logging plugin, %2$s: Link to Email FAQ support page. */
__( 'To ensure your store&rsquo;s notifications arrive in your and your customers&rsquo; inboxes, we recommend connecting your email address to your domain and setting up a dedicated SMTP server. If something doesn&rsquo;t seem to be sending correctly, install the <a href="%1$s">WP Mail Logging Plugin</a> or check the <a href="%2$s">Email FAQ page</a>.', 'woocommerce' ),
'https://wordpress.org/plugins/wp-mail-logging/',
'https://woo.com/document/email-faq'
'https://woocommerce.com/document/email-faq'
);
$settings =
array(

View File

@@ -36,7 +36,7 @@ class WC_Settings_General extends WC_Settings_Page {
$currency_code_options = get_woocommerce_currencies();
foreach ( $currency_code_options as $code => $name ) {
$currency_code_options[ $code ] = $name . ' (' . get_woocommerce_currency_symbol( $code ) . ')';
$currency_code_options[ $code ] = $name . ' (' . get_woocommerce_currency_symbol( $code ) . ') — ' . esc_html( $code );
}
$settings =

View File

@@ -39,6 +39,7 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) :
add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections' ) );
add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
add_action( 'woocommerce_admin_field_add_settings_slot', array( $this, 'add_settings_slot' ) );
}
/**
@@ -61,6 +62,15 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) :
return $this->label;
}
/**
* Creates the React mount point for settings slot.
*/
public function add_settings_slot() {
?>
<div id="wc_settings_slotfill"> </div>
<?php
}
/**
* Add this page to settings.
*
@@ -153,7 +163,13 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) :
*/
public function get_sections() {
$sections = $this->get_own_sections();
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
/**
* Filters the sections for this settings page.
*
* @since 2.2.0
* @param array $sections The sections for this settings page.
*/
return (array) apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
}
/**

View File

@@ -112,7 +112,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
*/
public function payment_gateways_banner() {
?>
<div id="wc_payment_gateways_banner_slotfill"> </div>
<div id="wc_payments_settings_slotfill"> </div>
<?php
}
@@ -258,7 +258,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
echo '<tr>';
// phpcs:ignore -- ignoring the error since the value is harded.
echo "<td style='border-top: 1px solid #c3c4c7; background-color: #fff' colspan='{$columns_count}'>";
echo "<a id='settings-other-payment-methods' href='https://woo.com/product-category/woocommerce-extensions/payment-gateways/?utm_source=payments_recommendations' target='_blank' class='components-button is-tertiary'>";
echo "<a id='settings-other-payment-methods' href='https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/?utm_source=payments_recommendations' target='_blank' class='components-button is-tertiary'>";
// phpcs:ignore
echo $link_text;
// phpcs:ignore

View File

@@ -378,7 +378,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'desc' => sprintf(
// translators: Link to WooCommerce Docs.
__( "If you are using X-Accel-Redirect download method along with NGINX server, make sure that you have applied settings as described in <a href='%s'>Digital/Downloadable Product Handling</a> guide.", 'woocommerce' ),
'https://woo.com/document/digital-downloadable-product-handling#nginx-setting'
'https://woocommerce.com/document/digital-downloadable-product-handling#nginx-setting'
),
'options' => array(
'force' => __( 'Force downloads', 'woocommerce' ),
@@ -396,7 +396,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'desc_tip' => sprintf(
/* translators: %1$s is a link to the WooCommerce documentation. */
__( 'If the "Force Downloads" or "X-Accel-Redirect/X-Sendfile" download method is selected but does not work, the system will use the "Redirect" method as a last resort. <a href="%1$s">See this guide</a> for more details.', 'woocommerce' ),
'https://woo.com/document/digital-downloadable-product-handling/'
'https://woocommerce.com/document/digital-downloadable-product-handling/'
),
'checkboxgroup' => 'start',
'autoload' => false,
@@ -442,7 +442,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'desc_tip' => sprintf(
// translators: Link to WooCommerce Docs.
__( "Not required if your download directory is protected. <a href='%s'>See this guide</a> for more details. Files already uploaded will not be affected.", 'woocommerce' ),
'https://woo.com/document/digital-downloadable-product-handling#unique-string'
'https://woocommerce.com/document/digital-downloadable-product-handling#unique-string'
),
),

View File

@@ -0,0 +1,52 @@
<?php
/**
* WooCommerce site visibility settings
*
* @package WooCommerce\Admin
*/
defined( 'ABSPATH' ) || exit;
/**
* Settings for API.
*/
if ( class_exists( 'WC_Settings_Site_Visibility', false ) ) {
return new WC_Settings_Site_Visibility();
}
/**
* WC_Settings_Advanced.
*/
class WC_Settings_Site_Visibility extends WC_Settings_Page {
/**
* Constructor.
*/
public function __construct() {
$this->id = 'site-visibility';
$this->label = __( 'Site visibility', 'woocommerce' );
parent::__construct();
}
/**
* Get settings for the default section.
*
* @return array
*/
protected function get_settings_for_default_section() {
$settings =
array(
array(
'id' => 'wc_settings_site_visibility_slotfill',
'type' => 'slotfill_placeholder',
),
);
return $settings;
}
}
return new WC_Settings_Site_Visibility();

View File

@@ -44,7 +44,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
<th scope="row" class="titledesc woocommerce_admin_tax_settings_slotfill_th">
</th>
<td class="forminp forminp-text woocommerce_admin_tax_settings_slotfill_td">
<div id="wc_conflict_error_slotfill"> </div>
<div id="wc_tax_settings_slotfill"> </div>
</td>
</tr>
<?php

View File

@@ -5,6 +5,9 @@
* @package WooCommerce\Admin\Shipping
*/
use Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils;
use Automattic\WooCommerce\Blocks\Shipping\ShippingController;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -15,7 +18,10 @@ if ( ! defined( 'ABSPATH' ) ) {
<span class="wc-shipping-zone-name"><?php echo esc_html( $zone->get_zone_name() ? $zone->get_zone_name() : __( 'Zone', 'woocommerce' ) ); ?></span>
</h2>
<?php do_action( 'woocommerce_shipping_zone_before_methods_table', $zone ); ?>
<?php
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
do_action( 'woocommerce_shipping_zone_before_methods_table', $zone );
?>
<table class="form-table wc-shipping-zone-settings">
<tbody>
@@ -52,7 +58,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="wc-shipping-zone-postcodes">
<textarea name="zone_postcodes" data-attribute="zone_postcodes" id="zone_postcodes" placeholder="<?php esc_attr_e( 'List 1 postcode per line', 'woocommerce' ); ?>" class="input-text large-text" cols="25" rows="5"><?php echo esc_textarea( implode( "\n", $postcodes ) ); ?></textarea>
<?php /* translators: WooCommerce link to setting up shipping zones */ ?>
<span class="description"><?php printf( __( 'Postcodes containing wildcards (e.g. CB23*) or fully numeric ranges (e.g. <code>90210...99000</code>) are also supported. Please see the shipping zones <a href="%s" target="_blank">documentation</a> for more information.', 'woocommerce' ), 'https://woo.com/document/setting-up-shipping-zones/#section-3' ); ?></span><?php // @codingStandardsIgnoreLine. ?>
<span class="description"><?php printf( __( 'Postcodes containing wildcards (e.g. CB23*) or fully numeric ranges (e.g. <code>90210...99000</code>) are also supported. Please see the shipping zones <a href="%s" target="_blank">documentation</a> for more information.', 'woocommerce' ), 'https://woocommerce.com/document/setting-up-shipping-zones/#section-3' ); ?></span><?php // @codingStandardsIgnoreLine. ?>
</div>
</td>
</tr>
@@ -90,7 +96,10 @@ if ( ! defined( 'ABSPATH' ) ) {
</tbody>
</table>
<?php do_action( 'woocommerce_shipping_zone_after_methods_table', $zone ); ?>
<?php
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
do_action( 'woocommerce_shipping_zone_after_methods_table', $zone );
?>
<p class="submit">
<button type="submit" name="submit" id="submit" class="button button-primary button-large wc-shipping-zone-method-save" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
@@ -198,6 +207,10 @@ if ( ! defined( 'ABSPATH' ) ) {
$methods_placed_in_order = array_merge( $methods_placed_in_order, array_values( $methods ) );
foreach ( $methods_placed_in_order as $method ) {
if ( CartCheckoutUtils::is_checkout_block_default() && ! ShippingController::is_legacy_local_pickup_active() && 'local_pickup' === $method->id ) {
continue;
}
if ( ! $method->supports( 'shipping-zones' ) ) {
continue;
}
@@ -214,7 +227,36 @@ if ( ! defined( 'ABSPATH' ) ) {
echo '<div id=' . esc_attr( $method->id ) . '-description class="wc-shipping-zone-method-input-help-text"><span>' . wp_kses_post( wpautop( $method->get_method_description() ) ) . '</span></div>';
}
echo '</div>'
if ( CartCheckoutUtils::is_checkout_block_default() ) {
echo '<p class="wc-shipping-legacy-local-pickup-help-text-container">';
if ( ShippingController::is_legacy_local_pickup_active() ) {
printf(
wp_kses(
/* translators: %s: Local pickup settings page URL. */
__( 'Explore a new enhanced delivery method that allows you to easily offer one or more pickup locations to your customers in the <a href="%s">Local pickup settings page</a>.', 'woocommerce' ),
array( 'a' => array( 'href' => array() ) )
),
esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&section=pickup_location' ) )
);
} else {
printf(
wp_kses(
/* translators: %s: Local pickup settings page URL. */
__( 'Local pickup: Set up pickup locations in the <a href="%s">Local pickup settings page</a>.', 'woocommerce' ),
array( 'a' => array( 'href' => array() ) )
),
esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&section=pickup_location' ) )
);
}
echo '</p>';
}
echo '</div>';
?>
</fieldset>
</form>

View File

@@ -98,6 +98,7 @@ $settings = array(
),
array( 'type' => 'conflict_error' ), // React mount point for embedded banner slotfill.
array( 'type' => 'add_settings_slot' ), // React mount point for settings slotfill.
array(
'title' => __( 'Price display suffix', 'woocommerce' ),

View File

@@ -57,7 +57,7 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
>
<?php
$count_html = WC_Helper_Updater::get_updates_count_html();
/* translators: %s: Woo.com Subscriptions tab count HTML. */
/* translators: %s: WooCommerce.com Subscriptions tab count HTML. */
echo ( wp_kses_post( sprintf( __( 'My Subscriptions %s', 'woocommerce' ), $count_html ) ) );
?>
</a>
@@ -131,12 +131,12 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
</div>
<?php else : ?>
<?php /* translators: a url */ ?>
<p><?php printf( wp_kses_post( __( 'Our catalog of WooCommerce Extensions can be found on Woo.com here: <a href="%s">WooCommerce Extensions Catalog</a>', 'woocommerce' ) ), 'https://woo.com/product-category/woocommerce-extensions/' ); ?></p>
<p><?php printf( wp_kses_post( __( 'Our catalog of WooCommerce Extensions can be found on WooCommerce.com here: <a href="%s">WooCommerce Extensions Catalog</a>', 'woocommerce' ) ), 'https://woocommerce.com/product-category/woocommerce-extensions/' ); ?></p>
<?php endif; ?>
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
<?php
$storefront_url = WC_Admin_Addons::add_in_app_purchase_url_params( 'https://woo.com/products/storefront/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=wcaddon' );
$storefront_url = WC_Admin_Addons::add_in_app_purchase_url_params( 'https://woocommerce.com/products/storefront/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=wcaddon' );
?>
<div class="storefront">
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>

View File

@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<strong>
<?php
/* translators: 1: Link URL */
echo wp_kses_post( sprintf( __( 'With the release of WooCommerce 4.0, these reports are being replaced. There is a new and better Analytics section available for users running WordPress 5.3+. Head on over to the <a href="%1$s">WooCommerce Analytics</a> or learn more about the new experience in the <a href="https://woo.com/document/woocommerce-analytics/" target="_blank">WooCommerce Analytics documentation</a>.', 'woocommerce' ), esc_url( wc_admin_url( '&path=/analytics/overview' ) ) ) );
echo wp_kses_post( sprintf( __( 'With the release of WooCommerce 4.0, these reports are being replaced. There is a new and better Analytics section available for users running WordPress 5.3+. Head on over to the <a href="%1$s">WooCommerce Analytics</a> or learn more about the new experience in the <a href="https://woocommerce.com/document/woocommerce-analytics/" target="_blank">WooCommerce Analytics documentation</a>.', 'woocommerce' ), esc_url( wc_admin_url( '&path=/analytics/overview' ) ) ) );
?>
</strong>
</p>

View File

@@ -5,10 +5,14 @@
* @package WooCommerce\Admin\Logs
*/
use Automattic\WooCommerce\Utilities\LoggingUtil;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$log_directory = LoggingUtil::get_log_directory();
?>
<?php if ( $logs ) : ?>
<div id="log-viewer-select">
@@ -25,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<select class="wc-enhanced-select" name="log_file">
<?php foreach ( $logs as $log_key => $log_file ) : ?>
<?php
$timestamp = filemtime( WC_LOG_DIR . $log_file );
$timestamp = filemtime( $log_directory . $log_file );
$date = sprintf(
/* translators: 1: last access date 2: last access time 3: last access timezone abbreviation */
__( '%1$s at %2$s %3$s', 'woocommerce' ),
@@ -43,7 +47,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="clear"></div>
</div>
<div id="log-viewer">
<pre><?php echo esc_html( file_get_contents( WC_LOG_DIR . $viewed_log ) ); ?></pre>
<pre><?php echo esc_html( file_get_contents( $log_directory . $viewed_log ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents ?></pre>
</div>
<?php else : ?>
<div class="updated woocommerce-message inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'woocommerce' ); ?></p></div>

View File

@@ -36,7 +36,7 @@ $inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_p
</p>
<p class="submit">
<a href="#" class="button-primary debug-report"><?php esc_html_e( 'Get system report', 'woocommerce' ); ?></a>
<a class="button-secondary docs" href="https://woo.com/document/understanding-the-woocommerce-system-status-report/" target="_blank">
<a class="button-secondary docs" href="https://woocommerce.com/document/understanding-the-woocommerce-system-status-report/" target="_blank">
<?php esc_html_e( 'Understanding the status report', 'woocommerce' ); ?>
</a>
</p>
@@ -120,8 +120,14 @@ $inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_p
if ( $environment['log_directory_writable'] ) {
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> <code class="private">' . esc_html( $environment['log_directory'] ) . '</code></mark> ';
} else {
/* Translators: %1$s: Log directory, %2$s: Log directory constant */
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'To allow logging, make %1$s writable or define a custom %2$s.', 'woocommerce' ), '<code>' . esc_html( $environment['log_directory'] ) . '</code>', '<code>WC_LOG_DIR</code>' ) . '</mark>';
printf(
'<mark class="error"><span class="dashicons dashicons-warning"></span> %s</mark>',
sprintf(
// Translators: %s: Log directory path.
esc_html__( 'To allow logging, make %s writable.', 'woocommerce' ),
'<code>' . esc_html( $environment['log_directory'] ) . '</code>'
)
);
}
?>
</td>
@@ -446,7 +452,7 @@ $inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_p
<?php
if ( strlen( $database['database_prefix'] ) > 20 ) {
/* Translators: %1$s: Database prefix, %2$s: Docs link. */
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%1$s - We recommend using a prefix with less than 20 characters. See: %2$s', 'woocommerce' ), esc_html( $database['database_prefix'] ), '<a href="https://woo.com/document/completed-order-email-doesnt-contain-download-links/#section-2" target="_blank">' . esc_html__( 'How to update your database table prefix', 'woocommerce' ) . '</a>' ) . '</mark>';
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%1$s - We recommend using a prefix with less than 20 characters. See: %2$s', 'woocommerce' ), esc_html( $database['database_prefix'] ), '<a href="https://woocommerce.com/document/completed-order-email-doesnt-contain-download-links/#section-2" target="_blank">' . esc_html__( 'How to update your database table prefix', 'woocommerce' ) . '</a>' ) . '</mark>';
} else {
echo '<mark class="yes">' . esc_html( $database['database_prefix'] ) . '</mark>';
}
@@ -557,7 +563,7 @@ $inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_p
<mark class="error"><span class="dashicons dashicons-warning"></span>
<?php
/* Translators: %s: docs link. */
echo wp_kses_post( sprintf( __( 'Your store is not using HTTPS. <a href="%s" target="_blank">Learn more about HTTPS and SSL Certificates</a>.', 'woocommerce' ), 'https://woo.com/document/ssl-and-https/' ) );
echo wp_kses_post( sprintf( __( 'Your store is not using HTTPS. <a href="%s" target="_blank">Learn more about HTTPS and SSL Certificates</a>.', 'woocommerce' ), 'https://woocommerce.com/document/ssl-and-https/' ) );
?>
</mark>
<?php endif; ?>
@@ -725,8 +731,8 @@ if ( 0 < $mu_plugins_count ) :
</td>
</tr>
<tr>
<td data-export-label="Connected to Woo.com"><?php esc_html_e( 'Connected to Woo.com', 'woocommerce' ); ?>:</td>
<td class="help"><?php echo wc_help_tip( esc_html__( 'Is your site connected to Woo.com?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
<td data-export-label="Connected to WooCommerce.com"><?php esc_html_e( 'Connected to WooCommerce.com', 'woocommerce' ); ?>:</td>
<td class="help"><?php echo wc_help_tip( esc_html__( 'Is your site connected to WooCommerce.com?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
<td><?php echo 'yes' === $settings['woocommerce_com_connected'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<mark class="no">&ndash;</mark>'; ?></td>
</tr>
<tr>
@@ -735,11 +741,6 @@ if ( 0 < $mu_plugins_count ) :
<td><?php echo $settings['enforce_approved_download_dirs'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<mark class="no">&ndash;</mark>'; ?></td>
</tr>
<tr>
<td data-export-label="HPOS feature screen enabled"><?php esc_html_e( 'HPOS feature screen enabled:', 'woocommerce' ); ?></td>
<td class="help"><?php echo wc_help_tip( esc_html__( 'Is HPOS feature screen enabled?', 'woocommerce' ) ); ?></td>
<td><?php echo $settings['HPOS_feature_screen_enabled'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<mark class="no">&ndash;</mark>'; ?></td>
</tr>
<tr>
<td data-export-label="HPOS feature enabled"><?php esc_html_e( 'HPOS enabled:', 'woocommerce' ); ?></td>
<td class="help"><?php echo wc_help_tip( esc_html__( 'Is HPOS enabled?', 'woocommerce' ) ); ?></td>
@@ -1006,7 +1007,7 @@ if ( 0 < $mu_plugins_count ) :
<mark class="error">
<span class="dashicons dashicons-warning"></span>
</mark>
<a href="https://woo.com/document/fix-outdated-templates-woocommerce/" target="_blank">
<a href="https://woocommerce.com/document/fix-outdated-templates-woocommerce/" target="_blank">
<?php esc_html_e( 'Learn how to update', 'woocommerce' ); ?>
</a>
</td>

View File

@@ -12,7 +12,7 @@ defined( 'ABSPATH' ) || exit;
<p>
<?php
$settings_screen_link = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=wc-settings&tab=products&section=download_urls' ) ) . '">';
$documentation_link = '<a href="https://woo.com/document/approved-download-directories">';
$documentation_link = '<a href="https://woocommerce.com/document/approved-download-directories">';
$closing_link = '</a>';
printf(

View File

@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php esc_html_e( 'Setup shipping zones', 'woocommerce' ); ?>
</a>
<?php endif; ?>
<a class="button-secondary" href="https://woo.com/document/setting-up-shipping-zones/">
<a class="button-secondary" href="https://woocommerce.com/document/setting-up-shipping-zones/">
<?php esc_html_e( 'Learn more about shipping zones', 'woocommerce' ); ?>
</a>
</p>

View File

@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>">
<?php esc_html_e( 'Setup shipping zones', 'woocommerce' ); ?>
</a>
<a class="button-secondary" href="https://woo.com/document/setting-up-shipping-zones/">
<a class="button-secondary" href="https://woocommerce.com/document/setting-up-shipping-zones/">
<?php esc_html_e( 'Learn more about shipping zones', 'woocommerce' ); ?>
</a>
</p>

View File

@@ -16,7 +16,7 @@ defined( 'ABSPATH' ) || exit;
echo wp_kses_post( sprintf(
/* translators: %s: documentation URL */
__( 'Your store does not appear to be using a secure connection. We highly recommend serving your entire website over an HTTPS connection to help keep customer data secure. <a href="%s">Learn more here.</a>', 'woocommerce' ),
'https://woo.com/document/ssl-and-https/'
'https://woocommerce.com/document/ssl-and-https/'
) );
?>
</p>

View File

@@ -23,7 +23,7 @@ $theme = wp_get_theme();
</ol>
</p>
<p class="submit">
<a class="button-primary" href="https://woo.com/document/template-structure/" target="_blank"><?php esc_html_e( 'Learn more about templates', 'woocommerce' ); ?></a>
<a class="button-primary" href="https://woocommerce.com/document/template-structure/" target="_blank"><?php esc_html_e( 'Learn more about templates', 'woocommerce' ); ?></a>
<a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-status' ) ); ?>" target="_blank"><?php esc_html_e( 'View affected templates', 'woocommerce' ); ?></a>
</p>
</div>

View File

@@ -32,7 +32,7 @@ $update_url = wp_nonce_url(
<a href="<?php echo esc_url( $update_url ); ?>" class="wc-update-now button-primary">
<?php esc_html_e( 'Update WooCommerce Database', 'woocommerce' ); ?>
</a>
<a href="https://woo.com/document/how-to-update-woocommerce/" class="button-secondary">
<a href="https://woocommerce.com/document/how-to-update-woocommerce/" class="button-secondary">
<?php esc_html_e( 'Learn more about updates', 'woocommerce' ); ?>
</a>
</p>

View File

@@ -21,7 +21,7 @@ $uploads = wp_get_upload_dir();
/* translators: 1: uploads directory URL 2: documentation URL */
__( 'Your store\'s uploads directory is <a href="%1$s">browsable via the web</a>. We strongly recommend <a href="%2$s">configuring your web server to prevent directory indexing</a>.', 'woocommerce' ),
esc_url( $uploads['baseurl'] . '/woocommerce_uploads' ),
'https://woo.com/document/digital-downloadable-product-handling/#protecting-your-uploads-directory'
'https://woocommerce.com/document/digital-downloadable-product-handling/#protecting-your-uploads-directory'
)
);
?>

View File

@@ -22,7 +22,7 @@ defined( 'ABSPATH' ) || exit;
'utm_campaign' => 'woocommerceplugin',
'utm_content' => 'docs',
),
'https://woo.com/document/update-php-wordpress/'
'https://woocommerce.com/document/update-php-wordpress/'
)
)
);