29 if (substr($class, 0, 4) !==
'CAS_') {
33 if (empty($include_path)) {
34 $include_path = array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) .
'/../test/' );
39 foreach ($include_path as $path) {
40 $file_path = $path .
'/' . str_replace(
'_',
'/', $class) .
'.php';
41 $fp = @fopen($file_path,
'r',
true);
45 if (!class_exists($class,
false) && !interface_exists($class,
false)) {
48 'Class ' . $class .
' was not present in ' .
58 'Class ' . $class .
' could not be loaded from ' .
59 $file_path .
', file does not exist (Path="' 60 . implode(
':', $include_path) .
'") [CAS_autoload]' 62 $trace = $e->getTrace();
63 if (isset($trace[2]) && isset($trace[2][
'function'])
64 && in_array($trace[2][
'function'], array(
'class_exists',
'interface_exists'))
68 if (isset($trace[1]) && isset($trace[1][
'function'])
69 && in_array($trace[1][
'function'], array(
'class_exists',
'interface_exists'))
77 if (!(spl_autoload_functions())
78 || !in_array(
'CAS_autoload', spl_autoload_functions())
80 spl_autoload_register(
'CAS_autoload');
81 if (function_exists(
'__autoload')
82 && !in_array(
'__autoload', spl_autoload_functions())
86 spl_autoload_register(
'__autoload');