public static function OAuthRequestLogger::getAllHeaders in Lingotek Translation 7.3
Same name and namespace in other branches
- 7.2 lib/oauth-php/library/OAuthRequestLogger.php \OAuthRequestLogger::getAllHeaders()
* helper to try to sort out headers for people who aren't running apache, * or people who are running PHP as FastCGI. * *
Return value
array of request headers as associative array.
3 calls to OAuthRequestLogger::getAllHeaders()
- OAuthRequest::__construct in lib/
oauth-php/ library/ OAuthRequest.php - * Construct from the current request. Useful for checking the signature of a request. * When not supplied with any parameters this will use the current request. * *
- OAuthRequestLogger::flush in lib/
oauth-php/ library/ OAuthRequestLogger.php - * Logs the request to the database, sends any cached output. * Also called on shutdown, to make sure we always log the request being handled.
- OAuthRequestVerifier::requestIsSigned in lib/
oauth-php/ library/ OAuthRequestVerifier.php - * See if the current request is signed with OAuth * *
File
- lib/
oauth-php/ library/ OAuthRequestLogger.php, line 278
Class
- OAuthRequestLogger
- Log OAuth requests
Code
public static function getAllHeaders() {
$retarr = array();
$headers = array();
if (function_exists('apache_request_headers')) {
$headers = apache_request_headers();
ksort($headers);
return $headers;
}
else {
$headers = array_merge($_ENV, $_SERVER);
foreach ($headers as $key => $val) {
//we need this header
if (strpos(strtolower($key), 'content-type') !== FALSE) {
continue;
}
if (strtoupper(substr($key, 0, 5)) != "HTTP_") {
unset($headers[$key]);
}
}
}
//Normalize this array to Cased-Like-This structure.
foreach ($headers as $key => $value) {
$key = preg_replace('/^HTTP_/i', '', $key);
$key = str_replace(" ", "-", ucwords(strtolower(str_replace(array(
"-",
"_",
), " ", $key))));
$retarr[$key] = $value;
}
ksort($retarr);
return $retarr;
}