Module
abstract class Module extends Singleton
A class to represent crucial project file system structures and bind their PHP functionalities to WordPress.
Properties
| static protected Singleton[] | $_instances | from Singleton | |
| protected bool | $is_submodule | ||
| protected bool | $enabled | ||
| static string | $includes_dir | ||
| static string | $modules_dir | ||
| static array | $includes | ||
| protected array | $loaded_modules |
Methods
A protected constructor to ensure only singleton instances of plugins exist.
Maybe initialize singleton instance and return the instance.
A short one-liner tool to get a ReflectionClass so we can get runtime info for the static class instance and not this abstract.
An empty, placeholder function for overriding, this is where the module "starts" it's WordPress code.
The function which gets called when a module is being constructed. This ensures the submodule construct sequences don't get fired when a submodule is first initialized.
The function which gets called if this module is being imported as a submodule.
Our special function for searching for submodule folders, loading them into the current module and PHP environment.
Loop through all loaded modules and run their initialization functions.
Given a Module class name and a file path, loads the file into the PHP environment, then checks to make sure the given class extends Module and adds it to { $this->loaded_modules }
Load a class from a file and return the full class name.
Get the currently loaded modules.
Details
at line 61
protected
__construct(bool $is_submodule = false)
A protected constructor to ensure only singleton instances of plugins exist.
in
Singleton at line 42
final static Singleton
instance(mixed $args = null)
Maybe initialize singleton instance and return the instance.
in
Singleton at line 63
final static array
get_instances()
Return a copy of the instances array.
in
Singleton at line 72
final protected ReflectionClass
get_class_reflection()
A short one-liner tool to get a ReflectionClass so we can get runtime info for the static class instance and not this abstract.
at line 82
static
construct()
An empty, placeholder function for overriding, this is where the module "starts" it's WordPress code.
at line 87
static
submodule_construct()
The function which gets called when a module is being constructed. This ensures the submodule construct sequences don't get fired when a submodule is first initialized.
at line 98
final static
submodule_instance()
The function which gets called if this module is being imported as a submodule.
at line 105
final protected
register_submodules()
Our special function for searching for submodule folders, loading them into the current module and PHP environment.
at line 136
final protected
construct_submodules()
Loop through all loaded modules and run their initialization functions.
at line 149
final protected
import_module(string $module_path)
Given a Module class name and a file path, loads the file into the PHP environment, then checks to make sure the given class extends Module and adds it to { $this->loaded_modules }
at line 173
final protected string|false
load_class_file(string $file_path)
Load a class from a file and return the full class name.
at line 225
final array
get_loaded_modules()
Get the currently loaded modules.