PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 4.2.1
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v4.2.1
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.2.1, at qcld-wpwbot.php

3,011 lines 176.5 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.2.1
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.2.1');
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 . "/halloween-sale-ghostly.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'),'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 ?>
314 <div data-dismiss-type="qcbot-feedback-notice" class="notice is-dismissible qcbot-feedback" style="background: #535647">
315 <div class="">
316
317 <div class="qc-review-text" >
318 <a href="https://www.wpbot.pro/pricing/" target="_blank">
319 <img src="<?php echo esc_url($this->promotion); ?>" alt=""></a>
320 </div>
321 </div>
322 </div>
323 <?php
324 }
325 public function qc_get_formbuilder_form_ids(){
326 global $wpdb;
327 $forms = array();
328 if(class_exists('Qcformbuilder_Forms_Admin')){
329 $results = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."wfb_forms where 1 and type='primary'");
330 if(!empty($results)){
331 foreach($results as $result){
332 $form = maybe_unserialize($result->config);
333 $forms[] = trim($form['ID']);
334 }
335 return $forms;
336 }else{
337 return array();
338 }
339 }else{
340 return array();
341 }
342 }
343
344 public function qcld_wb_chatbot_frontend_scripts()
345 {
346 global $wpcommerce, $wp_scripts, $wpdb, $current_user;
347
348 $display_name = '';
349 $display_email = '';
350 $user_image = get_option('wp_custom_client_icon');
351 $user_id = 0;
352 $user_image = get_option('wp_custom_client_icon');
353 if ( is_user_logged_in() ) {
354 $display_name = $current_user->display_name;
355 $display_email = $current_user->user_email;
356 $user_image = esc_url( get_avatar_url( $current_user->ID ) );
357 $user_id = $current_user->ID;
358 }
359
360 $conversation_form_ids = array();
361 $conversation_form_names = array();
362
363 if(class_exists('Qcformbuilder_Forms_Admin')){
364 $results = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."wfb_forms where 1 and type='primary'");
365 if(!empty($results)){
366
367 foreach($results as $result){
368 $form = unserialize($result->config);
369 $conversation_form_ids[] = $form['ID'];
370 $conversation_form_names[] = $form['name'];
371 }
372
373 }
374 }
375
376 $wp_chatbot_obj = array(
377 'wp_chatbot_position_x' => get_option('wp_chatbot_position_x'),
378 'wp_chatbot_position_y' => get_option('wp_chatbot_position_y'),
379 'disable_icon_animation' => get_option('disable_wp_chatbot_icon_animation'),
380 'disable_featured_product' => get_option('disable_wp_chatbot_featured_product'),
381 'disable_product_search' => get_option('disable_wp_chatbot_product_search'),
382 'disable_catalog' => get_option('disable_wp_chatbot_catalog'),
383 'disable_order_status' => get_option('disable_wp_chatbot_order_status'),
384 'disable_sale_product' => get_option('disable_wp_chatbot_sale_product'),
385 'open_product_detail' => get_option('wp_chatbot_open_product_detail'),
386 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
387 'ajax_url' => admin_url('admin-ajax.php'),
388 'image_path' => QCLD_wpCHATBOT_IMG_URL,
389 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
390 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
391 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
392 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
393 'agent' => str_replace('\\', '',get_option('qlcd_wp_chatbot_agent')),
394 'agent_image' => get_option('wp_chatbot_agent_image'),
395 'agent_image_path' => $this->qcld_wb_chatbot_agent_icon(),
396 'shopper_demo_name' => str_replace('\\', '',get_option('qlcd_wp_chatbot_shopper_demo_name')),
397 'agent_join' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
398 'welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_welcome'))),
399 'welcome_back' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
400 'hi_there' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
401 'hello' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_hello'))),
402 'asking_name' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_name'))),
403 'i_am' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_i_am'))),
404 'name_greeting' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_name_greeting'))),
405 'wildcard_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_msg'))),
406 'empty_filter_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_empty_filter_msg'))),
407 'did_you_mean' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_did_you_mean'))),
408 'is_typing' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_is_typing'))),
409 'send_a_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_send_a_msg'))),
410 'viewed_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_viewed_products'))),
411 'shopping_cart' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_shopping_cart'))),
412 'cart_updating' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_cart_updating'))),
413 'cart_removing' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_cart_removing'))),
414 'imgurl' => QCLD_wpCHATBOT_IMG_URL,
415 'sys_key_help' => get_option('qlcd_wp_chatbot_sys_key_help'),
416 'sys_key_product' => get_option('qlcd_wp_chatbot_sys_key_product'),
417 'sys_key_catalog' => get_option('qlcd_wp_chatbot_sys_key_catalog'),
418 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
419 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
420 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
421 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
422 'help_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
423 'back_to_start' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
424 'help_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
425 'reset' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_reset'))),
426 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
427 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
428 'featured_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
429 'sale_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
430 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
431 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
432 'product_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
433 'product_suggest' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
434 'product_infinite' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
435 'product_success' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_success'))),
436 'product_fail' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
437 'support_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
438 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
439 'support_option_again' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
440 'asking_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
441 'asking_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
442 'no_result' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_no_result'))),
443 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
444 'asking_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
445 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
446 'support_query' =>$this->qcld_wb_chatbot_str_replace(unserialize( get_option('support_query'))),
447 'support_ans' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('support_ans'))),
448 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
449 'notifications' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_notifications'))),
450 'order_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
451 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
452 'order_username_password' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
453 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
454 'order_login' => is_user_logged_in(),
455 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
456 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
457 'order_email_support' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
458 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
459 'invalid_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
460 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
461 'currency_symbol' => '',
462 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
463 'messenger_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
464 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
465 'enable_skype' => get_option('enable_wp_chatbot_skype'),
466 'enable_whats' => get_option('enable_wp_chatbot_whats'),
467 'whats_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
468 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
469 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
470 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
471 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
472 'exit_intent_once' => get_option('wp_chatbot_exit_intent_once'),
473 'enable_scroll_open' => get_option('enable_wp_chatbot_scroll_open'),
474 'scroll_open_msg' => str_replace('\\', '', get_option('wp_chatbot_scroll_open_msg')),
475 'scroll_open_percent' => get_option('wp_chatbot_scroll_percent'),
476 'scroll_open_once' => get_option('wp_chatbot_scroll_once'),
477 'enable_auto_open' => get_option('enable_wp_chatbot_auto_open'),
478 'auto_open_msg' => str_replace('\\', '', get_option('wp_chatbot_auto_open_msg')),
479 'auto_open_time' => get_option('wp_chatbot_auto_open_time'),
480 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
481 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
482 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
483 'disable_faq' => get_option('disable_wp_chatbot_faq'),
484 'feedback_label' =>$this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
485 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
486 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
487 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
488 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
489 'ajax_nonce'=> wp_create_nonce('qcsecretbotnonceval123qc'),
490 'site_search' => get_option('qlcd_wp_site_search'),
491 'call_gen' => get_option('disable_wp_chatbot_call_gen'),
492 'call_sup' => get_option('disable_wp_chatbot_call_sup'),
493 'enable_ret_sound' => get_option('enable_wp_chatbot_ret_sound'),
494 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
495 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
496 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
497 'mobile_full_screen' => get_option('enable_wp_chatbot_mobile_full_screen'),
498 'botpreloadingtime' => (get_option('wpbot_preloading_time')?get_option('wpbot_preloading_time'):100),
499 'inactive_time' => get_option('wp_chatbot_inactive_time'),
500 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
501 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
502 'ai_df_token' => get_option('qlcd_wp_chatbot_dialogflow_client_token'),
503 'df_defualt_reply' => str_replace('\\', '', get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')),
504 'df_agent_lan' => get_option('qlcd_wp_chatbot_dialogflow_agent_language'),
505 'start_menu' => wp_unslash(get_option('qc_wpbot_menu_order')),
506 'conversation_form_ids' => $conversation_form_ids,
507 'conversation_form_names' => $conversation_form_names,
508 'simple_response_intent' => $this->qc_wpbot_simple_response_intent(),
509 'forms' => $this->qc_get_formbuilder_forms(),
510 'form_ids' =>$this->qc_get_formbuilder_form_ids(),
511 'form_commands' => $this->qc_get_formbuilder_form_commands(),
512 'df_api_version' => (get_option('wp_chatbot_df_api')==''?'v1':get_option('wp_chatbot_df_api')),
513 'v2_client_url'=> esc_url(get_site_url().'/?action=qcld_dfv2_api'),
514 'show_menu_after_greetings'=> (get_option('show_menu_after_greetings')!=''?get_option('show_menu_after_greetings'):0),
515 'current_user_id' => $user_id,
516
517 );
518 $user_font = get_option('wp_chat_user_font_family') != '' ? get_option('wp_chat_user_font_family') : '';
519 if($user_font != '' ){
520 $user_font_family = str_replace('\\', '',$user_font);
521 $user_font_family = json_decode($user_font_family);
522 $user_font_name = $user_font_family->fontFamily;
523 $user_font_name = str_replace(' ', '+', $user_font_name);
524 $user_font_name = str_replace("'","",$user_font_name );
525 $user_enqueue_font = 'https://fonts.googleapis.com/css2?family='.$user_font_name;
526 wp_enqueue_style( 'qcld-chatbot-user-google-fonts', $user_enqueue_font, false );
527 wp_enqueue_style( 'qcld-chatbot-user-google-fonts');
528 }
529
530 $bot_font = get_option('wp_chat_bot_font_family') != '' ? get_option('wp_chat_bot_font_family') : '';
531 if($bot_font != '' ){
532 $bot_font_family = str_replace('\\', '',$bot_font);
533 $bot_font_family = json_decode($bot_font_family);
534 $bot_font_name =$bot_font_family->fontFamily;
535 $bot_font_name = str_replace(' ', '+', $bot_font_name );
536 $bot_font_name = str_replace("'","",$bot_font_name );
537 $bot_enqueue_font = 'https://fonts.googleapis.com/css2?family='.$bot_font_name;
538 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts', $bot_enqueue_font, false );
539 wp_enqueue_style( 'qcld-chatbot-bot-google-fonts');
540 }
541
542 wp_enqueue_style( 'dashicons' );
543 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);
544 wp_enqueue_script('qcld-wp-chatbot-slimscroll-js');
545 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);
546 wp_enqueue_script('qcld-wp-chatbot-jquery-cookie');
547 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);
548 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
549 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);
550 wp_enqueue_script('qcld-wp-chatbot-plugin');
551 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);
552 wp_enqueue_script('qcld-wp-chatbot-front-js');
553 wp_localize_script('qcld-wp-chatbot-front-js', 'wp_chatbot_obj', $wp_chatbot_obj);
554 //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);
555 //wp_enqueue_script('qcld-wp-chatbot-frontend');
556 //wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
557 wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
558 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');
559 wp_enqueue_style('qcld-wp-chatbot-common-style');
560
561 if(get_option('wp_chatbot_floatingiconbg_color')!="") {
562 $custom_colors = ".wp-chatbot-ball{
563 background: ". get_option('wp_chatbot_floatingiconbg_color')." !important;
564 }
565 .wp-chatbot-ball:hover, .wp-chatbot-ball:focus{
566 background: ".get_option('wp_chatbot_floatingiconbg_color')." !important;
567 }";
568 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
569 }
570
571
572 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');
573 wp_enqueue_style('qcld-wp-chatbot-magnific-popup');
574 $qcld_wb_chatbot_theme = get_option('qcld_wb_chatbot_theme');
575 /* if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css')) {
576 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');
577 wp_enqueue_style('qcld-wp-chatbot-style');
578 }*/
579 //Loading shortcode style
580 if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/shortcode.css')) {
581 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');
582 wp_enqueue_style('qcld-wp-chatbot-shortcode-style');
583 }
584 $custom_colors = '';
585 if(get_option('enable_wp_chatbot_custom_color')==1){
586 $custom_colors .="
587 #wp-chatbot-chat-container, .wp-chatbot-product-description, .wp-chatbot-product-description p,.wp-chatbot-product-quantity label, .wp-chatbot-product-variable label {
588 color: ". get_option('wp_chatbot_text_color')." !important;
589 }
590 #wp-chatbot-chat-container a {
591 color: ". get_option('wp_chatbot_link_color')." !important;
592 }
593 #wp-chatbot-chat-container a:hover {
594 color: ". get_option('wp_chatbot_link_hover_color')." !important;
595 }
596
597 ul.wp-chatbot-messages-container > li.wp-chatbot-msg .wp-chatbot-paragraph,
598 .wp-chatbot-agent-profile .wp-chatbot-bubble {
599 color: ". get_option('wp_chatbot_bot_msg_text_color')." !important;
600 background-color: ". get_option('wp_chatbot_bot_msg_bg_color')." !important;
601 word-break: break-word;
602 }
603 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 {
604 color: ". get_option('wp_chatbot_buttons_text_color') ." !important;
605 background-color: ". get_option('wp_chatbot_buttons_bg_color') ." !important;
606 background-image: none !important;
607 }
608
609 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 {
610 color: ". get_option('wp_chatbot_buttons_text_color_hover') ." !important;
611 background-color: ". get_option('wp_chatbot_buttons_bg_color_hover') ." !important;
612 background-image: none !important;
613 }
614
615 li.wp-chat-user-msg .wp-chatbot-paragraph {
616 color: ". get_option('wp_chatbot_user_msg_text_color')." !important;
617 background-color: ". get_option('wp_chatbot_user_msg_bg_color')." !important;
618 }
619 ul.wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph:before,
620 .wp-chatbot-bubble:before {
621 border-right: 10px solid ". get_option('wp_chatbot_bot_msg_bg_color')." !important;
622
623 }
624 ul.wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph:before {
625 border-left: 10px solid ". get_option('wp_chatbot_user_msg_bg_color')." !important;
626 }
627 #wp-chatbot-chat-container .wp-chatbot-header{
628 background: ". get_option('wp_chatbot_header_background_color')." !important;
629 }
630 ";
631
632 }
633 if((get_option('enable_wp_chatbot_custom_color')==1) && $user_font != ''){
634 $custom_colors .="
635 #wp-chatbot-messages-container > li.wp-chatbot-msg > .wp-chatbot-paragraph,
636 #wp-chatbot-messages-container > li.wp-chatbot-msg > span{
637 font-family: ".$bot_font_family->fontFamily.";
638 font-weight: ".$bot_font_family->fontWeight.";
639 font-style: ".$bot_font_family->fontStyle.";
640 font-size: ". get_option('wp_chatbot_font_size'). ";
641 }
642 ";
643 }
644 if((get_option('enable_wp_chatbot_custom_color')==1) && $bot_font != ''){
645 $custom_colors .="
646 #wp-chatbot-messages-container > li.wp-chat-user-msg > .wp-chatbot-paragraph{
647 font-family: ".$user_font_family->fontFamily.";
648 font-weight: ".$user_font_family->fontWeight.";
649 font-style: ".$user_font_family->fontStyle.";
650 font-size: ". get_option('wp_chatbot_font_size'). ";
651 }
652 ";
653 }
654 wp_add_inline_style( 'qcld-wp-chatbot-common-style', $custom_colors );
655 if(get_option('wp_chatbot_custom_css')!=""){
656
657 wp_add_inline_style( 'qlcd-wp-chatbot-admin-style', get_option('wp_chatbot_custom_css') );
658 }
659 }
660 public function qcld_wb_chatbot_str_replace($messages=array()){
661 $refined_mesgses=array();
662 if(!empty($messages)){
663 foreach ($messages as $message){
664 $refined_msg=str_replace('\\', '', $message);
665 array_push($refined_mesgses,$refined_msg);
666 }
667 }
668 return $refined_mesgses;
669 }
670 //getting exact agent icon path
671 public function qcld_wb_chatbot_agent_icon(){
672
673 if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')=="custom-agent.png" ){
674 $wp_chatbot_custom_icon_path=get_option('wp_chatbot_custom_agent_path');
675 }
676 else if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')!="custom-agent.png"){
677 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
678 }
679 else
680 {
681 if(get_option('wp_chatbot_agent_image')!=''){
682 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
683 }else{
684 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.'custom-agent.png';
685 }
686
687 }
688
689 return $wp_chatbot_custom_icon_path;
690 }
691 /**
692 * Render the admin page
693 */
694
695 public function qcld_wb_chatbot_admin_page()
696 {
697 global $wpcommerce;
698 $action = 'admin.php?page=wpbot-panel';
699 require_once("admin_ui2.php");
700 }
701
702 public function qcld_wb_chatbot_admin_page_settings()
703 {
704 global $wpcommerce;
705 $action = 'admin.php?page=wpbot';
706 require_once("admin_ui.php");
707 }
708
709 public function qcld_wb_chatbot_dynamic_multi_option($options = array(), $option_name = "", $option_text = "")
710 {
711 ?>
712
713 <h4 class="qc-opt-title">
714 <?php esc_html_e($option_text, 'wpchatbot'); ?>
715 </h4>
716 <div class="wp-chatbot-lng-items">
717 <?php
718 if (is_array($options) && count($options) > 0) {
719 foreach ($options as $key => $value) {
720 ?>
721 <div class="row" class="wp-chatbot-lng-item">
722 <div class="col-xs-10">
723 <input type="text"
724 class="form-control qc-opt-dcs-font"
725 name="<?php echo $option_name; ?>[]"
726 value="<?php echo str_replace('\\', '', $value); ?>">
727 </div>
728 <div class="col-xs-2">
729 <button type="button" class="btn btn-danger btn-sm wp-chatbot-lng-item-remove"> <span class="glyphicon glyphicon-remove"></span> </button>
730 </div>
731 </div>
732 <?php
733 }
734 } else { ?>
735 <div class="row" class="wp-chatbot-lng-item">
736 <div class="col-xs-10">
737 <input type="text"
738 class="form-control qc-opt-dcs-font"
739 name="<?php echo $option_name; ?>[]"
740 value="<?php echo $option_text; ?>">
741 </div>
742 <div class="col-xs-2"> <span class="wp-chatbot-lng-item-remove">
743 <?php esc_html_e('X', 'wpchatbot'); ?>
744 </span> </div>
745 </div>
746 <?php } ?>
747 </div>
748 <div class="row">
749 <div class="col-sm-2 col-sm-offset-10">
750 <button type="button" class="btn btn-success btn-sm wp-chatbot-lng-item-add"> <span class="glyphicon glyphicon-plus"></span> </button>
751 </div>
752 </div>
753 <?php
754 }
755
756 function qcld_wb_chatbot_save_options()
757 {
758 //global $wpcommerce;
759 if (isset($_POST['_wpnonce']) && $_POST['_wpnonce']) {
760 wp_verify_nonce($_POST['_wpnonce'], 'wp_chatbot');
761 // Check if the form is submitted or not
762 if (isset($_POST['submit'])) {
763 //wpwboticon position settings.
764 if (isset($_POST["wp_chatbot_position_x"])) {
765 $wp_chatbot_position_x = intval(($_POST["wp_chatbot_position_x"]));
766 update_option('wp_chatbot_position_x', $wp_chatbot_position_x);
767 }
768 if (isset($_POST["wp_chatbot_position_y"])) {
769 $wp_chatbot_position_y = intval(($_POST["wp_chatbot_position_y"]));
770 update_option('wp_chatbot_position_y', $wp_chatbot_position_y);
771 }
772 //product search options
773 if(isset($_POST['qlcd_wp_chatbot_search_option'])){
774 $qlcd_wp_chatbot_search_option = sanitize_text_field($_POST['qlcd_wp_chatbot_search_option']);
775 update_option('qlcd_wp_chatbot_search_option', $qlcd_wp_chatbot_search_option);
776 }
777
778 //Enable /disable wpwbot
779 if(isset( $_POST["disable_wp_chatbot"])){
780 $disable_wp_chatbot = sanitize_text_field($_POST["disable_wp_chatbot"]);
781 }else{ $disable_wp_chatbot='';}
782 update_option('disable_wp_chatbot', wp_unslash($disable_wp_chatbot));
783
784 if(isset( $_POST["qlcd_wp_chatbot_admin_email"])){
785 $qlcd_wp_chatbot_admin_email = sanitize_email($_POST["qlcd_wp_chatbot_admin_email"]);
786 }else{ $qlcd_wp_chatbot_admin_email='';}
787 update_option('qlcd_wp_chatbot_admin_email', wp_unslash($qlcd_wp_chatbot_admin_email));
788
789
790 if(isset( $_POST["qlcd_wp_chatbot_from_email"])){
791 $qlcd_wp_chatbot_from_email = sanitize_email($_POST["qlcd_wp_chatbot_from_email"]);
792 }else{ $qlcd_wp_chatbot_from_email='';}
793 update_option('qlcd_wp_chatbot_from_email', wp_unslash($qlcd_wp_chatbot_from_email));
794
795 if(isset( $_POST["disable_wp_chatbot_on_mobile"])) {
796 $disable_wp_chatbot_on_mobile = sanitize_text_field($_POST["disable_wp_chatbot_on_mobile"]);
797 }else{ $disable_wp_chatbot_on_mobile='';}
798 update_option('disable_wp_chatbot_on_mobile', wp_unslash($disable_wp_chatbot_on_mobile));
799 if(isset( $_POST["disable_wp_chatbot_product_search"])) {
800 $disable_wp_chatbot_product_search = sanitize_text_field($_POST["disable_wp_chatbot_product_search"]);
801 }else{ $disable_wp_chatbot_product_search='';}
802 update_option('disable_wp_chatbot_product_search', wp_unslash($disable_wp_chatbot_product_search));
803 if(isset( $_POST["disable_wp_chatbot_catalog"])) {
804 $disable_wp_chatbot_catalog= sanitize_text_field($_POST["disable_wp_chatbot_catalog"]);
805 }else{ $disable_wp_chatbot_catalog='';}
806 update_option('disable_wp_chatbot_catalog', wp_unslash($disable_wp_chatbot_catalog));
807 if(isset( $_POST["disable_wp_chatbot_order_status"])) {
808 $disable_wp_chatbot_order_status = sanitize_text_field($_POST["disable_wp_chatbot_order_status"]);
809 }else{ $disable_wp_chatbot_order_status='';}
810 update_option('disable_wp_chatbot_order_status', wp_unslash($disable_wp_chatbot_order_status));
811 if(isset( $_POST["disable_wp_chatbot_notification"])) {
812 $disable_wp_chatbot_notification = sanitize_text_field($_POST["disable_wp_chatbot_notification"]);
813 }else{ $disable_wp_chatbot_notification='1';}
814 update_option('disable_wp_chatbot_notification', wp_unslash($disable_wp_chatbot_notification));
815
816 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
817 $enable_wp_chatbot_rtl = sanitize_text_field($_POST["enable_wp_chatbot_rtl"]);
818 }else{ $enable_wp_chatbot_rtl='';}
819 update_option('enable_wp_chatbot_rtl', wp_unslash($enable_wp_chatbot_rtl));
820
821 if(isset( $_POST["show_menu_after_greetings"])) {
822 $show_menu_after_greetings = sanitize_text_field($_POST["show_menu_after_greetings"]);
823 }else{ $show_menu_after_greetings='';}
824 update_option('show_menu_after_greetings', wp_unslash($show_menu_after_greetings));
825 if(isset( $_POST["enable_chat_session"])) {
826 $enable_chat_session = sanitize_text_field($_POST["enable_chat_session"]);
827 }else{ $enable_chat_session='';}
828 update_option('enable_chat_session', wp_unslash($enable_chat_session));
829
830
831 if(isset( $_POST["enable_wp_chatbot_mobile_full_screen"])) {
832 $enable_wp_chatbot_mobile_full_screen = sanitize_text_field($_POST["enable_wp_chatbot_mobile_full_screen"]);
833 }else{ $enable_wp_chatbot_mobile_full_screen='';}
834 update_option('enable_wp_chatbot_mobile_full_screen', wp_unslash($enable_wp_chatbot_mobile_full_screen));
835
836 if(isset( $_POST["wpbot_preloading_time"])) {
837 $wpbot_preloading_time = sanitize_text_field($_POST["wpbot_preloading_time"]);
838 }else{ $wpbot_preloading_time='100';}
839 update_option('wpbot_preloading_time', wp_unslash($wpbot_preloading_time));
840
841 if(isset( $_POST["disable_wp_chatbot_icon_animation"])) {
842 $disable_wp_chatbot_icon_animation = sanitize_text_field($_POST["disable_wp_chatbot_icon_animation"]);
843 }else{ $disable_wp_chatbot_icon_animation='';}
844 update_option('disable_wp_chatbot_icon_animation', wp_unslash($disable_wp_chatbot_icon_animation));
845 //Enable /disable Cart Item Number
846 if(isset( $_POST["disable_wp_chatbot_cart_item_number"])) {
847 $disable_wp_chatbot_cart_item_number = sanitize_text_field($_POST["disable_wp_chatbot_cart_item_number"]);
848 }else{ $disable_wp_chatbot_cart_item_number='';}
849 update_option('disable_wp_chatbot_cart_item_number', wp_unslash($disable_wp_chatbot_cart_item_number));
850 //Enable /disable featured products button.
851 if(isset( $_POST["disable_wp_chatbot_featured_product"])) {
852 $disable_wp_chatbot_featured_product = sanitize_text_field($_POST["disable_wp_chatbot_featured_product"]);
853 }else{ $disable_wp_chatbot_featured_product='';}
854 update_option('disable_wp_chatbot_featured_product', wp_unslash($disable_wp_chatbot_featured_product));
855 //Enable /disable sale products button
856 if(isset( $_POST["disable_wp_chatbot_sale_product"])) {
857 $disable_wp_chatbot_sale_product = sanitize_text_field($_POST["disable_wp_chatbot_sale_product"]);
858 }else{ $disable_wp_chatbot_sale_product='';}
859 update_option('disable_wp_chatbot_sale_product', wp_unslash($disable_wp_chatbot_sale_product));
860 //Enable Product details page.
861 if(isset( $_POST["wp_chatbot_open_product_detail"])) {
862 $wp_chatbot_open_product_detail = sanitize_text_field($_POST["wp_chatbot_open_product_detail"]);
863 }else{ $wp_chatbot_open_product_detail='';}
864 update_option('wp_chatbot_open_product_detail', wp_unslash($wp_chatbot_open_product_detail));
865 //product order and order by
866 if(isset($_POST['qlcd_wp_chatbot_product_orderby'])){
867 $qlcd_wp_chatbot_product_orderby = sanitize_text_field($_POST['qlcd_wp_chatbot_product_orderby']);
868 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field($qlcd_wp_chatbot_product_orderby));
869 }
870 if(isset($_POST['qlcd_wp_chatbot_product_order'])){
871 $qlcd_wp_chatbot_product_order = sanitize_text_field($_POST['qlcd_wp_chatbot_product_order']);
872 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field($qlcd_wp_chatbot_product_order));
873 }
874
875
876 //Product per page settings.
877 if (isset($_POST["qlcd_wp_chatbot_ppp"])) {
878 $qlcd_wp_chatbot_ppp = sanitize_text_field($_POST["qlcd_wp_chatbot_ppp"]);
879 update_option('qlcd_wp_chatbot_ppp', intval($qlcd_wp_chatbot_ppp));
880 }
881 if(isset( $_POST["wp_chatbot_exclude_stock_out_product"])) {
882 $wp_chatbot_exclude_stock_out_product = sanitize_text_field($_POST['wp_chatbot_exclude_stock_out_product']);
883 }else{ $wp_chatbot_exclude_stock_out_product='';}
884 update_option('wp_chatbot_exclude_stock_out_product', wp_unslash($wp_chatbot_exclude_stock_out_product));
885 if(isset( $_POST["wp_chatbot_show_parent_category"])) {
886 $wp_chatbot_show_parent_category = sanitize_text_field($_POST['wp_chatbot_show_parent_category']);
887 }else{ $wp_chatbot_show_parent_category='';}
888 update_option('wp_chatbot_show_parent_category', wp_unslash($wp_chatbot_show_parent_category));
889 if(isset( $_POST["wp_chatbot_show_sub_category"])) {
890 $wp_chatbot_show_sub_category = sanitize_text_field($_POST['wp_chatbot_show_sub_category']);
891 }else{ $wp_chatbot_show_sub_category='';}
892 update_option('wp_chatbot_show_sub_category', wp_unslash($wp_chatbot_show_sub_category));
893 if (isset($_POST["qlcd_wp_chatbot_order_user"])) {
894 $qlcd_wp_chatbot_order_user = sanitize_text_field($_POST["qlcd_wp_chatbot_order_user"]);
895 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field($qlcd_wp_chatbot_order_user));
896 }
897
898 if(isset( $_POST["qc_wpbot_menu_order"]) && !empty($_POST["qc_wpbot_menu_order"])) {
899 $qc_wpbot_menu_order = wp_kses_post($_POST["qc_wpbot_menu_order"]);
900 }else{ $qc_wpbot_menu_order='';}
901 update_option('qc_wpbot_menu_order', ($qc_wpbot_menu_order));
902
903 //wpwBot Load control
904 if(isset($_POST["wp_chatbot_show_home_page"])){
905 $wp_chatbot_show_home_page = sanitize_key(($_POST["wp_chatbot_show_home_page"]));
906 update_option('wp_chatbot_show_home_page', $wp_chatbot_show_home_page);
907 }
908
909
910 if(isset($_POST["wp_chatbot_show_posts"])){
911 $wp_chatbot_show_posts = sanitize_key(($_POST["wp_chatbot_show_posts"]));
912 update_option('wp_chatbot_show_posts', $wp_chatbot_show_posts);
913 }
914
915
916 if(isset($_POST["wp_chatbot_show_pages"])){
917 $wp_chatbot_show_pages = sanitize_key(($_POST["wp_chatbot_show_pages"]));
918 update_option('wp_chatbot_show_pages', $wp_chatbot_show_pages);
919 }
920
921 if(isset( $_POST["wp_chatbot_show_pages_list"])) {
922 $wp_chatbot_show_pages_list = wp_parse_id_list($_POST["wp_chatbot_show_pages_list"]);
923 update_option('wp_chatbot_show_pages_list', serialize($wp_chatbot_show_pages_list));
924 }else{
925 $wp_chatbot_show_pages_list='';
926 update_option('wp_chatbot_show_pages_list', serialize($wp_chatbot_show_pages_list));
927 }
928 if(isset( $_POST["wp_chatbot_exclude_post_list"])) {
929 $wp_chatbot_exclude_post_list = $_POST["wp_chatbot_exclude_post_list"];
930 }else{ $wp_chatbot_exclude_post_list='';}
931 update_option('wp_chatbot_exclude_post_list', serialize($wp_chatbot_exclude_post_list));
932
933 if(isset($_POST["wp_chatbot_show_wpcommerce"])){
934 $wp_chatbot_show_wpcommerce = sanitize_key(($_POST["wp_chatbot_show_wpcommerce"]));
935 update_option('wp_chatbot_show_wpcommerce', $wp_chatbot_show_wpcommerce);
936 }
937
938
939 //Stop Words Settings
940 if (isset($_POST["qlcd_wp_chatbot_stop_words_name"])) {
941 $qlcd_wp_chatbot_stop_words_name = sanitize_text_field($_POST["qlcd_wp_chatbot_stop_words_name"]);
942 update_option('qlcd_wp_chatbot_stop_words_name', $qlcd_wp_chatbot_stop_words_name);
943 }
944 if (isset($_POST["qlcd_wp_chatbot_stop_words"])) {
945 $qlcd_wp_chatbot_stop_words = sanitize_text_field($_POST["qlcd_wp_chatbot_stop_words"]);
946 update_option('qlcd_wp_chatbot_stop_words', $qlcd_wp_chatbot_stop_words);
947 }
948 //wpwbot icon settings.
949 $wp_chatbot_icon = isset( $_POST['wp_chatbot_icon'] ) ? sanitize_text_field($_POST['wp_chatbot_icon']) : 'icon-3.png';
950 update_option('wp_chatbot_icon', $wp_chatbot_icon);
951
952 $wp_chatbot_floatingiconbg_color = isset( $_POST['wp_chatbot_floatingiconbg_color'] ) ? sanitize_text_field($_POST['wp_chatbot_floatingiconbg_color']) : '#fff';
953 update_option('wp_chatbot_floatingiconbg_color', $wp_chatbot_floatingiconbg_color);
954
955 // upload custom wpwbot icon path
956 $wp_chatbot_custom_icon_path = sanitize_text_field($_POST['wp_chatbot_custom_icon_path']);
957 update_option('wp_chatbot_custom_icon_path', $wp_chatbot_custom_icon_path);
958 //Agent image
959 //wpwbot icon settings.
960 $wp_chatbot_icon = (isset($_POST['wp_chatbot_agent_image']) ? sanitize_text_field($_POST['wp_chatbot_agent_image']) : 'agent-0.png');
961 update_option('wp_chatbot_agent_image', $wp_chatbot_icon);
962 // upload custom wpwbot icon
963 if(isset($_POST['wp_chatbot_custom_agent_path'])){
964 $wp_chatbot_custom_agent_path = sanitize_text_field($_POST['wp_chatbot_custom_agent_path']);
965 update_option('wp_chatbot_custom_agent_path', $wp_chatbot_custom_agent_path);
966 }
967
968 //Theming
969 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? sanitize_text_field($_POST['qcld_wb_chatbot_theme']) : 'template-00');
970 update_option('qcld_wb_chatbot_theme', $qcld_wb_chatbot_theme);
971 //Theme custom background option
972 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
973 $qcld_wb_chatbot_change_bg = sanitize_text_field($_POST["qcld_wb_chatbot_change_bg"]);
974 }else{$qcld_wb_chatbot_change_bg='';}
975 update_option('qcld_wb_chatbot_change_bg', $qcld_wb_chatbot_change_bg);
976 if(isset($_POST["qcld_wb_chatbot_board_bg_path"])){
977 $qcld_wb_chatbot_board_bg_path = sanitize_text_field($_POST["qcld_wb_chatbot_board_bg_path"]);
978 update_option('qcld_wb_chatbot_board_bg_path', wp_unslash($qcld_wb_chatbot_board_bg_path));
979 }
980
981
982
983 //To override style use custom css.
984 if(isset($_POST["wp_chatbot_custom_css"])){
985 $wp_chatbot_custom_css = wp_unslash($_POST["wp_chatbot_custom_css"]);
986 update_option('wp_chatbot_custom_css', $wp_chatbot_custom_css);
987 }
988
989 $qlcd_wp_chatbot_dialogflow_project_id= @$_POST["qlcd_wp_chatbot_dialogflow_project_id"];
990 update_option('qlcd_wp_chatbot_dialogflow_project_id', sanitize_text_field($qlcd_wp_chatbot_dialogflow_project_id));
991
992 $wp_chatbot_df_api= @$_POST["wp_chatbot_df_api"];
993 update_option('wp_chatbot_df_api', sanitize_text_field($wp_chatbot_df_api));
994
995
996
997 $qlcd_wp_chatbot_dialogflow_project_key= @$_POST["qlcd_wp_chatbot_dialogflow_project_key"];
998 update_option('qlcd_wp_chatbot_dialogflow_project_key', wp_unslash($qlcd_wp_chatbot_dialogflow_project_key));
999
1000 /****Language center settings. ****/
1001 //identity
1002 $qlcd_wp_chatbot_host = @$_POST["qlcd_wp_chatbot_host"];
1003 update_option('qlcd_wp_chatbot_host', sanitize_text_field($qlcd_wp_chatbot_host));
1004 $qlcd_wp_chatbot_agent = @$_POST["qlcd_wp_chatbot_agent"];
1005 update_option('qlcd_wp_chatbot_agent', sanitize_text_field($qlcd_wp_chatbot_agent));
1006 $qlcd_wp_chatbot_shopper_demo_name = @$_POST["qlcd_wp_chatbot_shopper_demo_name"];
1007 update_option('qlcd_wp_chatbot_shopper_demo_name', sanitize_text_field($qlcd_wp_chatbot_shopper_demo_name));
1008 $qlcd_wp_chatbot_yes = @$_POST["qlcd_wp_chatbot_yes"];
1009 update_option('qlcd_wp_chatbot_yes', sanitize_text_field($qlcd_wp_chatbot_yes));
1010 $qlcd_wp_chatbot_no = @$_POST["qlcd_wp_chatbot_no"];
1011 update_option('qlcd_wp_chatbot_no', sanitize_text_field($qlcd_wp_chatbot_no));
1012 $qlcd_wp_chatbot_or = @$_POST["qlcd_wp_chatbot_or"];
1013 update_option('qlcd_wp_chatbot_or', sanitize_text_field($qlcd_wp_chatbot_or));
1014 $qlcd_wp_chatbot_sorry = @$_POST["qlcd_wp_chatbot_sorry"];
1015 update_option('qlcd_wp_chatbot_sorry', sanitize_text_field($qlcd_wp_chatbot_sorry));
1016 $qlcd_wp_chatbot_agent_join = @$_POST["qlcd_wp_chatbot_agent_join"];
1017 update_option('qlcd_wp_chatbot_agent_join', serialize($qlcd_wp_chatbot_agent_join));
1018 //Greeting.
1019 $qlcd_wp_chatbot_welcome = @$_POST["qlcd_wp_chatbot_welcome"];
1020 update_option('qlcd_wp_chatbot_welcome', serialize($qlcd_wp_chatbot_welcome));
1021 $qlcd_wp_chatbot_back_to_start = @$_POST["qlcd_wp_chatbot_back_to_start"];
1022 update_option('qlcd_wp_chatbot_back_to_start', serialize($qlcd_wp_chatbot_back_to_start));
1023 $qlcd_wp_chatbot_hi_there = @$_POST["qlcd_wp_chatbot_hi_there"];
1024 update_option('qlcd_wp_chatbot_hi_there', serialize($qlcd_wp_chatbot_hi_there));
1025 $qlcd_wp_chatbot_hello = @$_POST["qlcd_wp_chatbot_hello"];
1026 update_option('qlcd_wp_chatbot_hello', serialize($qlcd_wp_chatbot_hello));
1027 $qlcd_wp_chatbot_welcome_back = @$_POST["qlcd_wp_chatbot_welcome_back"];
1028 update_option('qlcd_wp_chatbot_welcome_back', serialize($qlcd_wp_chatbot_welcome_back));
1029 $qlcd_wp_chatbot_asking_name = @$_POST["qlcd_wp_chatbot_asking_name"];
1030 update_option('qlcd_wp_chatbot_asking_name', serialize($qlcd_wp_chatbot_asking_name));
1031 $qlcd_wp_chatbot_name_greeting = @$_POST["qlcd_wp_chatbot_name_greeting"];
1032 update_option('qlcd_wp_chatbot_name_greeting', serialize($qlcd_wp_chatbot_name_greeting));
1033 $qlcd_wp_chatbot_i_am = @$_POST["qlcd_wp_chatbot_i_am"];
1034 update_option('qlcd_wp_chatbot_i_am', serialize($qlcd_wp_chatbot_i_am));
1035 $qlcd_wp_chatbot_is_typing = @$_POST["qlcd_wp_chatbot_is_typing"];
1036 update_option('qlcd_wp_chatbot_is_typing', serialize($qlcd_wp_chatbot_is_typing));
1037 $qlcd_wp_chatbot_send_a_msg= @$_POST["qlcd_wp_chatbot_send_a_msg"];
1038 update_option('qlcd_wp_chatbot_send_a_msg', serialize($qlcd_wp_chatbot_send_a_msg));
1039 $qlcd_wp_chatbot_choose_option= @$_POST["qlcd_wp_chatbot_choose_option"];
1040 update_option('qlcd_wp_chatbot_choose_option', serialize($qlcd_wp_chatbot_choose_option));
1041 $qlcd_wp_chatbot_viewed_products= @$_POST["qlcd_wp_chatbot_viewed_products"];
1042 update_option('qlcd_wp_chatbot_viewed_products', serialize($qlcd_wp_chatbot_viewed_products));
1043 $qlcd_wp_chatbot_shopping_cart= @$_POST["qlcd_wp_chatbot_shopping_cart"];
1044 update_option('qlcd_wp_chatbot_shopping_cart', serialize($qlcd_wp_chatbot_shopping_cart));
1045 $qlcd_wp_chatbot_add_to_cart= @$_POST["qlcd_wp_chatbot_add_to_cart"];
1046 update_option('qlcd_wp_chatbot_add_to_cart', serialize($qlcd_wp_chatbot_add_to_cart));
1047 $qlcd_wp_chatbot_cart_link= @$_POST["qlcd_wp_chatbot_cart_link"];
1048 update_option('qlcd_wp_chatbot_cart_link', serialize($qlcd_wp_chatbot_cart_link));
1049 $qlcd_wp_chatbot_checkout_link= @$_POST["qlcd_wp_chatbot_checkout_link"];
1050 update_option('qlcd_wp_chatbot_checkout_link', serialize($qlcd_wp_chatbot_checkout_link));
1051 $qlcd_wp_chatbot_cart_welcome= @$_POST["qlcd_wp_chatbot_cart_welcome"];
1052 update_option('qlcd_wp_chatbot_cart_welcome', serialize($qlcd_wp_chatbot_cart_welcome));
1053 $qlcd_wp_chatbot_featured_product_welcome= @$_POST["qlcd_wp_chatbot_featured_product_welcome"];
1054 update_option('qlcd_wp_chatbot_featured_product_welcome', serialize($qlcd_wp_chatbot_featured_product_welcome));
1055 $qlcd_wp_chatbot_viewed_product_welcome= @$_POST["qlcd_wp_chatbot_viewed_product_welcome"];
1056 update_option('qlcd_wp_chatbot_viewed_product_welcome', serialize($qlcd_wp_chatbot_viewed_product_welcome));
1057 $qlcd_wp_chatbot_latest_product_welcome= @$_POST["qlcd_wp_chatbot_latest_product_welcome"];
1058 update_option('qlcd_wp_chatbot_latest_product_welcome', serialize($qlcd_wp_chatbot_latest_product_welcome));
1059 $qlcd_wp_chatbot_cart_title= @$_POST["qlcd_wp_chatbot_cart_title"];
1060 update_option('qlcd_wp_chatbot_cart_title', serialize($qlcd_wp_chatbot_cart_title));
1061 $qlcd_wp_chatbot_cart_quantity= @$_POST["qlcd_wp_chatbot_cart_quantity"];
1062 update_option('qlcd_wp_chatbot_cart_quantity', serialize($qlcd_wp_chatbot_cart_quantity));
1063 $qlcd_wp_chatbot_cart_price= @$_POST["qlcd_wp_chatbot_cart_price"];
1064 update_option('qlcd_wp_chatbot_cart_price', serialize($qlcd_wp_chatbot_cart_price));
1065 $qlcd_wp_chatbot_no_cart_items= @$_POST["qlcd_wp_chatbot_no_cart_items"];
1066 update_option('qlcd_wp_chatbot_no_cart_items', serialize($qlcd_wp_chatbot_no_cart_items));
1067 $qlcd_wp_chatbot_cart_updating= @$_POST["qlcd_wp_chatbot_cart_updating"];
1068 update_option('qlcd_wp_chatbot_cart_updating', serialize($qlcd_wp_chatbot_cart_updating));
1069 $qlcd_wp_chatbot_cart_removing= @$_POST["qlcd_wp_chatbot_cart_removing"];
1070 update_option('qlcd_wp_chatbot_cart_removing', serialize($qlcd_wp_chatbot_cart_removing));
1071 //wpwBot wildcard settings
1072 $qlcd_wp_chatbot_wildcard_msg = @$_POST["qlcd_wp_chatbot_wildcard_msg"];
1073 update_option('qlcd_wp_chatbot_wildcard_msg', serialize($qlcd_wp_chatbot_wildcard_msg));
1074 //empty filter message repeat.
1075 $qlcd_wp_chatbot_empty_filter_msg = @$_POST["qlcd_wp_chatbot_empty_filter_msg"];
1076 update_option('qlcd_wp_chatbot_empty_filter_msg', serialize($qlcd_wp_chatbot_empty_filter_msg));
1077
1078 $qlcd_wp_chatbot_did_you_mean = @$_POST["qlcd_wp_chatbot_did_you_mean"];
1079 update_option('qlcd_wp_chatbot_did_you_mean', serialize($qlcd_wp_chatbot_did_you_mean));
1080 //help welcome and message
1081 $qlcd_wp_chatbot_help_welcome = @$_POST["qlcd_wp_chatbot_help_welcome"];
1082 update_option('qlcd_wp_chatbot_help_welcome', serialize($qlcd_wp_chatbot_help_welcome));
1083 $qlcd_wp_chatbot_help_msg = @$_POST["qlcd_wp_chatbot_help_msg"];
1084 update_option('qlcd_wp_chatbot_help_msg', serialize($qlcd_wp_chatbot_help_msg));
1085 //To clear Conversation history.
1086 $qlcd_wp_chatbot_reset = @$_POST["qlcd_wp_chatbot_reset"];
1087 update_option('qlcd_wp_chatbot_reset', serialize($qlcd_wp_chatbot_reset));
1088 //systems keyword.
1089 $qlcd_wp_chatbot_sys_key_help = @$_POST["qlcd_wp_chatbot_sys_key_help"];
1090 update_option('qlcd_wp_chatbot_sys_key_help', sanitize_text_field($qlcd_wp_chatbot_sys_key_help));
1091 $qlcd_wp_chatbot_sys_key_product = @$_POST["qlcd_wp_chatbot_sys_key_product"];
1092 update_option('qlcd_wp_chatbot_sys_key_product', sanitize_text_field($qlcd_wp_chatbot_sys_key_product));
1093 $qlcd_wp_chatbot_sys_key_catalog = @$_POST["qlcd_wp_chatbot_sys_key_catalog"];
1094 update_option('qlcd_wp_chatbot_sys_key_catalog', sanitize_text_field($qlcd_wp_chatbot_sys_key_catalog));
1095 $qlcd_wp_chatbot_sys_key_order = @$_POST["qlcd_wp_chatbot_sys_key_order"];
1096 update_option('qlcd_wp_chatbot_sys_key_order', sanitize_text_field($qlcd_wp_chatbot_sys_key_order));
1097 $qlcd_wp_chatbot_sys_key_support = @$_POST["qlcd_wp_chatbot_sys_key_support"];
1098 update_option('qlcd_wp_chatbot_sys_key_support', sanitize_text_field($qlcd_wp_chatbot_sys_key_support));
1099 $qlcd_wp_chatbot_sys_key_reset = @$_POST["qlcd_wp_chatbot_sys_key_reset"];
1100 update_option('qlcd_wp_chatbot_sys_key_reset', sanitize_text_field($qlcd_wp_chatbot_sys_key_reset));
1101 $qlcd_wp_chatbot_sys_key_email = @$_POST["qlcd_wp_chatbot_sys_key_email"];
1102 update_option('qlcd_wp_chatbot_sys_key_email', sanitize_text_field($qlcd_wp_chatbot_sys_key_email));
1103 $qlcd_wp_chatbot_wildcard_product = @$_POST["qlcd_wp_chatbot_wildcard_product"];
1104 update_option('qlcd_wp_chatbot_wildcard_product', serialize($qlcd_wp_chatbot_wildcard_product));
1105 $qlcd_wp_chatbot_wildcard_catalog = @$_POST["qlcd_wp_chatbot_wildcard_catalog"];
1106 update_option('qlcd_wp_chatbot_wildcard_catalog', serialize($qlcd_wp_chatbot_wildcard_catalog));
1107 $qlcd_wp_chatbot_featured_products = @$_POST["qlcd_wp_chatbot_featured_products"];
1108 update_option('qlcd_wp_chatbot_featured_products', serialize($qlcd_wp_chatbot_featured_products));
1109 $qlcd_wp_chatbot_sale_products = @$_POST["qlcd_wp_chatbot_sale_products"];
1110 update_option('qlcd_wp_chatbot_sale_products', serialize($qlcd_wp_chatbot_sale_products));
1111 $qlcd_wp_chatbot_wildcard_support = @$_POST["qlcd_wp_chatbot_wildcard_support"];
1112 update_option('qlcd_wp_chatbot_wildcard_support', sanitize_text_field($qlcd_wp_chatbot_wildcard_support));
1113 $qlcd_wp_chatbot_messenger_label = @$_POST["qlcd_wp_chatbot_messenger_label"];
1114 update_option('qlcd_wp_chatbot_messenger_label', serialize($qlcd_wp_chatbot_messenger_label));
1115 //Products search .
1116 if (isset($_POST["qlcd_wp_chatbot_product_success"])) {
1117 $qlcd_wp_chatbot_product_success = @$_POST["qlcd_wp_chatbot_product_success"];
1118 update_option('qlcd_wp_chatbot_product_success', serialize($qlcd_wp_chatbot_product_success));
1119 }
1120 if (isset($_POST["qlcd_wp_chatbot_product_fail"])) {
1121 $qlcd_wp_chatbot_product_fail = @$_POST["qlcd_wp_chatbot_product_fail"];
1122 update_option('qlcd_wp_chatbot_product_fail', serialize($qlcd_wp_chatbot_product_fail));
1123 }
1124 $qlcd_wp_chatbot_product_asking = @$_POST["qlcd_wp_chatbot_product_asking"];
1125 update_option('qlcd_wp_chatbot_product_asking', serialize($qlcd_wp_chatbot_product_asking));
1126 $qlcd_wp_chatbot_product_suggest = @$_POST["qlcd_wp_chatbot_product_suggest"];
1127 update_option('qlcd_wp_chatbot_product_suggest', serialize($qlcd_wp_chatbot_product_suggest));
1128 $qlcd_wp_chatbot_product_infinite = @$_POST["qlcd_wp_chatbot_product_infinite"];
1129 update_option('qlcd_wp_chatbot_product_infinite', serialize($qlcd_wp_chatbot_product_infinite));
1130 $qlcd_wp_chatbot_load_more = @$_POST["qlcd_wp_chatbot_load_more"];
1131 update_option('qlcd_wp_chatbot_load_more', serialize($qlcd_wp_chatbot_load_more));
1132 //Order
1133 $qlcd_wp_chatbot_wildcard_order = @$_POST["qlcd_wp_chatbot_wildcard_order"];
1134 update_option('qlcd_wp_chatbot_wildcard_order', serialize($qlcd_wp_chatbot_wildcard_order));
1135 $qlcd_wp_chatbot_order_welcome = @$_POST["qlcd_wp_chatbot_order_welcome"];
1136 update_option('qlcd_wp_chatbot_order_welcome', serialize($qlcd_wp_chatbot_order_welcome));
1137 $qlcd_wp_chatbot_order_username_asking = @$_POST["qlcd_wp_chatbot_order_username_asking"];
1138 update_option('qlcd_wp_chatbot_order_username_asking', serialize($qlcd_wp_chatbot_order_username_asking));
1139 $qlcd_wp_chatbot_order_username_not_exist = @$_POST["qlcd_wp_chatbot_order_username_not_exist"];
1140 update_option('qlcd_wp_chatbot_order_username_not_exist', serialize($qlcd_wp_chatbot_order_username_not_exist));
1141 $qlcd_wp_chatbot_order_username_thanks = @$_POST["qlcd_wp_chatbot_order_username_thanks"];
1142 update_option('qlcd_wp_chatbot_order_username_thanks', serialize($qlcd_wp_chatbot_order_username_thanks));
1143 $qlcd_wp_chatbot_order_username_password = @$_POST["qlcd_wp_chatbot_order_username_password"];
1144 update_option('qlcd_wp_chatbot_order_username_password', serialize($qlcd_wp_chatbot_order_username_password));
1145 $qlcd_wp_chatbot_order_password_incorrect= @$_POST["qlcd_wp_chatbot_order_password_incorrect"];
1146 update_option('qlcd_wp_chatbot_order_password_incorrect', serialize($qlcd_wp_chatbot_order_password_incorrect));
1147 $qlcd_wp_chatbot_order_not_found= @$_POST["qlcd_wp_chatbot_order_not_found"];
1148 update_option('qlcd_wp_chatbot_order_not_found', serialize($qlcd_wp_chatbot_order_not_found));
1149 $qlcd_wp_chatbot_order_found= @$_POST["qlcd_wp_chatbot_order_found"];
1150 update_option('qlcd_wp_chatbot_order_found', serialize($qlcd_wp_chatbot_order_found));
1151 $qlcd_wp_chatbot_order_email_support= @$_POST["qlcd_wp_chatbot_order_email_support"];
1152 update_option('qlcd_wp_chatbot_order_email_support', serialize($qlcd_wp_chatbot_order_email_support));
1153 //Support
1154 $qlcd_wp_chatbot_support_welcome = @$_POST["qlcd_wp_chatbot_support_welcome"];
1155 update_option('qlcd_wp_chatbot_support_welcome', serialize($qlcd_wp_chatbot_support_welcome));
1156 $qlcd_wp_chatbot_support_email = @$_POST["qlcd_wp_chatbot_support_email"];
1157 update_option('qlcd_wp_chatbot_support_email', sanitize_text_field($qlcd_wp_chatbot_support_email));
1158 $qlcd_wp_chatbot_asking_email = @$_POST["qlcd_wp_chatbot_asking_email"];
1159 update_option('qlcd_wp_chatbot_asking_email', serialize($qlcd_wp_chatbot_asking_email));
1160 $qlcd_wp_chatbot_asking_msg = @$_POST["qlcd_wp_chatbot_asking_msg"];
1161 update_option('qlcd_wp_chatbot_asking_msg', serialize($qlcd_wp_chatbot_asking_msg));
1162
1163 $qlcd_wp_chatbot_no_result = @$_POST["qlcd_wp_chatbot_no_result"];
1164 update_option('qlcd_wp_chatbot_no_result', serialize($qlcd_wp_chatbot_no_result));
1165
1166 $qlcd_wp_chatbot_support_option_again = @$_POST["qlcd_wp_chatbot_support_option_again"];
1167 update_option('qlcd_wp_chatbot_support_option_again', serialize($qlcd_wp_chatbot_support_option_again));
1168 $qlcd_wp_chatbot_invalid_email = @$_POST["qlcd_wp_chatbot_invalid_email"];
1169 update_option('qlcd_wp_chatbot_invalid_email', serialize($qlcd_wp_chatbot_invalid_email));
1170 $qlcd_wp_chatbot_support_phone= @$_POST["qlcd_wp_chatbot_support_phone"];
1171
1172 update_option('qlcd_wp_chatbot_support_phone', sanitize_text_field($qlcd_wp_chatbot_support_phone));
1173 $qlcd_wp_chatbot_asking_phone= @$_POST["qlcd_wp_chatbot_asking_phone"];
1174 update_option('qlcd_wp_chatbot_asking_phone', serialize($qlcd_wp_chatbot_asking_phone));
1175 $qlcd_wp_chatbot_thank_for_phone= @$_POST["qlcd_wp_chatbot_thank_for_phone"];
1176 update_option('qlcd_wp_chatbot_thank_for_phone', serialize($qlcd_wp_chatbot_thank_for_phone));
1177 $qlcd_wp_chatbot_admin_email = @$_POST["qlcd_wp_chatbot_admin_email"];
1178 update_option('qlcd_wp_chatbot_admin_email', sanitize_text_field($qlcd_wp_chatbot_admin_email));
1179
1180 $qlcd_wp_chatbot_email_sub = @$_POST["qlcd_wp_chatbot_email_sub"];
1181 update_option('qlcd_wp_chatbot_email_sub', sanitize_text_field($qlcd_wp_chatbot_email_sub));
1182
1183 $qlcd_wp_site_search = @$_POST["qlcd_wp_site_search"];
1184 update_option('qlcd_wp_site_search', sanitize_text_field($qlcd_wp_site_search));
1185
1186 $qlcd_wp_chatbot_email_sent = @$_POST["qlcd_wp_chatbot_email_sent"];
1187 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field($qlcd_wp_chatbot_email_sent));
1188 $qlcd_wp_chatbot_email_fail = @$_POST["qlcd_wp_chatbot_email_fail"];
1189 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field($qlcd_wp_chatbot_email_fail));
1190 //Notifications messages building.
1191 $qlcd_wp_chatbot_notification_interval = @$_POST["qlcd_wp_chatbot_notification_interval"];
1192 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field($qlcd_wp_chatbot_notification_interval));
1193 $qlcd_wp_chatbot_notifications = @$_POST["qlcd_wp_chatbot_notifications"];
1194 update_option('qlcd_wp_chatbot_notifications', serialize($qlcd_wp_chatbot_notifications));
1195 //Support building part.
1196 $support_query = @$_POST["support_query"];
1197 update_option('support_query', serialize($support_query));
1198 $support_ans = @$_POST["support_ans"];
1199 update_option('support_ans', serialize($support_ans));
1200 //Create Mobile app pages.
1201 if(isset( $_POST["wp_chatbot_app_pages"])) {
1202 $wp_chatbot_app_pages = $_POST["wp_chatbot_app_pages"];
1203 }else{ $wp_chatbot_app_pages='';}
1204 update_option('wp_chatbot_app_pages', wp_unslash($wp_chatbot_app_pages));
1205 //Messenger Options
1206 if(isset( $_POST["enable_wp_chatbot_messenger"])) {
1207 $enable_wp_chatbot_messenger = $_POST["enable_wp_chatbot_messenger"];
1208 }else{ $enable_wp_chatbot_messenger='';}
1209 update_option('enable_wp_chatbot_messenger', wp_unslash($enable_wp_chatbot_messenger));
1210 if(isset( $_POST["enable_wp_chatbot_messenger_floating_icon"])) {
1211 $enable_wp_chatbot_messenger_floating_icon = $_POST["enable_wp_chatbot_messenger_floating_icon"];
1212 }else{ $enable_wp_chatbot_messenger_floating_icon='';}
1213 update_option('enable_wp_chatbot_messenger_floating_icon', wp_unslash($enable_wp_chatbot_messenger_floating_icon));
1214 $qlcd_wp_chatbot_fb_app_id = @$_POST["qlcd_wp_chatbot_fb_app_id"];
1215 update_option('qlcd_wp_chatbot_fb_app_id', sanitize_text_field($qlcd_wp_chatbot_fb_app_id));
1216 $qlcd_wp_chatbot_fb_page_id = @$_POST["qlcd_wp_chatbot_fb_page_id"];
1217 update_option('qlcd_wp_chatbot_fb_page_id', sanitize_text_field($qlcd_wp_chatbot_fb_page_id));
1218 $qlcd_wp_chatbot_fb_color= @$_POST["qlcd_wp_chatbot_fb_color"];
1219 update_option('qlcd_wp_chatbot_fb_color', wp_unslash($qlcd_wp_chatbot_fb_color));
1220 $qlcd_wp_chatbot_fb_in_msg = @$_POST["qlcd_wp_chatbot_fb_in_msg"];
1221 update_option('qlcd_wp_chatbot_fb_in_msg', sanitize_text_field($qlcd_wp_chatbot_fb_in_msg));
1222 $qlcd_wp_chatbot_fb_out_msg = @$_POST["qlcd_wp_chatbot_fb_out_msg"];
1223 update_option('qlcd_wp_chatbot_fb_out_msg', sanitize_text_field($qlcd_wp_chatbot_fb_out_msg));
1224 //Skype option
1225 if(isset( $_POST["enable_wp_chatbot_skype_floating_icon"])) {
1226 $enable_wp_chatbot_skype_floating_icon = $_POST["enable_wp_chatbot_skype_floating_icon"];
1227 }else{ $enable_wp_chatbot_skype_floating_icon='';}
1228 update_option('enable_wp_chatbot_skype_floating_icon', sanitize_text_field($enable_wp_chatbot_skype_floating_icon));
1229 if(isset( $_POST["enable_wp_chatbot_skype_id"])) {
1230 $enable_wp_chatbot_skype_id = $_POST["enable_wp_chatbot_skype_id"];
1231 }else{ $enable_wp_chatbot_skype_id='';}
1232 update_option('enable_wp_chatbot_skype_id', sanitize_text_field($enable_wp_chatbot_skype_id));
1233 //WhatsApp
1234 if(isset( $_POST["enable_wp_chatbot_whats"])) {
1235 $enable_wp_chatbot_whats= $_POST["enable_wp_chatbot_whats"];
1236 }else{ $enable_wp_chatbot_whats='';}
1237 update_option('enable_wp_chatbot_whats', sanitize_text_field($enable_wp_chatbot_whats));
1238 $qlcd_wp_chatbot_whats_label = @$_POST["qlcd_wp_chatbot_whats_label"];
1239 update_option('qlcd_wp_chatbot_whats_label', serialize($qlcd_wp_chatbot_whats_label));
1240 if(isset( $_POST["enable_wp_chatbot_floating_whats"])) {
1241 $enable_wp_chatbot_floating_whats= $_POST["enable_wp_chatbot_floating_whats"];
1242 }else{ $enable_wp_chatbot_floating_whats='';}
1243 update_option('enable_wp_chatbot_floating_whats', sanitize_text_field($enable_wp_chatbot_floating_whats));
1244 $qlcd_wp_chatbot_whats_num = @$_POST["qlcd_wp_chatbot_whats_num"];
1245 update_option('qlcd_wp_chatbot_whats_num', sanitize_text_field($qlcd_wp_chatbot_whats_num));
1246 //Viber
1247 if(isset( $_POST["enable_wp_chatbot_floating_viber"])) {
1248 $enable_wp_chatbot_floating_viber = $_POST["enable_wp_chatbot_floating_viber"];
1249 }else{ $enable_wp_chatbot_floating_viber='';}
1250 update_option('enable_wp_chatbot_floating_viber', sanitize_text_field($enable_wp_chatbot_floating_viber));
1251 $qlcd_wp_chatbot_viber_acc = @$_POST["qlcd_wp_chatbot_viber_acc"];
1252 update_option('qlcd_wp_chatbot_viber_acc', sanitize_text_field($qlcd_wp_chatbot_viber_acc));
1253 //Others integration
1254 if(isset( $_POST["enable_wp_chatbot_floating_phone"])) {
1255 $enable_wp_chatbot_floating_phone = $_POST["enable_wp_chatbot_floating_phone"];
1256 }else{ $enable_wp_chatbot_floating_phone='';}
1257 update_option('enable_wp_chatbot_floating_phone', sanitize_text_field($enable_wp_chatbot_floating_phone));
1258 $qlcd_wp_chatbot_phone = @$_POST["qlcd_wp_chatbot_phone"];
1259 update_option('qlcd_wp_chatbot_phone', sanitize_text_field($qlcd_wp_chatbot_phone));
1260
1261 if(isset( $_POST["enable_wp_chatbot_floating_link"])) {
1262 $enable_wp_chatbot_floating_link = $_POST["enable_wp_chatbot_floating_link"];
1263 }else{ $enable_wp_chatbot_floating_link='';}
1264 update_option('enable_wp_chatbot_floating_link', sanitize_text_field($enable_wp_chatbot_floating_link));
1265 $qlcd_wp_chatbot_weblink = @$_POST["qlcd_wp_chatbot_weblink"];
1266 update_option('qlcd_wp_chatbot_weblink', sanitize_text_field($qlcd_wp_chatbot_weblink));
1267
1268 //Re Targetting.
1269 $qlcd_wp_chatbot_ret_greet = @$_POST["qlcd_wp_chatbot_ret_greet"];
1270 update_option('qlcd_wp_chatbot_ret_greet', sanitize_text_field($qlcd_wp_chatbot_ret_greet));
1271
1272 if(isset( $_POST["enable_wp_chatbot_exit_intent"])) {
1273 $enable_wp_chatbot_exit_intent = $_POST["enable_wp_chatbot_exit_intent"];
1274 }else{ $enable_wp_chatbot_exit_intent='';}
1275 update_option('enable_wp_chatbot_exit_intent', sanitize_text_field($enable_wp_chatbot_exit_intent));
1276
1277 $wp_chatbot_exit_intent_msg = @$_POST["wp_chatbot_exit_intent_msg"];
1278 update_option('wp_chatbot_exit_intent_msg', wp_unslash($wp_chatbot_exit_intent_msg));
1279
1280 if(isset( $_POST["wp_chatbot_exit_intent_once"])) {
1281 $wp_chatbot_exit_intent_once = $_POST["wp_chatbot_exit_intent_once"];
1282 }else{ $wp_chatbot_exit_intent_once='';}
1283 update_option('wp_chatbot_exit_intent_once', sanitize_text_field($wp_chatbot_exit_intent_once));
1284
1285 if(isset( $_POST["enable_wp_chatbot_scroll_open"])) {
1286 $enable_wp_chatbot_scroll_open = $_POST["enable_wp_chatbot_scroll_open"];
1287 }else{ $enable_wp_chatbot_scroll_open='';}
1288 update_option('enable_wp_chatbot_scroll_open', sanitize_text_field($enable_wp_chatbot_scroll_open));
1289
1290 $wp_chatbot_scroll_open_msg= @$_POST["wp_chatbot_scroll_open_msg"];
1291 update_option('wp_chatbot_scroll_open_msg', wp_unslash($wp_chatbot_scroll_open_msg));
1292
1293 $wp_chatbot_scroll_percent= @$_POST["wp_chatbot_scroll_percent"];
1294 update_option('wp_chatbot_scroll_percent', wp_unslash($wp_chatbot_scroll_percent));
1295
1296 if(isset( $_POST["wp_chatbot_scroll_once"])) {
1297 $wp_chatbot_scroll_once = sanitize_text_field($_POST["wp_chatbot_scroll_once"]);
1298 }else{ $wp_chatbot_scroll_once='';}
1299 update_option('wp_chatbot_scroll_once', $wp_chatbot_scroll_once);
1300
1301 if(isset( $_POST["enable_wp_chatbot_auto_open"])) {
1302 $enable_wp_chatbot_auto_open = sanitize_text_field($_POST["enable_wp_chatbot_auto_open"]);
1303 }else{ $enable_wp_chatbot_auto_open='';}
1304 update_option('enable_wp_chatbot_auto_open', $enable_wp_chatbot_auto_open);
1305
1306 if(isset( $_POST["enable_wp_chatbot_ret_sound"])) {
1307 $enable_wp_chatbot_ret_sound = sanitize_text_field($_POST["enable_wp_chatbot_ret_sound"]);
1308 }else{ $enable_wp_chatbot_ret_sound='';}
1309 update_option('enable_wp_chatbot_ret_sound', $enable_wp_chatbot_ret_sound);
1310
1311 if(isset( $_POST["enable_wp_chatbot_sound_initial"])) {
1312 $enable_wp_chatbot_sound_initial = sanitize_text_field($_POST["enable_wp_chatbot_sound_initial"]);
1313 }else{ $enable_wp_chatbot_sound_initial='';}
1314 update_option('enable_wp_chatbot_sound_initial', $enable_wp_chatbot_sound_initial);
1315
1316
1317 $wp_chatbot_auto_open_msg = @$_POST["wp_chatbot_auto_open_msg"];
1318 update_option('wp_chatbot_auto_open_msg', wp_unslash($wp_chatbot_auto_open_msg));
1319
1320 $wp_chatbot_auto_open_time = @$_POST["wp_chatbot_auto_open_time"];
1321 update_option('wp_chatbot_auto_open_time', wp_unslash($wp_chatbot_auto_open_time));
1322 //to complate checkout
1323 if(isset( $_POST["enable_wp_chatbot_ret_user_show"])) {
1324 $enable_wp_chatbot_ret_user_show = sanitize_text_field($_POST["enable_wp_chatbot_ret_user_show"]);
1325 }else{ $enable_wp_chatbot_ret_user_show='';}
1326 update_option('enable_wp_chatbot_ret_user_show', $enable_wp_chatbot_ret_user_show);
1327
1328 if(isset( $_POST["enable_wp_chatbot_inactive_time_show"])) {
1329 $enable_wp_chatbot_inactive_time_show = sanitize_text_field($_POST["enable_wp_chatbot_inactive_time_show"]);
1330 }else{ $enable_wp_chatbot_inactive_time_show='';}
1331 update_option('enable_wp_chatbot_inactive_time_show', $enable_wp_chatbot_inactive_time_show);
1332
1333 $wp_chatbot_inactive_time = @$_POST["wp_chatbot_inactive_time"];
1334 update_option('wp_chatbot_inactive_time', sanitize_text_field($wp_chatbot_inactive_time));
1335
1336 $wp_chatbot_checkout_msg = @$_POST["wp_chatbot_checkout_msg"];
1337 update_option('wp_chatbot_checkout_msg', wp_unslash($wp_chatbot_checkout_msg));
1338
1339 if(isset( $_POST["wp_chatbot_auto_open_once"])) {
1340 $wp_chatbot_auto_open_once = sanitize_text_field($_POST["wp_chatbot_auto_open_once"]);
1341 }else{ $wp_chatbot_auto_open_once='';}
1342 update_option('wp_chatbot_auto_open_once', $wp_chatbot_auto_open_once);
1343
1344 if(isset( $_POST["wp_chatbot_inactive_once"])) {
1345 $wp_chatbot_inactive_once = sanitize_text_field($_POST["wp_chatbot_inactive_once"]);
1346 }else{ $wp_chatbot_inactive_once='';}
1347 update_option('wp_chatbot_inactive_once', $wp_chatbot_inactive_once);
1348
1349
1350 $wp_chatbot_proactive_bg_color = @$_POST["wp_chatbot_proactive_bg_color"];
1351 update_option('wp_chatbot_proactive_bg_color', sanitize_text_field($wp_chatbot_proactive_bg_color));
1352
1353 if(isset( $_POST["disable_wp_chatbot_call_gen"])) {
1354 $disable_wp_chatbot_call_gen = sanitize_text_field($_POST["disable_wp_chatbot_call_gen"]);
1355 }else{ $disable_wp_chatbot_call_gen='';}
1356 update_option('disable_wp_chatbot_call_gen', $disable_wp_chatbot_call_gen);
1357
1358 if(isset( $_POST["disable_wp_chatbot_site_search"])) {
1359 $disable_wp_chatbot_site_search = sanitize_text_field($_POST["disable_wp_chatbot_site_search"]);
1360 }else{ $disable_wp_chatbot_site_search='';}
1361 update_option('disable_wp_chatbot_site_search', $disable_wp_chatbot_site_search);
1362
1363 if(isset( $_POST["disable_wp_chatbot_call_sup"])) {
1364 $disable_wp_chatbot_call_sup = sanitize_text_field($_POST["disable_wp_chatbot_call_sup"]);
1365 }else{ $disable_wp_chatbot_call_sup='';}
1366 update_option('disable_wp_chatbot_call_sup', $disable_wp_chatbot_call_sup);
1367
1368 if(isset( $_POST["disable_wp_chatbot_feedback"])) {
1369 $disable_wp_chatbot_feedback = sanitize_text_field($_POST["disable_wp_chatbot_feedback"]);
1370 }else{ $disable_wp_chatbot_feedback='';}
1371 update_option('disable_wp_chatbot_feedback', $disable_wp_chatbot_feedback);
1372
1373 if(isset( $_POST["disable_wp_chatbot_faq"])) {
1374 $disable_wp_chatbot_faq = sanitize_text_field($_POST["disable_wp_chatbot_faq"]);
1375 }else{ $disable_wp_chatbot_faq='';}
1376 update_option('disable_wp_chatbot_faq', $disable_wp_chatbot_faq);
1377
1378 $qlcd_wp_chatbot_feedback_label = @$_POST["qlcd_wp_chatbot_feedback_label"];
1379 update_option('qlcd_wp_chatbot_feedback_label', serialize($qlcd_wp_chatbot_feedback_label));
1380
1381 if(isset( $_POST["enable_wp_chatbot_meta_title"])) {
1382 $enable_wp_chatbot_meta_title = sanitize_text_field($_POST["enable_wp_chatbot_meta_title"]);
1383 }else{ $enable_wp_chatbot_meta_title='';}
1384 update_option('enable_wp_chatbot_meta_title', $enable_wp_chatbot_meta_title);
1385
1386 $qlcd_wp_chatbot_meta_label = @$_POST["qlcd_wp_chatbot_meta_label"];
1387 update_option('qlcd_wp_chatbot_meta_label', sanitize_text_field($qlcd_wp_chatbot_meta_label));
1388
1389 $qlcd_wp_chatbot_phone_sent = @$_POST["qlcd_wp_chatbot_phone_sent"];
1390 update_option('qlcd_wp_chatbot_phone_sent', sanitize_text_field($qlcd_wp_chatbot_phone_sent));
1391
1392 $qlcd_wp_chatbot_phone_fail = @$_POST["qlcd_wp_chatbot_phone_fail"];
1393 update_option('qlcd_wp_chatbot_phone_fail', sanitize_text_field($qlcd_wp_chatbot_phone_fail));
1394
1395 if(isset( $_POST["enable_wp_chatbot_opening_hour"])) {
1396 $enable_wp_chatbot_opening_hour = sanitize_text_field($_POST["enable_wp_chatbot_opening_hour"]);
1397 }else{ $enable_wp_chatbot_opening_hour='';}
1398 update_option('enable_wp_chatbot_opening_hour', $enable_wp_chatbot_opening_hour);
1399
1400 $wpwbot_hours= @$_POST["wpwbot_hours"];
1401 update_option('wpwbot_hours', serialize($wpwbot_hours));
1402
1403 if(isset( $_POST["enable_wp_chatbot_dailogflow"])) {
1404 $enable_wp_chatbot_dailogflow = sanitize_text_field($_POST["enable_wp_chatbot_dailogflow"]);
1405 }else{ $enable_wp_chatbot_dailogflow='';}
1406 update_option('enable_wp_chatbot_dailogflow', $enable_wp_chatbot_dailogflow);
1407
1408 $qlcd_wp_chatbot_dialogflow_client_token= @$_POST["qlcd_wp_chatbot_dialogflow_client_token"];
1409 update_option('qlcd_wp_chatbot_dialogflow_client_token', sanitize_text_field($qlcd_wp_chatbot_dialogflow_client_token));
1410
1411 $qlcd_wp_chatbot_dialogflow_defualt_reply= @$_POST["qlcd_wp_chatbot_dialogflow_defualt_reply"];
1412 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', sanitize_text_field($qlcd_wp_chatbot_dialogflow_defualt_reply));
1413
1414 $qlcd_wp_chatbot_dialogflow_agent_language= @$_POST["qlcd_wp_chatbot_dialogflow_agent_language"];
1415 update_option('qlcd_wp_chatbot_dialogflow_agent_language', sanitize_text_field($qlcd_wp_chatbot_dialogflow_agent_language));
1416 // style option save
1417 if(isset( $_POST["enable_wp_chatbot_custom_color"])) {
1418 $enable_wp_chatbot_custom_color = $_POST["enable_wp_chatbot_custom_color"];
1419 }else{ $enable_wp_chatbot_custom_color='';}
1420 update_option('enable_wp_chatbot_custom_color', sanitize_text_field($enable_wp_chatbot_custom_color));
1421 $wp_chatbot_text_color = @$_POST["wp_chatbot_text_color"];
1422 update_option('wp_chatbot_text_color', sanitize_text_field($wp_chatbot_text_color));
1423
1424 $wp_chatbot_floatingiconbg_color = @$_POST["wp_chatbot_floatingiconbg_color"];
1425 update_option('wp_chatbot_floatingiconbg_color', sanitize_text_field($wp_chatbot_floatingiconbg_color));
1426
1427 $wp_chatbot_link_color = @$_POST["wp_chatbot_link_color"];
1428 update_option('wp_chatbot_link_color', sanitize_text_field($wp_chatbot_link_color));
1429
1430 $wp_chatbot_link_hover_color = @$_POST["wp_chatbot_link_hover_color"];
1431 update_option('wp_chatbot_link_hover_color', sanitize_text_field($wp_chatbot_link_hover_color));
1432
1433 $wp_chatbot_bot_msg_bg_color = @$_POST["wp_chatbot_bot_msg_bg_color"];
1434 update_option('wp_chatbot_bot_msg_bg_color', sanitize_text_field($wp_chatbot_bot_msg_bg_color));
1435
1436 $wp_chatbot_bot_msg_text_color = @$_POST["wp_chatbot_bot_msg_text_color"];
1437 update_option('wp_chatbot_bot_msg_text_color', sanitize_text_field($wp_chatbot_bot_msg_text_color));
1438
1439 $wp_chatbot_user_msg_bg_color = @$_POST["wp_chatbot_user_msg_bg_color"];
1440 update_option('wp_chatbot_user_msg_bg_color', sanitize_text_field($wp_chatbot_user_msg_bg_color));
1441
1442 $wp_chatbot_user_msg_text_color = @$_POST["wp_chatbot_user_msg_text_color"];
1443 update_option('wp_chatbot_user_msg_text_color', sanitize_text_field($wp_chatbot_user_msg_text_color));
1444
1445
1446 $wp_chatbot_buttons_bg_color = @$_POST["wp_chatbot_buttons_bg_color"];
1447 update_option('wp_chatbot_buttons_bg_color', sanitize_text_field($wp_chatbot_buttons_bg_color));
1448
1449 $wp_chatbot_buttons_text_color = @$_POST["wp_chatbot_buttons_text_color"];
1450 update_option('wp_chatbot_buttons_text_color', sanitize_text_field($wp_chatbot_buttons_text_color));
1451
1452 $wp_chatbot_buttons_bg_color_hover = @$_POST["wp_chatbot_buttons_bg_color_hover"];
1453 update_option('wp_chatbot_buttons_bg_color_hover', sanitize_text_field($wp_chatbot_buttons_bg_color_hover));
1454
1455 $wp_chatbot_buttons_text_color_hover = @$_POST["wp_chatbot_buttons_text_color_hover"];
1456 update_option('wp_chatbot_buttons_text_color_hover', sanitize_text_field($wp_chatbot_buttons_text_color_hover));
1457
1458
1459 $wp_chatbot_theme_secondary_color = @$_POST["wp_chatbot_theme_secondary_color"];
1460 update_option('wp_chatbot_theme_secondary_color', sanitize_text_field($wp_chatbot_theme_secondary_color));
1461 $wp_chatbot_header_background_color = @$_POST["wp_chatbot_header_background_color"];
1462 update_option('wp_chatbot_header_background_color', sanitize_text_field($wp_chatbot_header_background_color));
1463
1464 $wp_chatbot_theme_primary_color = @$_POST["wp_chatbot_theme_primary_color"];
1465 update_option('wp_chatbot_theme_primary_color', sanitize_text_field($wp_chatbot_theme_primary_color));
1466
1467
1468 $wp_chatbot_font_size = @$_POST["wp_chatbot_font_size"];
1469 update_option('wp_chatbot_font_size', sanitize_text_field($wp_chatbot_font_size));
1470 $wp_chat_bot_font_family = @$_POST["wp_chat_bot_font_family"];
1471 update_option('wp_chat_bot_font_family', $wp_chat_bot_font_family);
1472 $wp_chat_user_font_family = @$_POST["wp_chat_user_font_family"];
1473 update_option('wp_chat_user_font_family', $wp_chat_user_font_family);
1474 $wp_chatbot_user_font = @$_POST['wp_chatbot_user_font'];
1475 update_option('wp_chatbot_user_font', $wp_chatbot_user_font);
1476 $wp_chatbot_bot_font = @$_POST['wp_chatbot_bot_font'];
1477 update_option('wp_chatbot_bot_font', $wp_chatbot_bot_font);
1478
1479 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
1480
1481 wp_enqueue_script( 'wp_chatbot_bot-front-js', plugins_url(basename(plugin_dir_path(__FILE__))) . '/js/sweetalrt.js', array('jquery'), '', true);
1482 $script = "
1483 console.log('sdaas');
1484 function callsweetalert(){
1485 Swal.fire({
1486 title: 'Your settings are saved.',
1487 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>',
1488 width: 450,
1489 icon: 'success',
1490 confirmButtonText: 'Got it',
1491 confirmButtonWidth: 100,
1492 confirmButtonClass: 'btn btn-lg'
1493 }).then((result) => {
1494 location.reload();
1495 })
1496 }
1497 callsweetalert();
1498 ";
1499
1500 wp_add_inline_script( 'wp_chatbot_bot-front-js', $script );
1501 }
1502 }
1503 }
1504 /**
1505 * Display Notifications on specific criteria.
1506 *
1507 * @since 2.14
1508 */
1509 public static function wpcommerce_inactive_notice_for_wp_chatbot()
1510 {
1511 if (current_user_can('activate_plugins')) :
1512 if (!class_exists('wpCommerce')) :
1513 deactivate_plugins(plugin_basename(__FILE__));
1514 ?>
1515 <div id="message" class="error">
1516 <p>
1517 <?php
1518 printf(
1519 __('%s WPBot for wpCommerce REQUIRES wpCommerce%s %swpCommerce%s must be active for WPBot to work. Please install & activate wpCommerce.', 'wpchatbot'),
1520 '<strong>',
1521 '</strong><br>',
1522 '<a href="http://wordpress.org/extend/plugins/wpcommerce/" target="_blank" >',
1523 '</a>'
1524 );
1525 ?>
1526 </p>
1527 </div>
1528 <?php
1529 elseif (version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) :
1530 ?>
1531 <div id="message" class="error">
1532 <!--<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>-->
1533 <p>
1534 <?php
1535 printf(
1536 __('%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'),
1537 '<strong>',
1538 '</strong><br>',
1539 QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION
1540 );
1541 ?>
1542 </p>
1543 <div style="clear:both;"></div>
1544 </div>
1545 <?php
1546 endif;
1547 endif;
1548 }
1549 /**
1550 * Admin notice for table reindex
1551 */
1552 public function admin_notice_reindex() { ?>
1553 <div class="updated notice is-dismissible">
1554 <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>
1555 </div>
1556 <?php }
1557 }
1558 /**
1559 * Instantiate plugin.
1560 *
1561 */
1562 if (!function_exists('qcld_wb_chatboot_plugin_init')) {
1563 function qcld_wb_chatboot_plugin_init()
1564 {
1565 global $qcld_wb_chatbot;
1566 $qcld_wb_chatbot = qcld_wb_Chatbot::qcld_wb_chatbot_get_instance();
1567 }
1568 }
1569 add_action('plugins_loaded', 'qcld_wb_chatboot_plugin_init');
1570 /*
1571 * Initial Options will be insert as defualt data
1572 */
1573 register_activation_hook(__FILE__, 'qcld_wb_chatboot_defualt_options');
1574 function qcld_wb_chatboot_defualt_options(){
1575
1576 global $wpdb;
1577 $collate = '';
1578
1579 if ( $wpdb->has_cap( 'collation' ) ) {
1580
1581 if ( ! empty( $wpdb->charset ) ) {
1582
1583 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
1584 }
1585 if ( ! empty( $wpdb->collate ) ) {
1586
1587 $collate .= " COLLATE $wpdb->collate";
1588
1589 }
1590 }
1591
1592 //Bot User Table
1593 $table1 = $wpdb->prefix.'wpbot_sessions';
1594 $sql_sliders_Table1 = "
1595 CREATE TABLE IF NOT EXISTS `$table1` (
1596 `id` int(11) NOT NULL AUTO_INCREMENT,
1597 `session` int(11) NOT NULL,
1598 PRIMARY KEY (`id`)
1599 ) $collate AUTO_INCREMENT=1 ";
1600
1601 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1602 dbDelta( $sql_sliders_Table1 );
1603
1604 //Bot Response Table
1605 $table1 = $wpdb->prefix.'wpbot_response';
1606 $sql_sliders_Table1 = "
1607 CREATE TABLE IF NOT EXISTS `$table1` (
1608 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
1609 `query` TEXT NOT NULL,
1610 `keyword` TEXT NOT NULL,
1611 `response` TEXT NOT NULL,
1612 `category` varchar(256) NOT NULL,
1613 `intent` varchar(256) NOT NULL,
1614 `custom` varchar(256) NOT NULL,
1615 `lang` varchar(25) NULL,
1616 FULLTEXT(`query`, `keyword`, `response`)
1617 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
1618
1619 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1620 dbDelta( $sql_sliders_Table1 );
1621
1622 $sqlqry = $wpdb->get_results("select * from $table1");
1623 if(empty($sqlqry)){
1624
1625 $query = 'What Can WPBot do for you?';
1626 $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!';
1627
1628 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
1629 $format = array('%s','%s', '%s', '%s');
1630 $wpdb->insert($table1,$data,$format);
1631 }
1632
1633 $url = get_site_url();
1634 $url = parse_url($url);
1635 $domain = $url['host'];
1636 //$admin_email = "admin@" . $domain;
1637 $admin_email = get_option('admin_email');
1638
1639 if(!get_option('wp_chatbot_position_x')) {
1640 update_option('wp_chatbot_position_x', 50);
1641 }
1642 if(!get_option('wp_chatbot_position_y')) {
1643 update_option('wp_chatbot_position_y', 50);
1644 }
1645 if(!get_option('disable_wp_chatbot')) {
1646 update_option('disable_wp_chatbot', '');
1647 }
1648 if(!get_option('disable_wp_chatbot_icon_animation')) {
1649 update_option('disable_wp_chatbot_icon_animation', '');
1650 }
1651 if(!get_option('disable_wp_chatbot_on_mobile')) {
1652 update_option('disable_wp_chatbot_on_mobile', '');
1653 }
1654 if(!get_option('qlcd_wp_chatbot_admin_email')) {
1655 update_option('qlcd_wp_chatbot_admin_email', get_option('admin_email'));
1656 }
1657 if(!get_option('disable_wp_chatbot_product_search')) {
1658 update_option('disable_wp_chatbot_product_search', '');
1659 }
1660 if(!get_option('disable_wp_chatbot_catalog')) {
1661 update_option('disable_wp_chatbot_catalog', '');
1662 }
1663 if(!get_option('disable_wp_chatbot_order_status')) {
1664 update_option('disable_wp_chatbot_order_status', '');
1665 }
1666 if(!get_option('enable_wp_chatbot_rtl')) {
1667 update_option('enable_wp_chatbot_rtl', '');
1668 }
1669 if(!get_option('show_menu_after_greetings')) {
1670 update_option('show_menu_after_greetings', '');
1671 }
1672 if(!get_option('enable_chat_session')) {
1673 update_option('enable_chat_session', '');
1674 }
1675
1676 if(!get_option('enable_wp_chatbot_mobile_full_screen')) {
1677 update_option('enable_wp_chatbot_mobile_full_screen', 1);
1678 }
1679 if(!get_option('wpbot_preloading_time')) {
1680 update_option('wpbot_preloading_time', '0.5');
1681 }
1682
1683 if(!get_option('disable_wp_chatbot_notification')) {
1684 update_option('disable_wp_chatbot_notification', '1');
1685 }
1686 if(!get_option('disable_wp_chatbot_cart_item_number')) {
1687 update_option('disable_wp_chatbot_cart_item_number', '');
1688 }
1689 if(!get_option('disable_wp_chatbot_featured_product')) {
1690 update_option('disable_wp_chatbot_featured_product', '');
1691 }
1692 if(!get_option('disable_wp_chatbot_sale_product')) {
1693 update_option('disable_wp_chatbot_sale_product', '');
1694 }
1695 if(!get_option('wp_chatbot_open_product_detail')) {
1696 update_option('wp_chatbot_open_product_detail', '');
1697 }
1698 if(!get_option('qlcd_wp_chatbot_product_orderby')) {
1699 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field('title'));
1700 }
1701 if(!get_option('qlcd_wp_chatbot_product_order')) {
1702 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field('ASC'));
1703 }
1704 if(!get_option('qlcd_wp_chatbot_ppp')) {
1705 update_option('qlcd_wp_chatbot_ppp', intval(6));
1706 }
1707 if(!get_option('wp_chatbot_exclude_stock_out_product')) {
1708 update_option('wp_chatbot_exclude_stock_out_product', '');
1709 }
1710 if(!get_option('wp_chatbot_show_sub_category')) {
1711 update_option('wp_chatbot_show_sub_category', '');
1712 }
1713 if(!get_option('wp_chatbot_vertical_custom')){
1714 update_option('wp_chatbot_vertical_custom', 'Go To');
1715 }
1716 if(!get_option('wp_chatbot_show_home_page')) {
1717 update_option('wp_chatbot_show_home_page', 'on');
1718 }
1719 if(!get_option('qc_wpbot_menu_order')) {
1720 update_option('qc_wpbot_menu_order', '');
1721 }
1722
1723 if(!get_option('wp_chatbot_show_posts')) {
1724 update_option('wp_chatbot_show_posts', 'on');
1725 }
1726 if(!get_option('wp_chatbot_show_pages')){
1727 update_option('wp_chatbot_show_pages', 'on');
1728 }
1729 if(!get_option('wp_chatbot_show_pages_list')) {
1730 update_option('wp_chatbot_show_pages_list', serialize(array()));
1731 }
1732 if(!get_option('wp_chatbot_exclude_post_list')) {
1733 update_option('wp_chatbot_exclude_post_list', serialize(array()));
1734 }
1735
1736 if(!get_option('wp_chatbot_show_wpcommerce')) {
1737 update_option('wp_chatbot_show_wpcommerce', 'on');
1738 }
1739 if(!get_option('qlcd_wp_chatbot_stop_words_name')) {
1740 update_option('qlcd_wp_chatbot_stop_words_name', 'english');
1741 }
1742 if(!get_option('qlcd_wp_chatbot_stop_words')) {
1743 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");
1744 }
1745 if(!get_option('qlcd_wp_chatbot_order_user')) {
1746 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field('login'));
1747 }
1748 if(!get_option('wp_chatbot_custom_agent_path')) {
1749 update_option('wp_chatbot_custom_agent_path', '');
1750 }
1751 if(!get_option('wp_chatbot_custom_icon_path')) {
1752 update_option('wp_chatbot_custom_icon_path', '');
1753 }
1754
1755 if(!get_option('wp_chatbot_icon')) {
1756 update_option('wp_chatbot_icon', sanitize_text_field('icon-13.png'));
1757 }
1758 if(!get_option('wp_chatbot_floatingiconbg_color')) {
1759 update_option('wp_chatbot_floatingiconbg_color', '#fff');
1760 }
1761 if(!get_option('wp_chatbot_agent_image')){
1762 update_option('wp_chatbot_agent_image',sanitize_text_field('agent-0.png'));
1763 }
1764 if(!get_option('qcld_wb_chatbot_theme')) {
1765 update_option('qcld_wb_chatbot_theme', sanitize_text_field('template-00'));
1766 }
1767 if(!get_option('qcld_wb_chatbot_change_bg')) {
1768 update_option('qcld_wb_chatbot_change_bg', '');
1769 }
1770 if(!get_option('wp_chatbot_custom_css')) {
1771 update_option('wp_chatbot_custom_css', '');
1772 }
1773 if(!get_option('qlcd_wp_chatbot_host')) {
1774 update_option('qlcd_wp_chatbot_host', sanitize_text_field('Our Website'));
1775 }
1776 if(!get_option('qlcd_wp_chatbot_agent')) {
1777 update_option('qlcd_wp_chatbot_agent', sanitize_text_field('Carrie'));
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_shopper_demo_name')) {
1783 update_option('qlcd_wp_chatbot_shopper_demo_name', sanitize_text_field('Amigo'));
1784 }
1785 if(!get_option('qlcd_wp_chatbot_yes')) {
1786 update_option('qlcd_wp_chatbot_yes', sanitize_text_field('YES'));
1787 }
1788 if(!get_option('qlcd_wp_chatbot_no')) {
1789 update_option('qlcd_wp_chatbot_no', sanitize_text_field('NO'));
1790 }
1791 if(!get_option('qlcd_wp_chatbot_or')) {
1792 update_option('qlcd_wp_chatbot_or', sanitize_text_field('OR'));
1793 }
1794 if(!get_option('qlcd_wp_chatbot_sorry')) {
1795 update_option('qlcd_wp_chatbot_sorry', sanitize_text_field('Sorry'));
1796 }
1797
1798 if(!get_option('qlcd_wp_chatbot_dialogflow_project_id')) {
1799 update_option('qlcd_wp_chatbot_dialogflow_project_id', '');
1800 }
1801 if(!get_option('wp_chatbot_df_api')) {
1802 update_option('wp_chatbot_df_api', 'v1');
1803 }
1804
1805
1806 if(!get_option('qlcd_wp_chatbot_dialogflow_project_key')) {
1807 update_option('qlcd_wp_chatbot_dialogflow_project_key', '');
1808 }
1809
1810 if(!get_option('qlcd_wp_chatbot_agent_join')) {
1811 update_option('qlcd_wp_chatbot_agent_join', serialize(array('has joined the conversation')));
1812 }
1813 if(!get_option('qlcd_wp_chatbot_welcome')) {
1814 update_option('qlcd_wp_chatbot_welcome', serialize(array('Welcome to', 'Glad to have you at')));
1815 }
1816 if(!get_option('qlcd_wp_chatbot_back_to_start')) {
1817 update_option('qlcd_wp_chatbot_back_to_start', serialize(array('Back to Start')));
1818 }
1819 if(!get_option('qlcd_wp_chatbot_hi_there')) {
1820 update_option('qlcd_wp_chatbot_hi_there', serialize(array('Hi There!')));
1821 }
1822 if(!get_option('qlcd_wp_chatbot_hello')) {
1823 update_option('qlcd_wp_chatbot_hello', serialize(array('Hi There!')));
1824 }
1825 if(!get_option('qlcd_wp_chatbot_welcome_back')) {
1826 update_option('qlcd_wp_chatbot_welcome_back', serialize(array('Welcome back', 'Good to see your again')));
1827 }
1828 if(!get_option('qlcd_wp_chatbot_asking_name')) {
1829 update_option('qlcd_wp_chatbot_asking_name', serialize(array('May I know your name?', 'What should I call you?')));
1830 }
1831 if(!get_option('qlcd_wp_chatbot_name_greeting')) {
1832 update_option('qlcd_wp_chatbot_name_greeting', serialize(array('Nice to meet you')));
1833 }
1834 if(!get_option('qlcd_wp_chatbot_i_am')) {
1835 update_option('qlcd_wp_chatbot_i_am', serialize(array('I am', 'This is')));
1836 }
1837 if(!get_option('qlcd_wp_chatbot_is_typing')) {
1838 update_option('qlcd_wp_chatbot_is_typing', serialize(array('is typing...')));
1839 }
1840 if(!get_option('qlcd_wp_chatbot_send_a_msg')) {
1841 update_option('qlcd_wp_chatbot_send_a_msg', serialize(array('Send a message.')));
1842 }
1843 if(!get_option('qlcd_wp_chatbot_choose_option')) {
1844 update_option('qlcd_wp_chatbot_choose_option', serialize(array('Choose an option.')));
1845 }
1846 if(!get_option('qlcd_wp_chatbot_viewed_products')) {
1847 update_option('qlcd_wp_chatbot_viewed_products', serialize(array('Recently viewed products')));
1848 }
1849 if(!get_option('qlcd_wp_chatbot_add_to_cart')) {
1850 update_option('qlcd_wp_chatbot_add_to_cart', serialize(array('Add to Cart')));
1851 }
1852 if(!get_option('qlcd_wp_chatbot_cart_link')) {
1853 update_option('qlcd_wp_chatbot_cart_link', serialize(array('Cart')));
1854 }
1855 if(!get_option('qlcd_wp_chatbot_checkout_link')) {
1856 update_option('qlcd_wp_chatbot_checkout_link', serialize(array('Checkout')));
1857 }
1858 if(!get_option('qlcd_wp_chatbot_featured_product_welcome')) {
1859 update_option('qlcd_wp_chatbot_featured_product_welcome', serialize(array('I have found following featured products')));
1860 }
1861 if(!get_option('qlcd_wp_chatbot_viewed_product_welcome')) {
1862 update_option('qlcd_wp_chatbot_viewed_product_welcome', serialize(array('I have found following recently viewed products')));
1863 }
1864 if(!get_option('qlcd_wp_chatbot_latest_product_welcome')) {
1865 update_option('qlcd_wp_chatbot_latest_product_welcome', serialize(array('I have found following latest products')));
1866 }
1867 if(!get_option('qlcd_wp_chatbot_cart_welcome')) {
1868 update_option('qlcd_wp_chatbot_cart_welcome', serialize(array('I have found following items from Shopping Cart.')));
1869 }
1870 if(!get_option('qlcd_wp_chatbot_cart_title')) {
1871 update_option('qlcd_wp_chatbot_cart_title', serialize(array('Title')));
1872 }
1873 if(!get_option('qlcd_wp_chatbot_cart_quantity')) {
1874 update_option('qlcd_wp_chatbot_cart_quantity', serialize(array('Qty')));
1875 }
1876 if(!get_option('qlcd_wp_chatbot_cart_price')) {
1877 update_option('qlcd_wp_chatbot_cart_price', serialize(array('Price')));
1878 }
1879 if(!get_option('qlcd_wp_chatbot_no_cart_items')) {
1880 update_option('qlcd_wp_chatbot_no_cart_items', serialize(array('No items in the cart')));
1881 }
1882 if(!get_option('qlcd_wp_chatbot_cart_updating')) {
1883 update_option('qlcd_wp_chatbot_cart_updating', serialize(array('Updating cart items ...')));
1884 }
1885 if(!get_option('qlcd_wp_chatbot_cart_removing')) {
1886 update_option('qlcd_wp_chatbot_cart_removing', serialize(array('Removing cart items ...')));
1887 }
1888 if(!get_option('qlcd_wp_chatbot_wildcard_msg')) {
1889 update_option('qlcd_wp_chatbot_wildcard_msg', serialize(array('I am here to find what you need. What are you looking for?')));
1890 }
1891 if(!get_option('qlcd_wp_chatbot_empty_filter_msg')) {
1892 update_option('qlcd_wp_chatbot_empty_filter_msg', serialize(array('Sorry, I did not understand you.')));
1893 }
1894 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
1895 update_option('qlcd_wp_chatbot_did_you_mean', serialize(array('Did you mean?')));
1896 }
1897 if(!get_option('qlcd_wp_chatbot_sys_key_help')) {
1898 update_option('qlcd_wp_chatbot_sys_key_help', 'start');
1899 }
1900 if(!get_option('qlcd_wp_chatbot_sys_key_product')) {
1901 update_option('qlcd_wp_chatbot_sys_key_product', 'product');
1902 }
1903 if(!get_option('qlcd_wp_chatbot_sys_key_catalog')) {
1904 update_option('qlcd_wp_chatbot_sys_key_catalog', 'catalog');
1905 }
1906 if(!get_option('qlcd_wp_chatbot_sys_key_order')) {
1907 update_option('qlcd_wp_chatbot_sys_key_order', 'order');
1908 }
1909 if(!get_option('qlcd_wp_chatbot_sys_key_support')) {
1910 update_option('qlcd_wp_chatbot_sys_key_support', 'faq');
1911 }
1912 if(!get_option('qlcd_wp_chatbot_sys_key_reset')) {
1913 update_option('qlcd_wp_chatbot_sys_key_reset', 'reset');
1914 }
1915 if(!get_option('qlcd_wp_chatbot_sys_key_email')) {
1916 update_option('qlcd_wp_chatbot_sys_key_email', 'email');
1917 }
1918 if(!get_option('qlcd_wp_chatbot_help_welcome')) {
1919 update_option('qlcd_wp_chatbot_help_welcome', serialize(array('Welcome to Help Section.')));
1920 }
1921 if(!get_option('qlcd_wp_chatbot_help_msg')) {
1922 update_option('qlcd_wp_chatbot_help_msg', 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.')));
1923 }
1924 if(!get_option('qlcd_wp_chatbot_reset')) {
1925 update_option('qlcd_wp_chatbot_reset', serialize(array('Do you want to clear our chat history and start over?')));
1926 }
1927 if(!get_option('qlcd_wp_chatbot_wildcard_product')) {
1928 update_option('qlcd_wp_chatbot_wildcard_product', serialize(array('Product Search')));
1929 }
1930 if(!get_option('qlcd_wp_chatbot_wildcard_catalog')) {
1931 update_option('qlcd_wp_chatbot_wildcard_catalog', serialize(array('Catalog')));
1932 }
1933 if(!get_option('qlcd_wp_chatbot_featured_products')) {
1934 update_option('qlcd_wp_chatbot_featured_products', serialize(array('Featured Products')));
1935 }
1936 if(!get_option('qlcd_wp_chatbot_sale_products')) {
1937 update_option('qlcd_wp_chatbot_sale_products', serialize(array('Products on Sale')));
1938 }
1939 if(!get_option('qlcd_wp_chatbot_wildcard_support')) {
1940 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
1941 }
1942 if(!get_option('qlcd_wp_chatbot_messenger_label')) {
1943 update_option('qlcd_wp_chatbot_messenger_label', serialize(array('Chat with Us on Facebook Messenger')));
1944 }
1945 if(!get_option('qlcd_wp_chatbot_product_success')) {
1946 update_option('qlcd_wp_chatbot_product_success', serialize(array('Great! We have these products for', 'Found these products for')));
1947 }
1948 if(!get_option('qlcd_wp_chatbot_product_fail')) {
1949 update_option('qlcd_wp_chatbot_product_fail', serialize(array('Oops! Nothing matches your criteria', 'Sorry, I found nothing')));
1950 }
1951 if(!get_option('qlcd_wp_chatbot_product_asking')) {
1952 update_option('qlcd_wp_chatbot_product_asking', serialize(array('What are you shopping for?')));
1953 }
1954 if(!get_option('qlcd_wp_chatbot_product_suggest')) {
1955 update_option('qlcd_wp_chatbot_product_suggest', serialize(array('You can browse our extensive catalog. Just pick a category from below:')));
1956 }
1957 if(!get_option('qlcd_wp_chatbot_product_infinite')) {
1958 update_option('qlcd_wp_chatbot_product_infinite', serialize(array('Too many choices? Let\'s try another search term', 'I may have something else for you. Why not search again?')));
1959 }
1960 if(!get_option('qlcd_wp_chatbot_load_more')) {
1961 update_option('qlcd_wp_chatbot_load_more', serialize(array('Load More')));
1962 }
1963 if(!get_option('qlcd_wp_chatbot_wildcard_order')) {
1964 update_option('qlcd_wp_chatbot_wildcard_order', serialize(array('Order Status')));
1965 }
1966 if(!get_option('qlcd_wp_chatbot_order_welcome')) {
1967 update_option('qlcd_wp_chatbot_order_welcome', serialize(array('Welcome to Order status section!')));
1968 }
1969 if(!get_option('qlcd_wp_chatbot_order_username_asking')) {
1970 update_option('qlcd_wp_chatbot_order_username_asking', serialize(array('Please type your username?')));
1971 }
1972 if(!get_option('qlcd_wp_chatbot_order_username_password')) {
1973 update_option('qlcd_wp_chatbot_order_username_password', serialize(array('Please type your password')));
1974 }
1975 if(!get_option('qlcd_wp_chatbot_order_username_not_exist')) {
1976 update_option('qlcd_wp_chatbot_order_username_not_exist', serialize(array('This username does not exist.')));
1977 }
1978 if(!get_option('qlcd_wp_chatbot_order_username_thanks')) {
1979 update_option('qlcd_wp_chatbot_order_username_thanks', serialize(array('Thank you for the username')));
1980 }
1981 if(!get_option('qlcd_wp_chatbot_order_password_incorrect')) {
1982 update_option('qlcd_wp_chatbot_order_password_incorrect', serialize(array('Sorry Password is not correct!')));
1983 }
1984 if(!get_option('qlcd_wp_chatbot_asking_email')) {
1985 update_option('qlcd_wp_chatbot_asking_email', serialize(array('Please provide your email address')));
1986 }
1987 if(!get_option('qlcd_wp_chatbot_order_not_found')) {
1988 update_option('qlcd_wp_chatbot_order_not_found', serialize(array('I did not find any order by you')));
1989 }
1990 if(!get_option('qlcd_wp_chatbot_order_found')) {
1991 update_option('qlcd_wp_chatbot_order_found', serialize(array('I have found the following orders')));
1992 }
1993 if(!get_option('qlcd_wp_chatbot_order_email_support')) {
1994 update_option('qlcd_wp_chatbot_order_email_support', serialize(array('Email our support center about your order.')));
1995 }
1996 if(!get_option('qlcd_wp_chatbot_support_welcome')) {
1997 update_option('qlcd_wp_chatbot_support_welcome', serialize(array('Welcome to FAQ Section')));
1998 }
1999 if(!get_option('qlcd_wp_chatbot_support_email')) {
2000 update_option('qlcd_wp_chatbot_support_email', 'Send us Email.');
2001 }
2002 if(!get_option('qlcd_wp_chatbot_asking_msg')) {
2003 update_option('qlcd_wp_chatbot_asking_msg', serialize(array('Thank you for email address. Please write your message now.')));
2004 }
2005 if(!get_option('qlcd_wp_chatbot_no_result')) {
2006 update_option('qlcd_wp_chatbot_no_result', serialize(array('Sorry, No result found!')));
2007 }
2008 if(!get_option('qlcd_wp_chatbot_invalid_email')) {
2009 update_option('qlcd_wp_chatbot_invalid_email', serialize(array('Sorry, Email address is not valid! Please provide a valid email.')));
2010 }
2011 if(!get_option('qlcd_wp_chatbot_support_phone')) {
2012 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
2013 }
2014 if(!get_option('qlcd_wp_chatbot_asking_phone')) {
2015 update_option('qlcd_wp_chatbot_asking_phone', serialize(array('Please provide your Phone number')));
2016 }
2017 if(!get_option('qlcd_wp_chatbot_thank_for_phone')) {
2018 update_option('qlcd_wp_chatbot_thank_for_phone', serialize(array('Thank you for Phone number')));
2019 }
2020 if(!get_option('qlcd_wp_chatbot_support_option_again')) {
2021 update_option('qlcd_wp_chatbot_support_option_again', serialize(array('You may choose option from below.')));
2022 }
2023 if(!get_option('qlcd_wp_chatbot_admin_email')) {
2024 update_option('qlcd_wp_chatbot_admin_email', $admin_email);
2025 }
2026 if(!get_option('qlcd_wp_chatbot_email_sub')) {
2027 update_option('qlcd_wp_chatbot_email_sub', sanitize_text_field('WPBot Support Mail'));
2028 }
2029 if(!get_option('qlcd_wp_site_search')) {
2030 update_option('qlcd_wp_site_search', sanitize_text_field('Site Search'));
2031 }
2032 if(!get_option('qlcd_wp_chatbot_email_sent')) {
2033 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field('Your email was sent successfully.Thanks!'));
2034 }
2035 if(!get_option('qlcd_wp_chatbot_email_fail')) {
2036 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field('Sorry! I could not send your mail! Please contact the webmaster.'));
2037 }
2038 if(!get_option('qlcd_wp_chatbot_notification_interval')) {
2039 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field(5));
2040 }
2041 if(!get_option('qlcd_wp_chatbot_notifications')) {
2042 update_option('qlcd_wp_chatbot_notifications', serialize(array('Welcome to WPBot')));
2043 }
2044 if(!get_option('support_query')) {
2045 update_option('support_query', serialize(array('What is WPBot?')));
2046 }
2047 if(!get_option('support_ans')) {
2048 update_option('support_ans', 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.')));
2049 }
2050 if(!get_option('qlcd_wp_chatbot_search_option')) {
2051 update_option('qlcd_wp_chatbot_search_option', 'standard');
2052 }
2053 if(!get_option('wp_chatbot_index_count')) {
2054 update_option('wp_chatbot_index_count', 0);
2055 }
2056 if(!get_option('wp_chatbot_app_pages')) {
2057 update_option('wp_chatbot_app_pages', 0);
2058 }
2059 //messenger options.
2060 if(!get_option('enable_wp_chatbot_messenger')) {
2061 update_option('enable_wp_chatbot_messenger', '');
2062 }
2063 if(!get_option('enable_wp_chatbot_messenger_floating_icon')) {
2064 update_option('enable_wp_chatbot_messenger_floating_icon', '');
2065 }
2066 if(!get_option('qlcd_wp_chatbot_fb_app_id')) {
2067 update_option('qlcd_wp_chatbot_fb_app_id', '');
2068 }
2069 if(!get_option('qlcd_wp_chatbot_fb_page_id')) {
2070 update_option('qlcd_wp_chatbot_fb_page_id', '');
2071 }
2072 if(!get_option('qlcd_wp_chatbot_fb_color')) {
2073 update_option('qlcd_wp_chatbot_fb_color', '#0084ff');
2074 }
2075 if(!get_option('qlcd_wp_chatbot_fb_in_msg')) {
2076 update_option('qlcd_wp_chatbot_fb_in_msg', 'Welcome to WPBot!');
2077 }
2078 if(!get_option('qlcd_wp_chatbot_fb_out_msg')) {
2079 update_option('qlcd_wp_chatbot_fb_out_msg', 'You are not logged in');
2080 }
2081 //Skype option
2082 if(!get_option('enable_wp_chatbot_skype_floating_icon')) {
2083 update_option('enable_wp_chatbot_skype_floating_icon', '');
2084 }
2085 if(!get_option('enable_wp_chatbot_skype_id')) {
2086 update_option('enable_wp_chatbot_skype_id', '');
2087 }
2088 //Whats App
2089 if(!get_option('enable_wp_chatbot_whats')) {
2090 update_option('enable_wp_chatbot_whats', '');
2091 }
2092 if(!get_option('qlcd_wp_chatbot_whats_label')) {
2093 update_option('qlcd_wp_chatbot_whats_label', serialize(array('Chat with Us on WhatsApp')));
2094 }
2095 if(!get_option('enable_wp_chatbot_floating_whats')) {
2096 update_option('enable_wp_chatbot_floating_whats', '');
2097 }
2098 if(!get_option('qlcd_wp_chatbot_whats_num')) {
2099 update_option('qlcd_wp_chatbot_whats_num', '');
2100 }
2101 //Viber
2102 if(!get_option('enable_wp_chatbot_floating_viber')) {
2103 update_option('enable_wp_chatbot_floating_viber', '');
2104 }
2105 if(!get_option('qlcd_wp_chatbot_viber_acc')) {
2106 update_option('qlcd_wp_chatbot_viber_acc', '');
2107 }
2108 //Integration others
2109 if(!get_option('enable_wp_chatbot_floating_phone')) {
2110 update_option('enable_wp_chatbot_floating_phone', '');
2111 }
2112 if(!get_option('qlcd_wp_chatbot_phone')) {
2113 update_option('qlcd_wp_chatbot_phone', '');
2114 }
2115 if(!get_option('enable_wp_chatbot_floating_link')) {
2116 update_option('enable_wp_chatbot_floating_link', '');
2117 }
2118
2119 if(!get_option('qlcd_wp_chatbot_weblink')) {
2120 update_option('qlcd_wp_chatbot_weblink', '');
2121 }
2122 //Re-Tagetting
2123 if(!get_option('qlcd_wp_chatbot_ret_greet')) {
2124 update_option('qlcd_wp_chatbot_ret_greet', 'Hello');
2125 }
2126 if(!get_option('enable_wp_chatbot_exit_intent')) {
2127 update_option('enable_wp_chatbot_exit_intent', '');
2128 }
2129 if(!get_option('wp_chatbot_exit_intent_msg')) {
2130 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.');
2131 }
2132 if(!get_option('wp_chatbot_exit_intent_once')) {
2133 update_option('wp_chatbot_exit_intent_once', '');
2134 }
2135
2136 if(!get_option('enable_wp_chatbot_scroll_open')) {
2137 update_option('enable_wp_chatbot_scroll_open', '');
2138 }
2139 if(!get_option('wp_chatbot_scroll_open_msg')) {
2140 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.');
2141 }
2142 if(!get_option('wp_chatbot_scroll_percent')) {
2143 update_option('wp_chatbot_scroll_percent', 50);
2144 }
2145 if(!get_option('wp_chatbot_scroll_once')) {
2146 update_option('wp_chatbot_scroll_once', '');
2147 }
2148
2149 if(!get_option('enable_wp_chatbot_auto_open')) {
2150 update_option('enable_wp_chatbot_auto_open', '');
2151 }
2152
2153 if(!get_option('enable_wp_chatbot_ret_sound')) {
2154 update_option('enable_wp_chatbot_ret_sound', '');
2155 }
2156 if(!get_option('enable_wp_chatbot_sound_initial')) {
2157 update_option('enable_wp_chatbot_sound_initial', '');
2158 }
2159
2160
2161 if(!get_option('wp_chatbot_auto_open_msg')) {
2162 update_option('wp_chatbot_auto_open_msg', 'A SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
2163 }
2164 if(!get_option('wp_chatbot_auto_open_time')) {
2165 update_option('wp_chatbot_auto_open_time', 10);
2166 }
2167 if(!get_option('wp_chatbot_auto_open_once')) {
2168 update_option('wp_chatbot_auto_open_once', '');
2169 }
2170 if(!get_option('wp_chatbot_inactive_once')) {
2171 update_option('wp_chatbot_inactive_once', '');
2172 }
2173
2174 //To complete checkout.
2175 if(!get_option('enable_wp_chatbot_ret_user_show')) {
2176 update_option('enable_wp_chatbot_ret_user_show', '');
2177 }
2178 if(!get_option('wp_chatbot_auto_open_msg')) {
2179 update_option('wp_chatbot_checkout_msg', 'You have products in shopping cart, please complete your order.');
2180 }
2181 if(!get_option('wp_chatbot_inactive_time')) {
2182 update_option('wp_chatbot_inactive_time', 300);
2183 }
2184 if(!get_option('enable_wp_chatbot_inactive_time_show')) {
2185 update_option('enable_wp_chatbot_inactive_time_show', '');
2186 }
2187
2188 if(!get_option('wp_chatbot_proactive_bg_color')) {
2189 update_option('wp_chatbot_proactive_bg_color', '#ffffff');
2190 }
2191 if(!get_option('disable_wp_chatbot_feedback')) {
2192 update_option('disable_wp_chatbot_feedback','');
2193 }
2194 if(!get_option('disable_wp_chatbot_faq')) {
2195 update_option('disable_wp_chatbot_faq','');
2196 }
2197 if(!get_option('qlcd_wp_chatbot_feedback_label')) {
2198 update_option('qlcd_wp_chatbot_feedback_label',serialize(array('Send Feedback')));
2199 }
2200
2201 if(!get_option('enable_wp_chatbot_meta_title')) {
2202 update_option('enable_wp_chatbot_meta_title','');
2203 }
2204 if(!get_option('qlcd_wp_chatbot_meta_label')) {
2205 update_option('qlcd_wp_chatbot_meta_label','*New Messages');
2206 }
2207
2208 if(!get_option('disable_wp_chatbot_call_gen')) {
2209 update_option('disable_wp_chatbot_call_gen', '');
2210 }
2211
2212 if(!get_option('disable_wp_chatbot_site_search')) {
2213 update_option('disable_wp_chatbot_site_search', '');
2214 }
2215 if(!get_option('disable_wp_chatbot_call_sup')) {
2216 update_option('disable_wp_chatbot_call_sup', '');
2217 }
2218
2219 if(!get_option('qlcd_wp_chatbot_phone_sent')) {
2220 update_option('qlcd_wp_chatbot_phone_sent', 'Thanks for your phone number. We will call you ASAP!');
2221 }
2222 if(!get_option('qlcd_wp_chatbot_phone_fail')) {
2223 update_option('qlcd_wp_chatbot_phone_fail', 'Sorry! I could not collect your phone number!');
2224 }
2225 if(!get_option('enable_wp_chatbot_opening_hour')) {
2226 update_option('enable_wp_chatbot_opening_hour', '');
2227 }
2228 if(!get_option('enable_wp_chatbot_opening_hour')) {
2229 update_option('wpwbot_hours', array());
2230 }
2231
2232 if(!get_option('enable_wp_chatbot_dailogflow')) {
2233 update_option('enable_wp_chatbot_dailogflow', '');
2234 }
2235 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
2236 update_option('qlcd_wp_chatbot_dialogflow_client_token', '');
2237 }
2238 if(!get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')) {
2239 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', 'Sorry, I did not understand you. You may browse');
2240 }
2241 if(!get_option('qlcd_wp_chatbot_dialogflow_agent_language')) {
2242 update_option('qlcd_wp_chatbot_dialogflow_agent_language', 'en');
2243 }
2244 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
2245 }
2246 /*
2247 * Reset Options will be insert as defualt data
2248 */
2249 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
2250 add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
2251 //Jarvis all option will be delete during uninstlling.
2252 function qcld_wb_chatboot_delete_all_options(){
2253 delete_option('disable_wp_chatbot');
2254 delete_option('disable_wp_chatbot_icon_animation');
2255 delete_option('disable_wp_chatbot_on_mobile');
2256 delete_option('qlcd_wp_chatbot_admin_email');
2257 delete_option('qlcd_wp_chatbot_from_email');
2258
2259 delete_option('disable_wp_chatbot_product_search');
2260 delete_option('disable_wp_chatbot_catalog');
2261 delete_option('disable_wp_chatbot_order_status');
2262 delete_option('disable_wp_chatbot_notification');
2263 delete_option('enable_wp_chatbot_rtl');
2264 delete_option('show_menu_after_greetings');
2265 delete_option('enable_chat_session');
2266
2267 delete_option('enable_wp_chatbot_mobile_full_screen');
2268 delete_option('wpbot_preloading_time');
2269 delete_option('disable_wp_chatbot_cart_item_number');
2270 delete_option('disable_wp_chatbot_featured_product');
2271 delete_option('disable_wp_chatbot_sale_product');
2272 delete_option('wp_chatbot_open_product_detail');
2273 delete_option('qlcd_wp_chatbot_product_orderby');
2274 delete_option('qlcd_wp_chatbot_product_order');
2275 delete_option('qlcd_wp_chatbot_ppp');
2276 delete_option('wp_chatbot_show_parent_category');
2277 delete_option('wp_chatbot_show_sub_category');
2278 delete_option('wp_chatbot_exclude_stock_out_product');
2279 delete_option('wp_chatbot_show_home_page');
2280 delete_option('qc_wpbot_menu_order');
2281
2282 delete_option('wp_chatbot_show_posts');
2283 delete_option('wp_chatbot_show_pages');
2284 delete_option('wp_chatbot_show_pages_list');
2285 delete_option('wp_chatbot_exclude_post_list');
2286 delete_option('wp_chatbot_show_wpcommerce');
2287 delete_option('qlcd_wp_chatbot_stop_words_name');
2288 delete_option('qlcd_wp_chatbot_stop_words');
2289 delete_option('qlcd_wp_chatbot_order_user');
2290 delete_option('wp_chatbot_icon');
2291 delete_option('wp_chatbot_floatingiconbg_color');
2292 delete_option('wp_chatbot_agent_image');
2293 delete_option('qcld_wb_chatbot_theme');
2294 delete_option('qcld_wb_chatbot_change_bg');
2295 delete_option('wp_chatbot_custom_css');
2296 delete_option('qlcd_wp_chatbot_host');
2297 delete_option('qlcd_wp_chatbot_agent');
2298 delete_option('qlcd_wp_chatbot_yes');
2299 delete_option('qlcd_wp_chatbot_no');
2300 delete_option('qlcd_wp_chatbot_or');
2301 delete_option('qlcd_wp_chatbot_sorry');
2302 delete_option('qlcd_wp_chatbot_agent_join');
2303 delete_option('qlcd_wp_chatbot_welcome');
2304 delete_option('qlcd_wp_chatbot_back_to_start');
2305 delete_option('qlcd_wp_chatbot_hi_there');
2306 delete_option('qlcd_wp_chatbot_hello');
2307 delete_option('qlcd_wp_chatbot_welcome_back');
2308 delete_option('qlcd_wp_chatbot_asking_name');
2309 delete_option('qlcd_wp_chatbot_name_greeting');
2310 delete_option('qlcd_wp_chatbot_i_am');
2311 delete_option('qlcd_wp_chatbot_wildcard_msg');
2312 delete_option('qlcd_wp_chatbot_empty_filter_msg');
2313 delete_option('qlcd_wp_chatbot_did_you_mean');
2314 delete_option('qlcd_wp_chatbot_wildcard_product');
2315 delete_option('qlcd_wp_chatbot_wildcard_catalog');
2316 delete_option('qlcd_wp_chatbot_featured_products');
2317 delete_option('qlcd_wp_chatbot_sale_products');
2318 delete_option('qlcd_wp_chatbot_wildcard_support');
2319 delete_option('qlcd_wp_chatbot_messenger_label');
2320 delete_option('qlcd_wp_chatbot_product_success');
2321 delete_option('qlcd_wp_chatbot_product_fail');
2322 delete_option('qlcd_wp_chatbot_product_asking');
2323 delete_option('qlcd_wp_chatbot_product_suggest');
2324 delete_option('qlcd_wp_chatbot_product_infinite');
2325 delete_option('qlcd_wp_chatbot_load_more');
2326 delete_option('qlcd_wp_chatbot_wildcard_order');
2327 delete_option('qlcd_wp_chatbot_order_welcome');
2328 delete_option('qlcd_wp_chatbot_order_username_asking');
2329 delete_option('qlcd_wp_chatbot_order_username_password');
2330 delete_option('qlcd_wp_chatbot_support_welcome');
2331 delete_option('qlcd_wp_chatbot_support_email');
2332 delete_option('qlcd_wp_chatbot_asking_email');
2333 delete_option('qlcd_wp_chatbot_asking_msg');
2334 delete_option('qlcd_wp_chatbot_no_result');
2335 delete_option('qlcd_wp_chatbot_admin_email');
2336 delete_option('qlcd_wp_chatbot_email_sub');
2337 delete_option('qlcd_wp_site_search');
2338 delete_option('qlcd_wp_chatbot_email_sent');
2339 delete_option('qlcd_wp_chatbot_support_phone');
2340 delete_option('qlcd_wp_chatbot_asking_phone');
2341 delete_option('qlcd_wp_chatbot_thank_for_phone');
2342 delete_option('qlcd_wp_chatbot_sys_key_help');
2343 delete_option('qlcd_wp_chatbot_sys_key_product');
2344 delete_option('qlcd_wp_chatbot_sys_key_catalog');
2345 delete_option('qlcd_wp_chatbot_sys_key_order');
2346 delete_option('qlcd_wp_chatbot_sys_key_support');
2347 delete_option('qlcd_wp_chatbot_sys_key_reset');
2348 delete_option('qlcd_wp_chatbot_sys_key_email');
2349 delete_option('qlcd_wp_chatbot_order_username_not_exist');
2350 delete_option('qlcd_wp_chatbot_order_username_thanks');
2351 delete_option('qlcd_wp_chatbot_order_password_incorrect');
2352 delete_option('qlcd_wp_chatbot_order_not_found');
2353 delete_option('qlcd_wp_chatbot_order_found');
2354 delete_option('qlcd_wp_chatbot_order_email_support');
2355 delete_option('qlcd_wp_chatbot_support_option_again');
2356 delete_option('qlcd_wp_chatbot_invalid_email');
2357 delete_option('qlcd_wp_chatbot_shopping_cart');
2358 delete_option('qlcd_wp_chatbot_add_to_cart');
2359 delete_option('qlcd_wp_chatbot_cart_link');
2360 delete_option('qlcd_wp_chatbot_checkout_link');
2361 delete_option('qlcd_wp_chatbot_cart_welcome');
2362 delete_option('qlcd_wp_chatbot_featured_product_welcome');
2363 delete_option('qlcd_wp_chatbot_viewed_product_welcome');
2364 delete_option('qlcd_wp_chatbot_latest_product_welcome');
2365 delete_option('qlcd_wp_chatbot_cart_title');
2366 delete_option('qlcd_wp_chatbot_cart_quantity');
2367 delete_option('qlcd_wp_chatbot_cart_price');
2368 delete_option('qlcd_wp_chatbot_no_cart_items');
2369 delete_option('qlcd_wp_chatbot_cart_updating');
2370 delete_option('qlcd_wp_chatbot_cart_removing');
2371 delete_option('qlcd_wp_chatbot_email_fail');
2372 delete_option('support_query');
2373 delete_option('support_ans');
2374 delete_option('qlcd_wp_chatbot_notification_interval');
2375 delete_option('qlcd_wp_chatbot_notifications');
2376 delete_option( 'qlcd_wp_chatbot_search_option');
2377 delete_option( 'wp_chatbot_index_count');
2378 delete_option( 'wp_chatbot_app_pages');
2379 //messenger option
2380 delete_option( 'enable_wp_chatbot_messenger');
2381 delete_option( 'enable_wp_chatbot_messenger_floating_icon');
2382 delete_option( 'qlcd_wp_chatbot_fb_app_id');
2383 delete_option( 'qlcd_wp_chatbot_fb_page_id');
2384 delete_option( 'qlcd_wp_chatbot_fb_color');
2385 delete_option( 'qlcd_wp_chatbot_fb_in_msg');
2386 delete_option( 'qlcd_wp_chatbot_fb_out_msg');
2387 //skype option
2388 delete_option( 'enable_wp_chatbot_skype_floating_icon');
2389 delete_option( 'enable_wp_chatbot_skype_id');
2390 //whats app
2391 delete_option( 'enable_wp_chatbot_whats');
2392 delete_option( 'qlcd_wp_chatbot_whats_label');
2393 delete_option( 'enable_wp_chatbot_floating_whats');
2394 delete_option( 'qlcd_wp_chatbot_whats_num');
2395 // Viber
2396 delete_option( 'enable_wp_chatbot_floating_viber');
2397 delete_option( 'qlcd_wp_chatbot_viber_acc');
2398 //Integration others
2399 delete_option( 'enable_wp_chatbot_floating_phone');
2400 delete_option( 'qlcd_wp_chatbot_phone');
2401 delete_option( 'enable_wp_chatbot_floating_link');
2402 delete_option( 'qlcd_wp_chatbot_weblink');
2403 //Re Targetting
2404 delete_option( 'qlcd_wp_chatbot_ret_greet');
2405 delete_option( 'enable_wp_chatbot_exit_intent');
2406 delete_option( 'wp_chatbot_exit_intent_msg');
2407 delete_option( 'wp_chatbot_exit_intent_once');
2408
2409 delete_option( 'enable_wp_chatbot_scroll_open');
2410 delete_option( 'wp_chatbot_scroll_open_msg');
2411 delete_option( 'wp_chatbot_scroll_percent');
2412 delete_option( 'wp_chatbot_scroll_once');
2413
2414 delete_option( 'enable_wp_chatbot_auto_open');
2415 delete_option( 'enable_wp_chatbot_ret_sound');
2416 delete_option( 'enable_wp_chatbot_sound_initial');
2417 delete_option( 'disable_wp_chatbot_feedback');
2418 delete_option( 'disable_wp_chatbot_faq');
2419 delete_option( 'qlcd_wp_chatbot_feedback_label');
2420 delete_option( 'enable_wp_chatbot_meta_title');
2421 delete_option( 'qlcd_wp_chatbot_meta_label');
2422 delete_option( 'wp_chatbot_auto_open_msg');
2423 delete_option( 'wp_chatbot_auto_open_time');
2424 delete_option( 'wp_chatbot_auto_open_once');
2425 delete_option( 'wp_chatbot_inactive_once');
2426 delete_option( 'wp_chatbot_proactive_bg_color');
2427 delete_option( 'qlcd_wp_chatbot_phone_sent');
2428 delete_option( 'qlcd_wp_chatbot_phone_fail');
2429 delete_option( 'disable_wp_chatbot_call_gen');
2430 delete_option( 'disable_wp_chatbot_site_search');
2431 delete_option( 'disable_wp_chatbot_call_sup');
2432
2433 delete_option( 'enable_wp_chatbot_ret_user_show');
2434 delete_option( 'enable_wp_chatbot_inactive_time_show');
2435 delete_option( 'wp_chatbot_inactive_time');
2436 delete_option( 'wp_chatbot_checkout_msg');
2437 delete_option( 'qlcd_wp_chatbot_shopper_demo_name');
2438 delete_option( 'qlcd_wp_chatbot_is_typing');
2439 delete_option( 'qlcd_wp_chatbot_send_a_msg');
2440 delete_option( 'qlcd_wp_chatbot_choose_option');
2441 delete_option( 'qlcd_wp_chatbot_viewed_products');
2442 delete_option( 'qlcd_wp_chatbot_help_welcome');
2443 delete_option( 'qlcd_wp_chatbot_help_msg');
2444 delete_option( 'qlcd_wp_chatbot_reset');
2445 delete_option( 'enable_wp_chatbot_opening_hour');
2446 delete_option( 'wpwbot_hours');
2447 delete_option( 'enable_wp_chatbot_dailogflow');
2448 delete_option( 'qlcd_wp_chatbot_dialogflow_client_token');
2449 delete_option( 'qlcd_wp_chatbot_dialogflow_defualt_reply');
2450 delete_option( 'qlcd_wp_chatbot_dialogflow_agent_language');
2451
2452 delete_option( 'qlcd_wp_chatbot_dialogflow_project_id');
2453 delete_option( 'wp_chatbot_df_api');
2454 delete_option( 'qlcd_wp_chatbot_dialogflow_project_key');
2455
2456 delete_option( 'wp_chatbot_bot_msg_bg_color');
2457 delete_option( 'wp_chatbot_bot_msg_text_color');
2458 delete_option( 'wp_chatbot_user_msg_bg_color');
2459 delete_option( 'wp_chatbot_user_msg_text_color');
2460 delete_option( 'wp_chatbot_buttons_bg_color');
2461 delete_option( 'wp_chatbot_buttons_text_color');
2462
2463 delete_option( 'wp_chatbot_buttons_bg_color_hover');
2464 delete_option( 'wp_chatbot_buttons_text_color_hover');
2465
2466 delete_option( 'wp_chatbot_theme_secondary_color');
2467 delete_option( 'wp_chatbot_theme_primary_color');
2468 delete_option( 'wp_chatbot_header_background_color');
2469 delete_option('wp_chatbot_font_size');
2470 delete_option('wp_chat_user_font_family');
2471 delete_option('wp_chat_bot_font_family');
2472 delete_option('wp_chatbot_bot_font');
2473 delete_option('wp_chatbot_user_font');
2474 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
2475 qcld_wb_chatboot_defualt_options();
2476 $html='Reset all options to default successfully.';
2477 wp_send_json($html);
2478 }
2479
2480 function wpbot_free_qc_upgrade_completed( $upgrader_object, $options ) {
2481 // The path to our plugin's main file
2482 $our_plugin = plugin_basename( __FILE__ );
2483 // If an update has taken place and the updated type is plugins and the plugins element exists
2484 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
2485 // Iterate through the plugins being updated and check if ours is there
2486 foreach( $options['plugins'] as $plugin ) {
2487 if( $plugin == $our_plugin ) {
2488 set_transient( 'bot_clear_cache', 1, DAY_IN_SECONDS );
2489 }
2490 }
2491 }
2492 }
2493 add_action( 'upgrader_process_complete', 'wpbot_free_qc_upgrade_completed', 10, 2 );
2494
2495 /**
2496 *
2497 * Function to load translation files.
2498 *
2499 */
2500 function wp_chatbot_lang_init() {
2501 load_plugin_textdomain( 'wpchatbot', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
2502 }
2503 add_action( 'plugins_loaded', 'wp_chatbot_lang_init');
2504
2505 $wpbot_feedback = new Wp_Usage_Feedback(
2506 __FILE__,
2507 'plugins@quantumcloud.com',
2508 false,
2509 true
2510
2511 );
2512
2513 function wpbot_help_page_callback_func(){
2514 ?>
2515 <div class="wrap swpm-admin-menu-wrap">
2516 <h2></h2>
2517 <h2 class="nav-tab-wrapper sld_nav_container wppt_nav_container">
2518 <a class="nav-tab sld_click_handle nav-tab-active" href="#general_int">Getting Started</a>
2519
2520 <a class="nav-tab sld_click_handle" id="general_debuggings" href="#general_debugging">Troubleshooting & FAQ</a>
2521
2522 </h2>
2523
2524
2525 <!-- <div class="container wppt-settings-section" style="margin-right:unset;margin-left:unset; margin-top:40px" id="general_help">
2526 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff">
2527 <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>
2528 </div>
2529 </div>-->
2530
2531
2532
2533 <div class="container wppt-settings-section" style="margin-right:unset;margin-left:unset; display:block; margin-top:40px" id="general_int">
2534 <div class="content form-container qcbot_help_secion" style="">
2535 <!-- new Section -->
2536
2537 <h2 style="margin-top: 10px;color:#fff">WPBot Interactions</h2>
2538 <h3 style="color:#fff">You can create user interactions in the following ways:</h3>
2539 <div style="clear:both"></div>
2540 <div class="panel panel-default">
2541 <div class="panel-heading" role="tab" id="headingOne">
2542 <h4 class="panel-title">
2543 <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>
2544 </h4>
2545 </div>
2546 <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
2547 <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">
2548 <div class="wpb_column vc_column_container vc_col-sm-6">
2549 <div class="vc_column-inner ">
2550 <div class="wpb_wrapper">
2551 <div class="to-icon-box left txt-left">
2552 <div class="to-icon-txt fa-4x-txt ">
2553 <h3>
2554 <span>// </span>Simple Text Responses
2555 </h3>
2556 <p>Create unlimited text responses from your WordPress backend. The ChatBot uses advanced search algorithm for natural language phrase matching with user input. </p>
2557 </div>
2558 </div>
2559 <div class="to-icon-box left txt-left">
2560 <div class="to-icon-txt fa-4x-txt ">
2561 <h3>
2562 <span>// </span>Send eMail, Call Me Back &amp; Feedback Collection
2563 </h3>
2564 <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>
2565 </div>
2566 </div>
2567 <div class="to-icon-box left txt-left">
2568 <div class="to-icon-txt fa-4x-txt ">
2569 <h3>
2570 <span>// </span>Advanced Site Search <span class="qc_wpbot_pro">PRO</span>
2571 </h3>
2572 <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>
2573 </div>
2574 </div>
2575 </div>
2576 </div>
2577 </div>
2578 <div class="wpb_column vc_column_container vc_col-sm-6">
2579 <div class="vc_column-inner ">
2580 <div class="wpb_wrapper">
2581 <div class="to-icon-box left txt-left">
2582 <div class="to-icon-txt fa-4x-txt ">
2583 <h3>
2584 <span>// </span>Frequently Asked Questions
2585 </h3>
2586 <p>Create a set of Frequently Asked Questions or FAQ so users can quickly find answers to the most common questions they have.</p>
2587 </div>
2588 </div>
2589 <div class="to-icon-box left txt-left">
2590 <div class="to-icon-txt fa-4x-txt ">
2591 <h3>
2592 <span>// </span>Ask for name, email, phone number etc.
2593 </h3>
2594 <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>
2595 </div>
2596 </div>
2597 <div class="to-icon-box left txt-left">
2598 <div class="to-icon-txt fa-4x-txt ">
2599 <h3>
2600 <span>// </span>Newsletter Subscription <span class="qc_wpbot_pro">PRO</span>
2601 </h3>
2602 <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>
2603 </div>
2604 </div>
2605 </div>
2606 </div>
2607 </div>
2608 </div>
2609 </div>
2610 </div>
2611 </div>
2612 <div class="panel panel-default">
2613 <div class="panel-heading" role="tab" id="headingTwo">
2614 <h4 class="panel-title">
2615 <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>
2616 </h4>
2617 </div>
2618 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
2619 <div class="panel-body">
2620 <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>
2621 <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>.
2622 </p>
2623 <h4>Conversational Form Builder Free or Pro version works with the WPBot Free or Pro versions.</h4>
2624 <a class="FormBuilder" href="https://wordpress.org/plugins/conversational-forms/" target="_blank">Download Free Version</a>
2625 <a class="FormBuilder" href="https://www.quantumcloud.com/products/conversations-and-form-builder/" target="_blank">Grab the Pro version</a>
2626 <h4>What Can You Do with it?</h4>
2627 <p>Conversation Forms allows you to create a wide variety of forms, that might include:</p>
2628 <ul>
2629 <li>Create menu or button driven conversations</li>
2630 <li>Conditional <strong>Menu Driven Conversations</strong>
2631 <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
2632 </li>
2633 <li>Standard Contact Forms</li>
2634 <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>
2635 </li>
2636 <li>Job <strong>Application Forms</strong>
2637 </li>
2638 <li>
2639 <strong>Lead Capture</strong> Forms
2640 </li>
2641 <li>Various types of <strong>Calculators</strong>
2642 <span class="qc_wpbot_pro" style="font-size: 9px;">PRO</span>
2643 </li>
2644 <li>Feedback <strong>Survey</strong> Forms etc. </li>
2645 </ul>
2646 </div>
2647 </div>
2648 </div>
2649 <div class="panel panel-default">
2650 <div class="panel-heading" role="tab" id="headingThree">
2651 <h4 class="panel-title">
2652 <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>
2653 </h4>
2654 </div>
2655 <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
2656 <div class="panel-body">
2657 <div class="section-container">
2658 <div class="wpb_column vc_column_container vc_col-sm-6">
2659 <div class="wpb_wrapper">
2660 <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>
2661 <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>
2662 </p>
2663 <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>
2664 </p>
2665 <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.
2666 </div>
2667 </div>
2668 <div class="wpb_column vc_column_container vc_col-sm-6">
2669 <div class="wpb_wrapper">
2670 <h2 style="font-size: 20px;">DialogFlow CX <span class="qc_wpbot_pro">PRO</span>
2671 </h2>
2672 <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>
2673 <ul>
2674 <li>
2675 <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.
2676 </li>
2677 <li>
2678 <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.
2679 </li>
2680 <li>
2681 <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.
2682 </li>
2683 <img style="width:100%" src="<?php echo QCLD_wpCHATBOT_IMG_URL . '/dialogflow-cx-1024x676.jpg';?>" alt="Dialogflow CX">
2684 </ul>
2685 </div>
2686 </div>
2687 </div>
2688 </div>
2689 </div>
2690 </div>
2691
2692
2693 <!-- end new Section -->
2694
2695 </div>
2696 </div>
2697
2698
2699
2700
2701
2702
2703
2704
2705 <div class="container wppt-settings-section" style="margin-right:unset;margin-left:unset;display:none" id="general_debugging">
2706
2707
2708
2709 <div class="content form-container qcbot_help_secion" style="margin-right:unset;margin-left:unset; margin-top:40px" >
2710 <div class="" style="color:#fff">
2711 <h2 style="font-size:28px;margin-top: 10px;">Tips</h2>
2712 <h2 style="font-size:20px;margin-top: 10px;">Tutorial</h2>
2713 <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>
2714 <h2 style="font-size:20px">Simple Text Responses</h2>
2715 <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>
2716 <h2 style="font-size:20px">Setting Updates</h2>
2717 <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>
2718 <h2 style="font-size:20px">Note</h2>
2719 <p>You could use &lt;br&gt; tag in Language Center & Dialogflow Responses for line break.</p>
2720 </div>
2721 </div>
2722
2723
2724
2725 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;margin-top:0px">
2726 <h2 style="font-size:20px">Problem: I changed language and/or some settings but do not see the changes.</h2>
2727 <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>
2728 </div>
2729 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2730 <h2 style="font-size:20px">Problem: I cannot connect to the DialogFlow</h2>
2731 <p>To Debug: 1. Make sure that you have created the Google Project and the Service account as an Owner<br>
2732 2. Make sure that you have connected to the correct Dialogflow agent<br>
2733 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>
2734 4. Make sure that the Google Client Package is Installed on Your Website.<br>
2735 5. For DialogFlow agent region, try choosing any region other than the EU region which has known issues.<br>
2736 6. Make sure to download and import the sample DialogFlow agent to your agent<br>
2737 7. Test the ChatBot in the browser Incognito mode</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 am not getting emails from the ChatBot</h2>
2741 <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>
2742 </div>
2743 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2744 <h2 style="font-size:20px">Problem: Simple text responses are not working or getting an error</h2>
2745 <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>
2746 </div>
2747 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2748 <h2 style="font-size:20px">Problem: I changed language or some other settings but do not see them when testing</h2>
2749 <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>
2750 </div>
2751 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2752 <h2 style="font-size:20px">Problem: The ChatBot is NOT working in the front end.</h2>
2753 <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>
2754 Also go to Simple Text Responses and press the Re-Index button.</br>
2755 After that try purging any cache and test the chatbot in Incognito mode<br>
2756 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>
2757 </div>
2758 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2759 <h2 style="font-size:20px">Problem: The ChatBot is stuck on typing or loading</h2>
2760 <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>
2761 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>
2762 Also go to Simple Text Responses and press the Re-Index button.</br>
2763 After that remember to test in a browser Incognito mode to avoid cache and cookies. </p>
2764 </div>
2765 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2766 <h2 style="font-size:20px">Problem: How do I add new conversations to the ChatBot?</h2>
2767 <p>Please check the plugin's Help Section for details on this</p>
2768 </div>
2769 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2770 <h2 style="font-size:20px">Problem: How do I add Line Breaks?</h2>
2771 <p>Please use the &lt;br&gt; tag for line breaks.</p>
2772 </div>
2773 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2774 <h2 style="font-size:20px">Problem: Are HTML tags supported? </h2>
2775 <p>Yes, common HTML tags link link href, strong, br etc. are supported.</p>
2776 </div>
2777 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2778 <h2 style="font-size:20px">Problem: I want to add images, GIFs, Videos</h2>
2779 <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>
2780 </div>
2781
2782
2783 <div class="content form-container qcbot_help_secion" style="padding: 10px;color:#fff;">
2784 <h2 style="font-size:20px">How to disable Predefined Intent?</h2>
2785 <p>You can disable predefined intents FAQ, eMail, Call me from WPBot Lite > Settings page's Start Menu Section.</p>
2786 </div>
2787
2788
2789 </div>
2790
2791 </div>
2792 <script type="text/javascript">
2793 jQuery(document).ready(function($){
2794 var url=document.URL;
2795 var arr=url.split('#');
2796 var tab_tar = '.'+arr[1];
2797 setTimeout(function(){
2798 jQuery(tab_tar).trigger('click');
2799 }, 500);
2800
2801 jQuery('.wppt_nav_container .nav-tab').on('click', function(e){
2802 e.preventDefault();
2803 var section_id = jQuery(this).attr('href');
2804 jQuery('.wppt_nav_container .nav-tab').removeClass('nav-tab-active');
2805 jQuery(this).addClass('nav-tab-active');
2806 jQuery('.wppt-settings-section').hide();
2807 jQuery('.wppt-settings-section').each(function(){
2808 jQuery(section_id).show();
2809 });
2810 });
2811 })
2812 </script>
2813 <?php
2814 }
2815
2816 add_action('init', 'qc_wp_latest_update_check');
2817 function qc_wp_latest_update_check(){
2818 global $wpdb;
2819
2820 if(!get_option('qc_wp_ludate_ck')){
2821 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
2822 update_option('qlcd_wp_chatbot_support_email', 'Send us Email');
2823 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
2824 update_option('qc_wp_ludate_ck', 'done');
2825 }
2826
2827 if( ! get_option( 'wpbot-admin-notice-oninstallation' ) ){
2828 update_option('wpbot-admin-notice-oninstallation', 'show');
2829 }
2830
2831 if(!get_option('qc_wpb_simple_response_db_upgrade_free2')){
2832
2833 $collate = '';
2834 if ( $wpdb->has_cap( 'collation' ) ) {
2835
2836 if ( ! empty( $wpdb->charset ) ) {
2837
2838 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
2839 }
2840 if ( ! empty( $wpdb->collate ) ) {
2841
2842 $collate .= " COLLATE $wpdb->collate";
2843
2844 }
2845 }
2846 //Bot Response Table
2847 $table1 = $wpdb->prefix.'wpbot_response';
2848 $sql_sliders_Table1 = "
2849 CREATE TABLE IF NOT EXISTS `$table1` (
2850 `id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
2851 `query` TEXT NOT NULL,
2852 `keyword` TEXT NOT NULL,
2853 `response` TEXT NOT NULL,
2854 `category` varchar(256) NOT NULL,
2855 `intent` varchar(256) NOT NULL,
2856 `custom` varchar(256) NOT NULL,
2857 `lang` varchar(25) NULL,
2858 FULLTEXT(`query`, `keyword`, `response`)
2859 ) $collate AUTO_INCREMENT=1 ENGINE=InnoDB";
2860
2861 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2862 dbDelta( $sql_sliders_Table1 );
2863
2864 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2865 update_option('qlcd_wp_chatbot_did_you_mean', serialize(array('Did you mean?')));
2866 }
2867
2868 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2869 update_option('qlcd_wp_chatbot_did_you_mean', serialize(array('Did you mean?')));
2870 }
2871
2872 $sqlqry = $wpdb->get_results("select * from $table1");
2873 if(empty($sqlqry)){
2874
2875 $query = 'What Can WPBot do for you?';
2876 $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!';
2877
2878 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2879 $format = array('%s','%s', '%s', '%s');
2880 $wpdb->insert($table1,$data,$format);
2881 }
2882
2883 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
2884
2885 }
2886
2887 if(!get_option('qc_wp_db_engine_update_free')){
2888 $table1 = $wpdb->prefix.'wpbot_response';
2889 $wpdb->query("ALTER TABLE $table1 ENGINE = InnoDB");
2890
2891 update_option('qc_wp_db_engine_update_free', 'done');
2892 }
2893 if(!get_option('qc_wp_db_engine_update_free_unassign')){
2894 $table1 = $wpdb->prefix.'wpbot_response';
2895 $wpdb->query("ALTER TABLE $table1 CHANGE `id` `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;");
2896 update_option('qc_wp_db_engine_update_free_unassign', 'done');
2897 }
2898
2899 if(isset($_POST['qc_bot_str_query']) && $_POST['qc_bot_str_query']!='' && !class_exists('Qcld_str_pro')){
2900
2901 $query = wp_unslash(sanitize_text_field($_POST['qc_bot_str_query']));
2902 $keyword = wp_unslash(sanitize_text_field($_POST['qc_bot_str_keyword']));
2903 $intent = wp_unslash(sanitize_text_field($_POST['qc_bot_str_intent']));
2904
2905 $category = '';
2906
2907 $response = wp_kses(wp_unslash($_POST['qc_bot_str_response']), 'post');
2908
2909 $table = $wpdb->prefix.'wpbot_response';
2910 $data = array('query' => $query, 'keyword' => $keyword, 'response'=> $response, 'intent'=> $intent, 'category'=> $category);
2911 $format = array('%s','%s', '%s', '%s', '%s');
2912
2913 if(isset($_POST['qc_bot_str_id']) && $_POST['qc_bot_str_id']!=''){
2914 $id = sanitize_text_field($_POST['qc_bot_str_id']);
2915 $where = array('id'=>$id);
2916 $whereformat = array('%d');
2917 $wpdb->update( $table, $data, $where, $format, $whereformat );
2918 }else{
2919 $wpdb->insert($table,$data,$format);
2920 }
2921
2922 qc_mysql_remove_existing_indexes();
2923 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
2924
2925 wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
2926
2927 }
2928 $table = $wpdb->prefix.'wpbot_response';
2929 if(isset($_POST['qc-re-index'])){
2930 qc_mysql_remove_existing_indexes();
2931 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`)");
2932 add_action('admin_notices', 'general_admin_notice_str' );
2933 }
2934 if(isset($_POST['qc_bot_str_weight']) && $_POST['qc_bot_str_weight']!=''){
2935 $weight = sanitize_text_field($_POST['qc_bot_str_weight']);
2936 update_option('qc_bot_str_weight', $weight);
2937 }
2938 if(isset($_POST['qc_bot_str_remove_stopwords']) && $_POST['qc_bot_str_remove_stopwords']!=''){
2939
2940 $stopwords = sanitize_text_field($_POST['qc_bot_str_remove_stopwords']);
2941 update_option('qc_bot_str_remove_stopwords', '1');
2942 }
2943 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
2944 $table = $wpdb->prefix.'wpbot_response';
2945 $fields = ($_POST['qc_bot_str_fields']);
2946 update_option('qc_bot_str_fields', $fields);
2947 qc_mysql_remove_existing_indexes();
2948
2949 if($fields && !empty($fields)){
2950 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
2951 }
2952 }
2953
2954 if(!get_option('wpbot_preloading_time')) {
2955 update_option('wpbot_preloading_time', '0.5');
2956 }
2957
2958 }
2959
2960 function general_admin_notice_str(){
2961 if ( isset($_GET['page']) && $_GET['page'] == 'simple-text-response' ) {
2962 echo '<div class="notice notice-success is-dismissible">
2963 <p>Re-Indexing has been completed!</p>
2964 </div>';
2965 }
2966 }
2967
2968 function qc_wpbot_simple_response_intent(){
2969 global $wpdb;
2970 $table = $wpdb->prefix.'wpbot_response';
2971 $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''");
2972 $response = array();
2973 if(!empty($results)){
2974 foreach($results as $result){
2975 $response[] = $result->intent;
2976 }
2977 }
2978 return $response;
2979 }
2980
2981 function qc_mysql_remove_existing_indexes(){
2982 global $wpdb;
2983 $table = $wpdb->prefix.'wpbot_response';
2984
2985 $results = $wpdb->get_results("SHOW INDEX FROM $table");
2986 $indexes = array();
2987 foreach($results as $result){
2988
2989
2990
2991 if("PRIMARY" != $result->Key_name && !in_array($result->Key_name, $indexes)){
2992 $wpdb->query("ALTER TABLE $table DROP INDEX `".$result->Key_name
2993 ."`;");
2994 $indexes[] = $result->Key_name;
2995 }
2996
2997 }
2998 }
2999
3000 add_action( 'activated_plugin', 'qc_wpbotfree_activation_redirect' );
3001 function qc_wpbotfree_activation_redirect( $plugin ){
3002
3003 if( $plugin == plugin_basename( __FILE__ ) ) {
3004 exit( wp_redirect( admin_url('admin.php?page=wpbot_help_page') ) );
3005 }
3006 }
3007
3008
3009
3010
3011