Enabled product bundles

This commit is contained in:
Nedim Uka
2018-06-29 14:40:28 +02:00
parent e0514f7f57
commit b5475ff2f1
12004 changed files with 1694047 additions and 1610 deletions

View File

@@ -32,7 +32,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
global $wp_scripts;
$screen = get_current_screen();
$screen_id = $screen ? $screen->id: '';
$screen_id = $screen ? $screen->id : '';
// Register admin styles.
wp_register_style( 'woocommerce_admin_menu_styles', WC()->plugin_url() . '/assets/css/menu.css', array(), WC_VERSION );
@@ -161,23 +161,24 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
$params = array(
/* translators: %s: decimal */
'i18n_decimal_error' => sprintf( __( 'Please enter in decimal (%s) format without thousand separators.', 'woocommerce' ), $decimal ),
'i18n_decimal_error' => sprintf( __( 'Please enter in decimal (%s) format without thousand separators.', 'woocommerce' ), $decimal ),
/* translators: %s: price decimal separator */
'i18n_mon_decimal_error' => sprintf( __( 'Please enter in monetary decimal (%s) format without thousand separators and currency symbols.', 'woocommerce' ), wc_get_price_decimal_separator() ),
'i18n_country_iso_error' => __( 'Please enter in country code with two capital letters.', 'woocommerce' ),
'i18_sale_less_than_regular_error' => __( 'Please enter in a value less than the regular price.', 'woocommerce' ),
'i18_delete_product_notice' => __( 'This product has produced sales and may be linked to existing orders. Are you sure you want to delete it?', 'woocommerce' ),
'decimal_point' => $decimal,
'mon_decimal_point' => wc_get_price_decimal_separator(),
'ajax_url' => admin_url( 'admin-ajax.php' ),
'strings' => array(
'i18n_mon_decimal_error' => sprintf( __( 'Please enter in monetary decimal (%s) format without thousand separators and currency symbols.', 'woocommerce' ), wc_get_price_decimal_separator() ),
'i18n_country_iso_error' => __( 'Please enter in country code with two capital letters.', 'woocommerce' ),
'i18n_sale_less_than_regular_error' => __( 'Please enter in a value less than the regular price.', 'woocommerce' ),
'i18n_delete_product_notice' => __( 'This product has produced sales and may be linked to existing orders. Are you sure you want to delete it?', 'woocommerce' ),
'i18n_remove_personal_data_notice' => __( 'This action cannot be reversed. Are you sure you wish to erase personal data from the selected orders?', 'woocommerce' ),
'decimal_point' => $decimal,
'mon_decimal_point' => wc_get_price_decimal_separator(),
'ajax_url' => admin_url( 'admin-ajax.php' ),
'strings' => array(
'import_products' => __( 'Import', 'woocommerce' ),
'export_products' => __( 'Export', 'woocommerce' ),
),
'nonces' => array(
'nonces' => array(
'gateway_toggle' => wp_create_nonce( 'woocommerce-toggle-payment-gateway-enabled' ),
),
'urls' => array(
'urls' => array(
'import_products' => current_user_can( 'import' ) ? esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_importer' ) ) : null,
'export_products' => current_user_can( 'export' ) ? esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_exporter' ) ) : null,
),

View File

@@ -360,7 +360,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
<script type="text/template" id="network-orders-row-template">
<tr>
<td>
<a href="<%- edit_url %>" class="order-view"><strong>#<%- id %> <%- customer %></strong></a>
<a href="<%- edit_url %>" class="order-view"><strong>#<%- number %> <%- customer %></strong></a>
<br>
<em>
<%- blog.blogname %>

View File

@@ -34,6 +34,7 @@ class WC_Admin_Notices {
'simplify_commerce' => 'simplify_commerce_notice',
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
'no_secure_connection' => 'secure_connection_notice',
'wootenberg' => 'wootenberg_feature_plugin_notice',
);
/**
@@ -49,6 +50,7 @@ class WC_Admin_Notices {
if ( current_user_can( 'manage_woocommerce' ) ) {
add_action( 'admin_print_styles', array( __CLASS__, 'add_notices' ) );
add_action( 'activate_gutenberg/gutenberg.php', array( __CLASS__, 'add_wootenberg_feature_plugin_notice_on_gutenberg_activate' ) );
}
}
@@ -91,6 +93,7 @@ class WC_Admin_Notices {
WC_Admin_Notices::add_notice( 'no_secure_connection' );
}
WC_Admin_Notices::add_wootenberg_feature_plugin_notice();
self::add_notice( 'template_files' );
}
@@ -357,6 +360,42 @@ class WC_Admin_Notices {
include dirname( __FILE__ ) . '/views/html-notice-secure-connection.php';
}
/**
* If Gutenberg is active, tell people about the Products block feature plugin.
*
* @since 3.4.3
* @todo Remove this notice and associated code once the feature plugin has been merged into core.
*/
public static function add_wootenberg_feature_plugin_notice() {
if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) {
self::add_notice( 'wootenberg' );
}
}
/**
* Tell people about the Products block feature plugin when they activate Gutenberg.
*
* @since 3.4.3
* @todo Remove this notice and associated code once the feature plugin has been merged into core.
*/
public static function add_wootenberg_feature_plugin_notice_on_gutenberg_activate() {
if ( ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) {
self::add_notice( 'wootenberg' );
}
}
/**
* Notice about trying the Products block.
*/
public static function wootenberg_feature_plugin_notice() {
if ( get_user_meta( get_current_user_id(), 'dismissed_wootenberg_notice', true ) || is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) {
self::remove_notice( 'wootenberg' );
return;
}
include dirname( __FILE__ ) . '/views/html-notice-wootenberg.php';
}
}
WC_Admin_Notices::init();

View File

@@ -2106,7 +2106,7 @@ class WC_Admin_Setup_Wizard {
<div class="woocommerce-message woocommerce-newsletter">
<p><?php esc_html_e( "We're here for you — get tips, product updates, and inspiration straight to your mailbox.", 'woocommerce' ); ?></p>
<form action="//woocommerce.us8.list-manage.com/subscribe/post?u=2c1434dc56f9506bf3c3ecd21&amp;id=13860df971" method="post" target="_blank" novalidate>
<form action="//woocommerce.us8.list-manage.com/subscribe/post?u=2c1434dc56f9506bf3c3ecd21&amp;id=13860df971&amp;SIGNUPPAGE=plugin" method="post" target="_blank" novalidate>
<div class="newsletter-form-container">
<input
class="newsletter-form-email"

View File

@@ -207,6 +207,22 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
);
}
/**
* Process bulk actions.
*/
public function process_bulk_action() {
$action = $this->current_action();
$webhooks = isset( $_REQUEST['webhook'] ) ? array_map( 'absint', (array) $_REQUEST['webhook'] ) : array(); // WPCS: input var okay, CSRF ok.
if ( ! current_user_can( 'manage_woocommerce' ) ) {
wp_die( esc_html__( 'You do not have permission to edit Webhooks', 'woocommerce' ) );
}
if ( 'delete' === $action ) {
WC_Admin_Webhooks::bulk_delete( $webhooks );
}
}
/**
* Generate the table navigation above or below the table.
* Included to remove extra nonce input.

View File

@@ -150,7 +150,7 @@ class WC_Admin_Webhooks {
*
* @param array $webhooks List of webhooks IDs.
*/
private function bulk_delete( $webhooks ) {
public static function bulk_delete( $webhooks ) {
foreach ( $webhooks as $webhook_id ) {
$webhook = new WC_Webhook( (int) $webhook_id );
$webhook->delete( true );
@@ -179,27 +179,6 @@ class WC_Admin_Webhooks {
}
}
/**
* Bulk actions.
*/
private function bulk_actions() {
check_admin_referer( 'woocommerce-settings' );
if ( ! current_user_can( 'manage_woocommerce' ) ) {
wp_die( esc_html__( 'You do not have permission to edit Webhooks', 'woocommerce' ) );
}
if ( isset( $_REQUEST['action'] ) ) { // WPCS: input var okay, CSRF ok.
$webhooks = isset( $_REQUEST['webhook'] ) ? array_map( 'absint', (array) $_REQUEST['webhook'] ) : array(); // WPCS: input var okay, CSRF ok.
$action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); // WPCS: input var okay, CSRF ok.
if ( 'delete' === $action ) {
$this->bulk_delete( $webhooks );
}
}
}
/**
* Webhooks admin actions.
*/
@@ -210,11 +189,6 @@ class WC_Admin_Webhooks {
$this->save();
}
// Bulk actions.
if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['webhook'] ) ) { // WPCS: input var okay, CSRF ok.
$this->bulk_actions();
}
// Delete webhook.
if ( isset( $_GET['delete'] ) ) { // WPCS: input var okay, CSRF ok.
$this->delete();
@@ -299,6 +273,7 @@ class WC_Admin_Webhooks {
$count = count( $data_store->get_webhooks_ids() );
if ( 0 < $count ) {
$webhooks_table_list->process_bulk_action();
$webhooks_table_list->prepare_items();
echo '<input type="hidden" name="page" value="wc-settings" />';

View File

@@ -575,7 +575,7 @@ class WC_Product_CSV_Importer_Controller {
* @return string
*/
protected function sanitize_special_column_name_regex( $value ) {
return '/' . str_replace( array( '%d', '%s' ), '(.*)', quotemeta( $value ) ) . '/';
return '/' . str_replace( array( '%d', '%s' ), '(.*)', trim( quotemeta( $value ) ) ) . '/';
}
/**

View File

@@ -644,6 +644,9 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
// Sanity check: bail out if this is actually not a status, or is not a registered status.
if ( isset( $order_statuses[ 'wc-' . $new_status ] ) ) {
// Initialize payment gateways in case order has hooked status transition actions.
wc()->payment_gateways();
foreach ( $ids as $id ) {
$order = wc_get_order( $id );
$order->update_status( $new_status, __( 'Order status changed by bulk edit:', 'woocommerce' ), true );

View File

@@ -332,7 +332,9 @@ class WC_Meta_Box_Order_Data {
$field_name = 'billing_' . $key;
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
if ( isset( $field['value'] ) ) {
$field_value = $field['value'];
} elseif ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
$field_value = $order->{"get_$field_name"}( 'edit' );
} else {
$field_value = $order->get_meta( '_' . $field_name );
@@ -365,10 +367,12 @@ class WC_Meta_Box_Order_Data {
$field_name = 'billing_' . $key;
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
$field['value'] = $order->{"get_$field_name"}( 'edit' );
} else {
$field['value'] = $order->get_meta( '_' . $field_name );
if ( ! isset( $field['value'] ) ) {
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
$field['value'] = $order->{"get_$field_name"}( 'edit' );
} else {
$field['value'] = $order->get_meta( '_' . $field_name );
}
}
switch ( $field['type'] ) {

Some files were not shown because too many files have changed in this diff Show More