5 * @package WordPress |
5 * @package WordPress |
6 * @since 3.1.0 |
6 * @since 3.1.0 |
7 * |
7 * |
8 */ |
8 */ |
9 class WP_HTTP_IXR_Client extends IXR_Client { |
9 class WP_HTTP_IXR_Client extends IXR_Client { |
|
10 public $scheme; |
|
11 /** |
|
12 * @var IXR_Error |
|
13 */ |
|
14 public $error; |
10 |
15 |
11 function __construct($server, $path = false, $port = false, $timeout = 15) { |
16 /** |
|
17 * @param string $server |
|
18 * @param string|bool $path |
|
19 * @param int|bool $port |
|
20 * @param int $timeout |
|
21 */ |
|
22 public function __construct($server, $path = false, $port = false, $timeout = 15) { |
12 if ( ! $path ) { |
23 if ( ! $path ) { |
13 // Assume we have been given a URL instead |
24 // Assume we have been given a URL instead |
14 $bits = parse_url($server); |
25 $bits = parse_url($server); |
15 $this->scheme = $bits['scheme']; |
26 $this->scheme = $bits['scheme']; |
16 $this->server = $bits['host']; |
27 $this->server = $bits['host']; |
17 $this->port = isset($bits['port']) ? $bits['port'] : $port; |
28 $this->port = isset($bits['port']) ? $bits['port'] : $port; |
18 $this->path = !empty($bits['path']) ? $bits['path'] : '/'; |
29 $this->path = !empty($bits['path']) ? $bits['path'] : '/'; |
19 |
30 |
20 // Make absolutely sure we have a path |
31 // Make absolutely sure we have a path |
21 if ( ! $this->path ) |
32 if ( ! $this->path ) { |
22 $this->path = '/'; |
33 $this->path = '/'; |
|
34 } |
|
35 |
|
36 if ( ! empty( $bits['query'] ) ) { |
|
37 $this->path .= '?' . $bits['query']; |
|
38 } |
23 } else { |
39 } else { |
24 $this->scheme = 'http'; |
40 $this->scheme = 'http'; |
25 $this->server = $server; |
41 $this->server = $server; |
26 $this->path = $path; |
42 $this->path = $path; |
27 $this->port = $port; |
43 $this->port = $port; |
28 } |
44 } |
29 $this->useragent = 'The Incutio XML-RPC PHP Library'; |
45 $this->useragent = 'The Incutio XML-RPC PHP Library'; |
30 $this->timeout = $timeout; |
46 $this->timeout = $timeout; |
31 } |
47 } |
32 |
48 |
33 function query() { |
49 public function query() { |
34 $args = func_get_args(); |
50 $args = func_get_args(); |
35 $method = array_shift($args); |
51 $method = array_shift($args); |
36 $request = new IXR_Request($method, $args); |
52 $request = new IXR_Request($method, $args); |
37 $xml = $request->getXml(); |
53 $xml = $request->getXml(); |
38 |
54 |