[wp-trac] [WordPress Trac] #15536: Introduce register_plugin
WordPress Trac
wp-trac at lists.automattic.com
Mon Nov 22 09:25:52 UTC 2010
#15536: Introduce register_plugin
-------------------------+--------------------------------------------------
Reporter: filosofo | Owner: filosofo
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Plugins | Version:
Severity: normal | Keywords: has-patch, close
-------------------------+--------------------------------------------------
Comment(by filosofo):
Replying to [comment:1 westi]:
> Why?
For the reasons mentioned:
* Plugins ''all'' have to repeat the same code, sometimes less
effectively than we would desire. And code duplication is not desirable.
* Plugins often initialize at the wrong point (too early or too late).
This takes care of it for them.
Note that your example only works for static methods in `MyPlugin`. To
actually instantiate, you have to do something like the following:
{{{
function load_my_plugin()
{
global $my_great_plugin;
$my_great_plugin = new MyPlugin;
}
add_action('plugins_loaded', 'load_my_plugin');
}}}
The current API requires ''practically every single plugin'' to repeat
this type of code.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15536#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list