You are here

function LingotekOAuthRequest::getNormalizedParams in Lingotek Translation 7.7

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

* Return the complete parameter string for the signature check. * All parameters are correctly urlencoded and sorted on name and value * *

Return value

string

1 call to LingotekOAuthRequest::getNormalizedParams()
LingotekOAuthRequest::signatureBaseString in lib/oauth-php/library/LingotekOAuthRequest.php
* Return the signature base string. * Note that we can't use rawurlencode due to specified use of RFC3986. * *

File

lib/oauth-php/library/LingotekOAuthRequest.php, line 301

Class

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

Code

function getNormalizedParams() {

  /*
  		// sort by name, then by value
  		// (needed when we start allowing multiple values with the same name)
  		$keys   = array_keys($this->param);
  		$values = array_values($this->param);
  		array_multisort($keys, SORT_ASC, $values, SORT_ASC);
  */
  $params = $this->param;
  $normalized = array();
  ksort($params);
  foreach ($params as $key => $value) {

    // all names and values are already urlencoded, exclude the oauth signature
    if ($key != 'oauth_signature') {
      if (is_array($value)) {
        $value_sort = $value;
        sort($value_sort, SORT_STRING);

        // multi-parameters require the values to be sorted lexigraphically
        foreach ($value_sort as $v) {
          $normalized[] = $key . '=' . $v;
        }
      }
      else {
        $normalized[] = $key . '=' . $value;
      }
    }
  }
  return implode('&', $normalized);
}