blob: 8eeba0c290f591edfc00a453523a2e88bffcad60 (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
/**
* An XMLRPC call
*
* @package Elgg.Core
* @subpackage XMLRPC
*/
class XMLRPCCall {
/** Method name */
private $methodname;
/** Parameters */
private $params;
/**
* Construct a new XML RPC Call
*
* @param string $xml XML
*/
function __construct($xml) {
$this->_parse($xml);
}
/**
* Return the method name associated with the call.
*
* @return string
*/
public function getMethodName() { return $this->methodname; }
/**
* Return the parameters.
* Returns a nested array of XmlElement.
*
* @see XmlElement
* @return array
*/
public function getParameters() { return $this->params; }
/**
* Parse the xml into its components according to spec.
* This first version is a little primitive.
*
* @param string $xml XML
*
* @return void
*/
private function _parse($xml) {
$xml = xml_to_object($xml);
// sanity check
if ((isset($xml->name)) && (strcasecmp($xml->name, "methodCall") != 0)) {
throw new CallException(elgg_echo('CallException:NotRPCCall'));
}
// method name
$this->methodname = $xml->children[0]->content;
// parameters
$this->params = $xml->children[1]->children;
}
}
|