You are here

static function Helper::apache_request_headers in Anti Spam by CleanTalk 8.3

1 call to Helper::apache_request_headers()
Helper::ip_get in src/lib/Cleantalk/Common/Helper.php

File

src/lib/Cleantalk/Common/Helper.php, line 655

Class

Helper
Cleantalk's hepler class

Namespace

Drupal\cleantalk\lib\Cleantalk\Common

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) {
          $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;
}