HEX
Server: Apache/2.4.49 (FreeBSD) OpenSSL/1.0.2s-freebsd PHP/5.6.36
System: FreeBSD hosting.icon.bg 11.3-RELEASE-p13 FreeBSD 11.3-RELEASE-p13 #0: Tue Sep 1 06:56:51 UTC 2020 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
User: ftpuser (1002)
PHP: 5.6.36
Disabled: NONE
Upload Files
File: /hosting/kak.bg/web/wp-content/themes/social_play/libs/fb.php
<?php $api_settings = $GLOBALS['_webnukes']->fw_get_settings('sub_APIs'); //printr($api_settings);?>

<script>
  window.fbAsyncInit = function() {
		FB.init({
			appId      : '<?php echo kvalue( $api_settings, 'facebook_api_key'); ?>', // App ID
			channelUrl : '<?php echo kvalue( $api_settings, 'facebook_channel_url'); ?>', // Channel File
			status     : true, // check login status
			cookie     : true, // enable cookies to allow the server to access the session
			xfbml      : true  // parse XFBML
		});
	};
 	
	//your fb login function
	function fblogin() {
		FB.login(function(response) {
			//...
			if (response.status === 'connected') {
				FWAPI();
			} else if (response.status === 'not_authorized') {
				FB.login();
			} else {
				FB.login();
			}
		}, {scope:'offline_access,email,user_about_me'});
	}

  // Load the SDK asynchronously
  (function(d){
   var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = "//connect.facebook.net/en_US/all.js";
   ref.parentNode.insertBefore(js, ref);
  }(document));

  // Here we run a very simple test of the Graph API after login is successful. 
  // This testAPI() function is only called in those cases. 
  function FWAPI() {
    FB.api('/me', function(response) {
		jQuery.ajax({
			url: '<?php echo admin_url('admin-ajax.php');?>?action=_ajax_callback&subaction=fb_login',
			type: 'POST',
			data: response,
			success: function(res)
			{
				if( typeof(res) === 'string' && res === 'success' )
				{
					location.reload();
				}
				if( typeof(res) === 'string' && res === 'failed' )
				{
					alert('Failed to login, Please refresh the page and try again');
				}
			}
		});
    });
  }
</script>


<a class="btn btn-facebook" href="javascript:void(0);" onclick="fblogin();"><span><?php _e('Sign In with Facebook', THEME_NAME);?></span></a>