PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.74
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.74
1.2.74 1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 All 174 releases
← All changes | includes/class-status.php +77 -685 1.0.201.2.74 View file →
@@ -7,676 +7,29 @@
7 7 * @since 1.0.20
8 8 */
9 9 class UsersWP_Status {
10 10
11 - public function uwp_status_wrap_error_message($message, $class) {
12 - ob_start();
13 - ?>
14 - <div class="notice inline notice-<?php echo $class; ?> notice-alt">
15 - <p><?php echo $message; ?></p>
16 - </div>
17 - <?php
18 - $html = ob_get_clean();
19 - return $html;
11 + /**
12 + * Outputs status page content
13 + *
14 + * @since 1.0.0
15 + * @package userswp
16 + */
17 + public static function output() {
18 + include_once( USERSWP_PATH . '/admin/views/html-admin-page-status.php' );
20 19 }
21 20
22 - /**
23 - * Adds the status settings page menu as submenu.
24 - *
25 - * @since 1.0.20
26 - * @package userswp
27 - *
28 - * @param callable $settings_page The function to be called to output the content for this page.
29 - *
30 - * @return void
31 - */
32 - public function uwp_add_admin_status_sub_menu($settings_page) {
33 -
34 - add_submenu_page(
35 - "userswp",
36 - __('Status', 'userswp'),
37 - __('Status', 'userswp'),
38 - 'manage_options',
39 - 'uwp_status',
40 - $settings_page
41 - );
42 -
21 + /**
22 + * Displays status report
23 + *
24 + * @since 1.0.0
25 + * @package userswp
26 + *
27 + */
28 + public static function status_report() {
29 + include_once( USERSWP_PATH . '/admin/views/html-admin-page-status-report.php' );
43 30 }
44 31
45 - public function uwp_status_main_tab_content() {
46 - global $wpdb;
47 - $environment = $this->uwp_get_environment_info();
48 - $database = $this->uwp_get_database_info();
49 - $active_plugins = $this->uwp_get_active_plugins();
50 - $theme = $this->uwp_get_theme_info();
51 - $security = $this->uwp_get_security_info();
52 - $pages = $this->uwp_get_pages();
53 - ?>
54 - <style type="text/css">
55 - table.uwp-status-table {
56 - margin-bottom: 1em;
57 - }
58 - table.uwp-status-table th {
59 - font-weight: 700;
60 - padding: 9px;
61 - }
62 - table.uwp-status-table td,
63 - table.uwp-status-table th {
64 - font-size: 1.1em;
65 - font-weight: 400;
66 - }
67 - table.uwp-status-table h2 {
68 - font-size: 14px;
69 - margin: 0;
70 - }
71 - table.uwp-status-table td:first-child {
72 - width: 33%;
73 - }
74 - table.uwp-status-table td mark,
75 - table.uwp-status-table th mark {
76 - background: transparent none;
77 - }
78 - table.uwp-status-table td mark.yes,
79 - table.uwp-status-table th mark.yes {
80 - color: #7ad03a;
81 - }
82 - p.submit {
83 - margin: .5em 0;
84 - padding: 2px;
85 - }
86 - #debug-report {
87 - display: none;
88 - margin: 10px 0;
89 - padding: 0;
90 - position: relative;
91 - }
92 - #debug-report textarea {
93 - font-family: monospace;
94 - width: 100%;
95 - margin: 0;
96 - height: 300px;
97 - padding: 20px;
98 - border-radius: 0;
99 - resize: none;
100 - font-size: 12px;
101 - line-height: 20px;
102 - outline: 0;
103 - }
104 - </style>
105 - <div class="notice">
106 - <p><?php _e( 'Please copy and paste this information in your ticket when contacting support:', 'userswp' ); ?> </p>
107 - <p class="submit"><a href="javascript:void" class="button-primary debug-report"><?php _e( 'Get system report', 'userswp' ); ?></a></p>
108 - <div id="debug-report">
109 - <textarea readonly="readonly"></textarea>
110 - <p class="submit"><button id="copy-for-support" class="button-primary" href="javascript:void"><?php _e( 'Copy for Support', 'userswp' ); ?></button></p>
111 - <p class="copy-error hidden"><?php _e( 'Copying to clipboard failed. Please press Ctrl/Cmd+C to copy.', 'userswp' ); ?></p>
112 - </div>
113 - </div>
114 - <table class="uwp-status-table widefat">
115 - <thead>
116 - <tr>
117 - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'userswp' ); ?></h2></th>
118 - </tr>
119 - </thead>
120 - <tbody>
121 - <tr>
122 - <td data-export-label="Home URL"><?php _e( 'Home URL', 'userswp' ); ?>:</td>
123 - <td><?php echo esc_html( $environment['home_url'] ) ?></td>
124 - </tr>
125 - <tr>
126 - <td data-export-label="Site URL"><?php _e( 'Site URL', 'userswp' ); ?>:</td>
127 - <td><?php echo esc_html( $environment['site_url'] ) ?></td>
128 - </tr>
129 - <tr>
130 - <td data-export-label="UWP Version"><?php _e( 'UWP version', 'userswp' ); ?>:</td>
131 - <td><?php echo esc_html( $environment['version'] ) ?></td>
132 - </tr>
133 - <tr>
134 - <td data-export-label="WP Version"><?php _e( 'WP version', 'userswp' ); ?>:</td>
135 - <td><?php echo esc_html( $environment['wp_version'] ) ?></td>
136 - </tr>
137 - <tr>
138 - <td data-export-label="WP Multisite"><?php _e( 'WP multisite', 'userswp' ); ?>:</td>
139 - <td><?php echo ( $environment['wp_multisite'] ) ? '<span class="dashicons dashicons-yes"></span>' : '&ndash;'; ?></td>
140 - </tr>
141 - <tr>
142 - <td data-export-label="WP Memory Limit"><?php _e( 'WP memory limit', 'userswp' ); ?>:</td>
143 - <td><?php
144 - if ( $environment['wp_memory_limit'] < 67108864 ) {
145 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend setting memory to at least 64MB. See: %2$s', 'userswp' ), size_format( $environment['wp_memory_limit'] ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'userswp' ) . '</a>' ) . '</mark>';
146 - } else {
147 - echo '<mark class="yes">' . size_format( $environment['wp_memory_limit'] ) . '</mark>';
148 - }
149 - ?></td>
150 - </tr>
151 - <tr>
152 - <td data-export-label="WP Debug Mode"><?php _e( 'WP debug mode', 'userswp' ); ?>:</td>
153 - <td>
154 - <?php if ( $environment['wp_debug_mode'] ) : ?>
155 - <mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
156 - <?php else : ?>
157 - <mark class="no">&ndash;</mark>
158 - <?php endif; ?>
159 - </td>
160 - </tr>
161 - <tr>
162 - <td data-export-label="WP Cron"><?php _e( 'WP cron', 'userswp' ); ?>:</td>
163 - <td>
164 - <?php if ( $environment['wp_cron'] ) : ?>
165 - <mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
166 - <?php else : ?>
167 - <mark class="no">&ndash;</mark>
168 - <?php endif; ?>
169 - </td>
170 - </tr>
171 - <tr>
172 - <td data-export-label="Language"><?php _e( 'Language', 'userswp' ); ?>:</td>
173 - <td><?php echo esc_html( $environment['language'] ) ?></td>
174 - </tr>
175 - </tbody>
176 - </table>
177 -
178 - <table class="uwp-status-table widefat" cellspacing="0">
179 - <thead>
180 - <tr>
181 - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'userswp' ); ?></h2></th>
182 - </tr>
183 - </thead>
184 - <tbody>
185 - <tr>
186 - <td data-export-label="Server Info"><?php _e( 'Server info', 'userswp' ); ?>:</td>
187 - <td><?php echo esc_html( $environment['server_info'] ); ?></td>
188 - </tr>
189 - <tr>
190 - <td data-export-label="PHP Version"><?php _e( 'PHP version', 'userswp' ); ?>:</td>
191 - <td><?php
192 - if ( version_compare( $environment['php_version'], '5.6', '<' ) ) {
193 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend a minimum PHP version of 5.6.', 'userswp' ), esc_html( $environment['php_version'] ) ) . '</mark>';
194 - } else {
195 - echo '<mark class="yes">' . esc_html( $environment['php_version'] ) . '</mark>';
196 - }
197 - ?></td>
198 - </tr>
199 - <?php if ( function_exists( 'ini_get' ) ) : ?>
200 - <tr>
201 - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP post max size', 'userswp' ); ?>:</td>
202 - <td><?php echo esc_html( size_format( $environment['php_post_max_size'] ) ) ?></td>
203 - </tr>
204 - <tr>
205 - <td data-export-label="PHP Time Limit"><?php _e( 'PHP time limit', 'userswp' ); ?>:</td>
206 - <td><?php echo esc_html( $environment['php_max_execution_time'] ) ?></td>
207 - </tr>
208 - <tr>
209 - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP max input vars', 'userswp' ); ?>:</td>
210 - <td><?php echo esc_html( $environment['php_max_input_vars'] ) ?></td>
211 - </tr>
212 - <tr>
213 - <td data-export-label="cURL Version"><?php _e( 'cURL version', 'userswp' ); ?>:</td>
214 - <td><?php echo esc_html( $environment['curl_version'] ) ?></td>
215 - </tr>
216 - <tr>
217 - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN installed', 'userswp' ); ?>:</td>
218 - <td><?php echo $environment['suhosin_installed'] ? '<span class="dashicons dashicons-yes"></span>' : '&ndash;'; ?></td>
219 - </tr>
220 - <?php endif;
221 - if ( $wpdb->use_mysqli ) {
222 - $ver = mysqli_get_server_info( $wpdb->dbh );
223 - } else {
224 - $ver = mysql_get_server_info();
225 - }
226 - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?>
227 - <tr>
228 - <td data-export-label="MySQL Version"><?php _e( 'MySQL version', 'userswp' ); ?>:</td>
229 - <td>
230 - <?php
231 - if ( version_compare( $environment['mysql_version'], '5.6', '<' ) ) {
232 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend a minimum MySQL version of 5.6. See: %2$s', 'userswp' ), esc_html( $environment['mysql_version'] ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress requirements', 'userswp' ) . '</a>' ) . '</mark>';
233 - } else {
234 - echo '<mark class="yes">' . esc_html( $environment['mysql_version'] ) . '</mark>';
235 - }
236 - ?>
237 - </td>
238 - </tr>
239 - <?php endif; ?>
240 - <tr>
241 - <td data-export-label="Max Upload Size"><?php _e( 'Max upload size', 'userswp' ); ?>:</td>
242 - <td><?php echo size_format( $environment['max_upload_size'] ) ?></td>
243 - </tr>
244 - <tr>
245 - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default timezone is UTC', 'userswp' ); ?>:</td>
246 - <td><?php
247 - if ( 'UTC' !== $environment['default_timezone'] ) {
248 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'userswp' ), $environment['default_timezone'] ) . '</mark>';
249 - } else {
250 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
251 - } ?>
252 - </td>
253 - </tr>
254 - <tr>
255 - <td data-export-label="fsockopen/cURL"><?php _e( 'fsockopen/cURL', 'userswp' ); ?>:</td>
256 - <td><?php
257 - if ( $environment['fsockopen_or_curl_enabled'] ) {
258 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
259 - } else {
260 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'userswp' ) . '</mark>';
261 - } ?>
262 - </td>
263 - </tr>
264 - <tr>
265 - <td data-export-label="SoapClient"><?php _e( 'SoapClient', 'userswp' ); ?>:</td>
266 - <td><?php
267 - if ( $environment['soapclient_enabled'] ) {
268 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
269 - } else {
270 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'userswp' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ) . '</mark>';
271 - } ?>
272 - </td>
273 - </tr>
274 - <tr>
275 - <td data-export-label="DOMDocument"><?php _e( 'DOMDocument', 'userswp' ); ?>:</td>
276 - <td><?php
277 - if ( $environment['domdocument_enabled'] ) {
278 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
279 - } else {
280 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'userswp' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ) . '</mark>';
281 - } ?>
282 - </td>
283 - </tr>
284 - <tr>
285 - <td data-export-label="GZip"><?php _e( 'GZip', 'userswp' ); ?>:</td>
286 - <td><?php
287 - if ( $environment['gzip_enabled'] ) {
288 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
289 - } else {
290 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind.', 'userswp' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ) . '</mark>';
291 - } ?>
292 - </td>
293 - </tr>
294 - <tr>
295 - <td data-export-label="GD Library"><?php _e( 'GD Library', 'userswp' ); ?>:</td>
296 - <td><?php
297 - if ( $environment['gd_library'] ) {
298 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
299 - } else {
300 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not have enabled %s - this is required for image processing.', 'userswp' ), '<a href="https://secure.php.net/manual/en/image.installation.php">GD Library</a>' ) . '</mark>';
301 - } ?>
302 - </td>
303 - </tr>
304 - <tr>
305 - <td data-export-label="Multibyte String"><?php _e( 'Multibyte string', 'userswp' ); ?>:</td>
306 - <td><?php
307 - if ( $environment['mbstring_enabled'] ) {
308 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
309 - } else {
310 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'userswp' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ) . '</mark>';
311 - } ?>
312 - </td>
313 - </tr>
314 - <tr>
315 - <td data-export-label="Remote Post"><?php _e( 'Remote POST', 'userswp' ); ?>:</td>
316 - <td><?php
317 - if ( $environment['remote_post_successful'] ) {
318 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
319 - } else {
320 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s failed. Contact your hosting provider.', 'userswp' ), 'wp_remote_post()' ) . ' ' . esc_html( $environment['remote_post_response'] ) . '</mark>';
321 - } ?>
322 - </td>
323 - </tr>
324 - <tr>
325 - <td data-export-label="Remote Get"><?php _e( 'Remote GET', 'userswp' ); ?>:</td>
326 - <td><?php
327 - if ( $environment['remote_get_successful'] ) {
328 - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
329 - } else {
330 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s failed. Contact your hosting provider.', 'userswp' ), 'wp_remote_get()' ) . ' ' . esc_html( $environment['remote_get_response'] ) . '</mark>';
331 - } ?>
332 - </td>
333 - </tr>
334 - <?php
335 - $rows = apply_filters( 'uwp_system_status_environment_rows', array() );
336 - if(count($rows) > 0) {
337 - foreach ($rows as $row) {
338 - if (!empty($row['success'])) {
339 - $css_class = 'yes';
340 - $icon = '<span class="dashicons dashicons-yes"></span>';
341 - } else {
342 - $css_class = 'error';
343 - $icon = '<span class="dashicons dashicons-no-alt"></span>';
344 - }
345 - ?>
346 - <tr>
347 - <td data-export-label="<?php echo esc_attr($row['name']); ?>"><?php echo esc_html($row['name']); ?>
348 - :
349 - </td>
350 - <td>
351 - <mark class="<?php echo esc_attr($css_class); ?>">
352 - <?php echo $icon; ?><?php echo !empty($row['note']) ? wp_kses_data($row['note']) : ''; ?>
353 - </mark>
354 - </td>
355 - </tr><?php
356 - }
357 - }?>
358 - </tbody>
359 - </table>
360 - <table class="widefat" cellspacing="0">
361 - <thead>
362 - <tr>
363 - <th colspan="3" data-export-label="User Platform"><h2><?php _e( 'User Platform', 'userswp' ); ?></h2></th>
364 - </tr>
365 - </thead>
366 - <tbody>
367 - <tr>
368 - <td data-export-label="Platform"><?php _e( 'Platform', 'userswp' ); ?>:</td>
369 - <td><?php echo esc_html( $environment['platform'] ); ?></td>
370 - </tr>
371 - <tr>
372 - <td data-export-label="Browser name"><?php _e( 'Browser name', 'userswp' ); ?>:</td>
373 - <td><?php echo esc_html( $environment['browser_name'] ); ?></td>
374 - </tr>
375 - <tr>
376 - <td data-export-label="Browser version"><?php _e( 'Browser version', 'userswp' ); ?>:</td>
377 - <td><?php echo esc_html( $environment['browser_version'] ); ?></td>
378 - </tr>
379 - <tr>
380 - <td data-export-label="User agent"><?php _e( 'User agent', 'userswp' ); ?>:</td>
381 - <td><?php echo esc_html( $environment['user_agent'] ); ?></td>
382 - </tr>
383 - </tbody>
384 - </table>
385 - <table class="uwp-status-table widefat" cellspacing="0">
386 - <thead>
387 - <tr>
388 - <th colspan="3" data-export-label="Database"><h2><?php _e( 'Database', 'userswp' ); ?></h2></th>
389 - </tr>
390 - </thead>
391 - <tbody>
392 - <tr>
393 - <td data-export-label="UWP Database Version"><?php _e( 'UWP database version', 'userswp' ); ?>:</td>
394 - <td><?php echo esc_html( $database['uwp_db_version'] ); ?></td>
395 - </tr>
396 - <tr>
397 - <td data-export-label="UWP Database Prefix"><?php _e( 'Database Prefix', 'userswp' ); ?></td>
398 - <td><?php
399 - if ( strlen( $database['database_prefix'] ) > 20 ) {
400 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend using a prefix with less than 20 characters.', 'userswp' ), esc_html( $database['database_prefix'] ) ) . '</mark>';
401 - } else {
402 - echo '<mark class="yes">' . esc_html( $database['database_prefix'] ) . '</mark>';
403 - }
404 - ?>
405 - </td>
406 - </tr>
407 - <tr>
408 - <td><?php _e( 'Total Database Size', 'userswp' ); ?></td>
409 - <td><?php printf( '%.2fMB', $database['database_size']['data'] + $database['database_size']['index'] ); ?></td>
410 - </tr>
411 -
412 - <tr>
413 - <td><?php _e( 'Database Data Size', 'userswp' ); ?></td>
414 - <td><?php printf( '%.2fMB', $database['database_size']['data'] ); ?></td>
415 - </tr>
416 -
417 - <tr>
418 - <td><?php _e( 'Database Index Size', 'userswp' ); ?></td>
419 - <td><?php printf( '%.2fMB', $database['database_size']['index'] ); ?></td>
420 - </tr>
421 -
422 - <?php foreach ( $database['database_tables']['userswp'] as $table => $table_data ) { ?>
423 - <tr>
424 - <td><?php echo esc_html( $table ); ?></td>
425 - <td>
426 - <?php if( ! $table_data ) {
427 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Table does not exist', 'userswp' ) . '</mark>';
428 - } else {
429 - printf( __( 'Data: %.2fMB + Index: %.2fMB', 'userswp' ), uwp_format_decimal( $table_data['data'], 2 ), uwp_format_decimal( $table_data['index'], 2 ) );
430 - } ?>
431 - </td>
432 - </tr>
433 - <?php } ?>
434 -
435 - <?php foreach ( $database['database_tables']['other'] as $table => $table_data ) { ?>
436 - <tr>
437 - <td><?php echo esc_html( $table ); ?></td>
438 - <td>
439 - <?php printf( __( 'Data: %.2fMB + Index: %.2fMB', 'userswp' ), uwp_format_decimal( $table_data['data'], 2 ), uwp_format_decimal( $table_data['index'], 2 ) ); ?>
440 - </td>
441 - </tr>
442 - <?php } ?>
443 - </tbody>
444 - </table>
445 - <table class="uwp-status-table widefat" cellspacing="0">
446 - <thead>
447 - <tr>
448 - <th colspan="3" data-export-label="Security"><h2><?php _e( 'Security', 'userswp' ); ?></h2></th>
449 - </tr>
450 - </thead>
451 - <tbody>
452 - <tr>
453 - <td data-export-label="Secure connection (HTTPS)"><?php _e( 'Secure connection (HTTPS)', 'userswp' ); ?>:</td>
454 - <td>
455 - <?php if ( $security['secure_connection'] ) : ?>
456 - <mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
457 - <?php else : ?>
458 - <mark class="error"><span class="dashicons dashicons-warning"></span><?php echo __( 'Your site is not using HTTPS.', 'userswp' ); ?></mark>
459 - <?php endif; ?>
460 - </td>
461 - </tr>
462 - <tr>
463 - <td data-export-label="Hide errors from visitors"><?php _e( 'Hide errors from visitors', 'userswp' ); ?></td>
464 - <td>
465 - <?php if ( $security['hide_errors'] ) : ?>
466 - <mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
467 - <?php else : ?>
468 - <mark class="error"><span class="dashicons dashicons-warning"></span><?php _e( 'Error messages should not be shown to visitors.', 'userswp' ); ?></mark>
469 - <?php endif; ?>
470 - </td>
471 - </tr>
472 - </tbody>
473 - </table>
474 - <table class="uwp-status-table widefat" cellspacing="0">
475 - <thead>
476 - <tr>
477 - <th colspan="3" data-export-label="Active Plugins (<?php echo count( $active_plugins ) ?>)"><h2><?php _e( 'Active Plugins', 'userswp' ); ?> (<?php echo count( $active_plugins ) ?>)</h2></th>
478 - </tr>
479 - </thead>
480 - <tbody>
481 - <?php
482 - foreach ( $active_plugins as $plugin ) {
483 - if ( ! empty( $plugin['name'] ) ) {
484 - $dirname = dirname( $plugin['plugin'] );
485 -
486 - // Link the plugin name to the plugin url if available.
487 - $plugin_name = esc_html( $plugin['name'] );
488 - if ( ! empty( $plugin['url'] ) ) {
489 - $plugin_name = '<a href="' . esc_url( $plugin['url'] ) . '" aria-label="' . esc_attr__( 'Visit plugin homepage' , 'userswp' ) . '" target="_blank">' . $plugin_name . '</a>';
490 - }
491 -
492 - $version_string = '';
493 - $network_string = '';
494 - if ( ! empty( $plugin['latest_verison'] ) && version_compare( $plugin['latest_verison'], $plugin['version'], '>' ) ) {
495 - /* translators: %s: plugin latest version */
496 - $version_string = ' &ndash; <strong style="color:red;">' . sprintf( esc_html__( '%s is available', 'userswp' ), $plugin['latest_verison'] ) . '</strong>';
497 - }
498 -
499 - if ( false != $plugin['network_activated'] ) {
500 - $network_string = ' &ndash; <strong style="color:black;">' . __( 'Network enabled', 'userswp' ) . '</strong>';
501 - }
502 - ?>
503 - <tr>
504 - <td><?php echo $plugin_name; ?></td>
505 - <td><?php
506 - /* translators: %s: plugin author */
507 - printf( __( 'by %s', 'userswp' ), $plugin['author_name'] );
508 - echo ' &ndash; ' . esc_html( $plugin['version'] ) . $version_string . $network_string;
509 - ?></td>
510 - </tr>
511 - <?php
512 - }
513 - }
514 - ?>
515 - </tbody>
516 - </table>
517 -
518 - <table class="uwp-status-table widefat" cellspacing="0">
519 - <thead>
520 - <tr>
521 - <th colspan="3" data-export-label="UWP Pages"><h2><?php _e( 'UWP Pages', 'userswp' ); ?></h2></th>
522 - </tr>
523 - </thead>
524 - <tbody>
525 - <?php
526 - foreach ( $pages as $page ) {
527 - $error = false;
528 -
529 - if ( $page['page_id'] ) {
530 - $page_name = '<a href="' . get_edit_post_link( $page['page_id'] ) . '" aria-label="' . sprintf( __( 'Edit %s page', 'userswp' ), esc_html( $page['page_name'] ) ) . '">' . esc_html( $page['page_name'] ) . '</a>';
531 - } else {
532 - $page_name = esc_html( $page['page_name'] );
533 - }
534 -
535 - echo '<tr><td data-export-label="' . esc_attr( $page_name ) . '">' . $page_name . ':</td><td>';
536 - // Page ID check.
537 - if ( ! $page['page_set'] ) {
538 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Page not set', 'userswp' ) . '</mark>';
539 - $error = true;
540 - } elseif ( ! $page['page_exists'] ) {
541 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Page ID is set, but the page does not exist', 'userswp' ) . '</mark>';
542 - $error = true;
543 - } elseif ( ! $page['page_visible'] ) {
544 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Page visibility should be <a href="%s" target="_blank">public</a>', 'userswp' ), 'https://codex.wordpress.org/Content_Visibility' ) . '</mark>';
545 - $error = true;
546 - } else {
547 - // Shortcode check
548 - if ( $page['shortcode_required'] ) {
549 - if ( ! $page['shortcode_present'] ) {
550 - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Page does not contains the shortcode.', 'userswp' ), $page['shortcode'] ) . '</mark>';
551 - $error = true;
552 - }
553 - }
554 - }
555 -
556 - if ( ! $error ) {
557 - echo '<mark class="yes">#' . absint( $page['page_id'] ) . ' - ' . str_replace( home_url(), '', get_permalink( $page['page_id'] ) ) . '</mark>';
558 - }
559 -
560 - echo '</td></tr>';
561 - }
562 - ?>
563 - </tbody>
564 - </table>
565 - <table class="uwp-status-table widefat" cellspacing="0">
566 - <thead>
567 - <tr>
568 - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'userswp' ); ?></h2></th>
569 - </tr>
570 - </thead>
571 - <tbody>
572 - <tr>
573 - <td data-export-label="Name"><?php _e( 'Name', 'userswp' ); ?>:</td>
574 - <td><?php echo esc_html( $theme['name'] ) ?></td>
575 - </tr>
576 - <tr>
577 - <td data-export-label="Version"><?php _e( 'Version', 'userswp' ); ?>:</td>
578 - <td><?php
579 - echo esc_html( $theme['version'] );
580 - if ( version_compare( $theme['version'], $theme['latest_verison'], '<' ) ) {
581 - /* translators: %s: theme latest version */
582 - echo ' &ndash; <strong style="color:red;">' . sprintf( __( '%s is available', 'userswp' ), esc_html( $theme['latest_verison'] ) ) . '</strong>';
583 - }
584 - ?></td>
585 - </tr>
586 - <tr>
587 - <td data-export-label="Author URL"><?php _e( 'Author URL', 'userswp' ); ?>:</td>
588 - <td><?php echo esc_html( $theme['author_url'] ) ?></td>
589 - </tr>
590 - <tr>
591 - <td data-export-label="Child Theme"><?php _e( 'Child theme', 'userswp' ); ?>:</td>
592 - <td><?php
593 - echo $theme['is_child_theme'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<span class="dashicons dashicons-no-alt"></span> &ndash; ' . sprintf( __( 'If you are modifying userswp on a parent theme that you did not build personally we recommend using a child theme. See: <a href="%s" target="_blank">How to create a child theme</a>', 'userswp' ), 'https://codex.wordpress.org/Child_Themes' );
594 - ?></td>
595 - </tr>
596 - <?php
597 - if ( $theme['is_child_theme'] ) :
598 - ?>
599 - <tr>
600 - <td data-export-label="Parent Theme Name"><?php _e( 'Parent theme name', 'userswp' ); ?>:</td>
601 - <td><?php echo esc_html( $theme['parent_name'] ); ?></td>
602 - </tr>
603 - <tr>
604 - <td data-export-label="Parent Theme Version"><?php _e( 'Parent theme version', 'userswp' ); ?>:</td>
605 - <td><?php
606 - echo esc_html( $theme['parent_version'] );
607 - if ( version_compare( $theme['parent_version'], $theme['parent_latest_verison'], '<' ) ) {
608 - /* translators: %s: parant theme latest version */
609 - echo ' &ndash; <strong style="color:red;">' . sprintf( __( '%s is available', 'userswp' ), esc_html( $theme['parent_latest_verison'] ) ) . '</strong>';
610 - }
611 - ?></td>
612 - </tr>
613 - <tr>
614 - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent theme author URL', 'userswp' ); ?>:</td>
615 - <td><?php echo esc_html( $theme['parent_author_url'] ) ?></td>
616 - </tr>
617 - <?php endif ?>
618 - </tbody>
619 - </table>
620 - <table class="uwp-status-table widefat" cellspacing="0">
621 - <thead>
622 - <tr>
623 - <th colspan="3" data-export-label="Templates"><h2><?php _e( 'Templates', 'userswp' ); ?></h2></th>
624 - </tr>
625 - </thead>
626 - <tbody>
627 - <?php
628 - if ( ! empty( $theme['overrides'] ) ) { ?>
629 - <tr>
630 - <td data-export-label="Overrides"><?php _e( 'Overrides', 'userswp' ); ?></td>
631 - <td>
632 - <?php
633 - $total_overrides = count( $theme['overrides'] );
634 - for ( $i = 0; $i < $total_overrides; $i++ ) {
635 - $override = $theme['overrides'][ $i ];
636 - if ( $override['core_version'] && ( empty( $override['version'] ) || version_compare( $override['version'], $override['core_version'], '<' ) ) ) {
637 - $current_version = $override['version'] ? $override['version'] : '-';
638 - printf(
639 - __( '%1$s version %2$s is out of date. The core version is %3$s', 'userswp' ),
640 - '<code>' . $override['file'] . '</code>',
641 - '<strong style="color:red">' . $current_version . '</strong>',
642 - $override['core_version']
643 - );
644 - } else {
645 - echo esc_html( $override['file'] );
646 - }
647 - if ( ( count( $theme['overrides'] ) - 1 ) !== $i ) {
648 - echo ', ';
649 - }
650 - echo '<br />';
651 - }
652 - ?>
653 - </td>
654 - </tr>
655 - <?php
656 - } else {
657 - ?>
658 - <tr>
659 - <td data-export-label="Overrides"><?php _e( 'Overrides', 'userswp' ); ?>:</td>
660 - <td>&ndash;</td>
661 - </tr>
662 - <?php
663 - }
664 -
665 - if ( true === $theme['has_outdated_templates'] ) {
666 - ?>
667 - <tr>
668 - <td data-export-label="Outdated Templates"><?php _e( 'Outdated templates', 'userswp' ); ?>:</td>
669 - <td><mark class="error"><span class="dashicons dashicons-warning"></span></mark></td>
670 - </tr>
671 - <?php
672 - }
673 - ?>
674 - </tbody>
675 - </table>
676 - <?php
677 - }
678 -
679 32 /**
680 33 * Get array of environment information. Includes thing like software
681 34 * versions, and various server settings.
682 35 *
@@ -681,9 +34,9 @@
681 34 * versions, and various server settings.
682 35 *
683 36 * @return array
684 37 */
685 - public function uwp_get_environment_info() {
38 + public static function get_environment_info() {
686 39 global $wpdb;
687 40
688 41 // Figure out cURL version, if installed.
689 42 $curl_version = '';
@@ -766,9 +119,17 @@
766 119 'user_agent' => $user_agent
767 120 );
768 121 }
769 122
770 - public function uwp_get_database_info(){
123 + /**
124 + * Returns database information
125 + *
126 + * @since 1.0.0
127 + * @package userswp
128 + *
129 + * @return array
130 + */
131 + public static function get_database_info(){
771 132 global $wpdb;
772 133
773 134 $database_table_sizes = $wpdb->get_results( $wpdb->prepare( "
774 135 SELECT
@@ -783,11 +144,9 @@
783 144 $core_tables = array(
784 145 'uwp_usermeta',
785 146 'uwp_form_fields',
786 147 'uwp_form_extras',
787 - 'uwp_activity',
788 - 'uwp_followers',
789 - 'uwp_friends',
148 + 'uwp_profile_tabs',
790 149 );
791 150
792 151 $core_tables = apply_filters( 'uwp_database_tables', $core_tables );
793 152
@@ -795,9 +154,9 @@
795 154 * Adding the prefix to the tables array, for backwards compatibility.
796 155 *
797 156 * If we changed the tables above to include the prefix, then any filters against that table could break.
798 157 */
799 - $core_tables = array_map( array( $this, 'uwp_add_db_table_prefix' ), $core_tables );
158 + $core_tables = array_map( array( 'UsersWP_Status', 'add_db_table_prefix' ), $core_tables );
800 159
801 160 /**
802 161 * Organize UWP and non-UWP tables separately for display purposes later.
803 162 *
@@ -833,9 +192,17 @@
833 192 'database_size' => $database_size,
834 193 );
835 194 }
836 195
837 - public function uwp_get_active_plugins(){
196 + /**
197 + * Returns active plugins
198 + *
199 + * @since 1.0.0
200 + * @package userswp
201 + *
202 + * @return array
203 + */
204 + public static function get_active_plugins(){
838 205 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
839 206 require_once( ABSPATH . 'wp-admin/includes/update.php' );
840 207
841 208 if ( ! function_exists( 'get_plugin_updates' ) ) {
@@ -870,9 +237,17 @@
870 237
871 238 return $active_plugins_data;
872 239 }
873 240
874 - public function uwp_get_theme_info(){
241 + /**
242 + * Returns theme info
243 + *
244 + * @since 1.0.0
245 + * @package userswp
246 + *
247 + * @return array
248 + */
249 + public static function get_theme_info(){
875 250 $active_theme = wp_get_theme();
876 251
877 252 // Get parent theme info if this theme is a child theme, otherwise
878 253 // pass empty info in the response.
@@ -880,9 +255,9 @@
880 255 $parent_theme = wp_get_theme( $active_theme->Template );
881 256 $parent_theme_info = array(
882 257 'parent_name' => $parent_theme->Name,
883 258 'parent_version' => $parent_theme->Version,
884 - 'parent_latest_verison' => $this->get_latest_theme_version( $parent_theme ),
259 + 'parent_latest_verison' => self::get_latest_theme_version( $parent_theme ),
885 260 'parent_author_url' => $parent_theme->{'Author URI'},
886 261 );
887 262 } else {
888 263 $parent_theme_info = array( 'parent_name' => '', 'parent_version' => '', 'parent_latest_verison' => '', 'parent_author_url' => '' );
@@ -893,9 +268,9 @@
893 268 * overrides any of them.
894 269 */
895 270 $override_files = array();
896 271 $outdated_templates = false;
897 - $scan_files = $this->scan_template_files( USERSWP_PATH . 'templates/' );
272 + $scan_files = self::scan_template_files( USERSWP_PATH . 'templates/' );
898 273
899 274 foreach ( $scan_files as $file ) {
900 275 if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
901 276 $theme_file = get_stylesheet_directory() . '/' . $file;
@@ -909,10 +284,10 @@
909 284 $theme_file = false;
910 285 }
911 286
912 287 if ( ! empty( $theme_file ) ) {
913 - $core_version = $this->get_file_version( USERSWP_PATH . '/templates/' . $file );
914 - $theme_version = $this->get_file_version( $theme_file );
288 + $core_version = self::get_file_version( USERSWP_PATH . '/templates/' . $file );
289 + $theme_version = self::get_file_version( $theme_file );
915 290 if ( $core_version && ( empty( $theme_version ) || version_compare( $theme_version, $core_version, '<' ) ) ) {
916 291 if ( ! $outdated_templates ) {
917 292 $outdated_templates = true;
918 293 }
@@ -927,9 +302,9 @@
927 302
928 303 $active_theme_info = array(
929 304 'name' => $active_theme->Name,
930 305 'version' => $active_theme->Version,
931 - 'latest_verison' => $this->get_latest_theme_version( $active_theme ),
306 + 'latest_verison' => self::get_latest_theme_version( $active_theme ),
932 307 'author_url' => esc_url_raw( $active_theme->{'Author URI'} ),
933 308 'is_child_theme' => is_child_theme(),
934 309 'has_outdated_templates' => $outdated_templates,
935 310 'overrides' => $override_files,
@@ -937,9 +312,17 @@
937 312
938 313 return array_merge( $active_theme_info, $parent_theme_info );
939 314 }
940 315
941 - public function uwp_get_security_info(){
316 + /**
317 + * Returns security info
318 + *
319 + * @since 1.0.0
320 + * @package userswp
321 + *
322 + * @return array
323 + */
324 + public static function get_security_info(){
942 325 $check_page = get_home_url();
943 326 return array(
944 327 'secure_connection' => 'https' === substr( $check_page, 0, 5 ),
945 328 'hide_errors' => ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ),
@@ -945,9 +328,17 @@
945 328 'hide_errors' => ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ),
946 329 );
947 330 }
948 331
949 - public function uwp_get_pages(){
332 + /**
333 + * Returns pages
334 + *
335 + * @since 1.0.0
336 + * @package userswp
337 + *
338 + * @return array
339 + */
340 + public static function get_pages(){
950 341 $check_pages = array(
951 342 _x( 'Profile Page', 'Page setting', 'userswp' ) => array(
952 343 'option' => 'profile_page',
953 344 'shortcode' => '[uwp_profile]',
@@ -988,12 +379,13 @@
988 379 foreach ( $check_pages as $page_name => $values ) {
989 380 $page_id = uwp_get_page_id( $values['option'], '' );
990 381 $page_set = $page_exists = $page_visible = false;
991 382 $shortcode_present = $shortcode_required = false;
992 - $page = get_post( $page_id );
383 + $page = false;
993 384 // Page checks
994 385 if ( $page_id ) {
995 386 $page_set = true;
387 + $page = get_post( $page_id );
996 388 }
997 389 if ( $page ) {
998 390 $page_exists = true;
999 391 }
@@ -1030,9 +422,9 @@
1030 422 *
1031 423 * @param string $table table name
1032 424 * @return string
1033 425 */
1034 - protected function uwp_add_db_table_prefix( $table ) {
426 + protected static function add_db_table_prefix( $table ) {
1035 427 return uwp_get_table_prefix() . $table;
1036 428 }
1037 429
1038 430 /**
@@ -1042,9 +434,9 @@
1042 434 *
1043 435 * @param object $theme WP_Theme object.
1044 436 * @return string Version number if found.
1045 437 */
1046 - public function get_latest_theme_version( $theme ) {
438 + public static function get_latest_theme_version( $theme ) {
1047 439 include_once( ABSPATH . 'wp-admin/includes/theme.php' );
1048 440
1049 441 $api = themes_api( 'theme_information', array(
1050 442 'slug' => $theme->get_stylesheet(),
@@ -1069,9 +461,9 @@
1069 461 *
1070 462 * @param string $template_path Path to the template directory.
1071 463 * @return array
1072 464 */
1073 - public function scan_template_files( $template_path ) {
465 + public static function scan_template_files( $template_path ) {
1074 466 $files = @scandir( $template_path ); // @codingStandardsIgnoreLine.
1075 467 $result = array();
1076 468
1077 469 if ( ! empty( $files ) ) {
@@ -1080,9 +472,9 @@
1080 472
1081 473 if ( ! in_array( $value, array( '.', '..' ), true ) ) {
1082 474
1083 475 if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
1084 - $sub_files = $this->scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
476 + $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
1085 477 foreach ( $sub_files as $sub_file ) {
1086 478 $result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
1087 479 }
1088 480 } else {
@@ -1100,9 +492,9 @@
1100 492 * @since 1.0.20
1101 493 * @param string $file Path to the file.
1102 494 * @return string
1103 495 */
1104 - public function get_file_version( $file ) {
496 + public static function get_file_version( $file ) {
1105 497
1106 498 // Avoid notices if file does not exist.
1107 499 if ( ! file_exists( $file ) ) {
1108 500 return '';