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_templates.php

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

105 lines 3.3 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;
7
8 if(!($current_user->ID && ($current_user->has_cap('wpsc_agent') || $current_user->has_cap('manage_options')))) exit;
9
10 $wpsc_appearance_modal_window = get_option('wpsc_modal_window');
11
12 $fields = get_terms([
13 'taxonomy' => 'wpsc_ticket_custom_fields',
14 'hide_empty' => false,
15 ]);
16
17 ob_start();
18 ?>
19 <div class="table-responsive">
20 <table id="tbl_templates" class="table table-striped table-bordered" cellspacing="5" cellpadding="5">
21 <thead>
22 <tr>
23 <th><?php _e('Tag','supportcandy')?></th>
24 <th><?php _e('Field Name','supportcandy')?></th>
25 <th></th>
26 </tr>
27 </thead>
28 <tbody>
29 <?php
30 foreach ($fields as $field) {
31 $label = get_term_meta($field->term_id,'wpsc_tf_label',true);
32 $wpsc_tf_type = get_term_meta($field->term_id,'wpsc_tf_type',true);
33 if( $wpsc_tf_type == '22' || $field->slug == 'conditional_agent_assign' || $field->slug == 'schedule_tickets'){
34 continue;
35 }
36 ?>
37 <tr>
38 <td id="wpsc_tag_td_<?php echo esc_attr($field->slug)?>" class="wpsc_tag_td" onclick="wpsc_insert_editor_text('{<?php echo esc_attr($field->slug)?>}')">{<?php echo esc_attr($field->slug)?>}</td>
39 <td><?php echo esc_attr($label)?></td>
40 <td><button id="wpsc_tag_td_btn_<?php echo esc_attr($field->slug)?>" onclick="copyToClipboard(this,'<?php echo esc_attr($field->slug)?>')" class="btn btn-sm btn-copy"><?php _e('Copy','supportcandy')?></button></td>
41 </tr>
42 <?php
43 }
44 do_action('wpsc_after_macro_templates');
45 ?>
46 </tbody>
47 </table>
48 </div>
49 <link rel="stylesheet" type="text/css" href="<?php echo esc_url(WPSC_PLUGIN_URL.'asset/lib/DataTables/datatables.min.css');?>"/>
50 <script type="text/javascript" src="<?php echo esc_url(WPSC_PLUGIN_URL.'asset/lib/DataTables/datatables.min.js');?>"></script>
51 <script>
52 jQuery(document).ready(function() {
53 var table = jQuery('#tbl_templates').DataTable({
54 "aLengthMenu": [[4, 8, 12, -1], [4, 8, 12, "All"]],
55 "columnDefs": [
56 { orderable: false, targets: -1 }
57 ]
58 });
59 jQuery('div.dataTables_filter input', table.table().container()).focus();
60 } );
61
62 function copyToClipboard(element,slug) {
63 var element = jQuery("#wpsc_tag_td_"+slug).focus()[0];
64 var range, selection;
65
66 if (document.body.createTextRange) {
67 range = document.body.createTextRange();
68 range.moveToElementText(element);
69 range.select();
70 } else if (window.getSelection) {
71 selection = window.getSelection();
72 range = document.createRange();
73 range.selectNodeContents(element);
74 selection.removeAllRanges();
75 selection.addRange(range);
76 }
77 try {
78 document.execCommand('copy');
79 var val = jQuery('#wpsc_tag_td_btn').text();
80 text = val.replace(val, "Coppied");
81 jQuery('#wpsc_tag_td_btn_'+slug).text(text);
82 wpsc_modal_close();
83 }
84 catch (err) {
85 alert('unable to copy text');
86 }
87
88 }
89 </script>
90 <?php
91 $body = ob_get_clean();
92 ob_start();
93 ?>
94 <button type="button" class="btn wpsc_popup_close" style="background-color:<?php echo esc_attr($wpsc_appearance_modal_window['wpsc_close_button_bg_color'])?> !important;color:<?php echo esc_attr($wpsc_appearance_modal_window['wpsc_close_button_text_color'])?> !important;" onclick="wpsc_modal_close();"><?php _e('Close','supportcandy');?></button>
95 <?php
96 $footer = ob_get_clean();
97
98 $output = array(
99 'body' => $body,
100 'footer' => $footer
101 );
102
103 wp_send_json($output);
104 ?>
105