@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | </h3> |
13 | 13 | <?php |
14 | 14 | |
15 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
15 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
16 | 16 | PhpXmlRpc\Autoloader::register(); |
17 | 17 | |
18 | 18 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
19 | 19 | $client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals |
20 | 20 | $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); |
21 | 21 | if ($resp->faultCode()) { |
22 | - echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n"; |
|
22 | + echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n"; |
|
23 | 23 | } else { |
24 | 24 | echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"; |
25 | 25 | flush(); |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | if ($methodName == 'examples.getStateName') { |
32 | 32 | $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); |
33 | 33 | if ($callable) { |
34 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n"; |
|
34 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n"; |
|
35 | 35 | } else { |
36 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n"; |
|
36 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n"; |
|
37 | 37 | } |
38 | 38 | break; |
39 | 39 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | <p></p> |
11 | 11 | <?php |
12 | 12 | |
13 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
13 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
14 | 14 | PhpXmlRpc\Autoloader::register(); |
15 | 15 | |
16 | 16 | $inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27); |
17 | 17 | print "This is the input data:<br/><pre>"; |
18 | -foreach($inAr as $key => $val) { |
|
19 | - print $key . ", " . $val . "\n"; |
|
18 | +foreach ($inAr as $key => $val) { |
|
19 | + print $key.", ".$val."\n"; |
|
20 | 20 | } |
21 | 21 | print "</pre>"; |
22 | 22 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ); |
33 | 33 | } |
34 | 34 | $v = new PhpXmlRpc\Value($p, "array"); |
35 | -print "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n"; |
|
35 | +print "Encoded into xmlrpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n"; |
|
36 | 36 | |
37 | 37 | // create client and message objects |
38 | 38 | $req = new PhpXmlRpc\Request('examples.sortByAge', array($v)); |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | foreach ($value as $struct) { |
53 | 53 | $name = $struct["name"]; |
54 | 54 | $age = $struct["age"]; |
55 | - print htmlspecialchars($name->scalarval()) . ", " . htmlspecialchars($age->scalarval()) . "\n"; |
|
55 | + print htmlspecialchars($name->scalarval()).", ".htmlspecialchars($age->scalarval())."\n"; |
|
56 | 56 | } |
57 | 57 | |
58 | - print "<hr/>For nerds: I got this value back<br/><pre>" . |
|
59 | - htmlentities($resp->serialize()) . "</pre><hr/>\n"; |
|
58 | + print "<hr/>For nerds: I got this value back<br/><pre>". |
|
59 | + htmlentities($resp->serialize())."</pre><hr/>\n"; |
|
60 | 60 | } else { |
61 | 61 | print "An error occurred:<pre>"; |
62 | - print "Code: " . htmlspecialchars($resp->faultCode()) . |
|
63 | - "\nReason: '" . htmlspecialchars($resp->faultString()) . '\'</pre><hr/>'; |
|
62 | + print "Code: ".htmlspecialchars($resp->faultCode()). |
|
63 | + "\nReason: '".htmlspecialchars($resp->faultString()).'\'</pre><hr/>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | ?> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | <h3>The code demonstrates usage for the terminally lazy. For a more complete proxy, look at at the Wrapper class</h3> |
7 | 7 | <?php |
8 | 8 | |
9 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
9 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
10 | 10 | PhpXmlRpc\Autoloader::register(); |
11 | 11 | |
12 | 12 | class PhpXmlRpcProxy |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | <h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3> |
7 | 7 | <?php |
8 | 8 | |
9 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
9 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
10 | 10 | PhpXmlRpc\Autoloader::register(); |
11 | 11 | |
12 | 12 | $req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array()); |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | $encoder = new PhpXmlRpc\Encoder(); |
17 | 17 | $value = $encoder->decode($resp->value()); |
18 | 18 | print "<pre>"; |
19 | - print "name: " . htmlspecialchars($value["toolkitName"]) . "\n"; |
|
20 | - print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n"; |
|
21 | - print "docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n"; |
|
22 | - print "os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n"; |
|
19 | + print "name: ".htmlspecialchars($value["toolkitName"])."\n"; |
|
20 | + print "version: ".htmlspecialchars($value["toolkitVersion"])."\n"; |
|
21 | + print "docs: ".htmlspecialchars($value["toolkitDocsUrl"])."\n"; |
|
22 | + print "os: ".htmlspecialchars($value["toolkitOperatingSystem"])."\n"; |
|
23 | 23 | print "</pre>"; |
24 | 24 | } else { |
25 | 25 | print "An error occurred: "; |
26 | - print "Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n"; |
|
26 | + print "Code: ".htmlspecialchars($resp->faultCode())." Reason: '".htmlspecialchars($resp->faultString())."'\n"; |
|
27 | 27 | } |
28 | 28 | ?> |
29 | 29 | </body> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | method)</p> |
21 | 21 | <?php |
22 | 22 | |
23 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
23 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
24 | 24 | PhpXmlRpc\Autoloader::register(); |
25 | 25 | |
26 | 26 | if (isset($_POST["mailto"]) && $_POST["mailto"]) { |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | print "<fonr color=\"red\">"; |
45 | 45 | print "Mail send failed<br/>\n"; |
46 | 46 | print "Fault: "; |
47 | - print "Code: " . htmlspecialchars($resp->faultCode()) . |
|
48 | - " Reason: '" . htmlspecialchars($resp->faultString()) . "'<br/>"; |
|
47 | + print "Code: ".htmlspecialchars($resp->faultCode()). |
|
48 | + " Reason: '".htmlspecialchars($resp->faultString())."'<br/>"; |
|
49 | 49 | print "</font><br/>"; |
50 | 50 | } |
51 | 51 | } |
@@ -8,34 +8,34 @@ |
||
8 | 8 | <h3>The code demonstrates usage of automatic encoding/decoding of php variables into xmlrpc values</h3> |
9 | 9 | <?php |
10 | 10 | |
11 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
11 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
12 | 12 | PhpXmlRpc\Autoloader::register(); |
13 | 13 | |
14 | 14 | if (isset($_POST["stateno"]) && $_POST["stateno"] != "") { |
15 | - $stateNo = (integer)$_POST["stateno"]; |
|
15 | + $stateNo = (integer) $_POST["stateno"]; |
|
16 | 16 | $encoder = new PhpXmlRpc\Encoder(); |
17 | 17 | $req = new PhpXmlRpc\Request('examples.getStateName', |
18 | 18 | array($encoder->encode($stateNo)) |
19 | 19 | ); |
20 | - print "Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . "\n\n</pre>Debug info of server data follows...\n\n"; |
|
20 | + print "Sending the following request:<pre>\n\n".htmlentities($req->serialize())."\n\n</pre>Debug info of server data follows...\n\n"; |
|
21 | 21 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
22 | 22 | $client->setDebug(1); |
23 | 23 | $r = $client->send($req); |
24 | 24 | if (!$r->faultCode()) { |
25 | 25 | $v = $r->value(); |
26 | - print "<br/>State number <b>" . $stateNo . "</b> is <b>" |
|
27 | - . htmlspecialchars($encoder->decode($v)) . "</b><br/>"; |
|
26 | + print "<br/>State number <b>".$stateNo."</b> is <b>" |
|
27 | + . htmlspecialchars($encoder->decode($v))."</b><br/>"; |
|
28 | 28 | } else { |
29 | 29 | print "An error occurred: "; |
30 | - print "Code: " . htmlspecialchars($r->faultCode()) |
|
31 | - . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>"; |
|
30 | + print "Code: ".htmlspecialchars($r->faultCode()) |
|
31 | + . " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>"; |
|
32 | 32 | } |
33 | 33 | } else { |
34 | 34 | $stateNo = ""; |
35 | 35 | } |
36 | 36 | |
37 | 37 | print "<form action=\"getstatename.php\" method=\"POST\"> |
38 | -<input name=\"stateno\" value=\"" . $stateNo . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
38 | +<input name=\"stateno\" value=\"" . $stateNo."\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
39 | 39 | <p>Enter a state number to query its name</p>"; |
40 | 40 | |
41 | 41 | ?> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return $xmlrpcVal->scalarval(); |
73 | 73 | case 'array': |
74 | 74 | $arr = array(); |
75 | - foreach($xmlrpcVal as $value) { |
|
75 | + foreach ($xmlrpcVal as $value) { |
|
76 | 76 | $arr[] = $this->decode($value, $options); |
77 | 77 | } |
78 | 78 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | case 'msg': |
103 | 103 | $paramCount = $xmlrpcVal->getNumParams(); |
104 | 104 | $arr = array(); |
105 | - for ($i = 0; $i < $paramCount; $i++) { |
|
105 | + for ($i = 0; $i<$paramCount; $i++) { |
|
106 | 106 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
107 | 107 | } |
108 | 108 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | break; |
204 | 204 | case 'resource': |
205 | 205 | if (in_array('extension_api', $options)) { |
206 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
206 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
207 | 207 | } else { |
208 | 208 | $xmlrpcVal = new Value(); |
209 | 209 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | if (extension_loaded('mbstring')) { |
247 | 247 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
248 | 248 | } else { |
249 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
249 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | xml_parser_free($parser); |
281 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
281 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
282 | 282 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
283 | 283 | |
284 | 284 | error_log($xmlRpcParser->_xh['isf_reason']); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | return $r; |
300 | 300 | case 'methodcall': |
301 | 301 | $req = new Request($xmlRpcParser->_xh['method']); |
302 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
302 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
303 | 303 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
304 | 304 | } |
305 | 305 |
@@ -110,36 +110,36 @@ |
||
110 | 110 | public function serialize($charsetEncoding = '') |
111 | 111 | { |
112 | 112 | if ($charsetEncoding != '') { |
113 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
113 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
114 | 114 | } else { |
115 | 115 | $this->content_type = 'text/xml'; |
116 | 116 | } |
117 | 117 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
118 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
118 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
119 | 119 | } else { |
120 | 120 | $result = "<methodResponse>\n"; |
121 | 121 | } |
122 | 122 | if ($this->errno) { |
123 | 123 | // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients |
124 | 124 | // by xml-encoding non ascii chars |
125 | - $result .= "<fault>\n" . |
|
126 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
127 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
128 | - Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
125 | + $result .= "<fault>\n". |
|
126 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
127 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
128 | + Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
129 | 129 | "</struct>\n</value>\n</fault>"; |
130 | 130 | } else { |
131 | 131 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
132 | 132 | if (is_string($this->val) && $this->valtyp == 'xml') { |
133 | - $result .= "<params>\n<param>\n" . |
|
134 | - $this->val . |
|
133 | + $result .= "<params>\n<param>\n". |
|
134 | + $this->val. |
|
135 | 135 | "</param>\n</params>"; |
136 | 136 | } else { |
137 | 137 | /// @todo try to build something serializable? |
138 | 138 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
139 | 139 | } |
140 | 140 | } else { |
141 | - $result .= "<params>\n<param>\n" . |
|
142 | - $this->val->serialize($charsetEncoding) . |
|
141 | + $result .= "<params>\n<param>\n". |
|
142 | + $this->val->serialize($charsetEncoding). |
|
143 | 143 | "</param>\n</params>"; |
144 | 144 | } |
145 | 145 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | - if (is_file($file = __DIR__ . str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
32 | + if (is_file($file = __DIR__.str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
33 | 33 | require $file; |
34 | 34 | } |
35 | 35 | } |