Instantiate class to be available to all plugin functions

Ryan McCue had a nice idea for his plugin Hopper: add a callback for a custom filter to return the current instance.

Sample code for the plugin:

class Plugin_Class {
    public function __construct()
    {
        add_filter( 'get_plugin_class', array ( $this, 'provide_instance' ) );
    }

    function provide_instance() {
        return $this;
    }
}

In a theme or a second plugin you can access the instance now like this:

$plugin_class = apply_filters( 'get_plugin_class', NULL );

if ( is_a( $plugin_class, 'Plugin_Class' ) )
{
    // use the plugin class instance
}