PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 3.4.2
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v3.4.2
8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 All 534 releases
chatbot / qcld-wpwbot.php

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

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