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

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