You are here

function _facebook_client_load_include in Facebook Connect 8.2

Same name and namespace in other branches
  1. 6 fbconnect.module \_facebook_client_load_include()
  2. 7.2 fbconnect.module \_facebook_client_load_include()

Locates and loads the Facebook PHP SDK library.

2 calls to _facebook_client_load_include()
facebook_client in ./fbconnect.module
Get the Facebook client object for easy access.
fbconnect_requirements in ./fbconnect.install
Implements hook_requirements().

File

./fbconnect.module, line 55
@todo.

Code

function _facebook_client_load_include() {
  if (!class_exists('Facebook\\Facebook')) {
    $sdk_path = DRUPAL_ROOT . '/sites/all/libraries/facebook-php-sdk-v4/src/Facebook/autoload.php';
    $library = array(
      'loaded' => file_exists($sdk_path),
    );
    if ($library['loaded']) {
      require_once $sdk_path;
    }
    if (!$library['loaded']) {
      watchdog('fbconnect', 'Unable to load the required Facebook library, please check the README.txt for instructions on how to resolve this.');
    }
  }
  $exists = class_exists('Facebook\\Facebook') && defined('Facebook\\Facebook::VERSION');
  return $exists;
}