|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Defines functions and signatures which can be registered as methods exposed by an XML-RPC Server. |
|
4
|
|
|
* |
|
5
|
|
|
* To use this, use something akin to: |
|
6
|
|
|
* $signatures = include('interop.php'); |
|
7
|
|
|
* |
|
8
|
|
|
* Trivial interop tests |
|
9
|
|
|
* http://www.xmlrpc.com/stories/storyReader$1636 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
use PhpXmlRpc\Encoder; |
|
13
|
|
|
use PhpXmlRpc\Response; |
|
14
|
|
|
use PhpXmlRpc\Value; |
|
15
|
559 |
|
|
|
16
|
559 |
|
$i_echoString_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString)); |
|
17
|
|
|
$i_echoString_doc = "Echoes string."; |
|
18
|
559 |
|
|
|
19
|
559 |
|
$i_echoStringArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
|
20
|
|
|
$i_echoStringArray_doc = "Echoes string array."; |
|
21
|
559 |
|
|
|
22
|
559 |
|
$i_echoInteger_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt)); |
|
23
|
|
|
$i_echoInteger_doc = "Echoes integer."; |
|
24
|
559 |
|
|
|
25
|
559 |
|
$i_echoIntegerArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
|
26
|
|
|
$i_echoIntegerArray_doc = "Echoes integer array."; |
|
27
|
559 |
|
|
|
28
|
559 |
|
$i_echoFloat_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble)); |
|
29
|
|
|
$i_echoFloat_doc = "Echoes float."; |
|
30
|
559 |
|
|
|
31
|
559 |
|
$i_echoFloatArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
|
32
|
|
|
$i_echoFloatArray_doc = "Echoes float array."; |
|
33
|
559 |
|
|
|
34
|
559 |
|
$i_echoStruct_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcStruct)); |
|
35
|
|
|
$i_echoStruct_doc = "Echoes struct."; |
|
36
|
559 |
|
|
|
37
|
559 |
|
$i_echoStructArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
|
38
|
|
|
$i_echoStructArray_doc = "Echoes struct array."; |
|
39
|
559 |
|
|
|
40
|
559 |
|
$i_echoValue_doc = "Echoes any value back."; |
|
41
|
|
|
$i_echoValue_sig = array(array(Value::$xmlrpcValue, Value::$xmlrpcValue)); |
|
42
|
559 |
|
|
|
43
|
559 |
|
$i_echoBase64_sig = array(array(Value::$xmlrpcBase64, Value::$xmlrpcBase64)); |
|
44
|
|
|
$i_echoBase64_doc = "Echoes base64."; |
|
45
|
559 |
|
|
|
46
|
559 |
|
$i_echoDate_sig = array(array(Value::$xmlrpcDateTime, Value::$xmlrpcDateTime)); |
|
47
|
|
|
$i_echoDate_doc = "Echoes dateTime."; |
|
48
|
|
|
|
|
49
|
|
|
$i_whichToolkit_sig = array(array(Value::$xmlrpcStruct)); |
|
50
|
|
|
$i_whichToolkit_doc = "Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem."; |
|
51
|
|
|
|
|
52
|
|
|
function i_echoParam($req) |
|
53
|
|
|
{ |
|
54
|
|
|
$v = $req->getParam(0); |
|
55
|
|
|
|
|
56
|
|
|
return new Response($v); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
function i_whichToolkit($req) |
|
|
|
|
|
|
60
|
|
|
{ |
|
61
|
|
|
$ret = array( |
|
62
|
|
|
"toolkitDocsUrl" => "https://gggeek.github.io/phpxmlrpc/", |
|
63
|
|
|
"toolkitName" => PhpXmlRpc\PhpXmlRpc::$xmlrpcName, |
|
64
|
|
|
"toolkitVersion" => PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion, |
|
65
|
|
|
"toolkitOperatingSystem" => $_SERVER['SERVER_SOFTWARE'], |
|
66
|
|
|
); |
|
67
|
|
|
|
|
68
|
|
|
$encoder = new Encoder(); |
|
69
|
|
|
return new Response($encoder->encode($ret)); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
return array( |
|
73
|
|
|
"interopEchoTests.echoString" => array( |
|
74
|
|
|
"function" => "i_echoParam", |
|
75
|
|
|
"signature" => $i_echoString_sig, |
|
76
|
|
|
"docstring" => $i_echoString_doc, |
|
77
|
|
|
), |
|
78
|
|
|
"interopEchoTests.echoStringArray" => array( |
|
79
|
|
|
"function" => "i_echoParam", |
|
80
|
|
|
"signature" => $i_echoStringArray_sig, |
|
81
|
|
|
"docstring" => $i_echoStringArray_doc, |
|
82
|
|
|
), |
|
83
|
|
|
"interopEchoTests.echoInteger" => array( |
|
84
|
|
|
"function" => "i_echoParam", |
|
85
|
|
|
"signature" => $i_echoInteger_sig, |
|
86
|
|
|
"docstring" => $i_echoInteger_doc, |
|
87
|
|
|
), |
|
88
|
|
|
"interopEchoTests.echoIntegerArray" => array( |
|
89
|
|
|
"function" => "i_echoParam", |
|
90
|
|
|
"signature" => $i_echoIntegerArray_sig, |
|
91
|
|
|
"docstring" => $i_echoIntegerArray_doc, |
|
92
|
|
|
), |
|
93
|
|
|
"interopEchoTests.echoFloat" => array( |
|
94
|
|
|
"function" => "i_echoParam", |
|
95
|
|
|
"signature" => $i_echoFloat_sig, |
|
96
|
|
|
"docstring" => $i_echoFloat_doc, |
|
97
|
|
|
), |
|
98
|
|
|
"interopEchoTests.echoFloatArray" => array( |
|
99
|
|
|
"function" => "i_echoParam", |
|
100
|
|
|
"signature" => $i_echoFloatArray_sig, |
|
101
|
|
|
"docstring" => $i_echoFloatArray_doc, |
|
102
|
|
|
), |
|
103
|
|
|
"interopEchoTests.echoStruct" => array( |
|
104
|
|
|
"function" => "i_echoParam", |
|
105
|
|
|
"signature" => $i_echoStruct_sig, |
|
106
|
|
|
"docstring" => $i_echoStruct_doc, |
|
107
|
|
|
), |
|
108
|
|
|
"interopEchoTests.echoStructArray" => array( |
|
109
|
|
|
"function" => "i_echoParam", |
|
110
|
559 |
|
"signature" => $i_echoStructArray_sig, |
|
111
|
559 |
|
"docstring" => $i_echoStructArray_doc, |
|
112
|
|
|
), |
|
113
|
|
|
"interopEchoTests.echoValue" => array( |
|
114
|
|
|
"function" => "i_echoParam", |
|
115
|
|
|
"signature" => $i_echoValue_sig, |
|
116
|
|
|
"docstring" => $i_echoValue_doc, |
|
117
|
|
|
), |
|
118
|
|
|
"interopEchoTests.echoBase64" => array( |
|
119
|
|
|
"function" => "i_echoParam", |
|
120
|
|
|
"signature" => $i_echoBase64_sig, |
|
121
|
|
|
"docstring" => $i_echoBase64_doc, |
|
122
|
|
|
), |
|
123
|
|
|
"interopEchoTests.echoDate" => array( |
|
124
|
|
|
"function" => "i_echoParam", |
|
125
|
|
|
"signature" => $i_echoDate_sig, |
|
126
|
|
|
"docstring" => $i_echoDate_doc, |
|
127
|
|
|
), |
|
128
|
|
|
"interopEchoTests.whichToolkit" => array( |
|
129
|
559 |
|
"function" => "i_whichToolkit", |
|
130
|
559 |
|
"signature" => $i_whichToolkit_sig, |
|
131
|
559 |
|
"docstring" => $i_whichToolkit_doc, |
|
132
|
|
|
), |
|
133
|
|
|
); |
|
134
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.