@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | use GeminiLabs\Castor\Helpers\Template; |
| 6 | 6 | use PHPMailer; |
| 7 | 7 | |
| 8 | -class Email |
|
| 9 | -{ |
|
| 8 | +class Email { |
|
| 10 | 9 | /** |
| 11 | 10 | * @var Template |
| 12 | 11 | */ |
@@ -56,7 +55,9 @@ discard block |
||
| 56 | 55 | $this->to = $email['to']; |
| 57 | 56 | |
| 58 | 57 | add_action( 'phpmailer_init', function( PHPMailer $phpmailer ) { |
| 59 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
| 58 | + if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) { |
|
| 59 | + return; |
|
| 60 | + } |
|
| 60 | 61 | $phpmailer->AltBody = $this->buildPlainTextMessage( $phpmailer->Body ); |
| 61 | 62 | }); |
| 62 | 63 | |
@@ -80,7 +81,9 @@ discard block |
||
| 80 | 81 | */ |
| 81 | 82 | public function send() |
| 82 | 83 | { |
| 83 | - if( !$this->message || !$this->subject || !$this->to )return; |
|
| 84 | + if( !$this->message || !$this->subject || !$this->to ) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 84 | 87 | |
| 85 | 88 | $sent = wp_mail( |
| 86 | 89 | $this->to, |
@@ -209,7 +212,9 @@ discard block |
||
| 209 | 212 | if( !file_exists( $file )) { |
| 210 | 213 | $file = sprintf( '%s/templates/email/%s.php', dirname( dirname( __DIR__ )), $templatePath ); |
| 211 | 214 | } |
| 212 | - if( !file_exists( $file ))return; |
|
| 215 | + if( !file_exists( $file )) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 213 | 218 | |
| 214 | 219 | ob_start(); |
| 215 | 220 | include $file; |