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

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