Plugin Directory

Changeset 188347


Ignore:
Timestamp:
12/31/2009 03:32:45 AM (16 years ago)
Author:
silasco
Message:

updated readme for v1.4.1

Location:
wp-pear-debug/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-pear-debug/trunk/readme.txt

    r150601 r188347  
    44Tags: debug, pear, php_debug, debugging, database debug, performance debug, performance
    55Requires at least: 2.8
    6 Tested up to: 2.8.4
    7 Stable tag: 1.4
     6Tested up to: 2.9
     7Stable tag: 1.4.1
    88
    99This plugin incorporates the pear php_debug library into wordpress.
     
    3131    For each you have the following options: Admin & Front End, Admin Only, Front End Only, Disable
    32324. The plugin shows queries that were run by wordpress
    33         Please not that some queries run before the plugin is initialized
     33        Please note that some queries run before the plugin is initialized. to ensure most if not all queries get recorded see step 4 in installation section. v1.4.1 shows not only the query but the time taken by the query and the function which called the query.
    34345. You can easly add debug information to the debugger by making use of several functions
    3535
    3636    `<?php
    37        
     37        //For advanced use.
     38        //Direct access to instance of debugger
    3839        $oDebug = wp_pear_debug::get();     
    3940        $oDebug->add($variable); //add variable to debug
     
    4445       
    4546        //With v1.2 you have access to several wrapper functions
     47        //Enough for most people
    4648                wp_pear_debug::add();
    4749                wp_pear_debug::dump();
    4850                wp_pear_debug::error();
    49                 wp_pear_debug::queryRel();
     51        //if you actually run this query using wpdb
     52        //It will probably appear anyways.
     53                wp_pear_debug::query();
    5054
    5155   
     
    7175    * Link to w3c validator
    727610. With v1.2 you can add debug information via shortcode from within your post.
     77`[wp_pear_debug]foo bar[/wp_pear_debug]`
     78 `[wp_pear-debug foo="bar" foo1="bar2"]`
    7379
    7480
    7581== Installation ==
    7682
    77 Please note that v1.3 works up to wordpress version 2.8. However, I cannot guarantee v1.4 below version 2.8
    78 because of the use of new hooks and methods. In using version 1.3 you are not foregoing any new features so please download
    79 the appropriate version.
     83Please note that v1.3 works up to wordpress version 2.8. However, I cannot guarantee v1.4.1 below version 2.8
     84From version 1.4.1 and version 5 there will be features not present in v1.3 such as database query execution time and database query back trace.
    8085
    8186File list
     
    92972. Activate the plugin through the 'Plugins' menu in WordPress
    93983. Set the appropriate option under settings->Debugger admin menu
     994. The following step is optional but recommended. Add the following code to wp-config.php `define('SAVEQUERIES',true);`
    94100
    95101== Frequently Asked Questions ==
     
    122128
    123129== Interesting Points ==
     130This plugin is completely encapsulated. This means that all functionality is hidden within the static wp_pear_debug class. This is important because it allows convenient naming of methods while avoiding conflicts.
    124131
    125 Since the plugin is wrapped in a class it can easily be extended to add more functionality.
    126 The most promising possibility I have seen is the add_filter() method which I used to get the query information in the debug.
    127 Though I have not tested this thoroughly but the library also allows you to watch variables.
    128132
  • wp-pear-debug/trunk/wp-pear-debug.php

    r188343 r188347  
    66 * Author: Community Modder
    77 * Plugin URI: http://www.communitymodder.com
    8  * Version: 1.4
     8 * Version: 1.4.1
    99 * =======================================================================
    1010 */
     
    3232    const WPD_CSS = 'wp_pear_debug_css';
    3333   
    34    
    35    
    3634    //Definitions
    3735    const WPD_GUEST_ROLE = 'guest';
     
    4442    }
    4543   
    46     //return the path to the plugin fold
     44    //return the path to the plugin folder
    4745    private static function path()
    4846    {
     
    9795            {           
    9896                $sFile.= $sPart.".class.php";
    99                
    10097                break;
    101                    
    10298            }           
    10399            $iCount++;
     
    111107        {
    112108            throw new Exception($sFile);
    113            
    114         }
    115    
    116     }
    117     //return instance of class
     109        }
     110   
     111    }
     112    //return instance of class from file
    118113    public static function getClass($sClassPath)
    119114    {
     
    127122        {
    128123            $oClass = $oClass->singleton();
    129            
    130         }
    131    
     124        }   
    132125        return $oClass;
    133        
    134126    }
    135127   
     
    140132        $sDebug = self::enabled();
    141133   
    142    
    143134        if($sDebug)
    144135        {
    145136            //Instruct wordpress to save queries
    146             //Please do this in wp-config.php instead
    147             define('SAVEQUERIES',true);
     137            //If not set in wp-config.php then set. Keep in mind we may miss some queries as a result
     138            if(!defined('SAVEQUERIES') || !SAVEQUERIES)
     139            {
     140                define('SAVEQUERIES',true);
     141            }
    148142            //register javascript
    149143            wp_register_script(self::WPD_JS, "".self::url()."/js/html_div.js");
     
    166160            }       
    167161
    168             //unlimited possibilities for add_filter and this plugin
    169             add_filter('query',array('wp_pear_debug','query'));
    170162            //Enable shortcode debug entry point
    171163            add_shortcode('wp_pear_debug', array('wp_pear_debug','short'));
     
    186178    {
    187179        //Add query info before render
    188         //This new method should gather most if not all the query info
     180        //This method should gather most if not all the query info
     181        //Use define('SAVEQUERIES',true); in wp-config.php for best results
    189182        self::_processQueries();
    190183        //Render debug information
     
    208201        foreach(self::getDB()->queries as $query)
    209202        {   
    210             self::get()->query('[ function: '.self::queryCaller($query[2]).' ] '.' [ '.self::toSeconds($query[1]).' secs ] '.$query[0]);
     203            self::get()->query('[ '.self::queryCaller($query[2]).' ] '.' [ '.self::toSeconds($query[1]).' secs ] '.$query[0]);
    211204        }   
    212205    }
     
    242235        Get option automatically creates options that are non existent
    243236        Therefore the initial state of the plugin will be the desired effect where all options are disabled
    244         Hence the absence of an installer
     237        Hence the absence of an installer.
     238        Ok...Installer coming in version 1.5 when more options are added.
    245239        ******/
    246240        if( get_option( self::opt( self::WPD_STATUS) ) == self::WPD_ENABLE )
     
    262256            if(  is_numeric(get_option(self::opt($role)))  )
    263257            {
     258                return get_option(self::opt($role));
     259            }
     260       
     261        }
     262        else
     263        {
     264            return false;
     265        }
     266       
     267
    264268               
    265                 return get_option(self::opt($role));
    266            
    267             }
    268        
     269    }
     270
     271    //wrapper functions
     272    //Library contains more functionality but these are essentials
     273    //Add plain text message
     274    public static function add($sVar)
     275    {
     276        self::get()->add($sVar);           
     277    }
     278   
     279    //add array like print_r or array item like $foo['bar']
     280    public static function dump($obj, $varName = '')
     281    {
     282        self::get()->dump($obj, $varName);         
     283    }
     284   
     285    //Database related info
     286    public static function queryRel($sInfo)
     287    {
     288        self::get()->queryRel($sInfo);         
     289    }
     290   
     291    //Your own generated error
     292    public static function error($sInfo)
     293    {       
     294        self::get()->error($sInfo);
     295    }
     296   
     297    //shortcode entry point to debug
     298    //Useful for debugging other short codes
     299    //Usage: [wp_pear_debug]foo bar[/wp_pear_debug]
     300    //Usage: [wp_pear-debug foo="bar" foo1="bar2"]
     301    public static function short($atts,$sContent='')
     302    {
     303        if( isset($sContent) && !empty($sContent) )
     304        {
     305            self::add($sContent);
    269306        }
    270307        else
    271308        {
    272             return false;
    273         }
    274        
    275 
    276                
    277     }
    278 
    279         //wrapper functions
    280         //Library contains more functionality but these are essentials
    281        
    282         public static function add($sVar)
    283         {
    284             self::get()->add($sVar);           
    285         }
    286         public static function dump($obj, $varName = '')
    287         {
    288             self::get()->dump($obj, $varName);         
    289         }   
    290         public static function queryRel($sInfo)
    291         {
    292             self::get()->queryRel($sInfo);         
    293         }
    294         public static function error($sInfo)
    295         {       
    296             self::get()->error($sInfo);
    297         }
    298         //shortcode entry point to debug
    299         //Does not return anything
    300         //Picks up data from post content
    301         //Have no idea what this can be used for! lol!
    302         public static function short($atts,$sContent='')
    303         {
    304            
    305             if( isset($sContent) && !empty($sContent) )
    306             {
    307                 self::add($sContent);
    308             }
    309             else
    310             {
    311                 self::dump($atts);
    312             }
    313         }   
     309            self::dump($atts);
     310        }
     311    }   
    314312
    315313//Add in admin options with link under settings "Debugger"
    316314//Indent this big mess? Thank wordpress for that...This should all be javascript
    317 public static function admin()
    318 {
    319 
    320     add_options_page('Debugger Options', 'Debugger', 10, '/wp-pear-debug/'.basename(__FILE__),array('wp_pear_debug','options'));
    321  }
    322 
    323 
     315    public static function admin()
     316    {
     317        add_options_page('Debugger Options', 'Debugger', 10, '/wp-pear-debug/'.basename(__FILE__),array('wp_pear_debug','options'));
     318    }
     319
     320//Do I hear multi language? ha!
    324321public static function options()
    325322{
Note: See TracChangeset for help on using the changeset viewer.