|
1
|
|
|
<?php |
|
2
|
|
|
/****************************************************************************** |
|
3
|
|
|
* Wikipedia Account Creation Assistance tool * |
|
4
|
|
|
* * |
|
5
|
|
|
* All code in this file is released into the public domain by the ACC * |
|
6
|
|
|
* Development Team. Please see team.json for a list of contributors. * |
|
7
|
|
|
******************************************************************************/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Waca; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* AutoLoader for the new classes |
|
13
|
|
|
*/ |
|
14
|
|
|
class AutoLoader |
|
15
|
|
|
{ |
|
16
|
17 |
|
public static function load($class) |
|
17
|
|
|
{ |
|
18
|
|
|
// handle namespaces sensibly |
|
19
|
17 |
|
if (strpos($class, "Waca") !== false) { |
|
20
|
|
|
// strip off the initial namespace |
|
21
|
17 |
|
$class = str_replace("Waca\\", "", $class); |
|
22
|
|
|
|
|
23
|
|
|
// swap backslashes for forward slashes to map to directory names |
|
24
|
17 |
|
$class = str_replace("\\", "/", $class); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
$paths = array( |
|
28
|
17 |
|
__DIR__ . '/' . $class . ".php", |
|
29
|
17 |
|
__DIR__ . '/DataObjects/' . $class . ".php", |
|
30
|
17 |
|
__DIR__ . '/Providers/' . $class . ".php", |
|
31
|
17 |
|
__DIR__ . '/Providers/Interfaces/' . $class . ".php", |
|
32
|
17 |
|
__DIR__ . '/Validation/' . $class . ".php", |
|
33
|
17 |
|
__DIR__ . '/Helpers/' . $class . ".php", |
|
34
|
17 |
|
__DIR__ . '/Helpers/Interfaces/' . $class . ".php", |
|
35
|
17 |
|
__DIR__ . '/' . $class . ".php", |
|
36
|
|
|
); |
|
37
|
|
|
|
|
38
|
17 |
|
foreach ($paths as $file) { |
|
39
|
17 |
|
if (file_exists($file)) { |
|
40
|
17 |
|
require_once($file); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
17 |
|
if (class_exists($class)) { |
|
44
|
17 |
|
return; |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
17 |
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|