Make sure get_hook_prefix is present on all of our classes.

And fix up an exclude internal keys call for the customer data store.
This commit is contained in:
Justin Shreve 2016-11-22 04:20:25 -08:00
parent e1d2a252b7
commit 58b4cb9cf4
5 changed files with 51 additions and 11 deletions

View File

@ -109,6 +109,16 @@ class WC_Coupon extends WC_Legacy_Coupon {
return ( $this->get_discount_type() == $type || ( is_array( $type ) && in_array( $this->get_discount_type(), $type ) ) );
}
/**
* Prefix for action and filter hooks on data.
*
* @since 2.7.0
* @return string
*/
protected function get_hook_prefix() {
return 'woocommerce_get_coupon_';
}
/*
|--------------------------------------------------------------------------
| Getters

View File

@ -113,19 +113,14 @@ class WC_Customer extends WC_Legacy_Customer {
}
/**
* Callback to remove unwanted meta data.
* Prefix for action and filter hooks on data.
*
* @param object $meta
* @return bool
* @since 2.7.0
* @return string
*/
protected function exclude_internal_meta_keys( $meta ) {
global $wpdb;
return ! in_array( $meta->meta_key, $this->get_internal_meta_keys() )
&& 0 !== strpos( $meta->meta_key, 'closedpostboxes_' )
&& 0 !== strpos( $meta->meta_key, 'metaboxhidden_' )
&& 0 !== strpos( $meta->meta_key, 'manageedit-' )
&& ! strstr( $meta->meta_key, $wpdb->prefix );
}
protected function get_hook_prefix() {
return 'woocommerce_get_customer_';
}
/**
* Delete a customer and reassign posts..

View File

@ -69,6 +69,16 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
}
}
/**
* Prefix for action and filter hooks on data.
*
* @since 2.7.0
* @return string
*/
protected function get_hook_prefix() {
return 'woocommerce_get_order_item_';
}
/*
|--------------------------------------------------------------------------
| Getters

View File

@ -56,6 +56,16 @@ class WC_Shipping_Zone extends WC_Legacy_Shipping_Zone {
}
}
/**
* Prefix for action and filter hooks on data.
*
* @since 2.7.0
* @return string
*/
protected function get_hook_prefix() {
return 'woocommerce_get_shipping_zone_';
}
/*
|--------------------------------------------------------------------------
| Getters

View File

@ -63,6 +63,21 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
*/
protected $meta_type = 'user';
/**
* Callback to remove unwanted meta data.
*
* @param object $meta
* @return bool
*/
protected function exclude_internal_meta_keys( $meta ) {
global $wpdb;
return ! in_array( $meta->meta_key, $this->internal_meta_keys )
&& 0 !== strpos( $meta->meta_key, 'closedpostboxes_' )
&& 0 !== strpos( $meta->meta_key, 'metaboxhidden_' )
&& 0 !== strpos( $meta->meta_key, 'manageedit-' )
&& ! strstr( $meta->meta_key, $wpdb->prefix );
}
/**
* Method to create a new customer in the database.
*