-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathinit.php
More file actions
73 lines (63 loc) · 1.78 KB
/
init.php
File metadata and controls
73 lines (63 loc) · 1.78 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
<?php
/**
* Copyright © Lyra Network.
* This file is part of Lyra PHP payment form example. See COPYING.md for license details.
*
* @author Lyra Network <https://www.lyra.com>
* @copyright Lyra Network
* @license http://www.apache.org/licenses/
*/
class Autoloader
{
/**
* @param $className
* @return bool
*/
static public function toolLoader($className)
{
$filename = implode(DIRECTORY_SEPARATOR,
[realpath(__DIR__), 'lib', 'tools', str_replace("\\", '/', $className ) . '.php']);
if (file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return true;
}
}
return false;
}
/**
* @param $className
* @return bool
*/
static public function sdkLoader($className)
{
$filename = implode(DIRECTORY_SEPARATOR,
[realpath(__DIR__), 'lib', 'lyra-payment-form-sdk', str_replace("\\", '/', $className) . '.php']);
if (file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return true;
}
}
return false;
}
/**
* @param $className
* @return bool
*/
static public function configLoader($className)
{
$filename = implode(DIRECTORY_SEPARATOR,
[realpath(__DIR__), 'config', str_replace("\\", '/', $className) . '.php']);
if (file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return true;
}
}
return false;
}
}
spl_autoload_register('Autoloader::toolLoader');
spl_autoload_register('Autoloader::sdkLoader');
spl_autoload_register('Autoloader::configLoader');