PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 4.3.2
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v4.3.2
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 8.5.5 8.5.4 8.5.3 All 534 releases
chatbot / qcld-wpwbot.php

qcld-wpwbot.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 4.3.2, at qcld-wpwbot.php

3,021 lines 177.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: ChatBot
4 * Plugin URI: https://wordpress.org/plugins/chatbot/
5 * Description: ChatBot is a native WordPress ChatBot plugin to provide quick support and email functionality.
6 * Donate link: https://www.quantumcloud.com
7 * Version: 4.3.2
8 * @author QuantumCloud
9 * Author: QuantumCloud
10 * Author URI: https://www.quantumcloud.com/
11 * Requires at least: 4.6
12 * Tested up to: 6.0
13 * Text Domain: wpbot
14 * Domain Path: /lang
15 * License: GPL2
16 */
17
18
19
20 if (!defined('ABSPATH')) exit; // Exit if accessed directly
21 define('QCLD_wpCHATBOT_VERSION', '4.3.2');
22 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
23 define('QCLD_wpCHATBOT_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
24 define('QCLD_wpCHATBOT_PLUGIN_URL', plugin_dir_url(__FILE__));
25 define('QCLD_wpCHATBOT_IMG_URL', QCLD_wpCHATBOT_PLUGIN_URL . "images/");
26 define('QCLD_wpCHATBOT_IMG_ABSOLUTE_PATH', plugin_dir_path(__FILE__) . "images");
27 define('QCLD_wpCHATBOT_INDEX_TABLE', 'wpwbot_index');
28 //define('QCLD_wpCHATBOT_CACHE_TABLE', 'wpwbot_cache');
29
30 $gcdirpath = __DIR__.'/../../wpbot-dfv2-client';
31 define('QCLD_wpCHATBOT_GC_DIRNAME', $gcdirpath);
32 $wpcontentpath = __DIR__.'/../../';
33 define('QCLD_wpCHATBOT_GC_ROOT', $wpcontentpath);
34
35 require_once("qcld-wpwbot-search.php");
36 require_once("class-qc-free-plugin-upgrade-notice.php");
37 require_once("class-plugin-deactivate-feedback.php");
38 require_once("qc-support-promo-page/class-qc-support-promo-page.php");
39 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."/functions.php");
40 require_once('qcld_df_api.php');
41 require_once('includes/class-wpbot-gc-download.php');
42 require_once('includes/class-response-list.php');
43 require_once('qc-rating-feature/qc-rating-class.php');
44
45 /*
46 if(file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH. "/conversion-tracker/class-qc-conversion-tracker.php")){
47 require_once (QCLD_wpCHATBOT_PLUGIN_DIR_PATH. "/conversion-tracker/class-qc-conversion-tracker.php");
48 }
49 */
50 /**
51 * Main Class.
52 */
53 class qcld_wb_Chatbot
54 {
55 private $id = 'wpbot';
56 private static $instance;
57 public $mysql_version = '';
58 public $promotion;
59 /**
60 * Get Instance creates a singleton class that's cached to stop duplicate instances
61 */
62 public static function qcld_wb_chatbot_get_instance()
63 {
64 if (!self::$instance) {
65 self::$instance = new self();
66 self::$instance->qcld_wb_chatbot_init();
67 }
68 return self::$instance;
69 }
70 /**
71 * Construct empty on purpose
72 */
73 private function __construct()
74 {
75 $this->promotion = QCLD_wpCHATBOT_IMG_URL . "/sale-wpbot.jpg";
76 }
77 /**
78 * Init behaves like, and replaces, construct
79 */
80 public function qcld_wb_chatbot_init()
81 {
82 // Check if wpCommerce is active, and is required wpCommerce version.
83 /*if (!class_exists('wpCommerce') || version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) {
84 add_action('admin_notices', array($this, 'wpcommerce_inactive_notice_for_wp_chatbot'));
85 return;
86 }*/
87 add_action('admin_menu', array($this, 'qcld_wb_chatbot_admin_menu'));
88 if ((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) {
89 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
90 }
91 if (is_admin() && !empty($_GET["page"]) && ($_GET["page"] == "wpbot") || (!empty($_GET['page']) && $_GET['page']=='wpbot_help_page') || (!empty($_GET['page']) && $_GET['page']=='wpbot-panel') || ( !empty($_GET['page']) && $_GET["page"] == "wbcs-botsessions-page") ) {
92 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
93 if( get_option('wp_chatbot_index_count')<=0 && get_option('qlcd_wp_chatbot_search_option')=='advanced'){
94 add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
95 }
96 }
97 // add_action( 'admin_notices', array( $this, 'promotion_notice' ) );
98 //loading frontend scripts
99 add_action('wp', array($this, 'qcld_wpchatbot_init_fnc'));
100 add_action('init', array($this, 'qcld_wpchatbot_init2_fnc'));
101
102
103 }
104
105
106
107 public function qcld_wpchatbot_init_fnc(){
108 if (!is_admin() && get_option('disable_wp_chatbot') != 1 && wp_chatbot_load_controlling() === true) {
109 add_action('wp_enqueue_scripts', array($this, 'qcld_wb_chatbot_frontend_scripts'));
110 }
111 }
112 public function qcld_wpchatbot_init2_fnc(){
113 global $wpdb;
114 if( is_admin() ){
115
116 $connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
117 if($connection === false){
118 return;
119 }
120 $content = $connection->server_info;
121
122 $mysql_server_info = $wpdb->db_server_info();
123
124 // Check for the MariaDB.
125 $is_mariadb = false;
126 if ( ! empty( $mysql_server_info ) && strpos( strtolower( $mysql_server_info ), 'maria' ) !== false ) {
127 $is_mariadb = true;
128 }
129
130 preg_match_all('/\d+\.\d+/', $content, $matches);
131
132 if( !empty( $matches ) && isset( $matches[0] ) && !empty( $matches[0] ) && is_array( $matches[0] ) && ! $is_mariadb ){
133 $versions = $matches[0];
134 $notice = true;
135 foreach( $versions as $version ){
136 if (version_compare($version, '5.5', '>')) {
137 $this->mysql_version = $version;
138 $notice = false;
139 }else{
140 $this->mysql_version = $version;
141 }
142 }
143
144 if( $notice ){
145 add_action('admin_notices', array($this, 'mysql_version_notice') );
146 }
147
148 }
149
150 $connection->close();
151 }
152 }
153
154 public function mysql_version_notice(){
155 $class="notice notice-error is-dismissible qc-notice-error";
156 $message = "Your server's MySQL version is **".$this->mysql_version."**. MySQL version 5.6+ is required for Simple Text Responses to work. Please contact your hosting support to upgrade the MySQL to the latest version.";
157 printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), $message );
158 }
159
160 /**
161 * Add a submenu item to the wpCommerce menu
162 */
163 public function qcld_wb_chatbot_admin_menu()
164 {
165 /* add_submenu_page('wpcommerce',
166 __('wpwBot Pro', 'wpchatbot'),
167 __('wpwBot Pro', 'wpchatbot'),
168 'manage_wpcommerce',
169 $this->id,
170 array($this, 'qcld_wb_chatbot_admin_page'));*/
171
172 add_menu_page( esc_html('WPBot Lite'), esc_html('WPBot Lite'), 'manage_options','wpbot-panel', array($this, 'qcld_wb_chatbot_admin_page'),'dashicons-format-status', 6 );
173
174 add_submenu_page( 'wpbot-panel', esc_html('Settings'), esc_html('Settings'), 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
175
176 $hook = add_submenu_page( 'wpbot-panel', esc_html('Simple Text Responses'), esc_html('Simple Text Responses'), 'manage_options','simple-text-response', array($this, 'qcld_wb_chatbot_admin_str') );
177
178 add_action( "load-$hook", [ $this, 'screen_option' ] );
179
180 add_submenu_page( 'wpbot-panel', esc_html('Support'), esc_html('Support'), 'manage_options','wpbot_support_page', 'qcpromo_support_page_callback_func' );
181
182 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' );
183 }
184
185 function screen_option(){
186 if( !empty($_POST['wp_screen_options'])){
187 $per_page_str = (int)$_POST['wp_screen_options']["value"];
188
189 }else{
190 $per_page_str = 20;
191 }
192 $option = 'per_page';
193 $args = [
194 'label' => 'Response',
195 'default' => $per_page_str,
196 'option' => 'responses_per_page'
197 ];
198 add_screen_option( $option, $args );
199
200 $this->response_list = new Response_list();
201 }
202
203 public function qcld_wb_chatbot_admin_str(){
204
205 require_once("includes/simple_text_response.php");
206
207 }
208
209 /**
210 * Include admin scripts
211 */
212 public function qcld_wb_chatbot_admin_scripts($hook)
213 {
214 global $wpcommerce, $wp_scripts;
215 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
216 if (((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) || ($hook == "widgets.php") || $_GET['page']=='wpbot_help_page' || $_GET['page']=='wpbot-panel' || $_GET["page"] == "wbcs-botsessions-page" ) {
217
218 wp_enqueue_script('jquery');
219 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
220 wp_register_style('qlcd-wp-chatbot-admin-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/admin-style.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
221 wp_enqueue_style('qlcd-wp-chatbot-admin-style');
222 wp_register_style('qlcd-wp-chatbot-font-awesome', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/font-awesome.min.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
223 wp_enqueue_style('qlcd-wp-chatbot-font-awesome');
224 wp_register_style('qlcd-wp-chatbot-tabs-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/wp-chatbot-tabs.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
225 wp_enqueue_style('qlcd-wp-chatbot-tabs-style');
226 wp_register_style('jquery.fontpicker.min.css', QCLD_wpCHATBOT_PLUGIN_URL . 'css/fontpicker.min.css', '', QCLD_wpCHATBOT_VERSION, 'screen');
227 wp_enqueue_style('jquery.fontpicker.min.css');
228 wp_enqueue_script('jquery');
229 wp_enqueue_script( 'jquery-ui-draggable' );
230 wp_enqueue_script( 'jquery-ui-droppable' );
231 wp_enqueue_script('jquery-ui-core');
232 wp_enqueue_style( 'wp-color-picker');
233 wp_enqueue_script( 'wp-color-picker');
234 wp_enqueue_script( 'jquery-ui-sortable');
235 wp_register_script('qcld-wp-fontpicker', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/fontpicker.js', basename(__FILE__)), array(), true);
236 wp_enqueue_script('qcld-wp-fontpicker');
237 wp_register_script('qcld-wp-chatbot-cbpFWTabs', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/cbpFWTabs.js', basename(__FILE__)), array(), true);
238 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
239 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
240 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
241 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
242 wp_enqueue_script('qcld-wp-chatbot-bootstrap-js');
243 wp_register_style('qcld-wp-chatbot-bootstrap-css', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/bootstrap.min.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
244 wp_enqueue_style('qcld-wp-chatbot-bootstrap-css');
245 //jquery time picker
246 wp_register_script('qcld-wp-chatbot-timepicker-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.timepicker.js', basename(__FILE__)), array('jquery'), true);
247 wp_enqueue_script('qcld-wp-chatbot-timepicker-js');
248 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');
249 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
250
251 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','wp-color-picker','qcld-wp-chatbot-timepicker-js'), '10.9.9', true);
252
253 wp_enqueue_script('qcld-wp-chatbot-admin-js');
254 wp_localize_script('qcld-wp-chatbot-admin-js', 'ajax_object',
255 array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce' => wp_create_nonce('wp_chatbot'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
256 // WordPress Media library
257 wp_enqueue_media();
258 }
259 }
260 public function qc_get_formbuilder_forms(){
261 global $wpdb;
262 $forms = array();
263 if(class_exists('Qcformbuilder_Forms_Admin')){
264 $results = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."wfb_forms where 1 and type='primary'");
265 if(!empty($results)){
266 foreach($results as $result){
267 $form = maybe_unserialize($result->config);
268 $forms[] = trim($form['name']);
269 }
270 return $forms;
271 }else{
272 return array();
273 }
274 }else{
275 return array();
276 }
277 }
278 function qc_wpbot_simple_response_intent(){
279 global $wpdb;
280 $table = $wpdb->prefix.'wpbot_response';
281 $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''");
282 $response = array();
283 if(!empty($results)){
284 foreach($results as $result){
285 $response[] = $result->intent;
286 }
287 }
288 return $response;
289 }
290 function qc_get_formbuilder_form_commands(){
291 global $wpdb;
292 $command = array();
293 if(class_exists('Qcformbuilder_Forms_Admin')){
294 $results = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."wfb_forms where 1 and type='primary'");
295 if(!empty($results)){
296 foreach($results as $result){
297 $form = maybe_unserialize($result->config);
298
299 if(isset($form['command'])){
300 $command[] = array_map('trim', explode(',', strtolower($form['command'])));
301 }
302
303 }
304 return $command;
305 }else{
306 return array();
307 }
308 }else{
309 return array();
310 }
311 }
312 public function promotion_notice(){
313 $screen = get_current_screen();
314 if( isset($screen->base) && (( $screen->base == 'wpbot-lite_page_wpbot') || ( $screen->base == 'toplevel_page_wpbot-panel"'))){
315 ?>
316 <div id="promotion-wpchatbot" data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #000">
317 <div class="">
318
319 <div class="qc-review-text" >
320 <a href="https://www.wpbot.pro/pricing/" target="_blank">
321 <img src="<?php echo esc_url($this->promotion); ?>" alt=""></a>
322 </div>
323 </div>
324 </div>
325 <?php
326 }
327 }
328 public function qc_get_formbuilder_form_ids(){
329 global $wpdb;
330 $forms = array();
331 if(class_exists('Qcformbuilder_Forms_Admin')){
332 $results = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."wfb_forms where 1 and type='primary'");
333 if(!empty($results)){
334 foreach($results as $result){
335 $form = maybe_unserialize($result->config);
336 $forms[] = trim($form['ID']);
337 }
338 return $forms;
339 }else{
340 return array();
341 }
342 }else{
343 return array();
344 }
345 }
346
347 public function qcld_wb_chatbot_frontend_scripts()
348 {
349 global $wpcommerce, $wp_scripts, $wpdb, $current_user;
350
351 $display_name = '';
352 $display_email = '';
353 $user_image = get_option('wp_custom_client_icon');
354 $user_id = 0;
355 $user_image = get_option('wp_custom_client_icon');
356 if ( is_user_logged_in() ) {
357 $display_name = $current_user->display_name;
358 $display_email = $current_user->user_email;
359 $user_image = esc_url( get_avatar_url( $current_user->ID ) );
360 $user_id = $current_user->ID;
361 }
362
363 $conversation_form_ids = array();
364 $conversation_form_names = array();
365
366 if(class_exists('Qcformbuilder_Forms_Admin')){
367 $results = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."wfb_forms where 1 and type='primary'");
368 if(!empty($results)){
369
370 foreach($results as $result){
371 $form = unserialize($result->config);
372 $conversation_form_ids[] = $form['ID'];
373 $conversation_form_names[] = $form['name'];
374 }
375
376 }
377 }
378
379 $wp_chatbot_obj = array(
380 'wp_chatbot_position_x' => get_option('wp_chatbot_position_x'),
381 'wp_chatbot_position_y' => get_option('wp_chatbot_position_y'),
382 'disable_icon_animation' => get_option('disable_wp_chatbot_icon_animation'),
383 'disable_featured_product' => get_option('disable_wp_chatbot_featured_product'),
384 'disable_product_search' => get_option('disable_wp_chatbot_product_search'),
385 'disable_catalog' => get_option('disable_wp_chatbot_catalog'),
386 'disable_order_status' => get_option('disable_wp_chatbot_order_status'),
387 'disable_sale_product' => get_option('disable_wp_chatbot_sale_product'),
388 'open_product_detail' => get_option('wp_chatbot_open_product_detail'),
389 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
390 'ajax_url' => admin_url('admin-ajax.php'),
391 'image_path' => QCLD_wpCHATBOT_IMG_URL,
392 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
393 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
394 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
395 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
396 'agent' => str_replace('\\', '',get_option('qlcd_wp_chatbot_agent')),
397 'agent_image' => get_option('wp_chatbot_agent_image'),
398 'agent_image_path' => $this->qcld_wb_chatbot_agent_icon(),
399 'shopper_demo_name' => str_replace('\\', '',get_option('qlcd_wp_chatbot_shopper_demo_name')),
400 'agent_join' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
401 'welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_welcome'))),
402 'welcome_back' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
403 'hi_there' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
404 'hello' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_hello'))),
405 'asking_name' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_name'))),
406 'i_am' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_i_am'))),
407 'name_greeting' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_name_greeting'))),
408 'wildcard_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_msg'))),
409 'empty_filter_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_empty_filter_msg'))),
410 'did_you_mean' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_did_you_mean'))),
411 'is_typing' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_is_typing'))),
412 'send_a_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_send_a_msg'))),
413 'viewed_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_viewed_products'))),
414 'shopping_cart' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_shopping_cart'))),
415 'cart_updating' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_cart_updating'))),
416 'cart_removing' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_cart_removing'))),
417 'imgurl' => QCLD_wpCHATBOT_IMG_URL,
418 'sys_key_help' => get_option('qlcd_wp_chatbot_sys_key_help'),
419 'sys_key_product' => get_option('qlcd_wp_chatbot_sys_key_product'),
420 'sys_key_catalog' => get_option('qlcd_wp_chatbot_sys_key_catalog'),
421 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
422 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
423 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
424 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
425 'help_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
426 'back_to_start' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
427 'help_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
428 'reset' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_reset'))),
429 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
430 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
431 'featured_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
432 'sale_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
433 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
434 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
435 'product_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
436 'product_suggest' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
437 'product_infinite' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
438 'product_success' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_success'))),
439 'product_fail' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
440 'support_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
441 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
442 'support_option_again' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
443 'asking_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
444 'asking_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
445 'no_result' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_no_result'))),
446 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
447 'asking_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
448 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
449 'support_query' =>$this->qcld_wb_chatbot_str_replace(unserialize( get_option('support_query'))),
450 'support_ans' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('support_ans'))),
451 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
452 'notifications' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_notifications'))),
453 'order_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
454 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
455 'order_username_password' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
456 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
457 'order_login' => is_user_logged_in(),
458 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
459 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
460 'order_email_support' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
461 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
462 'invalid_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
463 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
464 'currency_symbol' => '',
465 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
466 'messenger_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
467 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
468 'enable_skype' => get_option('enable_wp_chatbot_skype'),
469 'enable_whats' => get_option('enable_wp_chatbot_whats'),
470 'whats_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
471 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
472 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
473 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
474 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
475 'exit_intent_once' => get_option('wp_chatbot_exit_intent_once'),
476 'enable_scroll_open' => get_option('enable_wp_chatbot_scroll_open'),
477 'scroll_open_msg' => str_replace('\\', '', get_option('wp_chatbot_scroll_open_msg')),
478 'scroll_open_percent' => get_option('wp_chatbot_scroll_percent'),
479 'scroll_open_once' => get_option('wp_chatbot_scroll_once'),
480 'enable_auto_open' => get_option('enable_wp_chatbot_auto_open'),
481 'auto_open_msg' => str_replace('\\', '', get_option('wp_chatbot_auto_open_msg')),
482 'auto_open_time' => get_option('wp_chatbot_auto_open_time'),
483 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
484 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
485 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
486 'disable_faq' => get_option('disable_wp_chatbot_faq'),
487 'feedback_label' =>$this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
488 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
489 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
490 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
491 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
492 'ajax_nonce'=> wp_create_nonce('qcsecretbotnonceval123qc'),
493 'site_search' => get_option('qlcd_wp_site_search'),
494 'call_gen' => get_option('disable_wp_chatbot_call_gen'),
495 'call_sup' => get_option('disable_wp_chatbot_call_sup'),
496 'enable_ret_sound' => get_option('enable_wp_chatbot_ret_sound'),
497 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
498 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
499 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
500 'mobile_full_screen' => get_option('enable_wp_chatbot_mobile_full_screen'),
501 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):100),
502 'inactive_time' => get_option('wp_chatbot_inactive_time'),
503 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
504 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
505 'ai_df_token' => get_option('qlcd_wp_chatbot_dialogflow_client_token'),
506 'df_defualt_reply' => str_replace('\\', '', get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')),
507 'df_agent_lan' => get_option('qlcd_wp_chatbot_dialogflow_agent_language'),
508 'start_menu' => wp_unslash(get_option('qc_wpbot_menu_order')),
509 'conversation_form_ids' => $conversation_form_ids,
510 'conversation_form_names' => $conversation_form_names,
511 'simple_response_intent' => $this->qc_wpbot_simple_response_intent(),
512 'forms' => $this->qc_get_formbuilder_forms(),
513 'form_ids' =>$this->qc_get_formbuilder_form_ids(),
514 'form_commands' => $this->qc_get_formbuilder_form_commands(),
515 'df_api_version' => (get_option('wp_chatbot_df_api')==''?'v1':get_option('wp_chatbot_df_api')),
516 'v2_client_url'=> esc_url(get_site_url().'/?action=qcld_dfv2_api'),
517 'show_menu_after_greetings'=> (get_option('show_menu_after_greetings')!=''?get_option('show_menu_after_greetings'):0),
518 'current_user_id' => $user_id,
519
520 );
521 $user_font = get_option('wp_chat_user_font_family') != '' ? get_option('wp_chat_user_font_family') : '';
522 if($user_font != '' ){
523 $user_font_family = str_replace('\\', '',$user_font);
524 $user_font_family = json_decode($user_font_family);
525 $user_font_name = $user_font_family->fontFamily;
526 $user_font_name = str_replace(' ', '+', $user_font_name);
527 $user_font_name = str_replace("'","",$user_font_name );
528 $user_enqueue_font = 'https://fonts.googleapis.com/css2?family='.$user_font_name;
529 wp_enqueue_style( 'qcld-chatbot-user-google-fonts', $user_enqueue_font, false );
530 wp_enqueue_style( 'qcld-chatbot-user-google-fonts');
531 }
532
533 $bot_font = get_option('wp_chat_bot_font_family') != '' ? get_option('wp_chat_bot_font_family') : '';
534 if($bot_font != '' ){
535 $bot_font_family = str_replace('\\', '',$bot_font);
536 $bot_font_family = json_decode($bot_font_family);
537 $bot_font_name =$bot_font_family->fontFamily;
538 $bot_font_name = str_replace(' ', '+', $bot_font_name );
539 $bot_font_name = str_replace("'","",$bot_font_name );
540 $bot_enqueue_font = 'https://fonts.googleapis.com/css2?family='.$bot_font_name;
541 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts', $bot_enqueue_font, false );
542 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts');
543 }
544
545 wp_enqueue_style( 'dashicons' );
546 wp_register_script('qcld-wp-chatbot-slimscroll-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.slimscroll.min.js', basename(__FILE__)), array('jquery'), QCLD_wpCHATBOT_VERSION, true);
547 wp_enqueue_script('qcld-wp-chatbot-slimscroll-js');
548 wp_register_script('qcld-wp-chatbot-jquery-cookie', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.cookie.js', basename(__FILE__)), array('jquery'), QCLD_wpCHATBOT_VERSION, true);
549 wp_enqueue_script('qcld-wp-chatbot-jquery-cookie');
550 wp_register_script('qcld-wp-chatbot-magnify-popup', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.magnific-popup.min.js', basename(__FILE__)), array('jquery'), QCLD_wpCHATBOT_VERSION, true);
551 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
552 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);
553 wp_enqueue_script('qcld-wp-chatbot-plugin');
554 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);
555 wp_enqueue_script('qcld-wp-chatbot-front-js');
556 wp_localize_script('qcld-wp-chatbot-front-js', 'wp_chatbot_obj', $wp_chatbot_obj);
557 //wp_register_script('qcld-wp-chatbot-frontend', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/qcld-wp-chatbot-frontend.js', basename(__FILE__)), array('jquery','qcld-wp-chatbot-jquery-cookie'), QCLD_wpCHATBOT_VERSION, true);
558 //wp_enqueue_script('qcld-wp-chatbot-frontend');
559 //wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
560 wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
561 wp_register_style('qcld-wp-chatbot-common-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/common-style.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
562 wp_enqueue_style('qcld-wp-chatbot-common-style');
563
564 if(get_option('wp_chatbot_floatingiconbg_color')!="") {
565 $custom_colors = ".wp-chatbot-ball{
566 background: ". get_option('wp_chatbot_floatingiconbg_color')." !important;
567 }
568 .wp-chatbot-ball:hover, .wp-chatbot-ball:focus{
569 background: ".get_option('wp_chatbot_floatingiconbg_color')." !important;
570 }";
571 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
572 }
573
574
575 wp_register_style('qcld-wp-chatbot-magnific-popup', plugins_url(basename(plugin_dir_path(__FILE__)) . '/css/magnific-popup.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
576 wp_enqueue_style('qcld-wp-chatbot-magnific-popup');
577 $qcld_wb_chatbot_theme = get_option('qcld_wb_chatbot_theme');
578 /* if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css')) {
579 wp_register_style('qcld-wp-chatbot-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/templates/' . $qcld_wb_chatbot_theme . '/style.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
580 wp_enqueue_style('qcld-wp-chatbot-style');
581 }*/
582 //Loading shortcode style
583 if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/shortcode.css')) {
584 wp_register_style('qcld-wp-chatbot-shortcode-style', plugins_url(basename(plugin_dir_path(__FILE__)) . '/templates/' . $qcld_wb_chatbot_theme . '/shortcode.css', basename(__FILE__)), '', QCLD_wpCHATBOT_VERSION, 'screen');
585 wp_enqueue_style('qcld-wp-chatbot-shortcode-style');
586 }
587 $custom_colors = '';
588 if(get_option('enable_wp_chatbot_custom_color')==1){
589 $custom_colors .="
590 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
591 color: ". get_option('wp_chatbot_text_color')." !important;
592 }
593 #wp-chatbot-chat-container a {
594 color: ". get_option('wp_chatbot_link_color')." !important;
595 }
596 #wp-chatbot-chat-container a:hover {
597 color: ". get_option('wp_chatbot_link_hover_color')." !important;
598 }
599
600 ul.wp-chatbot-messages-container > li.wp-chatbot-msg .wp-chatbot-paragraph,
601 .wp-chatbot-agent-profile .wp-chatbot-bubble {
602 color: ". get_option('wp_chatbot_bot_msg_text_color')." !important;
603 background-color: ". get_option('wp_chatbot_bot_msg_bg_color')." !important;
604 word-break: break-word;
605 }
606 span.qcld-chatbot-product-category, span.qcld-chatbot-support-items, span.qcld-chatbot-wildcard, span.qcld-chatbot-suggest-email, span.qcld-chatbot-reset-btn, #woo-chatbot-loadmore, .wp-chatbot-shortcode-template-container span.qcld-chatbot-product-category, .wp-chatbot-shortcode-template-container span.qcld-chatbot-support-items, .wp-chatbot-shortcode-template-container span.qcld-chatbot-wildcard, .wp-chatbot-shortcode-template-container span.wp-chatbot-card-button, .wp-chatbot-shortcode-template-container span.qcld-chatbot-suggest-email, span.qcld-chatbot-suggest-phone, .wp-chatbot-shortcode-template-container span.qcld-chatbot-reset-btn, .wp-chatbot-shortcode-template-container #wp-chatbot-loadmore, .wp-chatbot-ball-cart-items, .wpbd_subscription, .qcld-chatbot-site-search, .qcld_subscribe_confirm, .qcld-chat-common, .qcld-chatbot-custom-intent {
607 color: ". get_option('wp_chatbot_buttons_text_color') ." !important;
608 background-color: ". get_option('wp_chatbot_buttons_bg_color') ." !important;
609 background-image: none !important;
610 }
611
612 span.qcld-chatbot-product-category:hover, span.qcld-chatbot-support-items:hover, span.qcld-chatbot-wildcard:hover, span.qcld-chatbot-suggest-email:hover, span.qcld-chatbot-reset-btn:hover, #woo-chatbot-loadmore:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-product-category:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-support-items:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-wildcard:hover, .wp-chatbot-shortcode-template-container:hover span.wp-chatbot-card-button:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-suggest-email:hover, span.qcld-chatbot-suggest-phone:hover, .wp-chatbot-shortcode-template-container:hover span.qcld-chatbot-reset-btn:hover, .wp-chatbot-shortcode-template-container:hover #wp-chatbot-loadmore:hover, .wp-chatbot-ball-cart-items:hover, .wpbd_subscription:hover, .qcld-chatbot-site-search:hover, .qcld_subscribe_confirm:hover, .qcld-chat-common:hover, .qcld-chatbot-custom-intent:hover {
613 color: ". get_option('wp_chatbot_buttons_text_color_hover') ." !important;
614 background-color: ". get_option('wp_chatbot_buttons_bg_color_hover') ." !important;
615 background-image: none !important;
616 }
617
618 li.wp-chat-user-msg .wp-chatbot-paragraph {
619 color: ". get_option('wp_chatbot_user_msg_text_color')." !important;
620 background-color: ". get_option('wp_chatbot_user_msg_bg_color')." !important;
621 }
622 ul.wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph:before,
623 .wp-chatbot-bubble:before {
624 border-right: 10px solid ". get_option('wp_chatbot_bot_msg_bg_color')." !important;
625
626 }
627 ul.wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph:before {
628 border-left: 10px solid ". get_option('wp_chatbot_user_msg_bg_color')." !important;
629 }
630 #wp-chatbot-chat-container .wp-chatbot-header{
631 background: ". get_option('wp_chatbot_header_background_color')." !important;
632 }
633 ";
634
635 }
636 if((get_option('enable_wp_chatbot_custom_color')==1) && $user_font != ''){
637 $custom_colors .="
638 #wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph,
639 #wp-chatbot-messages-container > li.wp-chatbot-msg > span{
640 font-family: ".$bot_font_family->fontFamily.";
641 font-weight: ".$bot_font_family->fontWeight.";
642 font-style: ".$bot_font_family->fontStyle.";
643 font-size: ". get_option('wp_chatbot_font_size'). ";
644 }
645 ";
646 }
647 if((get_option('enable_wp_chatbot_custom_color')==1) && $bot_font != ''){
648 $custom_colors .="
649 #wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph{
650 font-family: ".$user_font_family->fontFamily.";
651 font-weight: ".$user_font_family->fontWeight.";
652 font-style: ".$user_font_family->fontStyle.";
653 font-size: ". get_option('wp_chatbot_font_size'). ";
654 }
655 ";
656 }
657 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
658 if(get_option('wp_chatbot_custom_css')!=""){
659
660 wp_add_inline_style( 'qlcd-wp-chatbot-admin-style', get_option('wp_chatbot_custom_css') );
661 }
662 }
663 public function qcld_wb_chatbot_str_replace($messages=array()){
664 $refined_mesgses=array();
665 if(!empty($messages)){
666 foreach ($messages as $message){
667 $refined_msg=str_replace('\\', '', $message);
668 array_push($refined_mesgses,$refined_msg);
669 }
670 }
671 return $refined_mesgses;
672 }
673 //getting exact agent icon path
674 public function qcld_wb_chatbot_agent_icon(){
675
676 if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')=="custom-agent.png" ){
677 $wp_chatbot_custom_icon_path=get_option('wp_chatbot_custom_agent_path');
678 }
679 else if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')!="custom-agent.png"){
680 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
681 }
682 else
683 {
684 if(get_option('wp_chatbot_agent_image')!=''){
685 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
686 }else{
687 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.'custom-agent.png';
688 }
689
690 }
691
692 return $wp_chatbot_custom_icon_path;
693 }
694 /**
695 * Render the admin page
696 */
697
698 public function qcld_wb_chatbot_admin_page()
699 {
700 global $wpcommerce;
701 $action = 'admin.php?page=wpbot-panel';
702 require_once("admin_ui2.php");
703 }
704
705 public function qcld_wb_chatbot_admin_page_settings()
706 {
707 global $wpcommerce;
708 $action = 'admin.php?page=wpbot';
709 require_once("admin_ui.php");
710 }
711
712 public function qcld_wb_chatbot_dynamic_multi_option($options = array(), $option_name = "", $option_text = "")
713 {
714 ?>
715
716 <h4 class="qc-opt-title">
717 <?php esc_html_e($option_text, 'wpchatbot'); ?>
718 </h4>
719 <div class="wp-chatbot-lng-items">
720 <?php
721 if (is_array($options) && count($options) > 0) {
722 foreach ($options as $key => $value) {
723 ?>
724 <div class="row" class="wp-chatbot-lng-item">
725 <div class="col-xs-10">
726 <input type="text"
727 class="form-control qc-opt-dcs-font"
728 name="<?php echo $option_name; ?>[]"
729 value="<?php echo str_replace('\\', '', $value); ?>">
730 </div>
731 <div class="col-xs-2">
732 <button type="button" class="btn btn-danger btn-sm wp-chatbot-lng-item-remove"> <span class="glyphicon glyphicon-remove"></span> </button>
733 </div>
734 </div>
735 <?php
736 }
737 } else { ?>
738 <div class="row" class="wp-chatbot-lng-item">
739 <div class="col-xs-10">
740 <input type="text"
741 class="form-control qc-opt-dcs-font"
742 name="<?php echo $option_name; ?>[]"
743 value="<?php echo $option_text; ?>">
744 </div>
745 <div class="col-xs-2"> <span class="wp-chatbot-lng-item-remove">
746 <?php esc_html_e('X', 'wpchatbot'); ?>
747 </span> </div>
748 </div>
749 <?php } ?>
750 </div>
751 <div class="row">
752 <div class="col-sm-2 col-sm-offset-10">
753 <button type="button" class="btn btn-success btn-sm wp-chatbot-lng-item-add"> <span class="glyphicon glyphicon-plus"></span> </button>
754 </div>
755 </div>
756 <?php
757 }
758
759 function qcld_wb_chatbot_save_options()
760 {
761 //global $wpcommerce;
762 if (isset($_POST['_wpnonce']) && $_POST['_wpnonce']) {
763 wp_verify_nonce($_POST['_wpnonce'], 'wp_chatbot');
764
765 // Check if the form is submitted or not
766 $submit = sanitize_text_field($_POST['submit']);
767 if (isset($submit)) {
768 //wpwboticon position settings.
769 if (isset($_POST["wp_chatbot_position_x"])) {
770 $wp_chatbot_position_x = intval(sanitize_text_field($_POST["wp_chatbot_position_x"]));
771 update_option('wp_chatbot_position_x', $wp_chatbot_position_x);
772 }
773 if (isset($_POST["wp_chatbot_position_y"])) {
774 $wp_chatbot_position_y = intval(sanitize_text_field($_POST["wp_chatbot_position_y"]));
775 update_option('wp_chatbot_position_y', $wp_chatbot_position_y);
776 }
777 //product search options
778 if(isset($_POST['qlcd_wp_chatbot_search_option'])){
779 $qlcd_wp_chatbot_search_option = sanitize_text_field($_POST['qlcd_wp_chatbot_search_option']);
780 update_option('qlcd_wp_chatbot_search_option', $qlcd_wp_chatbot_search_option);
781 }
782
783 //Enable /disable wpwbot
784 if(isset( $_POST["disable_wp_chatbot"])){
785 $disable_wp_chatbot = sanitize_text_field($_POST["disable_wp_chatbot"]);
786 }else{ $disable_wp_chatbot='';}
787 update_option('disable_wp_chatbot', wp_unslash($disable_wp_chatbot));
788
789 if(isset( $_POST["qlcd_wp_chatbot_admin_email"])){
790 $qlcd_wp_chatbot_admin_email = sanitize_email($_POST["qlcd_wp_chatbot_admin_email"]);
791 }else{ $qlcd_wp_chatbot_admin_email='';}
792 update_option('qlcd_wp_chatbot_admin_email', wp_unslash($qlcd_wp_chatbot_admin_email));
793
794
795 if(isset( $_POST["qlcd_wp_chatbot_from_email"])){
796 $qlcd_wp_chatbot_from_email = sanitize_email($_POST["qlcd_wp_chatbot_from_email"]);
797 }else{ $qlcd_wp_chatbot_from_email='';}
798 update_option('qlcd_wp_chatbot_from_email', wp_unslash($qlcd_wp_chatbot_from_email));
799
800 if(isset( $_POST["disable_wp_chatbot_on_mobile"])) {
801 $disable_wp_chatbot_on_mobile = sanitize_text_field($_POST["disable_wp_chatbot_on_mobile"]);
802 }else{ $disable_wp_chatbot_on_mobile='';}
803 update_option('disable_wp_chatbot_on_mobile', wp_unslash($disable_wp_chatbot_on_mobile));
804 if(isset( $_POST["disable_wp_chatbot_product_search"])) {
805 $disable_wp_chatbot_product_search = sanitize_text_field($_POST["disable_wp_chatbot_product_search"]);
806 }else{ $disable_wp_chatbot_product_search='';}
807 update_option('disable_wp_chatbot_product_search', wp_unslash($disable_wp_chatbot_product_search));
808 if(isset( $_POST["disable_wp_chatbot_catalog"])) {
809 $disable_wp_chatbot_catalog= sanitize_text_field($_POST["disable_wp_chatbot_catalog"]);
810 }else{ $disable_wp_chatbot_catalog='';}
811 update_option('disable_wp_chatbot_catalog', wp_unslash($disable_wp_chatbot_catalog));
812 if(isset( $_POST["disable_wp_chatbot_order_status"])) {
813 $disable_wp_chatbot_order_status = sanitize_text_field($_POST["disable_wp_chatbot_order_status"]);
814 }else{ $disable_wp_chatbot_order_status='';}
815 update_option('disable_wp_chatbot_order_status', wp_unslash($disable_wp_chatbot_order_status));
816 if(isset( $_POST["disable_wp_chatbot_notification"])) {
817 $disable_wp_chatbot_notification = sanitize_text_field($_POST["disable_wp_chatbot_notification"]);
818 }else{ $disable_wp_chatbot_notification='1';}
819 update_option('disable_wp_chatbot_notification', wp_unslash($disable_wp_chatbot_notification));
820
821 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
822 $enable_wp_chatbot_rtl = sanitize_text_field($_POST["enable_wp_chatbot_rtl"]);
823 }else{ $enable_wp_chatbot_rtl='';}
824 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
825
826 if(isset( $_POST["show_menu_after_greetings"])) {
827 $show_menu_after_greetings = sanitize_text_field($_POST["show_menu_after_greetings"]);
828 }else{ $show_menu_after_greetings='';}
829 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
830 if(isset( $_POST["enable_chat_session"])) {
831 $enable_chat_session = sanitize_text_field($_POST["enable_chat_session"]);
832 }else{ $enable_chat_session='';}
833 update_option('enable_chat_session', wp_unslash($enable_chat_session));
834
835
836 if(isset( $_POST["enable_wp_chatbot_mobile_full_screen"])) {
837 $enable_wp_chatbot_mobile_full_screen = sanitize_text_field($_POST["enable_wp_chatbot_mobile_full_screen"]);
838 }else{ $enable_wp_chatbot_mobile_full_screen='';}
839 update_option('enable_wp_chatbot_mobile_full_screen', wp_unslash($enable_wp_chatbot_mobile_full_screen));
840
841 if(isset( $_POST["wpbot_preloading_time"])) {
842 $wpbot_preloading_time = sanitize_text_field($_POST["wpbot_preloading_time"]);
843 }else{ $wpbot_preloading_time='100';}
844 update_option('wpbot_preloading_time', wp_unslash($wpbot_preloading_time));
845
846 if(isset( $_POST["disable_wp_chatbot_icon_animation"])) {
847 $disable_wp_chatbot_icon_animation = sanitize_text_field($_POST["disable_wp_chatbot_icon_animation"]);
848 }else{ $disable_wp_chatbot_icon_animation='';}
849 update_option('disable_wp_chatbot_icon_animation', wp_unslash($disable_wp_chatbot_icon_animation));
850 //Enable /disable Cart Item Number
851 if(isset( $_POST["disable_wp_chatbot_cart_item_number"])) {
852 $disable_wp_chatbot_cart_item_number = sanitize_text_field($_POST["disable_wp_chatbot_cart_item_number"]);
853 }else{ $disable_wp_chatbot_cart_item_number='';}
854 update_option('disable_wp_chatbot_cart_item_number', wp_unslash($disable_wp_chatbot_cart_item_number));
855 //Enable /disable featured products button.
856 if(isset( $_POST["disable_wp_chatbot_featured_product"])) {
857 $disable_wp_chatbot_featured_product = sanitize_text_field($_POST["disable_wp_chatbot_featured_product"]);
858 }else{ $disable_wp_chatbot_featured_product='';}
859 update_option('disable_wp_chatbot_featured_product', wp_unslash($disable_wp_chatbot_featured_product));
860 //Enable /disable sale products button
861 if(isset( $_POST["disable_wp_chatbot_sale_product"])) {
862 $disable_wp_chatbot_sale_product = sanitize_text_field($_POST["disable_wp_chatbot_sale_product"]);
863 }else{ $disable_wp_chatbot_sale_product='';}
864 update_option('disable_wp_chatbot_sale_product', wp_unslash($disable_wp_chatbot_sale_product));
865 //Enable Product details page.
866 if(isset( $_POST["wp_chatbot_open_product_detail"])) {
867 $wp_chatbot_open_product_detail = sanitize_text_field($_POST["wp_chatbot_open_product_detail"]);
868 }else{ $wp_chatbot_open_product_detail='';}
869 update_option('wp_chatbot_open_product_detail', wp_unslash($wp_chatbot_open_product_detail));
870 //product order and order by
871 if(isset($_POST['qlcd_wp_chatbot_product_orderby'])){
872 $qlcd_wp_chatbot_product_orderby = sanitize_text_field($_POST['qlcd_wp_chatbot_product_orderby']);
873 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field($qlcd_wp_chatbot_product_orderby));
874 }
875 if(isset($_POST['qlcd_wp_chatbot_product_order'])){
876 $qlcd_wp_chatbot_product_order = sanitize_text_field($_POST['qlcd_wp_chatbot_product_order']);
877 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field($qlcd_wp_chatbot_product_order));
878 }
879
880
881 //Product per page settings.
882 if (isset($_POST["qlcd_wp_chatbot_ppp"])) {
883 $qlcd_wp_chatbot_ppp = sanitize_text_field($_POST["qlcd_wp_chatbot_ppp"]);
884 update_option('qlcd_wp_chatbot_ppp', intval($qlcd_wp_chatbot_ppp));
885 }
886 if(isset( $_POST["wp_chatbot_exclude_stock_out_product"])) {
887 $wp_chatbot_exclude_stock_out_product = sanitize_text_field($_POST['wp_chatbot_exclude_stock_out_product']);
888 }else{ $wp_chatbot_exclude_stock_out_product='';}
889 update_option('wp_chatbot_exclude_stock_out_product', wp_unslash($wp_chatbot_exclude_stock_out_product));
890 if(isset( $_POST["wp_chatbot_show_parent_category"])) {
891 $wp_chatbot_show_parent_category = sanitize_text_field($_POST['wp_chatbot_show_parent_category']);
892 }else{ $wp_chatbot_show_parent_category='';}
893 update_option('wp_chatbot_show_parent_category', wp_unslash($wp_chatbot_show_parent_category));
894 if(isset( $_POST["wp_chatbot_show_sub_category"])) {
895 $wp_chatbot_show_sub_category = sanitize_text_field($_POST['wp_chatbot_show_sub_category']);
896 }else{ $wp_chatbot_show_sub_category='';}
897 update_option('wp_chatbot_show_sub_category', wp_unslash($wp_chatbot_show_sub_category));
898 if (isset($_POST["qlcd_wp_chatbot_order_user"])) {
899 $qlcd_wp_chatbot_order_user = sanitize_text_field($_POST["qlcd_wp_chatbot_order_user"]);
900 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field($qlcd_wp_chatbot_order_user));
901 }
902
903 if(isset( $_POST["qc_wpbot_menu_order"]) && !empty($_POST["qc_wpbot_menu_order"])) {
904 $qc_wpbot_menu_order = wp_kses_post($_POST["qc_wpbot_menu_order"]);
905 }else{ $qc_wpbot_menu_order='';}
906 update_option('qc_wpbot_menu_order', ($qc_wpbot_menu_order));
907
908 //wpwBot Load control
909 if(isset($_POST["wp_chatbot_show_home_page"])){
910 $wp_chatbot_show_home_page = sanitize_key(($_POST["wp_chatbot_show_home_page"]));
911 update_option('wp_chatbot_show_home_page', $wp_chatbot_show_home_page);
912 }
913
914
915 if(isset($_POST["wp_chatbot_show_posts"])){
916 $wp_chatbot_show_posts = sanitize_key(($_POST["wp_chatbot_show_posts"]));
917 update_option('wp_chatbot_show_posts', $wp_chatbot_show_posts);
918 }
919
920
921 if(isset($_POST["wp_chatbot_show_pages"])){
922 $wp_chatbot_show_pages = sanitize_key(($_POST["wp_chatbot_show_pages"]));
923 update_option('wp_chatbot_show_pages', $wp_chatbot_show_pages);
924 }
925
926 if(isset( $_POST["wp_chatbot_show_pages_list"])) {
927 $wp_chatbot_show_pages_list = wp_parse_id_list($_POST["wp_chatbot_show_pages_list"]);
928 update_option('wp_chatbot_show_pages_list', maybe_serialize($wp_chatbot_show_pages_list));
929 }else{
930 $wp_chatbot_show_pages_list='';
931 update_option('wp_chatbot_show_pages_list', maybe_serialize($wp_chatbot_show_pages_list));
932 }
933 if(isset( $_POST["wp_chatbot_exclude_post_list"])) {
934 $wp_chatbot_exclude_post_list = $_POST["wp_chatbot_exclude_post_list"];
935 }else{ $wp_chatbot_exclude_post_list='';}
936 update_option('wp_chatbot_exclude_post_list', maybe_serialize($wp_chatbot_exclude_post_list));
937
938 if(isset($_POST["wp_chatbot_show_wpcommerce"])){
939 $wp_chatbot_show_wpcommerce = sanitize_key(($_POST["wp_chatbot_show_wpcommerce"]));
940 update_option('wp_chatbot_show_wpcommerce', $wp_chatbot_show_wpcommerce);
941 }
942
943
944 //Stop Words Settings
945 if (isset($_POST["qlcd_wp_chatbot_stop_words_name"])) {
946 $qlcd_wp_chatbot_stop_words_name = sanitize_text_field($_POST["qlcd_wp_chatbot_stop_words_name"]);
947 update_option('qlcd_wp_chatbot_stop_words_name', $qlcd_wp_chatbot_stop_words_name);
948 }
949 if (isset($_POST["qlcd_wp_chatbot_stop_words"])) {
950 $qlcd_wp_chatbot_stop_words = sanitize_text_field($_POST["qlcd_wp_chatbot_stop_words"]);
951 update_option('qlcd_wp_chatbot_stop_words', $qlcd_wp_chatbot_stop_words);
952 }
953 //wpwbot icon settings.
954 $wp_chatbot_icon = isset( $_POST['wp_chatbot_icon'] ) ? sanitize_text_field($_POST['wp_chatbot_icon']) : 'icon-3.png';
955 update_option('wp_chatbot_icon', $wp_chatbot_icon);
956
957 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field($_POST['wp_chatbot_floatingiconbg_color']) : '#fff';
958 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
959
960 // upload custom wpwbot icon path
961 $wp_chatbot_custom_icon_path = sanitize_text_field($_POST['wp_chatbot_custom_icon_path']);
962 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
963 //Agent image
964 //wpwbot icon settings.
965 $wp_chatbot_icon = (isset($_POST['wp_chatbot_agent_image']) ? sanitize_text_field($_POST['wp_chatbot_agent_image']) : 'agent-0.png');
966 update_option('wp_chatbot_agent_image', $wp_chatbot_icon);
967 // upload custom wpwbot icon
968 if(isset($_POST['wp_chatbot_custom_agent_path'])){
969 $wp_chatbot_custom_agent_path = sanitize_text_field($_POST['wp_chatbot_custom_agent_path']);
970 update_option('wp_chatbot_custom_agent_path', $wp_chatbot_custom_agent_path);
971 }
972
973 //Theming
974 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field($_POST['qcld_wb_chatbot_theme']) : 'template-00');
975 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
976 //Theme custom background option
977 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
978 $qcld_wb_chatbot_change_bg = sanitize_text_field($_POST["qcld_wb_chatbot_change_bg"]);
979 }else{$qcld_wb_chatbot_change_bg='';}
980 update_option('qcld_wb_chatbot_change_bg', $qcld_wb_chatbot_change_bg);
981 if(isset($_POST["qcld_wb_chatbot_board_bg_path"])){
982 $qcld_wb_chatbot_board_bg_path = sanitize_text_field($_POST["qcld_wb_chatbot_board_bg_path"]);
983 update_option('qcld_wb_chatbot_board_bg_path', wp_unslash($qcld_wb_chatbot_board_bg_path));
984 }
985
986
987
988 //To override style use custom css.
989 if(isset($_POST["wp_chatbot_custom_css"])){
990 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
991 update_option('wp_chatbot_custom_css', $wp_chatbot_custom_css);
992 }
993
994 $qlcd_wp_chatbot_dialogflow_project_id= @$_POST["qlcd_wp_chatbot_dialogflow_project_id"];
995 update_option('qlcd_wp_chatbot_dialogflow_project_id', sanitize_text_field($qlcd_wp_chatbot_dialogflow_project_id));
996
997 $wp_chatbot_df_api= @$_POST["wp_chatbot_df_api"];
998 update_option('wp_chatbot_df_api', sanitize_text_field($wp_chatbot_df_api));
999
1000
1001
1002 $qlcd_wp_chatbot_dialogflow_project_key= @$_POST["qlcd_wp_chatbot_dialogflow_project_key"];
1003 update_option('qlcd_wp_chatbot_dialogflow_project_key', wp_unslash($qlcd_wp_chatbot_dialogflow_project_key));
1004
1005 /****Language center settings. ****/
1006 //identity
1007 $qlcd_wp_chatbot_host = @$_POST["qlcd_wp_chatbot_host"];
1008 update_option('qlcd_wp_chatbot_host', sanitize_text_field($qlcd_wp_chatbot_host));
1009 $qlcd_wp_chatbot_agent = @$_POST["qlcd_wp_chatbot_agent"];
1010 update_option('qlcd_wp_chatbot_agent', sanitize_text_field($qlcd_wp_chatbot_agent));
1011 $qlcd_wp_chatbot_shopper_demo_name = @$_POST["qlcd_wp_chatbot_shopper_demo_name"];
1012 update_option('qlcd_wp_chatbot_shopper_demo_name', sanitize_text_field($qlcd_wp_chatbot_shopper_demo_name));
1013 $qlcd_wp_chatbot_yes = @$_POST["qlcd_wp_chatbot_yes"];
1014 update_option('qlcd_wp_chatbot_yes', sanitize_text_field($qlcd_wp_chatbot_yes));
1015 $qlcd_wp_chatbot_no = @$_POST["qlcd_wp_chatbot_no"];
1016 update_option('qlcd_wp_chatbot_no', sanitize_text_field($qlcd_wp_chatbot_no));
1017 $qlcd_wp_chatbot_or = @$_POST["qlcd_wp_chatbot_or"];
1018 update_option('qlcd_wp_chatbot_or', sanitize_text_field($qlcd_wp_chatbot_or));
1019 $qlcd_wp_chatbot_sorry = @$_POST["qlcd_wp_chatbot_sorry"];
1020 update_option('qlcd_wp_chatbot_sorry', sanitize_text_field($qlcd_wp_chatbot_sorry));
1021 $qlcd_wp_chatbot_agent_join = @$_POST["qlcd_wp_chatbot_agent_join"];
1022 update_option('qlcd_wp_chatbot_agent_join', maybe_serialize($qlcd_wp_chatbot_agent_join));
1023 //Greeting.
1024 $qlcd_wp_chatbot_welcome = @$_POST["qlcd_wp_chatbot_welcome"];
1025 update_option('qlcd_wp_chatbot_welcome', maybe_serialize($qlcd_wp_chatbot_welcome));
1026 $qlcd_wp_chatbot_back_to_start = @$_POST["qlcd_wp_chatbot_back_to_start"];
1027 update_option('qlcd_wp_chatbot_back_to_start', maybe_serialize($qlcd_wp_chatbot_back_to_start));
1028 $qlcd_wp_chatbot_hi_there = @$_POST["qlcd_wp_chatbot_hi_there"];
1029 update_option('qlcd_wp_chatbot_hi_there', maybe_serialize($qlcd_wp_chatbot_hi_there));
1030 $qlcd_wp_chatbot_hello = @$_POST["qlcd_wp_chatbot_hello"];
1031 update_option('qlcd_wp_chatbot_hello', maybe_serialize($qlcd_wp_chatbot_hello));
1032 $qlcd_wp_chatbot_welcome_back = @$_POST["qlcd_wp_chatbot_welcome_back"];
1033 update_option('qlcd_wp_chatbot_welcome_back', maybe_serialize($qlcd_wp_chatbot_welcome_back));
1034 $qlcd_wp_chatbot_asking_name = @$_POST["qlcd_wp_chatbot_asking_name"];
1035 update_option('qlcd_wp_chatbot_asking_name', maybe_serialize($qlcd_wp_chatbot_asking_name));
1036 $qlcd_wp_chatbot_name_greeting = @$_POST["qlcd_wp_chatbot_name_greeting"];
1037 update_option('qlcd_wp_chatbot_name_greeting', maybe_serialize($qlcd_wp_chatbot_name_greeting));
1038 $qlcd_wp_chatbot_i_am = @$_POST["qlcd_wp_chatbot_i_am"];
1039 update_option('qlcd_wp_chatbot_i_am', maybe_serialize($qlcd_wp_chatbot_i_am));
1040 $qlcd_wp_chatbot_is_typing = @$_POST["qlcd_wp_chatbot_is_typing"];
1041 update_option('qlcd_wp_chatbot_is_typing', maybe_serialize($qlcd_wp_chatbot_is_typing));
1042 $qlcd_wp_chatbot_send_a_msg= @$_POST["qlcd_wp_chatbot_send_a_msg"];
1043 update_option('qlcd_wp_chatbot_send_a_msg', maybe_serialize($qlcd_wp_chatbot_send_a_msg));
1044 $qlcd_wp_chatbot_choose_option= @$_POST["qlcd_wp_chatbot_choose_option"];
1045 update_option('qlcd_wp_chatbot_choose_option', maybe_serialize($qlcd_wp_chatbot_choose_option));
1046 $qlcd_wp_chatbot_viewed_products= @$_POST["qlcd_wp_chatbot_viewed_products"];
1047 update_option('qlcd_wp_chatbot_viewed_products', maybe_serialize($qlcd_wp_chatbot_viewed_products));
1048 $qlcd_wp_chatbot_shopping_cart= @$_POST["qlcd_wp_chatbot_shopping_cart"];
1049 update_option('qlcd_wp_chatbot_shopping_cart', maybe_serialize($qlcd_wp_chatbot_shopping_cart));
1050 $qlcd_wp_chatbot_add_to_cart= @$_POST["qlcd_wp_chatbot_add_to_cart"];
1051 update_option('qlcd_wp_chatbot_add_to_cart', maybe_serialize($qlcd_wp_chatbot_add_to_cart));
1052 $qlcd_wp_chatbot_cart_link= @$_POST["qlcd_wp_chatbot_cart_link"];
1053 update_option('qlcd_wp_chatbot_cart_link', maybe_serialize($qlcd_wp_chatbot_cart_link));
1054 $qlcd_wp_chatbot_checkout_link= @$_POST["qlcd_wp_chatbot_checkout_link"];
1055 update_option('qlcd_wp_chatbot_checkout_link', maybe_serialize($qlcd_wp_chatbot_checkout_link));
1056 $qlcd_wp_chatbot_cart_welcome= @$_POST["qlcd_wp_chatbot_cart_welcome"];
1057 update_option('qlcd_wp_chatbot_cart_welcome', maybe_serialize($qlcd_wp_chatbot_cart_welcome));
1058 $qlcd_wp_chatbot_featured_product_welcome= @$_POST["qlcd_wp_chatbot_featured_product_welcome"];
1059 update_option('qlcd_wp_chatbot_featured_product_welcome', maybe_serialize($qlcd_wp_chatbot_featured_product_welcome));
1060 $qlcd_wp_chatbot_viewed_product_welcome= @$_POST["qlcd_wp_chatbot_viewed_product_welcome"];
1061 update_option('qlcd_wp_chatbot_viewed_product_welcome', maybe_serialize($qlcd_wp_chatbot_viewed_product_welcome));
1062 $qlcd_wp_chatbot_latest_product_welcome= @$_POST["qlcd_wp_chatbot_latest_product_welcome"];
1063 update_option('qlcd_wp_chatbot_latest_product_welcome', maybe_serialize($qlcd_wp_chatbot_latest_product_welcome));
1064 $qlcd_wp_chatbot_cart_title= @$_POST["qlcd_wp_chatbot_cart_title"];
1065 update_option('qlcd_wp_chatbot_cart_title', maybe_serialize($qlcd_wp_chatbot_cart_title));
1066 $qlcd_wp_chatbot_cart_quantity= @$_POST["qlcd_wp_chatbot_cart_quantity"];
1067 update_option('qlcd_wp_chatbot_cart_quantity', maybe_serialize($qlcd_wp_chatbot_cart_quantity));
1068 $qlcd_wp_chatbot_cart_price= @$_POST["qlcd_wp_chatbot_cart_price"];
1069 update_option('qlcd_wp_chatbot_cart_price', maybe_serialize($qlcd_wp_chatbot_cart_price));
1070 $qlcd_wp_chatbot_no_cart_items= @$_POST["qlcd_wp_chatbot_no_cart_items"];
1071 update_option('qlcd_wp_chatbot_no_cart_items', maybe_serialize($qlcd_wp_chatbot_no_cart_items));
1072 $qlcd_wp_chatbot_cart_updating= @$_POST["qlcd_wp_chatbot_cart_updating"];
1073 update_option('qlcd_wp_chatbot_cart_updating', maybe_serialize($qlcd_wp_chatbot_cart_updating));
1074 $qlcd_wp_chatbot_cart_removing= @$_POST["qlcd_wp_chatbot_cart_removing"];
1075 update_option('qlcd_wp_chatbot_cart_removing', maybe_serialize($qlcd_wp_chatbot_cart_removing));
1076 //wpwBot wildcard settings
1077 $qlcd_wp_chatbot_wildcard_msg = @$_POST["qlcd_wp_chatbot_wildcard_msg"];
1078 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize($qlcd_wp_chatbot_wildcard_msg));
1079 //empty filter message repeat.
1080 $qlcd_wp_chatbot_empty_filter_msg = @$_POST["qlcd_wp_chatbot_empty_filter_msg"];
1081 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize($qlcd_wp_chatbot_empty_filter_msg));
1082
1083 $qlcd_wp_chatbot_did_you_mean = @$_POST["qlcd_wp_chatbot_did_you_mean"];
1084 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize($qlcd_wp_chatbot_did_you_mean));
1085 //help welcome and message
1086 $qlcd_wp_chatbot_help_welcome = @$_POST["qlcd_wp_chatbot_help_welcome"];
1087 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize($qlcd_wp_chatbot_help_welcome));
1088 $qlcd_wp_chatbot_help_msg = @$_POST["qlcd_wp_chatbot_help_msg"];
1089 update_option('qlcd_wp_chatbot_help_msg', maybe_serialize($qlcd_wp_chatbot_help_msg));
1090 //To clear Conversation history.
1091 $qlcd_wp_chatbot_reset = @$_POST["qlcd_wp_chatbot_reset"];
1092 update_option('qlcd_wp_chatbot_reset', maybe_serialize($qlcd_wp_chatbot_reset));
1093 //systems keyword.
1094 $qlcd_wp_chatbot_sys_key_help = @$_POST["qlcd_wp_chatbot_sys_key_help"];
1095 update_option('qlcd_wp_chatbot_sys_key_help', sanitize_text_field($qlcd_wp_chatbot_sys_key_help));
1096 $qlcd_wp_chatbot_sys_key_product = @$_POST["qlcd_wp_chatbot_sys_key_product"];
1097 update_option('qlcd_wp_chatbot_sys_key_product', sanitize_text_field($qlcd_wp_chatbot_sys_key_product));
1098 $qlcd_wp_chatbot_sys_key_catalog = @$_POST["qlcd_wp_chatbot_sys_key_catalog"];
1099 update_option('qlcd_wp_chatbot_sys_key_catalog', sanitize_text_field($qlcd_wp_chatbot_sys_key_catalog));
1100 $qlcd_wp_chatbot_sys_key_order = @$_POST["qlcd_wp_chatbot_sys_key_order"];
1101 update_option('qlcd_wp_chatbot_sys_key_order', sanitize_text_field($qlcd_wp_chatbot_sys_key_order));
1102 $qlcd_wp_chatbot_sys_key_support = @$_POST["qlcd_wp_chatbot_sys_key_support"];
1103 update_option('qlcd_wp_chatbot_sys_key_support', sanitize_text_field($qlcd_wp_chatbot_sys_key_support));
1104 $qlcd_wp_chatbot_sys_key_reset = @$_POST["qlcd_wp_chatbot_sys_key_reset"];
1105 update_option('qlcd_wp_chatbot_sys_key_reset', sanitize_text_field($qlcd_wp_chatbot_sys_key_reset));
1106 $qlcd_wp_chatbot_sys_key_email = @$_POST["qlcd_wp_chatbot_sys_key_email"];
1107 update_option('qlcd_wp_chatbot_sys_key_email', sanitize_text_field($qlcd_wp_chatbot_sys_key_email));
1108 $qlcd_wp_chatbot_wildcard_product = @$_POST["qlcd_wp_chatbot_wildcard_product"];
1109 update_option('qlcd_wp_chatbot_wildcard_product', maybe_serialize($qlcd_wp_chatbot_wildcard_product));
1110 $qlcd_wp_chatbot_wildcard_catalog = @$_POST["qlcd_wp_chatbot_wildcard_catalog"];
1111 update_option('qlcd_wp_chatbot_wildcard_catalog', maybe_serialize($qlcd_wp_chatbot_wildcard_catalog));
1112 $qlcd_wp_chatbot_featured_products = @$_POST["qlcd_wp_chatbot_featured_products"];
1113 update_option('qlcd_wp_chatbot_featured_products', maybe_serialize($qlcd_wp_chatbot_featured_products));
1114 $qlcd_wp_chatbot_sale_products = @$_POST["qlcd_wp_chatbot_sale_products"];
1115 update_option('qlcd_wp_chatbot_sale_products', maybe_serialize($qlcd_wp_chatbot_sale_products));
1116 $qlcd_wp_chatbot_wildcard_support = @$_POST["qlcd_wp_chatbot_wildcard_support"];
1117 update_option('qlcd_wp_chatbot_wildcard_support', sanitize_text_field($qlcd_wp_chatbot_wildcard_support));
1118 $qlcd_wp_chatbot_messenger_label = @$_POST["qlcd_wp_chatbot_messenger_label"];
1119 update_option('qlcd_wp_chatbot_messenger_label', maybe_serialize($qlcd_wp_chatbot_messenger_label));
1120 //Products search .
1121 if (isset($_POST["qlcd_wp_chatbot_product_success"])) {
1122 $qlcd_wp_chatbot_product_success = @$_POST["qlcd_wp_chatbot_product_success"];
1123 update_option('qlcd_wp_chatbot_product_success', maybe_serialize($qlcd_wp_chatbot_product_success));
1124 }
1125 if (isset($_POST["qlcd_wp_chatbot_product_fail"])) {
1126 $qlcd_wp_chatbot_product_fail = @$_POST["qlcd_wp_chatbot_product_fail"];
1127 update_option('qlcd_wp_chatbot_product_fail', maybe_serialize($qlcd_wp_chatbot_product_fail));
1128 }
1129 $qlcd_wp_chatbot_product_asking = @$_POST["qlcd_wp_chatbot_product_asking"];
1130 update_option('qlcd_wp_chatbot_product_asking', maybe_serialize($qlcd_wp_chatbot_product_asking));
1131 $qlcd_wp_chatbot_product_suggest = @$_POST["qlcd_wp_chatbot_product_suggest"];
1132 update_option('qlcd_wp_chatbot_product_suggest', maybe_serialize($qlcd_wp_chatbot_product_suggest));
1133 $qlcd_wp_chatbot_product_infinite = @$_POST["qlcd_wp_chatbot_product_infinite"];
1134 update_option('qlcd_wp_chatbot_product_infinite', maybe_serialize($qlcd_wp_chatbot_product_infinite));
1135 $qlcd_wp_chatbot_load_more = @$_POST["qlcd_wp_chatbot_load_more"];
1136 update_option('qlcd_wp_chatbot_load_more', maybe_serialize($qlcd_wp_chatbot_load_more));
1137 //Order
1138 $qlcd_wp_chatbot_wildcard_order = @$_POST["qlcd_wp_chatbot_wildcard_order"];
1139 update_option('qlcd_wp_chatbot_wildcard_order', maybe_serialize($qlcd_wp_chatbot_wildcard_order));
1140 $qlcd_wp_chatbot_order_welcome = @$_POST["qlcd_wp_chatbot_order_welcome"];
1141 update_option('qlcd_wp_chatbot_order_welcome', maybe_serialize($qlcd_wp_chatbot_order_welcome));
1142 $qlcd_wp_chatbot_order_username_asking = @$_POST["qlcd_wp_chatbot_order_username_asking"];
1143 update_option('qlcd_wp_chatbot_order_username_asking', maybe_serialize($qlcd_wp_chatbot_order_username_asking));
1144 $qlcd_wp_chatbot_order_username_not_exist = @$_POST["qlcd_wp_chatbot_order_username_not_exist"];
1145 update_option('qlcd_wp_chatbot_order_username_not_exist', maybe_serialize($qlcd_wp_chatbot_order_username_not_exist));
1146 $qlcd_wp_chatbot_order_username_thanks = @$_POST["qlcd_wp_chatbot_order_username_thanks"];
1147 update_option('qlcd_wp_chatbot_order_username_thanks', maybe_serialize($qlcd_wp_chatbot_order_username_thanks));
1148 $qlcd_wp_chatbot_order_username_password = @$_POST["qlcd_wp_chatbot_order_username_password"];
1149 update_option('qlcd_wp_chatbot_order_username_password', maybe_serialize($qlcd_wp_chatbot_order_username_password));
1150 $qlcd_wp_chatbot_order_password_incorrect= @$_POST["qlcd_wp_chatbot_order_password_incorrect"];
1151 update_option('qlcd_wp_chatbot_order_password_incorrect', maybe_serialize($qlcd_wp_chatbot_order_password_incorrect));
1152 $qlcd_wp_chatbot_order_not_found= @$_POST["qlcd_wp_chatbot_order_not_found"];
1153 update_option('qlcd_wp_chatbot_order_not_found', maybe_serialize($qlcd_wp_chatbot_order_not_found));
1154 $qlcd_wp_chatbot_order_found= @$_POST["qlcd_wp_chatbot_order_found"];
1155 update_option('qlcd_wp_chatbot_order_found', maybe_serialize($qlcd_wp_chatbot_order_found));
1156 $qlcd_wp_chatbot_order_email_support= @$_POST["qlcd_wp_chatbot_order_email_support"];
1157 update_option('qlcd_wp_chatbot_order_email_support', maybe_serialize($qlcd_wp_chatbot_order_email_support));
1158 //Support
1159 $qlcd_wp_chatbot_support_welcome = @$_POST["qlcd_wp_chatbot_support_welcome"];
1160 update_option('qlcd_wp_chatbot_support_welcome', maybe_serialize($qlcd_wp_chatbot_support_welcome));
1161 $qlcd_wp_chatbot_support_email = @$_POST["qlcd_wp_chatbot_support_email"];
1162 update_option('qlcd_wp_chatbot_support_email', sanitize_text_field($qlcd_wp_chatbot_support_email));
1163 $qlcd_wp_chatbot_asking_email = @$_POST["qlcd_wp_chatbot_asking_email"];
1164 update_option('qlcd_wp_chatbot_asking_email', maybe_serialize($qlcd_wp_chatbot_asking_email));
1165 $qlcd_wp_chatbot_asking_msg = @$_POST["qlcd_wp_chatbot_asking_msg"];
1166 update_option('qlcd_wp_chatbot_asking_msg', maybe_serialize($qlcd_wp_chatbot_asking_msg));
1167
1168 $qlcd_wp_chatbot_no_result = @$_POST["qlcd_wp_chatbot_no_result"];
1169 update_option('qlcd_wp_chatbot_no_result', maybe_serialize($qlcd_wp_chatbot_no_result));
1170
1171 $qlcd_wp_chatbot_support_option_again = @$_POST["qlcd_wp_chatbot_support_option_again"];
1172 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize($qlcd_wp_chatbot_support_option_again));
1173 $qlcd_wp_chatbot_invalid_email = @$_POST["qlcd_wp_chatbot_invalid_email"];
1174 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize($qlcd_wp_chatbot_invalid_email));
1175 $qlcd_wp_chatbot_support_phone= @$_POST["qlcd_wp_chatbot_support_phone"];
1176
1177 update_option('qlcd_wp_chatbot_support_phone', sanitize_text_field($qlcd_wp_chatbot_support_phone));
1178 $qlcd_wp_chatbot_asking_phone= @$_POST["qlcd_wp_chatbot_asking_phone"];
1179 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize($qlcd_wp_chatbot_asking_phone));
1180 $qlcd_wp_chatbot_thank_for_phone= @$_POST["qlcd_wp_chatbot_thank_for_phone"];
1181 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize($qlcd_wp_chatbot_thank_for_phone));
1182 $qlcd_wp_chatbot_admin_email = sanitize_email(@$_POST["qlcd_wp_chatbot_admin_email"]);
1183
1184 update_option('qlcd_wp_chatbot_admin_email', $qlcd_wp_chatbot_admin_email);
1185
1186 $qlcd_wp_chatbot_email_sub = sanitize_email(@$_POST["qlcd_wp_chatbot_email_sub"]);
1187 update_option('qlcd_wp_chatbot_email_sub', $qlcd_wp_chatbot_email_sub);
1188
1189 $qlcd_wp_site_search = @$_POST["qlcd_wp_site_search"];
1190 update_option('qlcd_wp_site_search', sanitize_text_field($qlcd_wp_site_search));
1191
1192 $qlcd_wp_chatbot_email_sent = @$_POST["qlcd_wp_chatbot_email_sent"];
1193 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field($qlcd_wp_chatbot_email_sent));
1194 $qlcd_wp_chatbot_email_fail = @$_POST["qlcd_wp_chatbot_email_fail"];
1195 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field($qlcd_wp_chatbot_email_fail));
1196 //Notifications messages building.
1197 $qlcd_wp_chatbot_notification_interval = @$_POST["qlcd_wp_chatbot_notification_interval"];
1198 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field($qlcd_wp_chatbot_notification_interval));
1199 $qlcd_wp_chatbot_notifications = @$_POST["qlcd_wp_chatbot_notifications"];
1200 update_option('qlcd_wp_chatbot_notifications', maybe_serialize($qlcd_wp_chatbot_notifications));
1201 //Support building part.
1202 $support_query = @$_POST["support_query"];
1203 update_option('support_query', maybe_serialize($support_query));
1204 $support_ans = @$_POST["support_ans"];
1205 update_option('support_ans', maybe_serialize($support_ans));
1206 //Create Mobile app pages.
1207 if(isset( $_POST["wp_chatbot_app_pages"])) {
1208 $wp_chatbot_app_pages = $_POST["wp_chatbot_app_pages"];
1209 }else{ $wp_chatbot_app_pages='';}
1210 update_option('wp_chatbot_app_pages', wp_unslash($wp_chatbot_app_pages));
1211 //Messenger Options
1212 if(isset( $_POST["enable_wp_chatbot_messenger"])) {
1213 $enable_wp_chatbot_messenger = $_POST["enable_wp_chatbot_messenger"];
1214 }else{ $enable_wp_chatbot_messenger='';}
1215 update_option('enable_wp_chatbot_messenger', wp_unslash($enable_wp_chatbot_messenger));
1216 if(isset( $_POST["enable_wp_chatbot_messenger_floating_icon"])) {
1217 $enable_wp_chatbot_messenger_floating_icon = $_POST["enable_wp_chatbot_messenger_floating_icon"];
1218 }else{ $enable_wp_chatbot_messenger_floating_icon='';}
1219 update_option('enable_wp_chatbot_messenger_floating_icon', wp_unslash($enable_wp_chatbot_messenger_floating_icon));
1220 $qlcd_wp_chatbot_fb_app_id = @$_POST["qlcd_wp_chatbot_fb_app_id"];
1221 update_option('qlcd_wp_chatbot_fb_app_id', sanitize_text_field($qlcd_wp_chatbot_fb_app_id));
1222 $qlcd_wp_chatbot_fb_page_id = @$_POST["qlcd_wp_chatbot_fb_page_id"];
1223 update_option('qlcd_wp_chatbot_fb_page_id', sanitize_text_field($qlcd_wp_chatbot_fb_page_id));
1224 $qlcd_wp_chatbot_fb_color= @$_POST["qlcd_wp_chatbot_fb_color"];
1225 update_option('qlcd_wp_chatbot_fb_color', wp_unslash($qlcd_wp_chatbot_fb_color));
1226 $qlcd_wp_chatbot_fb_in_msg = @$_POST["qlcd_wp_chatbot_fb_in_msg"];
1227 update_option('qlcd_wp_chatbot_fb_in_msg', sanitize_text_field($qlcd_wp_chatbot_fb_in_msg));
1228 $qlcd_wp_chatbot_fb_out_msg = @$_POST["qlcd_wp_chatbot_fb_out_msg"];
1229 update_option('qlcd_wp_chatbot_fb_out_msg', sanitize_text_field($qlcd_wp_chatbot_fb_out_msg));
1230 //Skype option
1231 if(isset( $_POST["enable_wp_chatbot_skype_floating_icon"])) {
1232 $enable_wp_chatbot_skype_floating_icon = $_POST["enable_wp_chatbot_skype_floating_icon"];
1233 }else{ $enable_wp_chatbot_skype_floating_icon='';}
1234 update_option('enable_wp_chatbot_skype_floating_icon', sanitize_text_field($enable_wp_chatbot_skype_floating_icon));
1235 if(isset( $_POST["enable_wp_chatbot_skype_id"])) {
1236 $enable_wp_chatbot_skype_id = $_POST["enable_wp_chatbot_skype_id"];
1237 }else{ $enable_wp_chatbot_skype_id='';}
1238 update_option('enable_wp_chatbot_skype_id', sanitize_text_field($enable_wp_chatbot_skype_id));
1239 //WhatsApp
1240 if(isset( $_POST["enable_wp_chatbot_whats"])) {
1241 $enable_wp_chatbot_whats= $_POST["enable_wp_chatbot_whats"];
1242 }else{ $enable_wp_chatbot_whats='';}
1243 update_option('enable_wp_chatbot_whats', sanitize_text_field($enable_wp_chatbot_whats));
1244 $qlcd_wp_chatbot_whats_label = @$_POST["qlcd_wp_chatbot_whats_label"];
1245 update_option('qlcd_wp_chatbot_whats_label', maybe_serialize($qlcd_wp_chatbot_whats_label));
1246 if(isset( $_POST["enable_wp_chatbot_floating_whats"])) {
1247 $enable_wp_chatbot_floating_whats= $_POST["enable_wp_chatbot_floating_whats"];
1248 }else{ $enable_wp_chatbot_floating_whats='';}
1249 update_option('enable_wp_chatbot_floating_whats', sanitize_text_field($enable_wp_chatbot_floating_whats));
1250 $qlcd_wp_chatbot_whats_num = @$_POST["qlcd_wp_chatbot_whats_num"];
1251 update_option('qlcd_wp_chatbot_whats_num', sanitize_text_field($qlcd_wp_chatbot_whats_num));
1252 //Viber
1253 if(isset( $_POST["enable_wp_chatbot_floating_viber"])) {
1254 $enable_wp_chatbot_floating_viber = $_POST["enable_wp_chatbot_floating_viber"];
1255 }else{ $enable_wp_chatbot_floating_viber='';}
1256 update_option('enable_wp_chatbot_floating_viber', sanitize_text_field($enable_wp_chatbot_floating_viber));
1257 $qlcd_wp_chatbot_viber_acc = @$_POST["qlcd_wp_chatbot_viber_acc"];
1258 update_option('qlcd_wp_chatbot_viber_acc', sanitize_text_field($qlcd_wp_chatbot_viber_acc));
1259 //Others integration
1260 if(isset( $_POST["enable_wp_chatbot_floating_phone"])) {
1261 $enable_wp_chatbot_floating_phone = $_POST["enable_wp_chatbot_floating_phone"];
1262 }else{ $enable_wp_chatbot_floating_phone='';}
1263 update_option('enable_wp_chatbot_floating_phone', sanitize_text_field($enable_wp_chatbot_floating_phone));
1264 $qlcd_wp_chatbot_phone = @$_POST["qlcd_wp_chatbot_phone"];
1265 update_option('qlcd_wp_chatbot_phone', sanitize_text_field($qlcd_wp_chatbot_phone));
1266
1267 if(isset( $_POST["enable_wp_chatbot_floating_link"])) {
1268 $enable_wp_chatbot_floating_link = $_POST["enable_wp_chatbot_floating_link"];
1269 }else{ $enable_wp_chatbot_floating_link='';}
1270 update_option('enable_wp_chatbot_floating_link', sanitize_text_field($enable_wp_chatbot_floating_link));
1271 $qlcd_wp_chatbot_weblink = @$_POST["qlcd_wp_chatbot_weblink"];
1272 update_option('qlcd_wp_chatbot_weblink', sanitize_text_field($qlcd_wp_chatbot_weblink));
1273
1274 //Re Targetting.
1275 $qlcd_wp_chatbot_ret_greet = @$_POST["qlcd_wp_chatbot_ret_greet"];
1276 update_option('qlcd_wp_chatbot_ret_greet', sanitize_text_field($qlcd_wp_chatbot_ret_greet));
1277
1278 if(isset( $_POST["enable_wp_chatbot_exit_intent"])) {
1279 $enable_wp_chatbot_exit_intent = $_POST["enable_wp_chatbot_exit_intent"];
1280 }else{ $enable_wp_chatbot_exit_intent='';}
1281 update_option('enable_wp_chatbot_exit_intent', sanitize_text_field($enable_wp_chatbot_exit_intent));
1282
1283 $wp_chatbot_exit_intent_msg = @$_POST["wp_chatbot_exit_intent_msg"];
1284 update_option('wp_chatbot_exit_intent_msg', wp_unslash($wp_chatbot_exit_intent_msg));
1285
1286 if(isset( $_POST["wp_chatbot_exit_intent_once"])) {
1287 $wp_chatbot_exit_intent_once = $_POST["wp_chatbot_exit_intent_once"];
1288 }else{ $wp_chatbot_exit_intent_once='';}
1289 update_option('wp_chatbot_exit_intent_once', sanitize_text_field($wp_chatbot_exit_intent_once));
1290
1291 if(isset( $_POST["enable_wp_chatbot_scroll_open"])) {
1292 $enable_wp_chatbot_scroll_open = $_POST["enable_wp_chatbot_scroll_open"];
1293 }else{ $enable_wp_chatbot_scroll_open='';}
1294 update_option('enable_wp_chatbot_scroll_open', sanitize_text_field($enable_wp_chatbot_scroll_open));
1295
1296 $wp_chatbot_scroll_open_msg= @$_POST["wp_chatbot_scroll_open_msg"];
1297 update_option('wp_chatbot_scroll_open_msg', wp_unslash($wp_chatbot_scroll_open_msg));
1298
1299 $wp_chatbot_scroll_percent= @$_POST["wp_chatbot_scroll_percent"];
1300 update_option('wp_chatbot_scroll_percent', wp_unslash($wp_chatbot_scroll_percent));
1301
1302 if(isset( $_POST["wp_chatbot_scroll_once"])) {
1303 $wp_chatbot_scroll_once = sanitize_text_field($_POST["wp_chatbot_scroll_once"]);
1304 }else{ $wp_chatbot_scroll_once='';}
1305 update_option('wp_chatbot_scroll_once', $wp_chatbot_scroll_once);
1306
1307 if(isset( $_POST["enable_wp_chatbot_auto_open"])) {
1308 $enable_wp_chatbot_auto_open = sanitize_text_field($_POST["enable_wp_chatbot_auto_open"]);
1309 }else{ $enable_wp_chatbot_auto_open='';}
1310 update_option('enable_wp_chatbot_auto_open', $enable_wp_chatbot_auto_open);
1311
1312 if(isset( $_POST["enable_wp_chatbot_ret_sound"])) {
1313 $enable_wp_chatbot_ret_sound = sanitize_text_field($_POST["enable_wp_chatbot_ret_sound"]);
1314 }else{ $enable_wp_chatbot_ret_sound='';}
1315 update_option('enable_wp_chatbot_ret_sound', $enable_wp_chatbot_ret_sound);
1316
1317 if(isset( $_POST["enable_wp_chatbot_sound_initial"])) {
1318 $enable_wp_chatbot_sound_initial = sanitize_text_field($_POST["enable_wp_chatbot_sound_initial"]);
1319 }else{ $enable_wp_chatbot_sound_initial='';}
1320 update_option('enable_wp_chatbot_sound_initial', $enable_wp_chatbot_sound_initial);
1321
1322
1323 $wp_chatbot_auto_open_msg = @$_POST["wp_chatbot_auto_open_msg"];
1324 update_option('wp_chatbot_auto_open_msg', wp_unslash($wp_chatbot_auto_open_msg));
1325
1326 $wp_chatbot_auto_open_time = @$_POST["wp_chatbot_auto_open_time"];
1327 update_option('wp_chatbot_auto_open_time', wp_unslash($wp_chatbot_auto_open_time));
1328 //to complate checkout
1329 if(isset( $_POST["enable_wp_chatbot_ret_user_show"])) {
1330 $enable_wp_chatbot_ret_user_show = sanitize_text_field($_POST["enable_wp_chatbot_ret_user_show"]);
1331 }else{ $enable_wp_chatbot_ret_user_show='';}
1332 update_option('enable_wp_chatbot_ret_user_show', $enable_wp_chatbot_ret_user_show);
1333
1334 if(isset( $_POST["enable_wp_chatbot_inactive_time_show"])) {
1335 $enable_wp_chatbot_inactive_time_show = sanitize_text_field($_POST["enable_wp_chatbot_inactive_time_show"]);
1336 }else{ $enable_wp_chatbot_inactive_time_show='';}
1337 update_option('enable_wp_chatbot_inactive_time_show', $enable_wp_chatbot_inactive_time_show);
1338
1339 $wp_chatbot_inactive_time = @$_POST["wp_chatbot_inactive_time"];
1340 update_option('wp_chatbot_inactive_time', sanitize_text_field($wp_chatbot_inactive_time));
1341
1342 $wp_chatbot_checkout_msg = @$_POST["wp_chatbot_checkout_msg"];
1343 update_option('wp_chatbot_checkout_msg', wp_unslash($wp_chatbot_checkout_msg));
1344
1345 if(isset( $_POST["wp_chatbot_auto_open_once"])) {
1346 $wp_chatbot_auto_open_once = sanitize_text_field($_POST["wp_chatbot_auto_open_once"]);
1347 }else{ $wp_chatbot_auto_open_once='';}
1348 update_option('wp_chatbot_auto_open_once', $wp_chatbot_auto_open_once);
1349
1350 if(isset( $_POST["wp_chatbot_inactive_once"])) {
1351 $wp_chatbot_inactive_once = sanitize_text_field($_POST["wp_chatbot_inactive_once"]);
1352 }else{ $wp_chatbot_inactive_once='';}
1353 update_option('wp_chatbot_inactive_once', $wp_chatbot_inactive_once);
1354
1355
1356 $wp_chatbot_proactive_bg_color = @$_POST["wp_chatbot_proactive_bg_color"];
1357 update_option('wp_chatbot_proactive_bg_color', sanitize_text_field($wp_chatbot_proactive_bg_color));
1358
1359 if(isset( $_POST["disable_wp_chatbot_call_gen"])) {
1360 $disable_wp_chatbot_call_gen = sanitize_text_field($_POST["disable_wp_chatbot_call_gen"]);
1361 }else{ $disable_wp_chatbot_call_gen='';}
1362 update_option('disable_wp_chatbot_call_gen', $disable_wp_chatbot_call_gen);
1363
1364 if(isset( $_POST["disable_wp_chatbot_site_search"])) {
1365 $disable_wp_chatbot_site_search = sanitize_text_field($_POST["disable_wp_chatbot_site_search"]);
1366 }else{ $disable_wp_chatbot_site_search='';}
1367 update_option('disable_wp_chatbot_site_search', $disable_wp_chatbot_site_search);
1368
1369 if(isset( $_POST["disable_wp_chatbot_call_sup"])) {
1370 $disable_wp_chatbot_call_sup = sanitize_text_field($_POST["disable_wp_chatbot_call_sup"]);
1371 }else{ $disable_wp_chatbot_call_sup='';}
1372 update_option('disable_wp_chatbot_call_sup', $disable_wp_chatbot_call_sup);
1373
1374 if(isset( $_POST["disable_wp_chatbot_feedback"])) {
1375 $disable_wp_chatbot_feedback = sanitize_text_field($_POST["disable_wp_chatbot_feedback"]);
1376 }else{ $disable_wp_chatbot_feedback='';}
1377 update_option('disable_wp_chatbot_feedback', $disable_wp_chatbot_feedback);
1378
1379 if(isset( $_POST["disable_wp_chatbot_faq"])) {
1380 $disable_wp_chatbot_faq = sanitize_text_field($_POST["disable_wp_chatbot_faq"]);
1381 }else{ $disable_wp_chatbot_faq='';}
1382 update_option('disable_wp_chatbot_faq', $disable_wp_chatbot_faq);
1383
1384 $qlcd_wp_chatbot_feedback_label = @$_POST["qlcd_wp_chatbot_feedback_label"];
1385 update_option('qlcd_wp_chatbot_feedback_label', maybe_serialize($qlcd_wp_chatbot_feedback_label));
1386
1387 if(isset( $_POST["enable_wp_chatbot_meta_title"])) {
1388 $enable_wp_chatbot_meta_title = sanitize_text_field($_POST["enable_wp_chatbot_meta_title"]);
1389 }else{ $enable_wp_chatbot_meta_title='';}
1390 update_option('enable_wp_chatbot_meta_title', $enable_wp_chatbot_meta_title);
1391
1392 $qlcd_wp_chatbot_meta_label = @$_POST["qlcd_wp_chatbot_meta_label"];
1393 update_option('qlcd_wp_chatbot_meta_label', sanitize_text_field($qlcd_wp_chatbot_meta_label));
1394
1395 $qlcd_wp_chatbot_phone_sent = @$_POST["qlcd_wp_chatbot_phone_sent"];
1396 update_option('qlcd_wp_chatbot_phone_sent', sanitize_text_field($qlcd_wp_chatbot_phone_sent));
1397
1398 $qlcd_wp_chatbot_phone_fail = @$_POST["qlcd_wp_chatbot_phone_fail"];
1399 update_option('qlcd_wp_chatbot_phone_fail', sanitize_text_field($qlcd_wp_chatbot_phone_fail));
1400
1401 if(isset( $_POST["enable_wp_chatbot_opening_hour"])) {
1402 $enable_wp_chatbot_opening_hour = sanitize_text_field($_POST["enable_wp_chatbot_opening_hour"]);
1403 }else{ $enable_wp_chatbot_opening_hour='';}
1404 update_option('enable_wp_chatbot_opening_hour', $enable_wp_chatbot_opening_hour);
1405
1406 $wpwbot_hours= @$_POST["wpwbot_hours"];
1407 update_option('wpwbot_hours', maybe_serialize($wpwbot_hours));
1408
1409 if(isset( $_POST["enable_wp_chatbot_dailogflow"])) {
1410 $enable_wp_chatbot_dailogflow = sanitize_text_field($_POST["enable_wp_chatbot_dailogflow"]);
1411 }else{ $enable_wp_chatbot_dailogflow='';}
1412 update_option('enable_wp_chatbot_dailogflow', $enable_wp_chatbot_dailogflow);
1413
1414 $qlcd_wp_chatbot_dialogflow_client_token= @$_POST["qlcd_wp_chatbot_dialogflow_client_token"];
1415 update_option('qlcd_wp_chatbot_dialogflow_client_token', sanitize_text_field($qlcd_wp_chatbot_dialogflow_client_token));
1416
1417 $qlcd_wp_chatbot_dialogflow_defualt_reply= @$_POST["qlcd_wp_chatbot_dialogflow_defualt_reply"];
1418 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', sanitize_text_field($qlcd_wp_chatbot_dialogflow_defualt_reply));
1419
1420 $qlcd_wp_chatbot_dialogflow_agent_language= @$_POST["qlcd_wp_chatbot_dialogflow_agent_language"];
1421 update_option('qlcd_wp_chatbot_dialogflow_agent_language', sanitize_text_field($qlcd_wp_chatbot_dialogflow_agent_language));
1422 // style option save
1423 if(isset( $_POST["enable_wp_chatbot_custom_color"])) {
1424 $enable_wp_chatbot_custom_color = $_POST["enable_wp_chatbot_custom_color"];
1425 }else{ $enable_wp_chatbot_custom_color='';}
1426 update_option('enable_wp_chatbot_custom_color', sanitize_text_field($enable_wp_chatbot_custom_color));
1427 $wp_chatbot_text_color = @$_POST["wp_chatbot_text_color"];
1428 update_option('wp_chatbot_text_color', sanitize_text_field($wp_chatbot_text_color));
1429
1430 $wp_chatbot_floatingiconbg_color = @$_POST["wp_chatbot_floatingiconbg_color"];
1431 update_option('wp_chatbot_floatingiconbg_color', sanitize_text_field($wp_chatbot_floatingiconbg_color));
1432
1433 $wp_chatbot_link_color = @$_POST["wp_chatbot_link_color"];
1434 update_option('wp_chatbot_link_color', sanitize_text_field($wp_chatbot_link_color));
1435
1436 $wp_chatbot_link_hover_color = @$_POST["wp_chatbot_link_hover_color"];
1437 update_option('wp_chatbot_link_hover_color', sanitize_text_field($wp_chatbot_link_hover_color));
1438
1439 $wp_chatbot_bot_msg_bg_color = @$_POST["wp_chatbot_bot_msg_bg_color"];
1440 update_option('wp_chatbot_bot_msg_bg_color', sanitize_text_field($wp_chatbot_bot_msg_bg_color));
1441
1442 $wp_chatbot_bot_msg_text_color = @$_POST["wp_chatbot_bot_msg_text_color"];
1443 update_option('wp_chatbot_bot_msg_text_color', sanitize_text_field($wp_chatbot_bot_msg_text_color));
1444
1445 $wp_chatbot_user_msg_bg_color = @$_POST["wp_chatbot_user_msg_bg_color"];
1446 update_option('wp_chatbot_user_msg_bg_color', sanitize_text_field($wp_chatbot_user_msg_bg_color));
1447
1448 $wp_chatbot_user_msg_text_color = @$_POST["wp_chatbot_user_msg_text_color"];
1449 update_option('wp_chatbot_user_msg_text_color', sanitize_text_field($wp_chatbot_user_msg_text_color));
1450
1451
1452 $wp_chatbot_buttons_bg_color = @$_POST["wp_chatbot_buttons_bg_color"];
1453 update_option('wp_chatbot_buttons_bg_color', sanitize_text_field($wp_chatbot_buttons_bg_color));
1454
1455 $wp_chatbot_buttons_text_color = @$_POST["wp_chatbot_buttons_text_color"];
1456 update_option('wp_chatbot_buttons_text_color', sanitize_text_field($wp_chatbot_buttons_text_color));
1457
1458 $wp_chatbot_buttons_bg_color_hover = @$_POST["wp_chatbot_buttons_bg_color_hover"];
1459 update_option('wp_chatbot_buttons_bg_color_hover', sanitize_text_field($wp_chatbot_buttons_bg_color_hover));
1460
1461 $wp_chatbot_buttons_text_color_hover = @$_POST["wp_chatbot_buttons_text_color_hover"];
1462 update_option('wp_chatbot_buttons_text_color_hover', sanitize_text_field($wp_chatbot_buttons_text_color_hover));
1463
1464
1465 $wp_chatbot_theme_secondary_color = @$_POST["wp_chatbot_theme_secondary_color"];
1466 update_option('wp_chatbot_theme_secondary_color', sanitize_text_field($wp_chatbot_theme_secondary_color));
1467 $wp_chatbot_header_background_color = @$_POST["wp_chatbot_header_background_color"];
1468 update_option('wp_chatbot_header_background_color', sanitize_text_field($wp_chatbot_header_background_color));
1469
1470 $wp_chatbot_theme_primary_color = @$_POST["wp_chatbot_theme_primary_color"];
1471 update_option('wp_chatbot_theme_primary_color', sanitize_text_field($wp_chatbot_theme_primary_color));
1472
1473
1474 $wp_chatbot_font_size = @$_POST["wp_chatbot_font_size"];
1475 update_option('wp_chatbot_font_size', sanitize_text_field($wp_chatbot_font_size));
1476 $wp_chat_bot_font_family = @$_POST["wp_chat_bot_font_family"];
1477 update_option('wp_chat_bot_font_family', sanitize_text_field($wp_chat_bot_font_family));
1478 $wp_chat_user_font_family = @$_POST["wp_chat_user_font_family"];
1479 update_option('wp_chat_user_font_family', sanitize_text_field($wp_chat_user_font_family));
1480 $wp_chatbot_user_font = @$_POST['wp_chatbot_user_font'];
1481 update_option('wp_chatbot_user_font', sanitize_text_field($wp_chatbot_user_font));
1482 $wp_chatbot_bot_font = @$_POST['wp_chatbot_bot_font'];
1483 update_option('wp_chatbot_bot_font', sanitize_text_field($wp_chatbot_bot_font));
1484
1485 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
1486
1487 wp_enqueue_script( 'wp_chatbot_bot-front-js', plugins_url(basename(plugin_dir_path(__FILE__))) . '/js/sweetalrt.js', array('jquery'), '', true);
1488 $script = "
1489 console.log('sdaas');
1490 function callsweetalert(){
1491 Swal.fire({
1492 title: 'Your settings are saved.',
1493 html: '<p style=font-size:14px>Please clear your browser <b>cache</b> and <b>cookies</b> both and reload the front end before testing. Alternatively, you can launch a new browser window in <b>Incognito</b>/Private mode (Ctrl+Shift+N in chrome) to test.</p>',
1494 width: 450,
1495 icon: 'success',
1496 confirmButtonText: 'Got it',
1497 confirmButtonWidth: 100,
1498 confirmButtonClass: 'btn btn-lg'
1499 }).then((result) => {
1500 location.reload();
1501 })
1502 }
1503 callsweetalert();
1504 ";
1505
1506 wp_add_inline_script( 'wp_chatbot_bot-front-js', $script );
1507 }
1508 }
1509 }
1510 /**
1511 * Display Notifications on specific criteria.
1512 *
1513 * @since 2.14
1514 */
1515 public static function wpcommerce_inactive_notice_for_wp_chatbot()
1516 {
1517 if (current_user_can('activate_plugins')) :
1518 if (!class_exists('wpCommerce')) :
1519 deactivate_plugins(plugin_basename(__FILE__));
1520 ?>
1521 <div id="message" class="error">
1522 <p>
1523 <?php
1524 printf(
1525 __('%s WPBot for wpCommerce REQUIRES wpCommerce%s %swpCommerce%s must be active for WPBot to work. Please install & activate wpCommerce.', 'wpchatbot'),
1526 '<strong>',
1527 '</strong><br>',
1528 '<a href="http://wordpress.org/extend/plugins/wpcommerce/" target="_blank" >',
1529 '</a>'
1530 );
1531 ?>
1532 </p>
1533 </div>
1534 <?php
1535 elseif (version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) :
1536 ?>
1537 <div id="message" class="error">
1538 <!--<p style="float: right; color: #9A9A9A; font-size: 13px; font-style: italic;">For more information <a href="http://cxthemes.com/plugins/update-notice.html" target="_blank" style="color: inheret;">click here</a></p>-->
1539 <p>
1540 <?php
1541 printf(
1542 __('%WPBot for wpCommerce is inactive%s This version of WpBot requires wpCommerce %s or newer. For more information about our wpCommerce version support %sclick here%s.', 'wpchatbot'),
1543 '<strong>',
1544 '</strong><br>',
1545 QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION
1546 );
1547 ?>
1548 </p>
1549 <div style="clear:both;"></div>
1550 </div>
1551 <?php
1552 endif;
1553 endif;
1554 }
1555 /**
1556 * Admin notice for table reindex
1557 */
1558 public function admin_notice_reindex() { ?>
1559 <div class="updated notice is-dismissible">
1560 <p><?php printf( esc_html__( 'WPBot Pro : To Enable Title, Content, Excerpt, Categories, Tag and SKU Search Re-Index Products is required. %s', 'wpchatbot' ),'<a class="button button-secondary" href="'.esc_url( admin_url( 'admin.php?page=wpbot') ).'">'.esc_html__( 'Re-Index Products', 'wp_chatbot' ).'</a>'); ?></p>
1561 </div>
1562 <?php }
1563 }
1564 /**
1565 * Instantiate plugin.
1566 *
1567 */
1568 if (!function_exists('qcld_wb_chatboot_plugin_init')) {
1569 function qcld_wb_chatboot_plugin_init()
1570 {
1571 global $qcld_wb_chatbot;
1572 $qcld_wb_chatbot = qcld_wb_Chatbot::qcld_wb_chatbot_get_instance();
1573 }
1574 }
1575 add_action('plugins_loaded', 'qcld_wb_chatboot_plugin_init');
1576 /*
1577 * Initial Options will be insert as defualt data
1578 */
1579 register_activation_hook(__FILE__, 'qcld_wb_chatboot_defualt_options');
1580 function qcld_wb_chatboot_defualt_options(){
1581
1582 global $wpdb;
1583 $collate = '';
1584
1585 if ( $wpdb->has_cap( 'collation' ) ) {
1586
1587 if ( ! empty( $wpdb->charset ) ) {
1588
1589 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
1590 }
1591 if ( ! empty( $wpdb->collate ) ) {
1592
1593 $collate .= " COLLATE $wpdb->collate";
1594
1595 }
1596 }
1597
1598 //Bot User Table
1599 $table1 = $wpdb->prefix.'wpbot_sessions';
1600 $sql_sliders_Table1 = "
1601 CREATE TABLE IF NOT EXISTS `$table1` (
1602 `id` int(11) NOT NULL AUTO_INCREMENT,
1603 `session` int(11) NOT NULL,
1604 PRIMARY KEY (`id`)
1605 ) $collate AUTO_INCREMENT=1 ";
1606
1607 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1608 dbDelta( $sql_sliders_Table1 );
1609
1610 //Bot Response Table
1611 $table1 = $wpdb->prefix.'wpbot_response';
1612 $sql_sliders_Table1 = "
1613 CREATE TABLE IF NOT EXISTS `$table1` (
1614 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
1615 `query` TEXT NOT NULL,
1616 `keyword` TEXT NOT NULL,
1617 `response` TEXT NOT NULL,
1618 `category` varchar(256) NOT NULL,
1619 `intent` varchar(256) NOT NULL,
1620 `custom` varchar(256) NOT NULL,
1621 `lang` varchar(25) NULL,
1622 FULLTEXT(`query`, `keyword`, `response`)
1623 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
1624
1625 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1626 dbDelta( $sql_sliders_Table1 );
1627
1628 $sqlqry = $wpdb->get_results("select * from $table1");
1629 if(empty($sqlqry)){
1630
1631 $query = 'What Can WPBot do for you?';
1632 $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!';
1633
1634 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
1635 $format = array('%s','%s', '%s', '%s');
1636 $wpdb->insert($table1,$data,$format);
1637 }
1638
1639 $url = get_site_url();
1640 $url = parse_url($url);
1641 $domain = $url['host'];
1642 //$admin_email = "admin@" . $domain;
1643 $admin_email = get_option('admin_email');
1644
1645 if(!get_option('wp_chatbot_position_x')) {
1646 update_option('wp_chatbot_position_x', 50);
1647 }
1648 if(!get_option('wp_chatbot_position_y')) {
1649 update_option('wp_chatbot_position_y', 50);
1650 }
1651 if(!get_option('disable_wp_chatbot')) {
1652 update_option('disable_wp_chatbot', '');
1653 }
1654 if(!get_option('disable_wp_chatbot_icon_animation')) {
1655 update_option('disable_wp_chatbot_icon_animation', '');
1656 }
1657 if(!get_option('disable_wp_chatbot_on_mobile')) {
1658 update_option('disable_wp_chatbot_on_mobile', '');
1659 }
1660 if(!get_option('qlcd_wp_chatbot_admin_email')) {
1661 update_option('qlcd_wp_chatbot_admin_email', get_option('admin_email'));
1662 }
1663 if(!get_option('disable_wp_chatbot_product_search')) {
1664 update_option('disable_wp_chatbot_product_search', '');
1665 }
1666 if(!get_option('disable_wp_chatbot_catalog')) {
1667 update_option('disable_wp_chatbot_catalog', '');
1668 }
1669 if(!get_option('disable_wp_chatbot_order_status')) {
1670 update_option('disable_wp_chatbot_order_status', '');
1671 }
1672 if(!get_option('enable_wp_chatbot_rtl')) {
1673 update_option('enable_wp_chatbot_rtl', '');
1674 }
1675 if(!get_option('show_menu_after_greetings')) {
1676 update_option('show_menu_after_greetings', '');
1677 }
1678 if(!get_option('enable_chat_session')) {
1679 update_option('enable_chat_session', '');
1680 }
1681
1682 if(!get_option('enable_wp_chatbot_mobile_full_screen')) {
1683 update_option('enable_wp_chatbot_mobile_full_screen', 1);
1684 }
1685 if(!get_option('wpbot_preloading_time')) {
1686 update_option('wpbot_preloading_time', '0.5');
1687 }
1688
1689 if(!get_option('disable_wp_chatbot_notification')) {
1690 update_option('disable_wp_chatbot_notification', '1');
1691 }
1692 if(!get_option('disable_wp_chatbot_cart_item_number')) {
1693 update_option('disable_wp_chatbot_cart_item_number', '');
1694 }
1695 if(!get_option('disable_wp_chatbot_featured_product')) {
1696 update_option('disable_wp_chatbot_featured_product', '');
1697 }
1698 if(!get_option('disable_wp_chatbot_sale_product')) {
1699 update_option('disable_wp_chatbot_sale_product', '');
1700 }
1701 if(!get_option('wp_chatbot_open_product_detail')) {
1702 update_option('wp_chatbot_open_product_detail', '');
1703 }
1704 if(!get_option('qlcd_wp_chatbot_product_orderby')) {
1705 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field('title'));
1706 }
1707 if(!get_option('qlcd_wp_chatbot_product_order')) {
1708 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field('ASC'));
1709 }
1710 if(!get_option('qlcd_wp_chatbot_ppp')) {
1711 update_option('qlcd_wp_chatbot_ppp', intval(6));
1712 }
1713 if(!get_option('wp_chatbot_exclude_stock_out_product')) {
1714 update_option('wp_chatbot_exclude_stock_out_product', '');
1715 }
1716 if(!get_option('wp_chatbot_show_sub_category')) {
1717 update_option('wp_chatbot_show_sub_category', '');
1718 }
1719 if(!get_option('wp_chatbot_vertical_custom')){
1720 update_option('wp_chatbot_vertical_custom', 'Go To');
1721 }
1722 if(!get_option('wp_chatbot_show_home_page')) {
1723 update_option('wp_chatbot_show_home_page', 'on');
1724 }
1725 if(!get_option('qc_wpbot_menu_order')) {
1726 update_option('qc_wpbot_menu_order', '');
1727 }
1728
1729 if(!get_option('wp_chatbot_show_posts')) {
1730 update_option('wp_chatbot_show_posts', 'on');
1731 }
1732 if(!get_option('wp_chatbot_show_pages')){
1733 update_option('wp_chatbot_show_pages', 'on');
1734 }
1735 if(!get_option('wp_chatbot_show_pages_list')) {
1736 update_option('wp_chatbot_show_pages_list', maybe_serialize(array()));
1737 }
1738 if(!get_option('wp_chatbot_exclude_post_list')) {
1739 update_option('wp_chatbot_exclude_post_list', maybe_serialize(array()));
1740 }
1741
1742 if(!get_option('wp_chatbot_show_wpcommerce')) {
1743 update_option('wp_chatbot_show_wpcommerce', 'on');
1744 }
1745 if(!get_option('qlcd_wp_chatbot_stop_words_name')) {
1746 update_option('qlcd_wp_chatbot_stop_words_name', 'english');
1747 }
1748 if(!get_option('qlcd_wp_chatbot_stop_words')) {
1749 update_option('qlcd_wp_chatbot_stop_words', "a,able,about,above,abst,accordance,according,accordingly,across,act,actually,added,adj,affected,affecting,affects,after,afterwards,again,against,ah,all,almost,alone,along,already,also,although,always,am,among,amongst,an,and,announce,another,any,anybody,anyhow,anymore,anyone,anything,anyway,anyways,anywhere,apparently,approximately,are,aren,arent,arise,around,as,aside,ask,asking,at,auth,available,away,awfully,b,back,be,became,because,become,becomes,becoming,been,before,beforehand,begin,beginning,beginnings,begins,behind,being,believe,below,beside,besides,between,beyond,biol,both,brief,briefly,but,by,c,ca,came,can,cannot,can't,cause,causes,certain,certainly,co,com,come,comes,contain,containing,contains,could,couldnt,d,date,did,didn't,different,do,does,doesn't,doing,done,don't,down,downwards,due,during,e,each,ed,edu,effect,eg,eight,eighty,either,else,elsewhere,end,ending,enough,especially,et,et-al,etc,even,ever,every,everybody,everyone,everything,everywhere,ex,except,f,far,few,ff,fifth,first,five,fix,followed,following,follows,for,former,formerly,forth,found,four,from,further,furthermore,g,gave,get,gets,getting,give,given,gives,giving,go,goes,gone,got,gotten,h,had,happens,hardly,has,hasn't,have,haven't,having,he,hed,hence,her,here,hereafter,hereby,herein,heres,hereupon,hers,herself,hes,hi,hid,him,himself,his,hither,home,how,howbeit,however,hundred,i,id,ie,if,i'll,im,immediate,immediately,importance,important,in,inc,indeed,index,information,instead,into,invention,inward,is,isn't,it,itd,it'll,its,itself,i've,j,just,k,keep,keeps,kept,kg,km,know,known,knows,l,largely,last,lately,later,latter,latterly,least,less,lest,let,lets,like,liked,likely,line,little,'ll,look,looking,looks,ltd,m,made,mainly,make,makes,many,may,maybe,me,mean,means,meantime,meanwhile,merely,mg,might,million,miss,ml,more,moreover,most,mostly,mr,mrs,much,mug,must,my,myself,n,na,name,namely,nay,nd,near,nearly,necessarily,necessary,need,needs,neither,never,nevertheless,new,next,nine,ninety,no,nobody,non,none,nonetheless,noone,nor,normally,nos,not,noted,nothing,now,nowhere,o,obtain,obtained,obviously,of,off,often,oh,ok,okay,old,omitted,on,once,one,ones,only,onto,or,ord,other,others,otherwise,ought,our,ours,ourselves,out,outside,over,overall,owing,own,p,page,pages,part,particular,particularly,past,per,perhaps,placed,please,plus,poorly,possible,possibly,potentially,pp,predominantly,present,previously,primarily,probably,promptly,proud,provides,put,q,que,quickly,quite,qv,r,ran,rather,rd,re,readily,really,recent,recently,ref,refs,regarding,regardless,regards,related,relatively,research,respectively,resulted,resulting,results,right,run,s,said,same,saw,say,saying,says,sec,section,see,seeing,seem,seemed,seeming,seems,seen,self,selves,sent,seven,several,shall,she,shed,she'll,shes,should,shouldn't,show,showed,shown,showns,shows,significant,significantly,similar,similarly,since,six,slightly,so,some,somebody,somehow,someone,somethan,something,sometime,sometimes,somewhat,somewhere,soon,sorry,specifically,specified,specify,specifying,still,stop,strongly,sub,substantially,successfully,such,sufficiently,suggest,sup,sure,t,take,taken,taking,tell,tends,th,than,thank,thanks,thanx,that,that'll,thats,that've,the,their,theirs,them,themselves,then,thence,there,thereafter,thereby,thered,therefore,therein,there'll,thereof,therere,theres,thereto,thereupon,there've,these,they,theyd,they'll,theyre,they've,think,this,those,thou,though,thoughh,thousand,throug,through,throughout,thru,thus,til,tip,to,together,too,took,toward,towards,tried,tries,truly,try,trying,ts,twice,two,u,un,under,unfortunately,unless,unlike,unlikely,until,unto,up,upon,ups,us,use,used,useful,usefully,usefulness,uses,using,usually,v,value,various,'ve,very,via,viz,vol,vols,vs,w,want,wants,was,wasnt,way,we,wed,welcome,we'll,went,were,werent,we've,what,whatever,what'll,whats,when,whence,whenever,where,whereafter,whereas,whereby,wherein,wheres,whereupon,wherever,whether,which,while,whim,whither,who,whod,whoever,whole,who'll,whom,whomever,whos,whose,why,widely,willing,wish,with,within,without,wont,words,world,would,wouldnt,www,x,y,yes,yet,you,youd,you'll,your,youre,yours,yourself,yourselves,you've,z,zero");
1750 }
1751 if(!get_option('qlcd_wp_chatbot_order_user')) {
1752 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field('login'));
1753 }
1754 if(!get_option('wp_chatbot_custom_agent_path')) {
1755 update_option('wp_chatbot_custom_agent_path', '');
1756 }
1757 if(!get_option('wp_chatbot_custom_icon_path')) {
1758 update_option('wp_chatbot_custom_icon_path', '');
1759 }
1760
1761 if(!get_option('wp_chatbot_icon')) {
1762 update_option('wp_chatbot_icon', sanitize_text_field('icon-13.png'));
1763 }
1764 if(!get_option('wp_chatbot_floatingiconbg_color')) {
1765 update_option('wp_chatbot_floatingiconbg_color', '#fff');
1766 }
1767 if(!get_option('wp_chatbot_agent_image')){
1768 update_option('wp_chatbot_agent_image',sanitize_text_field('agent-0.png'));
1769 }
1770 if(!get_option('qcld_wb_chatbot_theme')) {
1771 update_option('qcld_wb_chatbot_theme', sanitize_text_field('template-00'));
1772 }
1773 if(!get_option('qcld_wb_chatbot_change_bg')) {
1774 update_option('qcld_wb_chatbot_change_bg', '');
1775 }
1776 if(!get_option('wp_chatbot_custom_css')) {
1777 update_option('wp_chatbot_custom_css', '');
1778 }
1779 if(!get_option('qlcd_wp_chatbot_host')) {
1780 update_option('qlcd_wp_chatbot_host', sanitize_text_field('Our Website'));
1781 }
1782 if(!get_option('qlcd_wp_chatbot_agent')) {
1783 update_option('qlcd_wp_chatbot_agent', sanitize_text_field('Carrie'));
1784 }
1785 if(!get_option('qlcd_wp_chatbot_host')) {
1786 update_option('qlcd_wp_chatbot_host', sanitize_text_field('Our Website'));
1787 }
1788 if(!get_option('qlcd_wp_chatbot_shopper_demo_name')) {
1789 update_option('qlcd_wp_chatbot_shopper_demo_name', sanitize_text_field('Amigo'));
1790 }
1791 if(!get_option('qlcd_wp_chatbot_yes')) {
1792 update_option('qlcd_wp_chatbot_yes', sanitize_text_field('YES'));
1793 }
1794 if(!get_option('qlcd_wp_chatbot_no')) {
1795 update_option('qlcd_wp_chatbot_no', sanitize_text_field('NO'));
1796 }
1797 if(!get_option('qlcd_wp_chatbot_or')) {
1798 update_option('qlcd_wp_chatbot_or', sanitize_text_field('OR'));
1799 }
1800 if(!get_option('qlcd_wp_chatbot_sorry')) {
1801 update_option('qlcd_wp_chatbot_sorry', sanitize_text_field('Sorry'));
1802 }
1803
1804 if(!get_option('qlcd_wp_chatbot_dialogflow_project_id')) {
1805 update_option('qlcd_wp_chatbot_dialogflow_project_id', '');
1806 }
1807 if(!get_option('wp_chatbot_df_api')) {
1808 update_option('wp_chatbot_df_api', 'v1');
1809 }
1810
1811
1812 if(!get_option('qlcd_wp_chatbot_dialogflow_project_key')) {
1813 update_option('qlcd_wp_chatbot_dialogflow_project_key', '');
1814 }
1815
1816 if(!get_option('qlcd_wp_chatbot_agent_join')) {
1817 update_option('qlcd_wp_chatbot_agent_join', maybe_serialize(array('has joined the conversation')));
1818 }
1819 if(!get_option('qlcd_wp_chatbot_welcome')) {
1820 update_option('qlcd_wp_chatbot_welcome', maybe_serialize(array('Welcome to', 'Glad to have you at')));
1821 }
1822 if(!get_option('qlcd_wp_chatbot_back_to_start')) {
1823 update_option('qlcd_wp_chatbot_back_to_start', maybe_serialize(array('Back to Start')));
1824 }
1825 if(!get_option('qlcd_wp_chatbot_hi_there')) {
1826 update_option('qlcd_wp_chatbot_hi_there', maybe_serialize(array('Hi There!')));
1827 }
1828 if(!get_option('qlcd_wp_chatbot_hello')) {
1829 update_option('qlcd_wp_chatbot_hello', maybe_serialize(array('Hi There!')));
1830 }
1831 if(!get_option('qlcd_wp_chatbot_welcome_back')) {
1832 update_option('qlcd_wp_chatbot_welcome_back', maybe_serialize(array('Welcome back', 'Good to see your again')));
1833 }
1834 if(!get_option('qlcd_wp_chatbot_asking_name')) {
1835 update_option('qlcd_wp_chatbot_asking_name', maybe_serialize(array('May I know your name?', 'What should I call you?')));
1836 }
1837 if(!get_option('qlcd_wp_chatbot_name_greeting')) {
1838 update_option('qlcd_wp_chatbot_name_greeting', maybe_serialize(array('Nice to meet you')));
1839 }
1840 if(!get_option('qlcd_wp_chatbot_i_am')) {
1841 update_option('qlcd_wp_chatbot_i_am', maybe_serialize(array('I am', 'This is')));
1842 }
1843 if(!get_option('qlcd_wp_chatbot_is_typing')) {
1844 update_option('qlcd_wp_chatbot_is_typing', maybe_serialize(array('is typing...')));
1845 }
1846 if(!get_option('qlcd_wp_chatbot_send_a_msg')) {
1847 update_option('qlcd_wp_chatbot_send_a_msg', maybe_serialize(array('Send a message.')));
1848 }
1849 if(!get_option('qlcd_wp_chatbot_choose_option')) {
1850 update_option('qlcd_wp_chatbot_choose_option', maybe_serialize(array('Choose an option.')));
1851 }
1852 if(!get_option('qlcd_wp_chatbot_viewed_products')) {
1853 update_option('qlcd_wp_chatbot_viewed_products', maybe_serialize(array('Recently viewed products')));
1854 }
1855 if(!get_option('qlcd_wp_chatbot_add_to_cart')) {
1856 update_option('qlcd_wp_chatbot_add_to_cart', maybe_serialize(array('Add to Cart')));
1857 }
1858 if(!get_option('qlcd_wp_chatbot_cart_link')) {
1859 update_option('qlcd_wp_chatbot_cart_link', maybe_serialize(array('Cart')));
1860 }
1861 if(!get_option('qlcd_wp_chatbot_checkout_link')) {
1862 update_option('qlcd_wp_chatbot_checkout_link', maybe_serialize(array('Checkout')));
1863 }
1864 if(!get_option('qlcd_wp_chatbot_featured_product_welcome')) {
1865 update_option('qlcd_wp_chatbot_featured_product_welcome', maybe_serialize(array('I have found following featured products')));
1866 }
1867 if(!get_option('qlcd_wp_chatbot_viewed_product_welcome')) {
1868 update_option('qlcd_wp_chatbot_viewed_product_welcome', maybe_serialize(array('I have found following recently viewed products')));
1869 }
1870 if(!get_option('qlcd_wp_chatbot_latest_product_welcome')) {
1871 update_option('qlcd_wp_chatbot_latest_product_welcome', maybe_serialize(array('I have found following latest products')));
1872 }
1873 if(!get_option('qlcd_wp_chatbot_cart_welcome')) {
1874 update_option('qlcd_wp_chatbot_cart_welcome', maybe_serialize(array('I have found following items from Shopping Cart.')));
1875 }
1876 if(!get_option('qlcd_wp_chatbot_cart_title')) {
1877 update_option('qlcd_wp_chatbot_cart_title', maybe_serialize(array('Title')));
1878 }
1879 if(!get_option('qlcd_wp_chatbot_cart_quantity')) {
1880 update_option('qlcd_wp_chatbot_cart_quantity', maybe_serialize(array('Qty')));
1881 }
1882 if(!get_option('qlcd_wp_chatbot_cart_price')) {
1883 update_option('qlcd_wp_chatbot_cart_price', maybe_serialize(array('Price')));
1884 }
1885 if(!get_option('qlcd_wp_chatbot_no_cart_items')) {
1886 update_option('qlcd_wp_chatbot_no_cart_items', maybe_serialize(array('No items in the cart')));
1887 }
1888 if(!get_option('qlcd_wp_chatbot_cart_updating')) {
1889 update_option('qlcd_wp_chatbot_cart_updating', maybe_serialize(array('Updating cart items ...')));
1890 }
1891 if(!get_option('qlcd_wp_chatbot_cart_removing')) {
1892 update_option('qlcd_wp_chatbot_cart_removing', maybe_serialize(array('Removing cart items ...')));
1893 }
1894 if(!get_option('qlcd_wp_chatbot_wildcard_msg')) {
1895 update_option('qlcd_wp_chatbot_wildcard_msg', maybe_serialize(array('I am here to find what you need. What are you looking for?')));
1896 }
1897 if(!get_option('qlcd_wp_chatbot_empty_filter_msg')) {
1898 update_option('qlcd_wp_chatbot_empty_filter_msg', maybe_serialize(array('Sorry, I did not understand you.')));
1899 }
1900 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
1901 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
1902 }
1903 if(!get_option('qlcd_wp_chatbot_sys_key_help')) {
1904 update_option('qlcd_wp_chatbot_sys_key_help', 'start');
1905 }
1906 if(!get_option('qlcd_wp_chatbot_sys_key_product')) {
1907 update_option('qlcd_wp_chatbot_sys_key_product', 'product');
1908 }
1909 if(!get_option('qlcd_wp_chatbot_sys_key_catalog')) {
1910 update_option('qlcd_wp_chatbot_sys_key_catalog', 'catalog');
1911 }
1912 if(!get_option('qlcd_wp_chatbot_sys_key_order')) {
1913 update_option('qlcd_wp_chatbot_sys_key_order', 'order');
1914 }
1915 if(!get_option('qlcd_wp_chatbot_sys_key_support')) {
1916 update_option('qlcd_wp_chatbot_sys_key_support', 'faq');
1917 }
1918 if(!get_option('qlcd_wp_chatbot_sys_key_reset')) {
1919 update_option('qlcd_wp_chatbot_sys_key_reset', 'reset');
1920 }
1921 if(!get_option('qlcd_wp_chatbot_sys_key_email')) {
1922 update_option('qlcd_wp_chatbot_sys_key_email', 'email');
1923 }
1924 if(!get_option('qlcd_wp_chatbot_help_welcome')) {
1925 update_option('qlcd_wp_chatbot_help_welcome', maybe_serialize(array('Welcome to Help Section.')));
1926 }
1927 if(!get_option('qlcd_wp_chatbot_help_msg')) {
1928 update_option('qlcd_wp_chatbot_help_msg', maybe_serialize(array('<h3>Type and Hit Enter</h3> 1. <b>start</b> Get back to the main menu. <br> 2. <b>faq</b> for FAQ. <br> 3. <b>eMail </b> to Send eMail <br> 4. <b>reset</b> To clear chat history and start from the beginning.')));
1929 }
1930 if(!get_option('qlcd_wp_chatbot_reset')) {
1931 update_option('qlcd_wp_chatbot_reset', maybe_serialize(array('Do you want to clear our chat history and start over?')));
1932 }
1933 if(!get_option('qlcd_wp_chatbot_wildcard_product')) {
1934 update_option('qlcd_wp_chatbot_wildcard_product', maybe_serialize(array('Product Search')));
1935 }
1936 if(!get_option('qlcd_wp_chatbot_wildcard_catalog')) {
1937 update_option('qlcd_wp_chatbot_wildcard_catalog', maybe_serialize(array('Catalog')));
1938 }
1939 if(!get_option('qlcd_wp_chatbot_featured_products')) {
1940 update_option('qlcd_wp_chatbot_featured_products', maybe_serialize(array('Featured Products')));
1941 }
1942 if(!get_option('qlcd_wp_chatbot_sale_products')) {
1943 update_option('qlcd_wp_chatbot_sale_products', maybe_serialize(array('Products on Sale')));
1944 }
1945 if(!get_option('qlcd_wp_chatbot_wildcard_support')) {
1946 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
1947 }
1948 if(!get_option('qlcd_wp_chatbot_messenger_label')) {
1949 update_option('qlcd_wp_chatbot_messenger_label', maybe_serialize(array('Chat with Us on Facebook Messenger')));
1950 }
1951 if(!get_option('qlcd_wp_chatbot_product_success')) {
1952 update_option('qlcd_wp_chatbot_product_success', maybe_serialize(array('Great! We have these products for', 'Found these products for')));
1953 }
1954 if(!get_option('qlcd_wp_chatbot_product_fail')) {
1955 update_option('qlcd_wp_chatbot_product_fail', maybe_serialize(array('Oops! Nothing matches your criteria', 'Sorry, I found nothing')));
1956 }
1957 if(!get_option('qlcd_wp_chatbot_product_asking')) {
1958 update_option('qlcd_wp_chatbot_product_asking', maybe_serialize(array('What are you shopping for?')));
1959 }
1960 if(!get_option('qlcd_wp_chatbot_product_suggest')) {
1961 update_option('qlcd_wp_chatbot_product_suggest', maybe_serialize(array('You can browse our extensive catalog. Just pick a category from below:')));
1962 }
1963 if(!get_option('qlcd_wp_chatbot_product_infinite')) {
1964 update_option('qlcd_wp_chatbot_product_infinite', maybe_serialize(array('Too many choices? Let\'s try another search term', 'I may have something else for you. Why not search again?')));
1965 }
1966 if(!get_option('qlcd_wp_chatbot_load_more')) {
1967 update_option('qlcd_wp_chatbot_load_more', maybe_serialize(array('Load More')));
1968 }
1969 if(!get_option('qlcd_wp_chatbot_wildcard_order')) {
1970 update_option('qlcd_wp_chatbot_wildcard_order', maybe_serialize(array('Order Status')));
1971 }
1972 if(!get_option('qlcd_wp_chatbot_order_welcome')) {
1973 update_option('qlcd_wp_chatbot_order_welcome', maybe_serialize(array('Welcome to Order status section!')));
1974 }
1975 if(!get_option('qlcd_wp_chatbot_order_username_asking')) {
1976 update_option('qlcd_wp_chatbot_order_username_asking', maybe_serialize(array('Please type your username?')));
1977 }
1978 if(!get_option('qlcd_wp_chatbot_order_username_password')) {
1979 update_option('qlcd_wp_chatbot_order_username_password', maybe_serialize(array('Please type your password')));
1980 }
1981 if(!get_option('qlcd_wp_chatbot_order_username_not_exist')) {
1982 update_option('qlcd_wp_chatbot_order_username_not_exist', maybe_serialize(array('This username does not exist.')));
1983 }
1984 if(!get_option('qlcd_wp_chatbot_order_username_thanks')) {
1985 update_option('qlcd_wp_chatbot_order_username_thanks', maybe_serialize(array('Thank you for the username')));
1986 }
1987 if(!get_option('qlcd_wp_chatbot_order_password_incorrect')) {
1988 update_option('qlcd_wp_chatbot_order_password_incorrect', maybe_serialize(array('Sorry Password is not correct!')));
1989 }
1990 if(!get_option('qlcd_wp_chatbot_asking_email')) {
1991 update_option('qlcd_wp_chatbot_asking_email', maybe_serialize(array('Please provide your email address')));
1992 }
1993 if(!get_option('qlcd_wp_chatbot_order_not_found')) {
1994 update_option('qlcd_wp_chatbot_order_not_found', maybe_serialize(array('I did not find any order by you')));
1995 }
1996 if(!get_option('qlcd_wp_chatbot_order_found')) {
1997 update_option('qlcd_wp_chatbot_order_found', maybe_serialize(array('I have found the following orders')));
1998 }
1999 if(!get_option('qlcd_wp_chatbot_order_email_support')) {
2000 update_option('qlcd_wp_chatbot_order_email_support', maybe_serialize(array('Email our support center about your order.')));
2001 }
2002 if(!get_option('qlcd_wp_chatbot_support_welcome')) {
2003 update_option('qlcd_wp_chatbot_support_welcome', maybe_serialize(array('Welcome to FAQ Section')));
2004 }
2005 if(!get_option('qlcd_wp_chatbot_support_email')) {
2006 update_option('qlcd_wp_chatbot_support_email', 'Send us Email.');
2007 }
2008 if(!get_option('qlcd_wp_chatbot_asking_msg')) {
2009 update_option('qlcd_wp_chatbot_asking_msg', maybe_serialize(array('Thank you for email address. Please write your message now.')));
2010 }
2011 if(!get_option('qlcd_wp_chatbot_no_result')) {
2012 update_option('qlcd_wp_chatbot_no_result', maybe_serialize(array('Sorry, No result found!')));
2013 }
2014 if(!get_option('qlcd_wp_chatbot_invalid_email')) {
2015 update_option('qlcd_wp_chatbot_invalid_email', maybe_serialize(array('Sorry, Email address is not valid! Please provide a valid email.')));
2016 }
2017 if(!get_option('qlcd_wp_chatbot_support_phone')) {
2018 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
2019 }
2020 if(!get_option('qlcd_wp_chatbot_asking_phone')) {
2021 update_option('qlcd_wp_chatbot_asking_phone', maybe_serialize(array('Please provide your Phone number')));
2022 }
2023 if(!get_option('qlcd_wp_chatbot_thank_for_phone')) {
2024 update_option('qlcd_wp_chatbot_thank_for_phone', maybe_serialize(array('Thank you for Phone number')));
2025 }
2026 if(!get_option('qlcd_wp_chatbot_support_option_again')) {
2027 update_option('qlcd_wp_chatbot_support_option_again', maybe_serialize(array('You may choose option from below.')));
2028 }
2029 if(!get_option('qlcd_wp_chatbot_admin_email')) {
2030 update_option('qlcd_wp_chatbot_admin_email', $admin_email);
2031 }
2032 if(!get_option('qlcd_wp_chatbot_email_sub')) {
2033 update_option('qlcd_wp_chatbot_email_sub', sanitize_text_field('WPBot Support Mail'));
2034 }
2035 if(!get_option('qlcd_wp_site_search')) {
2036 update_option('qlcd_wp_site_search', sanitize_text_field('Site Search'));
2037 }
2038 if(!get_option('qlcd_wp_chatbot_email_sent')) {
2039 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field('Your email was sent successfully.Thanks!'));
2040 }
2041 if(!get_option('qlcd_wp_chatbot_email_fail')) {
2042 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field('Sorry! I could not send your mail! Please contact the webmaster.'));
2043 }
2044 if(!get_option('qlcd_wp_chatbot_notification_interval')) {
2045 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field(5));
2046 }
2047 if(!get_option('qlcd_wp_chatbot_notifications')) {
2048 update_option('qlcd_wp_chatbot_notifications', maybe_serialize(array('Welcome to WPBot')));
2049 }
2050 if(!get_option('support_query')) {
2051 update_option('support_query', maybe_serialize(array('What is WPBot?')));
2052 }
2053 if(!get_option('support_ans')) {
2054 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.')));
2055 }
2056 if(!get_option('qlcd_wp_chatbot_search_option')) {
2057 update_option('qlcd_wp_chatbot_search_option', 'standard');
2058 }
2059 if(!get_option('wp_chatbot_index_count')) {
2060 update_option('wp_chatbot_index_count', 0);
2061 }
2062 if(!get_option('wp_chatbot_app_pages')) {
2063 update_option('wp_chatbot_app_pages', 0);
2064 }
2065 //messenger options.
2066 if(!get_option('enable_wp_chatbot_messenger')) {
2067 update_option('enable_wp_chatbot_messenger', '');
2068 }
2069 if(!get_option('enable_wp_chatbot_messenger_floating_icon')) {
2070 update_option('enable_wp_chatbot_messenger_floating_icon', '');
2071 }
2072 if(!get_option('qlcd_wp_chatbot_fb_app_id')) {
2073 update_option('qlcd_wp_chatbot_fb_app_id', '');
2074 }
2075 if(!get_option('qlcd_wp_chatbot_fb_page_id')) {
2076 update_option('qlcd_wp_chatbot_fb_page_id', '');
2077 }
2078 if(!get_option('qlcd_wp_chatbot_fb_color')) {
2079 update_option('qlcd_wp_chatbot_fb_color', '#0084ff');
2080 }
2081 if(!get_option('qlcd_wp_chatbot_fb_in_msg')) {
2082 update_option('qlcd_wp_chatbot_fb_in_msg', 'Welcome to WPBot!');
2083 }
2084 if(!get_option('qlcd_wp_chatbot_fb_out_msg')) {
2085 update_option('qlcd_wp_chatbot_fb_out_msg', 'You are not logged in');
2086 }
2087 //Skype option
2088 if(!get_option('enable_wp_chatbot_skype_floating_icon')) {
2089 update_option('enable_wp_chatbot_skype_floating_icon', '');
2090 }
2091 if(!get_option('enable_wp_chatbot_skype_id')) {
2092 update_option('enable_wp_chatbot_skype_id', '');
2093 }
2094 //Whats App
2095 if(!get_option('enable_wp_chatbot_whats')) {
2096 update_option('enable_wp_chatbot_whats', '');
2097 }
2098 if(!get_option('qlcd_wp_chatbot_whats_label')) {
2099 update_option('qlcd_wp_chatbot_whats_label', maybe_serialize(array('Chat with Us on WhatsApp')));
2100 }
2101 if(!get_option('enable_wp_chatbot_floating_whats')) {
2102 update_option('enable_wp_chatbot_floating_whats', '');
2103 }
2104 if(!get_option('qlcd_wp_chatbot_whats_num')) {
2105 update_option('qlcd_wp_chatbot_whats_num', '');
2106 }
2107 //Viber
2108 if(!get_option('enable_wp_chatbot_floating_viber')) {
2109 update_option('enable_wp_chatbot_floating_viber', '');
2110 }
2111 if(!get_option('qlcd_wp_chatbot_viber_acc')) {
2112 update_option('qlcd_wp_chatbot_viber_acc', '');
2113 }
2114 //Integration others
2115 if(!get_option('enable_wp_chatbot_floating_phone')) {
2116 update_option('enable_wp_chatbot_floating_phone', '');
2117 }
2118 if(!get_option('qlcd_wp_chatbot_phone')) {
2119 update_option('qlcd_wp_chatbot_phone', '');
2120 }
2121 if(!get_option('enable_wp_chatbot_floating_link')) {
2122 update_option('enable_wp_chatbot_floating_link', '');
2123 }
2124
2125 if(!get_option('qlcd_wp_chatbot_weblink')) {
2126 update_option('qlcd_wp_chatbot_weblink', '');
2127 }
2128 //Re-Tagetting
2129 if(!get_option('qlcd_wp_chatbot_ret_greet')) {
2130 update_option('qlcd_wp_chatbot_ret_greet', 'Hello');
2131 }
2132 if(!get_option('enable_wp_chatbot_exit_intent')) {
2133 update_option('enable_wp_chatbot_exit_intent', '');
2134 }
2135 if(!get_option('wp_chatbot_exit_intent_msg')) {
2136 update_option('wp_chatbot_exit_intent_msg', 'WAIT, WE HAVE A SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
2137 }
2138 if(!get_option('wp_chatbot_exit_intent_once')) {
2139 update_option('wp_chatbot_exit_intent_once', '');
2140 }
2141
2142 if(!get_option('enable_wp_chatbot_scroll_open')) {
2143 update_option('enable_wp_chatbot_scroll_open', '');
2144 }
2145 if(!get_option('wp_chatbot_scroll_open_msg')) {
2146 update_option('wp_chatbot_scroll_open_msg', 'WE HAVE A VERY SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
2147 }
2148 if(!get_option('wp_chatbot_scroll_percent')) {
2149 update_option('wp_chatbot_scroll_percent', 50);
2150 }
2151 if(!get_option('wp_chatbot_scroll_once')) {
2152 update_option('wp_chatbot_scroll_once', '');
2153 }
2154
2155 if(!get_option('enable_wp_chatbot_auto_open')) {
2156 update_option('enable_wp_chatbot_auto_open', '');
2157 }
2158
2159 if(!get_option('enable_wp_chatbot_ret_sound')) {
2160 update_option('enable_wp_chatbot_ret_sound', '');
2161 }
2162 if(!get_option('enable_wp_chatbot_sound_initial')) {
2163 update_option('enable_wp_chatbot_sound_initial', '');
2164 }
2165
2166
2167 if(!get_option('wp_chatbot_auto_open_msg')) {
2168 update_option('wp_chatbot_auto_open_msg', 'A SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
2169 }
2170 if(!get_option('wp_chatbot_auto_open_time')) {
2171 update_option('wp_chatbot_auto_open_time', 10);
2172 }
2173 if(!get_option('wp_chatbot_auto_open_once')) {
2174 update_option('wp_chatbot_auto_open_once', '');
2175 }
2176 if(!get_option('wp_chatbot_inactive_once')) {
2177 update_option('wp_chatbot_inactive_once', '');
2178 }
2179
2180 //To complete checkout.
2181 if(!get_option('enable_wp_chatbot_ret_user_show')) {
2182 update_option('enable_wp_chatbot_ret_user_show', '');
2183 }
2184 if(!get_option('wp_chatbot_auto_open_msg')) {
2185 update_option('wp_chatbot_checkout_msg', 'You have products in shopping cart, please complete your order.');
2186 }
2187 if(!get_option('wp_chatbot_inactive_time')) {
2188 update_option('wp_chatbot_inactive_time', 300);
2189 }
2190 if(!get_option('enable_wp_chatbot_inactive_time_show')) {
2191 update_option('enable_wp_chatbot_inactive_time_show', '');
2192 }
2193
2194 if(!get_option('wp_chatbot_proactive_bg_color')) {
2195 update_option('wp_chatbot_proactive_bg_color', '#ffffff');
2196 }
2197 if(!get_option('disable_wp_chatbot_feedback')) {
2198 update_option('disable_wp_chatbot_feedback','');
2199 }
2200 if(!get_option('disable_wp_chatbot_faq')) {
2201 update_option('disable_wp_chatbot_faq','');
2202 }
2203 if(!get_option('qlcd_wp_chatbot_feedback_label')) {
2204 update_option('qlcd_wp_chatbot_feedback_label',maybe_serialize(array('Send Feedback')));
2205 }
2206
2207 if(!get_option('enable_wp_chatbot_meta_title')) {
2208 update_option('enable_wp_chatbot_meta_title','');
2209 }
2210 if(!get_option('qlcd_wp_chatbot_meta_label')) {
2211 update_option('qlcd_wp_chatbot_meta_label','*New Messages');
2212 }
2213
2214 if(!get_option('disable_wp_chatbot_call_gen')) {
2215 update_option('disable_wp_chatbot_call_gen', '');
2216 }
2217
2218 if(!get_option('disable_wp_chatbot_site_search')) {
2219 update_option('disable_wp_chatbot_site_search', '');
2220 }
2221 if(!get_option('disable_wp_chatbot_call_sup')) {
2222 update_option('disable_wp_chatbot_call_sup', '');
2223 }
2224
2225 if(!get_option('qlcd_wp_chatbot_phone_sent')) {
2226 update_option('qlcd_wp_chatbot_phone_sent', 'Thanks for your phone number. We will call you ASAP!');
2227 }
2228 if(!get_option('qlcd_wp_chatbot_phone_fail')) {
2229 update_option('qlcd_wp_chatbot_phone_fail', 'Sorry! I could not collect your phone number!');
2230 }
2231 if(!get_option('enable_wp_chatbot_opening_hour')) {
2232 update_option('enable_wp_chatbot_opening_hour', '');
2233 }
2234 if(!get_option('enable_wp_chatbot_opening_hour')) {
2235 update_option('wpwbot_hours', array());
2236 }
2237
2238 if(!get_option('enable_wp_chatbot_dailogflow')) {
2239 update_option('enable_wp_chatbot_dailogflow', '');
2240 }
2241 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
2242 update_option('qlcd_wp_chatbot_dialogflow_client_token', '');
2243 }
2244 if(!get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')) {
2245 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', 'Sorry, I did not understand you. You may browse');
2246 }
2247 if(!get_option('qlcd_wp_chatbot_dialogflow_agent_language')) {
2248 update_option('qlcd_wp_chatbot_dialogflow_agent_language', 'en');
2249 }
2250 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
2251 }
2252 /*
2253 * Reset Options will be insert as defualt data
2254 */
2255 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
2256 //add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
2257 //Jarvis all option will be delete during uninstlling.
2258 function qcld_wb_chatboot_delete_all_options(){
2259
2260 if ( ! wp_verify_nonce( $_POST['wpnonce'], 'wp_chatbot' ) ) {
2261 die ( 'No cheating');
2262 }
2263 delete_option('disable_wp_chatbot');
2264 delete_option('disable_wp_chatbot_icon_animation');
2265 delete_option('disable_wp_chatbot_on_mobile');
2266 delete_option('qlcd_wp_chatbot_admin_email');
2267 delete_option('qlcd_wp_chatbot_from_email');
2268
2269 delete_option('disable_wp_chatbot_product_search');
2270 delete_option('disable_wp_chatbot_catalog');
2271 delete_option('disable_wp_chatbot_order_status');
2272 delete_option('disable_wp_chatbot_notification');
2273 delete_option('enable_wp_chatbot_rtl');
2274 delete_option('show_menu_after_greetings');
2275 delete_option('enable_chat_session');
2276
2277 delete_option('enable_wp_chatbot_mobile_full_screen');
2278 delete_option('wpbot_preloading_time');
2279 delete_option('disable_wp_chatbot_cart_item_number');
2280 delete_option('disable_wp_chatbot_featured_product');
2281 delete_option('disable_wp_chatbot_sale_product');
2282 delete_option('wp_chatbot_open_product_detail');
2283 delete_option('qlcd_wp_chatbot_product_orderby');
2284 delete_option('qlcd_wp_chatbot_product_order');
2285 delete_option('qlcd_wp_chatbot_ppp');
2286 delete_option('wp_chatbot_show_parent_category');
2287 delete_option('wp_chatbot_show_sub_category');
2288 delete_option('wp_chatbot_exclude_stock_out_product');
2289 delete_option('wp_chatbot_show_home_page');
2290 delete_option('qc_wpbot_menu_order');
2291
2292 delete_option('wp_chatbot_show_posts');
2293 delete_option('wp_chatbot_show_pages');
2294 delete_option('wp_chatbot_show_pages_list');
2295 delete_option('wp_chatbot_exclude_post_list');
2296 delete_option('wp_chatbot_show_wpcommerce');
2297 delete_option('qlcd_wp_chatbot_stop_words_name');
2298 delete_option('qlcd_wp_chatbot_stop_words');
2299 delete_option('qlcd_wp_chatbot_order_user');
2300 delete_option('wp_chatbot_icon');
2301 delete_option('wp_chatbot_floatingiconbg_color');
2302 delete_option('wp_chatbot_agent_image');
2303 delete_option('qcld_wb_chatbot_theme');
2304 delete_option('qcld_wb_chatbot_change_bg');
2305 delete_option('wp_chatbot_custom_css');
2306 delete_option('qlcd_wp_chatbot_host');
2307 delete_option('qlcd_wp_chatbot_agent');
2308 delete_option('qlcd_wp_chatbot_yes');
2309 delete_option('qlcd_wp_chatbot_no');
2310 delete_option('qlcd_wp_chatbot_or');
2311 delete_option('qlcd_wp_chatbot_sorry');
2312 delete_option('qlcd_wp_chatbot_agent_join');
2313 delete_option('qlcd_wp_chatbot_welcome');
2314 delete_option('qlcd_wp_chatbot_back_to_start');
2315 delete_option('qlcd_wp_chatbot_hi_there');
2316 delete_option('qlcd_wp_chatbot_hello');
2317 delete_option('qlcd_wp_chatbot_welcome_back');
2318 delete_option('qlcd_wp_chatbot_asking_name');
2319 delete_option('qlcd_wp_chatbot_name_greeting');
2320 delete_option('qlcd_wp_chatbot_i_am');
2321 delete_option('qlcd_wp_chatbot_wildcard_msg');
2322 delete_option('qlcd_wp_chatbot_empty_filter_msg');
2323 delete_option('qlcd_wp_chatbot_did_you_mean');
2324 delete_option('qlcd_wp_chatbot_wildcard_product');
2325 delete_option('qlcd_wp_chatbot_wildcard_catalog');
2326 delete_option('qlcd_wp_chatbot_featured_products');
2327 delete_option('qlcd_wp_chatbot_sale_products');
2328 delete_option('qlcd_wp_chatbot_wildcard_support');
2329 delete_option('qlcd_wp_chatbot_messenger_label');
2330 delete_option('qlcd_wp_chatbot_product_success');
2331 delete_option('qlcd_wp_chatbot_product_fail');
2332 delete_option('qlcd_wp_chatbot_product_asking');
2333 delete_option('qlcd_wp_chatbot_product_suggest');
2334 delete_option('qlcd_wp_chatbot_product_infinite');
2335 delete_option('qlcd_wp_chatbot_load_more');
2336 delete_option('qlcd_wp_chatbot_wildcard_order');
2337 delete_option('qlcd_wp_chatbot_order_welcome');
2338 delete_option('qlcd_wp_chatbot_order_username_asking');
2339 delete_option('qlcd_wp_chatbot_order_username_password');
2340 delete_option('qlcd_wp_chatbot_support_welcome');
2341 delete_option('qlcd_wp_chatbot_support_email');
2342 delete_option('qlcd_wp_chatbot_asking_email');
2343 delete_option('qlcd_wp_chatbot_asking_msg');
2344 delete_option('qlcd_wp_chatbot_no_result');
2345 delete_option('qlcd_wp_chatbot_admin_email');
2346 delete_option('qlcd_wp_chatbot_email_sub');
2347 delete_option('qlcd_wp_site_search');
2348 delete_option('qlcd_wp_chatbot_email_sent');
2349 delete_option('qlcd_wp_chatbot_support_phone');
2350 delete_option('qlcd_wp_chatbot_asking_phone');
2351 delete_option('qlcd_wp_chatbot_thank_for_phone');
2352 delete_option('qlcd_wp_chatbot_sys_key_help');
2353 delete_option('qlcd_wp_chatbot_sys_key_product');
2354 delete_option('qlcd_wp_chatbot_sys_key_catalog');
2355 delete_option('qlcd_wp_chatbot_sys_key_order');
2356 delete_option('qlcd_wp_chatbot_sys_key_support');
2357 delete_option('qlcd_wp_chatbot_sys_key_reset');
2358 delete_option('qlcd_wp_chatbot_sys_key_email');
2359 delete_option('qlcd_wp_chatbot_order_username_not_exist');
2360 delete_option('qlcd_wp_chatbot_order_username_thanks');
2361 delete_option('qlcd_wp_chatbot_order_password_incorrect');
2362 delete_option('qlcd_wp_chatbot_order_not_found');
2363 delete_option('qlcd_wp_chatbot_order_found');
2364 delete_option('qlcd_wp_chatbot_order_email_support');
2365 delete_option('qlcd_wp_chatbot_support_option_again');
2366 delete_option('qlcd_wp_chatbot_invalid_email');
2367 delete_option('qlcd_wp_chatbot_shopping_cart');
2368 delete_option('qlcd_wp_chatbot_add_to_cart');
2369 delete_option('qlcd_wp_chatbot_cart_link');
2370 delete_option('qlcd_wp_chatbot_checkout_link');
2371 delete_option('qlcd_wp_chatbot_cart_welcome');
2372 delete_option('qlcd_wp_chatbot_featured_product_welcome');
2373 delete_option('qlcd_wp_chatbot_viewed_product_welcome');
2374 delete_option('qlcd_wp_chatbot_latest_product_welcome');
2375 delete_option('qlcd_wp_chatbot_cart_title');
2376 delete_option('qlcd_wp_chatbot_cart_quantity');
2377 delete_option('qlcd_wp_chatbot_cart_price');
2378 delete_option('qlcd_wp_chatbot_no_cart_items');
2379 delete_option('qlcd_wp_chatbot_cart_updating');
2380 delete_option('qlcd_wp_chatbot_cart_removing');
2381 delete_option('qlcd_wp_chatbot_email_fail');
2382 delete_option('support_query');
2383 delete_option('support_ans');
2384 delete_option('qlcd_wp_chatbot_notification_interval');
2385 delete_option('qlcd_wp_chatbot_notifications');
2386 delete_option( 'qlcd_wp_chatbot_search_option');
2387 delete_option( 'wp_chatbot_index_count');
2388 delete_option( 'wp_chatbot_app_pages');
2389 //messenger option
2390 delete_option( 'enable_wp_chatbot_messenger');
2391 delete_option( 'enable_wp_chatbot_messenger_floating_icon');
2392 delete_option( 'qlcd_wp_chatbot_fb_app_id');
2393 delete_option( 'qlcd_wp_chatbot_fb_page_id');
2394 delete_option( 'qlcd_wp_chatbot_fb_color');
2395 delete_option( 'qlcd_wp_chatbot_fb_in_msg');
2396 delete_option( 'qlcd_wp_chatbot_fb_out_msg');
2397 //skype option
2398 delete_option( 'enable_wp_chatbot_skype_floating_icon');
2399 delete_option( 'enable_wp_chatbot_skype_id');
2400 //whats app
2401 delete_option( 'enable_wp_chatbot_whats');
2402 delete_option( 'qlcd_wp_chatbot_whats_label');
2403 delete_option( 'enable_wp_chatbot_floating_whats');
2404 delete_option( 'qlcd_wp_chatbot_whats_num');
2405 // Viber
2406 delete_option( 'enable_wp_chatbot_floating_viber');
2407 delete_option( 'qlcd_wp_chatbot_viber_acc');
2408 //Integration others
2409 delete_option( 'enable_wp_chatbot_floating_phone');
2410 delete_option( 'qlcd_wp_chatbot_phone');
2411 delete_option( 'enable_wp_chatbot_floating_link');
2412 delete_option( 'qlcd_wp_chatbot_weblink');
2413 //Re Targetting
2414 delete_option( 'qlcd_wp_chatbot_ret_greet');
2415 delete_option( 'enable_wp_chatbot_exit_intent');
2416 delete_option( 'wp_chatbot_exit_intent_msg');
2417 delete_option( 'wp_chatbot_exit_intent_once');
2418
2419 delete_option( 'enable_wp_chatbot_scroll_open');
2420 delete_option( 'wp_chatbot_scroll_open_msg');
2421 delete_option( 'wp_chatbot_scroll_percent');
2422 delete_option( 'wp_chatbot_scroll_once');
2423
2424 delete_option( 'enable_wp_chatbot_auto_open');
2425 delete_option( 'enable_wp_chatbot_ret_sound');
2426 delete_option( 'enable_wp_chatbot_sound_initial');
2427 delete_option( 'disable_wp_chatbot_feedback');
2428 delete_option( 'disable_wp_chatbot_faq');
2429 delete_option( 'qlcd_wp_chatbot_feedback_label');
2430 delete_option( 'enable_wp_chatbot_meta_title');
2431 delete_option( 'qlcd_wp_chatbot_meta_label');
2432 delete_option( 'wp_chatbot_auto_open_msg');
2433 delete_option( 'wp_chatbot_auto_open_time');
2434 delete_option( 'wp_chatbot_auto_open_once');
2435 delete_option( 'wp_chatbot_inactive_once');
2436 delete_option( 'wp_chatbot_proactive_bg_color');
2437 delete_option( 'qlcd_wp_chatbot_phone_sent');
2438 delete_option( 'qlcd_wp_chatbot_phone_fail');
2439 delete_option( 'disable_wp_chatbot_call_gen');
2440 delete_option( 'disable_wp_chatbot_site_search');
2441 delete_option( 'disable_wp_chatbot_call_sup');
2442
2443 delete_option( 'enable_wp_chatbot_ret_user_show');
2444 delete_option( 'enable_wp_chatbot_inactive_time_show');
2445 delete_option( 'wp_chatbot_inactive_time');
2446 delete_option( 'wp_chatbot_checkout_msg');
2447 delete_option( 'qlcd_wp_chatbot_shopper_demo_name');
2448 delete_option( 'qlcd_wp_chatbot_is_typing');
2449 delete_option( 'qlcd_wp_chatbot_send_a_msg');
2450 delete_option( 'qlcd_wp_chatbot_choose_option');
2451 delete_option( 'qlcd_wp_chatbot_viewed_products');
2452 delete_option( 'qlcd_wp_chatbot_help_welcome');
2453 delete_option( 'qlcd_wp_chatbot_help_msg');
2454 delete_option( 'qlcd_wp_chatbot_reset');
2455 delete_option( 'enable_wp_chatbot_opening_hour');
2456 delete_option( 'wpwbot_hours');
2457 delete_option( 'enable_wp_chatbot_dailogflow');
2458 delete_option( 'qlcd_wp_chatbot_dialogflow_client_token');
2459 delete_option( 'qlcd_wp_chatbot_dialogflow_defualt_reply');
2460 delete_option( 'qlcd_wp_chatbot_dialogflow_agent_language');
2461
2462 delete_option( 'qlcd_wp_chatbot_dialogflow_project_id');
2463 delete_option( 'wp_chatbot_df_api');
2464 delete_option( 'qlcd_wp_chatbot_dialogflow_project_key');
2465
2466 delete_option( 'wp_chatbot_bot_msg_bg_color');
2467 delete_option( 'wp_chatbot_bot_msg_text_color');
2468 delete_option( 'wp_chatbot_user_msg_bg_color');
2469 delete_option( 'wp_chatbot_user_msg_text_color');
2470 delete_option( 'wp_chatbot_buttons_bg_color');
2471 delete_option( 'wp_chatbot_buttons_text_color');
2472
2473 delete_option( 'wp_chatbot_buttons_bg_color_hover');
2474 delete_option( 'wp_chatbot_buttons_text_color_hover');
2475
2476 delete_option( 'wp_chatbot_theme_secondary_color');
2477 delete_option( 'wp_chatbot_theme_primary_color');
2478 delete_option( 'wp_chatbot_header_background_color');
2479 delete_option('wp_chatbot_font_size');
2480 delete_option('wp_chat_user_font_family');
2481 delete_option('wp_chat_bot_font_family');
2482 delete_option('wp_chatbot_bot_font');
2483 delete_option('wp_chatbot_user_font');
2484 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
2485 qcld_wb_chatboot_defualt_options();
2486 $html='Reset all options to default successfully.';
2487 wp_send_json($html);
2488 }
2489
2490 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
2491 // The path to our plugin's main file
2492 $our_plugin = plugin_basename( __FILE__ );
2493 // If an update has taken place and the updated type is plugins and the plugins element exists
2494 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
2495 // Iterate through the plugins being updated and check if ours is there
2496 foreach( $options['plugins'] as $plugin ) {
2497 if( $plugin == $our_plugin ) {
2498 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
2499 }
2500 }
2501 }
2502 }
2503 add_action( 'upgrader_process_complete', 'wpbot_free_qc_upgrade_completed', 10, 2 );
2504
2505 /**
2506 *
2507 * Function to load translation files.
2508 *
2509 */
2510 function wp_chatbot_lang_init() {
2511 load_plugin_textdomain( 'wpchatbot', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
2512 }
2513 add_action( 'plugins_loaded', 'wp_chatbot_lang_init');
2514
2515 $wpbot_feedback = new Wp_Usage_Feedback(
2516 __FILE__,
2517 'plugins@quantumcloud.com',
2518 false,
2519 true
2520
2521 );
2522
2523 function wpbot_help_page_callback_func(){
2524 ?>
2525 <div class="wrap swpm-admin-menu-wrap">
2526 <h2></h2>
2527 <h2 class="nav-tab-wrapper sld_nav_container wppt_nav_container">
2528 <a class="nav-tab sld_click_handle nav-tab-active" href="#general_int">Getting Started</a>
2529
2530 <a class="nav-tab sld_click_handle" id="general_debuggings" href="#general_debugging">Troubleshooting & FAQ</a>
2531
2532 </h2>
2533
2534
2535 <!-- <div class="container wppt-settings-section" style="margin-right:unset;margin-left:unset; margin-top:40px" id="general_help">
2536 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff">
2537 <h3 style="font-size:20px;margin-top: 10px;">Check out the Pro version of the Plugin for more features from <a href="https://www.wpbot.pro/" target="_blank">here</a>.</h3>
2538 </div>
2539 </div>-->
2540
2541
2542
2543 <div class="container wppt-settings-section" style="margin-right:unset;margin-left:unset; display:block; margin-top:40px" id="general_int">
2544 <div class="content form-container qcbot_help_secion" style="">
2545 <!-- new Section -->
2546
2547 <h2 style="margin-top: 10px;color:#fff">WPBot Interactions</h2>
2548 <h3 style="color:#fff">You can create user interactions in the following ways:</h3>
2549 <div style="clear:both"></div>
2550 <div class="panel panel-default">
2551 <div class="panel-heading" role="tab" id="headingOne">
2552 <h4 class="panel-title">
2553 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false" aria-controls="collapseOne"> Predefined intents - Built-in ChatBot Features </a>
2554 </h4>
2555 </div>
2556 <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
2557 <div class="panel-body"> Predefined intents can work without integration to DialogFlow API and AI. These are readily available as soon as you install the plugin and can be turned on or off individually. <div class="section-container">
2558 <div class="wpb_column vc_column_container vc_col-sm-6">
2559 <div class="vc_column-inner ">
2560 <div class="wpb_wrapper">
2561 <div class="to-icon-box left txt-left">
2562 <div class="to-icon-txt fa-4x-txt ">
2563 <h3>
2564 <span>// </span>Simple Text Responses
2565 </h3>
2566 <p>Create unlimited text responses from your WordPress backend. The ChatBot uses advanced search algorithm for natural language phrase matching with user input. </p>
2567 </div>
2568 </div>
2569 <div class="to-icon-box left txt-left">
2570 <div class="to-icon-txt fa-4x-txt ">
2571 <h3>
2572 <span>// </span>Send eMail, Call Me Back &amp; Feedback Collection
2573 </h3>
2574 <p>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. </p>
2575 </div>
2576 </div>
2577 <div class="to-icon-box left txt-left">
2578 <div class="to-icon-txt fa-4x-txt ">
2579 <h3>
2580 <span>// </span>Advanced Site Search <span class="qc_wpbot_pro">PRO</span>
2581 </h3>
2582 <p>If no matching text response is found WPBot will conduct an advanced website search and try to match user queries with your website contents and show results. </p>
2583 </div>
2584 </div>
2585 </div>
2586 </div>
2587 </div>
2588 <div class="wpb_column vc_column_container vc_col-sm-6">
2589 <div class="vc_column-inner ">
2590 <div class="wpb_wrapper">
2591 <div class="to-icon-box left txt-left">
2592 <div class="to-icon-txt fa-4x-txt ">
2593 <h3>
2594 <span>// </span>Frequently Asked Questions
2595 </h3>
2596 <p>Create a set of Frequently Asked Questions or FAQ so users can quickly find answers to the most common questions they have.</p>
2597 </div>
2598 </div>
2599 <div class="to-icon-box left txt-left">
2600 <div class="to-icon-txt fa-4x-txt ">
2601 <h3>
2602 <span>// </span>Ask for name, email, phone number etc.
2603 </h3>
2604 <p>Asking for the name is the default workflow. In the pro version, you can also ask for an email and phone number if you want to or skip the Greetings part altogether and load any intent of your choice.</p>
2605 </div>
2606 </div>
2607 <div class="to-icon-box left txt-left">
2608 <div class="to-icon-txt fa-4x-txt ">
2609 <h3>
2610 <span>// </span>Newsletter Subscription <span class="qc_wpbot_pro">PRO</span>
2611 </h3>
2612 <p>WPBot can prompt User for eMail subscription. Link this with your Retargeting ChatBot window popup and a special offer. People can register their email address that you can later export as CSV! <strong>GDPR compliant</strong> with unsubscribe option from the ChatBot! </p>
2613 </div>
2614 </div>
2615 </div>
2616 </div>
2617 </div>
2618 </div>
2619 </div>
2620 </div>
2621 </div>
2622 <div class="panel panel-default">
2623 <div class="panel-heading" role="tab" id="headingTwo">
2624 <h4 class="panel-title">
2625 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Menu Driven - Created with Conversational Form Builder Addon </a>
2626 </h4>
2627 </div>
2628 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
2629 <div class="panel-body">
2630 <p>Extend the Start Menu with the <strong>powerful Conversational Forms</strong>&nbsp; Addon for WPBot. It extends WPBot’s functionality and adds the ability to create <strong>conditional conversations</strong> and/or <strong>forms</strong> for the WPBot. It is a visual, <strong> drag and drop</strong> 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 <strong>menu driven</strong>
2631 <strong>conversations </strong>with if else logic <strong>. </strong>Conversations or forms can be <strong>eMailed</strong> to you and <strong>saved in the database</strong>.
2632 </p>
2633 <h4>Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.</h4>
2634 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank">Download Free Version</a>
2635 <a class="FormBuilder" href="https://www.quantumcloud.com/products/conversations-and-form-builder/" target="_blank">Grab the Pro version</a>
2636 <h4>What Can You Do with it?</h4>
2637 <p>Conversation Forms allows you to create a wide variety of forms, that might include:</p>
2638 <ul>
2639 <li>Create menu or button driven conversations</li>
2640 <li>Conditional <strong>Menu Driven Conversations</strong>
2641 <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
2642 </li>
2643 <li>Standard Contact Forms</li>
2644 <li>Dynamic, <strong>conditional Forms</strong> – where fields can change based on the user selections <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
2645 </li>
2646 <li>Job <strong>Application Forms</strong>
2647 </li>
2648 <li>
2649 <strong>Lead Capture</strong> Forms
2650 </li>
2651 <li>Various types of <strong>Calculators</strong>
2652 <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
2653 </li>
2654 <li>Feedback <strong>Survey</strong> Forms etc. </li>
2655 </ul>
2656 </div>
2657 </div>
2658 </div>
2659 <div class="panel panel-default">
2660 <div class="panel-heading" role="tab" id="headingThree">
2661 <h4 class="panel-title">
2662 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> DialogFlow ES and CX, OpenAI </a>
2663 </h4>
2664 </div>
2665 <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
2666 <div class="panel-body">
2667 <div class="section-container">
2668 <div class="wpb_column vc_column_container vc_col-sm-6">
2669 <div class="wpb_wrapper">
2670 <h2 style="font-size: 20px;">DialogFlow Essential</h2> Intents created in Dialogflow give you the power to build a truly human like, intelligent and comprehensive chatbot. Build any type of Intents and Responses (including rich message responses) directly in DialogFlow and train the bot accordingly. When you create custom intents and responses in DialogFlow, WPBot will <strong>automatically</strong> display them when user inputs match with your Custom Intents along with the responses you created. You can also build Rich responses by enabling Facebook messenger Response option. <p></p>
2671 <p style="text-align: left;">In addition you can also Enable <strong>Advanced Chained Question and Answers</strong> using follow up Intents, Contexts, Entities etc. and then have resulting answers from your users emailed to you. This feature lets you create a a series of questions in DialogFlow that will be asked by the bot and based on the user inputs a response will be displayed. <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
2672 </p>
2673 <p style="text-align: left;">WPBot also supports Rich responses using Facebook Messenger integration. This allows you to display Image, <strong>Cards</strong>, Quick Text Reply or Custom PayLoad inside the ChatBot window. You can also insert an <strong>image</strong> or <strong>youtube video</strong> link inside the DialogFlow responses and they will be automatically rendered by the WPBot! <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
2674 </p>
2675 <h2 style="font-size: 20px;">OpenAI</h2>Connect the ChatBot to OpenAI. OpenAI’s API provides access to GPT-3, for a wide variety of natural language tasks. Train your ChatBot with (pre-trained) GPT-3 to answer any user questions using. Select your preferred Engine from DaVinci, Ada, Curie or Babbag! Add your own API key to the addon to connect to your OpenAI account. To go live, you need to apply to OpenAI.
2676 </div>
2677 </div>
2678 <div class="wpb_column vc_column_container vc_col-sm-6">
2679 <div class="wpb_wrapper">
2680 <h2 style="font-size: 20px;">DialogFlow CX <span class="qc_wpbot_pro">PRO</span>
2681 </h2>
2682 <p>WPBot supports <strong>visual workflow builder</strong> Dialogflow CX. It provides a new way of designing agents, taking a state machine approach to agent design. This gives you clear and explicit control over a conversation, a better end-user experience, and a better development <strong>workflow</strong>. </p>
2683 <ul>
2684 <li>
2685 <strong>Console visualization</strong>: A new <strong>visual builder</strong> makes building and maintaining agents easier. Conversation paths are graphed as a state machine model, which makes conversations easier to design, enhance, and maintain.
2686 </li>
2687 <li>
2688 <strong>Intuitive and powerful conversation control</strong>: Conversation states and state transitions are first-class types that provide explicit and powerful control over conversation paths. You can clearly define a series of steps that you want the end-user to go through.
2689 </li>
2690 <li>
2691 <strong>Flows for agent partitions</strong>: With flows, you can partition your agent into smaller conversation topics. Different team members can own different flows, which makes large and complex agents easy to build.
2692 </li>
2693 <img style="width:100%" src="<?php echo QCLD_wpCHATBOT_IMG_URL . '/dialogflow-cx-1024x676.jpg';?>" alt="Dialogflow CX">
2694 </ul>
2695 </div>
2696 </div>
2697 </div>
2698 </div>
2699 </div>
2700 </div>
2701
2702
2703 <!-- end new Section -->
2704
2705 </div>
2706 </div>
2707
2708
2709
2710
2711
2712
2713
2714
2715 <div class="container wppt-settings-section" style="margin-right:unset;margin-left:unset;display:none" id="general_debugging">
2716
2717
2718
2719 <div class="content form-container qcbot_help_secion" style="margin-right:unset;margin-left:unset; margin-top:40px" >
2720 <div class="" style="color:#fff">
2721 <h2 style="font-size:28px;margin-top: 10px;">Tips</h2>
2722 <h2 style="font-size:20px;margin-top: 10px;">Tutorial</h2>
2723 <p>You will find some helpful video tutorials and the ChatBot workflow on this <a href="https://www.wpbot.pro/chatbot-workflow/" target="_blank">page</a>.</p>
2724 <h2 style="font-size:20px">Simple Text Responses</h2>
2725 <p>Create simple text responses easily for your chatbot. The ChatBot will use advanced search algorithm for natural language phrase matching with user input. You can also adjust the Phrase matching accuracy for better user experience.</p>
2726 <h2 style="font-size:20px">Setting Updates</h2>
2727 <p>After making changes in the language center or settings, please type reset and hit enter in the ChatBot to start testing from the beginning or open a new Incognito window (Ctrl+Shit+N in chrome).</p>
2728 <h2 style="font-size:20px">Note</h2>
2729 <p>You could use &lt;br&gt; tag in Language Center & Dialogflow Responses for line break.</p>
2730 </div>
2731 </div>
2732
2733
2734
2735 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;margin-top:0px">
2736 <h2 style="font-size:20px">Problem: I changed language and/or some settings but do not see the changes.</h2>
2737 <p>WPBot saves a lot of information in the browser's local storage. After making any language or settings change you must clear browser cache and cookies both and reload the page for testing. An easier alternative is to always launch a new browser window in Incognito mode (Ctrl+Shift+N in chrome) and test there. Also, you need to purge cache plugin and CDN caching if you have any.</p>
2738 </div>
2739 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2740 <h2 style="font-size:20px">Problem: I cannot connect to the DialogFlow</h2>
2741 <p>To Debug: 1. Make sure that you have created the Google Project and the Service account as an Owner<br>
2742 2. Make sure that you have connected to the correct Dialogflow agent<br>
2743 3. Follow the steps in this tutorial correctly: <a href="https://www.wpbot.pro/dialogflow-integration" target="_blank">https://www.wpbot.pro/dialogflow-integration</a><br>
2744 4. Make sure that the Google Client Package is Installed on Your Website.<br>
2745 5. For DialogFlow agent region, try choosing any region other than the EU region which has known issues.<br>
2746 6. Make sure to download and import the sample DialogFlow agent to your agent<br>
2747 7. Test the ChatBot in the browser Incognito mode</p>
2748 </div>
2749 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2750 <h2 style="font-size:20px">Problem: I am not getting emails from the ChatBot</h2>
2751 <p>The WPBot ChatBot uses the WordPress' default email function. If you are not getting emails from the ChatBot's email feature, it is likely that no emails are getting through from your WordPress site or they are ending up in the Spam box. Try using an SMTP mailer plugin. Also, try changing the to and from email addresses in the ChatBot's general settings area.</p>
2752 </div>
2753 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2754 <h2 style="font-size:20px">Problem: Simple text responses are not working or getting an error</h2>
2755 <p>WPBot requires mysql version 5.6+ for the simple text responses to work. If your server has a version below that, you might see some PHP error or the Simple Text Responses will not work at all. Please request your hosting support to update the mysql version on your server.</p>
2756 </div>
2757 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2758 <h2 style="font-size:20px">Problem: I changed language or some other settings but do not see them when testing</h2>
2759 <p>Please clear the browser cache and <strong>cookies</strong> to see any change you have made. Alternatively, you can open a fresh browser window in incognito mode (Ctrl+Shift+N in chrome) to test your changes. Also, you may need to purge any cache plugin and CDN caching.</p>
2760 </div>
2761 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2762 <h2 style="font-size:20px">Problem: The ChatBot is NOT working in the front end.</h2>
2763 <p>The most common reason for this is if the theme is coded incorrectly and jQuery is loaded from external source. jQuery is included with WordPress core and according to WordPress standard, jQuery must be included using wp_enqueue_script. <a href="https://developer.wordpress.org/reference/functions/wp_enqueue_script/" target="_blank">https://developer.wordpress.org/reference/functions/wp_enqueue_script/</a> . Please make sure if that is the case in your theme.<br>
2764 Also go to Simple Text Responses and press the Re-Index button.</br>
2765 After that try purging any cache and test the chatbot in Incognito mode<br>
2766 Please contact us if you need [further help](<a href="https://www.wpbot.pro/free-support/" target="_blank">https://www.wpbot.pro/free-support/</a>). We take all user feedback sriously. </p>
2767 </div>
2768 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2769 <h2 style="font-size:20px">Problem: The ChatBot is stuck on typing or loading</h2>
2770 <p>This usually happens if you enabled DialogFlow but did not complete the set up. Please make sure that you have carefully followed all the steps for DialogFlow integration in the Settings->DialogFlow section.<br>
2771 This can also happen if there is any empty language fields or Simple Text Responses database needs updating because of mysql version changes. Try saving both the Language Center and Simple Text Responses and test again.<br>
2772 Also go to Simple Text Responses and press the Re-Index button.</br>
2773 After that remember to test in a browser Incognito mode to avoid cache and cookies. </p>
2774 </div>
2775 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2776 <h2 style="font-size:20px">Problem: How do I add new conversations to the ChatBot?</h2>
2777 <p>Please check the plugin's Help Section for details on this</p>
2778 </div>
2779 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2780 <h2 style="font-size:20px">Problem: How do I add Line Breaks?</h2>
2781 <p>Please use the &lt;br&gt; tag for line breaks.</p>
2782 </div>
2783 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2784 <h2 style="font-size:20px">Problem: Are HTML tags supported? </h2>
2785 <p>Yes, common HTML tags link link href, strong, br etc. are supported.</p>
2786 </div>
2787 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2788 <h2 style="font-size:20px">Problem: I want to add images, GIFs, Videos</h2>
2789 <p>Images, GIFs and Youtube Videos are supprted in the pro version. Pro version also includes a handy giphy floating search feature for easy embed in the language center.</p>
2790 </div>
2791
2792
2793 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2794 <h2 style="font-size:20px">How to disable Predefined Intent?</h2>
2795 <p>You can disable predefined intents FAQ, eMail, Call me from WPBot Lite > Settings page's Start Menu Section.</p>
2796 </div>
2797
2798
2799 </div>
2800
2801 </div>
2802 <script type="text/javascript">
2803 jQuery(document).ready(function($){
2804 var url=document.URL;
2805 var arr=url.split('#');
2806 var tab_tar = '.'+arr[1];
2807 setTimeout(function(){
2808 jQuery(tab_tar).trigger('click');
2809 }, 500);
2810
2811 jQuery('.wppt_nav_container .nav-tab').on('click', function(e){
2812 e.preventDefault();
2813 var section_id = jQuery(this).attr('href');
2814 jQuery('.wppt_nav_container .nav-tab').removeClass('nav-tab-active');
2815 jQuery(this).addClass('nav-tab-active');
2816 jQuery('.wppt-settings-section').hide();
2817 jQuery('.wppt-settings-section').each(function(){
2818 jQuery(section_id).show();
2819 });
2820 });
2821 })
2822 </script>
2823 <?php
2824 }
2825
2826 add_action('init', 'qc_wp_latest_update_check');
2827 function qc_wp_latest_update_check(){
2828 global $wpdb;
2829
2830 if(!get_option('qc_wp_ludate_ck')){
2831 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
2832 update_option('qlcd_wp_chatbot_support_email', 'Send us Email');
2833 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
2834 update_option('qc_wp_ludate_ck', 'done');
2835 }
2836
2837 if( ! get_option( 'wpbot-admin-notice-oninstallation' ) ){
2838 update_option('wpbot-admin-notice-oninstallation', 'show');
2839 }
2840
2841 if(!get_option('qc_wpb_simple_response_db_upgrade_free2')){
2842
2843 $collate = '';
2844 if ( $wpdb->has_cap( 'collation' ) ) {
2845
2846 if ( ! empty( $wpdb->charset ) ) {
2847
2848 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
2849 }
2850 if ( ! empty( $wpdb->collate ) ) {
2851
2852 $collate .= " COLLATE $wpdb->collate";
2853
2854 }
2855 }
2856 //Bot Response Table
2857 $table1 = $wpdb->prefix.'wpbot_response';
2858 $sql_sliders_Table1 = "
2859 CREATE TABLE IF NOT EXISTS `$table1` (
2860 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
2861 `query` TEXT NOT NULL,
2862 `keyword` TEXT NOT NULL,
2863 `response` TEXT NOT NULL,
2864 `category` varchar(256) NOT NULL,
2865 `intent` varchar(256) NOT NULL,
2866 `custom` varchar(256) NOT NULL,
2867 `lang` varchar(25) NULL,
2868 FULLTEXT(`query`, `keyword`, `response`)
2869 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
2870
2871 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2872 dbDelta( $sql_sliders_Table1 );
2873
2874 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2875 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
2876 }
2877
2878 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2879 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
2880 }
2881
2882 $sqlqry = $wpdb->get_results("select * from $table1");
2883 if(empty($sqlqry)){
2884
2885 $query = 'What Can WPBot do for you?';
2886 $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!';
2887
2888 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2889 $format = array('%s','%s', '%s', '%s');
2890 $wpdb->insert($table1,$data,$format);
2891 }
2892
2893 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
2894
2895 }
2896
2897 if(!get_option('qc_wp_db_engine_update_free')){
2898 $table1 = $wpdb->prefix.'wpbot_response';
2899 $wpdb->query("ALTER TABLE $table1 ENGINE = InnoDB");
2900
2901 update_option('qc_wp_db_engine_update_free', 'done');
2902 }
2903 if(!get_option('qc_wp_db_engine_update_free_unassign')){
2904 $table1 = $wpdb->prefix.'wpbot_response';
2905 $wpdb->query("ALTER TABLE $table1 CHANGE `id` `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;");
2906 update_option('qc_wp_db_engine_update_free_unassign', 'done');
2907 }
2908
2909 if(isset($_POST['qc_bot_str_query']) && $_POST['qc_bot_str_query']!='' && !class_exists('Qcld_str_pro')){
2910
2911 $query = wp_unslash(sanitize_text_field($_POST['qc_bot_str_query']));
2912 $keyword = wp_unslash(sanitize_text_field($_POST['qc_bot_str_keyword']));
2913 $intent = wp_unslash(sanitize_text_field($_POST['qc_bot_str_intent']));
2914
2915 $category = '';
2916
2917 $response = wp_kses(wp_unslash($_POST['qc_bot_str_response']), 'post');
2918
2919 $table = $wpdb->prefix.'wpbot_response';
2920 $data = array('query' => $query, 'keyword' => $keyword, 'response'=> $response, 'intent'=> $intent, 'category'=> $category);
2921 $format = array('%s','%s', '%s', '%s', '%s');
2922
2923 if(isset($_POST['qc_bot_str_id']) && $_POST['qc_bot_str_id']!=''){
2924 $id = sanitize_text_field($_POST['qc_bot_str_id']);
2925 $where = array('id'=>$id);
2926 $whereformat = array('%d');
2927 $wpdb->update( $table, $data, $where, $format, $whereformat );
2928 }else{
2929 $wpdb->insert($table,$data,$format);
2930 }
2931
2932 qc_mysql_remove_existing_indexes();
2933 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
2934
2935 wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
2936
2937 }
2938 $table = $wpdb->prefix.'wpbot_response';
2939 if(isset($_POST['qc-re-index'])){
2940 qc_mysql_remove_existing_indexes();
2941 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`)");
2942 add_action('admin_notices', 'general_admin_notice_str' );
2943 }
2944 if(isset($_POST['qc_bot_str_weight']) && $_POST['qc_bot_str_weight']!=''){
2945 $weight = sanitize_text_field($_POST['qc_bot_str_weight']);
2946 update_option('qc_bot_str_weight', $weight);
2947 }
2948 if(isset($_POST['qc_bot_str_remove_stopwords']) && $_POST['qc_bot_str_remove_stopwords']!=''){
2949
2950 $stopwords = sanitize_text_field($_POST['qc_bot_str_remove_stopwords']);
2951 update_option('qc_bot_str_remove_stopwords', '1');
2952 }
2953 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
2954 $table = $wpdb->prefix.'wpbot_response';
2955 $fields = ($_POST['qc_bot_str_fields']);
2956 update_option('qc_bot_str_fields', $fields);
2957 qc_mysql_remove_existing_indexes();
2958
2959 if($fields && !empty($fields)){
2960 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
2961 }
2962 }
2963
2964 if(!get_option('wpbot_preloading_time')) {
2965 update_option('wpbot_preloading_time', '0.5');
2966 }
2967
2968 }
2969
2970 function general_admin_notice_str(){
2971 if ( isset($_GET['page']) && $_GET['page'] == 'simple-text-response' ) {
2972 echo '<div class="notice notice-success is-dismissible">
2973 <p>Re-Indexing has been completed!</p>
2974 </div>';
2975 }
2976 }
2977
2978 function qc_wpbot_simple_response_intent(){
2979 global $wpdb;
2980 $table = $wpdb->prefix.'wpbot_response';
2981 $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''");
2982 $response = array();
2983 if(!empty($results)){
2984 foreach($results as $result){
2985 $response[] = $result->intent;
2986 }
2987 }
2988 return $response;
2989 }
2990
2991 function qc_mysql_remove_existing_indexes(){
2992 global $wpdb;
2993 $table = $wpdb->prefix.'wpbot_response';
2994
2995 $results = $wpdb->get_results("SHOW INDEX FROM $table");
2996 $indexes = array();
2997 foreach($results as $result){
2998
2999
3000
3001 if("PRIMARY" != $result->Key_name && !in_array($result->Key_name, $indexes)){
3002 $wpdb->query("ALTER TABLE $table DROP INDEX `".$result->Key_name
3003 ."`;");
3004 $indexes[] = $result->Key_name;
3005 }
3006
3007 }
3008 }
3009
3010 add_action( 'activated_plugin', 'qc_wpbotfree_activation_redirect' );
3011 function qc_wpbotfree_activation_redirect( $plugin ){
3012
3013 if( $plugin == plugin_basename( __FILE__ ) ) {
3014 exit( wp_redirect( admin_url('admin.php?page=wpbot_help_page') ) );
3015 }
3016 }
3017
3018
3019
3020
3021