[wp-hackers] [help] sink plugin hooks for $this references in WordPress 2.0 ?

Mark Jaquith mark.wordpress at txfx.net
Sat Jan 14 02:00:32 GMT 2006


On Jan 13, 2006, at 3:17 PM, Niels Hackius wrote:

> And I am also getting a confirmation that the constructor of the
> loadbalancer class has been run, however it doesn't run the installer
> function.
> I am doing this, because I am wanting to use $this references  
> within the
> class.

As a side note, instead of using a singleton when activating the hook:
add_action('publish', array(&$singleton, 'function'));

You can do this:
add_action('publish', array(&$this, 'function'));

... as long as you call the add_action from within the class.  For  
some classes, there is no benefit, but with some other classes,  
people might want to start up a second instance, and this allows them  
to do so, because you haven't hardcoded the singleton object's name  
into the class.  Plus, it's just good coding. :-)
--
Mark Jaquith
http://txfx.net/




More information about the wp-hackers mailing list