PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.3.8
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.3.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 8.5.2 All 533 releases
chatbot / qcld-wpwbot.php

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

4,260 lines 254.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://wordpress.org/plugins/chatbot/
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.3.8
8 * @author QuantumCloud
9 * Author: ChatBot for WordPress - WPBot
10 * Author URI: https://www.wpbot.pro/
11 * Requires at least: 4.6
12 * Tested up to: 7.0
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 add_action( 'plugins_loaded', 'qcld_chatbot_existing_plugin_activate_check_callback' );
23 if( !function_exists('qcld_chatbot_existing_plugin_activate_check_callback') ){
24 function qcld_chatbot_existing_plugin_activate_check_callback(){
25
26 $check_existing_plugin = get_option('qcld_chatbot_existing_plugin_activate_check');
27
28
29 if ( class_exists( 'qcld_wb_Chatbot' ) && isset($check_existing_plugin) && ($check_existing_plugin !== 'yes') ) {
30 update_option('qcld_chatbot_existing_plugin_activate_check', 'yes');
31 }else if ( ! class_exists( 'qcld_wb_Chatbot' ) ) {
32 delete_option('qcld_chatbot_existing_plugin_activate_check');
33 }
34
35 }
36 }
37
38 $check_existing_plugin = get_option('qcld_chatbot_existing_plugin_activate_check');
39 if ( isset($check_existing_plugin) && ($check_existing_plugin == 'yes') || class_exists( 'qcld_wb_Chatbot' ) ) {
40 return;
41 }
42
43 if ( ! defined( 'QCLD_wpCHATBOT_VERSION' ) ) {
44 define('QCLD_wpCHATBOT_VERSION', '8.3.8');
45 }
46 if ( ! defined( 'QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION' ) ) {
47 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
48 }
49 if ( ! defined( 'QCLD_wpCHATBOT_PLUGIN_DIR_PATH' ) ) {
50 define('QCLD_wpCHATBOT_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
51 }
52 if ( ! defined( 'QCLD_wpCHATBOT_PLUGIN_URL' ) ) {
53 define('QCLD_wpCHATBOT_PLUGIN_URL', plugin_dir_url(__FILE__));
54 }
55 if ( ! defined( 'QCLD_wpCHATBOT_IMG_URL' ) ) {
56 define('QCLD_wpCHATBOT_IMG_URL', QCLD_wpCHATBOT_PLUGIN_URL . "images/");
57 }
58 if ( ! defined( 'QCLD_wpCHATBOT_IMG_ABSOLUTE_PATH' ) ) {
59 define('QCLD_wpCHATBOT_IMG_ABSOLUTE_PATH', plugin_dir_path(__FILE__) . "images");
60 }
61 if ( ! defined( 'QCLD_wpCHATBOT_INDEX_TABLE' ) ) {
62 define('QCLD_wpCHATBOT_INDEX_TABLE', 'wpwbot_index');
63 }
64
65
66
67 //define('QCLD_wpCHATBOT_CACHE_TABLE', 'wpwbot_cache');
68
69 if ( ! defined( 'QCLD_wpCHATBOT_GC_DIRNAME' ) ) {
70 $gcdirpath = __DIR__.'/../../wpbot-dfv2-client';
71 define('QCLD_wpCHATBOT_GC_DIRNAME', $gcdirpath);
72 }
73 if ( ! defined( 'QCLD_wpCHATBOT_GC_ROOT' ) ) {
74 $wpcontentpath = __DIR__.'/../../';
75 define('QCLD_wpCHATBOT_GC_ROOT', $wpcontentpath);
76 }
77
78 require_once("qcld-wpwbot-search.php");
79 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/class-qcld-bot-rag.php");
80 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openai/qcld-bot-openai.php");
81 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openrouter/qcld-bot-openrouter.php");
82 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/gemini/qcld-bot-gemini.php");
83 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/grok/qcld-bot-grok.php");
84 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."class-qc-free-plugin-upgrade-notice.php");
85 require_once("class-plugin-deactivate-feedback.php");
86 require_once("qc-support-promo-page/class-qc-support-promo-page.php");
87 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."/functions.php");
88 require_once('qcld_df_api.php');
89 require_once('includes/class-wpbot-gc-download.php');
90 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/class-common-function.php");
91 require_once('includes/class-response-list.php');
92 require_once('qc-rating-feature/qc-rating-class.php');
93 // if ( is_admin() ) {
94 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/parsedown.php' );
95 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld-floating-openai-style-filter.php' );
96 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld_openai_floating_content.php' );
97 // }
98
99 /**
100 * Main Class.
101 */
102
103 class qcld_wb_Chatbot_free
104 {
105 private $id = 'wpbot';
106 private static $instance;
107 public $mysql_version = '';
108 public $promotion;
109 public $response_list;
110
111 /**
112 * Get Instance creates a singleton class that's cached to stop duplicate instances
113 */
114 public static function qcld_wb_chatbot_get_instance()
115 {
116 if (!self::$instance) {
117 self::$instance = new self();
118 self::$instance->qcld_wb_chatbot_init();
119 }
120 return self::$instance;
121 }
122 /**
123 * Construct empty on purpose
124 */
125 private function __construct()
126 {
127 $this->promotion = QCLD_wpCHATBOT_IMG_URL . "/NY-26-wpbot.jpg";
128 }
129 /**
130 * Init behaves like, and replaces, construct
131 */
132 public function qcld_wb_chatbot_init()
133 {
134 // Check if wpCommerce is active, and is required wpCommerce version.
135 /*if (!class_exists('wpCommerce') || version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) {
136 add_action('admin_notices', array($this, 'wpcommerce_inactive_notice_for_wp_chatbot'));
137 return;
138 }*/
139 add_action('admin_menu', array($this, 'qcld_wb_chatbot_admin_menu'));
140
141 if ((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) {
142 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
143
144 }
145
146 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'] == 'simple-text-response') ){
147 // add_action( 'admin_notices', array( $this, 'promotion_notice' ) );
148
149 }
150
151 if (is_admin() && !empty($_GET["page"]) && ($_GET["page"] == "wpbot") || (!empty($_GET['page']) && $_GET['page']=='wpbot_help_page')
152
153 || (!empty($_GET['page']) && $_GET['page']=='wpbot_openAi')
154
155 || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") ) {
156 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
157 if( get_option('wp_chatbot_index_count')<=0 && get_option('qlcd_wp_chatbot_search_option')=='advanced'){
158
159 add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
160 }
161 }
162 //loading frontend scripts
163 add_action('wp', array($this, 'qcld_wpchatbot_init_fnc'));
164 add_action('init', array($this, 'qcld_wpchatbot_init2_fnc'));
165
166
167 }
168
169
170
171 public function qcld_wpchatbot_init_fnc(){
172 if (!is_admin() && get_option('disable_wp_chatbot') != 1 && wp_chatbot_load_controlling() === true) {
173 add_action('wp_enqueue_scripts', array($this, 'qcld_wb_chatbot_frontend_scripts'));
174 }
175 }
176 public function qcld_wpchatbot_init2_fnc(){
177 global $wpdb;
178 if( is_admin() ){
179
180 $connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
181 if($connection === false){
182 return;
183 }
184 $content = $connection->server_info;
185
186 $mysql_server_info = $wpdb->db_server_info();
187
188 // Check for the MariaDB.
189 $is_mariadb = false;
190 if ( ! empty( $mysql_server_info ) && strpos( strtolower( $mysql_server_info ), 'maria' ) !== false ) {
191 $is_mariadb = true;
192 }
193
194 preg_match_all('/\d+\.\d+/', $content, $matches);
195
196 if( !empty( $matches ) && isset( $matches[0] ) && !empty( $matches[0] ) && is_array( $matches[0] ) && ! $is_mariadb ){
197 $versions = $matches[0];
198 $notice = true;
199 foreach( $versions as $version ){
200 if (version_compare($version, '5.5', '>')) {
201 $this->mysql_version = $version;
202 $notice = false;
203 }else{
204 $this->mysql_version = $version;
205 }
206 }
207
208 if( $notice ){
209 add_action('admin_notices', array($this, 'mysql_version_notice') );
210 }
211
212 }
213
214 $connection->close();
215 }
216 }
217
218 public function mysql_version_notice(){
219 $class="notice notice-error is-dismissible qc-notice-error";
220 $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.";
221 printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
222 }
223
224 /**
225 * Add a submenu item to the wpCommerce menu
226 */
227 public function qcld_wb_chatbot_admin_menu()
228 {
229 /* add_submenu_page('wpcommerce',
230 __('wpwBot Pro', 'chatbot'),
231 __('wpwBot Pro', 'chatbot'),
232 'manage_wpcommerce',
233 $this->id,
234 array($this, 'qcld_wb_chatbot_admin_page'));*/
235 if( get_option( 'qc_bot_str_allow_author_editor' ) == 1 ){
236 $capability = 'publish_posts';
237 }else{
238 $capability = 'manage_options';
239 }
240 add_menu_page( esc_html('ChatBot WPBot Lite'), esc_html('ChatBot WPBot Lite'), 'manage_options','wpbot-panel', array($this, 'qcld_wb_chatbot_admin_page'),'dashicons-format-status', 6 );
241
242 add_submenu_page( 'wpbot-panel', esc_html('Settings'), esc_html('Settings'), 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
243
244 add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
245
246 $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') );
247
248 add_action( "load-$hook", [ $this, 'screen_option' ] );
249
250 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
251
252 add_submenu_page( 'wpbot-panel', esc_html('Support'), esc_html('Support'), 'manage_options','wpbot_support_page', 'qcpromo_wpbot_free_support_page_callback_func' );
253
254 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' );
255
256
257 }
258
259 function screen_option(){
260 if( isset($_POST['wp_screen_options']) && !empty($_POST['wp_screen_options'])){
261 $per_page_str = (int)$_POST['wp_screen_options']["value"];
262
263 }else{
264 $per_page_str = 20;
265 }
266 $option = 'per_page';
267 $args = [
268 'label' => 'Response',
269 'default' => $per_page_str,
270 'option' => 'responses_per_page'
271 ];
272
273 $this->response_list = new Response_list();
274 }
275
276 public function qcld_wb_chatbot_admin_str(){
277
278 require_once("includes/simple_text_response.php");
279
280 }
281
282
283
284 /**
285 * Include admin scripts
286 */
287 public function qcld_wb_chatbot_admin_scripts($hook)
288 {
289 global $wpcommerce, $wp_scripts;
290 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
291
292 if (((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) || ($hook == "widgets.php") || $_GET['page']=='wpbot_help_page' || $_GET['page']=='wpbot_openAi' || $_GET['page']=='simple-text-response'
293 || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" ) {
294
295 wp_enqueue_script('jquery');
296 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
297
298 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');
299 wp_enqueue_style('qlcd-wp-chatbot-admin-style');
300 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');
301 wp_enqueue_style('qlcd-wp-chatbot-tabs-style');
302 wp_register_style('jquery.fontpicker.min.css', QCLD_wpCHATBOT_PLUGIN_URL . 'css/fontpicker.min.css', '', QCLD_wpCHATBOT_VERSION, 'screen');
303 wp_enqueue_style('jquery.fontpicker.min.css');
304
305
306 //wp_register_style('qlcd-openai-bootstap', plugins_url(basename(plugin_dir_path(__FILE__)) . '/openai/css/openai-admin-style.css', basename(__FILE__)), array(), true);
307 //wp_enqueue_style('qlcd-openai-bootstap');
308
309
310
311 wp_enqueue_script('jquery');
312 wp_enqueue_script( 'jquery-ui-draggable' );
313 wp_enqueue_script( 'jquery-ui-droppable' );
314 wp_enqueue_script('jquery-ui-core');
315 wp_enqueue_style( 'wp-color-picker');
316 wp_enqueue_script( 'wp-color-picker');
317 wp_enqueue_script( 'jquery-ui-sortable');
318 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
319 wp_enqueue_script('qcld-wp-fontpicker');
320 wp_register_script('qcld-wp-chatbot-cbpFWTabs', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/cbpFWTabs.js', basename(__FILE__)), array(), true);
321 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
322 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
323 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
324 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
325 wp_enqueue_script('qcld-wp-chatbot-bootstrap-js');
326
327 // wp_register_script('qcld-wp-openai-setting-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/openai_settings.js', basename(__FILE__)), array('jquery'), true);
328 // wp_enqueue_script('qcld-wp-openai-setting-js');
329
330 wp_localize_script( 'qcld-wp-openai-setting-js', 'openai_ajax', array(
331 'url' => admin_url( 'admin-ajax.php' ),
332 ) );
333
334 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');
335 wp_enqueue_style('qcld-wp-chatbot-bootstrap-css');
336 //jquery time picker
337 wp_register_script('qcld-wp-chatbot-timepicker-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.timepicker.js', basename(__FILE__)), array('jquery'), true);
338 wp_enqueue_script('qcld-wp-chatbot-timepicker-js');
339 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');
340 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
341 wp_register_script('qcld-wp-chatbot-sweetalrt', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/sweetalrt.js', basename(__FILE__)), array(), true);
342 wp_enqueue_script('qcld-wp-chatbot-sweetalrt');
343 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'), true);
344 wp_enqueue_script('qcld-wp-chatbot-admin-js');
345 wp_localize_script('qcld-wp-chatbot-admin-js', 'qcld_gemini_admin_data',
346 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
347 // WordPress Media library
348 wp_enqueue_media();
349
350
351
352 }
353
354 }
355
356
357 public function qcld_get_formbuilder_forms(){
358 global $wpdb;
359 $forms = array();
360 if(class_exists('Qcformbuilder_Forms_Admin')){
361 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
362 if(!empty($results)){
363 foreach($results as $result){
364 $form = maybe_unserialize($result->config);
365 $forms[] = trim($form['name']);
366 }
367 return $forms;
368 }else{
369 return array();
370 }
371 }else{
372 return array();
373 }
374 }
375 public function qcld_wpbot_simple_response_intent(){
376 global $wpdb;
377 $table = $wpdb->prefix.'wpbot_response';
378 $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''"); //DB Call OK, No Caching OK
379 $response = array();
380 if(!empty($results)){
381 foreach($results as $result){
382 $response[] = $result->intent;
383 }
384 }
385 return $response;
386 }
387 public function qcld_get_formbuilder_form_commands(){
388 global $wpdb;
389 $command = array();
390 if(class_exists('Qcformbuilder_Forms_Admin')){
391 $primary = 'primary';
392 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type = %s", $primary)); //DB Call OK, No Caching OK
393
394 if(!empty($results)){
395 foreach($results as $result){
396 $form = maybe_unserialize($result->config);
397
398 if(isset($form['command'])){
399 $command[] = array_map('trim', explode(',', strtolower($form['command'])));
400 }
401
402 }
403 return $command;
404 }else{
405 return array();
406 }
407 }else{
408 return array();
409 }
410 }
411 public function promotion_notice(){
412 $screen = get_current_screen();
413 // var_dump($screen->base );
414 // if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
415 ?>
416 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #120976 !important">
417 <div class="">
418
419 <div class="qc-review-text" >
420 <a href="<?php echo esc_url('https://www.wpbot.pro/pricing/'); ?>" target="_blank">
421 <img src="<?php echo esc_url($this->promotion); ?>" alt="promotion" style="position: flex !important;"></a>
422 </div>
423 </div>
424 </div>
425 <?php
426 // }
427 }
428 public function qcld_get_formbuilder_form_ids(){
429 global $wpdb;
430 $forms = array();
431 if(class_exists('Qcformbuilder_Forms_Admin')){
432 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
433
434 if(!empty($results)){
435 foreach($results as $result){
436 $form = maybe_unserialize($result->config);
437 $forms[] = trim($form['ID']);
438 }
439 return $forms;
440 }else{
441 return array();
442 }
443 }else{
444 return array();
445 }
446 }
447
448 public function qcld_wb_chatbot_frontend_scripts()
449 {
450 global $wpcommerce, $wp_scripts, $wpdb, $current_user;
451
452 $display_name = '';
453 $display_email = '';
454 $user_image = get_option('wp_custom_client_icon');
455 $user_id = 0;
456 $user_image = get_option('wp_custom_client_icon');
457 if ( is_user_logged_in() ) {
458 $display_name = $current_user->display_name;
459 $display_email = $current_user->user_email;
460 $user_image = esc_url( get_avatar_url( $current_user->ID ) );
461 $user_id = $current_user->ID;
462 }
463
464 $conversation_form_ids = array();
465 $conversation_form_names = array();
466
467 if(class_exists('Qcformbuilder_Forms_Admin')){
468 $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
469 if(!empty($results)){
470
471 foreach($results as $result){
472 $form = maybe_unserialize($result->config);
473 $conversation_form_ids[] = $form['ID'];
474 $conversation_form_names[] = $form['name'];
475 }
476
477 }
478 }
479 $wp_chatbot_obj = array(
480 'wp_chatbot_position_x' => get_option('wp_chatbot_position_x'),
481 'wp_chatbot_position_y' => get_option('wp_chatbot_position_y'),
482 'disable_icon_animation' => get_option('disable_wp_chatbot_icon_animation'),
483 'disable_featured_product' => get_option('disable_wp_chatbot_featured_product'),
484 'disable_product_search' => get_option('disable_wp_chatbot_product_search'),
485 'disable_catalog' => get_option('disable_wp_chatbot_catalog'),
486 'disable_order_status' => get_option('disable_wp_chatbot_order_status'),
487 'disable_sale_product' => get_option('disable_wp_chatbot_sale_product'),
488 'open_product_detail' => get_option('wp_chatbot_open_product_detail'),
489 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
490 'ajax_url' => admin_url('admin-ajax.php'),
491 'image_path' => QCLD_wpCHATBOT_IMG_URL,
492 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
493 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
494 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
495 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
496 'agent' => str_replace(['\\','<','>'], '',esc_html(get_option('qlcd_wp_chatbot_agent'))),
497 'agent_image' => get_option('wp_chatbot_agent_image'),
498 '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'),
499 'shopper_demo_name' => str_replace('\\', '',get_option('qlcd_wp_chatbot_shopper_demo_name')),
500 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
501 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
502 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
503 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
504 'hello' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hello'))),
505 'asking_name' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_name'))),
506 'i_am' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_i_am'))),
507 'name_greeting' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_name_greeting'))),
508 'wildcard_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_msg'))),
509 'empty_filter_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_empty_filter_msg'))),
510 'did_you_mean' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_did_you_mean'))),
511 'is_typing' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_is_typing'))),
512 'send_a_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_send_a_msg'))),
513
514 'viewed_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_viewed_products'))),
515
516 'shopping_cart' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_shopping_cart'))),
517 'cart_updating' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_cart_updating'))),
518 'cart_removing' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_cart_removing'))),
519 'imgurl' => QCLD_wpCHATBOT_IMG_URL,
520 'sys_key_help' => get_option('qlcd_wp_chatbot_sys_key_help'),
521 'sys_key_product' => get_option('qlcd_wp_chatbot_sys_key_product'),
522 'sys_key_catalog' => get_option('qlcd_wp_chatbot_sys_key_catalog'),
523 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
524 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
525 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
526 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
527 'help_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
528 'back_to_start' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
529 'help_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
530 'reset' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_reset'))),
531 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
532 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
533 'featured_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
534 'sale_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
535 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
536 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
537 'product_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
538 'product_suggest' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
539 'product_infinite' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
540 'product_success' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_success'))),
541 'product_fail' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
542 'support_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
543 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
544 'support_option_again' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
545 'asking_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
546 'asking_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
547 'no_result' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_no_result'))),
548 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
549 'asking_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
550 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
551 'support_query' => ((gettype(get_option('support_query')) == 'string') ? $this->qcld_wb_chatbot_str_replace(unserialize( get_option('support_query'))) : $this->qcld_wb_chatbot_str_replace(( get_option('support_query')))),
552 'support_ans' => (gettype(get_option('support_ans')) == 'string') ? $this->qcld_wb_chatbot_str_replace(unserialize(get_option('support_ans'))) : $this->qcld_wb_chatbot_str_replace((get_option('support_ans'))),
553 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
554 'notifications' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_notifications'))),
555 'order_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
556 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
557 'order_username_password' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
558 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
559 'order_login' => is_user_logged_in(),
560 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
561 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
562 'order_email_support' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
563 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
564 'invalid_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
565 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
566 'currency_symbol' => '',
567 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
568 'messenger_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
569 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
570 'enable_skype' => get_option('enable_wp_chatbot_skype'),
571 'enable_whats' => get_option('enable_wp_chatbot_whats'),
572 'whats_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
573 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
574 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
575 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
576 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
577 'exit_intent_once' => get_option('wp_chatbot_exit_intent_once'),
578 'enable_scroll_open' => get_option('enable_wp_chatbot_scroll_open'),
579 'scroll_open_msg' => str_replace('\\', '', get_option('wp_chatbot_scroll_open_msg')),
580 'scroll_open_percent' => get_option('wp_chatbot_scroll_percent'),
581 'scroll_open_once' => get_option('wp_chatbot_scroll_once'),
582 'enable_auto_open' => get_option('enable_wp_chatbot_auto_open'),
583 'auto_open_msg' => str_replace('\\', '', get_option('wp_chatbot_auto_open_msg')),
584 'auto_open_time' => get_option('wp_chatbot_auto_open_time'),
585 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
586 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
587 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
588 'disable_faq' => get_option('disable_wp_chatbot_faq'),
589 'feedback_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
590 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
591 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
592 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
593 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
594 'search_keyword' => get_option('qlcd_wp_chatbot_asking_search_keyword'),
595 'ajax_nonce'=> wp_create_nonce('qcsecretbotnonceval123qc'),
596 'session_nonce'=> wp_create_nonce('wp_chatbot'),
597 'site_search' => get_option('qlcd_wp_site_search'),
598 'open_links_newtab' => get_option('open_links_new_window'),
599 'call_gen' => get_option('disable_wp_chatbot_call_gen'),
600 'call_sup' => get_option('disable_wp_chatbot_call_sup'),
601 'enable_ret_sound' => get_option('enable_wp_chatbot_ret_sound'),
602 'found_result_message' => get_option('qlcd_wp_chatbot_found_result'),
603 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
604 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
605 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
606 'mobile_full_screen' => '1',
607 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):800),
608 'inactive_time' => get_option('wp_chatbot_inactive_time'),
609 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
610 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
611 'ai_df_token' => get_option('qlcd_wp_chatbot_dialogflow_client_token'),
612 'df_defualt_reply' => str_replace('\\', '', get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')),
613 'df_agent_lan' => get_option('qlcd_wp_chatbot_dialogflow_agent_language'),
614 'openai_enabled' => get_option('ai_enabled'),
615 'is_stream_enabled' => ( get_option('is_stream_enabled', '1') == '1' ? '1' : '0' ),
616 'qcld_openai_append_content' => get_option('qcld_openai_append_content'),
617 'openrouter_enabled' => (get_option('qcld_openrouter_enabled')=='1'? get_option('qcld_openrouter_enabled') : '0'),
618 'gemini_enabled' => (get_option('qcld_gemini_enabled')=='1'? get_option('qcld_gemini_enabled') : '0'),
619 'grok_enabled' => (get_option('qcld_grok_enabled')=='1'? get_option('qcld_grok_enabled') : '0'),
620 'qcld_gemini_prepend_content' => get_option('qcld_gemini_prepend_content'),
621 'qcld_gemini_append_content' => get_option('qcld_gemini_append_content'),
622 'qcld_openrouter_append_content' => get_option('qcld_openrouter_append_content'),
623 'qcld_openrouter_prepend_content' => get_option('qcld_openrouter_prepend_content'),
624 'start_menu' => wp_unslash(get_option('qc_wpbot_menu_order')),
625 'conversation_form_ids' => $conversation_form_ids,
626 'conversation_form_names' => $conversation_form_names,
627 'simple_response_intent' => $this->qcld_wpbot_simple_response_intent(),
628 'forms' => $this->qcld_get_formbuilder_forms(),
629 'form_ids' =>$this->qcld_get_formbuilder_form_ids(),
630 'form_commands' => $this->qcld_get_formbuilder_form_commands(),
631 'df_api_version' => (get_option('wp_chatbot_df_api')==''?'v1':get_option('wp_chatbot_df_api')),
632 'v2_client_url'=> esc_url(get_site_url().'/?action=qcld_dfv2_api'),
633 'show_menu_after_greetings'=> (get_option('show_menu_after_greetings')!=''?get_option('show_menu_after_greetings'):0),
634 'disable_back_to_start'=> (get_option('disable_back_to_start_menu')!=''?get_option('disable_back_to_start_menu'):0),
635 'current_user_id' => $user_id,
636 'display_name' => esc_html( $display_name ),
637 'skip_wp_greetings' => get_option('skip_wp_greetings'),
638 'skip_greetings_and_menu' => get_option('skip_wp_greetings_donot_show_menu'),
639 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
640 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
641 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
643 'qlcd_wp_chatbot_report_text' => get_option('qlcd_wp_chatbot_report_text'),
644 'enable_chat_share_menu' => get_option('enable_chat_share_menu'),
645 'qlcd_wp_chatbot_share_text' => get_option('qlcd_wp_chatbot_share_text'),
646
647 );
648 $user_font = get_option('wp_chatbot_user_font') != '' ? get_option('wp_chatbot_user_font') : '';
649 if($user_font != '' ){
650 $parts = explode(':', $user_font);
651 // Create an object
652 $user_font_family = new stdClass();
653 // Assign values
654 $user_font_family->fontfamily = $parts[0];
655 $user_font_family->fontWeight = isset($parts[1]) ? $parts[1] : '400'; // default weight
656 $user_font_family->fontStyle = 'normal';
657 if(get_option('enable_wp_chatbot_custom_color')==1){
658 $user_enqueue_font = 'https://fonts.googleapis.com/css2?family='. $user_font_family->fontfamily;
659 wp_enqueue_style( 'qcld-chatbot-user-google-fonts', $user_enqueue_font, false );
660 wp_enqueue_style( 'qcld-chatbot-user-google-fonts');
661 }
662 }
663
664 $bot_font = get_option('wp_chatbot_bot_font') != '' ? get_option('wp_chatbot_bot_font') : '';
665 if($bot_font != '' ){
666 $parts = explode(':', $bot_font);
667 // Create an object
668 $bot_font_family = new stdClass();
669 // Assign values
670 $bot_font_family->fontFamily = $parts[0];
671 $bot_font_family->fontWeight = isset($parts[1]) ? $parts[1] : '400'; // default weight
672 $bot_font_family->fontStyle = 'normal';
673
674
675
676 if(get_option('enable_wp_chatbot_custom_color')==1){
677 $bot_enqueue_font = 'https://fonts.googleapis.com/css2?family='.$bot_font_family->fontFamily;
678 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts', $bot_enqueue_font, false );
679 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts');
680 }
681 }
682
683
684
685 wp_enqueue_style( 'dashicons' );
686 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);
687 wp_enqueue_script('qcld-wp-chatbot-slimscroll-js');
688 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);
689 wp_enqueue_script('qcld-wp-chatbot-jquery-cookie');
690 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);
691 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
692 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);
693 wp_enqueue_script('qcld-wp-chatbot-plugin');
694
695 $nonce = wp_create_nonce('wp_chatbot');
696 // Pass data to JS
697 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
698 'ajax_url' => admin_url('admin-ajax.php'),
699 'nonce' => $nonce,
700 'stream_endpoint' => admin_url('admin-ajax.php?action=qcld_stream_openai'),
701 ]);
702
703 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);
704 wp_enqueue_script('qcld-wp-chatbot-front-js');
705 wp_localize_script('qcld-wp-chatbot-front-js', 'wp_chatbot_obj', $wp_chatbot_obj);
706 //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);
707 //wp_enqueue_script('qcld-wp-chatbot-frontend');
708 //wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
709 wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
710
711 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' ) ) {
712 // Return early if critical WordPress functions are not available.
713 // This indicates the code needs to be hooked into an appropriate action.
714 return;
715 }
716
717 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');
718 wp_enqueue_style('qcld-wp-chatbot-common-style');
719
720 $floating_icon_bg_color = get_option('wp_chatbot_floatingiconbg_color');
721 $floating_icon_bg_color = sanitize_hex_color($floating_icon_bg_color); // ensures it's a valid hex color like #ffffff
722
723 if ( ! empty($floating_icon_bg_color) ) {
724 $inline_floating_icon_styles = "
725 .wp-chatbot-ball {
726 background: {$floating_icon_bg_color} !important;
727 }
728 .wp-chatbot-ball:hover,
729 .wp-chatbot-ball:focus {
730 background: {$floating_icon_bg_color} !important;
731 }";
732
733 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $inline_floating_icon_styles );
734 }
735
736 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');
737 wp_enqueue_style('qcld-wp-chatbot-magnific-popup');
738
739 $qcld_wb_chatbot_theme = get_option('qcld_wb_chatbot_theme');
740 /* if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css')) {
741 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');
742 wp_enqueue_style('qcld-wp-chatbot-style');
743 }*/
744 //Loading shortcode style
745 if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/shortcode.css')) {
746 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');
747 wp_enqueue_style('qcld-wp-chatbot-shortcode-style');
748 }
749
750 $inline_chat_custom_styles = ''; // Initialize a new variable for general chat custom styles.
751 if(get_option('enable_wp_chatbot_custom_color')==1){
752 // Sanitize all color options before using them in CSS to prevent invalid values.
753 $text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
754 $link_color = sanitize_hex_color( get_option('wp_chatbot_link_color') );
755 $link_hover_color = sanitize_hex_color( get_option('wp_chatbot_link_hover_color') );
756 $bot_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_bot_msg_text_color') );
757 $bot_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_bot_msg_bg_color') );
758 $buttons_text_color = sanitize_hex_color( get_option('wp_chatbot_buttons_text_color') );
759 $buttons_bg_color = sanitize_hex_color( get_option('wp_chatbot_buttons_bg_color') );
760 $buttons_text_color_hover = sanitize_hex_color( get_option('wp_chatbot_buttons_text_color_hover') );
761 $buttons_bg_color_hover = sanitize_hex_color( get_option('wp_chatbot_buttons_bg_color_hover') );
762 $user_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_text_color') );
763 $wp_chatbot_text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
764 $user_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_bg_color') );
765 $header_background_color = sanitize_hex_color( get_option('wp_chatbot_header_background_color') );
766
767 $inline_chat_custom_styles .= "
768 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
769 color: ". $text_color ." !important;
770 }
771 #wp-chatbot-chat-container a {
772 color: ". $link_color ." !important;
773 }
774
775 #wp-chatbot-chat-container a p{
776 color: ". $link_color ." !important;
777 }
778 #wp-chatbot-chat-container a p span{
779 color: ". $link_color ." !important;
780 }
781 #wp-chatbot-chat-container a:hover {
782 color: ". $link_hover_color ." !important;
783 }
784
785 ul.wp-chatbot-messages-container > li.wp-chatbot-msg .wp-chatbot-paragraph,
786 .wp-chatbot-agent-profile .wp-chatbot-bubble {
787 color: ". $bot_msg_text_color ." !important;
788 background-color: ". $bot_msg_bg_color ." !important;
789 word-break: break-word;
790 }
791 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 {
792 color: ". $buttons_text_color ." !important;
793 background-color: ". $buttons_bg_color ." !important;
794 background-image: none !important;
795 }
796
797 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 {
798 color: ". $buttons_text_color_hover ." !important;
799 background-color: ". $buttons_bg_color_hover ." !important;
800 background-image: none !important;
801 }
802
803 li.wp-chat-user-msg .wp-chatbot-paragraph {
804 color: ". $user_msg_text_color ." !important;
805 background: ". $user_msg_bg_color ." !important;
806 }
807
808 ul.wp-chatbot-messages-container li:first-child.wp-chatbot-msg .wp-chatbot-paragraph {
809 color: ". $wp_chatbot_text_color ." !important;
810 }
811
812 ul.wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph:before,
813 .wp-chatbot-bubble:before {
814 border-right: 10px solid ". $bot_msg_bg_color ." !important;
815
816 }
817 ul.wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph:before {
818 border-left: 10px solid ". $user_msg_bg_color ." !important;
819 }
820 #wp-chatbot-chat-container .wp-chatbot-header{
821 background: ". $header_background_color ." !important;
822 }
823 .wp-chatbot-container ul.wp-chatbot-messages-container > li.wp-chatbot-msg .chat-container, .wp-chatbot-container .wp-chatbot-agent-profile .wp-chatbot-bubble {
824 color: ". $bot_msg_text_color ." !important;
825 background: ". $bot_msg_bg_color ." !important;
826 }
827 ";
828 // Apply the accumulated general chat custom styles.
829 // This ensures these styles are added if the custom color option is enabled.
830 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $inline_chat_custom_styles );
831 }
832 $custom_colors ="";
833 if((get_option('enable_wp_chatbot_custom_color')==1) && $user_font != ''){
834 $custom_colors .="
835
836
837 #wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph,
838 #wp-chatbot-messages-container > li.wp-chatbot-msg > span{
839 font-family: ".$bot_font_family->fontFamily.";
840 font-weight: ".$bot_font_family->fontWeight.";
841 font-style: ".$bot_font_family->fontStyle.";
842 font-size: ". get_option('wp_chatbot_font_size'). "px;
843 }
844
845 ul.wp-chatbot-messages-container > li.wp-chatbot-msg .wp-chatbot-paragraph, .wp-chatbot-agent-profile .wp-chatbot-bubble {
846 font-family: ".$bot_font_family->fontFamily.";
847 font-weight: ".$bot_font_family->fontWeight.";
848 font-style: ".$bot_font_family->fontStyle.";
849 font-size: ". get_option('wp_chatbot_font_size'). "px;
850 }
851
852 ul#wp-chatbot-messages-container .wp-chatbot-textanimation span {
853 font-family: ".$bot_font_family->fontFamily.";
854 font-weight: ".$bot_font_family->fontWeight.";
855 font-style: ".$bot_font_family->fontStyle.";
856 font-size: ". get_option('wp_chatbot_font_size'). "px;
857 }
858
859 ";
860 }
861 if ( get_option('enable_wp_chatbot_custom_color') == 1 && ! empty($bot_font) ) {
862
863 // Sanitize each CSS-related value
864 $font_family = isset( $user_font_family->fontfamily ) ? esc_attr( $user_font_family->fontfamily ) : 'inherit';
865 $font_weight = isset( $user_font_family->fontWeight ) ? esc_attr( $user_font_family->fontWeight ) : 'normal';
866 $font_style = isset( $user_font_family->fontStyle ) ? esc_attr( $user_font_family->fontStyle ) : 'normal';
867 $font_size = get_option( 'wp_chatbot_font_size' );
868 $font_size = esc_attr( trim( $font_size ) );
869
870 // Optional: ensure font size includes units.
871 if ( ! preg_match( '/(px|em|rem|%)$/', $font_size ) ) {
872 $font_size .= 'px'; // fallback to px if unit missing.
873 }
874
875 $custom_colors .= "
876 #wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph {
877 font-family: {$font_family};
878 font-weight: {$font_weight};
879 font-style: {$font_style};
880 font-size: {$font_size};
881 }
882 ";
883
884 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
885 }
886
887 if(get_option('wp_chatbot_custom_css')!=""){
888
889 wp_add_inline_style( 'qcld-wp-chatbot-common-style', get_option('wp_chatbot_custom_css') );
890 }
891 }
892 public function qcld_wb_chatbot_str_replace($messages=array()){
893 $allowed_html = array(
894 'a' => array(
895 'href' => array(),
896 'title' => array()
897 ),
898 'div' => array(
899 'class' => array()
900 ),
901 'span' => array(
902 'class' => array()
903 ),
904 'img' => array(
905 'src' => array()
906 ),
907 'h3' => array(),
908 'h4' => array(),
909 'h5' => array(),
910 'h6' => array(),
911 'b' => array(),
912 'br' => array(),
913 'em' => array(),
914 'ul' => array(),
915 'li' => array(),
916 'strong' => array(),
917 );
918 $refined_mesgses=array();
919 if(!empty($messages) && is_array($messages)){
920 foreach ($messages as $message){
921 $from = array('&lt;', '&gt;');
922 $to = array('<', '>');
923 if(!is_array($message)){
924 $message = str_replace($from, $to, $message);
925 $msg = wp_kses( ($message), $allowed_html);
926 $refined_msg=str_replace('\\', '', $msg);
927 array_push($refined_mesgses,$refined_msg);
928 }
929 }
930 }else{
931 $from = array('&lt;', '&gt;');
932 $to = array('<', '>');
933
934 $message = str_replace($from, $to, $messages);
935 if(!empty($messages )){
936 $msg = wp_kses( $messages, $allowed_html);
937 }else{
938 $msg = '';
939 }
940 $refined_msg=str_replace('\\', '', $msg);
941 array_push($refined_mesgses,$refined_msg);
942
943 }
944 return $refined_mesgses;
945
946 }
947 //getting exact agent icon path
948 public function qcld_wb_chatbot_agent_icon(){
949
950 if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')=="custom-agent.png" ){
951 $wp_chatbot_custom_icon_path=get_option('wp_chatbot_custom_agent_path');
952 }
953 else if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')!="custom-agent.png"){
954 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
955 }
956 else
957 {
958 if(get_option('wp_chatbot_agent_image')!=''){
959 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
960 }else{
961 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.'custom-agent.png';
962 }
963
964 }
965
966 return $wp_chatbot_custom_icon_path;
967 }
968 /**
969 * Render the admin page
970 */
971
972 public function qcld_wb_chatbot_admin_page()
973 {
974 global $wpcommerce;
975 $action = 'admin.php?page=wpbot-panel';
976 require_once("admin_ui2.php");
977 }
978
979 public function qcld_wb_chatbot_admin_page_settings()
980 {
981 global $wpcommerce;
982 $action = 'admin.php?page=wpbot';
983
984 require_once("admin_ui.php");
985 }
986
987 public function qcld_wb_chatbot_dynamic_multi_option($options, $option_name, $option_text)
988 {
989 ?>
990
991 <h4 class="qc-opt-title">
992 <?php echo esc_html($option_text); ?>
993 </h4>
994 <div class="wp-chatbot-lng-items">
995 <?php
996 if (is_array($options) && count($options) > 0) {
997 foreach ($options as $key => $value) {
998 ?>
999 <div class="row" class="wp-chatbot-lng-item">
1000 <div class="col-xs-11">
1001 <input type="text"
1002 class="form-control qc-opt-dcs-font"
1003 name="<?php echo esc_attr( $option_name ); ?>[]"
1004 value="<?php echo esc_attr(str_replace('\\', '', $value)); ?>">
1005 </div>
1006 <div class="col-xs-1">
1007 <button type="button" class="btn btn-danger btn-sm wp-chatbot-lng-item-remove"> <span class="glyphicon glyphicon-remove"></span> </button>
1008 </div>
1009 </div>
1010 <?php
1011 }
1012 } else { ?>
1013 <div class="row" class="wp-chatbot-lng-item">
1014 <div class="col-xs-11">
1015 <input type="text"
1016 class="form-control qc-opt-dcs-font"
1017 name="<?php echo esc_attr( $option_name ); ?>[]"
1018 value="<?php echo esc_attr($option_text); ?>">
1019 </div>
1020 <div class="col-xs-1"> <span class="wp-chatbot-lng-item-remove">
1021 <?php esc_html_e('X', 'chatbot'); ?>
1022 </span> </div>
1023 </div>
1024 <?php } ?>
1025 </div>
1026 <div class="row">
1027 <div class="col-sm-1 col-sm-offset-11">
1028 <button type="button" class="btn btn-success btn-sm wp-chatbot-lng-item-add"> <span class="glyphicon glyphicon-plus"></span> </button>
1029 </div>
1030 </div>
1031 <?php
1032 }
1033
1034 function qcld_wb_chatbot_save_options()
1035 {
1036 //global $wpcommerce;
1037 if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'wp_chatbot') && current_user_can('manage_options')) {
1038 // Check if the form is submitted or not.
1039 $submit = sanitize_text_field(wp_unslash($_POST['submit']));
1040 if (isset($submit)) {
1041 //wpwboticon position settings.
1042 if (isset($_POST["wp_chatbot_position_x"])) {
1043 $wp_chatbot_position_x = intval(sanitize_text_field(wp_unslash($_POST["wp_chatbot_position_x"])));
1044 update_option('wp_chatbot_position_x', $wp_chatbot_position_x);
1045 }
1046 if (isset($_POST["wp_chatbot_position_y"])) {
1047 $wp_chatbot_position_y = intval(sanitize_text_field(wp_unslash($_POST["wp_chatbot_position_y"])));
1048 update_option('wp_chatbot_position_y', $wp_chatbot_position_y);
1049 }
1050 //product search options
1051 if(isset($_POST['qlcd_wp_chatbot_search_option'])){
1052 $qlcd_wp_chatbot_search_option = sanitize_text_field(wp_unslash($_POST['qlcd_wp_chatbot_search_option']));
1053 update_option('qlcd_wp_chatbot_search_option', $qlcd_wp_chatbot_search_option);
1054 }
1055 if(isset( $_POST["disable_floating_button"])){
1056 $disable_floating_button = sanitize_text_field(wp_unslash($_POST["disable_floating_button"]));
1057 }else{ $disable_floating_button='';}
1058 update_option('disable_floating_button', wp_unslash($disable_floating_button));
1059
1060 if(isset( $_POST["wpbot_enable_on_search"])){
1061 $wpbot_enable_on_search = sanitize_text_field(wp_unslash($_POST["wpbot_enable_on_search"]));
1062 }else{ $wpbot_enable_on_search='';}
1063 update_option('wpbot_enable_on_search', wp_unslash($wpbot_enable_on_search));
1064
1065 if(isset( $_POST["skip_wp_greetings_donot_show_menu"])){
1066 $skip_wp_greetings_donot_show_menu = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings_donot_show_menu"]));
1067 }else{ $skip_wp_greetings_donot_show_menu='';}
1068 update_option('skip_wp_greetings_donot_show_menu', wp_unslash($skip_wp_greetings_donot_show_menu));
1069
1070 if(isset( $_POST["skip_wp_greetings"])){
1071 $skip_wp_greetings = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings"]));
1072 }else{ $skip_wp_greetings='';}
1073 update_option('skip_wp_greetings', wp_unslash($skip_wp_greetings));
1074 //Enable /disable wpwbot
1075 if(isset( $_POST["disable_wp_chatbot"])){
1076 $disable_wp_chatbot = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot"]));
1077 }else{ $disable_wp_chatbot='';}
1078 update_option('disable_wp_chatbot', wp_unslash($disable_wp_chatbot));
1079
1080 if(isset( $_POST["qlcd_wp_chatbot_admin_email"])){
1081 $qlcd_wp_chatbot_admin_email = sanitize_email(wp_unslash($_POST["qlcd_wp_chatbot_admin_email"]));
1082 }else{ $qlcd_wp_chatbot_admin_email='';}
1083 update_option('qlcd_wp_chatbot_admin_email', wp_unslash($qlcd_wp_chatbot_admin_email));
1084
1085
1086 if(isset( $_POST["open_links_new_window"])){
1087 $open_links_new_window = sanitize_text_field(wp_unslash($_POST["open_links_new_window"]));
1088 }else{ $open_links_new_window='';}
1089 update_option('open_links_new_window', wp_unslash($open_links_new_window));
1090
1091
1092 if(isset( $_POST["qlcd_wp_chatbot_from_email"])){
1093 $qlcd_wp_chatbot_from_email = sanitize_email(wp_unslash($_POST["qlcd_wp_chatbot_from_email"]));
1094 }else{ $qlcd_wp_chatbot_from_email='';}
1095 update_option('qlcd_wp_chatbot_from_email', wp_unslash($qlcd_wp_chatbot_from_email));
1096
1097 if(isset( $_POST["disable_wp_chatbot_on_mobile"])) {
1098 $disable_wp_chatbot_on_mobile = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_on_mobile"]));
1099 }else{ $disable_wp_chatbot_on_mobile='';}
1100 update_option('disable_wp_chatbot_on_mobile', wp_unslash($disable_wp_chatbot_on_mobile));
1101 if(isset( $_POST["disable_wp_chatbot_product_search"])) {
1102 $disable_wp_chatbot_product_search = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_product_search"]));
1103 }else{ $disable_wp_chatbot_product_search='';}
1104 update_option('disable_wp_chatbot_product_search', wp_unslash($disable_wp_chatbot_product_search));
1105 if(isset( $_POST["disable_wp_chatbot_catalog"])) {
1106 $disable_wp_chatbot_catalog= sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_catalog"]));
1107 }else{ $disable_wp_chatbot_catalog='';}
1108 update_option('disable_wp_chatbot_catalog', wp_unslash($disable_wp_chatbot_catalog));
1109 if(isset( $_POST["disable_wp_chatbot_order_status"])) {
1110 $disable_wp_chatbot_order_status = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_order_status"]));
1111 }else{ $disable_wp_chatbot_order_status='';}
1112 update_option('disable_wp_chatbot_order_status', wp_unslash($disable_wp_chatbot_order_status));
1113 if(isset( $_POST["disable_wp_chatbot_notification"])) {
1114 $disable_wp_chatbot_notification = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_notification"]));
1115 }else{ $disable_wp_chatbot_notification='1';}
1116 update_option('disable_wp_chatbot_notification', wp_unslash($disable_wp_chatbot_notification));
1117
1118 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
1119 $enable_wp_chatbot_rtl = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_rtl"]));
1120 }else{ $enable_wp_chatbot_rtl='';}
1121 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
1122
1123 if(isset( $_POST["show_menu_after_greetings"])) {
1124 $show_menu_after_greetings = sanitize_text_field(wp_unslash($_POST["show_menu_after_greetings"]));
1125 }else{ $show_menu_after_greetings='';}
1126 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
1127
1128 if(isset( $_POST["disable_back_to_start_menu"])) {
1129 $disable_back_to_start_menu = sanitize_text_field(wp_unslash($_POST["disable_back_to_start_menu"]));
1130 }else{ $disable_back_to_start_menu='';}
1131 update_option('disable_back_to_start_menu', wp_unslash($disable_back_to_start_menu));
1132
1133 if(isset( $_POST["enable_chat_session"])) {
1134 $enable_chat_session = sanitize_text_field(wp_unslash($_POST["enable_chat_session"]));
1135 }else{ $enable_chat_session='';}
1136 update_option('enable_chat_session', wp_unslash($enable_chat_session));
1137
1138
1139 if(isset( $_POST["enable_wp_chatbot_mobile_full_screen"])) {
1140 $enable_wp_chatbot_mobile_full_screen = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_mobile_full_screen"]));
1141 }else{ $enable_wp_chatbot_mobile_full_screen='';}
1142 update_option('enable_wp_chatbot_mobile_full_screen', wp_unslash($enable_wp_chatbot_mobile_full_screen));
1143
1144 if(isset( $_POST["wpbot_preloading_time"])) {
1145 $wpbot_preloading_time = sanitize_text_field(wp_unslash($_POST["wpbot_preloading_time"]));
1146 }else{ $wpbot_preloading_time='800';}
1147 update_option('wpbot_preloading_time', wp_unslash($wpbot_preloading_time));
1148
1149 if(isset( $_POST["disable_wp_chatbot_icon_animation"])) {
1150 $disable_wp_chatbot_icon_animation = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_icon_animation"]));
1151 }else{ $disable_wp_chatbot_icon_animation='';}
1152 update_option('disable_wp_chatbot_icon_animation', wp_unslash($disable_wp_chatbot_icon_animation));
1153 //Enable /disable Cart Item Number
1154 if(isset( $_POST["disable_wp_chatbot_cart_item_number"])) {
1155 $disable_wp_chatbot_cart_item_number = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_cart_item_number"]));
1156 }else{ $disable_wp_chatbot_cart_item_number='';}
1157 update_option('disable_wp_chatbot_cart_item_number', wp_unslash($disable_wp_chatbot_cart_item_number));
1158 //Enable /disable featured products button.
1159 if(isset( $_POST["disable_wp_chatbot_featured_product"])) {
1160 $disable_wp_chatbot_featured_product = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_featured_product"]));
1161 }else{ $disable_wp_chatbot_featured_product='';}
1162 update_option('disable_wp_chatbot_featured_product', wp_unslash($disable_wp_chatbot_featured_product));
1163 //Enable /disable sale products button
1164 if(isset( $_POST["disable_wp_chatbot_sale_product"])) {
1165 $disable_wp_chatbot_sale_product = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_sale_product"]));
1166 }else{ $disable_wp_chatbot_sale_product='';}
1167 update_option('disable_wp_chatbot_sale_product', wp_unslash($disable_wp_chatbot_sale_product));
1168 //Enable Product details page.
1169 if(isset( $_POST["wp_chatbot_open_product_detail"])) {
1170 $wp_chatbot_open_product_detail = sanitize_text_field(wp_unslash($_POST["wp_chatbot_open_product_detail"]));
1171 }else{ $wp_chatbot_open_product_detail='';}
1172 update_option('wp_chatbot_open_product_detail', wp_unslash($wp_chatbot_open_product_detail));
1173 //product order and order by
1174 if(isset($_POST['qlcd_wp_chatbot_product_orderby'])){
1175 $qlcd_wp_chatbot_product_orderby = sanitize_text_field(wp_unslash($_POST['qlcd_wp_chatbot_product_orderby']));
1176 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field($qlcd_wp_chatbot_product_orderby));
1177 }
1178 if(isset($_POST['qlcd_wp_chatbot_product_order'])){
1179 $qlcd_wp_chatbot_product_order = sanitize_text_field(wp_unslash($_POST['qlcd_wp_chatbot_product_order']));
1180 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field($qlcd_wp_chatbot_product_order));
1181 }
1182
1183
1184 //Product per page settings.
1185 if (isset($_POST["qlcd_wp_chatbot_ppp"])) {
1186 $qlcd_wp_chatbot_ppp = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_ppp"]));
1187 update_option('qlcd_wp_chatbot_ppp', intval($qlcd_wp_chatbot_ppp));
1188 }
1189 if(isset( $_POST["wp_chatbot_exclude_stock_out_product"])) {
1190 $wp_chatbot_exclude_stock_out_product = sanitize_text_field(wp_unslash($_POST['wp_chatbot_exclude_stock_out_product']));
1191 }else{ $wp_chatbot_exclude_stock_out_product='';}
1192 update_option('wp_chatbot_exclude_stock_out_product', wp_unslash($wp_chatbot_exclude_stock_out_product));
1193 if(isset( $_POST["wp_chatbot_show_parent_category"])) {
1194 $wp_chatbot_show_parent_category = sanitize_text_field(wp_unslash($_POST['wp_chatbot_show_parent_category']));
1195 }else{ $wp_chatbot_show_parent_category='';}
1196 update_option('wp_chatbot_show_parent_category', wp_unslash($wp_chatbot_show_parent_category));
1197 if(isset( $_POST["wp_chatbot_show_sub_category"])) {
1198 $wp_chatbot_show_sub_category = sanitize_text_field(wp_unslash($_POST['wp_chatbot_show_sub_category']));
1199 }else{ $wp_chatbot_show_sub_category='';}
1200 update_option('wp_chatbot_show_sub_category', wp_unslash($wp_chatbot_show_sub_category));
1201 if (isset($_POST["qlcd_wp_chatbot_order_user"])) {
1202 $qlcd_wp_chatbot_order_user = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_order_user"]));
1203 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field($qlcd_wp_chatbot_order_user));
1204 }
1205
1206 if(isset( $_POST["qc_wpbot_menu_order"]) && !empty($_POST["qc_wpbot_menu_order"])) {
1207 $qc_wpbot_menu_order = wp_kses_post(wp_unslash($_POST["qc_wpbot_menu_order"]));
1208 }else{ $qc_wpbot_menu_order='';}
1209 update_option('qc_wpbot_menu_order', ($qc_wpbot_menu_order));
1210
1211 //wpwBot Load control
1212 if(isset($_POST["wp_chatbot_show_home_page"])){
1213 $wp_chatbot_show_home_page = sanitize_key((wp_unslash($_POST["wp_chatbot_show_home_page"])));
1214 update_option('wp_chatbot_show_home_page', $wp_chatbot_show_home_page);
1215 }
1216
1217
1218 if(isset($_POST["wp_chatbot_show_posts"])){
1219 $wp_chatbot_show_posts = sanitize_key((wp_unslash($_POST["wp_chatbot_show_posts"])));
1220 update_option('wp_chatbot_show_posts', $wp_chatbot_show_posts);
1221 }
1222
1223
1224 if(isset($_POST["wp_chatbot_show_pages"])){
1225 $wp_chatbot_show_pages = sanitize_key((wp_unslash($_POST["wp_chatbot_show_pages"])));
1226 update_option('wp_chatbot_show_pages', $wp_chatbot_show_pages);
1227 }
1228
1229 if(isset( $_POST["wp_chatbot_show_pages_list"])) {
1230 $wp_chatbot_show_pages_list = wp_parse_id_list(wp_unslash($_POST["wp_chatbot_show_pages_list"]));
1231 update_option('wp_chatbot_show_pages_list', maybe_serialize(sanitize_array($wp_chatbot_show_pages_list)));
1232 }else{
1233 $wp_chatbot_show_pages_list='';
1234 update_option('wp_chatbot_show_pages_list', maybe_serialize(sanitize_array($wp_chatbot_show_pages_list)));
1235 }
1236 if(isset( $_POST["wp_chatbot_exclude_post_list"])) {
1237 $wp_chatbot_exclude_post_list = wp_unslash($_POST["wp_chatbot_exclude_post_list"]);
1238 update_option('wp_chatbot_exclude_post_list', maybe_serialize(sanitize_array($wp_chatbot_exclude_post_list)));
1239 }else{
1240 $wp_chatbot_exclude_post_list='';
1241 update_option('wp_chatbot_exclude_post_list', maybe_serialize(sanitize_array($wp_chatbot_exclude_post_list)));
1242 }
1243
1244 if(isset($_POST["wp_chatbot_show_wpcommerce"])){
1245 $wp_chatbot_show_wpcommerce = sanitize_key((wp_unslash($_POST["wp_chatbot_show_wpcommerce"])));
1246 update_option('wp_chatbot_show_wpcommerce', $wp_chatbot_show_wpcommerce);
1247 }
1248
1249
1250 //Stop Words Settings
1251 if (isset($_POST["qlcd_wp_chatbot_stop_words_name"])) {
1252 $qlcd_wp_chatbot_stop_words_name = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_stop_words_name"]));
1253 update_option('qlcd_wp_chatbot_stop_words_name', $qlcd_wp_chatbot_stop_words_name);
1254 }
1255 if (isset($_POST["qlcd_wp_chatbot_stop_words"])) {
1256 $qlcd_wp_chatbot_stop_words = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_stop_words"]));
1257 update_option('qlcd_wp_chatbot_stop_words', $qlcd_wp_chatbot_stop_words);
1258 }
1259 //wpwbot icon settings.
1260 $wp_chatbot_icon = isset( $_POST['wp_chatbot_icon'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_icon'])) : 'icon-3.png';
1261 update_option('wp_chatbot_icon', $wp_chatbot_icon);
1262
1263 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_floatingiconbg_color'])) : '#fff';
1264 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
1265
1266 // upload custom wpwbot icon path
1267 $wp_chatbot_custom_icon_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_icon_path']));
1268 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
1269 //Agent image
1270 //wpwbot icon settings.
1271 $wp_chatbot_icon = (isset($_POST['wp_chatbot_agent_image']) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_agent_image'])) : 'agent-13.png');
1272 update_option('wp_chatbot_agent_image', $wp_chatbot_icon);
1273 // upload custom wpwbot icon
1274 if(isset($_POST['wp_chatbot_custom_agent_path'])){
1275 $wp_chatbot_custom_agent_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_agent_path']));
1276 update_option('wp_chatbot_custom_agent_path', $wp_chatbot_custom_agent_path);
1277 }
1278
1279 //Theming
1280 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field(wp_unslash($_POST['qcld_wb_chatbot_theme'])) : 'template-00');
1281 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
1282 //Theme custom background option
1283 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
1284 $qcld_wb_chatbot_change_bg = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_change_bg"]));
1285 }else{$qcld_wb_chatbot_change_bg='';}
1286 update_option('qcld_wb_chatbot_change_bg', $qcld_wb_chatbot_change_bg);
1287 if(isset($_POST["qcld_wb_chatbot_board_bg_path"])){
1288 $qcld_wb_chatbot_board_bg_path = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_board_bg_path"]));
1289 update_option('qcld_wb_chatbot_board_bg_path', wp_unslash($qcld_wb_chatbot_board_bg_path));
1290 }
1291
1292
1293
1294 //To override style use custom css.
1295 if(isset($_POST["wp_chatbot_custom_css"])){
1296 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
1297 update_option('wp_chatbot_custom_css', sanitize_text_field($wp_chatbot_custom_css));
1298 }
1299
1300 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_id"])) {
1301 $qlcd_wp_chatbot_dialogflow_project_id = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_id"]));
1302 } else {
1303 $qlcd_wp_chatbot_dialogflow_project_id = '';
1304 }
1305 update_option('qlcd_wp_chatbot_dialogflow_project_id', $qlcd_wp_chatbot_dialogflow_project_id);
1306
1307 if (isset($_POST["wp_chatbot_df_api"])) {
1308 $wp_chatbot_df_api = sanitize_text_field(wp_unslash($_POST["wp_chatbot_df_api"]));
1309 } else {
1310 $wp_chatbot_df_api = '';
1311 }
1312 update_option('wp_chatbot_df_api', $wp_chatbot_df_api);
1313
1314 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_key"])) {
1315 $qlcd_wp_chatbot_dialogflow_project_key = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_key"]));
1316 } else {
1317 $qlcd_wp_chatbot_dialogflow_project_key = '';
1318 }
1319 update_option('qlcd_wp_chatbot_dialogflow_project_key', $qlcd_wp_chatbot_dialogflow_project_key);
1320
1321 /****Language center settings. ****/
1322 //identity
1323 if (isset($_POST["qlcd_wp_chatbot_host"])) {
1324 $qlcd_wp_chatbot_host = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_host"]));
1325 } else {
1326 $qlcd_wp_chatbot_host = '';
1327 }
1328 update_option('qlcd_wp_chatbot_host', $qlcd_wp_chatbot_host);
1329
1330 if (isset($_POST["qlcd_wp_chatbot_agent"])) {
1331 $qlcd_wp_chatbot_agent = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_agent"]));
1332 } else {
1333 $qlcd_wp_chatbot_agent = '';
1334 }
1335 update_option('qlcd_wp_chatbot_agent', $qlcd_wp_chatbot_agent);
1336
1337 if (isset($_POST["qlcd_wp_chatbot_shopper_demo_name"])) {
1338 $qlcd_wp_chatbot_shopper_demo_name = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_shopper_demo_name"]));
1339 } else {
1340 $qlcd_wp_chatbot_shopper_demo_name = '';
1341 }
1342 update_option('qlcd_wp_chatbot_shopper_demo_name', $qlcd_wp_chatbot_shopper_demo_name);
1343
1344 if (isset($_POST["qlcd_wp_chatbot_yes"])) {
1345 $qlcd_wp_chatbot_yes = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_yes"]));
1346 } else {
1347 $qlcd_wp_chatbot_yes = '';
1348 }
1349 update_option('qlcd_wp_chatbot_yes', $qlcd_wp_chatbot_yes);
1350
1351 if (isset($_POST["qlcd_wp_chatbot_no"])) {
1352 $qlcd_wp_chatbot_no = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_no"]));
1353 } else {
1354 $qlcd_wp_chatbot_no = '';
1355 }
1356 update_option('qlcd_wp_chatbot_no', $qlcd_wp_chatbot_no);
1357
1358 if (isset($_POST["qlcd_wp_chatbot_or"])) {
1359 $qlcd_wp_chatbot_or = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_or"]));
1360 } else {
1361 $qlcd_wp_chatbot_or = '';
1362 }
1363 update_option('qlcd_wp_chatbot_or', $qlcd_wp_chatbot_or);
1364
1365 if (isset($_POST["qlcd_wp_chatbot_sorry"])) {
1366 $qlcd_wp_chatbot_sorry = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sorry"]));
1367 } else {
1368 $qlcd_wp_chatbot_sorry = '';
1369 }
1370 update_option('qlcd_wp_chatbot_sorry', $qlcd_wp_chatbot_sorry);
1371
1372 if (isset($_POST["skip_chat_reactions_menu"])) {
1373 $skip_chat_reactions_menu = sanitize_text_field(wp_unslash($_POST["skip_chat_reactions_menu"]));
1374 } else {
1375 $skip_chat_reactions_menu = '';
1376 }
1377 update_option('skip_chat_reactions_menu', $skip_chat_reactions_menu);
1378
1379 if (isset($_POST["qlcd_wp_chatbot_report_text"])) {
1380 $qlcd_wp_chatbot_report_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_report_text"]));
1381 } else {
1382 $qlcd_wp_chatbot_report_text = '';
1383 }
1384 update_option('qlcd_wp_chatbot_report_text', $qlcd_wp_chatbot_report_text);
1385
1386 if (isset($_POST["qlcd_wp_chatbot_report_text"])) {
1387 $qlcd_wp_chatbot_report_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_report_text"]));
1388 } else {
1389 $qlcd_wp_chatbot_report_text = '';
1390 }
1391 update_option('qlcd_wp_chatbot_report_text', $qlcd_wp_chatbot_report_text);
1392
1393 if (isset($_POST["enable_chat_report_menu"])) {
1394 $enable_chat_report_menu = sanitize_text_field(wp_unslash($_POST["enable_chat_report_menu"]));
1395 } else {
1396 $enable_chat_report_menu = '';
1397 }
1398 update_option('enable_chat_report_menu', $enable_chat_report_menu);
1399
1400 if (isset($_POST["qlcd_wp_chatbot_like_text"])) {
1401 $qlcd_wp_chatbot_like_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_like_text"]));
1402 } else {
1403 $qlcd_wp_chatbot_like_text = '';
1404 }
1405 update_option('qlcd_wp_chatbot_like_text', $qlcd_wp_chatbot_like_text);
1406
1407 if (isset($_POST["qlcd_wp_chatbot_dislike_text"])) {
1408 $qlcd_wp_chatbot_dislike_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dislike_text"]));
1409 } else {
1410 $qlcd_wp_chatbot_dislike_text = '';
1411 }
1412 update_option('qlcd_wp_chatbot_dislike_text', $qlcd_wp_chatbot_dislike_text);
1413
1414 if (isset($_POST["enable_chat_share_menu"])) {
1415 $enable_chat_share_menu = sanitize_text_field(wp_unslash($_POST["enable_chat_share_menu"]));
1416 } else {
1417 $enable_chat_share_menu = '';
1418 }
1419 update_option('enable_chat_share_menu', $enable_chat_share_menu);
1420
1421 if (isset($_POST["qlcd_wp_chatbot_share_text"])) {
1422 $qlcd_wp_chatbot_share_text = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_share_text"]));
1423 } else {
1424 $qlcd_wp_chatbot_share_text = '';
1425 }
1426 update_option('qlcd_wp_chatbot_share_text', $qlcd_wp_chatbot_share_text);
1427
1428 if (isset($_POST["qlcd_wp_chatbot_agent_join"])) {
1429 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1430 $qlcd_wp_chatbot_agent_join = wp_unslash($_POST["qlcd_wp_chatbot_agent_join"]);
1431 $qlcd_wp_chatbot_agent_join = sanitize_array($qlcd_wp_chatbot_agent_join);
1432 } else {
1433 $qlcd_wp_chatbot_agent_join = array();
1434 }
1435 update_option('qlcd_wp_chatbot_agent_join', maybe_serialize($qlcd_wp_chatbot_agent_join));
1436
1437 //Greeting.
1438 if (isset($_POST["qlcd_wp_chatbot_welcome"])) {
1439 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1440 $qlcd_wp_chatbot_welcome = wp_unslash($_POST["qlcd_wp_chatbot_welcome"]);
1441 $qlcd_wp_chatbot_welcome = sanitize_array($qlcd_wp_chatbot_welcome);
1442 } else {
1443 $qlcd_wp_chatbot_welcome = array();
1444 }
1445 update_option('qlcd_wp_chatbot_welcome', maybe_serialize($qlcd_wp_chatbot_welcome));
1446
1447 if (isset($_POST["qlcd_wp_chatbot_back_to_start"])) {
1448 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1449 $qlcd_wp_chatbot_back_to_start = wp_unslash($_POST["qlcd_wp_chatbot_back_to_start"]);
1450 $qlcd_wp_chatbot_back_to_start = sanitize_array($qlcd_wp_chatbot_back_to_start);
1451 } else {
1452 $qlcd_wp_chatbot_back_to_start = array();
1453 }
1454 update_option('qlcd_wp_chatbot_back_to_start', maybe_serialize($qlcd_wp_chatbot_back_to_start));
1455
1456 if (isset($_POST["qlcd_wp_chatbot_hi_there"])) {
1457 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1458 $qlcd_wp_chatbot_hi_there = wp_unslash($_POST["qlcd_wp_chatbot_hi_there"]);
1459 $qlcd_wp_chatbot_hi_there = sanitize_array($qlcd_wp_chatbot_hi_there);
1460 } else {
1461 $qlcd_wp_chatbot_hi_there = array();
1462 }
1463 update_option('qlcd_wp_chatbot_hi_there', maybe_serialize($qlcd_wp_chatbot_hi_there));
1464
1465 if (isset($_POST["qlcd_wp_chatbot_hello"])) {
1466 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1467 $qlcd_wp_chatbot_hello = wp_unslash($_POST["qlcd_wp_chatbot_hello"]);
1468 $qlcd_wp_chatbot_hello = sanitize_array($qlcd_wp_chatbot_hello);
1469 } else {
1470 $qlcd_wp_chatbot_hello = array();
1471 }
1472 update_option('qlcd_wp_chatbot_hello', maybe_serialize($qlcd_wp_chatbot_hello));
1473
1474 if (isset($_POST["qlcd_wp_chatbot_welcome_back"])) {
1475 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1476 $qlcd_wp_chatbot_welcome_back = wp_unslash( $_POST["qlcd_wp_chatbot_welcome_back"] );
1477 $qlcd_wp_chatbot_welcome_back = sanitize_array( $qlcd_wp_chatbot_welcome_back );
1478 } else {
1479 $qlcd_wp_chatbot_welcome_back = array();
1480 }
1481 update_option('qlcd_wp_chatbot_welcome_back', maybe_serialize($qlcd_wp_chatbot_welcome_back));
1482
1483 if (isset($_POST["qlcd_wp_chatbot_asking_name"])) {
1484 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1485 $qlcd_wp_chatbot_asking_name = wp_unslash( $_POST["qlcd_wp_chatbot_asking_name"] );
1486 $qlcd_wp_chatbot_asking_name = sanitize_array( $qlcd_wp_chatbot_asking_name );
1487 } else {
1488 $qlcd_wp_chatbot_asking_name = array();
1489 }
1490 update_option('qlcd_wp_chatbot_asking_name', maybe_serialize($qlcd_wp_chatbot_asking_name));
1491
1492 if (isset($_POST["qlcd_wp_chatbot_name_greeting"])) {
1493 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1494 $qlcd_wp_chatbot_name_greeting = wp_unslash( $_POST["qlcd_wp_chatbot_name_greeting"] );
1495 $qlcd_wp_chatbot_name_greeting = sanitize_array( $qlcd_wp_chatbot_name_greeting );
1496 } else {
1497 $qlcd_wp_chatbot_name_greeting = array();
1498 }
1499 update_option('qlcd_wp_chatbot_name_greeting', maybe_serialize($qlcd_wp_chatbot_name_greeting));
1500
1501 if (isset($_POST["qlcd_wp_chatbot_i_am"])) {
1502 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1503 $qlcd_wp_chatbot_i_am = wp_unslash( $_POST["qlcd_wp_chatbot_i_am"] );
1504 $qlcd_wp_chatbot_i_am = sanitize_array( $qlcd_wp_chatbot_i_am );
1505 } else {
1506 $qlcd_wp_chatbot_i_am = array();
1507 }
1508 update_option('qlcd_wp_chatbot_i_am', maybe_serialize($qlcd_wp_chatbot_i_am));
1509
1510 if (isset($_POST["qlcd_wp_chatbot_is_typing"])) {
1511 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1512 $qlcd_wp_chatbot_is_typing = wp_unslash( $_POST["qlcd_wp_chatbot_is_typing"] );
1513 $qlcd_wp_chatbot_is_typing = sanitize_array( $qlcd_wp_chatbot_is_typing );
1514 } else {
1515 $qlcd_wp_chatbot_is_typing = array();
1516 }
1517 update_option('qlcd_wp_chatbot_is_typing', maybe_serialize($qlcd_wp_chatbot_is_typing));
1518
1519 if (isset($_POST["qlcd_wp_chatbot_send_a_msg"])) {
1520 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1521 $qlcd_wp_chatbot_send_a_msg = wp_unslash( $_POST["qlcd_wp_chatbot_send_a_msg"] );
1522 $qlcd_wp_chatbot_send_a_msg = sanitize_array( $qlcd_wp_chatbot_send_a_msg );
1523 } else {
1524 $qlcd_wp_chatbot_send_a_msg = array();
1525 }
1526 update_option('qlcd_wp_chatbot_send_a_msg', maybe_serialize($qlcd_wp_chatbot_send_a_msg));
1527
1528 if (isset($_POST["qlcd_wp_chatbot_choose_option"])) {
1529 // Assuming 'sanitize_array' is a custom function that properly sanitizes each element of the array.
1530 $qlcd_wp_chatbot_choose_option = wp_unslash( $_POST["qlcd_wp_chatbot_choose_option"] );
1531 $qlcd_wp_chatbot_choose_option = sanitize_array( $qlcd_wp_chatbot_choose_option );
1532 } else {
1533 $qlcd_wp_chatbot_choose_option = array();
1534 }
1535 update_option('qlcd_wp_chatbot_choose_option', maybe_serialize($qlcd_wp_chatbot_choose_option));
1536
1537 if (isset($_POST["qlcd_wp_chatbot_viewed_products"])) {
1538
1539 $qlcd_wp_chatbot_viewed_products = wp_unslash( $_POST["qlcd_wp_chatbot_viewed_products"] );
1540 $qlcd_wp_chatbot_viewed_products = sanitize_array( $qlcd_wp_chatbot_viewed_products );
1541 } else {
1542 $qlcd_wp_chatbot_viewed_products = array();
1543 }
1544 update_option('qlcd_wp_chatbot_viewed_products', maybe_serialize($qlcd_wp_chatbot_viewed_products));
1545
1546 if(isset($_POST["qlcd_wp_chatbot_shopping_cart"])){
1547 $qlcd_wp_chatbot_shopping_cart= esc_html((@wp_unslash($_POST["qlcd_wp_chatbot_shopping_cart"])));
1548 update_option('qlcd_wp_chatbot_shopping_cart', maybe_serialize(sanitize_array($qlcd_wp_chatbot_shopping_cart)));
1549 }
1550
1551 if(isset($_POST["qlcd_wp_chatbot_add_to_cart"])){
1552 $qlcd_wp_chatbot_add_to_cart= (@wp_unslash($_POST["qlcd_wp_chatbot_add_to_cart"]));
1553 update_option('qlcd_wp_chatbot_add_to_cart', maybe_serialize(sanitize_array($qlcd_wp_chatbot_add_to_cart)));
1554 }
1555 if(isset($_POST["qlcd_wp_chatbot_cart_link"])){
1556 $qlcd_wp_chatbot_cart_link= @wp_unslash($_POST["qlcd_wp_chatbot_cart_link"]);
1557 update_option('qlcd_wp_chatbot_cart_link', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_link)));
1558 }
1559 if(isset($_POST["qlcd_wp_chatbot_checkout_link"])){
1560 $qlcd_wp_chatbot_checkout_link= @wp_unslash($_POST["qlcd_wp_chatbot_checkout_link"]);
1561 update_option('qlcd_wp_chatbot_checkout_link', maybe_serialize(sanitize_array($qlcd_wp_chatbot_checkout_link)));
1562 }
1563 if(isset($_POST["qlcd_wp_chatbot_cart_welcome"])){
1564 $qlcd_wp_chatbot_cart_welcome= (@wp_unslash($_POST["qlcd_wp_chatbot_cart_welcome"]));
1565 update_option('qlcd_wp_chatbot_cart_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_welcome)));
1566 }
1567 if(isset($_POST["qlcd_wp_chatbot_featured_product_welcome"])){
1568 $qlcd_wp_chatbot_featured_product_welcome= @wp_unslash($_POST["qlcd_wp_chatbot_featured_product_welcome"]);
1569 update_option('qlcd_wp_chatbot_featured_product_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_featured_product_welcome)));
1570 }
1571
1572 if(isset($_POST["qlcd_wp_chatbot_viewed_product_welcome"])){
1573 $qlcd_wp_chatbot_viewed_product_welcome= @wp_unslash($_POST["qlcd_wp_chatbot_viewed_product_welcome"]);
1574 update_option('qlcd_wp_chatbot_viewed_product_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_viewed_product_welcome)));
1575 }
1576 if(isset($_POST["qlcd_wp_chatbot_latest_product_welcome"])){
1577 $qlcd_wp_chatbot_latest_product_welcome= @wp_unslash($_POST["qlcd_wp_chatbot_latest_product_welcome"]);
1578 update_option('qlcd_wp_chatbot_latest_product_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_latest_product_welcome)));
1579 }
1580
1581 if(isset($_POST["qlcd_wp_chatbot_cart_title"])){
1582 $qlcd_wp_chatbot_cart_title= @wp_unslash($_POST["qlcd_wp_chatbot_cart_title"]);
1583 update_option('qlcd_wp_chatbot_cart_title', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_title)));
1584 }
1585 if(isset($_POST["qlcd_wp_chatbot_cart_quantity"])){
1586 $qlcd_wp_chatbot_cart_quantity= @wp_unslash($_POST["qlcd_wp_chatbot_cart_quantity"]);
1587 update_option('qlcd_wp_chatbot_cart_quantity', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_quantity)));
1588 }
1589 if(isset($_POST["qlcd_wp_chatbot_cart_price"])){
1590 $qlcd_wp_chatbot_cart_price= @wp_unslash($_POST["qlcd_wp_chatbot_cart_price"]);
1591 update_option('qlcd_wp_chatbot_cart_price', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_price)));
1592 }
1593 if(isset($_POST["qlcd_wp_chatbot_no_cart_items"])){
1594 $qlcd_wp_chatbot_no_cart_items= wp_unslash(@$_POST["qlcd_wp_chatbot_no_cart_items"]);
1595 update_option('qlcd_wp_chatbot_no_cart_items', maybe_serialize(sanitize_array($qlcd_wp_chatbot_no_cart_items)));
1596 }
1597 if(isset($_POST["qlcd_wp_chatbot_cart_updating"])){
1598 $qlcd_wp_chatbot_cart_updating= @wp_unslash($_POST["qlcd_wp_chatbot_cart_updating"]);
1599 update_option('qlcd_wp_chatbot_cart_updating', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_updating)));
1600 }
1601 if(isset($_POST["qlcd_wp_chatbot_cart_removing"])){
1602 $qlcd_wp_chatbot_cart_removing= @wp_unslash($_POST["qlcd_wp_chatbot_cart_removing"]);
1603 update_option('qlcd_wp_chatbot_cart_removing', maybe_serialize(sanitize_array($qlcd_wp_chatbot_cart_removing)));
1604 }
1605 //wpwBot wildcard settings
1606 if (isset($_POST["qlcd_wp_chatbot_wildcard_msg"])) {
1607 $qlcd_wp_chatbot_wildcard_msg = wp_unslash( $_POST["qlcd_wp_chatbot_wildcard_msg"] );
1608 $qlcd_wp_chatbot_wildcard_msg = sanitize_array( $qlcd_wp_chatbot_wildcard_msg );
1609
1610 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize($qlcd_wp_chatbot_wildcard_msg));
1611 } else {
1612 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize(array()));
1613 }
1614 //empty filter message repeat.
1615 if (isset($_POST["qlcd_wp_chatbot_empty_filter_msg"])) {
1616 $qlcd_wp_chatbot_empty_filter_msg = wp_unslash( $_POST["qlcd_wp_chatbot_empty_filter_msg"] );
1617 $qlcd_wp_chatbot_empty_filter_msg = sanitize_array( $qlcd_wp_chatbot_empty_filter_msg );
1618
1619 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize($qlcd_wp_chatbot_empty_filter_msg));
1620 } else {
1621 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize(array()));
1622 }
1623
1624 if (isset($_POST["qlcd_wp_chatbot_did_you_mean"])) {
1625 $qlcd_wp_chatbot_did_you_mean = wp_unslash( $_POST["qlcd_wp_chatbot_did_you_mean"] );
1626 $qlcd_wp_chatbot_did_you_mean = sanitize_array( $qlcd_wp_chatbot_did_you_mean );
1627 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize($qlcd_wp_chatbot_did_you_mean));
1628 } else {
1629 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array()));
1630 }
1631 //help welcome and message
1632 if (isset($_POST["qlcd_wp_chatbot_help_welcome"])) {
1633 $qlcd_wp_chatbot_help_welcome = wp_unslash( $_POST["qlcd_wp_chatbot_help_welcome"] );
1634 $qlcd_wp_chatbot_help_welcome = sanitize_array( $qlcd_wp_chatbot_help_welcome );
1635 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize($qlcd_wp_chatbot_help_welcome));
1636 } else {
1637 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize(array()));
1638 }
1639 if (isset($_POST["qlcd_wp_chatbot_help_msg"])) {
1640 $qlcd_wp_chatbot_help_msg = wp_unslash( $_POST["qlcd_wp_chatbot_help_msg"] );
1641 $qlcd_wp_chatbot_help_msg = sanitize_array( $qlcd_wp_chatbot_help_msg );
1642 update_option('qlcd_wp_chatbot_help_msg', maybe_serialize($qlcd_wp_chatbot_help_msg));
1643 } else {
1644 update_option('qlcd_wp_chatbot_help_msg', maybe_serialize(array()));
1645 }
1646 //To clear Conversation history.
1647 if (isset($_POST["qlcd_wp_chatbot_reset"])) {
1648 $qlcd_wp_chatbot_reset = wp_unslash( $_POST["qlcd_wp_chatbot_reset"] );
1649 $qlcd_wp_chatbot_reset = sanitize_array( $qlcd_wp_chatbot_reset );
1650 update_option('qlcd_wp_chatbot_reset', maybe_serialize($qlcd_wp_chatbot_reset));
1651 } else {
1652 update_option('qlcd_wp_chatbot_reset', maybe_serialize(array()));
1653 }
1654 //systems keyword.
1655 if (isset($_POST["qlcd_wp_chatbot_sys_key_help"])) {
1656 $qlcd_wp_chatbot_sys_key_help = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_help"]));
1657 update_option('qlcd_wp_chatbot_sys_key_help', $qlcd_wp_chatbot_sys_key_help);
1658 } else {
1659 update_option('qlcd_wp_chatbot_sys_key_help', '');
1660 }
1661 if(isset($_POST["qlcd_wp_chatbot_sys_key_product"])){
1662 $qlcd_wp_chatbot_sys_key_product = esc_html((@wp_unslash($_POST["qlcd_wp_chatbot_sys_key_product"])));
1663 update_option('qlcd_wp_chatbot_sys_key_product', sanitize_text_field($qlcd_wp_chatbot_sys_key_product));
1664 }
1665 if(isset($_POST["qlcd_wp_chatbot_sys_key_catalog"])){
1666 $qlcd_wp_chatbot_sys_key_catalog = (@wp_unslash($_POST["qlcd_wp_chatbot_sys_key_catalog"]));
1667 update_option('qlcd_wp_chatbot_sys_key_catalog', sanitize_text_field($qlcd_wp_chatbot_sys_key_catalog));
1668 }
1669 if(isset($_POST["qlcd_wp_chatbot_sys_key_order"])){
1670 $qlcd_wp_chatbot_sys_key_order = (@wp_unslash($_POST["qlcd_wp_chatbot_sys_key_order"]));
1671 update_option('qlcd_wp_chatbot_sys_key_order', sanitize_text_field($qlcd_wp_chatbot_sys_key_order));
1672 }
1673 if (isset($_POST["qlcd_wp_chatbot_sys_key_support"])) {
1674 $qlcd_wp_chatbot_sys_key_support = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_support"]));
1675 update_option('qlcd_wp_chatbot_sys_key_support', $qlcd_wp_chatbot_sys_key_support);
1676 } else {
1677 update_option('qlcd_wp_chatbot_sys_key_support', '');
1678 }
1679 if (isset($_POST["qlcd_wp_chatbot_sys_key_reset"])) {
1680 $qlcd_wp_chatbot_sys_key_reset = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_reset"]));
1681 update_option('qlcd_wp_chatbot_sys_key_reset', $qlcd_wp_chatbot_sys_key_reset);
1682 } else {
1683 update_option('qlcd_wp_chatbot_sys_key_reset', '');
1684 }
1685 if (isset($_POST["qlcd_wp_chatbot_sys_key_email"])) {
1686 $qlcd_wp_chatbot_sys_key_email = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_sys_key_email"]));
1687 update_option('qlcd_wp_chatbot_sys_key_email', $qlcd_wp_chatbot_sys_key_email);
1688 } else {
1689 update_option('qlcd_wp_chatbot_sys_key_email', '');
1690 }
1691 if(isset($_POST["qlcd_wp_chatbot_wildcard_product"])){
1692 $qlcd_wp_chatbot_wildcard_product = (@wp_unslash($_POST["qlcd_wp_chatbot_wildcard_product"]));
1693 update_option('qlcd_wp_chatbot_wildcard_product', maybe_serialize(sanitize_array($qlcd_wp_chatbot_wildcard_product)));
1694 }
1695 if(isset($_POST["qlcd_wp_chatbot_wildcard_catalog"])){
1696 $qlcd_wp_chatbot_wildcard_catalog = (@wp_unslash($_POST["qlcd_wp_chatbot_wildcard_catalog"]));
1697 update_option('qlcd_wp_chatbot_wildcard_catalog', maybe_serialize(sanitize_array($qlcd_wp_chatbot_wildcard_catalog)));
1698 }
1699 if(isset($_POST["qlcd_wp_chatbot_featured_products"])){
1700 $qlcd_wp_chatbot_featured_products = (@wp_unslash($_POST["qlcd_wp_chatbot_featured_products"]));
1701 update_option('qlcd_wp_chatbot_featured_products', maybe_serialize(sanitize_array($qlcd_wp_chatbot_featured_products)));
1702 }
1703 if(isset($_POST["qlcd_wp_chatbot_sale_products"])){
1704 $qlcd_wp_chatbot_sale_products = (@wp_unslash($_POST["qlcd_wp_chatbot_sale_products"]));
1705 update_option('qlcd_wp_chatbot_sale_products', maybe_serialize(sanitize_array($qlcd_wp_chatbot_sale_products)));
1706 }
1707
1708 if (isset($_POST["qlcd_wp_chatbot_wildcard_support"])) {
1709 $qlcd_wp_chatbot_wildcard_support = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_wildcard_support"]));
1710 update_option('qlcd_wp_chatbot_wildcard_support', $qlcd_wp_chatbot_wildcard_support);
1711 } else {
1712 update_option('qlcd_wp_chatbot_wildcard_support', '');
1713 }
1714
1715 if (isset($_POST["qlcd_wp_chatbot_wildcard_site_search"])) {
1716 $qlcd_wp_chatbot_wildcard_site_search = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_wildcard_site_search"]));
1717 update_option('qlcd_wp_chatbot_wildcard_site_search', $qlcd_wp_chatbot_wildcard_site_search);
1718 } else {
1719 update_option('qlcd_wp_chatbot_wildcard_site_search', '');
1720 }
1721
1722 if(isset($_POST["qlcd_wp_chatbot_messenger_label"])){
1723 $qlcd_wp_chatbot_messenger_label = (@wp_unslash($_POST["qlcd_wp_chatbot_messenger_label"]));
1724 update_option('qlcd_wp_chatbot_messenger_label', maybe_serialize(sanitize_array($qlcd_wp_chatbot_messenger_label)));
1725 }
1726 //Products search .
1727 if (isset($_POST["qlcd_wp_chatbot_product_success"])) {
1728 // Unslash the input first, then sanitize deeply as text, assuming it's an array of texts or a single text.
1729 $unslashed_data = wp_unslash($_POST["qlcd_wp_chatbot_product_success"]);
1730 $qlcd_wp_chatbot_product_success = map_deep($unslashed_data, 'sanitize_text_field');
1731 update_option('qlcd_wp_chatbot_product_success', maybe_serialize($qlcd_wp_chatbot_product_success));
1732 }
1733 if (isset($_POST["qlcd_wp_chatbot_product_fail"])) {
1734 $qlcd_wp_chatbot_product_fail = @wp_unslash($_POST["qlcd_wp_chatbot_product_fail"]);
1735 update_option('qlcd_wp_chatbot_product_fail', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_fail)));
1736 }
1737 if(isset($_POST["qlcd_wp_chatbot_product_asking"])){
1738 $qlcd_wp_chatbot_product_asking = @wp_unslash($_POST["qlcd_wp_chatbot_product_asking"]);
1739 update_option('qlcd_wp_chatbot_product_asking', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_asking)));
1740 }
1741 if(isset($_POST["qlcd_wp_chatbot_product_suggest"])){
1742 $qlcd_wp_chatbot_product_suggest = @wp_unslash($_POST["qlcd_wp_chatbot_product_suggest"]);
1743 update_option('qlcd_wp_chatbot_product_suggest', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_suggest)));
1744 }
1745 if(isset($_POST["qlcd_wp_chatbot_product_infinite"])){
1746 $qlcd_wp_chatbot_product_infinite = @wp_unslash($_POST["qlcd_wp_chatbot_product_infinite"]);
1747 update_option('qlcd_wp_chatbot_product_infinite', maybe_serialize(sanitize_array($qlcd_wp_chatbot_product_infinite)));
1748 }
1749 if(isset($_POST["qlcd_wp_chatbot_load_more"])){
1750 $qlcd_wp_chatbot_load_more = @wp_unslash($_POST["qlcd_wp_chatbot_load_more"]);
1751 update_option('qlcd_wp_chatbot_load_more', maybe_serialize(sanitize_array($qlcd_wp_chatbot_load_more)));
1752 }
1753 //Order
1754 if(isset($_POST["qlcd_wp_chatbot_wildcard_order"])){
1755 $qlcd_wp_chatbot_wildcard_order = @wp_unslash($_POST["qlcd_wp_chatbot_wildcard_order"]);
1756 update_option('qlcd_wp_chatbot_wildcard_order', maybe_serialize(sanitize_array($qlcd_wp_chatbot_wildcard_order)));
1757 }
1758 if(isset($_POST["qlcd_wp_chatbot_order_welcome"])){
1759 $qlcd_wp_chatbot_order_welcome = @wp_unslash($_POST["qlcd_wp_chatbot_order_welcome"]);
1760 update_option('qlcd_wp_chatbot_order_welcome', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_welcome)));
1761 }
1762 if(isset($_POST["qlcd_wp_chatbot_order_username_asking"])){
1763 $qlcd_wp_chatbot_order_username_asking = @wp_unslash($_POST["qlcd_wp_chatbot_order_username_asking"]);
1764 update_option('qlcd_wp_chatbot_order_username_asking', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_username_asking)));
1765 }
1766 if(isset($_POST["qlcd_wp_chatbot_order_username_not_exist"])){
1767 $qlcd_wp_chatbot_order_username_not_exist = @wp_unslash($_POST["qlcd_wp_chatbot_order_username_not_exist"]);
1768 update_option('qlcd_wp_chatbot_order_username_not_exist', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_username_not_exist)));
1769 }
1770 if (isset($_POST["qlcd_wp_chatbot_order_username_thanks"])) {
1771 // Unslash the input first, then sanitize deeply as text, assuming it's an array of texts or a single text.
1772 $unslashed_data = wp_unslash($_POST["qlcd_wp_chatbot_order_username_thanks"]);
1773 $qlcd_wp_chatbot_order_username_thanks = map_deep($unslashed_data, 'sanitize_text_field');
1774 update_option('qlcd_wp_chatbot_order_username_thanks', maybe_serialize($qlcd_wp_chatbot_order_username_thanks));
1775 }
1776 if(isset($_POST["qlcd_wp_chatbot_order_username_password"])){
1777 $qlcd_wp_chatbot_order_username_password = @wp_unslash($_POST["qlcd_wp_chatbot_order_username_password"]);
1778 update_option('qlcd_wp_chatbot_order_username_password', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_username_password)));
1779 }
1780 if(isset($_POST["qlcd_wp_chatbot_order_password_incorrect"])){
1781 $qlcd_wp_chatbot_order_password_incorrect= @wp_unslash($_POST["qlcd_wp_chatbot_order_password_incorrect"]);
1782 update_option('qlcd_wp_chatbot_order_password_incorrect', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_password_incorrect)));
1783 }
1784 if(isset($_POST["qlcd_wp_chatbot_order_not_found"])){
1785 $qlcd_wp_chatbot_order_not_found= @wp_unslash($_POST["qlcd_wp_chatbot_order_not_found"]);
1786 update_option('qlcd_wp_chatbot_order_not_found', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_not_found)));
1787 }
1788 if(isset($_POST["qlcd_wp_chatbot_order_found"])){
1789 $qlcd_wp_chatbot_order_found= @wp_unslash($_POST["qlcd_wp_chatbot_order_found"]);
1790 update_option('qlcd_wp_chatbot_order_found', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_found)));
1791 }
1792 if(isset( $_POST["qlcd_wp_chatbot_order_email_support"])){
1793 $qlcd_wp_chatbot_order_email_support= @wp_unslash($_POST["qlcd_wp_chatbot_order_email_support"]);
1794 update_option('qlcd_wp_chatbot_order_email_support', maybe_serialize(sanitize_array($qlcd_wp_chatbot_order_email_support)));
1795 }
1796 //Support
1797 if (isset($_POST["qlcd_wp_chatbot_support_welcome"])) {
1798 $qlcd_wp_chatbot_support_welcome = wp_unslash($_POST["qlcd_wp_chatbot_support_welcome"]);
1799 $qlcd_wp_chatbot_support_welcome = sanitize_array($qlcd_wp_chatbot_support_welcome);
1800 update_option('qlcd_wp_chatbot_support_welcome', maybe_serialize($qlcd_wp_chatbot_support_welcome));
1801 }
1802 if (isset($_POST["qlcd_wp_chatbot_support_email"])) {
1803 $qlcd_wp_chatbot_support_email = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_support_email"]));
1804 update_option('qlcd_wp_chatbot_support_email', $qlcd_wp_chatbot_support_email);
1805 }
1806 if (isset($_POST["qlcd_wp_chatbot_asking_email"])) {
1807 $qlcd_wp_chatbot_asking_email = wp_unslash($_POST["qlcd_wp_chatbot_asking_email"]);
1808 $qlcd_wp_chatbot_asking_email = sanitize_array($qlcd_wp_chatbot_asking_email);
1809 update_option('qlcd_wp_chatbot_asking_email', maybe_serialize($qlcd_wp_chatbot_asking_email));
1810 }
1811 if (isset($_POST["qlcd_wp_chatbot_asking_msg"])) {
1812 $qlcd_wp_chatbot_asking_msg = wp_unslash($_POST["qlcd_wp_chatbot_asking_msg"]);
1813 $qlcd_wp_chatbot_asking_msg = sanitize_array($qlcd_wp_chatbot_asking_msg);
1814 update_option('qlcd_wp_chatbot_asking_msg', maybe_serialize($qlcd_wp_chatbot_asking_msg));
1815 }
1816
1817 if(isset($_POST["qlcd_wp_chatbot_no_result"])){
1818 $qlcd_wp_chatbot_no_result = @wp_unslash($_POST["qlcd_wp_chatbot_no_result"]);
1819 update_option('qlcd_wp_chatbot_no_result', maybe_serialize(sanitize_array($qlcd_wp_chatbot_no_result)));
1820 }
1821
1822 if (isset($_POST["qlcd_wp_chatbot_support_option_again"])) {
1823 $qlcd_wp_chatbot_support_option_again = wp_unslash($_POST["qlcd_wp_chatbot_support_option_again"]);
1824 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize(sanitize_array($qlcd_wp_chatbot_support_option_again)));
1825 } else {
1826 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize(array()));
1827 }
1828
1829 if (isset($_POST["qlcd_wp_chatbot_invalid_email"])) {
1830 $qlcd_wp_chatbot_invalid_email = wp_unslash($_POST["qlcd_wp_chatbot_invalid_email"]);
1831 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize(sanitize_array($qlcd_wp_chatbot_invalid_email)));
1832 } else {
1833 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize(array()));
1834 }
1835
1836 if (isset($_POST["qlcd_wp_chatbot_support_phone"])) {
1837 $qlcd_wp_chatbot_support_phone = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_support_phone"]));
1838 update_option('qlcd_wp_chatbot_support_phone', $qlcd_wp_chatbot_support_phone);
1839 } else {
1840 update_option('qlcd_wp_chatbot_support_phone', '');
1841 }
1842
1843 if (isset($_POST["qlcd_wp_chatbot_asking_phone"])) {
1844 $qlcd_wp_chatbot_asking_phone = wp_unslash($_POST["qlcd_wp_chatbot_asking_phone"]);
1845 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize(sanitize_array($qlcd_wp_chatbot_asking_phone)));
1846 } else {
1847 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize(array()));
1848 }
1849
1850 if (isset($_POST["qlcd_wp_chatbot_thank_for_phone"])) {
1851 $qlcd_wp_chatbot_thank_for_phone = wp_unslash($_POST["qlcd_wp_chatbot_thank_for_phone"]);
1852 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize(sanitize_array($qlcd_wp_chatbot_thank_for_phone)));
1853 } else {
1854 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize(array()));
1855 }
1856
1857 if (isset($_POST["qlcd_wp_chatbot_admin_email"])) {
1858 $qlcd_wp_chatbot_admin_email = sanitize_email(wp_unslash($_POST["qlcd_wp_chatbot_admin_email"]));
1859 } else {
1860 $qlcd_wp_chatbot_admin_email = '';
1861 }
1862
1863 update_option('qlcd_wp_chatbot_admin_email', $qlcd_wp_chatbot_admin_email);
1864
1865 // Sanitize early for qlcd_wp_chatbot_email_sub
1866 $qlcd_wp_chatbot_email_sub = '';
1867 if (isset($_POST["qlcd_wp_chatbot_email_sub"])) {
1868 $qlcd_wp_chatbot_email_sub = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_email_sub"]));
1869 }
1870 update_option('qlcd_wp_chatbot_email_sub', $qlcd_wp_chatbot_email_sub);
1871
1872 // Sanitize early for qlcd_wp_site_search, only update if set
1873 if (isset($_POST["qlcd_wp_site_search"])) {
1874 $qlcd_wp_site_search = sanitize_text_field(wp_unslash($_POST["qlcd_wp_site_search"]));
1875 update_option('qlcd_wp_site_search', $qlcd_wp_site_search);
1876 }
1877
1878 // Sanitize early for qlcd_wp_chatbot_email_sent
1879 $qlcd_wp_chatbot_email_sent = '';
1880 if (isset($_POST["qlcd_wp_chatbot_email_sent"])) {
1881 $qlcd_wp_chatbot_email_sent = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_email_sent"]));
1882 }
1883 update_option('qlcd_wp_chatbot_email_sent', $qlcd_wp_chatbot_email_sent);
1884
1885 // Sanitize early for qlcd_wp_chatbot_email_fail
1886 $qlcd_wp_chatbot_email_fail = '';
1887 if (isset($_POST["qlcd_wp_chatbot_email_fail"])) {
1888 $qlcd_wp_chatbot_email_fail = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_email_fail"]));
1889 }
1890 update_option('qlcd_wp_chatbot_email_fail', $qlcd_wp_chatbot_email_fail);
1891
1892 // Sanitize early for qlcd_wp_chatbot_relevant_post_link_openai
1893 $qlcd_wp_chatbot_relevant_post_link_openai = '';
1894 if (isset($_POST["qlcd_wp_chatbot_relevant_post_link_openai"])) {
1895 $qlcd_wp_chatbot_relevant_post_link_openai = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_relevant_post_link_openai"]));
1896 }
1897 update_option('qlcd_wp_chatbot_relevant_post_link_openai', $qlcd_wp_chatbot_relevant_post_link_openai);
1898 //Notifications messages building.
1899 if (isset($_POST["qlcd_wp_chatbot_notification_interval"])) {
1900 $qlcd_wp_chatbot_notification_interval = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_notification_interval"]));
1901 update_option('qlcd_wp_chatbot_notification_interval', $qlcd_wp_chatbot_notification_interval);
1902 }
1903
1904 if(isset($_POST["qlcd_wp_chatbot_notifications"])){
1905 $qlcd_wp_chatbot_notifications = @wp_unslash($_POST["qlcd_wp_chatbot_notifications"]);
1906 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(sanitize_array($qlcd_wp_chatbot_notifications)));
1907 }
1908 //Support building part.
1909
1910 $allowed_html = array(
1911 'a' => array(
1912 'href' => array(),
1913 'title' => array()
1914 ),
1915 'br' => array(),
1916 'em' => array(),
1917 'strong' => array(),
1918 );
1919 $support_query = @wp_unslash($_POST["support_query"]);
1920 $clean_support_query = [];
1921 if(!empty($support_query)){
1922 foreach($support_query as $key => $val) {
1923
1924 $clean_support_query[wp_kses($key,$allowed_html)] = wp_kses($val,$allowed_html);
1925 }
1926 }
1927 update_option('support_query', (maybe_serialize($clean_support_query)));
1928 $support_ans = @wp_unslash($_POST["support_ans"]);
1929 $clean_support_ans = [];
1930 if(!empty($support_query)){
1931 foreach($support_ans as $key => $val) {
1932 $clean_support_ans[wp_kses($key,$allowed_html)] = wp_kses($val,$allowed_html);
1933 }
1934 }
1935 update_option('support_ans', (maybe_serialize($clean_support_ans)));
1936 //Create Mobile app pages.
1937 if(isset( $_POST["wp_chatbot_app_pages"])) {
1938 $wp_chatbot_app_pages = wp_unslash($_POST["wp_chatbot_app_pages"]);
1939 }else{ $wp_chatbot_app_pages='';}
1940 update_option('wp_chatbot_app_pages', wp_unslash($wp_chatbot_app_pages));
1941 //Messenger Options
1942 if(isset( $_POST["enable_wp_chatbot_messenger"])) {
1943 $enable_wp_chatbot_messenger = wp_unslash($_POST["enable_wp_chatbot_messenger"]);
1944 }else{ $enable_wp_chatbot_messenger='';}
1945 update_option('enable_wp_chatbot_messenger', wp_unslash($enable_wp_chatbot_messenger));
1946 if(isset( $_POST["enable_wp_chatbot_messenger_floating_icon"])) {
1947 $enable_wp_chatbot_messenger_floating_icon = wp_unslash($_POST["enable_wp_chatbot_messenger_floating_icon"]);
1948 }else{ $enable_wp_chatbot_messenger_floating_icon='';}
1949 update_option('enable_wp_chatbot_messenger_floating_icon', wp_unslash($enable_wp_chatbot_messenger_floating_icon));
1950 if(isset($_POST["qlcd_wp_chatbot_fb_app_id"])){
1951 $qlcd_wp_chatbot_fb_app_id = @wp_unslash($_POST["qlcd_wp_chatbot_fb_app_id"]);
1952 update_option('qlcd_wp_chatbot_fb_app_id', sanitize_text_field($qlcd_wp_chatbot_fb_app_id));
1953 }
1954 if(isset($_POST["qlcd_wp_chatbot_fb_page_id"])){
1955 $qlcd_wp_chatbot_fb_page_id = @wp_unslash($_POST["qlcd_wp_chatbot_fb_page_id"]);
1956 update_option('qlcd_wp_chatbot_fb_page_id', sanitize_text_field($qlcd_wp_chatbot_fb_page_id));
1957 }
1958 if(isset($_POST["qlcd_wp_chatbot_fb_color"])){
1959 $qlcd_wp_chatbot_fb_color= @wp_unslash($_POST["qlcd_wp_chatbot_fb_color"]);
1960 update_option('qlcd_wp_chatbot_fb_color', wp_unslash($qlcd_wp_chatbot_fb_color));
1961 }
1962 if(isset($_POST["qlcd_wp_chatbot_fb_in_msg"])){
1963 $qlcd_wp_chatbot_fb_in_msg = @wp_unslash($_POST["qlcd_wp_chatbot_fb_in_msg"]);
1964 update_option('qlcd_wp_chatbot_fb_in_msg', stripslashes(sanitize_text_field($qlcd_wp_chatbot_fb_in_msg)));
1965 }
1966 if(isset($_POST["qlcd_wp_chatbot_fb_out_msg"])){
1967 $qlcd_wp_chatbot_fb_out_msg = @wp_unslash($_POST["qlcd_wp_chatbot_fb_out_msg"]);
1968 update_option('qlcd_wp_chatbot_fb_out_msg', stripslashes(sanitize_text_field($qlcd_wp_chatbot_fb_out_msg)));
1969 }
1970 //Skype option
1971 if(isset( $_POST["enable_wp_chatbot_skype_floating_icon"])) {
1972 $enable_wp_chatbot_skype_floating_icon = wp_unslash($_POST["enable_wp_chatbot_skype_floating_icon"]);
1973 }else{ $enable_wp_chatbot_skype_floating_icon='';}
1974 update_option('enable_wp_chatbot_skype_floating_icon', sanitize_text_field($enable_wp_chatbot_skype_floating_icon));
1975 if(isset( $_POST["enable_wp_chatbot_skype_id"])) {
1976 $enable_wp_chatbot_skype_id = wp_unslash($_POST["enable_wp_chatbot_skype_id"]);
1977 }else{ $enable_wp_chatbot_skype_id='';}
1978 update_option('enable_wp_chatbot_skype_id', sanitize_text_field($enable_wp_chatbot_skype_id));
1979 //WhatsApp
1980 if(isset( $_POST["enable_wp_chatbot_whats"])) {
1981 $enable_wp_chatbot_whats= wp_unslash($_POST["enable_wp_chatbot_whats"]);
1982 }else{ $enable_wp_chatbot_whats='';}
1983 update_option('enable_wp_chatbot_whats', sanitize_text_field($enable_wp_chatbot_whats));
1984 if(isset($_POST["qlcd_wp_chatbot_whats_label"])){
1985 $qlcd_wp_chatbot_whats_label = @wp_unslash($_POST["qlcd_wp_chatbot_whats_label"]);
1986 update_option('qlcd_wp_chatbot_whats_label', maybe_serialize(sanitize_array($qlcd_wp_chatbot_whats_label)));
1987 }
1988 if(isset( $_POST["enable_wp_chatbot_floating_whats"])) {
1989 $enable_wp_chatbot_floating_whats= wp_unslash($_POST["enable_wp_chatbot_floating_whats"]);
1990 }else{ $enable_wp_chatbot_floating_whats='';}
1991 update_option('enable_wp_chatbot_floating_whats', sanitize_text_field($enable_wp_chatbot_floating_whats));
1992 if(isset($_POST["qlcd_wp_chatbot_whats_num"])){
1993 $qlcd_wp_chatbot_whats_num = @wp_unslash($_POST["qlcd_wp_chatbot_whats_num"]);
1994 update_option('qlcd_wp_chatbot_whats_num', sanitize_text_field($qlcd_wp_chatbot_whats_num));
1995 }
1996 //Viber
1997 if(isset( $_POST["enable_wp_chatbot_floating_viber"])) {
1998 $enable_wp_chatbot_floating_viber = wp_unslash($_POST["enable_wp_chatbot_floating_viber"]);
1999 }else{ $enable_wp_chatbot_floating_viber='';}
2000 update_option('enable_wp_chatbot_floating_viber', sanitize_text_field($enable_wp_chatbot_floating_viber));
2001 if(isset($_POST["qlcd_wp_chatbot_viber_acc"])){
2002 $qlcd_wp_chatbot_viber_acc = @wp_unslash($_POST["qlcd_wp_chatbot_viber_acc"]);
2003 update_option('qlcd_wp_chatbot_viber_acc', sanitize_text_field($qlcd_wp_chatbot_viber_acc));
2004 }
2005 //Others integration
2006 if(isset( $_POST["enable_wp_chatbot_floating_phone"])) {
2007 $enable_wp_chatbot_floating_phone = wp_unslash($_POST["enable_wp_chatbot_floating_phone"]);
2008 }else{ $enable_wp_chatbot_floating_phone='';}
2009 update_option('enable_wp_chatbot_floating_phone', sanitize_text_field($enable_wp_chatbot_floating_phone));
2010 if(isset($_POST["qlcd_wp_chatbot_phone"])){
2011 $qlcd_wp_chatbot_phone = @wp_unslash($_POST["qlcd_wp_chatbot_phone"]);
2012 update_option('qlcd_wp_chatbot_phone', sanitize_text_field($qlcd_wp_chatbot_phone));
2013 }
2014
2015 if(isset( $_POST["enable_wp_chatbot_floating_link"])) {
2016 $enable_wp_chatbot_floating_link = wp_unslash($_POST["enable_wp_chatbot_floating_link"]);
2017 }else{ $enable_wp_chatbot_floating_link='';}
2018 update_option('enable_wp_chatbot_floating_link', sanitize_text_field($enable_wp_chatbot_floating_link));
2019 if(isset($_POST["qlcd_wp_chatbot_weblink"])){
2020 $qlcd_wp_chatbot_weblink = @wp_unslash($_POST["qlcd_wp_chatbot_weblink"]);
2021 update_option('qlcd_wp_chatbot_weblink', sanitize_text_field($qlcd_wp_chatbot_weblink));
2022 }
2023
2024 //Re Targetting.
2025 if(isset($_POST["qlcd_wp_chatbot_ret_greet"])){
2026 $qlcd_wp_chatbot_ret_greet = @wp_unslash($_POST["qlcd_wp_chatbot_ret_greet"]);
2027 update_option('qlcd_wp_chatbot_ret_greet', sanitize_text_field($qlcd_wp_chatbot_ret_greet));
2028 }
2029
2030 if(isset( $_POST["enable_wp_chatbot_exit_intent"])) {
2031 $enable_wp_chatbot_exit_intent = wp_unslash($_POST["enable_wp_chatbot_exit_intent"]);
2032 }else{ $enable_wp_chatbot_exit_intent='';}
2033 update_option('enable_wp_chatbot_exit_intent', sanitize_text_field($enable_wp_chatbot_exit_intent));
2034
2035 if(isset($_POST["wp_chatbot_exit_intent_msg"])){
2036 $wp_chatbot_exit_intent_msg = @wp_unslash($_POST["wp_chatbot_exit_intent_msg"]);
2037 update_option('wp_chatbot_exit_intent_msg', wp_unslash($wp_chatbot_exit_intent_msg));
2038 }
2039
2040 if(isset( $_POST["wp_chatbot_exit_intent_once"])) {
2041 $wp_chatbot_exit_intent_once = wp_unslash($_POST["wp_chatbot_exit_intent_once"]);
2042 }else{ $wp_chatbot_exit_intent_once='';}
2043 update_option('wp_chatbot_exit_intent_once', sanitize_text_field($wp_chatbot_exit_intent_once));
2044
2045 if(isset( $_POST["enable_wp_chatbot_scroll_open"])) {
2046 $enable_wp_chatbot_scroll_open = wp_unslash($_POST["enable_wp_chatbot_scroll_open"]);
2047 }else{ $enable_wp_chatbot_scroll_open='';}
2048 update_option('enable_wp_chatbot_scroll_open', sanitize_text_field($enable_wp_chatbot_scroll_open));
2049
2050 if(isset($_POST["wp_chatbot_scroll_open_msg"])){
2051 $wp_chatbot_scroll_open_msg= @wp_unslash($_POST["wp_chatbot_scroll_open_msg"]);
2052 update_option('wp_chatbot_scroll_open_msg', wp_unslash($wp_chatbot_scroll_open_msg));
2053 }
2054
2055 if(isset($_POST["wp_chatbot_scroll_percent"])){
2056 $wp_chatbot_scroll_percent= @wp_unslash($_POST["wp_chatbot_scroll_percent"]);
2057 update_option('wp_chatbot_scroll_percent', wp_unslash($wp_chatbot_scroll_percent));
2058 }
2059
2060 if(isset( $_POST["wp_chatbot_scroll_once"])) {
2061 $wp_chatbot_scroll_once = sanitize_text_field(wp_unslash($_POST["wp_chatbot_scroll_once"]));
2062 }else{ $wp_chatbot_scroll_once='';}
2063 update_option('wp_chatbot_scroll_once', $wp_chatbot_scroll_once);
2064
2065 if(isset( $_POST["enable_wp_chatbot_auto_open"])) {
2066 $enable_wp_chatbot_auto_open = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_auto_open"]));
2067 }else{ $enable_wp_chatbot_auto_open='';}
2068 update_option('enable_wp_chatbot_auto_open', $enable_wp_chatbot_auto_open);
2069
2070 if(isset( $_POST["enable_wp_chatbot_ret_sound"])) {
2071 $enable_wp_chatbot_ret_sound = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_ret_sound"]));
2072 }else{ $enable_wp_chatbot_ret_sound='';}
2073 update_option('enable_wp_chatbot_ret_sound', $enable_wp_chatbot_ret_sound);
2074
2075 if(isset( $_POST["enable_wp_chatbot_sound_initial"])) {
2076 $enable_wp_chatbot_sound_initial = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_sound_initial"]));
2077 }else{ $enable_wp_chatbot_sound_initial='';}
2078 update_option('enable_wp_chatbot_sound_initial', $enable_wp_chatbot_sound_initial);
2079
2080
2081 if(isset($_POST["wp_chatbot_auto_open_msg"])){
2082 $wp_chatbot_auto_open_msg = @wp_unslash($_POST["wp_chatbot_auto_open_msg"]);
2083 update_option('wp_chatbot_auto_open_msg', wp_unslash($wp_chatbot_auto_open_msg));
2084 }
2085
2086 if(isset($_POST["wp_chatbot_auto_open_time"])){
2087 $wp_chatbot_auto_open_time = @wp_unslash($_POST["wp_chatbot_auto_open_time"]);
2088 update_option('wp_chatbot_auto_open_time', wp_unslash($wp_chatbot_auto_open_time));
2089 }
2090 //to complate checkout.
2091 if(isset( $_POST["enable_wp_chatbot_ret_user_show"])) {
2092 $enable_wp_chatbot_ret_user_show = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_ret_user_show"]));
2093 }else{ $enable_wp_chatbot_ret_user_show='';}
2094 update_option('enable_wp_chatbot_ret_user_show', $enable_wp_chatbot_ret_user_show);
2095
2096 if(isset( $_POST["enable_wp_chatbot_inactive_time_show"])) {
2097 $enable_wp_chatbot_inactive_time_show = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_inactive_time_show"]));
2098 }else{ $enable_wp_chatbot_inactive_time_show='';}
2099 update_option('enable_wp_chatbot_inactive_time_show', $enable_wp_chatbot_inactive_time_show);
2100
2101 if(isset($_POST["wp_chatbot_inactive_time"])){
2102 $wp_chatbot_inactive_time = @wp_unslash($_POST["wp_chatbot_inactive_time"]);
2103 update_option('wp_chatbot_inactive_time', sanitize_text_field($wp_chatbot_inactive_time));
2104 }
2105
2106 if(isset($_POST["wp_chatbot_checkout_msg"])){
2107 $wp_chatbot_checkout_msg = @wp_unslash($_POST["wp_chatbot_checkout_msg"]);
2108 update_option('wp_chatbot_checkout_msg', wp_unslash($wp_chatbot_checkout_msg));
2109 }
2110
2111 if(isset( $_POST["wp_chatbot_auto_open_once"])) {
2112 $wp_chatbot_auto_open_once = sanitize_text_field(wp_unslash($_POST["wp_chatbot_auto_open_once"]));
2113 }else{ $wp_chatbot_auto_open_once='';}
2114 update_option('wp_chatbot_auto_open_once', $wp_chatbot_auto_open_once);
2115
2116 if(isset( $_POST["wp_chatbot_inactive_once"])) {
2117 $wp_chatbot_inactive_once = sanitize_text_field(wp_unslash($_POST["wp_chatbot_inactive_once"]));
2118 }else{ $wp_chatbot_inactive_once='';}
2119 update_option('wp_chatbot_inactive_once', $wp_chatbot_inactive_once);
2120
2121
2122 if(isset($_POST["wp_chatbot_proactive_bg_color"])){
2123 $wp_chatbot_proactive_bg_color = @wp_unslash($_POST["wp_chatbot_proactive_bg_color"]);
2124 update_option('wp_chatbot_proactive_bg_color', sanitize_text_field($wp_chatbot_proactive_bg_color));
2125 }
2126
2127 if(isset( $_POST["disable_wp_chatbot_call_gen"])) {
2128 $disable_wp_chatbot_call_gen = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_call_gen"]));
2129 }else{ $disable_wp_chatbot_call_gen='';}
2130 update_option('disable_wp_chatbot_call_gen', $disable_wp_chatbot_call_gen);
2131
2132 if(isset( $_POST["disable_wp_chatbot_site_search"])) {
2133 $disable_wp_chatbot_site_search = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_site_search"]));
2134 update_option('enable_wp_chatbot_post_content', '');
2135 }else{ $disable_wp_chatbot_site_search='';}
2136 update_option('disable_wp_chatbot_site_search', $disable_wp_chatbot_site_search);
2137
2138 if(isset( $_POST["enable_wp_chatbot_post_content"])) {
2139 $enable_wp_chatbot_post_content = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_post_content"]));
2140
2141 }else{ $enable_wp_chatbot_post_content='';}
2142 update_option('enable_wp_chatbot_post_content', $enable_wp_chatbot_post_content);
2143
2144 if(isset( $_POST["disable_wp_chatbot_call_sup"])) {
2145 $disable_wp_chatbot_call_sup = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_call_sup"]));
2146 }else{ $disable_wp_chatbot_call_sup='';}
2147 update_option('disable_wp_chatbot_call_sup', $disable_wp_chatbot_call_sup);
2148
2149 if(isset( $_POST["disable_wp_chatbot_feedback"])) {
2150 $disable_wp_chatbot_feedback = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_feedback"]));
2151 }else{ $disable_wp_chatbot_feedback='';}
2152 update_option('disable_wp_chatbot_feedback', $disable_wp_chatbot_feedback);
2153
2154 if(isset( $_POST["disable_wp_chatbot_faq"])) {
2155 $disable_wp_chatbot_faq = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot_faq"]));
2156 }else{ $disable_wp_chatbot_faq='';}
2157 update_option('disable_wp_chatbot_faq', $disable_wp_chatbot_faq);
2158
2159 if(isset($_POST["qlcd_wp_chatbot_feedback_label"])){
2160 $qlcd_wp_chatbot_feedback_label = (@wp_unslash($_POST["qlcd_wp_chatbot_feedback_label"]));
2161 update_option('qlcd_wp_chatbot_feedback_label', maybe_serialize(sanitize_array($qlcd_wp_chatbot_feedback_label)));
2162 }
2163
2164 if(isset( $_POST["enable_wp_chatbot_meta_title"])) {
2165 $enable_wp_chatbot_meta_title = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_meta_title"]));
2166 }else{ $enable_wp_chatbot_meta_title='';}
2167 update_option('enable_wp_chatbot_meta_title', $enable_wp_chatbot_meta_title);
2168
2169 if(isset($_POST["qlcd_wp_chatbot_meta_label"])){
2170 $qlcd_wp_chatbot_meta_label = esc_html(@wp_unslash($_POST["qlcd_wp_chatbot_meta_label"]));
2171 update_option('qlcd_wp_chatbot_meta_label', stripslashes(sanitize_text_field($qlcd_wp_chatbot_meta_label)));
2172 }
2173
2174 if (isset($_POST["qlcd_wp_chatbot_phone_sent"])) {
2175 $qlcd_wp_chatbot_phone_sent = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_phone_sent"]));
2176 update_option('qlcd_wp_chatbot_phone_sent', $qlcd_wp_chatbot_phone_sent);
2177 }
2178
2179 if (isset($_POST["qlcd_wp_chatbot_phone_fail"])) {
2180 $qlcd_wp_chatbot_phone_fail = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_phone_fail"]));
2181 update_option('qlcd_wp_chatbot_phone_fail', $qlcd_wp_chatbot_phone_fail);
2182 }
2183
2184 if (isset($_POST["qlcd_wp_chatbot_asking_search_keyword"])) {
2185 $qlcd_wp_chatbot_asking_search_keyword = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_asking_search_keyword"]));
2186 update_option('qlcd_wp_chatbot_asking_search_keyword', $qlcd_wp_chatbot_asking_search_keyword);
2187 }
2188
2189 if (isset($_POST["qlcd_wp_chatbot_found_result"])) {
2190 $qlcd_wp_chatbot_found_result = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_found_result"]));
2191 update_option('qlcd_wp_chatbot_found_result', $qlcd_wp_chatbot_found_result);
2192 }
2193
2194 if(isset( $_POST["enable_wp_chatbot_opening_hour"])) {
2195 $enable_wp_chatbot_opening_hour = stripslashes(sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_opening_hour"])));
2196 }else{ $enable_wp_chatbot_opening_hour='';}
2197 update_option('enable_wp_chatbot_opening_hour', esc_html($enable_wp_chatbot_opening_hour));
2198
2199 if(isset($_POST["wpwbot_hours"])){
2200 $wpwbot_hours= @wp_unslash($_POST["wpwbot_hours"]);
2201 update_option('wpwbot_hours', maybe_serialize(sanitize_array($wpwbot_hours)));
2202 }
2203
2204 if(isset( $_POST["enable_wp_chatbot_dailogflow"])) {
2205 $enable_wp_chatbot_dailogflow = stripslashes(sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_dailogflow"])));
2206 }else{ $enable_wp_chatbot_dailogflow='';}
2207 update_option('enable_wp_chatbot_dailogflow', $enable_wp_chatbot_dailogflow);
2208
2209 if(isset($_POST["qlcd_wp_chatbot_dialogflow_client_token"])){
2210 $qlcd_wp_chatbot_dialogflow_client_token= esc_html(@wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_client_token"]));
2211 update_option('qlcd_wp_chatbot_dialogflow_client_token', stripslashes(sanitize_text_field($qlcd_wp_chatbot_dialogflow_client_token)));
2212 }
2213
2214 if (isset($_POST["qlcd_wp_chatbot_dialogflow_defualt_reply"])) {
2215 $qlcd_wp_chatbot_dialogflow_defualt_reply = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_defualt_reply"]));
2216 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', $qlcd_wp_chatbot_dialogflow_defualt_reply);
2217 }
2218
2219 if (isset($_POST["qlcd_wp_chatbot_dialogflow_agent_language"])) {
2220 $qlcd_wp_chatbot_dialogflow_agent_language = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_agent_language"]));
2221 update_option('qlcd_wp_chatbot_dialogflow_agent_language', $qlcd_wp_chatbot_dialogflow_agent_language);
2222 }
2223 // style option save.
2224 if(isset( $_POST["enable_wp_chatbot_custom_color"])) {
2225 $enable_wp_chatbot_custom_color = esc_html(wp_unslash($_POST["enable_wp_chatbot_custom_color"]));
2226 }else{ $enable_wp_chatbot_custom_color='';}
2227 update_option('enable_wp_chatbot_custom_color', stripslashes(sanitize_text_field($enable_wp_chatbot_custom_color)));
2228 if (isset($_POST["wp_chatbot_text_color"])) {
2229 $wp_chatbot_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_text_color"]));
2230 update_option('wp_chatbot_text_color', $wp_chatbot_text_color);
2231 }
2232
2233 if (isset($_POST["wp_chatbot_floatingiconbg_color"])) {
2234 $wp_chatbot_floatingiconbg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_floatingiconbg_color"]));
2235 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
2236 }
2237
2238 if (isset($_POST["wp_chatbot_link_color"])) {
2239 $wp_chatbot_link_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_link_color"]));
2240 update_option('wp_chatbot_link_color', $wp_chatbot_link_color);
2241 }
2242
2243 if (isset($_POST["wp_chatbot_link_hover_color"])) {
2244 $wp_chatbot_link_hover_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_link_hover_color"]));
2245 update_option('wp_chatbot_link_hover_color', $wp_chatbot_link_hover_color);
2246 }
2247
2248 if (isset($_POST["wp_chatbot_bot_msg_bg_color"])) {
2249 $wp_chatbot_bot_msg_bg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_bot_msg_bg_color"]));
2250 update_option('wp_chatbot_bot_msg_bg_color', $wp_chatbot_bot_msg_bg_color);
2251 }
2252
2253 if (isset($_POST["wp_chatbot_bot_msg_text_color"])) {
2254 $wp_chatbot_bot_msg_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_bot_msg_text_color"]));
2255 update_option('wp_chatbot_bot_msg_text_color', $wp_chatbot_bot_msg_text_color);
2256 }
2257
2258 if (isset($_POST["wp_chatbot_user_msg_bg_color"])) {
2259 $wp_chatbot_user_msg_bg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_user_msg_bg_color"]));
2260 update_option('wp_chatbot_user_msg_bg_color', $wp_chatbot_user_msg_bg_color);
2261 }
2262
2263 if (isset($_POST["wp_chatbot_user_msg_text_color"])) {
2264 $wp_chatbot_user_msg_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_user_msg_text_color"]));
2265 update_option('wp_chatbot_user_msg_text_color', $wp_chatbot_user_msg_text_color);
2266 }
2267
2268 if (isset($_POST["wp_chatbot_buttons_bg_color"])) {
2269 $wp_chatbot_buttons_bg_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_bg_color"]));
2270 update_option('wp_chatbot_buttons_bg_color', $wp_chatbot_buttons_bg_color);
2271 }
2272
2273 if (isset($_POST["wp_chatbot_buttons_text_color"])) {
2274 $wp_chatbot_buttons_text_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_text_color"]));
2275 update_option('wp_chatbot_buttons_text_color', $wp_chatbot_buttons_text_color);
2276 }
2277
2278 if (isset($_POST["wp_chatbot_buttons_bg_color_hover"])) {
2279 $wp_chatbot_buttons_bg_color_hover = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_bg_color_hover"]));
2280 update_option('wp_chatbot_buttons_bg_color_hover', $wp_chatbot_buttons_bg_color_hover);
2281 }
2282
2283 if (isset($_POST["wp_chatbot_buttons_text_color_hover"])) {
2284 $wp_chatbot_buttons_text_color_hover = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_buttons_text_color_hover"]));
2285 update_option('wp_chatbot_buttons_text_color_hover', $wp_chatbot_buttons_text_color_hover);
2286 }
2287
2288 if (isset($_POST["wp_chatbot_theme_secondary_color"])) {
2289 $wp_chatbot_theme_secondary_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_theme_secondary_color"]));
2290 update_option('wp_chatbot_theme_secondary_color', $wp_chatbot_theme_secondary_color);
2291 }
2292 if (isset($_POST["wp_chatbot_header_background_color"])) {
2293 $wp_chatbot_header_background_color = sanitize_hex_color(wp_unslash($_POST["wp_chatbot_header_background_color"]));
2294 update_option('wp_chatbot_header_background_color', $wp_chatbot_header_background_color);
2295 }
2296
2297 if (isset($_POST["wp_chatbot_font_size"])) {
2298 $wp_chatbot_font_size = sanitize_text_field(wp_unslash($_POST["wp_chatbot_font_size"]));
2299 // Additional validation for font size format (e.g., '14px', '1.2em') could be added here if strict adherence to CSS units is required.
2300 update_option('wp_chatbot_font_size', $wp_chatbot_font_size);
2301 }
2302 if (isset($_POST["wp_chat_bot_font_family"])) {
2303 $wp_chat_bot_font_family = sanitize_text_field(wp_unslash($_POST["wp_chat_bot_font_family"]));
2304 update_option('wp_chat_bot_font_family', $wp_chat_bot_font_family);
2305 }
2306 if (isset($_POST["wp_chat_user_font_family"])) {
2307 $wp_chat_user_font_family = sanitize_text_field(wp_unslash($_POST["wp_chat_user_font_family"]));
2308 update_option('wp_chat_user_font_family', $wp_chat_user_font_family);
2309 }
2310 if (isset($_POST['wp_chatbot_user_font'])) {
2311 $wp_chatbot_user_font = sanitize_text_field(wp_unslash($_POST['wp_chatbot_user_font']));
2312 update_option('wp_chatbot_user_font', $wp_chatbot_user_font);
2313 }
2314 if (isset($_POST['wp_chatbot_bot_font'])) {
2315 $wp_chatbot_bot_font = sanitize_text_field(wp_unslash($_POST['wp_chatbot_bot_font']));
2316 update_option('wp_chatbot_bot_font', $wp_chatbot_bot_font);
2317 }
2318
2319 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
2320
2321 wp_enqueue_script( 'wp_chatbot_bot-front-js', plugins_url(basename(plugin_dir_path(__FILE__))) . '/js/sweetalrt.js', array('jquery'), '', true);
2322 $script = "
2323 console.log('sdaas');
2324 function callsweetalert(){
2325 Swal.fire({
2326 title: 'Your settings are saved.',
2327 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>',
2328 width: 450,
2329 icon: 'success',
2330 confirmButtonText: 'Got it',
2331 confirmButtonWidth: 100,
2332 confirmButtonClass: 'btn btn-lg',
2333 }).then((result) => {
2334 // location.reload();
2335 })
2336 }
2337 callsweetalert();
2338 ";
2339
2340 wp_add_inline_script( 'wp_chatbot_bot-front-js', $script );
2341 }
2342 }
2343 }
2344 /**
2345 * Display Notifications on specific criteria.
2346 *
2347 * @since 2.14
2348 */
2349 public static function wpcommerce_inactive_notice_for_wp_chatbot()
2350 {
2351 if (current_user_can('activate_plugins')) :
2352 if (!class_exists('wpCommerce')) :
2353 deactivate_plugins(plugin_basename(__FILE__));
2354 ?>
2355 <div id="message" class="error">
2356 <p>
2357 <?php
2358 printf(
2359 '%s WPBot for wpCommerce REQUIRES wpCommerce%s %swpCommerce%s must be active for WPBot to work. Please install & activate wpCommerce.',
2360 '<strong>',
2361 '</strong><br>',
2362 '<a href="http://wordpress.org/extend/plugins/wpcommerce/" target="_blank" >',
2363 '</a>'
2364 );
2365 ?>
2366 </p>
2367 </div>
2368 <?php
2369 elseif (version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) :
2370 ?>
2371 <div id="message" class="error">
2372 <!--<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>-->
2373 <p>
2374 <?php
2375 printf(
2376 '%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.',
2377 '<strong>',
2378 '</strong><br>',
2379 esc_html( QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION )
2380 );
2381 ?>
2382 </p>
2383 <div style="clear:both;"></div>
2384 </div>
2385 <?php
2386 endif;
2387 endif;
2388 }
2389 /**
2390 * Admin notice for table reindex
2391 */
2392 public function admin_notice_reindex() { ?>
2393 <div class="updated notice is-dismissible">
2394 <p><?php
2395 // translators: %s: A link to the Re-Index Products page.
2396 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>
2397 </div>
2398 <?php }
2399 }
2400 /**
2401 * Instantiate plugin.
2402 *
2403 */
2404 if (!function_exists('qcld_wb_chatboot_plugin_init')) {
2405 function qcld_wb_chatboot_plugin_init()
2406 {
2407 global $qcld_wb_chatbot;
2408 $qcld_wb_chatbot = qcld_wb_Chatbot_free::qcld_wb_chatbot_get_instance();
2409 }
2410 }
2411 add_action('plugins_loaded', 'qcld_wb_chatboot_plugin_init');
2412 /*
2413 * Initial Options will be insert as defualt data
2414 */
2415 register_activation_hook(__FILE__, 'qcld_wb_chatboot_defualt_options');
2416 if( !function_exists('qcld_wb_chatboot_defualt_options') ){
2417 function qcld_wb_chatboot_defualt_options(){
2418
2419 global $wpdb;
2420 $collate = '';
2421
2422 if ( $wpdb->has_cap( 'collation' ) ) {
2423
2424 if ( ! empty( $wpdb->charset ) ) {
2425
2426 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
2427 }
2428 if ( ! empty( $wpdb->collate ) ) {
2429
2430 $collate .= " COLLATE $wpdb->collate";
2431
2432 }
2433 }
2434
2435 //Bot User Table
2436 $table1 = $wpdb->prefix.'wpbot_sessions';
2437 $sql_sliders_Table1 = "
2438 CREATE TABLE IF NOT EXISTS `$table1` (
2439 `id` int(11) NOT NULL AUTO_INCREMENT,
2440 `session` int(11) NOT NULL,
2441 PRIMARY KEY (`id`)
2442 ) $collate AUTO_INCREMENT=1 ";
2443
2444 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2445 dbDelta( $sql_sliders_Table1 );
2446
2447 //Bot Response Table
2448 $table1 = $wpdb->prefix.'wpbot_response';
2449 $sql_sliders_Table1 = "
2450 CREATE TABLE IF NOT EXISTS `$table1` (
2451 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
2452 `query` TEXT NOT NULL,
2453 `keyword` TEXT NOT NULL,
2454 `response` TEXT NOT NULL,
2455 `category` varchar(256) NOT NULL,
2456 `intent` varchar(256) NOT NULL,
2457 `custom` varchar(256) NOT NULL,
2458 `lang` varchar(25) NULL,
2459 FULLTEXT(`query`, `keyword`, `response`)
2460 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
2461
2462 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2463 dbDelta( $sql_sliders_Table1 );
2464
2465 //Bot Response Table
2466 $table_rag_documents = $wpdb->prefix . "rag_documents";
2467
2468 $charset = $wpdb->get_charset_collate();
2469 if ($wpdb->get_var("SHOW TABLES LIKE '$table_rag_documents'") != $table_rag_documents) {
2470 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2471 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2472 doc_id VARCHAR(100) DEFAULT NULL,
2473 title VARCHAR(255) NOT NULL,
2474 content LONGTEXT NOT NULL,
2475 embedding LONGTEXT NOT NULL,
2476 source_type VARCHAR(20) DEFAULT 'post',
2477 source_url VARCHAR(255) DEFAULT NULL,
2478 file_url TEXT DEFAULT NULL,
2479 metadata LONGTEXT DEFAULT NULL,
2480 status VARCHAR(50) DEFAULT 'complete',
2481 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2482 ) $charset;";
2483 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2484 dbDelta($sql_rag_documents);
2485 }
2486 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2487
2488 if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_report'" ) != $table_report ) {
2489 $sql_report = "
2490 CREATE TABLE `$table_report` (
2491 `id` int(11) NOT NULL AUTO_INCREMENT,
2492 `user_id` int(11) NOT NULL,
2493 `conversation_id` int(11) DEFAULT NULL,
2494 `message` longtext NOT NULL,
2495 `feedback` varchar(20) DEFAULT NULL,
2496 `meta_info` text DEFAULT NULL,
2497 `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
2498 PRIMARY KEY (`id`)
2499 ) $charset_collate AUTO_INCREMENT=1;
2500 ";
2501
2502 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2503 dbDelta( $sql_report );
2504 }
2505
2506 $sqlqry = $wpdb->get_results($wpdb->prepare("select * from $table1 where id = %d", 1)); //DB Call OK, No Caching OK
2507 if(empty($sqlqry)){
2508
2509 $query = 'What Can WPBot do for you?';
2510 $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
2511
2512 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2513 $format = array('%s','%s', '%s', '%s');
2514 $wpdb->insert($table1,$data,$format); //DB Call OK, No Caching OK
2515 }
2516
2517 $url = get_site_url();
2518 $url = wp_parse_url($url);
2519 $domain = $url['host'];
2520 //$admin_email = "admin@" . $domain;
2521 $admin_email = get_option('admin_email');
2522 if(!get_option('wp_chatbot_position_x')) {
2523 update_option('wp_chatbot_position_x', 30);
2524 }
2525 if(!get_option('wp_chatbot_position_y')) {
2526 update_option('wp_chatbot_position_y', 30);
2527 }
2528 if(!get_option('disable_wp_chatbot')) {
2529 update_option('disable_wp_chatbot', '');
2530 }
2531 if(!get_option('disable_wp_chatbot_icon_animation')) {
2532 update_option('disable_wp_chatbot_icon_animation', '');
2533 }
2534 if(!get_option('disable_wp_chatbot_on_mobile')) {
2535 update_option('disable_wp_chatbot_on_mobile', '');
2536 }
2537 if(!get_option('qlcd_wp_chatbot_admin_email')) {
2538 update_option('qlcd_wp_chatbot_admin_email', get_option('admin_email'));
2539 }
2540 if(!get_option('disable_wp_chatbot_product_search')) {
2541 update_option('disable_wp_chatbot_product_search', '');
2542 }
2543 if(!get_option('disable_wp_chatbot_catalog')) {
2544 update_option('disable_wp_chatbot_catalog', '');
2545 }
2546 if(!get_option('disable_wp_chatbot_order_status')) {
2547 update_option('disable_wp_chatbot_order_status', '');
2548 }
2549 if(!get_option('enable_wp_chatbot_rtl')) {
2550 update_option('enable_wp_chatbot_rtl', '');
2551 }
2552 if(!get_option('show_menu_after_greetings')) {
2553 update_option('show_menu_after_greetings', 1);
2554 }
2555 if(!get_option('disable_back_to_start_menu')) {
2556 update_option('disable_back_to_start_menu', '');
2557 }
2558 if(!get_option('disable_floating_button')) {
2559 update_option('disable_floating_button', '');
2560 }
2561 if(!get_option('enable_chat_session')) {
2562 update_option('enable_chat_session', '');
2563 }
2564
2565 if(!get_option('enable_wp_chatbot_mobile_full_screen')) {
2566 update_option('enable_wp_chatbot_mobile_full_screen', 1);
2567 }
2568 if(!get_option('wpbot_preloading_time')) {
2569 update_option('wpbot_preloading_time', '800');
2570 }
2571
2572 if(!get_option('disable_wp_chatbot_notification')) {
2573 update_option('disable_wp_chatbot_notification', '1');
2574 }
2575 if(!get_option('disable_wp_chatbot_cart_item_number')) {
2576 update_option('disable_wp_chatbot_cart_item_number', '');
2577 }
2578 if(!get_option('disable_wp_chatbot_featured_product')) {
2579 update_option('disable_wp_chatbot_featured_product', '');
2580 }
2581 if(!get_option('disable_wp_chatbot_sale_product')) {
2582 update_option('disable_wp_chatbot_sale_product', '');
2583 }
2584 if(!get_option('wp_chatbot_open_product_detail')) {
2585 update_option('wp_chatbot_open_product_detail', '');
2586 }
2587 if(!get_option('qlcd_wp_chatbot_product_orderby')) {
2588 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field('title'));
2589 }
2590 if(!get_option('qlcd_wp_chatbot_product_order')) {
2591 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field('ASC'));
2592 }
2593 if(!get_option('qlcd_wp_chatbot_ppp')) {
2594 update_option('qlcd_wp_chatbot_ppp', intval(6));
2595 }
2596 if(!get_option('wp_chatbot_exclude_stock_out_product')) {
2597 update_option('wp_chatbot_exclude_stock_out_product', '');
2598 }
2599 if(!get_option('wp_chatbot_show_sub_category')) {
2600 update_option('wp_chatbot_show_sub_category', '');
2601 }
2602 if(!get_option('wp_chatbot_vertical_custom')){
2603 update_option('wp_chatbot_vertical_custom', 'Go To');
2604 }
2605 if(!get_option('wp_chatbot_show_home_page')) {
2606 update_option('wp_chatbot_show_home_page', 'on');
2607 }
2608 if(!get_option('qc_wpbot_menu_order')) {
2609 update_option('qc_wpbot_menu_order', '');
2610 }
2611
2612 if(!get_option('wp_chatbot_show_posts')) {
2613 update_option('wp_chatbot_show_posts', 'on');
2614 }
2615 if(!get_option('wp_chatbot_show_pages')){
2616 update_option('wp_chatbot_show_pages', 'on');
2617 }
2618 if(!get_option('wp_chatbot_show_pages_list')) {
2619 update_option('wp_chatbot_show_pages_list', maybe_serialize(array()));
2620 }
2621 if(!get_option('wp_chatbot_exclude_post_list')) {
2622 update_option('wp_chatbot_exclude_post_list', maybe_serialize(array()));
2623 }
2624
2625 if(!get_option('wp_chatbot_show_wpcommerce')) {
2626 update_option('wp_chatbot_show_wpcommerce', 'on');
2627 }
2628 if(!get_option('qlcd_wp_chatbot_stop_words_name')) {
2629 update_option('qlcd_wp_chatbot_stop_words_name', 'english');
2630 }
2631 if(!get_option('qlcd_wp_chatbot_stop_words')) {
2632 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");
2633 }
2634 if(!get_option('qlcd_wp_chatbot_order_user')) {
2635 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field('login'));
2636 }
2637 if(!get_option('wp_chatbot_custom_agent_path')) {
2638 update_option('wp_chatbot_custom_agent_path', '');
2639 }
2640 if(!get_option('wp_chatbot_custom_icon_path')) {
2641 update_option('wp_chatbot_custom_icon_path', '');
2642 }
2643
2644 if(!get_option('wp_chatbot_icon')) {
2645 update_option('wp_chatbot_icon', sanitize_text_field('icon-13.png'));
2646 }
2647 if(!get_option('wp_chatbot_floatingiconbg_color')) {
2648 update_option('wp_chatbot_floatingiconbg_color', '#fff');
2649 }
2650 if(!get_option('wp_chatbot_agent_image')){
2651 update_option('wp_chatbot_agent_image',sanitize_text_field('agent-0.png'));
2652 }
2653 if(!get_option('qcld_wb_chatbot_theme')) {
2654 update_option('qcld_wb_chatbot_theme', sanitize_text_field('template-00'));
2655 }
2656 if(!get_option('qcld_wb_chatbot_change_bg')) {
2657 update_option('qcld_wb_chatbot_change_bg', '');
2658 }
2659 if(!get_option('wp_chatbot_custom_css')) {
2660 update_option('wp_chatbot_custom_css', '');
2661 }
2662 if(!get_option('qlcd_wp_chatbot_host')) {
2663 update_option('qlcd_wp_chatbot_host', stripslashes(sanitize_text_field('Our Website')));
2664 }
2665 if(!get_option('qlcd_wp_chatbot_agent')) {
2666 update_option('qlcd_wp_chatbot_agent', stripslashes(sanitize_text_field('Carrie')));
2667 }
2668 if(!get_option('qlcd_wp_chatbot_host')) {
2669 update_option('qlcd_wp_chatbot_host', stripslashes(sanitize_text_field('Our Website')));
2670 }
2671 if(!get_option('qlcd_wp_chatbot_shopper_demo_name')) {
2672 update_option('qlcd_wp_chatbot_shopper_demo_name', stripslashes(sanitize_text_field('Amigo')));
2673 }
2674 if(!get_option('qlcd_wp_chatbot_yes')) {
2675 update_option('qlcd_wp_chatbot_yes', stripslashes(sanitize_text_field('YES')));
2676 }
2677 if(!get_option('qlcd_wp_chatbot_no')) {
2678 update_option('qlcd_wp_chatbot_no', stripslashes(sanitize_text_field('NO')));
2679 }
2680 if(!get_option('qlcd_wp_chatbot_or')) {
2681 update_option('qlcd_wp_chatbot_or', stripslashes(sanitize_text_field('OR')));
2682 }
2683 if(!get_option('qlcd_wp_chatbot_sorry')) {
2684 update_option('qlcd_wp_chatbot_sorry', stripslashes(sanitize_text_field('Sorry')));
2685 }
2686
2687 if(!get_option('qlcd_wp_chatbot_dialogflow_project_id')) {
2688 update_option('qlcd_wp_chatbot_dialogflow_project_id', '');
2689 }
2690 if(!get_option('wp_chatbot_df_api')) {
2691 update_option('wp_chatbot_df_api', 'v1');
2692 }
2693
2694
2695 if(!get_option('qlcd_wp_chatbot_dialogflow_project_key')) {
2696 update_option('qlcd_wp_chatbot_dialogflow_project_key', '');
2697 }
2698
2699 if(!get_option('qlcd_wp_chatbot_agent_join')) {
2700 update_option('qlcd_wp_chatbot_agent_join', maybe_serialize(array('has joined the conversation')));
2701 }
2702 if(!get_option('qlcd_wp_chatbot_welcome')) {
2703 update_option('qlcd_wp_chatbot_welcome', maybe_serialize(array('Welcome to', 'Glad to have you at')));
2704 }
2705 if(!get_option('qlcd_wp_chatbot_back_to_start')) {
2706 update_option('qlcd_wp_chatbot_back_to_start', maybe_serialize(array('Back to Start')));
2707 }
2708 if(!get_option('qlcd_wp_chatbot_hi_there')) {
2709 update_option('qlcd_wp_chatbot_hi_there', maybe_serialize(array('Hi There!')));
2710 }
2711 if(!get_option('qlcd_wp_chatbot_hello')) {
2712 update_option('qlcd_wp_chatbot_hello', maybe_serialize(array('Hi There!')));
2713 }
2714 if(!get_option('qlcd_wp_chatbot_welcome_back')) {
2715 update_option('qlcd_wp_chatbot_welcome_back', maybe_serialize(array('Welcome back', 'Good to see your again')));
2716 }
2717 if(!get_option('qlcd_wp_chatbot_asking_name')) {
2718 update_option('qlcd_wp_chatbot_asking_name', maybe_serialize(array('May I know your name?', 'What should I call you?')));
2719 }
2720 if(!get_option('qlcd_wp_chatbot_name_greeting')) {
2721 update_option('qlcd_wp_chatbot_name_greeting', maybe_serialize(array('Nice to meet you')));
2722 }
2723 if(!get_option('qlcd_wp_chatbot_i_am')) {
2724 update_option('qlcd_wp_chatbot_i_am', maybe_serialize(array('I am', 'This is')));
2725 }
2726 if(!get_option('qlcd_wp_chatbot_is_typing')) {
2727 update_option('qlcd_wp_chatbot_is_typing', maybe_serialize(array('is typing...')));
2728 }
2729 if(!get_option('qlcd_wp_chatbot_send_a_msg')) {
2730 update_option('qlcd_wp_chatbot_send_a_msg', maybe_serialize(array('Send a message.')));
2731 }
2732 if(!get_option('qlcd_wp_chatbot_choose_option')) {
2733 update_option('qlcd_wp_chatbot_choose_option', maybe_serialize(array('Choose an option.')));
2734 }
2735 if(!get_option('qlcd_wp_chatbot_viewed_products')) {
2736 update_option('qlcd_wp_chatbot_viewed_products', maybe_serialize(array('Recently viewed products')));
2737 }
2738 if(!get_option('qlcd_wp_chatbot_add_to_cart')) {
2739 update_option('qlcd_wp_chatbot_add_to_cart', maybe_serialize(array('Add to Cart')));
2740 }
2741 if(!get_option('qlcd_wp_chatbot_cart_link')) {
2742 update_option('qlcd_wp_chatbot_cart_link', maybe_serialize(array('Cart')));
2743 }
2744 if(!get_option('qlcd_wp_chatbot_checkout_link')) {
2745 update_option('qlcd_wp_chatbot_checkout_link', maybe_serialize(array('Checkout')));
2746 }
2747 if(!get_option('qlcd_wp_chatbot_featured_product_welcome')) {
2748 update_option('qlcd_wp_chatbot_featured_product_welcome', maybe_serialize(array('I have found following featured products')));
2749 }
2750 if(!get_option('qlcd_wp_chatbot_viewed_product_welcome')) {
2751 update_option('qlcd_wp_chatbot_viewed_product_welcome', maybe_serialize(array('I have found following recently viewed products')));
2752 }
2753 if(!get_option('qlcd_wp_chatbot_latest_product_welcome')) {
2754 update_option('qlcd_wp_chatbot_latest_product_welcome', maybe_serialize(array('I have found following latest products')));
2755 }
2756 if(!get_option('qlcd_wp_chatbot_cart_welcome')) {
2757 update_option('qlcd_wp_chatbot_cart_welcome', maybe_serialize(array('I have found following items from Shopping Cart.')));
2758 }
2759 if(!get_option('qlcd_wp_chatbot_cart_title')) {
2760 update_option('qlcd_wp_chatbot_cart_title', maybe_serialize(array('Title')));
2761 }
2762 if(!get_option('qlcd_wp_chatbot_cart_quantity')) {
2763 update_option('qlcd_wp_chatbot_cart_quantity', maybe_serialize(array('Qty')));
2764 }
2765 if(!get_option('qlcd_wp_chatbot_cart_price')) {
2766 update_option('qlcd_wp_chatbot_cart_price', maybe_serialize(array('Price')));
2767 }
2768 if(!get_option('qlcd_wp_chatbot_no_cart_items')) {
2769 update_option('qlcd_wp_chatbot_no_cart_items', maybe_serialize(array('No items in the cart')));
2770 }
2771 if(!get_option('qlcd_wp_chatbot_cart_updating')) {
2772 update_option('qlcd_wp_chatbot_cart_updating', maybe_serialize(array('Updating cart items ...')));
2773 }
2774 if(!get_option('qlcd_wp_chatbot_cart_removing')) {
2775 update_option('qlcd_wp_chatbot_cart_removing', maybe_serialize(array('Removing cart items ...')));
2776 }
2777 if(!get_option('qlcd_wp_chatbot_wildcard_msg')) {
2778 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize(array('I am here to find what you need. What are you looking for?')));
2779 }
2780 if(!get_option('qlcd_wp_chatbot_empty_filter_msg')) {
2781 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize(array('Sorry, I did not understand you.')));
2782 }
2783 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2784 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
2785 }
2786 if(!get_option('qlcd_wp_chatbot_sys_key_help')) {
2787 update_option('qlcd_wp_chatbot_sys_key_help', 'start');
2788 }
2789 if(!get_option('qlcd_wp_chatbot_sys_key_product')) {
2790 update_option('qlcd_wp_chatbot_sys_key_product', 'product');
2791 }
2792 if(!get_option('qlcd_wp_chatbot_sys_key_catalog')) {
2793 update_option('qlcd_wp_chatbot_sys_key_catalog', 'catalog');
2794 }
2795 if(!get_option('qlcd_wp_chatbot_sys_key_order')) {
2796 update_option('qlcd_wp_chatbot_sys_key_order', 'order');
2797 }
2798 if(!get_option('qlcd_wp_chatbot_sys_key_support')) {
2799 update_option('qlcd_wp_chatbot_sys_key_support', 'faq');
2800 }
2801 if(!get_option('qlcd_wp_chatbot_sys_key_reset')) {
2802 update_option('qlcd_wp_chatbot_sys_key_reset', 'reset');
2803 }
2804 if(!get_option('qlcd_wp_chatbot_sys_key_email')) {
2805 update_option('qlcd_wp_chatbot_sys_key_email', 'email');
2806 }
2807 if(!get_option('qlcd_wp_chatbot_help_welcome')) {
2808 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize(array('Welcome to Help Section.')));
2809 }
2810 if(!get_option('qlcd_wp_chatbot_help_msg')) {
2811 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>')));
2812 }
2813 if(!get_option('qlcd_wp_chatbot_reset')) {
2814 update_option('qlcd_wp_chatbot_reset', maybe_serialize(array('Do you want to clear our chat history and start over?')));
2815 }
2816 if(!get_option('qlcd_wp_chatbot_wildcard_product')) {
2817 update_option('qlcd_wp_chatbot_wildcard_product', maybe_serialize(array('Product Search')));
2818 }
2819 if(!get_option('qlcd_wp_chatbot_wildcard_catalog')) {
2820 update_option('qlcd_wp_chatbot_wildcard_catalog', maybe_serialize(array('Catalog')));
2821 }
2822 if(!get_option('qlcd_wp_chatbot_featured_products')) {
2823 update_option('qlcd_wp_chatbot_featured_products', maybe_serialize(array('Featured Products')));
2824 }
2825 if(!get_option('qlcd_wp_chatbot_sale_products')) {
2826 update_option('qlcd_wp_chatbot_sale_products', maybe_serialize(array('Products on Sale')));
2827 }
2828 if(!get_option('qlcd_wp_chatbot_wildcard_support')) {
2829 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
2830 }
2831 if(!get_option('qlcd_wp_chatbot_wildcard_site_search')) {
2832 update_option('qlcd_wp_chatbot_wildcard_site_search', 'Site Search');
2833 }
2834 if(!get_option('qlcd_wp_chatbot_messenger_label')) {
2835 update_option('qlcd_wp_chatbot_messenger_label', maybe_serialize(array('Chat with Us on Facebook Messenger')));
2836 }
2837 if(!get_option('qlcd_wp_chatbot_product_success')) {
2838 update_option('qlcd_wp_chatbot_product_success', maybe_serialize(array('Great! We have these products for', 'Found these products for')));
2839 }
2840 if(!get_option('qlcd_wp_chatbot_product_fail')) {
2841 update_option('qlcd_wp_chatbot_product_fail', maybe_serialize(array('Sorry, I found nothing')));
2842 }
2843 if(!get_option('qlcd_wp_chatbot_product_asking')) {
2844 update_option('qlcd_wp_chatbot_product_asking', maybe_serialize(array('What are you shopping for?')));
2845 }
2846 if(!get_option('qlcd_wp_chatbot_product_suggest')) {
2847 update_option('qlcd_wp_chatbot_product_suggest', maybe_serialize(array('You can browse our extensive catalog. Just pick a category from below:')));
2848 }
2849 if(!get_option('qlcd_wp_chatbot_product_infinite')) {
2850 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?')));
2851 }
2852 if(!get_option('qlcd_wp_chatbot_load_more')) {
2853 update_option('qlcd_wp_chatbot_load_more', maybe_serialize(array('Load More')));
2854 }
2855 if(!get_option('qlcd_wp_chatbot_wildcard_order')) {
2856 update_option('qlcd_wp_chatbot_wildcard_order', maybe_serialize(array('Order Status')));
2857 }
2858 if(!get_option('qlcd_wp_chatbot_order_welcome')) {
2859 update_option('qlcd_wp_chatbot_order_welcome', maybe_serialize(array('Welcome to Order status section!')));
2860 }
2861 if(!get_option('qlcd_wp_chatbot_order_username_asking')) {
2862 update_option('qlcd_wp_chatbot_order_username_asking', maybe_serialize(array('Please type your username?')));
2863 }
2864 if(!get_option('qlcd_wp_chatbot_order_username_password')) {
2865 update_option('qlcd_wp_chatbot_order_username_password', maybe_serialize(array('Please type your password')));
2866 }
2867 if(!get_option('qlcd_wp_chatbot_order_username_not_exist')) {
2868 update_option('qlcd_wp_chatbot_order_username_not_exist', maybe_serialize(array('This username does not exist.')));
2869 }
2870 if(!get_option('qlcd_wp_chatbot_order_username_thanks')) {
2871 update_option('qlcd_wp_chatbot_order_username_thanks', maybe_serialize(array('Thank you for the username')));
2872 }
2873 if(!get_option('qlcd_wp_chatbot_order_password_incorrect')) {
2874 update_option('qlcd_wp_chatbot_order_password_incorrect', maybe_serialize(array('Sorry Password is not correct!')));
2875 }
2876 if(!get_option('qlcd_wp_chatbot_asking_email')) {
2877 update_option('qlcd_wp_chatbot_asking_email', maybe_serialize(array('Please provide your email address')));
2878 }
2879 if(!get_option('qlcd_wp_chatbot_order_not_found')) {
2880 update_option('qlcd_wp_chatbot_order_not_found', maybe_serialize(array('I did not find any order by you')));
2881 }
2882 if(!get_option('qlcd_wp_chatbot_order_found')) {
2883 update_option('qlcd_wp_chatbot_order_found', maybe_serialize(array('I have found the following orders')));
2884 }
2885 if(!get_option('qlcd_wp_chatbot_order_email_support')) {
2886 update_option('qlcd_wp_chatbot_order_email_support', maybe_serialize(array('Email our support center about your order.')));
2887 }
2888 if(!get_option('qlcd_wp_chatbot_support_welcome')) {
2889 update_option('qlcd_wp_chatbot_support_welcome', maybe_serialize(array('Welcome to FAQ Section')));
2890 }
2891 if(!get_option('qlcd_wp_chatbot_support_email')) {
2892 update_option('qlcd_wp_chatbot_support_email', 'Send us Email.');
2893 }
2894 if(!get_option('qlcd_wp_chatbot_asking_msg')) {
2895 update_option('qlcd_wp_chatbot_asking_msg', maybe_serialize(array('Thank you for email address. Please write your message now.')));
2896 }
2897 if(!get_option('qlcd_wp_chatbot_no_result')) {
2898 update_option('qlcd_wp_chatbot_no_result', maybe_serialize(array('Sorry, No result found!')));
2899 }
2900 if(!get_option('qlcd_wp_chatbot_invalid_email')) {
2901 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize(array('Sorry, Email address is not valid! Please provide a valid email.')));
2902 }
2903 if(!get_option('qlcd_wp_chatbot_support_phone')) {
2904 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
2905 }
2906 if(!get_option('qlcd_wp_chatbot_asking_phone')) {
2907 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize(array('Please provide your Phone number')));
2908 }
2909 if(!get_option('qlcd_wp_chatbot_thank_for_phone')) {
2910 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize(array('Thank you for Phone number')));
2911 }
2912 if(!get_option('qlcd_wp_chatbot_support_option_again')) {
2913 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize(array('You may choose option from below.')));
2914 }
2915 if(!get_option('qlcd_wp_chatbot_admin_email')) {
2916 update_option('qlcd_wp_chatbot_admin_email', $admin_email);
2917 }
2918 if(!get_option('qlcd_wp_chatbot_email_sub')) {
2919 update_option('qlcd_wp_chatbot_email_sub', sanitize_text_field('WPBot Support Mail'));
2920 }
2921 if(!get_option('qlcd_wp_site_search')) {
2922 update_option('qlcd_wp_site_search', sanitize_text_field('Site Search'));
2923 }
2924 if(!get_option('qlcd_wp_chatbot_email_sent')) {
2925 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field('Your email was sent successfully.Thanks!'));
2926 }
2927 if(!get_option('qlcd_wp_chatbot_email_fail')) {
2928 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field('Sorry! I could not send your mail! Please contact the webmaster.'));
2929 }
2930 if(!get_option('qlcd_wp_chatbot_relevant_post_link_openai')) {
2931 update_option('qlcd_wp_chatbot_relevant_post_link_openai', sanitize_text_field('Check the relevant pages for more details and up to date information:'));
2932 }
2933 if(!get_option('qlcd_wp_chatbot_notification_interval')) {
2934 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field(5));
2935 }
2936 if(!get_option('qlcd_wp_chatbot_notifications')) {
2937 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
2938 }
2939 if(!get_option('support_query')) {
2940 update_option('support_query', maybe_serialize(array('What is WPBot?')));
2941 }
2942 if(!get_option('support_ans')) {
2943 update_option('support_ans', maybe_serialize(array('WPBot is a stand alone Chat Bot with zero configuration or bot training required. This plug and play chatbot also does not require any 3rd party service integration like Facebook. This chat bot helps shoppers find the products they are looking for easily and increase store sales! WPBot is a must have plugin for trending conversational commerce or conversational shopping.')));
2944 }
2945 if(!get_option('qlcd_wp_chatbot_search_option')) {
2946 update_option('qlcd_wp_chatbot_search_option', 'standard');
2947 }
2948 if(!get_option('wp_chatbot_index_count')) {
2949 update_option('wp_chatbot_index_count', 0);
2950 }
2951 if(!get_option('wp_chatbot_app_pages')) {
2952 update_option('wp_chatbot_app_pages', 0);
2953 }
2954 //messenger options.
2955 if(!get_option('enable_wp_chatbot_messenger')) {
2956 update_option('enable_wp_chatbot_messenger', '');
2957 }
2958 if(!get_option('enable_wp_chatbot_messenger_floating_icon')) {
2959 update_option('enable_wp_chatbot_messenger_floating_icon', '');
2960 }
2961 if(!get_option('qlcd_wp_chatbot_fb_app_id')) {
2962 update_option('qlcd_wp_chatbot_fb_app_id', '');
2963 }
2964 if(!get_option('qlcd_wp_chatbot_fb_page_id')) {
2965 update_option('qlcd_wp_chatbot_fb_page_id', '');
2966 }
2967 if(!get_option('qlcd_wp_chatbot_fb_color')) {
2968 update_option('qlcd_wp_chatbot_fb_color', '#0084ff');
2969 }
2970 if(!get_option('qlcd_wp_chatbot_fb_in_msg')) {
2971 update_option('qlcd_wp_chatbot_fb_in_msg', 'Welcome to WPBot!');
2972 }
2973 if(!get_option('qlcd_wp_chatbot_fb_out_msg')) {
2974 update_option('qlcd_wp_chatbot_fb_out_msg', 'You are not logged in');
2975 }
2976 //Skype option
2977 if(!get_option('enable_wp_chatbot_skype_floating_icon')) {
2978 update_option('enable_wp_chatbot_skype_floating_icon', '');
2979 }
2980 if(!get_option('enable_wp_chatbot_skype_id')) {
2981 update_option('enable_wp_chatbot_skype_id', '');
2982 }
2983 //Whats App
2984 if(!get_option('enable_wp_chatbot_whats')) {
2985 update_option('enable_wp_chatbot_whats', '');
2986 }
2987 if(!get_option('qlcd_wp_chatbot_whats_label')) {
2988 update_option('qlcd_wp_chatbot_whats_label', maybe_serialize(array('Chat with Us on WhatsApp')));
2989 }
2990 if(!get_option('enable_wp_chatbot_floating_whats')) {
2991 update_option('enable_wp_chatbot_floating_whats', '');
2992 }
2993 if(!get_option('qlcd_wp_chatbot_whats_num')) {
2994 update_option('qlcd_wp_chatbot_whats_num', '');
2995 }
2996 //Viber
2997 if(!get_option('enable_wp_chatbot_floating_viber')) {
2998 update_option('enable_wp_chatbot_floating_viber', '');
2999 }
3000 if(!get_option('qlcd_wp_chatbot_viber_acc')) {
3001 update_option('qlcd_wp_chatbot_viber_acc', '');
3002 }
3003 //Integration others
3004 if(!get_option('enable_wp_chatbot_floating_phone')) {
3005 update_option('enable_wp_chatbot_floating_phone', '');
3006 }
3007 if(!get_option('qlcd_wp_chatbot_phone')) {
3008 update_option('qlcd_wp_chatbot_phone', '');
3009 }
3010 if(!get_option('enable_wp_chatbot_floating_link')) {
3011 update_option('enable_wp_chatbot_floating_link', '');
3012 }
3013
3014 if(!get_option('qlcd_wp_chatbot_weblink')) {
3015 update_option('qlcd_wp_chatbot_weblink', '');
3016 }
3017 //Re-Tagetting
3018 if(!get_option('qlcd_wp_chatbot_ret_greet')) {
3019 update_option('qlcd_wp_chatbot_ret_greet', 'Hello');
3020 }
3021 if(!get_option('enable_wp_chatbot_exit_intent')) {
3022 update_option('enable_wp_chatbot_exit_intent', '');
3023 }
3024 if(!get_option('wp_chatbot_exit_intent_msg')) {
3025 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.');
3026 }
3027 if(!get_option('wp_chatbot_exit_intent_once')) {
3028 update_option('wp_chatbot_exit_intent_once', '');
3029 }
3030
3031 if(!get_option('enable_wp_chatbot_scroll_open')) {
3032 update_option('enable_wp_chatbot_scroll_open', '');
3033 }
3034 if(!get_option('wp_chatbot_scroll_open_msg')) {
3035 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.');
3036 }
3037 if(!get_option('wp_chatbot_scroll_percent')) {
3038 update_option('wp_chatbot_scroll_percent', 50);
3039 }
3040 if(!get_option('wp_chatbot_scroll_once')) {
3041 update_option('wp_chatbot_scroll_once', '');
3042 }
3043
3044 if(!get_option('enable_wp_chatbot_auto_open')) {
3045 update_option('enable_wp_chatbot_auto_open', '');
3046 }
3047
3048 if(!get_option('enable_wp_chatbot_ret_sound')) {
3049 update_option('enable_wp_chatbot_ret_sound', '');
3050 }
3051 if(!get_option('enable_wp_chatbot_sound_initial')) {
3052 update_option('enable_wp_chatbot_sound_initial', '');
3053 }
3054
3055
3056 if(!get_option('wp_chatbot_auto_open_msg')) {
3057 update_option('wp_chatbot_auto_open_msg', 'A SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
3058 }
3059 if(!get_option('wp_chatbot_auto_open_time')) {
3060 update_option('wp_chatbot_auto_open_time', 10);
3061 }
3062 if(!get_option('wp_chatbot_auto_open_once')) {
3063 update_option('wp_chatbot_auto_open_once', '');
3064 }
3065 if(!get_option('wp_chatbot_inactive_once')) {
3066 update_option('wp_chatbot_inactive_once', '');
3067 }
3068
3069 //To complete checkout.
3070 if(!get_option('enable_wp_chatbot_ret_user_show')) {
3071 update_option('enable_wp_chatbot_ret_user_show', '');
3072 }
3073 if(!get_option('wp_chatbot_auto_open_msg')) {
3074 update_option('wp_chatbot_checkout_msg', 'You have products in shopping cart, please complete your order.');
3075 }
3076 if(!get_option('wp_chatbot_inactive_time')) {
3077 update_option('wp_chatbot_inactive_time', 300);
3078 }
3079 if(!get_option('enable_wp_chatbot_inactive_time_show')) {
3080 update_option('enable_wp_chatbot_inactive_time_show', '');
3081 }
3082
3083 if(!get_option('wp_chatbot_proactive_bg_color')) {
3084 update_option('wp_chatbot_proactive_bg_color', '#ffffff');
3085 }
3086 if(!get_option('disable_wp_chatbot_feedback')) {
3087 update_option('disable_wp_chatbot_feedback','');
3088 }
3089 if(!get_option('disable_wp_chatbot_faq')) {
3090 update_option('disable_wp_chatbot_faq','');
3091 }
3092 if(!get_option('qlcd_wp_chatbot_feedback_label')) {
3093 update_option('qlcd_wp_chatbot_feedback_label',maybe_serialize(array('Send Feedback')));
3094 }
3095
3096 if(!get_option('enable_wp_chatbot_meta_title')) {
3097 update_option('enable_wp_chatbot_meta_title','');
3098 }
3099 if(!get_option('qlcd_wp_chatbot_meta_label')) {
3100 update_option('qlcd_wp_chatbot_meta_label','*New Messages');
3101 }
3102
3103 if(!get_option('disable_wp_chatbot_call_gen')) {
3104 update_option('disable_wp_chatbot_call_gen', '');
3105 }
3106
3107 if(!get_option('disable_wp_chatbot_site_search')) {
3108 update_option('disable_wp_chatbot_site_search', '');
3109 }
3110 if(!get_option('disable_wp_chatbot_call_sup')) {
3111 update_option('disable_wp_chatbot_call_sup', '');
3112 }
3113
3114 if(!get_option('qlcd_wp_chatbot_phone_sent')) {
3115 update_option('qlcd_wp_chatbot_phone_sent', 'Thanks for your phone number. We will call you ASAP!');
3116 }
3117 if(!get_option('qlcd_wp_chatbot_phone_fail')) {
3118 update_option('qlcd_wp_chatbot_phone_fail', 'Sorry! I could not collect your phone number!');
3119 }
3120 if(!get_option('qlcd_wp_chatbot_asking_search_keyword')){
3121 update_option('qlcd_wp_chatbot_asking_search_keyword', 'Please enter your keyword for searching');
3122 }
3123 if(!get_option('qlcd_wp_chatbot_found_result')){
3124 update_option('qlcd_wp_chatbot_found_result', 'We have found these results');
3125 }
3126 if(!get_option('enable_wp_chatbot_opening_hour')) {
3127 update_option('enable_wp_chatbot_opening_hour', '');
3128 }
3129 if(!get_option('enable_wp_chatbot_opening_hour')) {
3130 update_option('wpwbot_hours', array());
3131 }
3132
3133 if(!get_option('enable_wp_chatbot_dailogflow')) {
3134 update_option('enable_wp_chatbot_dailogflow', '');
3135 }
3136 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
3137 update_option('qlcd_wp_chatbot_dialogflow_client_token', '');
3138 }
3139 if(!get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')) {
3140 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', 'Sorry, I did not understand you. You may browse');
3141 }
3142 if(!get_option('openai_max_tokens')) {
3143 update_option('openai_max_tokens', '200');
3144 }
3145 if(!get_option('qcld_openai_suffix')) {
3146 update_option('qcld_openai_suffix', 'qcld');
3147 }
3148 if(!get_option('qlcd_wp_chatbot_dialogflow_agent_language')) {
3149 update_option('qlcd_wp_chatbot_dialogflow_agent_language', 'en');
3150 }
3151 if(!get_option('enable_wp_chatbot_post_content')) {
3152 update_option('enable_wp_chatbot_post_content', '1');
3153 }
3154 if(!get_option('openai_engines')) {
3155 update_option('openai_engines', 'gpt-4o');
3156 }
3157 // if(!get_option('skip_wp_greetings')) {
3158 update_option('skip_wp_greetings', '');
3159 //}
3160 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3161 }
3162 }
3163 /*
3164 * Reset Options will be insert as defualt data
3165 */
3166 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3167 //add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3168 //Jarvis all option will be delete during uninstlling.
3169 if( !function_exists('qcld_wb_chatboot_delete_all_options') ){
3170 function qcld_wb_chatboot_delete_all_options(){
3171
3172 if ( ! current_user_can( 'manage_options' ) ) {
3173 wp_die( 'Unauthorized access' );
3174 }
3175
3176 if ( ! isset( $_POST['wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wpnonce'] ) ), 'wp_chatbot' ) ) {
3177 wp_die( 'No cheating' );
3178 }
3179 delete_option('disable_wp_chatbot');
3180 delete_option('disable_wp_chatbot_icon_animation');
3181 delete_option('disable_wp_chatbot_on_mobile');
3182 delete_option('qlcd_wp_chatbot_admin_email');
3183 delete_option('qlcd_wp_chatbot_from_email');
3184
3185 delete_option('disable_back_to_start_menu');
3186 delete_option('disable_floating_button');
3187
3188 delete_option('disable_wp_chatbot_product_search');
3189 delete_option('disable_wp_chatbot_catalog');
3190 delete_option('disable_wp_chatbot_order_status');
3191 delete_option('disable_wp_chatbot_notification');
3192 delete_option('enable_wp_chatbot_rtl');
3193 delete_option('show_menu_after_greetings');
3194 delete_option('enable_chat_session');
3195
3196 delete_option('enable_wp_chatbot_mobile_full_screen');
3197 delete_option('wpbot_preloading_time');
3198 delete_option('disable_wp_chatbot_cart_item_number');
3199 delete_option('disable_wp_chatbot_featured_product');
3200 delete_option('disable_wp_chatbot_sale_product');
3201 delete_option('wp_chatbot_open_product_detail');
3202 delete_option('qlcd_wp_chatbot_product_orderby');
3203 delete_option('qlcd_wp_chatbot_product_order');
3204 delete_option('qlcd_wp_chatbot_ppp');
3205 delete_option('wp_chatbot_show_parent_category');
3206 delete_option('wp_chatbot_show_sub_category');
3207 delete_option('wp_chatbot_exclude_stock_out_product');
3208 delete_option('wp_chatbot_show_home_page');
3209 delete_option('qc_wpbot_menu_order');
3210
3211 delete_option('wp_chatbot_show_posts');
3212 delete_option('wp_chatbot_show_pages');
3213 delete_option('wp_chatbot_show_pages_list');
3214 delete_option('wp_chatbot_exclude_post_list');
3215 delete_option('wp_chatbot_show_wpcommerce');
3216 delete_option('qlcd_wp_chatbot_stop_words_name');
3217 delete_option('qlcd_wp_chatbot_stop_words');
3218 delete_option('qlcd_wp_chatbot_order_user');
3219 delete_option('wp_chatbot_icon');
3220 delete_option('wp_chatbot_floatingiconbg_color');
3221 delete_option('wp_chatbot_agent_image');
3222 delete_option('qcld_wb_chatbot_theme');
3223 delete_option('qcld_wb_chatbot_change_bg');
3224 delete_option('wp_chatbot_custom_css');
3225 delete_option('qlcd_wp_chatbot_host');
3226 delete_option('qlcd_wp_chatbot_agent');
3227 delete_option('qlcd_wp_chatbot_yes');
3228 delete_option('qlcd_wp_chatbot_no');
3229 delete_option('qlcd_wp_chatbot_or');
3230 delete_option('qlcd_wp_chatbot_sorry');
3231 delete_option('qlcd_wp_chatbot_agent_join');
3232 delete_option('qlcd_wp_chatbot_welcome');
3233 delete_option('qlcd_wp_chatbot_back_to_start');
3234 delete_option('qlcd_wp_chatbot_hi_there');
3235 delete_option('qlcd_wp_chatbot_hello');
3236 delete_option('qlcd_wp_chatbot_welcome_back');
3237 delete_option('qlcd_wp_chatbot_asking_name');
3238 delete_option('qlcd_wp_chatbot_name_greeting');
3239 delete_option('qlcd_wp_chatbot_i_am');
3240 delete_option('qlcd_wp_chatbot_wildcard_msg');
3241 delete_option('qlcd_wp_chatbot_empty_filter_msg');
3242 delete_option('qlcd_wp_chatbot_did_you_mean');
3243 delete_option('qlcd_wp_chatbot_wildcard_product');
3244 delete_option('qlcd_wp_chatbot_wildcard_catalog');
3245 delete_option('qlcd_wp_chatbot_featured_products');
3246 delete_option('qlcd_wp_chatbot_sale_products');
3247 delete_option('qlcd_wp_chatbot_wildcard_support');
3248 delete_option('qlcd_wp_chatbot_wildcard_site_search');
3249 delete_option('qlcd_wp_chatbot_messenger_label');
3250 delete_option('qlcd_wp_chatbot_product_success');
3251 delete_option('qlcd_wp_chatbot_product_fail');
3252 delete_option('qlcd_wp_chatbot_product_asking');
3253 delete_option('qlcd_wp_chatbot_product_suggest');
3254 delete_option('qlcd_wp_chatbot_product_infinite');
3255 delete_option('qlcd_wp_chatbot_load_more');
3256 delete_option('qlcd_wp_chatbot_wildcard_order');
3257 delete_option('qlcd_wp_chatbot_order_welcome');
3258 delete_option('qlcd_wp_chatbot_order_username_asking');
3259 delete_option('qlcd_wp_chatbot_order_username_password');
3260 delete_option('qlcd_wp_chatbot_support_welcome');
3261 delete_option('qlcd_wp_chatbot_support_email');
3262 delete_option('qlcd_wp_chatbot_asking_email');
3263 delete_option('qlcd_wp_chatbot_asking_msg');
3264 delete_option('qlcd_wp_chatbot_no_result');
3265 delete_option('qlcd_wp_chatbot_admin_email');
3266 delete_option('open_links_new_window');
3267 delete_option('qlcd_wp_chatbot_email_sub');
3268 delete_option('qlcd_wp_site_search');
3269 delete_option('qlcd_wp_chatbot_email_sent');
3270 delete_option('qlcd_wp_chatbot_support_phone');
3271 delete_option('qlcd_wp_chatbot_asking_phone');
3272 delete_option('qlcd_wp_chatbot_thank_for_phone');
3273 delete_option('qlcd_wp_chatbot_sys_key_help');
3274 delete_option('qlcd_wp_chatbot_sys_key_product');
3275 delete_option('qlcd_wp_chatbot_sys_key_catalog');
3276 delete_option('qlcd_wp_chatbot_sys_key_order');
3277 delete_option('qlcd_wp_chatbot_sys_key_support');
3278 delete_option('qlcd_wp_chatbot_sys_key_reset');
3279 delete_option('qlcd_wp_chatbot_sys_key_email');
3280 delete_option('qlcd_wp_chatbot_order_username_not_exist');
3281 delete_option('qlcd_wp_chatbot_order_username_thanks');
3282 delete_option('qlcd_wp_chatbot_order_password_incorrect');
3283 delete_option('qlcd_wp_chatbot_order_not_found');
3284 delete_option('qlcd_wp_chatbot_order_found');
3285 delete_option('qlcd_wp_chatbot_order_email_support');
3286 delete_option('qlcd_wp_chatbot_support_option_again');
3287 delete_option('qlcd_wp_chatbot_invalid_email');
3288 delete_option('qlcd_wp_chatbot_shopping_cart');
3289 delete_option('qlcd_wp_chatbot_add_to_cart');
3290 delete_option('qlcd_wp_chatbot_cart_link');
3291 delete_option('qlcd_wp_chatbot_checkout_link');
3292 delete_option('qlcd_wp_chatbot_cart_welcome');
3293 delete_option('qlcd_wp_chatbot_featured_product_welcome');
3294 delete_option('qlcd_wp_chatbot_viewed_product_welcome');
3295 delete_option('qlcd_wp_chatbot_latest_product_welcome');
3296 delete_option('qlcd_wp_chatbot_cart_title');
3297 delete_option('qlcd_wp_chatbot_cart_quantity');
3298 delete_option('qlcd_wp_chatbot_cart_price');
3299 delete_option('qlcd_wp_chatbot_no_cart_items');
3300 delete_option('qlcd_wp_chatbot_cart_updating');
3301 delete_option('qlcd_wp_chatbot_cart_removing');
3302 delete_option('qlcd_wp_chatbot_email_fail');
3303 delete_option('qlcd_wp_chatbot_relevant_post_link_openai');
3304 delete_option('support_query');
3305 delete_option('support_ans');
3306 delete_option('qlcd_wp_chatbot_notification_interval');
3307 delete_option('qlcd_wp_chatbot_notifications');
3308 delete_option( 'qlcd_wp_chatbot_search_option');
3309 delete_option( 'wp_chatbot_index_count');
3310 delete_option( 'wp_chatbot_app_pages');
3311 //messenger option
3312 delete_option( 'enable_wp_chatbot_messenger');
3313 delete_option( 'enable_wp_chatbot_messenger_floating_icon');
3314 delete_option( 'qlcd_wp_chatbot_fb_app_id');
3315 delete_option( 'qlcd_wp_chatbot_fb_page_id');
3316 delete_option( 'qlcd_wp_chatbot_fb_color');
3317 delete_option( 'qlcd_wp_chatbot_fb_in_msg');
3318 delete_option( 'qlcd_wp_chatbot_fb_out_msg');
3319 //skype option
3320 delete_option( 'enable_wp_chatbot_skype_floating_icon');
3321 delete_option( 'enable_wp_chatbot_skype_id');
3322 //whats app
3323 delete_option( 'enable_wp_chatbot_whats');
3324 delete_option( 'qlcd_wp_chatbot_whats_label');
3325 delete_option( 'enable_wp_chatbot_floating_whats');
3326 delete_option( 'qlcd_wp_chatbot_whats_num');
3327 // Viber
3328 delete_option( 'enable_wp_chatbot_floating_viber');
3329 delete_option( 'qlcd_wp_chatbot_viber_acc');
3330 //Integration others
3331 delete_option( 'enable_wp_chatbot_floating_phone');
3332 delete_option( 'qlcd_wp_chatbot_phone');
3333 delete_option( 'enable_wp_chatbot_floating_link');
3334 delete_option( 'qlcd_wp_chatbot_weblink');
3335 //Re Targetting
3336 delete_option( 'qlcd_wp_chatbot_ret_greet');
3337 delete_option( 'enable_wp_chatbot_exit_intent');
3338 delete_option( 'wp_chatbot_exit_intent_msg');
3339 delete_option( 'wp_chatbot_exit_intent_once');
3340
3341 delete_option( 'enable_wp_chatbot_scroll_open');
3342 delete_option( 'wp_chatbot_scroll_open_msg');
3343 delete_option( 'wp_chatbot_scroll_percent');
3344 delete_option( 'wp_chatbot_scroll_once');
3345
3346 delete_option( 'enable_wp_chatbot_auto_open');
3347 delete_option( 'enable_wp_chatbot_ret_sound');
3348 delete_option( 'enable_wp_chatbot_sound_initial');
3349 delete_option( 'disable_wp_chatbot_feedback');
3350 delete_option( 'disable_wp_chatbot_faq');
3351 delete_option( 'qlcd_wp_chatbot_feedback_label');
3352 delete_option( 'enable_wp_chatbot_meta_title');
3353 delete_option( 'qlcd_wp_chatbot_meta_label');
3354 delete_option( 'wp_chatbot_auto_open_msg');
3355 delete_option( 'wp_chatbot_auto_open_time');
3356 delete_option( 'wp_chatbot_auto_open_once');
3357 delete_option( 'wp_chatbot_inactive_once');
3358 delete_option( 'wp_chatbot_proactive_bg_color');
3359 delete_option( 'qlcd_wp_chatbot_phone_sent');
3360 delete_option( 'qlcd_wp_chatbot_phone_fail');
3361 delete_option('qlcd_wp_chatbot_asking_search_keyword');
3362 delete_option('qlcd_wp_chatbot_found_result');
3363 delete_option( 'disable_wp_chatbot_call_gen');
3364 delete_option( 'disable_wp_chatbot_site_search');
3365 delete_option( 'enable_wp_chatbot_post_content');
3366 delete_option( 'disable_wp_chatbot_call_sup');
3367
3368 delete_option( 'enable_wp_chatbot_ret_user_show');
3369 delete_option( 'enable_wp_chatbot_inactive_time_show');
3370 delete_option( 'wp_chatbot_inactive_time');
3371 delete_option( 'wp_chatbot_checkout_msg');
3372 delete_option( 'qlcd_wp_chatbot_shopper_demo_name');
3373 delete_option( 'qlcd_wp_chatbot_is_typing');
3374 delete_option( 'qlcd_wp_chatbot_send_a_msg');
3375 delete_option( 'qlcd_wp_chatbot_choose_option');
3376 delete_option( 'qlcd_wp_chatbot_viewed_products');
3377 delete_option( 'qlcd_wp_chatbot_help_welcome');
3378 delete_option( 'qlcd_wp_chatbot_help_msg');
3379 delete_option( 'qlcd_wp_chatbot_reset');
3380 delete_option( 'enable_wp_chatbot_opening_hour');
3381 delete_option( 'wpwbot_hours');
3382 delete_option( 'enable_wp_chatbot_dailogflow');
3383 delete_option( 'qlcd_wp_chatbot_dialogflow_client_token');
3384 delete_option( 'qlcd_wp_chatbot_dialogflow_defualt_reply');
3385 delete_option( 'qlcd_wp_chatbot_dialogflow_agent_language');
3386
3387 delete_option( 'qlcd_wp_chatbot_dialogflow_project_id');
3388 delete_option( 'wp_chatbot_df_api');
3389 delete_option( 'qlcd_wp_chatbot_dialogflow_project_key');
3390
3391 delete_option( 'wp_chatbot_bot_msg_bg_color');
3392 delete_option( 'wp_chatbot_bot_msg_text_color');
3393 delete_option( 'wp_chatbot_user_msg_bg_color');
3394 delete_option( 'wp_chatbot_user_msg_text_color');
3395 delete_option( 'wp_chatbot_buttons_bg_color');
3396 delete_option( 'wp_chatbot_buttons_text_color');
3397
3398 delete_option( 'wp_chatbot_buttons_bg_color_hover');
3399 delete_option( 'wp_chatbot_buttons_text_color_hover');
3400
3401 delete_option( 'wp_chatbot_theme_secondary_color');
3402 delete_option( 'wp_chatbot_theme_primary_color');
3403 delete_option( 'wp_chatbot_header_background_color');
3404 delete_option('wp_chatbot_font_size');
3405 delete_option('wp_chat_user_font_family');
3406 delete_option('wp_chat_bot_font_family');
3407 delete_option('wp_chatbot_bot_font');
3408 delete_option('wp_chatbot_user_font');
3409 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3410 qcld_wb_chatboot_defualt_options();
3411 $html='Reset all options to default successfully.';
3412 wp_send_json($html);
3413 }
3414 }
3415
3416 if( !function_exists('wpbot_free_qc_upgrade_completed') ){
3417 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
3418 // The path to our plugin's main file
3419 $our_plugin = plugin_basename( __FILE__ );
3420 // If an update has taken place and the updated type is plugins and the plugins element exists
3421 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
3422 // Iterate through the plugins being updated and check if ours is there
3423 foreach( $options['plugins'] as $plugin ) {
3424 if( $plugin == $our_plugin ) {
3425 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3426 }
3427 }
3428 }
3429 update_option( 'qcld_openai_relevant_post', ['post','page'] );
3430 }
3431 }
3432 add_action( 'upgrader_process_complete', 'wpbot_free_qc_upgrade_completed', 10, 2 );
3433
3434
3435
3436 /**
3437 *
3438 * Open Ai integration
3439 *
3440 */
3441 if( !function_exists('wpbot_openAi_setting_func') ){
3442 function wpbot_openAi_setting_func (){
3443
3444 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/admin/templates/ai-admin.php");
3445 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3446
3447 }
3448 }
3449
3450 /**
3451 *
3452 * Function to load translation files.
3453 *
3454 */
3455
3456 if( !function_exists('wp_chatbot_lang_init') ){
3457 function wp_chatbot_lang_init() {
3458 load_plugin_textdomain( 'chatbot', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
3459 }
3460 }
3461 add_action( 'plugins_loaded', 'wp_chatbot_lang_init');
3462
3463 $wpbot_feedback = new Qcld_Wp_Usage_Feedback(
3464 __FILE__,
3465 'plugins@quantumcloud.com',
3466 false,
3467 true
3468
3469 );
3470 if( !function_exists('wpbot_help_page_callback_func') ){
3471 function wpbot_help_page_callback_func(){
3472 ?>
3473
3474
3475
3476 <div class="wrap qcld-main-wrapper">
3477 <div class="qcld-wp-chatbot-wrap-header">
3478
3479 <div class="qcld-wp-chatbot-wrap-header-logo"><a href="#" class="qcld-wp-chatbot-wrap-site__logo"><img style="width:100%" src="<?php echo esc_url( QCLD_wpCHATBOT_IMG_URL . '/chatbot.png' ); ?>" alt="Dialogflow CX"> WPBot Control Panel </a>
3480 <p><strong>Core Version:</strong> v<?php echo QCLD_wpCHATBOT_VERSION; ?></p>
3481 </div>
3482 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3483 <li>
3484 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
3485
3486 </li>
3487 </ul>
3488 </div>
3489 <div class="qcld-wrap swpm-admin-menu-wrap">
3490 <div class="nav-tab-wrapper sld_nav_container wppt_nav_container qcld_help_wppt_nav_container">
3491 <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>
3492 <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>
3493 <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>
3494 </div>
3495 <div class="content_qcbot_help_secion">
3496 <div class=" wppt-settings-section" id="general_wp_nutshell" style="display:none;">
3497 <div class="content form-container qcbot_help_secion" style="">
3498 <!-- new Section -->
3499 <h3 class="qcld-wpbot-main-tabs-title"><?php echo esc_html__('WPBot – In a Nutshell', 'chatbot'); ?></h3>
3500 <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>
3501 <div class="panel panel-default">
3502 <div class="panel-heading" role="tab" id="IntentheadingOne">
3503 <h4 class="panel-title">
3504 <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>
3505 </h4>
3506 </div>
3507 <div id="IntentcollapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="IntentheadingOne">
3508 <div class="panel-body">
3509 <?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>
3510 <?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>
3511 <?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>
3512 <?php echo esc_html_e('Please check this article for', 'chatbot'); ?> <span class="wppt_nav_container qcld-plan-tab-text">
3513 <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'); ?>
3514 </div>
3515 </div>
3516 </div>
3517 <div class="panel panel-default">
3518 <div class="panel-heading" role="tab" id="headingSix">
3519 <h4 class="panel-title">
3520 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseSix" aria-expanded="false" aria-controls="collapseSix"> <?php esc_html_e('Start Menu', 'chatbot'); ?> </a>
3521 </h4>
3522 </div>
3523 <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
3524 <div class="panel-body">
3525 <?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 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->Start Menu you can drag Available Menu Items (Intents) to the Active Menu Items area.', 'chatbot'); ?></br></br>
3526 <?php echo esc_html_e('Besides the built-in Intents, you can also create custom Intents for your 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>
3527 <?php echo esc_html_e('We recommend enabling', 'chatbot'); ?><b><?php echo esc_html_e(' Show Start Menu After Greetings ', 'chatbot'); ?></b><?php echo esc_html_e('from ChatBot Pro->Settings->General settings.', 'chatbot'); ?>
3528 </div>
3529 </div>
3530 </div>
3531 <div class="panel panel-default">
3532 <div class="panel-heading" role="tab" id="headingSeven">
3533 <h4 class="panel-title">
3534 <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>
3535 </h4>
3536 </div>
3537 <div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
3538 <div class="panel-body">
3539 <?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 Start Menu.', 'chatbot'); ?></br></br>
3540 <?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'); ?>
3541 </div>
3542 </div>
3543 </div>
3544 <div class="panel panel-default">
3545 <div class="panel-heading" role="tab" id="headingEight">
3546 <h4 class="panel-title">
3547 <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>
3548 </h4>
3549 </div>
3550 <div id="collapseEight" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingEight">
3551 <div class="panel-body">
3552 <?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'); ?>
3553 </div>
3554 </div>
3555 </div>
3556 <div class="panel panel-default">
3557 <div class="panel-heading" role="tab" id="headingtwo">
3558 <h4 class="panel-title">
3559 <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>
3560 </h4>
3561 </div>
3562 <div id="collapsetwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingtwo">
3563 <div class="panel-body">
3564 <?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'); ?>
3565 </div>
3566 </div>
3567 </div>
3568 <div class="panel panel-default">
3569 <div class="panel-heading" role="tab" id="headingThree">
3570 <h4 class="panel-title">
3571 <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>
3572 </h4>
3573 </div>
3574 <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
3575 <div class="panel-body">
3576 <?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'); ?>
3577 </div>
3578 </div>
3579 </div>
3580 <div class="panel panel-default">
3581 <div class="panel-heading" role="tab" id="headingten">
3582 <h4 class="panel-title">
3583 <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>
3584 </h4>
3585 </div>
3586 <div id="collapseten" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingten">
3587 <div class="panel-body">
3588 <?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'); ?>
3589 </div>
3590 </div>
3591 </div>
3592 <div class="panel panel-default">
3593 <div class="panel-heading" role="tab" id="headingFour">
3594 <h4 class="panel-title">
3595 <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>
3596 </h4>
3597 </div>
3598 <div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
3599 <div class="panel-body">
3600 <?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'); ?>
3601 </div>
3602 </div>
3603 </div>
3604 <div class="panel panel-default">
3605 <div class="panel-heading" role="tab" id="headingFive">
3606 <h4 class="panel-title">
3607 <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>
3608 </h4>
3609 </div>
3610 <div id="collapseFive" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFive">
3611 <div class="panel-body">
3612 <?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'); ?>
3613 </div>
3614 </div>
3615 </div>
3616 </div>
3617 </div>
3618 <div class=" wppt-settings-section" id="general_int">
3619 <div class="content form-container qcbot_help_secion" style="">
3620 <!-- new Section -->
3621 <h3 class="qcld-wpbot-main-tabs-title"><?php echo esc_html__('WPBot Interactions', 'chatbot'); ?></h3>
3622 <p><?php echo esc_html__('You can use WPBot to both answer user questions and collect information from the users.', 'chatbot'); ?></p>
3623 <h4><?php echo esc_html__('To create answers to user questions you can use:', 'chatbot'); ?></h4>
3624 <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>
3625 <h4> <?php echo esc_html__('To collect information from your users you can use:', 'chatbot'); ?></h4>
3626 <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>
3627 <hr>
3628 <p>
3629 <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'); ?>
3630 </b></p>
3631 <p><b><?php echo esc_html__('To generate direct text responses, you need to use either Simple Text Responses or AI services. ', 'chatbot'); ?>
3632 </b></p>
3633 <hr>
3634 <h4><?php echo esc_html__('You can create user interactions in the following ways:', 'chatbot'); ?></h4>
3635 <div class="panel panel-default">
3636 <div class="panel-heading" role="tab" id="headingOne">
3637 <h4 class="panel-title">
3638 <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>
3639 </h4>
3640 </div>
3641 <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
3642 <div class="panel-body">
3643 <?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'); ?>
3644 <div class="section-container">
3645 <div class="wpb_column vc_column_container vc_col-sm-6">
3646 <div class="vc_column-inner ">
3647 <div class="wpb_wrapper">
3648 <div class="to-icon-box left txt-left">
3649 <div class="to-icon-txt fa-4x-txt ">
3650 <h3>
3651 <span>// </span><?php esc_html_e('Simple Text Responses', 'chatbot'); ?>
3652 </h3>
3653 <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>
3654 </div>
3655 </div>
3656 <div class="to-icon-box left txt-left">
3657 <div class="to-icon-txt fa-4x-txt ">
3658 <h3>
3659 <span>// </span><?php esc_html_e('Send eMail, Call Me Back &amp; Feedback Collection', 'chatbot'); ?>
3660 </h3>
3661 <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 Start Menu.', 'chatbot'); ?></p>
3662 </div>
3663 </div>
3664 <div class="to-icon-box left txt-left">
3665 <div class="to-icon-txt fa-4x-txt ">
3666 <h3>
3667 <span>// </span><?php esc_html_e('Advanced Site Search', 'chatbot'); ?> <span class="qc_wpbot_pro">PRO</span>
3668 </h3>
3669 <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>
3670 </div>
3671 </div>
3672 </div>
3673 </div>
3674 </div>
3675 <div class="wpb_column vc_column_container vc_col-sm-6">
3676 <div class="vc_column-inner ">
3677 <div class="wpb_wrapper">
3678 <div class="to-icon-box left txt-left">
3679 <div class="to-icon-txt fa-4x-txt ">
3680 <h3>
3681 <span>// </span><?php esc_html_e('Frequently Asked Questions', 'chatbot'); ?>
3682 </h3>
3683 <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>
3684 </div>
3685 </div>
3686 <div class="to-icon-box left txt-left">
3687 <div class="to-icon-txt fa-4x-txt ">
3688 <h3>
3689 <span>// </span>Ask for name, email, phone number etc.
3690 </h3>
3691 <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>
3692 </div>
3693 </div>
3694 <div class="to-icon-box left txt-left">
3695 <div class="to-icon-txt fa-4x-txt ">
3696 <h3>
3697 <span>// </span><?php esc_html_e('Newsletter Subscription', 'chatbot'); ?> <span class="qc_wpbot_pro">PRO</span>
3698 </h3>
3699 <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>
3700 </div>
3701 </div>
3702 </div>
3703 </div>
3704 </div>
3705 </div>
3706 </div>
3707 </div>
3708 </div>
3709 <div class="panel panel-default">
3710 <div class="panel-heading" role="tab" id="headingTwo">
3711 <h4 class="panel-title">
3712 <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>
3713 </h4>
3714 </div>
3715 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
3716 <div class="panel-body">
3717 <p><?php esc_html_e('Extend the 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>
3718 <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>.
3719 </p>
3720 <h4><?php esc_html_e('Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.', 'chatbot'); ?></h4>
3721 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank"><?php esc_html_e('Download Free Version', 'chatbot'); ?></a>
3722 <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>
3723 <h4><?php esc_html_e('What Can You Do with it?', 'chatbot'); ?></h4>
3724 <p><?php esc_html_e('Conversation Forms allows you to create a wide variety of forms, that might include:', 'chatbot'); ?></p>
3725 <ul>
3726 <li><?php esc_html_e('Create menu or button driven conversations', 'chatbot'); ?></li>
3727 <li><?php esc_html_e('Conditional <strong>Menu Driven Conversations', 'chatbot'); ?></strong>
3728 <span class="qc_wpbot_pro" style="font-size: 9px;"><?php esc_html_e('PRO', 'chatbot'); ?></span>
3729 </li>
3730 <li><?php esc_html_e('Standard Contact Forms', 'chatbot'); ?></li>
3731 <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>
3732 </li>
3733 <li>Job <strong><?php esc_html_e('Application Forms', 'chatbot'); ?></strong>
3734 </li>
3735 <li>
3736 <strong><?php esc_html_e('Lead Capture', 'chatbot'); ?></strong> <?php esc_html_e('Forms', 'chatbot'); ?>
3737 </li>
3738 <li><?php esc_html_e('Various types of', 'chatbot'); ?> <strong><?php esc_html_e('Calculators', 'chatbot'); ?></strong>
3739 <span class="qc_wpbot_pro" style="font-size: 9px;"><?php esc_html_e('PRO', 'chatbot'); ?></span>
3740 </li>
3741 <li><?php esc_html_e('Feedback', 'chatbot'); ?> <strong>Survey</strong><?php esc_html_e(' Forms etc.', 'chatbot'); ?> </li>
3742 </ul>
3743 </div>
3744 </div>
3745 </div>
3746 <div class="panel panel-default">
3747 <div class="panel-heading" role="tab" id="AIheadingThree">
3748 <h4 class="panel-title">
3749 <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>
3750 </h4>
3751 </div>
3752 <div id="AIcollapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="AIheadingThree">
3753 <div class="panel-body">
3754 <div class="section-container">
3755 <div class="wpb_column vc_column_container vc_col-sm-6">
3756 <div class="wpb_wrapper">
3757 <h3><?php esc_html_e('DialogFlow Essential', 'chatbot'); ?></h3>
3758 <?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'); ?>
3759 <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>
3760 </p>
3761 <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>
3762 </p>
3763 <h3><?php esc_html_e('OpenAI', 'chatbot'); ?></h3>
3764 <?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'); ?>
3765 </div>
3766 </div>
3767 <div class="wpb_column vc_column_container vc_col-sm-6">
3768 <div class="wpb_wrapper">
3769 <h3><?php esc_html_e('DialogFlow CX', 'chatbot'); ?> <span class="qc_wpbot_pro">PRO</span>
3770 </h3>
3771 <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>
3772 <ul>
3773 <li>
3774 <?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'); ?>
3775 </li>
3776 <li>
3777 <?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'); ?>
3778 </li>
3779 <li>
3780 <?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'); ?>
3781 </li>
3782 <img style="width:100%" src="<?php echo esc_url( QCLD_wpCHATBOT_IMG_URL . '/dialogflow-cx-1024x676.jpg' );?>" alt="Dialogflow CX">
3783 </ul>
3784 </div>
3785 </div>
3786 </div>
3787 </div>
3788 </div>
3789 </div>
3790 </div>
3791 </div>
3792 <div class=" wppt-settings-section" id="general_debugging" style="display:none;">
3793 <div class="content form-container qcbot_help_secion" >
3794 <div class="" >
3795 <h3 class="qcld-wpbot-main-tabs-title"><?php esc_html_e('Tips', 'chatbot'); ?></h3>
3796 <h3><?php esc_html_e('Tutorial', 'chatbot'); ?></h3>
3797 <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>
3798 <h3><?php esc_html_e('Simple Text Responses', 'chatbot'); ?></h3>
3799 <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>
3800 <h3><?php esc_html_e('Setting Updates', 'chatbot'); ?></h3>
3801 <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>
3802 <h3><?php esc_html_e('Note', 'chatbot'); ?></h3>
3803 <p><?php esc_html_e('You could use &lt;br&gt; tag in Language Center & Dialogflow Responses for line break.', 'chatbot'); ?></p>
3804 </div>
3805 </div>
3806
3807
3808
3809
3810
3811
3812
3813 <div class="panel panel-default">
3814 <div class="panel-heading" role="tab" id="faqone">
3815 <h4 class="panel-title">
3816 <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>
3817 </h4>
3818 </div>
3819 <div id="faqcollapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqone">
3820 <div class="panel-body">
3821 <?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'); ?>
3822 </div>
3823 </div>
3824 </div>
3825
3826
3827
3828
3829 <div class="panel panel-default">
3830 <div class="panel-heading" role="tab" id="faqtwo">
3831 <h4 class="panel-title">
3832 <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>
3833 </h4>
3834 </div>
3835 <div id="faqcollapsetwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwo">
3836 <div class="panel-body">
3837 <?php echo esc_html_e('To Debug: ', 'chatbot'); ?><br>
3838 <?php echo esc_html_e(' 1. Make sure that you have created the Google Project and the Service account as an Owner', 'chatbot'); ?><br>
3839 <?php echo esc_html_e('2. Make sure that you have connected to the correct Dialogflow agent', 'chatbot'); ?><br>
3840 <?php echo esc_html_e('3. Follow the steps in this tutorial correctly: https://www.wpbot.pro/dialogflow-integration', 'chatbot'); ?><br>
3841 <?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'); ?>
3842 </div>
3843 </div>
3844 </div>
3845
3846
3847 <div class="panel panel-default">
3848 <div class="panel-heading" role="tab" id="faqthree">
3849 <h4 class="panel-title">
3850 <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
3851 ', 'chatbot'); ?> </a>
3852 </h4>
3853 </div>
3854 <div id="faqcollapsethree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqthree">
3855 <div class="panel-body">
3856 <?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'); ?>
3857 </div>
3858 </div>
3859 </div>
3860
3861 <div class="panel panel-default">
3862 <div class="panel-heading" role="tab" id="faqfour">
3863 <h4 class="panel-title">
3864 <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
3865 ', 'chatbot'); ?> </a>
3866 </h4>
3867 </div>
3868 <div id="faqcollapsefour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqfour">
3869 <div class="panel-body">
3870 <?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'); ?>
3871 </div>
3872 </div>
3873 </div>
3874
3875
3876 <div class="panel panel-default">
3877 <div class="panel-heading" role="tab" id="faqfive">
3878 <h4 class="panel-title">
3879 <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>
3880 </h4>
3881 </div>
3882 <div id="faqcollapsefive" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqfive">
3883 <div class="panel-body">
3884 <?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'); ?>
3885 </div>
3886 </div>
3887 </div>
3888
3889
3890
3891 <div class="panel panel-default">
3892 <div class="panel-heading" role="tab" id="faqsix">
3893 <h4 class="panel-title">
3894 <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>
3895 </h4>
3896 </div>
3897 <div id="faqcollapsesix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqsix">
3898 <div class="panel-body">
3899 <?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>
3900 <?php echo esc_html_e('Also go to Simple Text Responses and press the Re-Index button.', 'chatbot'); ?><br>
3901 <?php echo esc_html_e(' After that try purging any cache and test the chatbot in Incognito mode', 'chatbot'); ?><br>
3902 <?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'); ?>
3903 </div>
3904 </div>
3905 </div>
3906
3907
3908 <div class="panel panel-default">
3909 <div class="panel-heading" role="tab" id="faqseven">
3910 <h4 class="panel-title">
3911 <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>
3912 </h4>
3913 </div>
3914 <div id="faqcollapseseven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqseven">
3915 <div class="panel-body">
3916 <?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>
3917 <?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>
3918 <?php echo esc_html_e('Also go to Simple Text Responses and press the Re-Index button.', 'chatbot'); ?><br>
3919 <?php echo esc_html_e('After that remember to test in a browser Incognito mode to avoid cache and cookies.', 'chatbot'); ?>
3920 </div>
3921 </div>
3922 </div>
3923
3924 <div class="panel panel-default">
3925 <div class="panel-heading" role="tab" id="faqeight">
3926 <h4 class="panel-title">
3927 <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>
3928 </h4>
3929 </div>
3930 <div id="faqcollapseeight" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqeight">
3931 <div class="panel-body">
3932 <?php echo esc_html_e('Please check the plugin`s Help Section for details on this', 'chatbot'); ?>
3933 </div>
3934 </div>
3935 </div>
3936
3937 <div class="panel panel-default">
3938 <div class="panel-heading" role="tab" id="faqnine">
3939 <h4 class="panel-title">
3940 <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>
3941 </h4>
3942 </div>
3943 <div id="faqcollapsenine" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqnine">
3944 <div class="panel-body">
3945 <?php echo esc_html_e('Please use the <br> tag for line breaks.', 'chatbot'); ?>
3946 </div>
3947 </div>
3948 </div>
3949
3950 <div class="panel panel-default">
3951 <div class="panel-heading" role="tab" id="faqten">
3952 <h4 class="panel-title">
3953 <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>
3954 </h4>
3955 </div>
3956 <div id="faqcollapseten" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqten">
3957 <div class="panel-body">
3958 <?php echo esc_html_e('Yes, common HTML tags link link href, strong, br etc. are supported.', 'chatbot'); ?>
3959 </div>
3960 </div>
3961 </div>
3962
3963 <div class="panel panel-default">
3964 <div class="panel-heading" role="tab" id="faqeleven">
3965 <h4 class="panel-title">
3966 <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>
3967 </h4>
3968 </div>
3969 <div id="faqcollapseeleven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqeleven">
3970 <div class="panel-body">
3971 <?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'); ?>
3972 </div>
3973 </div>
3974 </div>
3975
3976
3977 <div class="panel panel-default">
3978 <div class="panel-heading" role="tab" id="faqtwelve">
3979 <h4 class="panel-title">
3980 <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>
3981 </h4>
3982 </div>
3983 <div id="faqcollapsetwelve" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwelve">
3984 <div class="panel-body">
3985 <?php echo esc_html_e('You can disable predefined intents FAQ, eMail, Call me from WPBot Lite > Settings page`s Start Menu Section.', 'chatbot'); ?>
3986 </div>
3987 </div>
3988 </div>
3989
3990
3991
3992 </div>
3993 </div>
3994 </div>
3995 </div>
3996 <script type="text/javascript">
3997 jQuery(document).ready(function($){
3998 var url=document.URL;
3999 var arr=url.split('#');
4000 var tab_tar = '.'+arr[1];
4001 setTimeout(function(){
4002 jQuery(tab_tar).trigger('click');
4003 }, 500);
4004 jQuery('.wppt_nav_container .nav-tab').on('click', function(e){
4005 e.preventDefault();
4006 var section_id = jQuery(this).attr('href');
4007 jQuery('.wppt_nav_container .nav-tab').removeClass('nav-tab-active');
4008 jQuery(this).addClass('nav-tab-active');
4009 jQuery('.wppt-settings-section').hide();
4010 jQuery('.wppt-settings-section').each(function(){
4011 jQuery(section_id).show();
4012 });
4013 });
4014 })
4015 </script>
4016 <?php
4017 }
4018 }
4019
4020 add_action('init', 'qc_wp_latest_update_check');
4021 if( !function_exists('qc_wp_latest_update_check') ){
4022 function qc_wp_latest_update_check(){
4023 global $wpdb;
4024 if (current_user_can( 'manage_options' )) {
4025 if (isset($_POST['str_nonce'])) {
4026 $sanitized_nonce = sanitize_text_field(wp_unslash($_POST['str_nonce']));
4027 if (wp_verify_nonce($sanitized_nonce, 'str-nonce')) {
4028
4029 if(!get_option('qc_wp_ludate_ck')){
4030 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
4031 update_option('qlcd_wp_chatbot_support_email', 'Send us Email');
4032 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
4033 update_option('qlcd_wp_chatbot_wildcard_site_search', 'Site Search');
4034 update_option('qc_wp_ludate_ck', 'done');
4035 }
4036
4037 if( ! get_option( 'wpbot-admin-notice-oninstallation' ) ){
4038 update_option('wpbot-admin-notice-oninstallation', 'show');
4039 }
4040
4041 if(!get_option('qc_wpb_simple_response_db_upgrade_free2')){
4042
4043 $collate = '';
4044 if ( $wpdb->has_cap( 'collation' ) ) {
4045
4046 if ( ! empty( $wpdb->charset ) ) {
4047
4048 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
4049 }
4050 if ( ! empty( $wpdb->collate ) ) {
4051
4052 $collate .= " COLLATE $wpdb->collate";
4053
4054 }
4055 }
4056 //Bot Response Table
4057 $table1 = $wpdb->prefix.'wpbot_response';
4058 $sql_sliders_Table1 = "
4059 CREATE TABLE IF NOT EXISTS `$table1` (
4060 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
4061 `query` TEXT NOT NULL,
4062 `keyword` TEXT NOT NULL,
4063 `response` TEXT NOT NULL,
4064 `category` varchar(256) NOT NULL,
4065 `intent` varchar(256) NOT NULL,
4066 `custom` varchar(256) NOT NULL,
4067 `lang` varchar(25) NULL,
4068 FULLTEXT(`query`, `keyword`, `response`)
4069 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
4070
4071 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
4072 dbDelta( $sql_sliders_Table1 );
4073
4074 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4075 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4076 }
4077
4078 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4079 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4080 }
4081
4082 $sqlqry = $wpdb->get_results( $wpdb->prepare( "select * from $table1 where id = %d", 1 ) ); //DB Call OK, No Caching OK
4083 if(empty($sqlqry)){
4084
4085 $query = 'What Can WPBot do for you?';
4086 $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
4087
4088 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4089 $format = array('%s','%s', '%s', '%s');
4090 $wpdb->insert($table1,$data,$format); //DB Call OK, No Caching OK
4091 }
4092
4093 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4094
4095 }
4096
4097 if(!get_option('qc_wp_db_engine_update_free')){
4098
4099 $table1 = $wpdb->prefix.'wpbot_response';
4100
4101 // phpcs:ignore
4102 $wpdb->query("ALTER TABLE $table1 ENGINE = InnoDB");
4103
4104 update_option('qc_wp_db_engine_update_free', 'done');
4105 }
4106 if(!get_option('qc_wp_db_engine_update_free_unassign')){
4107
4108 $table1 = $wpdb->prefix.'wpbot_response';
4109
4110 // phpcs:ignore
4111 $wpdb->query("ALTER TABLE $table1 CHANGE `id` `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;");
4112
4113 update_option('qc_wp_db_engine_update_free_unassign', 'done');
4114 }
4115
4116 if(isset($_POST['qc_bot_str_query']) && $_POST['qc_bot_str_query']!='' && !class_exists('Qcld_str_pro')){
4117
4118
4119 if ( ! isset( $_POST['str_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['str_nonce'] ) ), 'str-nonce' ) ) {
4120 die( esc_html__( 'Security check failed', 'chatbot' ) );
4121 }
4122 $query = sanitize_text_field(wp_unslash($_POST['qc_bot_str_query']));
4123 $keyword = sanitize_text_field(wp_unslash($_POST['qc_bot_str_keyword']));
4124 $intent = sanitize_text_field(wp_unslash($_POST['qc_bot_str_intent']));
4125
4126 $category = '';
4127
4128 $response = wp_kses(wp_unslash($_POST['qc_bot_str_response']), 'post');
4129
4130 $table = $wpdb->prefix.'wpbot_response';
4131 $data = array('query' => $query, 'keyword' => $keyword, 'response'=> $response, 'intent'=> $intent, 'category'=> $category);
4132 $format = array('%s','%s', '%s', '%s', '%s');
4133
4134 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4135 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4136 $where = array('id'=>$id);
4137 $whereformat = array('%d');
4138 $wpdb->update( $table, $data, $where, $format, $whereformat ); //DB Call OK, No Caching OK
4139 }else{
4140 $wpdb->insert($table,$data,$format); //DB Call OK, No Caching OK
4141 }
4142
4143 qcld_mysql_remove_existing_indexes();
4144
4145 // phpcs:ignore
4146 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4147
4148 wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4149
4150 }
4151 $table = $wpdb->prefix.'wpbot_response';
4152
4153 if(isset($_POST['qc-re-index'])){
4154
4155 qcld_mysql_remove_existing_indexes();
4156
4157 // phpcs:ignore
4158 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`)");
4159
4160 add_action('admin_notices', 'general_admin_notice_str' );
4161
4162 }
4163 if(isset($_POST['qc_bot_str_weight']) && wp_unslash($_POST['qc_bot_str_weight'])!=''){
4164 $weight = sanitize_text_field(wp_unslash($_POST['qc_bot_str_weight']));
4165 update_option('qc_bot_str_weight', $weight);
4166 }
4167 if(isset($_POST['qc_bot_str_remove_stopwords']) && wp_unslash($_POST['qc_bot_str_remove_stopwords'])!=''){
4168
4169 $stopwords = sanitize_text_field(wp_unslash($_POST['qc_bot_str_remove_stopwords']));
4170 update_option('qc_bot_str_remove_stopwords', '1');
4171 }
4172 if ( isset($_POST['qc_bot_str_allow_author_editor']) && wp_unslash($_POST['qc_bot_str_allow_author_editor']) != '' ) {
4173 $qc_bot_str_allow_author_editor = sanitize_text_field(wp_unslash($_POST['qc_bot_str_allow_author_editor']));
4174 update_option( 'qc_bot_str_allow_author_editor', $qc_bot_str_allow_author_editor );
4175 } else {
4176 delete_option( 'qc_bot_str_allow_author_editor' );
4177 }
4178 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4179 $table = $wpdb->prefix.'wpbot_response';
4180 $fields = rest_sanitize_array(wp_unslash($_POST['qc_bot_str_fields']));
4181 update_option('qc_bot_str_fields', $fields);
4182 qcld_mysql_remove_existing_indexes();
4183
4184 if($fields && !empty($fields)){
4185
4186 // phpcs:ignore
4187 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
4188
4189 }
4190 }
4191
4192 if(!get_option('wpbot_preloading_time')) {
4193 update_option('wpbot_preloading_time', '800');
4194 }
4195 }
4196 }
4197 }
4198 }
4199 if( !function_exists('general_admin_notice_str') ){
4200 function general_admin_notice_str(){
4201 if ( isset($_GET['page']) && $_GET['page'] == 'simple-text-response' ) {
4202 echo '<div class="notice notice-success is-dismissible">
4203 <p>Re-Indexing has been completed!</p>
4204 </div>';
4205 }
4206 }
4207 }
4208 }
4209 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4210 function qcld_wpbot_simple_response_intent(){
4211 global $wpdb;
4212 $table = $wpdb->prefix.'wpbot_response';
4213 $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''"); //DB Call OK, No Caching OK
4214 $response = array();
4215 if(!empty($results)){
4216 foreach($results as $result){
4217 $response[] = $result->intent;
4218 }
4219 }
4220 return $response;
4221 }
4222 }
4223 if( !function_exists('qcld_mysql_remove_existing_indexes') ){
4224 function qcld_mysql_remove_existing_indexes(){
4225 global $wpdb;
4226 $table = $wpdb->prefix.'wpbot_response';
4227
4228 $results = $wpdb->get_results("SHOW INDEX FROM $table"); //DB Call OK, No Caching OK
4229 $indexes = array();
4230 foreach($results as $result){
4231
4232
4233
4234 if("PRIMARY" != $result->Key_name && !in_array($result->Key_name, $indexes)){
4235
4236 // phpcs:ignore
4237 $wpdb->query("ALTER TABLE $table DROP INDEX `".$result->Key_name."`;");
4238
4239 $indexes[] = $result->Key_name;
4240 }
4241
4242 }
4243 }
4244 }
4245
4246 add_action( 'activated_plugin', 'qc_wpbotfree_activation_redirect' );
4247 if( !function_exists('qc_wpbotfree_activation_redirect') ){
4248 function qc_wpbotfree_activation_redirect( $plugin ){
4249 $screen = get_current_screen();
4250 if( ( isset( $screen->base ) && $screen->base == 'plugins' ) && $plugin == plugin_basename( __FILE__ ) ) {
4251 if( $plugin == plugin_basename( __FILE__ ) ) {
4252 // phpcs:ignore
4253 exit( wp_redirect( esc_url( admin_url('admin.php?page=wpbot') ) ) );
4254 }
4255 }
4256 }
4257 }
4258
4259
4260