-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloader.php
36 lines (29 loc) · 1.24 KB
/
loader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// This sets initial path for the include. Further includes will be initialized through PathFinder
set_include_path('.'.PATH_SEPARATOR.'.'.DIRECTORY_SEPARATOR.'lib'.PATH_SEPARATOR.dirname(__FILE__).'/lib');
if (version_compare(PHP_VERSION, '5.3.0') < 0) {
echo 'PHP 5.3.0 is required';
exit;
}
/**
* In the event of missing Composer, we shall load this method for the initial
* bootstraping of our base classes. Once pathFinder is initialized, it will
* unregister this loader and will place it's own, more advanced loader
*/
function agile_toolkit_temporary_load_class($class) {
$file = str_replace('_',DIRECTORY_SEPARATOR,$class).'.php';
$file = str_replace('\\','/',$file);
foreach (explode(PATH_SEPARATOR, get_include_path()) as $path){
$fullpath = $path . DIRECTORY_SEPARATOR . $file;
if (file_exists($fullpath)) {
include_once($fullpath);
// add to loading log
$GLOBALS['agile_toolkit_temporary_load_class_log'][$class]=$fullpath;
return;
}
}
trigger_error('Class "'.$class.'" could not be loaded. Unable to start Agile Toolkit');
}
// register temporary loader
spl_autoload_register('agile_toolkit_temporary_load_class');
require'static.php';