@@ -158,10 +158,10 @@ discard block |
||
| 158 | 158 | $server = $parts['host']; |
| 159 | 159 | $path = isset($parts['path']) ? $parts['path'] : ''; |
| 160 | 160 | if (isset($parts['query'])) { |
| 161 | - $path .= '?' . $parts['query']; |
|
| 161 | + $path .= '?'.$parts['query']; |
|
| 162 | 162 | } |
| 163 | 163 | if (isset($parts['fragment'])) { |
| 164 | - $path .= '#' . $parts['fragment']; |
|
| 164 | + $path .= '#'.$parts['fragment']; |
|
| 165 | 165 | } |
| 166 | 166 | if (isset($parts['port'])) { |
| 167 | 167 | $port = $parts['port']; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | if ($path == '' || $path[0] != '/') { |
| 180 | - $this->path = '/' . $path; |
|
| 180 | + $this->path = '/'.$path; |
|
| 181 | 181 | } else { |
| 182 | 182 | $this->path = $path; |
| 183 | 183 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | }*/ |
| 216 | 216 | |
| 217 | 217 | // initialize user_agent string |
| 218 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
| 218 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | */ |
| 595 | 595 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
| 596 | 596 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
| 597 | - $method='http') |
|
| 597 | + $method = 'http') |
|
| 598 | 598 | { |
| 599 | 599 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
| 600 | 600 | |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | * |
| 628 | 628 | * @return Response |
| 629 | 629 | */ |
| 630 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
| 630 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
| 631 | 631 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
| 632 | 632 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
| 633 | 633 | $sslVersion = 0) |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | */ |
| 668 | 668 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
| 669 | 669 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
| 670 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
| 670 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
| 671 | 671 | $sslVersion = 0) |
| 672 | 672 | { |
| 673 | 673 | /// @todo log a warning if passed an unsupported method |
@@ -703,16 +703,16 @@ discard block |
||
| 703 | 703 | // thanks to Grant Rauscher <[email protected]> for this |
| 704 | 704 | $credentials = ''; |
| 705 | 705 | if ($username != '') { |
| 706 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
| 706 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
| 707 | 707 | if ($authType != 1) { |
| 708 | 708 | /// @todo make this a proper error, ie. return a failure |
| 709 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 709 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | $acceptedEncoding = ''; |
| 714 | 714 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
| 715 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
| 715 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | $proxyCredentials = ''; |
@@ -723,13 +723,13 @@ discard block |
||
| 723 | 723 | $connectServer = $proxyHost; |
| 724 | 724 | $connectPort = $proxyPort; |
| 725 | 725 | $transport = 'tcp'; |
| 726 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
| 726 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
| 727 | 727 | if ($proxyUsername != '') { |
| 728 | 728 | if ($proxyAuthType != 1) { |
| 729 | 729 | /// @todo make this a proper error, ie. return a failure |
| 730 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 730 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 731 | 731 | } |
| 732 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
| 732 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
| 733 | 733 | } |
| 734 | 734 | } else { |
| 735 | 735 | $connectServer = $server; |
@@ -744,45 +744,45 @@ discard block |
||
| 744 | 744 | $version = ''; |
| 745 | 745 | foreach ($this->cookies as $name => $cookie) { |
| 746 | 746 | if ($cookie['version']) { |
| 747 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
| 748 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
| 747 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
| 748 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
| 749 | 749 | if ($cookie['path']) { |
| 750 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
| 750 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
| 751 | 751 | } |
| 752 | 752 | if ($cookie['domain']) { |
| 753 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
| 753 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
| 754 | 754 | } |
| 755 | 755 | if ($cookie['port']) { |
| 756 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
| 756 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
| 757 | 757 | } |
| 758 | 758 | } else { |
| 759 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
| 759 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
| 762 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | // omit port if default |
| 766 | 766 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
| 767 | - $port = ''; |
|
| 767 | + $port = ''; |
|
| 768 | 768 | } else { |
| 769 | - $port = ':' . $port; |
|
| 769 | + $port = ':'.$port; |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
| 773 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
| 774 | - 'Host: ' . $server . $port . "\r\n" . |
|
| 775 | - $credentials . |
|
| 776 | - $proxyCredentials . |
|
| 777 | - $acceptedEncoding . |
|
| 778 | - $encodingHdr . |
|
| 779 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
| 780 | - $cookieHeader . |
|
| 781 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
| 782 | - strlen($payload) . "\r\n\r\n" . |
|
| 772 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
| 773 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
| 774 | + 'Host: '.$server.$port."\r\n". |
|
| 775 | + $credentials. |
|
| 776 | + $proxyCredentials. |
|
| 777 | + $acceptedEncoding. |
|
| 778 | + $encodingHdr. |
|
| 779 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
| 780 | + $cookieHeader. |
|
| 781 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
| 782 | + strlen($payload)."\r\n\r\n". |
|
| 783 | 783 | $payload; |
| 784 | 784 | |
| 785 | - if ($this->debug > 1) { |
|
| 785 | + if ($this->debug>1) { |
|
| 786 | 786 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
| 787 | 787 | } |
| 788 | 788 | |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | |
| 810 | 810 | $context = stream_context_create($contextOptions); |
| 811 | 811 | |
| 812 | - if ($timeout <= 0) { |
|
| 812 | + if ($timeout<=0) { |
|
| 813 | 813 | $connectTimeout = ini_get('default_socket_timeout'); |
| 814 | 814 | } else { |
| 815 | 815 | $connectTimeout = $timeout; |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
| 822 | 822 | STREAM_CLIENT_CONNECT, $context); |
| 823 | 823 | if ($fp) { |
| 824 | - if ($timeout > 0) { |
|
| 824 | + if ($timeout>0) { |
|
| 825 | 825 | stream_set_timeout($fp, $timeout); |
| 826 | 826 | } |
| 827 | 827 | } else { |
@@ -830,8 +830,8 @@ discard block |
||
| 830 | 830 | $this->errstr = $err['message']; |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
| 834 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
| 833 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
| 834 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
| 835 | 835 | |
| 836 | 836 | return $r; |
| 837 | 837 | } |
@@ -920,18 +920,18 @@ discard block |
||
| 920 | 920 | $keyPass, $sslVersion); |
| 921 | 921 | |
| 922 | 922 | if (!$curl) { |
| 923 | - return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
| 923 | + return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | $result = curl_exec($curl); |
| 927 | 927 | |
| 928 | - if ($this->debug > 1) { |
|
| 928 | + if ($this->debug>1) { |
|
| 929 | 929 | $message = "---CURL INFO---\n"; |
| 930 | 930 | foreach (curl_getinfo($curl) as $name => $val) { |
| 931 | 931 | if (is_array($val)) { |
| 932 | 932 | $val = implode("\n", $val); |
| 933 | 933 | } |
| 934 | - $message .= $name . ': ' . $val . "\n"; |
|
| 934 | + $message .= $name.': '.$val."\n"; |
|
| 935 | 935 | } |
| 936 | 936 | $message .= '---END---'; |
| 937 | 937 | $this->getLogger()->debugMessage($message); |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | /// @todo we should use a better check here - what if we get back '' or '0'? |
| 942 | 942 | |
| 943 | 943 | $this->errstr = 'no response'; |
| 944 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
| 944 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
| 945 | 945 | curl_close($curl); |
| 946 | 946 | if ($keepAlive) { |
| 947 | 947 | $this->xmlrpc_curl_handle = null; |
@@ -1011,12 +1011,12 @@ discard block |
||
| 1011 | 1011 | // http, https |
| 1012 | 1012 | $protocol = $method; |
| 1013 | 1013 | if (strpos($protocol, ':') !== false) { |
| 1014 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
| 1014 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
| 1015 | 1015 | return false; |
| 1016 | 1016 | } |
| 1017 | 1017 | } |
| 1018 | 1018 | } |
| 1019 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
| 1019 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
| 1020 | 1020 | if (!$curl) { |
| 1021 | 1021 | return false; |
| 1022 | 1022 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | // results into variable |
| 1031 | 1031 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 1032 | 1032 | |
| 1033 | - if ($this->debug > 1) { |
|
| 1033 | + if ($this->debug>1) { |
|
| 1034 | 1034 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
| 1035 | 1035 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
| 1036 | 1036 | } |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | 1057 | // extra headers |
| 1058 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
| 1058 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
| 1059 | 1059 | // if no keepalive is wanted, let the server know it in advance |
| 1060 | 1060 | if (!$keepAlive) { |
| 1061 | 1061 | $headers[] = 'Connection: close'; |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
| 1073 | 1073 | // timeout is borked |
| 1074 | 1074 | if ($timeout) { |
| 1075 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
| 1075 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | switch ($method) { |
@@ -1091,12 +1091,12 @@ discard block |
||
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | if ($username && $password) { |
| 1094 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
| 1094 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
| 1095 | 1095 | if (defined('CURLOPT_HTTPAUTH')) { |
| 1096 | 1096 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
| 1097 | 1097 | } elseif ($authType != 1) { |
| 1098 | 1098 | /// @todo make this a proper error, ie. return a failure |
| 1099 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 1099 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 1100 | 1100 | } |
| 1101 | 1101 | } |
| 1102 | 1102 | |
@@ -1139,14 +1139,14 @@ discard block |
||
| 1139 | 1139 | if ($proxyPort == 0) { |
| 1140 | 1140 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
| 1141 | 1141 | } |
| 1142 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
| 1142 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
| 1143 | 1143 | if ($proxyUsername) { |
| 1144 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
| 1144 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
| 1145 | 1145 | if (defined('CURLOPT_PROXYAUTH')) { |
| 1146 | 1146 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
| 1147 | 1147 | } elseif ($proxyAuthType != 1) { |
| 1148 | 1148 | /// @todo make this a proper error, ie. return a failure |
| 1149 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1149 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| 1152 | 1152 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | if (count($this->cookies)) { |
| 1157 | 1157 | $cookieHeader = ''; |
| 1158 | 1158 | foreach ($this->cookies as $name => $cookie) { |
| 1159 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
| 1159 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
| 1160 | 1160 | } |
| 1161 | 1161 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
| 1162 | 1162 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | curl_setopt($curl, $opt, $val); |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | - if ($this->debug > 1) { |
|
| 1168 | + if ($this->debug>1) { |
|
| 1169 | 1169 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
| 1170 | 1170 | } |
| 1171 | 1171 | |
@@ -1264,7 +1264,7 @@ discard block |
||
| 1264 | 1264 | $call['methodName'] = new Value($req->method(), 'string'); |
| 1265 | 1265 | $numParams = $req->getNumParams(); |
| 1266 | 1266 | $params = array(); |
| 1267 | - for ($i = 0; $i < $numParams; $i++) { |
|
| 1267 | + for ($i = 0; $i<$numParams; $i++) { |
|
| 1268 | 1268 | $params[$i] = $req->getParam($i); |
| 1269 | 1269 | } |
| 1270 | 1270 | $call['params'] = new Value($params, 'array'); |
@@ -1290,15 +1290,15 @@ discard block |
||
| 1290 | 1290 | /// @todo test this code branch... |
| 1291 | 1291 | $rets = $result->value(); |
| 1292 | 1292 | if (!is_array($rets)) { |
| 1293 | - return false; // bad return type from system.multicall |
|
| 1293 | + return false; // bad return type from system.multicall |
|
| 1294 | 1294 | } |
| 1295 | 1295 | $numRets = count($rets); |
| 1296 | 1296 | if ($numRets != count($reqs)) { |
| 1297 | - return false; // wrong number of return values. |
|
| 1297 | + return false; // wrong number of return values. |
|
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | $response = array(); |
| 1301 | - for ($i = 0; $i < $numRets; $i++) { |
|
| 1301 | + for ($i = 0; $i<$numRets; $i++) { |
|
| 1302 | 1302 | $val = $rets[$i]; |
| 1303 | 1303 | if (!is_array($val)) { |
| 1304 | 1304 | return false; |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | switch (count($val)) { |
| 1307 | 1307 | case 1: |
| 1308 | 1308 | if (!isset($val[0])) { |
| 1309 | - return false; // Bad value |
|
| 1309 | + return false; // Bad value |
|
| 1310 | 1310 | } |
| 1311 | 1311 | // Normal return value |
| 1312 | 1312 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1334,11 +1334,11 @@ discard block |
||
| 1334 | 1334 | |
| 1335 | 1335 | $rets = $result->value(); |
| 1336 | 1336 | if ($rets->kindOf() != 'array') { |
| 1337 | - return false; // bad return type from system.multicall |
|
| 1337 | + return false; // bad return type from system.multicall |
|
| 1338 | 1338 | } |
| 1339 | 1339 | $numRets = $rets->count(); |
| 1340 | 1340 | if ($numRets != count($reqs)) { |
| 1341 | - return false; // wrong number of return values. |
|
| 1341 | + return false; // wrong number of return values. |
|
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | $response = array(); |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | switch ($val->kindOf()) { |
| 1347 | 1347 | case 'array': |
| 1348 | 1348 | if ($val->count() != 1) { |
| 1349 | - return false; // Bad value |
|
| 1349 | + return false; // Bad value |
|
| 1350 | 1350 | } |
| 1351 | 1351 | // Normal return value |
| 1352 | 1352 | $response[] = new Response($val[0]); |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | if (count($this->xml_iso88591_Entities['in'])) { |
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | - for ($i = 0; $i < 32; $i++) { |
|
| 74 | + for ($i = 0; $i<32; $i++) { |
|
| 75 | 75 | $this->xml_iso88591_Entities["in"][] = chr($i); |
| 76 | 76 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
| 80 | 80 | |
| 81 | - for ($i = 160; $i < 256; $i++) { |
|
| 81 | + for ($i = 160; $i<256; $i++) { |
|
| 82 | 82 | $this->xml_iso88591_Entities["in"][] = chr($i); |
| 83 | 83 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
| 84 | 84 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | break;*/ |
| 107 | 107 | |
| 108 | 108 | default: |
| 109 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
| 109 | + throw new \Exception('Unsupported table: '.$tableName); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $destEncoding = 'US-ASCII'; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
| 152 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
| 153 | 153 | |
| 154 | 154 | // list ordered with (expected) most common scenarios first |
| 155 | 155 | switch ($conversion) { |
@@ -167,20 +167,20 @@ discard block |
||
| 167 | 167 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
| 168 | 168 | $escapedData = ''; |
| 169 | 169 | // be kind to users creating string xmlrpc values out of different php types |
| 170 | - $data = (string)$data; |
|
| 170 | + $data = (string) $data; |
|
| 171 | 171 | $ns = strlen($data); |
| 172 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
| 172 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
| 173 | 173 | $ch = $data[$nn]; |
| 174 | 174 | $ii = ord($ch); |
| 175 | 175 | // 7 bits in 1 byte: 0bbbbbbb (127) |
| 176 | - if ($ii < 32) { |
|
| 176 | + if ($ii<32) { |
|
| 177 | 177 | if ($conversion == 'UTF-8_US-ASCII') { |
| 178 | 178 | $escapedData .= sprintf('&#%d;', $ii); |
| 179 | 179 | } else { |
| 180 | 180 | $escapedData .= $ch; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | - else if ($ii < 128) { |
|
| 183 | + else if ($ii<128) { |
|
| 184 | 184 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
| 185 | 185 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
| 186 | 186 | switch ($ii) { |
@@ -205,25 +205,25 @@ discard block |
||
| 205 | 205 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
| 206 | 206 | elseif ($ii >> 5 == 6) { |
| 207 | 207 | $b1 = ($ii & 31); |
| 208 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 209 | - $ii = ($b1 * 64) + $b2; |
|
| 208 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 209 | + $ii = ($b1 * 64)+$b2; |
|
| 210 | 210 | $escapedData .= sprintf('&#%d;', $ii); |
| 211 | 211 | $nn += 1; |
| 212 | 212 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
| 213 | 213 | elseif ($ii >> 4 == 14) { |
| 214 | 214 | $b1 = ($ii & 15); |
| 215 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 216 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
| 217 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
| 215 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 216 | + $b3 = (ord($data[$nn+2]) & 63); |
|
| 217 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
| 218 | 218 | $escapedData .= sprintf('&#%d;', $ii); |
| 219 | 219 | $nn += 2; |
| 220 | 220 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
| 221 | 221 | elseif ($ii >> 3 == 30) { |
| 222 | 222 | $b1 = ($ii & 7); |
| 223 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 224 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
| 225 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
| 226 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
| 223 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 224 | + $b3 = (ord($data[$nn+2]) & 63); |
|
| 225 | + $b4 = (ord($data[$nn+3]) & 63); |
|
| 226 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
| 227 | 227 | $escapedData .= sprintf('&#%d;', $ii); |
| 228 | 228 | $nn += 3; |
| 229 | 229 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | default: |
| 274 | 274 | $escapedData = ''; |
| 275 | 275 | /// @todo allow usage of a custom Logger via the DIC(ish) pattern we use in other classes |
| 276 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
| 276 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return $escapedData; |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | case 'iso88591': |
| 327 | 327 | return $this->xml_iso88591_Entities; |
| 328 | 328 | default: |
| 329 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
| 329 | + throw new \Exception('Unsupported charset: '.$charset); |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | } |