| @@ -7,99 +7,30 @@ | ||
| 7 | 7 | * @since 2.03.04 |
| 8 | 8 | */ |
| 9 | 9 | class FrmEmail { |
| 10 | 10 | |
| 11 | - /** | |
| 12 | - * @var string | |
| 13 | - */ | |
| 14 | 11 | private $email_key = ''; |
| 15 | - | |
| 16 | - /** | |
| 17 | - * @var array | |
| 18 | - */ | |
| 19 | 12 | private $to = array(); |
| 20 | - | |
| 21 | - /** | |
| 22 | - * @var array | |
| 23 | - */ | |
| 24 | 13 | private $cc = array(); |
| 25 | - | |
| 26 | - /** | |
| 27 | - * @var array | |
| 28 | - */ | |
| 29 | 14 | private $bcc = array(); |
| 30 | - | |
| 31 | - /** | |
| 32 | - * @var string | |
| 33 | - */ | |
| 34 | 15 | private $from = ''; |
| 35 | - | |
| 36 | - /** | |
| 37 | - * @var string | |
| 38 | - */ | |
| 39 | 16 | private $reply_to = ''; |
| 40 | - | |
| 41 | - /** | |
| 42 | - * @var string | |
| 43 | - */ | |
| 44 | 17 | private $subject = ''; |
| 45 | - | |
| 46 | - /** | |
| 47 | - * @var string | |
| 48 | - */ | |
| 49 | 18 | private $message = ''; |
| 50 | - | |
| 51 | - /** | |
| 52 | - * @var array | |
| 53 | - */ | |
| 54 | 19 | private $attachments = array(); |
| 55 | 20 | |
| 56 | - /** | |
| 57 | - * @var bool | |
| 58 | - */ | |
| 59 | 21 | private $is_plain_text = false; |
| 60 | - | |
| 61 | - /** | |
| 62 | - * @var bool | |
| 63 | - */ | |
| 64 | 22 | private $is_single_recipient = false; |
| 65 | - | |
| 66 | - /** | |
| 67 | - * @var bool | |
| 68 | - */ | |
| 69 | 23 | private $include_user_info = false; |
| 70 | 24 | |
| 71 | - /** | |
| 72 | - * @var string | |
| 73 | - */ | |
| 74 | 25 | private $charset = ''; |
| 75 | - | |
| 76 | - /** | |
| 77 | - * @var string | |
| 78 | - */ | |
| 79 | 26 | private $content_type = 'text/html'; |
| 80 | 27 | |
| 81 | - /** | |
| 82 | - * @var array | |
| 83 | - */ | |
| 84 | 28 | private $settings = array(); |
| 85 | - | |
| 86 | - /** | |
| 87 | - * @var stdClass | |
| 88 | - */ | |
| 89 | 29 | private $entry; |
| 90 | - | |
| 91 | - /** | |
| 92 | - * @var stdClass | |
| 93 | - */ | |
| 94 | 30 | private $form; |
| 95 | 31 | |
| 96 | 32 | /** |
| 97 | - * @var int | |
| 98 | - */ | |
| 99 | - private $action_id = 0; | |
| 100 | - | |
| 101 | - /** | |
| 102 | 33 | * FrmEmail constructor |
| 103 | 34 | * |
| 104 | 35 | * @param object $action |
| 105 | 36 | * @param object $entry |
| @@ -106,12 +37,11 @@ | ||
| 106 | 37 | * @param object $form |
| 107 | 38 | */ |
| 108 | 39 | public function __construct( $action, $entry, $form ) { |
| 109 | 40 | $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; | |
| 41 | + $this->entry = $entry; | |
| 42 | + $this->form = $form; | |
| 43 | + $this->settings = $action->post_content; | |
| 114 | 44 | |
| 115 | 45 | $user_id_args = self::get_user_id_args( $form->id ); |
| 116 | 46 | $this->set_to( $user_id_args ); |
| 117 | 47 | $this->set_cc( $user_id_args ); |
| @@ -141,10 +71,8 @@ | ||
| 141 | 71 | * |
| 142 | 72 | * @since 2.03.04 |
| 143 | 73 | * |
| 144 | 74 | * @param object $action |
| 145 | - * | |
| 146 | - * @return void | |
| 147 | 75 | */ |
| 148 | 76 | private function set_email_key( $action ) { |
| 149 | 77 | $this->email_key = $action->ID; |
| 150 | 78 | } |
| @@ -154,10 +82,8 @@ | ||
| 154 | 82 | * |
| 155 | 83 | * @since 2.03.04 |
| 156 | 84 | * |
| 157 | 85 | * @param array $user_id_args |
| 158 | - * | |
| 159 | - * @return void | |
| 160 | 86 | */ |
| 161 | 87 | private function set_to( $user_id_args ) { |
| 162 | 88 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
| 163 | 89 | $to = $this->explode_emails( $to ); |
| @@ -190,10 +116,8 @@ | ||
| 190 | 116 | * |
| 191 | 117 | * @since 2.03.04 |
| 192 | 118 | * |
| 193 | 119 | * @param array $user_id_args |
| 194 | - * | |
| 195 | - * @return void | |
| 196 | 120 | */ |
| 197 | 121 | private function set_cc( $user_id_args ) { |
| 198 | 122 | $this->cc = $this->prepare_additional_recipients( $this->settings['cc'], $user_id_args ); |
| 199 | 123 | } |
| @@ -203,10 +127,8 @@ | ||
| 203 | 127 | * |
| 204 | 128 | * @since 2.03.04 |
| 205 | 129 | * |
| 206 | 130 | * @param array $user_id_args |
| 207 | - * | |
| 208 | - * @return void | |
| 209 | 131 | */ |
| 210 | 132 | private function set_bcc( $user_id_args ) { |
| 211 | 133 | $this->bcc = $this->prepare_additional_recipients( $this->settings['bcc'], $user_id_args ); |
| 212 | 134 | } |
| @@ -216,9 +138,9 @@ | ||
| 216 | 138 | * |
| 217 | 139 | * @since 2.03.04 |
| 218 | 140 | * |
| 219 | 141 | * @param string $recipients |
| 220 | - * @param array $user_id_args | |
| 142 | + * @param array $user_id_args | |
| 221 | 143 | * |
| 222 | 144 | * @return array |
| 223 | 145 | */ |
| 224 | 146 | private function prepare_additional_recipients( $recipients, $user_id_args ) { |
| @@ -236,14 +158,12 @@ | ||
| 236 | 158 | * |
| 237 | 159 | * @since 2.03.04 |
| 238 | 160 | * |
| 239 | 161 | * @param array $user_id_args |
| 240 | - * | |
| 241 | - * @return void | |
| 242 | 162 | */ |
| 243 | 163 | private function set_from( $user_id_args ) { |
| 244 | 164 | if ( empty( $this->settings['from'] ) ) { |
| 245 | - $from = FrmEmailHelper::get_default_from_email(); | |
| 165 | + $from = get_option( 'admin_email' ); | |
| 246 | 166 | } else { |
| 247 | 167 | $from = $this->prepare_email_setting( $this->settings['from'], $user_id_args ); |
| 248 | 168 | } |
| 249 | 169 | |
| @@ -255,10 +175,8 @@ | ||
| 255 | 175 | * |
| 256 | 176 | * @since 2.03.04 |
| 257 | 177 | * |
| 258 | 178 | * @param array $user_id_args |
| 259 | - * | |
| 260 | - * @return void | |
| 261 | 179 | */ |
| 262 | 180 | private function set_reply_to( $user_id_args ) { |
| 263 | 181 | $this->reply_to = trim( $this->settings['reply_to'] ); |
| 264 | 182 | |
| @@ -277,19 +195,13 @@ | ||
| 277 | 195 | * Set the is_plain_text property |
| 278 | 196 | * This should be set before the message |
| 279 | 197 | * |
| 280 | 198 | * @since 2.03.04 |
| 281 | - * | |
| 282 | - * @return void | |
| 283 | 199 | */ |
| 284 | 200 | 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; | |
| 201 | + if ( $this->settings['plain_text'] ) { | |
| 202 | + $this->is_plain_text = true; | |
| 289 | 203 | } |
| 290 | - | |
| 291 | - $this->is_plain_text = 'plain' === $this->settings['email_style']; | |
| 292 | 204 | } |
| 293 | 205 | |
| 294 | 206 | /** |
| 295 | 207 | * Set the include_user_info property |
| @@ -295,10 +207,8 @@ | ||
| 295 | 207 | * Set the include_user_info property |
| 296 | 208 | * This should be set before the message |
| 297 | 209 | * |
| 298 | 210 | * @since 2.03.04 |
| 299 | - * | |
| 300 | - * @return void | |
| 301 | 211 | */ |
| 302 | 212 | private function set_include_user_info() { |
| 303 | 213 | if ( isset( $this->settings['inc_user_info'] ) ) { |
| 304 | 214 | $this->include_user_info = $this->settings['inc_user_info']; |
| @@ -309,11 +219,9 @@ | ||
| 309 | 219 | * Set the is_single_recipient property |
| 310 | 220 | * |
| 311 | 221 | * @since 2.03.04 |
| 312 | 222 | * |
| 313 | - * @param object $action | |
| 314 | - * | |
| 315 | - * @return void | |
| 223 | + * @param $action | |
| 316 | 224 | */ |
| 317 | 225 | private function set_is_single_recipient( $action ) { |
| 318 | 226 | $args = array( |
| 319 | 227 | 'form' => $this->form, |
| @@ -332,10 +240,8 @@ | ||
| 332 | 240 | /** |
| 333 | 241 | * Set the charset |
| 334 | 242 | * |
| 335 | 243 | * @since 2.03.04 |
| 336 | - * | |
| 337 | - * @return void | |
| 338 | 244 | */ |
| 339 | 245 | private function set_charset() { |
| 340 | 246 | $this->charset = get_option( 'blog_charset' ); |
| 341 | 247 | } |
| @@ -343,10 +249,8 @@ | ||
| 343 | 249 | /** |
| 344 | 250 | * Set the content type |
| 345 | 251 | * |
| 346 | 252 | * @since 2.03.04 |
| 347 | - * | |
| 348 | - * @return void | |
| 349 | 253 | */ |
| 350 | 254 | private function set_content_type() { |
| 351 | 255 | if ( $this->is_plain_text ) { |
| 352 | 256 | $this->content_type = 'text/plain'; |
| @@ -356,10 +260,8 @@ | ||
| 356 | 260 | /** |
| 357 | 261 | * Set the subject |
| 358 | 262 | * |
| 359 | 263 | * @since 2.03.04 |
| 360 | - * | |
| 361 | - * @return void | |
| 362 | 264 | */ |
| 363 | 265 | private function set_subject() { |
| 364 | 266 | if ( empty( $this->settings['email_subject'] ) ) { |
| 365 | 267 | /* translators: %1$s: Form name, %2$s: Site name */ |
| @@ -367,9 +269,8 @@ | ||
| 367 | 269 | } else { |
| 368 | 270 | $this->subject = $this->settings['email_subject']; |
| 369 | 271 | } |
| 370 | 272 | |
| 371 | - // This also replaces [sitename] shortcode in default. | |
| 372 | 273 | $this->subject = FrmFieldsHelper::basic_replace_shortcodes( $this->subject, $this->form, $this->entry ); |
| 373 | 274 | |
| 374 | 275 | $args = array( |
| 375 | 276 | 'form' => $this->form, |
| @@ -376,8 +277,9 @@ | ||
| 376 | 277 | 'entry' => $this->entry, |
| 377 | 278 | 'email_key' => $this->email_key, |
| 378 | 279 | ); |
| 379 | 280 | $this->subject = apply_filters( 'frm_email_subject', $this->subject, $args ); |
| 281 | + | |
| 380 | 282 | $this->subject = wp_specialchars_decode( strip_tags( stripslashes( $this->subject ) ), ENT_QUOTES ); |
| 381 | 283 | } |
| 382 | 284 | |
| 383 | 285 | /** |
| @@ -383,38 +285,27 @@ | ||
| 383 | 285 | /** |
| 384 | 286 | * Set the email message |
| 385 | 287 | * |
| 386 | 288 | * @since 2.03.04 |
| 387 | - * | |
| 388 | - * @return void | |
| 389 | 289 | */ |
| 390 | 290 | private function set_message() { |
| 391 | - $this->message = $this->settings['email_message']; | |
| 291 | + $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->settings['email_message'], $this->form, $this->entry ); | |
| 392 | 292 | |
| 393 | - if ( ! $this->is_plain_text ) { | |
| 394 | - // The decode is to support [default-html] shortcodes. | |
| 395 | - $this->message = html_entity_decode( $this->message ); | |
| 396 | - } | |
| 397 | - | |
| 398 | - $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->message, $this->form, $this->entry ); | |
| 399 | 293 | $prev_mail_body = $this->message; |
| 400 | - | |
| 401 | - // Make a copy to prevent changes by reference. | |
| 402 | - $pass_entry = clone $this->entry; | |
| 403 | - $mail_body = FrmEntriesHelper::replace_default_message( | |
| 294 | + $pass_entry = clone $this->entry; // make a copy to prevent changes by reference | |
| 295 | + $mail_body = FrmEntriesHelper::replace_default_message( | |
| 404 | 296 | $prev_mail_body, |
| 405 | 297 | 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'], | |
| 298 | + 'id' => $this->entry->id, | |
| 299 | + 'entry' => $pass_entry, | |
| 300 | + 'plain_text' => $this->is_plain_text, | |
| 301 | + 'user_info' => $this->include_user_info, | |
| 411 | 302 | ) |
| 412 | 303 | ); |
| 413 | 304 | |
| 414 | 305 | // Add the user info if it isn't already included |
| 415 | 306 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
| 416 | - $data = $this->entry->description; | |
| 307 | + $data = $this->entry->description; | |
| 417 | 308 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
| 418 | 309 | $this->maybe_add_ip( $mail_body ); |
| 419 | 310 | $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n"; |
| 420 | 311 | $mail_body .= __( 'Referrer', 'formidable' ) . ': ' . $data['referrer'] . "\r\n"; |
| @@ -421,39 +312,17 @@ | ||
| 421 | 312 | } |
| 422 | 313 | |
| 423 | 314 | $this->message = $mail_body; |
| 424 | 315 | |
| 316 | + $this->message = do_shortcode( $this->message ); | |
| 317 | + | |
| 425 | 318 | if ( $this->is_plain_text ) { |
| 426 | 319 | $this->message = wp_specialchars_decode( strip_tags( $this->message ), ENT_QUOTES ); |
| 427 | - $this->message = str_replace( ' ', '', $this->message ); | |
| 428 | - } else { | |
| 429 | - $this->add_autop(); | |
| 430 | 320 | } |
| 431 | 321 | |
| 432 | 322 | $this->message = apply_filters( 'frm_email_message', $this->message, $this->package_atts() ); |
| 433 | 323 | } |
| 434 | 324 | |
| 435 | - /** | |
| 436 | - * Runs message through autop, extracting the content inside body tag if it has <body>. | |
| 437 | - * | |
| 438 | - * @return void | |
| 439 | - */ | |
| 440 | - private function add_autop() { | |
| 441 | - $message = $this->message; | |
| 442 | - preg_match( '/<body[^>]*>([\s\S]*?)<\/body>/', $message, $match ); | |
| 443 | - | |
| 444 | - if ( ! empty( $match[1] ) ) { | |
| 445 | - $this->message = str_replace( $match[1], trim( wpautop( $match[1] ) ), $message ); | |
| 446 | - } else { | |
| 447 | - $this->message = trim( wpautop( $message ) ); | |
| 448 | - } | |
| 449 | - } | |
| 450 | - | |
| 451 | - /** | |
| 452 | - * @param string $mail_body | |
| 453 | - * | |
| 454 | - * @return void | |
| 455 | - */ | |
| 456 | 325 | private function maybe_add_ip( &$mail_body ) { |
| 457 | 326 | if ( ! empty( $this->entry->ip ) ) { |
| 458 | 327 | $mail_body .= __( 'IP Address', 'formidable' ) . ': ' . $this->entry->ip . "\r\n"; |
| 459 | 328 | } |
| @@ -462,11 +331,8 @@ | ||
| 462 | 331 | /** |
| 463 | 332 | * Set the attachments for an email message |
| 464 | 333 | * |
| 465 | 334 | * @since 2.03.04 |
| 466 | - * @since 5.0.16 added new action_id key to $args. | |
| 467 | - * | |
| 468 | - * @return void | |
| 469 | 335 | */ |
| 470 | 336 | private function set_attachments() { |
| 471 | 337 | $args = array( |
| 472 | 338 | 'entry' => $this->entry, |
| @@ -471,9 +337,8 @@ | ||
| 471 | 337 | $args = array( |
| 472 | 338 | 'entry' => $this->entry, |
| 473 | 339 | 'email_key' => $this->email_key, |
| 474 | 340 | 'settings' => $this->settings, |
| 475 | - 'action_id' => $this->action_id, | |
| 476 | 341 | ); |
| 477 | 342 | |
| 478 | 343 | $this->attachments = apply_filters( 'frm_notification_attachment', array(), $this->form, $args ); |
| 479 | 344 | } |
| @@ -518,10 +383,11 @@ | ||
| 518 | 383 | */ |
| 519 | 384 | private function has_recipients() { |
| 520 | 385 | if ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) ) { |
| 521 | 386 | return false; |
| 387 | + } else { | |
| 388 | + return true; | |
| 522 | 389 | } |
| 523 | - return true; | |
| 524 | 390 | } |
| 525 | 391 | |
| 526 | 392 | /** |
| 527 | 393 | * Send an email |
| @@ -534,9 +400,8 @@ | ||
| 534 | 400 | $this->remove_buddypress_filters(); |
| 535 | 401 | $this->add_mandrill_filter(); |
| 536 | 402 | |
| 537 | 403 | $sent = false; |
| 538 | - | |
| 539 | 404 | if ( count( $this->to ) > 1 && $this->is_single_recipient ) { |
| 540 | 405 | foreach ( $this->to as $recipient ) { |
| 541 | 406 | $sent = $this->send_single( $recipient ); |
| 542 | 407 | } |
| @@ -575,9 +440,8 @@ | ||
| 575 | 440 | if ( ! $sent ) { |
| 576 | 441 | if ( is_array( $header ) ) { |
| 577 | 442 | $header = implode( "\r\n", $header ); |
| 578 | 443 | } |
| 579 | - | |
| 580 | 444 | $recipient = implode( ',', (array) $recipient ); |
| 581 | 445 | $sent = mail( $recipient, $subject, $this->message, $header ); |
| 582 | 446 | } |
| 583 | 447 | |
| @@ -615,9 +479,9 @@ | ||
| 615 | 479 | * Get the userID field ID and key for email settings |
| 616 | 480 | * |
| 617 | 481 | * @since 2.03.04 |
| 618 | 482 | * |
| 619 | - * @param int $form_id | |
| 483 | + * @param $form_id | |
| 620 | 484 | * |
| 621 | 485 | * @return array |
| 622 | 486 | */ |
| 623 | 487 | private function get_user_id_args( $form_id ) { |
| @@ -626,9 +490,8 @@ | ||
| 626 | 490 | 'field_key' => '', |
| 627 | 491 | ); |
| 628 | 492 | |
| 629 | 493 | $user_id_args['field_id'] = FrmEmailHelper::get_user_id_field_for_form( $form_id ); |
| 630 | - | |
| 631 | 494 | if ( $user_id_args['field_id'] ) { |
| 632 | 495 | $user_id_args['field_key'] = FrmField::get_key_by_id( $user_id_args['field_id'] ); |
| 633 | 496 | } |
| 634 | 497 | |
| @@ -640,9 +503,9 @@ | ||
| 640 | 503 | * |
| 641 | 504 | * @since 2.03.04 |
| 642 | 505 | * |
| 643 | 506 | * @param string $value |
| 644 | - * @param array $user_id_args | |
| 507 | + * @param array $user_id_args | |
| 645 | 508 | * |
| 646 | 509 | * @return string |
| 647 | 510 | */ |
| 648 | 511 | private function prepare_email_setting( $value, $user_id_args ) { |
| @@ -672,9 +535,8 @@ | ||
| 672 | 535 | * @return array|string $emails |
| 673 | 536 | */ |
| 674 | 537 | private function explode_emails( $emails ) { |
| 675 | 538 | $emails = ( ! empty( $emails ) ? preg_split( '/(,|;)/', $emails ) : '' ); |
| 676 | - | |
| 677 | 539 | if ( is_array( $emails ) ) { |
| 678 | 540 | $emails = array_map( 'trim', $emails ); |
| 679 | 541 | } else { |
| 680 | 542 | $emails = trim( $emails ); |
| @@ -700,24 +562,24 @@ | ||
| 700 | 562 | |
| 701 | 563 | if ( is_email( $val ) ) { |
| 702 | 564 | // If a plain email is used, no formatting is needed |
| 703 | 565 | continue; |
| 704 | - } | |
| 566 | + } else { | |
| 567 | + $parts = explode( ' ', $val ); | |
| 568 | + $email = end( $parts ); | |
| 705 | 569 | |
| 706 | - $parts = explode( ' ', $val ); | |
| 707 | - $email = end( $parts ); | |
| 708 | - | |
| 709 | - if ( is_email( $email ) ) { | |
| 710 | - // If user enters a name and email | |
| 711 | - $name = trim( str_replace( $email, '', $val ) ); | |
| 712 | - } else { | |
| 713 | - // If user enters a name without an email | |
| 714 | - unset( $recipients[ $key ] ); | |
| 715 | - continue; | |
| 570 | + if ( is_email( $email ) ) { | |
| 571 | + // If user enters a name and email | |
| 572 | + $name = trim( str_replace( $email, '', $val ) ); | |
| 573 | + } else { | |
| 574 | + // If user enters a name without an email | |
| 575 | + unset( $recipients[ $key ] ); | |
| 576 | + continue; | |
| 577 | + } | |
| 716 | 578 | } |
| 717 | 579 | |
| 718 | 580 | $recipients[ $key ] = $this->format_from_email( $name, $email ); |
| 719 | - }//end foreach | |
| 581 | + } | |
| 720 | 582 | |
| 721 | 583 | return $recipients; |
| 722 | 584 | } |
| 723 | 585 | |
| @@ -743,9 +605,8 @@ | ||
| 743 | 605 | if ( strpos( $from_email, '@yahoo.com' ) ) { |
| 744 | 606 | |
| 745 | 607 | // Get the site domain and get rid of www. |
| 746 | 608 | $sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) ); |
| 747 | - | |
| 748 | 609 | if ( substr( $sitename, 0, 4 ) === 'www.' ) { |
| 749 | 610 | $sitename = substr( $sitename, 4 ); |
| 750 | 611 | } |
| 751 | 612 | |
| @@ -768,9 +629,9 @@ | ||
| 768 | 629 | $reply_to = trim( $reply_to ); |
| 769 | 630 | |
| 770 | 631 | if ( ! is_email( $reply_to ) ) { |
| 771 | 632 | list( $name, $email ) = $this->get_name_and_email_for_sender( $reply_to ); |
| 772 | - $reply_to = $this->format_from_email( $name, $email ); | |
| 633 | + $reply_to = $this->format_from_email( $name, $email ); | |
| 773 | 634 | } |
| 774 | 635 | |
| 775 | 636 | return $reply_to; |
| 776 | 637 | } |
| @@ -778,16 +639,11 @@ | ||
| 778 | 639 | /** |
| 779 | 640 | * Get only the email if the name and email have been combined |
| 780 | 641 | * |
| 781 | 642 | * @since 3.0.06 |
| 782 | - * | |
| 783 | - * @param string $name | |
| 784 | - * | |
| 785 | - * @return string | |
| 786 | 643 | */ |
| 787 | 644 | private function get_email_from_name( $name ) { |
| 788 | 645 | $email = trim( trim( $name, '>' ), '<' ); |
| 789 | - | |
| 790 | 646 | if ( strpos( $email, '<' ) !== false ) { |
| 791 | 647 | $parts = explode( '<', $email ); |
| 792 | 648 | $email = trim( $parts[1], '>' ); |
| 793 | 649 | } |
| @@ -820,13 +676,8 @@ | ||
| 820 | 676 | } |
| 821 | 677 | |
| 822 | 678 | /** |
| 823 | 679 | * @since 3.0.06 |
| 824 | - * | |
| 825 | - * @param string $name | |
| 826 | - * @param string $email | |
| 827 | - * | |
| 828 | - * @return string | |
| 829 | 680 | */ |
| 830 | 681 | private function format_from_email( $name, $email ) { |
| 831 | 682 | if ( '' !== $name ) { |
| 832 | 683 | $email = $name . ' <' . $email . '>'; |
| @@ -839,10 +690,8 @@ | ||
| 839 | 690 | * Remove phone numbers from To addresses |
| 840 | 691 | * Send the phone numbers to the frm_send_to_not_email hook |
| 841 | 692 | * |
| 842 | 693 | * @since 2.03.04 |
| 843 | - * | |
| 844 | - * @return void | |
| 845 | 694 | */ |
| 846 | 695 | private function handle_phone_numbers() { |
| 847 | 696 | |
| 848 | 697 | foreach ( $this->to as $key => $recipient ) { |
| @@ -869,10 +718,10 @@ | ||
| 869 | 718 | ); |
| 870 | 719 | |
| 871 | 720 | // Remove phone number from to addresses |
| 872 | 721 | unset( $this->to[ $key ] ); |
| 873 | - }//end if | |
| 874 | - }//end foreach | |
| 722 | + } | |
| 723 | + } | |
| 875 | 724 | } |
| 876 | 725 | |
| 877 | 726 | /** |
| 878 | 727 | * Package an array of FrmEmail properties |
| @@ -891,12 +740,10 @@ | ||
| 891 | 740 | 'subject' => $this->subject, |
| 892 | 741 | 'message' => $this->message, |
| 893 | 742 | 'attachments' => $this->attachments, |
| 894 | 743 | 'plain_text' => $this->is_plain_text, |
| 895 | - 'email_key' => $this->email_key, | |
| 896 | 744 | 'form' => $this->form, |
| 897 | 745 | 'entry' => $this->entry, |
| 898 | - 'email_style' => $this->settings['email_style'], | |
| 899 | 746 | ); |
| 900 | 747 | } |
| 901 | 748 | |
| 902 | 749 | /** |
| @@ -902,10 +749,8 @@ | ||
| 902 | 749 | /** |
| 903 | 750 | * Remove the Buddypress email filters |
| 904 | 751 | * |
| 905 | 752 | * @since 2.03.04 |
| 906 | - * | |
| 907 | - * @return void | |
| 908 | 753 | */ |
| 909 | 754 | private function remove_buddypress_filters() { |
| 910 | 755 | remove_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' ); |
| 911 | 756 | remove_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' ); |
| @@ -915,10 +760,8 @@ | ||
| 915 | 760 | * Add Mandrill line break filter |
| 916 | 761 | * Remove line breaks in HTML emails to prevent conflicts with Mandrill |
| 917 | 762 | * |
| 918 | 763 | * @since 2.03.04 |
| 919 | - * | |
| 920 | - * @return void | |
| 921 | 764 | */ |
| 922 | 765 | private function add_mandrill_filter() { |
| 923 | 766 | if ( ! $this->is_plain_text ) { |
| 924 | 767 | add_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' ); |
| @@ -928,10 +771,8 @@ | ||
| 928 | 771 | /** |
| 929 | 772 | * Remove Mandrill line break filter |
| 930 | 773 | * |
| 931 | 774 | * @since 2.03.04 |
| 932 | - * | |
| 933 | - * @return void | |
| 934 | 775 | */ |
| 935 | 776 | private function remove_mandrill_filter() { |
| 936 | 777 | remove_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' ); |
| 937 | 778 | } |