Merge pull request #23250 from Spreeuw/patch-7
Add $this parameter to email class filters
This commit is contained in:
commit
f66e523c5f
|
@ -84,11 +84,11 @@ if ( ! class_exists( 'WC_Email_Customer_Invoice', false ) ) :
|
|||
if ( $this->object->has_status( array( 'completed', 'processing' ) ) ) {
|
||||
$subject = $this->get_option( 'subject_paid', $this->get_default_subject( true ) );
|
||||
|
||||
return apply_filters( 'woocommerce_email_subject_customer_invoice_paid', $this->format_string( $subject ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_subject_customer_invoice_paid', $this->format_string( $subject ), $this->object, $this );
|
||||
}
|
||||
|
||||
$subject = $this->get_option( 'subject', $this->get_default_subject() );
|
||||
return apply_filters( 'woocommerce_email_subject_customer_invoice', $this->format_string( $subject ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_subject_customer_invoice', $this->format_string( $subject ), $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,11 +99,11 @@ if ( ! class_exists( 'WC_Email_Customer_Invoice', false ) ) :
|
|||
public function get_heading() {
|
||||
if ( $this->object->has_status( wc_get_is_paid_statuses() ) ) {
|
||||
$heading = $this->get_option( 'heading_paid', $this->get_default_heading( true ) );
|
||||
return apply_filters( 'woocommerce_email_heading_customer_invoice_paid', $this->format_string( $heading ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_heading_customer_invoice_paid', $this->format_string( $heading ), $this->object, $this );
|
||||
}
|
||||
|
||||
$heading = $this->get_option( 'heading', $this->get_default_heading() );
|
||||
return apply_filters( 'woocommerce_email_heading_customer_invoice', $this->format_string( $heading ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_heading_customer_invoice', $this->format_string( $heading ), $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,7 +102,7 @@ if ( ! class_exists( 'WC_Email_Customer_Refunded_Order', false ) ) :
|
|||
} else {
|
||||
$subject = $this->get_option( 'subject_full', $this->get_default_subject() );
|
||||
}
|
||||
return apply_filters( 'woocommerce_email_subject_customer_refunded_order', $this->format_string( $subject ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_subject_customer_refunded_order', $this->format_string( $subject ), $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ if ( ! class_exists( 'WC_Email_Customer_Refunded_Order', false ) ) :
|
|||
} else {
|
||||
$heading = $this->get_option( 'heading_full', $this->get_default_heading() );
|
||||
}
|
||||
return apply_filters( 'woocommerce_email_heading_customer_refunded_order', $this->format_string( $heading ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_heading_customer_refunded_order', $this->format_string( $heading ), $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -351,7 +351,7 @@ class WC_Email extends WC_Settings_API {
|
|||
* @return string
|
||||
*/
|
||||
public function get_subject() {
|
||||
return apply_filters( 'woocommerce_email_subject_' . $this->id, $this->format_string( $this->get_option( 'subject', $this->get_default_subject() ) ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_subject_' . $this->id, $this->format_string( $this->get_option( 'subject', $this->get_default_subject() ) ), $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -360,7 +360,7 @@ class WC_Email extends WC_Settings_API {
|
|||
* @return string
|
||||
*/
|
||||
public function get_heading() {
|
||||
return apply_filters( 'woocommerce_email_heading_' . $this->id, $this->format_string( $this->get_option( 'heading', $this->get_default_heading() ) ), $this->object );
|
||||
return apply_filters( 'woocommerce_email_heading_' . $this->id, $this->format_string( $this->get_option( 'heading', $this->get_default_heading() ) ), $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -369,7 +369,7 @@ class WC_Email extends WC_Settings_API {
|
|||
* @return string
|
||||
*/
|
||||
public function get_recipient() {
|
||||
$recipient = apply_filters( 'woocommerce_email_recipient_' . $this->id, $this->recipient, $this->object );
|
||||
$recipient = apply_filters( 'woocommerce_email_recipient_' . $this->id, $this->recipient, $this->object, $this );
|
||||
$recipients = array_map( 'trim', explode( ',', $recipient ) );
|
||||
$recipients = array_filter( $recipients, 'is_email' );
|
||||
return implode( ', ', $recipients );
|
||||
|
@ -391,7 +391,7 @@ class WC_Email extends WC_Settings_API {
|
|||
$header .= 'Reply-to: ' . $this->get_from_name() . ' <' . $this->get_from_address() . ">\r\n";
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_email_headers', $header, $this->id, $this->object );
|
||||
return apply_filters( 'woocommerce_email_headers', $header, $this->id, $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,7 +400,7 @@ class WC_Email extends WC_Settings_API {
|
|||
* @return array
|
||||
*/
|
||||
public function get_attachments() {
|
||||
return apply_filters( 'woocommerce_email_attachments', array(), $this->id, $this->object );
|
||||
return apply_filters( 'woocommerce_email_attachments', array(), $this->id, $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -464,7 +464,7 @@ class WC_Email extends WC_Settings_API {
|
|||
* @return bool
|
||||
*/
|
||||
public function is_enabled() {
|
||||
return apply_filters( 'woocommerce_email_enabled_' . $this->id, 'yes' === $this->enabled, $this->object );
|
||||
return apply_filters( 'woocommerce_email_enabled_' . $this->id, 'yes' === $this->enabled, $this->object, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue