@live627, nice, I didn't think of that.
Here's what I wrote a week or two ago.
$smcFunc += array(
'ufunc' => function ($func, $vars = null, $array = false)
{
// Allow hooking into functions to rewrite vars or send the data to another function instead.
call_integration_hook('integrate_before_func_'.$func, array(&$func,&$vars));
if (!empty($func))
$return = call_user_func_array($func, is_array($vars) && $array == true ? $vars : array(&$vars));
if (!empty($return)) {
// allow modifications of return data.
call_integration_hook('integrate_after_func_'.$func, array(&$return));
return $return;
} else
return false;
},
'load' => function ($path, $file, $type = 'generic')
{
// File hijacking, good for when you want to replace source files with others.
// Types source, theme, lang, generic
call_integration_hook('integrate_require_'.$type.'_'.$file, array(&$file));
require_once ($path.$file);
}
);