Admin.php
8 months ago
admin-page.php
8 months ago
screen-debug.php
8 months ago
screen-stats.php
8 months ago
screen-tools.php
8 months ago
screen-debug.php
78 lines
| 1 | <?php |
| 2 | if ( 'debug' == $current ) { |
| 3 | |
| 4 | if ( ! current_user_can('edit_others_posts') ) { |
| 5 | echo '<p style="text-align: center;">' . esc_html(__('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts')) . '</p>'; |
| 6 | } |
| 7 | else { |
| 8 | global $wpdb, $wp_version; |
| 9 | |
| 10 | $my_theme = wp_get_theme(); |
| 11 | $site_plugins = get_plugins(); |
| 12 | $plugin_names = []; |
| 13 | $performance_nag = get_option('wpp_performance_nag'); |
| 14 | |
| 15 | if ( ! $performance_nag ) { |
| 16 | $performance_nag = [ |
| 17 | 'status' => 0, |
| 18 | 'last_checked' => null |
| 19 | ]; |
| 20 | } |
| 21 | |
| 22 | switch($performance_nag['status']) { |
| 23 | case 0: |
| 24 | $performance_nag_status = 'Inactive'; |
| 25 | break; |
| 26 | case 1: |
| 27 | $performance_nag_status = 'Active'; |
| 28 | break; |
| 29 | case 2: |
| 30 | $performance_nag_status = 'Remind me later'; |
| 31 | break; |
| 32 | case 3: |
| 33 | $performance_nag_status = 'Dismissed'; |
| 34 | break; |
| 35 | default: |
| 36 | $performance_nag_status = 'Inactive'; |
| 37 | break; |
| 38 | } |
| 39 | |
| 40 | foreach( $site_plugins as $main_file => $plugin_meta ) : |
| 41 | if ( ! is_plugin_active($main_file) ) { |
| 42 | continue; |
| 43 | } |
| 44 | $plugin_names[] = sanitize_text_field($plugin_meta['Name'] . ' ' . $plugin_meta['Version']); |
| 45 | endforeach; |
| 46 | |
| 47 | // Image formats support |
| 48 | $webp_support = \WP_Image_Editor_GD::supports_mime_type('image/webp'); |
| 49 | $avif_support = \WP_Image_Editor_GD::supports_mime_type('image/avif'); |
| 50 | ?> |
| 51 | <div id="wpp_debug"> |
| 52 | <h3>Plugin Configuration</h3> |
| 53 | <p><strong>Performance Nag:</strong> <?php echo $performance_nag_status; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $performance_nag_status is safe to use ?></p> |
| 54 | <p><strong>Log Limit:</strong> <?php echo ( $this->config['tools']['log']['limit'] ) ? 'Yes, keep data for ' . esc_html($this->config['tools']['log']['expires_after']) . ' days' : 'No'; ?></p> |
| 55 | <p><strong>Log Views From:</strong> <?php echo ( 0 == $this->config['tools']['log']['level'] ) ? 'Visitors only' : ( (2 == $this->config['tools']['log']['level']) ? 'Logged-in users only' : 'Everyone' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p> |
| 56 | <p><strong>Data Caching:</strong> <?php echo ( $this->config['tools']['cache']['active'] ) ? 'Yes, ' . esc_html($this->config['tools']['cache']['interval']['value']) . ' ' . esc_html($this->config['tools']['cache']['interval']['time']) : 'No'; ?></p> |
| 57 | <p><strong>Data Sampling:</strong> <?php echo ( $this->config['tools']['sampling']['active'] ) ? 'Yes, with a rate of ' . esc_html($this->config['tools']['sampling']['rate']) : 'No'; ?></p> |
| 58 | <p><strong>External object cache:</strong> <?php echo ( wp_using_ext_object_cache() ) ? 'Yes' : 'No'; ?></p> |
| 59 | <p><strong>WPP_CACHE_VIEWS:</strong> <?php echo ( defined('WPP_CACHE_VIEWS') && WPP_CACHE_VIEWS ) ? 'Yes' : 'No'; ?></p> |
| 60 | |
| 61 | <br /> |
| 62 | |
| 63 | <h3>System Info</h3> |
| 64 | <p><strong>PHP version:</strong> <?php echo phpversion(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p> |
| 65 | <p><strong>PHP extensions:</strong> <?php echo implode(', ', get_loaded_extensions()); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p> |
| 66 | <p><strong>AVIF support:</strong> <?php echo $avif_support ? 'Yes' : 'No'; ?></p> |
| 67 | <p><strong>WebP support:</strong> <?php echo $webp_support ? 'Yes' : 'No'; ?></p> |
| 68 | <p><strong>Database version:</strong> <?php echo $wpdb->get_var('SELECT VERSION();'); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching ?></p> |
| 69 | <p><strong>InnoDB availability:</strong> <?php echo $wpdb->get_var("SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE = 'InnoDB';"); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching ?></p> |
| 70 | <p><strong>WordPress version:</strong> <?php echo $wp_version; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $wp_version is safe to use ?></p> |
| 71 | <p><strong>Multisite:</strong> <?php echo ( function_exists('is_multisite') && is_multisite() ) ? 'Yes' : 'No'; ?></p> |
| 72 | <p><strong>Active plugins:</strong> <?php echo implode(', ', $plugin_names); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $plugin_names is safe to use ?></p> |
| 73 | <p><strong>Theme:</strong> <?php echo esc_html($my_theme->get('Name')) . ' (' . esc_html($my_theme->get('Version')) . ') by ' . esc_html($my_theme->get('Author')); ?></p> |
| 74 | </div> |
| 75 | <?php |
| 76 | } |
| 77 | } |
| 78 |