You are here

public function DrupalOAuthClient::__construct in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 includes/DrupalOAuthClient.inc \DrupalOAuthClient::__construct()
  2. 7.3 includes/DrupalOAuthClient.inc \DrupalOAuthClient::__construct()

Creates an instance of the DrupalOAuthClient.

Parameters

DrupalOAuthConsumer $consumer: The consumer.

OAuthToken $request_token: Optional. A request token to use.

OAuthSignatureMethod $signature_method: Optional. The signature method to use.

integer $version: Optional. The version to use - either OAUTH_COMMON_VERSION_1_RFC or OAUTH_COMMON_VERSION_1.

File

includes/DrupalOAuthClient.inc, line 23

Class

DrupalOAuthClient

Code

public function __construct($consumer, $request_token = NULL, $signature_method = NULL, $version = NULL) {
  $this->consumer = $consumer;
  $this->requestToken = $request_token;
  $this->signatureMethod = $signature_method;
  if ($version) {
    $this->version = $version;
  }

  // Set to the default signature method if no method was specified
  if (!$this->signatureMethod) {
    if (!empty($this->consumer->configuration['signature_method'])) {
      $signature_method = substr(strtolower($this->consumer->configuration['signature_method']), 5);
    }
    else {
      $signature_method = 'SHA1';
    }
    $this->signatureMethod = self::signatureMethod($signature_method);
  }
}