| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $current_user, $wpdb,$wpscfunction; |
| 7 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
$wpsc_gdpr_html= get_option('wpsc_gdpr_html'); |
| 11 |
$wpsc_terms_and_conditions_html=get_option('wpsc_terms_and_conditions_html'); |
| 12 |
$wpsc_personal_data_retention_period_time = get_option('wpsc_personal_data_retention_period_time'); |
| 13 |
|
| 14 |
$directionality = $wpscfunction->check_rtl(); |
| 15 |
?> |
| 16 |
|
| 17 |
<form id="wpsc_terms_and_cond_settings" method="post" action="javascript:wpsc_set_terms_and_condition_settings();"> |
| 18 |
|
| 19 |
|
| 20 |
<div class="form-group"> |
| 21 |
<label for="wpsc_terms_and_conditions"><?php _e('Terms & Conditions','supportcandy');?></label> |
| 22 |
<p class="help-block"><?php _e("Enable or disable Terms and Condition ticket form.","supportcandy");?></p> |
| 23 |
<select class="form-control" name="wpsc_terms_and_conditions" id="wpsc_terms_and_conditions"> |
| 24 |
<?php |
| 25 |
$wpsc_terms_and_conditions = get_option('wpsc_terms_and_conditions'); |
| 26 |
$selected = $wpsc_terms_and_conditions == '1' ? 'selected="selected"' : ''; |
| 27 |
echo '<option '.esc_attr($selected).' value="1">'.__('Enable','supportcandy').'</option>'; |
| 28 |
$selected = $wpsc_terms_and_conditions == '0' ? 'selected="selected"' : ''; |
| 29 |
echo '<option '.esc_attr($selected).' value="0">'.__('Disable','supportcandy').'</option>'; |
| 30 |
?> |
| 31 |
</select> |
| 32 |
</div> |
| 33 |
|
| 34 |
<div class="form-group"> |
| 35 |
<label for="wpsc_terms_and_conditions_html"><?php _e('Terms and Conditions Text','supportcandy');?></label> |
| 36 |
<p class="help-block"><?php _e("Text to show on create ticket page.","supportcandy");?></p> |
| 37 |
<div class="text-right"> |
| 38 |
<button id="visual" class="wpsc-switch-editor wpsc-switch-editor-active visual term" type="button" onclick="wpsc_get_tinymce_term('wpsc_terms_and_conditions_html','term_body');"><?php _e('Visual', 'supportcandy');?></button> |
| 39 |
<button id="text" class="wpsc-switch-editor text term" type="button" onclick="wpsc_get_textarea_term('wpsc_terms_and_conditions_html')"><?php _e('Text', 'supportcandy');?></button> |
| 40 |
</div> |
| 41 |
<textarea class="form-control" style="height:100px !important;" name="wpsc_terms_and_conditions_html" id="wpsc_terms_and_conditions_html"><?php echo esc_textarea(stripcslashes(get_option('wpsc_terms_and_conditions_html')));?></textarea> |
| 42 |
</div> |
| 43 |
|
| 44 |
<div class="form-group"> |
| 45 |
<label for="wpsc_gdpr_settings"><?php _e('GDPR','supportcandy');?></label> |
| 46 |
<p class="help-block"><?php _e('Enable or disable GDPR condition on ticket form.','supportcandy');?></p> |
| 47 |
<select class="form-control" name="wpsc_gdpr_settings" id="wpsc_gdpr_settings"> |
| 48 |
<?php |
| 49 |
$wpsc_set_in_gdpr = get_option('wpsc_set_in_gdpr'); |
| 50 |
$selected_gdpr = $wpsc_set_in_gdpr == '1' ? 'selected="selected"' : ''; |
| 51 |
echo '<option '.esc_attr($selected_gdpr).' value="1">'.__('Enable','supportcandy').'</option>'; |
| 52 |
$selected_gdpr = $wpsc_set_in_gdpr == '0' ? 'selected="selected"' : ''; |
| 53 |
echo '<option '.esc_attr($selected_gdpr).' value="0">'.__('Disable','supportcandy').'</option>'; |
| 54 |
?> |
| 55 |
</select> |
| 56 |
</div> |
| 57 |
|
| 58 |
<div class="form-group"> |
| 59 |
<label for="wpsc_gdpr_html"><?php _e('GDPR Text','supportcandy');?></label> |
| 60 |
<p class="help-block"><?php _e("Text to show on create ticket page.","supportcandy");?></p> |
| 61 |
<div class="text-right"> |
| 62 |
<button id="visual1" class="wpsc-switch-editor wpsc-switch-editor-active visual gdpr" type="button" onclick="wpsc_get_tinymce_gdpr('wpsc_gdpr_html','gdpr_body');"><?php _e('Visual', 'supportcandy');?></button> |
| 63 |
<button id="text2" class="wpsc-switch-editor text gdpr" type="button" onclick="wpsc_get_textarea_gdpr('wpsc_gdpr_html')"><?php _e('Text', 'supportcandy');?></button> |
| 64 |
</div> |
| 65 |
<textarea style="height:100px !important;" class="form-control" name="wpsc_gdpr_html" id="wpsc_gdpr_html"><?php echo esc_textarea(stripcslashes(get_option('wpsc_gdpr_html')));?></textarea> |
| 66 |
</div> |
| 67 |
|
| 68 |
<div class="form-group"> |
| 69 |
<label for="wpsc_personal_data_retention_period"><?php _e('Personal Data Retention','supportcandy');?></label> |
| 70 |
<p class="help-block"><?php _e('Enable or disable personal data retention policy .','supportcandy');?></p> |
| 71 |
<select class="form-control" name="wpsc_personal_data_retention_type" id="wpsc_personal_data_retention_type"> |
| 72 |
<?php |
| 73 |
$wpsc_personal_data_retention_type = get_option('wpsc_personal_data_retention_type'); |
| 74 |
$selected = $wpsc_personal_data_retention_type == 'disable' ? 'selected="selected"' : ''; |
| 75 |
echo '<option '.esc_attr($selected).' value="disable">'.__('Disable','supportcandy').'</option>'; |
| 76 |
$selected = $wpsc_personal_data_retention_type == 'enable' ? 'selected="selected"' : ''; |
| 77 |
echo '<option '.esc_attr($selected).' value="enable">'.__('Enable','supportcandy').'</option>'; |
| 78 |
?> |
| 79 |
</select> |
| 80 |
</div> |
| 81 |
|
| 82 |
<div class="form-group" id="wpsc_personal_data_retention_period_div" style="display:none;" > |
| 83 |
<label for="wpsc_personal_data_retention_period"><?php _e('Set retention period','supportcandy');?></label> |
| 84 |
<p class="help-block"><?php _e('Set time for which personal data should be retained.','supportcandy');?></p> |
| 85 |
<div class="row"> |
| 86 |
<div class="col-sm-6" style="padding-left:0px !important;"> |
| 87 |
<input type="number" id="wpsc_personal_data_retention_period_time" class="form-control" name="wpsc_personal_data_retention_period_time" value="<?php echo esc_attr($wpsc_personal_data_retention_period_time)?>" /> |
| 88 |
</div> |
| 89 |
|
| 90 |
<div class="col-sm-6" style="padding-right: 0px !important;"> |
| 91 |
<select class="form-control" name="wpsc_personal_data_retention_period_unit"> |
| 92 |
<?php |
| 93 |
$wpsc_personal_data_retention_period_unit = get_option('wpsc_personal_data_retention_period_unit'); |
| 94 |
$selected = $wpsc_personal_data_retention_period_unit == 'days' ? 'selected="selected"' : ''; |
| 95 |
echo '<option '.esc_attr($selected).' value="days">Days</option>'; |
| 96 |
$selected = $wpsc_personal_data_retention_period_unit == 'months' ? 'selected="selected"' : ''; |
| 97 |
echo '<option '.esc_attr($selected).' value="months">Months</option>'; |
| 98 |
$selected = $wpsc_personal_data_retention_period_unit == 'years' ? 'selected="selected"' : ''; |
| 99 |
echo '<option '.esc_attr($selected).' value="years">Years</option>'; |
| 100 |
?> |
| 101 |
</select> |
| 102 |
</div> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|
| 106 |
<button type="submit" class="btn btn-success"><?php _e('Save Changes','supportcandy');?></button> |
| 107 |
<img class="wpsc_submit_wait" style="display:none;" src="<?php echo esc_url(WPSC_PLUGIN_URL.'asset/images/[email protected]');?>"> |
| 108 |
<input type="hidden" name="action" value="wpsc_settings" /> |
| 109 |
<input type="hidden" name="setting_action" value="set_terms_and_condition_settings" /> |
| 110 |
<input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce('set_terms_and_condition_settings')?>"> |
| 111 |
</form> |
| 112 |
<script> |
| 113 |
|
| 114 |
jQuery(document).ready(function(){ |
| 115 |
|
| 116 |
<?php |
| 117 |
if($wpsc_personal_data_retention_type == 'enable'){ |
| 118 |
?> |
| 119 |
jQuery('#wpsc_personal_data_retention_period_div').show(); |
| 120 |
<?php |
| 121 |
} |
| 122 |
?> |
| 123 |
jQuery('#wpsc_personal_data_retention_type').on('change', function() { |
| 124 |
if(this.value=='enable'){ |
| 125 |
jQuery('#wpsc_personal_data_retention_period_div').show(); |
| 126 |
}else { |
| 127 |
jQuery('#wpsc_personal_data_retention_period_div').hide(); |
| 128 |
} |
| 129 |
}); |
| 130 |
}); |
| 131 |
|
| 132 |
jQuery( document ).ready(function() { |
| 133 |
tinymce.remove(); |
| 134 |
wpsc_get_tinymce_term('wpsc_terms_and_conditions_html','term_body'); |
| 135 |
wpsc_get_tinymce_gdpr('wpsc_gdpr_html','gdpr_body'); |
| 136 |
}); |
| 137 |
|
| 138 |
function wpsc_get_tinymce_term(selector,body_id){ |
| 139 |
|
| 140 |
jQuery('#visual_header').removeClass('btn btn-primary visual_header'); |
| 141 |
jQuery('#text_header').addClass('btn btn-primary text_header'); |
| 142 |
jQuery('#text_header').removeClass('btn btn-default text_header'); |
| 143 |
jQuery('#text').removeClass('wpsc-switch-editor-active'); |
| 144 |
jQuery('#visual').addClass('wpsc-switch-editor-active'); |
| 145 |
tinymce.init({ |
| 146 |
selector:'#'+selector, |
| 147 |
body_id: body_id, |
| 148 |
directionality : '<?php echo esc_attr($directionality); ?>', |
| 149 |
menubar: false, |
| 150 |
statusbar: false, |
| 151 |
height : '100', |
| 152 |
plugins: [ |
| 153 |
'lists link image directionality' |
| 154 |
], |
| 155 |
image_advtab: true, |
| 156 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 157 |
branding: false, |
| 158 |
autoresize_bottom_margin: 20, |
| 159 |
browser_spellcheck : true, |
| 160 |
relative_urls : false, |
| 161 |
remove_script_host : false, |
| 162 |
convert_urls : true, |
| 163 |
setup: function (editor) { |
| 164 |
} |
| 165 |
}); |
| 166 |
} |
| 167 |
|
| 168 |
function wpsc_get_textarea_term(selector){ |
| 169 |
jQuery('#visual_body').addClass('btn btn-primary visual_body'); |
| 170 |
jQuery('#visual_body').removeClass('btn btn-default visual_body'); |
| 171 |
jQuery('#text_body').removeClass('btn btn-primary text_body'); |
| 172 |
tinymce.remove('#'+selector); |
| 173 |
jQuery('#text').addClass('wpsc-switch-editor-active'); |
| 174 |
jQuery('#visual').removeClass('wpsc-switch-editor-active'); |
| 175 |
} |
| 176 |
|
| 177 |
function wpsc_get_tinymce_gdpr(selector,body_id){ |
| 178 |
|
| 179 |
jQuery('#visual_header').removeClass('btn btn-primary visual_header'); |
| 180 |
jQuery('#text_header').addClass('btn btn-primary text_header'); |
| 181 |
jQuery('#text_header').removeClass('btn btn-default text_header'); |
| 182 |
jQuery('#text2').removeClass('wpsc-switch-editor-active'); |
| 183 |
jQuery('#visual1').addClass('wpsc-switch-editor-active'); |
| 184 |
tinymce.init({ |
| 185 |
selector:'#'+selector, |
| 186 |
body_id: body_id, |
| 187 |
directionality : '<?php echo esc_attr($directionality); ?>', |
| 188 |
menubar: false, |
| 189 |
statusbar: false, |
| 190 |
height : '100', |
| 191 |
plugins: [ |
| 192 |
'lists link image directionality' |
| 193 |
], |
| 194 |
image_advtab: true, |
| 195 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 196 |
branding: false, |
| 197 |
autoresize_bottom_margin: 20, |
| 198 |
browser_spellcheck : true, |
| 199 |
relative_urls : false, |
| 200 |
remove_script_host : false, |
| 201 |
convert_urls : true, |
| 202 |
setup: function (editor) { |
| 203 |
} |
| 204 |
}); |
| 205 |
} |
| 206 |
|
| 207 |
function wpsc_get_textarea_gdpr(selector){ |
| 208 |
jQuery('#visual_body').addClass('btn btn-primary visual_body'); |
| 209 |
jQuery('#visual_body').removeClass('btn btn-default visual_body'); |
| 210 |
jQuery('#text_body').removeClass('btn btn-primary text_body'); |
| 211 |
tinymce.remove('#'+selector); |
| 212 |
jQuery('#text2').addClass('wpsc-switch-editor-active'); |
| 213 |
jQuery('#visual1').removeClass('wpsc-switch-editor-active'); |
| 214 |
} |
| 215 |
|
| 216 |
</script> |