PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.7.5
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.7.5
8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 All 534 releases
chatbot / qcld-wpwbot.php

qcld-wpwbot.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.7.5, at qcld-wpwbot.php

4,655 lines 280.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: AI ChatBot - WPBot
4 * Plugin URI: https://www.wpbot.pro/
5 * Description: ChatBot is a native WordPress ChatBot plugin to provide live chat support and lead generation
6 * Donate link: https://www.wpbot.pro/
7 * Version: 8.7.5
8 * @author QuantumCloud
9 * Author: ChatBot for WordPress - WPBot
10 * Author URI: https://www.wpbot.pro/
11 * Requires at least: 5.5
12 * Tested up to: 7.1
13 * Text Domain: chatbot
14 * Domain Path: /languages
15 * License: GPL2
16 */
17
18
19
20 if (!defined('ABSPATH')) exit; // Exit if accessed directly.
21
22 // Abort execution if Pro version is active to prevent conflicts
23 if ( ! function_exists( 'is_plugin_active' ) ) {
24 require_once ABSPATH . 'wp-admin/includes/plugin.php';
25 }
26
27 $active_plugins = (array) get_option( 'active_plugins', array() );
28 if ( is_multisite() ) {
29 $active_plugins = array_merge( $active_plugins, array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) ) );
30 }
31
32 $current_plugin = plugin_basename( __FILE__ );
33
34 foreach ( $active_plugins as $plugin ) {
35 if ( $plugin !== $current_plugin && basename( $plugin ) === 'qcld-wpwbot.php' ) {
36 return;
37 }
38 }
39
40 // Also abort if we are currently activating the Pro plugin
41 if ( isset($_REQUEST['action']) ) {
42 if ( $_REQUEST['action'] == 'activate' && isset($_REQUEST['plugin']) && ( ( strpos($_REQUEST['plugin'], 'wpbot-pro-master') !== false ) || ( strpos($_REQUEST['plugin'], 'wpbot-pro-professional') !== false ) || ( strpos($_REQUEST['plugin'], 'wpbot-pro-professional') !== false ) || ( strpos($_REQUEST['plugin'], 'wpbot-pro-starter') !== false ) ) ) {
43 return;
44 }
45 if ( $_REQUEST['action'] == 'activate-selected' && isset($_POST['checked']) && ( in_array('wpbot-pro-master/qcld-wpwbot.php', $_POST['checked']) || in_array('wpbot-pro-professional/qcld-wpwbot.php', $_POST['checked']) || in_array('wpbot-pro-starter/qcld-wpwbot.php', $_POST['checked']) ) ) {
46 return;
47 }
48 }
49
50 if ( ! defined( 'QCLD_wpCHATBOT_VERSION' ) ) {
51 define('QCLD_wpCHATBOT_VERSION', '8.7.5');
52 }
53 if ( ! defined( 'QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION' ) ) {
54 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
55 }
56 if ( ! defined( 'QCLD_wpCHATBOT_PLUGIN_DIR_PATH' ) ) {
57 define('QCLD_wpCHATBOT_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
58 }
59 if ( ! defined( 'QCLD_wpCHATBOT_PLUGIN_URL' ) ) {
60 define('QCLD_wpCHATBOT_PLUGIN_URL', plugin_dir_url(__FILE__));
61 }
62 if ( ! defined( 'QCLD_wpCHATBOT_IMG_URL' ) ) {
63 define('QCLD_wpCHATBOT_IMG_URL', QCLD_wpCHATBOT_PLUGIN_URL . "images/");
64 }
65 if ( ! defined( 'QCLD_wpCHATBOT_IMG_ABSOLUTE_PATH' ) ) {
66 define('QCLD_wpCHATBOT_IMG_ABSOLUTE_PATH', plugin_dir_path(__FILE__) . "images");
67 }
68 if ( ! defined( 'QCLD_wpCHATBOT_INDEX_TABLE' ) ) {
69 define('QCLD_wpCHATBOT_INDEX_TABLE', 'wpwbot_index');
70 }
71
72
73
74 //define('QCLD_wpCHATBOT_CACHE_TABLE', 'wpwbot_cache');
75
76 if ( ! defined( 'QCLD_wpCHATBOT_GC_DIRNAME' ) ) {
77 $gcdirpath = __DIR__.'/../../wpbot-dfv2-client';
78 define('QCLD_wpCHATBOT_GC_DIRNAME', $gcdirpath);
79 }
80 if ( ! defined( 'QCLD_wpCHATBOT_GC_ROOT' ) ) {
81 $wpcontentpath = __DIR__.'/../../';
82 define('QCLD_wpCHATBOT_GC_ROOT', $wpcontentpath);
83 }
84
85 require_once("qcld-wpwbot-search.php");
86 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/class-qcld-bot-rag.php");
87 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openai/qcld-bot-openai.php");
88 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openrouter/qcld-bot-openrouter.php");
89 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/gemini/qcld-bot-gemini.php");
90 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/grok/qcld-bot-grok.php");
91 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/claude/qcld-bot-claude.php");
92 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."class-qc-free-plugin-upgrade-notice.php");
93 require_once("class-plugin-deactivate-feedback.php");
94 require_once("qc-support-promo-page/class-qc-support-promo-page.php");
95 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."/functions.php");
96 require_once('qcld_df_api.php');
97 require_once('includes/class-wpbot-gc-download.php');
98 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/class-common-function.php");
99 require_once('includes/class-response-list.php');
100 require_once('qc-rating-feature/qc-rating-class.php');
101 // if ( is_admin() ) {
102 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/parsedown.php' );
103 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld-floating-openai-style-filter.php' );
104 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld_openai_floating_content.php' );
105 // }
106
107 // Built-in Chat Sessions & Analytics module.
108 // Defers to the Pro addon automatically when it's active.
109 require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/chat-sessions/wpbot-chat-sessions.php' );
110
111 /**
112 * Main Class.
113 */
114
115 class qcld_wb_Chatbot_free
116 {
117 private $id = 'wpbot';
118 private static $instance;
119 public $mysql_version = '';
120 public $promotion;
121 public $response_list;
122
123 /**
124 * Get Instance creates a singleton class that's cached to stop duplicate instances
125 */
126 public static function qcld_wb_chatbot_get_instance()
127 {
128 if (!self::$instance) {
129 self::$instance = new self();
130 self::$instance->qcld_wb_chatbot_init();
131 }
132 return self::$instance;
133 }
134 /**
135 * Construct empty on purpose
136 */
137 private function __construct()
138 {
139 $this->promotion = QCLD_wpCHATBOT_IMG_URL . "/NY-26-wpbot.jpg";
140 }
141 /**
142 * Init behaves like, and replaces, construct
143 */
144 public function qcld_wb_chatbot_init()
145 {
146 // Check if wpCommerce is active, and is required wpCommerce version.
147 /*if (!class_exists('wpCommerce') || version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) {
148 add_action('admin_notices', array($this, 'wpcommerce_inactive_notice_for_wp_chatbot'));
149 return;
150 }*/
151 add_action('admin_menu', array($this, 'qcld_wb_chatbot_admin_menu'));
152
153 if ((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) {
154 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
155
156 }
157
158 if( ( !empty($_GET['page']) && $_GET["page"] == "wpbot") || ( !empty($_GET['page']) && $_GET["page"] == "wpbot-panel")|| ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_openAi') || ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_ai_actions') || ( !empty($_GET['page']) && $_GET['page'] == 'simple-text-response') ){
159 // add_action( 'admin_notices', array( $this, 'promotion_notice' ) );
160
161 }
162
163 if (is_admin() && !empty($_GET["page"]) && ($_GET["page"] == "wpbot") || (!empty($_GET['page']) && $_GET['page']=='wpbot_help_page')
164 || ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_ai_actions')
165 || (!empty($_GET['page']) && $_GET['page']=='wpbot_openAi')
166
167 || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") || ( !empty($_GET['page']) && $_GET["page"] == "wpbot_ai_actions") ) {
168 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
169 if( get_option('wp_chatbot_index_count')<=0 && get_option('qlcd_wp_chatbot_search_option')=='advanced'){
170
171 add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
172 }
173 }
174 //loading frontend scripts
175 add_action('wp', array($this, 'qcld_wpchatbot_init_fnc'));
176 add_action('init', array($this, 'qcld_wpchatbot_init2_fnc'));
177
178
179 }
180
181
182
183 public function qcld_wpchatbot_init_fnc(){
184 if (!is_admin() && get_option('disable_wp_chatbot') != 1 && wp_chatbot_load_controlling() === true) {
185 add_action('wp_enqueue_scripts', array($this, 'qcld_wb_chatbot_frontend_scripts'));
186 }
187 }
188 public function qcld_register_ai_form_cpt() {
189 $args = array(
190 'public' => false,
191 'show_ui' => true,
192 'show_in_menu' => 'wpbot', // under WPBot menu
193 'label' => 'AI Form Entries',
194 'supports' => array('title', 'custom-fields')
195 );
196 register_post_type('wpbot_form_entry', $args);
197 }
198 public function qcld_wpchatbot_init2_fnc(){
199 $this->qcld_register_ai_form_cpt();
200 global $wpdb;
201 if( is_admin() ){
202
203 $content = $wpdb->db_server_info();
204 if ( empty( $content ) ) {
205 return;
206 }
207
208 $mysql_server_info = $content;
209
210 // Check for the MariaDB.
211 $is_mariadb = false;
212 if ( ! empty( $mysql_server_info ) && strpos( strtolower( $mysql_server_info ), 'maria' ) !== false ) {
213 $is_mariadb = true;
214 }
215
216 preg_match_all('/\d+\.\d+/', $content, $matches);
217
218 if( !empty( $matches ) && isset( $matches[0] ) && !empty( $matches[0] ) && is_array( $matches[0] ) && ! $is_mariadb ){
219 $versions = $matches[0];
220 $notice = true;
221 foreach( $versions as $version ){
222 if (version_compare($version, '5.5', '>')) {
223 $this->mysql_version = $version;
224 $notice = false;
225 }else{
226 $this->mysql_version = $version;
227 }
228 }
229
230 if( $notice ){
231 add_action('admin_notices', array($this, 'mysql_version_notice') );
232 }
233
234 }
235
236 }
237 }
238
239 public function mysql_version_notice(){
240 $class="notice notice-error is-dismissible qc-notice-error";
241 $message = "Your server's MySQL version is **".$this->mysql_version."**. MySQL version 5.6+ is required for Simple Text Responses to work. Please contact your hosting support to upgrade the MySQL to the latest version.";
242 printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
243 }
244
245 /**
246 * Add a submenu item to the wpCommerce menu
247 */
248 public function qcld_wb_chatbot_admin_menu()
249 {
250 /* add_submenu_page('wpcommerce',
251 __('wpwBot Pro', 'chatbot'),
252 __('wpwBot Pro', 'chatbot'),
253 'manage_wpcommerce',
254 $this->id,
255 array($this, 'qcld_wb_chatbot_admin_page'));*/
256 if( get_option( 'qc_bot_str_allow_author_editor' ) == 1 ){
257 $capability = 'publish_posts';
258 }else{
259 $capability = 'manage_options';
260 }
261 add_menu_page( esc_html('WPBot - ChatBot'), esc_html('WPBot - ChatBot'), 'manage_options','wpbot-panel', array($this, 'qcld_wb_chatbot_admin_page'),'dashicons-format-status', 6 );
262
263 add_submenu_page( 'wpbot-panel', esc_html('General Settings'), esc_html('General Settings'), 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
264 add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
265 add_submenu_page( 'wpbot-panel', esc_html('AI Actions'), esc_html('AI Actions'), 'manage_options','wpbot_ai_actions', 'wpbot_Ai_actions_func' );
266 $hook = add_submenu_page( 'wpbot-panel', esc_html('Simple Text Responses'), esc_html('Simple Text Responses'), $capability,'simple-text-response', array($this, 'qcld_wb_chatbot_admin_str') );
267 add_action( "load-$hook", [ $this, 'screen_option' ] );
268
269 add_submenu_page( 'wpbot-panel', esc_html('User Data'), esc_html('User Data'), 'manage_options','email-subscription', array($this, 'qcld_wb_chatbot_admin_page1') );
270
271
272 //$hook = add_submenu_page( 'wpbot-panel', esc_html('Simple Text Responses'), esc_html('Simple Text Responses'), $capability,'simple-text-response', array($this, 'qcld_wb_chatbot_admin_str') );
273
274
275 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
276
277 add_submenu_page( 'wpbot-panel', esc_html('Get Support'), esc_html('Get Support'), 'manage_options','wpbot_support_page', 'qcpromo_wpbot_free_support_page_callback_func' );
278
279 add_submenu_page( 'wpbot-panel', esc_html('Help and Debugging'), esc_html('Help and Debugging'), 'manage_options','wpbot_help_page', 'wpbot_help_page_callback_func' );
280
281
282 }
283
284 function screen_option(){
285 if( isset($_POST['wp_screen_options']) && !empty($_POST['wp_screen_options'])){
286 $per_page_str = (int)$_POST['wp_screen_options']["value"];
287
288 }else{
289 $per_page_str = 20;
290 }
291 $option = 'per_page';
292 $args = [
293 'label' => 'Response',
294 'default' => $per_page_str,
295 'option' => 'responses_per_page'
296 ];
297
298 $this->response_list = new Response_list();
299 }
300
301 public function qcld_wb_chatbot_admin_str(){
302
303 require_once("includes/simple_text_response.php");
304
305 }
306
307
308
309 /**
310 * Include admin scripts
311 */
312 public function qcld_wb_chatbot_admin_scripts($hook)
313 {
314 global $wpcommerce, $wp_scripts;
315 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
316
317 if (((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) || ($hook == "widgets.php") || $_GET['page']=='wpbot_help_page' || $_GET['page']=='wpbot_openAi' || $_GET['page']=='simple-text-response'
318 || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" || $_GET["page"] == "wpbot_ai_actions" ) {
319
320 wp_enqueue_script('jquery');
321 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
322
323 wp_register_style('qlcd-wp-chatbot-admin-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/admin-style.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
324 wp_enqueue_style('qlcd-wp-chatbot-admin-style');
325 wp_register_style('qlcd-wp-chatbot-tabs-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/wp-chatbot-tabs.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
326 wp_enqueue_style('qlcd-wp-chatbot-tabs-style');
327 wp_register_style('jquery.fontpicker.min.css', QCLD_wpCHATBOT_PLUGIN_URL . 'css/fontpicker.min.css', '', QCLD_wpCHATBOT_VERSION, 'screen');
328 wp_enqueue_style('jquery.fontpicker.min.css');
329
330
331 //wp_register_style('qlcd-openai-bootstap', plugins_url(basename(plugin_dir_path(__FILE__)) . '/openai/css/openai-admin-style.css', basename(__FILE__)), array(), true);
332 //wp_enqueue_style('qlcd-openai-bootstap');
333
334
335
336 wp_enqueue_script('jquery');
337 wp_enqueue_script( 'jquery-ui-draggable' );
338 wp_enqueue_script( 'jquery-ui-droppable' );
339 wp_enqueue_script('jquery-ui-core');
340 wp_enqueue_style( 'wp-color-picker');
341 wp_enqueue_script( 'wp-color-picker');
342 wp_enqueue_script( 'jquery-ui-sortable');
343 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
344 wp_enqueue_script('qcld-wp-fontpicker');
345 wp_register_script('qcld-wp-chatbot-cbpFWTabs', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/cbpFWTabs.js', basename(__FILE__)), array(), QCLD_wpCHATBOT_VERSION, true);
346 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
347 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
348 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
349 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
350 wp_enqueue_script('qcld-wp-chatbot-bootstrap-js');
351
352 // wp_register_script('qcld-wp-openai-setting-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/openai_settings.js', basename(__FILE__)), array('jquery'), true);
353 // wp_enqueue_script('qcld-wp-openai-setting-js');
354
355 wp_localize_script( 'qcld-wp-openai-setting-js', 'openai_ajax', array(
356 'url' => admin_url( 'admin-ajax.php' ),
357 ) );
358
359 wp_register_style('qcld-wp-chatbot-bootstrap-css', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/bootstrap.min.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
360 wp_enqueue_style('qcld-wp-chatbot-bootstrap-css');
361 //jquery time picker
362 wp_register_script('qcld-wp-chatbot-timepicker-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.timepicker.js', basename(__FILE__)), array('jquery'), true);
363 wp_enqueue_script('qcld-wp-chatbot-timepicker-js');
364 wp_register_style('qcld-wp-chatbot-timepicker-css', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/jquery.timepicker.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
365 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
366 wp_register_script('qcld-wp-chatbot-sweetalrt', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/sweetalrt.js', basename(__FILE__)), array(), true);
367 wp_enqueue_script('qcld-wp-chatbot-sweetalrt');
368 wp_register_script('qcld-wp-chatbot-admin-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-admin.js', basename(__FILE__)), array('jquery', 'jquery-ui-core','jquery-ui-sortable','jquery-ui-droppable','wp-color-picker','qcld-wp-chatbot-timepicker-js'), QCLD_wpCHATBOT_VERSION, true);
369 wp_enqueue_script('qcld-wp-chatbot-admin-js');
370 wp_localize_script('qcld-wp-chatbot-admin-js', 'qcld_gemini_admin_data',
371 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
372 // WordPress Media library
373 wp_enqueue_media();
374
375
376
377 }
378
379 }
380
381
382 public function qcld_get_formbuilder_forms(){
383 global $wpdb;
384 $forms = array();
385 if(class_exists('Qcformbuilder_Forms_Admin')){
386 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
387 if(!empty($results)){
388 foreach($results as $result){
389 $form = maybe_unserialize($result->config);
390 $forms[] = trim($form['name']);
391 }
392 return $forms;
393 }else{
394 return array();
395 }
396 }else{
397 return array();
398 }
399 }
400 public function qcld_wb_chatbot_admin_page1() {
401 require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/admin/templates/email_subscription.php';
402 }
403 public function qcld_wpbot_simple_response_intent(){
404 global $wpdb;
405 $table = $wpdb->prefix.'wpbot_response';
406 $results = $wpdb->get_results("SELECT `intent` FROM `{$table}` WHERE 1 and `intent` !=''"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
407 $response = array();
408 if(!empty($results)){
409 foreach($results as $result){
410 $response[] = $result->intent;
411 }
412 }
413 return $response;
414 }
415 public function qcld_get_formbuilder_form_commands(){
416 global $wpdb;
417 $command = array();
418 if(class_exists('Qcformbuilder_Forms_Admin')){
419 $primary = 'primary';
420 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type = %s", $primary)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
421
422 if(!empty($results)){
423 foreach($results as $result){
424 $form = maybe_unserialize($result->config);
425
426 if(isset($form['command'])){
427 $command[] = array_map('trim', explode(',', strtolower($form['command'])));
428 }
429
430 }
431 return $command;
432 }else{
433 return array();
434 }
435 }else{
436 return array();
437 }
438 }
439 public function promotion_notice(){
440 $screen = get_current_screen();
441 // if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
442 ?>
443 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #120976 !important">
444 <div class="">
445
446 <div class="qc-review-text" >
447 <a href="<?php echo esc_url('https://www.wpbot.pro/pricing/'); ?>" target="_blank">
448 <img src="<?php echo esc_url($this->promotion); ?>" alt="promotion" style="position: flex !important;"></a>
449 </div>
450 </div>
451 </div>
452 <?php
453 // }
454 }
455 public function qcld_get_formbuilder_form_ids(){
456 global $wpdb;
457 $forms = array();
458 if(class_exists('Qcformbuilder_Forms_Admin')){
459 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
460
461 if(!empty($results)){
462 foreach($results as $result){
463 $form = maybe_unserialize($result->config);
464 $forms[] = trim($form['ID']);
465 }
466 return $forms;
467 }else{
468 return array();
469 }
470 }else{
471 return array();
472 }
473 }
474
475 public function qcld_wb_chatbot_frontend_scripts()
476 {
477 global $wpcommerce, $wp_scripts, $wpdb, $current_user;
478
479 $display_name = '';
480 $display_email = '';
481 $user_image = get_option('wp_custom_client_icon');
482 $user_id = 0;
483 $user_image = get_option('wp_custom_client_icon');
484 if ( is_user_logged_in() ) {
485 $display_name = $current_user->display_name;
486 $display_email = $current_user->user_email;
487 $user_image = esc_url( get_avatar_url( $current_user->ID ) );
488 $user_id = $current_user->ID;
489 }
490
491 $conversation_form_ids = array();
492 $conversation_form_names = array();
493
494 if(class_exists('Qcformbuilder_Forms_Admin')){
495 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
496 if(!empty($results)){
497
498 foreach($results as $result){
499 $form = maybe_unserialize($result->config);
500 $conversation_form_ids[] = $form['ID'];
501 $conversation_form_names[] = $form['name'];
502 }
503
504 }
505 }
506 $wp_chatbot_obj = array(
507 'wp_chatbot_position_x' => get_option('wp_chatbot_position_x'),
508 'wp_chatbot_position_y' => get_option('wp_chatbot_position_y'),
509 'disable_icon_animation' => get_option('disable_wp_chatbot_icon_animation'),
510 'disable_featured_product' => get_option('disable_wp_chatbot_featured_product'),
511 'disable_product_search' => get_option('disable_wp_chatbot_product_search'),
512 'disable_catalog' => get_option('disable_wp_chatbot_catalog'),
513 'disable_order_status' => get_option('disable_wp_chatbot_order_status'),
514 'disable_sale_product' => get_option('disable_wp_chatbot_sale_product'),
515 'open_product_detail' => get_option('wp_chatbot_open_product_detail'),
516 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
517 'ajax_url' => admin_url('admin-ajax.php'),
518 'image_path' => QCLD_wpCHATBOT_IMG_URL,
519 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
520 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
521 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
522 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
523 'agent' => str_replace(['\\','<','>'], '',esc_html(is_array(maybe_unserialize(get_option('qlcd_wp_chatbot_agent'))) ? current(maybe_unserialize(get_option('qlcd_wp_chatbot_agent'))) : get_option('qlcd_wp_chatbot_agent'))),
524 'agent_image' => get_option('wp_chatbot_agent_image'),
525 'agent_image_path' => esc_url((!empty(get_option('wp_chatbot_custom_icon_path')) && !is_404(get_option('wp_chatbot_custom_icon_path'))) ? $this->qcld_wb_chatbot_agent_icon() : QCLD_wpCHATBOT_IMG_URL . 'icon-1.png'),
526 'shopper_demo_name' => str_replace('\\', '', is_array(maybe_unserialize(get_option('qlcd_wp_chatbot_shopper_demo_name'))) ? current(maybe_unserialize(get_option('qlcd_wp_chatbot_shopper_demo_name'))) : get_option('qlcd_wp_chatbot_shopper_demo_name')),
527 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
528 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
529 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
530 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
531 'hello' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hello'))),
532 'asking_name' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_name'))),
533 'i_am' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_i_am'))),
534 'name_greeting' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_name_greeting'))),
535 'wildcard_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_msg'))),
536 'empty_filter_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_empty_filter_msg'))),
537 'did_you_mean' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_did_you_mean'))),
538 'is_typing' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_is_typing'))),
539 'send_a_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_send_a_msg'))),
540
541 'viewed_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_viewed_products'))),
542
543 'shopping_cart' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_shopping_cart'))),
544 'cart_updating' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_cart_updating'))),
545 'cart_removing' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_cart_removing'))),
546 'imgurl' => QCLD_wpCHATBOT_IMG_URL,
547 'sys_key_help' => get_option('qlcd_wp_chatbot_sys_key_help'),
548 'sys_key_product' => get_option('qlcd_wp_chatbot_sys_key_product'),
549 'sys_key_catalog' => get_option('qlcd_wp_chatbot_sys_key_catalog'),
550 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
551 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
552 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
553 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
554 'help_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
555 'back_to_start' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
556 'help_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
557 'reset' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_reset'))),
558 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
559 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
560 'featured_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
561 'sale_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
562 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
563 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
564 'product_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
565 'product_suggest' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
566 'product_infinite' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
567 'product_success' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_success'))),
568 'product_fail' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
569 'support_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
570 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
571 'support_option_again' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
572 'asking_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
573 'asking_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
574 'no_result' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_no_result'))),
575 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
576 'asking_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
577 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
578 'support_query' => ((gettype(get_option('support_query')) == 'string') ? $this->qcld_wb_chatbot_str_replace(maybe_unserialize( get_option('support_query'))) : $this->qcld_wb_chatbot_str_replace(( get_option('support_query')))),
579 'support_ans' => (gettype(get_option('support_ans')) == 'string') ? $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('support_ans'))) : $this->qcld_wb_chatbot_str_replace((get_option('support_ans'))),
580 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
581 'notifications' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_notifications'))),
582 'order_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
583 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
584 'order_username_password' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
585 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
586 'order_login' => is_user_logged_in(),
587 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
588 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
589 'order_email_support' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
590 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
591 'invalid_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
592 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
593 'currency_symbol' => '',
594 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
595 'messenger_label' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
596 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
597 'enable_skype' => get_option('enable_wp_chatbot_skype'),
598 'enable_whats' => get_option('enable_wp_chatbot_whats'),
599 'whats_label' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
600 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
601 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
602 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
603 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
604 'exit_intent_once' => get_option('wp_chatbot_exit_intent_once'),
605 'enable_scroll_open' => get_option('enable_wp_chatbot_scroll_open'),
606 'scroll_open_msg' => str_replace('\\', '', get_option('wp_chatbot_scroll_open_msg')),
607 'scroll_open_percent' => get_option('wp_chatbot_scroll_percent'),
608 'scroll_open_once' => get_option('wp_chatbot_scroll_once'),
609 'enable_auto_open' => get_option('enable_wp_chatbot_auto_open'),
610 'auto_open_msg' => str_replace('\\', '', get_option('wp_chatbot_auto_open_msg')),
611 'auto_open_time' => get_option('wp_chatbot_auto_open_time'),
612 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
613 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
614 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
615 'disable_faq' => get_option('disable_wp_chatbot_faq'),
616 'feedback_label' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
617 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
618 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
619 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
620 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
621 'search_keyword' => get_option('qlcd_wp_chatbot_asking_search_keyword'),
622 'ajax_nonce'=> wp_create_nonce('qcsecretbotnonceval123qc'),
623 'session_nonce'=> wp_create_nonce('wp_chatbot'),
624 'site_search' => get_option('qlcd_wp_site_search'),
625 'open_links_newtab' => get_option('open_links_new_window'),
626 'call_gen' => get_option('disable_wp_chatbot_call_gen'),
627 'call_sup' => get_option('disable_wp_chatbot_call_sup'),
628 'enable_ret_sound' => get_option('enable_wp_chatbot_ret_sound'),
629 'found_result_message' => get_option('qlcd_wp_chatbot_found_result'),
630 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
631 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
632 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
633 'mobile_full_screen' => '1',
634 'chatbot_content' => get_option( 'chatbot_content_max_height' ),
635 'chatbot_content_responsive' => get_option( 'chatbot_content_max_height_responsive' ),
636 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):800),
637 'inactive_time' => get_option('wp_chatbot_inactive_time'),
638 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
639 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
640 'ai_df_token' => get_option('qlcd_wp_chatbot_dialogflow_client_token'),
641 'df_defualt_reply' => str_replace('\\', '', get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')),
642 'df_agent_lan' => get_option('qlcd_wp_chatbot_dialogflow_agent_language'),
643 'openai_enabled' => get_option('ai_enabled'),
644 'is_stream_enabled' => ( get_option('is_stream_enabled', '1') == '1' ? '1' : '0' ),
645 'qcld_openai_append_content' => get_option('qcld_openai_append_content'),
646 'openrouter_enabled' => (get_option('qcld_openrouter_enabled')=='1'? get_option('qcld_openrouter_enabled') : '0'),
647 'gemini_enabled' => (get_option('qcld_gemini_enabled')=='1'? get_option('qcld_gemini_enabled') : '0'),
648 'grok_enabled' => (get_option('qcld_grok_enabled')=='1'? get_option('qcld_grok_enabled') : '0'),
649 'qcld_gemini_prepend_content' => get_option('qcld_gemini_prepend_content'),
650 'qcld_gemini_append_content' => get_option('qcld_gemini_append_content'),
651 'qcld_openrouter_append_content' => get_option('qcld_openrouter_append_content'),
652 'qcld_openrouter_prepend_content' => get_option('qcld_openrouter_prepend_content'),
653 'start_menu' => wp_unslash(get_option('qc_wpbot_menu_order')),
654 'conversation_form_ids' => $conversation_form_ids,
655 'conversation_form_names' => $conversation_form_names,
656 'simple_response_intent' => $this->qcld_wpbot_simple_response_intent(),
657 'forms' => $this->qcld_get_formbuilder_forms(),
658 'form_ids' =>$this->qcld_get_formbuilder_form_ids(),
659 'form_commands' => $this->qcld_get_formbuilder_form_commands(),
660 'df_api_version' => (get_option('wp_chatbot_df_api')==''?'v1':get_option('wp_chatbot_df_api')),
661 'v2_client_url'=> esc_url(get_site_url().'/?action=qcld_dfv2_api'),
662 'show_menu_after_greetings'=> (get_option('show_menu_after_greetings')!=''?get_option('show_menu_after_greetings'):0),
663 'disable_back_to_start'=> (get_option('disable_back_to_start_menu')!=''?get_option('disable_back_to_start_menu'):0),
664 'current_user_id' => $user_id,
665 'display_name' => esc_html( $display_name ),
666 'skip_wp_greetings' => get_option('skip_wp_greetings'),
667 'skip_greetings_and_menu' => get_option('skip_wp_greetings_donot_show_menu'),
668 'skip_wp_greetings_trigger_intent' => get_option('skip_wp_greetings_trigger_intent'),
669 'intent_for_non_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_non_logged_in_user'),
670 'intent_for_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_logged_in_user'),
671 'ask_email_wp_greetings' => get_option('enable_asking_for_email'),
672 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
673 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
674 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
675 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
676 'qlcd_wp_chatbot_report_text' => get_option('qlcd_wp_chatbot_report_text'),
677 'enable_chat_share_menu' => get_option('enable_chat_share_menu'),
678 'qlcd_wp_chatbot_share_text' => get_option('qlcd_wp_chatbot_share_text'),
679 'icon_video' => get_option('wp_chatbot_icon_video', ''),
680 'icon_video_delay' => absint(get_option('wp_chatbot_icon_video_delay', 0)),
681
682 );
683 $user_font = get_option('wp_chatbot_user_font') != '' ? get_option('wp_chatbot_user_font') : '';
684 if($user_font != '' ){
685 $parts = explode(':', $user_font);
686 // Create an object
687 $user_font_family = new stdClass();
688 // Assign values
689 $user_font_family->fontfamily = $parts[0];
690 $user_font_family->fontWeight = isset($parts[1]) ? $parts[1] : '400'; // default weight
691 $user_font_family->fontStyle = 'normal';
692 if(get_option('enable_wp_chatbot_custom_color')==1){
693 $user_enqueue_font = 'https://fonts.googleapis.com/css2?family='. $user_font_family->fontfamily;
694 wp_enqueue_style( 'qcld-chatbot-user-google-fonts', $user_enqueue_font, false );
695 wp_enqueue_style( 'qcld-chatbot-user-google-fonts');
696 }
697 }
698
699 $bot_font = get_option('wp_chatbot_bot_font') != '' ? get_option('wp_chatbot_bot_font') : '';
700 if($bot_font != '' ){
701 $parts = explode(':', $bot_font);
702 // Create an object
703 $bot_font_family = new stdClass();
704 // Assign values
705 $bot_font_family->fontFamily = $parts[0];
706 $bot_font_family->fontWeight = isset($parts[1]) ? $parts[1] : '400'; // default weight
707 $bot_font_family->fontStyle = 'normal';
708
709
710
711 if(get_option('enable_wp_chatbot_custom_color')==1){
712 $bot_enqueue_font = 'https://fonts.googleapis.com/css2?family='.$bot_font_family->fontFamily;
713 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts', $bot_enqueue_font, false );
714 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts');
715 }
716 }
717
718
719
720 wp_enqueue_style( 'dashicons' );
721 wp_register_script('qcld-wp-chatbot-slimscroll-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.slimscroll.min.js', basename(__FILE__)), array('jquery'), QCLD_wpCHATBOT_VERSION, true);
722 wp_enqueue_script('qcld-wp-chatbot-slimscroll-js');
723 wp_register_script('qcld-wp-chatbot-jquery-cookie', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.cookie.js', basename(__FILE__)), array('jquery'), QCLD_wpCHATBOT_VERSION, true);
724 wp_enqueue_script('qcld-wp-chatbot-jquery-cookie');
725 wp_register_script('qcld-wp-chatbot-magnify-popup', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.magnific-popup.min.js', basename(__FILE__)), array('jquery'), QCLD_wpCHATBOT_VERSION, true);
726 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
727 wp_register_script('qcld-wp-chatbot-plugin', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-plugin.js', basename(__FILE__)), array('jquery', 'qcld-wp-chatbot-jquery-cookie','qcld-wp-chatbot-magnify-popup'), QCLD_wpCHATBOT_VERSION, true);
728 wp_enqueue_script('qcld-wp-chatbot-plugin');
729
730 $saved_ai_forms = get_option('wpbot_ai_forms', array());
731 $ai_form_titles = array();
732 if (is_array($saved_ai_forms)) {
733 foreach ($saved_ai_forms as $form) {
734 if (!isset($form['interactive']) || $form['interactive'] == 1) {
735 $ai_form_titles[] = trim(strtolower($form['title']));
736 }
737 }
738 }
739
740 $nonce = wp_create_nonce('wp_chatbot');
741 // Pass data to JS
742 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
743 'ajax_url' => admin_url('admin-ajax.php'),
744 'nonce' => $nonce,
745 'stream_endpoint' => admin_url('admin-ajax.php?action=qcld_stream_openai'),
746 'ai_form_titles' => $ai_form_titles,
747 ]);
748
749 wp_register_script('qcld-wp-chatbot-front-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-front.js', basename(__FILE__)), array('jquery', 'qcld-wp-chatbot-jquery-cookie'), QCLD_wpCHATBOT_VERSION, true);
750 wp_enqueue_script('qcld-wp-chatbot-front-js');
751 wp_localize_script('qcld-wp-chatbot-front-js', 'wp_chatbot_obj', $wp_chatbot_obj);
752 //wp_register_script('qcld-wp-chatbot-frontend', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-frontend.js', basename(__FILE__)), array('jquery','qcld-wp-chatbot-jquery-cookie'), QCLD_wpCHATBOT_VERSION, true);
753 //wp_enqueue_script('qcld-wp-chatbot-frontend');
754 //wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
755 wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
756
757 if ( ! function_exists( 'wp_register_style' ) || ! function_exists( 'wp_enqueue_style' ) || ! function_exists( 'plugins_url' ) || ! function_exists( 'plugin_dir_path' ) || ! function_exists( 'get_option' ) || ! function_exists( 'sanitize_hex_color' ) || ! function_exists( 'wp_add_inline_style' ) ) {
758 // Return early if critical WordPress functions are not available.
759 // This indicates the code needs to be hooked into an appropriate action.
760 return;
761 }
762
763 wp_register_style('qcld-wp-chatbot-common-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/common-style.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
764 wp_enqueue_style('qcld-wp-chatbot-common-style');
765
766 $floating_icon_bg_color = get_option('wp_chatbot_floatingiconbg_color');
767 $floating_icon_bg_color = sanitize_hex_color($floating_icon_bg_color); // ensures it's a valid hex color like #ffffff
768
769 if ( ! empty($floating_icon_bg_color) ) {
770 $inline_floating_icon_styles = "
771 .wp-chatbot-ball {
772 background: {$floating_icon_bg_color} !important;
773 }
774 .wp-chatbot-ball:hover,
775 .wp-chatbot-ball:focus {
776 background: {$floating_icon_bg_color} !important;
777 }";
778
779 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $inline_floating_icon_styles );
780 }
781
782 wp_register_style('qcld-wp-chatbot-magnific-popup', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/magnific-popup.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
783 wp_enqueue_style('qcld-wp-chatbot-magnific-popup');
784
785 $qcld_wb_chatbot_theme = get_option('qcld_wb_chatbot_theme');
786 /* if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css')) {
787 wp_register_style('qcld-wp-chatbot-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/templates/' . $qcld_wb_chatbot_theme . '/style.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
788 wp_enqueue_style('qcld-wp-chatbot-style');
789 }*/
790 //Loading shortcode style
791 if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/shortcode.css')) {
792 wp_register_style('qcld-wp-chatbot-shortcode-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/templates/' . $qcld_wb_chatbot_theme . '/shortcode.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
793 wp_enqueue_style('qcld-wp-chatbot-shortcode-style');
794 }
795
796 $inline_chat_custom_styles = ''; // Initialize a new variable for general chat custom styles.
797 if(get_option('enable_wp_chatbot_custom_color')==1){
798 // Sanitize all color options before using them in CSS to prevent invalid values.
799 $text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
800 $link_color = sanitize_hex_color( get_option('wp_chatbot_link_color') );
801 $link_hover_color = sanitize_hex_color( get_option('wp_chatbot_link_hover_color') );
802 $bot_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_bot_msg_text_color') );
803 $bot_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_bot_msg_bg_color') );
804 $buttons_text_color = sanitize_hex_color( get_option('wp_chatbot_buttons_text_color') );
805 $buttons_bg_color = sanitize_hex_color( get_option('wp_chatbot_buttons_bg_color') );
806 $buttons_text_color_hover = sanitize_hex_color( get_option('wp_chatbot_buttons_text_color_hover') );
807 $buttons_bg_color_hover = sanitize_hex_color( get_option('wp_chatbot_buttons_bg_color_hover') );
808 $user_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_text_color') );
809 $wp_chatbot_text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
810 $user_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_bg_color') );
811 $header_background_color = sanitize_hex_color( get_option('wp_chatbot_header_background_color') );
812 $chatbot_content_max_height = sanitize_text_field( get_option('chatbot_content_max_height') );
813 $chatbot_content_max_height_responsive = sanitize_text_field( get_option('chatbot_content_max_height_responsive') );
814
815
816 $inline_chat_custom_styles .= "
817 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
818 color: ". $text_color ." !important;
819 }
820 #wp-chatbot-chat-container a {
821 color: ". $link_color ." !important;
822 }
823
824 #wp-chatbot-chat-container a p{
825 color: ". $link_color ." !important;
826 }
827 #wp-chatbot-chat-container a p span{
828 color: ". $link_color ." !important;
829 }
830 #wp-chatbot-chat-container a:hover {
831 color: ". $link_hover_color ." !important;
832 }
833
834 ul.wp-chatbot-messages-container > li.wp-chatbot-msg .wp-chatbot-paragraph,
835 .wp-chatbot-agent-profile .wp-chatbot-bubble {
836 color: ". $bot_msg_text_color ." !important;
837 background-color: ". $bot_msg_bg_color ." !important;
838 word-break: break-word;
839 }
840 span.qcld-chatbot-product-category, span.qcld-chatbot-support-items, span.qcld-chatbot-wildcard, span.qcld-chatbot-suggest-email, span.qcld-chatbot-reset-btn, #woo-chatbot-loadmore, .wp-chatbot-shortcode-template-container span.qcld-chatbot-product-category, .wp-chatbot-shortcode-template-container span.qcld-chatbot-support-items, .wp-chatbot-shortcode-template-container span.qcld-chatbot-wildcard, .wp-chatbot-shortcode-template-container span.wp-chatbot-card-button, .wp-chatbot-shortcode-template-container span.qcld-chatbot-suggest-email, span.qcld-chatbot-suggest-phone, .wp-chatbot-shortcode-template-container span.qcld-chatbot-reset-btn, .wp-chatbot-shortcode-template-container #wp-chatbot-loadmore, .wp-chatbot-ball-cart-items, .wpbd_subscription, .qcld-chatbot-site-search, .qcld_subscribe_confirm, .qcld-chat-common, .qcld-chatbot-custom-intent {
841 color: ". $buttons_text_color ." !important;
842 background-color: ". $buttons_bg_color ." !important;
843 background-image: none !important;
844 }
845
846 span.qcld-chatbot-product-category:hover, span.qcld-chatbot-support-items:hover, span.qcld-chatbot-wildcard:hover, span.qcld-chatbot-suggest-email:hover, span.qcld-chatbot-reset-btn:hover, #woo-chatbot-loadmore:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-product-category:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-support-items:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-wildcard:hover, .wp-chatbot-shortcode-template-container:hover span.wp-chatbot-card-button:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-suggest-email:hover, span.qcld-chatbot-suggest-phone:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-reset-btn:hover, .wp-chatbot-shortcode-template-container:hover #wp-chatbot-loadmore:hover, .wp-chatbot-ball-cart-items:hover, .wpbd_subscription:hover, .qcld-chatbot-site-search:hover, .qcld_subscribe_confirm:hover, .qcld-chat-common:hover, .qcld-chatbot-custom-intent:hover {
847 color: ". $buttons_text_color_hover ." !important;
848 background-color: ". $buttons_bg_color_hover ." !important;
849 background-image: none !important;
850 }
851
852 li.wp-chat-user-msg .wp-chatbot-paragraph {
853 color: ". $user_msg_text_color ." !important;
854 background: ". $user_msg_bg_color ." !important;
855 }
856
857 ul.wp-chatbot-messages-container li:first-child.wp-chatbot-msg .wp-chatbot-paragraph {
858 color: ". $wp_chatbot_text_color ." !important;
859 }
860
861 ul.wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph:before,
862 .wp-chatbot-bubble:before {
863 border-right: 10px solid ". $bot_msg_bg_color ." !important;
864
865 }
866 ul.wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph:before {
867 border-left: 10px solid ". $user_msg_bg_color ." !important;
868 }
869 #wp-chatbot-chat-container .wp-chatbot-header{
870 background: ". $header_background_color ." !important;
871 }
872 .wp-chatbot-container ul.wp-chatbot-messages-container > li.wp-chatbot-msg .chat-container, .wp-chatbot-container .wp-chatbot-agent-profile .wp-chatbot-bubble {
873 color: ". $bot_msg_text_color ." !important;
874 background: ". $bot_msg_bg_color ." !important;
875 }
876 ";
877 // Apply the accumulated general chat custom styles.
878 // This ensures these styles are added if the custom color option is enabled.
879 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $inline_chat_custom_styles );
880 }
881 $custom_colors ="";
882 if((get_option('enable_wp_chatbot_custom_color')==1) && $user_font != ''){
883 $custom_colors .="
884
885
886 #wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph,
887 #wp-chatbot-messages-container > li.wp-chatbot-msg > span{
888 font-family: ".$bot_font_family->fontFamily.";
889 font-weight: ".$bot_font_family->fontWeight.";
890 font-style: ".$bot_font_family->fontStyle.";
891 font-size: ". get_option('wp_chatbot_font_size'). "px;
892 }
893
894 ul.wp-chatbot-messages-container > li.wp-chatbot-msg .wp-chatbot-paragraph, .wp-chatbot-agent-profile .wp-chatbot-bubble {
895 font-family: ".$bot_font_family->fontFamily.";
896 font-weight: ".$bot_font_family->fontWeight.";
897 font-style: ".$bot_font_family->fontStyle.";
898 font-size: ". get_option('wp_chatbot_font_size'). "px;
899 }
900
901 ul#wp-chatbot-messages-container .wp-chatbot-textanimation span {
902 font-family: ".$bot_font_family->fontFamily.";
903 font-weight: ".$bot_font_family->fontWeight.";
904 font-style: ".$bot_font_family->fontStyle.";
905 font-size: ". get_option('wp_chatbot_font_size'). "px;
906 }
907
908
909
910
911 ";
912 }
913 if ( get_option('enable_wp_chatbot_custom_color') == 1 && ! empty($bot_font) ) {
914
915 // Sanitize each CSS-related value
916 $font_family = isset( $user_font_family->fontfamily ) ? esc_attr( $user_font_family->fontfamily ) : 'inherit';
917 $font_weight = isset( $user_font_family->fontWeight ) ? esc_attr( $user_font_family->fontWeight ) : 'normal';
918 $font_style = isset( $user_font_family->fontStyle ) ? esc_attr( $user_font_family->fontStyle ) : 'normal';
919 $font_size = get_option( 'wp_chatbot_font_size' );
920 $font_size = esc_attr( trim( $font_size ) );
921
922 // Optional: ensure font size includes units.
923 if ( ! preg_match( '/(px|em|rem|%)$/', $font_size ) ) {
924 $font_size .= 'px'; // fallback to px if unit missing.
925 }
926
927 $custom_colors .= "
928 #wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph {
929 font-family: {$font_family};
930 font-weight: {$font_weight};
931 font-style: {$font_style};
932 font-size: {$font_size};
933 }
934 ";
935
936 }
937
938 if(get_option('wp_chatbot_custom_css')!=""){
939
940 wp_add_inline_style( 'qcld-wp-chatbot-common-style', get_option('wp_chatbot_custom_css') );
941 }
942
943
944
945
946 if ( ( get_option( 'chatbot_content_max_height' ) != '' ) ) {
947 $chatbot_h_vh = absint( get_option( 'chatbot_content_max_height' ) );
948 if ( $chatbot_h_vh <= 0 ) {
949 $chatbot_h_vh = 80;
950 }
951 if ( $chatbot_h_vh > 100 ) {
952 $chatbot_h_vh = 100;
953 }
954 // Expand adds a modest bump based on admin height (never above 100vh).
955 $chatbot_h_expanded_vh = min( 100, $chatbot_h_vh + 8 );
956
957 $chatbot_h_mobile_vh = absint( get_option( 'chatbot_content_max_height_responsive' ) );
958 if ( $chatbot_h_mobile_vh <= 0 ) {
959 $chatbot_h_mobile_vh = 90;
960 }
961 if ( $chatbot_h_mobile_vh > 100 ) {
962 $chatbot_h_mobile_vh = 100;
963 }
964
965 $custom_colors .= ' .slimScrollDiv{
966 height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
967 max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
968 }';
969
970
971 $custom_colors .= 'div#wp-chatbot-board-container{
972 height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
973 max-height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
974 }';
975
976 $custom_colors .= '.wp-chatbot-content{
977 height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
978 max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
979 }';
980
981 // Desktop expand: width toggle also grows height from admin base + bump.
982 $custom_colors .= '
983 div#wp-chatbot-board-container.wp-chatbot-expanded,
984 .wp-chatbot-board-container.wp-chatbot-expanded {
985 height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
986 max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
987 }
988 div#wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
989 div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
990 div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner,
991 .wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
992 .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
993 .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner {
994 height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
995 max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
996 }
997 ';
998
999
1000
1001 $custom_colors .= '
1002 @media screen and (max-width: 480px) {
1003 div#wp-chatbot-board-container{
1004 height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1005 max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1006 }
1007
1008 .slimScrollDiv{
1009 height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1010 max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1011 }
1012
1013 .wp-chatbot-content{
1014 height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1015 max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1016 }
1017 }
1018 ';
1019
1020
1021 }
1022 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
1023 }
1024 public function qcld_wb_chatbot_str_replace($messages=array()){
1025 $allowed_html = array(
1026 'a' => array(
1027 'href' => array(),
1028 'title' => array()
1029 ),
1030 'div' => array(
1031 'class' => array()
1032 ),
1033 'span' => array(
1034 'class' => array()
1035 ),
1036 'img' => array(
1037 'src' => array()
1038 ),
1039 'h3' => array(),
1040 'h4' => array(),
1041 'h5' => array(),
1042 'h6' => array(),
1043 'b' => array(),
1044 'br' => array(),
1045 'em' => array(),
1046 'ul' => array(),
1047 'li' => array(),
1048 'strong' => array(),
1049 );
1050 $refined_mesgses=array();
1051 if(!empty($messages) && is_array($messages)){
1052 foreach ($messages as $message){
1053 $from = array('&lt;', '&gt;');
1054 $to = array('<', '>');
1055 if(!is_array($message)){
1056 $message = str_replace($from, $to, $message);
1057 $msg = wp_kses( ($message), $allowed_html);
1058 $refined_msg=str_replace('\\', '', $msg);
1059 array_push($refined_mesgses,$refined_msg);
1060 }
1061 }
1062 }else{
1063 $from = array('&lt;', '&gt;');
1064 $to = array('<', '>');
1065
1066 $message = str_replace($from, $to, $messages);
1067 if(!empty($messages )){
1068 $msg = wp_kses( $messages, $allowed_html);
1069 }else{
1070 $msg = '';
1071 }
1072 $refined_msg=str_replace('\\', '', $msg);
1073 array_push($refined_mesgses,$refined_msg);
1074
1075 }
1076 return $refined_mesgses;
1077
1078 }
1079 //getting exact agent icon path
1080 public function qcld_wb_chatbot_agent_icon(){
1081
1082 if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')=="custom-agent.png" ){
1083 $wp_chatbot_custom_icon_path=get_option('wp_chatbot_custom_agent_path');
1084 }
1085 else if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')!="custom-agent.png"){
1086 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
1087 }
1088 else
1089 {
1090 if(get_option('wp_chatbot_agent_image')!=''){
1091 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
1092 }else{
1093 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.'custom-agent.png';
1094 }
1095
1096 }
1097
1098 return $wp_chatbot_custom_icon_path;
1099 }
1100 /**
1101 * Render the admin page
1102 */
1103
1104 public function qcld_wb_chatbot_admin_page()
1105 {
1106 global $wpcommerce;
1107 $action = 'admin.php?page=wpbot-panel';
1108 require_once("admin_ui2.php");
1109 }
1110
1111 public function qcld_wb_chatbot_admin_page_settings()
1112 {
1113 global $wpcommerce;
1114 $action = 'admin.php?page=wpbot';
1115
1116 require_once("admin_ui.php");
1117 }
1118
1119 public function qcld_wb_chatbot_dynamic_multi_option($options, $option_name, $option_text)
1120 {
1121 ?>
1122
1123 <h4 class="qc-opt-title">
1124 <?php echo esc_html($option_text); ?>
1125 </h4>
1126 <div class="wp-chatbot-lng-items">
1127 <?php
1128 if (is_array($options) && count($options) > 0) {
1129 foreach ($options as $key => $value) {
1130 ?>
1131 <div class="row" class="wp-chatbot-lng-item">
1132 <div class="col-xs-11">
1133 <input type="text"
1134 class="form-control qc-opt-dcs-font"
1135 name="<?php echo esc_attr( $option_name ); ?>[]"
1136 value="<?php echo esc_attr(str_replace('\\', '', $value)); ?>">
1137 </div>
1138 <div class="col-xs-1">
1139 <button type="button" class="btn btn-danger btn-sm wp-chatbot-lng-item-remove"> <span class="glyphicon glyphicon-remove"></span> </button>
1140 </div>
1141 </div>
1142 <?php
1143 }
1144 } else { ?>
1145 <div class="row" class="wp-chatbot-lng-item">
1146 <div class="col-xs-11">
1147 <input type="text"
1148 class="form-control qc-opt-dcs-font"
1149 name="<?php echo esc_attr( $option_name ); ?>[]"
1150 value="<?php echo esc_attr($option_text); ?>">
1151 </div>
1152 <div class="col-xs-1"> <span class="wp-chatbot-lng-item-remove">
1153 <?php esc_html_e('X', 'chatbot'); ?>
1154 </span> </div>
1155 </div>
1156 <?php } ?>
1157 </div>
1158 <div class="row">
1159 <div class="col-sm-1 col-sm-offset-11">
1160 <button type="button" class="btn btn-success btn-sm wp-chatbot-lng-item-add"> <span class="glyphicon glyphicon-plus"></span> </button>
1161 </div>
1162 </div>
1163 <?php
1164 }
1165
1166 function qcld_wb_chatbot_save_options()
1167 {
1168 //global $wpcommerce;
1169 if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'wp_chatbot') && current_user_can('manage_options')) {
1170 // Check if the form is submitted or not.
1171 $submit = sanitize_text_field(wp_unslash($_POST['submit']));
1172 if (isset($submit)) {
1173 //wpwboticon position settings.
1174 if (isset($_POST["wp_chatbot_position_x"])) {
1175 $wp_chatbot_position_x = intval(sanitize_text_field(wp_unslash($_POST["wp_chatbot_position_x"])));
1176 update_option('wp_chatbot_position_x', $wp_chatbot_position_x);
1177 }
1178 if (isset($_POST["wp_chatbot_position_y"])) {
1179 $wp_chatbot_position_y = intval(sanitize_text_field(wp_unslash($_POST["wp_chatbot_position_y"])));
1180 update_option('wp_chatbot_position_y', $wp_chatbot_position_y);
1181 }
1182 //product search options
1183 if(isset($_POST['qlcd_wp_chatbot_search_option'])){
1184 $qlcd_wp_chatbot_search_option = sanitize_text_field(wp_unslash($_POST['qlcd_wp_chatbot_search_option']));
1185 update_option('qlcd_wp_chatbot_search_option', $qlcd_wp_chatbot_search_option);
1186 }
1187 if(isset( $_POST["disable_floating_button"])){
1188 $disable_floating_button = sanitize_text_field(wp_unslash($_POST["disable_floating_button"]));
1189 }else{ $disable_floating_button='';}
1190 update_option('disable_floating_button', wp_unslash($disable_floating_button));
1191
1192 if(isset( $_POST["wpbot_enable_on_search"])){
1193 $wpbot_enable_on_search = sanitize_text_field(wp_unslash($_POST["wpbot_enable_on_search"]));
1194 }else{ $wpbot_enable_on_search='';}
1195 update_option('wpbot_enable_on_search', wp_unslash($wpbot_enable_on_search));
1196
1197 if(isset( $_POST["skip_wp_greetings_donot_show_menu"])){
1198 $skip_wp_greetings_donot_show_menu = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings_donot_show_menu"]));
1199 }else{ $skip_wp_greetings_donot_show_menu='';}
1200 update_option('skip_wp_greetings_donot_show_menu', wp_unslash($skip_wp_greetings_donot_show_menu));
1201
1202 if(isset( $_POST["skip_wp_greetings"])){
1203 $skip_wp_greetings = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings"]));
1204 }else{ $skip_wp_greetings='';}
1205 update_option('skip_wp_greetings', wp_unslash($skip_wp_greetings));
1206
1207 if( $skip_wp_greetings == '1' || $skip_wp_greetings_donot_show_menu == '1' ){
1208 $ask_email_wp_greetings = '';
1209 $enable_asking_for_email = '';
1210 } else {
1211 if (isset( $_POST["ask_email_wp_greetings"])) {
1212 $ask_email_wp_greetings = sanitize_text_field(wp_unslash($_POST["ask_email_wp_greetings"]));
1213 } else {
1214 $ask_email_wp_greetings = '';
1215 }
1216 if (isset( $_POST["enable_asking_for_email"])) {
1217 $enable_asking_for_email = sanitize_text_field(wp_unslash($_POST["enable_asking_for_email"]));
1218 } else {
1219 $enable_asking_for_email = '';
1220 }
1221 }
1222 update_option('ask_email_wp_greetings', wp_unslash($ask_email_wp_greetings));
1223 update_option('enable_asking_for_email', wp_unslash($enable_asking_for_email));
1224 //Enable /disable wpwbot
1225 if(isset( $_POST["disable_wp_chatbot"])){
1226 $disable_wp_chatbot = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot"]));
1227 }else{ $disable_wp_chatbot='';}
1228 update_option('disable_wp_chatbot', wp_unslash($disable_wp_chatbot));
1229
1230 if(isset( $_POST["qlcd_wp_chatbot_admin_email"])){
1231 $qlcd_wp_chatbot_admin_email = sanitize_email(wp_unslash($_POST["qlcd_wp_chatbot_admin_email"]));
1232 }else{ $qlcd_wp_chatbot_admin_email='';}
1233 update_option('qlcd_wp_chatbot_admin_email', wp_unslash($qlcd_wp_chatbot_admin_email));
1234
1235
1236 if(isset( $_POST["open_links_new_window"])){
1237 $open_links_new_window = sanitize_text_field(wp_unslash($_POST["open_links_new_window"]));
1238 }else{ $open_links_new_window='';}
1239 update_option('open_links_new_window', wp_unslash($open_links_new_window));
1240
1241
1242 if(isset( $_POST["qlcd_wp_chatbot_from_email"])){
1243 $qlcd_wp_chatbot_from_email = sanitize_email(wp_unslash($_POST["qlcd_wp_chatbot_from_email"]));
1244 }else{ $qlcd_wp_chatbot_from_email='';}
1245 update_option('qlcd_wp_chatbot_from_email', wp_unslash($qlcd_wp_chatbot_from_email));
1246
1247 if(isset( $_POST["disable_wp_chatbot_on_mobile"])) {
1248 $disable_wp_chatbot_on_mobile = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_on_mobile"]));
1249 }else{ $disable_wp_chatbot_on_mobile='';}
1250 update_option('disable_wp_chatbot_on_mobile', wp_unslash($disable_wp_chatbot_on_mobile));
1251 if(isset( $_POST["disable_wp_chatbot_product_search"])) {
1252 $disable_wp_chatbot_product_search = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_product_search"]));
1253 }else{ $disable_wp_chatbot_product_search='';}
1254 update_option('disable_wp_chatbot_product_search', wp_unslash($disable_wp_chatbot_product_search));
1255 if(isset( $_POST["disable_wp_chatbot_catalog"])) {
1256 $disable_wp_chatbot_catalog= sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_catalog"]));
1257 }else{ $disable_wp_chatbot_catalog='';}
1258 update_option('disable_wp_chatbot_catalog', wp_unslash($disable_wp_chatbot_catalog));
1259 if(isset( $_POST["disable_wp_chatbot_order_status"])) {
1260 $disable_wp_chatbot_order_status = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_order_status"]));
1261 }else{ $disable_wp_chatbot_order_status='';}
1262 update_option('disable_wp_chatbot_order_status', wp_unslash($disable_wp_chatbot_order_status));
1263 if(isset( $_POST["disable_wp_chatbot_notification"])) {
1264 $disable_wp_chatbot_notification = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_notification"]));
1265 }else{ $disable_wp_chatbot_notification='1';}
1266 update_option('disable_wp_chatbot_notification', wp_unslash($disable_wp_chatbot_notification));
1267
1268 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
1269 $enable_wp_chatbot_rtl = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_rtl"]));
1270 }else{ $enable_wp_chatbot_rtl='';}
1271 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
1272
1273 if(isset( $_POST["chatbot_content_max_height"])) {
1274 $chatbot_content_max_height = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height"]));
1275 }else{ $chatbot_content_max_height='';}
1276 update_option('chatbot_content_max_height', wp_unslash($chatbot_content_max_height));
1277
1278
1279 if(isset( $_POST["chatbot_content_max_height_responsive"])) {
1280 $chatbot_content_max_height_responsive = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height_responsive"]));
1281 }else{ $chatbot_content_max_height_responsive='';}
1282 update_option('chatbot_content_max_height_responsive', wp_unslash($chatbot_content_max_height_responsive));
1283
1284
1285 if(isset( $_POST["show_menu_after_greetings"])) {
1286 $show_menu_after_greetings = sanitize_text_field(wp_unslash($_POST["show_menu_after_greetings"]));
1287 }else{ $show_menu_after_greetings='';}
1288 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
1289
1290 if(isset( $_POST["disable_back_to_start_menu"])) {
1291 $disable_back_to_start_menu = sanitize_text_field(wp_unslash($_POST["disable_back_to_start_menu"]));
1292 }else{ $disable_back_to_start_menu='';}
1293 update_option('disable_back_to_start_menu', wp_unslash($disable_back_to_start_menu));
1294
1295 if(isset( $_POST["enable_chat_session"])) {
1296 $enable_chat_session = sanitize_text_field(wp_unslash($_POST["enable_chat_session"]));
1297 }else{ $enable_chat_session='';}
1298 update_option('enable_chat_session', wp_unslash($enable_chat_session));
1299
1300
1301 if(isset( $_POST["enable_wp_chatbot_mobile_full_screen"])) {
1302 $enable_wp_chatbot_mobile_full_screen = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_mobile_full_screen"]));
1303 }else{ $enable_wp_chatbot_mobile_full_screen='';}
1304 update_option('enable_wp_chatbot_mobile_full_screen', wp_unslash($enable_wp_chatbot_mobile_full_screen));
1305
1306 if(isset( $_POST["wpbot_preloading_time"])) {
1307 $wpbot_preloading_time = sanitize_text_field(wp_unslash($_POST["wpbot_preloading_time"]));
1308 }else{ $wpbot_preloading_time='800';}
1309 update_option('wpbot_preloading_time', wp_unslash($wpbot_preloading_time));
1310
1311 if(isset( $_POST["disable_wp_chatbot_icon_animation"])) {
1312 $disable_wp_chatbot_icon_animation = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_icon_animation"]));
1313 }else{ $disable_wp_chatbot_icon_animation='';}
1314 update_option('disable_wp_chatbot_icon_animation', wp_unslash($disable_wp_chatbot_icon_animation));
1315 //Enable /disable Cart Item Number
1316 if(isset( $_POST["disable_wp_chatbot_cart_item_number"])) {
1317 $disable_wp_chatbot_cart_item_number = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_cart_item_number"]));
1318 }else{ $disable_wp_chatbot_cart_item_number='';}
1319 update_option('disable_wp_chatbot_cart_item_number', wp_unslash($disable_wp_chatbot_cart_item_number));
1320 //Enable /disable featured products button.
1321 if(isset( $_POST["disable_wp_chatbot_featured_product"])) {
1322 $disable_wp_chatbot_featured_product = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_featured_product"]));
1323 }else{ $disable_wp_chatbot_featured_product='';}
1324 update_option('disable_wp_chatbot_featured_product', wp_unslash($disable_wp_chatbot_featured_product));
1325 //Enable /disable sale products button
1326 if(isset( $_POST["disable_wp_chatbot_sale_product"])) {
1327 $disable_wp_chatbot_sale_product = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_sale_product"]));
1328 }else{ $disable_wp_chatbot_sale_product='';}
1329 update_option('disable_wp_chatbot_sale_product', wp_unslash($disable_wp_chatbot_sale_product));
1330 //Enable Product details page.
1331 if(isset( $_POST["wp_chatbot_open_product_detail"])) {
1332 $wp_chatbot_open_product_detail = sanitize_text_field(wp_unslash($_POST["wp_chatbot_open_product_detail"]));
1333 }else{ $wp_chatbot_open_product_detail='';}
1334 update_option('wp_chatbot_open_product_detail', wp_unslash($wp_chatbot_open_product_detail));
1335 //product order and order by
1336 if(isset($_POST['qlcd_wp_chatbot_product_orderby'])){
1337 $qlcd_wp_chatbot_product_orderby = sanitize_text_field(wp_unslash($_POST['qlcd_wp_chatbot_product_orderby']));
1338 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field($qlcd_wp_chatbot_product_orderby));
1339 }
1340 if(isset($_POST['qlcd_wp_chatbot_product_order'])){
1341 $qlcd_wp_chatbot_product_order = sanitize_text_field(wp_unslash($_POST['qlcd_wp_chatbot_product_order']));
1342 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field($qlcd_wp_chatbot_product_order));
1343 }
1344
1345
1346 //Product per page settings.
1347 if (isset($_POST["qlcd_wp_chatbot_ppp"])) {
1348 $qlcd_wp_chatbot_ppp = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_ppp"]));
1349 update_option('qlcd_wp_chatbot_ppp', intval($qlcd_wp_chatbot_ppp));
1350 }
1351 if(isset( $_POST["wp_chatbot_exclude_stock_out_product"])) {
1352 $wp_chatbot_exclude_stock_out_product = sanitize_text_field(wp_unslash($_POST['wp_chatbot_exclude_stock_out_product']));
1353 }else{ $wp_chatbot_exclude_stock_out_product='';}
1354 update_option('wp_chatbot_exclude_stock_out_product', wp_unslash($wp_chatbot_exclude_stock_out_product));
1355 if(isset( $_POST["wp_chatbot_show_parent_category"])) {
1356 $wp_chatbot_show_parent_category = sanitize_text_field(wp_unslash($_POST['wp_chatbot_show_parent_category']));
1357 }else{ $wp_chatbot_show_parent_category='';}
1358 update_option('wp_chatbot_show_parent_category', wp_unslash($wp_chatbot_show_parent_category));
1359 if(isset( $_POST["wp_chatbot_show_sub_category"])) {
1360 $wp_chatbot_show_sub_category = sanitize_text_field(wp_unslash($_POST['wp_chatbot_show_sub_category']));
1361 }else{ $wp_chatbot_show_sub_category='';}
1362 update_option('wp_chatbot_show_sub_category', wp_unslash($wp_chatbot_show_sub_category));
1363 if (isset($_POST["qlcd_wp_chatbot_order_user"])) {
1364 $qlcd_wp_chatbot_order_user = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_order_user"]));
1365 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field($qlcd_wp_chatbot_order_user));
1366 }
1367
1368 if(isset( $_POST["qc_wpbot_menu_order"]) && !empty($_POST["qc_wpbot_menu_order"])) {
1369 $qc_wpbot_menu_order = wp_kses_post(wp_unslash($_POST["qc_wpbot_menu_order"]));
1370 }else{ $qc_wpbot_menu_order='';}
1371 update_option('qc_wpbot_menu_order', ($qc_wpbot_menu_order));
1372
1373 //wpwBot Load control
1374 if(isset($_POST["wp_chatbot_show_home_page"])){
1375 $wp_chatbot_show_home_page = sanitize_key((wp_unslash($_POST["wp_chatbot_show_home_page"])));
1376 update_option('wp_chatbot_show_home_page', $wp_chatbot_show_home_page);
1377 }
1378
1379
1380 if(isset($_POST["wp_chatbot_show_posts"])){
1381 $wp_chatbot_show_posts = sanitize_key((wp_unslash($_POST["wp_chatbot_show_posts"])));
1382 update_option('wp_chatbot_show_posts', $wp_chatbot_show_posts);
1383 }
1384
1385
1386 if(isset($_POST["wp_chatbot_show_pages"])){
1387 $wp_chatbot_show_pages = sanitize_key((wp_unslash($_POST["wp_chatbot_show_pages"])));
1388 update_option('wp_chatbot_show_pages', $wp_chatbot_show_pages);
1389 }
1390
1391 if(isset( $_POST["wp_chatbot_show_pages_list"])) {
1392 $wp_chatbot_show_pages_list = wp_parse_id_list(wp_unslash($_POST["wp_chatbot_show_pages_list"]));
1393 update_option('wp_chatbot_show_pages_list', maybe_serialize(sanitize_array($wp_chatbot_show_pages_list)));
1394 }else{
1395 $wp_chatbot_show_pages_list='';
1396 update_option('wp_chatbot_show_pages_list', maybe_serialize(sanitize_array($wp_chatbot_show_pages_list)));
1397 }
1398 if(isset( $_POST["wp_chatbot_exclude_post_list"])) {
1399 $wp_chatbot_exclude_post_list = wp_unslash($_POST["wp_chatbot_exclude_post_list"]);
1400 update_option('wp_chatbot_exclude_post_list', maybe_serialize(sanitize_array($wp_chatbot_exclude_post_list)));
1401 }else{
1402 $wp_chatbot_exclude_post_list='';
1403 update_option('wp_chatbot_exclude_post_list', maybe_serialize(sanitize_array($wp_chatbot_exclude_post_list)));
1404 }
1405
1406 if(isset($_POST["wp_chatbot_show_wpcommerce"])){
1407 $wp_chatbot_show_wpcommerce = sanitize_key((wp_unslash($_POST["wp_chatbot_show_wpcommerce"])));
1408 update_option('wp_chatbot_show_wpcommerce', $wp_chatbot_show_wpcommerce);
1409 }
1410
1411
1412 //Stop Words Settings
1413 if (isset($_POST["qlcd_wp_chatbot_stop_words_name"])) {
1414 $qlcd_wp_chatbot_stop_words_name = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_stop_words_name"]));
1415 update_option('qlcd_wp_chatbot_stop_words_name', $qlcd_wp_chatbot_stop_words_name);
1416 }
1417 if (isset($_POST["qlcd_wp_chatbot_stop_words"])) {
1418 $qlcd_wp_chatbot_stop_words = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_stop_words"]));
1419 update_option('qlcd_wp_chatbot_stop_words', $qlcd_wp_chatbot_stop_words);
1420 }
1421 //wpwbot icon settings.
1422 $wp_chatbot_icon = isset( $_POST['wp_chatbot_icon'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_icon'])) : 'icon-3.png';
1423 update_option('wp_chatbot_icon', $wp_chatbot_icon);
1424
1425 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_floatingiconbg_color'])) : '#fff';
1426 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
1427
1428 // Custom icon video / YouTube link
1429 $wp_chatbot_icon_youtube_url = isset( $_POST['wp_chatbot_icon_youtube_url'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_youtube_url'] ) : '';
1430 $wp_chatbot_icon_video_upload = isset( $_POST['wp_chatbot_icon_video'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_video'] ) : '';
1431 // YouTube URL takes priority; fall back to uploaded video
1432 $wp_chatbot_icon_video = ( $wp_chatbot_icon_youtube_url !== '' ) ? $wp_chatbot_icon_youtube_url : $wp_chatbot_icon_video_upload;
1433 update_option( 'wp_chatbot_icon_video', $wp_chatbot_icon_video );
1434 $wp_chatbot_icon_video_delay = isset( $_POST['wp_chatbot_icon_video_delay'] ) ? absint( $_POST['wp_chatbot_icon_video_delay'] ) : 0;
1435 update_option( 'wp_chatbot_icon_video_delay', $wp_chatbot_icon_video_delay );
1436
1437 // upload custom wpwbot icon path
1438 $wp_chatbot_custom_icon_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_icon_path']));
1439 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
1440 //Agent image
1441 //wpwbot icon settings.
1442 $wp_chatbot_icon = (isset($_POST['wp_chatbot_agent_image']) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_agent_image'])) : 'agent-13.png');
1443 update_option('wp_chatbot_agent_image', $wp_chatbot_icon);
1444 // upload custom wpwbot icon
1445 if(isset($_POST['wp_chatbot_custom_agent_path'])){
1446 $wp_chatbot_custom_agent_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_agent_path']));
1447 update_option('wp_chatbot_custom_agent_path', $wp_chatbot_custom_agent_path);
1448 }
1449
1450 //Theming
1451 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field(wp_unslash($_POST['qcld_wb_chatbot_theme'])) : 'template-00');
1452 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
1453
1454 //Avatar Location
1455 if(isset($_POST['qcld_chatbot_avatar_location'])) {
1456 $qcld_chatbot_avatar_location = sanitize_text_field(wp_unslash($_POST['qcld_chatbot_avatar_location']));
1457 update_option('qcld_chatbot_avatar_location', $qcld_chatbot_avatar_location);
1458 }
1459 //Theme custom background option
1460 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
1461 $qcld_wb_chatbot_change_bg = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_change_bg"]));
1462 }else{$qcld_wb_chatbot_change_bg='';}
1463 update_option('qcld_wb_chatbot_change_bg', $qcld_wb_chatbot_change_bg);
1464 if(isset($_POST["qcld_wb_chatbot_board_bg_path"])){
1465 $qcld_wb_chatbot_board_bg_path = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_board_bg_path"]));
1466 update_option('qcld_wb_chatbot_board_bg_path', wp_unslash($qcld_wb_chatbot_board_bg_path));
1467 }
1468
1469
1470
1471 //To override style use custom css.
1472 if(isset($_POST["wp_chatbot_custom_css"])){
1473 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
1474 update_option('wp_chatbot_custom_css', sanitize_textarea_field($wp_chatbot_custom_css));
1475 }
1476
1477 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_id"])) {
1478 $qlcd_wp_chatbot_dialogflow_project_id = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_id"]));
1479 } else {
1480 $qlcd_wp_chatbot_dialogflow_project_id = '';
1481 }
1482 update_option('qlcd_wp_chatbot_dialogflow_project_id', $qlcd_wp_chatbot_dialogflow_project_id);
1483
1484 if (isset($_POST["wp_chatbot_df_api"])) {
1485 $wp_chatbot_df_api = sanitize_text_field(wp_unslash($_POST["wp_chatbot_df_api"]));
1486 } else {
1487 $wp_chatbot_df_api = '';
1488 }
1489 update_option('wp_chatbot_df_api', $wp_chatbot_df_api);
1490
1491 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_key"])) {
1492 $qlcd_wp_chatbot_dialogflow_project_key = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_key"]));
1493 } else {
1494 $qlcd_wp_chatbot_dialogflow_project_key = '';
1495 }
1496 update_option('qlcd_wp_chatbot_dialogflow_project_key', $qlcd_wp_chatbot_dialogflow_project_key);
1497
1498 /****Language center settings. ****/
1499 //identity
1500 if (isset($_POST["qlcd_wp_chatbot_host"])) {
1501 $qlcd_wp_chatbot_host = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_host"]));
1502 } else {
1503 $qlcd_wp_chatbot_host = '';
1504 }
1505 update_option('qlcd_wp_chatbot_host', $qlcd_wp_chatbot_host);
1506
1507 if (isset($_POST["qlcd_wp_chatbot_agent"])) {
1508 $qlcd_wp_chatbot_agent = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_agent"]));
1509 } else {
1510 $qlcd_wp_chatbot_agent = '';
1511 }
1512 update_option('qlcd_wp_chatbot_agent', $qlcd_wp_chatbot_agent);
1513
1514 if (isset($_POST["qlcd_wp_chatbot_shopper_demo_name"])) {
1515 $qlcd_wp_chatbot_shopper_demo_name = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_shopper_demo_name"]));
1516 } else {
1517 $qlcd_wp_chatbot_shopper_demo_name = '';
1518 }
1519 update_option('qlcd_wp_chatbot_shopper_demo_name', $qlcd_wp_chatbot_shopper_demo_name);
1520
1521 if (isset($_POST["qlcd_wp_chatbot_yes"])) {
1522 $qlcd_wp_chatbot_yes = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_yes"]));
1523 } else {
1524 $qlcd_wp_chatbot_yes = '';
1525 }
1526 update_option('qlcd_wp_chatbot_yes', $qlcd_wp_chatbot_yes);
1527
1528 if (isset($_POST["qlcd_wp_chatbot_no"])) {
1529 $qlcd_wp_chatbot_no = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_no"]));
1530 } else {
1531 $qlcd_wp_chatbot_no = '';
1532 }
1533 update_option('qlcd_wp_chatbot_no', $qlcd_wp_chatbot_no);
1534
1535 if (isset($_POST["qlcd_wp_chatbot_or"])) {
1536 $qlcd_wp_chatbot_or = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_or"]));
1537 } else {
1538 $qlcd_wp_chatbot_or = '';
1539 }
1540 update_option('qlcd_wp_chatbot_or', $qlcd_wp_chatbot_or);
1541
1542 if (isset($_POST["qlcd_wp_chatbot_sorry"])) {
1543 $qlcd_wp_chatbot_sorry = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sorry"]));
1544 } else {
1545 $qlcd_wp_chatbot_sorry = '';
1546 }
1547 update_option('qlcd_wp_chatbot_sorry', $qlcd_wp_chatbot_sorry);
1548
1549 if (isset($_POST["skip_chat_reactions_menu"])) {
1550 $skip_chat_reactions_menu = sanitize_text_field(wp_unslash($_POST["skip_chat_reactions_menu"]));
1551 } else {
1552 $skip_chat_reactions_menu = '';
1553 }
1554 update_option('skip_chat_reactions_menu', $skip_chat_reactions_menu);
1555
1556 if (isset($_POST["qlcd_wp_chatbot_report_text"])) {
1557 $qlcd_wp_chatbot_report_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_report_text"]));
1558 } else {
1559 $qlcd_wp_chatbot_report_text = '';
1560 }
1561 update_option('qlcd_wp_chatbot_report_text', $qlcd_wp_chatbot_report_text);
1562
1563 if (isset($_POST["qlcd_wp_chatbot_report_text"])) {
1564 $qlcd_wp_chatbot_report_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_report_text"]));
1565 } else {
1566 $qlcd_wp_chatbot_report_text = '';
1567 }
1568 update_option('qlcd_wp_chatbot_report_text', $qlcd_wp_chatbot_report_text);
1569
1570 if (isset($_POST["enable_chat_report_menu"])) {
1571 $enable_chat_report_menu = sanitize_text_field(wp_unslash($_POST["enable_chat_report_menu"]));
1572 } else {
1573 $enable_chat_report_menu = '';
1574 }
1575 update_option('enable_chat_report_menu', $enable_chat_report_menu);
1576
1577 if (isset($_POST["qlcd_wp_chatbot_like_text"])) {
1578 $qlcd_wp_chatbot_like_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_like_text"]));
1579 } else {
1580 $qlcd_wp_chatbot_like_text = '';
1581 }
1582 update_option('qlcd_wp_chatbot_like_text', $qlcd_wp_chatbot_like_text);
1583
1584 if (isset($_POST["qlcd_wp_chatbot_dislike_text"])) {
1585 $qlcd_wp_chatbot_dislike_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dislike_text"]));
1586 } else {
1587 $qlcd_wp_chatbot_dislike_text = '';
1588 }
1589 update_option('qlcd_wp_chatbot_dislike_text', $qlcd_wp_chatbot_dislike_text);
1590
1591 if (isset($_POST["enable_chat_share_menu"])) {
1592 $enable_chat_share_menu = sanitize_text_field(wp_unslash($_POST["enable_chat_share_menu"]));
1593 } else {
1594 $enable_chat_share_menu = '';
1595 }
1596 update_option('enable_chat_share_menu', $enable_chat_share_menu);
1597
1598 if (isset($_POST["qlcd_wp_chatbot_share_text"])) {
1599 $qlcd_wp_chatbot_share_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_share_text"]));
1600 } else {
1601 $qlcd_wp_chatbot_share_text = '';
1602 }
1603 update_option('qlcd_wp_chatbot_share_text', $qlcd_wp_chatbot_share_text);
1604
1605 if (isset($_POST["qlcd_wp_chatbot_agent_join"])) {
1606 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1607 $qlcd_wp_chatbot_agent_join = wp_unslash($_POST["qlcd_wp_chatbot_agent_join"]);
1608 $qlcd_wp_chatbot_agent_join = sanitize_array($qlcd_wp_chatbot_agent_join);
1609 } else {
1610 $qlcd_wp_chatbot_agent_join = array();
1611 }
1612 update_option('qlcd_wp_chatbot_agent_join', maybe_serialize($qlcd_wp_chatbot_agent_join));
1613
1614 //Greeting.
1615 if (isset($_POST["qlcd_wp_chatbot_welcome"])) {
1616 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1617 $qlcd_wp_chatbot_welcome = wp_unslash($_POST["qlcd_wp_chatbot_welcome"]);
1618 $qlcd_wp_chatbot_welcome = sanitize_array($qlcd_wp_chatbot_welcome);
1619 } else {
1620 $qlcd_wp_chatbot_welcome = array();
1621 }
1622 update_option('qlcd_wp_chatbot_welcome', maybe_serialize($qlcd_wp_chatbot_welcome));
1623
1624 if (isset($_POST["qlcd_wp_chatbot_back_to_start"])) {
1625 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1626 $qlcd_wp_chatbot_back_to_start = wp_unslash($_POST["qlcd_wp_chatbot_back_to_start"]);
1627 $qlcd_wp_chatbot_back_to_start = sanitize_array($qlcd_wp_chatbot_back_to_start);
1628 } else {
1629 $qlcd_wp_chatbot_back_to_start = array();
1630 }
1631 update_option('qlcd_wp_chatbot_back_to_start', maybe_serialize($qlcd_wp_chatbot_back_to_start));
1632
1633 if (isset($_POST["qlcd_wp_chatbot_hi_there"])) {
1634 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1635 $qlcd_wp_chatbot_hi_there = wp_unslash($_POST["qlcd_wp_chatbot_hi_there"]);
1636 $qlcd_wp_chatbot_hi_there = sanitize_array($qlcd_wp_chatbot_hi_there);
1637 } else {
1638 $qlcd_wp_chatbot_hi_there = array();
1639 }
1640 update_option('qlcd_wp_chatbot_hi_there', maybe_serialize($qlcd_wp_chatbot_hi_there));
1641
1642 if (isset($_POST["qlcd_wp_chatbot_hello"])) {
1643 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1644 $qlcd_wp_chatbot_hello = wp_unslash($_POST["qlcd_wp_chatbot_hello"]);
1645 $qlcd_wp_chatbot_hello = sanitize_array($qlcd_wp_chatbot_hello);
1646 } else {
1647 $qlcd_wp_chatbot_hello = array();
1648 }
1649 update_option('qlcd_wp_chatbot_hello', maybe_serialize($qlcd_wp_chatbot_hello));
1650
1651 if (isset($_POST["qlcd_wp_chatbot_welcome_back"])) {
1652 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1653 $qlcd_wp_chatbot_welcome_back = wp_unslash( $_POST["qlcd_wp_chatbot_welcome_back"] );
1654 $qlcd_wp_chatbot_welcome_back = sanitize_array( $qlcd_wp_chatbot_welcome_back );
1655 } else {
1656 $qlcd_wp_chatbot_welcome_back = array();
1657 }
1658 update_option('qlcd_wp_chatbot_welcome_back', maybe_serialize($qlcd_wp_chatbot_welcome_back));
1659
1660 if (isset($_POST["qlcd_wp_chatbot_asking_name"])) {
1661 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1662 $qlcd_wp_chatbot_asking_name = wp_unslash( $_POST["qlcd_wp_chatbot_asking_name"] );
1663 $qlcd_wp_chatbot_asking_name = sanitize_array( $qlcd_wp_chatbot_asking_name );
1664 } else {
1665 $qlcd_wp_chatbot_asking_name = array();
1666 }
1667 update_option('qlcd_wp_chatbot_asking_name', maybe_serialize($qlcd_wp_chatbot_asking_name));
1668
1669 if (isset($_POST["qlcd_wp_chatbot_name_greeting"])) {
1670 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1671 $qlcd_wp_chatbot_name_greeting = wp_unslash( $_POST["qlcd_wp_chatbot_name_greeting"] );
1672 $qlcd_wp_chatbot_name_greeting = sanitize_array( $qlcd_wp_chatbot_name_greeting );
1673 } else {
1674 $qlcd_wp_chatbot_name_greeting = array();
1675 }
1676 update_option('qlcd_wp_chatbot_name_greeting', maybe_serialize($qlcd_wp_chatbot_name_greeting));
1677
1678 if (isset($_POST["qlcd_wp_chatbot_i_am"])) {
1679 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1680 $qlcd_wp_chatbot_i_am = wp_unslash( $_POST["qlcd_wp_chatbot_i_am"] );
1681 $qlcd_wp_chatbot_i_am = sanitize_array( $qlcd_wp_chatbot_i_am );
1682 } else {
1683 $qlcd_wp_chatbot_i_am = array();
1684 }
1685 update_option('qlcd_wp_chatbot_i_am', maybe_serialize($qlcd_wp_chatbot_i_am));
1686
1687 if (isset($_POST["qlcd_wp_chatbot_is_typing"])) {
1688 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1689 $qlcd_wp_chatbot_is_typing = wp_unslash( $_POST["qlcd_wp_chatbot_is_typing"] );
1690 $qlcd_wp_chatbot_is_typing = sanitize_array( $qlcd_wp_chatbot_is_typing );
1691 } else {
1692 $qlcd_wp_chatbot_is_typing = array();
1693 }
1694 update_option('qlcd_wp_chatbot_is_typing', maybe_serialize($qlcd_wp_chatbot_is_typing));
1695
1696 if (isset($_POST["qlcd_wp_chatbot_send_a_msg"])) {
1697 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1698 $qlcd_wp_chatbot_send_a_msg = wp_unslash( $_POST["qlcd_wp_chatbot_send_a_msg"] );
1699 $qlcd_wp_chatbot_send_a_msg = sanitize_array( $qlcd_wp_chatbot_send_a_msg );
1700 } else {
1701 $qlcd_wp_chatbot_send_a_msg = array();
1702 }
1703 update_option('qlcd_wp_chatbot_send_a_msg', maybe_serialize($qlcd_wp_chatbot_send_a_msg));
1704
1705 if (isset($_POST["qlcd_wp_chatbot_choose_option"])) {
1706 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1707 $qlcd_wp_chatbot_choose_option = wp_unslash( $_POST["qlcd_wp_chatbot_choose_option"] );
1708 $qlcd_wp_chatbot_choose_option = sanitize_array( $qlcd_wp_chatbot_choose_option );
1709 } else {
1710 $qlcd_wp_chatbot_choose_option = array();
1711 }
1712 update_option('qlcd_wp_chatbot_choose_option', maybe_serialize($qlcd_wp_chatbot_choose_option));
1713
1714 if (isset($_POST["qlcd_wp_chatbot_viewed_products"])) {
1715
1716 $qlcd_wp_chatbot_viewed_products = wp_unslash( $_POST["qlcd_wp_chatbot_viewed_products"] );
1717 $qlcd_wp_chatbot_viewed_products = sanitize_array( $qlcd_wp_chatbot_viewed_products );
1718 } else {
1719 $qlcd_wp_chatbot_viewed_products = array();
1720 }
1721 update_option('qlcd_wp_chatbot_viewed_products', maybe_serialize($qlcd_wp_chatbot_viewed_products));
1722
1723 if(isset($_POST["qlcd_wp_chatbot_shopping_cart"])){
1724 $qlcd_wp_chatbot_shopping_cart= esc_html((@wp_unslash($_POST["qlcd_wp_chatbot_shopping_cart"])));
1725 update_option('qlcd_wp_chatbot_shopping_cart', maybe_serialize(sanitize_array($qlcd_wp_chatbot_shopping_cart)));
1726 }
1727
1728 if(isset($_POST["qlcd_wp_chatbot_add_to_cart"])){
1729 $qlcd_wp_chatbot_add_to_cart= (@wp_unslash($_POST["qlcd_wp_chatbot_add_to_cart"]));
1730 update_option('qlcd_wp_chatbot_add_to_cart', maybe_serialize(sanitize_array($qlcd_wp_chatbot_add_to_cart)));
1731 }
1732 if(isset($_POST["qlcd_wp_chatbot_cart_link"])){
1733 $qlcd_wp_chatbot_cart_link= @wp_unslash($_POST["qlcd_wp_chatbot_cart_link"]);
1734 update_option('qlcd_wp_chatbot_cart_link', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_link)));
1735 }
1736 if(isset($_POST["qlcd_wp_chatbot_checkout_link"])){
1737 $qlcd_wp_chatbot_checkout_link= @wp_unslash($_POST["qlcd_wp_chatbot_checkout_link"]);
1738 update_option('qlcd_wp_chatbot_checkout_link', maybe_serialize(sanitize_array($qlcd_wp_chatbot_checkout_link)));
1739 }
1740 if(isset($_POST["qlcd_wp_chatbot_cart_welcome"])){
1741 $qlcd_wp_chatbot_cart_welcome= (@wp_unslash($_POST["qlcd_wp_chatbot_cart_welcome"]));
1742 update_option('qlcd_wp_chatbot_cart_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_welcome)));
1743 }
1744 if(isset($_POST["qlcd_wp_chatbot_featured_product_welcome"])){
1745 $qlcd_wp_chatbot_featured_product_welcome= @wp_unslash($_POST["qlcd_wp_chatbot_featured_product_welcome"]);
1746 update_option('qlcd_wp_chatbot_featured_product_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_featured_product_welcome)));
1747 }
1748
1749 if(isset($_POST["qlcd_wp_chatbot_viewed_product_welcome"])){
1750 $qlcd_wp_chatbot_viewed_product_welcome= @wp_unslash($_POST["qlcd_wp_chatbot_viewed_product_welcome"]);
1751 update_option('qlcd_wp_chatbot_viewed_product_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_viewed_product_welcome)));
1752 }
1753 if(isset($_POST["qlcd_wp_chatbot_latest_product_welcome"])){
1754 $qlcd_wp_chatbot_latest_product_welcome= @wp_unslash($_POST["qlcd_wp_chatbot_latest_product_welcome"]);
1755 update_option('qlcd_wp_chatbot_latest_product_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_latest_product_welcome)));
1756 }
1757
1758 if(isset($_POST["qlcd_wp_chatbot_cart_title"])){
1759 $qlcd_wp_chatbot_cart_title= @wp_unslash($_POST["qlcd_wp_chatbot_cart_title"]);
1760 update_option('qlcd_wp_chatbot_cart_title', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_title)));
1761 }
1762 if(isset($_POST["qlcd_wp_chatbot_cart_quantity"])){
1763 $qlcd_wp_chatbot_cart_quantity= @wp_unslash($_POST["qlcd_wp_chatbot_cart_quantity"]);
1764 update_option('qlcd_wp_chatbot_cart_quantity', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_quantity)));
1765 }
1766 if(isset($_POST["qlcd_wp_chatbot_cart_price"])){
1767 $qlcd_wp_chatbot_cart_price= @wp_unslash($_POST["qlcd_wp_chatbot_cart_price"]);
1768 update_option('qlcd_wp_chatbot_cart_price', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_price)));
1769 }
1770 if(isset($_POST["qlcd_wp_chatbot_no_cart_items"])){
1771 $qlcd_wp_chatbot_no_cart_items= wp_unslash(@$_POST["qlcd_wp_chatbot_no_cart_items"]);
1772 update_option('qlcd_wp_chatbot_no_cart_items', maybe_serialize(sanitize_array($qlcd_wp_chatbot_no_cart_items)));
1773 }
1774 if(isset($_POST["qlcd_wp_chatbot_cart_updating"])){
1775 $qlcd_wp_chatbot_cart_updating= @wp_unslash($_POST["qlcd_wp_chatbot_cart_updating"]);
1776 update_option('qlcd_wp_chatbot_cart_updating', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_updating)));
1777 }
1778 if(isset($_POST["qlcd_wp_chatbot_cart_removing"])){
1779 $qlcd_wp_chatbot_cart_removing= @wp_unslash($_POST["qlcd_wp_chatbot_cart_removing"]);
1780 update_option('qlcd_wp_chatbot_cart_removing', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_removing)));
1781 }
1782 //wpwBot wildcard settings
1783 if (isset($_POST["qlcd_wp_chatbot_wildcard_msg"])) {
1784 $qlcd_wp_chatbot_wildcard_msg = wp_unslash( $_POST["qlcd_wp_chatbot_wildcard_msg"] );
1785 $qlcd_wp_chatbot_wildcard_msg = sanitize_array( $qlcd_wp_chatbot_wildcard_msg );
1786
1787 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize($qlcd_wp_chatbot_wildcard_msg));
1788 } else {
1789 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize(array()));
1790 }
1791 //empty filter message repeat.
1792 if (isset($_POST["qlcd_wp_chatbot_empty_filter_msg"])) {
1793 $qlcd_wp_chatbot_empty_filter_msg = wp_unslash( $_POST["qlcd_wp_chatbot_empty_filter_msg"] );
1794 $qlcd_wp_chatbot_empty_filter_msg = sanitize_array( $qlcd_wp_chatbot_empty_filter_msg );
1795
1796 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize($qlcd_wp_chatbot_empty_filter_msg));
1797 } else {
1798 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize(array()));
1799 }
1800
1801 if (isset($_POST["qlcd_wp_chatbot_did_you_mean"])) {
1802 $qlcd_wp_chatbot_did_you_mean = wp_unslash( $_POST["qlcd_wp_chatbot_did_you_mean"] );
1803 $qlcd_wp_chatbot_did_you_mean = sanitize_array( $qlcd_wp_chatbot_did_you_mean );
1804 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize($qlcd_wp_chatbot_did_you_mean));
1805 } else {
1806 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array()));
1807 }
1808 //help welcome and message
1809 if (isset($_POST["qlcd_wp_chatbot_help_welcome"])) {
1810 $qlcd_wp_chatbot_help_welcome = wp_unslash( $_POST["qlcd_wp_chatbot_help_welcome"] );
1811 $qlcd_wp_chatbot_help_welcome = sanitize_array( $qlcd_wp_chatbot_help_welcome );
1812 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize($qlcd_wp_chatbot_help_welcome));
1813 } else {
1814 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize(array()));
1815 }
1816 if (isset($_POST["qlcd_wp_chatbot_help_msg"])) {
1817 $qlcd_wp_chatbot_help_msg = wp_unslash( $_POST["qlcd_wp_chatbot_help_msg"] );
1818 $qlcd_wp_chatbot_help_msg = sanitize_array( $qlcd_wp_chatbot_help_msg );
1819 update_option('qlcd_wp_chatbot_help_msg', maybe_serialize($qlcd_wp_chatbot_help_msg));
1820 } else {
1821 update_option('qlcd_wp_chatbot_help_msg', maybe_serialize(array()));
1822 }
1823 //To clear Conversation history.
1824 if (isset($_POST["qlcd_wp_chatbot_reset"])) {
1825 $qlcd_wp_chatbot_reset = wp_unslash( $_POST["qlcd_wp_chatbot_reset"] );
1826 $qlcd_wp_chatbot_reset = sanitize_array( $qlcd_wp_chatbot_reset );
1827 update_option('qlcd_wp_chatbot_reset', maybe_serialize($qlcd_wp_chatbot_reset));
1828 } else {
1829 update_option('qlcd_wp_chatbot_reset', maybe_serialize(array()));
1830 }
1831 //systems keyword.
1832 if (isset($_POST["qlcd_wp_chatbot_sys_key_help"])) {
1833 $qlcd_wp_chatbot_sys_key_help = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_help"]));
1834 update_option('qlcd_wp_chatbot_sys_key_help', $qlcd_wp_chatbot_sys_key_help);
1835 } else {
1836 update_option('qlcd_wp_chatbot_sys_key_help', '');
1837 }
1838 if(isset($_POST["qlcd_wp_chatbot_sys_key_product"])){
1839 $qlcd_wp_chatbot_sys_key_product = esc_html((@wp_unslash($_POST["qlcd_wp_chatbot_sys_key_product"])));
1840 update_option('qlcd_wp_chatbot_sys_key_product', sanitize_text_field($qlcd_wp_chatbot_sys_key_product));
1841 }
1842 if(isset($_POST["qlcd_wp_chatbot_sys_key_catalog"])){
1843 $qlcd_wp_chatbot_sys_key_catalog = (@wp_unslash($_POST["qlcd_wp_chatbot_sys_key_catalog"]));
1844 update_option('qlcd_wp_chatbot_sys_key_catalog', sanitize_text_field($qlcd_wp_chatbot_sys_key_catalog));
1845 }
1846 if(isset($_POST["qlcd_wp_chatbot_sys_key_order"])){
1847 $qlcd_wp_chatbot_sys_key_order = (@wp_unslash($_POST["qlcd_wp_chatbot_sys_key_order"]));
1848 update_option('qlcd_wp_chatbot_sys_key_order', sanitize_text_field($qlcd_wp_chatbot_sys_key_order));
1849 }
1850 if (isset($_POST["qlcd_wp_chatbot_sys_key_support"])) {
1851 $qlcd_wp_chatbot_sys_key_support = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_support"]));
1852 update_option('qlcd_wp_chatbot_sys_key_support', $qlcd_wp_chatbot_sys_key_support);
1853 } else {
1854 update_option('qlcd_wp_chatbot_sys_key_support', '');
1855 }
1856 if (isset($_POST["qlcd_wp_chatbot_sys_key_reset"])) {
1857 $qlcd_wp_chatbot_sys_key_reset = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_reset"]));
1858 update_option('qlcd_wp_chatbot_sys_key_reset', $qlcd_wp_chatbot_sys_key_reset);
1859 } else {
1860 update_option('qlcd_wp_chatbot_sys_key_reset', '');
1861 }
1862 if (isset($_POST["qlcd_wp_chatbot_sys_key_email"])) {
1863 $qlcd_wp_chatbot_sys_key_email = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_email"]));
1864 update_option('qlcd_wp_chatbot_sys_key_email', $qlcd_wp_chatbot_sys_key_email);
1865 } else {
1866 update_option('qlcd_wp_chatbot_sys_key_email', '');
1867 }
1868 if(isset($_POST["qlcd_wp_chatbot_wildcard_product"])){
1869 $qlcd_wp_chatbot_wildcard_product = (@wp_unslash($_POST["qlcd_wp_chatbot_wildcard_product"]));
1870 update_option('qlcd_wp_chatbot_wildcard_product', maybe_serialize(sanitize_array($qlcd_wp_chatbot_wildcard_product)));
1871 }
1872 if(isset($_POST["qlcd_wp_chatbot_wildcard_catalog"])){
1873 $qlcd_wp_chatbot_wildcard_catalog = (@wp_unslash($_POST["qlcd_wp_chatbot_wildcard_catalog"]));
1874 update_option('qlcd_wp_chatbot_wildcard_catalog', maybe_serialize(sanitize_array($qlcd_wp_chatbot_wildcard_catalog)));
1875 }
1876 if(isset($_POST["qlcd_wp_chatbot_featured_products"])){
1877 $qlcd_wp_chatbot_featured_products = (@wp_unslash($_POST["qlcd_wp_chatbot_featured_products"]));
1878 update_option('qlcd_wp_chatbot_featured_products', maybe_serialize(sanitize_array($qlcd_wp_chatbot_featured_products)));
1879 }
1880 if(isset($_POST["qlcd_wp_chatbot_sale_products"])){
1881 $qlcd_wp_chatbot_sale_products = (@wp_unslash($_POST["qlcd_wp_chatbot_sale_products"]));
1882 update_option('qlcd_wp_chatbot_sale_products', maybe_serialize(sanitize_array($qlcd_wp_chatbot_sale_products)));
1883 }
1884
1885 if (isset($_POST["qlcd_wp_chatbot_wildcard_support"])) {
1886 $qlcd_wp_chatbot_wildcard_support = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_wildcard_support"]));
1887 update_option('qlcd_wp_chatbot_wildcard_support', $qlcd_wp_chatbot_wildcard_support);
1888 } else {
1889 update_option('qlcd_wp_chatbot_wildcard_support', '');
1890 }
1891
1892 if (isset($_POST["qlcd_wp_chatbot_wildcard_site_search"])) {
1893 $qlcd_wp_chatbot_wildcard_site_search = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_wildcard_site_search"]));
1894 update_option('qlcd_wp_chatbot_wildcard_site_search', $qlcd_wp_chatbot_wildcard_site_search);
1895 } else {
1896 update_option('qlcd_wp_chatbot_wildcard_site_search', '');
1897 }
1898
1899 if(isset($_POST["qlcd_wp_chatbot_messenger_label"])){
1900 $qlcd_wp_chatbot_messenger_label = (@wp_unslash($_POST["qlcd_wp_chatbot_messenger_label"]));
1901 update_option('qlcd_wp_chatbot_messenger_label', maybe_serialize(sanitize_array($qlcd_wp_chatbot_messenger_label)));
1902 }
1903 //Products search .
1904 if (isset($_POST["qlcd_wp_chatbot_product_success"])) {
1905 // Unslash the input first, then sanitize deeply as text, assuming it's an array of texts or a single text.
1906 $unslashed_data = wp_unslash($_POST["qlcd_wp_chatbot_product_success"]);
1907 $qlcd_wp_chatbot_product_success = map_deep($unslashed_data, 'sanitize_text_field');
1908 update_option('qlcd_wp_chatbot_product_success', maybe_serialize($qlcd_wp_chatbot_product_success));
1909 }
1910 if (isset($_POST["qlcd_wp_chatbot_product_fail"])) {
1911 $qlcd_wp_chatbot_product_fail = @wp_unslash($_POST["qlcd_wp_chatbot_product_fail"]);
1912 update_option('qlcd_wp_chatbot_product_fail', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_fail)));
1913 }
1914 if(isset($_POST["qlcd_wp_chatbot_product_asking"])){
1915 $qlcd_wp_chatbot_product_asking = @wp_unslash($_POST["qlcd_wp_chatbot_product_asking"]);
1916 update_option('qlcd_wp_chatbot_product_asking', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_asking)));
1917 }
1918 if(isset($_POST["qlcd_wp_chatbot_product_suggest"])){
1919 $qlcd_wp_chatbot_product_suggest = @wp_unslash($_POST["qlcd_wp_chatbot_product_suggest"]);
1920 update_option('qlcd_wp_chatbot_product_suggest', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_suggest)));
1921 }
1922 if(isset($_POST["qlcd_wp_chatbot_product_infinite"])){
1923 $qlcd_wp_chatbot_product_infinite = @wp_unslash($_POST["qlcd_wp_chatbot_product_infinite"]);
1924 update_option('qlcd_wp_chatbot_product_infinite', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_infinite)));
1925 }
1926 if(isset($_POST["qlcd_wp_chatbot_load_more"])){
1927 $qlcd_wp_chatbot_load_more = @wp_unslash($_POST["qlcd_wp_chatbot_load_more"]);
1928 update_option('qlcd_wp_chatbot_load_more', maybe_serialize(sanitize_array($qlcd_wp_chatbot_load_more)));
1929 }
1930 //Order
1931 if(isset($_POST["qlcd_wp_chatbot_wildcard_order"])){
1932 $qlcd_wp_chatbot_wildcard_order = @wp_unslash($_POST["qlcd_wp_chatbot_wildcard_order"]);
1933 update_option('qlcd_wp_chatbot_wildcard_order', maybe_serialize(sanitize_array($qlcd_wp_chatbot_wildcard_order)));
1934 }
1935 if(isset($_POST["qlcd_wp_chatbot_order_welcome"])){
1936 $qlcd_wp_chatbot_order_welcome = @wp_unslash($_POST["qlcd_wp_chatbot_order_welcome"]);
1937 update_option('qlcd_wp_chatbot_order_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_welcome)));
1938 }
1939 if(isset($_POST["qlcd_wp_chatbot_order_username_asking"])){
1940 $qlcd_wp_chatbot_order_username_asking = @wp_unslash($_POST["qlcd_wp_chatbot_order_username_asking"]);
1941 update_option('qlcd_wp_chatbot_order_username_asking', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_username_asking)));
1942 }
1943 if(isset($_POST["qlcd_wp_chatbot_order_username_not_exist"])){
1944 $qlcd_wp_chatbot_order_username_not_exist = @wp_unslash($_POST["qlcd_wp_chatbot_order_username_not_exist"]);
1945 update_option('qlcd_wp_chatbot_order_username_not_exist', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_username_not_exist)));
1946 }
1947 if (isset($_POST["qlcd_wp_chatbot_order_username_thanks"])) {
1948 // Unslash the input first, then sanitize deeply as text, assuming it's an array of texts or a single text.
1949 $unslashed_data = wp_unslash($_POST["qlcd_wp_chatbot_order_username_thanks"]);
1950 $qlcd_wp_chatbot_order_username_thanks = map_deep($unslashed_data, 'sanitize_text_field');
1951 update_option('qlcd_wp_chatbot_order_username_thanks', maybe_serialize($qlcd_wp_chatbot_order_username_thanks));
1952 }
1953 if(isset($_POST["qlcd_wp_chatbot_order_username_password"])){
1954 $qlcd_wp_chatbot_order_username_password = @wp_unslash($_POST["qlcd_wp_chatbot_order_username_password"]);
1955 update_option('qlcd_wp_chatbot_order_username_password', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_username_password)));
1956 }
1957 if(isset($_POST["qlcd_wp_chatbot_order_password_incorrect"])){
1958 $qlcd_wp_chatbot_order_password_incorrect= @wp_unslash($_POST["qlcd_wp_chatbot_order_password_incorrect"]);
1959 update_option('qlcd_wp_chatbot_order_password_incorrect', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_password_incorrect)));
1960 }
1961 if(isset($_POST["qlcd_wp_chatbot_order_not_found"])){
1962 $qlcd_wp_chatbot_order_not_found= @wp_unslash($_POST["qlcd_wp_chatbot_order_not_found"]);
1963 update_option('qlcd_wp_chatbot_order_not_found', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_not_found)));
1964 }
1965 if(isset($_POST["qlcd_wp_chatbot_order_found"])){
1966 $qlcd_wp_chatbot_order_found= @wp_unslash($_POST["qlcd_wp_chatbot_order_found"]);
1967 update_option('qlcd_wp_chatbot_order_found', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_found)));
1968 }
1969 if(isset( $_POST["qlcd_wp_chatbot_order_email_support"])){
1970 $qlcd_wp_chatbot_order_email_support= @wp_unslash($_POST["qlcd_wp_chatbot_order_email_support"]);
1971 update_option('qlcd_wp_chatbot_order_email_support', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_email_support)));
1972 }
1973 //Support
1974 if (isset($_POST["qlcd_wp_chatbot_support_welcome"])) {
1975 $qlcd_wp_chatbot_support_welcome = wp_unslash($_POST["qlcd_wp_chatbot_support_welcome"]);
1976 $qlcd_wp_chatbot_support_welcome = sanitize_array($qlcd_wp_chatbot_support_welcome);
1977 update_option('qlcd_wp_chatbot_support_welcome', maybe_serialize($qlcd_wp_chatbot_support_welcome));
1978 }
1979 if (isset($_POST["qlcd_wp_chatbot_support_email"])) {
1980 $qlcd_wp_chatbot_support_email = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_support_email"]));
1981 update_option('qlcd_wp_chatbot_support_email', $qlcd_wp_chatbot_support_email);
1982 }
1983 if (isset($_POST["qlcd_wp_chatbot_asking_email"])) {
1984 $qlcd_wp_chatbot_asking_email = wp_unslash($_POST["qlcd_wp_chatbot_asking_email"]);
1985 $qlcd_wp_chatbot_asking_email = sanitize_array($qlcd_wp_chatbot_asking_email);
1986 update_option('qlcd_wp_chatbot_asking_email', maybe_serialize($qlcd_wp_chatbot_asking_email));
1987 }
1988 if (isset($_POST["qlcd_wp_chatbot_asking_msg"])) {
1989 $qlcd_wp_chatbot_asking_msg = wp_unslash($_POST["qlcd_wp_chatbot_asking_msg"]);
1990 $qlcd_wp_chatbot_asking_msg = sanitize_array($qlcd_wp_chatbot_asking_msg);
1991 update_option('qlcd_wp_chatbot_asking_msg', maybe_serialize($qlcd_wp_chatbot_asking_msg));
1992 }
1993
1994 if(isset($_POST["qlcd_wp_chatbot_no_result"])){
1995 $qlcd_wp_chatbot_no_result = @wp_unslash($_POST["qlcd_wp_chatbot_no_result"]);
1996 update_option('qlcd_wp_chatbot_no_result', maybe_serialize(sanitize_array($qlcd_wp_chatbot_no_result)));
1997 }
1998
1999 if (isset($_POST["qlcd_wp_chatbot_support_option_again"])) {
2000 $qlcd_wp_chatbot_support_option_again = wp_unslash($_POST["qlcd_wp_chatbot_support_option_again"]);
2001 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize(sanitize_array($qlcd_wp_chatbot_support_option_again)));
2002 } else {
2003 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize(array()));
2004 }
2005
2006 if (isset($_POST["qlcd_wp_chatbot_invalid_email"])) {
2007 $qlcd_wp_chatbot_invalid_email = wp_unslash($_POST["qlcd_wp_chatbot_invalid_email"]);
2008 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize(sanitize_array($qlcd_wp_chatbot_invalid_email)));
2009 } else {
2010 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize(array()));
2011 }
2012
2013 if (isset($_POST["qlcd_wp_chatbot_support_phone"])) {
2014 $qlcd_wp_chatbot_support_phone = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_support_phone"]));
2015 update_option('qlcd_wp_chatbot_support_phone', $qlcd_wp_chatbot_support_phone);
2016 } else {
2017 update_option('qlcd_wp_chatbot_support_phone', '');
2018 }
2019
2020 if (isset($_POST["qlcd_wp_chatbot_asking_phone"])) {
2021 $qlcd_wp_chatbot_asking_phone = wp_unslash($_POST["qlcd_wp_chatbot_asking_phone"]);
2022 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize(sanitize_array($qlcd_wp_chatbot_asking_phone)));
2023 } else {
2024 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize(array()));
2025 }
2026
2027 if (isset($_POST["qlcd_wp_chatbot_thank_for_phone"])) {
2028 $qlcd_wp_chatbot_thank_for_phone = wp_unslash($_POST["qlcd_wp_chatbot_thank_for_phone"]);
2029 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize(sanitize_array($qlcd_wp_chatbot_thank_for_phone)));
2030 } else {
2031 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize(array()));
2032 }
2033
2034 if (isset($_POST["qlcd_wp_chatbot_admin_email"])) {
2035 $qlcd_wp_chatbot_admin_email = sanitize_email(wp_unslash($_POST["qlcd_wp_chatbot_admin_email"]));
2036 } else {
2037 $qlcd_wp_chatbot_admin_email = '';
2038 }
2039
2040 update_option('qlcd_wp_chatbot_admin_email', $qlcd_wp_chatbot_admin_email);
2041
2042 // Sanitize early for qlcd_wp_chatbot_email_sub
2043 $qlcd_wp_chatbot_email_sub = '';
2044 if (isset($_POST["qlcd_wp_chatbot_email_sub"])) {
2045 $qlcd_wp_chatbot_email_sub = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_email_sub"]));
2046 }
2047 update_option('qlcd_wp_chatbot_email_sub', $qlcd_wp_chatbot_email_sub);
2048
2049 // Sanitize early for qlcd_wp_site_search, only update if set
2050 if (isset($_POST["qlcd_wp_site_search"])) {
2051 $qlcd_wp_site_search = sanitize_text_field(wp_unslash($_POST["qlcd_wp_site_search"]));
2052 update_option('qlcd_wp_site_search', $qlcd_wp_site_search);
2053 }
2054
2055 // Sanitize early for qlcd_wp_chatbot_email_sent
2056 $qlcd_wp_chatbot_email_sent = '';
2057 if (isset($_POST["qlcd_wp_chatbot_email_sent"])) {
2058 $qlcd_wp_chatbot_email_sent = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_email_sent"]));
2059 }
2060 update_option('qlcd_wp_chatbot_email_sent', $qlcd_wp_chatbot_email_sent);
2061
2062 // Sanitize early for qlcd_wp_chatbot_email_fail
2063 $qlcd_wp_chatbot_email_fail = '';
2064 if (isset($_POST["qlcd_wp_chatbot_email_fail"])) {
2065 $qlcd_wp_chatbot_email_fail = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_email_fail"]));
2066 }
2067 update_option('qlcd_wp_chatbot_email_fail', $qlcd_wp_chatbot_email_fail);
2068
2069 // Sanitize early for qlcd_wp_chatbot_relevant_post_link_openai
2070 $qlcd_wp_chatbot_relevant_post_link_openai = '';
2071 if (isset($_POST["qlcd_wp_chatbot_relevant_post_link_openai"])) {
2072 $qlcd_wp_chatbot_relevant_post_link_openai = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_relevant_post_link_openai"]));
2073 }
2074 update_option('qlcd_wp_chatbot_relevant_post_link_openai', $qlcd_wp_chatbot_relevant_post_link_openai);
2075 //Notifications messages building.
2076 if (isset($_POST["qlcd_wp_chatbot_notification_interval"])) {
2077 $qlcd_wp_chatbot_notification_interval = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_notification_interval"]));
2078 update_option('qlcd_wp_chatbot_notification_interval', $qlcd_wp_chatbot_notification_interval);
2079 }
2080
2081 if(isset($_POST["qlcd_wp_chatbot_notifications"])){
2082 $qlcd_wp_chatbot_notifications = @wp_unslash($_POST["qlcd_wp_chatbot_notifications"]);
2083 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(sanitize_array($qlcd_wp_chatbot_notifications)));
2084 }
2085 //Support building part.
2086
2087 $allowed_html = array(
2088 'a' => array(
2089 'href' => array(),
2090 'title' => array()
2091 ),
2092 'br' => array(),
2093 'em' => array(),
2094 'strong' => array(),
2095 );
2096 $support_query = @wp_unslash($_POST["support_query"]);
2097 $clean_support_query = [];
2098 if(!empty($support_query)){
2099 foreach($support_query as $key => $val) {
2100
2101 $clean_support_query[wp_kses($key,$allowed_html)] = wp_kses($val,$allowed_html);
2102 }
2103 }
2104 update_option('support_query', (maybe_serialize($clean_support_query)));
2105 $support_ans = @wp_unslash($_POST["support_ans"]);
2106 $clean_support_ans = [];
2107 if(!empty($support_query)){
2108 foreach($support_ans as $key => $val) {
2109 $clean_support_ans[wp_kses($key,$allowed_html)] = wp_kses($val,$allowed_html);
2110 }
2111 }
2112 update_option('support_ans', (maybe_serialize($clean_support_ans)));
2113 //Create Mobile app pages.
2114 if(isset( $_POST["wp_chatbot_app_pages"])) {
2115 $wp_chatbot_app_pages = wp_unslash($_POST["wp_chatbot_app_pages"]);
2116 }else{ $wp_chatbot_app_pages='';}
2117 update_option('wp_chatbot_app_pages', wp_unslash($wp_chatbot_app_pages));
2118 //Messenger Options
2119 if(isset( $_POST["enable_wp_chatbot_messenger"])) {
2120 $enable_wp_chatbot_messenger = wp_unslash($_POST["enable_wp_chatbot_messenger"]);
2121 }else{ $enable_wp_chatbot_messenger='';}
2122 update_option('enable_wp_chatbot_messenger', wp_unslash($enable_wp_chatbot_messenger));
2123 if(isset( $_POST["enable_wp_chatbot_messenger_floating_icon"])) {
2124 $enable_wp_chatbot_messenger_floating_icon = wp_unslash($_POST["enable_wp_chatbot_messenger_floating_icon"]);
2125 }else{ $enable_wp_chatbot_messenger_floating_icon='';}
2126 update_option('enable_wp_chatbot_messenger_floating_icon', wp_unslash($enable_wp_chatbot_messenger_floating_icon));
2127 if(isset($_POST["qlcd_wp_chatbot_fb_app_id"])){
2128 $qlcd_wp_chatbot_fb_app_id = @wp_unslash($_POST["qlcd_wp_chatbot_fb_app_id"]);
2129 update_option('qlcd_wp_chatbot_fb_app_id', sanitize_text_field($qlcd_wp_chatbot_fb_app_id));
2130 }
2131 if(isset($_POST["qlcd_wp_chatbot_fb_page_id"])){
2132 $qlcd_wp_chatbot_fb_page_id = @wp_unslash($_POST["qlcd_wp_chatbot_fb_page_id"]);
2133 update_option('qlcd_wp_chatbot_fb_page_id', sanitize_text_field($qlcd_wp_chatbot_fb_page_id));
2134 }
2135 if(isset($_POST["qlcd_wp_chatbot_fb_color"])){
2136 $qlcd_wp_chatbot_fb_color= @wp_unslash($_POST["qlcd_wp_chatbot_fb_color"]);
2137 update_option('qlcd_wp_chatbot_fb_color', wp_unslash($qlcd_wp_chatbot_fb_color));
2138 }
2139 if(isset($_POST["qlcd_wp_chatbot_fb_in_msg"])){
2140 $qlcd_wp_chatbot_fb_in_msg = @wp_unslash($_POST["qlcd_wp_chatbot_fb_in_msg"]);
2141 update_option('qlcd_wp_chatbot_fb_in_msg', stripslashes(sanitize_text_field($qlcd_wp_chatbot_fb_in_msg)));
2142 }
2143 if(isset($_POST["qlcd_wp_chatbot_fb_out_msg"])){
2144 $qlcd_wp_chatbot_fb_out_msg = @wp_unslash($_POST["qlcd_wp_chatbot_fb_out_msg"]);
2145 update_option('qlcd_wp_chatbot_fb_out_msg', stripslashes(sanitize_text_field($qlcd_wp_chatbot_fb_out_msg)));
2146 }
2147 //Skype option
2148 if(isset( $_POST["enable_wp_chatbot_skype_floating_icon"])) {
2149 $enable_wp_chatbot_skype_floating_icon = wp_unslash($_POST["enable_wp_chatbot_skype_floating_icon"]);
2150 }else{ $enable_wp_chatbot_skype_floating_icon='';}
2151 update_option('enable_wp_chatbot_skype_floating_icon', sanitize_text_field($enable_wp_chatbot_skype_floating_icon));
2152 if(isset( $_POST["enable_wp_chatbot_skype_id"])) {
2153 $enable_wp_chatbot_skype_id = wp_unslash($_POST["enable_wp_chatbot_skype_id"]);
2154 }else{ $enable_wp_chatbot_skype_id='';}
2155 update_option('enable_wp_chatbot_skype_id', sanitize_text_field($enable_wp_chatbot_skype_id));
2156 //WhatsApp
2157 if(isset( $_POST["enable_wp_chatbot_whats"])) {
2158 $enable_wp_chatbot_whats= wp_unslash($_POST["enable_wp_chatbot_whats"]);
2159 }else{ $enable_wp_chatbot_whats='';}
2160 update_option('enable_wp_chatbot_whats', sanitize_text_field($enable_wp_chatbot_whats));
2161 if(isset($_POST["qlcd_wp_chatbot_whats_label"])){
2162 $qlcd_wp_chatbot_whats_label = @wp_unslash($_POST["qlcd_wp_chatbot_whats_label"]);
2163 update_option('qlcd_wp_chatbot_whats_label', maybe_serialize(sanitize_array($qlcd_wp_chatbot_whats_label)));
2164 }
2165 if(isset( $_POST["enable_wp_chatbot_floating_whats"])) {
2166 $enable_wp_chatbot_floating_whats= wp_unslash($_POST["enable_wp_chatbot_floating_whats"]);
2167 }else{ $enable_wp_chatbot_floating_whats='';}
2168 update_option('enable_wp_chatbot_floating_whats', sanitize_text_field($enable_wp_chatbot_floating_whats));
2169 if(isset($_POST["qlcd_wp_chatbot_whats_num"])){
2170 $qlcd_wp_chatbot_whats_num = @wp_unslash($_POST["qlcd_wp_chatbot_whats_num"]);
2171 update_option('qlcd_wp_chatbot_whats_num', sanitize_text_field($qlcd_wp_chatbot_whats_num));
2172 }
2173 //Viber
2174 if(isset( $_POST["enable_wp_chatbot_floating_viber"])) {
2175 $enable_wp_chatbot_floating_viber = wp_unslash($_POST["enable_wp_chatbot_floating_viber"]);
2176 }else{ $enable_wp_chatbot_floating_viber='';}
2177 update_option('enable_wp_chatbot_floating_viber', sanitize_text_field($enable_wp_chatbot_floating_viber));
2178 if(isset($_POST["qlcd_wp_chatbot_viber_acc"])){
2179 $qlcd_wp_chatbot_viber_acc = @wp_unslash($_POST["qlcd_wp_chatbot_viber_acc"]);
2180 update_option('qlcd_wp_chatbot_viber_acc', sanitize_text_field($qlcd_wp_chatbot_viber_acc));
2181 }
2182 //Others integration
2183 if(isset( $_POST["enable_wp_chatbot_floating_phone"])) {
2184 $enable_wp_chatbot_floating_phone = wp_unslash($_POST["enable_wp_chatbot_floating_phone"]);
2185 }else{ $enable_wp_chatbot_floating_phone='';}
2186 update_option('enable_wp_chatbot_floating_phone', sanitize_text_field($enable_wp_chatbot_floating_phone));
2187 if(isset($_POST["qlcd_wp_chatbot_phone"])){
2188 $qlcd_wp_chatbot_phone = @wp_unslash($_POST["qlcd_wp_chatbot_phone"]);
2189 update_option('qlcd_wp_chatbot_phone', sanitize_text_field($qlcd_wp_chatbot_phone));
2190 }
2191
2192 if(isset( $_POST["enable_wp_chatbot_floating_link"])) {
2193 $enable_wp_chatbot_floating_link = wp_unslash($_POST["enable_wp_chatbot_floating_link"]);
2194 }else{ $enable_wp_chatbot_floating_link='';}
2195 update_option('enable_wp_chatbot_floating_link', sanitize_text_field($enable_wp_chatbot_floating_link));
2196 if(isset($_POST["qlcd_wp_chatbot_weblink"])){
2197 $qlcd_wp_chatbot_weblink = @wp_unslash($_POST["qlcd_wp_chatbot_weblink"]);
2198 update_option('qlcd_wp_chatbot_weblink', sanitize_text_field($qlcd_wp_chatbot_weblink));
2199 }
2200
2201 //Re Targetting.
2202 if(isset($_POST["qlcd_wp_chatbot_ret_greet"])){
2203 $qlcd_wp_chatbot_ret_greet = @wp_unslash($_POST["qlcd_wp_chatbot_ret_greet"]);
2204 update_option('qlcd_wp_chatbot_ret_greet', sanitize_text_field($qlcd_wp_chatbot_ret_greet));
2205 }
2206
2207 if(isset( $_POST["enable_wp_chatbot_exit_intent"])) {
2208 $enable_wp_chatbot_exit_intent = wp_unslash($_POST["enable_wp_chatbot_exit_intent"]);
2209 }else{ $enable_wp_chatbot_exit_intent='';}
2210 update_option('enable_wp_chatbot_exit_intent', sanitize_text_field($enable_wp_chatbot_exit_intent));
2211
2212 if(isset($_POST["wp_chatbot_exit_intent_msg"])){
2213 $wp_chatbot_exit_intent_msg = @wp_unslash($_POST["wp_chatbot_exit_intent_msg"]);
2214 update_option('wp_chatbot_exit_intent_msg', wp_unslash($wp_chatbot_exit_intent_msg));
2215 }
2216
2217 if(isset( $_POST["wp_chatbot_exit_intent_once"])) {
2218 $wp_chatbot_exit_intent_once = wp_unslash($_POST["wp_chatbot_exit_intent_once"]);
2219 }else{ $wp_chatbot_exit_intent_once='';}
2220 update_option('wp_chatbot_exit_intent_once', sanitize_text_field($wp_chatbot_exit_intent_once));
2221
2222 if(isset( $_POST["enable_wp_chatbot_scroll_open"])) {
2223 $enable_wp_chatbot_scroll_open = wp_unslash($_POST["enable_wp_chatbot_scroll_open"]);
2224 }else{ $enable_wp_chatbot_scroll_open='';}
2225 update_option('enable_wp_chatbot_scroll_open', sanitize_text_field($enable_wp_chatbot_scroll_open));
2226
2227 if(isset($_POST["wp_chatbot_scroll_open_msg"])){
2228 $wp_chatbot_scroll_open_msg= @wp_unslash($_POST["wp_chatbot_scroll_open_msg"]);
2229 update_option('wp_chatbot_scroll_open_msg', wp_unslash($wp_chatbot_scroll_open_msg));
2230 }
2231
2232 if(isset($_POST["wp_chatbot_scroll_percent"])){
2233 $wp_chatbot_scroll_percent= @wp_unslash($_POST["wp_chatbot_scroll_percent"]);
2234 update_option('wp_chatbot_scroll_percent', wp_unslash($wp_chatbot_scroll_percent));
2235 }
2236
2237 if(isset( $_POST["wp_chatbot_scroll_once"])) {
2238 $wp_chatbot_scroll_once = sanitize_text_field(wp_unslash($_POST["wp_chatbot_scroll_once"]));
2239 }else{ $wp_chatbot_scroll_once='';}
2240 update_option('wp_chatbot_scroll_once', $wp_chatbot_scroll_once);
2241
2242 if(isset( $_POST["enable_wp_chatbot_auto_open"])) {
2243 $enable_wp_chatbot_auto_open = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_auto_open"]));
2244 }else{ $enable_wp_chatbot_auto_open='';}
2245 update_option('enable_wp_chatbot_auto_open', $enable_wp_chatbot_auto_open);
2246
2247 if(isset( $_POST["enable_wp_chatbot_ret_sound"])) {
2248 $enable_wp_chatbot_ret_sound = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_ret_sound"]));
2249 }else{ $enable_wp_chatbot_ret_sound='';}
2250 update_option('enable_wp_chatbot_ret_sound', $enable_wp_chatbot_ret_sound);
2251
2252 if(isset( $_POST["enable_wp_chatbot_sound_initial"])) {
2253 $enable_wp_chatbot_sound_initial = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_sound_initial"]));
2254 }else{ $enable_wp_chatbot_sound_initial='';}
2255 update_option('enable_wp_chatbot_sound_initial', $enable_wp_chatbot_sound_initial);
2256
2257
2258 if(isset($_POST["wp_chatbot_auto_open_msg"])){
2259 $wp_chatbot_auto_open_msg = @wp_unslash($_POST["wp_chatbot_auto_open_msg"]);
2260 update_option('wp_chatbot_auto_open_msg', wp_unslash($wp_chatbot_auto_open_msg));
2261 }
2262
2263 if(isset($_POST["wp_chatbot_auto_open_time"])){
2264 $wp_chatbot_auto_open_time = @wp_unslash($_POST["wp_chatbot_auto_open_time"]);
2265 update_option('wp_chatbot_auto_open_time', wp_unslash($wp_chatbot_auto_open_time));
2266 }
2267 //to complate checkout.
2268 if(isset( $_POST["enable_wp_chatbot_ret_user_show"])) {
2269 $enable_wp_chatbot_ret_user_show = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_ret_user_show"]));
2270 }else{ $enable_wp_chatbot_ret_user_show='';}
2271 update_option('enable_wp_chatbot_ret_user_show', $enable_wp_chatbot_ret_user_show);
2272
2273 if(isset( $_POST["enable_wp_chatbot_inactive_time_show"])) {
2274 $enable_wp_chatbot_inactive_time_show = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_inactive_time_show"]));
2275 }else{ $enable_wp_chatbot_inactive_time_show='';}
2276 update_option('enable_wp_chatbot_inactive_time_show', $enable_wp_chatbot_inactive_time_show);
2277
2278 if(isset($_POST["wp_chatbot_inactive_time"])){
2279 $wp_chatbot_inactive_time = @wp_unslash($_POST["wp_chatbot_inactive_time"]);
2280 update_option('wp_chatbot_inactive_time', sanitize_text_field($wp_chatbot_inactive_time));
2281 }
2282
2283 if(isset($_POST["wp_chatbot_checkout_msg"])){
2284 $wp_chatbot_checkout_msg = @wp_unslash($_POST["wp_chatbot_checkout_msg"]);
2285 update_option('wp_chatbot_checkout_msg', wp_unslash($wp_chatbot_checkout_msg));
2286 }
2287
2288 if(isset( $_POST["wp_chatbot_auto_open_once"])) {
2289 $wp_chatbot_auto_open_once = sanitize_text_field(wp_unslash($_POST["wp_chatbot_auto_open_once"]));
2290 }else{ $wp_chatbot_auto_open_once='';}
2291 update_option('wp_chatbot_auto_open_once', $wp_chatbot_auto_open_once);
2292
2293 if(isset( $_POST["wp_chatbot_inactive_once"])) {
2294 $wp_chatbot_inactive_once = sanitize_text_field(wp_unslash($_POST["wp_chatbot_inactive_once"]));
2295 }else{ $wp_chatbot_inactive_once='';}
2296 update_option('wp_chatbot_inactive_once', $wp_chatbot_inactive_once);
2297
2298
2299 if(isset($_POST["wp_chatbot_proactive_bg_color"])){
2300 $wp_chatbot_proactive_bg_color = @wp_unslash($_POST["wp_chatbot_proactive_bg_color"]);
2301 update_option('wp_chatbot_proactive_bg_color', sanitize_text_field($wp_chatbot_proactive_bg_color));
2302 }
2303
2304 if(isset( $_POST["disable_wp_chatbot_call_gen"])) {
2305 $disable_wp_chatbot_call_gen = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_call_gen"]));
2306 }else{ $disable_wp_chatbot_call_gen='';}
2307 update_option('disable_wp_chatbot_call_gen', $disable_wp_chatbot_call_gen);
2308
2309 if(isset( $_POST["disable_wp_chatbot_site_search"])) {
2310 $disable_wp_chatbot_site_search = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_site_search"]));
2311 update_option('enable_wp_chatbot_post_content', '');
2312 }else{ $disable_wp_chatbot_site_search='';}
2313 update_option('disable_wp_chatbot_site_search', $disable_wp_chatbot_site_search);
2314
2315 if(isset( $_POST["enable_wp_chatbot_post_content"])) {
2316 $enable_wp_chatbot_post_content = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_post_content"]));
2317
2318 }else{ $enable_wp_chatbot_post_content='';}
2319 update_option('enable_wp_chatbot_post_content', $enable_wp_chatbot_post_content);
2320
2321 if(isset( $_POST["disable_wp_chatbot_call_sup"])) {
2322 $disable_wp_chatbot_call_sup = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_call_sup"]));
2323 }else{ $disable_wp_chatbot_call_sup='';}
2324 update_option('disable_wp_chatbot_call_sup', $disable_wp_chatbot_call_sup);
2325
2326 if(isset( $_POST["disable_wp_chatbot_feedback"])) {
2327 $disable_wp_chatbot_feedback = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_feedback"]));
2328 }else{ $disable_wp_chatbot_feedback='';}
2329 update_option('disable_wp_chatbot_feedback', $disable_wp_chatbot_feedback);
2330
2331 if(isset( $_POST["disable_wp_chatbot_faq"])) {
2332 $disable_wp_chatbot_faq = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_faq"]));
2333 }else{ $disable_wp_chatbot_faq='';}
2334 update_option('disable_wp_chatbot_faq', $disable_wp_chatbot_faq);
2335
2336 if(isset($_POST["qlcd_wp_chatbot_feedback_label"])){
2337 $qlcd_wp_chatbot_feedback_label = (@wp_unslash($_POST["qlcd_wp_chatbot_feedback_label"]));
2338 update_option('qlcd_wp_chatbot_feedback_label', maybe_serialize(sanitize_array($qlcd_wp_chatbot_feedback_label)));
2339 }
2340
2341 if(isset( $_POST["enable_wp_chatbot_meta_title"])) {
2342 $enable_wp_chatbot_meta_title = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_meta_title"]));
2343 }else{ $enable_wp_chatbot_meta_title='';}
2344 update_option('enable_wp_chatbot_meta_title', $enable_wp_chatbot_meta_title);
2345
2346 if(isset($_POST["qlcd_wp_chatbot_meta_label"])){
2347 $qlcd_wp_chatbot_meta_label = esc_html(@wp_unslash($_POST["qlcd_wp_chatbot_meta_label"]));
2348 update_option('qlcd_wp_chatbot_meta_label', stripslashes(sanitize_text_field($qlcd_wp_chatbot_meta_label)));
2349 }
2350
2351 if (isset($_POST["qlcd_wp_chatbot_phone_sent"])) {
2352 $qlcd_wp_chatbot_phone_sent = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_phone_sent"]));
2353 update_option('qlcd_wp_chatbot_phone_sent', $qlcd_wp_chatbot_phone_sent);
2354 }
2355
2356 if (isset($_POST["qlcd_wp_chatbot_phone_fail"])) {
2357 $qlcd_wp_chatbot_phone_fail = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_phone_fail"]));
2358 update_option('qlcd_wp_chatbot_phone_fail', $qlcd_wp_chatbot_phone_fail);
2359 }
2360
2361 if (isset($_POST["qlcd_wp_chatbot_asking_search_keyword"])) {
2362 $qlcd_wp_chatbot_asking_search_keyword = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_asking_search_keyword"]));
2363 update_option('qlcd_wp_chatbot_asking_search_keyword', $qlcd_wp_chatbot_asking_search_keyword);
2364 }
2365
2366 if (isset($_POST["qlcd_wp_chatbot_found_result"])) {
2367 $qlcd_wp_chatbot_found_result = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_found_result"]));
2368 update_option('qlcd_wp_chatbot_found_result', $qlcd_wp_chatbot_found_result);
2369 }
2370
2371 if(isset( $_POST["enable_wp_chatbot_opening_hour"])) {
2372 $enable_wp_chatbot_opening_hour = stripslashes(sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_opening_hour"])));
2373 }else{ $enable_wp_chatbot_opening_hour='';}
2374 update_option('enable_wp_chatbot_opening_hour', esc_html($enable_wp_chatbot_opening_hour));
2375
2376 if(isset($_POST["wpwbot_hours"])){
2377 $wpwbot_hours= @wp_unslash($_POST["wpwbot_hours"]);
2378 update_option('wpwbot_hours', maybe_serialize(sanitize_array($wpwbot_hours)));
2379 }
2380
2381 if(isset( $_POST["enable_wp_chatbot_dailogflow"])) {
2382 $enable_wp_chatbot_dailogflow = stripslashes(sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_dailogflow"])));
2383 }else{ $enable_wp_chatbot_dailogflow='';}
2384 update_option('enable_wp_chatbot_dailogflow', $enable_wp_chatbot_dailogflow);
2385
2386 if(isset($_POST["qlcd_wp_chatbot_dialogflow_client_token"])){
2387 $qlcd_wp_chatbot_dialogflow_client_token= esc_html(@wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_client_token"]));
2388 update_option('qlcd_wp_chatbot_dialogflow_client_token', stripslashes(sanitize_text_field($qlcd_wp_chatbot_dialogflow_client_token)));
2389 }
2390
2391 if (isset($_POST["qlcd_wp_chatbot_dialogflow_defualt_reply"])) {
2392 $qlcd_wp_chatbot_dialogflow_defualt_reply = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_defualt_reply"]));
2393 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', $qlcd_wp_chatbot_dialogflow_defualt_reply);
2394 }
2395
2396 if (isset($_POST["qlcd_wp_chatbot_dialogflow_agent_language"])) {
2397 $qlcd_wp_chatbot_dialogflow_agent_language = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_agent_language"]));
2398 update_option('qlcd_wp_chatbot_dialogflow_agent_language', $qlcd_wp_chatbot_dialogflow_agent_language);
2399 }
2400 // style option save.
2401 if(isset( $_POST["enable_wp_chatbot_custom_color"])) {
2402 $enable_wp_chatbot_custom_color = esc_html(wp_unslash($_POST["enable_wp_chatbot_custom_color"]));
2403 }else{ $enable_wp_chatbot_custom_color='';}
2404 update_option('enable_wp_chatbot_custom_color', stripslashes(sanitize_text_field($enable_wp_chatbot_custom_color)));
2405 if (isset($_POST["wp_chatbot_text_color"])) {
2406 $wp_chatbot_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_text_color"]));
2407 update_option('wp_chatbot_text_color', $wp_chatbot_text_color);
2408 }
2409
2410 if (isset($_POST["wp_chatbot_floatingiconbg_color"])) {
2411 $wp_chatbot_floatingiconbg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_floatingiconbg_color"]));
2412 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
2413 }
2414
2415 if (isset($_POST["wp_chatbot_link_color"])) {
2416 $wp_chatbot_link_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_link_color"]));
2417 update_option('wp_chatbot_link_color', $wp_chatbot_link_color);
2418 }
2419
2420 if (isset($_POST["wp_chatbot_link_hover_color"])) {
2421 $wp_chatbot_link_hover_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_link_hover_color"]));
2422 update_option('wp_chatbot_link_hover_color', $wp_chatbot_link_hover_color);
2423 }
2424
2425 if (isset($_POST["wp_chatbot_bot_msg_bg_color"])) {
2426 $wp_chatbot_bot_msg_bg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_bot_msg_bg_color"]));
2427 update_option('wp_chatbot_bot_msg_bg_color', $wp_chatbot_bot_msg_bg_color);
2428 }
2429
2430 if (isset($_POST["wp_chatbot_bot_msg_text_color"])) {
2431 $wp_chatbot_bot_msg_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_bot_msg_text_color"]));
2432 update_option('wp_chatbot_bot_msg_text_color', $wp_chatbot_bot_msg_text_color);
2433 }
2434
2435 if (isset($_POST["wp_chatbot_user_msg_bg_color"])) {
2436 $wp_chatbot_user_msg_bg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_user_msg_bg_color"]));
2437 update_option('wp_chatbot_user_msg_bg_color', $wp_chatbot_user_msg_bg_color);
2438 }
2439
2440 if (isset($_POST["wp_chatbot_user_msg_text_color"])) {
2441 $wp_chatbot_user_msg_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_user_msg_text_color"]));
2442 update_option('wp_chatbot_user_msg_text_color', $wp_chatbot_user_msg_text_color);
2443 }
2444
2445 if (isset($_POST["wp_chatbot_buttons_bg_color"])) {
2446 $wp_chatbot_buttons_bg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_bg_color"]));
2447 update_option('wp_chatbot_buttons_bg_color', $wp_chatbot_buttons_bg_color);
2448 }
2449
2450 if (isset($_POST["wp_chatbot_buttons_text_color"])) {
2451 $wp_chatbot_buttons_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_text_color"]));
2452 update_option('wp_chatbot_buttons_text_color', $wp_chatbot_buttons_text_color);
2453 }
2454
2455 if (isset($_POST["wp_chatbot_buttons_bg_color_hover"])) {
2456 $wp_chatbot_buttons_bg_color_hover = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_bg_color_hover"]));
2457 update_option('wp_chatbot_buttons_bg_color_hover', $wp_chatbot_buttons_bg_color_hover);
2458 }
2459
2460 if (isset($_POST["wp_chatbot_buttons_text_color_hover"])) {
2461 $wp_chatbot_buttons_text_color_hover = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_text_color_hover"]));
2462 update_option('wp_chatbot_buttons_text_color_hover', $wp_chatbot_buttons_text_color_hover);
2463 }
2464
2465 if (isset($_POST["wp_chatbot_theme_secondary_color"])) {
2466 $wp_chatbot_theme_secondary_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_theme_secondary_color"]));
2467 update_option('wp_chatbot_theme_secondary_color', $wp_chatbot_theme_secondary_color);
2468 }
2469 if (isset($_POST["wp_chatbot_header_background_color"])) {
2470 $wp_chatbot_header_background_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_header_background_color"]));
2471 update_option('wp_chatbot_header_background_color', $wp_chatbot_header_background_color);
2472 }
2473
2474 if (isset($_POST["wp_chatbot_font_size"])) {
2475 $wp_chatbot_font_size = sanitize_text_field(wp_unslash($_POST["wp_chatbot_font_size"]));
2476 // Additional validation for font size format (e.g., '14px', '1.2em') could be added here if strict adherence to CSS units is required.
2477 update_option('wp_chatbot_font_size', $wp_chatbot_font_size);
2478 }
2479 if (isset($_POST["wp_chat_bot_font_family"])) {
2480 $wp_chat_bot_font_family = sanitize_text_field(wp_unslash($_POST["wp_chat_bot_font_family"]));
2481 update_option('wp_chat_bot_font_family', $wp_chat_bot_font_family);
2482 }
2483 if (isset($_POST["wp_chat_user_font_family"])) {
2484 $wp_chat_user_font_family = sanitize_text_field(wp_unslash($_POST["wp_chat_user_font_family"]));
2485 update_option('wp_chat_user_font_family', $wp_chat_user_font_family);
2486 }
2487 if (isset($_POST['wp_chatbot_user_font'])) {
2488 $wp_chatbot_user_font = sanitize_text_field(wp_unslash($_POST['wp_chatbot_user_font']));
2489 update_option('wp_chatbot_user_font', $wp_chatbot_user_font);
2490 }
2491 if (isset($_POST['wp_chatbot_bot_font'])) {
2492 $wp_chatbot_bot_font = sanitize_text_field(wp_unslash($_POST['wp_chatbot_bot_font']));
2493 update_option('wp_chatbot_bot_font', $wp_chatbot_bot_font);
2494 }
2495
2496 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
2497
2498 wp_enqueue_script( 'wp_chatbot_bot-front-js', plugins_url(basename(plugin_dir_path(__FILE__))) . '/js/sweetalrt.js', array('jquery'), '', true);
2499 $script = "
2500 console.log('sdaas');
2501 function callsweetalert(){
2502 Swal.fire({
2503 title: 'Your settings are saved.',
2504 html: '<p style=font-size:14px>Please clear your browser <b>cache</b> and <b>cookies</b> both and reload the front end before testing. Alternatively, you can launch a new browser window in <b>Incognito</b>/Private mode (Ctrl+Shift+N in chrome) to test.</p>',
2505 width: 450,
2506 icon: 'success',
2507 confirmButtonText: 'Got it',
2508 confirmButtonWidth: 100,
2509 confirmButtonClass: 'btn btn-lg',
2510 }).then((result) => {
2511 // location.reload();
2512 })
2513 }
2514 callsweetalert();
2515 ";
2516
2517 wp_add_inline_script( 'wp_chatbot_bot-front-js', $script );
2518 }
2519 }
2520 }
2521 /**
2522 * Display Notifications on specific criteria.
2523 *
2524 * @since 2.14
2525 */
2526 public static function wpcommerce_inactive_notice_for_wp_chatbot()
2527 {
2528 if (current_user_can('activate_plugins')) :
2529 if (!class_exists('wpCommerce')) :
2530 deactivate_plugins(plugin_basename(__FILE__));
2531 ?>
2532 <div id="message" class="error">
2533 <p>
2534 <?php
2535 printf(
2536 '%s WPBot for wpCommerce REQUIRES wpCommerce%s %swpCommerce%s must be active for WPBot to work. Please install & activate wpCommerce.',
2537 '<strong>',
2538 '</strong><br>',
2539 '<a href="http://wordpress.org/extend/plugins/wpcommerce/" target="_blank" >',
2540 '</a>'
2541 );
2542 ?>
2543 </p>
2544 </div>
2545 <?php
2546 elseif (version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) :
2547 ?>
2548 <div id="message" class="error">
2549 <!--<p style="float: right; color: #9A9A9A; font-size: 13px; font-style: italic;">For more information <a href="http://cxthemes.com/plugins/update-notice.html" target="_blank" style="color: inheret;">click here</a></p>-->
2550 <p>
2551 <?php
2552 printf(
2553 '%WPBot for wpCommerce is inactive%s This version of WpBot requires wpCommerce %s or newer. For more information about our wpCommerce version support %sclick here%s.',
2554 '<strong>',
2555 '</strong><br>',
2556 esc_html( QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION )
2557 );
2558 ?>
2559 </p>
2560 <div style="clear:both;"></div>
2561 </div>
2562 <?php
2563 endif;
2564 endif;
2565 }
2566 /**
2567 * Admin notice for table reindex
2568 */
2569 public function admin_notice_reindex() { ?>
2570 <div class="updated notice is-dismissible">
2571 <p><?php
2572 // translators: %s: A link to the Re-Index Products page.
2573 printf( esc_html__( 'WPBot Pro : To Enable Title, Content, Excerpt, Categories, Tag and SKU Search Re-Index Products is required. %s', 'chatbot' ),'<a class="button button-secondary" href="'.esc_url( admin_url( 'admin.php?page=wpbot') ).'">'.esc_html__( 'Re-Index Products', 'chatbot' ).'</a>'); ?></p>
2574 </div>
2575 <?php }
2576 }
2577 /**
2578 * Instantiate plugin.
2579 *
2580 */
2581 if (!function_exists('qcld_wb_chatboot_plugin_init')) {
2582 function qcld_wb_chatboot_plugin_init()
2583 {
2584 global $qcld_wb_chatbot;
2585 $qcld_wb_chatbot = qcld_wb_Chatbot_free::qcld_wb_chatbot_get_instance();
2586 }
2587 }
2588 add_action('plugins_loaded', 'qcld_wb_chatboot_plugin_init');
2589 /*
2590 * Initial Options will be insert as defualt data
2591 */
2592 register_activation_hook(__FILE__, 'qcld_wb_chatboot_defualt_options');
2593 if( !function_exists('qcld_wb_chatboot_defualt_options') ){
2594 function qcld_wb_chatboot_defualt_options(){
2595
2596 global $wpdb;
2597 $collate = '';
2598
2599 if ( $wpdb->has_cap( 'collation' ) ) {
2600
2601 if ( ! empty( $wpdb->charset ) ) {
2602
2603 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
2604 }
2605 if ( ! empty( $wpdb->collate ) ) {
2606
2607 $collate .= " COLLATE $wpdb->collate";
2608
2609 }
2610 }
2611
2612 //Bot User Table
2613 $table1 = $wpdb->prefix.'wpbot_sessions';
2614 $sql_sliders_Table1 = "
2615 CREATE TABLE IF NOT EXISTS `$table1` (
2616 `id` int(11) NOT NULL AUTO_INCREMENT,
2617 `session` int(11) NOT NULL,
2618 PRIMARY KEY (`id`)
2619 ) $collate AUTO_INCREMENT=1 ";
2620
2621 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2622 dbDelta( $sql_sliders_Table1 );
2623
2624 //Bot Response Table
2625 $table1 = $wpdb->prefix.'wpbot_response';
2626 $sql_sliders_Table1 = "
2627 CREATE TABLE IF NOT EXISTS `$table1` (
2628 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
2629 `query` TEXT NOT NULL,
2630 `keyword` TEXT NOT NULL,
2631 `response` TEXT NOT NULL,
2632 `category` varchar(256) NOT NULL,
2633 `intent` varchar(256) NOT NULL,
2634 `custom` varchar(256) NOT NULL,
2635 `lang` varchar(25) NULL,
2636 FULLTEXT(`query`, `keyword`, `response`)
2637 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
2638
2639 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2640 dbDelta( $sql_sliders_Table1 );
2641
2642
2643 //Bot Response Table
2644 $table_rag_documents = $wpdb->prefix . "rag_documents";
2645
2646 $charset = $wpdb->get_charset_collate();
2647 if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($table_rag_documents))) != $table_rag_documents) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
2648 // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2649 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2650 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2651 doc_id VARCHAR(100) DEFAULT NULL,
2652 title VARCHAR(255) NOT NULL,
2653 content LONGTEXT NOT NULL,
2654 embedding LONGTEXT NOT NULL,
2655 source_type VARCHAR(20) DEFAULT 'post',
2656 source_url VARCHAR(255) DEFAULT NULL,
2657 file_url TEXT DEFAULT NULL,
2658 metadata LONGTEXT DEFAULT NULL,
2659 status VARCHAR(50) DEFAULT 'complete',
2660 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2661 ) $charset;";
2662 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2663 dbDelta($sql_rag_documents);
2664 // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2665 }
2666 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2667
2668 if ( $wpdb->get_var( $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($table_report)) ) != $table_report ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
2669 // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2670 $sql_report = "
2671 CREATE TABLE `$table_report` (
2672 `id` int(11) NOT NULL AUTO_INCREMENT,
2673 `user_id` int(11) NOT NULL,
2674 `conversation_id` int(11) DEFAULT NULL,
2675 `message` longtext NOT NULL,
2676 `feedback` varchar(20) DEFAULT NULL,
2677 `meta_info` text DEFAULT NULL,
2678 `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
2679 PRIMARY KEY (`id`)
2680 ) $charset_collate AUTO_INCREMENT=1;
2681 ";
2682
2683 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2684 dbDelta( $sql_report );
2685 // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2686 }
2687
2688 $sqlqry = $wpdb->get_results($wpdb->prepare("select * from {$table1} where id = %d", 1)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
2689 if(empty($sqlqry)){
2690
2691 $query = 'Sample Question ?';
2692 $response = 'Sample Answer';
2693
2694 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2695 $format = array('%s','%s', '%s', '%s');
2696 $wpdb->insert($table1,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter
2697 }
2698
2699 $table = $wpdb->prefix . 'wpbot_subscription';
2700 if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $table)) != $table) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
2701 // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2702 $sql_sliders_Table = "
2703 CREATE TABLE IF NOT EXISTS `$table` (
2704 `id` int(11) NOT NULL AUTO_INCREMENT,
2705 `name` varchar(256) NOT NULL,
2706 `email` varchar(256) NOT NULL,
2707 `phone` varchar(256) NOT NULL,
2708 `url` text NOT NULL,
2709 `date` datetime NOT NULL,
2710 `user_agent` text NOT NULL,
2711 PRIMARY KEY (`id`)
2712 ) $collate AUTO_INCREMENT=1 ";
2713 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2714 dbDelta($sql_sliders_Table);
2715 // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2716 }
2717
2718 $url = get_site_url();
2719 $url = wp_parse_url($url);
2720 $domain = $url['host'];
2721 //$admin_email = "admin@" . $domain;
2722 $admin_email = get_option('admin_email');
2723 if(!get_option('wp_chatbot_position_x')) {
2724 update_option('wp_chatbot_position_x', 30);
2725 }
2726 if(!get_option('wp_chatbot_position_y')) {
2727 update_option('wp_chatbot_position_y', 30);
2728 }
2729 if(!get_option('disable_wp_chatbot')) {
2730 update_option('disable_wp_chatbot', '');
2731 }
2732 if(!get_option('disable_wp_chatbot_icon_animation')) {
2733 update_option('disable_wp_chatbot_icon_animation', '');
2734 }
2735 if(!get_option('disable_wp_chatbot_on_mobile')) {
2736 update_option('disable_wp_chatbot_on_mobile', '');
2737 }
2738 if(!get_option('qlcd_wp_chatbot_admin_email')) {
2739 update_option('qlcd_wp_chatbot_admin_email', get_option('admin_email'));
2740 }
2741 if(!get_option('disable_wp_chatbot_product_search')) {
2742 update_option('disable_wp_chatbot_product_search', '');
2743 }
2744 if(!get_option('disable_wp_chatbot_catalog')) {
2745 update_option('disable_wp_chatbot_catalog', '');
2746 }
2747 if(!get_option('disable_wp_chatbot_order_status')) {
2748 update_option('disable_wp_chatbot_order_status', '');
2749 }
2750 if(!get_option('enable_wp_chatbot_rtl')) {
2751 update_option('enable_wp_chatbot_rtl', '');
2752 }
2753 if(!get_option('show_menu_after_greetings')) {
2754 update_option('show_menu_after_greetings', 1);
2755 }
2756 if(!get_option('disable_back_to_start_menu')) {
2757 update_option('disable_back_to_start_menu', '');
2758 }
2759 if(!get_option('disable_floating_button')) {
2760 update_option('disable_floating_button', '');
2761 }
2762 if(!get_option('enable_chat_session')) {
2763 update_option('enable_chat_session', '');
2764 }
2765
2766 if(!get_option('enable_wp_chatbot_mobile_full_screen')) {
2767 update_option('enable_wp_chatbot_mobile_full_screen', 1);
2768 }
2769 if(!get_option('wpbot_preloading_time')) {
2770 update_option('wpbot_preloading_time', '800');
2771 }
2772
2773 if(!get_option('disable_wp_chatbot_notification')) {
2774 update_option('disable_wp_chatbot_notification', '1');
2775 }
2776 if(!get_option('disable_wp_chatbot_cart_item_number')) {
2777 update_option('disable_wp_chatbot_cart_item_number', '');
2778 }
2779 if(!get_option('disable_wp_chatbot_featured_product')) {
2780 update_option('disable_wp_chatbot_featured_product', '');
2781 }
2782 if(!get_option('disable_wp_chatbot_sale_product')) {
2783 update_option('disable_wp_chatbot_sale_product', '');
2784 }
2785 if(!get_option('wp_chatbot_open_product_detail')) {
2786 update_option('wp_chatbot_open_product_detail', '');
2787 }
2788 if(!get_option('qlcd_wp_chatbot_product_orderby')) {
2789 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field('title'));
2790 }
2791 if(!get_option('qlcd_wp_chatbot_product_order')) {
2792 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field('ASC'));
2793 }
2794 if(!get_option('qlcd_wp_chatbot_ppp')) {
2795 update_option('qlcd_wp_chatbot_ppp', intval(6));
2796 }
2797 if(!get_option('wp_chatbot_exclude_stock_out_product')) {
2798 update_option('wp_chatbot_exclude_stock_out_product', '');
2799 }
2800 if(!get_option('wp_chatbot_show_sub_category')) {
2801 update_option('wp_chatbot_show_sub_category', '');
2802 }
2803 if(!get_option('wp_chatbot_vertical_custom')){
2804 update_option('wp_chatbot_vertical_custom', 'Go To');
2805 }
2806 if(!get_option('wp_chatbot_show_home_page')) {
2807 update_option('wp_chatbot_show_home_page', 'on');
2808 }
2809 if(!get_option('qc_wpbot_menu_order')) {
2810 $site_search_label = get_option('qlcd_wp_chatbot_wildcard_site_search') != '' ? get_option('qlcd_wp_chatbot_wildcard_site_search') : 'Site Search';
2811 $support_email_label = get_option('qlcd_wp_chatbot_support_email') != '' ? get_option('qlcd_wp_chatbot_support_email') : 'Send us Email.';
2812 $support_phone_label = get_option('qlcd_wp_chatbot_support_phone') != '' ? get_option('qlcd_wp_chatbot_support_phone') : 'Leave your number. We will call you back!';
2813 $default_menu = '<span class="qcld-chatbot-wildcard qc_draggable_item qcld-chatbot-site-search" data-wildcart="site_search">' . esc_attr($site_search_label) . '</span>';
2814 $default_menu .= '<span class="qcld-chatbot-suggest-email qc_draggable_item">' . esc_attr($support_email_label) . '</span>';
2815 $default_menu .= '<span class="qcld-chatbot-suggest-phone qc_draggable_item">' . esc_attr($support_phone_label) . '</span>';
2816 update_option('qc_wpbot_menu_order', $default_menu);
2817 }
2818 if(!get_option('qcld_chatbot_avatar_location')) {
2819 update_option('qcld_chatbot_avatar_location', 'side');
2820 }
2821 if(!get_option('wp_chatbot_show_posts')) {
2822 update_option('wp_chatbot_show_posts', 'on');
2823 }
2824 if(!get_option('wp_chatbot_show_pages')){
2825 update_option('wp_chatbot_show_pages', 'on');
2826 }
2827 if(!get_option('wp_chatbot_show_pages_list')) {
2828 update_option('wp_chatbot_show_pages_list', maybe_serialize(array()));
2829 }
2830 if(!get_option('wp_chatbot_exclude_post_list')) {
2831 update_option('wp_chatbot_exclude_post_list', maybe_serialize(array()));
2832 }
2833
2834 if(!get_option('wp_chatbot_show_wpcommerce')) {
2835 update_option('wp_chatbot_show_wpcommerce', 'on');
2836 }
2837 if(!get_option('qlcd_wp_chatbot_stop_words_name')) {
2838 update_option('qlcd_wp_chatbot_stop_words_name', 'english');
2839 }
2840 if(!get_option('qlcd_wp_chatbot_stop_words')) {
2841 update_option('qlcd_wp_chatbot_stop_words', "a,able,about,above,abst,accordance,according,accordingly,across,act,actually,added,adj,affected,affecting,affects,after,afterwards,again,against,ah,all,almost,alone,along,already,also,although,always,am,among,amongst,an,and,announce,another,any,anybody,anyhow,anymore,anyone,anything,anyway,anyways,anywhere,apparently,approximately,are,aren,arent,arise,around,as,aside,ask,asking,at,auth,available,away,awfully,b,back,be,became,because,become,becomes,becoming,been,before,beforehand,begin,beginning,beginnings,begins,behind,being,believe,below,beside,besides,between,beyond,biol,both,brief,briefly,but,by,c,ca,came,can,cannot,can't,cause,causes,certain,certainly,co,com,come,comes,contain,containing,contains,could,couldnt,d,date,did,didn't,different,do,does,doesn't,doing,done,don't,down,downwards,due,during,e,each,ed,edu,effect,eg,eight,eighty,either,else,elsewhere,end,ending,enough,especially,et,et-al,etc,even,ever,every,everybody,everyone,everything,everywhere,ex,except,f,far,few,ff,fifth,first,five,fix,followed,following,follows,for,former,formerly,forth,found,four,from,further,furthermore,g,gave,get,gets,getting,give,given,gives,giving,go,goes,gone,got,gotten,h,had,happens,hardly,has,hasn't,have,haven't,having,he,hed,hence,her,here,hereafter,hereby,herein,heres,hereupon,hers,herself,hes,hi,hid,him,himself,his,hither,home,how,howbeit,however,hundred,i,id,ie,if,i'll,im,immediate,immediately,importance,important,in,inc,indeed,index,information,instead,into,invention,inward,is,isn't,it,itd,it'll,its,itself,i've,j,just,k,keep,keeps,kept,kg,km,know,known,knows,l,largely,last,lately,later,latter,latterly,least,less,lest,let,lets,like,liked,likely,line,little,'ll,look,looking,looks,ltd,m,made,mainly,make,makes,many,may,maybe,me,mean,means,meantime,meanwhile,merely,mg,might,million,miss,ml,more,moreover,most,mostly,mr,mrs,much,mug,must,my,myself,n,na,name,namely,nay,nd,near,nearly,necessarily,necessary,need,needs,neither,never,nevertheless,new,next,nine,ninety,no,nobody,non,none,nonetheless,noone,nor,normally,nos,not,noted,nothing,now,nowhere,o,obtain,obtained,obviously,of,off,often,oh,ok,okay,old,omitted,on,once,one,ones,only,onto,or,ord,other,others,otherwise,ought,our,ours,ourselves,out,outside,over,overall,owing,own,p,page,pages,part,particular,particularly,past,per,perhaps,placed,please,plus,poorly,possible,possibly,potentially,pp,predominantly,present,previously,primarily,probably,promptly,proud,provides,put,q,que,quickly,quite,qv,r,ran,rather,rd,re,readily,really,recent,recently,ref,refs,regarding,regardless,regards,related,relatively,research,respectively,resulted,resulting,results,right,run,s,said,same,saw,say,saying,says,sec,section,see,seeing,seem,seemed,seeming,seems,seen,self,selves,sent,seven,several,shall,she,shed,she'll,shes,should,shouldn't,show,showed,shown,showns,shows,significant,significantly,similar,similarly,since,six,slightly,so,some,somebody,somehow,someone,somethan,something,sometime,sometimes,somewhat,somewhere,soon,sorry,specifically,specified,specify,specifying,still,stop,strongly,sub,substantially,successfully,such,sufficiently,suggest,sup,sure,t,take,taken,taking,tell,tends,th,than,thank,thanks,thanx,that,that'll,thats,that've,the,their,theirs,them,themselves,then,thence,there,thereafter,thereby,thered,therefore,therein,there'll,thereof,therere,theres,thereto,thereupon,there've,these,they,theyd,they'll,theyre,they've,think,this,those,thou,though,thoughh,thousand,throug,through,throughout,thru,thus,til,tip,to,together,too,took,toward,towards,tried,tries,truly,try,trying,ts,twice,two,u,un,under,unfortunately,unless,unlike,unlikely,until,unto,up,upon,ups,us,use,used,useful,usefully,usefulness,uses,using,usually,v,value,various,'ve,very,via,viz,vol,vols,vs,w,want,wants,was,wasnt,way,we,wed,welcome,we'll,went,were,werent,we've,what,whatever,what'll,whats,when,whence,whenever,where,whereafter,whereas,whereby,wherein,wheres,whereupon,wherever,whether,which,while,whim,whither,who,whod,whoever,whole,who'll,whom,whomever,whos,whose,why,widely,willing,wish,with,within,without,wont,words,world,would,wouldnt,www,x,y,yes,yet,you,youd,you'll,your,youre,yours,yourself,yourselves,you've,z,zero");
2842 }
2843 if(!get_option('qlcd_wp_chatbot_order_user')) {
2844 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field('login'));
2845 }
2846 if(!get_option('wp_chatbot_custom_agent_path')) {
2847 update_option('wp_chatbot_custom_agent_path', '');
2848 }
2849 if(!get_option('wp_chatbot_custom_icon_path')) {
2850 update_option('wp_chatbot_custom_icon_path', '');
2851 }
2852
2853 if(!get_option('wp_chatbot_icon')) {
2854 update_option('wp_chatbot_icon', sanitize_text_field('icon-13.png'));
2855 }
2856 if(!get_option('wp_chatbot_floatingiconbg_color')) {
2857 update_option('wp_chatbot_floatingiconbg_color', '#fff');
2858 }
2859 if(!get_option('wp_chatbot_agent_image')){
2860 update_option('wp_chatbot_agent_image',sanitize_text_field('agent-0.png'));
2861 }
2862 if(!get_option('qcld_wb_chatbot_theme')) {
2863 update_option('qcld_wb_chatbot_theme', sanitize_text_field('template-00'));
2864 }
2865 if(!get_option('qcld_wb_chatbot_change_bg')) {
2866 update_option('qcld_wb_chatbot_change_bg', '');
2867 }
2868 if(!get_option('wp_chatbot_custom_css')) {
2869 update_option('wp_chatbot_custom_css', '');
2870 }
2871 if(!get_option('qlcd_wp_chatbot_host')) {
2872 update_option('qlcd_wp_chatbot_host', stripslashes(sanitize_text_field('Our Website')));
2873 }
2874 if(!get_option('qlcd_wp_chatbot_agent')) {
2875 update_option('qlcd_wp_chatbot_agent', stripslashes(sanitize_text_field('Carrie')));
2876 }
2877 if(!get_option('qlcd_wp_chatbot_host')) {
2878 update_option('qlcd_wp_chatbot_host', stripslashes(sanitize_text_field('Our Website')));
2879 }
2880 if(!get_option('qlcd_wp_chatbot_shopper_demo_name')) {
2881 update_option('qlcd_wp_chatbot_shopper_demo_name', stripslashes(sanitize_text_field('Amigo')));
2882 }
2883 if(!get_option('qlcd_wp_chatbot_yes')) {
2884 update_option('qlcd_wp_chatbot_yes', stripslashes(sanitize_text_field('YES')));
2885 }
2886 if(!get_option('qlcd_wp_chatbot_no')) {
2887 update_option('qlcd_wp_chatbot_no', stripslashes(sanitize_text_field('NO')));
2888 }
2889 if(!get_option('qlcd_wp_chatbot_or')) {
2890 update_option('qlcd_wp_chatbot_or', stripslashes(sanitize_text_field('OR')));
2891 }
2892 if(!get_option('qlcd_wp_chatbot_sorry')) {
2893 update_option('qlcd_wp_chatbot_sorry', stripslashes(sanitize_text_field('Sorry')));
2894 }
2895
2896 if(!get_option('qlcd_wp_chatbot_dialogflow_project_id')) {
2897 update_option('qlcd_wp_chatbot_dialogflow_project_id', '');
2898 }
2899 if(!get_option('wp_chatbot_df_api')) {
2900 update_option('wp_chatbot_df_api', 'v1');
2901 }
2902
2903
2904 if(!get_option('qlcd_wp_chatbot_dialogflow_project_key')) {
2905 update_option('qlcd_wp_chatbot_dialogflow_project_key', '');
2906 }
2907
2908 if(!get_option('qlcd_wp_chatbot_agent_join')) {
2909 update_option('qlcd_wp_chatbot_agent_join', maybe_serialize(array('has joined the conversation')));
2910 }
2911 if(!get_option('qlcd_wp_chatbot_welcome')) {
2912 update_option('qlcd_wp_chatbot_welcome', maybe_serialize(array('Welcome to', 'Glad to have you at')));
2913 }
2914 if(!get_option('qlcd_wp_chatbot_back_to_start')) {
2915 update_option('qlcd_wp_chatbot_back_to_start', maybe_serialize(array('Back to Start')));
2916 }
2917 if(!get_option('qlcd_wp_chatbot_hi_there')) {
2918 update_option('qlcd_wp_chatbot_hi_there', maybe_serialize(array('Hi There!')));
2919 }
2920 if(!get_option('qlcd_wp_chatbot_hello')) {
2921 update_option('qlcd_wp_chatbot_hello', maybe_serialize(array('Hi There!')));
2922 }
2923 if(!get_option('qlcd_wp_chatbot_welcome_back')) {
2924 update_option('qlcd_wp_chatbot_welcome_back', maybe_serialize(array('Welcome back', 'Good to see your again')));
2925 }
2926 if(!get_option('qlcd_wp_chatbot_asking_name')) {
2927 update_option('qlcd_wp_chatbot_asking_name', maybe_serialize(array('May I know your name?', 'What should I call you?')));
2928 }
2929 if(!get_option('qlcd_wp_chatbot_name_greeting')) {
2930 update_option('qlcd_wp_chatbot_name_greeting', maybe_serialize(array('Nice to meet you')));
2931 }
2932 if(!get_option('qlcd_wp_chatbot_i_am')) {
2933 update_option('qlcd_wp_chatbot_i_am', maybe_serialize(array('I am', 'This is')));
2934 }
2935 if(!get_option('qlcd_wp_chatbot_is_typing')) {
2936 update_option('qlcd_wp_chatbot_is_typing', maybe_serialize(array('is typing...')));
2937 }
2938 if(!get_option('qlcd_wp_chatbot_send_a_msg')) {
2939 update_option('qlcd_wp_chatbot_send_a_msg', maybe_serialize(array('Send a message.')));
2940 }
2941 if(!get_option('qlcd_wp_chatbot_choose_option')) {
2942 update_option('qlcd_wp_chatbot_choose_option', maybe_serialize(array('Choose an option.')));
2943 }
2944 if(!get_option('qlcd_wp_chatbot_viewed_products')) {
2945 update_option('qlcd_wp_chatbot_viewed_products', maybe_serialize(array('Recently viewed products')));
2946 }
2947 if(!get_option('qlcd_wp_chatbot_add_to_cart')) {
2948 update_option('qlcd_wp_chatbot_add_to_cart', maybe_serialize(array('Add to Cart')));
2949 }
2950 if(!get_option('qlcd_wp_chatbot_cart_link')) {
2951 update_option('qlcd_wp_chatbot_cart_link', maybe_serialize(array('Cart')));
2952 }
2953 if(!get_option('qlcd_wp_chatbot_checkout_link')) {
2954 update_option('qlcd_wp_chatbot_checkout_link', maybe_serialize(array('Checkout')));
2955 }
2956 if(!get_option('qlcd_wp_chatbot_featured_product_welcome')) {
2957 update_option('qlcd_wp_chatbot_featured_product_welcome', maybe_serialize(array('I have found following featured products')));
2958 }
2959 if(!get_option('qlcd_wp_chatbot_viewed_product_welcome')) {
2960 update_option('qlcd_wp_chatbot_viewed_product_welcome', maybe_serialize(array('I have found following recently viewed products')));
2961 }
2962 if(!get_option('qlcd_wp_chatbot_latest_product_welcome')) {
2963 update_option('qlcd_wp_chatbot_latest_product_welcome', maybe_serialize(array('I have found following latest products')));
2964 }
2965 if(!get_option('qlcd_wp_chatbot_cart_welcome')) {
2966 update_option('qlcd_wp_chatbot_cart_welcome', maybe_serialize(array('I have found following items from Shopping Cart.')));
2967 }
2968 if(!get_option('qlcd_wp_chatbot_cart_title')) {
2969 update_option('qlcd_wp_chatbot_cart_title', maybe_serialize(array('Title')));
2970 }
2971 if(!get_option('qlcd_wp_chatbot_cart_quantity')) {
2972 update_option('qlcd_wp_chatbot_cart_quantity', maybe_serialize(array('Qty')));
2973 }
2974 if(!get_option('qlcd_wp_chatbot_cart_price')) {
2975 update_option('qlcd_wp_chatbot_cart_price', maybe_serialize(array('Price')));
2976 }
2977 if(!get_option('qlcd_wp_chatbot_no_cart_items')) {
2978 update_option('qlcd_wp_chatbot_no_cart_items', maybe_serialize(array('No items in the cart')));
2979 }
2980 if(!get_option('qlcd_wp_chatbot_cart_updating')) {
2981 update_option('qlcd_wp_chatbot_cart_updating', maybe_serialize(array('Updating cart items ...')));
2982 }
2983 if(!get_option('qlcd_wp_chatbot_cart_removing')) {
2984 update_option('qlcd_wp_chatbot_cart_removing', maybe_serialize(array('Removing cart items ...')));
2985 }
2986 if(!get_option('qlcd_wp_chatbot_wildcard_msg')) {
2987 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize(array('I am here to find what you need. What are you looking for?')));
2988 }
2989 if(!get_option('qlcd_wp_chatbot_empty_filter_msg')) {
2990 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize(array('Sorry, I did not understand you.')));
2991 }
2992 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2993 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
2994 }
2995 if(!get_option('qlcd_wp_chatbot_sys_key_help')) {
2996 update_option('qlcd_wp_chatbot_sys_key_help', 'start');
2997 }
2998 if(!get_option('qlcd_wp_chatbot_sys_key_product')) {
2999 update_option('qlcd_wp_chatbot_sys_key_product', 'product');
3000 }
3001 if(!get_option('qlcd_wp_chatbot_sys_key_catalog')) {
3002 update_option('qlcd_wp_chatbot_sys_key_catalog', 'catalog');
3003 }
3004 if(!get_option('qlcd_wp_chatbot_sys_key_order')) {
3005 update_option('qlcd_wp_chatbot_sys_key_order', 'order');
3006 }
3007 if(!get_option('qlcd_wp_chatbot_sys_key_support')) {
3008 update_option('qlcd_wp_chatbot_sys_key_support', 'faq');
3009 }
3010 if(!get_option('qlcd_wp_chatbot_sys_key_reset')) {
3011 update_option('qlcd_wp_chatbot_sys_key_reset', 'reset');
3012 }
3013 if(!get_option('qlcd_wp_chatbot_sys_key_email')) {
3014 update_option('qlcd_wp_chatbot_sys_key_email', 'email');
3015 }
3016 if(!get_option('qlcd_wp_chatbot_help_welcome')) {
3017 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize(array('Welcome to Help Section.')));
3018 }
3019 if(!get_option('qlcd_wp_chatbot_help_msg')) {
3020 update_option('qlcd_wp_chatbot_help_msg', maybe_serialize(array('<b>Type and Hit Enter</b><br><ul><li> <b>start</b> to Get back to the main menu. </li><li> <b>faq</b> for FAQ. </li><li> <b>email </b> to send eMail </li><li> <b>reset</b> to restart the chat</li></ul>')));
3021 }
3022 if(!get_option('qlcd_wp_chatbot_reset')) {
3023 update_option('qlcd_wp_chatbot_reset', maybe_serialize(array('Do you want to clear our chat history and start over?')));
3024 }
3025 if(!get_option('qlcd_wp_chatbot_wildcard_product')) {
3026 update_option('qlcd_wp_chatbot_wildcard_product', maybe_serialize(array('Product Search')));
3027 }
3028 if(!get_option('qlcd_wp_chatbot_wildcard_catalog')) {
3029 update_option('qlcd_wp_chatbot_wildcard_catalog', maybe_serialize(array('Catalog')));
3030 }
3031 if(!get_option('qlcd_wp_chatbot_featured_products')) {
3032 update_option('qlcd_wp_chatbot_featured_products', maybe_serialize(array('Featured Products')));
3033 }
3034 if(!get_option('qlcd_wp_chatbot_sale_products')) {
3035 update_option('qlcd_wp_chatbot_sale_products', maybe_serialize(array('Products on Sale')));
3036 }
3037 if(!get_option('qlcd_wp_chatbot_wildcard_support')) {
3038 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
3039 }
3040 if(!get_option('qlcd_wp_chatbot_wildcard_site_search')) {
3041 update_option('qlcd_wp_chatbot_wildcard_site_search', 'Site Search');
3042 }
3043 if(!get_option('qlcd_wp_chatbot_messenger_label')) {
3044 update_option('qlcd_wp_chatbot_messenger_label', maybe_serialize(array('Chat with Us on Facebook Messenger')));
3045 }
3046 if(!get_option('qlcd_wp_chatbot_product_success')) {
3047 update_option('qlcd_wp_chatbot_product_success', maybe_serialize(array('Great! We have these products for', 'Found these products for')));
3048 }
3049 if(!get_option('qlcd_wp_chatbot_product_fail')) {
3050 update_option('qlcd_wp_chatbot_product_fail', maybe_serialize(array('Sorry, I found nothing')));
3051 }
3052 if(!get_option('qlcd_wp_chatbot_product_asking')) {
3053 update_option('qlcd_wp_chatbot_product_asking', maybe_serialize(array('What are you shopping for?')));
3054 }
3055 if(!get_option('qlcd_wp_chatbot_product_suggest')) {
3056 update_option('qlcd_wp_chatbot_product_suggest', maybe_serialize(array('You can browse our extensive catalog. Just pick a category from below:')));
3057 }
3058 if(!get_option('qlcd_wp_chatbot_product_infinite')) {
3059 update_option('qlcd_wp_chatbot_product_infinite', maybe_serialize(array('Too many choices? Let\'s try another search term', 'I may have something else for you. Why not search again?')));
3060 }
3061 if(!get_option('qlcd_wp_chatbot_load_more')) {
3062 update_option('qlcd_wp_chatbot_load_more', maybe_serialize(array('Load More')));
3063 }
3064 if(!get_option('qlcd_wp_chatbot_wildcard_order')) {
3065 update_option('qlcd_wp_chatbot_wildcard_order', maybe_serialize(array('Order Status')));
3066 }
3067 if(!get_option('qlcd_wp_chatbot_order_welcome')) {
3068 update_option('qlcd_wp_chatbot_order_welcome', maybe_serialize(array('Welcome to Order status section!')));
3069 }
3070 if(!get_option('qlcd_wp_chatbot_order_username_asking')) {
3071 update_option('qlcd_wp_chatbot_order_username_asking', maybe_serialize(array('Please type your username?')));
3072 }
3073 if(!get_option('qlcd_wp_chatbot_order_username_password')) {
3074 update_option('qlcd_wp_chatbot_order_username_password', maybe_serialize(array('Please type your password')));
3075 }
3076 if(!get_option('qlcd_wp_chatbot_order_username_not_exist')) {
3077 update_option('qlcd_wp_chatbot_order_username_not_exist', maybe_serialize(array('This username does not exist.')));
3078 }
3079 if(!get_option('qlcd_wp_chatbot_order_username_thanks')) {
3080 update_option('qlcd_wp_chatbot_order_username_thanks', maybe_serialize(array('Thank you for the username')));
3081 }
3082 if(!get_option('qlcd_wp_chatbot_order_password_incorrect')) {
3083 update_option('qlcd_wp_chatbot_order_password_incorrect', maybe_serialize(array('Sorry Password is not correct!')));
3084 }
3085 if(!get_option('qlcd_wp_chatbot_asking_email')) {
3086 update_option('qlcd_wp_chatbot_asking_email', maybe_serialize(array('Please provide your email address')));
3087 }
3088 if(!get_option('qlcd_wp_chatbot_order_not_found')) {
3089 update_option('qlcd_wp_chatbot_order_not_found', maybe_serialize(array('I did not find any order by you')));
3090 }
3091 if(!get_option('qlcd_wp_chatbot_order_found')) {
3092 update_option('qlcd_wp_chatbot_order_found', maybe_serialize(array('I have found the following orders')));
3093 }
3094 if(!get_option('qlcd_wp_chatbot_order_email_support')) {
3095 update_option('qlcd_wp_chatbot_order_email_support', maybe_serialize(array('Email our support center about your order.')));
3096 }
3097 if(!get_option('qlcd_wp_chatbot_support_welcome')) {
3098 update_option('qlcd_wp_chatbot_support_welcome', maybe_serialize(array('Welcome to FAQ Section')));
3099 }
3100 if(!get_option('qlcd_wp_chatbot_support_email')) {
3101 update_option('qlcd_wp_chatbot_support_email', 'Send us Email.');
3102 }
3103 if(!get_option('qlcd_wp_chatbot_asking_msg')) {
3104 update_option('qlcd_wp_chatbot_asking_msg', maybe_serialize(array('Thank you for email address. Please write your message now.')));
3105 }
3106 if(!get_option('qlcd_wp_chatbot_no_result')) {
3107 update_option('qlcd_wp_chatbot_no_result', maybe_serialize(array('Sorry, No result found!')));
3108 }
3109 if(!get_option('qlcd_wp_chatbot_invalid_email')) {
3110 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize(array('Sorry, Email address is not valid! Please provide a valid email.')));
3111 }
3112 if(!get_option('qlcd_wp_chatbot_support_phone')) {
3113 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
3114 }
3115 if(!get_option('qlcd_wp_chatbot_asking_phone')) {
3116 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize(array('Please provide your Phone number')));
3117 }
3118 if(!get_option('qlcd_wp_chatbot_thank_for_phone')) {
3119 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize(array('Thank you for Phone number')));
3120 }
3121 if(!get_option('qlcd_wp_chatbot_support_option_again')) {
3122 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize(array('You may choose option from below.')));
3123 }
3124 if(!get_option('qlcd_wp_chatbot_admin_email')) {
3125 update_option('qlcd_wp_chatbot_admin_email', $admin_email);
3126 }
3127 if(!get_option('qlcd_wp_chatbot_email_sub')) {
3128 update_option('qlcd_wp_chatbot_email_sub', sanitize_text_field('WPBot Support Mail'));
3129 }
3130 if(!get_option('qlcd_wp_site_search')) {
3131 update_option('qlcd_wp_site_search', sanitize_text_field('Site Search'));
3132 }
3133 if(!get_option('qlcd_wp_chatbot_email_sent')) {
3134 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field('Your email was sent successfully.Thanks!'));
3135 }
3136 if(!get_option('qlcd_wp_chatbot_email_fail')) {
3137 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field('Sorry! I could not send your mail! Please contact the webmaster.'));
3138 }
3139 if(!get_option('qlcd_wp_chatbot_relevant_post_link_openai')) {
3140 update_option('qlcd_wp_chatbot_relevant_post_link_openai', sanitize_text_field('Check the relevant pages for more details and up to date information:'));
3141 }
3142 if(!get_option('qlcd_wp_chatbot_notification_interval')) {
3143 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field(5));
3144 }
3145 if(!get_option('qlcd_wp_chatbot_notifications')) {
3146 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
3147 }
3148 if(!get_option('support_query')) {
3149 update_option('support_query', maybe_serialize(array('Sample Question?')));
3150 }
3151 if(!get_option('support_ans')) {
3152 update_option('support_ans', maybe_serialize(array('Sample Answer')));
3153 }
3154 if(!get_option('qlcd_wp_chatbot_search_option')) {
3155 update_option('qlcd_wp_chatbot_search_option', 'standard');
3156 }
3157 if(!get_option('wp_chatbot_index_count')) {
3158 update_option('wp_chatbot_index_count', 0);
3159 }
3160 if(!get_option('wp_chatbot_app_pages')) {
3161 update_option('wp_chatbot_app_pages', 0);
3162 }
3163 //messenger options.
3164 if(!get_option('enable_wp_chatbot_messenger')) {
3165 update_option('enable_wp_chatbot_messenger', '');
3166 }
3167 if(!get_option('enable_wp_chatbot_messenger_floating_icon')) {
3168 update_option('enable_wp_chatbot_messenger_floating_icon', '');
3169 }
3170 if(!get_option('qlcd_wp_chatbot_fb_app_id')) {
3171 update_option('qlcd_wp_chatbot_fb_app_id', '');
3172 }
3173 if(!get_option('qlcd_wp_chatbot_fb_page_id')) {
3174 update_option('qlcd_wp_chatbot_fb_page_id', '');
3175 }
3176 if(!get_option('qlcd_wp_chatbot_fb_color')) {
3177 update_option('qlcd_wp_chatbot_fb_color', '#0084ff');
3178 }
3179 if(!get_option('qlcd_wp_chatbot_fb_in_msg')) {
3180 update_option('qlcd_wp_chatbot_fb_in_msg', 'Welcome to WPBot!');
3181 }
3182 if(!get_option('qlcd_wp_chatbot_fb_out_msg')) {
3183 update_option('qlcd_wp_chatbot_fb_out_msg', 'You are not logged in');
3184 }
3185 //Skype option
3186 if(!get_option('enable_wp_chatbot_skype_floating_icon')) {
3187 update_option('enable_wp_chatbot_skype_floating_icon', '');
3188 }
3189 if(!get_option('enable_wp_chatbot_skype_id')) {
3190 update_option('enable_wp_chatbot_skype_id', '');
3191 }
3192 //Whats App
3193 if(!get_option('enable_wp_chatbot_whats')) {
3194 update_option('enable_wp_chatbot_whats', '');
3195 }
3196 if(!get_option('qlcd_wp_chatbot_whats_label')) {
3197 update_option('qlcd_wp_chatbot_whats_label', maybe_serialize(array('Chat with Us on WhatsApp')));
3198 }
3199 if(!get_option('enable_wp_chatbot_floating_whats')) {
3200 update_option('enable_wp_chatbot_floating_whats', '');
3201 }
3202 if(!get_option('qlcd_wp_chatbot_whats_num')) {
3203 update_option('qlcd_wp_chatbot_whats_num', '');
3204 }
3205 //Viber
3206 if(!get_option('enable_wp_chatbot_floating_viber')) {
3207 update_option('enable_wp_chatbot_floating_viber', '');
3208 }
3209 if(!get_option('qlcd_wp_chatbot_viber_acc')) {
3210 update_option('qlcd_wp_chatbot_viber_acc', '');
3211 }
3212 //Integration others
3213 if(!get_option('enable_wp_chatbot_floating_phone')) {
3214 update_option('enable_wp_chatbot_floating_phone', '');
3215 }
3216 if(!get_option('qlcd_wp_chatbot_phone')) {
3217 update_option('qlcd_wp_chatbot_phone', '');
3218 }
3219 if(!get_option('enable_wp_chatbot_floating_link')) {
3220 update_option('enable_wp_chatbot_floating_link', '');
3221 }
3222
3223 if(!get_option('qlcd_wp_chatbot_weblink')) {
3224 update_option('qlcd_wp_chatbot_weblink', '');
3225 }
3226 //Re-Tagetting
3227 if(!get_option('qlcd_wp_chatbot_ret_greet')) {
3228 update_option('qlcd_wp_chatbot_ret_greet', 'Hello');
3229 }
3230 if(!get_option('enable_wp_chatbot_exit_intent')) {
3231 update_option('enable_wp_chatbot_exit_intent', '');
3232 }
3233 if(!get_option('wp_chatbot_exit_intent_msg')) {
3234 update_option('wp_chatbot_exit_intent_msg', 'WAIT, WE HAVE A SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
3235 }
3236 if(!get_option('wp_chatbot_exit_intent_once')) {
3237 update_option('wp_chatbot_exit_intent_once', '');
3238 }
3239
3240 if(!get_option('enable_wp_chatbot_scroll_open')) {
3241 update_option('enable_wp_chatbot_scroll_open', '');
3242 }
3243 if(!get_option('wp_chatbot_scroll_open_msg')) {
3244 update_option('wp_chatbot_scroll_open_msg', 'WE HAVE A VERY SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
3245 }
3246 if(!get_option('wp_chatbot_scroll_percent')) {
3247 update_option('wp_chatbot_scroll_percent', 50);
3248 }
3249 if(!get_option('wp_chatbot_scroll_once')) {
3250 update_option('wp_chatbot_scroll_once', '');
3251 }
3252
3253 if(!get_option('enable_wp_chatbot_auto_open')) {
3254 update_option('enable_wp_chatbot_auto_open', '');
3255 }
3256
3257 if(!get_option('enable_wp_chatbot_ret_sound')) {
3258 update_option('enable_wp_chatbot_ret_sound', '');
3259 }
3260 if(!get_option('enable_wp_chatbot_sound_initial')) {
3261 update_option('enable_wp_chatbot_sound_initial', '');
3262 }
3263
3264
3265 if(!get_option('wp_chatbot_auto_open_msg')) {
3266 update_option('wp_chatbot_auto_open_msg', 'A SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
3267 }
3268 if(!get_option('wp_chatbot_auto_open_time')) {
3269 update_option('wp_chatbot_auto_open_time', 10);
3270 }
3271 if(!get_option('wp_chatbot_auto_open_once')) {
3272 update_option('wp_chatbot_auto_open_once', '');
3273 }
3274 if(!get_option('wp_chatbot_inactive_once')) {
3275 update_option('wp_chatbot_inactive_once', '');
3276 }
3277
3278 //To complete checkout.
3279 if(!get_option('enable_wp_chatbot_ret_user_show')) {
3280 update_option('enable_wp_chatbot_ret_user_show', '');
3281 }
3282 if(!get_option('wp_chatbot_auto_open_msg')) {
3283 update_option('wp_chatbot_checkout_msg', 'You have products in shopping cart, please complete your order.');
3284 }
3285 if(!get_option('wp_chatbot_inactive_time')) {
3286 update_option('wp_chatbot_inactive_time', 300);
3287 }
3288 if(!get_option('enable_wp_chatbot_inactive_time_show')) {
3289 update_option('enable_wp_chatbot_inactive_time_show', '');
3290 }
3291
3292 if(!get_option('wp_chatbot_proactive_bg_color')) {
3293 update_option('wp_chatbot_proactive_bg_color', '#ffffff');
3294 }
3295 if(!get_option('disable_wp_chatbot_feedback')) {
3296 update_option('disable_wp_chatbot_feedback','');
3297 }
3298 if(!get_option('disable_wp_chatbot_faq')) {
3299 update_option('disable_wp_chatbot_faq','');
3300 }
3301 if(!get_option('qlcd_wp_chatbot_feedback_label')) {
3302 update_option('qlcd_wp_chatbot_feedback_label',maybe_serialize(array('Send Feedback')));
3303 }
3304
3305 if(!get_option('enable_wp_chatbot_meta_title')) {
3306 update_option('enable_wp_chatbot_meta_title','');
3307 }
3308 if(!get_option('qlcd_wp_chatbot_meta_label')) {
3309 update_option('qlcd_wp_chatbot_meta_label','*New Messages');
3310 }
3311
3312 if(!get_option('disable_wp_chatbot_call_gen')) {
3313 update_option('disable_wp_chatbot_call_gen', '');
3314 }
3315
3316 if(!get_option('disable_wp_chatbot_site_search')) {
3317 update_option('disable_wp_chatbot_site_search', '');
3318 }
3319 if(!get_option('disable_wp_chatbot_call_sup')) {
3320 update_option('disable_wp_chatbot_call_sup', '');
3321 }
3322
3323 if(!get_option('qlcd_wp_chatbot_phone_sent')) {
3324 update_option('qlcd_wp_chatbot_phone_sent', 'Thanks for your phone number. We will call you ASAP!');
3325 }
3326 if(!get_option('qlcd_wp_chatbot_phone_fail')) {
3327 update_option('qlcd_wp_chatbot_phone_fail', 'Sorry! I could not collect your phone number!');
3328 }
3329 if(!get_option('qlcd_wp_chatbot_asking_search_keyword')){
3330 update_option('qlcd_wp_chatbot_asking_search_keyword', 'Please enter your keyword for searching');
3331 }
3332 if(!get_option('qlcd_wp_chatbot_found_result')){
3333 update_option('qlcd_wp_chatbot_found_result', 'We have found these results');
3334 }
3335 if(!get_option('enable_wp_chatbot_opening_hour')) {
3336 update_option('enable_wp_chatbot_opening_hour', '');
3337 }
3338 if(!get_option('enable_wp_chatbot_opening_hour')) {
3339 update_option('wpwbot_hours', array());
3340 }
3341 wpbot_free_set_content_height_defaults();
3342
3343 if(!get_option('enable_wp_chatbot_dailogflow')) {
3344 update_option('enable_wp_chatbot_dailogflow', '');
3345 }
3346 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
3347 update_option('qlcd_wp_chatbot_dialogflow_client_token', '');
3348 }
3349 if(!get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')) {
3350 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', 'Sorry, I did not understand you. You may browse');
3351 }
3352 if(!get_option('openai_max_tokens')) {
3353 update_option('openai_max_tokens', '200');
3354 }
3355 if(!get_option('qcld_openai_suffix')) {
3356 update_option('qcld_openai_suffix', 'qcld');
3357 }
3358 if(!get_option('qlcd_wp_chatbot_dialogflow_agent_language')) {
3359 update_option('qlcd_wp_chatbot_dialogflow_agent_language', 'en');
3360 }
3361 if(!get_option('enable_wp_chatbot_post_content')) {
3362 update_option('enable_wp_chatbot_post_content', '1');
3363 }
3364 if(!get_option('openai_engines')) {
3365 update_option('openai_engines', 'gpt-4o');
3366 }
3367 // if(!get_option('skip_wp_greetings')) {
3368 update_option('skip_wp_greetings', '');
3369 //}
3370 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3371 }
3372 }
3373 /*
3374 * Reset Options will be insert as defualt data
3375 */
3376 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3377 //add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3378
3379 add_action('wp_ajax_qcld_save_ai_form', 'qcld_save_ai_form');
3380 add_action('wp_ajax_nopriv_qcld_save_ai_form', 'qcld_save_ai_form');
3381
3382 function qcld_save_ai_form() {
3383 check_ajax_referer('wp_chatbot', 'nonce');
3384 if (isset($_POST['data'])) {
3385 $data_string = stripslashes($_POST['data']);
3386 $json_data = json_decode($data_string, true);
3387 if ($json_data && isset($json_data['form_title'])) {
3388 $post_title = sanitize_text_field($json_data['form_title']) . ' - ' . current_time('mysql');
3389 $post_id = wp_insert_post(array(
3390 'post_title' => $post_title,
3391 'post_type' => 'wpbot_form_entry',
3392 'post_status' => 'publish'
3393 ));
3394 if ($post_id && isset($json_data['data']) && is_array($json_data['data'])) {
3395 $email_body = "<h2>" . esc_html__('New AI Action Submission', 'chatbot') . "</h2>";
3396 $email_body .= "<p><strong>" . esc_html__('Action', 'chatbot') . ":</strong> " . sanitize_text_field($json_data['form_title']) . "</p>";
3397 $email_body .= "<table border='1' cellpadding='10' cellspacing='0' style='border-collapse: collapse; width: 100%; max-width: 600px; font-family: sans-serif;'>";
3398
3399 // Extract user's email for Reply-To (not From, to avoid SMTP rejection)
3400 $reply_to = '';
3401
3402 foreach ($json_data['data'] as $key => $value) {
3403 update_post_meta($post_id, sanitize_text_field($key), sanitize_text_field($value));
3404 $clean_key = ucwords(str_replace(array('-', '_'), ' ', sanitize_text_field($key)));
3405 $email_body .= "<tr><td style='background: #f4f4f4; width: 40%;'><strong>" . esc_html($clean_key) . "</strong></td><td>" . esc_html(sanitize_text_field($value)) . "</td></tr>";
3406
3407 // Extract email from value — handles plain, [bracketed], and combined answers
3408 if (preg_match('/\[?([a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,})\]?/', $value, $email_match)) {
3409 $candidate = sanitize_email(trim($email_match[1]));
3410 if (is_email($candidate)) {
3411 $reply_to = $candidate;
3412 }
3413 }
3414 }
3415 $email_body .= "</table>";
3416
3417 $email_enabled = true; // Default to true if not found for backwards compatibility
3418 $per_action_emails = '';
3419 $saved_forms = get_option('wpbot_ai_forms', array());
3420 $ai_form_title = strtolower( trim( sanitize_text_field( $json_data['form_title'] ) ) );
3421 if (is_array($saved_forms)) {
3422 foreach ($saved_forms as $form) {
3423 if ( strtolower( trim( $form['title'] ) ) === $ai_form_title ) {
3424 if (isset($form['email'])) {
3425 $email_enabled = $form['email'] == 1;
3426 }
3427 $per_action_emails = isset($form['email_addresses']) ? trim($form['email_addresses']) : '';
3428 break;
3429 }
3430 }
3431 }
3432
3433 if ($email_enabled) {
3434 if (!empty($per_action_emails)) {
3435 $to = array_map('trim', explode(',', $per_action_emails));
3436 } else {
3437 $default = get_option('qlcd_wp_chatbot_admin_email', '');
3438 $to = !empty($default) ? array_map('trim', explode(',', $default)) : get_option('admin_email');
3439 }
3440 $subject = sanitize_text_field($json_data['form_title']) . " - " . esc_html__('New AI Action Submission', 'chatbot');
3441 $headers = array('Content-Type: text/html; charset=UTF-8');
3442 if (!empty($reply_to)) {
3443 $headers[] = 'Reply-To: ' . $reply_to;
3444 }
3445 wp_mail($to, $subject, $email_body, $headers);
3446 }
3447
3448 wp_send_json_success('Saved successfully');
3449 }
3450 }
3451 }
3452 wp_send_json_error('Failed to save');
3453 }
3454
3455 add_action('wp_ajax_qcld_get_ai_form_entries', 'qcld_get_ai_form_entries');
3456 function qcld_get_ai_form_entries() {
3457 check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3458 if (!current_user_can('manage_options')) {
3459 wp_send_json_error('Unauthorized');
3460 }
3461 $form_title = isset($_POST['form_title']) ? sanitize_text_field($_POST['form_title']) : '';
3462 if (empty($form_title)) {
3463 wp_send_json_error('No title provided');
3464 }
3465
3466 global $wpdb;
3467 $title_prefix = $form_title . ' - ';
3468 $where_filter = function ( $where ) use ( $wpdb, $title_prefix ) {
3469 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s", $wpdb->esc_like( $title_prefix ) . '%' );
3470 return $where;
3471 };
3472 add_filter( 'posts_where', $where_filter );
3473 $query = new WP_Query( array(
3474 'post_type' => 'wpbot_form_entry',
3475 'post_status' => 'publish',
3476 'posts_per_page' => -1,
3477 ) );
3478 remove_filter( 'posts_where', $where_filter );
3479
3480 ob_start();
3481 if ($query->have_posts()) {
3482 echo '<table class="wp-list-table widefat fixed striped" style="width: 100%; text-align: left;">';
3483 echo '<thead><tr><th>Entry</th><th>Data</th><th>Date</th><th>Action</th></tr></thead>';
3484 echo '<tbody>';
3485 while ($query->have_posts()) {
3486 $query->the_post();
3487 $meta = get_post_meta(get_the_ID());
3488 echo '<tr>';
3489 echo '<td><strong>' . esc_html( get_the_title() ) . '</strong></td>';
3490 echo '<td>';
3491 foreach ($meta as $key => $values) {
3492 if (strpos($key, '_') !== 0) { // skip hidden meta
3493 echo '<strong>' . esc_html($key) . ':</strong> ' . esc_html($values[0]) . '<br>';
3494 }
3495 }
3496 echo '</td>';
3497 echo '<td>' . esc_html( get_the_date() ) . ' ' . esc_html( get_the_time() ) . '</td>';
3498 echo '<td><button type="button" class="button qcld-delete-ai-entry" data-id="' . esc_attr(get_the_ID()) . '" style="color: #a00; border-color: #a00;">Delete</button></td>';
3499 echo '</tr>';
3500 }
3501 echo '</tbody></table>';
3502 wp_reset_postdata();
3503 } else {
3504 echo '<p>No entries found for this form.</p>';
3505 }
3506 $html = ob_get_clean();
3507 wp_send_json_success(array('html' => $html));
3508 }
3509
3510 add_action('wp_ajax_qcld_delete_ai_form_entry', 'qcld_delete_ai_form_entry');
3511 function qcld_delete_ai_form_entry() {
3512 check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3513 if (!current_user_can('manage_options')) {
3514 wp_send_json_error('Unauthorized');
3515 }
3516
3517 $entry_id = isset($_POST['entry_id']) ? intval($_POST['entry_id']) : 0;
3518 if (empty($entry_id)) {
3519 wp_send_json_error('No entry ID provided');
3520 }
3521
3522 if (get_post_type($entry_id) === 'wpbot_form_entry') {
3523 wp_delete_post($entry_id, true);
3524 wp_send_json_success('Entry deleted successfully');
3525 } else {
3526 wp_send_json_error('Invalid entry');
3527 }
3528 }
3529 //Jarvis all option will be delete during uninstlling.
3530 if( !function_exists('qcld_wb_chatboot_delete_all_options') ){
3531 function qcld_wb_chatboot_delete_all_options(){
3532
3533 if ( ! current_user_can( 'manage_options' ) ) {
3534 wp_die( 'Unauthorized access' );
3535 }
3536
3537 if ( ! isset( $_POST['wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wpnonce'] ) ), 'wp_chatbot' ) ) {
3538 wp_die( 'No cheating' );
3539 }
3540 delete_option('disable_wp_chatbot');
3541 delete_option('disable_wp_chatbot_icon_animation');
3542 delete_option('disable_wp_chatbot_on_mobile');
3543 delete_option('qlcd_wp_chatbot_admin_email');
3544 delete_option('qlcd_wp_chatbot_from_email');
3545
3546 delete_option('disable_back_to_start_menu');
3547 delete_option('disable_floating_button');
3548
3549 delete_option('disable_wp_chatbot_product_search');
3550 delete_option('disable_wp_chatbot_catalog');
3551 delete_option('disable_wp_chatbot_order_status');
3552 delete_option('disable_wp_chatbot_notification');
3553 delete_option('enable_wp_chatbot_rtl');
3554 delete_option('show_menu_after_greetings');
3555 delete_option('enable_chat_session');
3556
3557 delete_option('enable_wp_chatbot_mobile_full_screen');
3558 delete_option('wpbot_preloading_time');
3559 delete_option('disable_wp_chatbot_cart_item_number');
3560 delete_option('disable_wp_chatbot_featured_product');
3561 delete_option('disable_wp_chatbot_sale_product');
3562 delete_option('wp_chatbot_open_product_detail');
3563 delete_option('qlcd_wp_chatbot_product_orderby');
3564 delete_option('qlcd_wp_chatbot_product_order');
3565 delete_option('qlcd_wp_chatbot_ppp');
3566 delete_option('wp_chatbot_show_parent_category');
3567 delete_option('wp_chatbot_show_sub_category');
3568 delete_option('wp_chatbot_exclude_stock_out_product');
3569 delete_option('wp_chatbot_show_home_page');
3570 delete_option('qc_wpbot_menu_order');
3571
3572 delete_option('wp_chatbot_show_posts');
3573 delete_option('wp_chatbot_show_pages');
3574 delete_option('wp_chatbot_show_pages_list');
3575 delete_option('wp_chatbot_exclude_post_list');
3576 delete_option('wp_chatbot_show_wpcommerce');
3577 delete_option('qlcd_wp_chatbot_stop_words_name');
3578 delete_option('qlcd_wp_chatbot_stop_words');
3579 delete_option('qlcd_wp_chatbot_order_user');
3580 delete_option('wp_chatbot_icon');
3581 delete_option('wp_chatbot_floatingiconbg_color');
3582 delete_option('wp_chatbot_agent_image');
3583 delete_option('qcld_wb_chatbot_theme');
3584 delete_option('qcld_wb_chatbot_change_bg');
3585 delete_option('wp_chatbot_custom_css');
3586 delete_option('qlcd_wp_chatbot_host');
3587 delete_option('qlcd_wp_chatbot_agent');
3588 delete_option('qlcd_wp_chatbot_yes');
3589 delete_option('qlcd_wp_chatbot_no');
3590 delete_option('qlcd_wp_chatbot_or');
3591 delete_option('qlcd_wp_chatbot_sorry');
3592 delete_option('qlcd_wp_chatbot_agent_join');
3593 delete_option('qlcd_wp_chatbot_welcome');
3594 delete_option('qlcd_wp_chatbot_back_to_start');
3595 delete_option('qlcd_wp_chatbot_hi_there');
3596 delete_option('qlcd_wp_chatbot_hello');
3597 delete_option('qlcd_wp_chatbot_welcome_back');
3598 delete_option('qlcd_wp_chatbot_asking_name');
3599 delete_option('qlcd_wp_chatbot_name_greeting');
3600 delete_option('qlcd_wp_chatbot_i_am');
3601 delete_option('qlcd_wp_chatbot_wildcard_msg');
3602 delete_option('qlcd_wp_chatbot_empty_filter_msg');
3603 delete_option('qlcd_wp_chatbot_did_you_mean');
3604 delete_option('qlcd_wp_chatbot_wildcard_product');
3605 delete_option('qlcd_wp_chatbot_wildcard_catalog');
3606 delete_option('qlcd_wp_chatbot_featured_products');
3607 delete_option('qlcd_wp_chatbot_sale_products');
3608 delete_option('qlcd_wp_chatbot_wildcard_support');
3609 delete_option('qlcd_wp_chatbot_wildcard_site_search');
3610 delete_option('qlcd_wp_chatbot_messenger_label');
3611 delete_option('qlcd_wp_chatbot_product_success');
3612 delete_option('qlcd_wp_chatbot_product_fail');
3613 delete_option('qlcd_wp_chatbot_product_asking');
3614 delete_option('qlcd_wp_chatbot_product_suggest');
3615 delete_option('qlcd_wp_chatbot_product_infinite');
3616 delete_option('qlcd_wp_chatbot_load_more');
3617 delete_option('qlcd_wp_chatbot_wildcard_order');
3618 delete_option('qlcd_wp_chatbot_order_welcome');
3619 delete_option('qlcd_wp_chatbot_order_username_asking');
3620 delete_option('qlcd_wp_chatbot_order_username_password');
3621 delete_option('qlcd_wp_chatbot_support_welcome');
3622 delete_option('qlcd_wp_chatbot_support_email');
3623 delete_option('qlcd_wp_chatbot_asking_email');
3624 delete_option('qlcd_wp_chatbot_asking_msg');
3625 delete_option('qlcd_wp_chatbot_no_result');
3626 delete_option('qlcd_wp_chatbot_admin_email');
3627 delete_option('open_links_new_window');
3628 delete_option('qlcd_wp_chatbot_email_sub');
3629 delete_option('qlcd_wp_site_search');
3630 delete_option('qlcd_wp_chatbot_email_sent');
3631 delete_option('qlcd_wp_chatbot_support_phone');
3632 delete_option('qlcd_wp_chatbot_asking_phone');
3633 delete_option('qlcd_wp_chatbot_thank_for_phone');
3634 delete_option('qlcd_wp_chatbot_sys_key_help');
3635 delete_option('qlcd_wp_chatbot_sys_key_product');
3636 delete_option('qlcd_wp_chatbot_sys_key_catalog');
3637 delete_option('qlcd_wp_chatbot_sys_key_order');
3638 delete_option('qlcd_wp_chatbot_sys_key_support');
3639 delete_option('qlcd_wp_chatbot_sys_key_reset');
3640 delete_option('qlcd_wp_chatbot_sys_key_email');
3641 delete_option('qlcd_wp_chatbot_order_username_not_exist');
3642 delete_option('qlcd_wp_chatbot_order_username_thanks');
3643 delete_option('qlcd_wp_chatbot_order_password_incorrect');
3644 delete_option('qlcd_wp_chatbot_order_not_found');
3645 delete_option('qlcd_wp_chatbot_order_found');
3646 delete_option('qlcd_wp_chatbot_order_email_support');
3647 delete_option('qlcd_wp_chatbot_support_option_again');
3648 delete_option('qlcd_wp_chatbot_invalid_email');
3649 delete_option('qlcd_wp_chatbot_shopping_cart');
3650 delete_option('qlcd_wp_chatbot_add_to_cart');
3651 delete_option('qlcd_wp_chatbot_cart_link');
3652 delete_option('qlcd_wp_chatbot_checkout_link');
3653 delete_option('qlcd_wp_chatbot_cart_welcome');
3654 delete_option('qlcd_wp_chatbot_featured_product_welcome');
3655 delete_option('qlcd_wp_chatbot_viewed_product_welcome');
3656 delete_option('qlcd_wp_chatbot_latest_product_welcome');
3657 delete_option('qlcd_wp_chatbot_cart_title');
3658 delete_option('qlcd_wp_chatbot_cart_quantity');
3659 delete_option('qlcd_wp_chatbot_cart_price');
3660 delete_option('qlcd_wp_chatbot_no_cart_items');
3661 delete_option('qlcd_wp_chatbot_cart_updating');
3662 delete_option('qlcd_wp_chatbot_cart_removing');
3663 delete_option('qlcd_wp_chatbot_email_fail');
3664 delete_option('qlcd_wp_chatbot_relevant_post_link_openai');
3665 delete_option('support_query');
3666 delete_option('support_ans');
3667 delete_option('qlcd_wp_chatbot_notification_interval');
3668 delete_option('qlcd_wp_chatbot_notifications');
3669 delete_option( 'qlcd_wp_chatbot_search_option');
3670 delete_option( 'wp_chatbot_index_count');
3671 delete_option( 'wp_chatbot_app_pages');
3672 //messenger option
3673 delete_option( 'enable_wp_chatbot_messenger');
3674 delete_option( 'enable_wp_chatbot_messenger_floating_icon');
3675 delete_option( 'qlcd_wp_chatbot_fb_app_id');
3676 delete_option( 'qlcd_wp_chatbot_fb_page_id');
3677 delete_option( 'qlcd_wp_chatbot_fb_color');
3678 delete_option( 'qlcd_wp_chatbot_fb_in_msg');
3679 delete_option( 'qlcd_wp_chatbot_fb_out_msg');
3680 //skype option
3681 delete_option( 'enable_wp_chatbot_skype_floating_icon');
3682 delete_option( 'enable_wp_chatbot_skype_id');
3683 //whats app
3684 delete_option( 'enable_wp_chatbot_whats');
3685 delete_option( 'qlcd_wp_chatbot_whats_label');
3686 delete_option( 'enable_wp_chatbot_floating_whats');
3687 delete_option( 'qlcd_wp_chatbot_whats_num');
3688 // Viber
3689 delete_option( 'enable_wp_chatbot_floating_viber');
3690 delete_option( 'qlcd_wp_chatbot_viber_acc');
3691 //Integration others
3692 delete_option( 'enable_wp_chatbot_floating_phone');
3693 delete_option( 'qlcd_wp_chatbot_phone');
3694 delete_option( 'enable_wp_chatbot_floating_link');
3695 delete_option( 'qlcd_wp_chatbot_weblink');
3696 //Re Targetting
3697 delete_option( 'qlcd_wp_chatbot_ret_greet');
3698 delete_option( 'enable_wp_chatbot_exit_intent');
3699 delete_option( 'wp_chatbot_exit_intent_msg');
3700 delete_option( 'wp_chatbot_exit_intent_once');
3701
3702 delete_option( 'enable_wp_chatbot_scroll_open');
3703 delete_option( 'wp_chatbot_scroll_open_msg');
3704 delete_option( 'wp_chatbot_scroll_percent');
3705 delete_option( 'wp_chatbot_scroll_once');
3706
3707 delete_option( 'enable_wp_chatbot_auto_open');
3708 delete_option( 'enable_wp_chatbot_ret_sound');
3709 delete_option( 'enable_wp_chatbot_sound_initial');
3710 delete_option( 'disable_wp_chatbot_feedback');
3711 delete_option( 'disable_wp_chatbot_faq');
3712 delete_option( 'qlcd_wp_chatbot_feedback_label');
3713 delete_option( 'enable_wp_chatbot_meta_title');
3714 delete_option( 'qlcd_wp_chatbot_meta_label');
3715 delete_option( 'wp_chatbot_auto_open_msg');
3716 delete_option( 'wp_chatbot_auto_open_time');
3717 delete_option( 'wp_chatbot_auto_open_once');
3718 delete_option( 'wp_chatbot_inactive_once');
3719 delete_option( 'wp_chatbot_proactive_bg_color');
3720 delete_option( 'qlcd_wp_chatbot_phone_sent');
3721 delete_option( 'qlcd_wp_chatbot_phone_fail');
3722 delete_option('qlcd_wp_chatbot_asking_search_keyword');
3723 delete_option('qlcd_wp_chatbot_found_result');
3724 delete_option( 'disable_wp_chatbot_call_gen');
3725 delete_option( 'disable_wp_chatbot_site_search');
3726 delete_option( 'enable_wp_chatbot_post_content');
3727 delete_option( 'disable_wp_chatbot_call_sup');
3728
3729 delete_option( 'enable_wp_chatbot_ret_user_show');
3730 delete_option( 'enable_wp_chatbot_inactive_time_show');
3731 delete_option( 'wp_chatbot_inactive_time');
3732 delete_option( 'wp_chatbot_checkout_msg');
3733 delete_option( 'qlcd_wp_chatbot_shopper_demo_name');
3734 delete_option( 'qlcd_wp_chatbot_is_typing');
3735 delete_option( 'qlcd_wp_chatbot_send_a_msg');
3736 delete_option( 'qlcd_wp_chatbot_choose_option');
3737 delete_option( 'qlcd_wp_chatbot_viewed_products');
3738 delete_option( 'qlcd_wp_chatbot_help_welcome');
3739 delete_option( 'qlcd_wp_chatbot_help_msg');
3740 delete_option( 'qlcd_wp_chatbot_reset');
3741 delete_option( 'enable_wp_chatbot_opening_hour');
3742 delete_option( 'wpwbot_hours');
3743 delete_option( 'enable_wp_chatbot_dailogflow');
3744 delete_option( 'qlcd_wp_chatbot_dialogflow_client_token');
3745 delete_option( 'qlcd_wp_chatbot_dialogflow_defualt_reply');
3746 delete_option( 'qlcd_wp_chatbot_dialogflow_agent_language');
3747
3748 delete_option( 'qlcd_wp_chatbot_dialogflow_project_id');
3749 delete_option( 'wp_chatbot_df_api');
3750 delete_option( 'qlcd_wp_chatbot_dialogflow_project_key');
3751
3752 delete_option( 'wp_chatbot_bot_msg_bg_color');
3753 delete_option( 'wp_chatbot_bot_msg_text_color');
3754 delete_option( 'wp_chatbot_user_msg_bg_color');
3755 delete_option( 'wp_chatbot_user_msg_text_color');
3756 delete_option( 'wp_chatbot_buttons_bg_color');
3757 delete_option( 'wp_chatbot_buttons_text_color');
3758
3759 delete_option( 'wp_chatbot_buttons_bg_color_hover');
3760 delete_option( 'wp_chatbot_buttons_text_color_hover');
3761
3762 delete_option( 'wp_chatbot_theme_secondary_color');
3763 delete_option( 'wp_chatbot_theme_primary_color');
3764 delete_option( 'wp_chatbot_header_background_color');
3765 delete_option('wp_chatbot_font_size');
3766 delete_option('wp_chat_user_font_family');
3767 delete_option('wp_chat_bot_font_family');
3768 delete_option('wp_chatbot_bot_font');
3769 delete_option('wp_chatbot_user_font');
3770 delete_option('qcld_chatbot_avatar_location');
3771 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3772 qcld_wb_chatboot_defualt_options();
3773 $html='Reset all options to default successfully.';
3774 wp_send_json($html);
3775 }
3776 }
3777
3778 if( !function_exists('wpbot_free_set_content_height_defaults') ){
3779 function wpbot_free_set_content_height_defaults() {
3780 $chatbot_content_max_height = get_option( 'chatbot_content_max_height', false );
3781 if ( $chatbot_content_max_height === false || $chatbot_content_max_height === '' ) {
3782 update_option( 'chatbot_content_max_height', '80' );
3783 }
3784
3785 $chatbot_content_max_height_responsive = get_option( 'chatbot_content_max_height_responsive', false );
3786 if ( $chatbot_content_max_height_responsive === false || $chatbot_content_max_height_responsive === '' ) {
3787 update_option( 'chatbot_content_max_height_responsive', '90' );
3788 }
3789 }
3790 }
3791
3792 if( !function_exists('wpbot_free_qc_upgrade_completed') ){
3793 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
3794 // The path to our plugin's main file
3795 $our_plugin = plugin_basename( __FILE__ );
3796 // If an update has taken place and the updated type is plugins and the plugins element exists
3797 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
3798 // Iterate through the plugins being updated and check if ours is there
3799 foreach( $options['plugins'] as $plugin ) {
3800 if( $plugin == $our_plugin ) {
3801 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3802 wpbot_free_set_content_height_defaults();
3803 }
3804 }
3805 }
3806 update_option( 'qcld_openai_relevant_post', ['post','page'] );
3807 }
3808 }
3809 add_action( 'upgrader_process_complete', 'wpbot_free_qc_upgrade_completed', 10, 2 );
3810
3811
3812
3813 /**
3814 *
3815 * Open Ai integration
3816 *
3817 */
3818 if( !function_exists('wpbot_openAi_setting_func') ){
3819 function wpbot_openAi_setting_func (){
3820
3821 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/admin/templates/ai-admin.php");
3822 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3823
3824 }
3825 }
3826 if( !function_exists('wpbot_Ai_actions_func') ){
3827 function wpbot_Ai_actions_func (){
3828
3829 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/admin/templates/ai-actions.php");
3830 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3831
3832 }
3833 }
3834
3835 /**
3836 *
3837 * Function to load translation files.
3838 *
3839 */
3840
3841 if( !function_exists('wp_chatbot_lang_init') ){
3842 function wp_chatbot_lang_init() {
3843 load_plugin_textdomain( 'chatbot', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
3844 }
3845 }
3846 add_action( 'plugins_loaded', 'wp_chatbot_lang_init');
3847
3848 $wpbot_feedback = new Qcld_Wp_Usage_Feedback(
3849 __FILE__,
3850 'plugins@quantumcloud.com',
3851 false,
3852 true
3853
3854 );
3855 if( !function_exists('wpbot_help_page_callback_func') ){
3856 function wpbot_help_page_callback_func(){
3857 ?>
3858
3859
3860
3861 <div class="wrap qcld-main-wrapper">
3862 <div class="qcld-wp-chatbot-wrap-header">
3863
3864 <div class="qcld-wp-chatbot-wrap-header-logo"><a href="#" class="qcld-wp-chatbot-wrap-site__logo"><img src="<?php echo esc_url( QCLD_wpCHATBOT_IMG_URL . '/chatbot.png' ); ?>" alt="Dialogflow CX"> WPBot Control Panel </a>
3865 <p><strong>Core Version:</strong> v<?php echo esc_html( QCLD_wpCHATBOT_VERSION ); ?></p>
3866 </div>
3867 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3868 <li>
3869 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
3870
3871 </li>
3872 </ul>
3873 </div>
3874 <div class="qcld-wrap swpm-admin-menu-wrap">
3875 <div class="nav-tab-wrapper sld_nav_container wppt_nav_container qcld_help_wppt_nav_container">
3876 <a class="nav-tab sld_click_handle nav-tab-active" href="#general_int"><span class="wpwbot-admin-tab-icon "> <i class="fa fa-rocket"></i> </span><?php echo esc_html('Getting Started'); ?></a>
3877 <a class="nav-tab sld_click_handle " href="#general_wp_nutshell"><span class="wpwbot-admin-tab-icon "> <i class="fa fa-hourglass-start"></i> </span><?php echo esc_html('WPBot – In a Nutshell'); ?></a>
3878 <a class="nav-tab sld_click_handle" id="general_debuggings" href="#general_debugging"><span class="wpwbot-admin-tab-icon "> <i class="fa fa-question-circle-o"></i> </span><?php echo esc_html('Troubleshooting & FAQ'); ?></a>
3879 </div>
3880 <div class="content_qcbot_help_secion">
3881 <div class=" wppt-settings-section" id="general_wp_nutshell" style="display:none;">
3882 <div class="content form-container qcbot_help_secion" style="">
3883 <!-- new Section -->
3884 <h3 class="qcld-wpbot-main-tabs-title"><?php echo esc_html__('WPBot – In a Nutshell', 'chatbot'); ?></h3>
3885 <p><?php echo esc_html__('This is by no means a comprehensive list of WPBot features. But knowing these core terms will help you understand how WPBot was designed to work.', 'chatbot'); ?></p>
3886 <div class="panel panel-default">
3887 <div class="panel-heading" role="tab" id="IntentheadingOne">
3888 <h4 class="panel-title">
3889 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#IntentcollapseOne" aria-expanded="false" aria-controls="IntentcollapseOne"> <?php esc_html_e('Intents', 'chatbot'); ?> </a>
3890 </h4>
3891 </div>
3892 <div id="IntentcollapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="IntentheadingOne">
3893 <div class="panel-body">
3894 <?php echo esc_html_e(' Intent is all about what the user wants to get out of the interaction. Whenever a user types something or clicks a button, the ChatBot will try to understand what the user wants and fulfill the request with appropriate responses.', 'chatbot'); ?></br></br>
3895 <?php echo esc_html_e('You have to create possible Intent Responses using different features of the WPBot so the bot can respond accordingly. You can create Responses for various Intents using:', 'chatbot'); ?><b>
3896 <?php echo esc_html_e('Simple Text Responses, Conversational form builder, FAQ, Site Search, Send an eMail, Newsletter Subscription, DialogFlow, OpenAI etc.', 'chatbot'); ?></b></br></br>
3897 <?php echo esc_html_e('Please check this article for', 'chatbot'); ?> <span class="wppt_nav_container qcld-plan-tab-text">
3898 <a href="#general_int"><?php echo esc_html_e('more details', 'chatbot'); ?></a> </span> <?php echo esc_html_e('on how you can create Intents and Responses.', 'chatbot'); ?>
3899 </div>
3900 </div>
3901 </div>
3902 <div class="panel panel-default">
3903 <div class="panel-heading" role="tab" id="headingSix">
3904 <h4 class="panel-title">
3905 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseSix" aria-expanded="false" aria-controls="collapseSix"> <?php esc_html_e('Action Start Menu', 'chatbot'); ?> </a>
3906 </h4>
3907 </div>
3908 <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
3909 <div class="panel-body">
3910 <?php echo esc_html_e('While using a ChatBot, users can get lost or not know how to Interact with the Bot. That is why we have a Action Start Menu to always give the user', 'chatbot'); ?> <b><?php echo esc_html_e('options to do more', 'chatbot'); ?></b>. <?php echo esc_html_e('From ChatBot->Settings->Action Start Menu you can drag Available Menu Items (Intents) to the Active Menu Items area.', 'chatbot'); ?></br></br>
3911 <?php echo esc_html_e('Besides the built-in Intents, you can also create custom Intents for your Action Start Menu using', 'chatbot'); ?> <b><?php echo esc_html_e('Simple Text Responses', 'chatbot'); ?></b> and <b><?php echo esc_html_e('Conversational form builder', 'chatbot'); ?></b>. <?php echo esc_html_e('You can create almost any kind of response with the combinations of the two.', 'chatbot'); ?></br></br>
3912 <?php echo esc_html_e('We recommend enabling', 'chatbot'); ?><b><?php echo esc_html_e(' Show Action Start Menu After Greetings ', 'chatbot'); ?></b><?php echo esc_html_e('from ChatBot Pro->Settings->General settings.', 'chatbot'); ?>
3913 </div>
3914 </div>
3915 </div>
3916 <div class="panel panel-default">
3917 <div class="panel-heading" role="tab" id="headingSeven">
3918 <h4 class="panel-title">
3919 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseSeven" aria-expanded="false" aria-controls="collapseSeven"> <?php esc_html_e('Settings', 'chatbot'); ?> </a>
3920 </h4>
3921 </div>
3922 <div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
3923 <div class="panel-body">
3924 <?php echo esc_html_e('Head over to ChatBot Pro->Settings->General and make sure to Enable the Floating Icon. As soon as you do that, the ChatBot can start working for your users. Make sure to drag some items to the Active Menu area under the Action Start Menu.', 'chatbot'); ?></br></br>
3925 <?php echo esc_html_e('The ChatBot settings area is full of options. Do not be intimidated by that. You do not need to use all the options – just what you need. Head over to the Settings->', 'chatbot'); ?><b><?php echo esc_html_e('Icons and Themes', 'chatbot'); ?></b> <?php echo esc_html_e('for options to customize your ChatBot. You will also find options to embed the ChatBot on a page, click to chat, FAQ builder etc. under the Setting options.', 'chatbot'); ?>
3926 </div>
3927 </div>
3928 </div>
3929 <div class="panel panel-default">
3930 <div class="panel-heading" role="tab" id="headingEight">
3931 <h4 class="panel-title">
3932 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseEight" aria-expanded="false" aria-controls="collapseEight"> <?php esc_html_e('Language Center', 'chatbot'); ?> </a>
3933 </h4>
3934 </div>
3935 <div id="collapseEight" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingEight">
3936 <div class="panel-body">
3937 <?php echo esc_html_e('You can use the ChatBot in', 'chatbot'); ?> <b><?php echo esc_html_e('ANY language', 'chatbot'); ?></b>. <?php echo esc_html_e('Just translate the texts used by the ChatBot from the WordPress dashboard ChatBot Pro->', 'chatbot'); ?><b><?php echo esc_html_e('Language Center. Multi language', 'chatbot'); ?></b> <?php echo esc_html_e('module is available in the Master License..', 'chatbot'); ?>
3938 </div>
3939 </div>
3940 </div>
3941 <div class="panel panel-default">
3942 <div class="panel-heading" role="tab" id="headingtwo">
3943 <h4 class="panel-title">
3944 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapsetwo" aria-expanded="false" aria-controls="collapseOne"> <?php esc_html_e('Simple Text Responses', 'chatbot'); ?> </a>
3945 </h4>
3946 </div>
3947 <div id="collapsetwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingtwo">
3948 <div class="panel-body">
3949 <?php echo esc_html_e('You can use ChatBot Pro->Simple Text Responses to create', 'chatbot'); ?> <b><?php echo esc_html_e('text-based responses', 'chatbot'); ?></b> <?php echo esc_html_e('that users may ask your ChatBot. Just define the questions, answers, and some keywords and you are done. This is a much simpler', 'chatbot'); ?> <b><?php echo esc_html_e('alternative ', 'chatbot'); ?></b> <?php echo esc_html_e('to DialogFlow or OpenAI.', 'chatbot'); ?>
3950 </div>
3951 </div>
3952 </div>
3953 <div class="panel panel-default">
3954 <div class="panel-heading" role="tab" id="headingThree">
3955 <h4 class="panel-title">
3956 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> <?php esc_html_e('Conversational Forms', 'chatbot'); ?> </a>
3957 </h4>
3958 </div>
3959 <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
3960 <div class="panel-body">
3961 <?php echo esc_html_e('Use conversational forms to collect information from the users. This is also great for Button driven workflow. Create conditional conversations and forms for a native WordPress ChatBot experience. Build Standard Forms, Dynamic Forms with', 'chatbot'); ?> <b> <?php echo esc_html_e('conditional fields, Calculators, Appointment booking', 'chatbot'); ?></b> <?php echo esc_html_e('etc.', 'chatbot'); ?>
3962 </div>
3963 </div>
3964 </div>
3965 <div class="panel panel-default">
3966 <div class="panel-heading" role="tab" id="headingten">
3967 <h4 class="panel-title">
3968 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseten" aria-expanded="false" aria-controls="collapseten"> <?php esc_html_e('Retargeting (Pro feature)', 'chatbot'); ?> </a>
3969 </h4>
3970 </div>
3971 <div id="collapseten" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingten">
3972 <div class="panel-body">
3973 <?php echo esc_html_e('Retargeting is a powerful feature to grab your user’s attention with motivating information (a sale, coupon, ebook etc.). You can trigger a Retargeting message and the ChatBot window will automatically', 'chatbot'); ?> <b> <?php echo esc_html_e('automatically ', 'chatbot'); ?></b><?php echo esc_html_e('open up with your message. You can trigger Retargeting for ', 'chatbot'); ?><b> <?php echo esc_html_e('Exit Intent, Exit Intent, Scroll Intent, Auto After “X” Seconds, Checkout', 'chatbot'); ?></b> <?php echo esc_html_e('etc.', 'chatbot'); ?>
3974 </div>
3975 </div>
3976 </div>
3977 <div class="panel panel-default">
3978 <div class="panel-heading" role="tab" id="headingFour">
3979 <h4 class="panel-title">
3980 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour"> <?php esc_html_e('OpenAI or DialogFlow', 'chatbot'); ?> </a>
3981 </h4>
3982 </div>
3983 <div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
3984 <div class="panel-body">
3985 <?php echo esc_html_e('If you need a bot that can understand natural language better, use either OpenAI or DialogFlow. Between the two', 'chatbot'); ?> <b> <?php echo esc_html_e('DialogFlow', 'chatbot'); ?></b> <?php echo esc_html_e('is better if you want to', 'chatbot'); ?> <b> <?php echo esc_html_e('provide customer support', 'chatbot'); ?></b>. <?php echo esc_html_e('OpenAI is better at generic questions and training OpenAI also requires a large dataset. But you do not have to use either 3rd party service. Using OpenAI or DialogFlow requires some patience and', 'chatbot'); ?> <b> <?php echo esc_html_e('effort', 'chatbot'); ?></b>. <?php echo esc_html_e('You may very well achieve what you need using ', 'chatbot'); ?><b> <?php echo esc_html_e('Simple Text Responses', 'chatbot'); ?></b> <?php echo esc_html_e('and/or', 'chatbot'); ?> <b> <?php echo esc_html_e('Conversational form builder', 'chatbot'); ?></b> <?php echo esc_html_e('instead.', 'chatbot'); ?>
3986 </div>
3987 </div>
3988 </div>
3989 <div class="panel panel-default">
3990 <div class="panel-heading" role="tab" id="headingFive">
3991 <h4 class="panel-title">
3992 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseFive" aria-expanded="false" aria-controls="collapseFive"> <?php esc_html_e('Getting Help', 'chatbot'); ?> </a>
3993 </h4>
3994 </div>
3995 <div id="collapseFive" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFive">
3996 <div class="panel-body">
3997 <?php echo esc_html_e('We have built-in Help section under each module. Please check them out and you will get many answers to the questions you may have. If you cannot find the answer to something particular, just contact us.', 'chatbot'); ?> <b><?php echo esc_html_e('Pro version ', 'chatbot'); ?></b><?php echo esc_html_e('users can open a support ticket from here. We are ', 'chatbot'); ?><b><?php echo esc_html_e('friendly ', 'chatbot'); ?></b><?php echo esc_html_e('and always here to help.', 'chatbot'); ?>
3998 </div>
3999 </div>
4000 </div>
4001 </div>
4002 </div>
4003 <div class=" wppt-settings-section" id="general_int">
4004 <div class="content form-container qcbot_help_secion" style="">
4005 <!-- new Section -->
4006 <h3 class="qcld-wpbot-main-tabs-title"><?php echo esc_html__('WPBot Interactions', 'chatbot'); ?></h3>
4007 <p><?php echo esc_html__('You can use WPBot to both answer user questions and collect information from the users.', 'chatbot'); ?></p>
4008 <h4><?php echo esc_html__('To create answers to user questions you can use:', 'chatbot'); ?></h4>
4009 <p> <b> <?php echo esc_html__('Simple Text Responses (built-in), FAQ(built-in), Site search(built-in), Product search(built-in Pro feature), DialogFlow(3rd Party) or OpenAI(3rd Party)', 'chatbot'); ?></b></p>
4010 <h4> <?php echo esc_html__('To collect information from your users you can use:', 'chatbot'); ?></h4>
4011 <p><?php echo esc_html__('Conversational forms(built-in), Mail us(built-in), Call me back(built-in), Collect feedback(built-in) features', 'chatbot'); ?></p>
4012 <hr>
4013 <p>
4014 <b> <?php echo esc_html__('When you activate the plugin, by default only the Site search option will work. Site search displays links to your website pages that contain the keywords in the user query. ', 'chatbot'); ?>
4015 </b></p>
4016 <p><b><?php echo esc_html__('To generate direct text responses, you need to use either Simple Text Responses or AI services. ', 'chatbot'); ?>
4017 </b></p>
4018 <hr>
4019 <h4><?php echo esc_html__('You can create user interactions in the following ways:', 'chatbot'); ?></h4>
4020 <div class="panel panel-default">
4021 <div class="panel-heading" role="tab" id="headingOne">
4022 <h4 class="panel-title">
4023 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false" aria-controls="collapseOne"> <?php esc_html_e('Predefined intents - Built-in ChatBot Features', 'chatbot'); ?> </a>
4024 </h4>
4025 </div>
4026 <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
4027 <div class="panel-body">
4028 <?php esc_html_e('Predefined intents can work without integration to DialogFlow API and AI. These are readily available as soon as you install the plugin and can be turned on or off individually.', 'chatbot'); ?>
4029 <div class="section-container">
4030 <div class="wpb_column vc_column_container vc_col-sm-6">
4031 <div class="vc_column-inner ">
4032 <div class="wpb_wrapper">
4033 <div class="to-icon-box left txt-left">
4034 <div class="to-icon-txt fa-4x-txt ">
4035 <h3>
4036 <span>// </span><?php esc_html_e('Simple Text Responses', 'chatbot'); ?>
4037 </h3>
4038 <p><?php esc_html_e('Create unlimited text responses from your WordPress backend. The ChatBot uses advanced search algorithm for natural language phrase matching with user input.', 'chatbot'); ?> </p>
4039 </div>
4040 </div>
4041 <div class="to-icon-box left txt-left">
4042 <div class="to-icon-txt fa-4x-txt ">
4043 <h3>
4044 <span>// </span><?php esc_html_e('Send eMail, Call Me Back &amp; Feedback Collection', 'chatbot'); ?>
4045 </h3>
4046 <p><?php esc_html_e('Users can send a email to the site admin directly from the Chat window for customer support. The Call Me Back feature lets you get call requests from your customers which will be emailed to you. You can also use WPBot to collect Feedback from your customers regarding anything! You can disable/enable these features from the Action Start Menu.', 'chatbot'); ?></p>
4047 </div>
4048 </div>
4049 <div class="to-icon-box left txt-left">
4050 <div class="to-icon-txt fa-4x-txt ">
4051 <h3>
4052 <span>// </span><?php esc_html_e('Advanced Site Search', 'chatbot'); ?> <span class="qc_wpbot_pro">PRO</span>
4053 </h3>
4054 <p><?php esc_html_e('If no matching text response is found WPBot will conduct an advanced website search and try to match user queries with your website contents and show results.', 'chatbot'); ?> </p>
4055 </div>
4056 </div>
4057 </div>
4058 </div>
4059 </div>
4060 <div class="wpb_column vc_column_container vc_col-sm-6">
4061 <div class="vc_column-inner ">
4062 <div class="wpb_wrapper">
4063 <div class="to-icon-box left txt-left">
4064 <div class="to-icon-txt fa-4x-txt ">
4065 <h3>
4066 <span>// </span><?php esc_html_e('Frequently Asked Questions', 'chatbot'); ?>
4067 </h3>
4068 <p><?php esc_html_e('Create a set of Frequently Asked Questions or FAQ so users can quickly find answers to the most common questions they have.', 'chatbot'); ?></p>
4069 </div>
4070 </div>
4071 <div class="to-icon-box left txt-left">
4072 <div class="to-icon-txt fa-4x-txt ">
4073 <h3>
4074 <span>// </span>Ask for name, email, phone number etc.
4075 </h3>
4076 <p><?php esc_html_e('Asking for the name is the default workflow. In the pro version, you can also ask for an email and phone number if you want to or skip the Greetings part altogether and load any intent of your choice.', 'chatbot'); ?></p>
4077 </div>
4078 </div>
4079 <div class="to-icon-box left txt-left">
4080 <div class="to-icon-txt fa-4x-txt ">
4081 <h3>
4082 <span>// </span><?php esc_html_e('Newsletter Subscription', 'chatbot'); ?> <span class="qc_wpbot_pro">PRO</span>
4083 </h3>
4084 <p><?php esc_html_e('WPBot can prompt User for eMail subscription. Link this with your Retargeting ChatBot window popup and a special offer. People can register their email address that you can later export as CSV!', 'chatbot'); ?> <strong>GDPR compliant</strong> with unsubscribe option from the ChatBot! </p>
4085 </div>
4086 </div>
4087 </div>
4088 </div>
4089 </div>
4090 </div>
4091 </div>
4092 </div>
4093 </div>
4094 <div class="panel panel-default">
4095 <div class="panel-heading" role="tab" id="headingTwo">
4096 <h4 class="panel-title">
4097 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"><?php esc_html_e(' Menu Driven - Created with Conversational Form Builder Addon', 'chatbot'); ?> </a>
4098 </h4>
4099 </div>
4100 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
4101 <div class="panel-body">
4102 <p><?php esc_html_e('Extend the Action Start Menu with the', 'chatbot'); ?> <strong><?php esc_html_e('powerful Conversational Forms', 'chatbot'); ?></strong>&nbsp;<?php esc_html_e(' Addon for WPBot. It extends WPBot’s functionality and adds the ability to create', 'chatbot'); ?> <strong><?php esc_html_e('conditional conversations', 'chatbot'); ?></strong> <?php esc_html_e('and/or', 'chatbot'); ?> <strong><?php esc_html_e('forms', 'chatbot'); ?></strong> <?php esc_html_e('for the WPBot. It is a visual,', 'chatbot'); ?> <strong><?php esc_html_e('drag and drop', 'chatbot'); ?></strong><?php esc_html_e(' form builder that is easy to use and very flexible. Supports conditional logic and use of variables to build all types of forms or just', 'chatbot'); ?> <strong><?php esc_html_e('menu driven', 'chatbot'); ?></strong>
4103 <strong><?php esc_html_e('conversations', 'chatbot'); ?> </strong><?php esc_html_e('with if else logic', 'chatbot'); ?> <strong>. </strong><?php esc_html_e('Conversations or forms can be', 'chatbot'); ?> <strong><?php esc_html_e('eMailed', 'chatbot'); ?></strong> <?php esc_html_e('to you and', 'chatbot'); ?> <strong><?php esc_html_e('saved in the database', 'chatbot'); ?></strong>.
4104 </p>
4105 <h4><?php esc_html_e('Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.', 'chatbot'); ?></h4>
4106 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank"><?php esc_html_e('Download Free Version', 'chatbot'); ?></a>
4107 <a class="FormBuilder" href="https://www.quantumcloud.com/products/conversations-and-form-builder/" target="_blank"><?php esc_html_e('Grab the Pro version', 'chatbot'); ?></a>
4108 <h4><?php esc_html_e('What Can You Do with it?', 'chatbot'); ?></h4>
4109 <p><?php esc_html_e('Conversation Forms allows you to create a wide variety of forms, that might include:', 'chatbot'); ?></p>
4110 <ul>
4111 <li><?php esc_html_e('Create menu or button driven conversations', 'chatbot'); ?></li>
4112 <li><?php esc_html_e('Conditional <strong>Menu Driven Conversations', 'chatbot'); ?></strong>
4113 <span class="qc_wpbot_pro" style="font-size: 9px;"><?php esc_html_e('PRO', 'chatbot'); ?></span>
4114 </li>
4115 <li><?php esc_html_e('Standard Contact Forms', 'chatbot'); ?></li>
4116 <li><?php esc_html_e('Dynamic,', 'chatbot'); ?> <strong><?php esc_html_e('conditional Forms', 'chatbot'); ?></strong> <?php esc_html_e('– where fields can change based on the user selections', 'chatbot'); ?> <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
4117 </li>
4118 <li>Job <strong><?php esc_html_e('Application Forms', 'chatbot'); ?></strong>
4119 </li>
4120 <li>
4121 <strong><?php esc_html_e('Lead Capture', 'chatbot'); ?></strong> <?php esc_html_e('Forms', 'chatbot'); ?>
4122 </li>
4123 <li><?php esc_html_e('Various types of', 'chatbot'); ?> <strong><?php esc_html_e('Calculators', 'chatbot'); ?></strong>
4124 <span class="qc_wpbot_pro" style="font-size: 9px;"><?php esc_html_e('PRO', 'chatbot'); ?></span>
4125 </li>
4126 <li><?php esc_html_e('Feedback', 'chatbot'); ?> <strong>Survey</strong><?php esc_html_e(' Forms etc.', 'chatbot'); ?> </li>
4127 </ul>
4128 </div>
4129 </div>
4130 </div>
4131 <div class="panel panel-default">
4132 <div class="panel-heading" role="tab" id="AIheadingThree">
4133 <h4 class="panel-title">
4134 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#AIcollapseThree" aria-expanded="false" aria-controls="AIcollapseThree"> <?php esc_html_e('DialogFlow ES and CX, OpenAI', 'chatbot'); ?> </a>
4135 </h4>
4136 </div>
4137 <div id="AIcollapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="AIheadingThree">
4138 <div class="panel-body">
4139 <div class="section-container">
4140 <div class="wpb_column vc_column_container vc_col-sm-6">
4141 <div class="wpb_wrapper">
4142 <h3><?php esc_html_e('DialogFlow Essential', 'chatbot'); ?></h3>
4143 <?php esc_html_e('Intents created in Dialogflow give you the power to build a truly human like, intelligent and comprehensive chatbot. Build any type of Intents and Responses (including rich message responses) directly in DialogFlow and train the bot accordingly. When you create custom intents and responses in DialogFlow, WPBot will automatically display them when user inputs match with your Custom Intents along with the responses you created. You can also build Rich responses by enabling Facebook messenger Response option.', 'chatbot'); ?>
4144 <p><?php esc_html_e('In addition you can also Enable ', 'chatbot'); ?> <?php esc_html_e('Advanced Chained Question and Answers using follow up Intents, Contexts, Entities etc. and then have resulting answers from your users emailed to you. This feature lets you create a a series of questions in DialogFlow that will be asked by the bot and based on the user inputs a response will be displayed.', 'chatbot'); ?> <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
4145 </p>
4146 <p><?php esc_html_e('WPBot also supports Rich responses using Facebook Messenger integration. This allows you to display Image,', 'chatbot'); ?> Cards<?php esc_html_e(', Quick Text Reply or Custom PayLoad inside the ChatBot window. You can also insert an ', 'chatbot'); ?><?php esc_html_e('image', 'chatbot'); ?><?php esc_html_e(' or', 'chatbot'); ?> <?php esc_html_e('youtube video', 'chatbot'); ?><?php esc_html_e(' link inside the DialogFlow responses and they will be automatically rendered by the WPBot!', 'chatbot'); ?> <span class="qc_wpbot_pro" style="font-size: 9px;"><?php esc_html_e('PRO', 'chatbot'); ?></span>
4147 </p>
4148 <h3><?php esc_html_e('OpenAI', 'chatbot'); ?></h3>
4149 <?php esc_html_e('Connect the ChatBot to OpenAI. OpenAI’s API provides access to GPT-3, for a wide variety of natural language tasks. Train your ChatBot with (pre-trained) GPT-3 to answer any user questions using. Select your preferred Engine from DaVinci, Ada, Curie or Babbag! Add your own API key to the addon to connect to your OpenAI account. To go live, you need to apply to OpenAI.', 'chatbot'); ?>
4150 </div>
4151 </div>
4152 <div class="wpb_column vc_column_container vc_col-sm-6">
4153 <div class="wpb_wrapper">
4154 <h3><?php esc_html_e('DialogFlow CX', 'chatbot'); ?> <span class="qc_wpbot_pro">PRO</span>
4155 </h3>
4156 <p><?php esc_html_e('WPBot supports', 'chatbot'); ?> <?php esc_html_e('visual workflow builder', 'chatbot'); ?><?php esc_html_e(' Dialogflow CX. It provides a new way of designing agents, taking a state machine approach to agent design. This gives you clear and explicit control over a conversation, a better end-user experience, and a better development', 'chatbot'); ?> <?php esc_html_e('workflow', 'chatbot'); ?>. </p>
4157 <ul>
4158 <li>
4159 <?php esc_html_e('Console visualization', 'chatbot'); ?><?php esc_html_e(': A new', 'chatbot'); ?> <?php esc_html_e('visual builder', 'chatbot'); ?> <?php esc_html_e('makes building and maintaining agents easier. Conversation paths are graphed as a state machine model, which makes conversations easier to design, enhance, and maintain.', 'chatbot'); ?>
4160 </li>
4161 <li>
4162 <?php esc_html_e('Intuitive and powerful conversation control', 'chatbot'); ?>: <?php esc_html_e('Conversation states and state transitions are first-class types that provide explicit and powerful control over conversation paths. You can clearly define a series of steps that you want the end-user to go through.', 'chatbot'); ?>
4163 </li>
4164 <li>
4165 <?php esc_html_e('Flows for agent partitions', 'chatbot'); ?>: <?php esc_html_e('With flows, you can partition your agent into smaller conversation topics. Different team members can own different flows, which makes large and complex agents easy to build.', 'chatbot'); ?>
4166 </li>
4167 <img style="width:100%" src="<?php echo esc_url( QCLD_wpCHATBOT_IMG_URL . '/dialogflow-cx-1024x676.jpg' );?>" alt="Dialogflow CX">
4168 </ul>
4169 </div>
4170 </div>
4171 </div>
4172 </div>
4173 </div>
4174 </div>
4175 </div>
4176 </div>
4177 <div class=" wppt-settings-section" id="general_debugging" style="display:none;">
4178 <div class="content form-container qcbot_help_secion" >
4179 <div class="" >
4180 <h3 class="qcld-wpbot-main-tabs-title"><?php esc_html_e('Tips', 'chatbot'); ?></h3>
4181 <h3><?php esc_html_e('Tutorial', 'chatbot'); ?></h3>
4182 <p><?php esc_html_e('You will find some helpful video tutorials and the ChatBot workflow on this', 'chatbot'); ?> <a href="https://www.wpbot.pro/chatbot-workflow/" target="_blank">page</a>.</p>
4183 <h3><?php esc_html_e('Simple Text Responses', 'chatbot'); ?></h3>
4184 <p><?php esc_html_e('Create simple text responses easily for your chatbot. The ChatBot will use advanced search algorithm for natural language phrase matching with user input. You can also adjust the Phrase matching accuracy for better user experience.', 'chatbot'); ?></p>
4185 <h3><?php esc_html_e('Setting Updates', 'chatbot'); ?></h3>
4186 <p><?php esc_html_e('After making changes in the language center or settings, please type reset and hit enter in the ChatBot to start testing from the beginning or open a new Incognito window (Ctrl+Shit+N in chrome).', 'chatbot'); ?></p>
4187 <h3><?php esc_html_e('Note', 'chatbot'); ?></h3>
4188 <p><?php esc_html_e('You could use &lt;br&gt; tag in Language Center & Dialogflow Responses for line break.', 'chatbot'); ?></p>
4189 </div>
4190 </div>
4191
4192
4193
4194
4195
4196
4197
4198 <div class="panel panel-default">
4199 <div class="panel-heading" role="tab" id="faqone">
4200 <h4 class="panel-title">
4201 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapseOne" aria-expanded="false" aria-controls="faqcollapseOne"> <?php esc_html_e('Problem: I changed language and/or some settings but do not see the changes.', 'chatbot'); ?> </a>
4202 </h4>
4203 </div>
4204 <div id="faqcollapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqone">
4205 <div class="panel-body">
4206 <?php echo esc_html_e('WPBot saves a lot of information in the browser`s local storage. After making any language or settings change you must clear browser cache and cookies both and reload the page for testing. An easier alternative is to always launch a new browser window in Incognito mode (Ctrl+Shift+N in chrome) and test there. Also, you need to purge cache plugin and CDN caching if you have any.', 'chatbot'); ?>
4207 </div>
4208 </div>
4209 </div>
4210
4211
4212
4213
4214 <div class="panel panel-default">
4215 <div class="panel-heading" role="tab" id="faqtwo">
4216 <h4 class="panel-title">
4217 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapsetwo" aria-expanded="false" aria-controls="faqcollapsetwo"> <?php esc_html_e('Problem: I cannot connect to the DialogFlow', 'chatbot'); ?> </a>
4218 </h4>
4219 </div>
4220 <div id="faqcollapsetwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwo">
4221 <div class="panel-body">
4222 <?php echo esc_html_e('To Debug: ', 'chatbot'); ?><br>
4223 <?php echo esc_html_e(' 1. Make sure that you have created the Google Project and the Service account as an Owner', 'chatbot'); ?><br>
4224 <?php echo esc_html_e('2. Make sure that you have connected to the correct Dialogflow agent', 'chatbot'); ?><br>
4225 <?php echo esc_html_e('3. Follow the steps in this tutorial correctly: https://www.wpbot.pro/dialogflow-integration', 'chatbot'); ?><br>
4226 <?php echo esc_html_e('4. Make sure that the Google Client Package is Installed on Your Website. 5. For DialogFlow agent region, try choosing any region other than the EU region which has known issues. 6. Make sure to download and import the sample DialogFlow agent to your agent 7. Test the ChatBot in the browser Incognito mode', 'chatbot'); ?>
4227 </div>
4228 </div>
4229 </div>
4230
4231
4232 <div class="panel panel-default">
4233 <div class="panel-heading" role="tab" id="faqthree">
4234 <h4 class="panel-title">
4235 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapsethree" aria-expanded="false" aria-controls="faqcollapsethree"> <?php esc_html_e('Problem: I am not getting emails from the ChatBot
4236 ', 'chatbot'); ?> </a>
4237 </h4>
4238 </div>
4239 <div id="faqcollapsethree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqthree">
4240 <div class="panel-body">
4241 <?php echo esc_html_e('The WPBot ChatBot uses the WordPress` default email function. If you are not getting emails from the ChatBot`s email feature, it is likely that no emails are getting through from your WordPress site or they are ending up in the Spam box. Try using an SMTP mailer plugin. Also, try changing the to and from email addresses in the ChatBot`s general settings area.', 'chatbot'); ?>
4242 </div>
4243 </div>
4244 </div>
4245
4246 <div class="panel panel-default">
4247 <div class="panel-heading" role="tab" id="faqfour">
4248 <h4 class="panel-title">
4249 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapsefour" aria-expanded="false" aria-controls="faqcollapsefour"> <?php esc_html_e('Problem: Simple text responses are not working or getting an error
4250 ', 'chatbot'); ?> </a>
4251 </h4>
4252 </div>
4253 <div id="faqcollapsefour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqfour">
4254 <div class="panel-body">
4255 <?php echo esc_html_e('WPBot requires mysql version 5.6+ for the simple text responses to work. If your server has a version below that, you might see some PHP error or the Simple Text Responses will not work at all. Please request your hosting support to update the mysql version on your server.', 'chatbot'); ?>
4256 </div>
4257 </div>
4258 </div>
4259
4260
4261 <div class="panel panel-default">
4262 <div class="panel-heading" role="tab" id="faqfive">
4263 <h4 class="panel-title">
4264 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapsefive" aria-expanded="false" aria-controls="faqcollapsefive"> <?php esc_html_e('Problem: I changed language or some other settings but do not see them when testing', 'chatbot'); ?> </a>
4265 </h4>
4266 </div>
4267 <div id="faqcollapsefive" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqfive">
4268 <div class="panel-body">
4269 <?php echo esc_html_e('Please clear the browser cache and <strong>cookies</strong> to see any change you have made. Alternatively, you can open a fresh browser window in incognito mode (Ctrl+Shift+N in chrome) to test your changes. Also, you may need to purge any cache plugin and CDN caching.', 'chatbot'); ?>
4270 </div>
4271 </div>
4272 </div>
4273
4274
4275
4276 <div class="panel panel-default">
4277 <div class="panel-heading" role="tab" id="faqsix">
4278 <h4 class="panel-title">
4279 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapsesix" aria-expanded="false" aria-controls="faqcollapsesix"> <?php esc_html_e('Problem: The ChatBot is NOT working in the front end.', 'chatbot'); ?> </a>
4280 </h4>
4281 </div>
4282 <div id="faqcollapsesix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqsix">
4283 <div class="panel-body">
4284 <?php echo esc_html_e('The most common reason for this is if the theme is coded incorrectly and jQuery is loaded from external source. jQuery is included with WordPress core and according to WordPress standard, jQuery must be included using wp_enqueue_script. https://developer.wordpress.org/reference/functions/wp_enqueue_script/ .', 'chatbot'); ?><br> <?php echo esc_html_e('Please make sure if that is the case in your theme.', 'chatbot'); ?><br>
4285 <?php echo esc_html_e('Also go to Simple Text Responses and press the Re-Index button.', 'chatbot'); ?><br>
4286 <?php echo esc_html_e(' After that try purging any cache and test the chatbot in Incognito mode', 'chatbot'); ?><br>
4287 <?php echo esc_html_e('Please contact us if you need [further help] https://www.wpbot.pro/free-support/). We take all user feedback sriously.', 'chatbot'); ?>
4288 </div>
4289 </div>
4290 </div>
4291
4292
4293 <div class="panel panel-default">
4294 <div class="panel-heading" role="tab" id="faqseven">
4295 <h4 class="panel-title">
4296 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapseseven" aria-expanded="false" aria-controls="faqcollapseseven"> <?php esc_html_e('Problem: The ChatBot is stuck on typing or loading', 'chatbot'); ?> </a>
4297 </h4>
4298 </div>
4299 <div id="faqcollapseseven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqseven">
4300 <div class="panel-body">
4301 <?php echo esc_html_e('This usually happens if you enabled DialogFlow but did not complete the set up. Please make sure that you have carefully followed all the steps for DialogFlow integration in the Settings->DialogFlow section.', 'chatbot'); ?><br>
4302 <?php echo esc_html_e('This can also happen if there is any empty language fields or Simple Text Responses database needs updating because of mysql version changes. Try saving both the Language Center and Simple Text Responses and test again.', 'chatbot'); ?><br>
4303 <?php echo esc_html_e('Also go to Simple Text Responses and press the Re-Index button.', 'chatbot'); ?><br>
4304 <?php echo esc_html_e('After that remember to test in a browser Incognito mode to avoid cache and cookies.', 'chatbot'); ?>
4305 </div>
4306 </div>
4307 </div>
4308
4309 <div class="panel panel-default">
4310 <div class="panel-heading" role="tab" id="faqeight">
4311 <h4 class="panel-title">
4312 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapseeight" aria-expanded="false" aria-controls="faqcollapseeight"> <?php esc_html_e('Problem: How do I add new conversations to the ChatBot?', 'chatbot'); ?> </a>
4313 </h4>
4314 </div>
4315 <div id="faqcollapseeight" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqeight">
4316 <div class="panel-body">
4317 <?php echo esc_html_e('Please check the plugin`s Help Section for details on this', 'chatbot'); ?>
4318 </div>
4319 </div>
4320 </div>
4321
4322 <div class="panel panel-default">
4323 <div class="panel-heading" role="tab" id="faqnine">
4324 <h4 class="panel-title">
4325 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapsenine" aria-expanded="false" aria-controls="faqcollapsenine"> <?php esc_html_e('Problem: How do I add Line Breaks?', 'chatbot'); ?> </a>
4326 </h4>
4327 </div>
4328 <div id="faqcollapsenine" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqnine">
4329 <div class="panel-body">
4330 <?php echo esc_html_e('Please use the <br> tag for line breaks.', 'chatbot'); ?>
4331 </div>
4332 </div>
4333 </div>
4334
4335 <div class="panel panel-default">
4336 <div class="panel-heading" role="tab" id="faqten">
4337 <h4 class="panel-title">
4338 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapseten" aria-expanded="false" aria-controls="faqcollapseten"> <?php esc_html_e('Problem: Are HTML tags supported?', 'chatbot'); ?> </a>
4339 </h4>
4340 </div>
4341 <div id="faqcollapseten" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqten">
4342 <div class="panel-body">
4343 <?php echo esc_html_e('Yes, common HTML tags link link href, strong, br etc. are supported.', 'chatbot'); ?>
4344 </div>
4345 </div>
4346 </div>
4347
4348 <div class="panel panel-default">
4349 <div class="panel-heading" role="tab" id="faqeleven">
4350 <h4 class="panel-title">
4351 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapseeleven" aria-expanded="false" aria-controls="faqcollapseeleven"> <?php esc_html_e('Problem: I want to add images, GIFs, Videos', 'chatbot'); ?> </a>
4352 </h4>
4353 </div>
4354 <div id="faqcollapseeleven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqeleven">
4355 <div class="panel-body">
4356 <?php echo esc_html_e('Images, GIFs and Youtube Videos are supprted in the pro version. Pro version also includes a handy giphy floating search feature for easy embed in the language center.', 'chatbot'); ?>
4357 </div>
4358 </div>
4359 </div>
4360
4361
4362 <div class="panel panel-default">
4363 <div class="panel-heading" role="tab" id="faqtwelve">
4364 <h4 class="panel-title">
4365 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#faqcollapsetwelve" aria-expanded="false" aria-controls="faqcollapsetwelve"> <?php esc_html_e('How to disable Predefined Intent?', 'chatbot'); ?> </a>
4366 </h4>
4367 </div>
4368 <div id="faqcollapsetwelve" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwelve">
4369 <div class="panel-body">
4370 <?php echo esc_html_e('You can disable predefined intents FAQ, eMail, Call me from WPBot Lite > Settings page`s Action Start Menu Section.', 'chatbot'); ?>
4371 </div>
4372 </div>
4373 </div>
4374
4375
4376
4377 </div>
4378 </div>
4379 </div>
4380 </div>
4381 <script type="text/javascript">
4382 jQuery(document).ready(function($){
4383 var url=document.URL;
4384 var arr=url.split('#');
4385 var tab_tar = '.'+arr[1];
4386 setTimeout(function(){
4387 jQuery(tab_tar).trigger('click');
4388 }, 500);
4389 jQuery('.wppt_nav_container .nav-tab').on('click', function(e){
4390 e.preventDefault();
4391 var section_id = jQuery(this).attr('href');
4392 jQuery('.wppt_nav_container .nav-tab').removeClass('nav-tab-active');
4393 jQuery(this).addClass('nav-tab-active');
4394 jQuery('.wppt-settings-section').hide();
4395 jQuery('.wppt-settings-section').each(function(){
4396 jQuery(section_id).show();
4397 });
4398 });
4399 })
4400 </script>
4401 <?php
4402 }
4403 }
4404
4405 add_action('init', 'qc_wp_latest_update_check');
4406 if( !function_exists('qc_wp_latest_update_check') ){
4407 function qc_wp_latest_update_check(){
4408 global $wpdb;
4409 if (current_user_can( 'manage_options' )) {
4410 if (isset($_POST['str_nonce'])) {
4411 $sanitized_nonce = sanitize_text_field(wp_unslash($_POST['str_nonce']));
4412 if (wp_verify_nonce($sanitized_nonce, 'str-nonce')) {
4413
4414 if(!get_option('qc_wp_ludate_ck')){
4415 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
4416 update_option('qlcd_wp_chatbot_support_email', 'Send us Email');
4417 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
4418 update_option('qlcd_wp_chatbot_wildcard_site_search', 'Site Search');
4419 update_option('qc_wp_ludate_ck', 'done');
4420 }
4421
4422 if( ! get_option( 'wpbot-admin-notice-oninstallation' ) ){
4423 update_option('wpbot-admin-notice-oninstallation', 'show');
4424 }
4425
4426 if(!get_option('qc_wpb_simple_response_db_upgrade_free2')){
4427
4428 $collate = '';
4429 if ( $wpdb->has_cap( 'collation' ) ) {
4430
4431 if ( ! empty( $wpdb->charset ) ) {
4432
4433 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
4434 }
4435 if ( ! empty( $wpdb->collate ) ) {
4436
4437 $collate .= " COLLATE $wpdb->collate";
4438
4439 }
4440 }
4441 //Bot Response Table
4442 $table1 = $wpdb->prefix.'wpbot_response';
4443 $sql_sliders_Table1 = "
4444 CREATE TABLE IF NOT EXISTS `$table1` (
4445 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
4446 `query` TEXT NOT NULL,
4447 `keyword` TEXT NOT NULL,
4448 `response` TEXT NOT NULL,
4449 `category` varchar(256) NOT NULL,
4450 `intent` varchar(256) NOT NULL,
4451 `custom` varchar(256) NOT NULL,
4452 `lang` varchar(25) NULL,
4453 FULLTEXT(`query`, `keyword`, `response`)
4454 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
4455
4456 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
4457 dbDelta( $sql_sliders_Table1 );
4458
4459 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4460 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4461 }
4462
4463 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4464 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4465 }
4466
4467 $sqlqry = $wpdb->get_results( $wpdb->prepare( "select * from {$table1} where id = %d", 1 ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
4468 if(empty($sqlqry)){
4469
4470 $query = 'Sample Question?';
4471 $response = 'Sample Answer';
4472
4473 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4474 $format = array('%s','%s', '%s', '%s');
4475 $wpdb->insert($table1,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter
4476 }
4477
4478 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4479
4480 }
4481
4482 if(!get_option('qc_wp_db_engine_update_free')){
4483
4484 $table1 = $wpdb->prefix.'wpbot_response';
4485
4486 // phpcs:ignore
4487 $wpdb->query("ALTER TABLE $table1 ENGINE = InnoDB");
4488
4489 update_option('qc_wp_db_engine_update_free', 'done');
4490 }
4491 if(!get_option('qc_wp_db_engine_update_free_unassign')){
4492
4493 $table1 = $wpdb->prefix.'wpbot_response';
4494
4495 // phpcs:ignore
4496 $wpdb->query("ALTER TABLE $table1 CHANGE `id` `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;");
4497
4498 update_option('qc_wp_db_engine_update_free_unassign', 'done');
4499 }
4500
4501 if(isset($_POST['qc_bot_str_query']) && $_POST['qc_bot_str_query']!='' && !class_exists('Qcld_str_pro')){
4502
4503
4504 if ( ! isset( $_POST['str_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['str_nonce'] ) ), 'str-nonce' ) ) {
4505 die( esc_html__( 'Security check failed', 'chatbot' ) );
4506 }
4507 $query = sanitize_text_field(wp_unslash($_POST['qc_bot_str_query']));
4508 $keyword = sanitize_text_field(wp_unslash($_POST['qc_bot_str_keyword']));
4509 $intent = sanitize_text_field(wp_unslash($_POST['qc_bot_str_intent']));
4510
4511 $category = '';
4512
4513 $response = wp_kses(wp_unslash($_POST['qc_bot_str_response']), 'post');
4514
4515 $table = $wpdb->prefix.'wpbot_response';
4516 $data = array('query' => $query, 'keyword' => $keyword, 'response'=> $response, 'intent'=> $intent, 'category'=> $category);
4517 $format = array('%s','%s', '%s', '%s', '%s');
4518
4519 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4520 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4521 $where = array('id'=>$id);
4522 $whereformat = array('%d');
4523 $wpdb->update( $table, $data, $where, $format, $whereformat ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4524 }else{
4525 $wpdb->insert($table,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
4526 }
4527
4528 qcld_mysql_remove_existing_indexes();
4529
4530 // phpcs:ignore
4531 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4532
4533 wp_safe_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4534
4535 }
4536 $table = $wpdb->prefix.'wpbot_response';
4537
4538 if(isset($_POST['qc-re-index'])){
4539
4540 qcld_mysql_remove_existing_indexes();
4541
4542 // phpcs:ignore
4543 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`)");
4544
4545 add_action('admin_notices', 'general_admin_notice_str' );
4546
4547 }
4548 if(isset($_POST['qc_bot_str_weight']) && wp_unslash($_POST['qc_bot_str_weight'])!=''){
4549 $weight = sanitize_text_field(wp_unslash($_POST['qc_bot_str_weight']));
4550 update_option('qc_bot_str_weight', $weight);
4551 }
4552 if(isset($_POST['qc_bot_str_remove_stopwords']) && wp_unslash($_POST['qc_bot_str_remove_stopwords'])!=''){
4553
4554 $stopwords = sanitize_text_field(wp_unslash($_POST['qc_bot_str_remove_stopwords']));
4555 update_option('qc_bot_str_remove_stopwords', '1');
4556 }
4557 if ( isset($_POST['qc_bot_str_allow_author_editor']) && wp_unslash($_POST['qc_bot_str_allow_author_editor']) != '' ) {
4558 $qc_bot_str_allow_author_editor = sanitize_text_field(wp_unslash($_POST['qc_bot_str_allow_author_editor']));
4559 update_option( 'qc_bot_str_allow_author_editor', $qc_bot_str_allow_author_editor );
4560 } else {
4561 delete_option( 'qc_bot_str_allow_author_editor' );
4562 }
4563 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4564 $table = $wpdb->prefix.'wpbot_response';
4565 $fields = rest_sanitize_array(wp_unslash($_POST['qc_bot_str_fields']));
4566
4567 $allowed_fields = array('query', 'keyword', 'response');
4568 $valid_fields = array();
4569 if(is_array($fields)){
4570 foreach($fields as $field){
4571 if(in_array($field, $allowed_fields)){
4572 $valid_fields[] = $field;
4573 }
4574 }
4575 }
4576 $fields = $valid_fields;
4577
4578 update_option('qc_bot_str_fields', $fields);
4579 qcld_mysql_remove_existing_indexes();
4580
4581 if($fields && !empty($fields)){
4582 $safe_fields = array_map(function($f) { return '`' . $f . '`'; }, $fields);
4583 // phpcs:ignore
4584 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $safe_fields).")");
4585
4586 }
4587 }
4588
4589 if(!get_option('wpbot_preloading_time')) {
4590 update_option('wpbot_preloading_time', '800');
4591 }
4592 }
4593 }
4594 }
4595 }
4596 if( !function_exists('general_admin_notice_str') ){
4597 function general_admin_notice_str(){
4598 if ( isset($_GET['page']) && $_GET['page'] == 'simple-text-response' ) {
4599 echo '<div class="notice notice-success is-dismissible">
4600 <p>Re-Indexing has been completed!</p>
4601 </div>';
4602 }
4603 }
4604 }
4605 }
4606 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4607 function qcld_wpbot_simple_response_intent(){
4608 global $wpdb;
4609 $table = $wpdb->prefix.'wpbot_response';
4610 $results = $wpdb->get_results("SELECT `intent` FROM `{$table}` WHERE 1 and `intent` !=''"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
4611 $response = array();
4612 if(!empty($results)){
4613 foreach($results as $result){
4614 $response[] = $result->intent;
4615 }
4616 }
4617 return $response;
4618 }
4619 }
4620 if( !function_exists('qcld_mysql_remove_existing_indexes') ){
4621 function qcld_mysql_remove_existing_indexes(){
4622 global $wpdb;
4623 $table = $wpdb->prefix.'wpbot_response';
4624
4625 $results = $wpdb->get_results("SHOW INDEX FROM {$table}"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
4626 $indexes = array();
4627 foreach($results as $result){
4628
4629
4630
4631 if("PRIMARY" != $result->Key_name && !in_array($result->Key_name, $indexes)){
4632
4633 // phpcs:ignore
4634 $wpdb->query("ALTER TABLE $table DROP INDEX `".$result->Key_name."`;");
4635
4636 $indexes[] = $result->Key_name;
4637 }
4638
4639 }
4640 }
4641 }
4642
4643 add_action( 'activated_plugin', 'qc_wpbotfree_activation_redirect' );
4644 if( !function_exists('qc_wpbotfree_activation_redirect') ){
4645 function qc_wpbotfree_activation_redirect( $plugin ){
4646 $screen = get_current_screen();
4647 if( ( isset( $screen->base ) && $screen->base == 'plugins' ) && $plugin == plugin_basename( __FILE__ ) ) {
4648 if( $plugin == plugin_basename( __FILE__ ) ) {
4649 // phpcs:ignore
4650 exit( wp_redirect( esc_url( admin_url('admin.php?page=wpbot') ) ) );
4651 }
4652 }
4653 }
4654 }
4655