=== Plugin Name === Contributors: Silasco Solutions Donate link: http://www.communitymodder.com/Released-wordpress-plugins/wp-pear-debug-wordpress-plugin.html Tags: debug, pear, php_debug, debugging, database debug, performance debug, performance Requires at least: 2.6 Tested up to: 2.6 Stable tag: 1.2 This plugin incorporates the pear php_debug library into wordpress. == Description == This plugin incorporates the pear php_debug library into wordpress. I started creating a new website around wordpress and noticed that there was no way to quickly access debug information so I integrated this class into wordpress for quick easy debugging when developing or experiencing problems on your wordpress website. Please feel free to discuss it [here:](http://www.communitymodder.com/Released-wordpress-plugins/wp-pear-debug-wordpress-plugin.html) Plugin Home. Unfortunately php_debug only works in php5 so this plugin will only work in php5. I will happly incorporate another library that can work with php4 if someone sends me one. Please also note that I developed this plugin on wordpress 2.6 and can't guarantee that it will work on v2.5. This plugin makes use of some features only avaialable in the newest wordpress releases. - Features This plugin unlike most operates from within a class. There are several options which can be set in the admin section 1. Debug Status: Overall this option allows you to enable and disable debugging entirely 2. Display Debugging for: Guests This option allows you to enable debugging when no user is logged in 3. The rest are a list of roles found in the sytem, eg. editor, contributor, administrator For each you have the following options: Admin & Front End, Admin Only, Front End Only, Disable 4. The plugin shows queries that were run by wordpress Please not that some queries run before the plugin is initialized 5. You can easly add debug information to the debugger by making use of several functions `add($variable); //add variable to debug $oDebug->dump($object,$varname); //var_dump an array or object. $varname optional $oDebug->queryRel($info); //add query related info $oDebug->error($info); //add user error //more options available in the pear::php_debug documentation //With v1.2 you have access to several wrapper functions wp_pear_debug::add(); wp_pear_debug::dump(); wp_pear_debug::error(); wp_pear_debug::queryRel(); ?>` 6. Debug information appears in a neat panel controlled by javascript. The options expand and collapse. The debug panel also has a close button to completely remove the debug panel. 7. Note that the debug bar floats at the top right and will not disrupt your layout. 8. TO ensure layout stability the mod is hard coded to use only the HTML Div Renderer 9. displaying server and response varables. * Request * Response * Setings * Globals * Php * Files * Database queries * Execution time * Errors and messages * Link to w3c validator 10. With v1.2 you can add debug information via shortcode from within your post. == Installation == File list * css (containing style sheet for the plugin) * Debug (debug php helper functions) * images (images for the plugin * js (javascript for the plugin) * DebugLine.class.php (debugger helper class) * PHP_Debug.class.php (main debug class) * wp-pear-debug.php (Main plugin file) 1. UPload folder `wp-pear-debug` to the `/wp-content/plugins/` directory 2. Activate the plugin through the 'Plugins' menu in WordPress 3. Set the appropriate option under settings->Debugger admin menu == Frequently Asked Questions == = Does this plugin work with php4 = No this plugin does not work with php4 because the debug library pear::php_debug is php5 only. However, If I am able to get a good debug library which works with php4 I will be happy to include it. This plugin uses wrapper classes that allows you to quickly switch between libraries. A possible structure would be 1. Lib/php4/debugversion/1.x.x/ 1. Lib/php5/debugversion/1.x.x/ All these would be options in the debug settings = Do I need pear installed to get this working = No, pear is not required for this plugin to work = Who is this for = I imagine this plugin will be most valuable to wordpress developers generally It will also be good for people who are having errors on their site. This plugin also measures script execution time so It is also good for people who want to measure the performance of their entire site or a specific part of their script. = Can I see the library in action? = You can see the pear demo [here:](http://www.php-debug.com/www/PHP_Debug_HTML_Div_test.php) Pear Demo. == Screenshots == [screenshot1 screenshot1](http://www.communitymodder.com/images/screenshot-1.jpg) The screnshot displays the admin section for the debug plugin. To the top right is the floating debug bar. [screenshot2 screenshot2](http://www.communitymodder.com/images/screenshot-2.jpg) The screnshot displays the admin section for the debug plugin. To the top right is the database debug information. == Interesting Points == Since the plugin is wrapped in a class it can easily be extended to add more functionality. The most promising possibility I have seen is the add_filter() method which I used to get the query information in the debug. Though I have not tested this thoroughly but the library also allows you to watch variables.