<?php
/*
Plugin Name: Plugin Test
Plugin URI: http://www.santosj.name
Description: Horriblely break WordPress
Author: Jacob Santos
Version: code base
Author URI: http://www.santosj.name
*/

new TestPlugin();

class TestPlugin
{
    var $message = 'Hey, message was not updated! WTF?';
    
    function TestPlugin()
    {
        $this->construct();
    }
    
    function __construct()
    {
        add_action('init', array(&$this, 'init'));
    }
    
    function init()
    {
        add_filter('the_content', array(&$this, 'the_content'));
        add_filter('the_title', array(&$this, 'the_title'));
        
        // This illustrates, why it is useful to remove a plugin
        // It could be further illustrated by plugins that wish to check and
        // remove filters from other plugins and then add them again. Or
        // move their own hooks that are no longer needed, while still in
        // loop.
        
        $this->message = 'Removal Failed! Not seriously, but fix me!';
        
        
        add_action('wp_head', array(&$this, 'stop_message'));
        add_action('admin_head', array(&$this, 'stop_message'));
    }
    
    function the_content($content)
    {
        return $this->message;
    }
    
    function the_title($title)
    {
        return 'Removal Failed!';
    }
    
    function stop_message()
    {
        remove_filter('the_content', array(&$this, 'the_content'));
        remove_filter('the_title', array(&$this, 'the_title'));
    }
    
}