david64 wrote:I don't think he was using __call, but it must have been something like that. Think it might have been using reflection gubbins.
This is the same way I was doing events until I removed that part of things from my code base.
So if you are defining events with the above code, what are you doing to add an event?
Code: Select all
Unus::addEvent( 'eventName', 'eventMethod' array( 'args' ) )
Something like that? I was doing something along those lines.
There is no need to add an event anywhere only dispatch them.
Observers on the other hand are added via a built in intelligent system, depending on the current mode you have the system set in. All observers are stored in a directory which houses all of their code.
The plugin system is 2 completely separate parts the event dispatcher only interacts with the observer collection when it is telling it what is currently happening, the dispatcher has no clue what observers are waiting for the events its dispatching, as thats is not its purpose, that is the purpose of the observer collection
The way the system is constructed you are not limited to only having one observer called per-event, there can be an unlimited number of plugins loaded from a single dispatched event.
New Observers "or plugins" are automatically installed and added into the database once they are added into this directory and can be enabled/disabled via the administration.
If you are set in "Developer" mode any new observers are automatically installed added and set as enabled and will run on that page load if an event calls it, observers do not need any arguments called with them because of the way I have built the system.
There is only one line needed to call a plugin and that is only.
The plugin system is all automatic and requires no interaction, between the programmer and the plugin ( well expect for development of it )