PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.3.8
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.3.8
8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
← All changes | qcld-wpwbot.php +87 -252 8.6.68.3.8 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.6.6
7 + * Version: 8.3.8
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.6.6');
44 + define('QCLD_wpCHATBOT_VERSION', '8.3.8');
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
@@ -249,14 +236,12 @@
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 242 add_submenu_page( 'wpbot-panel', esc_html('Settings'), esc_html('Settings'), 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
256 243
257 - add_submenu_page( 'wpbot-panel', esc_html('User Data'), esc_html('User Data'), 'manage_options','email-subscription', array($this, 'qcld_wb_chatbot_admin_page1') );
258 -
259 244 add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
260 245
261 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') );
262 247
@@ -263,9 +248,9 @@
263 248 add_action( "load-$hook", [ $this, 'screen_option' ] );
264 249
265 250 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
266 251
267 - 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' );
268 253
269 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' );
270 255
271 256
@@ -372,9 +357,9 @@
372 357 public function qcld_get_formbuilder_forms(){
373 358 global $wpdb;
374 359 $forms = array();
375 360 if(class_exists('Qcformbuilder_Forms_Admin')){
376 - $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
377 362 if(!empty($results)){
378 363 foreach($results as $result){
379 364 $form = maybe_unserialize($result->config);
380 365 $forms[] = trim($form['name']);
@@ -386,15 +371,12 @@
386 371 }else{
387 372 return array();
388 373 }
389 374 }
390 - public function qcld_wb_chatbot_admin_page1() {
391 - require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/admin/templates/email_subscription.php';
392 - }
393 375 public function qcld_wpbot_simple_response_intent(){
394 376 global $wpdb;
395 377 $table = $wpdb->prefix.'wpbot_response';
396 - $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
397 379 $response = array();
398 380 if(!empty($results)){
399 381 foreach($results as $result){
400 382 $response[] = $result->intent;
@@ -406,9 +388,9 @@
406 388 global $wpdb;
407 389 $command = array();
408 390 if(class_exists('Qcformbuilder_Forms_Admin')){
409 391 $primary = 'primary';
410 - $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
411 393
412 394 if(!empty($results)){
413 395 foreach($results as $result){
414 396 $form = maybe_unserialize($result->config);
@@ -427,8 +409,9 @@
427 409 }
428 410 }
429 411 public function promotion_notice(){
430 412 $screen = get_current_screen();
413 + // var_dump($screen->base );
431 414 // if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
432 415 ?>
433 416 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #120976 !important">
434 417 <div class="">
@@ -445,9 +428,9 @@
445 428 public function qcld_get_formbuilder_form_ids(){
446 429 global $wpdb;
447 430 $forms = array();
448 431 if(class_exists('Qcformbuilder_Forms_Admin')){
449 - $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
450 433
451 434 if(!empty($results)){
452 435 foreach($results as $result){
453 436 $form = maybe_unserialize($result->config);
@@ -481,9 +464,9 @@
481 464 $conversation_form_ids = array();
482 465 $conversation_form_names = array();
483 466
484 467 if(class_exists('Qcformbuilder_Forms_Admin')){
485 - $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
486 469 if(!empty($results)){
487 470
488 471 foreach($results as $result){
489 472 $form = maybe_unserialize($result->config);
@@ -509,12 +492,12 @@
509 492 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
510 493 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
511 494 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
512 495 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
513 - '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'))),
514 497 'agent_image' => get_option('wp_chatbot_agent_image'),
515 498 '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'),
516 - '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')),
499 + 'shopper_demo_name' => str_replace('\\', '',get_option('qlcd_wp_chatbot_shopper_demo_name')),
517 500 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
518 501 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
519 502 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
520 503 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
@@ -540,54 +523,54 @@
540 523 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
541 524 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
542 525 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
543 526 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
544 - 'help_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
545 - 'back_to_start' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
546 - 'help_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
547 - 'reset' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_reset'))),
548 - 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
549 - 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
550 - 'featured_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
551 - 'sale_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
552 - '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'))),
553 536 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
554 - 'product_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
555 - 'product_suggest' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
556 - 'product_infinite' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
557 - 'product_success' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_success'))),
558 - 'product_fail' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
559 - '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'))),
560 543 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
561 - 'support_option_again' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
562 - 'asking_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
563 - 'asking_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
564 - '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'))),
565 548 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
566 - 'asking_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
567 - 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
568 - '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')))),
569 - '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'))),
570 553 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
571 - 'notifications' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_notifications'))),
572 - 'order_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
573 - 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
574 - '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'))),
575 558 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
576 559 'order_login' => is_user_logged_in(),
577 560 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
578 561 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
579 - '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'))),
580 563 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
581 - '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'))),
582 565 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
583 566 'currency_symbol' => '',
584 567 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
585 - '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'))),
586 569 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
587 570 'enable_skype' => get_option('enable_wp_chatbot_skype'),
588 571 'enable_whats' => get_option('enable_wp_chatbot_whats'),
589 - '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'))),
590 573 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
591 574 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
592 575 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
593 576 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
@@ -602,9 +585,9 @@
602 585 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
603 586 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
604 587 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
605 588 'disable_faq' => get_option('disable_wp_chatbot_faq'),
606 - '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'))),
607 590 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
608 591 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
609 592 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
610 593 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
@@ -620,10 +603,8 @@
620 603 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
621 604 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
622 605 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
623 606 'mobile_full_screen' => '1',
624 - 'chatbot_content' => get_option( 'chatbot_content_max_height' ),
625 - 'chatbot_content_responsive' => get_option( 'chatbot_content_max_height_responsive' ),
626 607 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):800),
627 608 'inactive_time' => get_option('wp_chatbot_inactive_time'),
628 609 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
629 610 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
@@ -654,9 +635,8 @@
654 635 'current_user_id' => $user_id,
655 636 'display_name' => esc_html( $display_name ),
656 637 'skip_wp_greetings' => get_option('skip_wp_greetings'),
657 638 'skip_greetings_and_menu' => get_option('skip_wp_greetings_donot_show_menu'),
658 - 'ask_email_wp_greetings' => get_option('enable_asking_for_email'),
659 639 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
660 640 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
661 641 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
662 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
@@ -782,11 +762,8 @@
782 762 $user_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_text_color') );
783 763 $wp_chatbot_text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
784 764 $user_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_bg_color') );
785 765 $header_background_color = sanitize_hex_color( get_option('wp_chatbot_header_background_color') );
786 - $chatbot_content_max_height = sanitize_text_field( get_option('chatbot_content_max_height') );
787 - $chatbot_content_max_height_responsive = sanitize_text_field( get_option('chatbot_content_max_height_responsive') );
788 -
789 766
790 767 $inline_chat_custom_styles .= "
791 768 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
792 769 color: ". $text_color ." !important;
@@ -878,11 +855,8 @@
878 855 font-style: ".$bot_font_family->fontStyle.";
879 856 font-size: ". get_option('wp_chatbot_font_size'). "px;
880 857 }
881 858
882 -
883 -
884 -
885 859 ";
886 860 }
887 861 if ( get_option('enable_wp_chatbot_custom_color') == 1 && ! empty($bot_font) ) {
888 862
@@ -905,9 +879,10 @@
905 879 font-style: {$font_style};
906 880 font-size: {$font_size};
907 881 }
908 882 ";
909 -
883 +
884 + wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
910 885 }
911 886
912 887 if(get_option('wp_chatbot_custom_css')!=""){
913 888
@@ -912,53 +887,8 @@
912 887 if(get_option('wp_chatbot_custom_css')!=""){
913 888
914 889 wp_add_inline_style( 'qcld-wp-chatbot-common-style', get_option('wp_chatbot_custom_css') );
915 890 }
916 -
917 -
918 -
919 -
920 - if ( ( get_option( 'chatbot_content_max_height' ) != '' ) ) {
921 -
922 - $custom_colors .= ' .slimScrollDiv{
923 - height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
924 - max-height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
925 - }';
926 -
927 - $custom_colors .= 'div#wp-chatbot-board-container{
928 - height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 100px) !important;
929 - max-height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 100px) !important;
930 - }';
931 -
932 - $custom_colors .= '.wp-chatbot-content{
933 - height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
934 - max-height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
935 - }';
936 -
937 -
938 -
939 - $custom_colors .= '
940 - @media screen and (max-width: 480px) {
941 - div#wp-chatbot-board-container{
942 - height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 0px) !important;
943 - max-height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 0px) !important;
944 - }
945 -
946 - .slimScrollDiv{
947 - height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
948 - max-height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
949 - }
950 -
951 - .wp-chatbot-content{
952 - height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
953 - max-height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
954 - }
955 - }
956 - ';
957 -
958 -
959 - }
960 - wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
961 891 }
962 892 public function qcld_wb_chatbot_str_replace($messages=array()){
963 893 $allowed_html = array(
964 894 'a' => array(
@@ -1140,26 +1070,8 @@
1140 1070 if(isset( $_POST["skip_wp_greetings"])){
1141 1071 $skip_wp_greetings = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings"]));
1142 1072 }else{ $skip_wp_greetings='';}
1143 1073 update_option('skip_wp_greetings', wp_unslash($skip_wp_greetings));
1144 -
1145 - if( $skip_wp_greetings == '1' || $skip_wp_greetings_donot_show_menu == '1' ){
1146 - $ask_email_wp_greetings = '';
1147 - $enable_asking_for_email = '';
1148 - } else {
1149 - if (isset( $_POST["ask_email_wp_greetings"])) {
1150 - $ask_email_wp_greetings = sanitize_text_field(wp_unslash($_POST["ask_email_wp_greetings"]));
1151 - } else {
1152 - $ask_email_wp_greetings = '';
1153 - }
1154 - if (isset( $_POST["enable_asking_for_email"])) {
1155 - $enable_asking_for_email = sanitize_text_field(wp_unslash($_POST["enable_asking_for_email"]));
1156 - } else {
1157 - $enable_asking_for_email = '';
1158 - }
1159 - }
1160 - update_option('ask_email_wp_greetings', wp_unslash($ask_email_wp_greetings));
1161 - update_option('enable_asking_for_email', wp_unslash($enable_asking_for_email));
1162 1074 //Enable /disable wpwbot
1163 1075 if(isset( $_POST["disable_wp_chatbot"])){
1164 1076 $disable_wp_chatbot = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot"]));
1165 1077 }else{ $disable_wp_chatbot='';}
@@ -1206,21 +1118,9 @@
1206 1118 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
1207 1119 $enable_wp_chatbot_rtl = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_rtl"]));
1208 1120 }else{ $enable_wp_chatbot_rtl='';}
1209 1121 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
1210 -
1211 - if(isset( $_POST["chatbot_content_max_height"])) {
1212 - $chatbot_content_max_height = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height"]));
1213 - }else{ $chatbot_content_max_height='';}
1214 - update_option('chatbot_content_max_height', wp_unslash($chatbot_content_max_height));
1215 -
1216 -
1217 - if(isset( $_POST["chatbot_content_max_height_responsive"])) {
1218 - $chatbot_content_max_height_responsive = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height_responsive"]));
1219 - }else{ $chatbot_content_max_height_responsive='';}
1220 - update_option('chatbot_content_max_height_responsive', wp_unslash($chatbot_content_max_height_responsive));
1221 -
1222 -
1122 +
1223 1123 if(isset( $_POST["show_menu_after_greetings"])) {
1224 1124 $show_menu_after_greetings = sanitize_text_field(wp_unslash($_POST["show_menu_after_greetings"]));
1225 1125 }else{ $show_menu_after_greetings='';}
1226 1126 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
@@ -1378,14 +1278,8 @@
1378 1278
1379 1279 //Theming
1380 1280 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field(wp_unslash($_POST['qcld_wb_chatbot_theme'])) : 'template-00');
1381 1281 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
1382 -
1383 - //Avatar Location
1384 - if(isset($_POST['qcld_chatbot_avatar_location'])) {
1385 - $qcld_chatbot_avatar_location = sanitize_text_field(wp_unslash($_POST['qcld_chatbot_avatar_location']));
1386 - update_option('qcld_chatbot_avatar_location', $qcld_chatbot_avatar_location);
1387 - }
1388 1282 //Theme custom background option
1389 1283 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
1390 1284 $qcld_wb_chatbot_change_bg = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_change_bg"]));
1391 1285 }else{$qcld_wb_chatbot_change_bg='';}
@@ -2567,15 +2461,13 @@
2567 2461
2568 2462 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2569 2463 dbDelta( $sql_sliders_Table1 );
2570 2464
2571 -
2572 2465 //Bot Response Table
2573 2466 $table_rag_documents = $wpdb->prefix . "rag_documents";
2574 2467
2575 2468 $charset = $wpdb->get_charset_collate();
2576 - 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
2577 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2469 + if ($wpdb->get_var("SHOW TABLES LIKE '$table_rag_documents'") != $table_rag_documents) {
2578 2470 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2579 2471 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2580 2472 doc_id VARCHAR(100) DEFAULT NULL,
2581 2473 title VARCHAR(255) NOT NULL,
@@ -2589,14 +2481,12 @@
2589 2481 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2590 2482 ) $charset;";
2591 2483 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2592 2484 dbDelta($sql_rag_documents);
2593 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2594 2485 }
2595 2486 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2596 2487
2597 - 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
2598 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2488 + if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_report'" ) != $table_report ) {
2599 2489 $sql_report = "
2600 2490 CREATE TABLE `$table_report` (
2601 2491 `id` int(11) NOT NULL AUTO_INCREMENT,
2602 2492 `user_id` int(11) NOT NULL,
@@ -2610,40 +2500,20 @@
2610 2500 ";
2611 2501
2612 2502 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2613 2503 dbDelta( $sql_report );
2614 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2615 2504 }
2616 2505
2617 - $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
2618 2507 if(empty($sqlqry)){
2619 2508
2620 - $query = 'Sample Question ?';
2621 - $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!';
2622 2511
2623 2512 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2624 2513 $format = array('%s','%s', '%s', '%s');
2625 - $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
2626 2515 }
2627 -
2628 - $table = $wpdb->prefix . 'wpbot_subscription';
2629 - 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
2630 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2631 - $sql_sliders_Table = "
2632 - CREATE TABLE IF NOT EXISTS `$table` (
2633 - `id` int(11) NOT NULL AUTO_INCREMENT,
2634 - `name` varchar(256) NOT NULL,
2635 - `email` varchar(256) NOT NULL,
2636 - `phone` varchar(256) NOT NULL,
2637 - `url` text NOT NULL,
2638 - `date` datetime NOT NULL,
2639 - `user_agent` text NOT NULL,
2640 - PRIMARY KEY (`id`)
2641 - ) $collate AUTO_INCREMENT=1 ";
2642 - require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2643 - dbDelta($sql_sliders_Table);
2644 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2645 - }
2646 2516
2647 2517 $url = get_site_url();
2648 2518 $url = wp_parse_url($url);
2649 2519 $domain = $url['host'];
@@ -2735,19 +2605,11 @@
2735 2605 if(!get_option('wp_chatbot_show_home_page')) {
2736 2606 update_option('wp_chatbot_show_home_page', 'on');
2737 2607 }
2738 2608 if(!get_option('qc_wpbot_menu_order')) {
2739 - $site_search_label = get_option('qlcd_wp_chatbot_wildcard_site_search') != '' ? get_option('qlcd_wp_chatbot_wildcard_site_search') : 'Site Search';
2740 - $support_email_label = get_option('qlcd_wp_chatbot_support_email') != '' ? get_option('qlcd_wp_chatbot_support_email') : 'Send us Email.';
2741 - $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!';
2742 - $default_menu = '<span class="qcld-chatbot-wildcard qc_draggable_item qcld-chatbot-site-search" data-wildcart="site_search">' . esc_attr($site_search_label) . '</span>';
2743 - $default_menu .= '<span class="qcld-chatbot-suggest-email qc_draggable_item">' . esc_attr($support_email_label) . '</span>';
2744 - $default_menu .= '<span class="qcld-chatbot-suggest-phone qc_draggable_item">' . esc_attr($support_phone_label) . '</span>';
2745 - update_option('qc_wpbot_menu_order', $default_menu);
2609 + update_option('qc_wpbot_menu_order', '');
2746 2610 }
2747 - if(!get_option('qcld_chatbot_avatar_location')) {
2748 - update_option('qcld_chatbot_avatar_location', 'side');
2749 - }
2611 +
2750 2612 if(!get_option('wp_chatbot_show_posts')) {
2751 2613 update_option('wp_chatbot_show_posts', 'on');
2752 2614 }
2753 2615 if(!get_option('wp_chatbot_show_pages')){
@@ -3074,12 +2936,12 @@
3074 2936 if(!get_option('qlcd_wp_chatbot_notifications')) {
3075 2937 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
3076 2938 }
3077 2939 if(!get_option('support_query')) {
3078 - update_option('support_query', maybe_serialize(array('Sample Question?')));
2940 + update_option('support_query', maybe_serialize(array('What is WPBot?')));
3079 2941 }
3080 2942 if(!get_option('support_ans')) {
3081 - 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.')));
3082 2944 }
3083 2945 if(!get_option('qlcd_wp_chatbot_search_option')) {
3084 2946 update_option('qlcd_wp_chatbot_search_option', 'standard');
3085 2947 }
@@ -3266,10 +3128,9 @@
3266 3128 }
3267 3129 if(!get_option('enable_wp_chatbot_opening_hour')) {
3268 3130 update_option('wpwbot_hours', array());
3269 3131 }
3270 - wpbot_free_set_content_height_defaults();
3271 -
3132 +
3272 3133 if(!get_option('enable_wp_chatbot_dailogflow')) {
3273 3134 update_option('enable_wp_chatbot_dailogflow', '');
3274 3135 }
3275 3136 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
@@ -3544,9 +3405,8 @@
3544 3405 delete_option('wp_chat_user_font_family');
3545 3406 delete_option('wp_chat_bot_font_family');
3546 3407 delete_option('wp_chatbot_bot_font');
3547 3408 delete_option('wp_chatbot_user_font');
3548 - delete_option('qcld_chatbot_avatar_location');
3549 3409 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3550 3410 qcld_wb_chatboot_defualt_options();
3551 3411 $html='Reset all options to default successfully.';
3552 3412 wp_send_json($html);
@@ -3552,22 +3412,8 @@
3552 3412 wp_send_json($html);
3553 3413 }
3554 3414 }
3555 3415
3556 -if( !function_exists('wpbot_free_set_content_height_defaults') ){
3557 - function wpbot_free_set_content_height_defaults() {
3558 - $chatbot_content_max_height = get_option( 'chatbot_content_max_height', false );
3559 - if ( $chatbot_content_max_height === false || $chatbot_content_max_height === '' ) {
3560 - update_option( 'chatbot_content_max_height', '80' );
3561 - }
3562 -
3563 - $chatbot_content_max_height_responsive = get_option( 'chatbot_content_max_height_responsive', false );
3564 - if ( $chatbot_content_max_height_responsive === false || $chatbot_content_max_height_responsive === '' ) {
3565 - update_option( 'chatbot_content_max_height_responsive', '90' );
3566 - }
3567 - }
3568 -}
3569 -
3570 3416 if( !function_exists('wpbot_free_qc_upgrade_completed') ){
3571 3417 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
3572 3418 // The path to our plugin's main file
3573 3419 $our_plugin = plugin_basename( __FILE__ );
@@ -3576,9 +3422,8 @@
3576 3422 // Iterate through the plugins being updated and check if ours is there
3577 3423 foreach( $options['plugins'] as $plugin ) {
3578 3424 if( $plugin == $our_plugin ) {
3579 3425 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3580 - wpbot_free_set_content_height_defaults();
3581 3426 }
3582 3427 }
3583 3428 }
3584 3429 update_option( 'qcld_openai_relevant_post', ['post','page'] );
@@ -3630,10 +3475,10 @@
3630 3475
3631 3476 <div class="wrap qcld-main-wrapper">
3632 3477 <div class="qcld-wp-chatbot-wrap-header">
3633 3478
3634 - <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>
3635 - <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>
3636 3481 </div>
3637 3482 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3638 3483 <li>
3639 3484 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
@@ -4233,17 +4078,17 @@
4233 4078 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4234 4079 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4235 4080 }
4236 4081
4237 - $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
4238 4083 if(empty($sqlqry)){
4239 4084
4240 - $query = 'Sample Question?';
4241 - $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!';
4242 4087
4243 4088 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4244 4089 $format = array('%s','%s', '%s', '%s');
4245 - $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
4246 4091 }
4247 4092
4248 4093 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4249 4094
@@ -4289,11 +4134,11 @@
4289 4134 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4290 4135 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4291 4136 $where = array('id'=>$id);
4292 4137 $whereformat = array('%d');
4293 - $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
4294 4139 }else{
4295 - $wpdb->insert($table,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
4140 + $wpdb->insert($table,$data,$format); //DB Call OK, No Caching OK
4296 4141 }
4297 4142
4298 4143 qcld_mysql_remove_existing_indexes();
4299 4144
@@ -4299,9 +4144,9 @@
4299 4144
4300 4145 // phpcs:ignore
4301 4146 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4302 4147
4303 - wp_safe_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4148 + wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4304 4149
4305 4150 }
4306 4151 $table = $wpdb->prefix.'wpbot_response';
4307 4152
@@ -4332,27 +4177,15 @@
4332 4177 }
4333 4178 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4334 4179 $table = $wpdb->prefix.'wpbot_response';
4335 4180 $fields = rest_sanitize_array(wp_unslash($_POST['qc_bot_str_fields']));
4336 -
4337 - $allowed_fields = array('query', 'keyword', 'response');
4338 - $valid_fields = array();
4339 - if(is_array($fields)){
4340 - foreach($fields as $field){
4341 - if(in_array($field, $allowed_fields)){
4342 - $valid_fields[] = $field;
4343 - }
4344 - }
4345 - }
4346 - $fields = $valid_fields;
4347 -
4348 4181 update_option('qc_bot_str_fields', $fields);
4349 4182 qcld_mysql_remove_existing_indexes();
4350 4183
4351 4184 if($fields && !empty($fields)){
4352 - $safe_fields = array_map(function($f) { return '`' . $f . '`'; }, $fields);
4185 +
4353 4186 // phpcs:ignore
4354 - $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $safe_fields).")");
4187 + $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
4355 4188
4356 4189 }
4357 4190 }
4358 4191
@@ -4376,9 +4209,9 @@
4376 4209 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4377 4210 function qcld_wpbot_simple_response_intent(){
4378 4211 global $wpdb;
4379 4212 $table = $wpdb->prefix.'wpbot_response';
4380 - $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
4381 4214 $response = array();
4382 4215 if(!empty($results)){
4383 4216 foreach($results as $result){
4384 4217 $response[] = $result->intent;
@@ -4391,9 +4224,9 @@
4391 4224 function qcld_mysql_remove_existing_indexes(){
4392 4225 global $wpdb;
4393 4226 $table = $wpdb->prefix.'wpbot_response';
4394 4227
4395 - $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
4396 4229 $indexes = array();
4397 4230 foreach($results as $result){
4398 4231
4399 4232
@@ -4421,4 +4254,6 @@
4421 4254 }
4422 4255 }
4423 4256 }
4424 4257 }
4258 +
4259 +