@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public static function getOpts($args=array(), $cliOpts=array()) |
|
| 60 | + public static function getOpts($args = array(), $cliOpts = array()) |
|
| 61 | 61 | { |
| 62 | - if (count($args) > 0) |
|
| 62 | + if (count($args)>0) |
|
| 63 | 63 | // throw new \Exception('Missing library version argument'); |
| 64 | 64 | self::$libVersion = $args[0]; |
| 65 | 65 | |
@@ -157,17 +157,17 @@ discard block |
||
| 157 | 157 | $out = ''; |
| 158 | 158 | while (($start = strpos($content, $startTag, $last)) !== false) { |
| 159 | 159 | $end = strpos($content, $endTag, $start); |
| 160 | - $code = substr($content, $start + strlen($startTag), $end - $start - strlen($startTag)); |
|
| 161 | - if ($code[strlen($code) - 1] == "\n") { |
|
| 160 | + $code = substr($content, $start+strlen($startTag), $end-$start-strlen($startTag)); |
|
| 161 | + if ($code[strlen($code)-1] == "\n") { |
|
| 162 | 162 | $code = substr($code, 0, -1); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $code = str_replace(array('>', '<'), array('>', '<'), $code); |
| 166 | - $code = highlight_string('<?php ' . $code, true); |
|
| 166 | + $code = highlight_string('<?php '.$code, true); |
|
| 167 | 167 | $code = str_replace('<span style="color: #0000BB"><?php <br />', '<span style="color: #0000BB">', $code); |
| 168 | 168 | |
| 169 | - $out = $out . substr($content, $last, $start + strlen($startTag) - $last) . $code . $endTag; |
|
| 170 | - $last = $end + strlen($endTag); |
|
| 169 | + $out = $out.substr($content, $last, $start+strlen($startTag)-$last).$code.$endTag; |
|
| 170 | + $last = $end+strlen($endTag); |
|
| 171 | 171 | } |
| 172 | 172 | $out .= substr($content, $last, strlen($content)); |
| 173 | 173 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | use PhpXmlRpc\Builder; |
| 183 | 183 | |
| 184 | -function run_default($task=null, $args=array(), $cliOpts=array()) |
|
| 184 | +function run_default($task = null, $args = array(), $cliOpts = array()) |
|
| 185 | 185 | { |
| 186 | 186 | echo "Syntax: pake {\$pake-options} \$task \$lib-version [\$git-tag] {\$task-options}\n"; |
| 187 | 187 | echo "\n"; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | echo " --zip=ZIP Location of the zip tool\n"; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | -function run_getopts($task=null, $args=array(), $cliOpts=array()) |
|
| 201 | +function run_getopts($task = null, $args = array(), $cliOpts = array()) |
|
| 202 | 202 | { |
| 203 | 203 | Builder::getOpts($args, $cliOpts); |
| 204 | 204 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | /** |
| 207 | 207 | * Downloads source code in the build workspace directory, optionally checking out the given branch/tag |
| 208 | 208 | */ |
| 209 | -function run_init($task=null, $args=array(), $cliOpts=array()) |
|
| 209 | +function run_init($task = null, $args = array(), $cliOpts = array()) |
|
| 210 | 210 | { |
| 211 | 211 | // download the current version into the workspace |
| 212 | 212 | $targetDir = Builder::workspaceDir(); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * (does nothing by itself, as all the steps are managed via task dependencies) |
| 236 | 236 | */ |
| 237 | -function run_build($task=null, $args=array(), $cliOpts=array()) |
|
| 237 | +function run_build($task = null, $args = array(), $cliOpts = array()) |
|
| 238 | 238 | { |
| 239 | 239 | } |
| 240 | 240 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | /** |
| 251 | 251 | * Generates documentation in all formats |
| 252 | 252 | */ |
| 253 | -function run_doc($task=null, $args=array(), $cliOpts=array()) |
|
| 253 | +function run_doc($task = null, $args = array(), $cliOpts = array()) |
|
| 254 | 254 | { |
| 255 | 255 | $docDir = Builder::workspaceDir().'/doc'; |
| 256 | 256 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | /** |
| 319 | 319 | * Creates the tarballs for a release |
| 320 | 320 | */ |
| 321 | -function run_dist($task=null, $args=array(), $cliOpts=array()) |
|
| 321 | +function run_dist($task = null, $args = array(), $cliOpts = array()) |
|
| 322 | 322 | { |
| 323 | 323 | // copy workspace dir into dist dir, without git |
| 324 | 324 | pake_mkdirs(Builder::distDir()); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | // create tarballs |
| 333 | 333 | $cwd = getcwd(); |
| 334 | 334 | chdir(dirname(Builder::distDir())); |
| 335 | - foreach(Builder::distFiles() as $distFile) { |
|
| 335 | + foreach (Builder::distFiles() as $distFile) { |
|
| 336 | 336 | // php can not really create good zip files via phar: they are not compressed! |
| 337 | 337 | if (substr($distFile, -4) == '.zip') { |
| 338 | 338 | $cmd = Builder::tool('zip'); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | chdir($cwd); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | -function run_clean_workspace($task=null, $args=array(), $cliOpts=array()) |
|
| 353 | +function run_clean_workspace($task = null, $args = array(), $cliOpts = array()) |
|
| 354 | 354 | { |
| 355 | 355 | pake_remove_dir(Builder::workspaceDir()); |
| 356 | 356 | } |
@@ -359,13 +359,13 @@ discard block |
||
| 359 | 359 | * Cleans up the whole build directory |
| 360 | 360 | * @todo 'make clean' usually just removes the results of the build, distclean removes all but sources |
| 361 | 361 | */ |
| 362 | -function run_clean($task=null, $args=array(), $cliOpts=array()) |
|
| 362 | +function run_clean($task = null, $args = array(), $cliOpts = array()) |
|
| 363 | 363 | { |
| 364 | 364 | pake_remove_dir(Builder::buildDir()); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | // helper task: display help text |
| 368 | -pake_task( 'default' ); |
|
| 368 | +pake_task('default'); |
|
| 369 | 369 | // internal task: parse cli options |
| 370 | 370 | pake_task('getopts'); |
| 371 | 371 | pake_task('init', 'getopts'); |
@@ -27,8 +27,9 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public static function libVersion() |
| 29 | 29 | { |
| 30 | - if (self::$libVersion == null) |
|
| 31 | - throw new \Exception('Missing library version argument'); |
|
| 30 | + if (self::$libVersion == null) { |
|
| 31 | + throw new \Exception('Missing library version argument'); |
|
| 32 | + } |
|
| 32 | 33 | return self::$libVersion; |
| 33 | 34 | } |
| 34 | 35 | |
@@ -59,9 +60,10 @@ discard block |
||
| 59 | 60 | |
| 60 | 61 | public static function getOpts($args=array(), $cliOpts=array()) |
| 61 | 62 | { |
| 62 | - if (count($args) > 0) |
|
| 63 | - // throw new \Exception('Missing library version argument'); |
|
| 63 | + if (count($args) > 0) { |
|
| 64 | + // throw new \Exception('Missing library version argument'); |
|
| 64 | 65 | self::$libVersion = $args[0]; |
| 66 | + } |
|
| 65 | 67 | |
| 66 | 68 | foreach (self::$tools as $name => $binary) { |
| 67 | 69 | if (isset($cliOpts[$name])) { |
@@ -338,8 +340,7 @@ discard block |
||
| 338 | 340 | $cmd = Builder::tool('zip'); |
| 339 | 341 | $extra = '-9 -r'; |
| 340 | 342 | pake_sh("$cmd $distFile $extra ".basename(Builder::distDir())); |
| 341 | - } |
|
| 342 | - else { |
|
| 343 | + } else { |
|
| 343 | 344 | $finder = pakeFinder::type('any')->pattern(basename(Builder::distDir()).'/**'); |
| 344 | 345 | // see https://bugs.php.net/bug.php?id=58852 |
| 345 | 346 | $pharFile = str_replace(Builder::libVersion(), '_LIBVERSION_', $distFile); |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | if (isset($_GET['run'])) { |
| 4 | 4 | $path = parse_url($_GET['run']); |
| 5 | 5 | if (isset($path['query'])) { |
| 6 | - $query = '?' . $path['query']; |
|
| 6 | + $query = '?'.$path['query']; |
|
| 7 | 7 | } |
| 8 | 8 | } |
| 9 | 9 | ?> |
@@ -12,7 +12,12 @@ |
||
| 12 | 12 | <html lang="en"> |
| 13 | 13 | <head> |
| 14 | 14 | <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico"> |
| 15 | - <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) echo 'JSONRPC'; else echo 'XMLRPC'; ?> Debugger</title> |
|
| 15 | + <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) { |
|
| 16 | + echo 'JSONRPC'; |
|
| 17 | +} else { |
|
| 18 | + echo 'XMLRPC'; |
|
| 19 | +} |
|
| 20 | +?> Debugger</title> |
|
| 16 | 21 | </head> |
| 17 | 22 | <frameset rows="360,*"> |
| 18 | 23 | <frame name="frmcontroller" src="controller.php<?php echo htmlspecialchars($query); ?>" marginwidth="0" |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @license code licensed under the BSD License: see file license.txt |
| 7 | 7 | **/ |
| 8 | 8 | |
| 9 | -$coverageFile = realpath(__DIR__ . "/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php"); |
|
| 9 | +$coverageFile = realpath(__DIR__."/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php"); |
|
| 10 | 10 | |
| 11 | 11 | // has to be the same value as used in server.php |
| 12 | 12 | $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage'; |
@@ -561,8 +561,9 @@ discard block |
||
| 561 | 561 | } |
| 562 | 562 | foreach ($parsVariations as $i => $pars) { |
| 563 | 563 | $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
| 564 | - if ($i < (count($parsVariations) - 1)) |
|
| 565 | - $innerCode .= "else\n"; |
|
| 564 | + if ($i < (count($parsVariations) - 1)) { |
|
| 565 | + $innerCode .= "else\n"; |
|
| 566 | + } |
|
| 566 | 567 | } |
| 567 | 568 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
| 568 | 569 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
@@ -615,7 +616,7 @@ discard block |
||
| 615 | 616 | if ($methodWrap) { |
| 616 | 617 | if (is_object($className)) { |
| 617 | 618 | $realClassName = get_class($className); |
| 618 | - }else { |
|
| 619 | + } else { |
|
| 619 | 620 | $realClassName = $className; |
| 620 | 621 | } |
| 621 | 622 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -167,20 +167,20 @@ discard block |
||
| 167 | 167 | $callable = explode('::', $callable); |
| 168 | 168 | } |
| 169 | 169 | if (is_array($callable)) { |
| 170 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
| 171 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
| 170 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
| 171 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | 174 | if (is_string($callable[0])) { |
| 175 | 175 | $plainFuncName = implode('::', $callable); |
| 176 | 176 | } elseif (is_object($callable[0])) { |
| 177 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
| 177 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
| 178 | 178 | } |
| 179 | 179 | $exists = method_exists($callable[0], $callable[1]); |
| 180 | 180 | } else if ($callable instanceof \Closure) { |
| 181 | 181 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
| 182 | 182 | if (!$buildIt) { |
| 183 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
| 183 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
| 184 | 184 | return false; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (!$exists) { |
| 195 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
| 195 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
| 196 | 196 | return false; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -236,23 +236,23 @@ discard block |
||
| 236 | 236 | if (is_array($callable)) { |
| 237 | 237 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
| 238 | 238 | if ($func->isPrivate()) { |
| 239 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
| 239 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | if ($func->isProtected()) { |
| 243 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
| 243 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | if ($func->isConstructor()) { |
| 247 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
| 247 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
| 248 | 248 | return false; |
| 249 | 249 | } |
| 250 | 250 | if ($func->isDestructor()) { |
| 251 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
| 251 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
| 252 | 252 | return false; |
| 253 | 253 | } |
| 254 | 254 | if ($func->isAbstract()) { |
| 255 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
| 255 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
| 256 | 256 | return false; |
| 257 | 257 | } |
| 258 | 258 | /// @todo add more checks for static vs. nonstatic? |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | if ($func->isInternal()) { |
| 263 | 263 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
| 264 | 264 | // instead of getparameters to fully reflect internal php functions ? |
| 265 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
| 265 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
| 266 | 266 | return false; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $i = 0; |
| 315 | 315 | foreach ($func->getParameters() as $paramObj) { |
| 316 | 316 | $params[$i] = array(); |
| 317 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
| 317 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
| 318 | 318 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
| 319 | 319 | $i++; |
| 320 | 320 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | // build a signature |
| 380 | 380 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
| 381 | 381 | $pSig = array($funcDesc['returnsDocs']); |
| 382 | - for ($i = 0; $i < count($pars); $i++) { |
|
| 382 | + for ($i = 0; $i<count($pars); $i++) { |
|
| 383 | 383 | $name = strtolower($funcDesc['params'][$i]['name']); |
| 384 | 384 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
| 385 | 385 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | $numPars = $req->getNumParams(); |
| 437 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
| 437 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
| 438 | 438 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
| 439 | 439 | } |
| 440 | 440 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | $result = call_user_func_array($callable, $params); |
| 449 | 449 | |
| 450 | - if (! is_a($result, $responseClass)) { |
|
| 450 | + if (!is_a($result, $responseClass)) { |
|
| 451 | 451 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
| 452 | 452 | $result = new $valueClass($result, $funcDesc['returns']); |
| 453 | 453 | } else { |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | if ($newFuncName == '') { |
| 483 | 483 | if (is_array($callable)) { |
| 484 | 484 | if (is_string($callable[0])) { |
| 485 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
| 485 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
| 486 | 486 | } else { |
| 487 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
| 487 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
| 488 | 488 | } |
| 489 | 489 | } else { |
| 490 | 490 | if ($callable instanceof \Closure) { |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | { |
| 521 | 521 | $namespace = '\\PhpXmlRpc\\'; |
| 522 | 522 | |
| 523 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
| 524 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
| 523 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
| 524 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
| 525 | 525 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
| 526 | 526 | |
| 527 | 527 | $i = 0; |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | // build body of new function |
| 557 | 557 | |
| 558 | 558 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
| 559 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
| 559 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
| 560 | 560 | |
| 561 | 561 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
| 562 | 562 | if ($decodePhpObjects) { |
@@ -570,13 +570,13 @@ discard block |
||
| 570 | 570 | if (is_array($callable) && is_object($callable[0])) { |
| 571 | 571 | self::$objHolder[$newFuncName] = $callable[0]; |
| 572 | 572 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
| 573 | - $realFuncName = '$obj->' . $callable[1]; |
|
| 573 | + $realFuncName = '$obj->'.$callable[1]; |
|
| 574 | 574 | } else { |
| 575 | 575 | $realFuncName = $plainFuncName; |
| 576 | 576 | } |
| 577 | 577 | foreach ($parsVariations as $i => $pars) { |
| 578 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
| 579 | - if ($i < (count($parsVariations) - 1)) |
|
| 578 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
| 579 | + if ($i<(count($parsVariations)-1)) |
|
| 580 | 580 | $innerCode .= "else\n"; |
| 581 | 581 | } |
| 582 | 582 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | // if($func->returnsReference()) |
| 594 | 594 | // return false; |
| 595 | 595 | |
| 596 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
| 596 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
| 597 | 597 | |
| 598 | 598 | return $code; |
| 599 | 599 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | if ($methodWrap) { |
| 631 | 631 | if (is_object($className)) { |
| 632 | 632 | $realClassName = get_class($className); |
| 633 | - }else { |
|
| 633 | + } else { |
|
| 634 | 634 | $realClassName = $className; |
| 635 | 635 | } |
| 636 | 636 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -731,21 +731,21 @@ discard block |
||
| 731 | 731 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
| 732 | 732 | { |
| 733 | 733 | $namespace = '\\PhpXmlRpc\\'; |
| 734 | - $reqClass = $namespace . 'Request'; |
|
| 735 | - $valClass = $namespace . 'Value'; |
|
| 736 | - $decoderClass = $namespace . 'Encoder'; |
|
| 734 | + $reqClass = $namespace.'Request'; |
|
| 735 | + $valClass = $namespace.'Value'; |
|
| 736 | + $decoderClass = $namespace.'Encoder'; |
|
| 737 | 737 | |
| 738 | 738 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
| 739 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
| 739 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
| 740 | 740 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
| 741 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
| 741 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
| 742 | 742 | |
| 743 | 743 | $req = new $reqClass('system.methodSignature'); |
| 744 | 744 | $req->addparam(new $valClass($methodName)); |
| 745 | 745 | $client->setDebug($debug); |
| 746 | 746 | $response = $client->send($req, $timeout, $protocol); |
| 747 | 747 | if ($response->faultCode()) { |
| 748 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
| 748 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
| 749 | 749 | return false; |
| 750 | 750 | } |
| 751 | 751 | |
@@ -755,8 +755,8 @@ discard block |
||
| 755 | 755 | $mSig = $decoder->decode($mSig); |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
| 759 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
| 758 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
| 759 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
| 760 | 760 | return false; |
| 761 | 761 | } |
| 762 | 762 | |
@@ -772,11 +772,11 @@ discard block |
||
| 772 | 772 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
| 773 | 773 | { |
| 774 | 774 | $namespace = '\\PhpXmlRpc\\'; |
| 775 | - $reqClass = $namespace . 'Request'; |
|
| 776 | - $valClass = $namespace . 'Value'; |
|
| 775 | + $reqClass = $namespace.'Request'; |
|
| 776 | + $valClass = $namespace.'Value'; |
|
| 777 | 777 | |
| 778 | 778 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
| 779 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
| 779 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
| 780 | 780 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
| 781 | 781 | |
| 782 | 782 | $mDesc = ''; |
@@ -810,10 +810,10 @@ discard block |
||
| 810 | 810 | $clientClone = clone $client; |
| 811 | 811 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
| 812 | 812 | { |
| 813 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
| 813 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
| 814 | 814 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
| 815 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
| 816 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
| 815 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
| 816 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
| 817 | 817 | if (isset($extraOptions['return_on_fault'])) { |
| 818 | 818 | $decodeFault = true; |
| 819 | 819 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -822,9 +822,9 @@ discard block |
||
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | $namespace = '\\PhpXmlRpc\\'; |
| 825 | - $reqClass = $namespace . 'Request'; |
|
| 826 | - $encoderClass = $namespace . 'Encoder'; |
|
| 827 | - $valueClass = $namespace . 'Value'; |
|
| 825 | + $reqClass = $namespace.'Request'; |
|
| 826 | + $encoderClass = $namespace.'Encoder'; |
|
| 827 | + $valueClass = $namespace.'Value'; |
|
| 828 | 828 | |
| 829 | 829 | $encoder = new $encoderClass(); |
| 830 | 830 | $encodeOptions = array(); |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | $xmlrpcArgs = array(); |
| 850 | - foreach($currentArgs as $i => $arg) { |
|
| 850 | + foreach ($currentArgs as $i => $arg) { |
|
| 851 | 851 | if ($i == $maxArgs) { |
| 852 | 852 | break; |
| 853 | 853 | } |
@@ -895,13 +895,13 @@ discard block |
||
| 895 | 895 | * @param string $mDesc |
| 896 | 896 | * @return string[] keys: source, docstring |
| 897 | 897 | */ |
| 898 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
| 898 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
| 899 | 899 | { |
| 900 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
| 900 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
| 901 | 901 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
| 902 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
| 903 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
| 904 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
| 902 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
| 903 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
| 904 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
| 905 | 905 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
| 906 | 906 | if (isset($extraOptions['return_on_fault'])) { |
| 907 | 907 | $decodeFault = true; |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | $namespace = '\\PhpXmlRpc\\'; |
| 915 | 915 | |
| 916 | 916 | $code = "function $newFuncName ("; |
| 917 | - if ($clientCopyMode < 2) { |
|
| 917 | + if ($clientCopyMode<2) { |
|
| 918 | 918 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
| 919 | 919 | $verbatimClientCopy = !$clientCopyMode; |
| 920 | 920 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | |
| 930 | 930 | if ($mDesc != '') { |
| 931 | 931 | // take care that PHP comment is not terminated unwillingly by method description |
| 932 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
| 932 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
| 933 | 933 | } else { |
| 934 | 934 | $mDesc = "/**\nFunction $newFuncName\n"; |
| 935 | 935 | } |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
| 939 | 939 | $plist = array(); |
| 940 | 940 | $pCount = count($mSig); |
| 941 | - for ($i = 1; $i < $pCount; $i++) { |
|
| 941 | + for ($i = 1; $i<$pCount; $i++) { |
|
| 942 | 942 | $plist[] = "\$p$i"; |
| 943 | 943 | $pType = $mSig[$i]; |
| 944 | 944 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -954,19 +954,19 @@ discard block |
||
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
| 957 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
| 957 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
| 958 | 958 | } |
| 959 | - if ($clientCopyMode < 2) { |
|
| 959 | + if ($clientCopyMode<2) { |
|
| 960 | 960 | $plist[] = '$debug=0'; |
| 961 | 961 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
| 962 | 962 | } |
| 963 | 963 | $plist = implode(', ', $plist); |
| 964 | - $mDesc .= '* @return {$namespace}Response|' . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 964 | + $mDesc .= '* @return {$namespace}Response|'.$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 965 | 965 | |
| 966 | 966 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
| 967 | 967 | if ($decodeFault) { |
| 968 | 968 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
| 969 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
| 969 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
| 970 | 970 | } else { |
| 971 | 971 | $respCode = var_export($faultResponse, true); |
| 972 | 972 | } |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
| 982 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
| 983 | 983 | |
| 984 | 984 | return array('source' => $code, 'docstring' => $mDesc); |
| 985 | 985 | } |
@@ -1005,23 +1005,23 @@ discard block |
||
| 1005 | 1005 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
| 1006 | 1006 | { |
| 1007 | 1007 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
| 1008 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
| 1008 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
| 1009 | 1009 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
| 1010 | 1010 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
| 1011 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
| 1012 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
| 1011 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
| 1012 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
| 1013 | 1013 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
| 1014 | 1014 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
| 1015 | 1015 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
| 1016 | 1016 | $namespace = '\\PhpXmlRpc\\'; |
| 1017 | 1017 | |
| 1018 | - $reqClass = $namespace . 'Request'; |
|
| 1019 | - $decoderClass = $namespace . 'Encoder'; |
|
| 1018 | + $reqClass = $namespace.'Request'; |
|
| 1019 | + $decoderClass = $namespace.'Encoder'; |
|
| 1020 | 1020 | |
| 1021 | 1021 | $req = new $reqClass('system.listMethods'); |
| 1022 | 1022 | $response = $client->send($req, $timeout, $protocol); |
| 1023 | 1023 | if ($response->faultCode()) { |
| 1024 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
| 1024 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
| 1025 | 1025 | |
| 1026 | 1026 | return false; |
| 1027 | 1027 | } else { |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | $mList = $decoder->decode($mList); |
| 1032 | 1032 | } |
| 1033 | 1033 | if (!is_array($mList) || !count($mList)) { |
| 1034 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
| 1034 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
| 1035 | 1035 | |
| 1036 | 1036 | return false; |
| 1037 | 1037 | } else { |
@@ -1039,8 +1039,8 @@ discard block |
||
| 1039 | 1039 | if ($newClassName != '') { |
| 1040 | 1040 | $xmlrpcClassName = $newClassName; |
| 1041 | 1041 | } else { |
| 1042 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
| 1043 | - array('_', ''), $client->server) . '_client'; |
|
| 1042 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
| 1043 | + array('_', ''), $client->server).'_client'; |
|
| 1044 | 1044 | } |
| 1045 | 1045 | while ($buildIt && class_exists($xmlrpcClassName)) { |
| 1046 | 1046 | $xmlrpcClassName .= 'x'; |
@@ -1071,20 +1071,20 @@ discard block |
||
| 1071 | 1071 | if (!$buildIt) { |
| 1072 | 1072 | $source .= $methodWrap['docstring']; |
| 1073 | 1073 | } |
| 1074 | - $source .= $methodWrap['source'] . "\n"; |
|
| 1074 | + $source .= $methodWrap['source']."\n"; |
|
| 1075 | 1075 | } else { |
| 1076 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
| 1076 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| 1080 | 1080 | $source .= "}\n"; |
| 1081 | 1081 | if ($buildIt) { |
| 1082 | 1082 | $allOK = 0; |
| 1083 | - eval($source . '$allOK=1;'); |
|
| 1083 | + eval($source.'$allOK=1;'); |
|
| 1084 | 1084 | if ($allOK) { |
| 1085 | 1085 | return $xmlrpcClassName; |
| 1086 | 1086 | } else { |
| 1087 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
| 1087 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
| 1088 | 1088 | return false; |
| 1089 | 1089 | } |
| 1090 | 1090 | } else { |
@@ -1105,10 +1105,10 @@ discard block |
||
| 1105 | 1105 | * |
| 1106 | 1106 | * @return string |
| 1107 | 1107 | */ |
| 1108 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
| 1108 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
| 1109 | 1109 | { |
| 1110 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
| 1111 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
| 1110 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
| 1111 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
| 1112 | 1112 | |
| 1113 | 1113 | // copy all client fields to the client that will be generated runtime |
| 1114 | 1114 | // (this provides for future expansion or subclassing of client obj) |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if (is_file($file = __DIR__ . str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
| 32 | + if (is_file($file = __DIR__.str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
| 33 | 33 | require $file; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -141,9 +141,9 @@ |
||
| 141 | 141 | * @deprecated |
| 142 | 142 | */ |
| 143 | 143 | function build_remote_method_wrapper_code($client, $methodName, $xmlrpcFuncName, |
| 144 | - $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', |
|
| 145 | - $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, |
|
| 146 | - $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
|
| 144 | + $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', |
|
| 145 | + $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, |
|
| 146 | + $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
|
| 147 | 147 | { |
| 148 | 148 | $code = "function $xmlrpcFuncName ("; |
| 149 | 149 | if ($clientCopyMode < 2) { |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | * @param array $extraOptions |
| 42 | 42 | * @return array|false |
| 43 | 43 | */ |
| 44 | -function wrap_php_function($funcName, $newFuncName='', $extraOptions=array()) |
|
| 44 | +function wrap_php_function($funcName, $newFuncName = '', $extraOptions = array()) |
|
| 45 | 45 | { |
| 46 | 46 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 47 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 47 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 48 | 48 | // backwards compat: return string instead of callable |
| 49 | 49 | $extraOptions['return_source'] = true; |
| 50 | 50 | $wrapped = $wrapper->wrapPhpFunction($funcName, $newFuncName, $extraOptions); |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | * @param array $extraOptions |
| 65 | 65 | * @return array|false |
| 66 | 66 | */ |
| 67 | -function wrap_php_class($className, $extraOptions=array()) |
|
| 67 | +function wrap_php_class($className, $extraOptions = array()) |
|
| 68 | 68 | { |
| 69 | 69 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 70 | 70 | $fix = false; |
| 71 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 71 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 72 | 72 | // backwards compat: return string instead of callable |
| 73 | 73 | $extraOptions['return_source'] = true; |
| 74 | 74 | $fix = true; |
| 75 | 75 | } |
| 76 | 76 | $wrapped = $wrapper->wrapPhpClass($className, $extraOptions); |
| 77 | - foreach($wrapped as $name => $value) { |
|
| 77 | + foreach ($wrapped as $name => $value) { |
|
| 78 | 78 | if ($fix) { |
| 79 | 79 | eval($value['source']); |
| 80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $newFuncName deprecated, use an option in $extraOptions |
| 94 | 94 | * @return array|callable|false |
| 95 | 95 | */ |
| 96 | -function wrap_xmlrpc_method($client, $methodName, $extraOptions=0, $timeout=0, $protocol='', $newFuncName='') |
|
| 96 | +function wrap_xmlrpc_method($client, $methodName, $extraOptions = 0, $timeout = 0, $protocol = '', $newFuncName = '') |
|
| 97 | 97 | { |
| 98 | 98 | if (!is_array($extraOptions)) |
| 99 | 99 | { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 110 | 110 | |
| 111 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 111 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 112 | 112 | // backwards compat: return string instead of callable |
| 113 | 113 | $extraOptions['return_source'] = true; |
| 114 | 114 | $wrapped = $wrapper->wrapXmlrpcMethod($client, $methodName, $extraOptions); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param array $extraOptions |
| 127 | 127 | * @return mixed |
| 128 | 128 | */ |
| 129 | -function wrap_xmlrpc_server($client, $extraOptions=array()) |
|
| 129 | +function wrap_xmlrpc_server($client, $extraOptions = array()) |
|
| 130 | 130 | { |
| 131 | 131 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 132 | 132 | return $wrapper->wrapXmlrpcServer($client, $extraOptions); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
| 147 | 147 | { |
| 148 | 148 | $code = "function $xmlrpcFuncName ("; |
| 149 | - if ($clientCopyMode < 2) { |
|
| 149 | + if ($clientCopyMode<2) { |
|
| 150 | 150 | // client copy mode 0 or 1 == partial / full client copy in emitted code |
| 151 | 151 | $innerCode = build_client_wrapper_code($client, $clientCopyMode, $prefix, $namespace); |
| 152 | 152 | $innerCode .= "\$client->setDebug(\$debug);\n"; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if ($mDesc != '') { |
| 162 | 162 | // take care that PHP comment is not terminated unwillingly by method description |
| 163 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
| 163 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
| 164 | 164 | } else { |
| 165 | 165 | $mDesc = "/**\nFunction $xmlrpcFuncName\n"; |
| 166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
| 170 | 170 | $plist = array(); |
| 171 | 171 | $pCount = count($mSig); |
| 172 | - for ($i = 1; $i < $pCount; $i++) { |
|
| 172 | + for ($i = 1; $i<$pCount; $i++) { |
|
| 173 | 173 | $plist[] = "\$p$i"; |
| 174 | 174 | $pType = $mSig[$i]; |
| 175 | 175 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -185,19 +185,19 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
| 188 | - $mDesc .= '* @param ' . xmlrpc_2_php_type($pType) . " \$p$i\n"; |
|
| 188 | + $mDesc .= '* @param '.xmlrpc_2_php_type($pType)." \$p$i\n"; |
|
| 189 | 189 | } |
| 190 | - if ($clientCopyMode < 2) { |
|
| 190 | + if ($clientCopyMode<2) { |
|
| 191 | 191 | $plist[] = '$debug=0'; |
| 192 | 192 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
| 193 | 193 | } |
| 194 | 194 | $plist = implode(', ', $plist); |
| 195 | - $mDesc .= '* @return ' . xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 195 | + $mDesc .= '* @return '.xmlrpc_2_php_type($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 196 | 196 | |
| 197 | 197 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
| 198 | 198 | if ($decodeFault) { |
| 199 | 199 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
| 200 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
| 200 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
| 201 | 201 | } else { |
| 202 | 202 | $respCode = var_export($faultResponse, true); |
| 203 | 203 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
| 213 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
| 214 | 214 | |
| 215 | 215 | return array('source' => $code, 'docstring' => $mDesc); |
| 216 | 216 | } |
@@ -218,18 +218,18 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * @deprecated |
| 220 | 220 | */ |
| 221 | -function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
|
| 221 | +function build_client_wrapper_code($client, $verbatim_client_copy, $prefix = 'xmlrpc') |
|
| 222 | 222 | { |
| 223 | 223 | $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). |
| 224 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
| 224 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
| 225 | 225 | |
| 226 | 226 | // copy all client fields to the client that will be generated runtime |
| 227 | 227 | // (this provides for future expansion or subclassing of client obj) |
| 228 | 228 | if ($verbatim_client_copy) |
| 229 | 229 | { |
| 230 | - foreach($client as $fld => $val) |
|
| 230 | + foreach ($client as $fld => $val) |
|
| 231 | 231 | { |
| 232 | - if($fld != 'debug' && $fld != 'return_type') |
|
| 232 | + if ($fld != 'debug' && $fld != 'return_type') |
|
| 233 | 233 | { |
| 234 | 234 | $val = var_export($val, true); |
| 235 | 235 | $code .= "\$client->$fld = $val;\n"; |
@@ -39,10 +39,10 @@ |
||
| 39 | 39 | $flags = ENT_COMPAT; |
| 40 | 40 | // avoid warnings on php < 5.4... |
| 41 | 41 | if (defined('ENT_HTML401')) { |
| 42 | - $flags = $flags | ENT_HTML401; |
|
| 42 | + $flags = $flags | ENT_HTML401; |
|
| 43 | 43 | } |
| 44 | 44 | if (defined('ENT_SUBSTITUTE')) { |
| 45 | - $flags = $flags | ENT_SUBSTITUTE; |
|
| 45 | + $flags = $flags | ENT_SUBSTITUTE; |
|
| 46 | 46 | } |
| 47 | 47 | if ($encoding != null) { |
| 48 | 48 | print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>"; |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | $server = $parts['host']; |
| 136 | 136 | $path = isset($parts['path']) ? $parts['path'] : ''; |
| 137 | 137 | if (isset($parts['query'])) { |
| 138 | - $path .= '?' . $parts['query']; |
|
| 138 | + $path .= '?'.$parts['query']; |
|
| 139 | 139 | } |
| 140 | 140 | if (isset($parts['fragment'])) { |
| 141 | - $path .= '#' . $parts['fragment']; |
|
| 141 | + $path .= '#'.$parts['fragment']; |
|
| 142 | 142 | } |
| 143 | 143 | if (isset($parts['port'])) { |
| 144 | 144 | $port = $parts['port']; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | if ($path == '' || $path[0] != '/') { |
| 157 | - $this->path = '/' . $path; |
|
| 157 | + $this->path = '/'.$path; |
|
| 158 | 158 | } else { |
| 159 | 159 | $this->path = $path; |
| 160 | 160 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | }*/ |
| 193 | 193 | |
| 194 | 194 | // initialize user_agent string |
| 195 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
| 195 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | */ |
| 565 | 565 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
| 566 | 566 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
| 567 | - $method='http') |
|
| 567 | + $method = 'http') |
|
| 568 | 568 | { |
| 569 | 569 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
| 570 | 570 | |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * @param int $sslVersion |
| 597 | 597 | * @return Response |
| 598 | 598 | */ |
| 599 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
| 599 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
| 600 | 600 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
| 601 | 601 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
| 602 | 602 | $sslVersion = 0) |
@@ -633,11 +633,11 @@ discard block |
||
| 633 | 633 | */ |
| 634 | 634 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
| 635 | 635 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
| 636 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
| 636 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
| 637 | 637 | $sslVersion = 0) |
| 638 | 638 | { |
| 639 | 639 | if ($port == 0) { |
| 640 | - $port = ( $method === 'https' ) ? 443 : 80; |
|
| 640 | + $port = ($method === 'https') ? 443 : 80; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | // Only create the payload if it was not created previously |
@@ -667,15 +667,15 @@ discard block |
||
| 667 | 667 | // thanks to Grant Rauscher <[email protected]> for this |
| 668 | 668 | $credentials = ''; |
| 669 | 669 | if ($username != '') { |
| 670 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
| 670 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
| 671 | 671 | if ($authType != 1) { |
| 672 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 672 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | $acceptedEncoding = ''; |
| 677 | 677 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
| 678 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
| 678 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | $proxyCredentials = ''; |
@@ -686,17 +686,17 @@ discard block |
||
| 686 | 686 | $connectServer = $proxyHost; |
| 687 | 687 | $connectPort = $proxyPort; |
| 688 | 688 | $transport = 'tcp'; |
| 689 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
| 689 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
| 690 | 690 | if ($proxyUsername != '') { |
| 691 | 691 | if ($proxyAuthType != 1) { |
| 692 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 692 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 693 | 693 | } |
| 694 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
| 694 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
| 695 | 695 | } |
| 696 | 696 | } else { |
| 697 | 697 | $connectServer = $server; |
| 698 | 698 | $connectPort = $port; |
| 699 | - $transport = ( $method === 'https' ) ? 'tls' : 'tcp'; |
|
| 699 | + $transport = ($method === 'https') ? 'tls' : 'tcp'; |
|
| 700 | 700 | $uri = $this->path; |
| 701 | 701 | } |
| 702 | 702 | |
@@ -706,45 +706,45 @@ discard block |
||
| 706 | 706 | $version = ''; |
| 707 | 707 | foreach ($this->cookies as $name => $cookie) { |
| 708 | 708 | if ($cookie['version']) { |
| 709 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
| 710 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
| 709 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
| 710 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
| 711 | 711 | if ($cookie['path']) { |
| 712 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
| 712 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
| 713 | 713 | } |
| 714 | 714 | if ($cookie['domain']) { |
| 715 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
| 715 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
| 716 | 716 | } |
| 717 | 717 | if ($cookie['port']) { |
| 718 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
| 718 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
| 719 | 719 | } |
| 720 | 720 | } else { |
| 721 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
| 721 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
| 722 | 722 | } |
| 723 | 723 | } |
| 724 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
| 724 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | // omit port if default |
| 728 | 728 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
| 729 | - $port = ''; |
|
| 729 | + $port = ''; |
|
| 730 | 730 | } else { |
| 731 | - $port = ':' . $port; |
|
| 731 | + $port = ':'.$port; |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
| 735 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
| 736 | - 'Host: ' . $server . $port . "\r\n" . |
|
| 737 | - $credentials . |
|
| 738 | - $proxyCredentials . |
|
| 739 | - $acceptedEncoding . |
|
| 740 | - $encodingHdr . |
|
| 741 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
| 742 | - $cookieHeader . |
|
| 743 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
| 744 | - strlen($payload) . "\r\n\r\n" . |
|
| 734 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
| 735 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
| 736 | + 'Host: '.$server.$port."\r\n". |
|
| 737 | + $credentials. |
|
| 738 | + $proxyCredentials. |
|
| 739 | + $acceptedEncoding. |
|
| 740 | + $encodingHdr. |
|
| 741 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
| 742 | + $cookieHeader. |
|
| 743 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
| 744 | + strlen($payload)."\r\n\r\n". |
|
| 745 | 745 | $payload; |
| 746 | 746 | |
| 747 | - if ($this->debug > 1) { |
|
| 747 | + if ($this->debug>1) { |
|
| 748 | 748 | Logger::instance()->debugMessage("---SENDING---\n$op\n---END---"); |
| 749 | 749 | } |
| 750 | 750 | |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | } |
| 771 | 771 | $context = stream_context_create($contextOptions); |
| 772 | 772 | |
| 773 | - if ($timeout <= 0) { |
|
| 773 | + if ($timeout<=0) { |
|
| 774 | 774 | $connectTimeout = ini_get('default_socket_timeout'); |
| 775 | 775 | } else { |
| 776 | 776 | $connectTimeout = $timeout; |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
| 783 | 783 | STREAM_CLIENT_CONNECT, $context); |
| 784 | 784 | if ($fp) { |
| 785 | - if ($timeout > 0) { |
|
| 785 | + if ($timeout>0) { |
|
| 786 | 786 | stream_set_timeout($fp, $timeout); |
| 787 | 787 | } |
| 788 | 788 | } else { |
@@ -790,8 +790,8 @@ discard block |
||
| 790 | 790 | $err = error_get_last(); |
| 791 | 791 | $this->errstr = $err['message']; |
| 792 | 792 | } |
| 793 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
| 794 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
| 793 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
| 794 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
| 795 | 795 | |
| 796 | 796 | return $r; |
| 797 | 797 | } |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | $encodingHdr = ''; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - if ($this->debug > 1) { |
|
| 901 | + if ($this->debug>1) { |
|
| 902 | 902 | Logger::instance()->debugMessage("---SENDING---\n$payload\n---END---"); |
| 903 | 903 | } |
| 904 | 904 | |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | } else { |
| 909 | 909 | $protocol = $method; |
| 910 | 910 | } |
| 911 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
| 911 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
| 912 | 912 | if ($keepAlive) { |
| 913 | 913 | $this->xmlrpc_curl_handle = $curl; |
| 914 | 914 | } |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | // results into variable |
| 920 | 920 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 921 | 921 | |
| 922 | - if ($this->debug > 1) { |
|
| 922 | + if ($this->debug>1) { |
|
| 923 | 923 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
| 924 | 924 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
| 925 | 925 | } |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | } |
| 945 | 945 | } |
| 946 | 946 | // extra headers |
| 947 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
| 947 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
| 948 | 948 | // if no keepalive is wanted, let the server know it in advance |
| 949 | 949 | if (!$keepAlive) { |
| 950 | 950 | $headers[] = 'Connection: close'; |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
| 962 | 962 | // timeout is borked |
| 963 | 963 | if ($timeout) { |
| 964 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
| 964 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | if ($method == 'http10') { |
@@ -971,11 +971,11 @@ discard block |
||
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | if ($username && $password) { |
| 974 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
| 974 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
| 975 | 975 | if (defined('CURLOPT_HTTPAUTH')) { |
| 976 | 976 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
| 977 | 977 | } elseif ($authType != 1) { |
| 978 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 978 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 979 | 979 | } |
| 980 | 980 | } |
| 981 | 981 | |
@@ -1017,13 +1017,13 @@ discard block |
||
| 1017 | 1017 | if ($proxyPort == 0) { |
| 1018 | 1018 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
| 1019 | 1019 | } |
| 1020 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
| 1020 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
| 1021 | 1021 | if ($proxyUsername) { |
| 1022 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
| 1022 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
| 1023 | 1023 | if (defined('CURLOPT_PROXYAUTH')) { |
| 1024 | 1024 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
| 1025 | 1025 | } elseif ($proxyAuthType != 1) { |
| 1026 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1026 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | if (count($this->cookies)) { |
| 1034 | 1034 | $cookieHeader = ''; |
| 1035 | 1035 | foreach ($this->cookies as $name => $cookie) { |
| 1036 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
| 1036 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
| 1039 | 1039 | } |
@@ -1044,13 +1044,13 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | $result = curl_exec($curl); |
| 1046 | 1046 | |
| 1047 | - if ($this->debug > 1) { |
|
| 1047 | + if ($this->debug>1) { |
|
| 1048 | 1048 | $message = "---CURL INFO---\n"; |
| 1049 | 1049 | foreach (curl_getinfo($curl) as $name => $val) { |
| 1050 | 1050 | if (is_array($val)) { |
| 1051 | 1051 | $val = implode("\n", $val); |
| 1052 | 1052 | } |
| 1053 | - $message .= $name . ': ' . $val . "\n"; |
|
| 1053 | + $message .= $name.': '.$val."\n"; |
|
| 1054 | 1054 | } |
| 1055 | 1055 | $message .= '---END---'; |
| 1056 | 1056 | Logger::instance()->debugMessage($message); |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | /// @todo we should use a better check here - what if we get back '' or '0'? |
| 1061 | 1061 | |
| 1062 | 1062 | $this->errstr = 'no response'; |
| 1063 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
| 1063 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
| 1064 | 1064 | curl_close($curl); |
| 1065 | 1065 | if ($keepAlive) { |
| 1066 | 1066 | $this->xmlrpc_curl_handle = null; |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | $call['methodName'] = new Value($req->method(), 'string'); |
| 1171 | 1171 | $numParams = $req->getNumParams(); |
| 1172 | 1172 | $params = array(); |
| 1173 | - for ($i = 0; $i < $numParams; $i++) { |
|
| 1173 | + for ($i = 0; $i<$numParams; $i++) { |
|
| 1174 | 1174 | $params[$i] = $req->getParam($i); |
| 1175 | 1175 | } |
| 1176 | 1176 | $call['params'] = new Value($params, 'array'); |
@@ -1196,15 +1196,15 @@ discard block |
||
| 1196 | 1196 | /// @todo test this code branch... |
| 1197 | 1197 | $rets = $result->value(); |
| 1198 | 1198 | if (!is_array($rets)) { |
| 1199 | - return false; // bad return type from system.multicall |
|
| 1199 | + return false; // bad return type from system.multicall |
|
| 1200 | 1200 | } |
| 1201 | 1201 | $numRets = count($rets); |
| 1202 | 1202 | if ($numRets != count($reqs)) { |
| 1203 | - return false; // wrong number of return values. |
|
| 1203 | + return false; // wrong number of return values. |
|
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | $response = array(); |
| 1207 | - for ($i = 0; $i < $numRets; $i++) { |
|
| 1207 | + for ($i = 0; $i<$numRets; $i++) { |
|
| 1208 | 1208 | $val = $rets[$i]; |
| 1209 | 1209 | if (!is_array($val)) { |
| 1210 | 1210 | return false; |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | switch (count($val)) { |
| 1213 | 1213 | case 1: |
| 1214 | 1214 | if (!isset($val[0])) { |
| 1215 | - return false; // Bad value |
|
| 1215 | + return false; // Bad value |
|
| 1216 | 1216 | } |
| 1217 | 1217 | // Normal return value |
| 1218 | 1218 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1240,19 +1240,19 @@ discard block |
||
| 1240 | 1240 | |
| 1241 | 1241 | $rets = $result->value(); |
| 1242 | 1242 | if ($rets->kindOf() != 'array') { |
| 1243 | - return false; // bad return type from system.multicall |
|
| 1243 | + return false; // bad return type from system.multicall |
|
| 1244 | 1244 | } |
| 1245 | 1245 | $numRets = $rets->count(); |
| 1246 | 1246 | if ($numRets != count($reqs)) { |
| 1247 | - return false; // wrong number of return values. |
|
| 1247 | + return false; // wrong number of return values. |
|
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | $response = array(); |
| 1251 | - foreach($rets as $val) { |
|
| 1251 | + foreach ($rets as $val) { |
|
| 1252 | 1252 | switch ($val->kindOf()) { |
| 1253 | 1253 | case 'array': |
| 1254 | 1254 | if ($val->count() != 1) { |
| 1255 | - return false; // Bad value |
|
| 1255 | + return false; // Bad value |
|
| 1256 | 1256 | } |
| 1257 | 1257 | // Normal return value |
| 1258 | 1258 | $response[] = new Response($val[0]); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // check for command line (env vars) vs. web page input params |
| 45 | 45 | if (!isset($_SERVER['REQUEST_METHOD'])) { |
| 46 | - foreach($_SERVER as $key => $val) { |
|
| 46 | + foreach ($_SERVER as $key => $val) { |
|
| 47 | 47 | if (array_key_exists($key, $args)) { |
| 48 | 48 | $$key = $val; |
| 49 | 49 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | if ($HTTPURI[0] != '/') { |
| 90 | - $HTTPURI = '/' . $HTTPURI; |
|
| 90 | + $HTTPURI = '/'.$HTTPURI; |
|
| 91 | 91 | } |
| 92 | 92 | $args['HTTPURI'] = $HTTPURI; |
| 93 | 93 | |
@@ -101,21 +101,21 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | if (isset($HTTPSIGNOREPEER)) { |
| 104 | - $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER; |
|
| 104 | + $args['HTTPSIGNOREPEER'] = (bool) $HTTPSIGNOREPEER; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (isset($HTTPSVERIFYHOST)) { |
| 108 | - $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST; |
|
| 108 | + $args['HTTPSVERIFYHOST'] = (int) $HTTPSVERIFYHOST; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if (isset($SSLVERSION)) { |
| 112 | - $args['SSLVERSION'] = (int)$SSLVERSION; |
|
| 112 | + $args['SSLVERSION'] = (int) $SSLVERSION; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | if (isset($PROXYSERVER)) { |
| 116 | 116 | $arr = explode(':', $PROXYSERVER); |
| 117 | 117 | $args['PROXYSERVER'] = $arr[0]; |
| 118 | - if (count($arr) > 1) { |
|
| 118 | + if (count($arr)>1) { |
|
| 119 | 119 | $args['PROXYPORT'] = $arr[1]; |
| 120 | 120 | } else { |
| 121 | 121 | $args['PROXYPORT'] = 8080; |