| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\DashboardWidgets; |
| 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 |
* System Info Dashboard Widget |
| 15 |
* |
| 16 |
* @return void |
| 17 |
*/ |
| 18 |
/** |
| 19 |
* WPAdminify |
| 20 |
* |
| 21 |
* @author Jewel Theme <support@jeweltheme.com> |
| 22 |
*/ |
| 23 |
|
| 24 |
class Adminify_SystemInfo { |
| 25 |
|
| 26 |
public function __construct() { |
| 27 |
add_action( 'wp_dashboard_setup', [ $this, 'jltwp_adminify_register' ] ); |
| 28 |
} |
| 29 |
public function jltwp_adminify_register() { |
| 30 |
wp_add_dashboard_widget( |
| 31 |
'jltwp_adminify_dash_system_info', |
| 32 |
esc_html__( 'System Info - Adminify', 'adminify' ), |
| 33 |
[ $this, 'jltwp_adminify_widget_details' ] |
| 34 |
); |
| 35 |
} |
| 36 |
|
| 37 |
public function jltwp_adminify_widget_details() { |
| 38 |
$server_info = new ServerInfo(); |
| 39 |
?> |
| 40 |
|
| 41 |
|
| 42 |
<div class="wp-adminify-server-info"> |
| 43 |
<div class="table listing"> |
| 44 |
<table> |
| 45 |
<tr> |
| 46 |
<td><?php esc_html_e( 'WP Version', 'adminify' ); ?>:</td> |
| 47 |
<td><strong><?php bloginfo( 'version' ); ?></strong></td> |
| 48 |
</tr> |
| 49 |
<tr> |
| 50 |
<td><?php esc_html_e( 'PHP Version', 'adminify' ); ?>:</td> |
| 51 |
<td><strong><?php echo Utils::wp_kses_custom( $server_info->get_php_version() ); ?></strong></td> |
| 52 |
</tr> |
| 53 |
<tr> |
| 54 |
<td><?php esc_html_e( 'MySQL Version', 'adminify' ); ?>:</td> |
| 55 |
<td><strong><?php echo Utils::wp_kses_custom( $server_info->get_mysql_version() ); ?></strong></td> |
| 56 |
</tr> |
| 57 |
<tr> |
| 58 |
<td><?php esc_html_e( 'Database Software', 'adminify' ); ?>:</td> |
| 59 |
<td><strong><?php echo Utils::wp_kses_custom( $server_info->get_db_software() ); ?></strong></td> |
| 60 |
</tr> |
| 61 |
<tr> |
| 62 |
<td><?php esc_html_e( 'PHP Memory Server-Limit', 'adminify' ); ?>:</td> |
| 63 |
<td><?php echo '<strong>' . Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemLimitFormat'] ) . '</strong>'; ?></td> |
| 64 |
</tr> |
| 65 |
<tr> |
| 66 |
<td><?php esc_html_e( 'PHP Memory Server-Usage', 'adminify' ); ?>:</td> |
| 67 |
|
| 68 |
<td> |
| 69 |
<?php if ( $server_info->get_server_memory_usage()['MemLimitGet'] == '-1' ) { ?> |
| 70 |
<strong><?php echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . esc_html__( 'Unlimited', 'adminify' ) . ' (-1)'; ?></strong> |
| 71 |
<?php } else { ?> |
| 72 |
<strong><?php 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'] ); ?></strong> |
| 73 |
<br> |
| 74 |
<div class="adminify-system-progress"> |
| 75 |
<div class="status-progressbar"><span><?php echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageCalc'] ) . '% '; ?></span> |
| 76 |
<div style="width: <?php echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageCalc'] ); ?>%"></div> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
<?php } ?> |
| 80 |
</td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<td><?php esc_html_e( 'PHP Memory WP-Limit', 'adminify' ); ?>:</td> |
| 84 |
<td><?php echo '<strong>' . Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemLimitFormat'] ) . '</strong>'; ?></td> |
| 85 |
</tr> |
| 86 |
<tr> |
| 87 |
<td><?php esc_html_e( 'PHP Memory WP-Usage', 'adminify' ); ?>:</td> |
| 88 |
<td> |
| 89 |
<?php if ( $server_info->get_wp_memory_usage()['MemLimitGet'] == '-1' ) { ?> |
| 90 |
<strong><?php echo Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . esc_html__( 'Unlimited', 'adminify' ) . ' (-1)'; ?></strong> |
| 91 |
<?php } else { ?> |
| 92 |
<strong><?php 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'] ); ?></strong> |
| 93 |
|
| 94 |
<div class="adminify-system-progress"> |
| 95 |
<div class="status-progressbar"><span><?php echo Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemUsageCalc'] ) . '% '; ?></span> |
| 96 |
<div style="width: <?php echo Utils::wp_kses_custom( $server_info->get_wp_memory_usage()['MemUsageCalc'] ); ?>%"></div> |
| 97 |
</div> |
| 98 |
</div> |
| 99 |
<?php } ?> |
| 100 |
</td> |
| 101 |
</tr> |
| 102 |
<tr> |
| 103 |
<td><?php esc_html_e( 'PHP Max Upload Size (WP)', 'adminify' ); ?>:</td> |
| 104 |
<td><strong><?php echo esc_html( (int) ini_get( 'upload_max_filesize' ) . ' MB (' . size_format( wp_max_upload_size() ) . ')' ); ?></strong></td> |
| 105 |
|
| 106 |
</tr> |
| 107 |
<tr> |
| 108 |
<td> |
| 109 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=adminify-server-info' ) ); ?>"><span class="dashicons dashicons-dashboard"></span> <?php esc_html_e( 'Adminify System Info Details', 'adminify' ); ?></a> |
| 110 |
</td> |
| 111 |
</tr> |
| 112 |
</table> |
| 113 |
</div> |
| 114 |
</div> |
| 115 |
<?php |
| 116 |
|
| 117 |
} |
| 118 |
} |
| 119 |
|