@@ -29,7 +29,7 @@ |
||
29 | 29 | // gmstrftime doesn't exist in some versions of PHP |
30 | 30 | $t = gmstrftime("%Y%m%dT%H:%M:%S", $timet); |
31 | 31 | } else { |
32 | - $t = strftime("%Y%m%dT%H:%M:%S", $timet - date('Z')); |
|
32 | + $t = strftime("%Y%m%dT%H:%M:%S", $timet-date('Z')); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 |
@@ -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 | default: |
58 | 58 | return $xmlrpcVal->scalarval(); |
59 | 59 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | case 'array': |
80 | 80 | $arr = array(); |
81 | - foreach($xmlrpcVal as $value) { |
|
81 | + foreach ($xmlrpcVal as $value) { |
|
82 | 82 | $arr[] = $this->decode($value, $options); |
83 | 83 | } |
84 | 84 | return $arr; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | case 'msg': |
108 | 108 | $paramCount = $xmlrpcVal->getNumParams(); |
109 | 109 | $arr = array(); |
110 | - for ($i = 0; $i < $paramCount; $i++) { |
|
110 | + for ($i = 0; $i<$paramCount; $i++) { |
|
111 | 111 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
112 | 112 | } |
113 | 113 | return $arr; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | } else { |
203 | 203 | $arr = array(); |
204 | - foreach($phpVal as $k => $v) { |
|
204 | + foreach ($phpVal as $k => $v) { |
|
205 | 205 | $arr[$k] = $this->encode($v, $options); |
206 | 206 | } |
207 | 207 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | break; |
224 | 224 | case 'resource': |
225 | 225 | if (in_array('extension_api', $options)) { |
226 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
226 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
227 | 227 | } else { |
228 | 228 | $xmlrpcVal = new Value(); |
229 | 229 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if (extension_loaded('mbstring')) { |
272 | 272 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
273 | 273 | } else { |
274 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
274 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $xmlRpcParser = new XMLParser($parserOptions); |
288 | 288 | $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE | XMLParser::ACCEPT_FAULT); |
289 | 289 | |
290 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
290 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
291 | 291 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
292 | 292 | |
293 | 293 | Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | case 'methodcall': |
313 | 313 | $req = new Request($xmlRpcParser->_xh['method']); |
314 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
314 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
315 | 315 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
316 | 316 | } |
317 | 317 | return $req; |
@@ -61,17 +61,17 @@ 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 | - for ($i = 160; $i < 256; $i++) { |
|
74 | + for ($i = 160; $i<256; $i++) { |
|
75 | 75 | $this->xml_iso88591_Entities["in"][] = chr($i); |
76 | 76 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
77 | 77 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->buildConversionTable('xml_iso88591_Entities'); |
98 | 98 | break;*/ |
99 | 99 | default: |
100 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
100 | + throw new \Exception('Unsupported table: '.$tableName); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $srcEncoding = PhpXmlRpc::$xmlrpc_internalencoding; |
128 | 128 | } |
129 | 129 | |
130 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
130 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
131 | 131 | switch ($conversion) { |
132 | 132 | case 'ISO-8859-1_': |
133 | 133 | case 'ISO-8859-1_US-ASCII': |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
158 | 158 | $escapedData = ''; |
159 | 159 | // be kind to users creating string xmlrpc values out of different php types |
160 | - $data = (string)$data; |
|
160 | + $data = (string) $data; |
|
161 | 161 | $ns = strlen($data); |
162 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
162 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
163 | 163 | $ch = $data[$nn]; |
164 | 164 | $ii = ord($ch); |
165 | 165 | // 7 bits: 0bbbbbbb (127) |
166 | - if ($ii < 128) { |
|
166 | + if ($ii<128) { |
|
167 | 167 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
168 | 168 | switch ($ii) { |
169 | 169 | case 34: |
@@ -187,33 +187,33 @@ discard block |
||
187 | 187 | } // 11 bits: 110bbbbb 10bbbbbb (2047) |
188 | 188 | elseif ($ii >> 5 == 6) { |
189 | 189 | $b1 = ($ii & 31); |
190 | - $ii = ord($data[$nn + 1]); |
|
190 | + $ii = ord($data[$nn+1]); |
|
191 | 191 | $b2 = ($ii & 63); |
192 | - $ii = ($b1 * 64) + $b2; |
|
192 | + $ii = ($b1 * 64)+$b2; |
|
193 | 193 | $ent = sprintf('&#%d;', $ii); |
194 | 194 | $escapedData .= $ent; |
195 | 195 | $nn += 1; |
196 | 196 | } // 16 bits: 1110bbbb 10bbbbbb 10bbbbbb |
197 | 197 | elseif ($ii >> 4 == 14) { |
198 | 198 | $b1 = ($ii & 15); |
199 | - $ii = ord($data[$nn + 1]); |
|
199 | + $ii = ord($data[$nn+1]); |
|
200 | 200 | $b2 = ($ii & 63); |
201 | - $ii = ord($data[$nn + 2]); |
|
201 | + $ii = ord($data[$nn+2]); |
|
202 | 202 | $b3 = ($ii & 63); |
203 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
203 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
204 | 204 | $ent = sprintf('&#%d;', $ii); |
205 | 205 | $escapedData .= $ent; |
206 | 206 | $nn += 2; |
207 | 207 | } // 21 bits: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
208 | 208 | elseif ($ii >> 3 == 30) { |
209 | 209 | $b1 = ($ii & 7); |
210 | - $ii = ord($data[$nn + 1]); |
|
210 | + $ii = ord($data[$nn+1]); |
|
211 | 211 | $b2 = ($ii & 63); |
212 | - $ii = ord($data[$nn + 2]); |
|
212 | + $ii = ord($data[$nn+2]); |
|
213 | 213 | $b3 = ($ii & 63); |
214 | - $ii = ord($data[$nn + 3]); |
|
214 | + $ii = ord($data[$nn+3]); |
|
215 | 215 | $b4 = ($ii & 63); |
216 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
216 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
217 | 217 | $ent = sprintf('&#%d;', $ii); |
218 | 218 | $escapedData .= $ent; |
219 | 219 | $nn += 3; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | default: |
254 | 254 | $escapedData = ''; |
255 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
255 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return $escapedData; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | case 'iso88591': |
307 | 307 | return $this->xml_iso88591_Entities; |
308 | 308 | default: |
309 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
309 | + throw new \Exception('Unsupported charset: '.$charset); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | } |
@@ -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 | } |