If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Features Wish List / Plugin system - call back events

Plugin system - call back events

Locked

Started by matt_t_hat on 23 Jun 2006, 8:00 AM · Views: 1,960

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
23 Jun 2006, 8:00 AM
#1
matt_t_hat avatar

matt_t_hat

New Zenner

Join Date:
Oct 2005
Location:
Kent, UK
Posts:
15
Plugin Contributions:
0

Post #1 by matt_t_hat

I'm guessing this is a wish list rather than code suggest so I'll post it here.

I suggest a Call Back system that would allow modules/plugins/extentions/what-ever-you-want-to-call-them to hook into every pat of the system safely and without harm.

Upgrades would require a simple process without diffs and changes would require no modification at all.

There is a PEAR module/class for this already as I understand it and it is used by NucleusCMS BLOG:CMS and a few other CMSish type jobies.

The idea is that our modules subscribe to events such as PostAddToCart, PreCreateUser, PostCreateUser, PostLogin, PreRenderPage and soforth.

A central class, lets call it EventManager is called something like $Manager->NewEvent("RenderSideBar", &$data);

Where $data is all the data about to be used, o just used etc. The manager would then call each subscribed plugin class summoning it's event like say CallUserFunction("Event_" . $EventName);

This would hand control to any plugins at the appropriate point in the code.

With even a reasonable selection of events it becomes increasingly unlikely that anyone need actually edit the base distro to add new functionality.

Further more it would be easy with a Zen like easiness to add or remove extra functionility.

Even more efficiently lessor used parts could be removed from core to a plugin and the plugin distributed with the distro thus removing nothing fromt he code base while simplifying and slimlining the core.

My feeling is that this would make Zen Cart accessable to more people, upgrades simpler and add-on writting more inviting.

Surely this can only be good.

--[ Lord Matt ]-----[ Mad, Bad and Nice to know ]-----[ Lord Matt Blog ]--

23 Jun 2006, 2:00 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Jun 2006, 3:26 PM
#3
matt_t_hat avatar

matt_t_hat

New Zenner

Join Date:
Oct 2005
Location:
Kent, UK
Posts:
15
Plugin Contributions:
0

Post #3 by matt_t_hat

DrByte:

http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#Observer_Class

The very stuff!

we will see later how it can be used with general procedural code as well. it should work OK as it is effectivly an "inline" sort of thing.

Nice to know that I'm not the only one thinking what I'm thinking.

--[ Lord Matt ]-----[ Mad, Bad and Nice to know ]-----[ Lord Matt Blog ]--