PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 2.1.0
WP 2FA – Two-factor authentication for WordPress v2.1.0
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / Admin / Views / class-settings-page-render.php
wp-2fa / includes / classes / Admin / Views Last commit date
FirstTimeWizardSteps.php 4 years ago WizardSteps.php 4 years ago class-settings-page-render.php 4 years ago
class-settings-page-render.php
169 lines
1 <?php
2 /**
3 * Settings page render class.
4 *
5 * @package wp2fa
6 * @copyright 2021 WP White Security
7 * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
8 * @link https://wordpress.org/plugins/wp-2fa/
9 */
10
11 namespace WP2FA\Admin\Views;
12
13 use \WP2FA\WP2FA;
14 use WP2FA\Admin\SettingsPages\{
15 Settings_Page_General,
16 Settings_Page_White_Label,
17 Settings_Page_Email
18 };
19
20 /**
21 * Settings_Page_Render - Class for rendering the plugin settings settings
22 *
23 * @since 2.0.0
24 */
25 class Settings_Page_Render {
26
27 /**
28 * Render the settings
29 */
30 public function render() {
31 if ( ! current_user_can( 'manage_options' ) ) {
32 return;
33 }
34
35 $user = wp_get_current_user();
36 if ( ! empty( WP2FA::get_wp2fa_setting( '2fa_settings_last_updated_by' ) ) ) {
37 $main_user = (int) WP2FA::get_wp2fa_setting( '2fa_settings_last_updated_by' );
38 } else {
39 $main_user = get_current_user_id();
40 }
41 ?>
42
43 <div class="wrap wp-2fa-settings-wrapper wp2fa-form-styles">
44 <h2><?php esc_html_e( 'WP 2FA Settings', 'wp-2fa' ); ?></h2>
45 <hr>
46 <?php if ( ! empty( WP2FA::get_wp2fa_general_setting( 'limit_access' ) ) && $main_user !== $user->ID ) : ?>
47 <?php
48 echo esc_html__( 'These settings have been disabled by your site administrator, please contact them for further assistance.', 'wp-2fa' );
49 ?>
50 <?php else : ?>
51 <?php do_action( 'wp2fa_before_plugin_settings' ); ?>
52 <div class="nav-tab-wrapper">
53 <a href="
54 <?php
55 echo esc_url(
56 add_query_arg(
57 array(
58 'page' => 'wp-2fa-settings',
59 'tab' => 'generic-settings',
60 ),
61 network_admin_url( 'admin.php' )
62 )
63 );
64 ?>
65 " class="nav-tab <?php echo ( ! isset( $_REQUEST['tab']) || isset( $_REQUEST['tab'] ) && 'generic-settings' === $_REQUEST['tab'] ) ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'General plugin settings', 'wp-2fa' ); // @codingStandardsIgnoreLine - No nonce verification warning?></a>
66 <a href="
67 <?php
68 echo esc_url(
69 add_query_arg(
70 array(
71 'page' => 'wp-2fa-settings',
72 'tab' => 'email-settings',
73 ),
74 network_admin_url( 'admin.php' )
75 )
76 );
77 ?>
78 " class="nav-tab <?php echo ( isset( $_REQUEST['tab'] ) && 'email-settings' === $_REQUEST['tab'] ) ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Email Settings & Templates', 'wp-2fa' ); // @codingStandardsIgnoreLine - No nonce verification warning?></a>
79 <a href="
80 <?php
81 echo esc_url(
82 add_query_arg(
83 array(
84 'page' => 'wp-2fa-settings',
85 'tab' => 'white-label-settings',
86 ),
87 network_admin_url( 'admin.php' )
88 )
89 );
90 ?>
91 " class="nav-tab <?php echo isset( $_REQUEST['tab'] ) && 'white-label-settings' === $_REQUEST['tab'] ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'White labeling', 'wp-2fa' ); // @codingStandardsIgnoreLine - No nonce verification warning?></a>
92 </div>
93 <?php
94 if ( WP2FA::is_this_multisite() ) {
95 $action = 'edit.php?action=update_wp2fa_network_options';
96 } else {
97 $action = 'options.php';
98 }
99 if ( ! isset( $_REQUEST['tab'] ) || isset( $_REQUEST['tab'] ) && 'generic-settings' === $_REQUEST['tab'] ) : // @codingStandardsIgnoreLine - No nonce verification warning
100 ?>
101 <br/>
102 <?php
103 printf(
104 '<p class="description">%1$s <a href="mailto:support@wpwhitesecurity.com">%2$s</a></p>',
105 esc_html__( 'Use the settings below to configure the properties of the two-factor authentication on your website and how users use it. If you have any questions send us an email at', 'wp-2fa' ),
106 esc_html__( 'support@wpwhitesecurity.com', 'wp-2fa' )
107 );
108 ?>
109 <br/>
110 <?php $total_users = count_users(); ?>
111 <form id="wp-2fa-admin-settings" action='<?php echo esc_attr( $action ); ?>' method='post' autocomplete="off" data-2fa-total-users="<?php echo esc_attr( $total_users['total_users'] ); ?>">
112 <?php
113 $settings_general = new Settings_Page_General();
114 $settings_general->render();
115 ?>
116 </form>
117 <?php endif; ?>
118 <?php
119 if ( isset( $_REQUEST['tab'] ) && 'white-label-settings' === $_REQUEST['tab'] ) : // @codingStandardsIgnoreLine - No nonce verification warning
120 ?>
121 <br/>
122 <?php
123 printf(
124 '<p class="description">%1$s <a href="mailto:support@wpwhitesecurity.com">%2$s</a></p>',
125 esc_html__( 'Use the settings below to configure the properties of the two-factor authentication on your website and how users use it. If you have any questions send us an email at', 'wp-2fa' ),
126 esc_html__( 'support@wpwhitesecurity.com', 'wp-2fa' )
127 );
128 ?>
129 <br/>
130 <?php $total_users = count_users(); ?>
131 <form id="wp-2fa-admin-settings" action='<?php echo esc_attr( $action ); ?>' method='post' autocomplete="off" data-2fa-total-users="<?php echo esc_attr( $total_users['total_users'] ); ?>">
132 <?php
133 $settings_white_label = new Settings_Page_White_Label();
134 $settings_white_label->render();
135 ?>
136 </form>
137 <?php endif; ?>
138
139 <?php
140 if ( WP2FA::is_this_multisite() ) {
141 $action = 'edit.php?action=update_wp2fa_network_email_options';
142 } else {
143 $action = 'options.php';
144 }
145 ?>
146
147 <?php if ( isset( $_REQUEST['tab'] ) && 'email-settings' === $_REQUEST['tab'] ) : // @codingStandardsIgnoreLine - No nonce verification warning?>
148 <br/>
149 <?php
150 printf(
151 '<p class="description">%1$s <a href="mailto:support@wpwhitesecurity.com">%2$s</a></p>',
152 esc_html__( 'Use the settings below to configure the emails which are sent to users as part of the 2FA plugin. If you have any questions send us an email at', 'wp-2fa' ),
153 esc_html__( 'support@wpwhitesecurity.com', 'wp-2fa' )
154 );
155 ?>
156 <br/>
157 <form action='<?php echo esc_attr( $action ); ?>' method='post' autocomplete="off">
158 <?php
159 $settings_email = new Settings_Page_Email();
160 $settings_email->render();
161 ?>
162 </form>
163 <?php endif; ?>
164 <?php endif; ?>
165 </div>
166 <?php
167 }
168 }
169