# acymailing/10.1.4/WpInit/Security.php

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

- Page: https://pluginprobe.com/plugins/acymailing/10.1.4/code/WpInit/Security.php
- Raw: https://pluginprobe.com/plugins/acymailing/10.1.4/raw/WpInit/Security.php
- Modified: 2025-01-27T11:09:38+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/10.1.4/code/WpInit/Security.php#L10-L20`.

```php
<?php


namespace AcyMailing\WpInit;

class Security
{
    public function __construct()
    {
        add_filter('allowed_redirect_hosts', [$this, 'extendsAllowedHostsList']);
    }

    function extendsAllowedHostsList($hosts)
    {
        $config = acym_config();
        $allowedHosts = $config->get('allowed_hosts', []);
        if (!is_array($allowedHosts)) $allowedHosts = explode(',', $allowedHosts);

        if (empty($allowedHosts)) return $hosts;

        foreach ($allowedHosts as $host) {
            $hosts[] = $host;
        }

        return $hosts;
    }

}

```
