Plugin Directory

Changeset 3423844


Ignore:
Timestamp:
12/19/2025 04:45:51 PM (3 months ago)
Author:
apos37
Message:

3.0.0.8

  • Update: Added a Download System Status Report button to dashboard for sharing with support
  • Update: Added option to indicate WP_DEBUG is enabled by subtly striping the admin bar
  • Fix: ddtt_is_dev() causing fatal error if used without any params
Location:
dev-debug-tools
Files:
224 added
7 edited

Legend:

Unmodified
Added
Removed
  • dev-debug-tools/trunk/dev-debug-tools.php

    r3422220 r3423844  
    44 * Plugin URI:          https://pluginrx.com/plugin/dev-debug-tools/
    55 * Description:         WordPress debugging and testing tools for developers
    6  * Version:             3.0.0.7
     6 * Version:             3.0.0.8
    77 * Requires at least:   5.9
    88 * Tested up to:        6.9
     
    135135                /* translators: %1$s is plugin name, %2$s is required PHP version */
    136136                esc_html( __( '%1$s requires PHP %2$s or higher.', 'dev-debug-tools' ) ),
    137                 esc_html( $this->meta['name'] ),
    138                 esc_html( $this->meta['requires_php'] )
     137                esc_html( $this->meta[ 'name' ] ),
     138                esc_html( $this->meta[ 'requires_php' ] )
    139139            ) );
    140140        }
     
    268268     */
    269269    public static function script_version() : string {
    270         return self::is_test_mode() ? (string) time() : self::version();
     270        if ( self::is_test_mode() ) {
     271            return 'TEST-' . time();
     272        }
     273        return self::version();
    271274    } // End script_version()
    272275
  • dev-debug-tools/trunk/inc/admin-area/admin-bar/class-admin-bar.php

    r3422220 r3423844  
    7373        if ( get_option( 'ddtt_admin_bar_gravity_form_finder', true ) && ! is_admin() && is_plugin_active( 'gravityforms/gravityforms.php' ) ) {
    7474            add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_gravity_forms_finder' ] );
     75        }
     76
     77        // Indicate that we are in debug mode
     78        if ( get_option( 'ddtt_admin_bar_debug', true ) ) {
     79            add_filter( 'body_class', [ $this, 'add_debug_body_class' ] );
     80            add_filter( 'admin_body_class', [ $this, 'add_debug_body_class' ] );
     81            add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_debug_mode_indicator' ] );
     82            add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_debug_mode_indicator' ] );
    7583        }
    7684
     
    678686     */
    679687    private function render_post_details( $wp_admin_bar ) {
     688        $post_id = null;
    680689        if ( is_search() ) {
    681690            $post_info_title = __( 'Search Results Page', 'dev-debug-tools' );
     
    10761085    } // End ajax_save_centering_tool()
    10771086
     1087
     1088    /**
     1089     * Add a body class if WP_DEBUG is enabled
     1090     *
     1091     * @param string|array $classes The existing body classes.
     1092     * @return string|array The modified body classes.
     1093     */
     1094    public function add_debug_body_class( $classes ) {
     1095        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     1096            if ( is_array( $classes ) ) {
     1097                $classes[] = 'ddtt-debug-enabled';
     1098            } else {
     1099                $classes .= ' ddtt-debug-enabled';
     1100            }
     1101        } else {
     1102            if ( is_array( $classes ) ) {
     1103                $classes[] = 'ddtt-debug-disabled';
     1104            } else {
     1105                $classes .= ' ddtt-debug-disabled';
     1106            }
     1107        }
     1108        return $classes;
     1109    } // End add_debug_body_class()
     1110
     1111
     1112    /**
     1113     * Enqueue the condensed admin bar styles
     1114     */
     1115    public function enqueue_debug_mode_indicator() {
     1116        if ( Helpers::is_dev() ) {
     1117            $version = Bootstrap::script_version();
     1118            $handle = 'ddtt-admin-bar-debug-mode-indicator';
     1119
     1120            wp_enqueue_style(
     1121                $handle,
     1122                Bootstrap::url( 'inc/admin-area/admin-bar/debug-mode-indicator.css' ),
     1123                [],
     1124                $version
     1125            );
     1126        }
     1127    } // End enqueue_debug_mode_indicator()
     1128
    10781129}
    10791130
  • dev-debug-tools/trunk/inc/functions.php

    r3422220 r3423844  
    1616 */
    1717if ( ! function_exists( 'ddtt_is_dev' ) ) {
    18     function ddtt_is_dev( $id, $array = false ) : bool|string|array {
     18    function ddtt_is_dev( $id = null, $array = false ) : bool|string|array {
    1919        if ( is_bool( $id ) ) {
    2020
  • dev-debug-tools/trunk/inc/hub/pages/dashboard/class-dashboard.php

    r3422220 r3423844  
    4545        }
    4646
     47        if ( isset( $_POST[ 'ddtt-download-status-report' ] ) ) { // phpcs:ignore
     48            $this->download_status_report();
     49        }
     50
    4751        add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
    4852        add_action( 'wp_ajax_ddtt_check_issue', [ $this, 'ajax_check_issue' ] );
     
    5458     */
    5559    public function download_important_files() {
    56         if ( !isset( $_POST[ 'ddtt-download-important-files' ] ) || ! isset( $_POST[ $this->nonce_field ] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ $this->nonce_field ] ) ), $this->nonce_action ) ) {
     60        if (
     61            ! isset( $_POST[ 'ddtt-download-important-files' ] ) ||
     62            ! isset( $_POST[ $this->nonce_field ] ) ||
     63            ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ $this->nonce_field ] ) ), $this->nonce_action )
     64        ) {
    5765            return;
    5866        }
     
    98106        }
    99107    } // End download_important_files()
     108
     109
     110    /**
     111     * Handle the download system status report request.
     112     */
     113    public function download_status_report() {
     114        if (
     115            ! isset( $_POST[ 'ddtt-download-status-report' ] ) ||
     116            ! isset( $_POST[ $this->nonce_field ] ) ||
     117            ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ $this->nonce_field ] ) ), $this->nonce_action )
     118        ) {
     119            return;
     120        }
     121
     122        if ( ! current_user_can( 'manage_options' ) ) {
     123            wp_die( 'Unauthorized access.' );
     124        }
     125
     126        $report_lines = [];
     127
     128        $report_lines[] = "DEVELOPER DEBUG TOOLS SYSTEM STATUS REPORT\n";
     129
     130        $report_lines[] = "Is Test Mode Active: " . ( Bootstrap::is_test_mode() ? 'Yes' : 'No' ) . "\n";
     131
     132        // Versions
     133        $report_lines[] = "Plugin Version: " . Bootstrap::version();
     134        $report_lines[] = "WordPress Version: " . get_bloginfo( 'version' );
     135        $report_lines[] = "PHP Version: " . phpversion();
     136        global $wpdb;
     137        $report_lines[] = "MySQL Version: " . $wpdb->db_version();
     138
     139        $jquery_version = '';
     140        if ( isset( $GLOBALS[ 'wp_scripts' ] ) && $GLOBALS[ 'wp_scripts' ] instanceof \WP_Scripts ) {
     141            $jquery_version = $GLOBALS[ 'wp_scripts' ]->registered[ 'jquery' ]->ver ?? false;
     142            if ( $jquery_version ) {
     143                $jquery_version = sanitize_text_field( wp_unslash( $jquery_version ) );
     144            }
     145        }
     146        $report_lines[] = "jQuery Version: " . $jquery_version;
     147
     148        // Site Info
     149        $report_lines[] = "\nSite Domain: " . get_site_url();
     150        $report_lines[] = "Multisite: " . ( is_multisite() ? 'Yes' : 'No' );
     151        $report_lines[] = "WordPress Timezone: " . get_option( 'timezone_string' );
     152        $report_lines[] = "Developer Timezone: " . get_option( 'ddtt_dev_timezone' );
     153        $theme = wp_get_theme();
     154        $report_lines[] = "Active Theme: " . $theme->get( 'Name' ) . " " . $theme->get( 'Version' );
     155        $report_lines[] = "Is Child Theme? " . ( $theme->parent() ? 'Yes' : 'No' );
     156
     157        // Plugins info
     158        $all_plugins = get_plugins();
     159        $active_plugins = get_option( 'active_plugins', [] );
     160        $must_use_plugins = get_mu_plugins();
     161        $inactive_plugins = array_diff( array_keys( $all_plugins ), $active_plugins );
     162
     163        $report_lines[] = "\nActive Plugins Count: " . count( $active_plugins );
     164        $report_lines[] = "Must Use Plugins Count: " . count( $must_use_plugins );
     165        $report_lines[] = "Inactive Plugins Count: " . count( $inactive_plugins );
     166
     167        $report_lines[] = "\n======= ACTIVE PLUGINS: =======";
     168        foreach ( $active_plugins as $plugin_file ) {
     169            if ( isset( $all_plugins[ $plugin_file ] ) ) {
     170                $p = $all_plugins[ $plugin_file ];
     171                $report_lines[] = sprintf(
     172                    "%s by %s, v %s, %s",
     173                    $p[ 'Name' ],
     174                    $p[ 'Author' ],
     175                    $p[ 'Version' ],
     176                    $plugin_file
     177                );
     178            }
     179        }
     180
     181        // Plugin settings
     182        $ignore_settings = [ 'ddtt_pass', 'ddtt_plugins' ];
     183
     184        $report_lines[] = "\n======= PLUGIN SETTINGS: =======";
     185        $options = wp_load_alloptions();
     186        foreach ( $options as $key => $value ) {
     187            if ( str_starts_with( $key, 'ddtt_' ) && ! in_array( $key, $ignore_settings ) ) {
     188                $value = maybe_unserialize( $value );
     189                if ( is_array( $value ) || is_object( $value ) ) {
     190                    $report_lines[] = $key . " =>\n" . print_r( $value, true );
     191                } else {
     192                    $report_lines[] = $key . " => " . $value;
     193                }
     194                $report_lines[] = ""; // empty line between settings
     195            }
     196        }
     197
     198        $filename = 'ddtt-system-status-report-' . gmdate( 'Y-m-d-H-i-s' ) . '.txt';
     199
     200        header( 'Content-Type: text/plain' );
     201        header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
     202        echo implode( "\n", $report_lines );
     203
     204        exit;
     205    } // End download_status_report()
    100206
    101207
  • dev-debug-tools/trunk/inc/hub/pages/dashboard/page-dashboard.php

    r3422220 r3423844  
    9292                        <span class="dashicons dashicons-media-archive"></span>
    9393                        <span class="button-label"><?php esc_html_e( 'Download Important Files', 'dev-debug-tools' ); ?></span>
     94                    </button>
     95                    <button class="ddtt-button" type="submit" name="ddtt-download-status-report" title="Text file with system status report to share when seeking support" style="margin-top: 10px;">
     96                        <span class="dashicons dashicons-media-text"></span>
     97                        <span class="button-label"><?php esc_html_e( 'Download System Status Report', 'dev-debug-tools' ); ?></span>
    9498                    </button>
    9599                </form>
  • dev-debug-tools/trunk/inc/hub/pages/settings/class-settings.php

    r3422220 r3423844  
    568568                        'title'     => __( 'Add Log Error Count', 'dev-debug-tools' ),
    569569                        'desc'      => __( 'Add the total number of errors in your logs to the admin bar.', 'dev-debug-tools' ),
     570                        'type'      => 'checkbox',
     571                        'default'   => true,
     572                    ],
     573                    'admin_bar_debug' => [
     574                        'title'     => __( 'Indicate WP_DEBUG is Enabled', 'dev-debug-tools' ),
     575                        'desc'      => __( 'Add faint red stripes to the admin bar when WP_DEBUG is enabled.', 'dev-debug-tools' ),
    570576                        'type'      => 'checkbox',
    571577                        'default'   => true,
  • dev-debug-tools/trunk/readme.txt

    r3422228 r3423844  
    55Tested up to: 6.9
    66Requires PHP: 8.0
    7 Stable tag: 3.0.0.7
     7Stable tag: 3.0.0.8
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    107107
    108108== Changelog ==
    109 = 3.0.0 =
     109= 3.0.0.8 =
     110* Update: Added a Download System Status Report button to dashboard for sharing with support
     111* Update: Added option to indicate WP_DEBUG is enabled by subtly striping the admin bar
     112* Fix: ddtt_is_dev() causing fatal error if used without any params
     113
     114= 3.0.0.7 =
    110115* Major update: rewrote the plugin for better performance, UI and UX
    111116* Fixes: Fixed a number of bugs throughout
Note: See TracChangeset for help on using the changeset viewer.