PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 7.6.8
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v7.6.8
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 7.6.8, at qcld-wpwbot.php

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