public static function sOAuthUtil::split_header in jQuery social stream 7
Same name and namespace in other branches
- 7.2 jquery_social_stream.js.inc \sOAuthUtil::split_header()
1 call to sOAuthUtil::split_header()
- sOAuthRequest::from_request in ./
jquery_social_stream.js.inc - attempt to build up a request from what was passed to the server
File
- ./
jquery_social_stream.js.inc, line 1083 - JS callbacks.
Class
Code
public static function split_header($header, $only_allow_oauth_parameters = true) {
$pattern = '/(([-_a-z]*)=("([^"]*)"|([^,]*)),?)/';
$offset = 0;
$params = array();
while (preg_match($pattern, $header, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
$match = $matches[0];
$header_name = $matches[2][0];
$header_content = isset($matches[5]) ? $matches[5][0] : $matches[4][0];
if (preg_match('/^oauth_/', $header_name) || !$only_allow_oauth_parameters) {
$params[$header_name] = sOAuthUtil::urldecode_rfc3986($header_content);
}
$offset = $match[1] + strlen($match[0]);
}
if (isset($params['realm'])) {
unset($params['realm']);
}
return $params;
}