Plugins are loaded through the plugin_handler. It looks for directories in the Plugins folder and loads the loader.php file for each of those plugins.
Loader.php
The loader file below is a basic example of a plugin. It registers itself to the reactor global.
namespace Triekster\Reactor;
/** Plugin File
* Name: Example Plugin
* Copyright (c) 2020 Patriek Jeuriens
*/
global $reactor, $factory, $routing;
$plugin = array(
"name" => "Example Plugin",
"description" => __("Adds an empty plugin."),
"plugin" => basename(dirname(__FILE__)),
"author" => "Patriek Jeuriens",
"license" => __("Commercial License"),
"version" => 10222020, "enabled" => true
);
$reactor->plugins[$plugin["plugin"]] = $plugin;
if ($plugin['enabled'] == true) {
}
Now your plugin is loaded and any code between the plugin['enabled'] statement will be executed.