PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.8.1
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.8.1
8.8.1 8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 All 537 releases
← All changes | qcld-wpwbot.php +290 -45 8.6.6 → 8.8.1 View file →
@@ -3,14 +3,14 @@
3 3 * Plugin Name: AI ChatBot - WPBot
4 4 * Plugin URI: https://www.wpbot.pro/
5 5 * Description: ChatBot is a native WordPress ChatBot plugin to provide live chat support and lead generation
6 6 * Donate link: https://www.wpbot.pro/
7 - * Version: 8.6.6
7 + * Version: 8.8.1
8 8 * @author QuantumCloud
9 9 * Author: ChatBot for WordPress - WPBot
10 10 * Author URI: https://www.wpbot.pro/
11 - * Requires at least: 4.6
12 - * Tested up to: 7.0
11 + * Requires at least: 5.5
12 + * Tested up to: 7.1
13 13 * Text Domain: chatbot
14 14 * Domain Path: /languages
15 15 * License: GPL2
16 16 */
@@ -18,10 +18,8 @@
18 18
19 19
20 20 if (!defined('ABSPATH')) exit; // Exit if accessed directly.
21 21
22 -
23 -
24 22 // Abort execution if Pro version is active to prevent conflicts
25 23 if ( ! function_exists( 'is_plugin_active' ) ) {
26 24 require_once ABSPATH . 'wp-admin/includes/plugin.php';
27 25 }
@@ -49,9 +47,9 @@
49 47 }
50 48 }
51 49
52 50 if ( ! defined( 'QCLD_wpCHATBOT_VERSION' ) ) {
53 - define('QCLD_wpCHATBOT_VERSION', '8.6.6');
51 + define('QCLD_wpCHATBOT_VERSION', '8.8.1');
54 52 }
55 53 if ( ! defined( 'QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION' ) ) {
56 54 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
57 55 }
@@ -89,8 +87,9 @@
89 87 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openai/qcld-bot-openai.php");
90 88 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/openrouter/qcld-bot-openrouter.php");
91 89 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/integration/gemini/qcld-bot-gemini.php");
92 90 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");
93 92 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."class-qc-free-plugin-upgrade-notice.php");
94 93 require_once("class-plugin-deactivate-feedback.php");
95 94 require_once("qc-support-promo-page/class-qc-support-promo-page.php");
96 95 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."/functions.php");
@@ -108,8 +107,13 @@
108 107 // Built-in Chat Sessions & Analytics module.
109 108 // Defers to the Pro addon automatically when it's active.
110 109 require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/chat-sessions/wpbot-chat-sessions.php' );
111 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 +
112 116 /**
113 117 * Main Class.
114 118 */
115 119
@@ -155,18 +159,18 @@
155 159 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
156 160
157 161 }
158 162
159 - if( ( !empty($_GET['page']) && $_GET["page"] == "wpbot") || ( !empty($_GET['page']) && $_GET["page"] == "wpbot-panel")|| ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_openAi') || ( !empty($_GET['page']) && $_GET['page'] == 'simple-text-response') ){
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') ){
160 164 // add_action( 'admin_notices', array( $this, 'promotion_notice' ) );
161 165
162 166 }
163 167
164 168 if (is_admin() && !empty($_GET["page"]) && ($_GET["page"] == "wpbot") || (!empty($_GET['page']) && $_GET['page']=='wpbot_help_page')
165 -
169 + || ( !empty($_GET['page']) && $_GET['page'] == 'wpbot_ai_actions')
166 170 || (!empty($_GET['page']) && $_GET['page']=='wpbot_openAi')
167 171
168 - || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") ) {
172 + || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") || ( !empty($_GET['page']) && $_GET["page"] == "wpbot_ai_actions") ) {
169 173 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
170 174 if( get_option('wp_chatbot_index_count')<=0 && get_option('qlcd_wp_chatbot_search_option')=='advanced'){
171 175
172 176 add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
@@ -185,20 +189,30 @@
185 189 if (!is_admin() && get_option('disable_wp_chatbot') != 1 && wp_chatbot_load_controlling() === true) {
186 190 add_action('wp_enqueue_scripts', array($this, 'qcld_wb_chatbot_frontend_scripts'));
187 191 }
188 192 }
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 + }
189 203 public function qcld_wpchatbot_init2_fnc(){
204 + $this->qcld_register_ai_form_cpt();
190 205 global $wpdb;
191 206 if( is_admin() ){
192 207
193 - $connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
194 - if($connection === false){
208 + $content = $wpdb->db_server_info();
209 + if ( empty( $content ) ) {
195 210 return;
196 211 }
197 - $content = $connection->server_info;
198 -
199 - $mysql_server_info = $wpdb->db_server_info();
200 212
213 + $mysql_server_info = $content;
214 +
201 215 // Check for the MariaDB.
202 216 $is_mariadb = false;
203 217 if ( ! empty( $mysql_server_info ) && strpos( strtolower( $mysql_server_info ), 'maria' ) !== false ) {
204 218 $is_mariadb = true;
@@ -223,9 +237,8 @@
223 237 }
224 238
225 239 }
226 240
227 - $connection->close();
228 241 }
229 242 }
230 243
231 244 public function mysql_version_notice(){
@@ -251,17 +264,28 @@
251 264 $capability = 'manage_options';
252 265 }
253 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 );
254 267
255 - add_submenu_page( 'wpbot-panel', esc_html('Settings'), esc_html('Settings'), 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
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') );
269 + 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 + }
256 275
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 + }
279 +
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 + add_action( "load-$hook", [ $this, 'screen_option' ] );
282 +
257 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') );
258 284
259 - add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
260 285
261 - $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') );
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') );
262 287
263 - add_action( "load-$hook", [ $this, 'screen_option' ] );
264 288
265 289 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
266 290
267 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' );
@@ -304,9 +328,9 @@
304 328 global $wpcommerce, $wp_scripts;
305 329 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
306 330
307 331 if (((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) || ($hook == "widgets.php") || $_GET['page']=='wpbot_help_page' || $_GET['page']=='wpbot_openAi' || $_GET['page']=='simple-text-response'
308 - || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" ) {
332 + || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" || $_GET["page"] == "wpbot_ai_actions" ) {
309 333
310 334 wp_enqueue_script('jquery');
311 335 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
312 336
@@ -331,9 +355,9 @@
331 355 wp_enqueue_script( 'wp-color-picker');
332 356 wp_enqueue_script( 'jquery-ui-sortable');
333 357 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
334 358 wp_enqueue_script('qcld-wp-fontpicker');
335 - wp_register_script('qcld-wp-chatbot-cbpFWTabs', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/cbpFWTabs.js', basename(__FILE__)), array(), true);
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);
336 360 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
337 361 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
338 362 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
339 363 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
@@ -354,9 +378,9 @@
354 378 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');
355 379 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
356 380 wp_register_script('qcld-wp-chatbot-sweetalrt', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/sweetalrt.js', basename(__FILE__)), array(), true);
357 381 wp_enqueue_script('qcld-wp-chatbot-sweetalrt');
358 - 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);
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);
359 383 wp_enqueue_script('qcld-wp-chatbot-admin-js');
360 384 wp_localize_script('qcld-wp-chatbot-admin-js', 'qcld_gemini_admin_data',
361 385 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
362 386 // WordPress Media library
@@ -634,8 +658,9 @@
634 658 'is_stream_enabled' => ( get_option('is_stream_enabled', '1') == '1' ? '1' : '0' ),
635 659 'qcld_openai_append_content' => get_option('qcld_openai_append_content'),
636 660 'openrouter_enabled' => (get_option('qcld_openrouter_enabled')=='1'? get_option('qcld_openrouter_enabled') : '0'),
637 661 'gemini_enabled' => (get_option('qcld_gemini_enabled')=='1'? get_option('qcld_gemini_enabled') : '0'),
662 + 'claude_enabled' => (get_option('qcld_claude_enabled')=='1'? get_option('qcld_claude_enabled') : '0'),
638 663 'grok_enabled' => (get_option('qcld_grok_enabled')=='1'? get_option('qcld_grok_enabled') : '0'),
639 664 'qcld_gemini_prepend_content' => get_option('qcld_gemini_prepend_content'),
640 665 'qcld_gemini_append_content' => get_option('qcld_gemini_append_content'),
641 666 'qcld_openrouter_append_content' => get_option('qcld_openrouter_append_content'),
@@ -654,8 +679,11 @@
654 679 'current_user_id' => $user_id,
655 680 'display_name' => esc_html( $display_name ),
656 681 'skip_wp_greetings' => get_option('skip_wp_greetings'),
657 682 'skip_greetings_and_menu' => get_option('skip_wp_greetings_donot_show_menu'),
683 + 'skip_wp_greetings_trigger_intent' => get_option('skip_wp_greetings_trigger_intent'),
684 + 'intent_for_non_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_non_logged_in_user'),
685 + 'intent_for_logged_in_user' => get_option('qlcd_wp_chatbot_intent_for_logged_in_user'),
658 686 'ask_email_wp_greetings' => get_option('enable_asking_for_email'),
659 687 'skip_chat_reactions_menu' => get_option('skip_chat_reactions_menu'),
660 688 'qlcd_wp_chatbot_like_text' => get_option('qlcd_wp_chatbot_like_text'),
661 689 'qlcd_wp_chatbot_dislike_text' => get_option('qlcd_wp_chatbot_dislike_text'),
@@ -662,8 +690,10 @@
662 690 'enable_chat_report_menu' => get_option('enable_chat_report_menu'),
663 691 'qlcd_wp_chatbot_report_text' => get_option('qlcd_wp_chatbot_report_text'),
664 692 'enable_chat_share_menu' => get_option('enable_chat_share_menu'),
665 693 'qlcd_wp_chatbot_share_text' => get_option('qlcd_wp_chatbot_share_text'),
694 + 'icon_video' => get_option('wp_chatbot_icon_video', ''),
695 + 'icon_video_delay' => absint(get_option('wp_chatbot_icon_video_delay', 0)),
666 696
667 697 );
668 698 $user_font = get_option('wp_chatbot_user_font') != '' ? get_option('wp_chatbot_user_font') : '';
669 699 if($user_font != '' ){
@@ -711,8 +741,18 @@
711 741 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
712 742 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);
713 743 wp_enqueue_script('qcld-wp-chatbot-plugin');
714 744
745 + $saved_ai_forms = get_option('wpbot_ai_forms', array());
746 + $ai_form_titles = array();
747 + if (is_array($saved_ai_forms)) {
748 + foreach ($saved_ai_forms as $form) {
749 + if (!isset($form['interactive']) || $form['interactive'] == 1) {
750 + $ai_form_titles[] = trim(strtolower($form['title']));
751 + }
752 + }
753 + }
754 +
715 755 $nonce = wp_create_nonce('wp_chatbot');
716 756 // Pass data to JS
717 757 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
718 758 'ajax_url' => admin_url('admin-ajax.php'),
@@ -717,8 +757,9 @@
717 757 wp_localize_script('qcld-wp-chatbot-plugin', 'qcld_chatbot_obj', [
718 758 'ajax_url' => admin_url('admin-ajax.php'),
719 759 'nonce' => $nonce,
720 760 'stream_endpoint' => admin_url('admin-ajax.php?action=qcld_stream_openai'),
761 + 'ai_form_titles' => $ai_form_titles,
721 762 ]);
722 763
723 764 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);
724 765 wp_enqueue_script('qcld-wp-chatbot-front-js');
@@ -917,41 +958,77 @@
917 958
918 959
919 960
920 961 if ( ( get_option( 'chatbot_content_max_height' ) != '' ) ) {
962 + $chatbot_h_vh = absint( get_option( 'chatbot_content_max_height' ) );
963 + if ( $chatbot_h_vh <= 0 ) {
964 + $chatbot_h_vh = 80;
965 + }
966 + if ( $chatbot_h_vh > 100 ) {
967 + $chatbot_h_vh = 100;
968 + }
969 + // Expand adds a modest bump based on admin height (never above 100vh).
970 + $chatbot_h_expanded_vh = min( 100, $chatbot_h_vh + 8 );
971 +
972 + $chatbot_h_mobile_vh = absint( get_option( 'chatbot_content_max_height_responsive' ) );
973 + if ( $chatbot_h_mobile_vh <= 0 ) {
974 + $chatbot_h_mobile_vh = 90;
975 + }
976 + if ( $chatbot_h_mobile_vh > 100 ) {
977 + $chatbot_h_mobile_vh = 100;
978 + }
921 979
922 980 $custom_colors .= ' .slimScrollDiv{
923 - height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
924 - max-height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
981 + height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
982 + max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
925 983 }';
984 +
926 985
927 986 $custom_colors .= 'div#wp-chatbot-board-container{
928 - height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 100px) !important;
929 - max-height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 100px) !important;
987 + height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
988 + max-height: calc(' . $chatbot_h_vh . 'vh - 100px) !important;
930 989 }';
931 990
932 991 $custom_colors .= '.wp-chatbot-content{
933 - height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
934 - max-height: calc(' . get_option( 'chatbot_content_max_height' ) . 'vh - 270px) !important;
992 + height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
993 + max-height: calc(' . $chatbot_h_vh . 'vh - 270px) !important;
935 994 }';
936 995
996 + // Desktop expand: width toggle also grows height from admin base + bump.
997 + $custom_colors .= '
998 + div#wp-chatbot-board-container.wp-chatbot-expanded,
999 + .wp-chatbot-board-container.wp-chatbot-expanded {
1000 + height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
1001 + max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 100px) !important;
1002 + }
1003 + div#wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
1004 + div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
1005 + div#wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner,
1006 + .wp-chatbot-board-container.wp-chatbot-expanded .slimScrollDiv,
1007 + .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-content,
1008 + .wp-chatbot-board-container.wp-chatbot-expanded .wp-chatbot-ball-inner {
1009 + height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
1010 + max-height: calc(' . $chatbot_h_expanded_vh . 'vh - 270px) !important;
1011 + }
1012 + ';
1013 +
937 1014
938 1015
939 1016 $custom_colors .= '
940 1017 @media screen and (max-width: 480px) {
941 1018 div#wp-chatbot-board-container{
942 - height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 0px) !important;
943 - max-height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 0px) !important;
1019 + height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
1020 + max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 0px) !important;
944 1021 }
945 1022
946 1023 .slimScrollDiv{
947 - height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
948 - max-height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
1024 + height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1025 + max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
949 1026 }
950 1027
951 1028 .wp-chatbot-content{
952 - height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
953 - max-height: calc(' . get_option( 'chatbot_content_max_height_responsive' ) . 'vh - 170px) !important;
1029 + height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
1030 + max-height: calc(' . $chatbot_h_mobile_vh . 'vh - 170px) !important;
954 1031 }
955 1032 }
956 1033 ';
957 1034
@@ -1361,8 +1438,17 @@
1361 1438 update_option('wp_chatbot_icon', $wp_chatbot_icon);
1362 1439
1363 1440 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field(wp_unslash($_POST['wp_chatbot_floatingiconbg_color'])) : '#fff';
1364 1441 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
1442 +
1443 + // Custom icon video / YouTube link
1444 + $wp_chatbot_icon_youtube_url = isset( $_POST['wp_chatbot_icon_youtube_url'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_youtube_url'] ) : '';
1445 + $wp_chatbot_icon_video_upload = isset( $_POST['wp_chatbot_icon_video'] ) ? esc_url_raw( $_POST['wp_chatbot_icon_video'] ) : '';
1446 + // YouTube URL takes priority; fall back to uploaded video
1447 + $wp_chatbot_icon_video = ( $wp_chatbot_icon_youtube_url !== '' ) ? $wp_chatbot_icon_youtube_url : $wp_chatbot_icon_video_upload;
1448 + update_option( 'wp_chatbot_icon_video', $wp_chatbot_icon_video );
1449 + $wp_chatbot_icon_video_delay = isset( $_POST['wp_chatbot_icon_video_delay'] ) ? absint( $_POST['wp_chatbot_icon_video_delay'] ) : 0;
1450 + update_option( 'wp_chatbot_icon_video_delay', $wp_chatbot_icon_video_delay );
1365 1451
1366 1452 // upload custom wpwbot icon path
1367 1453 $wp_chatbot_custom_icon_path = sanitize_text_field(wp_unslash($_POST['wp_chatbot_custom_icon_path']));
1368 1454 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
@@ -1399,9 +1485,9 @@
1399 1485
1400 1486 //To override style use custom css.
1401 1487 if(isset($_POST["wp_chatbot_custom_css"])){
1402 1488 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
1403 - update_option('wp_chatbot_custom_css', sanitize_text_field($wp_chatbot_custom_css));
1489 + update_option('wp_chatbot_custom_css', sanitize_textarea_field($wp_chatbot_custom_css));
1404 1490 }
1405 1491
1406 1492 if (isset($_POST["qlcd_wp_chatbot_dialogflow_project_id"])) {
1407 1493 $qlcd_wp_chatbot_dialogflow_project_id = sanitize_text_field(wp_unslash($_POST["qlcd_wp_chatbot_dialogflow_project_id"]));
@@ -3303,8 +3389,159 @@
3303 3389 * Reset Options will be insert as defualt data
3304 3390 */
3305 3391 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3306 3392 //add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
3393 +
3394 +add_action('wp_ajax_qcld_save_ai_form', 'qcld_save_ai_form');
3395 +add_action('wp_ajax_nopriv_qcld_save_ai_form', 'qcld_save_ai_form');
3396 +
3397 +function qcld_save_ai_form() {
3398 + check_ajax_referer('wp_chatbot', 'nonce');
3399 + if (isset($_POST['data'])) {
3400 + $data_string = stripslashes($_POST['data']);
3401 + $json_data = json_decode($data_string, true);
3402 + if ($json_data && isset($json_data['form_title'])) {
3403 + $post_title = sanitize_text_field($json_data['form_title']) . ' - ' . current_time('mysql');
3404 + $post_id = wp_insert_post(array(
3405 + 'post_title' => $post_title,
3406 + 'post_type' => 'wpbot_form_entry',
3407 + 'post_status' => 'publish'
3408 + ));
3409 + if ($post_id && isset($json_data['data']) && is_array($json_data['data'])) {
3410 + $email_body = "<h2>" . esc_html__('New AI Action Submission', 'chatbot') . "</h2>";
3411 + $email_body .= "<p><strong>" . esc_html__('Action', 'chatbot') . ":</strong> " . sanitize_text_field($json_data['form_title']) . "</p>";
3412 + $email_body .= "<table border='1' cellpadding='10' cellspacing='0' style='border-collapse: collapse; width: 100%; max-width: 600px; font-family: sans-serif;'>";
3413 +
3414 + // Extract user's email for Reply-To (not From, to avoid SMTP rejection)
3415 + $reply_to = '';
3416 +
3417 + foreach ($json_data['data'] as $key => $value) {
3418 + update_post_meta($post_id, sanitize_text_field($key), sanitize_text_field($value));
3419 + $clean_key = ucwords(str_replace(array('-', '_'), ' ', sanitize_text_field($key)));
3420 + $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>";
3421 +
3422 + // Extract email from value — handles plain, [bracketed], and combined answers
3423 + if (preg_match('/\[?([a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,})\]?/', $value, $email_match)) {
3424 + $candidate = sanitize_email(trim($email_match[1]));
3425 + if (is_email($candidate)) {
3426 + $reply_to = $candidate;
3427 + }
3428 + }
3429 + }
3430 + $email_body .= "</table>";
3431 +
3432 + $email_enabled = true; // Default to true if not found for backwards compatibility
3433 + $per_action_emails = '';
3434 + $saved_forms = get_option('wpbot_ai_forms', array());
3435 + $ai_form_title = strtolower( trim( sanitize_text_field( $json_data['form_title'] ) ) );
3436 + if (is_array($saved_forms)) {
3437 + foreach ($saved_forms as $form) {
3438 + if ( strtolower( trim( $form['title'] ) ) === $ai_form_title ) {
3439 + if (isset($form['email'])) {
3440 + $email_enabled = $form['email'] == 1;
3441 + }
3442 + $per_action_emails = isset($form['email_addresses']) ? trim($form['email_addresses']) : '';
3443 + break;
3444 + }
3445 + }
3446 + }
3447 +
3448 + if ($email_enabled) {
3449 + if (!empty($per_action_emails)) {
3450 + $to = array_map('trim', explode(',', $per_action_emails));
3451 + } else {
3452 + $default = get_option('qlcd_wp_chatbot_admin_email', '');
3453 + $to = !empty($default) ? array_map('trim', explode(',', $default)) : get_option('admin_email');
3454 + }
3455 + $subject = sanitize_text_field($json_data['form_title']) . " - " . esc_html__('New AI Action Submission', 'chatbot');
3456 + $headers = array('Content-Type: text/html; charset=UTF-8');
3457 + if (!empty($reply_to)) {
3458 + $headers[] = 'Reply-To: ' . $reply_to;
3459 + }
3460 + wp_mail($to, $subject, $email_body, $headers);
3461 + }
3462 +
3463 + wp_send_json_success('Saved successfully');
3464 + }
3465 + }
3466 + }
3467 + wp_send_json_error('Failed to save');
3468 +}
3469 +
3470 +add_action('wp_ajax_qcld_get_ai_form_entries', 'qcld_get_ai_form_entries');
3471 +function qcld_get_ai_form_entries() {
3472 + check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3473 + if (!current_user_can('manage_options')) {
3474 + wp_send_json_error('Unauthorized');
3475 + }
3476 + $form_title = isset($_POST['form_title']) ? sanitize_text_field($_POST['form_title']) : '';
3477 + if (empty($form_title)) {
3478 + wp_send_json_error('No title provided');
3479 + }
3480 +
3481 + global $wpdb;
3482 + $title_prefix = $form_title . ' - ';
3483 + $where_filter = function ( $where ) use ( $wpdb, $title_prefix ) {
3484 + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s", $wpdb->esc_like( $title_prefix ) . '%' );
3485 + return $where;
3486 + };
3487 + add_filter( 'posts_where', $where_filter );
3488 + $query = new WP_Query( array(
3489 + 'post_type' => 'wpbot_form_entry',
3490 + 'post_status' => 'publish',
3491 + 'posts_per_page' => -1,
3492 + ) );
3493 + remove_filter( 'posts_where', $where_filter );
3494 +
3495 + ob_start();
3496 + if ($query->have_posts()) {
3497 + echo '<table class="wp-list-table widefat fixed striped" style="width: 100%; text-align: left;">';
3498 + echo '<thead><tr><th>Entry</th><th>Data</th><th>Date</th><th>Action</th></tr></thead>';
3499 + echo '<tbody>';
3500 + while ($query->have_posts()) {
3501 + $query->the_post();
3502 + $meta = get_post_meta(get_the_ID());
3503 + echo '<tr>';
3504 + echo '<td><strong>' . esc_html( get_the_title() ) . '</strong></td>';
3505 + echo '<td>';
3506 + foreach ($meta as $key => $values) {
3507 + if (strpos($key, '_') !== 0) { // skip hidden meta
3508 + echo '<strong>' . esc_html($key) . ':</strong> ' . esc_html($values[0]) . '<br>';
3509 + }
3510 + }
3511 + echo '</td>';
3512 + echo '<td>' . esc_html( get_the_date() ) . ' ' . esc_html( get_the_time() ) . '</td>';
3513 + 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>';
3514 + echo '</tr>';
3515 + }
3516 + echo '</tbody></table>';
3517 + wp_reset_postdata();
3518 + } else {
3519 + echo '<p>No entries found for this form.</p>';
3520 + }
3521 + $html = ob_get_clean();
3522 + wp_send_json_success(array('html' => $html));
3523 +}
3524 +
3525 +add_action('wp_ajax_qcld_delete_ai_form_entry', 'qcld_delete_ai_form_entry');
3526 +function qcld_delete_ai_form_entry() {
3527 + check_ajax_referer('wp_chatbot_ai_actions', 'nonce');
3528 + if (!current_user_can('manage_options')) {
3529 + wp_send_json_error('Unauthorized');
3530 + }
3531 +
3532 + $entry_id = isset($_POST['entry_id']) ? intval($_POST['entry_id']) : 0;
3533 + if (empty($entry_id)) {
3534 + wp_send_json_error('No entry ID provided');
3535 + }
3536 +
3537 + if (get_post_type($entry_id) === 'wpbot_form_entry') {
3538 + wp_delete_post($entry_id, true);
3539 + wp_send_json_success('Entry deleted successfully');
3540 + } else {
3541 + wp_send_json_error('Invalid entry');
3542 + }
3543 +}
3307 3544 //Jarvis all option will be delete during uninstlling.
3308 3545 if( !function_exists('qcld_wb_chatboot_delete_all_options') ){
3309 3546 function qcld_wb_chatboot_delete_all_options(){
3310 3547
@@ -3600,9 +3837,17 @@
3600 3837 // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3601 3838
3602 3839 }
3603 3840 }
3841 +if( !function_exists('wpbot_Ai_actions_func') ){
3842 + function wpbot_Ai_actions_func (){
3604 3843
3844 + require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."includes/admin/templates/ai-actions.php");
3845 + // require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."qcld-openai-bot.php");
3846 +
3847 +}
3848 +}
3849 +
3605 3850 /**
3606 3851 *
3607 3852 * Function to load translation files.
3608 3853 *
@@ -3616,9 +3861,9 @@
3616 3861 add_action( 'plugins_loaded', 'wp_chatbot_lang_init');
3617 3862
3618 3863 $wpbot_feedback = new Qcld_Wp_Usage_Feedback(
3619 3864 __FILE__,
3620 - '[email protected]',
3865 + '[email protected]',
3621 3866 false,
3622 3867 true
3623 3868
3624 3869 );
@@ -3671,16 +3916,16 @@
3671 3916 </div>
3672 3917 <div class="panel panel-default">
3673 3918 <div class="panel-heading" role="tab" id="headingSix">
3674 3919 <h4 class="panel-title">
3675 - <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 + <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>
3676 3921 </h4>
3677 3922 </div>
3678 3923 <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
3679 3924 <div class="panel-body">
3680 - <?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>
3681 - <?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>
3682 - <?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'); ?>
3925 + <?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>
3926 + <?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>
3927 + <?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'); ?>
3683 3928 </div>
3684 3929 </div>
3685 3930 </div>
3686 3931 <div class="panel panel-default">
@@ -3690,9 +3935,9 @@
3690 3935 </h4>
3691 3936 </div>
3692 3937 <div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
3693 3938 <div class="panel-body">
3694 - <?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 + <?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>
3695 3940 <?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'); ?>
3696 3941 </div>
3697 3942 </div>
3698 3943 </div>
@@ -3812,9 +4057,9 @@
3812 4057 <div class="to-icon-txt fa-4x-txt ">
3813 4058 <h3>
3814 4059 <span>// </span><?php esc_html_e('Send eMail, Call Me Back &amp; Feedback Collection', 'chatbot'); ?>
3815 4060 </h3>
3816 - <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 + <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>
3817 4062 </div>
3818 4063 </div>
3819 4064 <div class="to-icon-box left txt-left">
3820 4065 <div class="to-icon-txt fa-4x-txt ">
@@ -3868,14 +4113,14 @@
3868 4113 </h4>
3869 4114 </div>
3870 4115 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
3871 4116 <div class="panel-body">
3872 - <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 + <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>
3873 4118 <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>.
3874 4119 </p>
3875 4120 <h4><?php esc_html_e('Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.', 'chatbot'); ?></h4>
3876 4121 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank"><?php esc_html_e('Download Free Version', 'chatbot'); ?></a>
3877 - <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 + <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>
3878 4123 <h4><?php esc_html_e('What Can You Do with it?', 'chatbot'); ?></h4>
3879 4124 <p><?php esc_html_e('Conversation Forms allows you to create a wide variety of forms, that might include:', 'chatbot'); ?></p>
3880 4125 <ul>
3881 4126 <li><?php esc_html_e('Create menu or button driven conversations', 'chatbot'); ?></li>
@@ -4136,9 +4381,9 @@
4136 4381 </h4>
4137 4382 </div>
4138 4383 <div id="faqcollapsetwelve" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faqtwelve">
4139 4384 <div class="panel-body">
4140 - <?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 + <?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'); ?>
4141 4386 </div>
4142 4387 </div>
4143 4388 </div>
4144 4389