You are here

function LingotekOAuthRequestSigner::__construct in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lib/oauth-php/library/LingotekOAuthRequestSigner.php \LingotekOAuthRequestSigner::__construct()
  2. 7.5 lib/oauth-php/library/LingotekOAuthRequestSigner.php \LingotekOAuthRequestSigner::__construct()
  3. 7.6 lib/oauth-php/library/LingotekOAuthRequestSigner.php \LingotekOAuthRequestSigner::__construct()

* Construct the request to be signed. Parses or appends the parameters in the params url. * When you supply an params array, then the params should not be urlencoded. * When you supply a string, then it is assumed it is of the type application/x-www-form-urlencoded * *

Parameters

string request url: * @param string method PUT, GET, POST etc. * @param mixed params string (for urlencoded data, or array with name/value pairs) * @param string body optional body for PUT and/or POST requests

Overrides LingotekOAuthRequest::__construct

1 call to LingotekOAuthRequestSigner::__construct()
LingotekOAuthRequester::__construct in lib/oauth-php/library/LingotekOAuthRequester.php
* Construct a new request signer. Perform the request with the doRequest() method below. * * A request can have either one file or a body, not both. * * The files array consists of arrays: * - file the filename/path containing the data…
1 method overrides LingotekOAuthRequestSigner::__construct()
LingotekOAuthRequester::__construct in lib/oauth-php/library/LingotekOAuthRequester.php
* Construct a new request signer. Perform the request with the doRequest() method below. * * A request can have either one file or a body, not both. * * The files array consists of arrays: * - file the filename/path containing the data…

File

lib/oauth-php/library/LingotekOAuthRequestSigner.php, line 57

Class

LingotekOAuthRequestSigner

Code

function __construct($request, $method = null, $params = null, $body = null) {
  $this->store = OAuthStore::instance();
  if (is_string($params)) {
    parent::__construct($request, $method, $params);
  }
  else {
    parent::__construct($request, $method);
    if (is_array($params)) {
      foreach ($params as $name => $value) {
        $this
          ->setParam($name, $value);
      }
    }
  }

  // With put/ post we might have a body (not for application/x-www-form-urlencoded requests)
  if (strcasecmp($method, 'PUT') == 0 || strcasecmp($method, 'POST') == 0) {
    $this
      ->setBody($body);
  }
}