| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Services; |
| 4 |
|
| 5 |
defined('ABSPATH') || exit; |
| 6 |
|
| 7 |
class CheckHttpBlockService |
| 8 |
{ |
| 9 |
public function SyncBasalamHttpBlock() |
| 10 |
{ |
| 11 |
if (!defined('WP_HTTP_BLOCK_EXTERNAL') || WP_HTTP_BLOCK_EXTERNAL !== true) return false; |
| 12 |
|
| 13 |
$required_hosts = [ |
| 14 |
'basalam.com', |
| 15 |
'*.basalam.com', |
| 16 |
'*.hamsalam.ir', |
| 17 |
]; |
| 18 |
|
| 19 |
$current_hosts = []; |
| 20 |
|
| 21 |
if (defined('WP_ACCESSIBLE_HOSTS')) { |
| 22 |
$current_hosts = array_filter(array_map('trim', explode(',', WP_ACCESSIBLE_HOSTS))); |
| 23 |
} |
| 24 |
|
| 25 |
$missing_hosts = array_diff($required_hosts, $current_hosts); |
| 26 |
|
| 27 |
if (empty($missing_hosts)) return false; |
| 28 |
|
| 29 |
return $required_hosts; |
| 30 |
} |
| 31 |
} |
| 32 |
|