/** * Registers the main event add method */ public function __construct() { // Dirty hack to load this plugin before the current theme, but after default $modules = Kohana::config('core.modules'); $sharing_path = PLUGINPATH . 'sharing_two'; unset($modules[array_search($sharing_path, $modules)]); $d_index = array_search(THEMEPATH . "default", $modules); $modules = array_merge(array_slice($modules, 0, $d_index), array($sharing_path), array_slice($modules, $d_index)); Kohana::config_set('core.modules', $modules); // Try to alter routing now Sharing::routing(); // hook into routing - in case we're running too early Event::add_after('system.routing', array('Router', 'find_uri'), array('Sharing', 'routing')); // Add other events just before controller runs Event::add('system.pre_controller', array($this, 'add')); }