You are here

function OAuthRequest::getSignatureMethod in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 lib/oauth-php/library/OAuthRequest.php \OAuthRequest::getSignatureMethod()

* Fetch the signature object used for calculating and checking the signature base string * *

Parameters

string method: * @return OAuthSignatureMethod object

2 calls to OAuthRequest::getSignatureMethod()
OAuthRequest::calculateDataSignature in lib/oauth-php/library/OAuthRequest.php
* Calculate the signature of a string. * Uses the signature method from the current parameters. * *
OAuthRequestVerifier::verifyDataSignature in lib/oauth-php/library/OAuthRequestVerifier.php
* Verify the signature of a string. * *

File

lib/oauth-php/library/OAuthRequest.php, line 279

Class

OAuthRequest
Object to parse an incoming OAuth request or prepare an outgoing OAuth request

Code

function getSignatureMethod($method) {
  $m = strtoupper($method);
  $m = preg_replace('/[^A-Z0-9]/', '_', $m);
  $class = 'OAuthSignatureMethod_' . $m;
  if (file_exists(dirname(__FILE__) . '/signature_method/' . $class . '.php')) {
    require_once dirname(__FILE__) . '/signature_method/' . $class . '.php';
    $sig = new $class();
  }
  else {
    throw new OAuthException2('Unsupported signature method "' . $m . '".');
  }
  return $sig;
}