PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmEmail.php +129 -193 6.305.4 View file →
@@ -8,94 +8,94 @@
8 8 */
9 9 class FrmEmail {
10 10
11 11 /**
12 - * @var string
12 + * @var string $email_key
13 13 */
14 14 private $email_key = '';
15 15
16 16 /**
17 - * @var array
17 + * @var array $to
18 18 */
19 19 private $to = array();
20 20
21 21 /**
22 - * @var array
22 + * @var array $cc
23 23 */
24 24 private $cc = array();
25 25
26 26 /**
27 - * @var array
27 + * @var array $bcc
28 28 */
29 29 private $bcc = array();
30 30
31 31 /**
32 - * @var string
32 + * @var string $from
33 33 */
34 34 private $from = '';
35 35
36 36 /**
37 - * @var string
37 + * @var string $reply_to
38 38 */
39 39 private $reply_to = '';
40 40
41 41 /**
42 - * @var string
42 + * @var string $subject
43 43 */
44 44 private $subject = '';
45 45
46 46 /**
47 - * @var string
47 + * @var string $message
48 48 */
49 49 private $message = '';
50 50
51 51 /**
52 - * @var array
52 + * @var array $attachments
53 53 */
54 54 private $attachments = array();
55 55
56 56 /**
57 - * @var bool
57 + * @var bool $is_plain_text
58 58 */
59 59 private $is_plain_text = false;
60 60
61 61 /**
62 - * @var bool
62 + * @var bool $is_single_recipient
63 63 */
64 64 private $is_single_recipient = false;
65 65
66 66 /**
67 - * @var bool
67 + * @var bool $include_user_info
68 68 */
69 69 private $include_user_info = false;
70 70
71 71 /**
72 - * @var string
72 + * @var string $charset
73 73 */
74 74 private $charset = '';
75 75
76 76 /**
77 - * @var string
77 + * @var string $content_type
78 78 */
79 79 private $content_type = 'text/html';
80 80
81 81 /**
82 - * @var array
82 + * @var array $settings
83 83 */
84 84 private $settings = array();
85 85
86 86 /**
87 - * @var stdClass
87 + * @var stdClass $entry
88 88 */
89 89 private $entry;
90 90
91 91 /**
92 - * @var stdClass
92 + * @var stdClass $form
93 93 */
94 94 private $form;
95 95
96 96 /**
97 - * @var int
97 + * @var int $action_id
98 98 */
99 99 private $action_id = 0;
100 100
101 101 /**
@@ -141,10 +141,8 @@
141 141 *
142 142 * @since 2.03.04
143 143 *
144 144 * @param object $action
145 - *
146 - * @return void
147 145 */
148 146 private function set_email_key( $action ) {
149 147 $this->email_key = $action->ID;
150 148 }
@@ -154,10 +152,8 @@
154 152 *
155 153 * @since 2.03.04
156 154 *
157 155 * @param array $user_id_args
158 - *
159 - * @return void
160 156 */
161 157 private function set_to( $user_id_args ) {
162 158 $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args );
163 159 $to = $this->explode_emails( $to );
@@ -175,9 +171,9 @@
175 171 $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args );
176 172
177 173 $this->to = array_unique( (array) $to );
178 174
179 - if ( ! $this->to ) {
175 + if ( empty( $this->to ) ) {
180 176 return;
181 177 }
182 178
183 179 $this->handle_phone_numbers();
@@ -190,10 +186,8 @@
190 186 *
191 187 * @since 2.03.04
192 188 *
193 189 * @param array $user_id_args
194 - *
195 - * @return void
196 190 */
197 191 private function set_cc( $user_id_args ) {
198 192 $this->cc = $this->prepare_additional_recipients( $this->settings['cc'], $user_id_args );
199 193 }
@@ -203,10 +197,8 @@
203 197 *
204 198 * @since 2.03.04
205 199 *
206 200 * @param array $user_id_args
207 - *
208 - * @return void
209 201 */
210 202 private function set_bcc( $user_id_args ) {
211 203 $this->bcc = $this->prepare_additional_recipients( $this->settings['bcc'], $user_id_args );
212 204 }
@@ -216,9 +208,9 @@
216 208 *
217 209 * @since 2.03.04
218 210 *
219 211 * @param string $recipients
220 - * @param array $user_id_args
212 + * @param array $user_id_args
221 213 *
222 214 * @return array
223 215 */
224 216 private function prepare_additional_recipients( $recipients, $user_id_args ) {
@@ -223,11 +215,13 @@
223 215 */
224 216 private function prepare_additional_recipients( $recipients, $user_id_args ) {
225 217 $recipients = $this->prepare_email_setting( $recipients, $user_id_args );
226 218 $recipients = $this->explode_emails( $recipients );
219 +
227 220 $recipients = array_unique( (array) $recipients );
221 + $recipients = $this->format_recipients( $recipients );
228 222
229 - return $this->format_recipients( $recipients );
223 + return $recipients;
230 224 }
231 225
232 226 /**
233 227 * Set the From addresses
@@ -234,14 +228,12 @@
234 228 *
235 229 * @since 2.03.04
236 230 *
237 231 * @param array $user_id_args
238 - *
239 - * @return void
240 232 */
241 233 private function set_from( $user_id_args ) {
242 234 if ( empty( $this->settings['from'] ) ) {
243 - $from = FrmEmailHelper::get_default_from_email();
235 + $from = get_option( 'admin_email' );
244 236 } else {
245 237 $from = $this->prepare_email_setting( $this->settings['from'], $user_id_args );
246 238 }
247 239
@@ -253,10 +245,8 @@
253 245 *
254 246 * @since 2.03.04
255 247 *
256 248 * @param array $user_id_args
257 - *
258 - * @return void
259 249 */
260 250 private function set_reply_to( $user_id_args ) {
261 251 $this->reply_to = trim( $this->settings['reply_to'] );
262 252
@@ -275,19 +265,13 @@
275 265 * Set the is_plain_text property
276 266 * This should be set before the message
277 267 *
278 268 * @since 2.03.04
279 - *
280 - * @return void
281 269 */
282 270 private function set_is_plain_text() {
283 - if ( empty( $this->settings['email_style'] ) ) {
284 - // If `email_style` isn't set, use the `plain_text` checkbox.
285 - $this->is_plain_text = ! empty( $this->settings['plain_text'] );
286 - return;
271 + if ( $this->settings['plain_text'] ) {
272 + $this->is_plain_text = true;
287 273 }
288 -
289 - $this->is_plain_text = 'plain' === $this->settings['email_style'];
290 274 }
291 275
292 276 /**
293 277 * Set the include_user_info property
@@ -293,10 +277,8 @@
293 277 * Set the include_user_info property
294 278 * This should be set before the message
295 279 *
296 280 * @since 2.03.04
297 - *
298 - * @return void
299 281 */
300 282 private function set_include_user_info() {
301 283 if ( isset( $this->settings['inc_user_info'] ) ) {
302 284 $this->include_user_info = $this->settings['inc_user_info'];
@@ -307,11 +289,9 @@
307 289 * Set the is_single_recipient property
308 290 *
309 291 * @since 2.03.04
310 292 *
311 - * @param object $action
312 - *
313 - * @return void
293 + * @param $action
314 294 */
315 295 private function set_is_single_recipient( $action ) {
316 296 $args = array(
317 297 'form' => $this->form,
@@ -330,10 +310,8 @@
330 310 /**
331 311 * Set the charset
332 312 *
333 313 * @since 2.03.04
334 - *
335 - * @return void
336 314 */
337 315 private function set_charset() {
338 316 $this->charset = get_option( 'blog_charset' );
339 317 }
@@ -341,10 +319,8 @@
341 319 /**
342 320 * Set the content type
343 321 *
344 322 * @since 2.03.04
345 - *
346 - * @return void
347 323 */
348 324 private function set_content_type() {
349 325 if ( $this->is_plain_text ) {
350 326 $this->content_type = 'text/plain';
@@ -354,10 +330,8 @@
354 330 /**
355 331 * Set the subject
356 332 *
357 333 * @since 2.03.04
358 - *
359 - * @return void
360 334 */
361 335 private function set_subject() {
362 336 if ( empty( $this->settings['email_subject'] ) ) {
363 337 /* translators: %1$s: Form name, %2$s: Site name */
@@ -365,9 +339,8 @@
365 339 } else {
366 340 $this->subject = $this->settings['email_subject'];
367 341 }
368 342
369 - // This also replaces [sitename] shortcode in default.
370 343 $this->subject = FrmFieldsHelper::basic_replace_shortcodes( $this->subject, $this->form, $this->entry );
371 344
372 345 $args = array(
373 346 'form' => $this->form,
@@ -374,8 +347,9 @@
374 347 'entry' => $this->entry,
375 348 'email_key' => $this->email_key,
376 349 );
377 350 $this->subject = apply_filters( 'frm_email_subject', $this->subject, $args );
351 +
378 352 $this->subject = wp_specialchars_decode( strip_tags( stripslashes( $this->subject ) ), ENT_QUOTES );
379 353 }
380 354
381 355 /**
@@ -381,38 +355,27 @@
381 355 /**
382 356 * Set the email message
383 357 *
384 358 * @since 2.03.04
385 - *
386 - * @return void
387 359 */
388 360 private function set_message() {
389 - $this->message = $this->settings['email_message'];
361 + $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->settings['email_message'], $this->form, $this->entry );
390 362
391 - if ( ! $this->is_plain_text ) {
392 - // The decode is to support [default-html] shortcodes.
393 - $this->message = html_entity_decode( $this->message );
394 - }
395 -
396 - $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->message, $this->form, $this->entry );
397 363 $prev_mail_body = $this->message;
398 -
399 - // Make a copy to prevent changes by reference.
400 - $pass_entry = clone $this->entry;
401 - $mail_body = FrmEntriesHelper::replace_default_message(
364 + $pass_entry = clone $this->entry; // make a copy to prevent changes by reference
365 + $mail_body = FrmEntriesHelper::replace_default_message(
402 366 $prev_mail_body,
403 367 array(
404 - 'id' => $this->entry->id,
405 - 'entry' => $pass_entry,
406 - 'plain_text' => $this->is_plain_text,
407 - 'user_info' => $this->include_user_info,
408 - 'table_style' => $this->settings['email_style'],
368 + 'id' => $this->entry->id,
369 + 'entry' => $pass_entry,
370 + 'plain_text' => $this->is_plain_text,
371 + 'user_info' => $this->include_user_info,
409 372 )
410 373 );
411 374
412 375 // Add the user info if it isn't already included
413 376 if ( $this->include_user_info && $prev_mail_body === $mail_body ) {
414 - $data = $this->entry->description;
377 + $data = $this->entry->description;
415 378 $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n";
416 379 $this->maybe_add_ip( $mail_body );
417 380 $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n";
418 381 $mail_body .= __( 'Referrer', 'formidable' ) . ': ' . $data['referrer'] . "\r\n";
@@ -419,39 +382,17 @@
419 382 }
420 383
421 384 $this->message = $mail_body;
422 385
386 + $this->message = do_shortcode( $this->message );
387 +
423 388 if ( $this->is_plain_text ) {
424 389 $this->message = wp_specialchars_decode( strip_tags( $this->message ), ENT_QUOTES );
425 - $this->message = str_replace( ' ', '', $this->message );
426 - } else {
427 - $this->add_autop();
428 390 }
429 391
430 392 $this->message = apply_filters( 'frm_email_message', $this->message, $this->package_atts() );
431 393 }
432 394
433 - /**
434 - * Runs message through autop, extracting the content inside body tag if it has <body>.
435 - *
436 - * @return void
437 - */
438 - private function add_autop() {
439 - $message = $this->message;
440 - preg_match( '/<body[^>]*>([\s\S]*?)<\/body>/', $message, $match );
441 -
442 - if ( ! empty( $match[1] ) ) {
443 - $this->message = str_replace( $match[1], trim( wpautop( $match[1] ) ), $message );
444 - } else {
445 - $this->message = trim( wpautop( $message ) );
446 - }
447 - }
448 -
449 - /**
450 - * @param string $mail_body
451 - *
452 - * @return void
453 - */
454 395 private function maybe_add_ip( &$mail_body ) {
455 396 if ( ! empty( $this->entry->ip ) ) {
456 397 $mail_body .= __( 'IP Address', 'formidable' ) . ': ' . $this->entry->ip . "\r\n";
457 398 }
@@ -484,24 +425,28 @@
484 425 * @return bool|mixed|void
485 426 */
486 427 public function should_send() {
487 428 if ( ! $this->has_recipients() ) {
488 - return false;
429 + $send = false;
430 + } else {
431 +
432 + $filter_args = array(
433 + 'message' => $this->message,
434 + 'subject' => $this->subject,
435 + 'recipient' => $this->to,
436 + 'header' => $this->package_header(),
437 + );
438 +
439 + /**
440 + * Stop an email based on the message, subject, recipient,
441 + * or any information included in the email header
442 + *
443 + * @since 2.2.8
444 + */
445 + $send = apply_filters( 'frm_send_email', true, $filter_args );
489 446 }
490 447
491 - $filter_args = array(
492 - 'message' => $this->message,
493 - 'subject' => $this->subject,
494 - 'recipient' => $this->to,
495 - 'header' => $this->package_header(),
496 - );
497 - /**
498 - * Stop an email based on the message, subject, recipient,
499 - * or any information included in the email header
500 - *
501 - * @since 2.2.8
502 - */
503 - return apply_filters( 'frm_send_email', true, $filter_args );
448 + return $send;
504 449 }
505 450
506 451 /**
507 452 * Check if an email has any recipients
@@ -510,9 +455,13 @@
510 455 *
511 456 * @return bool
512 457 */
513 458 private function has_recipients() {
514 - return $this->to || $this->cc || $this->bcc;
459 + if ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) ) {
460 + return false;
461 + } else {
462 + return true;
463 + }
515 464 }
516 465
517 466 /**
518 467 * Send an email
@@ -525,9 +474,8 @@
525 474 $this->remove_buddypress_filters();
526 475 $this->add_mandrill_filter();
527 476
528 477 $sent = false;
529 -
530 478 if ( count( $this->to ) > 1 && $this->is_single_recipient ) {
531 479 foreach ( $this->to as $recipient ) {
532 480 $sent = $this->send_single( $recipient );
533 481 }
@@ -559,15 +507,15 @@
559 507 )
560 508 );
561 509
562 510 $subject = $this->encode_subject( $this->subject );
563 - $sent = wp_mail( $recipient, $subject, $this->message, $header, $this->attachments );
564 511
512 + $sent = wp_mail( $recipient, $subject, $this->message, $header, $this->attachments );
513 +
565 514 if ( ! $sent ) {
566 515 if ( is_array( $header ) ) {
567 516 $header = implode( "\r\n", $header );
568 517 }
569 -
570 518 $recipient = implode( ',', (array) $recipient );
571 519 $sent = mail( $recipient, $subject, $this->message, $header );
572 520 }
573 521
@@ -585,13 +533,13 @@
585 533 */
586 534 private function package_header() {
587 535 $header = array();
588 536
589 - if ( $this->cc ) {
537 + if ( ! empty( $this->cc ) ) {
590 538 $header[] = 'CC: ' . implode( ',', $this->cc );
591 539 }
592 540
593 - if ( $this->bcc ) {
541 + if ( ! empty( $this->bcc ) ) {
594 542 $header[] = 'BCC: ' . implode( ',', $this->bcc );
595 543 }
596 544
597 545 $header[] = 'From: ' . $this->from;
@@ -605,9 +553,9 @@
605 553 * Get the userID field ID and key for email settings
606 554 *
607 555 * @since 2.03.04
608 556 *
609 - * @param int $form_id
557 + * @param $form_id
610 558 *
611 559 * @return array
612 560 */
613 561 private function get_user_id_args( $form_id ) {
@@ -616,9 +564,8 @@
616 564 'field_key' => '',
617 565 );
618 566
619 567 $user_id_args['field_id'] = FrmEmailHelper::get_user_id_field_for_form( $form_id );
620 -
621 568 if ( $user_id_args['field_id'] ) {
622 569 $user_id_args['field_key'] = FrmField::get_key_by_id( $user_id_args['field_id'] );
623 570 }
624 571
@@ -630,16 +577,16 @@
630 577 *
631 578 * @since 2.03.04
632 579 *
633 580 * @param string $value
634 - * @param array $user_id_args
581 + * @param array $user_id_args
635 582 *
636 583 * @return string
637 584 */
638 585 private function prepare_email_setting( $value, $user_id_args ) {
639 - if ( str_contains( $value, '[' . $user_id_args['field_id'] . ']' ) ) {
586 + if ( strpos( $value, '[' . $user_id_args['field_id'] . ']' ) !== false ) {
640 587 $value = str_replace( '[' . $user_id_args['field_id'] . ']', '[' . $user_id_args['field_id'] . ' show="user_email"]', $value );
641 - } elseif ( str_contains( $value, '[' . $user_id_args['field_key'] . ']' ) ) {
588 + } elseif ( strpos( $value, '[' . $user_id_args['field_key'] . ']' ) !== false ) {
642 589 $value = str_replace( '[' . $user_id_args['field_key'] . ']', '[' . $user_id_args['field_key'] . ' show="user_email"]', $value );
643 590 }
644 591
645 592 $value = FrmFieldsHelper::basic_replace_shortcodes( $value, $this->form, $this->entry );
@@ -645,10 +592,11 @@
645 592 $value = FrmFieldsHelper::basic_replace_shortcodes( $value, $this->form, $this->entry );
646 593
647 594 // Remove brackets and add a space in case there isn't one
648 595 $value = str_replace( '<', ' ', $value );
596 + $value = str_replace( array( '"', '>' ), '', $value );
649 597
650 - return str_replace( array( '"', '>' ), '', $value );
598 + return $value;
651 599 }
652 600
653 601 /**
654 602 * Extract the emails from cc and bcc. Allow separation by , or ;.
@@ -657,13 +605,19 @@
657 605 * @since 2.03.04
658 606 *
659 607 * @param string $emails
660 608 *
661 - * @return array|string Emails.
609 + * @return array|string $emails
662 610 */
663 611 private function explode_emails( $emails ) {
664 - $emails = $emails ? preg_split( '/(,|;)/', $emails ) : '';
665 - return is_array( $emails ) ? array_map( 'trim', $emails ) : trim( $emails );
612 + $emails = ( ! empty( $emails ) ? preg_split( '/(,|;)/', $emails ) : '' );
613 + if ( is_array( $emails ) ) {
614 + $emails = array_map( 'trim', $emails );
615 + } else {
616 + $emails = trim( $emails );
617 + }
618 +
619 + return $emails;
666 620 }
667 621
668 622 /**
669 623 * Format the recipients( to, cc, bcc)
@@ -672,9 +626,9 @@
672 626 *
673 627 * @return array
674 628 */
675 629 private function format_recipients( $recipients ) {
676 - if ( ! $recipients ) {
630 + if ( empty( $recipients ) ) {
677 631 return $recipients;
678 632 }
679 633
680 634 foreach ( $recipients as $key => $val ) {
@@ -682,24 +636,24 @@
682 636
683 637 if ( is_email( $val ) ) {
684 638 // If a plain email is used, no formatting is needed
685 639 continue;
686 - }
640 + } else {
641 + $parts = explode( ' ', $val );
642 + $email = end( $parts );
687 643
688 - $parts = explode( ' ', $val );
689 - $email = end( $parts );
690 -
691 - if ( ! is_email( $email ) ) {
692 - // If user enters a name without an email
693 - unset( $recipients[ $key ] );
694 - continue;
644 + if ( is_email( $email ) ) {
645 + // If user enters a name and email
646 + $name = trim( str_replace( $email, '', $val ) );
647 + } else {
648 + // If user enters a name without an email
649 + unset( $recipients[ $key ] );
650 + continue;
651 + }
695 652 }
696 653
697 - // If user enters a name and email
698 - $name = trim( str_replace( $email, '', $val ) );
699 -
700 654 $recipients[ $key ] = $this->format_from_email( $name, $email );
701 - }//end foreach
655 + }
702 656
703 657 return $recipients;
704 658 }
705 659
@@ -720,14 +674,14 @@
720 674 } else {
721 675 list( $from_name, $from_email ) = $this->get_name_and_email_for_sender( $from );
722 676 }
723 677
724 - // If sending the email from a yahoo address, change it to the WordPress default
725 - if ( str_contains( $from_email, '@yahoo.com' ) ) {
678 + // if sending the email from a yahoo address, change it to the WordPress default
679 + if ( strpos( $from_email, '@yahoo.com' ) ) {
680 +
726 681 // Get the site domain and get rid of www.
727 682 $sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) );
728 -
729 - if ( str_starts_with( $sitename, 'www.' ) ) {
683 + if ( substr( $sitename, 0, 4 ) === 'www.' ) {
730 684 $sitename = substr( $sitename, 4 );
731 685 }
732 686
733 687 $from_email = 'wordpress@' . $sitename;
@@ -749,9 +703,9 @@
749 703 $reply_to = trim( $reply_to );
750 704
751 705 if ( ! is_email( $reply_to ) ) {
752 706 list( $name, $email ) = $this->get_name_and_email_for_sender( $reply_to );
753 - $reply_to = $this->format_from_email( $name, $email );
707 + $reply_to = $this->format_from_email( $name, $email );
754 708 }
755 709
756 710 return $reply_to;
757 711 }
@@ -759,17 +713,12 @@
759 713 /**
760 714 * Get only the email if the name and email have been combined
761 715 *
762 716 * @since 3.0.06
763 - *
764 - * @param string $name
765 - *
766 - * @return string
767 717 */
768 718 private function get_email_from_name( $name ) {
769 719 $email = trim( trim( $name, '>' ), '<' );
770 -
771 - if ( str_contains( $email, '<' ) ) {
720 + if ( strpos( $email, '<' ) !== false ) {
772 721 $parts = explode( '<', $email );
773 722 $email = trim( $parts[1], '>' );
774 723 }
775 724
@@ -801,16 +750,15 @@
801 750 }
802 751
803 752 /**
804 753 * @since 3.0.06
805 - *
806 - * @param string $name
807 - * @param string $email
808 - *
809 - * @return string
810 754 */
811 755 private function format_from_email( $name, $email ) {
812 - return '' !== $name ? $name . ' <' . $email . '>' : $email;
756 + if ( '' !== $name ) {
757 + $email = $name . ' <' . $email . '>';
758 + }
759 +
760 + return $email;
813 761 }
814 762
815 763 /**
816 764 * Remove phone numbers from To addresses
@@ -816,42 +764,38 @@
816 764 * Remove phone numbers from To addresses
817 765 * Send the phone numbers to the frm_send_to_not_email hook
818 766 *
819 767 * @since 2.03.04
820 - *
821 - * @return void
822 768 */
823 769 private function handle_phone_numbers() {
770 +
824 771 foreach ( $this->to as $key => $recipient ) {
825 - if ( '[admin_email]' === $recipient || is_email( $recipient ) ) {
826 - continue;
827 - }
772 + if ( '[admin_email]' !== $recipient && ! is_email( $recipient ) ) {
773 + $recipient = explode( ' ', $recipient );
828 774
829 - $recipient = explode( ' ', $recipient );
775 + if ( is_email( end( $recipient ) ) ) {
776 + continue;
777 + }
830 778
831 - if ( is_email( end( $recipient ) ) ) {
832 - continue;
779 + do_action(
780 + 'frm_send_to_not_email',
781 + array(
782 + 'e' => $recipient,
783 + 'subject' => $this->subject,
784 + 'mail_body' => $this->message,
785 + 'reply_to' => $this->reply_to,
786 + 'from' => $this->from,
787 + 'plain_text' => $this->is_plain_text,
788 + 'attachments' => $this->attachments,
789 + 'form' => $this->form,
790 + 'email_key' => $key,
791 + )
792 + );
793 +
794 + // Remove phone number from to addresses
795 + unset( $this->to[ $key ] );
833 796 }
834 -
835 - do_action(
836 - 'frm_send_to_not_email',
837 - array(
838 - 'e' => $recipient,
839 - 'subject' => $this->subject,
840 - 'mail_body' => $this->message,
841 - 'reply_to' => $this->reply_to,
842 - 'from' => $this->from,
843 - 'plain_text' => $this->is_plain_text,
844 - 'attachments' => $this->attachments,
845 - 'form' => $this->form,
846 - 'email_key' => $key,
847 - )
848 - );
849 -
850 - // Remove phone number from to addresses
851 - unset( $this->to[ $key ] );
852 - // end if
853 - }//end foreach
797 + }
854 798 }
855 799
856 800 /**
857 801 * Package an array of FrmEmail properties
@@ -870,12 +814,10 @@
870 814 'subject' => $this->subject,
871 815 'message' => $this->message,
872 816 'attachments' => $this->attachments,
873 817 'plain_text' => $this->is_plain_text,
874 - 'email_key' => $this->email_key,
875 818 'form' => $this->form,
876 819 'entry' => $this->entry,
877 - 'email_style' => $this->settings['email_style'],
878 820 );
879 821 }
880 822
881 823 /**
@@ -881,10 +823,8 @@
881 823 /**
882 824 * Remove the Buddypress email filters
883 825 *
884 826 * @since 2.03.04
885 - *
886 - * @return void
887 827 */
888 828 private function remove_buddypress_filters() {
889 829 remove_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' );
890 830 remove_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
@@ -894,10 +834,8 @@
894 834 * Add Mandrill line break filter
895 835 * Remove line breaks in HTML emails to prevent conflicts with Mandrill
896 836 *
897 837 * @since 2.03.04
898 - *
899 - * @return void
900 838 */
901 839 private function add_mandrill_filter() {
902 840 if ( ! $this->is_plain_text ) {
903 841 add_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' );
@@ -907,10 +845,8 @@
907 845 /**
908 846 * Remove Mandrill line break filter
909 847 *
910 848 * @since 2.03.04
911 - *
912 - * @return void
913 849 */
914 850 private function remove_mandrill_filter() {
915 851 remove_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' );
916 852 }
@@ -923,9 +859,9 @@
923 859 * @return string
924 860 */
925 861 private function encode_subject( $subject ) {
926 862 if ( apply_filters( 'frm_encode_subject', false, $subject ) ) {
927 - return '=?' . $this->charset . '?B?' . base64_encode( $subject ) . '?=';
863 + $subject = '=?' . $this->charset . '?B?' . base64_encode( $subject ) . '?=';
928 864 }
929 865
930 866 return $subject;
931 867 }