PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.7
4.3.2 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 All 165 releases
adminify / Inc / Modules / ServerInformation / ServerInfo_WP_Details.php

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

305 lines 16.7 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_WP_Details
19 {
20
21 public function __construct()
22 {
23 $this->init();
24 }
25
26 public function init()
27 {
28
29
30 $server_info = new ServerInfo();
31
32 $help = '<span class="dashicons dashicons-editor-help"></span>';
33 $enabled = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Enabled', WP_ADMINIFY_TD) . '</span>';
34 $disabled = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Disabled', WP_ADMINIFY_TD) . '</span>';
35 $yes = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Yes', WP_ADMINIFY_TD) . '</span>';
36 $no = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('No', WP_ADMINIFY_TD) . '</span>';
37 $entered = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Defined', WP_ADMINIFY_TD) . '</span>';
38 $not_entered = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Not defined', WP_ADMINIFY_TD) . '</span>';
39 $sec_key = '<span class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__('Please enter this security key in the wp-confiq.php file', WP_ADMINIFY_TD) . '!</span>';
40 ?>
41
42 <div class="wrap">
43 <h1>
44 <?php echo Utils::admin_page_title(esc_html__('Site Information', WP_ADMINIFY_TD)); ?>
45 </h1>
46 </div>
47
48
49 <p><?php echo __('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>', WP_ADMINIFY_TD); ?>.</p>
50 </br>
51
52 <table class="wp-list-table widefat posts mt-5">
53 <thead>
54 <tr>
55 <th width="35%" class="manage-column"><?php esc_html_e('Info', WP_ADMINIFY_TD); ?></th>
56 <th class="manage-column"><?php esc_html_e('Result', WP_ADMINIFY_TD); ?></th>
57 </tr>
58 </thead>
59 <tbody>
60 <tr>
61 <td width="35%"><?php esc_html_e('WP Version', WP_ADMINIFY_TD); ?>:</td>
62 <td><strong><?php bloginfo('version'); ?></strong></td>
63 </tr>
64 <tr>
65 <td><?php esc_html_e('PHP Version', WP_ADMINIFY_TD); ?>:</td>
66 <td><?php echo $server_info->get_php_version(); ?></td>
67 </tr>
68 <tr>
69 <td><?php esc_html_e('MySQL Version', WP_ADMINIFY_TD); ?>:</td>
70 <td><?php echo $server_info->get_mysql_version(); ?></td>
71 </tr>
72 <tr>
73 <td><?php esc_html_e('PHP Memory WP-Limit', WP_ADMINIFY_TD); ?>:</td>
74 <td><?php
75 $memory = $server_info->convert_memory_size(WP_MEMORY_LIMIT);
76
77 if ($memory < 67108864) {
78 echo '<span class="warning"><span class="dashicons dashicons-warning"></span> ' . sprintf(__('%s - For better performance, we recommend setting memory to at least 64MB. See: %s', WP_ADMINIFY_TD), 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', WP_ADMINIFY_TD) . '</a>') . '</span>';
79 } else {
80 echo '<strong>' . size_format($memory) . '</strong>';
81 } ?>
82 </td>
83 </tr>
84 <tr>
85 <td><?php esc_html_e('PHP Memory Server-Limit', WP_ADMINIFY_TD); ?>:</td>
86 <td>
87 <?php
88 if (function_exists('memory_get_usage')) {
89 $system_memory = $server_info->convert_memory_size(@ini_get('memory_limit'));
90 $memory = max($memory, $system_memory);
91 }
92
93 if ($memory < 67108864) {
94 echo '<span class="warning"><span class="dashicons dashicons-warning"></span> ' . sprintf(__('%s - For better performance, we recommend setting memory to at least 64MB. See: %s', WP_ADMINIFY_TD), 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', WP_ADMINIFY_TD) . '</a>') . '</span>';
95 } else {
96 echo '<strong>' . size_format($memory) . '</strong>';
97 } ?>
98 </td>
99 </tr>
100 <tr>
101 <td><?php esc_html_e('PHP Memory WP-Usage', WP_ADMINIFY_TD); ?>:</td>
102 <td>
103 <?php if ($server_info->get_wp_memory_usage()['MemLimitGet'] == '-1') {
104 echo $server_info->get_wp_memory_usage()['MemUsageFormat'] . ' ' . esc_html__('of', WP_ADMINIFY_TD) . ' ' . esc_html__('Unlimited', WP_ADMINIFY_TD) . ' (-1)';
105 } else {
106 echo $server_info->get_wp_memory_usage()['MemUsageFormat'] . ' ' . esc_html__('of', WP_ADMINIFY_TD) . ' ' . $server_info->get_wp_memory_usage()['MemLimitFormat'];
107 ?>
108
109 <div class="adminify-system-progress">
110 <div class="status-progressbar">
111 <span><?php echo $server_info->get_wp_memory_usage()['MemUsageCalc'] . '% '; ?></span>
112 <div style="width: <?php echo $server_info->get_wp_memory_usage()['MemUsageCalc']; ?>%"></div>
113 </div>
114 </div>
115 <?php } ?>
116 </td>
117 </tr>
118 <tr>
119 <td><?php esc_html_e('PHP Memory Server-Usage', WP_ADMINIFY_TD); ?>:</td>
120 <td>
121 <?php if ($server_info->get_server_memory_usage()['MemLimitGet'] == '-1') {
122 echo $server_info->get_server_memory_usage()['MemUsageFormat'] . ' ' . esc_html__('of', WP_ADMINIFY_TD) . ' ' . esc_html__('Unlimited', WP_ADMINIFY_TD) . ' (-1)';
123 } else {
124 echo $server_info->get_server_memory_usage()['MemUsageFormat'] . ' ' . esc_html__('of', WP_ADMINIFY_TD) . ' ' . $server_info->get_server_memory_usage()['MemLimitFormat'];
125 ?>
126 <div class="adminify-system-progress">
127 <div class="status-progressbar">
128 <span><?php echo $server_info->get_server_memory_usage()['MemUsageCalc'] . '% '; ?></span>
129 <div style="width: <?php echo $server_info->get_server_memory_usage()['MemUsageCalc']; ?>%"></div>
130 </div>
131 </div>
132 <?php } ?>
133 </td>
134 </tr>
135 <tr>
136 <td><?php esc_html_e('PHP Max Upload Size (WP)', WP_ADMINIFY_TD); ?>:</td>
137 <td><?php echo (int)ini_get('upload_max_filesize') . ' MB (' . size_format(wp_max_upload_size()) . ')'; ?></td>
138 </tr>
139 <tr>
140 <td><?php esc_html_e('WP Home URL', WP_ADMINIFY_TD); ?>:</td>
141 <td><?php echo get_home_url(); ?></td>
142 </tr>
143 <tr>
144 <td><?php esc_html_e('WP Site URL', WP_ADMINIFY_TD); ?>:</td>
145 <td><?php echo get_site_url(); ?></td>
146 </tr>
147 <tr>
148 <td><?php esc_html_e('Document Root', WP_ADMINIFY_TD); ?>:</td>
149 <td><?php echo get_home_path(); ?></td>
150 </tr>
151 </tbody>
152 </table>
153
154 <h2 class="pt-5"><?php echo esc_html__('Current Theme', WP_ADMINIFY_TD); ?></h2>
155
156 <table class="wp-list-table widefat posts">
157 <thead>
158 <tr>
159 <th width="35%" class="manage-column"><?php echo esc_html__('Info', WP_ADMINIFY_TD); ?></th>
160 <th class="manage-column"><?php echo esc_html__('Result', WP_ADMINIFY_TD); ?></th>
161 </tr>
162 </thead>
163 <tbody>
164 <?php include_once(ABSPATH . 'wp-admin/includes/theme-install.php');
165 $active_theme = wp_get_theme();
166 $theme_version = $active_theme->Version; ?>
167 <tr>
168 <td><?php esc_html_e('Name', WP_ADMINIFY_TD); ?>:</td>
169 <td><?php echo esc_html($active_theme->Name); ?></td>
170 </tr>
171 <tr>
172 <td><?php esc_html_e('Version', WP_ADMINIFY_TD); ?>:</td>
173 <td>
174 <?php echo esc_html($theme_version); ?>
175 </td>
176 </tr>
177 <tr>
178 <td><?php esc_html_e('Author URL', WP_ADMINIFY_TD); ?>:</td>
179 <td><?php echo $active_theme->{'Author URI'}; ?></td>
180 </tr>
181 <tr>
182 <td><?php esc_html_e('Image Sizes', WP_ADMINIFY_TD); ?>:</td>
183 <td><?php echo implode(', ', get_intermediate_image_sizes()); ?></td>
184 </tr>
185 <tr>
186 <td><?php esc_html_e('WooCommerce Compatibility', WP_ADMINIFY_TD); ?>:</td>
187 <td>
188 <?php if (current_theme_supports('woocommerce')) {
189 echo $yes;
190 } else {
191 echo $no;
192 } ?>
193 </td>
194 </tr>
195 <tr>
196 <td><?php esc_html_e('Child Theme', WP_ADMINIFY_TD); ?>: <a href="https://developer.wordpress.org/themes/advanced-topics/child-themes/" target="_blank" rel="noopener"><?php echo $help; ?></a></td>
197 <td>
198 <?php 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>', WP_ADMINIFY_TD), 'https://developer.wordpress.org/themes/advanced-topics/child-themes/') . '</span>'; ?>
199 </td>
200 </tr>
201 <?php if (is_child_theme()) :
202 $parent_theme = wp_get_theme($active_theme->Template); ?>
203 <tr>
204 <td><?php esc_html_e('Parent Theme Name', WP_ADMINIFY_TD); ?>:</td>
205 <td><?php echo esc_html($parent_theme->Name); ?></td>
206 </tr>
207 <tr>
208 <td><?php esc_html_e('Parent Theme Version', WP_ADMINIFY_TD); ?>:</td>
209 <td>
210 <?php echo esc_html($parent_theme->Version);
211 if (version_compare($parent_theme->Version, $update_theme_version, '<')) {
212 echo ' &ndash; <strong style="color:red;">' . sprintf(__('%s is available', WP_ADMINIFY_TD), esc_html($update_theme_version)) . '</strong>';
213 } ?>
214 </td>
215 </tr>
216 <tr>
217 <td><?php esc_html_e('Parent Theme Author URL', WP_ADMINIFY_TD); ?>:</td>
218 <td><?php echo $parent_theme->{'Author URI'}; ?></td>
219 </tr>
220 <?php endif ?>
221 </tbody>
222 </table>
223
224 <h2 class="is-pulled-left pt-5"><?php echo esc_html__('Active Plugins', WP_ADMINIFY_TD); ?></h2>
225
226 <button class="adminify-copy-btn button is-pulled-right" data-text="COPY" data-text-copied="COPIED">
227 <span class="icon icon-copy dashicons dashicons-admin-page"></span>
228 <span>COPY</span>
229 </button>
230
231 <table class="wp-list-table widefat posts adminify-active-plugins-data">
232 <thead>
233 <tr>
234 <th width="35%" class="manage-column"><?php echo esc_html__('Name', WP_ADMINIFY_TD); ?></th>
235 <th class="manage-column"><?php echo esc_html__('Version', WP_ADMINIFY_TD); ?></th>
236 <th width="35%" class="manage-column"><?php echo esc_html__('Author', WP_ADMINIFY_TD); ?></th>
237 </tr>
238 </thead>
239 <tbody>
240 <?php $active_plugins = (array) get_option('active_plugins', array());
241
242 if (is_multisite()) {
243 $network_activated_plugins = array_keys(get_site_option('active_sitewide_plugins', array()));
244 $active_plugins = array_merge($active_plugins, $network_activated_plugins);
245 }
246
247 foreach ($active_plugins as $plugin) {
248
249 $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
250 $dirname = dirname($plugin);
251 $version_string = '';
252 $network_string = '';
253
254 if (!empty($plugin_data['Name'])) {
255
256 // Link the plugin name to the plugin url if available.
257 $plugin_name = esc_html($plugin_data['Name']);
258
259 if (!empty($plugin_data['PluginURI'])) {
260 $plugin_name = '<a href="' . esc_url($plugin_data['PluginURI']) . '" title="' . esc_attr__('Visit plugin homepage', WP_ADMINIFY_TD) . '" target="_blank" rel="noopener">' . $plugin_name . '</a>';
261 }
262
263 if (strstr($dirname, 'wphave-admin-') && strstr($plugin_data['PluginURI'], 'woothemes.com')) {
264
265 if (false === ($version_data = get_transient(md5($plugin) . '_version_data'))) {
266 $changelog = wp_safe_remote_get('http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $dirname . '/changelog.txt');
267 $cl_lines = explode("\n", wp_remote_retrieve_body($changelog));
268 if (!empty($cl_lines)) {
269 foreach ($cl_lines as $line_num => $cl_line) {
270 if (preg_match('/^[0-9]/', $cl_line)) {
271 $date = str_replace('.', '-', trim(substr($cl_line, 0, strpos($cl_line, '-'))));
272 $version = preg_replace('~[^0-9,.]~', '', stristr($cl_line, "version"));
273 $update = trim(str_replace("*", "", $cl_lines[$line_num + 1]));
274 $version_data = array('date' => $date, 'version' => $version, 'update' => $update, 'changelog' => $changelog);
275 set_transient(md5($plugin) . '_version_data', $version_data, DAY_IN_SECONDS);
276 break;
277 }
278 }
279 }
280 }
281
282 if (!empty($version_data['version']) && version_compare($version_data['version'], $plugin_data['Version'], '>')) {
283 $version_string = ' &ndash; <strong style="color:red;">' . esc_html(sprintf(_x('%s is available', 'Version info', WP_ADMINIFY_TD), $version_data['version'])) . '</strong>';
284 }
285
286 if ($plugin_data['Network'] != false) {
287 $network_string = ' &ndash; <strong style="color:black;">' . __('Network enabled', WP_ADMINIFY_TD) . '</strong>';
288 }
289 } ?>
290 <tr>
291 <td><?php echo $plugin_name; ?></td>
292 <td><?php echo esc_html($plugin_data['Version']) . $version_string . $network_string; ?></td>
293 <td><?php echo sprintf(_x('%s', 'by author', WP_ADMINIFY_TD), $plugin_data['Author']); ?></td>
294 </tr>
295 <?php }
296 } ?>
297 </tbody>
298 </table>
299
300
301 <?php
302
303 }
304 }
305