| 1 |
<?php |
| 2 |
/** |
| 3 |
* Access Control Page View |
| 4 |
* |
| 5 |
* @package AtomicEdge |
| 6 |
*/ |
| 7 |
|
| 8 |
// Prevent direct access. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
// Use dev mode for local environments. |
| 14 |
$atomicedge_dev_mode = AtomicEdge_Dev_Mode::is_enabled(); |
| 15 |
?> |
| 16 |
<div class="wrap atomicedge-wrap"> |
| 17 |
<h1><img src="<?php echo esc_url( ATOMICEDGE_PLUGIN_URL . 'admin/images/logo.svg' ); ?>" alt="<?php esc_attr_e( 'Atomic Edge', 'atomic-edge-security' ); ?>" class="atomicedge-logo" /></h1> |
| 18 |
|
| 19 |
<?php |
| 20 |
// Show dev mode notice. |
| 21 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped in the method. |
| 22 |
echo AtomicEdge_Dev_Mode::get_admin_notice(); |
| 23 |
?> |
| 24 |
|
| 25 |
<div class="atomicedge-access-control"> |
| 26 |
<!-- Tabs --> |
| 27 |
<nav class="nav-tab-wrapper atomicedge-tabs"> |
| 28 |
<a href="#ip-whitelist" class="nav-tab nav-tab-active" data-tab="ip-whitelist"> |
| 29 |
<?php esc_html_e( 'IP Whitelist', 'atomic-edge-security' ); ?> |
| 30 |
</a> |
| 31 |
<a href="#ip-blacklist" class="nav-tab" data-tab="ip-blacklist"> |
| 32 |
<?php esc_html_e( 'IP Blacklist', 'atomic-edge-security' ); ?> |
| 33 |
</a> |
| 34 |
<a href="#geo-access" class="nav-tab" data-tab="geo-access"> |
| 35 |
<?php esc_html_e( 'Geographic Access', 'atomic-edge-security' ); ?> |
| 36 |
</a> |
| 37 |
</nav> |
| 38 |
|
| 39 |
<!-- IP Whitelist Tab --> |
| 40 |
<div id="ip-whitelist" class="atomicedge-tab-content atomicedge-tab-active"> |
| 41 |
<div class="atomicedge-section-header"> |
| 42 |
<h2><?php esc_html_e( 'IP Whitelist', 'atomic-edge-security' ); ?></h2> |
| 43 |
<p><?php esc_html_e( 'Whitelisted IPs bypass WAF, bot blocking, and geographic restrictions.', 'atomic-edge-security' ); ?></p> |
| 44 |
</div> |
| 45 |
|
| 46 |
<form id="atomicedge-add-whitelist-form" class="atomicedge-ip-form"> |
| 47 |
<div class="atomicedge-form-row"> |
| 48 |
<input type="text" |
| 49 |
id="whitelist-ip" |
| 50 |
name="ip" |
| 51 |
placeholder="<?php esc_attr_e( 'IP address or CIDR (e.g., 192.168.1.1 or 10.0.0.0/24)', 'atomic-edge-security' ); ?>" |
| 52 |
required /> |
| 53 |
<input type="text" |
| 54 |
id="whitelist-description" |
| 55 |
name="description" |
| 56 |
placeholder="<?php esc_attr_e( 'Description (optional)', 'atomic-edge-security' ); ?>" /> |
| 57 |
<button type="submit" class="button button-primary"> |
| 58 |
<?php esc_html_e( 'Add to Whitelist', 'atomic-edge-security' ); ?> |
| 59 |
</button> |
| 60 |
</div> |
| 61 |
</form> |
| 62 |
|
| 63 |
<table class="wp-list-table widefat fixed striped" id="atomicedge-whitelist-table"> |
| 64 |
<thead> |
| 65 |
<tr> |
| 66 |
<th class="column-ip"><?php esc_html_e( 'IP/CIDR', 'atomic-edge-security' ); ?></th> |
| 67 |
<th class="column-description"><?php esc_html_e( 'Description', 'atomic-edge-security' ); ?></th> |
| 68 |
<th class="column-actions"><?php esc_html_e( 'Actions', 'atomic-edge-security' ); ?></th> |
| 69 |
</tr> |
| 70 |
</thead> |
| 71 |
<tbody id="atomicedge-whitelist-body"> |
| 72 |
<tr class="atomicedge-loading-row"> |
| 73 |
<td colspan="3"> |
| 74 |
<span class="spinner is-active"></span> |
| 75 |
<?php esc_html_e( 'Loading...', 'atomic-edge-security' ); ?> |
| 76 |
</td> |
| 77 |
</tr> |
| 78 |
</tbody> |
| 79 |
</table> |
| 80 |
</div> |
| 81 |
|
| 82 |
<!-- IP Blacklist Tab --> |
| 83 |
<div id="ip-blacklist" class="atomicedge-tab-content"> |
| 84 |
<div class="atomicedge-section-header"> |
| 85 |
<h2><?php esc_html_e( 'IP Blacklist', 'atomic-edge-security' ); ?></h2> |
| 86 |
<p><?php esc_html_e( 'Blacklisted IPs are blocked from accessing your site entirely.', 'atomic-edge-security' ); ?></p> |
| 87 |
</div> |
| 88 |
|
| 89 |
<form id="atomicedge-add-blacklist-form" class="atomicedge-ip-form"> |
| 90 |
<div class="atomicedge-form-row"> |
| 91 |
<input type="text" |
| 92 |
id="blacklist-ip" |
| 93 |
name="ip" |
| 94 |
placeholder="<?php esc_attr_e( 'IP address or CIDR (e.g., 192.168.1.1 or 10.0.0.0/24)', 'atomic-edge-security' ); ?>" |
| 95 |
required /> |
| 96 |
<input type="text" |
| 97 |
id="blacklist-description" |
| 98 |
name="description" |
| 99 |
placeholder="<?php esc_attr_e( 'Description (optional)', 'atomic-edge-security' ); ?>" /> |
| 100 |
<button type="submit" class="button button-primary"> |
| 101 |
<?php esc_html_e( 'Add to Blacklist', 'atomic-edge-security' ); ?> |
| 102 |
</button> |
| 103 |
</div> |
| 104 |
</form> |
| 105 |
|
| 106 |
<table class="wp-list-table widefat fixed striped" id="atomicedge-blacklist-table"> |
| 107 |
<thead> |
| 108 |
<tr> |
| 109 |
<th class="column-ip"><?php esc_html_e( 'IP/CIDR', 'atomic-edge-security' ); ?></th> |
| 110 |
<th class="column-description"><?php esc_html_e( 'Description', 'atomic-edge-security' ); ?></th> |
| 111 |
<th class="column-actions"><?php esc_html_e( 'Actions', 'atomic-edge-security' ); ?></th> |
| 112 |
</tr> |
| 113 |
</thead> |
| 114 |
<tbody id="atomicedge-blacklist-body"> |
| 115 |
<tr class="atomicedge-loading-row"> |
| 116 |
<td colspan="3"> |
| 117 |
<span class="spinner is-active"></span> |
| 118 |
<?php esc_html_e( 'Loading...', 'atomic-edge-security' ); ?> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
</tbody> |
| 122 |
</table> |
| 123 |
</div> |
| 124 |
|
| 125 |
<!-- Geographic Access Tab --> |
| 126 |
<div id="geo-access" class="atomicedge-tab-content"> |
| 127 |
<div class="atomicedge-section-header"> |
| 128 |
<h2><?php esc_html_e( 'Geographic Access Control', 'atomic-edge-security' ); ?></h2> |
| 129 |
<p><?php esc_html_e( 'Block or allow access based on visitor country.', 'atomic-edge-security' ); ?></p> |
| 130 |
</div> |
| 131 |
|
| 132 |
<form id="atomicedge-geo-form" class="atomicedge-geo-form"> |
| 133 |
<div class="atomicedge-form-section"> |
| 134 |
<label> |
| 135 |
<input type="checkbox" id="geo-enabled" name="enabled" /> |
| 136 |
<?php esc_html_e( 'Enable Geographic Access Control', 'atomic-edge-security' ); ?> |
| 137 |
</label> |
| 138 |
</div> |
| 139 |
|
| 140 |
<div class="atomicedge-form-section" id="geo-options" style="display: none;"> |
| 141 |
<label for="geo-mode"><?php esc_html_e( 'Mode:', 'atomic-edge-security' ); ?></label> |
| 142 |
<select id="geo-mode" name="mode"> |
| 143 |
<option value="blacklist"><?php esc_html_e( 'Blacklist (block selected countries)', 'atomic-edge-security' ); ?></option> |
| 144 |
<option value="whitelist"><?php esc_html_e( 'Whitelist (only allow selected countries)', 'atomic-edge-security' ); ?></option> |
| 145 |
</select> |
| 146 |
|
| 147 |
<div class="atomicedge-country-selector"> |
| 148 |
<label><?php esc_html_e( 'Countries:', 'atomic-edge-security' ); ?></label> |
| 149 |
<select id="geo-countries" name="countries" multiple size="10"> |
| 150 |
<!-- Countries will be populated by JavaScript --> |
| 151 |
</select> |
| 152 |
<p class="description"> |
| 153 |
<?php esc_html_e( 'Hold Ctrl (Cmd on Mac) to select multiple countries.', 'atomic-edge-security' ); ?> |
| 154 |
</p> |
| 155 |
</div> |
| 156 |
|
| 157 |
<button type="submit" class="button button-primary"> |
| 158 |
<?php esc_html_e( 'Save Geographic Rules', 'atomic-edge-security' ); ?> |
| 159 |
</button> |
| 160 |
</div> |
| 161 |
</form> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
</div> |
| 165 |
|