-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathUi.php
45 lines (34 loc) · 1.3 KB
/
Ui.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
// Copyright 1999-2025. WebPros International GmbH.
namespace PleskX\Api\Operator;
use PleskX\Api\Struct\Ui as Struct;
class Ui extends \PleskX\Api\Operator
{
public function getNavigation(): array
{
$response = $this->request('get-navigation');
/** @psalm-suppress ImplicitToStringCast, PossiblyNullArgument */
return unserialize(base64_decode($response->navigation));
}
public function createCustomButton(string $owner, array $properties): int
{
$packet = $this->client->getPacket();
$buttonNode = $packet->addChild($this->wrapperTag)->addChild('create-custombutton');
$buttonNode->addChild('owner')->addChild($owner);
$propertiesNode = $buttonNode->addChild('properties');
foreach ($properties as $name => $value) {
$propertiesNode->{$name} = $value;
}
$response = $this->client->request($packet);
return (int) $response->id;
}
public function getCustomButton(int $id): Struct\CustomButton
{
$response = $this->request("get-custombutton.filter.custombutton-id=$id");
return new Struct\CustomButton($response);
}
public function deleteCustomButton(int $id): bool
{
return $this->deleteBy('custombutton-id', $id, 'delete-custombutton');
}
}