[wp-hackers] Plugin dependency checking

scribu scribu at gmail.com
Thu Jun 18 02:29:17 GMT 2009


[--Don't know what happend to my message above--]

About validating interfaces, it just dawned on me that the safest way
would be to simply act like a consumer of that interface. For example:

define_interface('My Interface', '1.0', array(
 'constants' => array('FOO_CONST'),
 'classes' => array('foo_class', 'bar_class')
);

----------

// validating interface 'My Interface':

foreach ( $interface('classes') as $class )
  if ( ! class_exisits($class) )
    return;  // interface not implemented properly

and so on for globals, functions etc.

Not sure about dynamic actions and hooks. Maybe defining them with
wildcards? 'my_filter_*'.


Another benefit of using interfaces would be that name collisions
would be easier to identify.

-- 
http://scribu.net


More information about the wp-hackers mailing list