X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=blobdiff_plain;f=file_run.php;h=e5016688c514b09b61a1b944fc70cc09ea36ebf0;hp=fd1d20fe58ffe4470e902e548dcc6e91a1d420fc;hb=062d46e16429f2e55573567518cb01c83b319ac4;hpb=6c27f346217f7b4b8b24064371f2461cf57c6167 diff --git a/file_run.php b/file_run.php index fd1d20f..e501668 100644 --- a/file_run.php +++ b/file_run.php @@ -1,22 +1,19 @@ -. # This function makes it easier to put everything in functions like you should. @@ -36,11 +33,14 @@ # return array('me', 'secret'); # } -function file_run($filename) { - require_once($filename); - ereg_replace('.*/', '', $filename); - $func = basename($filename, '.php') . '_main'; - return $func(); +function file_run($filename /* args... */) { + $args = array_slice(func_get_args(), 1); + require_once($filename); + $func = basename($filename, '.php') . '_main'; + + if(function_exists($func)) { + return call_user_func_array($func, $args); + } } ?>