[wp-hackers] Plugin dependency checking

Stephen Rider wp-hackers at striderweb.com
Tue Jun 16 23:44:51 GMT 2009


On Jun 16, 2009, at 6:20 PM, scribu wrote:

> On 6/16/09, Stephen Rider <wp-hackers at striderweb.com> wrote:
>>
>> Mike Schinkel's argument is correct that even if I program a  
>> dependent
>> plugin intending it to be used with "Plugin A", it might be entirely
>> legitimate for someone to create "Plugin B" that can also use that
>> "sub plugin".  This breaks if the sub plugin is checking for a
>> specific "master"; but works just fine if the sub plugin says "I can
>> do X for you" and the (any) master says "If any plugins can do X, do
>> it now".
>
> Now I finally get what Mike was trying to say about why to use
> interfaces. (I think we should stick to this term)

I'm not going to fight about the term.  "Interfaces" works.  :)

As I see it, everything needed to do this already exists within  
WordPress.  The sub-plugin can do a custom add_action, and the master  
plugins can do a do_action on the same hook.

Off the top of my head, an existing plugin that already does this is  
Ozh's Drop Down Menu plugin.  I'm sure there are others.  The Ozh menu  
plugin has action hooks for, among other things, adding a custom icon  
for a particular menu item.  Thus, another plugin can make itself  
compatible with the Ozh menu by having its own icon.

Ozh plugin:
http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/

API here:
http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/api-for-plugin-coders/


Stephen

-- 
Stephen Rider
http://striderweb.com/


More information about the wp-hackers mailing list