| @@ -9,14 +9,14 @@ | ||
| 9 | 9 | $pageemail = get_post_meta( $post->ID, '_kad_contact_form_email', true ); |
| 10 | 10 | $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true ); |
| 11 | 11 | if ($form == 'yes') { ?> |
| 12 | 12 | <script type="text/javascript">jQuery(document).ready(function ($) {$.extend($.validator.messages, { |
| 13 | - required: "<?php echo __('This field is required.', 'virtue-toolkit'); ?>", | |
| 14 | - email: "<?php echo __('Please enter a valid email address.', 'virtue-toolkit'); ?>", | |
| 13 | + required: "<?php echo esc_attr(__('This field is required.', 'virtue-toolkit')); ?>", | |
| 14 | + email: "<?php echo esc_attr(__('Please enter a valid email address.', 'virtue-toolkit')); ?>", | |
| 15 | 15 | }); |
| 16 | 16 | $("#contactForm").validate(); |
| 17 | 17 | });</script> |
| 18 | - <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/assets/js/jquery.validate-ck.js"></script> | |
| 18 | + <script type="text/javascript" src="<?php echo VIRTUE_TOOLKIT_URL ?>assets/jquery.validate.js"></script> | |
| 19 | 19 | <?php } |
| 20 | 20 | if ($map == 'yes') { ?> |
| 21 | 21 | <?php $address = get_post_meta( $post->ID, '_kad_contact_address', true ); |
| 22 | 22 | $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true ); |
| @@ -38,9 +38,9 @@ | ||
| 38 | 38 | $zoom = 15; |
| 39 | 39 | } ?> |
| 40 | 40 | <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?php echo esc_attr($gmap_api);?>"></script> |
| 41 | 41 | <script type="text/javascript"> |
| 42 | - jQuery(window).load(function() { | |
| 42 | + jQuery(window).on( 'load', function(){ | |
| 43 | 43 | jQuery('#map_address').gmap3({ |
| 44 | 44 | map: { |
| 45 | 45 | address:"<?php echo esc_js($address);?>", |
| 46 | 46 | options: { |
| @@ -108,9 +108,9 @@ | ||
| 108 | 108 | if(trim($_POST['contactName']) === '') { |
| 109 | 109 | $nameError = __('Please enter your name.', 'virtue-toolkit'); |
| 110 | 110 | $hasError = true; |
| 111 | 111 | } else { |
| 112 | - $name = trim($_POST['contactName']); | |
| 112 | + $name = sanitize_text_field($_POST['contactName']); | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | if(trim($_POST['email']) === '') { |
| 116 | 116 | $emailError = __('Please enter your email address.', 'virtue-toolkit'); |
| @@ -118,9 +118,9 @@ | ||
| 118 | 118 | } else if (!is_email($_POST['email'])) { |
| 119 | 119 | $emailError = __('You entered an invalid email address.', 'virtue-toolkit'); |
| 120 | 120 | $hasError = true; |
| 121 | 121 | } else { |
| 122 | - $email = trim($_POST['email']); | |
| 122 | + $email = sanitize_email($_POST['email']); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if(trim($_POST['comments']) === '') { |
| 126 | 126 | $commentError = __('Please enter a message.', 'virtue-toolkit'); |
| @@ -128,9 +128,9 @@ | ||
| 128 | 128 | } else { |
| 129 | 129 | if(function_exists('stripslashes')) { |
| 130 | 130 | $comments = stripslashes(trim($_POST['comments'])); |
| 131 | 131 | } else { |
| 132 | - $comments = trim($_POST['comments']); | |
| 132 | + $comments = wp_kses_post($_POST['comments']); | |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if(!isset($hasError)) { |
| @@ -142,18 +142,18 @@ | ||
| 142 | 142 | $emailTo = $pageemail; |
| 143 | 143 | } else { |
| 144 | 144 | $emailTo = get_option('admin_email'); |
| 145 | 145 | } |
| 146 | - $sitename = get_bloginfo('name'); | |
| 147 | - $subject = '['.$sitename . ' ' . __("Contact", "kadencetoolkit").'] '. __("From", "kadencetoolkit") . ' ' . $name; | |
| 148 | - $body = __('Name', 'virtue-toolkit').": $name \n\n"; | |
| 149 | - $body .= __('Email', 'virtue-toolkit').": $email \n\n"; | |
| 150 | - $body .= __('Comments', 'virtue-toolkit').":\n $comments"; | |
| 151 | - $headers = 'Reply-To: ' . $name . '<' . $email . '>' . "\r\n"; | |
| 146 | + $sitename = get_bloginfo('name'); | |
| 147 | + $subject = '['.$sitename . ' ' . __("Contact", "kadencetoolkit").'] '. __("From", "kadencetoolkit") . ' ' . $name; | |
| 148 | + $body = __('Name', 'virtue-toolkit').": $name \n\n"; | |
| 149 | + $body .= __('Email', 'virtue-toolkit').": $email \n\n"; | |
| 150 | + $body .= __('Comments', 'virtue-toolkit').":\n $comments"; | |
| 151 | + $headers = 'Reply-To: ' . $name . '<' . $email . '>' . "\r\n"; | |
| 152 | 152 | |
| 153 | - wp_mail($emailTo, $subject, $body, $headers); | |
| 154 | - $emailSent = true; | |
| 155 | - } | |
| 153 | + wp_mail($emailTo, $subject, $body, $headers); | |
| 154 | + $emailSent = true; | |
| 155 | + } | |
| 156 | 156 | |
| 157 | 157 | } ?> |
| 158 | 158 | <?php get_template_part('templates/page', 'header'); ?> |
| 159 | 159 | <?php if ($map == 'yes') { ?> |