Codeigniter Hook Based Plugin System |
[eluser]Vheissu[/eluser]
We all love the Wordpress plugins system. The ability to define hooks that get called when particular actions happen and ability to pass through arguments as well? Recently while helping out Chris Baines with Dove Forums talk of a plugins system like Wordpress arose and so in a couple of hours work I've developed one. It's sort of alpha and sort of beta. You can define actions and then trigger them in your application, your plugin functions are called. Creating plugins is in-fact so close to Wordpress that if you can create Wordpress plugins, you can use this library. Feel free to fork and make it better. It's still early days, but it works. Check it out on the Github repository I created here. The repository has information on using it, but there is no documentation for this library yet as things keep changing. The basics of this are: * Autoload the library. * Register action hooks by using the add_action() function. * Trigger actions by run_action() That's basically it, see the repo for more info.
[eluser]Vheissu[/eluser]
A slew of updates have been made to make this library better since posting this thread. Has anyone got any feedback? 40 views thus far and not a single comment, very strange. I would have thought plugin functionality was something lots of people wanted.
[eluser]Bainzy[/eluser]
I have a comment ![]() But no mate like I keep saying, fantastic work. Had a play earlier but going to sit down and take a good look tonight and have a play with what can be done. Can't wait till we intergrate with Dove Forums and see what we can do with the system ![]() Keep up the great work dude. peace !
[eluser]quasiperfect[/eluser]
hi i use latest reactor + Modular Extensions - HMVC version 5.4 i downloaded the latest Codeigniter Hook Based Plugin System , run the sql file and autoloaded the plugin library i left only the helloworld plugin in the plugins dir i see lots of duplicate selects from the database Code: 0.0007 SELECT *
[eluser]Vheissu[/eluser]
Haha, yeah. It kind of has a few flaws at the moment. Planning on getting those sorted this weekend (within the next two days). The priority of things is a bit messed up, I call the same function for getting plugins quite a lot of times which is why that happens for the activation stuff, etc. I'm also going to add in some caching as well to alleviate the load on the database because if someone has 30 or even 15 plugins, their app will slow significantly. It's a work in progress, an early beta version I guess you could say so things like this will pop up for the next couple of weeks until it's stable. Thank you for letting me know though, very helpful feedback. Also feel free to fork and make changes yourselves as well, I'm open to all changes.
[eluser]Vheissu[/eluser]
Can anyone help me out who's good at profiling PHP code and pinpointing the location of duplicate queries? I've got the list of duplicate queries down to 2 now. The issue appears to be that the same plugin is searched for in the database twice, it must be within one of the foreach loops and is currently doing my head in. Anyone have any ideas and want to quickly help me out? Here's what my profiler is now showing: Code: 0.0004 SELECT *
[eluser]phpwebdev[/eluser]
Can u show to us little more complex example on the plugin work
[eluser]Timothy_[/eluser]
Hello, I am really excited by this library however no matter what I try i have been unable to get it working. I have added Plugins.php to my /application/libraries/ folder I then autoload the library in my /application/config/autoload.php file Code: $autoload['libraries'] = array('plugins'); I then get a global 500 server error. Removing the auto-load call removes the server error. I have successfully loaded other libraries but have removed them to make sure there is no clashes. Any advice would be greatly appreciated. Thanks, Tim
[eluser]Vheissu[/eluser]
[quote author="Timothy_" date="1312952887"]Hello, I am really excited by this library however no matter what I try i have been unable to get it working. I have added Plugins.php to my /application/libraries/ folder I then autoload the library in my /application/config/autoload.php file Code: $autoload['libraries'] = array('plugins'); I then get a global 500 server error. Removing the auto-load call removes the server error. I have successfully loaded other libraries but have removed them to make sure there is no clashes. Any advice would be greatly appreciated. Thanks, Tim[/quote] What kind of server setup are you running Timothy? More specifically PHP version and Codeigniter version and we'll go from there.
[eluser]Timothy_[/eluser]
Hello, Thanks for responding. PHP Version: <b>5.3.3-1ubuntu9.3</b> Codeigniter Version: <b>2.0.2</b> Is that enough info? Thanks Tim |
Welcome Guest, Not a member yet? Register Sign In |