Plugin Directory

Changeset 3422220


Ignore:
Timestamp:
12/17/2025 06:40:06 PM (3 months ago)
Author:
apos37
Message:

MAJOR UPDATE:

3.0.0.7

  • Major update: rewrote the plugin for better performance, UI and UX
  • Fixes: Fixed a number of bugs throughout
  • Update: Added a light mode option by toggling the bug icon in the header
  • Update: More customization on almost every page
  • Update: Most pages now remember your last results
  • Update: Cleaned up the admin menu, moved tools to a dedicated Tools section
  • Update: Changed navigation tabs to a drop down in the top-right corner
  • Update: Added a dashboard with versions, server metrics, environment info, quick download of important files, and an issues check
  • Update: New Tools dashboard allows you to disable tool scripts you aren't using
  • Update: Moved all Plugins tab data to WP Plugins page with options to enable/disable each, plus added a notes feature
  • Update: Removed tools/tabs - Plugins, Error Types, Error Suppressing, Functions.php, Media Library, Domain, Regex, Available Functions/Hooks
  • Update: Combined different Error Logs, Activity Logs, and custom logs into a Logs section
  • Update: Combined User Meta and Post Meta into a new Meta Data section, added Term Meta, Comment Meta, Media Meta
  • Update: WP-CONFIG and HTACCESS tools now have improved snippets area, raw editors, magic cleaners and a code/lint checker
  • Update: Testing tool is now a built-in HTML/PHP editor
  • Update: Improved security for password protected pages
  • Update: New tools and options - Discord Messenger (Tool), Signups (Tool), Hearbeat Monitor (Settings > Heartbeat)
  • Update: Added an optional log count indicator to the admin bar
  • Update: Deprecated hooks: ddtt_debug_log_help_col, ddtt_debug_log_max_filesize, ddtt_on_update_user_meta, ddtt_on_update_post_meta, ddtt_ignore_pages_for_discord_notifications
  • Update: Deprecated functions: ddtt_get(), ddtt_increase_test_number(), ddtt_get_current_url()
  • Update: Improved help guide and developer documentation on our website
Location:
dev-debug-tools
Files:
440 added
1 deleted
12 edited

Legend:

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

    r3330444 r3422220  
    44 * Plugin URI:          https://pluginrx.com/plugin/dev-debug-tools/
    55 * Description:         WordPress debugging and testing tools for developers
    6  * Version:             2.1.2
     6 * Version:             3.0.0.7
    77 * Requires at least:   5.9
    8  * Tested up to:        6.8
    9  * Requires PHP:        7.4
     8 * Tested up to:        6.9
     9 * Requires PHP:        8.0
    1010 * Author:              PluginRx
    1111 * Author URI:          https://pluginrx.com/
     
    1717 */
    1818
     19namespace Apos37\DevDebugTools;
     20
     21if ( ! defined( 'ABSPATH' ) ) exit;
     22
    1923
    2024/**
    21  * Exit if accessed directly.
     25 * BOOTSTRAP
     26 *
     27 * Loads plugin metadata, performs environment checks, and initializes the plugin.
    2228 */
    23 if ( !defined( 'ABSPATH' ) ) exit;
    24 
    25 
    26 /**
    27  * Defines
    28  */
    29 $plugin_data = get_file_data( __FILE__, [
    30     'name'         => 'Plugin Name',
    31     'description'  => 'Description',
    32     'version'      => 'Version',
    33     'plugin_uri'   => 'Plugin URI',
    34     'requires_php' => 'Requires PHP',
    35     'textdomain'   => 'Text Domain',
    36     'author'       => 'Author',
    37     'author_uri'   => 'Author URI',
    38     'discord_uri'  => 'Discord URI',
    39 ] );
    40 
    41 
    42 /**
    43  * Defines
    44  */
    45 
    46 // Versions
    47 define( 'DDTT_VERSION', $plugin_data[ 'version' ] );
    48 define( 'DDTT_BETA', false );
    49 define( 'DDTT_MIN_PHP_VERSION', $plugin_data[ 'requires_php' ] );
    50 
    51 // Prevent loading the plugin if PHP version is not minimum
    52 if ( version_compare( PHP_VERSION, DDTT_MIN_PHP_VERSION, '<=' ) ) {
    53     add_action( 'admin_init', static function() {
    54         deactivate_plugins( plugin_basename( __FILE__ ) );
    55     } );
    56     add_action( 'admin_notices', static function() {
    57         /* translators: 1: Plugin name, 2: Minimum PHP version */
    58         $message = sprintf( __( '"%1$s" requires PHP %2$s or newer.', 'dev-debug-tools' ),
    59             DDTT_NAME,
    60             DDTT_MIN_PHP_VERSION
    61         );
    62         echo '<div class="notice notice-error"><p>'.esc_html( $message ).'</p></div>';
    63     } );
    64     return;
    65 }
    66 
    67 // Prefixes
    68 define( 'DDTT_PF', 'DDTT_' ); // Plugin prefix
    69 define( 'DDTT_GO_PF', 'ddtt_' ); // Global options prefix
    70 
    71 // Names
    72 define( 'DDTT_NAME', $plugin_data[ 'name' ] );
    73 define( 'DDTT_TEXTDOMAIN', $plugin_data[ 'textdomain' ] );
    74 define( 'DDTT_AUTHOR', $plugin_data[ 'author' ] );
    75 define( 'DDTT_AUTHOR_EMAIL', '[email protected]' );
    76 define( 'DDTT_AUTHOR_URL', $plugin_data[ 'author_uri' ] );
    77 define( 'DDTT_GUIDE_URL', DDTT_AUTHOR_URL . 'guide/plugin/' . DDTT_TEXTDOMAIN . '/' );
    78 define( 'DDTT_DOCS_URL', DDTT_AUTHOR_URL . 'docs/plugin/' . DDTT_TEXTDOMAIN . '/' );
    79 define( 'DDTT_SUPPORT_URL', DDTT_AUTHOR_URL . 'support/plugin/' . DDTT_TEXTDOMAIN . '/' );
    80 define( 'DDTT_DISCORD_URL', $plugin_data[ 'discord_uri' ] );
    81 
    82 // Fetch site url only once
    83 $site_url = site_url( '/' );
    84 $ip = isset( $_SERVER[ 'SERVER_ADDR' ] ) ? filter_var( $_SERVER[ 'SERVER_ADDR' ], FILTER_VALIDATE_IP ) : '0.0.0.0';
    85 
    86 // Define core WordPress URLs relative to site URL
    87 define( 'DDTT_ABSPATH', ddtt_canonical_pathname( ABSPATH ) );
    88 define( 'DDTT_ADMIN_URL', str_replace( $site_url, '', rtrim( ddtt_admin_url(), '/' ) ) );                                       //: wp-admin || wp-admin/network
    89 define( 'DDTT_CONTENT_URL', str_replace( $site_url, '', content_url() ) );                                                      //: wp-content
    90 define( 'DDTT_INCLUDES_URL', str_replace( $site_url, '', rtrim( includes_url(), '/' ) ) );                                      //: wp-includes
    91 define( 'DDTT_ADMIN_INCLUDES_URL', trailingslashit( ABSPATH . DDTT_ADMIN_URL . '/includes/' ) );                                //: /abspath/.../public_html/wp-admin/includes/
    92 define( 'DDTT_PLUGINS_URL', str_replace( $site_url, '', plugins_url() ) );                                                      //: wp-content/plugins
    93 define( 'DDTT_MU_PLUGINS_DIR', ABSPATH.DDTT_CONTENT_URL.'/mu-plugins/' );                                                       //: /abspath/.../public_html/wp-content/mu-plugins/
    94 define( 'DDTT_UPLOADS_DIR', wp_upload_dir()[ 'basedir' ] );                                                                     //: /abspath/.../public_html/wp-content/uploads/
    95 
    96 // Define plugin specific paths
    97 define( 'DDTT_PLUGIN_ABSOLUTE', __FILE__ );                                                                                     //: /abspath/.../public_html/wp-content/plugins/dev-debug-tools/dev-debug-tools.php)
    98 define( 'DDTT_PLUGIN_ROOT', plugin_dir_path( __FILE__ ) );                                                                      //: /abspath/.../public_html/wp-content/plugins/dev-debug-tools/
    99 define( 'DDTT_PLUGIN_DIR', plugins_url( '/'.DDTT_TEXTDOMAIN.'/' ) );                                                            //: https://domain.com/wp-content/plugins/dev-debug-tools/
    100 define( 'DDTT_PLUGIN_SHORT_DIR', str_replace( site_url(), '', DDTT_PLUGIN_DIR ) );                                              //: /wp-content/plugins/dev-debug-tools/
    101 
    102 // Define paths within the plugin directory
    103 define( 'DDTT_PLUGIN_ASSETS_PATH', DDTT_PLUGIN_ROOT.'assets/' );                                                                //: /abspath/.../public_html/wp-content/plugins/dev-debug-tools/assets/
    104 define( 'DDTT_PLUGIN_IMG_PATH', DDTT_PLUGIN_DIR.'includes/admin/img/' );                                                        //: https://domain.com/wp-content/plugins/dev-debug-tools/includes/admin/img/
    105 define( 'DDTT_PLUGIN_INCLUDES_PATH', DDTT_PLUGIN_ROOT.'includes/' );                                                            //: /abspath/.../public_html/wp-content/plugins/dev-debug-tools/includes/
    106 define( 'DDTT_PLUGIN_ADMIN_PATH', DDTT_PLUGIN_INCLUDES_PATH.'admin/' );                                                         //: /abspath/.../public_html/wp-content/plugins/dev-debug-tools/includes/admin/
    107 define( 'DDTT_PLUGIN_CLASSES_PATH', DDTT_PLUGIN_INCLUDES_PATH.'classes/' );                                                     //: /abspath/.../public_html/wp-content/plugins/dev-debug-tools/includes/classes/
    108 define( 'DDTT_PLUGIN_CSS_PATH', DDTT_PLUGIN_SHORT_DIR.'includes/admin/css/' );                                                  //: /wp-content/plugins/dev-debug-tools/includes/admin/css/
    109 define( 'DDTT_PLUGIN_JS_PATH', DDTT_PLUGIN_SHORT_DIR.'includes/admin/js/' );                                                    //: /wp-content/plugins/dev-debug-tools/includes/admin/js/
    110 define( 'DDTT_PLUGIN_FILES_PATH', DDTT_PLUGIN_SHORT_DIR.'includes/files/' );                                                    //: /wp-content/plugins/dev-debug-tools/includes/files/
    111 
    112 
    113 /**
    114  * Get admin URL (handles multisite)
    115  *
    116  * @param string $path
    117  * @param string $scheme
    118  * @return string
    119  */
    120 function ddtt_admin_url( $path = '', $scheme = 'admin' ) {
    121     if ( is_network_admin() ) {
    122         $admin_url = network_admin_url( $path, $scheme );
    123     } else {
    124         $admin_url = admin_url( $path, $scheme );
    125     }
    126     return $admin_url;
    127 } // End ddtt_admin_url()
    128 
    129 
    130 /**
    131  * Canonical pathname
    132  *
    133  * @param string $pathname
    134  * @return string
    135  */
    136 function ddtt_canonical_pathname( $pathname ) {
    137     return str_replace( DIRECTORY_SEPARATOR, '/', $pathname );
    138 } // End ddtt_canonical_pathname()
    139 
    140 
    141 /**
    142  * Relative pathname
    143  *
    144  * @param string $pathname
    145  * @return string
    146  */
    147 function ddtt_relative_pathname( $pathname ) {
    148     $pathname = ddtt_canonical_pathname( $pathname );
    149     if ( !str_starts_with( $pathname, DDTT_ABSPATH ) ) {
    150         return $pathname;
    151     } else {
    152         return substr( $pathname, strlen( DDTT_ABSPATH ) );
    153     }
    154 } // End ddtt_relative_pathname()
    155  
    156 /**
    157  * Get a path to one of our options pages
    158  * https://domain.com/wp-admin/admin.php?page=dev-debug-tools
    159  * https://domain.com/wp-admin/admin.php?page=dev-debug-tools&tab=testing
    160  *
    161  * @param string $tab
    162  * @return string
    163  */
    164 function ddtt_plugin_options_path( $tab = null ) {
    165     $incl_tab = !is_null( $tab ) ? '&tab='.sanitize_html_class( $tab ) : '';
    166     return ddtt_admin_url( 'admin.php?page='.DDTT_TEXTDOMAIN.$incl_tab );
    167 } // End ddtt_plugin_options_path()
    168 
    169 
    170 /**
    171  * Get a short path to our options pages
    172  * dev-debug-tools
    173  * dev-debug-tools&tab=testing
    174  *
    175  * @param string $tab
    176  * @return string
    177  */
    178 function ddtt_plugin_options_short_path( $tab = null ) {
    179     $incl_tab = !is_null( $tab ) ? '&tab='.sanitize_html_class( $tab ) : '';
    180     return DDTT_TEXTDOMAIN.$incl_tab;
    181 } // End ddtt_plugin_options_short_path()
    182 
    183 
    184 /**
    185  * Multisite verbiage
    186  *
    187  * @return string
    188  */
    189 function ddtt_multisite_suffix() {
    190     if ( is_network_admin() ) {
    191         $sfx = ' <em>' . __( '- Network', 'dev-debug-tools' ) . '</em>';
    192     } elseif ( is_multisite() && is_main_site() ) {
    193         $sfx = ' <em>' . __( '- Primary', 'dev-debug-tools' ) . '</em>';
    194     } elseif ( is_multisite() && !is_main_site() ) {
    195         $sfx = ' <em>' . __( '- Subsite', 'dev-debug-tools' ) . '</em>';
    196     } else {
    197         $sfx = '';
    198     }
    199     return $sfx;
    200 } // End ddtt_multisite_suffix()
    201 
    202 
    203 /**
    204  * Add user and url when an error occurs
    205  *
    206  * @param int $num
    207  * @param string $str
    208  * @param string $file
    209  * @param string $line
    210  * @param null $context
    211  * @return void
    212  */
    213 function ddtt_log_error( $num, $str, $file, $line, $context = null ) {
    214     // This error code is not included in error_reporting, so let it fall through to the standard PHP error handler
    215     if ( !( error_reporting() & $num ) ) {
    216         return false;
    217     }
    218 
    219     // Only apply to user errors
    220     $user_errors = [
    221         E_USER_ERROR,
    222         E_USER_WARNING,
    223         E_USER_NOTICE
     29final class Bootstrap {
     30
     31    /**
     32     * Plugin files to load.
     33     *
     34     * This array contains the paths to all plugin files that need to be included.
     35     */
     36    public const FILES = [
     37        'hub/pages/resources/links.php'                  => 'dev',
     38        'admin-area/class-admin-area.php'                => 'admin',
     39        'hub/menu.php'                                   => 'dev',
     40        'functions.php'                                  => 'all',
     41        'helpers/help-map.php'                           => 'dev',
     42        'helpers/error-messages.php'                     => 'all',
     43        'helpers/jokes.php'                              => 'dev',
     44        'helpers/discord.php'                            => 'all',
     45        'admin-area/security/class-security.php'         => 'all',
     46        'shortcodes.php'                                 => 'dev',
     47        'site-wide/heartbeat/class-heartbeat.php'        => 'dev',
     48        'admin-area/admin-bar/class-admin-bar.php'       => 'all',
     49        'admin-area/online-users/class-online-users.php' => 'all',
     50        'admin-area/plugins/class-plugins.php'           => 'admin',
     51        'site-wide/class-site-wide.php'                  => 'all',
     52        'cleanup.php'                                    => 'dev',
     53        'deprecated.php'                                 => 'dev',
     54        'backdoor.php'                                   => 'all'
    22455    ];
    225     if ( in_array( $num, $user_errors ) ) {
    226        
    227         // Get user id
    228         $user_id = get_current_user_id();
    229 
    230         // Check for a user name
    231         if ( is_user_logged_in() ) {
    232             $user = get_userdata( $user_id );
    233             $display_name = sanitize_text_field( $user->display_name );
    234         } else {
    235             $display_name = 'Visitor';
     56
     57
     58    /**
     59     * Plugin header keys for get_file_data()
     60     */
     61    public const HEADER_KEYS = [
     62        'name'         => 'Plugin Name',
     63        'description'  => 'Description',
     64        'version'      => 'Version',
     65        'plugin_uri'   => 'Plugin URI',
     66        'requires_php' => 'Requires PHP',
     67        'textdomain'   => 'Text Domain',
     68        'author'       => 'Author',
     69        'author_uri'   => 'Author URI',
     70        'discord_uri'  => 'Discord URI'
     71    ];
     72
     73
     74    /**
     75     * @var array Plugin metadata from file header
     76     */
     77    private array $meta;
     78
     79
     80    /**
     81     * @var Bootstrap|null Singleton instance
     82     */
     83    private static ?Bootstrap $instance = null;
     84
     85
     86    /**
     87     * Get instance
     88     *
     89     * @return self
     90     */
     91    public static function instance() : self {
     92        return self::$instance ??= new self();
     93    } // End instance()
     94
     95
     96    /**
     97     * Constructor
     98     */
     99    private function __construct() {
     100        $this->meta = $this->load_meta();
     101        $this->check_environment();
     102        add_action( 'plugins_loaded', [ $this, 'load_files' ] );
     103    } // End __construct()
     104
     105
     106    /**
     107     * Check if test mode is enabled
     108     *
     109     * @return bool
     110     */
     111    public static function is_test_mode() : bool {
     112        return filter_var( get_option( 'ddtt_test_mode' ), FILTER_VALIDATE_BOOLEAN );
     113    } // End is_test_mode()
     114
     115
     116    /**
     117     * Load plugin metadata
     118     *
     119     * @return array
     120     */
     121    private function load_meta() : array {
     122        return get_file_data( __FILE__, self::HEADER_KEYS );
     123    } // End load_meta()
     124
     125
     126    /**
     127     * Check environment requirements
     128     *
     129     * @return void
     130     */
     131    private function check_environment() : void {
     132        if ( version_compare( PHP_VERSION, $this->meta[ 'requires_php' ], '<' ) ) {
     133            deactivate_plugins( plugin_basename( __FILE__ ) );
     134            wp_die( sprintf(
     135                /* translators: %1$s is plugin name, %2$s is required PHP version */
     136                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'] )
     139            ) );
    236140        }
    237 
    238         // Log
    239         $message = 'Error triggered by user '.absint( $user_id ).' ('.$display_name.') on '.sanitize_text_field( $_SERVER[ 'REQUEST_URI' ] );
    240         error_log( $message );
    241     }
    242    
    243     // Restore the old handler, because we don't want to stop it
    244     restore_error_handler();
    245 } // End ddtt_log_error()
    246 
    247 // Option to set it
    248 $log_user_url = get_option( DDTT_GO_PF.'log_user_url' );
    249 if ( $log_user_url && $log_user_url == 1 ) {
    250     set_error_handler( 'ddtt_log_error' );
    251 }
    252 
    253 
    254 /**
    255  * Activate
    256  */
    257 register_activation_hook( __FILE__, 'ddtt_activate_plugin' );
    258 function ddtt_activate_plugin() {
    259     // Log when this plugin was installed
    260     if ( !get_option( DDTT_GO_PF.'plugin_installed' ) ) {
    261         update_option( DDTT_GO_PF.'plugin_installed', gmdate( 'Y-m-d H:i:s' ) );
    262     }
    263 
    264     // Log when this plugin was last activated
    265     update_option( DDTT_GO_PF.'plugin_activated', gmdate( 'Y-m-d H:i:s' ) );
    266 
    267     // Log who activated this plugin
    268     update_option( DDTT_GO_PF.'plugin_activated_by', get_current_user_id() );
    269 
    270     // Uninstall
    271     register_uninstall_hook( __FILE__, DDTT_GO_PF.'uninstall_plugin' );
    272 } // End ddtt_activate_plugin()
    273 
    274 
    275 /**
    276  * Uninstall
    277  * Registered inside register_activation_hook above
    278  */
    279 function ddtt_uninstall_plugin() {
    280     // Define the options to be deleted
    281     $options = [
    282         'admin_menu_links',             // Admin bar menu links
    283         'centering_tool_cols',          // Centering tool columns
    284         'dev_email',                    // Dev email
    285         'disable_fb_form',              // Disable the deactivate feedback form
    286         'htaccess_last_updated',        // HTACCESS last updated date
    287         'htaccess_og_replaced_date',    // HTACCESS original was replaced date
    288         'last_viewed_version',          // Last viewed version
    289         'plugin_activated',             // Last date plugin was activated
    290         'plugin_activated_by',          // Who that plugin was last activated by
    291         'plugin_installed',             // When the plugin was installed
    292         'plugins',                      // A list of the plugins used by the activity log
    293         'suppressed_errors',            // Suppressed errors
    294         'test_number',                  // Test number
    295         'wpconfig_last_updated',        // When the wp-config.php file was last updated
    296         'wpconfig_og_replaced_date',    // When the original wp-config.php was replaced
    297     ];
    298 
    299     // Loop through the options and delete them
    300     foreach ( $options as $option ) {
    301         delete_option( DDTT_GO_PF . $option );
    302     }
    303    
    304     // Remove Must-Use-Plugin upon uninstall
    305     $remove_mu_plugin = get_option( DDTT_GO_PF.'error_uninstall' );
    306     if ( $remove_mu_plugin ) {
    307         (new DDTT_ERROR_REPORTING)->add_remove_mu_plugin( 'remove' );
    308         delete_option( DDTT_GO_PF.'error_enable' );
    309         delete_option( DDTT_GO_PF.'error_uninstall' );
    310         delete_option( DDTT_GO_PF.'error_constants' );
    311     }
    312 
    313     // Remove the activity log
    314     (new DDTT_ACTIVITY())->remove_log_file();
    315 } // End ddtt_uninstall_plugin()
    316 
    317 
    318 /**
    319  * The core plugin class that is used to define internationalization,
    320  * admin-specific hooks, and public-facing site hooks.
    321  */
    322 require DDTT_PLUGIN_INCLUDES_PATH.'class-'.DDTT_TEXTDOMAIN.'.php';
    323 
    324 
    325 /**
    326  * Begin execution of the plugin
    327  */
    328 new DDTT_DEBUG_TOOLS();
     141    } // End check_environment()
     142
     143
     144    /**
     145     * Load all required plugin files
     146     *
     147     * @return void
     148     */
     149    public function load_files() : void {
     150        require_once __DIR__ . '/inc/helpers/helpers.php';
     151        $is_dev = Helpers::has_access();
     152        $is_administrator = current_user_can( 'administrator' );
     153
     154        foreach ( self::FILES as $file => $env ) {
     155
     156            if (
     157                ( $env === 'dev' && $is_dev ) ||
     158                ( $env === 'admin' && ( $is_administrator || $is_dev ) ) ||
     159                ( $env === 'all' )
     160            ) {
     161                $file_path = __DIR__ . '/inc/' . $file;
     162                if ( file_exists( $file_path ) ) {
     163                    require_once $file_path;
     164                } else {
     165                    _doing_it_wrong(
     166                        __METHOD__,
     167                        sprintf( 'File not found: %s', esc_html( $file_path ) ),
     168                        esc_html( $this->version() )
     169                    );
     170                }
     171            }
     172        }
     173    } // End load_files()
     174
     175
     176    /**
     177     * Get admin URL
     178     *
     179     * @param string $path
     180     * @param string $scheme
     181     * @return string
     182     */
     183    public static function admin_url( $path = '', $scheme = 'admin' ) {
     184         return is_network_admin() ? network_admin_url( $path, $scheme ) : admin_url( $path, $scheme );
     185    } // End admin_url()
     186
     187
     188    /**
     189     * Get metadata value
     190     *
     191     * @param string $key
     192     * @return string
     193     */
     194    public static function meta( string $key ) : string {
     195        return self::$instance->meta[ $key ] ?? '';
     196    } // End meta()
     197
     198
     199    /**
     200     * Get plugin URL
     201     *
     202     * @param string $append
     203     * @return string
     204     */
     205    public static function url( string $append = '' ) : string {
     206        return plugin_dir_url( __FILE__ ) . ltrim( $append, '/' );
     207    } // End url()
     208
     209
     210    /**
     211     * Get plugin path
     212     *
     213     * @param string $append
     214     * @return string
     215     */
     216    public static function path( string $append = '' ) : string {
     217        return plugin_dir_path( __FILE__ ) . ltrim( $append, '/' );
     218    } // End path()
     219
     220
     221    /**
     222     * Get a page URL
     223     *
     224     * @param string $append
     225     * @return string
     226     */
     227    public static function page_url( $slug ) : string {
     228        return self::admin_url( 'admin.php?page=dev-debug-' . $slug );
     229    } // End page_url()
     230
     231
     232    /**
     233     * Get a tool URL
     234     *
     235     * @param string $append
     236     * @return string
     237     */
     238    public static function tool_url( $slug ) : string {
     239        return self::admin_url( 'admin.php?page=dev-debug-tools&tool=' . $slug );
     240    } // End tool_url()
     241
     242
     243    /**
     244     * Get plugin name
     245     *
     246     * @return string
     247     */
     248    public static function name() : string {
     249        return self::meta( 'name' );
     250    } // End name()
     251
     252
     253    /**
     254     * Get plugin version
     255     *
     256     * @return string
     257     */
     258    public static function version() : string {
     259        return self::meta( 'version' );
     260    } // End version()
     261
     262
     263    /**
     264     * Get script/style version for cache busting.
     265     * Returns timestamp if TEST_MODE is enabled, otherwise plugin version.
     266     *
     267     * @return string
     268     */
     269    public static function script_version() : string {
     270        return self::is_test_mode() ? (string) time() : self::version();
     271    } // End script_version()
     272
     273
     274    /**
     275     * Get plugin text domain
     276     *
     277     * @return string
     278     */
     279    public static function textdomain() : string {
     280        return self::meta( 'textdomain' );
     281    } // End textdomain()
     282
     283
     284    /**
     285     * Get plugin author
     286     *
     287     * @return string
     288     */
     289    public static function author() : string {
     290        return self::meta( 'author' );
     291    } // End author()
     292
     293
     294    /**
     295     * Get plugin URI
     296     *
     297     * @return string
     298     */
     299    public static function plugin_uri() : string {
     300        return self::meta( 'plugin_uri' );
     301    } // End plugin_uri()
     302
     303
     304    /**
     305     * Get author URI
     306     *
     307     * @return string
     308     */
     309    public static function author_uri() : string {
     310        return self::meta( 'author_uri' );
     311    } // End author_uri()
     312
     313
     314    /**
     315     * Get Discord URI
     316     *
     317     * @return string
     318     */
     319    public static function discord_uri() : string {
     320        return self::meta( 'discord_uri' );
     321    } // End discord_uri()
     322
     323
     324    /**
     325     * Prevent cloning and unserializing
     326     */
     327    public function __clone() {}
     328    public function __wakeup() {}
     329
     330} // End Bootstrap
     331
     332
     333Bootstrap::instance();
  • dev-debug-tools/trunk/readme.txt

    r3330444 r3422220  
    11=== Developer Debug Tools ===
    22Contributors: apos37, venutius
    3 Tags: debug, developer, testing, wp-config, htaccess
     3Tags: debug, developer, testing, logs, config
    44Requires at least: 5.9
    5 Tested up to: 6.8
    6 Requires PHP: 7.4
    7 Stable tag: 2.1.2
     5Tested up to: 6.9
     6Requires PHP: 8.0
     7Stable tag: 3.0.0.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    1212
    1313== Description ==
    14 The "Developer Debug Tools" WordPress plugin is a powerhouse for developers and site administrators! It's a comprehensive toolkit that helps you identify, troubleshoot, and resolve issues in your WordPress site, making debugging a breeze.
     14The "Developer Debug Tools" WordPress plugin is a powerhouse for developers and site administrators! It's a FREE comprehensive toolkit that helps you identify, troubleshoot, and resolve issues in your WordPress site, making debugging a breeze. No premium version available.
    1515
    1616This plugin offers a suite of features to aid in debugging, including, but not limited to:
    1717
    18 * Viewing and clearing `debug.log` and other error logs
    19 * Debug log Easy Reader combines duplicate lines and breaks down each error in an easy to read format
    20 * Viewing and updating `wp-config.php` and `.htaccess` files
    21 * Viewing and editing user meta and post meta
    22 * Viewing detailed info on post types and taxonomies
    23 * Quick links for debugging users, posts, pages and comments
    24 * Clearing all taxonomy terms from a given post
    25 * Clearing all or expired transients easily
    26 * Finding which posts and pages shortcodes are used on
    27 * Seeing whom is online with their roles
    28 * Activity logging such as when user meta, post meta, site settings, plugins and themes are updated or when bots crawl the site
    29 * Discord notifications of fatal errors, user page loads, and user logins
    30 * Viewing your database tables and entries at a glance without worry
    31 * Enhancements to the admin bar such as condensing/removing items and seeing user/post info at a glance
    32 * Viewing helpful information such php.ini values, php configs, scheduled cron jobs, site options, global variables, server metrics and more
    33 * Access to a handful of additional functions and hooks that you can use for debugging
     18* Dashboard with **important site information and server metrics**
     19* **Enhanced log viewer** for `debug.log`, error logs, custom logs, and an activity log
     20* **Config file** viewers and editors for `wp-config.php` and `.htaccess` files
     21* **Meta Data** viewer and editor for users, posts, tax terms, comments, and media
     22* **Database Table records** viewer
     23* **Site Options** viewer and editor
     24* **Globals** viewer
     25* **Defined Constants** viewer
     26* **Transients, Cookies, and Sessions** management
     27* **REST API** viewer and status checker
     28* **Post Types and Taxonomies** viewers
     29* **Auto-Draft** viewer and clearer
     30* **Shortcode Finder**
     31* **Cron Jobs** viewer
     32* **PHP Info** and **php.ini** viewers
     33* **Discord Notifications** of fatal errors and when users with certain roles log in
     34* **Discord Messenger** for testing connections with Discord
     35* **See who's online** and **last online** dates
     36* **Heartbeat Monitor** for testing WP Heartbeat API sitewide
     37* **Plugins Page Enhancements** with addt plugin data and notes feature
     38* **Security Options** for hiding the plugin and password protection to any admin page
     39* **Admin Bar Tools** such as seeing Post ID/type/status, User ID, an interactive centering tool, and more
     40* **Quick Debug Links** for debugging users, posts, and comments
     41* **Gravity Forms** integrations
    3442
    3543With "Developer Debug Tools", you can:
     
    48562. Activate it.
    49573. Go to Developer Debug Tools in your admin menu.
    50 4. Enter your account email address as a "Developer Email Address" to view the rest of the tools.
    5158
    5259== Frequently Asked Questions ==
    5360= Should I backup my wp-config.php and .htaccess files before using the tools to add/remove snippets?
    54 Yes! It is always best to back these files up when making updates to them.
     61Yes! It is always best to back these files up when making updates to them. You can do so on the config file pages or all together with your functions.php in a zip file from the dashboard.
    5562
    5663= Can I use this plugin on a live website? =
    5764Yes, but you should always make a backup of your site before using functionality that makes changes to your core files or database.
    5865
    59 = My site broke when updating my wp-config.php or .htaccess. How do I revert back to my original? =
    60 The originals are stored in your root folder and renamed with the date and time from which they were replaced. For example, the `wp-config.php` file will have been renamed to `wp-config-2022-08-22-15-25-46.php` and replaced with a new file. Simply log into your FTP or File Manager (from your host), rename the current file to something else such as `wp-config-BROKEN.php` (just in case you need it), and then rename the version you want to revert back to as `wp-config.php`. If everything looks good, then you can either delete this file or send a copy of it to me so I can figure out what went wrong. You can do so in the Discord server mentioned below.
     66= My site broke when updating my wp-config.php or .htaccess from your plugin. How do I revert back to my original? =
     67The file editors have been improved to include a code/lint checker and other checks to ensure that they include certain working pieces. However, nothing is full-proof, so in the case that something happens, a backup is automatically stored in the same folders as the originals before being saved. The backups are named with the date and time from which they were replaced. For example, the `wp-config.php` file will have been renamed to `wp-config-2022-08-22-15-25-46.php` and replaced with a new file. Simply log into your FTP or File Manager (from your host), rename the current file to something else such as `wp-config-BROKEN.php` (just in case you need it), and then rename the version you want to revert back to as `wp-config.php`. If everything looks good, then you can either delete the broken file or send a copy of it to PluginRx so we can figure out what went wrong.
     68
     69= How can I switch between dark and light mode? =
     70Click on the bug icon in the header. ;)
     71
     72= What is Test Mode? And How do I get out of it? =
     73If you are seeing that Test Mode is Active in the header, you likely accidentally clicked on the version number. Test Mode is for our developers only. If you contact support with an issue you are having with the plugin not working the way it should be, we may have you activate Test Mode with additional instructions on what to provide so we can handle it promptly. It is of no use to you otherwise. Just click on the version number in the header again to disable it.
    6174
    6275= Why can't I edit a username for a user? =
     
    6477
    6578= Where is the centering tool? =
    66 Viewable only on the front-end, there is a link on the admin bar that shows `+Off`. Click on it and it will add a transparent bar with lines on it at the top of the page underneath the admin bar. If you click on the centering bar it will expand all the way down the page. Click on it again and it will minimize back to the top. You can click on the `+On` link from the admin bar to make it go away.
     79Viewable only on the front-end, there is a link on the admin bar that shows `+ Off`. Click on it and it will add a semi-transparent bar with lines on it at the top of the page underneath the admin bar. If you click on this bar it will expand all the way down the page. Click on it again and it will minimize back to the top. You can click on the `+ On` link from the admin bar to make it go away.
    6780
    6881= Where are the quick debug links? =
    69 You have to enable them on the Developer Debug Tools settings first. Once they are enabled, an "ID" column will be added to the user and/or post admin list pages. Next to the user or post's ID you will see a lightning bolt icon. Clicking on the lightning bolt will redirect you to the User Meta or Post Meta tab on our plugin where you can view and edit all of the meta easily.
     82You have to enable them on the Developer Debug Tools settings first under the Admin Menu tab. Once they are enabled, an "ID" column will be added to the corresponding admin list pages. Next to the user or post's ID you will see a lightning bolt icon. Clicking on the lightning bolt will redirect you to the Metadata page on the plugin where you can view and edit all of the meta easily. Links are also added to the user profile and post edit screens.
    7083
    7184= I hid the plugin, now I can't find it! =
    72 You can get there directly by going to `https://yourdomain.com/wp-admin/admin.php?page=dev-debug-tools`. Be sure to bookmark it next time like the instructions say to do!
     85You can get there directly by going to `https://yourdomain.com/wp-admin/admin.php?page=dev-debug-dashboard`. Be sure to bookmark it next time like the instructions say to do!
     86
     87= I password-protected the plugin and forgot my password, how can I reset it? =
     88If you password-protected your `options.php` page like you should have (included by default), then you will need to log in directly to your database and clear the password manually (`{prefix}_options` table > delete key `ddtt_pass`). We used to have a forgot password option that would email a reset link to the devs, but it's easy to intercept that email with various email logging plugins if you have access to the admin area of your site.
    7389
    7490= Where can I get further support? =
     
    7692
    7793== Demo ==
    78 https://youtu.be/l45T__AIHME
     94https://youtu.be/36aebqdzHQw
    7995
    8096== Screenshots ==
    81 1. Settings page
    82 2. Activated plugins with warnings
    83 3. View, filter, and clear debug.log file
    84 4. View wp-config.php file
    85 5. Some of the snippets you can add/remove from your wp-config.php file
    86 6. View .htaccess file
    87 7. Cron jobs
    88 8. View and update a user's meta
    89 9. Database table records
    90 10. Check API statuses
    91 
    92 == Changelog ===
     971. Dashboard
     982. Tools page: enable/disable, sort, favorite
     993. Debug Log viewer using Easy Reader
     1004. Post Meta viewer and editor
     1015. Config file viewer and editor
     1026. Database table records viewer
     1037. Post Type viewer
     1048. Shortcode finder
     1059. Online users settings in light mode and admin bar drop down
     10610. Admin bar centering tool
     107
     108== Changelog ==
     109= 3.0.0 =
     110* Major update: rewrote the plugin for better performance, UI and UX
     111* Fixes: Fixed a number of bugs throughout
     112* Update: Added a light mode option by toggling the bug icon in the header
     113* Update: More customization on almost every page
     114* Update: Most pages now remember your last results
     115* Update: Cleaned up the admin menu, moved tools to a dedicated Tools section
     116* Update: Changed navigation tabs to a drop down in the top-right corner
     117* Update: Added a dashboard with versions, server metrics, environment info, quick download of important files, and an issues check
     118* Update: New Tools dashboard allows you to disable tool scripts you aren't using
     119* Update: Moved all Plugins tab data to WP Plugins page with options to enable/disable each, plus added a notes feature
     120* Update: Removed tools/tabs - Plugins, Error Types, Error Suppressing, Functions.php, Media Library, Domain, Regex, Available Functions/Hooks
     121* Update: Combined different Error Logs, Activity Logs, and custom logs into a Logs section
     122* Update: Combined User Meta and Post Meta into a new Meta Data section, added Term Meta, Comment Meta, Media Meta
     123* Update: WP-CONFIG and HTACCESS tools now have improved snippets area, raw editors, magic cleaners and a code/lint checker
     124* Update: Testing tool is now a built-in HTML/PHP editor
     125* Update: Improved security for password protected pages
     126* Update: New tools and options - Discord Messenger (Tool), Signups (Tool), Hearbeat Monitor (Settings > Heartbeat)
     127* Update: Added an optional log count indicator to the admin bar
     128* Update: Deprecated hooks: ddtt_debug_log_help_col, ddtt_debug_log_max_filesize, ddtt_on_update_user_meta, ddtt_on_update_post_meta, ddtt_ignore_pages_for_discord_notifications
     129* Update: Deprecated functions: ddtt_get(), ddtt_increase_test_number(), ddtt_get_current_url()
     130* Update: Improved help guide and developer documentation on our website
     131
    93132= 2.1.2 =
    94133* Update: Added Bulk Delete option to Site Options tab (props @venutius for feature request)
Note: See TracChangeset for help on using the changeset viewer.