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

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

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