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 +107 -508 8.7.28.3.8 View file →
@@ -1,16 +1,16 @@
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.2
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
12 - * Tested up to: 7.1
12 + * Tested up to: 7.0
13 13 * Text Domain: chatbot
14 14 * Domain Path: /languages
15 15 * License: GPL2
16 16 */
@@ -18,38 +18,31 @@
18 18
19 19
20 20 if (!defined('ABSPATH')) exit; // Exit if accessed directly.
21 21
22 -// Abort execution if Pro version is active to prevent conflicts
23 -if ( ! function_exists( 'is_plugin_active' ) ) {
24 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
25 -}
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(){
26 25
27 -$active_plugins = (array) get_option( 'active_plugins', array() );
28 -if ( is_multisite() ) {
29 - $active_plugins = array_merge( $active_plugins, array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) ) );
30 -}
26 + $check_existing_plugin = get_option('qcld_chatbot_existing_plugin_activate_check');
31 27
32 -$current_plugin = plugin_basename( __FILE__ );
33 28
34 -foreach ( $active_plugins as $plugin ) {
35 - if ( $plugin !== $current_plugin && basename( $plugin ) === 'qcld-wpwbot.php' ) {
36 - 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 +
37 35 }
38 36 }
39 37
40 -// Also abort if we are currently activating the Pro plugin
41 -if ( isset($_REQUEST['action']) ) {
42 - 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 ) ) ) {
43 - return;
44 - }
45 - 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']) ) ) {
46 - return;
47 - }
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;
48 41 }
49 42
50 43 if ( ! defined( 'QCLD_wpCHATBOT_VERSION' ) ) {
51 - define('QCLD_wpCHATBOT_VERSION', '8.8.0');
44 + define('QCLD_wpCHATBOT_VERSION', '8.3.8');
52 45 }
53 46 if ( ! defined( 'QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION' ) ) {
54 47 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
55 48 }
@@ -87,9 +80,8 @@
87 80 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openai/qcld-bot-openai.php");
88 81 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openrouter/qcld-bot-openrouter.php");
89 82 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/gemini/qcld-bot-gemini.php");
90 83 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/grok/qcld-bot-grok.php");
91 -require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/claude/qcld-bot-claude.php");
92 84 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."class-qc-free-plugin-upgrade-notice.php");
93 85 require_once("class-plugin-deactivate-feedback.php");
94 86 require_once("qc-support-promo-page/class-qc-support-promo-page.php");
95 87 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."/functions.php");
@@ -103,12 +95,8 @@
103 95 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld-floating-openai-style-filter.php' );
104 96 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld_openai_floating_content.php' );
105 97 // }
106 98
107 -// Built-in Chat Sessions & Analytics module.
108 -// Defers to the Pro addon automatically when it's active.
109 -require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/chat-sessions/wpbot-chat-sessions.php' );
110 -
111 99 /**
112 100 * Main Class.
113 101 */
114 102
@@ -154,18 +142,18 @@
154 142 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
155 143
156 144 }
157 145
158 - 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') ){
159 147 // add_action( 'admin_notices', array( $this, 'promotion_notice' ) );
160 148
161 149 }
162 150
163 151 if (is_admin() && !empty($_GET["page"]) && ($_GET["page"] == "wpbot") || (!empty($_GET['page']) && $_GET['page']=='wpbot_help_page')
164 - || ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_ai_actions')
152 +
165 153 || (!empty($_GET['page']) && $_GET['page']=='wpbot_openAi')
166 154
167 - || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") || ( !empty($_GET['page']) && $_GET["page"] == "wpbot_ai_actions") ) {
155 + || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") ) {
168 156 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
169 157 if( get_option('wp_chatbot_index_count')<=0 && get_option('qlcd_wp_chatbot_search_option')=='advanced'){
170 158
171 159 add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
@@ -184,20 +172,9 @@
184 172 if (!is_admin() && get_option('disable_wp_chatbot') != 1 && wp_chatbot_load_controlling() === true) {
185 173 add_action('wp_enqueue_scripts', array($this, 'qcld_wb_chatbot_frontend_scripts'));
186 174 }
187 175 }
188 - public function qcld_register_ai_form_cpt() {
189 - $args = array(
190 - 'public' => false,
191 - 'show_ui' => true,
192 - 'show_in_menu' => 'wpbot', // under WPBot menu
193 - 'label' => 'AI Form Entries',
194 - 'supports' => array('title', 'custom-fields')
195 - );
196 - register_post_type('wpbot_form_entry', $args);
197 - }
198 176 public function qcld_wpchatbot_init2_fnc(){
199 - $this->qcld_register_ai_form_cpt();
200 177 global $wpdb;
201 178 if( is_admin() ){
202 179
203 180 $connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
@@ -259,25 +236,21 @@
259 236 $capability = 'publish_posts';
260 237 }else{
261 238 $capability = 'manage_options';
262 239 }
263 - 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 );
264 241
265 - 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 +
266 244 add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
267 - add_submenu_page( 'wpbot-panel', esc_html('AI Actions'), esc_html('AI Actions'), 'manage_options','wpbot_ai_actions', 'wpbot_Ai_actions_func' );
245 +
268 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 +
269 248 add_action( "load-$hook", [ $this, 'screen_option' ] );
270 249
271 - add_submenu_page( 'wpbot-panel', esc_html('User Data'), esc_html('User Data'), 'manage_options','email-subscription', array($this, 'qcld_wb_chatbot_admin_page1') );
272 -
273 -
274 - //$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') );
275 -
276 -
277 250 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
278 251
279 - 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' );
280 253
281 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' );
282 255
283 256
@@ -316,9 +289,9 @@
316 289 global $wpcommerce, $wp_scripts;
317 290 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
318 291
319 292 if (((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) || ($hook == "widgets.php") || $_GET['page']=='wpbot_help_page' || $_GET['page']=='wpbot_openAi' || $_GET['page']=='simple-text-response'
320 - || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" || $_GET["page"] == "wpbot_ai_actions" ) {
293 + || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" ) {
321 294
322 295 wp_enqueue_script('jquery');
323 296 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
324 297
@@ -343,9 +316,9 @@
343 316 wp_enqueue_script( 'wp-color-picker');
344 317 wp_enqueue_script( 'jquery-ui-sortable');
345 318 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
346 319 wp_enqueue_script('qcld-wp-fontpicker');
347 - 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);
348 321 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
349 322 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
350 323 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
351 324 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
@@ -366,9 +339,9 @@
366 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');
367 340 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
368 341 wp_register_script('qcld-wp-chatbot-sweetalrt', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/sweetalrt.js', basename(__FILE__)), array(), true);
369 342 wp_enqueue_script('qcld-wp-chatbot-sweetalrt');
370 - 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);
371 344 wp_enqueue_script('qcld-wp-chatbot-admin-js');
372 345 wp_localize_script('qcld-wp-chatbot-admin-js', 'qcld_gemini_admin_data',
373 346 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
374 347 // WordPress Media library
@@ -384,9 +357,9 @@
384 357 public function qcld_get_formbuilder_forms(){
385 358 global $wpdb;
386 359 $forms = array();
387 360 if(class_exists('Qcformbuilder_Forms_Admin')){
388 - $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
389 362 if(!empty($results)){
390 363 foreach($results as $result){
391 364 $form = maybe_unserialize($result->config);
392 365 $forms[] = trim($form['name']);
@@ -398,15 +371,12 @@
398 371 }else{
399 372 return array();
400 373 }
401 374 }
402 - public function qcld_wb_chatbot_admin_page1() {
403 - require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/admin/templates/email_subscription.php';
404 - }
405 375 public function qcld_wpbot_simple_response_intent(){
406 376 global $wpdb;
407 377 $table = $wpdb->prefix.'wpbot_response';
408 - $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
409 379 $response = array();
410 380 if(!empty($results)){
411 381 foreach($results as $result){
412 382 $response[] = $result->intent;
@@ -418,9 +388,9 @@
418 388 global $wpdb;
419 389 $command = array();
420 390 if(class_exists('Qcformbuilder_Forms_Admin')){
421 391 $primary = 'primary';
422 - $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
423 393
424 394 if(!empty($results)){
425 395 foreach($results as $result){
426 396 $form = maybe_unserialize($result->config);
@@ -439,8 +409,9 @@
439 409 }
440 410 }
441 411 public function promotion_notice(){
442 412 $screen = get_current_screen();
413 + // var_dump($screen->base );
443 414 // if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
444 415 ?>
445 416 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #120976 !important">
446 417 <div class="">
@@ -457,9 +428,9 @@
457 428 public function qcld_get_formbuilder_form_ids(){
458 429 global $wpdb;
459 430 $forms = array();
460 431 if(class_exists('Qcformbuilder_Forms_Admin')){
461 - $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
462 433
463 434 if(!empty($results)){
464 435 foreach($results as $result){
465 436 $form = maybe_unserialize($result->config);
@@ -493,9 +464,9 @@
493 464 $conversation_form_ids = array();
494 465 $conversation_form_names = array();
495 466
496 467 if(class_exists('Qcformbuilder_Forms_Admin')){
497 - $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
498 469 if(!empty($results)){
499 470
500 471 foreach($results as $result){
501 472 $form = maybe_unserialize($result->config);
@@ -521,12 +492,12 @@
521 492 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
522 493 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
523 494 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
524 495 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
525 - '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'))),
526 497 'agent_image' => get_option('wp_chatbot_agent_image'),
527 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'),
528 - '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')),
529 500 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
530 501 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
531 502 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
532 503 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
@@ -552,54 +523,54 @@
552 523 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
553 524 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
554 525 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
555 526 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
556 - 'help_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
557 - 'back_to_start' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
558 - 'help_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
559 - 'reset' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_reset'))),
560 - 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
561 - 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
562 - 'featured_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
563 - 'sale_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
564 - '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'))),
565 536 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
566 - 'product_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
567 - 'product_suggest' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
568 - 'product_infinite' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
569 - 'product_success' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_success'))),
570 - 'product_fail' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
571 - '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'))),
572 543 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
573 - 'support_option_again' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
574 - 'asking_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
575 - 'asking_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
576 - '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'))),
577 548 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
578 - 'asking_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
579 - 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
580 - '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')))),
581 - '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'))),
582 553 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
583 - 'notifications' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_notifications'))),
584 - 'order_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
585 - 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
586 - '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'))),
587 558 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
588 559 'order_login' => is_user_logged_in(),
589 560 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
590 561 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
591 - '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'))),
592 563 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
593 - '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'))),
594 565 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
595 566 'currency_symbol' => '',
596 567 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
597 - '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'))),
598 569 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
599 570 'enable_skype' => get_option('enable_wp_chatbot_skype'),
600 571 'enable_whats' => get_option('enable_wp_chatbot_whats'),
601 - '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'))),
602 573 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
603 574 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
604 575 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
605 576 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
@@ -614,9 +585,9 @@
614 585 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
615 586 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
616 587 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
617 588 'disable_faq' => get_option('disable_wp_chatbot_faq'),
618 - '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'))),
619 590 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
620 591 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
621 592 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
622 593 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
@@ -632,10 +603,8 @@
632 603 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
633 604 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
634 605 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
635 606 'mobile_full_screen' => '1',
636 - 'chatbot_content' => get_option( 'chatbot_content_max_height' ),
637 - 'chatbot_content_responsive' => get_option( 'chatbot_content_max_height_responsive' ),
638 607 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):800),
639 608 'inactive_time' => get_option('wp_chatbot_inactive_time'),
640 609 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
641 610 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
@@ -666,12 +635,8 @@
666 635 'current_user_id' => $user_id,
667 636 'display_name' => esc_html( $display_name ),
668 637 'skip_wp_greetings' => get_option('skip_wp_greetings'),
669 638 'skip_greetings_and_menu' => get_option('skip_wp_greetings_donot_show_menu'),
670 - 'skip_wp_greetings_trigger_intent' => get_option('skip_wp_greetings_trigger_intent'),
671 - 'intent_for_non_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_non_logged_in_user'),
672 - 'intent_for_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_logged_in_user'),
673 - 'ask_email_wp_greetings' => get_option('enable_asking_for_email'),
674 639 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
675 640 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
676 641 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
677 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
@@ -677,10 +642,8 @@
677 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
678 643 'qlcd_wp_chatbot_report_text' => get_option('qlcd_wp_chatbot_report_text'),
679 644 'enable_chat_share_menu' => get_option('enable_chat_share_menu'),
680 645 'qlcd_wp_chatbot_share_text' => get_option('qlcd_wp_chatbot_share_text'),
681 - 'icon_video' => get_option('wp_chatbot_icon_video', ''),
682 - 'icon_video_delay' => absint(get_option('wp_chatbot_icon_video_delay', 0)),
683 646
684 647 );
685 648 $user_font = get_option('wp_chatbot_user_font') != '' ? get_option('wp_chatbot_user_font') : '';
686 649 if($user_font != '' ){
@@ -728,18 +691,8 @@
728 691 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
729 692 wp_register_script('qcld-wp-chatbot-plugin', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-plugin.js', basename(__FILE__)), array('jquery', 'qcld-wp-chatbot-jquery-cookie','qcld-wp-chatbot-magnify-popup'), QCLD_wpCHATBOT_VERSION, true);
730 693 wp_enqueue_script('qcld-wp-chatbot-plugin');
731 694
732 - $saved_ai_forms = get_option('wpbot_ai_forms', array());
733 - $ai_form_titles = array();
734 - if (is_array($saved_ai_forms)) {
735 - foreach ($saved_ai_forms as $form) {
736 - if (!isset($form['interactive']) || $form['interactive'] == 1) {
737 - $ai_form_titles[] = trim(strtolower($form['title']));
738 - }
739 - }
740 - }
741 -
742 695 $nonce = wp_create_nonce('wp_chatbot');
743 696 // Pass data to JS
744 697 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
745 698 'ajax_url' => admin_url('admin-ajax.php'),
@@ -744,9 +697,8 @@
744 697 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
745 698 'ajax_url' => admin_url('admin-ajax.php'),
746 699 'nonce' => $nonce,
747 700 'stream_endpoint' => admin_url('admin-ajax.php?action=qcld_stream_openai'),
748 - 'ai_form_titles' => $ai_form_titles,
749 701 ]);
750 702
751 703 wp_register_script('qcld-wp-chatbot-front-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-front.js', basename(__FILE__)), array('jquery', 'qcld-wp-chatbot-jquery-cookie'), QCLD_wpCHATBOT_VERSION, true);
752 704 wp_enqueue_script('qcld-wp-chatbot-front-js');
@@ -810,11 +762,8 @@
810 762 $user_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_text_color') );
811 763 $wp_chatbot_text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
812 764 $user_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_bg_color') );
813 765 $header_background_color = sanitize_hex_color( get_option('wp_chatbot_header_background_color') );
814 - $chatbot_content_max_height = sanitize_text_field( get_option('chatbot_content_max_height') );
815 - $chatbot_content_max_height_responsive = sanitize_text_field( get_option('chatbot_content_max_height_responsive') );
816 -
817 766
818 767 $inline_chat_custom_styles .= "
819 768 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
820 769 color: ". $text_color ." !important;
@@ -906,11 +855,8 @@
906 855 font-style: ".$bot_font_family->fontStyle.";
907 856 font-size: ". get_option('wp_chatbot_font_size'). "px;
908 857 }
909 858
910 -
911 -
912 -
913 859 ";
914 860 }
915 861 if ( get_option('enable_wp_chatbot_custom_color') == 1 && ! empty($bot_font) ) {
916 862
@@ -933,9 +879,10 @@
933 879 font-style: {$font_style};
934 880 font-size: {$font_size};
935 881 }
936 882 ";
937 -
883 +
884 + wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
938 885 }
939 886
940 887 if(get_option('wp_chatbot_custom_css')!=""){
941 888
@@ -940,89 +887,8 @@
940 887 if(get_option('wp_chatbot_custom_css')!=""){
941 888
942 889 wp_add_inline_style( 'qcld-wp-chatbot-common-style', get_option('wp_chatbot_custom_css') );
943 890 }
944 -
945 -
946 -
947 -
948 - if ( ( get_option( 'chatbot_content_max_height' ) != '' ) ) {
949 - $chatbot_h_vh = absint( get_option( 'chatbot_content_max_height' ) );
950 - if ( $chatbot_h_vh <= 0 ) {
951 - $chatbot_h_vh = 80;
952 - }
953 - if ( $chatbot_h_vh > 100 ) {
954 - $chatbot_h_vh = 100;
955 - }
956 - // Expand adds a modest bump based on admin height (never above 100vh).
957 - $chatbot_h_expanded_vh = min( 100, $chatbot_h_vh + 8 );
958 -
959 - $chatbot_h_mobile_vh = absint( get_option( 'chatbot_content_max_height_responsive' ) );
960 - if ( $chatbot_h_mobile_vh <= 0 ) {
961 - $chatbot_h_mobile_vh = 90;
962 - }
963 - if ( $chatbot_h_mobile_vh > 100 ) {
964 - $chatbot_h_mobile_vh = 100;
965 - }
966 -
967 - $custom_colors .= ' .slimScrollDiv{
968 - height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
969 - max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
970 - }';
971 -
972 -
973 - $custom_colors .= 'div#wp-chatbot-board-container{
974 - height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
975 - max-height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
976 - }';
977 -
978 - $custom_colors .= '.wp-chatbot-content{
979 - height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
980 - max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
981 - }';
982 -
983 - // Desktop expand: width toggle also grows height from admin base + bump.
984 - $custom_colors .= '
985 - div#wp-chatbot-board-container.wp-chatbot-expanded,
986 - .wp-chatbot-board-container.wp-chatbot-expanded {
987 - height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
988 - max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
989 - }
990 - div#wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
991 - div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
992 - div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner,
993 - .wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
994 - .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
995 - .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner {
996 - height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
997 - max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
998 - }
999 - ';
1000 -
1001 -
1002 -
1003 - $custom_colors .= '
1004 - @media screen and (max-width: 480px) {
1005 - div#wp-chatbot-board-container{
1006 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1007 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1008 - }
1009 -
1010 - .slimScrollDiv{
1011 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1012 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1013 - }
1014 -
1015 - .wp-chatbot-content{
1016 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1017 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1018 - }
1019 - }
1020 - ';
1021 -
1022 -
1023 - }
1024 - wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
1025 891 }
1026 892 public function qcld_wb_chatbot_str_replace($messages=array()){
1027 893 $allowed_html = array(
1028 894 'a' => array(
@@ -1204,26 +1070,8 @@
1204 1070 if(isset( $_POST["skip_wp_greetings"])){
1205 1071 $skip_wp_greetings = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings"]));
1206 1072 }else{ $skip_wp_greetings='';}
1207 1073 update_option('skip_wp_greetings', wp_unslash($skip_wp_greetings));
1208 -
1209 - if( $skip_wp_greetings == '1' || $skip_wp_greetings_donot_show_menu == '1' ){
1210 - $ask_email_wp_greetings = '';
1211 - $enable_asking_for_email = '';
1212 - } else {
1213 - if (isset( $_POST["ask_email_wp_greetings"])) {
1214 - $ask_email_wp_greetings = sanitize_text_field(wp_unslash($_POST["ask_email_wp_greetings"]));
1215 - } else {
1216 - $ask_email_wp_greetings = '';
1217 - }
1218 - if (isset( $_POST["enable_asking_for_email"])) {
1219 - $enable_asking_for_email = sanitize_text_field(wp_unslash($_POST["enable_asking_for_email"]));
1220 - } else {
1221 - $enable_asking_for_email = '';
1222 - }
1223 - }
1224 - update_option('ask_email_wp_greetings', wp_unslash($ask_email_wp_greetings));
1225 - update_option('enable_asking_for_email', wp_unslash($enable_asking_for_email));
1226 1074 //Enable /disable wpwbot
1227 1075 if(isset( $_POST["disable_wp_chatbot"])){
1228 1076 $disable_wp_chatbot = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot"]));
1229 1077 }else{ $disable_wp_chatbot='';}
@@ -1270,21 +1118,9 @@
1270 1118 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
1271 1119 $enable_wp_chatbot_rtl = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_rtl"]));
1272 1120 }else{ $enable_wp_chatbot_rtl='';}
1273 1121 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
1274 -
1275 - if(isset( $_POST["chatbot_content_max_height"])) {
1276 - $chatbot_content_max_height = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height"]));
1277 - }else{ $chatbot_content_max_height='';}
1278 - update_option('chatbot_content_max_height', wp_unslash($chatbot_content_max_height));
1279 -
1280 -
1281 - if(isset( $_POST["chatbot_content_max_height_responsive"])) {
1282 - $chatbot_content_max_height_responsive = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height_responsive"]));
1283 - }else{ $chatbot_content_max_height_responsive='';}
1284 - update_option('chatbot_content_max_height_responsive', wp_unslash($chatbot_content_max_height_responsive));
1285 -
1286 -
1122 +
1287 1123 if(isset( $_POST["show_menu_after_greetings"])) {
1288 1124 $show_menu_after_greetings = sanitize_text_field(wp_unslash($_POST["show_menu_after_greetings"]));
1289 1125 }else{ $show_menu_after_greetings='';}
1290 1126 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
@@ -1425,17 +1261,8 @@
1425 1261 update_option('wp_chatbot_icon', $wp_chatbot_icon);
1426 1262
1427 1263 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_floatingiconbg_color'])) : '#fff';
1428 1264 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
1429 -
1430 - // Custom icon video / YouTube link
1431 - $wp_chatbot_icon_youtube_url = isset( $_POST['wp_chatbot_icon_youtube_url'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_youtube_url'] ) : '';
1432 - $wp_chatbot_icon_video_upload = isset( $_POST['wp_chatbot_icon_video'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_video'] ) : '';
1433 - // YouTube URL takes priority; fall back to uploaded video
1434 - $wp_chatbot_icon_video = ( $wp_chatbot_icon_youtube_url !== '' ) ? $wp_chatbot_icon_youtube_url : $wp_chatbot_icon_video_upload;
1435 - update_option( 'wp_chatbot_icon_video', $wp_chatbot_icon_video );
1436 - $wp_chatbot_icon_video_delay = isset( $_POST['wp_chatbot_icon_video_delay'] ) ? absint( $_POST['wp_chatbot_icon_video_delay'] ) : 0;
1437 - update_option( 'wp_chatbot_icon_video_delay', $wp_chatbot_icon_video_delay );
1438 1265
1439 1266 // upload custom wpwbot icon path
1440 1267 $wp_chatbot_custom_icon_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_icon_path']));
1441 1268 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
@@ -1451,14 +1278,8 @@
1451 1278
1452 1279 //Theming
1453 1280 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field(wp_unslash($_POST['qcld_wb_chatbot_theme'])) : 'template-00');
1454 1281 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
1455 -
1456 - //Avatar Location
1457 - if(isset($_POST['qcld_chatbot_avatar_location'])) {
1458 - $qcld_chatbot_avatar_location = sanitize_text_field(wp_unslash($_POST['qcld_chatbot_avatar_location']));
1459 - update_option('qcld_chatbot_avatar_location', $qcld_chatbot_avatar_location);
1460 - }
1461 1282 //Theme custom background option
1462 1283 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
1463 1284 $qcld_wb_chatbot_change_bg = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_change_bg"]));
1464 1285 }else{$qcld_wb_chatbot_change_bg='';}
@@ -1472,9 +1293,9 @@
1472 1293
1473 1294 //To override style use custom css.
1474 1295 if(isset($_POST["wp_chatbot_custom_css"])){
1475 1296 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
1476 - update_option('wp_chatbot_custom_css', sanitize_textarea_field($wp_chatbot_custom_css));
1297 + update_option('wp_chatbot_custom_css', sanitize_text_field($wp_chatbot_custom_css));
1477 1298 }
1478 1299
1479 1300 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_id"])) {
1480 1301 $qlcd_wp_chatbot_dialogflow_project_id = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_id"]));
@@ -2640,15 +2461,13 @@
2640 2461
2641 2462 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2642 2463 dbDelta( $sql_sliders_Table1 );
2643 2464
2644 -
2645 2465 //Bot Response Table
2646 2466 $table_rag_documents = $wpdb->prefix . "rag_documents";
2647 2467
2648 2468 $charset = $wpdb->get_charset_collate();
2649 - 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
2650 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2469 + if ($wpdb->get_var("SHOW TABLES LIKE '$table_rag_documents'") != $table_rag_documents) {
2651 2470 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2652 2471 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2653 2472 doc_id VARCHAR(100) DEFAULT NULL,
2654 2473 title VARCHAR(255) NOT NULL,
@@ -2662,14 +2481,12 @@
2662 2481 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2663 2482 ) $charset;";
2664 2483 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2665 2484 dbDelta($sql_rag_documents);
2666 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2667 2485 }
2668 2486 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2669 2487
2670 - 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
2671 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2488 + if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_report'" ) != $table_report ) {
2672 2489 $sql_report = "
2673 2490 CREATE TABLE `$table_report` (
2674 2491 `id` int(11) NOT NULL AUTO_INCREMENT,
2675 2492 `user_id` int(11) NOT NULL,
@@ -2683,40 +2500,20 @@
2683 2500 ";
2684 2501
2685 2502 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2686 2503 dbDelta( $sql_report );
2687 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2688 2504 }
2689 2505
2690 - $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
2691 2507 if(empty($sqlqry)){
2692 2508
2693 - $query = 'Sample Question ?';
2694 - $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!';
2695 2511
2696 2512 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2697 2513 $format = array('%s','%s', '%s', '%s');
2698 - $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
2699 2515 }
2700 -
2701 - $table = $wpdb->prefix . 'wpbot_subscription';
2702 - 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
2703 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2704 - $sql_sliders_Table = "
2705 - CREATE TABLE IF NOT EXISTS `$table` (
2706 - `id` int(11) NOT NULL AUTO_INCREMENT,
2707 - `name` varchar(256) NOT NULL,
2708 - `email` varchar(256) NOT NULL,
2709 - `phone` varchar(256) NOT NULL,
2710 - `url` text NOT NULL,
2711 - `date` datetime NOT NULL,
2712 - `user_agent` text NOT NULL,
2713 - PRIMARY KEY (`id`)
2714 - ) $collate AUTO_INCREMENT=1 ";
2715 - require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2716 - dbDelta($sql_sliders_Table);
2717 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2718 - }
2719 2516
2720 2517 $url = get_site_url();
2721 2518 $url = wp_parse_url($url);
2722 2519 $domain = $url['host'];
@@ -2808,19 +2605,11 @@
2808 2605 if(!get_option('wp_chatbot_show_home_page')) {
2809 2606 update_option('wp_chatbot_show_home_page', 'on');
2810 2607 }
2811 2608 if(!get_option('qc_wpbot_menu_order')) {
2812 - $site_search_label = get_option('qlcd_wp_chatbot_wildcard_site_search') != '' ? get_option('qlcd_wp_chatbot_wildcard_site_search') : 'Site Search';
2813 - $support_email_label = get_option('qlcd_wp_chatbot_support_email') != '' ? get_option('qlcd_wp_chatbot_support_email') : 'Send us Email.';
2814 - $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!';
2815 - $default_menu = '<span class="qcld-chatbot-wildcard qc_draggable_item qcld-chatbot-site-search" data-wildcart="site_search">' . esc_attr($site_search_label) . '</span>';
2816 - $default_menu .= '<span class="qcld-chatbot-suggest-email qc_draggable_item">' . esc_attr($support_email_label) . '</span>';
2817 - $default_menu .= '<span class="qcld-chatbot-suggest-phone qc_draggable_item">' . esc_attr($support_phone_label) . '</span>';
2818 - update_option('qc_wpbot_menu_order', $default_menu);
2609 + update_option('qc_wpbot_menu_order', '');
2819 2610 }
2820 - if(!get_option('qcld_chatbot_avatar_location')) {
2821 - update_option('qcld_chatbot_avatar_location', 'side');
2822 - }
2611 +
2823 2612 if(!get_option('wp_chatbot_show_posts')) {
2824 2613 update_option('wp_chatbot_show_posts', 'on');
2825 2614 }
2826 2615 if(!get_option('wp_chatbot_show_pages')){
@@ -3147,12 +2936,12 @@
3147 2936 if(!get_option('qlcd_wp_chatbot_notifications')) {
3148 2937 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
3149 2938 }
3150 2939 if(!get_option('support_query')) {
3151 - update_option('support_query', maybe_serialize(array('Sample Question?')));
2940 + update_option('support_query', maybe_serialize(array('What is WPBot?')));
3152 2941 }
3153 2942 if(!get_option('support_ans')) {
3154 - 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.')));
3155 2944 }
3156 2945 if(!get_option('qlcd_wp_chatbot_search_option')) {
3157 2946 update_option('qlcd_wp_chatbot_search_option', 'standard');
3158 2947 }
@@ -3339,10 +3128,9 @@
3339 3128 }
3340 3129 if(!get_option('enable_wp_chatbot_opening_hour')) {
3341 3130 update_option('wpwbot_hours', array());
3342 3131 }
3343 - wpbot_free_set_content_height_defaults();
3344 -
3132 +
3345 3133 if(!get_option('enable_wp_chatbot_dailogflow')) {
3346 3134 update_option('enable_wp_chatbot_dailogflow', '');
3347 3135 }
3348 3136 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
@@ -3376,163 +3164,8 @@
3376 3164 * Reset Options will be insert as defualt data
3377 3165 */
3378 3166 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3379 3167 //add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3380 -
3381 -add_action('wp_ajax_qcld_save_ai_form', 'qcld_save_ai_form');
3382 -add_action('wp_ajax_nopriv_qcld_save_ai_form', 'qcld_save_ai_form');
3383 -
3384 -function qcld_save_ai_form() {
3385 - check_ajax_referer('wp_chatbot', 'nonce');
3386 - if (isset($_POST['data'])) {
3387 - $data_string = stripslashes($_POST['data']);
3388 - $json_data = json_decode($data_string, true);
3389 - if ($json_data && isset($json_data['form_title'])) {
3390 - $post_title = sanitize_text_field($json_data['form_title']) . ' - ' . current_time('mysql');
3391 - $post_id = wp_insert_post(array(
3392 - 'post_title' => $post_title,
3393 - 'post_type' => 'wpbot_form_entry',
3394 - 'post_status' => 'publish'
3395 - ));
3396 - if ($post_id && isset($json_data['data']) && is_array($json_data['data'])) {
3397 - $email_body = "<h2>" . esc_html__('New AI Action Submission', 'chatbot') . "</h2>";
3398 - $email_body .= "<p><strong>" . esc_html__('Action', 'chatbot') . ":</strong> " . sanitize_text_field($json_data['form_title']) . "</p>";
3399 - $email_body .= "<table border='1' cellpadding='10' cellspacing='0' style='border-collapse: collapse; width: 100%; max-width: 600px; font-family: sans-serif;'>";
3400 -
3401 - // Extract user's email for Reply-To (not From, to avoid SMTP rejection)
3402 - $reply_to = '';
3403 -
3404 - foreach ($json_data['data'] as $key => $value) {
3405 - update_post_meta($post_id, sanitize_text_field($key), sanitize_text_field($value));
3406 - $clean_key = ucwords(str_replace(array('-', '_'), ' ', sanitize_text_field($key)));
3407 - $email_body .= "<tr><td style='background: #f4f4f4; width: 40%;'><strong>" . esc_html($clean_key) . "</strong></td><td>" . esc_html(sanitize_text_field($value)) . "</td></tr>";
3408 -
3409 - // Extract email from value — handles plain, [bracketed], and combined answers
3410 - if (preg_match('/\[?([a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,})\]?/', $value, $email_match)) {
3411 - $candidate = sanitize_email(trim($email_match[1]));
3412 - if (is_email($candidate)) {
3413 - $reply_to = $candidate;
3414 - }
3415 - }
3416 - }
3417 - $email_body .= "</table>";
3418 -
3419 - $email_enabled = true; // Default to true if not found for backwards compatibility
3420 - $per_action_emails = '';
3421 - $saved_forms = get_option('wpbot_ai_forms', array());
3422 - $ai_form_title = strtolower( trim( sanitize_text_field( $json_data['form_title'] ) ) );
3423 - if (is_array($saved_forms)) {
3424 - foreach ($saved_forms as $form) {
3425 - if ( strtolower( trim( $form['title'] ) ) === $ai_form_title ) {
3426 - if (isset($form['email'])) {
3427 - $email_enabled = $form['email'] == 1;
3428 - }
3429 - $per_action_emails = isset($form['email_addresses']) ? trim($form['email_addresses']) : '';
3430 - break;
3431 - }
3432 - }
3433 - }
3434 -
3435 - if ($email_enabled) {
3436 - if (!empty($per_action_emails)) {
3437 - $to = array_map('trim', explode(',', $per_action_emails));
3438 - } else {
3439 - $default = get_option('qlcd_wp_chatbot_admin_email', '');
3440 - $to = !empty($default) ? array_map('trim', explode(',', $default)) : get_option('admin_email');
3441 - }
3442 - $subject = sanitize_text_field($json_data['form_title']) . " - " . esc_html__('New AI Action Submission', 'chatbot');
3443 - $headers = array('Content-Type: text/html; charset=UTF-8');
3444 - if (!empty($reply_to)) {
3445 - $headers[] = 'Reply-To: ' . $reply_to;
3446 - }
3447 - wp_mail($to, $subject, $email_body, $headers);
3448 - }
3449 -
3450 - wp_send_json_success('Saved successfully');
3451 - }
3452 - }
3453 - }
3454 - wp_send_json_error('Failed to save');
3455 -}
3456 -
3457 -add_action('wp_ajax_qcld_get_ai_form_entries', 'qcld_get_ai_form_entries');
3458 -function qcld_get_ai_form_entries() {
3459 - check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3460 - if (!current_user_can('manage_options')) {
3461 - wp_send_json_error('Unauthorized');
3462 - }
3463 - $form_title = isset($_POST['form_title']) ? sanitize_text_field($_POST['form_title']) : '';
3464 - if (empty($form_title)) {
3465 - wp_send_json_error('No title provided');
3466 - }
3467 -
3468 - global $wpdb;
3469 - $post_ids = $wpdb->get_col( $wpdb->prepare(
3470 - "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpbot_form_entry' AND post_status = 'publish' AND post_title LIKE %s",
3471 - $wpdb->esc_like( $form_title . ' - ' ) . '%'
3472 - ) );
3473 -
3474 - if ( empty($post_ids) ) {
3475 - $post_ids = array(0);
3476 - }
3477 -
3478 - $args = array(
3479 - 'post_type' => 'wpbot_form_entry',
3480 - 'post_status' => 'publish',
3481 - 'posts_per_page' => -1,
3482 - 'post__in' => $post_ids
3483 - );
3484 - $query = new WP_Query($args);
3485 -
3486 - ob_start();
3487 - if ($query->have_posts()) {
3488 - echo '<table class="wp-list-table widefat fixed striped" style="width: 100%; text-align: left;">';
3489 - echo '<thead><tr><th>Entry</th><th>Data</th><th>Date</th><th>Action</th></tr></thead>';
3490 - echo '<tbody>';
3491 - while ($query->have_posts()) {
3492 - $query->the_post();
3493 - $meta = get_post_meta(get_the_ID());
3494 - echo '<tr>';
3495 - echo '<td><strong>' . get_the_title() . '</strong></td>';
3496 - echo '<td>';
3497 - foreach ($meta as $key => $values) {
3498 - if (strpos($key, '_') !== 0) { // skip hidden meta
3499 - echo '<strong>' . esc_html($key) . ':</strong> ' . esc_html($values[0]) . '<br>';
3500 - }
3501 - }
3502 - echo '</td>';
3503 - echo '<td>' . get_the_date() . ' ' . get_the_time() . '</td>';
3504 - echo '<td><button type="button" class="button qcld-delete-ai-entry" data-id="' . esc_attr(get_the_ID()) . '" style="color: #a00; border-color: #a00;">Delete</button></td>';
3505 - echo '</tr>';
3506 - }
3507 - echo '</tbody></table>';
3508 - wp_reset_postdata();
3509 - } else {
3510 - echo '<p>No entries found for this form.</p>';
3511 - }
3512 - $html = ob_get_clean();
3513 - wp_send_json_success(array('html' => $html));
3514 -}
3515 -
3516 -add_action('wp_ajax_qcld_delete_ai_form_entry', 'qcld_delete_ai_form_entry');
3517 -function qcld_delete_ai_form_entry() {
3518 - check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3519 - if (!current_user_can('manage_options')) {
3520 - wp_send_json_error('Unauthorized');
3521 - }
3522 -
3523 - $entry_id = isset($_POST['entry_id']) ? intval($_POST['entry_id']) : 0;
3524 - if (empty($entry_id)) {
3525 - wp_send_json_error('No entry ID provided');
3526 - }
3527 -
3528 - if (get_post_type($entry_id) === 'wpbot_form_entry') {
3529 - wp_delete_post($entry_id, true);
3530 - wp_send_json_success('Entry deleted successfully');
3531 - } else {
3532 - wp_send_json_error('Invalid entry');
3533 - }
3534 -}
3535 3168 //Jarvis all option will be delete during uninstlling.
3536 3169 if( !function_exists('qcld_wb_chatboot_delete_all_options') ){
3537 3170 function qcld_wb_chatboot_delete_all_options(){
3538 3171
@@ -3772,9 +3405,8 @@
3772 3405 delete_option('wp_chat_user_font_family');
3773 3406 delete_option('wp_chat_bot_font_family');
3774 3407 delete_option('wp_chatbot_bot_font');
3775 3408 delete_option('wp_chatbot_user_font');
3776 - delete_option('qcld_chatbot_avatar_location');
3777 3409 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3778 3410 qcld_wb_chatboot_defualt_options();
3779 3411 $html='Reset all options to default successfully.';
3780 3412 wp_send_json($html);
@@ -3780,22 +3412,8 @@
3780 3412 wp_send_json($html);
3781 3413 }
3782 3414 }
3783 3415
3784 -if( !function_exists('wpbot_free_set_content_height_defaults') ){
3785 - function wpbot_free_set_content_height_defaults() {
3786 - $chatbot_content_max_height = get_option( 'chatbot_content_max_height', false );
3787 - if ( $chatbot_content_max_height === false || $chatbot_content_max_height === '' ) {
3788 - update_option( 'chatbot_content_max_height', '80' );
3789 - }
3790 -
3791 - $chatbot_content_max_height_responsive = get_option( 'chatbot_content_max_height_responsive', false );
3792 - if ( $chatbot_content_max_height_responsive === false || $chatbot_content_max_height_responsive === '' ) {
3793 - update_option( 'chatbot_content_max_height_responsive', '90' );
3794 - }
3795 - }
3796 -}
3797 -
3798 3416 if( !function_exists('wpbot_free_qc_upgrade_completed') ){
3799 3417 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
3800 3418 // The path to our plugin's main file
3801 3419 $our_plugin = plugin_basename( __FILE__ );
@@ -3804,9 +3422,8 @@
3804 3422 // Iterate through the plugins being updated and check if ours is there
3805 3423 foreach( $options['plugins'] as $plugin ) {
3806 3424 if( $plugin == $our_plugin ) {
3807 3425 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3808 - wpbot_free_set_content_height_defaults();
3809 3426 }
3810 3427 }
3811 3428 }
3812 3429 update_option( 'qcld_openai_relevant_post', ['post','page'] );
@@ -3828,17 +3445,9 @@
3828 3445 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3829 3446
3830 3447 }
3831 3448 }
3832 -if( !function_exists('wpbot_Ai_actions_func') ){
3833 - function wpbot_Ai_actions_func (){
3834 3449
3835 - require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/admin/templates/ai-actions.php");
3836 - // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3837 -
3838 -}
3839 -}
3840 -
3841 3450 /**
3842 3451 *
3843 3452 * Function to load translation files.
3844 3453 *
@@ -3866,10 +3475,10 @@
3866 3475
3867 3476 <div class="wrap qcld-main-wrapper">
3868 3477 <div class="qcld-wp-chatbot-wrap-header">
3869 3478
3870 - <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>
3871 - <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>
3872 3481 </div>
3873 3482 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3874 3483 <li>
3875 3484 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
@@ -3907,16 +3516,16 @@
3907 3516 </div>
3908 3517 <div class="panel panel-default">
3909 3518 <div class="panel-heading" role="tab" id="headingSix">
3910 3519 <h4 class="panel-title">
3911 - <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>
3912 3521 </h4>
3913 3522 </div>
3914 3523 <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
3915 3524 <div class="panel-body">
3916 - <?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>
3917 - <?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>
3918 - <?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'); ?>
3919 3528 </div>
3920 3529 </div>
3921 3530 </div>
3922 3531 <div class="panel panel-default">
@@ -3926,9 +3535,9 @@
3926 3535 </h4>
3927 3536 </div>
3928 3537 <div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
3929 3538 <div class="panel-body">
3930 - <?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>
3931 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'); ?>
3932 3541 </div>
3933 3542 </div>
3934 3543 </div>
@@ -4048,9 +3657,9 @@
4048 3657 <div class="to-icon-txt fa-4x-txt ">
4049 3658 <h3>
4050 3659 <span>// </span><?php esc_html_e('Send eMail, Call Me Back &amp; Feedback Collection', 'chatbot'); ?>
4051 3660 </h3>
4052 - <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>
4053 3662 </div>
4054 3663 </div>
4055 3664 <div class="to-icon-box left txt-left">
4056 3665 <div class="to-icon-txt fa-4x-txt ">
@@ -4104,9 +3713,9 @@
4104 3713 </h4>
4105 3714 </div>
4106 3715 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
4107 3716 <div class="panel-body">
4108 - <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>
4109 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>.
4110 3719 </p>
4111 3720 <h4><?php esc_html_e('Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.', 'chatbot'); ?></h4>
4112 3721 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank"><?php esc_html_e('Download Free Version', 'chatbot'); ?></a>
@@ -4372,9 +3981,9 @@
4372 3981 </h4>
4373 3982 </div>
4374 3983 <div id="faqcollapsetwelve" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwelve">
4375 3984 <div class="panel-body">
4376 - <?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'); ?>
4377 3986 </div>
4378 3987 </div>
4379 3988 </div>
4380 3989
@@ -4469,17 +4078,17 @@
4469 4078 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4470 4079 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4471 4080 }
4472 4081
4473 - $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
4474 4083 if(empty($sqlqry)){
4475 4084
4476 - $query = 'Sample Question?';
4477 - $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!';
4478 4087
4479 4088 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4480 4089 $format = array('%s','%s', '%s', '%s');
4481 - $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
4482 4091 }
4483 4092
4484 4093 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4485 4094
@@ -4525,11 +4134,11 @@
4525 4134 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4526 4135 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4527 4136 $where = array('id'=>$id);
4528 4137 $whereformat = array('%d');
4529 - $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
4530 4139 }else{
4531 - $wpdb->insert($table,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
4140 + $wpdb->insert($table,$data,$format); //DB Call OK, No Caching OK
4532 4141 }
4533 4142
4534 4143 qcld_mysql_remove_existing_indexes();
4535 4144
@@ -4535,9 +4144,9 @@
4535 4144
4536 4145 // phpcs:ignore
4537 4146 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4538 4147
4539 - wp_safe_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4148 + wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4540 4149
4541 4150 }
4542 4151 $table = $wpdb->prefix.'wpbot_response';
4543 4152
@@ -4568,27 +4177,15 @@
4568 4177 }
4569 4178 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4570 4179 $table = $wpdb->prefix.'wpbot_response';
4571 4180 $fields = rest_sanitize_array(wp_unslash($_POST['qc_bot_str_fields']));
4572 -
4573 - $allowed_fields = array('query', 'keyword', 'response');
4574 - $valid_fields = array();
4575 - if(is_array($fields)){
4576 - foreach($fields as $field){
4577 - if(in_array($field, $allowed_fields)){
4578 - $valid_fields[] = $field;
4579 - }
4580 - }
4581 - }
4582 - $fields = $valid_fields;
4583 -
4584 4181 update_option('qc_bot_str_fields', $fields);
4585 4182 qcld_mysql_remove_existing_indexes();
4586 4183
4587 4184 if($fields && !empty($fields)){
4588 - $safe_fields = array_map(function($f) { return '`' . $f . '`'; }, $fields);
4185 +
4589 4186 // phpcs:ignore
4590 - $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $safe_fields).")");
4187 + $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
4591 4188
4592 4189 }
4593 4190 }
4594 4191
@@ -4612,9 +4209,9 @@
4612 4209 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4613 4210 function qcld_wpbot_simple_response_intent(){
4614 4211 global $wpdb;
4615 4212 $table = $wpdb->prefix.'wpbot_response';
4616 - $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
4617 4214 $response = array();
4618 4215 if(!empty($results)){
4619 4216 foreach($results as $result){
4620 4217 $response[] = $result->intent;
@@ -4627,9 +4224,9 @@
4627 4224 function qcld_mysql_remove_existing_indexes(){
4628 4225 global $wpdb;
4629 4226 $table = $wpdb->prefix.'wpbot_response';
4630 4227
4631 - $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
4632 4229 $indexes = array();
4633 4230 foreach($results as $result){
4634 4231
4635 4232
@@ -4657,4 +4254,6 @@
4657 4254 }
4658 4255 }
4659 4256 }
4660 4257 }
4258 +
4259 +