@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | public function xml_header($charsetEncoding = '') |
46 | 46 | { |
47 | 47 | if ($charsetEncoding != '') { |
48 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
48 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
49 | 49 | } else { |
50 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
50 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | public function createPayload($charsetEncoding = '') |
68 | 68 | { |
69 | 69 | if ($charsetEncoding != '') { |
70 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
70 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
71 | 71 | } else { |
72 | 72 | $this->content_type = 'text/xml'; |
73 | 73 | } |
74 | 74 | $this->payload = $this->xml_header($charsetEncoding); |
75 | - $this->payload .= '<methodName>' . Charset::instance()->encodeEntities( |
|
76 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
75 | + $this->payload .= '<methodName>'.Charset::instance()->encodeEntities( |
|
76 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
77 | 77 | $this->payload .= "<params>\n"; |
78 | 78 | foreach ($this->params as $p) { |
79 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
79 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
80 | 80 | "</param>\n"; |
81 | 81 | } |
82 | 82 | $this->payload .= "</params>\n"; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
204 | 204 | |
205 | 205 | if ($data == '') { |
206 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
206 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
207 | 207 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
208 | 208 | } |
209 | 209 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $httpParser = new Http(); |
213 | 213 | try { |
214 | 214 | $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug); |
215 | - } catch(\Exception $e) { |
|
215 | + } catch (\Exception $e) { |
|
216 | 216 | $r = new Response(0, $e->getCode(), $e->getMessage()); |
217 | 217 | // failed processing of HTTP response headers |
218 | 218 | // save into response obj the full payload received, for debugging |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
232 | 232 | $pos = strrpos($data, '</methodResponse>'); |
233 | 233 | if ($pos !== false) { |
234 | - $data = substr($data, 0, $pos + 17); |
|
234 | + $data = substr($data, 0, $pos+17); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // try to 'guestimate' the character encoding of the received response |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | if ($start) { |
243 | 243 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
244 | 244 | $end = strpos($data, '-->', $start); |
245 | - $comments = substr($data, $start, $end - $start); |
|
246 | - Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
247 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
245 | + $comments = substr($data, $start, $end-$start); |
|
246 | + Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
247 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | if (extension_loaded('mbstring')) { |
273 | 273 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
274 | 274 | } else { |
275 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
275 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE); |
293 | 293 | |
294 | 294 | // first error check: xml not well formed |
295 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
295 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
296 | 296 | |
297 | 297 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
298 | 298 | |
299 | 299 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
300 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
300 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
301 | 301 | |
302 | 302 | if ($this->debug) { |
303 | 303 | print $xmlRpcParser->_xh['isf_reason']; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | // second error check: xml well formed but not xml-rpc compliant |
307 | 307 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
308 | 308 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
309 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
309 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
310 | 310 | |
311 | 311 | if ($this->debug) { |
312 | 312 | /// @todo echo something for user? |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
322 | 322 | PhpXmlRpc::$xmlrpcstr['invalid_return']); |
323 | 323 | } else { |
324 | - if ($this->debug > 1) { |
|
324 | + if ($this->debug>1) { |
|
325 | 325 | Logger::instance()->debugMessage( |
326 | 326 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
327 | 327 | ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public static function xmlrpc_debugmsg($msg) |
162 | 162 | { |
163 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
163 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public static function error_occurred($msg) |
174 | 174 | { |
175 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
175 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
192 | 192 | $out = ''; |
193 | 193 | if ($this->debug_info != '') { |
194 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
194 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
195 | 195 | } |
196 | 196 | if (static::$_xmlrpc_debuginfo != '') { |
197 | - $out .= "<!-- DEBUG INFO:\n" . Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
197 | + $out .= "<!-- DEBUG INFO:\n".Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
198 | 198 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
199 | 199 | // into return payload AFTER the beginning tag |
200 | 200 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | $this->debug_info = ''; |
225 | 225 | |
226 | 226 | // Save what we received, before parsing it |
227 | - if ($this->debug > 1) { |
|
228 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
227 | + if ($this->debug>1) { |
|
228 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | // save full body of request into response, for more debugging usages |
238 | 238 | $r->raw_data = $rawData; |
239 | 239 | |
240 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
241 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
242 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
240 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
241 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
242 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | $payload = $this->xml_header($respCharset); |
246 | - if ($this->debug > 0) { |
|
247 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
246 | + if ($this->debug>0) { |
|
247 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | // Do not create response serialization if it has already happened. Helps building json magic |
251 | 251 | if (empty($r->payload)) { |
252 | 252 | $r->serialize($respCharset); |
253 | 253 | } |
254 | - $payload = $payload . $r->payload; |
|
254 | + $payload = $payload.$r->payload; |
|
255 | 255 | |
256 | 256 | if ($returnPayload) { |
257 | 257 | return $payload; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | // if we get a warning/error that has output some text before here, then we cannot |
261 | 261 | // add a new header. We cannot say we are sending xml, either... |
262 | 262 | if (!headers_sent()) { |
263 | - header('Content-Type: ' . $r->content_type); |
|
263 | + header('Content-Type: '.$r->content_type); |
|
264 | 264 | // we do not know if client actually told us an accepted charset, but if he did |
265 | 265 | // we have to tell him what we did |
266 | 266 | header("Vary: Accept-Charset"); |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
290 | 290 | // responses up to 8000 bytes |
291 | 291 | if ($phpNoSelfCompress) { |
292 | - header('Content-Length: ' . (int)strlen($payload)); |
|
292 | + header('Content-Length: '.(int) strlen($payload)); |
|
293 | 293 | } |
294 | 294 | } else { |
295 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
295 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | print $payload; |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | $numParams = count($in); |
348 | 348 | } |
349 | 349 | foreach ($sigs as $curSig) { |
350 | - if (count($curSig) == $numParams + 1) { |
|
350 | + if (count($curSig) == $numParams+1) { |
|
351 | 351 | $itsOK = 1; |
352 | - for ($n = 0; $n < $numParams; $n++) { |
|
352 | + for ($n = 0; $n<$numParams; $n++) { |
|
353 | 353 | if (is_object($in)) { |
354 | 354 | $p = $in->getParam($n); |
355 | 355 | if ($p->kindOf() == 'scalar') { |
@@ -362,10 +362,10 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | // param index is $n+1, as first member of sig is return type |
365 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
365 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
366 | 366 | $itsOK = 0; |
367 | - $pno = $n + 1; |
|
368 | - $wanted = $curSig[$n + 1]; |
|
367 | + $pno = $n+1; |
|
368 | + $wanted = $curSig[$n+1]; |
|
369 | 369 | $got = $pt; |
370 | 370 | break; |
371 | 371 | } |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | // check if $_SERVER is populated: it might have been disabled via ini file |
393 | 393 | // (this is true even when in CLI mode) |
394 | 394 | if (count($_SERVER) == 0) { |
395 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
395 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
396 | 396 | } |
397 | 397 | |
398 | - if ($this->debug > 1) { |
|
398 | + if ($this->debug>1) { |
|
399 | 399 | if (function_exists('getallheaders')) { |
400 | 400 | $this->debugmsg(''); // empty line |
401 | 401 | foreach (getallheaders() as $name => $val) { |
@@ -417,13 +417,13 @@ discard block |
||
417 | 417 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
418 | 418 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
419 | 419 | $data = $degzdata; |
420 | - if ($this->debug > 1) { |
|
421 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
420 | + if ($this->debug>1) { |
|
421 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
422 | 422 | } |
423 | 423 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
424 | 424 | $data = $degzdata; |
425 | - if ($this->debug > 1) { |
|
426 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
425 | + if ($this->debug>1) { |
|
426 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
427 | 427 | } |
428 | 428 | } else { |
429 | 429 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | if (extension_loaded('mbstring')) { |
514 | 514 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
515 | 515 | } else { |
516 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
516 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | } |
@@ -531,16 +531,16 @@ discard block |
||
531 | 531 | |
532 | 532 | $xmlRpcParser = new XMLParser($options); |
533 | 533 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST); |
534 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
534 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
535 | 535 | // (BC) we return XML error as a faultCode |
536 | 536 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
537 | 537 | $r = new Response(0, |
538 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
538 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
539 | 539 | $xmlRpcParser->_xh['isf_reason']); |
540 | 540 | } elseif ($xmlRpcParser->_xh['isf']) { |
541 | 541 | $r = new Response(0, |
542 | 542 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
543 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
543 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
544 | 544 | } else { |
545 | 545 | // small layering violation in favor of speed and memory usage: |
546 | 546 | // we should allow the 'execute' method handle this, but in the |
@@ -551,20 +551,20 @@ discard block |
||
551 | 551 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
552 | 552 | ) |
553 | 553 | ) { |
554 | - if ($this->debug > 1) { |
|
555 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
554 | + if ($this->debug>1) { |
|
555 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
556 | 556 | } |
557 | 557 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
558 | 558 | } else { |
559 | 559 | // build a Request object with data parsed from xml |
560 | 560 | $req = new Request($xmlRpcParser->_xh['method']); |
561 | 561 | // now add parameters in |
562 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
562 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
563 | 563 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
564 | 564 | } |
565 | 565 | |
566 | - if ($this->debug > 1) { |
|
567 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
566 | + if ($this->debug>1) { |
|
567 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
568 | 568 | } |
569 | 569 | $r = $this->execute($req); |
570 | 570 | } |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | return new Response( |
618 | 618 | 0, |
619 | 619 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
620 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
620 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
621 | 621 | ); |
622 | 622 | } |
623 | 623 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | |
631 | 631 | if (is_array($func)) { |
632 | 632 | if (is_object($func[0])) { |
633 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
633 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
634 | 634 | } else { |
635 | 635 | $funcName = implode('::', $func); |
636 | 636 | } |
@@ -642,17 +642,17 @@ discard block |
||
642 | 642 | |
643 | 643 | // verify that function to be invoked is in fact callable |
644 | 644 | if (!is_callable($func)) { |
645 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
645 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
646 | 646 | return new Response( |
647 | 647 | 0, |
648 | 648 | PhpXmlRpc::$xmlrpcerr['server_error'], |
649 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
649 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
650 | 650 | ); |
651 | 651 | } |
652 | 652 | |
653 | 653 | // If debug level is 3, we should catch all errors generated during |
654 | 654 | // processing of user function, and log them as part of response |
655 | - if ($this->debug > 2) { |
|
655 | + if ($this->debug>2) { |
|
656 | 656 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
657 | 657 | } |
658 | 658 | |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | $r = call_user_func($func, $req); |
666 | 666 | } |
667 | 667 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
668 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
668 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
669 | 669 | if (is_a($r, 'PhpXmlRpc\Value')) { |
670 | 670 | $r = new Response($r); |
671 | 671 | } else { |
672 | 672 | $r = new Response( |
673 | 673 | 0, |
674 | 674 | PhpXmlRpc::$xmlrpcerr['server_error'], |
675 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
675 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
676 | 676 | ); |
677 | 677 | } |
678 | 678 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
689 | 689 | // an error response |
690 | 690 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
691 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
691 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
692 | 692 | } else { |
693 | 693 | // functions using EPI api should NOT return resp objects, |
694 | 694 | // so make sure we encode the return type correctly |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | // in the called function, we wrap it in a proper error-response |
713 | 713 | switch ($this->exception_handling) { |
714 | 714 | case 2: |
715 | - if ($this->debug > 2) { |
|
715 | + if ($this->debug>2) { |
|
716 | 716 | if (self::$_xmlrpcs_prev_ehandler) { |
717 | 717 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
718 | 718 | } else { |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
728 | 728 | } |
729 | 729 | } |
730 | - if ($this->debug > 2) { |
|
730 | + if ($this->debug>2) { |
|
731 | 731 | // note: restore the error handler we found before calling the |
732 | 732 | // user func, even if it has been changed inside the func itself |
733 | 733 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | */ |
748 | 748 | protected function debugmsg($string) |
749 | 749 | { |
750 | - $this->debug_info .= $string . "\n"; |
|
750 | + $this->debug_info .= $string."\n"; |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | /** |
@@ -757,9 +757,9 @@ discard block |
||
757 | 757 | protected function xml_header($charsetEncoding = '') |
758 | 758 | { |
759 | 759 | if ($charsetEncoding != '') { |
760 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
760 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
761 | 761 | } else { |
762 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
762 | + return "<?xml version=\"1.0\"?".">\n"; |
|
763 | 763 | } |
764 | 764 | } |
765 | 765 | |
@@ -1003,12 +1003,12 @@ discard block |
||
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | $req = new Request($methName->scalarval()); |
1006 | - foreach($params as $i => $param) { |
|
1006 | + foreach ($params as $i => $param) { |
|
1007 | 1007 | if (!$req->addParam($param)) { |
1008 | 1008 | $i++; // for error message, we count params from 1 |
1009 | 1009 | return static::_xmlrpcs_multicall_error(new Response(0, |
1010 | 1010 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1011 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1011 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1012 | 1012 | } |
1013 | 1013 | } |
1014 | 1014 | |
@@ -1080,12 +1080,12 @@ discard block |
||
1080 | 1080 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
1081 | 1081 | if (is_object($req)) { |
1082 | 1082 | $calls = $req->getParam(0); |
1083 | - foreach($calls as $call) { |
|
1083 | + foreach ($calls as $call) { |
|
1084 | 1084 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
1085 | 1085 | } |
1086 | 1086 | } else { |
1087 | 1087 | $numCalls = count($req); |
1088 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1088 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1089 | 1089 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1090 | 1090 | } |
1091 | 1091 | } |
@@ -121,35 +121,35 @@ |
||
121 | 121 | public function serialize($charsetEncoding = '') |
122 | 122 | { |
123 | 123 | if ($charsetEncoding != '') { |
124 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
124 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
125 | 125 | } else { |
126 | 126 | $this->content_type = 'text/xml'; |
127 | 127 | } |
128 | 128 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
129 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
129 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
130 | 130 | } else { |
131 | 131 | $result = "<methodResponse>\n"; |
132 | 132 | } |
133 | 133 | if ($this->errno) { |
134 | 134 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
135 | - $result .= "<fault>\n" . |
|
136 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
137 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
138 | - Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
135 | + $result .= "<fault>\n". |
|
136 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
137 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
138 | + Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
139 | 139 | "</struct>\n</value>\n</fault>"; |
140 | 140 | } else { |
141 | 141 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
142 | 142 | if (is_string($this->val) && $this->valtyp == 'xml') { |
143 | - $result .= "<params>\n<param>\n" . |
|
144 | - $this->val . |
|
143 | + $result .= "<params>\n<param>\n". |
|
144 | + $this->val. |
|
145 | 145 | "</param>\n</params>"; |
146 | 146 | } else { |
147 | 147 | /// @todo try to build something serializable using the Encoder... |
148 | 148 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
149 | 149 | } |
150 | 150 | } else { |
151 | - $result .= "<params>\n<param>\n" . |
|
152 | - $this->val->serialize($charsetEncoding) . |
|
151 | + $result .= "<params>\n<param>\n". |
|
152 | + $this->val->serialize($charsetEncoding). |
|
153 | 153 | "</param>\n</params>"; |
154 | 154 | } |
155 | 155 | } |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | 'scalar' => $val, |
48 | 48 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
49 | 49 | ); |
50 | - return (object)$xmlrpcVal; |
|
50 | + return (object) $xmlrpcVal; |
|
51 | 51 | case 'base64': |
52 | 52 | $xmlrpcVal = array( |
53 | 53 | 'xmlrpc_type' => 'base64', |
54 | 54 | 'scalar' => $val |
55 | 55 | ); |
56 | - return (object)$xmlrpcVal; |
|
56 | + return (object) $xmlrpcVal; |
|
57 | 57 | case 'string': |
58 | 58 | if (isset($options['extension_api_encoding'])) { |
59 | 59 | $dval = @iconv('UTF-8', $options['extension_api_encoding'], $val); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | case 'array': |
89 | 89 | $arr = array(); |
90 | - foreach($xmlrpcVal as $value) { |
|
90 | + foreach ($xmlrpcVal as $value) { |
|
91 | 91 | $arr[] = $this->decode($value, $options); |
92 | 92 | } |
93 | 93 | return $arr; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | case 'msg': |
117 | 117 | $paramCount = $xmlrpcVal->getNumParams(); |
118 | 118 | $arr = array(); |
119 | - for ($i = 0; $i < $paramCount; $i++) { |
|
119 | + for ($i = 0; $i<$paramCount; $i++) { |
|
120 | 120 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
121 | 121 | } |
122 | 122 | return $arr; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | } else { |
212 | 212 | $arr = array(); |
213 | - foreach($phpVal as $k => $v) { |
|
213 | + foreach ($phpVal as $k => $v) { |
|
214 | 214 | $arr[$k] = $this->encode($v, $options); |
215 | 215 | } |
216 | 216 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | break; |
233 | 233 | case 'resource': |
234 | 234 | if (in_array('extension_api', $options)) { |
235 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
235 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
236 | 236 | } else { |
237 | 237 | $xmlrpcVal = new Value(); |
238 | 238 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (extension_loaded('mbstring')) { |
281 | 281 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
282 | 282 | } else { |
283 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
283 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $xmlRpcParser = new XMLParser($parserOptions); |
298 | 298 | $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE | XMLParser::ACCEPT_FAULT); |
299 | 299 | |
300 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
300 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
301 | 301 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
302 | 302 | |
303 | 303 | Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | case 'methodcall': |
323 | 323 | $req = new Request($xmlRpcParser->_xh['method']); |
324 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
324 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
325 | 325 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
326 | 326 | } |
327 | 327 | return $req; |
@@ -174,8 +174,7 @@ |
||
174 | 174 | } else { |
175 | 175 | $escapedData .= $ch; |
176 | 176 | } |
177 | - } |
|
178 | - else if ($ii < 128) { |
|
177 | + } else if ($ii < 128) { |
|
179 | 178 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
180 | 179 | switch ($ii) { |
181 | 180 | case 34: |
@@ -61,19 +61,19 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function buildConversionTable($tableName) |
63 | 63 | { |
64 | - switch($tableName) { |
|
64 | + switch ($tableName) { |
|
65 | 65 | case 'xml_iso88591_Entities': |
66 | 66 | if (count($this->xml_iso88591_Entities['in'])) { |
67 | 67 | return; |
68 | 68 | } |
69 | - for ($i = 0; $i < 32; $i++) { |
|
69 | + for ($i = 0; $i<32; $i++) { |
|
70 | 70 | $this->xml_iso88591_Entities["in"][] = chr($i); |
71 | 71 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
72 | 72 | } |
73 | 73 | |
74 | 74 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
75 | 75 | |
76 | - for ($i = 160; $i < 256; $i++) { |
|
76 | + for ($i = 160; $i<256; $i++) { |
|
77 | 77 | $this->xml_iso88591_Entities["in"][] = chr($i); |
78 | 78 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
79 | 79 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | break;*/ |
102 | 102 | |
103 | 103 | default: |
104 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
104 | + throw new \Exception('Unsupported table: '.$tableName); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $destEncoding = 'US-ASCII'; |
144 | 144 | } |
145 | 145 | |
146 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
146 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
147 | 147 | |
148 | 148 | // list ordered with (expected) most common scenarios first |
149 | 149 | switch ($conversion) { |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
162 | 162 | $escapedData = ''; |
163 | 163 | // be kind to users creating string xmlrpc values out of different php types |
164 | - $data = (string)$data; |
|
164 | + $data = (string) $data; |
|
165 | 165 | $ns = strlen($data); |
166 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
166 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
167 | 167 | $ch = $data[$nn]; |
168 | 168 | $ii = ord($ch); |
169 | 169 | // 7 bits in 1 byte: 0bbbbbbb (127) |
170 | - if ($ii < 32) { |
|
170 | + if ($ii<32) { |
|
171 | 171 | if ($conversion == 'UTF-8_US-ASCII') { |
172 | 172 | $escapedData .= sprintf('&#%d;', $ii); |
173 | 173 | } else { |
174 | 174 | $escapedData .= $ch; |
175 | 175 | } |
176 | 176 | } |
177 | - else if ($ii < 128) { |
|
177 | + else if ($ii<128) { |
|
178 | 178 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
179 | 179 | switch ($ii) { |
180 | 180 | case 34: |
@@ -198,25 +198,25 @@ discard block |
||
198 | 198 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
199 | 199 | elseif ($ii >> 5 == 6) { |
200 | 200 | $b1 = ($ii & 31); |
201 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
202 | - $ii = ($b1 * 64) + $b2; |
|
201 | + $b2 = (ord($data[$nn+1]) & 63); |
|
202 | + $ii = ($b1 * 64)+$b2; |
|
203 | 203 | $escapedData .= sprintf('&#%d;', $ii); |
204 | 204 | $nn += 1; |
205 | 205 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
206 | 206 | elseif ($ii >> 4 == 14) { |
207 | 207 | $b1 = ($ii & 15); |
208 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
209 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
210 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
208 | + $b2 = (ord($data[$nn+1]) & 63); |
|
209 | + $b3 = (ord($data[$nn+2]) & 63); |
|
210 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
211 | 211 | $escapedData .= sprintf('&#%d;', $ii); |
212 | 212 | $nn += 2; |
213 | 213 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
214 | 214 | elseif ($ii >> 3 == 30) { |
215 | 215 | $b1 = ($ii & 7); |
216 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
217 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
218 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
219 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
216 | + $b2 = (ord($data[$nn+1]) & 63); |
|
217 | + $b3 = (ord($data[$nn+2]) & 63); |
|
218 | + $b4 = (ord($data[$nn+3]) & 63); |
|
219 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
220 | 220 | $escapedData .= sprintf('&#%d;', $ii); |
221 | 221 | $nn += 3; |
222 | 222 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | default: |
266 | 266 | $escapedData = ''; |
267 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
267 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | return $escapedData; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | case 'iso88591': |
319 | 319 | return $this->xml_iso88591_Entities; |
320 | 320 | default: |
321 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
321 | + throw new \Exception('Unsupported charset: '.$charset); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |