if( ! empty( $custom_autoresponder ) ) { $message = '
' . wp_kses_post( balanceTags( $custom_autoresponder, true ) ) . '
'; } else { $mess = nl2br( $this->form_params['autoresponder'] ); $mess .= '


' . __( 'Your Message:','avia_framework' ) . '

'; $mess .= $message; if( ! empty( $this->form_params['autoresponder_after'] ) ) { $mess .= '
'; $mess .= nl2br( $this->form_params['autoresponder_after'] ) . '

'; } $message = apply_filters_deprecated( 'avf_form_autorespondermessage', array( $mess ), '4.6.4', 'avf_contact_form_autoresponder_mail', __( 'Allows stack modifications', 'avia_framework' ) ); } $mail_array['Message'] = $message; /** * Allows bulk changing of mail content * * @since 4.6.4 * @param array $header_array * @param array $new_post * @param array $this->form_params * @param avia_form $this * @return array */ $mail_array = apply_filters( 'avf_contact_form_autoresponder_mail', $mail_array, $new_post, $this->form_params, $this ); /** * Add keys to remove from $mail_array when forming the header string * * @since 4.6.4 * @param array * @param string $context * @return array */ $skip_mail_array_keys = apply_filters( 'avf_skip_mail_header_keys', array( 'To', 'Subject', 'Message' ), 'autoresponder_mail' ); $header = ''; foreach( $mail_array as $header_key => $header_value ) { if( in_array( $header_key, $skip_mail_array_keys ) ) { continue; } $header .= $header_key . ': ' . $header_value . " \r\n"; } if( $use_wpmail ) { wp_mail( $mail_array['To'], $mail_array['Subject'], $mail_array['Message'], $header ); } else { mail( $mail_array['To'], $mail_array['Subject'], $mail_array['Message'], $header ); } } unset( $_POST ); return true; //return wp_mail( $to, $subject, $message , $header); } /** * Check the value of an element * The check_element method creates checks if the submitted value of a post element is valid * * @param string $id holds the key of the element * @param array $element data array of the element that should be created * @return string 'valid' | 'error' */ protected function check_element( $id, array $element ) { if( isset( $_POST ) && count( $_POST ) && isset( $_POST[ $id ] ) && $this->do_checks ) { switch( $element['check'] ) { case 'is_empty': if( ! empty( $_POST[ $id ] ) || $_POST[ $id ] === '0' ) { return 'valid'; } break; case 'must_empty': if( isset( $_POST[ $id ] ) && $_POST[ $id ] == '') { return 'valid'; } break; case 'is_email': $this->autoresponder[] = $id; if( preg_match( "!^[\w|\.|\-]+@\w[\w|\.|\-]*\.[a-zA-Z]{2,20}$!", urldecode( $_POST[ $id ] ) ) ) { return 'valid'; } break; case 'is_ext_email': $this->autoresponder[] = $id; if( preg_match( "!^[\w\.\-ÄÖÜäöü]+@\w[\w\.\-ÄÖÜäöü]*\.[a-zA-Z]{2,20}$!", urldecode( $_POST[ $id ] ) ) ) { return 'valid'; } break; case 'is_special_email': $this->autoresponder[] = $id; /** * see https://de.wikipedia.org/wiki/E-Mail-Adresse#Der_Lokalteil_(Local_Part) */ if( preg_match( "/^[a-zA-Z0-9.!#$%&'*+\-\/=?^_`{|}~ÄÖÜäöü]+@\w[\w\.\-ÄÖÜäöü]*\.[a-zA-Z]{2,20}$/", urldecode( $_POST[ $id ] ) ) ) { return 'valid'; } break; case 'is_number': if( preg_match("!^-?\s*(0|[1-9]\d*)([\.,]\d+)?$!", urldecode( $_POST[ $id ] ) ) ) { return 'valid'; } break; case 'is_positiv_number': if( preg_match( "!^[0-9]\d*([\.|\,]\d+)?$!", urldecode( $_POST[ $id ] ) ) ) { return 'valid'; } break; case 'is_phone': if( preg_match( "!^(\d|\s|\-|\/|\(|\)|\[|\]|e|x|t|ension|\.|\+|\_|\,|\:|\;){3,}$!", urldecode( $_POST[ $id ] ) ) ) { return 'valid'; } break; case 'is_url': if( preg_match( "!^(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$!", urldecode( $_POST[ $id ] ) ) ) { return 'valid'; } break; case 'captcha': $ver = $_POST[ $id . '_verifier' ]; $reverse = strrev( $ver ); if( $ver[ $reverse[0] ] == $_POST[ $id ] ) { unset( $_POST[ $id ], $_POST[ $id . '_verifier'] ); return 'valid'; } break; } //end switch $this->submit_form = false; $this->validation_error = true; return 'error'; } } } }