Hi
I've almost completed work on version 0.1 of phpSecureSite (http://www.sourceforge.net/projects/phpsecuresite), and one of the new features in this version is support for loadable modules. Currently the module subsystem is rather primitive, it only includes a file defining variables, constants and functions for the module and registering the module as loaded in an array, but I'd like to extend the possibilities of modules.
I don't know the proper terminology, so I'll explain it using my own words 🙂 I'd like to make it possible for module writers to say that when a user logs in, this functions should be called. It should also be possible to access the variables accessable by the environment from which control is passed.
I would like to build a system like UNIX signals, where a "signal" is emitted when a user logs in, and the module writer could say that upon signal X, run this function. The solution I've found so far would be to create an array containing signals, for example ;
$phpss_signal['login']
$phpss_signal['logout']
Then I would create a functions which adds functions pointers to the array, so that to make a log entry when a user logs in, I would add the following entry to the array :
$phpss_signal['login']'log'
Would this be a good way of adding "signal" support to my system, or should it be implementet in another way?
And yes, I know this isn't what UNIX signals are, but I'll just use the term until I find a better name for it 🙂 And btw, are these sort of functions what is referred to as hooks?