Merge pull request #16734 from woocommerce/fix/mail-notices
Reintroduce find and replace variables
This commit is contained in:
commit
a98a70f559
|
@ -190,6 +190,22 @@ class WC_Email extends WC_Settings_API {
|
||||||
*/
|
*/
|
||||||
protected $placeholders = array();
|
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.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -242,15 +258,13 @@ class WC_Email extends WC_Settings_API {
|
||||||
$replace = array_values( $this->placeholders );
|
$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 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 );
|
$find = array_merge( $this->find, $find );
|
||||||
$replace = array_merge( $this->replace, $replace );
|
$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 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' ) ) {
|
if ( has_filter( 'woocommerce_email_format_string_replace' ) || has_filter( 'woocommerce_email_format_string_find' ) ) {
|
||||||
$legacy_find = isset( $this->find ) ? $this->find : array();
|
$legacy_find = $this->find;
|
||||||
$legacy_replace = isset( $this->replace ) ? $this->replace : array();
|
$legacy_replace = $this->replace;
|
||||||
|
|
||||||
foreach ( $this->placeholders as $find => $replace ) {
|
foreach ( $this->placeholders as $find => $replace ) {
|
||||||
$legacy_key = sanitize_title( str_replace( '_', '-', trim( $find, '{}' ) ) );
|
$legacy_key = sanitize_title( str_replace( '_', '-', trim( $find, '{}' ) ) );
|
||||||
|
|
Loading…
Reference in New Issue