PHP Classes


Recommend this page to a friend!

      PHP Plugin System  >  All threads  >  Subdirectories?  >  (Un) Subscribe thread alerts  
Summary:Plugins in subdirectories
Author:Christian Ammers
Date:2015-05-04 22:06:38


  1. Subdirectories?   Reply   Report abuse  
Picture of Christian Ammers Christian Ammers - 2015-05-04 22:06:38
WHat about plugins in subdirectories? For example when i want to use a large plugin with its own classes.

  2. Re: Subdirectories?   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2015-05-04 22:30:02 - In reply to message 1 from Christian Ammers
That is the role of an observer class, to manage the operations between the main script and the plugin application.

Let's say a plugin to an enterprise program for a forum is available. The forum resides in its own folder, managed by its own class. It will also have the observer class which is dropped into the plugin folder. This observer class manages events for the forum while other observers are managing the same events for their respective applications.

The reason this class was created was to manage a unified login system between unrelated scripts. So one script manages the user system from registration, login, validation, and so on. These events trigger the observers to take the appropriate action for their scripts. Johhny User registers and the observers register him across all the unrelated scripts. He logs in, and he is logged in across all the unrelated scripts.

This is just one possible use, it really is up to your imagination how an observe should interact with the system and the script it is observing for.