@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving automatic encoding/decoding of php values into xmlrpc values (the Encoder class). |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing. |
| 76 | 76 | /// We should fix that, then re-enable this test |
| 77 | 77 | if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
| 78 | - $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>'); |
|
| 78 | + $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>'); |
|
| 79 | 79 | $this->assertEquals($string, $i->scalarVal()); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving the Value class. |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->assertequals(1, count($v1)); |
| 156 | 156 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
| 157 | 157 | |
| 158 | - foreach($v1 as $key => $val) |
|
| 158 | + foreach ($v1 as $key => $val) |
|
| 159 | 159 | { |
| 160 | 160 | $this->assertArrayHasKey($key, $out); |
| 161 | 161 | $expected = $out[$key]; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $this->assertequals(2, count($v2)); |
| 171 | 171 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
| 172 | 172 | $i = 0; |
| 173 | - foreach($v2 as $key => $val) |
|
| 173 | + foreach ($v2 as $key => $val) |
|
| 174 | 174 | { |
| 175 | 175 | $expected = $out[$i]; |
| 176 | 176 | $this->assertequals($expected['key'], $key); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
| 186 | 186 | $data = array(); |
| 187 | - for ($i = 0; $i < 500000; $i++ ) { |
|
| 187 | + for ($i = 0; $i<500000; $i++) { |
|
| 188 | 188 | $data[] = 'hello world'; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving xml parsing. |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function testI8() |
| 103 | 103 | { |
| 104 | - if (PHP_INT_SIZE == 4 ) { |
|
| 104 | + if (PHP_INT_SIZE == 4) { |
|
| 105 | 105 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
| 106 | 106 | return; |
| 107 | 107 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function testUnicodeInMemberName() |
| 178 | 178 | { |
| 179 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
| 179 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
| 180 | 180 | $v = array($str => new xmlrpcval(1)); |
| 181 | 181 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
| 182 | 182 | $r = $r->serialize(); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $response = @utf8_encode( |
| 193 | 193 | '<?xml version="1.0"?> |
| 194 | 194 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
| 195 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
| 195 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
| 196 | 196 | <methodResponse> |
| 197 | 197 | <fault> |
| 198 | 198 | <value> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | </member> |
| 204 | 204 | <member> |
| 205 | 205 | <name>faultString</name> |
| 206 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
| 206 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
| 207 | 207 | </member> |
| 208 | 208 | </struct> |
| 209 | 209 | </value> |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $m = $this->newRequest('dummy'); |
| 213 | 213 | $r = $m->parseResponse($response); |
| 214 | 214 | $v = $r->faultString(); |
| 215 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
| 215 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public function testBrokenRequests() |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
| 420 | 420 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
| 421 | 421 | |
| 422 | - foreach($values as $value) { |
|
| 423 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
| 422 | + foreach ($values as $value) { |
|
| 423 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
| 424 | 424 | $r = $s->parseResponse($f); |
| 425 | 425 | $v = $r->faultCode(); |
| 426 | 426 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -524,11 +524,11 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | public function testUTF8Response() |
| 526 | 526 | { |
| 527 | - $string = chr(224) . chr(252) . chr(232); |
|
| 527 | + $string = chr(224).chr(252).chr(232); |
|
| 528 | 528 | |
| 529 | 529 | $s = $this->newRequest('dummy'); |
| 530 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 530 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 532 | 532 | '; |
| 533 | 533 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 534 | 534 | $v = $r->value(); |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $this->assertEquals($string, $v); |
| 537 | 537 | |
| 538 | 538 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 539 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 539 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 540 | 540 | '; |
| 541 | 541 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 542 | 542 | $v = $r->value(); |
@@ -552,11 +552,11 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public function testLatin1Response() |
| 554 | 554 | { |
| 555 | - $string = chr(224) . chr(252) . chr(232); |
|
| 555 | + $string = chr(224).chr(252).chr(232); |
|
| 556 | 556 | |
| 557 | 557 | $s = $this->newRequest('dummy'); |
| 558 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 558 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 560 | 560 | '; |
| 561 | 561 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 562 | 562 | $v = $r->value(); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $this->assertEquals($string, $v); |
| 565 | 565 | |
| 566 | 566 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 567 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 567 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 568 | 568 | '; |
| 569 | 569 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 570 | 570 | $v = $r->value(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | output('<html lang="en"> |
| 5 | 5 | <head><title>phpxmlrpc - Webservice wrapper demo</title></head> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $client->setOption(\PhpXmlRpc\Client::OPT_RETURN_TYPE, 'phpvals'); // let client give us back php values instead of xmlrpcvals |
| 21 | 21 | $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); |
| 22 | 22 | if ($resp->faultCode()) { |
| 23 | - output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n"); |
|
| 23 | + output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n"); |
|
| 24 | 24 | } else { |
| 25 | 25 | output("<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"); |
| 26 | 26 | flush(); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | if ($methodName == 'examples.getStateName') { |
| 33 | 33 | $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); |
| 34 | 34 | if ($callable) { |
| 35 | - output("<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n"); |
|
| 35 | + output("<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n"); |
|
| 36 | 36 | } else { |
| 37 | - output("<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n"); |
|
| 37 | + output("<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n"); |
|
| 38 | 38 | } |
| 39 | 39 | break; |
| 40 | 40 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
| 4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
| 3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
| 4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
| 5 | 5 | |
| 6 | -include_once __DIR__ . '/parse_args.php'; |
|
| 6 | +include_once __DIR__.'/parse_args.php'; |
|
| 7 | 7 | |
| 8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
| 8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
| 9 | 9 | |
| 10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
| 11 | 11 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | protected function tear_down() |
| 34 | 34 | { |
| 35 | - if ($this->args['DEBUG'] > 0) { |
|
| 35 | + if ($this->args['DEBUG']>0) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -50,16 +50,16 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function debug($message, $context = array()) |
| 52 | 52 | { |
| 53 | - $this->buffer .= $message . "\n"; |
|
| 53 | + $this->buffer .= $message."\n"; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function error($message, $context = array()) |
| 57 | 57 | { |
| 58 | - $this->buffer .= $message . "\n"; |
|
| 58 | + $this->buffer .= $message."\n"; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function warning($message, $context = array()) |
| 62 | 62 | { |
| 63 | - $this->buffer .= $message . "\n"; |
|
| 63 | + $this->buffer .= $message."\n"; |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Demoing how to inject a custom logger for use by the library |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | // logger API |
| 22 | 22 | public function debug($message, $context = array()) |
| 23 | 23 | { |
| 24 | - $this->debugBuffer .= $message . "\n"; |
|
| 24 | + $this->debugBuffer .= $message."\n"; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function error($message, $context = array()) |
| 28 | 28 | { |
| 29 | - $this->errorBuffer .= $message . "\n"; |
|
| 29 | + $this->errorBuffer .= $message."\n"; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function warning($message, $context = array()) |
| 33 | 33 | { |
| 34 | - $this->warningBuffer .= $message . "\n"; |
|
| 34 | + $this->warningBuffer .= $message."\n"; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function getDebug() |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $input = array( |
| 64 | 64 | array('name' => 'Dave', 'age' => 24), |
| 65 | - array('name' => 'Edd', 'age' => 45), |
|
| 66 | - array('name' => 'Joe', 'age' => 37), |
|
| 65 | + array('name' => 'Edd', 'age' => 45), |
|
| 66 | + array('name' => 'Joe', 'age' => 37), |
|
| 67 | 67 | array('name' => 'Fred', 'age' => 27), |
| 68 | 68 | ); |
| 69 | 69 | |
@@ -85,6 +85,6 @@ discard block |
||
| 85 | 85 | $response = $client->send($request); |
| 86 | 86 | output("Response received.<br>"); |
| 87 | 87 | |
| 88 | -output("The client error info is:<pre>\n" . $logger->getError() . "\n</pre>"); |
|
| 89 | -output("The client warning info is:<pre>\n" . $logger->getWarning() . "\n</pre>"); |
|
| 90 | -output("The client debug info is:<pre>\n" . $logger->getDebug() . "\n</pre>"); |
|
| 88 | +output("The client error info is:<pre>\n".$logger->getError()."\n</pre>"); |
|
| 89 | +output("The client warning info is:<pre>\n".$logger->getWarning()."\n</pre>"); |
|
| 90 | +output("The client debug info is:<pre>\n".$logger->getDebug()."\n</pre>"); |
|
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | if ($response->faultCode()) { |
| 29 | 29 | throw new HttpException(502, $response->faultString()); |
| 30 | 30 | } else { |
| 31 | - return new Response("<html><body>State number $stateNo is: " . $response->value()->scalarVal() . '</body></html>'); |
|
| 31 | + return new Response("<html><body>State number $stateNo is: ".$response->value()->scalarVal().'</body></html>'); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Demoing the code-generation capabilities of the library: create all that is required to expose as xml-rpc methods |
@@ -38,33 +38,33 @@ discard block |
||
| 38 | 38 | // generate a file with a class definition |
| 39 | 39 | |
| 40 | 40 | // the generated code does not have an autoloader included - we need to add in one |
| 41 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
| 41 | +$autoloader = __DIR__."/_prepend.php"; |
|
| 42 | 42 | |
| 43 | 43 | file_put_contents($targetClassFile, |
| 44 | - "<?php\n\n" . |
|
| 45 | - "require_once '$autoloader';\n\n" . |
|
| 44 | + "<?php\n\n". |
|
| 45 | + "require_once '$autoloader';\n\n". |
|
| 46 | 46 | "class MyServerClass\n{\n\n" |
| 47 | 47 | ) || die('uh oh'); |
| 48 | 48 | |
| 49 | 49 | // we mangle a bit the code we get from wrapPhpClass to turn it into a php class definition instead of a bunch of functions |
| 50 | 50 | |
| 51 | -foreach($code as $methodName => $methodDef) { |
|
| 52 | - file_put_contents($targetClassFile, ' ' . str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source']) . "\n\n", FILE_APPEND) || die('uh oh'); |
|
| 53 | - $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function']; |
|
| 51 | +foreach ($code as $methodName => $methodDef) { |
|
| 52 | + file_put_contents($targetClassFile, ' '.str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source'])."\n\n", FILE_APPEND) || die('uh oh'); |
|
| 53 | + $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function']; |
|
| 54 | 54 | unset($code[$methodName]['source']); |
| 55 | 55 | } |
| 56 | 56 | file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh'); |
| 57 | 57 | |
| 58 | 58 | // generate separate files with the xml-rpc server instantiation and its dispatch map |
| 59 | 59 | |
| 60 | -file_put_contents($targetDispatchMapFile, "<?php\n\nreturn " . var_export($code, true) . ";\n"); |
|
| 60 | +file_put_contents($targetDispatchMapFile, "<?php\n\nreturn ".var_export($code, true).";\n"); |
|
| 61 | 61 | |
| 62 | 62 | file_put_contents($targetControllerFile, |
| 63 | - "<?php\n\n" . |
|
| 63 | + "<?php\n\n". |
|
| 64 | 64 | |
| 65 | - "require_once '$autoloader';\n\n" . |
|
| 65 | + "require_once '$autoloader';\n\n". |
|
| 66 | 66 | |
| 67 | - "require_once '$targetClassFile';\n\n" . |
|
| 67 | + "require_once '$targetClassFile';\n\n". |
|
| 68 | 68 | |
| 69 | 69 | // NB: since we are running the generated code within the same script, the existing CommentManager instance will be |
| 70 | 70 | // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | // Wrapper::holdObject('xmlrpc_CommentManager_addComment', $cm); |
| 75 | 75 | // Wrapper::holdObject('xmlrpc_CommentManager_getComments', $cm); |
| 76 | 76 | |
| 77 | - "\$dm = require_once '$targetDispatchMapFile';\n" . |
|
| 78 | - '$s = new \PhpXmlRpc\Server($dm, false);' . "\n\n" . |
|
| 79 | - '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!' . "\n" . |
|
| 80 | - '$s->setOption(\PhpXmlRpc\Server::OPT_DEBUG, 2);' . "\n" . |
|
| 81 | - '$s->setOption(\PhpXmlRpc\Server::OPT_EXCEPTION_HANDLING, 1);' . "\n\n" . |
|
| 82 | - '$s->service();' . "\n" |
|
| 77 | + "\$dm = require_once '$targetDispatchMapFile';\n". |
|
| 78 | + '$s = new \PhpXmlRpc\Server($dm, false);'."\n\n". |
|
| 79 | + '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!'."\n". |
|
| 80 | + '$s->setOption(\PhpXmlRpc\Server::OPT_DEBUG, 2);'."\n". |
|
| 81 | + '$s->setOption(\PhpXmlRpc\Server::OPT_EXCEPTION_HANDLING, 1);'."\n\n". |
|
| 82 | + '$s->service();'."\n" |
|
| 83 | 83 | ) || die('uh oh'); |
| 84 | 84 | |
| 85 | 85 | // test that everything worked by running it in realtime (note that this script will return an xml-rpc error message if |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $val = reset($ar); |
| 130 | 130 | $typ = key($ar); |
| 131 | 131 | |
| 132 | - return '<value>' . $this->serializeData($typ, $val) . "</value>\n"; |
|
| 132 | + return '<value>'.$this->serializeData($typ, $val)."</value>\n"; |
|
| 133 | 133 | //} |
| 134 | 134 | } |
| 135 | 135 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | // preserve back compatibility |
| 149 | 149 | |
| 150 | 150 | if (is_array($b)) { |
| 151 | - foreach($b as $id => $cont) { |
|
| 151 | + foreach ($b as $id => $cont) { |
|
| 152 | 152 | $b[$id] = $cont->scalarVal(); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | // add support for structures directly encoding php objects |
| 157 | 157 | if (is_object($b)) { |
| 158 | 158 | $t = get_object_vars($b); |
| 159 | - foreach($t as $id => $cont) { |
|
| 159 | + foreach ($t as $id => $cont) { |
|
| 160 | 160 | $t[$id] = $cont->scalarVal(); |
| 161 | 161 | } |
| 162 | - foreach($t as $id => $cont) { |
|
| 162 | + foreach ($t as $id => $cont) { |
|
| 163 | 163 | @$b->$id = $cont; |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -201,17 +201,17 @@ discard block |
||
| 201 | 201 | /* Expose as global functions the ones which are now class methods */ |
| 202 | 202 | |
| 203 | 203 | /// Wrong speling, but we are adamant on backwards compatibility! |
| 204 | -function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='') |
|
| 204 | +function xmlrpc_encode_entitites($data, $srcEncoding = '', $destEncoding = '') |
|
| 205 | 205 | { |
| 206 | 206 | return Charset::instance()->encodeEntities($data, $srcEncoding, $destEncoding); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | -function iso8601_encode($timeT, $utc=0) |
|
| 209 | +function iso8601_encode($timeT, $utc = 0) |
|
| 210 | 210 | { |
| 211 | 211 | return Date::iso8601Encode($timeT, $utc); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | -function iso8601_decode($iDate, $utc=0) |
|
| 214 | +function iso8601_decode($iDate, $utc = 0) |
|
| 215 | 215 | { |
| 216 | 216 | return Date::iso8601Decode($iDate, $utc); |
| 217 | 217 | } |
@@ -221,25 +221,25 @@ discard block |
||
| 221 | 221 | return Http::decodeChunked($buffer); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | -function php_xmlrpc_decode($xmlrpcVal, $options=array()) |
|
| 224 | +function php_xmlrpc_decode($xmlrpcVal, $options = array()) |
|
| 225 | 225 | { |
| 226 | 226 | $encoder = new Encoder(); |
| 227 | 227 | return $encoder->decode($xmlrpcVal, $options); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | -function php_xmlrpc_encode($phpVal, $options=array()) |
|
| 230 | +function php_xmlrpc_encode($phpVal, $options = array()) |
|
| 231 | 231 | { |
| 232 | 232 | $encoder = new Encoder(); |
| 233 | 233 | return $encoder->encode($phpVal, $options); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | -function php_xmlrpc_decode_xml($xmlVal, $options=array()) |
|
| 236 | +function php_xmlrpc_decode_xml($xmlVal, $options = array()) |
|
| 237 | 237 | { |
| 238 | 238 | $encoder = new Encoder(); |
| 239 | 239 | return $encoder->decodeXml($xmlVal, $options); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | -function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null) |
|
| 242 | +function guess_encoding($httpHeader = '', $xmlChunk = '', $encodingPrefs = null) |
|
| 243 | 243 | { |
| 244 | 244 | return XMLParser::guessEncoding($httpHeader, $xmlChunk, $encodingPrefs); |
| 245 | 245 | } |