function fbconnect_footer in Facebook Connect 6.2
Same name and namespace in other branches
- 5 fbconnect.module \fbconnect_footer()
- 6 fbconnect.module \fbconnect_footer()
Implements hook_footer().
File
- ./
fbconnect.module, line 419 - Integration with Facebook Connect API.
Code
function fbconnect_footer() {
if (fbconnect_facebook_client() && !_fbconnect_is_excluded_page($_GET['q'])) {
$config = fbconnect_get_config();
$channel_uri = preg_replace("@'@msi", "\\'", "http://" . $_SERVER['HTTP_HOST'] . "/" . drupal_get_path('module', 'fbconnect') . "/channel.html");
$footer = array();
$footer['fb-init-code'] = <<<CODE
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '{<span class="php-variable">$config</span>[<span class="php-string">'app_id'</span>]}',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true,
logging: '{<span class="php-variable">$config</span>[<span class="php-string">'debug'</span>]}',
channelURL: '{<span class="php-variable">$channel_uri</span>}',
oauth : true
});
jQuery(document).trigger('fb:init');
};
(function() {
var e = document.createElement('script');
e.src = {<span class="php-variable">$config</span>[<span class="php-string">'connect_js'</span>]};
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
CODE;
// Ugly hack to integrate with fb_social.
if (@$config['omit_fb_init_code']) {
unset($footer['fb-init-code']);
}
if (!fbconnect_get_fbuid(TRUE)) {
// Display the autoconnect form.
$footer['autoconnect-form'] = '<div style="display: none">' . drupal_get_form('fbconnect_autoconnect_form') . '</div>';
}
return join("\n", $footer);
}
}