Skip to content

Commit

Permalink
Made autoload a little more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenrnl committed Jun 5, 2013
1 parent 39aacb9 commit eb8e5f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions php/include.inc.php
Expand Up @@ -20,12 +20,20 @@
* @todo return false should change into an exception * @todo return false should change into an exception
*/ */


function zophAutoload($file) {
if(is_readable($file)) {
require_once $file;
}
}

function zophAutoloadClass($class) { function zophAutoloadClass($class) {
@include_once "classes/" . $class . ".inc.php"; $file="classes/" . $class . ".inc.php";
zophAutoload($file);
} }


function zophAutoloadInterface($interface) { function zophAutoloadInterface($interface) {
@include_once "interfaces/" . $interface . ".inc.php"; $file="interfaces/" . $interface . ".inc.php";
zophAutoload($file);
} }
spl_autoload_register("zophAutoloadClass"); spl_autoload_register("zophAutoloadClass");
spl_autoload_register("zophAutoloadInterface"); spl_autoload_register("zophAutoloadInterface");
Expand Down

0 comments on commit eb8e5f9

Please sign in to comment.