PluginProbe
Patchstack – WordPress & Plugins Security / 2.2.7
Patchstack – WordPress & Plugins Security v2.2.7
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / includes / views / pages / settings.php

settings.php in Patchstack – WordPress & Plugins Security 2.2.7, at includes/views/pages/settings.php

155 lines 7.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Do not allow the file to be called directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 // Determine the active tab and account activation state.
9 $tabs = [ 'hardening', 'firewall', 'login', 'cookienotice', 'logs', 'license', 'multisite' ];
10 $active_tab = isset( $_GET['tab'] ) && in_array( $_GET['tab'], $tabs ) ? esc_attr( $_GET['tab'] ) : 'license'; // default active tab
11 $activated = ( ( isset( $_GET['ps_activated'] ) && $_GET['ps_activated'] == 1 ) || ( isset( $_GET['active'] ) && $_GET['active'] == 1 ) );
12 $status = ( get_option( 'patchstack_license_expiry', '' ) == '' || time() >= strtotime( get_option( 'patchstack_license_expiry', '' ) ) );
13 $show_settings = $this->get_option( 'patchstack_show_settings', 0 ) == 1 && !isset($_GET['tab']) || isset($_GET['tab']) && $_GET['tab'] != 'license';
14 $is_free = $this->get_option( 'patchstack_license_free', 0 ) == 1;
15 $class = get_option( 'patchstack_subscription_class', '' );
16 $managed = get_option( 'patchstack_managed', false );
17 $managed_text = get_option( 'patchstack_managed_text', '' );
18
19 if ( ( ! $show_settings && $_GET['page'] != 'patchstack-multisite-settings' ) || ( $status && $active_tab != 'license' && $_GET['page'] != 'patchstack-multisite-settings' ) ) {
20 $_GET['tab'] = $active_tab = 'license';
21 }
22
23 if ( ( $is_free || ! $is_free && $status ) && $active_tab != 'license' && $_GET['page'] == 'patchstack-multisite-settings' ) {
24 $_GET['tab'] = $active_tab = 'multisite';
25 }
26
27 if ($active_tab == 'license') {
28 $show_settings = false;
29 }
30
31 // Determine the URL's.
32 $page = $_GET['page'] == 'patchstack-multisite-settings' ? 'patchstack-multisite-settings' : $this->plugin->name;
33 ?>
34 <div class="patchstack-content-wrap<?php echo ( ! $show_settings || $this->get_option( 'patchstack_license_free', 0 ) == 1 ? ' patchstack-free' : '' ); ?>">
35 <div class="patchstack-top">
36 <div class="patchstack-top-logo"
37 <?php
38 if ( $show_settings && $this->get_option( 'patchstack_license_free', 0 ) == 1 ) {
39 echo ' style="float: right; width: 80%; margin-right: -15px;"';
40 }
41 ?>
42 >
43 <img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/logo.svg" alt="">
44 </div>
45 <h1 <?php echo $show_settings || !$managed ? 'style="display: none;"' : ''; ?>>
46 <?php echo $managed_text; ?>
47 </h1>
48 <?php
49 if ( $_GET['page'] != 'patchstack-multisite-settings' && $show_settings && is_multisite() ) {
50 $site_info = get_blog_details();
51 echo "<h2 style='color:white;padding-left: 95px; margin-top: -12px; margin-left: 150px;'>" . esc_html( $site_info->domain ) . '</h2>';
52 }
53 ?>
54 </div>
55
56 <div class="patchstack-content-table">
57 <?php
58 if ( is_multisite() && $show_settings ) {
59 ?>
60 <div class="notice notice-warning">
61 <p>
62 <?php
63 if ( isset( $_GET['page'] ) && $_GET['page'] == 'patchstack-multisite-settings' ) {
64 _e( 'Note that because this is a multisite/network environment, this settings page will define all default settings of all sites.<br />If you would like to change the settings of a specific site, visit the administration panel of the site in question. Click <a href="' . network_admin_url( 'admin.php?page=patchstack-multisite' ) . '">here</a> for an overview of sites.', 'patchstack' );
65 } else {
66 _e( 'Note that because this is a multisite/network environment, certain settings can only be managed by the super administrator of the WordPress network.', 'patchstack' );
67 }
68 ?>
69 </p>
70 </div><br />
71 <?php } ?>
72 <h2 class="nav-tab-wrapper patchstack-nav-tab-wrapper"
73 <?php
74 if ( ! $show_settings ) {
75 echo ' style="display: none;"'; }
76 ?>
77 >
78 <?php if ( $class >= 1 || $class === '' ) { ?>
79 <a href="?page=<?php echo esc_attr( $page ); ?>&tab=hardening" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'hardening' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>">
80 <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-services white"></span></span>
81 <span class="patchstack-icon-text"><?php echo __( 'Hardening', 'patchstack' ); ?><br /><span>General Security Tweaks</span></span>
82 </a>
83 <?php } ?>
84
85 <a href="?page=<?php echo esc_attr( $page ); ?>&tab=firewall" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'firewall' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>">
86 <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-firewall white"></span></span>
87 <span class="patchstack-icon-text"><?php echo __( 'Firewall', 'patchstack' ); ?><br /><span>Whitelist & Blacklist & Firewall</span></span>
88 </a>
89
90 <?php if ( $class >= 1 || $class === '' ) { ?>
91 <a href="?page=<?php echo esc_attr( $page ); ?>&tab=login" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'login' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>">
92 <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-login white"></span></span>
93 <span class="patchstack-icon-text"><?php echo __( 'Login Protection', 'patchstack' ); ?><br /><span>Protect your login page</span></span>
94 </a>
95 <?php } ?>
96
97 <?php if ( $class >= 1 || $class === '' ) { ?>
98 <a href="?page=<?php echo esc_attr( $page ); ?>&tab=cookienotice" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'cookienotice' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>">
99 <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-cookies white"></span></span>
100 <span class="patchstack-icon-text"><?php echo __( 'Cookie Notice', 'patchstack' ); ?><br /><span>Inform your users</span></span>
101 </a>
102 <?php } ?>
103
104 <?php if ( $page != 'patchstack-multisite-settings' ) { ?>
105 <a href="?page=<?php echo esc_attr( $page ); ?>&tab=logs" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>">
106 <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-logs white"></span></span>
107 <span class="patchstack-icon-text"><?php echo __( 'Logs', 'patchstack' ); ?><br /><span>Firewall &amp; Activity Logs</span></span>
108 </a>
109 <?php } ?>
110
111 <?php if ( ! is_multisite() || ( isset( $_GET['page'] ) && $_GET['page'] != 'patchstack-multisite-settings' ) ) { ?>
112 <a href="?page=<?php echo esc_attr( $page ); ?>&tab=license" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'license' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>">
113 <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-license white"></span></span>
114 <span class="patchstack-icon-text"><?php echo __( 'License', 'patchstack' ); ?><br /><span>Your license information</span></span>
115 </a>
116 <?php } ?>
117 </h2>
118 <div class="patchstack-content-inner patchstack-active-tab-<?php echo esc_attr( $active_tab ); ?> <?php echo ! $show_settings && $this->get_option( 'patchstack_license_free', 0 ) == 0 ? 'patchstack-premium' : ''; ?>">
119 <?php
120 if ( $status && $_GET['page'] != 'patchstack-multisite-settings' ) {
121 require 'license.php';
122 } else {
123 $form_action = is_multisite() ? '' : 'options.php';
124 switch ( $active_tab ) {
125 case 'hardening':
126 require 'hardening.php';
127 break;
128 case 'firewall':
129 require 'firewall.php';
130 break;
131 case 'login':
132 require 'login.php';
133 break;
134 case 'cookienotice':
135 require 'cookie-notice.php';
136 break;
137 case 'logs':
138 require 'logs.php';
139 break;
140 case 'license':
141 require 'license.php';
142 break;
143 case 'multisite':
144 require 'multisite-activation.php';
145 break;
146 default:
147 require 'license.php';
148 break;
149 }
150 }
151 ?>
152 </div>
153 </div>
154 </div>
155