@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | public function xml_header($charsetEncoding = '') |
39 | 39 | { |
40 | 40 | if ($charsetEncoding != '') { |
41 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
41 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
42 | 42 | } else { |
43 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
43 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | public function createPayload($charsetEncoding = '') |
53 | 53 | { |
54 | 54 | if ($charsetEncoding != '') { |
55 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
55 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
56 | 56 | } else { |
57 | 57 | $this->content_type = 'text/xml'; |
58 | 58 | } |
59 | 59 | $this->payload = $this->xml_header($charsetEncoding); |
60 | - $this->payload .= '<methodName>' . Charset::instance()->encodeEntities( |
|
61 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
60 | + $this->payload .= '<methodName>'.Charset::instance()->encodeEntities( |
|
61 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
62 | 62 | $this->payload .= "<params>\n"; |
63 | 63 | foreach ($this->params as $p) { |
64 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
64 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
65 | 65 | "</param>\n"; |
66 | 66 | } |
67 | 67 | $this->payload .= "</params>\n"; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
187 | 187 | |
188 | 188 | if ($data == '') { |
189 | - error_log('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
189 | + error_log('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
190 | 190 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
191 | 191 | } |
192 | 192 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $httpParser = new Http(); |
196 | 196 | try { |
197 | 197 | $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug); |
198 | - } catch(\Exception $e) { |
|
198 | + } catch (\Exception $e) { |
|
199 | 199 | $r = new Response(0, $e->getCode(), $e->getMessage()); |
200 | 200 | // failed processing of HTTP response headers |
201 | 201 | // save into response obj the full payload received, for debugging |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
215 | 215 | $pos = strrpos($data, '</methodResponse>'); |
216 | 216 | if ($pos !== false) { |
217 | - $data = substr($data, 0, $pos + 17); |
|
217 | + $data = substr($data, 0, $pos+17); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // try to 'guestimate' the character encoding of the received response |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | if ($start) { |
226 | 226 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
227 | 227 | $end = strpos($data, '-->', $start); |
228 | - $comments = substr($data, $start, $end - $start); |
|
229 | - Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
230 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
228 | + $comments = substr($data, $start, $end-$start); |
|
229 | + Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
230 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | if (extension_loaded('mbstring')) { |
256 | 256 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
257 | 257 | } else { |
258 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
258 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
299 | 299 | } |
300 | 300 | error_log($errStr); |
301 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' (' . $errStr . ')'); |
|
301 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], PhpXmlRpc::$xmlrpcstr['invalid_return'].' ('.$errStr.')'); |
|
302 | 302 | xml_parser_free($parser); |
303 | 303 | if ($this->debug) { |
304 | 304 | print $errStr; |
@@ -311,13 +311,13 @@ discard block |
||
311 | 311 | } |
312 | 312 | xml_parser_free($parser); |
313 | 313 | // second error check: xml well formed but not xml-rpc compliant |
314 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
314 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
315 | 315 | if ($this->debug) { |
316 | 316 | /// @todo echo something for user? |
317 | 317 | } |
318 | 318 | |
319 | 319 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
320 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
320 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
321 | 321 | } |
322 | 322 | // third error check: parsing of the response has somehow gone boink. |
323 | 323 | // NB: shall we omit this check, since we trust the parsing code? |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
329 | 329 | PhpXmlRpc::$xmlrpcstr['invalid_return']); |
330 | 330 | } else { |
331 | - if ($this->debug > 1) { |
|
331 | + if ($this->debug>1) { |
|
332 | 332 | Logger::instance()->debugMessage( |
333 | 333 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
334 | 334 | ); |