PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.7
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Modules / ServerInformation / ServerInfo_Server_Details.php

ServerInfo_Server_Details.php in Adminify – White Label, Admin Menu Editor, Login Customizer 2.0.7, at Inc/Modules/ServerInformation/ServerInfo_Server_Details.php

367 lines 19.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Modules\ServerInformation;
4
5 use WPAdminify\Inc\Classes\ServerInfo;
6 use WPAdminify\Inc\Utils;
7
8 // no direct access allowed
9 if (!defined('ABSPATH')) exit;
10
11 /**
12 * WPAdminify
13 * @package Server Information
14 *
15 * @author WP Adminify <support@wpadminify.com>
16 */
17
18 class ServerInfo_Server_Details
19 {
20
21 public function __construct()
22 {
23 $this->init();
24 }
25
26 public function init()
27 {
28
29 $server_info = new ServerInfo();
30
31 $help = '<span class="dashicons dashicons-editor-help"></span>';
32 $enabled = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Enabled', 'adminify') . '</span>';
33 $disabled = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Disabled', 'adminify') . '</span>';
34 $yes = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Yes', 'adminify') . '</span>';
35 $no = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('No', 'adminify') . '</span>';
36 $entered = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Defined', 'adminify') . '</span>';
37 $not_entered = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Not defined', 'adminify') . '</span>';
38 $sec_key = '<span class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__('Please enter this security key in the wp-confiq.php file', 'adminify') . '!</span>';
39
40 ?>
41
42 <div class="wrap">
43 <h1>
44 <?php echo Utils::admin_page_title(esc_html__('Server Info', 'adminify')); ?>
45 </h1>
46
47 <p><?php echo __('Interesting information about your web server. You can also use <a href="http://linfo.sourceforge.net/" target="_blank" rel="noopener">linfo</a> or <a href="https://phpsysinfo.github.io/phpsysinfo/" target="_blank" rel="noopener">phpsysinfo</a> to get more information about the web server', 'adminify'); ?>.</p>
48
49 <p><?php echo __('In the most cases you can modify some server settings like "PHP Memory Limit" or "PHP Post Max Size" by upload and modify a <code>php.ini</code> file in the WordPress <code>/wp-admin/</code> folder. Learn more about <a href="https://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/" target="_blank" rel="noopener">here</a>', 'adminify'); ?>.</p>
50
51
52 <table class="wp-list-table widefat posts mt-6">
53 <thead>
54 <tr>
55 <th style="width: 300px" class="manage-column"><?php echo esc_html__('Info', 'adminify'); ?></th>
56 <th class="manage-column"><?php echo esc_html__('Result', 'adminify'); ?></th>
57 </tr>
58 </thead>
59 <tbody>
60 <tr>
61 <td><?php esc_html_e('OS', 'adminify'); ?>:</td>
62 <td><?php echo PHP_OS; ?> / <?php echo (PHP_INT_SIZE * 8) . __('Bit OS', 'adminify') . ' (' . php_uname() . ')'; ?></td>
63 </tr>
64 <tr>
65 <td><?php esc_html_e('Software', 'adminify'); ?>:</td>
66 <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td>
67 </tr>
68 <tr>
69 <td><?php esc_html_e('IP Address', 'adminify'); ?>:</td>
70 <td><?php echo esc_html($_SERVER['SERVER_ADDR']); ?></td>
71 </tr>
72 <tr>
73 <td><?php esc_html_e('Web Port', 'adminify'); ?>:</td>
74 <td><?php echo $_SERVER['SERVER_PORT']; ?></td>
75 </tr>
76 <tr>
77 <td><?php esc_html_e('Date / Time (WP)', 'adminify'); ?>:</td>
78 <td><?php echo date('Y-m-d H:i:s', current_time('timestamp', 1)) . ' (' . current_time('mysql') . ')'; ?></td>
79 </tr>
80 <tr>
81 <td><?php esc_html_e('Timezone (WP)', 'adminify'); ?>:</td>
82 <td><?php echo date_default_timezone_get() . ' (' . $server_info->get_wp_timezone() . ')'; ?></td>
83 </tr>
84 <tr>
85 <td><?php esc_html_e('Default Timezone is UTC', 'adminify'); ?>:</td>
86 <td>
87 <?php $default_timezone = date_default_timezone_get();
88 if ('UTC' !== $default_timezone) {
89 echo $no . sprintf(__('Default timezone is %s - it should be UTC', 'adminify'), $default_timezone) . '</span>';
90 } else {
91 echo $yes;
92 } ?>
93 </td>
94 </tr>
95 <tr>
96 <td><?php esc_html_e('Protocol', 'adminify'); ?>:</td>
97 <td><?php echo php_uname('n'); ?></td>
98 </tr>
99 <tr>
100 <td><?php esc_html_e('Administrator', 'adminify'); ?>:</td>
101 <td><?php //echo $_SERVER['SERVER_ADMIN'];
102 ?></td>
103 </tr>
104 <tr>
105 <td><?php esc_html_e('CGI Version', 'adminify'); ?>:</td>
106 <td><?php echo $_SERVER['GATEWAY_INTERFACE']; ?></td>
107 </tr>
108 <tr class="table-border-top">
109 <td><?php esc_html_e('CPU Total', 'adminify'); ?>:</td>
110 <td><?php echo $server_info->check_cpu_count() . ' / ' . $server_info->check_core_count() . ' ' . esc_html__('Cores', 'adminify'); ?></td>
111 </tr>
112 <tr>
113 <td><?php esc_html_e('CPU Usage', 'adminify'); ?>:</td>
114 <td>
115 <div class="adminify-system-progress">
116 <div class="status-progressbar">
117 <span><?php echo $server_info->get_server_cpu_load_percentage() . '% '; ?></span>
118 <div style="width: <?php echo $server_info->get_server_cpu_load_percentage(); ?>%"></div>
119 </div>
120 </div>
121 </td>
122 </tr>
123 <tr>
124 <td><?php esc_html_e('CPU Load Average', 'adminify'); ?>:</td>
125 <td><?php echo $server_info->get_cpu_load_average(); ?></td>
126 </tr>
127 <tr>
128 <td><?php esc_html_e('Disk Space', 'adminify'); ?>:</td>
129 <td>
130 <?php $disk_space = $server_info->get_server_disk_size();
131 if ($disk_space != 'N/A') {
132 echo esc_html__('Total', 'adminify') . ': ' . esc_html($disk_space['size']) . ' GB / ' . esc_html__('Free', 'adminify') . ': ' . esc_html($disk_space['free']) . ' GB / ' . esc_html__('Used', 'adminify') . ': ' . esc_html($disk_space['used']) . ' GB';
133 } else {
134 echo esc_html($disk_space);
135 } ?>
136 </td>
137 </tr>
138 <tr>
139 <td><?php esc_html_e('Disk Space Usage', 'adminify'); ?>:</td>
140 <td>
141 <?php $disk_space = $server_info->get_server_disk_size();
142 if ($disk_space != 'N/A') { ?>
143 <div class="status-progressbar">
144 <span><?php echo esc_html($disk_space['usage'] . '% '); ?></span>
145 <div style="width: <?php echo $disk_space['usage']; ?>%"></div>
146 </div>
147 <?php echo esc_html(' ' . $disk_space['used'] . ' GB of ' . $disk_space['size'] . ' GB');
148 } else {
149 echo esc_html($disk_space);
150 } ?>
151 </td>
152 </tr>
153 <tr>
154 <td><?php esc_html_e('Memory (RAM) Total', 'adminify'); ?>:</td>
155 <td>
156 <?php $server_ram = $server_info->get_server_ram_details();
157 if ($server_ram != 'N/A') {
158 echo esc_html($server_ram['MemTotal']) . ' GB';
159 } else {
160 echo esc_html($server_ram);
161 } ?>
162 </td>
163 </tr>
164 <tr>
165 <td><?php esc_html_e('Memory (RAM) Free', 'adminify'); ?>:</td>
166 <td>
167 <?php $server_ram = $server_info->get_server_ram_details();
168 if ($server_ram != 'N/A') {
169 echo esc_html($server_ram['MemFree']) . ' GB';
170 } else {
171 echo esc_html($server_ram);
172 } ?>
173 </td>
174 </tr>
175 <tr>
176 <td><?php esc_html_e('Memory (RAM) Usage', 'adminify'); ?>:</td>
177 <td>
178 <?php $server_ram = $server_info->get_server_ram_details();
179 if ($server_ram != 'N/A') { ?>
180 <div class="status-progressbar">
181 <span>
182 <?php echo esc_html($server_ram['MemUsagePercentage'] . '% '); ?>
183 </span>
184 <div style="width: <?php echo $server_ram['MemUsagePercentage']; ?>%"></div>
185 </div>
186 <?php echo esc_html(' ' . ($server_ram['MemTotal'] - $server_ram['MemFree']) . ' GB of ' . $server_ram['MemTotal'] . ' GB');
187 } else {
188 echo esc_html($server_ram);
189 } ?>
190 </td>
191 </tr>
192 <tr>
193 <td><?php esc_html_e('Memcached', 'adminify'); ?>:</td>
194 <td>
195 <?php if (extension_loaded('memcache')) :
196 echo $yes;
197 else :
198 echo $no;
199 endif; ?>
200 </td>
201 </tr>
202 <tr>
203 <td><?php esc_html_e('Uptime', 'adminify'); ?>:</td>
204 <td><?php echo $server_info->get_server_uptime(); ?></td>
205 </tr>
206 <tr class="table-border-top">
207 <td><?php esc_html_e('PHP Version', 'adminify'); ?>:</td>
208 <td><?php echo $server_info->get_php_version(); ?></td>
209 </tr>
210 <?php if (function_exists('ini_get')) : ?>
211 <tr>
212 <td><?php esc_html_e('PHP Memory Limit (WP)', 'adminify'); ?>:</td>
213 <td><?php echo $server_info->get_wp_memory_limit(); ?></td>
214 </tr>
215 <tr>
216 <td><?php esc_html_e('PHP Memory Usage', 'adminify'); ?>:</td>
217 <td>
218 <?php if ($server_info->get_server_memory_usage()['MemLimitGet'] == '-1') { ?>
219 <?php echo $server_info->get_server_memory_usage()['MemUsageFormat'] . ' ' . esc_html__('of', 'adminify') . ' ' . esc_html__('Unlimited', 'adminify') . ' (-1)'; ?>
220 <?php } else { ?>
221 <?php echo $server_info->get_server_memory_usage()['MemUsageFormat'] . ' ' . esc_html__('of', 'adminify') . ' ' . $server_info->get_server_memory_usage()['MemLimitFormat']; ?>
222
223 <div class="adminify-system-progress">
224 <div class="status-progressbar"><span><?php echo $server_info->get_server_memory_usage()['MemUsageCalc'] . '% '; ?></span>
225 <div style="width: <?php echo $server_info->get_server_memory_usage()['MemUsageCalc']; ?>%"></div>
226 </div>
227 </div>
228
229 <?php } ?>
230 </td>
231 </tr>
232 <tr>
233 <td><?php esc_html_e('PHP Max Upload Size (WP)', 'adminify'); ?>:</td>
234 <td><?php echo (int)ini_get('upload_max_filesize') . ' MB (' . size_format(wp_max_upload_size()) . ')'; ?></td>
235 </tr>
236 <tr>
237 <td><?php esc_html_e('PHP Post Max Size', 'adminify'); ?>:</td>
238 <td><?php echo size_format($server_info->convert_memory_size(ini_get('post_max_size'))); ?></td>
239 </tr>
240 <tr>
241 <td><?php esc_html_e('PHP Max Input Vars', 'adminify'); ?>:</td>
242 <td><?php echo ini_get('max_input_vars'); ?></td>
243 </tr>
244 <tr>
245 <td><?php esc_html_e('PHP Max Execution Time', 'adminify'); ?>:</td>
246 <td><?php echo ini_get('max_execution_time') . ' ' . esc_html__('Seconds', 'adminify'); ?></td>
247 </tr>
248 <tr>
249 <td><?php esc_html_e('PHP Extensions', 'adminify'); ?>:</td>
250 <td><?php echo esc_html(implode(', ', get_loaded_extensions())); ?></td>
251 </tr>
252 <tr>
253 <td><?php esc_html_e('GD Library', 'adminify'); ?>:</td>
254 <td>
255 <?php $gdl = gd_info();
256 if ($gdl) {
257 echo $yes . ' / ' . esc_html__('Version', 'adminify') . ': ' . $gdl['GD Version'];
258 } else {
259 echo $no;
260 } ?>
261 </td>
262 </tr>
263 <tr>
264 <td><?php esc_html_e('cURL Version', 'adminify'); ?>:</td>
265 <td><?php echo $server_info->get_cURL_version(); ?></td>
266 </tr>
267 <tr>
268 <td><?php esc_html_e('SUHOSIN Installed', 'adminify'); ?>:</td>
269 <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '&ndash;'; ?></td>
270 </tr>
271 <?php endif; ?>
272 <?php if (function_exists('ini_get')) : ?>
273 <tr>
274 <td><?php esc_html_e('PHP Error Log File Location', 'adminify'); ?>:</td>
275 <td><?php echo ini_get('error_log'); ?></td>
276 </tr>
277 <?php endif; ?>
278
279 <?php $fields = array();
280
281 // fsockopen/cURL.
282 $fields['fsockopen_curl']['name'] = 'fsockopen/cURL';
283
284 if (function_exists('fsockopen') || function_exists('curl_init')) {
285 $fields['fsockopen_curl']['success'] = true;
286 } else {
287 $fields['fsockopen_curl']['success'] = false;
288 }
289
290 // SOAP.
291 $fields['soap_client']['name'] = 'SoapClient';
292
293 if (class_exists('SoapClient')) {
294 $fields['soap_client']['success'] = true;
295 } else {
296 $fields['soap_client']['success'] = false;
297 $fields['soap_client']['note'] = sprintf(__('Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'bsi'), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>');
298 }
299
300 // DOMDocument.
301 $fields['dom_document']['name'] = 'DOMDocument';
302
303 if (class_exists('DOMDocument')) {
304 $fields['dom_document']['success'] = true;
305 } else {
306 $fields['dom_document']['success'] = false;
307 $fields['dom_document']['note'] = sprintf(__('Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'bsi'), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>');
308 }
309
310 // GZIP.
311 $fields['gzip']['name'] = 'GZip';
312
313 if (is_callable('gzopen')) {
314 $fields['gzip']['success'] = true;
315 } else {
316 $fields['gzip']['success'] = false;
317 $fields['gzip']['note'] = sprintf(__('Your server does not support the %s function - this is required to use the GeoIP database from MaxMind.', 'bsi'), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>');
318 }
319
320 // Multibyte String.
321 $fields['mbstring']['name'] = 'Multibyte String';
322
323 if (extension_loaded('mbstring')) {
324 $fields['mbstring']['success'] = true;
325 } else {
326 $fields['mbstring']['success'] = false;
327 $fields['mbstring']['note'] = sprintf(__('Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'bsi'), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>');
328 }
329
330 // Remote Get.
331 $fields['remote_get']['name'] = 'Remote Get Status';
332
333 $response = wp_remote_get('https://www.paypal.com/cgi-bin/webscr', array(
334 'timeout' => 60,
335 'user-agent' => 'BSI/' . 1.0,
336 'httpversion' => '1.1',
337 'body' => array(
338 'cmd' => '_notify-validate'
339 )
340 ));
341 $response_code = wp_remote_retrieve_response_code($response);
342 if ($response_code == 200) {
343 $fields['remote_get']['success'] = true;
344 } else {
345 $fields['remote_get']['success'] = false;
346 }
347
348 foreach ($fields as $field) {
349 $mark = !empty($field['success']) ? 'yes' : 'error'; ?>
350 <tr>
351 <td data-export-label="<?php echo esc_html($field['name']); ?>"><?php echo esc_html($field['name']); ?>:</td>
352 <td>
353 <span class="<?php echo $mark; ?>">
354 <?php echo !empty($field['success']) ? $yes : $no; ?> <?php echo !empty($field['note']) ? wp_kses_data($field['note']) : ''; ?>
355 </span>
356 </td>
357 </tr>
358 <?php } ?>
359 </tbody>
360 </table>
361 </div>
362
363
364 <?php
365 }
366 }
367