You are here

function fb_connect_fb in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 5.2 fb_connect.module \fb_connect_fb()
  2. 6.2 fb_connect.module \fb_connect_fb()
  3. 7.3 fb_connect.module \fb_connect_fb()

Implementation of hook_fb().

File

./fb_connect.module, line 90
Support for Facebook Connect features

Code

function fb_connect_fb($op, $data, &$return) {

  //dpm(func_get_args(), "fb_connect_fb($op)");
  if ($op == FB_OP_CURRENT_APP && !$return && !fb_is_canvas()) {

    // This will cause fb.module to set the global $_fb when user is logged in via fbConnect.
    if ($id = variable_get(FB_VAR_ID, NULL)) {

      // Use $conf['fb_id'] if set in settings.php.
      $return = fb_get_app(array(
        'id' => $id,
      ));
    }
    elseif ($apikey = variable_get(FB_VAR_APIKEY, NULL)) {

      // Deprecated.  Use fb_id instead.
      // Use $conf['fb_apikey'] if set in settings.php.
      $return = fb_get_app(array(
        'apikey' => $apikey,
      ));
    }
    elseif ($label = variable_get(FB_CONNECT_VAR_PRIMARY, NULL)) {
      $return = fb_get_app(array(
        'label' => $label,
      ));
    }
  }
  elseif ($op == FB_OP_POST_INIT) {
    if (!fb_is_tab()) {

      // Init Facebook javascript for primary app
      _fb_connect_add_js($data['fb_app'], $data['fb']);
    }

    // Include our admin hooks.
    if (fb_is_fb_admin_page()) {
      module_load_include('inc', 'fb_connect', 'fb_connect.admin');
    }
  }
}