PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 3.5.2
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v3.5.2
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 / ai-chatbot / templates / class-wpsc-chatbot.php

class-wpsc-chatbot.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 3.5.2, at includes/admin/ai-chatbot/templates/class-wpsc-chatbot.php

94 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 if ( ! class_exists( 'WPSC_Chatbot' ) ) :
7
8 final class WPSC_Chatbot {
9
10 /**
11 * Initialize this class
12 *
13 * @return void
14 */
15 public static function init() {
16
17 add_action( 'init', array( __CLASS__, 'get_template' ), 1 );
18 }
19
20 /**
21 * Get chatbot template
22 *
23 * @return string
24 */
25 public static function get_template() {
26
27 $acb_settings = get_option( 'wpsc-ps-acb-chatbot-settings', array() );
28 $cookie_name = 'wpsc_acb_session_id';
29 $session_id = isset( $_COOKIE[ $cookie_name ] ) ? sanitize_text_field( wp_unslash( $_COOKIE[ $cookie_name ] ) ) : '';
30 ob_start();
31 ?>
32 <div class="wpsc-chatbot-launcher" data-sessionid="<?php echo esc_attr( $session_id ); ?>" >
33 <?php WPSC_Icons::get( 'headphone' ); ?>
34 </div>
35 <div class="wpsc-chatbot">
36 <div class="wpsc-chatbot__header">
37 <div class="wpsc-chatbot__header-title">
38 <?php
39 WPSC_Icons::get( 'headphone' );
40 esc_html_e( 'AI Chatbot', 'wpsc-ps' );
41 ?>
42 </div>
43 <div class="wpsc-chatbot__header-actions">
44 <button type="button" class="wpsc-chatbot__header-btn wpsc-chatbot__expand" aria-label="Expand" title="<?php esc_attr_e( 'Full screen view', 'wpsc-ps' ); ?>" >
45 <?php WPSC_Icons::get( 'expand' ); ?>
46 </button>
47 <button type="button" class="wpsc-chatbot__header-btn wpsc-chatbot__minimize" aria-label="Minimize" title="<?php esc_attr_e( 'Minimize chat', 'wpsc-ps' ); ?>" >
48 <?php WPSC_Icons::get( 'minimize' ); ?>
49 </button>
50 <button type="button" class="wpsc-chatbot__header-btn wpsc-chatbot__compress" aria-label="Compress" title="<?php esc_attr_e( 'Exit full screen view', 'wpsc-ps' ); ?>" >
51 <?php WPSC_Icons::get( 'compress' ); ?>
52 </button>
53 <button type="button" class="wpsc-chatbot__header-btn wpsc-chatbot__close" aria-label="Close" data-sessionid="<?php echo esc_attr( $session_id ); ?>" title="<?php esc_attr_e( 'Exit chat', 'wpsc-ps' ); ?>" >
54 <?php WPSC_Icons::get( 'poweroff' ); ?>
55 </button>
56 </div>
57 </div>
58
59 <div class="wpsc-chatbot__body">
60 <div class="wpsc-chatbot__system__message">
61 <?php esc_html_e( 'Hey, I\'m your assistant. How can I help you today?', 'wpsc-ps' ); ?>
62 <div class="wpsc-chatbot__message-meta">
63 <span><?php esc_html_e( 'Assistant', 'wpsc-ps' ); ?></span>
64 <span><?php echo esc_html( wp_date( 'H:i' ) ); ?></span>
65 </div>
66 </div>
67 </div>
68
69 <div class="wpsc-chatbot__footer">
70 <div class="wpsc-chatbot__input-group">
71 <textarea id="wpsc-chatbot-input" class="wpsc-chatbot__input" placeholder="<?php esc_attr_e( 'Type your message...', 'wpsc-ps' ); ?>" ></textarea>
72 <span class="wpsc-chatbot__send"><?php WPSC_Icons::get( 'send' ); ?></span>
73 </div>
74 <?php
75 if ( isset( $acb_settings['show-footer-branding'] ) && $acb_settings['show-footer-branding'] ) {
76 ?>
77 <div class="wpsc-chatbot__powered-by">
78 <?php esc_html_e( 'Powered by', 'wpsc-ps' ); ?>
79 <a href="https://supportcandy.net" target="_blank" rel="noopener noreferrer">
80 <?php WPSC_Icons::get( 'sc_logo' ); ?>
81 </a>
82 </div>
83 <?php
84 }
85 ?>
86 </div>
87 </div>
88 <?php
89 return ob_get_clean();
90 }
91 }
92 endif;
93 WPSC_Chatbot::init();
94