From 75d8163d36084be51b32c16c6b58c29901c7721a Mon Sep 17 00:00:00 2001 From: Geert De Deckere Date: Sat, 5 May 2012 15:32:24 +0200 Subject: [PATCH] Made shipping classes a bit more DRY --- classes/shipping/class-wc-flat-rate.php | 4 ++-- classes/shipping/class-wc-free-shipping.php | 2 +- classes/shipping/class-wc-international-delivery.php | 4 ++-- classes/shipping/class-wc-local-delivery.php | 2 +- classes/shipping/class-wc-local-pickup.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/shipping/class-wc-flat-rate.php b/classes/shipping/class-wc-flat-rate.php index 361c73c9ad1..30d74371802 100644 --- a/classes/shipping/class-wc-flat-rate.php +++ b/classes/shipping/class-wc-flat-rate.php @@ -19,8 +19,8 @@ class WC_Flat_Rate extends WC_Shipping_Method { $this->admin_page_heading = __('Flat Rates', 'woocommerce'); $this->admin_page_description = __('Flat rates let you define a standard rate per item, or per order.', 'woocommerce'); - add_action('woocommerce_update_options_shipping_flat_rate', array(&$this, 'process_admin_options')); - add_action('woocommerce_update_options_shipping_flat_rate', array(&$this, 'process_flat_rates')); + add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); + add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_flat_rates')); $this->init(); } diff --git a/classes/shipping/class-wc-free-shipping.php b/classes/shipping/class-wc-free-shipping.php index 69a1e05ae4a..2ed1d725b83 100644 --- a/classes/shipping/class-wc-free-shipping.php +++ b/classes/shipping/class-wc-free-shipping.php @@ -33,7 +33,7 @@ class WC_Free_Shipping extends WC_Shipping_Method { $this->requires_coupon = $this->settings['requires_coupon']; // Actions - add_action('woocommerce_update_options_shipping_free_shipping', array(&$this, 'process_admin_options')); + add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); } /** diff --git a/classes/shipping/class-wc-international-delivery.php b/classes/shipping/class-wc-international-delivery.php index 2ec3cc4f727..c165ed66b65 100644 --- a/classes/shipping/class-wc-international-delivery.php +++ b/classes/shipping/class-wc-international-delivery.php @@ -22,8 +22,8 @@ class WC_International_Delivery extends WC_Flat_Rate { $this->admin_page_heading = __('International Delivery', 'woocommerce'); $this->admin_page_description = __('International delivery based on flat rate shipping.', 'woocommerce'); - add_action('woocommerce_update_options_shipping_international_delivery', array(&$this, 'process_admin_options')); - add_action('woocommerce_update_options_shipping_international_delivery', array(&$this, 'process_flat_rates')); + add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); + add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_flat_rates')); $this->init(); } diff --git a/classes/shipping/class-wc-local-delivery.php b/classes/shipping/class-wc-local-delivery.php index 383a5fbdd5d..7ed6a535aa8 100644 --- a/classes/shipping/class-wc-local-delivery.php +++ b/classes/shipping/class-wc-local-delivery.php @@ -35,7 +35,7 @@ class WC_Local_Delivery extends WC_Shipping_Method { $this->availability = empty( $this->settings['availability'] ) ? '' : $this->settings['availability']; $this->countries = empty( $this->settings['countries'] ) ? '' : $this->settings['countries']; - add_action('woocommerce_update_options_shipping_local_delivery', array(&$this, 'process_admin_options')); + add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); } function calculate_shipping( $package = array() ) { diff --git a/classes/shipping/class-wc-local-pickup.php b/classes/shipping/class-wc-local-pickup.php index 3a85d474c81..c920c8e7e2a 100644 --- a/classes/shipping/class-wc-local-pickup.php +++ b/classes/shipping/class-wc-local-pickup.php @@ -31,7 +31,7 @@ class WC_Local_Pickup extends WC_Shipping_Method { $this->availability = $this->settings['availability']; $this->countries = $this->settings['countries']; - add_action('woocommerce_update_options_shipping_local_pickup', array(&$this, 'process_admin_options')); + add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); } function calculate_shipping() {