Thanks for installing Zotabox plugin! Click to configure.

'; $message_disconnect = '

Disconnected from Zotabox successfully!

'; if ( is_plugin_active( 'fb-messenger-live-chat/fb-messenger-live-chat.php') ) { if($ztb_status_message == 1){ echo $message_intall; if($ztb_status_message == 1){ update_option( 'ztb_status_message', 2 ); } } } } add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'zb_fbc_add_action_links' ); function zb_fbc_add_action_links ( $links ) { $mylinks = array( 'Settings', ); return array_merge( $links, $mylinks ); } add_action('admin_menu', 'zb_fbc_admin_menu'); function zb_fbc_admin_menu() { add_menu_page('FB Messenger Live Chat', 'FB Live Chat', 'administrator', 'zb_fbc', 'zb_fbc_setting',plugins_url( 'zotabox.png', __FILE__ )); } function zb_fbc_setting(){ $domain_action = 'https://zotabox.com'; $token_key = wp_create_nonce('update_zb_fbc_code'); $access_key = get_option( 'ztb_access_key', '' ); if(empty($access_key)){ $access_key = get_option( 'access_key', '' ); } $ztb_id = get_option( 'ztb_id', '' ); $domain = get_option('ztb_domainid',''); $zbEmail = get_option('ztb_email',''); $ztb_source = get_option('ztb_source',''); $button = ''; $adminEmail = get_option('admin_email'); //Check empty ztb email if(empty($zbEmail)){ $zbEmail = $adminEmail; } global $current_user; wp_get_current_user(); $ztb_status_disconnect = get_option( 'ztb_status_disconnect', '' ); $connected = 2; if(isset($access_key) && !empty($access_key) && strlen($access_key) > 0 && $ztb_status_disconnect == $connected){ $button = ' Configure your tools '; $form = ''; }else{ $form = '


Note: Zotabox is a 3rd party service provider. A Zotabox account will be created automatically and you can delete it at any time.

You will receive important account, informational and promotional emails from us and remarketing ads via Google Adwords. For information to opt out of these ads and emails at any time, please visit our privacy page.
'; $button = ''; } $html = '
Zotabox includes 20+ Promotional Sales tools to grow your website’s traffic, boost your sales and get more subscribers.
'.$button.'
'; echo $html; } function insert_zb_fbc_code(){ if(!is_admin()){ $domain = get_option( 'ztb_domainid', '' ); $ztb_source = get_option('ztb_source',''); $ztb_status_disconnect = get_option('ztb_status_disconnect',''); $connected = 2; if(!empty($domain) && strlen($domain) > 0 && $ztb_status_disconnect == $connected){ print_r(html_entity_decode(print_zb_fbc_code($domain))); } } } add_action( 'wp_head', 'insert_zb_fbc_code' ); add_action("wp_ajax_update_zb_fbc_code", "update_zb_fbc_code"); add_action("wp_ajax_nopriv_update_zb_fbc_code", "update_zb_fbc_code"); function update_zb_fbc_code(){ if(isset($_REQUEST['token']) && wp_verify_nonce($_REQUEST['token'], 'update_zb_fbc_code')){ $domain = sanitize_text_field(addslashes($_REQUEST['domain'])); $public_key = sanitize_text_field(addslashes($_REQUEST['access'])); $token = sanitize_text_field(addslashes($_REQUEST['token'])); $id = intval($_REQUEST['customer']); if(!isset($domain) || empty($domain)){ $redirect = admin_url('admin.php?page=zb_fbc'); wp_safe_redirect($redirect); }else{ if(wp_verify_nonce($_REQUEST['token'], 'update_zb_fbc_code')){ update_option( 'ztb_domainid', $domain ); update_option( 'ztb_access_key', $public_key ); update_option( 'ztb_id', $id ); update_option( 'ztb_status_disconnect', 2 ); wp_send_json( array( 'error' => false, 'message' => 'Update Zotabox embedded code successful !' ) ); }else{ wp_send_json( array( 'error' => true, 'message' => 'Wrong nonce!' ) ); } } } } function print_zb_fbc_code($domainSecureID = "", $isHtml = false) { $ds1 = substr($domainSecureID, 0, 1); $ds2 = substr($domainSecureID, 1, 1); $baseUrl = '//static.zotabox.com'; $code = << STRING; return $code; } ?>