more on plugins
Plugins will be the major focus for the upcoming 0.8.1 release. In order to get a better feel for what is actually good or requiried, I started another plugin that will be both useful and instructive: a wiki plugin. Existing plugins will be updated and improved along the way, too.
One thing that really worried me for a while was that ZMPluing got quite bloated. having spend some more time actually thinking about the different pieces that make plugins work, I decided that ZMPlugin should be rather small and provide just the glue between core and the actual plugin logic to make things work.
One major aspect of this refactoring will be to redefine the way plugins retreive and store values in the database. This, however, depends on having an easy to use way to manage them.
Another slight worry is the current naming of actual plugin classes. Sure, the zm_ prefix is quite handy, considering that the classname is used to provide a global reference to the plugin instance. Still, it isa long way away from the regular naming conventions ZenMagick employs. This might need some more thinking to specify better rules.
Already implemented is the extraction of actual plugin business code into a separate class that extends ZMPluginHandler. The plugin will create a single instance that will be (re-)used to handle events, filter contents and so on. The initial handler is created on demand, so will hopefully not create to much overhead.
Also already implemented is loader support to add plugin code to core.php and the Zenmagick loader system. This will allow plugins to override controller and other supported classes that are instantiated by the loader. It also frees the plugin from worrying about including files itself which might become tricky if added to core.php (for example resolving filenames using __FILENAME__).
A fundamental requirement towards giving plugins the ability to serve individual admin pages is to allow dynamic additions to the admin menu system. This has been coded and wil make it into the next release. There might alsobe another patch to enable a new (leaner) page header for all ZenMagick admin pages. (There are a couple unresolved issues like page titles, but no showstopper as such)
Also in the process is dynamic support for pretty links. What this means is that plugins may add mappings that will be used to generate pretty links for new controller/views added by a plugin. (If not used, URLs will default to the standard zen-cart schema; ie: index.php?main_page=XXX)
So, all in all, the next release is looming even if not all might be included. Good times for plugin developer, though. As a side-effect, plugins may also be used to wrap up site wide code that then may be switched on/off on demand. For example, certain controllers could be replaced for special promotions, etc without the need to create a new theme. Another example that there are usually multiple ways of implementing things in ZenMagick!

[...] Original post by DerManoMann [...]
Pingback by » more on plugins — June 15, 2007 @ 2:00 am