-
Notifications
You must be signed in to change notification settings - Fork 1
/
hooks.php
45 lines (36 loc) · 1.34 KB
/
hooks.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
<?php
use WHMCS\Module\Server\Katapult\Adaptation\AdminArea;
use WHMCS\Module\Server\Katapult\Adaptation\ClientArea;
use WHMCS\Module\Server\Katapult\Adaptation\System as SystemAdaptation;
use WHMCS\Module\Server\Katapult\Katapult\ParentOrganization;
if (!defined('WHMCS')) {
die('This file cannot be accessed directly');
}
require(__DIR__ . '/vendor/autoload.php');
// System
\add_hook('DailyCronJob', 0, [SystemAdaptation::class, 'syncConfigOptions']);
\add_hook('AfterCronJob', 0, [SystemAdaptation::class, 'syncVmBuilds']);
// Admin area
\add_hook('AdminProductConfigFields', 0, function ($vars) {
$configurationPane = new AdminArea\ConfigurationPane(
new ParentOrganization(
\Katapult\APIClient(),
\Katapult\keyValueStore(),
),
\Katapult\APIKey()
);
return $configurationPane($vars);
});
\add_hook('AdminProductConfigFieldsSave', 0, function ($vars) {
$updateConfiguration = new AdminArea\UpdateConfiguration(
new ParentOrganization(
\Katapult\APIClient(),
\Katapult\keyValueStore(),
),
\Katapult\APIKey()
);
$updateConfiguration($vars);
});
// JS and CSS assets
\add_hook('AdminAreaHeadOutput', 0, [AdminArea\Assets::class, 'addAssetsToHead']);
\add_hook('ClientAreaHeadOutput', 0, [ClientArea\Assets::class, 'addAssetsToHead']);