| @@ -1,231 +1,271 @@ | ||
| 1 | 1 | <?php |
| 2 | -/* | |
| 3 | -Template Name: Contact | |
| 4 | -*/ | |
| 5 | -?> | |
| 6 | - <?php global $virtue, $post; | |
| 7 | - $map = get_post_meta( $post->ID, '_kad_contact_map', true ); | |
| 8 | - $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true ); | |
| 9 | - $contactformtitle = get_post_meta( $post->ID, '_kad_contact_form_title', true ); | |
| 10 | - $form = get_post_meta( $post->ID, '_kad_contact_form', true ); | |
| 11 | - if ($form == 'yes') { ?> | |
| 12 | - <script type="text/javascript">jQuery(document).ready(function ($) {$.extend($.validator.messages, { | |
| 13 | - required: "<?php echo __('This field is required.', 'kadencetoolkit'); ?>", | |
| 14 | - email: "<?php echo __('Please enter a valid email address.', 'kadencetoolkit'); ?>", | |
| 15 | - }); | |
| 16 | - $("#contactForm").validate(); | |
| 17 | - });</script> | |
| 18 | - <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/assets/js/jquery.validate.js"></script> | |
| 19 | - <?php } | |
| 20 | - if ($map == 'yes') { ?> | |
| 21 | - <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script> | |
| 22 | - <?php $address = get_post_meta( $post->ID, '_kad_contact_address', true ); | |
| 23 | - $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true ); | |
| 24 | - $height = get_post_meta( $post->ID, '_kad_contact_mapheight', true ); | |
| 25 | - $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true ); | |
| 26 | - | |
| 27 | - if(!empty($height)) { | |
| 28 | - $mapheight = $height; | |
| 29 | - } else { | |
| 30 | - $mapheight = 300; | |
| 31 | - } | |
| 32 | - if(!empty($mapzoom)) { | |
| 33 | - $zoom = $mapzoom; | |
| 34 | - } else { | |
| 35 | - $zoom = 15; | |
| 36 | - } ?> | |
| 37 | - <script type="text/javascript"> | |
| 38 | - jQuery(window).load(function() { | |
| 39 | - jQuery('#map_address').gmap3({ | |
| 40 | - map: { | |
| 41 | - address:"<?php echo $address;?>", | |
| 42 | - options: { | |
| 43 | - zoom:<?php echo $zoom;?>, | |
| 44 | - draggable: true, | |
| 45 | - mapTypeControl: true, | |
| 46 | - mapTypeId: google.maps.MapTypeId.<?php echo esc_attr($maptype);?>, | |
| 47 | - scrollwheel: false, | |
| 48 | - panControl: true, | |
| 49 | - rotateControl: false, | |
| 50 | - scaleControl: true, | |
| 51 | - streetViewControl: true, | |
| 52 | - zoomControl: true | |
| 53 | - } | |
| 54 | - }, | |
| 55 | - marker:{ | |
| 56 | - values:[ | |
| 57 | - {address: "<?php echo $address;?>", | |
| 58 | - data:"<div class='mapinfo'>'<?php echo $address;?>'</div>", | |
| 59 | - }, | |
| 60 | - ], | |
| 61 | - options:{ | |
| 62 | - draggable: false, | |
| 63 | - }, | |
| 64 | - events:{ | |
| 65 | - click: function(marker, event, context){ | |
| 66 | - var map = jQuery(this).gmap3("get"), | |
| 67 | - infowindow = jQuery(this).gmap3({get:{name:"infowindow"}}); | |
| 68 | - if (infowindow){ | |
| 69 | - infowindow.open(map, marker); | |
| 70 | - infowindow.setContent(context.data); | |
| 71 | - } else { | |
| 72 | - jQuery(this).gmap3({ | |
| 73 | - infowindow:{ | |
| 74 | - anchor:marker, | |
| 75 | - options:{content: context.data} | |
| 76 | - } | |
| 77 | - }); | |
| 78 | - } | |
| 79 | - }, | |
| 80 | - closeclick: function(){ | |
| 81 | - var infowindow = jQuery(this).gmap3({get:{name:"infowindow"}}); | |
| 82 | - if (infowindow){ | |
| 83 | - infowindow.close(); | |
| 84 | - } | |
| 85 | - } | |
| 86 | - } | |
| 87 | - } | |
| 88 | - }); | |
| 89 | - }); | |
| 90 | - </script> | |
| 91 | - <?php echo '<style type="text/css" media="screen">#map_address {height:'.esc_attr($mapheight).'px; margin-bottom:20px;}</style>'; | |
| 92 | - } | |
| 2 | +/** | |
| 3 | + * Template Name: Contact | |
| 4 | + * | |
| 5 | + * @package Kadence Toolkit | |
| 6 | + */ | |
| 93 | 7 | |
| 94 | - if(isset($_POST['submitted'])) { | |
| 95 | - if(isset($form_math) && $form_math == 'yes') { | |
| 96 | - if(md5($_POST['kad_captcha']) != $_POST['hval']) { | |
| 97 | - $kad_captchaError = __('Check your math.', 'kadencetoolkit'); | |
| 98 | - $hasError = true; | |
| 8 | +global $virtue, $post; | |
| 9 | +$page_map = get_post_meta( $post->ID, '_kad_contact_map', true ); | |
| 10 | +$form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true ); | |
| 11 | +$contactformtitle = get_post_meta( $post->ID, '_kad_contact_form_title', true ); | |
| 12 | +$form = get_post_meta( $post->ID, '_kad_contact_form', true ); | |
| 13 | +$consent = apply_filters( 'kadence-virtue-contact-consent', false ); | |
| 14 | + | |
| 15 | +if ( isset( $_POST['submitted'] ) && isset( $_POST['virtue_contact_nounce'] ) ) { | |
| 16 | + if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['virtue_contact_nounce'] ) ), 'virtue_contact_nounce_action' ) ) { | |
| 17 | + $spam_hook = apply_filters( 'kadence-contact-spam-check', true, $_POST ); | |
| 18 | + | |
| 19 | + if ( ! $spam_hook ) { | |
| 20 | + $has_error = true; | |
| 21 | + $spam_error = __( 'Your post appears to be spam, if this is incorrect please contact the site admnistator.', 'virtue-toolkit' ); | |
| 22 | + } | |
| 23 | + if ( isset( $form_math ) && 'yes' === $form_math ) { | |
| 24 | + if ( isset( $_POST['kad_captcha'] ) && isset( $_POST['hval'] ) ) { | |
| 25 | + $math_answer = trim( sanitize_text_field( wp_unslash( $_POST['kad_captcha'] ) ) ); | |
| 26 | + if ( md5( $math_answer ) != sanitize_text_field( wp_unslash( $_POST['hval'] ) ) ) { | |
| 27 | + $kad_captcha_error = __( 'Check your math.', 'virtue-toolkit' ); | |
| 28 | + $has_error = true; | |
| 29 | + } | |
| 30 | + } else { | |
| 31 | + $kad_captcha_error = __( 'Check your math.', 'virtue-toolkit' ); | |
| 32 | + $has_error = true; | |
| 99 | 33 | } |
| 100 | 34 | } |
| 101 | - if(trim($_POST['contactName']) === '') { | |
| 102 | - $nameError = __('Please enter your name.', 'kadencetoolkit'); | |
| 103 | - $hasError = true; | |
| 35 | + if ( isset( $consent ) && 'true' == $consent ) { | |
| 36 | + if ( isset( $_POST['gdpr-consent'] ) ) { | |
| 37 | + $gdpr_consent = sanitize_text_field( wp_unslash( $_POST['gdpr-consent'] ) ); | |
| 38 | + if ( 'on' != $gdpr_consent ) { | |
| 39 | + $kad_consent_error = __( 'Please check the box.', 'virtue-toolkit' ); | |
| 40 | + $has_error = true; | |
| 41 | + } | |
| 42 | + } else { | |
| 43 | + $kad_consent_error = __( 'Please check the box.', 'virtue-toolkit' ); | |
| 44 | + $has_error = true; | |
| 45 | + } | |
| 46 | + } | |
| 47 | + if ( isset( $_POST['contactName'] ) && ! empty( $_POST['contactName'] ) ) { | |
| 48 | + $name = trim( sanitize_text_field( wp_unslash( $_POST['contactName'] ) ) ); | |
| 49 | + } else { | |
| 50 | + $name_error = __( 'Please enter your name.', 'virtue-toolkit' ); | |
| 51 | + $has_error = true; | |
| 52 | + } | |
| 53 | + if ( ! isset( $_POST['email'] ) || empty( $_POST['email'] ) ) { | |
| 54 | + $email_error = __( 'Please enter your email address.', 'virtue-toolkit' ); | |
| 55 | + $has_error = true; | |
| 56 | + } elseif ( ! is_email( trim( sanitize_text_field( wp_unslash( $_POST['email'] ) ) ) ) ) { | |
| 57 | + $email_error = __( 'You entered an invalid email address.', 'virtue-toolkit' ); | |
| 58 | + $has_error = true; | |
| 59 | + } else { | |
| 60 | + $email = trim( sanitize_text_field( wp_unslash( $_POST['email'] ) ) ); | |
| 61 | + } | |
| 62 | + | |
| 63 | + if ( ! isset( $_POST['comments'] ) || empty( $_POST['comments'] ) ) { | |
| 64 | + $comment_error = __( 'Please enter a message.', 'virtue-toolkit' ); | |
| 65 | + $has_error = true; | |
| 66 | + } else { | |
| 67 | + $contact_comments = wp_kses_post( wp_unslash( $_POST['comments'] ) ); | |
| 68 | + } | |
| 69 | + | |
| 70 | + if ( ! isset( $has_error ) ) { | |
| 71 | + | |
| 72 | + if ( isset( $virtue['contact_email'] ) ) { | |
| 73 | + $email_to = $virtue['contact_email']; | |
| 74 | + } else { | |
| 75 | + $email_to = get_option( 'admin_email' ); | |
| 76 | + } | |
| 77 | + $sitename = get_bloginfo( 'name' ); | |
| 78 | + $subject = '[' . $sitename . ' ' . __( 'Contact', 'virtue-toolkit' ) . '] ' . __( 'From ', 'virtue-toolkit' ) . $name; | |
| 79 | + $body = __( 'Name', 'virtue-toolkit' ) . ':' . $name . "\n\n" . 'Email:' . $email . "\n\n" . 'Comments:' . $contact_comments; | |
| 80 | + $headers = 'Content-Type: text/plain; charset=UTF-8' . "\r\n"; | |
| 81 | + $headers .= 'Content-Transfer-Encoding: 8bit' . "\r\n"; | |
| 82 | + $headers .= 'From: ' . $name . ' <' . $email . '>' . "\r\n"; | |
| 83 | + $headers .= 'Reply-To: <' . $email . '>' . "\r\n"; | |
| 84 | + | |
| 85 | + wp_mail( $email_to, $subject, $body, $headers ); | |
| 86 | + $email_sent = true; | |
| 87 | + } | |
| 88 | + } | |
| 89 | +} | |
| 90 | + | |
| 91 | +/** | |
| 92 | + * @hooked virtue_page_title - 20 | |
| 93 | + */ | |
| 94 | +do_action( 'virtue_page_title_container' ); | |
| 95 | + | |
| 96 | +if ( 'yes' == $page_map ) { | |
| 97 | + $address = get_post_meta( $post->ID, '_kad_contact_address', true ); | |
| 98 | + $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true ); | |
| 99 | + $height = get_post_meta( $post->ID, '_kad_contact_mapheight', true ); | |
| 100 | + $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true ); | |
| 101 | + if ( isset( $virtue['google_map_api'] ) && ! empty( $virtue['google_map_api'] ) ) { | |
| 102 | + $gmap_api = $virtue['google_map_api']; | |
| 104 | 103 | } else { |
| 105 | - $name = trim($_POST['contactName']); | |
| 104 | + $gmap_api = ''; | |
| 106 | 105 | } |
| 107 | - | |
| 108 | - if(trim($_POST['email']) === '') { | |
| 109 | - $emailError = __('Please enter your email address.', 'kadencetoolkit'); | |
| 110 | - $hasError = true; | |
| 111 | - } else if (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['email']))) { | |
| 112 | - $emailError = __('You entered an invalid email address.', 'kadencetoolkit'); | |
| 113 | - $hasError = true; | |
| 106 | + if ( ! empty( $height ) ) { | |
| 107 | + $mapheight = $height; | |
| 114 | 108 | } else { |
| 115 | - $email = trim($_POST['email']); | |
| 109 | + $mapheight = 300; | |
| 116 | 110 | } |
| 117 | - | |
| 118 | - if(trim($_POST['comments']) === '') { | |
| 119 | - $commentError = __('Please enter a message.', 'kadencetoolkit'); | |
| 120 | - $hasError = true; | |
| 111 | + if ( ! empty( $mapzoom ) ) { | |
| 112 | + $zoom = $mapzoom; | |
| 121 | 113 | } else { |
| 122 | - if(function_exists('stripslashes')) { | |
| 123 | - $comments = stripslashes(trim($_POST['comments'])); | |
| 124 | - } else { | |
| 125 | - $comments = trim($_POST['comments']); | |
| 114 | + $zoom = 15; | |
| 115 | + } | |
| 116 | + if ( ! empty( $gmap_api ) ) { | |
| 117 | + if ( wp_script_is( 'virtue_gmap', 'registered' ) ) { | |
| 118 | + wp_enqueue_script( 'virtue_gmap' ); | |
| 126 | 119 | } |
| 127 | - } | |
| 128 | - | |
| 129 | - if(!isset($hasError)) { | |
| 130 | - if (isset($virtue['contact_email'])) { | |
| 131 | - $emailTo = $virtue['contact_email']; | |
| 120 | + ?> | |
| 121 | + <div id="mapheader" class="titleclass"> | |
| 122 | + <div class="container"> | |
| 123 | + <div id="map_address" style="height:<?php echo esc_attr( $mapheight ); ?>px; margin-bottom:20px;" class="kt-gmap-js-init" data-maptype="<?php echo esc_attr( $maptype ); ?>" data-mapzoom="<?php echo esc_attr( $zoom ); ?>" data-mapcenter="<?php echo esc_attr( $address ); ?>" data-address1="<?php echo esc_attr( $address ); ?>"> | |
| 124 | + </div> | |
| 125 | + </div><!--container--> | |
| 126 | + </div><!--titleclass--> | |
| 127 | + <?php | |
| 128 | + } else { | |
| 129 | + if ( 'TERRAIN' === $maptype ) { | |
| 130 | + $maptype = 'p'; | |
| 131 | + } elseif ( 'HYBRID' === $maptype ) { | |
| 132 | + $maptype = 'h'; | |
| 133 | + } elseif ( 'SATELLITE' === $maptype ) { | |
| 134 | + $maptype = 'k'; | |
| 132 | 135 | } else { |
| 133 | - $emailTo = get_option('admin_email'); | |
| 136 | + $maptype = 'm'; | |
| 134 | 137 | } |
| 135 | - $sitename = get_bloginfo('name'); | |
| 136 | - $subject = '['.esc_html($sitename) . ' ' . __("Contact", "virtue").'] '. __("From", "virtue") . ' ' . esc_html($name); | |
| 137 | - $body = __('Name', 'kadencetoolkit').": $name \n\n"; | |
| 138 | - $body .= __('Email', 'kadencetoolkit').": $email \n\n"; | |
| 139 | - $body .= __('Comments', 'kadencetoolkit').":\n $comments"; | |
| 140 | - $headers = 'Reply-To: ' . esc_html($name) . '<' . $email . '>' . "\r\n"; | |
| 138 | + $query_string = 'q=' . rawurlencode( $address ) . '&cid=&t=' . rawurlencode( $maptype ) . '¢er=' . rawurlencode( $address ); | |
| 139 | + echo '<div class="kt-map"><iframe height="' . esc_attr( $mapheight ) . '" style="width:100%; max-width: 100%; border:0;" src="https://maps.google.com/maps?&' . esc_attr( htmlentities( $query_string ) ) . '&output=embed&z=' . esc_attr( $zoom ) . '&iwloc=A&visual_refresh=true"></iframe></div>'; | |
| 141 | 140 | |
| 142 | - wp_mail($emailTo, $subject, $body, $headers); | |
| 143 | - $emailSent = true; | |
| 144 | 141 | } |
| 142 | +} | |
| 143 | +?> | |
| 144 | +<div id="content" class="container"> | |
| 145 | + <div class="row"> | |
| 146 | + <div id="main" class="<?php echo ( 'yes' === $form ? 'col-md-6' : 'col-md-12' ); ?>" role="main"> | |
| 147 | + <?php do_action( 'kadence_page_before_content' ); ?> | |
| 148 | + <div class="entry-content" itemprop="mainContentOfPage"> | |
| 149 | + <?php get_template_part( 'templates/content', 'page' ); ?> | |
| 150 | + </div> | |
| 151 | + </div> | |
| 152 | + <?php | |
| 153 | + if ( 'yes' === $form ) { | |
| 154 | + if ( wp_script_is( 'virtue_contact_validation', 'registered' ) ) { | |
| 155 | + wp_enqueue_script( 'virtue_contact_validation' ); | |
| 156 | + } | |
| 157 | + ?> | |
| 158 | + <div class="contactformcase col-md-6"> | |
| 159 | + <?php | |
| 160 | + $contactformtitle = get_post_meta( $post->ID, '_kad_contact_form_title', true ); | |
| 161 | + if ( ! empty( $contactformtitle ) ) { | |
| 162 | + echo '<h3>' . wp_kses_post( $contactformtitle ) . '</h3>'; | |
| 163 | + } | |
| 164 | + if ( isset( $email_sent ) && true === $email_sent ) { | |
| 165 | + do_action( 'kt_contact_email_sent' ); | |
| 166 | + ?> | |
| 167 | + <div class="thanks"> | |
| 168 | + <p><?php esc_html_e( 'Thanks, your email was sent successfully.', 'virtue-toolkit' ); ?></p> | |
| 169 | + </div> | |
| 170 | + <?php | |
| 171 | + } else { | |
| 145 | 172 | |
| 146 | -} ?> | |
| 147 | - <div id="pageheader" class="titleclass"> | |
| 148 | - <div class="container"> | |
| 149 | - <?php get_template_part('templates/page', 'header'); ?> | |
| 150 | - </div><!--container--> | |
| 151 | - </div><!--titleclass--> | |
| 152 | - <?php if ($map == 'yes') { ?> | |
| 153 | - <div id="mapheader" class="titleclass"> | |
| 154 | - <div class="container"> | |
| 155 | - <div id="map_address"> | |
| 156 | - </div> | |
| 157 | - </div><!--container--> | |
| 158 | - </div><!--titleclass--> | |
| 159 | - <?php } ?> | |
| 160 | - <div id="content" class="container"> | |
| 161 | - <div class="row"> | |
| 162 | - <?php if ($form == 'yes') { ?> | |
| 163 | - <div id="main" class="main col-md-6" role="main"> | |
| 164 | - <?php } else { ?> | |
| 165 | - <div id="main" class="main col-md-12" role="main"> | |
| 166 | - <?php } ?> | |
| 167 | - <?php get_template_part('templates/content', 'page'); ?> | |
| 168 | - </div> | |
| 169 | - | |
| 170 | - <?php if ($form == 'yes') { ?> | |
| 171 | - <div class="contactformcase col-md-6"> | |
| 172 | - <?php if (!empty($contactformtitle)) { | |
| 173 | - echo '<h3>'. esc_html($contactformtitle).'</h3>'; | |
| 174 | - } | |
| 175 | - if(isset($emailSent) && $emailSent == true) { ?> | |
| 176 | - <div class="thanks"> | |
| 177 | - <p><?php _e('Thanks, your email was sent successfully.', 'kadencetoolkit');?></p> | |
| 178 | - </div> | |
| 179 | - <?php } else { | |
| 180 | - | |
| 181 | - if(isset($hasError) || isset($captchaError)) { ?> | |
| 182 | - <p class="error"><?php _e('Sorry, an error occured.', 'kadencetoolkit');?><p> | |
| 173 | + if ( isset( $has_error ) ) { | |
| 174 | + ?> | |
| 175 | + <p class="error"><?php esc_html_e( 'Sorry, an error occured.', 'virtue-toolkit' ); ?><p> | |
| 176 | + <?php | |
| 177 | + } | |
| 178 | + ?> | |
| 179 | + <form action="<?php the_permalink(); ?>" id="contactForm" method="post"> | |
| 180 | + <div class="contactform"> | |
| 181 | + <p> | |
| 182 | + <label for="contactName"><b><?php esc_html_e( 'Name:', 'virtue-toolkit' ); ?></b><span class="contact-required">*</span></label> | |
| 183 | + <input type="text" name="contactName" id="contactName" value="<?php echo ( isset( $_POST['contactName'] ) ? esc_attr( wp_kses_post( wp_unslash( $_POST['contactName'] ) ) ) : '' ); ?>" class="required requiredField full" /> | |
| 184 | + <?php if ( isset( $name_error ) ) { ?> | |
| 185 | + <label class="error"><?php esc_html( $name_error ); ?></label> | |
| 183 | 186 | <?php } ?> |
| 187 | + </p> | |
| 188 | + <p> | |
| 189 | + <label for="email"><b><?php esc_html_e( 'Email:', 'virtue-toolkit' ); ?></b><span class="contact-required">*</span></label> | |
| 190 | + <input type="text" name="email" id="email" value="<?php echo ( isset( $_POST['email'] ) ? esc_attr( wp_kses_post( wp_unslash( $_POST['email'] ) ) ) : '' ); ?>" class="required requiredField email full" /> | |
| 191 | + <?php if ( isset( $email_error ) ) { ?> | |
| 192 | + <label class="error"><?php echo esc_html( $email_error ); ?></label> | |
| 193 | + <?php } ?> | |
| 194 | + </p> | |
| 195 | + <p><label for="commentsText"><b><?php esc_html_e( 'Message: ', 'virtue-toolkit' ); ?></b><span class="contact-required">*</span></label> | |
| 196 | + <textarea name="comments" id="commentsText" rows="10" class="required requiredField"><?php echo ( isset( $_POST['comments'] ) ? esc_textarea( wp_kses_post( wp_unslash( $_POST['comments'] ) ) ) : '' ); ?></textarea> | |
| 197 | + <?php if ( isset( $comment_error ) ) { ?> | |
| 198 | + <label class="error"><?php echo esc_html( $comment_error ); ?></label> | |
| 199 | + <?php } ?> | |
| 200 | + </p> | |
| 201 | + <?php | |
| 202 | + if ( isset( $form_math ) && 'yes' === $form_math ) { | |
| 203 | + $one = wp_rand( 5, 50 ); | |
| 204 | + $two = wp_rand( 1, 9 ); | |
| 205 | + $result = md5( $one + $two ); | |
| 206 | + ?> | |
| 207 | + <p> | |
| 208 | + <label for="kad_captcha"><b><?php echo esc_html( $one . ' + ' . $two ); ?> = </b><span class="contact-required">*</span></label> | |
| 209 | + <input type="text" name="kad_captcha" id="kad_captcha" class="required requiredField kad_captcha kad-quarter" /> | |
| 210 | + <?php if ( isset( $kad_captcha_error ) ) { ?> | |
| 211 | + <label class="error"><?php echo esc_html( $kad_captcha_error ); ?></label> | |
| 212 | + <?php } ?> | |
| 213 | + <input type="hidden" name="hval" id="hval" value="<?php echo esc_attr( $result ); ?>" /> | |
| 214 | + </p> | |
| 215 | + <?php } ?> | |
| 216 | + <?php if ( isset( $consent ) && 'true' === $consent ) { ?> | |
| 217 | + <p> | |
| 218 | + <input type="checkbox" name="gdpr-consent" id="gdpr-consent" class="required requiredField kad_gdpr-consent" /> | |
| 219 | + <?php | |
| 220 | + if ( isset( $virtue_premium['contact_consent'] ) && ! empty( $virtue_premium['contact_consent'] ) ) { | |
| 221 | + $contact_consent_label = $virtue_premium['contact_consent']; | |
| 222 | + } else { | |
| 223 | + if ( function_exists( 'the_privacy_policy_link' ) ) { | |
| 224 | + $privacy_link = get_the_privacy_policy_link(); | |
| 225 | + } | |
| 226 | + if ( ! empty( $privacy_link ) ) { | |
| 227 | + // translators: %1$s = privacy page link. | |
| 228 | + $contact_consent_label = sprintf( __( 'Please check to consent to our %s.', 'virtue-toolkit' ), $privacy_link ); | |
| 229 | + } else { | |
| 230 | + $contact_consent_label = __( 'Please check to consent to our privacy policy.', 'virtue-toolkit' ); | |
| 231 | + } | |
| 232 | + } | |
| 233 | + ?> | |
| 234 | + <label for="gdpr-consent" class="gdpr-consent-label"><?php echo wp_kses_post( $contact_consent_label ); ?><span class="contact-required">*</span></label> | |
| 235 | + <?php if ( isset( $kad_consent_error ) ) { ?> | |
| 236 | + <label class="error"><?php echo esc_html( $kad_consent_error ); ?></label> | |
| 237 | + <?php } ?> | |
| 238 | + </p> | |
| 239 | + <?php } ?> | |
| 240 | + <?php | |
| 241 | + $spam_field = apply_filters( 'kadence-contact-spam-field', null ); | |
| 242 | + $spam_field = apply_filters( 'kadence_contact_spam_field', $spam_field ); | |
| 243 | + if ( ! empty( $spam_field ) && is_array( $spam_field ) ) { | |
| 244 | + ?> | |
| 245 | + <p> | |
| 246 | + <?php | |
| 247 | + if ( isset( $spam_field['label'] ) && ! empty( $spam_field['label'] ) ) { | |
| 248 | + echo wp_kses_post( $spam_field['label'] ); | |
| 249 | + } | |
| 250 | + if ( isset( $spam_field['input'] ) && ! empty( $spam_field['input'] ) ) { | |
| 251 | + echo wp_kses_post( $spam_field['input'] ); | |
| 252 | + } | |
| 184 | 253 | |
| 185 | - <form action="<?php the_permalink(); ?>" id="contactForm" method="post"> | |
| 186 | - <div class="contactform"> | |
| 187 | - <p> | |
| 188 | - <label for="contactName"><b><?php _e('Name:', 'kadencetoolkit'); ?></b></label> | |
| 189 | - <?php if(isset($nameError)) { ?> | |
| 190 | - <span class="error"><?php echo esc_html($nameError);?></span> | |
| 191 | - <?php } ?> | |
| 192 | - <input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactName'])) echo esc_attr($_POST['contactName']);?>" class="required requiredField full" /> | |
| 193 | - </p> | |
| 194 | - | |
| 195 | - <p> | |
| 196 | - <label for="email"><b><?php _e('Email: ', 'kadencetoolkit'); ?></b></label> | |
| 197 | - <?php if(isset($emailError)) { ?> | |
| 198 | - <span class="error"><?php echo esc_html($emailError);?></span> | |
| 199 | - <?php } ?> | |
| 200 | - <input type="text" name="email" id="email" value="<?php if(isset($_POST['email'])) echo esc_attr($_POST['email']);?>" class="required requiredField email full" /> | |
| 201 | - </p> | |
| 202 | - | |
| 203 | - <p> | |
| 204 | - <label for="commentsText"><b><?php _e('Message: ', 'kadencetoolkit'); ?></b></label> | |
| 205 | - <?php if(isset($commentError)) { ?> | |
| 206 | - <span class="error"><?php echo esc_html($commentError);?></span> | |
| 207 | - <?php } ?> | |
| 208 | - <textarea name="comments" id="commentsText" rows="10" class="required requiredField"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo esc_textarea(stripslashes($_POST['comments'])); } else { echo esc_textarea($_POST['comments']); } } ?></textarea> | |
| 209 | - </p> | |
| 210 | - <?php if(isset($form_math) && $form_math == 'yes') { | |
| 211 | - $one = rand(5, 50); | |
| 212 | - $two = rand(1, 9); | |
| 213 | - $result = md5($one + $two); ?> | |
| 214 | - <p> | |
| 215 | - <label for="kad_captcha"><b><?php echo $one.' + '.$two; ?> = </b></label> | |
| 216 | - <input type="text" name="kad_captcha" id="kad_captcha" class="required requiredField kad_captcha kad-quarter" /> | |
| 217 | - <?php if(isset($kad_captchaError)) { ?> | |
| 218 | - <label class="error"><?php echo esc_html($kad_captchaError);?></label> | |
| 219 | - <?php } ?> | |
| 220 | - <input type="hidden" name="hval" id="hval" value="<?php echo esc_attr($result);?>" /> | |
| 221 | - </p> | |
| 222 | - <?php } ?> | |
| 223 | - <p> | |
| 224 | - <input type="submit" class="kad-btn kad-btn-primary" id="submit" value="<?php _e('Send Email', 'kadencetoolkit'); ?>"></input> | |
| 225 | - </p> | |
| 226 | - </div><!-- /.contactform--> | |
| 227 | - <input type="hidden" name="submitted" id="submitted" value="true" /> | |
| 228 | - </form> | |
| 254 | + if ( isset( $spam_error ) ) { | |
| 255 | + ?> | |
| 256 | + <label class="error"><?php echo esc_html( $spam_error ); ?></label> | |
| 257 | + <?php } ?> | |
| 258 | + </p> | |
| 229 | 259 | <?php } ?> |
| 230 | - </div><!--contactform--> | |
| 231 | - <?php } ?> | |
| 260 | + <p> | |
| 261 | + <?php wp_nonce_field( 'virtue_contact_nounce_action', 'virtue_contact_nounce' ); ?> | |
| 262 | + <input type="submit" class="kad-btn kad-btn-primary" id="submit" value="<?php esc_attr_e( 'Send Email', 'virtue-toolkit' ); ?>" ></input> | |
| 263 | + </p> | |
| 264 | + </div><!-- /.contactform--> | |
| 265 | + <input type="hidden" name="submitted" id="submitted" value="true" /> | |
| 266 | + </form> | |
| 267 | + <?php | |
| 268 | + } | |
| 269 | + ?> | |
| 270 | + </div><!--contactform--> | |
| 271 | + <?php } ?> | |