diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index e7c7b288..c025dd73 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -1,37 +1,53 @@ options()->get( $template . '_on' ) != 1 ) { + if ( ! empty( UM()->options()->get( $template . '_on' ) ) ) { + return; + } + + $hook_disabled = apply_filters( 'um_disable_email_notification_sending', false, $email, $template, $args ); + if ( false !== $hook_disabled ) { return; } do_action( 'um_before_email_notification_sending', $email, $template, $args ); $this->attachments = array(); - $this->headers = 'From: '. stripslashes( UM()->options()->get('mail_from') ) .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n"; + $this->headers = 'From: ' . stripslashes( UM()->options()->get( 'mail_from' ) ) . ' <' . UM()->options()->get( 'mail_from_addr' ) . '>' . "\r\n"; + + add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ), 10, 1 ); + add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ), 10, 1 ); /** * UM hook @@ -432,15 +452,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * } * ?> */ - - add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ), 10, 1 ); - add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ), 10, 1 ); - $subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template ); + $subject = wp_unslash( um_convert_tags( $subject, $args ) ); - $subject = wp_unslash( um_convert_tags( $subject , $args ) ); - - $this->subject = html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ); + $this->subject = html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ); $this->message = $this->prepare_template( $template, $args ); @@ -456,7 +471,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { do_action( 'um_after_email_notification_sending', $email, $template, $args ); } - /** * @param $template_name *