Permalink
Browse files

Made autoload a little more robust

  • Loading branch information...
1 parent 39aacb9 commit eb8e5f95b9bb186575f7a583a7c194aef088acf9 @jeroenrnl committed Jun 5, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 php/include.inc.php
View
@@ -20,12 +20,20 @@
* @todo return false should change into an exception
*/
+ function zophAutoload($file) {
+ if(is_readable($file)) {
+ require_once $file;
+ }
+ }
+
function zophAutoloadClass($class) {
- @include_once "classes/" . $class . ".inc.php";
+ $file="classes/" . $class . ".inc.php";
+ zophAutoload($file);
}
function zophAutoloadInterface($interface) {
- @include_once "interfaces/" . $interface . ".inc.php";
+ $file="interfaces/" . $interface . ".inc.php";
+ zophAutoload($file);
}
spl_autoload_register("zophAutoloadClass");
spl_autoload_register("zophAutoloadInterface");

0 comments on commit eb8e5f9

Please sign in to comment.