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 +114 -509 8.7.48.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.4
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.4');
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,30 +172,20 @@
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 - $content = $wpdb->db_server_info();
204 - if ( empty( $content ) ) {
180 + $connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
181 + if($connection === false){
205 182 return;
206 183 }
184 + $content = $connection->server_info;
185 +
186 + $mysql_server_info = $wpdb->db_server_info();
207 187
208 - $mysql_server_info = $content;
209 -
210 188 // Check for the MariaDB.
211 189 $is_mariadb = false;
212 190 if ( ! empty( $mysql_server_info ) && strpos( strtolower( $mysql_server_info ), 'maria' ) !== false ) {
213 191 $is_mariadb = true;
@@ -232,8 +210,9 @@
232 210 }
233 211
234 212 }
235 213
214 + $connection->close();
236 215 }
237 216 }
238 217
239 218 public function mysql_version_notice(){
@@ -257,25 +236,21 @@
257 236 $capability = 'publish_posts';
258 237 }else{
259 238 $capability = 'manage_options';
260 239 }
261 - 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 );
262 241
263 - 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 +
264 244 add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
265 - add_submenu_page( 'wpbot-panel', esc_html('AI Actions'), esc_html('AI Actions'), 'manage_options','wpbot_ai_actions', 'wpbot_Ai_actions_func' );
245 +
266 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 +
267 248 add_action( "load-$hook", [ $this, 'screen_option' ] );
268 249
269 - add_submenu_page( 'wpbot-panel', esc_html('User Data'), esc_html('User Data'), 'manage_options','email-subscription', array($this, 'qcld_wb_chatbot_admin_page1') );
270 -
271 -
272 - //$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') );
273 -
274 -
275 250 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
276 251
277 - 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' );
278 253
279 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' );
280 255
281 256
@@ -314,9 +289,9 @@
314 289 global $wpcommerce, $wp_scripts;
315 290 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
316 291
317 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'
318 - || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" || $_GET["page"] == "wpbot_ai_actions" ) {
293 + || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" ) {
319 294
320 295 wp_enqueue_script('jquery');
321 296 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
322 297
@@ -341,9 +316,9 @@
341 316 wp_enqueue_script( 'wp-color-picker');
342 317 wp_enqueue_script( 'jquery-ui-sortable');
343 318 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
344 319 wp_enqueue_script('qcld-wp-fontpicker');
345 - 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);
346 321 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
347 322 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
348 323 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
349 324 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
@@ -364,9 +339,9 @@
364 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');
365 340 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
366 341 wp_register_script('qcld-wp-chatbot-sweetalrt', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/sweetalrt.js', basename(__FILE__)), array(), true);
367 342 wp_enqueue_script('qcld-wp-chatbot-sweetalrt');
368 - 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);
369 344 wp_enqueue_script('qcld-wp-chatbot-admin-js');
370 345 wp_localize_script('qcld-wp-chatbot-admin-js', 'qcld_gemini_admin_data',
371 346 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
372 347 // WordPress Media library
@@ -382,9 +357,9 @@
382 357 public function qcld_get_formbuilder_forms(){
383 358 global $wpdb;
384 359 $forms = array();
385 360 if(class_exists('Qcformbuilder_Forms_Admin')){
386 - $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
387 362 if(!empty($results)){
388 363 foreach($results as $result){
389 364 $form = maybe_unserialize($result->config);
390 365 $forms[] = trim($form['name']);
@@ -396,15 +371,12 @@
396 371 }else{
397 372 return array();
398 373 }
399 374 }
400 - public function qcld_wb_chatbot_admin_page1() {
401 - require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/admin/templates/email_subscription.php';
402 - }
403 375 public function qcld_wpbot_simple_response_intent(){
404 376 global $wpdb;
405 377 $table = $wpdb->prefix.'wpbot_response';
406 - $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
407 379 $response = array();
408 380 if(!empty($results)){
409 381 foreach($results as $result){
410 382 $response[] = $result->intent;
@@ -416,9 +388,9 @@
416 388 global $wpdb;
417 389 $command = array();
418 390 if(class_exists('Qcformbuilder_Forms_Admin')){
419 391 $primary = 'primary';
420 - $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
421 393
422 394 if(!empty($results)){
423 395 foreach($results as $result){
424 396 $form = maybe_unserialize($result->config);
@@ -437,8 +409,9 @@
437 409 }
438 410 }
439 411 public function promotion_notice(){
440 412 $screen = get_current_screen();
413 + // var_dump($screen->base );
441 414 // if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
442 415 ?>
443 416 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #120976 !important">
444 417 <div class="">
@@ -455,9 +428,9 @@
455 428 public function qcld_get_formbuilder_form_ids(){
456 429 global $wpdb;
457 430 $forms = array();
458 431 if(class_exists('Qcformbuilder_Forms_Admin')){
459 - $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
460 433
461 434 if(!empty($results)){
462 435 foreach($results as $result){
463 436 $form = maybe_unserialize($result->config);
@@ -491,9 +464,9 @@
491 464 $conversation_form_ids = array();
492 465 $conversation_form_names = array();
493 466
494 467 if(class_exists('Qcformbuilder_Forms_Admin')){
495 - $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
496 469 if(!empty($results)){
497 470
498 471 foreach($results as $result){
499 472 $form = maybe_unserialize($result->config);
@@ -519,12 +492,12 @@
519 492 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
520 493 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
521 494 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
522 495 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
523 - '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'))),
524 497 'agent_image' => get_option('wp_chatbot_agent_image'),
525 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'),
526 - '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')),
527 500 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
528 501 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
529 502 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
530 503 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
@@ -550,54 +523,54 @@
550 523 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
551 524 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
552 525 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
553 526 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
554 - 'help_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
555 - 'back_to_start' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
556 - 'help_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
557 - 'reset' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_reset'))),
558 - 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
559 - 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
560 - 'featured_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
561 - 'sale_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
562 - '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'))),
563 536 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
564 - 'product_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
565 - 'product_suggest' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
566 - 'product_infinite' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
567 - 'product_success' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_success'))),
568 - 'product_fail' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
569 - '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'))),
570 543 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
571 - 'support_option_again' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
572 - 'asking_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
573 - 'asking_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
574 - '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'))),
575 548 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
576 - 'asking_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
577 - 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
578 - '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')))),
579 - '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'))),
580 553 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
581 - 'notifications' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_notifications'))),
582 - 'order_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
583 - 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
584 - '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'))),
585 558 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
586 559 'order_login' => is_user_logged_in(),
587 560 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
588 561 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
589 - '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'))),
590 563 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
591 - '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'))),
592 565 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
593 566 'currency_symbol' => '',
594 567 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
595 - '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'))),
596 569 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
597 570 'enable_skype' => get_option('enable_wp_chatbot_skype'),
598 571 'enable_whats' => get_option('enable_wp_chatbot_whats'),
599 - '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'))),
600 573 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
601 574 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
602 575 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
603 576 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
@@ -612,9 +585,9 @@
612 585 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
613 586 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
614 587 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
615 588 'disable_faq' => get_option('disable_wp_chatbot_faq'),
616 - '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'))),
617 590 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
618 591 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
619 592 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
620 593 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
@@ -630,10 +603,8 @@
630 603 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
631 604 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
632 605 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
633 606 'mobile_full_screen' => '1',
634 - 'chatbot_content' => get_option( 'chatbot_content_max_height' ),
635 - 'chatbot_content_responsive' => get_option( 'chatbot_content_max_height_responsive' ),
636 607 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):800),
637 608 'inactive_time' => get_option('wp_chatbot_inactive_time'),
638 609 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
639 610 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
@@ -664,12 +635,8 @@
664 635 'current_user_id' => $user_id,
665 636 'display_name' => esc_html( $display_name ),
666 637 'skip_wp_greetings' => get_option('skip_wp_greetings'),
667 638 'skip_greetings_and_menu' => get_option('skip_wp_greetings_donot_show_menu'),
668 - 'skip_wp_greetings_trigger_intent' => get_option('skip_wp_greetings_trigger_intent'),
669 - 'intent_for_non_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_non_logged_in_user'),
670 - 'intent_for_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_logged_in_user'),
671 - 'ask_email_wp_greetings' => get_option('enable_asking_for_email'),
672 639 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
673 640 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
674 641 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
675 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
@@ -675,10 +642,8 @@
675 642 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
676 643 'qlcd_wp_chatbot_report_text' => get_option('qlcd_wp_chatbot_report_text'),
677 644 'enable_chat_share_menu' => get_option('enable_chat_share_menu'),
678 645 'qlcd_wp_chatbot_share_text' => get_option('qlcd_wp_chatbot_share_text'),
679 - 'icon_video' => get_option('wp_chatbot_icon_video', ''),
680 - 'icon_video_delay' => absint(get_option('wp_chatbot_icon_video_delay', 0)),
681 646
682 647 );
683 648 $user_font = get_option('wp_chatbot_user_font') != '' ? get_option('wp_chatbot_user_font') : '';
684 649 if($user_font != '' ){
@@ -726,18 +691,8 @@
726 691 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
727 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);
728 693 wp_enqueue_script('qcld-wp-chatbot-plugin');
729 694
730 - $saved_ai_forms = get_option('wpbot_ai_forms', array());
731 - $ai_form_titles = array();
732 - if (is_array($saved_ai_forms)) {
733 - foreach ($saved_ai_forms as $form) {
734 - if (!isset($form['interactive']) || $form['interactive'] == 1) {
735 - $ai_form_titles[] = trim(strtolower($form['title']));
736 - }
737 - }
738 - }
739 -
740 695 $nonce = wp_create_nonce('wp_chatbot');
741 696 // Pass data to JS
742 697 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
743 698 'ajax_url' => admin_url('admin-ajax.php'),
@@ -742,9 +697,8 @@
742 697 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
743 698 'ajax_url' => admin_url('admin-ajax.php'),
744 699 'nonce' => $nonce,
745 700 'stream_endpoint' => admin_url('admin-ajax.php?action=qcld_stream_openai'),
746 - 'ai_form_titles' => $ai_form_titles,
747 701 ]);
748 702
749 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);
750 704 wp_enqueue_script('qcld-wp-chatbot-front-js');
@@ -808,11 +762,8 @@
808 762 $user_msg_text_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_text_color') );
809 763 $wp_chatbot_text_color = sanitize_hex_color( get_option('wp_chatbot_text_color') );
810 764 $user_msg_bg_color = sanitize_hex_color( get_option('wp_chatbot_user_msg_bg_color') );
811 765 $header_background_color = sanitize_hex_color( get_option('wp_chatbot_header_background_color') );
812 - $chatbot_content_max_height = sanitize_text_field( get_option('chatbot_content_max_height') );
813 - $chatbot_content_max_height_responsive = sanitize_text_field( get_option('chatbot_content_max_height_responsive') );
814 -
815 766
816 767 $inline_chat_custom_styles .= "
817 768 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
818 769 color: ". $text_color ." !important;
@@ -904,11 +855,8 @@
904 855 font-style: ".$bot_font_family->fontStyle.";
905 856 font-size: ". get_option('wp_chatbot_font_size'). "px;
906 857 }
907 858
908 -
909 -
910 -
911 859 ";
912 860 }
913 861 if ( get_option('enable_wp_chatbot_custom_color') == 1 && ! empty($bot_font) ) {
914 862
@@ -931,9 +879,10 @@
931 879 font-style: {$font_style};
932 880 font-size: {$font_size};
933 881 }
934 882 ";
935 -
883 +
884 + wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
936 885 }
937 886
938 887 if(get_option('wp_chatbot_custom_css')!=""){
939 888
@@ -938,89 +887,8 @@
938 887 if(get_option('wp_chatbot_custom_css')!=""){
939 888
940 889 wp_add_inline_style( 'qcld-wp-chatbot-common-style', get_option('wp_chatbot_custom_css') );
941 890 }
942 -
943 -
944 -
945 -
946 - if ( ( get_option( 'chatbot_content_max_height' ) != '' ) ) {
947 - $chatbot_h_vh = absint( get_option( 'chatbot_content_max_height' ) );
948 - if ( $chatbot_h_vh <= 0 ) {
949 - $chatbot_h_vh = 80;
950 - }
951 - if ( $chatbot_h_vh > 100 ) {
952 - $chatbot_h_vh = 100;
953 - }
954 - // Expand adds a modest bump based on admin height (never above 100vh).
955 - $chatbot_h_expanded_vh = min( 100, $chatbot_h_vh + 8 );
956 -
957 - $chatbot_h_mobile_vh = absint( get_option( 'chatbot_content_max_height_responsive' ) );
958 - if ( $chatbot_h_mobile_vh <= 0 ) {
959 - $chatbot_h_mobile_vh = 90;
960 - }
961 - if ( $chatbot_h_mobile_vh > 100 ) {
962 - $chatbot_h_mobile_vh = 100;
963 - }
964 -
965 - $custom_colors .= ' .slimScrollDiv{
966 - height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
967 - max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
968 - }';
969 -
970 -
971 - $custom_colors .= 'div#wp-chatbot-board-container{
972 - height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
973 - max-height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
974 - }';
975 -
976 - $custom_colors .= '.wp-chatbot-content{
977 - height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
978 - max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
979 - }';
980 -
981 - // Desktop expand: width toggle also grows height from admin base + bump.
982 - $custom_colors .= '
983 - div#wp-chatbot-board-container.wp-chatbot-expanded,
984 - .wp-chatbot-board-container.wp-chatbot-expanded {
985 - height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
986 - max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
987 - }
988 - div#wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
989 - div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
990 - div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner,
991 - .wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
992 - .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
993 - .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner {
994 - height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
995 - max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
996 - }
997 - ';
998 -
999 -
1000 -
1001 - $custom_colors .= '
1002 - @media screen and (max-width: 480px) {
1003 - div#wp-chatbot-board-container{
1004 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1005 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1006 - }
1007 -
1008 - .slimScrollDiv{
1009 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1010 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1011 - }
1012 -
1013 - .wp-chatbot-content{
1014 - height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1015 - max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1016 - }
1017 - }
1018 - ';
1019 -
1020 -
1021 - }
1022 - wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
1023 891 }
1024 892 public function qcld_wb_chatbot_str_replace($messages=array()){
1025 893 $allowed_html = array(
1026 894 'a' => array(
@@ -1202,26 +1070,8 @@
1202 1070 if(isset( $_POST["skip_wp_greetings"])){
1203 1071 $skip_wp_greetings = sanitize_text_field(wp_unslash($_POST["skip_wp_greetings"]));
1204 1072 }else{ $skip_wp_greetings='';}
1205 1073 update_option('skip_wp_greetings', wp_unslash($skip_wp_greetings));
1206 -
1207 - if( $skip_wp_greetings == '1' || $skip_wp_greetings_donot_show_menu == '1' ){
1208 - $ask_email_wp_greetings = '';
1209 - $enable_asking_for_email = '';
1210 - } else {
1211 - if (isset( $_POST["ask_email_wp_greetings"])) {
1212 - $ask_email_wp_greetings = sanitize_text_field(wp_unslash($_POST["ask_email_wp_greetings"]));
1213 - } else {
1214 - $ask_email_wp_greetings = '';
1215 - }
1216 - if (isset( $_POST["enable_asking_for_email"])) {
1217 - $enable_asking_for_email = sanitize_text_field(wp_unslash($_POST["enable_asking_for_email"]));
1218 - } else {
1219 - $enable_asking_for_email = '';
1220 - }
1221 - }
1222 - update_option('ask_email_wp_greetings', wp_unslash($ask_email_wp_greetings));
1223 - update_option('enable_asking_for_email', wp_unslash($enable_asking_for_email));
1224 1074 //Enable /disable wpwbot
1225 1075 if(isset( $_POST["disable_wp_chatbot"])){
1226 1076 $disable_wp_chatbot = sanitize_text_field(wp_unslash($_POST["disable_wp_chatbot"]));
1227 1077 }else{ $disable_wp_chatbot='';}
@@ -1268,21 +1118,9 @@
1268 1118 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
1269 1119 $enable_wp_chatbot_rtl = sanitize_text_field(wp_unslash($_POST["enable_wp_chatbot_rtl"]));
1270 1120 }else{ $enable_wp_chatbot_rtl='';}
1271 1121 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
1272 -
1273 - if(isset( $_POST["chatbot_content_max_height"])) {
1274 - $chatbot_content_max_height = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height"]));
1275 - }else{ $chatbot_content_max_height='';}
1276 - update_option('chatbot_content_max_height', wp_unslash($chatbot_content_max_height));
1277 -
1278 -
1279 - if(isset( $_POST["chatbot_content_max_height_responsive"])) {
1280 - $chatbot_content_max_height_responsive = sanitize_text_field(wp_unslash($_POST["chatbot_content_max_height_responsive"]));
1281 - }else{ $chatbot_content_max_height_responsive='';}
1282 - update_option('chatbot_content_max_height_responsive', wp_unslash($chatbot_content_max_height_responsive));
1283 -
1284 -
1122 +
1285 1123 if(isset( $_POST["show_menu_after_greetings"])) {
1286 1124 $show_menu_after_greetings = sanitize_text_field(wp_unslash($_POST["show_menu_after_greetings"]));
1287 1125 }else{ $show_menu_after_greetings='';}
1288 1126 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
@@ -1423,17 +1261,8 @@
1423 1261 update_option('wp_chatbot_icon', $wp_chatbot_icon);
1424 1262
1425 1263 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_floatingiconbg_color'])) : '#fff';
1426 1264 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
1427 -
1428 - // Custom icon video / YouTube link
1429 - $wp_chatbot_icon_youtube_url = isset( $_POST['wp_chatbot_icon_youtube_url'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_youtube_url'] ) : '';
1430 - $wp_chatbot_icon_video_upload = isset( $_POST['wp_chatbot_icon_video'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_video'] ) : '';
1431 - // YouTube URL takes priority; fall back to uploaded video
1432 - $wp_chatbot_icon_video = ( $wp_chatbot_icon_youtube_url !== '' ) ? $wp_chatbot_icon_youtube_url : $wp_chatbot_icon_video_upload;
1433 - update_option( 'wp_chatbot_icon_video', $wp_chatbot_icon_video );
1434 - $wp_chatbot_icon_video_delay = isset( $_POST['wp_chatbot_icon_video_delay'] ) ? absint( $_POST['wp_chatbot_icon_video_delay'] ) : 0;
1435 - update_option( 'wp_chatbot_icon_video_delay', $wp_chatbot_icon_video_delay );
1436 1265
1437 1266 // upload custom wpwbot icon path
1438 1267 $wp_chatbot_custom_icon_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_icon_path']));
1439 1268 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
@@ -1449,14 +1278,8 @@
1449 1278
1450 1279 //Theming
1451 1280 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field(wp_unslash($_POST['qcld_wb_chatbot_theme'])) : 'template-00');
1452 1281 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
1453 -
1454 - //Avatar Location
1455 - if(isset($_POST['qcld_chatbot_avatar_location'])) {
1456 - $qcld_chatbot_avatar_location = sanitize_text_field(wp_unslash($_POST['qcld_chatbot_avatar_location']));
1457 - update_option('qcld_chatbot_avatar_location', $qcld_chatbot_avatar_location);
1458 - }
1459 1282 //Theme custom background option
1460 1283 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
1461 1284 $qcld_wb_chatbot_change_bg = sanitize_text_field(wp_unslash($_POST["qcld_wb_chatbot_change_bg"]));
1462 1285 }else{$qcld_wb_chatbot_change_bg='';}
@@ -1470,9 +1293,9 @@
1470 1293
1471 1294 //To override style use custom css.
1472 1295 if(isset($_POST["wp_chatbot_custom_css"])){
1473 1296 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
1474 - 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));
1475 1298 }
1476 1299
1477 1300 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_id"])) {
1478 1301 $qlcd_wp_chatbot_dialogflow_project_id = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_id"]));
@@ -2638,15 +2461,13 @@
2638 2461
2639 2462 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2640 2463 dbDelta( $sql_sliders_Table1 );
2641 2464
2642 -
2643 2465 //Bot Response Table
2644 2466 $table_rag_documents = $wpdb->prefix . "rag_documents";
2645 2467
2646 2468 $charset = $wpdb->get_charset_collate();
2647 - 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
2648 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2469 + if ($wpdb->get_var("SHOW TABLES LIKE '$table_rag_documents'") != $table_rag_documents) {
2649 2470 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2650 2471 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2651 2472 doc_id VARCHAR(100) DEFAULT NULL,
2652 2473 title VARCHAR(255) NOT NULL,
@@ -2660,14 +2481,12 @@
2660 2481 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2661 2482 ) $charset;";
2662 2483 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2663 2484 dbDelta($sql_rag_documents);
2664 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2665 2485 }
2666 2486 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2667 2487
2668 - 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
2669 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2488 + if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_report'" ) != $table_report ) {
2670 2489 $sql_report = "
2671 2490 CREATE TABLE `$table_report` (
2672 2491 `id` int(11) NOT NULL AUTO_INCREMENT,
2673 2492 `user_id` int(11) NOT NULL,
@@ -2681,40 +2500,20 @@
2681 2500 ";
2682 2501
2683 2502 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2684 2503 dbDelta( $sql_report );
2685 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2686 2504 }
2687 2505
2688 - $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
2689 2507 if(empty($sqlqry)){
2690 2508
2691 - $query = 'Sample Question ?';
2692 - $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!';
2693 2511
2694 2512 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2695 2513 $format = array('%s','%s', '%s', '%s');
2696 - $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
2697 2515 }
2698 -
2699 - $table = $wpdb->prefix . 'wpbot_subscription';
2700 - 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
2701 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2702 - $sql_sliders_Table = "
2703 - CREATE TABLE IF NOT EXISTS `$table` (
2704 - `id` int(11) NOT NULL AUTO_INCREMENT,
2705 - `name` varchar(256) NOT NULL,
2706 - `email` varchar(256) NOT NULL,
2707 - `phone` varchar(256) NOT NULL,
2708 - `url` text NOT NULL,
2709 - `date` datetime NOT NULL,
2710 - `user_agent` text NOT NULL,
2711 - PRIMARY KEY (`id`)
2712 - ) $collate AUTO_INCREMENT=1 ";
2713 - require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2714 - dbDelta($sql_sliders_Table);
2715 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2716 - }
2717 2516
2718 2517 $url = get_site_url();
2719 2518 $url = wp_parse_url($url);
2720 2519 $domain = $url['host'];
@@ -2806,19 +2605,11 @@
2806 2605 if(!get_option('wp_chatbot_show_home_page')) {
2807 2606 update_option('wp_chatbot_show_home_page', 'on');
2808 2607 }
2809 2608 if(!get_option('qc_wpbot_menu_order')) {
2810 - $site_search_label = get_option('qlcd_wp_chatbot_wildcard_site_search') != '' ? get_option('qlcd_wp_chatbot_wildcard_site_search') : 'Site Search';
2811 - $support_email_label = get_option('qlcd_wp_chatbot_support_email') != '' ? get_option('qlcd_wp_chatbot_support_email') : 'Send us Email.';
2812 - $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!';
2813 - $default_menu = '<span class="qcld-chatbot-wildcard qc_draggable_item qcld-chatbot-site-search" data-wildcart="site_search">' . esc_attr($site_search_label) . '</span>';
2814 - $default_menu .= '<span class="qcld-chatbot-suggest-email qc_draggable_item">' . esc_attr($support_email_label) . '</span>';
2815 - $default_menu .= '<span class="qcld-chatbot-suggest-phone qc_draggable_item">' . esc_attr($support_phone_label) . '</span>';
2816 - update_option('qc_wpbot_menu_order', $default_menu);
2609 + update_option('qc_wpbot_menu_order', '');
2817 2610 }
2818 - if(!get_option('qcld_chatbot_avatar_location')) {
2819 - update_option('qcld_chatbot_avatar_location', 'side');
2820 - }
2611 +
2821 2612 if(!get_option('wp_chatbot_show_posts')) {
2822 2613 update_option('wp_chatbot_show_posts', 'on');
2823 2614 }
2824 2615 if(!get_option('wp_chatbot_show_pages')){
@@ -3145,12 +2936,12 @@
3145 2936 if(!get_option('qlcd_wp_chatbot_notifications')) {
3146 2937 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
3147 2938 }
3148 2939 if(!get_option('support_query')) {
3149 - update_option('support_query', maybe_serialize(array('Sample Question?')));
2940 + update_option('support_query', maybe_serialize(array('What is WPBot?')));
3150 2941 }
3151 2942 if(!get_option('support_ans')) {
3152 - 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.')));
3153 2944 }
3154 2945 if(!get_option('qlcd_wp_chatbot_search_option')) {
3155 2946 update_option('qlcd_wp_chatbot_search_option', 'standard');
3156 2947 }
@@ -3337,10 +3128,9 @@
3337 3128 }
3338 3129 if(!get_option('enable_wp_chatbot_opening_hour')) {
3339 3130 update_option('wpwbot_hours', array());
3340 3131 }
3341 - wpbot_free_set_content_height_defaults();
3342 -
3132 +
3343 3133 if(!get_option('enable_wp_chatbot_dailogflow')) {
3344 3134 update_option('enable_wp_chatbot_dailogflow', '');
3345 3135 }
3346 3136 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
@@ -3374,159 +3164,8 @@
3374 3164 * Reset Options will be insert as defualt data
3375 3165 */
3376 3166 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3377 3167 //add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3378 -
3379 -add_action('wp_ajax_qcld_save_ai_form', 'qcld_save_ai_form');
3380 -add_action('wp_ajax_nopriv_qcld_save_ai_form', 'qcld_save_ai_form');
3381 -
3382 -function qcld_save_ai_form() {
3383 - check_ajax_referer('wp_chatbot', 'nonce');
3384 - if (isset($_POST['data'])) {
3385 - $data_string = stripslashes($_POST['data']);
3386 - $json_data = json_decode($data_string, true);
3387 - if ($json_data && isset($json_data['form_title'])) {
3388 - $post_title = sanitize_text_field($json_data['form_title']) . ' - ' . current_time('mysql');
3389 - $post_id = wp_insert_post(array(
3390 - 'post_title' => $post_title,
3391 - 'post_type' => 'wpbot_form_entry',
3392 - 'post_status' => 'publish'
3393 - ));
3394 - if ($post_id && isset($json_data['data']) && is_array($json_data['data'])) {
3395 - $email_body = "<h2>" . esc_html__('New AI Action Submission', 'chatbot') . "</h2>";
3396 - $email_body .= "<p><strong>" . esc_html__('Action', 'chatbot') . ":</strong> " . sanitize_text_field($json_data['form_title']) . "</p>";
3397 - $email_body .= "<table border='1' cellpadding='10' cellspacing='0' style='border-collapse: collapse; width: 100%; max-width: 600px; font-family: sans-serif;'>";
3398 -
3399 - // Extract user's email for Reply-To (not From, to avoid SMTP rejection)
3400 - $reply_to = '';
3401 -
3402 - foreach ($json_data['data'] as $key => $value) {
3403 - update_post_meta($post_id, sanitize_text_field($key), sanitize_text_field($value));
3404 - $clean_key = ucwords(str_replace(array('-', '_'), ' ', sanitize_text_field($key)));
3405 - $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>";
3406 -
3407 - // Extract email from value — handles plain, [bracketed], and combined answers
3408 - if (preg_match('/\[?([a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,})\]?/', $value, $email_match)) {
3409 - $candidate = sanitize_email(trim($email_match[1]));
3410 - if (is_email($candidate)) {
3411 - $reply_to = $candidate;
3412 - }
3413 - }
3414 - }
3415 - $email_body .= "</table>";
3416 -
3417 - $email_enabled = true; // Default to true if not found for backwards compatibility
3418 - $per_action_emails = '';
3419 - $saved_forms = get_option('wpbot_ai_forms', array());
3420 - $ai_form_title = strtolower( trim( sanitize_text_field( $json_data['form_title'] ) ) );
3421 - if (is_array($saved_forms)) {
3422 - foreach ($saved_forms as $form) {
3423 - if ( strtolower( trim( $form['title'] ) ) === $ai_form_title ) {
3424 - if (isset($form['email'])) {
3425 - $email_enabled = $form['email'] == 1;
3426 - }
3427 - $per_action_emails = isset($form['email_addresses']) ? trim($form['email_addresses']) : '';
3428 - break;
3429 - }
3430 - }
3431 - }
3432 -
3433 - if ($email_enabled) {
3434 - if (!empty($per_action_emails)) {
3435 - $to = array_map('trim', explode(',', $per_action_emails));
3436 - } else {
3437 - $default = get_option('qlcd_wp_chatbot_admin_email', '');
3438 - $to = !empty($default) ? array_map('trim', explode(',', $default)) : get_option('admin_email');
3439 - }
3440 - $subject = sanitize_text_field($json_data['form_title']) . " - " . esc_html__('New AI Action Submission', 'chatbot');
3441 - $headers = array('Content-Type: text/html; charset=UTF-8');
3442 - if (!empty($reply_to)) {
3443 - $headers[] = 'Reply-To: ' . $reply_to;
3444 - }
3445 - wp_mail($to, $subject, $email_body, $headers);
3446 - }
3447 -
3448 - wp_send_json_success('Saved successfully');
3449 - }
3450 - }
3451 - }
3452 - wp_send_json_error('Failed to save');
3453 -}
3454 -
3455 -add_action('wp_ajax_qcld_get_ai_form_entries', 'qcld_get_ai_form_entries');
3456 -function qcld_get_ai_form_entries() {
3457 - check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3458 - if (!current_user_can('manage_options')) {
3459 - wp_send_json_error('Unauthorized');
3460 - }
3461 - $form_title = isset($_POST['form_title']) ? sanitize_text_field($_POST['form_title']) : '';
3462 - if (empty($form_title)) {
3463 - wp_send_json_error('No title provided');
3464 - }
3465 -
3466 - global $wpdb;
3467 - $title_prefix = $form_title . ' - ';
3468 - $where_filter = function ( $where ) use ( $wpdb, $title_prefix ) {
3469 - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s", $wpdb->esc_like( $title_prefix ) . '%' );
3470 - return $where;
3471 - };
3472 - add_filter( 'posts_where', $where_filter );
3473 - $query = new WP_Query( array(
3474 - 'post_type' => 'wpbot_form_entry',
3475 - 'post_status' => 'publish',
3476 - 'posts_per_page' => -1,
3477 - ) );
3478 - remove_filter( 'posts_where', $where_filter );
3479 -
3480 - ob_start();
3481 - if ($query->have_posts()) {
3482 - echo '<table class="wp-list-table widefat fixed striped" style="width: 100%; text-align: left;">';
3483 - echo '<thead><tr><th>Entry</th><th>Data</th><th>Date</th><th>Action</th></tr></thead>';
3484 - echo '<tbody>';
3485 - while ($query->have_posts()) {
3486 - $query->the_post();
3487 - $meta = get_post_meta(get_the_ID());
3488 - echo '<tr>';
3489 - echo '<td><strong>' . esc_html( get_the_title() ) . '</strong></td>';
3490 - echo '<td>';
3491 - foreach ($meta as $key => $values) {
3492 - if (strpos($key, '_') !== 0) { // skip hidden meta
3493 - echo '<strong>' . esc_html($key) . ':</strong> ' . esc_html($values[0]) . '<br>';
3494 - }
3495 - }
3496 - echo '</td>';
3497 - echo '<td>' . esc_html( get_the_date() ) . ' ' . esc_html( get_the_time() ) . '</td>';
3498 - 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>';
3499 - echo '</tr>';
3500 - }
3501 - echo '</tbody></table>';
3502 - wp_reset_postdata();
3503 - } else {
3504 - echo '<p>No entries found for this form.</p>';
3505 - }
3506 - $html = ob_get_clean();
3507 - wp_send_json_success(array('html' => $html));
3508 -}
3509 -
3510 -add_action('wp_ajax_qcld_delete_ai_form_entry', 'qcld_delete_ai_form_entry');
3511 -function qcld_delete_ai_form_entry() {
3512 - check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3513 - if (!current_user_can('manage_options')) {
3514 - wp_send_json_error('Unauthorized');
3515 - }
3516 -
3517 - $entry_id = isset($_POST['entry_id']) ? intval($_POST['entry_id']) : 0;
3518 - if (empty($entry_id)) {
3519 - wp_send_json_error('No entry ID provided');
3520 - }
3521 -
3522 - if (get_post_type($entry_id) === 'wpbot_form_entry') {
3523 - wp_delete_post($entry_id, true);
3524 - wp_send_json_success('Entry deleted successfully');
3525 - } else {
3526 - wp_send_json_error('Invalid entry');
3527 - }
3528 -}
3529 3168 //Jarvis all option will be delete during uninstlling.
3530 3169 if( !function_exists('qcld_wb_chatboot_delete_all_options') ){
3531 3170 function qcld_wb_chatboot_delete_all_options(){
3532 3171
@@ -3766,9 +3405,8 @@
3766 3405 delete_option('wp_chat_user_font_family');
3767 3406 delete_option('wp_chat_bot_font_family');
3768 3407 delete_option('wp_chatbot_bot_font');
3769 3408 delete_option('wp_chatbot_user_font');
3770 - delete_option('qcld_chatbot_avatar_location');
3771 3409 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3772 3410 qcld_wb_chatboot_defualt_options();
3773 3411 $html='Reset all options to default successfully.';
3774 3412 wp_send_json($html);
@@ -3774,22 +3412,8 @@
3774 3412 wp_send_json($html);
3775 3413 }
3776 3414 }
3777 3415
3778 -if( !function_exists('wpbot_free_set_content_height_defaults') ){
3779 - function wpbot_free_set_content_height_defaults() {
3780 - $chatbot_content_max_height = get_option( 'chatbot_content_max_height', false );
3781 - if ( $chatbot_content_max_height === false || $chatbot_content_max_height === '' ) {
3782 - update_option( 'chatbot_content_max_height', '80' );
3783 - }
3784 -
3785 - $chatbot_content_max_height_responsive = get_option( 'chatbot_content_max_height_responsive', false );
3786 - if ( $chatbot_content_max_height_responsive === false || $chatbot_content_max_height_responsive === '' ) {
3787 - update_option( 'chatbot_content_max_height_responsive', '90' );
3788 - }
3789 - }
3790 -}
3791 -
3792 3416 if( !function_exists('wpbot_free_qc_upgrade_completed') ){
3793 3417 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
3794 3418 // The path to our plugin's main file
3795 3419 $our_plugin = plugin_basename( __FILE__ );
@@ -3798,9 +3422,8 @@
3798 3422 // Iterate through the plugins being updated and check if ours is there
3799 3423 foreach( $options['plugins'] as $plugin ) {
3800 3424 if( $plugin == $our_plugin ) {
3801 3425 set_transient( 'qcld_bot_clear_cache', 1, DAY_IN_SECONDS );
3802 - wpbot_free_set_content_height_defaults();
3803 3426 }
3804 3427 }
3805 3428 }
3806 3429 update_option( 'qcld_openai_relevant_post', ['post','page'] );
@@ -3822,17 +3445,9 @@
3822 3445 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3823 3446
3824 3447 }
3825 3448 }
3826 -if( !function_exists('wpbot_Ai_actions_func') ){
3827 - function wpbot_Ai_actions_func (){
3828 3449
3829 - require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/admin/templates/ai-actions.php");
3830 - // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3831 -
3832 -}
3833 -}
3834 -
3835 3450 /**
3836 3451 *
3837 3452 * Function to load translation files.
3838 3453 *
@@ -3860,10 +3475,10 @@
3860 3475
3861 3476 <div class="wrap qcld-main-wrapper">
3862 3477 <div class="qcld-wp-chatbot-wrap-header">
3863 3478
3864 - <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>
3865 - <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>
3866 3481 </div>
3867 3482 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3868 3483 <li>
3869 3484 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
@@ -3901,16 +3516,16 @@
3901 3516 </div>
3902 3517 <div class="panel panel-default">
3903 3518 <div class="panel-heading" role="tab" id="headingSix">
3904 3519 <h4 class="panel-title">
3905 - <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>
3906 3521 </h4>
3907 3522 </div>
3908 3523 <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
3909 3524 <div class="panel-body">
3910 - <?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>
3911 - <?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>
3912 - <?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'); ?>
3913 3528 </div>
3914 3529 </div>
3915 3530 </div>
3916 3531 <div class="panel panel-default">
@@ -3920,9 +3535,9 @@
3920 3535 </h4>
3921 3536 </div>
3922 3537 <div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
3923 3538 <div class="panel-body">
3924 - <?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>
3925 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'); ?>
3926 3541 </div>
3927 3542 </div>
3928 3543 </div>
@@ -4042,9 +3657,9 @@
4042 3657 <div class="to-icon-txt fa-4x-txt ">
4043 3658 <h3>
4044 3659 <span>// </span><?php esc_html_e('Send eMail, Call Me Back &amp; Feedback Collection', 'chatbot'); ?>
4045 3660 </h3>
4046 - <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>
4047 3662 </div>
4048 3663 </div>
4049 3664 <div class="to-icon-box left txt-left">
4050 3665 <div class="to-icon-txt fa-4x-txt ">
@@ -4098,9 +3713,9 @@
4098 3713 </h4>
4099 3714 </div>
4100 3715 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
4101 3716 <div class="panel-body">
4102 - <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>
4103 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>.
4104 3719 </p>
4105 3720 <h4><?php esc_html_e('Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.', 'chatbot'); ?></h4>
4106 3721 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank"><?php esc_html_e('Download Free Version', 'chatbot'); ?></a>
@@ -4366,9 +3981,9 @@
4366 3981 </h4>
4367 3982 </div>
4368 3983 <div id="faqcollapsetwelve" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwelve">
4369 3984 <div class="panel-body">
4370 - <?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'); ?>
4371 3986 </div>
4372 3987 </div>
4373 3988 </div>
4374 3989
@@ -4463,17 +4078,17 @@
4463 4078 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4464 4079 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4465 4080 }
4466 4081
4467 - $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
4468 4083 if(empty($sqlqry)){
4469 4084
4470 - $query = 'Sample Question?';
4471 - $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!';
4472 4087
4473 4088 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4474 4089 $format = array('%s','%s', '%s', '%s');
4475 - $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
4476 4091 }
4477 4092
4478 4093 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4479 4094
@@ -4519,11 +4134,11 @@
4519 4134 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4520 4135 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4521 4136 $where = array('id'=>$id);
4522 4137 $whereformat = array('%d');
4523 - $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
4524 4139 }else{
4525 - $wpdb->insert($table,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
4140 + $wpdb->insert($table,$data,$format); //DB Call OK, No Caching OK
4526 4141 }
4527 4142
4528 4143 qcld_mysql_remove_existing_indexes();
4529 4144
@@ -4529,9 +4144,9 @@
4529 4144
4530 4145 // phpcs:ignore
4531 4146 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4532 4147
4533 - wp_safe_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4148 + wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4534 4149
4535 4150 }
4536 4151 $table = $wpdb->prefix.'wpbot_response';
4537 4152
@@ -4562,27 +4177,15 @@
4562 4177 }
4563 4178 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4564 4179 $table = $wpdb->prefix.'wpbot_response';
4565 4180 $fields = rest_sanitize_array(wp_unslash($_POST['qc_bot_str_fields']));
4566 -
4567 - $allowed_fields = array('query', 'keyword', 'response');
4568 - $valid_fields = array();
4569 - if(is_array($fields)){
4570 - foreach($fields as $field){
4571 - if(in_array($field, $allowed_fields)){
4572 - $valid_fields[] = $field;
4573 - }
4574 - }
4575 - }
4576 - $fields = $valid_fields;
4577 -
4578 4181 update_option('qc_bot_str_fields', $fields);
4579 4182 qcld_mysql_remove_existing_indexes();
4580 4183
4581 4184 if($fields && !empty($fields)){
4582 - $safe_fields = array_map(function($f) { return '`' . $f . '`'; }, $fields);
4185 +
4583 4186 // phpcs:ignore
4584 - $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $safe_fields).")");
4187 + $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
4585 4188
4586 4189 }
4587 4190 }
4588 4191
@@ -4606,9 +4209,9 @@
4606 4209 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4607 4210 function qcld_wpbot_simple_response_intent(){
4608 4211 global $wpdb;
4609 4212 $table = $wpdb->prefix.'wpbot_response';
4610 - $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
4611 4214 $response = array();
4612 4215 if(!empty($results)){
4613 4216 foreach($results as $result){
4614 4217 $response[] = $result->intent;
@@ -4621,9 +4224,9 @@
4621 4224 function qcld_mysql_remove_existing_indexes(){
4622 4225 global $wpdb;
4623 4226 $table = $wpdb->prefix.'wpbot_response';
4624 4227
4625 - $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
4626 4229 $indexes = array();
4627 4230 foreach($results as $result){
4628 4231
4629 4232
@@ -4651,4 +4254,6 @@
4651 4254 }
4652 4255 }
4653 4256 }
4654 4257 }
4258 +
4259 +