Habari\Plugins::register PHP Method

register() public static method

function register Registers a plugin action for possible execution
public static register ( Callable $fn, string $type, string $hook, integer $priority = 8 )
$fn Callable A reference to the function to register by string or array(object, string)
$type string Usually either 'filter' or 'action' depending on the hook type.
$hook string The plugin hook to register
$priority integer An optional execution priority, from 1-16. The lower the priority, the earlier the function will execute in the chain. Default value = 8.
    public static function register($fn, $type, $hook, $priority = 8)
    {
        // add the plugin function to the appropriate array
        $index = array($type, $hook, $priority);
        $ref =& self::$hooks;
        foreach ($index as $bit) {
            if (!isset($ref["{$bit}"])) {
                $ref["{$bit}"] = array();
            }
            $ref =& $ref["{$bit}"];
        }
        $ref[] = $fn;
        ksort(self::$hooks[$type][$hook]);
    }