| @@ -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,22 +175,17 @@ | ||
| 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 | |
| 265 | - if ( $this->reply_to ) { | |
| 183 | + if ( empty( $this->reply_to ) ) { | |
| 184 | + $this->reply_to = $this->get_email_from_name( $this->from ); | |
| 185 | + } else { | |
| 266 | 186 | $this->reply_to = $this->prepare_email_setting( $this->settings['reply_to'], $user_id_args ); |
| 267 | 187 | } |
| 268 | - | |
| 269 | - if ( ! $this->reply_to ) { | |
| 270 | - $this->reply_to = $this->get_email_from_name( $this->from ); | |
| 271 | - } | |
| 272 | - | |
| 273 | 188 | $this->reply_to = $this->format_reply_to( $this->reply_to ); |
| 274 | 189 | } |
| 275 | 190 | |
| 276 | 191 | /** |
| @@ -277,19 +192,13 @@ | ||
| 277 | 192 | * Set the is_plain_text property |
| 278 | 193 | * This should be set before the message |
| 279 | 194 | * |
| 280 | 195 | * @since 2.03.04 |
| 281 | - * | |
| 282 | - * @return void | |
| 283 | 196 | */ |
| 284 | 197 | 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; | |
| 198 | + if ( $this->settings['plain_text'] ) { | |
| 199 | + $this->is_plain_text = true; | |
| 289 | 200 | } |
| 290 | - | |
| 291 | - $this->is_plain_text = 'plain' === $this->settings['email_style']; | |
| 292 | 201 | } |
| 293 | 202 | |
| 294 | 203 | /** |
| 295 | 204 | * Set the include_user_info property |
| @@ -295,10 +204,8 @@ | ||
| 295 | 204 | * Set the include_user_info property |
| 296 | 205 | * This should be set before the message |
| 297 | 206 | * |
| 298 | 207 | * @since 2.03.04 |
| 299 | - * | |
| 300 | - * @return void | |
| 301 | 208 | */ |
| 302 | 209 | private function set_include_user_info() { |
| 303 | 210 | if ( isset( $this->settings['inc_user_info'] ) ) { |
| 304 | 211 | $this->include_user_info = $this->settings['inc_user_info']; |
| @@ -309,11 +216,9 @@ | ||
| 309 | 216 | * Set the is_single_recipient property |
| 310 | 217 | * |
| 311 | 218 | * @since 2.03.04 |
| 312 | 219 | * |
| 313 | - * @param object $action | |
| 314 | - * | |
| 315 | - * @return void | |
| 220 | + * @param $action | |
| 316 | 221 | */ |
| 317 | 222 | private function set_is_single_recipient( $action ) { |
| 318 | 223 | $args = array( |
| 319 | 224 | 'form' => $this->form, |
| @@ -332,10 +237,8 @@ | ||
| 332 | 237 | /** |
| 333 | 238 | * Set the charset |
| 334 | 239 | * |
| 335 | 240 | * @since 2.03.04 |
| 336 | - * | |
| 337 | - * @return void | |
| 338 | 241 | */ |
| 339 | 242 | private function set_charset() { |
| 340 | 243 | $this->charset = get_option( 'blog_charset' ); |
| 341 | 244 | } |
| @@ -343,10 +246,8 @@ | ||
| 343 | 246 | /** |
| 344 | 247 | * Set the content type |
| 345 | 248 | * |
| 346 | 249 | * @since 2.03.04 |
| 347 | - * | |
| 348 | - * @return void | |
| 349 | 250 | */ |
| 350 | 251 | private function set_content_type() { |
| 351 | 252 | if ( $this->is_plain_text ) { |
| 352 | 253 | $this->content_type = 'text/plain'; |
| @@ -356,10 +257,8 @@ | ||
| 356 | 257 | /** |
| 357 | 258 | * Set the subject |
| 358 | 259 | * |
| 359 | 260 | * @since 2.03.04 |
| 360 | - * | |
| 361 | - * @return void | |
| 362 | 261 | */ |
| 363 | 262 | private function set_subject() { |
| 364 | 263 | if ( empty( $this->settings['email_subject'] ) ) { |
| 365 | 264 | /* translators: %1$s: Form name, %2$s: Site name */ |
| @@ -367,9 +266,8 @@ | ||
| 367 | 266 | } else { |
| 368 | 267 | $this->subject = $this->settings['email_subject']; |
| 369 | 268 | } |
| 370 | 269 | |
| 371 | - // This also replaces [sitename] shortcode in default. | |
| 372 | 270 | $this->subject = FrmFieldsHelper::basic_replace_shortcodes( $this->subject, $this->form, $this->entry ); |
| 373 | 271 | |
| 374 | 272 | $args = array( |
| 375 | 273 | 'form' => $this->form, |
| @@ -376,8 +274,9 @@ | ||
| 376 | 274 | 'entry' => $this->entry, |
| 377 | 275 | 'email_key' => $this->email_key, |
| 378 | 276 | ); |
| 379 | 277 | $this->subject = apply_filters( 'frm_email_subject', $this->subject, $args ); |
| 278 | + | |
| 380 | 279 | $this->subject = wp_specialchars_decode( strip_tags( stripslashes( $this->subject ) ), ENT_QUOTES ); |
| 381 | 280 | } |
| 382 | 281 | |
| 383 | 282 | /** |
| @@ -383,38 +282,27 @@ | ||
| 383 | 282 | /** |
| 384 | 283 | * Set the email message |
| 385 | 284 | * |
| 386 | 285 | * @since 2.03.04 |
| 387 | - * | |
| 388 | - * @return void | |
| 389 | 286 | */ |
| 390 | 287 | private function set_message() { |
| 391 | - $this->message = $this->settings['email_message']; | |
| 288 | + $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->settings['email_message'], $this->form, $this->entry ); | |
| 392 | 289 | |
| 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 | 290 | $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( | |
| 291 | + $pass_entry = clone $this->entry; // make a copy to prevent changes by reference | |
| 292 | + $mail_body = FrmEntriesHelper::replace_default_message( | |
| 404 | 293 | $prev_mail_body, |
| 405 | 294 | 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'], | |
| 295 | + 'id' => $this->entry->id, | |
| 296 | + 'entry' => $pass_entry, | |
| 297 | + 'plain_text' => $this->is_plain_text, | |
| 298 | + 'user_info' => $this->include_user_info, | |
| 411 | 299 | ) |
| 412 | 300 | ); |
| 413 | 301 | |
| 414 | 302 | // Add the user info if it isn't already included |
| 415 | 303 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
| 416 | - $data = $this->entry->description; | |
| 304 | + $data = $this->entry->description; | |
| 417 | 305 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
| 418 | 306 | $this->maybe_add_ip( $mail_body ); |
| 419 | 307 | $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n"; |
| 420 | 308 | $mail_body .= __( 'Referrer', 'formidable' ) . ': ' . $data['referrer'] . "\r\n"; |
| @@ -421,39 +309,17 @@ | ||
| 421 | 309 | } |
| 422 | 310 | |
| 423 | 311 | $this->message = $mail_body; |
| 424 | 312 | |
| 313 | + $this->message = do_shortcode( $this->message ); | |
| 314 | + | |
| 425 | 315 | if ( $this->is_plain_text ) { |
| 426 | 316 | $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 | 317 | } |
| 431 | 318 | |
| 432 | 319 | $this->message = apply_filters( 'frm_email_message', $this->message, $this->package_atts() ); |
| 433 | 320 | } |
| 434 | 321 | |
| 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 | 322 | private function maybe_add_ip( &$mail_body ) { |
| 457 | 323 | if ( ! empty( $this->entry->ip ) ) { |
| 458 | 324 | $mail_body .= __( 'IP Address', 'formidable' ) . ': ' . $this->entry->ip . "\r\n"; |
| 459 | 325 | } |
| @@ -462,11 +328,8 @@ | ||
| 462 | 328 | /** |
| 463 | 329 | * Set the attachments for an email message |
| 464 | 330 | * |
| 465 | 331 | * @since 2.03.04 |
| 466 | - * @since 5.0.16 added new action_id key to $args. | |
| 467 | - * | |
| 468 | - * @return void | |
| 469 | 332 | */ |
| 470 | 333 | private function set_attachments() { |
| 471 | 334 | $args = array( |
| 472 | 335 | 'entry' => $this->entry, |
| @@ -471,9 +334,8 @@ | ||
| 471 | 334 | $args = array( |
| 472 | 335 | 'entry' => $this->entry, |
| 473 | 336 | 'email_key' => $this->email_key, |
| 474 | 337 | 'settings' => $this->settings, |
| 475 | - 'action_id' => $this->action_id, | |
| 476 | 338 | ); |
| 477 | 339 | |
| 478 | 340 | $this->attachments = apply_filters( 'frm_notification_attachment', array(), $this->form, $args ); |
| 479 | 341 | } |
| @@ -518,10 +380,11 @@ | ||
| 518 | 380 | */ |
| 519 | 381 | private function has_recipients() { |
| 520 | 382 | if ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) ) { |
| 521 | 383 | return false; |
| 384 | + } else { | |
| 385 | + return true; | |
| 522 | 386 | } |
| 523 | - return true; | |
| 524 | 387 | } |
| 525 | 388 | |
| 526 | 389 | /** |
| 527 | 390 | * Send an email |
| @@ -534,9 +397,8 @@ | ||
| 534 | 397 | $this->remove_buddypress_filters(); |
| 535 | 398 | $this->add_mandrill_filter(); |
| 536 | 399 | |
| 537 | 400 | $sent = false; |
| 538 | - | |
| 539 | 401 | if ( count( $this->to ) > 1 && $this->is_single_recipient ) { |
| 540 | 402 | foreach ( $this->to as $recipient ) { |
| 541 | 403 | $sent = $this->send_single( $recipient ); |
| 542 | 404 | } |
| @@ -572,12 +434,9 @@ | ||
| 572 | 434 | |
| 573 | 435 | $sent = wp_mail( $recipient, $subject, $this->message, $header, $this->attachments ); |
| 574 | 436 | |
| 575 | 437 | if ( ! $sent ) { |
| 576 | - if ( is_array( $header ) ) { | |
| 577 | - $header = implode( "\r\n", $header ); | |
| 578 | - } | |
| 579 | - | |
| 438 | + $header = 'From: ' . $this->from . "\r\n"; | |
| 580 | 439 | $recipient = implode( ',', (array) $recipient ); |
| 581 | 440 | $sent = mail( $recipient, $subject, $this->message, $header ); |
| 582 | 441 | } |
| 583 | 442 | |
| @@ -615,9 +474,9 @@ | ||
| 615 | 474 | * Get the userID field ID and key for email settings |
| 616 | 475 | * |
| 617 | 476 | * @since 2.03.04 |
| 618 | 477 | * |
| 619 | - * @param int $form_id | |
| 478 | + * @param $form_id | |
| 620 | 479 | * |
| 621 | 480 | * @return array |
| 622 | 481 | */ |
| 623 | 482 | private function get_user_id_args( $form_id ) { |
| @@ -626,9 +485,8 @@ | ||
| 626 | 485 | 'field_key' => '', |
| 627 | 486 | ); |
| 628 | 487 | |
| 629 | 488 | $user_id_args['field_id'] = FrmEmailHelper::get_user_id_field_for_form( $form_id ); |
| 630 | - | |
| 631 | 489 | if ( $user_id_args['field_id'] ) { |
| 632 | 490 | $user_id_args['field_key'] = FrmField::get_key_by_id( $user_id_args['field_id'] ); |
| 633 | 491 | } |
| 634 | 492 | |
| @@ -640,9 +498,9 @@ | ||
| 640 | 498 | * |
| 641 | 499 | * @since 2.03.04 |
| 642 | 500 | * |
| 643 | 501 | * @param string $value |
| 644 | - * @param array $user_id_args | |
| 502 | + * @param array $user_id_args | |
| 645 | 503 | * |
| 646 | 504 | * @return string |
| 647 | 505 | */ |
| 648 | 506 | private function prepare_email_setting( $value, $user_id_args ) { |
| @@ -672,9 +530,8 @@ | ||
| 672 | 530 | * @return array|string $emails |
| 673 | 531 | */ |
| 674 | 532 | private function explode_emails( $emails ) { |
| 675 | 533 | $emails = ( ! empty( $emails ) ? preg_split( '/(,|;)/', $emails ) : '' ); |
| 676 | - | |
| 677 | 534 | if ( is_array( $emails ) ) { |
| 678 | 535 | $emails = array_map( 'trim', $emails ); |
| 679 | 536 | } else { |
| 680 | 537 | $emails = trim( $emails ); |
| @@ -700,24 +557,24 @@ | ||
| 700 | 557 | |
| 701 | 558 | if ( is_email( $val ) ) { |
| 702 | 559 | // If a plain email is used, no formatting is needed |
| 703 | 560 | continue; |
| 704 | - } | |
| 561 | + } else { | |
| 562 | + $parts = explode( ' ', $val ); | |
| 563 | + $email = end( $parts ); | |
| 705 | 564 | |
| 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; | |
| 565 | + if ( is_email( $email ) ) { | |
| 566 | + // If user enters a name and email | |
| 567 | + $name = trim( str_replace( $email, '', $val ) ); | |
| 568 | + } else { | |
| 569 | + // If user enters a name without an email | |
| 570 | + unset( $recipients[ $key ] ); | |
| 571 | + continue; | |
| 572 | + } | |
| 716 | 573 | } |
| 717 | 574 | |
| 718 | 575 | $recipients[ $key ] = $this->format_from_email( $name, $email ); |
| 719 | - }//end foreach | |
| 576 | + } | |
| 720 | 577 | |
| 721 | 578 | return $recipients; |
| 722 | 579 | } |
| 723 | 580 | |
| @@ -743,9 +600,8 @@ | ||
| 743 | 600 | if ( strpos( $from_email, '@yahoo.com' ) ) { |
| 744 | 601 | |
| 745 | 602 | // Get the site domain and get rid of www. |
| 746 | 603 | $sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) ); |
| 747 | - | |
| 748 | 604 | if ( substr( $sitename, 0, 4 ) === 'www.' ) { |
| 749 | 605 | $sitename = substr( $sitename, 4 ); |
| 750 | 606 | } |
| 751 | 607 | |
| @@ -768,9 +624,9 @@ | ||
| 768 | 624 | $reply_to = trim( $reply_to ); |
| 769 | 625 | |
| 770 | 626 | if ( ! is_email( $reply_to ) ) { |
| 771 | 627 | list( $name, $email ) = $this->get_name_and_email_for_sender( $reply_to ); |
| 772 | - $reply_to = $this->format_from_email( $name, $email ); | |
| 628 | + $reply_to = $this->format_from_email( $name, $email ); | |
| 773 | 629 | } |
| 774 | 630 | |
| 775 | 631 | return $reply_to; |
| 776 | 632 | } |
| @@ -778,16 +634,11 @@ | ||
| 778 | 634 | /** |
| 779 | 635 | * Get only the email if the name and email have been combined |
| 780 | 636 | * |
| 781 | 637 | * @since 3.0.06 |
| 782 | - * | |
| 783 | - * @param string $name | |
| 784 | - * | |
| 785 | - * @return string | |
| 786 | 638 | */ |
| 787 | 639 | private function get_email_from_name( $name ) { |
| 788 | 640 | $email = trim( trim( $name, '>' ), '<' ); |
| 789 | - | |
| 790 | 641 | if ( strpos( $email, '<' ) !== false ) { |
| 791 | 642 | $parts = explode( '<', $email ); |
| 792 | 643 | $email = trim( $parts[1], '>' ); |
| 793 | 644 | } |
| @@ -820,13 +671,8 @@ | ||
| 820 | 671 | } |
| 821 | 672 | |
| 822 | 673 | /** |
| 823 | 674 | * @since 3.0.06 |
| 824 | - * | |
| 825 | - * @param string $name | |
| 826 | - * @param string $email | |
| 827 | - * | |
| 828 | - * @return string | |
| 829 | 675 | */ |
| 830 | 676 | private function format_from_email( $name, $email ) { |
| 831 | 677 | if ( '' !== $name ) { |
| 832 | 678 | $email = $name . ' <' . $email . '>'; |
| @@ -839,10 +685,8 @@ | ||
| 839 | 685 | * Remove phone numbers from To addresses |
| 840 | 686 | * Send the phone numbers to the frm_send_to_not_email hook |
| 841 | 687 | * |
| 842 | 688 | * @since 2.03.04 |
| 843 | - * | |
| 844 | - * @return void | |
| 845 | 689 | */ |
| 846 | 690 | private function handle_phone_numbers() { |
| 847 | 691 | |
| 848 | 692 | foreach ( $this->to as $key => $recipient ) { |
| @@ -869,10 +713,10 @@ | ||
| 869 | 713 | ); |
| 870 | 714 | |
| 871 | 715 | // Remove phone number from to addresses |
| 872 | 716 | unset( $this->to[ $key ] ); |
| 873 | - }//end if | |
| 874 | - }//end foreach | |
| 717 | + } | |
| 718 | + } | |
| 875 | 719 | } |
| 876 | 720 | |
| 877 | 721 | /** |
| 878 | 722 | * Package an array of FrmEmail properties |
| @@ -891,12 +735,10 @@ | ||
| 891 | 735 | 'subject' => $this->subject, |
| 892 | 736 | 'message' => $this->message, |
| 893 | 737 | 'attachments' => $this->attachments, |
| 894 | 738 | 'plain_text' => $this->is_plain_text, |
| 895 | - 'email_key' => $this->email_key, | |
| 896 | 739 | 'form' => $this->form, |
| 897 | 740 | 'entry' => $this->entry, |
| 898 | - 'email_style' => $this->settings['email_style'], | |
| 899 | 741 | ); |
| 900 | 742 | } |
| 901 | 743 | |
| 902 | 744 | /** |
| @@ -902,10 +744,8 @@ | ||
| 902 | 744 | /** |
| 903 | 745 | * Remove the Buddypress email filters |
| 904 | 746 | * |
| 905 | 747 | * @since 2.03.04 |
| 906 | - * | |
| 907 | - * @return void | |
| 908 | 748 | */ |
| 909 | 749 | private function remove_buddypress_filters() { |
| 910 | 750 | remove_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' ); |
| 911 | 751 | remove_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' ); |
| @@ -915,10 +755,8 @@ | ||
| 915 | 755 | * Add Mandrill line break filter |
| 916 | 756 | * Remove line breaks in HTML emails to prevent conflicts with Mandrill |
| 917 | 757 | * |
| 918 | 758 | * @since 2.03.04 |
| 919 | - * | |
| 920 | - * @return void | |
| 921 | 759 | */ |
| 922 | 760 | private function add_mandrill_filter() { |
| 923 | 761 | if ( ! $this->is_plain_text ) { |
| 924 | 762 | add_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' ); |
| @@ -928,10 +766,8 @@ | ||
| 928 | 766 | /** |
| 929 | 767 | * Remove Mandrill line break filter |
| 930 | 768 | * |
| 931 | 769 | * @since 2.03.04 |
| 932 | - * | |
| 933 | - * @return void | |
| 934 | 770 | */ |
| 935 | 771 | private function remove_mandrill_filter() { |
| 936 | 772 | remove_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' ); |
| 937 | 773 | } |