Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Changes to autoload so it works in unittests too.
  • Loading branch information
jeroenrnl committed Jun 5, 2013
1 parent eb8e5f9 commit d74bc6d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions php/include.inc.php
Expand Up @@ -17,24 +17,27 @@
*/
/**
* Autoload classes
* @todo return false should change into an exception
*/

function zophAutoload($file) {
if(is_readable($file)) {
function zophAutoload($file) {
if(is_readable(settings::$php_loc . "/" . $file)) {
require_once $file;
} else {
return false;
}

}

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

function zophAutoloadInterface($interface) {
$file="interfaces/" . $interface . ".inc.php";
zophAutoload($file);
return zophAutoload($file);
}

spl_autoload_register("zophAutoloadClass");
spl_autoload_register("zophAutoloadInterface");

Expand Down

0 comments on commit d74bc6d

Please sign in to comment.