WordPress FirePHP plugin

11 Comments 24th FEB 2009 | Posted by Ivan Weiler in Wordpress

WordPress FirePHP plugin

While tracing some code in WordPress i got tired of var_dumps, so i quickly coded FirePHP plugin. All it does is include FirePHP and forces WordPress to load it before other plugins, so that you can use it in plugin development.

wp_firephp_v.0.2.rar
wp_firephp_v.0.1.rar

It’s tested on WP 2.7 and someone might find it useful! I got few more ideas to implement to make it useful for theme debugging, but that’s another version ;)

If you like what you read, please share it.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Yahoo! Bookmarks
  • Reddit
  • Technorati
  • Twitter
  • StumbleUpon
  • LinkedIn
  • Netvibes
  • NewsVine
  • Sphinn
  • Tumblr
  • Posterous

To post code in comments, place your code inside [code] and [/code] tags.

There are 11 comments (Add Yours +)

  • Wow great post. I have been searching online for awhile and I came accros this post. It was just what I needed. Thanks and keep up with the great content.

  • Thanks for implementing a plugin for wordpress.

    I have added a link to this post to the FirePHP Wiki: http://www.firephp.org/Wiki/Libraries/Wordpress

  • Thank you! I’ll add some more wp functionality when i catch some free time ;)

  • I just cannot get this to work. Installs fine on WP 2.7.1 running php 5. I’ve got both Firebug and Firephp plugins installed. I typed in fb(‘hello’); in my functions.php for just for a test but nothing shows up on the console. Any ideas?

  • I just added some small changes. Now theme debugging should work.

    @jding: It should solve your functions.php problem.

  • Hello all,

    I am having troubles to get the plugin to work. That’s what i did:

    1) Unzip the plugin into the /plugins directory.
    2) Insert this code in my index.php:

    10, ‘j’=>20);

    $firephp->log($var, ‘Iterators’);

    ?>

    But then I get the following error:

    Fatal error: Uncaught exception ‘Exception’ with message ‘Headers already sent in /var/www/wordpress2/wp-content/themes/extended/header.php on line 2. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.’ in /var/www/wordpress2/FirePHPCore/FirePHP.class.php:949 Stack trace: #0 /var/www/wordpress2/FirePHPCore/FirePHP.class.php(624): FirePHP->newException(‘Headers already…’) #1 /var/www/wordpress2/FirePHPCore/FirePHP.class.php(510): FirePHP->fb(Array, ‘Iterators’, ‘LOG’) #2 /var/www/wordpress2/wp-content/themes/extended/index.php(11): FirePHP->log(Array, ‘Iterators’) #3 /var/www/wordpress2/wp-includes/template-loader.php(27): include(‘/var/www/wordpr…’) #4 /var/www/wordpress2/wp-blog-header.php(16): require_once(‘/var/www/wordpr…’) #5 /var/www/wordpress2/index.php(17): require(‘/var/www/wordpr…’) #6 {main} thrown in /var/www/wordpress2/FirePHPCore/FirePHP.class.php on line 949

    Any help would be really appreciated as I usually develop for wordpress.

    Thanks in advance.

    PS: My server config:

    # Sistema Operativo : Linux
    # Servidor : Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 PHP/5.2.4-2ubuntu5.5 with Suhosin-Patch
    # Uso de memoria : 26.69 MB
    # Versión de MySQL : 5.0.51a-3ubuntu5.4
    # Modo SQL : No definido
    # Versión de PHP : 5.2.4-2ubuntu5.5

  • @Javier:
    This plugin starts output caching(ob_start()) at init hook.

    I’m not sure if this error has anything to do with my plugin since i see that your firephp class is at /var/www/wordpress2/FirePHPCore/FirePHP.class.php. Or did you change include path?

    If you’re using FirePHP that you included yourself, just try to add ob_start() before any wp output.

    Or just remove any instance of FirePHP if you have it and install v.0.2 of my plugin.

  • Sorry, I paste the php code again:

    $firephp = FirePHP::getInstance(true);

    $var = array(‘i’=>10, ‘j’=>20);

    $firephp->log($var, ‘Iterators’);

    Thanks in advance!!

  • thanks for the plugin!
    very useful!

  • Luke Mackenzie Says

    please post code example of how to use it!

  • Tried this with WP 3.0.1 and works fine (couldn’t get WP_FirePHP to fly).
    Easiest thing in the world to use. Install and activate plugin as per. Then anywhere in your template files just call the fb() function as per FirePHP docs http://www.firephp.org/HQ/Use.htm .
    So I’m working on dynamic sidebars responding to the new Nav Menu structures, so I can call

    fb(wp_get_nav_menus());

    to find out which Nav Menus are available.
    Don’t forget to install the FirePHP extension to Firebug too https://addons.mozilla.org/en-US/firefox/addon/6149/

Leave a Comment

Please wrap all source codes with [code][/code] tags.
Magento Design and Development | Magento SEO | iPhone Application Development Web Application Development with ZEND | WordPress Ecommerce | WordPress development
Sitemap

Inchoo - webappsolutions | 2009