function _fbconnect_render_js in Facebook Connect 5
This function manage all javascripts used by this module.
1 call to _fbconnect_render_js()
- fbconnect_menu in ./
fbconnect.module - Implementation of hook_menu().
File
- ./
fbconnect.module, line 660 - This module allows site visitors to connect and register with facebook account
Code
function _fbconnect_render_js() {
global $base_url;
$url = drupal_to_js($base_url);
drupal_add_js(drupal_get_path('module', 'fbconnect') . '/js/fbconnect.js', 'module', 'footer');
if (!($conf = fbconnect_get_config())) {
return;
}
$sitename = drupal_to_js(variable_get('fbconnect_invitef_type', variable_get('site_name', NULL)));
if ($_SESSION['fbconnect_feed']['type'] == 'registration') {
$bundle_id = variable_get('fbconnect_reg_feed_id', FBCONNECT_REG_FEED_BUNDLEID);
$onload_js .= 'facebook_publish_feed_story(' . $bundle_id . ', {
"sitename": ' . $sitename . ', "siteurl" : ' . $url . '
});';
unset($_SESSION['fbconnect_feed']);
}
if ($_SESSION['fbconnect_feed']['type'] == 'comment') {
$bundle_id = variable_get('fbconnect_com_feed_id', FBCONNECT_COMMENT_FEED_BUNDLEID);
$onload_js .= 'facebook_publish_feed_story(' . $bundle_id . ',{
"sitename":' . $sitename . ',
"siteurl" : ' . $url . ',
"title" : ' . $_SESSION['fbconnect_feed']['title'] . ',
"article_url" : ' . $_SESSION['fbconnect_feed']['nodeurl'] . ',
"comment" : "' . $_SESSION['fbconnect_feed']['comment'] . '"
});';
unset($_SESSION['fbconnect_feed']);
}
if (fbconnect_get_fbuid() && $_GET['fblogout']) {
$onload_js = 'FB.Connect.logout(function() { window.location = ' . $url . ';});';
}
$xd_path = drupal_to_js(base_path() . drupal_get_path('module', 'fbconnect') . '/xd_receiver.html');
drupal_add_js('FB.Bootstrap.requireFeatures(["Connect","XFBML"], function() {
FB.Facebook.init("' . $conf['api_key'] . '", ' . $xd_path . ');
' . $onload_js . '
});', 'inline', 'footer');
}