From c3554490b531846ec0e652f5c9b903d491e400b1 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 26 Feb 2016 15:26:39 +0000 Subject: [PATCH] Backwards compatibility --- includes/admin/settings/class-wc-settings-checkout.php | 6 ++---- includes/admin/settings/class-wc-settings-shipping.php | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/admin/settings/class-wc-settings-checkout.php b/includes/admin/settings/class-wc-settings-checkout.php index c2e87211e54..ed8f5306532 100644 --- a/includes/admin/settings/class-wc-settings-checkout.php +++ b/includes/admin/settings/class-wc-settings-checkout.php @@ -241,10 +241,8 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page { $payment_gateways = WC()->payment_gateways->payment_gateways(); if ( $current_section ) { - foreach ( $payment_gateways as $gateway ) { - - if ( strtolower( $current_section ) === $gateway->id ) { + if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ) ) ) { $gateway->admin_options(); break; } @@ -349,7 +347,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page { } else { 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 ); $wc_payment_gateways->init(); } diff --git a/includes/admin/settings/class-wc-settings-shipping.php b/includes/admin/settings/class-wc-settings-shipping.php index 22877addef4..e6cc76466d8 100644 --- a/includes/admin/settings/class-wc-settings-shipping.php +++ b/includes/admin/settings/class-wc-settings-shipping.php @@ -137,7 +137,7 @@ class WC_Settings_Shipping extends WC_Settings_Page { return; } else { 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(); return; } @@ -166,7 +166,7 @@ class WC_Settings_Shipping extends WC_Settings_Page { $wc_shipping = WC_Shipping::instance(); 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 ); } }