|
1
|
|
|
<?php namespace EmailLog\Core\UI\Page; |
|
2
|
|
|
|
|
3
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Settings Page. |
|
7
|
|
|
* This page is displayed only if any add-on has a setting enabled. |
|
8
|
|
|
* |
|
9
|
|
|
* @since 2.0.0 |
|
10
|
|
|
*/ |
|
11
|
|
|
class SystemInfoPage extends BasePage { |
|
12
|
|
|
const PAGE_SLUG = 'ststem_infos'; |
|
13
|
|
|
/** |
|
14
|
|
|
* Specify additional hooks. |
|
15
|
|
|
* |
|
16
|
|
|
* @inheritdoc |
|
17
|
|
|
*/ |
|
18
|
|
|
public function load() { |
|
19
|
|
|
parent::load(); |
|
20
|
|
|
|
|
21
|
|
|
add_action( 'admin_init', array( $this, 'register_settings' ) ); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Register settings and add setting sections and fields. |
|
26
|
|
|
*/ |
|
27
|
|
|
public function register_settings() { |
|
28
|
|
|
$sections = $this->get_setting_sections(); |
|
29
|
|
|
|
|
30
|
|
|
foreach ( $sections as $section ) { |
|
31
|
|
|
register_setting( |
|
32
|
|
|
self::PAGE_SLUG, |
|
33
|
|
|
$section->option_name, |
|
34
|
|
|
array( 'sanitize_callback' => $section->sanitize_callback ) |
|
35
|
|
|
); |
|
36
|
|
|
|
|
37
|
|
|
add_settings_section( |
|
38
|
|
|
$section->id, |
|
39
|
|
|
$section->title, |
|
40
|
|
|
$section->callback, |
|
41
|
|
|
self::PAGE_SLUG |
|
42
|
|
|
); |
|
43
|
|
|
|
|
44
|
|
|
foreach ( $section->fields as $field ) { |
|
45
|
|
|
add_settings_field( |
|
46
|
|
|
$section->id . '[' . $field->id . ']', |
|
47
|
|
|
$field->title, |
|
48
|
|
|
$field->callback, |
|
49
|
|
|
self::PAGE_SLUG, |
|
50
|
|
|
$section->id, |
|
51
|
|
|
$field->args |
|
52
|
|
|
); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Get a list of setting sections defined. |
|
59
|
|
|
* An add-on can define a setting section. |
|
60
|
|
|
* |
|
61
|
|
|
* @return \EmailLog\Core\UI\Setting\SettingSection[] List of defined setting sections. |
|
62
|
|
|
*/ |
|
63
|
|
|
protected function get_setting_sections() { |
|
64
|
|
|
/** |
|
65
|
|
|
* Specify the list of setting sections in the settings page. |
|
66
|
|
|
* An add-on can add its own setting section by adding an instance of |
|
67
|
|
|
* SectionSection to the array. |
|
68
|
|
|
* |
|
69
|
|
|
* @since 2.0.0 |
|
70
|
|
|
* |
|
71
|
|
|
* @param \EmailLog\Core\UI\Setting\SettingSection[] List of SettingSections. |
|
72
|
|
|
*/ |
|
73
|
|
|
return apply_filters( 'el_setting_sections', array() ); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Register page. |
|
78
|
|
|
*/ |
|
79
|
|
|
public function register_page() { |
|
80
|
|
|
|
|
81
|
|
|
$sections = $this->get_setting_sections(); |
|
82
|
|
|
|
|
83
|
|
|
if ( empty( $sections ) ) { |
|
84
|
|
|
return; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
$this->page = add_submenu_page( |
|
88
|
|
|
LogListPage::PAGE_SLUG, |
|
89
|
|
|
__( 'System Info', 'email-log' ), |
|
90
|
|
|
__( 'System Info', 'email-log' ), |
|
91
|
|
|
'manage_options', |
|
92
|
|
|
self::PAGE_SLUG, |
|
93
|
|
|
array( $this, 'render_page' ) |
|
94
|
|
|
); |
|
95
|
|
|
|
|
96
|
|
|
add_action( "load-{$this->page}", array( $this, 'render_help_tab' ) ); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Get current theme name. |
|
101
|
|
|
* |
|
102
|
|
|
* @since 5.5.4 |
|
103
|
|
|
* |
|
104
|
|
|
* @return string Current theme name. |
|
105
|
|
|
*/ |
|
106
|
|
|
protected function el_get_current_theme_name() { |
|
107
|
|
|
if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
108
|
|
|
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
109
|
|
|
|
|
110
|
|
|
return $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
111
|
|
|
} else { |
|
112
|
|
|
$theme_data = wp_get_theme(); |
|
113
|
|
|
|
|
114
|
|
|
return $theme_data->Name . ' ' . $theme_data->Version; |
|
115
|
|
|
} |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* Render the page. |
|
120
|
|
|
* //TODO: Convert these sections into tabs. |
|
121
|
|
|
*/ |
|
122
|
|
|
public function render_page() { |
|
123
|
|
|
global $wpdb; |
|
124
|
|
|
$plugin_version = '2.2.5'; |
|
125
|
|
|
?> |
|
126
|
|
|
<div class="wrap"> |
|
127
|
|
|
<h1><?php _e( 'Email Log - System Info', 'email-log' ); ?></h1> |
|
128
|
|
|
|
|
129
|
|
|
<textarea wrap="off" style="width:100%;height:500px;font-family:Menlo,Monaco,monospace;white-space:pre;" readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="bulk-delete-sysinfo" title="<?php _e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'bulk-delete' ); ?>"> |
|
130
|
|
|
### Begin System Info ### |
|
131
|
|
|
|
|
132
|
|
|
Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> |
|
133
|
|
|
|
|
134
|
|
|
SITE_URL: <?php echo site_url() . "\n"; ?> |
|
135
|
|
|
HOME_URL: <?php echo home_url() . "\n"; ?> |
|
136
|
|
|
Browser: <?php echo esc_html( $_SERVER['HTTP_USER_AGENT'] ), "\n"; ?> |
|
137
|
|
|
|
|
138
|
|
|
Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?> |
|
139
|
|
|
Active Theme: <?php echo $this->el_get_current_theme_name() . "\n"; ?> |
|
140
|
|
|
<?php |
|
141
|
|
|
$host = bd_identify_host(); |
|
142
|
|
|
if ( '' !== $host ) : ?> |
|
143
|
|
|
Host: <?php echo $host . "\n\n"; ?> |
|
144
|
|
|
<?php endif; ?> |
|
145
|
|
|
|
|
146
|
|
|
<?php $post_types = get_post_types(); ?> |
|
147
|
|
|
Registered Post types: <?php echo implode( ', ', $post_types ) . "\n"; ?> |
|
148
|
|
|
<?php |
|
149
|
|
|
foreach ( $post_types as $post_type ) { |
|
150
|
|
|
echo $post_type; |
|
151
|
|
|
if ( strlen( $post_type ) < 26 ) { |
|
152
|
|
|
echo str_repeat( ' ', 26 - strlen( $post_type ) ); |
|
153
|
|
|
} |
|
154
|
|
|
$post_count = wp_count_posts( $post_type ); |
|
155
|
|
|
foreach ( $post_count as $key => $value ) { |
|
156
|
|
|
echo $key, '=', $value, ', '; |
|
157
|
|
|
} |
|
158
|
|
|
echo "\n"; |
|
159
|
|
|
} |
|
160
|
|
|
?> |
|
161
|
|
|
|
|
162
|
|
|
<?php $taxonomies = get_taxonomies(); ?> |
|
163
|
|
|
Registered Taxonomies: <?php echo implode( ', ', $taxonomies ) . "\n"; ?> |
|
164
|
|
|
|
|
165
|
|
|
Email log Version: <?php echo $plugin_version . "\n"; ?> |
|
166
|
|
|
WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> |
|
167
|
|
|
PHP Version: <?php echo PHP_VERSION . "\n"; ?> |
|
168
|
|
|
MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> |
|
169
|
|
|
Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> |
|
170
|
|
|
|
|
171
|
|
|
WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
|
172
|
|
|
WordPress Max Limit: <?php echo WP_MAX_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
|
173
|
|
|
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> |
|
174
|
|
|
|
|
175
|
|
|
SAVEQUERIES: <?php echo defined( 'SAVEQUERIES' ) ? SAVEQUERIES ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
176
|
|
|
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
177
|
|
|
WP_SCRIPT_DEBUG: <?php echo defined( 'WP_SCRIPT_DEBUG' ) ? WP_SCRIPT_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
178
|
|
|
|
|
179
|
|
|
GMT Offset: <?php echo esc_html( get_option( 'gmt_offset' ) ), "\n\n"; ?> |
|
180
|
|
|
DISABLE_WP_CRON: <?php echo defined( 'DISABLE_WP_CRON' ) ? DISABLE_WP_CRON ? 'Yes' . "\n" : 'No' . "\n" : 'Not set' . "\n" ?> |
|
181
|
|
|
WP_CRON_LOCK_TIMEOUT: <?php echo defined( 'WP_CRON_LOCK_TIMEOUT' ) ? WP_CRON_LOCK_TIMEOUT : 'Not set', "\n" ?> |
|
182
|
|
|
EMPTY_TRASH_DAYS: <?php echo defined( 'EMPTY_TRASH_DAYS' ) ? EMPTY_TRASH_DAYS : 'Not set', "\n" ?> |
|
183
|
|
|
|
|
184
|
|
|
PHP Safe Mode: <?php echo ini_get( 'safe_mode' ) ? 'Yes' : 'No', "\n"; // phpcs:ignore PHPCompatibility.PHP.DeprecatedIniDirectives.safe_modeDeprecatedRemoved?> |
|
185
|
|
|
PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> |
|
186
|
|
|
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> |
|
187
|
|
|
PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> |
|
188
|
|
|
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> |
|
189
|
|
|
PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; // phpcs:ignore PHPCompatibility.PHP.NewIniDirectives.max_input_varsFound?> |
|
190
|
|
|
PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?> |
|
191
|
|
|
PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? 'Yes' : 'No', "\n"; ?> |
|
192
|
|
|
|
|
193
|
|
|
WP Table Prefix: <?php echo $wpdb->prefix, "\n";?> |
|
194
|
|
|
|
|
195
|
|
|
Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
196
|
|
|
Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?> |
|
197
|
|
|
Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?> |
|
198
|
|
|
Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?> |
|
199
|
|
|
Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
|
200
|
|
|
Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
|
201
|
|
|
|
|
202
|
|
|
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> |
|
203
|
|
|
FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?> |
|
204
|
|
|
cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?> |
|
205
|
|
|
SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?> |
|
206
|
|
|
SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?> |
|
207
|
|
|
|
|
208
|
|
|
ACTIVE PLUGINS: |
|
209
|
|
|
|
|
210
|
|
|
<?php bd_print_current_plugins(); ?> |
|
211
|
|
|
|
|
212
|
|
|
<?php |
|
213
|
|
|
if ( is_multisite() ) : ?> |
|
214
|
|
|
NETWORK ACTIVE PLUGINS: |
|
215
|
|
|
|
|
216
|
|
|
<?php |
|
217
|
|
|
bd_print_network_active_plugins(); |
|
218
|
|
|
endif; |
|
219
|
|
|
?> |
|
220
|
|
|
|
|
221
|
|
|
<?php do_action( 'bd_system_info_after' );?> |
|
222
|
|
|
### End System Info ###</textarea> |
|
223
|
|
|
|
|
224
|
|
|
<p class="submit"> |
|
225
|
|
|
<input type="hidden" name="bd_action" value="download_sysinfo"> |
|
226
|
|
|
<?php submit_button( 'Download System Info File', 'primary', 'bulk-delete-download-sysinfo', false ); ?> |
|
227
|
|
|
</p> |
|
228
|
|
|
|
|
229
|
|
|
|
|
230
|
|
|
</div> |
|
231
|
|
|
<?php |
|
232
|
|
|
|
|
233
|
|
|
$this->render_page_footer(); |
|
234
|
|
|
} |
|
235
|
|
|
} |