Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -64,8 +64,24 @@ class WC_Admin_Addons {
|
||||
* @return void
|
||||
*/
|
||||
public static function render_featured() {
|
||||
$featured = self::fetch_featured();
|
||||
|
||||
if ( is_wp_error( $featured ) ) {
|
||||
self::output_empty( $featured->get_error_message() );
|
||||
}
|
||||
|
||||
self::output_featured( $featured );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch featured products from WCCOM's the Featured 2.0 Endpoint and cache the data for a day.
|
||||
*
|
||||
* @return array|WP_Error
|
||||
*/
|
||||
public static function fetch_featured() {
|
||||
$locale = get_user_locale();
|
||||
$featured = self::get_locale_data_from_transient( 'wc_addons_featured', $locale );
|
||||
|
||||
if ( false === $featured ) {
|
||||
$headers = array();
|
||||
$auth = WC_Helper_Options::get( 'auth' );
|
||||
@@ -96,9 +112,7 @@ class WC_Admin_Addons {
|
||||
? __( 'We encountered an SSL error. Please ensure your site supports TLS version 1.2 or above.', 'woocommerce' )
|
||||
: $raw_featured->get_error_message();
|
||||
|
||||
self::output_empty( $message );
|
||||
|
||||
return;
|
||||
return new WP_Error( 'wc-addons-connection-error', $message );
|
||||
}
|
||||
|
||||
$response_code = (int) wp_remote_retrieve_response_code( $raw_featured );
|
||||
@@ -117,18 +131,15 @@ class WC_Admin_Addons {
|
||||
$response_code
|
||||
);
|
||||
|
||||
self::output_empty( $message );
|
||||
|
||||
return;
|
||||
return new WP_Error( 'wc-addons-connection-error', $message );
|
||||
}
|
||||
|
||||
$featured = json_decode( wp_remote_retrieve_body( $raw_featured ) );
|
||||
if ( empty( $featured ) || ! is_array( $featured ) ) {
|
||||
do_action( 'woocommerce_page_wc-addons_connection_error', 'Empty or malformed response' );
|
||||
$message = __( 'Our request to the featured API got a malformed response.', 'woocommerce' );
|
||||
self::output_empty( $message );
|
||||
|
||||
return;
|
||||
return new WP_Error( 'wc-addons-connection-error', $message );
|
||||
}
|
||||
|
||||
if ( $featured ) {
|
||||
@@ -136,7 +147,7 @@ class WC_Admin_Addons {
|
||||
}
|
||||
}
|
||||
|
||||
self::output_featured( $featured );
|
||||
return $featured;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,7 +351,7 @@ class WC_Admin_Addons {
|
||||
$url
|
||||
);
|
||||
|
||||
echo '<a href="' . esc_url( $url ) . '" class="add-new-h2">' . esc_html( $text ) . '</a>' . "\n";
|
||||
echo '<a href="' . esc_url( $url ) . '" class="page-title-action">' . esc_html( $text ) . '</a>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,7 @@ class WC_Admin_API_Keys {
|
||||
private static function table_list_output() {
|
||||
global $wpdb, $keys_table_list;
|
||||
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'REST API', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys&create-key=1' ) ) . '" class="add-new-h2">' . esc_html__( 'Add key', 'woocommerce' ) . '</a></h2>';
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'REST API', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys&create-key=1' ) ) . '" class="page-title-action">' . esc_html__( 'Add key', 'woocommerce' ) . '</a></h2>';
|
||||
|
||||
// Get the API keys count.
|
||||
$count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1;" );
|
||||
|
||||
@@ -368,74 +368,77 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'remove_item_notice' => $remove_item_notice,
|
||||
'remove_fee_notice' => $remove_fee_notice,
|
||||
'remove_shipping_notice' => $remove_shipping_notice,
|
||||
'i18n_select_items' => __( 'Please select some items.', 'woocommerce' ),
|
||||
'i18n_do_refund' => __( 'Are you sure you wish to process this refund? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_delete_refund' => __( 'Are you sure you wish to delete this refund? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_delete_tax' => __( 'Are you sure you wish to delete this tax column? This action cannot be undone.', 'woocommerce' ),
|
||||
'remove_item_meta' => __( 'Remove this item meta?', 'woocommerce' ),
|
||||
'name_label' => __( 'Name', 'woocommerce' ),
|
||||
'remove_label' => __( 'Remove', 'woocommerce' ),
|
||||
'click_to_toggle' => __( 'Click to toggle', 'woocommerce' ),
|
||||
'values_label' => __( 'Value(s)', 'woocommerce' ),
|
||||
'text_attribute_tip' => __( 'Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce' ),
|
||||
'visible_label' => __( 'Visible on the product page', 'woocommerce' ),
|
||||
'used_for_variations_label' => __( 'Used for variations', 'woocommerce' ),
|
||||
'new_attribute_prompt' => __( 'Enter a name for the new attribute term:', 'woocommerce' ),
|
||||
'calc_totals' => __( 'Recalculate totals? This will calculate taxes based on the customers country (or the store base country) and update totals.', 'woocommerce' ),
|
||||
'copy_billing' => __( 'Copy billing information to shipping information? This will remove any currently entered shipping information.', 'woocommerce' ),
|
||||
'load_billing' => __( "Load the customer's billing information? This will remove any currently entered billing information.", 'woocommerce' ),
|
||||
'load_shipping' => __( "Load the customer's shipping information? This will remove any currently entered shipping information.", 'woocommerce' ),
|
||||
'featured_label' => __( 'Featured', 'woocommerce' ),
|
||||
'prices_include_tax' => esc_attr( get_option( 'woocommerce_prices_include_tax' ) ),
|
||||
'tax_based_on' => esc_attr( get_option( 'woocommerce_tax_based_on' ) ),
|
||||
'round_at_subtotal' => esc_attr( get_option( 'woocommerce_tax_round_at_subtotal' ) ),
|
||||
'no_customer_selected' => __( 'No customer selected', 'woocommerce' ),
|
||||
'plugin_url' => WC()->plugin_url(),
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'order_item_nonce' => wp_create_nonce( 'order-item' ),
|
||||
'add_attribute_nonce' => wp_create_nonce( 'add-attribute' ),
|
||||
'save_attributes_nonce' => wp_create_nonce( 'save-attributes' ),
|
||||
'add_attributes_and_variations' => wp_create_nonce( 'add-attributes-and-variations' ),
|
||||
'calc_totals_nonce' => wp_create_nonce( 'calc-totals' ),
|
||||
'get_customer_details_nonce' => wp_create_nonce( 'get-customer-details' ),
|
||||
'search_products_nonce' => wp_create_nonce( 'search-products' ),
|
||||
'grant_access_nonce' => wp_create_nonce( 'grant-access' ),
|
||||
'revoke_access_nonce' => wp_create_nonce( 'revoke-access' ),
|
||||
'add_order_note_nonce' => wp_create_nonce( 'add-order-note' ),
|
||||
'delete_order_note_nonce' => wp_create_nonce( 'delete-order-note' ),
|
||||
'calendar_image' => WC()->plugin_url() . '/assets/images/calendar.png',
|
||||
'post_id' => $this->is_order_meta_box_screen( $screen_id ) && isset( $order_or_post_object ) ? \Automattic\WooCommerce\Utilities\OrderUtil::get_post_or_order_id( $order_or_post_object ) : $post_id,
|
||||
'base_country' => WC()->countries->get_base_country(),
|
||||
'currency_format_num_decimals' => wc_get_price_decimals(),
|
||||
'currency_format_symbol' => get_woocommerce_currency_symbol( $currency ),
|
||||
'currency_format_decimal_sep' => esc_attr( wc_get_price_decimal_separator() ),
|
||||
'currency_format_thousand_sep' => esc_attr( wc_get_price_thousand_separator() ),
|
||||
'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), // For accounting JS.
|
||||
'rounding_precision' => wc_get_rounding_precision(),
|
||||
'tax_rounding_mode' => wc_get_tax_rounding_mode(),
|
||||
'product_types' => array_unique( array_merge( array( 'simple', 'grouped', 'variable', 'external' ), array_keys( wc_get_product_types() ) ) ),
|
||||
'i18n_download_permission_fail' => __( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ),
|
||||
'i18n_permission_revoke' => __( 'Are you sure you want to revoke access to this download?', 'woocommerce' ),
|
||||
'i18n_tax_rate_already_exists' => __( 'You cannot add the same tax rate twice!', 'woocommerce' ),
|
||||
'i18n_delete_note' => __( 'Are you sure you wish to delete this note? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_apply_coupon' => __( 'Enter a coupon code to apply. Discounts are applied to line totals, before taxes.', 'woocommerce' ),
|
||||
'i18n_add_fee' => __( 'Enter a fixed amount or percentage to apply as a fee.', 'woocommerce' ),
|
||||
'i18n_attribute_name_placeholder' => __( 'New attribute', 'woocommerce' ),
|
||||
'i18n_product_simple_tip' => __( '<b>Simple –</b> covers the vast majority of any products you may sell. Simple products are shipped and have no options. For example, a book.', 'woocommerce' ),
|
||||
'i18n_product_grouped_tip' => __( '<b>Grouped –</b> a collection of related products that can be purchased individually and only consist of simple products. For example, a set of six drinking glasses.', 'woocommerce' ),
|
||||
'i18n_product_external_tip' => __( '<b>External or Affiliate –</b> one that you list and describe on your website but is sold elsewhere.', 'woocommerce' ),
|
||||
'i18n_product_variable_tip' => __( '<b>Variable –</b> a product with variations, each of which may have a different SKU, price, stock option, etc. For example, a t-shirt available in different colors and/or sizes.', 'woocommerce' ),
|
||||
'i18n_product_other_tip' => __( 'Product types define available product details and attributes, such as downloadable files and variations. They’re also used for analytics and inventory management.', 'woocommerce' ),
|
||||
'i18n_product_description_tip' => __( 'Describe this product. What makes it unique? What are its most important features?', 'woocommerce' ),
|
||||
'i18n_product_short_description_tip' => __( 'Summarize this product in 1-2 short sentences. We’ll show it at the top of the page.', 'woocommerce' ),
|
||||
'i18n_save_attribute_variation_tip' => __( 'Make sure you enter the name and values for each attribute.', 'woocommerce' ),
|
||||
'remove_item_notice' => $remove_item_notice,
|
||||
'remove_fee_notice' => $remove_fee_notice,
|
||||
'remove_shipping_notice' => $remove_shipping_notice,
|
||||
'i18n_select_items' => __( 'Please select some items.', 'woocommerce' ),
|
||||
'i18n_do_refund' => __( 'Are you sure you wish to process this refund? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_delete_refund' => __( 'Are you sure you wish to delete this refund? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_delete_tax' => __( 'Are you sure you wish to delete this tax column? This action cannot be undone.', 'woocommerce' ),
|
||||
'remove_item_meta' => __( 'Remove this item meta?', 'woocommerce' ),
|
||||
'name_label' => __( 'Name', 'woocommerce' ),
|
||||
'remove_label' => __( 'Remove', 'woocommerce' ),
|
||||
'click_to_toggle' => __( 'Click to toggle', 'woocommerce' ),
|
||||
'values_label' => __( 'Value(s)', 'woocommerce' ),
|
||||
'text_attribute_tip' => __( 'Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce' ),
|
||||
'visible_label' => __( 'Visible on the product page', 'woocommerce' ),
|
||||
'used_for_variations_label' => __( 'Used for variations', 'woocommerce' ),
|
||||
'new_attribute_prompt' => __( 'Enter a name for the new attribute term:', 'woocommerce' ),
|
||||
'calc_totals' => __( 'Recalculate totals? This will calculate taxes based on the customers country (or the store base country) and update totals.', 'woocommerce' ),
|
||||
'copy_billing' => __( 'Copy billing information to shipping information? This will remove any currently entered shipping information.', 'woocommerce' ),
|
||||
'load_billing' => __( "Load the customer's billing information? This will remove any currently entered billing information.", 'woocommerce' ),
|
||||
'load_shipping' => __( "Load the customer's shipping information? This will remove any currently entered shipping information.", 'woocommerce' ),
|
||||
'featured_label' => __( 'Featured', 'woocommerce' ),
|
||||
'prices_include_tax' => esc_attr( get_option( 'woocommerce_prices_include_tax' ) ),
|
||||
'tax_based_on' => esc_attr( get_option( 'woocommerce_tax_based_on' ) ),
|
||||
'round_at_subtotal' => esc_attr( get_option( 'woocommerce_tax_round_at_subtotal' ) ),
|
||||
'no_customer_selected' => __( 'No customer selected', 'woocommerce' ),
|
||||
'plugin_url' => WC()->plugin_url(),
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'order_item_nonce' => wp_create_nonce( 'order-item' ),
|
||||
'add_attribute_nonce' => wp_create_nonce( 'add-attribute' ),
|
||||
'save_attributes_nonce' => wp_create_nonce( 'save-attributes' ),
|
||||
'add_attributes_and_variations' => wp_create_nonce( 'add-attributes-and-variations' ),
|
||||
'calc_totals_nonce' => wp_create_nonce( 'calc-totals' ),
|
||||
'get_customer_details_nonce' => wp_create_nonce( 'get-customer-details' ),
|
||||
'search_products_nonce' => wp_create_nonce( 'search-products' ),
|
||||
'grant_access_nonce' => wp_create_nonce( 'grant-access' ),
|
||||
'revoke_access_nonce' => wp_create_nonce( 'revoke-access' ),
|
||||
'add_order_note_nonce' => wp_create_nonce( 'add-order-note' ),
|
||||
'delete_order_note_nonce' => wp_create_nonce( 'delete-order-note' ),
|
||||
'calendar_image' => WC()->plugin_url() . '/assets/images/calendar.png',
|
||||
'post_id' => $this->is_order_meta_box_screen( $screen_id ) && isset( $order_or_post_object ) ? \Automattic\WooCommerce\Utilities\OrderUtil::get_post_or_order_id( $order_or_post_object ) : $post_id,
|
||||
'base_country' => WC()->countries->get_base_country(),
|
||||
'currency_format_num_decimals' => wc_get_price_decimals(),
|
||||
'currency_format_symbol' => get_woocommerce_currency_symbol( $currency ),
|
||||
'currency_format_decimal_sep' => esc_attr( wc_get_price_decimal_separator() ),
|
||||
'currency_format_thousand_sep' => esc_attr( wc_get_price_thousand_separator() ),
|
||||
'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), // For accounting JS.
|
||||
'rounding_precision' => wc_get_rounding_precision(),
|
||||
'tax_rounding_mode' => wc_get_tax_rounding_mode(),
|
||||
'product_types' => array_unique( array_merge( array( 'simple', 'grouped', 'variable', 'external' ), array_keys( wc_get_product_types() ) ) ),
|
||||
'i18n_download_permission_fail' => __( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ),
|
||||
'i18n_permission_revoke' => __( 'Are you sure you want to revoke access to this download?', 'woocommerce' ),
|
||||
'i18n_tax_rate_already_exists' => __( 'You cannot add the same tax rate twice!', 'woocommerce' ),
|
||||
'i18n_delete_note' => __( 'Are you sure you wish to delete this note? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_apply_coupon' => __( 'Enter a coupon code to apply. Discounts are applied to line totals, before taxes.', 'woocommerce' ),
|
||||
'i18n_add_fee' => __( 'Enter a fixed amount or percentage to apply as a fee.', 'woocommerce' ),
|
||||
'i18n_attribute_name_placeholder' => __( 'New attribute', 'woocommerce' ),
|
||||
'i18n_product_simple_tip' => __( '<b>Simple –</b> covers the vast majority of any products you may sell. Simple products are shipped and have no options. For example, a book.', 'woocommerce' ),
|
||||
'i18n_product_grouped_tip' => __( '<b>Grouped –</b> a collection of related products that can be purchased individually and only consist of simple products. For example, a set of six drinking glasses.', 'woocommerce' ),
|
||||
'i18n_product_external_tip' => __( '<b>External or Affiliate –</b> one that you list and describe on your website but is sold elsewhere.', 'woocommerce' ),
|
||||
'i18n_product_variable_tip' => __( '<b>Variable –</b> a product with variations, each of which may have a different SKU, price, stock option, etc. For example, a t-shirt available in different colors and/or sizes.', 'woocommerce' ),
|
||||
'i18n_product_other_tip' => __( 'Product types define available product details and attributes, such as downloadable files and variations. They’re also used for analytics and inventory management.', 'woocommerce' ),
|
||||
'i18n_product_description_tip' => __( 'Describe this product. What makes it unique? What are its most important features?', 'woocommerce' ),
|
||||
'i18n_product_short_description_tip' => __( 'Summarize this product in 1-2 short sentences. We’ll show it at the top of the page.', 'woocommerce' ),
|
||||
'i18n_save_attribute_variation_tip' => __( 'Make sure you enter the name and values for each attribute.', 'woocommerce' ),
|
||||
/* translators: %1$s: maximum file size */
|
||||
'i18n_product_image_tip' => sprintf( __( 'For best results, upload JPEG or PNG files that are 1000 by 1000 pixels or larger. Maximum upload file size: %1$s.', 'woocommerce' ) , size_format( wp_max_upload_size() ) ),
|
||||
'i18n_product_image_tip' => sprintf( __( 'For best results, upload JPEG or PNG files that are 1000 by 1000 pixels or larger. Maximum upload file size: %1$s.', 'woocommerce' ), size_format( wp_max_upload_size() ) ),
|
||||
'i18n_remove_used_attribute_confirmation_message' => __( 'If you remove this attribute, customers will no longer be able to purchase some variations of this product.', 'woocommerce' ),
|
||||
'i18n_add_attribute_error_notice' => __( 'Adding new attribute failed.', 'woocommerce' ),
|
||||
'i18n_add_attribute_error_notice' => __( 'Adding new attribute failed.', 'woocommerce' ),
|
||||
/* translators: %s: WC_DELIMITER */
|
||||
'i18n_attributes_default_placeholder' => sprintf( esc_attr__( 'Enter some descriptive text. Use “%s” to separate different values.', 'woocommerce' ), esc_attr( WC_DELIMITER ) ),
|
||||
'i18n_attributes_used_for_variations_placeholder' => sprintf( esc_attr__( 'Enter options for customers to choose from, f.e. “Blue” or “Large”. Use “%s” to separate different options.', 'woocommerce' ), esc_attr( WC_DELIMITER ) )
|
||||
);
|
||||
|
||||
wp_localize_script( 'wc-admin-meta-boxes', 'woocommerce_admin_meta_boxes', $params );
|
||||
@@ -549,7 +552,6 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
);
|
||||
wp_enqueue_script( 'marketplace-suggestions' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ class WC_Admin_Help {
|
||||
'<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://woocommerce.com/storefront/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official theme', '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>'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,14 @@
|
||||
* @version 2.5.0
|
||||
*/
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\Features;
|
||||
use Automattic\WooCommerce\Admin\PageController;
|
||||
use Automattic\WooCommerce\Internal\Admin\Marketplace;
|
||||
use Automattic\WooCommerce\Internal\Admin\Orders\COTRedirectionController;
|
||||
use Automattic\WooCommerce\Internal\Admin\Orders\PageController as Custom_Orders_PageController;
|
||||
use Automattic\WooCommerce\Internal\Admin\WCAdminAssets;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
||||
use Automattic\WooCommerce\Admin\Features\Features;
|
||||
use Automattic\WooCommerce\Utilities\FeaturesUtil;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
@@ -22,6 +26,13 @@ if ( class_exists( 'WC_Admin_Menus', false ) ) {
|
||||
*/
|
||||
class WC_Admin_Menus {
|
||||
|
||||
/**
|
||||
* The CSS classes used to hide the submenu items in navigation.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const HIDE_CSS_CLASS = 'hide-if-js';
|
||||
|
||||
/**
|
||||
* Hook in tabs.
|
||||
*/
|
||||
@@ -36,8 +47,23 @@ class WC_Admin_Menus {
|
||||
add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
|
||||
add_action( 'admin_menu', array( $this, 'status_menu' ), 60 );
|
||||
|
||||
/**
|
||||
* Controls whether we add a submenu item for the WooCommerce Addons page.
|
||||
* Woo Express uses this filter.
|
||||
*
|
||||
* @since 8.2.1
|
||||
*
|
||||
* @param bool $show_addons_page If the addons page should be included.
|
||||
*/
|
||||
if ( apply_filters( 'woocommerce_show_addons_page', true ) ) {
|
||||
add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
|
||||
if ( FeaturesUtil::feature_is_enabled( 'marketplace' ) ) {
|
||||
$container = wc_get_container();
|
||||
$container->get( Marketplace::class );
|
||||
|
||||
add_action( 'admin_menu', array( $this, 'addons_my_subscriptions' ), 70 );
|
||||
} else {
|
||||
add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'menu_order', array( $this, 'menu_order' ) );
|
||||
@@ -171,6 +197,18 @@ class WC_Admin_Menus {
|
||||
add_submenu_page( 'woocommerce', __( 'WooCommerce extensions', 'woocommerce' ), $menu_title, 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the wc-addons page within the WooCommerce menu.
|
||||
* Temporary measure till we convert the whole page to React.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addons_my_subscriptions() {
|
||||
add_submenu_page( 'woocommerce', __( 'WooCommerce extensions', 'woocommerce' ), null, 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
|
||||
// Temporarily hide the submenu item we've just added.
|
||||
$this->hide_submenu_page( 'woocommerce', 'wc-addons' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlights the correct top level admin menu item for post type add screens.
|
||||
*/
|
||||
@@ -426,7 +464,7 @@ class WC_Admin_Menus {
|
||||
* Maybe add new management product experience.
|
||||
*/
|
||||
public function maybe_add_new_product_management_experience() {
|
||||
if ( Features::is_enabled( 'new-product-management-experience' ) || \Automattic\WooCommerce\Utilities\FeaturesUtil::feature_is_enabled( 'product_block_editor' ) ) {
|
||||
if ( Features::is_enabled( 'new-product-management-experience' ) || FeaturesUtil::feature_is_enabled( 'product_block_editor' ) ) {
|
||||
global $submenu;
|
||||
if ( isset( $submenu['edit.php?post_type=product'][10] ) ) {
|
||||
// Disable phpcs since we need to override submenu classes.
|
||||
@@ -437,6 +475,58 @@ class WC_Admin_Menus {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the submenu page based on slug and return the item that was hidden.
|
||||
*
|
||||
* Borrowed from Jetpack's Base_Admin_Menu class.
|
||||
*
|
||||
* Instead of actually removing the submenu item, a safer approach is to hide it and filter it in the API response.
|
||||
* In this manner we'll avoid breaking third-party plugins depending on items that no longer exist.
|
||||
*
|
||||
* A false|array value is returned to be consistent with remove_submenu_page() function
|
||||
*
|
||||
* @param string $menu_slug The parent menu slug.
|
||||
* @param string $submenu_slug The submenu slug that should be hidden.
|
||||
* @return false|array
|
||||
*/
|
||||
public function hide_submenu_page( $menu_slug, $submenu_slug ) {
|
||||
global $submenu;
|
||||
|
||||
if ( ! isset( $submenu[ $menu_slug ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $submenu[ $menu_slug ] as $i => $item ) {
|
||||
if ( $submenu_slug !== $item[2] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->hide_submenu_element( $i, $menu_slug, $item );
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the hide-if-js CSS class to a submenu item.
|
||||
*
|
||||
* Borrowed from Jetpack's Base_Admin_Menu class.
|
||||
*
|
||||
* @param int $index The position of a submenu item in the submenu array.
|
||||
* @param string $parent_slug The parent slug.
|
||||
* @param array $item The submenu item.
|
||||
*/
|
||||
public function hide_submenu_element( $index, $parent_slug, $item ) {
|
||||
global $submenu;
|
||||
|
||||
$css_classes = empty( $item[4] ) ? self::HIDE_CSS_CLASS : $item[4] . ' ' . self::HIDE_CSS_CLASS;
|
||||
|
||||
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$submenu [ $parent_slug ][ $index ][4] = $css_classes;
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_Admin_Menus();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
use Automattic\WooCommerce\Internal\Admin\Orders\Edit as OrderEdit;
|
||||
use Automattic\WooCommerce\Utilities\OrderUtil;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
@@ -215,7 +216,7 @@ class WC_Admin_Meta_Boxes {
|
||||
$post_id = absint( $post_id );
|
||||
|
||||
// $post_id and $post are required
|
||||
if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) {
|
||||
if ( empty( $post_id ) || empty( $post ) || ! is_a( $post, 'WP_Post' ) || self::$saved_meta_boxes ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,6 +248,10 @@ class WC_Admin_Meta_Boxes {
|
||||
|
||||
// Check the post type.
|
||||
if ( in_array( $post->post_type, wc_get_order_types( 'order-meta-boxes' ), true ) ) {
|
||||
if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save meta for shop order.
|
||||
*
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
use Automattic\WooCommerce\Internal\Utilities\Users;
|
||||
use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods;
|
||||
use Automattic\WooCommerce\Internal\Utilities\Users;
|
||||
use Automattic\WooCommerce\Internal\Utilities\WebhookUtil;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
@@ -39,7 +40,6 @@ class WC_Admin_Notices {
|
||||
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
|
||||
'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
|
||||
'no_secure_connection' => 'secure_connection_notice',
|
||||
WC_PHP_MIN_REQUIREMENTS_NOTICE => 'wp_php_min_requirements_notice',
|
||||
'maxmind_license_key' => 'maxmind_missing_license_key_notice',
|
||||
'redirect_download_method' => 'redirect_download_method_notice',
|
||||
'uploads_directory_is_unprotected' => 'uploads_directory_is_unprotected_notice',
|
||||
@@ -57,7 +57,7 @@ class WC_Admin_Notices {
|
||||
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
|
||||
add_action( 'wp_loaded', array( __CLASS__, 'add_redirect_download_method_notice' ) );
|
||||
add_action( 'admin_init', array( __CLASS__, 'hide_notices' ), 20 );
|
||||
self::add_action( 'admin_init', array( __CLASS__, 'maybe_remove_php74_required_notice' ) );
|
||||
self::add_action( 'admin_init', array( __CLASS__, 'maybe_remove_legacy_api_removal_notice' ), 20 );
|
||||
|
||||
// @TODO: This prevents Action Scheduler async jobs from storing empty list of notices during WC installation.
|
||||
// That could lead to OBW not starting and 'Run setup wizard' notice not appearing in WP admin, which we want
|
||||
@@ -120,48 +120,77 @@ class WC_Admin_Notices {
|
||||
self::add_notice( 'template_files' );
|
||||
self::add_min_version_notice();
|
||||
self::add_maxmind_missing_license_key_notice();
|
||||
self::maybe_add_php74_required_notice();
|
||||
self::maybe_add_legacy_api_removal_notice();
|
||||
}
|
||||
|
||||
// phpcs:disable Generic.Commenting.Todo.TaskFound
|
||||
|
||||
/**
|
||||
* Add an admin notice about the bump of the required PHP version in WooCommerce 8.2
|
||||
* if the current PHP version is too old.
|
||||
* Add an admin notice about the removal of the Legacy REST API if the said API is enabled,
|
||||
* and a notice about soon to be unsupported webhooks with Legacy API payload if at least one of these exist.
|
||||
*
|
||||
* TODO: Remove this method in WooCommerce 8.2.
|
||||
* TODO: Change this method in WooCommerce 9.0 so that it checks if the Legacy REST API extension is installed, and if not, it points to the extension URL in the WordPress plugins directory.
|
||||
*/
|
||||
private static function maybe_add_php74_required_notice() {
|
||||
if ( version_compare( phpversion(), '7.4', '>=' ) ) {
|
||||
private static function maybe_add_legacy_api_removal_notice() {
|
||||
if ( is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::add_custom_notice(
|
||||
'php74_required_in_woo_82',
|
||||
sprintf(
|
||||
'%s%s',
|
||||
if ( 'yes' === get_option( 'woocommerce_api_enabled' ) ) {
|
||||
self::add_custom_notice(
|
||||
'legacy_api_removed_in_woo_90',
|
||||
sprintf(
|
||||
'<h4>%s</h4>',
|
||||
esc_html__( 'PHP version requirements will change soon', 'woocommerce' )
|
||||
),
|
||||
sprintf(
|
||||
// translators: Placeholder is a URL.
|
||||
wpautop( wp_kses_data( __( 'WooCommerce 8.2, scheduled for <b>October 2023</b>, will require PHP 7.4 or newer to work. Your server is currently running an older version of PHP, so this change will impact your store. Upgrading to at least PHP 8.0 is recommended. <b><a href="%s">Learn more about this change.</a></b>', 'woocommerce' ) ) ),
|
||||
'https://developer.woocommerce.com/2023/06/05/new-requirement-for-woocommerce-8-2-php-7-4/'
|
||||
'%s%s',
|
||||
sprintf(
|
||||
'<h4>%s</h4>',
|
||||
esc_html__( 'The WooCommerce Legacy REST API will be removed soon', 'woocommerce' )
|
||||
),
|
||||
sprintf(
|
||||
// translators: Placeholders are URLs.
|
||||
wpautop( wp_kses_data( __( 'The WooCommerce Legacy REST API, <a href="%1$s">currently enabled in this site</a>, will be removed in WooCommerce 9.0. A separate WooCommerce extension will be available to keep it enabled. <b><a target=”_blank” href="%2$s">Learn more about this change.</a></b>', 'woocommerce' ) ) ),
|
||||
admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=legacy_api' ),
|
||||
'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
if ( wc_get_container()->get( WebhookUtil::class )->get_legacy_webhooks_count() > 0 ) {
|
||||
self::add_custom_notice(
|
||||
'legacy_webhooks_unsupported_in_woo_90',
|
||||
sprintf(
|
||||
'%s%s',
|
||||
sprintf(
|
||||
'<h4>%s</h4>',
|
||||
esc_html__( 'WooCommerce webhooks that use the Legacy REST API will be unsupported soon', 'woocommerce' )
|
||||
),
|
||||
sprintf(
|
||||
// translators: Placeholders are URLs.
|
||||
wpautop( wp_kses_data( __( '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 separate WooCommerce extension will be available 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="%2$s">Learn more about this change.</a></b>', 'woocommerce' ) ) ),
|
||||
admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&legacy=true' ),
|
||||
'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the admin notice about the bump of the required PHP version in WooCommerce 8.2
|
||||
* if the current PHP version is good.
|
||||
* Remove the admin notice about the removal of the Legacy REST API if the said API is disabled
|
||||
* 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: Remove this method in WooCommerce 8.2.
|
||||
* TODO: Change this method in WooCommerce 9.0 so that the notice gets removed if the Legacy REST API extension is installed and active.
|
||||
*/
|
||||
private static function maybe_remove_php74_required_notice() {
|
||||
if ( version_compare( phpversion(), '7.4', '>=' ) && self::has_notice( 'php74_required_in_woo_82' ) ) {
|
||||
self::remove_notice( 'php74_required_in_woo_82' );
|
||||
private static function maybe_remove_legacy_api_removal_notice() {
|
||||
$plugin_is_active = is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' );
|
||||
|
||||
if ( self::has_notice( 'legacy_api_removed_in_woo_90' ) && ( $plugin_is_active || 'yes' !== get_option( 'woocommerce_api_enabled' ) ) ) {
|
||||
self::remove_notice( 'legacy_api_removed_in_woo_90' );
|
||||
}
|
||||
|
||||
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' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,45 +504,12 @@ class WC_Admin_Notices {
|
||||
/**
|
||||
* Notice about WordPress and PHP minimum requirements.
|
||||
*
|
||||
* @deprecated 8.2.0 WordPress and PHP minimum requirements notices are no longer shown.
|
||||
*
|
||||
* @since 3.6.5
|
||||
* @return void
|
||||
*/
|
||||
public static function wp_php_min_requirements_notice() {
|
||||
if ( apply_filters( 'woocommerce_hide_php_wp_nag', get_user_meta( get_current_user_id(), 'dismissed_' . WC_PHP_MIN_REQUIREMENTS_NOTICE . '_notice', true ) ) ) {
|
||||
self::remove_notice( WC_PHP_MIN_REQUIREMENTS_NOTICE );
|
||||
return;
|
||||
}
|
||||
|
||||
$old_php = version_compare( phpversion(), WC_NOTICE_MIN_PHP_VERSION, '<' );
|
||||
$old_wp = version_compare( get_bloginfo( 'version' ), WC_NOTICE_MIN_WP_VERSION, '<' );
|
||||
|
||||
// Both PHP and WordPress up to date version => no notice.
|
||||
if ( ! $old_php && ! $old_wp ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $old_php && $old_wp ) {
|
||||
$msg = sprintf(
|
||||
/* translators: 1: Minimum PHP version 2: Minimum WordPress version */
|
||||
__( 'Update required: WooCommerce will soon require PHP version %1$s and WordPress version %2$s or newer.', 'woocommerce' ),
|
||||
WC_NOTICE_MIN_PHP_VERSION,
|
||||
WC_NOTICE_MIN_WP_VERSION
|
||||
);
|
||||
} elseif ( $old_php ) {
|
||||
$msg = sprintf(
|
||||
/* translators: %s: Minimum PHP version */
|
||||
__( 'Update required: WooCommerce will soon require PHP version %s or newer.', 'woocommerce' ),
|
||||
WC_NOTICE_MIN_PHP_VERSION
|
||||
);
|
||||
} elseif ( $old_wp ) {
|
||||
$msg = sprintf(
|
||||
/* translators: %s: Minimum WordPress version */
|
||||
__( 'Update required: WooCommerce will soon require WordPress version %s or newer.', 'woocommerce' ),
|
||||
WC_NOTICE_MIN_WP_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
include dirname( __FILE__ ) . '/views/html-notice-wp-php-minimum-requirements.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -200,7 +200,7 @@ class WC_Admin_Post_Types {
|
||||
9 => sprintf(
|
||||
/* translators: %s: date */
|
||||
__( 'Order scheduled for: %s.', 'woocommerce' ),
|
||||
'<strong>' . date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $theorder->get_date_created() ) ) . '</strong>'
|
||||
'<strong>' . date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $theorder->get_date_created() ?? $post->post_date ) ) . '</strong>'
|
||||
),
|
||||
10 => __( 'Order draft updated.', 'woocommerce' ),
|
||||
11 => __( 'Order updated and sent.', 'woocommerce' ),
|
||||
|
||||
@@ -240,6 +240,12 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
if ( ! isset( $value['placeholder'] ) ) {
|
||||
$value['placeholder'] = '';
|
||||
}
|
||||
if ( ! isset( $value['row_class'] ) ) {
|
||||
$value['row_class'] = '';
|
||||
}
|
||||
if ( ! empty( $value['row_class'] ) && substr( $value['row_class'], 0, 16 ) !== 'wc-settings-row-' ) {
|
||||
$value['row_class'] = 'wc-settings-row-' . $value['row_class'];
|
||||
}
|
||||
if ( ! isset( $value['suffix'] ) ) {
|
||||
$value['suffix'] = '';
|
||||
}
|
||||
@@ -281,7 +287,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
break;
|
||||
|
||||
case 'info':
|
||||
echo '<tr><th scope="row" class="titledesc"/><td style="' . esc_attr( $value['css'] ) . '">';
|
||||
?><tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc"/><td style="<?php echo esc_attr( $value['css'] ); ?>">;
|
||||
<?php
|
||||
echo wp_kses_post( wpautop( wptexturize( $value['text'] ) ) );
|
||||
echo '</td></tr>';
|
||||
break;
|
||||
@@ -312,7 +320,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
case 'tel':
|
||||
$option_value = $value['value'];
|
||||
|
||||
?><tr valign="top">
|
||||
?><tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -337,7 +345,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
$option_value = $value['value'];
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -365,7 +373,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
$option_value = $value['value'];
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -391,7 +399,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
$option_value = $value['value'];
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -434,7 +442,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
$show_desc_at_end = $value['desc_at_end'] ?? false;
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -494,6 +502,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
if ( 'option' === $value['show_if_checked'] ) {
|
||||
$visibility_class[] = 'show_options_if_checked';
|
||||
}
|
||||
if ( $value['row_class'] ) {
|
||||
$visibility_class[] = $value['row_class'];
|
||||
}
|
||||
|
||||
$must_disable = $value['disabled'] ?? false;
|
||||
|
||||
@@ -566,7 +577,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
}
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html . $disabled_message; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -600,7 +611,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
}
|
||||
|
||||
?>
|
||||
<tr valign="top" class="single_select_page">
|
||||
<tr valign="top" class="single_select_page"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -625,7 +636,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
);
|
||||
}
|
||||
?>
|
||||
<tr valign="top" class="single_select_page">
|
||||
<tr valign="top" class="single_select_page"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></label>
|
||||
</th>
|
||||
@@ -665,7 +676,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
$state = '*';
|
||||
}
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -689,7 +700,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
|
||||
asort( $countries );
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
@@ -718,7 +729,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
);
|
||||
$option_value = wc_parse_relative_date_option( $value['value'] );
|
||||
?>
|
||||
<tr valign="top">
|
||||
<tr valign="top"<?php echo $value['row_class'] ? ' class="' . esc_attr( $value['row_class'] ) . '"' : '' ?>">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
use Automattic\WooCommerce\Internal\Utilities\WebhookUtil;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'WP_List_Table' ) ) {
|
||||
@@ -174,7 +176,8 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||
$num_webhooks = $data_store->get_count_webhooks_by_status();
|
||||
$total_webhooks = array_sum( (array) $num_webhooks );
|
||||
$statuses = array_keys( wc_get_webhook_statuses() );
|
||||
$class = empty( $_REQUEST['status'] ) ? ' class="current"' : ''; // WPCS: input var okay. CSRF ok.
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$class = empty( $_REQUEST['status'] ) && empty( $_REQUEST['legacy'] ) ? ' class="current"' : '';
|
||||
|
||||
/* translators: %s: count */
|
||||
$status_links['all'] = "<a href='admin.php?page=wc-settings&tab=advanced&section=webhooks'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_webhooks, 'posts', 'woocommerce' ), number_format_i18n( $total_webhooks ) ) . '</a>';
|
||||
@@ -186,7 +189,8 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['status'] ) && sanitize_key( wp_unslash( $_REQUEST['status'] ) ) === $status_name ) { // WPCS: input var okay, CSRF ok.
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_REQUEST['status'] ) && sanitize_key( wp_unslash( $_REQUEST['status'] ) ) === $status_name ) {
|
||||
$class = ' class="current"';
|
||||
}
|
||||
|
||||
@@ -195,6 +199,20 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||
$status_links[ $status_name ] = "<a href='admin.php?page=wc-settings&tab=advanced&section=webhooks&status=$status_name'$class>" . sprintf( translate_nooped_plural( $label, $num_webhooks[ $status_name ] ), number_format_i18n( $num_webhooks[ $status_name ] ) ) . '</a>';
|
||||
}
|
||||
|
||||
$legacy_webhooks_count = wc_get_container()->get( WebhookUtil::class )->get_legacy_webhooks_count();
|
||||
if ( $legacy_webhooks_count > 0 ) {
|
||||
$class = '';
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( 'true' === sanitize_key( wp_unslash( $_REQUEST['legacy'] ?? '' ) ) ) {
|
||||
$class = ' class="current"';
|
||||
}
|
||||
|
||||
$label = $this->get_status_label( __( 'Legacy', 'woocommerce' ), $legacy_webhooks_count );
|
||||
|
||||
$status_links['legacy'] = "<a href='admin.php?page=wc-settings&tab=advanced&section=webhooks&legacy=true'$class>" . sprintf( translate_nooped_plural( $label, $legacy_webhooks_count ), number_format_i18n( $legacy_webhooks_count ) ) . '</a>';
|
||||
}
|
||||
|
||||
return $status_links;
|
||||
}
|
||||
|
||||
@@ -216,12 +234,16 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||
$action = $this->current_action();
|
||||
$webhooks = isset( $_REQUEST['webhook'] ) ? array_map( 'absint', (array) $_REQUEST['webhook'] ) : array(); // WPCS: input var okay, CSRF ok.
|
||||
|
||||
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit Webhooks', 'woocommerce' ) );
|
||||
}
|
||||
if ( false !== $action ) {
|
||||
check_admin_referer( 'woocommerce-settings' );
|
||||
|
||||
if ( 'delete' === $action ) {
|
||||
WC_Admin_Webhooks::bulk_delete( $webhooks );
|
||||
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
||||
wp_die( esc_html__( 'You do not have permission to edit Webhooks', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
if ( 'delete' === $action ) {
|
||||
WC_Admin_Webhooks::bulk_delete( $webhooks );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,6 +321,11 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||
|
||||
$args['paginate'] = true;
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( 'true' === sanitize_key( wp_unslash( $_REQUEST['legacy'] ?? null ) ) ) {
|
||||
$args['api_version'] = -1;
|
||||
}
|
||||
|
||||
// Get the webhooks.
|
||||
$data_store = WC_Data_Store::load( 'webhook' );
|
||||
$webhooks = $data_store->search_webhooks( $args );
|
||||
|
||||
@@ -295,7 +295,7 @@ class WC_Admin_Webhooks {
|
||||
private static function table_list_output() {
|
||||
global $webhooks_table_list;
|
||||
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=0' ) ) . '" class="add-new-h2">' . esc_html__( 'Add webhook', 'woocommerce' ) . '</a></h2>';
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=0' ) ) . '" class="page-title-action">' . esc_html__( 'Add webhook', 'woocommerce' ) . '</a></h2>';
|
||||
|
||||
// Get the webhooks count.
|
||||
$data_store = WC_Data_Store::load( 'webhook' );
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* WooCommerce Admin Helper - React admin interface
|
||||
*
|
||||
* @package WooCommerce\Admin\Helper
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Helper Class
|
||||
*
|
||||
* The main entry-point for all things related to the Helper.
|
||||
* The Helper manages the connection between the store and
|
||||
* an account on WooCommerce.com.
|
||||
*/
|
||||
class WC_Helper_Admin {
|
||||
|
||||
/**
|
||||
* Loads the class, runs on init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function load() {
|
||||
add_filter( 'woocommerce_admin_shared_settings', array( __CLASS__, 'add_marketplace_settings' ) );
|
||||
add_filter( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes settings onto the WooCommerce Admin global settings object (wcSettings).
|
||||
*
|
||||
* @param mixed $settings The settings object we're amending.
|
||||
*
|
||||
* @return mixed $settings
|
||||
*/
|
||||
public static function add_marketplace_settings( $settings ) {
|
||||
$auth_user_data = WC_Helper_Options::get( 'auth_user_data', array() );
|
||||
$auth_user_email = isset( $auth_user_data['email'] ) ? $auth_user_data['email'] : '';
|
||||
|
||||
$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(),
|
||||
);
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public static function get_connection_url() {
|
||||
// No active connection.
|
||||
if ( ! WC_Helper::is_site_connected() ) {
|
||||
$connect_url = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-connect' => 1,
|
||||
'wc-helper-nonce' => wp_create_nonce( 'connect' ),
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
|
||||
return $connect_url;
|
||||
}
|
||||
|
||||
$connect_url = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-disconnect' => 1,
|
||||
'wc-helper-nonce' => wp_create_nonce( 'disconnect' ),
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
|
||||
return $connect_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the REST routes for the featured products endpoint.
|
||||
* This endpoint is used by the WooCommerce > Extensions > Discover
|
||||
* page.
|
||||
*/
|
||||
public static function register_rest_routes() {
|
||||
register_rest_route(
|
||||
'wc/v3',
|
||||
'/marketplace/featured',
|
||||
array(
|
||||
'methods' => 'GET',
|
||||
'callback' => array( __CLASS__, 'get_featured' ),
|
||||
'permission_callback' => array( __CLASS__, 'get_permission' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Extensions page can only be accessed by users with the manage_woocommerce
|
||||
* capability. So the API mimics that behavior.
|
||||
*/
|
||||
public static function get_permission() {
|
||||
return current_user_can( 'manage_woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch featured procucts from WooCommerce.com and serve them
|
||||
* as JSON.
|
||||
*/
|
||||
public static function get_featured() {
|
||||
$featured = WC_Admin_Addons::fetch_featured();
|
||||
|
||||
if ( is_wp_error( $featured ) ) {
|
||||
wp_send_json_error( array( 'message' => $featured->get_error_message() ) );
|
||||
}
|
||||
|
||||
wp_send_json( $featured );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WC_Helper_Admin::load();
|
||||
@@ -68,17 +68,21 @@ class WC_Helper_Updater {
|
||||
$item['package'] = 'woocommerce-com-expired-' . $plugin['_product_id'];
|
||||
}
|
||||
|
||||
if ( version_compare( $plugin['Version'], $data['version'], '<' ) ) {
|
||||
$transient->response[ $filename ] = (object) $item;
|
||||
unset( $transient->no_update[ $filename ] );
|
||||
} else {
|
||||
$transient->no_update[ $filename ] = (object) $item;
|
||||
unset( $transient->response[ $filename ] );
|
||||
if ( $transient instanceof stdClass ) {
|
||||
if ( version_compare( $plugin['Version'], $data['version'], '<' ) ) {
|
||||
$transient->response[ $filename ] = (object) $item;
|
||||
unset( $transient->no_update[ $filename ] );
|
||||
} else {
|
||||
$transient->no_update[ $filename ] = (object) $item;
|
||||
unset( $transient->response[ $filename ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$translations = self::get_translations_update_data();
|
||||
$transient->translations = array_merge( isset( $transient->translations ) ? $transient->translations : array(), $translations );
|
||||
if ( $transient instanceof stdClass ) {
|
||||
$translations = self::get_translations_update_data();
|
||||
$transient->translations = array_merge( isset( $transient->translations ) ? $transient->translations : array(), $translations );
|
||||
}
|
||||
|
||||
return $transient;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ class WC_Helper {
|
||||
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';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1198,6 +1199,11 @@ class WC_Helper {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Omit the WooCommerce plugin used on Woo Express sites.
|
||||
if ( 'WooCommerce' === $data['Name'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data['_filename'] = $filename;
|
||||
$data['_product_id'] = absint( $product_id );
|
||||
$data['_file_id'] = $file_id;
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
$class_html = $current_filter === $key ? 'class="current"' : '';
|
||||
?>
|
||||
<li>
|
||||
<a <?php echo esc_html( $class_html ); ?> href="<?php echo esc_url( $url ); ?>">
|
||||
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<a <?php echo $class_html; ?> href="<?php echo esc_url( $url ); ?>">
|
||||
<?php echo esc_html( $label ); ?>
|
||||
<span class="count">(<?php echo absint( $counts[ $key ] ); ?>)</span>
|
||||
</a>
|
||||
|
||||
@@ -7,10 +7,17 @@
|
||||
* @deprecated 5.7.0
|
||||
*/
|
||||
|
||||
use Automattic\WooCommerce\Utilities\FeaturesUtil;
|
||||
|
||||
$addons_url = admin_url( 'admin.php?page=wc-addons' );
|
||||
if ( FeaturesUtil::feature_is_enabled( 'marketplace' ) ) {
|
||||
$addons_url = admin_url( 'admin.php?page=wc-admin&path=/extensions&tab=extensions' );
|
||||
}
|
||||
|
||||
defined( 'ABSPATH' ) || exit(); ?>
|
||||
|
||||
<nav class="nav-tab-wrapper woo-nav-tab-wrapper">
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons' ) ); ?>" class="nav-tab"><?php esc_html_e( 'Browse Extensions', 'woocommerce' ); ?></a>
|
||||
<a href="<?php echo esc_url( $addons_url ); ?>" class="nav-tab"><?php esc_html_e( 'Browse Extensions', 'woocommerce' ); ?></a>
|
||||
|
||||
<?php
|
||||
$count_html = WC_Helper_Updater::get_updates_count_html();
|
||||
|
||||
@@ -103,7 +103,7 @@ class WC_Meta_Box_Order_Actions {
|
||||
$trash_order_url = add_query_arg(
|
||||
array(
|
||||
'action' => 'trash',
|
||||
'order' => array( $order_id ),
|
||||
'id' => array( $order_id ),
|
||||
'_wp_http_referer' => $order_list_url,
|
||||
),
|
||||
$order_list_url
|
||||
|
||||
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<select multiple="multiple"
|
||||
data-minimum_input_length="0"
|
||||
data-limit="50" data-return_id="id"
|
||||
data-placeholder="<?php esc_attr_e( 'Select terms', 'woocommerce' ); ?>"
|
||||
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"
|
||||
name="attribute_values[<?php echo esc_attr( $i ); ?>][]"
|
||||
@@ -79,7 +79,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
do_action( 'woocommerce_product_option_terms', $attribute_taxonomy, $i, $attribute );
|
||||
} else {
|
||||
?>
|
||||
<textarea name="attribute_values[<?php echo esc_attr( $i ); ?>]" cols="5" rows="5" placeholder="<?php /* translators: %s: WC_DELIMITER */ printf( esc_attr__( 'Enter options for customers to choose from, f.e. “Blue” or “Large”. Use “%s” to separate different options.', 'woocommerce' ), esc_attr( WC_DELIMITER ) ); ?>"><?php echo esc_textarea( wc_implode_text_attributes( $attribute->get_options() ) ); ?></textarea>
|
||||
<textarea name="attribute_values[<?php echo esc_attr( $i ); ?>]" cols="5" rows="5"><?php echo esc_textarea( wc_implode_text_attributes( $attribute->get_options() ) ); ?></textarea>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -17,14 +17,15 @@ $product_attributes = $product_object->get_attributes( 'edit' );
|
||||
?>
|
||||
<div id="product_attributes" class="panel wc-metaboxes-wrapper hidden">
|
||||
<div class="toolbar toolbar-top">
|
||||
<div id="message" class="inline notice woocommerce-message">
|
||||
<p>
|
||||
<div id="message" class="inline notice woocommerce-message is-dismissible">
|
||||
<p class="help">
|
||||
<?php
|
||||
esc_html_e(
|
||||
'Add descriptive pieces of information that customers can use to search for this product on your store, such as “Material” or “Brand”.',
|
||||
'woocommerce'
|
||||
);
|
||||
?>
|
||||
<button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'woocommerce' ); ?></span></button>
|
||||
</p>
|
||||
</div>
|
||||
<span class="expand-close">
|
||||
|
||||
@@ -10,13 +10,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
?>
|
||||
<div id="inventory_product_data" class="panel woocommerce_options_panel hidden">
|
||||
<div class="inline notice woocommerce-message show_if_variable">
|
||||
<p>
|
||||
<?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>
|
||||
<div class="options_group">
|
||||
<?php
|
||||
$info_img_url = WC_ADMIN_IMAGES_FOLDER_URL . '/icons/info.svg';
|
||||
|
||||
if ( wc_product_sku_enabled() ) {
|
||||
woocommerce_wp_text_input(
|
||||
array(
|
||||
@@ -31,6 +28,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
do_action( 'woocommerce_product_options_sku' );
|
||||
|
||||
?>
|
||||
<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://woocommerce.com/document/variable-product/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
|
||||
|
||||
woocommerce_wp_checkbox(
|
||||
@@ -69,8 +75,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
'value' => $product_object->get_backorders( 'edit' ),
|
||||
'label' => __( 'Allow backorders?', 'woocommerce' ),
|
||||
'options' => wc_get_product_backorder_options(),
|
||||
'desc_tip' => true,
|
||||
'description' => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ),
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,7 +63,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
array(
|
||||
'title' => __( 'Cart page', 'woocommerce' ),
|
||||
/* Translators: %s Page contents. */
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_cart_shortcode_tag', 'woocommerce_cart' ) ),
|
||||
'desc' => __( 'Page where shoppers review their shopping cart', 'woocommerce' ),
|
||||
'id' => 'woocommerce_cart_page_id',
|
||||
'type' => 'single_select_page_with_search',
|
||||
'default' => '',
|
||||
@@ -83,7 +83,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
array(
|
||||
'title' => __( 'Checkout page', 'woocommerce' ),
|
||||
/* Translators: %s Page contents. */
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_checkout_shortcode_tag', 'woocommerce_checkout' ) ),
|
||||
'desc' => __( 'Page where shoppers go to finalize their purchase', 'woocommerce' ),
|
||||
'id' => 'woocommerce_checkout_page_id',
|
||||
'type' => 'single_select_page_with_search',
|
||||
'default' => wc_get_page_id( 'checkout' ),
|
||||
@@ -383,6 +383,25 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_settings_for_legacy_api_section() {
|
||||
$enable_legacy_api_setting = array(
|
||||
'title' => __( 'Legacy API', 'woocommerce' ),
|
||||
'desc' => __( 'Enable the legacy REST API', 'woocommerce' ),
|
||||
'id' => 'woocommerce_api_enabled',
|
||||
'type' => 'checkbox',
|
||||
'default' => 'no',
|
||||
);
|
||||
|
||||
if ( ! is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' ) ) {
|
||||
$enable_legacy_api_setting['desc_tip'] = sprintf(
|
||||
// translators: Placeholder is a URL.
|
||||
__(
|
||||
'⚠️ <b>️The Legacy REST API will be removed in WooCommerce 9.0.</b> A separate WooCommerce extension will soon be available to keep it enabled. <b><a target=”_blank” href="%s">Learn more about this change.</a></b>',
|
||||
'woocommerce'
|
||||
),
|
||||
'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
|
||||
);
|
||||
}
|
||||
|
||||
$settings =
|
||||
array(
|
||||
array(
|
||||
@@ -391,13 +410,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
'desc' => '',
|
||||
'id' => 'legacy_api_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Legacy API', 'woocommerce' ),
|
||||
'desc' => __( 'Enable the legacy REST API', 'woocommerce' ),
|
||||
'id' => 'woocommerce_api_enabled',
|
||||
'type' => 'checkbox',
|
||||
'default' => 'no',
|
||||
),
|
||||
$enable_legacy_api_setting,
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'legacy_api_options',
|
||||
|
||||
@@ -136,10 +136,9 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
|
||||
|
||||
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
|
||||
<?php
|
||||
$storefront_url = WC_Admin_Addons::add_in_app_purchase_url_params( 'https://woocommerce.com/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">
|
||||
<a href="<?php echo esc_url( $storefront_url ); ?>" target="_blank"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/storefront.png" alt="<?php esc_attr_e( 'Storefront', 'woocommerce' ); ?>" /></a>
|
||||
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
|
||||
<p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p>
|
||||
<p><?php echo wp_kses_post( __( 'Storefront is an intuitive, flexible and <strong>free</strong> WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ) ); ?></p>
|
||||
|
||||
@@ -244,25 +244,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, Cons
|
||||
<td data-export-label="PHP Version"><?php esc_html_e( 'PHP version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of PHP installed on your hosting server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( version_compare( $environment['php_version'], '7.2', '>=' ) ) {
|
||||
echo '<mark class="yes">' . esc_html( $environment['php_version'] ) . '</mark>';
|
||||
} else {
|
||||
$update_link = ' <a href="https://docs.woocommerce.com/document/how-to-update-your-php-version/" target="_blank">' . esc_html__( 'How to update your PHP version', 'woocommerce' ) . '</a>';
|
||||
$class = 'error';
|
||||
|
||||
if ( version_compare( $environment['php_version'], '5.4', '<' ) ) {
|
||||
$notice = '<span class="dashicons dashicons-warning"></span> ' . __( 'WooCommerce will run under this version of PHP, however, some features such as geolocation are not compatible. Support for this version will be dropped in the next major release. We recommend using PHP version 7.2 or above for greater performance and security.', 'woocommerce' ) . $update_link;
|
||||
} elseif ( version_compare( $environment['php_version'], '5.6', '<' ) ) {
|
||||
$notice = '<span class="dashicons dashicons-warning"></span> ' . __( 'WooCommerce will run under this version of PHP, however, it has reached end of life. We recommend using PHP version 7.2 or above for greater performance and security.', 'woocommerce' ) . $update_link;
|
||||
} elseif ( version_compare( $environment['php_version'], '7.2', '<' ) ) {
|
||||
$notice = __( 'We recommend using PHP version 7.2 or above for greater performance and security.', 'woocommerce' ) . $update_link;
|
||||
$class = 'recommendation';
|
||||
}
|
||||
|
||||
echo '<mark class="' . esc_attr( $class ) . '">' . esc_html( $environment['php_version'] ) . ' - ' . wp_kses_post( $notice ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
<?php echo '<mark class="yes">' . esc_html( $environment['php_version'] ) . '</mark>'; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( function_exists( 'ini_get' ) ) : ?>
|
||||
|
||||
Reference in New Issue
Block a user