@@ -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 | |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | $date = new static(); |
| 607 | 607 | |
| 608 | 608 | if (static::hasMacro($method)) { |
| 609 | - return static::bindMacroContext(null, function () use (&$method, &$parameters, &$date) { |
|
| 609 | + return static::bindMacroContext(null, function() use (&$method, &$parameters, &$date) { |
|
| 610 | 610 | return $date->callMacro($method, $parameters); |
| 611 | 611 | }); |
| 612 | 612 | } |
@@ -931,8 +931,7 @@ discard block |
||
| 931 | 931 | |
| 932 | 932 | return $this->setOptions( |
| 933 | 933 | $state ? |
| 934 | - $this->options | $options : |
|
| 935 | - $this->options & ~$options |
|
| 934 | + $this->options | $options : $this->options & ~$options |
|
| 936 | 935 | ); |
| 937 | 936 | } |
| 938 | 937 | |
@@ -1144,7 +1143,7 @@ discard block |
||
| 1144 | 1143 | |
| 1145 | 1144 | $this->filters = array_values(array_filter( |
| 1146 | 1145 | $this->filters, |
| 1147 | - function ($tuple) use ($key, $filter) { |
|
| 1146 | + function($tuple) use ($key, $filter) { |
|
| 1148 | 1147 | return $tuple[$key] !== $filter; |
| 1149 | 1148 | } |
| 1150 | 1149 | )); |
@@ -1664,7 +1663,7 @@ discard block |
||
| 1664 | 1663 | public function __call($method, $parameters) |
| 1665 | 1664 | { |
| 1666 | 1665 | if (static::hasMacro($method)) { |
| 1667 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
| 1666 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
| 1668 | 1667 | return $this->callMacro($method, $parameters); |
| 1669 | 1668 | }); |
| 1670 | 1669 | } |
@@ -1914,7 +1913,7 @@ discard block |
||
| 1914 | 1913 | * |
| 1915 | 1914 | * @param callable $callback |
| 1916 | 1915 | */ |
| 1917 | - public function forEach(callable $callback) |
|
| 1916 | + public function forEach (callable $callback) |
|
| 1918 | 1917 | { |
| 1919 | 1918 | foreach ($this as $date) { |
| 1920 | 1919 | $callback($date); |
@@ -2368,7 +2367,7 @@ discard block |
||
| 2368 | 2367 | return [$method, array_shift($parameters)]; |
| 2369 | 2368 | } |
| 2370 | 2369 | |
| 2371 | - return [function ($date) use ($method, $parameters) { |
|
| 2370 | + return [function($date) use ($method, $parameters) { |
|
| 2372 | 2371 | return ([$date, $method])(...$parameters); |
| 2373 | 2372 | }, $method]; |
| 2374 | 2373 | } |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | $interval->localStrictModeEnabled = true; |
| 657 | 657 | |
| 658 | 658 | $result = static::hasMacro($method) |
| 659 | - ? static::bindMacroContext(null, function () use (&$method, &$parameters, &$interval) { |
|
| 659 | + ? static::bindMacroContext(null, function() use (&$method, &$parameters, &$interval) { |
|
| 660 | 660 | return $interval->callMacro($method, $parameters); |
| 661 | 661 | }) |
| 662 | 662 | : $interval->$method(...$parameters); |
@@ -746,9 +746,7 @@ discard block |
||
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | switch ($unit === 'µs' ? 'µs' : strtolower($unit)) { |
| 749 | - case 'millennia': |
|
| 750 | - case 'millennium': |
|
| 751 | - $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; |
|
| 749 | + case 'millennia' : case 'millennium' : $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; |
|
| 752 | 750 | |
| 753 | 751 | break; |
| 754 | 752 | |
@@ -1343,7 +1341,7 @@ discard block |
||
| 1343 | 1341 | public function __call($method, $parameters) |
| 1344 | 1342 | { |
| 1345 | 1343 | if (static::hasMacro($method)) { |
| 1346 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
| 1344 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
| 1347 | 1345 | return $this->callMacro($method, $parameters); |
| 1348 | 1346 | }); |
| 1349 | 1347 | } |
@@ -1410,7 +1408,7 @@ discard block |
||
| 1410 | 1408 | $minimumUnit = 's'; |
| 1411 | 1409 | $skip = []; |
| 1412 | 1410 | extract($this->getForHumansInitialVariables($syntax, $short)); |
| 1413 | - $skip = array_filter((array) $skip, static function ($value) { |
|
| 1411 | + $skip = array_filter((array) $skip, static function($value) { |
|
| 1414 | 1412 | return \is_string($value) && $value !== ''; |
| 1415 | 1413 | }); |
| 1416 | 1414 | |
@@ -1447,7 +1445,7 @@ discard block |
||
| 1447 | 1445 | $optionalSpace = ''; |
| 1448 | 1446 | } |
| 1449 | 1447 | |
| 1450 | - $join = function ($list) use ($default, $last) { |
|
| 1448 | + $join = function($list) use ($default, $last) { |
|
| 1451 | 1449 | if (\count($list) < 2) { |
| 1452 | 1450 | return implode('', $list); |
| 1453 | 1451 | } |
@@ -1464,7 +1462,7 @@ discard block |
||
| 1464 | 1462 | } |
| 1465 | 1463 | |
| 1466 | 1464 | $glue = $join; |
| 1467 | - $join = function ($list) use ($glue) { |
|
| 1465 | + $join = function($list) use ($glue) { |
|
| 1468 | 1466 | return implode($glue, $list); |
| 1469 | 1467 | }; |
| 1470 | 1468 | } |
@@ -1623,7 +1621,7 @@ discard block |
||
| 1623 | 1621 | /** @var \Symfony\Component\Translation\Translator $translator */ |
| 1624 | 1622 | $translator = $this->getLocalTranslator(); |
| 1625 | 1623 | |
| 1626 | - $handleDeclensions = function ($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { |
|
| 1624 | + $handleDeclensions = function($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { |
|
| 1627 | 1625 | if (!$absolute) { |
| 1628 | 1626 | $declensionMode = $declensionMode ?? $this->translate($transId.'_mode'); |
| 1629 | 1627 | |
@@ -1673,14 +1671,14 @@ discard block |
||
| 1673 | 1671 | } |
| 1674 | 1672 | |
| 1675 | 1673 | $diffIntervalArray = [ |
| 1676 | - ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], |
|
| 1677 | - ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], |
|
| 1678 | - ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], |
|
| 1679 | - ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], |
|
| 1680 | - ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], |
|
| 1681 | - ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], |
|
| 1682 | - ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], |
|
| 1683 | - ['value' => $intervalValues->milliseconds, 'unit' => 'millisecond', 'unitShort' => 'ms'], |
|
| 1674 | + ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], |
|
| 1675 | + ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], |
|
| 1676 | + ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], |
|
| 1677 | + ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], |
|
| 1678 | + ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], |
|
| 1679 | + ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], |
|
| 1680 | + ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], |
|
| 1681 | + ['value' => $intervalValues->milliseconds, 'unit' => 'millisecond', 'unitShort' => 'ms'], |
|
| 1684 | 1682 | ['value' => $intervalValues->microExcludeMilli, 'unit' => 'microsecond', 'unitShort' => 'µs'], |
| 1685 | 1683 | ]; |
| 1686 | 1684 | |
@@ -1699,7 +1697,7 @@ discard block |
||
| 1699 | 1697 | } |
| 1700 | 1698 | } |
| 1701 | 1699 | |
| 1702 | - $transChoice = function ($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { |
|
| 1700 | + $transChoice = function($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { |
|
| 1703 | 1701 | $count = $unitData['value']; |
| 1704 | 1702 | |
| 1705 | 1703 | if ($short) { |
@@ -2233,7 +2231,7 @@ discard block |
||
| 2233 | 2231 | |
| 2234 | 2232 | private function invertCascade(array $values) |
| 2235 | 2233 | { |
| 2236 | - return $this->set(array_map(function ($value) { |
|
| 2234 | + return $this->set(array_map(function($value) { |
|
| 2237 | 2235 | return -$value; |
| 2238 | 2236 | }, $values))->doCascade(true)->invert(); |
| 2239 | 2237 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $search = rtrim(strtr($directory, '\\', '/'), '/'); |
| 138 | 138 | |
| 139 | - return $this->setDirectories(array_filter($this->getDirectories(), function ($item) use ($search) { |
|
| 139 | + return $this->setDirectories(array_filter($this->getDirectories(), function($item) use ($search) { |
|
| 140 | 140 | return rtrim(strtr($item, '\\', '/'), '/') !== $search; |
| 141 | 141 | })); |
| 142 | 142 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public function setLocale($locale) |
| 309 | 309 | { |
| 310 | - $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function ($matches) { |
|
| 310 | + $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function($matches) { |
|
| 311 | 311 | // _2-letters or YUE is a region, _3+-letters is a variant |
| 312 | 312 | $upper = strtoupper($matches[1]); |
| 313 | 313 | |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | $completeLocaleChunks = preg_split('/[_.-]+/', $completeLocale); |
| 335 | 335 | |
| 336 | - $getScore = function ($language) use ($completeLocaleChunks) { |
|
| 336 | + $getScore = function($language) use ($completeLocaleChunks) { |
|
| 337 | 337 | return self::compareChunkLists($completeLocaleChunks, preg_split('/[_.-]+/', $language)); |
| 338 | 338 | }; |
| 339 | 339 | |
| 340 | - usort($locales, function ($first, $second) use ($getScore) { |
|
| 340 | + usort($locales, function($first, $second) use ($getScore) { |
|
| 341 | 341 | return $getScore($second) <=> $getScore($first); |
| 342 | 342 | }); |
| 343 | 343 | |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $events = $this->app['events']; |
| 53 | 53 | |
| 54 | 54 | if ($this->isEventDispatcher($events)) { |
| 55 | - $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function () use ($service) { |
|
| 55 | + $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function() use ($service) { |
|
| 56 | 56 | $service->updateLocale(); |
| 57 | 57 | }); |
| 58 | 58 | } |