| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) |
| 3 |
exit; |
| 4 |
|
| 5 |
$license_key = berqwp_get_license_key(); |
| 6 |
$is_licensed = !empty($license_key); |
| 7 |
$updated = isset($_GET['updated']); |
| 8 |
?> |
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com"> |
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 11 |
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500&display=swap" rel="stylesheet"> |
| 12 |
<link rel="stylesheet" href="<?php echo esc_attr(optifer_URL . '/admin/css/style.css?v=' . BERQWP_VERSION); ?>"> |
| 13 |
|
| 14 |
<div class="wrap"> |
| 15 |
<h1>BerqWP Network Settings</h1> |
| 16 |
|
| 17 |
<?php if ($updated): ?> |
| 18 |
<div class="notice notice-success is-dismissible"> |
| 19 |
<p>Settings saved successfully.</p> |
| 20 |
</div> |
| 21 |
<?php endif; ?> |
| 22 |
|
| 23 |
<div style="max-width: 800px; margin-top: 20px;"> |
| 24 |
|
| 25 |
<!-- License Key Section --> |
| 26 |
<div class="card" style="padding: 20px; margin-bottom: 20px;"> |
| 27 |
<h2 style="margin-top: 0;">Network License Key</h2> |
| 28 |
<p>This license key will be shared across all sites in the network.</p> |
| 29 |
|
| 30 |
<form method="post" action="<?php echo esc_url(network_admin_url('edit.php?action=berqwp_network_save')); ?>"> |
| 31 |
<?php wp_nonce_field('berqwp_network_save'); ?> |
| 32 |
|
| 33 |
<?php if ($is_licensed): ?> |
| 34 |
<table class="form-table"> |
| 35 |
<tr> |
| 36 |
<th scope="row">License Key</th> |
| 37 |
<td> |
| 38 |
<code><?php echo esc_html(substr($license_key, 0, 8) . '...' . substr($license_key, -4)); ?></code> |
| 39 |
<span style="color: green; font-weight: bold; margin-left: 10px;">Active</span> |
| 40 |
</td> |
| 41 |
</tr> |
| 42 |
</table> |
| 43 |
<input type="hidden" name="berq_deactivate_key" value="1"> |
| 44 |
<p class="submit"> |
| 45 |
<input type="submit" class="button button-secondary" value="Deactivate License" onclick="return confirm('Are you sure you want to deactivate the license key for all sites?');"> |
| 46 |
</p> |
| 47 |
<?php else: ?> |
| 48 |
<table class="form-table"> |
| 49 |
<tr> |
| 50 |
<th scope="row"><label for="berqwp_license_key">License Key</label></th> |
| 51 |
<td> |
| 52 |
<input type="text" id="berqwp_license_key" name="berqwp_license_key" class="regular-text" placeholder="Enter your license key" required> |
| 53 |
</td> |
| 54 |
</tr> |
| 55 |
</table> |
| 56 |
<p class="submit"> |
| 57 |
<input type="submit" class="button button-primary" value="Activate License"> |
| 58 |
</p> |
| 59 |
<?php endif; ?> |
| 60 |
</form> |
| 61 |
</div> |
| 62 |
|
| 63 |
<!-- Cache Management Section --> |
| 64 |
<div class="card" style="padding: 20px; margin-bottom: 20px;"> |
| 65 |
<h2 style="margin-top: 0;">Network Cache Management</h2> |
| 66 |
<p>Flush the page cache for all sites in the network.</p> |
| 67 |
|
| 68 |
<form method="post" action="<?php echo esc_url(network_admin_url('edit.php?action=berqwp_network_save')); ?>"> |
| 69 |
<?php wp_nonce_field('berqwp_network_save'); ?> |
| 70 |
<input type="hidden" name="berqwp_flush_all_cache" value="1"> |
| 71 |
<p class="submit"> |
| 72 |
<input type="submit" class="button button-secondary" value="Flush All Sites Cache" onclick="return confirm('This will flush the cache for all sites in the network. Continue?');"> |
| 73 |
</p> |
| 74 |
</form> |
| 75 |
</div> |
| 76 |
|
| 77 |
<!-- Sites Overview --> |
| 78 |
<div class="card" style="padding: 20px;"> |
| 79 |
<h2 style="margin-top: 0;">Network Sites</h2> |
| 80 |
<p>Each site has its own settings page. Visit individual site dashboards to configure per-site settings.</p> |
| 81 |
|
| 82 |
<table class="wp-list-table widefat fixed striped"> |
| 83 |
<thead> |
| 84 |
<tr> |
| 85 |
<th>Site</th> |
| 86 |
<th>URL</th> |
| 87 |
<th>Actions</th> |
| 88 |
</tr> |
| 89 |
</thead> |
| 90 |
<tbody> |
| 91 |
<?php |
| 92 |
$sites = get_sites(['number' => 100]); |
| 93 |
foreach ($sites as $site): |
| 94 |
$site_details = get_blog_details($site->blog_id); |
| 95 |
$site_url = get_site_url($site->blog_id); |
| 96 |
$admin_url = get_admin_url($site->blog_id, 'admin.php?page=berqwp'); |
| 97 |
?> |
| 98 |
<tr> |
| 99 |
<td><?php echo esc_html($site_details->blogname); ?></td> |
| 100 |
<td><a href="<?php echo esc_url($site_url); ?>" target="_blank"><?php echo esc_html($site_url); ?></a></td> |
| 101 |
<td><a href="<?php echo esc_url($admin_url); ?>" class="button button-small">Settings</a></td> |
| 102 |
</tr> |
| 103 |
<?php endforeach; ?> |
| 104 |
</tbody> |
| 105 |
</table> |
| 106 |
</div> |
| 107 |
|
| 108 |
</div> |
| 109 |
</div> |
| 110 |
|