@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | // |
| 56 | 56 | // OPERATIONS |
| 57 | 57 | // |
| 58 | - public function cupsGetDefaults($attributes=array("all")) |
|
| 58 | + public function cupsGetDefaults($attributes = array("all")) |
|
| 59 | 59 | { |
| 60 | 60 | //The CUPS-Get-Default operation returns the default printer URI and attributes |
| 61 | 61 | |
| 62 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 63 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 62 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 63 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 64 | 64 | $this->parsed = array(); |
| 65 | 65 | unset($this->printer_attributes); |
| 66 | 66 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | self::_setOperationId(); |
| 78 | 78 | |
| 79 | - for($i = 0 ; $i < count($attributes) ; $i++) |
|
| 79 | + for ($i = 0; $i < count($attributes); $i++) |
|
| 80 | 80 | { |
| 81 | 81 | if ($i == 0) |
| 82 | 82 | { |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
| 99 | - . chr(0x40). chr(0x01) // operation: cups vendor extension: get defaults |
|
| 98 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
| 99 | + . chr(0x40).chr(0x01) // operation: cups vendor extension: get defaults |
|
| 100 | 100 | . $this->meta->operation_id // request-id |
| 101 | 101 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 102 | 102 | . $this->meta->charset |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | self::_putDebug("Request: ".$this->output); |
| 110 | 110 | |
| 111 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 111 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 112 | 112 | "Data" => $this->output); |
| 113 | 113 | |
| 114 | - if (self::_sendHttp ($post_values,'/')) |
|
| 114 | + if (self::_sendHttp($post_values, '/')) |
|
| 115 | 115 | { |
| 116 | 116 | |
| 117 | - if(self::_parseServerOutput()) |
|
| 117 | + if (self::_parseServerOutput()) |
|
| 118 | 118 | { |
| 119 | 119 | self::_parsePrinterAttributes(); |
| 120 | 120 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $printer_type = $this->printer_attributes->printer_type->_value0; |
| 128 | 128 | $table = self::_interpretPrinterType($printer_type); |
| 129 | 129 | |
| 130 | - for($i = 0 ; $i < count($table) ; $i++ ) |
|
| 130 | + for ($i = 0; $i < count($table); $i++) |
|
| 131 | 131 | { |
| 132 | 132 | $index = '_value'.$i; |
| 133 | 133 | $this->printer_attributes->printer_type->$index = $table[$i]; |
@@ -137,22 +137,22 @@ discard block |
||
| 137 | 137 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 138 | 138 | { |
| 139 | 139 | |
| 140 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 140 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 141 | 141 | if ($this->serveroutput->status == "successfull-ok") |
| 142 | 142 | { |
| 143 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
|
| 143 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 3); |
|
| 144 | 144 | } |
| 145 | 145 | else |
| 146 | 146 | { |
| 147 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
|
| 147 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 1); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return $this->serveroutput->status; |
| 151 | 151 | } |
| 152 | 152 | else |
| 153 | 153 | { |
| 154 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 155 | - self::_errorLog("getting defaults : OPERATION FAILED",1); |
|
| 154 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 155 | + self::_errorLog("getting defaults : OPERATION FAILED", 1); |
|
| 156 | 156 | } |
| 157 | 157 | return false; |
| 158 | 158 | } |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | //The CUPS-Get-Default operation returns the default printer URI and attributes |
| 164 | 164 | |
| 165 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 166 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 165 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 166 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 167 | 167 | $this->parsed = array(); |
| 168 | 168 | unset($this->printer_attributes); |
| 169 | 169 | |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | self::_setOperationId(); |
| 181 | 181 | |
| 182 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
| 183 | - . chr(0x40). chr(0x08) // operation: cups vendor extension: Accept-Jobs |
|
| 182 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
| 183 | + . chr(0x40).chr(0x08) // operation: cups vendor extension: Accept-Jobs |
|
| 184 | 184 | . $this->meta->operation_id // request-id |
| 185 | 185 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 186 | 186 | . $this->meta->charset |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | self::_putDebug("Request: ".$this->output); |
| 198 | 198 | |
| 199 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 199 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 200 | 200 | "Data" => $this->output); |
| 201 | 201 | |
| 202 | - if (self::_sendHttp ($post_values,'/admin/')) |
|
| 202 | + if (self::_sendHttp($post_values, '/admin/')) |
|
| 203 | 203 | { |
| 204 | 204 | |
| 205 | - if(self::_parseServerOutput()) |
|
| 205 | + if (self::_parseServerOutput()) |
|
| 206 | 206 | { |
| 207 | 207 | self::_parseAttributes(); |
| 208 | 208 | } |
@@ -211,33 +211,33 @@ discard block |
||
| 211 | 211 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 212 | 212 | { |
| 213 | 213 | |
| 214 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 214 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 215 | 215 | if ($this->serveroutput->status == "successfull-ok") |
| 216 | 216 | { |
| 217 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
|
| 217 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 3); |
|
| 218 | 218 | } |
| 219 | 219 | else |
| 220 | 220 | { |
| 221 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
|
| 221 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 1); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | return $this->serveroutput->status; |
| 225 | 225 | } |
| 226 | 226 | else |
| 227 | 227 | { |
| 228 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 229 | - self::_errorLog("getting defaults : OPERATION FAILED",1); |
|
| 228 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 229 | + self::_errorLog("getting defaults : OPERATION FAILED", 1); |
|
| 230 | 230 | } |
| 231 | 231 | return false; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
| 235 | - public function cupsRejectJobs($printer_uri,$printer_state_message) |
|
| 235 | + public function cupsRejectJobs($printer_uri, $printer_state_message) |
|
| 236 | 236 | { |
| 237 | 237 | //The CUPS-Get-Default operation returns the default printer URI and attributes |
| 238 | 238 | |
| 239 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 240 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 239 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 240 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 241 | 241 | $this->parsed = array(); |
| 242 | 242 | unset($this->attributes); |
| 243 | 243 | |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | . $printer_state_message; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
| 268 | - . chr(0x40). chr(0x09) // operation: cups vendor extension: Reject-Jobs |
|
| 267 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
| 268 | + . chr(0x40).chr(0x09) // operation: cups vendor extension: Reject-Jobs |
|
| 269 | 269 | . $this->meta->operation_id // request-id |
| 270 | 270 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 271 | 271 | . $this->meta->charset |
@@ -282,13 +282,13 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | self::_putDebug("Request: ".$this->output); |
| 284 | 284 | |
| 285 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 285 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 286 | 286 | "Data" => $this->output); |
| 287 | 287 | |
| 288 | - if (self::_sendHttp ($post_values,'/admin/')) |
|
| 288 | + if (self::_sendHttp($post_values, '/admin/')) |
|
| 289 | 289 | { |
| 290 | 290 | |
| 291 | - if(self::_parseServerOutput()) |
|
| 291 | + if (self::_parseServerOutput()) |
|
| 292 | 292 | { |
| 293 | 293 | self::_parseAttributes(); |
| 294 | 294 | } |
@@ -297,36 +297,36 @@ discard block |
||
| 297 | 297 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 298 | 298 | { |
| 299 | 299 | |
| 300 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 300 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 301 | 301 | if ($this->serveroutput->status == "successfull-ok") |
| 302 | 302 | { |
| 303 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
|
| 303 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 3); |
|
| 304 | 304 | } |
| 305 | 305 | else |
| 306 | 306 | { |
| 307 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
|
| 307 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 1); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | return $this->serveroutput->status; |
| 311 | 311 | } |
| 312 | 312 | else |
| 313 | 313 | { |
| 314 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 315 | - self::_errorLog("getting defaults : OPERATION FAILED",1); |
|
| 314 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 315 | + self::_errorLog("getting defaults : OPERATION FAILED", 1); |
|
| 316 | 316 | } |
| 317 | 317 | return false; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
| 321 | - public function getPrinters($printer_location=false,$printer_info=false,$attributes=array()) |
|
| 321 | + public function getPrinters($printer_location = false, $printer_info = false, $attributes = array()) |
|
| 322 | 322 | { |
| 323 | 323 | if (count($attributes) == 0) |
| 324 | 324 | { |
| 325 | 325 | true; |
| 326 | 326 | } |
| 327 | - $attributes=array('printer-uri-supported', 'printer-location', 'printer-info', 'printer-type', 'color-supported', 'printer-name'); |
|
| 328 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 329 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 327 | + $attributes = array('printer-uri-supported', 'printer-location', 'printer-info', 'printer-type', 'color-supported', 'printer-name'); |
|
| 328 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 329 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 330 | 330 | |
| 331 | 331 | unset ($this->printers_attributes); |
| 332 | 332 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | self::_setOperationId(); |
| 344 | 344 | |
| 345 | - $this->meta->attributes=''; |
|
| 345 | + $this->meta->attributes = ''; |
|
| 346 | 346 | |
| 347 | 347 | if ($printer_location) |
| 348 | 348 | { |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | . $printer_info; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - for($i = 0 ; $i < count($attributes) ; $i++) |
|
| 365 | + for ($i = 0; $i < count($attributes); $i++) |
|
| 366 | 366 | { |
| 367 | 367 | if ($i == 0) |
| 368 | 368 | { |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
| 385 | - . chr(0x40). chr(0x02) // operation: cups vendor extension: get printers |
|
| 384 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
| 385 | + . chr(0x40).chr(0x02) // operation: cups vendor extension: get printers |
|
| 386 | 386 | . $this->meta->operation_id // request-id |
| 387 | 387 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 388 | 388 | . $this->meta->charset |
@@ -392,13 +392,13 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | $this->output = $this->stringjob; |
| 394 | 394 | |
| 395 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 395 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 396 | 396 | "Data" => $this->output); |
| 397 | 397 | |
| 398 | - if (self::_sendHttp ($post_values,'/')) |
|
| 398 | + if (self::_sendHttp($post_values, '/')) |
|
| 399 | 399 | { |
| 400 | 400 | |
| 401 | - if(self::_parseServerOutput()) |
|
| 401 | + if (self::_parseServerOutput()) |
|
| 402 | 402 | { |
| 403 | 403 | $this->_getAvailablePrinters(); |
| 404 | 404 | } |
@@ -407,27 +407,27 @@ discard block |
||
| 407 | 407 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 408 | 408 | { |
| 409 | 409 | |
| 410 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 410 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 411 | 411 | if ($this->serveroutput->status == "successfull-ok") |
| 412 | 412 | { |
| 413 | - self::_errorLog("getting printers: ".$this->serveroutput->status,3); |
|
| 413 | + self::_errorLog("getting printers: ".$this->serveroutput->status, 3); |
|
| 414 | 414 | } |
| 415 | 415 | else |
| 416 | 416 | { |
| 417 | - self::_errorLog("getting printers: ".$this->serveroutput->status,1); |
|
| 417 | + self::_errorLog("getting printers: ".$this->serveroutput->status, 1); |
|
| 418 | 418 | } |
| 419 | 419 | return $this->serveroutput->status; |
| 420 | 420 | } |
| 421 | 421 | else |
| 422 | 422 | { |
| 423 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 424 | - self::_errorLog("getting printers : OPERATION FAILED",1); |
|
| 423 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 424 | + self::_errorLog("getting printers : OPERATION FAILED", 1); |
|
| 425 | 425 | } |
| 426 | 426 | return false; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | |
| 430 | - public function cupsGetPrinters () |
|
| 430 | + public function cupsGetPrinters() |
|
| 431 | 431 | { |
| 432 | 432 | // alias for getPrinters(); |
| 433 | 433 | self::getPrinters(); |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | { |
| 439 | 439 | // complete informations from parent with Cups-specific stuff |
| 440 | 440 | |
| 441 | - if(!$result = parent::getPrinterAttributes()) |
|
| 441 | + if (!$result = parent::getPrinterAttributes()) |
|
| 442 | 442 | { |
| 443 | 443 | return FALSE; |
| 444 | 444 | } |
| 445 | - if(!isset($this->printer_attributes)) |
|
| 445 | + if (!isset($this->printer_attributes)) |
|
| 446 | 446 | { |
| 447 | 447 | return FALSE; |
| 448 | 448 | } |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $printer_type = $this->printer_attributes->printer_type->_value0; |
| 453 | 453 | $table = self::_interpretPrinterType($printer_type); |
| 454 | 454 | |
| 455 | - for($i = 0 ; $i < count($table) ; $i++ ) |
|
| 455 | + for ($i = 0; $i < count($table); $i++) |
|
| 456 | 456 | { |
| 457 | 457 | $index = '_value'.$i; |
| 458 | 458 | $this->printer_attributes->printer_type->$index = $table[$i]; |
@@ -465,14 +465,14 @@ discard block |
||
| 465 | 465 | // |
| 466 | 466 | // SETUP |
| 467 | 467 | // |
| 468 | - protected function _initTags () |
|
| 468 | + protected function _initTags() |
|
| 469 | 469 | { |
| 470 | 470 | // override parent with specific cups attributes |
| 471 | 471 | |
| 472 | - $operation_tags = array (); |
|
| 473 | - $this->operation_tags = array_merge ($this->operation_tags, $operation_tags); |
|
| 472 | + $operation_tags = array(); |
|
| 473 | + $this->operation_tags = array_merge($this->operation_tags, $operation_tags); |
|
| 474 | 474 | |
| 475 | - $job_tags = array ( "job-billing" => array("tag" => "textWithoutLanguage"), |
|
| 475 | + $job_tags = array("job-billing" => array("tag" => "textWithoutLanguage"), |
|
| 476 | 476 | "blackplot" => array("tag" => "boolean"), |
| 477 | 477 | "brightness" => array("tag" => "integer"), |
| 478 | 478 | "columns" => array("tag" => "integer"), |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | "gamma" => array("tag" => "integer"), |
| 482 | 482 | "hue" => array("tag" => "integer"), |
| 483 | 483 | "lpi" => array("tag" => "enum"), |
| 484 | - "mirror" => array("tag","boolean"), |
|
| 484 | + "mirror" => array("tag", "boolean"), |
|
| 485 | 485 | "natural-scaling" => array("tag" => "integer"), |
| 486 | 486 | "number-up-layout" => array("tag" => "keyword"), |
| 487 | 487 | "page-border" => array("tag" => "keyword"), |
@@ -494,21 +494,21 @@ discard block |
||
| 494 | 494 | "penwidth" => array("tag" => "integer"), |
| 495 | 495 | "position" => array("tag" => "keyword"), |
| 496 | 496 | "ppi" => array("tag" => "integer"), |
| 497 | - "prettyprint" => array("tag","boolean"), |
|
| 497 | + "prettyprint" => array("tag", "boolean"), |
|
| 498 | 498 | "saturation" => array("tag" => "integer"), |
| 499 | 499 | "scaling" => array("tag" => "integer"), |
| 500 | - "wrap" => array("tag","boolean"), |
|
| 500 | + "wrap" => array("tag", "boolean"), |
|
| 501 | 501 | |
| 502 | 502 | ); |
| 503 | - $this->job_tags = array_merge ($this->job_tags, $job_tags); |
|
| 503 | + $this->job_tags = array_merge($this->job_tags, $job_tags); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // |
| 507 | 507 | // REQUEST BUILDING |
| 508 | 508 | // |
| 509 | - protected function _enumBuild ($tag,$value) |
|
| 509 | + protected function _enumBuild($tag, $value) |
|
| 510 | 510 | { |
| 511 | - $value_built = parent::_enumBuild($tag,$value); |
|
| 511 | + $value_built = parent::_enumBuild($tag, $value); |
|
| 512 | 512 | |
| 513 | 513 | switch ($tag) |
| 514 | 514 | { |
@@ -552,35 +552,35 @@ discard block |
||
| 552 | 552 | // |
| 553 | 553 | // RESPONSE PARSING |
| 554 | 554 | // |
| 555 | - private function _getAvailablePrinters () |
|
| 555 | + private function _getAvailablePrinters() |
|
| 556 | 556 | { |
| 557 | 557 | $this->available_printers = array(); |
| 558 | 558 | $this->printer_map = array(); |
| 559 | 559 | $k = 0; |
| 560 | 560 | $this->printers_attributes = new \stdClass(); |
| 561 | 561 | |
| 562 | - for ($i = 0 ; (array_key_exists($i,$this->serveroutput->response)) ; $i ++) |
|
| 562 | + for ($i = 0; (array_key_exists($i, $this->serveroutput->response)); $i++) |
|
| 563 | 563 | { |
| 564 | 564 | if (($this->serveroutput->response[$i]['attributes']) == "printer-attributes") |
| 565 | 565 | { |
| 566 | 566 | $phpname = "_printer".$k; |
| 567 | 567 | $this->printers_attributes->$phpname = new \stdClass(); |
| 568 | - for ($j = 0 ; array_key_exists($j,$this->serveroutput->response[$i]) ; $j++) |
|
| 568 | + for ($j = 0; array_key_exists($j, $this->serveroutput->response[$i]); $j++) |
|
| 569 | 569 | { |
| 570 | 570 | |
| 571 | 571 | $value = $this->serveroutput->response[$i][$j]['value']; |
| 572 | - $name = str_replace("-","_",$this->serveroutput->response[$i][$j]['name']); |
|
| 572 | + $name = str_replace("-", "_", $this->serveroutput->response[$i][$j]['name']); |
|
| 573 | 573 | |
| 574 | 574 | switch ($name) |
| 575 | 575 | { |
| 576 | 576 | case "printer_uri_supported": |
| 577 | - $this->available_printers = array_merge($this->available_printers,array($value)); |
|
| 577 | + $this->available_printers = array_merge($this->available_printers, array($value)); |
|
| 578 | 578 | break; |
| 579 | 579 | case "printer_type": |
| 580 | 580 | $table = self::_interpretPrinterType($value); |
| 581 | 581 | $this->printers_attributes->$phpname->$name = new \stdClass(); |
| 582 | 582 | |
| 583 | - for($l = 0 ; $l < count($table) ; $l++ ) |
|
| 583 | + for ($l = 0; $l < count($table); $l++) |
|
| 584 | 584 | { |
| 585 | 585 | $index = '_value'.$l; |
| 586 | 586 | $this->printers_attributes->$phpname->$name->$index = $table[$l]; |
@@ -597,12 +597,12 @@ discard block |
||
| 597 | 597 | break; |
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | - $k ++; |
|
| 600 | + $k++; |
|
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - protected function _getEnumVendorExtensions ($value_parsed) |
|
| 605 | + protected function _getEnumVendorExtensions($value_parsed) |
|
| 606 | 606 | { |
| 607 | 607 | switch ($value_parsed) |
| 608 | 608 | { |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | $value = 'Get-Availables-Printers'; |
| 611 | 611 | break; |
| 612 | 612 | default: |
| 613 | - $value = sprintf('Unknown(Cups extension for operations): 0x%x',$value_parsed); |
|
| 613 | + $value = sprintf('Unknown(Cups extension for operations): 0x%x', $value_parsed); |
|
| 614 | 614 | break; |
| 615 | 615 | } |
| 616 | 616 | |
@@ -619,16 +619,16 @@ discard block |
||
| 619 | 619 | return ($value); |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | - return sprintf('Unknown: 0x%x',$value_parsed); |
|
| 622 | + return sprintf('Unknown: 0x%x', $value_parsed); |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | |
| 626 | 626 | private function _interpretPrinterType($value) |
| 627 | 627 | { |
| 628 | 628 | $value_parsed = 0; |
| 629 | - for ($i = strlen($value) ; $i > 0 ; $i --) |
|
| 629 | + for ($i = strlen($value); $i > 0; $i--) |
|
| 630 | 630 | { |
| 631 | - $value_parsed += pow(256,($i - 1)) * ord($value[strlen($value) - $i]); |
|
| 631 | + $value_parsed += pow(256, ($i - 1)) * ord($value[strlen($value) - $i]); |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | $type[0] = $type[1] = $type[2] = $type[3] = $type[4] = $type[5] = ''; |
@@ -636,115 +636,115 @@ discard block |
||
| 636 | 636 | $type[11] = $type[12] = $type[13] = $type[14] = $type[15] = ''; |
| 637 | 637 | $type[16] = $type[17] = $type[18] = $type[19] = ''; |
| 638 | 638 | |
| 639 | - if ($value_parsed %2 == 1) |
|
| 639 | + if ($value_parsed % 2 == 1) |
|
| 640 | 640 | { |
| 641 | 641 | $type[0] = 'printer-class'; |
| 642 | 642 | $value_parsed -= 1; |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | - if ($value_parsed %4 == 2 ) |
|
| 645 | + if ($value_parsed % 4 == 2) |
|
| 646 | 646 | { |
| 647 | 647 | $type[1] = 'remote-destination'; |
| 648 | 648 | $value_parsed -= 2; |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | - if ($value_parsed %8 == 4 ) |
|
| 651 | + if ($value_parsed % 8 == 4) |
|
| 652 | 652 | { |
| 653 | 653 | $type[2] = 'print-black'; |
| 654 | 654 | $value_parsed -= 4; |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | - if ($value_parsed %16 == 8 ) |
|
| 657 | + if ($value_parsed % 16 == 8) |
|
| 658 | 658 | { |
| 659 | 659 | $type[3] = 'print-color'; |
| 660 | 660 | $value_parsed -= 8; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | - if ($value_parsed %32 == 16) |
|
| 663 | + if ($value_parsed % 32 == 16) |
|
| 664 | 664 | { |
| 665 | 665 | $type[4] = 'hardware-print-on-both-sides'; |
| 666 | 666 | $value_parsed -= 16; |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | - if ($value_parsed %64 == 32) |
|
| 669 | + if ($value_parsed % 64 == 32) |
|
| 670 | 670 | { |
| 671 | 671 | $type[5] = 'hardware-staple-output'; |
| 672 | 672 | $value_parsed -= 32; |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - if ($value_parsed %128 == 64) |
|
| 675 | + if ($value_parsed % 128 == 64) |
|
| 676 | 676 | { |
| 677 | 677 | $type[6] = 'hardware-fast-copies'; |
| 678 | 678 | $value_parsed -= 64; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | - if ($value_parsed %256 == 128) |
|
| 681 | + if ($value_parsed % 256 == 128) |
|
| 682 | 682 | { |
| 683 | 683 | $type[7] = 'hardware-fast-copy-collation'; |
| 684 | 684 | $value_parsed -= 128; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | - if ($value_parsed %512 == 256) |
|
| 687 | + if ($value_parsed % 512 == 256) |
|
| 688 | 688 | { |
| 689 | 689 | $type[8] = 'punch-output'; |
| 690 | 690 | $value_parsed -= 256; |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - if ($value_parsed %1024 == 512) |
|
| 693 | + if ($value_parsed % 1024 == 512) |
|
| 694 | 694 | { |
| 695 | 695 | $type[9] = 'cover-output'; |
| 696 | 696 | $value_parsed -= 512; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - if ($value_parsed %2048 == 1024) |
|
| 699 | + if ($value_parsed % 2048 == 1024) |
|
| 700 | 700 | { |
| 701 | 701 | $type[10] = 'bind-output'; |
| 702 | 702 | $value_parsed -= 1024; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - if ($value_parsed %4096 == 2048) |
|
| 705 | + if ($value_parsed % 4096 == 2048) |
|
| 706 | 706 | { |
| 707 | 707 | $type[11] = 'sort-output'; |
| 708 | 708 | $value_parsed -= 2048; |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | - if ($value_parsed %8192 == 4096) |
|
| 711 | + if ($value_parsed % 8192 == 4096) |
|
| 712 | 712 | { |
| 713 | 713 | $type[12] = 'handle-media-up-to-US-Legal-A4'; |
| 714 | 714 | $value_parsed -= 4096; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | - if ($value_parsed %16384 == 8192) |
|
| 717 | + if ($value_parsed % 16384 == 8192) |
|
| 718 | 718 | { |
| 719 | 719 | $type[13] = 'handle-media-between-US-Legal-A4-and-ISO_C-A2'; |
| 720 | 720 | $value_parsed -= 8192; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | - if ($value_parsed %32768 == 16384) |
|
| 723 | + if ($value_parsed % 32768 == 16384) |
|
| 724 | 724 | { |
| 725 | 725 | $type[14] = 'handle-media-larger-than-ISO_C-A2'; |
| 726 | 726 | $value_parsed -= 16384; |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | - if ($value_parsed %65536 == 32768) |
|
| 729 | + if ($value_parsed % 65536 == 32768) |
|
| 730 | 730 | { |
| 731 | 731 | $type[15] = 'handle-user-defined-media-sizes'; |
| 732 | 732 | $value_parsed -= 32768; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - if ($value_parsed %131072 == 65536) |
|
| 735 | + if ($value_parsed % 131072 == 65536) |
|
| 736 | 736 | { |
| 737 | 737 | $type[16] = 'implicit-server-generated-class'; |
| 738 | 738 | $value_parsed -= 65536; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - if ($value_parsed %262144 == 131072) |
|
| 741 | + if ($value_parsed % 262144 == 131072) |
|
| 742 | 742 | { |
| 743 | 743 | $type[17] = 'network-default-printer'; |
| 744 | 744 | $value_parsed -= 131072; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - if ($value_parsed %524288 == 262144) |
|
| 747 | + if ($value_parsed % 524288 == 262144) |
|
| 748 | 748 | { |
| 749 | 749 | $type[18] = 'fax-device'; |
| 750 | 750 | $value_parsed -= 262144; |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | |
| 757 | - protected function _interpretEnum($attribute_name,$value) |
|
| 757 | + protected function _interpretEnum($attribute_name, $value) |
|
| 758 | 758 | { |
| 759 | 759 | $value_parsed = self::_interpretInteger($value); |
| 760 | 760 | |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | $value = $value_parsed; |
| 766 | 766 | break; |
| 767 | 767 | default: |
| 768 | - $value = parent::_interpretEnum($attribute_name,$value); |
|
| 768 | + $value = parent::_interpretEnum($attribute_name, $value); |
|
| 769 | 769 | break; |
| 770 | 770 | } |
| 771 | 771 | |
@@ -102,16 +102,16 @@ discard block |
||
| 102 | 102 | E_USER_NOTICE => 'E_USER_NOTICE' |
| 103 | 103 | ); |
| 104 | 104 | if (defined('E_STRICT')) { |
| 105 | - $level_names[E_STRICT]='E_STRICT'; |
|
| 105 | + $level_names[E_STRICT] = 'E_STRICT'; |
|
| 106 | 106 | } |
| 107 | - $levels=array(); |
|
| 108 | - if (($value&E_ALL)==E_ALL) { |
|
| 109 | - $levels[]='E_ALL'; |
|
| 110 | - $value&=~E_ALL; |
|
| 107 | + $levels = array(); |
|
| 108 | + if (($value&E_ALL) == E_ALL) { |
|
| 109 | + $levels[] = 'E_ALL'; |
|
| 110 | + $value &= ~E_ALL; |
|
| 111 | 111 | } |
| 112 | 112 | foreach ($level_names as $level=>$name) { |
| 113 | - if (($value&$level)==$level) { |
|
| 114 | - $levels[]=$name; |
|
| 113 | + if (($value & $level) == $level) { |
|
| 114 | + $levels[] = $name; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | return implode(' | ', $levels); |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | // variables declaration |
| 128 | 128 | public $debug; |
| 129 | 129 | public $html_debug; |
| 130 | - public $timeout = 30; // time waiting for connection, seconds |
|
| 130 | + public $timeout = 30; // time waiting for connection, seconds |
|
| 131 | 131 | public $data_timeout = 30; // time waiting for data, milliseconds |
| 132 | 132 | public $data_chunk_timeout = 1; // time waiting between data chunks, millisecond |
| 133 | 133 | public $force_multipart_form_post; |
| 134 | 134 | public $username; |
| 135 | 135 | public $password; |
| 136 | - public $request_headers = array (); |
|
| 136 | + public $request_headers = array(); |
|
| 137 | 137 | public $request_body = "Not a useful information"; |
| 138 | 138 | public $status; |
| 139 | 139 | public $window_size = 1024; // chunk size of data |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | public $host; |
| 143 | 143 | private $default_port = 631; |
| 144 | 144 | private $headers; |
| 145 | - private $reply_headers = array (); |
|
| 146 | - private $reply_body = array (); |
|
| 145 | + private $reply_headers = array(); |
|
| 146 | + private $reply_body = array(); |
|
| 147 | 147 | private $connection; |
| 148 | 148 | private $arguments; |
| 149 | - private $bodystream = array (); |
|
| 149 | + private $bodystream = array(); |
|
| 150 | 150 | private $last_limit; |
| 151 | 151 | private $connected; |
| 152 | 152 | private $nc = 1; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | public function GetRequestArguments($url, &$arguments) |
| 168 | 168 | { |
| 169 | - $this->arguments = array (); |
|
| 169 | + $this->arguments = array(); |
|
| 170 | 170 | $this->arguments["URL"] = $arguments["URL"] = $url; |
| 171 | 171 | $this->arguments["RequestMethod"] = $arguments["RequestMethod"] = "POST"; |
| 172 | 172 | $this->headers["Content-Length"] = 0; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | return $this->_HttpError($error, E_USER_WARNING); |
| 231 | 231 | } |
| 232 | 232 | $this->connected = true; |
| 233 | - return array (true, "success"); |
|
| 233 | + return array(true, "success"); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | public function SendRequest($arguments) |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | self::_ReadReply(); |
| 245 | 245 | if (!preg_match('#http/1.1 401 unauthorized#', $this->status)) { |
| 246 | - return array (true, "success"); |
|
| 246 | + return array(true, "success"); |
|
| 247 | 247 | } |
| 248 | 248 | $headers = array_keys($this->reply_headers); |
| 249 | 249 | $error = _("need authentication but no mechanism provided"); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | return $this->_HttpError($error.": ".$result[1], E_USER_WARNING); |
| 280 | 280 | } |
| 281 | 281 | self::_ReadReply(); |
| 282 | - return array (true, "success"); |
|
| 282 | + return array(true, "success"); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | public function ReadReplyHeaders(&$headers) |
@@ -314,13 +314,13 @@ discard block |
||
| 314 | 314 | foreach ($backtrace as $trace) { |
| 315 | 315 | $trace .= sprintf("in [file: '%s'][function: '%s'][line: %s];\n", $trace['file'], $trace['function'], $trace['line']); |
| 316 | 316 | } |
| 317 | - $msg = sprintf( '%s\n%s: [errno: %s]: %s', |
|
| 317 | + $msg = sprintf('%s\n%s: [errno: %s]: %s', |
|
| 318 | 318 | $trace, error2string($level), $errno, $msg); |
| 319 | 319 | if ($this->with_exceptions) { |
| 320 | 320 | throw new httpException($msg, $errno); |
| 321 | 321 | } else { |
| 322 | 322 | trigger_error($msg, $level); |
| 323 | - return array (false, $msg); |
|
| 323 | + return array(false, $msg); |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | private function _StreamRequest($arguments) |
| 337 | 337 | { |
| 338 | 338 | $this->status = false; |
| 339 | - $this->reply_headers = array (); |
|
| 339 | + $this->reply_headers = array(); |
|
| 340 | 340 | $this->reply_body = ""; |
| 341 | 341 | if (!$this->connected) { |
| 342 | 342 | return $this->_HttpError(_("not connected"), E_USER_WARNING); |
@@ -413,17 +413,17 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | - return array (true, "success"); |
|
| 416 | + return array(true, "success"); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | private function _ReadReply() |
| 420 | 420 | { |
| 421 | 421 | if (!$this->connected) { |
| 422 | - return array (false, _("not connected")); |
|
| 422 | + return array(false, _("not connected")); |
|
| 423 | 423 | } |
| 424 | - $this->reply_headers = array (); |
|
| 424 | + $this->reply_headers = array(); |
|
| 425 | 425 | $this->reply_body = ""; |
| 426 | - $headers = array (); |
|
| 426 | + $headers = array(); |
|
| 427 | 427 | $body = ""; |
| 428 | 428 | while (!feof($this->connection)) { |
| 429 | 429 | $line = fgets($this->connection, 1024); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | private function _ReadStream() |
| 455 | 455 | { |
| 456 | - if (! array_key_exists("content-length", $this->reply_headers)) { |
|
| 456 | + if (!array_key_exists("content-length", $this->reply_headers)) { |
|
| 457 | 457 | stream_set_blocking($this->connection, 0); |
| 458 | 458 | $this->reply_body = stream_get_contents($this->connection); |
| 459 | 459 | return true; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // OPERATIONS |
| 53 | 53 | public function printJob() |
| 54 | 54 | { |
| 55 | - self::_putDebug( sprintf("*************************\nDate: %s\n*************************\n\n",date('Y-m-d H:i:s'))); |
|
| 55 | + self::_putDebug(sprintf("*************************\nDate: %s\n*************************\n\n", date('Y-m-d H:i:s'))); |
|
| 56 | 56 | |
| 57 | 57 | if (!$this->_stringJob()) |
| 58 | 58 | { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | if (is_readable($this->data)) |
| 63 | 63 | { |
| 64 | - self::_putDebug( _("Printing a FILE\n"),3); |
|
| 64 | + self::_putDebug(_("Printing a FILE\n"), 3); |
|
| 65 | 65 | |
| 66 | 66 | $this->output = $this->stringjob; |
| 67 | 67 | |
@@ -70,31 +70,31 @@ discard block |
||
| 70 | 70 | $this->output .= chr(0x16); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 73 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 74 | 74 | "Data" => $this->output, |
| 75 | 75 | "File" => $this->data); |
| 76 | 76 | |
| 77 | 77 | if ($this->setup->datatype == "TEXT" && !isset($this->setup->noFormFeed)) |
| 78 | 78 | { |
| 79 | - $post_values = array_merge($post_values,array("Filetype"=>"TEXT")); |
|
| 79 | + $post_values = array_merge($post_values, array("Filetype"=>"TEXT")); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | else |
| 83 | 83 | { |
| 84 | - self::_putDebug( _("Printing DATA\n"),3); |
|
| 84 | + self::_putDebug(_("Printing DATA\n"), 3); |
|
| 85 | 85 | |
| 86 | 86 | $this->output = $this->stringjob; |
| 87 | 87 | $this->output .= $this->datahead; |
| 88 | 88 | $this->output .= $this->data; |
| 89 | 89 | $this->output .= $this->datatail; |
| 90 | 90 | |
| 91 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 91 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 92 | 92 | "Data" => $this->output); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if (self::_sendHttp ($post_values,$this->paths['printers'])) |
|
| 95 | + if (self::_sendHttp($post_values, $this->paths['printers'])) |
|
| 96 | 96 | { |
| 97 | - if(self::_parseServerOutput()) |
|
| 97 | + if (self::_parseServerOutput()) |
|
| 98 | 98 | { |
| 99 | 99 | $this->_getJobId(); |
| 100 | 100 | $this->_getJobUri(); |
@@ -102,24 +102,24 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | else |
| 104 | 104 | { |
| 105 | - $this->jobs = array_merge($this->jobs,array('')); |
|
| 106 | - $this->jobs_uri = array_merge($this->jobs_uri,array('')); |
|
| 105 | + $this->jobs = array_merge($this->jobs, array('')); |
|
| 106 | + $this->jobs_uri = array_merge($this->jobs_uri, array('')); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 111 | 111 | { |
| 112 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 112 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 113 | 113 | |
| 114 | 114 | if ($this->serveroutput->status == "successfull-ok") |
| 115 | 115 | { |
| 116 | - self::_errorLog(sprintf("printing job %s: ",$this->last_job) .$this->serveroutput->status,3); |
|
| 116 | + self::_errorLog(sprintf("printing job %s: ", $this->last_job).$this->serveroutput->status, 3); |
|
| 117 | 117 | } |
| 118 | 118 | else |
| 119 | 119 | { |
| 120 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 121 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 122 | - self::_errorLog(sprintf("printing job: ",$this->last_job) .$this->serveroutput->status,1); |
|
| 120 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 121 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 122 | + self::_errorLog(sprintf("printing job: ", $this->last_job).$this->serveroutput->status, 1); |
|
| 123 | 123 | if ($this->with_exceptions) |
| 124 | 124 | { |
| 125 | 125 | throw new ippException(sprintf("job status: %s", |
@@ -129,69 +129,69 @@ discard block |
||
| 129 | 129 | return $this->serveroutput->status; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 133 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 134 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 135 | - self::_errorLog("printing job : OPERATION FAILED",1); |
|
| 132 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 133 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 134 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 135 | + self::_errorLog("printing job : OPERATION FAILED", 1); |
|
| 136 | 136 | |
| 137 | 137 | return false; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - public function cancelJob ($job_uri) |
|
| 140 | + public function cancelJob($job_uri) |
|
| 141 | 141 | { |
| 142 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 143 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 142 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 143 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 144 | 144 | |
| 145 | - self::_putDebug( sprintf("*************************\nDate: %s\n*************************\n\n",date('Y-m-d H:i:s'))); |
|
| 145 | + self::_putDebug(sprintf("*************************\nDate: %s\n*************************\n\n", date('Y-m-d H:i:s'))); |
|
| 146 | 146 | |
| 147 | 147 | if (!$this->_stringCancel($job_uri)) |
| 148 | 148 | { |
| 149 | 149 | return FALSE; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - self::_putDebug( _("Cancelling Job $job_uri\n"),3); |
|
| 152 | + self::_putDebug(_("Cancelling Job $job_uri\n"), 3); |
|
| 153 | 153 | |
| 154 | 154 | $this->output = $this->stringjob; |
| 155 | 155 | |
| 156 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 156 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 157 | 157 | "Data"=>$this->output); |
| 158 | 158 | |
| 159 | - if (self::_sendHttp ($post_values,$this->paths['jobs'])) |
|
| 159 | + if (self::_sendHttp($post_values, $this->paths['jobs'])) |
|
| 160 | 160 | { |
| 161 | 161 | self::_parseServerOutput(); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 165 | 165 | { |
| 166 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 166 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 167 | 167 | |
| 168 | 168 | if ($this->serveroutput->status == "successfull-ok") |
| 169 | 169 | { |
| 170 | - self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status,3); |
|
| 170 | + self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status, 3); |
|
| 171 | 171 | } |
| 172 | 172 | else |
| 173 | 173 | { |
| 174 | - self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status,1); |
|
| 174 | + self::_errorLog("cancelling job $job_uri: ".$this->serveroutput->status, 1); |
|
| 175 | 175 | } |
| 176 | 176 | return $this->serveroutput->status; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 180 | - self::_errorLog("cancelling job : OPERATION FAILED",3); |
|
| 179 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 180 | + self::_errorLog("cancelling job : OPERATION FAILED", 3); |
|
| 181 | 181 | |
| 182 | 182 | return false; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public function validateJob () |
|
| 185 | + public function validateJob() |
|
| 186 | 186 | { |
| 187 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 188 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 187 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 188 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 189 | 189 | |
| 190 | 190 | $this->serveroutput->response = ''; |
| 191 | 191 | |
| 192 | - self::_putDebug( sprintf("*************************\nDate: %s\n*************************\n\n",date('Y-m-d H:i:s'))); |
|
| 192 | + self::_putDebug(sprintf("*************************\nDate: %s\n*************************\n\n", date('Y-m-d H:i:s'))); |
|
| 193 | 193 | |
| 194 | - self::_putDebug( _("Validate Job\n"),2); |
|
| 194 | + self::_putDebug(_("Validate Job\n"), 2); |
|
| 195 | 195 | |
| 196 | 196 | if (!isset($this->setup->charset)) |
| 197 | 197 | { |
@@ -209,15 +209,15 @@ discard block |
||
| 209 | 209 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 210 | 210 | unset($this->status[count($this->status) - 1]); |
| 211 | 211 | |
| 212 | - if (array_key_exists(0,$this->available_printers)) |
|
| 212 | + if (array_key_exists(0, $this->available_printers)) |
|
| 213 | 213 | { |
| 214 | 214 | self::setPrinterURI($this->available_printers[0]); |
| 215 | 215 | } |
| 216 | 216 | else |
| 217 | 217 | { |
| 218 | - trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
|
| 219 | - self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
|
| 220 | - self::_errorLog(" Printer URI is not set, die",2); |
|
| 218 | + trigger_error(_("_stringJob: Printer URI is not set: die"), E_USER_WARNING); |
|
| 219 | + self::_putDebug(_("_stringJob: Printer URI is not set: die\n"), 3); |
|
| 220 | + self::_errorLog(" Printer URI is not set, die", 2); |
|
| 221 | 221 | return FALSE; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | { |
| 252 | 252 | if (is_readable($this->data)) |
| 253 | 253 | { |
| 254 | - self::setJobName(basename($this->data),true); |
|
| 254 | + self::setJobName(basename($this->data), true); |
|
| 255 | 255 | } |
| 256 | 256 | else |
| 257 | 257 | { |
@@ -288,12 +288,12 @@ discard block |
||
| 288 | 288 | $jobattributes = ''; |
| 289 | 289 | $operationattributes = ''; |
| 290 | 290 | $printerattributes = ''; |
| 291 | - self::_buildValues ($operationattributes,$jobattributes,$printerattributes); |
|
| 291 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 292 | 292 | |
| 293 | 293 | self::_setOperationId(); |
| 294 | 294 | |
| 295 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 296 | - . chr(0x00) . chr (0x04) // Validate-Job | operation-id |
|
| 295 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 296 | + . chr(0x00).chr(0x04) // Validate-Job | operation-id |
|
| 297 | 297 | . $this->meta->operation_id // request-id |
| 298 | 298 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 299 | 299 | . $this->meta->charset |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | . $jobattributes |
| 313 | 313 | . chr(0x03); // end-of-attributes | end-of-attributes-tag |
| 314 | 314 | |
| 315 | - self::_putDebug( sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 315 | + self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 316 | 316 | |
| 317 | 317 | $this->output = $this->stringjob; |
| 318 | 318 | |
| 319 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 319 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 320 | 320 | "Data"=>$this->output); |
| 321 | 321 | |
| 322 | - if (self::_sendHttp ($post_values,$this->paths['printers'])) |
|
| 322 | + if (self::_sendHttp($post_values, $this->paths['printers'])) |
|
| 323 | 323 | { |
| 324 | - if(self::_parseServerOutput()) |
|
| 324 | + if (self::_parseServerOutput()) |
|
| 325 | 325 | { |
| 326 | 326 | self::_parseAttributes(); |
| 327 | 327 | } |
@@ -329,33 +329,33 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 331 | 331 | { |
| 332 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 332 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 333 | 333 | |
| 334 | 334 | if ($this->serveroutput->status == "successfull-ok") |
| 335 | 335 | { |
| 336 | - self::_errorLog("validate job: ".$this->serveroutput->status,3); |
|
| 336 | + self::_errorLog("validate job: ".$this->serveroutput->status, 3); |
|
| 337 | 337 | } |
| 338 | 338 | else |
| 339 | 339 | { |
| 340 | - self::_errorLog("validate job: ".$this->serveroutput->status,1); |
|
| 340 | + self::_errorLog("validate job: ".$this->serveroutput->status, 1); |
|
| 341 | 341 | } |
| 342 | 342 | return $this->serveroutput->status; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 346 | - self::_errorLog("validate job : OPERATION FAILED",3); |
|
| 345 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 346 | + self::_errorLog("validate job : OPERATION FAILED", 3); |
|
| 347 | 347 | |
| 348 | 348 | return false; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | public function getPrinterAttributes() |
| 352 | 352 | { |
| 353 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 354 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 353 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 354 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 355 | 355 | |
| 356 | 356 | $jobattributes = ''; |
| 357 | 357 | $operationattributes = ''; |
| 358 | - self::_buildValues($operationattributes,$jobattributes,$printerattributes); |
|
| 358 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 359 | 359 | self::_setOperationId(); |
| 360 | 360 | $this->parsed = array(); |
| 361 | 361 | unset($this->printer_attributes); |
@@ -367,15 +367,15 @@ discard block |
||
| 367 | 367 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 368 | 368 | unset($this->status[count($this->status) - 1]); |
| 369 | 369 | |
| 370 | - if (array_key_exists(0,$this->available_printers)) |
|
| 370 | + if (array_key_exists(0, $this->available_printers)) |
|
| 371 | 371 | { |
| 372 | 372 | self::setPrinterURI($this->available_printers[0]); |
| 373 | 373 | } |
| 374 | 374 | else |
| 375 | 375 | { |
| 376 | - trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
|
| 377 | - self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
|
| 378 | - self::_errorLog(" Printer URI is not set, die",2); |
|
| 376 | + trigger_error(_("_stringJob: Printer URI is not set: die"), E_USER_WARNING); |
|
| 377 | + self::_putDebug(_("_stringJob: Printer URI is not set: die\n"), 3); |
|
| 378 | + self::_errorLog(" Printer URI is not set, die", 2); |
|
| 379 | 379 | return FALSE; |
| 380 | 380 | } |
| 381 | 381 | } |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | self::setUserName(); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 399 | - . chr(0x00) . chr (0x0b) // Print-URI | operation-id |
|
| 398 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 399 | + . chr(0x00).chr(0x0b) // Print-URI | operation-id |
|
| 400 | 400 | . $this->meta->operation_id // request-id |
| 401 | 401 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 402 | 402 | . $this->meta->charset |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 410 | 410 | |
| 411 | - self::_putDebug(sprintf(_("Getting printer attributes of %s\n"),$this->printer_uri),2); |
|
| 411 | + self::_putDebug(sprintf(_("Getting printer attributes of %s\n"), $this->printer_uri), 2); |
|
| 412 | 412 | |
| 413 | 413 | $this->output = $this->stringjob; |
| 414 | 414 | |
| 415 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 415 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 416 | 416 | "Data"=>$this->output); |
| 417 | 417 | |
| 418 | - if (self::_sendHttp ($post_values,$this->paths['root'])) |
|
| 418 | + if (self::_sendHttp($post_values, $this->paths['root'])) |
|
| 419 | 419 | { |
| 420 | 420 | if (self::_parseServerOutput()) |
| 421 | 421 | { |
@@ -427,35 +427,35 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 429 | 429 | { |
| 430 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 430 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 431 | 431 | |
| 432 | - if ($this->serveroutput->status == "successfull-ok") |
|
| 432 | + if ($this->serveroutput->status == "successfull-ok") |
|
| 433 | 433 | { |
| 434 | - self::_errorLog(sprintf(_("getting printer attributes of %s: %s"),$this->printer_uri, |
|
| 435 | - $this->serveroutput->status),3); |
|
| 434 | + self::_errorLog(sprintf(_("getting printer attributes of %s: %s"), $this->printer_uri, |
|
| 435 | + $this->serveroutput->status), 3); |
|
| 436 | 436 | } |
| 437 | 437 | else |
| 438 | 438 | { |
| 439 | - self::_errorLog(sprintf(_("getting printer attributes of %s: %s"),$this->printer_uri, |
|
| 440 | - $this->serveroutput->status),1); |
|
| 439 | + self::_errorLog(sprintf(_("getting printer attributes of %s: %s"), $this->printer_uri, |
|
| 440 | + $this->serveroutput->status), 1); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | return $this->serveroutput->status; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 446 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 447 | 447 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 448 | 448 | .basename($_SERVER['PHP_SELF']) |
| 449 | 449 | .sprintf(_("getting printer's attributes of %s : OPERATION FAILED"), |
| 450 | - $this->printer_uri),3); |
|
| 450 | + $this->printer_uri), 3); |
|
| 451 | 451 | |
| 452 | 452 | return false; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - public function getJobs($my_jobs=true,$limit=0,$which_jobs="not-completed",$subset=false) |
|
| 455 | + public function getJobs($my_jobs = true, $limit = 0, $which_jobs = "not-completed", $subset = false) |
|
| 456 | 456 | { |
| 457 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 458 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 457 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 458 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 459 | 459 | |
| 460 | 460 | self::_setOperationId(); |
| 461 | 461 | $this->parsed = array(); |
@@ -468,15 +468,15 @@ discard block |
||
| 468 | 468 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 469 | 469 | unset($this->status[count($this->status) - 1]); |
| 470 | 470 | |
| 471 | - if (array_key_exists(0,$this->available_printers)) |
|
| 471 | + if (array_key_exists(0, $this->available_printers)) |
|
| 472 | 472 | { |
| 473 | 473 | self::setPrinterURI($this->available_printers[0]); |
| 474 | 474 | } |
| 475 | 475 | else |
| 476 | 476 | { |
| 477 | - trigger_error(_("getJobs: Printer URI is not set: die"),E_USER_WARNING); |
|
| 478 | - self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
|
| 479 | - self::_errorLog("getJobs: Printer URI is not set, die",2); |
|
| 477 | + trigger_error(_("getJobs: Printer URI is not set: die"), E_USER_WARNING); |
|
| 478 | + self::_putDebug(_("_stringJob: Printer URI is not set: die\n"), 3); |
|
| 479 | + self::_errorLog("getJobs: Printer URI is not set, die", 2); |
|
| 480 | 480 | return FALSE; |
| 481 | 481 | } |
| 482 | 482 | } |
@@ -536,8 +536,8 @@ discard block |
||
| 536 | 536 | $this->meta->my_jobs = ''; |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 540 | - . chr(0x00) . chr (0x0A) // Get-Jobs | operation-id |
|
| 539 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 540 | + . chr(0x00).chr(0x0A) // Get-Jobs | operation-id |
|
| 541 | 541 | . $this->meta->operation_id // request-id |
| 542 | 542 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 543 | 543 | . $this->meta->charset |
@@ -584,14 +584,14 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 586 | 586 | |
| 587 | - self::_putDebug(sprintf(_("getting jobs of %s\n"),$this->printer_uri),2); |
|
| 587 | + self::_putDebug(sprintf(_("getting jobs of %s\n"), $this->printer_uri), 2); |
|
| 588 | 588 | |
| 589 | 589 | $this->output = $this->stringjob; |
| 590 | 590 | |
| 591 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 591 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 592 | 592 | "Data"=>$this->output); |
| 593 | 593 | |
| 594 | - if (self::_sendHttp ($post_values,$this->paths['jobs'])) |
|
| 594 | + if (self::_sendHttp($post_values, $this->paths['jobs'])) |
|
| 595 | 595 | { |
| 596 | 596 | if (self::_parseServerOutput()) |
| 597 | 597 | { |
@@ -603,36 +603,36 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 605 | 605 | { |
| 606 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 606 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 607 | 607 | |
| 608 | 608 | if ($this->serveroutput->status == "successfull-ok") |
| 609 | 609 | { |
| 610 | - self::_errorLog(sprintf(_("getting jobs of printer %s: "),$this->printer_uri) |
|
| 611 | - .$this->serveroutput->status,3); |
|
| 610 | + self::_errorLog(sprintf(_("getting jobs of printer %s: "), $this->printer_uri) |
|
| 611 | + .$this->serveroutput->status, 3); |
|
| 612 | 612 | } |
| 613 | 613 | else |
| 614 | 614 | { |
| 615 | - self::_errorLog(sprintf(_("getting jobs of printer %s: "),$this->printer_uri) |
|
| 616 | - .$this->serveroutput->status,1); |
|
| 615 | + self::_errorLog(sprintf(_("getting jobs of printer %s: "), $this->printer_uri) |
|
| 616 | + .$this->serveroutput->status, 1); |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | return $this->serveroutput->status; |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 622 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 623 | 623 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 624 | 624 | .basename($_SERVER['PHP_SELF']) |
| 625 | 625 | .sprintf(_("getting jobs of %s : OPERATION FAILED"), |
| 626 | - $this->printer_uri),3); |
|
| 626 | + $this->printer_uri), 3); |
|
| 627 | 627 | |
| 628 | 628 | return false; |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | |
| 632 | - public function getJobAttributes($job_uri,$subset=false,$attributes_group="all") |
|
| 632 | + public function getJobAttributes($job_uri, $subset = false, $attributes_group = "all") |
|
| 633 | 633 | { |
| 634 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 635 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 634 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 635 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 636 | 636 | |
| 637 | 637 | if (!$job_uri) |
| 638 | 638 | { |
@@ -651,15 +651,15 @@ discard block |
||
| 651 | 651 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 652 | 652 | unset($this->status[count($this->status) - 1]); |
| 653 | 653 | |
| 654 | - if (array_key_exists(0,$this->available_printers)) |
|
| 654 | + if (array_key_exists(0, $this->available_printers)) |
|
| 655 | 655 | { |
| 656 | 656 | self::setPrinterURI($this->available_printers[0]); |
| 657 | 657 | } |
| 658 | 658 | else |
| 659 | 659 | { |
| 660 | - trigger_error(_("getJobs: Printer URI is not set: die"),E_USER_WARNING); |
|
| 661 | - self::_putDebug( _("_stringJob: Printer URI is not set: die\n"),3); |
|
| 662 | - self::_errorLog("getJobs: Printer URI is not set, die",2); |
|
| 660 | + trigger_error(_("getJobs: Printer URI is not set: die"), E_USER_WARNING); |
|
| 661 | + self::_putDebug(_("_stringJob: Printer URI is not set: die\n"), 3); |
|
| 662 | + self::_errorLog("getJobs: Printer URI is not set, die", 2); |
|
| 663 | 663 | return FALSE; |
| 664 | 664 | } |
| 665 | 665 | } |
@@ -685,8 +685,8 @@ discard block |
||
| 685 | 685 | . self::_giveMeStringLength($job_uri) |
| 686 | 686 | . $job_uri; |
| 687 | 687 | |
| 688 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 689 | - . chr(0x00) . chr (0x09) // Get-Job-Attributes | operation-id |
|
| 688 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 689 | + . chr(0x00).chr(0x09) // Get-Job-Attributes | operation-id |
|
| 690 | 690 | . $this->meta->operation_id // request-id |
| 691 | 691 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 692 | 692 | . $this->meta->charset |
@@ -717,9 +717,9 @@ discard block |
||
| 717 | 717 | . self::_giveMeStringLength('job-state-reason') |
| 718 | 718 | . 'job-state-reason'; |
| 719 | 719 | } |
| 720 | - elseif($attributes_group) |
|
| 720 | + elseif ($attributes_group) |
|
| 721 | 721 | { |
| 722 | - switch($attributes_group) |
|
| 722 | + switch ($attributes_group) |
|
| 723 | 723 | { |
| 724 | 724 | case 'job-template': |
| 725 | 725 | break; |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | case 'all': |
| 729 | 729 | break; |
| 730 | 730 | default: |
| 731 | - trigger_error(_('not a valid attribute group: ').$attributes_group,E_USER_NOTICE); |
|
| 731 | + trigger_error(_('not a valid attribute group: ').$attributes_group, E_USER_NOTICE); |
|
| 732 | 732 | $attributes_group = ''; |
| 733 | 733 | break; |
| 734 | 734 | } |
@@ -743,14 +743,14 @@ discard block |
||
| 743 | 743 | |
| 744 | 744 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 745 | 745 | |
| 746 | - self::_putDebug(sprintf(_("getting jobs of %s\n"),$this->printer_uri),2); |
|
| 746 | + self::_putDebug(sprintf(_("getting jobs of %s\n"), $this->printer_uri), 2); |
|
| 747 | 747 | |
| 748 | 748 | $this->output = $this->stringjob; |
| 749 | 749 | |
| 750 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 750 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 751 | 751 | "Data"=>$this->output); |
| 752 | 752 | |
| 753 | - if (self::_sendHttp ($post_values,$this->paths['jobs'])) |
|
| 753 | + if (self::_sendHttp($post_values, $this->paths['jobs'])) |
|
| 754 | 754 | { |
| 755 | 755 | if (self::_parseServerOutput()) |
| 756 | 756 | { |
@@ -762,27 +762,27 @@ discard block |
||
| 762 | 762 | |
| 763 | 763 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 764 | 764 | { |
| 765 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 765 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 766 | 766 | |
| 767 | 767 | if ($this->serveroutput->status == "successfull-ok") |
| 768 | 768 | { |
| 769 | - self::_errorLog(sprintf(_("getting job attributes for %s: "),$job_uri) |
|
| 770 | - .$this->serveroutput->status,3); |
|
| 769 | + self::_errorLog(sprintf(_("getting job attributes for %s: "), $job_uri) |
|
| 770 | + .$this->serveroutput->status, 3); |
|
| 771 | 771 | } |
| 772 | 772 | else |
| 773 | 773 | { |
| 774 | - self::_errorLog(sprintf(_("getting job attributes for %s: "),$job_uri) |
|
| 775 | - .$this->serveroutput->status,1); |
|
| 774 | + self::_errorLog(sprintf(_("getting job attributes for %s: "), $job_uri) |
|
| 775 | + .$this->serveroutput->status, 1); |
|
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | return $this->serveroutput->status; |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 781 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 782 | 782 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 783 | 783 | .basename($_SERVER['PHP_SELF']) |
| 784 | 784 | .sprintf(_("getting jobs attributes of %s : OPERATION FAILED"), |
| 785 | - $job_uri),3); |
|
| 785 | + $job_uri), 3); |
|
| 786 | 786 | |
| 787 | 787 | return false; |
| 788 | 788 | } |
@@ -790,12 +790,12 @@ discard block |
||
| 790 | 790 | public function getPrinters() |
| 791 | 791 | { |
| 792 | 792 | // placeholder for vendor extension operation (getAvailablePrinters for CUPS) |
| 793 | - $this->jobs = array_merge($this->jobs,array('')); |
|
| 794 | - $this->jobs_uri = array_merge($this->jobs_uri,array('')); |
|
| 795 | - $this->status = array_merge($this->status,array('')); |
|
| 793 | + $this->jobs = array_merge($this->jobs, array('')); |
|
| 794 | + $this->jobs_uri = array_merge($this->jobs_uri, array('')); |
|
| 795 | + $this->status = array_merge($this->status, array('')); |
|
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - public function generateError ($error) |
|
| 798 | + public function generateError($error) |
|
| 799 | 799 | { |
| 800 | 800 | switch ($error) |
| 801 | 801 | { |
@@ -807,31 +807,31 @@ discard block |
||
| 807 | 807 | break; |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - trigger_error(sprintf(_('Setting Error %s'),$error),E_USER_NOTICE); |
|
| 810 | + trigger_error(sprintf(_('Setting Error %s'), $error), E_USER_NOTICE); |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | - public function resetError ($error) |
|
| 813 | + public function resetError($error) |
|
| 814 | 814 | { |
| 815 | 815 | unset ($this->error_generation->$error); |
| 816 | - trigger_error(sprintf(_('Reset Error %s'),$error),E_USER_NOTICE); |
|
| 816 | + trigger_error(sprintf(_('Reset Error %s'), $error), E_USER_NOTICE); |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | // SETUP |
| 820 | - protected function _setOperationId () |
|
| 820 | + protected function _setOperationId() |
|
| 821 | 821 | { |
| 822 | 822 | $prepend = ''; |
| 823 | 823 | $this->operation_id += 1; |
| 824 | 824 | $this->meta->operation_id = self::_integerBuild($this->operation_id); |
| 825 | - self::_putDebug( "operation id is: ".$this->operation_id."\n",2); |
|
| 825 | + self::_putDebug("operation id is: ".$this->operation_id."\n", 2); |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | protected function _setJobId() |
| 829 | 829 | { |
| 830 | 830 | |
| 831 | - $this->meta->jobid +=1; |
|
| 831 | + $this->meta->jobid += 1; |
|
| 832 | 832 | $prepend = ''; |
| 833 | 833 | $prepend_length = 4 - strlen($this->meta->jobid); |
| 834 | - for ($i = 0; $i < $prepend_length ; $i++ ) |
|
| 834 | + for ($i = 0; $i < $prepend_length; $i++) |
|
| 835 | 835 | { |
| 836 | 836 | $prepend .= '0'; |
| 837 | 837 | } |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | return $prepend.$this->meta->jobid; |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | - protected function _setJobUri ($job_uri) |
|
| 842 | + protected function _setJobUri($job_uri) |
|
| 843 | 843 | { |
| 844 | 844 | $this->meta->job_uri = chr(0x45) // type uri |
| 845 | 845 | . chr(0x00).chr(0x07) // name-length |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | . self::_giveMeStringLength($job_uri) |
| 849 | 849 | . $job_uri; |
| 850 | 850 | |
| 851 | - self::_putDebug( "job-uri is: ".$job_uri."\n",2); |
|
| 851 | + self::_putDebug("job-uri is: ".$job_uri."\n", 2); |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | // RESPONSE PARSING |
@@ -859,9 +859,9 @@ discard block |
||
| 859 | 859 | |
| 860 | 860 | $k = -1; |
| 861 | 861 | $l = 0; |
| 862 | - for ($i = 0 ; $i < count($this->serveroutput->response) ; $i++) |
|
| 862 | + for ($i = 0; $i < count($this->serveroutput->response); $i++) |
|
| 863 | 863 | { |
| 864 | - for ($j = 0 ; $j < (count($this->serveroutput->response[$i]) - 1) ; $j ++) |
|
| 864 | + for ($j = 0; $j < (count($this->serveroutput->response[$i]) - 1); $j++) |
|
| 865 | 865 | { |
| 866 | 866 | if (!empty($this->serveroutput->response[$i][$j]['name'])) |
| 867 | 867 | { |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | } |
| 875 | 875 | else |
| 876 | 876 | { |
| 877 | - $l ++; |
|
| 877 | + $l++; |
|
| 878 | 878 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 879 | 879 | } |
| 880 | 880 | } |
@@ -882,16 +882,16 @@ discard block |
||
| 882 | 882 | $this->serveroutput->response = array(); |
| 883 | 883 | |
| 884 | 884 | $this->printer_attributes = new \stdClass(); |
| 885 | - for ($i = 0 ; $i < count($this->parsed) ; $i ++) |
|
| 885 | + for ($i = 0; $i < count($this->parsed); $i++) |
|
| 886 | 886 | { |
| 887 | 887 | $name = $this->parsed[$i]['name']; |
| 888 | - $php_name = str_replace('-','_',$name); |
|
| 888 | + $php_name = str_replace('-', '_', $name); |
|
| 889 | 889 | $type = $this->parsed[$i]['type']; |
| 890 | 890 | $range = $this->parsed[$i]['range']; |
| 891 | 891 | $this->printer_attributes->$php_name = new \stdClass(); |
| 892 | 892 | $this->printer_attributes->$php_name->_type = $type; |
| 893 | 893 | $this->printer_attributes->$php_name->_range = $range; |
| 894 | - for ($j = 0 ; $j < (count($this->parsed[$i]) - 3) ; $j ++) |
|
| 894 | + for ($j = 0; $j < (count($this->parsed[$i]) - 3); $j++) |
|
| 895 | 895 | { |
| 896 | 896 | $value = $this->parsed[$i][$j]; |
| 897 | 897 | $index = '_value'.$j; |
@@ -909,14 +909,14 @@ discard block |
||
| 909 | 909 | |
| 910 | 910 | $job = -1; |
| 911 | 911 | $l = 0; |
| 912 | - for ($i = 0 ; $i < count($this->serveroutput->response) ; $i++) |
|
| 912 | + for ($i = 0; $i < count($this->serveroutput->response); $i++) |
|
| 913 | 913 | { |
| 914 | 914 | if ($this->serveroutput->response[$i]['attributes'] == "job-attributes") |
| 915 | 915 | { |
| 916 | - $job ++; |
|
| 916 | + $job++; |
|
| 917 | 917 | } |
| 918 | 918 | $k = -1; |
| 919 | - for ($j = 0 ; $j < (count($this->serveroutput->response[$i]) - 1) ; $j ++) |
|
| 919 | + for ($j = 0; $j < (count($this->serveroutput->response[$i]) - 1); $j++) |
|
| 920 | 920 | { |
| 921 | 921 | if (!empty($this->serveroutput->response[$i][$j]['name'])) |
| 922 | 922 | { |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | } |
| 930 | 930 | else |
| 931 | 931 | { |
| 932 | - $l ++; |
|
| 932 | + $l++; |
|
| 933 | 933 | $this->parsed[$job][$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 934 | 934 | } |
| 935 | 935 | } |
@@ -937,20 +937,20 @@ discard block |
||
| 937 | 937 | |
| 938 | 938 | $this->serveroutput->response = array(); |
| 939 | 939 | $this->jobs_attributes = new \stdClass(); |
| 940 | - for ($job_nbr = 0 ; $job_nbr <= $job ; $job_nbr ++) |
|
| 940 | + for ($job_nbr = 0; $job_nbr <= $job; $job_nbr++) |
|
| 941 | 941 | { |
| 942 | 942 | $job_index = "job_".$job_nbr; |
| 943 | 943 | $this->jobs_attributes->$job_index = new \stdClass(); |
| 944 | - for ($i = 0 ; $i < count($this->parsed[$job_nbr]) ; $i ++) |
|
| 944 | + for ($i = 0; $i < count($this->parsed[$job_nbr]); $i++) |
|
| 945 | 945 | { |
| 946 | 946 | $name = $this->parsed[$job_nbr][$i]['name']; |
| 947 | - $php_name = str_replace('-','_',$name); |
|
| 947 | + $php_name = str_replace('-', '_', $name); |
|
| 948 | 948 | $type = $this->parsed[$job_nbr][$i]['type']; |
| 949 | 949 | $range = $this->parsed[$job_nbr][$i]['range']; |
| 950 | 950 | $this->jobs_attributes->$job_index->$php_name = new \stdClass(); |
| 951 | 951 | $this->jobs_attributes->$job_index->$php_name->_type = $type; |
| 952 | 952 | $this->jobs_attributes->$job_index->$php_name->_range = $range; |
| 953 | - for ($j = 0 ; $j < (count($this->parsed[$job_nbr][$i]) - 3) ; $j ++) |
|
| 953 | + for ($j = 0; $j < (count($this->parsed[$job_nbr][$i]) - 3); $j++) |
|
| 954 | 954 | { |
| 955 | 955 | # This causes incorrect parsing of integer job attributes. |
| 956 | 956 | # 2010-08-16 |
@@ -980,28 +980,28 @@ discard block |
||
| 980 | 980 | case "begCollection": //RFC3382 (BLIND CODE) |
| 981 | 981 | if ($this->end_collection) |
| 982 | 982 | { |
| 983 | - $this->index --; |
|
| 983 | + $this->index--; |
|
| 984 | 984 | } |
| 985 | 985 | $this->end_collection = false; |
| 986 | 986 | $this->serveroutput->response[$attributes_type][$j]['type'] = "collection"; |
| 987 | - self::_putDebug( "tag is: begCollection\n"); |
|
| 988 | - self::_readAttributeName ($attributes_type,$j); |
|
| 987 | + self::_putDebug("tag is: begCollection\n"); |
|
| 988 | + self::_readAttributeName($attributes_type, $j); |
|
| 989 | 989 | if (!$this->serveroutput->response[$attributes_type][$j]['name']) |
| 990 | 990 | { // it is a multi-valued collection |
| 991 | - $this->collection_depth ++; |
|
| 992 | - $this->index --; |
|
| 993 | - $this->collection_nbr[$this->collection_depth] ++; |
|
| 991 | + $this->collection_depth++; |
|
| 992 | + $this->index--; |
|
| 993 | + $this->collection_nbr[$this->collection_depth]++; |
|
| 994 | 994 | } |
| 995 | 995 | else |
| 996 | 996 | { |
| 997 | - $this->collection_depth ++; |
|
| 997 | + $this->collection_depth++; |
|
| 998 | 998 | if ($this->collection_depth == 0) |
| 999 | 999 | { |
| 1000 | 1000 | $this->collection = (object) 'collection'; |
| 1001 | 1001 | } |
| 1002 | - if (array_key_exists($this->collection_depth,$this->collection_nbr)) |
|
| 1002 | + if (array_key_exists($this->collection_depth, $this->collection_nbr)) |
|
| 1003 | 1003 | { |
| 1004 | - $this->collection_nbr[$this->collection_depth] ++; |
|
| 1004 | + $this->collection_nbr[$this->collection_depth]++; |
|
| 1005 | 1005 | } |
| 1006 | 1006 | else |
| 1007 | 1007 | { |
@@ -1009,22 +1009,22 @@ discard block |
||
| 1009 | 1009 | } |
| 1010 | 1010 | unset($this->end_collection); |
| 1011 | 1011 | } |
| 1012 | - self::_readValue ("begCollection",$attributes_type,$j); |
|
| 1012 | + self::_readValue("begCollection", $attributes_type, $j); |
|
| 1013 | 1013 | break; |
| 1014 | 1014 | case "endCollection": //RFC3382 (BLIND CODE) |
| 1015 | 1015 | $this->serveroutput->response[$attributes_type][$j]['type'] = "collection"; |
| 1016 | - self::_putDebug( "tag is: endCollection\n"); |
|
| 1017 | - self::_readAttributeName ($attributes_type,$j,0); |
|
| 1018 | - self::_readValue ('name',$attributes_type,$j,0); |
|
| 1019 | - $this->collection_depth --; |
|
| 1016 | + self::_putDebug("tag is: endCollection\n"); |
|
| 1017 | + self::_readAttributeName($attributes_type, $j, 0); |
|
| 1018 | + self::_readValue('name', $attributes_type, $j, 0); |
|
| 1019 | + $this->collection_depth--; |
|
| 1020 | 1020 | $this->collection_key[$this->collection_depth] = 0; |
| 1021 | 1021 | $this->end_collection = true; |
| 1022 | 1022 | break; |
| 1023 | 1023 | case "memberAttrName": // RFC3382 (BLIND CODE) |
| 1024 | 1024 | $this->serveroutput->response[$attributes_type][$j]['type'] = "memberAttrName"; |
| 1025 | - $this->index -- ; |
|
| 1026 | - self::_putDebug( "tag is: memberAttrName\n"); |
|
| 1027 | - self::_readCollection ($attributes_type,$j); |
|
| 1025 | + $this->index--; |
|
| 1026 | + self::_putDebug("tag is: memberAttrName\n"); |
|
| 1027 | + self::_readCollection($attributes_type, $j); |
|
| 1028 | 1028 | break; |
| 1029 | 1029 | |
| 1030 | 1030 | default: |
@@ -1032,8 +1032,8 @@ discard block |
||
| 1032 | 1032 | $this->collection_key = array(); |
| 1033 | 1033 | $this->collection_nbr = array(); |
| 1034 | 1034 | $this->serveroutput->response[$attributes_type][$j]['type'] = $tag; |
| 1035 | - self::_putDebug( "tag is: $tag\n"); |
|
| 1036 | - $attribute_name = self::_readAttributeName ($attributes_type,$j); |
|
| 1035 | + self::_putDebug("tag is: $tag\n"); |
|
| 1036 | + $attribute_name = self::_readAttributeName($attributes_type, $j); |
|
| 1037 | 1037 | if (!$attribute_name) |
| 1038 | 1038 | { |
| 1039 | 1039 | $attribute_name = $this->attribute_name; |
@@ -1042,9 +1042,9 @@ discard block |
||
| 1042 | 1042 | { |
| 1043 | 1043 | $this->attribute_name = $attribute_name; |
| 1044 | 1044 | } |
| 1045 | - $value = self::_readValue ($tag,$attributes_type,$j); |
|
| 1045 | + $value = self::_readValue($tag, $attributes_type, $j); |
|
| 1046 | 1046 | $this->serveroutput->response[$attributes_type][$j]['value'] = |
| 1047 | - self::_interpretAttribute($attribute_name,$tag,$this->serveroutput->response[$attributes_type][$j]['value']); |
|
| 1047 | + self::_interpretAttribute($attribute_name, $tag, $this->serveroutput->response[$attributes_type][$j]['value']); |
|
| 1048 | 1048 | break; |
| 1049 | 1049 | } |
| 1050 | 1050 | return; |
@@ -1164,13 +1164,13 @@ discard block |
||
| 1164 | 1164 | { |
| 1165 | 1165 | $tag = "new character string type"; |
| 1166 | 1166 | } |
| 1167 | - elseif ((0x60 <= $tag && $tag < 0x7f) || $tag >= 0x80 ) |
|
| 1167 | + elseif ((0x60 <= $tag && $tag < 0x7f) || $tag >= 0x80) |
|
| 1168 | 1168 | { |
| 1169 | 1169 | $tag = "IETF reserved for future"; |
| 1170 | 1170 | } |
| 1171 | 1171 | else |
| 1172 | 1172 | { |
| 1173 | - $tag = sprintf("UNKNOWN: 0x%x (%u)",$tag,$tag); |
|
| 1173 | + $tag = sprintf("UNKNOWN: 0x%x (%u)", $tag, $tag); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | break; |
| 1176 | 1176 | } |
@@ -1178,14 +1178,14 @@ discard block |
||
| 1178 | 1178 | return $tag; |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | - protected function _readCollection($attributes_type,$j) |
|
| 1181 | + protected function _readCollection($attributes_type, $j) |
|
| 1182 | 1182 | { |
| 1183 | - $name_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1183 | + $name_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1184 | 1184 | + ord($this->serveroutput->body[$this->_parsing->offset + 1]); |
| 1185 | 1185 | |
| 1186 | 1186 | $this->_parsing->offset += 2; |
| 1187 | 1187 | |
| 1188 | - self::_putDebug( "Collection name_length ". $name_length ."\n"); |
|
| 1188 | + self::_putDebug("Collection name_length ".$name_length."\n"); |
|
| 1189 | 1189 | |
| 1190 | 1190 | $name = ''; |
| 1191 | 1191 | for ($i = 0; $i < $name_length; $i++) |
@@ -1200,11 +1200,11 @@ discard block |
||
| 1200 | 1200 | |
| 1201 | 1201 | $collection_name = $name; |
| 1202 | 1202 | |
| 1203 | - $name_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1203 | + $name_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1204 | 1204 | + ord($this->serveroutput->body[$this->_parsing->offset + 1]); |
| 1205 | 1205 | $this->_parsing->offset += 2; |
| 1206 | 1206 | |
| 1207 | - self::_putDebug( "Attribute name_length ". $name_length ."\n"); |
|
| 1207 | + self::_putDebug("Attribute name_length ".$name_length."\n"); |
|
| 1208 | 1208 | |
| 1209 | 1209 | $name = ''; |
| 1210 | 1210 | for ($i = 0; $i < $name_length; $i++) |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | if ($attribute_name == "") |
| 1222 | 1222 | { |
| 1223 | 1223 | $attribute_name = $this->last_attribute_name; |
| 1224 | - $this->collection_key[$this->collection_depth] ++; |
|
| 1224 | + $this->collection_key[$this->collection_depth]++; |
|
| 1225 | 1225 | } |
| 1226 | 1226 | else |
| 1227 | 1227 | { |
@@ -1229,18 +1229,18 @@ discard block |
||
| 1229 | 1229 | } |
| 1230 | 1230 | $this->last_attribute_name = $attribute_name; |
| 1231 | 1231 | |
| 1232 | - self::_putDebug( "Attribute name ".$name."\n"); |
|
| 1232 | + self::_putDebug("Attribute name ".$name."\n"); |
|
| 1233 | 1233 | |
| 1234 | 1234 | $tag = self::_readTag(ord($this->serveroutput->body[$this->_parsing->offset])); |
| 1235 | - $this->_parsing->offset ++; |
|
| 1235 | + $this->_parsing->offset++; |
|
| 1236 | 1236 | |
| 1237 | 1237 | $type = $tag; |
| 1238 | 1238 | |
| 1239 | - $name_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1239 | + $name_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1240 | 1240 | + ord($this->serveroutput->body[$this->_parsing->offset + 1]); |
| 1241 | 1241 | $this->_parsing->offset += 2; |
| 1242 | 1242 | |
| 1243 | - self::_putDebug( "Collection2 name_length ". $name_length ."\n"); |
|
| 1243 | + self::_putDebug("Collection2 name_length ".$name_length."\n"); |
|
| 1244 | 1244 | |
| 1245 | 1245 | $name = ''; |
| 1246 | 1246 | for ($i = 0; $i < $name_length; $i++) |
@@ -1254,10 +1254,10 @@ discard block |
||
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | $collection_value = $name; |
| 1257 | - $value_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1257 | + $value_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1258 | 1258 | + ord($this->serveroutput->body[$this->_parsing->offset + 1]); |
| 1259 | 1259 | |
| 1260 | - self::_putDebug( "Collection value_length ".$this->serveroutput->body[ $this->_parsing->offset] |
|
| 1260 | + self::_putDebug("Collection value_length ".$this->serveroutput->body[$this->_parsing->offset] |
|
| 1261 | 1261 | . $this->serveroutput->body[$this->_parsing->offset + 1] |
| 1262 | 1262 | .": " |
| 1263 | 1263 | . $value_length |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | 1279 | $object = &$this->collection; |
| 1280 | - for ($i = 0 ; $i <= $this->collection_depth ; $i ++) |
|
| 1280 | + for ($i = 0; $i <= $this->collection_depth; $i++) |
|
| 1281 | 1281 | { |
| 1282 | 1282 | $indice = "_indice".$this->collection_nbr[$i]; |
| 1283 | 1283 | if (!isset($object->$indice)) |
@@ -1291,10 +1291,10 @@ discard block |
||
| 1291 | 1291 | $col_name_key = "_collection_name".$this->collection_key[$this->collection_depth]; |
| 1292 | 1292 | $col_val_key = "_collection_value".$this->collection_key[$this->collection_depth]; |
| 1293 | 1293 | |
| 1294 | - $attribute_value = self::_interpretAttribute($attribute_name,$tag,$value); |
|
| 1295 | - $attribute_name = str_replace('-','_',$attribute_name); |
|
| 1294 | + $attribute_value = self::_interpretAttribute($attribute_name, $tag, $value); |
|
| 1295 | + $attribute_name = str_replace('-', '_', $attribute_name); |
|
| 1296 | 1296 | |
| 1297 | - self::_putDebug( sprintf("Value: %s\n",$value)); |
|
| 1297 | + self::_putDebug(sprintf("Value: %s\n", $value)); |
|
| 1298 | 1298 | $object->$attribute_name->_type = $type; |
| 1299 | 1299 | $object->$attribute_name->$value_key = $attribute_value; |
| 1300 | 1300 | $object->$attribute_name->$col_name_key = $collection_name; |
@@ -1303,13 +1303,13 @@ discard block |
||
| 1303 | 1303 | $this->serveroutput->response[$attributes_type][$j]['value'] = $this->collection; |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | - protected function _readAttributeName ($attributes_type,$j,$write=1) |
|
| 1306 | + protected function _readAttributeName($attributes_type, $j, $write = 1) |
|
| 1307 | 1307 | { |
| 1308 | - $name_length = ord($this->serveroutput->body[ $this->_parsing->offset]) * 256 |
|
| 1308 | + $name_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1309 | 1309 | + ord($this->serveroutput->body[$this->_parsing->offset + 1]); |
| 1310 | 1310 | $this->_parsing->offset += 2; |
| 1311 | 1311 | |
| 1312 | - self::_putDebug( "name_length ". $name_length ."\n"); |
|
| 1312 | + self::_putDebug("name_length ".$name_length."\n"); |
|
| 1313 | 1313 | |
| 1314 | 1314 | $name = ''; |
| 1315 | 1315 | for ($i = 0; $i < $name_length; $i++) |
@@ -1322,22 +1322,22 @@ discard block |
||
| 1322 | 1322 | $this->_parsing->offset += 1; |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | - if($write) |
|
| 1325 | + if ($write) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | $this->serveroutput->response[$attributes_type][$j]['name'] = $name; |
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | - self::_putDebug( "name " . $name . "\n"); |
|
| 1330 | + self::_putDebug("name ".$name."\n"); |
|
| 1331 | 1331 | |
| 1332 | 1332 | return $name; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | - protected function _readValue ($type,$attributes_type,$j,$write=1) |
|
| 1335 | + protected function _readValue($type, $attributes_type, $j, $write = 1) |
|
| 1336 | 1336 | { |
| 1337 | - $value_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1337 | + $value_length = ord($this->serveroutput->body[$this->_parsing->offset]) * 256 |
|
| 1338 | 1338 | + ord($this->serveroutput->body[$this->_parsing->offset + 1]); |
| 1339 | 1339 | |
| 1340 | - self::_putDebug( "value_length ".$this->serveroutput->body[ $this->_parsing->offset] |
|
| 1340 | + self::_putDebug("value_length ".$this->serveroutput->body[$this->_parsing->offset] |
|
| 1341 | 1341 | . $this->serveroutput->body[$this->_parsing->offset + 1] |
| 1342 | 1342 | .": " |
| 1343 | 1343 | . $value_length |
@@ -1356,7 +1356,7 @@ discard block |
||
| 1356 | 1356 | $this->_parsing->offset += 1; |
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | - self::_putDebug( sprintf("Value: %s\n",$value)); |
|
| 1359 | + self::_putDebug(sprintf("Value: %s\n", $value)); |
|
| 1360 | 1360 | |
| 1361 | 1361 | if ($write) |
| 1362 | 1362 | { |
@@ -1370,9 +1370,9 @@ discard block |
||
| 1370 | 1370 | { |
| 1371 | 1371 | $k = -1; |
| 1372 | 1372 | $l = 0; |
| 1373 | - for ($i = 0 ; $i < count($this->serveroutput->response) ; $i++) |
|
| 1373 | + for ($i = 0; $i < count($this->serveroutput->response); $i++) |
|
| 1374 | 1374 | { |
| 1375 | - for ($j = 0 ; $j < (count($this->serveroutput->response[$i]) - 1) ; $j ++) |
|
| 1375 | + for ($j = 0; $j < (count($this->serveroutput->response[$i]) - 1); $j++) |
|
| 1376 | 1376 | { |
| 1377 | 1377 | if (!empty($this->serveroutput->response[$i][$j]['name'])) |
| 1378 | 1378 | { |
@@ -1385,23 +1385,23 @@ discard block |
||
| 1385 | 1385 | } |
| 1386 | 1386 | else |
| 1387 | 1387 | { |
| 1388 | - $l ++; |
|
| 1388 | + $l++; |
|
| 1389 | 1389 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 1390 | 1390 | } |
| 1391 | 1391 | } |
| 1392 | 1392 | } |
| 1393 | 1393 | $this->serveroutput->response = array(); |
| 1394 | - $this->attributes = new \stdClass(); |
|
| 1395 | - for ($i = 0 ; $i < count($this->parsed) ; $i ++) |
|
| 1394 | + $this->attributes = new \stdClass(); |
|
| 1395 | + for ($i = 0; $i < count($this->parsed); $i++) |
|
| 1396 | 1396 | { |
| 1397 | 1397 | $name = $this->parsed[$i]['name']; |
| 1398 | - $php_name = str_replace('-','_',$name); |
|
| 1398 | + $php_name = str_replace('-', '_', $name); |
|
| 1399 | 1399 | $type = $this->parsed[$i]['type']; |
| 1400 | 1400 | $range = $this->parsed[$i]['range']; |
| 1401 | 1401 | $this->attributes->$php_name = new \stdClass(); |
| 1402 | 1402 | $this->attributes->$php_name->_type = $type; |
| 1403 | 1403 | $this->attributes->$php_name->_range = $range; |
| 1404 | - for ($j = 0 ; $j < (count($this->parsed[$i]) - 3) ; $j ++) |
|
| 1404 | + for ($j = 0; $j < (count($this->parsed[$i]) - 3); $j++) |
|
| 1405 | 1405 | { |
| 1406 | 1406 | $value = $this->parsed[$i][$j]; |
| 1407 | 1407 | $index = '_value'.$j; |
@@ -1418,9 +1418,9 @@ discard block |
||
| 1418 | 1418 | // return false; |
| 1419 | 1419 | $k = -1; |
| 1420 | 1420 | $l = 0; |
| 1421 | - for ($i = 0 ; $i < count($this->serveroutput->response) ; $i++) |
|
| 1421 | + for ($i = 0; $i < count($this->serveroutput->response); $i++) |
|
| 1422 | 1422 | { |
| 1423 | - for ($j = 0 ; $j < (count($this->serveroutput->response[$i]) - 1) ; $j ++) |
|
| 1423 | + for ($j = 0; $j < (count($this->serveroutput->response[$i]) - 1); $j++) |
|
| 1424 | 1424 | { |
| 1425 | 1425 | if (!empty($this->serveroutput->response[$i][$j]['name'])) |
| 1426 | 1426 | { |
@@ -1433,7 +1433,7 @@ discard block |
||
| 1433 | 1433 | } |
| 1434 | 1434 | else |
| 1435 | 1435 | { |
| 1436 | - $l ++; |
|
| 1436 | + $l++; |
|
| 1437 | 1437 | $this->parsed[$k][$l] = $this->serveroutput->response[$i][$j]['value']; |
| 1438 | 1438 | } |
| 1439 | 1439 | } |
@@ -1442,16 +1442,16 @@ discard block |
||
| 1442 | 1442 | $this->serveroutput->response = array(); |
| 1443 | 1443 | |
| 1444 | 1444 | $this->job_attributes = new \stdClass(); |
| 1445 | - for ($i = 0 ; $i < count($this->parsed) ; $i ++) |
|
| 1445 | + for ($i = 0; $i < count($this->parsed); $i++) |
|
| 1446 | 1446 | { |
| 1447 | 1447 | $name = $this->parsed[$i]['name']; |
| 1448 | - $php_name = str_replace('-','_',$name); |
|
| 1448 | + $php_name = str_replace('-', '_', $name); |
|
| 1449 | 1449 | $type = $this->parsed[$i]['type']; |
| 1450 | 1450 | $range = $this->parsed[$i]['range']; |
| 1451 | 1451 | $this->job_attributes->$php_name = new \stdClass(); |
| 1452 | 1452 | $this->job_attributes->$php_name->_type = $type; |
| 1453 | 1453 | $this->job_attributes->$php_name->_range = $range; |
| 1454 | - for ($j = 0 ; $j < (count($this->parsed[$i]) - 3) ; $j ++) |
|
| 1454 | + for ($j = 0; $j < (count($this->parsed[$i]) - 3); $j++) |
|
| 1455 | 1455 | { |
| 1456 | 1456 | $value = $this->parsed[$i][$j]; |
| 1457 | 1457 | $index = '_value'.$j; |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | $this->parsed = array(); |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | - protected function _interpretAttribute($attribute_name,$type,$value) |
|
| 1465 | + protected function _interpretAttribute($attribute_name, $type, $value) |
|
| 1466 | 1466 | { |
| 1467 | 1467 | switch ($type) |
| 1468 | 1468 | { |
@@ -1487,12 +1487,12 @@ discard block |
||
| 1487 | 1487 | $value = self::_interpretDateTime($value); |
| 1488 | 1488 | break; |
| 1489 | 1489 | case 'enum': |
| 1490 | - $value = $this->_interpretEnum($attribute_name,$value); // must be overwritten by children |
|
| 1490 | + $value = $this->_interpretEnum($attribute_name, $value); // must be overwritten by children |
|
| 1491 | 1491 | break; |
| 1492 | 1492 | case 'resolution': |
| 1493 | 1493 | $unit = $value[8]; |
| 1494 | - $value = self::_interpretRangeOfInteger(substr($value,0,8)); |
|
| 1495 | - switch($unit) |
|
| 1494 | + $value = self::_interpretRangeOfInteger(substr($value, 0, 8)); |
|
| 1495 | + switch ($unit) |
|
| 1496 | 1496 | { |
| 1497 | 1497 | case chr(0x03): |
| 1498 | 1498 | $unit = "dpi"; |
@@ -1516,32 +1516,32 @@ discard block |
||
| 1516 | 1516 | |
| 1517 | 1517 | $halfsize = strlen($value) / 2; |
| 1518 | 1518 | |
| 1519 | - $integer1 = self::_interpretInteger(substr($value,0,$halfsize)); |
|
| 1520 | - $integer2 = self::_interpretInteger(substr($value,$halfsize,$halfsize)); |
|
| 1519 | + $integer1 = self::_interpretInteger(substr($value, 0, $halfsize)); |
|
| 1520 | + $integer2 = self::_interpretInteger(substr($value, $halfsize, $halfsize)); |
|
| 1521 | 1521 | |
| 1522 | - $value_parsed = sprintf('%s-%s',$integer1,$integer2); |
|
| 1522 | + $value_parsed = sprintf('%s-%s', $integer1, $integer2); |
|
| 1523 | 1523 | |
| 1524 | 1524 | return $value_parsed; |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | 1527 | protected function _interpretDateTime($date) |
| 1528 | 1528 | { |
| 1529 | - $year = self::_interpretInteger(substr($date,0,2)); |
|
| 1530 | - $month = self::_interpretInteger(substr($date,2,1)); |
|
| 1531 | - $day = self::_interpretInteger(substr($date,3,1)); |
|
| 1532 | - $hour = self::_interpretInteger(substr($date,4,1)); |
|
| 1533 | - $minute = self::_interpretInteger(substr($date,5,1)); |
|
| 1534 | - $second = self::_interpretInteger(substr($date,6,1)); |
|
| 1535 | - $direction = substr($date,8,1); |
|
| 1536 | - $hours_from_utc = self::_interpretInteger(substr($date,9,1)); |
|
| 1537 | - $minutes_from_utc = self::_interpretInteger(substr($date,10,1)); |
|
| 1538 | - |
|
| 1539 | - $date = sprintf('%s-%s-%s %s:%s:%s %s%s:%s',$year,$month,$day,$hour,$minute,$second,$direction,$hours_from_utc,$minutes_from_utc); |
|
| 1529 | + $year = self::_interpretInteger(substr($date, 0, 2)); |
|
| 1530 | + $month = self::_interpretInteger(substr($date, 2, 1)); |
|
| 1531 | + $day = self::_interpretInteger(substr($date, 3, 1)); |
|
| 1532 | + $hour = self::_interpretInteger(substr($date, 4, 1)); |
|
| 1533 | + $minute = self::_interpretInteger(substr($date, 5, 1)); |
|
| 1534 | + $second = self::_interpretInteger(substr($date, 6, 1)); |
|
| 1535 | + $direction = substr($date, 8, 1); |
|
| 1536 | + $hours_from_utc = self::_interpretInteger(substr($date, 9, 1)); |
|
| 1537 | + $minutes_from_utc = self::_interpretInteger(substr($date, 10, 1)); |
|
| 1538 | + |
|
| 1539 | + $date = sprintf('%s-%s-%s %s:%s:%s %s%s:%s', $year, $month, $day, $hour, $minute, $second, $direction, $hours_from_utc, $minutes_from_utc); |
|
| 1540 | 1540 | |
| 1541 | 1541 | return $date; |
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | - protected function _interpretEnum($attribute_name,$value) |
|
| 1544 | + protected function _interpretEnum($attribute_name, $value) |
|
| 1545 | 1545 | { |
| 1546 | 1546 | $value_parsed = self::_interpretInteger($value); |
| 1547 | 1547 | |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | } |
| 1575 | 1575 | if ($value_parsed > 0x09) |
| 1576 | 1576 | { |
| 1577 | - $value = sprintf('Unknown(IETF standards track "job-state" reserved): 0x%x',$value_parsed); |
|
| 1577 | + $value = sprintf('Unknown(IETF standards track "job-state" reserved): 0x%x', $value_parsed); |
|
| 1578 | 1578 | } |
| 1579 | 1579 | break; |
| 1580 | 1580 | case 'print-quality': |
@@ -1608,16 +1608,16 @@ discard block |
||
| 1608 | 1608 | } |
| 1609 | 1609 | if ($value_parsed > 0x05) |
| 1610 | 1610 | { |
| 1611 | - $value = sprintf('Unknown(IETF standards track "printer-state" reserved): 0x%x',$value_parsed); |
|
| 1611 | + $value = sprintf('Unknown(IETF standards track "printer-state" reserved): 0x%x', $value_parsed); |
|
| 1612 | 1612 | } |
| 1613 | 1613 | break; |
| 1614 | 1614 | |
| 1615 | 1615 | case 'operations-supported': |
| 1616 | - switch($value_parsed) |
|
| 1616 | + switch ($value_parsed) |
|
| 1617 | 1617 | { |
| 1618 | 1618 | case 0x0000: |
| 1619 | 1619 | case 0x0001: |
| 1620 | - $value = sprintf('Unknown(reserved) : %s',ord($value)); |
|
| 1620 | + $value = sprintf('Unknown(reserved) : %s', ord($value)); |
|
| 1621 | 1621 | break; |
| 1622 | 1622 | case 0x0002: |
| 1623 | 1623 | $value = 'Print-Job'; |
@@ -1701,19 +1701,19 @@ discard block |
||
| 1701 | 1701 | $value = 'Get-Notifications'; |
| 1702 | 1702 | break; |
| 1703 | 1703 | case 0x001D: |
| 1704 | - $value = sprintf('Unknown (reserved IETF "operations"): 0x%x',ord($value)); |
|
| 1704 | + $value = sprintf('Unknown (reserved IETF "operations"): 0x%x', ord($value)); |
|
| 1705 | 1705 | break; |
| 1706 | 1706 | case 0x001E: |
| 1707 | - $value = sprintf('Unknown (reserved IETF "operations"): 0x%x',ord($value)); |
|
| 1707 | + $value = sprintf('Unknown (reserved IETF "operations"): 0x%x', ord($value)); |
|
| 1708 | 1708 | break; |
| 1709 | 1709 | case 0x001F: |
| 1710 | - $value = sprintf('Unknown (reserved IETF "operations"): 0x%x',ord($value)); |
|
| 1710 | + $value = sprintf('Unknown (reserved IETF "operations"): 0x%x', ord($value)); |
|
| 1711 | 1711 | break; |
| 1712 | 1712 | case 0x0020: |
| 1713 | - $value = sprintf('Unknown (reserved IETF "operations"): 0x%x',ord($value)); |
|
| 1713 | + $value = sprintf('Unknown (reserved IETF "operations"): 0x%x', ord($value)); |
|
| 1714 | 1714 | break; |
| 1715 | 1715 | case 0x0021: |
| 1716 | - $value = sprintf('Unknown (reserved IETF "operations"): 0x%x',ord($value)); |
|
| 1716 | + $value = sprintf('Unknown (reserved IETF "operations"): 0x%x', ord($value)); |
|
| 1717 | 1717 | break; |
| 1718 | 1718 | case 0x0022: |
| 1719 | 1719 | $value = 'Enable-Printer'; |
@@ -1748,22 +1748,22 @@ discard block |
||
| 1748 | 1748 | } |
| 1749 | 1749 | if ($value_parsed > 0x002B && $value_parsed <= 0x3FFF) |
| 1750 | 1750 | { |
| 1751 | - $value = sprintf('Unknown(IETF standards track operations reserved): 0x%x',$value_parsed); |
|
| 1751 | + $value = sprintf('Unknown(IETF standards track operations reserved): 0x%x', $value_parsed); |
|
| 1752 | 1752 | } |
| 1753 | 1753 | elseif ($value_parsed >= 0x4000 && $value_parsed <= 0x8FFF) |
| 1754 | 1754 | { |
| 1755 | - if (method_exists($this,'_getEnumVendorExtensions')) |
|
| 1755 | + if (method_exists($this, '_getEnumVendorExtensions')) |
|
| 1756 | 1756 | { |
| 1757 | 1757 | $value = $this->_getEnumVendorExtensions($value_parsed); |
| 1758 | 1758 | } |
| 1759 | 1759 | else |
| 1760 | 1760 | { |
| 1761 | - $value = sprintf('Unknown(Vendor extension for operations): 0x%x',$value_parsed); |
|
| 1761 | + $value = sprintf('Unknown(Vendor extension for operations): 0x%x', $value_parsed); |
|
| 1762 | 1762 | } |
| 1763 | 1763 | } |
| 1764 | 1764 | elseif ($value_parsed > 0x8FFF) |
| 1765 | 1765 | { |
| 1766 | - $value = sprintf('Unknown operation (should not exists): 0x%x',$value_parsed); |
|
| 1766 | + $value = sprintf('Unknown operation (should not exists): 0x%x', $value_parsed); |
|
| 1767 | 1767 | } |
| 1768 | 1768 | |
| 1769 | 1769 | break; |
@@ -1832,7 +1832,7 @@ discard block |
||
| 1832 | 1832 | } |
| 1833 | 1833 | if ($value_parsed > 31) |
| 1834 | 1834 | { |
| 1835 | - $value = sprintf('Unknown(IETF standards track "finishing" reserved): 0x%x',$value_parsed); |
|
| 1835 | + $value = sprintf('Unknown(IETF standards track "finishing" reserved): 0x%x', $value_parsed); |
|
| 1836 | 1836 | } |
| 1837 | 1837 | break; |
| 1838 | 1838 | |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | } |
| 1857 | 1857 | if ($value_parsed > 0x06) |
| 1858 | 1858 | { |
| 1859 | - $value = sprintf('Unknown(IETF standards track "orientation" reserved): 0x%x',$value_parsed); |
|
| 1859 | + $value = sprintf('Unknown(IETF standards track "orientation" reserved): 0x%x', $value_parsed); |
|
| 1860 | 1860 | } |
| 1861 | 1861 | break; |
| 1862 | 1862 | |
@@ -1866,24 +1866,24 @@ discard block |
||
| 1866 | 1866 | return $value; |
| 1867 | 1867 | } |
| 1868 | 1868 | |
| 1869 | - protected function _getJobId () |
|
| 1869 | + protected function _getJobId() |
|
| 1870 | 1870 | { |
| 1871 | 1871 | if (!isset($this->serveroutput->response)) |
| 1872 | 1872 | { |
| 1873 | - $this->jobs = array_merge($this->jobs,array('NO JOB')); |
|
| 1873 | + $this->jobs = array_merge($this->jobs, array('NO JOB')); |
|
| 1874 | 1874 | } |
| 1875 | 1875 | |
| 1876 | 1876 | $jobfinded = false; |
| 1877 | - for ($i = 0 ; (!$jobfinded && array_key_exists($i,$this->serveroutput->response)) ; $i ++) |
|
| 1877 | + for ($i = 0; (!$jobfinded && array_key_exists($i, $this->serveroutput->response)); $i++) |
|
| 1878 | 1878 | { |
| 1879 | 1879 | if (($this->serveroutput->response[$i]['attributes']) == "job-attributes") |
| 1880 | 1880 | { |
| 1881 | - for ($j = 0 ; array_key_exists($j,$this->serveroutput->response[$i]) ; $j++) |
|
| 1881 | + for ($j = 0; array_key_exists($j, $this->serveroutput->response[$i]); $j++) |
|
| 1882 | 1882 | { |
| 1883 | 1883 | if ($this->serveroutput->response[$i][$j]['name'] == "job-id") |
| 1884 | 1884 | { |
| 1885 | 1885 | $this->last_job = $this->serveroutput->response[$i][$j]['value']; |
| 1886 | - $this->jobs = array_merge($this->jobs,array($this->serveroutput->response[$i][$j]['value'])); |
|
| 1886 | + $this->jobs = array_merge($this->jobs, array($this->serveroutput->response[$i][$j]['value'])); |
|
| 1887 | 1887 | return; |
| 1888 | 1888 | } |
| 1889 | 1889 | } |
@@ -1891,7 +1891,7 @@ discard block |
||
| 1891 | 1891 | } |
| 1892 | 1892 | } |
| 1893 | 1893 | |
| 1894 | - protected function _getJobUri () |
|
| 1894 | + protected function _getJobUri() |
|
| 1895 | 1895 | { |
| 1896 | 1896 | if (!isset($this->jobs_uri)) |
| 1897 | 1897 | { |
@@ -1899,16 +1899,16 @@ discard block |
||
| 1899 | 1899 | } |
| 1900 | 1900 | |
| 1901 | 1901 | $jobfinded = false; |
| 1902 | - for ($i = 0 ; (!$jobfinded && array_key_exists($i,$this->serveroutput->response)) ; $i ++) |
|
| 1902 | + for ($i = 0; (!$jobfinded && array_key_exists($i, $this->serveroutput->response)); $i++) |
|
| 1903 | 1903 | { |
| 1904 | 1904 | if (($this->serveroutput->response[$i]['attributes']) == "job-attributes") |
| 1905 | 1905 | { |
| 1906 | - for ($j = 0 ; array_key_exists($j,$this->serveroutput->response[$i]) ; $j++) |
|
| 1906 | + for ($j = 0; array_key_exists($j, $this->serveroutput->response[$i]); $j++) |
|
| 1907 | 1907 | { |
| 1908 | 1908 | if ($this->serveroutput->response[$i][$j]['name'] == "job-uri") |
| 1909 | 1909 | { |
| 1910 | 1910 | $this->last_job = $this->serveroutput->response[$i][$j]['value']; |
| 1911 | - $this->jobs_uri = array_merge($this->jobs_uri,array($this->last_job)); |
|
| 1911 | + $this->jobs_uri = array_merge($this->jobs_uri, array($this->last_job)); |
|
| 1912 | 1912 | return; |
| 1913 | 1913 | } |
| 1914 | 1914 | } |
@@ -1917,18 +1917,18 @@ discard block |
||
| 1917 | 1917 | $this->last_job = ''; |
| 1918 | 1918 | } |
| 1919 | 1919 | |
| 1920 | - protected function _parseResponse () |
|
| 1920 | + protected function _parseResponse() |
|
| 1921 | 1921 | { |
| 1922 | 1922 | $j = -1; |
| 1923 | 1923 | $this->index = 0; |
| 1924 | - for ($i = $this->_parsing->offset; $i < strlen($this->serveroutput->body) ; $i = $this->_parsing->offset) |
|
| 1924 | + for ($i = $this->_parsing->offset; $i < strlen($this->serveroutput->body); $i = $this->_parsing->offset) |
|
| 1925 | 1925 | { |
| 1926 | 1926 | $tag = ord($this->serveroutput->body[$this->_parsing->offset]); |
| 1927 | 1927 | |
| 1928 | 1928 | if ($tag > 0x0F) |
| 1929 | 1929 | { |
| 1930 | 1930 | self::_readAttribute($j); |
| 1931 | - $this->index ++; |
|
| 1931 | + $this->index++; |
|
| 1932 | 1932 | continue; |
| 1933 | 1933 | } |
| 1934 | 1934 | |
@@ -1947,14 +1947,14 @@ discard block |
||
| 1947 | 1947 | $this->_parsing->offset += 1; |
| 1948 | 1948 | break; |
| 1949 | 1949 | case 0x03: |
| 1950 | - $j +=1; |
|
| 1950 | + $j += 1; |
|
| 1951 | 1951 | $this->serveroutput->response[$j]['attributes'] = "end-of-attributes"; |
| 1952 | - self::_putDebug( "tag is: ".$this->serveroutput->response[$j]['attributes']."\n"); |
|
| 1952 | + self::_putDebug("tag is: ".$this->serveroutput->response[$j]['attributes']."\n"); |
|
| 1953 | 1953 | if ($this->alert_on_end_tag === 1) |
| 1954 | 1954 | { |
| 1955 | 1955 | echo "END tag OK<br />"; |
| 1956 | 1956 | } |
| 1957 | - $this->response_completed[(count($this->response_completed) -1)] = "completed"; |
|
| 1957 | + $this->response_completed[(count($this->response_completed) - 1)] = "completed"; |
|
| 1958 | 1958 | return; |
| 1959 | 1959 | case 0x04: |
| 1960 | 1960 | $j += 1; |
@@ -1970,13 +1970,13 @@ discard block |
||
| 1970 | 1970 | break; |
| 1971 | 1971 | default: |
| 1972 | 1972 | $j += 1; |
| 1973 | - $this->serveroutput->response[$j]['attributes'] = sprintf(_("0x%x (%u) : attributes tag Unknown (reserved for future versions of IPP"),$tag,$tag); |
|
| 1973 | + $this->serveroutput->response[$j]['attributes'] = sprintf(_("0x%x (%u) : attributes tag Unknown (reserved for future versions of IPP"), $tag, $tag); |
|
| 1974 | 1974 | $this->index = 0; |
| 1975 | 1975 | $this->_parsing->offset += 1; |
| 1976 | 1976 | break; |
| 1977 | 1977 | } |
| 1978 | 1978 | |
| 1979 | - self::_putDebug( "tag is: ".$this->serveroutput->response[$j]['attributes']."\n\n\n"); |
|
| 1979 | + self::_putDebug("tag is: ".$this->serveroutput->response[$j]['attributes']."\n\n\n"); |
|
| 1980 | 1980 | } |
| 1981 | 1981 | return; |
| 1982 | 1982 | } |
@@ -2003,7 +2003,7 @@ discard block |
||
| 2003 | 2003 | */ |
| 2004 | 2004 | |
| 2005 | 2005 | // REQUEST BUILDING |
| 2006 | - protected function _stringCancel ($job_uri) |
|
| 2006 | + protected function _stringCancel($job_uri) |
|
| 2007 | 2007 | { |
| 2008 | 2008 | |
| 2009 | 2009 | if (!isset($this->setup->charset)) |
@@ -2036,8 +2036,8 @@ discard block |
||
| 2036 | 2036 | $this->error_generation->request_body_malformed = ""; |
| 2037 | 2037 | } |
| 2038 | 2038 | |
| 2039 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 2040 | - . chr(0x00) . chr (0x08) // cancel-Job | operation-id |
|
| 2039 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 2040 | + . chr(0x00).chr(0x08) // cancel-Job | operation-id |
|
| 2041 | 2041 | . $this->meta->operation_id // request-id |
| 2042 | 2042 | . $this->error_generation->request_body_malformed |
| 2043 | 2043 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
@@ -2048,7 +2048,7 @@ discard block |
||
| 2048 | 2048 | . $this->meta->message |
| 2049 | 2049 | . chr(0x03); // end-of-attributes | end-of-attributes-tag |
| 2050 | 2050 | |
| 2051 | - self::_putDebug( sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 2051 | + self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 2052 | 2052 | return TRUE; |
| 2053 | 2053 | } |
| 2054 | 2054 | } |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function getErrorFormatted() |
| 52 | 52 | { |
| 53 | - $return = sprintf("[ipp]: %s -- " . _(" file %s, line %s"), |
|
| 54 | - $this->getMessage() , $this->getFile() , $this->getLine()); |
|
| 53 | + $return = sprintf("[ipp]: %s -- "._(" file %s, line %s"), |
|
| 54 | + $this->getMessage(), $this->getFile(), $this->getLine()); |
|
| 55 | 55 | return $return; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -157,21 +157,21 @@ discard block |
||
| 157 | 157 | public function setPort($port = '631') |
| 158 | 158 | { |
| 159 | 159 | $this->port = $port; |
| 160 | - self::_putDebug("Port is " . $this->port, 2); |
|
| 160 | + self::_putDebug("Port is ".$this->port, 2); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function setUnix($socket = '/var/run/cups/cups.sock') |
| 164 | 164 | { |
| 165 | 165 | $this->host = $socket; |
| 166 | 166 | $this->unix = true; |
| 167 | - self::_putDebug("Host is " . $this->host, 2); |
|
| 167 | + self::_putDebug("Host is ".$this->host, 2); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | public function setHost($host = 'localhost') |
| 171 | 171 | { |
| 172 | 172 | $this->host = $host; |
| 173 | 173 | $this->unix = false; |
| 174 | - self::_putDebug("Host is " . $this->host, 2); |
|
| 174 | + self::_putDebug("Host is ".$this->host, 2); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function setTimeout($timeout) |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | $length = strlen($uri); |
| 185 | 185 | $length = chr($length); |
| 186 | - while (strlen($length) < 2) $length = chr(0x00) . $length; |
|
| 186 | + while (strlen($length) < 2) $length = chr(0x00).$length; |
|
| 187 | 187 | $this->meta->printer_uri = chr(0x45) // uri type | value-tag |
| 188 | - . chr(0x00) . chr(0x0B) // name-length |
|
| 188 | + . chr(0x00).chr(0x0B) // name-length |
|
| 189 | 189 | . "printer-uri" // printer-uri | name |
| 190 | - . $length . $uri; |
|
| 190 | + . $length.$uri; |
|
| 191 | 191 | $this->printer_uri = $uri; |
| 192 | - self::_putDebug(sprintf(_("Printer URI: %s") , $uri) , 2); |
|
| 192 | + self::_putDebug(sprintf(_("Printer URI: %s"), $uri), 2); |
|
| 193 | 193 | $this->setup->uri = 1; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $this->datatail = chr(0x0c); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | - self::_putDebug(_("Forcing data to be interpreted as RAW TEXT") , 2); |
|
| 224 | + self::_putDebug(_("Forcing data to be interpreted as RAW TEXT"), 2); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | public function unsetRawText() |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $this->setup->datatype = 'BINARY'; |
| 230 | 230 | $this->datahead = ''; |
| 231 | 231 | $this->datatail = ''; |
| 232 | - self::_putDebug(_("Unset forcing data to be interpreted as RAW TEXT") , 2); |
|
| 232 | + self::_putDebug(_("Unset forcing data to be interpreted as RAW TEXT"), 2); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | public function setBinary() |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | public function setFormFeed() |
| 241 | 241 | { |
| 242 | - $this->datatail = "\r\n" . chr(0x0c); |
|
| 242 | + $this->datatail = "\r\n".chr(0x0c); |
|
| 243 | 243 | unset($this->setup->noFormFeed); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -254,11 +254,11 @@ discard block |
||
| 254 | 254 | $charset = strtolower($charset); |
| 255 | 255 | $this->charset = $charset; |
| 256 | 256 | $this->meta->charset = chr(0x47) // charset type | value-tag |
| 257 | - . chr(0x00) . chr(0x12) // name-length |
|
| 257 | + . chr(0x00).chr(0x12) // name-length |
|
| 258 | 258 | . "attributes-charset" // attributes-charset | name |
| 259 | 259 | . self::_giveMeStringLength($charset) // value-length |
| 260 | 260 | . $charset; // value |
| 261 | - self::_putDebug(sprintf(_("Charset: %s") , $charset) , 2); |
|
| 261 | + self::_putDebug(sprintf(_("Charset: %s"), $charset), 2); |
|
| 262 | 262 | $this->setup->charset = 1; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | { |
| 267 | 267 | $language = strtolower($language); |
| 268 | 268 | $this->meta->language = chr(0x48) // natural-language type | value-tag |
| 269 | - . chr(0x00) . chr(0x1B) // name-length |
|
| 269 | + . chr(0x00).chr(0x1B) // name-length |
|
| 270 | 270 | . "attributes-natural-language" //attributes-natural-language |
| 271 | 271 | . self::_giveMeStringLength($language) // value-length |
| 272 | 272 | . $language; // value |
| 273 | - self::_putDebug(sprintf(_("Language: %s") , $language) , 2); |
|
| 273 | + self::_putDebug(sprintf(_("Language: %s"), $language), 2); |
|
| 274 | 274 | $this->setup->language = 1; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | self::setBinary(); |
| 280 | 280 | $length = chr(strlen($mime_media_type)); |
| 281 | - while (strlen($length) < 2) $length = chr(0x00) . $length; |
|
| 282 | - self::_putDebug(sprintf(_("mime type: %s") , $mime_media_type) , 2); |
|
| 281 | + while (strlen($length) < 2) $length = chr(0x00).$length; |
|
| 282 | + self::_putDebug(sprintf(_("mime type: %s"), $mime_media_type), 2); |
|
| 283 | 283 | $this->meta->mime_media_type = chr(0x49) // document-format tag |
| 284 | - . self::_giveMeStringLength('document-format') . 'document-format' // |
|
| 285 | - . self::_giveMeStringLength($mime_media_type) . $mime_media_type; // value |
|
| 284 | + . self::_giveMeStringLength('document-format').'document-format' // |
|
| 285 | + . self::_giveMeStringLength($mime_media_type).$mime_media_type; // value |
|
| 286 | 286 | $this->setup->mime_media_type = 1; |
| 287 | 287 | } |
| 288 | 288 | |
@@ -303,11 +303,11 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | $copies = self::_integerBuild($nbrcopies); |
| 305 | 305 | $this->meta->copies = chr(0x21) // integer type | value-tag |
| 306 | - . chr(0x00) . chr(0x06) // name-length |
|
| 306 | + . chr(0x00).chr(0x06) // name-length |
|
| 307 | 307 | . "copies" // copies | name |
| 308 | 308 | . self::_giveMeStringLength($copies) // value-length |
| 309 | 309 | . $copies; |
| 310 | - self::_putDebug(sprintf(_("Copies: %s") , $nbrcopies) , 2); |
|
| 310 | + self::_putDebug(sprintf(_("Copies: %s"), $nbrcopies), 2); |
|
| 311 | 311 | $this->setup->copies = 1; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -320,12 +320,12 @@ discard block |
||
| 320 | 320 | $document_name = substr($document_name, 0, 1023); |
| 321 | 321 | $length = strlen($document_name); |
| 322 | 322 | $length = chr($length); |
| 323 | - while (strlen($length) < 2) $length = chr(0x00) . $length; |
|
| 324 | - self::_putDebug(sprintf(_("document name: %s") , $document_name) , 2); |
|
| 323 | + while (strlen($length) < 2) $length = chr(0x00).$length; |
|
| 324 | + self::_putDebug(sprintf(_("document name: %s"), $document_name), 2); |
|
| 325 | 325 | $this->meta->document_name = chr(0x41) // textWithoutLanguage tag |
| 326 | - . chr(0x00) . chr(0x0d) // name-length |
|
| 326 | + . chr(0x00).chr(0x0d) // name-length |
|
| 327 | 327 | . "document-name" // mimeMediaType |
| 328 | - . self::_giveMeStringLength($document_name) . $document_name; // value |
|
| 328 | + . self::_giveMeStringLength($document_name).$document_name; // value |
|
| 329 | 329 | |
| 330 | 330 | } |
| 331 | 331 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $this->meta->jobname = ''; |
| 338 | 338 | return true; |
| 339 | 339 | } |
| 340 | - $postpend = date('-H:i:s-') . $this->_setJobId(); |
|
| 340 | + $postpend = date('-H:i:s-').$this->_setJobId(); |
|
| 341 | 341 | if ($absolute) { |
| 342 | 342 | $postpend = ''; |
| 343 | 343 | } |
@@ -346,13 +346,13 @@ discard block |
||
| 346 | 346 | $jobname = $this->values->jobname; |
| 347 | 347 | } |
| 348 | 348 | $this->values->jobname = $jobname; |
| 349 | - $jobname.= $postpend; |
|
| 349 | + $jobname .= $postpend; |
|
| 350 | 350 | $this->meta->jobname = chr(0x42) // nameWithoutLanguage type || value-tag |
| 351 | - . chr(0x00) . chr(0x08) // name-length |
|
| 351 | + . chr(0x00).chr(0x08) // name-length |
|
| 352 | 352 | . "job-name" // job-name || name |
| 353 | 353 | . self::_giveMeStringLength($jobname) // value-length |
| 354 | 354 | . $jobname; // value |
| 355 | - self::_putDebug(sprintf(_("Job name: %s") , $jobname) , 2); |
|
| 355 | + self::_putDebug(sprintf(_("Job name: %s"), $jobname), 2); |
|
| 356 | 356 | $this->setup->jobname = 1; |
| 357 | 357 | } |
| 358 | 358 | |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | while (strlen($value_length) < 2) $value_length = chr(0x00) . $value_length; |
| 377 | 377 | */ |
| 378 | 378 | $this->meta->username = chr(0x42) // keyword type || value-tag |
| 379 | - . chr(0x00) . chr(0x14) // name-length |
|
| 379 | + . chr(0x00).chr(0x14) // name-length |
|
| 380 | 380 | . "requesting-user-name" |
| 381 | 381 | . self::_giveMeStringLength($username) // value-length |
| 382 | 382 | . $username; |
| 383 | - self::_putDebug(sprintf(_("Username: %s") , $username) , 2); |
|
| 383 | + self::_putDebug(sprintf(_("Username: %s"), $username), 2); |
|
| 384 | 384 | $this->setup->username = 1; |
| 385 | 385 | } |
| 386 | 386 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | { |
| 394 | 394 | $this->password = $password; |
| 395 | 395 | $this->username = $username; |
| 396 | - self::_putDebug(_("Setting password") , 2); |
|
| 396 | + self::_putDebug(_("Setting password"), 2); |
|
| 397 | 397 | $this->setup->password = 1; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -421,11 +421,11 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | $this->meta->sides = chr(0x44) // keyword type | value-tag |
| 424 | - . chr(0x00) . chr(0x05) // name-length |
|
| 424 | + . chr(0x00).chr(0x05) // name-length |
|
| 425 | 425 | . "sides" // sides | name |
| 426 | 426 | . self::_giveMeStringLength($sides) // value-length |
| 427 | 427 | . $sides; // one-sided | value |
| 428 | - self::_putDebug(sprintf(_("Sides value set to %s") , $sides) , 2); |
|
| 428 | + self::_putDebug(sprintf(_("Sides value set to %s"), $sides), 2); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | public function setFidelity() |
@@ -434,11 +434,11 @@ discard block |
||
| 434 | 434 | // (eg, 2 sided print is not possible, |
| 435 | 435 | // so print one sided) and DO NOT THE JOB. |
| 436 | 436 | $this->meta->fidelity = chr(0x22) // boolean type | value-tag |
| 437 | - . chr(0x00) . chr(0x16) // name-length |
|
| 437 | + . chr(0x00).chr(0x16) // name-length |
|
| 438 | 438 | . "ipp-attribute-fidelity" // ipp-attribute-fidelity | name |
| 439 | - . chr(0x00) . chr(0x01) // value-length |
|
| 439 | + . chr(0x00).chr(0x01) // value-length |
|
| 440 | 440 | . chr(0x01); // true | value |
| 441 | - self::_putDebug(_("Fidelity attribute is set (paranoid mode)") , 3); |
|
| 441 | + self::_putDebug(_("Fidelity attribute is set (paranoid mode)"), 3); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | public function unsetFidelity() |
@@ -447,11 +447,11 @@ discard block |
||
| 447 | 447 | // (eg, 2 sided print is not possible, |
| 448 | 448 | // so print one sided) and DO THE JOB. |
| 449 | 449 | $this->meta->fidelity = chr(0x22) // boolean type | value-tag |
| 450 | - . chr(0x00) . chr(0x16) // name-length |
|
| 450 | + . chr(0x00).chr(0x16) // name-length |
|
| 451 | 451 | . "ipp-attribute-fidelity" // ipp-attribute-fidelity | name |
| 452 | - . chr(0x00) . chr(0x01) // value-length |
|
| 452 | + . chr(0x00).chr(0x01) // value-length |
|
| 453 | 453 | . chr(0x00); // false | value |
| 454 | - self::_putDebug(_("Fidelity attribute is unset") , 2); |
|
| 454 | + self::_putDebug(_("Fidelity attribute is unset"), 2); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | public function setMessage($message = '') |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | . "message" |
| 468 | 468 | . self::_giveMeStringLength(substr($message, 0, 127)) |
| 469 | 469 | . substr($message, 0, 127); |
| 470 | - self::_putDebug(sprintf(_('Setting message to "%s"') , $message) , 2); |
|
| 470 | + self::_putDebug(sprintf(_('Setting message to "%s"'), $message), 2); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | public function setPageRanges($page_ranges) |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | $first = true; |
| 483 | 483 | #$page_ranges = split(' ', $page_ranges); |
| 484 | 484 | $page_ranges = preg_split('# #', $page_ranges); |
| 485 | - foreach($page_ranges as $page_range) |
|
| 485 | + foreach ($page_ranges as $page_range) |
|
| 486 | 486 | { |
| 487 | 487 | $value = self::_rangeOfIntegerBuild($page_range); |
| 488 | 488 | if ($first) |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | else |
| 522 | 522 | { |
| 523 | - foreach($values as $value) |
|
| 523 | + foreach ($values as $value) |
|
| 524 | 524 | { |
| 525 | 525 | self::_setOperationAttribute($attribute, $value); |
| 526 | 526 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | else |
| 536 | 536 | { |
| 537 | - foreach($values as $value) |
|
| 537 | + foreach ($values as $value) |
|
| 538 | 538 | { |
| 539 | 539 | self::_setJobAttribute($attribute, $value); |
| 540 | 540 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | else |
| 550 | 550 | { |
| 551 | - foreach($values as $value) |
|
| 551 | + foreach ($values as $value) |
|
| 552 | 552 | { |
| 553 | 553 | self::_setPrinterAttribute($attribute, $value); |
| 554 | 554 | } |
@@ -558,13 +558,13 @@ discard block |
||
| 558 | 558 | { |
| 559 | 559 | trigger_error( |
| 560 | 560 | sprintf(_('SetAttribute: Tag "%s" is not a printer or a job attribute'), |
| 561 | - $attribute) , E_USER_NOTICE); |
|
| 561 | + $attribute), E_USER_NOTICE); |
|
| 562 | 562 | self::_putDebug( |
| 563 | 563 | sprintf(_('SetAttribute: Tag "%s" is not a printer or a job attribute'), |
| 564 | - $attribute) , 3); |
|
| 564 | + $attribute), 3); |
|
| 565 | 565 | self::_errorLog( |
| 566 | 566 | sprintf(_('SetAttribute: Tag "%s" is not a printer or a job attribute'), |
| 567 | - $attribute) , 2); |
|
| 567 | + $attribute), 2); |
|
| 568 | 568 | return FALSE; |
| 569 | 569 | } |
| 570 | 570 | } |
@@ -599,13 +599,13 @@ discard block |
||
| 599 | 599 | { |
| 600 | 600 | trigger_error( |
| 601 | 601 | sprintf(_('unsetAttribute: Tag "%s" is not a printer or a job attribute'), |
| 602 | - $attribute) , E_USER_NOTICE); |
|
| 602 | + $attribute), E_USER_NOTICE); |
|
| 603 | 603 | self::_putDebug( |
| 604 | 604 | sprintf(_('unsetAttribute: Tag "%s" is not a printer or a job attribute'), |
| 605 | - $attribute) , 3); |
|
| 605 | + $attribute), 3); |
|
| 606 | 606 | self::_errorLog( |
| 607 | 607 | sprintf(_('unsetAttribute: Tag "%s" is not a printer or a job attribute'), |
| 608 | - $attribute) , 2); |
|
| 608 | + $attribute), 2); |
|
| 609 | 609 | return FALSE; |
| 610 | 610 | } |
| 611 | 611 | return true; |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $debug = ''; |
| 670 | 670 | for ($i = 0; $i < $this->debug_count; $i++) |
| 671 | 671 | { |
| 672 | - $debug.= $this->debug[$i]; |
|
| 672 | + $debug .= $this->debug[$i]; |
|
| 673 | 673 | } |
| 674 | 674 | $this->debug = array(); |
| 675 | 675 | $this->debug_count = 0; |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | $this->output = $this->stringjob; |
| 699 | 699 | if ($this->setup->datatype == "TEXT") |
| 700 | 700 | { |
| 701 | - $this->output.= chr(0x16); |
|
| 701 | + $this->output .= chr(0x16); |
|
| 702 | 702 | } |
| 703 | 703 | $post_values = array( |
| 704 | 704 | "Content-Type" => "application/ipp", |
@@ -775,13 +775,13 @@ discard block |
||
| 775 | 775 | */ |
| 776 | 776 | $this->response_completed[] = "no"; |
| 777 | 777 | unset($this->serverouptut); |
| 778 | - self::_putDebug(_("Processing HTTP request") , 2); |
|
| 778 | + self::_putDebug(_("Processing HTTP request"), 2); |
|
| 779 | 779 | $this->serveroutput->headers = array(); |
| 780 | 780 | $this->serveroutput->body = ""; |
| 781 | 781 | $http = new http_class; |
| 782 | 782 | if (!$this->unix) { |
| 783 | 783 | // DOL_LDR_CHANGE |
| 784 | - if (empty($this->host)) $this->host='127.0.0.1'; |
|
| 784 | + if (empty($this->host)) $this->host = '127.0.0.1'; |
|
| 785 | 785 | $http->host = $this->host; |
| 786 | 786 | } |
| 787 | 787 | else { |
@@ -798,12 +798,12 @@ discard block |
||
| 798 | 798 | $http->debug = 0; |
| 799 | 799 | $http->html_debug = 0; |
| 800 | 800 | } |
| 801 | - $url = "http://" . $this->host; |
|
| 801 | + $url = "http://".$this->host; |
|
| 802 | 802 | if ($this->ssl) { |
| 803 | - $url = "https://" . $this->host; |
|
| 803 | + $url = "https://".$this->host; |
|
| 804 | 804 | } |
| 805 | 805 | if ($this->unix) { |
| 806 | - $url = "unix://" . $this->host; |
|
| 806 | + $url = "unix://".$this->host; |
|
| 807 | 807 | } |
| 808 | 808 | $http->port = $this->port; |
| 809 | 809 | $http->timeout = $this->http_timeout; |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | { |
| 840 | 840 | $success = $http->Open($arguments); |
| 841 | 841 | } |
| 842 | - catch(httpException $e) |
|
| 842 | + catch (httpException $e) |
|
| 843 | 843 | { |
| 844 | 844 | throw new ippException( |
| 845 | 845 | sprintf("http error: %s", $e->getMessage()), |
@@ -857,19 +857,19 @@ discard block |
||
| 857 | 857 | { |
| 858 | 858 | self::_putDebug("H T T P R E Q U E S T :"); |
| 859 | 859 | self::_putDebug("Request headers:"); |
| 860 | - for (Reset($http->request_headers) , $header = 0; $header < count($http->request_headers); Next($http->request_headers) , $header++) |
|
| 860 | + for (Reset($http->request_headers), $header = 0; $header < count($http->request_headers); Next($http->request_headers), $header++) |
|
| 861 | 861 | { |
| 862 | 862 | $header_name = Key($http->request_headers); |
| 863 | 863 | if (GetType($http->request_headers[$header_name]) == "array") |
| 864 | 864 | { |
| 865 | 865 | for ($header_value = 0; $header_value < count($http->request_headers[$header_name]); $header_value++) |
| 866 | 866 | { |
| 867 | - self::_putDebug($header_name . ": " . $http->request_headers[$header_name][$header_value]); |
|
| 867 | + self::_putDebug($header_name.": ".$http->request_headers[$header_name][$header_value]); |
|
| 868 | 868 | } |
| 869 | 869 | } |
| 870 | 870 | else |
| 871 | 871 | { |
| 872 | - self::_putDebug($header_name . ": " . $http->request_headers[$header_name]); |
|
| 872 | + self::_putDebug($header_name.": ".$http->request_headers[$header_name]); |
|
| 873 | 873 | } |
| 874 | 874 | } |
| 875 | 875 | self::_putDebug("Request body:"); |
@@ -883,23 +883,23 @@ discard block |
||
| 883 | 883 | $http->ReadReplyHeaders($headers); |
| 884 | 884 | self::_putDebug("H T T P R E S P O N S E :"); |
| 885 | 885 | self::_putDebug("Response headers:"); |
| 886 | - for (Reset($headers) , $header = 0; $header < count($headers); Next($headers) , $header++) |
|
| 886 | + for (Reset($headers), $header = 0; $header < count($headers); Next($headers), $header++) |
|
| 887 | 887 | { |
| 888 | 888 | $header_name = Key($headers); |
| 889 | 889 | if (GetType($headers[$header_name]) == "array") |
| 890 | 890 | { |
| 891 | 891 | for ($header_value = 0; $header_value < count($headers[$header_name]); $header_value++) |
| 892 | 892 | { |
| 893 | - self::_putDebug($header_name . ": " . $headers[$header_name][$header_value]); |
|
| 893 | + self::_putDebug($header_name.": ".$headers[$header_name][$header_value]); |
|
| 894 | 894 | $this->serveroutput->headers[$i] = |
| 895 | - $header_name . ": " |
|
| 895 | + $header_name.": " |
|
| 896 | 896 | . $headers[$header_name][$header_value]; |
| 897 | 897 | $i++; |
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | 900 | else |
| 901 | 901 | { |
| 902 | - self::_putDebug($header_name . ": " . $headers[$header_name]); |
|
| 902 | + self::_putDebug($header_name.": ".$headers[$header_name]); |
|
| 903 | 903 | $this->serveroutput->headers[$i] = |
| 904 | 904 | $header_name |
| 905 | 905 | . ": " |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | self::_putDebug(htmlentities($body)); |
| 920 | - $this->serveroutput->body.= $body; |
|
| 920 | + $this->serveroutput->body .= $body; |
|
| 921 | 921 | } |
| 922 | 922 | self::_putDebug("********* END RESPONSE BODY ********"); |
| 923 | 923 | } |
@@ -933,57 +933,57 @@ discard block |
||
| 933 | 933 | { |
| 934 | 934 | $this->tags_types = array( |
| 935 | 935 | "unsupported" => array( |
| 936 | - "tag" => chr(0x10) , |
|
| 936 | + "tag" => chr(0x10), |
|
| 937 | 937 | "build" => "" |
| 938 | - ) , |
|
| 938 | + ), |
|
| 939 | 939 | "reserved" => array( |
| 940 | - "tag" => chr(0x11) , |
|
| 940 | + "tag" => chr(0x11), |
|
| 941 | 941 | "build" => "" |
| 942 | - ) , |
|
| 942 | + ), |
|
| 943 | 943 | "unknown" => array( |
| 944 | - "tag" => chr(0x12) , |
|
| 944 | + "tag" => chr(0x12), |
|
| 945 | 945 | "build" => "" |
| 946 | - ) , |
|
| 946 | + ), |
|
| 947 | 947 | "no-value" => array( |
| 948 | - "tag" => chr(0x13) , |
|
| 948 | + "tag" => chr(0x13), |
|
| 949 | 949 | "build" => "no_value" |
| 950 | - ) , |
|
| 950 | + ), |
|
| 951 | 951 | "integer" => array( |
| 952 | - "tag" => chr(0x21) , |
|
| 952 | + "tag" => chr(0x21), |
|
| 953 | 953 | "build" => "integer" |
| 954 | - ) , |
|
| 954 | + ), |
|
| 955 | 955 | "boolean" => array( |
| 956 | - "tag" => chr(0x22) , |
|
| 956 | + "tag" => chr(0x22), |
|
| 957 | 957 | "build" => "boolean" |
| 958 | - ) , |
|
| 958 | + ), |
|
| 959 | 959 | "enum" => array( |
| 960 | - "tag" => chr(0x23) , |
|
| 960 | + "tag" => chr(0x23), |
|
| 961 | 961 | "build" => "enum" |
| 962 | - ) , |
|
| 962 | + ), |
|
| 963 | 963 | "octetString" => array( |
| 964 | - "tag" => chr(0x30) , |
|
| 964 | + "tag" => chr(0x30), |
|
| 965 | 965 | "build" => "octet_string" |
| 966 | - ) , |
|
| 966 | + ), |
|
| 967 | 967 | "datetime" => array( |
| 968 | - "tag" => chr(0x31) , |
|
| 968 | + "tag" => chr(0x31), |
|
| 969 | 969 | "build" => "datetime" |
| 970 | - ) , |
|
| 970 | + ), |
|
| 971 | 971 | "resolution" => array( |
| 972 | - "tag" => chr(0x32) , |
|
| 972 | + "tag" => chr(0x32), |
|
| 973 | 973 | "build" => "resolution" |
| 974 | - ) , |
|
| 974 | + ), |
|
| 975 | 975 | "rangeOfInteger" => array( |
| 976 | - "tag" => chr(0x33) , |
|
| 976 | + "tag" => chr(0x33), |
|
| 977 | 977 | "build" => "range_of_integers" |
| 978 | - ) , |
|
| 978 | + ), |
|
| 979 | 979 | "textWithLanguage" => array( |
| 980 | - "tag" => chr(0x35) , |
|
| 980 | + "tag" => chr(0x35), |
|
| 981 | 981 | "build" => "string" |
| 982 | - ) , |
|
| 982 | + ), |
|
| 983 | 983 | "nameWithLanguage" => array( |
| 984 | - "tag" => chr(0x36) , |
|
| 984 | + "tag" => chr(0x36), |
|
| 985 | 985 | "build" => "string" |
| 986 | - ) , |
|
| 986 | + ), |
|
| 987 | 987 | /* |
| 988 | 988 | "text" => array ("tag" => chr(0x40), |
| 989 | 989 | "build" => "string"), |
@@ -991,96 +991,96 @@ discard block |
||
| 991 | 991 | "build" => "string"), |
| 992 | 992 | */ |
| 993 | 993 | "textWithoutLanguage" => array( |
| 994 | - "tag" => chr(0x41) , |
|
| 994 | + "tag" => chr(0x41), |
|
| 995 | 995 | "build" => "string" |
| 996 | - ) , |
|
| 996 | + ), |
|
| 997 | 997 | "nameWithoutLanguage" => array( |
| 998 | - "tag" => chr(0x42) , |
|
| 998 | + "tag" => chr(0x42), |
|
| 999 | 999 | "buid" => "string" |
| 1000 | - ) , |
|
| 1000 | + ), |
|
| 1001 | 1001 | "keyword" => array( |
| 1002 | - "tag" => chr(0x44) , |
|
| 1002 | + "tag" => chr(0x44), |
|
| 1003 | 1003 | "build" => "string" |
| 1004 | - ) , |
|
| 1004 | + ), |
|
| 1005 | 1005 | "uri" => array( |
| 1006 | - "tag" => chr(0x45) , |
|
| 1006 | + "tag" => chr(0x45), |
|
| 1007 | 1007 | "build" => "string" |
| 1008 | - ) , |
|
| 1008 | + ), |
|
| 1009 | 1009 | "uriScheme" => array( |
| 1010 | - "tag" => chr(0x46) , |
|
| 1010 | + "tag" => chr(0x46), |
|
| 1011 | 1011 | "build" => "string" |
| 1012 | - ) , |
|
| 1012 | + ), |
|
| 1013 | 1013 | "charset" => array( |
| 1014 | - "tag" => chr(0x47) , |
|
| 1014 | + "tag" => chr(0x47), |
|
| 1015 | 1015 | "build" => "string" |
| 1016 | - ) , |
|
| 1016 | + ), |
|
| 1017 | 1017 | "naturalLanguage" => array( |
| 1018 | - "tag" => chr(0x48) , |
|
| 1018 | + "tag" => chr(0x48), |
|
| 1019 | 1019 | "build" => "string" |
| 1020 | - ) , |
|
| 1020 | + ), |
|
| 1021 | 1021 | "mimeMediaType" => array( |
| 1022 | - "tag" => chr(0x49) , |
|
| 1022 | + "tag" => chr(0x49), |
|
| 1023 | 1023 | "build" => "string" |
| 1024 | - ) , |
|
| 1024 | + ), |
|
| 1025 | 1025 | "extendedAttributes" => array( |
| 1026 | - "tag" => chr(0x7F) , |
|
| 1026 | + "tag" => chr(0x7F), |
|
| 1027 | 1027 | "build" => "extended" |
| 1028 | - ) , |
|
| 1028 | + ), |
|
| 1029 | 1029 | ); |
| 1030 | 1030 | $this->operation_tags = array( |
| 1031 | 1031 | "compression" => array( |
| 1032 | 1032 | "tag" => "keyword" |
| 1033 | - ) , |
|
| 1033 | + ), |
|
| 1034 | 1034 | "document-natural-language" => array( |
| 1035 | 1035 | "tag" => "naturalLanguage" |
| 1036 | - ) , |
|
| 1036 | + ), |
|
| 1037 | 1037 | "job-k-octets" => array( |
| 1038 | 1038 | "tag" => "integer" |
| 1039 | - ) , |
|
| 1039 | + ), |
|
| 1040 | 1040 | "job-impressions" => array( |
| 1041 | 1041 | "tag" => "integer" |
| 1042 | - ) , |
|
| 1042 | + ), |
|
| 1043 | 1043 | "job-media-sheets" => array( |
| 1044 | 1044 | "tag" => "integer" |
| 1045 | - ) , |
|
| 1045 | + ), |
|
| 1046 | 1046 | ); |
| 1047 | 1047 | $this->job_tags = array( |
| 1048 | 1048 | "job-priority" => array( |
| 1049 | 1049 | "tag" => "integer" |
| 1050 | - ) , |
|
| 1050 | + ), |
|
| 1051 | 1051 | "job-hold-until" => array( |
| 1052 | 1052 | "tag" => "keyword" |
| 1053 | - ) , |
|
| 1053 | + ), |
|
| 1054 | 1054 | "job-sheets" => array( |
| 1055 | 1055 | "tag" => "keyword" |
| 1056 | - ) , //banner page |
|
| 1056 | + ), //banner page |
|
| 1057 | 1057 | "multiple-document-handling" => array( |
| 1058 | 1058 | "tag" => "keyword" |
| 1059 | - ) , |
|
| 1059 | + ), |
|
| 1060 | 1060 | //"copies" => array("tag" => "integer"), |
| 1061 | 1061 | "finishings" => array( |
| 1062 | 1062 | "tag" => "enum" |
| 1063 | - ) , |
|
| 1063 | + ), |
|
| 1064 | 1064 | //"page-ranges" => array("tag" => "rangeOfInteger"), // has its own function |
| 1065 | 1065 | //"sides" => array("tag" => "keyword"), // has its own function |
| 1066 | 1066 | "number-up" => array( |
| 1067 | 1067 | "tag" => "integer" |
| 1068 | - ) , |
|
| 1068 | + ), |
|
| 1069 | 1069 | "orientation-requested" => array( |
| 1070 | 1070 | "tag" => "enum" |
| 1071 | - ) , |
|
| 1071 | + ), |
|
| 1072 | 1072 | "media" => array( |
| 1073 | 1073 | "tag" => "keyword" |
| 1074 | - ) , |
|
| 1074 | + ), |
|
| 1075 | 1075 | "printer-resolution" => array( |
| 1076 | 1076 | "tag" => "resolution" |
| 1077 | - ) , |
|
| 1077 | + ), |
|
| 1078 | 1078 | "print-quality" => array( |
| 1079 | 1079 | "tag" => "enum" |
| 1080 | - ) , |
|
| 1080 | + ), |
|
| 1081 | 1081 | "job-message-from-operator" => array( |
| 1082 | 1082 | "tag" => "textWithoutLanguage" |
| 1083 | - ) , |
|
| 1083 | + ), |
|
| 1084 | 1084 | ); |
| 1085 | 1085 | $this->printer_tags = array( |
| 1086 | 1086 | "requested-attributes" => array( |
@@ -1095,30 +1095,30 @@ discard block |
||
| 1095 | 1095 | protected function _setOperationId() |
| 1096 | 1096 | { |
| 1097 | 1097 | $prepend = ''; |
| 1098 | - $this->operation_id+= 1; |
|
| 1098 | + $this->operation_id += 1; |
|
| 1099 | 1099 | $this->meta->operation_id = self::_integerBuild($this->operation_id); |
| 1100 | - self::_putDebug("operation id is: " . $this->operation_id, 2); |
|
| 1100 | + self::_putDebug("operation id is: ".$this->operation_id, 2); |
|
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | 1103 | protected function _setJobId() |
| 1104 | 1104 | { |
| 1105 | - $this->meta->jobid+= 1; |
|
| 1105 | + $this->meta->jobid += 1; |
|
| 1106 | 1106 | $prepend = ''; |
| 1107 | 1107 | $prepend_length = 4 - strlen($this->meta->jobid); |
| 1108 | 1108 | for ($i = 0; $i < $prepend_length; $i++) { |
| 1109 | - $prepend.= '0'; |
|
| 1109 | + $prepend .= '0'; |
|
| 1110 | 1110 | } |
| 1111 | - return $prepend . $this->meta->jobid; |
|
| 1111 | + return $prepend.$this->meta->jobid; |
|
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | protected function _setJobUri($job_uri) |
| 1115 | 1115 | { |
| 1116 | 1116 | $this->meta->job_uri = chr(0x45) // type uri |
| 1117 | - . chr(0x00) . chr(0x07) // name-length |
|
| 1117 | + . chr(0x00).chr(0x07) // name-length |
|
| 1118 | 1118 | . "job-uri" |
| 1119 | 1119 | //. chr(0x00).chr(strlen($job_uri)) |
| 1120 | - . self::_giveMeStringLength($job_uri) . $job_uri; |
|
| 1121 | - self::_putDebug("job-uri is: " . $job_uri, 2); |
|
| 1120 | + . self::_giveMeStringLength($job_uri).$job_uri; |
|
| 1121 | + self::_putDebug("job-uri is: ".$job_uri, 2); |
|
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | 1124 | // |
@@ -1180,9 +1180,9 @@ discard block |
||
| 1180 | 1180 | $errno = $strings[1]; |
| 1181 | 1181 | $string = strtoupper(str_replace(' ', '_', $strings[2])); |
| 1182 | 1182 | trigger_error( |
| 1183 | - sprintf(_("server responds %s") , $server_response), |
|
| 1183 | + sprintf(_("server responds %s"), $server_response), |
|
| 1184 | 1184 | E_USER_WARNING); |
| 1185 | - self::_errorLog("server responds " . $server_response, 1); |
|
| 1185 | + self::_errorLog("server responds ".$server_response, 1); |
|
| 1186 | 1186 | $this->serveroutput->httpstatus = |
| 1187 | 1187 | strtoupper($strings[0]) |
| 1188 | 1188 | . " " |
@@ -1227,7 +1227,7 @@ discard block |
||
| 1227 | 1227 | ord($this->serveroutput->body[$this->_parsing->offset]), |
| 1228 | 1228 | ord($this->serveroutput->body[$this->_parsing->offset + 1]), |
| 1229 | 1229 | $this->serveroutput->ipp_version)); |
| 1230 | - $this->_parsing->offset+= 2; |
|
| 1230 | + $this->_parsing->offset += 2; |
|
| 1231 | 1231 | return; |
| 1232 | 1232 | } |
| 1233 | 1233 | |
@@ -1237,7 +1237,7 @@ discard block |
||
| 1237 | 1237 | (ord($this->serveroutput->body[$this->_parsing->offset]) * 256) |
| 1238 | 1238 | + ord($this->serveroutput->body[$this->_parsing->offset + 1]); |
| 1239 | 1239 | $this->serveroutput->status = "NOT PARSED"; |
| 1240 | - $this->_parsing->offset+= 2; |
|
| 1240 | + $this->_parsing->offset += 2; |
|
| 1241 | 1241 | if (strlen($this->serveroutput->body) < $this->_parsing->offset) |
| 1242 | 1242 | { |
| 1243 | 1243 | return false; |
@@ -1415,8 +1415,8 @@ discard block |
||
| 1415 | 1415 | self::_interpretInteger( |
| 1416 | 1416 | substr($this->serveroutput->body, $this->_parsing->offset, 4) |
| 1417 | 1417 | ); |
| 1418 | - self::_putDebug("request-id " . $this->serveroutput->request_id, 2); |
|
| 1419 | - $this->_parsing->offset+= 4; |
|
| 1418 | + self::_putDebug("request-id ".$this->serveroutput->request_id, 2); |
|
| 1419 | + $this->_parsing->offset += 4; |
|
| 1420 | 1420 | return; |
| 1421 | 1421 | } |
| 1422 | 1422 | |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | { |
| 1425 | 1425 | // they are _signed_ integers |
| 1426 | 1426 | $value_parsed = 0; |
| 1427 | - for ($i = strlen($value); $i > 0; $i --) |
|
| 1427 | + for ($i = strlen($value); $i > 0; $i--) |
|
| 1428 | 1428 | { |
| 1429 | 1429 | $value_parsed += |
| 1430 | 1430 | ( |
@@ -1470,7 +1470,7 @@ discard block |
||
| 1470 | 1470 | trigger_error( |
| 1471 | 1471 | _("_stringJob: Printer URI is not set: die"), |
| 1472 | 1472 | E_USER_WARNING); |
| 1473 | - self::_putDebug(_("_stringJob: Printer URI is not set: die") , 4); |
|
| 1473 | + self::_putDebug(_("_stringJob: Printer URI is not set: die"), 4); |
|
| 1474 | 1474 | self::_errorLog(" Printer URI is not set, die", 2); |
| 1475 | 1475 | return FALSE; |
| 1476 | 1476 | } |
@@ -1512,8 +1512,8 @@ discard block |
||
| 1512 | 1512 | { |
| 1513 | 1513 | $this->error_generation->request_body_malformed = ""; |
| 1514 | 1514 | } |
| 1515 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 1516 | - . chr(0x00) . chr(0x02) // Print-Job | operation-id |
|
| 1515 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 1516 | + . chr(0x00).chr(0x02) // Print-Job | operation-id |
|
| 1517 | 1517 | . $this->meta->operation_id // request-id |
| 1518 | 1518 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 1519 | 1519 | . $this->meta->charset |
@@ -1534,7 +1534,7 @@ discard block |
||
| 1534 | 1534 | . $this->meta->page_ranges |
| 1535 | 1535 | . $jobattributes; |
| 1536 | 1536 | } |
| 1537 | - $this->stringjob.= chr(0x03); // end-of-attributes | end-of-attributes-tag |
|
| 1537 | + $this->stringjob .= chr(0x03); // end-of-attributes | end-of-attributes-tag |
|
| 1538 | 1538 | self::_putDebug( |
| 1539 | 1539 | sprintf(_("String sent to the server is: %s"), |
| 1540 | 1540 | $this->stringjob) |
@@ -1545,12 +1545,12 @@ discard block |
||
| 1545 | 1545 | protected function _buildValues(&$operationattributes, &$jobattributes, &$printerattributes) |
| 1546 | 1546 | { |
| 1547 | 1547 | $operationattributes = ''; |
| 1548 | - foreach($this->operation_tags as $key => $values) |
|
| 1548 | + foreach ($this->operation_tags as $key => $values) |
|
| 1549 | 1549 | { |
| 1550 | 1550 | $item = 0; |
| 1551 | 1551 | if (array_key_exists('value', $values)) |
| 1552 | 1552 | { |
| 1553 | - foreach($values['value'] as $item_value) |
|
| 1553 | + foreach ($values['value'] as $item_value) |
|
| 1554 | 1554 | { |
| 1555 | 1555 | if ($item == 0) |
| 1556 | 1556 | { |
@@ -1574,12 +1574,12 @@ discard block |
||
| 1574 | 1574 | } |
| 1575 | 1575 | } |
| 1576 | 1576 | $jobattributes = ''; |
| 1577 | - foreach($this->job_tags as $key => $values) |
|
| 1577 | + foreach ($this->job_tags as $key => $values) |
|
| 1578 | 1578 | { |
| 1579 | 1579 | $item = 0; |
| 1580 | 1580 | if (array_key_exists('value', $values)) |
| 1581 | 1581 | { |
| 1582 | - foreach($values['value'] as $item_value) |
|
| 1582 | + foreach ($values['value'] as $item_value) |
|
| 1583 | 1583 | { |
| 1584 | 1584 | if ($item == 0) |
| 1585 | 1585 | { |
@@ -1603,12 +1603,12 @@ discard block |
||
| 1603 | 1603 | } |
| 1604 | 1604 | } |
| 1605 | 1605 | $printerattributes = ''; |
| 1606 | - foreach($this->printer_tags as $key => $values) |
|
| 1606 | + foreach ($this->printer_tags as $key => $values) |
|
| 1607 | 1607 | { |
| 1608 | 1608 | $item = 0; |
| 1609 | 1609 | if (array_key_exists('value', $values)) |
| 1610 | 1610 | { |
| 1611 | - foreach($values['value'] as $item_value) |
|
| 1611 | + foreach ($values['value'] as $item_value) |
|
| 1612 | 1612 | { |
| 1613 | 1613 | if ($item == 0) |
| 1614 | 1614 | { |
@@ -1640,9 +1640,9 @@ discard block |
||
| 1640 | 1640 | protected function _giveMeStringLength($string) |
| 1641 | 1641 | { |
| 1642 | 1642 | $length = strlen($string); |
| 1643 | - if ($length > ((0xFF << 8) + 0xFF) ) |
|
| 1643 | + if ($length > ((0xFF << 8) + 0xFF)) |
|
| 1644 | 1644 | { |
| 1645 | - $errmsg = sprintf ( |
|
| 1645 | + $errmsg = sprintf( |
|
| 1646 | 1646 | _('max string length for an ipp meta-information = %d, while here %d'), |
| 1647 | 1647 | ((0xFF << 8) + 0xFF), $length); |
| 1648 | 1648 | |
@@ -1652,14 +1652,14 @@ discard block |
||
| 1652 | 1652 | } |
| 1653 | 1653 | else |
| 1654 | 1654 | { |
| 1655 | - trigger_error ($errmsg, E_USER_ERROR); |
|
| 1655 | + trigger_error($errmsg, E_USER_ERROR); |
|
| 1656 | 1656 | } |
| 1657 | 1657 | } |
| 1658 | 1658 | $int1 = $length & 0xFF; |
| 1659 | 1659 | $length -= $int1; |
| 1660 | 1660 | $length = $length >> 8; |
| 1661 | 1661 | $int2 = $length & 0xFF; |
| 1662 | - return chr($int2) . chr($int1); |
|
| 1662 | + return chr($int2).chr($int1); |
|
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | protected function _enumBuild($tag, $value) |
@@ -1790,7 +1790,7 @@ discard block |
||
| 1790 | 1790 | { |
| 1791 | 1791 | $prepend .= chr(0); |
| 1792 | 1792 | } |
| 1793 | - return $prepend . $value; |
|
| 1793 | + return $prepend.$value; |
|
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | protected function _integerBuild($value) |
@@ -1798,18 +1798,18 @@ discard block |
||
| 1798 | 1798 | if ($value >= 2147483647 || $value < - 2147483648) |
| 1799 | 1799 | { |
| 1800 | 1800 | trigger_error( |
| 1801 | - _("Values must be between -2147483648 and 2147483647: assuming '0'") , E_USER_WARNING); |
|
| 1802 | - return chr(0x00) . chr(0x00) . chr(0x00) . chr(0x00); |
|
| 1801 | + _("Values must be between -2147483648 and 2147483647: assuming '0'"), E_USER_WARNING); |
|
| 1802 | + return chr(0x00).chr(0x00).chr(0x00).chr(0x00); |
|
| 1803 | 1803 | } |
| 1804 | 1804 | $initial_value = $value; |
| 1805 | 1805 | $int1 = $value & 0xFF; |
| 1806 | 1806 | $value -= $int1; |
| 1807 | 1807 | $value = $value >> 8; |
| 1808 | 1808 | $int2 = $value & 0xFF; |
| 1809 | - $value-= $int2; |
|
| 1809 | + $value -= $int2; |
|
| 1810 | 1810 | $value = $value >> 8; |
| 1811 | 1811 | $int3 = $value & 0xFF; |
| 1812 | - $value-= $int3; |
|
| 1812 | + $value -= $int3; |
|
| 1813 | 1813 | $value = $value >> 8; |
| 1814 | 1814 | $int4 = $value & 0xFF; //64bits |
| 1815 | 1815 | if ($initial_value < 0) { |
@@ -1818,7 +1818,7 @@ discard block |
||
| 1818 | 1818 | else { |
| 1819 | 1819 | $int4 = chr($int4); |
| 1820 | 1820 | } |
| 1821 | - $value = $int4 . chr($int3) . chr($int2) . chr($int1); |
|
| 1821 | + $value = $int4.chr($int3).chr($int2).chr($int1); |
|
| 1822 | 1822 | return $value; |
| 1823 | 1823 | } |
| 1824 | 1824 | |
@@ -1829,7 +1829,7 @@ discard block |
||
| 1829 | 1829 | for ($i = 0; $i < 2; $i++) { |
| 1830 | 1830 | $outvalue[$i] = self::_integerBuild($integers[$i]); |
| 1831 | 1831 | } |
| 1832 | - return $outvalue[0] . $outvalue[1]; |
|
| 1832 | + return $outvalue[0].$outvalue[1]; |
|
| 1833 | 1833 | } |
| 1834 | 1834 | |
| 1835 | 1835 | protected function _setJobAttribute($attribute, $value) |
@@ -1877,14 +1877,14 @@ discard block |
||
| 1877 | 1877 | "", |
| 1878 | 1878 | ":" |
| 1879 | 1879 | ); |
| 1880 | - $value = self::_rangeOfIntegerBuild(preg_replace($search, $replace, $value)) . $unit; |
|
| 1880 | + $value = self::_rangeOfIntegerBuild(preg_replace($search, $replace, $value)).$unit; |
|
| 1881 | 1881 | $this->job_tags[$attribute]['value'][] = $value; |
| 1882 | 1882 | break; |
| 1883 | 1883 | |
| 1884 | 1884 | default: |
| 1885 | - trigger_error(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , E_USER_NOTICE); |
|
| 1886 | - self::_putDebug(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , 2); |
|
| 1887 | - self::_errorLog(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , 2); |
|
| 1885 | + trigger_error(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), E_USER_NOTICE); |
|
| 1886 | + self::_putDebug(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), 2); |
|
| 1887 | + self::_errorLog(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), 2); |
|
| 1888 | 1888 | return FALSE; |
| 1889 | 1889 | break; |
| 1890 | 1890 | } |
@@ -1907,9 +1907,9 @@ discard block |
||
| 1907 | 1907 | break; |
| 1908 | 1908 | |
| 1909 | 1909 | default: |
| 1910 | - trigger_error(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , E_USER_NOTICE); |
|
| 1911 | - self::_putDebug(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , 2); |
|
| 1912 | - self::_errorLog(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , 2); |
|
| 1910 | + trigger_error(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), E_USER_NOTICE); |
|
| 1911 | + self::_putDebug(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), 2); |
|
| 1912 | + self::_errorLog(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), 2); |
|
| 1913 | 1913 | return FALSE; |
| 1914 | 1914 | break; |
| 1915 | 1915 | } |
@@ -1932,9 +1932,9 @@ discard block |
||
| 1932 | 1932 | break; |
| 1933 | 1933 | |
| 1934 | 1934 | default: |
| 1935 | - trigger_error(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , E_USER_NOTICE); |
|
| 1936 | - self::_putDebug(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , 2); |
|
| 1937 | - self::_errorLog(sprintf(_('SetAttribute: Tag "%s": cannot set attribute') , $attribute) , 2); |
|
| 1935 | + trigger_error(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), E_USER_NOTICE); |
|
| 1936 | + self::_putDebug(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), 2); |
|
| 1937 | + self::_errorLog(sprintf(_('SetAttribute: Tag "%s": cannot set attribute'), $attribute), 2); |
|
| 1938 | 1938 | return FALSE; |
| 1939 | 1939 | break; |
| 1940 | 1940 | } |
@@ -1969,7 +1969,7 @@ discard block |
||
| 1969 | 1969 | return; |
| 1970 | 1970 | } |
| 1971 | 1971 | |
| 1972 | - $string = sprintf('%s : %s:%s user %s : %s', basename($_SERVER['PHP_SELF']) , $this->host, $this->port, $this->requesting_user, $string_to_log); |
|
| 1972 | + $string = sprintf('%s : %s:%s user %s : %s', basename($_SERVER['PHP_SELF']), $this->host, $this->port, $this->requesting_user, $string_to_log); |
|
| 1973 | 1973 | |
| 1974 | 1974 | if ($this->log_type == 0) |
| 1975 | 1975 | { |
@@ -1977,7 +1977,7 @@ discard block |
||
| 1977 | 1977 | return; |
| 1978 | 1978 | } |
| 1979 | 1979 | |
| 1980 | - $string = sprintf("%s %s Host %s:%s user %s : %s\n", date('M d H:i:s') , basename($_SERVER['PHP_SELF']) , $this->host, $this->port, $this->requesting_user, $string_to_log); |
|
| 1980 | + $string = sprintf("%s %s Host %s:%s user %s : %s\n", date('M d H:i:s'), basename($_SERVER['PHP_SELF']), $this->host, $this->port, $this->requesting_user, $string_to_log); |
|
| 1981 | 1981 | error_log($string, $this->log_type, $this->log_destination); |
| 1982 | 1982 | return; |
| 1983 | 1983 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | // OPERATIONS |
| 55 | - public function printURI ($uri) |
|
| 55 | + public function printURI($uri) |
|
| 56 | 56 | { |
| 57 | 57 | |
| 58 | - self::_putDebug( sprintf("*************************\nDate: %s\n*************************\n\n",date('Y-m-d H:i:s'))); |
|
| 58 | + self::_putDebug(sprintf("*************************\nDate: %s\n*************************\n\n", date('Y-m-d H:i:s'))); |
|
| 59 | 59 | |
| 60 | 60 | if (!empty($uri)) |
| 61 | 61 | { |
@@ -63,19 +63,19 @@ discard block |
||
| 63 | 63 | $this->setup->uri = 1; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if(!$this->_stringUri()) |
|
| 66 | + if (!$this->_stringUri()) |
|
| 67 | 67 | { |
| 68 | 68 | return FALSE; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $this->output = $this->stringjob; |
| 72 | 72 | |
| 73 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 73 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 74 | 74 | "Data" => $this->output); |
| 75 | 75 | |
| 76 | - if (self::_sendHttp ($post_values,$this->paths['printers'])) |
|
| 76 | + if (self::_sendHttp($post_values, $this->paths['printers'])) |
|
| 77 | 77 | { |
| 78 | - if(self::_parseServerOutput()) |
|
| 78 | + if (self::_parseServerOutput()) |
|
| 79 | 79 | { |
| 80 | 80 | $this->_parseJobAttributes(); |
| 81 | 81 | $this->_getJobId(); |
@@ -88,24 +88,24 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 90 | 90 | { |
| 91 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 91 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 92 | 92 | if ($this->serveroutput->status == "successfull-ok") |
| 93 | 93 | { |
| 94 | - self::_errorLog(sprintf("printing uri %s, job %s: ",$uri,$this->last_job) |
|
| 95 | - .$this->serveroutput->status,3); |
|
| 94 | + self::_errorLog(sprintf("printing uri %s, job %s: ", $uri, $this->last_job) |
|
| 95 | + .$this->serveroutput->status, 3); |
|
| 96 | 96 | } |
| 97 | 97 | else |
| 98 | 98 | { |
| 99 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 100 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 101 | - self::_errorLog(sprintf("printing uri %s: ",$uri,$this->last_job) |
|
| 102 | - .$this->serveroutput->status,1); |
|
| 99 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 100 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 101 | + self::_errorLog(sprintf("printing uri %s: ", $uri, $this->last_job) |
|
| 102 | + .$this->serveroutput->status, 1); |
|
| 103 | 103 | } |
| 104 | 104 | return $this->serveroutput->status; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 108 | - self::_errorLog("printing uri $uri : OPERATION FAILED",1); |
|
| 107 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 108 | + self::_errorLog("printing uri $uri : OPERATION FAILED", 1); |
|
| 109 | 109 | |
| 110 | 110 | return false; |
| 111 | 111 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function purgeJobs() |
| 115 | 115 | { |
| 116 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 117 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 116 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 117 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 118 | 118 | |
| 119 | 119 | self::_setOperationId(); |
| 120 | 120 | $this->parsed = array(); |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 128 | 128 | unset($this->status[count($this->status) - 1]); |
| 129 | 129 | |
| 130 | - if (array_key_exists(0,$this->available_printers)) |
|
| 130 | + if (array_key_exists(0, $this->available_printers)) |
|
| 131 | 131 | { |
| 132 | 132 | self::setPrinterURI($this->available_printers[0]); |
| 133 | 133 | } |
| 134 | 134 | else |
| 135 | 135 | { |
| 136 | - trigger_error(_("purgeJobs: Printer URI is not set: die"),E_USER_WARNING); |
|
| 137 | - self::_putDebug( _("purgeJobs: Printer URI is not set: die\n")); |
|
| 138 | - self::_errorLog("purgeJobs: Printer URI is not set, die",2); |
|
| 136 | + trigger_error(_("purgeJobs: Printer URI is not set: die"), E_USER_WARNING); |
|
| 137 | + self::_putDebug(_("purgeJobs: Printer URI is not set: die\n")); |
|
| 138 | + self::_errorLog("purgeJobs: Printer URI is not set, die", 2); |
|
| 139 | 139 | return FALSE; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | self::setUserName(); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 159 | - . chr(0x00) . chr (0x12) // purge-Jobs | operation-id |
|
| 158 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 159 | + . chr(0x00).chr(0x12) // purge-Jobs | operation-id |
|
| 160 | 160 | . $this->meta->operation_id // request-id |
| 161 | 161 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 162 | 162 | . $this->meta->charset |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 174 | 174 | |
| 175 | - self::_putDebug(sprintf(_("purging jobs of %s\n"),$this->printer_uri)); |
|
| 175 | + self::_putDebug(sprintf(_("purging jobs of %s\n"), $this->printer_uri)); |
|
| 176 | 176 | |
| 177 | 177 | $this->output = $this->stringjob; |
| 178 | 178 | |
| 179 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 179 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 180 | 180 | "Data"=>$this->output); |
| 181 | 181 | |
| 182 | - if (self::_sendHttp ($post_values,$this->paths['admin'])) |
|
| 182 | + if (self::_sendHttp($post_values, $this->paths['admin'])) |
|
| 183 | 183 | { |
| 184 | 184 | self::_parseServerOutput(); |
| 185 | 185 | self::_parseAttributes(); |
@@ -187,27 +187,27 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 189 | 189 | { |
| 190 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 190 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 191 | 191 | |
| 192 | 192 | if ($this->serveroutput->status == "successfull-ok") |
| 193 | 193 | { |
| 194 | - self::_errorLog(sprintf(_("purging jobs of %s: "),$this->printer_uri) |
|
| 195 | - .$this->serveroutput->status,3); |
|
| 194 | + self::_errorLog(sprintf(_("purging jobs of %s: "), $this->printer_uri) |
|
| 195 | + .$this->serveroutput->status, 3); |
|
| 196 | 196 | } |
| 197 | 197 | else |
| 198 | 198 | { |
| 199 | - self::_errorLog(sprintf(_("purging jobs of %s: "),$this->printer_uri) |
|
| 200 | - .$this->serveroutput->status,1); |
|
| 199 | + self::_errorLog(sprintf(_("purging jobs of %s: "), $this->printer_uri) |
|
| 200 | + .$this->serveroutput->status, 1); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return $this->serveroutput->status; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 206 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 207 | 207 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 208 | 208 | .basename($_SERVER['PHP_SELF']) |
| 209 | 209 | .sprintf(_("purging jobs of %s : OPERATION FAILED"), |
| 210 | - $this->printer_uri),3); |
|
| 210 | + $this->printer_uri), 3); |
|
| 211 | 211 | |
| 212 | 212 | return false; |
| 213 | 213 | } |
@@ -225,15 +225,15 @@ discard block |
||
| 225 | 225 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 226 | 226 | unset($this->status[count($this->status) - 1]); |
| 227 | 227 | |
| 228 | - if (array_key_exists(0,$this->available_printers)) |
|
| 228 | + if (array_key_exists(0, $this->available_printers)) |
|
| 229 | 229 | { |
| 230 | 230 | self::setPrinterURI($this->available_printers[0]); |
| 231 | 231 | } |
| 232 | 232 | else |
| 233 | 233 | { |
| 234 | - trigger_error(_("createJob: Printer URI is not set: die"),E_USER_WARNING); |
|
| 235 | - self::_putDebug( _("createJob: Printer URI is not set: die\n")); |
|
| 236 | - self::_errorLog("createJob: Printer URI is not set, die",2); |
|
| 234 | + trigger_error(_("createJob: Printer URI is not set: die"), E_USER_WARNING); |
|
| 235 | + self::_putDebug(_("createJob: Printer URI is not set: die\n")); |
|
| 236 | + self::_errorLog("createJob: Printer URI is not set, die", 2); |
|
| 237 | 237 | return FALSE; |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | { |
| 278 | 278 | if (is_readable($this->data)) |
| 279 | 279 | { |
| 280 | - self::setJobName(basename($this->data),true); |
|
| 280 | + self::setJobName(basename($this->data), true); |
|
| 281 | 281 | } |
| 282 | 282 | else |
| 283 | 283 | { |
@@ -302,10 +302,10 @@ discard block |
||
| 302 | 302 | $jobattributes = ''; |
| 303 | 303 | $operationattributes = ''; |
| 304 | 304 | $printerattributes = ''; |
| 305 | - self::_buildValues($operationattributes,$jobattributes,$printerattributes); |
|
| 305 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 306 | 306 | |
| 307 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 308 | - . chr(0x00) . chr (0x05) // Create-Job | operation-id |
|
| 307 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 308 | + . chr(0x00).chr(0x05) // Create-Job | operation-id |
|
| 309 | 309 | . $this->meta->operation_id // request-id |
| 310 | 310 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 311 | 311 | . $this->meta->charset |
@@ -323,20 +323,20 @@ discard block |
||
| 323 | 323 | . $jobattributes |
| 324 | 324 | . chr(0x03); // end-of-attributes | end-of-attributes-tag |
| 325 | 325 | |
| 326 | - unset ($this->meta->copies,$this->meta->sides,$this->meta->page_ranges); |
|
| 326 | + unset ($this->meta->copies, $this->meta->sides, $this->meta->page_ranges); |
|
| 327 | 327 | |
| 328 | 328 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 329 | 329 | |
| 330 | - self::_putDebug(sprintf(_("creating job %s, printer %s\n"),$this->last_job,$this->printer_uri)); |
|
| 330 | + self::_putDebug(sprintf(_("creating job %s, printer %s\n"), $this->last_job, $this->printer_uri)); |
|
| 331 | 331 | |
| 332 | 332 | $this->output = $this->stringjob; |
| 333 | 333 | |
| 334 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 334 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 335 | 335 | "Data"=>$this->output); |
| 336 | 336 | |
| 337 | - if (self::_sendHttp ($post_values,$this->paths['printers'])) |
|
| 337 | + if (self::_sendHttp($post_values, $this->paths['printers'])) |
|
| 338 | 338 | { |
| 339 | - if(self::_parseServerOutput()) |
|
| 339 | + if (self::_parseServerOutput()) |
|
| 340 | 340 | { |
| 341 | 341 | $this->_getJobId(); |
| 342 | 342 | $this->_getJobUri(); |
@@ -344,53 +344,53 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | else |
| 346 | 346 | { |
| 347 | - $this->jobs = array_merge($this->jobs,array('')); |
|
| 348 | - $this->jobs_uri = array_merge($this->jobs_uri,array('')); |
|
| 347 | + $this->jobs = array_merge($this->jobs, array('')); |
|
| 348 | + $this->jobs_uri = array_merge($this->jobs_uri, array('')); |
|
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 353 | 353 | { |
| 354 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 354 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 355 | 355 | |
| 356 | 356 | if ($this->serveroutput->status == "successfull-ok") |
| 357 | 357 | { |
| 358 | - self::_errorLog(sprintf(_("Create job: job %s"),$this->last_job) |
|
| 359 | - .$this->serveroutput->status,3); |
|
| 358 | + self::_errorLog(sprintf(_("Create job: job %s"), $this->last_job) |
|
| 359 | + .$this->serveroutput->status, 3); |
|
| 360 | 360 | } |
| 361 | 361 | else |
| 362 | 362 | { |
| 363 | 363 | |
| 364 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 365 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 366 | - self::_errorLog(sprintf(_("Create-Job: %s"),$this->serveroutput->status),1); |
|
| 364 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 365 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 366 | + self::_errorLog(sprintf(_("Create-Job: %s"), $this->serveroutput->status), 1); |
|
| 367 | 367 | } |
| 368 | 368 | return $this->serveroutput->status; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 371 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 372 | 372 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 373 | 373 | .basename($_SERVER['PHP_SELF']) |
| 374 | 374 | .sprintf(_("Creating job on %s : OPERATION FAILED"), |
| 375 | - $this->printer_uri),3); |
|
| 375 | + $this->printer_uri), 3); |
|
| 376 | 376 | |
| 377 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 378 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 377 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 378 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 379 | 379 | return false; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - public function sendDocument($job,$is_last=false) |
|
| 382 | + public function sendDocument($job, $is_last = false) |
|
| 383 | 383 | { |
| 384 | - self::_putDebug( sprintf("*************************\nDate: %s\n*************************\n\n",date('Y-m-d H:i:s'))); |
|
| 384 | + self::_putDebug(sprintf("*************************\nDate: %s\n*************************\n\n", date('Y-m-d H:i:s'))); |
|
| 385 | 385 | |
| 386 | - if (!$this->_stringDocument($job,$is_last)) |
|
| 386 | + if (!$this->_stringDocument($job, $is_last)) |
|
| 387 | 387 | { |
| 388 | 388 | return FALSE; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if (is_readable($this->data)) |
| 392 | 392 | { |
| 393 | - self::_putDebug( _("sending Document\n")); |
|
| 393 | + self::_putDebug(_("sending Document\n")); |
|
| 394 | 394 | |
| 395 | 395 | $this->output = $this->stringjob; |
| 396 | 396 | |
@@ -399,32 +399,32 @@ discard block |
||
| 399 | 399 | $this->output .= chr(0x16); |
| 400 | 400 | } // ASCII "SYN" |
| 401 | 401 | |
| 402 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 402 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 403 | 403 | "Data" => $this->output, |
| 404 | 404 | "File" => $this->data); |
| 405 | 405 | |
| 406 | 406 | if ($this->setup->datatype == "TEXT" && !isset($this->setup->noFormFeed)) |
| 407 | 407 | { |
| 408 | - $post_values = array_merge($post_values,array("Filetype"=>"TEXT")); |
|
| 408 | + $post_values = array_merge($post_values, array("Filetype"=>"TEXT")); |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | else |
| 412 | 412 | { |
| 413 | - self::_putDebug( _("sending DATA as document\n")); |
|
| 413 | + self::_putDebug(_("sending DATA as document\n")); |
|
| 414 | 414 | |
| 415 | 415 | $this->output = $this->stringjob; |
| 416 | 416 | $this->output .= $this->datahead; |
| 417 | 417 | $this->output .= $this->data; |
| 418 | 418 | $this->output .= $this->datatail; |
| 419 | 419 | |
| 420 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 420 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 421 | 421 | "Data" => $this->output); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if (self::_sendHttp ($post_values,$this->paths['printers'])) |
|
| 424 | + if (self::_sendHttp($post_values, $this->paths['printers'])) |
|
| 425 | 425 | { |
| 426 | 426 | |
| 427 | - if(self::_parseServerOutput()) |
|
| 427 | + if (self::_parseServerOutput()) |
|
| 428 | 428 | { |
| 429 | 429 | $this->_getJobId(); |
| 430 | 430 | //$this->_getPrinterUri(); |
@@ -433,56 +433,56 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | else |
| 435 | 435 | { |
| 436 | - $this->jobs = array_merge($this->jobs,array($job)); |
|
| 437 | - $this->jobs_uri = array_merge($this->jobs_uri,array($job)); |
|
| 436 | + $this->jobs = array_merge($this->jobs, array($job)); |
|
| 437 | + $this->jobs_uri = array_merge($this->jobs_uri, array($job)); |
|
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 442 | 442 | { |
| 443 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 443 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 444 | 444 | |
| 445 | 445 | if ($this->serveroutput->status == "successfull-ok") |
| 446 | 446 | { |
| 447 | - self::_errorLog(sprintf("sending document, job %s: %s",$job,$this->serveroutput->status),3); |
|
| 447 | + self::_errorLog(sprintf("sending document, job %s: %s", $job, $this->serveroutput->status), 3); |
|
| 448 | 448 | } |
| 449 | 449 | else |
| 450 | 450 | { |
| 451 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 452 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 453 | - self::_errorLog(sprintf("sending document, job %s: %s",$job,$this->serveroutput->status),1); |
|
| 451 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 452 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 453 | + self::_errorLog(sprintf("sending document, job %s: %s", $job, $this->serveroutput->status), 1); |
|
| 454 | 454 | } |
| 455 | 455 | return $this->serveroutput->status; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 459 | - $this->jobs = array_merge($this->jobs,array($job)); |
|
| 460 | - $this->jobs_uri = array_merge($this->jobs_uri,array($job)); |
|
| 461 | - self::_errorLog(sprintf("sending document, job %s : OPERATION FAILED",$job),1); |
|
| 458 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 459 | + $this->jobs = array_merge($this->jobs, array($job)); |
|
| 460 | + $this->jobs_uri = array_merge($this->jobs_uri, array($job)); |
|
| 461 | + self::_errorLog(sprintf("sending document, job %s : OPERATION FAILED", $job), 1); |
|
| 462 | 462 | |
| 463 | 463 | return false; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
| 467 | - public function sendURI ($uri,$job,$is_last=false) |
|
| 467 | + public function sendURI($uri, $job, $is_last = false) |
|
| 468 | 468 | { |
| 469 | - self::_putDebug( sprintf("*************************\nDate: %s\n*************************\n\n",date('Y-m-d H:i:s'))); |
|
| 469 | + self::_putDebug(sprintf("*************************\nDate: %s\n*************************\n\n", date('Y-m-d H:i:s'))); |
|
| 470 | 470 | |
| 471 | - if (!$this->_stringSendUri($uri,$job,$is_last)) |
|
| 471 | + if (!$this->_stringSendUri($uri, $job, $is_last)) |
|
| 472 | 472 | { |
| 473 | 473 | return FALSE; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - self::_putDebug( _("sending URI $uri\n")); |
|
| 476 | + self::_putDebug(_("sending URI $uri\n")); |
|
| 477 | 477 | |
| 478 | 478 | $this->output = $this->stringjob; |
| 479 | 479 | |
| 480 | - $post_values = array( "Content-Type" => "application/ipp", |
|
| 480 | + $post_values = array("Content-Type" => "application/ipp", |
|
| 481 | 481 | "Data" => $this->output); |
| 482 | 482 | |
| 483 | - if (self::_sendHttp ($post_values,$this->paths['printers'])) |
|
| 483 | + if (self::_sendHttp($post_values, $this->paths['printers'])) |
|
| 484 | 484 | { |
| 485 | - if(self::_parseServerOutput()) |
|
| 485 | + if (self::_parseServerOutput()) |
|
| 486 | 486 | { |
| 487 | 487 | $this->_getJobId(); |
| 488 | 488 | //$this->_getPrinterUri(); |
@@ -491,8 +491,8 @@ discard block |
||
| 491 | 491 | } |
| 492 | 492 | else |
| 493 | 493 | { |
| 494 | - $this->jobs = array_merge($this->jobs,array($job)); |
|
| 495 | - $this->jobs_uri = array_merge($this->jobs_uri,array($job)); |
|
| 494 | + $this->jobs = array_merge($this->jobs, array($job)); |
|
| 495 | + $this->jobs_uri = array_merge($this->jobs_uri, array($job)); |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | |
@@ -500,25 +500,25 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 502 | 502 | { |
| 503 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 503 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 504 | 504 | |
| 505 | 505 | if ($this->serveroutput->status == "successfull-ok") |
| 506 | 506 | { |
| 507 | - self::_errorLog(sprintf("sending uri %s, job %s: %s",$uri,$job,$this->serveroutput->status),3); |
|
| 507 | + self::_errorLog(sprintf("sending uri %s, job %s: %s", $uri, $job, $this->serveroutput->status), 3); |
|
| 508 | 508 | } |
| 509 | 509 | else |
| 510 | 510 | { |
| 511 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 512 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 513 | - self::_errorLog(sprintf("sending uri, job %s: %s",$uri,$job,$this->serveroutput->status),1); |
|
| 511 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 512 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 513 | + self::_errorLog(sprintf("sending uri, job %s: %s", $uri, $job, $this->serveroutput->status), 1); |
|
| 514 | 514 | } |
| 515 | 515 | return $this->serveroutput->status; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 519 | - $this->jobs = array_merge($this->jobs,array($job)); |
|
| 520 | - $this->jobs_uri = array_merge($this->jobs_uri,array($job)); |
|
| 521 | - self::_errorLog(sprintf("sending uri %s, job %s : OPERATION FAILED",$uri,$job),1); |
|
| 518 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 519 | + $this->jobs = array_merge($this->jobs, array($job)); |
|
| 520 | + $this->jobs_uri = array_merge($this->jobs_uri, array($job)); |
|
| 521 | + self::_errorLog(sprintf("sending uri %s, job %s : OPERATION FAILED", $uri, $job), 1); |
|
| 522 | 522 | |
| 523 | 523 | return false; |
| 524 | 524 | } |
@@ -526,8 +526,8 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | public function pausePrinter() |
| 528 | 528 | { |
| 529 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 530 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 529 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 530 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 531 | 531 | |
| 532 | 532 | self::_setOperationId(); |
| 533 | 533 | $this->parsed = array(); |
@@ -540,15 +540,15 @@ discard block |
||
| 540 | 540 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 541 | 541 | unset($this->status[count($this->status) - 1]); |
| 542 | 542 | |
| 543 | - if (array_key_exists(0,$this->available_printers)) |
|
| 543 | + if (array_key_exists(0, $this->available_printers)) |
|
| 544 | 544 | { |
| 545 | 545 | self::setPrinterURI($this->available_printers[0]); |
| 546 | 546 | } |
| 547 | 547 | else |
| 548 | 548 | { |
| 549 | - trigger_error(_("pausePrinter: Printer URI is not set: die"),E_USER_WARNING); |
|
| 550 | - self::_putDebug( _("pausePrinter: Printer URI is not set: die\n")); |
|
| 551 | - self::_errorLog("pausePrinter: Printer URI is not set, die",2); |
|
| 549 | + trigger_error(_("pausePrinter: Printer URI is not set: die"), E_USER_WARNING); |
|
| 550 | + self::_putDebug(_("pausePrinter: Printer URI is not set: die\n")); |
|
| 551 | + self::_errorLog("pausePrinter: Printer URI is not set, die", 2); |
|
| 552 | 552 | return FALSE; |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -568,8 +568,8 @@ discard block |
||
| 568 | 568 | self::setUserName(); |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 572 | - . chr(0x00) . chr (0x10) // Pause-Printer | operation-id |
|
| 571 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 572 | + . chr(0x00).chr(0x10) // Pause-Printer | operation-id |
|
| 573 | 573 | . $this->meta->operation_id // request-id |
| 574 | 574 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 575 | 575 | . $this->meta->charset |
@@ -585,14 +585,14 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 587 | 587 | |
| 588 | - self::_putDebug(sprintf(_("pause printer %s\n"),$this->printer_uri)); |
|
| 588 | + self::_putDebug(sprintf(_("pause printer %s\n"), $this->printer_uri)); |
|
| 589 | 589 | |
| 590 | 590 | $this->output = $this->stringjob; |
| 591 | 591 | |
| 592 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 592 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 593 | 593 | "Data"=>$this->output); |
| 594 | 594 | |
| 595 | - if (self::_sendHttp ($post_values,$this->paths['admin'])) |
|
| 595 | + if (self::_sendHttp($post_values, $this->paths['admin'])) |
|
| 596 | 596 | { |
| 597 | 597 | self::_parseServerOutput(); |
| 598 | 598 | self::_parseAttributes(); |
@@ -600,27 +600,27 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 602 | 602 | { |
| 603 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 603 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 604 | 604 | |
| 605 | 605 | if ($this->serveroutput->status == "successfull-ok") |
| 606 | 606 | { |
| 607 | - self::_errorLog(sprintf(_("Pause printer %s: "),$this->printer_uri) |
|
| 608 | - .$this->serveroutput->status,3); |
|
| 607 | + self::_errorLog(sprintf(_("Pause printer %s: "), $this->printer_uri) |
|
| 608 | + .$this->serveroutput->status, 3); |
|
| 609 | 609 | } |
| 610 | 610 | else |
| 611 | 611 | { |
| 612 | - self::_errorLog(sprintf(_("pause printer %s: "),$this->printer_uri) |
|
| 613 | - .$this->serveroutput->status,1); |
|
| 612 | + self::_errorLog(sprintf(_("pause printer %s: "), $this->printer_uri) |
|
| 613 | + .$this->serveroutput->status, 1); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | return $this->serveroutput->status; |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 619 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 620 | 620 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 621 | 621 | .basename($_SERVER['PHP_SELF']) |
| 622 | 622 | .sprintf(_("pause printer %s : OPERATION FAILED"), |
| 623 | - $this->printer_uri),3); |
|
| 623 | + $this->printer_uri), 3); |
|
| 624 | 624 | |
| 625 | 625 | return false; |
| 626 | 626 | } |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | public function resumePrinter() |
| 630 | 630 | { |
| 631 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 632 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 631 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 632 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 633 | 633 | |
| 634 | 634 | self::_setOperationId(); |
| 635 | 635 | $this->parsed = array(); |
@@ -642,15 +642,15 @@ discard block |
||
| 642 | 642 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 643 | 643 | unset($this->status[count($this->status) - 1]); |
| 644 | 644 | |
| 645 | - if (array_key_exists(0,$this->available_printers)) |
|
| 645 | + if (array_key_exists(0, $this->available_printers)) |
|
| 646 | 646 | { |
| 647 | 647 | self::setPrinterURI($this->available_printers[0]); |
| 648 | 648 | } |
| 649 | 649 | else |
| 650 | 650 | { |
| 651 | - trigger_error(_("resumePrinter: Printer URI is not set: die"),E_USER_WARNING); |
|
| 652 | - self::_putDebug( _("resumePrinter: Printer URI is not set: die\n")); |
|
| 653 | - self::_errorLog(" Printer URI is not set, die",2); |
|
| 651 | + trigger_error(_("resumePrinter: Printer URI is not set: die"), E_USER_WARNING); |
|
| 652 | + self::_putDebug(_("resumePrinter: Printer URI is not set: die\n")); |
|
| 653 | + self::_errorLog(" Printer URI is not set, die", 2); |
|
| 654 | 654 | return FALSE; |
| 655 | 655 | } |
| 656 | 656 | } |
@@ -670,8 +670,8 @@ discard block |
||
| 670 | 670 | self::setUserName(); |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 674 | - . chr(0x00) . chr (0x11) // suse-Printer | operation-id |
|
| 673 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 674 | + . chr(0x00).chr(0x11) // suse-Printer | operation-id |
|
| 675 | 675 | . $this->meta->operation_id // request-id |
| 676 | 676 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 677 | 677 | . $this->meta->charset |
@@ -682,14 +682,14 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 684 | 684 | |
| 685 | - self::_putDebug(sprintf(_("resume printer %s\n"),$this->printer_uri)); |
|
| 685 | + self::_putDebug(sprintf(_("resume printer %s\n"), $this->printer_uri)); |
|
| 686 | 686 | |
| 687 | 687 | $this->output = $this->stringjob; |
| 688 | 688 | |
| 689 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 689 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 690 | 690 | "Data"=>$this->output); |
| 691 | 691 | |
| 692 | - if (self::_sendHttp ($post_values,$this->paths['admin'])) |
|
| 692 | + if (self::_sendHttp($post_values, $this->paths['admin'])) |
|
| 693 | 693 | { |
| 694 | 694 | self::_parseServerOutput(); |
| 695 | 695 | self::_parseAttributes(); |
@@ -697,36 +697,36 @@ discard block |
||
| 697 | 697 | |
| 698 | 698 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 699 | 699 | { |
| 700 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 700 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 701 | 701 | |
| 702 | 702 | if ($this->serveroutput->status == "successfull-ok") |
| 703 | 703 | { |
| 704 | - self::_errorLog(sprintf(_("resume printer %s: "),$this->printer_uri) |
|
| 705 | - .$this->serveroutput->status,3); |
|
| 704 | + self::_errorLog(sprintf(_("resume printer %s: "), $this->printer_uri) |
|
| 705 | + .$this->serveroutput->status, 3); |
|
| 706 | 706 | } |
| 707 | 707 | else |
| 708 | 708 | { |
| 709 | - self::_errorLog(sprintf(_("resume printer %s: "),$this->printer_uri) |
|
| 710 | - .$this->serveroutput->status,1); |
|
| 709 | + self::_errorLog(sprintf(_("resume printer %s: "), $this->printer_uri) |
|
| 710 | + .$this->serveroutput->status, 1); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | return $this->serveroutput->status; |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 716 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 717 | 717 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 718 | 718 | .basename($_SERVER['PHP_SELF']) |
| 719 | 719 | .sprintf(_("resume printer %s : OPERATION FAILED"), |
| 720 | - $this->printer_uri),3); |
|
| 720 | + $this->printer_uri), 3); |
|
| 721 | 721 | |
| 722 | 722 | return false; |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | |
| 726 | - public function holdJob ($job_uri,$until='indefinite') |
|
| 726 | + public function holdJob($job_uri, $until = 'indefinite') |
|
| 727 | 727 | { |
| 728 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 729 | - $this->jobs_uri = array_merge($this->jobs_uri,array(trim($job_uri))); |
|
| 728 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 729 | + $this->jobs_uri = array_merge($this->jobs_uri, array(trim($job_uri))); |
|
| 730 | 730 | |
| 731 | 731 | self::_setOperationId(); |
| 732 | 732 | $this->parsed = array(); |
@@ -754,8 +754,8 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | self::_setJobUri($job_uri); |
| 756 | 756 | |
| 757 | - $until_strings = array('no-hold','day-time','evening','night','weekend','second-shift','third-shift'); |
|
| 758 | - if (in_array($until,$until_strings)) |
|
| 757 | + $until_strings = array('no-hold', 'day-time', 'evening', 'night', 'weekend', 'second-shift', 'third-shift'); |
|
| 758 | + if (in_array($until, $until_strings)) |
|
| 759 | 759 | { |
| 760 | 760 | true; |
| 761 | 761 | } |
@@ -770,8 +770,8 @@ discard block |
||
| 770 | 770 | . self::_giveMeStringLength($until) |
| 771 | 771 | . $until; |
| 772 | 772 | |
| 773 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 774 | - . chr(0x00) . chr (0x0C) // Hold-Job | operation-id |
|
| 773 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 774 | + . chr(0x00).chr(0x0C) // Hold-Job | operation-id |
|
| 775 | 775 | . $this->meta->operation_id // request-id |
| 776 | 776 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 777 | 777 | . $this->meta->charset |
@@ -784,14 +784,14 @@ discard block |
||
| 784 | 784 | |
| 785 | 785 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 786 | 786 | |
| 787 | - self::_putDebug(sprintf(_("hold job %s until %s\n"),$job_uri,$until)); |
|
| 787 | + self::_putDebug(sprintf(_("hold job %s until %s\n"), $job_uri, $until)); |
|
| 788 | 788 | |
| 789 | 789 | $this->output = $this->stringjob; |
| 790 | 790 | |
| 791 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 791 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 792 | 792 | "Data"=>$this->output); |
| 793 | 793 | |
| 794 | - if (self::_sendHttp ($post_values,$this->paths['jobs'])) |
|
| 794 | + if (self::_sendHttp($post_values, $this->paths['jobs'])) |
|
| 795 | 795 | { |
| 796 | 796 | self::_parseServerOutput(); |
| 797 | 797 | self::_parseAttributes(); |
@@ -799,36 +799,36 @@ discard block |
||
| 799 | 799 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 800 | 800 | { |
| 801 | 801 | |
| 802 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 802 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 803 | 803 | |
| 804 | 804 | if ($this->serveroutput->status == "successfull-ok") |
| 805 | 805 | { |
| 806 | - self::_errorLog(sprintf(_("hold job %s until %s: "),$job_uri,$until) |
|
| 807 | - .$this->serveroutput->status,3); |
|
| 806 | + self::_errorLog(sprintf(_("hold job %s until %s: "), $job_uri, $until) |
|
| 807 | + .$this->serveroutput->status, 3); |
|
| 808 | 808 | } |
| 809 | 809 | else |
| 810 | 810 | { |
| 811 | - self::_errorLog(sprintf(_("hold job %s until %s: "),$job_uri,$until) |
|
| 812 | - .$this->serveroutput->status,1); |
|
| 811 | + self::_errorLog(sprintf(_("hold job %s until %s: "), $job_uri, $until) |
|
| 812 | + .$this->serveroutput->status, 1); |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | return $this->serveroutput->status; |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 818 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 819 | 819 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 820 | 820 | .basename($_SERVER['PHP_SELF']) |
| 821 | 821 | .sprintf(_("hold job %s until %s : OPERATION FAILED"), |
| 822 | - $job_uri,$until),3); |
|
| 822 | + $job_uri, $until), 3); |
|
| 823 | 823 | |
| 824 | 824 | return false; |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | |
| 828 | - public function releaseJob ($job_uri) |
|
| 828 | + public function releaseJob($job_uri) |
|
| 829 | 829 | { |
| 830 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 831 | - $this->jobs_uri = array_merge($this->jobs_uri,array(trim($job_uri))); |
|
| 830 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 831 | + $this->jobs_uri = array_merge($this->jobs_uri, array(trim($job_uri))); |
|
| 832 | 832 | |
| 833 | 833 | self::_setOperationId(); |
| 834 | 834 | $this->parsed = array(); |
@@ -856,8 +856,8 @@ discard block |
||
| 856 | 856 | |
| 857 | 857 | self::_setJobUri($job_uri); |
| 858 | 858 | |
| 859 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 860 | - . chr(0x00) . chr (0x0D) // Hold-Job | operation-id |
|
| 859 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 860 | + . chr(0x00).chr(0x0D) // Hold-Job | operation-id |
|
| 861 | 861 | . $this->meta->operation_id // request-id |
| 862 | 862 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 863 | 863 | . $this->meta->charset |
@@ -869,50 +869,50 @@ discard block |
||
| 869 | 869 | |
| 870 | 870 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 871 | 871 | |
| 872 | - self::_putDebug(sprintf(_("release job %s\n"),$job_uri)); |
|
| 872 | + self::_putDebug(sprintf(_("release job %s\n"), $job_uri)); |
|
| 873 | 873 | |
| 874 | 874 | $this->output = $this->stringjob; |
| 875 | 875 | |
| 876 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 876 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 877 | 877 | "Data"=>$this->output); |
| 878 | 878 | |
| 879 | - if (self::_sendHttp ($post_values,$this->paths['jobs'])) |
|
| 879 | + if (self::_sendHttp($post_values, $this->paths['jobs'])) |
|
| 880 | 880 | { |
| 881 | 881 | self::_parseServerOutput(); |
| 882 | 882 | self::_parseAttributes(); |
| 883 | 883 | } |
| 884 | 884 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 885 | 885 | { |
| 886 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 886 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 887 | 887 | |
| 888 | 888 | if ($this->serveroutput->status == "successfull-ok") |
| 889 | 889 | { |
| 890 | - self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
|
| 891 | - .$this->serveroutput->status,3); |
|
| 890 | + self::_errorLog(sprintf(_("release job %s: "), $job_uri) |
|
| 891 | + .$this->serveroutput->status, 3); |
|
| 892 | 892 | } |
| 893 | 893 | else |
| 894 | 894 | { |
| 895 | - self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
|
| 896 | - .$this->serveroutput->status,1); |
|
| 895 | + self::_errorLog(sprintf(_("release job %s: "), $job_uri) |
|
| 896 | + .$this->serveroutput->status, 1); |
|
| 897 | 897 | } |
| 898 | 898 | |
| 899 | 899 | return $this->serveroutput->status; |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 902 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 903 | 903 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 904 | 904 | .basename($_SERVER['PHP_SELF']) |
| 905 | 905 | .sprintf(_("release job %s: OPERATION FAILED"), |
| 906 | - $job_uri),3); |
|
| 906 | + $job_uri), 3); |
|
| 907 | 907 | |
| 908 | 908 | return false; |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | |
| 912 | - public function restartJob ($job_uri) |
|
| 912 | + public function restartJob($job_uri) |
|
| 913 | 913 | { |
| 914 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 915 | - $this->jobs_uri = array_merge($this->jobs_uri,array(trim($job_uri))); |
|
| 914 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 915 | + $this->jobs_uri = array_merge($this->jobs_uri, array(trim($job_uri))); |
|
| 916 | 916 | |
| 917 | 917 | self::_setOperationId(); |
| 918 | 918 | $this->parsed = array(); |
@@ -943,10 +943,10 @@ discard block |
||
| 943 | 943 | $jobattributes = ''; |
| 944 | 944 | $operationattributes = ''; |
| 945 | 945 | $printerattributes = ''; |
| 946 | - self::_buildValues ($operationattributes,$jobattributes,$printerattributes); |
|
| 946 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 947 | 947 | |
| 948 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 949 | - . chr(0x00) . chr (0x0E) // Hold-Job | operation-id |
|
| 948 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 949 | + . chr(0x00).chr(0x0E) // Hold-Job | operation-id |
|
| 950 | 950 | . $this->meta->operation_id // request-id |
| 951 | 951 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 952 | 952 | . $this->meta->charset |
@@ -959,14 +959,14 @@ discard block |
||
| 959 | 959 | |
| 960 | 960 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 961 | 961 | |
| 962 | - self::_putDebug(sprintf(_("release job %s\n"),$job_uri)); |
|
| 962 | + self::_putDebug(sprintf(_("release job %s\n"), $job_uri)); |
|
| 963 | 963 | |
| 964 | 964 | $this->output = $this->stringjob; |
| 965 | 965 | |
| 966 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 966 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 967 | 967 | "Data"=>$this->output); |
| 968 | 968 | |
| 969 | - if (self::_sendHttp ($post_values,$this->paths['jobs'])) |
|
| 969 | + if (self::_sendHttp($post_values, $this->paths['jobs'])) |
|
| 970 | 970 | { |
| 971 | 971 | self::_parseServerOutput(); |
| 972 | 972 | self::_parseAttributes(); |
@@ -974,36 +974,36 @@ discard block |
||
| 974 | 974 | |
| 975 | 975 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 976 | 976 | { |
| 977 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 977 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 978 | 978 | |
| 979 | 979 | if ($this->serveroutput->status == "successfull-ok") |
| 980 | 980 | { |
| 981 | - self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
|
| 982 | - .$this->serveroutput->status,3); |
|
| 981 | + self::_errorLog(sprintf(_("release job %s: "), $job_uri) |
|
| 982 | + .$this->serveroutput->status, 3); |
|
| 983 | 983 | } |
| 984 | 984 | else |
| 985 | 985 | { |
| 986 | - self::_errorLog(sprintf(_("release job %s: "),$job_uri) |
|
| 987 | - .$this->serveroutput->status,1); |
|
| 986 | + self::_errorLog(sprintf(_("release job %s: "), $job_uri) |
|
| 987 | + .$this->serveroutput->status, 1); |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | return $this->serveroutput->status; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 993 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 994 | 994 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 995 | 995 | .basename($_SERVER['PHP_SELF']) |
| 996 | 996 | .sprintf(_("release job %s: OPERATION FAILED"), |
| 997 | - $job_uri),3); |
|
| 997 | + $job_uri), 3); |
|
| 998 | 998 | |
| 999 | 999 | return false; |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | |
| 1003 | - public function setJobAttributes ($job_uri,$deleted_attributes=array()) |
|
| 1003 | + public function setJobAttributes($job_uri, $deleted_attributes = array()) |
|
| 1004 | 1004 | { |
| 1005 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 1006 | - $this->jobs_uri = array_merge($this->jobs_uri,array(trim($job_uri))); |
|
| 1005 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 1006 | + $this->jobs_uri = array_merge($this->jobs_uri, array(trim($job_uri))); |
|
| 1007 | 1007 | |
| 1008 | 1008 | self::_setOperationId(); |
| 1009 | 1009 | $this->parsed = array(); |
@@ -1049,10 +1049,10 @@ discard block |
||
| 1049 | 1049 | $operationattributes = ''; |
| 1050 | 1050 | $jobattributes = ''; |
| 1051 | 1051 | $printerattributes = ''; |
| 1052 | - self::_buildValues ($operationattributes,$jobattributes,$printerattributes); |
|
| 1052 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 1053 | 1053 | |
| 1054 | 1054 | $this->meta->deleted_attributes = ""; |
| 1055 | - for ($i = 0 ; $i < count($deleted_attributes) ; $i++) |
|
| 1055 | + for ($i = 0; $i < count($deleted_attributes); $i++) |
|
| 1056 | 1056 | { |
| 1057 | 1057 | $this->meta->deleted_attributes .= chr(0x16) // out-of-band value |
| 1058 | 1058 | . self::_giveMeStringLength($deleted_attributes[$i]) |
@@ -1060,8 +1060,8 @@ discard block |
||
| 1060 | 1060 | . chr(0x0).chr(0x0); |
| 1061 | 1061 | } // value-length = 0; |
| 1062 | 1062 | |
| 1063 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 1064 | - . chr(0x00) . chr (0x14) // Set-Job-Attributes | operation-id |
|
| 1063 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 1064 | + . chr(0x00).chr(0x14) // Set-Job-Attributes | operation-id |
|
| 1065 | 1065 | . $this->meta->operation_id // request-id |
| 1066 | 1066 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 1067 | 1067 | . $this->meta->charset |
@@ -1079,48 +1079,48 @@ discard block |
||
| 1079 | 1079 | |
| 1080 | 1080 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 1081 | 1081 | |
| 1082 | - self::_putDebug(sprintf(_("set job attributes for job %s\n"),$job_uri)); |
|
| 1082 | + self::_putDebug(sprintf(_("set job attributes for job %s\n"), $job_uri)); |
|
| 1083 | 1083 | |
| 1084 | 1084 | $this->output = $this->stringjob; |
| 1085 | 1085 | |
| 1086 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 1086 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 1087 | 1087 | "Data"=>$this->output); |
| 1088 | 1088 | |
| 1089 | - if (self::_sendHttp ($post_values,$this->paths['jobs'])) |
|
| 1089 | + if (self::_sendHttp($post_values, $this->paths['jobs'])) |
|
| 1090 | 1090 | { |
| 1091 | 1091 | self::_parseServerOutput(); |
| 1092 | 1092 | self::_parseAttributes(); |
| 1093 | 1093 | } |
| 1094 | 1094 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 1095 | 1095 | { |
| 1096 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 1096 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 1097 | 1097 | |
| 1098 | 1098 | if ($this->serveroutput->status == "successfull-ok") |
| 1099 | 1099 | { |
| 1100 | - self::_errorLog(sprintf(_("set job attributes for job %s: "),$job_uri) |
|
| 1101 | - .$this->serveroutput->status,3); |
|
| 1100 | + self::_errorLog(sprintf(_("set job attributes for job %s: "), $job_uri) |
|
| 1101 | + .$this->serveroutput->status, 3); |
|
| 1102 | 1102 | } |
| 1103 | 1103 | else |
| 1104 | 1104 | { |
| 1105 | - self::_errorLog(sprintf(_("set job attributes for job %s: "),$job_uri) |
|
| 1106 | - .$this->serveroutput->status,1); |
|
| 1105 | + self::_errorLog(sprintf(_("set job attributes for job %s: "), $job_uri) |
|
| 1106 | + .$this->serveroutput->status, 1); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | $this->last_job = $job_uri; |
| 1109 | 1109 | $this->jobs_uri[count($this->jobs_uri) - 1] = $job_uri; |
| 1110 | 1110 | return $this->serveroutput->status; |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 1113 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 1114 | 1114 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 1115 | 1115 | .basename($_SERVER['PHP_SELF']) |
| 1116 | 1116 | .sprintf(_("set job attributes for job %s: OPERATION FAILED"), |
| 1117 | - $job_uri),3); |
|
| 1117 | + $job_uri), 3); |
|
| 1118 | 1118 | |
| 1119 | 1119 | return false; |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | |
| 1123 | - public function setPrinterAttributes ($document_format='',$deleted_attributes=array()) |
|
| 1123 | + public function setPrinterAttributes($document_format = '', $deleted_attributes = array()) |
|
| 1124 | 1124 | { |
| 1125 | 1125 | /* $document_format (RFC 3380) |
| 1126 | 1126 | If the client includes this attribute, the Printer MUST change |
@@ -1140,8 +1140,8 @@ discard block |
||
| 1140 | 1140 | they vary by document-format. |
| 1141 | 1141 | */ |
| 1142 | 1142 | |
| 1143 | - $this->jobs = array_merge($this->jobs,array("")); |
|
| 1144 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
| 1143 | + $this->jobs = array_merge($this->jobs, array("")); |
|
| 1144 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
| 1145 | 1145 | unset ($this->attributes); |
| 1146 | 1146 | |
| 1147 | 1147 | self::_setOperationId(); |
@@ -1194,10 +1194,10 @@ discard block |
||
| 1194 | 1194 | $operationattributes = ''; |
| 1195 | 1195 | $jobattributes = ''; |
| 1196 | 1196 | $printerattributes = ''; |
| 1197 | - self::_buildValues ($operationattributes,$jobattributes,$printerattributes); |
|
| 1197 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 1198 | 1198 | |
| 1199 | 1199 | $this->meta->deleted_attributes = ""; |
| 1200 | - for ($i = 0 ; $i < count($deleted_attributes) ; $i++) |
|
| 1200 | + for ($i = 0; $i < count($deleted_attributes); $i++) |
|
| 1201 | 1201 | { |
| 1202 | 1202 | $this->meta->deleted_attributes .= chr(0x16) // out-of-band "deleted" value |
| 1203 | 1203 | . self::_giveMeStringLength($deleted_attributes[$i]) |
@@ -1205,8 +1205,8 @@ discard block |
||
| 1205 | 1205 | . chr(0x0).chr(0x0); |
| 1206 | 1206 | } // value-length = 0; |
| 1207 | 1207 | |
| 1208 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 1209 | - . chr(0x00) . chr (0x13) // Set-Printer-Attributes | operation-id |
|
| 1208 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 1209 | + . chr(0x00).chr(0x13) // Set-Printer-Attributes | operation-id |
|
| 1210 | 1210 | . $this->meta->operation_id // request-id |
| 1211 | 1211 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 1212 | 1212 | . $this->meta->charset |
@@ -1225,47 +1225,47 @@ discard block |
||
| 1225 | 1225 | |
| 1226 | 1226 | self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
| 1227 | 1227 | |
| 1228 | - self::_putDebug(sprintf(_("set printer attributes for job %s\n"),$this->printer_uri)); |
|
| 1228 | + self::_putDebug(sprintf(_("set printer attributes for job %s\n"), $this->printer_uri)); |
|
| 1229 | 1229 | |
| 1230 | 1230 | $this->output = $this->stringjob; |
| 1231 | 1231 | |
| 1232 | - $post_values = array( "Content-Type"=>"application/ipp", |
|
| 1232 | + $post_values = array("Content-Type"=>"application/ipp", |
|
| 1233 | 1233 | "Data"=>$this->output); |
| 1234 | 1234 | |
| 1235 | - if (self::_sendHttp ($post_values,$this->paths['printers'])) |
|
| 1235 | + if (self::_sendHttp($post_values, $this->paths['printers'])) |
|
| 1236 | 1236 | { |
| 1237 | 1237 | self::_parseServerOutput(); |
| 1238 | 1238 | self::_parseAttributes(); |
| 1239 | 1239 | } |
| 1240 | 1240 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
| 1241 | 1241 | { |
| 1242 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
| 1242 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
| 1243 | 1243 | |
| 1244 | 1244 | if ($this->serveroutput->status == "successfull-ok") |
| 1245 | 1245 | { |
| 1246 | - self::_errorLog(sprintf(_("set printer attributes for printer %s: "),$this->printer_uri) |
|
| 1247 | - .$this->serveroutput->status,3); |
|
| 1246 | + self::_errorLog(sprintf(_("set printer attributes for printer %s: "), $this->printer_uri) |
|
| 1247 | + .$this->serveroutput->status, 3); |
|
| 1248 | 1248 | } |
| 1249 | 1249 | else |
| 1250 | 1250 | { |
| 1251 | - self::_errorLog(sprintf(_("set printer attributes for printer %s: "),$this->printer_uri) |
|
| 1252 | - .$this->serveroutput->status,1); |
|
| 1251 | + self::_errorLog(sprintf(_("set printer attributes for printer %s: "), $this->printer_uri) |
|
| 1252 | + .$this->serveroutput->status, 1); |
|
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | 1255 | return $this->serveroutput->status; |
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
| 1258 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
| 1259 | 1259 | self::_errorLog(date("Y-m-d H:i:s : ") |
| 1260 | 1260 | .basename($_SERVER['PHP_SELF']) |
| 1261 | 1261 | .sprintf(_("set printer attributes for printer %s: OPERATION FAILED"), |
| 1262 | - $this->printer_uri),1); |
|
| 1262 | + $this->printer_uri), 1); |
|
| 1263 | 1263 | |
| 1264 | 1264 | return false; |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | 1267 | // REQUEST BUILDING |
| 1268 | - protected function _setDocumentUri () |
|
| 1268 | + protected function _setDocumentUri() |
|
| 1269 | 1269 | { |
| 1270 | 1270 | $this->meta->document_uri = chr(0x45) // type uri |
| 1271 | 1271 | . chr(0x00).chr(0x0c) // name-length |
@@ -1273,20 +1273,20 @@ discard block |
||
| 1273 | 1273 | . self::_giveMeStringLength($this->document_uri) |
| 1274 | 1274 | . $this->document_uri; |
| 1275 | 1275 | |
| 1276 | - self::_putDebug( "document uri is: ".$this->document_uri."\n"); |
|
| 1276 | + self::_putDebug("document uri is: ".$this->document_uri."\n"); |
|
| 1277 | 1277 | $this->setup->document_uri = 1; |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | |
| 1281 | - protected function _stringUri () |
|
| 1281 | + protected function _stringUri() |
|
| 1282 | 1282 | { |
| 1283 | 1283 | self::_setDocumentUri(); |
| 1284 | 1284 | |
| 1285 | 1285 | if (!isset($this->setup->document_uri)) |
| 1286 | 1286 | { |
| 1287 | - trigger_error(_("_stringUri: Document URI is not set: die"),E_USER_WARNING); |
|
| 1288 | - self::_putDebug( _("_stringUri: Document URI is not set: die\n")); |
|
| 1289 | - self::_errorLog("Document URI is not set, die",2); |
|
| 1287 | + trigger_error(_("_stringUri: Document URI is not set: die"), E_USER_WARNING); |
|
| 1288 | + self::_putDebug(_("_stringUri: Document URI is not set: die\n")); |
|
| 1289 | + self::_errorLog("Document URI is not set, die", 2); |
|
| 1290 | 1290 | return FALSE; |
| 1291 | 1291 | } |
| 1292 | 1292 | unset ($this->setup->document_uri); |
@@ -1298,15 +1298,15 @@ discard block |
||
| 1298 | 1298 | unset($this->jobs_uri[count($this->jobs) - 1]); |
| 1299 | 1299 | unset($this->status[count($this->status) - 1]); |
| 1300 | 1300 | |
| 1301 | - if (array_key_exists(0,$this->available_printers)) |
|
| 1301 | + if (array_key_exists(0, $this->available_printers)) |
|
| 1302 | 1302 | { |
| 1303 | 1303 | self::setPrinterURI($this->available_printers[0]); |
| 1304 | 1304 | } |
| 1305 | 1305 | else |
| 1306 | 1306 | { |
| 1307 | - trigger_error(_("_stringUri: Printer URI is not set: die"),E_USER_WARNING); |
|
| 1308 | - self::_putDebug( _("_stringUri: Printer URI is not set: die\n")); |
|
| 1309 | - self::_errorLog("_stringUri: Printer URI is not set, die",2); |
|
| 1307 | + trigger_error(_("_stringUri: Printer URI is not set: die"), E_USER_WARNING); |
|
| 1308 | + self::_putDebug(_("_stringUri: Printer URI is not set: die\n")); |
|
| 1309 | + self::_errorLog("_stringUri: Printer URI is not set, die", 2); |
|
| 1310 | 1310 | return FALSE; |
| 1311 | 1311 | } |
| 1312 | 1312 | } |
@@ -1321,9 +1321,9 @@ discard block |
||
| 1321 | 1321 | } |
| 1322 | 1322 | if (!isset($this->setup->uri)) |
| 1323 | 1323 | { |
| 1324 | - trigger_error(_("_stringUri: Printer URI is not set: die"),E_USER_WARNING); |
|
| 1325 | - self::_putDebug( _("_stringUri: Printer URI is not set: die\n")); |
|
| 1326 | - self::_errorLog("Printer URI is not set, die",2); |
|
| 1324 | + trigger_error(_("_stringUri: Printer URI is not set: die"), E_USER_WARNING); |
|
| 1325 | + self::_putDebug(_("_stringUri: Printer URI is not set: die\n")); |
|
| 1326 | + self::_errorLog("Printer URI is not set, die", 2); |
|
| 1327 | 1327 | return FALSE; |
| 1328 | 1328 | } |
| 1329 | 1329 | if (!isset($this->setup->copies)) |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | { |
| 1347 | 1347 | if (is_readable($this->data)) |
| 1348 | 1348 | { |
| 1349 | - self::setJobName(basename($this->data),true); |
|
| 1349 | + self::setJobName(basename($this->data), true); |
|
| 1350 | 1350 | } |
| 1351 | 1351 | else |
| 1352 | 1352 | { |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | $jobattributes = ''; |
| 1384 | 1384 | $operationattributes = ''; |
| 1385 | 1385 | $printerattributes = ''; |
| 1386 | - self::_buildValues($operationattributes,$jobattributes,$printerattributes); |
|
| 1386 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 1387 | 1387 | |
| 1388 | 1388 | self::_setOperationId(); |
| 1389 | 1389 | |
@@ -1392,8 +1392,8 @@ discard block |
||
| 1392 | 1392 | $this->error_generation->request_body_malformed = ""; |
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 1396 | - . chr(0x00) . chr (0x03) // Print-URI | operation-id |
|
| 1395 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 1396 | + . chr(0x00).chr(0x03) // Print-URI | operation-id |
|
| 1397 | 1397 | . $this->meta->operation_id // request-id |
| 1398 | 1398 | . $this->error_generation->request_body_malformed |
| 1399 | 1399 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
@@ -1413,12 +1413,12 @@ discard block |
||
| 1413 | 1413 | . $jobattributes |
| 1414 | 1414 | . chr(0x03); // end-of-attributes | end-of-attributes-tag |
| 1415 | 1415 | |
| 1416 | - self::_putDebug( sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 1416 | + self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 1417 | 1417 | return TRUE; |
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | |
| 1421 | - protected function _stringDocument ($job,$is_last) |
|
| 1421 | + protected function _stringDocument($job, $is_last) |
|
| 1422 | 1422 | { |
| 1423 | 1423 | if ($is_last == false) |
| 1424 | 1424 | { |
@@ -1445,15 +1445,15 @@ discard block |
||
| 1445 | 1445 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 1446 | 1446 | unset($this->status[count($this->status) - 1]); |
| 1447 | 1447 | |
| 1448 | - if (array_key_exists(0,$this->available_printers)) |
|
| 1448 | + if (array_key_exists(0, $this->available_printers)) |
|
| 1449 | 1449 | { |
| 1450 | 1450 | self::setPrinterURI($this->available_printers[0]); |
| 1451 | 1451 | } |
| 1452 | 1452 | else |
| 1453 | 1453 | { |
| 1454 | - trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
|
| 1455 | - self::_putDebug( _("_stringJob: Printer URI is not set: die\n")); |
|
| 1456 | - self::_errorLog(" Printer URI is not set, die",2); |
|
| 1454 | + trigger_error(_("_stringJob: Printer URI is not set: die"), E_USER_WARNING); |
|
| 1455 | + self::_putDebug(_("_stringJob: Printer URI is not set: die\n")); |
|
| 1456 | + self::_errorLog(" Printer URI is not set, die", 2); |
|
| 1457 | 1457 | return FALSE; |
| 1458 | 1458 | } |
| 1459 | 1459 | } |
@@ -1500,12 +1500,12 @@ discard block |
||
| 1500 | 1500 | $operationattributes = ''; |
| 1501 | 1501 | $jobattributes = ''; |
| 1502 | 1502 | $printerattributes = ''; |
| 1503 | - self::_buildValues($operationattributes,$jobattributes,$printerattributes); |
|
| 1503 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 1504 | 1504 | |
| 1505 | 1505 | self::_setOperationId(); |
| 1506 | 1506 | |
| 1507 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 1508 | - . chr(0x00) . chr (0x06) // Send-Document | operation-id |
|
| 1507 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 1508 | + . chr(0x00).chr(0x06) // Send-Document | operation-id |
|
| 1509 | 1509 | . $this->meta->operation_id // request-id |
| 1510 | 1510 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 1511 | 1511 | . $this->meta->charset |
@@ -1527,21 +1527,21 @@ discard block |
||
| 1527 | 1527 | . $is_last |
| 1528 | 1528 | . chr(0x03); // end-of-attributes | end-of-attributes-tag |
| 1529 | 1529 | |
| 1530 | - self::_putDebug( sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 1530 | + self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 1531 | 1531 | return TRUE; |
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | 1534 | |
| 1535 | - protected function _stringSendUri ($uri,$job,$is_last) |
|
| 1535 | + protected function _stringSendUri($uri, $job, $is_last) |
|
| 1536 | 1536 | { |
| 1537 | 1537 | $this->document_uri = $uri; |
| 1538 | 1538 | self::_setDocumentUri(); |
| 1539 | 1539 | |
| 1540 | 1540 | if (!isset($this->setup->document_uri)) |
| 1541 | 1541 | { |
| 1542 | - trigger_error(_("_stringUri: Document URI is not set: die"),E_USER_WARNING); |
|
| 1543 | - self::_putDebug( _("_stringUri: Document URI is not set: die\n")); |
|
| 1544 | - self::_errorLog("Document URI is not set, die",2); |
|
| 1542 | + trigger_error(_("_stringUri: Document URI is not set: die"), E_USER_WARNING); |
|
| 1543 | + self::_putDebug(_("_stringUri: Document URI is not set: die\n")); |
|
| 1544 | + self::_errorLog("Document URI is not set, die", 2); |
|
| 1545 | 1545 | return FALSE; |
| 1546 | 1546 | } |
| 1547 | 1547 | unset ($this->setup->document_uri); |
@@ -1571,15 +1571,15 @@ discard block |
||
| 1571 | 1571 | unset($this->jobs_uri[count($this->jobs_uri) - 1]); |
| 1572 | 1572 | unset($this->status[count($this->status) - 1]); |
| 1573 | 1573 | |
| 1574 | - if (array_key_exists(0,$this->available_printers)) |
|
| 1574 | + if (array_key_exists(0, $this->available_printers)) |
|
| 1575 | 1575 | { |
| 1576 | 1576 | self::setPrinterURI($this->available_printers[0]); |
| 1577 | 1577 | } |
| 1578 | 1578 | else |
| 1579 | 1579 | { |
| 1580 | - trigger_error(_("_stringJob: Printer URI is not set: die"),E_USER_WARNING); |
|
| 1581 | - self::_putDebug( _("_stringJob: Printer URI is not set: die\n")); |
|
| 1582 | - self::_errorLog(" Printer URI is not set, die",2); |
|
| 1580 | + trigger_error(_("_stringJob: Printer URI is not set: die"), E_USER_WARNING); |
|
| 1581 | + self::_putDebug(_("_stringJob: Printer URI is not set: die\n")); |
|
| 1582 | + self::_errorLog(" Printer URI is not set, die", 2); |
|
| 1583 | 1583 | return FALSE; |
| 1584 | 1584 | } |
| 1585 | 1585 | } |
@@ -1623,12 +1623,12 @@ discard block |
||
| 1623 | 1623 | $operationattributes = ''; |
| 1624 | 1624 | $jobattributes = ''; |
| 1625 | 1625 | $printerattributes = ''; |
| 1626 | - self::_buildValues($operationattributes,$jobattributes,$printerattributes); |
|
| 1626 | + self::_buildValues($operationattributes, $jobattributes, $printerattributes); |
|
| 1627 | 1627 | |
| 1628 | 1628 | self::_setOperationId(); |
| 1629 | 1629 | |
| 1630 | - $this->stringjob = chr(0x01) . chr(0x01) // 1.1 | version-number |
|
| 1631 | - . chr(0x00) . chr (0x07) // Send-Uri | operation-id |
|
| 1630 | + $this->stringjob = chr(0x01).chr(0x01) // 1.1 | version-number |
|
| 1631 | + . chr(0x00).chr(0x07) // Send-Uri | operation-id |
|
| 1632 | 1632 | . $this->meta->operation_id // request-id |
| 1633 | 1633 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
| 1634 | 1634 | . $this->meta->charset |
@@ -1650,7 +1650,7 @@ discard block |
||
| 1650 | 1650 | . $is_last |
| 1651 | 1651 | . chr(0x03); // end-of-attributes | end-of-attributes-tag |
| 1652 | 1652 | |
| 1653 | - self::_putDebug( sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 1653 | + self::_putDebug(sprintf(_("String sent to the server is:\n%s\n"), $this->stringjob)); |
|
| 1654 | 1654 | return TRUE; |
| 1655 | 1655 | } |
| 1656 | 1656 | } |
| 1657 | 1657 | \ No newline at end of file |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | break; |
| 184 | 184 | |
| 185 | 185 | case 'cid': |
| 186 | - $headers['Content-ID'] = '<' . $value . '>'; |
|
| 186 | + $headers['Content-ID'] = '<'.$value.'>'; |
|
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | case 'location': |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | if ((strlen($headers['Content-Type']) + strlen($charset) + 16) <= 76) { |
| 215 | 215 | $headers['Content-Type'] .= '; '; |
| 216 | 216 | } else { |
| 217 | - $headers['Content-Type'] .= ';' . $this->_eol . ' '; |
|
| 217 | + $headers['Content-Type'] .= ';'.$this->_eol.' '; |
|
| 218 | 218 | } |
| 219 | 219 | $headers['Content-Type'] .= $charset; |
| 220 | 220 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | if (!empty($params['filename'])) { |
| 234 | - $headers['Content-Type'] .= ';' . $this->_eol; |
|
| 234 | + $headers['Content-Type'] .= ';'.$this->_eol; |
|
| 235 | 235 | $headers['Content-Type'] .= $this->_buildHeaderParam( |
| 236 | 236 | 'name', $params['filename'], $h_charset, $h_language, $h_encoding |
| 237 | 237 | ); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | if (!empty($params['disposition'])) { |
| 242 | 242 | $headers['Content-Disposition'] = $params['disposition']; |
| 243 | 243 | if (!empty($params['filename'])) { |
| 244 | - $headers['Content-Disposition'] .= ';' . $this->_eol; |
|
| 244 | + $headers['Content-Disposition'] .= ';'.$this->_eol; |
|
| 245 | 245 | $headers['Content-Disposition'] .= $this->_buildHeaderParam( |
| 246 | 246 | 'filename', $params['filename'], $h_charset, $h_language, |
| 247 | 247 | !empty($params['filename_encoding']) ? $params['filename_encoding'] : null |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | // add attachment size |
| 252 | 252 | $size = $this->_body_file ? filesize($this->_body_file) : strlen($body); |
| 253 | 253 | if ($size) { |
| 254 | - $headers['Content-Disposition'] .= ';' . $this->_eol . ' size=' . $size; |
|
| 254 | + $headers['Content-Disposition'] .= ';'.$this->_eol.' size='.$size; |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $header = $items[0]; |
| 270 | 270 | $param = $items[1]; |
| 271 | 271 | if (isset($headers[$header])) { |
| 272 | - $headers[$header] .= ';' . $this->_eol; |
|
| 272 | + $headers[$header] .= ';'.$this->_eol; |
|
| 273 | 273 | } |
| 274 | 274 | $headers[$header] .= $this->_buildHeaderParam( |
| 275 | 275 | $param, $value, $h_charset, $h_language, $h_encoding |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | * an indexed array. On error returns PEAR error object. |
| 301 | 301 | * @access public |
| 302 | 302 | */ |
| 303 | - function encode($boundary=null) |
|
| 303 | + function encode($boundary = null) |
|
| 304 | 304 | { |
| 305 | - $encoded =& $this->_encoded; |
|
| 305 | + $encoded = & $this->_encoded; |
|
| 306 | 306 | |
| 307 | 307 | if (count($this->_subparts)) { |
| 308 | - $boundary = $boundary ? $boundary : '=_' . md5(rand() . microtime()); |
|
| 308 | + $boundary = $boundary ? $boundary : '=_'.md5(rand().microtime()); |
|
| 309 | 309 | $eol = $this->_eol; |
| 310 | 310 | |
| 311 | 311 | $this->_headers['Content-Type'] .= ";$eol boundary=\"$boundary\""; |
@@ -313,18 +313,18 @@ discard block |
||
| 313 | 313 | $encoded['body'] = ''; |
| 314 | 314 | |
| 315 | 315 | for ($i = 0; $i < count($this->_subparts); $i++) { |
| 316 | - $encoded['body'] .= '--' . $boundary . $eol; |
|
| 316 | + $encoded['body'] .= '--'.$boundary.$eol; |
|
| 317 | 317 | $tmp = $this->_subparts[$i]->encode(); |
| 318 | 318 | if ($this->_isError($tmp)) { |
| 319 | 319 | return $tmp; |
| 320 | 320 | } |
| 321 | 321 | foreach ($tmp['headers'] as $key => $value) { |
| 322 | - $encoded['body'] .= $key . ': ' . $value . $eol; |
|
| 322 | + $encoded['body'] .= $key.': '.$value.$eol; |
|
| 323 | 323 | } |
| 324 | - $encoded['body'] .= $eol . $tmp['body'] . $eol; |
|
| 324 | + $encoded['body'] .= $eol.$tmp['body'].$eol; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $encoded['body'] .= '--' . $boundary . '--' . $eol; |
|
| 327 | + $encoded['body'] .= '--'.$boundary.'--'.$eol; |
|
| 328 | 328 | |
| 329 | 329 | } else if ($this->_body) { |
| 330 | 330 | $encoded['body'] = $this->_getEncodedData($this->_body, $this->_encoding); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | // Add headers to $encoded |
| 350 | - $encoded['headers'] =& $this->_headers; |
|
| 350 | + $encoded['headers'] = & $this->_headers; |
|
| 351 | 351 | |
| 352 | 352 | return $encoded; |
| 353 | 353 | } |
@@ -365,15 +365,15 @@ discard block |
||
| 365 | 365 | * @access public |
| 366 | 366 | * @since 1.6.0 |
| 367 | 367 | */ |
| 368 | - function encodeToFile($filename, $boundary=null, $skip_head=false) |
|
| 368 | + function encodeToFile($filename, $boundary = null, $skip_head = false) |
|
| 369 | 369 | { |
| 370 | 370 | if (file_exists($filename) && !is_writable($filename)) { |
| 371 | - $err = $this->_raiseError('File is not writeable: ' . $filename); |
|
| 371 | + $err = $this->_raiseError('File is not writeable: '.$filename); |
|
| 372 | 372 | return $err; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | if (!($fh = fopen($filename, 'ab'))) { |
| 376 | - $err = $this->_raiseError('Unable to open file: ' . $filename); |
|
| 376 | + $err = $this->_raiseError('Unable to open file: '.$filename); |
|
| 377 | 377 | return $err; |
| 378 | 378 | } |
| 379 | 379 | |
@@ -403,18 +403,18 @@ discard block |
||
| 403 | 403 | * @return array True on sucess or PEAR error object |
| 404 | 404 | * @access private |
| 405 | 405 | */ |
| 406 | - function _encodePartToFile($fh, $boundary=null, $skip_head=false) |
|
| 406 | + function _encodePartToFile($fh, $boundary = null, $skip_head = false) |
|
| 407 | 407 | { |
| 408 | 408 | $eol = $this->_eol; |
| 409 | 409 | |
| 410 | 410 | if (count($this->_subparts)) { |
| 411 | - $boundary = $boundary ? $boundary : '=_' . md5(rand() . microtime()); |
|
| 411 | + $boundary = $boundary ? $boundary : '=_'.md5(rand().microtime()); |
|
| 412 | 412 | $this->_headers['Content-Type'] .= ";$eol boundary=\"$boundary\""; |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | if (!$skip_head) { |
| 416 | 416 | foreach ($this->_headers as $key => $value) { |
| 417 | - fwrite($fh, $key . ': ' . $value . $eol); |
|
| 417 | + fwrite($fh, $key.': '.$value.$eol); |
|
| 418 | 418 | } |
| 419 | 419 | $f_eol = $eol; |
| 420 | 420 | } else { |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | if (count($this->_subparts)) { |
| 425 | 425 | for ($i = 0; $i < count($this->_subparts); $i++) { |
| 426 | - fwrite($fh, $f_eol . '--' . $boundary . $eol); |
|
| 426 | + fwrite($fh, $f_eol.'--'.$boundary.$eol); |
|
| 427 | 427 | $res = $this->_subparts[$i]->_encodePartToFile($fh); |
| 428 | 428 | if ($this->_isError($res)) { |
| 429 | 429 | return $res; |
@@ -431,10 +431,10 @@ discard block |
||
| 431 | 431 | $f_eol = $eol; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - fwrite($fh, $eol . '--' . $boundary . '--' . $eol); |
|
| 434 | + fwrite($fh, $eol.'--'.$boundary.'--'.$eol); |
|
| 435 | 435 | |
| 436 | 436 | } else if ($this->_body) { |
| 437 | - fwrite($fh, $f_eol . $this->_getEncodedData($this->_body, $this->_encoding)); |
|
| 437 | + fwrite($fh, $f_eol.$this->_getEncodedData($this->_body, $this->_encoding)); |
|
| 438 | 438 | } else if ($this->_body_file) { |
| 439 | 439 | fwrite($fh, $f_eol); |
| 440 | 440 | $res = $this->_getEncodedDataFromFile( |
@@ -508,15 +508,15 @@ discard block |
||
| 508 | 508 | * @return string Encoded data or PEAR error object |
| 509 | 509 | * @access private |
| 510 | 510 | */ |
| 511 | - function _getEncodedDataFromFile($filename, $encoding, $fh=null) |
|
| 511 | + function _getEncodedDataFromFile($filename, $encoding, $fh = null) |
|
| 512 | 512 | { |
| 513 | 513 | if (!is_readable($filename)) { |
| 514 | - $err = $this->_raiseError('Unable to read file: ' . $filename); |
|
| 514 | + $err = $this->_raiseError('Unable to read file: '.$filename); |
|
| 515 | 515 | return $err; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if (!($fd = fopen($filename, 'rb'))) { |
| 519 | - $err = $this->_raiseError('Could not open file: ' . $filename); |
|
| 519 | + $err = $this->_raiseError('Could not open file: '.$filename); |
|
| 520 | 520 | return $err; |
| 521 | 521 | } |
| 522 | 522 | |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | * |
| 586 | 586 | * @access private |
| 587 | 587 | */ |
| 588 | - function _quotedPrintableEncode($input , $line_max = 76) |
|
| 588 | + function _quotedPrintableEncode($input, $line_max = 76) |
|
| 589 | 589 | { |
| 590 | 590 | $eol = $this->_eol; |
| 591 | 591 | /* |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | } elseif ($dec == 9 && isset($line[$i])) { |
| 619 | 619 | ; // Do nothing if a TAB is not on eol |
| 620 | 620 | } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { |
| 621 | - $char = $escape . sprintf('%02X', $dec); |
|
| 621 | + $char = $escape.sprintf('%02X', $dec); |
|
| 622 | 622 | } elseif (($dec == 46) && (($newline == '') |
| 623 | 623 | || ((strlen($newline) + strlen("=2E")) >= $line_max)) |
| 624 | 624 | ) { |
@@ -634,12 +634,12 @@ discard block |
||
| 634 | 634 | // EOL is not counted |
| 635 | 635 | if ((strlen($newline) + strlen($char)) >= $line_max) { |
| 636 | 636 | // soft line break; " =\r\n" is okay |
| 637 | - $output .= $newline . $escape . $eol; |
|
| 637 | + $output .= $newline.$escape.$eol; |
|
| 638 | 638 | $newline = ''; |
| 639 | 639 | } |
| 640 | 640 | $newline .= $char; |
| 641 | 641 | } // end of for |
| 642 | - $output .= $newline . $eol; |
|
| 642 | + $output .= $newline.$eol; |
|
| 643 | 643 | unset($lines[$idx]); |
| 644 | 644 | } |
| 645 | 645 | // Don't want last crlf |
@@ -662,8 +662,8 @@ discard block |
||
| 662 | 662 | * |
| 663 | 663 | * @access private |
| 664 | 664 | */ |
| 665 | - function _buildHeaderParam($name, $value, $charset=null, $language=null, |
|
| 666 | - $encoding=null, $maxLength=75 |
|
| 665 | + function _buildHeaderParam($name, $value, $charset = null, $language = null, |
|
| 666 | + $encoding = null, $maxLength = 75 |
|
| 667 | 667 | ) { |
| 668 | 668 | // RFC 2045: |
| 669 | 669 | // value needs encoding if contains non-ASCII chars or is longer than 78 chars |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | $headCount++; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | - $headers = implode(';' . $this->_eol, $headers); |
|
| 723 | + $headers = implode(';'.$this->_eol, $headers); |
|
| 724 | 724 | return $headers; |
| 725 | 725 | } |
| 726 | 726 | |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | * @access private |
| 738 | 738 | */ |
| 739 | 739 | function _buildRFC2047Param($name, $value, $charset, |
| 740 | - $encoding='quoted-printable', $maxLength=76 |
|
| 740 | + $encoding = 'quoted-printable', $maxLength = 76 |
|
| 741 | 741 | ) { |
| 742 | 742 | // WARNING: RFC 2047 says: "An 'encoded-word' MUST NOT be used in |
| 743 | 743 | // parameter of a MIME Content-Type or Content-Disposition field", |
@@ -746,11 +746,11 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | if ($encoding == 'base64') { |
| 748 | 748 | $value = base64_encode($value); |
| 749 | - $prefix = '=?' . $charset . '?B?'; |
|
| 749 | + $prefix = '=?'.$charset.'?B?'; |
|
| 750 | 750 | $suffix = '?='; |
| 751 | 751 | |
| 752 | 752 | // 2 x SPACE, 2 x '"', '=', ';' |
| 753 | - $add_len = strlen($prefix . $suffix) + strlen($name) + 6; |
|
| 753 | + $add_len = strlen($prefix.$suffix) + strlen($name) + 6; |
|
| 754 | 754 | $len = $add_len + strlen($value); |
| 755 | 755 | |
| 756 | 756 | while ($len > $maxLength) { |
@@ -759,20 +759,20 @@ discard block |
||
| 759 | 759 | $_quote = substr($value, 0, $real_len); |
| 760 | 760 | $value = substr($value, $real_len); |
| 761 | 761 | |
| 762 | - $quoted .= $prefix . $_quote . $suffix . $this->_eol . ' '; |
|
| 763 | - $add_len = strlen($prefix . $suffix) + 4; // 2 x SPACE, '"', ';' |
|
| 762 | + $quoted .= $prefix.$_quote.$suffix.$this->_eol.' '; |
|
| 763 | + $add_len = strlen($prefix.$suffix) + 4; // 2 x SPACE, '"', ';' |
|
| 764 | 764 | $len = strlen($value) + $add_len; |
| 765 | 765 | } |
| 766 | - $quoted .= $prefix . $value . $suffix; |
|
| 766 | + $quoted .= $prefix.$value.$suffix; |
|
| 767 | 767 | |
| 768 | 768 | } else { |
| 769 | 769 | // quoted-printable |
| 770 | 770 | $value = $this->encodeQP($value); |
| 771 | - $prefix = '=?' . $charset . '?Q?'; |
|
| 771 | + $prefix = '=?'.$charset.'?Q?'; |
|
| 772 | 772 | $suffix = '?='; |
| 773 | 773 | |
| 774 | 774 | // 2 x SPACE, 2 x '"', '=', ';' |
| 775 | - $add_len = strlen($prefix . $suffix) + strlen($name) + 6; |
|
| 775 | + $add_len = strlen($prefix.$suffix) + strlen($name) + 6; |
|
| 776 | 776 | $len = $add_len + strlen($value); |
| 777 | 777 | |
| 778 | 778 | while ($len > $maxLength) { |
@@ -782,13 +782,13 @@ discard block |
||
| 782 | 782 | $_quote = $matches[1]; |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | - $quoted .= $prefix . $_quote . $suffix . $this->_eol . ' '; |
|
| 785 | + $quoted .= $prefix.$_quote.$suffix.$this->_eol.' '; |
|
| 786 | 786 | $value = substr($value, strlen($_quote)); |
| 787 | - $add_len = strlen($prefix . $suffix) + 4; // 2 x SPACE, '"', ';' |
|
| 787 | + $add_len = strlen($prefix.$suffix) + 4; // 2 x SPACE, '"', ';' |
|
| 788 | 788 | $len = strlen($value) + $add_len; |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | - $quoted .= $prefix . $value . $suffix; |
|
| 791 | + $quoted .= $prefix.$value.$suffix; |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | return " {$name}=\"{$quoted}\""; |
@@ -807,8 +807,8 @@ discard block |
||
| 807 | 807 | * @access public |
| 808 | 808 | * @since 1.6.1 |
| 809 | 809 | */ |
| 810 | - function encodeHeader($name, $value, $charset='ISO-8859-1', |
|
| 811 | - $encoding='quoted-printable', $eol="\r\n" |
|
| 810 | + function encodeHeader($name, $value, $charset = 'ISO-8859-1', |
|
| 811 | + $encoding = 'quoted-printable', $eol = "\r\n" |
|
| 812 | 812 | ) { |
| 813 | 813 | // Structured headers |
| 814 | 814 | $comma_headers = array( |
@@ -843,25 +843,25 @@ discard block |
||
| 843 | 843 | $value = ''; |
| 844 | 844 | |
| 845 | 845 | foreach ($parts as $part) { |
| 846 | - $part = preg_replace('/\r?\n[\s\t]*/', $eol . ' ', $part); |
|
| 846 | + $part = preg_replace('/\r?\n[\s\t]*/', $eol.' ', $part); |
|
| 847 | 847 | $part = trim($part); |
| 848 | 848 | |
| 849 | 849 | if (!$part) { |
| 850 | 850 | continue; |
| 851 | 851 | } |
| 852 | 852 | if ($value) { |
| 853 | - $value .= $separator == ',' ? $separator . ' ' : ' '; |
|
| 853 | + $value .= $separator == ',' ? $separator.' ' : ' '; |
|
| 854 | 854 | } else { |
| 855 | - $value = $name . ': '; |
|
| 855 | + $value = $name.': '; |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | // let's find phrase (name) and/or addr-spec |
| 859 | - if (preg_match('/^<' . $email_regexp . '>$/', $part)) { |
|
| 859 | + if (preg_match('/^<'.$email_regexp.'>$/', $part)) { |
|
| 860 | 860 | $value .= $part; |
| 861 | - } else if (preg_match('/^' . $email_regexp . '$/', $part)) { |
|
| 861 | + } else if (preg_match('/^'.$email_regexp.'$/', $part)) { |
|
| 862 | 862 | // address without brackets and without name |
| 863 | 863 | $value .= $part; |
| 864 | - } else if (preg_match('/<*' . $email_regexp . '>*$/', $part, $matches)) { |
|
| 864 | + } else if (preg_match('/<*'.$email_regexp.'>*$/', $part, $matches)) { |
|
| 865 | 865 | // address with name (handle name) |
| 866 | 866 | $address = $matches[0]; |
| 867 | 867 | $word = str_replace($address, '', $part); |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | if ($word) { |
| 871 | 871 | // non-ASCII: require encoding |
| 872 | 872 | if (preg_match('#([^\s\x21-\x7E]){1}#', $word)) { |
| 873 | - if ($word[0] == '"' && $word[strlen($word)-1] == '"') { |
|
| 873 | + if ($word[0] == '"' && $word[strlen($word) - 1] == '"') { |
|
| 874 | 874 | // de-quote quoted-string, encoding changes |
| 875 | 875 | // string to atom |
| 876 | 876 | $search = array("\\\"", "\\\\"); |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | $word = Mail_mimePart::encodeHeaderValue( |
| 888 | 888 | $word, $charset, $encoding, $last_len, $eol |
| 889 | 889 | ); |
| 890 | - } else if (($word[0] != '"' || $word[strlen($word)-1] != '"') |
|
| 890 | + } else if (($word[0] != '"' || $word[strlen($word) - 1] != '"') |
|
| 891 | 891 | && preg_match('/[\(\)\<\>\\\.\[\]@,;:"]/', $word) |
| 892 | 892 | ) { |
| 893 | 893 | // ASCII: quote string if needed |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | // RFC2822 recommends 78 characters limit, use 76 from RFC2047 |
| 904 | - $value = wordwrap($value, 76, $eol . ' '); |
|
| 904 | + $value = wordwrap($value, 76, $eol.' '); |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | // remove header name prefix (there could be EOL too) |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | // Unstructured header |
| 913 | 913 | // non-ASCII: require encoding |
| 914 | 914 | if (preg_match('#([^\s\x21-\x7E]){1}#', $value)) { |
| 915 | - if ($value[0] == '"' && $value[strlen($value)-1] == '"') { |
|
| 915 | + if ($value[0] == '"' && $value[strlen($value) - 1] == '"') { |
|
| 916 | 916 | // de-quote quoted-string, encoding changes |
| 917 | 917 | // string to atom |
| 918 | 918 | $search = array("\\\"", "\\\\"); |
@@ -925,11 +925,11 @@ discard block |
||
| 925 | 925 | ); |
| 926 | 926 | } else if (strlen($name.': '.$value) > 78) { |
| 927 | 927 | // ASCII: check if header line isn't too long and use folding |
| 928 | - $value = preg_replace('/\r?\n[\s\t]*/', $eol . ' ', $value); |
|
| 929 | - $tmp = wordwrap($name.': '.$value, 78, $eol . ' '); |
|
| 928 | + $value = preg_replace('/\r?\n[\s\t]*/', $eol.' ', $value); |
|
| 929 | + $tmp = wordwrap($name.': '.$value, 78, $eol.' '); |
|
| 930 | 930 | $value = preg_replace('/^'.$name.':\s*/', '', $tmp); |
| 931 | 931 | // hard limit 998 (RFC2822) |
| 932 | - $value = wordwrap($value, 998, $eol . ' ', true); |
|
| 932 | + $value = wordwrap($value, 998, $eol.' ', true); |
|
| 933 | 933 | } |
| 934 | 934 | } |
| 935 | 935 | |
@@ -950,9 +950,9 @@ discard block |
||
| 950 | 950 | $result = array(); |
| 951 | 951 | $strlen = strlen($string); |
| 952 | 952 | |
| 953 | - for ($q=$p=$i=0; $i < $strlen; $i++) { |
|
| 953 | + for ($q = $p = $i = 0; $i < $strlen; $i++) { |
|
| 954 | 954 | if ($string[$i] == "\"" |
| 955 | - && (empty($string[$i-1]) || $string[$i-1] != "\\") |
|
| 955 | + && (empty($string[$i - 1]) || $string[$i - 1] != "\\") |
|
| 956 | 956 | ) { |
| 957 | 957 | $q = $q ? false : true; |
| 958 | 958 | } else if (!$q && preg_match("/$delimiter/", $string[$i])) { |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | * @access public |
| 979 | 979 | * @since 1.6.1 |
| 980 | 980 | */ |
| 981 | - function encodeHeaderValue($value, $charset, $encoding, $prefix_len=0, $eol="\r\n") |
|
| 981 | + function encodeHeaderValue($value, $charset, $encoding, $prefix_len = 0, $eol = "\r\n") |
|
| 982 | 982 | { |
| 983 | 983 | // #17311: Use multibyte aware method (requires mbstring extension) |
| 984 | 984 | if ($result = Mail_mimePart::encodeMB($value, $charset, $encoding, $prefix_len, $eol)) { |
@@ -989,9 +989,9 @@ discard block |
||
| 989 | 989 | // determine the maximum length of such strings. |
| 990 | 990 | // 75 is the value specified in the RFC. |
| 991 | 991 | $encoding = $encoding == 'base64' ? 'B' : 'Q'; |
| 992 | - $prefix = '=?' . $charset . '?' . $encoding .'?'; |
|
| 992 | + $prefix = '=?'.$charset.'?'.$encoding.'?'; |
|
| 993 | 993 | $suffix = '?='; |
| 994 | - $maxLength = 75 - strlen($prefix . $suffix); |
|
| 994 | + $maxLength = 75 - strlen($prefix.$suffix); |
|
| 995 | 995 | $maxLength1stLine = $maxLength - $prefix_len; |
| 996 | 996 | |
| 997 | 997 | if ($encoding == 'B') { |
@@ -1014,9 +1014,9 @@ discard block |
||
| 1014 | 1014 | // RFC 2047 specifies that any split header should |
| 1015 | 1015 | // be separated by a CRLF SPACE. |
| 1016 | 1016 | if ($output) { |
| 1017 | - $output .= $eol . ' '; |
|
| 1017 | + $output .= $eol.' '; |
|
| 1018 | 1018 | } |
| 1019 | - $output .= $prefix . $part . $suffix; |
|
| 1019 | + $output .= $prefix.$part.$suffix; |
|
| 1020 | 1020 | } |
| 1021 | 1021 | $value = $output; |
| 1022 | 1022 | } else { |
@@ -1056,13 +1056,13 @@ discard block |
||
| 1056 | 1056 | // RFC 2047 specifies that any split header should |
| 1057 | 1057 | // be separated by a CRLF SPACE |
| 1058 | 1058 | if ($output) { |
| 1059 | - $output .= $eol . ' '; |
|
| 1059 | + $output .= $eol.' '; |
|
| 1060 | 1060 | } |
| 1061 | - $output .= $prefix . $part . $suffix; |
|
| 1061 | + $output .= $prefix.$part.$suffix; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | $value = $output; |
| 1064 | 1064 | } else { |
| 1065 | - $value = $prefix . $value . $suffix; |
|
| 1065 | + $value = $prefix.$value.$suffix; |
|
| 1066 | 1066 | } |
| 1067 | 1067 | } |
| 1068 | 1068 | |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | * @access public |
| 1109 | 1109 | * @since 1.8.0 |
| 1110 | 1110 | */ |
| 1111 | - function encodeMB($str, $charset, $encoding, $prefix_len=0, $eol="\r\n") |
|
| 1111 | + function encodeMB($str, $charset, $encoding, $prefix_len = 0, $eol = "\r\n") |
|
| 1112 | 1112 | { |
| 1113 | 1113 | if (!function_exists('mb_substr') || !function_exists('mb_strlen')) { |
| 1114 | 1114 | return; |
@@ -1116,9 +1116,9 @@ discard block |
||
| 1116 | 1116 | |
| 1117 | 1117 | $encoding = $encoding == 'base64' ? 'B' : 'Q'; |
| 1118 | 1118 | // 75 is the value specified in the RFC |
| 1119 | - $prefix = '=?' . $charset . '?'.$encoding.'?'; |
|
| 1119 | + $prefix = '=?'.$charset.'?'.$encoding.'?'; |
|
| 1120 | 1120 | $suffix = '?='; |
| 1121 | - $maxLength = 75 - strlen($prefix . $suffix); |
|
| 1121 | + $maxLength = 75 - strlen($prefix.$suffix); |
|
| 1122 | 1122 | |
| 1123 | 1123 | // A multi-octet character may not be split across adjacent encoded-words |
| 1124 | 1124 | // So, we'll loop over each character |
@@ -1132,9 +1132,9 @@ discard block |
||
| 1132 | 1132 | $start = 0; |
| 1133 | 1133 | $prev = ''; |
| 1134 | 1134 | |
| 1135 | - for ($i=1; $i<=$length; $i++) { |
|
| 1135 | + for ($i = 1; $i <= $length; $i++) { |
|
| 1136 | 1136 | // See #17311 |
| 1137 | - $chunk = mb_substr($str, $start, $i-$start, $charset); |
|
| 1137 | + $chunk = mb_substr($str, $start, $i - $start, $charset); |
|
| 1138 | 1138 | $chunk = base64_encode($chunk); |
| 1139 | 1139 | $chunk_len = strlen($chunk); |
| 1140 | 1140 | |
@@ -1163,7 +1163,7 @@ discard block |
||
| 1163 | 1163 | // see encodeQP() |
| 1164 | 1164 | $regexp = '/([\x22-\x29\x2C\x2E\x3A-\x40\x5B-\x60\x7B-\x7E\x80-\xFF])/'; |
| 1165 | 1165 | |
| 1166 | - for ($i=0; $i<=$length; $i++) { |
|
| 1166 | + for ($i = 0; $i <= $length; $i++) { |
|
| 1167 | 1167 | $char = mb_substr($str, $i, 1, $charset); |
| 1168 | 1168 | // RFC recommends underline (instead of =20) in place of the space |
| 1169 | 1169 | // that's one of the reasons why we're not using iconv_mime_encode() |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @access public |
| 325 | 325 | */ |
| 326 | 326 | function addHTMLImage($file, |
| 327 | - $c_type='application/octet-stream', |
|
| 327 | + $c_type = 'application/octet-stream', |
|
| 328 | 328 | $name = '', |
| 329 | 329 | $isfile = true, |
| 330 | 330 | $content_id = null |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | { |
| 466 | 466 | // Check state of file and raise an error properly |
| 467 | 467 | if (!file_exists($file_name)) { |
| 468 | - return $this->_raiseError('File not found: ' . $file_name); |
|
| 468 | + return $this->_raiseError('File not found: '.$file_name); |
|
| 469 | 469 | } |
| 470 | 470 | if (!is_file($file_name)) { |
| 471 | - return $this->_raiseError('Not a regular file: ' . $file_name); |
|
| 471 | + return $this->_raiseError('Not a regular file: '.$file_name); |
|
| 472 | 472 | } |
| 473 | 473 | if (!is_readable($file_name)) { |
| 474 | - return $this->_raiseError('File is not readable: ' . $file_name); |
|
| 474 | + return $this->_raiseError('File is not readable: '.$file_name); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | // Temporarily reset magic_quotes_runtime and read file contents |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | return $body; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | - return $this->txtHeaders($headers, $overwrite) . $separation . $body; |
|
| 723 | + return $this->txtHeaders($headers, $overwrite).$separation.$body; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | /** |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | { |
| 759 | 759 | // Check state of file and raise an error properly |
| 760 | 760 | if (file_exists($filename) && !is_writable($filename)) { |
| 761 | - return $this->_raiseError('File is not writable: ' . $filename); |
|
| 761 | + return $this->_raiseError('File is not writable: '.$filename); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | // Temporarily reset magic_quotes_runtime and read file contents |
@@ -767,13 +767,13 @@ discard block |
||
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | if (!($fh = fopen($filename, 'ab'))) { |
| 770 | - return $this->_raiseError('Unable to open file: ' . $filename); |
|
| 770 | + return $this->_raiseError('Unable to open file: '.$filename); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // Write message headers into file (skipping Content-* headers) |
| 774 | 774 | $head = $this->txtHeaders($headers, $overwrite, true); |
| 775 | 775 | if (fwrite($fh, $head) === false) { |
| 776 | - return $this->_raiseError('Error writing to file: ' . $filename); |
|
| 776 | + return $this->_raiseError('Error writing to file: '.$filename); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | fclose($fh); |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | { |
| 804 | 804 | // Check state of file and raise an error properly |
| 805 | 805 | if (file_exists($filename) && !is_writable($filename)) { |
| 806 | - return $this->_raiseError('File is not writable: ' . $filename); |
|
| 806 | + return $this->_raiseError('File is not writable: '.$filename); |
|
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | // Temporarily reset magic_quotes_runtime and read file contents |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | if (!($fh = fopen($filename, 'ab'))) { |
| 815 | - return $this->_raiseError('Unable to open file: ' . $filename); |
|
| 815 | + return $this->_raiseError('Unable to open file: '.$filename); |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | // Write the rest of the message into file |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | foreach ($this->_html_images as $i => $img) { |
| 854 | 854 | $cid = $this->_html_images[$i]['cid']; |
| 855 | 855 | if (!preg_match('#'.preg_quote($domainID).'$#', $cid)) { |
| 856 | - $this->_html_images[$i]['cid'] = $cid . $domainID; |
|
| 856 | + $this->_html_images[$i]['cid'] = $cid.$domainID; |
|
| 857 | 857 | } |
| 858 | 858 | } |
| 859 | 859 | } |
@@ -861,14 +861,14 @@ discard block |
||
| 861 | 861 | if (count($this->_html_images) && isset($this->_htmlbody)) { |
| 862 | 862 | foreach ($this->_html_images as $key => $value) { |
| 863 | 863 | $regex = array(); |
| 864 | - $regex[] = '#(\s)((?i)src|background|href(?-i))\s*=\s*(["\']?)' . |
|
| 865 | - preg_quote($value['name'], '#') . '\3#'; |
|
| 866 | - $regex[] = '#(?i)url(?-i)\(\s*(["\']?)' . |
|
| 867 | - preg_quote($value['name'], '#') . '\1\s*\)#'; |
|
| 864 | + $regex[] = '#(\s)((?i)src|background|href(?-i))\s*=\s*(["\']?)'. |
|
| 865 | + preg_quote($value['name'], '#').'\3#'; |
|
| 866 | + $regex[] = '#(?i)url(?-i)\(\s*(["\']?)'. |
|
| 867 | + preg_quote($value['name'], '#').'\1\s*\)#'; |
|
| 868 | 868 | |
| 869 | 869 | $rep = array(); |
| 870 | - $rep[] = '\1\2=\3cid:' . $value['cid'] .'\3'; |
|
| 871 | - $rep[] = 'url(\1cid:' . $value['cid'] . '\1)'; |
|
| 870 | + $rep[] = '\1\2=\3cid:'.$value['cid'].'\3'; |
|
| 871 | + $rep[] = 'url(\1cid:'.$value['cid'].'\1)'; |
|
| 872 | 872 | |
| 873 | 873 | $this->_htmlbody = preg_replace($regex, $rep, $this->_htmlbody); |
| 874 | 874 | $this->_html_images[$key]['name'] |
@@ -886,18 +886,18 @@ discard block |
||
| 886 | 886 | |
| 887 | 887 | switch (true) { |
| 888 | 888 | case $text && !$attachments: |
| 889 | - $message =& $this->_addTextPart($null, $this->_txtbody); |
|
| 889 | + $message = & $this->_addTextPart($null, $this->_txtbody); |
|
| 890 | 890 | break; |
| 891 | 891 | |
| 892 | 892 | case !$text && !$html && $attachments: |
| 893 | - $message =& $this->_addMixedPart(); |
|
| 893 | + $message = & $this->_addMixedPart(); |
|
| 894 | 894 | for ($i = 0; $i < count($this->_parts); $i++) { |
| 895 | 895 | $this->_addAttachmentPart($message, $this->_parts[$i]); |
| 896 | 896 | } |
| 897 | 897 | break; |
| 898 | 898 | |
| 899 | 899 | case $text && $attachments: |
| 900 | - $message =& $this->_addMixedPart(); |
|
| 900 | + $message = & $this->_addMixedPart(); |
|
| 901 | 901 | $this->_addTextPart($message, $this->_txtbody); |
| 902 | 902 | for ($i = 0; $i < count($this->_parts); $i++) { |
| 903 | 903 | $this->_addAttachmentPart($message, $this->_parts[$i]); |
@@ -906,11 +906,11 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | case $html && !$attachments && !$html_images: |
| 908 | 908 | if (isset($this->_txtbody)) { |
| 909 | - $message =& $this->_addAlternativePart($null); |
|
| 909 | + $message = & $this->_addAlternativePart($null); |
|
| 910 | 910 | $this->_addTextPart($message, $this->_txtbody); |
| 911 | 911 | $this->_addHtmlPart($message); |
| 912 | 912 | } else { |
| 913 | - $message =& $this->_addHtmlPart($null); |
|
| 913 | + $message = & $this->_addHtmlPart($null); |
|
| 914 | 914 | } |
| 915 | 915 | break; |
| 916 | 916 | |
@@ -921,10 +921,10 @@ discard block |
||
| 921 | 921 | // * html |
| 922 | 922 | // * image... |
| 923 | 923 | if (isset($this->_txtbody)) { |
| 924 | - $message =& $this->_addAlternativePart($null); |
|
| 924 | + $message = & $this->_addAlternativePart($null); |
|
| 925 | 925 | $this->_addTextPart($message, $this->_txtbody); |
| 926 | 926 | |
| 927 | - $ht =& $this->_addRelatedPart($message); |
|
| 927 | + $ht = & $this->_addRelatedPart($message); |
|
| 928 | 928 | $this->_addHtmlPart($ht); |
| 929 | 929 | for ($i = 0; $i < count($this->_html_images); $i++) { |
| 930 | 930 | $this->_addHtmlImagePart($ht, $this->_html_images[$i]); |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | // * Content-Type: multipart/related; |
| 934 | 934 | // * html |
| 935 | 935 | // * image... |
| 936 | - $message =& $this->_addRelatedPart($null); |
|
| 936 | + $message = & $this->_addRelatedPart($null); |
|
| 937 | 937 | $this->_addHtmlPart($message); |
| 938 | 938 | for ($i = 0; $i < count($this->_html_images); $i++) { |
| 939 | 939 | $this->_addHtmlImagePart($message, $this->_html_images[$i]); |
@@ -961,9 +961,9 @@ discard block |
||
| 961 | 961 | break; |
| 962 | 962 | |
| 963 | 963 | case $html && $attachments && !$html_images: |
| 964 | - $message =& $this->_addMixedPart(); |
|
| 964 | + $message = & $this->_addMixedPart(); |
|
| 965 | 965 | if (isset($this->_txtbody)) { |
| 966 | - $alt =& $this->_addAlternativePart($message); |
|
| 966 | + $alt = & $this->_addAlternativePart($message); |
|
| 967 | 967 | $this->_addTextPart($alt, $this->_txtbody); |
| 968 | 968 | $this->_addHtmlPart($alt); |
| 969 | 969 | } else { |
@@ -975,13 +975,13 @@ discard block |
||
| 975 | 975 | break; |
| 976 | 976 | |
| 977 | 977 | case $html && $attachments && $html_images: |
| 978 | - $message =& $this->_addMixedPart(); |
|
| 978 | + $message = & $this->_addMixedPart(); |
|
| 979 | 979 | if (isset($this->_txtbody)) { |
| 980 | - $alt =& $this->_addAlternativePart($message); |
|
| 980 | + $alt = & $this->_addAlternativePart($message); |
|
| 981 | 981 | $this->_addTextPart($alt, $this->_txtbody); |
| 982 | - $rel =& $this->_addRelatedPart($alt); |
|
| 982 | + $rel = & $this->_addRelatedPart($alt); |
|
| 983 | 983 | } else { |
| 984 | - $rel =& $this->_addRelatedPart($message); |
|
| 984 | + $rel = & $this->_addRelatedPart($message); |
|
| 985 | 985 | } |
| 986 | 986 | $this->_addHtmlPart($rel); |
| 987 | 987 | for ($i = 0; $i < count($this->_html_images); $i++) { |
@@ -1105,10 +1105,10 @@ discard block |
||
| 1105 | 1105 | foreach ($headers as $key => $val) { |
| 1106 | 1106 | if (is_array($val)) { |
| 1107 | 1107 | foreach ($val as $value) { |
| 1108 | - $ret .= "$key: $value" . $eol; |
|
| 1108 | + $ret .= "$key: $value".$eol; |
|
| 1109 | 1109 | } |
| 1110 | 1110 | } else { |
| 1111 | - $ret .= "$key: $val" . $eol; |
|
| 1111 | + $ret .= "$key: $val".$eol; |
|
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | // add required boundary parameter if not defined |
| 1155 | 1155 | if (preg_match('/^multipart\//i', $type)) { |
| 1156 | 1156 | if (empty($this->_build_params['boundary'])) { |
| 1157 | - $this->_build_params['boundary'] = '=_' . md5(rand() . microtime()); |
|
| 1157 | + $this->_build_params['boundary'] = '=_'.md5(rand().microtime()); |
|
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | $header .= ";$eol boundary=\"".$this->_build_params['boundary']."\""; |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | { |
| 1261 | 1261 | $input = array("To" => $recipients); |
| 1262 | 1262 | $retval = $this->_encodeHeaders($input); |
| 1263 | - return $retval["To"] ; |
|
| 1263 | + return $retval["To"]; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | /** |
@@ -1344,10 +1344,10 @@ discard block |
||
| 1344 | 1344 | */ |
| 1345 | 1345 | function _contentHeaders() |
| 1346 | 1346 | { |
| 1347 | - $attachments = count($this->_parts) ? true : false; |
|
| 1348 | - $html_images = count($this->_html_images) ? true : false; |
|
| 1349 | - $html = strlen($this->_htmlbody) ? true : false; |
|
| 1350 | - $text = (!$html && strlen($this->_txtbody)) ? true : false; |
|
| 1347 | + $attachments = count($this->_parts) ? true : false; |
|
| 1348 | + $html_images = count($this->_html_images) ? true : false; |
|
| 1349 | + $html = strlen($this->_htmlbody) ? true : false; |
|
| 1350 | + $text = (!$html && strlen($this->_txtbody)) ? true : false; |
|
| 1351 | 1351 | $headers = array(); |
| 1352 | 1352 | |
| 1353 | 1353 | // See get() |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | |
| 1388 | 1388 | if ($headers['Content-Type'] == 'text/plain') { |
| 1389 | 1389 | // single-part message: add charset and encoding |
| 1390 | - $charset = 'charset=' . $this->_build_params['text_charset']; |
|
| 1390 | + $charset = 'charset='.$this->_build_params['text_charset']; |
|
| 1391 | 1391 | // place charset parameter in the same line, if possible |
| 1392 | 1392 | // 26 = strlen("Content-Type: text/plain; ") |
| 1393 | 1393 | $headers['Content-Type'] |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | = $this->_build_params['text_encoding']; |
| 1397 | 1397 | } else if ($headers['Content-Type'] == 'text/html') { |
| 1398 | 1398 | // single-part message: add charset and encoding |
| 1399 | - $charset = 'charset=' . $this->_build_params['html_charset']; |
|
| 1399 | + $charset = 'charset='.$this->_build_params['html_charset']; |
|
| 1400 | 1400 | // place charset parameter in the same line, if possible |
| 1401 | 1401 | $headers['Content-Type'] |
| 1402 | 1402 | .= (strlen($charset) + 25 <= 76) ? "; $charset" : ";$eol $charset"; |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | ) { |
| 1412 | 1412 | $boundary = $m[1]; |
| 1413 | 1413 | } else { |
| 1414 | - $boundary = '=_' . md5(rand() . microtime()); |
|
| 1414 | + $boundary = '=_'.md5(rand().microtime()); |
|
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | 1417 | $this->_build_params['boundary'] = $boundary; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | private function getPrivateProperty($instance, string $field) |
| 46 | 46 | { |
| 47 | - return (function (string $field) { |
|
| 47 | + return (function(string $field) { |
|
| 48 | 48 | return $this->$field; |
| 49 | 49 | })->call($instance, $field); |
| 50 | 50 | } |
@@ -301,7 +301,7 @@ |
||
| 301 | 301 | $settings = $this->settings; |
| 302 | 302 | |
| 303 | 303 | if ($settings && isset($settings['timezone'])) { |
| 304 | - $tzParameters = array_filter($method->getParameters(), function ($parameter) { |
|
| 304 | + $tzParameters = array_filter($method->getParameters(), function($parameter) { |
|
| 305 | 305 | return \in_array($parameter->getName(), ['tz', 'timezone'], true); |
| 306 | 306 | }); |
| 307 | 307 | |