-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathez_sql_loader.php
More file actions
34 lines (29 loc) · 1.01 KB
/
ez_sql_loader.php
File metadata and controls
34 lines (29 loc) · 1.01 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
<?php
function ez_autoloader($class) {
$base_dir = __DIR__ .DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR;
$prefix = 'ezsql\\';
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
return;
}
$relative_class = substr($class, $len);
$file = $base_dir.strtolower( str_replace('\\', DIRECTORY_SEPARATOR , $relative_class) ).'.php';
if (file_exists($file)) {
require_once($file);
}
}
spl_autoload_register('ez_autoloader');
function sql_autoloader($class) {
$base_dir = __DIR__ .DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'Database'.DIRECTORY_SEPARATOR;
$prefix = 'ezsql\\Database\\';
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
return;
}
$relative_class = substr($class, $len);
$file = $base_dir.strtolower( str_replace('\\', DIRECTORY_SEPARATOR , $relative_class) ).'.php';
if (file_exists($file)) {
require_once($file);
}
}
spl_autoload_register('sql_autoloader');