@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function make($string, $data = null) |
| 27 | 27 | { |
| 28 | - if (!strlen($string)) |
|
| 29 | - return array(); |
|
| 28 | + if (!strlen($string)) { |
|
| 29 | + return array(); |
|
| 30 | + } |
|
| 30 | 31 | |
| 31 | 32 | $implicitTag = |
| 32 | 33 | function () use (& $tag) { |
@@ -66,8 +67,8 @@ discard block |
||
| 66 | 67 | & $tokens, & $tag |
| 67 | 68 | ) { |
| 68 | 69 | $digits = 0; |
| 69 | - if ($delimiter == null) |
|
| 70 | - $delimiter = array( |
|
| 70 | + if ($delimiter == null) { |
|
| 71 | + $delimiter = array( |
|
| 71 | 72 | '.' => true, |
| 72 | 73 | '#' => true, |
| 73 | 74 | '*' => true, |
@@ -78,6 +79,7 @@ discard block |
||
| 78 | 79 | ']' => true, |
| 79 | 80 | '=' => true, |
| 80 | 81 | ); |
| 82 | + } |
|
| 81 | 83 | while (!empty($tokens) && |
| 82 | 84 | !isset($delimiter[$t = array_shift($tokens)])) { |
| 83 | 85 | while ('$' === $t) { |
@@ -126,8 +128,9 @@ discard block |
||
| 126 | 128 | $text .= $t; |
| 127 | 129 | } |
| 128 | 130 | } |
| 129 | - if (isset($t)) |
|
| 130 | - array_unshift($tokens, $t); |
|
| 131 | + if (isset($t)) { |
|
| 132 | + array_unshift($tokens, $t); |
|
| 133 | + } |
|
| 131 | 134 | return $text; |
| 132 | 135 | }; |
| 133 | 136 | |
@@ -137,8 +140,9 @@ discard block |
||
| 137 | 140 | $a = $parseText( |
| 138 | 141 | '', $round, $total, $data |
| 139 | 142 | ); |
| 140 | - if (is_null($a)) |
|
| 141 | - return; |
|
| 143 | + if (is_null($a)) { |
|
| 144 | + return; |
|
| 145 | + } |
|
| 142 | 146 | if ('=' == ($v = array_shift($tokens))) { |
| 143 | 147 | //value |
| 144 | 148 | if ('"' == ($v = array_shift($tokens))) { |
@@ -266,11 +270,13 @@ discard block |
||
| 266 | 270 | break; |
| 267 | 271 | } |
| 268 | 272 | $tag = $tag->parent; |
| 269 | - if ($tag->parent) |
|
| 270 | - $tag = $tag->parent; |
|
| 273 | + if ($tag->parent) { |
|
| 274 | + $tag = $tag->parent; |
|
| 275 | + } |
|
| 271 | 276 | while ('^' == ($t = array_shift($tokens))) { |
| 272 | - if ($tag->parent) |
|
| 273 | - $tag = $tag->parent; |
|
| 277 | + if ($tag->parent) { |
|
| 278 | + $tag = $tag->parent; |
|
| 279 | + } |
|
| 274 | 280 | } |
| 275 | 281 | $child = new T($t); |
| 276 | 282 | $tag[] = $child; |
@@ -78,7 +78,9 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | if (static::$authenticatedUsagePerUnit |
| 80 | 80 | == static::$usagePerUnit |
| 81 | - ) return $this->check(); |
|
| 81 | + ) { |
|
| 82 | + return $this->check(); |
|
| 83 | + } |
|
| 82 | 84 | return null; |
| 83 | 85 | } |
| 84 | 86 | |
@@ -90,11 +92,12 @@ discard block |
||
| 90 | 92 | |
| 91 | 93 | private static function validate($unit) |
| 92 | 94 | { |
| 93 | - if (!isset(static::$units[$unit])) |
|
| 94 | - throw new \InvalidArgumentException( |
|
| 95 | + if (!isset(static::$units[$unit])) { |
|
| 96 | + throw new \InvalidArgumentException( |
|
| 95 | 97 | 'Rate Limit time unit should be ' |
| 96 | 98 | . implode('|', array_keys(static::$units)) . '.' |
| 97 | 99 | ); |
| 100 | + } |
|
| 98 | 101 | } |
| 99 | 102 | |
| 100 | 103 | private function check($isAuthenticated = false) |
@@ -106,8 +106,9 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | static::$haveHeaders ? $keys = $row : $decoded[] = $row; |
| 108 | 108 | |
| 109 | - while (($row = static::getRow(array_shift($lines), $keys)) !== FALSE) |
|
| 110 | - $decoded [] = $row; |
|
| 109 | + while (($row = static::getRow(array_shift($lines), $keys)) !== FALSE) { |
|
| 110 | + $decoded [] = $row; |
|
| 111 | + } |
|
| 111 | 112 | |
| 112 | 113 | $char = Obj::$separatorChar; |
| 113 | 114 | Obj::$separatorChar = false; |
@@ -130,11 +131,13 @@ discard block |
||
| 130 | 131 | |
| 131 | 132 | $row = array(); |
| 132 | 133 | foreach ($line as $key => $value) { |
| 133 | - if (is_numeric($value)) |
|
| 134 | - $value = floatval($value); |
|
| 134 | + if (is_numeric($value)) { |
|
| 135 | + $value = floatval($value); |
|
| 136 | + } |
|
| 135 | 137 | if ($keys) { |
| 136 | - if (isset($keys [$key])) |
|
| 137 | - $row [$keys [$key]] = $value; |
|
| 138 | + if (isset($keys [$key])) { |
|
| 139 | + $row [$keys [$key]] = $value; |
|
| 140 | + } |
|
| 138 | 141 | } else { |
| 139 | 142 | $row [$key] = $value; |
| 140 | 143 | } |
@@ -169,8 +172,9 @@ discard block |
||
| 169 | 172 | |
| 170 | 173 | static::$haveHeaders ? $keys = $row : $decoded[] = $row; |
| 171 | 174 | |
| 172 | - while (($row = static::getRow(stream_get_line($stream, 0, PHP_EOL), $keys)) !== FALSE) |
|
| 173 | - $decoded [] = $row; |
|
| 175 | + while (($row = static::getRow(stream_get_line($stream, 0, PHP_EOL), $keys)) !== FALSE) { |
|
| 176 | + $decoded [] = $row; |
|
| 177 | + } |
|
| 174 | 178 | |
| 175 | 179 | $char = Obj::$separatorChar; |
| 176 | 180 | Obj::$separatorChar = false; |
@@ -118,8 +118,9 @@ discard block |
||
| 118 | 118 | foreach ($file as $property => $value) { |
| 119 | 119 | $innerFile[$property] = $value[$i]; |
| 120 | 120 | } |
| 121 | - if ($innerFile['name']) |
|
| 122 | - static::checkFile($innerFile, $doMimeCheck, $doSizeCheck); |
|
| 121 | + if ($innerFile['name']) { |
|
| 122 | + static::checkFile($innerFile, $doMimeCheck, $doSizeCheck); |
|
| 123 | + } |
|
| 123 | 124 | |
| 124 | 125 | if (isset($innerFile['exception'])) { |
| 125 | 126 | $file['error'][$i] = $innerFile['error']; |
@@ -128,8 +129,9 @@ discard block |
||
| 128 | 129 | } |
| 129 | 130 | } |
| 130 | 131 | } else { |
| 131 | - if ($file['name']) |
|
| 132 | - static::checkFile($file, $doMimeCheck, $doSizeCheck); |
|
| 132 | + if ($file['name']) { |
|
| 133 | + static::checkFile($file, $doMimeCheck, $doSizeCheck); |
|
| 134 | + } |
|
| 133 | 135 | if (isset($innerFile['exception'])) { |
| 134 | 136 | break; |
| 135 | 137 | } |
@@ -124,9 +124,10 @@ discard block |
||
| 124 | 124 | $metadata['param'] = array(); |
| 125 | 125 | } |
| 126 | 126 | if (isset($metadata['return']['type'])) { |
| 127 | - if ($qualified = Scope::resolve($metadata['return']['type'], $scope)) |
|
| 128 | - list($metadata['return']['type'], $metadata['return']['children']) = |
|
| 127 | + if ($qualified = Scope::resolve($metadata['return']['type'], $scope)) { |
|
| 128 | + list($metadata['return']['type'], $metadata['return']['children']) = |
|
| 129 | 129 | static::getTypeAndModel(new ReflectionClass($qualified), $scope); |
| 130 | + } |
|
| 130 | 131 | } else { |
| 131 | 132 | //assume return type is array |
| 132 | 133 | $metadata['return']['type'] = 'array'; |
@@ -147,8 +148,9 @@ discard block |
||
| 147 | 148 | $m[$dataName] = array(); |
| 148 | 149 | } |
| 149 | 150 | $p = &$m[$dataName]; |
| 150 | - if (empty($m['label'])) |
|
| 151 | - $m['label'] = Text::title($m['name']); |
|
| 151 | + if (empty($m['label'])) { |
|
| 152 | + $m['label'] = Text::title($m['name']); |
|
| 153 | + } |
|
| 152 | 154 | if (is_null($type) && isset($m['type'])) { |
| 153 | 155 | $type = $m['type']; |
| 154 | 156 | } |
@@ -307,8 +309,9 @@ discard block |
||
| 307 | 309 | } |
| 308 | 310 | $lastPathParam = end($pathParams); |
| 309 | 311 | foreach ($pathParams as $position) { |
| 310 | - if (!empty($url)) |
|
| 311 | - $url .= '/'; |
|
| 312 | + if (!empty($url)) { |
|
| 313 | + $url .= '/'; |
|
| 314 | + } |
|
| 312 | 315 | $url .= '{' . |
| 313 | 316 | static::typeChar(isset($call['metadata']['param'][$position]['type']) |
| 314 | 317 | ? $call['metadata']['param'][$position]['type'] |
@@ -356,8 +359,9 @@ discard block |
||
| 356 | 359 | } else { |
| 357 | 360 | static::$routes["v$version"][$path][$httpMethod] = $call; |
| 358 | 361 | //create an alias with index if the method name is index |
| 359 | - if ($call['methodName'] == 'index') |
|
| 360 | - static::$routes["v$version"][ltrim("$path/index", '/')][$httpMethod] = $call; |
|
| 362 | + if ($call['methodName'] == 'index') { |
|
| 363 | + static::$routes["v$version"][ltrim("$path/index", '/')][$httpMethod] = $call; |
|
| 364 | + } |
|
| 361 | 365 | } |
| 362 | 366 | } |
| 363 | 367 | |
@@ -407,8 +411,9 @@ discard block |
||
| 407 | 411 | } |
| 408 | 412 | //================== dynamic routes ============================= |
| 409 | 413 | //add newline char if trailing slash is found |
| 410 | - if (substr($path, -1) == '/') |
|
| 411 | - $path .= PHP_EOL; |
|
| 414 | + if (substr($path, -1) == '/') { |
|
| 415 | + $path .= PHP_EOL; |
|
| 416 | + } |
|
| 412 | 417 | //if double slash is found fill in newline char; |
| 413 | 418 | $path = str_replace('//', '/' . PHP_EOL . '/', $path); |
| 414 | 419 | ksort($p); |
@@ -474,8 +479,9 @@ discard block |
||
| 474 | 479 | } |
| 475 | 480 | foreach ($excludedPaths as $exclude) { |
| 476 | 481 | if (empty($exclude)) { |
| 477 | - if ($fullPath == $exclude || $fullPath == 'index') |
|
| 478 | - continue 2; |
|
| 482 | + if ($fullPath == $exclude || $fullPath == 'index') { |
|
| 483 | + continue 2; |
|
| 484 | + } |
|
| 479 | 485 | } elseif (Text::beginsWith($fullPath, $exclude)) { |
| 480 | 486 | continue 2; |
| 481 | 487 | } |
@@ -495,13 +501,15 @@ discard block |
||
| 495 | 501 | |
| 496 | 502 | public static function verifyAccess($route) |
| 497 | 503 | { |
| 498 | - if ($route['accessLevel'] < 2) |
|
| 499 | - return true; |
|
| 504 | + if ($route['accessLevel'] < 2) { |
|
| 505 | + return true; |
|
| 506 | + } |
|
| 500 | 507 | /** @var Restler $r */ |
| 501 | 508 | $r = Scope::get('Restler'); |
| 502 | 509 | $authenticated = $r->_authenticated; |
| 503 | - if (!$authenticated && $route['accessLevel'] > 1) |
|
| 504 | - return false; |
|
| 510 | + if (!$authenticated && $route['accessLevel'] > 1) { |
|
| 511 | + return false; |
|
| 512 | + } |
|
| 505 | 513 | if ( |
| 506 | 514 | $authenticated && |
| 507 | 515 | Defaults::$accessControlFunction && |
@@ -568,8 +576,9 @@ discard block |
||
| 568 | 576 | $modifier = "_modify_{$r->methodName}_api"; |
| 569 | 577 | if (method_exists($r->className, $modifier)) { |
| 570 | 578 | $stage = end(Scope::get('Restler')->getEvents()); |
| 571 | - if (empty($stage)) |
|
| 572 | - $stage = 'setup'; |
|
| 579 | + if (empty($stage)) { |
|
| 580 | + $stage = 'setup'; |
|
| 581 | + } |
|
| 573 | 582 | $r = Scope::get($r->className)->$modifier($r, $stage) ? : $r; |
| 574 | 583 | } |
| 575 | 584 | return $r; |
@@ -758,10 +767,18 @@ discard block |
||
| 758 | 767 | |
| 759 | 768 | public static function type($var) |
| 760 | 769 | { |
| 761 | - if (is_object($var)) return get_class($var); |
|
| 762 | - if (is_array($var)) return 'array'; |
|
| 763 | - if (is_bool($var)) return 'boolean'; |
|
| 764 | - if (is_numeric($var)) return is_float($var) ? 'float' : 'int'; |
|
| 770 | + if (is_object($var)) { |
|
| 771 | + return get_class($var); |
|
| 772 | + } |
|
| 773 | + if (is_array($var)) { |
|
| 774 | + return 'array'; |
|
| 775 | + } |
|
| 776 | + if (is_bool($var)) { |
|
| 777 | + return 'boolean'; |
|
| 778 | + } |
|
| 779 | + if (is_numeric($var)) { |
|
| 780 | + return is_float($var) ? 'float' : 'int'; |
|
| 781 | + } |
|
| 765 | 782 | return 'string'; |
| 766 | 783 | } |
| 767 | 784 | |
@@ -782,8 +799,9 @@ discard block |
||
| 782 | 799 | if ($reading && ',' == $token) { |
| 783 | 800 | //===== STOP =====// |
| 784 | 801 | $reading = false; |
| 785 | - if (!empty($namespace)) |
|
| 786 | - $imports[$alias] = trim($namespace, '\\'); |
|
| 802 | + if (!empty($namespace)) { |
|
| 803 | + $imports[$alias] = trim($namespace, '\\'); |
|
| 804 | + } |
|
| 787 | 805 | //===== START =====// |
| 788 | 806 | $reading = true; |
| 789 | 807 | $namespace = ''; |
@@ -791,8 +809,9 @@ discard block |
||
| 791 | 809 | } else { |
| 792 | 810 | //===== STOP =====// |
| 793 | 811 | $reading = false; |
| 794 | - if (!empty($namespace)) |
|
| 795 | - $imports[$alias] = trim($namespace, '\\'); |
|
| 812 | + if (!empty($namespace)) { |
|
| 813 | + $imports[$alias] = trim($namespace, '\\'); |
|
| 814 | + } |
|
| 796 | 815 | } |
| 797 | 816 | } elseif (T_USE == $token[0]) { |
| 798 | 817 | //===== START =====// |
@@ -44,8 +44,9 @@ discard block |
||
| 44 | 44 | public function __call($eventName, $params) |
| 45 | 45 | { |
| 46 | 46 | if (0 === strpos($eventName, 'on')) { |
| 47 | - if (!isset($this->listeners[$eventName]) || !is_array($this->listeners[$eventName])) |
|
| 48 | - $this->listeners[$eventName] = array(); |
|
| 47 | + if (!isset($this->listeners[$eventName]) || !is_array($this->listeners[$eventName])) { |
|
| 48 | + $this->listeners[$eventName] = array(); |
|
| 49 | + } |
|
| 49 | 50 | $this->listeners[$eventName][] = $params[0]; |
| 50 | 51 | } |
| 51 | 52 | return $this; |
@@ -89,9 +90,10 @@ discard block |
||
| 89 | 90 | $this->events[] = $eventName; |
| 90 | 91 | $params = func_get_args(); |
| 91 | 92 | $eventName = 'on'.ucfirst(array_shift($params)); |
| 92 | - if (isset($this->listeners[$eventName])) |
|
| 93 | - foreach ($this->listeners[$eventName] as $callback) |
|
| 93 | + if (isset($this->listeners[$eventName])) { |
|
| 94 | + foreach ($this->listeners[$eventName] as $callback) |
|
| 94 | 95 | call_user_func_array($callback, $params); |
| 96 | + } |
|
| 95 | 97 | } |
| 96 | 98 | |
| 97 | 99 | } |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | . 'requested-attributes' |
| 86 | 86 | . self::_giveMeStringLength($attributes[0]) |
| 87 | 87 | . $attributes[0]; |
| 88 | - } |
|
| 89 | - else |
|
| 88 | + } else |
|
| 90 | 89 | { |
| 91 | 90 | $this->meta->attributes .= chr(0x44) // Keyword |
| 92 | 91 | . chr(0x0).chr(0x0) // zero-length name |
@@ -141,15 +140,13 @@ discard block |
||
| 141 | 140 | if ($this->serveroutput->status == "successfull-ok") |
| 142 | 141 | { |
| 143 | 142 | self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
| 144 | - } |
|
| 145 | - else |
|
| 143 | + } else |
|
| 146 | 144 | { |
| 147 | 145 | self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
| 148 | 146 | } |
| 149 | 147 | |
| 150 | 148 | return $this->serveroutput->status; |
| 151 | - } |
|
| 152 | - else |
|
| 149 | + } else |
|
| 153 | 150 | { |
| 154 | 151 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
| 155 | 152 | self::_errorLog("getting defaults : OPERATION FAILED",1); |
@@ -215,15 +212,13 @@ discard block |
||
| 215 | 212 | if ($this->serveroutput->status == "successfull-ok") |
| 216 | 213 | { |
| 217 | 214 | self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
| 218 | - } |
|
| 219 | - else |
|
| 215 | + } else |
|
| 220 | 216 | { |
| 221 | 217 | self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
| 222 | 218 | } |
| 223 | 219 | |
| 224 | 220 | return $this->serveroutput->status; |
| 225 | - } |
|
| 226 | - else |
|
| 221 | + } else |
|
| 227 | 222 | { |
| 228 | 223 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
| 229 | 224 | self::_errorLog("getting defaults : OPERATION FAILED",1); |
@@ -301,15 +296,13 @@ discard block |
||
| 301 | 296 | if ($this->serveroutput->status == "successfull-ok") |
| 302 | 297 | { |
| 303 | 298 | self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
| 304 | - } |
|
| 305 | - else |
|
| 299 | + } else |
|
| 306 | 300 | { |
| 307 | 301 | self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
| 308 | 302 | } |
| 309 | 303 | |
| 310 | 304 | return $this->serveroutput->status; |
| 311 | - } |
|
| 312 | - else |
|
| 305 | + } else |
|
| 313 | 306 | { |
| 314 | 307 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
| 315 | 308 | self::_errorLog("getting defaults : OPERATION FAILED",1); |
@@ -371,8 +364,7 @@ discard block |
||
| 371 | 364 | . 'requested-attributes' |
| 372 | 365 | . self::_giveMeStringLength($attributes[0]) |
| 373 | 366 | . $attributes[0]; |
| 374 | - } |
|
| 375 | - else |
|
| 367 | + } else |
|
| 376 | 368 | { |
| 377 | 369 | $this->meta->attributes .= chr(0x44) // Keyword |
| 378 | 370 | . chr(0x0).chr(0x0) // zero-length name |
@@ -411,14 +403,12 @@ discard block |
||
| 411 | 403 | if ($this->serveroutput->status == "successfull-ok") |
| 412 | 404 | { |
| 413 | 405 | self::_errorLog("getting printers: ".$this->serveroutput->status,3); |
| 414 | - } |
|
| 415 | - else |
|
| 406 | + } else |
|
| 416 | 407 | { |
| 417 | 408 | self::_errorLog("getting printers: ".$this->serveroutput->status,1); |
| 418 | 409 | } |
| 419 | 410 | return $this->serveroutput->status; |
| 420 | - } |
|
| 421 | - else |
|
| 411 | + } else |
|
| 422 | 412 | { |
| 423 | 413 | $this->status = array_merge($this->status,array("OPERATION FAILED")); |
| 424 | 414 | self::_errorLog("getting printers : OPERATION FAILED",1); |
@@ -544,8 +534,9 @@ discard block |
||
| 544 | 534 | } |
| 545 | 535 | |
| 546 | 536 | $prepend = ''; |
| 547 | - while ((strlen($value_built) + strlen($prepend)) < 4) |
|
| 548 | - $prepend .= chr(0); |
|
| 537 | + while ((strlen($value_built) + strlen($prepend)) < 4) { |
|
| 538 | + $prepend .= chr(0); |
|
| 539 | + } |
|
| 549 | 540 | return $prepend.$value_built; |
| 550 | 541 | } |
| 551 | 542 | |
@@ -478,8 +478,9 @@ |
||
| 478 | 478 | } |
| 479 | 479 | $nc = sprintf('%x', $this->nc); |
| 480 | 480 | $prepend = ""; |
| 481 | - while ((strlen($nc) + strlen($prepend)) < 8) |
|
| 482 | - $prependi .= "0"; |
|
| 481 | + while ((strlen($nc) + strlen($prepend)) < 8) { |
|
| 482 | + $prependi .= "0"; |
|
| 483 | + } |
|
| 483 | 484 | $nc = $prepend.$nc; |
| 484 | 485 | $cnonce = "printipp"; |
| 485 | 486 | $username = $this->user; |
@@ -78,8 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $post_values = array_merge($post_values,array("Filetype"=>"TEXT")); |
| 80 | 80 | } |
| 81 | - } |
|
| 82 | - else |
|
| 81 | + } else |
|
| 83 | 82 | { |
| 84 | 83 | self::_putDebug( _("Printing DATA\n"),3); |
| 85 | 84 | |
@@ -99,8 +98,7 @@ discard block |
||
| 99 | 98 | $this->_getJobId(); |
| 100 | 99 | $this->_getJobUri(); |
| 101 | 100 | $this->_parseJobAttributes(); |
| 102 | - } |
|
| 103 | - else |
|
| 101 | + } else |
|
| 104 | 102 | { |
| 105 | 103 | $this->jobs = array_merge($this->jobs,array('')); |
| 106 | 104 | $this->jobs_uri = array_merge($this->jobs_uri,array('')); |
@@ -114,8 +112,7 @@ discard block |
||
| 114 | 112 | if ($this->serveroutput->status == "successfull-ok") |
| 115 | 113 | { |
| 116 | 114 | self::_errorLog(sprintf("printing job %s: ",$this->last_job) .$this->serveroutput->status,3); |
| 117 | - } |
|
| 118 | - else |
|
| 115 | + } else |
|
| 119 | 116 | { |
| 120 | 117 | $this->jobs = array_merge($this->jobs,array("")); |
| 121 | 118 | $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
@@ -168,8 +165,7 @@ discard block |
||
| 168 | 165 | if ($this->serveroutput->status == "successfull-ok") |
| 169 | 166 | { |
| 170 | 167 | self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status,3); |
| 171 | - } |
|
| 172 | - else |
|
| 168 | + } else |
|
| 173 | 169 | { |
| 174 | 170 | self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status,1); |
| 175 | 171 | } |
@@ -212,8 +208,7 @@ discard block |
||
| 212 | 208 | if (array_key_exists(0,$this->available_printers)) |
| 213 | 209 | { |
| 214 | 210 | self::setPrinterURI($this->available_printers[0]); |
| 215 | - } |
|
| 216 | - else |
|
| 211 | + } else |
|
| 217 | 212 | { |
| 218 | 213 | trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
| 219 | 214 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -252,8 +247,7 @@ discard block |
||
| 252 | 247 | if (is_readable($this->data)) |
| 253 | 248 | { |
| 254 | 249 | self::setJobName(basename($this->data),true); |
| 255 | - } |
|
| 256 | - else |
|
| 250 | + } else |
|
| 257 | 251 | { |
| 258 | 252 | self::setJobName(); |
| 259 | 253 | } |
@@ -334,8 +328,7 @@ discard block |
||
| 334 | 328 | if ($this->serveroutput->status == "successfull-ok") |
| 335 | 329 | { |
| 336 | 330 | self::_errorLog("validate job: ".$this->serveroutput->status,3); |
| 337 | - } |
|
| 338 | - else |
|
| 331 | + } else |
|
| 339 | 332 | { |
| 340 | 333 | self::_errorLog("validate job: ".$this->serveroutput->status,1); |
| 341 | 334 | } |
@@ -370,8 +363,7 @@ discard block |
||
| 370 | 363 | if (array_key_exists(0,$this->available_printers)) |
| 371 | 364 | { |
| 372 | 365 | self::setPrinterURI($this->available_printers[0]); |
| 373 | - } |
|
| 374 | - else |
|
| 366 | + } else |
|
| 375 | 367 | { |
| 376 | 368 | trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
| 377 | 369 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -433,8 +425,7 @@ discard block |
||
| 433 | 425 | { |
| 434 | 426 | self::_errorLog(sprintf(_("getting printer attributes of %s: %s"),$this->printer_uri, |
| 435 | 427 | $this->serveroutput->status),3); |
| 436 | - } |
|
| 437 | - else |
|
| 428 | + } else |
|
| 438 | 429 | { |
| 439 | 430 | self::_errorLog(sprintf(_("getting printer attributes of %s: %s"),$this->printer_uri, |
| 440 | 431 | $this->serveroutput->status),1); |
@@ -471,8 +462,7 @@ discard block |
||
| 471 | 462 | if (array_key_exists(0,$this->available_printers)) |
| 472 | 463 | { |
| 473 | 464 | self::setPrinterURI($this->available_printers[0]); |
| 474 | - } |
|
| 475 | - else |
|
| 465 | + } else |
|
| 476 | 466 | { |
| 477 | 467 | trigger_error(_("getJobs: Printer URI is not set: die"),E_USER_WARNING); |
| 478 | 468 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -504,8 +494,7 @@ discard block |
||
| 504 | 494 | . 'limit' |
| 505 | 495 | . self::_giveMeStringLength($limit) |
| 506 | 496 | . $limit; |
| 507 | - } |
|
| 508 | - else |
|
| 497 | + } else |
|
| 509 | 498 | { |
| 510 | 499 | $this->meta->limit = ''; |
| 511 | 500 | } |
@@ -517,8 +506,7 @@ discard block |
||
| 517 | 506 | . 'which-jobs' |
| 518 | 507 | . self::_giveMeStringLength($which_jobs) |
| 519 | 508 | . $which_jobs; |
| 520 | - } |
|
| 521 | - else |
|
| 509 | + } else |
|
| 522 | 510 | { |
| 523 | 511 | $this->meta->which_jobs = ""; |
| 524 | 512 | } |
@@ -530,8 +518,7 @@ discard block |
||
| 530 | 518 | . 'my-jobs' |
| 531 | 519 | . self::_giveMeStringLength(chr(0x01)) |
| 532 | 520 | . chr(0x01); |
| 533 | - } |
|
| 534 | - else |
|
| 521 | + } else |
|
| 535 | 522 | { |
| 536 | 523 | $this->meta->my_jobs = ''; |
| 537 | 524 | } |
@@ -570,8 +557,7 @@ discard block |
||
| 570 | 557 | . '' |
| 571 | 558 | . self::_giveMeStringLength('job-state-reason') |
| 572 | 559 | . 'job-state-reason'; |
| 573 | - } |
|
| 574 | - else |
|
| 560 | + } else |
|
| 575 | 561 | { # cups 1.4.4 doesn't return much of anything without this |
| 576 | 562 | $this->stringjob .= |
| 577 | 563 | chr(0x44) // keyword |
@@ -609,8 +595,7 @@ discard block |
||
| 609 | 595 | { |
| 610 | 596 | self::_errorLog(sprintf(_("getting jobs of printer %s: "),$this->printer_uri) |
| 611 | 597 | .$this->serveroutput->status,3); |
| 612 | - } |
|
| 613 | - else |
|
| 598 | + } else |
|
| 614 | 599 | { |
| 615 | 600 | self::_errorLog(sprintf(_("getting jobs of printer %s: "),$this->printer_uri) |
| 616 | 601 | .$this->serveroutput->status,1); |
@@ -654,8 +639,7 @@ discard block |
||
| 654 | 639 | if (array_key_exists(0,$this->available_printers)) |
| 655 | 640 | { |
| 656 | 641 | self::setPrinterURI($this->available_printers[0]); |
| 657 | - } |
|
| 658 | - else |
|
| 642 | + } else |
|
| 659 | 643 | { |
| 660 | 644 | trigger_error(_("getJobs: Printer URI is not set: die"),E_USER_WARNING); |
| 661 | 645 | self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
@@ -716,8 +700,7 @@ discard block |
||
| 716 | 700 | . '' |
| 717 | 701 | . self::_giveMeStringLength('job-state-reason') |
| 718 | 702 | . 'job-state-reason'; |
| 719 | - } |
|
| 720 | - elseif($attributes_group) |
|
| 703 | + } elseif($attributes_group) |
|
| 721 | 704 | { |
| 722 | 705 | switch($attributes_group) |
| 723 | 706 | { |
@@ -768,8 +751,7 @@ discard block |
||
| 768 | 751 | { |
| 769 | 752 | self::_errorLog(sprintf(_("getting job attributes for %s: "),$job_uri) |
| 770 | 753 | .$this->serveroutput->status,3); |
| 771 | - } |
|
| 772 | - else |
|
| 754 | + } else |
|
| 773 | 755 | { |
| 774 | 756 | self::_errorLog(sprintf(_("getting job attributes for %s: "),$job_uri) |
| 775 | 757 | .$this->serveroutput->status,1); |
@@ -871,8 +853,7 @@ discard block |
||
| 871 | 853 | $this->parsed[$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
| 872 | 854 | $this->parsed[$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
| 873 | 855 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 874 | - } |
|
| 875 | - else |
|
| 856 | + } else |
|
| 876 | 857 | { |
| 877 | 858 | $l ++; |
| 878 | 859 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -926,8 +907,7 @@ discard block |
||
| 926 | 907 | $this->parsed[$job][$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
| 927 | 908 | $this->parsed[$job][$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
| 928 | 909 | $this->parsed[$job][$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 929 | - } |
|
| 930 | - else |
|
| 910 | + } else |
|
| 931 | 911 | { |
| 932 | 912 | $l ++; |
| 933 | 913 | $this->parsed[$job][$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -991,8 +971,7 @@ discard block |
||
| 991 | 971 | $this->collection_depth ++; |
| 992 | 972 | $this->index --; |
| 993 | 973 | $this->collection_nbr[$this->collection_depth] ++; |
| 994 | - } |
|
| 995 | - else |
|
| 974 | + } else |
|
| 996 | 975 | { |
| 997 | 976 | $this->collection_depth ++; |
| 998 | 977 | if ($this->collection_depth == 0) |
@@ -1002,8 +981,7 @@ discard block |
||
| 1002 | 981 | if (array_key_exists($this->collection_depth,$this->collection_nbr)) |
| 1003 | 982 | { |
| 1004 | 983 | $this->collection_nbr[$this->collection_depth] ++; |
| 1005 | - } |
|
| 1006 | - else |
|
| 984 | + } else |
|
| 1007 | 985 | { |
| 1008 | 986 | $this->collection_nbr[$this->collection_depth] = 0; |
| 1009 | 987 | } |
@@ -1037,8 +1015,7 @@ discard block |
||
| 1037 | 1015 | if (!$attribute_name) |
| 1038 | 1016 | { |
| 1039 | 1017 | $attribute_name = $this->attribute_name; |
| 1040 | - } |
|
| 1041 | - else |
|
| 1018 | + } else |
|
| 1042 | 1019 | { |
| 1043 | 1020 | $this->attribute_name = $attribute_name; |
| 1044 | 1021 | } |
@@ -1151,24 +1128,19 @@ discard block |
||
| 1151 | 1128 | if ($tag >= 0x14 && $tag < 0x15 && $tag > 0x17 && $tag <= 0x1f) |
| 1152 | 1129 | { |
| 1153 | 1130 | $tag = "out-of-band"; |
| 1154 | - } |
|
| 1155 | - elseif (0x24 <= $tag && $tag <= 0x2f) |
|
| 1131 | + } elseif (0x24 <= $tag && $tag <= 0x2f) |
|
| 1156 | 1132 | { |
| 1157 | 1133 | $tag = "new integer type"; |
| 1158 | - } |
|
| 1159 | - elseif (0x38 <= $tag && $tag <= 0x3F) |
|
| 1134 | + } elseif (0x38 <= $tag && $tag <= 0x3F) |
|
| 1160 | 1135 | { |
| 1161 | 1136 | $tag = "new octet-stream type"; |
| 1162 | - } |
|
| 1163 | - elseif (0x4B <= $tag && $tag <= 0x5F) |
|
| 1137 | + } elseif (0x4B <= $tag && $tag <= 0x5F) |
|
| 1164 | 1138 | { |
| 1165 | 1139 | $tag = "new character string type"; |
| 1166 | - } |
|
| 1167 | - elseif ((0x60 <= $tag && $tag < 0x7f) || $tag >= 0x80 ) |
|
| 1140 | + } elseif ((0x60 <= $tag && $tag < 0x7f) || $tag >= 0x80 ) |
|
| 1168 | 1141 | { |
| 1169 | 1142 | $tag = "IETF reserved for future"; |
| 1170 | - } |
|
| 1171 | - else |
|
| 1143 | + } else |
|
| 1172 | 1144 | { |
| 1173 | 1145 | $tag = sprintf("UNKNOWN: 0x%x (%u)",$tag,$tag); |
| 1174 | 1146 | } |
@@ -1222,8 +1194,7 @@ discard block |
||
| 1222 | 1194 | { |
| 1223 | 1195 | $attribute_name = $this->last_attribute_name; |
| 1224 | 1196 | $this->collection_key[$this->collection_depth] ++; |
| 1225 | - } |
|
| 1226 | - else |
|
| 1197 | + } else |
|
| 1227 | 1198 | { |
| 1228 | 1199 | $this->collection_key[$this->collection_depth] = 0; |
| 1229 | 1200 | } |
@@ -1382,8 +1353,7 @@ discard block |
||
| 1382 | 1353 | $this->parsed[$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
| 1383 | 1354 | $this->parsed[$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
| 1384 | 1355 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 1385 | - } |
|
| 1386 | - else |
|
| 1356 | + } else |
|
| 1387 | 1357 | { |
| 1388 | 1358 | $l ++; |
| 1389 | 1359 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -1430,8 +1400,7 @@ discard block |
||
| 1430 | 1400 | $this->parsed[$k]['name'] = $this->serveroutput->response[$i][$j]['name']; |
| 1431 | 1401 | $this->parsed[$k]['type'] = $this->serveroutput->response[$i][$j]['type']; |
| 1432 | 1402 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 1433 | - } |
|
| 1434 | - else |
|
| 1403 | + } else |
|
| 1435 | 1404 | { |
| 1436 | 1405 | $l ++; |
| 1437 | 1406 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
@@ -1477,8 +1446,7 @@ discard block |
||
| 1477 | 1446 | if ($value == 0x00) |
| 1478 | 1447 | { |
| 1479 | 1448 | $value = 'false'; |
| 1480 | - } |
|
| 1481 | - else |
|
| 1449 | + } else |
|
| 1482 | 1450 | { |
| 1483 | 1451 | $value = 'true'; |
| 1484 | 1452 | } |
@@ -1749,19 +1717,16 @@ discard block |
||
| 1749 | 1717 | if ($value_parsed > 0x002B && $value_parsed <= 0x3FFF) |
| 1750 | 1718 | { |
| 1751 | 1719 | $value = sprintf('Unknown(IETF standards track operations reserved): 0x%x',$value_parsed); |
| 1752 | - } |
|
| 1753 | - elseif ($value_parsed >= 0x4000 && $value_parsed <= 0x8FFF) |
|
| 1720 | + } elseif ($value_parsed >= 0x4000 && $value_parsed <= 0x8FFF) |
|
| 1754 | 1721 | { |
| 1755 | 1722 | if (method_exists($this,'_getEnumVendorExtensions')) |
| 1756 | 1723 | { |
| 1757 | 1724 | $value = $this->_getEnumVendorExtensions($value_parsed); |
| 1758 | - } |
|
| 1759 | - else |
|
| 1725 | + } else |
|
| 1760 | 1726 | { |
| 1761 | 1727 | $value = sprintf('Unknown(Vendor extension for operations): 0x%x',$value_parsed); |
| 1762 | 1728 | } |
| 1763 | - } |
|
| 1764 | - elseif ($value_parsed > 0x8FFF) |
|
| 1729 | + } elseif ($value_parsed > 0x8FFF) |
|
| 1765 | 1730 | { |
| 1766 | 1731 | $value = sprintf('Unknown operation (should not exists): 0x%x',$value_parsed); |
| 1767 | 1732 | } |