function facebook_client in Facebook Connect 5
Same name and namespace in other branches
- 8.2 fbconnect.module \facebook_client()
- 6 fbconnect.module \facebook_client()
Get the facebook client object for easy access.
Return value
object Facebook Api object
4 calls to facebook_client()
- fbconnect_get_connected_friends in ./
fbconnect.module - Get facebook friend who has_added_app.
- fbconnect_get_fbname in ./
fbconnect.module - Get the facebook username
- fbconnect_get_fbuid in ./
fbconnect.module - Check facebook session.
- fbconnect_get_info_from_fb in ./
fbconnect.module - Query information from facebook user table.
File
- ./
fbconnect.module, line 948 - This module allows site visitors to connect and register with facebook account
Code
function facebook_client() {
static $fb = NULL;
if (!$fb instanceof Facebook) {
if ($conf = fbconnect_get_config()) {
// Facebook php client API
$lib_path = drupal_get_path('module', 'fbconnect') . '/facebook-client/';
$lib_files = array(
'facebook.php',
'facebook_desktop.php',
'jsonwrapper/jsonwrapper_inner.php',
'jsonwrapper/jsonwrapper.php',
'jsonwrapper/JSON/JSON.php',
);
foreach ($lib_files as $files) {
if (!file_exists($lib_path . $files)) {
$msg = t('Fbconnect : Facebook PHP library file @file not found see readme.txt', array(
'@file' => $lib_path . $files,
));
drupal_set_message($msg, 'status');
return;
}
}
// Include facebook.php
include_once $lib_path . $lib_files[0];
if (class_exists('Facebook')) {
$fb = new Facebook($conf['api_key'], $conf['secret_api_key']);
}
}
}
return $fb;
}