ID, '_kad_contact_map', true ); $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true ); $contactformtitle = get_post_meta( $post->ID, '_kad_contact_form_title', true ); $form = get_post_meta( $post->ID, '_kad_contact_form', true ); if ($form == 'yes') { ?> ID, '_kad_contact_address', true ); $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true ); $height = get_post_meta( $post->ID, '_kad_contact_mapheight', true ); $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true ); if(isset($virtue['google_map_api']) && !empty($virtue['google_map_api'])) { $gmap_api = $virtue['google_map_api']; } else { $gmap_api = 'AIzaSyBt7JOCM4XQTEi9jzdqB8alFc1Vm_3mbfQ'; } if(!empty($height)) { $mapheight = $height; } else { $mapheight = 300; } if(!empty($mapzoom)) { $zoom = $mapzoom; } else { $zoom = 15; } ?> #map_address {height:'.esc_attr($mapheight).'px; margin-bottom:20px;}'; } if(isset($_POST['submitted'])) { if(isset($form_math) && $form_math == 'yes') { $math_answer = trim($_POST['kad_captcha']); if(md5($math_answer) != $_POST['hval']) { $kad_captchaError = __('Check your math.', 'virtue-toolkit'); $hasError = true; } } if(trim($_POST['contactName']) === '') { $nameError = __('Please enter your name.', 'virtue-toolkit'); $hasError = true; } else { $name = trim($_POST['contactName']); } if(trim($_POST['email']) === '') { $emailError = __('Please enter your email address.', 'virtue-toolkit'); $hasError = true; } else if (!is_email($_POST['email'])) { $emailError = __('You entered an invalid email address.', 'virtue-toolkit'); $hasError = true; } else { $email = trim($_POST['email']); } if(trim($_POST['comments']) === '') { $commentError = __('Please enter a message.', 'virtue-toolkit'); $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['comments'])); } else { $comments = trim($_POST['comments']); } } if(!isset($hasError)) { $name = wp_filter_kses( $name ); $email = wp_filter_kses( $email ); $comments = wp_filter_kses( $comments ); if (isset($virtue['contact_email'])) { $emailTo = $virtue['contact_email']; } else { $emailTo = get_option('admin_email'); } $sitename = get_bloginfo('name'); $subject = '['.esc_html($sitename) . ' ' . __("Contact", "kadencetoolkit").'] '. __("From", "kadencetoolkit") . ' ' . esc_html($name); $body = __('Name', 'virtue-toolkit').": $name \n\n"; $body .= __('Email', 'virtue-toolkit').": $email \n\n"; $body .= __('Comments', 'virtue-toolkit').":\n $comments"; $headers = 'Reply-To: ' . esc_html($name) . '<' . $email . '>' . "\r\n"; wp_mail($emailTo, $subject, $body, $headers); $emailSent = true; } } ?>