| 1 |
<?php |
| 2 |
/** |
| 3 |
* Dashboard 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 |
$atomicedge_is_connected = $atomicedge_dev_mode ? true : $this->api->is_connected(); |
| 16 |
$atomicedge_site_data = AtomicEdge_Dev_Mode::get_effective_site_data(); |
| 17 |
?> |
| 18 |
<div class="wrap atomicedge-wrap"> |
| 19 |
<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> |
| 20 |
|
| 21 |
<?php |
| 22 |
// Show dev mode notice. |
| 23 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped in the method. |
| 24 |
echo AtomicEdge_Dev_Mode::get_admin_notice(); |
| 25 |
?> |
| 26 |
|
| 27 |
<?php if ( ! $atomicedge_is_connected ) : ?> |
| 28 |
<div class="atomicedge-welcome"> |
| 29 |
<div class="atomicedge-welcome-header"> |
| 30 |
<h2><?php esc_html_e( 'Welcome to Atomic Edge Security', 'atomic-edge-security' ); ?></h2> |
| 31 |
<p><?php esc_html_e( 'Protect your WordPress site with enterprise-grade WAF protection, analytics, and security tools.', 'atomic-edge-security' ); ?></p> |
| 32 |
</div> |
| 33 |
|
| 34 |
<div class="atomicedge-connect-box"> |
| 35 |
<h3><?php esc_html_e( 'Connect Your Site', 'atomic-edge-security' ); ?></h3> |
| 36 |
<p><?php esc_html_e( 'Enter your Atomic Edge API key to get started.', 'atomic-edge-security' ); ?></p> |
| 37 |
|
| 38 |
<form method="post" action=""> |
| 39 |
<?php wp_nonce_field( 'atomicedge_connect' ); ?> |
| 40 |
<table class="form-table"> |
| 41 |
<tr> |
| 42 |
<th scope="row"> |
| 43 |
<label for="atomicedge_api_key"><?php esc_html_e( 'API Key', 'atomic-edge-security' ); ?></label> |
| 44 |
</th> |
| 45 |
<td> |
| 46 |
<input type="text" |
| 47 |
id="atomicedge_api_key" |
| 48 |
name="atomicedge_api_key" |
| 49 |
class="regular-text" |
| 50 |
placeholder="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |
| 51 |
required /> |
| 52 |
<p class="description"> |
| 53 |
<?php esc_html_e( 'Paste the API key exactly as shown in the Atomic Edge dashboard (32–64 letters/numbers, no prefix).', 'atomic-edge-security' ); ?> |
| 54 |
<br /> |
| 55 |
<?php |
| 56 |
printf( |
| 57 |
/* translators: %s: AtomicEdge dashboard URL */ |
| 58 |
esc_html__( 'Get your API key from your %s.', 'atomic-edge-security' ), |
| 59 |
'<a href="https://dashboard.atomicedge.io" target="_blank">' . esc_html__( 'Atomic Edge dashboard', 'atomic-edge-security' ) . '</a>' |
| 60 |
); |
| 61 |
?> |
| 62 |
</p> |
| 63 |
</td> |
| 64 |
</tr> |
| 65 |
</table> |
| 66 |
<p class="submit"> |
| 67 |
<button type="submit" name="atomicedge_connect" class="button button-primary button-hero"> |
| 68 |
<?php esc_html_e( 'Connect to Atomic Edge', 'atomic-edge-security' ); ?> |
| 69 |
</button> |
| 70 |
</p> |
| 71 |
</form> |
| 72 |
</div> |
| 73 |
|
| 74 |
<div class="atomicedge-features"> |
| 75 |
<h3><?php esc_html_e( 'Features', 'atomic-edge-security' ); ?></h3> |
| 76 |
<div class="atomicedge-feature-grid"> |
| 77 |
<div class="atomicedge-feature"> |
| 78 |
<span class="dashicons dashicons-shield"></span> |
| 79 |
<h4><?php esc_html_e( 'WAF Protection', 'atomic-edge-security' ); ?></h4> |
| 80 |
<p><?php esc_html_e( 'Enterprise-grade Web Application Firewall with OWASP rules.', 'atomic-edge-security' ); ?></p> |
| 81 |
</div> |
| 82 |
<div class="atomicedge-feature"> |
| 83 |
<span class="dashicons dashicons-chart-area"></span> |
| 84 |
<h4><?php esc_html_e( 'Real-time Analytics', 'atomic-edge-security' ); ?></h4> |
| 85 |
<p><?php esc_html_e( 'Monitor traffic, threats, and security events in real-time.', 'atomic-edge-security' ); ?></p> |
| 86 |
</div> |
| 87 |
<div class="atomicedge-feature"> |
| 88 |
<span class="dashicons dashicons-admin-network"></span> |
| 89 |
<h4><?php esc_html_e( 'Access Control', 'atomic-edge-security' ); ?></h4> |
| 90 |
<p><?php esc_html_e( 'Block or allow IPs and countries with ease.', 'atomic-edge-security' ); ?></p> |
| 91 |
</div> |
| 92 |
<div class="atomicedge-feature"> |
| 93 |
<span class="dashicons dashicons-search"></span> |
| 94 |
<h4><?php esc_html_e( 'Malware Scanner', 'atomic-edge-security' ); ?></h4> |
| 95 |
<p><?php esc_html_e( 'Scan your WordPress files for malware and modifications.', 'atomic-edge-security' ); ?></p> |
| 96 |
</div> |
| 97 |
</div> |
| 98 |
</div> |
| 99 |
</div> |
| 100 |
|
| 101 |
<?php else : ?> |
| 102 |
<div class="atomicedge-dashboard"> |
| 103 |
<div class="atomicedge-status-bar"> |
| 104 |
<div class="atomicedge-status atomicedge-status-connected"> |
| 105 |
<span class="dashicons dashicons-yes-alt"></span> |
| 106 |
<?php esc_html_e( 'Connected to Atomic Edge', 'atomic-edge-security' ); ?> |
| 107 |
</div> |
| 108 |
<?php if ( ! empty( $atomicedge_site_data['domain'] ) ) : ?> |
| 109 |
<div class="atomicedge-domain"> |
| 110 |
<strong><?php esc_html_e( 'Domain:', 'atomic-edge-security' ); ?></strong> |
| 111 |
<?php echo esc_html( $atomicedge_site_data['domain'] ); ?> |
| 112 |
</div> |
| 113 |
<?php endif; ?> |
| 114 |
<?php if ( ! empty( $atomicedge_site_data['plan'] ) ) : ?> |
| 115 |
<div class="atomicedge-plan"> |
| 116 |
<strong><?php esc_html_e( 'Plan:', 'atomic-edge-security' ); ?></strong> |
| 117 |
<?php echo esc_html( ucfirst( $atomicedge_site_data['plan'] ) ); ?> |
| 118 |
</div> |
| 119 |
<?php endif; ?> |
| 120 |
</div> |
| 121 |
|
| 122 |
<div class="atomicedge-dashboard-widgets"> |
| 123 |
<div class="atomicedge-widget atomicedge-widget-summary" id="atomicedge-summary-widget"> |
| 124 |
<h3><?php esc_html_e( 'Security Summary', 'atomic-edge-security' ); ?></h3> |
| 125 |
<div class="atomicedge-widget-content atomicedge-loading"> |
| 126 |
<span class="spinner is-active"></span> |
| 127 |
<?php esc_html_e( 'Loading...', 'atomic-edge-security' ); ?> |
| 128 |
</div> |
| 129 |
</div> |
| 130 |
|
| 131 |
<div class="atomicedge-widget atomicedge-widget-chart"> |
| 132 |
<h3><?php esc_html_e( 'Traffic (Last 24 Hours)', 'atomic-edge-security' ); ?></h3> |
| 133 |
<div class="atomicedge-widget-content"> |
| 134 |
<canvas id="atomicedge-traffic-chart"></canvas> |
| 135 |
</div> |
| 136 |
</div> |
| 137 |
|
| 138 |
<div class="atomicedge-widget atomicedge-widget-chart"> |
| 139 |
<h3><?php esc_html_e( 'Attacks Blocked (Last 24 Hours)', 'atomic-edge-security' ); ?></h3> |
| 140 |
<div class="atomicedge-widget-content"> |
| 141 |
<canvas id="atomicedge-attacks-chart"></canvas> |
| 142 |
</div> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
|
| 146 |
<div class="atomicedge-quick-actions"> |
| 147 |
<h3><?php esc_html_e( 'Quick Actions', 'atomic-edge-security' ); ?></h3> |
| 148 |
<div class="atomicedge-action-buttons"> |
| 149 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=atomicedge-analytics' ) ); ?>" class="button"> |
| 150 |
<span class="dashicons dashicons-chart-area"></span> |
| 151 |
<?php esc_html_e( 'Analytics', 'atomic-edge-security' ); ?> |
| 152 |
</a> |
| 153 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=atomicedge-waf-logs' ) ); ?>" class="button"> |
| 154 |
<span class="dashicons dashicons-shield"></span> |
| 155 |
<?php esc_html_e( 'WAF Logs', 'atomic-edge-security' ); ?> |
| 156 |
</a> |
| 157 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=atomicedge-access-control' ) ); ?>" class="button"> |
| 158 |
<span class="dashicons dashicons-admin-network"></span> |
| 159 |
<?php esc_html_e( 'Access Control', 'atomic-edge-security' ); ?> |
| 160 |
</a> |
| 161 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=atomicedge-scanner' ) ); ?>" class="button"> |
| 162 |
<span class="dashicons dashicons-search"></span> |
| 163 |
<?php esc_html_e( 'Malware Scanner', 'atomic-edge-security' ); ?> |
| 164 |
</a> |
| 165 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=atomicedge-vulnerabilities' ) ); ?>" class="button"> |
| 166 |
<span class="dashicons dashicons-shield-alt"></span> |
| 167 |
<?php esc_html_e( 'Vulnerability Scanner', 'atomic-edge-security' ); ?> |
| 168 |
</a> |
| 169 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=atomicedge-settings' ) ); ?>" class="button"> |
| 170 |
<span class="dashicons dashicons-admin-generic"></span> |
| 171 |
<?php esc_html_e( 'Settings', 'atomic-edge-security' ); ?> |
| 172 |
</a> |
| 173 |
</div> |
| 174 |
</div> |
| 175 |
</div> |
| 176 |
<?php endif; ?> |
| 177 |
</div> |
| 178 |
|