| @@ -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 ); |
| @@ -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 | } |
| @@ -236,9 +228,8 @@ | ||
| 236 | 228 | * |
| 237 | 229 | * @since 2.03.04 |
| 238 | 230 | * |
| 239 | 231 | * @param array $user_id_args |
| 240 | - * @return void | |
| 241 | 232 | */ |
| 242 | 233 | private function set_from( $user_id_args ) { |
| 243 | 234 | if ( empty( $this->settings['from'] ) ) { |
| 244 | 235 | $from = get_option( 'admin_email' ); |
| @@ -254,10 +245,8 @@ | ||
| 254 | 245 | * |
| 255 | 246 | * @since 2.03.04 |
| 256 | 247 | * |
| 257 | 248 | * @param array $user_id_args |
| 258 | - * | |
| 259 | - * @return void | |
| 260 | 249 | */ |
| 261 | 250 | private function set_reply_to( $user_id_args ) { |
| 262 | 251 | $this->reply_to = trim( $this->settings['reply_to'] ); |
| 263 | 252 | |
| @@ -276,10 +265,8 @@ | ||
| 276 | 265 | * Set the is_plain_text property |
| 277 | 266 | * This should be set before the message |
| 278 | 267 | * |
| 279 | 268 | * @since 2.03.04 |
| 280 | - * | |
| 281 | - * @return void | |
| 282 | 269 | */ |
| 283 | 270 | private function set_is_plain_text() { |
| 284 | 271 | if ( $this->settings['plain_text'] ) { |
| 285 | 272 | $this->is_plain_text = true; |
| @@ -290,10 +277,8 @@ | ||
| 290 | 277 | * Set the include_user_info property |
| 291 | 278 | * This should be set before the message |
| 292 | 279 | * |
| 293 | 280 | * @since 2.03.04 |
| 294 | - * | |
| 295 | - * @return void | |
| 296 | 281 | */ |
| 297 | 282 | private function set_include_user_info() { |
| 298 | 283 | if ( isset( $this->settings['inc_user_info'] ) ) { |
| 299 | 284 | $this->include_user_info = $this->settings['inc_user_info']; |
| @@ -305,11 +290,8 @@ | ||
| 305 | 290 | * |
| 306 | 291 | * @since 2.03.04 |
| 307 | 292 | * |
| 308 | 293 | * @param $action |
| 309 | - * @param object $action | |
| 310 | - * | |
| 311 | - * @return void | |
| 312 | 294 | */ |
| 313 | 295 | private function set_is_single_recipient( $action ) { |
| 314 | 296 | $args = array( |
| 315 | 297 | 'form' => $this->form, |
| @@ -328,10 +310,8 @@ | ||
| 328 | 310 | /** |
| 329 | 311 | * Set the charset |
| 330 | 312 | * |
| 331 | 313 | * @since 2.03.04 |
| 332 | - * | |
| 333 | - * @return void | |
| 334 | 314 | */ |
| 335 | 315 | private function set_charset() { |
| 336 | 316 | $this->charset = get_option( 'blog_charset' ); |
| 337 | 317 | } |
| @@ -339,10 +319,8 @@ | ||
| 339 | 319 | /** |
| 340 | 320 | * Set the content type |
| 341 | 321 | * |
| 342 | 322 | * @since 2.03.04 |
| 343 | - * | |
| 344 | - * @return void | |
| 345 | 323 | */ |
| 346 | 324 | private function set_content_type() { |
| 347 | 325 | if ( $this->is_plain_text ) { |
| 348 | 326 | $this->content_type = 'text/plain'; |
| @@ -352,10 +330,8 @@ | ||
| 352 | 330 | /** |
| 353 | 331 | * Set the subject |
| 354 | 332 | * |
| 355 | 333 | * @since 2.03.04 |
| 356 | - * | |
| 357 | - * @return void | |
| 358 | 334 | */ |
| 359 | 335 | private function set_subject() { |
| 360 | 336 | if ( empty( $this->settings['email_subject'] ) ) { |
| 361 | 337 | /* translators: %1$s: Form name, %2$s: Site name */ |
| @@ -363,9 +339,8 @@ | ||
| 363 | 339 | } else { |
| 364 | 340 | $this->subject = $this->settings['email_subject']; |
| 365 | 341 | } |
| 366 | 342 | |
| 367 | - // This also replaces [sitename] shortcode in default. | |
| 368 | 343 | $this->subject = FrmFieldsHelper::basic_replace_shortcodes( $this->subject, $this->form, $this->entry ); |
| 369 | 344 | |
| 370 | 345 | $args = array( |
| 371 | 346 | 'form' => $this->form, |
| @@ -372,8 +347,9 @@ | ||
| 372 | 347 | 'entry' => $this->entry, |
| 373 | 348 | 'email_key' => $this->email_key, |
| 374 | 349 | ); |
| 375 | 350 | $this->subject = apply_filters( 'frm_email_subject', $this->subject, $args ); |
| 351 | + | |
| 376 | 352 | $this->subject = wp_specialchars_decode( strip_tags( stripslashes( $this->subject ) ), ENT_QUOTES ); |
| 377 | 353 | } |
| 378 | 354 | |
| 379 | 355 | /** |
| @@ -379,20 +355,12 @@ | ||
| 379 | 355 | /** |
| 380 | 356 | * Set the email message |
| 381 | 357 | * |
| 382 | 358 | * @since 2.03.04 |
| 383 | - * | |
| 384 | - * @return void | |
| 385 | 359 | */ |
| 386 | 360 | private function set_message() { |
| 387 | - $this->message = $this->settings['email_message']; | |
| 361 | + $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->settings['email_message'], $this->form, $this->entry ); | |
| 388 | 362 | |
| 389 | - if ( ! $this->is_plain_text ) { | |
| 390 | - $this->message = html_entity_decode( $this->message ); // The decode is to support [default-html] shortcodes. | |
| 391 | - } | |
| 392 | - | |
| 393 | - $this->message = FrmFieldsHelper::basic_replace_shortcodes( $this->message, $this->form, $this->entry ); | |
| 394 | - | |
| 395 | 363 | $prev_mail_body = $this->message; |
| 396 | 364 | $pass_entry = clone $this->entry; // make a copy to prevent changes by reference |
| 397 | 365 | $mail_body = FrmEntriesHelper::replace_default_message( |
| 398 | 366 | $prev_mail_body, |
| @@ -418,35 +386,13 @@ | ||
| 418 | 386 | $this->message = do_shortcode( $this->message ); |
| 419 | 387 | |
| 420 | 388 | if ( $this->is_plain_text ) { |
| 421 | 389 | $this->message = wp_specialchars_decode( strip_tags( $this->message ), ENT_QUOTES ); |
| 422 | - } else { | |
| 423 | - $this->add_autop(); | |
| 424 | 390 | } |
| 425 | 391 | |
| 426 | 392 | $this->message = apply_filters( 'frm_email_message', $this->message, $this->package_atts() ); |
| 427 | 393 | } |
| 428 | 394 | |
| 429 | - /** | |
| 430 | - * Runs message through autop, extracting the content inside body tag if it has <body>. | |
| 431 | - * | |
| 432 | - * @return void | |
| 433 | - */ | |
| 434 | - private function add_autop() { | |
| 435 | - $message = $this->message; | |
| 436 | - $result = preg_match( '/<body[^>]*>([\s\S]*?)<\/body>/', $message, $match ); | |
| 437 | - if ( ! empty( $match[1] ) ) { | |
| 438 | - $this->message = str_replace( $match[1], trim( wpautop( $match[1] ) ), $message ); | |
| 439 | - } else { | |
| 440 | - $this->message = trim( wpautop( $message ) ); | |
| 441 | - } | |
| 442 | - } | |
| 443 | - | |
| 444 | - /** | |
| 445 | - * @param string $mail_body | |
| 446 | - * | |
| 447 | - * @return void | |
| 448 | - */ | |
| 449 | 395 | private function maybe_add_ip( &$mail_body ) { |
| 450 | 396 | if ( ! empty( $this->entry->ip ) ) { |
| 451 | 397 | $mail_body .= __( 'IP Address', 'formidable' ) . ': ' . $this->entry->ip . "\r\n"; |
| 452 | 398 | } |
| @@ -767,12 +713,8 @@ | ||
| 767 | 713 | /** |
| 768 | 714 | * Get only the email if the name and email have been combined |
| 769 | 715 | * |
| 770 | 716 | * @since 3.0.06 |
| 771 | - * | |
| 772 | - * @param string $name | |
| 773 | - * | |
| 774 | - * @return string | |
| 775 | 717 | */ |
| 776 | 718 | private function get_email_from_name( $name ) { |
| 777 | 719 | $email = trim( trim( $name, '>' ), '<' ); |
| 778 | 720 | if ( strpos( $email, '<' ) !== false ) { |
| @@ -808,11 +750,8 @@ | ||
| 808 | 750 | } |
| 809 | 751 | |
| 810 | 752 | /** |
| 811 | 753 | * @since 3.0.06 |
| 812 | - * | |
| 813 | - * @param string $name | |
| 814 | - * @param string $email | |
| 815 | 754 | */ |
| 816 | 755 | private function format_from_email( $name, $email ) { |
| 817 | 756 | if ( '' !== $name ) { |
| 818 | 757 | $email = $name . ' <' . $email . '>'; |
| @@ -825,10 +764,8 @@ | ||
| 825 | 764 | * Remove phone numbers from To addresses |
| 826 | 765 | * Send the phone numbers to the frm_send_to_not_email hook |
| 827 | 766 | * |
| 828 | 767 | * @since 2.03.04 |
| 829 | - * | |
| 830 | - * @return void | |
| 831 | 768 | */ |
| 832 | 769 | private function handle_phone_numbers() { |
| 833 | 770 | |
| 834 | 771 | foreach ( $this->to as $key => $recipient ) { |
| @@ -886,10 +823,8 @@ | ||
| 886 | 823 | /** |
| 887 | 824 | * Remove the Buddypress email filters |
| 888 | 825 | * |
| 889 | 826 | * @since 2.03.04 |
| 890 | - * | |
| 891 | - * @return void | |
| 892 | 827 | */ |
| 893 | 828 | private function remove_buddypress_filters() { |
| 894 | 829 | remove_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' ); |
| 895 | 830 | remove_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' ); |
| @@ -899,10 +834,8 @@ | ||
| 899 | 834 | * Add Mandrill line break filter |
| 900 | 835 | * Remove line breaks in HTML emails to prevent conflicts with Mandrill |
| 901 | 836 | * |
| 902 | 837 | * @since 2.03.04 |
| 903 | - * | |
| 904 | - * @return void | |
| 905 | 838 | */ |
| 906 | 839 | private function add_mandrill_filter() { |
| 907 | 840 | if ( ! $this->is_plain_text ) { |
| 908 | 841 | add_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' ); |
| @@ -912,10 +845,8 @@ | ||
| 912 | 845 | /** |
| 913 | 846 | * Remove Mandrill line break filter |
| 914 | 847 | * |
| 915 | 848 | * @since 2.03.04 |
| 916 | - * | |
| 917 | - * @return void | |
| 918 | 849 | */ |
| 919 | 850 | private function remove_mandrill_filter() { |
| 920 | 851 | remove_filter( 'mandrill_nl2br', 'FrmEmailHelper::remove_mandrill_br' ); |
| 921 | 852 | } |