@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | include("xmlrpc.inc"); |
9 | 9 | |
10 | 10 | // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off |
11 | - if(!isset($HTTP_POST_VARS) && isset($_POST)) |
|
11 | + if (!isset($HTTP_POST_VARS) && isset($_POST)) |
|
12 | 12 | { |
13 | 13 | $HTTP_POST_VARS = $_POST; |
14 | 14 | } |
15 | 15 | |
16 | - if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="") |
|
16 | + if (isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"] != "") |
|
17 | 17 | { |
18 | - $stateno=(integer)$HTTP_POST_VARS["stateno"]; |
|
19 | - $f=new xmlrpcmsg('examples.getStateName', |
|
18 | + $stateno = (integer) $HTTP_POST_VARS["stateno"]; |
|
19 | + $f = new xmlrpcmsg('examples.getStateName', |
|
20 | 20 | array(php_xmlrpc_encode($stateno)) |
21 | 21 | ); |
22 | - print "<pre>Sending the following request:\n\n" . htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n"; |
|
23 | - $c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80); |
|
22 | + print "<pre>Sending the following request:\n\n".htmlentities($f->serialize())."\n\nDebug info of server data follows...\n\n"; |
|
23 | + $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80); |
|
24 | 24 | $c->setDebug(1); |
25 | - $r=&$c->send($f); |
|
26 | - if(!$r->faultCode()) |
|
25 | + $r = &$c->send($f); |
|
26 | + if (!$r->faultCode()) |
|
27 | 27 | { |
28 | - $v=$r->value(); |
|
29 | - print "</pre><br/>State number " . $stateno . " is " |
|
30 | - . htmlspecialchars($v->scalarval()) . "<br/>"; |
|
28 | + $v = $r->value(); |
|
29 | + print "</pre><br/>State number ".$stateno." is " |
|
30 | + . htmlspecialchars($v->scalarval())."<br/>"; |
|
31 | 31 | // print "<HR>I got this value back<BR><PRE>" . |
32 | 32 | // htmlentities($r->serialize()). "</PRE><HR>\n"; |
33 | 33 | } |
34 | 34 | else |
35 | 35 | { |
36 | 36 | print "An error occurred: "; |
37 | - print "Code: " . htmlspecialchars($r->faultCode()) |
|
38 | - . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>"; |
|
37 | + print "Code: ".htmlspecialchars($r->faultCode()) |
|
38 | + . " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | else |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | print "<form action=\"client.php\" method=\"POST\"> |
47 | -<input name=\"stateno\" value=\"" . $stateno . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
47 | +<input name=\"stateno\" value=\"" . $stateno."\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
48 | 48 | <p>Enter a state number to query its name</p>"; |
49 | 49 | |
50 | 50 | ?> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function xmlrpccall_simple() |
33 | 33 | { |
34 | - if(func_num_args() < 2) |
|
34 | + if (func_num_args()<2) |
|
35 | 35 | { |
36 | 36 | // Incorrect |
37 | 37 | return false; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | $xmlrpcval_array = array(); |
50 | - foreach($varargs as $parameter) |
|
50 | + foreach ($varargs as $parameter) |
|
51 | 51 | { |
52 | 52 | $xmlrpcval_array[] = php_xmlrpc_encode($parameter); |
53 | 53 | } |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | $HTTP_POST_VARS = $_POST; |
22 | 22 | |
23 | 23 | if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) { |
24 | - if ($HTTP_POST_VARS["server"]=="Userland") { |
|
25 | - $XP="/RPC2"; $XS="206.204.24.2"; |
|
24 | + if ($HTTP_POST_VARS["server"] == "Userland") { |
|
25 | + $XP = "/RPC2"; $XS = "206.204.24.2"; |
|
26 | 26 | } else { |
27 | - $XP="/xmlrpc/server.php"; $XS="pingu.heddley.com"; |
|
27 | + $XP = "/xmlrpc/server.php"; $XS = "pingu.heddley.com"; |
|
28 | 28 | } |
29 | - $f=new xmlrpcmsg('mail.send'); |
|
29 | + $f = new xmlrpcmsg('mail.send'); |
|
30 | 30 | $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"])); |
31 | 31 | $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"])); |
32 | 32 | $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"])); |
@@ -35,17 +35,17 @@ discard block |
||
35 | 35 | $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"])); |
36 | 36 | $f->addParam(new xmlrpcval("text/plain")); |
37 | 37 | |
38 | - $c=new xmlrpc_client($XP, $XS, 80); |
|
38 | + $c = new xmlrpc_client($XP, $XS, 80); |
|
39 | 39 | $c->setDebug(2); |
40 | - $r=&$c->send($f); |
|
40 | + $r = &$c->send($f); |
|
41 | 41 | if (!$r->faultCode()) { |
42 | 42 | print "Mail sent OK<br/>\n"; |
43 | 43 | } else { |
44 | 44 | print "<fonr color=\"red\">"; |
45 | 45 | print "Mail send failed<br/>\n"; |
46 | 46 | print "Fault: "; |
47 | - print "Code: " . htmlspecialchars($r->faultCode()) . |
|
48 | - " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>"; |
|
47 | + print "Code: ".htmlspecialchars($r->faultCode()). |
|
48 | + " Reason: '".htmlspecialchars($r->faultString())."'<br/>"; |
|
49 | 49 | print "</font><br/>"; |
50 | 50 | } |
51 | 51 | } |
@@ -11,18 +11,18 @@ |
||
11 | 11 | $c->setCredentials("username", "password"); |
12 | 12 | $c->setDebug(2); |
13 | 13 | $r = $c->send($f); |
14 | - if(!$r->faultCode()) |
|
14 | + if (!$r->faultCode()) |
|
15 | 15 | { |
16 | 16 | $v = $r->value(); |
17 | - print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>"; |
|
18 | - print "<hr/>I got this value back<br/>pre>" . |
|
19 | - htmlentities($r->serialize()). "</pre>\n"; |
|
17 | + print "I received:".htmlspecialchars($v->scalarval())."<br/>"; |
|
18 | + print "<hr/>I got this value back<br/>pre>". |
|
19 | + htmlentities($r->serialize())."</pre>\n"; |
|
20 | 20 | } |
21 | 21 | else |
22 | 22 | { |
23 | 23 | print "An error occurred: "; |
24 | - print "Code: " . htmlspecialchars($r->faultCode()) |
|
25 | - . " Reason: '" . ($r->faultString()) . "'<br/>"; |
|
24 | + print "Code: ".htmlspecialchars($r->faultCode()) |
|
25 | + . " Reason: '".($r->faultString())."'<br/>"; |
|
26 | 26 | } |
27 | 27 | ?> |
28 | 28 | </body> |
@@ -1,1 +1,1 @@ |
||
1 | -<html> <head><title>xmlrpc</title></head> <body> <h1>Introspect demo</h1> <h2>Query server for available methods and their description</h2> <h3>The code demonstrates usage of multicall and introspection methods</h3> <?php include("xmlrpc.inc"); function display_error($r) { print "An error occurred: "; print "Code: " . $r->faultCode() . " Reason: '" .$r->faultString()."'<br/>"; } // 'new style' client constuctor $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php"); print "<h3>methods available at http://" . $c->server . $c->path . "</h3>\n"; $m = new xmlrpcmsg('system.listMethods'); $r =& $c->send($m); if($r->faultCode()) { display_error($r); } else { $v=$r->value(); for($i=0; $i<$v->arraysize(); $i++) { $mname=$v->arraymem($i); print "<h4>" . $mname->scalarval() . "</h4>\n"; // build messages first, add params later $m1 = new xmlrpcmsg('system.methodHelp'); $m2 = new xmlrpcmsg('system.methodSignature'); $val = new xmlrpcval($mname->scalarval(), "string"); $m1->addParam($val); $m2->addParam($val); // send multiple messages in one pass. // If server does not support multicall, client will fall back to 2 separate calls $ms = array($m1, $m2); $rs =& $c->send($ms); if($rs[0]->faultCode()) { display_error($rs[0]); } else { $val=$rs[0]->value(); $txt=$val->scalarval(); if($txt != "") { print "<h4>Documentation</h4><p>${txt}</p>\n"; } else { print "<p>No documentation available.</p>\n"; } } if($rs[1]->faultCode()) { display_error($rs[1]); } else { print "<h4>Signature</h4><p>\n"; $val = $rs[1]->value(); if($val->kindOf()=="array") { for($j=0; $j<$val->arraysize(); $j++) { $x = $val->arraymem($j); $ret = $x->arraymem(0); print "<code>" . $ret->scalarval() . " " . $mname->scalarval() . "("; if($x->arraysize()>1) { for($k=1; $k<$x->arraysize(); $k++) { $y = $x->arraymem($k); print $y->scalarval(); if($k < $x->arraysize()-1) { print ", "; } } } print ")</code><br/>\n"; } } else { print "Signature unknown\n"; } print "</p>\n"; } } } ?> </body> </html> |
|
2 | 1 | \ No newline at end of file |
2 | +<html> <head><title>xmlrpc</title></head> <body> <h1>Introspect demo</h1> <h2>Query server for available methods and their description</h2> <h3>The code demonstrates usage of multicall and introspection methods</h3> <?php include("xmlrpc.inc"); function display_error($r) { print "An error occurred: "; print "Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>"; } // 'new style' client constuctor $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php"); print "<h3>methods available at http://".$c->server.$c->path."</h3>\n"; $m = new xmlrpcmsg('system.listMethods'); $r = & $c->send($m); if ($r->faultCode()) { display_error($r); } else { $v = $r->value(); for ($i = 0; $i<$v->arraysize(); $i++) { $mname = $v->arraymem($i); print "<h4>".$mname->scalarval()."</h4>\n"; // build messages first, add params later $m1 = new xmlrpcmsg('system.methodHelp'); $m2 = new xmlrpcmsg('system.methodSignature'); $val = new xmlrpcval($mname->scalarval(), "string"); $m1->addParam($val); $m2->addParam($val); // send multiple messages in one pass. // If server does not support multicall, client will fall back to 2 separate calls $ms = array($m1, $m2); $rs = & $c->send($ms); if ($rs[0]->faultCode()) { display_error($rs[0]); } else { $val = $rs[0]->value(); $txt = $val->scalarval(); if ($txt != "") { print "<h4>Documentation</h4><p>${txt}</p>\n"; } else { print "<p>No documentation available.</p>\n"; } } if ($rs[1]->faultCode()) { display_error($rs[1]); } else { print "<h4>Signature</h4><p>\n"; $val = $rs[1]->value(); if ($val->kindOf() == "array") { for ($j = 0; $j<$val->arraysize(); $j++) { $x = $val->arraymem($j); $ret = $x->arraymem(0); print "<code>".$ret->scalarval()." ".$mname->scalarval()."("; if ($x->arraysize()>1) { for ($k = 1; $k<$x->arraysize(); $k++) { $y = $x->arraymem($k); print $y->scalarval(); if ($k<$x->arraysize()-1) { print ", "; } } } print ")</code><br/>\n"; } } else { print "Signature unknown\n"; } print "</p>\n"; } } } ?> </body> </html> |
|
3 | 3 | \ No newline at end of file |
@@ -1,1 +1,1 @@ |
||
1 | -<html> <head><title>xmlrpc</title></head> <body> <h1>Which toolkit demo</h1> <h2>Query server for toolkit information</h2> <h3>The code demonstrates usage of the php_xmlrpc_decode function</h3> <?php include("xmlrpc.inc"); $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array()); $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80); $r = $c->send($f); if(!$r->faultCode()) { $v = php_xmlrpc_decode($r->value()); print "<pre>"; print "name: " . htmlspecialchars($v["toolkitName"]) . "\n"; print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n"; print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n"; print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n"; print "</pre>"; } else { print "An error occurred: "; print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n"; } ?> </body> </html> |
|
2 | 1 | \ No newline at end of file |
2 | +<html> <head><title>xmlrpc</title></head> <body> <h1>Which toolkit demo</h1> <h2>Query server for toolkit information</h2> <h3>The code demonstrates usage of the php_xmlrpc_decode function</h3> <?php include("xmlrpc.inc"); $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array()); $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80); $r = $c->send($f); if (!$r->faultCode()) { $v = php_xmlrpc_decode($r->value()); print "<pre>"; print "name: ".htmlspecialchars($v["toolkitName"])."\n"; print "version: ".htmlspecialchars($v["toolkitVersion"])."\n"; print "docs: ".htmlspecialchars($v["toolkitDocsUrl"])."\n"; print "os: ".htmlspecialchars($v["toolkitOperatingSystem"])."\n"; print "</pre>"; } else { print "An error occurred: "; print "Code: ".htmlspecialchars($r->faultCode())." Reason: '".htmlspecialchars($r->faultString())."'\n"; } ?> </body> </html> |
|
3 | 3 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @copyright (c) 2007-2014 G. Giunta |
6 | 6 | */ |
7 | 7 | |
8 | -if ($_SERVER['argc'] < 4) |
|
8 | +if ($_SERVER['argc']<4) |
|
9 | 9 | die("Usage: php convert.php docbook.xml \path\\to\stylesheet.xsl output-dir|output_file\n"); |
10 | 10 | else |
11 | 11 | echo "Starting xsl conversion process...\n"; |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | // Configure the transformer |
28 | 28 | $proc = new XSLTProcessor; |
29 | -if (version_compare(PHP_VERSION,'5.4',"<")) |
|
29 | +if (version_compare(PHP_VERSION, '5.4', "<")) |
|
30 | 30 | { |
31 | - if(defined('XSL_SECPREF_WRITE_FILE')) |
|
31 | + if (defined('XSL_SECPREF_WRITE_FILE')) |
|
32 | 32 | ini_set("xsl.security_prefs", XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE); |
33 | 33 | } |
34 | 34 | else |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $content = file_get_contents($file); |
15 | 15 | $last = 0; |
16 | 16 | $out = ''; |
17 | - while(($start = strpos($content, $starttag, $last)) !== false) |
|
17 | + while (($start = strpos($content, $starttag, $last)) !== false) |
|
18 | 18 | { |
19 | 19 | $end = strpos($content, $endtag, $start); |
20 | 20 | $code = substr($content, $start+strlen($starttag), $end-$start-strlen($starttag)); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $code = highlight_string('<?php '.$code, true); |
27 | 27 | $code = str_replace('<span style="color: #0000BB"><?php <br />', '<span style="color: #0000BB">', $code); |
28 | 28 | //echo($code); |
29 | - $out = $out . substr($content, $last, $start+strlen($starttag)-$last) . $code . $endtag; |
|
29 | + $out = $out.substr($content, $last, $start+strlen($starttag)-$last).$code.$endtag; |
|
30 | 30 | $last = $end+strlen($endtag); |
31 | 31 | } |
32 | 32 | $out .= substr($content, $last, strlen($content)); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $dir = $argv[1]; |
37 | 37 | |
38 | 38 | $files = scandir($dir); |
39 | -foreach($files as $file) |
|
39 | +foreach ($files as $file) |
|
40 | 40 | { |
41 | 41 | if (substr($file, -5, 5) == '.html') |
42 | 42 | { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function php_2_xmlrpc_type($phptype) |
29 | 29 | { |
30 | - switch(strtolower($phptype)) |
|
30 | + switch (strtolower($phptype)) |
|
31 | 31 | { |
32 | 32 | case 'string': |
33 | 33 | return $GLOBALS['xmlrpcString']; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | case 'resource': |
50 | 50 | return ''; |
51 | 51 | default: |
52 | - if(class_exists($phptype)) |
|
52 | + if (class_exists($phptype)) |
|
53 | 53 | { |
54 | 54 | return $GLOBALS['xmlrpcStruct']; |
55 | 55 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | function xmlrpc_2_php_type($xmlrpctype) |
70 | 70 | { |
71 | - switch(strtolower($xmlrpctype)) |
|
71 | + switch (strtolower($xmlrpctype)) |
|
72 | 72 | { |
73 | 73 | case 'base64': |
74 | 74 | case 'datetime.iso8601': |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | * @todo if $newfuncname is empty, we could use create_user_func instead of eval, as it is possibly faster |
141 | 141 | * @todo add a verbatim_object_copy parameter to allow avoiding the same obj instance? |
142 | 142 | */ |
143 | - function wrap_php_function($funcname, $newfuncname='', $extra_options=array()) |
|
143 | + function wrap_php_function($funcname, $newfuncname = '', $extra_options = array()) |
|
144 | 144 | { |
145 | 145 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; |
146 | 146 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; |
147 | - $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; |
|
148 | - $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; |
|
147 | + $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool) $extra_options['encode_php_objs'] : false; |
|
148 | + $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool) $extra_options['decode_php_objs'] : false; |
|
149 | 149 | $catch_warnings = isset($extra_options['suppress_warnings']) && $extra_options['suppress_warnings'] ? '@' : ''; |
150 | 150 | |
151 | 151 | $exists = false; |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | { |
154 | 154 | $funcname = explode('::', $funcname); |
155 | 155 | } |
156 | - if(is_array($funcname)) |
|
156 | + if (is_array($funcname)) |
|
157 | 157 | { |
158 | - if(count($funcname) < 2 || (!is_string($funcname[0]) && !is_object($funcname[0]))) |
|
158 | + if (count($funcname)<2 || (!is_string($funcname[0]) && !is_object($funcname[0]))) |
|
159 | 159 | { |
160 | 160 | error_log('XML-RPC: syntax for function to be wrapped is wrong'); |
161 | 161 | return false; |
162 | 162 | } |
163 | - if(is_string($funcname[0])) |
|
163 | + if (is_string($funcname[0])) |
|
164 | 164 | { |
165 | 165 | $plainfuncname = implode('::', $funcname); |
166 | 166 | } |
167 | - elseif(is_object($funcname[0])) |
|
167 | + elseif (is_object($funcname[0])) |
|
168 | 168 | { |
169 | - $plainfuncname = get_class($funcname[0]) . '->' . $funcname[1]; |
|
169 | + $plainfuncname = get_class($funcname[0]).'->'.$funcname[1]; |
|
170 | 170 | } |
171 | 171 | $exists = method_exists($funcname[0], $funcname[1]); |
172 | 172 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $exists = function_exists($funcname); |
177 | 177 | } |
178 | 178 | |
179 | - if(!$exists) |
|
179 | + if (!$exists) |
|
180 | 180 | { |
181 | 181 | error_log('XML-RPC: function to be wrapped is not defined: '.$plainfuncname); |
182 | 182 | return false; |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | else |
185 | 185 | { |
186 | 186 | // determine name of new php function |
187 | - if($newfuncname == '') |
|
187 | + if ($newfuncname == '') |
|
188 | 188 | { |
189 | - if(is_array($funcname)) |
|
189 | + if (is_array($funcname)) |
|
190 | 190 | { |
191 | - if(is_string($funcname[0])) |
|
191 | + if (is_string($funcname[0])) |
|
192 | 192 | $xmlrpcfuncname = "{$prefix}_".implode('_', $funcname); |
193 | 193 | else |
194 | - $xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1]; |
|
194 | + $xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]).'_'.$funcname[1]; |
|
195 | 195 | } |
196 | 196 | else |
197 | 197 | { |
@@ -202,36 +202,36 @@ discard block |
||
202 | 202 | { |
203 | 203 | $xmlrpcfuncname = $newfuncname; |
204 | 204 | } |
205 | - while($buildit && function_exists($xmlrpcfuncname)) |
|
205 | + while ($buildit && function_exists($xmlrpcfuncname)) |
|
206 | 206 | { |
207 | 207 | $xmlrpcfuncname .= 'x'; |
208 | 208 | } |
209 | 209 | |
210 | 210 | // start to introspect PHP code |
211 | - if(is_array($funcname)) |
|
211 | + if (is_array($funcname)) |
|
212 | 212 | { |
213 | 213 | $func = new ReflectionMethod($funcname[0], $funcname[1]); |
214 | - if($func->isPrivate()) |
|
214 | + if ($func->isPrivate()) |
|
215 | 215 | { |
216 | 216 | error_log('XML-RPC: method to be wrapped is private: '.$plainfuncname); |
217 | 217 | return false; |
218 | 218 | } |
219 | - if($func->isProtected()) |
|
219 | + if ($func->isProtected()) |
|
220 | 220 | { |
221 | 221 | error_log('XML-RPC: method to be wrapped is protected: '.$plainfuncname); |
222 | 222 | return false; |
223 | 223 | } |
224 | - if($func->isConstructor()) |
|
224 | + if ($func->isConstructor()) |
|
225 | 225 | { |
226 | 226 | error_log('XML-RPC: method to be wrapped is the constructor: '.$plainfuncname); |
227 | 227 | return false; |
228 | 228 | } |
229 | - if($func->isDestructor()) |
|
229 | + if ($func->isDestructor()) |
|
230 | 230 | { |
231 | 231 | error_log('XML-RPC: method to be wrapped is the destructor: '.$plainfuncname); |
232 | 232 | return false; |
233 | 233 | } |
234 | - if($func->isAbstract()) |
|
234 | + if ($func->isAbstract()) |
|
235 | 235 | { |
236 | 236 | error_log('XML-RPC: method to be wrapped is abstract: '.$plainfuncname); |
237 | 237 | return false; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | { |
243 | 243 | $func = new ReflectionFunction($funcname); |
244 | 244 | } |
245 | - if($func->isInternal()) |
|
245 | + if ($func->isInternal()) |
|
246 | 246 | { |
247 | 247 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
248 | 248 | // instead of getparameters to fully reflect internal php functions ? |
@@ -262,27 +262,27 @@ discard block |
||
262 | 262 | $paramDocs = array(); |
263 | 263 | |
264 | 264 | $docs = $func->getDocComment(); |
265 | - if($docs != '') |
|
265 | + if ($docs != '') |
|
266 | 266 | { |
267 | 267 | $docs = explode("\n", $docs); |
268 | 268 | $i = 0; |
269 | - foreach($docs as $doc) |
|
269 | + foreach ($docs as $doc) |
|
270 | 270 | { |
271 | 271 | $doc = trim($doc, " \r\t/*"); |
272 | - if(strlen($doc) && strpos($doc, '@') !== 0 && !$i) |
|
272 | + if (strlen($doc) && strpos($doc, '@') !== 0 && !$i) |
|
273 | 273 | { |
274 | - if($desc) |
|
274 | + if ($desc) |
|
275 | 275 | { |
276 | 276 | $desc .= "\n"; |
277 | 277 | } |
278 | 278 | $desc .= $doc; |
279 | 279 | } |
280 | - elseif(strpos($doc, '@param') === 0) |
|
280 | + elseif (strpos($doc, '@param') === 0) |
|
281 | 281 | { |
282 | 282 | // syntax: @param type [$name] desc |
283 | - if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches)) |
|
283 | + if (preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches)) |
|
284 | 284 | { |
285 | - if(strpos($matches[1], '|')) |
|
285 | + if (strpos($matches[1], '|')) |
|
286 | 286 | { |
287 | 287 | //$paramDocs[$i]['type'] = explode('|', $matches[1]); |
288 | 288 | $paramDocs[$i]['type'] = 'mixed'; |
@@ -296,14 +296,14 @@ discard block |
||
296 | 296 | } |
297 | 297 | $i++; |
298 | 298 | } |
299 | - elseif(strpos($doc, '@return') === 0) |
|
299 | + elseif (strpos($doc, '@return') === 0) |
|
300 | 300 | { |
301 | 301 | // syntax: @return type desc |
302 | 302 | //$returns = preg_split('/\s+/', $doc); |
303 | - if(preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches)) |
|
303 | + if (preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches)) |
|
304 | 304 | { |
305 | 305 | $returns = php_2_xmlrpc_type($matches[1]); |
306 | - if(isset($matches[2])) |
|
306 | + if (isset($matches[2])) |
|
307 | 307 | { |
308 | 308 | $returnsDocs = $matches[2]; |
309 | 309 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | // execute introspection of actual function prototype |
316 | 316 | $params = array(); |
317 | 317 | $i = 0; |
318 | - foreach($func->getParameters() as $paramobj) |
|
318 | + foreach ($func->getParameters() as $paramobj) |
|
319 | 319 | { |
320 | 320 | $params[$i] = array(); |
321 | 321 | $params[$i]['name'] = '$'.$paramobj->getName(); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $parsvariations = array(); |
331 | 331 | $pars = array(); |
332 | 332 | $pnum = count($params); |
333 | - foreach($params as $param) |
|
333 | + foreach ($params as $param) |
|
334 | 334 | { |
335 | 335 | if (isset($paramDocs[$i]['name']) && $paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != strtolower($param['name'])) |
336 | 336 | { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $paramDocs[$i]['type'] = 'mixed'; |
339 | 339 | } |
340 | 340 | |
341 | - if($param['isoptional']) |
|
341 | + if ($param['isoptional']) |
|
342 | 342 | { |
343 | 343 | // this particular parameter is optional. save as valid previous list of parameters |
344 | 344 | $innercode .= "if (\$paramcount > $i) {\n"; |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | |
357 | 357 | $pars[] = "\$p$i"; |
358 | 358 | $i++; |
359 | - if($param['isoptional']) |
|
359 | + if ($param['isoptional']) |
|
360 | 360 | { |
361 | 361 | $innercode .= "}\n"; |
362 | 362 | } |
363 | - if($i == $pnum) |
|
363 | + if ($i == $pnum) |
|
364 | 364 | { |
365 | 365 | // last allowed parameters combination |
366 | 366 | $parsvariations[] = $pars; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | $sigs = array(); |
371 | 371 | $psigs = array(); |
372 | - if(count($parsvariations) == 0) |
|
372 | + if (count($parsvariations) == 0) |
|
373 | 373 | { |
374 | 374 | // only known good synopsis = no parameters |
375 | 375 | $parsvariations[] = array(); |
@@ -380,24 +380,24 @@ discard block |
||
380 | 380 | $minpars = count($parsvariations[0]); |
381 | 381 | } |
382 | 382 | |
383 | - if($minpars) |
|
383 | + if ($minpars) |
|
384 | 384 | { |
385 | 385 | // add to code the check for min params number |
386 | 386 | // NB: this check needs to be done BEFORE decoding param values |
387 | - $innercode = "\$paramcount = \$msg->getNumParams();\n" . |
|
388 | - "if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode; |
|
387 | + $innercode = "\$paramcount = \$msg->getNumParams();\n". |
|
388 | + "if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n".$innercode; |
|
389 | 389 | } |
390 | 390 | else |
391 | 391 | { |
392 | - $innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode; |
|
392 | + $innercode = "\$paramcount = \$msg->getNumParams();\n".$innercode; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | $innercode .= "\$np = false;\n"; |
396 | 396 | // since there are no closures in php, if we are given an object instance, |
397 | 397 | // we store a pointer to it in a global var... |
398 | - if ( is_array($funcname) && is_object($funcname[0]) ) |
|
398 | + if (is_array($funcname) && is_object($funcname[0])) |
|
399 | 399 | { |
400 | - $GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& $funcname[0]; |
|
400 | + $GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] = & $funcname[0]; |
|
401 | 401 | $innercode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n"; |
402 | 402 | $realfuncname = '$obj->'.$funcname[1]; |
403 | 403 | } |
@@ -405,13 +405,13 @@ discard block |
||
405 | 405 | { |
406 | 406 | $realfuncname = $plainfuncname; |
407 | 407 | } |
408 | - foreach($parsvariations as $pars) |
|
408 | + foreach ($parsvariations as $pars) |
|
409 | 409 | { |
410 | - $innercode .= "if (\$paramcount == " . count($pars) . ") \$retval = {$catch_warnings}$realfuncname(" . implode(',', $pars) . "); else\n"; |
|
410 | + $innercode .= "if (\$paramcount == ".count($pars).") \$retval = {$catch_warnings}$realfuncname(".implode(',', $pars)."); else\n"; |
|
411 | 411 | // build a 'generic' signature (only use an appropriate return type) |
412 | 412 | $sig = array($returns); |
413 | 413 | $psig = array($returnsDocs); |
414 | - for($i=0; $i < count($pars); $i++) |
|
414 | + for ($i = 0; $i<count($pars); $i++) |
|
415 | 415 | { |
416 | 416 | if (isset($paramDocs[$i]['type'])) |
417 | 417 | { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $innercode .= "if (\$np) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else {\n"; |
431 | 431 | //$innercode .= "if (\$_xmlrpcs_error_occurred) return new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); else\n"; |
432 | 432 | $innercode .= "if (is_a(\$retval, '{$prefix}resp')) return \$retval; else\n"; |
433 | - if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64']) |
|
433 | + if ($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64']) |
|
434 | 434 | { |
435 | 435 | $innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));"; |
436 | 436 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | // shall we exclude functions returning by ref? |
445 | 445 | // if($func->returnsReference()) |
446 | 446 | // return false; |
447 | - $code = "function $xmlrpcfuncname(\$msg) {\n" . $innercode . "}\n}"; |
|
447 | + $code = "function $xmlrpcfuncname(\$msg) {\n".$innercode."}\n}"; |
|
448 | 448 | //print_r($code); |
449 | 449 | if ($buildit) |
450 | 450 | { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | // alternative |
454 | 454 | //$xmlrpcfuncname = create_function('$m', $innercode); |
455 | 455 | |
456 | - if(!$allOK) |
|
456 | + if (!$allOK) |
|
457 | 457 | { |
458 | 458 | error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap php function '.$plainfuncname); |
459 | 459 | return false; |
@@ -481,26 +481,26 @@ discard block |
||
481 | 481 | * @todo get_class_methods will return both static and non-static methods. |
482 | 482 | * we have to differentiate the action, depending on whether we received a class name or object |
483 | 483 | */ |
484 | - function wrap_php_class($classname, $extra_options=array()) |
|
484 | + function wrap_php_class($classname, $extra_options = array()) |
|
485 | 485 | { |
486 | 486 | $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : ''; |
487 | 487 | $methodtype = isset($extra_options['method_type']) ? $extra_options['method_type'] : 'auto'; |
488 | 488 | |
489 | 489 | $result = array(); |
490 | 490 | $mlist = get_class_methods($classname); |
491 | - foreach($mlist as $mname) |
|
491 | + foreach ($mlist as $mname) |
|
492 | 492 | { |
493 | 493 | if ($methodfilter == '' || preg_match($methodfilter, $mname)) |
494 | 494 | { |
495 | 495 | // echo $mlist."\n"; |
496 | 496 | $func = new ReflectionMethod($classname, $mname); |
497 | - if(!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract()) |
|
497 | + if (!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract()) |
|
498 | 498 | { |
499 | - if(($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) || |
|
499 | + if (($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) || |
|
500 | 500 | (!$func->isStatic && ($methodtype == 'all' || $methodtype == 'nonstatic' || ($methodtype == 'auto' && is_object($classname))))) |
501 | 501 | { |
502 | 502 | $methodwrap = wrap_php_function(array($classname, $mname), '', $extra_options); |
503 | - if ( $methodwrap ) |
|
503 | + if ($methodwrap) |
|
504 | 504 | { |
505 | 505 | $result[$methodwrap['function']] = $methodwrap['function']; |
506 | 506 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * bool debug set it to 1 or 2 to see debug results of querying server for method synopsis |
549 | 549 | * @return string the name of the generated php function (or false) - OR AN ARRAY... |
550 | 550 | */ |
551 | - function wrap_xmlrpc_method($client, $methodname, $extra_options=0, $timeout=0, $protocol='', $newfuncname='') |
|
551 | + function wrap_xmlrpc_method($client, $methodname, $extra_options = 0, $timeout = 0, $protocol = '', $newfuncname = '') |
|
552 | 552 | { |
553 | 553 | // mind numbing: let caller use sane calling convention (as per javadoc, 3 params), |
554 | 554 | // OR the 2.0 calling convention (no options) - we really love backward compat, don't we? |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | } |
560 | 560 | else |
561 | 561 | { |
562 | - $signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0; |
|
563 | - $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0; |
|
562 | + $signum = isset($extra_options['signum']) ? (int) $extra_options['signum'] : 0; |
|
563 | + $timeout = isset($extra_options['timeout']) ? (int) $extra_options['timeout'] : 0; |
|
564 | 564 | $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : ''; |
565 | 565 | $newfuncname = isset($extra_options['new_function_name']) ? $extra_options['new_function_name'] : ''; |
566 | 566 | } |
@@ -568,10 +568,10 @@ discard block |
||
568 | 568 | //$verbatim_client_copy = in_array('simple_client_copy', $extra_options) ? 1 : |
569 | 569 | // in_array('build_class_code', $extra_options) ? 2 : 0; |
570 | 570 | |
571 | - $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; |
|
572 | - $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; |
|
571 | + $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool) $extra_options['encode_php_objs'] : false; |
|
572 | + $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool) $extra_options['decode_php_objs'] : false; |
|
573 | 573 | // it seems like the meaning of 'simple_client_copy' here is swapped wrt client_copy_mode later on... |
574 | - $simple_client_copy = isset($extra_options['simple_client_copy']) ? (int)($extra_options['simple_client_copy']) : 0; |
|
574 | + $simple_client_copy = isset($extra_options['simple_client_copy']) ? (int) ($extra_options['simple_client_copy']) : 0; |
|
575 | 575 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; |
576 | 576 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; |
577 | 577 | if (isset($extra_options['return_on_fault'])) |
@@ -593,8 +593,8 @@ discard block |
||
593 | 593 | $msg = new $msgclass('system.methodSignature'); |
594 | 594 | $msg->addparam(new $valclass($methodname)); |
595 | 595 | $client->setDebug($debug); |
596 | - $response =& $client->send($msg, $timeout, $protocol); |
|
597 | - if($response->faultCode()) |
|
596 | + $response = & $client->send($msg, $timeout, $protocol); |
|
597 | + if ($response->faultCode()) |
|
598 | 598 | { |
599 | 599 | error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname); |
600 | 600 | return false; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | { |
607 | 607 | $msig = $decodefunc($msig); |
608 | 608 | } |
609 | - if(!is_array($msig) || count($msig) <= $signum) |
|
609 | + if (!is_array($msig) || count($msig)<=$signum) |
|
610 | 610 | { |
611 | 611 | error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname); |
612 | 612 | return false; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | else |
615 | 615 | { |
616 | 616 | // pick a suitable name for the new function, avoiding collisions |
617 | - if($newfuncname != '') |
|
617 | + if ($newfuncname != '') |
|
618 | 618 | { |
619 | 619 | $xmlrpcfuncname = $newfuncname; |
620 | 620 | } |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | $xmlrpcfuncname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
626 | 626 | array('_', ''), $methodname); |
627 | 627 | } |
628 | - while($buildit && function_exists($xmlrpcfuncname)) |
|
628 | + while ($buildit && function_exists($xmlrpcfuncname)) |
|
629 | 629 | { |
630 | 630 | $xmlrpcfuncname .= 'x'; |
631 | 631 | } |
@@ -634,11 +634,11 @@ discard block |
||
634 | 634 | $mdesc = ''; |
635 | 635 | // if in 'offline' mode, get method description too. |
636 | 636 | // in online mode, favour speed of operation |
637 | - if(!$buildit) |
|
637 | + if (!$buildit) |
|
638 | 638 | { |
639 | 639 | $msg = new $msgclass('system.methodHelp'); |
640 | 640 | $msg->addparam(new $valclass($methodname)); |
641 | - $response =& $client->send($msg, $timeout, $protocol); |
|
641 | + $response = & $client->send($msg, $timeout, $protocol); |
|
642 | 642 | if (!$response->faultCode()) |
643 | 643 | { |
644 | 644 | $mdesc = $response->value(); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | eval($results['source'].'$allOK=1;'); |
662 | 662 | // alternative |
663 | 663 | //$xmlrpcfuncname = create_function('$m', $innercode); |
664 | - if($allOK) |
|
664 | + if ($allOK) |
|
665 | 665 | { |
666 | 666 | return $xmlrpcfuncname; |
667 | 667 | } |
@@ -688,15 +688,15 @@ discard block |
||
688 | 688 | * @param array $extra_options list of options for wrapped code |
689 | 689 | * @return mixed false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriatevoption is set in extra_options) |
690 | 690 | */ |
691 | - function wrap_xmlrpc_server($client, $extra_options=array()) |
|
691 | + function wrap_xmlrpc_server($client, $extra_options = array()) |
|
692 | 692 | { |
693 | 693 | $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : ''; |
694 | 694 | //$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0; |
695 | - $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0; |
|
695 | + $timeout = isset($extra_options['timeout']) ? (int) $extra_options['timeout'] : 0; |
|
696 | 696 | $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : ''; |
697 | 697 | $newclassname = isset($extra_options['new_class_name']) ? $extra_options['new_class_name'] : ''; |
698 | - $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; |
|
699 | - $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; |
|
698 | + $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool) $extra_options['encode_php_objs'] : false; |
|
699 | + $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool) $extra_options['decode_php_objs'] : false; |
|
700 | 700 | $verbatim_client_copy = isset($extra_options['simple_client_copy']) ? !($extra_options['simple_client_copy']) : true; |
701 | 701 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; |
702 | 702 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; |
@@ -706,8 +706,8 @@ discard block |
||
706 | 706 | $decodefunc = 'php_'.$prefix.'_decode'; |
707 | 707 | |
708 | 708 | $msg = new $msgclass('system.listMethods'); |
709 | - $response =& $client->send($msg, $timeout, $protocol); |
|
710 | - if($response->faultCode()) |
|
709 | + $response = & $client->send($msg, $timeout, $protocol); |
|
710 | + if ($response->faultCode()) |
|
711 | 711 | { |
712 | 712 | error_log('XML-RPC: could not retrieve method list from remote server'); |
713 | 713 | return false; |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | { |
720 | 720 | $mlist = $decodefunc($mlist); |
721 | 721 | } |
722 | - if(!is_array($mlist) || !count($mlist)) |
|
722 | + if (!is_array($mlist) || !count($mlist)) |
|
723 | 723 | { |
724 | 724 | error_log('XML-RPC: could not retrieve meaningful method list from remote server'); |
725 | 725 | return false; |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | else |
728 | 728 | { |
729 | 729 | // pick a suitable name for the new function, avoiding collisions |
730 | - if($newclassname != '') |
|
730 | + if ($newclassname != '') |
|
731 | 731 | { |
732 | 732 | $xmlrpcclassname = $newclassname; |
733 | 733 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
737 | 737 | array('_', ''), $client->server).'_client'; |
738 | 738 | } |
739 | - while($buildit && class_exists($xmlrpcclassname)) |
|
739 | + while ($buildit && class_exists($xmlrpcclassname)) |
|
740 | 740 | { |
741 | 741 | $xmlrpcclassname .= 'x'; |
742 | 742 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | 'decode_php_objs' => $decode_php_objects |
753 | 753 | ); |
754 | 754 | /// @todo build javadoc for class definition, too |
755 | - foreach($mlist as $mname) |
|
755 | + foreach ($mlist as $mname) |
|
756 | 756 | { |
757 | 757 | if ($methodfilter == '' || preg_match($methodfilter, $mname)) |
758 | 758 | { |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | eval($source.'$allOK=1;'); |
781 | 781 | // alternative |
782 | 782 | //$xmlrpcfuncname = create_function('$m', $innercode); |
783 | - if($allOK) |
|
783 | + if ($allOK) |
|
784 | 784 | { |
785 | 785 | return $xmlrpcclassname; |
786 | 786 | } |
@@ -807,12 +807,12 @@ discard block |
||
807 | 807 | * @access private |
808 | 808 | */ |
809 | 809 | function build_remote_method_wrapper_code($client, $methodname, $xmlrpcfuncname, |
810 | - $msig, $mdesc='', $timeout=0, $protocol='', $client_copy_mode=0, $prefix='xmlrpc', |
|
811 | - $decode_php_objects=false, $encode_php_objects=false, $decode_fault=false, |
|
812 | - $fault_response='') |
|
810 | + $msig, $mdesc = '', $timeout = 0, $protocol = '', $client_copy_mode = 0, $prefix = 'xmlrpc', |
|
811 | + $decode_php_objects = false, $encode_php_objects = false, $decode_fault = false, |
|
812 | + $fault_response = '') |
|
813 | 813 | { |
814 | 814 | $code = "function $xmlrpcfuncname ("; |
815 | - if ($client_copy_mode < 2) |
|
815 | + if ($client_copy_mode<2) |
|
816 | 816 | { |
817 | 817 | // client copy mode 0 or 1 == partial / full client copy in emitted code |
818 | 818 | $innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix); |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | // param parsing |
841 | 841 | $plist = array(); |
842 | 842 | $pcount = count($msig); |
843 | - for($i = 1; $i < $pcount; $i++) |
|
843 | + for ($i = 1; $i<$pcount; $i++) |
|
844 | 844 | { |
845 | 845 | $plist[] = "\$p$i"; |
846 | 846 | $ptype = $msig[$i]; |
847 | - if($ptype == 'i4' || $ptype == 'int' || $ptype == 'boolean' || $ptype == 'double' || |
|
847 | + if ($ptype == 'i4' || $ptype == 'int' || $ptype == 'boolean' || $ptype == 'double' || |
|
848 | 848 | $ptype == 'string' || $ptype == 'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null') |
849 | 849 | { |
850 | 850 | // only build directly xmlrpcvals when type is known and scalar |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | $innercode .= "\$msg->addparam(\$p$i);\n"; |
865 | 865 | $mdesc .= '* @param '.xmlrpc_2_php_type($ptype)." \$p$i\n"; |
866 | 866 | } |
867 | - if ($client_copy_mode < 2) |
|
867 | + if ($client_copy_mode<2) |
|
868 | 868 | { |
869 | 869 | $plist[] = '$debug=0'; |
870 | 870 | $mdesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | $innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());"; |
898 | 898 | } |
899 | 899 | |
900 | - $code = $code . $plist. ") {\n" . $innercode . "\n}\n"; |
|
900 | + $code = $code.$plist.") {\n".$innercode."\n}\n"; |
|
901 | 901 | |
902 | 902 | return array('source' => $code, 'docstring' => $mdesc); |
903 | 903 | } |
@@ -908,18 +908,18 @@ discard block |
||
908 | 908 | * valid php code is emitted. |
909 | 909 | * @access private |
910 | 910 | */ |
911 | - function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
|
911 | + function build_client_wrapper_code($client, $verbatim_client_copy, $prefix = 'xmlrpc') |
|
912 | 912 | { |
913 | 913 | $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). |
914 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
914 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
915 | 915 | |
916 | 916 | // copy all client fields to the client that will be generated runtime |
917 | 917 | // (this provides for future expansion or subclassing of client obj) |
918 | 918 | if ($verbatim_client_copy) |
919 | 919 | { |
920 | - foreach($client as $fld => $val) |
|
920 | + foreach ($client as $fld => $val) |
|
921 | 921 | { |
922 | - if($fld != 'debug' && $fld != 'return_type') |
|
922 | + if ($fld != 'debug' && $fld != 'return_type') |
|
923 | 923 | { |
924 | 924 | $val = var_export($val, true); |
925 | 925 | $code .= "\$client->$fld = $val;\n"; |