You are here

function _facebook_client_load_include in Facebook Connect 7.2

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

Locates and loads the Facebook PHP SDK library.

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

File

./fbconnect.module, line 83
Facebook Connect API module.

Code

function _facebook_client_load_include() {
  if (!class_exists('Facebook\\FacebookRequest')) {
    if (function_exists('libraries_load')) {
      $library = libraries_load('facebook-php-sdk-v4');
      if (!$library['loaded']) {
        watchdog('fbconnectv4', t('Unable to load the required Facebook library'));
      }
    }
    else {
      $sdk_path = DRUPAL_ROOT . '/sites/all/libraries/facebook-php-sdk-v4/autoload.php';
      $library = array(
        'loaded' => file_exists($sdk_path),
      );
      if ($library['loaded']) {
        require_once $sdk_path;
      }
    }
  }
  return class_exists('Facebook\\FacebookRequest') && defined('Facebook\\FacebookRequest::VERSION');
}