Filter Hook And Action Hook Like Wordpress In Yii

I am currently working on new project that would like users could write their own plugin and hook my core function like wordpress

For example i have a gateways list that return an array in my showGatewayList method, i want to allow users could write plugin that extend the array.

In wordpress i know that we could use


apply_filter('show_gateway',array('paybal'=>'Paybal')) 

and can hook to it with


add_filter('show_gateway','add_new_gateway')

in any plugin, but how it can implemented with yii events, in a oop and mvc way?

During my research i find out that wordpress load all plugins at every request then add all callback func name to every hooks that has filter and save it into one global array $wp_filter then when php read apply_filter(‘examplehook’) it will look in $wp_filters[‘examplehook’] and run callbacks for $value then return it

But i cant figure it out how to implement this for yii with attach handler becuase for attach hanlder the object must already exict!

according to my idea centralize your hook registering page so that all plugins are registered in one place for your available hooks like this. try this url. http://codepad.org/JzxmZvSz

according to my idea centralize your hook registering page so that all plugins are registered in one place for your available hooks like this. try this url. http://codepad.org/JzxmZvSz

well i think its not a good idea but because some plugin maybe has a lot of code its the idea for boil every thing toghather will be messed up!