Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Plugin Library
#1

[eluser]bl00dshooter[/eluser]
Quote:This library is a port and edit of FuelPHP's event.php file.

It aims to allow you to build a plugin system for your applications, by using events.

Project on github: https://github.com/bl00dshooter/Plugin-C...er-Library

I, bl00dshooter, added the unregister function and array support for trigger, register and unregister functions.
The rest was made by WanWizard, Dan Horrigan and Eric Barnes.
#2

[eluser]Vheissu[/eluser]
Could this be useful for writing an events system similar to Wordpress hooks and if so, how would you go about that?
#3

[eluser]bl00dshooter[/eluser]
Yes, that was my main objective.

Well, basically in the plugin file you would define your functions, put them into some kind of "event namespace", and call them in your script, if you want that part to be extendable. Also, keep in mind you can grab the return value of the functions, by doing something like this:

Code:
$variable = Plugin::trigger('my_event');

So, just use your imagination and common sense to go around building a plugin system.
#4

[eluser]Vheissu[/eluser]
When I get the time I will definitely look into this. I've been building a CMS and this would be a perfect addition to mimicking the much loved Wordpress hooks system to allow people to modify output without editing controllers and models.
#5

[eluser]WanWizard[/eluser]
May I add that my Fuel class was in turn based on Dan's codeigniter class? (see https://github.com/dhorrigan/codeigniter-events).
#6

[eluser]bl00dshooter[/eluser]
[quote author="WanWizard" date="1290998662"]May I add that my Fuel class was in turn based on Dan's codeigniter class? (see https://github.com/dhorrigan/codeigniter-events).[/quote]

Ahh, wish I knew it..
#7

[eluser]WanWizard[/eluser]
There are some differences though.

My version supports shutdown events properly (they need to be executed in reverse order), and support functions and both static and dynamic method calls.




Theme © iAndrew 2016 - Forum software by © MyBB