@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function addTo($address, $title = '') |
66 | 66 | { |
67 | - if($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
67 | + if ($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
68 | 68 | $this->to_array[] = ($title != '') ? "\"{$title}\" <{$address}>" : "{$address}"; |
69 | 69 | |
70 | 70 | return $this; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function addCC($address, $title = '') |
81 | 81 | { |
82 | - if($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
82 | + if ($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
83 | 83 | $this->cc_array[] = ($title != '') ? "\"{$title}\" <{$address}>" : "{$address}"; |
84 | 84 | |
85 | 85 | return $this; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function addBCC($address, $title = '') |
96 | 96 | { |
97 | - if($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
97 | + if ($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
98 | 98 | $this->bcc_array[] = ($title != '') ? "\"{$title}\" <{$address}>" : "{$address}"; |
99 | 99 | |
100 | 100 | return $this; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function setFrom($address, $title = '') |
111 | 111 | { |
112 | - if($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
112 | + if ($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
113 | 113 | $this->header_array['From'] = ($title != '') ? "\"{$title}\" <{$address}>" : "{$address}"; |
114 | 114 | |
115 | 115 | return $this; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function setReplyTo($address, $title = '') |
126 | 126 | { |
127 | - if($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
127 | + if ($this->is_valid_email_address($address) && $this->is_valid_email_title($title)) |
|
128 | 128 | $this->header_array['Reply-To'] = ($title != '') ? "\"{$title}\" <{$address}>" : "{$address}"; |
129 | 129 | |
130 | 130 | return $this; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function setSubject($subject) |
140 | 140 | { |
141 | - if($this->is_valid_subject($subject)) |
|
141 | + if ($this->is_valid_subject($subject)) |
|
142 | 142 | $this->subject = $subject; |
143 | 143 | |
144 | 144 | return $this; |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function send() |
199 | 199 | { |
200 | - if($this->passed_validation === FALSE) |
|
200 | + if ($this->passed_validation === FALSE) |
|
201 | 201 | return false; |
202 | 202 | |
203 | - if(!$this->check_required_fields()) |
|
203 | + if (!$this->check_required_fields()) |
|
204 | 204 | return false; |
205 | 205 | |
206 | 206 | $to = $this->get_to(); |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | { |
257 | 257 | $message = ''; |
258 | 258 | |
259 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
259 | + if (isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
260 | 260 | $message .= "--{$this->get_boundary()}" . self::$LINE_BREAK; |
261 | 261 | |
262 | - if( |
|
262 | + if ( |
|
263 | 263 | isset($this->plain_message) && strlen($this->plain_message) > 0 && |
264 | 264 | isset($this->html_message) && strlen($this->html_message) > 0) |
265 | 265 | { |
266 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
266 | + if (isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
267 | 267 | { |
268 | 268 | $message .= "Content-Type: multipart/alternative; boundary={$this->get_alternative_boundary()}" . self::$LINE_BREAK; |
269 | 269 | $message .= self::$LINE_BREAK; |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | $message .= "--{$this->get_alternative_boundary()}--" . self::$LINE_BREAK; |
284 | 284 | $message .= self::$LINE_BREAK; |
285 | 285 | } |
286 | - else if(isset($this->plain_message) && strlen($this->plain_message)) |
|
286 | + else if (isset($this->plain_message) && strlen($this->plain_message)) |
|
287 | 287 | { |
288 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
288 | + if (isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
289 | 289 | { |
290 | 290 | $message .= 'Content-Type: text/plain; charset="iso-8859"' . self::$LINE_BREAK; |
291 | 291 | $message .= 'Content-Transfer-Encoding: 7bit' . self::$LINE_BREAK; |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | $message .= $this->plain_message; |
295 | 295 | $message .= self::$LINE_BREAK; |
296 | 296 | } |
297 | - else if(isset($this->html_message) && strlen($this->html_message)) |
|
297 | + else if (isset($this->html_message) && strlen($this->html_message)) |
|
298 | 298 | { |
299 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
299 | + if (isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
300 | 300 | { |
301 | 301 | $message .= 'Content-Type: text/html; charset="iso-8859-1"' . self::$LINE_BREAK; |
302 | 302 | $message .= 'Content-Transfer-Encoding: 7bit' . self::$LINE_BREAK; |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | $message .= $this->html_message; |
306 | 306 | $message .= self::$LINE_BREAK; |
307 | 307 | } |
308 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
308 | + if (isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
309 | 309 | { |
310 | - foreach($this->attachment_array as $attachment) |
|
310 | + foreach ($this->attachment_array as $attachment) |
|
311 | 311 | { |
312 | 312 | $message .= "--{$this->get_boundary()}" . self::$LINE_BREAK; |
313 | 313 | $message .= "Content-Type: {$attachment->type}; name=\"{$attachment->title}\"" . self::$LINE_BREAK; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | private $boundary; |
332 | 332 | private function get_boundary() |
333 | 333 | { |
334 | - if(!isset($this->boundary)) |
|
334 | + if (!isset($this->boundary)) |
|
335 | 335 | $this->boundary = sprintf(self::$BOUNDARY_FORMAT, md5(date('r', time()) . self::$BOUNDARY_SALT)); |
336 | 336 | return $this->boundary; |
337 | 337 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | private $alternative_boundary; |
346 | 346 | private function get_alternative_boundary() |
347 | 347 | { |
348 | - if(!isset($this->alternative_boundary)) |
|
348 | + if (!isset($this->alternative_boundary)) |
|
349 | 349 | $this->alternative_boundary = sprintf(self::$ALTERNATIVE_BOUNDARY_FORMAT, md5(date('r', time()) . self::$ALTERNATIVE_BOUNDARY_SALT)); |
350 | 350 | return $this->alternative_boundary; |
351 | 351 | } |
@@ -358,25 +358,25 @@ discard block |
||
358 | 358 | private function get_additional_headers() |
359 | 359 | { |
360 | 360 | $headers = ''; |
361 | - foreach($this->header_array as $key => $value) |
|
361 | + foreach ($this->header_array as $key => $value) |
|
362 | 362 | { |
363 | 363 | $headers .= "{$key}: {$value}" . self::$LINE_BREAK; |
364 | 364 | } |
365 | 365 | |
366 | - if(count($this->cc_array) > 0) |
|
366 | + if (count($this->cc_array) > 0) |
|
367 | 367 | $headers .= 'CC: ' . implode(', ', $this->cc_array) . self::$LINE_BREAK; |
368 | - if(count($this->bcc_array) > 0) |
|
368 | + if (count($this->bcc_array) > 0) |
|
369 | 369 | $headers .= 'BCC: ' . implode(', ', $this->bcc_array) . self::$LINE_BREAK; |
370 | 370 | |
371 | - if(isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
371 | + if (isset($this->attachment_array) && count($this->attachment_array) > 0) |
|
372 | 372 | $headers .= "Content-Type: multipart/mixed; boundary=\"{$this->get_boundary()}\""; |
373 | - else if( |
|
373 | + else if ( |
|
374 | 374 | isset($this->plain_message) && strlen($this->plain_message) > 0 && |
375 | 375 | isset($this->html_message) && strlen($this->html_message) > 0) |
376 | 376 | { |
377 | 377 | $headers .= "Content-Type: multipart/alternative; boundary=\"{$this->get_alternative_boundary()}\""; |
378 | 378 | } |
379 | - else if(isset($this->html_message) && strlen($this->html_message) > 0) |
|
379 | + else if (isset($this->html_message) && strlen($this->html_message) > 0) |
|
380 | 380 | $headers .= 'Content-type: text/html; charset="iso-8859-1"'; |
381 | 381 | |
382 | 382 | return $headers; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | */ |
404 | 404 | private function is_valid_email_address($string) |
405 | 405 | { |
406 | - if(strlen($string) < 1) |
|
406 | + if (strlen($string) < 1) |
|
407 | 407 | return $this->fail_validation("{$string} is an invalid email address!"); |
408 | 408 | |
409 | 409 | return true; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | private function is_valid_subject($string) |
424 | 424 | { |
425 | - if(strlen($string) < 1) |
|
425 | + if (strlen($string) < 1) |
|
426 | 426 | return $this->fail_validation("{$string} is an invalid email subject!"); |
427 | 427 | |
428 | 428 | return true; |