Welcome Guest, Not a member yet? Register   Sign In
Plugin Architecture: Hooks and Callbacks
#3

[eluser]Grahack[/eluser]
When I saw your extensivity thing, I first thought about a simple Vanilla-like delegation.
My idea is quite simple, but maybe too simple for you.

Using a very early hook, we discover plugins in a special (and of course configurable) directory. Those plugins are simple callbacks declarations and registrations, that we 'include'.
Code:
// in the plugins files: the injected code
function my_function()
{
$var &= $ci->plugin_lib->param('param_id');
// some processing
}
$ci->plugin_lib->register('my_function', 'moment_id');

Code:
// anywhere else: where we want to inject some code
$ci->plugin_lib->add_param('param_id', $the_param);
$ci->plugin_lib->moment('moment_id');

The 'moment' function then calls every function that has registered to act at the 'moment_id' moment.

About the name, CI has (had) already a 'plugin' thing. Vanilla calls this 'delegation', if I were the boss, I'd call this 'injections'.


Messages In This Thread
Plugin Architecture: Hooks and Callbacks - by El Forum - 12-26-2007, 10:22 AM
Plugin Architecture: Hooks and Callbacks - by El Forum - 12-26-2007, 11:51 AM
Plugin Architecture: Hooks and Callbacks - by El Forum - 12-26-2007, 12:07 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 03:09 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 04:40 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 06:17 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 06:39 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 07:10 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 07:20 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 07:37 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 08-05-2008, 07:43 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 10-27-2008, 12:52 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 10-27-2008, 01:33 PM
Plugin Architecture: Hooks and Callbacks - by El Forum - 09-11-2012, 02:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB