Fix woocommerce_email_from_* filtering

- apply filters before sanitizing
- send entire $this as argument so hooked functions can access any properties of the WC_Email (subclass) instance
This commit is contained in:
Yoni Mazuz 2015-11-20 13:00:37 -05:00
parent afb19228a9
commit 9e5098627c
1 changed files with 4 additions and 4 deletions

View File

@ -435,8 +435,8 @@ class WC_Email extends WC_Settings_API {
* @return string
*/
public function get_from_name() {
$from_name = wp_specialchars_decode( esc_html( get_option( 'woocommerce_email_from_name' ) ), ENT_QUOTES );
return apply_filters( 'woocommerce_email_from_name', $from_name, $this->id, $this->object );
$from_name = apply_filters( 'woocommerce_email_from_name', get_option( 'woocommerce_email_from_name' ), $this );
return wp_specialchars_decode( esc_html( $from_name ), ENT_QUOTES );
}
/**
@ -444,8 +444,8 @@ class WC_Email extends WC_Settings_API {
* @return string
*/
public function get_from_address() {
$from_address = return sanitize_email( get_option( 'woocommerce_email_from_address' ) );
return apply_filters( 'woocommerce_email_from_address', $from_address, $this->id, $this->object );
$from_address = apply_filters( 'woocommerce_email_from_address', get_option( 'woocommerce_email_from_address' ), $this );
return sanitize_email( $from_address );
}
/**