PluginProbe
Virtue/Ascend/Pinnacle Toolkit / 4.9.12.2
Virtue/Ascend/Pinnacle Toolkit v4.9.12.2
4.9.12.2 trunk 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.7 All 48 releases
← All changes | template-contact.php +84 -74 3.4 → 4.9.12.2 View file →
@@ -2,9 +2,9 @@
2 2 /*
3 3 Template Name: Contact
4 4 */
5 5 get_header();
6 -global $post;
6 +global $post, $pinnacle;
7 7 $form = get_post_meta( $post->ID, '_kad_contact_form', true );
8 8 $map = get_post_meta( $post->ID, '_kad_contact_map', true );
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 );
@@ -9,21 +9,25 @@
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 - <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
22 21 <?php $address = get_post_meta( $post->ID, '_kad_contact_address', true );
23 22 $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true );
24 23 $height = get_post_meta( $post->ID, '_kad_contact_mapheight', true );
25 - $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true );
24 + $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true );
25 + if(isset($pinnacle['google_map_api']) && !empty($pinnacle['google_map_api'])) {
26 + $gmap_api = $pinnacle['google_map_api'];
27 + } else {
28 + $gmap_api = 'AIzaSyBt7JOCM4XQTEi9jzdqB8alFc1Vm_3mbfQ';
29 + }
26 30 if(!empty($height)) {
27 31 $mapheight = $height;
28 32 } else {
29 33 $mapheight = 300;
@@ -32,63 +36,64 @@
32 36 $zoom = $mapzoom;
33 37 } else {
34 38 $zoom = 15;
35 39 } ?>
36 -<script type="text/javascript">
37 - jQuery(window).load(function() {
38 - jQuery('#map_address').gmap3({
39 - map: {
40 - address:"<?php echo $address;?>",
41 - options: {
42 - zoom:<?php echo $zoom;?>,
43 - draggable: true,
44 - mapTypeControl: true,
45 - mapTypeId: google.maps.MapTypeId.<?php echo $maptype;?>,
46 - scrollwheel: false,
47 - panControl: true,
48 - rotateControl: false,
49 - scaleControl: true,
50 - streetViewControl: true,
51 - zoomControl: true
52 - }
53 - },
54 - marker:{
55 - values:[
56 - {
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>
40 + <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?php echo esc_attr($gmap_api);?>"></script>
41 + <script type="text/javascript">
42 + jQuery(window).on( 'load', function(){
43 + jQuery('#map_address').gmap3({
44 + map: {
45 + address:"<?php echo esc_js($address);?>",
46 + options: {
47 + zoom:<?php echo esc_js($zoom);?>,
48 + draggable: true,
49 + mapTypeControl: true,
50 + mapTypeId: google.maps.MapTypeId.<?php echo esc_js($maptype);?>,
51 + scrollwheel: false,
52 + panControl: true,
53 + rotateControl: false,
54 + scaleControl: true,
55 + streetViewControl: true,
56 + zoomControl: true
57 + }
58 + },
59 + marker:{
60 + values:[
61 + {
62 + address: "<?php echo esc_js($address);?>",
63 + data:"<div class='mapinfo'>'<?php echo esc_js($address);?>'</div>",
64 + },
65 + ],
66 + options:{
67 + draggable: false,
68 + },
69 + events:{
70 + click: function(marker, event, context){
71 + var map = jQuery(this).gmap3("get"),
72 + infowindow = jQuery(this).gmap3({get:{name:"infowindow"}});
73 + if (infowindow){
74 + infowindow.open(map, marker);
75 + infowindow.setContent(context.data);
76 + } else {
77 + jQuery(this).gmap3({
78 + infowindow:{
79 + anchor:marker,
80 + options:{content: context.data}
81 + }
82 + });
83 + }
84 + },
85 + closeclick: function(){
86 + var infowindow = jQuery(this).gmap3({get:{name:"infowindow"}});
87 + if (infowindow){
88 + infowindow.close();
89 + }
90 + }
91 + }
92 + }
93 + });
94 + });
95 + </script>
91 96
92 97 <?php
93 98 echo '<style type="text/css" media="screen">#map_address {height:'.$mapheight.'px;}</style>';
94 99 }
@@ -93,9 +98,10 @@
93 98 echo '<style type="text/css" media="screen">#map_address {height:'.$mapheight.'px;}</style>';
94 99 }
95 100 if(isset($_POST['submitted'])) {
96 101 if(isset($form_math) && $form_math == 'yes') {
97 - if(md5($_POST['kad_captcha']) != $_POST['hval']) {
102 + $math_answer = trim($_POST['kad_captcha']);
103 + if(md5($math_answer) != $_POST['hval']) {
98 104 $kad_captchaError = __('Check your math.', 'virtue-toolkit');
99 105 $hasError = true;
100 106 }
101 107 }
@@ -102,9 +108,9 @@
102 108 if(trim($_POST['contactName']) === '') {
103 109 $nameError = __('Please enter your name.', 'virtue-toolkit');
104 110 $hasError = true;
105 111 } else {
106 - $name = trim($_POST['contactName']);
112 + $name = sanitize_text_field($_POST['contactName']);
107 113 }
108 114
109 115 if(trim($_POST['email']) === '') {
110 116 $emailError = __('Please enter your email address.', 'virtue-toolkit');
@@ -112,9 +118,9 @@
112 118 } else if (!is_email($_POST['email'])) {
113 119 $emailError = __('You entered an invalid email address.', 'virtue-toolkit');
114 120 $hasError = true;
115 121 } else {
116 - $email = trim($_POST['email']);
122 + $email = sanitize_email($_POST['email']);
117 123 }
118 124
119 125 if(trim($_POST['comments']) === '') {
120 126 $commentError = __('Please enter a message.', 'virtue-toolkit');
@@ -122,28 +128,32 @@
122 128 } else {
123 129 if(function_exists('stripslashes')) {
124 130 $comments = stripslashes(trim($_POST['comments']));
125 131 } else {
126 - $comments = trim($_POST['comments']);
132 + $comments = wp_kses_post($_POST['comments']);
127 133 }
128 134 }
129 135
130 136 if(!isset($hasError)) {
137 + $name = wp_filter_kses( $name );
138 + $email = wp_filter_kses( $email );
139 + $comments = wp_filter_kses( $comments );
140 +
131 141 if (isset($pageemail)) {
132 142 $emailTo = $pageemail;
133 143 } else {
134 144 $emailTo = get_option('admin_email');
135 145 }
136 - $sitename = get_bloginfo('name');
137 - $subject = '['.$sitename . ' ' . __("Contact", "kadencetoolkit").'] '. __("From", "kadencetoolkit") . ' ' . $name;
138 - $body = __('Name', 'virtue-toolkit').": $name \n\n";
139 - $body .= __('Email', 'virtue-toolkit').": $email \n\n";
140 - $body .= __('Comments', 'virtue-toolkit').":\n $comments";
141 - $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";
142 152
143 - wp_mail($emailTo, $subject, $body, $headers);
144 - $emailSent = true;
145 - }
153 + wp_mail($emailTo, $subject, $body, $headers);
154 + $emailSent = true;
155 + }
146 156
147 157 } ?>
148 158 <?php get_template_part('templates/page', 'header'); ?>
149 159 <?php if ($map == 'yes') { ?>