@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/client/_prepend.php"; |
|
2 | +require_once __DIR__."/client/_prepend.php"; |
|
3 | 3 | |
4 | 4 | output('<html lang="en"> |
5 | 5 | <head><title>phpxmlrpc</title></head> |
@@ -10,25 +10,25 @@ discard block |
||
10 | 10 | output("<p>Please note that in most cases you are better off using `new PhpXmlRpc\Encoder()->encode()` to create nested Value objects</p>\n"); |
11 | 11 | |
12 | 12 | $v = new PhpXmlRpc\Value(1234, 'int'); |
13 | -output("Int: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
13 | +output("Int: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
14 | 14 | |
15 | 15 | $v = new PhpXmlRpc\Value('Are the following characters escaped? < & >'); |
16 | -output("String <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
16 | +output("String <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
17 | 17 | |
18 | 18 | $v = new PhpXmlRpc\Value(true, 'boolean'); |
19 | -output("Boolean: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
19 | +output("Boolean: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
20 | 20 | |
21 | 21 | $v = new PhpXmlRpc\Value(1234.5678, 'double'); |
22 | -output("Double: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
22 | +output("Double: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
23 | 23 | |
24 | 24 | $v = new PhpXmlRpc\Value(time(), 'dateTime.iso8601'); |
25 | -output("Datetime (from timestamp): <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
25 | +output("Datetime (from timestamp): <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
26 | 26 | $v = new PhpXmlRpc\Value(new DateTime(), 'dateTime.iso8601'); |
27 | -output("Datetime (from php DateTime): <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
27 | +output("Datetime (from php DateTime): <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
28 | 28 | |
29 | 29 | $v = new PhpXmlRpc\Value('hello world', 'base64'); |
30 | -output("Base64: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
31 | -output("(value of base64 string is: '" . $v->scalarval() . "')<BR><BR>"); |
|
30 | +output("Base64: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
31 | +output("(value of base64 string is: '".$v->scalarval()."')<BR><BR>"); |
|
32 | 32 | |
33 | 33 | $v = new PhpXmlRpc\Value( |
34 | 34 | array( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ), |
42 | 42 | "array" |
43 | 43 | ); |
44 | -output("Array: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
44 | +output("Array: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
45 | 45 | |
46 | 46 | $v = new PhpXmlRpc\Value( |
47 | 47 | array( |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | ), |
62 | 62 | "struct" |
63 | 63 | ); |
64 | -output("Struct: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
64 | +output("Struct: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
65 | 65 | |
66 | 66 | $w = new PhpXmlRpc\Value(array($v), 'array'); |
67 | -output("Array containing a struct: <PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
67 | +output("Array containing a struct: <PRE>".htmlentities($w->serialize())."</PRE>"); |
|
68 | 68 | |
69 | 69 | class MyClass |
70 | 70 | { |
@@ -76,49 +76,49 @@ discard block |
||
76 | 76 | // the public property is the only one which will be serialized. As such, it has to be of type Value |
77 | 77 | $myObject->public = new \PhpXmlRpc\Value('a public property, wrapped'); |
78 | 78 | $w = new PhpXmlRpc\Value($myObject, 'struct'); |
79 | -output("Struct encoding a php object: <PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
79 | +output("Struct encoding a php object: <PRE>".htmlentities($w->serialize())."</PRE>"); |
|
80 | 80 | |
81 | 81 | output("<h3>Testing value serialization - xml-rpc extensions</h3>\n"); |
82 | 82 | $v = new PhpXmlRpc\Value(1234, 'i8'); |
83 | -output("I8: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
83 | +output("I8: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
84 | 84 | $v = new PhpXmlRpc\Value(null, 'null'); |
85 | -output("Null: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
85 | +output("Null: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
86 | 86 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_apache_encoding = true; |
87 | -output("Null, alternative: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
87 | +output("Null, alternative: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
88 | 88 | |
89 | 89 | output("<h3>Testing value serialization - character encoding</h3>\n"); |
90 | 90 | // The greek word 'kosme' |
91 | 91 | $v = new PhpXmlRpc\Value('κόσμε'); |
92 | -output("Greek (default encoding): <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
93 | -output("Greek (utf8 encoding): <PRE>" . htmlentities($v->serialize('UTF-8')) . "</PRE>"); |
|
92 | +output("Greek (default encoding): <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
93 | +output("Greek (utf8 encoding): <PRE>".htmlentities($v->serialize('UTF-8'))."</PRE>"); |
|
94 | 94 | if (function_exists('mb_convert_encoding')) { |
95 | - output("Greek (ISO-8859-7 encoding): <PRE>" . htmlentities($v->serialize('ISO-8859-7')) . "</PRE>"); |
|
95 | + output("Greek (ISO-8859-7 encoding): <PRE>".htmlentities($v->serialize('ISO-8859-7'))."</PRE>"); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | output("<h3>Testing request serialization</h3>\n"); |
99 | 99 | $req = new PhpXmlRpc\Request('examples.getStateName'); |
100 | 100 | $req->method('examples.getStateName'); |
101 | 101 | $req->addParam(new PhpXmlRpc\Value(42, 'int')); |
102 | -output("<PRE>" . htmlentities($req->serialize()) . "</PRE>"); |
|
102 | +output("<PRE>".htmlentities($req->serialize())."</PRE>"); |
|
103 | 103 | |
104 | 104 | output("<h3>Testing response serialization</h3>\n"); |
105 | 105 | $resp = new PhpXmlRpc\Response(new PhpXmlRpc\Value('The meaning of life')); |
106 | -output("<PRE>" . htmlentities($resp->serialize()) . "</PRE>"); |
|
106 | +output("<PRE>".htmlentities($resp->serialize())."</PRE>"); |
|
107 | 107 | |
108 | 108 | output("<h3>Testing ISO date formatting</h3><pre>\n"); |
109 | 109 | $t = time(); |
110 | 110 | $date = PhpXmlRpc\Helper\Date::iso8601Encode($t); |
111 | 111 | output("Now is $t --> $date\n"); |
112 | -output("Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n"); |
|
112 | +output("Or in UTC, that is ".PhpXmlRpc\Helper\Date::iso8601Encode($t, 1)."\n"); |
|
113 | 113 | $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date); |
114 | 114 | output("That is to say $date --> $tb\n"); |
115 | -output("Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n"); |
|
116 | -output("Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1) . "\n"); |
|
115 | +output("Which comes out at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb)."\n"); |
|
116 | +output("Which was the time in UTC at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1)."\n"); |
|
117 | 117 | output("</pre>\n"); |
118 | 118 | |
119 | 119 | output("<h3>Testing reduced-precision formatting for doubles</h3><pre>\n"); |
120 | 120 | $v = new PhpXmlRpc\Value(1234.56789, 'double'); |
121 | 121 | \PhpXmlRpc\PhpXmlRpc::$xmlpc_double_precision = 2; |
122 | -output("Double, limited precision: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
122 | +output("Double, limited precision: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
123 | 123 | |
124 | 124 | output('</body></html>'); |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function plain_findstate($stateNo) |
28 | 28 | { |
29 | - if (isset(exampleMethods::$stateNames[$stateNo - 1])) { |
|
30 | - return exampleMethods::$stateNames[$stateNo - 1]; |
|
29 | + if (isset(exampleMethods::$stateNames[$stateNo-1])) { |
|
30 | + return exampleMethods::$stateNames[$stateNo-1]; |
|
31 | 31 | } else { |
32 | 32 | // not, there so complain |
33 | - throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
33 | + throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if ($req->getNumParams()) { |
70 | 70 | $p1 = $req->getParam(0); |
71 | 71 | if ($p1->kindOf() === 'scalar') { |
72 | - $errNum = (int)$p1->scalarval(); |
|
72 | + $errNum = (int) $p1->scalarval(); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | throw new Exception("it's just a test", $errNum); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | |
142 | 142 | $findstate10_sig = array( |
143 | 143 | /// @todo add a demo and test with closure usage |
144 | - "function" => function ($req) { return exampleMethods::findState($req); }, |
|
144 | + "function" => function($req) { return exampleMethods::findState($req); }, |
|
145 | 145 | "signature" => array(array(Value::$xmlrpcString, Value::$xmlrpcInt)), |
146 | - "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the ' . |
|
146 | + "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the '. |
|
147 | 147 | 'index of that state name in an alphabetic order.', |
148 | 148 | ); |
149 | 149 | |
150 | -$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return plain_findstate($stateNo); }); |
|
150 | +$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return plain_findstate($stateNo); }); |
|
151 | 151 | |
152 | 152 | /// @todo do we really need a new instance ? |
153 | 153 | $c = new handlersContainer(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $namespaceSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'namespacetest.', 'replace_class_name' => true, 'method_filter' => '/^findState$/', 'method_type' => 'static')); |
158 | 158 | |
159 | -$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
159 | +$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
160 | 160 | |
161 | 161 | return array_merge( |
162 | 162 | array( |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | -require_once __DIR__ . "/_prepend.php"; |
|
27 | +require_once __DIR__."/_prepend.php"; |
|
28 | 28 | |
29 | 29 | use PhpXmlRpc\PhpXmlRpc; |
30 | 30 | use PhpXmlRpc\Server; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } elseif ($_GET['FORCE_AUTH'] == 'Digest') { |
84 | 84 | if (empty($_SERVER['PHP_AUTH_DIGEST'])) { |
85 | 85 | header('HTTP/1.1 401 Unauthorized'); |
86 | - header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"'); |
|
86 | + header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"'); |
|
87 | 87 | die('Text visible if user hits Cancel button'); |
88 | 88 | } |
89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if (isset($_GET['FORCE_REDIRECT'])) { |
92 | 92 | header('HTTP/1.0 302 Found'); |
93 | 93 | unset($_GET['FORCE_REDIRECT']); |
94 | - header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : '')); |
|
94 | + header('Location: '.$_SERVER['REQUEST_URI'].(count($_GET) ? '?'.http_build_query($_GET) : '')); |
|
95 | 95 | die(); |
96 | 96 | } |
97 | 97 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | // Use the custom class autoloader. These two lines are not needed when the phpxmlrpc library is installed using Composer |
11 | -include_once __DIR__ . '/../../src/Autoloader.php'; |
|
11 | +include_once __DIR__.'/../../src/Autoloader.php'; |
|
12 | 12 | PhpXmlRpc\Autoloader::register(); |
13 | 13 | |
14 | 14 | // Let unit tests run against localhost, 'plain' demos against a known public server |
@@ -22,5 +22,5 @@ discard block |
||
22 | 22 | function output($text) |
23 | 23 | { |
24 | 24 | /// @todo we should only strip html tags, and let through all xml tags |
25 | - echo PHP_SAPI == 'cli' ? strip_tags(str_replace(array('<br/>','<br>'), "\n", $text)) : $text; |
|
25 | + echo PHP_SAPI == 'cli' ? strip_tags(str_replace(array('<br/>', '<br>'), "\n", $text)) : $text; |
|
26 | 26 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Demoing how to inject a custom logger for use by the library |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | // logger API |
23 | 23 | public function debug($message, $context = array()) |
24 | 24 | { |
25 | - $this->debugBuffer .= $message . "\n"; |
|
25 | + $this->debugBuffer .= $message."\n"; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | // logger API |
29 | 29 | public function error($message, $context = array()) |
30 | 30 | { |
31 | - $this->errorBuffer .= $message . "\n"; |
|
31 | + $this->errorBuffer .= $message."\n"; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function getDebug() |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | |
60 | 60 | $input = array( |
61 | 61 | array('name' => 'Dave', 'age' => 24), |
62 | - array('name' => 'Edd', 'age' => 45), |
|
63 | - array('name' => 'Joe', 'age' => 37), |
|
62 | + array('name' => 'Edd', 'age' => 45), |
|
63 | + array('name' => 'Joe', 'age' => 37), |
|
64 | 64 | array('name' => 'Fred', 'age' => 27), |
65 | 65 | ); |
66 | 66 | |
@@ -79,5 +79,5 @@ discard block |
||
79 | 79 | $response = $client->send($request); |
80 | 80 | output("Response received.<br>"); |
81 | 81 | |
82 | -output("The client error info is:<pre>\n" . $logger->getError() . "\n</pre>"); |
|
83 | -output("The client debug info is:<pre>\n" . $logger->getDebug() . "\n</pre>"); |
|
82 | +output("The client error info is:<pre>\n".$logger->getError()."\n</pre>"); |
|
83 | +output("The client debug info is:<pre>\n".$logger->getDebug()."\n</pre>"); |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | 'scalar' => $val, |
58 | 58 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
59 | 59 | ); |
60 | - return (object)$xmlrpcVal; |
|
60 | + return (object) $xmlrpcVal; |
|
61 | 61 | case 'base64': |
62 | 62 | $xmlrpcVal = array( |
63 | 63 | 'xmlrpc_type' => 'base64', |
64 | 64 | 'scalar' => $val |
65 | 65 | ); |
66 | - return (object)$xmlrpcVal; |
|
66 | + return (object) $xmlrpcVal; |
|
67 | 67 | case 'string': |
68 | 68 | if (isset($options['extension_api_encoding'])) { |
69 | 69 | // if iconv is not available, we use mb_convert_encoding |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | case 'msg': |
137 | 137 | $paramCount = $xmlrpcVal->getNumParams(); |
138 | 138 | $arr = array(); |
139 | - for ($i = 0; $i < $paramCount; $i++) { |
|
139 | + for ($i = 0; $i<$paramCount; $i++) { |
|
140 | 140 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
141 | 141 | } |
142 | 142 | return $arr; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | break; |
262 | 262 | case 'resource': |
263 | 263 | if (in_array('extension_api', $options)) { |
264 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
264 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
265 | 265 | } else { |
266 | 266 | $xmlrpcVal = new Value(); |
267 | 267 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ($valEncoding == 'ISO-8859-1') { |
311 | 311 | $xmlVal = utf8_encode($xmlVal); |
312 | 312 | } else { |
313 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
313 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $parserOptions |
333 | 333 | ); |
334 | 334 | |
335 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
335 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
336 | 336 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
337 | 337 | |
338 | 338 | $this->getLogger()->error($xmlRpcParser->_xh['isf_reason']); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | case 'methodcall': |
358 | 358 | $req = new Request($xmlRpcParser->_xh['method']); |
359 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
359 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
360 | 360 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
361 | 361 | } |
362 | 362 | return $req; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->me['struct'] = $val; |
94 | 94 | break; |
95 | 95 | default: |
96 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
96 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if ($typeOf !== 1) { |
120 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
120 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
121 | 121 | return 0; |
122 | 122 | } |
123 | 123 | |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | |
135 | 135 | switch ($this->mytype) { |
136 | 136 | case 1: |
137 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
137 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
138 | 138 | return 0; |
139 | 139 | case 3: |
140 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
140 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
141 | 141 | return 0; |
142 | 142 | case 2: |
143 | 143 | // we're adding a scalar value to an array here |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | return 1; |
181 | 181 | } else { |
182 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
182 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
183 | 183 | return 0; |
184 | 184 | } |
185 | 185 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | return 1; |
211 | 211 | } else { |
212 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
212 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
213 | 213 | return 0; |
214 | 214 | } |
215 | 215 | } |
@@ -251,19 +251,19 @@ discard block |
||
251 | 251 | case 1: |
252 | 252 | switch ($typ) { |
253 | 253 | case static::$xmlrpcBase64: |
254 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
254 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
255 | 255 | break; |
256 | 256 | case static::$xmlrpcBoolean: |
257 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
257 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
258 | 258 | break; |
259 | 259 | case static::$xmlrpcString: |
260 | 260 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
261 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
261 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
262 | 262 | break; |
263 | 263 | case static::$xmlrpcInt: |
264 | 264 | case static::$xmlrpcI4: |
265 | 265 | case static::$xmlrpcI8: |
266 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
266 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
267 | 267 | break; |
268 | 268 | case static::$xmlrpcDouble: |
269 | 269 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -271,16 +271,16 @@ discard block |
||
271 | 271 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
272 | 272 | // The code below tries its best at keeping max precision while avoiding exp notation, |
273 | 273 | // but there is of course no limit in the number of decimal places to be used... |
274 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
274 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
275 | 275 | break; |
276 | 276 | case static::$xmlrpcDateTime: |
277 | 277 | if (is_string($val)) { |
278 | 278 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
279 | 279 | // DateTimeInterface is not present in php 5.4... |
280 | 280 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
281 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
281 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
282 | 282 | } elseif (is_int($val)) { |
283 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
283 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
284 | 284 | } else { |
285 | 285 | // not really a good idea here: but what should we output anyway? left for backward compat... |
286 | 286 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | case 3: |
303 | 303 | // struct |
304 | 304 | if ($this->_php_class) { |
305 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
305 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
306 | 306 | } else { |
307 | 307 | $rs .= "<struct>\n"; |
308 | 308 | } |
309 | 309 | $charsetEncoder = $this->getCharsetEncoder(); |
310 | 310 | /** @var Value $val2 */ |
311 | 311 | foreach ($val as $key2 => $val2) { |
312 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
312 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
313 | 313 | //$rs.=$this->serializeval($val2); |
314 | 314 | $rs .= $val2->serialize($charsetEncoding); |
315 | 315 | $rs .= "</member>\n"; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $val = reset($this->me); |
345 | 345 | $typ = key($this->me); |
346 | 346 | |
347 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
347 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | $server = $parts['host']; |
294 | 294 | $path = isset($parts['path']) ? $parts['path'] : ''; |
295 | 295 | if (isset($parts['query'])) { |
296 | - $path .= '?' . $parts['query']; |
|
296 | + $path .= '?'.$parts['query']; |
|
297 | 297 | } |
298 | 298 | if (isset($parts['fragment'])) { |
299 | - $path .= '#' . $parts['fragment']; |
|
299 | + $path .= '#'.$parts['fragment']; |
|
300 | 300 | } |
301 | 301 | if (isset($parts['port'])) { |
302 | 302 | $port = $parts['port']; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | } |
313 | 313 | } |
314 | 314 | if ($path == '' || $path[0] != '/') { |
315 | - $this->path = '/' . $path; |
|
315 | + $this->path = '/'.$path; |
|
316 | 316 | } else { |
317 | 317 | $this->path = $path; |
318 | 318 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | //$this->accepted_charset_encodings = $ch->knownCharsets(); |
345 | 345 | |
346 | 346 | // initialize user_agent string |
347 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
347 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -638,12 +638,12 @@ discard block |
||
638 | 638 | */ |
639 | 639 | public function getUrl() |
640 | 640 | { |
641 | - $url = $this->method . '://' . $this->server; |
|
641 | + $url = $this->method.'://'.$this->server; |
|
642 | 642 | if (($this->port = 80 && in_array($this->method, array('http', 'http10', 'http11', 'h2c'))) && |
643 | 643 | ($this->port = 443 && in_array($this->method, array('https', 'h2')))) { |
644 | - return $url . $this->path; |
|
644 | + return $url.$this->path; |
|
645 | 645 | } else { |
646 | - return $url . ':' . $this->port . $this->path; |
|
646 | + return $url.':'.$this->port.$this->path; |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | */ |
785 | 785 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
786 | 786 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
787 | - $method='http') |
|
787 | + $method = 'http') |
|
788 | 788 | { |
789 | 789 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
790 | 790 | |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | * @param int $sslVersion |
818 | 818 | * @return Response |
819 | 819 | */ |
820 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
820 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
821 | 821 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
822 | 822 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
823 | 823 | $sslVersion = 0) |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | */ |
857 | 857 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
858 | 858 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
859 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
859 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
860 | 860 | $sslVersion = 0) |
861 | 861 | { |
862 | 862 | /// @todo log a warning if passed an unsupported method |
@@ -893,16 +893,16 @@ discard block |
||
893 | 893 | // thanks to Grant Rauscher <[email protected]> for this |
894 | 894 | $credentials = ''; |
895 | 895 | if ($username != '') { |
896 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
896 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
897 | 897 | if ($authType != 1) { |
898 | 898 | /// @todo make this a proper error, i.e. return a failure |
899 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
899 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
900 | 900 | } |
901 | 901 | } |
902 | 902 | |
903 | 903 | $acceptedEncoding = ''; |
904 | 904 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
905 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
905 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | $proxyCredentials = ''; |
@@ -914,13 +914,13 @@ discard block |
||
914 | 914 | $connectPort = $proxyPort; |
915 | 915 | $transport = 'tcp'; |
916 | 916 | /// @todo check: should we not use https in some cases? |
917 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
917 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
918 | 918 | if ($proxyUsername != '') { |
919 | 919 | if ($proxyAuthType != 1) { |
920 | 920 | /// @todo make this a proper error, i.e. return a failure |
921 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
921 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
922 | 922 | } |
923 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
923 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
924 | 924 | } |
925 | 925 | } else { |
926 | 926 | $connectServer = $server; |
@@ -935,45 +935,45 @@ discard block |
||
935 | 935 | $version = ''; |
936 | 936 | foreach ($this->cookies as $name => $cookie) { |
937 | 937 | if ($cookie['version']) { |
938 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
939 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
938 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
939 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
940 | 940 | if ($cookie['path']) { |
941 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
941 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
942 | 942 | } |
943 | 943 | if ($cookie['domain']) { |
944 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
944 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
945 | 945 | } |
946 | 946 | if ($cookie['port']) { |
947 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
947 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
948 | 948 | } |
949 | 949 | } else { |
950 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
950 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
951 | 951 | } |
952 | 952 | } |
953 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
953 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
954 | 954 | } |
955 | 955 | |
956 | 956 | // omit port if default |
957 | 957 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
958 | - $port = ''; |
|
958 | + $port = ''; |
|
959 | 959 | } else { |
960 | - $port = ':' . $port; |
|
960 | + $port = ':'.$port; |
|
961 | 961 | } |
962 | 962 | |
963 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
964 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
965 | - 'Host: ' . $server . $port . "\r\n" . |
|
966 | - $credentials . |
|
967 | - $proxyCredentials . |
|
968 | - $acceptedEncoding . |
|
969 | - $encodingHdr . |
|
970 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
971 | - $cookieHeader . |
|
972 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
973 | - strlen($payload) . "\r\n\r\n" . |
|
963 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
964 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
965 | + 'Host: '.$server.$port."\r\n". |
|
966 | + $credentials. |
|
967 | + $proxyCredentials. |
|
968 | + $acceptedEncoding. |
|
969 | + $encodingHdr. |
|
970 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
971 | + $cookieHeader. |
|
972 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
973 | + strlen($payload)."\r\n\r\n". |
|
974 | 974 | $payload; |
975 | 975 | |
976 | - if ($this->debug > 1) { |
|
976 | + if ($this->debug>1) { |
|
977 | 977 | $this->getLogger()->debug("---SENDING---\n$op\n---END---"); |
978 | 978 | } |
979 | 979 | |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | |
1001 | 1001 | $context = stream_context_create($contextOptions); |
1002 | 1002 | |
1003 | - if ($timeout <= 0) { |
|
1003 | + if ($timeout<=0) { |
|
1004 | 1004 | $connectTimeout = ini_get('default_socket_timeout'); |
1005 | 1005 | } else { |
1006 | 1006 | $connectTimeout = $timeout; |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
1013 | 1013 | STREAM_CLIENT_CONNECT, $context); |
1014 | 1014 | if ($fp) { |
1015 | - if ($timeout > 0) { |
|
1015 | + if ($timeout>0) { |
|
1016 | 1016 | stream_set_timeout($fp, $timeout, 0); |
1017 | 1017 | } |
1018 | 1018 | } else { |
@@ -1021,8 +1021,8 @@ discard block |
||
1021 | 1021 | $this->errstr = $err['message']; |
1022 | 1022 | } |
1023 | 1023 | |
1024 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
1025 | - $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
1024 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
1025 | + $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
1026 | 1026 | |
1027 | 1027 | return $r; |
1028 | 1028 | } |
@@ -1110,18 +1110,18 @@ discard block |
||
1110 | 1110 | $keyPass, $sslVersion); |
1111 | 1111 | |
1112 | 1112 | if (!$curl) { |
1113 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
1113 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | $result = curl_exec($curl); |
1117 | 1117 | |
1118 | - if ($this->debug > 1) { |
|
1118 | + if ($this->debug>1) { |
|
1119 | 1119 | $message = "---CURL INFO---\n"; |
1120 | 1120 | foreach (curl_getinfo($curl) as $name => $val) { |
1121 | 1121 | if (is_array($val)) { |
1122 | 1122 | $val = implode("\n", $val); |
1123 | 1123 | } |
1124 | - $message .= $name . ': ' . $val . "\n"; |
|
1124 | + $message .= $name.': '.$val."\n"; |
|
1125 | 1125 | } |
1126 | 1126 | $message .= '---END---'; |
1127 | 1127 | $this->getLogger()->debug($message); |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1132 | 1132 | |
1133 | 1133 | $this->errstr = 'no response'; |
1134 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1134 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1135 | 1135 | curl_close($curl); |
1136 | 1136 | if ($keepAlive) { |
1137 | 1137 | $this->xmlrpc_curl_handle = null; |
@@ -1201,12 +1201,12 @@ discard block |
||
1201 | 1201 | // http, https |
1202 | 1202 | $protocol = $method; |
1203 | 1203 | if (strpos($protocol, ':') !== false) { |
1204 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1204 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1205 | 1205 | return false; |
1206 | 1206 | } |
1207 | 1207 | } |
1208 | 1208 | } |
1209 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1209 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1210 | 1210 | if (!$curl) { |
1211 | 1211 | return false; |
1212 | 1212 | } |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | // results into variable |
1221 | 1221 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1222 | 1222 | |
1223 | - if ($this->debug > 1) { |
|
1223 | + if ($this->debug>1) { |
|
1224 | 1224 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1225 | 1225 | /// @todo redirect curlopt_stderr to some stream which can be piped to the logger |
1226 | 1226 | } |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | } |
1246 | 1246 | } |
1247 | 1247 | // extra headers |
1248 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1248 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1249 | 1249 | // if no keepalive is wanted, let the server know it in advance |
1250 | 1250 | if (!$keepAlive) { |
1251 | 1251 | $headers[] = 'Connection: close'; |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1263 | 1263 | // timeout is borked |
1264 | 1264 | if ($timeout) { |
1265 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1265 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | switch ($method) { |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1278 | 1278 | } else { |
1279 | 1279 | /// @todo make this a proper error, i.e. return a failure |
1280 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1280 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1281 | 1281 | } |
1282 | 1282 | break; |
1283 | 1283 | case 'h2': |
@@ -1286,12 +1286,12 @@ discard block |
||
1286 | 1286 | } |
1287 | 1287 | |
1288 | 1288 | if ($username && $password) { |
1289 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1289 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1290 | 1290 | if (defined('CURLOPT_HTTPAUTH')) { |
1291 | 1291 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1292 | 1292 | } elseif ($authType != 1) { |
1293 | 1293 | /// @todo make this a proper error, i.e. return a failure |
1294 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1294 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1295 | 1295 | } |
1296 | 1296 | } |
1297 | 1297 | |
@@ -1334,14 +1334,14 @@ discard block |
||
1334 | 1334 | if ($proxyPort == 0) { |
1335 | 1335 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1336 | 1336 | } |
1337 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1337 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1338 | 1338 | if ($proxyUsername) { |
1339 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1339 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1340 | 1340 | if (defined('CURLOPT_PROXYAUTH')) { |
1341 | 1341 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1342 | 1342 | } elseif ($proxyAuthType != 1) { |
1343 | 1343 | /// @todo make this a proper error, i.e. return a failure |
1344 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1344 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1345 | 1345 | } |
1346 | 1346 | } |
1347 | 1347 | } |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | if (count($this->cookies)) { |
1352 | 1352 | $cookieHeader = ''; |
1353 | 1353 | foreach ($this->cookies as $name => $cookie) { |
1354 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1354 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1355 | 1355 | } |
1356 | 1356 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1357 | 1357 | } |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | curl_setopt($curl, $opt, $val); |
1361 | 1361 | } |
1362 | 1362 | |
1363 | - if ($this->debug > 1) { |
|
1363 | + if ($this->debug>1) { |
|
1364 | 1364 | $this->getLogger()->debug("---SENDING---\n$payload\n---END---"); |
1365 | 1365 | } |
1366 | 1366 | |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | $call['methodName'] = new Value($req->method(), 'string'); |
1452 | 1452 | $numParams = $req->getNumParams(); |
1453 | 1453 | $params = array(); |
1454 | - for ($i = 0; $i < $numParams; $i++) { |
|
1454 | + for ($i = 0; $i<$numParams; $i++) { |
|
1455 | 1455 | $params[$i] = $req->getParam($i); |
1456 | 1456 | } |
1457 | 1457 | $call['params'] = new Value($params, 'array'); |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | $response = array(); |
1474 | 1474 | |
1475 | 1475 | if ($this->return_type == 'xml') { |
1476 | - for ($i = 0; $i < count($reqs); $i++) { |
|
1476 | + for ($i = 0; $i<count($reqs); $i++) { |
|
1477 | 1477 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
1478 | 1478 | } |
1479 | 1479 | |
@@ -1481,21 +1481,21 @@ discard block |
||
1481 | 1481 | if (!is_array($rets)) { |
1482 | 1482 | // bad return type from system.multicall |
1483 | 1483 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1484 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
1484 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
1485 | 1485 | } |
1486 | 1486 | $numRets = count($rets); |
1487 | 1487 | if ($numRets != count($reqs)) { |
1488 | 1488 | // wrong number of return values. |
1489 | 1489 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1490 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
1490 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
1491 | 1491 | $result->httpResponse()); |
1492 | 1492 | } |
1493 | 1493 | |
1494 | - for ($i = 0; $i < $numRets; $i++) { |
|
1494 | + for ($i = 0; $i<$numRets; $i++) { |
|
1495 | 1495 | $val = $rets[$i]; |
1496 | 1496 | if (!is_array($val)) { |
1497 | 1497 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1498 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1498 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1499 | 1499 | 'phpvals', $result->httpResponse()); |
1500 | 1500 | } |
1501 | 1501 | switch (count($val)) { |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | if (!isset($val[0])) { |
1504 | 1504 | // Bad value |
1505 | 1505 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1506 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
1506 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
1507 | 1507 | 'phpvals', $result->httpResponse()); |
1508 | 1508 | } |
1509 | 1509 | // Normal return value |
@@ -1515,20 +1515,20 @@ discard block |
||
1515 | 1515 | if (!is_int($code)) { |
1516 | 1516 | /// @todo should we check that it is != 0? |
1517 | 1517 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1518 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1518 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1519 | 1519 | 'phpvals', $result->httpResponse()); |
1520 | 1520 | } |
1521 | 1521 | $str = @$val['faultString']; |
1522 | 1522 | if (!is_string($str)) { |
1523 | 1523 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1524 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
1524 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
1525 | 1525 | 'phpvals', $result->httpResponse()); |
1526 | 1526 | } |
1527 | 1527 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
1528 | 1528 | break; |
1529 | 1529 | default: |
1530 | 1530 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1531 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1531 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1532 | 1532 | 'phpvals', $result->httpResponse()); |
1533 | 1533 | } |
1534 | 1534 | } |
@@ -1537,14 +1537,14 @@ discard block |
||
1537 | 1537 | // return type == 'xmlrpcvals' |
1538 | 1538 | if ($rets->kindOf() != 'array') { |
1539 | 1539 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1540 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
1540 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
1541 | 1541 | $result->httpResponse()); |
1542 | 1542 | } |
1543 | 1543 | $numRets = $rets->count(); |
1544 | 1544 | if ($numRets != count($reqs)) { |
1545 | 1545 | // wrong number of return values. |
1546 | 1546 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1547 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
1547 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
1548 | 1548 | $result->httpResponse()); |
1549 | 1549 | } |
1550 | 1550 | |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | case 'array': |
1554 | 1554 | if ($val->count() != 1) { |
1555 | 1555 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1556 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1556 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1557 | 1557 | 'phpvals', $result->httpResponse()); |
1558 | 1558 | } |
1559 | 1559 | // Normal return value |
@@ -1562,28 +1562,28 @@ discard block |
||
1562 | 1562 | case 'struct': |
1563 | 1563 | if ($val->count() != 2) { |
1564 | 1564 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1565 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1565 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1566 | 1566 | 'phpvals', $result->httpResponse()); |
1567 | 1567 | } |
1568 | 1568 | /** @var Value $code */ |
1569 | 1569 | $code = $val['faultCode']; |
1570 | 1570 | if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') { |
1571 | 1571 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1572 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1572 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1573 | 1573 | 'xmlrpcvals', $result->httpResponse()); |
1574 | 1574 | } |
1575 | 1575 | /** @var Value $str */ |
1576 | 1576 | $str = $val['faultString']; |
1577 | 1577 | if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') { |
1578 | 1578 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1579 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1579 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1580 | 1580 | 'xmlrpcvals', $result->httpResponse()); |
1581 | 1581 | } |
1582 | 1582 | $response[] = new Response(0, $code->scalarval(), $str->scalarval(), 'xmlrpcvals', $result->httpResponse()); |
1583 | 1583 | break; |
1584 | 1584 | default: |
1585 | 1585 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1586 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1586 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1587 | 1587 | 'xmlrpcvals', $result->httpResponse()); |
1588 | 1588 | } |
1589 | 1589 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public static function xmlrpc_debugmsg($msg) |
193 | 193 | { |
194 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
194 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function error_occurred($msg) |
205 | 205 | { |
206 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
206 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
225 | 225 | $out = ''; |
226 | 226 | if ($this->debug_info != '') { |
227 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
227 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
228 | 228 | } |
229 | 229 | if (static::$_xmlrpc_debuginfo != '') { |
230 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
230 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
231 | 231 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
232 | 232 | // into return payload AFTER the beginning tag |
233 | 233 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | $this->debug_info = ''; |
257 | 257 | |
258 | 258 | // Save what we received, before parsing it |
259 | - if ($this->debug > 1) { |
|
260 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
259 | + if ($this->debug>1) { |
|
260 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -274,14 +274,14 @@ discard block |
||
274 | 274 | $resp->raw_data = $rawData; |
275 | 275 | } |
276 | 276 | |
277 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
278 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
279 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
277 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
278 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
279 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | $payload = $this->xml_header($respCharset); |
283 | - if ($this->debug > 0) { |
|
284 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
283 | + if ($this->debug>0) { |
|
284 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | // Do not create response serialization if it has already happened. Helps to build json magic |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | if (empty($resp->payload)) { |
290 | 290 | $resp->serialize($respCharset); |
291 | 291 | } |
292 | - $payload = $payload . $resp->payload; |
|
292 | + $payload = $payload.$resp->payload; |
|
293 | 293 | |
294 | 294 | if ($returnPayload) { |
295 | 295 | return $payload; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // if we get a warning/error that has output some text before here, then we cannot |
299 | 299 | // add a new header. We cannot say we are sending xml, either... |
300 | 300 | if (!headers_sent()) { |
301 | - header('Content-Type: ' . $resp->content_type); |
|
301 | + header('Content-Type: '.$resp->content_type); |
|
302 | 302 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
303 | 303 | header("Vary: Accept-Charset"); |
304 | 304 | |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
322 | 322 | // responses up to 8000 bytes |
323 | 323 | if ($phpNoSelfCompress) { |
324 | - header('Content-Length: ' . (int)strlen($payload)); |
|
324 | + header('Content-Length: '.(int) strlen($payload)); |
|
325 | 325 | } |
326 | 326 | } else { |
327 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
327 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | print $payload; |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | $numParams = count($in); |
383 | 383 | } |
384 | 384 | foreach ($sigs as $curSig) { |
385 | - if (count($curSig) == $numParams + 1) { |
|
385 | + if (count($curSig) == $numParams+1) { |
|
386 | 386 | $itsOK = 1; |
387 | - for ($n = 0; $n < $numParams; $n++) { |
|
387 | + for ($n = 0; $n<$numParams; $n++) { |
|
388 | 388 | if (is_object($in)) { |
389 | 389 | $p = $in->getParam($n); |
390 | 390 | if ($p->kindOf() == 'scalar') { |
@@ -397,10 +397,10 @@ discard block |
||
397 | 397 | } |
398 | 398 | |
399 | 399 | // param index is $n+1, as first member of sig is return type |
400 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
400 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
401 | 401 | $itsOK = 0; |
402 | - $pno = $n + 1; |
|
403 | - $wanted = $curSig[$n + 1]; |
|
402 | + $pno = $n+1; |
|
403 | + $wanted = $curSig[$n+1]; |
|
404 | 404 | $got = $pt; |
405 | 405 | break; |
406 | 406 | } |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | // check if $_SERVER is populated: it might have been disabled via ini file |
428 | 428 | // (this is true even when in CLI mode) |
429 | 429 | if (count($_SERVER) == 0) { |
430 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
430 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
431 | 431 | } |
432 | 432 | |
433 | - if ($this->debug > 1) { |
|
433 | + if ($this->debug>1) { |
|
434 | 434 | if (function_exists('getallheaders')) { |
435 | 435 | $this->debugmsg(''); // empty line |
436 | 436 | foreach (getallheaders() as $name => $val) { |
@@ -455,13 +455,13 @@ discard block |
||
455 | 455 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
456 | 456 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
457 | 457 | $data = $degzdata; |
458 | - if ($this->debug > 1) { |
|
459 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
458 | + if ($this->debug>1) { |
|
459 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
460 | 460 | } |
461 | 461 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
462 | 462 | $data = $degzdata; |
463 | - if ($this->debug > 1) { |
|
464 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
463 | + if ($this->debug>1) { |
|
464 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
465 | 465 | } |
466 | 466 | } else { |
467 | 467 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | if ($reqEncoding == 'ISO-8859-1') { |
549 | 549 | $data = utf8_encode($data); |
550 | 550 | } else { |
551 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
551 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
576 | 576 | return new Response( |
577 | 577 | 0, |
578 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
578 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
579 | 579 | $xmlRpcParser->_xh['isf_reason']); |
580 | 580 | } elseif ($xmlRpcParser->_xh['isf']) { |
581 | 581 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | return new Response( |
584 | 584 | 0, |
585 | 585 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
586 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
586 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
587 | 587 | } else { |
588 | 588 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
589 | 589 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -593,20 +593,20 @@ discard block |
||
593 | 593 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
594 | 594 | ) |
595 | 595 | ) { |
596 | - if ($this->debug > 1) { |
|
597 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
596 | + if ($this->debug>1) { |
|
597 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
601 | 601 | } else { |
602 | 602 | // build a Request object with data parsed from xml and add parameters in |
603 | 603 | $req = new Request($xmlRpcParser->_xh['method']); |
604 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
604 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
605 | 605 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
606 | 606 | } |
607 | 607 | |
608 | - if ($this->debug > 1) { |
|
609 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
608 | + if ($this->debug>1) { |
|
609 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | return $this->execute($req); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | return new Response( |
659 | 659 | 0, |
660 | 660 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
661 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
661 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
662 | 662 | ); |
663 | 663 | } |
664 | 664 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | // build string representation of function 'name' |
674 | 674 | if (is_array($func)) { |
675 | 675 | if (is_object($func[0])) { |
676 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
676 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
677 | 677 | } else { |
678 | 678 | $funcName = implode('::', $func); |
679 | 679 | } |
@@ -685,17 +685,17 @@ discard block |
||
685 | 685 | |
686 | 686 | // verify that function to be invoked is in fact callable |
687 | 687 | if (!is_callable($func)) { |
688 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
688 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
689 | 689 | return new Response( |
690 | 690 | 0, |
691 | 691 | PhpXmlRpc::$xmlrpcerr['server_error'], |
692 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
692 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
693 | 693 | ); |
694 | 694 | } |
695 | 695 | |
696 | 696 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
697 | 697 | // as part of response |
698 | - if ($this->debug > 2) { |
|
698 | + if ($this->debug>2) { |
|
699 | 699 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
700 | 700 | } |
701 | 701 | |
@@ -709,14 +709,14 @@ discard block |
||
709 | 709 | $r = call_user_func($func, $req); |
710 | 710 | } |
711 | 711 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
712 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
712 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
713 | 713 | if (is_a($r, 'PhpXmlRpc\Value')) { |
714 | 714 | $r = new Response($r); |
715 | 715 | } else { |
716 | 716 | $r = new Response( |
717 | 717 | 0, |
718 | 718 | PhpXmlRpc::$xmlrpcerr['server_error'], |
719 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
719 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
720 | 720 | ); |
721 | 721 | } |
722 | 722 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
732 | 732 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
733 | 733 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
734 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
734 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
735 | 735 | } else { |
736 | 736 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
737 | 737 | // return type correctly |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | // proper error-response |
756 | 756 | switch ($this->exception_handling) { |
757 | 757 | case 2: |
758 | - if ($this->debug > 2) { |
|
758 | + if ($this->debug>2) { |
|
759 | 759 | if (self::$_xmlrpcs_prev_ehandler) { |
760 | 760 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
761 | 761 | } else { |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | // proper error-response |
779 | 779 | switch ($this->exception_handling) { |
780 | 780 | case 2: |
781 | - if ($this->debug > 2) { |
|
781 | + if ($this->debug>2) { |
|
782 | 782 | if (self::$_xmlrpcs_prev_ehandler) { |
783 | 783 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
784 | 784 | } else { |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | } |
799 | 799 | } |
800 | 800 | |
801 | - if ($this->debug > 2) { |
|
801 | + if ($this->debug>2) { |
|
802 | 802 | // note: restore the error handler we found before calling the user func, even if it has been changed |
803 | 803 | // inside the func itself |
804 | 804 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | */ |
865 | 865 | protected function debugmsg($string) |
866 | 866 | { |
867 | - $this->debug_info .= $string . "\n"; |
|
867 | + $this->debug_info .= $string."\n"; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -874,9 +874,9 @@ discard block |
||
874 | 874 | protected function xml_header($charsetEncoding = '') |
875 | 875 | { |
876 | 876 | if ($charsetEncoding != '') { |
877 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
877 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
878 | 878 | } else { |
879 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
879 | + return "<?xml version=\"1.0\"?".">\n"; |
|
880 | 880 | } |
881 | 881 | } |
882 | 882 | |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | $i++; // for error message, we count params from 1 |
1170 | 1170 | return static::_xmlrpcs_multicall_error(new Response(0, |
1171 | 1171 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1172 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1172 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1173 | 1173 | } |
1174 | 1174 | } |
1175 | 1175 | |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | } |
1251 | 1251 | } else { |
1252 | 1252 | $numCalls = count($req); |
1253 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1253 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1254 | 1254 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1255 | 1255 | } |
1256 | 1256 | } |