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

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

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