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