On Mon, Jun 9, 2008 at 12:43 PM, A.L.E.C alec@alec.pl wrote:
I think it would be good start for plugins API to get rid of hardcoded actions from index.php. So, we have such code:
// include task specific files if ($RCMAIL->task=='mail') { include_once('program/steps/mail/func.inc');
if ($RCMAIL->action=='show' || $RCMAIL->action=='preview' || $RCMAIL->action=='print') include('program/steps/mail/show.inc');
...
My proposition is to create file for each action (filename = actionname) in tasks directories, and then we have:
foreach(array('plugins', 'steps') as $dir) if (file_exists('program/'.$dir.'/'.$RCMAIL->task.'/'.$RCMAIL->action.'.inc')) { @include_once('program/'.$dir.'/'.$RCMAIL->task.'/_init.inc'); // init actions (renamed func.inc)
@include_once('program/'.$dir.'/'.$RCMAIL->task.'/'.$RCMAIL->action.'.inc'); @include_once('program/'.$dir.'/'.$RCMAIL->task.'/_destroy.inc'); // post actions break; }
Maybe we can work on a required set of "methods" and calls for all plugins to get rid off those [file, function]_exists() things. We could also register available methods/calls via an ini file (of course parsing of those should be cached) which exposes them.
I am all for dropping in plugins and running them - on the same side this very dynamic context also eats away on resources, so maybe we should have a plugin.ini after all which initializes them or lets roundcube know what is available.
I'd also like to seperate "core" feature set and plugins. Not everything (by definition)is a plugin, even if they are handled the same.
RE: hooks - interesting idea, I think that would make sense. We can utilize jquery to perform the frontend things for that. We'd probably need an "ajax" endpoint so jquery can give the endpoint a context (e.g. reading mail, writing mail, browsing addressbook, browsing folder, ...) and in return get available plugins for the hooks that are available in this context.
Also check out the wiki for some notes that Brennan and I took on a plugin api.
Till _______________________________________________ List info: http://lists.roundcube.net/dev/