| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { exit; } |
| 4 |
|
| 5 |
$panels = array( |
| 6 |
'index' => array( |
| 7 |
'title' => __("Settings Index", "gd-security-headers"), 'icon' => 'cogs', 'scope' => 'network', |
| 8 |
'info' => __("All plugin settings are split into panels, and you access each starting from the right.", "gd-security-headers")) |
| 9 |
); |
| 10 |
|
| 11 |
if (gdsih_scope()->is_master_network_admin()) { |
| 12 |
$panels['global'] = array( |
| 13 |
'title' => __("Global", "gd-security-headers"), 'icon' => 'cog', 'scope' => 'network', |
| 14 |
'break' => __("Basic", "gd-security-headers"), |
| 15 |
'info' => __("From this panel you control global, common plugin settings.", "gd-security-headers")); |
| 16 |
$panels['csp'] = array( |
| 17 |
'title' => __("Content Security Policy", "gd-security-headers"), 'icon' => 'flag', 'scope' => 'network', |
| 18 |
'break' => __("Headers", "gd-security-headers"), |
| 19 |
'info' => __("From this panel you control CSP settings.", "gd-security-headers")); |
| 20 |
$panels['xxp'] = array( |
| 21 |
'title' => __("X XSS Protection", "gd-security-headers"), 'icon' => 'window-close', 'scope' => 'network', |
| 22 |
'info' => __("From this panel you control XXP settings.", "gd-security-headers")); |
| 23 |
$panels['feature'] = array( |
| 24 |
'title' => __("Feature Policy", "gd-security-headers"), 'icon' => 'cubes', 'scope' => 'network', |
| 25 |
'info' => __("From this panel you control Feature Policy header settings.", "gd-security-headers")); |
| 26 |
$panels['msh'] = array( |
| 27 |
'title' => __("More Headers", "gd-security-headers"), 'icon' => 'tags', 'scope' => 'network', |
| 28 |
'info' => __("From this panel you control other security headers settings.", "gd-security-headers")); |
| 29 |
} |
| 30 |
|
| 31 |
include(GDSIH_PATH.'forms/shared/top.php'); |
| 32 |
|
| 33 |
$scope = is_multisite() ? gdsih_scope()->get_scope() : $panels[$_panel]['scope']; |
| 34 |
|
| 35 |
?> |
| 36 |
|
| 37 |
<form method="post" action="" autocomplete="off"> |
| 38 |
<?php settings_fields('gd-security-headers-settings'); ?> |
| 39 |
<input type="hidden" value="postback" name="gdsih_handler" /> |
| 40 |
<input type="hidden" value="<?php echo $scope; ?>" name="gdsih_scope" /> |
| 41 |
|
| 42 |
<div class="d4p-content-left"> |
| 43 |
<div class="d4p-panel-scroller d4p-scroll-active"> |
| 44 |
<div class="d4p-panel-title"> |
| 45 |
<i aria-hidden="true" class="fa fa-cogs"></i> |
| 46 |
<h3><?php _e("Settings", "gd-security-headers"); ?></h3> |
| 47 |
<?php if ($_panel != 'index') { ?> |
| 48 |
<h4><i aria-hidden="true" class="fa fa-<?php echo $panels[$_panel]['icon']; ?>"></i> <?php echo $panels[$_panel]['title']; ?></h4> |
| 49 |
<?php } ?> |
| 50 |
</div> |
| 51 |
<div class="d4p-panel-info"> |
| 52 |
<?php echo $panels[$_panel]['info']; ?> |
| 53 |
</div> |
| 54 |
<?php if ($_panel != 'index') { ?> |
| 55 |
<div class="d4p-panel-buttons"> |
| 56 |
<input type="submit" value="<?php _e("Save Settings", "gd-security-headers"); ?>" class="button-primary"> |
| 57 |
</div> |
| 58 |
<?php } ?> |
| 59 |
<div class="d4p-return-to-top"> |
| 60 |
<a href="#wpwrap"><?php _e("Return to top", "gd-security-headers"); ?></a> |
| 61 |
</div> |
| 62 |
</div> |
| 63 |
</div> |
| 64 |
<div class="d4p-content-right"> |
| 65 |
<?php |
| 66 |
|
| 67 |
if ($_panel == 'index') { |
| 68 |
foreach ($panels as $panel => $obj) { |
| 69 |
if ($panel == 'index') continue; |
| 70 |
|
| 71 |
$url = 'admin.php?page=gd-security-headers-'.$_page.'&panel='.$panel; |
| 72 |
|
| 73 |
if (isset($obj['break'])) { ?> |
| 74 |
|
| 75 |
<div style="clear: both"></div> |
| 76 |
<div class="d4p-panel-break d4p-clearfix"> |
| 77 |
<h4><?php echo $obj['break']; ?></h4> |
| 78 |
</div> |
| 79 |
<div style="clear: both"></div> |
| 80 |
|
| 81 |
<?php } ?> |
| 82 |
|
| 83 |
<div class="d4p-options-panel"> |
| 84 |
<i aria-hidden="true" class="fa fa-<?php echo $obj['icon']; ?>"></i> |
| 85 |
<h5><?php echo $obj['title']; ?></h5> |
| 86 |
<div> |
| 87 |
<?php if (isset($obj['type'])) { ?> |
| 88 |
<span><?php echo $obj['type']; ?></span> |
| 89 |
<?php } ?> |
| 90 |
<a class="button-primary" href="<?php echo $url; ?>"><?php _e("Settings Panel", "gd-security-headers"); ?></a> |
| 91 |
</div> |
| 92 |
</div> |
| 93 |
|
| 94 |
<?php if (isset($obj['break_next'])) { ?> |
| 95 |
|
| 96 |
<div style="clear: both"></div> |
| 97 |
<div class="d4p-panel-break d4p-clearfix"> |
| 98 |
<h4><?php echo $obj['break_next']; ?></h4> |
| 99 |
</div> |
| 100 |
<div style="clear: both"></div> |
| 101 |
|
| 102 |
<?php } |
| 103 |
} |
| 104 |
} else { |
| 105 |
d4p_includes(array( |
| 106 |
array('name' => 'settings', 'directory' => 'admin'), |
| 107 |
array('name' => 'walkers', 'directory' => 'admin'), |
| 108 |
array('name' => 'functions', 'directory' => 'admin') |
| 109 |
), GDSIH_D4PLIB); |
| 110 |
|
| 111 |
include(GDSIH_PATH.'core/admin/options.php'); |
| 112 |
|
| 113 |
$options = new gdsih_admin_settings(); |
| 114 |
|
| 115 |
$panel = gdsih_admin()->panel; |
| 116 |
$groups = $options->get($panel); |
| 117 |
|
| 118 |
$render = new d4pSettingsRender($panel, $groups); |
| 119 |
$render->base = 'gdsihvalue'; |
| 120 |
$render->render(); |
| 121 |
} |
| 122 |
|
| 123 |
?> |
| 124 |
</div> |
| 125 |
</form> |
| 126 |
|
| 127 |
<?php |
| 128 |
|
| 129 |
include(GDSIH_PATH.'forms/shared/bottom.php'); |
| 130 |
|