You are here

public static function sOAuthRequest::from_consumer_and_token in jQuery social stream 7

Same name and namespace in other branches
  1. 7.2 jquery_social_stream.js.inc \sOAuthRequest::from_consumer_and_token()

pretty much a helper function to set up the request

1 call to sOAuthRequest::from_consumer_and_token()
TwittersOAuth::oAuthRequest in ./jquery_social_stream.js.inc
Format and sign an sOAuth / API request

File

./jquery_social_stream.js.inc, line 617
JS callbacks.

Class

sOAuthRequest

Code

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