| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace AcyMailing\WpInit; |
| 5 |
|
| 6 |
class Security |
| 7 |
{ |
| 8 |
public function __construct() |
| 9 |
{ |
| 10 |
add_filter('allowed_redirect_hosts', [$this, 'extendsAllowedHostsList']); |
| 11 |
} |
| 12 |
|
| 13 |
function extendsAllowedHostsList($hosts) |
| 14 |
{ |
| 15 |
$config = acym_config(); |
| 16 |
$allowedHosts = $config->get('allowed_hosts', []); |
| 17 |
if (!is_array($allowedHosts)) $allowedHosts = explode(',', $allowedHosts); |
| 18 |
|
| 19 |
if (empty($allowedHosts)) return $hosts; |
| 20 |
|
| 21 |
foreach ($allowedHosts as $host) { |
| 22 |
$hosts[] = $host; |
| 23 |
} |
| 24 |
|
| 25 |
return $hosts; |
| 26 |
} |
| 27 |
|
| 28 |
} |
| 29 |
|