PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 2.3.1
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v2.3.1
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
supportcandy / includes / admin / settings / get_captcha_settings.php

get_captcha_settings.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at includes/admin/settings/get_captcha_settings.php

184 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 global $current_user, $wpdb;
7 if (!($current_user->ID && $current_user->has_cap('manage_options'))) {
8 exit;
9 }
10 ?>
11
12 <form id="wpsc_frm_captcha_settings" method="post" action="javascript:wpsc_set_captcha_settings();">
13 <div class="form-group">
14 <label for="wpsc_captcha"><?php _e('Allow Captcha','supportcandy');?></label>
15 <p class="help-block"><?php _e("Enable or disable Captcha in ticket form.","supportcandy");?></p>
16 <select class="form-control wpsc_catpcha_setting" name="wpsc_captcha" id="wpsc_captcha">
17 <?php
18 $wpsc_captcha = get_option('wpsc_captcha');
19 $selected = $wpsc_captcha == '1' ? 'selected="selected"' : '';
20 echo '<option '.esc_attr($selected).' value="1">'.__('Enable','supportcandy').'</option>';
21 $selected = $wpsc_captcha == '0' ? 'selected="selected"' : '';
22 echo '<option '.esc_attr($selected).' value="0">'.__('Disable','supportcandy').'</option>';
23 ?>
24 </select>
25 </div>
26
27 <div class="form-group">
28 <label for="wpsc_registration_captcha"><?php _e('Allow Captcha In Registration Form','supportcandy');?></label>
29 <p class="help-block"><?php _e("Enable or disable Captcha in registration form.","wpsc");?></p>
30 <select class="form-control wpsc_catpcha_setting" name="wpsc_registration_captcha" id="wpsc_registration_captcha">
31 <?php
32 $wpsc_registration_captcha = get_option('wpsc_registration_captcha');
33 $selected = $wpsc_registration_captcha == '1' ? 'selected="selected"' : '';
34 echo '<option '.esc_attr($selected).' value="1">'.__('Enable','supportcandy').'</option>';
35 $selected = $wpsc_registration_captcha == '0' ? 'selected="selected"' : '';
36 echo '<option '.esc_attr($selected).' value="0">'.__('Disable','supportcandy').'</option>';
37 ?>
38 </select>
39 </div>
40
41 <div class="form-group">
42 <label for="wpsc_login_captcha"><?php _e('Allow Captcha In Login Form','supportcandy');?></label>
43 <p class="help-block"><?php _e("Enable or disable Captcha in Login form.","wpsc");?></p>
44 <select class="form-control wpsc_catpcha_setting" name="wpsc_login_captcha" id="wpsc_login_captcha">
45 <?php
46 $wpsc_login_captcha = get_option('wpsc_login_captcha');
47 $selected = $wpsc_login_captcha == '1' ? 'selected="selected"' : '';
48 echo '<option '.esc_attr($selected).' value="1">'.__('Enable','supportcandy').'</option>';
49 $selected = $wpsc_login_captcha == '0' ? 'selected="selected"' : '';
50 echo '<option '.esc_attr($selected).' value="0">'.__('Disable','supportcandy').'</option>';
51 ?>
52 </select>
53 </div>
54
55 <div class="form-group" id="wpsc_recaptcha_types" style="display:none;">
56 <label for="wpsc_recaptcha_type"><?php _e('Recaptcha Type','supportcandy');?></label>
57 <p class="help-block"><?php _e("Select the captcha type for Supportcandy on create ticket page.","supportcandy");?></p>
58 <div class="form-group" id="google_captcha_v2_notice" style="display:none;">
59 <span><strong> <?php _e('Please Use Google Recaptcha Version 2.0.','supportcandy')?> </strong> <?php echo sprintf(__('%1$s for steps to get Site Key and Secret Key for Google Recaptcha.','supportcandy'),'<a href="https://supportcandy.net/knowledgebase/captcha/" target="_blank">Click here</a>')?></span>
60 </div>
61 <select class="form-control" name="wpsc_recaptcha_type" id="wpsc_recaptcha_type">
62 <?php
63 $wpsc_recaptcha_type = get_option('wpsc_recaptcha_type');
64 $selected = $wpsc_recaptcha_type == '1' ? 'selected="selected"' : '';
65 echo '<option '.esc_attr($selected).' value="1">'.__('SupportCandy Captcha','supportcandy').'</option>';
66 $selected = $wpsc_recaptcha_type == '0' ? 'selected="selected"' : '';
67 echo '<option '.esc_attr($selected).' value="0">'.__('Google reCaptcha','supportcandy').'</option>';
68 ?>
69 </select>
70 </div>
71
72 <div class="form-group" id="wpsc_get_site_key" style="display:none;">
73 <label for="wpsc_recaptcha_type"><?php _e('Enter Site Key','supportcandy');?></label>
74 <input type="text" class="form-control" name="wpsc_get_site_key" id="wpsc_get_site_key" value="<?php echo esc_attr(get_option('wpsc_get_site_key')); ?>">
75 </div>
76
77 <div class="form-group" id="wpsc_get_secret_key" style="display:none;">
78 <label for="wpsc_get_secret_key"><?php _e('Enter Secret Key','supportcandy');?></label>
79 <input type="text" class="form-control" name="wpsc_get_secret_key" id="wpsc_get_secret_key" value="<?php echo esc_attr(get_option('wpsc_get_secret_key')); ?>">
80 </div>
81
82 <button type="submit" class="btn btn-success"><?php _e('Save Changes','supportcandy');?></button>
83 <img class="wpsc_submit_wait" style="display:none;" src="<?php echo esc_url(WPSC_PLUGIN_URL.'asset/images/[email protected]');?>">
84 <input type="hidden" name="action" value="wpsc_settings" />
85 <input type="hidden" name="setting_action" value="set_captcha_settings" />
86 <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce('set_captcha_settings')?>">
87 </form>
88 <script>
89
90 jQuery(document).ready(function() {
91 <?php
92 if( $wpsc_recaptcha_type == '0' ){
93 ?>
94 jQuery('#wpsc_get_site_key').show();
95 jQuery('#wpsc_get_secret_key').show();
96 jQuery('#google_captcha_v2_notice').show();
97 <?php
98 }
99 ?>
100 <?php
101 if($wpsc_captcha == '1' || $wpsc_registration_captcha == '1' || $wpsc_login_captcha =='1'){ ?>
102 jQuery('#wpsc_recaptcha_types').show();
103 wpsc_captcha_type = jQuery('#wpsc_recaptcha_type').val();
104 if(!wpsc_captcha_type){
105 jQuery('#wpsc_get_site_key').show();
106 jQuery('#wpsc_get_secret_key').show();
107 jQuery('#google_captcha_v2_notice').show();
108 }
109 <?php
110 }else{?>
111 jQuery('#wpsc_recaptcha_types').hide();
112 jQuery('#wpsc_get_site_key').hide();
113 jQuery('#wpsc_get_secret_key').hide();
114 jQuery('#google_captcha_v2_notice').hide();
115 <?php
116 }
117 ?>
118
119 jQuery(".wpsc_catpcha_setting").change(function(){
120 wpsc_captcha = parseInt(jQuery('#wpsc_captcha').val());
121 wpsc_reg_captcha = parseInt(jQuery("#wpsc_registration_captcha").val());
122 wpsc_login_captcha = parseInt(jQuery("#wpsc_login_captcha").val());
123 if( wpsc_captcha || wpsc_reg_captcha || wpsc_login_captcha ){
124 jQuery('#wpsc_recaptcha_types').show();
125 wpsc_captcha_type = parseInt(jQuery('#wpsc_recaptcha_type').val());
126 if(!wpsc_captcha_type){
127 jQuery('#wpsc_get_site_key').show();
128 jQuery('#wpsc_get_secret_key').show();
129 jQuery('#google_captcha_v2_notice').show();
130 }
131 }else{
132 jQuery('#wpsc_recaptcha_types').hide();
133 jQuery('#wpsc_get_site_key').hide();
134 jQuery('#wpsc_get_secret_key').hide();
135 jQuery('#google_captcha_v2_notice').hide();
136 }
137 });
138
139 jQuery('#wpsc_recaptcha_type').change(function() {
140 if(this.value==0){
141 jQuery('#wpsc_get_site_key').show();
142 jQuery('#wpsc_get_secret_key').show();
143 jQuery('#google_captcha_v2_notice').show();
144 }else {
145 jQuery('#wpsc_get_site_key').hide();
146 jQuery('#wpsc_get_secret_key').hide();
147 jQuery('#google_captcha_v2_notice').hide();
148 }
149 });
150 });
151
152 function wpsc_set_captcha_settings(){
153 wpsc_captcha = parseInt(jQuery('#wpsc_captcha').val());
154 wpsc_reg_captcha = parseInt(jQuery("#wpsc_registration_captcha").val());
155 if(jQuery("#wpsc_recaptcha_type").val()=='0' && (wpsc_captcha || wpsc_reg_captcha)){
156 if(!jQuery("input[name=wpsc_get_site_key]").val()){
157 alert("<?php _e('Enter site key','supportcandy')?>");
158 return;
159 }
160 if(!jQuery("input[name=wpsc_get_secret_key]").val()){
161 alert("<?php _e('Enter secret key','supportcandy')?>");
162 return;
163 }
164 }
165 jQuery('.wpsc_submit_wait').show();
166 var dataform = new FormData(jQuery('#wpsc_frm_captcha_settings')[0]);
167 jQuery.ajax({
168 url: wpsc_admin.ajax_url,
169 type: 'POST',
170 data: dataform,
171 processData: false,
172 contentType: false
173 })
174 .done(function (response_str) {
175 var response = JSON.parse(response_str);
176 jQuery('.wpsc_submit_wait').hide();
177 if (response.sucess_status=='1') {
178 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
179 }
180 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
181 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
182 });
183 }
184 </script>