PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.3.7
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.3.7
8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 All 536 releases
← All changes | qcld-wpwbot.php +105 -294 8.7.0 → 8.3.7 View file →
@@ -1,11 +1,11 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: AI ChatBot - WPBot
4 - * Plugin URI: https://www.wpbot.pro/
4 + * Plugin URI: https://wordpress.org/plugins/chatbot/
5 5 * Description: ChatBot is a native WordPress ChatBot plugin to provide live chat support and lead generation
6 6 * Donate link: https://www.wpbot.pro/
7 - * Version: 8.7.0
7 + * Version: 8.3.7
8 8 * @author QuantumCloud
9 9 * Author: ChatBot for WordPress - WPBot
10 10 * Author URI: https://www.wpbot.pro/
11 11 * Requires at least: 4.6
@@ -18,40 +18,31 @@
18 18
19 19
20 20 if (!defined('ABSPATH')) exit; // Exit if accessed directly.
21 21
22 +add_action( 'plugins_loaded', 'qcld_chatbot_existing_plugin_activate_check_callback' );
23 +if( !function_exists('qcld_chatbot_existing_plugin_activate_check_callback') ){
24 + function qcld_chatbot_existing_plugin_activate_check_callback(){
22 25
26 + $check_existing_plugin = get_option('qcld_chatbot_existing_plugin_activate_check');
23 27
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 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;
29 + if ( class_exists( 'qcld_wb_Chatbot' ) && isset($check_existing_plugin) && ($check_existing_plugin !== 'yes') ) {
30 + update_option('qcld_chatbot_existing_plugin_activate_check', 'yes');
31 + }else if ( ! class_exists( 'qcld_wb_Chatbot' ) ) {
32 + delete_option('qcld_chatbot_existing_plugin_activate_check');
33 + }
34 +
39 35 }
40 36 }
41 37
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 - }
38 +$check_existing_plugin = get_option('qcld_chatbot_existing_plugin_activate_check');
39 +if ( isset($check_existing_plugin) && ($check_existing_plugin == 'yes') || class_exists( 'qcld_wb_Chatbot' ) ) {
40 + return;
50 41 }
51 42
52 43 if ( ! defined( 'QCLD_wpCHATBOT_VERSION' ) ) {
53 - define('QCLD_wpCHATBOT_VERSION', '8.7.0');
44 + define('QCLD_wpCHATBOT_VERSION', '8.3.7');
54 45 }
55 46 if ( ! defined( 'QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION' ) ) {
56 47 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
57 48 }
@@ -104,12 +95,8 @@
104 95 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld-floating-openai-style-filter.php' );
105 96 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld_openai_floating_content.php' );
106 97 // }
107 98
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 99 /**
113 100 * Main Class.
114 101 */
115 102
@@ -155,15 +142,15 @@
155 142 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
156 143
157 144 }
158 145
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') ){
146 + if( ( !empty($_GET['page']) && $_GET["page"] == "wpbot") || ( !empty($_GET['page']) && $_GET["page"] == "wpbot-panel")|| ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_openAi') || ( !empty($_GET['page']) && $_GET['page'] == 'simple-text-response') ){
160 147 // add_action( 'admin_notices', array( $this, 'promotion_notice' ) );
161 148
162 149 }
163 150
164 151 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')
152 +
166 153 || (!empty($_GET['page']) && $_GET['page']=='wpbot_openAi')
167 154
168 155 || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") ) {
169 156 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
@@ -249,24 +236,21 @@
249 236 $capability = 'publish_posts';
250 237 }else{
251 238 $capability = 'manage_options';
252 239 }
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 );
240 + add_menu_page( esc_html('ChatBot WPBot Lite'), esc_html('ChatBot WPBot Lite'), 'manage_options','wpbot-panel', array($this, 'qcld_wb_chatbot_admin_page'),'dashicons-format-status', 6 );
254 241
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') );
242 + add_submenu_page( 'wpbot-panel', esc_html('Settings'), esc_html('Settings'), 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
243 +
256 244 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' );
245 +
258 246 $hook = add_submenu_page( 'wpbot-panel', esc_html('Simple Text Responses'), esc_html('Simple Text Responses'), $capability,'simple-text-response', array($this, 'qcld_wb_chatbot_admin_str') );
247 +
259 248 add_action( "load-$hook", [ $this, 'screen_option' ] );
260 249
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 250 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
267 251
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' );
252 + add_submenu_page( 'wpbot-panel', esc_html('Support'), esc_html('Support'), 'manage_options','wpbot_support_page', 'qcpromo_wpbot_free_support_page_callback_func' );
269 253
270 254 add_submenu_page( 'wpbot-panel', esc_html('Help and Debugging'), esc_html('Help and Debugging'), 'manage_options','wpbot_help_page', 'wpbot_help_page_callback_func' );
271 255
272 256
@@ -332,9 +316,9 @@
332 316 wp_enqueue_script( 'wp-color-picker');
333 317 wp_enqueue_script( 'jquery-ui-sortable');
334 318 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
335 319 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);
320 + wp_register_script('qcld-wp-chatbot-cbpFWTabs', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/cbpFWTabs.js', basename(__FILE__)), array(), true);
337 321 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
338 322 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
339 323 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
340 324 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
@@ -355,9 +339,9 @@
355 339 wp_register_style('qcld-wp-chatbot-timepicker-css', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/jquery.timepicker.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
356 340 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
357 341 wp_register_script('qcld-wp-chatbot-sweetalrt', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/sweetalrt.js', basename(__FILE__)), array(), true);
358 342 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);
343 + wp_register_script('qcld-wp-chatbot-admin-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-admin.js', basename(__FILE__)), array('jquery', 'jquery-ui-core','jquery-ui-sortable','jquery-ui-droppable','wp-color-picker','qcld-wp-chatbot-timepicker-js'), true);
360 344 wp_enqueue_script('qcld-wp-chatbot-admin-js');
361 345 wp_localize_script('qcld-wp-chatbot-admin-js', 'qcld_gemini_admin_data',
362 346 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
363 347 // WordPress Media library
@@ -373,9 +357,9 @@
373 357 public function qcld_get_formbuilder_forms(){
374 358 global $wpdb;
375 359 $forms = array();
376 360 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
361 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
378 362 if(!empty($results)){
379 363 foreach($results as $result){
380 364 $form = maybe_unserialize($result->config);
381 365 $forms[] = trim($form['name']);
@@ -387,15 +371,12 @@
387 371 }else{
388 372 return array();
389 373 }
390 374 }
391 - public function qcld_wb_chatbot_admin_page1() {
392 - require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/admin/templates/email_subscription.php';
393 - }
394 375 public function qcld_wpbot_simple_response_intent(){
395 376 global $wpdb;
396 377 $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
378 + $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''"); //DB Call OK, No Caching OK
398 379 $response = array();
399 380 if(!empty($results)){
400 381 foreach($results as $result){
401 382 $response[] = $result->intent;
@@ -407,9 +388,9 @@
407 388 global $wpdb;
408 389 $command = array();
409 390 if(class_exists('Qcformbuilder_Forms_Admin')){
410 391 $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
392 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type = %s", $primary)); //DB Call OK, No Caching OK
412 393
413 394 if(!empty($results)){
414 395 foreach($results as $result){
415 396 $form = maybe_unserialize($result->config);
@@ -428,8 +409,9 @@
428 409 }
429 410 }
430 411 public function promotion_notice(){
431 412 $screen = get_current_screen();
413 + // var_dump($screen->base );
432 414 // if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
433 415 ?>
434 416 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #120976 !important">
435 417 <div class="">
@@ -446,9 +428,9 @@
446 428 public function qcld_get_formbuilder_form_ids(){
447 429 global $wpdb;
448 430 $forms = array();
449 431 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
432 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
451 433
452 434 if(!empty($results)){
453 435 foreach($results as $result){
454 436 $form = maybe_unserialize($result->config);
@@ -482,9 +464,9 @@
482 464 $conversation_form_ids = array();
483 465 $conversation_form_names = array();
484 466
485 467 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
468 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
487 469 if(!empty($results)){
488 470
489 471 foreach($results as $result){
490 472 $form = maybe_unserialize($result->config);
@@ -510,12 +492,12 @@
510 492 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
511 493 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
512 494 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
513 495 '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'))),
496 + 'agent' => str_replace(['\\','<','>'], '',esc_html(get_option('qlcd_wp_chatbot_agent'))),
515 497 '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')),
498 + 'agent_image_path' => (!empty(get_option('wp_chatbot_custom_icon_path')) && !is_404(get_option('wp_chatbot_custom_icon_path'))) ? $this->qcld_wb_chatbot_agent_icon() : QCLD_wpCHATBOT_IMG_URL . 'icon-1.png',
499 + 'shopper_demo_name' => str_replace('\\', '',get_option('qlcd_wp_chatbot_shopper_demo_name')),
518 500 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
519 501 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
520 502 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
521 503 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
@@ -541,54 +523,54 @@
541 523 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
542 524 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
543 525 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
544 526 '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'))),
527 + 'help_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
528 + 'back_to_start' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
529 + 'help_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
530 + 'reset' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_reset'))),
531 + 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
532 + 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
533 + 'featured_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
534 + 'sale_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
535 + 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
554 536 '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'))),
537 + 'product_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
538 + 'product_suggest' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
539 + 'product_infinite' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
540 + 'product_success' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_success'))),
541 + 'product_fail' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
542 + 'support_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
561 543 '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'))),
544 + 'support_option_again' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
545 + 'asking_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
546 + 'asking_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
547 + 'no_result' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_no_result'))),
566 548 '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'))),
549 + 'asking_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
550 + 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
551 + 'support_query' => ((gettype(get_option('support_query')) == 'string') ? $this->qcld_wb_chatbot_str_replace(unserialize( get_option('support_query'))) : $this->qcld_wb_chatbot_str_replace(( get_option('support_query')))),
552 + 'support_ans' => (gettype(get_option('support_ans')) == 'string') ? $this->qcld_wb_chatbot_str_replace(unserialize(get_option('support_ans'))) : $this->qcld_wb_chatbot_str_replace((get_option('support_ans'))),
571 553 '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'))),
554 + 'notifications' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_notifications'))),
555 + 'order_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
556 + 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
557 + 'order_username_password' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
576 558 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
577 559 'order_login' => is_user_logged_in(),
578 560 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
579 561 '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'))),
562 + 'order_email_support' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
581 563 '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'))),
564 + 'invalid_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
583 565 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
584 566 'currency_symbol' => '',
585 567 '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'))),
568 + 'messenger_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
587 569 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
588 570 'enable_skype' => get_option('enable_wp_chatbot_skype'),
589 571 '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'))),
572 + 'whats_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
591 573 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
592 574 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
593 575 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
594 576 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
@@ -603,9 +585,9 @@
603 585 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
604 586 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
605 587 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
606 588 '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'))),
589 + 'feedback_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
608 590 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
609 591 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
610 592 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
611 593 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
@@ -621,10 +603,8 @@
621 603 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
622 604 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
623 605 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
624 606 '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 607 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):800),
628 608 'inactive_time' => get_option('wp_chatbot_inactive_time'),
629 609 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
630 610 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
@@ -655,12 +635,8 @@
655 635 'current_user_id' => $user_id,
656 636 'display_name' => esc_html( $display_name ),
657 637 'skip_wp_greetings' => get_option('skip_wp_greetings'),
658 638 '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 639 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
664 640 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
665 641 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
666 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
@@ -666,10 +642,8 @@
666 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
667 643 'qlcd_wp_chatbot_report_text' => get_option('qlcd_wp_chatbot_report_text'),
668 644 'enable_chat_share_menu' => get_option('enable_chat_share_menu'),
669 645 '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 646
673 647 );
674 648 $user_font = get_option('wp_chatbot_user_font') != '' ? get_option('wp_chatbot_user_font') : '';
675 649 if($user_font != '' ){
@@ -788,11 +762,8 @@
788 762 $user_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_text_color') );
789 763 $wp_chatbot_text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
790 764 $user_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_bg_color') );
791 765 $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 766
796 767 $inline_chat_custom_styles .= "
797 768 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
798 769 color: ". $text_color ." !important;
@@ -884,11 +855,8 @@
884 855 font-style: ".$bot_font_family->fontStyle.";
885 856 font-size: ". get_option('wp_chatbot_font_size'). "px;
886 857 }
887 858
888 -
889 -
890 -
891 859 ";
892 860 }
893 861 if ( get_option('enable_wp_chatbot_custom_color') == 1 && ! empty($bot_font) ) {
894 862
@@ -911,9 +879,10 @@
911 879 font-style: {$font_style};
912 880 font-size: {$font_size};
913 881 }
914 882 ";
915 -
883 +
884 + wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
916 885 }
917 886
918 887 if(get_option('wp_chatbot_custom_css')!=""){
919 888
@@ -918,54 +887,8 @@
918 887 if(get_option('wp_chatbot_custom_css')!=""){
919 888
920 889 wp_add_inline_style( 'qcld-wp-chatbot-common-style', get_option('wp_chatbot_custom_css') );
921 890 }
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 891 }
969 892 public function qcld_wb_chatbot_str_replace($messages=array()){
970 893 $allowed_html = array(
971 894 'a' => array(
@@ -1110,9 +1033,9 @@
1110 1033
1111 1034 function qcld_wb_chatbot_save_options()
1112 1035 {
1113 1036 //global $wpcommerce;
1114 - if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'wp_chatbot') && current_user_can('manage_options')) {
1037 + if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'wp_chatbot')) {
1115 1038 // Check if the form is submitted or not.
1116 1039 $submit = sanitize_text_field(wp_unslash($_POST['submit']));
1117 1040 if (isset($submit)) {
1118 1041 //wpwboticon position settings.
@@ -1147,26 +1070,8 @@
1147 1070 if(isset( $_POST["skip_wp_greetings"])){
1148 1071 $skip_wp_greetings = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings"]));
1149 1072 }else{ $skip_wp_greetings='';}
1150 1073 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 1074 //Enable /disable wpwbot
1170 1075 if(isset( $_POST["disable_wp_chatbot"])){
1171 1076 $disable_wp_chatbot = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot"]));
1172 1077 }else{ $disable_wp_chatbot='';}
@@ -1213,21 +1118,9 @@
1213 1118 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
1214 1119 $enable_wp_chatbot_rtl = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_rtl"]));
1215 1120 }else{ $enable_wp_chatbot_rtl='';}
1216 1121 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 -
1122 +
1230 1123 if(isset( $_POST["show_menu_after_greetings"])) {
1231 1124 $show_menu_after_greetings = sanitize_text_field(wp_unslash($_POST["show_menu_after_greetings"]));
1232 1125 }else{ $show_menu_after_greetings='';}
1233 1126 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
@@ -1368,17 +1261,8 @@
1368 1261 update_option('wp_chatbot_icon', $wp_chatbot_icon);
1369 1262
1370 1263 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_floatingiconbg_color'])) : '#fff';
1371 1264 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 1265
1382 1266 // upload custom wpwbot icon path
1383 1267 $wp_chatbot_custom_icon_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_icon_path']));
1384 1268 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
@@ -1394,14 +1278,8 @@
1394 1278
1395 1279 //Theming
1396 1280 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field(wp_unslash($_POST['qcld_wb_chatbot_theme'])) : 'template-00');
1397 1281 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 1282 //Theme custom background option
1405 1283 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
1406 1284 $qcld_wb_chatbot_change_bg = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_change_bg"]));
1407 1285 }else{$qcld_wb_chatbot_change_bg='';}
@@ -2583,15 +2461,13 @@
2583 2461
2584 2462 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2585 2463 dbDelta( $sql_sliders_Table1 );
2586 2464
2587 -
2588 2465 //Bot Response Table
2589 2466 $table_rag_documents = $wpdb->prefix . "rag_documents";
2590 2467
2591 2468 $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
2469 + if ($wpdb->get_var("SHOW TABLES LIKE '$table_rag_documents'") != $table_rag_documents) {
2594 2470 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2595 2471 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2596 2472 doc_id VARCHAR(100) DEFAULT NULL,
2597 2473 title VARCHAR(255) NOT NULL,
@@ -2605,14 +2481,12 @@
2605 2481 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2606 2482 ) $charset;";
2607 2483 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2608 2484 dbDelta($sql_rag_documents);
2609 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2610 2485 }
2611 2486 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2612 2487
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
2488 + if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_report'" ) != $table_report ) {
2615 2489 $sql_report = "
2616 2490 CREATE TABLE `$table_report` (
2617 2491 `id` int(11) NOT NULL AUTO_INCREMENT,
2618 2492 `user_id` int(11) NOT NULL,
@@ -2626,40 +2500,20 @@
2626 2500 ";
2627 2501
2628 2502 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2629 2503 dbDelta( $sql_report );
2630 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2631 2504 }
2632 2505
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
2506 + $sqlqry = $wpdb->get_results($wpdb->prepare("select * from $table1 where id = %d", 1)); //DB Call OK, No Caching OK
2634 2507 if(empty($sqlqry)){
2635 2508
2636 - $query = 'Sample Question ?';
2637 - $response = 'Sample Answer';
2509 + $query = 'What Can WPBot do for you?';
2510 + $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
2638 2511
2639 2512 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2640 2513 $format = array('%s','%s', '%s', '%s');
2641 - $wpdb->insert($table1,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter
2514 + $wpdb->insert($table1,$data,$format); //DB Call OK, No Caching OK
2642 2515 }
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 2516
2663 2517 $url = get_site_url();
2664 2518 $url = wp_parse_url($url);
2665 2519 $domain = $url['host'];
@@ -2751,19 +2605,11 @@
2751 2605 if(!get_option('wp_chatbot_show_home_page')) {
2752 2606 update_option('wp_chatbot_show_home_page', 'on');
2753 2607 }
2754 2608 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);
2609 + update_option('qc_wpbot_menu_order', '');
2762 2610 }
2763 - if(!get_option('qcld_chatbot_avatar_location')) {
2764 - update_option('qcld_chatbot_avatar_location', 'side');
2765 - }
2611 +
2766 2612 if(!get_option('wp_chatbot_show_posts')) {
2767 2613 update_option('wp_chatbot_show_posts', 'on');
2768 2614 }
2769 2615 if(!get_option('wp_chatbot_show_pages')){
@@ -3090,12 +2936,12 @@
3090 2936 if(!get_option('qlcd_wp_chatbot_notifications')) {
3091 2937 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
3092 2938 }
3093 2939 if(!get_option('support_query')) {
3094 - update_option('support_query', maybe_serialize(array('Sample Question?')));
2940 + update_option('support_query', maybe_serialize(array('What is WPBot?')));
3095 2941 }
3096 2942 if(!get_option('support_ans')) {
3097 - update_option('support_ans', maybe_serialize(array('Sample Answer')));
2943 + update_option('support_ans', maybe_serialize(array('WPBot is a stand alone Chat Bot with zero configuration or bot training required. This plug and play chatbot also does not require any 3rd party service integration like Facebook. This chat bot helps shoppers find the products they are looking for easily and increase store sales! WPBot is a must have plugin for trending conversational commerce or conversational shopping.')));
3098 2944 }
3099 2945 if(!get_option('qlcd_wp_chatbot_search_option')) {
3100 2946 update_option('qlcd_wp_chatbot_search_option', 'standard');
3101 2947 }
@@ -3282,10 +3128,9 @@
3282 3128 }
3283 3129 if(!get_option('enable_wp_chatbot_opening_hour')) {
3284 3130 update_option('wpwbot_hours', array());
3285 3131 }
3286 - wpbot_free_set_content_height_defaults();
3287 -
3132 +
3288 3133 if(!get_option('enable_wp_chatbot_dailogflow')) {
3289 3134 update_option('enable_wp_chatbot_dailogflow', '');
3290 3135 }
3291 3136 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
@@ -3560,9 +3405,8 @@
3560 3405 delete_option('wp_chat_user_font_family');
3561 3406 delete_option('wp_chat_bot_font_family');
3562 3407 delete_option('wp_chatbot_bot_font');
3563 3408 delete_option('wp_chatbot_user_font');
3564 - delete_option('qcld_chatbot_avatar_location');
3565 3409 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3566 3410 qcld_wb_chatboot_defualt_options();
3567 3411 $html='Reset all options to default successfully.';
3568 3412 wp_send_json($html);
@@ -3568,22 +3412,8 @@
3568 3412 wp_send_json($html);
3569 3413 }
3570 3414 }
3571 3415
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 3416 if( !function_exists('wpbot_free_qc_upgrade_completed') ){
3587 3417 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
3588 3418 // The path to our plugin's main file
3589 3419 $our_plugin = plugin_basename( __FILE__ );
@@ -3592,9 +3422,8 @@
3592 3422 // Iterate through the plugins being updated and check if ours is there
3593 3423 foreach( $options['plugins'] as $plugin ) {
3594 3424 if( $plugin == $our_plugin ) {
3595 3425 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3596 - wpbot_free_set_content_height_defaults();
3597 3426 }
3598 3427 }
3599 3428 }
3600 3429 update_option( 'qcld_openai_relevant_post', ['post','page'] );
@@ -3616,17 +3445,9 @@
3616 3445 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3617 3446
3618 3447 }
3619 3448 }
3620 -if( !function_exists('wpbot_Ai_actions_func') ){
3621 - function wpbot_Ai_actions_func (){
3622 3449
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 3450 /**
3630 3451 *
3631 3452 * Function to load translation files.
3632 3453 *
@@ -3654,10 +3475,10 @@
3654 3475
3655 3476 <div class="wrap qcld-main-wrapper">
3656 3477 <div class="qcld-wp-chatbot-wrap-header">
3657 3478
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>
3479 + <div class="qcld-wp-chatbot-wrap-header-logo"><a href="#" class="qcld-wp-chatbot-wrap-site__logo"><img style="width:100%" src="<?php echo esc_url( QCLD_wpCHATBOT_IMG_URL . '/chatbot.png' ); ?>" alt="Dialogflow CX"> WPBot Control Panel </a>
3480 + <p><strong>Core Version:</strong> v<?php echo QCLD_wpCHATBOT_VERSION; ?></p>
3660 3481 </div>
3661 3482 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3662 3483 <li>
3663 3484 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
@@ -3695,16 +3516,16 @@
3695 3516 </div>
3696 3517 <div class="panel panel-default">
3697 3518 <div class="panel-heading" role="tab" id="headingSix">
3698 3519 <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>
3520 + <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseSix" aria-expanded="false" aria-controls="collapseSix"> <?php esc_html_e('Start Menu', 'chatbot'); ?> </a>
3700 3521 </h4>
3701 3522 </div>
3702 3523 <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
3703 3524 <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'); ?>
3525 + <?php echo esc_html_e('While using a ChatBot, users can get lost or not know how to Interact with the Bot. That is why we have a Start menu to always give the user', 'chatbot'); ?> <b><?php echo esc_html_e('options to do more', 'chatbot'); ?></b>. <?php echo esc_html_e('From ChatBot->Settings->Start Menu you can drag Available Menu Items (Intents) to the Active Menu Items area.', 'chatbot'); ?></br></br>
3526 + <?php echo esc_html_e('Besides the built-in Intents, you can also create custom Intents for your Start Menu using', 'chatbot'); ?> <b><?php echo esc_html_e('Simple Text Responses', 'chatbot'); ?></b> and <b><?php echo esc_html_e('Conversational form builder', 'chatbot'); ?></b>. <?php echo esc_html_e('You can create almost any kind of response with the combinations of the two.', 'chatbot'); ?></br></br>
3527 + <?php echo esc_html_e('We recommend enabling', 'chatbot'); ?><b><?php echo esc_html_e(' Show Start Menu After Greetings ', 'chatbot'); ?></b><?php echo esc_html_e('from ChatBot Pro->Settings->General settings.', 'chatbot'); ?>
3707 3528 </div>
3708 3529 </div>
3709 3530 </div>
3710 3531 <div class="panel panel-default">
@@ -3714,9 +3535,9 @@
3714 3535 </h4>
3715 3536 </div>
3716 3537 <div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
3717 3538 <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>
3539 + <?php echo esc_html_e('Head over to ChatBot Pro->Settings->General and make sure to Enable the Floating Icon. As soon as you do that, the ChatBot can start working for your users. Make sure to drag some items to the Active Menu area under the Start Menu.', 'chatbot'); ?></br></br>
3719 3540 <?php echo esc_html_e('The ChatBot settings area is full of options. Do not be intimidated by that. You do not need to use all the options – just what you need. Head over to the Settings->', 'chatbot'); ?><b><?php echo esc_html_e('Icons and Themes', 'chatbot'); ?></b> <?php echo esc_html_e('for options to customize your ChatBot. You will also find options to embed the ChatBot on a page, click to chat, FAQ builder etc. under the Setting options.', 'chatbot'); ?>
3720 3541 </div>
3721 3542 </div>
3722 3543 </div>
@@ -3836,9 +3657,9 @@
3836 3657 <div class="to-icon-txt fa-4x-txt ">
3837 3658 <h3>
3838 3659 <span>// </span><?php esc_html_e('Send eMail, Call Me Back &amp; Feedback Collection', 'chatbot'); ?>
3839 3660 </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>
3661 + <p><?php esc_html_e('Users can send a email to the site admin directly from the Chat window for customer support. The Call Me Back feature lets you get call requests from your customers which will be emailed to you. You can also use WPBot to collect Feedback from your customers regarding anything! You can disable/enable these features from the Start Menu.', 'chatbot'); ?></p>
3841 3662 </div>
3842 3663 </div>
3843 3664 <div class="to-icon-box left txt-left">
3844 3665 <div class="to-icon-txt fa-4x-txt ">
@@ -3892,9 +3713,9 @@
3892 3713 </h4>
3893 3714 </div>
3894 3715 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
3895 3716 <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>
3717 + <p><?php esc_html_e('Extend the Start Menu with the', 'chatbot'); ?> <strong><?php esc_html_e('powerful Conversational Forms', 'chatbot'); ?></strong>&nbsp;<?php esc_html_e(' Addon for WPBot. It extends WPBot’s functionality and adds the ability to create', 'chatbot'); ?> <strong><?php esc_html_e('conditional conversations', 'chatbot'); ?></strong> <?php esc_html_e('and/or', 'chatbot'); ?> <strong><?php esc_html_e('forms', 'chatbot'); ?></strong> <?php esc_html_e('for the WPBot. It is a visual,', 'chatbot'); ?> <strong><?php esc_html_e('drag and drop', 'chatbot'); ?></strong><?php esc_html_e(' form builder that is easy to use and very flexible. Supports conditional logic and use of variables to build all types of forms or just', 'chatbot'); ?> <strong><?php esc_html_e('menu driven', 'chatbot'); ?></strong>
3897 3718 <strong><?php esc_html_e('conversations', 'chatbot'); ?> </strong><?php esc_html_e('with if else logic', 'chatbot'); ?> <strong>. </strong><?php esc_html_e('Conversations or forms can be', 'chatbot'); ?> <strong><?php esc_html_e('eMailed', 'chatbot'); ?></strong> <?php esc_html_e('to you and', 'chatbot'); ?> <strong><?php esc_html_e('saved in the database', 'chatbot'); ?></strong>.
3898 3719 </p>
3899 3720 <h4><?php esc_html_e('Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.', 'chatbot'); ?></h4>
3900 3721 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank"><?php esc_html_e('Download Free Version', 'chatbot'); ?></a>
@@ -4160,9 +3981,9 @@
4160 3981 </h4>
4161 3982 </div>
4162 3983 <div id="faqcollapsetwelve" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwelve">
4163 3984 <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'); ?>
3985 + <?php echo esc_html_e('You can disable predefined intents FAQ, eMail, Call me from WPBot Lite > Settings page`s Start Menu Section.', 'chatbot'); ?>
4165 3986 </div>
4166 3987 </div>
4167 3988 </div>
4168 3989
@@ -4257,17 +4078,17 @@
4257 4078 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4258 4079 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4259 4080 }
4260 4081
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
4082 + $sqlqry = $wpdb->get_results( $wpdb->prepare( "select * from $table1 where id = %d", 1 ) ); //DB Call OK, No Caching OK
4262 4083 if(empty($sqlqry)){
4263 4084
4264 - $query = 'Sample Question?';
4265 - $response = 'Sample Answer';
4085 + $query = 'What Can WPBot do for you?';
4086 + $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
4266 4087
4267 4088 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4268 4089 $format = array('%s','%s', '%s', '%s');
4269 - $wpdb->insert($table1,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter
4090 + $wpdb->insert($table1,$data,$format); //DB Call OK, No Caching OK
4270 4091 }
4271 4092
4272 4093 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4273 4094
@@ -4313,11 +4134,11 @@
4313 4134 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4314 4135 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4315 4136 $where = array('id'=>$id);
4316 4137 $whereformat = array('%d');
4317 - $wpdb->update( $table, $data, $where, $format, $whereformat ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4138 + $wpdb->update( $table, $data, $where, $format, $whereformat ); //DB Call OK, No Caching OK
4318 4139 }else{
4319 - $wpdb->insert($table,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
4140 + $wpdb->insert($table,$data,$format); //DB Call OK, No Caching OK
4320 4141 }
4321 4142
4322 4143 qcld_mysql_remove_existing_indexes();
4323 4144
@@ -4323,9 +4144,9 @@
4323 4144
4324 4145 // phpcs:ignore
4325 4146 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4326 4147
4327 - wp_safe_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4148 + wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4328 4149
4329 4150 }
4330 4151 $table = $wpdb->prefix.'wpbot_response';
4331 4152
@@ -4356,27 +4177,15 @@
4356 4177 }
4357 4178 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4358 4179 $table = $wpdb->prefix.'wpbot_response';
4359 4180 $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 4181 update_option('qc_bot_str_fields', $fields);
4373 4182 qcld_mysql_remove_existing_indexes();
4374 4183
4375 4184 if($fields && !empty($fields)){
4376 - $safe_fields = array_map(function($f) { return '`' . $f . '`'; }, $fields);
4185 +
4377 4186 // phpcs:ignore
4378 - $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $safe_fields).")");
4187 + $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
4379 4188
4380 4189 }
4381 4190 }
4382 4191
@@ -4400,9 +4209,9 @@
4400 4209 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4401 4210 function qcld_wpbot_simple_response_intent(){
4402 4211 global $wpdb;
4403 4212 $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
4213 + $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''"); //DB Call OK, No Caching OK
4405 4214 $response = array();
4406 4215 if(!empty($results)){
4407 4216 foreach($results as $result){
4408 4217 $response[] = $result->intent;
@@ -4415,9 +4224,9 @@
4415 4224 function qcld_mysql_remove_existing_indexes(){
4416 4225 global $wpdb;
4417 4226 $table = $wpdb->prefix.'wpbot_response';
4418 4227
4419 - $results = $wpdb->get_results("SHOW INDEX FROM {$table}"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
4228 + $results = $wpdb->get_results("SHOW INDEX FROM $table"); //DB Call OK, No Caching OK
4420 4229 $indexes = array();
4421 4230 foreach($results as $result){
4422 4231
4423 4232
@@ -4445,4 +4254,6 @@
4445 4254 }
4446 4255 }
4447 4256 }
4448 4257 }
4258 +
4259 +