PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 3.06.06
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v3.06.06
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 +89 -240 6.273.06.06 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - die( 'You are not allowed to call this page directly.' );
4 -}
5 2
6 3 /**
7 4 * @since 2.03.04
8 5 */
@@ -7,99 +4,30 @@
7 4 * @since 2.03.04
8 5 */
9 6 class FrmEmail {
10 7
11 - /**
12 - * @var string
13 - */
14 8 private $email_key = '';
15 -
16 - /**
17 - * @var array
18 - */
19 9 private $to = array();
20 -
21 - /**
22 - * @var array
23 - */
24 10 private $cc = array();
25 -
26 - /**
27 - * @var array
28 - */
29 11 private $bcc = array();
30 -
31 - /**
32 - * @var string
33 - */
34 12 private $from = '';
35 -
36 - /**
37 - * @var string
38 - */
39 13 private $reply_to = '';
40 -
41 - /**
42 - * @var string
43 - */
44 14 private $subject = '';
45 -
46 - /**
47 - * @var string
48 - */
49 15 private $message = '';
50 -
51 - /**
52 - * @var array
53 - */
54 16 private $attachments = array();
55 17
56 - /**
57 - * @var bool
58 - */
59 18 private $is_plain_text = false;
60 -
61 - /**
62 - * @var bool
63 - */
64 19 private $is_single_recipient = false;
65 -
66 - /**
67 - * @var bool
68 - */
69 20 private $include_user_info = false;
70 21
71 - /**
72 - * @var string
73 - */
74 22 private $charset = '';
75 -
76 - /**
77 - * @var string
78 - */
79 23 private $content_type = 'text/html';
80 24
81 - /**
82 - * @var array
83 - */
84 25 private $settings = array();
85 -
86 - /**
87 - * @var stdClass
88 - */
89 26 private $entry;
90 -
91 - /**
92 - * @var stdClass
93 - */
94 27 private $form;
95 28
96 29 /**
97 - * @var int
98 - */
99 - private $action_id = 0;
100 -
101 - /**
102 30 * FrmEmail constructor
103 31 *
104 32 * @param object $action
105 33 * @param object $entry
@@ -106,12 +34,11 @@
106 34 * @param object $form
107 35 */
108 36 public function __construct( $action, $entry, $form ) {
109 37 $this->set_email_key( $action );
110 - $this->entry = $entry;
111 - $this->form = $form;
112 - $this->settings = $action->post_content;
113 - $this->action_id = (int) $action->ID;
38 + $this->entry = $entry;
39 + $this->form = $form;
40 + $this->settings = $action->post_content;
114 41
115 42 $user_id_args = self::get_user_id_args( $form->id );
116 43 $this->set_to( $user_id_args );
117 44 $this->set_cc( $user_id_args );
@@ -141,10 +68,8 @@
141 68 *
142 69 * @since 2.03.04
143 70 *
144 71 * @param object $action
145 - *
146 - * @return void
147 72 */
148 73 private function set_email_key( $action ) {
149 74 $this->email_key = $action->ID;
150 75 }
@@ -154,16 +79,14 @@
154 79 *
155 80 * @since 2.03.04
156 81 *
157 82 * @param array $user_id_args
158 - *
159 - * @return void
160 83 */
161 84 private function set_to( $user_id_args ) {
162 85 $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args );
163 86 $to = $this->explode_emails( $to );
164 87
165 - $where = array(
88 + $where = array(
166 89 'it.field_id !' => 0,
167 90 'it.item_id' => $this->entry->id,
168 91 );
169 92 $values = FrmEntryMeta::getAll( $where, ' ORDER BY fi.field_order' );
@@ -190,10 +113,8 @@
190 113 *
191 114 * @since 2.03.04
192 115 *
193 116 * @param array $user_id_args
194 - *
195 - * @return void
196 117 */
197 118 private function set_cc( $user_id_args ) {
198 119 $this->cc = $this->prepare_additional_recipients( $this->settings['cc'], $user_id_args );
199 120 }
@@ -203,10 +124,8 @@
203 124 *
204 125 * @since 2.03.04
205 126 *
206 127 * @param array $user_id_args
207 - *
208 - * @return void
209 128 */
210 129 private function set_bcc( $user_id_args ) {
211 130 $this->bcc = $this->prepare_additional_recipients( $this->settings['bcc'], $user_id_args );
212 131 }
@@ -216,9 +135,9 @@
216 135 *
217 136 * @since 2.03.04
218 137 *
219 138 * @param string $recipients
220 - * @param array $user_id_args
139 + * @param array $user_id_args
221 140 *
222 141 * @return array
223 142 */
224 143 private function prepare_additional_recipients( $recipients, $user_id_args ) {
@@ -223,11 +142,13 @@
223 142 */
224 143 private function prepare_additional_recipients( $recipients, $user_id_args ) {
225 144 $recipients = $this->prepare_email_setting( $recipients, $user_id_args );
226 145 $recipients = $this->explode_emails( $recipients );
146 +
227 147 $recipients = array_unique( (array) $recipients );
148 + $recipients = $this->format_recipients( $recipients );
228 149
229 - return $this->format_recipients( $recipients );
150 + return $recipients;
230 151 }
231 152
232 153 /**
233 154 * Set the From addresses
@@ -234,14 +155,12 @@
234 155 *
235 156 * @since 2.03.04
236 157 *
237 158 * @param array $user_id_args
238 - *
239 - * @return void
240 159 */
241 160 private function set_from( $user_id_args ) {
242 161 if ( empty( $this->settings['from'] ) ) {
243 - $from = FrmEmailHelper::get_default_from_email();
162 + $from = get_option( 'admin_email' );
244 163 } else {
245 164 $from = $this->prepare_email_setting( $this->settings['from'], $user_id_args );
246 165 }
247 166
@@ -253,22 +172,17 @@
253 172 *
254 173 * @since 2.03.04
255 174 *
256 175 * @param array $user_id_args
257 - *
258 - * @return void
259 176 */
260 177 private function set_reply_to( $user_id_args ) {
261 178 $this->reply_to = trim( $this->settings['reply_to'] );
262 179
263 - if ( $this->reply_to ) {
180 + if ( empty( $this->reply_to ) ) {
181 + $this->reply_to = $this->get_email_from_name( $this->from );
182 + } else {
264 183 $this->reply_to = $this->prepare_email_setting( $this->settings['reply_to'], $user_id_args );
265 184 }
266 -
267 - if ( ! $this->reply_to ) {
268 - $this->reply_to = $this->get_email_from_name( $this->from );
269 - }
270 -
271 185 $this->reply_to = $this->format_reply_to( $this->reply_to );
272 186 }
273 187
274 188 /**
@@ -275,19 +189,13 @@
275 189 * Set the is_plain_text property
276 190 * This should be set before the message
277 191 *
278 192 * @since 2.03.04
279 - *
280 - * @return void
281 193 */
282 194 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;
195 + if ( $this->settings['plain_text'] ) {
196 + $this->is_plain_text = true;
287 197 }
288 -
289 - $this->is_plain_text = 'plain' === $this->settings['email_style'];
290 198 }
291 199
292 200 /**
293 201 * Set the include_user_info property
@@ -293,10 +201,8 @@
293 201 * Set the include_user_info property
294 202 * This should be set before the message
295 203 *
296 204 * @since 2.03.04
297 - *
298 - * @return void
299 205 */
300 206 private function set_include_user_info() {
301 207 if ( isset( $this->settings['inc_user_info'] ) ) {
302 208 $this->include_user_info = $this->settings['inc_user_info'];
@@ -307,11 +213,9 @@
307 213 * Set the is_single_recipient property
308 214 *
309 215 * @since 2.03.04
310 216 *
311 - * @param object $action
312 - *
313 - * @return void
217 + * @param $action
314 218 */
315 219 private function set_is_single_recipient( $action ) {
316 220 $args = array(
317 221 'form' => $this->form,
@@ -330,10 +234,8 @@
330 234 /**
331 235 * Set the charset
332 236 *
333 237 * @since 2.03.04
334 - *
335 - * @return void
336 238 */
337 239 private function set_charset() {
338 240 $this->charset = get_option( 'blog_charset' );
339 241 }
@@ -341,10 +243,8 @@
341 243 /**
342 244 * Set the content type
343 245 *
344 246 * @since 2.03.04
345 - *
346 - * @return void
347 247 */
348 248 private function set_content_type() {
349 249 if ( $this->is_plain_text ) {
350 250 $this->content_type = 'text/plain';
@@ -354,10 +254,8 @@
354 254 /**
355 255 * Set the subject
356 256 *
357 257 * @since 2.03.04
358 - *
359 - * @return void
360 258 */
361 259 private function set_subject() {
362 260 if ( empty( $this->settings['email_subject'] ) ) {
363 261 /* translators: %1$s: Form name, %2$s: Site name */
@@ -365,9 +263,8 @@
365 263 } else {
366 264 $this->subject = $this->settings['email_subject'];
367 265 }
368 266
369 - // This also replaces [sitename] shortcode in default.
370 267 $this->subject = FrmFieldsHelper::basic_replace_shortcodes( $this->subject, $this->form, $this->entry );
371 268
372 269 $args = array(
373 270 'form' => $this->form,
@@ -374,8 +271,9 @@
374 271 'entry' => $this->entry,
375 272 'email_key' => $this->email_key,
376 273 );
377 274 $this->subject = apply_filters( 'frm_email_subject', $this->subject, $args );
275 +
378 276 $this->subject = wp_specialchars_decode( strip_tags( stripslashes( $this->subject ) ), ENT_QUOTES );
379 277 }
380 278
381 279 /**
@@ -381,38 +279,27 @@
381 279 /**
382 280 * Set the email message
383 281 *
384 282 * @since 2.03.04
385 - *
386 - * @return void
387 283 */
388 284 private function set_message() {
389 - $this->message = $this->settings['email_message'];
285 + $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->settings['email_message'], $this->form, $this->entry );
390 286
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 287 $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(
288 + $pass_entry = clone $this->entry; // make a copy to prevent changes by reference
289 + $mail_body = FrmEntriesHelper::replace_default_message(
402 290 $prev_mail_body,
403 291 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'],
292 + 'id' => $this->entry->id,
293 + 'entry' => $pass_entry,
294 + 'plain_text' => $this->is_plain_text,
295 + 'user_info' => $this->include_user_info,
409 296 )
410 297 );
411 298
412 299 // Add the user info if it isn't already included
413 300 if ( $this->include_user_info && $prev_mail_body === $mail_body ) {
414 - $data = $this->entry->description;
301 + $data = maybe_unserialize( $this->entry->description );
415 302 $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n";
416 303 $this->maybe_add_ip( $mail_body );
417 304 $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n";
418 305 $mail_body .= __( 'Referrer', 'formidable' ) . ': ' . $data['referrer'] . "\r\n";
@@ -419,39 +306,17 @@
419 306 }
420 307
421 308 $this->message = $mail_body;
422 309
310 + $this->message = do_shortcode( $this->message );
311 +
423 312 if ( $this->is_plain_text ) {
424 313 $this->message = wp_specialchars_decode( strip_tags( $this->message ), ENT_QUOTES );
425 - $this->message = str_replace( '&nbsp;', '', $this->message );
426 - } else {
427 - $this->add_autop();
428 314 }
429 315
430 316 $this->message = apply_filters( 'frm_email_message', $this->message, $this->package_atts() );
431 317 }
432 318
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 319 private function maybe_add_ip( &$mail_body ) {
455 320 if ( ! empty( $this->entry->ip ) ) {
456 321 $mail_body .= __( 'IP Address', 'formidable' ) . ': ' . $this->entry->ip . "\r\n";
457 322 }
@@ -460,18 +325,13 @@
460 325 /**
461 326 * Set the attachments for an email message
462 327 *
463 328 * @since 2.03.04
464 - * @since 5.0.16 added new action_id key to $args.
465 - *
466 - * @return void
467 329 */
468 330 private function set_attachments() {
469 331 $args = array(
470 332 'entry' => $this->entry,
471 333 'email_key' => $this->email_key,
472 - 'settings' => $this->settings,
473 - 'action_id' => $this->action_id,
474 334 );
475 335
476 336 $this->attachments = apply_filters( 'frm_notification_attachment', array(), $this->form, $args );
477 337 }
@@ -484,24 +344,28 @@
484 344 * @return bool|mixed|void
485 345 */
486 346 public function should_send() {
487 347 if ( ! $this->has_recipients() ) {
488 - return false;
348 + $send = false;
349 + } else {
350 +
351 + $filter_args = array(
352 + 'message' => $this->message,
353 + 'subject' => $this->subject,
354 + 'recipient' => $this->to,
355 + 'header' => $this->package_header(),
356 + );
357 +
358 + /**
359 + * Stop an email based on the message, subject, recipient,
360 + * or any information included in the email header
361 + *
362 + * @since 2.2.8
363 + */
364 + $send = apply_filters( 'frm_send_email', true, $filter_args );
489 365 }
490 366
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 );
367 + return $send;
504 368 }
505 369
506 370 /**
507 371 * Check if an email has any recipients
@@ -510,9 +374,13 @@
510 374 *
511 375 * @return bool
512 376 */
513 377 private function has_recipients() {
514 - return ! ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) );
378 + if ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) ) {
379 + return false;
380 + } else {
381 + return true;
382 + }
515 383 }
516 384
517 385 /**
518 386 * Send an email
@@ -525,9 +393,8 @@
525 393 $this->remove_buddypress_filters();
526 394 $this->add_mandrill_filter();
527 395
528 396 $sent = false;
529 -
530 397 if ( count( $this->to ) > 1 && $this->is_single_recipient ) {
531 398 foreach ( $this->to as $recipient ) {
532 399 $sent = $this->send_single( $recipient );
533 400 }
@@ -559,15 +426,13 @@
559 426 )
560 427 );
561 428
562 429 $subject = $this->encode_subject( $this->subject );
563 - $sent = wp_mail( $recipient, $subject, $this->message, $header, $this->attachments );
564 430
431 + $sent = wp_mail( $recipient, $subject, $this->message, $header, $this->attachments );
432 +
565 433 if ( ! $sent ) {
566 - if ( is_array( $header ) ) {
567 - $header = implode( "\r\n", $header );
568 - }
569 -
434 + $header = 'From: ' . $this->from . "\r\n";
570 435 $recipient = implode( ',', (array) $recipient );
571 436 $sent = mail( $recipient, $subject, $this->message, $header );
572 437 }
573 438
@@ -583,9 +448,9 @@
583 448 *
584 449 * @return array
585 450 */
586 451 private function package_header() {
587 - $header = array();
452 + $header = array();
588 453
589 454 if ( ! empty( $this->cc ) ) {
590 455 $header[] = 'CC: ' . implode( ',', $this->cc );
591 456 }
@@ -605,9 +470,9 @@
605 470 * Get the userID field ID and key for email settings
606 471 *
607 472 * @since 2.03.04
608 473 *
609 - * @param int $form_id
474 + * @param $form_id
610 475 *
611 476 * @return array
612 477 */
613 478 private function get_user_id_args( $form_id ) {
@@ -616,9 +481,8 @@
616 481 'field_key' => '',
617 482 );
618 483
619 484 $user_id_args['field_id'] = FrmEmailHelper::get_user_id_field_for_form( $form_id );
620 -
621 485 if ( $user_id_args['field_id'] ) {
622 486 $user_id_args['field_key'] = FrmField::get_key_by_id( $user_id_args['field_id'] );
623 487 }
624 488
@@ -630,16 +494,16 @@
630 494 *
631 495 * @since 2.03.04
632 496 *
633 497 * @param string $value
634 - * @param array $user_id_args
498 + * @param array $user_id_args
635 499 *
636 500 * @return string
637 501 */
638 502 private function prepare_email_setting( $value, $user_id_args ) {
639 - if ( str_contains( $value, '[' . $user_id_args['field_id'] . ']' ) ) {
503 + if ( strpos( $value, '[' . $user_id_args['field_id'] . ']' ) !== false ) {
640 504 $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'] . ']' ) ) {
505 + } elseif ( strpos( $value, '[' . $user_id_args['field_key'] . ']' ) !== false ) {
642 506 $value = str_replace( '[' . $user_id_args['field_key'] . ']', '[' . $user_id_args['field_key'] . ' show="user_email"]', $value );
643 507 }
644 508
645 509 $value = FrmFieldsHelper::basic_replace_shortcodes( $value, $this->form, $this->entry );
@@ -645,10 +509,11 @@
645 509 $value = FrmFieldsHelper::basic_replace_shortcodes( $value, $this->form, $this->entry );
646 510
647 511 // Remove brackets and add a space in case there isn't one
648 512 $value = str_replace( '<', ' ', $value );
513 + $value = str_replace( array( '"', '>' ), '', $value );
649 514
650 - return str_replace( array( '"', '>' ), '', $value );
515 + return $value;
651 516 }
652 517
653 518 /**
654 519 * Extract the emails from cc and bcc. Allow separation by , or ;.
@@ -656,14 +521,19 @@
656 521 *
657 522 * @since 2.03.04
658 523 *
659 524 * @param string $emails
660 - *
661 525 * @return array|string $emails
662 526 */
663 527 private function explode_emails( $emails ) {
664 - $emails = ! empty( $emails ) ? preg_split( '/(,|;)/', $emails ) : '';
665 - return is_array( $emails ) ? array_map( 'trim', $emails ) : trim( $emails );
528 + $emails = ( ! empty( $emails ) ? preg_split( '/(,|;)/', $emails ) : '' );
529 + if ( is_array( $emails ) ) {
530 + $emails = array_map( 'trim', $emails );
531 + } else {
532 + $emails = trim( $emails );
533 + }
534 +
535 + return $emails;
666 536 }
667 537
668 538 /**
669 539 * Format the recipients( to, cc, bcc)
@@ -672,9 +542,9 @@
672 542 *
673 543 * @return array
674 544 */
675 545 private function format_recipients( $recipients ) {
676 - if ( ! $recipients ) {
546 + if ( empty( $recipients ) ) {
677 547 return $recipients;
678 548 }
679 549
680 550 foreach ( $recipients as $key => $val ) {
@@ -682,24 +552,24 @@
682 552
683 553 if ( is_email( $val ) ) {
684 554 // If a plain email is used, no formatting is needed
685 555 continue;
686 - }
556 + } else {
557 + $parts = explode( ' ', $val );
558 + $email = end( $parts );
687 559
688 - $parts = explode( ' ', $val );
689 - $email = end( $parts );
690 -
691 - if ( is_email( $email ) ) {
692 - // If user enters a name and email
693 - $name = trim( str_replace( $email, '', $val ) );
694 - } else {
695 - // If user enters a name without an email
696 - unset( $recipients[ $key ] );
697 - continue;
560 + if ( is_email( $email ) ) {
561 + // If user enters a name and email
562 + $name = trim( str_replace( $email, '', $val ) );
563 + } else {
564 + // If user enters a name without an email
565 + unset( $recipients[ $key ] );
566 + continue;
567 + }
698 568 }
699 569
700 570 $recipients[ $key ] = $this->format_from_email( $name, $email );
701 - }//end foreach
571 + }
702 572
703 573 return $recipients;
704 574 }
705 575
@@ -721,13 +591,13 @@
721 591 list( $from_name, $from_email ) = $this->get_name_and_email_for_sender( $from );
722 592 }
723 593
724 594 // if sending the email from a yahoo address, change it to the WordPress default
725 - if ( str_contains( $from_email, '@yahoo.com' ) ) {
595 + if ( strpos( $from_email, '@yahoo.com' ) ) {
596 +
726 597 // Get the site domain and get rid of www.
727 598 $sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) );
728 -
729 - if ( str_starts_with( $sitename, 'www.' ) ) {
599 + if ( substr( $sitename, 0, 4 ) === 'www.' ) {
730 600 $sitename = substr( $sitename, 4 );
731 601 }
732 602
733 603 $from_email = 'wordpress@' . $sitename;
@@ -749,9 +619,9 @@
749 619 $reply_to = trim( $reply_to );
750 620
751 621 if ( ! is_email( $reply_to ) ) {
752 622 list( $name, $email ) = $this->get_name_and_email_for_sender( $reply_to );
753 - $reply_to = $this->format_from_email( $name, $email );
623 + $reply_to = $this->format_from_email( $name, $email );
754 624 }
755 625
756 626 return $reply_to;
757 627 }
@@ -759,21 +629,15 @@
759 629 /**
760 630 * Get only the email if the name and email have been combined
761 631 *
762 632 * @since 3.0.06
763 - *
764 - * @param string $name
765 - *
766 - * @return string
767 633 */
768 634 private function get_email_from_name( $name ) {
769 635 $email = trim( trim( $name, '>' ), '<' );
770 -
771 - if ( str_contains( $email, '<' ) ) {
636 + if ( strpos( $email, '<' ) !== false ) {
772 637 $parts = explode( '<', $email );
773 638 $email = trim( $parts[1], '>' );
774 639 }
775 -
776 640 return $email;
777 641 }
778 642
779 643 /**
@@ -801,19 +665,13 @@
801 665 }
802 666
803 667 /**
804 668 * @since 3.0.06
805 - *
806 - * @param string $name
807 - * @param string $email
808 - *
809 - * @return string
810 669 */
811 670 private function format_from_email( $name, $email ) {
812 671 if ( '' !== $name ) {
813 672 $email = $name . ' <' . $email . '>';
814 673 }
815 -
816 674 return $email;
817 675 }
818 676
819 677 /**
@@ -820,12 +678,11 @@
820 678 * Remove phone numbers from To addresses
821 679 * Send the phone numbers to the frm_send_to_not_email hook
822 680 *
823 681 * @since 2.03.04
824 - *
825 - * @return void
826 682 */
827 683 private function handle_phone_numbers() {
684 +
828 685 foreach ( $this->to as $key => $recipient ) {
829 686 if ( '[admin_email]' !== $recipient && ! is_email( $recipient ) ) {
830 687 $recipient = explode( ' ', $recipient );
831 688
@@ -849,10 +706,10 @@
849 706 );
850 707
851 708 // Remove phone number from to addresses
852 709 unset( $this->to[ $key ] );
853 - }//end if
854 - }//end foreach
710 + }
711 + }
855 712 }
856 713
857 714 /**
858 715 * Package an array of FrmEmail properties
@@ -871,12 +728,10 @@
871 728 'subject' => $this->subject,
872 729 'message' => $this->message,
873 730 'attachments' => $this->attachments,
874 731 'plain_text' => $this->is_plain_text,
875 - 'email_key' => $this->email_key,
876 732 'form' => $this->form,
877 733 'entry' => $this->entry,
878 - 'email_style' => $this->settings['email_style'],
879 734 );
880 735 }
881 736
882 737 /**
@@ -882,10 +737,8 @@
882 737 /**
883 738 * Remove the Buddypress email filters
884 739 *
885 740 * @since 2.03.04
886 - *
887 - * @return void
888 741 */
889 742 private function remove_buddypress_filters() {
890 743 remove_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' );
891 744 remove_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
@@ -895,10 +748,8 @@
895 748 * Add Mandrill line break filter
896 749 * Remove line breaks in HTML emails to prevent conflicts with Mandrill
897 750 *
898 751 * @since 2.03.04
899 - *
900 - * @return void
901 752 */
902 753 private function add_mandrill_filter() {
903 754 if ( ! $this->is_plain_text ) {
904 755 add_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' );
@@ -908,10 +759,8 @@
908 759 /**
909 760 * Remove Mandrill line break filter
910 761 *
911 762 * @since 2.03.04
912 - *
913 - * @return void
914 763 */
915 764 private function remove_mandrill_filter() {
916 765 remove_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' );
917 766 }
@@ -923,9 +772,9 @@
923 772 *
924 773 * @return string
925 774 */
926 775 private function encode_subject( $subject ) {
927 - if ( apply_filters( 'frm_encode_subject', false, $subject ) ) {
776 + if ( apply_filters( 'frm_encode_subject', 1, $subject ) ) {
928 777 $subject = '=?' . $this->charset . '?B?' . base64_encode( $subject ) . '?=';
929 778 }
930 779
931 780 return $subject;