JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
file_run() expects _main suffix. added: enc_htmlbr enc_provinces
[wfpl.git] / file_run.php
index 409cb4b..bca5c18 100644 (file)
 #
 # the file db_password.php would be like so:
 #
-#     function db_password() {
+#     function db_password_main() {
 #           return array('me', 'secret');
 #     }
 
 function file_run($filename) {
-    require_once($filename);
-    ereg_replace('.*/', '', $filename);
-    $func = basename($filename, '.php');
-    return $func();
+       require_once($filename);
+       $func = basename($filename, '.php') . '_main';
+       if(!function_exists($func)) {
+               $func = basename($filename, '.php');
+       }
+
+       return $func();
 }
 
 ?>