Welcome Guest, Not a member yet? Register   Sign In
Plugin Handling Class - Extends the CI_Hooks Class
#1

[eluser]Xeoncross[/eluser]
Based on disccustions Here and here I built a way to handle plugins without breaking/changing the CI core - or even your system design pattern.

Just drop this class into your application/lib/{prefix}_hooks.php folder and you are set to use the power of hooks throughout the whole of your site.

Background: all systems built by more than 3 people need to think about building flexible systems that 3rd parties and end users can change/update/add-to without messing with your classes/models/etc. Plugins are the answer to this - if you need more info please read the two topics above.


Download: ExtraHooks on Google Code

I would love to have feed back on why I am so stupid for making this, what I could have done, etc... :cheese:

Here is an example controller using Hooks:
Code:
class Hooks extends Controller {

    function Hooks()
    {
        parent::Controller();    
        $this->output->enable_profiler(TRUE);
        
                //Instantiate the hooks class
        $this->hooks =& load_class('Hooks');
    }
    
    function index()
    {
        print $this->hooks->call('custom_hook', 'call');

        var_dump($this->hooks->remove('custom_hook', 'custom_hook2'));

        print $this->hooks->filter('custom_hook', 'filter');

        $this->hooks->_call_hook('custom_hook_class');
    }
}


Messages In This Thread
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 08-05-2008, 06:23 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 08-05-2008, 07:00 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 08-05-2008, 07:15 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 08-05-2008, 07:24 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 08-05-2008, 07:34 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 08-05-2008, 07:42 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 04:02 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 05:32 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 05:46 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 05:50 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 06:20 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 06:29 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 06:34 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 06:41 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 06:47 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-30-2008, 06:51 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 04:22 AM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 11:42 AM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 11:43 AM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 11:49 AM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 11:51 AM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 11:55 AM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 12:00 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 12-31-2008, 12:08 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 07-15-2009, 12:55 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 07-15-2009, 01:04 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 07-15-2009, 01:55 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 07-15-2009, 02:00 PM
Plugin Handling Class - Extends the CI_Hooks Class - by El Forum - 07-16-2009, 08:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB