plugin_loader
Custom Plugin Loader trait - {eac}Doojigger for WordPress
Sets auto-updater, text domain, includes primary class file, instantiates class object, fires plugin methods and actions. We trigger loading/initializing/hooks on 'plugins_loaded' action. Extensions should use 'init' or 'wp_loaded' (headers are sent before wp_loaded), or {classname}_extensions_loaded or {classname}_ready
Tags
Table of Contents
- __callStatic() : mixed
- Convenience method to call a function in our instantiated plugin object
- getInstance() : object
- Convenience method to get existing instance of the plugin object.
- isPHP() : bool
- Only for PHP requests.
- loadPlugin() : void
- Load/instantiate the main plugin and extensions.
- loadPluginUpdater() : void
- Load object (once) for automatic updates.
Methods
__callStatic()
Convenience method to call a function in our instantiated plugin object
public
static __callStatic(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
- $name : string
- $arguments : array<string|int, mixed>
Tags
Return values
mixed —getInstance()
Convenience method to get existing instance of the plugin object.
public
static getInstance() : object
Tags
Return values
object —(null if not instantiated)
isPHP()
Only for PHP requests.
public
static isPHP() : bool
We only want to load the plugin for php files
Return values
bool —loadPlugin()
Load/instantiate the main plugin and extensions.
public
static loadPlugin([bool $onlyPHP = true ]) : void
Initialize the plugin & extensions Add filters/actions and shortcodes once all plugins are loaded
Parameters
- $onlyPHP : bool = true
-
- only load for PHP requests
Return values
void —loadPluginUpdater()
Load object (once) for automatic updates.
public
static loadPluginUpdater(string $pluginFile, string $updateType) : void
Now (as of v2.6) only used by extensions.
Parameters
- $pluginFile : string
-
plugin file pathname ($plugin_detail['PluginFile'])
- $updateType : string
-
auto-update type ('self' | 'wp') ($plugin_detail['AutoUpdate'])