Passed
Push — master ( 63d1f8...7c50e7 )
by Joe Nilson
02:33
created
controller/documentos_residentes.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 
79 79
     public function crear_documento($tipo_documento)
80 80
     {
81
-        $this->archivo = \date('dmYhis') . '.pdf';
81
+        $this->archivo = \date('dmYhis').'.pdf';
82 82
         switch ($tipo_documento) {
83 83
             case 'informacion_cobros':
84 84
                 $this->documento = new residentes_pdf('letter', 'portrait');
85
-                $this->documento->pdf->addInfo('Title', 'Pagos Residente ' .
85
+                $this->documento->pdf->addInfo('Title', 'Pagos Residente '.
86 86
                                         $this->cliente_residente->codcliente);
87
-                $this->documento->pdf->addInfo('Subject', 'Pagos del Residente ' .
87
+                $this->documento->pdf->addInfo('Subject', 'Pagos del Residente '.
88 88
                                         $this->cliente_residente->codcliente);
89 89
                 $this->documento->pdf->addInfo('Author', $this->empresa->nombre);
90 90
                 $this->documento->pdf->ezSetMargins(10, 10, 10, 10);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     public function crearFacturaDetallada()
135 135
     {
136 136
         $customerInfo = (array) $this->cliente_residente;
137
-        $customerInfo['direccion'] = trim($this->cliente_residente->inmueble->codigo_externo()) . ' numero '
137
+        $customerInfo['direccion'] = trim($this->cliente_residente->inmueble->codigo_externo()).' numero '
138 138
             . $this->cliente_residente->inmueble->numero;
139 139
         $datosFactura = $this->datosFactura();
140 140
         $datosEmpresa = (array) $this->empresa;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
         $this->documento->set_y(80);
197 197
         if ($this->empresa->pie_factura) {
198
-            $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> ' .
198
+            $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> '.
199 199
                 $this->user->get_agente_fullname()), 0);
200 200
             $this->documento->pdf->addText(
201 201
                 10,
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
         }
207 207
 
208 208
         if ($this->filter_request('info_accion') == 'enviar') {
209
-            $this->documento->save('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo);
210
-        } else {
211
-            $this->documento->show('documento_cobros_' . \date('dmYhis') . '.pdf');
209
+            $this->documento->save('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo);
210
+        }else {
211
+            $this->documento->show('documento_cobros_'.\date('dmYhis').'.pdf');
212 212
         }
213 213
     }
214 214
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         }
257 257
         $this->documento->set_y(80);
258 258
         if ($this->empresa->pie_factura) {
259
-            $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> ' .
259
+            $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> '.
260 260
                 $this->user->get_agente_fullname()), 0);
261 261
             $this->documento->pdf->addText(
262 262
                 10,
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
         }
268 268
 
269 269
         if ($this->filter_request('info_accion') == 'enviar') {
270
-            $this->documento->save('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo);
271
-        } else {
272
-            $this->documento->show('documento_cobros_' . \date('dmYhis') . '.pdf');
270
+            $this->documento->save('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo);
271
+        }else {
272
+            $this->documento->show('documento_cobros_'.\date('dmYhis').'.pdf');
273 273
         }
274 274
     }
275 275
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     {
278 278
         $this->crear_documento($tipo_documento);
279 279
         $tipo_doc = $this->generar_tipo_doc($tipo_documento);
280
-        if (file_exists('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo)) {
280
+        if (file_exists('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo)) {
281 281
             $mail = $this->empresa->new_mail();
282 282
             $mail->FromName = $this->user->get_agente_fullname();
283 283
 
@@ -289,22 +289,22 @@  discard block
 block discarded – undo
289 289
             if ($_POST['email_copia']) {
290 290
                 if (isset($_POST['cco'])) {
291 291
                     $mail->addBCC($_POST['email_copia'], $this->cliente_residente->nombre);
292
-                } else {
292
+                }else {
293 293
                     $mail->addCC($_POST['email_copia'], $this->cliente_residente->nombre);
294 294
                 }
295 295
             }
296 296
 
297
-            $mail->Subject = $this->empresa->nombre . ': ' . $tipo_doc;
297
+            $mail->Subject = $this->empresa->nombre.': '.$tipo_doc;
298 298
 
299 299
             if ($this->is_html($_POST['mensaje'])) {
300 300
                 $mail->AltBody = strip_tags($_POST['mensaje']);
301 301
                 $mail->msgHTML($_POST['mensaje']);
302 302
                 $mail->isHTML(true);
303
-            } else {
303
+            }else {
304 304
                 $mail->Body = $_POST['mensaje'];
305 305
             }
306 306
 
307
-            $mail->addAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo);
307
+            $mail->addAttachment('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo);
308 308
             if (is_uploaded_file($_FILES['adjunto']['tmp_name'])) {
309 309
                 $mail->addAttachment($_FILES['adjunto']['tmp_name'], $_FILES['adjunto']['name']);
310 310
             }
@@ -312,12 +312,12 @@  discard block
 block discarded – undo
312 312
             if ($this->empresa->mail_connect($mail) && $mail->send()) {
313 313
                 $this->new_message('Mensaje enviado correctamente.');
314 314
                 $this->empresa->save_mail($mail);
315
-            } else {
316
-                $this->new_error_msg("Error al enviar el email: " . $mail->ErrorInfo);
315
+            }else {
316
+                $this->new_error_msg("Error al enviar el email: ".$mail->ErrorInfo);
317 317
             }
318 318
 
319
-            unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo);
320
-        } else {
319
+            unlink('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo);
320
+        }else {
321 321
             $this->new_error_msg('Imposible generar el PDF.');
322 322
         }
323 323
     }
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
         $pdf_doc->new_table();
337 337
         $pdf_doc->add_table_row(
338 338
             array(
339
-                'campo1' => "<b>" . $tipo_doc . "</b>",
339
+                'campo1' => "<b>".$tipo_doc."</b>",
340 340
                 'dato1' => '',
341
-                'campo2' => "<b>Fecha Impresión:</b> " . \date('d-m-Y H:i:s')
341
+                'campo2' => "<b>Fecha Impresión:</b> ".\date('d-m-Y H:i:s')
342 342
             )
343 343
         );
344 344
 
@@ -346,27 +346,27 @@  discard block
 block discarded – undo
346 346
             array(
347 347
                 'campo1' => "<b>Residente:</b>",
348 348
                 'dato1' => fs_fix_html($this->cliente_residente->nombre),
349
-                'campo2' => "<b>Tipo Residente:</b> " . $tipo_residente
349
+                'campo2' => "<b>Tipo Residente:</b> ".$tipo_residente
350 350
             )
351 351
         );
352 352
 
353 353
         $row = array(
354 354
             'campo1' => "<b>Inmueble:</b>",
355
-            'dato1' => fs_fix_html($this->cliente_residente->inmueble->codigo_externo() .
356
-                ' - ' . $this->cliente_residente->inmueble->numero),
355
+            'dato1' => fs_fix_html($this->cliente_residente->inmueble->codigo_externo().
356
+                ' - '.$this->cliente_residente->inmueble->numero),
357 357
             'campo2' => ''
358 358
         );
359 359
 
360 360
         if (!$this->cliente_residente) {
361 361
             /// nada
362 362
         } elseif ($this->cliente_residente->telefono1) {
363
-            $row['campo2'] = "<b>Teléfonos:</b> " . $this->cliente_residente->telefono1;
363
+            $row['campo2'] = "<b>Teléfonos:</b> ".$this->cliente_residente->telefono1;
364 364
             if ($this->cliente_residente->telefono2) {
365
-                $row['campo2'] .= "\n" . $this->cliente_residente->telefono2;
365
+                $row['campo2'] .= "\n".$this->cliente_residente->telefono2;
366 366
                 $lppag -= 2;
367 367
             }
368 368
         } elseif ($this->cliente_residente->telefono2) {
369
-            $row['campo2'] = "<b>Teléfonos:</b> " . $this->cliente_residente->telefono2;
369
+            $row['campo2'] = "<b>Teléfonos:</b> ".$this->cliente_residente->telefono2;
370 370
         }
371 371
         $pdf_doc->add_table_row($row);
372 372
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         [$table_header, $array_cols] = $this->generar_pdf_lineas_tablas($tipo);
415 415
         $pdf_doc->add_table_header($table_header);
416 416
 
417
-        for ($i = $linea_actual; (($linea_actual < ($lppag + $i)) && ( $linea_actual < count($items)));) {
417
+        for ($i = $linea_actual; (($linea_actual < ($lppag + $i)) && ($linea_actual < count($items)));) {
418 418
             $fila = $this->generar_pdf_lineas_fila($tipo, $items, $linea_actual);
419 419
             $pdf_doc->add_table_row($fila);
420 420
             $linea_actual++;
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             );
457 457
         }
458 458
         
459
-        return array($table_header,$array_cols);
459
+        return array($table_header, $array_cols);
460 460
     }
461 461
     
462 462
     public function generar_pdf_lineas_fila($tipo, $items, $linea_actual)
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             'fecha' => $items[$linea_actual]->fecha,
468 468
             'vencimiento' => $items[$linea_actual]->vencimiento,
469 469
             'importe' => $this->show_precio($items[$linea_actual]->pvpsindto, $this->empresa->coddivisa, true, FS_NF0),
470
-            'descuento' => $this->show_numero($items[$linea_actual]->dtopor) . " %",
470
+            'descuento' => $this->show_numero($items[$linea_actual]->dtopor)." %",
471 471
             'total' => $this->show_precio($items[$linea_actual]->pvptotal, $this->empresa->coddivisa, true, FS_NF0),
472 472
             'atraso' => $items[$linea_actual]->dias_atraso
473 473
         );
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                 }
495 495
                 $aux = explode("\n", $lin->descripcion);
496 496
                 if (count($aux) > 1) {
497
-                    $linea_size += 0.5 * ( count($aux) - 1);
497
+                    $linea_size += 0.5 * (count($aux) - 1);
498 498
                 }
499 499
                 if ($linea_size > 1) {
500 500
                     $lppag2 -= $linea_size - 1;
@@ -522,83 +522,83 @@  discard block
 block discarded – undo
522 522
                     if (imagepng(imagecreatefromstring(file_get_contents($pdf_doc->logo)), FS_MYDOCS
523 523
                         . 'images/logo.png')) {
524 524
                         $pdf_doc->pdf->addPngFromFile(
525
-                            FS_MYDOCS . 'images/logo.png',
525
+                            FS_MYDOCS.'images/logo.png',
526 526
                             $pdf_doc_LOGO_X,
527 527
                             $pdf_doc_LOGO_Y,
528 528
                             $tamanyo[0],
529 529
                             $tamanyo[1]
530 530
                         );
531
-                    } else {
531
+                    }else {
532 532
                         $pdf_doc->pdf->addJpegFromFile($pdf_doc->logo, $pdf_doc_LOGO_X, $pdf_doc_LOGO_Y, $tamanyo[0], $tamanyo[1]);
533 533
                     }
534
-                } else {
534
+                }else {
535 535
                     $pdf_doc->pdf->addJpegFromFile($pdf_doc->logo, $pdf_doc_LOGO_X, $pdf_doc_LOGO_Y, $tamanyo[0], $tamanyo[1]);
536 536
                 }
537 537
                 $pdf_doc->set_y(400);
538 538
                 $pdf_doc->pdf->ez['leftMargin'] = 120;
539 539
                 $pdf_doc->pdf->ezText(
540
-                    "<b>" . fs_fix_html($empresa->nombre) . "</b>",
540
+                    "<b>".fs_fix_html($empresa->nombre)."</b>",
541 541
                     12,
542 542
                     array('justification' => 'left')
543 543
                 );
544
-                $pdf_doc->pdf->ezText(FS_CIFNIF . ": " . $empresa->cifnif, 8, array('justification' => 'left'));
544
+                $pdf_doc->pdf->ezText(FS_CIFNIF.": ".$empresa->cifnif, 8, array('justification' => 'left'));
545 545
 
546
-                $direccion = $empresa->direccion . "\n";
546
+                $direccion = $empresa->direccion."\n";
547 547
                 if ($empresa->apartado) {
548
-                    $direccion .= ucfirst(FS_APARTADO) . ': ' . $empresa->apartado . ' - ';
548
+                    $direccion .= ucfirst(FS_APARTADO).': '.$empresa->apartado.' - ';
549 549
                 }
550 550
 
551 551
                 if ($empresa->codpostal) {
552
-                    $direccion .= 'CP: ' . $empresa->codpostal . ' - ';
552
+                    $direccion .= 'CP: '.$empresa->codpostal.' - ';
553 553
                 }
554 554
 
555 555
                 if ($empresa->ciudad) {
556
-                    $direccion .= $empresa->ciudad . ' - ';
556
+                    $direccion .= $empresa->ciudad.' - ';
557 557
                 }
558 558
 
559 559
                 if ($empresa->provincia) {
560
-                    $direccion .= '(' . $empresa->provincia . ')';
560
+                    $direccion .= '('.$empresa->provincia.')';
561 561
                 }
562 562
 
563 563
                 if ($empresa->telefono) {
564
-                    $direccion .= "\nTeléfono: " . $empresa->telefono . ' - '.$pdf_doc_LOGO_X."/".$pdf_doc_LOGO_Y;
564
+                    $direccion .= "\nTeléfono: ".$empresa->telefono.' - '.$pdf_doc_LOGO_X."/".$pdf_doc_LOGO_Y;
565 565
                 }
566 566
 
567
-                $pdf_doc->pdf->ezText(fs_fix_html($direccion) . "\n", 8, array('justification' => 'left'));
567
+                $pdf_doc->pdf->ezText(fs_fix_html($direccion)."\n", 8, array('justification' => 'left'));
568 568
                 $pdf_doc->set_y($pdf_doc_LOGO_Y);
569 569
 
570 570
                 $pdf_doc->pdf->ez['leftMargin'] = 10;
571
-            } else {
571
+            }else {
572 572
                 die('ERROR: no se encuentra la función imagecreatefromstring(). '
573 573
                     . 'Y por tanto no se puede usar el logotipo en los documentos.');
574 574
             }
575
-        } else {
575
+        }else {
576 576
             $pdf_doc->pdf->ezText(
577
-                "<b>" . fs_fix_html($empresa->nombre) . "</b>",
577
+                "<b>".fs_fix_html($empresa->nombre)."</b>",
578 578
                 12,
579 579
                 array('justification' => 'left')
580 580
             );
581
-            $pdf_doc->pdf->ezText(FS_CIFNIF . ": " . $empresa->cifnif, 8, array('justification' => 'left'));
581
+            $pdf_doc->pdf->ezText(FS_CIFNIF.": ".$empresa->cifnif, 8, array('justification' => 'left'));
582 582
 
583 583
             $direccion = $empresa->direccion;
584 584
             if ($empresa->apartado) {
585
-                $direccion .= ' - ' . ucfirst(FS_APARTADO) . ': ' . $empresa->apartado;
585
+                $direccion .= ' - '.ucfirst(FS_APARTADO).': '.$empresa->apartado;
586 586
             }
587 587
 
588 588
             if ($empresa->codpostal) {
589
-                $direccion .= ' - CP: ' . $empresa->codpostal;
589
+                $direccion .= ' - CP: '.$empresa->codpostal;
590 590
             }
591 591
 
592 592
             if ($empresa->ciudad) {
593
-                $direccion .= ' - ' . $empresa->ciudad;
593
+                $direccion .= ' - '.$empresa->ciudad;
594 594
             }
595 595
 
596 596
             if ($empresa->provincia) {
597
-                $direccion .= ' (' . $empresa->provincia . ')';
597
+                $direccion .= ' ('.$empresa->provincia.')';
598 598
             }
599 599
 
600 600
             if ($empresa->telefono) {
601
-                $direccion .= ' - Teléfono: ' . $empresa->telefono;
601
+                $direccion .= ' - Teléfono: '.$empresa->telefono;
602 602
             }
603 603
 
604 604
             $pdf_doc->pdf->ezText(fs_fix_html($direccion), 8, array('justification' => 'left'));
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
         $pdf_doc->new_table();
624 624
         $pdf_doc->add_table_row(
625 625
             array(
626
-                'campos' => "<b>" . ucfirst(FS_FACTURA) . ":</b>\n <b>".FS_NUMERO2.":</b>\n<b>Fecha:</b>\n<b>" . 'F. Pago' . ":</b>",
627
-                'factura' => $factura->codigo . "\n" . $factura->numero2 . "\n" . $factura->fecha . "\n" . $factura->codpago,
626
+                'campos' => "<b>".ucfirst(FS_FACTURA).":</b>\n <b>".FS_NUMERO2.":</b>\n<b>Fecha:</b>\n<b>".'F. Pago'.":</b>",
627
+                'factura' => $factura->codigo."\n".$factura->numero2."\n".$factura->fecha."\n".$factura->codpago,
628 628
             )
629 629
         );
630 630
         $pdf_doc->save_table(
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
         $pdf_doc->pdf->ez['leftMargin'] = 10;
644 644
     }
645 645
 
646
-    public function pdfFacturaDetalle(&$pdf_doc, &$empresa, &$lppag,  &$linea_actual)
646
+    public function pdfFacturaDetalle(&$pdf_doc, &$empresa, &$lppag, &$linea_actual)
647 647
     {
648 648
         $facturas = new factura_cliente();
649 649
         $clientes = new cliente();
@@ -662,10 +662,10 @@  discard block
 block discarded – undo
662 662
 
663 663
         $pdf_doc->add_table_header($table_header);
664 664
 
665
-        for ($i = $linea_actual; (($linea_actual < ($lppag + $i)) && ( $linea_actual < count($lineas)));) {
665
+        for ($i = $linea_actual; (($linea_actual < ($lppag + $i)) && ($linea_actual < count($lineas)));) {
666 666
             $descripcion = fs_fix_html($lineas[$linea_actual]->descripcion);
667 667
             if (!is_null($lineas[$linea_actual]->referencia) && $this->impresion['print_ref']) {
668
-                $descripcion = '<b>' . $lineas[$linea_actual]->referencia . '</b> ' . $descripcion;
668
+                $descripcion = '<b>'.$lineas[$linea_actual]->referencia.'</b> '.$descripcion;
669 669
             }
670 670
 
671 671
             /// ¿El articulo tiene trazabilidad?
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
                 'descripcion' => $descripcion,
678 678
                 'cantidad' => $this->show_numero($lineas[$linea_actual]->cantidad, 0),
679 679
                 'pvp' => $this->show_precio($lineas[$linea_actual]->pvpunitario, $factura->coddivisa, true, FS_NF0_ART),
680
-                'dto' => $this->show_numero($due_lineas) . " %",
680
+                'dto' => $this->show_numero($due_lineas)." %",
681 681
                 'importe' => $this->show_precio($lineas[$linea_actual]->pvptotal, $this->documento->coddivisa)
682 682
             );
683 683
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 
719 719
         /// ¿Última página?
720 720
         if ($linea_actual == count($lineas) && $this->documento->observaciones != '') {
721
-            $pdf_doc->pdf->ezText("\n" . fs_fix_html($this->documento->observaciones), 9);
721
+            $pdf_doc->pdf->ezText("\n".fs_fix_html($this->documento->observaciones), 9);
722 722
         }
723 723
     }
724 724
 
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
     {
738 738
         $this->existe_tesoreria();
739 739
         $this->cliente_residente = false;
740
-        if (!file_exists('tmp/' . FS_TMP_NAME . 'enviar') &&
741
-            !mkdir($concurrentDirectory = 'tmp/' . FS_TMP_NAME . 'enviar') &&
740
+        if (!file_exists('tmp/'.FS_TMP_NAME.'enviar') &&
741
+            !mkdir($concurrentDirectory = 'tmp/'.FS_TMP_NAME.'enviar') &&
742 742
             !is_dir($concurrentDirectory)) {
743 743
             throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
744 744
         }
Please login to merge, or discard this patch.
controller/imprimir_factura_residentes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         if ($logo) {
59 59
             $type = pathinfo($logo, PATHINFO_EXTENSION);
60 60
             $data = file_get_contents($logo);
61
-            $this->factura_logo_uri = 'data:image/' . $type . ';base64,' . base64_encode($data);
61
+            $this->factura_logo_uri = 'data:image/'.$type.';base64,'.base64_encode($data);
62 62
         }
63 63
 
64 64
         if ($this->id) {
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
         $fac = new factura_cliente();
72 72
         $this->factura = $fac->get($this->id);
73 73
         //Agregamos la cantidad de lineas multiplicadas por 4
74
-        $this->sizeFactura+= count($this->factura->get_lineas())*8;
74
+        $this->sizeFactura += count($this->factura->get_lineas()) * 8;
75 75
         //Agregamos la linea de separación del total
76
-        $this->sizeFactura+=4;
76
+        $this->sizeFactura += 4;
77 77
         //Agregamos las 3 lineas de Neto, FS_IVA y Total
78
-        $this->sizeFactura+=12;
78
+        $this->sizeFactura += 12;
79 79
         //Agregamos un espacio de 4 lineas aprox
80
-        $this->sizeFactura+=20;
80
+        $this->sizeFactura += 20;
81 81
         $cli = new cliente();
82 82
         $this->cliente = $cli->get($this->factura->codcliente);
83 83
         $facturas = $fac->all_from_cliente($this->factura->codcliente);
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
                         'fecha'=>$f->fecha,
90 90
                         'monto'=>$f->total
91 91
                     );
92
-                    $this->sizeFactura+=4;
92
+                    $this->sizeFactura += 4;
93 93
                     $this->total_facturas_pendientes += $f->total;
94 94
                 }
95 95
             }
96 96
         }
97
-        $this->sizeFactura+=20;
97
+        $this->sizeFactura += 20;
98 98
     }
99 99
 
100 100
     public function url()
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
                 'page_from' => __CLASS__,
121 121
                 'page_to' => __CLASS__,
122 122
                 'type' => 'head',
123
-                'text' => '<script src="' .
124
-                            FS_PATH .
123
+                'text' => '<script src="'.
124
+                            FS_PATH.
125 125
                             'plugins/residentes/view/js/jspdf.min.js" type="text/javascript"></script>',
126 126
                 'params' => ''
127 127
             ),
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
                 'page_from' => __CLASS__,
131 131
                 'page_to' => __CLASS__,
132 132
                 'type' => 'head',
133
-                'text' => '<script src="' .
134
-                             FS_PATH .
135
-                            'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" ' .
133
+                'text' => '<script src="'.
134
+                             FS_PATH.
135
+                            'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" '.
136 136
                             'type="text/javascript"></script>',
137 137
                 'params' => ''
138 138
             ),
Please login to merge, or discard this patch.
controller/informe_residentes.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         if ($this->codigo_edificacion) {
111
-            $this->where_code = " AND r.codigo like '" . $this->codigo_edificacion . "%' ";
111
+            $this->where_code = " AND r.codigo like '".$this->codigo_edificacion."%' ";
112 112
         }
113 113
 
114 114
         if ($this->tipo === 'informacion') {
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
         $this->offset = $this->confirmarValor($this->filter_request('offset'), 0);
148 148
         $this->limit = $this->confirmarValor($this->filter_request('limit'), FS_ITEM_LIMIT);
149 149
         $this->search = $this->confirmarValor($this->filter_request('search'), false);
150
-        $this->sort = ($sort and $sort!='undefined')?$sort:'r.codigo, r.numero';
151
-        $this->order = ($order and $order!='undefined')?$order:'ASC';
150
+        $this->sort = ($sort and $sort != 'undefined') ? $sort : 'r.codigo, r.numero';
151
+        $this->order = ($order and $order != 'undefined') ? $order : 'ASC';
152 152
     }
153 153
 
154 154
     public function informacion_edificaciones()
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         }
170 170
 
171 171
         //Verificamos los que están ocupados
172
-        $this->inmuebles_libres = $inmuebles-$inmuebles_ocupados;
172
+        $this->inmuebles_libres = $inmuebles - $inmuebles_ocupados;
173 173
         $this->inmuebles_ocupados = $inmuebles_ocupados;
174 174
         $this->total_vehiculos = $vehiculos;
175 175
         $this->carpetasPlugin();
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 
179 179
     public function generarArchivoExcel()
180 180
     {
181
-        $this->archivoXLSX = $this->exportDir . DIRECTORY_SEPARATOR .
182
-                            $this->archivo . "_" . $this->user->nick . ".xlsx";
183
-        $this->archivoXLSXPath = $this->publicPath . DIRECTORY_SEPARATOR .
184
-                            $this->archivo . "_" . $this->user->nick . ".xlsx";
181
+        $this->archivoXLSX = $this->exportDir.DIRECTORY_SEPARATOR.
182
+                            $this->archivo."_".$this->user->nick.".xlsx";
183
+        $this->archivoXLSXPath = $this->publicPath.DIRECTORY_SEPARATOR.
184
+                            $this->archivo."_".$this->user->nick.".xlsx";
185 185
         if (file_exists($this->archivoXLSX)) {
186 186
             unlink($this->archivoXLSX);
187 187
         }
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
     public function datosInformacion()
262 262
     {
263 263
         //Cantidad de Edificaciones
264
-        $sql_edificaciones = "SELECT ret.id,ret.descripcion, count(rme.id) as total " .
265
-            "FROM residentes_edificaciones_tipo as ret " .
266
-            " join residentes_mapa_edificaciones as rme on (rme.id_tipo = ret.id) " .
267
-            " group by ret.id,ret.descripcion " .
264
+        $sql_edificaciones = "SELECT ret.id,ret.descripcion, count(rme.id) as total ".
265
+            "FROM residentes_edificaciones_tipo as ret ".
266
+            " join residentes_mapa_edificaciones as rme on (rme.id_tipo = ret.id) ".
267
+            " group by ret.id,ret.descripcion ".
268 268
             " order by ret.padre;";
269 269
         $data_edificaciones = $this->db->select($sql_edificaciones);
270 270
         //cantidad de Inmuebles
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         echo json_encode($data, JSON_THROW_ON_ERROR);
308 308
     }
309 309
 
310
-    public function lista_residentes ($todo = false)
310
+    public function lista_residentes($todo = false)
311 311
     {
312 312
         $sql = " select r.codcliente, c.nombre, c.cifnif, c.telefono1, c.email, codigo, numero, fecha_ocupacion ".
313 313
             " from residentes_edificaciones as r, clientes as c ".
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             " order by ".$this->sort." ".$this->order;
316 316
         if ($todo) {
317 317
             $data = $this->db->select($sql);
318
-        } else {
318
+        }else {
319 319
             $data = $this->db->select_limit($sql, $this->limit, $this->offset);
320 320
         }
321 321
         $sql_cantidad = "select count(r.id) as total from residentes_edificaciones as r ".
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
             " order by ".$this->sort." ".$this->order;
338 338
         if ($todo) {
339 339
             $data = $this->db->select($sql);
340
-        } else {
340
+        }else {
341 341
             $data = $this->db->select_limit($sql, $this->limit, $this->offset);
342 342
         }
343 343
 
344 344
         $sql_cantidad = "select count(r.id) as total from residentes_edificaciones as r";
345 345
         if ($this->where_code) {
346
-            $sql_cantidad.=" WHERE r.codigo!='' ".$this->where_code;
346
+            $sql_cantidad .= " WHERE r.codigo!='' ".$this->where_code;
347 347
         }
348 348
         $data_cantidad = $this->db->select($sql_cantidad);
349 349
         return array($data, $data_cantidad[0]['total']);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             " order by ".$this->sort." ".$this->order;
366 366
         if ($todo) {
367 367
             $data = $this->db->select($sql);
368
-        } else {
368
+        }else {
369 369
             $data = $this->db->select_limit($sql, $this->limit, $this->offset);
370 370
         }
371 371
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
     public function crearXLSX(&$writer, $hoja_nombre, $header, $headerText, $data)
448 448
     {
449
-        $style_header = array('border'=>'left,right,top,bottom','font'=>'Arial','font-size'=>10,'font-style'=>'bold');
449
+        $style_header = array('border'=>'left,right,top,bottom', 'font'=>'Arial', 'font-size'=>10, 'font-style'=>'bold');
450 450
         $writer->writeSheetRow($hoja_nombre, $headerText, $style_header);
451 451
         $writer->writeSheetHeader($hoja_nombre, $header, true);
452 452
         $this->agregarDatosXLSX($writer, $hoja_nombre, $data, $headerText);
@@ -478,9 +478,9 @@  discard block
 block discarded – undo
478 478
     public function carpetasPlugin()
479 479
     {
480 480
         $basepath = dirname(__DIR__, 3);
481
-        $this->documentosDir = $basepath . DIRECTORY_SEPARATOR . FS_MYDOCS . 'documentos';
482
-        $this->exportDir = $this->documentosDir . DIRECTORY_SEPARATOR . "informes_residentes";
483
-        $this->publicPath = FS_PATH . FS_MYDOCS . 'documentos' . DIRECTORY_SEPARATOR . 'informes_residentes';
481
+        $this->documentosDir = $basepath.DIRECTORY_SEPARATOR.FS_MYDOCS.'documentos';
482
+        $this->exportDir = $this->documentosDir.DIRECTORY_SEPARATOR."informes_residentes";
483
+        $this->publicPath = FS_PATH.FS_MYDOCS.'documentos'.DIRECTORY_SEPARATOR.'informes_residentes';
484 484
         if (!is_dir($this->documentosDir)) {
485 485
             if (!mkdir($concurrentDirectory = $this->documentosDir) && !is_dir($concurrentDirectory)) {
486 486
                 throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
     public function url()
498 498
     {
499 499
         if (isset($_REQUEST['inmueble'])) {
500
-            return 'index.php?page=informe_residentes&inmueble=' . $_REQUEST['inmueble'];
501
-        } else {
500
+            return 'index.php?page=informe_residentes&inmueble='.$_REQUEST['inmueble'];
501
+        }else {
502 502
             return parent::url();
503 503
         }
504 504
     }
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                 'page_from' => __CLASS__,
516 516
                 'page_to' => __CLASS__,
517 517
                 'type' => 'head',
518
-                'text' => '<script src="' . FS_PATH .
518
+                'text' => '<script src="'.FS_PATH.
519 519
                                 'plugins/residentes/view/js/1/bootstrap-table.min.js" type="text/javascript"></script>',
520 520
                 'params' => ''
521 521
             ),
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
                 'page_from' => __CLASS__,
525 525
                 'page_to' => __CLASS__,
526 526
                 'type' => 'head',
527
-                'text' => '<script src="' . FS_PATH .
527
+                'text' => '<script src="'.FS_PATH.
528 528
                     'plugins/residentes/view/js/1/bootstrap-table-locale-all.min.js" type="text/javascript"></script>',
529 529
                 'params' => ''
530 530
             ),
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                 'page_from' => __CLASS__,
534 534
                 'page_to' => __CLASS__,
535 535
                 'type' => 'head',
536
-                'text' => '<script src="' . FS_PATH .
536
+                'text' => '<script src="'.FS_PATH.
537 537
                 'plugins/residentes/view/js/plugins/bootstrap-table-filter.min.js" type="text/javascript"></script>',
538 538
                 'params' => ''
539 539
             ),
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                 'page_from' => __CLASS__,
543 543
                 'page_to' => __CLASS__,
544 544
                 'type' => 'head',
545
-                'text' => '<script src="' . FS_PATH .
545
+                'text' => '<script src="'.FS_PATH.
546 546
                 'plugins/residentes/view/js/plugins/bootstrap-table-toolbar.min.js" type="text/javascript"></script>',
547 547
                 'params' => ''
548 548
             ),
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                 'page_from' => __CLASS__,
552 552
                 'page_to' => __CLASS__,
553 553
                 'type' => 'head',
554
-                'text' => '<script src="' . FS_PATH .
554
+                'text' => '<script src="'.FS_PATH.
555 555
                 'plugins/residentes/view/js/plugins/bootstrap-table-mobile.min.js" type="text/javascript"></script>',
556 556
                 'params' => ''
557 557
             ),
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 'page_from' => __CLASS__,
561 561
                 'page_to' => __CLASS__,
562 562
                 'type' => 'head',
563
-                'text' => '<script src="' . FS_PATH . 'view/js/chart.bundle.min.js" type="text/javascript"></script>',
563
+                'text' => '<script src="'.FS_PATH.'view/js/chart.bundle.min.js" type="text/javascript"></script>',
564 564
                 'params' => ''
565 565
             ),
566 566
             array(
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                 'page_from' => __CLASS__,
569 569
                 'page_to' => __CLASS__,
570 570
                 'type' => 'head',
571
-                'text' => '<link rel="stylesheet" type="text/css" media="screen" href="' . FS_PATH .
571
+                'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH.
572 572
                     'plugins/residentes/view/css/bootstrap-table.min.css"/>',
573 573
                 'params' => ''
574 574
             ),
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         foreach ($extensiones as $ext) {
578 578
             $fsext0 = new fs_extension($ext);
579 579
             if (!$fsext0->save()) {
580
-                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.');
580
+                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.');
581 581
             }
582 582
         }
583 583
     }
Please login to merge, or discard this patch.
controller/imprimir_factura_residentes_detallada.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         if ($logo) {
59 59
             $type = pathinfo($logo, PATHINFO_EXTENSION);
60 60
             $data = file_get_contents($logo);
61
-            $this->factura_logo_uri = 'data:image/' . $type . ';base64,' . base64_encode($data);
61
+            $this->factura_logo_uri = 'data:image/'.$type.';base64,'.base64_encode($data);
62 62
         }
63 63
 
64 64
         if ($this->id) {
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
         $fac = new factura_cliente();
72 72
         $this->factura = $fac->get($this->id);
73 73
         //Agregamos la cantidad de lineas multiplicadas por 4
74
-        $this->sizeFactura+= count($this->factura->get_lineas())*8;
74
+        $this->sizeFactura += count($this->factura->get_lineas()) * 8;
75 75
         //Agregamos la linea de separación del total
76
-        $this->sizeFactura+=4;
76
+        $this->sizeFactura += 4;
77 77
         //Agregamos las 3 lineas de Neto, FS_IVA y Total
78
-        $this->sizeFactura+=12;
78
+        $this->sizeFactura += 12;
79 79
         //Agregamos un espacio de 4 lineas aprox
80
-        $this->sizeFactura+=20;
80
+        $this->sizeFactura += 20;
81 81
         $cli = new cliente();
82 82
         $this->cliente = $cli->get($this->factura->codcliente);
83 83
         $facturas = $fac->all_from_cliente($this->factura->codcliente);
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
                         'fecha'=>$f->fecha,
90 90
                         'monto'=>$f->total
91 91
                     );
92
-                    $this->sizeFactura+=4;
92
+                    $this->sizeFactura += 4;
93 93
                     $this->total_facturas_pendientes += $f->total;
94 94
                 }
95 95
             }
96 96
         }
97
-        $this->sizeFactura+=20;
97
+        $this->sizeFactura += 20;
98 98
     }
99 99
 
100 100
     public function url()
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
                 'page_from' => __CLASS__,
121 121
                 'page_to' => __CLASS__,
122 122
                 'type' => 'head',
123
-                'text' => '<script src="' .
124
-                            FS_PATH .
123
+                'text' => '<script src="'.
124
+                            FS_PATH.
125 125
                             'plugins/residentes/view/js/jspdf.min.js" type="text/javascript"></script>',
126 126
                 'params' => ''
127 127
             ),
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
                 'page_from' => __CLASS__,
131 131
                 'page_to' => __CLASS__,
132 132
                 'type' => 'head',
133
-                'text' => '<script src="' .
134
-                             FS_PATH .
135
-                            'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" ' .
133
+                'text' => '<script src="'.
134
+                             FS_PATH.
135
+                            'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" '.
136 136
                             'type="text/javascript"></script>',
137 137
                 'params' => ''
138 138
             ),
Please login to merge, or discard this patch.
controller/clientes_vehiculos.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
             if ($accion === 'agregar') {
69 69
                 if ($vehiculo->save()) {
70 70
                     $this->new_message('Vehiculo agregado exitosamente');
71
-                } else {
71
+                }else {
72 72
                     $this->new_error_msg('No se pudieron agregar los datos del vehiculo, revise la información e ".
73 73
                     "intentelo nuevamente.');
74 74
                 }
75 75
             } elseif ($accion === 'eliminar') {
76 76
                 if ($vehiculo->delete()) {
77 77
                     $this->new_message('Vehiculo eliminado exitosamente');
78
-                } else {
78
+                }else {
79 79
                     $this->new_error_msg('No se pudieron eliminar los datos del vehiculo, revise la información e ".
80 80
                     "intentelo nuevamente.');
81 81
                 }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         foreach ($extensiones as $ext) {
111 111
             $fsext0 = new fs_extension($ext);
112 112
             if (!$fsext0->save()) {
113
-                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.');
113
+                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.');
114 114
             }
115 115
         }
116 116
     }
Please login to merge, or discard this patch.
extras/residentes_pdf.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -62,81 +62,81 @@
 block discarded – undo
62 62
                     if (imagepng(imagecreatefromstring(file_get_contents($this->logo)), FS_MYDOCS
63 63
                         . 'images/logo.png')) {
64 64
                         $this->pdf->addPngFromFile(
65
-                            FS_MYDOCS . 'images/logo.png',
65
+                            FS_MYDOCS.'images/logo.png',
66 66
                             self::LOGO_X,
67 67
                             self::LOGO_Y,
68 68
                             $tamanyo[0],
69 69
                             $tamanyo[1]
70 70
                         );
71
-                    } else {
71
+                    }else {
72 72
                         $this->pdf->addJpegFromFile($this->logo, self::LOGO_X, self::LOGO_Y, $tamanyo[0], $tamanyo[1]);
73 73
                     }
74
-                } else {
74
+                }else {
75 75
                     $this->pdf->addJpegFromFile($this->logo, self::LOGO_X, self::LOGO_Y, $tamanyo[0], $tamanyo[1]);
76 76
                 }
77 77
 
78 78
                 $this->pdf->ez['rightMargin'] = 40;
79 79
                 $this->pdf->ezText(
80
-                    "<b>" . fs_fix_html($empresa->nombre) . "</b>",
80
+                    "<b>".fs_fix_html($empresa->nombre)."</b>",
81 81
                     12,
82 82
                     array('justification' => 'right')
83 83
                 );
84
-                $this->pdf->ezText(FS_CIFNIF . ": " . $empresa->cifnif, 8, array('justification' => 'right'));
84
+                $this->pdf->ezText(FS_CIFNIF.": ".$empresa->cifnif, 8, array('justification' => 'right'));
85 85
 
86
-                $direccion = $empresa->direccion . "\n";
86
+                $direccion = $empresa->direccion."\n";
87 87
                 if ($empresa->apartado) {
88
-                    $direccion .= ucfirst(FS_APARTADO) . ': ' . $empresa->apartado . ' - ';
88
+                    $direccion .= ucfirst(FS_APARTADO).': '.$empresa->apartado.' - ';
89 89
                 }
90 90
 
91 91
                 if ($empresa->codpostal) {
92
-                    $direccion .= 'CP: ' . $empresa->codpostal . ' - ';
92
+                    $direccion .= 'CP: '.$empresa->codpostal.' - ';
93 93
                 }
94 94
 
95 95
                 if ($empresa->ciudad) {
96
-                    $direccion .= $empresa->ciudad . ' - ';
96
+                    $direccion .= $empresa->ciudad.' - ';
97 97
                 }
98 98
 
99 99
                 if ($empresa->provincia) {
100
-                    $direccion .= '(' . $empresa->provincia . ')';
100
+                    $direccion .= '('.$empresa->provincia.')';
101 101
                 }
102 102
 
103 103
                 if ($empresa->telefono) {
104
-                    $direccion .= "\nTeléfono: " . $empresa->telefono;
104
+                    $direccion .= "\nTeléfono: ".$empresa->telefono;
105 105
                 }
106 106
 
107
-                $this->pdf->ezText(fs_fix_html($direccion) . "\n", 8, array('justification' => 'right'));
107
+                $this->pdf->ezText(fs_fix_html($direccion)."\n", 8, array('justification' => 'right'));
108 108
                 $this->set_y(self::LOGO_Y + 10);
109
-            } else {
109
+            }else {
110 110
                 die('ERROR: no se encuentra la función imagecreatefromstring(). '
111 111
                     . 'Y por tanto no se puede usar el logotipo en los documentos.');
112 112
             }
113
-        } else {
113
+        }else {
114 114
             $this->pdf->ezText(
115
-                "<b>" . fs_fix_html($empresa->nombre) . "</b>",
115
+                "<b>".fs_fix_html($empresa->nombre)."</b>",
116 116
                 12,
117 117
                 array('justification' => 'center')
118 118
             );
119
-            $this->pdf->ezText(FS_CIFNIF . ": " . $empresa->cifnif, 8, array('justification' => 'center'));
119
+            $this->pdf->ezText(FS_CIFNIF.": ".$empresa->cifnif, 8, array('justification' => 'center'));
120 120
 
121 121
             $direccion = $empresa->direccion;
122 122
             if ($empresa->apartado) {
123
-                $direccion .= ' - ' . ucfirst(FS_APARTADO) . ': ' . $empresa->apartado;
123
+                $direccion .= ' - '.ucfirst(FS_APARTADO).': '.$empresa->apartado;
124 124
             }
125 125
 
126 126
             if ($empresa->codpostal) {
127
-                $direccion .= ' - CP: ' . $empresa->codpostal;
127
+                $direccion .= ' - CP: '.$empresa->codpostal;
128 128
             }
129 129
 
130 130
             if ($empresa->ciudad) {
131
-                $direccion .= ' - ' . $empresa->ciudad;
131
+                $direccion .= ' - '.$empresa->ciudad;
132 132
             }
133 133
 
134 134
             if ($empresa->provincia) {
135
-                $direccion .= ' (' . $empresa->provincia . ')';
135
+                $direccion .= ' ('.$empresa->provincia.')';
136 136
             }
137 137
 
138 138
             if ($empresa->telefono) {
139
-                $direccion .= ' - Teléfono: ' . $empresa->telefono;
139
+                $direccion .= ' - Teléfono: '.$empresa->telefono;
140 140
             }
141 141
 
142 142
             $this->pdf->ezText(fs_fix_html($direccion), 8, array('justification' => 'center'));
Please login to merge, or discard this patch.
extras/fpdf183/exfpdf.php 3 patches
Indentation   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*********************************************************************
2
+    /*********************************************************************
3 3
  * exFPDF  extend FPDF v1.81                                                    *
4 4
  *                                                                    *
5 5
  * Version: 2.2                                                       *
@@ -7,378 +7,378 @@  discard block
 block discarded – undo
7 7
  * Author:  Dan Machado                                               *
8 8
  * Require  FPDF v1.81, formatedstring v1.0                                                *
9 9
  **********************************************************************/
10
- include 'formatedstring.php';
11
- class exFPDF extends FPDF
12
- {
10
+    include 'formatedstring.php';
11
+    class exFPDF extends FPDF
12
+    {
13 13
     public function PageBreak(){
14
-       return $this->PageBreakTrigger;
15
-   }
14
+        return $this->PageBreakTrigger;
15
+    }
16 16
 
17
-   public function current_font($c){
18
-      if($c=='family'){
19
-         return $this->FontFamily;
20
-      }
21
-      elseif($c=='style'){
22
-         return $this->FontStyle;
23
-      }
24
-      elseif($c=='size'){
25
-         return $this->FontSizePt;
26
-      }
27
-   }
17
+    public function current_font($c){
18
+        if($c=='family'){
19
+            return $this->FontFamily;
20
+        }
21
+        elseif($c=='style'){
22
+            return $this->FontStyle;
23
+        }
24
+        elseif($c=='size'){
25
+            return $this->FontSizePt;
26
+        }
27
+    }
28 28
 
29
-   public function get_color($c){
30
-      if($c=='fill'){
31
-         return $this->FillColor;
32
-      }
33
-      elseif($c=='text'){
34
-         return $this->TextColor;
35
-      }
36
-   }
29
+    public function get_color($c){
30
+        if($c=='fill'){
31
+            return $this->FillColor;
32
+        }
33
+        elseif($c=='text'){
34
+            return $this->TextColor;
35
+        }
36
+    }
37 37
 
38
-   public function get_page_width(){
39
-      return $this->w;
40
-   }
38
+    public function get_page_width(){
39
+        return $this->w;
40
+    }
41 41
 
42
-   public function get_margin($c){
43
-      if($c=='l'){
44
-         return $this->lMargin;
45
-      }
46
-      elseif($c=='r'){
47
-         return $this->rMargin;
48
-      }
49
-      elseif($c=='t'){
50
-         return $this->tMargin;
51
-      }
52
-   }
42
+    public function get_margin($c){
43
+        if($c=='l'){
44
+            return $this->lMargin;
45
+        }
46
+        elseif($c=='r'){
47
+            return $this->rMargin;
48
+        }
49
+        elseif($c=='t'){
50
+            return $this->tMargin;
51
+        }
52
+    }
53 53
 
54
-   public function get_linewidth(){
55
-      return $this->LineWidth;
56
-   }
54
+    public function get_linewidth(){
55
+        return $this->LineWidth;
56
+    }
57 57
 
58
-   public function get_orientation(){
59
-      return $this->CurOrientation;
60
-   }
61
-   static private $hex=array('0'=>0,'1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7,'8'=>8,'9'=>9,
62
-   'A'=>10,'B'=>11,'C'=>12,'D'=>13,'E'=>14,'F'=>15);
58
+    public function get_orientation(){
59
+        return $this->CurOrientation;
60
+    }
61
+    static private $hex=array('0'=>0,'1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7,'8'=>8,'9'=>9,
62
+    'A'=>10,'B'=>11,'C'=>12,'D'=>13,'E'=>14,'F'=>15);
63 63
 
64
-   public function is_rgb($str){
65
-      $a=true;
66
-      $tmp=explode(',', trim($str, ','));
67
-      foreach($tmp as $color){
68
-         if(!is_numeric($color) || $color<0 || $color>255){
64
+    public function is_rgb($str){
65
+        $a=true;
66
+        $tmp=explode(',', trim($str, ','));
67
+        foreach($tmp as $color){
68
+            if(!is_numeric($color) || $color<0 || $color>255){
69 69
             $a=false;
70 70
             break;
71
-         }
72
-      }
73
-      return $a;
74
-   }
71
+            }
72
+        }
73
+        return $a;
74
+    }
75 75
 
76
-   public function is_hex($str){
77
-      $a=true;
78
-      $str=strtoupper($str);
79
-      $n=strlen($str);
80
-      if(($n==7 || $n==4) && $str[0]=='#'){
81
-         for($i=1; $i<$n; $i++){
76
+    public function is_hex($str){
77
+        $a=true;
78
+        $str=strtoupper($str);
79
+        $n=strlen($str);
80
+        if(($n==7 || $n==4) && $str[0]=='#'){
81
+            for($i=1; $i<$n; $i++){
82 82
             if(!isset(self::$hex[$str[$i]])){
83
-               $a=false;
84
-               break;
83
+                $a=false;
84
+                break;
85
+            }
85 86
             }
86
-         }
87
-      }
88
-      else{
89
-         $a=false;
90
-      }
91
-      return $a;
92
-   }
87
+        }
88
+        else{
89
+            $a=false;
90
+        }
91
+        return $a;
92
+    }
93 93
 
94
-   public function hextodec($str){
95
-      $result=array();
96
-      $str=strtoupper(substr($str,1));
97
-      $n=strlen($str);
98
-      for($i=0; $i<3; $i++){
99
-         if($n==6){
94
+    public function hextodec($str){
95
+        $result=array();
96
+        $str=strtoupper(substr($str,1));
97
+        $n=strlen($str);
98
+        for($i=0; $i<3; $i++){
99
+            if($n==6){
100 100
             $result[$i]=self::$hex[$str[2*$i]]*16+self::$hex[$str[2*$i+1]];
101
-         }
102
-         else{
101
+            }
102
+            else{
103 103
             $result[$i]=self::$hex[$str[$i]]*16+self::$hex[$str[$i]];
104
-         }
105
-      }
106
-      return $result;
107
-   }
108
-   static private $options=array('F'=>'', 'T'=>'', 'D'=>'');
104
+            }
105
+        }
106
+        return $result;
107
+    }
108
+    static private $options=array('F'=>'', 'T'=>'', 'D'=>'');
109 109
 
110
-   public function resetColor($str, $p='F'){
111
-      if(isset(self::$options[$p]) && self::$options[$p]!=$str){
112
-         self::$options[$p]=$str;
113
-         $array=array();
114
-         if($this->is_hex($str)){
110
+    public function resetColor($str, $p='F'){
111
+        if(isset(self::$options[$p]) && self::$options[$p]!=$str){
112
+            self::$options[$p]=$str;
113
+            $array=array();
114
+            if($this->is_hex($str)){
115 115
             $array=$this->hextodec($str);
116
-         }
117
-         elseif($this->is_rgb($str)){
116
+            }
117
+            elseif($this->is_rgb($str)){
118 118
             $array=explode(',', trim($str, ','));
119 119
             for($i=0; $i<3; $i++){
120
-               if(!isset($array[$i])){
121
-                  $array[$i]=0;
122
-               }
120
+                if(!isset($array[$i])){
121
+                    $array[$i]=0;
122
+                }
123
+            }
123 124
             }
124
-         }
125
-         else{
125
+            else{
126 126
             $array=array(null, null, null);
127 127
             $i=0;
128 128
             $tmp=explode(' ', $str);
129 129
             foreach($tmp as $c){
130
-               if(is_numeric($c)){
131
-                  $array[$i]=$c*256;
132
-                  $i++;
133
-               }
130
+                if(is_numeric($c)){
131
+                    $array[$i]=$c*256;
132
+                    $i++;
133
+                }
134 134
             }
135
-         }
136
-         if($p=='T'){
135
+            }
136
+            if($p=='T'){
137 137
             $this->SetTextColor($array[0],$array[1],$array[2]);
138
-         }
139
-         elseif($p=='D'){
138
+            }
139
+            elseif($p=='D'){
140 140
             $this->SetDrawColor($array[0],$array[1], $array[2]);
141
-         }
142
-         elseif($p=='F'){
141
+            }
142
+            elseif($p=='F'){
143 143
             $this->SetFillColor($array[0],$array[1],$array[2]);
144
-         }
145
-      }
146
-   }
147
-   static private $font_def='';
144
+            }
145
+        }
146
+    }
147
+    static private $font_def='';
148 148
 
149
-   public function resetFont($font_family, $font_style, $font_size){
150
-      if(self::$font_def!=$font_family .'-' . $font_style . '-' .$font_size){
151
-         self::$font_def=$font_family .'-' . $font_style . '-' .$font_size;
152
-         $this->SetFont($font_family, $font_style, $font_size);
153
-      }
154
-   }
149
+    public function resetFont($font_family, $font_style, $font_size){
150
+        if(self::$font_def!=$font_family .'-' . $font_style . '-' .$font_size){
151
+            self::$font_def=$font_family .'-' . $font_style . '-' .$font_size;
152
+            $this->SetFont($font_family, $font_style, $font_size);
153
+        }
154
+    }
155 155
 
156
-   public function resetStaticData(){
157
-      self::$font_def='';
158
-      self::$options=array('F'=>'', 'T'=>'', 'D'=>'');
159
-   }
160
-   /***********************************************************************
156
+    public function resetStaticData(){
157
+        self::$font_def='';
158
+        self::$options=array('F'=>'', 'T'=>'', 'D'=>'');
159
+    }
160
+    /***********************************************************************
161 161
    *
162 162
    * Based on FPDF method SetFont
163 163
    *
164 164
    ************************************************************************/
165 165
 
166
-   private function &FontData($family, $style, $size){
167
-      if($family=='')
168
-      $family = $this->FontFamily;
169
-      else
170
-      $family = strtolower($family);
171
-      $style = strtoupper($style);
172
-      if(strpos($style,'U')!==false){
173
-         $this->underline = true;
174
-         $style = str_replace('U','',$style);
175
-      }
176
-      if($style=='IB')
177
-      $style = 'BI';
178
-      $fontkey = $family.$style;
179
-      if(!isset($this->fonts[$fontkey])){
180
-         if($family=='arial')
181
-         $family = 'helvetica';
182
-         if(in_array($family,$this->CoreFonts)){
166
+    private function &FontData($family, $style, $size){
167
+        if($family=='')
168
+        $family = $this->FontFamily;
169
+        else
170
+        $family = strtolower($family);
171
+        $style = strtoupper($style);
172
+        if(strpos($style,'U')!==false){
173
+            $this->underline = true;
174
+            $style = str_replace('U','',$style);
175
+        }
176
+        if($style=='IB')
177
+        $style = 'BI';
178
+        $fontkey = $family.$style;
179
+        if(!isset($this->fonts[$fontkey])){
180
+            if($family=='arial')
181
+            $family = 'helvetica';
182
+            if(in_array($family,$this->CoreFonts)){
183 183
             if($family=='symbol' || $family=='zapfdingbats')
184 184
             $style = '';
185 185
             $fontkey = $family.$style;
186 186
             if(!isset($this->fonts[$fontkey]))
187 187
             $this->AddFont($family,$style);
188
-         }
189
-         else
190
-         $this->Error('Undefined font: '.$family.' '.$style);
191
-      }
192
-      $result['FontSize'] = $size/$this->k;
193
-      $result['CurrentFont']=&$this->fonts[$fontkey];
194
-      return $result;
195
-   }
188
+            }
189
+            else
190
+            $this->Error('Undefined font: '.$family.' '.$style);
191
+        }
192
+        $result['FontSize'] = $size/$this->k;
193
+        $result['CurrentFont']=&$this->fonts[$fontkey];
194
+        return $result;
195
+    }
196 196
     
197 197
 
198
-   private function setLines(&$fstring, $p, $q){
199
-      $parced_str=& $fstring->parced_str;
200
-      $lines=& $fstring->lines;
201
-      $linesmap=& $fstring->linesmap;
202
-      $cfty=$fstring->get_current_style($p);
203
-      $ffs=$cfty['font-family'] . $cfty['style'];
204
-      if(!isset($fstring->used_fonts[$ffs])){
205
-         $fstring->used_fonts[$ffs]=& $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
206
-      }
207
-      $cw=& $fstring->used_fonts[$ffs]['CurrentFont']['cw'];
208
-      $wmax = $fstring->width*1000*$this->k;
209
-      $j=count($lines)-1;
210
-      $k=strlen($lines[$j]);
211
-         if(!isset($linesmap[$j][0])) {
212
-         $linesmap[$j]=array($p,$p, 0);
213
-      }
214
-      $sl=$cw[' ']*$cfty['font-size'];
215
-      $x=$a=$linesmap[$j][2];
216
-      if($k>0){
217
-         $x+=$sl;
218
-         $lines[$j].=' ';
219
-         $linesmap[$j][2]+=$sl;
220
-      }
221
-      $u=$p;
222
-      $t='';
223
-      $l=$p+$q;
224
-      $ftmp='';
225
-      for($i=$p; $i<$l; $i++){
198
+    private function setLines(&$fstring, $p, $q){
199
+        $parced_str=& $fstring->parced_str;
200
+        $lines=& $fstring->lines;
201
+        $linesmap=& $fstring->linesmap;
202
+        $cfty=$fstring->get_current_style($p);
203
+        $ffs=$cfty['font-family'] . $cfty['style'];
204
+        if(!isset($fstring->used_fonts[$ffs])){
205
+            $fstring->used_fonts[$ffs]=& $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
206
+        }
207
+        $cw=& $fstring->used_fonts[$ffs]['CurrentFont']['cw'];
208
+        $wmax = $fstring->width*1000*$this->k;
209
+        $j=count($lines)-1;
210
+        $k=strlen($lines[$j]);
211
+            if(!isset($linesmap[$j][0])) {
212
+            $linesmap[$j]=array($p,$p, 0);
213
+        }
214
+        $sl=$cw[' ']*$cfty['font-size'];
215
+        $x=$a=$linesmap[$j][2];
216
+        if($k>0){
217
+            $x+=$sl;
218
+            $lines[$j].=' ';
219
+            $linesmap[$j][2]+=$sl;
220
+        }
221
+        $u=$p;
222
+        $t='';
223
+        $l=$p+$q;
224
+        $ftmp='';
225
+        for($i=$p; $i<$l; $i++){
226 226
             if($ftmp!=$ffs){
227 227
             $cfty=$fstring->get_current_style($i);
228 228
             $ffs=$cfty['font-family'] . $cfty['style'];
229 229
             if(!isset($fstring->used_fonts[$ffs])){
230
-               $fstring->used_fonts[$ffs]=& $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
230
+                $fstring->used_fonts[$ffs]=& $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
231 231
             }
232 232
             $cw=& $fstring->used_fonts[$ffs]['CurrentFont']['cw'];
233 233
             $ftmp=$ffs;
234
-         }
235
-         $x+=$cw[$parced_str[$i]]*$cfty['font-size'];
236
-         if($x>$wmax){
234
+            }
235
+            $x+=$cw[$parced_str[$i]]*$cfty['font-size'];
236
+            if($x>$wmax){
237 237
             if($a>0){
238
-               $t=substr($parced_str,$p, $i-$p);
239
-               $lines[$j]=substr($lines[$j],0,$k);
240
-               $linesmap[$j][1]=$p-1;
241
-               $linesmap[$j][2]=$a;
242
-               $x-=($a+$sl);
243
-               $a=0;
244
-               $u=$p;
238
+                $t=substr($parced_str,$p, $i-$p);
239
+                $lines[$j]=substr($lines[$j],0,$k);
240
+                $linesmap[$j][1]=$p-1;
241
+                $linesmap[$j][2]=$a;
242
+                $x-=($a+$sl);
243
+                $a=0;
244
+                $u=$p;
245 245
             }
246 246
             else{
247
-               $x=$cw[$parced_str[$i]]*$cfty['font-size'];
248
-               $t='';
249
-               $u=$i;
247
+                $x=$cw[$parced_str[$i]]*$cfty['font-size'];
248
+                $t='';
249
+                $u=$i;
250 250
             }
251 251
             $j++;
252 252
             $lines[$j]=$t;
253 253
             $linesmap[$j]=array();
254 254
             $linesmap[$j][0]=$u;
255 255
             $linesmap[$j][2]=0;
256
-         }
257
-         $lines[$j].=$parced_str[$i];
258
-         $linesmap[$j][1]=$i;
259
-         $linesmap[$j][2]=$x;
260
-      }
261
-      return;
262
-   }
256
+            }
257
+            $lines[$j].=$parced_str[$i];
258
+            $linesmap[$j][1]=$i;
259
+            $linesmap[$j][2]=$x;
260
+        }
261
+        return;
262
+    }
263 263
 
264
-   public function &extMultiCell($font_family, $font_style, $font_size, $font_color, $w, $txt){
265
-      $result=array();
266
-      if($w==0){
267
-         return $result;
268
-      }
269
-      $this->current_font=array('font-family'=>$font_family, 'style'=>$font_style, 'font-size'=>$font_size, 'font-color'=>$font_color);
270
-      $fstring=new formatedString($txt, $w, $this->current_font);
271
-      $word='';
272
-      $p=0;
273
-      $i=0;
274
-      $n=strlen($fstring->parced_str);
275
-      while($i<$n){
276
-         $word.=$fstring->parced_str[$i];
277
-         if($fstring->parced_str[$i]=="\n" || $fstring->parced_str[$i]==' ' || $i==$n-1){
264
+    public function &extMultiCell($font_family, $font_style, $font_size, $font_color, $w, $txt){
265
+        $result=array();
266
+        if($w==0){
267
+            return $result;
268
+        }
269
+        $this->current_font=array('font-family'=>$font_family, 'style'=>$font_style, 'font-size'=>$font_size, 'font-color'=>$font_color);
270
+        $fstring=new formatedString($txt, $w, $this->current_font);
271
+        $word='';
272
+        $p=0;
273
+        $i=0;
274
+        $n=strlen($fstring->parced_str);
275
+        while($i<$n){
276
+            $word.=$fstring->parced_str[$i];
277
+            if($fstring->parced_str[$i]=="\n" || $fstring->parced_str[$i]==' ' || $i==$n-1){
278 278
             $word=trim($word);
279 279
             $this->setLines($fstring, $p, strlen($word));
280 280
             $p=$i+1;
281 281
             $word='';
282 282
             if($fstring->parced_str[$i]=="\n" && $i<$n-1){
283
-               $z=0;
284
-               $j=count($fstring->lines);
285
-               $fstring->lines[$j]='';
286
-               $fstring->linesmap[$j]=array();
283
+                $z=0;
284
+                $j=count($fstring->lines);
285
+                $fstring->lines[$j]='';
286
+                $fstring->linesmap[$j]=array();
287 287
             }
288
-         }
289
-         $i++;
290
-      }
291
-      if($n==0){
292
-         return $result;
293
-      }
294
-      $n=count($fstring->lines);
295
-         for($i=0; $i<$n; $i++){
296
-         $result[$i]=$fstring->break_by_style($i);
297
-      }
298
-      return $result;
299
-   }
288
+            }
289
+            $i++;
290
+        }
291
+        if($n==0){
292
+            return $result;
293
+        }
294
+        $n=count($fstring->lines);
295
+            for($i=0; $i<$n; $i++){
296
+            $result[$i]=$fstring->break_by_style($i);
297
+        }
298
+        return $result;
299
+    }
300 300
 
301
-   private function GetMixStringWidth($line){
302
-      $w = 0;
303
-      foreach($line['chunks'] as $i=>$chunk){
304
-         $t=0;
305
-         $cf=& $this->FontData($line['style'][$i]['font-family'], $line['style'][$i]['style'], $line['style'][$i]['font-size']);
306
-         $cw=& $cf['CurrentFont']['cw'];
307
-         $s=implode('', explode(' ',$chunk));
308
-         $l = strlen($s);
309
-         for($j=0;$j<$l;$j++){
301
+    private function GetMixStringWidth($line){
302
+        $w = 0;
303
+        foreach($line['chunks'] as $i=>$chunk){
304
+            $t=0;
305
+            $cf=& $this->FontData($line['style'][$i]['font-family'], $line['style'][$i]['style'], $line['style'][$i]['font-size']);
306
+            $cw=& $cf['CurrentFont']['cw'];
307
+            $s=implode('', explode(' ',$chunk));
308
+            $l = strlen($s);
309
+            for($j=0;$j<$l;$j++){
310 310
             $t+=$cw[$s[$j]];
311
-         }
312
-         $w+=$t*$line['style'][$i]['font-size'];
313
-      }
314
-      return $w;
315
-   }
311
+            }
312
+            $w+=$t*$line['style'][$i]['font-size'];
313
+        }
314
+        return $w;
315
+    }
316 316
 
317
-   public function CellBlock($w, $lh, &$lines, $align='J'){
318
-      if($w==0){
319
-         return;
320
-      }
321
-      $ctmp='';
322
-      $ftmp='';
323
-      foreach($lines as $i=>$line){
324
-         $k = $this->k;
325
-         if($this->y+$lh*$line['height']>$this->PageBreakTrigger){
317
+    public function CellBlock($w, $lh, &$lines, $align='J'){
318
+        if($w==0){
319
+            return;
320
+        }
321
+        $ctmp='';
322
+        $ftmp='';
323
+        foreach($lines as $i=>$line){
324
+            $k = $this->k;
325
+            if($this->y+$lh*$line['height']>$this->PageBreakTrigger){
326 326
             break;
327
-         }
328
-         $dx=0;
329
-         $dw=0;
330
-         if($line['width']!=0){
327
+            }
328
+            $dx=0;
329
+            $dw=0;
330
+            if($line['width']!=0){
331 331
             if($align=='R'){
332
-               $dx = $w-$line['width']/($this->k*1000);
332
+                $dx = $w-$line['width']/($this->k*1000);
333 333
             }
334 334
             elseif($align=='C'){
335
-               $dx = ($w-$line['width']/($this->k*1000))/2;
335
+                $dx = ($w-$line['width']/($this->k*1000))/2;
336 336
             }
337 337
             if($align=='J'){
338
-               $tmp=explode(' ', implode('',$line['chunks']));
339
-               $ns=count($tmp);
340
-               if($ns>1){
341
-                  $sx=implode('',$tmp);
342
-                  $delta=$this->GetMixStringWidth($line)/($this->k*1000);
343
-                  $dw=($w-$delta)*(1/($ns-1));
344
-               }
338
+                $tmp=explode(' ', implode('',$line['chunks']));
339
+                $ns=count($tmp);
340
+                if($ns>1){
341
+                    $sx=implode('',$tmp);
342
+                    $delta=$this->GetMixStringWidth($line)/($this->k*1000);
343
+                    $dw=($w-$delta)*(1/($ns-1));
344
+                }
345 345
             }
346
-         }
347
-         $xx=$this->x+$dx;
348
-         foreach($line['chunks'] as $tj=>$txt){
346
+            }
347
+            $xx=$this->x+$dx;
348
+            foreach($line['chunks'] as $tj=>$txt){
349 349
             $this->resetFont($line['style'][$tj]['font-family'], $line['style'][$tj]['style'], $line['style'][$tj]['font-size']);
350 350
             $this->resetColor($line['style'][$tj]['font-color'], 'T');
351 351
             $y=$this->y+0.5*$lh*$line['height'] +0.3*$line['height']/$this->k;
352 352
             if($dw){
353
-               $tmp=explode(' ', $txt);
354
-               foreach($tmp as $e=>$tt){
355
-                  if($e>0){
356
-                     $xx+=$dw;
357
-                     if($tt==''){
353
+                $tmp=explode(' ', $txt);
354
+                foreach($tmp as $e=>$tt){
355
+                    if($e>0){
356
+                        $xx+=$dw;
357
+                        if($tt==''){
358 358
                         continue;
359
-                     }
360
-                  }
361
-                  $this->Text($xx, $y, $tt);
362
-                     if($line['style'][$tj]['href']){
363
-                     $yr=$this->y+0.5*($lh*$line['height']-$line['height']/$this->k);
364
-                     $this->Link($xx, $yr, $this->GetStringWidth($txt),$line['height']/$this->k, $line['style'][$tj]['href']);
365
-                  }
366
-                  $xx+=$this->GetStringWidth($tt);
367
-               }
359
+                        }
360
+                    }
361
+                    $this->Text($xx, $y, $tt);
362
+                        if($line['style'][$tj]['href']){
363
+                        $yr=$this->y+0.5*($lh*$line['height']-$line['height']/$this->k);
364
+                        $this->Link($xx, $yr, $this->GetStringWidth($txt),$line['height']/$this->k, $line['style'][$tj]['href']);
365
+                    }
366
+                    $xx+=$this->GetStringWidth($tt);
367
+                }
368 368
             }
369 369
             else{
370
-               $this->Text($xx, $y, $txt);
371
-                  if($line['style'][$tj]['href']){
372
-                  $yr=$this->y+0.5*($lh*$line['height']-$line['height']/$this->k);
373
-                  $this->Link($xx, $yr, $this->GetStringWidth($txt),$line['height']/$this->k, $line['style'][$tj]['href']);
374
-               }
375
-               $xx+=$this->GetStringWidth($txt);
370
+                $this->Text($xx, $y, $txt);
371
+                    if($line['style'][$tj]['href']){
372
+                    $yr=$this->y+0.5*($lh*$line['height']-$line['height']/$this->k);
373
+                    $this->Link($xx, $yr, $this->GetStringWidth($txt),$line['height']/$this->k, $line['style'][$tj]['href']);
374
+                }
375
+                $xx+=$this->GetStringWidth($txt);
376
+            }
376 377
             }
377
-         }
378
-         unset($lines[$i]);
379
-         $this->y += $lh*$line['height'];
380
-      }
381
-   }
378
+            unset($lines[$i]);
379
+            $this->y += $lh*$line['height'];
380
+        }
381
+    }
382 382
    
383 383
 }
384 384
 ?>
Please login to merge, or discard this patch.
Spacing   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -10,152 +10,152 @@  discard block
 block discarded – undo
10 10
  include 'formatedstring.php';
11 11
  class exFPDF extends FPDF
12 12
  {
13
-    public function PageBreak(){
13
+    public function PageBreak() {
14 14
        return $this->PageBreakTrigger;
15 15
    }
16 16
 
17
-   public function current_font($c){
18
-      if($c=='family'){
17
+   public function current_font($c) {
18
+      if ($c == 'family') {
19 19
          return $this->FontFamily;
20 20
       }
21
-      elseif($c=='style'){
21
+      elseif ($c == 'style') {
22 22
          return $this->FontStyle;
23 23
       }
24
-      elseif($c=='size'){
24
+      elseif ($c == 'size') {
25 25
          return $this->FontSizePt;
26 26
       }
27 27
    }
28 28
 
29
-   public function get_color($c){
30
-      if($c=='fill'){
29
+   public function get_color($c) {
30
+      if ($c == 'fill') {
31 31
          return $this->FillColor;
32 32
       }
33
-      elseif($c=='text'){
33
+      elseif ($c == 'text') {
34 34
          return $this->TextColor;
35 35
       }
36 36
    }
37 37
 
38
-   public function get_page_width(){
38
+   public function get_page_width() {
39 39
       return $this->w;
40 40
    }
41 41
 
42
-   public function get_margin($c){
43
-      if($c=='l'){
42
+   public function get_margin($c) {
43
+      if ($c == 'l') {
44 44
          return $this->lMargin;
45 45
       }
46
-      elseif($c=='r'){
46
+      elseif ($c == 'r') {
47 47
          return $this->rMargin;
48 48
       }
49
-      elseif($c=='t'){
49
+      elseif ($c == 't') {
50 50
          return $this->tMargin;
51 51
       }
52 52
    }
53 53
 
54
-   public function get_linewidth(){
54
+   public function get_linewidth() {
55 55
       return $this->LineWidth;
56 56
    }
57 57
 
58
-   public function get_orientation(){
58
+   public function get_orientation() {
59 59
       return $this->CurOrientation;
60 60
    }
61
-   static private $hex=array('0'=>0,'1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7,'8'=>8,'9'=>9,
62
-   'A'=>10,'B'=>11,'C'=>12,'D'=>13,'E'=>14,'F'=>15);
61
+   static private $hex = array('0'=>0, '1'=>1, '2'=>2, '3'=>3, '4'=>4, '5'=>5, '6'=>6, '7'=>7, '8'=>8, '9'=>9,
62
+   'A'=>10, 'B'=>11, 'C'=>12, 'D'=>13, 'E'=>14, 'F'=>15);
63 63
 
64
-   public function is_rgb($str){
65
-      $a=true;
66
-      $tmp=explode(',', trim($str, ','));
67
-      foreach($tmp as $color){
68
-         if(!is_numeric($color) || $color<0 || $color>255){
69
-            $a=false;
64
+   public function is_rgb($str) {
65
+      $a = true;
66
+      $tmp = explode(',', trim($str, ','));
67
+      foreach ($tmp as $color) {
68
+         if (!is_numeric($color) || $color < 0 || $color > 255) {
69
+            $a = false;
70 70
             break;
71 71
          }
72 72
       }
73 73
       return $a;
74 74
    }
75 75
 
76
-   public function is_hex($str){
77
-      $a=true;
78
-      $str=strtoupper($str);
79
-      $n=strlen($str);
80
-      if(($n==7 || $n==4) && $str[0]=='#'){
81
-         for($i=1; $i<$n; $i++){
82
-            if(!isset(self::$hex[$str[$i]])){
83
-               $a=false;
76
+   public function is_hex($str) {
77
+      $a = true;
78
+      $str = strtoupper($str);
79
+      $n = strlen($str);
80
+      if (($n == 7 || $n == 4) && $str[0] == '#') {
81
+         for ($i = 1; $i < $n; $i++) {
82
+            if (!isset(self::$hex[$str[$i]])) {
83
+               $a = false;
84 84
                break;
85 85
             }
86 86
          }
87 87
       }
88
-      else{
89
-         $a=false;
88
+      else {
89
+         $a = false;
90 90
       }
91 91
       return $a;
92 92
    }
93 93
 
94
-   public function hextodec($str){
95
-      $result=array();
96
-      $str=strtoupper(substr($str,1));
97
-      $n=strlen($str);
98
-      for($i=0; $i<3; $i++){
99
-         if($n==6){
100
-            $result[$i]=self::$hex[$str[2*$i]]*16+self::$hex[$str[2*$i+1]];
94
+   public function hextodec($str) {
95
+      $result = array();
96
+      $str = strtoupper(substr($str, 1));
97
+      $n = strlen($str);
98
+      for ($i = 0; $i < 3; $i++) {
99
+         if ($n == 6) {
100
+            $result[$i] = self::$hex[$str[2 * $i]] * 16 + self::$hex[$str[2 * $i + 1]];
101 101
          }
102
-         else{
103
-            $result[$i]=self::$hex[$str[$i]]*16+self::$hex[$str[$i]];
102
+         else {
103
+            $result[$i] = self::$hex[$str[$i]] * 16 + self::$hex[$str[$i]];
104 104
          }
105 105
       }
106 106
       return $result;
107 107
    }
108
-   static private $options=array('F'=>'', 'T'=>'', 'D'=>'');
108
+   static private $options = array('F'=>'', 'T'=>'', 'D'=>'');
109 109
 
110
-   public function resetColor($str, $p='F'){
111
-      if(isset(self::$options[$p]) && self::$options[$p]!=$str){
112
-         self::$options[$p]=$str;
113
-         $array=array();
114
-         if($this->is_hex($str)){
115
-            $array=$this->hextodec($str);
110
+   public function resetColor($str, $p = 'F') {
111
+      if (isset(self::$options[$p]) && self::$options[$p] != $str) {
112
+         self::$options[$p] = $str;
113
+         $array = array();
114
+         if ($this->is_hex($str)) {
115
+            $array = $this->hextodec($str);
116 116
          }
117
-         elseif($this->is_rgb($str)){
118
-            $array=explode(',', trim($str, ','));
119
-            for($i=0; $i<3; $i++){
120
-               if(!isset($array[$i])){
121
-                  $array[$i]=0;
117
+         elseif ($this->is_rgb($str)) {
118
+            $array = explode(',', trim($str, ','));
119
+            for ($i = 0; $i < 3; $i++) {
120
+               if (!isset($array[$i])) {
121
+                  $array[$i] = 0;
122 122
                }
123 123
             }
124 124
          }
125
-         else{
126
-            $array=array(null, null, null);
127
-            $i=0;
128
-            $tmp=explode(' ', $str);
129
-            foreach($tmp as $c){
130
-               if(is_numeric($c)){
131
-                  $array[$i]=$c*256;
125
+         else {
126
+            $array = array(null, null, null);
127
+            $i = 0;
128
+            $tmp = explode(' ', $str);
129
+            foreach ($tmp as $c) {
130
+               if (is_numeric($c)) {
131
+                  $array[$i] = $c * 256;
132 132
                   $i++;
133 133
                }
134 134
             }
135 135
          }
136
-         if($p=='T'){
137
-            $this->SetTextColor($array[0],$array[1],$array[2]);
136
+         if ($p == 'T') {
137
+            $this->SetTextColor($array[0], $array[1], $array[2]);
138 138
          }
139
-         elseif($p=='D'){
140
-            $this->SetDrawColor($array[0],$array[1], $array[2]);
139
+         elseif ($p == 'D') {
140
+            $this->SetDrawColor($array[0], $array[1], $array[2]);
141 141
          }
142
-         elseif($p=='F'){
143
-            $this->SetFillColor($array[0],$array[1],$array[2]);
142
+         elseif ($p == 'F') {
143
+            $this->SetFillColor($array[0], $array[1], $array[2]);
144 144
          }
145 145
       }
146 146
    }
147
-   static private $font_def='';
147
+   static private $font_def = '';
148 148
 
149
-   public function resetFont($font_family, $font_style, $font_size){
150
-      if(self::$font_def!=$font_family .'-' . $font_style . '-' .$font_size){
151
-         self::$font_def=$font_family .'-' . $font_style . '-' .$font_size;
149
+   public function resetFont($font_family, $font_style, $font_size) {
150
+      if (self::$font_def != $font_family.'-'.$font_style.'-'.$font_size) {
151
+         self::$font_def = $font_family.'-'.$font_style.'-'.$font_size;
152 152
          $this->SetFont($font_family, $font_style, $font_size);
153 153
       }
154 154
    }
155 155
 
156
-   public function resetStaticData(){
157
-      self::$font_def='';
158
-      self::$options=array('F'=>'', 'T'=>'', 'D'=>'');
156
+   public function resetStaticData() {
157
+      self::$font_def = '';
158
+      self::$options = array('F'=>'', 'T'=>'', 'D'=>'');
159 159
    }
160 160
    /***********************************************************************
161 161
    *
@@ -164,219 +164,219 @@  discard block
 block discarded – undo
164 164
    ************************************************************************/
165 165
 
166 166
    private function &FontData($family, $style, $size){
167
-      if($family=='')
167
+      if ($family == '')
168 168
       $family = $this->FontFamily;
169 169
       else
170 170
       $family = strtolower($family);
171 171
       $style = strtoupper($style);
172
-      if(strpos($style,'U')!==false){
172
+      if (strpos($style, 'U') !== false) {
173 173
          $this->underline = true;
174
-         $style = str_replace('U','',$style);
174
+         $style = str_replace('U', '', $style);
175 175
       }
176
-      if($style=='IB')
176
+      if ($style == 'IB')
177 177
       $style = 'BI';
178 178
       $fontkey = $family.$style;
179
-      if(!isset($this->fonts[$fontkey])){
180
-         if($family=='arial')
179
+      if (!isset($this->fonts[$fontkey])) {
180
+         if ($family == 'arial')
181 181
          $family = 'helvetica';
182
-         if(in_array($family,$this->CoreFonts)){
183
-            if($family=='symbol' || $family=='zapfdingbats')
182
+         if (in_array($family, $this->CoreFonts)) {
183
+            if ($family == 'symbol' || $family == 'zapfdingbats')
184 184
             $style = '';
185 185
             $fontkey = $family.$style;
186
-            if(!isset($this->fonts[$fontkey]))
187
-            $this->AddFont($family,$style);
186
+            if (!isset($this->fonts[$fontkey]))
187
+            $this->AddFont($family, $style);
188 188
          }
189 189
          else
190 190
          $this->Error('Undefined font: '.$family.' '.$style);
191 191
       }
192
-      $result['FontSize'] = $size/$this->k;
193
-      $result['CurrentFont']=&$this->fonts[$fontkey];
192
+      $result['FontSize'] = $size / $this->k;
193
+      $result['CurrentFont'] = &$this->fonts[$fontkey];
194 194
       return $result;
195 195
    }
196 196
     
197 197
 
198
-   private function setLines(&$fstring, $p, $q){
199
-      $parced_str=& $fstring->parced_str;
200
-      $lines=& $fstring->lines;
201
-      $linesmap=& $fstring->linesmap;
202
-      $cfty=$fstring->get_current_style($p);
203
-      $ffs=$cfty['font-family'] . $cfty['style'];
204
-      if(!isset($fstring->used_fonts[$ffs])){
205
-         $fstring->used_fonts[$ffs]=& $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
198
+   private function setLines(&$fstring, $p, $q) {
199
+      $parced_str = & $fstring->parced_str;
200
+      $lines = & $fstring->lines;
201
+      $linesmap = & $fstring->linesmap;
202
+      $cfty = $fstring->get_current_style($p);
203
+      $ffs = $cfty['font-family'].$cfty['style'];
204
+      if (!isset($fstring->used_fonts[$ffs])) {
205
+         $fstring->used_fonts[$ffs] = & $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
206 206
       }
207
-      $cw=& $fstring->used_fonts[$ffs]['CurrentFont']['cw'];
208
-      $wmax = $fstring->width*1000*$this->k;
209
-      $j=count($lines)-1;
210
-      $k=strlen($lines[$j]);
211
-         if(!isset($linesmap[$j][0])) {
212
-         $linesmap[$j]=array($p,$p, 0);
207
+      $cw = & $fstring->used_fonts[$ffs]['CurrentFont']['cw'];
208
+      $wmax = $fstring->width * 1000 * $this->k;
209
+      $j = count($lines) - 1;
210
+      $k = strlen($lines[$j]);
211
+         if (!isset($linesmap[$j][0])) {
212
+         $linesmap[$j] = array($p, $p, 0);
213 213
       }
214
-      $sl=$cw[' ']*$cfty['font-size'];
215
-      $x=$a=$linesmap[$j][2];
216
-      if($k>0){
217
-         $x+=$sl;
218
-         $lines[$j].=' ';
219
-         $linesmap[$j][2]+=$sl;
214
+      $sl = $cw[' '] * $cfty['font-size'];
215
+      $x = $a = $linesmap[$j][2];
216
+      if ($k > 0) {
217
+         $x += $sl;
218
+         $lines[$j] .= ' ';
219
+         $linesmap[$j][2] += $sl;
220 220
       }
221
-      $u=$p;
222
-      $t='';
223
-      $l=$p+$q;
224
-      $ftmp='';
225
-      for($i=$p; $i<$l; $i++){
226
-            if($ftmp!=$ffs){
227
-            $cfty=$fstring->get_current_style($i);
228
-            $ffs=$cfty['font-family'] . $cfty['style'];
229
-            if(!isset($fstring->used_fonts[$ffs])){
230
-               $fstring->used_fonts[$ffs]=& $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
221
+      $u = $p;
222
+      $t = '';
223
+      $l = $p + $q;
224
+      $ftmp = '';
225
+      for ($i = $p; $i < $l; $i++) {
226
+            if ($ftmp != $ffs) {
227
+            $cfty = $fstring->get_current_style($i);
228
+            $ffs = $cfty['font-family'].$cfty['style'];
229
+            if (!isset($fstring->used_fonts[$ffs])) {
230
+               $fstring->used_fonts[$ffs] = & $this->FontData($cfty['font-family'], $cfty['style'], $cfty['font-size']);
231 231
             }
232
-            $cw=& $fstring->used_fonts[$ffs]['CurrentFont']['cw'];
233
-            $ftmp=$ffs;
232
+            $cw = & $fstring->used_fonts[$ffs]['CurrentFont']['cw'];
233
+            $ftmp = $ffs;
234 234
          }
235
-         $x+=$cw[$parced_str[$i]]*$cfty['font-size'];
236
-         if($x>$wmax){
237
-            if($a>0){
238
-               $t=substr($parced_str,$p, $i-$p);
239
-               $lines[$j]=substr($lines[$j],0,$k);
240
-               $linesmap[$j][1]=$p-1;
241
-               $linesmap[$j][2]=$a;
242
-               $x-=($a+$sl);
243
-               $a=0;
244
-               $u=$p;
235
+         $x += $cw[$parced_str[$i]] * $cfty['font-size'];
236
+         if ($x > $wmax) {
237
+            if ($a > 0) {
238
+               $t = substr($parced_str, $p, $i - $p);
239
+               $lines[$j] = substr($lines[$j], 0, $k);
240
+               $linesmap[$j][1] = $p - 1;
241
+               $linesmap[$j][2] = $a;
242
+               $x -= ($a + $sl);
243
+               $a = 0;
244
+               $u = $p;
245 245
             }
246
-            else{
247
-               $x=$cw[$parced_str[$i]]*$cfty['font-size'];
248
-               $t='';
249
-               $u=$i;
246
+            else {
247
+               $x = $cw[$parced_str[$i]] * $cfty['font-size'];
248
+               $t = '';
249
+               $u = $i;
250 250
             }
251 251
             $j++;
252
-            $lines[$j]=$t;
253
-            $linesmap[$j]=array();
254
-            $linesmap[$j][0]=$u;
255
-            $linesmap[$j][2]=0;
252
+            $lines[$j] = $t;
253
+            $linesmap[$j] = array();
254
+            $linesmap[$j][0] = $u;
255
+            $linesmap[$j][2] = 0;
256 256
          }
257
-         $lines[$j].=$parced_str[$i];
258
-         $linesmap[$j][1]=$i;
259
-         $linesmap[$j][2]=$x;
257
+         $lines[$j] .= $parced_str[$i];
258
+         $linesmap[$j][1] = $i;
259
+         $linesmap[$j][2] = $x;
260 260
       }
261 261
       return;
262 262
    }
263 263
 
264 264
    public function &extMultiCell($font_family, $font_style, $font_size, $font_color, $w, $txt){
265
-      $result=array();
266
-      if($w==0){
265
+      $result = array();
266
+      if ($w == 0) {
267 267
          return $result;
268 268
       }
269
-      $this->current_font=array('font-family'=>$font_family, 'style'=>$font_style, 'font-size'=>$font_size, 'font-color'=>$font_color);
270
-      $fstring=new formatedString($txt, $w, $this->current_font);
271
-      $word='';
272
-      $p=0;
273
-      $i=0;
274
-      $n=strlen($fstring->parced_str);
275
-      while($i<$n){
276
-         $word.=$fstring->parced_str[$i];
277
-         if($fstring->parced_str[$i]=="\n" || $fstring->parced_str[$i]==' ' || $i==$n-1){
278
-            $word=trim($word);
269
+      $this->current_font = array('font-family'=>$font_family, 'style'=>$font_style, 'font-size'=>$font_size, 'font-color'=>$font_color);
270
+      $fstring = new formatedString($txt, $w, $this->current_font);
271
+      $word = '';
272
+      $p = 0;
273
+      $i = 0;
274
+      $n = strlen($fstring->parced_str);
275
+      while ($i < $n) {
276
+         $word .= $fstring->parced_str[$i];
277
+         if ($fstring->parced_str[$i] == "\n" || $fstring->parced_str[$i] == ' ' || $i == $n - 1) {
278
+            $word = trim($word);
279 279
             $this->setLines($fstring, $p, strlen($word));
280
-            $p=$i+1;
281
-            $word='';
282
-            if($fstring->parced_str[$i]=="\n" && $i<$n-1){
283
-               $z=0;
284
-               $j=count($fstring->lines);
285
-               $fstring->lines[$j]='';
286
-               $fstring->linesmap[$j]=array();
280
+            $p = $i + 1;
281
+            $word = '';
282
+            if ($fstring->parced_str[$i] == "\n" && $i < $n - 1) {
283
+               $z = 0;
284
+               $j = count($fstring->lines);
285
+               $fstring->lines[$j] = '';
286
+               $fstring->linesmap[$j] = array();
287 287
             }
288 288
          }
289 289
          $i++;
290 290
       }
291
-      if($n==0){
291
+      if ($n == 0) {
292 292
          return $result;
293 293
       }
294
-      $n=count($fstring->lines);
295
-         for($i=0; $i<$n; $i++){
296
-         $result[$i]=$fstring->break_by_style($i);
294
+      $n = count($fstring->lines);
295
+         for ($i = 0; $i < $n; $i++) {
296
+         $result[$i] = $fstring->break_by_style($i);
297 297
       }
298 298
       return $result;
299 299
    }
300 300
 
301
-   private function GetMixStringWidth($line){
301
+   private function GetMixStringWidth($line) {
302 302
       $w = 0;
303
-      foreach($line['chunks'] as $i=>$chunk){
304
-         $t=0;
305
-         $cf=& $this->FontData($line['style'][$i]['font-family'], $line['style'][$i]['style'], $line['style'][$i]['font-size']);
306
-         $cw=& $cf['CurrentFont']['cw'];
307
-         $s=implode('', explode(' ',$chunk));
303
+      foreach ($line['chunks'] as $i=>$chunk) {
304
+         $t = 0;
305
+         $cf = & $this->FontData($line['style'][$i]['font-family'], $line['style'][$i]['style'], $line['style'][$i]['font-size']);
306
+         $cw = & $cf['CurrentFont']['cw'];
307
+         $s = implode('', explode(' ', $chunk));
308 308
          $l = strlen($s);
309
-         for($j=0;$j<$l;$j++){
310
-            $t+=$cw[$s[$j]];
309
+         for ($j = 0; $j < $l; $j++) {
310
+            $t += $cw[$s[$j]];
311 311
          }
312
-         $w+=$t*$line['style'][$i]['font-size'];
312
+         $w += $t * $line['style'][$i]['font-size'];
313 313
       }
314 314
       return $w;
315 315
    }
316 316
 
317
-   public function CellBlock($w, $lh, &$lines, $align='J'){
318
-      if($w==0){
317
+   public function CellBlock($w, $lh, &$lines, $align = 'J') {
318
+      if ($w == 0) {
319 319
          return;
320 320
       }
321
-      $ctmp='';
322
-      $ftmp='';
323
-      foreach($lines as $i=>$line){
321
+      $ctmp = '';
322
+      $ftmp = '';
323
+      foreach ($lines as $i=>$line) {
324 324
          $k = $this->k;
325
-         if($this->y+$lh*$line['height']>$this->PageBreakTrigger){
325
+         if ($this->y + $lh * $line['height'] > $this->PageBreakTrigger) {
326 326
             break;
327 327
          }
328
-         $dx=0;
329
-         $dw=0;
330
-         if($line['width']!=0){
331
-            if($align=='R'){
332
-               $dx = $w-$line['width']/($this->k*1000);
328
+         $dx = 0;
329
+         $dw = 0;
330
+         if ($line['width'] != 0) {
331
+            if ($align == 'R') {
332
+               $dx = $w - $line['width'] / ($this->k * 1000);
333 333
             }
334
-            elseif($align=='C'){
335
-               $dx = ($w-$line['width']/($this->k*1000))/2;
334
+            elseif ($align == 'C') {
335
+               $dx = ($w - $line['width'] / ($this->k * 1000)) / 2;
336 336
             }
337
-            if($align=='J'){
338
-               $tmp=explode(' ', implode('',$line['chunks']));
339
-               $ns=count($tmp);
340
-               if($ns>1){
341
-                  $sx=implode('',$tmp);
342
-                  $delta=$this->GetMixStringWidth($line)/($this->k*1000);
343
-                  $dw=($w-$delta)*(1/($ns-1));
337
+            if ($align == 'J') {
338
+               $tmp = explode(' ', implode('', $line['chunks']));
339
+               $ns = count($tmp);
340
+               if ($ns > 1) {
341
+                  $sx = implode('', $tmp);
342
+                  $delta = $this->GetMixStringWidth($line) / ($this->k * 1000);
343
+                  $dw = ($w - $delta) * (1 / ($ns - 1));
344 344
                }
345 345
             }
346 346
          }
347
-         $xx=$this->x+$dx;
348
-         foreach($line['chunks'] as $tj=>$txt){
347
+         $xx = $this->x + $dx;
348
+         foreach ($line['chunks'] as $tj=>$txt) {
349 349
             $this->resetFont($line['style'][$tj]['font-family'], $line['style'][$tj]['style'], $line['style'][$tj]['font-size']);
350 350
             $this->resetColor($line['style'][$tj]['font-color'], 'T');
351
-            $y=$this->y+0.5*$lh*$line['height'] +0.3*$line['height']/$this->k;
352
-            if($dw){
353
-               $tmp=explode(' ', $txt);
354
-               foreach($tmp as $e=>$tt){
355
-                  if($e>0){
356
-                     $xx+=$dw;
357
-                     if($tt==''){
351
+            $y = $this->y + 0.5 * $lh * $line['height'] + 0.3 * $line['height'] / $this->k;
352
+            if ($dw) {
353
+               $tmp = explode(' ', $txt);
354
+               foreach ($tmp as $e=>$tt) {
355
+                  if ($e > 0) {
356
+                     $xx += $dw;
357
+                     if ($tt == '') {
358 358
                         continue;
359 359
                      }
360 360
                   }
361 361
                   $this->Text($xx, $y, $tt);
362
-                     if($line['style'][$tj]['href']){
363
-                     $yr=$this->y+0.5*($lh*$line['height']-$line['height']/$this->k);
364
-                     $this->Link($xx, $yr, $this->GetStringWidth($txt),$line['height']/$this->k, $line['style'][$tj]['href']);
362
+                     if ($line['style'][$tj]['href']) {
363
+                     $yr = $this->y + 0.5 * ($lh * $line['height'] - $line['height'] / $this->k);
364
+                     $this->Link($xx, $yr, $this->GetStringWidth($txt), $line['height'] / $this->k, $line['style'][$tj]['href']);
365 365
                   }
366
-                  $xx+=$this->GetStringWidth($tt);
366
+                  $xx += $this->GetStringWidth($tt);
367 367
                }
368 368
             }
369
-            else{
369
+            else {
370 370
                $this->Text($xx, $y, $txt);
371
-                  if($line['style'][$tj]['href']){
372
-                  $yr=$this->y+0.5*($lh*$line['height']-$line['height']/$this->k);
373
-                  $this->Link($xx, $yr, $this->GetStringWidth($txt),$line['height']/$this->k, $line['style'][$tj]['href']);
371
+                  if ($line['style'][$tj]['href']) {
372
+                  $yr = $this->y + 0.5 * ($lh * $line['height'] - $line['height'] / $this->k);
373
+                  $this->Link($xx, $yr, $this->GetStringWidth($txt), $line['height'] / $this->k, $line['style'][$tj]['href']);
374 374
                }
375
-               $xx+=$this->GetStringWidth($txt);
375
+               $xx += $this->GetStringWidth($txt);
376 376
             }
377 377
          }
378 378
          unset($lines[$i]);
379
-         $this->y += $lh*$line['height'];
379
+         $this->y += $lh * $line['height'];
380 380
       }
381 381
    }
382 382
    
Please login to merge, or discard this patch.
Braces   +33 added lines, -42 removed lines patch added patch discarded remove patch
@@ -17,11 +17,9 @@  discard block
 block discarded – undo
17 17
    public function current_font($c){
18 18
       if($c=='family'){
19 19
          return $this->FontFamily;
20
-      }
21
-      elseif($c=='style'){
20
+      } elseif($c=='style'){
22 21
          return $this->FontStyle;
23
-      }
24
-      elseif($c=='size'){
22
+      } elseif($c=='size'){
25 23
          return $this->FontSizePt;
26 24
       }
27 25
    }
@@ -29,8 +27,7 @@  discard block
 block discarded – undo
29 27
    public function get_color($c){
30 28
       if($c=='fill'){
31 29
          return $this->FillColor;
32
-      }
33
-      elseif($c=='text'){
30
+      } elseif($c=='text'){
34 31
          return $this->TextColor;
35 32
       }
36 33
    }
@@ -42,11 +39,9 @@  discard block
 block discarded – undo
42 39
    public function get_margin($c){
43 40
       if($c=='l'){
44 41
          return $this->lMargin;
45
-      }
46
-      elseif($c=='r'){
42
+      } elseif($c=='r'){
47 43
          return $this->rMargin;
48
-      }
49
-      elseif($c=='t'){
44
+      } elseif($c=='t'){
50 45
          return $this->tMargin;
51 46
       }
52 47
    }
@@ -84,8 +79,7 @@  discard block
 block discarded – undo
84 79
                break;
85 80
             }
86 81
          }
87
-      }
88
-      else{
82
+      } else{
89 83
          $a=false;
90 84
       }
91 85
       return $a;
@@ -98,8 +92,7 @@  discard block
 block discarded – undo
98 92
       for($i=0; $i<3; $i++){
99 93
          if($n==6){
100 94
             $result[$i]=self::$hex[$str[2*$i]]*16+self::$hex[$str[2*$i+1]];
101
-         }
102
-         else{
95
+         } else{
103 96
             $result[$i]=self::$hex[$str[$i]]*16+self::$hex[$str[$i]];
104 97
          }
105 98
       }
@@ -113,16 +106,14 @@  discard block
 block discarded – undo
113 106
          $array=array();
114 107
          if($this->is_hex($str)){
115 108
             $array=$this->hextodec($str);
116
-         }
117
-         elseif($this->is_rgb($str)){
109
+         } elseif($this->is_rgb($str)){
118 110
             $array=explode(',', trim($str, ','));
119 111
             for($i=0; $i<3; $i++){
120 112
                if(!isset($array[$i])){
121 113
                   $array[$i]=0;
122 114
                }
123 115
             }
124
-         }
125
-         else{
116
+         } else{
126 117
             $array=array(null, null, null);
127 118
             $i=0;
128 119
             $tmp=explode(' ', $str);
@@ -135,11 +126,9 @@  discard block
 block discarded – undo
135 126
          }
136 127
          if($p=='T'){
137 128
             $this->SetTextColor($array[0],$array[1],$array[2]);
138
-         }
139
-         elseif($p=='D'){
129
+         } elseif($p=='D'){
140 130
             $this->SetDrawColor($array[0],$array[1], $array[2]);
141
-         }
142
-         elseif($p=='F'){
131
+         } elseif($p=='F'){
143 132
             $this->SetFillColor($array[0],$array[1],$array[2]);
144 133
          }
145 134
       }
@@ -164,30 +153,35 @@  discard block
 block discarded – undo
164 153
    ************************************************************************/
165 154
 
166 155
    private function &FontData($family, $style, $size){
167
-      if($family=='')
168
-      $family = $this->FontFamily;
169
-      else
170
-      $family = strtolower($family);
156
+      if($family=='') {
157
+            $family = $this->FontFamily;
158
+      } else {
159
+            $family = strtolower($family);
160
+      }
171 161
       $style = strtoupper($style);
172 162
       if(strpos($style,'U')!==false){
173 163
          $this->underline = true;
174 164
          $style = str_replace('U','',$style);
175 165
       }
176
-      if($style=='IB')
177
-      $style = 'BI';
166
+      if($style=='IB') {
167
+            $style = 'BI';
168
+      }
178 169
       $fontkey = $family.$style;
179 170
       if(!isset($this->fonts[$fontkey])){
180
-         if($family=='arial')
181
-         $family = 'helvetica';
171
+         if($family=='arial') {
172
+                  $family = 'helvetica';
173
+         }
182 174
          if(in_array($family,$this->CoreFonts)){
183
-            if($family=='symbol' || $family=='zapfdingbats')
184
-            $style = '';
175
+            if($family=='symbol' || $family=='zapfdingbats') {
176
+                        $style = '';
177
+            }
185 178
             $fontkey = $family.$style;
186
-            if(!isset($this->fonts[$fontkey]))
187
-            $this->AddFont($family,$style);
179
+            if(!isset($this->fonts[$fontkey])) {
180
+                        $this->AddFont($family,$style);
181
+            }
182
+         } else {
183
+                  $this->Error('Undefined font: '.$family.' '.$style);
188 184
          }
189
-         else
190
-         $this->Error('Undefined font: '.$family.' '.$style);
191 185
       }
192 186
       $result['FontSize'] = $size/$this->k;
193 187
       $result['CurrentFont']=&$this->fonts[$fontkey];
@@ -242,8 +236,7 @@  discard block
 block discarded – undo
242 236
                $x-=($a+$sl);
243 237
                $a=0;
244 238
                $u=$p;
245
-            }
246
-            else{
239
+            } else{
247 240
                $x=$cw[$parced_str[$i]]*$cfty['font-size'];
248 241
                $t='';
249 242
                $u=$i;
@@ -330,8 +323,7 @@  discard block
 block discarded – undo
330 323
          if($line['width']!=0){
331 324
             if($align=='R'){
332 325
                $dx = $w-$line['width']/($this->k*1000);
333
-            }
334
-            elseif($align=='C'){
326
+            } elseif($align=='C'){
335 327
                $dx = ($w-$line['width']/($this->k*1000))/2;
336 328
             }
337 329
             if($align=='J'){
@@ -365,8 +357,7 @@  discard block
 block discarded – undo
365 357
                   }
366 358
                   $xx+=$this->GetStringWidth($tt);
367 359
                }
368
-            }
369
-            else{
360
+            } else{
370 361
                $this->Text($xx, $y, $txt);
371 362
                   if($line['style'][$tj]['href']){
372 363
                   $yr=$this->y+0.5*($lh*$line['height']-$line['height']/$this->k);
Please login to merge, or discard this patch.
extras/fpdf183/ResidentesFpdf.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function setPdfLogo()
57 57
     {
58
-        if (!file_exists(FS_MYDOCS . 'images') && !mkdir($concurrentDirectory = FS_MYDOCS . 'images', 0777, true) && !is_dir($concurrentDirectory)) {
58
+        if (!file_exists(FS_MYDOCS.'images') && !mkdir($concurrentDirectory = FS_MYDOCS.'images', 0777, true) && !is_dir($concurrentDirectory)) {
59 59
             throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
60 60
         }
61 61
 
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
          * Antes se guardaba el logo en el temporal.
64 64
          * Mala decisión, lo movemos.
65 65
          */
66
-        if (file_exists('tmp/' . FS_TMP_NAME . 'logo.png')) {
67
-            rename('tmp/' . FS_TMP_NAME . 'logo.png', FS_MYDOCS . 'images/logo.png');
68
-        } elseif (file_exists('tmp/' . FS_TMP_NAME . 'logo.jpg')) {
69
-            rename('tmp/' . FS_TMP_NAME . 'logo.jpg', FS_MYDOCS . 'images/logo.jpg');
66
+        if (file_exists('tmp/'.FS_TMP_NAME.'logo.png')) {
67
+            rename('tmp/'.FS_TMP_NAME.'logo.png', FS_MYDOCS.'images/logo.png');
68
+        } elseif (file_exists('tmp/'.FS_TMP_NAME.'logo.jpg')) {
69
+            rename('tmp/'.FS_TMP_NAME.'logo.jpg', FS_MYDOCS.'images/logo.jpg');
70 70
         }
71 71
 
72 72
         $this->logo = false;
73
-        if (file_exists(FS_MYDOCS . 'images/logo.png')) {
74
-            $this->logo = FS_MYDOCS . 'images/logo.png';
75
-        } elseif (file_exists(FS_MYDOCS . 'images/logo.jpg')) {
76
-            $this->logo = FS_MYDOCS . 'images/logo.jpg';
73
+        if (file_exists(FS_MYDOCS.'images/logo.png')) {
74
+            $this->logo = FS_MYDOCS.'images/logo.png';
75
+        } elseif (file_exists(FS_MYDOCS.'images/logo.jpg')) {
76
+            $this->logo = FS_MYDOCS.'images/logo.jpg';
77 77
         }
78 78
         if ($this->logo) {
79 79
             $this->Image($this->logo, 5, 5, 30);
@@ -91,24 +91,24 @@  discard block
 block discarded – undo
91 91
         $this->SetXY(140, $localTopLine);
92 92
         $this->Cell(60, 8, $documentHeader['codigo'], 0, 0, 'C');
93 93
         $localHeight += 4;
94
-        $this->SetXY(140, $localTopLine+($localSpaceBetweenLine*$localLine));
94
+        $this->SetXY(140, $localTopLine + ($localSpaceBetweenLine * $localLine));
95 95
         $this->Cell(60, 8, $documentHeader['numero2'], 0, 0, 'C');
96 96
         $localHeight += 4;
97 97
         $localLine++;
98
-        $this->SetXY(140, $localTopLine+($localSpaceBetweenLine*$localLine));
98
+        $this->SetXY(140, $localTopLine + ($localSpaceBetweenLine * $localLine));
99 99
         if (isset($documentHeader['tiponcf'])) {
100 100
             $this->Cell(60, 8, $documentHeader['tiponcf'], 0, 0, 'C');
101 101
             $localHeight += 4;
102 102
             $localLine++;
103
-            $this->SetXY(140, $localTopLine+($localSpaceBetweenLine*$localLine));
103
+            $this->SetXY(140, $localTopLine + ($localSpaceBetweenLine * $localLine));
104 104
             if (substr($documentHeader['numero2'], -10, 2) !== '02') {
105 105
                 $this->Cell(60, 8, "Valido hasta el: ".$documentHeader['vencimientoncf'], 0, 0, 'C');
106 106
                 $localHeight += 4;
107 107
                 $localLine++;
108
-                $this->SetXY(140, $localTopLine*$localSpaceBetweenLine*$localLine);
108
+                $this->SetXY(140, $localTopLine * $localSpaceBetweenLine * $localLine);
109 109
             }
110 110
         }
111
-        $this->Cell(60, 8, "Fecha: " . $documentHeader['fecha'], 0, 0, 'C');
111
+        $this->Cell(60, 8, "Fecha: ".$documentHeader['fecha'], 0, 0, 'C');
112 112
         $localHeight += 4;
113 113
         $this->Rect(140, $localTopLine, 60, $localHeight, "D");
114 114
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         // Subtotal, Impuestos y Total
123 123
         $number_to_words = new NumberToLetterConverter();
124 124
         $words = $number_to_words->to_word($documentFooter['neto'], 'DOP');
125
-        $subtotal = "Son: " . $words;
125
+        $subtotal = "Son: ".$words;
126 126
         $this->SetFont($this->font, '', 8);
127 127
         $this->SetXY($x, $y);
128 128
         $this->Cell(95, 8, $subtotal, 0, 0, 'L');
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
 
134 134
         // trait vertical cadre totaux, 8 de hauteur -> 213 + 8 = 221
135 135
         $this->SetFont($this->font, 'B', 8);
136
-        $this->Rect($x, $y+6, 95, 6, "D");
136
+        $this->Rect($x, $y + 6, 95, 6, "D");
137 137
         // Forma de Pago
138
-        $this->SetXY($x, $y+6);
138
+        $this->SetXY($x, $y + 6);
139 139
         $this->Cell(38, 5, "Forma de Pago:", 0, 0, 'L');
140 140
         $this->Cell(55, 5, utf8_decode($documentFooter['codpago']), 0, 0, 'L');
141 141
         // Fecha de Vencimiento
142 142
         //$date_ech = date_format($documentFooter['vencimiento'], 'd/m/Y');
143 143
 
144
-        $this->Rect($x, $y+12, 95, 6, "D");
145
-        $this->SetXY($x, $y+12);
144
+        $this->Rect($x, $y + 12, 95, 6, "D");
145
+        $this->SetXY($x, $y + 12);
146 146
         $this->Cell(38, 5, "Fecha de Vencimiento:", 0, 0, 'R');
147 147
         $this->Cell(38, 5, $documentFooter['vencimiento'], 0, 0, 'L');
148 148
 
149 149
         $this->SetFont($this->font, "BU", 8);
150
-        $this->SetXY($x, $y+30);
150
+        $this->SetXY($x, $y + 30);
151 151
         $this->Cell($this->GetStringWidth("Observaciones"), 0, "Observaciones", 0, "L");
152 152
         $this->SetFont($this->font, "", 8);
153
-        $this->SetXY($x, $y+35);
153
+        $this->SetXY($x, $y + 35);
154 154
         $this->MultiCell(190, 4, utf8_decode($documentFooter['observaciones']), 0, "L");
155 155
         //$y += 5;
156 156
         $this->setDocumentFooterTotalsBase($x, $y);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     {
171 171
         $x += 130;
172 172
         $this->SetLineWidth(0.1);
173
-        $this->Rect($x, $y, 60, (5*5), "D");
173
+        $this->Rect($x, $y, 60, (5 * 5), "D");
174 174
 //        // Lineas Verticales
175 175
 //        $this->Line(147, 221, 147, 245);
176 176
 //        $this->Line(164, 221, 164, 245);
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
         $this->SetFont($this->font, 'B', 8);
184 184
         $this->SetXY($x, $y);
185 185
         $this->Cell(30, 6, "Importe", 0, 0, 'R');
186
-        $this->SetXY($x, $y+5);
186
+        $this->SetXY($x, $y + 5);
187 187
         $this->Cell(30, 6, "Descuento", 0, 0, 'R');
188
-        $this->SetXY($x, $y+10);
188
+        $this->SetXY($x, $y + 10);
189 189
         $this->Cell(30, 6, "Subtotal", 0, 0, 'R');
190
-        $this->SetXY($x, $y+15);
190
+        $this->SetXY($x, $y + 15);
191 191
         $this->Cell(30, 6, FS_IVA, 0, 0, 'R');
192
-        $this->SetXY($x, $y+20);
192
+        $this->SetXY($x, $y + 20);
193 193
         $this->Cell(30, 6, "Total", 0, 0, 'R');
194 194
     }
195 195
 
@@ -202,21 +202,21 @@  discard block
 block discarded – undo
202 202
         $taux = $documentFooter['neto'];
203 203
 
204 204
         $totalDescuento = number_format($documentFooter['total_descuento'], FS_NF0, FS_NF1, FS_NF2);
205
-        $this->SetXY($x, $y+5);
205
+        $this->SetXY($x, $y + 5);
206 206
         $this->Cell(30, 6, $totalDescuento, 0, 0, 'R');
207 207
 
208 208
         $col_ht = $documentFooter['totaliva'];
209
-        $col_tva = $col_ht - ($col_ht * (1-($taux/100)));
209
+        $col_tva = $col_ht - ($col_ht * (1 - ($taux / 100)));
210 210
         $totalImpuesto = number_format($col_tva, FS_NF0, FS_NF1, FS_NF2);
211 211
         $totalNeto = number_format($documentFooter['neto'], FS_NF0, FS_NF1, FS_NF2);
212
-        $this->SetXY($x, $y+10);
212
+        $this->SetXY($x, $y + 10);
213 213
         $this->Cell(30, 6, $totalNeto, 0, 0, 'R');
214
-        $this->SetXY($x, $y+15);
214
+        $this->SetXY($x, $y + 15);
215 215
         $this->Cell(30, 6, $totalImpuesto, 0, 0, 'R');
216 216
 
217 217
         $col_ttc = $documentFooter['total'];
218 218
         $totalGeneral = number_format($col_ttc, 2, ',', ' ');
219
-        $this->SetXY($x, $y+20);
219
+        $this->SetXY($x, $y + 20);
220 220
         $this->Cell(30, 6, $totalGeneral, 0, 0, 'R');
221 221
     }
222 222
 
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
         $this->SetFont($this->font, 'B', 8);
227 227
         $this->SetXY($x, $y);
228 228
         $this->Cell(25, 8, utf8_decode("Residente:"), 0, 0, 'R');
229
-        $this->SetXY($x+100, $y);
229
+        $this->SetXY($x + 100, $y);
230 230
         $this->Cell(25, 8, utf8_decode($tipoDocumentoFiscal.":"), 0, 0, 'R');
231 231
         $y += 4;
232 232
         $this->SetXY($x, $y);
233 233
         $this->Cell(25, 8, utf8_decode("Dirección:"), 0, 0, 'R');
234
-        $this->SetXY($x+100, $y);
234
+        $this->SetXY($x + 100, $y);
235 235
         $this->Cell(25, 8, utf8_decode("Teléfono:"), 0, 0, 'R');
236 236
         $y += 4;
237 237
         $this->SetXY($x, $y);
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
     public function setDocumentLinesHeader($x, $y)
269 269
     {
270 270
         $this->SetLineWidth(0.1);
271
-        $this->Rect(10, $y, 190, ($this->max_lines*7), "D");
272
-        $this->Line(10, $y+5, 200, $y+5);
271
+        $this->Rect(10, $y, 190, ($this->max_lines * 7), "D");
272
+        $this->Line(10, $y + 5, 200, $y + 5);
273 273
         //Lineas Verticales
274 274
         $arrayLineas = [105, 120, 140, 160, 180];
275 275
         foreach ($arrayLineas as $lineaX) {
276
-                $this->Line($lineaX, $y, $lineaX, $y+($this->max_lines*7));
276
+                $this->Line($lineaX, $y, $lineaX, $y + ($this->max_lines * 7));
277 277
         }
278 278
         $arrayDatosLineas = ["Descripción", "Cantidad", "Precio", "Descuento", FS_IVA, "Importe"];
279 279
         $arrayAnchoLineas = [95, 15, 20, 20, 20, 20];
@@ -300,34 +300,34 @@  discard block
 block discarded – undo
300 300
         $linesSubtotal = 0;
301 301
         for ($i; $i < ($pageNumber * $this->max_lines); $i++) {
302 302
             if (isset($documentLines[$i])) {
303
-                $this->SetXY($x, $y+5);
303
+                $this->SetXY($x, $y + 5);
304 304
                 $line = $documentLines[$i];
305 305
                 $linesSubtotal += $line['pvptotal'];
306 306
                 $this->Cell(95, 5, utf8_decode($line['descripcion']), 0, 0, 'L');
307 307
                 // qte
308
-                $this->SetXY(105, $y+6);
308
+                $this->SetXY(105, $y + 6);
309 309
                 $this->Cell(15, 5, strrev(wordwrap(strrev($line['cantidad']), 3, ' ', true)), 0, 0, 'R');
310 310
                 // PU
311 311
                 $numero_formateado = number_format($line['pvpunitario'], FS_NF0, FS_NF1, FS_NF2);
312
-                $this->SetXY(120, $y+6);
312
+                $this->SetXY(120, $y + 6);
313 313
                 $this->Cell(20, 5, $numero_formateado, 0, 0, 'R');
314 314
                 //Descuento
315 315
                 $numero_formateado = number_format(($line['pvpsindto'] - $line['pvptotal']), FS_NF0, FS_NF1, FS_NF2);
316
-                $this->SetXY(140, $y+6);
316
+                $this->SetXY(140, $y + 6);
317 317
                 $this->Cell(20, 5, $numero_formateado, 0, 0, 'R');
318 318
                 // Impuesto
319 319
                 $numero_formateado = number_format($line['iva'], FS_NF0, FS_NF1, FS_NF2);
320
-                $this->SetXY(160, $y+6);
320
+                $this->SetXY(160, $y + 6);
321 321
                 $this->Cell(20, 5, $numero_formateado, 0, 0, 'R');
322 322
                 // total
323 323
                 $numero_formateado = number_format($line['pvptotal'], FS_NF0, FS_NF1, FS_NF2);
324
-                $this->SetXY(180, $y+6);
324
+                $this->SetXY(180, $y + 6);
325 325
                 $this->Cell(20, 5, $numero_formateado, 0, 0, 'R');
326 326
                 //$this->Line($x, $y+13, 200, $y+13);
327 327
                 $y += 6;
328 328
             }
329 329
         }
330
-        $this->setDocumentLinesSubtotal($linesSubtotal, $pageNumber, $numberOfPages, $x, ($y+($this->max_lines)));
330
+        $this->setDocumentLinesSubtotal($linesSubtotal, $pageNumber, $numberOfPages, $x, ($y + ($this->max_lines)));
331 331
         $this->setDocumentPageNumber($pageNumber, $numberOfPages);
332 332
     }
333 333
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             $this->SetFont($this->font, '', 8);
341 341
             $this->SetXY($x, $y);
342 342
             $this->Cell(30, 6, utf8_decode("Subtotal página: "), 0, 0, 'R');
343
-            $this->SetXY($x+30, $y);
343
+            $this->SetXY($x + 30, $y);
344 344
             $this->Cell(30, 6, number_format($linesSubtotal, FS_NF0, FS_NF1, FS_NF2), 0, 0, 'R');
345 345
         }
346 346
     }
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
     public function setDocumentPageNumber($pageNumber, $numberOfPages)
349 349
     {
350 350
         $x = $this->GetPageHeight();
351
-        $y = $this->GetPageWidth()-70;
351
+        $y = $this->GetPageWidth() - 70;
352 352
         //print_r($x);
353 353
         $this->SetXY($x, $y);
354 354
         $this->SetFont($this->font, 'B', 7);
355
-        $this->Cell(52, 5, utf8_decode("Página " . $pageNumber . " de " . $numberOfPages), 0, 0, 'R');
355
+        $this->Cell(52, 5, utf8_decode("Página ".$pageNumber." de ".$numberOfPages), 0, 0, 'R');
356 356
     }
357 357
 
358 358
     public function setCompanyInfo($companyInfo)
@@ -375,24 +375,24 @@  discard block
 block discarded – undo
375 375
         $this->Cell($this->GetPageWidth(), 5, utf8_decode($companyInfo['telefono']), 0, 0, 'L');
376 376
         $localLineHeight += 4;
377 377
         $this->SetXY($x1, $y1 + $localLineHeight);
378
-        $this->Cell($this->GetPageWidth(), 5, utf8_decode($companyInfo['web']) . ' - ' .
378
+        $this->Cell($this->GetPageWidth(), 5, utf8_decode($companyInfo['web']).' - '.
379 379
                         utf8_decode($companyInfo['email']), 0, 0, 'L');
380 380
     }
381 381
 
382 382
     public function createDocument($companyInformation, $documentHeader, $documentLines, $customerInfo)
383 383
     {
384
-        $numberOfPages = (int) ceil(count($documentLines)/$this->max_lines);
384
+        $numberOfPages = (int) ceil(count($documentLines) / $this->max_lines);
385 385
 //        var_dump($this->max_lines);
386 386
 //        var_dump(count($documentLines));
387 387
 //        var_dump($numberOfPages);
388
-        for ($pageNumber=0; $pageNumber < $numberOfPages; $pageNumber++) {
388
+        for ($pageNumber = 0; $pageNumber < $numberOfPages; $pageNumber++) {
389 389
             $this->AddPage();
390 390
             $this->setPdfLogo();
391 391
             $this->setCompanyInfo($companyInformation);
392 392
             $this->setPdfCustomerInfo($customerInfo);
393 393
             $this->setDocumentHeaderInfo($documentHeader);
394
-            $this->setDocumentLinesInfo($documentLines, $pageNumber+1, $numberOfPages);
395
-            if ($pageNumber === ($numberOfPages-1)) {
394
+            $this->setDocumentLinesInfo($documentLines, $pageNumber + 1, $numberOfPages);
395
+            if ($pageNumber === ($numberOfPages - 1)) {
396 396
                 $this->setDocumentFooterInfo($documentHeader);
397 397
                 $this->setDocumentFooterCompanyText($companyInformation['pie_factura']);
398 398
             }
Please login to merge, or discard this patch.
extras/fpdf183/formatedstring.php 3 patches
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /**********************************************************************
2
+    /**********************************************************************
3 3
  * formateString                                                       *
4 4
  *                                                                     *
5 5
  * Version: 1.2                                                        *
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * Author:  Dan Machado                                                *
8 8
  * Use within exfpdf class                                             *
9 9
  **********************************************************************/
10
- class formatedString
11
- {
10
+    class formatedString
11
+    {
12 12
     public $parced_str;
13 13
     public $style_map;
14 14
     public $positions;
@@ -20,191 +20,191 @@  discard block
 block discarded – undo
20 20
     public $used_fonts;
21 21
 
22 22
     private function get_style($str){
23
-       $style=array('font-family'=>false, 'font-weight'=>false, 'font-style'=>false,
24
-       'font-size'=>false, 'font-color'=>false, 'href'=>'');
25
-       $tmp=explode(';', trim($str, '",\', '));
26
-       foreach($tmp as $x){
27
-          if($x && strpos($x,':')>0){
28
-             $r=explode(':',$x);
29
-             $r[0]=trim($r[0]);
30
-             $r[1]=trim($r[1]);
31
-             if(isset($style[$r[0]]) || $r[0]=='style'){
23
+        $style=array('font-family'=>false, 'font-weight'=>false, 'font-style'=>false,
24
+        'font-size'=>false, 'font-color'=>false, 'href'=>'');
25
+        $tmp=explode(';', trim($str, '",\', '));
26
+        foreach($tmp as $x){
27
+            if($x && strpos($x,':')>0){
28
+                $r=explode(':',$x);
29
+                $r[0]=trim($r[0]);
30
+                $r[1]=trim($r[1]);
31
+                if(isset($style[$r[0]]) || $r[0]=='style'){
32 32
                 if($r[0]=='style' || $r[0]=='font-style'){
33
-                   $r[1]=strtoupper($r[1]);
34
-                   if(strpos($r[1], 'B')!==false){
35
-                      $style['font-weight']='B';
36
-                  }
37
-                  if(strpos($r[1], 'I')!==false){
38
-                     $style['font-style']='I';
39
-                  }
40
-                  if(strpos($r[1], 'U')!==false){
41
-                     $style['font-style'].='U';
42
-                  }
43
-               }
44
-               elseif($r[1]){
45
-                  if($r[0]=='href'){
46
-                     $style[$r[0]]=implode(':', array_slice($r,1));
47
-                  }
48
-                  else{
49
-                     $style[$r[0]]=$r[1];
50
-                  }
51
-               }
33
+                    $r[1]=strtoupper($r[1]);
34
+                    if(strpos($r[1], 'B')!==false){
35
+                        $style['font-weight']='B';
36
+                    }
37
+                    if(strpos($r[1], 'I')!==false){
38
+                        $style['font-style']='I';
39
+                    }
40
+                    if(strpos($r[1], 'U')!==false){
41
+                        $style['font-style'].='U';
42
+                    }
43
+                }
44
+                elseif($r[1]){
45
+                    if($r[0]=='href'){
46
+                        $style[$r[0]]=implode(':', array_slice($r,1));
47
+                    }
48
+                    else{
49
+                        $style[$r[0]]=$r[1];
50
+                    }
51
+                }
52 52
             }
53
-         }
54
-      }
55
-      return $style;
56
-   }
53
+            }
54
+        }
55
+        return $style;
56
+    }
57 57
     
58 58
 
59
-   private function style_merge($style1, $style2){
60
-      $result=$style1;
61
-      foreach($style2 as $k=>$v){
62
-         if($v){
59
+    private function style_merge($style1, $style2){
60
+        $result=$style1;
61
+        foreach($style2 as $k=>$v){
62
+            if($v){
63 63
             $result[$k]=$v;
64
-         }
65
-      }
66
-      return $result;
67
-   }
64
+            }
65
+        }
66
+        return $result;
67
+    }
68 68
 
69
-   private function style_parcer($text, &$font_data){
70
-      $str=trim(strtr($text, array("\r"=>'', "\t"=>'')));
71
-      $rep=array('[bB]{1}'=>'B', '[iI]{1}'=>'I', '[iI]{1}[ ]*[bB]{1}'=>'BI', '[bB]{1}[ ]*[iI]{1}'=>'BI' );
72
-      foreach($rep as $a=>$v){
73
-         $str=preg_replace('/<[ ]*'.$a.'[ ]*>/', "<$v>", $str);
74
-         $str=preg_replace('/<[ ]*\/+[ ]*'.$a.'[ ]*>/', "</$v>", $str);
75
-      }
76
-      $str=preg_replace('/<BI>/', '<s "font-weight:B;font-style:I">', $str);
77
-      $str=preg_replace('/<\/BI>/', "</s>", $str);
78
-      $str=preg_replace('/<B>/', '<s "font-weight:B;">', $str);
79
-      $str=preg_replace('/<\/B>/', "</s>", $str);
80
-      $str=preg_replace('/<I>/', '<s "font-style:I;">', $str);
81
-      $str=preg_replace('/<\/I>/', "</s>", $str);
82
-      $open=array();
83
-      $total=array();
84
-      $lt="<s";
85
-      $rt="</s>";
86
-      $j=strpos($str, $lt, 0);
87
-      while($j!==false){
69
+    private function style_parcer($text, &$font_data){
70
+        $str=trim(strtr($text, array("\r"=>'', "\t"=>'')));
71
+        $rep=array('[bB]{1}'=>'B', '[iI]{1}'=>'I', '[iI]{1}[ ]*[bB]{1}'=>'BI', '[bB]{1}[ ]*[iI]{1}'=>'BI' );
72
+        foreach($rep as $a=>$v){
73
+            $str=preg_replace('/<[ ]*'.$a.'[ ]*>/', "<$v>", $str);
74
+            $str=preg_replace('/<[ ]*\/+[ ]*'.$a.'[ ]*>/', "</$v>", $str);
75
+        }
76
+        $str=preg_replace('/<BI>/', '<s "font-weight:B;font-style:I">', $str);
77
+        $str=preg_replace('/<\/BI>/', "</s>", $str);
78
+        $str=preg_replace('/<B>/', '<s "font-weight:B;">', $str);
79
+        $str=preg_replace('/<\/B>/', "</s>", $str);
80
+        $str=preg_replace('/<I>/', '<s "font-style:I;">', $str);
81
+        $str=preg_replace('/<\/I>/', "</s>", $str);
82
+        $open=array();
83
+        $total=array();
84
+        $lt="<s";
85
+        $rt="</s>";
86
+        $j=strpos($str, $lt, 0);
87
+        while($j!==false){
88 88
             if($j>0 && ord($str[$j-1])==92){
89 89
             $j=strpos($str, $lt, $j+1);
90 90
             continue;
91
-         }
92
-         $k=strpos($str, '>',$j+1);
93
-         $open[$j]=substr($str, $j+2, $k-($j+2));
94
-         $total[]=$j;
95
-         $j=strpos($str, $lt, $j+1);
96
-      }
97
-      $j=strpos($str, $rt, 0);
98
-      while($j!==false){
99
-         $total[]=$j;
100
-         $j=strpos($str, $rt, $j+1);
101
-      }
102
-      sort($total);
91
+            }
92
+            $k=strpos($str, '>',$j+1);
93
+            $open[$j]=substr($str, $j+2, $k-($j+2));
94
+            $total[]=$j;
95
+            $j=strpos($str, $lt, $j+1);
96
+        }
97
+        $j=strpos($str, $rt, 0);
98
+        while($j!==false){
99
+            $total[]=$j;
100
+            $j=strpos($str, $rt, $j+1);
101
+        }
102
+        sort($total);
103 103
       
104
-      $cs='';
105
-      foreach($font_data as $k=>$v){
106
-         $cs.=$k . ':'. $v . '; ';
107
-      }
108
-      $cs=$this->get_style($cs);
109
-      $tmp=array($cs);
110
-      $blocks=array();
111
-      $blockstyle=array();
112
-      $n=count($total);
113
-      $k=0;
114
-      for($i=0; $i<$n; $i++){
115
-         $blocks[]=substr($str, $k, $total[$i]-$k);
116
-         $blockstyle[]=$cs;
117
-         if(isset($open[$total[$i]])){
104
+        $cs='';
105
+        foreach($font_data as $k=>$v){
106
+            $cs.=$k . ':'. $v . '; ';
107
+        }
108
+        $cs=$this->get_style($cs);
109
+        $tmp=array($cs);
110
+        $blocks=array();
111
+        $blockstyle=array();
112
+        $n=count($total);
113
+        $k=0;
114
+        for($i=0; $i<$n; $i++){
115
+            $blocks[]=substr($str, $k, $total[$i]-$k);
116
+            $blockstyle[]=$cs;
117
+            if(isset($open[$total[$i]])){
118 118
             $cs=$this->style_merge($cs, $this->get_style($open[$total[$i]]));
119 119
             array_push($tmp, $cs);
120 120
             $k=strpos($str, '>',$total[$i]+1)+1;
121
-         }
122
-         else{
121
+            }
122
+            else{
123 123
             $k=$total[$i]+4;
124 124
             array_pop($tmp);
125 125
             $l=count($tmp)-1;
126 126
             $cs=$tmp[$l];
127
-         }
128
-      }
129
-      if($k<strlen($str)){
130
-         $blocks[]=substr($str, $k);
131
-         $blockstyle[]=$cs;
132
-      }
133
-      $n=count($blocks);
134
-      for($i=0; $i<$n; $i++){
135
-         $this->parced_str.=strtr($blocks[$i], array('\<s'=>'<s'));
136
-         if(strlen($blocks[$i])>0){
127
+            }
128
+        }
129
+        if($k<strlen($str)){
130
+            $blocks[]=substr($str, $k);
131
+            $blockstyle[]=$cs;
132
+        }
133
+        $n=count($blocks);
134
+        for($i=0; $i<$n; $i++){
135
+            $this->parced_str.=strtr($blocks[$i], array('\<s'=>'<s'));
136
+            if(strlen($blocks[$i])>0){
137 137
             $blockstyle[$i]['style']=$blockstyle[$i]['font-weight'] . $blockstyle[$i]['font-style'];
138 138
             unset($blockstyle[$i]['font-weight']);
139 139
             unset($blockstyle[$i]['font-style']);
140 140
             $this->style_map[strlen($this->parced_str)-1]=$blockstyle[$i];
141
-         }
142
-      }
143
-   }
141
+            }
142
+        }
143
+    }
144 144
 
145
-   public function __construct($text, $width, &$font_data){
146
-      $this->iterator=0;
147
-      $this->parced_str='';
148
-      $this->style_map=array();
149
-      $this->style_parcer($text, $font_data);
150
-      $this->positions=array_keys($this->style_map);
151
-      $this->np=(bool)count($this->positions);
152
-      $this->width=$width;
153
-      $this->lines=array('');
154
-      $this->linesmap[0]=array(0, 0, 0);
155
-      $this->used_fonts=array();
156
-   }
145
+    public function __construct($text, $width, &$font_data){
146
+        $this->iterator=0;
147
+        $this->parced_str='';
148
+        $this->style_map=array();
149
+        $this->style_parcer($text, $font_data);
150
+        $this->positions=array_keys($this->style_map);
151
+        $this->np=(bool)count($this->positions);
152
+        $this->width=$width;
153
+        $this->lines=array('');
154
+        $this->linesmap[0]=array(0, 0, 0);
155
+        $this->used_fonts=array();
156
+    }
157 157
 
158
-   public function get_str(){
159
-      return $this->parced_str;
160
-   }
158
+    public function get_str(){
159
+        return $this->parced_str;
160
+    }
161 161
 
162
-   public function get_current_style($i){
163
-      if(!$this->np){
164
-         return '';
165
-      }
166
-      while($this->positions[$this->iterator]<$i){
167
-         $this->iterator++;
168
-      }
169
-      return $this->style_map[$this->positions[$this->iterator]];
170
-   }
162
+    public function get_current_style($i){
163
+        if(!$this->np){
164
+            return '';
165
+        }
166
+        while($this->positions[$this->iterator]<$i){
167
+            $this->iterator++;
168
+        }
169
+        return $this->style_map[$this->positions[$this->iterator]];
170
+    }
171 171
    
172 172
 
173
-      public function break_by_style($t){
174
-      $i=$this->linesmap[$t][0];
175
-      $j=$this->linesmap[$t][1];
176
-      $this->iterator=0;
177
-      $result=array('chunks'=>array(), 'style'=>array(), 'height'=>0, 'width'=>$this->linesmap[$t][2]);
178
-      if(strlen($this->parced_str)==0){
179
-         return $result;
180
-      }
181
-      $cs=$this->get_current_style($i);
182
-      $result['height']=$cs['font-size'];
183
-      $r=0;
184
-      $result['chunks'][$r]='';
185
-      $result['style'][$r]=$cs;
186
-      while($this->parced_str[$j]==' '){
187
-         $j--;
188
-      }
189
-      $tmp=$i;
190
-         for($k=$i; $k<=$j; $k++){
191
-         if($this->parced_str[$tmp]==' ' && $this->parced_str[$k]==' '){
173
+        public function break_by_style($t){
174
+        $i=$this->linesmap[$t][0];
175
+        $j=$this->linesmap[$t][1];
176
+        $this->iterator=0;
177
+        $result=array('chunks'=>array(), 'style'=>array(), 'height'=>0, 'width'=>$this->linesmap[$t][2]);
178
+        if(strlen($this->parced_str)==0){
179
+            return $result;
180
+        }
181
+        $cs=$this->get_current_style($i);
182
+        $result['height']=$cs['font-size'];
183
+        $r=0;
184
+        $result['chunks'][$r]='';
185
+        $result['style'][$r]=$cs;
186
+        while($this->parced_str[$j]==' '){
187
+            $j--;
188
+        }
189
+        $tmp=$i;
190
+            for($k=$i; $k<=$j; $k++){
191
+            if($this->parced_str[$tmp]==' ' && $this->parced_str[$k]==' '){
192 192
             $tmp=$k;
193 193
             continue;
194
-         }
194
+            }
195 195
             if($cs!=$this->get_current_style($k)) {
196 196
             $r++;
197 197
             $cs=$this->get_current_style($k);
198 198
             $result['chunks'][$r]='';
199 199
             $result['style'][$r]=$cs;
200 200
             if($result['height']<$cs['font-size']){
201
-               $result['height']=$cs['font-size'];
201
+                $result['height']=$cs['font-size'];
202 202
             }
203
-         }
204
-         $result['chunks'][$r].=$this->parced_str[$k];
205
-         $tmp=$k;
206
-      }
207
-      return $result;
208
-   }
203
+            }
204
+            $result['chunks'][$r].=$this->parced_str[$k];
205
+            $tmp=$k;
206
+        }
207
+        return $result;
208
+    }
209 209
 }
210 210
 ?>
Please login to merge, or discard this patch.
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -19,34 +19,34 @@  discard block
 block discarded – undo
19 19
     public $linesmap;
20 20
     public $used_fonts;
21 21
 
22
-    private function get_style($str){
23
-       $style=array('font-family'=>false, 'font-weight'=>false, 'font-style'=>false,
22
+    private function get_style($str) {
23
+       $style = array('font-family'=>false, 'font-weight'=>false, 'font-style'=>false,
24 24
        'font-size'=>false, 'font-color'=>false, 'href'=>'');
25
-       $tmp=explode(';', trim($str, '",\', '));
26
-       foreach($tmp as $x){
27
-          if($x && strpos($x,':')>0){
28
-             $r=explode(':',$x);
29
-             $r[0]=trim($r[0]);
30
-             $r[1]=trim($r[1]);
31
-             if(isset($style[$r[0]]) || $r[0]=='style'){
32
-                if($r[0]=='style' || $r[0]=='font-style'){
33
-                   $r[1]=strtoupper($r[1]);
34
-                   if(strpos($r[1], 'B')!==false){
35
-                      $style['font-weight']='B';
25
+       $tmp = explode(';', trim($str, '",\', '));
26
+       foreach ($tmp as $x) {
27
+          if ($x && strpos($x, ':') > 0) {
28
+             $r = explode(':', $x);
29
+             $r[0] = trim($r[0]);
30
+             $r[1] = trim($r[1]);
31
+             if (isset($style[$r[0]]) || $r[0] == 'style') {
32
+                if ($r[0] == 'style' || $r[0] == 'font-style') {
33
+                   $r[1] = strtoupper($r[1]);
34
+                   if (strpos($r[1], 'B') !== false) {
35
+                      $style['font-weight'] = 'B';
36 36
                   }
37
-                  if(strpos($r[1], 'I')!==false){
38
-                     $style['font-style']='I';
37
+                  if (strpos($r[1], 'I') !== false) {
38
+                     $style['font-style'] = 'I';
39 39
                   }
40
-                  if(strpos($r[1], 'U')!==false){
41
-                     $style['font-style'].='U';
40
+                  if (strpos($r[1], 'U') !== false) {
41
+                     $style['font-style'] .= 'U';
42 42
                   }
43 43
                }
44
-               elseif($r[1]){
45
-                  if($r[0]=='href'){
46
-                     $style[$r[0]]=implode(':', array_slice($r,1));
44
+               elseif ($r[1]) {
45
+                  if ($r[0] == 'href') {
46
+                     $style[$r[0]] = implode(':', array_slice($r, 1));
47 47
                   }
48
-                  else{
49
-                     $style[$r[0]]=$r[1];
48
+                  else {
49
+                     $style[$r[0]] = $r[1];
50 50
                   }
51 51
                }
52 52
             }
@@ -56,153 +56,153 @@  discard block
 block discarded – undo
56 56
    }
57 57
     
58 58
 
59
-   private function style_merge($style1, $style2){
60
-      $result=$style1;
61
-      foreach($style2 as $k=>$v){
62
-         if($v){
63
-            $result[$k]=$v;
59
+   private function style_merge($style1, $style2) {
60
+      $result = $style1;
61
+      foreach ($style2 as $k=>$v) {
62
+         if ($v) {
63
+            $result[$k] = $v;
64 64
          }
65 65
       }
66 66
       return $result;
67 67
    }
68 68
 
69
-   private function style_parcer($text, &$font_data){
70
-      $str=trim(strtr($text, array("\r"=>'', "\t"=>'')));
71
-      $rep=array('[bB]{1}'=>'B', '[iI]{1}'=>'I', '[iI]{1}[ ]*[bB]{1}'=>'BI', '[bB]{1}[ ]*[iI]{1}'=>'BI' );
72
-      foreach($rep as $a=>$v){
73
-         $str=preg_replace('/<[ ]*'.$a.'[ ]*>/', "<$v>", $str);
74
-         $str=preg_replace('/<[ ]*\/+[ ]*'.$a.'[ ]*>/', "</$v>", $str);
69
+   private function style_parcer($text, &$font_data) {
70
+      $str = trim(strtr($text, array("\r"=>'', "\t"=>'')));
71
+      $rep = array('[bB]{1}'=>'B', '[iI]{1}'=>'I', '[iI]{1}[ ]*[bB]{1}'=>'BI', '[bB]{1}[ ]*[iI]{1}'=>'BI');
72
+      foreach ($rep as $a=>$v) {
73
+         $str = preg_replace('/<[ ]*'.$a.'[ ]*>/', "<$v>", $str);
74
+         $str = preg_replace('/<[ ]*\/+[ ]*'.$a.'[ ]*>/', "</$v>", $str);
75 75
       }
76
-      $str=preg_replace('/<BI>/', '<s "font-weight:B;font-style:I">', $str);
77
-      $str=preg_replace('/<\/BI>/', "</s>", $str);
78
-      $str=preg_replace('/<B>/', '<s "font-weight:B;">', $str);
79
-      $str=preg_replace('/<\/B>/', "</s>", $str);
80
-      $str=preg_replace('/<I>/', '<s "font-style:I;">', $str);
81
-      $str=preg_replace('/<\/I>/', "</s>", $str);
82
-      $open=array();
83
-      $total=array();
84
-      $lt="<s";
85
-      $rt="</s>";
86
-      $j=strpos($str, $lt, 0);
87
-      while($j!==false){
88
-            if($j>0 && ord($str[$j-1])==92){
89
-            $j=strpos($str, $lt, $j+1);
76
+      $str = preg_replace('/<BI>/', '<s "font-weight:B;font-style:I">', $str);
77
+      $str = preg_replace('/<\/BI>/', "</s>", $str);
78
+      $str = preg_replace('/<B>/', '<s "font-weight:B;">', $str);
79
+      $str = preg_replace('/<\/B>/', "</s>", $str);
80
+      $str = preg_replace('/<I>/', '<s "font-style:I;">', $str);
81
+      $str = preg_replace('/<\/I>/', "</s>", $str);
82
+      $open = array();
83
+      $total = array();
84
+      $lt = "<s";
85
+      $rt = "</s>";
86
+      $j = strpos($str, $lt, 0);
87
+      while ($j !== false) {
88
+            if ($j > 0 && ord($str[$j - 1]) == 92) {
89
+            $j = strpos($str, $lt, $j + 1);
90 90
             continue;
91 91
          }
92
-         $k=strpos($str, '>',$j+1);
93
-         $open[$j]=substr($str, $j+2, $k-($j+2));
94
-         $total[]=$j;
95
-         $j=strpos($str, $lt, $j+1);
92
+         $k = strpos($str, '>', $j + 1);
93
+         $open[$j] = substr($str, $j + 2, $k - ($j + 2));
94
+         $total[] = $j;
95
+         $j = strpos($str, $lt, $j + 1);
96 96
       }
97
-      $j=strpos($str, $rt, 0);
98
-      while($j!==false){
99
-         $total[]=$j;
100
-         $j=strpos($str, $rt, $j+1);
97
+      $j = strpos($str, $rt, 0);
98
+      while ($j !== false) {
99
+         $total[] = $j;
100
+         $j = strpos($str, $rt, $j + 1);
101 101
       }
102 102
       sort($total);
103 103
       
104
-      $cs='';
105
-      foreach($font_data as $k=>$v){
106
-         $cs.=$k . ':'. $v . '; ';
104
+      $cs = '';
105
+      foreach ($font_data as $k=>$v) {
106
+         $cs .= $k.':'.$v.'; ';
107 107
       }
108
-      $cs=$this->get_style($cs);
109
-      $tmp=array($cs);
110
-      $blocks=array();
111
-      $blockstyle=array();
112
-      $n=count($total);
113
-      $k=0;
114
-      for($i=0; $i<$n; $i++){
115
-         $blocks[]=substr($str, $k, $total[$i]-$k);
116
-         $blockstyle[]=$cs;
117
-         if(isset($open[$total[$i]])){
118
-            $cs=$this->style_merge($cs, $this->get_style($open[$total[$i]]));
108
+      $cs = $this->get_style($cs);
109
+      $tmp = array($cs);
110
+      $blocks = array();
111
+      $blockstyle = array();
112
+      $n = count($total);
113
+      $k = 0;
114
+      for ($i = 0; $i < $n; $i++) {
115
+         $blocks[] = substr($str, $k, $total[$i] - $k);
116
+         $blockstyle[] = $cs;
117
+         if (isset($open[$total[$i]])) {
118
+            $cs = $this->style_merge($cs, $this->get_style($open[$total[$i]]));
119 119
             array_push($tmp, $cs);
120
-            $k=strpos($str, '>',$total[$i]+1)+1;
120
+            $k = strpos($str, '>', $total[$i] + 1) + 1;
121 121
          }
122
-         else{
123
-            $k=$total[$i]+4;
122
+         else {
123
+            $k = $total[$i] + 4;
124 124
             array_pop($tmp);
125
-            $l=count($tmp)-1;
126
-            $cs=$tmp[$l];
125
+            $l = count($tmp) - 1;
126
+            $cs = $tmp[$l];
127 127
          }
128 128
       }
129
-      if($k<strlen($str)){
130
-         $blocks[]=substr($str, $k);
131
-         $blockstyle[]=$cs;
129
+      if ($k < strlen($str)) {
130
+         $blocks[] = substr($str, $k);
131
+         $blockstyle[] = $cs;
132 132
       }
133
-      $n=count($blocks);
134
-      for($i=0; $i<$n; $i++){
135
-         $this->parced_str.=strtr($blocks[$i], array('\<s'=>'<s'));
136
-         if(strlen($blocks[$i])>0){
137
-            $blockstyle[$i]['style']=$blockstyle[$i]['font-weight'] . $blockstyle[$i]['font-style'];
133
+      $n = count($blocks);
134
+      for ($i = 0; $i < $n; $i++) {
135
+         $this->parced_str .= strtr($blocks[$i], array('\<s'=>'<s'));
136
+         if (strlen($blocks[$i]) > 0) {
137
+            $blockstyle[$i]['style'] = $blockstyle[$i]['font-weight'].$blockstyle[$i]['font-style'];
138 138
             unset($blockstyle[$i]['font-weight']);
139 139
             unset($blockstyle[$i]['font-style']);
140
-            $this->style_map[strlen($this->parced_str)-1]=$blockstyle[$i];
140
+            $this->style_map[strlen($this->parced_str) - 1] = $blockstyle[$i];
141 141
          }
142 142
       }
143 143
    }
144 144
 
145
-   public function __construct($text, $width, &$font_data){
146
-      $this->iterator=0;
147
-      $this->parced_str='';
148
-      $this->style_map=array();
145
+   public function __construct($text, $width, &$font_data) {
146
+      $this->iterator = 0;
147
+      $this->parced_str = '';
148
+      $this->style_map = array();
149 149
       $this->style_parcer($text, $font_data);
150
-      $this->positions=array_keys($this->style_map);
151
-      $this->np=(bool)count($this->positions);
152
-      $this->width=$width;
153
-      $this->lines=array('');
154
-      $this->linesmap[0]=array(0, 0, 0);
155
-      $this->used_fonts=array();
150
+      $this->positions = array_keys($this->style_map);
151
+      $this->np = (bool) count($this->positions);
152
+      $this->width = $width;
153
+      $this->lines = array('');
154
+      $this->linesmap[0] = array(0, 0, 0);
155
+      $this->used_fonts = array();
156 156
    }
157 157
 
158
-   public function get_str(){
158
+   public function get_str() {
159 159
       return $this->parced_str;
160 160
    }
161 161
 
162
-   public function get_current_style($i){
163
-      if(!$this->np){
162
+   public function get_current_style($i) {
163
+      if (!$this->np) {
164 164
          return '';
165 165
       }
166
-      while($this->positions[$this->iterator]<$i){
166
+      while ($this->positions[$this->iterator] < $i) {
167 167
          $this->iterator++;
168 168
       }
169 169
       return $this->style_map[$this->positions[$this->iterator]];
170 170
    }
171 171
    
172 172
 
173
-      public function break_by_style($t){
174
-      $i=$this->linesmap[$t][0];
175
-      $j=$this->linesmap[$t][1];
176
-      $this->iterator=0;
177
-      $result=array('chunks'=>array(), 'style'=>array(), 'height'=>0, 'width'=>$this->linesmap[$t][2]);
178
-      if(strlen($this->parced_str)==0){
173
+      public function break_by_style($t) {
174
+      $i = $this->linesmap[$t][0];
175
+      $j = $this->linesmap[$t][1];
176
+      $this->iterator = 0;
177
+      $result = array('chunks'=>array(), 'style'=>array(), 'height'=>0, 'width'=>$this->linesmap[$t][2]);
178
+      if (strlen($this->parced_str) == 0) {
179 179
          return $result;
180 180
       }
181
-      $cs=$this->get_current_style($i);
182
-      $result['height']=$cs['font-size'];
183
-      $r=0;
184
-      $result['chunks'][$r]='';
185
-      $result['style'][$r]=$cs;
186
-      while($this->parced_str[$j]==' '){
181
+      $cs = $this->get_current_style($i);
182
+      $result['height'] = $cs['font-size'];
183
+      $r = 0;
184
+      $result['chunks'][$r] = '';
185
+      $result['style'][$r] = $cs;
186
+      while ($this->parced_str[$j] == ' ') {
187 187
          $j--;
188 188
       }
189
-      $tmp=$i;
190
-         for($k=$i; $k<=$j; $k++){
191
-         if($this->parced_str[$tmp]==' ' && $this->parced_str[$k]==' '){
192
-            $tmp=$k;
189
+      $tmp = $i;
190
+         for ($k = $i; $k <= $j; $k++) {
191
+         if ($this->parced_str[$tmp] == ' ' && $this->parced_str[$k] == ' ') {
192
+            $tmp = $k;
193 193
             continue;
194 194
          }
195
-            if($cs!=$this->get_current_style($k)) {
195
+            if ($cs != $this->get_current_style($k)) {
196 196
             $r++;
197
-            $cs=$this->get_current_style($k);
198
-            $result['chunks'][$r]='';
199
-            $result['style'][$r]=$cs;
200
-            if($result['height']<$cs['font-size']){
201
-               $result['height']=$cs['font-size'];
197
+            $cs = $this->get_current_style($k);
198
+            $result['chunks'][$r] = '';
199
+            $result['style'][$r] = $cs;
200
+            if ($result['height'] < $cs['font-size']) {
201
+               $result['height'] = $cs['font-size'];
202 202
             }
203 203
          }
204
-         $result['chunks'][$r].=$this->parced_str[$k];
205
-         $tmp=$k;
204
+         $result['chunks'][$r] .= $this->parced_str[$k];
205
+         $tmp = $k;
206 206
       }
207 207
       return $result;
208 208
    }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,12 +40,10 @@  discard block
 block discarded – undo
40 40
                   if(strpos($r[1], 'U')!==false){
41 41
                      $style['font-style'].='U';
42 42
                   }
43
-               }
44
-               elseif($r[1]){
43
+               } elseif($r[1]){
45 44
                   if($r[0]=='href'){
46 45
                      $style[$r[0]]=implode(':', array_slice($r,1));
47
-                  }
48
-                  else{
46
+                  } else{
49 47
                      $style[$r[0]]=$r[1];
50 48
                   }
51 49
                }
@@ -118,8 +116,7 @@  discard block
 block discarded – undo
118 116
             $cs=$this->style_merge($cs, $this->get_style($open[$total[$i]]));
119 117
             array_push($tmp, $cs);
120 118
             $k=strpos($str, '>',$total[$i]+1)+1;
121
-         }
122
-         else{
119
+         } else{
123 120
             $k=$total[$i]+4;
124 121
             array_pop($tmp);
125 122
             $l=count($tmp)-1;
Please login to merge, or discard this patch.