Hi!
I have already improved the plugin system for next version but I feel
that it could still be more powerful. The main problem is that in order
to enable advanced users to develop plugins that are powerful enough, I
believe we should provide plugins with some kind of "hooks" deep into
the core so that for example they can work with intermediate data and
modify that data if necessary, instead of working on final data that
cannot be changed or affected, as it currently works with
template-based plugins (you know, objects exported to the current
template)
I have been thinking about it and I even have a working implementation
but I am still not sure if this is going to be enough... The idea is
that the core will be throwing certain events to which plugins can
"subscribe". An event could be thrown when a post is loaded, or when a
comment is received, when a post is removed, etc. The list of events
can be as big as we want... These events would be thrown by the *Action
classes, which is not exactly the lowest level in the core but I think
it should be enough. The PluginManager would have a method called
throwEvent($eventType,$eventParameters) (or something like that), and
plugins which requested to be notified of this particular event would
be activated and a method called "processEvent" (or similar) would be
called. This method would do its job and then return something that the
class that threw the event understands... For example, think of a
plugin that subscribes to the EVENT_POST_LOADED event requesting to be
informed about any post that is loaded by pLog. The plugin would
receive the post as the parameter (of course, the amount and type of
parameters would depend on the event) and then for example, replace
known acronyms with the correct <acronym> tag and return the modified
post. And so on...
Action classes of course get more complex, and plugins get more complex
too... But on the other hand, I think that we gain flexibility for
plugin designers. What do you guys think? Or do you know a better way?
I think this is quite important because at some point there would be no
need for developing major releases anymore, and any kind of new feature
could be easily added via normal template plugins, new actions via
plugins, new filters via plugins or new event-based plugins, and pLog
could be left as the platform that allows those things and makes them
all work.
As I said earlier, there already is a working implementation and I will
put it up for download (it's not in CVS yet) as soon as I clean it up a
little, so that you can try it out and see it (well, if there's anybody
interested! :) But that doesn't mean that what I have now is final or
anything... otherwise I wouldn't be willing to discuss this with you!!!
Oscar
|