From d0db4c69345794383acc9dd77e9c83a06f90354f Mon Sep 17 00:00:00 2001 From: Boro Sitnikovski Date: Thu, 7 Sep 2017 09:58:54 +0200 Subject: [PATCH] Reintroduce find and replace variables --- includes/emails/class-wc-email.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/includes/emails/class-wc-email.php b/includes/emails/class-wc-email.php index 60078318274..0b4bdd48682 100644 --- a/includes/emails/class-wc-email.php +++ b/includes/emails/class-wc-email.php @@ -190,6 +190,22 @@ class WC_Email extends WC_Settings_API { */ protected $placeholders = array(); + /** + * Strings to find in subjects/headings. + * + * @deprecated 3.2.0 in favour of placeholders + * @var array + */ + public $find = array(); + + /** + * Strings to replace in subjects/headings. + * + * @deprecated 3.2.0 in favour of placeholders + * @var array + */ + public $replace = array(); + /** * Constructor. */ @@ -242,15 +258,13 @@ class WC_Email extends WC_Settings_API { $replace = array_values( $this->placeholders ); // If using legacy find replace, add those to our find/replace arrays first. @todo deprecate in 4.0.0. - if ( isset( $this->find, $this->replace ) ) { - $find = array_merge( $this->find, $find ); - $replace = array_merge( $this->replace, $replace ); - } + $find = array_merge( $this->find, $find ); + $replace = array_merge( $this->replace, $replace ); // If using the older style filters for find and replace, ensure the array is associative and then pass through filters. @todo deprecate in 4.0.0. if ( has_filter( 'woocommerce_email_format_string_replace' ) || has_filter( 'woocommerce_email_format_string_find' ) ) { - $legacy_find = isset( $this->find ) ? $this->find : array(); - $legacy_replace = isset( $this->replace ) ? $this->replace : array(); + $legacy_find = $this->find; + $legacy_replace = $this->replace; foreach ( $this->placeholders as $find => $replace ) { $legacy_key = sanitize_title( str_replace( '_', '-', trim( $find, '{}' ) ) );