You are here

public static function OAuthRequest::from_consumer_and_token in OAuth 1.0 7.3

Same name and namespace in other branches
  1. 6.3 lib/OAuth.php \OAuthRequest::from_consumer_and_token()
  2. 6 OAuth.php \OAuthRequest::from_consumer_and_token()

pretty much a helper function to set up the request

1 call to OAuthRequest::from_consumer_and_token()
DrupalOAuthClient::get in includes/DrupalOAuthClient.inc
Make an OAuth request.

File

lib/OAuth.php, line 322
OAuth 1.0 server and client library.

Class

OAuthRequest

Code

public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL) {
  $parameters = $parameters ? $parameters : array();
  $defaults = array(
    "oauth_version" => OAuthRequest::$version,
    "oauth_nonce" => OAuthRequest::generate_nonce(),
    "oauth_timestamp" => OAuthRequest::generate_timestamp(),
    "oauth_consumer_key" => $consumer->key,
  );
  if ($token) {
    $defaults['oauth_token'] = $token->key;
  }
  $parameters = array_merge($defaults, $parameters);
  return new OAuthRequest($http_method, $http_url, $parameters);
}