static function CleantalkHelper::apache_request_headers in Anti Spam by CleanTalk 7.5
Same name and namespace in other branches
- 7.4 src/CleantalkHelper.php \CleantalkHelper::apache_request_headers()
1 call to CleantalkHelper::apache_request_headers()
File
- src/
CleantalkHelper.php, line 638
Class
- CleantalkHelper
- Cleantalk's hepler class
Code
static function apache_request_headers() {
$headers = array();
foreach ($_SERVER as $key => $val) {
if (preg_match('/\\AHTTP_/', $key)) {
$server_key = preg_replace('/\\AHTTP_/', '', $key);
$key_parts = explode('_', $server_key);
if (count($key_parts) > 0 and strlen($server_key) > 2) {
foreach ($key_parts as $part_index => $part) {
if (!empty($part)) {
$key_parts[$part_index] = mb_strtolower($part);
$key_parts[$part_index][0] = strtoupper($key_parts[$part_index][0]);
}
}
$server_key = implode('-', $key_parts);
}
$headers[$server_key] = $val;
}
}
return $headers;
}