/
functions.php
executable file
·50 lines (46 loc) · 1.01 KB
/
functions.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
46
47
48
49
<?php
function radcanon_autoloader ($classname) {
$cLoc = $classname = preg_replace('/[^A-Z\d_-]+/i', '', $classname);
$prefixes = array(
'App',
'AuthNet',
'File',
'Html',
'Exception',
'Filter',
'Model',
'Controller',
'Email',
'Utils',
);
foreach ($prefixes as $prefix) {
if (preg_match('#^' . $prefix . '#', $classname)) {
$cLoc = preg_replace('#^' . $prefix . '#', $prefix . DS, $classname);
if ($cLoc === $prefix . DS) $cLoc .= $classname;
break;//May only be performed once!
}
}
if (!file_exists(RADCANON_CLASS_DIR . $cLoc . '.php')) {
return false;
}
require_once(RADCANON_CLASS_DIR . $cLoc . '.php');
return true;
}
function vdump () {
if (defined('DEBUG') && DEBUG) {
$args = func_get_args();
call_user_func_array('vdumpF', $args);
}
}
function vdumpF () {
$i = 1;
while (ob_get_level() && $i < 5) {
ob_end_flush();
$i++;
}
$args = func_get_args();
echo '<html><head></head><body><pre>';
call_user_func_array('var_dump', $args);
echo '</pre></body></html>';
exit;
}