You are here

function facebook_client in Facebook Connect 6

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

Get the facebook client object for easy access.

Return value

Facebook Facebook Api object

7 calls to facebook_client()
fbconnect_fbapp_settings in ./fbconnect.admin.inc
fbconnect_fbapp_settings_submit in ./fbconnect.admin.inc
fbconnect_get_connected_friends in ./fbconnect.module
Get facebook friend who has_added_app.
fbconnect_get_fbuid in ./fbconnect.module
Check facebook session.
fbconnect_get_info_from_fb in ./fbconnect.module
Query information from facebook user table.

... See full list

File

./fbconnect.module, line 417

Code

function facebook_client() {
  static $fb = NULL;
  if (!$fb instanceof Facebook && _facebook_client_load_include() && ($conf = fbconnect_get_config())) {
    $fb = new Facebook($conf['api_key'], $conf['secret_api_key']);

    /*
     * If a page is loaded via HTTPS, then all images and static
     * resources need to be printed with HTTPS urls to avoid
     * mixed content warnings. If your page loads with an HTTPS
     * url, then call set_use_ssl_resources to retrieve the correct
     * urls.
     */
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
      $fb->api_client
        ->set_use_ssl_resources(TRUE);
    }
  }
  return $fb;
}