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 +115 -524 8.7.68.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.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 - * Requires at least: 5.5
12 - * Tested up to: 7.1
11 + * Requires at least: 4.6
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.7.6');
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,17 +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 -// Load Automator addon if it exists
112 -if ( file_exists( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'addons/automator/wpbot-automator.php' ) ) {
113 - require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'addons/automator/wpbot-automator.php' );
114 -}
115 -
116 99 /**
117 100 * Main Class.
118 101 */
119 102
@@ -159,18 +142,18 @@
159 142 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
160 143
161 144 }
162 145
163 - 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') ){
164 147 // add_action( 'admin_notices', array( $this, 'promotion_notice' ) );
165 148
166 149 }
167 150
168 151 if (is_admin() && !empty($_GET["page"]) && ($_GET["page"] == "wpbot") || (!empty($_GET['page']) && $_GET['page']=='wpbot_help_page')
169 - || ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_ai_actions')
152 +
170 153 || (!empty($_GET['page']) && $_GET['page']=='wpbot_openAi')
171 154
172 - || (!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") ) {
173 156 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
174 157 if( get_option('wp_chatbot_index_count')<=0 && get_option('qlcd_wp_chatbot_search_option')=='advanced'){
175 158
176 159 add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
@@ -189,30 +172,20 @@
189 172 if (!is_admin() && get_option('disable_wp_chatbot') != 1 && wp_chatbot_load_controlling() === true) {
190 173 add_action('wp_enqueue_scripts', array($this, 'qcld_wb_chatbot_frontend_scripts'));
191 174 }
192 175 }
193 - public function qcld_register_ai_form_cpt() {
194 - $args = array(
195 - 'public' => false,
196 - 'show_ui' => true,
197 - 'show_in_menu' => 'wpbot', // under WPBot menu
198 - 'label' => 'AI Form Entries',
199 - 'supports' => array('title', 'custom-fields')
200 - );
201 - register_post_type('wpbot_form_entry', $args);
202 - }
203 176 public function qcld_wpchatbot_init2_fnc(){
204 - $this->qcld_register_ai_form_cpt();
205 177 global $wpdb;
206 178 if( is_admin() ){
207 179
208 - $content = $wpdb->db_server_info();
209 - if ( empty( $content ) ) {
180 + $connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
181 + if($connection === false){
210 182 return;
211 183 }
184 + $content = $connection->server_info;
185 +
186 + $mysql_server_info = $wpdb->db_server_info();
212 187
213 - $mysql_server_info = $content;
214 -
215 188 // Check for the MariaDB.
216 189 $is_mariadb = false;
217 190 if ( ! empty( $mysql_server_info ) && strpos( strtolower( $mysql_server_info ), 'maria' ) !== false ) {
218 191 $is_mariadb = true;
@@ -237,8 +210,9 @@
237 210 }
238 211
239 212 }
240 213
214 + $connection->close();
241 215 }
242 216 }
243 217
244 218 public function mysql_version_notice(){
@@ -262,34 +236,21 @@
262 236 $capability = 'publish_posts';
263 237 }else{
264 238 $capability = 'manage_options';
265 239 }
266 - 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 );
267 241
268 - 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 +
269 244 add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
270 - add_submenu_page( 'wpbot-panel', esc_html('AI Actions'), esc_html('AI Actions'), 'manage_options','wpbot_ai_actions', 'wpbot_Ai_actions_func' );
271 -
272 - if ( class_exists( '\WPbot_Automator\Core\Plugin' ) && method_exists( '\WPbot_Automator\Core\Plugin', 'render_admin_page' ) ) {
273 - add_submenu_page( 'wpbot-panel', esc_html('Automator'), esc_html('Automator'), 'manage_options', 'wpbot-automator', array( '\WPbot_Automator\Core\Plugin', 'render_admin_page' ) );
274 - }
275 245
276 - if ( function_exists( 'qc_wpbot_cs_tabbed_wrapper' ) ) {
277 - add_submenu_page( 'wpbot-panel', esc_html('Chat Sessions'), esc_html('Chat Sessions'), $capability, 'wbcs-botsessions-page', 'qc_wpbot_cs_tabbed_wrapper' );
278 - }
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') );
279 247
280 - $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') );
281 248 add_action( "load-$hook", [ $this, 'screen_option' ] );
282 249
283 - add_submenu_page( 'wpbot-panel', esc_html('User Data'), esc_html('User Data'), 'manage_options','email-subscription', array($this, 'qcld_wb_chatbot_admin_page1') );
284 -
285 -
286 - //$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') );
287 -
288 -
289 250 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
290 251
291 - 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' );
292 253
293 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' );
294 255
295 256
@@ -328,9 +289,9 @@
328 289 global $wpcommerce, $wp_scripts;
329 290 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
330 291
331 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'
332 - || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" || $_GET["page"] == "wpbot_ai_actions" ) {
293 + || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" ) {
333 294
334 295 wp_enqueue_script('jquery');
335 296 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
336 297
@@ -355,9 +316,9 @@
355 316 wp_enqueue_script( 'wp-color-picker');
356 317 wp_enqueue_script( 'jquery-ui-sortable');
357 318 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
358 319 wp_enqueue_script('qcld-wp-fontpicker');
359 - 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);
360 321 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
361 322 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
362 323 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
363 324 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
@@ -378,9 +339,9 @@
378 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');
379 340 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
380 341 wp_register_script('qcld-wp-chatbot-sweetalrt', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/sweetalrt.js', basename(__FILE__)), array(), true);
381 342 wp_enqueue_script('qcld-wp-chatbot-sweetalrt');
382 - 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);
383 344 wp_enqueue_script('qcld-wp-chatbot-admin-js');
384 345 wp_localize_script('qcld-wp-chatbot-admin-js', 'qcld_gemini_admin_data',
385 346 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
386 347 // WordPress Media library
@@ -396,9 +357,9 @@
396 357 public function qcld_get_formbuilder_forms(){
397 358 global $wpdb;
398 359 $forms = array();
399 360 if(class_exists('Qcformbuilder_Forms_Admin')){
400 - $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
401 362 if(!empty($results)){
402 363 foreach($results as $result){
403 364 $form = maybe_unserialize($result->config);
404 365 $forms[] = trim($form['name']);
@@ -410,15 +371,12 @@
410 371 }else{
411 372 return array();
412 373 }
413 374 }
414 - public function qcld_wb_chatbot_admin_page1() {
415 - require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/admin/templates/email_subscription.php';
416 - }
417 375 public function qcld_wpbot_simple_response_intent(){
418 376 global $wpdb;
419 377 $table = $wpdb->prefix.'wpbot_response';
420 - $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
421 379 $response = array();
422 380 if(!empty($results)){
423 381 foreach($results as $result){
424 382 $response[] = $result->intent;
@@ -430,9 +388,9 @@
430 388 global $wpdb;
431 389 $command = array();
432 390 if(class_exists('Qcformbuilder_Forms_Admin')){
433 391 $primary = 'primary';
434 - $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
435 393
436 394 if(!empty($results)){
437 395 foreach($results as $result){
438 396 $form = maybe_unserialize($result->config);
@@ -451,8 +409,9 @@
451 409 }
452 410 }
453 411 public function promotion_notice(){
454 412 $screen = get_current_screen();
413 + // var_dump($screen->base );
455 414 // if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
456 415 ?>
457 416 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #120976 !important">
458 417 <div class="">
@@ -469,9 +428,9 @@
469 428 public function qcld_get_formbuilder_form_ids(){
470 429 global $wpdb;
471 430 $forms = array();
472 431 if(class_exists('Qcformbuilder_Forms_Admin')){
473 - $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
474 433
475 434 if(!empty($results)){
476 435 foreach($results as $result){
477 436 $form = maybe_unserialize($result->config);
@@ -505,9 +464,9 @@
505 464 $conversation_form_ids = array();
506 465 $conversation_form_names = array();
507 466
508 467 if(class_exists('Qcformbuilder_Forms_Admin')){
509 - $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
510 469 if(!empty($results)){
511 470
512 471 foreach($results as $result){
513 472 $form = maybe_unserialize($result->config);
@@ -533,12 +492,12 @@
533 492 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
534 493 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
535 494 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
536 495 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
537 - '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'))),
538 497 'agent_image' => get_option('wp_chatbot_agent_image'),
539 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'),
540 - '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')),
541 500 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
542 501 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
543 502 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
544 503 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
@@ -564,54 +523,54 @@
564 523 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
565 524 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
566 525 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
567 526 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
568 - 'help_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
569 - 'back_to_start' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
570 - 'help_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
571 - 'reset' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_reset'))),
572 - 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
573 - 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
574 - 'featured_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
575 - 'sale_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
576 - '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'))),
577 536 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
578 - 'product_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
579 - 'product_suggest' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
580 - 'product_infinite' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
581 - 'product_success' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_success'))),
582 - 'product_fail' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
583 - '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'))),
584 543 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
585 - 'support_option_again' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
586 - 'asking_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
587 - 'asking_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
588 - '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'))),
589 548 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
590 - 'asking_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
591 - 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
592 - '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')))),
593 - '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'))),
594 553 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
595 - 'notifications' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_notifications'))),
596 - 'order_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
597 - 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
598 - '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'))),
599 558 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
600 559 'order_login' => is_user_logged_in(),
601 560 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
602 561 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
603 - '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'))),
604 563 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
605 - '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'))),
606 565 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
607 566 'currency_symbol' => '',
608 567 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
609 - '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'))),
610 569 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
611 570 'enable_skype' => get_option('enable_wp_chatbot_skype'),
612 571 'enable_whats' => get_option('enable_wp_chatbot_whats'),
613 - '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'))),
614 573 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
615 574 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
616 575 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
617 576 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
@@ -626,9 +585,9 @@
626 585 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
627 586 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
628 587 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
629 588 'disable_faq' => get_option('disable_wp_chatbot_faq'),
630 - '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'))),
631 590 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
632 591 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
633 592 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
634 593 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
@@ -644,10 +603,8 @@
644 603 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
645 604 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
646 605 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
647 606 'mobile_full_screen' => '1',
648 - 'chatbot_content' => get_option( 'chatbot_content_max_height' ),
649 - 'chatbot_content_responsive' => get_option( 'chatbot_content_max_height_responsive' ),
650 607 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):800),
651 608 'inactive_time' => get_option('wp_chatbot_inactive_time'),
652 609 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
653 610 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
@@ -678,12 +635,8 @@
678 635 'current_user_id' => $user_id,
679 636 'display_name' => esc_html( $display_name ),
680 637 'skip_wp_greetings' => get_option('skip_wp_greetings'),
681 638 'skip_greetings_and_menu' => get_option('skip_wp_greetings_donot_show_menu'),
682 - 'skip_wp_greetings_trigger_intent' => get_option('skip_wp_greetings_trigger_intent'),
683 - 'intent_for_non_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_non_logged_in_user'),
684 - 'intent_for_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_logged_in_user'),
685 - 'ask_email_wp_greetings' => get_option('enable_asking_for_email'),
686 639 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
687 640 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
688 641 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
689 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
@@ -689,10 +642,8 @@
689 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
690 643 'qlcd_wp_chatbot_report_text' => get_option('qlcd_wp_chatbot_report_text'),
691 644 'enable_chat_share_menu' => get_option('enable_chat_share_menu'),
692 645 'qlcd_wp_chatbot_share_text' => get_option('qlcd_wp_chatbot_share_text'),
693 - 'icon_video' => get_option('wp_chatbot_icon_video', ''),
694 - 'icon_video_delay' => absint(get_option('wp_chatbot_icon_video_delay', 0)),
695 646
696 647 );
697 648 $user_font = get_option('wp_chatbot_user_font') != '' ? get_option('wp_chatbot_user_font') : '';
698 649 if($user_font != '' ){
@@ -740,18 +691,8 @@
740 691 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
741 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);
742 693 wp_enqueue_script('qcld-wp-chatbot-plugin');
743 694
744 - $saved_ai_forms = get_option('wpbot_ai_forms', array());
745 - $ai_form_titles = array();
746 - if (is_array($saved_ai_forms)) {
747 - foreach ($saved_ai_forms as $form) {
748 - if (!isset($form['interactive']) || $form['interactive'] == 1) {
749 - $ai_form_titles[] = trim(strtolower($form['title']));
750 - }
751 - }
752 - }
753 -
754 695 $nonce = wp_create_nonce('wp_chatbot');
755 696 // Pass data to JS
756 697 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
757 698 'ajax_url' => admin_url('admin-ajax.php'),
@@ -756,9 +697,8 @@
756 697 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
757 698 'ajax_url' => admin_url('admin-ajax.php'),
758 699 'nonce' => $nonce,
759 700 'stream_endpoint' => admin_url('admin-ajax.php?action=qcld_stream_openai'),
760 - 'ai_form_titles' => $ai_form_titles,
761 701 ]);
762 702
763 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);
764 704 wp_enqueue_script('qcld-wp-chatbot-front-js');
@@ -822,11 +762,8 @@
822 762 $user_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_text_color') );
823 763 $wp_chatbot_text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
824 764 $user_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_bg_color') );
825 765 $header_background_color = sanitize_hex_color( get_option('wp_chatbot_header_background_color') );
826 - $chatbot_content_max_height = sanitize_text_field( get_option('chatbot_content_max_height') );
827 - $chatbot_content_max_height_responsive = sanitize_text_field( get_option('chatbot_content_max_height_responsive') );
828 -
829 766
830 767 $inline_chat_custom_styles .= "
831 768 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
832 769 color: ". $text_color ." !important;
@@ -918,11 +855,8 @@
918 855 font-style: ".$bot_font_family->fontStyle.";
919 856 font-size: ". get_option('wp_chatbot_font_size'). "px;
920 857 }
921 858
922 -
923 -
924 -
925 859 ";
926 860 }
927 861 if ( get_option('enable_wp_chatbot_custom_color') == 1 && ! empty($bot_font) ) {
928 862
@@ -945,9 +879,10 @@
945 879 font-style: {$font_style};
946 880 font-size: {$font_size};
947 881 }
948 882 ";
949 -
883 +
884 + wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
950 885 }
951 886
952 887 if(get_option('wp_chatbot_custom_css')!=""){
953 888
@@ -952,89 +887,8 @@
952 887 if(get_option('wp_chatbot_custom_css')!=""){
953 888
954 889 wp_add_inline_style( 'qcld-wp-chatbot-common-style', get_option('wp_chatbot_custom_css') );
955 890 }
956 -
957 -
958 -
959 -
960 - if ( ( get_option( 'chatbot_content_max_height' ) != '' ) ) {
961 - $chatbot_h_vh = absint( get_option( 'chatbot_content_max_height' ) );
962 - if ( $chatbot_h_vh <= 0 ) {
963 - $chatbot_h_vh = 80;
964 - }
965 - if ( $chatbot_h_vh > 100 ) {
966 - $chatbot_h_vh = 100;
967 - }
968 - // Expand adds a modest bump based on admin height (never above 100vh).
969 - $chatbot_h_expanded_vh = min( 100, $chatbot_h_vh + 8 );
970 -
971 - $chatbot_h_mobile_vh = absint( get_option( 'chatbot_content_max_height_responsive' ) );
972 - if ( $chatbot_h_mobile_vh <= 0 ) {
973 - $chatbot_h_mobile_vh = 90;
974 - }
975 - if ( $chatbot_h_mobile_vh > 100 ) {
976 - $chatbot_h_mobile_vh = 100;
977 - }
978 -
979 - $custom_colors .= ' .slimScrollDiv{
980 - height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
981 - max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
982 - }';
983 -
984 -
985 - $custom_colors .= 'div#wp-chatbot-board-container{
986 - height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
987 - max-height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
988 - }';
989 -
990 - $custom_colors .= '.wp-chatbot-content{
991 - height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
992 - max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
993 - }';
994 -
995 - // Desktop expand: width toggle also grows height from admin base + bump.
996 - $custom_colors .= '
997 - div#wp-chatbot-board-container.wp-chatbot-expanded,
998 - .wp-chatbot-board-container.wp-chatbot-expanded {
999 - height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
1000 - max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
1001 - }
1002 - div#wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
1003 - div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
1004 - div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner,
1005 - .wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
1006 - .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
1007 - .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner {
1008 - height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
1009 - max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
1010 - }
1011 - ';
1012 -
1013 -
1014 -
1015 - $custom_colors .= '
1016 - @media screen and (max-width: 480px) {
1017 - div#wp-chatbot-board-container{
1018 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1019 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1020 - }
1021 -
1022 - .slimScrollDiv{
1023 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1024 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1025 - }
1026 -
1027 - .wp-chatbot-content{
1028 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1029 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1030 - }
1031 - }
1032 - ';
1033 -
1034 -
1035 - }
1036 - wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
1037 891 }
1038 892 public function qcld_wb_chatbot_str_replace($messages=array()){
1039 893 $allowed_html = array(
1040 894 'a' => array(
@@ -1216,26 +1070,8 @@
1216 1070 if(isset( $_POST["skip_wp_greetings"])){
1217 1071 $skip_wp_greetings = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings"]));
1218 1072 }else{ $skip_wp_greetings='';}
1219 1073 update_option('skip_wp_greetings', wp_unslash($skip_wp_greetings));
1220 -
1221 - if( $skip_wp_greetings == '1' || $skip_wp_greetings_donot_show_menu == '1' ){
1222 - $ask_email_wp_greetings = '';
1223 - $enable_asking_for_email = '';
1224 - } else {
1225 - if (isset( $_POST["ask_email_wp_greetings"])) {
1226 - $ask_email_wp_greetings = sanitize_text_field(wp_unslash($_POST["ask_email_wp_greetings"]));
1227 - } else {
1228 - $ask_email_wp_greetings = '';
1229 - }
1230 - if (isset( $_POST["enable_asking_for_email"])) {
1231 - $enable_asking_for_email = sanitize_text_field(wp_unslash($_POST["enable_asking_for_email"]));
1232 - } else {
1233 - $enable_asking_for_email = '';
1234 - }
1235 - }
1236 - update_option('ask_email_wp_greetings', wp_unslash($ask_email_wp_greetings));
1237 - update_option('enable_asking_for_email', wp_unslash($enable_asking_for_email));
1238 1074 //Enable /disable wpwbot
1239 1075 if(isset( $_POST["disable_wp_chatbot"])){
1240 1076 $disable_wp_chatbot = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot"]));
1241 1077 }else{ $disable_wp_chatbot='';}
@@ -1282,21 +1118,9 @@
1282 1118 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
1283 1119 $enable_wp_chatbot_rtl = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_rtl"]));
1284 1120 }else{ $enable_wp_chatbot_rtl='';}
1285 1121 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
1286 -
1287 - if(isset( $_POST["chatbot_content_max_height"])) {
1288 - $chatbot_content_max_height = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height"]));
1289 - }else{ $chatbot_content_max_height='';}
1290 - update_option('chatbot_content_max_height', wp_unslash($chatbot_content_max_height));
1291 -
1292 -
1293 - if(isset( $_POST["chatbot_content_max_height_responsive"])) {
1294 - $chatbot_content_max_height_responsive = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height_responsive"]));
1295 - }else{ $chatbot_content_max_height_responsive='';}
1296 - update_option('chatbot_content_max_height_responsive', wp_unslash($chatbot_content_max_height_responsive));
1297 -
1298 -
1122 +
1299 1123 if(isset( $_POST["show_menu_after_greetings"])) {
1300 1124 $show_menu_after_greetings = sanitize_text_field(wp_unslash($_POST["show_menu_after_greetings"]));
1301 1125 }else{ $show_menu_after_greetings='';}
1302 1126 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
@@ -1437,17 +1261,8 @@
1437 1261 update_option('wp_chatbot_icon', $wp_chatbot_icon);
1438 1262
1439 1263 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_floatingiconbg_color'])) : '#fff';
1440 1264 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
1441 -
1442 - // Custom icon video / YouTube link
1443 - $wp_chatbot_icon_youtube_url = isset( $_POST['wp_chatbot_icon_youtube_url'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_youtube_url'] ) : '';
1444 - $wp_chatbot_icon_video_upload = isset( $_POST['wp_chatbot_icon_video'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_video'] ) : '';
1445 - // YouTube URL takes priority; fall back to uploaded video
1446 - $wp_chatbot_icon_video = ( $wp_chatbot_icon_youtube_url !== '' ) ? $wp_chatbot_icon_youtube_url : $wp_chatbot_icon_video_upload;
1447 - update_option( 'wp_chatbot_icon_video', $wp_chatbot_icon_video );
1448 - $wp_chatbot_icon_video_delay = isset( $_POST['wp_chatbot_icon_video_delay'] ) ? absint( $_POST['wp_chatbot_icon_video_delay'] ) : 0;
1449 - update_option( 'wp_chatbot_icon_video_delay', $wp_chatbot_icon_video_delay );
1450 1265
1451 1266 // upload custom wpwbot icon path
1452 1267 $wp_chatbot_custom_icon_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_icon_path']));
1453 1268 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
@@ -1463,14 +1278,8 @@
1463 1278
1464 1279 //Theming
1465 1280 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field(wp_unslash($_POST['qcld_wb_chatbot_theme'])) : 'template-00');
1466 1281 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
1467 -
1468 - //Avatar Location
1469 - if(isset($_POST['qcld_chatbot_avatar_location'])) {
1470 - $qcld_chatbot_avatar_location = sanitize_text_field(wp_unslash($_POST['qcld_chatbot_avatar_location']));
1471 - update_option('qcld_chatbot_avatar_location', $qcld_chatbot_avatar_location);
1472 - }
1473 1282 //Theme custom background option
1474 1283 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
1475 1284 $qcld_wb_chatbot_change_bg = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_change_bg"]));
1476 1285 }else{$qcld_wb_chatbot_change_bg='';}
@@ -1484,9 +1293,9 @@
1484 1293
1485 1294 //To override style use custom css.
1486 1295 if(isset($_POST["wp_chatbot_custom_css"])){
1487 1296 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
1488 - 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));
1489 1298 }
1490 1299
1491 1300 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_id"])) {
1492 1301 $qlcd_wp_chatbot_dialogflow_project_id = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_id"]));
@@ -2652,15 +2461,13 @@
2652 2461
2653 2462 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2654 2463 dbDelta( $sql_sliders_Table1 );
2655 2464
2656 -
2657 2465 //Bot Response Table
2658 2466 $table_rag_documents = $wpdb->prefix . "rag_documents";
2659 2467
2660 2468 $charset = $wpdb->get_charset_collate();
2661 - 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
2662 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2469 + if ($wpdb->get_var("SHOW TABLES LIKE '$table_rag_documents'") != $table_rag_documents) {
2663 2470 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2664 2471 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2665 2472 doc_id VARCHAR(100) DEFAULT NULL,
2666 2473 title VARCHAR(255) NOT NULL,
@@ -2674,14 +2481,12 @@
2674 2481 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2675 2482 ) $charset;";
2676 2483 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2677 2484 dbDelta($sql_rag_documents);
2678 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2679 2485 }
2680 2486 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2681 2487
2682 - 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
2683 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2488 + if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_report'" ) != $table_report ) {
2684 2489 $sql_report = "
2685 2490 CREATE TABLE `$table_report` (
2686 2491 `id` int(11) NOT NULL AUTO_INCREMENT,
2687 2492 `user_id` int(11) NOT NULL,
@@ -2695,40 +2500,20 @@
2695 2500 ";
2696 2501
2697 2502 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2698 2503 dbDelta( $sql_report );
2699 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2700 2504 }
2701 2505
2702 - $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
2703 2507 if(empty($sqlqry)){
2704 2508
2705 - $query = 'Sample Question ?';
2706 - $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!';
2707 2511
2708 2512 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2709 2513 $format = array('%s','%s', '%s', '%s');
2710 - $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
2711 2515 }
2712 -
2713 - $table = $wpdb->prefix . 'wpbot_subscription';
2714 - 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
2715 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2716 - $sql_sliders_Table = "
2717 - CREATE TABLE IF NOT EXISTS `$table` (
2718 - `id` int(11) NOT NULL AUTO_INCREMENT,
2719 - `name` varchar(256) NOT NULL,
2720 - `email` varchar(256) NOT NULL,
2721 - `phone` varchar(256) NOT NULL,
2722 - `url` text NOT NULL,
2723 - `date` datetime NOT NULL,
2724 - `user_agent` text NOT NULL,
2725 - PRIMARY KEY (`id`)
2726 - ) $collate AUTO_INCREMENT=1 ";
2727 - require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2728 - dbDelta($sql_sliders_Table);
2729 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2730 - }
2731 2516
2732 2517 $url = get_site_url();
2733 2518 $url = wp_parse_url($url);
2734 2519 $domain = $url['host'];
@@ -2820,19 +2605,11 @@
2820 2605 if(!get_option('wp_chatbot_show_home_page')) {
2821 2606 update_option('wp_chatbot_show_home_page', 'on');
2822 2607 }
2823 2608 if(!get_option('qc_wpbot_menu_order')) {
2824 - $site_search_label = get_option('qlcd_wp_chatbot_wildcard_site_search') != '' ? get_option('qlcd_wp_chatbot_wildcard_site_search') : 'Site Search';
2825 - $support_email_label = get_option('qlcd_wp_chatbot_support_email') != '' ? get_option('qlcd_wp_chatbot_support_email') : 'Send us Email.';
2826 - $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!';
2827 - $default_menu = '<span class="qcld-chatbot-wildcard qc_draggable_item qcld-chatbot-site-search" data-wildcart="site_search">' . esc_attr($site_search_label) . '</span>';
2828 - $default_menu .= '<span class="qcld-chatbot-suggest-email qc_draggable_item">' . esc_attr($support_email_label) . '</span>';
2829 - $default_menu .= '<span class="qcld-chatbot-suggest-phone qc_draggable_item">' . esc_attr($support_phone_label) . '</span>';
2830 - update_option('qc_wpbot_menu_order', $default_menu);
2609 + update_option('qc_wpbot_menu_order', '');
2831 2610 }
2832 - if(!get_option('qcld_chatbot_avatar_location')) {
2833 - update_option('qcld_chatbot_avatar_location', 'side');
2834 - }
2611 +
2835 2612 if(!get_option('wp_chatbot_show_posts')) {
2836 2613 update_option('wp_chatbot_show_posts', 'on');
2837 2614 }
2838 2615 if(!get_option('wp_chatbot_show_pages')){
@@ -3159,12 +2936,12 @@
3159 2936 if(!get_option('qlcd_wp_chatbot_notifications')) {
3160 2937 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
3161 2938 }
3162 2939 if(!get_option('support_query')) {
3163 - update_option('support_query', maybe_serialize(array('Sample Question?')));
2940 + update_option('support_query', maybe_serialize(array('What is WPBot?')));
3164 2941 }
3165 2942 if(!get_option('support_ans')) {
3166 - 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.')));
3167 2944 }
3168 2945 if(!get_option('qlcd_wp_chatbot_search_option')) {
3169 2946 update_option('qlcd_wp_chatbot_search_option', 'standard');
3170 2947 }
@@ -3351,10 +3128,9 @@
3351 3128 }
3352 3129 if(!get_option('enable_wp_chatbot_opening_hour')) {
3353 3130 update_option('wpwbot_hours', array());
3354 3131 }
3355 - wpbot_free_set_content_height_defaults();
3356 -
3132 +
3357 3133 if(!get_option('enable_wp_chatbot_dailogflow')) {
3358 3134 update_option('enable_wp_chatbot_dailogflow', '');
3359 3135 }
3360 3136 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
@@ -3388,159 +3164,8 @@
3388 3164 * Reset Options will be insert as defualt data
3389 3165 */
3390 3166 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3391 3167 //add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3392 -
3393 -add_action('wp_ajax_qcld_save_ai_form', 'qcld_save_ai_form');
3394 -add_action('wp_ajax_nopriv_qcld_save_ai_form', 'qcld_save_ai_form');
3395 -
3396 -function qcld_save_ai_form() {
3397 - check_ajax_referer('wp_chatbot', 'nonce');
3398 - if (isset($_POST['data'])) {
3399 - $data_string = stripslashes($_POST['data']);
3400 - $json_data = json_decode($data_string, true);
3401 - if ($json_data && isset($json_data['form_title'])) {
3402 - $post_title = sanitize_text_field($json_data['form_title']) . ' - ' . current_time('mysql');
3403 - $post_id = wp_insert_post(array(
3404 - 'post_title' => $post_title,
3405 - 'post_type' => 'wpbot_form_entry',
3406 - 'post_status' => 'publish'
3407 - ));
3408 - if ($post_id && isset($json_data['data']) && is_array($json_data['data'])) {
3409 - $email_body = "<h2>" . esc_html__('New AI Action Submission', 'chatbot') . "</h2>";
3410 - $email_body .= "<p><strong>" . esc_html__('Action', 'chatbot') . ":</strong> " . sanitize_text_field($json_data['form_title']) . "</p>";
3411 - $email_body .= "<table border='1' cellpadding='10' cellspacing='0' style='border-collapse: collapse; width: 100%; max-width: 600px; font-family: sans-serif;'>";
3412 -
3413 - // Extract user's email for Reply-To (not From, to avoid SMTP rejection)
3414 - $reply_to = '';
3415 -
3416 - foreach ($json_data['data'] as $key => $value) {
3417 - update_post_meta($post_id, sanitize_text_field($key), sanitize_text_field($value));
3418 - $clean_key = ucwords(str_replace(array('-', '_'), ' ', sanitize_text_field($key)));
3419 - $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>";
3420 -
3421 - // Extract email from value — handles plain, [bracketed], and combined answers
3422 - if (preg_match('/\[?([a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,})\]?/', $value, $email_match)) {
3423 - $candidate = sanitize_email(trim($email_match[1]));
3424 - if (is_email($candidate)) {
3425 - $reply_to = $candidate;
3426 - }
3427 - }
3428 - }
3429 - $email_body .= "</table>";
3430 -
3431 - $email_enabled = true; // Default to true if not found for backwards compatibility
3432 - $per_action_emails = '';
3433 - $saved_forms = get_option('wpbot_ai_forms', array());
3434 - $ai_form_title = strtolower( trim( sanitize_text_field( $json_data['form_title'] ) ) );
3435 - if (is_array($saved_forms)) {
3436 - foreach ($saved_forms as $form) {
3437 - if ( strtolower( trim( $form['title'] ) ) === $ai_form_title ) {
3438 - if (isset($form['email'])) {
3439 - $email_enabled = $form['email'] == 1;
3440 - }
3441 - $per_action_emails = isset($form['email_addresses']) ? trim($form['email_addresses']) : '';
3442 - break;
3443 - }
3444 - }
3445 - }
3446 -
3447 - if ($email_enabled) {
3448 - if (!empty($per_action_emails)) {
3449 - $to = array_map('trim', explode(',', $per_action_emails));
3450 - } else {
3451 - $default = get_option('qlcd_wp_chatbot_admin_email', '');
3452 - $to = !empty($default) ? array_map('trim', explode(',', $default)) : get_option('admin_email');
3453 - }
3454 - $subject = sanitize_text_field($json_data['form_title']) . " - " . esc_html__('New AI Action Submission', 'chatbot');
3455 - $headers = array('Content-Type: text/html; charset=UTF-8');
3456 - if (!empty($reply_to)) {
3457 - $headers[] = 'Reply-To: ' . $reply_to;
3458 - }
3459 - wp_mail($to, $subject, $email_body, $headers);
3460 - }
3461 -
3462 - wp_send_json_success('Saved successfully');
3463 - }
3464 - }
3465 - }
3466 - wp_send_json_error('Failed to save');
3467 -}
3468 -
3469 -add_action('wp_ajax_qcld_get_ai_form_entries', 'qcld_get_ai_form_entries');
3470 -function qcld_get_ai_form_entries() {
3471 - check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3472 - if (!current_user_can('manage_options')) {
3473 - wp_send_json_error('Unauthorized');
3474 - }
3475 - $form_title = isset($_POST['form_title']) ? sanitize_text_field($_POST['form_title']) : '';
3476 - if (empty($form_title)) {
3477 - wp_send_json_error('No title provided');
3478 - }
3479 -
3480 - global $wpdb;
3481 - $title_prefix = $form_title . ' - ';
3482 - $where_filter = function ( $where ) use ( $wpdb, $title_prefix ) {
3483 - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s", $wpdb->esc_like( $title_prefix ) . '%' );
3484 - return $where;
3485 - };
3486 - add_filter( 'posts_where', $where_filter );
3487 - $query = new WP_Query( array(
3488 - 'post_type' => 'wpbot_form_entry',
3489 - 'post_status' => 'publish',
3490 - 'posts_per_page' => -1,
3491 - ) );
3492 - remove_filter( 'posts_where', $where_filter );
3493 -
3494 - ob_start();
3495 - if ($query->have_posts()) {
3496 - echo '<table class="wp-list-table widefat fixed striped" style="width: 100%; text-align: left;">';
3497 - echo '<thead><tr><th>Entry</th><th>Data</th><th>Date</th><th>Action</th></tr></thead>';
3498 - echo '<tbody>';
3499 - while ($query->have_posts()) {
3500 - $query->the_post();
3501 - $meta = get_post_meta(get_the_ID());
3502 - echo '<tr>';
3503 - echo '<td><strong>' . esc_html( get_the_title() ) . '</strong></td>';
3504 - echo '<td>';
3505 - foreach ($meta as $key => $values) {
3506 - if (strpos($key, '_') !== 0) { // skip hidden meta
3507 - echo '<strong>' . esc_html($key) . ':</strong> ' . esc_html($values[0]) . '<br>';
3508 - }
3509 - }
3510 - echo '</td>';
3511 - echo '<td>' . esc_html( get_the_date() ) . ' ' . esc_html( get_the_time() ) . '</td>';
3512 - 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>';
3513 - echo '</tr>';
3514 - }
3515 - echo '</tbody></table>';
3516 - wp_reset_postdata();
3517 - } else {
3518 - echo '<p>No entries found for this form.</p>';
3519 - }
3520 - $html = ob_get_clean();
3521 - wp_send_json_success(array('html' => $html));
3522 -}
3523 -
3524 -add_action('wp_ajax_qcld_delete_ai_form_entry', 'qcld_delete_ai_form_entry');
3525 -function qcld_delete_ai_form_entry() {
3526 - check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3527 - if (!current_user_can('manage_options')) {
3528 - wp_send_json_error('Unauthorized');
3529 - }
3530 -
3531 - $entry_id = isset($_POST['entry_id']) ? intval($_POST['entry_id']) : 0;
3532 - if (empty($entry_id)) {
3533 - wp_send_json_error('No entry ID provided');
3534 - }
3535 -
3536 - if (get_post_type($entry_id) === 'wpbot_form_entry') {
3537 - wp_delete_post($entry_id, true);
3538 - wp_send_json_success('Entry deleted successfully');
3539 - } else {
3540 - wp_send_json_error('Invalid entry');
3541 - }
3542 -}
3543 3168 //Jarvis all option will be delete during uninstlling.
3544 3169 if( !function_exists('qcld_wb_chatboot_delete_all_options') ){
3545 3170 function qcld_wb_chatboot_delete_all_options(){
3546 3171
@@ -3780,9 +3405,8 @@
3780 3405 delete_option('wp_chat_user_font_family');
3781 3406 delete_option('wp_chat_bot_font_family');
3782 3407 delete_option('wp_chatbot_bot_font');
3783 3408 delete_option('wp_chatbot_user_font');
3784 - delete_option('qcld_chatbot_avatar_location');
3785 3409 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3786 3410 qcld_wb_chatboot_defualt_options();
3787 3411 $html='Reset all options to default successfully.';
3788 3412 wp_send_json($html);
@@ -3788,22 +3412,8 @@
3788 3412 wp_send_json($html);
3789 3413 }
3790 3414 }
3791 3415
3792 -if( !function_exists('wpbot_free_set_content_height_defaults') ){
3793 - function wpbot_free_set_content_height_defaults() {
3794 - $chatbot_content_max_height = get_option( 'chatbot_content_max_height', false );
3795 - if ( $chatbot_content_max_height === false || $chatbot_content_max_height === '' ) {
3796 - update_option( 'chatbot_content_max_height', '80' );
3797 - }
3798 -
3799 - $chatbot_content_max_height_responsive = get_option( 'chatbot_content_max_height_responsive', false );
3800 - if ( $chatbot_content_max_height_responsive === false || $chatbot_content_max_height_responsive === '' ) {
3801 - update_option( 'chatbot_content_max_height_responsive', '90' );
3802 - }
3803 - }
3804 -}
3805 -
3806 3416 if( !function_exists('wpbot_free_qc_upgrade_completed') ){
3807 3417 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
3808 3418 // The path to our plugin's main file
3809 3419 $our_plugin = plugin_basename( __FILE__ );
@@ -3812,9 +3422,8 @@
3812 3422 // Iterate through the plugins being updated and check if ours is there
3813 3423 foreach( $options['plugins'] as $plugin ) {
3814 3424 if( $plugin == $our_plugin ) {
3815 3425 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3816 - wpbot_free_set_content_height_defaults();
3817 3426 }
3818 3427 }
3819 3428 }
3820 3429 update_option( 'qcld_openai_relevant_post', ['post','page'] );
@@ -3836,17 +3445,9 @@
3836 3445 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3837 3446
3838 3447 }
3839 3448 }
3840 -if( !function_exists('wpbot_Ai_actions_func') ){
3841 - function wpbot_Ai_actions_func (){
3842 3449
3843 - require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/admin/templates/ai-actions.php");
3844 - // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3845 -
3846 -}
3847 -}
3848 -
3849 3450 /**
3850 3451 *
3851 3452 * Function to load translation files.
3852 3453 *
@@ -3860,9 +3461,9 @@
3860 3461 add_action( 'plugins_loaded', 'wp_chatbot_lang_init');
3861 3462
3862 3463 $wpbot_feedback = new Qcld_Wp_Usage_Feedback(
3863 3464 __FILE__,
3864 - 'plugins@quantumcloud.net',
3465 + 'plugins@quantumcloud.com',
3865 3466 false,
3866 3467 true
3867 3468
3868 3469 );
@@ -3874,10 +3475,10 @@
3874 3475
3875 3476 <div class="wrap qcld-main-wrapper">
3876 3477 <div class="qcld-wp-chatbot-wrap-header">
3877 3478
3878 - <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>
3879 - <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>
3880 3481 </div>
3881 3482 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3882 3483 <li>
3883 3484 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
@@ -3915,16 +3516,16 @@
3915 3516 </div>
3916 3517 <div class="panel panel-default">
3917 3518 <div class="panel-heading" role="tab" id="headingSix">
3918 3519 <h4 class="panel-title">
3919 - <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>
3920 3521 </h4>
3921 3522 </div>
3922 3523 <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
3923 3524 <div class="panel-body">
3924 - <?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>
3925 - <?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>
3926 - <?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'); ?>
3927 3528 </div>
3928 3529 </div>
3929 3530 </div>
3930 3531 <div class="panel panel-default">
@@ -3934,9 +3535,9 @@
3934 3535 </h4>
3935 3536 </div>
3936 3537 <div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
3937 3538 <div class="panel-body">
3938 - <?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>
3939 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'); ?>
3940 3541 </div>
3941 3542 </div>
3942 3543 </div>
@@ -4056,9 +3657,9 @@
4056 3657 <div class="to-icon-txt fa-4x-txt ">
4057 3658 <h3>
4058 3659 <span>// </span><?php esc_html_e('Send eMail, Call Me Back &amp; Feedback Collection', 'chatbot'); ?>
4059 3660 </h3>
4060 - <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>
4061 3662 </div>
4062 3663 </div>
4063 3664 <div class="to-icon-box left txt-left">
4064 3665 <div class="to-icon-txt fa-4x-txt ">
@@ -4112,14 +3713,14 @@
4112 3713 </h4>
4113 3714 </div>
4114 3715 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
4115 3716 <div class="panel-body">
4116 - <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>
4117 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>.
4118 3719 </p>
4119 3720 <h4><?php esc_html_e('Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.', 'chatbot'); ?></h4>
4120 3721 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank"><?php esc_html_e('Download Free Version', 'chatbot'); ?></a>
4121 - <a class="FormBuilder" href="https://www.quantumcloud.net/products/conversations-and-form-builder/" target="_blank"><?php esc_html_e('Grab the Pro version', 'chatbot'); ?></a>
3722 + <a class="FormBuilder" href="https://www.quantumcloud.com/products/conversations-and-form-builder/" target="_blank"><?php esc_html_e('Grab the Pro version', 'chatbot'); ?></a>
4122 3723 <h4><?php esc_html_e('What Can You Do with it?', 'chatbot'); ?></h4>
4123 3724 <p><?php esc_html_e('Conversation Forms allows you to create a wide variety of forms, that might include:', 'chatbot'); ?></p>
4124 3725 <ul>
4125 3726 <li><?php esc_html_e('Create menu or button driven conversations', 'chatbot'); ?></li>
@@ -4380,9 +3981,9 @@
4380 3981 </h4>
4381 3982 </div>
4382 3983 <div id="faqcollapsetwelve" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwelve">
4383 3984 <div class="panel-body">
4384 - <?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'); ?>
4385 3986 </div>
4386 3987 </div>
4387 3988 </div>
4388 3989
@@ -4477,17 +4078,17 @@
4477 4078 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4478 4079 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4479 4080 }
4480 4081
4481 - $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
4482 4083 if(empty($sqlqry)){
4483 4084
4484 - $query = 'Sample Question?';
4485 - $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!';
4486 4087
4487 4088 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4488 4089 $format = array('%s','%s', '%s', '%s');
4489 - $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
4490 4091 }
4491 4092
4492 4093 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4493 4094
@@ -4533,11 +4134,11 @@
4533 4134 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4534 4135 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4535 4136 $where = array('id'=>$id);
4536 4137 $whereformat = array('%d');
4537 - $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
4538 4139 }else{
4539 - $wpdb->insert($table,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
4140 + $wpdb->insert($table,$data,$format); //DB Call OK, No Caching OK
4540 4141 }
4541 4142
4542 4143 qcld_mysql_remove_existing_indexes();
4543 4144
@@ -4543,9 +4144,9 @@
4543 4144
4544 4145 // phpcs:ignore
4545 4146 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4546 4147
4547 - wp_safe_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4148 + wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4548 4149
4549 4150 }
4550 4151 $table = $wpdb->prefix.'wpbot_response';
4551 4152
@@ -4576,27 +4177,15 @@
4576 4177 }
4577 4178 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4578 4179 $table = $wpdb->prefix.'wpbot_response';
4579 4180 $fields = rest_sanitize_array(wp_unslash($_POST['qc_bot_str_fields']));
4580 -
4581 - $allowed_fields = array('query', 'keyword', 'response');
4582 - $valid_fields = array();
4583 - if(is_array($fields)){
4584 - foreach($fields as $field){
4585 - if(in_array($field, $allowed_fields)){
4586 - $valid_fields[] = $field;
4587 - }
4588 - }
4589 - }
4590 - $fields = $valid_fields;
4591 -
4592 4181 update_option('qc_bot_str_fields', $fields);
4593 4182 qcld_mysql_remove_existing_indexes();
4594 4183
4595 4184 if($fields && !empty($fields)){
4596 - $safe_fields = array_map(function($f) { return '`' . $f . '`'; }, $fields);
4185 +
4597 4186 // phpcs:ignore
4598 - $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $safe_fields).")");
4187 + $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
4599 4188
4600 4189 }
4601 4190 }
4602 4191
@@ -4620,9 +4209,9 @@
4620 4209 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4621 4210 function qcld_wpbot_simple_response_intent(){
4622 4211 global $wpdb;
4623 4212 $table = $wpdb->prefix.'wpbot_response';
4624 - $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
4625 4214 $response = array();
4626 4215 if(!empty($results)){
4627 4216 foreach($results as $result){
4628 4217 $response[] = $result->intent;
@@ -4635,9 +4224,9 @@
4635 4224 function qcld_mysql_remove_existing_indexes(){
4636 4225 global $wpdb;
4637 4226 $table = $wpdb->prefix.'wpbot_response';
4638 4227
4639 - $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
4640 4229 $indexes = array();
4641 4230 foreach($results as $result){
4642 4231
4643 4232
@@ -4665,4 +4254,6 @@
4665 4254 }
4666 4255 }
4667 4256 }
4668 4257 }
4258 +
4259 +