function _run_hook($data) { if (is_callable($data)) { call_user_func_array($data, array()); } else { return parent::_run_hook($data); } }
/** * Run Hook * * Runs a particular hook * * @param array $data Hook details * @return bool TRUE on success or FALSE on failure */ protected function _run_hook($data) { if (is_array($data)) { $a_path = APPPATH . trim($data['filepath'], '/') . '/' . $data['filename']; if (!file_exists($a_path)) { // Let's try to load a hook outside $repeater = rtrim(str_repeat('../', substr_count(APPPATH, '/')), '/'); $b_path = $repeater . '/' . trim($data['filepath'], '/'); if (realpath(APPPATH . $b_path)) { $data['filepath'] = rtrim($b_path, '/') . '/'; } } } return parent::_run_hook($data); }