3 # Copyright (C) 2005 Jason Woofenden
5 # This file is part of wfpl.
7 # wfpl is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU Lesser General Public License as published by the Free
9 # Software Foundation; either version 2.1 of the License, or (at your option)
12 # wfpl is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with wfpl; if not, write to the Free Software Foundation, Inc., 51
19 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 # This function makes it easier to put everything in functions like you should.
24 # Instead of putting everything in the global namespace and having it run when
25 # you include the file, put everything in functions. This function makes it so
26 # you can both include (require_once) the file, and call its main function in
31 # list($user, $pass) = file_run('db_password.php');
33 # the file db_password.php would be like so:
35 # function db_password() {
36 # return array('me', 'secret');
39 function file_run($filename) {
40 require_once($filename);
41 ereg_replace('.*/', '', $filename);
42 $func = basename($filename, '.php');