{eac}Doojigger Reference

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
category

WordPress Plugin

author

Kevin Burkholder KBurkholder@EarthAsylum.com

copyright

Copyright (c) 2022 EarthAsylum Consulting <www.earthasylum.com>

version
2.x
link
https://eacDoojigger.earthasylum.com/
see
https://eacDoojigger.earthasylum.com/phpdoc/

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.
loadPlugin()  : void
Load/instantiate the main plugin and extensions.
loadPluginUpdater()  : void
Load object (once) for automatic updates.
plugin_updater_filter()  : void
Filter 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
example

MyPlugin::myMethod(...)

Return values
mixed

getInstance()

Convenience method to get existing instance of the plugin object.

public static getInstance() : object
Tags
example

MyPlugin()->myMethod(...)

Return values
object

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

Uses 'pre_set_site_transient_update_plugins' and 'plugins_api_args' filter so we only do this when needed.

Parameters
$pluginFile : string

plugin file pathname ($plugin_detail['PluginFile'])

$updateType : string

auto-update type ('self' | 'wp') ($plugin_detail['AutoUpdate'])

Return values
void

plugin_updater_filter()

Filter for automatic updates.

public static plugin_updater_filter(string $pluginFile, string $updateType) : void
Parameters
$pluginFile : string

plugin file pathname ($plugin_detail['PluginFile'])

$updateType : string

auto-update type ('self' | 'wp') ($plugin_detail['AutoUpdate'])

Return values
void

Search results