PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 2.4.0
WP 2FA – Two-factor authentication for WordPress v2.4.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 / class-help-contact-us.php
wp-2fa / includes / classes / Admin Last commit date
Controllers 3 years ago Helpers 3 years ago SettingsPages 3 years ago Views 3 years ago class-help-contact-us.php 3 years ago class-premium-features.php 3 years ago class-settings-page.php 3 years ago class-settingspage.php 3 years ago class-setup-wizard.php 3 years ago class-user-listing.php 3 years ago class-user-notices.php 3 years ago class-user-profile.php 3 years ago class-user-registered.php 3 years ago class-user.php 3 years ago index.php 5 years ago
class-help-contact-us.php
446 lines
1 <?php
2 /**
3 * Contact us and help rendering class.
4 *
5 * @package wp2fa
6 * @subpackage admin
7 * @copyright 2023 WP White Security
8 * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
9 * @link https://wordpress.org/plugins/wp-2fa/
10 * @since 2.0.0
11 */
12
13 namespace WP2FA\Admin;
14
15 use \WP2FA\Admin\Settings_Page;
16 use WP2FA\Admin\Helpers\WP_Helper;
17
18 /**
19 * Handles contact us tab and content.
20 */
21 class Help_Contact_Us {
22
23 const TOP_MENU_SLUG = 'wp-2fa-help-contact-us';
24
25 /**
26 * Create admin menu entry and settings page
27 */
28 public static function add_extra_menu_item() {
29 add_submenu_page(
30 Settings_Page::TOP_MENU_SLUG,
31 esc_html__( 'Help & Contact Us', 'wp-2fa' ),
32 esc_html__( 'Help & Contact Us', 'wp-2fa' ),
33 'manage_options',
34 self::TOP_MENU_SLUG,
35 array( __CLASS__, 'render' ),
36 100
37 );
38 }
39
40 /**
41 * Handles rendering the help tabs and their wrapping element.
42 *
43 * @return void
44 */
45 public static function render() {
46 ?>
47 <div class="wrap help-wrap">
48 <div class="page-head">
49 <h2><?php esc_html_e( 'Help', 'wp-2fa' ); ?></h2>
50 </div>
51 <div class="nav-tab-wrapper">
52 <?php
53 // Get current tab.
54 $current_tab = isset( $_GET['tab'] ) ? \wp_unslash( $_GET['tab'] ) : 'help'; // phpcs:ignore
55 ?>
56 <a href="<?php echo esc_url( remove_query_arg( 'tab' ) ); ?>" class="nav-tab<?php echo 'help' === $current_tab ? ' nav-tab-active' : ''; ?>"><?php esc_html_e( 'Help', 'wp-2fa' ); ?></a>
57 <a href="<?php echo esc_url( add_query_arg( 'tab', 'system-info' ) ); ?>" class="nav-tab<?php echo 'system-info' === $current_tab ? ' nav-tab-active' : ''; ?>"><?php esc_html_e( 'System info', 'wp-2fa' ); ?></a>
58 </div>
59 <div class="wp2fa-help-section nav-tabs">
60 <?php
61 self::sidebar();
62 if ( 'help' === $current_tab ) {
63 self::help();
64 } elseif ( 'system-info' === $current_tab ) {
65 self::system_info();
66 }
67 ?>
68 </div>
69 </div>
70 <?php
71 }
72
73 /**
74 * Help tab content.
75 *
76 * @return void
77 */
78 public static function help() {
79 ?>
80 <div class="wp2fa-help-main">
81 <!-- getting started -->
82 <div class="title">
83 <h2><?php esc_html_e( 'Getting started', 'wp-2fa' ); ?></h2>
84 </div>
85 <p><?php esc_html_e( 'Getting started with WP 2FA and making 2FA compulsory is as easy as 1 2 3 with WP 2FA. This can be easily done through the install wizard or the plugin settings. If you are stuck, no problem! Below are a few links of guides to help you get started:', 'wp-2fa' ); ?></p>
86 <ul>
87 <li><?php echo wp_sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url( 'https://wp2fa.io/support/kb/getting-started-wp-2fa-plugin/?utm_source=plugin&utm_medium=referral&utm_campaign=WP2FA&utm_content=help+page' ), esc_html__( 'Getting started with WP 2FA', 'wp-2fa' ) ); ?></li>
88 <li><?php echo wp_sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url( 'https://wp2fa.io/support/kb/configure-2fa-policies-enforce/?utm_source=plugin&utm_medium=referral&utm_campaign=WP2FA&utm_content=help+page' ), esc_html__( 'Configuring 2FA policies & making 2FA mandatory', 'wp-2fa' ) ); ?></li>
89 <li><?php echo wp_sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url( 'https://wp2fa.io/support/kb/configure-2fa-front-end-page-wordpress/?utm_source=plugin&utm_medium=referral&utm_campaign=WP2FA&utm_content=help+page' ), esc_html__( 'Allowing users to configure 2FA from a website page (no dashboard access)', 'wp-2fa' ) ); ?></li>
90 </ul>
91 <!-- End -->
92 <br>
93 <p><iframe title="<?php esc_html_e( 'Getting started', 'wp-2fa' ); ?>" class="wsal-youtube-embed" width="100%" height="315" src="https://www.youtube.com/embed/vRlX_NNGeFo" frameborder="0" allowfullscreen></iframe></p>
94
95 <!-- Plugin documentation -->
96 <div class="title">
97 <h2><?php esc_html_e( 'Plugin documentation', 'wp-2fa' ); ?></h2>
98 </div>
99 <p><?php esc_html_e( 'For more technical information about the WP 2FA plugin please visit the plugin\'s knowledge base.', 'wp-2fa' ); ?></p>
100 <div class="btn">
101 <a href="<?php echo esc_url( 'https://wp2fa.io/support/kb/?utm_source=plugin&utm_medium=referral&utm_campaign=WP2FA&utm_content=help+page' ); ?>" class="button" target="_blank"><?php esc_html_e( 'Knowledge base', 'wp-2fa' ); ?></a>
102 </div>
103 <!-- End -->
104
105 <!-- Plugin support -->
106 <div class="title">
107 <h2><?php esc_html_e( 'Plugin support', 'wp-2fa' ); ?></h2>
108 </div>
109 <p><?php esc_html_e( 'Do you need assistance with the plugin? Have you noticed or encountered an issue while using WP 2FA, or do you just want to report something to us?', 'wp-2fa' ); ?></p>
110 <div class="btn">
111 <a href="<?php echo esc_url( 'https://wp2fa.io/support/submit-ticket/?utm_source=plugin&utm_medium=referral&utm_campaign=WP2FA&utm_content=help+page' ); ?>" class="button" target="_blank"><?php esc_html_e( 'Open support ticket', 'wp-2fa' ); ?></a>
112 <a href="<?php echo esc_url( 'https://www.wpwhitesecurity.com/contact-wp-white-security/?utm_source=plugin&utm_medium=referral&utm_campaign=WP2FA&utm_content=help+page' ); ?>" class="button" target="_blank"><?php esc_html_e( 'Contact us', 'wp-2fa' ); ?></a>
113 </div>
114 <!-- End -->
115 </div>
116 <?php
117 }
118
119 /**
120 * System info tab content.
121 *
122 * @return void
123 */
124 public static function system_info() {
125 ?>
126 <div class="wp2fa-help-main">
127 <!-- getting started -->
128 <div class="title">
129 <h2><?php esc_html_e( 'System information', 'wp-2fa' ); ?></h2>
130 </div>
131 <form method="post" dir="ltr">
132 <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="wsal-sysinfo"><?php echo self::get_sysinfo(); // phpcs:ignore ?></textarea>
133 <p class="submit">
134 <input type="hidden" name="ppmwp-action" value="download_sysinfo" />
135 <?php submit_button( 'Download System Info File', 'primary', 'wp2fa-download-sysinfo', false ); ?>
136 </p>
137 </form>
138 <script>
139
140 function download(filename, text) {
141 // Create temporary element.
142 var element = document.createElement('a');
143 element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
144 element.setAttribute('download', filename);
145
146 // Set the element to not display.
147 element.style.display = 'none';
148 document.body.appendChild(element);
149
150 // Simlate click on the element.
151 element.click();
152
153 // Remove temporary element.
154 document.body.removeChild(element);
155 }
156 jQuery( document ).ready( function() {
157 var download_btn = jQuery( '#wp2fa-download-sysinfo' );
158 download_btn.click( function( event ) {
159 event.preventDefault();
160 download( 'wp2fa-system-info.txt', jQuery( '#system-info-textarea' ).val() );
161 } );
162 } );
163 </script>
164 </div>
165 <?php
166 }
167
168 /**
169 * Advertising sidebar.
170 *
171 * @return void
172 */
173 public static function sidebar() {
174 ?>
175 <div class="our-wordpress-plugins side-bar">
176 <h3><?php esc_html_e( 'Our WordPress Plugins', 'wp-2fa' ); ?></h3>
177 <ul>
178 <li>
179 <div class="plugin-box">
180 <div class="plugin-img">
181 <img src="<?php echo WP_2FA_URL; // phpcs:ignore ?>dist/images/wp-security-audit-log-img.jpg" alt="">
182 </div>
183 <div class="plugin-desc">
184 <p><?php esc_html_e( 'Keep a log of users and under the hood site activity.', 'wp-2fa' ); ?></p>
185 <div class="cta-btn">
186 <a href="
187 <?php
188 echo esc_url(
189 add_query_arg(
190 array(
191 'utm_source' => 'plugin',
192 'utm_medium' => 'referral',
193 'utm_campaign' => 'WSAL',
194 'utm_content' => 'WP2FA+banner',
195 ),
196 'https://wpactivitylog.com'
197 )
198 );
199 ?>
200 " target="_blank"><?php esc_html_e( 'LEARN MORE', 'wp-2fa' ); ?></a>
201 </div>
202 </div>
203 </div>
204 </li>
205 <li>
206 <div class="plugin-box">
207 <div class="plugin-img">
208 <img src="<?php echo WP_2FA_URL; // phpcs:ignore ?>dist/images/wp-password-img.jpg" alt="">
209 </div>
210 <div class="plugin-desc">
211 <p><?php esc_html_e( 'Enforce strong password policies on WordPress.', 'wp-2fa' ); ?></p>
212 <div class="cta-btn">
213 <a href="
214 <?php
215 echo esc_url(
216 add_query_arg(
217 array(
218 'utm_source' => 'plugin',
219 'utm_medium' => 'referral',
220 'utm_campaign' => 'WSAL',
221 'utm_content' => 'WP2FA+banner',
222 ),
223 'https://www.wpwhitesecurity.com/wordpress-plugins/password-security/'
224 )
225 );
226 ?>
227 " target="_blank"><?php esc_html_e( 'LEARN MORE', 'wp-2fa' ); ?></a>
228 </div>
229 </div>
230 </div>
231 </li>
232 <li>
233 <div class="plugin-box">
234 <div class="plugin-img">
235 <img src="<?php echo WP_2FA_URL; // phpcs:ignore ?>dist/images/website-file-changes-monitor.jpg" alt="">
236 </div>
237 <div class="plugin-desc">
238 <p><?php esc_html_e( 'Automatically identify unauthorized file changes on your WordPress site.', 'wp-2fa' ); ?></p>
239 <div class="cta-btn">
240 <a href="
241 <?php
242 echo esc_url(
243 add_query_arg(
244 array(
245 'utm_source' => 'plugin',
246 'utm_medium' => 'referral',
247 'utm_campaign' => 'WSAL',
248 'utm_content' => 'WP2FA+banner',
249 ),
250 'https://www.wpwhitesecurity.com/wordpress-plugins/website-file-changes-monitor/'
251 )
252 );
253 ?>
254 " target="_blank"><?php esc_html_e( 'LEARN MORE', 'wp-2fa' ); ?></a>
255 </div>
256 </div>
257 </div>
258 </li>
259 <li>
260 <div class="plugin-box">
261 <div class="plugin-img">
262 <img src="<?php echo WP_2FA_URL; // phpcs:ignore ?>dist/images/c4wp.jpg" alt="">
263 </div>
264 <div class="plugin-desc">
265 <p><?php esc_html_e( 'Protect website forms & login pages from spam bots & automated attacks.', 'wp-2fa' ); ?></p>
266 <div class="cta-btn">
267 <a href="
268 <?php
269 echo esc_url(
270 add_query_arg(
271 array(
272 'utm_source' => 'plugin',
273 'utm_medium' => 'referral',
274 'utm_campaign' => 'WSAL',
275 'utm_content' => 'WP2FA+banner',
276 ),
277 'https://www.wpwhitesecurity.com/wordpress-plugins/captcha-plugin-wordpress/'
278 )
279 );
280 ?>
281 " target="_blank"><?php esc_html_e( 'LEARN MORE', 'wp-2fa' ); ?></a>
282 </div>
283 </div>
284 </div>
285 </li>
286 </ul>
287 </div>
288 <?php
289 }
290
291 /**
292 * Gather basic settings and system information for use in the system info tab. Left untranslated (as is the case in all plugins)
293 * as its for our use only.
294 *
295 * @return string
296 */
297 public static function get_sysinfo() {
298 // System info.
299 global $wpdb;
300
301 $sysinfo = '### System Info → Begin ###' . "\n\n";
302
303 // Start with the basics...
304 $sysinfo .= '-- Site Info --' . "\n\n";
305 $sysinfo .= 'Site URL (WP Address): ' . site_url() . "\n";
306 $sysinfo .= 'Home URL (Site Address): ' . home_url() . "\n";
307 $sysinfo .= 'Multisite: ' . ( WP_Helper::is_multisite() ? 'Yes' : 'No' ) . "\n";
308
309 // Get theme info.
310 $theme_data = wp_get_theme();
311 $theme = $theme_data->name . ' ' . $theme_data->version;
312 $parent_theme = $theme_data->template;
313 if ( ! empty( $parent_theme ) ) {
314 $parent_theme_data = wp_get_theme( $parent_theme );
315 $parent_theme = $parent_theme_data->name . ' ' . $parent_theme_data->version;
316 }
317
318 // Language information.
319 $locale = get_locale();
320
321 // WordPress configuration.
322 $sysinfo .= "\n" . '-- WordPress Configuration --' . "\n\n";
323 $sysinfo .= 'Version: ' . get_bloginfo( 'version' ) . "\n";
324 $sysinfo .= 'Language: ' . ( ! empty( $locale ) ? $locale : 'en_US' ) . "\n";
325 $sysinfo .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n";
326 $sysinfo .= 'Active Theme: ' . $theme . "\n";
327 if ( $parent_theme !== $theme ) {
328 $sysinfo .= 'Parent Theme: ' . $parent_theme . "\n";
329 }
330 $sysinfo .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n";
331
332 // Only show page specs if frontpage is set to 'page'.
333 if ( 'page' === get_option( 'show_on_front' ) ) {
334 $front_page_id = (int) get_option( 'page_on_front' );
335 $blog_page_id = (int) get_option( 'page_for_posts' );
336
337 $sysinfo .= 'Page On Front: ' . ( 0 !== $front_page_id ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n";
338 $sysinfo .= 'Page For Posts: ' . ( 0 !== $blog_page_id ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n";
339 }
340
341 $sysinfo .= 'ABSPATH: ' . ABSPATH . "\n";
342 $sysinfo .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? ( WP_DEBUG ? 'Enabled' : 'Disabled' ) : 'Not set' ) . "\n";
343 $sysinfo .= 'WP Memory Limit: ' . WP_MEMORY_LIMIT . "\n";
344
345 // Get plugins that have an update.
346 $updates = get_plugin_updates();
347
348 // Must-use plugins.
349 // NOTE: MU plugins can't show updates!
350 $muplugins = get_mu_plugins();
351 if ( count( $muplugins ) > 0 ) {
352 $sysinfo .= "\n" . '-- Must-Use Plugins --' . "\n\n";
353
354 foreach ( $muplugins as $plugin => $plugin_data ) {
355 $sysinfo .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n";
356 }
357 }
358
359 // WordPress active plugins.
360 $sysinfo .= "\n" . '-- WordPress Active Plugins --' . "\n\n";
361
362 $plugins = get_plugins();
363 $active_plugins = get_option( 'active_plugins', array() );
364
365 foreach ( $plugins as $plugin_path => $plugin ) {
366 if ( ! in_array( $plugin_path, $active_plugins, true ) ) {
367 continue;
368 }
369
370 $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : '';
371 $sysinfo .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
372 }
373
374 // WordPress inactive plugins.
375 $sysinfo .= "\n" . '-- WordPress Inactive Plugins --' . "\n\n";
376
377 foreach ( $plugins as $plugin_path => $plugin ) {
378 if ( in_array( $plugin_path, $active_plugins, true ) ) {
379 continue;
380 }
381
382 $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : '';
383 $sysinfo .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
384 }
385
386 if ( WP_Helper::is_multisite() ) {
387 // WordPress Multisite active plugins.
388 $sysinfo .= "\n" . '-- Network Active Plugins --' . "\n\n";
389
390 $plugins = wp_get_active_network_plugins();
391 $active_plugins = get_site_option( 'active_sitewide_plugins', array() );
392
393 foreach ( $plugins as $plugin_path ) {
394 $plugin_base = plugin_basename( $plugin_path );
395
396 if ( ! array_key_exists( $plugin_base, $active_plugins ) ) {
397 continue;
398 }
399
400 $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : '';
401 $plugin = get_plugin_data( $plugin_path );
402 $sysinfo .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
403 }
404 }
405
406 // Server configuration.
407 $server_software = ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) ? \sanitize_text_field( \wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '';
408 $sysinfo .= "\n" . '-- Webserver Configuration --' . "\n\n";
409 $sysinfo .= 'PHP Version: ' . PHP_VERSION . "\n";
410 $sysinfo .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
411
412 if ( isset( $server_software ) ) {
413 $sysinfo .= 'Webserver Info: ' . $server_software . "\n";
414 } else {
415 $sysinfo .= 'Webserver Info: Global $_SERVER array is not set.' . "\n";
416 }
417
418 // PHP configs.
419 $sysinfo .= "\n" . '-- PHP Configuration --' . "\n\n";
420 $sysinfo .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n";
421 $sysinfo .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n";
422 $sysinfo .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n";
423 $sysinfo .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n";
424 $sysinfo .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n";
425 $sysinfo .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n";
426 $sysinfo .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n";
427
428 $sysinfo .= "\n" . '-- WP 2FA Settings --' . "\n\n";
429
430 global $wpdb;
431
432 $wp2fa_options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE 'wp_2fa_%'", ARRAY_A ); // phpcs:ignore
433
434 if ( ! empty( $wp2fa_options ) ) {
435 foreach ( $wp2fa_options as $option => $value ) {
436 $sysinfo .= 'Option: ' . $value['option_name'] . "\n";
437 $sysinfo .= 'Value: ' . print_r( $value['option_value'], true ) . "\n\n"; // phpcs:ignore
438 }
439 }
440
441 $sysinfo .= "\n" . '### System Info → End ###' . "\n\n";
442
443 return $sysinfo;
444 }
445 }
446