PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.1.3
Adminify – White Label, Admin Menu Editor, Login Customizer v4.1.3
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_WP_Details.php

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

381 lines 15.8 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' ) ) {
10 exit;
11 }
12
13 /**
14 * WPAdminify
15 *
16 * @package Server Information
17 *
18 * @author WP Adminify <support@wpadminify.com>
19 */
20
21 class ServerInfo_WP_Details {
22
23
24 public function __construct() {
25 $this->init();
26 }
27
28 public function init() {
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 <div class="wrap">
42 <h1><?php echo Utils::admin_page_title( esc_html__( 'Site Information', 'adminify' ) ); ?></h1>
43 </div>
44
45
46 <p><?php echo wp_kses_post( 'First, you can see the most important information about your WordPress installation at a glance. Learn more about the <a href="https://wordpress.org/about/requirements/" target="_blank" rel="noopener">requirements</a>' ); ?>.</p>
47 </br>
48
49 <table class="wp-list-table widefat posts mt-5">
50 <thead>
51 <tr>
52 <th width="35%" class="manage-column"><?php esc_html_e( 'Info', 'adminify' ); ?></th>
53 <th class="manage-column"><?php esc_html_e( 'Result', 'adminify' ); ?></th>
54 </tr>
55 </thead>
56 <tbody>
57 <tr>
58 <td width="35%"><?php esc_html_e( 'WP Version', 'adminify' ); ?>:</td>
59 <td><strong><?php bloginfo( 'version' ); ?></strong></td>
60 </tr>
61
62 <tr>
63 <td><?php esc_html_e( 'PHP Version', 'adminify' ); ?>:</td>
64 <td><?php echo Utils::wp_kses_custom( $server_info->get_php_version() ); ?></td>
65 </tr>
66
67 <tr>
68 <td><?php esc_html_e( 'MySQL Version', 'adminify' ); ?>:</td>
69 <td><?php echo Utils::wp_kses_custom( $server_info->get_mysql_version() ); ?></td>
70 </tr>
71
72 <tr>
73 <td><?php esc_html_e( 'PHP Memory WP-Limit', 'adminify' ); ?>:</td>
74 <td>
75 <?php
76 $memory = $server_info->convert_memory_size( WP_MEMORY_LIMIT );
77
78 if ( $memory < 67108864 ) {
79 // echo '<span class="warning"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - For better performance, we recommend setting memory to at least 64MB. See: %2$s', 'adminify' ), size_format( $memory ), '<a href="https://wordpress.org/support/article/editing-wp-config-php/#increasing-memory-allocated-to-php" target="_blank" rel="noopener">' . __( 'Increasing memory allocated to PHP', 'adminify' ) . '</a>' ) . '</span>';
80
81 echo sprintf(
82 wp_kses_post( '<span class="warning"><span class="dashicons dashicons-warning"></span> %1$s - For better performance, we recommend setting memory to at least 64MB. See: <a href="https://wordpress.org/support/article/editing-wp-config-php/#increasing-memory-allocated-to-php" target="_blank" rel="noopener">%2$s</a></span>' ),
83 esc_html(size_format( $memory )),
84 esc_html__( 'Increasing memory allocated to PHP', 'adminify' )
85 );
86 } else {
87 echo '<strong>' . esc_html( size_format( $memory ) ) . '</strong>';
88 }
89 ?>
90 </td>
91 </tr>
92
93 <tr>
94 <td><?php esc_html_e( 'PHP Memory Server-Limit', 'adminify' ); ?>:</td>
95 <td>
96 <?php
97 if ( function_exists( 'memory_get_usage' ) ) {
98 $system_memory = $server_info->convert_memory_size( @ini_get( 'memory_limit' ) );
99 $memory = max( $memory, $system_memory );
100 }
101
102 if ( $memory < 67108864 ) {
103 // echo '<span class="warning"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - For better performance, we recommend setting memory to at least 64MB. See: %2$s', 'adminify' ), esc_html( size_format( $memory ) ), '<a href="https://wordpress.org/support/article/editing-wp-config-php/#increasing-memory-allocated-to-php" target="_blank" rel="noopener">' . __( 'Increasing memory allocated to PHP', 'adminify' ) . '</a>' ) . '</span>';
104
105 echo sprintf(
106 wp_kses_post('<span class="warning"><span class="dashicons dashicons-warning"></span>%1$s - For better performance, we recommend setting memory to at least 64MB. See: <a href="https://wordpress.org/support/article/editing-wp-config-php/#increasing-memory-allocated-to-php" target="_blank" rel="noopener">%2$s</a></span>'),
107 esc_html( size_format( $memory )),
108 esc_html__( 'Increasing memory allocated to PHP', 'adminify' )
109 );
110 } else {
111 echo '<strong>' . esc_html( size_format( $memory ) ) . '</strong>';
112 }
113 ?>
114 </td>
115 </tr>
116
117 <tr>
118 <td><?php esc_html_e( 'PHP Memory WP-Usage', 'adminify' ); ?>:</td>
119 <td>
120 <?php
121 if ( $server_info->get_wp_memory_usage()['MemLimitGet'] == '-1' ) {
122 echo Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . esc_html__( 'Unlimited', 'adminify' ) . ' (-1)';
123 } else {
124 echo Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemLimitFormat'] );
125 ?>
126
127 <div class="adminify-system-progress">
128 <div class="status-progressbar">
129 <span><?php echo Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemUsageCalc'] ) . '% '; ?></span>
130 <div style="width: <?php echo Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemUsageCalc'] ); ?>%"></div>
131 </div>
132 </div>
133 <?php } ?>
134 </td>
135 </tr>
136
137 <tr>
138 <td><?php esc_html_e( 'PHP Memory Server-Usage', 'adminify' ); ?>:</td>
139 <td>
140 <?php
141 if ( $server_info->get_server_memory_usage()['MemLimitGet'] == '-1' ) {
142 echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . esc_html__( 'Unlimited', 'adminify' ) . ' (-1)';
143 } else {
144 echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemLimitFormat'] );
145 ?>
146 <div class="adminify-system-progress">
147 <div class="status-progressbar">
148 <span><?php echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageCalc'] ) . '% '; ?></span>
149 <div style="width: <?php echo esc_attr( $server_info->get_server_memory_usage()['MemUsageCalc'] ); ?>%"></div>
150 </div>
151 </div>
152 <?php } ?>
153 </td>
154 </tr>
155
156 <tr>
157 <td><?php esc_html_e( 'PHP Max Upload Size (WP)', 'adminify' ); ?>:</td>
158 <td><?php echo esc_html( (int) ini_get( 'upload_max_filesize' ) . ' MB (' . size_format( wp_max_upload_size() ) . ')' ); ?></td>
159 </tr>
160
161 <tr>
162 <td><?php esc_html_e( 'WP Home URL', 'adminify' ); ?>:</td>
163 <td><?php echo esc_html( get_home_url() ); ?></td>
164 </tr>
165
166 <tr>
167 <td><?php esc_html_e( 'WP Site URL', 'adminify' ); ?>:</td>
168 <td><?php echo esc_html( get_site_url() ); ?></td>
169 </tr>
170
171 <tr>
172 <td><?php esc_html_e( 'Document Root', 'adminify' ); ?>:</td>
173 <td><?php echo esc_html( get_home_path() ); ?></td>
174 </tr>
175 </tbody>
176 </table>
177
178 <h2 class="pt-5"><?php echo esc_html__( 'Current Theme', 'adminify' ); ?></h2>
179
180 <table class="wp-list-table widefat posts">
181 <thead>
182 <tr>
183 <th width="35%" class="manage-column"><?php echo esc_html__( 'Info', 'adminify' ); ?></th>
184 <th class="manage-column"><?php echo esc_html__( 'Result', 'adminify' ); ?></th>
185 </tr>
186 </thead>
187
188 <tbody>
189 <?php
190 include_once ABSPATH . 'wp-admin/includes/theme-install.php';
191 $active_theme = wp_get_theme();
192 $theme_version = $active_theme->Version;
193 ?>
194 <tr>
195 <td><?php esc_html_e( 'Name', 'adminify' ); ?>:</td>
196 <td><?php echo wp_kses_post( $active_theme->Name ); ?></td>
197 </tr>
198
199 <tr>
200 <td><?php esc_html_e( 'Version', 'adminify' ); ?>:</td>
201 <td>
202 <?php echo esc_html( $theme_version ); ?>
203 </td>
204 </tr>
205
206 <tr>
207 <td><?php esc_html_e( 'Author URL', 'adminify' ); ?>:</td>
208 <td><?php echo esc_url( $active_theme->{'Author URI'} ); ?></td>
209 </tr>
210
211 <tr>
212 <td><?php esc_html_e( 'Image Sizes', 'adminify' ); ?>:</td>
213 <td><?php echo esc_html( implode( ', ', get_intermediate_image_sizes() ) ); ?></td>
214 </tr>
215
216 <tr>
217 <td><?php esc_html_e( 'WooCommerce Compatibility', 'adminify' ); ?>:</td>
218 <td>
219 <?php
220 if ( current_theme_supports( 'woocommerce' ) ) {
221 echo wp_kses_post( $yes );
222 } else {
223 echo wp_kses_post( $no );
224 }
225 ?>
226 </td>
227 </tr>
228
229 <tr>
230 <td><?php esc_html_e( 'Child Theme', 'adminify' ); ?>: <a href="https://developer.wordpress.org/themes/advanced-topics/child-themes/" target="_blank" rel="noopener"><?php echo wp_kses_post( $help ); ?></a></td>
231 <td>
232 <?php
233 // echo is_child_theme() ? '<span class="yes"><span class="dashicons dashicons-yes"></span>Yes</span>' : '<span class="warning"><span class="dashicons dashicons-warning"></span> No. ' . sprintf( __( 'If you\'re want to modifying a theme, it safe to create a child theme. See: <a href="%s" target="_blank" rel="noopener">How to create a child theme</a>', 'adminify' ), 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) . '</span>';
234 ?>
235
236 <?php echo is_child_theme() ?
237 wp_kses_post('<span class="yes"><span class="dashicons dashicons-yes"></span>Yes</span>'):
238 sprintf(
239 wp_kses_post('<span class="warning"><span class="dashicons dashicons-warning"></span> No. If you\'re want to modifying a theme, it safe to create a child theme. See: <a href="%1$s" target="_blank" rel="noopener">%2$s</a></span>'),
240 esc_url('https://developer.wordpress.org/themes/advanced-topics/child-themes/'),
241 esc_html__('How to create a child theme','adminify')
242 );
243 ?>
244 </td>
245 </tr>
246
247 <?php
248 if ( is_child_theme() ) {
249 $parent_theme = wp_get_theme()->parent();
250 ?>
251 <tr>
252 <td><?php esc_html_e( 'Parent Theme Name', 'adminify' ); ?>:</td>
253 <td>
254 <?php
255 if ( ! empty( $parent_theme ) ) {
256 echo esc_html( $parent_theme->Name );}
257 ?>
258 </td>
259 </tr>
260 <tr>
261 <td><?php esc_html_e( 'Parent Theme Version', 'adminify' ); ?>:</td>
262 <td>
263 <?php
264 if ( ! empty( $parent_theme ) ) {
265 echo esc_html( $parent_theme->Version );}
266 if ( version_compare( $parent_theme->Version, $update_theme_version, '<' ) ) {
267 // echo ' &ndash; <strong style="color:red;">' . sprintf( __( '%s is available', 'adminify' ), esc_html( $update_theme_version ) ) . '</strong>';
268 echo sprintf(
269 wp_kses_post(' &ndash; <strong style="color:red;"> %s is available</strong>'),
270 esc_html( $update_theme_version )
271 );
272 }
273 ?>
274 </td>
275 </tr>
276 <tr>
277 <td><?php esc_html_e( 'Parent Theme Author URL', 'adminify' ); ?>:</td>
278 <td>
279 <?php
280 if ( ! empty( $parent_theme ) ) {
281 echo esc_url( $parent_theme->{'Author URI'} );}
282 ?>
283 </td>
284 </tr>
285 <?php } //is_child_theme ?>
286
287 </tbody>
288 </table>
289
290 <div class="adminify-flex-center adminify-justify-between">
291 <h2 class="is-pulled-left pt-5"><?php echo esc_html__( 'Active Plugins', 'adminify' ); ?></h2>
292
293 <button class="adminify-copy-btn adminify-btn adminify-btn-primary is-pulled-right" data-text="COPY" data-text-copied="COPIED">
294 <span class="icon icon-copy dashicons dashicons-admin-page"></span>
295 <span><?php esc_html_e( 'COPY', 'adminify' ); ?></span>
296 </button>
297 </div>
298
299
300 <table class="wp-list-table widefat posts adminify-active-plugins-data">
301 <thead>
302 <tr>
303 <th width="35%" class="manage-column"><?php echo esc_html__( 'Name', 'adminify' ); ?></th>
304 <th class="manage-column"><?php echo esc_html__( 'Version', 'adminify' ); ?></th>
305 <th width="35%" class="manage-column"><?php echo esc_html__( 'Author', 'adminify' ); ?></th>
306 </tr>
307 </thead>
308 <tbody>
309 <?php
310 $active_plugins = (array) get_option( 'active_plugins', [] );
311
312 if ( is_multisite() ) {
313 $network_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', [] ) );
314 $active_plugins = array_merge( $active_plugins, $network_activated_plugins );
315 }
316
317 foreach ( $active_plugins as $plugin ) {
318 $plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
319 $dirname = dirname( $plugin );
320 $version_string = '';
321 $network_string = '';
322
323 if ( ! empty( $plugin_data['Name'] ) ) {
324
325 // Link the plugin name to the plugin url if available.
326 $plugin_name = esc_html( $plugin_data['Name'] );
327
328 if ( ! empty( $plugin_data['PluginURI'] ) ) {
329 $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage', 'adminify' ) . '" target="_blank" rel="noopener">' . $plugin_name . '</a>';
330 }
331
332 if ( strstr( $dirname, 'adminify-' ) && strstr( $plugin_data['PluginURI'], 'woothemes.com' ) ) {
333 if ( false === ( $version_data = get_transient( md5( $plugin ) . '_version_data' ) ) ) {
334 $changelog = wp_safe_remote_get( 'http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $dirname . '/changelog.txt' );
335 $cl_lines = explode( "\n", wp_remote_retrieve_body( $changelog ) );
336 if ( ! empty( $cl_lines ) ) {
337 foreach ( $cl_lines as $line_num => $cl_line ) {
338 if ( preg_match( '/^[0-9]/', $cl_line ) ) {
339 $date = str_replace( '.', '-', trim( substr( $cl_line, 0, strpos( $cl_line, '-' ) ) ) );
340 $version = preg_replace( '~[^0-9,.]~', '', stristr( $cl_line, 'version' ) );
341 $update = trim( str_replace( '*', '', $cl_lines[ $line_num + 1 ] ) );
342 $version_data = [
343 'date' => $date,
344 'version' => $version,
345 'update' => $update,
346 'changelog' => $changelog,
347 ];
348 set_transient( md5( $plugin ) . '_version_data', $version_data, DAY_IN_SECONDS );
349 break;
350 }
351 }
352 }
353 }
354
355 if ( ! empty( $version_data['version'] ) && version_compare( $version_data['version'], $plugin_data['Version'], '>' ) ) {
356 $version_string = ' &ndash; <strong style="color:red;">' . esc_html( sprintf( _x( '%s is available', 'Version info', 'adminify' ), $version_data['version'] ) ) . '</strong>';
357 }
358
359 if ( $plugin_data['Network'] != false ) {
360 $network_string = ' &ndash; <strong style="color:black;">' . __( 'Network enabled', 'adminify' ) . '</strong>';
361 }
362 }
363 ?>
364 <tr>
365 <td><?php echo wp_kses_post( $plugin_name ); ?></td>
366 <td><?php echo esc_html( $plugin_data['Version'] ) .wp_kses_post( $version_string) . wp_kses_post($network_string); ?></td>
367 <td><?php echo sprintf( esc_html__( '%s', 'by author', 'adminify' ), wp_kses_post($plugin_data['Author']) ); ?></td>
368 </tr>
369 <?php
370 }
371 }
372 ?>
373 </tbody>
374 </table>
375
376
377 <?php
378
379 }
380 }
381