You are here

function drupagram_connect in Drupagram 6

Same name and namespace in other branches
  1. 7 drupagram.inc \drupagram_connect()

Connect to the API using the 'proper' version (Oauth vs. standard)

1 call to drupagram_connect()
drupagram_fetch_recent_items in ./drupagram.inc
Fetches a user's recent items.

File

./drupagram.inc, line 12
Instagram API functions

Code

function drupagram_connect($account) {
  $auth = $account
    ->get_auth();
  if (_drupagram_use_oauth() && $auth['oauth_token'] && $auth['oauth_token_secret']) {
    module_load_include('lib.php', 'oauth_common');
    return new InstagramOAuth(variable_get('drupagram_consumer_key', ''), variable_get('drupagram_consumer_secret', ''), $auth['oauth_token'], $auth['oauth_token_secret']);
  }
  elseif (_drupagram_use_oauth() && $auth['oauth_token']) {
    return new Instagram($account->username, $auth['oauth_token']);
  }
  else {
    return new Instagram();
  }
}