You are here

function drupagram_connect in Drupagram 7

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

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

2 calls to drupagram_connect()
drupagram_fetch_recent_items in ./drupagram.inc
Fetches a user's recent items.
drupagram_fetch_user_feed in ./drupagram.inc
Fetches a user's feed

File

./drupagram.inc, line 11
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();
  }
}