@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->me['struct'] = $val; |
84 | 84 | break; |
85 | 85 | default: |
86 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
86 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | if ($typeOf !== 1) { |
111 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
111 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
112 | 112 | return 0; |
113 | 113 | } |
114 | 114 | |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | |
126 | 126 | switch ($this->mytype) { |
127 | 127 | case 1: |
128 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
128 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
129 | 129 | return 0; |
130 | 130 | case 3: |
131 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
131 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
132 | 132 | return 0; |
133 | 133 | case 2: |
134 | 134 | // we're adding a scalar value to an array here |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | return 1; |
172 | 172 | } else { |
173 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
173 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
174 | 174 | return 0; |
175 | 175 | } |
176 | 176 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | return 1; |
203 | 203 | } else { |
204 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
204 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
205 | 205 | return 0; |
206 | 206 | } |
207 | 207 | } |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | case 1: |
241 | 241 | switch ($typ) { |
242 | 242 | case static::$xmlrpcBase64: |
243 | - $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>"; |
|
243 | + $rs .= "<${typ}>".base64_encode($val)."</${typ}>"; |
|
244 | 244 | break; |
245 | 245 | case static::$xmlrpcBoolean: |
246 | - $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>"; |
|
246 | + $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>"; |
|
247 | 247 | break; |
248 | 248 | case static::$xmlrpcString: |
249 | 249 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
250 | - $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>"; |
|
250 | + $rs .= "<${typ}>".Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>"; |
|
251 | 251 | break; |
252 | 252 | case static::$xmlrpcInt: |
253 | 253 | case static::$xmlrpcI4: |
254 | 254 | case static::$xmlrpcI8: |
255 | - $rs .= "<${typ}>" . (int)$val . "</${typ}>"; |
|
255 | + $rs .= "<${typ}>".(int) $val."</${typ}>"; |
|
256 | 256 | break; |
257 | 257 | case static::$xmlrpcDouble: |
258 | 258 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | // sprintf('%F') could be most likely ok but it fails eg. on 2e-14. |
261 | 261 | // The code below tries its best at keeping max precision while avoiding exp notation, |
262 | 262 | // but there is of course no limit in the number of decimal places to be used... |
263 | - $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, 128, '.', '')) . "</${typ}>"; |
|
263 | + $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, 128, '.', ''))."</${typ}>"; |
|
264 | 264 | break; |
265 | 265 | case static::$xmlrpcDateTime: |
266 | 266 | if (is_string($val)) { |
267 | 267 | $rs .= "<${typ}>${val}</${typ}>"; |
268 | 268 | } elseif (is_a($val, 'DateTime')) { |
269 | - $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>"; |
|
269 | + $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>"; |
|
270 | 270 | } elseif (is_int($val)) { |
271 | - $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>"; |
|
271 | + $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>"; |
|
272 | 272 | } else { |
273 | 273 | // not really a good idea here: but what shall we output anyway? left for backward compat... |
274 | 274 | $rs .= "<${typ}>${val}</${typ}>"; |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | case 3: |
291 | 291 | // struct |
292 | 292 | if ($this->_php_class) { |
293 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
293 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
294 | 294 | } else { |
295 | 295 | $rs .= "<struct>\n"; |
296 | 296 | } |
297 | 297 | $charsetEncoder = Charset::instance(); |
298 | 298 | /** @var Value $val2 */ |
299 | 299 | foreach ($val as $key2 => $val2) { |
300 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
300 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
301 | 301 | //$rs.=$this->serializeval($val2); |
302 | 302 | $rs .= $val2->serialize($charsetEncoding); |
303 | 303 | $rs .= "</member>\n"; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $val = reset($this->me); |
334 | 334 | $typ = key($this->me); |
335 | 335 | |
336 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
336 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return $xmlrpcVal->scalarval(); |
75 | 75 | case 'array': |
76 | 76 | $arr = array(); |
77 | - foreach($xmlrpcVal as $value) { |
|
77 | + foreach ($xmlrpcVal as $value) { |
|
78 | 78 | $arr[] = $this->decode($value, $options); |
79 | 79 | } |
80 | 80 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | case 'msg': |
105 | 105 | $paramCount = $xmlrpcVal->getNumParams(); |
106 | 106 | $arr = array(); |
107 | - for ($i = 0; $i < $paramCount; $i++) { |
|
107 | + for ($i = 0; $i<$paramCount; $i++) { |
|
108 | 108 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
109 | 109 | } |
110 | 110 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct); |
180 | 180 | } else { |
181 | 181 | $arr = array(); |
182 | - foreach($phpVal as $k => $v) { |
|
182 | + foreach ($phpVal as $k => $v) { |
|
183 | 183 | $arr[$k] = $this->encode($v, $options); |
184 | 184 | } |
185 | 185 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | break; |
202 | 202 | case 'resource': |
203 | 203 | if (in_array('extension_api', $options)) { |
204 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
204 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
205 | 205 | } else { |
206 | 206 | $xmlrpcVal = new Value(); |
207 | 207 | } |
@@ -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 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
249 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $xmlRpcParser = new XMLParser($options); |
263 | 263 | $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE); |
264 | 264 | |
265 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
265 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
266 | 266 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
267 | 267 | |
268 | 268 | Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | return $r; |
287 | 287 | case 'methodcall': |
288 | 288 | $req = new Request($xmlRpcParser->_xh['method']); |
289 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
289 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
290 | 290 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
291 | 291 | } |
292 | 292 |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public static function xmlrpc_debugmsg($msg) |
154 | 154 | { |
155 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
155 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public static function error_occurred($msg) |
162 | 162 | { |
163 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
163 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
180 | 180 | $out = ''; |
181 | 181 | if ($this->debug_info != '') { |
182 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
182 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
183 | 183 | } |
184 | 184 | if (static::$_xmlrpc_debuginfo != '') { |
185 | - $out .= "<!-- DEBUG INFO:\n" . Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
185 | + $out .= "<!-- DEBUG INFO:\n".Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
186 | 186 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
187 | 187 | // into return payload AFTER the beginning tag |
188 | 188 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | $this->debug_info = ''; |
213 | 213 | |
214 | 214 | // Save what we received, before parsing it |
215 | - if ($this->debug > 1) { |
|
216 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
215 | + if ($this->debug>1) { |
|
216 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -225,21 +225,21 @@ discard block |
||
225 | 225 | // save full body of request into response, for more debugging usages |
226 | 226 | $r->raw_data = $rawData; |
227 | 227 | |
228 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
229 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
230 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
228 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
229 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
230 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $payload = $this->xml_header($respCharset); |
234 | - if ($this->debug > 0) { |
|
235 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
234 | + if ($this->debug>0) { |
|
235 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // Do not create response serialization if it has already happened. Helps building json magic |
239 | 239 | if (empty($r->payload)) { |
240 | 240 | $r->serialize($respCharset); |
241 | 241 | } |
242 | - $payload = $payload . $r->payload; |
|
242 | + $payload = $payload.$r->payload; |
|
243 | 243 | |
244 | 244 | if ($returnPayload) { |
245 | 245 | return $payload; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | // if we get a warning/error that has output some text before here, then we cannot |
249 | 249 | // add a new header. We cannot say we are sending xml, either... |
250 | 250 | if (!headers_sent()) { |
251 | - header('Content-Type: ' . $r->content_type); |
|
251 | + header('Content-Type: '.$r->content_type); |
|
252 | 252 | // we do not know if client actually told us an accepted charset, but if he did |
253 | 253 | // we have to tell him what we did |
254 | 254 | header("Vary: Accept-Charset"); |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
277 | 277 | // responses up to 8000 bytes |
278 | 278 | if ($phpNoSelfCompress) { |
279 | - header('Content-Length: ' . (int)strlen($payload)); |
|
279 | + header('Content-Length: '.(int) strlen($payload)); |
|
280 | 280 | } |
281 | 281 | } else { |
282 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
282 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | print $payload; |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | $numParams = count($in); |
329 | 329 | } |
330 | 330 | foreach ($sigs as $curSig) { |
331 | - if (count($curSig) == $numParams + 1) { |
|
331 | + if (count($curSig) == $numParams+1) { |
|
332 | 332 | $itsOK = 1; |
333 | - for ($n = 0; $n < $numParams; $n++) { |
|
333 | + for ($n = 0; $n<$numParams; $n++) { |
|
334 | 334 | if (is_object($in)) { |
335 | 335 | $p = $in->getParam($n); |
336 | 336 | if ($p->kindOf() == 'scalar') { |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | } |
344 | 344 | |
345 | 345 | // param index is $n+1, as first member of sig is return type |
346 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
346 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
347 | 347 | $itsOK = 0; |
348 | - $pno = $n + 1; |
|
349 | - $wanted = $curSig[$n + 1]; |
|
348 | + $pno = $n+1; |
|
349 | + $wanted = $curSig[$n+1]; |
|
350 | 350 | $got = $pt; |
351 | 351 | break; |
352 | 352 | } |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | // check if $_SERVER is populated: it might have been disabled via ini file |
374 | 374 | // (this is true even when in CLI mode) |
375 | 375 | if (count($_SERVER) == 0) { |
376 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
376 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
377 | 377 | } |
378 | 378 | |
379 | - if ($this->debug > 1) { |
|
379 | + if ($this->debug>1) { |
|
380 | 380 | if (function_exists('getallheaders')) { |
381 | 381 | $this->debugmsg(''); // empty line |
382 | 382 | foreach (getallheaders() as $name => $val) { |
@@ -398,13 +398,13 @@ discard block |
||
398 | 398 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
399 | 399 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
400 | 400 | $data = $degzdata; |
401 | - if ($this->debug > 1) { |
|
402 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
401 | + if ($this->debug>1) { |
|
402 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
403 | 403 | } |
404 | 404 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
405 | 405 | $data = $degzdata; |
406 | - if ($this->debug > 1) { |
|
407 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
406 | + if ($this->debug>1) { |
|
407 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
408 | 408 | } |
409 | 409 | } else { |
410 | 410 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | if (extension_loaded('mbstring')) { |
492 | 492 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
493 | 493 | } else { |
494 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
494 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | } |
@@ -509,16 +509,16 @@ discard block |
||
509 | 509 | |
510 | 510 | $xmlRpcParser = new XMLParser($options); |
511 | 511 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST); |
512 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
512 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
513 | 513 | // (BC) we return XML error as a faultCode |
514 | 514 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
515 | 515 | $r = new Response(0, |
516 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
516 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
517 | 517 | $xmlRpcParser->_xh['isf_reason']); |
518 | 518 | } elseif ($xmlRpcParser->_xh['isf']) { |
519 | 519 | $r = new Response(0, |
520 | 520 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
521 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
521 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
522 | 522 | } else { |
523 | 523 | // small layering violation in favor of speed and memory usage: |
524 | 524 | // we should allow the 'execute' method handle this, but in the |
@@ -529,20 +529,20 @@ discard block |
||
529 | 529 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] == 'phpvals') |
530 | 530 | ) |
531 | 531 | ) { |
532 | - if ($this->debug > 1) { |
|
533 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
532 | + if ($this->debug>1) { |
|
533 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
534 | 534 | } |
535 | 535 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
536 | 536 | } else { |
537 | 537 | // build a Request object with data parsed from xml |
538 | 538 | $req = new Request($xmlRpcParser->_xh['method']); |
539 | 539 | // now add parameters in |
540 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
540 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
541 | 541 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
542 | 542 | } |
543 | 543 | |
544 | - if ($this->debug > 1) { |
|
545 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
544 | + if ($this->debug>1) { |
|
545 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
546 | 546 | } |
547 | 547 | $r = $this->execute($req); |
548 | 548 | } |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | return new Response( |
596 | 596 | 0, |
597 | 597 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
598 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
598 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
599 | 599 | ); |
600 | 600 | } |
601 | 601 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | |
609 | 609 | if (is_array($func)) { |
610 | 610 | if (is_object($func[0])) { |
611 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
611 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
612 | 612 | } else { |
613 | 613 | $funcName = implode('::', $func); |
614 | 614 | } |
@@ -620,17 +620,17 @@ discard block |
||
620 | 620 | |
621 | 621 | // verify that function to be invoked is in fact callable |
622 | 622 | if (!is_callable($func)) { |
623 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
623 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
624 | 624 | return new Response( |
625 | 625 | 0, |
626 | 626 | PhpXmlRpc::$xmlrpcerr['server_error'], |
627 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
627 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
628 | 628 | ); |
629 | 629 | } |
630 | 630 | |
631 | 631 | // If debug level is 3, we should catch all errors generated during |
632 | 632 | // processing of user function, and log them as part of response |
633 | - if ($this->debug > 2) { |
|
633 | + if ($this->debug>2) { |
|
634 | 634 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
635 | 635 | } |
636 | 636 | |
@@ -643,14 +643,14 @@ discard block |
||
643 | 643 | $r = call_user_func($func, $req); |
644 | 644 | } |
645 | 645 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
646 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
646 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
647 | 647 | if (is_a($r, 'PhpXmlRpc\Value')) { |
648 | 648 | $r = new Response($r); |
649 | 649 | } else { |
650 | 650 | $r = new Response( |
651 | 651 | 0, |
652 | 652 | PhpXmlRpc::$xmlrpcerr['server_error'], |
653 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
653 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
654 | 654 | ); |
655 | 655 | } |
656 | 656 | } |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
667 | 667 | // an eror response |
668 | 668 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
669 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
669 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
670 | 670 | } else { |
671 | 671 | // functions using EPI api should NOT return resp objects, |
672 | 672 | // so make sure we encode the return type correctly |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | // in the called function, we wrap it in a proper error-response |
691 | 691 | switch ($this->exception_handling) { |
692 | 692 | case 2: |
693 | - if ($this->debug > 2) { |
|
693 | + if ($this->debug>2) { |
|
694 | 694 | if (self::$_xmlrpcs_prev_ehandler) { |
695 | 695 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
696 | 696 | } else { |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
707 | 707 | } |
708 | 708 | } |
709 | - if ($this->debug > 2) { |
|
709 | + if ($this->debug>2) { |
|
710 | 710 | // note: restore the error handler we found before calling the |
711 | 711 | // user func, even if it has been changed inside the func itself |
712 | 712 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | */ |
727 | 727 | protected function debugmsg($string) |
728 | 728 | { |
729 | - $this->debug_info .= $string . "\n"; |
|
729 | + $this->debug_info .= $string."\n"; |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | /** |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | protected function xml_header($charsetEncoding = '') |
737 | 737 | { |
738 | 738 | if ($charsetEncoding != '') { |
739 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
739 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
740 | 740 | } else { |
741 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
741 | + return "<?xml version=\"1.0\"?".">\n"; |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | |
@@ -971,12 +971,12 @@ discard block |
||
971 | 971 | } |
972 | 972 | |
973 | 973 | $req = new Request($methName->scalarval()); |
974 | - foreach($params as $i => $param) { |
|
974 | + foreach ($params as $i => $param) { |
|
975 | 975 | if (!$req->addParam($param)) { |
976 | 976 | $i++; // for error message, we count params from 1 |
977 | 977 | return static::_xmlrpcs_multicall_error(new Response(0, |
978 | 978 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
979 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
979 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
@@ -1043,12 +1043,12 @@ discard block |
||
1043 | 1043 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
1044 | 1044 | if (is_object($req)) { |
1045 | 1045 | $calls = $req->getParam(0); |
1046 | - foreach($calls as $call) { |
|
1046 | + foreach ($calls as $call) { |
|
1047 | 1047 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
1048 | 1048 | } |
1049 | 1049 | } else { |
1050 | 1050 | $numCalls = count($req); |
1051 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1051 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1052 | 1052 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1053 | 1053 | } |
1054 | 1054 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | use PhpXmlRpc\Helper\Charset; |
7 | 7 | |
8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Test conversion between encodings |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | { |
29 | 29 | // construct a latin string with all chars (except control ones) |
30 | 30 | $this->latinString = "\n\r\t"; |
31 | - for($i = 32; $i < 127; $i++) { |
|
31 | + for ($i = 32; $i<127; $i++) { |
|
32 | 32 | $this->latinString .= chr($i); |
33 | 33 | } |
34 | - for($i = 160; $i < 256; $i++) { |
|
34 | + for ($i = 160; $i<256; $i++) { |
|
35 | 35 | $this->latinString .= chr($i); |
36 | 36 | } |
37 | 37 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | } |
8 | 8 | |
9 | 9 | if (class_exists(PHPUnit_Version::class) === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) { |
10 | - include_once __DIR__ . '/PolyfillTestCase7.php'; |
|
10 | + include_once __DIR__.'/PolyfillTestCase7.php'; |
|
11 | 11 | } else { |
12 | - include_once __DIR__ . '/PolyfillTestCase8.php'; |
|
12 | + include_once __DIR__.'/PolyfillTestCase8.php'; |
|
13 | 13 | } |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * NB: do not let your IDE fool you. The correct encoding for this file is NOT UTF8. |
4 | 4 | */ |
5 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
6 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
5 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
6 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/parse_args.php'; |
|
8 | +include_once __DIR__.'/parse_args.php'; |
|
9 | 9 | |
10 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
10 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Tests involving parsing of xml and handling of xmlrpc values |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function testUnicodeInMemberName() |
65 | 65 | { |
66 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
66 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
67 | 67 | $v = array($str => new xmlrpcval(1)); |
68 | 68 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
69 | 69 | $r = $r->serialize(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | '<?xml version="1.0"?> |
80 | 80 | <!-- $Id --> |
81 | 81 | <!-- found by G. Giunta, covers what happens when lib receives UTF8 chars in response text and comments --> |
82 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
82 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
83 | 83 | <methodResponse> |
84 | 84 | <fault> |
85 | 85 | <value> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | </member> |
91 | 91 | <member> |
92 | 92 | <name>faultString</name> |
93 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
93 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
94 | 94 | </member> |
95 | 95 | </struct> |
96 | 96 | </value> |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $m = $this->newMsg('dummy'); |
100 | 100 | $r = $m->parseResponse($response); |
101 | 101 | $v = $r->faultString(); |
102 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
102 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | public function testValidNumbers() |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | public function testI8() |
162 | 162 | { |
163 | - if (PHP_INT_SIZE == 4 ) { |
|
163 | + if (PHP_INT_SIZE == 4) { |
|
164 | 164 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
165 | 165 | return; |
166 | 166 | } |
@@ -483,11 +483,11 @@ discard block |
||
483 | 483 | |
484 | 484 | public function testUTF8Response() |
485 | 485 | { |
486 | - $string = chr(224) . chr(252) . chr(232); |
|
486 | + $string = chr(224).chr(252).chr(232); |
|
487 | 487 | |
488 | 488 | $s = $this->newMsg('dummy'); |
489 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
490 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
489 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
490 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
491 | 491 | '; |
492 | 492 | $r = $s->parseResponse($f, false, 'phpvals'); |
493 | 493 | $v = $r->value(); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | $this->assertEquals($string, $v); |
496 | 496 | |
497 | 497 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
498 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
498 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
499 | 499 | '; |
500 | 500 | $r = $s->parseResponse($f, false, 'phpvals'); |
501 | 501 | $v = $r->value(); |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | |
511 | 511 | public function testLatin1Response() |
512 | 512 | { |
513 | - $string = chr(224) . chr(252) . chr(232); |
|
513 | + $string = chr(224).chr(252).chr(232); |
|
514 | 514 | |
515 | 515 | $s = $this->newMsg('dummy'); |
516 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
517 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
516 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
517 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
518 | 518 | '; |
519 | 519 | $r = $s->parseResponse($f, false, 'phpvals'); |
520 | 520 | $v = $r->value(); |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | $this->assertEquals($string, $v); |
523 | 523 | |
524 | 524 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
525 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
525 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
526 | 526 | '; |
527 | 527 | $r = $s->parseResponse($f, false, 'phpvals'); |
528 | 528 | $v = $r->value(); |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $this->assertequals(1, count($v1)); |
618 | 618 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
619 | 619 | |
620 | - foreach($v1 as $key => $val) |
|
620 | + foreach ($v1 as $key => $val) |
|
621 | 621 | { |
622 | 622 | $this->assertArrayHasKey($key, $out); |
623 | 623 | $expected = $out[$key]; |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | $this->assertequals(2, count($v2)); |
633 | 633 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
634 | 634 | $i = 0; |
635 | - foreach($v2 as $key => $val) |
|
635 | + foreach ($v2 as $key => $val) |
|
636 | 636 | { |
637 | 637 | $expected = $out[$i]; |
638 | 638 | $this->assertequals($expected['key'], $key); |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | { |
646 | 646 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
647 | 647 | $data = array(); |
648 | - for ($i = 0; $i < 500000; $i++ ) { |
|
648 | + for ($i = 0; $i<500000; $i++) { |
|
649 | 649 | $data[] = 'hello world'; |
650 | 650 | } |
651 | 651 |
@@ -159,20 +159,20 @@ discard block |
||
159 | 159 | $callable = explode('::', $callable); |
160 | 160 | } |
161 | 161 | if (is_array($callable)) { |
162 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
163 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
162 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
163 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | if (is_string($callable[0])) { |
167 | 167 | $plainFuncName = implode('::', $callable); |
168 | 168 | } elseif (is_object($callable[0])) { |
169 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
169 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
170 | 170 | } |
171 | 171 | $exists = method_exists($callable[0], $callable[1]); |
172 | 172 | } else if ($callable instanceof \Closure) { |
173 | 173 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
174 | 174 | if (!$buildIt) { |
175 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
175 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | if (!$exists) { |
187 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
187 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
@@ -228,23 +228,23 @@ discard block |
||
228 | 228 | if (is_array($callable)) { |
229 | 229 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
230 | 230 | if ($func->isPrivate()) { |
231 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
231 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
232 | 232 | return false; |
233 | 233 | } |
234 | 234 | if ($func->isProtected()) { |
235 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
235 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | if ($func->isConstructor()) { |
239 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
239 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | if ($func->isDestructor()) { |
243 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
243 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | if ($func->isAbstract()) { |
247 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
247 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
248 | 248 | return false; |
249 | 249 | } |
250 | 250 | /// @todo add more checks for static vs. nonstatic? |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | if ($func->isInternal()) { |
255 | 255 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
256 | 256 | // instead of getparameters to fully reflect internal php functions ? |
257 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
257 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $i = 0; |
307 | 307 | foreach ($func->getParameters() as $paramObj) { |
308 | 308 | $params[$i] = array(); |
309 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
309 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
310 | 310 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
311 | 311 | $i++; |
312 | 312 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | // build a signature |
372 | 372 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
373 | 373 | $pSig = array($funcDesc['returnsDocs']); |
374 | - for ($i = 0; $i < count($pars); $i++) { |
|
374 | + for ($i = 0; $i<count($pars); $i++) { |
|
375 | 375 | $name = strtolower($funcDesc['params'][$i]['name']); |
376 | 376 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
377 | 377 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | } |
428 | 428 | $numPars = $req->getNumParams(); |
429 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
429 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
430 | 430 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
431 | 431 | } |
432 | 432 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | $result = call_user_func_array($callable, $params); |
441 | 441 | |
442 | - if (! is_a($result, $responseClass)) { |
|
442 | + if (!is_a($result, $responseClass)) { |
|
443 | 443 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
444 | 444 | $result = new $valueClass($result, $funcDesc['returns']); |
445 | 445 | } else { |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | if ($newFuncName == '') { |
475 | 475 | if (is_array($callable)) { |
476 | 476 | if (is_string($callable[0])) { |
477 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
477 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
478 | 478 | } else { |
479 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
479 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
480 | 480 | } |
481 | 481 | } else { |
482 | 482 | if ($callable instanceof \Closure) { |
@@ -512,8 +512,8 @@ discard block |
||
512 | 512 | { |
513 | 513 | $namespace = '\\PhpXmlRpc\\'; |
514 | 514 | |
515 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
516 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
515 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
516 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
517 | 517 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
518 | 518 | |
519 | 519 | $i = 0; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | // build body of new function |
549 | 549 | |
550 | 550 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
551 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
551 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
552 | 552 | |
553 | 553 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
554 | 554 | if ($decodePhpObjects) { |
@@ -562,13 +562,13 @@ discard block |
||
562 | 562 | if (is_array($callable) && is_object($callable[0])) { |
563 | 563 | self::$objHolder[$newFuncName] = $callable[0]; |
564 | 564 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
565 | - $realFuncName = '$obj->' . $callable[1]; |
|
565 | + $realFuncName = '$obj->'.$callable[1]; |
|
566 | 566 | } else { |
567 | 567 | $realFuncName = $plainFuncName; |
568 | 568 | } |
569 | 569 | foreach ($parsVariations as $i => $pars) { |
570 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
571 | - if ($i < (count($parsVariations) - 1)) |
|
570 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
571 | + if ($i<(count($parsVariations)-1)) |
|
572 | 572 | $innerCode .= "else\n"; |
573 | 573 | } |
574 | 574 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | // if($func->returnsReference()) |
586 | 586 | // return false; |
587 | 587 | |
588 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
588 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
589 | 589 | |
590 | 590 | return $code; |
591 | 591 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | if ($methodWrap) { |
623 | 623 | if (is_object($className)) { |
624 | 624 | $realClassName = get_class($className); |
625 | - }else { |
|
625 | + } else { |
|
626 | 626 | $realClassName = $className; |
627 | 627 | } |
628 | 628 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -723,21 +723,21 @@ discard block |
||
723 | 723 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
724 | 724 | { |
725 | 725 | $namespace = '\\PhpXmlRpc\\'; |
726 | - $reqClass = $namespace . 'Request'; |
|
727 | - $valClass = $namespace . 'Value'; |
|
728 | - $decoderClass = $namespace . 'Encoder'; |
|
726 | + $reqClass = $namespace.'Request'; |
|
727 | + $valClass = $namespace.'Value'; |
|
728 | + $decoderClass = $namespace.'Encoder'; |
|
729 | 729 | |
730 | 730 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
731 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
731 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
732 | 732 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
733 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
733 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
734 | 734 | |
735 | 735 | $req = new $reqClass('system.methodSignature'); |
736 | 736 | $req->addparam(new $valClass($methodName)); |
737 | 737 | $client->setDebug($debug); |
738 | 738 | $response = $client->send($req, $timeout, $protocol); |
739 | 739 | if ($response->faultCode()) { |
740 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
740 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
741 | 741 | return false; |
742 | 742 | } |
743 | 743 | |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | $mSig = $decoder->decode($mSig); |
748 | 748 | } |
749 | 749 | |
750 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
751 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
750 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
751 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
752 | 752 | return false; |
753 | 753 | } |
754 | 754 | |
@@ -764,11 +764,11 @@ discard block |
||
764 | 764 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
765 | 765 | { |
766 | 766 | $namespace = '\\PhpXmlRpc\\'; |
767 | - $reqClass = $namespace . 'Request'; |
|
768 | - $valClass = $namespace . 'Value'; |
|
767 | + $reqClass = $namespace.'Request'; |
|
768 | + $valClass = $namespace.'Value'; |
|
769 | 769 | |
770 | 770 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
771 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
771 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
772 | 772 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
773 | 773 | |
774 | 774 | $mDesc = ''; |
@@ -802,10 +802,10 @@ discard block |
||
802 | 802 | $clientClone = clone $client; |
803 | 803 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
804 | 804 | { |
805 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
805 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
806 | 806 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
807 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
808 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
807 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
808 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
809 | 809 | if (isset($extraOptions['return_on_fault'])) { |
810 | 810 | $decodeFault = true; |
811 | 811 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -814,9 +814,9 @@ discard block |
||
814 | 814 | } |
815 | 815 | |
816 | 816 | $namespace = '\\PhpXmlRpc\\'; |
817 | - $reqClass = $namespace . 'Request'; |
|
818 | - $encoderClass = $namespace . 'Encoder'; |
|
819 | - $valueClass = $namespace . 'Value'; |
|
817 | + $reqClass = $namespace.'Request'; |
|
818 | + $encoderClass = $namespace.'Encoder'; |
|
819 | + $valueClass = $namespace.'Value'; |
|
820 | 820 | |
821 | 821 | $encoder = new $encoderClass(); |
822 | 822 | $encodeOptions = array(); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | } |
840 | 840 | |
841 | 841 | $xmlrpcArgs = array(); |
842 | - foreach($currentArgs as $i => $arg) { |
|
842 | + foreach ($currentArgs as $i => $arg) { |
|
843 | 843 | if ($i == $maxArgs) { |
844 | 844 | break; |
845 | 845 | } |
@@ -887,13 +887,13 @@ discard block |
||
887 | 887 | * @param string $mDesc |
888 | 888 | * @return string[] keys: source, docstring |
889 | 889 | */ |
890 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
890 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
891 | 891 | { |
892 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
892 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
893 | 893 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
894 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
895 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
896 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
894 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
895 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
896 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
897 | 897 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
898 | 898 | if (isset($extraOptions['return_on_fault'])) { |
899 | 899 | $decodeFault = true; |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | $namespace = '\\PhpXmlRpc\\'; |
907 | 907 | |
908 | 908 | $code = "function $newFuncName ("; |
909 | - if ($clientCopyMode < 2) { |
|
909 | + if ($clientCopyMode<2) { |
|
910 | 910 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
911 | 911 | $verbatimClientCopy = !$clientCopyMode; |
912 | 912 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | |
922 | 922 | if ($mDesc != '') { |
923 | 923 | // take care that PHP comment is not terminated unwillingly by method description |
924 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
924 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
925 | 925 | } else { |
926 | 926 | $mDesc = "/**\nFunction $newFuncName\n"; |
927 | 927 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
931 | 931 | $plist = array(); |
932 | 932 | $pCount = count($mSig); |
933 | - for ($i = 1; $i < $pCount; $i++) { |
|
933 | + for ($i = 1; $i<$pCount; $i++) { |
|
934 | 934 | $plist[] = "\$p$i"; |
935 | 935 | $pType = $mSig[$i]; |
936 | 936 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -946,19 +946,19 @@ discard block |
||
946 | 946 | } |
947 | 947 | } |
948 | 948 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
949 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
949 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
950 | 950 | } |
951 | - if ($clientCopyMode < 2) { |
|
951 | + if ($clientCopyMode<2) { |
|
952 | 952 | $plist[] = '$debug=0'; |
953 | 953 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
954 | 954 | } |
955 | 955 | $plist = implode(', ', $plist); |
956 | - $mDesc .= '* @return ' . $this->xmlrpc2PhpType($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
956 | + $mDesc .= '* @return '.$this->xmlrpc2PhpType($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
957 | 957 | |
958 | 958 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
959 | 959 | if ($decodeFault) { |
960 | 960 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
961 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
961 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
962 | 962 | } else { |
963 | 963 | $respCode = var_export($faultResponse, true); |
964 | 964 | } |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
972 | 972 | } |
973 | 973 | |
974 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
974 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
975 | 975 | |
976 | 976 | return array('source' => $code, 'docstring' => $mDesc); |
977 | 977 | } |
@@ -997,23 +997,23 @@ discard block |
||
997 | 997 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
998 | 998 | { |
999 | 999 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
1000 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
1000 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
1001 | 1001 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1002 | 1002 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1003 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1004 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1003 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1004 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1005 | 1005 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1006 | 1006 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1007 | 1007 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1008 | 1008 | $namespace = '\\PhpXmlRpc\\'; |
1009 | 1009 | |
1010 | - $reqClass = $namespace . 'Request'; |
|
1011 | - $decoderClass = $namespace . 'Encoder'; |
|
1010 | + $reqClass = $namespace.'Request'; |
|
1011 | + $decoderClass = $namespace.'Encoder'; |
|
1012 | 1012 | |
1013 | 1013 | $req = new $reqClass('system.listMethods'); |
1014 | 1014 | $response = $client->send($req, $timeout, $protocol); |
1015 | 1015 | if ($response->faultCode()) { |
1016 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1016 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1017 | 1017 | |
1018 | 1018 | return false; |
1019 | 1019 | } else { |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | $mList = $decoder->decode($mList); |
1024 | 1024 | } |
1025 | 1025 | if (!is_array($mList) || !count($mList)) { |
1026 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1026 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1027 | 1027 | |
1028 | 1028 | return false; |
1029 | 1029 | } else { |
@@ -1031,8 +1031,8 @@ discard block |
||
1031 | 1031 | if ($newClassName != '') { |
1032 | 1032 | $xmlrpcClassName = $newClassName; |
1033 | 1033 | } else { |
1034 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1035 | - array('_', ''), $client->server) . '_client'; |
|
1034 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1035 | + array('_', ''), $client->server).'_client'; |
|
1036 | 1036 | } |
1037 | 1037 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1038 | 1038 | $xmlrpcClassName .= 'x'; |
@@ -1063,20 +1063,20 @@ discard block |
||
1063 | 1063 | if (!$buildIt) { |
1064 | 1064 | $source .= $methodWrap['docstring']; |
1065 | 1065 | } |
1066 | - $source .= $methodWrap['source'] . "\n"; |
|
1066 | + $source .= $methodWrap['source']."\n"; |
|
1067 | 1067 | } else { |
1068 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1068 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1069 | 1069 | } |
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | $source .= "}\n"; |
1073 | 1073 | if ($buildIt) { |
1074 | 1074 | $allOK = 0; |
1075 | - eval($source . '$allOK=1;'); |
|
1075 | + eval($source.'$allOK=1;'); |
|
1076 | 1076 | if ($allOK) { |
1077 | 1077 | return $xmlrpcClassName; |
1078 | 1078 | } else { |
1079 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1079 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1080 | 1080 | return false; |
1081 | 1081 | } |
1082 | 1082 | } else { |
@@ -1097,10 +1097,10 @@ discard block |
||
1097 | 1097 | * |
1098 | 1098 | * @return string |
1099 | 1099 | */ |
1100 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
1100 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
1101 | 1101 | { |
1102 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
1103 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
1102 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
1103 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
1104 | 1104 | |
1105 | 1105 | // copy all client fields to the client that will be generated runtime |
1106 | 1106 | // (this provides for future expansion or subclassing of client obj) |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | <body> |
92 | 92 | <?php |
93 | 93 | |
94 | -include __DIR__ . '/common.php'; |
|
94 | +include __DIR__.'/common.php'; |
|
95 | 95 | if ($action) { |
96 | 96 | |
97 | - include_once __DIR__ . "/../src/Autoloader.php"; |
|
97 | + include_once __DIR__."/../src/Autoloader.php"; |
|
98 | 98 | PhpXmlRpc\Autoloader::register(); |
99 | 99 | |
100 | 100 | // make sure the script waits long enough for the call to complete... |
101 | 101 | if ($timeout) { |
102 | - set_time_limit($timeout + 10); |
|
102 | + set_time_limit($timeout+10); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | if ($wstype == 1) { |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | $server = "$host$path"; |
125 | 125 | } |
126 | 126 | if ($protocol == 2) { |
127 | - $server = 'https://' . $server; |
|
127 | + $server = 'https://'.$server; |
|
128 | 128 | } else { |
129 | - $server = 'http://' . $server; |
|
129 | + $server = 'http://'.$server; |
|
130 | 130 | } |
131 | 131 | if ($proxy != '') { |
132 | 132 | $pproxy = explode(':', $proxy); |
133 | - if (count($pproxy) > 1) { |
|
133 | + if (count($pproxy)>1) { |
|
134 | 134 | $pport = $pproxy[1]; |
135 | 135 | } else { |
136 | 136 | $pport = 8080; |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | case 'wrap': |
200 | 200 | $msg[0] = new $requestClass('system.methodHelp', array(), $id); |
201 | 201 | $msg[0]->addparam(new PhpXmlRpc\Value($method)); |
202 | - $msg[1] = new $requestClass('system.methodSignature', array(), (int)$id + 1); |
|
202 | + $msg[1] = new $requestClass('system.methodSignature', array(), (int) $id+1); |
|
203 | 203 | $msg[1]->addparam(new PhpXmlRpc\Value($method)); |
204 | - $actionname = 'Description of method "' . $method . '"'; |
|
204 | + $actionname = 'Description of method "'.$method.'"'; |
|
205 | 205 | break; |
206 | 206 | case 'list': |
207 | 207 | $msg[0] = new $requestClass('system.listMethods', array(), $id); |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | $msg[0] = new $requestClass($method, array(), $id); |
215 | 215 | // hack! build xml payload by hand |
216 | 216 | if ($wstype == 1) { |
217 | - $msg[0]->payload = "{\n" . |
|
218 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
219 | - $payload . |
|
217 | + $msg[0]->payload = "{\n". |
|
218 | + '"method": "'.$method."\",\n\"params\": [". |
|
219 | + $payload. |
|
220 | 220 | "\n],\n\"id\": "; |
221 | 221 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
222 | 222 | if ($id == "") { |
@@ -229,20 +229,20 @@ discard block |
||
229 | 229 | } |
230 | 230 | } |
231 | 231 | } else { |
232 | - $msg[0]->payload = $msg[0]->xml_header($inputcharset) . |
|
233 | - '<methodName>' . $method . "</methodName>\n<params>" . |
|
234 | - $payload . |
|
235 | - "</params>\n" . $msg[0]->xml_footer(); |
|
232 | + $msg[0]->payload = $msg[0]->xml_header($inputcharset). |
|
233 | + '<methodName>'.$method."</methodName>\n<params>". |
|
234 | + $payload. |
|
235 | + "</params>\n".$msg[0]->xml_footer(); |
|
236 | 236 | } |
237 | - $actionname = 'Execution of method ' . $method; |
|
237 | + $actionname = 'Execution of method '.$method; |
|
238 | 238 | break; |
239 | 239 | default: // give a warning |
240 | - $actionname = '[ERROR: unknown action] "' . $action . '"'; |
|
240 | + $actionname = '[ERROR: unknown action] "'.$action.'"'; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // Before calling execute, echo out brief description of action taken + date and time ??? |
244 | 244 | // this gives good user feedback for long-running methods... |
245 | - echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...</h2>\n"; |
|
245 | + echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset)." ...</h2>\n"; |
|
246 | 246 | flush(); |
247 | 247 | |
248 | 248 | $response = null; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | break; |
261 | 261 | } |
262 | 262 | } |
263 | - $time = microtime(true) - $time; |
|
263 | + $time = microtime(true)-$time; |
|
264 | 264 | if ($debug) { |
265 | 265 | echo "</div>\n"; |
266 | 266 | } |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | // call failed! echo out error msg! |
271 | 271 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
272 | 272 | echo "<h3>$protoName call FAILED!</h3>\n"; |
273 | - echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
274 | - "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n"; |
|
273 | + echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
274 | + "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."'</p>\n"; |
|
275 | 275 | echo(strftime("%d/%b/%Y:%H:%M:%S\n")); |
276 | 276 | } else { |
277 | 277 | // call succeeded: parse results |
@@ -287,36 +287,36 @@ discard block |
||
287 | 287 | $max = $v->count(); |
288 | 288 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
289 | 289 | echo "<thead>\n<tr><th>Method ($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
290 | - foreach($v as $i => $rec) { |
|
290 | + foreach ($v as $i => $rec) { |
|
291 | 291 | if ($i % 2) { |
292 | 292 | $class = ' class="oddrow"'; |
293 | 293 | } else { |
294 | 294 | $class = ' class="evenrow"'; |
295 | 295 | } |
296 | - echo("<tr><td$class>" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" . |
|
297 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
298 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
299 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
300 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
301 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
302 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
303 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
304 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
305 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
306 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
307 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
308 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
309 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
310 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
311 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
312 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
313 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
314 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
315 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
316 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" . |
|
317 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
318 | - "<input type=\"hidden\" name=\"action\" value=\"describe\" />" . |
|
319 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
296 | + echo("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
|
297 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
298 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
299 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
300 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
301 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
302 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
303 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
304 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
305 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
306 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
307 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
308 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
309 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
310 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
311 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
312 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
313 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
314 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
315 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
316 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."\" />". |
|
317 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
318 | + "<input type=\"hidden\" name=\"action\" value=\"describe\" />". |
|
319 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
320 | 320 | "<input type=\"submit\" value=\"Describe\" /></form></td>"); |
321 | 321 | //echo("</tr>\n"); |
322 | 322 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $r2 = $resp[1]->value(); |
344 | 344 | |
345 | 345 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
346 | - echo "<thead>\n<tr><th>Method</th><th>" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
346 | + echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
347 | 347 | $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
348 | 348 | if ($desc == "") { |
349 | 349 | $desc = "-"; |
@@ -353,41 +353,41 @@ discard block |
||
353 | 353 | if ($r2->kindOf() != "array") { |
354 | 354 | echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
355 | 355 | } else { |
356 | - foreach($r2 as $i => $x) { |
|
356 | + foreach ($r2 as $i => $x) { |
|
357 | 357 | $payload = ""; |
358 | 358 | $alt_payload = ""; |
359 | - if ($i + 1 % 2) { |
|
359 | + if ($i+1 % 2) { |
|
360 | 360 | $class = ' class="oddrow"'; |
361 | 361 | } else { |
362 | 362 | $class = ' class="evenrow"'; |
363 | 363 | } |
364 | - echo "<tr><td$class>Signature " . ($i + 1) . "</td><td$class>"; |
|
364 | + echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
|
365 | 365 | if ($x->kindOf() == "array") { |
366 | 366 | $ret = $x[0]; |
367 | - echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
|
368 | - if ($x->count() > 1) { |
|
369 | - foreach($x as $k => $y) { |
|
367 | + echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."<br />IN: ("; |
|
368 | + if ($x->count()>1) { |
|
369 | + foreach ($x as $k => $y) { |
|
370 | 370 | if ($k == 0) continue; |
371 | 371 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
372 | 372 | if ($wstype != 1) { |
373 | 373 | $type = $y->scalarval(); |
374 | 374 | $payload .= '<param><value>'; |
375 | - switch($type) { |
|
375 | + switch ($type) { |
|
376 | 376 | case 'undefined': |
377 | 377 | break; |
378 | 378 | case 'null'; |
379 | 379 | $type = 'nil'; |
380 | 380 | // fall thru intentionally |
381 | 381 | default: |
382 | - $payload .= '<' . |
|
383 | - htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
384 | - '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
382 | + $payload .= '<'. |
|
383 | + htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
384 | + '></'.htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
385 | 385 | '>'; |
386 | 386 | } |
387 | 387 | $payload .= "</value></param>\n"; |
388 | 388 | } |
389 | 389 | $alt_payload .= $y->scalarval(); |
390 | - if ($k < $x->count() - 1) { |
|
390 | + if ($k<$x->count()-1) { |
|
391 | 391 | $alt_payload .= ';'; |
392 | 392 | echo ", "; |
393 | 393 | } |
@@ -400,63 +400,63 @@ discard block |
||
400 | 400 | echo '</td>'; |
401 | 401 | // button to test this method |
402 | 402 | //$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>"; |
403 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
404 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
405 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
406 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
407 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
408 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
409 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
410 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
411 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
412 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
413 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
414 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
415 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
416 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
417 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
418 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
419 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
420 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
421 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
422 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
423 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
424 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
425 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
426 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
403 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
404 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
405 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
406 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
407 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
408 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
409 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
410 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
411 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
412 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
413 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
414 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
415 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
416 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
417 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
418 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
419 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
420 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
421 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
422 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
423 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
424 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
425 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
426 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
427 | 427 | "<input type=\"hidden\" name=\"action\" value=\"execute\" />"; |
428 | 428 | if ($wstype != 1) { |
429 | 429 | echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
430 | 430 | } |
431 | 431 | echo "</form></td>\n"; |
432 | 432 | |
433 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
434 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
435 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
436 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
437 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
438 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
439 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
440 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
441 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
442 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
443 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
444 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
445 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
446 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
447 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
448 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
449 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
450 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
451 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
452 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
453 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
454 | - "<input type=\"hidden\" name=\"methodsig\" value=\"" . $i . "\" />" . |
|
455 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
456 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
457 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
458 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
459 | - "<input type=\"hidden\" name=\"action\" value=\"wrap\" />" . |
|
433 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
434 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
435 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
436 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
437 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
438 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
439 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
440 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
441 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
442 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
443 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
444 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
445 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
446 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
447 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
448 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
449 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
450 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
451 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
452 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
453 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
454 | + "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />". |
|
455 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
456 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
457 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
458 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
459 | + "<input type=\"hidden\" name=\"action\" value=\"wrap\" />". |
|
460 | 460 | "<input type=\"submit\" value=\"Generate method call stub code\" />"; |
461 | 461 | echo "</form></td></tr>\n"; |
462 | 462 | } |
@@ -468,14 +468,14 @@ discard block |
||
468 | 468 | case 'wrap': |
469 | 469 | $r1 = $resp[0]->value(); |
470 | 470 | $r2 = $resp[1]->value(); |
471 | - if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) { |
|
471 | + if ($r2->kindOf() != "array" || $r2->count()<=$methodsig) { |
|
472 | 472 | echo "Error: signature unknown\n"; |
473 | 473 | } else { |
474 | 474 | $mdesc = $r1->scalarval(); |
475 | 475 | $encoder = new PhpXmlRpc\Encoder(); |
476 | 476 | $msig = $encoder->decode($r2); |
477 | 477 | $msig = $msig[$methodsig]; |
478 | - $proto = $protocol == 2 ? 'https' : ( $protocol == 1 ? 'http11' : '' ); |
|
478 | + $proto = $protocol == 2 ? 'https' : ($protocol == 1 ? 'http11' : ''); |
|
479 | 479 | if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
480 | 480 | $clientcookies == '' |
481 | 481 | ) { |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | $prefix = 'xmlrpc'; |
490 | 490 | } |
491 | 491 | $wrapper = new PhpXmlRpc\Wrapper(); |
492 | - $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc); |
|
492 | + $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc); |
|
493 | 493 | //if ($code) |
494 | 494 | //{ |
495 | 495 | echo "<div id=\"phpcode\">\n"; |
496 | - highlight_string("<?php\n" . $code['docstring'] . $code['source'] . '?>'); |
|
496 | + highlight_string("<?php\n".$code['docstring'].$code['source'].'?>'); |
|
497 | 497 | echo "\n</div>"; |
498 | 498 | //} |
499 | 499 | //else |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | break; |
505 | 505 | |
506 | 506 | case 'execute': |
507 | - echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>'; |
|
507 | + echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>'; |
|
508 | 508 | break; |
509 | 509 | |
510 | 510 | default: // give a warning |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | 4 | |
5 | -include_once __DIR__ . '/parse_args.php'; |
|
5 | +include_once __DIR__.'/parse_args.php'; |
|
6 | 6 | |
7 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
7 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Tests involving requests sent to non-existing servers |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // make sure there's no freaking catchall DNS in effect |
58 | 58 | $dnsinfo = dns_get_record($this->client->server); |
59 | 59 | if ($dnsinfo) { |
60 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
60 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
61 | 61 | } else { |
62 | 62 | $this->assertEquals(5, $r->faultCode()); |
63 | 63 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // now test a successful connection |
84 | 84 | $server = explode(':', $this->args['HTTPSERVER']); |
85 | - if (count($server) > 1) { |
|
85 | + if (count($server)>1) { |
|
86 | 86 | $this->client->port = $server[1]; |
87 | 87 | } |
88 | 88 | $this->client->server = $server[0]; |