PluginProbe
GD Security Headers / trunk
GD Security Headers vtrunk
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 / tools.php

tools.php in GD Security Headers trunk, at forms/tools.php

128 lines 4.9 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' => __( 'Tools Index', 'gd-security-headers' ),
10 'icon' => 'wrench',
11 'info' => __( 'All plugin tools are split into several panels, and you can access each starting from the right.', 'gd-security-headers' ),
12 ),
13 );
14
15 if ( gdsih_scope()->is_master_network_admin() ) {
16 $panels['reportslog'] = array(
17 'title' => __( 'Reports Logs Cleanup', 'gd-security-headers' ),
18 'icon' => 'trash-o',
19 'break' => __( 'Cleanup', 'gd-security-headers' ),
20 'button' => 'submit',
21 'button_text' => 'Clean Log',
22 'info' => __( 'Remove old reports from CSP and XXP reports logs.', 'gd-security-headers' ),
23 );
24 $panels['recheck'] = array(
25 'title' => __( 'Recheck and Update', 'gd-security-headers' ),
26 'icon' => 'refresh',
27 'break' => __( 'Maintenance', 'gd-security-headers' ),
28 'button' => 'none',
29 'button_text' => '',
30 'info' => __( 'Recheck plugin database tables, check for new templates and clean cache.', 'gd-security-headers' ),
31 );
32 $panels['export'] = array(
33 'title' => __( 'Export Settings', 'gd-security-headers' ),
34 'icon' => 'download',
35 'button' => 'button',
36 'button_text' => __( 'Export', 'gd-security-headers' ),
37 'info' => __( 'Export all plugin settings into file.', 'gd-security-headers' ),
38 );
39 $panels['import'] = array(
40 'title' => __( 'Import Settings', 'gd-security-headers' ),
41 'icon' => 'upload',
42 'button' => 'submit',
43 'button_text' => __( 'Import', 'gd-security-headers' ),
44 'info' => __( 'Import all plugin settings from export file.', 'gd-security-headers' ),
45 );
46 $panels['remove'] = array(
47 'title' => __( 'Reset / Remove', 'gd-security-headers' ),
48 'icon' => 'remove',
49 'button' => 'submit',
50 'button_text' => __( 'Remove', 'gd-security-headers' ),
51 'info' => __( 'Remove selected plugin settings, database tables and optionally disable plugin.', 'gd-security-headers' ),
52 );
53 }
54
55 include( GDSIH_PATH . 'forms/shared/top.php' );
56
57 ?>
58
59 <form method="post" action="" enctype="multipart/form-data" id="gdsih-tools-form">
60 <?php settings_fields( 'gd-security-headers-tools' ); ?>
61 <input type="hidden" value="<?php echo $_panel; ?>" name="gdsihtools[panel]"/>
62 <input type="hidden" value="postback" name="gdsih_handler"/>
63
64 <div class="d4p-content-left">
65 <div class="d4p-panel-scroller d4p-scroll-active">
66 <div class="d4p-panel-title">
67 <i aria-hidden="true" class="fa fa-wrench"></i>
68 <h3><?php esc_html_e( 'Tools', 'gd-security-headers' ); ?></h3>
69 <?php if ( $_panel != 'index' ) { ?>
70 <h4><i aria-hidden="true" class="fa fa-<?php echo $panels[ $_panel ]['icon']; ?>"></i> <?php echo $panels[ $_panel ]['title']; ?></h4>
71 <?php } ?>
72 </div>
73 <div class="d4p-panel-info">
74 <?php echo $panels[ $_panel ]['info']; ?>
75 </div>
76 <?php if ( $_panel != 'index' && $panels[ $_panel ]['button'] != 'none' ) { ?>
77 <div class="d4p-panel-buttons">
78 <input id="gdsih-tool-<?php echo $_panel; ?>" class="button-primary" type="<?php echo $panels[ $_panel ]['button']; ?>" value="<?php echo $panels[ $_panel ]['button_text']; ?>"/>
79 </div>
80 <?php } ?>
81 <div class="d4p-return-to-top">
82 <a href="#wpwrap"><?php esc_html_e( 'Return to top', 'gd-security-headers' ); ?></a>
83 </div>
84 </div>
85 </div>
86 <div class="d4p-content-right">
87 <?php
88
89 if ( $_panel == 'index' ) {
90 foreach ( $panels as $panel => $obj ) {
91 if ( $panel == 'index' ) {
92 continue;
93 }
94
95 $url = 'admin.php?page=gd-security-headers-' . $_page . '&panel=' . $panel;
96
97 if ( isset( $obj['break'] ) ) { ?>
98
99 <div style="clear: both"></div>
100 <div class="d4p-panel-break d4p-clearfix">
101 <h4><?php echo $obj['break']; ?></h4>
102 </div>
103 <div style="clear: both"></div>
104
105 <?php } ?>
106
107 <div class="d4p-options-panel">
108 <i aria-hidden="true" class="fa fa-<?php echo $obj['icon']; ?>"></i>
109 <h5><?php echo $obj['title']; ?></h5>
110 <div>
111 <a class="button-primary" href="<?php echo $url; ?>"><?php esc_html_e( 'Tools Panel', 'gd-security-headers' ); ?></a>
112 </div>
113 </div>
114
115 <?php
116 }
117 } else {
118 include( GDSIH_PATH . 'forms/tools/' . $_panel . '.php' );
119 }
120
121 ?>
122 </div>
123 </form>
124
125 <?php
126
127 include( GDSIH_PATH . 'forms/shared/bottom.php' );
128