# acymailing/11.0.4/back/Helpers/global/ajax.php

AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress, version 11.0.4. 48 lines.

- Page: https://pluginprobe.com/plugins/acymailing/11.0.4/code/back/Helpers/global/ajax.php
- Raw: https://pluginprobe.com/plugins/acymailing/11.0.4/raw/back/Helpers/global/ajax.php
- Modified: 2026-08-03T10:18:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/acymailing/11.0.4/code/back/Helpers/global/ajax.php#L10-L20`.

```php
<?php
defined('ABSPATH') || die('Restricted Access');

function acym_getAllHeaders(): array
{
    if (function_exists('getallheaders')) {
        return getallheaders();
    }

    $headers = [];

    foreach ($_SERVER as $name => $value) {
        if (substr($name, 0, 5) === 'HTTP_') {
            $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
        } else {
            $headers[$name] = $value;
        }
    }

    return $headers;
}

function acym_getHeader(string $headerName): string
{
    $allHeaders = acym_getAllHeaders();

    if (!empty($allHeaders[$headerName])) {
        return $allHeaders[$headerName];
    }

    return '';
}

function acym_isAjax(): bool
{
    $allHeaders = acym_getAllHeaders();

    if (!empty($allHeaders['Accept'])) {
        $headerAccept = $allHeaders['Accept'];
    } elseif (!empty($allHeaders['accept'])) {
        $headerAccept = $allHeaders['accept'];
    } else {
        $headerAccept = '';
    }

    return strpos($headerAccept, 'application/json') !== false;
}

```
