-
Notifications
You must be signed in to change notification settings - Fork 0
/
ARSU_VA_Plugin.php
59 lines (48 loc) · 1.33 KB
/
ARSU_VA_Plugin.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
50
51
52
53
54
55
56
57
58
59
<?php
class ARSU_VA_Plugin
{
const DIR_PUBLIC = 'public';
/** @var string */
private $directory;
/** @var array */
private $classMap = array();
/** @var ARSU_VA_Util */
private $util;
public function load_module($directory, $urlToRoot)
{
$this->prepareClassAutoloader();
$this->directory = $directory;
$this->util = new ARSU_VA_Util($directory, $urlToRoot, ARSU_VA_Constants::PLUGIN_ID, self::DIR_PUBLIC);
}
/**
* Initialize the class map array and prepare the autoload function
*/
private function prepareClassAutoloader()
{
$this->classMap = array(
'ARSU_VA_Plugin' => 'ARSU_VA_Plugin.php',
'ARSU_VA_Constants' => 'ARSU_VAC_Constants.php',
'ARSU_VA_Util' => 'ARSU_VA_Util.php',
);
spl_autoload_extensions('.php');
spl_autoload_register(array($this, 'autoload'));
}
/**
* Autoload function for the spl_autoload_register() function
*
* @param string $className
*/
private function autoload($className)
{
if (isset($this->classMap[$className])) {
require_once $this->directory . $this->classMap[$className];
}
}
/**
* @return ARSU_VA_Util
*/
public function util()
{
return $this->util;
}
}