PluginProbe
GD Security Headers / 1.9
GD Security Headers v1.9
trunk 1.0 1.1 1.1.1 1.2 1.3 1.4 1.5 1.6 1.6.1 1.7 1.7.1 1.8 1.9
gd-security-headers / forms / settings.php

settings.php in GD Security Headers 1.9, at forms/settings.php

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