| @@ -236,14 +236,13 @@ | ||
| 236 | 236 | * |
| 237 | 237 | * @since 2.03.04 |
| 238 | 238 | * |
| 239 | 239 | * @param array $user_id_args |
| 240 | - * | |
| 241 | 240 | * @return void |
| 242 | 241 | */ |
| 243 | 242 | private function set_from( $user_id_args ) { |
| 244 | 243 | if ( empty( $this->settings['from'] ) ) { |
| 245 | - $from = FrmEmailHelper::get_default_from_email(); | |
| 244 | + $from = get_option( 'admin_email' ); | |
| 246 | 245 | } else { |
| 247 | 246 | $from = $this->prepare_email_setting( $this->settings['from'], $user_id_args ); |
| 248 | 247 | } |
| 249 | 248 | |
| @@ -281,15 +280,11 @@ | ||
| 281 | 280 | * |
| 282 | 281 | * @return void |
| 283 | 282 | */ |
| 284 | 283 | private function set_is_plain_text() { |
| 285 | - if ( empty( $this->settings['email_style'] ) ) { | |
| 286 | - // If `email_style` isn't set, use the `plain_text` checkbox. | |
| 287 | - $this->is_plain_text = ! empty( $this->settings['plain_text'] ); | |
| 288 | - return; | |
| 284 | + if ( $this->settings['plain_text'] ) { | |
| 285 | + $this->is_plain_text = true; | |
| 289 | 286 | } |
| 290 | - | |
| 291 | - $this->is_plain_text = 'plain' === $this->settings['email_style']; | |
| 292 | 287 | } |
| 293 | 288 | |
| 294 | 289 | /** |
| 295 | 290 | * Set the include_user_info property |
| @@ -402,13 +397,12 @@ | ||
| 402 | 397 | $pass_entry = clone $this->entry; |
| 403 | 398 | $mail_body = FrmEntriesHelper::replace_default_message( |
| 404 | 399 | $prev_mail_body, |
| 405 | 400 | array( |
| 406 | - 'id' => $this->entry->id, | |
| 407 | - 'entry' => $pass_entry, | |
| 408 | - 'plain_text' => $this->is_plain_text, | |
| 409 | - 'user_info' => $this->include_user_info, | |
| 410 | - 'table_style' => $this->settings['email_style'], | |
| 401 | + 'id' => $this->entry->id, | |
| 402 | + 'entry' => $pass_entry, | |
| 403 | + 'plain_text' => $this->is_plain_text, | |
| 404 | + 'user_info' => $this->include_user_info, | |
| 411 | 405 | ) |
| 412 | 406 | ); |
| 413 | 407 | |
| 414 | 408 | // Add the user info if it isn't already included |
| @@ -421,11 +415,12 @@ | ||
| 421 | 415 | } |
| 422 | 416 | |
| 423 | 417 | $this->message = $mail_body; |
| 424 | 418 | |
| 419 | + $this->message = do_shortcode( $this->message ); | |
| 420 | + | |
| 425 | 421 | if ( $this->is_plain_text ) { |
| 426 | 422 | $this->message = wp_specialchars_decode( strip_tags( $this->message ), ENT_QUOTES ); |
| 427 | - $this->message = str_replace( ' ', '', $this->message ); | |
| 428 | 423 | } else { |
| 429 | 424 | $this->add_autop(); |
| 430 | 425 | } |
| 431 | 426 | |
| @@ -438,10 +433,9 @@ | ||
| 438 | 433 | * @return void |
| 439 | 434 | */ |
| 440 | 435 | private function add_autop() { |
| 441 | 436 | $message = $this->message; |
| 442 | - preg_match( '/<body[^>]*>([\s\S]*?)<\/body>/', $message, $match ); | |
| 443 | - | |
| 437 | + $result = preg_match( '/<body[^>]*>([\s\S]*?)<\/body>/', $message, $match ); | |
| 444 | 438 | if ( ! empty( $match[1] ) ) { |
| 445 | 439 | $this->message = str_replace( $match[1], trim( wpautop( $match[1] ) ), $message ); |
| 446 | 440 | } else { |
| 447 | 441 | $this->message = trim( wpautop( $message ) ); |
| @@ -534,9 +528,8 @@ | ||
| 534 | 528 | $this->remove_buddypress_filters(); |
| 535 | 529 | $this->add_mandrill_filter(); |
| 536 | 530 | |
| 537 | 531 | $sent = false; |
| 538 | - | |
| 539 | 532 | if ( count( $this->to ) > 1 && $this->is_single_recipient ) { |
| 540 | 533 | foreach ( $this->to as $recipient ) { |
| 541 | 534 | $sent = $this->send_single( $recipient ); |
| 542 | 535 | } |
| @@ -575,9 +568,8 @@ | ||
| 575 | 568 | if ( ! $sent ) { |
| 576 | 569 | if ( is_array( $header ) ) { |
| 577 | 570 | $header = implode( "\r\n", $header ); |
| 578 | 571 | } |
| 579 | - | |
| 580 | 572 | $recipient = implode( ',', (array) $recipient ); |
| 581 | 573 | $sent = mail( $recipient, $subject, $this->message, $header ); |
| 582 | 574 | } |
| 583 | 575 | |
| @@ -626,9 +618,8 @@ | ||
| 626 | 618 | 'field_key' => '', |
| 627 | 619 | ); |
| 628 | 620 | |
| 629 | 621 | $user_id_args['field_id'] = FrmEmailHelper::get_user_id_field_for_form( $form_id ); |
| 630 | - | |
| 631 | 622 | if ( $user_id_args['field_id'] ) { |
| 632 | 623 | $user_id_args['field_key'] = FrmField::get_key_by_id( $user_id_args['field_id'] ); |
| 633 | 624 | } |
| 634 | 625 | |
| @@ -672,9 +663,8 @@ | ||
| 672 | 663 | * @return array|string $emails |
| 673 | 664 | */ |
| 674 | 665 | private function explode_emails( $emails ) { |
| 675 | 666 | $emails = ( ! empty( $emails ) ? preg_split( '/(,|;)/', $emails ) : '' ); |
| 676 | - | |
| 677 | 667 | if ( is_array( $emails ) ) { |
| 678 | 668 | $emails = array_map( 'trim', $emails ); |
| 679 | 669 | } else { |
| 680 | 670 | $emails = trim( $emails ); |
| @@ -743,9 +733,8 @@ | ||
| 743 | 733 | if ( strpos( $from_email, '@yahoo.com' ) ) { |
| 744 | 734 | |
| 745 | 735 | // Get the site domain and get rid of www. |
| 746 | 736 | $sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) ); |
| 747 | - | |
| 748 | 737 | if ( substr( $sitename, 0, 4 ) === 'www.' ) { |
| 749 | 738 | $sitename = substr( $sitename, 4 ); |
| 750 | 739 | } |
| 751 | 740 | |
| @@ -785,9 +774,8 @@ | ||
| 785 | 774 | * @return string |
| 786 | 775 | */ |
| 787 | 776 | private function get_email_from_name( $name ) { |
| 788 | 777 | $email = trim( trim( $name, '>' ), '<' ); |
| 789 | - | |
| 790 | 778 | if ( strpos( $email, '<' ) !== false ) { |
| 791 | 779 | $parts = explode( '<', $email ); |
| 792 | 780 | $email = trim( $parts[1], '>' ); |
| 793 | 781 | } |
| @@ -823,10 +811,8 @@ | ||
| 823 | 811 | * @since 3.0.06 |
| 824 | 812 | * |
| 825 | 813 | * @param string $name |
| 826 | 814 | * @param string $email |
| 827 | - * | |
| 828 | - * @return string | |
| 829 | 815 | */ |
| 830 | 816 | private function format_from_email( $name, $email ) { |
| 831 | 817 | if ( '' !== $name ) { |
| 832 | 818 | $email = $name . ' <' . $email . '>'; |
| @@ -891,12 +877,10 @@ | ||
| 891 | 877 | 'subject' => $this->subject, |
| 892 | 878 | 'message' => $this->message, |
| 893 | 879 | 'attachments' => $this->attachments, |
| 894 | 880 | 'plain_text' => $this->is_plain_text, |
| 895 | - 'email_key' => $this->email_key, | |
| 896 | 881 | 'form' => $this->form, |
| 897 | 882 | 'entry' => $this->entry, |
| 898 | - 'email_style' => $this->settings['email_style'], | |
| 899 | 883 | ); |
| 900 | 884 | } |
| 901 | 885 | |
| 902 | 886 | /** |