@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function buildPlainTextMessage( PHPMailer $phpmailer ) |
92 | 92 | { |
93 | - if( empty( $this->email ))return; |
|
94 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
93 | + if( empty($this->email) )return; |
|
94 | + if( $phpmailer->ContentType === 'text/plain' || !empty($phpmailer->AltBody) )return; |
|
95 | 95 | $message = $this->stripHtmlTags( $phpmailer->Body ); |
96 | 96 | $phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this ); |
97 | 97 | } |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | $allowed = [ |
105 | 105 | 'bcc', 'cc', 'from', 'reply-to', |
106 | 106 | ]; |
107 | - $headers = array_intersect_key( $this->email, array_flip( $allowed )); |
|
107 | + $headers = array_intersect_key( $this->email, array_flip( $allowed ) ); |
|
108 | 108 | $headers = array_filter( $headers ); |
109 | 109 | foreach( $headers as $key => $value ) { |
110 | - unset( $headers[$key] ); |
|
110 | + unset($headers[$key]); |
|
111 | 111 | $headers[] = $key.': '.$value; |
112 | 112 | } |
113 | 113 | $headers[] = 'Content-Type: text/html'; |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function buildHtmlMessage() |
121 | 121 | { |
122 | - $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' )); |
|
123 | - if( !empty( $template )) { |
|
122 | + $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) ); |
|
123 | + if( !empty($template) ) { |
|
124 | 124 | $message = glsr( Template::class )->interpolate( $template, $this->email['template-tags'] ); |
125 | 125 | } |
126 | 126 | else if( $this->email['template'] ) { |
127 | 127 | $message = glsr( Template::class )->build( 'templates/'.$this->email['template'], [ |
128 | 128 | 'context' => $this->email['template-tags'], |
129 | - ]); |
|
129 | + ] ); |
|
130 | 130 | } |
131 | - if( !isset( $message )) { |
|
131 | + if( !isset($message) ) { |
|
132 | 132 | $message = $this->email['message']; |
133 | 133 | } |
134 | 134 | $message = $this->email['before'].$message.$this->email['after']; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $message = str_replace( ']]>', ']]>', $message ); |
140 | 140 | $message = glsr( Template::class )->build( 'partials/email/index', [ |
141 | 141 | 'context' => ['message' => $message], |
142 | - ]); |
|
142 | + ] ); |
|
143 | 143 | return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this ); |
144 | 144 | } |
145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | protected function normalize( array $email = [] ) |
150 | 150 | { |
151 | 151 | $email = shortcode_atts( glsr( EmailDefaults::class )->defaults(), $email ); |
152 | - if( empty( $email['reply-to'] )) { |
|
152 | + if( empty($email['reply-to']) ) { |
|
153 | 153 | $email['reply-to'] = $email['from']; |
154 | 154 | } |
155 | 155 | $this->email = apply_filters( 'site-reviews/email/compose', $email, $this ); |
@@ -60,8 +60,10 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function read( $format = '' ) |
62 | 62 | { |
63 | - if( $format == 'plaintext' )) { |
|
63 | + if( $format == 'plaintext' ) { |
|
64 | + ) { |
|
64 | 65 | $message = $this->stripHtmlTags( $this->message ); |
66 | + } |
|
65 | 67 | return apply_filters( 'site-reviews/email/message', $message, 'text', $this ); |
66 | 68 | } |
67 | 69 | return $this->message; |
@@ -72,7 +74,9 @@ discard block |
||
72 | 74 | */ |
73 | 75 | public function send() |
74 | 76 | { |
75 | - if( !$this->message || !$this->subject || !$this->to )return; |
|
77 | + if( !$this->message || !$this->subject || !$this->to ) { |
|
78 | + return; |
|
79 | + } |
|
76 | 80 | $sent = wp_mail( |
77 | 81 | $this->to, |
78 | 82 | $this->subject, |
@@ -90,8 +94,12 @@ discard block |
||
90 | 94 | */ |
91 | 95 | public function buildPlainTextMessage( PHPMailer $phpmailer ) |
92 | 96 | { |
93 | - if( empty( $this->email ))return; |
|
94 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
97 | + if( empty( $this->email )) { |
|
98 | + return; |
|
99 | + } |
|
100 | + if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) { |
|
101 | + return; |
|
102 | + } |
|
95 | 103 | $message = $this->stripHtmlTags( $phpmailer->Body ); |
96 | 104 | $phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this ); |
97 | 105 | } |