Is your feature request related to a problem? Please describe.
When LifterLMS is loaded by WordPress, it is important for some LifterLMS classes to be loaded, instantiated, and hooked into the system in a certain order. See #2070.
Describe the solution you'd like.
Create a class, named LLMS_Classes, extended from the WP_Dependencies class and using LLMS_Trait_Singleton, that helps to initialize LifterLMS objects in the correct order.
Add a LifterLMS::classes() method that returns a singleton instance of LLMS_Classes.
Add a static method to every class loaded by LifterLMS::bootstrap_X() methods, that returns an array of classes it is dependent on.
Add a LifterLMS::bootstrap_always() method that registers classes with LLMS_Classes::add() that are currently listed in LLMS_Loader::includes() .
Add a LifterLMS::bootstrap_admin() method that registers classes with LLMS_Classes::add() that are currently listed in LLMS_Loader::includes_admin().
Add a LifterLMS::bootstrap_frontend() method that registers classes with LLMS_Classes::add() that are currently listed in LLMS_Loader::includes_frontend().
Add a LifterLMS::bootstrap() method that calls LifterLMS::bootstrap_always() and either LifterLMS::bootstrap_admin() or LifterLMS::bootstrap_frontend().
Add a call to LifterLMS::bootstrap() in LifterLMS::__construct().
The LLMS_Classes::__constructor() method should register LLMS_Classes::do_items() as a callback on the before_lifterlms_init or maybe lifterlms_init action hook.
Add a LLMS_Classes::do_item() method (not to be confused with do_items()) that either includes the class file which also instantiates the class (LifterLMS pattern) or instantiates the class using the autoloader (PSR-1 standard).
Describe alternatives you've considered.
Quitting programming and opening up a bait shop in Minnesota, but that would just exchange software bugs for actual bugs.
Oh, you meant loading classes in an order based on dependencies?
Changing the hook used by classes when they hook into the system. Hook options, init, admin_init, before_lifterlms_init, lifterlms_init, lifterlms_loaded.
Is your feature request related to a problem? Please describe.
When LifterLMS is loaded by WordPress, it is important for some LifterLMS classes to be loaded, instantiated, and hooked into the system in a certain order. See #2070.
Describe the solution you'd like.
Create a class, named
LLMS_Classes
, extended from theWP_Dependencies
class and usingLLMS_Trait_Singleton
, that helps to initialize LifterLMS objects in the correct order.Add a
LifterLMS::classes()
method that returns a singleton instance ofLLMS_Classes
.Add a static method to every class loaded by
LifterLMS::bootstrap_X()
methods, that returns an array of classes it is dependent on.Add a
LifterLMS::bootstrap_always()
method that registers classes withLLMS_Classes::add()
that are currently listed inLLMS_Loader::includes()
.Add a
LifterLMS::bootstrap_admin()
method that registers classes withLLMS_Classes::add()
that are currently listed inLLMS_Loader::includes_admin()
.Add a
LifterLMS::bootstrap_frontend()
method that registers classes withLLMS_Classes::add()
that are currently listed inLLMS_Loader::includes_frontend()
.Add a
LifterLMS::bootstrap()
method that callsLifterLMS::bootstrap_always()
and eitherLifterLMS::bootstrap_admin()
orLifterLMS::bootstrap_frontend()
.Add a call to
LifterLMS::bootstrap()
inLifterLMS::__construct()
.The
LLMS_Classes::__constructor()
method should registerLLMS_Classes::do_items()
as a callback on thebefore_lifterlms_init
or maybelifterlms_init
action hook.Add a
LLMS_Classes::do_item()
method (not to be confused withdo_items()
) that either includes the class file which also instantiates the class (LifterLMS pattern) or instantiates the class using the autoloader (PSR-1 standard).Describe alternatives you've considered.
Quitting programming and opening up a bait shop in Minnesota, but that would just exchange software bugs for actual bugs.
Oh, you meant loading classes in an order based on dependencies?
Changing the hook used by classes when they hook into the system. Hook options,
init
,admin_init
,before_lifterlms_init
,lifterlms_init
,lifterlms_loaded
.