You are here

public function sOAuthRequest::to_header in jQuery social stream 7

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

builds the Authorization: header

File

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

Class

sOAuthRequest

Code

public function to_header($realm = null) {
  $first = true;
  if ($realm) {
    $out = 'Authorization: sOAuth realm="' . sOAuthUtil::urlencode_rfc3986($realm) . '"';
    $first = false;
  }
  else {
    $out = 'Authorization: sOAuth';
  }
  $total = array();
  foreach ($this->parameters as $k => $v) {
    if (substr($k, 0, 5) != "oauth") {
      continue;
    }
    if (is_array($v)) {
      throw new sOAuthException('Arrays not supported in headers');
    }
    $out .= $first ? ' ' : ',';
    $out .= sOAuthUtil::urlencode_rfc3986($k) . '="' . sOAuthUtil::urlencode_rfc3986($v) . '"';
    $first = false;
  }
  return $out;
}