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;
  }


plugins directory it's just for possibility to overwrite built-in action 
with plugin action.

-- 
Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252
LAN Management System Developer http://lms.org.pl
Roundcube Webmail Project Developer http://roundcube.net
_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to