9
|
1 |
<?php |
|
2 |
/** |
|
3 |
* Tools Administration Screen. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
|
|
9 |
/** WordPress Administration Bootstrap */ |
16
|
10 |
require_once __DIR__ . '/admin.php'; |
9
|
11 |
|
|
12 |
$title = __( 'Site Health Info' ); |
|
13 |
|
|
14 |
if ( ! current_user_can( 'view_site_health_checks' ) ) { |
|
15 |
wp_die( __( 'Sorry, you are not allowed to access the debug data.' ), '', 403 ); |
|
16 |
} |
|
17 |
|
|
18 |
wp_enqueue_style( 'site-health' ); |
|
19 |
wp_enqueue_script( 'site-health' ); |
|
20 |
|
|
21 |
if ( ! class_exists( 'WP_Debug_Data' ) ) { |
16
|
22 |
require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php'; |
9
|
23 |
} |
|
24 |
if ( ! class_exists( 'WP_Site_Health' ) ) { |
16
|
25 |
require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; |
9
|
26 |
} |
|
27 |
|
16
|
28 |
$health_check_site_status = WP_Site_Health::get_instance(); |
9
|
29 |
|
16
|
30 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
9
|
31 |
?> |
|
32 |
<div class="health-check-header"> |
|
33 |
<div class="health-check-title-section"> |
|
34 |
<h1> |
|
35 |
<?php _e( 'Site Health' ); ?> |
|
36 |
</h1> |
16
|
37 |
</div> |
9
|
38 |
|
16
|
39 |
<div class="health-check-title-section site-health-progress-wrapper loading hide-if-no-js"> |
|
40 |
<div class="site-health-progress"> |
9
|
41 |
<svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg"> |
|
42 |
<circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle> |
|
43 |
<circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle> |
|
44 |
</svg> |
16
|
45 |
</div> |
|
46 |
<div class="site-health-progress-label"> |
|
47 |
<?php _e( 'Results are still loading…' ); ?> |
9
|
48 |
</div> |
|
49 |
</div> |
|
50 |
|
|
51 |
<nav class="health-check-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>"> |
|
52 |
<a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="health-check-tab"> |
|
53 |
<?php |
16
|
54 |
/* translators: Tab heading for Site Health Status page. */ |
9
|
55 |
_ex( 'Status', 'Site Health' ); |
|
56 |
?> |
|
57 |
</a> |
|
58 |
|
|
59 |
<a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab active" aria-current="true"> |
|
60 |
<?php |
16
|
61 |
/* translators: Tab heading for Site Health Info page. */ |
9
|
62 |
_ex( 'Info', 'Site Health' ); |
|
63 |
?> |
|
64 |
</a> |
|
65 |
</nav> |
|
66 |
</div> |
|
67 |
|
|
68 |
<hr class="wp-header-end"> |
|
69 |
|
|
70 |
<div class="notice notice-error hide-if-js"> |
|
71 |
<p><?php _e( 'The Site Health check requires JavaScript.' ); ?></p> |
|
72 |
</div> |
|
73 |
|
|
74 |
<div class="health-check-body health-check-debug-tab hide-if-no-js"> |
|
75 |
<?php |
|
76 |
|
|
77 |
WP_Debug_Data::check_for_updates(); |
|
78 |
|
|
79 |
$info = WP_Debug_Data::debug_data(); |
|
80 |
|
|
81 |
?> |
|
82 |
|
|
83 |
<h2> |
|
84 |
<?php _e( 'Site Health Info' ); ?> |
|
85 |
</h2> |
|
86 |
|
|
87 |
<p> |
16
|
88 |
<?php |
|
89 |
/* translators: %s: URL to Site Health Status page. */ |
|
90 |
printf( __( 'This page can show you every detail about the configuration of your WordPress website. For any improvements that could be made, see the <a href="%s">Site Health Status</a> page.' ), esc_url( admin_url( 'site-health.php' ) ) ); |
|
91 |
?> |
9
|
92 |
</p> |
|
93 |
<p> |
16
|
94 |
<?php _e( 'If you want to export a handy list of all the information on this page, you can use the button below to copy it to the clipboard. You can then paste it in a text file and save it to your device, or paste it in an email exchange with a support engineer or theme/plugin developer for example.' ); ?> |
9
|
95 |
</p> |
|
96 |
|
|
97 |
<div class="site-health-copy-buttons"> |
|
98 |
<div class="copy-button-wrapper"> |
|
99 |
<button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'debug' ) ); ?>"> |
|
100 |
<?php _e( 'Copy site info to clipboard' ); ?> |
|
101 |
</button> |
16
|
102 |
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> |
9
|
103 |
</div> |
|
104 |
</div> |
|
105 |
|
|
106 |
<div id="health-check-debug" class="health-check-accordion"> |
|
107 |
|
|
108 |
<?php |
|
109 |
|
|
110 |
$sizes_fields = array( 'uploads_size', 'themes_size', 'plugins_size', 'wordpress_size', 'database_size', 'total_size' ); |
|
111 |
|
|
112 |
foreach ( $info as $section => $details ) { |
|
113 |
if ( ! isset( $details['fields'] ) || empty( $details['fields'] ) ) { |
|
114 |
continue; |
|
115 |
} |
|
116 |
|
|
117 |
?> |
|
118 |
<h3 class="health-check-accordion-heading"> |
|
119 |
<button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" type="button"> |
|
120 |
<span class="title"> |
|
121 |
<?php echo esc_html( $details['label'] ); ?> |
|
122 |
<?php |
|
123 |
|
|
124 |
if ( isset( $details['show_count'] ) && $details['show_count'] ) { |
|
125 |
printf( '(%d)', count( $details['fields'] ) ); |
|
126 |
} |
|
127 |
|
|
128 |
?> |
|
129 |
</span> |
|
130 |
<?php |
|
131 |
|
|
132 |
if ( 'wp-paths-sizes' === $section ) { |
|
133 |
?> |
|
134 |
<span class="health-check-wp-paths-sizes spinner"></span> |
|
135 |
<?php |
|
136 |
} |
|
137 |
|
|
138 |
?> |
|
139 |
<span class="icon"></span> |
|
140 |
</button> |
|
141 |
</h3> |
|
142 |
|
|
143 |
<div id="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" class="health-check-accordion-panel" hidden="hidden"> |
|
144 |
<?php |
|
145 |
|
|
146 |
if ( isset( $details['description'] ) && ! empty( $details['description'] ) ) { |
|
147 |
printf( '<p>%s</p>', $details['description'] ); |
|
148 |
} |
|
149 |
|
|
150 |
?> |
|
151 |
<table class="widefat striped health-check-table" role="presentation"> |
|
152 |
<tbody> |
|
153 |
<?php |
|
154 |
|
|
155 |
foreach ( $details['fields'] as $field_name => $field ) { |
|
156 |
if ( is_array( $field['value'] ) ) { |
|
157 |
$values = '<ul>'; |
|
158 |
|
|
159 |
foreach ( $field['value'] as $name => $value ) { |
|
160 |
$values .= sprintf( '<li>%s: %s</li>', esc_html( $name ), esc_html( $value ) ); |
|
161 |
} |
|
162 |
|
|
163 |
$values .= '</ul>'; |
|
164 |
} else { |
|
165 |
$values = esc_html( $field['value'] ); |
|
166 |
} |
|
167 |
|
|
168 |
if ( in_array( $field_name, $sizes_fields, true ) ) { |
|
169 |
printf( '<tr><td>%s</td><td class="%s">%s</td></tr>', esc_html( $field['label'] ), esc_attr( $field_name ), $values ); |
|
170 |
} else { |
|
171 |
printf( '<tr><td>%s</td><td>%s</td></tr>', esc_html( $field['label'] ), $values ); |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 |
?> |
|
176 |
</tbody> |
|
177 |
</table> |
|
178 |
</div> |
|
179 |
<?php } ?> |
|
180 |
</div> |
|
181 |
</div> |
|
182 |
|
|
183 |
<?php |
16
|
184 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |