You are here

function _facebook_client_load_include in Facebook Connect 6

Same name and namespace in other branches
  1. 8.2 fbconnect.module \_facebook_client_load_include()
  2. 7.2 fbconnect.module \_facebook_client_load_include()
1 call to _facebook_client_load_include()
facebook_client in ./fbconnect.module
Get the facebook client object for easy access.

File

./fbconnect.module, line 379

Code

function _facebook_client_load_include() {
  if (!class_exists('Facebook')) {
    $lib_paths = array_filter(array(
      drupal_get_path('module', 'fbconnect') . '/facebook-client',
      module_invoke('libraries', 'get_path', 'facebook-platform'),
      module_invoke('libraries', 'get_path', 'facebook-client'),
      module_invoke('libraries', 'get_path', 'facebook-php-sdk'),
    ));
    foreach ($lib_paths as $dir) {
      $lib_paths[] = $dir . '/php';
      $lib_paths[] = $dir . '/src';
    }
    foreach ($lib_paths as $path) {
      $client_include = $path . '/facebook.php';
      if (file_exists($client_include)) {
        include_once $client_include;
        if (class_exists('Facebook')) {
          return true;
        }
      }
    }
    $message = t('Fbconnect : Facebook PHP library not found. See README.TXT');
    drupal_set_message($message, 'warning', FALSE);
    return false;
  }
  return true;
}