ircbot/AutoLoader.php

17 lines
497 B
PHP
Raw Normal View History

2010-11-21 23:48:11 +01:00
<?php
/**
* Autoloader function.
* All classes will be in Classes/$Package$/$ClassName$.php
* @throws Exception_GeneralException
* @param string $className
* @return void
*/
function __autoload($className) {
$file = "Classes/" . str_replace("_", "/", $className) . ".php";
if(file_exists($file) === TRUE) {
require_once($file);
} else {
throw new Exception_GeneralException("Could not autoload class: '" . $className . "' - File does not exist: '" . $file . "'!", 1289659295);
}
}
?>