@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @license code licensed under the BSD License: see file license.txt |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 12 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 13 | 13 | PhpXmlRpc\Autoloader::register(); |
| 14 | 14 | |
| 15 | 15 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $url = $encoder->decode($req->getParam(0)); |
| 31 | 31 | $client = new PhpXmlRpc\Client($url); |
| 32 | 32 | |
| 33 | - if ($req->getNumParams() > 3) { |
|
| 33 | + if ($req->getNumParams()>3) { |
|
| 34 | 34 | // we have to set some options onto the client. |
| 35 | 35 | // Note that if we do not untaint the received values, warnings might be generated... |
| 36 | 36 | $options = $encoder->decode($req->getParam(3)); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $client->setSSLVerifyPeer($val); |
| 51 | 51 | break; |
| 52 | 52 | case 'Timeout': |
| 53 | - $timeout = (integer)$val; |
|
| 53 | + $timeout = (integer) $val; |
|
| 54 | 54 | break; |
| 55 | 55 | } // switch |
| 56 | 56 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // add debug info into response we give back to caller |
| 71 | - PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize()); |
|
| 71 | + PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize()); |
|
| 72 | 72 | |
| 73 | 73 | return $client->send($req, $timeout); |
| 74 | 74 | } |
@@ -6,20 +6,20 @@ discard block |
||
| 6 | 6 | <h3>The code demonstrates usage of multicall and introspection methods</h3> |
| 7 | 7 | <?php |
| 8 | 8 | |
| 9 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 9 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 10 | 10 | PhpXmlRpc\Autoloader::register(); |
| 11 | 11 | |
| 12 | 12 | function display_error($r) |
| 13 | 13 | { |
| 14 | 14 | print "An error occurred: "; |
| 15 | - print "Code: " . $r->faultCode() |
|
| 16 | - . " Reason: '" . $r->faultString() . "'<br/>"; |
|
| 15 | + print "Code: ".$r->faultCode() |
|
| 16 | + . " Reason: '".$r->faultString()."'<br/>"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
| 20 | 20 | |
| 21 | 21 | // First off, let's retrieve the list of methods available on the remote server |
| 22 | -print "<h3>methods available at http://" . $client->server . $client->path . "</h3>\n"; |
|
| 22 | +print "<h3>methods available at http://".$client->server.$client->path."</h3>\n"; |
|
| 23 | 23 | $req = new PhpXmlRpc\Request('system.listMethods'); |
| 24 | 24 | $resp = $client->send($req); |
| 25 | 25 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | // Then, retrieve the signature and help text of each available method |
| 32 | 32 | foreach ($v as $methodName) { |
| 33 | - print "<h4>" . $methodName->scalarval() . "</h4>\n"; |
|
| 33 | + print "<h4>".$methodName->scalarval()."</h4>\n"; |
|
| 34 | 34 | // build messages first, add params later |
| 35 | 35 | $m1 = new PhpXmlRpc\Request('system.methodHelp'); |
| 36 | 36 | $m2 = new PhpXmlRpc\Request('system.methodSignature'); |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | if ($val->kindOf() == "array") { |
| 62 | 62 | foreach ($val as $x) { |
| 63 | 63 | $ret = $x[0]; |
| 64 | - print "<code>" . $ret->scalarval() . " " |
|
| 65 | - . $methodName->scalarval() . "("; |
|
| 66 | - if ($x->count() > 1) { |
|
| 67 | - for ($k = 1; $k < $x->count(); $k++) { |
|
| 64 | + print "<code>".$ret->scalarval()." " |
|
| 65 | + . $methodName->scalarval()."("; |
|
| 66 | + if ($x->count()>1) { |
|
| 67 | + for ($k = 1; $k<$x->count(); $k++) { |
|
| 68 | 68 | $y = $x[$k]; |
| 69 | 69 | print $y->scalarval(); |
| 70 | - if ($k < $x->count() - 1) { |
|
| 70 | + if ($k<$x->count()-1) { |
|
| 71 | 71 | print ", "; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | </h3> |
| 13 | 13 | <?php |
| 14 | 14 | |
| 15 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 15 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 16 | 16 | PhpXmlRpc\Autoloader::register(); |
| 17 | 17 | |
| 18 | 18 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
| 19 | 19 | $client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals |
| 20 | 20 | $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); |
| 21 | 21 | if ($resp->faultCode()) { |
| 22 | - echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n"; |
|
| 22 | + echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n"; |
|
| 23 | 23 | } else { |
| 24 | 24 | echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"; |
| 25 | 25 | flush(); |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | if ($methodName == 'examples.getStateName') { |
| 32 | 32 | $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); |
| 33 | 33 | if ($callable) { |
| 34 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n"; |
|
| 34 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n"; |
|
| 35 | 35 | } else { |
| 36 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n"; |
|
| 36 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n"; |
|
| 37 | 37 | } |
| 38 | 38 | break; |
| 39 | 39 | } |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | <p></p> |
| 11 | 11 | <?php |
| 12 | 12 | |
| 13 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 13 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 14 | 14 | PhpXmlRpc\Autoloader::register(); |
| 15 | 15 | |
| 16 | 16 | $inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27); |
| 17 | 17 | print "This is the input data:<br/><pre>"; |
| 18 | -foreach($inAr as $key => $val) { |
|
| 19 | - print $key . ", " . $val . "\n"; |
|
| 18 | +foreach ($inAr as $key => $val) { |
|
| 19 | + print $key.", ".$val."\n"; |
|
| 20 | 20 | } |
| 21 | 21 | print "</pre>"; |
| 22 | 22 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | ); |
| 33 | 33 | } |
| 34 | 34 | $v = new PhpXmlRpc\Value($p, "array"); |
| 35 | -print "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n"; |
|
| 35 | +print "Encoded into xmlrpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n"; |
|
| 36 | 36 | |
| 37 | 37 | // create client and message objects |
| 38 | 38 | $req = new PhpXmlRpc\Request('examples.sortByAge', array($v)); |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | foreach ($value as $struct) { |
| 53 | 53 | $name = $struct["name"]; |
| 54 | 54 | $age = $struct["age"]; |
| 55 | - print htmlspecialchars($name->scalarval()) . ", " . htmlspecialchars($age->scalarval()) . "\n"; |
|
| 55 | + print htmlspecialchars($name->scalarval()).", ".htmlspecialchars($age->scalarval())."\n"; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - print "<hr/>For nerds: I got this value back<br/><pre>" . |
|
| 59 | - htmlentities($resp->serialize()) . "</pre><hr/>\n"; |
|
| 58 | + print "<hr/>For nerds: I got this value back<br/><pre>". |
|
| 59 | + htmlentities($resp->serialize())."</pre><hr/>\n"; |
|
| 60 | 60 | } else { |
| 61 | 61 | print "An error occurred:<pre>"; |
| 62 | - print "Code: " . htmlspecialchars($resp->faultCode()) . |
|
| 63 | - "\nReason: '" . htmlspecialchars($resp->faultString()) . '\'</pre><hr/>'; |
|
| 62 | + print "Code: ".htmlspecialchars($resp->faultCode()). |
|
| 63 | + "\nReason: '".htmlspecialchars($resp->faultString()).'\'</pre><hr/>'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | ?> |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | <h3>The code demonstrates usage for the terminally lazy. For a more complete proxy, look at at the Wrapper class</h3> |
| 7 | 7 | <?php |
| 8 | 8 | |
| 9 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 9 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 10 | 10 | PhpXmlRpc\Autoloader::register(); |
| 11 | 11 | |
| 12 | 12 | class PhpXmlRpcProxy |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | <h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3> |
| 7 | 7 | <?php |
| 8 | 8 | |
| 9 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 9 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 10 | 10 | PhpXmlRpc\Autoloader::register(); |
| 11 | 11 | |
| 12 | 12 | $req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array()); |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | $encoder = new PhpXmlRpc\Encoder(); |
| 17 | 17 | $value = $encoder->decode($resp->value()); |
| 18 | 18 | print "<pre>"; |
| 19 | - print "name: " . htmlspecialchars($value["toolkitName"]) . "\n"; |
|
| 20 | - print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n"; |
|
| 21 | - print "docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n"; |
|
| 22 | - print "os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n"; |
|
| 19 | + print "name: ".htmlspecialchars($value["toolkitName"])."\n"; |
|
| 20 | + print "version: ".htmlspecialchars($value["toolkitVersion"])."\n"; |
|
| 21 | + print "docs: ".htmlspecialchars($value["toolkitDocsUrl"])."\n"; |
|
| 22 | + print "os: ".htmlspecialchars($value["toolkitOperatingSystem"])."\n"; |
|
| 23 | 23 | print "</pre>"; |
| 24 | 24 | } else { |
| 25 | 25 | print "An error occurred: "; |
| 26 | - print "Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n"; |
|
| 26 | + print "Code: ".htmlspecialchars($resp->faultCode())." Reason: '".htmlspecialchars($resp->faultString())."'\n"; |
|
| 27 | 27 | } |
| 28 | 28 | ?> |
| 29 | 29 | </body> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | method)</p> |
| 21 | 21 | <?php |
| 22 | 22 | |
| 23 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 23 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 24 | 24 | PhpXmlRpc\Autoloader::register(); |
| 25 | 25 | |
| 26 | 26 | if (isset($_POST["mailto"]) && $_POST["mailto"]) { |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | print "<fonr color=\"red\">"; |
| 45 | 45 | print "Mail send failed<br/>\n"; |
| 46 | 46 | print "Fault: "; |
| 47 | - print "Code: " . htmlspecialchars($resp->faultCode()) . |
|
| 48 | - " Reason: '" . htmlspecialchars($resp->faultString()) . "'<br/>"; |
|
| 47 | + print "Code: ".htmlspecialchars($resp->faultCode()). |
|
| 48 | + " Reason: '".htmlspecialchars($resp->faultString())."'<br/>"; |
|
| 49 | 49 | print "</font><br/>"; |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -8,34 +8,34 @@ |
||
| 8 | 8 | <h3>The code demonstrates usage of automatic encoding/decoding of php variables into xmlrpc values</h3> |
| 9 | 9 | <?php |
| 10 | 10 | |
| 11 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 11 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 12 | 12 | PhpXmlRpc\Autoloader::register(); |
| 13 | 13 | |
| 14 | 14 | if (isset($_POST["stateno"]) && $_POST["stateno"] != "") { |
| 15 | - $stateNo = (integer)$_POST["stateno"]; |
|
| 15 | + $stateNo = (integer) $_POST["stateno"]; |
|
| 16 | 16 | $encoder = new PhpXmlRpc\Encoder(); |
| 17 | 17 | $req = new PhpXmlRpc\Request('examples.getStateName', |
| 18 | 18 | array($encoder->encode($stateNo)) |
| 19 | 19 | ); |
| 20 | - print "Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . "\n\n</pre>Debug info of server data follows...\n\n"; |
|
| 20 | + print "Sending the following request:<pre>\n\n".htmlentities($req->serialize())."\n\n</pre>Debug info of server data follows...\n\n"; |
|
| 21 | 21 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
| 22 | 22 | $client->setDebug(1); |
| 23 | 23 | $r = $client->send($req); |
| 24 | 24 | if (!$r->faultCode()) { |
| 25 | 25 | $v = $r->value(); |
| 26 | - print "<br/>State number <b>" . $stateNo . "</b> is <b>" |
|
| 27 | - . htmlspecialchars($encoder->decode($v)) . "</b><br/>"; |
|
| 26 | + print "<br/>State number <b>".$stateNo."</b> is <b>" |
|
| 27 | + . htmlspecialchars($encoder->decode($v))."</b><br/>"; |
|
| 28 | 28 | } else { |
| 29 | 29 | print "An error occurred: "; |
| 30 | - print "Code: " . htmlspecialchars($r->faultCode()) |
|
| 31 | - . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>"; |
|
| 30 | + print "Code: ".htmlspecialchars($r->faultCode()) |
|
| 31 | + . " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>"; |
|
| 32 | 32 | } |
| 33 | 33 | } else { |
| 34 | 34 | $stateNo = ""; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | print "<form action=\"getstatename.php\" method=\"POST\"> |
| 38 | -<input name=\"stateno\" value=\"" . $stateNo . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
| 38 | +<input name=\"stateno\" value=\"" . $stateNo."\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
| 39 | 39 | <p>Enter a state number to query its name</p>"; |
| 40 | 40 | |
| 41 | 41 | ?> |
@@ -110,36 +110,36 @@ |
||
| 110 | 110 | public function serialize($charsetEncoding = '') |
| 111 | 111 | { |
| 112 | 112 | if ($charsetEncoding != '') { |
| 113 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 113 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 114 | 114 | } else { |
| 115 | 115 | $this->content_type = 'text/xml'; |
| 116 | 116 | } |
| 117 | 117 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
| 118 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
| 118 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
| 119 | 119 | } else { |
| 120 | 120 | $result = "<methodResponse>\n"; |
| 121 | 121 | } |
| 122 | 122 | if ($this->errno) { |
| 123 | 123 | // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients |
| 124 | 124 | // by xml-encoding non ascii chars |
| 125 | - $result .= "<fault>\n" . |
|
| 126 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
| 127 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
| 128 | - Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
| 125 | + $result .= "<fault>\n". |
|
| 126 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
| 127 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
| 128 | + Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
| 129 | 129 | "</struct>\n</value>\n</fault>"; |
| 130 | 130 | } else { |
| 131 | 131 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
| 132 | 132 | if (is_string($this->val) && $this->valtyp == 'xml') { |
| 133 | - $result .= "<params>\n<param>\n" . |
|
| 134 | - $this->val . |
|
| 133 | + $result .= "<params>\n<param>\n". |
|
| 134 | + $this->val. |
|
| 135 | 135 | "</param>\n</params>"; |
| 136 | 136 | } else { |
| 137 | 137 | /// @todo try to build something serializable? |
| 138 | 138 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
| 139 | 139 | } |
| 140 | 140 | } else { |
| 141 | - $result .= "<params>\n<param>\n" . |
|
| 142 | - $this->val->serialize($charsetEncoding) . |
|
| 141 | + $result .= "<params>\n<param>\n". |
|
| 142 | + $this->val->serialize($charsetEncoding). |
|
| 143 | 143 | "</param>\n</params>"; |
| 144 | 144 | } |
| 145 | 145 | } |