|
From: Tyler A. <ty...@bo...> - 2000-12-31 17:10:35
|
I was wondering if anyone was formally creating the archetecture for the plugins. If not, I have a lot of ideas. [ Install / Config ] Each plugin should report its version number, name, and have some way to tell the configure script (hopefully a PHP script this time) what variables need to be defined with text boxes, pull-down lists, checkboxes, etc. The easiest way is to create a few functions or a global array in every plugin. I think I'd go for the array myself. I'd probably name it $squirrelmail_plugin-name_info or something hideously long and very hard to ever mix up with something else. Array Index What it Holds -------------------------------------------------------------------- Version Version number (float or string) Name Human-readable version of the plugin's name Maintainer Maintainer of the plugin (name) MaintainerEmail Maintainer's email address, if any I am sure that you can think of more. For the configuration, maybe a 'ConfigurePage' array element that lists the PHP page to go to in order to configure the plugin. I'm still somewhat fuzzy here. A few vital functions are needed too. Imagine all functions prepended with "squirrelmail_plugin-name_" (saves on typing). Function What it Does -------------------------------------------------------------------- Verify Makes sure that the plugin is configured correctly List_Hooks Returns an associative array of function names and hooks Again, more can go in here. I think that plugins need to be configured properly and all the tests that they can do can be verified (hence 'Verify()') before they are allowed to be included into SquirrelMail via the config script. I think the List_Hooks function is vital for speeding up SquirrelMail. You don't need all plugins loaded all the time. Just save which files need to be loaded for each hook. When the hook is called, just check to see if that file was loaded yet. If not, load it. Then simply call the hook. That should really speed things up. The configure script should remember the version number/string that is passed to it, and the hook processing function should verify that the version number is the same. If it is not, then don't use that plugin. This should prevent misconfigurations from upgrades and from people not reconfiguring the plugins. [ Removal ] Plugins may need specific information to be recorded -- like the translate plugin lets you move it left/right/center on the bottom of your screen. It should be mandatory that plugin variables that are saved in the user's preferences be prepended with 'plugin-name_' so they can be optionally removed automatically when the plugin is uninstalled. -- Tyler Akins ty...@bo... |