e( "\n", $content ); foreach ( $headers as $header ) { $header = trim( $header ); if ( '' === $header ) { continue; } if ( ! preg_match( '/^([0-9A-Za-z-]+):(.+)$/', $header, $matches ) ) { return false; } $is_mailbox_list_field = in_array( strtolower( $matches[1] ), array( 'reply-to', 'cc', 'bcc' ) ); if ( $is_mailbox_list_field && ! wpcf7_is_mailbox_list( $matches[2] ) ) { return false; } } return true; } public function validate_messages() { $messages = (array) $this->contact_form->prop( 'messages' ); if ( ! $messages ) { return; } if ( isset( $messages['captcha_not_match'] ) && ! wpcf7_use_really_simple_captcha() ) { unset( $messages['captcha_not_match'] ); } foreach ( $messages as $key => $message ) { $stripped = wp_strip_all_tags( $message ); if ( $stripped != $message ) { $this->add_error( sprintf( 'messages.%s', $key ), self::error_html_in_message ); } } } public function replace_mail_tags_with_minimum_input( $matches ) { // allow [[foo]] syntax for escaping a tag if ( $matches[1] == '[' && $matches[4] == ']' ) { return substr( $matches[0], 1, -1 ); } $tag = $matches[0]; $tagname = $matches[2]; $values = $matches[3]; if ( ! empty( $values ) ) { preg_match_all( '/"[^"]*"|\'[^\']*\'/', $values, $matches ); $values = wpcf7_strip_quote_deep( $matches[0] ); } $do_not_heat = false; if ( preg_match( '/^_raw_(.+)$/', $tagname, $matches ) ) { $tagname = trim( $matches[1] ); $do_not_heat = true; } $format = ''; if ( preg_match( '/^_format_(.+)$/', $tagname, $matches ) ) { $tagname = trim( $matches[1] ); $format = $values[0]; } $example_email = 'example@example.com'; $example_text = 'example'; $example_blank = ''; $form_tags = $this->contact_form->form_scan_shortcode( array( 'name' => $tagname ) ); if ( $form_tags ) { $form_tag = new WPCF7_Shortcode( $form_tags[0] ); $is_required = ( $form_tag->is_required() || 'radio' == $form_tag->type ); if ( ! $is_required ) { return $example_blank; } $is_selectable = in_array( $form_tag->basetype, array( 'radio', 'checkbox', 'select' ) ); if ( $is_selectable ) { if ( $form_tag->pipes instanceof WPCF7_Pipes ) { if ( $do_not_heat ) { $before_pipes = $form_tag->pipes->collect_befores(); $last_item = array_pop( $before_pipes ); } else { $after_pipes = $form_tag->pipes->collect_afters(); $last_item = array_pop( $after_pipes ); } } else { $last_item = array_pop( $form_tag->values ); } if ( $last_item && wpcf7_is_mailbox_list( $last_item ) ) { return $example_email; } else { return $example_text; } } if ( 'email' == $form_tag->basetype ) { return $example_email; } else { return $example_text; } } else { $tagname = preg_replace( '/^wpcf7\./', '_', $tagname ); // for back-compat if ( '_post_author_email' == $tagname ) { return $example_email; } elseif ( '_' == substr( $tagname, 0, 1 ) ) { // maybe special mail tag return $example_text; } } return $tag; } }