I'm working on a generic form processor to be the be all, end all of my form processing woes that would be a simple drop in and editing a configuration file to do things like send mail, send mail using an html template, send mail using an html template encrypted using X.509, or GPG, or even send an email with a PDF attachment that has form values in it. Even posisble be able to configure it to map form inputs to database tables.
Anyway, how it acts is the config file is read, each instance of <module> loads a module, adds parameters defined in the configuration file, and marks delayed parameters (i.e. a module that depends on the result of some other module). Each module is added to a form processor, and on execution, the form processor calls perform() on each module, passing the post variables as well as any files that were posted, storing the result (i.e. html template generation) in a array that is keyed with the module name. When a module is executed that requires one of those results, the form processor adds it as a parameter before executing it.
I guess my question is, would it be cleaner to instead add modules as sub modules to a module? For example, x.509 would require a complete email message in proper format with headers if we want to send the email with attachments or a special mime type (html). It almost seems it would be more appropriate to add them as filters, as the encryption process using either GPG or X.509 would be performed after a valid email message is generated, but before it is actually sent.
Any ideas would be apperciated.
Here's an example configuration file that outlines what I have so far:
<param name="htmlmailtemplate" value="indvpreapp.txt"/>
<param name="success" value="indvpreapp.txt"/>
<param name="failure" value="fail-template.txt"/>
<param-from module="Processing" name="invalid_inputs"/>
<param name="to" value="email@example.com"/>
<param name="subject" value="test"/>
<param-from module="Templates" name="templates"/>
<!-- filters to apply to message before it is sent -->
<param name="key" value="foo.cer"/>