File tree Expand file tree Collapse file tree 3 files changed +55
-11
lines changed Expand file tree Collapse file tree 3 files changed +55
-11
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ public function request($request, $mode = self::RESPONSE_SHORT)
163
163
? call_user_func ($ this ->_verifyResponseCallback , $ xml )
164
164
: $ this ->_verifyResponse ($ xml );
165
165
166
- return (self ::RESPONSE_FULL == $ mode ) ? $ xml : $ xml ->xpath ('//result ' )[ 0 ] ;
166
+ return (self ::RESPONSE_FULL == $ mode ) ? $ xml : $ xml ->xpath ('//result ' );
167
167
}
168
168
169
169
/**
@@ -200,7 +200,6 @@ private function _performHttpRequest($request)
200
200
}
201
201
202
202
curl_close ($ curl );
203
-
204
203
$ xml = new XmlResponse ($ result );
205
204
return $ xml ;
206
205
}
Original file line number Diff line number Diff line change 7
7
8
8
class SiteAlias extends \PleskX \Api \Operator
9
9
{
10
+
11
+
10
12
/**
11
13
* @param array $properties
12
14
* @param array $preferences
@@ -34,4 +36,19 @@ public function create(array $properties, array $preferences = [])
34
36
return new Struct \Info ($ response );
35
37
}
36
38
39
+ public function get ($ site_id )
40
+ {
41
+ $ packet = $ this ->_client ->getPacket ();
42
+
43
+ $ get = $ packet ->addChild ($ this ->_wrapperTag )->addChild ('get ' );
44
+
45
+ $ filter = $ get ->addChild ('filter ' );
46
+ $ filter ->addChild ('site-id ' ,$ site_id );
47
+ $ response = $ this ->_client ->request ($ packet );
48
+
49
+ return new Struct \Info ($ response );
50
+ //$packet->saveXML('/var/www/vagrant/ataama_development/application/logs/ataama/development/portal/xml');
51
+ return $ response ;
52
+ }
53
+
37
54
}
Original file line number Diff line number Diff line change 3
3
4
4
namespace PleskX \Api \Struct \SiteAlias ;
5
5
6
- class Info extends \PleskX \Api \Struct
6
+ class Info extends \PleskX \Api \Struct implements \Iterator
7
7
{
8
- /** @var string */
9
- public $ status ;
10
8
11
- /** @var integer */
12
- public $ id ;
9
+ public $ site_id ;
10
+
11
+ private $ array = array ();
12
+
13
+ private $ position = 0 ;
13
14
14
15
public function __construct ($ apiResponse )
15
16
{
16
- $ this ->_initScalarProperties ($ apiResponse , [
17
- 'id ' ,
18
- 'status ' ,
19
- ]);
17
+ $ json = json_encode ($ apiResponse );
18
+ $ responses = json_decode ($ json );
19
+
20
+ $ this ->site_id = $ responses [0 ]->id ;
21
+
22
+ foreach ($ responses as $ response ) {
23
+ $ this ->array [] = array (
24
+ 'site-name ' => $ response ->info ->name ,
25
+ 'ascii-name ' => $ response ->info ->{'ascii-name ' }
26
+ );
27
+ }
28
+ }
29
+
30
+ public function rewind () {
31
+ $ this ->position = 0 ;
32
+ }
33
+
34
+ public function current () {
35
+ return $ this ->array [$ this ->position ];
36
+ }
37
+
38
+ public function key () {
39
+ return $ this ->position ;
40
+ }
41
+
42
+ public function next () {
43
+ ++$ this ->position ;
44
+ }
45
+
46
+ public function valid () {
47
+ return isset ($ this ->array [$ this ->position ]);
20
48
}
21
49
}
You can’t perform that action at this time.
0 commit comments