Merged in feature/117-dev-dev01 (pull request #8)
auto-patch 117-dev-dev01-2023-12-15T16_09_06 * auto-patch 117-dev-dev01-2023-12-15T16_09_06
This commit is contained in:
@@ -327,16 +327,16 @@ class WC_Admin_Addons {
|
||||
|
||||
if ( 'storefront' === $template ) {
|
||||
if ( 'storefront' === $stylesheet ) {
|
||||
$url = 'https://woocommerce.com/product-category/themes/storefront-child-theme-themes/';
|
||||
$url = 'https://woo.com/product-category/themes/storefront-child-theme-themes/';
|
||||
$text = __( 'Need a fresh look? Try Storefront child themes', 'woocommerce' );
|
||||
$utm_content = 'nostorefrontchildtheme';
|
||||
} else {
|
||||
$url = 'https://woocommerce.com/product-category/themes/storefront-child-theme-themes/';
|
||||
$url = 'https://woo.com/product-category/themes/storefront-child-theme-themes/';
|
||||
$text = __( 'View more Storefront child themes', 'woocommerce' );
|
||||
$utm_content = 'hasstorefrontchildtheme';
|
||||
}
|
||||
} else {
|
||||
$url = 'https://woocommerce.com/storefront/';
|
||||
$url = 'https://woo.com/storefront/';
|
||||
$text = __( 'Need a theme? Try Storefront', 'woocommerce' );
|
||||
$utm_content = 'nostorefront';
|
||||
}
|
||||
@@ -1026,11 +1026,11 @@ class WC_Admin_Addons {
|
||||
wp_kses_post(
|
||||
/* translators: a url */
|
||||
__(
|
||||
'To start growing your business, head over to <a href="%s">WooCommerce.com</a>, where you\'ll find the most popular WooCommerce extensions.',
|
||||
'To start growing your business, head over to <a href="%s">Woo.com</a>, where you\'ll find the most popular WooCommerce extensions.',
|
||||
'woocommerce'
|
||||
)
|
||||
),
|
||||
'https://woocommerce.com/products/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=connectionerror'
|
||||
'https://woo.com/products/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=connectionerror'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
@@ -1263,7 +1263,7 @@ class WC_Admin_Addons {
|
||||
'title' => $locale->title,
|
||||
'description' => $locale->description,
|
||||
'image' => ( 'http' === substr( $locale->image, 0, 4 ) ) ? $locale->image : WC()->plugin_url() . $locale->image,
|
||||
'image_alt' => $locale->image_alt,
|
||||
'image_alt' => $locale->image_alt ?? '',
|
||||
'actions' => $promotion_actions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
wp_register_script( 'wc-backbone-modal', WC()->plugin_url() . '/assets/js/admin/backbone-modal' . $suffix . '.js', array( 'underscore', 'backbone', 'wp-util' ), $version );
|
||||
wp_register_script( 'wc-shipping-zones', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zones' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select', 'wc-backbone-modal' ), $version );
|
||||
wp_register_script( 'wc-shipping-zone-methods', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zone-methods' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-backbone-modal' ), $version );
|
||||
wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), $version );
|
||||
wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'wc-backbone-modal' ), $version, array( 'in_footer' => false ) );
|
||||
wp_register_script( 'wc-clipboard', WC()->plugin_url() . '/assets/js/admin/wc-clipboard' . $suffix . '.js', array( 'jquery' ), $version );
|
||||
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
|
||||
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.6' );
|
||||
|
||||
@@ -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://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'
|
||||
'https://woo.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 WooCommerce.com, <a href="%2$s">open a support request at WooCommerce.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 Woo.com, <a href="%2$s">open a support request at Woo.com</a>.', 'woocommerce' ),
|
||||
'https://wordpress.org/support/plugin/woocommerce',
|
||||
'https://woocommerce.com/my-account/create-a-ticket/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin'
|
||||
'https://woo.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://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>',
|
||||
'<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>',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -73,11 +73,11 @@ class WC_Admin_Help {
|
||||
|
||||
$screen->set_help_sidebar(
|
||||
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></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://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://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/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>'
|
||||
'<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>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,12 +303,13 @@ class WC_Admin_Importers {
|
||||
} else {
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'position' => $importer->get_file_position(),
|
||||
'percentage' => $percent_complete,
|
||||
'imported' => count( $results['imported'] ),
|
||||
'failed' => count( $results['failed'] ),
|
||||
'updated' => count( $results['updated'] ),
|
||||
'skipped' => count( $results['skipped'] ),
|
||||
'position' => $importer->get_file_position(),
|
||||
'percentage' => $percent_complete,
|
||||
'imported' => count( $results['imported'] ),
|
||||
'imported_variations' => count( $results['imported_variations'] ),
|
||||
'failed' => count( $results['failed'] ),
|
||||
'updated' => count( $results['updated'] ),
|
||||
'skipped' => count( $results['skipped'] ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ 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\Logging\PageController as LoggingPageController;
|
||||
use Automattic\WooCommerce\Internal\Admin\Logging\FileV2\ListTable as LoggingListTable;
|
||||
use Automattic\WooCommerce\Internal\Admin\WCAdminAssets;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
||||
use Automattic\WooCommerce\Utilities\FeaturesUtil;
|
||||
@@ -184,7 +186,18 @@ class WC_Admin_Menus {
|
||||
* Add menu item.
|
||||
*/
|
||||
public function status_menu() {
|
||||
add_submenu_page( 'woocommerce', __( 'WooCommerce status', 'woocommerce' ), __( 'Status', 'woocommerce' ), 'manage_woocommerce', 'wc-status', array( $this, 'status_page' ) );
|
||||
$status_page = add_submenu_page( 'woocommerce', __( 'WooCommerce status', 'woocommerce' ), __( 'Status', 'woocommerce' ), 'manage_woocommerce', 'wc-status', array( $this, 'status_page' ) );
|
||||
|
||||
add_action(
|
||||
'load-' . $status_page,
|
||||
function() {
|
||||
if ( 'logs' === filter_input( INPUT_GET, 'tab' ) ) {
|
||||
// Initialize the logging page controller early so that it can hook into things.
|
||||
wc_get_container()->get( LoggingPageController::class );
|
||||
}
|
||||
},
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,7 +321,13 @@ class WC_Admin_Menus {
|
||||
* @param int $value The number of rows to use.
|
||||
*/
|
||||
public function set_screen_option( $status, $option, $value ) {
|
||||
if ( in_array( $option, array( 'woocommerce_keys_per_page', 'woocommerce_webhooks_per_page' ), true ) ) {
|
||||
$screen_options = array(
|
||||
'woocommerce_keys_per_page',
|
||||
'woocommerce_webhooks_per_page',
|
||||
LoggingListTable::PER_PAGE_USER_OPTION_KEY,
|
||||
);
|
||||
|
||||
if ( in_array( $option, $screen_options, true ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,9 +147,9 @@ class WC_Admin_Notices {
|
||||
),
|
||||
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' ) ) ),
|
||||
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/'
|
||||
'https://developer.woo.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -166,9 +166,9 @@ class WC_Admin_Notices {
|
||||
),
|
||||
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' ) ) ),
|
||||
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/'
|
||||
'https://developer.woo.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -408,6 +408,14 @@ class WC_Admin_Post_Types {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $request_data['_tax_class'] ) ) {
|
||||
$tax_class = sanitize_title( wp_unslash( $request_data['_tax_class'] ) );
|
||||
if ( 'standard' === $tax_class ) {
|
||||
$tax_class = '';
|
||||
}
|
||||
$product->set_tax_class( $tax_class );
|
||||
}
|
||||
|
||||
$product->set_featured( isset( $request_data['_featured'] ) );
|
||||
|
||||
if ( $product->is_type( 'simple' ) || $product->is_type( 'external' ) ) {
|
||||
@@ -505,7 +513,7 @@ class WC_Admin_Post_Types {
|
||||
}
|
||||
|
||||
if ( ! empty( $request_data['_tax_class'] ) ) {
|
||||
$tax_class = wc_clean( wp_unslash( $request_data['_tax_class'] ) );
|
||||
$tax_class = sanitize_title( wp_unslash( $request_data['_tax_class'] ) );
|
||||
if ( 'standard' === $tax_class ) {
|
||||
$tax_class = '';
|
||||
}
|
||||
@@ -617,7 +625,7 @@ class WC_Admin_Post_Types {
|
||||
public function disable_autosave() {
|
||||
global $post;
|
||||
|
||||
if ( $post && in_array( get_post_type( $post->ID ), wc_get_order_types( 'order-meta-boxes' ), true ) ) {
|
||||
if ( $post instanceof WP_Post && in_array( get_post_type( $post->ID ), wc_get_order_types( 'order-meta-boxes' ), true ) ) {
|
||||
wp_dequeue_script( 'autosave' );
|
||||
}
|
||||
}
|
||||
@@ -871,7 +879,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://docs.woocommerce.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://woo.com/document/woocommerce-pages/#section-4' ) . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
|
||||
case 'info':
|
||||
?><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'] ); ?>">;
|
||||
<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>';
|
||||
@@ -462,7 +462,10 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
name="<?php echo esc_attr( $value['field_name'] ); ?>"
|
||||
value="<?php echo esc_attr( $key ); ?>"
|
||||
type="radio"
|
||||
<?php if( in_array( $key, $disabled_values ) ) { echo 'disabled'; } ?>
|
||||
<?php
|
||||
if ( in_array( $key, $disabled_values, true ) ) {
|
||||
echo 'disabled'; }
|
||||
?>
|
||||
style="<?php echo esc_attr( $value['css'] ); ?>"
|
||||
class="<?php echo esc_attr( $value['class'] ); ?>"
|
||||
<?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?>
|
||||
@@ -787,16 +790,19 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
$description = $value['desc'];
|
||||
}
|
||||
|
||||
$description_is_error = $value['description_is_error'] ?? false;
|
||||
$extra_description_style = $description_is_error ? " style='color:red'" : '';
|
||||
|
||||
if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ), true ) ) {
|
||||
$description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>';
|
||||
} elseif ( $description && in_array( $value['type'], array( 'checkbox' ), true ) ) {
|
||||
$description = wp_kses_post( $description );
|
||||
} elseif ( $description ) {
|
||||
$description = '<p class="description">' . wp_kses_post( $description ) . '</p>';
|
||||
$description = '<p class="description"' . $extra_description_style . '>' . wp_kses_post( $description ) . '</p>';
|
||||
}
|
||||
|
||||
if ( $tooltip_html && in_array( $value['type'], array( 'checkbox' ), true ) ) {
|
||||
$tooltip_html = '<p class="description">' . $tooltip_html . '</p>';
|
||||
$tooltip_html = '<p class="description"' . $extra_description_style . '>' . $tooltip_html . '</p>';
|
||||
} elseif ( $tooltip_html ) {
|
||||
$tooltip_html = wc_help_tip( $tooltip_html );
|
||||
}
|
||||
|
||||
@@ -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://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>
|
||||
<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>
|
||||
<?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://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>
|
||||
<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>
|
||||
<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://woocommerce.com/usage-tracking/'
|
||||
'https://woo.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://woocommerce.com/product-category/woocommerce-extensions/shipping-methods/shipping-carriers/'
|
||||
'https://woo.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://woocommerce.com/products/stripe/'
|
||||
'https://woo.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://woocommerce.com/products/woocommerce-gateway-paypal-checkout/'
|
||||
'https://woo.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://woocommerce.com/products/klarna-checkout/'
|
||||
'https://woo.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://woocommerce.com/products/klarna-payments/ '
|
||||
'https://woo.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://woocommerce.com/products/square/'
|
||||
'https://woo.com/products/square/'
|
||||
) . '</p>';
|
||||
|
||||
return array(
|
||||
@@ -1890,9 +1890,13 @@ class WC_Admin_Setup_Wizard {
|
||||
$this->display_recommended_item( array(
|
||||
'type' => 'storefront_theme',
|
||||
'title' => __( 'Storefront Theme', 'woocommerce' ),
|
||||
'description' => sprintf( __(
|
||||
'Design your store with deep WooCommerce integration. If toggled on, we’ll 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
|
||||
'description' => sprintf(
|
||||
/* translators: %s: theme name. */
|
||||
__(
|
||||
'Design your store with deep WooCommerce integration. If toggled on, we’ll install <a href="https://woo.com/storefront/" target="_blank" rel="noopener noreferrer">Storefront</a>, and your current theme <em>%s</em> will be deactivated.',
|
||||
'woocommerce'
|
||||
),
|
||||
$theme_name
|
||||
),
|
||||
'img_url' => WC()->plugin_url() . '/assets/images/obw-storefront-icon.svg',
|
||||
'img_alt' => __( 'Storefront icon', 'woocommerce' ),
|
||||
@@ -2216,11 +2220,11 @@ class WC_Admin_Setup_Wizard {
|
||||
// We've made it! Don't prompt the user to run the wizard again.
|
||||
WC_Admin_Notices::remove_notice( 'install', true );
|
||||
|
||||
$user_email = $this->get_current_user_email();
|
||||
$docs_url = 'https://docs.woocommerce.com/documentation/plugins/woocommerce/getting-started/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin';
|
||||
$help_text = sprintf(
|
||||
$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';
|
||||
$help_text = sprintf(
|
||||
/* translators: %1$s: link to docs */
|
||||
__( 'Visit WooCommerce.com to learn more about <a href="%1$s" target="_blank">getting started</a>.', 'woocommerce' ),
|
||||
__( 'Visit Woo.com to learn more about <a href="%1$s" target="_blank">getting started</a>.', 'woocommerce' ),
|
||||
$docs_url
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
use Automattic\WooCommerce\Internal\Admin\Logging\PageController as LoggingPageController;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
@@ -104,13 +105,7 @@ class WC_Admin_Status {
|
||||
* Show the logs page.
|
||||
*/
|
||||
public static function status_logs() {
|
||||
$log_handler = Constants::get_constant( 'WC_LOG_HANDLER' );
|
||||
|
||||
if ( 'WC_Log_Handler_DB' === $log_handler ) {
|
||||
self::status_logs_db();
|
||||
} else {
|
||||
self::status_logs_file();
|
||||
}
|
||||
wc_get_container()->get( LoggingPageController::class )->render();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,7 +395,7 @@ class WC_Admin_Status {
|
||||
$has_newer_version = false;
|
||||
$version_string = $plugin['version'];
|
||||
$network_string = '';
|
||||
if ( strstr( $plugin['url'], 'woothemes.com' ) || strstr( $plugin['url'], 'woocommerce.com' ) ) {
|
||||
if ( strstr( $plugin['url'], 'woothemes.com' ) || strstr( $plugin['url'], 'woocommerce.com' ) || strstr( $plugin['url'], 'woo.com' ) ) {
|
||||
if ( ! empty( $plugin['version_latest'] ) && version_compare( $plugin['version_latest'], $plugin['version'], '>' ) ) {
|
||||
/* translators: 1: current version. 2: latest version */
|
||||
$version_string = sprintf( __( '%1$s (update to version %2$s is available)', 'woocommerce' ), $plugin['version'], $plugin['version_latest'] );
|
||||
|
||||
@@ -14,7 +14,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 WooCommerce.com.
|
||||
* an account on Woo.com.
|
||||
*/
|
||||
class WC_Helper_Admin {
|
||||
|
||||
@@ -52,38 +52,36 @@ class WC_Helper_Admin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the URL for connecting or disconnecting the store to/from WooCommerce.com.
|
||||
* Generates the URL for connecting or disconnecting the store to/from Woo.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' )
|
||||
);
|
||||
global $current_screen;
|
||||
|
||||
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' )
|
||||
$connect_url_args = array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
);
|
||||
|
||||
return $connect_url;
|
||||
// No active connection.
|
||||
if ( WC_Helper::is_site_connected() ) {
|
||||
$connect_url_args['wc-helper-disconnect'] = 1;
|
||||
$connect_url_args['wc-helper-nonce'] = wp_create_nonce( 'disconnect' );
|
||||
} else {
|
||||
$connect_url_args['wc-helper-connect'] = 1;
|
||||
$connect_url_args['wc-helper-nonce'] = wp_create_nonce( 'connect' );
|
||||
}
|
||||
|
||||
if ( isset( $current_screen->id ) && 'woocommerce_page_wc-admin' === $current_screen->id ) {
|
||||
$connect_url_args['redirect-to-wc-admin'] = 1;
|
||||
}
|
||||
|
||||
return add_query_arg(
|
||||
$connect_url_args,
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +110,7 @@ class WC_Helper_Admin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch featured procucts from WooCommerce.com and serve them
|
||||
* Fetch featured products from Woo.com and serve them
|
||||
* as JSON.
|
||||
*/
|
||||
public static function get_featured() {
|
||||
@@ -124,7 +122,6 @@ class WC_Helper_Admin {
|
||||
|
||||
wp_send_json( $featured );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WC_Helper_Admin::load();
|
||||
|
||||
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
/**
|
||||
* WC_Helper_API Class
|
||||
*
|
||||
* Provides a communication interface with the WooCommerce.com Helper API.
|
||||
* Provides a communication interface with the Woo.com Helper API.
|
||||
*/
|
||||
class WC_Helper_API {
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
/**
|
||||
* WC_Helper_Plugin_Info Class
|
||||
*
|
||||
* Provides the "View Information" core modals with data for WooCommerce.com
|
||||
* Provides the "View Information" core modals with data for Woo.com
|
||||
* hosted extensions.
|
||||
*/
|
||||
class WC_Helper_Plugin_Info {
|
||||
@@ -22,6 +22,7 @@ class WC_Helper_Plugin_Info {
|
||||
*/
|
||||
public static function load() {
|
||||
add_filter( 'plugins_api', array( __CLASS__, 'plugins_api' ), 20, 3 );
|
||||
add_filter( 'themes_api', array( __CLASS__, 'themes_api' ), 20, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +38,31 @@ class WC_Helper_Plugin_Info {
|
||||
if ( 'plugin_information' !== $action ) {
|
||||
return $response;
|
||||
}
|
||||
return self::maybe_override_products_api( $response, $action, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Theme information callback for Woo themes.
|
||||
*
|
||||
* @param object $response The response core needs to display the modal.
|
||||
* @param string $action The requested themes_api() action.
|
||||
* @param object $args Arguments passed to themes_api().
|
||||
*/
|
||||
public static function themes_api( $response, $action, $args ) {
|
||||
if ( 'theme_information' !== $action ) {
|
||||
return $response;
|
||||
}
|
||||
return self::maybe_override_products_api( $response, $action, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the products API to fetch data from the Helper API if it's a Woo product.
|
||||
*
|
||||
* @param object $response The response core needs to display the modal.
|
||||
* @param string $action The requested action.
|
||||
* @param object $args Arguments passed to the API.
|
||||
*/
|
||||
public static function maybe_override_products_api( $response, $action, $args ) {
|
||||
if ( empty( $args->slug ) ) {
|
||||
return $response;
|
||||
}
|
||||
@@ -74,6 +99,11 @@ class WC_Helper_Plugin_Info {
|
||||
$results = json_decode( wp_remote_retrieve_body( $request ), true );
|
||||
if ( ! empty( $results ) ) {
|
||||
$response = (object) $results;
|
||||
|
||||
$product = array_shift( $products );
|
||||
if ( isset( $product['package'] ) ) {
|
||||
$response->download_link = $product['package'];
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
<?php
|
||||
/**
|
||||
* WooCommerce Admin Helper - React admin interface
|
||||
*
|
||||
* @package WooCommerce\Admin\Helper
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Helper_Subscriptions_API
|
||||
*
|
||||
* The main entry-point for all things related to the Marketplace Subscriptions API.
|
||||
* The Subscriptions API manages WooCommerce.com Subscriptions.
|
||||
*/
|
||||
class WC_Helper_Subscriptions_API {
|
||||
|
||||
/**
|
||||
* Loads the class, runs on init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function load() {
|
||||
add_filter( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the REST routes for the Marketplace Subscriptions API.
|
||||
* These endpoints are used by the Marketplace Subscriptions React UI.
|
||||
*/
|
||||
public static function register_rest_routes() {
|
||||
register_rest_route(
|
||||
'wc/v3',
|
||||
'/marketplace/refresh',
|
||||
array(
|
||||
'methods' => 'POST',
|
||||
'callback' => array( __CLASS__, 'refresh' ),
|
||||
'permission_callback' => array( __CLASS__, 'get_permission' ),
|
||||
)
|
||||
);
|
||||
register_rest_route(
|
||||
'wc/v3',
|
||||
'/marketplace/subscriptions',
|
||||
array(
|
||||
'methods' => 'GET',
|
||||
'callback' => array( __CLASS__, 'get_subscriptions' ),
|
||||
'permission_callback' => array( __CLASS__, 'get_permission' ),
|
||||
)
|
||||
);
|
||||
register_rest_route(
|
||||
'wc/v3',
|
||||
'/marketplace/subscriptions/connect',
|
||||
array(
|
||||
'methods' => 'POST',
|
||||
'callback' => array( __CLASS__, 'connect' ),
|
||||
'permission_callback' => array( __CLASS__, 'get_permission' ),
|
||||
'args' => array(
|
||||
'product_key' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
register_rest_route(
|
||||
'wc/v3',
|
||||
'/marketplace/subscriptions/disconnect',
|
||||
array(
|
||||
'methods' => 'POST',
|
||||
'callback' => array( __CLASS__, 'disconnect' ),
|
||||
'permission_callback' => array( __CLASS__, 'get_permission' ),
|
||||
'args' => array(
|
||||
'product_key' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
register_rest_route(
|
||||
'wc/v3',
|
||||
'/marketplace/subscriptions/activate',
|
||||
array(
|
||||
'methods' => 'POST',
|
||||
'callback' => array( __CLASS__, 'activate' ),
|
||||
'permission_callback' => array( __CLASS__, 'get_permission' ),
|
||||
'args' => array(
|
||||
'product_key' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 subscriptions from WooCommerce.com and serve them
|
||||
* as JSON.
|
||||
*/
|
||||
public static function get_subscriptions() {
|
||||
$subscriptions = WC_Helper::get_subscription_list_data();
|
||||
wp_send_json(
|
||||
array_values(
|
||||
$subscriptions
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh account and subscriptions from WooCommerce.com and serve subscriptions
|
||||
* as JSON.
|
||||
*/
|
||||
public static function refresh() {
|
||||
WC_Helper::refresh_helper_subscriptions();
|
||||
self::get_subscriptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect a WooCommerce.com subscription.
|
||||
*
|
||||
* @param WP_REST_Request $request Request object.
|
||||
*/
|
||||
public static function connect( $request ) {
|
||||
$product_key = $request->get_param( 'product_key' );
|
||||
try {
|
||||
$success = WC_Helper::activate_helper_subscription( $product_key );
|
||||
} catch ( Exception $e ) {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => $e->getMessage(),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
if ( $success ) {
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'message' => __( 'Your subscription has been connected.', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => __( 'There was an error connecting your subscription. Please try again.', 'woocommerce' ),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect a WooCommerce.com subscription.
|
||||
*
|
||||
* @param WP_REST_Request $request Request object.
|
||||
*/
|
||||
public static function disconnect( $request ) {
|
||||
$product_key = $request->get_param( 'product_key' );
|
||||
try {
|
||||
$success = WC_Helper::deactivate_helper_subscription( $product_key );
|
||||
} catch ( Exception $e ) {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => $e->getMessage(),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
if ( $success ) {
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'message' => __( 'Your subscription has been disconnected.', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => __( 'There was an error disconnecting your subscription. Please try again.', 'woocommerce' ),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate a WooCommerce.com product.
|
||||
* This activates the plugin/theme on the site.
|
||||
*
|
||||
* @param WP_REST_Request $request Request object.
|
||||
*/
|
||||
public static function activate( $request ) {
|
||||
$product_key = $request->get_param( 'product_key' );
|
||||
$subscription = WC_Helper::get_subscription( $product_key );
|
||||
|
||||
if ( ! $subscription ) {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => __( 'We couldn\'t find a subscription for this product.', 'woocommerce' ),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
||||
if ( true !== $subscription['local']['installed'] || ! isset( $subscription['local']['active'] ) ) {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => __( 'This product is not installed.', 'woocommerce' ),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
||||
if ( true === $subscription['local']['active'] ) {
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'message' => __( 'This product is already active.', 'woocommerce' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'plugin' === $subscription['product_type'] ) {
|
||||
$success = activate_plugin( $subscription['local']['path'] );
|
||||
if ( is_wp_error( $success ) ) {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => __( 'There was an error activating this plugin.', 'woocommerce' ),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
} elseif ( 'theme' === $subscription['product_type'] ) {
|
||||
switch_theme( $subscription['local']['slug'] );
|
||||
$theme = wp_get_theme();
|
||||
if ( $subscription['local']['slug'] !== $theme->get_stylesheet() ) {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => __( 'There was an error activating this theme.', 'woocommerce' ),
|
||||
),
|
||||
400
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'message' => __( 'This product has been activated.', 'woocommerce' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
WC_Helper_Subscriptions_API::load();
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* The update helper for WooCommerce.com plugins.
|
||||
* The update helper for Woo.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 WooCommerce.com-provided packages.
|
||||
* routines to serve Woo.com-provided packages.
|
||||
*/
|
||||
class WC_Helper_Updater {
|
||||
|
||||
@@ -89,7 +89,7 @@ class WC_Helper_Updater {
|
||||
|
||||
/**
|
||||
* Runs on pre_set_site_transient_update_themes, provides custom
|
||||
* packages for WooCommerce.com-hosted extensions.
|
||||
* packages for Woo.com-hosted extensions.
|
||||
*
|
||||
* @param object $transient The update_themes transient object.
|
||||
*
|
||||
@@ -516,7 +516,7 @@ class WC_Helper_Updater {
|
||||
return new WP_Error(
|
||||
'woocommerce_subscription_expired',
|
||||
sprintf(
|
||||
// translators: %s: URL of WooCommerce.com subscriptions tab.
|
||||
// translators: %s: URL of Woo.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§ion=helper' ) )
|
||||
)
|
||||
|
||||
@@ -59,6 +59,7 @@ class WC_Helper {
|
||||
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';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,14 +113,17 @@ class WC_Helper {
|
||||
$woo_plugins = self::get_local_woo_plugins();
|
||||
$woo_themes = self::get_local_woo_themes();
|
||||
|
||||
$site_id = absint( $auth['site_id'] );
|
||||
$subscriptions = self::get_subscriptions();
|
||||
$subscriptions_list_data = self::get_subscription_list_data();
|
||||
$subscriptions = array_filter(
|
||||
$subscriptions_list_data,
|
||||
function( $subscription ) {
|
||||
return ! empty( $subscription['product_key'] );
|
||||
}
|
||||
);
|
||||
$updates = WC_Helper_Updater::get_update_data();
|
||||
$subscriptions_product_ids = wp_list_pluck( $subscriptions, 'product_id' );
|
||||
|
||||
foreach ( $subscriptions as &$subscription ) {
|
||||
$subscription['active'] = in_array( $site_id, $subscription['connections'] );
|
||||
|
||||
$subscription['activate_url'] = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
@@ -146,48 +150,24 @@ class WC_Helper {
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
|
||||
$subscription['local'] = array(
|
||||
'installed' => false,
|
||||
'active' => false,
|
||||
'version' => null,
|
||||
);
|
||||
|
||||
$subscription['update_url'] = admin_url( 'update-core.php' );
|
||||
|
||||
$local = wp_list_filter( array_merge( $woo_plugins, $woo_themes ), array( '_product_id' => $subscription['product_id'] ) );
|
||||
|
||||
if ( ! empty( $local ) ) {
|
||||
$local = array_shift( $local );
|
||||
$subscription['local']['installed'] = true;
|
||||
$subscription['local']['version'] = $local['Version'];
|
||||
|
||||
if ( 'plugin' == $local['_type'] ) {
|
||||
if ( is_plugin_active( $local['_filename'] ) ) {
|
||||
$subscription['local']['active'] = true;
|
||||
} elseif ( is_multisite() && is_plugin_active_for_network( $local['_filename'] ) ) {
|
||||
$subscription['local']['active'] = true;
|
||||
}
|
||||
|
||||
$local = array_shift( $local );
|
||||
if ( 'plugin' === $local['_type'] ) {
|
||||
// A magic update_url.
|
||||
$subscription['update_url'] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $local['_filename'], 'upgrade-plugin_' . $local['_filename'] );
|
||||
|
||||
} elseif ( 'theme' == $local['_type'] ) {
|
||||
if ( in_array( $local['_stylesheet'], array( get_stylesheet(), get_template() ) ) ) {
|
||||
$subscription['local']['active'] = true;
|
||||
}
|
||||
|
||||
} elseif ( 'theme' === $local['_type'] ) {
|
||||
// Another magic update_url.
|
||||
$subscription['update_url'] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' . $local['_stylesheet'] ), 'upgrade-theme_' . $local['_stylesheet'] );
|
||||
}
|
||||
}
|
||||
|
||||
$subscription['has_update'] = false;
|
||||
if ( $subscription['local']['installed'] && ! empty( $updates[ $subscription['product_id'] ] ) ) {
|
||||
$subscription['has_update'] = version_compare( $updates[ $subscription['product_id'] ]['version'], $subscription['local']['version'], '>' );
|
||||
}
|
||||
|
||||
$subscription['download_primary'] = true;
|
||||
$subscription['download_url'] = 'https://woocommerce.com/my-account/downloads/';
|
||||
$subscription['download_url'] = 'https://woo.com/my-account/downloads/';
|
||||
if ( ! $subscription['local']['installed'] && ! empty( $updates[ $subscription['product_id'] ] ) ) {
|
||||
$subscription['download_url'] = $updates[ $subscription['product_id'] ]['package'];
|
||||
}
|
||||
@@ -243,7 +223,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://woocommerce.com/my-account/my-subscriptions/',
|
||||
'https://woo.com/my-account/my-subscriptions/',
|
||||
'renew'
|
||||
),
|
||||
'status' => 'expired',
|
||||
@@ -258,7 +238,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://woocommerce.com/my-account/my-subscriptions/',
|
||||
'https://woo.com/my-account/my-subscriptions/',
|
||||
'auto-renew'
|
||||
),
|
||||
'status' => 'expired',
|
||||
@@ -272,7 +252,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://woocommerce.com/my-account/my-subscriptions/',
|
||||
'https://woo.com/my-account/my-subscriptions/',
|
||||
'renew'
|
||||
),
|
||||
'status' => 'expired',
|
||||
@@ -334,7 +314,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://docs.woocommerce.com/document/managing-woocommerce-com-subscriptions/#section-10', 'https://docs.woocommerce.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://woo.com/document/managing-woocommerce-com-subscriptions/#section-10', 'https://woo.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'],
|
||||
@@ -372,7 +352,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://woocommerce.com/my-account/my-subscriptions/
|
||||
* @param string $url URL to product page or to https://woo.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
|
||||
@@ -633,14 +613,14 @@ class WC_Helper {
|
||||
|
||||
case 'helper-connected':
|
||||
$notices[] = array(
|
||||
'message' => __( 'You have successfully connected your store to WooCommerce.com', 'woocommerce' ),
|
||||
'message' => __( 'You have successfully connected your store to Woo.com', 'woocommerce' ),
|
||||
'type' => 'updated',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'helper-disconnected':
|
||||
$notices[] = array(
|
||||
'message' => __( 'You have successfully disconnected your store from WooCommerce.com', 'woocommerce' ),
|
||||
'message' => __( 'You have successfully disconnected your store from Woo.com', 'woocommerce' ),
|
||||
'type' => 'updated',
|
||||
);
|
||||
break;
|
||||
@@ -693,7 +673,7 @@ class WC_Helper {
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['wc-helper-deactivate'] ) ) {
|
||||
return self::_helper_subscription_deactivate();
|
||||
return self::helper_subscription_deactivate();
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['wc-helper-deactivate-plugin'] ) ) {
|
||||
@@ -701,6 +681,32 @@ class WC_Helper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get helper redirect URL.
|
||||
*
|
||||
* @param array $args Query args.
|
||||
* @param bool $redirect_to_wc_admin Whether to redirect to WC Admin.
|
||||
* @return string
|
||||
*/
|
||||
private static function get_helper_redirect_url( $args = array(), $redirect_to_wc_admin = false ) {
|
||||
global $current_screen;
|
||||
if ( true === $redirect_to_wc_admin && 'woocommerce_page_wc-addons' === $current_screen->id ) {
|
||||
return add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-admin',
|
||||
'tab' => 'my-subscriptions',
|
||||
'path' => rawurlencode( '/extensions' ),
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
}
|
||||
|
||||
return add_query_arg(
|
||||
$args,
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a new OAuth connection.
|
||||
*/
|
||||
@@ -710,13 +716,19 @@ class WC_Helper {
|
||||
wp_die( 'Could not verify nonce' );
|
||||
}
|
||||
|
||||
$redirect_url_args = array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-return' => 1,
|
||||
'wc-helper-nonce' => wp_create_nonce( 'connect' ),
|
||||
);
|
||||
|
||||
if ( isset( $_GET['redirect-to-wc-admin'] ) ) {
|
||||
$redirect_url_args['redirect-to-wc-admin'] = 1;
|
||||
}
|
||||
|
||||
$redirect_uri = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-return' => 1,
|
||||
'wc-helper-nonce' => wp_create_nonce( 'connect' ),
|
||||
),
|
||||
$redirect_url_args,
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
|
||||
@@ -762,7 +774,7 @@ class WC_Helper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return from WooCommerce.com OAuth flow.
|
||||
* Return from Woo.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
|
||||
@@ -776,7 +788,16 @@ class WC_Helper {
|
||||
* Fires when the Helper connection process is denied/cancelled.
|
||||
*/
|
||||
do_action( 'woocommerce_helper_denied' );
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-addons§ion=helper' ) );
|
||||
|
||||
wp_safe_redirect(
|
||||
self::get_helper_redirect_url(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
),
|
||||
isset( $_GET['redirect-to-wc-admin'] )
|
||||
)
|
||||
);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -823,7 +844,7 @@ class WC_Helper {
|
||||
WC_Tracker::send_tracking_data( true );
|
||||
}
|
||||
|
||||
// If connecting through in-app purchase, redirects back to WooCommerce.com
|
||||
// If connecting through in-app purchase, redirects back to Woo.com
|
||||
// for product installation.
|
||||
if ( ! empty( $_GET['wccom-install-url'] ) ) {
|
||||
wp_redirect( wp_unslash( $_GET['wccom-install-url'] ) );
|
||||
@@ -831,20 +852,20 @@ class WC_Helper {
|
||||
}
|
||||
|
||||
wp_safe_redirect(
|
||||
add_query_arg(
|
||||
self::get_helper_redirect_url(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-status' => 'helper-connected',
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
isset( $_GET['redirect-to-wc-admin'] )
|
||||
)
|
||||
);
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from WooCommerce.com, clear OAuth tokens.
|
||||
* Disconnect from Woo.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
|
||||
@@ -857,13 +878,13 @@ class WC_Helper {
|
||||
*/
|
||||
do_action( 'woocommerce_helper_disconnected' );
|
||||
|
||||
$redirect_uri = add_query_arg(
|
||||
$redirect_uri = self::get_helper_redirect_url(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-status' => 'helper-disconnected',
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
isset( $_GET['redirect-to-wc-admin'] )
|
||||
);
|
||||
|
||||
self::disconnect();
|
||||
@@ -881,27 +902,36 @@ class WC_Helper {
|
||||
wp_die( 'Could not verify nonce' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires when Helper subscriptions are refreshed.
|
||||
*/
|
||||
do_action( 'woocommerce_helper_subscriptions_refresh' );
|
||||
self::refresh_helper_subscriptions();
|
||||
|
||||
$redirect_uri = add_query_arg(
|
||||
$redirect_uri = self::get_helper_redirect_url(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'filter' => self::get_current_filter(),
|
||||
'wc-helper-status' => 'helper-refreshed',
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
isset( $_GET['redirect-to-wc-admin'] )
|
||||
);
|
||||
|
||||
wp_safe_redirect( $redirect_uri );
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush helper authentication cache.
|
||||
*/
|
||||
public static function refresh_helper_subscriptions() {
|
||||
/**
|
||||
* Fires when Helper subscriptions are refreshed.
|
||||
*
|
||||
* @since 8.3.0
|
||||
*/
|
||||
do_action( 'woocommerce_helper_subscriptions_refresh' );
|
||||
|
||||
self::_flush_authentication_cache();
|
||||
self::_flush_subscriptions_cache();
|
||||
self::_flush_updates_cache();
|
||||
|
||||
wp_safe_redirect( $redirect_uri );
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -916,6 +946,41 @@ class WC_Helper {
|
||||
wp_die( 'Could not verify nonce' );
|
||||
}
|
||||
|
||||
try {
|
||||
$activated = self::activate_helper_subscription( $product_key, $product_id );
|
||||
} catch ( Exception $e ) {
|
||||
$activated = false;
|
||||
}
|
||||
|
||||
$redirect_uri = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'filter' => self::get_current_filter(),
|
||||
'wc-helper-status' => $activated ? 'activate-success' : 'activate-error',
|
||||
'wc-helper-product-id' => $product_id,
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
|
||||
wp_safe_redirect( $redirect_uri );
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate helper subscription.
|
||||
*
|
||||
* @throws Exception If the subscription could not be activated or found.
|
||||
* @param string $product_key Subscription product key.
|
||||
* @return bool True if activated, false otherwise.
|
||||
*/
|
||||
public static function activate_helper_subscription( $product_key ) {
|
||||
$subscription = self::get_subscription( $product_key );
|
||||
if ( ! $subscription ) {
|
||||
throw new Exception( __( 'Subscription not found', 'woocommerce' ) );
|
||||
}
|
||||
$product_id = $subscription['product_id'];
|
||||
|
||||
// Activate subscription.
|
||||
$activation_response = WC_Helper_API::post(
|
||||
'activate',
|
||||
@@ -954,6 +1019,7 @@ class WC_Helper {
|
||||
* @param array $activation_response The response object from wp_safe_remote_request().
|
||||
*/
|
||||
do_action( 'woocommerce_helper_subscription_activate_error', $product_id, $product_key, $activation_response );
|
||||
throw new Exception( $body['message'] ?? __( 'Unknown error', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
// Attempt to activate this plugin.
|
||||
@@ -965,12 +1031,33 @@ class WC_Helper {
|
||||
self::_flush_subscriptions_cache();
|
||||
self::_flush_updates_cache();
|
||||
|
||||
return $activated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate a product subscription.
|
||||
*/
|
||||
private static function helper_subscription_deactivate() {
|
||||
$product_key = isset( $_GET['wc-helper-product-key'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-product-key'] ) ) : '';
|
||||
$product_id = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
|
||||
|
||||
if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'deactivate:' . $product_key ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
self::log( 'Could not verify nonce in helper_subscription_deactivate' );
|
||||
wp_die( 'Could not verify nonce' );
|
||||
}
|
||||
|
||||
try {
|
||||
$deactivated = self::deactivate_helper_subscription( $product_key );
|
||||
} catch ( Exception $e ) {
|
||||
$deactivated = false;
|
||||
}
|
||||
|
||||
$redirect_uri = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'filter' => self::get_current_filter(),
|
||||
'wc-helper-status' => $activated ? 'activate-success' : 'activate-error',
|
||||
'wc-helper-status' => $deactivated ? 'deactivate-success' : 'deactivate-error',
|
||||
'wc-helper-product-id' => $product_id,
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
@@ -982,15 +1069,17 @@ class WC_Helper {
|
||||
|
||||
/**
|
||||
* Deactivate a product subscription.
|
||||
*
|
||||
* @throws Exception If the subscription could not be deactivated or found.
|
||||
* @param string $product_key Subscription product key.
|
||||
* @return bool True if deactivated, false otherwise.
|
||||
*/
|
||||
private static function _helper_subscription_deactivate() {
|
||||
$product_key = isset( $_GET['wc-helper-product-key'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-product-key'] ) ) : '';
|
||||
$product_id = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
|
||||
|
||||
if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'deactivate:' . $product_key ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
self::log( 'Could not verify nonce in _helper_subscription_deactivate' );
|
||||
wp_die( 'Could not verify nonce' );
|
||||
public static function deactivate_helper_subscription( $product_key ) {
|
||||
$subscription = self::get_subscription( $product_key );
|
||||
if ( ! $subscription ) {
|
||||
throw new Exception( __( 'Subscription not found', 'woocommerce' ) );
|
||||
}
|
||||
$product_id = $subscription['product_id'];
|
||||
|
||||
$deactivation_response = WC_Helper_API::post(
|
||||
'deactivate',
|
||||
@@ -1027,23 +1116,14 @@ class WC_Helper {
|
||||
* @param array $deactivation_response The response object from wp_safe_remote_request().
|
||||
*/
|
||||
do_action( 'woocommerce_helper_subscription_deactivate_error', $product_id, $product_key, $deactivation_response );
|
||||
|
||||
$body = json_decode( wp_remote_retrieve_body( $deactivation_response ), true );
|
||||
throw new Exception( $body['message'] ?? __( 'Unknown error', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
self::_flush_subscriptions_cache();
|
||||
|
||||
$redirect_uri = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'filter' => self::get_current_filter(),
|
||||
'wc-helper-status' => $deactivated ? 'deactivate-success' : 'deactivate-error',
|
||||
'wc-helper-product-id' => $product_id,
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
|
||||
wp_safe_redirect( $redirect_uri );
|
||||
die();
|
||||
return $deactivated;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1148,10 +1228,63 @@ class WC_Helper {
|
||||
if ( ! empty( $subscriptions ) ) {
|
||||
return $single ? array_shift( $subscriptions ) : $subscriptions;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get locally installed plugins
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_local_plugins() {
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
$plugins = get_plugins();
|
||||
|
||||
$output_plugins = array();
|
||||
foreach ( $plugins as $filename => $data ) {
|
||||
array_push(
|
||||
$output_plugins,
|
||||
array(
|
||||
'_filename' => $filename,
|
||||
'_type' => 'plugin',
|
||||
'slug' => dirname( $filename ),
|
||||
'Version' => $data['Version'],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $output_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get locally installed themes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_local_themes() {
|
||||
if ( ! function_exists( 'wp_get_themes' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/theme.php';
|
||||
}
|
||||
$themes = wp_get_themes();
|
||||
|
||||
$output_themes = array();
|
||||
foreach ( $themes as $theme ) {
|
||||
array_push(
|
||||
$output_themes,
|
||||
array(
|
||||
'_filename' => $theme->get_stylesheet() . '/style.css',
|
||||
'_stylesheet' => $theme->get_stylesheet(),
|
||||
'_type' => 'theme',
|
||||
'slug' => $theme->get_stylesheet(),
|
||||
'Version' => $theme->get( 'Version' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
return $output_themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a list of data about locally installed Woo extensions.
|
||||
*/
|
||||
@@ -1256,6 +1389,7 @@ class WC_Helper {
|
||||
'_product_id' => absint( $product_id ),
|
||||
'_file_id' => $file_id,
|
||||
'_type' => 'theme',
|
||||
'slug' => dirname( $theme->get_stylesheet() ),
|
||||
);
|
||||
|
||||
$woo_themes[ $data['_filename'] ] = $data;
|
||||
@@ -1313,6 +1447,256 @@ class WC_Helper {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subscription data for a given product key.
|
||||
*
|
||||
* @param string $product_key Subscription product key.
|
||||
* @return array|bool The array containing sub data or false.
|
||||
*/
|
||||
public static function get_subscription( $product_key ) {
|
||||
$subscriptions = wp_list_filter(
|
||||
self::get_subscriptions(),
|
||||
array( 'product_key' => $product_key )
|
||||
);
|
||||
|
||||
if ( empty( $subscriptions ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$subscription = array_shift( $subscriptions );
|
||||
$subscription['local'] = self::get_subscription_local_data( $subscription );
|
||||
return $subscription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connected user's subscription list data.
|
||||
* This is used by the My Subscriptions page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_subscription_list_data() {
|
||||
$subscriptions = self::get_subscriptions();
|
||||
|
||||
// Installed plugins and themes, with or without an active subscription.
|
||||
$woo_plugins = self::get_local_woo_plugins();
|
||||
$woo_themes = self::get_local_woo_themes();
|
||||
|
||||
$subscriptions_product_ids = wp_list_pluck( $subscriptions, 'product_id' );
|
||||
|
||||
$auth = WC_Helper_Options::get( 'auth' );
|
||||
$site_id = isset( $auth['site_id'] ) ? absint( $auth['site_id'] ) : 0;
|
||||
|
||||
// Installed products without a subscription.
|
||||
foreach ( array_merge( $woo_plugins, $woo_themes ) as $filename => $data ) {
|
||||
if ( in_array( $data['_product_id'], $subscriptions_product_ids, true ) ) {
|
||||
continue;
|
||||
}
|
||||
$subscriptions[] = array(
|
||||
'product_key' => '',
|
||||
'product_id' => $data['_product_id'],
|
||||
'product_name' => $data['Name'],
|
||||
'product_url' => $data['PluginURI'] ?? '',
|
||||
'zip_slug' => $data['slug'],
|
||||
'documentation_url' => '',
|
||||
'key_type' => '',
|
||||
'key_type_label' => '',
|
||||
'lifetime' => false,
|
||||
'product_status' => 'publish',
|
||||
'connections' => array(),
|
||||
'expires' => 0,
|
||||
'expired' => true,
|
||||
'expiring' => false,
|
||||
'sites_max' => 0,
|
||||
'sites_active' => 0,
|
||||
'autorenew' => false,
|
||||
'maxed' => false,
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $subscriptions as &$subscription ) {
|
||||
$subscription['active'] = in_array( $site_id, $subscription['connections'], true );
|
||||
|
||||
$updates = WC_Helper_Updater::get_update_data();
|
||||
|
||||
$subscription['local'] = self::get_subscription_local_data( $subscription );
|
||||
|
||||
$subscription['has_update'] = false;
|
||||
if ( $subscription['local']['installed'] && ! empty( $updates[ $subscription['product_id'] ] ) ) {
|
||||
$subscription['has_update'] = version_compare( $updates[ $subscription['product_id'] ]['version'], $subscription['local']['version'], '>' );
|
||||
}
|
||||
|
||||
if ( ! empty( $updates[ $subscription['product_id'] ] ) ) {
|
||||
$subscription['version'] = $updates[ $subscription['product_id'] ]['version'];
|
||||
}
|
||||
}
|
||||
|
||||
// Sort subscriptions by name and expiration date.
|
||||
usort(
|
||||
$subscriptions,
|
||||
function( $a, $b ) {
|
||||
$compare_value = strcasecmp( $a['product_name'], $b['product_name'] );
|
||||
if ( 0 === $compare_value ) {
|
||||
return strcasecmp( $a['expires'], $b['expires'] );
|
||||
}
|
||||
return $compare_value;
|
||||
}
|
||||
);
|
||||
|
||||
// Add subscription install flags after the active and local data is set.
|
||||
foreach ( $subscriptions as &$subscription ) {
|
||||
$subscription['subscription_available'] = self::is_subscription_available( $subscription, $subscriptions );
|
||||
$subscription['subscription_installed'] = self::is_subscription_installed( $subscription, $subscriptions );
|
||||
}
|
||||
|
||||
// Break the by-ref.
|
||||
unset( $subscription );
|
||||
|
||||
return $subscriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a subscription is available to use.
|
||||
* That is, is not already active and hasn't expired, and there are no other subscriptions
|
||||
* for this product already active on this site.
|
||||
*
|
||||
* @param array $subscription The subscription we're checking.
|
||||
* @param array $subscriptions The list of all the user's subscriptions.
|
||||
* @return bool True if multiple licenses exist, false otherwise.
|
||||
*/
|
||||
public static function is_subscription_available( $subscription, $subscriptions ) {
|
||||
if ( true === $subscription['active'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( true === $subscription['expired'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$product_subscriptions = wp_list_filter(
|
||||
$subscriptions,
|
||||
array(
|
||||
'product_id' => $subscription['product_id'],
|
||||
'active' => true,
|
||||
)
|
||||
);
|
||||
|
||||
// If there are no subscriptions for this product already active on this site, then it's available.
|
||||
if ( empty( $product_subscriptions ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if product relating to a subscription is installed.
|
||||
* This method will return true if the product is installed, but will exclude subscriptions for the same product that are not in use.
|
||||
* If a product is installed and inactive, this will ensure that one subscription is marked as installed.
|
||||
*
|
||||
* @param array $subscription The subscription we're checking.
|
||||
* @param array $subscriptions The list of all the user's subscriptions.
|
||||
* @return bool True if installed, false otherwise.
|
||||
*/
|
||||
public static function is_subscription_installed( $subscription, $subscriptions ) {
|
||||
if ( false === $subscription['local']['installed'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the subscription is active, then it's installed.
|
||||
if ( true === $subscription['active'] ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$product_subscriptions = wp_list_filter(
|
||||
$subscriptions,
|
||||
array(
|
||||
'product_id' => $subscription['product_id'],
|
||||
)
|
||||
);
|
||||
if ( empty( $product_subscriptions ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there are no other subscriptions for this product, then it's installed.
|
||||
if ( 1 === count( $product_subscriptions ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$active_subscription = wp_list_filter(
|
||||
$product_subscriptions,
|
||||
array(
|
||||
'active' => true,
|
||||
)
|
||||
);
|
||||
|
||||
// If there is another active subscription, this subscription is not installed.
|
||||
// If the current subscription is active, it would already return true above.
|
||||
if ( ! empty( $active_subscription ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there are multiple subscriptions, but no active subscriptions, then mark the first one as installed.
|
||||
$product_subscription = array_shift( $product_subscriptions );
|
||||
if ( $product_subscription['product_key'] === $subscription['product_key'] ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add local data to a subscription.
|
||||
*
|
||||
* @param array $subscription The subscription data.
|
||||
* @return array The subscription data with local data added.
|
||||
*/
|
||||
public static function get_subscription_local_data( array $subscription ) {
|
||||
$local_plugins = self::get_local_plugins();
|
||||
$local_themes = self::get_local_themes();
|
||||
|
||||
$installed_product = wp_list_filter(
|
||||
array_merge( $local_plugins, $local_themes ),
|
||||
array( 'slug' => $subscription['zip_slug'] )
|
||||
);
|
||||
$installed_product = array_shift( $installed_product );
|
||||
|
||||
if ( empty( $installed_product ) ) {
|
||||
return array(
|
||||
'installed' => false,
|
||||
'active' => false,
|
||||
'version' => null,
|
||||
'type' => null,
|
||||
'slug' => null,
|
||||
'path' => null,
|
||||
);
|
||||
}
|
||||
|
||||
$local_data = array(
|
||||
'installed' => true,
|
||||
'active' => false,
|
||||
'version' => $installed_product['Version'],
|
||||
'type' => $installed_product['_type'],
|
||||
'slug' => null,
|
||||
'path' => $installed_product['_filename'],
|
||||
);
|
||||
|
||||
if ( 'plugin' === $installed_product['_type'] ) {
|
||||
$local_data['slug'] = $installed_product['slug'];
|
||||
if ( is_plugin_active( $installed_product['_filename'] ) ) {
|
||||
$local_data['active'] = true;
|
||||
} elseif ( is_multisite() && is_plugin_active_for_network( $installed_product['_filename'] ) ) {
|
||||
$local_data['active'] = true;
|
||||
}
|
||||
} elseif ( 'theme' === $installed_product['_type'] ) {
|
||||
$local_data['slug'] = $installed_product['_stylesheet'];
|
||||
if ( in_array( $installed_product['_stylesheet'], array( get_stylesheet(), get_template() ), true ) ) {
|
||||
$local_data['active'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $local_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs when any plugin is activated.
|
||||
*
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
<?php
|
||||
printf(
|
||||
wp_kses(
|
||||
/* translators: Introduction to list of WooCommerce.com extensions the merchant has subscriptions for. */
|
||||
/* translators: Introduction to list of Woo.com extensions the merchant has subscriptions for. */
|
||||
__(
|
||||
'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.',
|
||||
'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.',
|
||||
'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://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php esc_html_e( 'Upgrade', 'woocommerce' ); ?></a>
|
||||
<a class="button" href="https://woo.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 WooCommerce.com account', 'woocommerce' ); ?></td>
|
||||
<td colspan="3"><em><?php esc_html_e( 'Could not find any subscriptions on your Woo.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 WooCommerce.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 Woo.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. */ ?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin -> WooCommerce -> Extensions -> WooCommerce.com Subscriptions main page.
|
||||
* Admin -> WooCommerce -> Extensions -> Woo.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 WooCommerce.com purchases will be listed here.', 'woocommerce' ); ?></p>
|
||||
<p><?php esc_html_e( 'Once connected, your Woo.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>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php defined( 'ABSPATH' ) or exit(); ?>
|
||||
|
||||
<a class="button button-update" href="<?php echo esc_url( $refresh_url ); ?>"><span class="dashicons dashicons-image-rotate"></span> <?php _e( 'Update', 'woocommerce' ); ?></a>
|
||||
<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 printf( __( 'Connected to WooCommerce.com', 'woocommerce' ) ); ?> <span class="chevron dashicons dashicons-arrow-down-alt2"></span></p>
|
||||
<p><?php esc_html_e( 'Connected to Woo.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://woocommerce.com/my-account/my-subscriptions/" target="_blank"><span class="dashicons dashicons-admin-generic"></span> <?php _e( 'My Subscriptions', 'woocommerce' ); ?></a>
|
||||
<a class="" href="<?php echo esc_url( $disconnect_url ); ?>"><span class="dashicons dashicons-no"></span> <?php _e( 'Disconnect', 'woocommerce' ); ?></a>
|
||||
<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="<?php echo esc_url( $disconnect_url ); ?>"><span class="dashicons dashicons-no"></span> <?php esc_html_e( 'Disconnect', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ defined( 'ABSPATH' ) || exit(); ?>
|
||||
|
||||
<?php
|
||||
$count_html = WC_Helper_Updater::get_updates_count_html();
|
||||
/* translators: %s: WooCommerce.com Subscriptions tab count HTML. */
|
||||
/* translators: %s: Woo.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§ion=helper' ) ); ?>" class="nav-tab nav-tab-active"><?php echo wp_kses_post( $menu_title ); ?></a>
|
||||
|
||||
@@ -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://docs.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 '<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 '</div>';
|
||||
}
|
||||
|
||||
|
||||
@@ -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://woocommerce.com/wp-content/plugins/wccom-plugins/marketplace-suggestions/icons/get_more_options.svg" class="marketplace-suggestion-icon">
|
||||
<img src="https://woo.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://woocommerce.com/product-category/woocommerce-extensions/?utm_source=editproduct&utm_campaign=marketplacesuggestions&utm_medium=product" target="blank" class="button"><?php esc_html_e( 'Browse the Marketplace', 'woocommerce' ); ?></a><br />
|
||||
<a href="https://woo.com/product-category/woocommerce-extensions/?utm_source=editproduct&utm_campaign=marketplacesuggestions&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§ion=woocommerce_com' ) ); ?>"><?php esc_html_e( 'Manage suggestions', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -103,7 +103,8 @@ class WC_Meta_Box_Coupon_Data {
|
||||
array(
|
||||
'id' => 'free_shipping',
|
||||
'label' => __( 'Allow free shipping', 'woocommerce' ),
|
||||
'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://docs.woocommerce.com/document/free-shipping/' ),
|
||||
// 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/' ),
|
||||
'value' => wc_bool_to_string( $coupon->get_free_shipping( 'edit' ) ),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -45,7 +45,7 @@ class WC_Meta_Box_Product_Categories {
|
||||
* @param number $threshold The default threshold.
|
||||
* @returns number The threshold that will be used.
|
||||
*/
|
||||
if ( $categories_count <= apply_filters( 'woocommerce_product_category_metabox_search_threshold', 100 ) && function_exists( 'post_categories_meta_box' ) ) {
|
||||
if ( $categories_count <= apply_filters( 'woocommerce_product_category_metabox_search_threshold', 5 ) && function_exists( 'post_categories_meta_box' ) ) {
|
||||
return post_categories_meta_box( $post, $box );
|
||||
}
|
||||
|
||||
|
||||
@@ -546,7 +546,7 @@ class WC_Meta_Box_Product_Data {
|
||||
'width' => isset( $_POST['variable_width'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_width'][ $i ] ) ) : '',
|
||||
'height' => isset( $_POST['variable_height'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_height'][ $i ] ) ) : '',
|
||||
'shipping_class_id' => isset( $_POST['variable_shipping_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_shipping_class'][ $i ] ) ) : null,
|
||||
'tax_class' => isset( $_POST['variable_tax_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_tax_class'][ $i ] ) ) : null,
|
||||
'tax_class' => isset( $_POST['variable_tax_class'][ $i ] ) ? sanitize_title( wp_unslash( $_POST['variable_tax_class'][ $i ] ) ) : null,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -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—%1$slearn more%2$s).', 'woocommerce' ),
|
||||
'<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
|
||||
'<a href="https://woo.com/document/approved-download-directories" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -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://woocommerce.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://woo.com/document/variable-product/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -28,7 +28,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://woocommerce.com/document/variable-product/' )
|
||||
esc_url( 'https://woo.com/document/variable-product/' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -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—%1$slearn more%2$s).', 'woocommerce' ),
|
||||
'<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
|
||||
'<a href="https://woo.com/document/approved-download-directories" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -130,7 +130,7 @@ class WC_Notes_Run_Db_Update {
|
||||
array(
|
||||
'name' => 'update-db_learn-more',
|
||||
'label' => __( 'Learn more about updates', 'woocommerce' ),
|
||||
'url' => 'https://docs.woocommerce.com/document/how-to-update-woocommerce/',
|
||||
'url' => 'https://woo.com/document/how-to-update-woocommerce/',
|
||||
'status' => 'unactioned',
|
||||
'primary' => false,
|
||||
),
|
||||
|
||||
@@ -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://woocommerce.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://woo.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">
|
||||
|
||||
@@ -41,7 +41,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
'keys' => __( 'REST API', 'woocommerce' ),
|
||||
'webhooks' => __( 'Webhooks', 'woocommerce' ),
|
||||
'legacy_api' => __( 'Legacy API', 'woocommerce' ),
|
||||
'woocommerce_com' => __( 'WooCommerce.com', 'woocommerce' ),
|
||||
'woocommerce_com' => __( 'Woo.com', 'woocommerce' ),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,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://docs.woocommerce.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://woo.com/document/ssl-and-https/#section-3' ),
|
||||
),
|
||||
|
||||
'unforce_ssl_checkout' => array(
|
||||
@@ -322,12 +322,12 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings for the WooCommerce.com section.
|
||||
* Get settings for the Woo.com section.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_settings_for_woocommerce_com_section() {
|
||||
$tracking_info_text = sprintf( '<a href="%s" target="_blank">%s</a>', 'https://woocommerce.com/usage-tracking', esc_html__( 'WooCommerce.com Usage Tracking Documentation', 'woocommerce' ) );
|
||||
$tracking_info_text = sprintf( '<a href="%s" target="_blank">%s</a>', 'https://woo.com/usage-tracking', esc_html__( 'Woo.com Usage Tracking Documentation', 'woocommerce' ) );
|
||||
|
||||
$settings =
|
||||
array(
|
||||
@@ -395,10 +395,10 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
$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>',
|
||||
'⚠️ <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/'
|
||||
'https://developer.woo.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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’s notifications arrive in your and your customers’ inboxes, we recommend connecting your email address to your domain and setting up a dedicated SMTP server. If something doesn’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://docs.woocommerce.com/document/email-faq'
|
||||
'https://woo.com/document/email-faq'
|
||||
);
|
||||
$settings =
|
||||
array(
|
||||
|
||||
@@ -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://woocommerce.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://woo.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
|
||||
|
||||
@@ -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://docs.woocommerce.com/document/digital-downloadable-product-handling#nginx-setting'
|
||||
'https://woo.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://docs.woocommerce.com/document/digital-downloadable-product-handling/'
|
||||
'https://woo.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://docs.woocommerce.com/document/digital-downloadable-product-handling#unique-string'
|
||||
'https://woo.com/document/digital-downloadable-product-handling#unique-string'
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
use Automattic\WooCommerce\Internal\Admin\WCAdminAssets;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
@@ -47,8 +48,8 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||
protected function get_own_sections() {
|
||||
$sections = array(
|
||||
'' => __( 'Shipping zones', 'woocommerce' ),
|
||||
'options' => __( 'Shipping options', 'woocommerce' ),
|
||||
'classes' => __( 'Shipping classes', 'woocommerce' ),
|
||||
'options' => __( 'Shipping settings', 'woocommerce' ),
|
||||
'classes' => __( 'Classes', 'woocommerce' ),
|
||||
);
|
||||
|
||||
if ( ! $this->wc_is_installing() ) {
|
||||
@@ -108,7 +109,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||
$settings =
|
||||
array(
|
||||
array(
|
||||
'title' => __( 'Shipping options', 'woocommerce' ),
|
||||
'title' => __( 'Shipping settings', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'shipping_options',
|
||||
),
|
||||
@@ -247,6 +248,48 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all available regions.
|
||||
*
|
||||
* @param int $allowed_countries Zone ID.
|
||||
* @param int $shipping_continents Zone ID.
|
||||
*/
|
||||
protected function get_region_options( $allowed_countries, $shipping_continents ) {
|
||||
$options = array();
|
||||
foreach ( $shipping_continents as $continent_code => $continent ) {
|
||||
$continent_data = array(
|
||||
'value' => 'continent:' . esc_attr( $continent_code ),
|
||||
'label' => esc_html( $continent['name'] ),
|
||||
'children' => array(),
|
||||
);
|
||||
|
||||
$countries = array_intersect( array_keys( $allowed_countries ), $continent['countries'] );
|
||||
|
||||
foreach ( $countries as $country_code ) {
|
||||
$country_data = array(
|
||||
'value' => 'country:' . esc_attr( $country_code ),
|
||||
'label' => esc_html( $allowed_countries[ $country_code ] ),
|
||||
'children' => array(),
|
||||
);
|
||||
|
||||
$states = WC()->countries->get_states( $country_code );
|
||||
|
||||
if ( $states ) {
|
||||
foreach ( $states as $state_code => $state_name ) {
|
||||
$country_data['children'][] = array(
|
||||
'value' => 'state:' . esc_attr( $country_code . ':' . $state_code ),
|
||||
'label' => esc_html( $state_name . ', ' . $allowed_countries[ $country_code ] ),
|
||||
);
|
||||
}
|
||||
}
|
||||
$continent_data['children'][] = $country_data;
|
||||
}
|
||||
$options[] = $continent_data;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show method for a zone
|
||||
*
|
||||
@@ -278,26 +321,34 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||
}
|
||||
}
|
||||
|
||||
$localized_object = array(
|
||||
'methods' => $zone->get_shipping_methods( false, 'json' ),
|
||||
'zone_name' => $zone->get_zone_name(),
|
||||
'zone_id' => $zone->get_id(),
|
||||
'locations' => $locations,
|
||||
'wc_shipping_zones_nonce' => wp_create_nonce( 'wc_shipping_zones_nonce' ),
|
||||
'strings' => array(
|
||||
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
|
||||
'save_changes_prompt' => __( 'Do you wish to save your changes first? Your changed data will be discarded if you choose to cancel.', 'woocommerce' ),
|
||||
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' ),
|
||||
'add_method_failed' => __( 'Shipping method could not be added. Please retry.', 'woocommerce' ),
|
||||
'remove_method_failed' => __( 'Shipping method could not be removed. Please retry.', 'woocommerce' ),
|
||||
'yes' => __( 'Yes', 'woocommerce' ),
|
||||
'no' => __( 'No', 'woocommerce' ),
|
||||
'default_zone_name' => __( 'Zone', 'woocommerce' ),
|
||||
'delete_shipping_method_confirmation' => __( 'Are you sure you want to delete this shipping method?', 'woocommerce' ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( 0 !== $zone->get_id() ) {
|
||||
WCAdminAssets::register_script( 'wp-admin-scripts', 'shipping-settings-region-picker', true, array( 'wc-shipping-zone-methods' ) );
|
||||
$localized_object['region_options'] = $this->get_region_options( $allowed_countries, $shipping_continents );
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
'wc-shipping-zone-methods',
|
||||
'shippingZoneMethodsLocalizeScript',
|
||||
array(
|
||||
'methods' => $zone->get_shipping_methods( false, 'json' ),
|
||||
'zone_name' => $zone->get_zone_name(),
|
||||
'zone_id' => $zone->get_id(),
|
||||
'wc_shipping_zones_nonce' => wp_create_nonce( 'wc_shipping_zones_nonce' ),
|
||||
'strings' => array(
|
||||
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
|
||||
'save_changes_prompt' => __( 'Do you wish to save your changes first? Your changed data will be discarded if you choose to cancel.', 'woocommerce' ),
|
||||
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' ),
|
||||
'add_method_failed' => __( 'Shipping method could not be added. Please retry.', 'woocommerce' ),
|
||||
'remove_method_failed' => __( 'Shipping method could not be removed. Please retry.', 'woocommerce' ),
|
||||
'yes' => __( 'Yes', 'woocommerce' ),
|
||||
'no' => __( 'No', 'woocommerce' ),
|
||||
'default_zone_name' => __( 'Zone', 'woocommerce' ),
|
||||
'delete_shipping_method_confirmation' => __( 'Are you sure you want to delete this shipping method?', 'woocommerce' ),
|
||||
),
|
||||
)
|
||||
$localized_object,
|
||||
);
|
||||
wp_enqueue_script( 'wc-shipping-zone-methods' );
|
||||
|
||||
|
||||
@@ -8,38 +8,119 @@
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h2>
|
||||
<?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Shipping classes can be used to group products of similar type and can be used by some Shipping Methods (such as "Flat rate shipping") to provide different rates to different classes of product.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
<h2 class="wc-shipping-zones-heading">
|
||||
<span><?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?></span>
|
||||
<a class="button button-primary wc-shipping-class-add-new" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a>
|
||||
</h2>
|
||||
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Use shipping classes to customize the shipping rates for different groups of products, such as heavy items that require higher postage fees.', 'woocommerce' ); ?> <a target="_blank" href="https://woocommerce.com/document/product-shipping-classes/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
|
||||
<table class="wc-shipping-classes widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ( $shipping_class_columns as $class => $heading ) : ?>
|
||||
<th class="<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $heading ); ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>">
|
||||
<button type="submit" name="save" class="button button-primary wc-shipping-class-save" value="<?php esc_attr_e( 'Save shipping classes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save shipping classes', 'woocommerce' ); ?></button>
|
||||
<a class="button button-secondary wc-shipping-class-add" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody class="wc-shipping-class-rows"></tbody>
|
||||
<tbody class="wc-shipping-class-rows wc-shipping-tables-tbody"></tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-row-blank">
|
||||
<tr>
|
||||
<td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td>
|
||||
<td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_class_columns ) + 1 ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<!-- 1. Placeholder becomes the "label" in view class div -->
|
||||
<!-- 1. Add labelFor or some kind of attribute for semantic HTML-->
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-configure">
|
||||
<div class="wc-backbone-modal wc-shipping-class-modal">
|
||||
<div class="wc-backbone-modal-content" data-id="{{ data.term_id }}">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="term_id" value="{{{ data.term_id }}}" />
|
||||
<?php
|
||||
foreach ( $shipping_class_columns as $class => $heading ) {
|
||||
echo '<div class="wc-shipping-class-modal-input ' . esc_attr( $class ) . '">';
|
||||
switch ( $class ) {
|
||||
case 'wc-shipping-class-name':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?> *
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="name" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'e.g. Heavy', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Give your shipping class a name for easy identification', 'woocommerce' ); ?></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-slug':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?>
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="slug" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'e.g. heavy-packages', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Slug (unique identifier) can be left blank and auto-generated, or you can enter one', 'woocommerce' ); ?></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-description':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?> *
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="description" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'e.g. For heavy items requiring higher postage', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-count':
|
||||
break;
|
||||
default:
|
||||
?>
|
||||
<div class="view wc-shipping-class-hide-sibling-view">
|
||||
<?php echo esc_html( $heading ); ?>
|
||||
</div>
|
||||
<?php
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
do_action( 'woocommerce_shipping_classes_column_' . $class );
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" disabled class="button button-primary button-large disabled">
|
||||
<div class="wc-backbone-modal-action-{{ data.action === 'create' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div>
|
||||
<div class="wc-backbone-modal-action-{{ data.action === 'edit' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div>
|
||||
</button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wc-backbone-modal-backdrop modal-close"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-row">
|
||||
<tr data-id="{{ data.term_id }}">
|
||||
<?php
|
||||
@@ -50,28 +131,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
?>
|
||||
<div class="view">
|
||||
{{ data.name }}
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-class-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="name[{{ data.term_id }}]" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'Shipping class name', 'woocommerce' ); ?>" />
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-class-cancel-edit" href="#"><?php esc_html_e( 'Cancel changes', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-slug':
|
||||
?>
|
||||
<div class="view">{{ data.slug }}</div>
|
||||
<div class="edit"><input type="text" name="slug[{{ data.term_id }}]" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'Slug', 'woocommerce' ); ?>" /></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-description':
|
||||
?>
|
||||
<div class="view">{{ data.description }}</div>
|
||||
<div class="edit"><input type="text" name="description[{{ data.term_id }}]" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'Description for your reference', 'woocommerce' ); ?>" /></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-count':
|
||||
@@ -80,11 +150,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
do_action( 'woocommerce_shipping_classes_column_' . $class );
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
?>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-class-edit wc-shipping-zone-action-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
@@ -24,8 +24,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="zone_name">
|
||||
<?php esc_html_e( 'Zone name', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'This is the name of the zone for your reference.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Give your zone a name! E.g. Local, or Worldwide.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input type="text" data-attribute="zone_name" name="zone_name" id="zone_name" value="<?php echo esc_attr( $zone->get_zone_name( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Zone name', 'woocommerce' ); ?>">
|
||||
@@ -35,48 +37,34 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="zone_locations">
|
||||
<?php esc_html_e( 'Zone regions', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'These are regions inside this zone. Customers will be matched against these regions.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'List the regions you\'d like to include in your shipping zone. Customers will be matched against these regions.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select multiple="multiple" data-attribute="zone_locations" id="zone_locations" name="zone_locations" data-placeholder="<?php esc_attr_e( 'Select regions within this zone', 'woocommerce' ); ?>" class="wc-shipping-zone-region-select chosen_select">
|
||||
<?php
|
||||
foreach ( $shipping_continents as $continent_code => $continent ) {
|
||||
echo '<option value="continent:' . esc_attr( $continent_code ) . '"' . wc_selected( "continent:$continent_code", $locations ) . '>' . esc_html( $continent['name'] ) . '</option>';
|
||||
|
||||
$countries = array_intersect( array_keys( $allowed_countries ), $continent['countries'] );
|
||||
|
||||
foreach ( $countries as $country_code ) {
|
||||
echo '<option value="country:' . esc_attr( $country_code ) . '"' . wc_selected( "country:$country_code", $locations ) . '>' . esc_html( ' ' . $allowed_countries[ $country_code ] ) . '</option>';
|
||||
|
||||
$states = WC()->countries->get_states( $country_code );
|
||||
|
||||
if ( $states ) {
|
||||
foreach ( $states as $state_code => $state_name ) {
|
||||
echo '<option value="state:' . esc_attr( $country_code . ':' . $state_code ) . '"' . wc_selected( "state:$country_code:$state_code", $locations ) . '>' . esc_html( ' ' . $state_name . ', ' . $allowed_countries[ $country_code ] ) . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<td>
|
||||
<div>
|
||||
<div id="wc-shipping-zone-region-picker-root"/>
|
||||
</div>
|
||||
<?php if ( empty( $postcodes ) ) : ?>
|
||||
<a class="wc-shipping-zone-postcodes-toggle" href="#"><?php esc_html_e( 'Limit to specific ZIP/postcodes', 'woocommerce' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<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://docs.woocommerce.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://woo.com/document/setting-up-shipping-zones/#section-3' ); ?></span><?php // @codingStandardsIgnoreLine. ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<label>
|
||||
<?php esc_html_e( 'Shipping methods', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Add the shipping methods you\'d like to make available to customers in this zone.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</th>
|
||||
<td class="">
|
||||
<table class="wc-shipping-zone-methods widefat">
|
||||
@@ -86,19 +74,19 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th class="wc-shipping-zone-method-title"><?php esc_html_e( 'Title', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-enabled"><?php esc_html_e( 'Enabled', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-description"><?php esc_html_e( 'Description', 'woocommerce' ); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" class="button wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?>"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody class="wc-shipping-zone-method-rows"></tbody>
|
||||
<tbody class="wc-shipping-zone-method-rows wc-shipping-tables-tbody"></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"></th>
|
||||
<td>
|
||||
<button type="submit" class="button button-primary wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?>"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -120,16 +108,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<tr data-id="{{ data.instance_id }}" data-enabled="{{ data.enabled }}">
|
||||
<td width="1%" class="wc-shipping-zone-method-sort"></td>
|
||||
<td class="wc-shipping-zone-method-title">
|
||||
<a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&tab=shipping&instance_id={{ data.instance_id }}">{{{ data.title }}}</a>
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&tab=shipping&instance_id={{ data.instance_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-method-delete"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
{{{ data.title }}}
|
||||
</td>
|
||||
<td width="1%" class="wc-shipping-zone-method-enabled"><a href="#">{{{ data.enabled_icon }}}</a></td>
|
||||
<td class="wc-shipping-zone-method-description">
|
||||
<strong class="wc-shipping-zone-method-type">{{ data.method_title }}</strong>
|
||||
{{{ data.method_description }}}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-zone-method-settings wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&instance_id={{ data.instance_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-method-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
@@ -142,8 +131,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: shipping method title */
|
||||
esc_html__( '%s Settings', 'woocommerce' ),
|
||||
'{{{ data.method.method_title }}}'
|
||||
esc_html__( 'Set up %s', 'woocommerce' ),
|
||||
'{{{ data.method.method_title.toLowerCase() }}}'
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
@@ -151,15 +140,20 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article class="wc-modal-shipping-method-settings">
|
||||
<article class="wc-modal-shipping-method-settings" data-id="{{{ data.instance_id }}}" data-status="{{{ data.status }}}" data-shipping-classes-count="<?php echo count( WC()->shipping()->get_shipping_classes() ); ?>">
|
||||
<form action="" method="post">
|
||||
{{{ data.method.settings_html }}}
|
||||
<input type="hidden" name="instance_id" value="{{{ data.instance_id }}}" />
|
||||
</form>
|
||||
<a class="wc-shipping-method-add-class-costs" style="display:none;" target="_blank" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=classes' ) ); ?>"><?php esc_html_e( 'Add shipping class costs', 'woocommerce' ); ?></a>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
|
||||
<button id="btn-ok" data-status='{{ data.status }}' class="button button-primary button-large">
|
||||
<div class="wc-backbone-modal-action-{{ data.status === 'new' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div>
|
||||
<div class="wc-backbone-modal-action-{{ data.status === 'existing' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div>
|
||||
</button>
|
||||
<div class="wc-shipping-zone-method-modal-info wc-shipping-zone-method-modal-info-{{ data.status === 'existing' ? 'inactive' : 'active' }}"><?php esc_html_e( 'STEP 2 OF 2', 'woocommerce' ); ?></div>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
@@ -169,36 +163,52 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-wc-modal-add-shipping-method">
|
||||
<div class="wc-backbone-modal">
|
||||
<div class="wc-backbone-modal wc-backbone-modal-add-shipping-method">
|
||||
<div class="wc-backbone-modal-content">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></h1>
|
||||
<h1><?php esc_html_e( 'Create shipping method', 'woocommerce' ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<div class="wc-shipping-zone-method-selector">
|
||||
<p><?php esc_html_e( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.', 'woocommerce' ); ?></p>
|
||||
<fieldset class="wc-shipping-zone-method-selector">
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.', 'woocommerce' ); ?></legend>
|
||||
<?php
|
||||
$methods = WC()->shipping()->load_shipping_methods();
|
||||
|
||||
<select name="add_method_id">
|
||||
<?php
|
||||
foreach ( WC()->shipping()->load_shipping_methods() as $method ) {
|
||||
if ( ! $method->supports( 'shipping-zones' ) ) {
|
||||
continue;
|
||||
$methods_placed_in_order = array();
|
||||
$first_methods_ids = array( 'free_shipping', 'flat_rate', 'local_pickup' );
|
||||
|
||||
foreach ( $first_methods_ids as $first_method_id ) {
|
||||
foreach ( $methods as $key => $obj ) {
|
||||
if ( $obj->id === $first_method_id ) {
|
||||
$methods_placed_in_order[] = $obj;
|
||||
unset( $methods[ $key ] );
|
||||
break;
|
||||
}
|
||||
echo '<option data-description="' . esc_attr( wp_kses_post( wpautop( $method->get_method_description() ) ) ) . '" value="' . esc_attr( $method->id ) . '">' . esc_html( $method->get_method_title() ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
|
||||
$methods_placed_in_order = array_merge( $methods_placed_in_order, array_values( $methods ) );
|
||||
|
||||
foreach ( $methods_placed_in_order as $method ) {
|
||||
if ( ! $method->supports( 'shipping-zones' ) ) {
|
||||
continue;
|
||||
}
|
||||
$description = wp_kses_post( $method->get_method_description() );
|
||||
echo '<div class="wc-shipping-zone-method-input"><input type="radio" value="' . esc_attr( $method->id ) . '" id="' . esc_attr( $method->id ) . '" name="add_method_id"/><label for="' . esc_attr( $method->id ) . '">' . esc_html( $method->get_method_title() ) . '<span class="dashicons dashicons-yes"></span></label><div class="wc-shipping-zone-method-input-help-text"><span>' . esc_html( $description ) . '</span></div></div>';
|
||||
}
|
||||
?>
|
||||
</fieldset>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
<button id="btn-next" disabled class="button button-primary button-large disabled"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<div class="wc-shipping-zone-method-modal-info"><?php esc_html_e( 'STEP 1 OF 2', 'woocommerce' ); ?></div>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
|
||||
@@ -5,10 +5,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
?>
|
||||
|
||||
<h2 class="wc-shipping-zones-heading">
|
||||
<?php _e( 'Shipping zones', 'woocommerce' ); ?>
|
||||
<a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ); ?>" class="page-title-action"><?php esc_html_e( 'Add shipping zone', 'woocommerce' ); ?></a>
|
||||
<span><?php esc_html_e( 'Shipping zones', 'woocommerce' ); ?></span>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ) ); ?>" class="button-primary"><?php esc_html_e( 'Add zone', 'woocommerce' ); ?></a>
|
||||
</h2>
|
||||
<p><?php echo __( 'A shipping zone is a geographic region where a certain set of shipping methods are offered.', 'woocommerce' ) . ' ' . __( 'WooCommerce will match a customer to a single zone using their shipping address and present the shipping methods within that zone to them.', 'woocommerce' ); ?></p>
|
||||
<p class="wc-shipping-zone-heading-help-text"><?php echo esc_html_e( 'A shipping zone consists of the region(s) you\'d like to ship to and the shipping method(s) offered. A shopper can only be matched to one zone, and we\'ll use their shipping address to show them the methods available in their area.', 'woocommerce' ); ?></p>
|
||||
<table class="wc-shipping-zones widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -16,39 +16,40 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th class="wc-shipping-zone-name"><?php esc_html_e( 'Zone name', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-region"><?php esc_html_e( 'Region(s)', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-methods"><?php esc_html_e( 'Shipping method(s)', 'woocommerce' ); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="wc-shipping-zone-rows"></tbody>
|
||||
<tbody>
|
||||
<tr data-id="0" class="wc-shipping-zone-worldwide">
|
||||
<td width="1%" class="wc-shipping-zone-worldwide"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=0' ) ); ?>"><?php esc_html_e( 'Locations not covered by your other zones', 'woocommerce' ); ?></a>
|
||||
<div class="row-actions">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id=0"><?php _e( 'Manage shipping methods', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region"><?php _e( 'This zone is <b>optionally</b> used for regions that are not included in any other shipping zone.', 'woocommerce' ); ?></td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<ul>
|
||||
<?php
|
||||
$worldwide = new WC_Shipping_Zone( 0 );
|
||||
$methods = $worldwide->get_shipping_methods();
|
||||
uasort( $methods, 'wc_shipping_zone_method_order_uasort_comparison' );
|
||||
<tbody class="wc-shipping-zone-rows wc-shipping-tables-tbody"></tbody>
|
||||
|
||||
if ( ! empty( $methods ) ) {
|
||||
foreach ( $methods as $method ) {
|
||||
$class_name = 'yes' === $method->enabled ? 'method_enabled' : 'method_disabled';
|
||||
echo '<li class="wc-shipping-zone-method ' . esc_attr( $class_name ) . '">' . esc_html( $method->get_title() ) . '</li>';
|
||||
}
|
||||
} else {
|
||||
echo '<li class="wc-shipping-zone-method">' . __( 'No shipping methods offered to this zone.', 'woocommerce' ) . '</li>';
|
||||
<tfoot data-id="0" class="wc-shipping-zone-worldwide">
|
||||
<td width="1%" class="wc-shipping-zone-worldwide"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<?php esc_html_e( 'Rest of the world', 'woocommerce' ); ?>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region"><?php esc_html_e( 'An optional zone you can use to set the shipping method(s) available to any regions that have not been listed above.', 'woocommerce' ); ?></td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<ul>
|
||||
<?php
|
||||
$worldwide = new WC_Shipping_Zone( 0 );
|
||||
$methods = $worldwide->get_shipping_methods();
|
||||
uasort( $methods, 'wc_shipping_zone_method_order_uasort_comparison' );
|
||||
|
||||
if ( ! empty( $methods ) ) {
|
||||
foreach ( $methods as $method ) {
|
||||
$class_name = 'yes' === $method->enabled ? 'method_enabled' : 'method_disabled';
|
||||
echo '<li class="wc-shipping-zone-method ' . esc_attr( $class_name ) . '">' . esc_html( $method->get_title() ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
} else {
|
||||
echo '<li>' . esc_html_e( 'No shipping methods offered to this zone.', 'woocommerce' ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<a class="wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&zone_id=0"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-zone-row-blank">
|
||||
@@ -73,10 +74,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<tr data-id="{{ data.zone_id }}">
|
||||
<td width="1%" class="wc-shipping-zone-sort"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}">{{ data.zone_name }}</a>
|
||||
<div class="row-actions">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php _e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-delete"><?php _e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
{{ data.zone_name }}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region">
|
||||
{{ data.formatted_zone_location }}
|
||||
@@ -84,6 +82,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<div><ul></ul></div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
|
||||
>
|
||||
<?php
|
||||
$count_html = WC_Helper_Updater::get_updates_count_html();
|
||||
/* translators: %s: WooCommerce.com Subscriptions tab count HTML. */
|
||||
echo ( sprintf( __( 'My Subscriptions %s', 'woocommerce' ), $count_html ) );
|
||||
/* translators: %s: Woo.com Subscriptions tab count HTML. */
|
||||
echo ( wp_kses_post( sprintf( __( 'My Subscriptions %s', 'woocommerce' ), $count_html ) ) );
|
||||
?>
|
||||
</a>
|
||||
</li>
|
||||
@@ -90,7 +90,7 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
|
||||
<?php if ( '_featured' !== $current_section ) : ?>
|
||||
<?php if ( is_wp_error( $addons ) ) : ?>
|
||||
<?php WC_Admin_Addons::output_empty( $addons->get_error_message() ); ?>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php
|
||||
if ( ! empty( $promotions ) && WC()->is_wc_admin_active() ) {
|
||||
foreach ( $promotions as $promotion ) {
|
||||
@@ -105,17 +105,17 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
|
||||
// Do not show USPS or Canada Post extensions for US and CA stores, respectively.
|
||||
$country = WC()->countries->get_base_country();
|
||||
if ( 'US' === $country
|
||||
&& false !== strpos(
|
||||
&& false !== strpos(
|
||||
$addon->link,
|
||||
'woocommerce.com/products/usps-shipping-method'
|
||||
'woo.com/products/usps-shipping-method'
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if ( 'CA' === $country
|
||||
&& false !== strpos(
|
||||
&& false !== strpos(
|
||||
$addon->link,
|
||||
'woocommerce.com/products/canada-post-shipping-method'
|
||||
'woo.com/products/canada-post-shipping-method'
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
@@ -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 WooCommerce.com here: <a href="%s">WooCommerce Extensions Catalog</a>', 'woocommerce' ) ), 'https://woocommerce.com/product-category/woocommerce-extensions/' ); ?></p>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
|
||||
<?php
|
||||
$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' );
|
||||
$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' );
|
||||
?>
|
||||
<div class="storefront">
|
||||
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
|
||||
|
||||
@@ -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://docs.woocommerce.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://woo.com/document/woocommerce-analytics/" target="_blank">WooCommerce Analytics documentation</a>.', 'woocommerce' ), esc_url( wc_admin_url( '&path=/analytics/overview' ) ) ) );
|
||||
?>
|
||||
</strong>
|
||||
</p>
|
||||
|
||||
@@ -31,7 +31,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, Cons
|
||||
</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://docs.woocommerce.com/document/understanding-the-woocommerce-system-status-report/" target="_blank">
|
||||
<a class="button-secondary docs" href="https://woo.com/document/understanding-the-woocommerce-system-status-report/" target="_blank">
|
||||
<?php esc_html_e( 'Understanding the status report', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
@@ -461,7 +461,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, Cons
|
||||
<?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://docs.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>';
|
||||
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>';
|
||||
} else {
|
||||
echo '<mark class="yes">' . esc_html( $database['database_prefix'] ) . '</mark>';
|
||||
}
|
||||
@@ -572,7 +572,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, Cons
|
||||
<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://docs.woocommerce.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://woo.com/document/ssl-and-https/' ) );
|
||||
?>
|
||||
</mark>
|
||||
<?php endif; ?>
|
||||
@@ -737,8 +737,8 @@ if ( 0 < count( $dropins_mu_plugins['mu_plugins'] ) ) :
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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 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><?php echo 'yes' === $settings['woocommerce_com_connected'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<mark class="no">–</mark>'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -968,7 +968,7 @@ if ( 0 < count( $dropins_mu_plugins['mu_plugins'] ) ) :
|
||||
<mark class="error">
|
||||
<span class="dashicons dashicons-warning"></span>
|
||||
</mark>
|
||||
<a href="https://docs.woocommerce.com/document/fix-outdated-templates-woocommerce/" target="_blank">
|
||||
<a href="https://woo.com/document/fix-outdated-templates-woocommerce/" target="_blank">
|
||||
<?php esc_html_e( 'Learn how to update', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
@@ -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§ion=download_urls' ) ) . '">';
|
||||
$documentation_link = '<a href="https://woocommerce.com/document/approved-download-directories">';
|
||||
$documentation_link = '<a href="https://woo.com/document/approved-download-directories">';
|
||||
$closing_link = '</a>';
|
||||
|
||||
printf(
|
||||
|
||||
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<?php esc_html_e( 'Setup shipping zones', 'woocommerce' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a class="button-secondary" href="https://docs.woocommerce.com/document/setting-up-shipping-zones/">
|
||||
<a class="button-secondary" href="https://woo.com/document/setting-up-shipping-zones/">
|
||||
<?php esc_html_e( 'Learn more about shipping zones', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -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://docs.woocommerce.com/document/setting-up-shipping-zones/">
|
||||
<a class="button-secondary" href="https://woo.com/document/setting-up-shipping-zones/">
|
||||
<?php esc_html_e( 'Learn more about shipping zones', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -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://docs.woocommerce.com/document/ssl-and-https/'
|
||||
'https://woo.com/document/ssl-and-https/'
|
||||
) );
|
||||
?>
|
||||
</p>
|
||||
|
||||
@@ -23,7 +23,7 @@ $theme = wp_get_theme();
|
||||
</ol>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<a class="button-primary" href="https://docs.woocommerce.com/document/template-structure/" target="_blank"><?php esc_html_e( 'Learn more about templates', 'woocommerce' ); ?></a>
|
||||
<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="<?php echo esc_url( admin_url( 'admin.php?page=wc-status' ) ); ?>" target="_blank"><?php esc_html_e( 'View affected templates', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -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://docs.woocommerce.com/document/how-to-update-woocommerce/" class="button-secondary">
|
||||
<a href="https://woo.com/document/how-to-update-woocommerce/" class="button-secondary">
|
||||
<?php esc_html_e( 'Learn more about updates', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -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://docs.woocommerce.com/document/digital-downloadable-product-handling/#protecting-your-uploads-directory'
|
||||
'https://woo.com/document/digital-downloadable-product-handling/#protecting-your-uploads-directory'
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -22,7 +22,7 @@ defined( 'ABSPATH' ) || exit;
|
||||
'utm_campaign' => 'woocommerceplugin',
|
||||
'utm_content' => 'docs',
|
||||
),
|
||||
'https://docs.woocommerce.com/document/update-php-wordpress/'
|
||||
'https://woo.com/document/update-php-wordpress/'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user