Completed
Pull Request — v3.0 (#136)
by
unknown
25:07
created
astpp/application/libraries/html2pdf/_class/parsingCss.class.php 1 patch
Spacing   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     protected $_pdf         = null;
19 19
 
20 20
     protected $_htmlColor   = array(); // list of the HTML colors
21
-    protected $_onlyLeft    = false;   // flag if we are in a sub html => only "text-align:left" is used
22
-    protected $_defaultFont = null;    // default font to use if the asked font does not exist
21
+    protected $_onlyLeft    = false; // flag if we are in a sub html => only "text-align:left" is used
22
+    protected $_defaultFont = null; // default font to use if the asked font does not exist
23 23
 
24 24
     public    $value        = array(); // current values
25 25
     public    $css          = array(); // css values
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function getOldValues()
70 70
     {
71
-        return isset($this->table[count($this->table)-1]) ? $this->table[count($this->table)-1] : $this->value;
71
+        return isset($this->table[count($this->table) - 1]) ? $this->table[count($this->table) - 1] : $this->value;
72 72
     }
73 73
 
74 74
     /**
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function initStyle()
115 115
     {
116
-        $this->value['id_tag']       = 'body';        // tag name
117
-        $this->value['id_name']          = null;         // tag - attribute name
118
-        $this->value['id_id']            = null;         // tag - attribute id
119
-        $this->value['id_class']         = null;         // tag - attribute class
120
-        $this->value['id_lst']           = array('*');   // tag - list of legacy
121
-        $this->value['mini-size']        = 1.;           // specific size report for sup, sub
122
-        $this->value['mini-decal']       = 0;            // specific position report for sup, sub
116
+        $this->value['id_tag'] = 'body'; // tag name
117
+        $this->value['id_name']          = null; // tag - attribute name
118
+        $this->value['id_id']            = null; // tag - attribute id
119
+        $this->value['id_class']         = null; // tag - attribute class
120
+        $this->value['id_lst']           = array('*'); // tag - list of legacy
121
+        $this->value['mini-size']        = 1.; // specific size report for sup, sub
122
+        $this->value['mini-decal']       = 0; // specific position report for sup, sub
123 123
         $this->value['font-family']      = 'Arial';
124 124
         $this->value['font-bold']        = false;
125 125
         $this->value['font-italic']      = false;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
         // prepare the Collapse attribute
181 181
         $collapse = isset($this->value['border']['collapse']) ? $this->value['border']['collapse'] : false;
182
-        if (!in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) $collapse = false;
182
+        if ( ! in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) $collapse = false;
183 183
 
184 184
         // set the global css values
185 185
         $this->value['position']   = null;
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
         );
212 212
 
213 213
         // specific values for some tags
214
-        if (!in_array($tagName, array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'))) {
215
-            $this->value['margin'] = array('t'=>0,'r'=>0,'b'=>0,'l'=>0);
214
+        if ( ! in_array($tagName, array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'))) {
215
+            $this->value['margin'] = array('t'=>0, 'r'=>0, 'b'=>0, 'l'=>0);
216 216
         }
217 217
 
218 218
         if (in_array($tagName, array('input', 'select', 'textarea'))) {
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
             $this->value['border']['l'] = null;
223 223
         }
224 224
 
225
-        if ($tagName=='p') {
225
+        if ($tagName == 'p') {
226 226
             $this->value['margin']['t'] = null;
227 227
             $this->value['margin']['b'] = null;
228 228
         }
229
-        if ($tagName=='blockquote') {
229
+        if ($tagName == 'blockquote') {
230 230
             $this->value['margin']['t'] = 3;
231 231
             $this->value['margin']['r'] = 3;
232 232
             $this->value['margin']['b'] = 3;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             $this->value['list-style-image'] = '';
260 260
         }
261 261
 
262
-        if (!in_array($tagName, array('tr', 'td'))) {
262
+        if ( ! in_array($tagName, array('tr', 'td'))) {
263 263
             $this->value['padding'] = array(
264 264
                 't' => 0,
265 265
                 'r' => 0,
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             );
276 276
         }
277 277
 
278
-        if ($tagName=='hr') {
278
+        if ($tagName == 'hr') {
279 279
             $this->value['border'] = array(
280 280
                 't' => $border,
281 281
                 'r' => $border,
@@ -305,40 +305,40 @@  discard block
 block discarded – undo
305 305
     {
306 306
         $family = strtolower($this->value['font-family']);
307 307
 
308
-        $b = ($this->value['font-bold']        ? 'B' : '');
309
-        $i = ($this->value['font-italic']      ? 'I' : '');
310
-        $u = ($this->value['font-underline']   ? 'U' : '');
308
+        $b = ($this->value['font-bold'] ? 'B' : '');
309
+        $i = ($this->value['font-italic'] ? 'I' : '');
310
+        $u = ($this->value['font-underline'] ? 'U' : '');
311 311
         $d = ($this->value['font-linethrough'] ? 'D' : '');
312
-        $o = ($this->value['font-overline']    ? 'O' : '');
312
+        $o = ($this->value['font-overline'] ? 'O' : '');
313 313
 
314 314
         // font style
315 315
         $style = $b.$i;
316 316
 
317 317
         if ($this->_defaultFont) {
318
-            if($family=='arial')
319
-                $family='helvetica';
320
-            elseif($family=='symbol' || $family=='zapfdingbats')
321
-                $style='';
318
+            if ($family == 'arial')
319
+                $family = 'helvetica';
320
+            elseif ($family == 'symbol' || $family == 'zapfdingbats')
321
+                $style = '';
322 322
 
323 323
             $fontkey = $family.$style;
324
-            if (!$this->_pdf->isLoadedFont($fontkey))
324
+            if ( ! $this->_pdf->isLoadedFont($fontkey))
325 325
                 $family = $this->_defaultFont;
326 326
         }
327 327
 
328
-        if($family=='arial')
329
-            $family='helvetica';
330
-        elseif($family=='symbol' || $family=='zapfdingbats')
331
-            $style='';
328
+        if ($family == 'arial')
329
+            $family = 'helvetica';
330
+        elseif ($family == 'symbol' || $family == 'zapfdingbats')
331
+            $style = '';
332 332
 
333 333
         // complete style
334
-        $style.= $u.$d.$o;
334
+        $style .= $u.$d.$o;
335 335
 
336 336
         // size : mm => pt
337 337
         $size = $this->value['font-size'];
338 338
         $size = 72 * $size / 25.4;
339 339
 
340 340
         // apply the font
341
-        $this->_pdf->SetFont($family, $style, $this->value['mini-size']*$size);
341
+        $this->_pdf->SetFont($family, $style, $this->value['mini-size'] * $size);
342 342
         $this->_pdf->setTextColorArray($this->value['color']);
343 343
         if ($this->value['background']['color'])
344 344
             $this->_pdf->setFillColorArray($this->value['background']['color']);
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     public function restorePosition()
377 377
     {
378
-        if ($this->value['y']==$this->_pdf->getY()) $this->_pdf->setY($this->value['yc'], false);
378
+        if ($this->value['y'] == $this->_pdf->getY()) $this->_pdf->setY($this->value['yc'], false);
379 379
     }
380 380
 
381 381
      /**
@@ -393,35 +393,35 @@  discard block
 block discarded – undo
393 393
         $this->value['xc'] = $currentX;
394 394
         $this->value['yc'] = $currentY;
395 395
 
396
-        if ($this->value['position']=='relative' || $this->value['position']=='absolute') {
397
-            if ($this->value['right']!==null) {
396
+        if ($this->value['position'] == 'relative' || $this->value['position'] == 'absolute') {
397
+            if ($this->value['right'] !== null) {
398 398
                 $x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width'];
399
-                if ($this->value['margin']['r']) $x-= $this->value['margin']['r'];
399
+                if ($this->value['margin']['r']) $x -= $this->value['margin']['r'];
400 400
             } else {
401 401
                 $x = $this->value['left'];
402
-                if ($this->value['margin']['l']) $x+= $this->value['margin']['l'];
402
+                if ($this->value['margin']['l']) $x += $this->value['margin']['l'];
403 403
             }
404 404
 
405
-            if ($this->value['bottom']!==null) {
405
+            if ($this->value['bottom'] !== null) {
406 406
                 $y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height'];
407
-                if ($this->value['margin']['b']) $y-= $this->value['margin']['b'];
407
+                if ($this->value['margin']['b']) $y -= $this->value['margin']['b'];
408 408
             } else {
409 409
                 $y = $this->value['top'];
410
-                if ($this->value['margin']['t']) $y+= $this->value['margin']['t'];
410
+                if ($this->value['margin']['t']) $y += $this->value['margin']['t'];
411 411
             }
412 412
 
413
-            if ($this->value['position']=='relative') {
413
+            if ($this->value['position'] == 'relative') {
414 414
                 $this->value['x'] = $currentX + $x;
415 415
                 $this->value['y'] = $currentY + $y;
416 416
             } else {
417
-                $this->value['x'] = $this->_getLastAbsoluteX()+$x;
418
-                $this->value['y'] = $this->_getLastAbsoluteY()+$y;
417
+                $this->value['x'] = $this->_getLastAbsoluteX() + $x;
418
+                $this->value['y'] = $this->_getLastAbsoluteY() + $y;
419 419
             }
420 420
         } else {
421 421
             $this->value['x'] = $currentX;
422 422
             $this->value['y'] = $currentY;
423
-            if ($this->value['margin']['l']) $this->value['x']+= $this->value['margin']['l'];
424
-            if ($this->value['margin']['t']) $this->value['y']+= $this->value['margin']['t'];
423
+            if ($this->value['margin']['l']) $this->value['x'] += $this->value['margin']['l'];
424
+            if ($this->value['margin']['t']) $this->value['y'] += $this->value['margin']['t'];
425 425
         }
426 426
 
427 427
         // save the new position
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
             $prop['borderStyle'] = $this->value['border']['t']['type'];
457 457
         }
458 458
 
459
-        if (!empty($this->value['color'])) {
459
+        if ( ! empty($this->value['color'])) {
460 460
             $prop['textColor'] = $this->value['color'];
461 461
         }
462 462
 
463
-        if (!empty($this->value['font-size'])) {
463
+        if ( ! empty($this->value['font-size'])) {
464 464
             $prop['textSize'] = $this->value['font-size'];
465 465
         }
466 466
 
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
     {
479 479
         // prepare
480 480
         $tagName = strtolower($tagName);
481
-        $id   = isset($param['id'])   ? strtolower(trim($param['id']))   : null; if (!$id)   $id   = null;
482
-        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if (!$name) $name = null;
481
+        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id)   $id   = null;
482
+        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null;
483 483
 
484 484
         // read the class attribute
485 485
         $class = array();
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
         $this->value['id_lst']    = array();
499 499
         $this->value['id_lst'][] = '*';
500 500
         $this->value['id_lst'][] = $tagName;
501
-        if (!isset($this->value['svg'])) {
501
+        if ( ! isset($this->value['svg'])) {
502 502
             $this->value['svg'] = array(
503 503
                 'stroke'         => null,
504 504
                 'stroke-width'   => $this->convertToMM('1pt'),
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
         if (isset($styles['stroke']))        $this->value['svg']['stroke']       = $this->convertToColor($styles['stroke'], $res);
530 530
         if (isset($styles['stroke-width']))  $this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']);
531 531
         if (isset($styles['fill']))          $this->value['svg']['fill']         = $this->convertToColor($styles['fill'], $res);
532
-        if (isset($styles['fill-opacity']))  $this->value['svg']['fill-opacity'] = 1.*$styles['fill-opacity'];
532
+        if (isset($styles['fill-opacity']))  $this->value['svg']['fill-opacity'] = 1. * $styles['fill-opacity'];
533 533
 
534 534
         return $this->value['svg'];
535 535
     }
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
     {
547 547
         // prepare the informations
548 548
         $tagName = strtolower($tagName);
549
-        $id   = isset($param['id'])   ? strtolower(trim($param['id']))    : null; if (!$id)   $id   = null;
550
-        $name = isset($param['name']) ? strtolower(trim($param['name']))  : null; if (!$name) $name = null;
549
+        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id)   $id   = null;
550
+        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null;
551 551
 
552 552
         // get the class names to use
553 553
         $class = array();
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 
585 585
         // merge with the css styles from tag
586 586
         $styles = array_merge($styles, $param['style']);
587
-        if (isset($param['allwidth']) && !isset($styles['width'])) $styles['width'] = '100%';
587
+        if (isset($param['allwidth']) && ! isset($styles['width'])) $styles['width'] = '100%';
588 588
 
589 589
         // reset some styles, depending on the tag name
590 590
         $this->resetStyle($tagName);
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         if ($legacy) {
594 594
             foreach ($legacy as $legacyName => $legacyValue) {
595 595
                 if (is_array($legacyValue)) {
596
-                    foreach($legacyValue as $legacy2Name => $legacy2Value)
596
+                    foreach ($legacyValue as $legacy2Name => $legacy2Value)
597 597
                         $this->value[$legacyName][$legacy2Name] = $legacy2Value;
598 598
                 } else {
599 599
                     $this->value[$legacyName] = $legacyValue;
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
         // read all the css styles
609 609
         foreach ($styles as $nom => $val) {
610
-            switch($nom)
610
+            switch ($nom)
611 611
             {
612 612
                 case 'font-family':
613 613
                     $val = explode(',', $val);
@@ -616,11 +616,11 @@  discard block
 block discarded – undo
616 616
                     break;
617 617
 
618 618
                 case 'font-weight':
619
-                    $this->value['font-bold'] = ($val=='bold');
619
+                    $this->value['font-bold'] = ($val == 'bold');
620 620
                     break;
621 621
 
622 622
                 case 'font-style':
623
-                    $this->value['font-italic'] = ($val=='italic');
623
+                    $this->value['font-italic'] = ($val == 'italic');
624 624
                     break;
625 625
 
626 626
                 case 'text-decoration':
@@ -635,8 +635,8 @@  discard block
 block discarded – undo
635 635
                     break;
636 636
 
637 637
                 case 'text-transform':
638
-                    if (!in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none';
639
-                    $this->value['text-transform']  = $val;
638
+                    if ( ! in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none';
639
+                    $this->value['text-transform'] = $val;
640 640
                     break;
641 641
 
642 642
                 case 'font-size':
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
                 case 'color':
648 648
                     $res = null;
649 649
                     $this->value['color'] = $this->convertToColor($val, $res);
650
-                    if ($tagName=='hr') {
650
+                    if ($tagName == 'hr') {
651 651
                         $this->value['border']['l']['color'] = $this->value['color'];
652 652
                         $this->value['border']['t']['color'] = $this->value['color'];
653 653
                         $this->value['border']['r']['color'] = $this->value['color'];
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 
658 658
                 case 'text-align':
659 659
                     $val = strtolower($val);
660
-                    if (!in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) $val = 'left';
660
+                    if ( ! in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) $val = 'left';
661 661
                     $this->value['text-align'] = $val;
662 662
                     break;
663 663
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 
668 668
                 case 'width':
669 669
                     $this->value['width'] = $this->convertToMM($val, $this->getLastWidth());
670
-                    if ($this->value['width'] && substr($val, -1)=='%') $correctWidth=true;
670
+                    if ($this->value['width'] && substr($val, -1) == '%') $correctWidth = true;
671 671
                     $noWidth = false;
672 672
                     break;
673 673
 
@@ -676,18 +676,18 @@  discard block
 block discarded – undo
676 676
                     break;
677 677
 
678 678
                 case 'line-height':
679
-                    if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val*100).'%';
679
+                    if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val * 100).'%';
680 680
                     $this->value['line-height'] = $val;
681 681
                     break;
682 682
 
683 683
                 case 'rotate':
684
-                    if (!in_array($val, array(0, -90, 90, 180, 270, -180, -270))) $val = null;
685
-                    if ($val<0) $val+= 360;
684
+                    if ( ! in_array($val, array(0, -90, 90, 180, 270, -180, -270))) $val = null;
685
+                    if ($val < 0) $val += 360;
686 686
                     $this->value['rotate'] = $val;
687 687
                     break;
688 688
 
689 689
                 case 'overflow':
690
-                    if (!in_array($val, array('visible', 'hidden'))) $val = 'visible';
690
+                    if ( ! in_array($val, array('visible', 'hidden'))) $val = 'visible';
691 691
                     $this->value['overflow'] = $val;
692 692
                     break;
693 693
 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
                     $val = explode(' ', $val);
696 696
                     foreach ($val as $k => $v) {
697 697
                         $v = trim($v);
698
-                        if ($v!='') {
698
+                        if ($v != '') {
699 699
                             $val[$k] = $v;
700 700
                         } else {
701 701
                             unset($val[$k]);
@@ -726,14 +726,14 @@  discard block
 block discarded – undo
726 726
                     break;
727 727
 
728 728
                 case 'margin':
729
-                    if ($val=='auto') {
729
+                    if ($val == 'auto') {
730 730
                         $this->value['margin-auto'] = true;
731 731
                         break;
732 732
                     }
733 733
                     $val = explode(' ', $val);
734 734
                     foreach ($val as $k => $v) {
735 735
                         $v = trim($v);
736
-                        if ($v!='') {
736
+                        if ($v != '') {
737 737
                             $val[$k] = $v;
738 738
                         } else {
739 739
                             unset($val[$k]);
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
                 case 'border-style':
775 775
                     $val = explode(' ', $val);
776 776
                     foreach ($val as $valK => $valV) {
777
-                        if (!in_array($valV, array('solid', 'dotted', 'dashed'))) {
777
+                        if ( ! in_array($valV, array('solid', 'dotted', 'dashed'))) {
778 778
                             $val[$valK] = null;
779 779
                         }
780 780
                     }
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
                     $val = explode(' ', $val);
815 815
                     foreach ($val as $valK => $valV) {
816 816
                             $val[$valK] = $this->convertToColor($valV, $res);
817
-                            if (!$res) {
817
+                            if ( ! $res) {
818 818
                                 $val[$valK] = null;
819 819
                             }
820 820
                     }
@@ -883,29 +883,29 @@  discard block
 block discarded – undo
883 883
                     break;
884 884
 
885 885
                 case 'border-collapse':
886
-                    if ($tagName=='table') $this->value['border']['collapse'] = ($val=='collapse');
886
+                    if ($tagName == 'table') $this->value['border']['collapse'] = ($val == 'collapse');
887 887
                     break;
888 888
 
889 889
                 case 'border-radius':
890 890
                     $val = explode('/', $val);
891
-                    if (count($val)>2) {
891
+                    if (count($val) > 2) {
892 892
                         break;
893 893
                     }
894 894
                     $valH = $this->convertToRadius(trim($val[0]));
895
-                    if (count($valH)<1 || count($valH)>4) {
895
+                    if (count($valH) < 1 || count($valH) > 4) {
896 896
                         break;
897 897
                     }
898
-                    if (!isset($valH[1])) $valH[1] = $valH[0];
899
-                    if (!isset($valH[2])) $valH = array($valH[0], $valH[0], $valH[1], $valH[1]);
900
-                    if (!isset($valH[3])) $valH[3] = $valH[1];
898
+                    if ( ! isset($valH[1])) $valH[1] = $valH[0];
899
+                    if ( ! isset($valH[2])) $valH = array($valH[0], $valH[0], $valH[1], $valH[1]);
900
+                    if ( ! isset($valH[3])) $valH[3] = $valH[1];
901 901
                     if (isset($val[1])) {
902 902
                         $valV = $this->convertToRadius(trim($val[1]));
903
-                        if (count($valV)<1 || count($valV)>4) {
903
+                        if (count($valV) < 1 || count($valV) > 4) {
904 904
                             break;
905 905
                         }
906
-                        if (!isset($valV[1])) $valV[1] = $valV[0];
907
-                        if (!isset($valV[2])) $valV = array($valV[0], $valV[0], $valV[1], $valV[1]);
908
-                        if (!isset($valV[3])) $valV[3] = $valV[1];
906
+                        if ( ! isset($valV[1])) $valV[1] = $valV[0];
907
+                        if ( ! isset($valV[2])) $valV = array($valV[0], $valV[0], $valV[1], $valV[1]);
908
+                        if ( ! isset($valV[3])) $valV[3] = $valV[1];
909 909
                     } else {
910 910
                         $valV = $valH;
911 911
                     }
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 
920 920
                 case 'border-top-left-radius':
921 921
                     $val = $this->convertToRadius($val);
922
-                    if (count($val)<1 || count($val)>2) {
922
+                    if (count($val) < 1 || count($val) > 2) {
923 923
                         break;
924 924
                     }
925 925
                     $this->value['border']['radius']['tl'] = array($val[0], isset($val[1]) ? $val[1] : $val[0]);
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 
928 928
                 case 'border-top-right-radius':
929 929
                     $val = $this->convertToRadius($val);
930
-                    if (count($val)<1 || count($val)>2) {
930
+                    if (count($val) < 1 || count($val) > 2) {
931 931
                         break;
932 932
                     }
933 933
                     $this->value['border']['radius']['tr'] = array($val[0], isset($val[1]) ? $val[1] : $val[0]);
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 
936 936
                 case 'border-bottom-right-radius':
937 937
                     $val = $this->convertToRadius($val);
938
-                    if (count($val)<1 || count($val)>2) {
938
+                    if (count($val) < 1 || count($val) > 2) {
939 939
                         break;
940 940
                     }
941 941
                     $this->value['border']['radius']['br'] = array($val[0], isset($val[1]) ? $val[1] : $val[0]);
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 
944 944
                 case 'border-bottom-left-radius':
945 945
                     $val = $this->convertToRadius($val);
946
-                    if (count($val)<1 || count($val)>2) {
946
+                    if (count($val) < 1 || count($val) > 2) {
947 947
                         break;
948 948
                     }
949 949
                     $this->value['border']['radius']['bl'] = array($val[0], isset($val[1]) ? $val[1] : $val[0]);
@@ -987,21 +987,21 @@  discard block
 block discarded – undo
987 987
                     break;
988 988
 
989 989
                 case 'position':
990
-                    if ($val=='absolute')       $this->value['position'] = 'absolute';
991
-                    else if ($val=='relative')  $this->value['position'] = 'relative';
990
+                    if ($val == 'absolute')       $this->value['position'] = 'absolute';
991
+                    else if ($val == 'relative')  $this->value['position'] = 'relative';
992 992
                     else                        $this->value['position'] = null;
993 993
                     break;
994 994
 
995 995
                 case 'float':
996
-                    if ($val=='left')           $this->value['float'] = 'left';
997
-                    else if ($val=='right')     $this->value['float'] = 'right';
996
+                    if ($val == 'left')           $this->value['float'] = 'left';
997
+                    else if ($val == 'right')     $this->value['float'] = 'right';
998 998
                     else                        $this->value['float'] = null;
999 999
                     break;
1000 1000
 
1001 1001
                 case 'display':
1002
-                    if ($val=='inline')         $this->value['display'] = 'inline';
1003
-                    else if ($val=='block')     $this->value['display'] = 'block';
1004
-                    else if ($val=='none')      $this->value['display'] = 'none';
1002
+                    if ($val == 'inline')         $this->value['display'] = 'inline';
1003
+                    else if ($val == 'block')     $this->value['display'] = 'block';
1004
+                    else if ($val == 'none')      $this->value['display'] = 'none';
1005 1005
                     else                        $this->value['display'] = null;
1006 1006
                     break;
1007 1007
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
                 case 'list-style':
1016 1016
                 case 'list-style-type':
1017 1017
                 case 'list-style-image':
1018
-                    if ($nom=='list-style') $nom = 'list-style-type';
1018
+                    if ($nom == 'list-style') $nom = 'list-style-type';
1019 1019
                     $this->value[$nom] = $val;
1020 1020
                     break;
1021 1021
 
@@ -1027,27 +1027,27 @@  discard block
 block discarded – undo
1027 1027
         $return = true;
1028 1028
 
1029 1029
         // only for P tag
1030
-        if ($this->value['margin']['t']===null) $this->value['margin']['t'] = $this->value['font-size'];
1031
-        if ($this->value['margin']['b']===null) $this->value['margin']['b'] = $this->value['font-size'];
1030
+        if ($this->value['margin']['t'] === null) $this->value['margin']['t'] = $this->value['font-size'];
1031
+        if ($this->value['margin']['b'] === null) $this->value['margin']['b'] = $this->value['font-size'];
1032 1032
 
1033 1033
         // force the text align to left, if asked by html2pdf
1034 1034
         if ($this->_onlyLeft) $this->value['text-align'] = 'left';
1035 1035
 
1036 1036
         // correction on the width (quick box)
1037
-        if ($noWidth && in_array($tagName, array('div', 'blockquote', 'fieldset')) && $this->value['position']!='absolute') {
1037
+        if ($noWidth && in_array($tagName, array('div', 'blockquote', 'fieldset')) && $this->value['position'] != 'absolute') {
1038 1038
             $this->value['width'] = $this->getLastWidth();
1039
-            $this->value['width']-= $this->value['margin']['l'] + $this->value['margin']['r'];
1039
+            $this->value['width'] -= $this->value['margin']['l'] + $this->value['margin']['r'];
1040 1040
         } else {
1041 1041
             if ($correctWidth) {
1042
-                if (!in_array($tagName, array('table', 'div', 'blockquote', 'fieldset', 'hr'))) {
1043
-                    $this->value['width']-= $this->value['padding']['l'] + $this->value['padding']['r'];
1044
-                    $this->value['width']-= $this->value['border']['l']['width'] + $this->value['border']['r']['width'];
1042
+                if ( ! in_array($tagName, array('table', 'div', 'blockquote', 'fieldset', 'hr'))) {
1043
+                    $this->value['width'] -= $this->value['padding']['l'] + $this->value['padding']['r'];
1044
+                    $this->value['width'] -= $this->value['border']['l']['width'] + $this->value['border']['r']['width'];
1045 1045
                 }
1046 1046
                 if (in_array($tagName, array('th', 'td'))) {
1047
-                    $this->value['width']-= $this->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
1047
+                    $this->value['width'] -= $this->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
1048 1048
                     $return = false;
1049 1049
                 }
1050
-                if ($this->value['width']<0) $this->value['width']=0;
1050
+                if ($this->value['width'] < 0) $this->value['width'] = 0;
1051 1051
             } else {
1052 1052
                 if ($this->value['width']) {
1053 1053
                     if ($this->value['border']['l']['width']) $this->value['width'] += $this->value['border']['l']['width'];
@@ -1064,10 +1064,10 @@  discard block
 block discarded – undo
1064 1064
             if ($this->value['padding']['t'])         $this->value['height'] += $this->value['padding']['t'];
1065 1065
         }
1066 1066
 
1067
-        if ($this->value['top']!=null)      $this->value['top']     = $this->convertToMM($this->value['top'], $this->getLastHeight(true));
1068
-        if ($this->value['bottom']!=null)   $this->value['bottom']  = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true));
1069
-        if ($this->value['left']!=null)     $this->value['left']    = $this->convertToMM($this->value['left'], $this->getLastWidth(true));
1070
-        if ($this->value['right']!=null)    $this->value['right']   = $this->convertToMM($this->value['right'], $this->getLastWidth(true));
1067
+        if ($this->value['top'] != null)      $this->value['top']     = $this->convertToMM($this->value['top'], $this->getLastHeight(true));
1068
+        if ($this->value['bottom'] != null)   $this->value['bottom']  = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true));
1069
+        if ($this->value['left'] != null)     $this->value['left']    = $this->convertToMM($this->value['left'], $this->getLastWidth(true));
1070
+        if ($this->value['right'] != null)    $this->value['right']   = $this->convertToMM($this->value['right'], $this->getLastWidth(true));
1071 1071
 
1072 1072
         if ($this->value['top'] && $this->value['bottom'] && $this->value['height'])    $this->value['bottom']  = null;
1073 1073
         if ($this->value['left'] && $this->value['right'] && $this->value['width'])     $this->value['right']   = null;
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
     public function getLineHeight()
1085 1085
     {
1086 1086
         $val = $this->value['line-height'];
1087
-        if ($val=='normal') $val = '108%';
1087
+        if ($val == 'normal') $val = '108%';
1088 1088
         return $this->convertToMM($val, $this->value['font-size']);
1089 1089
     }
1090 1090
 
@@ -1097,12 +1097,12 @@  discard block
 block discarded – undo
1097 1097
      */
1098 1098
     public function getLastWidth($mode = false)
1099 1099
     {
1100
-        for ($k=count($this->table)-1; $k>=0; $k--) {
1100
+        for ($k = count($this->table) - 1; $k >= 0; $k--) {
1101 1101
             if ($this->table[$k]['width']) {
1102 1102
                 $w = $this->table[$k]['width'];
1103 1103
                 if ($mode) {
1104
-                    $w+= $this->table[$k]['border']['l']['width'] + $this->table[$k]['padding']['l'] + 0.02;
1105
-                    $w+= $this->table[$k]['border']['r']['width'] + $this->table[$k]['padding']['r'] + 0.02;
1104
+                    $w += $this->table[$k]['border']['l']['width'] + $this->table[$k]['padding']['l'] + 0.02;
1105
+                    $w += $this->table[$k]['border']['r']['width'] + $this->table[$k]['padding']['r'] + 0.02;
1106 1106
                 }
1107 1107
                 return $w;
1108 1108
             }
@@ -1119,12 +1119,12 @@  discard block
 block discarded – undo
1119 1119
      */
1120 1120
     public function getLastHeight($mode = false)
1121 1121
     {
1122
-        for ($k=count($this->table)-1; $k>=0; $k--) {
1122
+        for ($k = count($this->table) - 1; $k >= 0; $k--) {
1123 1123
             if ($this->table[$k]['height']) {
1124 1124
                 $h = $this->table[$k]['height'];
1125 1125
                 if ($mode) {
1126
-                    $h+= $this->table[$k]['border']['t']['width'] + $this->table[$k]['padding']['t'] + 0.02;
1127
-                    $h+= $this->table[$k]['border']['b']['width'] + $this->table[$k]['padding']['b'] + 0.02;
1126
+                    $h += $this->table[$k]['border']['t']['width'] + $this->table[$k]['padding']['t'] + 0.02;
1127
+                    $h += $this->table[$k]['border']['b']['width'] + $this->table[$k]['padding']['b'] + 0.02;
1128 1128
                 }
1129 1129
                 return $h;
1130 1130
             }
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
      */
1141 1141
     public function getFloat()
1142 1142
     {
1143
-        if ($this->value['float']=='left')    return 'left';
1144
-        if ($this->value['float']=='right')   return 'right';
1143
+        if ($this->value['float'] == 'left')    return 'left';
1144
+        if ($this->value['float'] == 'right')   return 'right';
1145 1145
         return null;
1146 1146
     }
1147 1147
 
@@ -1155,8 +1155,8 @@  discard block
 block discarded – undo
1155 1155
     public function getLastValue($key)
1156 1156
     {
1157 1157
         $nb = count($this->table);
1158
-        if ($nb>0) {
1159
-            return $this->table[$nb-1][$key];
1158
+        if ($nb > 0) {
1159
+            return $this->table[$nb - 1][$key];
1160 1160
         } else {
1161 1161
             return null;
1162 1162
         }
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
      */
1171 1171
     protected function _getLastAbsoluteX()
1172 1172
     {
1173
-        for ($k=count($this->table)-1; $k>=0; $k--) {
1173
+        for ($k = count($this->table) - 1; $k >= 0; $k--) {
1174 1174
             if ($this->table[$k]['x'] && $this->table[$k]['position']) return $this->table[$k]['x'];
1175 1175
         }
1176 1176
         return $this->_pdf->getlMargin();
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
      */
1185 1185
     protected function _getLastAbsoluteY()
1186 1186
     {
1187
-        for ($k=count($this->table)-1; $k>=0; $k--) {
1187
+        for ($k = count($this->table) - 1; $k >= 0; $k--) {
1188 1188
             if ($this->table[$k]['y'] && $this->table[$k]['position']) return $this->table[$k]['y'];
1189 1189
         }
1190 1190
         return $this->_pdf->gettMargin();
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
         // get the list of the selectors of each tags
1208 1208
         $lst = array();
1209 1209
         $lst[] = $this->value['id_lst'];
1210
-        for ($i=count($this->table)-1; $i>=0; $i--) {
1210
+        for ($i = count($this->table) - 1; $i >= 0; $i--) {
1211 1211
             $lst[] = $this->table[$i]['id_lst'];
1212 1212
         }
1213 1213
 
@@ -1240,13 +1240,13 @@  discard block
 block discarded – undo
1240 1240
     protected function _getReccursiveStyle($key, $lst, $next = null)
1241 1241
     {
1242 1242
         // if next step
1243
-        if ($next!==null) {
1243
+        if ($next !== null) {
1244 1244
             // we remove this step
1245 1245
             if ($next) $key = trim(substr($key, 0, -strlen($next)));
1246 1246
             array_shift($lst);
1247 1247
 
1248 1248
             // if no more step to identify => return false
1249
-            if (!count($lst)) {
1249
+            if ( ! count($lst)) {
1250 1250
                 return false;
1251 1251
             }
1252 1252
         }
@@ -1254,18 +1254,18 @@  discard block
 block discarded – undo
1254 1254
         // for each selector of the current step
1255 1255
         foreach ($lst[0] as $name) {
1256 1256
             // if selector = key => ok
1257
-            if ($key==$name) {
1257
+            if ($key == $name) {
1258 1258
                 return true;
1259 1259
             }
1260 1260
 
1261 1261
             // if the end of the key = the selector and the next step is ok => ok
1262
-            if (substr($key, -strlen(' '.$name))==' '.$name && $this->_getReccursiveStyle($key, $lst, $name)) {
1262
+            if (substr($key, -strlen(' '.$name)) == ' '.$name && $this->_getReccursiveStyle($key, $lst, $name)) {
1263 1263
                 return true;
1264 1264
             }
1265 1265
         }
1266 1266
 
1267 1267
         // if we are not in the first step, we analyse the sub steps (the pareng tag of the current tag)
1268
-        if ($next!==null && $this->_getReccursiveStyle($key, $lst, '')) {
1268
+        if ($next !== null && $this->_getReccursiveStyle($key, $lst, '')) {
1269 1269
             return true;
1270 1270
         }
1271 1271
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
         foreach ($css as $value) {
1305 1305
 
1306 1306
             // if no border => return none
1307
-            if ($value=='none' || $value=='hidden') {
1307
+            if ($value == 'none' || $value == 'hidden') {
1308 1308
                 return $none;
1309 1309
             }
1310 1310
 
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
             $tmp = $this->convertToMM($value);
1313 1313
 
1314 1314
             // if the convert is ok => it is a width
1315
-            if ($tmp!==null) {
1315
+            if ($tmp !== null) {
1316 1316
                 $width = $tmp;
1317 1317
             // else, it could be the type
1318 1318
             } else if (in_array($value, array('solid', 'dotted', 'dashed', 'double'))) {
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
         }
1326 1326
 
1327 1327
         // if no witdh => return none
1328
-        if (!$width) return $none;
1328
+        if ( ! $width) return $none;
1329 1329
 
1330 1330
         // return the border properties
1331 1331
         return array('type' => $type, 'width' => $width, 'color' => $color);
@@ -1340,16 +1340,16 @@  discard block
 block discarded – undo
1340 1340
     protected function _duplicateBorder(&$val)
1341 1341
     {
1342 1342
         // 1 value => L => RTB
1343
-        if (count($val)==1) {
1343
+        if (count($val) == 1) {
1344 1344
             $val[1] = $val[0];
1345 1345
             $val[2] = $val[0];
1346 1346
             $val[3] = $val[0];
1347 1347
         // 2 values => L => R & T => B
1348
-        } else if (count($val)==2) {
1348
+        } else if (count($val) == 2) {
1349 1349
             $val[2] = $val[0];
1350 1350
             $val[3] = $val[1];
1351 1351
         // 3 values => T => B
1352
-        } else if (count($val)==3) {
1352
+        } else if (count($val) == 3) {
1353 1353
             $val[3] = $val[1];
1354 1354
         }
1355 1355
     }
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
             if ($ok) {
1394 1394
                 $value['color'] = $color;
1395 1395
             // else if transparent => no coloàr
1396
-            } else if ($val=='transparent') {
1396
+            } else if ($val == 'transparent') {
1397 1397
                 $value['color'] = null;
1398 1398
             // else
1399 1399
             } else {
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
                     $value['repeat'] = $repeat;
1406 1406
                 // else => it could only be a position
1407 1407
                 } else {
1408
-                    $pos.= ($pos ? ' ' : '').$val;
1408
+                    $pos .= ($pos ? ' ' : '').$val;
1409 1409
                 }
1410 1410
             }
1411 1411
         }
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
     public function convertBackgroundColor($css)
1429 1429
     {
1430 1430
         $res = null;
1431
-        if ($css=='transparent') return null;
1431
+        if ($css == 'transparent') return null;
1432 1432
         else                     return $this->convertToColor($css, $res);
1433 1433
     }
1434 1434
 
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
      */
1442 1442
     public function convertBackgroundImage($css)
1443 1443
     {
1444
-        if ($css=='none')
1444
+        if ($css == 'none')
1445 1445
             return null;
1446 1446
         else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match))
1447 1447
             return $match[1];
@@ -1466,11 +1466,11 @@  discard block
 block discarded – undo
1466 1466
         $css = explode(' ', $css);
1467 1467
 
1468 1468
         // we must have 2 values. if 0 or >2 : error. if 1 => put center for 2
1469
-        if (count($css)<2) {
1470
-            if (!$css[0]) return null;
1469
+        if (count($css) < 2) {
1470
+            if ( ! $css[0]) return null;
1471 1471
             $css[1] = 'center';
1472 1472
         }
1473
-        if (count($css)>2) return null;
1473
+        if (count($css) > 2) return null;
1474 1474
 
1475 1475
         // prepare the values
1476 1476
         $x = 0;
@@ -1478,21 +1478,21 @@  discard block
 block discarded – undo
1478 1478
         $res = true;
1479 1479
 
1480 1480
         // convert the first value
1481
-        if ($css[0]=='left')        $x = '0%';
1482
-        else if ($css[0]=='center') $x = '50%';
1483
-        else if ($css[0]=='right')  $x = '100%';
1484
-        else if ($css[0]=='top')    $y = '0%';
1485
-        else if ($css[0]=='bottom') $y = '100%';
1481
+        if ($css[0] == 'left')        $x = '0%';
1482
+        else if ($css[0] == 'center') $x = '50%';
1483
+        else if ($css[0] == 'right')  $x = '100%';
1484
+        else if ($css[0] == 'top')    $y = '0%';
1485
+        else if ($css[0] == 'bottom') $y = '100%';
1486 1486
         else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) $x = $css[0];
1487 1487
         else if ($this->convertToMM($css[0])) $x = $this->convertToMM($css[0]);
1488 1488
         else $res = false;
1489 1489
 
1490 1490
         // convert the second value
1491
-        if ($css[1]=='left')        $x = '0%';
1492
-        else if ($css[1]=='right')  $x = '100%';
1493
-        else if ($css[1]=='top')    $y = '0%';
1494
-        else if ($css[1]=='center') $y = '50%';
1495
-        else if ($css[1]=='bottom') $y = '100%';
1491
+        if ($css[1] == 'left')        $x = '0%';
1492
+        else if ($css[1] == 'right')  $x = '100%';
1493
+        else if ($css[1] == 'top')    $y = '0%';
1494
+        else if ($css[1] == 'center') $y = '50%';
1495
+        else if ($css[1] == 'bottom') $y = '100%';
1496 1496
         else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) $y = $css[1];
1497 1497
         else if ($this->convertToMM($css[1])) $y = $this->convertToMM($css[1]);
1498 1498
         else $res = false;
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
      */
1511 1511
     public function convertBackgroundRepeat($css)
1512 1512
     {
1513
-        switch($css)
1513
+        switch ($css)
1514 1514
         {
1515 1515
             case 'repeat':
1516 1516
                 return array(true, true);
@@ -1532,15 +1532,15 @@  discard block
 block discarded – undo
1532 1532
      * @param  float  $old parent distance
1533 1533
      * @return float  $value
1534 1534
      */
1535
-    public function convertToMM($css, $old=0.)
1535
+    public function convertToMM($css, $old = 0.)
1536 1536
     {
1537 1537
         $css = trim($css);
1538
-        if (preg_match('/^[0-9\.\-]+$/isU', $css))        $css.= 'px';
1539
-        if (preg_match('/^[0-9\.\-]+px$/isU', $css))      $css = 25.4/96. * str_replace('px', '', $css);
1540
-        else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) $css = 25.4/72. * str_replace('pt', '', $css);
1538
+        if (preg_match('/^[0-9\.\-]+$/isU', $css))        $css .= 'px';
1539
+        if (preg_match('/^[0-9\.\-]+px$/isU', $css))      $css = 25.4 / 96. * str_replace('px', '', $css);
1540
+        else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) $css = 25.4 / 72. * str_replace('pt', '', $css);
1541 1541
         else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) $css = 25.4 * str_replace('in', '', $css);
1542
-        else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) $css = 1.*str_replace('mm', '', $css);
1543
-        else if (preg_match('/^[0-9\.\-]+%$/isU', $css))  $css = 1.*$old*str_replace('%', '', $css)/100.;
1542
+        else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) $css = 1. * str_replace('mm', '', $css);
1543
+        else if (preg_match('/^[0-9\.\-]+%$/isU', $css))  $css = 1. * $old * str_replace('%', '', $css) / 100.;
1544 1544
         else                                              $css = null;
1545 1545
 
1546 1546
         return $css;
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
             $v = trim($v);
1563 1563
             if ($v) {
1564 1564
                 $v = $this->convertToMM($v, 0);
1565
-                if ($v!==null) {
1565
+                if ($v !== null) {
1566 1566
                     $css[$k] = $v;
1567 1567
                 } else {
1568 1568
                     unset($css[$k]);
@@ -1590,7 +1590,7 @@  discard block
 block discarded – undo
1590 1590
         $res = true;
1591 1591
 
1592 1592
         // if transparent => return null
1593
-        if (strtolower($css)=='transparent') return array(null, null, null);
1593
+        if (strtolower($css) == 'transparent') return array(null, null, null);
1594 1594
 
1595 1595
         // HTML color
1596 1596
         if (isset($this->_htmlColor[strtolower($css)])) {
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
             $r = $this->_convertSubColor($match[1]);
1623 1623
             $v = $this->_convertSubColor($match[2]);
1624 1624
             $b = $this->_convertSubColor($match[3]);
1625
-            return array($r*255., $v*255., $b*255.);
1625
+            return array($r * 255., $v * 255., $b * 255.);
1626 1626
         }
1627 1627
 
1628 1628
         // like cmyk(100, 100, 100, 100)
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
             $m = $this->_convertSubColor($match[2]);
1632 1632
             $y = $this->_convertSubColor($match[3]);
1633 1633
             $k = $this->_convertSubColor($match[4]);
1634
-            return array($c*100., $m*100., $y*100., $k*100.);
1634
+            return array($c * 100., $m * 100., $y * 100., $k * 100.);
1635 1635
         }
1636 1636
 
1637 1637
         $res = false;
@@ -1647,11 +1647,11 @@  discard block
 block discarded – undo
1647 1647
      */
1648 1648
     protected function _convertSubColor($c)
1649 1649
     {
1650
-        if (substr($c, -1)=='%') {
1651
-            $c = floatVal(substr($c, 0, -1))/100.;
1650
+        if (substr($c, -1) == '%') {
1651
+            $c = floatVal(substr($c, 0, -1)) / 100.;
1652 1652
         } else {
1653 1653
             $c = floatVal($c);
1654
-            if ($c>1) $c = $c/255.;
1654
+            if ($c > 1) $c = $c / 255.;
1655 1655
         }
1656 1656
 
1657 1657
         return $c;
@@ -1675,7 +1675,7 @@  discard block
 block discarded – undo
1675 1675
         preg_match_all('/([^{}]+){([^}]*)}/isU', $code, $match);
1676 1676
 
1677 1677
         // for each CSS code
1678
-        for ($k=0; $k<count($match[0]); $k++) {
1678
+        for ($k = 0; $k < count($match[0]); $k++) {
1679 1679
 
1680 1680
             // selectors
1681 1681
             $names = strtolower(trim($match[1][$k]));
@@ -1690,7 +1690,7 @@  discard block
 block discarded – undo
1690 1690
             $css = array();
1691 1691
             foreach ($styles as $style) {
1692 1692
                 $tmp = explode(':', $style);
1693
-                if (count($tmp)>1) {
1693
+                if (count($tmp) > 1) {
1694 1694
                     $cod = $tmp[0]; unset($tmp[0]); $tmp = implode(':', $tmp);
1695 1695
                     $css[trim(strtolower($cod))] = trim($tmp);
1696 1696
                 }
@@ -1705,10 +1705,10 @@  discard block
 block discarded – undo
1705 1705
                 $name = trim($name);
1706 1706
 
1707 1707
                 // if a selector with somethink lige :hover => continue
1708
-                if (strpos($name, ':')!==false) continue;
1708
+                if (strpos($name, ':') !== false) continue;
1709 1709
 
1710 1710
                 // save the value
1711
-                if (!isset($this->css[$name]))
1711
+                if ( ! isset($this->css[$name]))
1712 1712
                     $this->css[$name] = $css;
1713 1713
                 else
1714 1714
                     $this->css[$name] = array_merge($this->css[$name], $css);
@@ -1743,26 +1743,26 @@  discard block
 block discarded – undo
1743 1743
             // read the attributes name=value
1744 1744
             $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)';
1745 1745
             preg_match_all('/'.$prop.'/is', $code, $match);
1746
-            for ($k=0; $k<count($match[0]); $k++) {
1746
+            for ($k = 0; $k < count($match[0]); $k++) {
1747 1747
                 $tmp[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
1748 1748
             }
1749 1749
 
1750 1750
             // read the attributes name="value"
1751 1751
             $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]';
1752 1752
             preg_match_all('/'.$prop.'/is', $code, $match);
1753
-            for ($k=0; $k<count($match[0]); $k++) {
1753
+            for ($k = 0; $k < count($match[0]); $k++) {
1754 1754
                 $tmp[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
1755 1755
             }
1756 1756
 
1757 1757
             // read the attributes name='value'
1758 1758
             $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']";
1759 1759
             preg_match_all('/'.$prop.'/is', $code, $match);
1760
-            for ($k=0; $k<count($match[0]); $k++) {
1760
+            for ($k = 0; $k < count($match[0]); $k++) {
1761 1761
                 $tmp[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
1762 1762
             }
1763 1763
 
1764 1764
             // if type text/css => we keep it
1765
-            if (isset($tmp['type']) && strtolower($tmp['type'])=='text/css' && isset($tmp['href'])) {
1765
+            if (isset($tmp['type']) && strtolower($tmp['type']) == 'text/css' && isset($tmp['href'])) {
1766 1766
 
1767 1767
                 // get the href
1768 1768
                 $url = $tmp['href'];
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
                 $content = @file_get_contents($url);
1772 1772
 
1773 1773
                 // if "http://" in the url
1774
-                if (strpos($url, 'http://')!==false) {
1774
+                if (strpos($url, 'http://') !== false) {
1775 1775
 
1776 1776
                     // get the domain "http://xxx/"
1777 1777
                     $url = str_replace('http://', '', $url);
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
                     $urlMain = 'http://'.$url[0].'/';
1780 1780
 
1781 1781
                     // get the absolute url of the path
1782
-                    $urlSelf = $url; unset($urlSelf[count($urlSelf)-1]); $urlSelf = 'http://'.implode('/', $urlSelf).'/';
1782
+                    $urlSelf = $url; unset($urlSelf[count($urlSelf) - 1]); $urlSelf = 'http://'.implode('/', $urlSelf).'/';
1783 1783
 
1784 1784
                     // adapt the url in the css content
1785 1785
                     $content = preg_replace('/url\(([^\\\\][^)]*)\)/isU', 'url('.$urlSelf.'$1)', $content);
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
                 }
1791 1791
 
1792 1792
                 // add to the CSS content
1793
-                $style.= $content."\n";
1793
+                $style .= $content."\n";
1794 1794
             }
1795 1795
         }
1796 1796
 
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
             // add to the CSS content
1804 1804
             $code = str_replace('<!--', '', $code);
1805 1805
             $code = str_replace('-->', '', $code);
1806
-            $style.= $code."\n";
1806
+            $style .= $code."\n";
1807 1807
         }
1808 1808
 
1809 1809
         //analyse the css content
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/html2pdf/html2pdf.php 1 patch
Spacing   +959 added lines, -959 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @version 4.03
10 10
  */
11 11
 
12
-if (!defined('__CLASS_HTML2PDF__')) {
12
+if ( ! defined('__CLASS_HTML2PDF__')) {
13 13
 
14 14
     define('__CLASS_HTML2PDF__', '4.03');
15 15
     define('HTML2PDF_USED_TCPDF_VERSION', '5.0.002');
@@ -40,77 +40,77 @@  discard block
 block discarded – undo
40 40
          */
41 41
         public $parsingHtml = null;
42 42
 
43
-        protected $_langue           = 'fr';        // locale of the messages
44
-        protected $_orientation      = 'P';         // page orientation : Portrait ou Landscape
45
-        protected $_format           = 'A4';        // page format : A4, A3, ...
46
-        protected $_encoding         = '';          // charset encoding
47
-        protected $_unicode          = true;        // means that the input text is unicode (default = true)
48
-
49
-        protected $_testTdInOnepage  = true;        // test of TD that can not take more than one page
50
-        protected $_testIsImage      = true;        // test if the images exist or not
51
-        protected $_testIsDeprecated = false;       // test the deprecated functions
52
-
53
-        protected $_parsePos         = 0;           // position in the parsing
54
-        protected $_tempPos          = 0;           // temporary position for complex table
55
-        protected $_page             = 0;           // current page number
56
-
57
-        protected $_subHtml          = null;        // sub html
58
-        protected $_subPart          = false;       // sub HTML2PDF
59
-        protected $_subHEADER        = array();     // sub action to make the header
60
-        protected $_subFOOTER        = array();     // sub action to make the footer
61
-        protected $_subSTATES        = array();     // array to save some parameters
62
-
63
-        protected $_isSubPart        = false;       // flag : in a sub html2pdf
64
-        protected $_isInThead        = false;       // flag : in a thead
65
-        protected $_isInTfoot        = false;       // flag : in a tfoot
66
-        protected $_isInOverflow     = false;       // flag : in a overflow
67
-        protected $_isInFooter       = false;       // flag : in a footer
68
-        protected $_isInDraw         = null;        // flag : in a draw (svg)
69
-        protected $_isAfterFloat     = false;       // flag : is just after a float
70
-        protected $_isInForm         = false;       // flag : is in a float. false / action of the form
71
-        protected $_isInLink         = '';          // flag : is in a link. empty / href of the link
72
-        protected $_isInParagraph    = false;       // flag : is in a paragraph
73
-        protected $_isForOneLine     = false;       // flag : in a specific sub html2pdf to have the height of the next line
74
-
75
-        protected $_maxX             = 0;           // maximum X of the current zone
76
-        protected $_maxY             = 0;           // maximum Y of the current zone
77
-        protected $_maxE             = 0;           // number of elements in the current zone
78
-        protected $_maxH             = 0;           // maximum height of the line in the current zone
79
-        protected $_maxSave          = array();     // save the maximums of the current zone
80
-        protected $_currentH         = 0;           // height of the current line
81
-
82
-        protected $_defaultLeft      = 0;           // default marges of the page
43
+        protected $_langue           = 'fr'; // locale of the messages
44
+        protected $_orientation      = 'P'; // page orientation : Portrait ou Landscape
45
+        protected $_format           = 'A4'; // page format : A4, A3, ...
46
+        protected $_encoding         = ''; // charset encoding
47
+        protected $_unicode          = true; // means that the input text is unicode (default = true)
48
+
49
+        protected $_testTdInOnepage  = true; // test of TD that can not take more than one page
50
+        protected $_testIsImage      = true; // test if the images exist or not
51
+        protected $_testIsDeprecated = false; // test the deprecated functions
52
+
53
+        protected $_parsePos         = 0; // position in the parsing
54
+        protected $_tempPos          = 0; // temporary position for complex table
55
+        protected $_page             = 0; // current page number
56
+
57
+        protected $_subHtml          = null; // sub html
58
+        protected $_subPart          = false; // sub HTML2PDF
59
+        protected $_subHEADER        = array(); // sub action to make the header
60
+        protected $_subFOOTER        = array(); // sub action to make the footer
61
+        protected $_subSTATES        = array(); // array to save some parameters
62
+
63
+        protected $_isSubPart        = false; // flag : in a sub html2pdf
64
+        protected $_isInThead        = false; // flag : in a thead
65
+        protected $_isInTfoot        = false; // flag : in a tfoot
66
+        protected $_isInOverflow     = false; // flag : in a overflow
67
+        protected $_isInFooter       = false; // flag : in a footer
68
+        protected $_isInDraw         = null; // flag : in a draw (svg)
69
+        protected $_isAfterFloat     = false; // flag : is just after a float
70
+        protected $_isInForm         = false; // flag : is in a float. false / action of the form
71
+        protected $_isInLink         = ''; // flag : is in a link. empty / href of the link
72
+        protected $_isInParagraph    = false; // flag : is in a paragraph
73
+        protected $_isForOneLine     = false; // flag : in a specific sub html2pdf to have the height of the next line
74
+
75
+        protected $_maxX             = 0; // maximum X of the current zone
76
+        protected $_maxY             = 0; // maximum Y of the current zone
77
+        protected $_maxE             = 0; // number of elements in the current zone
78
+        protected $_maxH             = 0; // maximum height of the line in the current zone
79
+        protected $_maxSave          = array(); // save the maximums of the current zone
80
+        protected $_currentH         = 0; // height of the current line
81
+
82
+        protected $_defaultLeft      = 0; // default marges of the page
83 83
         protected $_defaultTop       = 0;
84 84
         protected $_defaultRight     = 0;
85 85
         protected $_defaultBottom    = 0;
86
-        protected $_defaultFont      = null;        // default font to use, is the asked font does not exist
86
+        protected $_defaultFont      = null; // default font to use, is the asked font does not exist
87 87
 
88
-        protected $_margeLeft        = 0;           // current marges of the page
88
+        protected $_margeLeft        = 0; // current marges of the page
89 89
         protected $_margeTop         = 0;
90 90
         protected $_margeRight       = 0;
91 91
         protected $_margeBottom      = 0;
92
-        protected $_marges           = array();     // save the different marges of the current page
93
-        protected $_pageMarges       = array();     // float marges of the current page
94
-        protected $_background       = array();     // background informations
92
+        protected $_marges           = array(); // save the different marges of the current page
93
+        protected $_pageMarges       = array(); // float marges of the current page
94
+        protected $_background       = array(); // background informations
95 95
 
96 96
 
97
-        protected $_firstPage        = true;        // flag : first page
98
-        protected $_defList          = array();     // table to save the stats of the tags UL and OL
97
+        protected $_firstPage        = true; // flag : first page
98
+        protected $_defList          = array(); // table to save the stats of the tags UL and OL
99 99
 
100
-        protected $_lstAnchor        = array();     // list of the anchors
101
-        protected $_lstField         = array();     // list of the fields
102
-        protected $_lstSelect        = array();     // list of the options of the current select
103
-        protected $_previousCall     = null;        // last action called
100
+        protected $_lstAnchor        = array(); // list of the anchors
101
+        protected $_lstField         = array(); // list of the fields
102
+        protected $_lstSelect        = array(); // list of the options of the current select
103
+        protected $_previousCall     = null; // last action called
104 104
 
105
-        protected $_debugActif       = false;       // flag : mode debug is active
106
-        protected $_debugOkUsage     = false;       // flag : the function memory_get_usage exist
107
-        protected $_debugOkPeak      = false;       // flag : the function memory_get_peak_usage exist
108
-        protected $_debugLevel       = 0;           // level in the debug
109
-        protected $_debugStartTime   = 0;           // debug start time
110
-        protected $_debugLastTime    = 0;           // debug stop time
105
+        protected $_debugActif       = false; // flag : mode debug is active
106
+        protected $_debugOkUsage     = false; // flag : the function memory_get_usage exist
107
+        protected $_debugOkPeak      = false; // flag : the function memory_get_peak_usage exist
108
+        protected $_debugLevel       = 0; // level in the debug
109
+        protected $_debugStartTime   = 0; // debug start time
110
+        protected $_debugLastTime    = 0; // debug stop time
111 111
 
112
-        static protected $_subobj    = null;        // object html2pdf prepared in order to accelerate the creation of sub html2pdf
113
-        static protected $_tables    = array();     // static table to prepare the nested html tables
112
+        static protected $_subobj    = null; // object html2pdf prepared in order to accelerate the creation of sub html2pdf
113
+        static protected $_tables    = array(); // static table to prepare the nested html tables
114 114
 
115 115
         /**
116 116
          * class constructor
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
          * @param  array    $marges      Default marges (left, top, right, bottom)
125 125
          * @return HTML2PDF $this
126 126
          */
127
-        public function __construct($orientation = 'P', $format = 'A4', $langue='en', $unicode=true, $encoding='UTF-8', $marges = array(5, 5, 5, 8))
127
+        public function __construct($orientation = 'P', $format = 'A4', $langue = 'en', $unicode = true, $encoding = 'UTF-8', $marges = array(5, 5, 5, 8))
128 128
         {
129 129
             // init the page number
130 130
             $this->_page         = 0;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $this->_subPart = false;
163 163
 
164 164
             // init the marges of the page
165
-            if (!is_array($marges)) $marges = array($marges, $marges, $marges, $marges);
165
+            if ( ! is_array($marges)) $marges = array($marges, $marges, $marges, $marges);
166 166
             $this->_setDefaultMargins($marges[0], $marges[1], $marges[2], $marges[3]);
167 167
             $this->_setMargins();
168 168
             $this->_marges = array();
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
          * @return HTML2PDF $this
287 287
          * @see TCPDF::addFont
288 288
          */
289
-        public function addFont($family, $style='', $file='')
289
+        public function addFont($family, $style = '', $file = '')
290 290
         {
291 291
             $this->pdf->AddFont($family, $style, $file);
292 292
 
@@ -356,17 +356,17 @@  discard block
 block discarded – undo
356 356
             }
357 357
 
358 358
             // complete parameters
359
-            if ($dest===false) $dest = 'I';
360
-            if ($dest===true)  $dest = 'S';
361
-            if ($dest==='')    $dest = 'I';
362
-            if ($name=='')     $name='document.pdf';
359
+            if ($dest === false) $dest = 'I';
360
+            if ($dest === true)  $dest = 'S';
361
+            if ($dest === '')    $dest = 'I';
362
+            if ($name == '')     $name = 'document.pdf';
363 363
 
364 364
             // clean up the destination
365 365
             $dest = strtoupper($dest);
366
-            if (!in_array($dest, array('I', 'D', 'F', 'S', 'FI','FD'))) $dest = 'I';
366
+            if ( ! in_array($dest, array('I', 'D', 'F', 'S', 'FI', 'FD'))) $dest = 'I';
367 367
 
368 368
             // the name must be a PDF name
369
-            if (strtolower(substr($name, -4))!='.pdf') {
369
+            if (strtolower(substr($name, -4)) != '.pdf') {
370 370
                 throw new HTML2PDF_exception(0, 'The output document name "'.$name.'" is not a PDF name');
371 371
             }
372 372
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
             // extract the content
424 424
             $res = explode('<body', $html);
425
-            if (count($res)<2) return $html;
425
+            if (count($res) < 2) return $html;
426 426
             $content = '<page'.$res[1];
427 427
             $content = explode('</body', $content);
428 428
             $content = $content[0].'</page>';
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 
459 459
             $this->parsingCss->setOnlyLeft();
460 460
 
461
-            $this->_setNewPage($format, $orientation, null, null, ($myLastPageGroup!==null));
461
+            $this->_setNewPage($format, $orientation, null, null, ($myLastPageGroup !== null));
462 462
 
463 463
             $this->_saveMargin(0, 0, $marge);
464 464
             $this->_defList = $defLIST;
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
          */
514 514
         protected function _setDefaultMargins($left, $top, $right = null, $bottom = null)
515 515
         {
516
-            if ($right===null)  $right = $left;
517
-            if ($bottom===null) $bottom = 8;
516
+            if ($right === null)  $right = $left;
517
+            if ($bottom === null) $bottom = 8;
518 518
 
519 519
             $this->_defaultLeft   = $this->parsingCss->ConvertToMM($left.'mm');
520 520
             $this->_defaultTop    = $this->parsingCss->ConvertToMM($top.'mm');
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
          * @param  integer $curr real position in the html parseur (if break line in the write of a text)
533 533
          * @param  boolean $resetPageNumber
534 534
          */
535
-        protected function _setNewPage($format = null, $orientation = '', $background = null, $curr = null, $resetPageNumber=false)
535
+        protected function _setNewPage($format = null, $orientation = '', $background = null, $curr = null, $resetPageNumber = false)
536 536
         {
537 537
             $this->_firstPage = false;
538 538
 
539 539
             $this->_format = $format ? $format : $this->_format;
540 540
             $this->_orientation = $orientation ? $orientation : $this->_orientation;
541
-            $this->_background = $background!==null ? $background : $this->_background;
541
+            $this->_background = $background !== null ? $background : $this->_background;
542 542
             $this->_maxY = 0;
543 543
             $this->_maxX = 0;
544 544
             $this->_maxH = 0;
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 
559 559
             $this->_page++;
560 560
 
561
-            if (!$this->_subPart && !$this->_isSubPart) {
561
+            if ( ! $this->_subPart && ! $this->_isSubPart) {
562 562
                 if (is_array($this->_background)) {
563 563
                     if (isset($this->_background['color']) && $this->_background['color']) {
564 564
                         $this->pdf->setFillColorArray($this->_background['color']);
@@ -588,9 +588,9 @@  discard block
 block discarded – undo
588 588
         protected function _setMargins()
589 589
         {
590 590
             // prepare the margins
591
-            $this->_margeLeft   = $this->_defaultLeft   + (isset($this->_background['left'])   ? $this->_background['left']   : 0);
592
-            $this->_margeRight  = $this->_defaultRight  + (isset($this->_background['right'])  ? $this->_background['right']  : 0);
593
-            $this->_margeTop    = $this->_defaultTop    + (isset($this->_background['top'])    ? $this->_background['top']    : 0);
591
+            $this->_margeLeft   = $this->_defaultLeft + (isset($this->_background['left']) ? $this->_background['left'] : 0);
592
+            $this->_margeRight  = $this->_defaultRight + (isset($this->_background['right']) ? $this->_background['right'] : 0);
593
+            $this->_margeTop    = $this->_defaultTop + (isset($this->_background['top']) ? $this->_background['top'] : 0);
594 594
             $this->_margeBottom = $this->_defaultBottom + (isset($this->_background['bottom']) ? $this->_background['bottom'] : 0);
595 595
 
596 596
             // set the PDF margins
@@ -599,10 +599,10 @@  discard block
 block discarded – undo
599 599
 
600 600
             // set the float Margins
601 601
             $this->_pageMarges = array();
602
-            if ($this->_isInParagraph!==false) {
603
-                $this->_pageMarges[floor($this->_margeTop*100)] = array($this->_isInParagraph[0], $this->pdf->getW()-$this->_isInParagraph[1]);
602
+            if ($this->_isInParagraph !== false) {
603
+                $this->_pageMarges[floor($this->_margeTop * 100)] = array($this->_isInParagraph[0], $this->pdf->getW() - $this->_isInParagraph[1]);
604 604
             } else {
605
-                $this->_pageMarges[floor($this->_margeTop*100)] = array($this->_margeLeft, $this->pdf->getW()-$this->_margeRight);
605
+                $this->_pageMarges[floor($this->_margeTop * 100)] = array($this->_margeLeft, $this->pdf->getW() - $this->_margeRight);
606 606
             }
607 607
         }
608 608
 
@@ -614,28 +614,28 @@  discard block
 block discarded – undo
614 614
          * @param  boolean $level (true=up, false=down, null=nothing to do)
615 615
          * @return $this
616 616
          */
617
-        protected function _DEBUG_add($name, $level=null)
617
+        protected function _DEBUG_add($name, $level = null)
618 618
         {
619 619
             // if true : UP
620
-            if ($level===true) $this->_debugLevel++;
620
+            if ($level === true) $this->_debugLevel++;
621 621
 
622
-            $name   = str_repeat('  ', $this->_debugLevel). $name.($level===true ? ' Begin' : ($level===false ? ' End' : ''));
622
+            $name = str_repeat('  ', $this->_debugLevel).$name.($level === true ? ' Begin' : ($level === false ? ' End' : ''));
623 623
             $time  = microtime(true);
624 624
             $usage = ($this->_debugOkUsage ? memory_get_usage() : 0);
625 625
             $peak  = ($this->_debugOkPeak ? memory_get_peak_usage() : 0);
626 626
 
627 627
             $this->_DEBUG_stepline(
628 628
                 $name,
629
-                number_format(($time - $this->_debugStartTime)*1000, 1, '.', ' ').' ms',
630
-                number_format(($time - $this->_debugLastTime)*1000, 1, '.', ' ').' ms',
631
-                number_format($usage/1024, 1, '.', ' ').' Ko',
632
-                number_format($peak/1024, 1, '.', ' ').' Ko'
629
+                number_format(($time - $this->_debugStartTime) * 1000, 1, '.', ' ').' ms',
630
+                number_format(($time - $this->_debugLastTime) * 1000, 1, '.', ' ').' ms',
631
+                number_format($usage / 1024, 1, '.', ' ').' Ko',
632
+                number_format($peak / 1024, 1, '.', ' ').' Ko'
633 633
             );
634 634
 
635 635
             $this->_debugLastTime = $time;
636 636
 
637 637
             // it false : DOWN
638
-            if ($level===false) $this->_debugLevel--;
638
+            if ($level === false) $this->_debugLevel--;
639 639
 
640 640
             return $this;
641 641
         }
@@ -671,11 +671,11 @@  discard block
 block discarded – undo
671 671
          */
672 672
         protected function _getMargins($y)
673 673
         {
674
-            $y = floor($y*100);
675
-            $x = array($this->pdf->getlMargin(), $this->pdf->getW()-$this->pdf->getrMargin());
674
+            $y = floor($y * 100);
675
+            $x = array($this->pdf->getlMargin(), $this->pdf->getW() - $this->pdf->getrMargin());
676 676
 
677 677
             foreach ($this->_pageMarges as $mY => $mX)
678
-                if ($mY<=$y) $x = $mX;
678
+                if ($mY <= $y) $x = $mX;
679 679
 
680 680
             return $x;
681 681
         }
@@ -697,18 +697,18 @@  discard block
 block discarded – undo
697 697
             $oldBottom = $this->_getMargins($yBottom);
698 698
 
699 699
             // update the top float margin
700
-            if ($float=='left'  && $oldTop[0]<$xRight) $oldTop[0] = $xRight;
701
-            if ($float=='right' && $oldTop[1]>$xLeft)  $oldTop[1] = $xLeft;
700
+            if ($float == 'left' && $oldTop[0] < $xRight) $oldTop[0] = $xRight;
701
+            if ($float == 'right' && $oldTop[1] > $xLeft)  $oldTop[1] = $xLeft;
702 702
 
703
-            $yTop = floor($yTop*100);
704
-            $yBottom = floor($yBottom*100);
703
+            $yTop = floor($yTop * 100);
704
+            $yBottom = floor($yBottom * 100);
705 705
 
706 706
             // erase all the float margins that are smaller than the new one
707 707
             foreach ($this->_pageMarges as $mY => $mX) {
708
-                if ($mY<$yTop) continue;
709
-                if ($mY>$yBottom) break;
710
-                if ($float=='left' && $this->_pageMarges[$mY][0]<$xRight)  unset($this->_pageMarges[$mY]);
711
-                if ($float=='right' && $this->_pageMarges[$mY][1]>$xLeft) unset($this->_pageMarges[$mY]);
708
+                if ($mY < $yTop) continue;
709
+                if ($mY > $yBottom) break;
710
+                if ($float == 'left' && $this->_pageMarges[$mY][0] < $xRight)  unset($this->_pageMarges[$mY]);
711
+                if ($float == 'right' && $this->_pageMarges[$mY][1] > $xLeft) unset($this->_pageMarges[$mY]);
712 712
             }
713 713
 
714 714
             // save the new Top and Bottom margins
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
             // prepare for float margins
742 742
             $this->_pageMarges = array();
743
-            $this->_pageMarges[floor($mt*100)] = array($ml, $this->pdf->getW()-$mr);
743
+            $this->_pageMarges[floor($mt * 100)] = array($ml, $this->pdf->getW() - $mr);
744 744
         }
745 745
 
746 746
         /**
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
                 $ml = $this->_margeLeft;
761 761
                 $mt = 0;
762 762
                 $mr = $this->_margeRight;
763
-                $mP = array($mt => array($ml, $this->pdf->getW()-$mr));
763
+                $mP = array($mt => array($ml, $this->pdf->getW() - $mr));
764 764
             }
765 765
 
766 766
             $this->pdf->SetMargins($ml, $mt, $mr);
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
          */
807 807
         protected function _setPageHeader()
808 808
         {
809
-            if (!count($this->_subHEADER)) return false;
809
+            if ( ! count($this->_subHEADER)) return false;
810 810
 
811 811
             $oldParsePos = $this->_parsePos;
812 812
             $oldParseCode = $this->parsingHtml->code;
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
          */
827 827
         protected function _setPageFooter()
828 828
         {
829
-            if (!count($this->_subFOOTER)) return false;
829
+            if ( ! count($this->_subFOOTER)) return false;
830 830
 
831 831
             $oldParsePos = $this->_parsePos;
832 832
             $oldParseCode = $this->parsingHtml->code;
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
             // get the margins for the current line
866 866
             list($lx, $rx) = $this->_getMargins($this->pdf->getY());
867 867
             $this->pdf->setX($lx);
868
-            $wMax = $rx-$lx;
868
+            $wMax = $rx - $lx;
869 869
             $this->_currentH = 0;
870 870
 
871 871
             // if subPart => return because align left
@@ -877,39 +877,39 @@  discard block
 block discarded – undo
877 877
             // create the sub object
878 878
             $sub = null;
879 879
             $this->_createSubHTML($sub);
880
-            $sub->_saveMargin(0, 0, $sub->pdf->getW()-$wMax);
880
+            $sub->_saveMargin(0, 0, $sub->pdf->getW() - $wMax);
881 881
             $sub->_isForOneLine = true;
882 882
             $sub->_parsePos = $this->_parsePos;
883 883
             $sub->parsingHtml->code = $this->parsingHtml->code;
884 884
 
885 885
             // if $curr => adapt the current position of the parsing
886
-            if ($curr!==null && $sub->parsingHtml->code[$this->_parsePos]['name']=='write') {
886
+            if ($curr !== null && $sub->parsingHtml->code[$this->_parsePos]['name'] == 'write') {
887 887
                 $txt = $sub->parsingHtml->code[$this->_parsePos]['param']['txt'];
888 888
                 $txt = str_replace('[[page_cu]]', $sub->pdf->getMyNumPage($this->_page), $txt);
889
-                $sub->parsingHtml->code[$this->_parsePos]['param']['txt'] = substr($txt, $curr+1);
889
+                $sub->parsingHtml->code[$this->_parsePos]['param']['txt'] = substr($txt, $curr + 1);
890 890
             } else
891 891
                 $sub->_parsePos++;
892 892
 
893 893
             // for each element of the parsing => load the action
894 894
             $res = null;
895
-            for ($sub->_parsePos; $sub->_parsePos<count($sub->parsingHtml->code); $sub->_parsePos++) {
895
+            for ($sub->_parsePos; $sub->_parsePos < count($sub->parsingHtml->code); $sub->_parsePos++) {
896 896
                 $action = $sub->parsingHtml->code[$sub->_parsePos];
897 897
                 $res = $sub->_executeAction($action);
898
-                if (!$res) break;
898
+                if ( ! $res) break;
899 899
             }
900 900
 
901 901
             $w = $sub->_maxX; // max width
902 902
             $h = $sub->_maxH; // max height
903
-            $e = ($res===null ? $sub->_maxE : 0); // maxnumber of elemets on the line
903
+            $e = ($res === null ? $sub->_maxE : 0); // maxnumber of elemets on the line
904 904
 
905 905
             // destroy the sub HTML
906 906
             $this->_destroySubHTML($sub);
907 907
 
908 908
             // adapt the start of the line, depending on the text-align
909
-            if ($this->parsingCss->value['text-align']=='center')
910
-                $this->pdf->setX(($rx+$this->pdf->getX()-$w)*0.5-0.01);
911
-            else if ($this->parsingCss->value['text-align']=='right')
912
-                $this->pdf->setX($rx-$w-0.01);
909
+            if ($this->parsingCss->value['text-align'] == 'center')
910
+                $this->pdf->setX(($rx + $this->pdf->getX() - $w) * 0.5 - 0.01);
911
+            else if ($this->parsingCss->value['text-align'] == 'right')
912
+                $this->pdf->setX($rx - $w - 0.01);
913 913
             else
914 914
                 $this->pdf->setX($lx);
915 915
 
@@ -917,8 +917,8 @@  discard block
 block discarded – undo
917 917
             $this->_currentH = $h;
918 918
 
919 919
             // if justify => set the word spacing
920
-            if ($this->parsingCss->value['text-align']=='justify' && $e>1) {
921
-                $this->pdf->setWordSpacing(($wMax-$w)/($e-1));
920
+            if ($this->parsingCss->value['text-align'] == 'justify' && $e > 1) {
921
+                $this->pdf->setWordSpacing(($wMax - $w) / ($e - 1));
922 922
             } else {
923 923
                 $this->pdf->setWordSpacing(0);
924 924
             }
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                                         $this->_langue,
941 941
                                         $this->_unicode,
942 942
                                         $this->_encoding,
943
-                                        array($this->_defaultLeft,$this->_defaultTop,$this->_defaultRight,$this->_defaultBottom)
943
+                                        array($this->_defaultLeft, $this->_defaultTop, $this->_defaultRight, $this->_defaultBottom)
944 944
                                     );
945 945
 
946 946
             // init
@@ -965,21 +965,21 @@  discard block
 block discarded – undo
965 965
          * @param  &HTML2PDF $subHtml sub HTML2PDF to create
966 966
          * @param  integer   $cellmargin if in a TD : cellmargin of this td
967 967
          */
968
-        protected function _createSubHTML(&$subHtml, $cellmargin=0)
968
+        protected function _createSubHTML(&$subHtml, $cellmargin = 0)
969 969
         {
970 970
             // prepare the subObject, if never prepare before
971
-            if (HTML2PDF::$_subobj===null) {
971
+            if (HTML2PDF::$_subobj === null) {
972 972
                 $this->_prepareSubObj();
973 973
             }
974 974
 
975 975
             // calculate the width to use
976 976
             if ($this->parsingCss->value['width']) {
977
-                $marge = $cellmargin*2;
978
-                $marge+= $this->parsingCss->value['padding']['l'] + $this->parsingCss->value['padding']['r'];
979
-                $marge+= $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['border']['r']['width'];
977
+                $marge = $cellmargin * 2;
978
+                $marge += $this->parsingCss->value['padding']['l'] + $this->parsingCss->value['padding']['r'];
979
+                $marge += $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['border']['r']['width'];
980 980
                 $marge = $this->pdf->getW() - $this->parsingCss->value['width'] + $marge;
981 981
             } else {
982
-                $marge = $this->_margeLeft+$this->_margeRight;
982
+                $marge = $this->_margeLeft + $this->_margeRight;
983 983
             }
984 984
 
985 985
             // BUGFIX : we have to call the method, because of a bug in php 5.1.6
@@ -1020,29 +1020,29 @@  discard block
 block discarded – undo
1020 1020
          */
1021 1021
         protected function _listeArab2Rom($nbArabic)
1022 1022
         {
1023
-            $nbBaseTen    = array('I','X','C','M');
1024
-            $nbBaseFive    = array('V','L','D');
1025
-            $nbRoman    = '';
1023
+            $nbBaseTen = array('I', 'X', 'C', 'M');
1024
+            $nbBaseFive = array('V', 'L', 'D');
1025
+            $nbRoman = '';
1026 1026
 
1027
-            if ($nbArabic<1)    return $nbArabic;
1028
-            if ($nbArabic>3999) return $nbArabic;
1027
+            if ($nbArabic < 1)    return $nbArabic;
1028
+            if ($nbArabic > 3999) return $nbArabic;
1029 1029
 
1030
-            for ($i=3; $i>=0 ; $i--) {
1031
-                $chiffre=floor($nbArabic/pow(10, $i));
1032
-                if ($chiffre>=1) {
1033
-                    $nbArabic=$nbArabic-$chiffre*pow(10, $i);
1034
-                    if ($chiffre<=3) {
1035
-                        for ($j=$chiffre; $j>=1; $j--) {
1036
-                            $nbRoman=$nbRoman.$nbBaseTen[$i];
1030
+            for ($i = 3; $i >= 0; $i--) {
1031
+                $chiffre = floor($nbArabic / pow(10, $i));
1032
+                if ($chiffre >= 1) {
1033
+                    $nbArabic = $nbArabic - $chiffre * pow(10, $i);
1034
+                    if ($chiffre <= 3) {
1035
+                        for ($j = $chiffre; $j >= 1; $j--) {
1036
+                            $nbRoman = $nbRoman.$nbBaseTen[$i];
1037 1037
                         }
1038
-                    } else if ($chiffre==9) {
1039
-                        $nbRoman=$nbRoman.$nbBaseTen[$i].$nbBaseTen[$i+1];
1040
-                    } else if ($chiffre==4) {
1041
-                    $nbRoman=$nbRoman.$nbBaseTen[$i].$nbBaseFive[$i];
1038
+                    } else if ($chiffre == 9) {
1039
+                        $nbRoman = $nbRoman.$nbBaseTen[$i].$nbBaseTen[$i + 1];
1040
+                    } else if ($chiffre == 4) {
1041
+                    $nbRoman = $nbRoman.$nbBaseTen[$i].$nbBaseFive[$i];
1042 1042
                     } else {
1043
-                        $nbRoman=$nbRoman.$nbBaseFive[$i];
1044
-                        for ($j=$chiffre-5; $j>=1; $j--) {
1045
-                            $nbRoman=$nbRoman.$nbBaseTen[$i];
1043
+                        $nbRoman = $nbRoman.$nbBaseFive[$i];
1044
+                        for ($j = $chiffre - 5; $j >= 1; $j--) {
1045
+                            $nbRoman = $nbRoman.$nbBaseTen[$i];
1046 1046
                         }
1047 1047
                     }
1048 1048
                 }
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
          */
1058 1058
         protected function _listeAddLi()
1059 1059
         {
1060
-            $this->_defList[count($this->_defList)-1]['nb']++;
1060
+            $this->_defList[count($this->_defList) - 1]['nb']++;
1061 1061
         }
1062 1062
 
1063 1063
         /**
@@ -1090,14 +1090,14 @@  discard block
 block discarded – undo
1090 1090
          */
1091 1091
         protected function _listeGetLi()
1092 1092
         {
1093
-            $im = $this->_defList[count($this->_defList)-1]['img'];
1094
-            $st = $this->_defList[count($this->_defList)-1]['style'];
1095
-            $nb = $this->_defList[count($this->_defList)-1]['nb'];
1096
-            $up = (substr($st, 0, 6)=='upper-');
1093
+            $im = $this->_defList[count($this->_defList) - 1]['img'];
1094
+            $st = $this->_defList[count($this->_defList) - 1]['style'];
1095
+            $nb = $this->_defList[count($this->_defList) - 1]['nb'];
1096
+            $up = (substr($st, 0, 6) == 'upper-');
1097 1097
 
1098 1098
             if ($im) return array(false, false, $im);
1099 1099
 
1100
-            switch($st)
1100
+            switch ($st)
1101 1101
             {
1102 1102
                 case 'none':
1103 1103
                     return array('helvetica', true, ' ');
@@ -1105,11 +1105,11 @@  discard block
 block discarded – undo
1105 1105
                 case 'upper-alpha':
1106 1106
                 case 'lower-alpha':
1107 1107
                     $str = '';
1108
-                    while ($nb>26) {
1109
-                        $str = chr(96+$nb%26).$str;
1110
-                        $nb = floor($nb/26);
1108
+                    while ($nb > 26) {
1109
+                        $str = chr(96 + $nb % 26).$str;
1110
+                        $nb = floor($nb / 26);
1111 1111
                     }
1112
-                    $str = chr(96+$nb).$str;
1112
+                    $str = chr(96 + $nb).$str;
1113 1113
 
1114 1114
                     return array('helvetica', false, ($up ? strtoupper($str) : $str).'.');
1115 1115
 
@@ -1156,11 +1156,11 @@  discard block
 block discarded – undo
1156 1156
             }
1157 1157
 
1158 1158
             // prepare the datas
1159
-            if (!in_array($type, array('ul', 'ol'))) $type = 'ul';
1160
-            if (!in_array($style, array('lower-alpha', 'upper-alpha', 'upper-roman', 'lower-roman', 'decimal', 'square', 'circle', 'disc', 'none'))) $style = '';
1159
+            if ( ! in_array($type, array('ul', 'ol'))) $type = 'ul';
1160
+            if ( ! in_array($style, array('lower-alpha', 'upper-alpha', 'upper-roman', 'lower-roman', 'decimal', 'square', 'circle', 'disc', 'none'))) $style = '';
1161 1161
 
1162
-            if (!$style) {
1163
-                if ($type=='ul')    $style = 'disc';
1162
+            if ( ! $style) {
1163
+                if ($type == 'ul')    $style = 'disc';
1164 1164
                 else                $style = 'decimal';
1165 1165
             }
1166 1166
 
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
         protected function _listeDelLevel()
1177 1177
         {
1178 1178
             if (count($this->_defList)) {
1179
-                unset($this->_defList[count($this->_defList)-1]);
1179
+                unset($this->_defList[count($this->_defList) - 1]);
1180 1180
                 $this->_defList = array_values($this->_defList);
1181 1181
             }
1182 1182
         }
@@ -1189,13 +1189,13 @@  discard block
 block discarded – undo
1189 1189
         protected function _makeHTMLcode()
1190 1190
         {
1191 1191
             // foreach elements of the parsing
1192
-            for ($this->_parsePos=0; $this->_parsePos<count($this->parsingHtml->code); $this->_parsePos++) {
1192
+            for ($this->_parsePos = 0; $this->_parsePos < count($this->parsingHtml->code); $this->_parsePos++) {
1193 1193
 
1194 1194
                 // get the action to do
1195 1195
                 $action = $this->parsingHtml->code[$this->_parsePos];
1196 1196
 
1197 1197
                 // if it is a opening of table / ul / ol
1198
-                if (in_array($action['name'], array('table', 'ul', 'ol')) && !$action['close']) {
1198
+                if (in_array($action['name'], array('table', 'ul', 'ol')) && ! $action['close']) {
1199 1199
 
1200 1200
                     //  we will work as a sub HTML to calculate the size of the element
1201 1201
                     $this->_subPart = true;
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
                     $this->_tempPos = $this->_parsePos;
1208 1208
 
1209 1209
                     // foreach elements, while we are in the opened tag
1210
-                    while (isset($this->parsingHtml->code[$this->_tempPos]) && !($this->parsingHtml->code[$this->_tempPos]['name']==$tagOpen && $this->parsingHtml->code[$this->_tempPos]['close'])) {
1210
+                    while (isset($this->parsingHtml->code[$this->_tempPos]) && ! ($this->parsingHtml->code[$this->_tempPos]['name'] == $tagOpen && $this->parsingHtml->code[$this->_tempPos]['close'])) {
1211 1211
                         // make the action
1212 1212
                         $this->_executeAction($this->parsingHtml->code[$this->_tempPos]);
1213 1213
                         $this->_tempPos++;
@@ -1242,12 +1242,12 @@  discard block
 block discarded – undo
1242 1242
             $param = $action['param'];
1243 1243
 
1244 1244
             // if it the first action of the first page, and if it is not a open tag of PAGE => create the new page
1245
-            if ($fnc!='_tag_open_PAGE' && $this->_firstPage) {
1245
+            if ($fnc != '_tag_open_PAGE' && $this->_firstPage) {
1246 1246
                 $this->_setNewPage();
1247 1247
             }
1248 1248
 
1249 1249
             // the action must exist
1250
-            if (!is_callable(array(&$this, $fnc))) {
1250
+            if ( ! is_callable(array(&$this, $fnc))) {
1251 1251
                 throw new HTML2PDF_exception(1, strtoupper($action['name']), $this->parsingHtml->getHtmlErrorCode($action['html_pos']));
1252 1252
             }
1253 1253
 
@@ -1270,10 +1270,10 @@  discard block
 block discarded – undo
1270 1270
          */
1271 1271
         protected function _getElementY($h)
1272 1272
         {
1273
-            if ($this->_subPart || $this->_isSubPart || !$this->_currentH || $this->_currentH<$h)
1273
+            if ($this->_subPart || $this->_isSubPart || ! $this->_currentH || $this->_currentH < $h)
1274 1274
                 return 0;
1275 1275
 
1276
-            return ($this->_currentH-$h)*0.8;
1276
+            return ($this->_currentH - $h) * 0.8;
1277 1277
         }
1278 1278
 
1279 1279
         /**
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
         protected function _makeBreakLine($h, $curr = null)
1287 1287
         {
1288 1288
             if ($h) {
1289
-                if (($this->pdf->getY()+$h<$this->pdf->getH() - $this->pdf->getbMargin()) || $this->_isInOverflow || $this->_isInFooter)
1289
+                if (($this->pdf->getY() + $h < $this->pdf->getH() - $this->pdf->getbMargin()) || $this->_isInOverflow || $this->_isInFooter)
1290 1290
                     $this->_setNewLine($h, $curr);
1291 1291
                 else
1292 1292
                     $this->_setNewPage(null, '', null, $curr);
@@ -1306,15 +1306,15 @@  discard block
 block discarded – undo
1306 1306
          * @param  boolean $subLi if true=image of a list
1307 1307
          * @return boolean depending on "isForOneLine"
1308 1308
          */
1309
-        protected function _drawImage($src, $subLi=false)
1309
+        protected function _drawImage($src, $subLi = false)
1310 1310
         {
1311 1311
             // get the size of the image
1312 1312
             // WARNING : if URL, "allow_url_fopen" must turned to "on" in php.ini
1313 1313
 
1314
-            $infos=@getimagesize($src);
1314
+            $infos = @getimagesize($src);
1315 1315
 
1316 1316
             // if the image does not exist, or can not be loaded
1317
-            if (count($infos)<2) {
1317
+            if (count($infos) < 2) {
1318 1318
                 // if the test is activ => exception
1319 1319
                 if ($this->_testIsImage) {
1320 1320
                     throw new HTML2PDF_exception(6, $src);
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
             }
1327 1327
 
1328 1328
             // convert the size of the image in the unit of the PDF
1329
-            $imageWidth = $infos[0]/$this->pdf->getK();
1330
-            $imageHeight = $infos[1]/$this->pdf->getK();
1329
+            $imageWidth = $infos[0] / $this->pdf->getK();
1330
+            $imageHeight = $infos[1] / $this->pdf->getK();
1331 1331
 
1332 1332
             // calculate the size from the css style
1333 1333
             if ($this->parsingCss->value['width'] && $this->parsingCss->value['height']) {
@@ -1335,14 +1335,14 @@  discard block
 block discarded – undo
1335 1335
                 $h = $this->parsingCss->value['height'];
1336 1336
             } else if ($this->parsingCss->value['width']) {
1337 1337
                 $w = $this->parsingCss->value['width'];
1338
-                $h = $imageHeight*$w/$imageWidth;
1338
+                $h = $imageHeight * $w / $imageWidth;
1339 1339
             } else if ($this->parsingCss->value['height']) {
1340 1340
                 $h = $this->parsingCss->value['height'];
1341
-                $w = $imageWidth*$h/$imageHeight;
1341
+                $w = $imageWidth * $h / $imageHeight;
1342 1342
             } else {
1343 1343
                 // convert px to pt
1344
-                $w = 72./96.*$imageWidth;
1345
-                $h = 72./96.*$imageHeight;
1344
+                $w = 72. / 96. * $imageWidth;
1345
+                $h = 72. / 96. * $imageHeight;
1346 1346
             }
1347 1347
 
1348 1348
             // are we in a float
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
             // if we are in a float, but if something else if on the line => Break Line
1352 1352
             if ($float && $this->_maxH) {
1353 1353
                 // make the break line (false if we are in "_isForOneLine" mode)
1354
-                if (!$this->_tag_open_BR(array())) {
1354
+                if ( ! $this->_tag_open_BR(array())) {
1355 1355
                     return false;
1356 1356
                 }
1357 1357
             }
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
             $y = $this->pdf->getY();
1362 1362
 
1363 1363
             // if the image can not be put on the current line => new line
1364
-            if (!$float && ($x + $w>$this->pdf->getW() - $this->pdf->getrMargin()) && $this->_maxH) {
1364
+            if ( ! $float && ($x + $w > $this->pdf->getW() - $this->pdf->getrMargin()) && $this->_maxH) {
1365 1365
                 if ($this->_isForOneLine) {
1366 1366
                     return false;
1367 1367
                 }
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
             }
1377 1377
 
1378 1378
             // if the image can not be put on the current page
1379
-            if (($y + $h>$this->pdf->getH() - $this->pdf->getbMargin()) && !$this->_isInOverflow) {
1379
+            if (($y + $h > $this->pdf->getH() - $this->pdf->getbMargin()) && ! $this->_isInOverflow) {
1380 1380
                 // new page
1381 1381
                 $this->_setNewPage();
1382 1382
 
@@ -1386,17 +1386,17 @@  discard block
 block discarded – undo
1386 1386
             }
1387 1387
 
1388 1388
             // correction for display the image of a list
1389
-            $hT = 0.80*$this->parsingCss->value['font-size'];
1390
-            if ($subLi && $h<$hT) {
1391
-                $y+=($hT-$h);
1389
+            $hT = 0.80 * $this->parsingCss->value['font-size'];
1390
+            if ($subLi && $h < $hT) {
1391
+                $y += ($hT - $h);
1392 1392
             }
1393 1393
 
1394 1394
             // add the margin top
1395
-            $yc = $y-$this->parsingCss->value['margin']['t'];
1395
+            $yc = $y - $this->parsingCss->value['margin']['t'];
1396 1396
 
1397 1397
             // get the width and the position of the parent
1398 1398
             $old = $this->parsingCss->getOldValues();
1399
-            if ( $old['width']) {
1399
+            if ($old['width']) {
1400 1400
                 $parentWidth = $old['width'];
1401 1401
                 $parentX = $x;
1402 1402
             } else {
@@ -1408,16 +1408,16 @@  discard block
 block discarded – undo
1408 1408
             if ($float) {
1409 1409
                 list($lx, $rx) = $this->_getMargins($yc);
1410 1410
                 $parentX = $lx;
1411
-                $parentWidth = $rx-$lx;
1411
+                $parentWidth = $rx - $lx;
1412 1412
             }
1413 1413
 
1414 1414
             // calculate the position of the image, if align to the right
1415
-            if ($parentWidth>$w && $float!='left') {
1416
-                if ($float=='right' || $this->parsingCss->value['text-align']=='li_right')    $x = $parentX + $parentWidth - $w-$this->parsingCss->value['margin']['r']-$this->parsingCss->value['margin']['l'];
1415
+            if ($parentWidth > $w && $float != 'left') {
1416
+                if ($float == 'right' || $this->parsingCss->value['text-align'] == 'li_right')    $x = $parentX + $parentWidth - $w - $this->parsingCss->value['margin']['r'] - $this->parsingCss->value['margin']['l'];
1417 1417
             }
1418 1418
 
1419 1419
             // display the image
1420
-            if (!$this->_subPart && !$this->_isSubPart) {
1420
+            if ( ! $this->_subPart && ! $this->_isSubPart) {
1421 1421
                 if ($src) {
1422 1422
                     $this->pdf->Image($src, $x, $y, $w, $h, '', $this->_isInLink);
1423 1423
                 } else {
@@ -1428,39 +1428,39 @@  discard block
 block discarded – undo
1428 1428
             }
1429 1429
 
1430 1430
             // apply the margins
1431
-            $x-= $this->parsingCss->value['margin']['l'];
1432
-            $y-= $this->parsingCss->value['margin']['t'];
1433
-            $w+= $this->parsingCss->value['margin']['l'] + $this->parsingCss->value['margin']['r'];
1434
-            $h+= $this->parsingCss->value['margin']['t'] + $this->parsingCss->value['margin']['b'];
1431
+            $x -= $this->parsingCss->value['margin']['l'];
1432
+            $y -= $this->parsingCss->value['margin']['t'];
1433
+            $w += $this->parsingCss->value['margin']['l'] + $this->parsingCss->value['margin']['r'];
1434
+            $h += $this->parsingCss->value['margin']['t'] + $this->parsingCss->value['margin']['b'];
1435 1435
 
1436
-            if ($float=='left') {
1436
+            if ($float == 'left') {
1437 1437
                 // save the current max
1438
-                $this->_maxX = max($this->_maxX, $x+$w);
1439
-                $this->_maxY = max($this->_maxY, $y+$h);
1438
+                $this->_maxX = max($this->_maxX, $x + $w);
1439
+                $this->_maxY = max($this->_maxY, $y + $h);
1440 1440
 
1441 1441
                 // add the image to the margins
1442
-                $this->_addMargins($float, $x, $y, $x+$w, $y+$h);
1442
+                $this->_addMargins($float, $x, $y, $x + $w, $y + $h);
1443 1443
 
1444 1444
                 // get the new position
1445 1445
                 list($lx, $rx) = $this->_getMargins($yc);
1446 1446
                 $this->pdf->setXY($lx, $yc);
1447
-            } else if ($float=='right') {
1447
+            } else if ($float == 'right') {
1448 1448
                 // save the current max. We don't save the X because it is not the real max of the line
1449
-                $this->_maxY = max($this->_maxY, $y+$h);
1449
+                $this->_maxY = max($this->_maxY, $y + $h);
1450 1450
 
1451 1451
                 // add the image to the margins
1452
-                $this->_addMargins($float, $x, $y, $x+$w, $y+$h);
1452
+                $this->_addMargins($float, $x, $y, $x + $w, $y + $h);
1453 1453
 
1454 1454
                 // get the new position
1455 1455
                 list($lx, $rx) = $this->_getMargins($yc);
1456 1456
                 $this->pdf->setXY($lx, $yc);
1457 1457
             } else {
1458 1458
                 // set the new position at the end of the image
1459
-                $this->pdf->setX($x+$w);
1459
+                $this->pdf->setX($x + $w);
1460 1460
 
1461 1461
                 // save the current max
1462
-                $this->_maxX = max($this->_maxX, $x+$w);
1463
-                $this->_maxY = max($this->_maxY, $y+$h);
1462
+                $this->_maxX = max($this->_maxX, $x + $w);
1463
+                $this->_maxY = max($this->_maxY, $y + $h);
1464 1464
                 $this->_maxH = max($this->_maxH, $h);
1465 1465
             }
1466 1466
 
@@ -1484,13 +1484,13 @@  discard block
 block discarded – undo
1484 1484
         protected function _drawRectangle($x, $y, $w, $h, $border, $padding, $margin, $background)
1485 1485
         {
1486 1486
             // if we are in a subpart or if height is null => return false
1487
-            if ($this->_subPart || $this->_isSubPart || $h===null) return false;
1487
+            if ($this->_subPart || $this->_isSubPart || $h === null) return false;
1488 1488
 
1489 1489
             // add the margin
1490
-            $x+= $margin;
1491
-            $y+= $margin;
1492
-            $w-= $margin*2;
1493
-            $h-= $margin*2;
1490
+            $x += $margin;
1491
+            $y += $margin;
1492
+            $w -= $margin * 2;
1493
+            $h -= $margin * 2;
1494 1494
 
1495 1495
             // get the radius of the border
1496 1496
             $outTL = $border['radius']['tl'];
@@ -1511,32 +1511,32 @@  discard block
 block discarded – undo
1511 1511
             $inBL = $outBL;
1512 1512
 
1513 1513
             if (is_array($inTL)) {
1514
-                $inTL[0]-= $border['l']['width'];
1515
-                $inTL[1]-= $border['t']['width'];
1514
+                $inTL[0] -= $border['l']['width'];
1515
+                $inTL[1] -= $border['t']['width'];
1516 1516
             }
1517 1517
             if (is_array($inTR)) {
1518
-                $inTR[0]-= $border['r']['width'];
1519
-                $inTR[1]-= $border['t']['width'];
1518
+                $inTR[0] -= $border['r']['width'];
1519
+                $inTR[1] -= $border['t']['width'];
1520 1520
             }
1521 1521
             if (is_array($inBR)) {
1522
-                $inBR[0]-= $border['r']['width'];
1523
-                $inBR[1]-= $border['b']['width'];
1522
+                $inBR[0] -= $border['r']['width'];
1523
+                $inBR[1] -= $border['b']['width'];
1524 1524
             }
1525 1525
             if (is_array($inBL)) {
1526
-                $inBL[0]-= $border['l']['width'];
1527
-                $inBL[1]-= $border['b']['width'];
1526
+                $inBL[0] -= $border['l']['width'];
1527
+                $inBL[1] -= $border['b']['width'];
1528 1528
             }
1529 1529
 
1530
-            if ($inTL[0]<=0 || $inTL[1]<=0) $inTL = null;
1531
-            if ($inTR[0]<=0 || $inTR[1]<=0) $inTR = null;
1532
-            if ($inBR[0]<=0 || $inBR[1]<=0) $inBR = null;
1533
-            if ($inBL[0]<=0 || $inBL[1]<=0) $inBL = null;
1530
+            if ($inTL[0] <= 0 || $inTL[1] <= 0) $inTL = null;
1531
+            if ($inTR[0] <= 0 || $inTR[1] <= 0) $inTR = null;
1532
+            if ($inBR[0] <= 0 || $inBR[1] <= 0) $inBR = null;
1533
+            if ($inBL[0] <= 0 || $inBL[1] <= 0) $inBL = null;
1534 1534
 
1535 1535
             // prepare the background color
1536 1536
             $pdfStyle = '';
1537 1537
             if ($background['color']) {
1538 1538
                 $this->pdf->setFillColorArray($background['color']);
1539
-                $pdfStyle.= 'F';
1539
+                $pdfStyle .= 'F';
1540 1540
             }
1541 1541
 
1542 1542
             // if we have a background to fill => fill it with a path (because of the radius)
@@ -1549,8 +1549,8 @@  discard block
 block discarded – undo
1549 1549
             // prepare the background image
1550 1550
             if ($background['image']) {
1551 1551
                 $iName      = $background['image'];
1552
-                $iPosition  = $background['position']!==null ? $background['position'] : array(0, 0);
1553
-                $iRepeat    = $background['repeat']!==null   ? $background['repeat']   : array(true, true);
1552
+                $iPosition  = $background['position'] !== null ? $background['position'] : array(0, 0);
1553
+                $iRepeat    = $background['repeat'] !== null ? $background['repeat'] : array(true, true);
1554 1554
 
1555 1555
                 // size of the background without the borders
1556 1556
                 $bX = $x;
@@ -1559,76 +1559,76 @@  discard block
 block discarded – undo
1559 1559
                 $bH = $h;
1560 1560
 
1561 1561
                 if ($border['b']['width']) {
1562
-                    $bH-= $border['b']['width'];
1562
+                    $bH -= $border['b']['width'];
1563 1563
                 }
1564 1564
                 if ($border['l']['width']) {
1565
-                    $bW-= $border['l']['width'];
1566
-                    $bX+= $border['l']['width'];
1565
+                    $bW -= $border['l']['width'];
1566
+                    $bX += $border['l']['width'];
1567 1567
                 }
1568 1568
                 if ($border['t']['width']) {
1569
-                    $bH-= $border['t']['width'];
1570
-                    $bY+= $border['t']['width'];
1569
+                    $bH -= $border['t']['width'];
1570
+                    $bY += $border['t']['width'];
1571 1571
                 }
1572 1572
                 if ($border['r']['width']) {
1573
-                    $bW-= $border['r']['width'];
1573
+                    $bW -= $border['r']['width'];
1574 1574
                 }
1575 1575
 
1576 1576
                 // get the size of the image
1577 1577
                 // WARNING : if URL, "allow_url_fopen" must turned to "on" in php.ini
1578
-                $imageInfos=@getimagesize($iName);
1578
+                $imageInfos = @getimagesize($iName);
1579 1579
 
1580 1580
                 // if the image can not be loaded
1581
-                if (count($imageInfos)<2) {
1581
+                if (count($imageInfos) < 2) {
1582 1582
                     if ($this->_testIsImage) {
1583 1583
                         throw new HTML2PDF_exception(6, $iName);
1584 1584
                     }
1585 1585
                 } else {
1586 1586
                     // convert the size of the image from pixel to the unit of the PDF
1587
-                    $imageWidth    = 72./96.*$imageInfos[0]/$this->pdf->getK();
1588
-                    $imageHeight    = 72./96.*$imageInfos[1]/$this->pdf->getK();
1587
+                    $imageWidth = 72. / 96. * $imageInfos[0] / $this->pdf->getK();
1588
+                    $imageHeight = 72. / 96. * $imageInfos[1] / $this->pdf->getK();
1589 1589
 
1590 1590
                     // prepare the position of the backgroung
1591 1591
                     if ($iRepeat[0]) $iPosition[0] = $bX;
1592
-                    else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[0], $match)) $iPosition[0] = $bX + $match[1]*($bW-$imageWidth)/100;
1593
-                    else $iPosition[0] = $bX+$iPosition[0];
1592
+                    else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[0], $match)) $iPosition[0] = $bX + $match[1] * ($bW - $imageWidth) / 100;
1593
+                    else $iPosition[0] = $bX + $iPosition[0];
1594 1594
 
1595 1595
                     if ($iRepeat[1]) $iPosition[1] = $bY;
1596
-                    else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[1], $match)) $iPosition[1] = $bY + $match[1]*($bH-$imageHeight)/100;
1597
-                    else $iPosition[1] = $bY+$iPosition[1];
1596
+                    else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[1], $match)) $iPosition[1] = $bY + $match[1] * ($bH - $imageHeight) / 100;
1597
+                    else $iPosition[1] = $bY + $iPosition[1];
1598 1598
 
1599 1599
                     $imageXmin = $bX;
1600
-                    $imageXmax = $bX+$bW;
1600
+                    $imageXmax = $bX + $bW;
1601 1601
                     $imageYmin = $bY;
1602
-                    $imageYmax = $bY+$bH;
1603
-
1604
-                    if (!$iRepeat[0] && !$iRepeat[1]) {
1605
-                        $imageXmin =     $iPosition[0]; $imageXmax =     $iPosition[0]+$imageWidth;
1606
-                        $imageYmin =     $iPosition[1]; $imageYmax =     $iPosition[1]+$imageHeight;
1607
-                    } else if ($iRepeat[0] && !$iRepeat[1]) {
1608
-                        $imageYmin =     $iPosition[1]; $imageYmax =     $iPosition[1]+$imageHeight;
1609
-                    } else if (!$iRepeat[0] && $iRepeat[1]) {
1610
-                        $imageXmin =     $iPosition[0]; $imageXmax =     $iPosition[0]+$imageWidth;
1602
+                    $imageYmax = $bY + $bH;
1603
+
1604
+                    if ( ! $iRepeat[0] && ! $iRepeat[1]) {
1605
+                        $imageXmin = $iPosition[0]; $imageXmax = $iPosition[0] + $imageWidth;
1606
+                        $imageYmin = $iPosition[1]; $imageYmax = $iPosition[1] + $imageHeight;
1607
+                    } else if ($iRepeat[0] && ! $iRepeat[1]) {
1608
+                        $imageYmin = $iPosition[1]; $imageYmax = $iPosition[1] + $imageHeight;
1609
+                    } else if ( ! $iRepeat[0] && $iRepeat[1]) {
1610
+                        $imageXmin = $iPosition[0]; $imageXmax = $iPosition[0] + $imageWidth;
1611 1611
                     }
1612 1612
 
1613 1613
                     // build the path to display the image (because of radius)
1614 1614
                     $this->pdf->clippingPathStart($bX, $bY, $bW, $bH, $inTL, $inTR, $inBL, $inBR);
1615 1615
 
1616 1616
                     // repeat the image
1617
-                    for ($iY=$imageYmin; $iY<$imageYmax; $iY+=$imageHeight) {
1618
-                        for ($iX=$imageXmin; $iX<$imageXmax; $iX+=$imageWidth) {
1617
+                    for ($iY = $imageYmin; $iY < $imageYmax; $iY += $imageHeight) {
1618
+                        for ($iX = $imageXmin; $iX < $imageXmax; $iX += $imageWidth) {
1619 1619
                             $cX = null;
1620 1620
                             $cY = null;
1621 1621
                             $cW = $imageWidth;
1622 1622
                             $cH = $imageHeight;
1623
-                            if ($imageYmax-$iY<$imageHeight) {
1623
+                            if ($imageYmax - $iY < $imageHeight) {
1624 1624
                                 $cX = $iX;
1625 1625
                                 $cY = $iY;
1626
-                                $cH = $imageYmax-$iY;
1626
+                                $cH = $imageYmax - $iY;
1627 1627
                             }
1628
-                            if ($imageXmax-$iX<$imageWidth) {
1628
+                            if ($imageXmax - $iX < $imageWidth) {
1629 1629
                                 $cX = $iX;
1630 1630
                                 $cY = $iY;
1631
-                                $cW = $imageXmax-$iX;
1631
+                                $cW = $imageXmax - $iX;
1632 1632
                             }
1633 1633
 
1634 1634
                             $this->pdf->Image($iName, $iX, $iY, $imageWidth, $imageHeight, '', '');
@@ -1642,36 +1642,36 @@  discard block
 block discarded – undo
1642 1642
 
1643 1643
             // adding some loose (0.01mm)
1644 1644
             $loose = 0.01;
1645
-            $x-= $loose;
1646
-            $y-= $loose;
1647
-            $w+= 2.*$loose;
1648
-            $h+= 2.*$loose;
1649
-            if ($border['l']['width']) $border['l']['width']+= 2.*$loose;
1650
-            if ($border['t']['width']) $border['t']['width']+= 2.*$loose;
1651
-            if ($border['r']['width']) $border['r']['width']+= 2.*$loose;
1652
-            if ($border['b']['width']) $border['b']['width']+= 2.*$loose;
1645
+            $x -= $loose;
1646
+            $y -= $loose;
1647
+            $w += 2. * $loose;
1648
+            $h += 2. * $loose;
1649
+            if ($border['l']['width']) $border['l']['width'] += 2. * $loose;
1650
+            if ($border['t']['width']) $border['t']['width'] += 2. * $loose;
1651
+            if ($border['r']['width']) $border['r']['width'] += 2. * $loose;
1652
+            if ($border['b']['width']) $border['b']['width'] += 2. * $loose;
1653 1653
 
1654 1654
             // prepare the test on borders
1655
-            $testBl = ($border['l']['width'] && $border['l']['color'][0]!==null);
1656
-            $testBt = ($border['t']['width'] && $border['t']['color'][0]!==null);
1657
-            $testBr = ($border['r']['width'] && $border['r']['color'][0]!==null);
1658
-            $testBb = ($border['b']['width'] && $border['b']['color'][0]!==null);
1655
+            $testBl = ($border['l']['width'] && $border['l']['color'][0] !== null);
1656
+            $testBt = ($border['t']['width'] && $border['t']['color'][0] !== null);
1657
+            $testBr = ($border['r']['width'] && $border['r']['color'][0] !== null);
1658
+            $testBb = ($border['b']['width'] && $border['b']['color'][0] !== null);
1659 1659
 
1660 1660
             // draw the radius bottom-left
1661 1661
             if (is_array($outBL) && ($testBb || $testBl)) {
1662 1662
                 if ($inBL) {
1663 1663
                     $courbe = array();
1664
-                    $courbe[] = $x+$outBL[0];              $courbe[] = $y+$h;
1665
-                    $courbe[] = $x;                        $courbe[] = $y+$h-$outBL[1];
1666
-                    $courbe[] = $x+$outBL[0];              $courbe[] = $y+$h-$border['b']['width'];
1667
-                    $courbe[] = $x+$border['l']['width'];  $courbe[] = $y+$h-$outBL[1];
1668
-                    $courbe[] = $x+$outBL[0];              $courbe[] = $y+$h-$outBL[1];
1664
+                    $courbe[] = $x + $outBL[0]; $courbe[] = $y + $h;
1665
+                    $courbe[] = $x; $courbe[] = $y + $h - $outBL[1];
1666
+                    $courbe[] = $x + $outBL[0]; $courbe[] = $y + $h - $border['b']['width'];
1667
+                    $courbe[] = $x + $border['l']['width']; $courbe[] = $y + $h - $outBL[1];
1668
+                    $courbe[] = $x + $outBL[0]; $courbe[] = $y + $h - $outBL[1];
1669 1669
                 } else {
1670 1670
                     $courbe = array();
1671
-                    $courbe[] = $x+$outBL[0];              $courbe[] = $y+$h;
1672
-                    $courbe[] = $x;                        $courbe[] = $y+$h-$outBL[1];
1673
-                    $courbe[] = $x+$border['l']['width'];  $courbe[] = $y+$h-$border['b']['width'];
1674
-                    $courbe[] = $x+$outBL[0];              $courbe[] = $y+$h-$outBL[1];
1671
+                    $courbe[] = $x + $outBL[0]; $courbe[] = $y + $h;
1672
+                    $courbe[] = $x; $courbe[] = $y + $h - $outBL[1];
1673
+                    $courbe[] = $x + $border['l']['width']; $courbe[] = $y + $h - $border['b']['width'];
1674
+                    $courbe[] = $x + $outBL[0]; $courbe[] = $y + $h - $outBL[1];
1675 1675
                 }
1676 1676
                 $this->_drawCurve($courbe, $border['l']['color']);
1677 1677
             }
@@ -1680,17 +1680,17 @@  discard block
 block discarded – undo
1680 1680
             if (is_array($outTL) && ($testBt || $testBl)) {
1681 1681
                 if ($inTL) {
1682 1682
                     $courbe = array();
1683
-                    $courbe[] = $x;                        $courbe[] = $y+$outTL[1];
1684
-                    $courbe[] = $x+$outTL[0];              $courbe[] = $y;
1685
-                    $courbe[] = $x+$border['l']['width'];  $courbe[] = $y+$outTL[1];
1686
-                    $courbe[] = $x+$outTL[0];              $courbe[] = $y+$border['t']['width'];
1687
-                    $courbe[] = $x+$outTL[0];              $courbe[] = $y+$outTL[1];
1683
+                    $courbe[] = $x; $courbe[] = $y + $outTL[1];
1684
+                    $courbe[] = $x + $outTL[0]; $courbe[] = $y;
1685
+                    $courbe[] = $x + $border['l']['width']; $courbe[] = $y + $outTL[1];
1686
+                    $courbe[] = $x + $outTL[0]; $courbe[] = $y + $border['t']['width'];
1687
+                    $courbe[] = $x + $outTL[0]; $courbe[] = $y + $outTL[1];
1688 1688
                 } else {
1689 1689
                     $courbe = array();
1690
-                    $courbe[] = $x;                        $courbe[] = $y+$outTL[1];
1691
-                    $courbe[] = $x+$outTL[0];              $courbe[] = $y;
1692
-                    $courbe[] = $x+$border['l']['width'];  $courbe[] = $y+$border['t']['width'];
1693
-                    $courbe[] = $x+$outTL[0];              $courbe[] = $y+$outTL[1];
1690
+                    $courbe[] = $x; $courbe[] = $y + $outTL[1];
1691
+                    $courbe[] = $x + $outTL[0]; $courbe[] = $y;
1692
+                    $courbe[] = $x + $border['l']['width']; $courbe[] = $y + $border['t']['width'];
1693
+                    $courbe[] = $x + $outTL[0]; $courbe[] = $y + $outTL[1];
1694 1694
                 }
1695 1695
                 $this->_drawCurve($courbe, $border['t']['color']);
1696 1696
             }
@@ -1699,17 +1699,17 @@  discard block
 block discarded – undo
1699 1699
             if (is_array($outTR) && ($testBt || $testBr)) {
1700 1700
                 if ($inTR) {
1701 1701
                     $courbe = array();
1702
-                    $courbe[] = $x+$w-$outTR[0];             $courbe[] = $y;
1703
-                    $courbe[] = $x+$w;                       $courbe[] = $y+$outTR[1];
1704
-                    $courbe[] = $x+$w-$outTR[0];             $courbe[] = $y+$border['t']['width'];
1705
-                    $courbe[] = $x+$w-$border['r']['width']; $courbe[] = $y+$outTR[1];
1706
-                    $courbe[] = $x+$w-$outTR[0];             $courbe[] = $y+$outTR[1];
1702
+                    $courbe[] = $x + $w - $outTR[0]; $courbe[] = $y;
1703
+                    $courbe[] = $x + $w; $courbe[] = $y + $outTR[1];
1704
+                    $courbe[] = $x + $w - $outTR[0]; $courbe[] = $y + $border['t']['width'];
1705
+                    $courbe[] = $x + $w - $border['r']['width']; $courbe[] = $y + $outTR[1];
1706
+                    $courbe[] = $x + $w - $outTR[0]; $courbe[] = $y + $outTR[1];
1707 1707
                 } else {
1708 1708
                     $courbe = array();
1709
-                    $courbe[] = $x+$w-$outTR[0];             $courbe[] = $y;
1710
-                    $courbe[] = $x+$w;                       $courbe[] = $y+$outTR[1];
1711
-                    $courbe[] = $x+$w-$border['r']['width']; $courbe[] = $y+$border['t']['width'];
1712
-                    $courbe[] = $x+$w-$outTR[0];             $courbe[] = $y+$outTR[1];
1709
+                    $courbe[] = $x + $w - $outTR[0]; $courbe[] = $y;
1710
+                    $courbe[] = $x + $w; $courbe[] = $y + $outTR[1];
1711
+                    $courbe[] = $x + $w - $border['r']['width']; $courbe[] = $y + $border['t']['width'];
1712
+                    $courbe[] = $x + $w - $outTR[0]; $courbe[] = $y + $outTR[1];
1713 1713
                 }
1714 1714
                 $this->_drawCurve($courbe, $border['r']['color']);
1715 1715
             }
@@ -1718,17 +1718,17 @@  discard block
 block discarded – undo
1718 1718
             if (is_array($outBR) && ($testBb || $testBr)) {
1719 1719
                 if ($inBR) {
1720 1720
                     $courbe = array();
1721
-                    $courbe[] = $x+$w;                       $courbe[] = $y+$h-$outBR[1];
1722
-                    $courbe[] = $x+$w-$outBR[0];             $courbe[] = $y+$h;
1723
-                    $courbe[] = $x+$w-$border['r']['width']; $courbe[] = $y+$h-$outBR[1];
1724
-                    $courbe[] = $x+$w-$outBR[0];             $courbe[] = $y+$h-$border['b']['width'];
1725
-                    $courbe[] = $x+$w-$outBR[0];             $courbe[] = $y+$h-$outBR[1];
1721
+                    $courbe[] = $x + $w; $courbe[] = $y + $h - $outBR[1];
1722
+                    $courbe[] = $x + $w - $outBR[0]; $courbe[] = $y + $h;
1723
+                    $courbe[] = $x + $w - $border['r']['width']; $courbe[] = $y + $h - $outBR[1];
1724
+                    $courbe[] = $x + $w - $outBR[0]; $courbe[] = $y + $h - $border['b']['width'];
1725
+                    $courbe[] = $x + $w - $outBR[0]; $courbe[] = $y + $h - $outBR[1];
1726 1726
                 } else {
1727 1727
                     $courbe = array();
1728
-                    $courbe[] = $x+$w;                       $courbe[] = $y+$h-$outBR[1];
1729
-                    $courbe[] = $x+$w-$outBR[0];             $courbe[] = $y+$h;
1730
-                    $courbe[] = $x+$w-$border['r']['width']; $courbe[] = $y+$h-$border['b']['width'];
1731
-                    $courbe[] = $x+$w-$outBR[0];             $courbe[] = $y+$h-$outBR[1];
1728
+                    $courbe[] = $x + $w; $courbe[] = $y + $h - $outBR[1];
1729
+                    $courbe[] = $x + $w - $outBR[0]; $courbe[] = $y + $h;
1730
+                    $courbe[] = $x + $w - $border['r']['width']; $courbe[] = $y + $h - $border['b']['width'];
1731
+                    $courbe[] = $x + $w - $outBR[0]; $courbe[] = $y + $h - $outBR[1];
1732 1732
                 }
1733 1733
                 $this->_drawCurve($courbe, $border['b']['color']);
1734 1734
             }
@@ -1736,25 +1736,25 @@  discard block
 block discarded – undo
1736 1736
             // draw the left border
1737 1737
             if ($testBl) {
1738 1738
                 $pt = array();
1739
-                $pt[] = $x;                       $pt[] = $y+$h;
1740
-                $pt[] = $x;                       $pt[] = $y+$h-$border['b']['width'];
1741
-                $pt[] = $x;                       $pt[] = $y+$border['t']['width'];
1742
-                $pt[] = $x;                       $pt[] = $y;
1743
-                $pt[] = $x+$border['l']['width']; $pt[] = $y+$border['t']['width'];
1744
-                $pt[] = $x+$border['l']['width']; $pt[] = $y+$h-$border['b']['width'];
1739
+                $pt[] = $x; $pt[] = $y + $h;
1740
+                $pt[] = $x; $pt[] = $y + $h - $border['b']['width'];
1741
+                $pt[] = $x; $pt[] = $y + $border['t']['width'];
1742
+                $pt[] = $x; $pt[] = $y;
1743
+                $pt[] = $x + $border['l']['width']; $pt[] = $y + $border['t']['width'];
1744
+                $pt[] = $x + $border['l']['width']; $pt[] = $y + $h - $border['b']['width'];
1745 1745
 
1746 1746
                 $bord = 3;
1747 1747
                 if (is_array($outBL)) {
1748
-                    $bord-=1;
1748
+                    $bord -= 1;
1749 1749
                     $pt[3] -= $outBL[1] - $border['b']['width'];
1750
-                    if ($inBL) $pt[11]-= $inBL[1];
1751
-                    unset($pt[0]);unset($pt[1]);
1750
+                    if ($inBL) $pt[11] -= $inBL[1];
1751
+                    unset($pt[0]); unset($pt[1]);
1752 1752
                 }
1753 1753
                 if (is_array($outTL)) {
1754
-                    $bord-=2;
1755
-                    $pt[5] += $outTL[1]-$border['t']['width'];
1754
+                    $bord -= 2;
1755
+                    $pt[5] += $outTL[1] - $border['t']['width'];
1756 1756
                     if ($inTL) $pt[9] += $inTL[1];
1757
-                    unset($pt[6]);unset($pt[7]);
1757
+                    unset($pt[6]); unset($pt[7]);
1758 1758
                 }
1759 1759
 
1760 1760
                 $pt = array_values($pt);
@@ -1764,25 +1764,25 @@  discard block
 block discarded – undo
1764 1764
             // draw the top border
1765 1765
             if ($testBt) {
1766 1766
                 $pt = array();
1767
-                $pt[] = $x;                          $pt[] = $y;
1768
-                $pt[] = $x+$border['l']['width'];    $pt[] = $y;
1769
-                $pt[] = $x+$w-$border['r']['width']; $pt[] = $y;
1770
-                $pt[] = $x+$w;                       $pt[] = $y;
1771
-                $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$border['t']['width'];
1772
-                $pt[] = $x+$border['l']['width'];    $pt[] = $y+$border['t']['width'];
1767
+                $pt[] = $x; $pt[] = $y;
1768
+                $pt[] = $x + $border['l']['width']; $pt[] = $y;
1769
+                $pt[] = $x + $w - $border['r']['width']; $pt[] = $y;
1770
+                $pt[] = $x + $w; $pt[] = $y;
1771
+                $pt[] = $x + $w - $border['r']['width']; $pt[] = $y + $border['t']['width'];
1772
+                $pt[] = $x + $border['l']['width']; $pt[] = $y + $border['t']['width'];
1773 1773
 
1774 1774
                 $bord = 3;
1775 1775
                 if (is_array($outTL)) {
1776
-                    $bord-=1;
1776
+                    $bord -= 1;
1777 1777
                     $pt[2] += $outTL[0] - $border['l']['width'];
1778
-                    if ($inTL) $pt[10]+= $inTL[0];
1779
-                    unset($pt[0]);unset($pt[1]);
1778
+                    if ($inTL) $pt[10] += $inTL[0];
1779
+                    unset($pt[0]); unset($pt[1]);
1780 1780
                 }
1781 1781
                 if (is_array($outTR)) {
1782
-                    $bord-=2;
1782
+                    $bord -= 2;
1783 1783
                     $pt[4] -= $outTR[0] - $border['r']['width'];
1784 1784
                     if ($inTR) $pt[8] -= $inTR[0];
1785
-                    unset($pt[6]);unset($pt[7]);
1785
+                    unset($pt[6]); unset($pt[7]);
1786 1786
                 }
1787 1787
 
1788 1788
                 $pt = array_values($pt);
@@ -1792,25 +1792,25 @@  discard block
 block discarded – undo
1792 1792
             // draw the right border
1793 1793
             if ($testBr) {
1794 1794
                 $pt = array();
1795
-                $pt[] = $x+$w;                       $pt[] = $y;
1796
-                $pt[] = $x+$w;                       $pt[] = $y+$border['t']['width'];
1797
-                $pt[] = $x+$w;                       $pt[] = $y+$h-$border['b']['width'];
1798
-                $pt[] = $x+$w;                       $pt[] = $y+$h;
1799
-                $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$h-$border['b']['width'];
1800
-                $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$border['t']['width'];
1795
+                $pt[] = $x + $w; $pt[] = $y;
1796
+                $pt[] = $x + $w; $pt[] = $y + $border['t']['width'];
1797
+                $pt[] = $x + $w; $pt[] = $y + $h - $border['b']['width'];
1798
+                $pt[] = $x + $w; $pt[] = $y + $h;
1799
+                $pt[] = $x + $w - $border['r']['width']; $pt[] = $y + $h - $border['b']['width'];
1800
+                $pt[] = $x + $w - $border['r']['width']; $pt[] = $y + $border['t']['width'];
1801 1801
 
1802 1802
                 $bord = 3;
1803 1803
                 if (is_array($outTR)) {
1804
-                    $bord-=1;
1804
+                    $bord -= 1;
1805 1805
                     $pt[3] += $outTR[1] - $border['t']['width'];
1806
-                    if ($inTR) $pt[11]+= $inTR[1];
1807
-                    unset($pt[0]);unset($pt[1]);
1806
+                    if ($inTR) $pt[11] += $inTR[1];
1807
+                    unset($pt[0]); unset($pt[1]);
1808 1808
                 }
1809 1809
                 if (is_array($outBR)) {
1810
-                    $bord-=2;
1810
+                    $bord -= 2;
1811 1811
                     $pt[5] -= $outBR[1] - $border['b']['width'];
1812 1812
                     if ($inBR) $pt[9] -= $inBR[1];
1813
-                    unset($pt[6]);unset($pt[7]);
1813
+                    unset($pt[6]); unset($pt[7]);
1814 1814
                 }
1815 1815
 
1816 1816
                 $pt = array_values($pt);
@@ -1820,25 +1820,25 @@  discard block
 block discarded – undo
1820 1820
             // draw the bottom border
1821 1821
             if ($testBb) {
1822 1822
                 $pt = array();
1823
-                $pt[] = $x+$w;                       $pt[] = $y+$h;
1824
-                $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$h;
1825
-                $pt[] = $x+$border['l']['width'];    $pt[] = $y+$h;
1826
-                $pt[] = $x;                          $pt[] = $y+$h;
1827
-                $pt[] = $x+$border['l']['width'];    $pt[] = $y+$h-$border['b']['width'];
1828
-                $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$h-$border['b']['width'];
1823
+                $pt[] = $x + $w; $pt[] = $y + $h;
1824
+                $pt[] = $x + $w - $border['r']['width']; $pt[] = $y + $h;
1825
+                $pt[] = $x + $border['l']['width']; $pt[] = $y + $h;
1826
+                $pt[] = $x; $pt[] = $y + $h;
1827
+                $pt[] = $x + $border['l']['width']; $pt[] = $y + $h - $border['b']['width'];
1828
+                $pt[] = $x + $w - $border['r']['width']; $pt[] = $y + $h - $border['b']['width'];
1829 1829
 
1830 1830
                 $bord = 3;
1831 1831
                 if (is_array($outBL)) {
1832
-                    $bord-=2;
1832
+                    $bord -= 2;
1833 1833
                     $pt[4] += $outBL[0] - $border['l']['width'];
1834 1834
                     if ($inBL) $pt[8] += $inBL[0];
1835
-                    unset($pt[6]);unset($pt[7]);
1835
+                    unset($pt[6]); unset($pt[7]);
1836 1836
                 }
1837 1837
                 if (is_array($outBR)) {
1838
-                    $bord-=1;
1838
+                    $bord -= 1;
1839 1839
                     $pt[2] -= $outBR[0] - $border['r']['width'];
1840
-                    if ($inBR) $pt[10]-= $inBR[0];
1841
-                    unset($pt[0]);unset($pt[1]);
1840
+                    if ($inBR) $pt[10] -= $inBR[0];
1841
+                    unset($pt[0]); unset($pt[1]);
1842 1842
 
1843 1843
                 }
1844 1844
 
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
         {
1865 1865
             $this->pdf->setFillColorArray($color);
1866 1866
 
1867
-            if (count($pt)==10)
1867
+            if (count($pt) == 10)
1868 1868
                 $this->pdf->drawCurve($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7], $pt[8], $pt[9]);
1869 1869
             else
1870 1870
                 $this->pdf->drawCorner($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7]);
@@ -1880,128 +1880,128 @@  discard block
 block discarded – undo
1880 1880
          * @param  float   $width
1881 1881
          * @param  integer $radius (binary from 0 to 3 with 1=>start with a radius, 2=>end with a radius)
1882 1882
          */
1883
-        protected function _drawLine($pt, $color, $type, $width, $radius=3)
1883
+        protected function _drawLine($pt, $color, $type, $width, $radius = 3)
1884 1884
         {
1885 1885
             // set the fill color
1886 1886
             $this->pdf->setFillColorArray($color);
1887 1887
 
1888 1888
             // if dashed or dotted
1889
-            if ($type=='dashed' || $type=='dotted') {
1889
+            if ($type == 'dashed' || $type == 'dotted') {
1890 1890
 
1891 1891
                 // clean the end of the line, if radius
1892
-                if ($radius==1) {
1893
-                    $tmp = array(); $tmp[]=$pt[0]; $tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[8]; $tmp[]=$pt[9];
1892
+                if ($radius == 1) {
1893
+                    $tmp = array(); $tmp[] = $pt[0]; $tmp[] = $pt[1]; $tmp[] = $pt[2]; $tmp[] = $pt[3]; $tmp[] = $pt[8]; $tmp[] = $pt[9];
1894 1894
                     $this->pdf->Polygon($tmp, 'F');
1895 1895
 
1896
-                    $tmp = array(); $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $tmp[]=$pt[8]; $tmp[]=$pt[9];
1896
+                    $tmp = array(); $tmp[] = $pt[2]; $tmp[] = $pt[3]; $tmp[] = $pt[4]; $tmp[] = $pt[5]; $tmp[] = $pt[6]; $tmp[] = $pt[7]; $tmp[] = $pt[8]; $tmp[] = $pt[9];
1897 1897
                     $pt = $tmp;
1898
-                } else if ($radius==2) {
1899
-                    $tmp = array(); $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7];
1898
+                } else if ($radius == 2) {
1899
+                    $tmp = array(); $tmp[] = $pt[2]; $tmp[] = $pt[3]; $tmp[] = $pt[4]; $tmp[] = $pt[5]; $tmp[] = $pt[6]; $tmp[] = $pt[7];
1900 1900
                     $this->pdf->Polygon($tmp, 'F');
1901 1901
 
1902
-                    $tmp = array(); $tmp[]=$pt[0]; $tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $tmp[]=$pt[8]; $tmp[]=$pt[9];
1902
+                    $tmp = array(); $tmp[] = $pt[0]; $tmp[] = $pt[1]; $tmp[] = $pt[2]; $tmp[] = $pt[3]; $tmp[] = $pt[6]; $tmp[] = $pt[7]; $tmp[] = $pt[8]; $tmp[] = $pt[9];
1903 1903
                     $pt = $tmp;
1904
-                } else if ($radius==3) {
1905
-                    $tmp = array(); $tmp[]=$pt[0]; $tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[10]; $tmp[]=$pt[11];
1904
+                } else if ($radius == 3) {
1905
+                    $tmp = array(); $tmp[] = $pt[0]; $tmp[] = $pt[1]; $tmp[] = $pt[2]; $tmp[] = $pt[3]; $tmp[] = $pt[10]; $tmp[] = $pt[11];
1906 1906
                     $this->pdf->Polygon($tmp, 'F');
1907 1907
 
1908
-                    $tmp = array(); $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $tmp[]=$pt[8]; $tmp[]=$pt[9];
1908
+                    $tmp = array(); $tmp[] = $pt[4]; $tmp[] = $pt[5]; $tmp[] = $pt[6]; $tmp[] = $pt[7]; $tmp[] = $pt[8]; $tmp[] = $pt[9];
1909 1909
                     $this->pdf->Polygon($tmp, 'F');
1910 1910
 
1911
-                    $tmp = array(); $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[8]; $tmp[]=$pt[9]; $tmp[]=$pt[10]; $tmp[]=$pt[11];
1911
+                    $tmp = array(); $tmp[] = $pt[2]; $tmp[] = $pt[3]; $tmp[] = $pt[4]; $tmp[] = $pt[5]; $tmp[] = $pt[8]; $tmp[] = $pt[9]; $tmp[] = $pt[10]; $tmp[] = $pt[11];
1912 1912
                     $pt = $tmp;
1913 1913
                 }
1914 1914
 
1915 1915
                 // horisontal or vertical line
1916
-                if ($pt[2]==$pt[0]) {
1917
-                    $l = abs(($pt[3]-$pt[1])*0.5);
1916
+                if ($pt[2] == $pt[0]) {
1917
+                    $l = abs(($pt[3] - $pt[1]) * 0.5);
1918 1918
                     $px = 0;
1919 1919
                     $py = $width;
1920
-                    $x1 = $pt[0]; $y1 = ($pt[3]+$pt[1])*0.5;
1921
-                    $x2 = $pt[6]; $y2 = ($pt[7]+$pt[5])*0.5;
1920
+                    $x1 = $pt[0]; $y1 = ($pt[3] + $pt[1]) * 0.5;
1921
+                    $x2 = $pt[6]; $y2 = ($pt[7] + $pt[5]) * 0.5;
1922 1922
                 } else {
1923
-                    $l = abs(($pt[2]-$pt[0])*0.5);
1923
+                    $l = abs(($pt[2] - $pt[0]) * 0.5);
1924 1924
                     $px = $width;
1925 1925
                     $py = 0;
1926
-                    $x1 = ($pt[2]+$pt[0])*0.5; $y1 = $pt[1];
1927
-                    $x2 = ($pt[6]+$pt[4])*0.5; $y2 = $pt[7];
1926
+                    $x1 = ($pt[2] + $pt[0]) * 0.5; $y1 = $pt[1];
1927
+                    $x2 = ($pt[6] + $pt[4]) * 0.5; $y2 = $pt[7];
1928 1928
                 }
1929 1929
 
1930 1930
                 // if dashed : 3x bigger than dotted
1931
-                if ($type=='dashed') {
1932
-                    $px = $px*3.;
1933
-                    $py = $py*3.;
1931
+                if ($type == 'dashed') {
1932
+                    $px = $px * 3.;
1933
+                    $py = $py * 3.;
1934 1934
                 }
1935
-                $mode = ($l/($px+$py)<.5);
1935
+                $mode = ($l / ($px + $py) < .5);
1936 1936
 
1937 1937
                 // display the dotted/dashed line
1938
-                for ($i=0; $l-($px+$py)*($i-0.5)>0; $i++) {
1939
-                    if (($i%2)==$mode) {
1940
-                        $j = $i-0.5;
1941
-                        $lx1 = $px*($j);   if ($lx1<-$l) $lx1 =-$l;
1942
-                        $ly1 = $py*($j);   if ($ly1<-$l) $ly1 =-$l;
1943
-                        $lx2 = $px*($j+1); if ($lx2>$l)  $lx2 = $l;
1944
-                        $ly2 = $py*($j+1); if ($ly2>$l)  $ly2 = $l;
1938
+                for ($i = 0; $l - ($px + $py) * ($i - 0.5) > 0; $i++) {
1939
+                    if (($i % 2) == $mode) {
1940
+                        $j = $i - 0.5;
1941
+                        $lx1 = $px * ($j); if ($lx1 < -$l) $lx1 = -$l;
1942
+                        $ly1 = $py * ($j); if ($ly1 < -$l) $ly1 = -$l;
1943
+                        $lx2 = $px * ($j + 1); if ($lx2 > $l)  $lx2 = $l;
1944
+                        $ly2 = $py * ($j + 1); if ($ly2 > $l)  $ly2 = $l;
1945 1945
 
1946 1946
                         $tmp = array();
1947
-                        $tmp[] = $x1+$lx1; $tmp[] = $y1+$ly1;
1948
-                        $tmp[] = $x1+$lx2; $tmp[] = $y1+$ly2;
1949
-                        $tmp[] = $x2+$lx2; $tmp[] = $y2+$ly2;
1950
-                        $tmp[] = $x2+$lx1; $tmp[] = $y2+$ly1;
1947
+                        $tmp[] = $x1 + $lx1; $tmp[] = $y1 + $ly1;
1948
+                        $tmp[] = $x1 + $lx2; $tmp[] = $y1 + $ly2;
1949
+                        $tmp[] = $x2 + $lx2; $tmp[] = $y2 + $ly2;
1950
+                        $tmp[] = $x2 + $lx1; $tmp[] = $y2 + $ly1;
1951 1951
                         $this->pdf->Polygon($tmp, 'F');
1952 1952
 
1953
-                        if ($j>0) {
1953
+                        if ($j > 0) {
1954 1954
                             $tmp = array();
1955
-                            $tmp[] = $x1-$lx1; $tmp[] = $y1-$ly1;
1956
-                            $tmp[] = $x1-$lx2; $tmp[] = $y1-$ly2;
1957
-                            $tmp[] = $x2-$lx2; $tmp[] = $y2-$ly2;
1958
-                            $tmp[] = $x2-$lx1; $tmp[] = $y2-$ly1;
1955
+                            $tmp[] = $x1 - $lx1; $tmp[] = $y1 - $ly1;
1956
+                            $tmp[] = $x1 - $lx2; $tmp[] = $y1 - $ly2;
1957
+                            $tmp[] = $x2 - $lx2; $tmp[] = $y2 - $ly2;
1958
+                            $tmp[] = $x2 - $lx1; $tmp[] = $y2 - $ly1;
1959 1959
                             $this->pdf->Polygon($tmp, 'F');
1960 1960
                         }
1961 1961
                     }
1962 1962
                 }
1963
-            } else if ($type=='double') {
1963
+            } else if ($type == 'double') {
1964 1964
 
1965 1965
                 // if double, 2 lines : 0=>1/3 and 2/3=>1
1966 1966
                 $pt1 = $pt;
1967 1967
                 $pt2 = $pt;
1968 1968
 
1969
-                if (count($pt)==12) {
1969
+                if (count($pt) == 12) {
1970 1970
                     // line 1
1971
-                    $pt1[0] = ($pt[0]-$pt[10])*0.33 + $pt[10];
1972
-                    $pt1[1] = ($pt[1]-$pt[11])*0.33 + $pt[11];
1973
-                    $pt1[2] = ($pt[2]-$pt[10])*0.33 + $pt[10];
1974
-                    $pt1[3] = ($pt[3]-$pt[11])*0.33 + $pt[11];
1975
-                    $pt1[4] = ($pt[4]-$pt[8])*0.33 + $pt[8];
1976
-                    $pt1[5] = ($pt[5]-$pt[9])*0.33 + $pt[9];
1977
-                    $pt1[6] = ($pt[6]-$pt[8])*0.33 + $pt[8];
1978
-                    $pt1[7] = ($pt[7]-$pt[9])*0.33 + $pt[9];
1979
-                    $pt2[10]= ($pt[10]-$pt[0])*0.33 + $pt[0];
1980
-                    $pt2[11]= ($pt[11]-$pt[1])*0.33 + $pt[1];
1971
+                    $pt1[0] = ($pt[0] - $pt[10]) * 0.33 + $pt[10];
1972
+                    $pt1[1] = ($pt[1] - $pt[11]) * 0.33 + $pt[11];
1973
+                    $pt1[2] = ($pt[2] - $pt[10]) * 0.33 + $pt[10];
1974
+                    $pt1[3] = ($pt[3] - $pt[11]) * 0.33 + $pt[11];
1975
+                    $pt1[4] = ($pt[4] - $pt[8]) * 0.33 + $pt[8];
1976
+                    $pt1[5] = ($pt[5] - $pt[9]) * 0.33 + $pt[9];
1977
+                    $pt1[6] = ($pt[6] - $pt[8]) * 0.33 + $pt[8];
1978
+                    $pt1[7] = ($pt[7] - $pt[9]) * 0.33 + $pt[9];
1979
+                    $pt2[10] = ($pt[10] - $pt[0]) * 0.33 + $pt[0];
1980
+                    $pt2[11] = ($pt[11] - $pt[1]) * 0.33 + $pt[1];
1981 1981
 
1982 1982
                     // line 2
1983
-                    $pt2[2] = ($pt[2] -$pt[0])*0.33 + $pt[0];
1984
-                    $pt2[3] = ($pt[3] -$pt[1])*0.33 + $pt[1];
1985
-                    $pt2[4] = ($pt[4] -$pt[6])*0.33 + $pt[6];
1986
-                    $pt2[5] = ($pt[5] -$pt[7])*0.33 + $pt[7];
1987
-                    $pt2[8] = ($pt[8] -$pt[6])*0.33 + $pt[6];
1988
-                    $pt2[9] = ($pt[9] -$pt[7])*0.33 + $pt[7];
1983
+                    $pt2[2] = ($pt[2] - $pt[0]) * 0.33 + $pt[0];
1984
+                    $pt2[3] = ($pt[3] - $pt[1]) * 0.33 + $pt[1];
1985
+                    $pt2[4] = ($pt[4] - $pt[6]) * 0.33 + $pt[6];
1986
+                    $pt2[5] = ($pt[5] - $pt[7]) * 0.33 + $pt[7];
1987
+                    $pt2[8] = ($pt[8] - $pt[6]) * 0.33 + $pt[6];
1988
+                    $pt2[9] = ($pt[9] - $pt[7]) * 0.33 + $pt[7];
1989 1989
                 } else {
1990 1990
                     // line 1
1991
-                    $pt1[0] = ($pt[0]-$pt[6])*0.33 + $pt[6];
1992
-                    $pt1[1] = ($pt[1]-$pt[7])*0.33 + $pt[7];
1993
-                    $pt1[2] = ($pt[2]-$pt[4])*0.33 + $pt[4];
1994
-                    $pt1[3] = ($pt[3]-$pt[5])*0.33 + $pt[5];
1991
+                    $pt1[0] = ($pt[0] - $pt[6]) * 0.33 + $pt[6];
1992
+                    $pt1[1] = ($pt[1] - $pt[7]) * 0.33 + $pt[7];
1993
+                    $pt1[2] = ($pt[2] - $pt[4]) * 0.33 + $pt[4];
1994
+                    $pt1[3] = ($pt[3] - $pt[5]) * 0.33 + $pt[5];
1995 1995
 
1996 1996
                     // line 2
1997
-                    $pt2[6] = ($pt[6]-$pt[0])*0.33 + $pt[0];
1998
-                    $pt2[7] = ($pt[7]-$pt[1])*0.33 + $pt[1];
1999
-                    $pt2[4] = ($pt[4]-$pt[2])*0.33 + $pt[2];
2000
-                    $pt2[5] = ($pt[5]-$pt[3])*0.33 + $pt[3];
1997
+                    $pt2[6] = ($pt[6] - $pt[0]) * 0.33 + $pt[0];
1998
+                    $pt2[7] = ($pt[7] - $pt[1]) * 0.33 + $pt[1];
1999
+                    $pt2[4] = ($pt[4] - $pt[2]) * 0.33 + $pt[2];
2000
+                    $pt2[5] = ($pt[5] - $pt[3]) * 0.33 + $pt[3];
2001 2001
                 }
2002 2002
                 $this->pdf->Polygon($pt1, 'F');
2003 2003
                 $this->pdf->Polygon($pt2, 'F');
2004
-            } else if ($type=='solid') {
2004
+            } else if ($type == 'solid') {
2005 2005
                 // solid line : draw directly the polygon
2006 2006
                 $this->pdf->Polygon($pt, 'F');
2007 2007
             }
@@ -2017,16 +2017,16 @@  discard block
 block discarded – undo
2017 2017
         protected function _prepareTransform($transform)
2018 2018
         {
2019 2019
             // it can not be  empty
2020
-            if (!$transform) return null;
2020
+            if ( ! $transform) return null;
2021 2021
 
2022 2022
             // sctions must be like scale(...)
2023
-            if (!preg_match_all('/([a-z]+)\(([^\)]*)\)/isU', $transform, $match)) return null;
2023
+            if ( ! preg_match_all('/([a-z]+)\(([^\)]*)\)/isU', $transform, $match)) return null;
2024 2024
 
2025 2025
             // prepare the list of the actions
2026 2026
             $actions = array();
2027 2027
 
2028 2028
             // for actions
2029
-            for ($k=0; $k<count($match[0]); $k++) {
2029
+            for ($k = 0; $k < count($match[0]); $k++) {
2030 2030
 
2031 2031
                 // get the name of the action
2032 2032
                 $name = strtolower($match[1][$k]);
@@ -2038,52 +2038,52 @@  discard block
 block discarded – undo
2038 2038
                 }
2039 2039
 
2040 2040
                 // prepare the matrix, depending on the action
2041
-                switch($name)
2041
+                switch ($name)
2042 2042
                 {
2043 2043
                     case 'scale':
2044
-                        if (!isset($val[0])) $val[0] = 1.;      else $val[0] = 1.*$val[0];
2045
-                        if (!isset($val[1])) $val[1] = $val[0]; else $val[1] = 1.*$val[1];
2046
-                        $actions[] = array($val[0],0,0,$val[1],0,0);
2044
+                        if ( ! isset($val[0])) $val[0] = 1.; else $val[0] = 1. * $val[0];
2045
+                        if ( ! isset($val[1])) $val[1] = $val[0]; else $val[1] = 1. * $val[1];
2046
+                        $actions[] = array($val[0], 0, 0, $val[1], 0, 0);
2047 2047
                         break;
2048 2048
 
2049 2049
                     case 'translate':
2050
-                        if (!isset($val[0])) $val[0] = 0.; else $val[0] = $this->parsingCss->ConvertToMM($val[0], $this->_isInDraw['w']);
2051
-                        if (!isset($val[1])) $val[1] = 0.; else $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['h']);
2052
-                        $actions[] = array(1,0,0,1,$val[0],$val[1]);
2050
+                        if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $this->parsingCss->ConvertToMM($val[0], $this->_isInDraw['w']);
2051
+                        if ( ! isset($val[1])) $val[1] = 0.; else $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['h']);
2052
+                        $actions[] = array(1, 0, 0, 1, $val[0], $val[1]);
2053 2053
                         break;
2054 2054
 
2055 2055
                     case 'rotate':
2056
-                        if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*M_PI/180.;
2057
-                        if (!isset($val[1])) $val[1] = 0.; else $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['w']);
2058
-                        if (!isset($val[2])) $val[2] = 0.; else $val[2] = $this->parsingCss->ConvertToMM($val[2], $this->_isInDraw['h']);
2059
-                        if ($val[1] || $val[2]) $actions[] = array(1,0,0,1,-$val[1],-$val[2]);
2060
-                        $actions[] = array(cos($val[0]),sin($val[0]),-sin($val[0]),cos($val[0]),0,0);
2061
-                        if ($val[1] || $val[2]) $actions[] = array(1,0,0,1,$val[1],$val[2]);
2056
+                        if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $val[0] * M_PI / 180.;
2057
+                        if ( ! isset($val[1])) $val[1] = 0.; else $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['w']);
2058
+                        if ( ! isset($val[2])) $val[2] = 0.; else $val[2] = $this->parsingCss->ConvertToMM($val[2], $this->_isInDraw['h']);
2059
+                        if ($val[1] || $val[2]) $actions[] = array(1, 0, 0, 1, -$val[1], -$val[2]);
2060
+                        $actions[] = array(cos($val[0]), sin($val[0]), -sin($val[0]), cos($val[0]), 0, 0);
2061
+                        if ($val[1] || $val[2]) $actions[] = array(1, 0, 0, 1, $val[1], $val[2]);
2062 2062
                         break;
2063 2063
 
2064 2064
                     case 'skewx':
2065
-                        if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*M_PI/180.;
2066
-                        $actions[] = array(1,0,tan($val[0]),1,0,0);
2065
+                        if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $val[0] * M_PI / 180.;
2066
+                        $actions[] = array(1, 0, tan($val[0]), 1, 0, 0);
2067 2067
                         break;
2068 2068
 
2069 2069
                     case 'skewy':
2070
-                        if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*M_PI/180.;
2071
-                        $actions[] = array(1,tan($val[0]),0,1,0,0);
2070
+                        if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $val[0] * M_PI / 180.;
2071
+                        $actions[] = array(1, tan($val[0]), 0, 1, 0, 0);
2072 2072
                         break;
2073 2073
                     case 'matrix':
2074
-                        if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*1.;
2075
-                        if (!isset($val[1])) $val[1] = 0.; else $val[1] = $val[1]*1.;
2076
-                        if (!isset($val[2])) $val[2] = 0.; else $val[2] = $val[2]*1.;
2077
-                        if (!isset($val[3])) $val[3] = 0.; else $val[3] = $val[3]*1.;
2078
-                        if (!isset($val[4])) $val[4] = 0.; else $val[4] = $this->parsingCss->ConvertToMM($val[4], $this->_isInDraw['w']);
2079
-                        if (!isset($val[5])) $val[5] = 0.; else $val[5] = $this->parsingCss->ConvertToMM($val[5], $this->_isInDraw['h']);
2080
-                        $actions[] =$val;
2074
+                        if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $val[0] * 1.;
2075
+                        if ( ! isset($val[1])) $val[1] = 0.; else $val[1] = $val[1] * 1.;
2076
+                        if ( ! isset($val[2])) $val[2] = 0.; else $val[2] = $val[2] * 1.;
2077
+                        if ( ! isset($val[3])) $val[3] = 0.; else $val[3] = $val[3] * 1.;
2078
+                        if ( ! isset($val[4])) $val[4] = 0.; else $val[4] = $this->parsingCss->ConvertToMM($val[4], $this->_isInDraw['w']);
2079
+                        if ( ! isset($val[5])) $val[5] = 0.; else $val[5] = $this->parsingCss->ConvertToMM($val[5], $this->_isInDraw['h']);
2080
+                        $actions[] = $val;
2081 2081
                         break;
2082 2082
                 }
2083 2083
             }
2084 2084
 
2085 2085
             // if ther is no actions => return
2086
-            if (!$actions) return null;
2086
+            if ( ! $actions) return null;
2087 2087
 
2088 2088
             // get the first matrix
2089 2089
             $m = $actions[0]; unset($actions[0]);
@@ -2091,12 +2091,12 @@  discard block
 block discarded – undo
2091 2091
             // foreach matrix => multiply to the last matrix
2092 2092
             foreach ($actions as $n) {
2093 2093
                 $m = array(
2094
-                    $m[0]*$n[0]+$m[2]*$n[1],
2095
-                    $m[1]*$n[0]+$m[3]*$n[1],
2096
-                    $m[0]*$n[2]+$m[2]*$n[3],
2097
-                    $m[1]*$n[2]+$m[3]*$n[3],
2098
-                    $m[0]*$n[4]+$m[2]*$n[5]+$m[4],
2099
-                    $m[1]*$n[4]+$m[3]*$n[5]+$m[5]
2094
+                    $m[0] * $n[0] + $m[2] * $n[1],
2095
+                    $m[1] * $n[0] + $m[3] * $n[1],
2096
+                    $m[0] * $n[2] + $m[2] * $n[3],
2097
+                    $m[1] * $n[2] + $m[3] * $n[3],
2098
+                    $m[0] * $n[4] + $m[2] * $n[5] + $m[4],
2099
+                    $m[1] * $n[4] + $m[3] * $n[5] + $m[5]
2100 2100
                 );
2101 2101
             }
2102 2102
 
@@ -2111,14 +2111,14 @@  discard block
 block discarded – undo
2111 2111
          */
2112 2112
         protected function _calculateTableCellSize(&$cases, &$corr)
2113 2113
         {
2114
-            if (!isset($corr[0])) return true;
2114
+            if ( ! isset($corr[0])) return true;
2115 2115
 
2116 2116
             // for each cell without colspan, we get the max width for each column
2117 2117
             $sw = array();
2118
-            for ($x=0; $x<count($corr[0]); $x++) {
2119
-                $m=0;
2120
-                for ($y=0; $y<count($corr); $y++) {
2121
-                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][2]==1) {
2118
+            for ($x = 0; $x < count($corr[0]); $x++) {
2119
+                $m = 0;
2120
+                for ($y = 0; $y < count($corr); $y++) {
2121
+                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][2] == 1) {
2122 2122
                         $m = max($m, $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']);
2123 2123
                     }
2124 2124
                 }
@@ -2126,17 +2126,17 @@  discard block
 block discarded – undo
2126 2126
             }
2127 2127
 
2128 2128
             // for each cell with colspan, we adapt the width of each column
2129
-            for ($x=0; $x<count($corr[0]); $x++) {
2130
-                for ($y=0; $y<count($corr); $y++) {
2131
-                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][2]>1) {
2129
+            for ($x = 0; $x < count($corr[0]); $x++) {
2130
+                for ($y = 0; $y < count($corr); $y++) {
2131
+                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][2] > 1) {
2132 2132
 
2133 2133
                         // sum the max width of each column in colspan
2134
-                        $s = 0; for ($i=0; $i<$corr[$y][$x][2]; $i++) $s+= $sw[$x+$i];
2134
+                        $s = 0; for ($i = 0; $i < $corr[$y][$x][2]; $i++) $s += $sw[$x + $i];
2135 2135
 
2136 2136
                         // if the max width is < the width of the cell with colspan => we adapt the width of each max width
2137
-                        if ($s>0 && $s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']) {
2138
-                            for ($i=0; $i<$corr[$y][$x][2]; $i++) {
2139
-                                $sw[$x+$i] = $sw[$x+$i]/$s*$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'];
2137
+                        if ($s > 0 && $s < $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']) {
2138
+                            for ($i = 0; $i < $corr[$y][$x][2]; $i++) {
2139
+                                $sw[$x + $i] = $sw[$x + $i] / $s * $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'];
2140 2140
                             }
2141 2141
                         }
2142 2142
                     }
@@ -2144,17 +2144,17 @@  discard block
 block discarded – undo
2144 2144
             }
2145 2145
 
2146 2146
             // set the new width, for each cell
2147
-            for ($x=0; $x<count($corr[0]); $x++) {
2148
-                for ($y=0; $y<count($corr); $y++) {
2147
+            for ($x = 0; $x < count($corr[0]); $x++) {
2148
+                for ($y = 0; $y < count($corr); $y++) {
2149 2149
                     if (isset($corr[$y][$x]) && is_array($corr[$y][$x])) {
2150 2150
                         // without colspan
2151
-                        if ($corr[$y][$x][2]==1) {
2151
+                        if ($corr[$y][$x][2] == 1) {
2152 2152
                             $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'] = $sw[$x];
2153 2153
                         // with colspan
2154 2154
                         } else {
2155 2155
                             $s = 0;
2156
-                            for ($i=0; $i<$corr[$y][$x][2]; $i++) {
2157
-                                $s+= $sw[$x+$i];
2156
+                            for ($i = 0; $i < $corr[$y][$x][2]; $i++) {
2157
+                                $s += $sw[$x + $i];
2158 2158
                             }
2159 2159
                             $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'] = $s;
2160 2160
                         }
@@ -2164,10 +2164,10 @@  discard block
 block discarded – undo
2164 2164
 
2165 2165
             // for each cell without rowspan, we get the max height for each line
2166 2166
             $sh = array();
2167
-            for ($y=0; $y<count($corr); $y++) {
2168
-                $m=0;
2169
-                for ($x=0; $x<count($corr[0]); $x++) {
2170
-                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][3]==1) {
2167
+            for ($y = 0; $y < count($corr); $y++) {
2168
+                $m = 0;
2169
+                for ($x = 0; $x < count($corr[0]); $x++) {
2170
+                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][3] == 1) {
2171 2171
                         $m = max($m, $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']);
2172 2172
                     }
2173 2173
                 }
@@ -2175,17 +2175,17 @@  discard block
 block discarded – undo
2175 2175
             }
2176 2176
 
2177 2177
             // for each cell with rowspan, we adapt the height of each line
2178
-            for ($y=0; $y<count($corr); $y++) {
2179
-                for ($x=0; $x<count($corr[0]); $x++) {
2180
-                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][3]>1) {
2178
+            for ($y = 0; $y < count($corr); $y++) {
2179
+                for ($x = 0; $x < count($corr[0]); $x++) {
2180
+                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][3] > 1) {
2181 2181
 
2182 2182
                         // sum the max height of each line in rowspan
2183
-                        $s = 0; for ($i=0; $i<$corr[$y][$x][3]; $i++) $s+= $sh[$y+$i];
2183
+                        $s = 0; for ($i = 0; $i < $corr[$y][$x][3]; $i++) $s += $sh[$y + $i];
2184 2184
 
2185 2185
                         // if the max height is < the height of the cell with rowspan => we adapt the height of each max height
2186
-                        if ($s>0 && $s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']) {
2187
-                            for ($i=0; $i<$corr[$y][$x][3]; $i++) {
2188
-                                $sh[$y+$i] = $sh[$y+$i]/$s*$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'];
2186
+                        if ($s > 0 && $s < $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']) {
2187
+                            for ($i = 0; $i < $corr[$y][$x][3]; $i++) {
2188
+                                $sh[$y + $i] = $sh[$y + $i] / $s * $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'];
2189 2189
                             }
2190 2190
                         }
2191 2191
                     }
@@ -2193,26 +2193,26 @@  discard block
 block discarded – undo
2193 2193
             }
2194 2194
 
2195 2195
             // set the new height, for each cell
2196
-            for ($y=0; $y<count($corr); $y++) {
2197
-                for ($x=0; $x<count($corr[0]); $x++) {
2196
+            for ($y = 0; $y < count($corr); $y++) {
2197
+                for ($x = 0; $x < count($corr[0]); $x++) {
2198 2198
                     if (isset($corr[$y][$x]) && is_array($corr[$y][$x])) {
2199 2199
                         // without rowspan
2200
-                        if ($corr[$y][$x][3]==1) {
2200
+                        if ($corr[$y][$x][3] == 1) {
2201 2201
                             $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'] = $sh[$y];
2202 2202
                         // with rowspan
2203 2203
                         } else {
2204 2204
                             $s = 0;
2205
-                            for ($i=0; $i<$corr[$y][$x][3]; $i++) {
2206
-                                $s+= $sh[$y+$i];
2205
+                            for ($i = 0; $i < $corr[$y][$x][3]; $i++) {
2206
+                                $s += $sh[$y + $i];
2207 2207
                             }
2208 2208
                             $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'] = $s;
2209 2209
 
2210
-                            for ($j=1; $j<$corr[$y][$x][3]; $j++) {
2211
-                                $tx = $x+1;
2212
-                                $ty = $y+$j;
2213
-                                for (true; isset($corr[$ty][$tx]) && !is_array($corr[$ty][$tx]); $tx++);
2210
+                            for ($j = 1; $j < $corr[$y][$x][3]; $j++) {
2211
+                                $tx = $x + 1;
2212
+                                $ty = $y + $j;
2213
+                                for (true; isset($corr[$ty][$tx]) && ! is_array($corr[$ty][$tx]); $tx++);
2214 2214
                                 if (isset($corr[$ty][$tx])) {
2215
-                                    $cases[$corr[$ty][$tx][1]][$corr[$ty][$tx][0]]['dw']+= $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'];
2215
+                                    $cases[$corr[$ty][$tx][1]][$corr[$ty][$tx][0]]['dw'] += $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'];
2216 2216
                                 }
2217 2217
                             }
2218 2218
                         }
@@ -2231,11 +2231,11 @@  discard block
 block discarded – undo
2231 2231
         protected function _tag_open_PAGE($param)
2232 2232
         {
2233 2233
             if ($this->_isForOneLine) return false;
2234
-            if ($this->_debugActif) $this->_DEBUG_add('PAGE '.($this->_page+1), true);
2234
+            if ($this->_debugActif) $this->_DEBUG_add('PAGE '.($this->_page + 1), true);
2235 2235
 
2236
-            $newPageSet= (!isset($param['pageset']) || $param['pageset']!='old');
2236
+            $newPageSet = ( ! isset($param['pageset']) || $param['pageset'] != 'old');
2237 2237
 
2238
-            $resetPageNumber = (isset($param['pagegroup']) && $param['pagegroup']=='new');
2238
+            $resetPageNumber = (isset($param['pagegroup']) && $param['pagegroup'] == 'new');
2239 2239
 
2240 2240
             $this->_maxH = 0;
2241 2241
 
@@ -2248,12 +2248,12 @@  discard block
 block discarded – undo
2248 2248
                 $orientation = '';
2249 2249
                 if (isset($param['orientation'])) {
2250 2250
                     $param['orientation'] = strtolower($param['orientation']);
2251
-                    if ($param['orientation']=='p')         $orientation = 'P';
2252
-                    if ($param['orientation']=='portrait')  $orientation = 'P';
2251
+                    if ($param['orientation'] == 'p')         $orientation = 'P';
2252
+                    if ($param['orientation'] == 'portrait')  $orientation = 'P';
2253 2253
 
2254
-                    if ($param['orientation']=='l')         $orientation = 'L';
2255
-                    if ($param['orientation']=='paysage')   $orientation = 'L';
2256
-                    if ($param['orientation']=='landscape') $orientation = 'L';
2254
+                    if ($param['orientation'] == 'l')         $orientation = 'L';
2255
+                    if ($param['orientation'] == 'paysage')   $orientation = 'L';
2256
+                    if ($param['orientation'] == 'landscape') $orientation = 'L';
2257 2257
                 }
2258 2258
 
2259 2259
                 // format
@@ -2268,29 +2268,29 @@  discard block
 block discarded – undo
2268 2268
                 // background
2269 2269
                 $background = array();
2270 2270
                 if (isset($param['backimg'])) {
2271
-                    $background['img']    = isset($param['backimg'])  ? $param['backimg']  : '';       // src of the image
2271
+                    $background['img']    = isset($param['backimg']) ? $param['backimg'] : ''; // src of the image
2272 2272
                     $background['posX']   = isset($param['backimgx']) ? $param['backimgx'] : 'center'; // horizontale position of the image
2273 2273
                     $background['posY']   = isset($param['backimgy']) ? $param['backimgy'] : 'middle'; // vertical position of the image
2274
-                    $background['width']  = isset($param['backimgw']) ? $param['backimgw'] : '100%';   // width of the image (100% = page width)
2274
+                    $background['width']  = isset($param['backimgw']) ? $param['backimgw'] : '100%'; // width of the image (100% = page width)
2275 2275
 
2276 2276
                     // convert the src of the image, if parameters
2277 2277
                     $background['img'] = str_replace('&amp;', '&', $background['img']);
2278 2278
 
2279 2279
                     // convert the positions
2280
-                    if ($background['posX']=='left')    $background['posX'] = '0%';
2281
-                    if ($background['posX']=='center')  $background['posX'] = '50%';
2282
-                    if ($background['posX']=='right')   $background['posX'] = '100%';
2283
-                    if ($background['posY']=='top')     $background['posY'] = '0%';
2284
-                    if ($background['posY']=='middle')  $background['posY'] = '50%';
2285
-                    if ($background['posY']=='bottom')  $background['posY'] = '100%';
2280
+                    if ($background['posX'] == 'left')    $background['posX'] = '0%';
2281
+                    if ($background['posX'] == 'center')  $background['posX'] = '50%';
2282
+                    if ($background['posX'] == 'right')   $background['posX'] = '100%';
2283
+                    if ($background['posY'] == 'top')     $background['posY'] = '0%';
2284
+                    if ($background['posY'] == 'middle')  $background['posY'] = '50%';
2285
+                    if ($background['posY'] == 'bottom')  $background['posY'] = '100%';
2286 2286
 
2287 2287
                     if ($background['img']) {
2288 2288
                         // get the size of the image
2289 2289
                         // WARNING : if URL, "allow_url_fopen" must turned to "on" in php.ini
2290
-                        $infos=@getimagesize($background['img']);
2291
-                        if (count($infos)>1) {
2290
+                        $infos = @getimagesize($background['img']);
2291
+                        if (count($infos) > 1) {
2292 2292
                             $imageWidth = $this->parsingCss->ConvertToMM($background['width'], $this->pdf->getW());
2293
-                            $imageHeight = $imageWidth*$infos[1]/$infos[0];
2293
+                            $imageHeight = $imageWidth * $infos[1] / $infos[0];
2294 2294
 
2295 2295
                             $background['width'] = $imageWidth;
2296 2296
                             $background['posX']  = $this->parsingCss->ConvertToMM($background['posX'], $this->pdf->getW() - $imageWidth);
@@ -2304,10 +2304,10 @@  discard block
 block discarded – undo
2304 2304
                 }
2305 2305
 
2306 2306
                 // margins of the page
2307
-                $background['top']    = isset($param['backtop'])    ? $param['backtop']    : '0';
2307
+                $background['top']    = isset($param['backtop']) ? $param['backtop'] : '0';
2308 2308
                 $background['bottom'] = isset($param['backbottom']) ? $param['backbottom'] : '0';
2309
-                $background['left']   = isset($param['backleft'])   ? $param['backleft']   : '0';
2310
-                $background['right']  = isset($param['backright'])  ? $param['backright']  : '0';
2309
+                $background['left']   = isset($param['backleft']) ? $param['backleft'] : '0';
2310
+                $background['right']  = isset($param['backright']) ? $param['backright'] : '0';
2311 2311
 
2312 2312
                 // if no unit => mm
2313 2313
                 if (preg_match('/^([0-9]*)$/isU', $background['top']))    $background['top']    .= 'mm';
@@ -2323,8 +2323,8 @@  discard block
 block discarded – undo
2323 2323
 
2324 2324
                 // get the background color
2325 2325
                 $res = false;
2326
-                $background['color']    = isset($param['backcolor'])    ? $this->parsingCss->convertToColor($param['backcolor'], $res) : null;
2327
-                if (!$res) $background['color'] = null;
2326
+                $background['color'] = isset($param['backcolor']) ? $this->parsingCss->convertToColor($param['backcolor'], $res) : null;
2327
+                if ( ! $res) $background['color'] = null;
2328 2328
 
2329 2329
                 $this->parsingCss->save();
2330 2330
                 $this->parsingCss->analyse('PAGE', $param);
@@ -2395,11 +2395,11 @@  discard block
 block discarded – undo
2395 2395
             if ($this->_isForOneLine) return false;
2396 2396
 
2397 2397
             $this->_subHEADER = array();
2398
-            for ($this->_parsePos; $this->_parsePos<count($this->parsingHtml->code); $this->_parsePos++) {
2398
+            for ($this->_parsePos; $this->_parsePos < count($this->parsingHtml->code); $this->_parsePos++) {
2399 2399
                 $action = $this->parsingHtml->code[$this->_parsePos];
2400
-                if ($action['name']=='page_header') $action['name']='page_header_sub';
2400
+                if ($action['name'] == 'page_header') $action['name'] = 'page_header_sub';
2401 2401
                 $this->_subHEADER[] = $action;
2402
-                if (strtolower($action['name'])=='page_header_sub' && $action['close']) break;
2402
+                if (strtolower($action['name']) == 'page_header_sub' && $action['close']) break;
2403 2403
             }
2404 2404
 
2405 2405
             $this->_setPageHeader();
@@ -2419,11 +2419,11 @@  discard block
 block discarded – undo
2419 2419
             if ($this->_isForOneLine) return false;
2420 2420
 
2421 2421
             $this->_subFOOTER = array();
2422
-            for ($this->_parsePos; $this->_parsePos<count($this->parsingHtml->code); $this->_parsePos++) {
2422
+            for ($this->_parsePos; $this->_parsePos < count($this->parsingHtml->code); $this->_parsePos++) {
2423 2423
                 $action = $this->parsingHtml->code[$this->_parsePos];
2424
-                if ($action['name']=='page_footer') $action['name']='page_footer_sub';
2424
+                if ($action['name'] == 'page_footer') $action['name'] = 'page_footer_sub';
2425 2425
                 $this->_subFOOTER[] = $action;
2426
-                if (strtolower($action['name'])=='page_footer_sub' && $action['close']) break;
2426
+                if (strtolower($action['name']) == 'page_footer_sub' && $action['close']) break;
2427 2427
             }
2428 2428
 
2429 2429
             $this->_setPageFooter();
@@ -2541,8 +2541,8 @@  discard block
 block discarded – undo
2541 2541
 
2542 2542
             $this->parsingCss->initStyle();
2543 2543
             $this->parsingCss->resetStyle();
2544
-            $this->parsingCss->value['width']    = $this->pdf->getW() - $this->_defaultLeft - $this->_defaultRight;
2545
-            $this->parsingCss->table                = array();
2544
+            $this->parsingCss->value['width'] = $this->pdf->getW() - $this->_defaultLeft - $this->_defaultRight;
2545
+            $this->parsingCss->table = array();
2546 2546
 
2547 2547
             // we create a sub HTML2PFDF, and we execute on it the content of the footer, to get the height of it
2548 2548
             $sub = null;
@@ -2575,11 +2575,11 @@  discard block
 block discarded – undo
2575 2575
 
2576 2576
             $this->parsingCss->value                = $this->_subSTATES['s'];
2577 2577
             $this->parsingCss->table                = $this->_subSTATES['t'];
2578
-            $this->_pageMarges                 = $this->_subSTATES['mp'];
2579
-            $this->_margeLeft                = $this->_subSTATES['ml'];
2580
-            $this->_margeRight                = $this->_subSTATES['mr'];
2581
-            $this->_margeTop                    = $this->_subSTATES['mt'];
2582
-            $this->_margeBottom                = $this->_subSTATES['mb'];
2578
+            $this->_pageMarges = $this->_subSTATES['mp'];
2579
+            $this->_margeLeft = $this->_subSTATES['ml'];
2580
+            $this->_margeRight = $this->_subSTATES['mr'];
2581
+            $this->_margeTop = $this->_subSTATES['mt'];
2582
+            $this->_margeBottom = $this->_subSTATES['mb'];
2583 2583
             $this->pdf->SetMargins($this->_margeLeft, $this->_margeTop, $this->_margeRight);
2584 2584
             $this->pdf->SetAutoPageBreak(false, $this->_margeBottom);
2585 2585
             $this->pdf->setXY($this->_subSTATES['x'], $this->_subSTATES['y']);
@@ -2612,8 +2612,8 @@  discard block
 block discarded – undo
2612 2612
 
2613 2613
             // if the content does not fit on the page => new page
2614 2614
             if (
2615
-                $sub->_maxY < ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin()) &&
2616
-                $y + $sub->_maxY>=($this->pdf->getH() - $this->pdf->getbMargin())
2615
+                $sub->_maxY < ($this->pdf->getH() - $this->pdf->gettMargin() - $this->pdf->getbMargin()) &&
2616
+                $y + $sub->_maxY >= ($this->pdf->getH() - $this->pdf->getbMargin())
2617 2617
             ) {
2618 2618
                 $this->_setNewPage();
2619 2619
             }
@@ -2669,10 +2669,10 @@  discard block
 block discarded – undo
2669 2669
             if ($this->parsingCss->value['margin-auto']) $alignObject = 'center';
2670 2670
 
2671 2671
             $marge = array();
2672
-            $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l']+0.03;
2673
-            $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r']+0.03;
2674
-            $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t']+0.03;
2675
-            $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b']+0.03;
2672
+            $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l'] + 0.03;
2673
+            $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r'] + 0.03;
2674
+            $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t'] + 0.03;
2675
+            $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b'] + 0.03;
2676 2676
 
2677 2677
             // extract the content of the div
2678 2678
             $level = $this->parsingHtml->getLevel($this->_parsePos);
@@ -2691,10 +2691,10 @@  discard block
 block discarded – undo
2691 2691
             $wReel = $w;
2692 2692
             $hReel = $h;
2693 2693
 
2694
-            $w+= $marge['l']+$marge['r']+0.001;
2695
-            $h+= $marge['t']+$marge['b']+0.001;
2694
+            $w += $marge['l'] + $marge['r'] + 0.001;
2695
+            $h += $marge['t'] + $marge['b'] + 0.001;
2696 2696
 
2697
-            if ($this->parsingCss->value['overflow']=='hidden') {
2697
+            if ($this->parsingCss->value['overflow'] == 'hidden') {
2698 2698
                 $overW = max($w, $this->parsingCss->value['width']);
2699 2699
                 $overH = max($h, $this->parsingCss->value['height']);
2700 2700
                 $overflow = true;
@@ -2707,11 +2707,11 @@  discard block
 block discarded – undo
2707 2707
                 $overW = null;
2708 2708
                 $overH = null;
2709 2709
                 $overflow = false;
2710
-                $this->parsingCss->value['width']    = max($w, $this->parsingCss->value['width']);
2711
-                $this->parsingCss->value['height']    = max($h, $this->parsingCss->value['height']);
2710
+                $this->parsingCss->value['width'] = max($w, $this->parsingCss->value['width']);
2711
+                $this->parsingCss->value['height'] = max($h, $this->parsingCss->value['height']);
2712 2712
             }
2713 2713
 
2714
-            switch($this->parsingCss->value['rotate'])
2714
+            switch ($this->parsingCss->value['rotate'])
2715 2715
             {
2716 2716
                 case 90:
2717 2717
                     $tmp = $overH; $overH = $overW; $overW = $tmp;
@@ -2719,7 +2719,7 @@  discard block
 block discarded – undo
2719 2719
                     unset($tmp);
2720 2720
                     $w = $this->parsingCss->value['height'];
2721 2721
                     $h = $this->parsingCss->value['width'];
2722
-                    $tX =-$h;
2722
+                    $tX = -$h;
2723 2723
                     $tY = 0;
2724 2724
                     break;
2725 2725
 
@@ -2737,7 +2737,7 @@  discard block
 block discarded – undo
2737 2737
                     $w = $this->parsingCss->value['height'];
2738 2738
                     $h = $this->parsingCss->value['width'];
2739 2739
                     $tX = 0;
2740
-                    $tY =-$w;
2740
+                    $tY = -$w;
2741 2741
                     break;
2742 2742
 
2743 2743
                 default:
@@ -2748,26 +2748,26 @@  discard block
 block discarded – undo
2748 2748
                     break;
2749 2749
             }
2750 2750
 
2751
-            if (!$this->parsingCss->value['position']) {
2751
+            if ( ! $this->parsingCss->value['position']) {
2752 2752
                 if (
2753
-                    $w < ($this->pdf->getW() - $this->pdf->getlMargin()-$this->pdf->getrMargin()) &&
2754
-                    $this->pdf->getX() + $w>=($this->pdf->getW() - $this->pdf->getrMargin())
2753
+                    $w < ($this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin()) &&
2754
+                    $this->pdf->getX() + $w >= ($this->pdf->getW() - $this->pdf->getrMargin())
2755 2755
                     )
2756 2756
                     $this->_tag_open_BR(array());
2757 2757
 
2758 2758
                 if (
2759
-                        ($h < ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin())) &&
2760
-                        ($this->pdf->getY() + $h>=($this->pdf->getH() - $this->pdf->getbMargin())) &&
2761
-                        !$this->_isInOverflow
2759
+                        ($h < ($this->pdf->getH() - $this->pdf->gettMargin() - $this->pdf->getbMargin())) &&
2760
+                        ($this->pdf->getY() + $h >= ($this->pdf->getH() - $this->pdf->getbMargin())) &&
2761
+                        ! $this->_isInOverflow
2762 2762
                     )
2763 2763
                     $this->_setNewPage();
2764 2764
 
2765 2765
                 $old = $this->parsingCss->getOldValues();
2766 2766
                 $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
2767 2767
 
2768
-                if ($parentWidth>$w) {
2769
-                    if ($alignObject=='center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5);
2770
-                    else if ($alignObject=='right')    $this->pdf->setX($this->pdf->getX() + $parentWidth-$w);
2768
+                if ($parentWidth > $w) {
2769
+                    if ($alignObject == 'center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5);
2770
+                    else if ($alignObject == 'right')    $this->pdf->setX($this->pdf->getX() + $parentWidth - $w);
2771 2771
                 }
2772 2772
 
2773 2773
                 $this->parsingCss->setPosition();
@@ -2775,9 +2775,9 @@  discard block
 block discarded – undo
2775 2775
                 $old = $this->parsingCss->getOldValues();
2776 2776
                 $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
2777 2777
 
2778
-                if ($parentWidth>$w) {
2779
-                    if ($alignObject=='center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5);
2780
-                    else if ($alignObject=='right')    $this->pdf->setX($this->pdf->getX() + $parentWidth-$w);
2778
+                if ($parentWidth > $w) {
2779
+                    if ($alignObject == 'center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5);
2780
+                    else if ($alignObject == 'right')    $this->pdf->setX($this->pdf->getX() + $parentWidth - $w);
2781 2781
                 }
2782 2782
 
2783 2783
                 $this->parsingCss->setPosition();
@@ -2806,61 +2806,61 @@  discard block
 block discarded – undo
2806 2806
             );
2807 2807
 
2808 2808
             $marge = array();
2809
-            $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l']+0.03;
2810
-            $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r']+0.03;
2811
-            $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t']+0.03;
2812
-            $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b']+0.03;
2809
+            $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l'] + 0.03;
2810
+            $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r'] + 0.03;
2811
+            $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t'] + 0.03;
2812
+            $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b'] + 0.03;
2813 2813
 
2814
-            $this->parsingCss->value['width'] -= $marge['l']+$marge['r'];
2815
-            $this->parsingCss->value['height']-= $marge['t']+$marge['b'];
2814
+            $this->parsingCss->value['width'] -= $marge['l'] + $marge['r'];
2815
+            $this->parsingCss->value['height'] -= $marge['t'] + $marge['b'];
2816 2816
 
2817 2817
             $xCorr = 0;
2818 2818
             $yCorr = 0;
2819
-            if (!$this->_subPart && !$this->_isSubPart) {
2820
-                switch($this->parsingCss->value['text-align'])
2819
+            if ( ! $this->_subPart && ! $this->_isSubPart) {
2820
+                switch ($this->parsingCss->value['text-align'])
2821 2821
                 {
2822 2822
                     case 'right':
2823
-                        $xCorr = ($this->parsingCss->value['width']-$wReel);
2823
+                        $xCorr = ($this->parsingCss->value['width'] - $wReel);
2824 2824
                         break;
2825 2825
                     case 'center':
2826
-                        $xCorr = ($this->parsingCss->value['width']-$wReel)*0.5;
2826
+                        $xCorr = ($this->parsingCss->value['width'] - $wReel) * 0.5;
2827 2827
                         break;
2828 2828
                 }
2829
-                if ($xCorr>0) $xCorr=0;
2830
-                switch($this->parsingCss->value['vertical-align'])
2829
+                if ($xCorr > 0) $xCorr = 0;
2830
+                switch ($this->parsingCss->value['vertical-align'])
2831 2831
                 {
2832 2832
                     case 'bottom':
2833
-                        $yCorr = ($this->parsingCss->value['height']-$hReel);
2833
+                        $yCorr = ($this->parsingCss->value['height'] - $hReel);
2834 2834
                         break;
2835 2835
                     case 'middle':
2836
-                        $yCorr = ($this->parsingCss->value['height']-$hReel)*0.5;
2836
+                        $yCorr = ($this->parsingCss->value['height'] - $hReel) * 0.5;
2837 2837
                         break;
2838 2838
                 }
2839 2839
             }
2840 2840
 
2841 2841
             if ($overflow) {
2842
-                $overW-= $marge['l']+$marge['r'];
2843
-                $overH-= $marge['t']+$marge['b'];
2842
+                $overW -= $marge['l'] + $marge['r'];
2843
+                $overH -= $marge['t'] + $marge['b'];
2844 2844
                 $this->pdf->clippingPathStart(
2845
-                    $this->parsingCss->value['x']+$marge['l'],
2846
-                    $this->parsingCss->value['y']+$marge['t'],
2845
+                    $this->parsingCss->value['x'] + $marge['l'],
2846
+                    $this->parsingCss->value['y'] + $marge['t'],
2847 2847
                     $this->parsingCss->value['width'],
2848 2848
                     $this->parsingCss->value['height']
2849 2849
                 );
2850 2850
 
2851
-                $this->parsingCss->value['x']+= $xCorr;
2851
+                $this->parsingCss->value['x'] += $xCorr;
2852 2852
 
2853 2853
                 // marges from the dimension of the content
2854
-                $mL = $this->parsingCss->value['x']+$marge['l'];
2854
+                $mL = $this->parsingCss->value['x'] + $marge['l'];
2855 2855
                 $mR = $this->pdf->getW() - $mL - $overW;
2856 2856
             } else {
2857 2857
                 // marges from the dimension of the div
2858
-                $mL = $this->parsingCss->value['x']+$marge['l'];
2858
+                $mL = $this->parsingCss->value['x'] + $marge['l'];
2859 2859
                 $mR = $this->pdf->getW() - $mL - $this->parsingCss->value['width'];
2860 2860
             }
2861 2861
 
2862
-            $x = $this->parsingCss->value['x']+$marge['l'];
2863
-            $y = $this->parsingCss->value['y']+$marge['t']+$yCorr;
2862
+            $x = $this->parsingCss->value['x'] + $marge['l'];
2863
+            $y = $this->parsingCss->value['y'] + $marge['t'] + $yCorr;
2864 2864
             $this->_saveMargin($mL, 0, $mR);
2865 2865
             $this->pdf->setXY($x, $y);
2866 2866
 
@@ -2908,10 +2908,10 @@  discard block
 block discarded – undo
2908 2908
             $this->parsingCss->analyse('fieldset', $param);
2909 2909
 
2910 2910
             // get height of LEGEND element and make fieldset corrections
2911
-            for ($tempPos = $this->_parsePos + 1; $tempPos<count($this->parsingHtml->code); $tempPos++) {
2911
+            for ($tempPos = $this->_parsePos + 1; $tempPos < count($this->parsingHtml->code); $tempPos++) {
2912 2912
                 $action = $this->parsingHtml->code[$tempPos];
2913 2913
                 if ($action['name'] == 'fieldset') break;
2914
-                if ($action['name'] == 'legend' && !$action['close']) {
2914
+                if ($action['name'] == 'legend' && ! $action['close']) {
2915 2915
                     $legendOpenPos = $tempPos;
2916 2916
 
2917 2917
                     $sub = null;
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
                     $sub->parsingHtml->code = $this->parsingHtml->getLevel($tempPos - 1);
2920 2920
 
2921 2921
                     $res = null;
2922
-                    for ($sub->_parsePos = 0; $sub->_parsePos<count($sub->parsingHtml->code); $sub->_parsePos++) {
2922
+                    for ($sub->_parsePos = 0; $sub->_parsePos < count($sub->parsingHtml->code); $sub->_parsePos++) {
2923 2923
                         $action = $sub->parsingHtml->code[$sub->_parsePos];
2924 2924
                         $sub->_executeAction($action);
2925 2925
 
@@ -2953,11 +2953,11 @@  discard block
 block discarded – undo
2953 2953
          * @param  string $other name of tag that used the div tag
2954 2954
          * @return boolean
2955 2955
          */
2956
-        protected function _tag_close_DIV($param, $other='div')
2956
+        protected function _tag_close_DIV($param, $other = 'div')
2957 2957
         {
2958 2958
             if ($this->_isForOneLine) return false;
2959 2959
 
2960
-            if ($this->parsingCss->value['overflow']=='hidden') {
2960
+            if ($this->parsingCss->value['overflow'] == 'hidden') {
2961 2961
                 $this->_maxX = $this->parsingCss->value['old_maxX'];
2962 2962
                 $this->_maxY = $this->parsingCss->value['old_maxY'];
2963 2963
                 $this->_maxH = $this->parsingCss->value['old_maxH'];
@@ -2969,17 +2969,17 @@  discard block
 block discarded – undo
2969 2969
                 $this->pdf->stopTransform();
2970 2970
 
2971 2971
             $marge = array();
2972
-            $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l']+0.03;
2973
-            $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r']+0.03;
2974
-            $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t']+0.03;
2975
-            $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b']+0.03;
2972
+            $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l'] + 0.03;
2973
+            $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r'] + 0.03;
2974
+            $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t'] + 0.03;
2975
+            $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b'] + 0.03;
2976 2976
 
2977 2977
             $x = $this->parsingCss->value['x'];
2978 2978
             $y = $this->parsingCss->value['y'];
2979
-            $w = $this->parsingCss->value['width']+$marge['l']+$marge['r']+$this->parsingCss->value['margin']['r'];
2980
-            $h = $this->parsingCss->value['height']+$marge['t']+$marge['b']+$this->parsingCss->value['margin']['b'];
2979
+            $w = $this->parsingCss->value['width'] + $marge['l'] + $marge['r'] + $this->parsingCss->value['margin']['r'];
2980
+            $h = $this->parsingCss->value['height'] + $marge['t'] + $marge['b'] + $this->parsingCss->value['margin']['b'];
2981 2981
 
2982
-            switch($this->parsingCss->value['rotate'])
2982
+            switch ($this->parsingCss->value['rotate'])
2983 2983
             {
2984 2984
                 case 90:
2985 2985
                     $t = $w; $w = $h; $h = $t;
@@ -2994,11 +2994,11 @@  discard block
 block discarded – undo
2994 2994
             }
2995 2995
 
2996 2996
 
2997
-            if ($this->parsingCss->value['position']!='absolute') {
2998
-                $this->pdf->setXY($x+$w, $y);
2997
+            if ($this->parsingCss->value['position'] != 'absolute') {
2998
+                $this->pdf->setXY($x + $w, $y);
2999 2999
 
3000
-                $this->_maxX = max($this->_maxX, $x+$w);
3001
-                $this->_maxY = max($this->_maxY, $y+$h);
3000
+                $this->_maxX = max($this->_maxX, $x + $w);
3001
+                $this->_maxY = max($this->_maxY, $y + $h);
3002 3002
                 $this->_maxH = max($this->_maxH, $h);
3003 3003
             } else {
3004 3004
                 $this->pdf->setXY($this->parsingCss->value['xc'], $this->parsingCss->value['yc']);
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
                 $this->_loadMax();
3007 3007
             }
3008 3008
 
3009
-            $block = ($this->parsingCss->value['display']!='inline' && $this->parsingCss->value['position']!='absolute');
3009
+            $block = ($this->parsingCss->value['display'] != 'inline' && $this->parsingCss->value['position'] != 'absolute');
3010 3010
 
3011 3011
             $this->parsingCss->load();
3012 3012
             $this->parsingCss->fontSet();
@@ -3065,13 +3065,13 @@  discard block
 block discarded – undo
3065 3065
         {
3066 3066
             // for  compatibility with old versions < 3.29
3067 3067
             $lstBarcode = array();
3068
-            $lstBarcode['UPC_A']  =    'UPCA';
3069
-            $lstBarcode['CODE39'] =    'C39';
3068
+            $lstBarcode['UPC_A']  = 'UPCA';
3069
+            $lstBarcode['CODE39'] = 'C39';
3070 3070
 
3071
-            if (!isset($param['type']))     $param['type'] = 'C39';
3072
-            if (!isset($param['value']))    $param['value']    = 0;
3073
-            if (!isset($param['label']))    $param['label']    = 'label';
3074
-            if (!isset($param['style']['color'])) $param['style']['color'] = '#000000';
3071
+            if ( ! isset($param['type']))     $param['type'] = 'C39';
3072
+            if ( ! isset($param['value']))    $param['value']    = 0;
3073
+            if ( ! isset($param['label']))    $param['label']    = 'label';
3074
+            if ( ! isset($param['style']['color'])) $param['style']['color'] = '#000000';
3075 3075
 
3076 3076
             if ($this->_testIsDeprecated && (isset($param['bar_h']) || isset($param['bar_w'])))
3077 3077
                 throw new HTML2PDF_exception(9, array('BARCODE', 'bar_h, bar_w'));
@@ -3086,18 +3086,18 @@  discard block
 block discarded – undo
3086 3086
 
3087 3087
             $x = $this->pdf->getX();
3088 3088
             $y = $this->pdf->getY();
3089
-            $w = $this->parsingCss->value['width'];    if (!$w) $w = $this->parsingCss->ConvertToMM('50mm');
3090
-            $h = $this->parsingCss->value['height'];    if (!$h) $h = $this->parsingCss->ConvertToMM('10mm');
3091
-            $txt = ($param['label']!=='none' ? $this->parsingCss->value['font-size'] : false);
3089
+            $w = $this->parsingCss->value['width']; if ( ! $w) $w = $this->parsingCss->ConvertToMM('50mm');
3090
+            $h = $this->parsingCss->value['height']; if ( ! $h) $h = $this->parsingCss->ConvertToMM('10mm');
3091
+            $txt = ($param['label'] !== 'none' ? $this->parsingCss->value['font-size'] : false);
3092 3092
             $c = $this->parsingCss->value['color'];
3093 3093
             $infos = $this->pdf->myBarcode($param['value'], $param['type'], $x, $y, $w, $h, $txt, $c);
3094 3094
 
3095
-            $this->_maxX = max($this->_maxX, $x+$infos[0]);
3096
-            $this->_maxY = max($this->_maxY, $y+$infos[1]);
3095
+            $this->_maxX = max($this->_maxX, $x + $infos[0]);
3096
+            $this->_maxY = max($this->_maxY, $y + $infos[1]);
3097 3097
             $this->_maxH = max($this->_maxH, $infos[1]);
3098 3098
             $this->_maxE++;
3099 3099
 
3100
-            $this->pdf->setXY($x+$infos[0], $y);
3100
+            $this->pdf->setXY($x + $infos[0], $y);
3101 3101
 
3102 3102
             $this->parsingCss->load();
3103 3103
             $this->parsingCss->fontSet();
@@ -3133,19 +3133,19 @@  discard block
 block discarded – undo
3133 3133
 
3134 3134
             if ($this->_debugActif) $this->_DEBUG_add('QRCODE');
3135 3135
 
3136
-            if (!isset($param['value']))                     $param['value'] = '';
3137
-            if (!isset($param['ec']))                        $param['ec'] = 'H';
3138
-            if (!isset($param['style']['color']))            $param['style']['color'] = '#000000';
3139
-            if (!isset($param['style']['background-color'])) $param['style']['background-color'] = '#FFFFFF';
3136
+            if ( ! isset($param['value']))                     $param['value'] = '';
3137
+            if ( ! isset($param['ec']))                        $param['ec'] = 'H';
3138
+            if ( ! isset($param['style']['color']))            $param['style']['color'] = '#000000';
3139
+            if ( ! isset($param['style']['background-color'])) $param['style']['background-color'] = '#FFFFFF';
3140 3140
             if (isset($param['style']['border'])) {
3141
-                $borders = $param['style']['border']!='none';
3141
+                $borders = $param['style']['border'] != 'none';
3142 3142
                 unset($param['style']['border']);
3143 3143
             } else {
3144 3144
                 $borders = true;
3145 3145
             }
3146 3146
 
3147
-            if ($param['value']==='') return true;
3148
-            if (!in_array($param['ec'], array('L', 'M', 'Q', 'H'))) $param['ec'] = 'H';
3147
+            if ($param['value'] === '') return true;
3148
+            if ( ! in_array($param['ec'], array('L', 'M', 'Q', 'H'))) $param['ec'] = 'H';
3149 3149
 
3150 3150
             $this->parsingCss->save();
3151 3151
             $this->parsingCss->analyse('qrcode', $param);
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
             $y = $this->pdf->getY();
3157 3157
             $w = $this->parsingCss->value['width'];
3158 3158
             $h = $this->parsingCss->value['height'];
3159
-            $size = max($w, $h); if (!$size) $size = $this->parsingCss->ConvertToMM('50mm');
3159
+            $size = max($w, $h); if ( ! $size) $size = $this->parsingCss->ConvertToMM('50mm');
3160 3160
 
3161 3161
             $style = array(
3162 3162
                     'fgcolor' => $this->parsingCss->value['color'],
@@ -3171,16 +3171,16 @@  discard block
 block discarded – undo
3171 3171
                 $style['padding'] = 0;
3172 3172
             }
3173 3173
 
3174
-            if (!$this->_subPart && !$this->_isSubPart) {
3174
+            if ( ! $this->_subPart && ! $this->_isSubPart) {
3175 3175
                 $this->pdf->write2DBarcode($param['value'], 'QRCODE,'.$param['ec'], $x, $y, $size, $size, $style);
3176 3176
             }
3177 3177
 
3178
-            $this->_maxX = max($this->_maxX, $x+$size);
3179
-            $this->_maxY = max($this->_maxY, $y+$size);
3178
+            $this->_maxX = max($this->_maxX, $x + $size);
3179
+            $this->_maxY = max($this->_maxY, $y + $size);
3180 3180
             $this->_maxH = max($this->_maxH, $size);
3181 3181
             $this->_maxE++;
3182 3182
 
3183
-            $this->pdf->setX($x+$size);
3183
+            $this->pdf->setX($x + $size);
3184 3184
 
3185 3185
             $this->parsingCss->load();
3186 3186
             $this->parsingCss->fontSet();
@@ -3214,7 +3214,7 @@  discard block
 block discarded – undo
3214 3214
             $titre = isset($param['title']) ? trim($param['title']) : '';
3215 3215
             $level = isset($param['level']) ? floor($param['level']) : 0;
3216 3216
 
3217
-            if ($level<0) $level = 0;
3217
+            if ($level < 0) $level = 0;
3218 3218
             if ($titre) $this->pdf->Bookmark($titre, $level, -1);
3219 3219
 
3220 3220
             return true;
@@ -3242,7 +3242,7 @@  discard block
 block discarded – undo
3242 3242
          */
3243 3243
         protected function _tag_open_WRITE($param)
3244 3244
         {
3245
-            $fill = ($this->parsingCss->value['background']['color']!==null && $this->parsingCss->value['background']['image']===null);
3245
+            $fill = ($this->parsingCss->value['background']['color'] !== null && $this->parsingCss->value['background']['image'] === null);
3246 3246
             if (in_array($this->parsingCss->value['id_tag'], array('fieldset', 'legend', 'div', 'table', 'tr', 'td', 'th'))) {
3247 3247
                 $fill = false;
3248 3248
             }
@@ -3258,23 +3258,23 @@  discard block
 block discarded – undo
3258 3258
             $txt = str_replace('[[page_nb]]', $this->pdf->getMyAliasNbPages(), $txt);
3259 3259
             $txt = str_replace('[[page_cu]]', $this->pdf->getMyNumPage($this->_page), $txt);
3260 3260
 
3261
-            if ($this->parsingCss->value['text-transform']!='none') {
3262
-                if ($this->parsingCss->value['text-transform']=='capitalize')
3261
+            if ($this->parsingCss->value['text-transform'] != 'none') {
3262
+                if ($this->parsingCss->value['text-transform'] == 'capitalize')
3263 3263
                     $txt = ucwords($txt);
3264
-                else if ($this->parsingCss->value['text-transform']=='uppercase')
3264
+                else if ($this->parsingCss->value['text-transform'] == 'uppercase')
3265 3265
                     $txt = strtoupper($txt);
3266
-                else if ($this->parsingCss->value['text-transform']=='lowercase')
3266
+                else if ($this->parsingCss->value['text-transform'] == 'lowercase')
3267 3267
                     $txt = strtolower($txt);
3268 3268
             }
3269 3269
 
3270 3270
             // size of the text
3271
-            $h  = 1.08*$this->parsingCss->value['font-size'];
3272
-            $dh = $h*$this->parsingCss->value['mini-decal'];
3271
+            $h  = 1.08 * $this->parsingCss->value['font-size'];
3272
+            $dh = $h * $this->parsingCss->value['mini-decal'];
3273 3273
             $lh = $this->parsingCss->getLineHeight();
3274 3274
 
3275 3275
             // identify the align
3276 3276
             $align = 'L';
3277
-            if ($this->parsingCss->value['text-align']=='li_right') {
3277
+            if ($this->parsingCss->value['text-align'] == 'li_right') {
3278 3278
                 $w = $this->parsingCss->value['width'];
3279 3279
                 $align = 'R';
3280 3280
             }
@@ -3284,10 +3284,10 @@  discard block
 block discarded – undo
3284 3284
             $words = explode(' ', $txt);
3285 3285
             foreach ($words as $k => $word) {
3286 3286
                 $words[$k] = array($word, $this->pdf->GetStringWidth($word));
3287
-                $w+= $words[$k][1];
3287
+                $w += $words[$k][1];
3288 3288
             }
3289 3289
             $space = $this->pdf->GetStringWidth(' ');
3290
-            $w+= $space*(count($words)-1);
3290
+            $w += $space * (count($words) - 1);
3291 3291
 
3292 3292
             // position in the text
3293 3293
             $currPos = 0;
@@ -3307,40 +3307,40 @@  discard block
 block discarded – undo
3307 3307
             $nb = 0;
3308 3308
 
3309 3309
             // while we have words, and the text does not fit on the line => we cut the sentence
3310
-            while ($x+$w>$right && $x<$right+$space && count($words)) {
3310
+            while ($x + $w > $right && $x < $right + $space && count($words)) {
3311 3311
                 // adding words 1 by 1 to fit on the line
3312
-                $i=0;
3312
+                $i = 0;
3313 3313
                 $old = array('', 0);
3314 3314
                 $str = $words[0];
3315 3315
                 $add = false;
3316
-                while (($x+$str[1])<$right) {
3316
+                while (($x + $str[1]) < $right) {
3317 3317
                     $i++;
3318 3318
                     $add = true;
3319 3319
 
3320 3320
                     array_shift($words);
3321 3321
                     $old = $str;
3322 3322
 
3323
-                    if (!count($words)) break;
3324
-                    $str[0].= ' '.$words[0][0];
3325
-                    $str[1]+= $space+$words[0][1];
3323
+                    if ( ! count($words)) break;
3324
+                    $str[0] .= ' '.$words[0][0];
3325
+                    $str[1] += $space + $words[0][1];
3326 3326
                 }
3327 3327
                 $str = $old;
3328 3328
 
3329 3329
                 // if  nothing fit on the line, and if the first word does not fit on the line => the word is too long, we put it
3330
-                if ($i==0 && (($left+$words[0][1])>=$right)) {
3330
+                if ($i == 0 && (($left + $words[0][1]) >= $right)) {
3331 3331
                     $str = $words[0];
3332 3332
                     array_shift($words);
3333 3333
                     $i++;
3334 3334
                     $add = true;
3335 3335
                 }
3336
-                $currPos+= ($currPos ? 1 : 0)+strlen($str[0]);
3336
+                $currPos += ($currPos ? 1 : 0) + strlen($str[0]);
3337 3337
 
3338 3338
                 // write the extract sentence that fit on the page
3339
-                $wc = ($align=='L' ? $str[1] : $this->parsingCss->value['width']);
3340
-                if ($right - $left<$wc) $wc = $right - $left;
3339
+                $wc = ($align == 'L' ? $str[1] : $this->parsingCss->value['width']);
3340
+                if ($right - $left < $wc) $wc = $right - $left;
3341 3341
 
3342 3342
                 if (strlen($str[0])) {
3343
-                    $this->pdf->setXY($this->pdf->getX(), $y+$dh+$dy);
3343
+                    $this->pdf->setXY($this->pdf->getX(), $y + $dh + $dy);
3344 3344
                     $this->pdf->Cell($wc, $h, $str[0], 0, 0, $align, $fill, $this->_isInLink);
3345 3345
                     $this->pdf->setXY($this->pdf->getX(), $y);
3346 3346
                 }
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
                 $maxX = max($maxX, $this->pdf->getX());
3351 3351
 
3352 3352
                 // new position and new width for the "while"
3353
-                $w-= $str[1];
3353
+                $w -= $str[1];
3354 3354
                 $y = $this->pdf->getY();
3355 3355
                 $x = $this->pdf->getX();
3356 3356
                 $dy = $this->_getElementY($lh);
@@ -3358,16 +3358,16 @@  discard block
 block discarded – undo
3358 3358
                 // if we have again words to write
3359 3359
                 if (count($words)) {
3360 3360
                     // remove the space at the end
3361
-                    if ($add) $w-= $space;
3361
+                    if ($add) $w -= $space;
3362 3362
 
3363 3363
                     // if we don't add any word, and if the first word is empty => useless space to skip
3364
-                    if (!$add && $words[0][0]==='') {
3364
+                    if ( ! $add && $words[0][0] === '') {
3365 3365
                         array_shift($words);
3366 3366
                     }
3367 3367
 
3368 3368
                     // if it is just to calculate for one line => adding the number of words
3369 3369
                     if ($this->_isForOneLine) {
3370
-                        $this->_maxE+= $i;
3370
+                        $this->_maxE += $i;
3371 3371
                         $this->_maxX = max($this->_maxX, $maxX);
3372 3372
                         return null;
3373 3373
                     }
@@ -3381,8 +3381,8 @@  discard block
 block discarded – undo
3381 3381
                     $dy = $this->_getElementY($lh);
3382 3382
 
3383 3383
                     // if the next line does  not fit on the page => new page
3384
-                    if ($y + $h>=$this->pdf->getH() - $this->pdf->getbMargin()) {
3385
-                        if (!$this->_isInOverflow && !$this->_isInFooter) {
3384
+                    if ($y + $h >= $this->pdf->getH() - $this->pdf->getbMargin()) {
3385
+                        if ( ! $this->_isInOverflow && ! $this->_isInFooter) {
3386 3386
                             $this->_setNewPage(null, '', null, $currPos);
3387 3387
                             $y = $this->pdf->getY();
3388 3388
                             $x = $this->pdf->getX();
@@ -3392,9 +3392,9 @@  discard block
 block discarded – undo
3392 3392
 
3393 3393
                     // if more than 10000 line => error
3394 3394
                     $nb++;
3395
-                    if ($nb>10000) {
3396
-                        $txt = ''; foreach ($words as $k => $word) $txt.= ($k ? ' ' : '').$word[0];
3397
-                        throw new HTML2PDF_exception(2, array($txt, $right-$left, $w));
3395
+                    if ($nb > 10000) {
3396
+                        $txt = ''; foreach ($words as $k => $word) $txt .= ($k ? ' ' : '').$word[0];
3397
+                        throw new HTML2PDF_exception(2, array($txt, $right - $left, $w));
3398 3398
                     }
3399 3399
 
3400 3400
                     // new margins for the new line
@@ -3404,17 +3404,17 @@  discard block
 block discarded – undo
3404 3404
 
3405 3405
             // if we have words after automatic cut, it is because they fit on the line => we write the text
3406 3406
             if (count($words)) {
3407
-                $txt = ''; foreach ($words as $k => $word) $txt.= ($k ? ' ' : '').$word[0];
3408
-                $w+= $this->pdf->getWordSpacing()*(count($words));
3409
-                $this->pdf->setXY($this->pdf->getX(), $y+$dh+$dy);
3410
-                $this->pdf->Cell(($align=='L' ? $w : $this->parsingCss->value['width']), $h, $txt, 0, 0, $align, $fill, $this->_isInLink);
3407
+                $txt = ''; foreach ($words as $k => $word) $txt .= ($k ? ' ' : '').$word[0];
3408
+                $w += $this->pdf->getWordSpacing() * (count($words));
3409
+                $this->pdf->setXY($this->pdf->getX(), $y + $dh + $dy);
3410
+                $this->pdf->Cell(($align == 'L' ? $w : $this->parsingCss->value['width']), $h, $txt, 0, 0, $align, $fill, $this->_isInLink);
3411 3411
                 $this->pdf->setXY($this->pdf->getX(), $y);
3412 3412
                 $this->_maxH = max($this->_maxH, $lh);
3413
-                $this->_maxE+= count($words);
3413
+                $this->_maxE += count($words);
3414 3414
             }
3415 3415
 
3416 3416
             $maxX = max($maxX, $this->pdf->getX());
3417
-            $maxY = $this->pdf->getY()+$h;
3417
+            $maxY = $this->pdf->getY() + $h;
3418 3418
 
3419 3419
             $this->_maxX = max($this->_maxX, $maxX);
3420 3420
             $this->_maxY = max($this->_maxY, $maxY);
@@ -3436,7 +3436,7 @@  discard block
 block discarded – undo
3436 3436
 
3437 3437
             $h = max($this->_maxH, $this->parsingCss->getLineHeight());
3438 3438
 
3439
-            if ($this->_maxH==0) $this->_maxY = max($this->_maxY, $this->pdf->getY()+$h);
3439
+            if ($this->_maxH == 0) $this->_maxY = max($this->_maxY, $this->pdf->getY() + $h);
3440 3440
 
3441 3441
             $this->_makeBreakLine($h, $curr);
3442 3442
 
@@ -3462,21 +3462,21 @@  discard block
 block discarded – undo
3462 3462
             if ($this->_maxH) $this->_tag_open_BR($param);
3463 3463
 
3464 3464
             $fontSize = $this->parsingCss->value['font-size'];
3465
-            $this->parsingCss->value['font-size']=$fontSize*0.5; $this->_tag_open_BR($param);
3466
-            $this->parsingCss->value['font-size']=0;
3465
+            $this->parsingCss->value['font-size'] = $fontSize * 0.5; $this->_tag_open_BR($param);
3466
+            $this->parsingCss->value['font-size'] = 0;
3467 3467
 
3468 3468
             $param['style']['width'] = '100%';
3469 3469
 
3470 3470
             $this->parsingCss->save();
3471
-            $this->parsingCss->value['height']=$this->parsingCss->ConvertToMM('1mm');
3471
+            $this->parsingCss->value['height'] = $this->parsingCss->ConvertToMM('1mm');
3472 3472
 
3473 3473
             $this->parsingCss->analyse('hr', $param);
3474 3474
             $this->parsingCss->setPosition();
3475 3475
             $this->parsingCss->fontSet();
3476 3476
 
3477 3477
             $h = $this->parsingCss->value['height'];
3478
-            if ($h)    $h-= $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width'];
3479
-            if ($h<=0) $h = $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width'];
3478
+            if ($h)    $h -= $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['border']['b']['width'];
3479
+            if ($h <= 0) $h = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['border']['b']['width'];
3480 3480
 
3481 3481
             $this->_drawRectangle($this->pdf->getX(), $this->pdf->getY(), $this->parsingCss->value['width'], $h, $this->parsingCss->value['border'], 0, 0, $this->parsingCss->value['background']);
3482 3482
             $this->_maxH = $h;
@@ -3486,8 +3486,8 @@  discard block
 block discarded – undo
3486 3486
 
3487 3487
             $this->_tag_open_BR($param);
3488 3488
 
3489
-            $this->parsingCss->value['font-size']=$fontSize*0.5; $this->_tag_open_BR($param);
3490
-            $this->parsingCss->value['font-size']=$fontSize;
3489
+            $this->parsingCss->value['font-size'] = $fontSize * 0.5; $this->_tag_open_BR($param);
3490
+            $this->parsingCss->value['font-size'] = $fontSize;
3491 3491
 
3492 3492
             $this->parsingCss->value['text-align'] = $oldAlign;
3493 3493
             $this->_setNewPositionForNewLine();
@@ -3749,7 +3749,7 @@  discard block
 block discarded – undo
3749 3749
          * @param  string $other
3750 3750
          * @return boolean
3751 3751
          */
3752
-        protected function _tag_open_U($param, $other='u')
3752
+        protected function _tag_open_U($param, $other = 'u')
3753 3753
         {
3754 3754
             $this->parsingCss->save();
3755 3755
             $this->parsingCss->value['font-underline'] = true;
@@ -3811,10 +3811,10 @@  discard block
 block discarded – undo
3811 3811
             $this->_isInLink = str_replace('&amp;', '&', isset($param['href']) ? $param['href'] : '');
3812 3812
 
3813 3813
             if (isset($param['name'])) {
3814
-                $name =     $param['name'];
3815
-                if (!isset($this->_lstAnchor[$name])) $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false);
3814
+                $name = $param['name'];
3815
+                if ( ! isset($this->_lstAnchor[$name])) $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false);
3816 3816
 
3817
-                if (!$this->_lstAnchor[$name][1]) {
3817
+                if ( ! $this->_lstAnchor[$name][1]) {
3818 3818
                     $this->_lstAnchor[$name][1] = true;
3819 3819
                     $this->pdf->SetLink($this->_lstAnchor[$name][0], -1, -1);
3820 3820
                 }
@@ -3822,7 +3822,7 @@  discard block
 block discarded – undo
3822 3822
 
3823 3823
             if (preg_match('/^#([^#]+)$/isU', $this->_isInLink, $match)) {
3824 3824
                 $name = $match[1];
3825
-                if (!isset($this->_lstAnchor[$name])) $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false);
3825
+                if ( ! isset($this->_lstAnchor[$name])) $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false);
3826 3826
 
3827 3827
                 $this->_isInLink = $this->_lstAnchor[$name][0];
3828 3828
             }
@@ -3846,7 +3846,7 @@  discard block
 block discarded – undo
3846 3846
          */
3847 3847
         protected function _tag_close_A($param)
3848 3848
         {
3849
-            $this->_isInLink    = '';
3849
+            $this->_isInLink = '';
3850 3850
             $this->parsingCss->load();
3851 3851
             $this->parsingCss->fontSet();
3852 3852
 
@@ -3955,7 +3955,7 @@  discard block
 block discarded – undo
3955 3955
         {
3956 3956
             if ($this->_isForOneLine) return false;
3957 3957
 
3958
-            $this->_maxH+= $this->parsingCss->value['margin']['b'];
3958
+            $this->_maxH += $this->parsingCss->value['margin']['b'];
3959 3959
             $h = max($this->_maxH, $this->parsingCss->getLineHeight());
3960 3960
 
3961 3961
             $this->parsingCss->load();
@@ -4122,7 +4122,7 @@  discard block
 block discarded – undo
4122 4122
         {
4123 4123
             if ($this->_isForOneLine) return false;
4124 4124
 
4125
-            if (!in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) {
4125
+            if ( ! in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) {
4126 4126
                 if ($this->_maxH) $this->_tag_open_BR(array());
4127 4127
             }
4128 4128
 
@@ -4132,21 +4132,21 @@  discard block
 block discarded – undo
4132 4132
             $this->parsingCss->fontSet();
4133 4133
 
4134 4134
              // cancel the effects of the setPosition
4135
-            $this->pdf->setXY($this->pdf->getX()-$this->parsingCss->value['margin']['l'], $this->pdf->getY()-$this->parsingCss->value['margin']['t']);
4135
+            $this->pdf->setXY($this->pdf->getX() - $this->parsingCss->value['margin']['l'], $this->pdf->getY() - $this->parsingCss->value['margin']['t']);
4136 4136
 
4137 4137
             list($mL, $mR) = $this->_getMargins($this->pdf->getY());
4138
-            $mR = $this->pdf->getW()-$mR;
4139
-            $mL+= $this->parsingCss->value['margin']['l']+$this->parsingCss->value['padding']['l'];
4140
-            $mR+= $this->parsingCss->value['margin']['r']+$this->parsingCss->value['padding']['r'];
4138
+            $mR = $this->pdf->getW() - $mR;
4139
+            $mL += $this->parsingCss->value['margin']['l'] + $this->parsingCss->value['padding']['l'];
4140
+            $mR += $this->parsingCss->value['margin']['r'] + $this->parsingCss->value['padding']['r'];
4141 4141
             $this->_saveMargin($mL, 0, $mR);
4142 4142
 
4143
-            if ($this->parsingCss->value['text-indent']>0) {
4144
-                $y = $this->pdf->getY()+$this->parsingCss->value['margin']['t']+$this->parsingCss->value['padding']['t'];
4145
-                $this->_pageMarges[floor($y*100)] = array($mL+$this->parsingCss->value['text-indent'], $this->pdf->getW()-$mR);
4146
-                $y+= $this->parsingCss->getLineHeight()*0.1;
4147
-                $this->_pageMarges[floor($y*100)] = array($mL, $this->pdf->getW()-$mR);
4143
+            if ($this->parsingCss->value['text-indent'] > 0) {
4144
+                $y = $this->pdf->getY() + $this->parsingCss->value['margin']['t'] + $this->parsingCss->value['padding']['t'];
4145
+                $this->_pageMarges[floor($y * 100)] = array($mL + $this->parsingCss->value['text-indent'], $this->pdf->getW() - $mR);
4146
+                $y += $this->parsingCss->getLineHeight() * 0.1;
4147
+                $this->_pageMarges[floor($y * 100)] = array($mL, $this->pdf->getW() - $mR);
4148 4148
             }
4149
-            $this->_makeBreakLine($this->parsingCss->value['margin']['t']+$this->parsingCss->value['padding']['t']);
4149
+            $this->_makeBreakLine($this->parsingCss->value['margin']['t'] + $this->parsingCss->value['padding']['t']);
4150 4150
             $this->_isInParagraph = array($mL, $mR);
4151 4151
             return true;
4152 4152
         }
@@ -4165,7 +4165,7 @@  discard block
 block discarded – undo
4165 4165
             if ($this->_maxH) $this->_tag_open_BR(array());
4166 4166
             $this->_isInParagraph = false;
4167 4167
             $this->_loadMargin();
4168
-            $h = $this->parsingCss->value['margin']['b']+$this->parsingCss->value['padding']['b'];
4168
+            $h = $this->parsingCss->value['margin']['b'] + $this->parsingCss->value['padding']['b'];
4169 4169
 
4170 4170
             $this->parsingCss->load();
4171 4171
             $this->parsingCss->fontSet();
@@ -4184,7 +4184,7 @@  discard block
 block discarded – undo
4184 4184
          */
4185 4185
         protected function _tag_open_PRE($param, $other = 'pre')
4186 4186
         {
4187
-            if ($other=='pre' && $this->_maxH) $this->_tag_open_BR(array());
4187
+            if ($other == 'pre' && $this->_maxH) $this->_tag_open_BR(array());
4188 4188
 
4189 4189
             $this->parsingCss->save();
4190 4190
             $this->parsingCss->value['font-family'] = 'courier';
@@ -4192,7 +4192,7 @@  discard block
 block discarded – undo
4192 4192
             $this->parsingCss->setPosition();
4193 4193
             $this->parsingCss->fontSet();
4194 4194
 
4195
-            if ($other=='pre') return $this->_tag_open_DIV($param, $other);
4195
+            if ($other == 'pre') return $this->_tag_open_DIV($param, $other);
4196 4196
 
4197 4197
             return true;
4198 4198
         }
@@ -4220,7 +4220,7 @@  discard block
 block discarded – undo
4220 4220
          */
4221 4221
         protected function _tag_close_PRE($param, $other = 'pre')
4222 4222
         {
4223
-            if ($other=='pre') {
4223
+            if ($other == 'pre') {
4224 4224
                 if ($this->_isForOneLine) return false;
4225 4225
 
4226 4226
                 $this->_tag_close_DIV($param, $other);
@@ -4254,7 +4254,7 @@  discard block
 block discarded – undo
4254 4254
         protected function _tag_open_BIG($param)
4255 4255
         {
4256 4256
             $this->parsingCss->save();
4257
-            $this->parsingCss->value['mini-decal']-= $this->parsingCss->value['mini-size']*0.12;
4257
+            $this->parsingCss->value['mini-decal'] -= $this->parsingCss->value['mini-size'] * 0.12;
4258 4258
             $this->parsingCss->value['mini-size'] *= 1.2;
4259 4259
             $this->parsingCss->analyse('big', $param);
4260 4260
             $this->parsingCss->setPosition();
@@ -4287,7 +4287,7 @@  discard block
 block discarded – undo
4287 4287
         protected function _tag_open_SMALL($param)
4288 4288
         {
4289 4289
             $this->parsingCss->save();
4290
-            $this->parsingCss->value['mini-decal']+= $this->parsingCss->value['mini-size']*0.05;
4290
+            $this->parsingCss->value['mini-decal'] += $this->parsingCss->value['mini-size'] * 0.05;
4291 4291
             $this->parsingCss->value['mini-size'] *= 0.82;
4292 4292
             $this->parsingCss->analyse('small', $param);
4293 4293
             $this->parsingCss->setPosition();
@@ -4320,7 +4320,7 @@  discard block
 block discarded – undo
4320 4320
         protected function _tag_open_SUP($param)
4321 4321
         {
4322 4322
             $this->parsingCss->save();
4323
-            $this->parsingCss->value['mini-decal']-= $this->parsingCss->value['mini-size']*0.15;
4323
+            $this->parsingCss->value['mini-decal'] -= $this->parsingCss->value['mini-size'] * 0.15;
4324 4324
             $this->parsingCss->value['mini-size'] *= 0.75;
4325 4325
             $this->parsingCss->analyse('sup', $param);
4326 4326
             $this->parsingCss->setPosition();
@@ -4354,7 +4354,7 @@  discard block
 block discarded – undo
4354 4354
         protected function _tag_open_SUB($param)
4355 4355
         {
4356 4356
             $this->parsingCss->save();
4357
-            $this->parsingCss->value['mini-decal']+= $this->parsingCss->value['mini-size']*0.15;
4357
+            $this->parsingCss->value['mini-decal'] += $this->parsingCss->value['mini-size'] * 0.15;
4358 4358
             $this->parsingCss->value['mini-size'] *= 0.75;
4359 4359
             $this->parsingCss->analyse('sub', $param);
4360 4360
             $this->parsingCss->setPosition();
@@ -4389,12 +4389,12 @@  discard block
 block discarded – undo
4389 4389
         {
4390 4390
             if ($this->_isForOneLine) return false;
4391 4391
 
4392
-            if (!in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) {
4392
+            if ( ! in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) {
4393 4393
                 if ($this->_maxH) $this->_tag_open_BR(array());
4394
-                if (!count($this->_defList)) $this->_tag_open_BR(array());
4394
+                if ( ! count($this->_defList)) $this->_tag_open_BR(array());
4395 4395
             }
4396 4396
 
4397
-            if (!isset($param['style']['width'])) $param['allwidth'] = true;
4397
+            if ( ! isset($param['style']['width'])) $param['allwidth'] = true;
4398 4398
             $param['cellspacing'] = 0;
4399 4399
 
4400 4400
             // a list is like a table
@@ -4433,8 +4433,8 @@  discard block
 block discarded – undo
4433 4433
 
4434 4434
             $this->_listeDelLevel();
4435 4435
 
4436
-            if (!$this->_subPart) {
4437
-                if (!count($this->_defList)) $this->_tag_open_BR(array());
4436
+            if ( ! $this->_subPart) {
4437
+                if ( ! count($this->_defList)) $this->_tag_open_BR(array());
4438 4438
             }
4439 4439
 
4440 4440
             return true;
@@ -4465,7 +4465,7 @@  discard block
 block discarded – undo
4465 4465
 
4466 4466
             $this->_listeAddLi();
4467 4467
 
4468
-            if (!isset($param['style']['width'])) $param['style']['width'] = '100%';
4468
+            if ( ! isset($param['style']['width'])) $param['style']['width'] = '100%';
4469 4469
 
4470 4470
             $paramPUCE = $param;
4471 4471
 
@@ -4492,7 +4492,7 @@  discard block
 block discarded – undo
4492 4492
 
4493 4493
             // if small LI
4494 4494
             if ($inf[1]) {
4495
-                $this->parsingCss->value['mini-decal']+= $this->parsingCss->value['mini-size']*0.045;
4495
+                $this->parsingCss->value['mini-decal'] += $this->parsingCss->value['mini-size'] * 0.045;
4496 4496
                 $this->parsingCss->value['mini-size'] *= 0.75;
4497 4497
             }
4498 4498
 
@@ -4500,21 +4500,21 @@  discard block
 block discarded – undo
4500 4500
             if ($this->_subPart) {
4501 4501
                 // TD for the puce
4502 4502
                 $tmpPos = $this->_tempPos;
4503
-                $tmpLst1 = $this->parsingHtml->code[$tmpPos+1];
4504
-                $tmpLst2 = $this->parsingHtml->code[$tmpPos+2];
4505
-                $this->parsingHtml->code[$tmpPos+1] = array();
4506
-                $this->parsingHtml->code[$tmpPos+1]['name']    = (isset($paramPUCE['src'])) ? 'img' : 'write';
4507
-                $this->parsingHtml->code[$tmpPos+1]['param']    = $paramPUCE; unset($this->parsingHtml->code[$tmpPos+1]['param']['style']['width']);
4508
-                $this->parsingHtml->code[$tmpPos+1]['close']    = 0;
4509
-                $this->parsingHtml->code[$tmpPos+2] = array();
4510
-                $this->parsingHtml->code[$tmpPos+2]['name']    = 'li';
4511
-                $this->parsingHtml->code[$tmpPos+2]['param']    = $paramPUCE;
4512
-                $this->parsingHtml->code[$tmpPos+2]['close']    = 1;
4503
+                $tmpLst1 = $this->parsingHtml->code[$tmpPos + 1];
4504
+                $tmpLst2 = $this->parsingHtml->code[$tmpPos + 2];
4505
+                $this->parsingHtml->code[$tmpPos + 1] = array();
4506
+                $this->parsingHtml->code[$tmpPos + 1]['name'] = (isset($paramPUCE['src'])) ? 'img' : 'write';
4507
+                $this->parsingHtml->code[$tmpPos + 1]['param']    = $paramPUCE; unset($this->parsingHtml->code[$tmpPos + 1]['param']['style']['width']);
4508
+                $this->parsingHtml->code[$tmpPos + 1]['close']    = 0;
4509
+                $this->parsingHtml->code[$tmpPos + 2] = array();
4510
+                $this->parsingHtml->code[$tmpPos + 2]['name'] = 'li';
4511
+                $this->parsingHtml->code[$tmpPos + 2]['param']    = $paramPUCE;
4512
+                $this->parsingHtml->code[$tmpPos + 2]['close']    = 1;
4513 4513
                 $this->_tag_open_TD($paramPUCE, 'li_sub');
4514 4514
                 $this->_tag_close_TD($param);
4515 4515
                 $this->_tempPos = $tmpPos;
4516
-                $this->parsingHtml->code[$tmpPos+1] = $tmpLst1;
4517
-                $this->parsingHtml->code[$tmpPos+2] = $tmpLst2;
4516
+                $this->parsingHtml->code[$tmpPos + 1] = $tmpLst1;
4517
+                $this->parsingHtml->code[$tmpPos + 2] = $tmpLst2;
4518 4518
             } else {
4519 4519
                 // TD for the puce
4520 4520
                 $this->_tag_open_TD($paramPUCE, 'li_sub');
@@ -4606,16 +4606,16 @@  discard block
 block discarded – undo
4606 4606
             if ($this->_subPart) {
4607 4607
                 HTML2PDF::$_tables[$param['num']]['thead']['tr'][0] = HTML2PDF::$_tables[$param['num']]['tr_curr'];
4608 4608
                 HTML2PDF::$_tables[$param['num']]['thead']['code'] = array();
4609
-                for ($pos=$this->_tempPos; $pos<count($this->parsingHtml->code); $pos++) {
4609
+                for ($pos = $this->_tempPos; $pos < count($this->parsingHtml->code); $pos++) {
4610 4610
                     $action = $this->parsingHtml->code[$pos];
4611
-                    if (strtolower($action['name'])=='thead') $action['name'] = 'thead_sub';
4611
+                    if (strtolower($action['name']) == 'thead') $action['name'] = 'thead_sub';
4612 4612
                     HTML2PDF::$_tables[$param['num']]['thead']['code'][] = $action;
4613
-                    if (strtolower($action['name'])=='thead_sub' && $action['close']) break;
4613
+                    if (strtolower($action['name']) == 'thead_sub' && $action['close']) break;
4614 4614
                 }
4615 4615
             } else {
4616 4616
                 $level = $this->parsingHtml->getLevel($this->_parsePos);
4617
-                $this->_parsePos+= count($level);
4618
-                HTML2PDF::$_tables[$param['num']]['tr_curr']+= count(HTML2PDF::$_tables[$param['num']]['thead']['tr']);
4617
+                $this->_parsePos += count($level);
4618
+                HTML2PDF::$_tables[$param['num']]['tr_curr'] += count(HTML2PDF::$_tables[$param['num']]['thead']['tr']);
4619 4619
             }
4620 4620
 
4621 4621
             return true;
@@ -4638,7 +4638,7 @@  discard block
 block discarded – undo
4638 4638
             // if we are in a sub HTM, construct the list of the TR in the thead
4639 4639
             if ($this->_subPart) {
4640 4640
                 $min = HTML2PDF::$_tables[$param['num']]['thead']['tr'][0];
4641
-                $max = HTML2PDF::$_tables[$param['num']]['tr_curr']-1;
4641
+                $max = HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1;
4642 4642
                 HTML2PDF::$_tables[$param['num']]['thead']['tr'] = range($min, $max);
4643 4643
             }
4644 4644
 
@@ -4665,16 +4665,16 @@  discard block
 block discarded – undo
4665 4665
             if ($this->_subPart) {
4666 4666
                 HTML2PDF::$_tables[$param['num']]['tfoot']['tr'][0] = HTML2PDF::$_tables[$param['num']]['tr_curr'];
4667 4667
                 HTML2PDF::$_tables[$param['num']]['tfoot']['code'] = array();
4668
-                for ($pos=$this->_tempPos; $pos<count($this->parsingHtml->code); $pos++) {
4668
+                for ($pos = $this->_tempPos; $pos < count($this->parsingHtml->code); $pos++) {
4669 4669
                     $action = $this->parsingHtml->code[$pos];
4670
-                    if (strtolower($action['name'])=='tfoot') $action['name'] = 'tfoot_sub';
4670
+                    if (strtolower($action['name']) == 'tfoot') $action['name'] = 'tfoot_sub';
4671 4671
                     HTML2PDF::$_tables[$param['num']]['tfoot']['code'][] = $action;
4672
-                    if (strtolower($action['name'])=='tfoot_sub' && $action['close']) break;
4672
+                    if (strtolower($action['name']) == 'tfoot_sub' && $action['close']) break;
4673 4673
                 }
4674 4674
             } else {
4675 4675
                 $level = $this->parsingHtml->getLevel($this->_parsePos);
4676
-                $this->_parsePos+= count($level);
4677
-                HTML2PDF::$_tables[$param['num']]['tr_curr']+= count(HTML2PDF::$_tables[$param['num']]['tfoot']['tr']);
4676
+                $this->_parsePos += count($level);
4677
+                HTML2PDF::$_tables[$param['num']]['tr_curr'] += count(HTML2PDF::$_tables[$param['num']]['tfoot']['tr']);
4678 4678
             }
4679 4679
 
4680 4680
             return true;
@@ -4697,7 +4697,7 @@  discard block
 block discarded – undo
4697 4697
             // if we are in a sub HTM, construct the list of the TR in the tfoot
4698 4698
             if ($this->_subPart) {
4699 4699
                 $min = HTML2PDF::$_tables[$param['num']]['tfoot']['tr'][0];
4700
-                $max = HTML2PDF::$_tables[$param['num']]['tr_curr']-1;
4700
+                $max = HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1;
4701 4701
                 HTML2PDF::$_tables[$param['num']]['tfoot']['tr'] = range($min, $max);
4702 4702
             }
4703 4703
 
@@ -4839,7 +4839,7 @@  discard block
 block discarded – undo
4839 4839
 
4840 4840
             $alignObject = isset($param['align']) ? strtolower($param['align']) : 'left';
4841 4841
             if (isset($param['align'])) unset($param['align']);
4842
-            if (!in_array($alignObject, array('left', 'center', 'right'))) $alignObject = 'left';
4842
+            if ( ! in_array($alignObject, array('left', 'center', 'right'))) $alignObject = 'left';
4843 4843
 
4844 4844
             $this->parsingCss->save();
4845 4845
             $this->parsingCss->analyse($other, $param);
@@ -4850,7 +4850,7 @@  discard block
 block discarded – undo
4850 4850
 
4851 4851
             // collapse table ?
4852 4852
             $collapse = false;
4853
-            if ($other=='table') {
4853
+            if ($other == 'table') {
4854 4854
                 $collapse = isset($this->parsingCss->value['border']['collapse']) ? $this->parsingCss->value['border']['collapse'] : false;
4855 4855
             }
4856 4856
 
@@ -4872,45 +4872,45 @@  discard block
 block discarded – undo
4872 4872
                 HTML2PDF::$_tables[$param['num']]['border']          = isset($param['border']) ? $this->parsingCss->readBorder($param['border']) : null;
4873 4873
                 HTML2PDF::$_tables[$param['num']]['cellpadding']     = $this->parsingCss->ConvertToMM(isset($param['cellpadding']) ? $param['cellpadding'] : '1px');
4874 4874
                 HTML2PDF::$_tables[$param['num']]['cellspacing']     = $this->parsingCss->ConvertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
4875
-                HTML2PDF::$_tables[$param['num']]['cases']           = array();          // properties of each TR/TD
4876
-                HTML2PDF::$_tables[$param['num']]['corr']            = array();          // link between TR/TD and colspan/rowspan
4877
-                HTML2PDF::$_tables[$param['num']]['corr_x']          = 0;                // position in 'cases'
4878
-                HTML2PDF::$_tables[$param['num']]['corr_y']          = 0;                // position in 'cases'
4879
-                HTML2PDF::$_tables[$param['num']]['td_curr']         = 0;                // current column
4880
-                HTML2PDF::$_tables[$param['num']]['tr_curr']         = 0;                // current row
4875
+                HTML2PDF::$_tables[$param['num']]['cases']           = array(); // properties of each TR/TD
4876
+                HTML2PDF::$_tables[$param['num']]['corr']            = array(); // link between TR/TD and colspan/rowspan
4877
+                HTML2PDF::$_tables[$param['num']]['corr_x']          = 0; // position in 'cases'
4878
+                HTML2PDF::$_tables[$param['num']]['corr_y']          = 0; // position in 'cases'
4879
+                HTML2PDF::$_tables[$param['num']]['td_curr']         = 0; // current column
4880
+                HTML2PDF::$_tables[$param['num']]['tr_curr']         = 0; // current row
4881 4881
                 HTML2PDF::$_tables[$param['num']]['curr_x']          = $this->pdf->getX();
4882 4882
                 HTML2PDF::$_tables[$param['num']]['curr_y']          = $this->pdf->getY();
4883
-                HTML2PDF::$_tables[$param['num']]['width']           = 0;                // global width
4884
-                HTML2PDF::$_tables[$param['num']]['height']          = 0;                // global height
4883
+                HTML2PDF::$_tables[$param['num']]['width']           = 0; // global width
4884
+                HTML2PDF::$_tables[$param['num']]['height']          = 0; // global height
4885 4885
                 HTML2PDF::$_tables[$param['num']]['align']           = $alignObject;
4886 4886
                 HTML2PDF::$_tables[$param['num']]['marge']           = array();
4887
-                HTML2PDF::$_tables[$param['num']]['marge']['t']      = $this->parsingCss->value['padding']['t']+$this->parsingCss->value['border']['t']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
4888
-                HTML2PDF::$_tables[$param['num']]['marge']['r']      = $this->parsingCss->value['padding']['r']+$this->parsingCss->value['border']['r']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
4889
-                HTML2PDF::$_tables[$param['num']]['marge']['b']      = $this->parsingCss->value['padding']['b']+$this->parsingCss->value['border']['b']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
4890
-                HTML2PDF::$_tables[$param['num']]['marge']['l']      = $this->parsingCss->value['padding']['l']+$this->parsingCss->value['border']['l']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
4891
-                HTML2PDF::$_tables[$param['num']]['page']            = 0;                // number of pages
4892
-                HTML2PDF::$_tables[$param['num']]['new_page']        = true;             // flag : new page for the current TR
4893
-                HTML2PDF::$_tables[$param['num']]['style_value']     = null;             // CSS style of the table
4894
-                HTML2PDF::$_tables[$param['num']]['thead']           = array();          // properties on the thead
4895
-                HTML2PDF::$_tables[$param['num']]['tfoot']           = array();          // properties on the tfoot
4896
-                HTML2PDF::$_tables[$param['num']]['thead']['tr']     = array();          // list of the TRs in the thead
4897
-                HTML2PDF::$_tables[$param['num']]['tfoot']['tr']     = array();          // list of the TRs in the tfoot
4898
-                HTML2PDF::$_tables[$param['num']]['thead']['height']    = 0;             // thead height
4899
-                HTML2PDF::$_tables[$param['num']]['tfoot']['height']    = 0;             // tfoot height
4900
-                HTML2PDF::$_tables[$param['num']]['thead']['code'] = array();            // HTML content of the thead
4901
-                HTML2PDF::$_tables[$param['num']]['tfoot']['code'] = array();            // HTML content of the tfoot
4902
-                HTML2PDF::$_tables[$param['num']]['cols']        = array();              // properties of the COLs
4887
+                HTML2PDF::$_tables[$param['num']]['marge']['t']      = $this->parsingCss->value['padding']['t'] + $this->parsingCss->value['border']['t']['width'] + HTML2PDF::$_tables[$param['num']]['cellspacing'] * 0.5;
4888
+                HTML2PDF::$_tables[$param['num']]['marge']['r']      = $this->parsingCss->value['padding']['r'] + $this->parsingCss->value['border']['r']['width'] + HTML2PDF::$_tables[$param['num']]['cellspacing'] * 0.5;
4889
+                HTML2PDF::$_tables[$param['num']]['marge']['b']      = $this->parsingCss->value['padding']['b'] + $this->parsingCss->value['border']['b']['width'] + HTML2PDF::$_tables[$param['num']]['cellspacing'] * 0.5;
4890
+                HTML2PDF::$_tables[$param['num']]['marge']['l']      = $this->parsingCss->value['padding']['l'] + $this->parsingCss->value['border']['l']['width'] + HTML2PDF::$_tables[$param['num']]['cellspacing'] * 0.5;
4891
+                HTML2PDF::$_tables[$param['num']]['page']            = 0; // number of pages
4892
+                HTML2PDF::$_tables[$param['num']]['new_page']        = true; // flag : new page for the current TR
4893
+                HTML2PDF::$_tables[$param['num']]['style_value']     = null; // CSS style of the table
4894
+                HTML2PDF::$_tables[$param['num']]['thead']           = array(); // properties on the thead
4895
+                HTML2PDF::$_tables[$param['num']]['tfoot']           = array(); // properties on the tfoot
4896
+                HTML2PDF::$_tables[$param['num']]['thead']['tr']     = array(); // list of the TRs in the thead
4897
+                HTML2PDF::$_tables[$param['num']]['tfoot']['tr']     = array(); // list of the TRs in the tfoot
4898
+                HTML2PDF::$_tables[$param['num']]['thead']['height']    = 0; // thead height
4899
+                HTML2PDF::$_tables[$param['num']]['tfoot']['height']    = 0; // tfoot height
4900
+                HTML2PDF::$_tables[$param['num']]['thead']['code'] = array(); // HTML content of the thead
4901
+                HTML2PDF::$_tables[$param['num']]['tfoot']['code'] = array(); // HTML content of the tfoot
4902
+                HTML2PDF::$_tables[$param['num']]['cols'] = array(); // properties of the COLs
4903 4903
 
4904 4904
                 $this->_saveMargin($this->pdf->getlMargin(), $this->pdf->gettMargin(), $this->pdf->getrMargin());
4905 4905
 
4906
-                $this->parsingCss->value['width']-= HTML2PDF::$_tables[$param['num']]['marge']['l'] + HTML2PDF::$_tables[$param['num']]['marge']['r'];
4906
+                $this->parsingCss->value['width'] -= HTML2PDF::$_tables[$param['num']]['marge']['l'] + HTML2PDF::$_tables[$param['num']]['marge']['r'];
4907 4907
             } else {
4908 4908
                 // we start from the first page and the first page of the table
4909 4909
                 HTML2PDF::$_tables[$param['num']]['page'] = 0;
4910 4910
                 HTML2PDF::$_tables[$param['num']]['td_curr']    = 0;
4911 4911
                 HTML2PDF::$_tables[$param['num']]['tr_curr']    = 0;
4912
-                HTML2PDF::$_tables[$param['num']]['td_x']        = HTML2PDF::$_tables[$param['num']]['marge']['l']+HTML2PDF::$_tables[$param['num']]['curr_x'];
4913
-                HTML2PDF::$_tables[$param['num']]['td_y']        = HTML2PDF::$_tables[$param['num']]['marge']['t']+HTML2PDF::$_tables[$param['num']]['curr_y'];
4912
+                HTML2PDF::$_tables[$param['num']]['td_x']        = HTML2PDF::$_tables[$param['num']]['marge']['l'] + HTML2PDF::$_tables[$param['num']]['curr_x'];
4913
+                HTML2PDF::$_tables[$param['num']]['td_y']        = HTML2PDF::$_tables[$param['num']]['marge']['t'] + HTML2PDF::$_tables[$param['num']]['curr_y'];
4914 4914
 
4915 4915
                 // draw the borders/background of the first page/part of the table
4916 4916
                 $this->_drawRectangle(
@@ -4955,10 +4955,10 @@  discard block
 block discarded – undo
4955 4955
                     foreach (HTML2PDF::$_tables[$param['num']][$mode]['tr'] as $tr) {
4956 4956
                         // hauteur de la ligne tr
4957 4957
                         $h = 0;
4958
-                        for ($i=0; $i<count(HTML2PDF::$_tables[$param['num']]['cases'][$tr]); $i++)
4959
-                            if (HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['rowspan']==1)
4958
+                        for ($i = 0; $i < count(HTML2PDF::$_tables[$param['num']]['cases'][$tr]); $i++)
4959
+                            if (HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['rowspan'] == 1)
4960 4960
                                 $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['h']);
4961
-                        HTML2PDF::$_tables[$param['num']][$mode]['height']+= $h;
4961
+                        HTML2PDF::$_tables[$param['num']][$mode]['height'] += $h;
4962 4962
                     }
4963 4963
                 }
4964 4964
 
@@ -4966,7 +4966,7 @@  discard block
 block discarded – undo
4966 4966
                 HTML2PDF::$_tables[$param['num']]['width'] = HTML2PDF::$_tables[$param['num']]['marge']['l'] + HTML2PDF::$_tables[$param['num']]['marge']['r'];
4967 4967
                 if (isset(HTML2PDF::$_tables[$param['num']]['cases'][0])) {
4968 4968
                     foreach (HTML2PDF::$_tables[$param['num']]['cases'][0] as $case) {
4969
-                        HTML2PDF::$_tables[$param['num']]['width']+= $case['w'];
4969
+                        HTML2PDF::$_tables[$param['num']]['width'] += $case['w'];
4970 4970
                     }
4971 4971
                 }
4972 4972
 
@@ -4975,11 +4975,11 @@  discard block
 block discarded – undo
4975 4975
                 $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
4976 4976
                 $x = HTML2PDF::$_tables[$param['num']]['curr_x'];
4977 4977
                 $w = HTML2PDF::$_tables[$param['num']]['width'];
4978
-                if ($parentWidth>$w) {
4979
-                    if (HTML2PDF::$_tables[$param['num']]['align']=='center')
4980
-                        $x = $x + ($parentWidth-$w)*0.5;
4981
-                    else if (HTML2PDF::$_tables[$param['num']]['align']=='right')
4982
-                        $x = $x + $parentWidth-$w;
4978
+                if ($parentWidth > $w) {
4979
+                    if (HTML2PDF::$_tables[$param['num']]['align'] == 'center')
4980
+                        $x = $x + ($parentWidth - $w) * 0.5;
4981
+                    else if (HTML2PDF::$_tables[$param['num']]['align'] == 'right')
4982
+                        $x = $x + $parentWidth - $w;
4983 4983
 
4984 4984
                     HTML2PDF::$_tables[$param['num']]['curr_x'] = $x;
4985 4985
                 }
@@ -4989,7 +4989,7 @@  discard block
 block discarded – undo
4989 4989
 
4990 4990
                 // minimum of the height because of margins, and of the thead and tfoot height
4991 4991
                 $h0 = HTML2PDF::$_tables[$param['num']]['marge']['t'] + HTML2PDF::$_tables[$param['num']]['marge']['b'];
4992
-                $h0+= HTML2PDF::$_tables[$param['num']]['thead']['height'] + HTML2PDF::$_tables[$param['num']]['tfoot']['height'];
4992
+                $h0 += HTML2PDF::$_tables[$param['num']]['thead']['height'] + HTML2PDF::$_tables[$param['num']]['tfoot']['height'];
4993 4993
 
4994 4994
                 // max height of the page
4995 4995
                 $max = $this->pdf->getH() - $this->pdf->getbMargin();
@@ -4999,7 +4999,7 @@  discard block
 block discarded – undo
4999 4999
                 $height = $h0;
5000 5000
 
5001 5001
                 // we get the height of each line
5002
-                for ($k=0; $k<count(HTML2PDF::$_tables[$param['num']]['cases']); $k++) {
5002
+                for ($k = 0; $k < count(HTML2PDF::$_tables[$param['num']]['cases']); $k++) {
5003 5003
 
5004 5004
                     // if it is a TR of the thead or of the tfoot => skip
5005 5005
                     if (in_array($k, HTML2PDF::$_tables[$param['num']]['thead']['tr'])) continue;
@@ -5008,25 +5008,25 @@  discard block
 block discarded – undo
5008 5008
                     // height of the line
5009 5009
                     $th = 0;
5010 5010
                     $h = 0;
5011
-                    for ($i=0; $i<count(HTML2PDF::$_tables[$param['num']]['cases'][$k]); $i++) {
5011
+                    for ($i = 0; $i < count(HTML2PDF::$_tables[$param['num']]['cases'][$k]); $i++) {
5012 5012
                         $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']);
5013 5013
 
5014
-                        if (HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['rowspan']==1)
5014
+                        if (HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['rowspan'] == 1)
5015 5015
                             $th = max($th, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']);
5016 5016
                     }
5017 5017
 
5018 5018
                     // if the row does not fit on the page => new page
5019
-                    if ($y+$h+$height>$max) {
5020
-                        if ($height==$h0) $height = null;
5019
+                    if ($y + $h + $height > $max) {
5020
+                        if ($height == $h0) $height = null;
5021 5021
                         HTML2PDF::$_tables[$param['num']]['height'][] = $height;
5022 5022
                         $height = $h0;
5023 5023
                         $y = $this->_margeTop;
5024 5024
                     }
5025
-                    $height+= $th;
5025
+                    $height += $th;
5026 5026
                 }
5027 5027
 
5028 5028
                 // if ther is a height at the end, add it
5029
-                if ($height!=$h0 || $k==0) HTML2PDF::$_tables[$param['num']]['height'][] = $height;
5029
+                if ($height != $h0 || $k == 0) HTML2PDF::$_tables[$param['num']]['height'][] = $height;
5030 5030
             } else {
5031 5031
                 // if we have tfoor, draw it
5032 5032
                 if (count(HTML2PDF::$_tables[$param['num']]['tfoot']['code'])) {
@@ -5043,7 +5043,7 @@  discard block
 block discarded – undo
5043 5043
                     $this->_makeHTMLcode();
5044 5044
                     $this->_isInTfoot = false;
5045 5045
 
5046
-                    $this->_parsePos =     $oldParsePos;
5046
+                    $this->_parsePos = $oldParsePos;
5047 5047
                     $this->parsingHtml->code = $oldParseCode;
5048 5048
                     HTML2PDF::$_tables[$param['num']]['tr_curr'] = $tmpTR;
5049 5049
                     HTML2PDF::$_tables[$param['num']]['td_curr'] = $tmpTD;
@@ -5051,10 +5051,10 @@  discard block
 block discarded – undo
5051 5051
 
5052 5052
                 // get the positions of the end of the table
5053 5053
                 $x = HTML2PDF::$_tables[$param['num']]['curr_x'] + HTML2PDF::$_tables[$param['num']]['width'];
5054
-                if (count(HTML2PDF::$_tables[$param['num']]['height'])>1)
5055
-                    $y = $this->_margeTop+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1];
5056
-                else if (count(HTML2PDF::$_tables[$param['num']]['height'])==1)
5057
-                    $y = HTML2PDF::$_tables[$param['num']]['curr_y']+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1];
5054
+                if (count(HTML2PDF::$_tables[$param['num']]['height']) > 1)
5055
+                    $y = $this->_margeTop + HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height']) - 1];
5056
+                else if (count(HTML2PDF::$_tables[$param['num']]['height']) == 1)
5057
+                    $y = HTML2PDF::$_tables[$param['num']]['curr_y'] + HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height']) - 1];
5058 5058
                 else
5059 5059
                     $y = HTML2PDF::$_tables[$param['num']]['curr_y'];
5060 5060
 
@@ -5085,7 +5085,7 @@  discard block
 block discarded – undo
5085 5085
         protected function _tag_open_COL($param)
5086 5086
         {
5087 5087
             $span = isset($param['span']) ? $param['span'] : 1;
5088
-            for ($k=0; $k<$span; $k++)
5088
+            for ($k = 0; $k < $span; $k++)
5089 5089
                 HTML2PDF::$_tables[$param['num']]['cols'][] = $param;
5090 5090
         }
5091 5091
 
@@ -5123,22 +5123,22 @@  discard block
 block discarded – undo
5123 5123
 
5124 5124
             // position in the table
5125 5125
             HTML2PDF::$_tables[$param['num']]['tr_curr']++;
5126
-            HTML2PDF::$_tables[$param['num']]['td_curr']= 0;
5126
+            HTML2PDF::$_tables[$param['num']]['td_curr'] = 0;
5127 5127
 
5128 5128
             // if we are not in a sub html
5129
-            if (!$this->_subPart) {
5129
+            if ( ! $this->_subPart) {
5130 5130
 
5131 5131
                 // Y after the row
5132
-                $ty=null;
5133
-                for ($ii=0; $ii<count(HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1]); $ii++) {
5134
-                    $ty = max($ty, HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][$ii]['h']);
5132
+                $ty = null;
5133
+                for ($ii = 0; $ii < count(HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1]); $ii++) {
5134
+                    $ty = max($ty, HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][$ii]['h']);
5135 5135
                 }
5136 5136
 
5137 5137
                 // height of the tfoot
5138 5138
                 $hfoot = HTML2PDF::$_tables[$param['num']]['tfoot']['height'];
5139 5139
 
5140 5140
                 // if the line does not fit on the page => new page
5141
-                if (!$this->_isInTfoot && HTML2PDF::$_tables[$param['num']]['td_y'] + HTML2PDF::$_tables[$param['num']]['marge']['b'] + $ty +$hfoot> $this->pdf->getH() - $this->pdf->getbMargin()) {
5141
+                if ( ! $this->_isInTfoot && HTML2PDF::$_tables[$param['num']]['td_y'] + HTML2PDF::$_tables[$param['num']]['marge']['b'] + $ty + $hfoot > $this->pdf->getH() - $this->pdf->getbMargin()) {
5142 5142
 
5143 5143
                     // fi ther is a tfoot => draw it
5144 5144
                     if (count(HTML2PDF::$_tables[$param['num']]['tfoot']['code'])) {
@@ -5155,7 +5155,7 @@  discard block
 block discarded – undo
5155 5155
                         $this->_makeHTMLcode();
5156 5156
                         $this->_isInTfoot = false;
5157 5157
 
5158
-                        $this->_parsePos =     $oldParsePos;
5158
+                        $this->_parsePos = $oldParsePos;
5159 5159
                         $this->parsingHtml->code = $oldParseCode;
5160 5160
                         HTML2PDF::$_tables[$param['num']]['tr_curr'] = $tmpTR;
5161 5161
                         HTML2PDF::$_tables[$param['num']]['td_curr'] = $tmpTD;
@@ -5168,7 +5168,7 @@  discard block
 block discarded – undo
5168 5168
                     // new position
5169 5169
                     HTML2PDF::$_tables[$param['num']]['page']++;
5170 5170
                     HTML2PDF::$_tables[$param['num']]['curr_y'] = $this->pdf->getY();
5171
-                    HTML2PDF::$_tables[$param['num']]['td_y'] = HTML2PDF::$_tables[$param['num']]['curr_y']+HTML2PDF::$_tables[$param['num']]['marge']['t'];
5171
+                    HTML2PDF::$_tables[$param['num']]['td_y'] = HTML2PDF::$_tables[$param['num']]['curr_y'] + HTML2PDF::$_tables[$param['num']]['marge']['t'];
5172 5172
 
5173 5173
                     // if we have the height of the tbale on the page => draw borders and background
5174 5174
                     if (isset(HTML2PDF::$_tables[$param['num']]['height'][HTML2PDF::$_tables[$param['num']]['page']])) {
@@ -5182,7 +5182,7 @@  discard block
 block discarded – undo
5182 5182
                             HTML2PDF::$_tables[$param['num']]['height'][HTML2PDF::$_tables[$param['num']]['page']],
5183 5183
                             $this->parsingCss->value['border'],
5184 5184
                             $this->parsingCss->value['padding'],
5185
-                            HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5,
5185
+                            HTML2PDF::$_tables[$param['num']]['cellspacing'] * 0.5,
5186 5186
                             $this->parsingCss->value['background']
5187 5187
                         );
5188 5188
 
@@ -5206,7 +5206,7 @@  discard block
 block discarded – undo
5206 5206
                     $this->_makeHTMLcode();
5207 5207
                     $this->_isInThead = false;
5208 5208
 
5209
-                    $this->_parsePos =     $oldParsePos;
5209
+                    $this->_parsePos = $oldParsePos;
5210 5210
                     $this->parsingHtml->code = $oldParseCode;
5211 5211
                     HTML2PDF::$_tables[$param['num']]['tr_curr'] = $tmpTR;
5212 5212
                     HTML2PDF::$_tables[$param['num']]['td_curr'] = $tmpTD;
@@ -5215,12 +5215,12 @@  discard block
 block discarded – undo
5215 5215
             // else (in a sub HTML)
5216 5216
             } else {
5217 5217
                 // prepare it
5218
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1] = array();
5219
-                if (!isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']]))
5218
+                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1] = array();
5219
+                if ( ! isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']]))
5220 5220
                     HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']] = array();
5221 5221
 
5222
-                HTML2PDF::$_tables[$param['num']]['corr_x']=0;
5223
-                while(isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']]))
5222
+                HTML2PDF::$_tables[$param['num']]['corr_x'] = 0;
5223
+                while (isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']]))
5224 5224
                     HTML2PDF::$_tables[$param['num']]['corr_x']++;
5225 5225
             }
5226 5226
 
@@ -5244,19 +5244,19 @@  discard block
 block discarded – undo
5244 5244
             $this->parsingCss->fontSet();
5245 5245
 
5246 5246
             // if we are not in a sub HTML
5247
-            if (!$this->_subPart) {
5247
+            if ( ! $this->_subPart) {
5248 5248
 
5249 5249
                 // Y of the current line
5250
-                $ty=null;
5251
-                for ($ii=0; $ii<count(HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1]); $ii++) {
5252
-                    if (HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][$ii]['rowspan']==1) {
5253
-                        $ty = HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][$ii]['h'];
5250
+                $ty = null;
5251
+                for ($ii = 0; $ii < count(HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1]); $ii++) {
5252
+                    if (HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][$ii]['rowspan'] == 1) {
5253
+                        $ty = HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][$ii]['h'];
5254 5254
                     }
5255 5255
                 }
5256 5256
 
5257 5257
                 // new position
5258
-                HTML2PDF::$_tables[$param['num']]['td_x'] = HTML2PDF::$_tables[$param['num']]['curr_x']+HTML2PDF::$_tables[$param['num']]['marge']['l'];
5259
-                HTML2PDF::$_tables[$param['num']]['td_y']+= $ty;
5258
+                HTML2PDF::$_tables[$param['num']]['td_x'] = HTML2PDF::$_tables[$param['num']]['curr_x'] + HTML2PDF::$_tables[$param['num']]['marge']['l'];
5259
+                HTML2PDF::$_tables[$param['num']]['td_y'] += $ty;
5260 5260
                 HTML2PDF::$_tables[$param['num']]['new_page'] = false;
5261 5261
             } else {
5262 5262
                 HTML2PDF::$_tables[$param['num']]['corr_y']++;
@@ -5282,11 +5282,11 @@  discard block
 block discarded – undo
5282 5282
             $param['cellspacing'] = HTML2PDF::$_tables[$param['num']]['cellspacing'].'mm';
5283 5283
 
5284 5284
             // specific style for LI
5285
-            if ($other=='li') {
5285
+            if ($other == 'li') {
5286 5286
                 $specialLi = true;
5287 5287
             } else {
5288 5288
                 $specialLi = false;
5289
-                if ($other=='li_sub') {
5289
+                if ($other == 'li_sub') {
5290 5290
                     $param['style']['border'] = 'none';
5291 5291
                     $param['style']['background-color']    = 'transparent';
5292 5292
                     $param['style']['background-image']    = 'none';
@@ -5298,7 +5298,7 @@  discard block
 block discarded – undo
5298 5298
 
5299 5299
             // get the properties of the TD
5300 5300
             $x = HTML2PDF::$_tables[$param['num']]['td_curr'];
5301
-            $y = HTML2PDF::$_tables[$param['num']]['tr_curr']-1;
5301
+            $y = HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1;
5302 5302
             $colspan = isset($param['colspan']) ? $param['colspan'] : 1;
5303 5303
             $rowspan = isset($param['rowspan']) ? $param['rowspan'] : 1;
5304 5304
 
@@ -5317,9 +5317,9 @@  discard block
 block discarded – undo
5317 5317
 
5318 5318
                     // for colspans => we get all the neede widths
5319 5319
                     $colParam['style']['width'] = array();
5320
-                    for ($k=0; $k<$colspan; $k++) {
5321
-                        if (isset(HTML2PDF::$_tables[$param['num']]['cols'][$numCol+$k]['style']['width'])) {
5322
-                            $colParam['style']['width'][] = HTML2PDF::$_tables[$param['num']]['cols'][$numCol+$k]['style']['width'];
5320
+                    for ($k = 0; $k < $colspan; $k++) {
5321
+                        if (isset(HTML2PDF::$_tables[$param['num']]['cols'][$numCol + $k]['style']['width'])) {
5322
+                            $colParam['style']['width'][] = HTML2PDF::$_tables[$param['num']]['cols'][$numCol + $k]['style']['width'];
5323 5323
                         }
5324 5324
                     }
5325 5325
 
@@ -5329,8 +5329,8 @@  discard block
 block discarded – undo
5329 5329
                     if (count($colParam['style']['width'])) {
5330 5330
                         $total = $colParam['style']['width'][0]; unset($colParam['style']['width'][0]);
5331 5331
                         foreach ($colParam['style']['width'] as $width) {
5332
-                            if (substr($total, -1)=='%' && substr($width, -1)=='%')
5333
-                                $total = (str_replace('%', '', $total)+str_replace('%', '', $width)).'%';
5332
+                            if (substr($total, -1) == '%' && substr($width, -1) == '%')
5333
+                                $total = (str_replace('%', '', $total) + str_replace('%', '', $width)).'%';
5334 5334
                             else
5335 5335
                                 $total = ($this->parsingCss->ConvertToMM($total, $last) + $this->parsingCss->ConvertToMM($width, $last)).'mm';
5336 5336
                         }
@@ -5378,35 +5378,35 @@  discard block
 block discarded – undo
5378 5378
             $return = $this->parsingCss->analyse($other, $param, $legacy);
5379 5379
 
5380 5380
             if ($specialLi) {
5381
-                $this->parsingCss->value['width']-= $this->parsingCss->ConvertToMM($this->_listeGetWidth());
5382
-                $this->parsingCss->value['width']-= $this->parsingCss->ConvertToMM($this->_listeGetPadding());
5381
+                $this->parsingCss->value['width'] -= $this->parsingCss->ConvertToMM($this->_listeGetWidth());
5382
+                $this->parsingCss->value['width'] -= $this->parsingCss->ConvertToMM($this->_listeGetPadding());
5383 5383
             }
5384 5384
             $this->parsingCss->setPosition();
5385 5385
             $this->parsingCss->fontSet();
5386 5386
 
5387 5387
             // if tale collapse => modify the borders
5388 5388
             if ($collapse) {
5389
-                if (!$this->_subPart) {
5389
+                if ( ! $this->_subPart) {
5390 5390
                     if (
5391
-                        (HTML2PDF::$_tables[$param['num']]['tr_curr']>1 && !HTML2PDF::$_tables[$param['num']]['new_page']) ||
5392
-                        (!$this->_isInThead && count(HTML2PDF::$_tables[$param['num']]['thead']['code']))
5391
+                        (HTML2PDF::$_tables[$param['num']]['tr_curr'] > 1 && ! HTML2PDF::$_tables[$param['num']]['new_page']) ||
5392
+                        ( ! $this->_isInThead && count(HTML2PDF::$_tables[$param['num']]['thead']['code']))
5393 5393
                     ) {
5394 5394
                         $this->parsingCss->value['border']['t'] = $this->parsingCss->readBorder('none');
5395 5395
                     }
5396 5396
                 }
5397 5397
 
5398
-                if (HTML2PDF::$_tables[$param['num']]['td_curr']>0) {
5399
-                    if (!$return) $this->parsingCss->value['width']+= $this->parsingCss->value['border']['l']['width'];
5398
+                if (HTML2PDF::$_tables[$param['num']]['td_curr'] > 0) {
5399
+                    if ( ! $return) $this->parsingCss->value['width'] += $this->parsingCss->value['border']['l']['width'];
5400 5400
                     $this->parsingCss->value['border']['l'] = $this->parsingCss->readBorder('none');
5401 5401
                 }
5402 5402
             }
5403 5403
 
5404 5404
             // margins of the table
5405 5405
             $marge = array();
5406
-            $marge['t'] = $this->parsingCss->value['padding']['t']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['t']['width'];
5407
-            $marge['r'] = $this->parsingCss->value['padding']['r']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['r']['width'];
5408
-            $marge['b'] = $this->parsingCss->value['padding']['b']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['b']['width'];
5409
-            $marge['l'] = $this->parsingCss->value['padding']['l']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['l']['width'];
5406
+            $marge['t'] = $this->parsingCss->value['padding']['t'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['t']['width'];
5407
+            $marge['r'] = $this->parsingCss->value['padding']['r'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['r']['width'];
5408
+            $marge['b'] = $this->parsingCss->value['padding']['b'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['b']['width'];
5409
+            $marge['l'] = $this->parsingCss->value['padding']['l'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['l']['width'];
5410 5410
 
5411 5411
             // if we are in a sub HTML
5412 5412
             if ($this->_subPart) {
@@ -5422,14 +5422,14 @@  discard block
 block discarded – undo
5422 5422
                 HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['Yr'] = HTML2PDF::$_tables[$param['num']]['corr_y'];
5423 5423
 
5424 5424
                 // prepare the mapping for rowspan and colspan
5425
-                for ($j=0; $j<$rowspan; $j++) {
5426
-                    for ($i=0; $i<$colspan; $i++) {
5425
+                for ($j = 0; $j < $rowspan; $j++) {
5426
+                    for ($i = 0; $i < $colspan; $i++) {
5427 5427
                         HTML2PDF::$_tables[$param['num']]['corr']
5428
-                            [HTML2PDF::$_tables[$param['num']]['corr_y']+$j]
5429
-                            [HTML2PDF::$_tables[$param['num']]['corr_x']+$i] = ($i+$j>0) ? '' : array($x,$y,$colspan,$rowspan);
5428
+                            [HTML2PDF::$_tables[$param['num']]['corr_y'] + $j]
5429
+                            [HTML2PDF::$_tables[$param['num']]['corr_x'] + $i] = ($i + $j > 0) ? '' : array($x, $y, $colspan, $rowspan);
5430 5430
                     }
5431 5431
                 }
5432
-                HTML2PDF::$_tables[$param['num']]['corr_x']+= $colspan;
5432
+                HTML2PDF::$_tables[$param['num']]['corr_x'] += $colspan;
5433 5433
                 while (isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']])) {
5434 5434
                     HTML2PDF::$_tables[$param['num']]['corr_x']++;
5435 5435
                 }
@@ -5439,11 +5439,11 @@  discard block
 block discarded – undo
5439 5439
                 $this->_createSubHTML($this->_subHtml);
5440 5440
                 $this->_subHtml->parsingHtml->code = $level;
5441 5441
                 $this->_subHtml->_makeHTMLcode();
5442
-                $this->_tempPos+= count($level);
5442
+                $this->_tempPos += count($level);
5443 5443
             } else {
5444 5444
                 // new position in the table
5445 5445
                 HTML2PDF::$_tables[$param['num']]['td_curr']++;
5446
-                HTML2PDF::$_tables[$param['num']]['td_x']+= HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['dw'];
5446
+                HTML2PDF::$_tables[$param['num']]['td_x'] += HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['dw'];
5447 5447
 
5448 5448
                 // borders and background of the TD
5449 5449
                 $this->_drawRectangle(
@@ -5453,28 +5453,28 @@  discard block
 block discarded – undo
5453 5453
                     HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['h'],
5454 5454
                     $this->parsingCss->value['border'],
5455 5455
                     $this->parsingCss->value['padding'],
5456
-                    HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5,
5456
+                    HTML2PDF::$_tables[$param['num']]['cellspacing'] * 0.5,
5457 5457
                     $this->parsingCss->value['background']
5458 5458
                 );
5459 5459
 
5460 5460
                 $this->parsingCss->value['width'] = HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['w'] - $marge['l'] - $marge['r'];
5461 5461
 
5462 5462
                 // marges = size of the TD
5463
-                $mL = HTML2PDF::$_tables[$param['num']]['td_x']+$marge['l'];
5463
+                $mL = HTML2PDF::$_tables[$param['num']]['td_x'] + $marge['l'];
5464 5464
                 $mR = $this->pdf->getW() - $mL - $this->parsingCss->value['width'];
5465 5465
                 $this->_saveMargin($mL, 0, $mR);
5466 5466
 
5467 5467
                 // position of the content, from vertical-align
5468 5468
                 $hCorr = HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['h'];
5469 5469
                 $hReel = HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['real_h'];
5470
-                switch($this->parsingCss->value['vertical-align'])
5470
+                switch ($this->parsingCss->value['vertical-align'])
5471 5471
                 {
5472 5472
                     case 'bottom':
5473
-                        $yCorr = $hCorr-$hReel;
5473
+                        $yCorr = $hCorr - $hReel;
5474 5474
                         break;
5475 5475
 
5476 5476
                     case 'middle':
5477
-                        $yCorr = ($hCorr-$hReel)*0.5;
5477
+                        $yCorr = ($hCorr - $hReel) * 0.5;
5478 5478
                         break;
5479 5479
 
5480 5480
                     case 'top':
@@ -5484,8 +5484,8 @@  discard block
 block discarded – undo
5484 5484
                 }
5485 5485
 
5486 5486
                 //  position of the content
5487
-                $x = HTML2PDF::$_tables[$param['num']]['td_x']+$marge['l'];
5488
-                $y = HTML2PDF::$_tables[$param['num']]['td_y']+$marge['t']+$yCorr;
5487
+                $x = HTML2PDF::$_tables[$param['num']]['td_x'] + $marge['l'];
5488
+                $y = HTML2PDF::$_tables[$param['num']]['td_y'] + $marge['t'] + $yCorr;
5489 5489
                 $this->pdf->setXY($x, $y);
5490 5490
                 $this->_setNewPositionForNewLine();
5491 5491
             }
@@ -5508,20 +5508,20 @@  discard block
 block discarded – undo
5508 5508
 
5509 5509
             // get the margins
5510 5510
             $marge = array();
5511
-            $marge['t'] = $this->parsingCss->value['padding']['t']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['t']['width'];
5512
-            $marge['r'] = $this->parsingCss->value['padding']['r']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['r']['width'];
5513
-            $marge['b'] = $this->parsingCss->value['padding']['b']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['b']['width'];
5514
-            $marge['l'] = $this->parsingCss->value['padding']['l']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['l']['width'];
5515
-            $marge['t']+= 0.001;
5516
-            $marge['r']+= 0.001;
5517
-            $marge['b']+= 0.001;
5518
-            $marge['l']+= 0.001;
5511
+            $marge['t'] = $this->parsingCss->value['padding']['t'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['t']['width'];
5512
+            $marge['r'] = $this->parsingCss->value['padding']['r'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['r']['width'];
5513
+            $marge['b'] = $this->parsingCss->value['padding']['b'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['b']['width'];
5514
+            $marge['l'] = $this->parsingCss->value['padding']['l'] + 0.5 * HTML2PDF::$_tables[$param['num']]['cellspacing'] + $this->parsingCss->value['border']['l']['width'];
5515
+            $marge['t'] += 0.001;
5516
+            $marge['r'] += 0.001;
5517
+            $marge['b'] += 0.001;
5518
+            $marge['l'] += 0.001;
5519 5519
 
5520 5520
             // if we are in a sub HTML
5521 5521
             if ($this->_subPart) {
5522 5522
 
5523 5523
                 // it msut take only one page
5524
-                if ($this->_testTdInOnepage && $this->_subHtml->pdf->getPage()>1) {
5524
+                if ($this->_testTdInOnepage && $this->_subHtml->pdf->getPage() > 1) {
5525 5525
                     throw new HTML2PDF_exception(7);
5526 5526
                 }
5527 5527
 
@@ -5534,19 +5534,19 @@  discard block
 block discarded – undo
5534 5534
                 $h2 = $this->parsingCss->value['height'] + $marge['t'] + $marge['b'];
5535 5535
 
5536 5536
                 // final size of the TD
5537
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['w'] = max(array($w0, $w2));
5538
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['h'] = max(array($h0, $h2));
5537
+                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][HTML2PDF::$_tables[$param['num']]['td_curr'] - 1]['w'] = max(array($w0, $w2));
5538
+                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][HTML2PDF::$_tables[$param['num']]['td_curr'] - 1]['h'] = max(array($h0, $h2));
5539 5539
 
5540 5540
                 // real position of the content
5541
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['real_w'] = $w0;
5542
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['real_h'] = $h0;
5541
+                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][HTML2PDF::$_tables[$param['num']]['td_curr'] - 1]['real_w'] = $w0;
5542
+                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][HTML2PDF::$_tables[$param['num']]['td_curr'] - 1]['real_h'] = $h0;
5543 5543
 
5544 5544
                 // destroy the sub HTML
5545 5545
                 $this->_destroySubHTML($this->_subHtml);
5546 5546
             } else {
5547 5547
                 $this->_loadMargin();
5548 5548
 
5549
-                HTML2PDF::$_tables[$param['num']]['td_x']+= HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['w'];
5549
+                HTML2PDF::$_tables[$param['num']]['td_x'] += HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1][HTML2PDF::$_tables[$param['num']]['td_curr'] - 1]['w'];
5550 5550
             }
5551 5551
 
5552 5552
             $this->parsingCss->load();
@@ -5602,10 +5602,10 @@  discard block
 block discarded – undo
5602 5602
          */
5603 5603
         protected function _tag_open_IMG($param)
5604 5604
         {
5605
-            $src    = str_replace('&amp;', '&', $param['src']);
5605
+            $src = str_replace('&amp;', '&', $param['src']);
5606 5606
 
5607 5607
             $this->parsingCss->save();
5608
-            $this->parsingCss->value['width']    = 0;
5608
+            $this->parsingCss->value['width'] = 0;
5609 5609
             $this->parsingCss->value['height']    = 0;
5610 5610
             $this->parsingCss->value['border']    = array('type' => 'none', 'width' => 0, 'color' => array(0, 0, 0));
5611 5611
             $this->parsingCss->value['background'] = array('color' => null, 'image' => null, 'position' => null, 'repeat' => null);
@@ -5614,7 +5614,7 @@  discard block
 block discarded – undo
5614 5614
             $this->parsingCss->fontSet();
5615 5615
 
5616 5616
             $res = $this->_drawImage($src, isset($param['sub_li']));
5617
-            if (!$res) return $res;
5617
+            if ( ! $res) return $res;
5618 5618
 
5619 5619
             $this->parsingCss->load();
5620 5620
             $this->parsingCss->fontSet();
@@ -5632,8 +5632,8 @@  discard block
 block discarded – undo
5632 5632
          */
5633 5633
         protected function _tag_open_SELECT($param)
5634 5634
         {
5635
-            if (!isset($param['name'])) {
5636
-                $param['name'] = 'champs_pdf_'.(count($this->_lstField)+1);
5635
+            if ( ! isset($param['name'])) {
5636
+                $param['name'] = 'champs_pdf_'.(count($this->_lstField) + 1);
5637 5637
             }
5638 5638
 
5639 5639
             $param['name'] = strtolower($param['name']);
@@ -5651,11 +5651,11 @@  discard block
 block discarded – undo
5651 5651
 
5652 5652
             $this->_lstSelect = array();
5653 5653
             $this->_lstSelect['name']    = $param['name'];
5654
-            $this->_lstSelect['multi']    = isset($param['multiple']) ? true : false;
5654
+            $this->_lstSelect['multi'] = isset($param['multiple']) ? true : false;
5655 5655
             $this->_lstSelect['size']    = isset($param['size']) ? $param['size'] : 1;
5656
-            $this->_lstSelect['options']    = array();
5656
+            $this->_lstSelect['options'] = array();
5657 5657
 
5658
-            if ($this->_lstSelect['multi'] && $this->_lstSelect['size']<3) $this->_lstSelect['size'] = 3;
5658
+            if ($this->_lstSelect['multi'] && $this->_lstSelect['size'] < 3) $this->_lstSelect['size'] = 3;
5659 5659
 
5660 5660
             return true;
5661 5661
         }
@@ -5671,8 +5671,8 @@  discard block
 block discarded – undo
5671 5671
         {
5672 5672
             // get the content of the option : it is the text of the option
5673 5673
             $level = $this->parsingHtml->getLevel($this->_parsePos);
5674
-            $this->_parsePos+= count($level);
5675
-            $value = isset($param['value']) ? $param['value'] : 'aut_tag_open_opt_'.(count($this->_lstSelect)+1);
5674
+            $this->_parsePos += count($level);
5675
+            $value = isset($param['value']) ? $param['value'] : 'aut_tag_open_opt_'.(count($this->_lstSelect) + 1);
5676 5676
 
5677 5677
             $this->_lstSelect['options'][$value] = isset($level[0]['param']['txt']) ? $level[0]['param']['txt'] : '';
5678 5678
 
@@ -5705,13 +5705,13 @@  discard block
 block discarded – undo
5705 5705
             // position of the select
5706 5706
             $x = $this->pdf->getX();
5707 5707
             $y = $this->pdf->getY();
5708
-            $f = 1.08*$this->parsingCss->value['font-size'];
5708
+            $f = 1.08 * $this->parsingCss->value['font-size'];
5709 5709
 
5710 5710
             // width
5711
-            $w = $this->parsingCss->value['width']; if (!$w) $w = 50;
5711
+            $w = $this->parsingCss->value['width']; if ( ! $w) $w = 50;
5712 5712
 
5713 5713
             // height (automatic)
5714
-            $h = ($f*1.07*$this->_lstSelect['size'] + 1);
5714
+            $h = ($f * 1.07 * $this->_lstSelect['size'] + 1);
5715 5715
 
5716 5716
             $prop = $this->parsingCss->getFormStyle();
5717 5717
 
@@ -5722,17 +5722,17 @@  discard block
 block discarded – undo
5722 5722
 
5723 5723
 
5724 5724
             // single or multi select
5725
-            if ($this->_lstSelect['size']>1) {
5725
+            if ($this->_lstSelect['size'] > 1) {
5726 5726
                 $this->pdf->ListBox($this->_lstSelect['name'], $w, $h, $this->_lstSelect['options'], $prop);
5727 5727
             } else {
5728 5728
                 $this->pdf->ComboBox($this->_lstSelect['name'], $w, $h, $this->_lstSelect['options'], $prop);
5729 5729
             }
5730 5730
 
5731
-            $this->_maxX = max($this->_maxX, $x+$w);
5732
-            $this->_maxY = max($this->_maxY, $y+$h);
5731
+            $this->_maxX = max($this->_maxX, $x + $w);
5732
+            $this->_maxY = max($this->_maxY, $y + $h);
5733 5733
             $this->_maxH = max($this->_maxH, $h);
5734 5734
             $this->_maxE++;
5735
-            $this->pdf->setX($x+$w);
5735
+            $this->pdf->setX($x + $w);
5736 5736
 
5737 5737
             $this->parsingCss->load();
5738 5738
             $this->parsingCss->fontSet();
@@ -5751,8 +5751,8 @@  discard block
 block discarded – undo
5751 5751
          */
5752 5752
         protected function _tag_open_TEXTAREA($param)
5753 5753
         {
5754
-            if (!isset($param['name'])) {
5755
-                $param['name'] = 'champs_pdf_'.(count($this->_lstField)+1);
5754
+            if ( ! isset($param['name'])) {
5755
+                $param['name'] = 'champs_pdf_'.(count($this->_lstField) + 1);
5756 5756
             }
5757 5757
 
5758 5758
             $param['name'] = strtolower($param['name']);
@@ -5770,16 +5770,16 @@  discard block
 block discarded – undo
5770 5770
 
5771 5771
             $x = $this->pdf->getX();
5772 5772
             $y = $this->pdf->getY();
5773
-            $fx = 0.65*$this->parsingCss->value['font-size'];
5774
-            $fy = 1.08*$this->parsingCss->value['font-size'];
5773
+            $fx = 0.65 * $this->parsingCss->value['font-size'];
5774
+            $fy = 1.08 * $this->parsingCss->value['font-size'];
5775 5775
 
5776 5776
             // extract the content the textarea : value
5777 5777
             $level = $this->parsingHtml->getLevel($this->_parsePos);
5778
-            $this->_parsePos+= count($level);
5778
+            $this->_parsePos += count($level);
5779 5779
 
5780 5780
             // automatic size, from cols and rows properties
5781
-            $w = $fx*(isset($param['cols']) ? $param['cols'] : 22)+1;
5782
-            $h = $fy*1.07*(isset($param['rows']) ? $param['rows'] : 3)+3;
5781
+            $w = $fx * (isset($param['cols']) ? $param['cols'] : 22) + 1;
5782
+            $h = $fy * 1.07 * (isset($param['rows']) ? $param['rows'] : 3) + 3;
5783 5783
 
5784 5784
             $prop = $this->parsingCss->getFormStyle();
5785 5785
 
@@ -5788,11 +5788,11 @@  discard block
 block discarded – undo
5788 5788
 
5789 5789
             $this->pdf->TextField($param['name'], $w, $h, $prop, array(), $x, $y);
5790 5790
 
5791
-            $this->_maxX = max($this->_maxX, $x+$w);
5792
-            $this->_maxY = max($this->_maxY, $y+$h);
5791
+            $this->_maxX = max($this->_maxX, $x + $w);
5792
+            $this->_maxY = max($this->_maxY, $y + $h);
5793 5793
             $this->_maxH = max($this->_maxH, $h);
5794 5794
             $this->_maxE++;
5795
-            $this->pdf->setX($x+$w);
5795
+            $this->pdf->setX($x + $w);
5796 5796
 
5797 5797
             return true;
5798 5798
         }
@@ -5821,15 +5821,15 @@  discard block
 block discarded – undo
5821 5821
          */
5822 5822
         protected function _tag_open_INPUT($param)
5823 5823
         {
5824
-            if (!isset($param['name']))  $param['name']  = 'champs_pdf_'.(count($this->_lstField)+1);
5825
-            if (!isset($param['value'])) $param['value'] = '';
5826
-            if (!isset($param['type']))  $param['type']  = 'text';
5824
+            if ( ! isset($param['name']))  $param['name']  = 'champs_pdf_'.(count($this->_lstField) + 1);
5825
+            if ( ! isset($param['value'])) $param['value'] = '';
5826
+            if ( ! isset($param['type']))  $param['type']  = 'text';
5827 5827
 
5828 5828
             $param['name'] = strtolower($param['name']);
5829 5829
             $param['type'] = strtolower($param['type']);
5830 5830
 
5831 5831
             // the type must be valid
5832
-            if (!in_array($param['type'], array('text', 'checkbox', 'radio', 'hidden', 'submit', 'reset', 'button'))) {
5832
+            if ( ! in_array($param['type'], array('text', 'checkbox', 'radio', 'hidden', 'submit', 'reset', 'button'))) {
5833 5833
                 $param['type'] = 'text';
5834 5834
             }
5835 5835
 
@@ -5848,25 +5848,25 @@  discard block
 block discarded – undo
5848 5848
 
5849 5849
             $x = $this->pdf->getX();
5850 5850
             $y = $this->pdf->getY();
5851
-            $f = 1.08*$this->parsingCss->value['font-size'];
5851
+            $f = 1.08 * $this->parsingCss->value['font-size'];
5852 5852
 
5853 5853
             $prop = $this->parsingCss->getFormStyle();
5854 5854
 
5855
-            switch($param['type'])
5855
+            switch ($param['type'])
5856 5856
             {
5857 5857
                 case 'checkbox':
5858 5858
                     $w = 3;
5859 5859
                     $h = $w;
5860
-                    if ($h<$f) $y+= ($f-$h)*0.5;
5861
-                    $checked = (isset($param['checked']) && $param['checked']=='checked');
5860
+                    if ($h < $f) $y += ($f - $h) * 0.5;
5861
+                    $checked = (isset($param['checked']) && $param['checked'] == 'checked');
5862 5862
                     $this->pdf->CheckBox($name, $w, $checked, $prop, array(), ($param['value'] ? $param['value'] : 'Yes'), $x, $y);
5863 5863
                     break;
5864 5864
 
5865 5865
                 case 'radio':
5866 5866
                     $w = 3;
5867 5867
                     $h = $w;
5868
-                    if ($h<$f) $y+= ($f-$h)*0.5;
5869
-                    $checked = (isset($param['checked']) && $param['checked']=='checked');
5868
+                    if ($h < $f) $y += ($f - $h) * 0.5;
5869
+                    $checked = (isset($param['checked']) && $param['checked'] == 'checked');
5870 5870
                     $this->pdf->RadioButton($name, $w, $prop, array(), ($param['value'] ? $param['value'] : 'On'), $checked, $x, $y);
5871 5871
                     break;
5872 5872
 
@@ -5878,29 +5878,29 @@  discard block
 block discarded – undo
5878 5878
                     break;
5879 5879
 
5880 5880
                 case 'text':
5881
-                    $w = $this->parsingCss->value['width']; if (!$w) $w = 40;
5882
-                    $h = $f*1.3;
5881
+                    $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40;
5882
+                    $h = $f * 1.3;
5883 5883
                     $prop['value'] = $param['value'];
5884 5884
                     $this->pdf->TextField($name, $w, $h, $prop, array(), $x, $y);
5885 5885
                     break;
5886 5886
 
5887 5887
                 case 'submit':
5888
-                    $w = $this->parsingCss->value['width'];    if (!$w) $w = 40;
5889
-                    $h = $this->parsingCss->value['height'];    if (!$h) $h = $f*1.3;
5888
+                    $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40;
5889
+                    $h = $this->parsingCss->value['height']; if ( ! $h) $h = $f * 1.3;
5890 5890
                     $action = array('S'=>'SubmitForm', 'F'=>$this->_isInForm, 'Flags'=>array('ExportFormat'));
5891 5891
                     $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y);
5892 5892
                     break;
5893 5893
 
5894 5894
                 case 'reset':
5895
-                    $w = $this->parsingCss->value['width'];    if (!$w) $w = 40;
5896
-                    $h = $this->parsingCss->value['height'];    if (!$h) $h = $f*1.3;
5895
+                    $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40;
5896
+                    $h = $this->parsingCss->value['height']; if ( ! $h) $h = $f * 1.3;
5897 5897
                     $action = array('S'=>'ResetForm');
5898 5898
                     $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y);
5899 5899
                     break;
5900 5900
 
5901 5901
                 case 'button':
5902
-                    $w = $this->parsingCss->value['width'];    if (!$w) $w = 40;
5903
-                    $h = $this->parsingCss->value['height'];    if (!$h) $h = $f*1.3;
5902
+                    $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40;
5903
+                    $h = $this->parsingCss->value['height']; if ( ! $h) $h = $f * 1.3;
5904 5904
                     $action = isset($param['onclick']) ? $param['onclick'] : '';
5905 5905
                     $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y);
5906 5906
                     break;
@@ -5911,11 +5911,11 @@  discard block
 block discarded – undo
5911 5911
                     break;
5912 5912
             }
5913 5913
 
5914
-            $this->_maxX = max($this->_maxX, $x+$w);
5915
-            $this->_maxY = max($this->_maxY, $y+$h);
5914
+            $this->_maxX = max($this->_maxX, $x + $w);
5915
+            $this->_maxY = max($this->_maxY, $y + $h);
5916 5916
             $this->_maxH = max($this->_maxH, $h);
5917 5917
             $this->_maxE++;
5918
-            $this->pdf->setX($x+$w);
5918
+            $this->pdf->setX($x + $w);
5919 5919
 
5920 5920
             $this->parsingCss->load();
5921 5921
             $this->parsingCss->fontSet();
@@ -5951,26 +5951,26 @@  discard block
 block discarded – undo
5951 5951
             $w = $this->parsingCss->value['width'];
5952 5952
             $h = $this->parsingCss->value['height'];
5953 5953
 
5954
-            if (!$this->parsingCss->value['position']) {
5954
+            if ( ! $this->parsingCss->value['position']) {
5955 5955
                 if (
5956
-                    $w < ($this->pdf->getW() - $this->pdf->getlMargin()-$this->pdf->getrMargin()) &&
5957
-                    $this->pdf->getX() + $w>=($this->pdf->getW() - $this->pdf->getrMargin())
5956
+                    $w < ($this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin()) &&
5957
+                    $this->pdf->getX() + $w >= ($this->pdf->getW() - $this->pdf->getrMargin())
5958 5958
                     )
5959 5959
                     $this->_tag_open_BR(array());
5960 5960
 
5961 5961
                 if (
5962
-                        ($h < ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin())) &&
5963
-                        ($this->pdf->getY() + $h>=($this->pdf->getH() - $this->pdf->getbMargin())) &&
5964
-                        !$this->_isInOverflow
5962
+                        ($h < ($this->pdf->getH() - $this->pdf->gettMargin() - $this->pdf->getbMargin())) &&
5963
+                        ($this->pdf->getY() + $h >= ($this->pdf->getH() - $this->pdf->getbMargin())) &&
5964
+                        ! $this->_isInOverflow
5965 5965
                     )
5966 5966
                     $this->_setNewPage();
5967 5967
 
5968 5968
                 $old = $this->parsingCss->getOldValues();
5969 5969
                 $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
5970 5970
 
5971
-                if ($parentWidth>$w) {
5972
-                    if ($alignObject=='center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5);
5973
-                    else if ($alignObject=='right')    $this->pdf->setX($this->pdf->getX() + $parentWidth-$w);
5971
+                if ($parentWidth > $w) {
5972
+                    if ($alignObject == 'center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5);
5973
+                    else if ($alignObject == 'right')    $this->pdf->setX($this->pdf->getX() + $parentWidth - $w);
5974 5974
                 }
5975 5975
 
5976 5976
                 $this->parsingCss->setPosition();
@@ -5978,9 +5978,9 @@  discard block
 block discarded – undo
5978 5978
                 $old = $this->parsingCss->getOldValues();
5979 5979
                 $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
5980 5980
 
5981
-                if ($parentWidth>$w) {
5982
-                    if ($alignObject=='center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5);
5983
-                    else if ($alignObject=='right')    $this->pdf->setX($this->pdf->getX() + $parentWidth-$w);
5981
+                if ($parentWidth > $w) {
5982
+                    if ($alignObject == 'center')        $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5);
5983
+                    else if ($alignObject == 'right')    $this->pdf->setX($this->pdf->getX() + $parentWidth - $w);
5984 5984
                 }
5985 5985
 
5986 5986
                 $this->parsingCss->setPosition();
@@ -6008,27 +6008,27 @@  discard block
 block discarded – undo
6008 6008
             $marge['t'] = $this->parsingCss->value['border']['t']['width'];
6009 6009
             $marge['b'] = $this->parsingCss->value['border']['b']['width'];
6010 6010
 
6011
-            $this->parsingCss->value['width'] -= $marge['l']+$marge['r'];
6012
-            $this->parsingCss->value['height']-= $marge['t']+$marge['b'];
6011
+            $this->parsingCss->value['width'] -= $marge['l'] + $marge['r'];
6012
+            $this->parsingCss->value['height'] -= $marge['t'] + $marge['b'];
6013 6013
 
6014
-            $overW-= $marge['l']+$marge['r'];
6015
-            $overH-= $marge['t']+$marge['b'];
6014
+            $overW -= $marge['l'] + $marge['r'];
6015
+            $overH -= $marge['t'] + $marge['b'];
6016 6016
 
6017 6017
             // clipping to draw only in the size opf the DRAW tag
6018 6018
             $this->pdf->clippingPathStart(
6019
-                $this->parsingCss->value['x']+$marge['l'],
6020
-                $this->parsingCss->value['y']+$marge['t'],
6019
+                $this->parsingCss->value['x'] + $marge['l'],
6020
+                $this->parsingCss->value['y'] + $marge['t'],
6021 6021
                 $this->parsingCss->value['width'],
6022 6022
                 $this->parsingCss->value['height']
6023 6023
             );
6024 6024
 
6025 6025
             // left and right of the DRAW tag
6026
-            $mL = $this->parsingCss->value['x']+$marge['l'];
6026
+            $mL = $this->parsingCss->value['x'] + $marge['l'];
6027 6027
             $mR = $this->pdf->getW() - $mL - $overW;
6028 6028
 
6029 6029
             // position of the DRAW tag
6030
-            $x = $this->parsingCss->value['x']+$marge['l'];
6031
-            $y = $this->parsingCss->value['y']+$marge['t'];
6030
+            $x = $this->parsingCss->value['x'] + $marge['l'];
6031
+            $y = $this->parsingCss->value['y'] + $marge['t'];
6032 6032
 
6033 6033
             // prepare the drawing area
6034 6034
             $this->_saveMargin($mL, 0, $mR);
@@ -6043,7 +6043,7 @@  discard block
 block discarded – undo
6043 6043
             );
6044 6044
 
6045 6045
             // init the translate matrix : (0,0) => ($x, $y)
6046
-            $this->pdf->doTransform(array(1,0,0,1,$x,$y));
6046
+            $this->pdf->doTransform(array(1, 0, 0, 1, $x, $y));
6047 6047
             $this->pdf->SetAlpha(1.);
6048 6048
             return true;
6049 6049
         }
@@ -6075,14 +6075,14 @@  discard block
 block discarded – undo
6075 6075
 
6076 6076
             $x = $this->parsingCss->value['x'];
6077 6077
             $y = $this->parsingCss->value['y'];
6078
-            $w = $this->parsingCss->value['width']+$marge['l']+$marge['r'];
6079
-            $h = $this->parsingCss->value['height']+$marge['t']+$marge['b'];
6078
+            $w = $this->parsingCss->value['width'] + $marge['l'] + $marge['r'];
6079
+            $h = $this->parsingCss->value['height'] + $marge['t'] + $marge['b'];
6080 6080
 
6081
-            if ($this->parsingCss->value['position']!='absolute') {
6082
-                $this->pdf->setXY($x+$w, $y);
6081
+            if ($this->parsingCss->value['position'] != 'absolute') {
6082
+                $this->pdf->setXY($x + $w, $y);
6083 6083
 
6084
-                $this->_maxX = max($this->_maxX, $x+$w);
6085
-                $this->_maxY = max($this->_maxY, $y+$h);
6084
+                $this->_maxX = max($this->_maxX, $x + $w);
6085
+                $this->_maxY = max($this->_maxY, $y + $h);
6086 6086
                 $this->_maxH = max($this->_maxH, $h);
6087 6087
                 $this->_maxE++;
6088 6088
             } else {
@@ -6092,7 +6092,7 @@  discard block
 block discarded – undo
6092 6092
                 $this->_loadMax();
6093 6093
             }
6094 6094
 
6095
-            $block = ($this->parsingCss->value['display']!='inline' && $this->parsingCss->value['position']!='absolute');
6095
+            $block = ($this->parsingCss->value['display'] != 'inline' && $this->parsingCss->value['position'] != 'absolute');
6096 6096
 
6097 6097
             $this->parsingCss->load();
6098 6098
             $this->parsingCss->fontSet();
@@ -6115,7 +6115,7 @@  discard block
 block discarded – undo
6115 6115
          */
6116 6116
         protected function _tag_open_LINE($param)
6117 6117
         {
6118
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'LINE');
6118
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'LINE');
6119 6119
 
6120 6120
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6121 6121
             $this->parsingCss->save();
@@ -6142,7 +6142,7 @@  discard block
 block discarded – undo
6142 6142
          */
6143 6143
         protected function _tag_open_RECT($param)
6144 6144
         {
6145
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'RECT');
6145
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'RECT');
6146 6146
 
6147 6147
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6148 6148
             $this->parsingCss->save();
@@ -6169,7 +6169,7 @@  discard block
 block discarded – undo
6169 6169
          */
6170 6170
         protected function _tag_open_CIRCLE($param)
6171 6171
         {
6172
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'CIRCLE');
6172
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'CIRCLE');
6173 6173
 
6174 6174
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6175 6175
             $this->parsingCss->save();
@@ -6194,7 +6194,7 @@  discard block
 block discarded – undo
6194 6194
          */
6195 6195
         protected function _tag_open_ELLIPSE($param)
6196 6196
         {
6197
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'ELLIPSE');
6197
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'ELLIPSE');
6198 6198
 
6199 6199
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6200 6200
             $this->parsingCss->save();
@@ -6221,7 +6221,7 @@  discard block
 block discarded – undo
6221 6221
          */
6222 6222
         protected function _tag_open_POLYLINE($param)
6223 6223
         {
6224
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON');
6224
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON');
6225 6225
 
6226 6226
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6227 6227
             $this->parsingCss->save();
@@ -6237,16 +6237,16 @@  discard block
 block discarded – undo
6237 6237
                 $path = explode(' ', $path);
6238 6238
                 foreach ($path as $k => $v) {
6239 6239
                     $path[$k] = trim($v);
6240
-                    if ($path[$k]==='') unset($path[$k]);
6240
+                    if ($path[$k] === '') unset($path[$k]);
6241 6241
                 }
6242 6242
                 $path = array_values($path);
6243 6243
 
6244 6244
                 $actions = array();
6245
-                for ($k=0; $k<count($path); $k+=2) {
6245
+                for ($k = 0; $k < count($path); $k += 2) {
6246 6246
                     $actions[] = array(
6247
-                        ($k ? 'L' : 'M') ,
6248
-                        $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['w']),
6249
-                        $this->parsingCss->ConvertToMM($path[$k+1], $this->_isInDraw['h'])
6247
+                        ($k ? 'L' : 'M'),
6248
+                        $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']),
6249
+                        $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h'])
6250 6250
                     );
6251 6251
                 }
6252 6252
 
@@ -6267,7 +6267,7 @@  discard block
 block discarded – undo
6267 6267
          */
6268 6268
         protected function _tag_open_POLYGON($param)
6269 6269
         {
6270
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON');
6270
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON');
6271 6271
 
6272 6272
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6273 6273
             $this->parsingCss->save();
@@ -6283,16 +6283,16 @@  discard block
 block discarded – undo
6283 6283
                 $path = explode(' ', $path);
6284 6284
                 foreach ($path as $k => $v) {
6285 6285
                     $path[$k] = trim($v);
6286
-                    if ($path[$k]==='') unset($path[$k]);
6286
+                    if ($path[$k] === '') unset($path[$k]);
6287 6287
                 }
6288 6288
                 $path = array_values($path);
6289 6289
 
6290 6290
                 $actions = array();
6291
-                for ($k=0; $k<count($path); $k+=2) {
6291
+                for ($k = 0; $k < count($path); $k += 2) {
6292 6292
                     $actions[] = array(
6293
-                        ($k ? 'L' : 'M') ,
6294
-                        $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['w']),
6295
-                        $this->parsingCss->ConvertToMM($path[$k+1], $this->_isInDraw['h'])
6293
+                        ($k ? 'L' : 'M'),
6294
+                        $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']),
6295
+                        $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h'])
6296 6296
                     );
6297 6297
                 }
6298 6298
                 $actions[] = array('z');
@@ -6314,7 +6314,7 @@  discard block
 block discarded – undo
6314 6314
          */
6315 6315
         protected function _tag_open_PATH($param)
6316 6316
         {
6317
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'PATH');
6317
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'PATH');
6318 6318
 
6319 6319
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6320 6320
             $this->parsingCss->save();
@@ -6334,7 +6334,7 @@  discard block
 block discarded – undo
6334 6334
                 $path = explode(' ', $path);
6335 6335
                 foreach ($path as $k => $v) {
6336 6336
                     $path[$k] = trim($v);
6337
-                    if ($path[$k]==='') unset($path[$k]);
6337
+                    if ($path[$k] === '') unset($path[$k]);
6338 6338
                 }
6339 6339
                 $path = array_values($path);
6340 6340
 
@@ -6342,7 +6342,7 @@  discard block
 block discarded – undo
6342 6342
                 $actions = array();
6343 6343
                 $action = array();
6344 6344
                 $lastAction = null; // last action found
6345
-                for ($k=0; $k<count($path);true) {
6345
+                for ($k = 0; $k < count($path); true) {
6346 6346
 
6347 6347
                     // for this actions, we can not have multi coordonate
6348 6348
                     if (in_array($lastAction, array('z', 'Z'))) {
@@ -6350,7 +6350,7 @@  discard block
 block discarded – undo
6350 6350
                     }
6351 6351
 
6352 6352
                     // read the new action (forcing if no action before)
6353
-                    if (preg_match('/^[a-z]+$/i', $path[$k]) || $lastAction===null) {
6353
+                    if (preg_match('/^[a-z]+$/i', $path[$k]) || $lastAction === null) {
6354 6354
                         $lastAction = $path[$k];
6355 6355
                         $k++;
6356 6356
                     }
@@ -6358,40 +6358,40 @@  discard block
 block discarded – undo
6358 6358
                     // current action
6359 6359
                     $action = array();
6360 6360
                     $action[] = $lastAction;
6361
-                    switch($lastAction)
6361
+                    switch ($lastAction)
6362 6362
                     {
6363 6363
                         case 'C':
6364 6364
                         case 'c':
6365
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['w']);    // x1
6366
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+1], $this->_isInDraw['h']);    // y1
6367
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+2], $this->_isInDraw['w']);    // x2
6368
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+3], $this->_isInDraw['h']);    // y2
6369
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+4], $this->_isInDraw['w']);    // x
6370
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+5], $this->_isInDraw['h']);    // y
6371
-                            $k+= 6;
6365
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']); // x1
6366
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h']); // y1
6367
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 2], $this->_isInDraw['w']); // x2
6368
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 3], $this->_isInDraw['h']); // y2
6369
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 4], $this->_isInDraw['w']); // x
6370
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 5], $this->_isInDraw['h']); // y
6371
+                            $k += 6;
6372 6372
                             break;
6373 6373
 
6374 6374
                         case 'Q':
6375 6375
                         case 'S':
6376 6376
                         case 'q':
6377 6377
                         case 's':
6378
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['w']);    // x2
6379
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+1], $this->_isInDraw['h']);    // y2
6380
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+2], $this->_isInDraw['w']);    // x
6381
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+3], $this->_isInDraw['h']);    // y
6382
-                            $k+= 4;
6378
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']); // x2
6379
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h']); // y2
6380
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 2], $this->_isInDraw['w']); // x
6381
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 3], $this->_isInDraw['h']); // y
6382
+                            $k += 4;
6383 6383
                             break;
6384 6384
 
6385 6385
                         case 'A':
6386 6386
                         case 'a':
6387
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['w']);    // rx
6388
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+1], $this->_isInDraw['h']);    // ry
6389
-                            $action[] = 1.*$path[$k+2];                                                        // angle de deviation de l'axe X
6390
-                            $action[] = ($path[$k+3]=='1') ? 1 : 0;                                            // large-arc-flag
6391
-                            $action[] = ($path[$k+4]=='1') ? 1 : 0;                                            // sweep-flag
6392
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+5], $this->_isInDraw['w']);    // x
6393
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+6], $this->_isInDraw['h']);    // y
6394
-                            $k+= 7;
6387
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']); // rx
6388
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h']); // ry
6389
+                            $action[] = 1. * $path[$k + 2]; // angle de deviation de l'axe X
6390
+                            $action[] = ($path[$k + 3] == '1') ? 1 : 0; // large-arc-flag
6391
+                            $action[] = ($path[$k + 4] == '1') ? 1 : 0; // sweep-flag
6392
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 5], $this->_isInDraw['w']); // x
6393
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 6], $this->_isInDraw['h']); // y
6394
+                            $k += 7;
6395 6395
                             break;
6396 6396
 
6397 6397
                         case 'M':
@@ -6400,21 +6400,21 @@  discard block
 block discarded – undo
6400 6400
                         case 'm':
6401 6401
                         case 'l':
6402 6402
                         case 't':
6403
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['w']);    // x
6404
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+1], $this->_isInDraw['h']);    // y
6405
-                            $k+= 2;
6403
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']); // x
6404
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h']); // y
6405
+                            $k += 2;
6406 6406
                             break;
6407 6407
 
6408 6408
                         case 'H':
6409 6409
                         case 'h':
6410
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['w']);    // x
6411
-                            $k+= 1;
6410
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']); // x
6411
+                            $k += 1;
6412 6412
                             break;
6413 6413
 
6414 6414
                         case 'V':
6415 6415
                         case 'v':
6416
-                            $action[] = $this->parsingCss->ConvertToMM($path[$k+0], $this->_isInDraw['h']);    // y
6417
-                            $k+= 1;
6416
+                            $action[] = $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['h']); // y
6417
+                            $k += 1;
6418 6418
                             break;
6419 6419
 
6420 6420
                         case 'z':
@@ -6443,7 +6443,7 @@  discard block
 block discarded – undo
6443 6443
          */
6444 6444
         protected function _tag_open_G($param)
6445 6445
         {
6446
-            if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'G');
6446
+            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'G');
6447 6447
 
6448 6448
             $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6449 6449
             $this->parsingCss->save();
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/global_locale.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,19 +21,19 @@
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
     exit('No direct script access allowed');
26 26
 
27 27
 /**
28 28
  * Dynamically build forms for display
29 29
  */
30
-class Global_locale{
30
+class Global_locale {
31 31
 
32 32
     function __construct($library_name = '') {
33 33
 
34 34
         $this->CI = & get_instance();
35 35
 	header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
36
-	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
36
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
37 37
 	header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
38 38
 	header("Cache-Control: post-check=0, pre-check=0", false);
39 39
 	header("Pragma: no-cache");
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/locale_menu.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
     exit('No direct script access allowed');
26 26
 
27 27
 /**
28 28
  * Dynamically build forms for display
29 29
  */
30
-class locale_Menu{
30
+class locale_Menu {
31 31
 
32 32
     function __construct($library_name = '') {
33 33
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $this->CI->load->model('db_model');
36 36
         $this->CI->load->library('email');
37 37
         $this->CI->load->library('session');
38
-	$current_locale=$this->CI->session->userdata('user_language');
38
+	$current_locale = $this->CI->session->userdata('user_language');
39 39
 	putenv("LC_ALL=$current_locale");
40 40
 	setlocale(LC_ALL, $current_locale); 
41 41
 	bindtextdomain(WEBSITE_DOMAIN, FCPATH.'/application/modules/dashboard/language');
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/locale.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
     exit('No direct script access allowed');
26 26
 
27 27
 /**
28 28
  * Dynamically build forms for display
29 29
  */
30
-class Locale{
30
+class Locale {
31 31
 
32 32
     function __construct($library_name = '') {
33 33
 
@@ -38,23 +38,23 @@  discard block
 block discarded – undo
38 38
         $this->CI->load->driver('cache');
39 39
 	$this->set_lang();
40 40
     }
41
-    function set_lang($lang=FALSE){
41
+    function set_lang($lang = FALSE) {
42 42
 
43
-        $current_locale=$this->CI->session->userdata('user_language');
44
-        if(empty($current_locale)){
45
-             $current_locale= 'en_US';
43
+        $current_locale = $this->CI->session->userdata('user_language');
44
+        if (empty($current_locale)) {
45
+             $current_locale = 'en_US';
46 46
         }
47 47
 	putenv("LANG=$current_locale");
48 48
 	setlocale(LC_ALL, $current_locale.".UTF-8");
49
-        setlocale(LC_MESSAGES,$current_locale);
49
+        setlocale(LC_MESSAGES, $current_locale);
50 50
 	setlocale(LC_TIME, $current_locale);
51
-        setlocale(LC_CTYPE,$current_locale);
52
-	$domain='messages';
53
-	$uri_segment='';
51
+        setlocale(LC_CTYPE, $current_locale);
52
+	$domain = 'messages';
53
+	$uri_segment = '';
54 54
 	 $uri_segment = $this->CI->uri->segments;
55
-	if(isset($uri_segment[1])){	
55
+	if (isset($uri_segment[1])) {	
56 56
 		$filename = getcwd().'/application/modules/user/language/'.$lang.'/LC_MESSAGES/messages.mo';
57
-                bindtextdomain(WEBSITE_DOMAIN,getcwd().'/application/modules/'.$uri_segment[1].'/language/');
57
+                bindtextdomain(WEBSITE_DOMAIN, getcwd().'/application/modules/'.$uri_segment[1].'/language/');
58 58
 	}
59 59
 	bind_textdomain_codeset(WEBSITE_DOMAIN, 'UTF-8');
60 60
 	textdomain(WEBSITE_DOMAIN);
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/freeswitch_lib.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 ###############################################################################
23 23
 
24 24
 if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
25
-class freeswitch_lib{
25
+class freeswitch_lib {
26 26
 	
27
-	function event_socket_create($host='127.0.0.1', $port='8021', $password='ClueCon') {
27
+	function event_socket_create($host = '127.0.0.1', $port = '8021', $password = 'ClueCon') {
28 28
 	    $fp = @fsockopen($host, $port, $errno, $errdesc);
29 29
 // 	    or die("Connection to $host failed");
30 30
 // 	    socket_set_blocking($fp,false);
31 31
 	    
32 32
 	    if ($fp) {
33
-		socket_set_blocking($fp,false);
34
-		while (!feof($fp)) {
33
+		socket_set_blocking($fp, false);
34
+		while ( ! feof($fp)) {
35 35
 		    $buffer = fgets($fp, 1024);
36 36
 		    usleep(100); //allow time for reponse
37 37
 		    if (trim($buffer) == "Content-Type: auth/request") {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$response = "";
55 55
 		$i = 0;
56 56
 		$contentlength = 0;
57
-		while (!feof($fp)) {
57
+		while ( ! feof($fp)) {
58 58
 		    $buffer = fgets($fp, 4096);
59 59
 		    if ($contentlength > 0) {
60 60
 		      $response .= $buffer;
Please login to merge, or discard this patch.
web_interface/astpp/application/config/hooks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 * Purpose : Display logo based on domain name
15 15
 *
16 16
 */
17
-$hook['pre_system']	= array(
17
+$hook['pre_system'] = array(
18 18
 	'class'		=> 'Router',
19 19
 	'function'	=> 'route',
20 20
 	'filename'	=> 'router.php',
Please login to merge, or discard this patch.
web_interface/astpp/application/config/constants.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 |
28 28
 */
29 29
 
30
-define('FOPEN_READ',							'rb');
31
-define('FOPEN_READ_WRITE',						'r+b');
32
-define('FOPEN_WRITE_CREATE_DESTRUCTIVE',		'wb'); // truncates existing file data, use with care
33
-define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE',	'w+b'); // truncates existing file data, use with care
34
-define('FOPEN_WRITE_CREATE',					'ab');
35
-define('FOPEN_READ_WRITE_CREATE',				'a+b');
36
-define('FOPEN_WRITE_CREATE_STRICT',				'xb');
37
-define('FOPEN_READ_WRITE_CREATE_STRICT',		'x+b');
38
-define("RESELLERPROFILE_ARRAY",  serialize(array(
30
+define('FOPEN_READ', 'rb');
31
+define('FOPEN_READ_WRITE', 'r+b');
32
+define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
33
+define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
34
+define('FOPEN_WRITE_CREATE', 'ab');
35
+define('FOPEN_READ_WRITE_CREATE', 'a+b');
36
+define('FOPEN_WRITE_CREATE_STRICT', 'xb');
37
+define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
38
+define("RESELLERPROFILE_ARRAY", serialize(array(
39 39
 				"My Profile"=>"user/user_myprofile/",
40 40
                                 "Change Password"=>"user/user_change_password/",
41 41
                                 "Subscriptions"=>"user/user_subscriptions/",
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                                 "Alert Threshold"=>"user/user_alert_threshold/"
50 50
                                ))
51 51
 );
52
-define("CUSTOMEREDIT_ARRAY",serialize(array(
52
+define("CUSTOMEREDIT_ARRAY", serialize(array(
53 53
                                               "Customer Profile"=>"accounts/customer_edit/",
54 54
                                               "SIP Devices"=>"accounts/customer_sipdevices/",
55 55
                                               "Opensips Device"=>"accounts/customer_opensips/",
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                                              )
69 69
                               ));
70 70
 
71
-define("PROVIDEREDIT_ARRAY",serialize(array(
71
+define("PROVIDEREDIT_ARRAY", serialize(array(
72 72
 					      "Provider Profile"=>"accounts/provider_edit/",
73 73
                                               "SIP Devices"=>"accounts/provider_sipdevices/",
74 74
                                               "Opensips Device"=>"accounts/provider_opensips/",
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                                               "Alert Threshold"=>"accounts/provider_alert_threshold/"
87 87
                                              )
88 88
                               ));
89
-define("RESELLEREDIT_ARRAY",serialize(array("Reseller Profile"=>"accounts/reseller_edit/",
89
+define("RESELLEREDIT_ARRAY", serialize(array("Reseller Profile"=>"accounts/reseller_edit/",
90 90
 					    "DID"=>"accounts/reseller_dids/",
91 91
                                             "Subscription"=>"accounts/reseller_subscription/",
92 92
                                             "Invoice"=>"accounts/reseller_invoices/",
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
                                             "Emails"=>"accounts/reseller_emailhistory/",
99 99
                                             "Alert Threshold"=>"accounts/reseller_alert_threshold/"
100 100
 )));
101
-define("PACKAGEEDIT_ARRAY",  serialize( array(
101
+define("PACKAGEEDIT_ARRAY", serialize(array(
102 102
                                             "Package Details"=>"package/package_edit/",
103 103
                                             "Package Codes"=>"package/package_pattern_list/"
104 104
                                        )));
105
-define("CUSTOMERPROFILE_ARRAY",serialize(array(
105
+define("CUSTOMERPROFILE_ARRAY", serialize(array(
106 106
             "My Profile"=>"user/user_myprofile/",
107 107
             "Change Password"=>"user/user_change_password"
108 108
 )));
109
-define("DATABASE_DIRECTORY",FCPATH.'database_backup'.DIRECTORY_SEPARATOR);
109
+define("DATABASE_DIRECTORY", FCPATH.'database_backup'.DIRECTORY_SEPARATOR);
110 110
 define('LOCALE_REQUEST_PARAM', 'lang');
111 111
 define('WEBSITE_DOMAIN', 'messages');
112 112
 
Please login to merge, or discard this patch.
web_interface/astpp/application/config/smileys.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,49 +16,49 @@
 block discarded – undo
16 16
 
17 17
 //	smiley			image name						width	height	alt
18 18
 
19
-	':-)'			=>	array('grin.gif',			'19',	'19',	'grin'),
20
-	':lol:'			=>	array('lol.gif',			'19',	'19',	'LOL'),
21
-	':cheese:'		=>	array('cheese.gif',			'19',	'19',	'cheese'),
22
-	':)'			=>	array('smile.gif',			'19',	'19',	'smile'),
23
-	';-)'			=>	array('wink.gif',			'19',	'19',	'wink'),
24
-	';)'			=>	array('wink.gif',			'19',	'19',	'wink'),
25
-	':smirk:'		=>	array('smirk.gif',			'19',	'19',	'smirk'),
26
-	':roll:'		=>	array('rolleyes.gif',		'19',	'19',	'rolleyes'),
27
-	':-S'			=>	array('confused.gif',		'19',	'19',	'confused'),
28
-	':wow:'			=>	array('surprise.gif',		'19',	'19',	'surprised'),
29
-	':bug:'			=>	array('bigsurprise.gif',	'19',	'19',	'big surprise'),
30
-	':-P'			=>	array('tongue_laugh.gif',	'19',	'19',	'tongue laugh'),
31
-	'%-P'			=>	array('tongue_rolleye.gif',	'19',	'19',	'tongue rolleye'),
32
-	';-P'			=>	array('tongue_wink.gif',	'19',	'19',	'tongue wink'),
33
-	':P'			=>	array('raspberry.gif',		'19',	'19',	'raspberry'),
34
-	':blank:'		=>	array('blank.gif',			'19',	'19',	'blank stare'),
35
-	':long:'		=>	array('longface.gif',		'19',	'19',	'long face'),
36
-	':ohh:'			=>	array('ohh.gif',			'19',	'19',	'ohh'),
37
-	':grrr:'		=>	array('grrr.gif',			'19',	'19',	'grrr'),
38
-	':gulp:'		=>	array('gulp.gif',			'19',	'19',	'gulp'),
39
-	'8-/'			=>	array('ohoh.gif',			'19',	'19',	'oh oh'),
40
-	':down:'		=>	array('downer.gif',			'19',	'19',	'downer'),
41
-	':red:'			=>	array('embarrassed.gif',	'19',	'19',	'red face'),
42
-	':sick:'		=>	array('sick.gif',			'19',	'19',	'sick'),
43
-	':shut:'		=>	array('shuteye.gif',		'19',	'19',	'shut eye'),
44
-	':-/'			=>	array('hmm.gif',			'19',	'19',	'hmmm'),
45
-	'>:('			=>	array('mad.gif',			'19',	'19',	'mad'),
46
-	':mad:'			=>	array('mad.gif',			'19',	'19',	'mad'),
47
-	'>:-('			=>	array('angry.gif',			'19',	'19',	'angry'),
48
-	':angry:'		=>	array('angry.gif',			'19',	'19',	'angry'),
49
-	':zip:'			=>	array('zip.gif',			'19',	'19',	'zipper'),
50
-	':kiss:'		=>	array('kiss.gif',			'19',	'19',	'kiss'),
51
-	':ahhh:'		=>	array('shock.gif',			'19',	'19',	'shock'),
52
-	':coolsmile:'	=>	array('shade_smile.gif',	'19',	'19',	'cool smile'),
53
-	':coolsmirk:'	=>	array('shade_smirk.gif',	'19',	'19',	'cool smirk'),
54
-	':coolgrin:'	=>	array('shade_grin.gif',		'19',	'19',	'cool grin'),
55
-	':coolhmm:'		=>	array('shade_hmm.gif',		'19',	'19',	'cool hmm'),
56
-	':coolmad:'		=>	array('shade_mad.gif',		'19',	'19',	'cool mad'),
57
-	':coolcheese:'	=>	array('shade_cheese.gif',	'19',	'19',	'cool cheese'),
58
-	':vampire:'		=>	array('vampire.gif',		'19',	'19',	'vampire'),
59
-	':snake:'		=>	array('snake.gif',			'19',	'19',	'snake'),
60
-	':exclaim:'		=>	array('exclaim.gif',		'19',	'19',	'excaim'),
61
-	':question:'	=>	array('question.gif',		'19',	'19',	'question') // no comma after last item
19
+	':-)'			=>	array('grin.gif', '19', '19', 'grin'),
20
+	':lol:'			=>	array('lol.gif', '19', '19', 'LOL'),
21
+	':cheese:'		=>	array('cheese.gif', '19', '19', 'cheese'),
22
+	':)'			=>	array('smile.gif', '19', '19', 'smile'),
23
+	';-)'			=>	array('wink.gif', '19', '19', 'wink'),
24
+	';)'			=>	array('wink.gif', '19', '19', 'wink'),
25
+	':smirk:'		=>	array('smirk.gif', '19', '19', 'smirk'),
26
+	':roll:'		=>	array('rolleyes.gif', '19', '19', 'rolleyes'),
27
+	':-S'			=>	array('confused.gif', '19', '19', 'confused'),
28
+	':wow:'			=>	array('surprise.gif', '19', '19', 'surprised'),
29
+	':bug:'			=>	array('bigsurprise.gif', '19', '19', 'big surprise'),
30
+	':-P'			=>	array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
31
+	'%-P'			=>	array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
32
+	';-P'			=>	array('tongue_wink.gif', '19', '19', 'tongue wink'),
33
+	':P'			=>	array('raspberry.gif', '19', '19', 'raspberry'),
34
+	':blank:'		=>	array('blank.gif', '19', '19', 'blank stare'),
35
+	':long:'		=>	array('longface.gif', '19', '19', 'long face'),
36
+	':ohh:'			=>	array('ohh.gif', '19', '19', 'ohh'),
37
+	':grrr:'		=>	array('grrr.gif', '19', '19', 'grrr'),
38
+	':gulp:'		=>	array('gulp.gif', '19', '19', 'gulp'),
39
+	'8-/'			=>	array('ohoh.gif', '19', '19', 'oh oh'),
40
+	':down:'		=>	array('downer.gif', '19', '19', 'downer'),
41
+	':red:'			=>	array('embarrassed.gif', '19', '19', 'red face'),
42
+	':sick:'		=>	array('sick.gif', '19', '19', 'sick'),
43
+	':shut:'		=>	array('shuteye.gif', '19', '19', 'shut eye'),
44
+	':-/'			=>	array('hmm.gif', '19', '19', 'hmmm'),
45
+	'>:('			=>	array('mad.gif', '19', '19', 'mad'),
46
+	':mad:'			=>	array('mad.gif', '19', '19', 'mad'),
47
+	'>:-('			=>	array('angry.gif', '19', '19', 'angry'),
48
+	':angry:'		=>	array('angry.gif', '19', '19', 'angry'),
49
+	':zip:'			=>	array('zip.gif', '19', '19', 'zipper'),
50
+	':kiss:'		=>	array('kiss.gif', '19', '19', 'kiss'),
51
+	':ahhh:'		=>	array('shock.gif', '19', '19', 'shock'),
52
+	':coolsmile:'	=>	array('shade_smile.gif', '19', '19', 'cool smile'),
53
+	':coolsmirk:'	=>	array('shade_smirk.gif', '19', '19', 'cool smirk'),
54
+	':coolgrin:'	=>	array('shade_grin.gif', '19', '19', 'cool grin'),
55
+	':coolhmm:'		=>	array('shade_hmm.gif', '19', '19', 'cool hmm'),
56
+	':coolmad:'		=>	array('shade_mad.gif', '19', '19', 'cool mad'),
57
+	':coolcheese:'	=>	array('shade_cheese.gif', '19', '19', 'cool cheese'),
58
+	':vampire:'		=>	array('vampire.gif', '19', '19', 'vampire'),
59
+	':snake:'		=>	array('snake.gif', '19', '19', 'snake'),
60
+	':exclaim:'		=>	array('exclaim.gif', '19', '19', 'excaim'),
61
+	':question:'	=>	array('question.gif', '19', '19', 'question') // no comma after last item
62 62
 
63 63
 		);
64 64
 
Please login to merge, or discard this patch.