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