@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * Please _do not_ copy this file verbatim into your production server. |
11 | 11 | */ |
12 | 12 | |
13 | -require_once __DIR__ . "/_prepend.php"; |
|
13 | +require_once __DIR__."/_prepend.php"; |
|
14 | 14 | |
15 | 15 | use PhpXmlRpc\PhpXmlRpc; |
16 | 16 | use PhpXmlRpc\Server; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } elseif ($_GET['FORCE_AUTH'] == 'Digest') { |
70 | 70 | if (empty($_SERVER['PHP_AUTH_DIGEST'])) { |
71 | 71 | header('HTTP/1.1 401 Unauthorized'); |
72 | - header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"'); |
|
72 | + header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"'); |
|
73 | 73 | die('Text visible if user hits Cancel button'); |
74 | 74 | } |
75 | 75 | } |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | $snv = $sno->scalarval(); |
54 | 54 | |
55 | 55 | // look it up in our array (zero-based) |
56 | - if (isset(self::$stateNames[$snv - 1])) { |
|
57 | - $stateName = self::$stateNames[$snv - 1]; |
|
56 | + if (isset(self::$stateNames[$snv-1])) { |
|
57 | + $stateName = self::$stateNames[$snv-1]; |
|
58 | 58 | } else { |
59 | 59 | // not there, so complain |
60 | - $err = "I don't have a state for the index '" . $snv . "'"; |
|
60 | + $err = "I don't have a state for the index '".$snv."'"; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | if ($err != '') { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $s = $req->getParam(0); |
132 | 132 | $t = $req->getParam(1); |
133 | 133 | |
134 | - return new Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcInt)); |
|
134 | + return new Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcInt)); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | public static $addtwodouble_sig = array(array('double', 'double', 'double')); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $s = $req->getParam(0); |
142 | 142 | $t = $req->getParam(1); |
143 | 143 | |
144 | - return new Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcDouble)); |
|
144 | + return new Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcDouble)); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | public static $stringecho_sig = array(array('string', 'string')); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public static function echoBack($req) |
158 | 158 | { |
159 | 159 | // just sends back a string with what I got sent to me, that's all (escaping for xml is automatic) |
160 | - $s = "I got the following message:\n" . $req->serialize(); |
|
160 | + $s = "I got the following message:\n".$req->serialize(); |
|
161 | 161 | |
162 | 162 | return new Response(new Value($s)); |
163 | 163 | } |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | |
231 | 231 | /// @todo in real life, we should check for presence of return characters to avoid header injection! |
232 | 232 | |
233 | - $msgHdr = "From: " . $mFrom->scalarval() . "\n"; |
|
234 | - $msgHdr .= "To: " . $mTo->scalarval() . "\n"; |
|
233 | + $msgHdr = "From: ".$mFrom->scalarval()."\n"; |
|
234 | + $msgHdr .= "To: ".$mTo->scalarval()."\n"; |
|
235 | 235 | |
236 | 236 | if ($mCc->scalarval() != "") { |
237 | - $msgHdr .= "Cc: " . $mCc->scalarval() . "\n"; |
|
237 | + $msgHdr .= "Cc: ".$mCc->scalarval()."\n"; |
|
238 | 238 | } |
239 | 239 | if ($mBcc->scalarval() != "") { |
240 | - $msgHdr .= "Bcc: " . $mBcc->scalarval() . "\n"; |
|
240 | + $msgHdr .= "Bcc: ".$mBcc->scalarval()."\n"; |
|
241 | 241 | } |
242 | 242 | if ($mMime->scalarval() != "") { |
243 | - $msgHdr .= "Content-type: " . $mMime->scalarval() . "\n"; |
|
243 | + $msgHdr .= "Content-type: ".$mMime->scalarval()."\n"; |
|
244 | 244 | } |
245 | 245 | $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0"; |
246 | 246 |
@@ -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 a client class which exposes a bunch of methods |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | ); |
22 | 22 | |
23 | 23 | // the generated code does not have an autoloader included - we need to add in one |
24 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
24 | +$autoloader = __DIR__."/_prepend.php"; |
|
25 | 25 | |
26 | 26 | $targetFile = '/tmp/MyClient.php'; |
27 | 27 | $generated = file_put_contents($targetFile, |
28 | - "<?php\n\n" . |
|
29 | - "require_once '$autoloader';\n\n" . |
|
28 | + "<?php\n\n". |
|
29 | + "require_once '$autoloader';\n\n". |
|
30 | 30 | $code['code'] |
31 | 31 | ); |
32 | 32 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $client = new MyClient(); |
47 | 47 | $sorted = $client->examples_sortByAge(array( |
48 | 48 | array('name' => 'Dave', 'age' => 24), |
49 | - array('name' => 'Edd', 'age' => 45), |
|
50 | - array('name' => 'Joe', 'age' => 37), |
|
49 | + array('name' => 'Edd', 'age' => 45), |
|
50 | + array('name' => 'Joe', 'age' => 37), |
|
51 | 51 | array('name' => 'Fred', 'age' => 27), |
52 | 52 | )); |
53 | 53 |
@@ -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 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
5 | 5 | |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | // generate a file with a class definition |
23 | 23 | |
24 | 24 | // the generated code does not have an autoloader included - we need to add in one |
25 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
25 | +$autoloader = __DIR__."/_prepend.php"; |
|
26 | 26 | |
27 | 27 | file_put_contents($targetClassFile, |
28 | - "<?php\n\n" . |
|
29 | - "require_once '$autoloader';\n\n" . |
|
28 | + "<?php\n\n". |
|
29 | + "require_once '$autoloader';\n\n". |
|
30 | 30 | "class MyServerClass {\n\n" |
31 | 31 | ) || die('uh oh'); |
32 | 32 | |
33 | 33 | // we mangle a bit the code we get from wrapPhpClass to generate a php class instead of a bunch of functions |
34 | 34 | |
35 | -foreach($code as $methodName => $methodDef) { |
|
36 | - file_put_contents($targetClassFile, 'public static ' . $methodDef['source'] . "\n\n", FILE_APPEND) || die('uh oh'); |
|
37 | - $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function']; |
|
35 | +foreach ($code as $methodName => $methodDef) { |
|
36 | + file_put_contents($targetClassFile, 'public static '.$methodDef['source']."\n\n", FILE_APPEND) || die('uh oh'); |
|
37 | + $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function']; |
|
38 | 38 | unset($code[$methodName]['source']); |
39 | 39 | } |
40 | 40 | file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh'); |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | // generate the separate file with the xml-rpc server and dispatch map |
43 | 43 | |
44 | 44 | file_put_contents($targetServerFile, |
45 | - "<?php\n\n" . |
|
45 | + "<?php\n\n". |
|
46 | 46 | |
47 | - "require_once '$autoloader';\n\n" . |
|
47 | + "require_once '$autoloader';\n\n". |
|
48 | 48 | |
49 | - "require_once '$targetClassFile';\n\n" . |
|
49 | + "require_once '$targetClassFile';\n\n". |
|
50 | 50 | |
51 | 51 | // NB: since we are running the generated code within the same script, the existing CommentManager instance will be |
52 | 52 | // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | // Wrapper::$objHolder['xmlrpc_CommentManager_addComment'] = $cm; |
57 | 57 | // Wrapper::$objHolder['xmlrpc_CommentManager_getComments'] = $cm; |
58 | 58 | |
59 | - '$dm = ' . var_export($code, true) . ";\n" . |
|
60 | - '$s = new \PhpXmlRpc\Server($dm, false);' . "\n" . |
|
61 | - '$s->setDebug(2);' . "\n" . |
|
62 | - '$s->exception_handling = 1;' . "\n" . |
|
63 | - '$s->service();' . "\n" |
|
59 | + '$dm = '.var_export($code, true).";\n". |
|
60 | + '$s = new \PhpXmlRpc\Server($dm, false);'."\n". |
|
61 | + '$s->setDebug(2);'."\n". |
|
62 | + '$s->exception_handling = 1;'."\n". |
|
63 | + '$s->service();'."\n" |
|
64 | 64 | ) || die('uh oh'); |
65 | 65 | |
66 | 66 | // test that everything worked by running it in realtime |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * `$functions_parameters_type` and `$exception_handling` |
9 | 9 | */ |
10 | 10 | |
11 | -require_once __DIR__ . "/_prepend.php"; |
|
11 | +require_once __DIR__."/_prepend.php"; |
|
12 | 12 | |
13 | 13 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
14 | 14 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | |
20 | 20 | $addComment_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcString, Value::$xmlrpcString, Value::$xmlrpcString)); |
21 | 21 | |
22 | -$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, ' . |
|
22 | +$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, '. |
|
23 | 23 | 'and the third is the comment itself. Returns the number of comments against that ID.'; |
24 | 24 | |
25 | 25 | $getComments_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcString)); |
26 | 26 | |
27 | -$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct ' . |
|
27 | +$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct '. |
|
28 | 28 | 'containing name and comment text.'; |
29 | 29 | |
30 | 30 | $srv = new Server(array( |