Merge branch 'pr/17435'

This commit is contained in:
Mike Jolley 2017-11-01 13:10:37 +00:00
commit 9c096b419f
2 changed files with 17 additions and 2 deletions

View File

@ -103,13 +103,14 @@ class WC_Settings_Emails extends WC_Settings_Page {
array(
'title' => __( 'Footer text', 'woocommerce' ),
'desc' => __( 'The text to appear in the footer of WooCommerce emails.', 'woocommerce' ),
'desc' => __( 'The text to appear in the footer of WooCommerce emails.', 'woocommerce' )
. ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title}' ),
'id' => 'woocommerce_email_footer_text',
'css' => 'width:300px; height: 75px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'type' => 'textarea',
/* translators: %s: site name */
'default' => get_bloginfo( 'name', 'display' ),
'default' => '{site_title}',
'autoload' => false,
'desc_tip' => true,
),

View File

@ -177,6 +177,9 @@ class WC_Emails {
add_action( 'woocommerce_product_on_backorder_notification', array( $this, 'backorder' ) );
add_action( 'woocommerce_created_customer_notification', array( $this, 'customer_new_account' ), 10, 3 );
// Hook for replacing {site_title} in email-footer.
add_filter( 'woocommerce_email_footer_text' , array( $this, 'email_footer_replace_site_title' ) );
// Let 3rd parties unhook the above via this hook
do_action( 'woocommerce_email', $this );
}
@ -251,6 +254,17 @@ class WC_Emails {
wc_get_template( 'emails/email-footer.php' );
}
/**
* Filter callback to replace {site_title} in email footer
*
* @since 3.3.0
* @param string $string Email footer text.
* @return string Email footer text with any replacements done.
*/
public function email_footer_replace_site_title( $string ) {
return str_replace( '{site_title}', $this->get_blogname(), $string );
}
/**
* Wraps a message in the woocommerce mail template.
*