1
|
|
|
<?php |
2
|
|
|
// Copyright 1999-2016. Parallels IP Holdings GmbH. |
3
|
|
|
|
4
|
|
|
namespace PleskX\Api\Operator; |
5
|
|
|
use PleskX\Api\Struct\Webspace as Struct; |
6
|
|
|
|
7
|
|
|
class Webspace extends \PleskX\Api\Operator |
8
|
|
|
{ |
9
|
|
|
|
10
|
|
|
public function getPermissionDescriptor() |
11
|
|
|
{ |
12
|
|
|
$response = $this->request('get-permission-descriptor.filter'); |
13
|
|
|
return new Struct\PermissionDescriptor($response); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
public function getLimitDescriptor() |
17
|
|
|
{ |
18
|
|
|
$response = $this->request('get-limit-descriptor.filter'); |
19
|
|
|
return new Struct\LimitDescriptor($response); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function getPhysicalHostingDescriptor() |
23
|
|
|
{ |
24
|
|
|
$response = $this->request('get-physical-hosting-descriptor.filter'); |
25
|
|
|
return new Struct\PhysicalHostingDescriptor($response); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param array $properties |
30
|
|
|
* @param array|null $hostingProperties |
31
|
|
|
* @return Struct\Info |
32
|
|
|
*/ |
33
|
|
|
public function create(array $properties, array $hostingProperties = null) |
34
|
|
|
{ |
35
|
|
|
$packet = $this->_client->getPacket(); |
36
|
|
|
$info = $packet->addChild($this->_wrapperTag)->addChild('add'); |
37
|
|
|
|
38
|
|
|
$infoGeneral = $info->addChild('gen_setup'); |
39
|
|
|
foreach ($properties as $name => $value) { |
40
|
|
|
$infoGeneral->addChild($name, $value); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
if ($hostingProperties) { |
44
|
|
|
$infoHosting = $info->addChild('hosting')->addChild('vrt_hst'); |
45
|
|
|
foreach ($hostingProperties as $name => $value) { |
46
|
|
|
$property = $infoHosting->addChild('property'); |
47
|
|
|
$property->addChild('name', $name); |
48
|
|
|
$property->addChild('value', $value); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
if (isset($properties['ip_address'])) { |
52
|
|
|
$infoHosting->addChild("ip_address", $properties['ip_address']); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
$response = $this->_client->request($packet); |
57
|
|
|
return new Struct\Info($response); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $field |
62
|
|
|
* @param integer|string $value |
63
|
|
|
* @return bool |
64
|
|
|
*/ |
65
|
|
|
public function delete($field, $value) |
66
|
|
|
{ |
67
|
|
|
return $this->_delete($field, $value); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $field |
72
|
|
|
* @param integer|string $value |
73
|
|
|
* @return Struct\GeneralInfo |
74
|
|
|
*/ |
75
|
|
|
public function get($field, $value) |
76
|
|
|
{ |
77
|
|
|
$items = $this->_getItems(Struct\GeneralInfo::class, 'gen_info', $field, $value); |
78
|
|
|
return reset($items); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return Struct\GeneralInfo[] |
83
|
|
|
*/ |
84
|
|
|
public function getAll() |
85
|
|
|
{ |
86
|
|
|
return $this->_getItems(Struct\GeneralInfo::class, 'gen_info'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
} |
90
|
|
|
|