Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changes to autoload so it works in unittests too.

  • Loading branch information...
commit d74bc6dc9233f95052e9a78b1b02032e9e434884 1 parent eb8e5f9
@jeroenrnl authored
Showing with 8 additions and 5 deletions.
  1. +8 −5 php/include.inc.php
View
13 php/include.inc.php
@@ -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");
Please sign in to comment.
Something went wrong with that request. Please try again.