29 if (substr($class, 0, 4) !==
'CAS_' && substr($class, 0, 7) !==
'PhpCas\\') {
34 if (empty($include_path)) {
35 $include_path = array(dirname(__DIR__));
39 foreach ($include_path as $path) {
40 $class_path = str_replace(
'_', DIRECTORY_SEPARATOR, $class);
42 if (substr($class_path, 0, 7) ===
'PhpCas\\') {
43 $class_path =
'CAS' . DIRECTORY_SEPARATOR . substr($class_path, 7);
46 $file_path = $path . DIRECTORY_SEPARATOR . $class_path .
'.php';
47 $fp = @fopen($file_path,
'r',
true);
51 if (!class_exists($class,
false) && !interface_exists($class,
false)) {
54 'Class ' . $class .
' was not present in ' .
65 'Class ' . $class .
' could not be loaded from ' .
66 $file_path .
', file does not exist (Path="' 67 . implode(
':', $include_path) .
'") [CAS_autoload]' 69 $trace = $e->getTrace();
70 if (isset($trace[2]) && isset($trace[2][
'function'])
71 && in_array($trace[2][
'function'], array(
'class_exists',
'interface_exists'))
75 if (isset($trace[1]) && isset($trace[1][
'function'])
76 && in_array($trace[1][
'function'], array(
'class_exists',
'interface_exists'))
84 if (!class_exists(
'CAS_Client'))
86 trigger_error(
'phpCAS autoloader is deprecated. Install phpCAS using composer instead.', E_USER_DEPRECATED);
87 spl_autoload_register(
'CAS_autoload');
88 if (function_exists(
'__autoload')
89 && !in_array(
'__autoload', spl_autoload_functions())
93 spl_autoload_register(
'__autoload');