Hello. Today I was wondering how a hook system should work. If you dont know what a hook system its where you can 'hook' a function to the execution of another function. This would make it easier for developers to create plugin's and modifications.
Well I was creating some ideas on how you could possibly do it and I wanted to know if anyone else any ideas.
Idea 1 - Create a class named HookManager. This would class would have add_hook, run_hook, hook_exists, remove_hook.
Now when you create a function you would use global to get the hookmanager. Then at the topc of the function before anything starts add $hookmanager->run_hook("currFuncName", "before");
which will run all the functions for currFuncName before the function start.
Then at the end add $hookmanager->run_hook("currFuncName", "after");
Any other ideas?