You are here

public static function OAuthUtil::split_header in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.3 lib/OAuth.php \OAuthUtil::split_header()
1 call to OAuthUtil::split_header()
OAuthRequest::from_request in lib/OAuth.php
attempt to build up a request from what was passed to the server

File

lib/OAuth.php, line 788
OAuth 1.0 server and client library.

Class

OAuthUtil

Code

public static function split_header($header, $only_allow_oauth_parameters = true) {
  $params = array();
  if (preg_match_all('/(' . ($only_allow_oauth_parameters ? 'oauth_' : '') . '[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches)) {
    foreach ($matches[1] as $i => $h) {
      $params[$h] = OAuthUtil::urldecode_rfc3986(empty($matches[3][$i]) ? $matches[4][$i] : $matches[3][$i]);
    }
    if (isset($params['realm'])) {
      unset($params['realm']);
    }
  }
  return $params;
}