Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
93e9830c57
|
@ -138,7 +138,7 @@ jQuery( function( $ ) {
|
||||||
|
|
||||||
$( document.body ).trigger( 'country_to_state_changed', [country, $wrapper ] );
|
$( document.body ).trigger( 'country_to_state_changed', [country, $wrapper ] );
|
||||||
|
|
||||||
} else if ( $statebox.is( '.hidden' ) ) {
|
} else if ( $statebox.is( 'input[type="hidden"]' ) ) {
|
||||||
|
|
||||||
$parent.show().find( '.select2-container' ).remove();
|
$parent.show().find( '.select2-container' ).remove();
|
||||||
$statebox.replaceWith( '<input type="text" class="input-text" name="' + input_name + '" id="' + input_id + '" placeholder="' + placeholder + '" />' );
|
$statebox.replaceWith( '<input type="text" class="input-text" name="' + input_name + '" id="' + input_id + '" placeholder="' + placeholder + '" />' );
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?wc_country_select_params.i18n_matches_1:wc_country_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return wc_country_select_params.i18n_no_matches},formatAjaxError:function(){return wc_country_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return wc_country_select_params.i18n_load_more},formatSearching:function(){return wc_country_select_params.i18n_searching}};return a}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({placeholderOption:"first",width:"100%"},b());a(this).select2(c)})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/"/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");b.size()||(b=a(this).closest(".form-row").parent());var c=a(this).val(),d=b.find("#billing_state, #shipping_state, #calc_shipping_state"),f=d.parent(),g=d.attr("name"),h=d.attr("id"),i=d.val(),j=d.attr("placeholder")||d.attr("data-placeholder")||"";if(e[c])if(a.isEmptyObject(e[c]))d.parent().hide().find(".select2-container").remove(),d.replaceWith('<input type="hidden" class="hidden" name="'+g+'" id="'+h+'" value="" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]);else{var k="",l=e[c];for(var m in l)l.hasOwnProperty(m)&&(k=k+'<option value="'+m+'">'+l[m]+"</option>");d.parent().show(),d.is("input")&&(d.replaceWith('<select name="'+g+'" id="'+h+'" class="state_select" data-placeholder="'+j+'"></select>'),d=b.find("#billing_state, #shipping_state, #calc_shipping_state")),d.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+k),d.val(i).change(),a(document.body).trigger("country_to_state_changed",[c,b])}else d.is("select")?(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b])):d.is(".hidden")&&(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]));a(document.body).trigger("country_to_state_changing",[c,b])}),a(function(){a(":input.country_to_state").change()})});
|
jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?wc_country_select_params.i18n_matches_1:wc_country_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return wc_country_select_params.i18n_no_matches},formatAjaxError:function(){return wc_country_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return wc_country_select_params.i18n_load_more},formatSearching:function(){return wc_country_select_params.i18n_searching}};return a}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({placeholderOption:"first",width:"100%"},b());a(this).select2(c)})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/"/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");b.size()||(b=a(this).closest(".form-row").parent());var c=a(this).val(),d=b.find("#billing_state, #shipping_state, #calc_shipping_state"),f=d.parent(),g=d.attr("name"),h=d.attr("id"),i=d.val(),j=d.attr("placeholder")||d.attr("data-placeholder")||"";if(e[c])if(a.isEmptyObject(e[c]))d.parent().hide().find(".select2-container").remove(),d.replaceWith('<input type="hidden" class="hidden" name="'+g+'" id="'+h+'" value="" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]);else{var k="",l=e[c];for(var m in l)l.hasOwnProperty(m)&&(k=k+'<option value="'+m+'">'+l[m]+"</option>");d.parent().show(),d.is("input")&&(d.replaceWith('<select name="'+g+'" id="'+h+'" class="state_select" data-placeholder="'+j+'"></select>'),d=b.find("#billing_state, #shipping_state, #calc_shipping_state")),d.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+k),d.val(i).change(),a(document.body).trigger("country_to_state_changed",[c,b])}else d.is("select")?(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b])):d.is('input[type="hidden"]')&&(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]));a(document.body).trigger("country_to_state_changing",[c,b])}),a(function(){a(":input.country_to_state").change()})});
|
|
@ -50,7 +50,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||||
|
|
||||||
foreach ( $payment_gateways as $gateway ) {
|
foreach ( $payment_gateways as $gateway ) {
|
||||||
$title = empty( $gateway->method_title ) ? ucfirst( $gateway->id ) : $gateway->method_title;
|
$title = empty( $gateway->method_title ) ? ucfirst( $gateway->id ) : $gateway->method_title;
|
||||||
$sections[ strtolower( get_class( $gateway ) ) ] = esc_html( $title );
|
$sections[ strtolower( $gateway->id ) ] = esc_html( $title );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +241,8 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||||
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
||||||
|
|
||||||
if ( $current_section ) {
|
if ( $current_section ) {
|
||||||
|
|
||||||
foreach ( $payment_gateways as $gateway ) {
|
foreach ( $payment_gateways as $gateway ) {
|
||||||
|
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ) ) ) {
|
||||||
if ( strtolower( get_class( $gateway ) ) == strtolower( $current_section ) ) {
|
|
||||||
$gateway->admin_options();
|
$gateway->admin_options();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +347,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
foreach ( $wc_payment_gateways->payment_gateways() as $gateway ) {
|
foreach ( $wc_payment_gateways->payment_gateways() as $gateway ) {
|
||||||
if ( $current_section === sanitize_title( get_class( $gateway ) ) ) {
|
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ) ) ) {
|
||||||
do_action( 'woocommerce_update_options_payment_gateways_' . $gateway->id );
|
do_action( 'woocommerce_update_options_payment_gateways_' . $gateway->id );
|
||||||
$wc_payment_gateways->init();
|
$wc_payment_gateways->init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$title = empty( $method->method_title ) ? ucfirst( $method->id ) : $method->method_title;
|
$title = empty( $method->method_title ) ? ucfirst( $method->id ) : $method->method_title;
|
||||||
$sections[ strtolower( get_class( $method ) ) ] = esc_html( $title );
|
$sections[ strtolower( $method->id ) ] = esc_html( $title );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
foreach ( $shipping_methods as $method ) {
|
foreach ( $shipping_methods as $method ) {
|
||||||
if ( strtolower( get_class( $method ) ) === strtolower( $current_section ) && $method->has_settings() ) {
|
if ( in_array( $current_section, array( $method->id, sanitize_title( get_class( $method ) ) ) ) && $method->has_settings() ) {
|
||||||
$method->admin_options();
|
$method->admin_options();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||||
$wc_shipping = WC_Shipping::instance();
|
$wc_shipping = WC_Shipping::instance();
|
||||||
|
|
||||||
foreach ( $wc_shipping->get_shipping_methods() as $method_id => $method ) {
|
foreach ( $wc_shipping->get_shipping_methods() as $method_id => $method ) {
|
||||||
if ( $current_section === sanitize_title( get_class( $method ) ) ) {
|
if ( in_array( $current_section, array( $method->id, sanitize_title( get_class( $method ) ) ) ) ) {
|
||||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $method->id );
|
do_action( 'woocommerce_update_options_' . $this->id . '_' . $method->id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue