PluginProbe ʕ •ᴥ•ʔ
Custom Post Type UI / 1.19.2
Custom Post Type UI v1.19.2
1.19.2 1.19.1 1.19.0 trunk 0.7.0.0 0.7.1.0 0.7.2.0 0.8.0.0 0.8.1 0.8.2 0.8.3 0.8.4 0.8.5 0.9.0 0.9.5 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.10.1 1.10.2 1.11.0 1.11.1 1.11.2 1.12.0 1.12.1 1.13.0 1.13.1 1.13.2 1.13.3 1.13.4 1.13.5 1.13.6 1.13.7 1.14.0 1.15.0 1.15.1 1.16.0 1.17.0 1.17.1 1.17.2 1.17.3 1.18.0 1.18.1 1.18.2 1.18.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.8.0 1.8.1 1.8.2 1.9.0 1.9.1 1.9.2
custom-post-type-ui / classes / class.cptui_debug_info.php
custom-post-type-ui / classes Last commit date
class.cptui_admin_ui.php 3 weeks ago class.cptui_debug_info.php 3 weeks ago
class.cptui_debug_info.php
253 lines
1 <?php
2 /**
3 * Custom Post Type UI Debug Information.
4 *
5 * @package CPTUI
6 * @subpackage Debugging
7 * @author WebDevStudios
8 * @since 1.2.0
9 * @license GPL-2.0+
10 */
11
12 /**
13 * Custom Post Type UI Debug Info
14 */
15 class CPTUI_Debug_Info {
16
17 /**
18 * Tab content for the debug info tab.
19 *
20 * @since 1.2.0
21 */
22 public function tab_site_info() {
23 ?>
24 <p><?php esc_html_e( 'If you have sought support for Custom Post Type UI on the forums, you may be requested to send the information below to the plugin developer. Simply insert the email they provided in the input field at the bottom and click the "Send debug info" button. Only the data below will be sent to them.', 'custom-post-type-ui' ); ?></p>
25 <label for="cptui_audit_textarea">
26 <textarea readonly="readonly" aria-readonly="true" id="cptui-audit-textarea" name="cptui_audit_textarea" rows="20" cols="100" class="large-text code">
27 <?php echo esc_html( $this->system_status() ); ?>
28 </textarea></label>
29 <?php
30 }
31
32 /**
33 * Generate the debug information content.
34 *
35 * @since 1.2.0
36 *
37 * @return string
38 */
39 private function system_status() {
40 if ( ! current_user_can( 'manage_options' ) ) {
41 return '';
42 }
43
44 global $wpdb;
45
46 $theme_data = wp_get_theme();
47 $theme = $theme_data->Name . ' ' . $theme_data->Version; // phpcs:ignore.
48
49 ob_start();
50 ?>
51
52 ### Begin Custom Post Type UI Debug Info ###
53
54 Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?>
55
56 SITE_URL: <?php echo esc_url( site_url() ) . "\n"; ?>
57 HOME_URL: <?php echo esc_url( home_url() ) . "\n"; ?>
58
59 WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; // phpcs:ignore. ?>
60 Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; // phpcs:ignore. ?>
61 Active Theme: <?php echo $theme . "\n"; // phpcs:ignore. ?>
62
63 Registered Post Types: <?php echo implode( ', ', get_post_types( '', 'names' ) ) . "\n"; // phpcs:ignore. ?>
64
65 PHP Version: <?php echo PHP_VERSION . "\n"; ?>
66 MySQL Version: <?php echo $wpdb->db_version() . "\n"; // phpcs:ignore. ?>
67 Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; // phpcs:ignore. ?>
68
69 Show On Front: <?php echo get_option( 'show_on_front' ) . "\n"; // phpcs:ignore. ?>
70 Page On Front: <?php $id = get_option( 'page_on_front' ); // phpcs:ignore.
71 echo get_the_title( $id ) . ' (#' . $id . ')' . "\n"; // phpcs:ignore. ?>
72 Page For Posts: <?php $id = get_option( 'page_for_posts' ); // phpcs:ignore.
73 echo get_the_title( $id ) . ' (#' . $id . ')' . "\n"; // phpcs:ignore. ?>
74
75 WordPress Memory Limit: <?php echo ( $this->num_convt( WP_MEMORY_LIMIT ) / ( 1024 ) ) . 'MB'; ?><?php echo "\n"; // phpcs:ignore. ?>
76
77 <?php
78 $plugins = get_plugins();
79 $pg_count = count( $plugins );
80 echo 'TOTAL PLUGINS: ' . $pg_count . "\n\n"; // phpcs:ignore.
81 // MU plugins.
82 $mu_plugins = get_mu_plugins();
83
84 if ( $mu_plugins ) :
85 echo "\t\t" . 'MU PLUGINS: (' . count( $mu_plugins ) . ')' . "\n\n";
86
87 foreach ( $mu_plugins as $mu_path => $mu_plugin ) {
88
89 echo "\t\t" . esc_html( $mu_plugin['Name'] ) . ': ' . esc_html( $mu_plugin['Version'] ) . "\n";
90 }
91 endif;
92 // Standard plugins - active.
93 echo "\n";
94
95 $active = get_option( 'active_plugins', [] );
96 $ac_count = count( $active );
97 $ic_count = $pg_count - $ac_count;
98
99 echo "\t\t" . 'ACTIVE PLUGINS: (' . $ac_count . ')' . "\n\n"; // phpcs:ignore.
100
101 foreach ( $plugins as $plugin_path => $plugin ) {
102 // If the plugin isn't active, don't show it.
103 if ( ! in_array( $plugin_path, $active, true ) ) {
104 continue;
105 }
106
107 echo "\t\t" . esc_html( $plugin['Name'] ) . ': ' . esc_html( $plugin['Version'] ) . "\n";
108 }
109 // Standard plugins - inactive.
110 echo "\n";
111 echo "\t\t" , 'INACTIVE PLUGINS: (' . $ic_count . ')' . "\n\n"; // phpcs:ignore.
112
113 foreach ( $plugins as $plugin_path => $plugin ) {
114 // If the plugin isn't active, show it here.
115 if ( in_array( $plugin_path, $active, true ) ) {
116 continue;
117 }
118
119 echo "\t\t" . esc_html( $plugin['Name'] ) . ': ' . esc_html( $plugin['Version'] ) . "\n";
120 }
121
122 // If multisite, grab network as well.
123 if ( is_multisite() ) :
124
125 $net_plugins = wp_get_active_network_plugins();
126 $net_active = get_site_option( 'active_sitewide_plugins', [] );
127
128 echo "\n";
129 echo 'NETWORK ACTIVE PLUGINS: (' . count( $net_plugins ) . ')' . "\n\n";
130
131 foreach ( $net_plugins as $plugin_path ) {
132 $plugin_base = plugin_basename( $plugin_path );
133
134 // If the plugin isn't active, don't show it.
135 if ( ! array_key_exists( $plugin_base, $net_active ) ) {
136 continue;
137 }
138
139 $plugin = get_plugin_data( $plugin_path );
140
141 echo esc_html( $plugin['Name'] ) . ' :' . esc_html( $plugin['Version'] ) . "\n";
142 }
143
144 endif;
145
146 echo "\n";
147 $cptui_post_types = cptui_get_post_type_data();
148 echo "\t\t" . 'Post Types: ' . "\n";
149 echo "\t\t" . wp_json_encode( $cptui_post_types ) . "\n";
150
151 echo "\n\n";
152
153 $cptui_taxonomies = cptui_get_taxonomy_data();
154 echo "\t\t" . 'Taxonomies: ' . "\n";
155 echo "\t\t" . wp_json_encode( $cptui_taxonomies ) . "\n";
156 echo "\n";
157
158 if ( has_action( 'cptui_custom_debug_info' ) ) {
159 echo "\t\t" . 'EXTRA DEBUG INFO';
160 }
161
162 /**
163 * Fires at the end of the debug info output.
164 *
165 * @since 1.3.0
166 */
167 do_action( 'cptui_custom_debug_info' );
168
169 echo "\n";
170 ?>
171 ### End Debug Info ###
172 <?php
173
174 return ob_get_clean();
175 }
176
177 /**
178 * Helper function for number conversions.
179 *
180 * @since 1.2.0
181 * @access public
182 *
183 * @param mixed $v Value.
184 * @return int
185 */
186 public function num_convt( $v ) {
187 $l = substr( $v, - 1 );
188 $ret = substr( $v, 0, - 1 );
189
190 switch ( strtoupper( $l ) ) {
191 case 'P': // Fall-through.
192 case 'T': // Fall-through.
193 case 'G': // Fall-through.
194 case 'M': // Fall-through.
195 case 'K': // Fall-through.
196 $ret *= 1024;
197 break;
198 default:
199 break;
200 }
201
202 return $ret;
203 }
204
205 /**
206 * Sends an email to the specified address, with the system status as the message.
207 *
208 * @since 1.2.0
209 *
210 * @param array $args Array of arguments for the method. Optional.
211 * @return bool
212 */
213 public function send_email( $args = [] ) {
214
215 if ( ! isset( $args['email'] ) || ! is_email( $args['email'] ) ) {
216 return false;
217 }
218
219 stripslashes_deep( $args );
220
221 $args['email'] = sanitize_email( $args['email'] );
222
223 $message = $this->system_status();
224
225 /**
226 * Filters the debug email subject.
227 *
228 * @since 1.3.0
229 *
230 * @param string $value Intended email subject.
231 */
232 $subject = apply_filters(
233 'cptui_debug_email_subject',
234 sprintf(
235 // translators: Placeholder will hold site home_url.
236 esc_html__( 'Custom Post Type UI debug information for %s', 'custom-post-type-ui' ),
237 esc_url( home_url( '/' ) )
238 )
239 );
240
241 $result = wp_mail( $args['email'], $subject, $message );
242
243 /**
244 * Fires after the debug email has been sent.
245 *
246 * @since 1.3.0
247 */
248 do_action( 'cptui_after_debug_email_sent' );
249
250 return $result;
251 }
252 }
253