PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 3.2.9
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v3.2.9
8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 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 3.2.9, at qcld-wpwbot.php

2,191 lines 126.2 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 WordPress Chat Bot plugin to provide quick support and email functionality.
6 * Donate link: https://www.quantumcloud.com
7 * Version: 3.2.9
8 * @author QuantumCloud
9 * Author: QuantumCloud
10 * Author URI: https://www.quantumcloud.com/
11 * Requires at least: 4.6
12 * Tested up to: 5.3
13 * Text Domain: wpbot
14 * Domain Path: /lang
15 * License: GPL2
16 */
17
18
19 if (!defined('ABSPATH')) exit; // Exit if accessed directly
20 define('QCLD_wpCHATBOT_VERSION', '1.0');
21 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
22 define('QCLD_wpCHATBOT_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
23 define('QCLD_wpCHATBOT_PLUGIN_URL', plugin_dir_url(__FILE__));
24 define('QCLD_wpCHATBOT_IMG_URL', QCLD_wpCHATBOT_PLUGIN_URL . "images/");
25 define('QCLD_wpCHATBOT_IMG_ABSOLUTE_PATH', plugin_dir_path(__FILE__) . "images");
26 define('QCLD_wpCHATBOT_INDEX_TABLE', 'wpwbot_index');
27 //define('QCLD_wpCHATBOT_CACHE_TABLE', 'wpwbot_cache');
28
29 $gcdirpath = __DIR__.'/../../wpbot-dfv2-client';
30 define('QCLD_wpCHATBOT_GC_DIRNAME', $gcdirpath);
31 $wpcontentpath = __DIR__.'/../../';
32 define('QCLD_wpCHATBOT_GC_ROOT', $wpcontentpath);
33
34 require_once("qcld-wpwbot-search.php");
35 require_once("class-qc-free-plugin-upgrade-notice.php");
36 require_once("class-plugin-deactivate-feedback.php");
37 require_once("qc-support-promo-page/class-qc-support-promo-page.php");
38 require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH."/functions.php");
39 require_once('qcld_df_api.php');
40 require_once('includes/class-wpbot-gc-download.php');
41 require_once('includes/class-response-list.php');
42
43 /*
44 if(file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH. "/conversion-tracker/class-qc-conversion-tracker.php")){
45 require_once (QCLD_wpCHATBOT_PLUGIN_DIR_PATH. "/conversion-tracker/class-qc-conversion-tracker.php");
46 }
47 */
48 /**
49 * Main Class.
50 */
51 class qcld_wb_Chatbot
52 {
53 private $id = 'wpbot';
54 private static $instance;
55 /**
56 * Get Instance creates a singleton class that's cached to stop duplicate instances
57 */
58 public static function qcld_wb_chatbot_get_instance()
59 {
60 if (!self::$instance) {
61 self::$instance = new self();
62 self::$instance->qcld_wb_chatbot_init();
63 }
64 return self::$instance;
65 }
66 /**
67 * Construct empty on purpose
68 */
69 private function __construct()
70 {
71 }
72 /**
73 * Init behaves like, and replaces, construct
74 */
75 public function qcld_wb_chatbot_init()
76 {
77 // Check if wpCommerce is active, and is required wpCommerce version.
78 /*if (!class_exists('wpCommerce') || version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) {
79 add_action('admin_notices', array($this, 'wpcommerce_inactive_notice_for_wp_chatbot'));
80 return;
81 }*/
82 add_action('admin_menu', array($this, 'qcld_wb_chatbot_admin_menu'));
83 if ((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) {
84 add_action('admin_init', array($this, 'qcld_wb_chatbot_save_options'));
85 }
86 if (is_admin() && !empty($_GET["page"]) && ($_GET["page"] == "wpbot") || (isset($_GET['page']) && $_GET['page']=='wpbot_help_page') || (isset($_GET['page']) && $_GET['page']=='wpbot-panel') ) {
87 add_action('admin_enqueue_scripts', array($this, 'qcld_wb_chatbot_admin_scripts'));
88 if( get_option('wp_chatbot_index_count')<=0 && get_option('qlcd_wp_chatbot_search_option')=='advanced'){
89 add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
90 }
91 }
92 if (!is_admin()) {
93 add_action('wp_enqueue_scripts', array($this, 'qcld_wb_chatbot_frontend_scripts'));
94 }
95 }
96 /**
97 * Add a submenu item to the wpCommerce menu
98 */
99 public function qcld_wb_chatbot_admin_menu()
100 {
101 /* add_submenu_page('wpcommerce',
102 __('wpwBot Pro', 'wpchatbot'),
103 __('wpwBot Pro', 'wpchatbot'),
104 'manage_wpcommerce',
105 $this->id,
106 array($this, 'qcld_wb_chatbot_admin_page'));*/
107
108 add_menu_page( 'WPBot Lite', 'WPBot Lite', 'manage_options','wpbot-panel', array($this, 'qcld_wb_chatbot_admin_page'),'dashicons-format-status', 6 );
109
110 add_submenu_page( 'wpbot-panel', 'Settings', 'Settings', 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
111
112 $hook = add_submenu_page( 'wpbot-panel', 'Simple Text Responses', 'Simple Text Responses', 'manage_options','simple-text-response', array($this, 'qcld_wb_chatbot_admin_str') );
113
114 add_action( "load-$hook", [ $this, 'screen_option' ] );
115
116 add_submenu_page( 'wpbot-panel', 'Support', 'Support', 'manage_options','wpbot_support_page', 'qcpromo_support_page_callback_func' );
117
118 add_submenu_page( 'wpbot-panel', 'Help', 'Help', 'manage_options','wpbot_help_page', 'wpbot_help_page_callback_func' );
119 }
120
121 function screen_option(){
122 $option = 'per_page';
123 $args = [
124 'label' => 'Response',
125 'default' => 5,
126 'option' => 'responses_per_page'
127 ];
128
129 add_screen_option( $option, $args );
130
131 $this->response_list = new Response_list();
132 }
133
134 public function qcld_wb_chatbot_admin_str(){
135
136 require_once("includes/simple_text_response.php");
137
138 }
139
140 /**
141 * Include admin scripts
142 */
143 public function qcld_wb_chatbot_admin_scripts($hook)
144 {
145 global $wpcommerce, $wp_scripts;
146 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
147 if (((!empty($_GET["page"])) && ($_GET["page"] == "wpbot")) || ($hook == "widgets.php") || $_GET['page']=='wpbot_help_page' || $_GET['page']=='wpbot-panel') {
148 wp_enqueue_script('jquery');
149 //wp_enqueue_style('wpcommerce_admin_styles', $wpcommerce->plugin_url() . '/assets/css/admin.css');
150 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');
151 wp_enqueue_style('qlcd-wp-chatbot-admin-style');
152 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');
153 wp_enqueue_style('qlcd-wp-chatbot-font-awesome');
154 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');
155 wp_enqueue_style('qlcd-wp-chatbot-tabs-style');
156 wp_enqueue_script('jquery');
157 wp_enqueue_script( 'jquery-ui-draggable' );
158 wp_enqueue_script( 'jquery-ui-droppable' );
159 wp_enqueue_script('jquery-ui-core');
160 wp_enqueue_style( 'wp-color-picker');
161 wp_enqueue_script( 'wp-color-picker');
162 wp_enqueue_script( 'jquery-ui-sortable');
163 wp_register_script('qcld-wp-chatbot-cbpFWTabs', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/cbpFWTabs.js', basename(__FILE__)), array(), true);
164 wp_enqueue_script('qcld-wp-chatbot-cbpFWTabs');
165 wp_register_script('qcld-wp-chatbot-modernizr-custom', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/modernizr.custom.js', basename(__FILE__)), array(), true);
166 wp_enqueue_script('qcld-wp-chatbot-modernizr-custom');
167 wp_register_script('qcld-wp-chatbot-bootstrap-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/bootstrap.js', basename(__FILE__)), array('jquery'), true);
168 wp_enqueue_script('qcld-wp-chatbot-bootstrap-js');
169 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');
170 wp_enqueue_style('qcld-wp-chatbot-bootstrap-css');
171 //jquery time picker
172 wp_register_script('qcld-wp-chatbot-timepicker-js', plugins_url(basename(plugin_dir_path(__FILE__)) . '/js/jquery.timepicker.js', basename(__FILE__)), array('jquery'), true);
173 wp_enqueue_script('qcld-wp-chatbot-timepicker-js');
174 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');
175 wp_enqueue_style('qcld-wp-chatbot-timepicker-css');
176 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'), true);
177 wp_enqueue_script('qcld-wp-chatbot-admin-js');
178 wp_localize_script('qcld-wp-chatbot-admin-js', 'ajax_object',
179 array('ajax_url' => admin_url('admin-ajax.php'),'image_path' => QCLD_wpCHATBOT_IMG_URL));
180 // WordPress Media library
181 wp_enqueue_media();
182 }
183 }
184
185
186
187 public function qcld_wb_chatbot_frontend_scripts()
188 {
189 global $wpcommerce, $wp_scripts, $wpdb;
190
191 $conversation_form_ids = array();
192 $conversation_form_names = array();
193
194 if(class_exists('Qcformbuilder_Forms_Admin')){
195 $results = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix."wfb_forms where 1 and type='primary'");
196 if(!empty($results)){
197
198 foreach($results as $result){
199 $form = unserialize($result->config);
200 $conversation_form_ids[] = $form['ID'];
201 $conversation_form_names[] = $form['name'];
202 }
203
204 }
205 }
206
207 $wp_chatbot_obj = array(
208 'wp_chatbot_position_x' => get_option('wp_chatbot_position_x'),
209 'wp_chatbot_position_y' => get_option('wp_chatbot_position_y'),
210 'disable_icon_animation' => get_option('disable_wp_chatbot_icon_animation'),
211 'disable_featured_product' => get_option('disable_wp_chatbot_featured_product'),
212 'disable_product_search' => get_option('disable_wp_chatbot_product_search'),
213 'disable_catalog' => get_option('disable_wp_chatbot_catalog'),
214 'disable_order_status' => get_option('disable_wp_chatbot_order_status'),
215 'disable_sale_product' => get_option('disable_wp_chatbot_sale_product'),
216 'open_product_detail' => get_option('wp_chatbot_open_product_detail'),
217 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
218 'ajax_url' => admin_url('admin-ajax.php'),
219 'image_path' => QCLD_wpCHATBOT_IMG_URL,
220 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
221 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
222 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
223 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
224 'agent' => str_replace('\\', '',get_option('qlcd_wp_chatbot_agent')),
225 'agent_image' => get_option('wp_chatbot_agent_image'),
226 'agent_image_path' => $this->qcld_wb_chatbot_agent_icon(),
227 'shopper_demo_name' => str_replace('\\', '',get_option('qlcd_wp_chatbot_shopper_demo_name')),
228 'agent_join' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
229 'welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_welcome'))),
230 'welcome_back' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
231 'hi_there' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
232 'asking_name' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_name'))),
233 'i_am' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_i_am'))),
234 'name_greeting' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_name_greeting'))),
235 'wildcard_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_msg'))),
236 'empty_filter_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_empty_filter_msg'))),
237 'did_you_mean' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_did_you_mean'))),
238 'is_typing' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_is_typing'))),
239 'send_a_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_send_a_msg'))),
240 'viewed_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_viewed_products'))),
241 'shopping_cart' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_shopping_cart'))),
242 'cart_updating' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_cart_updating'))),
243 'cart_removing' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_cart_removing'))),
244 'sys_key_help' => get_option('qlcd_wp_chatbot_sys_key_help'),
245 'sys_key_product' => get_option('qlcd_wp_chatbot_sys_key_product'),
246 'sys_key_catalog' => get_option('qlcd_wp_chatbot_sys_key_catalog'),
247 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
248 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
249 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
250 'help_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
251 'back_to_start' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
252 'help_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
253 'reset' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_reset'))),
254 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
255 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
256 'featured_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
257 'sale_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
258 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
259 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
260 'product_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
261 'product_suggest' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
262 'product_infinite' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
263 'product_success' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_success'))),
264 'product_fail' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
265 'support_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
266 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
267 'support_option_again' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
268 'asking_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
269 'asking_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
270 'no_result' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_no_result'))),
271 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
272 'asking_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
273 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
274 'support_query' =>$this->qcld_wb_chatbot_str_replace(unserialize( get_option('support_query'))),
275 'support_ans' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('support_ans'))),
276 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
277 'notifications' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_notifications'))),
278 'order_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
279 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
280 'order_username_password' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
281 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
282 'order_login' => is_user_logged_in(),
283 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
284 'order_email_support' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
285 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
286 'invalid_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
287 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
288 'currency_symbol' => '',
289 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
290 'messenger_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
291 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
292 'enable_skype' => get_option('enable_wp_chatbot_skype'),
293 'enable_whats' => get_option('enable_wp_chatbot_whats'),
294 'whats_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
295 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
296 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
297 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
298 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
299 'exit_intent_once' => get_option('wp_chatbot_exit_intent_once'),
300 'enable_scroll_open' => get_option('enable_wp_chatbot_scroll_open'),
301 'scroll_open_msg' => str_replace('\\', '', get_option('wp_chatbot_scroll_open_msg')),
302 'scroll_open_percent' => get_option('wp_chatbot_scroll_percent'),
303 'scroll_open_once' => get_option('wp_chatbot_scroll_once'),
304 'enable_auto_open' => get_option('enable_wp_chatbot_auto_open'),
305 'auto_open_msg' => str_replace('\\', '', get_option('wp_chatbot_auto_open_msg')),
306 'auto_open_time' => get_option('wp_chatbot_auto_open_time'),
307 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
308 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
309 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
310 'disable_faq' => get_option('disable_wp_chatbot_faq'),
311 'feedback_label' =>$this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
312 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
313 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
314 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
315 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
316 'site_search' => get_option('qlcd_wp_site_search'),
317 'call_gen' => get_option('disable_wp_chatbot_call_gen'),
318 'call_sup' => get_option('disable_wp_chatbot_call_sup'),
319 'enable_ret_sound' => get_option('enable_wp_chatbot_ret_sound'),
320 'enable_ret_user_show' => get_option('enable_wp_chatbot_ret_user_show'),
321 'enable_inactive_time_show' => get_option('enable_wp_chatbot_inactive_time_show'),
322 'ret_inactive_user_once' => get_option('wp_chatbot_inactive_once'),
323 'mobile_full_screen' => get_option('enable_wp_chatbot_mobile_full_screen'),
324 'inactive_time' => get_option('wp_chatbot_inactive_time'),
325 'checkout_msg' => str_replace('\\', '', get_option('wp_chatbot_checkout_msg')),
326 'ai_df_enable' => get_option('enable_wp_chatbot_dailogflow'),
327 'ai_df_token' => get_option('qlcd_wp_chatbot_dialogflow_client_token'),
328 'df_defualt_reply' => str_replace('\\', '', get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')),
329 'df_agent_lan' => get_option('qlcd_wp_chatbot_dialogflow_agent_language'),
330 'start_menu' => stripslashes(get_option('qc_wpbot_menu_order')),
331 'conversation_form_ids' => $conversation_form_ids,
332 'conversation_form_names' => $conversation_form_names,
333 'df_api_version' => (get_option('wp_chatbot_df_api')==''?'v1':get_option('wp_chatbot_df_api')),
334 'v2_client_url'=> esc_url(get_site_url().'/?action=qcld_dfv2_api'),
335 'show_menu_after_greetings'=> (get_option('show_menu_after_greetings')!=''?get_option('show_menu_after_greetings'):0),
336
337 );
338 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);
339 wp_enqueue_script('qcld-wp-chatbot-slimscroll-js');
340 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);
341 wp_enqueue_script('qcld-wp-chatbot-jquery-cookie');
342 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);
343 wp_enqueue_script('qcld-wp-chatbot-magnify-popup');
344 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);
345 wp_enqueue_script('qcld-wp-chatbot-plugin');
346 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);
347 wp_enqueue_script('qcld-wp-chatbot-front-js');
348 wp_localize_script('qcld-wp-chatbot-front-js', 'wp_chatbot_obj', $wp_chatbot_obj);
349 //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);
350 //wp_enqueue_script('qcld-wp-chatbot-frontend');
351 //wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
352 wp_localize_script('qcld-wp-chatbot-frontend', 'wp_chatbot_obj', $wp_chatbot_obj);
353 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');
354 wp_enqueue_style('qcld-wp-chatbot-common-style');
355 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');
356 wp_enqueue_style('qcld-wp-chatbot-magnific-popup');
357 $qcld_wb_chatbot_theme = get_option('qcld_wb_chatbot_theme');
358 /* if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css')) {
359 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');
360 wp_enqueue_style('qcld-wp-chatbot-style');
361 }*/
362 //Loading shortcode style
363 if (file_exists(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/shortcode.css')) {
364 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');
365 wp_enqueue_style('qcld-wp-chatbot-shortcode-style');
366 }
367 }
368 public function qcld_wb_chatbot_str_replace($messages=array()){
369 $refined_mesgses=array();
370 if(!empty($messages)){
371 foreach ($messages as $message){
372 $refined_msg=str_replace('\\', '', $message);
373 array_push($refined_mesgses,$refined_msg);
374 }
375 }
376 return $refined_mesgses;
377 }
378 //getting exact agent icon path
379 public function qcld_wb_chatbot_agent_icon(){
380
381 if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')=="custom-agent.png" ){
382 $wp_chatbot_custom_icon_path=get_option('wp_chatbot_custom_agent_path');
383 }
384 else if(get_option('wp_chatbot_custom_agent_path')!="" && get_option('wp_chatbot_agent_image')!="custom-agent.png"){
385 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
386 }
387 else
388 {
389 if(get_option('wp_chatbot_agent_image')!=''){
390 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.get_option('wp_chatbot_agent_image');
391 }else{
392 $wp_chatbot_custom_icon_path=QCLD_wpCHATBOT_IMG_URL.'custom-agent.png';
393 }
394
395 }
396
397 return $wp_chatbot_custom_icon_path;
398 }
399 /**
400 * Render the admin page
401 */
402
403 public function qcld_wb_chatbot_admin_page()
404 {
405 global $wpcommerce;
406 $action = 'admin.php?page=wpbot-panel';
407 require_once("admin_ui2.php");
408 }
409
410 public function qcld_wb_chatbot_admin_page_settings()
411 {
412 global $wpcommerce;
413 $action = 'admin.php?page=wpbot';
414 require_once("admin_ui.php");
415 }
416
417 public function qcld_wb_chatbot_dynamic_multi_option($options = array(), $option_name = "", $option_text = "")
418 {
419 ?>
420 <h4 class="qc-opt-title"><?php _e($option_text, 'wpchatbot'); ?></h4>
421 <div class="wp-chatbot-lng-items">
422 <?php
423 if (is_array($options) && count($options) > 0) {
424 foreach ($options as $key => $value) {
425 ?>
426 <div class="row" class="wp-chatbot-lng-item">
427 <div class="col-xs-10">
428 <input type="text"
429 class="form-control qc-opt-dcs-font"
430 name="<?php echo $option_name; ?>[]"
431 value="<?php echo str_replace('\\', '', $value); ?>">
432 </div>
433 <div class="col-xs-2">
434 <button type="button" class="btn btn-danger btn-sm wp-chatbot-lng-item-remove">
435 <span class="glyphicon glyphicon-remove"></span>
436 </button>
437 </div>
438 </div>
439 <?php
440 }
441 } else { ?>
442 <div class="row" class="wp-chatbot-lng-item">
443 <div class="col-xs-10">
444 <input type="text"
445 class="form-control qc-opt-dcs-font"
446 name="<?php echo $option_name; ?>[]"
447 value="<?php echo $option_text; ?>">
448 </div>
449 <div class="col-xs-2">
450 <span class="wp-chatbot-lng-item-remove"><?php _e('X', 'wpchatbot'); ?></span>
451 </div>
452 </div>
453 <?php } ?>
454 </div>
455 <div class="row">
456 <div class="col-sm-2 col-sm-offset-10">
457 <button type="button" class="btn btn-success btn-sm wp-chatbot-lng-item-add"> <span class="glyphicon glyphicon-plus"></span> </button>
458 </div>
459 </div>
460 <?php
461 }
462 public function wp_chatbot_opening_hours($day_name,$wpwbot_times){
463 if(!empty($wpwbot_times) && isset($wpwbot_times[$day_name])){
464 $day_times=$wpwbot_times[$day_name];
465 if(!empty($day_times)){
466 $segment=0;
467 foreach ($day_times as $day_time ){
468 ?>
469 <div class="wp-chatbot-hours-container">
470 <div class="wp-chatbot-hours">
471 <input type="text" class="wp-chatbot-hour" name="wpwbot_hours[<?php echo $day_name; ?>][<?php echo $segment; ?>][]" value="<?php if(isset($day_time[0])){echo $day_time[0];}else{ echo "00:00";} ?>" >
472 <input type="text" class="wp-chatbot-hour" name="wpwbot_hours[<?php echo $day_name; ?>][<?php echo $segment; ?>][]" value="<?php if(isset($day_time[1])){echo $day_time[1];}else{ echo "00:00";} ?>" >
473 </div>
474 <div class="wp-chatbot-hours-remove">
475 <button type="button" class="btn btn-danger btn-sm wp-chatbot-hours-remove-btn">
476 <i class="fa fa-times" aria-hidden="true"></i>
477 </button>
478 </div>
479 </div>
480
481 <?php
482 $segment++;
483 }
484 }
485 }else{
486 ?>
487 <div class="wp-chatbot-hours-container">
488 <div class="wp-chatbot-hours">
489 <input type="text" class="wp-chatbot-hour" name="wpwbot_hours[<?php echo $day_name; ?>][0][]" value="00:00" > <input type="text" name="wpwbot_hours[<?php echo $day_name; ?>][0][]" value="00:00">
490 </div>
491 <div class="wp-chatbot-hours-remove">
492 <button type="button" class="btn btn-danger btn-sm wp-chatbot-hours-remove-btn">
493 <i class="fa fa-times" aria-hidden="true"></i>
494 </button>
495 </div>
496 </div>
497 <?php
498 }
499 }
500 function qcld_wb_chatbot_save_options()
501 {
502 //global $wpcommerce;
503 if (isset($_POST['_wpnonce']) && $_POST['_wpnonce']) {
504 wp_verify_nonce($_POST['_wpnonce'], 'wp_chatbot');
505 // Check if the form is submitted or not
506 if (isset($_POST['submit'])) {
507 //wpwboticon position settings.
508 if (isset($_POST["wp_chatbot_position_x"])) {
509 $wp_chatbot_position_x = stripslashes(($_POST["wp_chatbot_position_x"]));
510 update_option('wp_chatbot_position_x', $wp_chatbot_position_x);
511 }
512 if (isset($_POST["wp_chatbot_position_y"])) {
513 $wp_chatbot_position_y = stripslashes(($_POST["wp_chatbot_position_y"]));
514 update_option('wp_chatbot_position_y', $wp_chatbot_position_y);
515 }
516 //product search options
517 if(isset($_POST['qlcd_wp_chatbot_search_option'])){
518 $qlcd_wp_chatbot_search_option = $_POST['qlcd_wp_chatbot_search_option'];
519 update_option('qlcd_wp_chatbot_search_option', sanitize_text_field($qlcd_wp_chatbot_search_option));
520 }
521
522 //Enable /disable wpwbot
523 if(isset( $_POST["disable_wp_chatbot"])){
524 $disable_wp_chatbot = $_POST["disable_wp_chatbot"];
525 }else{ $disable_wp_chatbot='';}
526 update_option('disable_wp_chatbot', stripslashes($disable_wp_chatbot));
527
528 if(isset( $_POST["qlcd_wp_chatbot_admin_email"])){
529 $qlcd_wp_chatbot_admin_email = $_POST["qlcd_wp_chatbot_admin_email"];
530 }else{ $qlcd_wp_chatbot_admin_email='';}
531 update_option('qlcd_wp_chatbot_admin_email', stripslashes($qlcd_wp_chatbot_admin_email));
532
533 if(isset( $_POST["disable_wp_chatbot_on_mobile"])) {
534 $disable_wp_chatbot_on_mobile = sanitize_text_field($_POST["disable_wp_chatbot_on_mobile"]);
535 }else{ $disable_wp_chatbot_on_mobile='';}
536 update_option('disable_wp_chatbot_on_mobile', stripslashes($disable_wp_chatbot_on_mobile));
537 if(isset( $_POST["disable_wp_chatbot_product_search"])) {
538 $disable_wp_chatbot_product_search = sanitize_text_field($_POST["disable_wp_chatbot_product_search"]);
539 }else{ $disable_wp_chatbot_product_search='';}
540 update_option('disable_wp_chatbot_product_search', stripslashes($disable_wp_chatbot_product_search));
541 if(isset( $_POST["disable_wp_chatbot_catalog"])) {
542 $disable_wp_chatbot_catalog= sanitize_text_field($_POST["disable_wp_chatbot_catalog"]);
543 }else{ $disable_wp_chatbot_catalog='';}
544 update_option('disable_wp_chatbot_catalog', stripslashes($disable_wp_chatbot_catalog));
545 if(isset( $_POST["disable_wp_chatbot_order_status"])) {
546 $disable_wp_chatbot_order_status = sanitize_text_field($_POST["disable_wp_chatbot_order_status"]);
547 }else{ $disable_wp_chatbot_order_status='';}
548 update_option('disable_wp_chatbot_order_status', stripslashes($disable_wp_chatbot_order_status));
549 if(isset( $_POST["disable_wp_chatbot_notification"])) {
550 $disable_wp_chatbot_notification = sanitize_text_field($_POST["disable_wp_chatbot_notification"]);
551 }else{ $disable_wp_chatbot_notification='1';}
552 update_option('disable_wp_chatbot_notification', stripslashes($disable_wp_chatbot_notification));
553
554 if(isset( $_POST["enable_wp_chatbot_rtl"])) {
555 $enable_wp_chatbot_rtl = $_POST["enable_wp_chatbot_rtl"];
556 }else{ $enable_wp_chatbot_rtl='';}
557 update_option('enable_wp_chatbot_rtl', stripslashes($enable_wp_chatbot_rtl));
558
559 if(isset( $_POST["show_menu_after_greetings"])) {
560 $show_menu_after_greetings = $_POST["show_menu_after_greetings"];
561 }else{ $show_menu_after_greetings='';}
562 update_option('show_menu_after_greetings', stripslashes($show_menu_after_greetings));
563
564 if(isset( $_POST["enable_wp_chatbot_mobile_full_screen"])) {
565 $enable_wp_chatbot_mobile_full_screen = sanitize_text_field($_POST["enable_wp_chatbot_mobile_full_screen"]);
566 }else{ $enable_wp_chatbot_mobile_full_screen='';}
567 update_option('enable_wp_chatbot_mobile_full_screen', stripslashes($enable_wp_chatbot_mobile_full_screen));
568
569 if(isset( $_POST["disable_wp_chatbot_icon_animation"])) {
570 $disable_wp_chatbot_icon_animation = sanitize_text_field($_POST["disable_wp_chatbot_icon_animation"]);
571 }else{ $disable_wp_chatbot_icon_animation='';}
572 update_option('disable_wp_chatbot_icon_animation', stripslashes($disable_wp_chatbot_icon_animation));
573 //Enable /disable Cart Item Number
574 if(isset( $_POST["disable_wp_chatbot_cart_item_number"])) {
575 $disable_wp_chatbot_cart_item_number = sanitize_text_field($_POST["disable_wp_chatbot_cart_item_number"]);
576 }else{ $disable_wp_chatbot_cart_item_number='';}
577 update_option('disable_wp_chatbot_cart_item_number', stripslashes($disable_wp_chatbot_cart_item_number));
578 //Enable /disable featured products button.
579 if(isset( $_POST["disable_wp_chatbot_featured_product"])) {
580 $disable_wp_chatbot_featured_product = sanitize_text_field($_POST["disable_wp_chatbot_featured_product"]);
581 }else{ $disable_wp_chatbot_featured_product='';}
582 update_option('disable_wp_chatbot_featured_product', stripslashes($disable_wp_chatbot_featured_product));
583 //Enable /disable sale products button
584 if(isset( $_POST["disable_wp_chatbot_sale_product"])) {
585 $disable_wp_chatbot_sale_product = sanitize_text_field($_POST["disable_wp_chatbot_sale_product"]);
586 }else{ $disable_wp_chatbot_sale_product='';}
587 update_option('disable_wp_chatbot_sale_product', stripslashes($disable_wp_chatbot_sale_product));
588 //Enable Product details page.
589 if(isset( $_POST["wp_chatbot_open_product_detail"])) {
590 $wp_chatbot_open_product_detail = sanitize_text_field($_POST["wp_chatbot_open_product_detail"]);
591 }else{ $wp_chatbot_open_product_detail='';}
592 update_option('wp_chatbot_open_product_detail', stripslashes($wp_chatbot_open_product_detail));
593 //product order and order by
594 if(isset($_POST['qlcd_wp_chatbot_product_orderby'])){
595 $qlcd_wp_chatbot_product_orderby = sanitize_text_field($_POST['qlcd_wp_chatbot_product_orderby']);
596 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field($qlcd_wp_chatbot_product_orderby));
597 }
598 if(isset($_POST['qlcd_wp_chatbot_product_order'])){
599 $qlcd_wp_chatbot_product_order = sanitize_text_field($_POST['qlcd_wp_chatbot_product_order']);
600 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field($qlcd_wp_chatbot_product_order));
601 }
602
603
604 //Product per page settings.
605 if (isset($_POST["qlcd_wp_chatbot_ppp"])) {
606 $qlcd_wp_chatbot_ppp = $_POST["qlcd_wp_chatbot_ppp"];
607 update_option('qlcd_wp_chatbot_ppp', intval($qlcd_wp_chatbot_ppp));
608 }
609 if(isset( $_POST["wp_chatbot_exclude_stock_out_product"])) {
610 $wp_chatbot_exclude_stock_out_product = sanitize_text_field($_POST['wp_chatbot_exclude_stock_out_product']);
611 }else{ $wp_chatbot_exclude_stock_out_product='';}
612 update_option('wp_chatbot_exclude_stock_out_product', stripslashes($wp_chatbot_exclude_stock_out_product));
613 if(isset( $_POST["wp_chatbot_show_parent_category"])) {
614 $wp_chatbot_show_parent_category = sanitize_text_field($_POST['wp_chatbot_show_parent_category']);
615 }else{ $wp_chatbot_show_parent_category='';}
616 update_option('wp_chatbot_show_parent_category', stripslashes($wp_chatbot_show_parent_category));
617 if(isset( $_POST["wp_chatbot_show_sub_category"])) {
618 $wp_chatbot_show_sub_category = sanitize_text_field($_POST['wp_chatbot_show_sub_category']);
619 }else{ $wp_chatbot_show_sub_category='';}
620 update_option('wp_chatbot_show_sub_category', stripslashes($wp_chatbot_show_sub_category));
621 if (isset($_POST["qlcd_wp_chatbot_order_user"])) {
622 $qlcd_wp_chatbot_order_user = sanitize_text_field($_POST["qlcd_wp_chatbot_order_user"]);
623 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field($qlcd_wp_chatbot_order_user));
624 }
625
626 if(isset( $_POST["qc_wpbot_menu_order"])) {
627 $qc_wpbot_menu_order = ($_POST["qc_wpbot_menu_order"]);
628 }else{ $qc_wpbot_menu_order='';}
629 update_option('qc_wpbot_menu_order', ($qc_wpbot_menu_order));
630
631 //wpwBot Load control
632 if(isset($_POST["wp_chatbot_show_home_page"])){
633 $wp_chatbot_show_home_page = sanitize_key(($_POST["wp_chatbot_show_home_page"]));
634 update_option('wp_chatbot_show_home_page', $wp_chatbot_show_home_page);
635 }
636
637
638 if(isset($_POST["wp_chatbot_show_posts"])){
639 $wp_chatbot_show_posts = sanitize_key(($_POST["wp_chatbot_show_posts"]));
640 update_option('wp_chatbot_show_posts', $wp_chatbot_show_posts);
641 }
642
643
644 if(isset($_POST["wp_chatbot_show_pages"])){
645 $wp_chatbot_show_pages = sanitize_key(($_POST["wp_chatbot_show_pages"]));
646 update_option('wp_chatbot_show_pages', $wp_chatbot_show_pages);
647 }
648
649
650 if(isset( $_POST["wp_chatbot_show_pages_list"])) {
651 $wp_chatbot_show_pages_list = $_POST["wp_chatbot_show_pages_list"];
652 }else{ $wp_chatbot_show_pages_list='';}
653 update_option('wp_chatbot_show_pages_list', serialize($wp_chatbot_show_pages_list));
654 if(isset($_POST["wp_chatbot_show_wpcommerce"])){
655 $wp_chatbot_show_wpcommerce = sanitize_key(($_POST["wp_chatbot_show_wpcommerce"]));
656 update_option('wp_chatbot_show_wpcommerce', $wp_chatbot_show_wpcommerce);
657 }
658
659
660 //Stop Words Settings
661 if (isset($_POST["qlcd_wp_chatbot_stop_words_name"])) {
662 $qlcd_wp_chatbot_stop_words_name = $_POST["qlcd_wp_chatbot_stop_words_name"];
663 update_option('qlcd_wp_chatbot_stop_words_name', sanitize_text_field($qlcd_wp_chatbot_stop_words_name));
664 }
665 if (isset($_POST["qlcd_wp_chatbot_stop_words"])) {
666 $qlcd_wp_chatbot_stop_words = $_POST["qlcd_wp_chatbot_stop_words"];
667 update_option('qlcd_wp_chatbot_stop_words', sanitize_text_field($qlcd_wp_chatbot_stop_words));
668 }
669 //wpwbot icon settings.
670 $wp_chatbot_icon = $_POST['wp_chatbot_icon'] ? $_POST['wp_chatbot_icon'] : 'icon-3.png';
671 update_option('wp_chatbot_icon', sanitize_text_field($wp_chatbot_icon));
672 // upload custom wpwbot icon path
673 $wp_chatbot_custom_icon_path = $_POST['wp_chatbot_custom_icon_path'];
674 update_option('wp_chatbot_custom_icon_path', sanitize_text_field($wp_chatbot_custom_icon_path));
675 //Agent image
676 //wpwbot icon settings.
677 $wp_chatbot_icon = (isset($_POST['wp_chatbot_agent_image']) ? $_POST['wp_chatbot_agent_image'] : 'agent-0.png');
678 update_option('wp_chatbot_agent_image', sanitize_text_field($wp_chatbot_icon));
679 // upload custom wpwbot icon
680 if(isset($_POST['wp_chatbot_custom_agent_path'])){
681 $wp_chatbot_custom_agent_path = $_POST['wp_chatbot_custom_agent_path'];
682 update_option('wp_chatbot_custom_agent_path', sanitize_text_field($wp_chatbot_custom_agent_path));
683 }
684
685 //Theming
686 $qcld_wb_chatbot_theme = (isset($_POST['qcld_wb_chatbot_theme']) ? $_POST['qcld_wb_chatbot_theme'] : 'template-00');
687 update_option('qcld_wb_chatbot_theme', sanitize_text_field($qcld_wb_chatbot_theme));
688 //Theme custom background option
689 if(isset( $_POST["qcld_wb_chatbot_change_bg"])) {
690 $qcld_wb_chatbot_change_bg = $_POST["qcld_wb_chatbot_change_bg"];
691 }else{$qcld_wb_chatbot_change_bg='';}
692 update_option('qcld_wb_chatbot_change_bg', stripslashes($qcld_wb_chatbot_change_bg));
693 if(isset($_POST["qcld_wb_chatbot_board_bg_path"])){
694 $qcld_wb_chatbot_board_bg_path = $_POST["qcld_wb_chatbot_board_bg_path"];
695 update_option('qcld_wb_chatbot_board_bg_path', stripslashes($qcld_wb_chatbot_board_bg_path));
696 }
697
698
699 //To override style use custom css.
700 if(isset($_POST["wp_chatbot_custom_css"])){
701 $wp_chatbot_custom_css = $_POST["wp_chatbot_custom_css"];
702 update_option('wp_chatbot_custom_css', stripslashes($wp_chatbot_custom_css));
703 }
704
705 $qlcd_wp_chatbot_dialogflow_project_id= @$_POST["qlcd_wp_chatbot_dialogflow_project_id"];
706 update_option('qlcd_wp_chatbot_dialogflow_project_id', sanitize_text_field($qlcd_wp_chatbot_dialogflow_project_id));
707
708 $wp_chatbot_df_api= @$_POST["wp_chatbot_df_api"];
709 update_option('wp_chatbot_df_api', sanitize_text_field($wp_chatbot_df_api));
710
711
712
713 $qlcd_wp_chatbot_dialogflow_project_key= @$_POST["qlcd_wp_chatbot_dialogflow_project_key"];
714 update_option('qlcd_wp_chatbot_dialogflow_project_key', stripslashes($qlcd_wp_chatbot_dialogflow_project_key));
715
716 /****Language center settings. ****/
717 //identity
718 $qlcd_wp_chatbot_host = @$_POST["qlcd_wp_chatbot_host"];
719 update_option('qlcd_wp_chatbot_host', sanitize_text_field($qlcd_wp_chatbot_host));
720 $qlcd_wp_chatbot_agent = @$_POST["qlcd_wp_chatbot_agent"];
721 update_option('qlcd_wp_chatbot_agent', sanitize_text_field($qlcd_wp_chatbot_agent));
722 $qlcd_wp_chatbot_shopper_demo_name = @$_POST["qlcd_wp_chatbot_shopper_demo_name"];
723 update_option('qlcd_wp_chatbot_shopper_demo_name', sanitize_text_field($qlcd_wp_chatbot_shopper_demo_name));
724 $qlcd_wp_chatbot_yes = @$_POST["qlcd_wp_chatbot_yes"];
725 update_option('qlcd_wp_chatbot_yes', sanitize_text_field($qlcd_wp_chatbot_yes));
726 $qlcd_wp_chatbot_no = @$_POST["qlcd_wp_chatbot_no"];
727 update_option('qlcd_wp_chatbot_no', sanitize_text_field($qlcd_wp_chatbot_no));
728 $qlcd_wp_chatbot_or = @$_POST["qlcd_wp_chatbot_or"];
729 update_option('qlcd_wp_chatbot_or', sanitize_text_field($qlcd_wp_chatbot_or));
730 $qlcd_wp_chatbot_sorry = @$_POST["qlcd_wp_chatbot_sorry"];
731 update_option('qlcd_wp_chatbot_sorry', sanitize_text_field($qlcd_wp_chatbot_sorry));
732 $qlcd_wp_chatbot_agent_join = @$_POST["qlcd_wp_chatbot_agent_join"];
733 update_option('qlcd_wp_chatbot_agent_join', serialize($qlcd_wp_chatbot_agent_join));
734 //Greeting.
735 $qlcd_wp_chatbot_welcome = @$_POST["qlcd_wp_chatbot_welcome"];
736 update_option('qlcd_wp_chatbot_welcome', serialize($qlcd_wp_chatbot_welcome));
737 $qlcd_wp_chatbot_back_to_start = @$_POST["qlcd_wp_chatbot_back_to_start"];
738 update_option('qlcd_wp_chatbot_back_to_start', serialize($qlcd_wp_chatbot_back_to_start));
739 $qlcd_wp_chatbot_hi_there = @$_POST["qlcd_wp_chatbot_hi_there"];
740 update_option('qlcd_wp_chatbot_hi_there', serialize($qlcd_wp_chatbot_hi_there));
741 $qlcd_wp_chatbot_welcome_back = @$_POST["qlcd_wp_chatbot_welcome_back"];
742 update_option('qlcd_wp_chatbot_welcome_back', serialize($qlcd_wp_chatbot_welcome_back));
743 $qlcd_wp_chatbot_asking_name = @$_POST["qlcd_wp_chatbot_asking_name"];
744 update_option('qlcd_wp_chatbot_asking_name', serialize($qlcd_wp_chatbot_asking_name));
745 $qlcd_wp_chatbot_name_greeting = @$_POST["qlcd_wp_chatbot_name_greeting"];
746 update_option('qlcd_wp_chatbot_name_greeting', serialize($qlcd_wp_chatbot_name_greeting));
747 $qlcd_wp_chatbot_i_am = @$_POST["qlcd_wp_chatbot_i_am"];
748 update_option('qlcd_wp_chatbot_i_am', serialize($qlcd_wp_chatbot_i_am));
749 $qlcd_wp_chatbot_is_typing = @$_POST["qlcd_wp_chatbot_is_typing"];
750 update_option('qlcd_wp_chatbot_is_typing', serialize($qlcd_wp_chatbot_is_typing));
751 $qlcd_wp_chatbot_send_a_msg= @$_POST["qlcd_wp_chatbot_send_a_msg"];
752 update_option('qlcd_wp_chatbot_send_a_msg', serialize($qlcd_wp_chatbot_send_a_msg));
753 $qlcd_wp_chatbot_choose_option= @$_POST["qlcd_wp_chatbot_choose_option"];
754 update_option('qlcd_wp_chatbot_choose_option', serialize($qlcd_wp_chatbot_choose_option));
755 $qlcd_wp_chatbot_viewed_products= @$_POST["qlcd_wp_chatbot_viewed_products"];
756 update_option('qlcd_wp_chatbot_viewed_products', serialize($qlcd_wp_chatbot_viewed_products));
757 $qlcd_wp_chatbot_shopping_cart= @$_POST["qlcd_wp_chatbot_shopping_cart"];
758 update_option('qlcd_wp_chatbot_shopping_cart', serialize($qlcd_wp_chatbot_shopping_cart));
759 $qlcd_wp_chatbot_add_to_cart= @$_POST["qlcd_wp_chatbot_add_to_cart"];
760 update_option('qlcd_wp_chatbot_add_to_cart', serialize($qlcd_wp_chatbot_add_to_cart));
761 $qlcd_wp_chatbot_cart_link= @$_POST["qlcd_wp_chatbot_cart_link"];
762 update_option('qlcd_wp_chatbot_cart_link', serialize($qlcd_wp_chatbot_cart_link));
763 $qlcd_wp_chatbot_checkout_link= @$_POST["qlcd_wp_chatbot_checkout_link"];
764 update_option('qlcd_wp_chatbot_checkout_link', serialize($qlcd_wp_chatbot_checkout_link));
765 $qlcd_wp_chatbot_cart_welcome= @$_POST["qlcd_wp_chatbot_cart_welcome"];
766 update_option('qlcd_wp_chatbot_cart_welcome', serialize($qlcd_wp_chatbot_cart_welcome));
767 $qlcd_wp_chatbot_featured_product_welcome= @$_POST["qlcd_wp_chatbot_featured_product_welcome"];
768 update_option('qlcd_wp_chatbot_featured_product_welcome', serialize($qlcd_wp_chatbot_featured_product_welcome));
769 $qlcd_wp_chatbot_viewed_product_welcome= @$_POST["qlcd_wp_chatbot_viewed_product_welcome"];
770 update_option('qlcd_wp_chatbot_viewed_product_welcome', serialize($qlcd_wp_chatbot_viewed_product_welcome));
771 $qlcd_wp_chatbot_latest_product_welcome= @$_POST["qlcd_wp_chatbot_latest_product_welcome"];
772 update_option('qlcd_wp_chatbot_latest_product_welcome', serialize($qlcd_wp_chatbot_latest_product_welcome));
773 $qlcd_wp_chatbot_cart_title= @$_POST["qlcd_wp_chatbot_cart_title"];
774 update_option('qlcd_wp_chatbot_cart_title', serialize($qlcd_wp_chatbot_cart_title));
775 $qlcd_wp_chatbot_cart_quantity= @$_POST["qlcd_wp_chatbot_cart_quantity"];
776 update_option('qlcd_wp_chatbot_cart_quantity', serialize($qlcd_wp_chatbot_cart_quantity));
777 $qlcd_wp_chatbot_cart_price= @$_POST["qlcd_wp_chatbot_cart_price"];
778 update_option('qlcd_wp_chatbot_cart_price', serialize($qlcd_wp_chatbot_cart_price));
779 $qlcd_wp_chatbot_no_cart_items= @$_POST["qlcd_wp_chatbot_no_cart_items"];
780 update_option('qlcd_wp_chatbot_no_cart_items', serialize($qlcd_wp_chatbot_no_cart_items));
781 $qlcd_wp_chatbot_cart_updating= @$_POST["qlcd_wp_chatbot_cart_updating"];
782 update_option('qlcd_wp_chatbot_cart_updating', serialize($qlcd_wp_chatbot_cart_updating));
783 $qlcd_wp_chatbot_cart_removing= @$_POST["qlcd_wp_chatbot_cart_removing"];
784 update_option('qlcd_wp_chatbot_cart_removing', serialize($qlcd_wp_chatbot_cart_removing));
785 //wpwBot wildcard settings
786 $qlcd_wp_chatbot_wildcard_msg = @$_POST["qlcd_wp_chatbot_wildcard_msg"];
787 update_option('qlcd_wp_chatbot_wildcard_msg', serialize($qlcd_wp_chatbot_wildcard_msg));
788 //empty filter message repeat.
789 $qlcd_wp_chatbot_empty_filter_msg = @$_POST["qlcd_wp_chatbot_empty_filter_msg"];
790 update_option('qlcd_wp_chatbot_empty_filter_msg', serialize($qlcd_wp_chatbot_empty_filter_msg));
791
792 $qlcd_wp_chatbot_did_you_mean = @$_POST["qlcd_wp_chatbot_did_you_mean"];
793 update_option('qlcd_wp_chatbot_did_you_mean', serialize($qlcd_wp_chatbot_did_you_mean));
794 //help welcome and message
795 $qlcd_wp_chatbot_help_welcome = @$_POST["qlcd_wp_chatbot_help_welcome"];
796 update_option('qlcd_wp_chatbot_help_welcome', serialize($qlcd_wp_chatbot_help_welcome));
797 $qlcd_wp_chatbot_help_msg = @$_POST["qlcd_wp_chatbot_help_msg"];
798 update_option('qlcd_wp_chatbot_help_msg', serialize($qlcd_wp_chatbot_help_msg));
799 //To clear Conversation history.
800 $qlcd_wp_chatbot_reset = @$_POST["qlcd_wp_chatbot_reset"];
801 update_option('qlcd_wp_chatbot_reset', serialize($qlcd_wp_chatbot_reset));
802 //systems keyword.
803 $qlcd_wp_chatbot_sys_key_help = @$_POST["qlcd_wp_chatbot_sys_key_help"];
804 update_option('qlcd_wp_chatbot_sys_key_help', sanitize_text_field($qlcd_wp_chatbot_sys_key_help));
805 $qlcd_wp_chatbot_sys_key_product = @$_POST["qlcd_wp_chatbot_sys_key_product"];
806 update_option('qlcd_wp_chatbot_sys_key_product', sanitize_text_field($qlcd_wp_chatbot_sys_key_product));
807 $qlcd_wp_chatbot_sys_key_catalog = @$_POST["qlcd_wp_chatbot_sys_key_catalog"];
808 update_option('qlcd_wp_chatbot_sys_key_catalog', sanitize_text_field($qlcd_wp_chatbot_sys_key_catalog));
809 $qlcd_wp_chatbot_sys_key_order = @$_POST["qlcd_wp_chatbot_sys_key_order"];
810 update_option('qlcd_wp_chatbot_sys_key_order', sanitize_text_field($qlcd_wp_chatbot_sys_key_order));
811 $qlcd_wp_chatbot_sys_key_support = @$_POST["qlcd_wp_chatbot_sys_key_support"];
812 update_option('qlcd_wp_chatbot_sys_key_support', sanitize_text_field($qlcd_wp_chatbot_sys_key_support));
813 $qlcd_wp_chatbot_sys_key_reset = @$_POST["qlcd_wp_chatbot_sys_key_reset"];
814 update_option('qlcd_wp_chatbot_sys_key_reset', sanitize_text_field($qlcd_wp_chatbot_sys_key_reset));
815 $qlcd_wp_chatbot_wildcard_product = @$_POST["qlcd_wp_chatbot_wildcard_product"];
816 update_option('qlcd_wp_chatbot_wildcard_product', serialize($qlcd_wp_chatbot_wildcard_product));
817 $qlcd_wp_chatbot_wildcard_catalog = @$_POST["qlcd_wp_chatbot_wildcard_catalog"];
818 update_option('qlcd_wp_chatbot_wildcard_catalog', serialize($qlcd_wp_chatbot_wildcard_catalog));
819 $qlcd_wp_chatbot_featured_products = @$_POST["qlcd_wp_chatbot_featured_products"];
820 update_option('qlcd_wp_chatbot_featured_products', serialize($qlcd_wp_chatbot_featured_products));
821 $qlcd_wp_chatbot_sale_products = @$_POST["qlcd_wp_chatbot_sale_products"];
822 update_option('qlcd_wp_chatbot_sale_products', serialize($qlcd_wp_chatbot_sale_products));
823 $qlcd_wp_chatbot_wildcard_support = @$_POST["qlcd_wp_chatbot_wildcard_support"];
824 update_option('qlcd_wp_chatbot_wildcard_support', sanitize_text_field($qlcd_wp_chatbot_wildcard_support));
825 $qlcd_wp_chatbot_messenger_label = @$_POST["qlcd_wp_chatbot_messenger_label"];
826 update_option('qlcd_wp_chatbot_messenger_label', serialize($qlcd_wp_chatbot_messenger_label));
827 //Products search .
828 if (isset($_POST["qlcd_wp_chatbot_product_success"])) {
829 $qlcd_wp_chatbot_product_success = @$_POST["qlcd_wp_chatbot_product_success"];
830 update_option('qlcd_wp_chatbot_product_success', serialize($qlcd_wp_chatbot_product_success));
831 }
832 if (isset($_POST["qlcd_wp_chatbot_product_fail"])) {
833 $qlcd_wp_chatbot_product_fail = @$_POST["qlcd_wp_chatbot_product_fail"];
834 update_option('qlcd_wp_chatbot_product_fail', serialize($qlcd_wp_chatbot_product_fail));
835 }
836 $qlcd_wp_chatbot_product_asking = @$_POST["qlcd_wp_chatbot_product_asking"];
837 update_option('qlcd_wp_chatbot_product_asking', serialize($qlcd_wp_chatbot_product_asking));
838 $qlcd_wp_chatbot_product_suggest = @$_POST["qlcd_wp_chatbot_product_suggest"];
839 update_option('qlcd_wp_chatbot_product_suggest', serialize($qlcd_wp_chatbot_product_suggest));
840 $qlcd_wp_chatbot_product_infinite = @$_POST["qlcd_wp_chatbot_product_infinite"];
841 update_option('qlcd_wp_chatbot_product_infinite', serialize($qlcd_wp_chatbot_product_infinite));
842 $qlcd_wp_chatbot_load_more = @$_POST["qlcd_wp_chatbot_load_more"];
843 update_option('qlcd_wp_chatbot_load_more', serialize($qlcd_wp_chatbot_load_more));
844 //Order
845 $qlcd_wp_chatbot_wildcard_order = @$_POST["qlcd_wp_chatbot_wildcard_order"];
846 update_option('qlcd_wp_chatbot_wildcard_order', serialize($qlcd_wp_chatbot_wildcard_order));
847 $qlcd_wp_chatbot_order_welcome = @$_POST["qlcd_wp_chatbot_order_welcome"];
848 update_option('qlcd_wp_chatbot_order_welcome', serialize($qlcd_wp_chatbot_order_welcome));
849 $qlcd_wp_chatbot_order_username_asking = @$_POST["qlcd_wp_chatbot_order_username_asking"];
850 update_option('qlcd_wp_chatbot_order_username_asking', serialize($qlcd_wp_chatbot_order_username_asking));
851 $qlcd_wp_chatbot_order_username_not_exist = @$_POST["qlcd_wp_chatbot_order_username_not_exist"];
852 update_option('qlcd_wp_chatbot_order_username_not_exist', serialize($qlcd_wp_chatbot_order_username_not_exist));
853 $qlcd_wp_chatbot_order_username_thanks = @$_POST["qlcd_wp_chatbot_order_username_thanks"];
854 update_option('qlcd_wp_chatbot_order_username_thanks', serialize($qlcd_wp_chatbot_order_username_thanks));
855 $qlcd_wp_chatbot_order_username_password = @$_POST["qlcd_wp_chatbot_order_username_password"];
856 update_option('qlcd_wp_chatbot_order_username_password', serialize($qlcd_wp_chatbot_order_username_password));
857 $qlcd_wp_chatbot_order_password_incorrect= @$_POST["qlcd_wp_chatbot_order_password_incorrect"];
858 update_option('qlcd_wp_chatbot_order_password_incorrect', serialize($qlcd_wp_chatbot_order_password_incorrect));
859 $qlcd_wp_chatbot_order_not_found= @$_POST["qlcd_wp_chatbot_order_not_found"];
860 update_option('qlcd_wp_chatbot_order_not_found', serialize($qlcd_wp_chatbot_order_not_found));
861 $qlcd_wp_chatbot_order_found= @$_POST["qlcd_wp_chatbot_order_found"];
862 update_option('qlcd_wp_chatbot_order_found', serialize($qlcd_wp_chatbot_order_found));
863 $qlcd_wp_chatbot_order_email_support= @$_POST["qlcd_wp_chatbot_order_email_support"];
864 update_option('qlcd_wp_chatbot_order_email_support', serialize($qlcd_wp_chatbot_order_email_support));
865 //Support
866 $qlcd_wp_chatbot_support_welcome = @$_POST["qlcd_wp_chatbot_support_welcome"];
867 update_option('qlcd_wp_chatbot_support_welcome', serialize($qlcd_wp_chatbot_support_welcome));
868 $qlcd_wp_chatbot_support_email = @$_POST["qlcd_wp_chatbot_support_email"];
869 update_option('qlcd_wp_chatbot_support_email', sanitize_text_field($qlcd_wp_chatbot_support_email));
870 $qlcd_wp_chatbot_asking_email = @$_POST["qlcd_wp_chatbot_asking_email"];
871 update_option('qlcd_wp_chatbot_asking_email', serialize($qlcd_wp_chatbot_asking_email));
872 $qlcd_wp_chatbot_asking_msg = @$_POST["qlcd_wp_chatbot_asking_msg"];
873 update_option('qlcd_wp_chatbot_asking_msg', serialize($qlcd_wp_chatbot_asking_msg));
874
875 $qlcd_wp_chatbot_no_result = @$_POST["qlcd_wp_chatbot_no_result"];
876 update_option('qlcd_wp_chatbot_no_result', serialize($qlcd_wp_chatbot_no_result));
877
878 $qlcd_wp_chatbot_support_option_again = @$_POST["qlcd_wp_chatbot_support_option_again"];
879 update_option('qlcd_wp_chatbot_support_option_again', serialize($qlcd_wp_chatbot_support_option_again));
880 $qlcd_wp_chatbot_invalid_email = @$_POST["qlcd_wp_chatbot_invalid_email"];
881 update_option('qlcd_wp_chatbot_invalid_email', serialize($qlcd_wp_chatbot_invalid_email));
882 $qlcd_wp_chatbot_support_phone= @$_POST["qlcd_wp_chatbot_support_phone"];
883
884 update_option('qlcd_wp_chatbot_support_phone', sanitize_text_field($qlcd_wp_chatbot_support_phone));
885 $qlcd_wp_chatbot_asking_phone= @$_POST["qlcd_wp_chatbot_asking_phone"];
886 update_option('qlcd_wp_chatbot_asking_phone', serialize($qlcd_wp_chatbot_asking_phone));
887 $qlcd_wp_chatbot_thank_for_phone= @$_POST["qlcd_wp_chatbot_thank_for_phone"];
888 update_option('qlcd_wp_chatbot_thank_for_phone', serialize($qlcd_wp_chatbot_thank_for_phone));
889 $qlcd_wp_chatbot_admin_email = @$_POST["qlcd_wp_chatbot_admin_email"];
890 update_option('qlcd_wp_chatbot_admin_email', sanitize_text_field($qlcd_wp_chatbot_admin_email));
891
892 $qlcd_wp_chatbot_email_sub = @$_POST["qlcd_wp_chatbot_email_sub"];
893 update_option('qlcd_wp_chatbot_email_sub', sanitize_text_field($qlcd_wp_chatbot_email_sub));
894
895 $qlcd_wp_site_search = @$_POST["qlcd_wp_site_search"];
896 update_option('qlcd_wp_site_search', sanitize_text_field($qlcd_wp_site_search));
897
898 $qlcd_wp_chatbot_email_sent = @$_POST["qlcd_wp_chatbot_email_sent"];
899 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field($qlcd_wp_chatbot_email_sent));
900 $qlcd_wp_chatbot_email_fail = @$_POST["qlcd_wp_chatbot_email_fail"];
901 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field($qlcd_wp_chatbot_email_fail));
902 //Notifications messages building.
903 $qlcd_wp_chatbot_notification_interval = @$_POST["qlcd_wp_chatbot_notification_interval"];
904 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field($qlcd_wp_chatbot_notification_interval));
905 $qlcd_wp_chatbot_notifications = @$_POST["qlcd_wp_chatbot_notifications"];
906 update_option('qlcd_wp_chatbot_notifications', serialize($qlcd_wp_chatbot_notifications));
907 //Support building part.
908 $support_query = @$_POST["support_query"];
909 update_option('support_query', serialize($support_query));
910 $support_ans = @$_POST["support_ans"];
911 update_option('support_ans', serialize($support_ans));
912 //Create Mobile app pages.
913 if(isset( $_POST["wp_chatbot_app_pages"])) {
914 $wp_chatbot_app_pages = $_POST["wp_chatbot_app_pages"];
915 }else{ $wp_chatbot_app_pages='';}
916 update_option('wp_chatbot_app_pages', stripslashes($wp_chatbot_app_pages));
917 //Messenger Options
918 if(isset( $_POST["enable_wp_chatbot_messenger"])) {
919 $enable_wp_chatbot_messenger = $_POST["enable_wp_chatbot_messenger"];
920 }else{ $enable_wp_chatbot_messenger='';}
921 update_option('enable_wp_chatbot_messenger', stripslashes($enable_wp_chatbot_messenger));
922 if(isset( $_POST["enable_wp_chatbot_messenger_floating_icon"])) {
923 $enable_wp_chatbot_messenger_floating_icon = $_POST["enable_wp_chatbot_messenger_floating_icon"];
924 }else{ $enable_wp_chatbot_messenger_floating_icon='';}
925 update_option('enable_wp_chatbot_messenger_floating_icon', stripslashes($enable_wp_chatbot_messenger_floating_icon));
926 $qlcd_wp_chatbot_fb_app_id = @$_POST["qlcd_wp_chatbot_fb_app_id"];
927 update_option('qlcd_wp_chatbot_fb_app_id', sanitize_text_field($qlcd_wp_chatbot_fb_app_id));
928 $qlcd_wp_chatbot_fb_page_id = @$_POST["qlcd_wp_chatbot_fb_page_id"];
929 update_option('qlcd_wp_chatbot_fb_page_id', sanitize_text_field($qlcd_wp_chatbot_fb_page_id));
930 $qlcd_wp_chatbot_fb_color= @$_POST["qlcd_wp_chatbot_fb_color"];
931 update_option('qlcd_wp_chatbot_fb_color', stripslashes($qlcd_wp_chatbot_fb_color));
932 $qlcd_wp_chatbot_fb_in_msg = @$_POST["qlcd_wp_chatbot_fb_in_msg"];
933 update_option('qlcd_wp_chatbot_fb_in_msg', sanitize_text_field($qlcd_wp_chatbot_fb_in_msg));
934 $qlcd_wp_chatbot_fb_out_msg = @$_POST["qlcd_wp_chatbot_fb_out_msg"];
935 update_option('qlcd_wp_chatbot_fb_out_msg', sanitize_text_field($qlcd_wp_chatbot_fb_out_msg));
936 //Skype option
937 if(isset( $_POST["enable_wp_chatbot_skype_floating_icon"])) {
938 $enable_wp_chatbot_skype_floating_icon = $_POST["enable_wp_chatbot_skype_floating_icon"];
939 }else{ $enable_wp_chatbot_skype_floating_icon='';}
940 update_option('enable_wp_chatbot_skype_floating_icon', sanitize_text_field($enable_wp_chatbot_skype_floating_icon));
941 if(isset( $_POST["enable_wp_chatbot_skype_id"])) {
942 $enable_wp_chatbot_skype_id = $_POST["enable_wp_chatbot_skype_id"];
943 }else{ $enable_wp_chatbot_skype_id='';}
944 update_option('enable_wp_chatbot_skype_id', sanitize_text_field($enable_wp_chatbot_skype_id));
945 //WhatsApp
946 if(isset( $_POST["enable_wp_chatbot_whats"])) {
947 $enable_wp_chatbot_whats= $_POST["enable_wp_chatbot_whats"];
948 }else{ $enable_wp_chatbot_whats='';}
949 update_option('enable_wp_chatbot_whats', sanitize_text_field($enable_wp_chatbot_whats));
950 $qlcd_wp_chatbot_whats_label = @$_POST["qlcd_wp_chatbot_whats_label"];
951 update_option('qlcd_wp_chatbot_whats_label', serialize($qlcd_wp_chatbot_whats_label));
952 if(isset( $_POST["enable_wp_chatbot_floating_whats"])) {
953 $enable_wp_chatbot_floating_whats= $_POST["enable_wp_chatbot_floating_whats"];
954 }else{ $enable_wp_chatbot_floating_whats='';}
955 update_option('enable_wp_chatbot_floating_whats', sanitize_text_field($enable_wp_chatbot_floating_whats));
956 $qlcd_wp_chatbot_whats_num = @$_POST["qlcd_wp_chatbot_whats_num"];
957 update_option('qlcd_wp_chatbot_whats_num', sanitize_text_field($qlcd_wp_chatbot_whats_num));
958 //Viber
959 if(isset( $_POST["enable_wp_chatbot_floating_viber"])) {
960 $enable_wp_chatbot_floating_viber = $_POST["enable_wp_chatbot_floating_viber"];
961 }else{ $enable_wp_chatbot_floating_viber='';}
962 update_option('enable_wp_chatbot_floating_viber', sanitize_text_field($enable_wp_chatbot_floating_viber));
963 $qlcd_wp_chatbot_viber_acc = @$_POST["qlcd_wp_chatbot_viber_acc"];
964 update_option('qlcd_wp_chatbot_viber_acc', sanitize_text_field($qlcd_wp_chatbot_viber_acc));
965 //Others integration
966 if(isset( $_POST["enable_wp_chatbot_floating_phone"])) {
967 $enable_wp_chatbot_floating_phone = $_POST["enable_wp_chatbot_floating_phone"];
968 }else{ $enable_wp_chatbot_floating_phone='';}
969 update_option('enable_wp_chatbot_floating_phone', sanitize_text_field($enable_wp_chatbot_floating_phone));
970 $qlcd_wp_chatbot_phone = @$_POST["qlcd_wp_chatbot_phone"];
971 update_option('qlcd_wp_chatbot_phone', sanitize_text_field($qlcd_wp_chatbot_phone));
972
973 if(isset( $_POST["enable_wp_chatbot_floating_link"])) {
974 $enable_wp_chatbot_floating_link = $_POST["enable_wp_chatbot_floating_link"];
975 }else{ $enable_wp_chatbot_floating_link='';}
976 update_option('enable_wp_chatbot_floating_link', sanitize_text_field($enable_wp_chatbot_floating_link));
977 $qlcd_wp_chatbot_weblink = @$_POST["qlcd_wp_chatbot_weblink"];
978 update_option('qlcd_wp_chatbot_weblink', sanitize_text_field($qlcd_wp_chatbot_weblink));
979
980 //Re Targetting.
981 $qlcd_wp_chatbot_ret_greet = @$_POST["qlcd_wp_chatbot_ret_greet"];
982 update_option('qlcd_wp_chatbot_ret_greet', sanitize_text_field($qlcd_wp_chatbot_ret_greet));
983
984 if(isset( $_POST["enable_wp_chatbot_exit_intent"])) {
985 $enable_wp_chatbot_exit_intent = $_POST["enable_wp_chatbot_exit_intent"];
986 }else{ $enable_wp_chatbot_exit_intent='';}
987 update_option('enable_wp_chatbot_exit_intent', sanitize_text_field($enable_wp_chatbot_exit_intent));
988
989 $wp_chatbot_exit_intent_msg = @$_POST["wp_chatbot_exit_intent_msg"];
990 update_option('wp_chatbot_exit_intent_msg', stripslashes($wp_chatbot_exit_intent_msg));
991
992 if(isset( $_POST["wp_chatbot_exit_intent_once"])) {
993 $wp_chatbot_exit_intent_once = $_POST["wp_chatbot_exit_intent_once"];
994 }else{ $wp_chatbot_exit_intent_once='';}
995 update_option('wp_chatbot_exit_intent_once', sanitize_text_field($wp_chatbot_exit_intent_once));
996
997 if(isset( $_POST["enable_wp_chatbot_scroll_open"])) {
998 $enable_wp_chatbot_scroll_open = $_POST["enable_wp_chatbot_scroll_open"];
999 }else{ $enable_wp_chatbot_scroll_open='';}
1000 update_option('enable_wp_chatbot_scroll_open', sanitize_text_field($enable_wp_chatbot_scroll_open));
1001
1002 $wp_chatbot_scroll_open_msg= @$_POST["wp_chatbot_scroll_open_msg"];
1003 update_option('wp_chatbot_scroll_open_msg', stripslashes($wp_chatbot_scroll_open_msg));
1004
1005 $wp_chatbot_scroll_percent= @$_POST["wp_chatbot_scroll_percent"];
1006 update_option('wp_chatbot_scroll_percent', stripslashes($wp_chatbot_scroll_percent));
1007
1008 if(isset( $_POST["wp_chatbot_scroll_once"])) {
1009 $wp_chatbot_scroll_once = $_POST["wp_chatbot_scroll_once"];
1010 }else{ $wp_chatbot_scroll_once='';}
1011 update_option('wp_chatbot_scroll_once', sanitize_text_field($wp_chatbot_scroll_once));
1012
1013 if(isset( $_POST["enable_wp_chatbot_auto_open"])) {
1014 $enable_wp_chatbot_auto_open = $_POST["enable_wp_chatbot_auto_open"];
1015 }else{ $enable_wp_chatbot_auto_open='';}
1016 update_option('enable_wp_chatbot_auto_open', sanitize_text_field($enable_wp_chatbot_auto_open));
1017
1018 if(isset( $_POST["enable_wp_chatbot_ret_sound"])) {
1019 $enable_wp_chatbot_ret_sound = $_POST["enable_wp_chatbot_ret_sound"];
1020 }else{ $enable_wp_chatbot_ret_sound='';}
1021 update_option('enable_wp_chatbot_ret_sound', sanitize_text_field($enable_wp_chatbot_ret_sound));
1022
1023 if(isset( $_POST["enable_wp_chatbot_sound_initial"])) {
1024 $enable_wp_chatbot_sound_initial = $_POST["enable_wp_chatbot_sound_initial"];
1025 }else{ $enable_wp_chatbot_sound_initial='';}
1026 update_option('enable_wp_chatbot_sound_initial', sanitize_text_field($enable_wp_chatbot_sound_initial));
1027
1028
1029 $wp_chatbot_auto_open_msg = @$_POST["wp_chatbot_auto_open_msg"];
1030 update_option('wp_chatbot_auto_open_msg', stripslashes($wp_chatbot_auto_open_msg));
1031
1032 $wp_chatbot_auto_open_time = @$_POST["wp_chatbot_auto_open_time"];
1033 update_option('wp_chatbot_auto_open_time', stripslashes($wp_chatbot_auto_open_time));
1034 //to complate checkout
1035 if(isset( $_POST["enable_wp_chatbot_ret_user_show"])) {
1036 $enable_wp_chatbot_ret_user_show = $_POST["enable_wp_chatbot_ret_user_show"];
1037 }else{ $enable_wp_chatbot_ret_user_show='';}
1038 update_option('enable_wp_chatbot_ret_user_show', sanitize_text_field($enable_wp_chatbot_ret_user_show));
1039
1040 if(isset( $_POST["enable_wp_chatbot_inactive_time_show"])) {
1041 $enable_wp_chatbot_inactive_time_show = $_POST["enable_wp_chatbot_inactive_time_show"];
1042 }else{ $enable_wp_chatbot_inactive_time_show='';}
1043 update_option('enable_wp_chatbot_inactive_time_show', sanitize_text_field($enable_wp_chatbot_inactive_time_show));
1044
1045 $wp_chatbot_inactive_time = @$_POST["wp_chatbot_inactive_time"];
1046 update_option('wp_chatbot_inactive_time', sanitize_text_field($wp_chatbot_inactive_time));
1047
1048 $wp_chatbot_checkout_msg = @$_POST["wp_chatbot_checkout_msg"];
1049 update_option('wp_chatbot_checkout_msg', stripslashes($wp_chatbot_checkout_msg));
1050
1051 if(isset( $_POST["wp_chatbot_auto_open_once"])) {
1052 $wp_chatbot_auto_open_once = $_POST["wp_chatbot_auto_open_once"];
1053 }else{ $wp_chatbot_auto_open_once='';}
1054 update_option('wp_chatbot_auto_open_once', sanitize_text_field($wp_chatbot_auto_open_once));
1055
1056 if(isset( $_POST["wp_chatbot_inactive_once"])) {
1057 $wp_chatbot_inactive_once = $_POST["wp_chatbot_inactive_once"];
1058 }else{ $wp_chatbot_inactive_once='';}
1059 update_option('wp_chatbot_inactive_once', sanitize_text_field($wp_chatbot_inactive_once));
1060
1061
1062 $wp_chatbot_proactive_bg_color = @$_POST["wp_chatbot_proactive_bg_color"];
1063 update_option('wp_chatbot_proactive_bg_color', sanitize_text_field($wp_chatbot_proactive_bg_color));
1064
1065 if(isset( $_POST["disable_wp_chatbot_call_gen"])) {
1066 $disable_wp_chatbot_call_gen = $_POST["disable_wp_chatbot_call_gen"];
1067 }else{ $disable_wp_chatbot_call_gen='';}
1068 update_option('disable_wp_chatbot_call_gen', sanitize_text_field($disable_wp_chatbot_call_gen));
1069
1070 if(isset( $_POST["disable_wp_chatbot_site_search"])) {
1071 $disable_wp_chatbot_site_search = $_POST["disable_wp_chatbot_site_search"];
1072 }else{ $disable_wp_chatbot_site_search='';}
1073 update_option('disable_wp_chatbot_site_search', sanitize_text_field($disable_wp_chatbot_site_search));
1074
1075 if(isset( $_POST["disable_wp_chatbot_call_sup"])) {
1076 $disable_wp_chatbot_call_sup = $_POST["disable_wp_chatbot_call_sup"];
1077 }else{ $disable_wp_chatbot_call_sup='';}
1078 update_option('disable_wp_chatbot_call_sup', sanitize_text_field($disable_wp_chatbot_call_sup));
1079
1080 if(isset( $_POST["disable_wp_chatbot_feedback"])) {
1081 $disable_wp_chatbot_feedback = $_POST["disable_wp_chatbot_feedback"];
1082 }else{ $disable_wp_chatbot_feedback='';}
1083 update_option('disable_wp_chatbot_feedback', sanitize_text_field($disable_wp_chatbot_feedback));
1084
1085 if(isset( $_POST["disable_wp_chatbot_faq"])) {
1086 $disable_wp_chatbot_faq = $_POST["disable_wp_chatbot_faq"];
1087 }else{ $disable_wp_chatbot_faq='';}
1088 update_option('disable_wp_chatbot_faq', sanitize_text_field($disable_wp_chatbot_faq));
1089
1090 $qlcd_wp_chatbot_feedback_label = @$_POST["qlcd_wp_chatbot_feedback_label"];
1091 update_option('qlcd_wp_chatbot_feedback_label', serialize($qlcd_wp_chatbot_feedback_label));
1092
1093 if(isset( $_POST["enable_wp_chatbot_meta_title"])) {
1094 $enable_wp_chatbot_meta_title = $_POST["enable_wp_chatbot_meta_title"];
1095 }else{ $enable_wp_chatbot_meta_title='';}
1096 update_option('enable_wp_chatbot_meta_title', sanitize_text_field($enable_wp_chatbot_meta_title));
1097
1098 $qlcd_wp_chatbot_meta_label = @$_POST["qlcd_wp_chatbot_meta_label"];
1099 update_option('qlcd_wp_chatbot_meta_label', sanitize_text_field($qlcd_wp_chatbot_meta_label));
1100
1101 $qlcd_wp_chatbot_phone_sent = @$_POST["qlcd_wp_chatbot_phone_sent"];
1102 update_option('qlcd_wp_chatbot_phone_sent', sanitize_text_field($qlcd_wp_chatbot_phone_sent));
1103
1104 $qlcd_wp_chatbot_phone_fail = @$_POST["qlcd_wp_chatbot_phone_fail"];
1105 update_option('qlcd_wp_chatbot_phone_fail', sanitize_text_field($qlcd_wp_chatbot_phone_fail));
1106
1107 if(isset( $_POST["enable_wp_chatbot_opening_hour"])) {
1108 $enable_wp_chatbot_opening_hour = $_POST["enable_wp_chatbot_opening_hour"];
1109 }else{ $enable_wp_chatbot_opening_hour='';}
1110 update_option('enable_wp_chatbot_opening_hour', sanitize_text_field($enable_wp_chatbot_opening_hour));
1111
1112 $wpwbot_hours= @$_POST["wpwbot_hours"];
1113 update_option('wpwbot_hours', serialize($wpwbot_hours));
1114
1115 if(isset( $_POST["enable_wp_chatbot_dailogflow"])) {
1116 $enable_wp_chatbot_dailogflow = $_POST["enable_wp_chatbot_dailogflow"];
1117 }else{ $enable_wp_chatbot_dailogflow='';}
1118 update_option('enable_wp_chatbot_dailogflow', sanitize_text_field($enable_wp_chatbot_dailogflow));
1119
1120 $qlcd_wp_chatbot_dialogflow_client_token= @$_POST["qlcd_wp_chatbot_dialogflow_client_token"];
1121 update_option('qlcd_wp_chatbot_dialogflow_client_token', sanitize_text_field($qlcd_wp_chatbot_dialogflow_client_token));
1122
1123 $qlcd_wp_chatbot_dialogflow_defualt_reply= @$_POST["qlcd_wp_chatbot_dialogflow_defualt_reply"];
1124 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', sanitize_text_field($qlcd_wp_chatbot_dialogflow_defualt_reply));
1125
1126 $qlcd_wp_chatbot_dialogflow_agent_language= @$_POST["qlcd_wp_chatbot_dialogflow_agent_language"];
1127 update_option('qlcd_wp_chatbot_dialogflow_agent_language', sanitize_text_field($qlcd_wp_chatbot_dialogflow_agent_language));
1128
1129 }
1130 }
1131 }
1132 /**
1133 * Display Notifications on specific criteria.
1134 *
1135 * @since 2.14
1136 */
1137 public static function wpcommerce_inactive_notice_for_wp_chatbot()
1138 {
1139 if (current_user_can('activate_plugins')) :
1140 if (!class_exists('wpCommerce')) :
1141 deactivate_plugins(plugin_basename(__FILE__));
1142 ?>
1143 <div id="message" class="error">
1144 <p>
1145 <?php
1146 printf(
1147 __('%s WPBot for wpCommerce REQUIRES wpCommerce%s %swpCommerce%s must be active for WPBot to work. Please install & activate wpCommerce.', 'wpchatbot'),
1148 '<strong>',
1149 '</strong><br>',
1150 '<a href="http://wordpress.org/extend/plugins/wpcommerce/" target="_blank" >',
1151 '</a>'
1152 );
1153 ?>
1154 </p>
1155 </div>
1156 <?php
1157 elseif (version_compare(get_option('wpcommerce_db_version'), QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION, '<')) :
1158 ?>
1159 <div id="message" class="error">
1160 <!--<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>-->
1161 <p>
1162 <?php
1163 printf(
1164 __('%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'),
1165 '<strong>',
1166 '</strong><br>',
1167 QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION
1168 );
1169 ?>
1170 </p>
1171 <div style="clear:both;"></div>
1172 </div>
1173 <?php
1174 endif;
1175 endif;
1176 }
1177 /**
1178 * Admin notice for table reindex
1179 */
1180 public function admin_notice_reindex() { ?>
1181 <div class="updated notice is-dismissible">
1182 <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>
1183 </div>
1184 <?php }
1185 }
1186 /**
1187 * Instantiate plugin.
1188 *
1189 */
1190 if (!function_exists('qcld_wb_chatboot_plugin_init')) {
1191 function qcld_wb_chatboot_plugin_init()
1192 {
1193 global $qcld_wb_chatbot;
1194 $qcld_wb_chatbot = qcld_wb_Chatbot::qcld_wb_chatbot_get_instance();
1195 }
1196 }
1197 add_action('plugins_loaded', 'qcld_wb_chatboot_plugin_init');
1198 /*
1199 * Initial Options will be insert as defualt data
1200 */
1201 register_activation_hook(__FILE__, 'qcld_wb_chatboot_defualt_options');
1202 function qcld_wb_chatboot_defualt_options(){
1203
1204 global $wpdb;
1205 $collate = '';
1206
1207 if ( $wpdb->has_cap( 'collation' ) ) {
1208
1209 if ( ! empty( $wpdb->charset ) ) {
1210
1211 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
1212 }
1213 if ( ! empty( $wpdb->collate ) ) {
1214
1215 $collate .= " COLLATE $wpdb->collate";
1216
1217 }
1218 }
1219
1220 //Bot User Table
1221 $table1 = $wpdb->prefix.'wpbot_sessions';
1222 $sql_sliders_Table1 = "
1223 CREATE TABLE IF NOT EXISTS `$table1` (
1224 `id` int(11) NOT NULL AUTO_INCREMENT,
1225 `session` int(11) NOT NULL,
1226 PRIMARY KEY (`id`)
1227 ) $collate AUTO_INCREMENT=1 ";
1228
1229 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1230 dbDelta( $sql_sliders_Table1 );
1231
1232 //Bot Response Table
1233 $table1 = $wpdb->prefix.'wpbot_response';
1234 $sql_sliders_Table1 = "
1235 CREATE TABLE IF NOT EXISTS `$table1` (
1236 `id` int(11) NOT NULL AUTO_INCREMENT,
1237 `query` TEXT NOT NULL,
1238 `keyword` TEXT NOT NULL,
1239 `response` TEXT NOT NULL,
1240 `category` varchar(256) NOT NULL,
1241 `intent` varchar(256) NOT NULL,
1242 `custom` varchar(256) NOT NULL,
1243 PRIMARY KEY (`id`),
1244 FULLTEXT(`query`, `keyword`, `response`)
1245 ) $collate AUTO_INCREMENT=1 ";
1246
1247 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1248 dbDelta( $sql_sliders_Table1 );
1249
1250
1251 $url = get_site_url();
1252 $url = parse_url($url);
1253 $domain = $url['host'];
1254 //$admin_email = "admin@" . $domain;
1255 $admin_email = get_option('admin_email');
1256
1257 if(!get_option('wp_chatbot_position_x')) {
1258 update_option('wp_chatbot_position_x', 50);
1259 }
1260 if(!get_option('wp_chatbot_position_y')) {
1261 update_option('wp_chatbot_position_y', 50);
1262 }
1263 if(!get_option('disable_wp_chatbot')) {
1264 update_option('disable_wp_chatbot', '');
1265 }
1266 if(!get_option('disable_wp_chatbot_icon_animation')) {
1267 update_option('disable_wp_chatbot_icon_animation', '');
1268 }
1269 if(!get_option('disable_wp_chatbot_on_mobile')) {
1270 update_option('disable_wp_chatbot_on_mobile', '');
1271 }
1272 if(!get_option('qlcd_wp_chatbot_admin_email')) {
1273 update_option('qlcd_wp_chatbot_admin_email', get_option('admin_email'));
1274 }
1275 if(!get_option('disable_wp_chatbot_product_search')) {
1276 update_option('disable_wp_chatbot_product_search', '');
1277 }
1278 if(!get_option('disable_wp_chatbot_catalog')) {
1279 update_option('disable_wp_chatbot_catalog', '');
1280 }
1281 if(!get_option('disable_wp_chatbot_order_status')) {
1282 update_option('disable_wp_chatbot_order_status', '');
1283 }
1284 if(!get_option('enable_wp_chatbot_rtl')) {
1285 update_option('enable_wp_chatbot_rtl', '');
1286 }
1287 if(!get_option('show_menu_after_greetings')) {
1288 update_option('show_menu_after_greetings', '');
1289 }
1290 if(!get_option('enable_wp_chatbot_mobile_full_screen')) {
1291 update_option('enable_wp_chatbot_mobile_full_screen', '');
1292 }
1293
1294 if(!get_option('disable_wp_chatbot_notification')) {
1295 update_option('disable_wp_chatbot_notification', '1');
1296 }
1297 if(!get_option('disable_wp_chatbot_cart_item_number')) {
1298 update_option('disable_wp_chatbot_cart_item_number', '');
1299 }
1300 if(!get_option('disable_wp_chatbot_featured_product')) {
1301 update_option('disable_wp_chatbot_featured_product', '');
1302 }
1303 if(!get_option('disable_wp_chatbot_sale_product')) {
1304 update_option('disable_wp_chatbot_sale_product', '');
1305 }
1306 if(!get_option('wp_chatbot_open_product_detail')) {
1307 update_option('wp_chatbot_open_product_detail', '');
1308 }
1309 if(!get_option('qlcd_wp_chatbot_product_orderby')) {
1310 update_option('qlcd_wp_chatbot_product_orderby', sanitize_text_field('title'));
1311 }
1312 if(!get_option('qlcd_wp_chatbot_product_order')) {
1313 update_option('qlcd_wp_chatbot_product_order', sanitize_text_field('ASC'));
1314 }
1315 if(!get_option('qlcd_wp_chatbot_ppp')) {
1316 update_option('qlcd_wp_chatbot_ppp', intval(6));
1317 }
1318 if(!get_option('wp_chatbot_exclude_stock_out_product')) {
1319 update_option('wp_chatbot_exclude_stock_out_product', '');
1320 }
1321 if(!get_option('wp_chatbot_show_sub_category')) {
1322 update_option('wp_chatbot_show_sub_category', '');
1323 }
1324 if(!get_option('wp_chatbot_vertical_custom')){
1325 update_option('wp_chatbot_vertical_custom', 'Go To');
1326 }
1327 if(!get_option('wp_chatbot_show_home_page')) {
1328 update_option('wp_chatbot_show_home_page', 'on');
1329 }
1330 if(!get_option('qc_wpbot_menu_order')) {
1331 update_option('qc_wpbot_menu_order', '');
1332 }
1333
1334 if(!get_option('wp_chatbot_show_posts')) {
1335 update_option('wp_chatbot_show_posts', 'on');
1336 }
1337 if(!get_option('wp_chatbot_show_pages')){
1338 update_option('wp_chatbot_show_pages', 'on');
1339 }
1340 if(!get_option('wp_chatbot_show_pages_list')) {
1341 update_option('wp_chatbot_show_pages_list', serialize(array()));
1342 }
1343 if(!get_option('wp_chatbot_show_wpcommerce')) {
1344 update_option('wp_chatbot_show_wpcommerce', 'on');
1345 }
1346 if(!get_option('qlcd_wp_chatbot_stop_words_name')) {
1347 update_option('qlcd_wp_chatbot_stop_words_name', 'english');
1348 }
1349 if(!get_option('qlcd_wp_chatbot_stop_words')) {
1350 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");
1351 }
1352 if(!get_option('qlcd_wp_chatbot_order_user')) {
1353 update_option('qlcd_wp_chatbot_order_user', sanitize_text_field('login'));
1354 }
1355 if(!get_option('wp_chatbot_custom_agent_path')) {
1356 update_option('wp_chatbot_custom_agent_path', '');
1357 }
1358 if(!get_option('wp_chatbot_custom_icon_path')) {
1359 update_option('wp_chatbot_custom_icon_path', '');
1360 }
1361
1362 if(!get_option('wp_chatbot_icon')) {
1363 update_option('wp_chatbot_icon', sanitize_text_field('icon-13.png'));
1364 }
1365 if(!get_option('wp_chatbot_agent_image')){
1366 update_option('wp_chatbot_agent_image',sanitize_text_field('agent-0.png'));
1367 }
1368 if(!get_option('qcld_wb_chatbot_theme')) {
1369 update_option('qcld_wb_chatbot_theme', sanitize_text_field('template-00'));
1370 }
1371 if(!get_option('qcld_wb_chatbot_change_bg')) {
1372 update_option('qcld_wb_chatbot_change_bg', '');
1373 }
1374 if(!get_option('wp_chatbot_custom_css')) {
1375 update_option('wp_chatbot_custom_css', '');
1376 }
1377 if(!get_option('qlcd_wp_chatbot_host')) {
1378 update_option('qlcd_wp_chatbot_host', sanitize_text_field('Our Website'));
1379 }
1380 if(!get_option('qlcd_wp_chatbot_agent')) {
1381 update_option('qlcd_wp_chatbot_agent', sanitize_text_field('Carrie'));
1382 }
1383 if(!get_option('qlcd_wp_chatbot_host')) {
1384 update_option('qlcd_wp_chatbot_host', sanitize_text_field('Our Website'));
1385 }
1386 if(!get_option('qlcd_wp_chatbot_shopper_demo_name')) {
1387 update_option('qlcd_wp_chatbot_shopper_demo_name', sanitize_text_field('Amigo'));
1388 }
1389 if(!get_option('qlcd_wp_chatbot_yes')) {
1390 update_option('qlcd_wp_chatbot_yes', sanitize_text_field('YES'));
1391 }
1392 if(!get_option('qlcd_wp_chatbot_no')) {
1393 update_option('qlcd_wp_chatbot_no', sanitize_text_field('NO'));
1394 }
1395 if(!get_option('qlcd_wp_chatbot_or')) {
1396 update_option('qlcd_wp_chatbot_or', sanitize_text_field('OR'));
1397 }
1398 if(!get_option('qlcd_wp_chatbot_sorry')) {
1399 update_option('qlcd_wp_chatbot_sorry', sanitize_text_field('Sorry'));
1400 }
1401
1402 if(!get_option('qlcd_wp_chatbot_dialogflow_project_id')) {
1403 update_option('qlcd_wp_chatbot_dialogflow_project_id', '');
1404 }
1405 if(!get_option('wp_chatbot_df_api')) {
1406 update_option('wp_chatbot_df_api', 'v1');
1407 }
1408
1409
1410 if(!get_option('qlcd_wp_chatbot_dialogflow_project_key')) {
1411 update_option('qlcd_wp_chatbot_dialogflow_project_key', '');
1412 }
1413
1414 if(!get_option('qlcd_wp_chatbot_agent_join')) {
1415 update_option('qlcd_wp_chatbot_agent_join', serialize(array('has joined the conversation')));
1416 }
1417 if(!get_option('qlcd_wp_chatbot_welcome')) {
1418 update_option('qlcd_wp_chatbot_welcome', serialize(array('Welcome to', 'Glad to have you at')));
1419 }
1420 if(!get_option('qlcd_wp_chatbot_back_to_start')) {
1421 update_option('qlcd_wp_chatbot_back_to_start', serialize(array('Back to Start')));
1422 }
1423 if(!get_option('qlcd_wp_chatbot_hi_there')) {
1424 update_option('qlcd_wp_chatbot_hi_there', serialize(array('Hi There!')));
1425 }
1426 if(!get_option('qlcd_wp_chatbot_welcome_back')) {
1427 update_option('qlcd_wp_chatbot_welcome_back', serialize(array('Welcome back', 'Good to see your again')));
1428 }
1429 if(!get_option('qlcd_wp_chatbot_asking_name')) {
1430 update_option('qlcd_wp_chatbot_asking_name', serialize(array('May I know your name?', 'What should I call you?')));
1431 }
1432 if(!get_option('qlcd_wp_chatbot_name_greeting')) {
1433 update_option('qlcd_wp_chatbot_name_greeting', serialize(array('Nice to meet you')));
1434 }
1435 if(!get_option('qlcd_wp_chatbot_i_am')) {
1436 update_option('qlcd_wp_chatbot_i_am', serialize(array('I am', 'This is')));
1437 }
1438 if(!get_option('qlcd_wp_chatbot_is_typing')) {
1439 update_option('qlcd_wp_chatbot_is_typing', serialize(array('is typing...')));
1440 }
1441 if(!get_option('qlcd_wp_chatbot_send_a_msg')) {
1442 update_option('qlcd_wp_chatbot_send_a_msg', serialize(array('Send a message.')));
1443 }
1444 if(!get_option('qlcd_wp_chatbot_choose_option')) {
1445 update_option('qlcd_wp_chatbot_choose_option', serialize(array('Choose an option.')));
1446 }
1447 if(!get_option('qlcd_wp_chatbot_viewed_products')) {
1448 update_option('qlcd_wp_chatbot_viewed_products', serialize(array('Recently viewed products')));
1449 }
1450 if(!get_option('qlcd_wp_chatbot_add_to_cart')) {
1451 update_option('qlcd_wp_chatbot_add_to_cart', serialize(array('Add to Cart')));
1452 }
1453 if(!get_option('qlcd_wp_chatbot_cart_link')) {
1454 update_option('qlcd_wp_chatbot_cart_link', serialize(array('Cart')));
1455 }
1456 if(!get_option('qlcd_wp_chatbot_checkout_link')) {
1457 update_option('qlcd_wp_chatbot_checkout_link', serialize(array('Checkout')));
1458 }
1459 if(!get_option('qlcd_wp_chatbot_featured_product_welcome')) {
1460 update_option('qlcd_wp_chatbot_featured_product_welcome', serialize(array('I have found following featured products')));
1461 }
1462 if(!get_option('qlcd_wp_chatbot_viewed_product_welcome')) {
1463 update_option('qlcd_wp_chatbot_viewed_product_welcome', serialize(array('I have found following recently viewed products')));
1464 }
1465 if(!get_option('qlcd_wp_chatbot_latest_product_welcome')) {
1466 update_option('qlcd_wp_chatbot_latest_product_welcome', serialize(array('I have found following latest products')));
1467 }
1468 if(!get_option('qlcd_wp_chatbot_cart_welcome')) {
1469 update_option('qlcd_wp_chatbot_cart_welcome', serialize(array('I have found following items from Shopping Cart.')));
1470 }
1471 if(!get_option('qlcd_wp_chatbot_cart_title')) {
1472 update_option('qlcd_wp_chatbot_cart_title', serialize(array('Title')));
1473 }
1474 if(!get_option('qlcd_wp_chatbot_cart_quantity')) {
1475 update_option('qlcd_wp_chatbot_cart_quantity', serialize(array('Qty')));
1476 }
1477 if(!get_option('qlcd_wp_chatbot_cart_price')) {
1478 update_option('qlcd_wp_chatbot_cart_price', serialize(array('Price')));
1479 }
1480 if(!get_option('qlcd_wp_chatbot_no_cart_items')) {
1481 update_option('qlcd_wp_chatbot_no_cart_items', serialize(array('No items in the cart')));
1482 }
1483 if(!get_option('qlcd_wp_chatbot_cart_updating')) {
1484 update_option('qlcd_wp_chatbot_cart_updating', serialize(array('Updating cart items ...')));
1485 }
1486 if(!get_option('qlcd_wp_chatbot_cart_removing')) {
1487 update_option('qlcd_wp_chatbot_cart_removing', serialize(array('Removing cart items ...')));
1488 }
1489 if(!get_option('qlcd_wp_chatbot_wildcard_msg')) {
1490 update_option('qlcd_wp_chatbot_wildcard_msg', serialize(array('I am here to find what you need. What are you looking for?')));
1491 }
1492 if(!get_option('qlcd_wp_chatbot_empty_filter_msg')) {
1493 update_option('qlcd_wp_chatbot_empty_filter_msg', serialize(array('Sorry, I did not understand you.')));
1494 }
1495 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
1496 update_option('qlcd_wp_chatbot_did_you_mean', serialize(array('Did you mean?')));
1497 }
1498 if(!get_option('qlcd_wp_chatbot_sys_key_help')) {
1499 update_option('qlcd_wp_chatbot_sys_key_help', 'start');
1500 }
1501 if(!get_option('qlcd_wp_chatbot_sys_key_product')) {
1502 update_option('qlcd_wp_chatbot_sys_key_product', 'product');
1503 }
1504 if(!get_option('qlcd_wp_chatbot_sys_key_catalog')) {
1505 update_option('qlcd_wp_chatbot_sys_key_catalog', 'catalog');
1506 }
1507 if(!get_option('qlcd_wp_chatbot_sys_key_order')) {
1508 update_option('qlcd_wp_chatbot_sys_key_order', 'order');
1509 }
1510 if(!get_option('qlcd_wp_chatbot_sys_key_support')) {
1511 update_option('qlcd_wp_chatbot_sys_key_support', 'faq');
1512 }
1513 if(!get_option('qlcd_wp_chatbot_sys_key_reset')) {
1514 update_option('qlcd_wp_chatbot_sys_key_reset', 'reset');
1515 }
1516 if(!get_option('qlcd_wp_chatbot_help_welcome')) {
1517 update_option('qlcd_wp_chatbot_help_welcome', serialize(array('Welcome to Help Section.')));
1518 }
1519 if(!get_option('qlcd_wp_chatbot_help_msg')) {
1520 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.')));
1521 }
1522 if(!get_option('qlcd_wp_chatbot_reset')) {
1523 update_option('qlcd_wp_chatbot_reset', serialize(array('Do you want to clear our chat history and start over?')));
1524 }
1525 if(!get_option('qlcd_wp_chatbot_wildcard_product')) {
1526 update_option('qlcd_wp_chatbot_wildcard_product', serialize(array('Product Search')));
1527 }
1528 if(!get_option('qlcd_wp_chatbot_wildcard_catalog')) {
1529 update_option('qlcd_wp_chatbot_wildcard_catalog', serialize(array('Catalog')));
1530 }
1531 if(!get_option('qlcd_wp_chatbot_featured_products')) {
1532 update_option('qlcd_wp_chatbot_featured_products', serialize(array('Featured Products')));
1533 }
1534 if(!get_option('qlcd_wp_chatbot_sale_products')) {
1535 update_option('qlcd_wp_chatbot_sale_products', serialize(array('Products on Sale')));
1536 }
1537 if(!get_option('qlcd_wp_chatbot_wildcard_support')) {
1538 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
1539 }
1540 if(!get_option('qlcd_wp_chatbot_messenger_label')) {
1541 update_option('qlcd_wp_chatbot_messenger_label', serialize(array('Chat with Us on Facebook Messenger')));
1542 }
1543 if(!get_option('qlcd_wp_chatbot_product_success')) {
1544 update_option('qlcd_wp_chatbot_product_success', serialize(array('Great! We have these products for', 'Found these products for')));
1545 }
1546 if(!get_option('qlcd_wp_chatbot_product_fail')) {
1547 update_option('qlcd_wp_chatbot_product_fail', serialize(array('Oops! Nothing matches your criteria', 'Sorry, I found nothing')));
1548 }
1549 if(!get_option('qlcd_wp_chatbot_product_asking')) {
1550 update_option('qlcd_wp_chatbot_product_asking', serialize(array('What are you shopping for?')));
1551 }
1552 if(!get_option('qlcd_wp_chatbot_product_suggest')) {
1553 update_option('qlcd_wp_chatbot_product_suggest', serialize(array('You can browse our extensive catalog. Just pick a category from below:')));
1554 }
1555 if(!get_option('qlcd_wp_chatbot_product_infinite')) {
1556 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?')));
1557 }
1558 if(!get_option('qlcd_wp_chatbot_load_more')) {
1559 update_option('qlcd_wp_chatbot_load_more', serialize(array('Load More')));
1560 }
1561 if(!get_option('qlcd_wp_chatbot_wildcard_order')) {
1562 update_option('qlcd_wp_chatbot_wildcard_order', serialize(array('Order Status')));
1563 }
1564 if(!get_option('qlcd_wp_chatbot_order_welcome')) {
1565 update_option('qlcd_wp_chatbot_order_welcome', serialize(array('Welcome to Order status section!')));
1566 }
1567 if(!get_option('qlcd_wp_chatbot_order_username_asking')) {
1568 update_option('qlcd_wp_chatbot_order_username_asking', serialize(array('Please type your username?')));
1569 }
1570 if(!get_option('qlcd_wp_chatbot_order_username_password')) {
1571 update_option('qlcd_wp_chatbot_order_username_password', serialize(array('Please type your password')));
1572 }
1573 if(!get_option('qlcd_wp_chatbot_order_username_not_exist')) {
1574 update_option('qlcd_wp_chatbot_order_username_not_exist', serialize(array('This username does not exist.')));
1575 }
1576 if(!get_option('qlcd_wp_chatbot_order_username_thanks')) {
1577 update_option('qlcd_wp_chatbot_order_username_thanks', serialize(array('Thank you for the username')));
1578 }
1579 if(!get_option('qlcd_wp_chatbot_order_password_incorrect')) {
1580 update_option('qlcd_wp_chatbot_order_password_incorrect', serialize(array('Sorry Password is not correct!')));
1581 }
1582 if(!get_option('qlcd_wp_chatbot_asking_email')) {
1583 update_option('qlcd_wp_chatbot_asking_email', serialize(array('Please provide your email address')));
1584 }
1585 if(!get_option('qlcd_wp_chatbot_order_not_found')) {
1586 update_option('qlcd_wp_chatbot_order_not_found', serialize(array('I did not find any order by you')));
1587 }
1588 if(!get_option('qlcd_wp_chatbot_order_found')) {
1589 update_option('qlcd_wp_chatbot_order_found', serialize(array('I have found the following orders')));
1590 }
1591 if(!get_option('qlcd_wp_chatbot_order_email_support')) {
1592 update_option('qlcd_wp_chatbot_order_email_support', serialize(array('Email our support center about your order.')));
1593 }
1594 if(!get_option('qlcd_wp_chatbot_support_welcome')) {
1595 update_option('qlcd_wp_chatbot_support_welcome', serialize(array('Welcome to FAQ Section')));
1596 }
1597 if(!get_option('qlcd_wp_chatbot_support_email')) {
1598 update_option('qlcd_wp_chatbot_support_email', 'Send us Email.');
1599 }
1600 if(!get_option('qlcd_wp_chatbot_asking_msg')) {
1601 update_option('qlcd_wp_chatbot_asking_msg', serialize(array('Thank you for email address. Please write your message now.')));
1602 }
1603 if(!get_option('qlcd_wp_chatbot_no_result')) {
1604 update_option('qlcd_wp_chatbot_no_result', serialize(array('Sorry, No result found!')));
1605 }
1606 if(!get_option('qlcd_wp_chatbot_invalid_email')) {
1607 update_option('qlcd_wp_chatbot_invalid_email', serialize(array('Sorry, Email address is not valid! Please provide a valid email.')));
1608 }
1609 if(!get_option('qlcd_wp_chatbot_support_phone')) {
1610 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
1611 }
1612 if(!get_option('qlcd_wp_chatbot_asking_phone')) {
1613 update_option('qlcd_wp_chatbot_asking_phone', serialize(array('Please provide your Phone number')));
1614 }
1615 if(!get_option('qlcd_wp_chatbot_thank_for_phone')) {
1616 update_option('qlcd_wp_chatbot_thank_for_phone', serialize(array('Thank you for Phone number')));
1617 }
1618 if(!get_option('qlcd_wp_chatbot_support_option_again')) {
1619 update_option('qlcd_wp_chatbot_support_option_again', serialize(array('You may choose option from below.')));
1620 }
1621 if(!get_option('qlcd_wp_chatbot_admin_email')) {
1622 update_option('qlcd_wp_chatbot_admin_email', $admin_email);
1623 }
1624 if(!get_option('qlcd_wp_chatbot_email_sub')) {
1625 update_option('qlcd_wp_chatbot_email_sub', sanitize_text_field('WPBot Support Mail'));
1626 }
1627 if(!get_option('qlcd_wp_site_search')) {
1628 update_option('qlcd_wp_site_search', sanitize_text_field('Site Search'));
1629 }
1630 if(!get_option('qlcd_wp_chatbot_email_sent')) {
1631 update_option('qlcd_wp_chatbot_email_sent', sanitize_text_field('Your email was sent successfully.Thanks!'));
1632 }
1633 if(!get_option('qlcd_wp_chatbot_email_fail')) {
1634 update_option('qlcd_wp_chatbot_email_fail', sanitize_text_field('Sorry! I could not send your mail! Please contact the webmaster.'));
1635 }
1636 if(!get_option('qlcd_wp_chatbot_notification_interval')) {
1637 update_option('qlcd_wp_chatbot_notification_interval', sanitize_text_field(5));
1638 }
1639 if(!get_option('qlcd_wp_chatbot_notifications')) {
1640 update_option('qlcd_wp_chatbot_notifications', serialize(array('Welcome to WPBot')));
1641 }
1642 if(!get_option('support_query')) {
1643 update_option('support_query', serialize(array('What is WPBot?')));
1644 }
1645 if(!get_option('support_ans')) {
1646 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.')));
1647 }
1648 if(!get_option('qlcd_wp_chatbot_search_option')) {
1649 update_option('qlcd_wp_chatbot_search_option', 'standard');
1650 }
1651 if(!get_option('wp_chatbot_index_count')) {
1652 update_option('wp_chatbot_index_count', 0);
1653 }
1654 if(!get_option('wp_chatbot_app_pages')) {
1655 update_option('wp_chatbot_app_pages', 0);
1656 }
1657 //messenger options.
1658 if(!get_option('enable_wp_chatbot_messenger')) {
1659 update_option('enable_wp_chatbot_messenger', '');
1660 }
1661 if(!get_option('enable_wp_chatbot_messenger_floating_icon')) {
1662 update_option('enable_wp_chatbot_messenger_floating_icon', '');
1663 }
1664 if(!get_option('qlcd_wp_chatbot_fb_app_id')) {
1665 update_option('qlcd_wp_chatbot_fb_app_id', '');
1666 }
1667 if(!get_option('qlcd_wp_chatbot_fb_page_id')) {
1668 update_option('qlcd_wp_chatbot_fb_page_id', '');
1669 }
1670 if(!get_option('qlcd_wp_chatbot_fb_color')) {
1671 update_option('qlcd_wp_chatbot_fb_color', '#0084ff');
1672 }
1673 if(!get_option('qlcd_wp_chatbot_fb_in_msg')) {
1674 update_option('qlcd_wp_chatbot_fb_in_msg', 'Welcome to WPBot!');
1675 }
1676 if(!get_option('qlcd_wp_chatbot_fb_out_msg')) {
1677 update_option('qlcd_wp_chatbot_fb_out_msg', 'You are not logged in');
1678 }
1679 //Skype option
1680 if(!get_option('enable_wp_chatbot_skype_floating_icon')) {
1681 update_option('enable_wp_chatbot_skype_floating_icon', '');
1682 }
1683 if(!get_option('enable_wp_chatbot_skype_id')) {
1684 update_option('enable_wp_chatbot_skype_id', '');
1685 }
1686 //Whats App
1687 if(!get_option('enable_wp_chatbot_whats')) {
1688 update_option('enable_wp_chatbot_whats', '');
1689 }
1690 if(!get_option('qlcd_wp_chatbot_whats_label')) {
1691 update_option('qlcd_wp_chatbot_whats_label', serialize(array('Chat with Us on WhatsApp')));
1692 }
1693 if(!get_option('enable_wp_chatbot_floating_whats')) {
1694 update_option('enable_wp_chatbot_floating_whats', '');
1695 }
1696 if(!get_option('qlcd_wp_chatbot_whats_num')) {
1697 update_option('qlcd_wp_chatbot_whats_num', '');
1698 }
1699 //Viber
1700 if(!get_option('enable_wp_chatbot_floating_viber')) {
1701 update_option('enable_wp_chatbot_floating_viber', '');
1702 }
1703 if(!get_option('qlcd_wp_chatbot_viber_acc')) {
1704 update_option('qlcd_wp_chatbot_viber_acc', '');
1705 }
1706 //Integration others
1707 if(!get_option('enable_wp_chatbot_floating_phone')) {
1708 update_option('enable_wp_chatbot_floating_phone', '');
1709 }
1710 if(!get_option('qlcd_wp_chatbot_phone')) {
1711 update_option('qlcd_wp_chatbot_phone', '');
1712 }
1713 if(!get_option('enable_wp_chatbot_floating_link')) {
1714 update_option('enable_wp_chatbot_floating_link', '');
1715 }
1716
1717 if(!get_option('qlcd_wp_chatbot_weblink')) {
1718 update_option('qlcd_wp_chatbot_weblink', '');
1719 }
1720 //Re-Tagetting
1721 if(!get_option('qlcd_wp_chatbot_ret_greet')) {
1722 update_option('qlcd_wp_chatbot_ret_greet', 'Hello');
1723 }
1724 if(!get_option('enable_wp_chatbot_exit_intent')) {
1725 update_option('enable_wp_chatbot_exit_intent', '');
1726 }
1727 if(!get_option('wp_chatbot_exit_intent_msg')) {
1728 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.');
1729 }
1730 if(!get_option('wp_chatbot_exit_intent_once')) {
1731 update_option('wp_chatbot_exit_intent_once', '');
1732 }
1733
1734 if(!get_option('enable_wp_chatbot_scroll_open')) {
1735 update_option('enable_wp_chatbot_scroll_open', '');
1736 }
1737 if(!get_option('wp_chatbot_scroll_open_msg')) {
1738 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.');
1739 }
1740 if(!get_option('wp_chatbot_scroll_percent')) {
1741 update_option('wp_chatbot_scroll_percent', 50);
1742 }
1743 if(!get_option('wp_chatbot_scroll_once')) {
1744 update_option('wp_chatbot_scroll_once', '');
1745 }
1746
1747 if(!get_option('enable_wp_chatbot_auto_open')) {
1748 update_option('enable_wp_chatbot_auto_open', '');
1749 }
1750
1751 if(!get_option('enable_wp_chatbot_ret_sound')) {
1752 update_option('enable_wp_chatbot_ret_sound', '');
1753 }
1754 if(!get_option('enable_wp_chatbot_sound_initial')) {
1755 update_option('enable_wp_chatbot_sound_initial', '');
1756 }
1757
1758
1759 if(!get_option('wp_chatbot_auto_open_msg')) {
1760 update_option('wp_chatbot_auto_open_msg', 'A SPECIAL OFFER FOR YOU! Get Your 50% Discount Now. Use Coupon Code QC50 during checkout.');
1761 }
1762 if(!get_option('wp_chatbot_auto_open_time')) {
1763 update_option('wp_chatbot_auto_open_time', 10);
1764 }
1765 if(!get_option('wp_chatbot_auto_open_once')) {
1766 update_option('wp_chatbot_auto_open_once', '');
1767 }
1768 if(!get_option('wp_chatbot_inactive_once')) {
1769 update_option('wp_chatbot_inactive_once', '');
1770 }
1771
1772 //To complete checkout.
1773 if(!get_option('enable_wp_chatbot_ret_user_show')) {
1774 update_option('enable_wp_chatbot_ret_user_show', '');
1775 }
1776 if(!get_option('wp_chatbot_auto_open_msg')) {
1777 update_option('wp_chatbot_checkout_msg', 'You have products in shopping cart, please complete your order.');
1778 }
1779 if(!get_option('wp_chatbot_inactive_time')) {
1780 update_option('wp_chatbot_inactive_time', 300);
1781 }
1782 if(!get_option('enable_wp_chatbot_inactive_time_show')) {
1783 update_option('enable_wp_chatbot_inactive_time_show', '');
1784 }
1785
1786 if(!get_option('wp_chatbot_proactive_bg_color')) {
1787 update_option('wp_chatbot_proactive_bg_color', '#ffffff');
1788 }
1789 if(!get_option('disable_wp_chatbot_feedback')) {
1790 update_option('disable_wp_chatbot_feedback','');
1791 }
1792 if(!get_option('disable_wp_chatbot_faq')) {
1793 update_option('disable_wp_chatbot_faq','');
1794 }
1795 if(!get_option('qlcd_wp_chatbot_feedback_label')) {
1796 update_option('qlcd_wp_chatbot_feedback_label',serialize(array('Send Feedback')));
1797 }
1798
1799 if(!get_option('enable_wp_chatbot_meta_title')) {
1800 update_option('enable_wp_chatbot_meta_title','');
1801 }
1802 if(!get_option('qlcd_wp_chatbot_meta_label')) {
1803 update_option('qlcd_wp_chatbot_meta_label','*New Messages');
1804 }
1805
1806 if(!get_option('disable_wp_chatbot_call_gen')) {
1807 update_option('disable_wp_chatbot_call_gen', '');
1808 }
1809
1810 if(!get_option('disable_wp_chatbot_site_search')) {
1811 update_option('disable_wp_chatbot_site_search', '');
1812 }
1813 if(!get_option('disable_wp_chatbot_call_sup')) {
1814 update_option('disable_wp_chatbot_call_sup', '');
1815 }
1816
1817 if(!get_option('qlcd_wp_chatbot_phone_sent')) {
1818 update_option('qlcd_wp_chatbot_phone_sent', 'Thanks for your phone number. We will call you ASAP!');
1819 }
1820 if(!get_option('qlcd_wp_chatbot_phone_fail')) {
1821 update_option('qlcd_wp_chatbot_phone_fail', 'Sorry! I could not collect your phone number!');
1822 }
1823 if(!get_option('enable_wp_chatbot_opening_hour')) {
1824 update_option('enable_wp_chatbot_opening_hour', '');
1825 }
1826 if(!get_option('enable_wp_chatbot_opening_hour')) {
1827 update_option('wpwbot_hours', array());
1828 }
1829
1830 if(!get_option('enable_wp_chatbot_dailogflow')) {
1831 update_option('enable_wp_chatbot_dailogflow', '');
1832 }
1833 if(!get_option('qlcd_wp_chatbot_dialogflow_client_token')) {
1834 update_option('qlcd_wp_chatbot_dialogflow_client_token', '');
1835 }
1836 if(!get_option('qlcd_wp_chatbot_dialogflow_defualt_reply')) {
1837 update_option('qlcd_wp_chatbot_dialogflow_defualt_reply', 'Sorry, I did not understand you. You may browse');
1838 }
1839 if(!get_option('qlcd_wp_chatbot_dialogflow_agent_language')) {
1840 update_option('qlcd_wp_chatbot_dialogflow_agent_language', 'en');
1841 }
1842
1843 }
1844 /*
1845 * Reset Options will be insert as defualt data
1846 */
1847 add_action('wp_ajax_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
1848 add_action('wp_ajax_nopriv_qcld_wb_chatboot_delete_all_options', 'qcld_wb_chatboot_delete_all_options');
1849 //Jarvis all option will be delete during uninstlling.
1850 function qcld_wb_chatboot_delete_all_options(){
1851 delete_option('disable_wp_chatbot');
1852 delete_option('disable_wp_chatbot_icon_animation');
1853 delete_option('disable_wp_chatbot_on_mobile');
1854 delete_option('qlcd_wp_chatbot_admin_email');
1855 delete_option('disable_wp_chatbot_product_search');
1856 delete_option('disable_wp_chatbot_catalog');
1857 delete_option('disable_wp_chatbot_order_status');
1858 delete_option('disable_wp_chatbot_notification');
1859 delete_option('enable_wp_chatbot_rtl');
1860 delete_option('show_menu_after_greetings');
1861 delete_option('enable_wp_chatbot_mobile_full_screen');
1862 delete_option('disable_wp_chatbot_cart_item_number');
1863 delete_option('disable_wp_chatbot_featured_product');
1864 delete_option('disable_wp_chatbot_sale_product');
1865 delete_option('wp_chatbot_open_product_detail');
1866 delete_option('qlcd_wp_chatbot_product_orderby');
1867 delete_option('qlcd_wp_chatbot_product_order');
1868 delete_option('qlcd_wp_chatbot_ppp');
1869 delete_option('wp_chatbot_show_parent_category');
1870 delete_option('wp_chatbot_show_sub_category');
1871 delete_option('wp_chatbot_exclude_stock_out_product');
1872 delete_option('wp_chatbot_show_home_page');
1873 delete_option('qc_wpbot_menu_order');
1874
1875 delete_option('wp_chatbot_show_posts');
1876 delete_option('wp_chatbot_show_pages');
1877 delete_option('wp_chatbot_show_pages_list');
1878 delete_option('wp_chatbot_show_wpcommerce');
1879 delete_option('qlcd_wp_chatbot_stop_words_name');
1880 delete_option('qlcd_wp_chatbot_stop_words');
1881 delete_option('qlcd_wp_chatbot_order_user');
1882 delete_option('wp_chatbot_icon');
1883 delete_option('wp_chatbot_agent_image');
1884 delete_option('qcld_wb_chatbot_theme');
1885 delete_option('qcld_wb_chatbot_change_bg');
1886 delete_option('wp_chatbot_custom_css');
1887 delete_option('qlcd_wp_chatbot_host');
1888 delete_option('qlcd_wp_chatbot_agent');
1889 delete_option('qlcd_wp_chatbot_yes');
1890 delete_option('qlcd_wp_chatbot_no');
1891 delete_option('qlcd_wp_chatbot_or');
1892 delete_option('qlcd_wp_chatbot_sorry');
1893 delete_option('qlcd_wp_chatbot_agent_join');
1894 delete_option('qlcd_wp_chatbot_welcome');
1895 delete_option('qlcd_wp_chatbot_back_to_start');
1896 delete_option('qlcd_wp_chatbot_hi_there');
1897 delete_option('qlcd_wp_chatbot_welcome_back');
1898 delete_option('qlcd_wp_chatbot_asking_name');
1899 delete_option('qlcd_wp_chatbot_name_greeting');
1900 delete_option('qlcd_wp_chatbot_i_am');
1901 delete_option('qlcd_wp_chatbot_wildcard_msg');
1902 delete_option('qlcd_wp_chatbot_empty_filter_msg');
1903 delete_option('qlcd_wp_chatbot_did_you_mean');
1904 delete_option('qlcd_wp_chatbot_wildcard_product');
1905 delete_option('qlcd_wp_chatbot_wildcard_catalog');
1906 delete_option('qlcd_wp_chatbot_featured_products');
1907 delete_option('qlcd_wp_chatbot_sale_products');
1908 delete_option('qlcd_wp_chatbot_wildcard_support');
1909 delete_option('qlcd_wp_chatbot_messenger_label');
1910 delete_option('qlcd_wp_chatbot_product_success');
1911 delete_option('qlcd_wp_chatbot_product_fail');
1912 delete_option('qlcd_wp_chatbot_product_asking');
1913 delete_option('qlcd_wp_chatbot_product_suggest');
1914 delete_option('qlcd_wp_chatbot_product_infinite');
1915 delete_option('qlcd_wp_chatbot_load_more');
1916 delete_option('qlcd_wp_chatbot_wildcard_order');
1917 delete_option('qlcd_wp_chatbot_order_welcome');
1918 delete_option('qlcd_wp_chatbot_order_username_asking');
1919 delete_option('qlcd_wp_chatbot_order_username_password');
1920 delete_option('qlcd_wp_chatbot_support_welcome');
1921 delete_option('qlcd_wp_chatbot_support_email');
1922 delete_option('qlcd_wp_chatbot_asking_email');
1923 delete_option('qlcd_wp_chatbot_asking_msg');
1924 delete_option('qlcd_wp_chatbot_no_result');
1925 delete_option('qlcd_wp_chatbot_admin_email');
1926 delete_option('qlcd_wp_chatbot_email_sub');
1927 delete_option('qlcd_wp_site_search');
1928 delete_option('qlcd_wp_chatbot_email_sent');
1929 delete_option('qlcd_wp_chatbot_support_phone');
1930 delete_option('qlcd_wp_chatbot_asking_phone');
1931 delete_option('qlcd_wp_chatbot_thank_for_phone');
1932 delete_option('qlcd_wp_chatbot_sys_key_help');
1933 delete_option('qlcd_wp_chatbot_sys_key_product');
1934 delete_option('qlcd_wp_chatbot_sys_key_catalog');
1935 delete_option('qlcd_wp_chatbot_sys_key_order');
1936 delete_option('qlcd_wp_chatbot_sys_key_support');
1937 delete_option('qlcd_wp_chatbot_sys_key_reset');
1938 delete_option('qlcd_wp_chatbot_order_username_not_exist');
1939 delete_option('qlcd_wp_chatbot_order_username_thanks');
1940 delete_option('qlcd_wp_chatbot_order_password_incorrect');
1941 delete_option('qlcd_wp_chatbot_order_not_found');
1942 delete_option('qlcd_wp_chatbot_order_found');
1943 delete_option('qlcd_wp_chatbot_order_email_support');
1944 delete_option('qlcd_wp_chatbot_support_option_again');
1945 delete_option('qlcd_wp_chatbot_invalid_email');
1946 delete_option('qlcd_wp_chatbot_shopping_cart');
1947 delete_option('qlcd_wp_chatbot_add_to_cart');
1948 delete_option('qlcd_wp_chatbot_cart_link');
1949 delete_option('qlcd_wp_chatbot_checkout_link');
1950 delete_option('qlcd_wp_chatbot_cart_welcome');
1951 delete_option('qlcd_wp_chatbot_featured_product_welcome');
1952 delete_option('qlcd_wp_chatbot_viewed_product_welcome');
1953 delete_option('qlcd_wp_chatbot_latest_product_welcome');
1954 delete_option('qlcd_wp_chatbot_cart_title');
1955 delete_option('qlcd_wp_chatbot_cart_quantity');
1956 delete_option('qlcd_wp_chatbot_cart_price');
1957 delete_option('qlcd_wp_chatbot_no_cart_items');
1958 delete_option('qlcd_wp_chatbot_cart_updating');
1959 delete_option('qlcd_wp_chatbot_cart_removing');
1960 delete_option('qlcd_wp_chatbot_email_fail');
1961 delete_option('support_query');
1962 delete_option('support_ans');
1963 delete_option('qlcd_wp_chatbot_notification_interval');
1964 delete_option('qlcd_wp_chatbot_notifications');
1965 delete_option( 'qlcd_wp_chatbot_search_option');
1966 delete_option( 'wp_chatbot_index_count');
1967 delete_option( 'wp_chatbot_app_pages');
1968 //messenger option
1969 delete_option( 'enable_wp_chatbot_messenger');
1970 delete_option( 'enable_wp_chatbot_messenger_floating_icon');
1971 delete_option( 'qlcd_wp_chatbot_fb_app_id');
1972 delete_option( 'qlcd_wp_chatbot_fb_page_id');
1973 delete_option( 'qlcd_wp_chatbot_fb_color');
1974 delete_option( 'qlcd_wp_chatbot_fb_in_msg');
1975 delete_option( 'qlcd_wp_chatbot_fb_out_msg');
1976 //skype option
1977 delete_option( 'enable_wp_chatbot_skype_floating_icon');
1978 delete_option( 'enable_wp_chatbot_skype_id');
1979 //whats app
1980 delete_option( 'enable_wp_chatbot_whats');
1981 delete_option( 'qlcd_wp_chatbot_whats_label');
1982 delete_option( 'enable_wp_chatbot_floating_whats');
1983 delete_option( 'qlcd_wp_chatbot_whats_num');
1984 // Viber
1985 delete_option( 'enable_wp_chatbot_floating_viber');
1986 delete_option( 'qlcd_wp_chatbot_viber_acc');
1987 //Integration others
1988 delete_option( 'enable_wp_chatbot_floating_phone');
1989 delete_option( 'qlcd_wp_chatbot_phone');
1990 delete_option( 'enable_wp_chatbot_floating_link');
1991 delete_option( 'qlcd_wp_chatbot_weblink');
1992 //Re Targetting
1993 delete_option( 'qlcd_wp_chatbot_ret_greet');
1994 delete_option( 'enable_wp_chatbot_exit_intent');
1995 delete_option( 'wp_chatbot_exit_intent_msg');
1996 delete_option( 'wp_chatbot_exit_intent_once');
1997
1998 delete_option( 'enable_wp_chatbot_scroll_open');
1999 delete_option( 'wp_chatbot_scroll_open_msg');
2000 delete_option( 'wp_chatbot_scroll_percent');
2001 delete_option( 'wp_chatbot_scroll_once');
2002
2003 delete_option( 'enable_wp_chatbot_auto_open');
2004 delete_option( 'enable_wp_chatbot_ret_sound');
2005 delete_option( 'enable_wp_chatbot_sound_initial');
2006 delete_option( 'disable_wp_chatbot_feedback');
2007 delete_option( 'disable_wp_chatbot_faq');
2008 delete_option( 'qlcd_wp_chatbot_feedback_label');
2009 delete_option( 'enable_wp_chatbot_meta_title');
2010 delete_option( 'qlcd_wp_chatbot_meta_label');
2011 delete_option( 'wp_chatbot_auto_open_msg');
2012 delete_option( 'wp_chatbot_auto_open_time');
2013 delete_option( 'wp_chatbot_auto_open_once');
2014 delete_option( 'wp_chatbot_inactive_once');
2015 delete_option( 'wp_chatbot_proactive_bg_color');
2016 delete_option( 'qlcd_wp_chatbot_phone_sent');
2017 delete_option( 'qlcd_wp_chatbot_phone_fail');
2018 delete_option( 'disable_wp_chatbot_call_gen');
2019 delete_option( 'disable_wp_chatbot_site_search');
2020 delete_option( 'disable_wp_chatbot_call_sup');
2021
2022 delete_option( 'enable_wp_chatbot_ret_user_show');
2023 delete_option( 'enable_wp_chatbot_inactive_time_show');
2024 delete_option( 'wp_chatbot_inactive_time');
2025 delete_option( 'wp_chatbot_checkout_msg');
2026 delete_option( 'qlcd_wp_chatbot_shopper_demo_name');
2027 delete_option( 'qlcd_wp_chatbot_is_typing');
2028 delete_option( 'qlcd_wp_chatbot_send_a_msg');
2029 delete_option( 'qlcd_wp_chatbot_choose_option');
2030 delete_option( 'qlcd_wp_chatbot_viewed_products');
2031 delete_option( 'qlcd_wp_chatbot_help_welcome');
2032 delete_option( 'qlcd_wp_chatbot_help_msg');
2033 delete_option( 'qlcd_wp_chatbot_reset');
2034 delete_option( 'enable_wp_chatbot_opening_hour');
2035 delete_option( 'wpwbot_hours');
2036 delete_option( 'enable_wp_chatbot_dailogflow');
2037 delete_option( 'qlcd_wp_chatbot_dialogflow_client_token');
2038 delete_option( 'qlcd_wp_chatbot_dialogflow_defualt_reply');
2039 delete_option( 'qlcd_wp_chatbot_dialogflow_agent_language');
2040
2041 delete_option( 'qlcd_wp_chatbot_dialogflow_project_id');
2042 delete_option( 'wp_chatbot_df_api');
2043 delete_option( 'qlcd_wp_chatbot_dialogflow_project_key');
2044
2045 qcld_wb_chatboot_defualt_options();
2046 $html='Reset all options to default successfully.';
2047 wp_send_json($html);
2048 }
2049 /**
2050 *
2051 * Function to load translation files.
2052 *
2053 */
2054 function wp_chatbot_lang_init() {
2055 load_plugin_textdomain( 'wpchatbot', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
2056 }
2057 add_action( 'plugins_loaded', 'wp_chatbot_lang_init');
2058
2059 $wpbot_feedback = new Wp_Usage_Feedback(
2060 __FILE__,
2061 'plugins@quantumcloud.com',
2062 false,
2063 true
2064
2065 );
2066
2067 function wpbot_help_page_callback_func(){
2068 ?>
2069 <div class="wrap swpm-admin-menu-wrap">
2070 <div class="container" style="margin-right:unset;margin-left:unset;">
2071 <h1>Help</h1>
2072 <div class="content form-container" style="padding: 10px;color:#fff">
2073
2074 <h2 style="font-size:20px">How to disable Predefined Intent?</h2>
2075 <p>You can disable predefined intents FAQ, eMail, Call me from WPBot Lite > Settings page's Start Menu Section.</p>
2076 <h2 style="font-size:20px">Setting Updates</h2>
2077 <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>
2078 <h2 style="font-size:20px">Tips</h2>
2079 <p>You could use &lt;br&gt; tag in Language Center & Dialogflow Responses for line break.</p>
2080 <h3 style="font-size:20px">Check out the Pro version of the Plugin for more features from <a href="https://www.quantumcloud.com/products/chatbot-for-wordpress/" target="_blank">here</a>.</h3>
2081 </div>
2082 </div>
2083
2084 </div>
2085 <?php
2086 }
2087
2088 add_action('init', 'qc_wp_latest_update_check');
2089 function qc_wp_latest_update_check(){
2090 global $wpdb;
2091 if(!get_option('qc_wp_ludate_ck')){
2092 update_option('qlcd_wp_chatbot_support_phone', 'Leave your number. We will call you back!');
2093 update_option('qlcd_wp_chatbot_support_email', 'Send us Email');
2094 update_option('qlcd_wp_chatbot_wildcard_support', 'FAQ');
2095 update_option('qc_wp_ludate_ck', 'done');
2096 }
2097
2098 if(!get_option('qc_wpb_simple_response_db_upgrade_free')){
2099
2100 $collate = '';
2101 if ( $wpdb->has_cap( 'collation' ) ) {
2102
2103 if ( ! empty( $wpdb->charset ) ) {
2104
2105 $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
2106 }
2107 if ( ! empty( $wpdb->collate ) ) {
2108
2109 $collate .= " COLLATE $wpdb->collate";
2110
2111 }
2112 }
2113 //Bot Response Table
2114 $table1 = $wpdb->prefix.'wpbot_response';
2115 $sql_sliders_Table1 = "
2116 CREATE TABLE IF NOT EXISTS `$table1` (
2117 `id` int(11) NOT NULL AUTO_INCREMENT,
2118 `query` TEXT NOT NULL,
2119 `keyword` TEXT NOT NULL,
2120 `response` TEXT NOT NULL,
2121 `category` varchar(256) NOT NULL,
2122 `intent` varchar(256) NOT NULL,
2123 `custom` varchar(256) NOT NULL,
2124 PRIMARY KEY (`id`),
2125 FULLTEXT(`query`, `keyword`, `response`)
2126 ) $collate AUTO_INCREMENT=1 ";
2127
2128 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2129 dbDelta( $sql_sliders_Table1 );
2130
2131 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2132 update_option('qlcd_wp_chatbot_did_you_mean', serialize(array('Did you mean?')));
2133 }
2134
2135 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
2136 update_option('qlcd_wp_chatbot_did_you_mean', serialize(array('Did you mean?')));
2137 }
2138
2139 update_option('qc_wpb_simple_response_db_upgrade_free', 'done');
2140
2141 }
2142
2143 if(isset($_POST['qc_bot_str_query']) && $_POST['qc_bot_str_query']!=''){
2144 $query = sanitize_text_field($_POST['qc_bot_str_query']);
2145 $keyword = sanitize_text_field($_POST['qc_bot_str_keyword']);
2146 $intent = sanitize_text_field(@$_POST['qc_bot_str_intent']);
2147 $response = wp_kses($_POST['qc_bot_str_response'], 'post');
2148 $table = $wpdb->prefix.'wpbot_response';
2149 $data = array('query' => $query, 'keyword' => $keyword, 'response'=> $response, 'intent'=> $intent);
2150 $format = array('%s','%s', '%s', '%s');
2151
2152 if(isset($_POST['qc_bot_str_id']) && $_POST['qc_bot_str_id']!=''){
2153 $id = sanitize_text_field($_POST['qc_bot_str_id']);
2154 $where = array('id'=>$id);
2155 $whereformat = array('%d');
2156 //$wpdb->update( $table, $data, $where, $format, $where_format );
2157 $wpdb->query( "UPDATE `$table` SET `query`= '$query',`keyword`= '$keyword',`response`= '$response' WHERE 1 and id ='".$id."'" );
2158
2159 }else{
2160 $wpdb->insert($table,$data,$format);
2161 }
2162
2163 $wpdb->query( "ALTER TABLE `$table` ADD FULLTEXT(`query`);" );
2164 $wpdb->query( "ALTER TABLE `$table` ADD FULLTEXT(`keyword`);" );
2165 $wpdb->query( "ALTER TABLE `$table` ADD FULLTEXT(`response`);" );
2166
2167 wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
2168
2169 }
2170 if(isset($_POST['qc_bot_str_weight']) && $_POST['qc_bot_str_weight']!=''){
2171 $weight = sanitize_text_field($_POST['qc_bot_str_weight']);
2172 update_option('qc_bot_str_weight', $weight);
2173 }
2174
2175 }
2176
2177 function qc_wpbot_simple_response_intent(){
2178 global $wpdb;
2179 $table = $wpdb->prefix.'wpbot_response';
2180 $results = $wpdb->get_results("SELECT `intent` FROM `wp_wpbot_response` WHERE 1 and `intent` !=''");
2181 $response = array();
2182 if(!empty($results)){
2183 foreach($results as $result){
2184 $response[] = $result->intent;
2185 }
2186 }
2187 return $response;
2188 }
2189
2190
2191