/** * function register * Registers a plugin action for possible execution * @param mixed A reference to the function to register by string or array(object, string) * @param string Usually either 'filter' or 'action' depending on the hook type. * @param string The plugin hook to register * @param hex An optional execution priority, in hex. 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]); }