Backwards compatibility

This commit is contained in:
Mike Jolley 2016-02-26 15:26:39 +00:00
parent 346b25d01b
commit c3554490b5
2 changed files with 4 additions and 6 deletions

View File

@ -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( $current_section ) === $gateway->id ) {
$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 ( strtolower( $current_section ) === $gateway->id ) { 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();
} }

View File

@ -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( $current_section ) === $method->id ) && $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 ( strtolower( $current_section ) === $method->id ) { 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 );
} }
} }