-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
46 lines (36 loc) · 1.02 KB
/
bootstrap.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
37
38
39
40
41
42
43
44
45
<?php
spl_autoload_register('frameworkAutoload');
function frameworkAutoload($class)
{
$includeArray = explode(':',get_include_path());
//echo strpos(strtolower(PHP_OS), 'win');
//explode include Path differently in case of Windows
if (strpos(strtolower(PHP_OS), 'win') !== false)
{
//$includeArray = explode(';',get_include_path());
}
foreach($includeArray as $path)
{
//@psa added check for file_exists
if (file_exists($path .'/'. $class . '.php') && !class_exists($path .'/'. $class . '.php'))
{
include_once $path .'/'. $class . '.php';
}
checkFileExists('./lib/' . $class . '.php');
checkFileExists('./model/' . $class . '.php');
checkFileExists('./view/' . $class . '.php');
checkFileExists('./controller/' . $class . '.php');
}
}
function checkFileExists($path)
{
if (file_exists($path) && !class_exists($path))
{
include_once $path;
}
else
{
return false;
}
}
?>