-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbootstrap.php
More file actions
74 lines (52 loc) · 1.91 KB
/
bootstrap.php
File metadata and controls
74 lines (52 loc) · 1.91 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
// Start output-buffering for any header for cookie functions ('headers already sent' error)
ob_start();
$modulesDirectory = "engine/engineAPI/latest/modules";
$helperFunctions = "engine/engineAPI/latest/helperFunctions";
$availableModules = array();
//Load helper function Modules
$hfDirHandle = @opendir($helperFunctions) or die("Unable to open: ".$helperFunctions);
while (false !== ($file = readdir($hfDirHandle))) {
// Check to make sure that it isn't a hidden file and that it is a PHP file
if ($file != "." && $file != ".." && $file) {
$fileChunks = array_reverse(explode(".", $file));
$ext= $fileChunks[0];
if ($ext == "php") {
require_once $helperFunctions."/".$file;
}
}
}
$modules_dirHandle = @opendir($modulesDirectory) or die("Unable to open (Modules): ".$modulesDirectory);
while (false !== ($dir = readdir($modules_dirHandle))) {
$moduleDirectory = $modulesDirectory."/".$dir;
// Check to make sure that it isn't a hidden file and that the file is a directory
if ($dir != "." && $dir != ".." && is_dir($moduleDirectory) === TRUE) {
$singleMod_dirHandle = @opendir($moduleDirectory) or die("Unable to open (Single Module): ".$moduleDirectory);
while (false !== ($file = readdir($singleMod_dirHandle))) {
if ($file != "." && $file != ".." && $file) {
// if ($file == "onLoad.php") {
// include_once($moduleDirectory."/".$file);
// }
// else {
$fileChunks = array_reverse(explode(".", $file));
$ext= $fileChunks[0];
if ($ext == "php") {
$availableModules[$fileChunks[1]] = $moduleDirectory."/".$file;
}
// }
}
}
}
}
function autoloader($className) {
if (!class_exists($className, FALSE)) {
global $availableModules;
if (isset($availableModules[$className]) && file_exists($availableModules[$className])) {
require_once $availableModules[$className];
return TRUE;
}
}
return;
}
spl_autoload_register("autoloader",TRUE);
?>