Passed
Branch v3.5 (f0ef26)
by Samir
36:09
created
web_interface/astpp/application/libraries/html2pdf/_class/myPdf.class.php 2 patches
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @param string  $orientation page orientation, same as TCPDF
32 32
      * @param string  $unit        User measure unit, same as TCPDF
33
-     * @param mixed   $format      The format used for pages, same as TCPDF
33
+     * @param string   $format      The format used for pages, same as TCPDF
34 34
      * @param boolean $unicode     TRUE means that the input text is unicode (default = true)
35 35
      * @param String  $encoding    charset encoding; default is UTF-8
36 36
      * @param boolean $diskcache   if TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower).
@@ -1407,7 +1407,6 @@  discard block
 block discarded – undo
1407 1407
      * set $_myLastPageGroup;
1408 1408
      *
1409 1409
      * @access public
1410
-     * @param integer $myLastPageGroup;
1411 1410
      * @param integer $myLastPageGroup
1412 1411
      */
1413 1412
     public function setMyLastPageGroup($myLastPageGroup)
@@ -1430,7 +1429,6 @@  discard block
 block discarded – undo
1430 1429
      * set $_myLastPageGroupNb;
1431 1430
      *
1432 1431
      * @access public
1433
-     * @param integer $myLastPageGroupNb;
1434 1432
      * @param integer $myLastPageGroupNb
1435 1433
      */
1436 1434
     public function setMyLastPageGroupNb($myLastPageGroupNb)
Please login to merge, or discard this patch.
Braces   +58 added lines, -23 removed lines patch added patch discarded remove patch
@@ -549,8 +549,12 @@  discard block
 block discarded – undo
549 549
     public function setRotation($angle, $xC = null, $yC = null)
550 550
     {
551 551
         // if no center, rotate around the current posiition
552
-        if ($xC === null) $xC = $this->x;
553
-        if ($yC === null) $yC = $this->y;
552
+        if ($xC === null) {
553
+        	$xC = $this->x;
554
+        }
555
+        if ($yC === null) {
556
+        	$yC = $this->y;
557
+        }
554 558
 
555 559
         // prepare the coordinate
556 560
         $yC = ($this->h - $yC) * $this->k;
@@ -592,8 +596,9 @@  discard block
 block discarded – undo
592 596
      */
593 597
     public function SetY($y, $resetx = true, $rtloff = false)
594 598
     {
595
-        if ($resetx)
596
-            $this->x = $this->lMargin;
599
+        if ($resetx) {
600
+                    $this->x = $this->lMargin;
601
+        }
597 602
 
598 603
         $this->y = $y;
599 604
     }
@@ -726,9 +731,13 @@  discard block
 block discarded – undo
726 731
         $y4 = $y + $h;
727 732
 
728 733
         // get the Closing operator from the PDF Style
729
-        if ($style == 'F') $op = 'f';
730
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
731
-        else $op = 'S';
734
+        if ($style == 'F') {
735
+        	$op = 'f';
736
+        } elseif ($style == 'FD' || $style == 'DF') {
737
+        	$op = 'B';
738
+        } else {
739
+        	$op = 'S';
740
+        }
732 741
 
733 742
         // drawing
734 743
         $this->_Point($x1, $y1, true);
@@ -772,9 +781,13 @@  discard block
 block discarded – undo
772 781
     public function svgEllipse($x0, $y0, $rx, $ry, $style)
773 782
     {
774 783
         // get the Closing operator from the PDF Style
775
-        if ($style == 'F') $op = 'f';
776
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
777
-        else $op = 'S';
784
+        if ($style == 'F') {
785
+        	$op = 'f';
786
+        } elseif ($style == 'FD' || $style == 'DF') {
787
+        	$op = 'B';
788
+        } else {
789
+        	$op = 'S';
790
+        }
778 791
 
779 792
         // drawing
780 793
         $this->_Arc($x0, $y0, $rx, $ry, 0, 2 * M_PI, true, true, true);
@@ -791,9 +804,13 @@  discard block
 block discarded – undo
791 804
     public function svgPolygone($actions, $style)
792 805
     {
793 806
         // get the Closing operator from the PDF Style
794
-        if ($style == 'F') $op = 'f';
795
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
796
-        else $op = 'S';
807
+        if ($style == 'F') {
808
+        	$op = 'f';
809
+        } elseif ($style == 'FD' || $style == 'DF') {
810
+        	$op = 'B';
811
+        } else {
812
+        	$op = 'S';
813
+        }
797 814
 
798 815
         // To save the First action and the last point
799 816
         $first = array('', 0, 0);
@@ -1004,7 +1021,9 @@  discard block
 block discarded – undo
1004 1021
         $trans = false)
1005 1022
     {
1006 1023
         // if we want the no trigo direction : add 2PI to the begin angle, to invert the direction
1007
-        if ( ! $direction) $angleBegin += M_PI * 2.;
1024
+        if ( ! $direction) {
1025
+        	$angleBegin += M_PI * 2.;
1026
+        }
1008 1027
 
1009 1028
         // cut in segment to convert in berize curv
1010 1029
         $dt = ($angleEnd - $angleBegin) / self::ARC_NB_SEGMENT;
@@ -1110,7 +1129,9 @@  discard block
 block discarded – undo
1110 1129
         $v['s1']['y'] = -$v['s1']['xr'] * sin($angle) + $v['s1']['yr'] * cos($angle);
1111 1130
         $v['s1']['a1'] = atan2($v['y1'] - $v['s1']['y'], $v['x1'] - $v['s1']['x']);
1112 1131
         $v['s1']['a2'] = atan2($v['y2'] - $v['s1']['y'], $v['x2'] - $v['s1']['x']);
1113
-        if ($v['s1']['a1'] > $v['s1']['a2']) $v['s1']['a1'] -= 2 * M_PI;
1132
+        if ($v['s1']['a1'] > $v['s1']['a2']) {
1133
+        	$v['s1']['a1'] -= 2 * M_PI;
1134
+        }
1114 1135
 
1115 1136
         $v['s2'] = array();
1116 1137
         $v['s2']['t'] = -$v['s1']['t'];
@@ -1122,7 +1143,9 @@  discard block
 block discarded – undo
1122 1143
         $v['s2']['y'] = -$v['s2']['xr'] * sin($angle) + $v['s2']['yr'] * cos($angle);
1123 1144
         $v['s2']['a1'] = atan2($v['y1'] - $v['s2']['y'], $v['x1'] - $v['s2']['x']);
1124 1145
         $v['s2']['a2'] = atan2($v['y2'] - $v['s2']['y'], $v['x2'] - $v['s2']['x']);
1125
-        if ($v['s2']['a1'] > $v['s2']['a2']) $v['s2']['a1'] -= 2 * M_PI;
1146
+        if ($v['s2']['a1'] > $v['s2']['a2']) {
1147
+        	$v['s2']['a1'] -= 2 * M_PI;
1148
+        }
1126 1149
 
1127 1150
         if ( ! $l) {
1128 1151
             if ($s) {
@@ -1170,8 +1193,11 @@  discard block
 block discarded – undo
1170 1193
     {
1171 1194
         // load the last Transfomation Matrix
1172 1195
         $nb = count($this->_transf);
1173
-        if ($nb)    $m = $this->_transf[$nb - 1];
1174
-        else        $m = array(1, 0, 0, 1, 0, 0);
1196
+        if ($nb) {
1197
+        	$m = $this->_transf[$nb - 1];
1198
+        } else {
1199
+        	$m = array(1, 0, 0, 1, 0, 0);
1200
+        }
1175 1201
 
1176 1202
         // apply the Transformation Matrix
1177 1203
         list($x, $y) = array(($x * $m[0] + $y * $m[2] + $m[4]), ($x * $m[1] + $y * $m[3] + $m[5]));
@@ -1195,11 +1221,16 @@  discard block
 block discarded – undo
1195 1221
     {
1196 1222
         // get the last Transformation Matrix
1197 1223
         $nb = count($this->_transf);
1198
-        if ($nb)    $m = $this->_transf[$nb - 1];
1199
-        else        $m = array(1, 0, 0, 1, 0, 0);
1224
+        if ($nb) {
1225
+        	$m = $this->_transf[$nb - 1];
1226
+        } else {
1227
+        	$m = array(1, 0, 0, 1, 0, 0);
1228
+        }
1200 1229
 
1201 1230
         // if no transform, get the Identity Matrix
1202
-        if ( ! $n) $n = array(1, 0, 0, 1, 0, 0);
1231
+        if ( ! $n) {
1232
+        	$n = array(1, 0, 0, 1, 0, 0);
1233
+        }
1203 1234
 
1204 1235
         // create the new Transformation Matrix
1205 1236
         $this->_transf[] = array(
@@ -1249,7 +1280,9 @@  discard block
 block discarded – undo
1249 1280
         $this->write1DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N');
1250 1281
 
1251 1282
         // it Label => add the FontSize to the height
1252
-        if ($labelFontsize) $h += ($labelFontsize);
1283
+        if ($labelFontsize) {
1284
+        	$h += ($labelFontsize);
1285
+        }
1253 1286
 
1254 1287
         // return the size of the barcode
1255 1288
         return array($w, $h);
@@ -1307,7 +1340,9 @@  discard block
 block discarded – undo
1307 1340
 
1308 1341
             // Offset of the current level
1309 1342
             $level = $this->outlines[$i]['l'];
1310
-            if ($level > 0) $this->Cell($level * 8);
1343
+            if ($level > 0) {
1344
+            	$this->Cell($level * 8);
1345
+            }
1311 1346
 
1312 1347
             // Caption (cut to fit on the width page)
1313 1348
             $str = $this->outlines[$i]['t'];
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_class/parsingCss.class.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -43,6 +43,7 @@
 block discarded – undo
43 43
      * Set the HTML2PDF parent object
44 44
      *
45 45
      * @param  &HTML2PDF reference to the HTML2PDF parent $object
46
+     * @param HTML2PDF_myPdf|null $pdf
46 47
      * @access public
47 48
      */
48 49
     public function setPdfParent(&$pdf)
Please login to merge, or discard this patch.
Braces   +319 added lines, -128 removed lines patch added patch discarded remove patch
@@ -183,7 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
         // prepare the Collapse attribute
185 185
         $collapse = isset($this->value['border']['collapse']) ? $this->value['border']['collapse'] : false;
186
-        if ( ! in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) $collapse = false;
186
+        if ( ! in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) {
187
+        	$collapse = false;
188
+        }
187 189
 
188 190
         // set the global css values
189 191
         $this->value['position']   = null;
@@ -319,20 +321,23 @@  discard block
 block discarded – undo
319 321
         $style = $b.$i;
320 322
 
321 323
         if ($this->_defaultFont) {
322
-            if ($family == 'arial')
323
-                $family = 'helvetica';
324
-            elseif ($family == 'symbol' || $family == 'zapfdingbats')
325
-                $style = '';
324
+            if ($family == 'arial') {
325
+                            $family = 'helvetica';
326
+            } elseif ($family == 'symbol' || $family == 'zapfdingbats') {
327
+                            $style = '';
328
+            }
326 329
 
327 330
             $fontkey = $family.$style;
328
-            if ( ! $this->_pdf->isLoadedFont($fontkey))
329
-                $family = $this->_defaultFont;
331
+            if ( ! $this->_pdf->isLoadedFont($fontkey)) {
332
+                            $family = $this->_defaultFont;
333
+            }
330 334
         }
331 335
 
332
-        if ($family == 'arial')
333
-            $family = 'helvetica';
334
-        elseif ($family == 'symbol' || $family == 'zapfdingbats')
335
-            $style = '';
336
+        if ($family == 'arial') {
337
+                    $family = 'helvetica';
338
+        } elseif ($family == 'symbol' || $family == 'zapfdingbats') {
339
+                    $style = '';
340
+        }
336 341
 
337 342
         // complete style
338 343
         $style .= $u.$d.$o;
@@ -380,7 +385,9 @@  discard block
 block discarded – undo
380 385
      */
381 386
     public function restorePosition()
382 387
     {
383
-        if ($this->value['y'] == $this->_pdf->getY()) $this->_pdf->setY($this->value['yc'], false);
388
+        if ($this->value['y'] == $this->_pdf->getY()) {
389
+        	$this->_pdf->setY($this->value['yc'], false);
390
+        }
384 391
     }
385 392
 
386 393
      /**
@@ -401,18 +408,26 @@  discard block
 block discarded – undo
401 408
         if ($this->value['position'] == 'relative' || $this->value['position'] == 'absolute') {
402 409
             if ($this->value['right'] !== null) {
403 410
                 $x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width'];
404
-                if ($this->value['margin']['r']) $x -= $this->value['margin']['r'];
411
+                if ($this->value['margin']['r']) {
412
+                	$x -= $this->value['margin']['r'];
413
+                }
405 414
             } else {
406 415
                 $x = $this->value['left'];
407
-                if ($this->value['margin']['l']) $x += $this->value['margin']['l'];
416
+                if ($this->value['margin']['l']) {
417
+                	$x += $this->value['margin']['l'];
418
+                }
408 419
             }
409 420
 
410 421
             if ($this->value['bottom'] !== null) {
411 422
                 $y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height'];
412
-                if ($this->value['margin']['b']) $y -= $this->value['margin']['b'];
423
+                if ($this->value['margin']['b']) {
424
+                	$y -= $this->value['margin']['b'];
425
+                }
413 426
             } else {
414 427
                 $y = $this->value['top'];
415
-                if ($this->value['margin']['t']) $y += $this->value['margin']['t'];
428
+                if ($this->value['margin']['t']) {
429
+                	$y += $this->value['margin']['t'];
430
+                }
416 431
             }
417 432
 
418 433
             if ($this->value['position'] == 'relative') {
@@ -425,8 +440,12 @@  discard block
 block discarded – undo
425 440
         } else {
426 441
             $this->value['x'] = $currentX;
427 442
             $this->value['y'] = $currentY;
428
-            if ($this->value['margin']['l']) $this->value['x'] += $this->value['margin']['l'];
429
-            if ($this->value['margin']['t']) $this->value['y'] += $this->value['margin']['t'];
443
+            if ($this->value['margin']['l']) {
444
+            	$this->value['x'] += $this->value['margin']['l'];
445
+            }
446
+            if ($this->value['margin']['t']) {
447
+            	$this->value['y'] += $this->value['margin']['t'];
448
+            }
430 449
         }
431 450
 
432 451
         // save the new position
@@ -484,8 +503,12 @@  discard block
 block discarded – undo
484 503
     {
485 504
         // prepare
486 505
         $tagName = strtolower($tagName);
487
-        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id)   $id   = null;
488
-        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null;
506
+        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) {
507
+        	$id   = null;
508
+        }
509
+        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) {
510
+        	$name = null;
511
+        }
489 512
 
490 513
         // read the class attribute
491 514
         $class = array();
@@ -534,10 +557,18 @@  discard block
 block discarded – undo
534 557
         // adding the style from the tag
535 558
         $styles = array_merge($styles, $param['style']);
536 559
 
537
-        if (isset($styles['stroke']))        $this->value['svg']['stroke']       = $this->convertToColor($styles['stroke'], $res);
538
-        if (isset($styles['stroke-width']))  $this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']);
539
-        if (isset($styles['fill']))          $this->value['svg']['fill']         = $this->convertToColor($styles['fill'], $res);
540
-        if (isset($styles['fill-opacity']))  $this->value['svg']['fill-opacity'] = 1. * $styles['fill-opacity'];
560
+        if (isset($styles['stroke'])) {
561
+        	$this->value['svg']['stroke']       = $this->convertToColor($styles['stroke'], $res);
562
+        }
563
+        if (isset($styles['stroke-width'])) {
564
+        	$this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']);
565
+        }
566
+        if (isset($styles['fill'])) {
567
+        	$this->value['svg']['fill']         = $this->convertToColor($styles['fill'], $res);
568
+        }
569
+        if (isset($styles['fill-opacity'])) {
570
+        	$this->value['svg']['fill-opacity'] = 1. * $styles['fill-opacity'];
571
+        }
541 572
 
542 573
         return $this->value['svg'];
543 574
     }
@@ -554,8 +585,12 @@  discard block
 block discarded – undo
554 585
     {
555 586
         // prepare the informations
556 587
         $tagName = strtolower($tagName);
557
-        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id)   $id   = null;
558
-        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null;
588
+        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) {
589
+        	$id   = null;
590
+        }
591
+        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) {
592
+        	$name = null;
593
+        }
559 594
 
560 595
         // get the class names to use
561 596
         $class = array();
@@ -594,7 +629,9 @@  discard block
 block discarded – undo
594 629
 
595 630
         // merge with the css styles from tag
596 631
         $styles = array_merge($styles, $param['style']);
597
-        if (isset($param['allwidth']) && ! isset($styles['width'])) $styles['width'] = '100%';
632
+        if (isset($param['allwidth']) && ! isset($styles['width'])) {
633
+        	$styles['width'] = '100%';
634
+        }
598 635
 
599 636
         // reset some styles, depending on the tag name
600 637
         $this->resetStyle($tagName);
@@ -603,8 +640,9 @@  discard block
 block discarded – undo
603 640
         if ($legacy) {
604 641
             foreach ($legacy as $legacyName => $legacyValue) {
605 642
                 if (is_array($legacyValue)) {
606
-                    foreach ($legacyValue as $legacy2Name => $legacy2Value)
607
-                        $this->value[$legacyName][$legacy2Name] = $legacy2Value;
643
+                    foreach ($legacyValue as $legacy2Name => $legacy2Value) {
644
+                                            $this->value[$legacyName][$legacy2Name] = $legacy2Value;
645
+                    }
608 646
                 } else {
609 647
                     $this->value[$legacyName] = $legacyValue;
610 648
                 }
@@ -647,13 +685,17 @@  discard block
 block discarded – undo
647 685
                     break;
648 686
 
649 687
                 case 'text-transform':
650
-                    if ( ! in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none';
688
+                    if ( ! in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) {
689
+                    	$val = 'none';
690
+                    }
651 691
                     $this->value['text-transform'] = $val;
652 692
                     break;
653 693
 
654 694
                 case 'font-size':
655 695
                     $val = $this->convertToMM($val, $this->value['font-size']);
656
-                    if ($val) $this->value['font-size'] = $val;
696
+                    if ($val) {
697
+                    	$this->value['font-size'] = $val;
698
+                    }
657 699
                     break;
658 700
 
659 701
                 case 'color':
@@ -669,7 +711,9 @@  discard block
 block discarded – undo
669 711
 
670 712
                 case 'text-align':
671 713
                     $val = strtolower($val);
672
-                    if ( ! in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) $val = 'left';
714
+                    if ( ! in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) {
715
+                    	$val = 'left';
716
+                    }
673 717
                     $this->value['text-align'] = $val;
674 718
                     break;
675 719
 
@@ -679,7 +723,9 @@  discard block
 block discarded – undo
679 723
 
680 724
                 case 'width':
681 725
                     $this->value['width'] = $this->convertToMM($val, $this->getLastWidth());
682
-                    if ($this->value['width'] && substr($val, -1) == '%') $correctWidth = true;
726
+                    if ($this->value['width'] && substr($val, -1) == '%') {
727
+                    	$correctWidth = true;
728
+                    }
683 729
                     $noWidth = false;
684 730
                     break;
685 731
 
@@ -688,18 +734,26 @@  discard block
 block discarded – undo
688 734
                     break;
689 735
 
690 736
                 case 'line-height':
691
-                    if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val * 100).'%';
737
+                    if (preg_match('/^[0-9\.]+$/isU', $val)) {
738
+                    	$val = floor($val * 100).'%';
739
+                    }
692 740
                     $this->value['line-height'] = $val;
693 741
                     break;
694 742
 
695 743
                 case 'rotate':
696
-                    if ( ! in_array($val, array(0, -90, 90, 180, 270, -180, -270))) $val = null;
697
-                    if ($val < 0) $val += 360;
744
+                    if ( ! in_array($val, array(0, -90, 90, 180, 270, -180, -270))) {
745
+                    	$val = null;
746
+                    }
747
+                    if ($val < 0) {
748
+                    	$val += 360;
749
+                    }
698 750
                     $this->value['rotate'] = $val;
699 751
                     break;
700 752
 
701 753
                 case 'overflow':
702
-                    if ( ! in_array($val, array('visible', 'hidden'))) $val = 'visible';
754
+                    if ( ! in_array($val, array('visible', 'hidden'))) {
755
+                    	$val = 'visible';
756
+                    }
703 757
                     $this->value['overflow'] = $val;
704 758
                     break;
705 759
 
@@ -893,34 +947,52 @@  discard block
 block discarded – undo
893 947
                             $val[$valK] = $this->convertToMM($valV, 0);
894 948
                     }
895 949
                     $this->_duplicateBorder($val);
896
-                    if ($val[0]) $this->value['border']['t']['width'] = $val[0];
897
-                    if ($val[1]) $this->value['border']['r']['width'] = $val[1];
898
-                    if ($val[2]) $this->value['border']['b']['width'] = $val[2];
899
-                    if ($val[3]) $this->value['border']['l']['width'] = $val[3];
950
+                    if ($val[0]) {
951
+                    	$this->value['border']['t']['width'] = $val[0];
952
+                    }
953
+                    if ($val[1]) {
954
+                    	$this->value['border']['r']['width'] = $val[1];
955
+                    }
956
+                    if ($val[2]) {
957
+                    	$this->value['border']['b']['width'] = $val[2];
958
+                    }
959
+                    if ($val[3]) {
960
+                    	$this->value['border']['l']['width'] = $val[3];
961
+                    }
900 962
                     break;
901 963
 
902 964
                 case 'border-top-width':
903 965
                     $val = $this->convertToMM($val, 0);
904
-                    if ($val) $this->value['border']['t']['width'] = $val;
966
+                    if ($val) {
967
+                    	$this->value['border']['t']['width'] = $val;
968
+                    }
905 969
                     break;
906 970
 
907 971
                 case 'border-right-width':
908 972
                     $val = $this->convertToMM($val, 0);
909
-                    if ($val) $this->value['border']['r']['width'] = $val;
973
+                    if ($val) {
974
+                    	$this->value['border']['r']['width'] = $val;
975
+                    }
910 976
                     break;
911 977
 
912 978
                 case 'border-bottom-width':
913 979
                     $val = $this->convertToMM($val, 0);
914
-                    if ($val) $this->value['border']['b']['width'] = $val;
980
+                    if ($val) {
981
+                    	$this->value['border']['b']['width'] = $val;
982
+                    }
915 983
                     break;
916 984
 
917 985
                 case 'border-left-width':
918 986
                     $val = $this->convertToMM($val, 0);
919
-                    if ($val) $this->value['border']['l']['width'] = $val;
987
+                    if ($val) {
988
+                    	$this->value['border']['l']['width'] = $val;
989
+                    }
920 990
                     break;
921 991
 
922 992
                 case 'border-collapse':
923
-                    if ($tagName == 'table') $this->value['border']['collapse'] = ($val == 'collapse');
993
+                    if ($tagName == 'table') {
994
+                    	$this->value['border']['collapse'] = ($val == 'collapse');
995
+                    }
924 996
                     break;
925 997
 
926 998
                 case 'border-radius':
@@ -932,17 +1004,29 @@  discard block
 block discarded – undo
932 1004
                     if (count($valH) < 1 || count($valH) > 4) {
933 1005
                         break;
934 1006
                     }
935
-                    if ( ! isset($valH[1])) $valH[1] = $valH[0];
936
-                    if ( ! isset($valH[2])) $valH = array($valH[0], $valH[0], $valH[1], $valH[1]);
937
-                    if ( ! isset($valH[3])) $valH[3] = $valH[1];
1007
+                    if ( ! isset($valH[1])) {
1008
+                    	$valH[1] = $valH[0];
1009
+                    }
1010
+                    if ( ! isset($valH[2])) {
1011
+                    	$valH = array($valH[0], $valH[0], $valH[1], $valH[1]);
1012
+                    }
1013
+                    if ( ! isset($valH[3])) {
1014
+                    	$valH[3] = $valH[1];
1015
+                    }
938 1016
                     if (isset($val[1])) {
939 1017
                         $valV = $this->convertToRadius(trim($val[1]));
940 1018
                         if (count($valV) < 1 || count($valV) > 4) {
941 1019
                             break;
942 1020
                         }
943
-                        if ( ! isset($valV[1])) $valV[1] = $valV[0];
944
-                        if ( ! isset($valV[2])) $valV = array($valV[0], $valV[0], $valV[1], $valV[1]);
945
-                        if ( ! isset($valV[3])) $valV[3] = $valV[1];
1021
+                        if ( ! isset($valV[1])) {
1022
+                        	$valV[1] = $valV[0];
1023
+                        }
1024
+                        if ( ! isset($valV[2])) {
1025
+                        	$valV = array($valV[0], $valV[0], $valV[1], $valV[1]);
1026
+                        }
1027
+                        if ( ! isset($valV[3])) {
1028
+                        	$valV[3] = $valV[1];
1029
+                        }
946 1030
                     } else {
947 1031
                         $valV = $valH;
948 1032
                     }
@@ -1024,22 +1108,35 @@  discard block
 block discarded – undo
1024 1108
                     break;
1025 1109
 
1026 1110
                 case 'position':
1027
-                    if ($val == 'absolute')       $this->value['position'] = 'absolute';
1028
-                    else if ($val == 'relative')  $this->value['position'] = 'relative';
1029
-                    else                        $this->value['position'] = null;
1111
+                    if ($val == 'absolute') {
1112
+                    	$this->value['position'] = 'absolute';
1113
+                    } else if ($val == 'relative') {
1114
+                    	$this->value['position'] = 'relative';
1115
+                    } else {
1116
+                    	$this->value['position'] = null;
1117
+                    }
1030 1118
                     break;
1031 1119
 
1032 1120
                 case 'float':
1033
-                    if ($val == 'left')           $this->value['float'] = 'left';
1034
-                    else if ($val == 'right')     $this->value['float'] = 'right';
1035
-                    else                        $this->value['float'] = null;
1121
+                    if ($val == 'left') {
1122
+                    	$this->value['float'] = 'left';
1123
+                    } else if ($val == 'right') {
1124
+                    	$this->value['float'] = 'right';
1125
+                    } else {
1126
+                    	$this->value['float'] = null;
1127
+                    }
1036 1128
                     break;
1037 1129
 
1038 1130
                 case 'display':
1039
-                    if ($val == 'inline')         $this->value['display'] = 'inline';
1040
-                    else if ($val == 'block')     $this->value['display'] = 'block';
1041
-                    else if ($val == 'none')      $this->value['display'] = 'none';
1042
-                    else                        $this->value['display'] = null;
1131
+                    if ($val == 'inline') {
1132
+                    	$this->value['display'] = 'inline';
1133
+                    } else if ($val == 'block') {
1134
+                    	$this->value['display'] = 'block';
1135
+                    } else if ($val == 'none') {
1136
+                    	$this->value['display'] = 'none';
1137
+                    } else {
1138
+                    	$this->value['display'] = null;
1139
+                    }
1043 1140
                     break;
1044 1141
 
1045 1142
                 case 'top':
@@ -1052,7 +1149,9 @@  discard block
 block discarded – undo
1052 1149
                 case 'list-style':
1053 1150
                 case 'list-style-type':
1054 1151
                 case 'list-style-image':
1055
-                    if ($nom == 'list-style') $nom = 'list-style-type';
1152
+                    if ($nom == 'list-style') {
1153
+                    	$nom = 'list-style-type';
1154
+                    }
1056 1155
                     $this->value[$nom] = $val;
1057 1156
                     break;
1058 1157
 
@@ -1064,11 +1163,17 @@  discard block
 block discarded – undo
1064 1163
         $return = true;
1065 1164
 
1066 1165
         // only for P tag
1067
-        if ($this->value['margin']['t'] === null) $this->value['margin']['t'] = $this->value['font-size'];
1068
-        if ($this->value['margin']['b'] === null) $this->value['margin']['b'] = $this->value['font-size'];
1166
+        if ($this->value['margin']['t'] === null) {
1167
+        	$this->value['margin']['t'] = $this->value['font-size'];
1168
+        }
1169
+        if ($this->value['margin']['b'] === null) {
1170
+        	$this->value['margin']['b'] = $this->value['font-size'];
1171
+        }
1069 1172
 
1070 1173
         // force the text align to left, if asked by html2pdf
1071
-        if ($this->_onlyLeft) $this->value['text-align'] = 'left';
1174
+        if ($this->_onlyLeft) {
1175
+        	$this->value['text-align'] = 'left';
1176
+        }
1072 1177
 
1073 1178
         // correction on the width (quick box)
1074 1179
         if ($noWidth && in_array($tagName, array('div', 'blockquote', 'fieldset')) && $this->value['position'] != 'absolute') {
@@ -1084,30 +1189,60 @@  discard block
 block discarded – undo
1084 1189
                     $this->value['width'] -= $this->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
1085 1190
                     $return = false;
1086 1191
                 }
1087
-                if ($this->value['width'] < 0) $this->value['width'] = 0;
1192
+                if ($this->value['width'] < 0) {
1193
+                	$this->value['width'] = 0;
1194
+                }
1088 1195
             } else {
1089 1196
                 if ($this->value['width']) {
1090
-                    if ($this->value['border']['l']['width']) $this->value['width'] += $this->value['border']['l']['width'];
1091
-                    if ($this->value['border']['r']['width']) $this->value['width'] += $this->value['border']['r']['width'];
1092
-                    if ($this->value['padding']['l'])         $this->value['width'] += $this->value['padding']['l'];
1093
-                    if ($this->value['padding']['r'])         $this->value['width'] += $this->value['padding']['r'];
1197
+                    if ($this->value['border']['l']['width']) {
1198
+                    	$this->value['width'] += $this->value['border']['l']['width'];
1199
+                    }
1200
+                    if ($this->value['border']['r']['width']) {
1201
+                    	$this->value['width'] += $this->value['border']['r']['width'];
1202
+                    }
1203
+                    if ($this->value['padding']['l']) {
1204
+                    	$this->value['width'] += $this->value['padding']['l'];
1205
+                    }
1206
+                    if ($this->value['padding']['r']) {
1207
+                    	$this->value['width'] += $this->value['padding']['r'];
1208
+                    }
1094 1209
                 }
1095 1210
             }
1096 1211
         }
1097 1212
         if ($this->value['height']) {
1098
-            if ($this->value['border']['b']['width']) $this->value['height'] += $this->value['border']['b']['width'];
1099
-            if ($this->value['border']['t']['width']) $this->value['height'] += $this->value['border']['t']['width'];
1100
-            if ($this->value['padding']['b'])         $this->value['height'] += $this->value['padding']['b'];
1101
-            if ($this->value['padding']['t'])         $this->value['height'] += $this->value['padding']['t'];
1213
+            if ($this->value['border']['b']['width']) {
1214
+            	$this->value['height'] += $this->value['border']['b']['width'];
1215
+            }
1216
+            if ($this->value['border']['t']['width']) {
1217
+            	$this->value['height'] += $this->value['border']['t']['width'];
1218
+            }
1219
+            if ($this->value['padding']['b']) {
1220
+            	$this->value['height'] += $this->value['padding']['b'];
1221
+            }
1222
+            if ($this->value['padding']['t']) {
1223
+            	$this->value['height'] += $this->value['padding']['t'];
1224
+            }
1102 1225
         }
1103 1226
 
1104
-        if ($this->value['top'] != null)      $this->value['top']     = $this->convertToMM($this->value['top'], $this->getLastHeight(true));
1105
-        if ($this->value['bottom'] != null)   $this->value['bottom']  = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true));
1106
-        if ($this->value['left'] != null)     $this->value['left']    = $this->convertToMM($this->value['left'], $this->getLastWidth(true));
1107
-        if ($this->value['right'] != null)    $this->value['right']   = $this->convertToMM($this->value['right'], $this->getLastWidth(true));
1227
+        if ($this->value['top'] != null) {
1228
+        	$this->value['top']     = $this->convertToMM($this->value['top'], $this->getLastHeight(true));
1229
+        }
1230
+        if ($this->value['bottom'] != null) {
1231
+        	$this->value['bottom']  = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true));
1232
+        }
1233
+        if ($this->value['left'] != null) {
1234
+        	$this->value['left']    = $this->convertToMM($this->value['left'], $this->getLastWidth(true));
1235
+        }
1236
+        if ($this->value['right'] != null) {
1237
+        	$this->value['right']   = $this->convertToMM($this->value['right'], $this->getLastWidth(true));
1238
+        }
1108 1239
 
1109
-        if ($this->value['top'] && $this->value['bottom'] && $this->value['height'])    $this->value['bottom']  = null;
1110
-        if ($this->value['left'] && $this->value['right'] && $this->value['width'])     $this->value['right']   = null;
1240
+        if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) {
1241
+        	$this->value['bottom']  = null;
1242
+        }
1243
+        if ($this->value['left'] && $this->value['right'] && $this->value['width']) {
1244
+        	$this->value['right']   = null;
1245
+        }
1111 1246
 
1112 1247
         return $return;
1113 1248
     }
@@ -1121,7 +1256,9 @@  discard block
 block discarded – undo
1121 1256
     public function getLineHeight()
1122 1257
     {
1123 1258
         $val = $this->value['line-height'];
1124
-        if ($val == 'normal') $val = '108%';
1259
+        if ($val == 'normal') {
1260
+        	$val = '108%';
1261
+        }
1125 1262
         return $this->convertToMM($val, $this->value['font-size']);
1126 1263
     }
1127 1264
 
@@ -1177,8 +1314,12 @@  discard block
 block discarded – undo
1177 1314
      */
1178 1315
     public function getFloat()
1179 1316
     {
1180
-        if ($this->value['float'] == 'left')    return 'left';
1181
-        if ($this->value['float'] == 'right')   return 'right';
1317
+        if ($this->value['float'] == 'left') {
1318
+        	return 'left';
1319
+        }
1320
+        if ($this->value['float'] == 'right') {
1321
+        	return 'right';
1322
+        }
1182 1323
         return null;
1183 1324
     }
1184 1325
 
@@ -1208,7 +1349,9 @@  discard block
 block discarded – undo
1208 1349
     protected function _getLastAbsoluteX()
1209 1350
     {
1210 1351
         for ($k = count($this->table) - 1; $k >= 0; $k--) {
1211
-            if ($this->table[$k]['x'] && $this->table[$k]['position']) return $this->table[$k]['x'];
1352
+            if ($this->table[$k]['x'] && $this->table[$k]['position']) {
1353
+            	return $this->table[$k]['x'];
1354
+            }
1212 1355
         }
1213 1356
         return $this->_pdf->getlMargin();
1214 1357
     }
@@ -1222,7 +1365,9 @@  discard block
 block discarded – undo
1222 1365
     protected function _getLastAbsoluteY()
1223 1366
     {
1224 1367
         for ($k = count($this->table) - 1; $k >= 0; $k--) {
1225
-            if ($this->table[$k]['y'] && $this->table[$k]['position']) return $this->table[$k]['y'];
1368
+            if ($this->table[$k]['y'] && $this->table[$k]['position']) {
1369
+            	return $this->table[$k]['y'];
1370
+            }
1226 1371
         }
1227 1372
         return $this->_pdf->gettMargin();
1228 1373
     }
@@ -1364,12 +1509,16 @@  discard block
 block discarded – undo
1364 1509
             // else, it could be the color
1365 1510
             } else {
1366 1511
                 $tmp = $this->convertToColor($value, $res);
1367
-                if ($res) $color = $tmp;
1512
+                if ($res) {
1513
+                	$color = $tmp;
1514
+                }
1368 1515
             }
1369 1516
         }
1370 1517
 
1371 1518
         // if no witdh => return none
1372
-        if ( ! $width) return $none;
1519
+        if ( ! $width) {
1520
+        	return $none;
1521
+        }
1373 1522
 
1374 1523
         // return the border properties
1375 1524
         return array('type' => $type, 'width' => $width, 'color' => $color);
@@ -1474,8 +1623,11 @@  discard block
 block discarded – undo
1474 1623
     public function convertBackgroundColor($css)
1475 1624
     {
1476 1625
         $res = null;
1477
-        if ($css == 'transparent') return null;
1478
-        else                     return $this->convertToColor($css, $res);
1626
+        if ($css == 'transparent') {
1627
+        	return null;
1628
+        } else {
1629
+        	return $this->convertToColor($css, $res);
1630
+        }
1479 1631
     }
1480 1632
 
1481 1633
     /**
@@ -1487,12 +1639,13 @@  discard block
 block discarded – undo
1487 1639
      */
1488 1640
     public function convertBackgroundImage($css)
1489 1641
     {
1490
-        if ($css == 'none')
1491
-            return null;
1492
-        else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match))
1493
-            return $match[1];
1494
-        else
1495
-            return null;
1642
+        if ($css == 'none') {
1643
+                    return null;
1644
+        } else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match)) {
1645
+                    return $match[1];
1646
+        } else {
1647
+                    return null;
1648
+        }
1496 1649
     }
1497 1650
 
1498 1651
     /**
@@ -1513,10 +1666,14 @@  discard block
 block discarded – undo
1513 1666
 
1514 1667
         // we must have 2 values. if 0 or >2 : error. if 1 => put center for 2
1515 1668
         if (count($css) < 2) {
1516
-            if ( ! $css[0]) return null;
1669
+            if ( ! $css[0]) {
1670
+            	return null;
1671
+            }
1517 1672
             $css[1] = 'center';
1518 1673
         }
1519
-        if (count($css) > 2) return null;
1674
+        if (count($css) > 2) {
1675
+        	return null;
1676
+        }
1520 1677
 
1521 1678
         // prepare the values
1522 1679
         $x = 0;
@@ -1524,24 +1681,42 @@  discard block
 block discarded – undo
1524 1681
         $res = true;
1525 1682
 
1526 1683
         // convert the first value
1527
-        if ($css[0] == 'left')        $x = '0%';
1528
-        else if ($css[0] == 'center') $x = '50%';
1529
-        else if ($css[0] == 'right')  $x = '100%';
1530
-        else if ($css[0] == 'top')    $y = '0%';
1531
-        else if ($css[0] == 'bottom') $y = '100%';
1532
-        else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) $x = $css[0];
1533
-        else if ($this->convertToMM($css[0])) $x = $this->convertToMM($css[0]);
1534
-        else $res = false;
1684
+        if ($css[0] == 'left') {
1685
+        	$x = '0%';
1686
+        } else if ($css[0] == 'center') {
1687
+        	$x = '50%';
1688
+        } else if ($css[0] == 'right') {
1689
+        	$x = '100%';
1690
+        } else if ($css[0] == 'top') {
1691
+        	$y = '0%';
1692
+        } else if ($css[0] == 'bottom') {
1693
+        	$y = '100%';
1694
+        } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) {
1695
+        	$x = $css[0];
1696
+        } else if ($this->convertToMM($css[0])) {
1697
+        	$x = $this->convertToMM($css[0]);
1698
+        } else {
1699
+        	$res = false;
1700
+        }
1535 1701
 
1536 1702
         // convert the second value
1537
-        if ($css[1] == 'left')        $x = '0%';
1538
-        else if ($css[1] == 'right')  $x = '100%';
1539
-        else if ($css[1] == 'top')    $y = '0%';
1540
-        else if ($css[1] == 'center') $y = '50%';
1541
-        else if ($css[1] == 'bottom') $y = '100%';
1542
-        else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) $y = $css[1];
1543
-        else if ($this->convertToMM($css[1])) $y = $this->convertToMM($css[1]);
1544
-        else $res = false;
1703
+        if ($css[1] == 'left') {
1704
+        	$x = '0%';
1705
+        } else if ($css[1] == 'right') {
1706
+        	$x = '100%';
1707
+        } else if ($css[1] == 'top') {
1708
+        	$y = '0%';
1709
+        } else if ($css[1] == 'center') {
1710
+        	$y = '50%';
1711
+        } else if ($css[1] == 'bottom') {
1712
+        	$y = '100%';
1713
+        } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) {
1714
+        	$y = $css[1];
1715
+        } else if ($this->convertToMM($css[1])) {
1716
+        	$y = $this->convertToMM($css[1]);
1717
+        } else {
1718
+        	$res = false;
1719
+        }
1545 1720
 
1546 1721
         // return the values
1547 1722
         return array($x, $y);
@@ -1581,13 +1756,22 @@  discard block
 block discarded – undo
1581 1756
     public function convertToMM($css, $old = 0.)
1582 1757
     {
1583 1758
         $css = trim($css);
1584
-        if (preg_match('/^[0-9\.\-]+$/isU', $css))        $css .= 'px';
1585
-        if (preg_match('/^[0-9\.\-]+px$/isU', $css))      $css = 25.4 / 96. * str_replace('px', '', $css);
1586
-        else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) $css = 25.4 / 72. * str_replace('pt', '', $css);
1587
-        else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) $css = 25.4 * str_replace('in', '', $css);
1588
-        else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) $css = 1. * str_replace('mm', '', $css);
1589
-        else if (preg_match('/^[0-9\.\-]+%$/isU', $css))  $css = 1. * $old * str_replace('%', '', $css) / 100.;
1590
-        else                                              $css = null;
1759
+        if (preg_match('/^[0-9\.\-]+$/isU', $css)) {
1760
+        	$css .= 'px';
1761
+        }
1762
+        if (preg_match('/^[0-9\.\-]+px$/isU', $css)) {
1763
+        	$css = 25.4 / 96. * str_replace('px', '', $css);
1764
+        } else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) {
1765
+        	$css = 25.4 / 72. * str_replace('pt', '', $css);
1766
+        } else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) {
1767
+        	$css = 25.4 * str_replace('in', '', $css);
1768
+        } else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) {
1769
+        	$css = 1. * str_replace('mm', '', $css);
1770
+        } else if (preg_match('/^[0-9\.\-]+%$/isU', $css)) {
1771
+        	$css = 1. * $old * str_replace('%', '', $css) / 100.;
1772
+        } else {
1773
+        	$css = null;
1774
+        }
1591 1775
 
1592 1776
         return $css;
1593 1777
     }
@@ -1636,7 +1820,9 @@  discard block
 block discarded – undo
1636 1820
         $res = true;
1637 1821
 
1638 1822
         // if transparent => return null
1639
-        if (strtolower($css) == 'transparent') return array(null, null, null);
1823
+        if (strtolower($css) == 'transparent') {
1824
+        	return array(null, null, null);
1825
+        }
1640 1826
 
1641 1827
         // HTML color
1642 1828
         if (isset($this->_htmlColor[strtolower($css)])) {
@@ -1697,7 +1883,9 @@  discard block
 block discarded – undo
1697 1883
             $c = floatVal(substr($c, 0, -1)) / 100.;
1698 1884
         } else {
1699 1885
             $c = floatVal($c);
1700
-            if ($c > 1) $c = $c / 255.;
1886
+            if ($c > 1) {
1887
+            	$c = $c / 255.;
1888
+            }
1701 1889
         }
1702 1890
 
1703 1891
         return $c;
@@ -1751,13 +1939,16 @@  discard block
 block discarded – undo
1751 1939
                 $name = trim($name);
1752 1940
 
1753 1941
                 // if a selector with somethink lige :hover => continue
1754
-                if (strpos($name, ':') !== false) continue;
1942
+                if (strpos($name, ':') !== false) {
1943
+                	continue;
1944
+                }
1755 1945
 
1756 1946
                 // save the value
1757
-                if ( ! isset($this->css[$name]))
1758
-                    $this->css[$name] = $css;
1759
-                else
1760
-                    $this->css[$name] = array_merge($this->css[$name], $css);
1947
+                if ( ! isset($this->css[$name])) {
1948
+                                    $this->css[$name] = $css;
1949
+                } else {
1950
+                                    $this->css[$name] = array_merge($this->css[$name], $css);
1951
+                }
1761 1952
 
1762 1953
             }
1763 1954
         }
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_class/parsingHtml.class.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -50,6 +50,7 @@
 block discarded – undo
50 50
      * Define the HTML code to parse
51 51
      *
52 52
      * @param   string HTML code
53
+     * @param string $html
53 54
      * @access  public
54 55
      */
55 56
     public function setHTML($html)
Please login to merge, or discard this patch.
Braces   +65 added lines, -34 removed lines patch added patch discarded remove patch
@@ -115,12 +115,13 @@  discard block
 block discarded – undo
115 115
                         // if it is a closure tag
116 116
                         if ($res['close']) {
117 117
                             // HTML validation
118
-                            if (count($parents) < 1)
119
-                                throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos']));
120
-                            else if ($parents[count($parents) - 1] != $res['name'])
121
-                                throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos']));
122
-                            else
123
-                                unset($parents[count($parents) - 1]);
118
+                            if (count($parents) < 1) {
119
+                                                            throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos']));
120
+                            } else if ($parents[count($parents) - 1] != $res['name']) {
121
+                                                            throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos']));
122
+                            } else {
123
+                                                            unset($parents[count($parents) - 1]);
124
+                            }
124 125
                         } else {
125 126
                             // if it is a autoclosed tag
126 127
                             if ($res['autoclose']) {
@@ -171,7 +172,9 @@  discard block
 block discarded – undo
171 172
                         $txt = str_replace(' ', '&nbsp;', $txt);
172 173
 
173 174
                         // add a break line
174
-                        if ($k > 0) $actions[] = $tagPreBr;
175
+                        if ($k > 0) {
176
+                        	$actions[] = $tagPreBr;
177
+                        }
175 178
 
176 179
                         // save the action
177 180
                         $actions[] = array(
@@ -204,21 +207,26 @@  discard block
 block discarded – undo
204 207
             // if it is a Text
205 208
             if ($actions[$k]['name'] == 'write') {
206 209
                 // if the tag before the text is a tag to clean => ltrim on the text
207
-                if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean))
208
-                    $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']);
210
+                if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean)) {
211
+                                    $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']);
212
+                }
209 213
 
210 214
                 // if the tag after the text is a tag to clean => rtrim on the text
211
-                if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean))
212
-                    $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']);
215
+                if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean)) {
216
+                                    $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']);
217
+                }
213 218
 
214 219
                 // if the text is empty => remove the action
215
-                if ( ! strlen($actions[$k]['param']['txt']))
216
-                    unset($actions[$k]);
220
+                if ( ! strlen($actions[$k]['param']['txt'])) {
221
+                                    unset($actions[$k]);
222
+                }
217 223
             }
218 224
         }
219 225
 
220 226
         // if we are not on the level 0 => HTML validator ERROR
221
-        if (count($parents)) throw new HTML2PDF_exception(5, $parents);
227
+        if (count($parents)) {
228
+        	throw new HTML2PDF_exception(5, $parents);
229
+        }
222 230
 
223 231
         // save the actions to do
224 232
         $this->code = array_values($actions);
@@ -265,7 +273,9 @@  discard block
 block discarded – undo
265 273
             // if it is a tag
266 274
             if ($parse[1][0]) {
267 275
                 // save the previous text if it exists
268
-                if ($str !== '')    $tmp[] = array('txt', $str);
276
+                if ($str !== '') {
277
+                	$tmp[] = array('txt', $str);
278
+                }
269 279
 
270 280
                 // save the tag, with the offset
271 281
                 $tmp[] = array('code', trim($parse[1][0]), $offset);
@@ -282,7 +292,9 @@  discard block
 block discarded – undo
282 292
             unset($parse);
283 293
         }
284 294
         // if a text is present in the end, we save it
285
-        if ($str != '') $tmp[] = array('txt', $str);
295
+        if ($str != '') {
296
+        	$tmp[] = array('txt', $str);
297
+        }
286 298
         unset($str);
287 299
     }
288 300
 
@@ -296,7 +308,9 @@  discard block
 block discarded – undo
296 308
     {
297 309
         // name of the tag, opening, closure, autoclosure
298 310
         $tag = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)';
299
-        if ( ! preg_match('/'.$tag.'/isU', $code, $match)) return null;
311
+        if ( ! preg_match('/'.$tag.'/isU', $code, $match)) {
312
+        	return null;
313
+        }
300 314
         $close     = ($match[1] == '/' ? true : false);
301 315
         $autoclose = preg_match('/\/>$/isU', $code);
302 316
         $name      = strtolower($match[2]);
@@ -315,20 +329,23 @@  discard block
 block discarded – undo
315 329
         // read the parameters : nom=valeur
316 330
         $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)';
317 331
         preg_match_all('/'.$prop.'/is', $code, $match);
318
-        for ($k = 0; $k < count($match[0]); $k++)
319
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
332
+        for ($k = 0; $k < count($match[0]); $k++) {
333
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
334
+        }
320 335
 
321 336
         // read the parameters : nom="valeur"
322 337
         $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]';
323 338
         preg_match_all('/'.$prop.'/is', $code, $match);
324
-        for ($k = 0; $k < count($match[0]); $k++)
325
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
339
+        for ($k = 0; $k < count($match[0]); $k++) {
340
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
341
+        }
326 342
 
327 343
         // read the parameters : nom='valeur'
328 344
         $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']";
329 345
         preg_match_all('/'.$prop.'/is', $code, $match);
330
-        for ($k = 0; $k < count($match[0]); $k++)
331
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
346
+        for ($k = 0; $k < count($match[0]); $k++) {
347
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
348
+        }
332 349
 
333 350
         // compliance of each parameter
334 351
         $color  = "#000000";
@@ -374,19 +391,25 @@  discard block
 block discarded – undo
374 391
 
375 392
                 case 'border':
376 393
                     unset($param[$key]);
377
-                    if (preg_match('/^[0-9]+$/isU', $val)) $val = $val.'px';
394
+                    if (preg_match('/^[0-9]+$/isU', $val)) {
395
+                    	$val = $val.'px';
396
+                    }
378 397
                     $border = $val;
379 398
                     break;
380 399
 
381 400
                 case 'cellpadding':
382 401
                 case 'cellspacing':
383
-                    if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px';
402
+                    if (preg_match('/^([0-9]+)$/isU', $val)) {
403
+                    	$param[$key] = $val.'px';
404
+                    }
384 405
                     break;
385 406
 
386 407
                 case 'colspan':
387 408
                 case 'rowspan':
388 409
                     $val = preg_replace('/[^0-9]/isU', '', $val);
389
-                    if ( ! $val) $val = 1;
410
+                    if ( ! $val) {
411
+                    	$val = 1;
412
+                    }
390 413
                     $param[$key] = $val;
391 414
                     break;
392 415
             }
@@ -394,8 +417,11 @@  discard block
 block discarded – undo
394 417
 
395 418
         // compliance of the border
396 419
         if ($border !== null) {
397
-            if ($border)    $border = 'border: solid '.$border.' '.$color;
398
-            else            $border = 'border: none';
420
+            if ($border) {
421
+            	$border = 'border: solid '.$border.' '.$color;
422
+            } else {
423
+            	$border = 'border: none';
424
+            }
399 425
 
400 426
             $param['style'] .= $border.'; ';
401 427
             $param['border'] = $border;
@@ -458,7 +484,9 @@  discard block
 block discarded – undo
458 484
     public function getLevel($k)
459 485
     {
460 486
         // if the code does not exist => return empty
461
-        if ( ! isset($this->code[$k])) return array();
487
+        if ( ! isset($this->code[$k])) {
488
+        	return array();
489
+        }
462 490
 
463 491
         // the tag to detect
464 492
         $detect = $this->code[$k]['name'];
@@ -503,16 +531,19 @@  discard block
 block discarded – undo
503 531
 
504 532
                 // if we can takin into account the current tag => save it
505 533
                 if ( ! $not) {
506
-                    if (isset($row['style']['text-align'])) unset($row['style']['text-align']);
534
+                    if (isset($row['style']['text-align'])) {
535
+                    	unset($row['style']['text-align']);
536
+                    }
507 537
                     $code[] = $row;
508 538
                 }
509 539
             }
510 540
 
511 541
             // it continues as long as there has code to analise
512
-            if (isset($this->code[$k + 1]))
513
-                $k++;
514
-            else
515
-                $end = true;
542
+            if (isset($this->code[$k + 1])) {
543
+                            $k++;
544
+            } else {
545
+                            $end = true;
546
+            }
516 547
         }
517 548
 
518 549
         // return the extract
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_tcpdf_5.0.002/qrcode.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
 		 * @param array $frame
1124 1124
 		 * @param int $maskNo
1125 1125
 		 * @param int $level
1126
-		 * @return array mask
1126
+		 * @return integer mask
1127 1127
 		 */
1128 1128
 		 protected function makeMask($width, $frame, $maskNo, $level) {
1129 1129
 			$masked = array_fill(0, $width, str_repeat("\0", $width));
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 		/**
1166 1166
 		 * evaluateSymbol
1167 1167
 		 * @param int $width
1168
-		 * @param array $frame
1168
+		 * @param integer $frame
1169 1169
 		 * @return int demerit
1170 1170
 		 */
1171 1171
 		 protected function evaluateSymbol($width, $frame) {
@@ -2035,7 +2035,7 @@  discard block
 block discarded – undo
2035 2035
 
2036 2036
 		/**
2037 2037
 		 * convertData
2038
-		 * @param array $items
2038
+		 * @param integer $items
2039 2039
 		 * @return array items
2040 2040
 		 */
2041 2041
 		 protected function convertData($items) {
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
 
2491 2491
 		/**
2492 2492
 		 * Return BCH encoded format information pattern.
2493
-		 * @param array $mask
2493
+		 * @param integer $mask
2494 2494
 		 * @param int $level error correction level
2495 2495
 		 * @return BCH encoded format information pattern
2496 2496
 		 */
Please login to merge, or discard this patch.
web_interface/astpp/system/database/DB_result.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -64,6 +64,7 @@
 block discarded – undo
64 64
 	 * Custom query result.
65 65
 	 *
66 66
 	 * @param class_name A string that represents the type of object you want back
67
+	 * @param string $class_name
67 68
 	 * @return array of objects
68 69
 	 */
69 70
 	public function custom_result_object($class_name)
Please login to merge, or discard this patch.
web_interface/astpp/system/database/drivers/sqlsrv/sqlsrv_driver.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -164,6 +164,7 @@
 block discarded – undo
164 164
 	 *
165 165
 	 * @access	private called by execute()
166 166
 	 * @param	string	an SQL query
167
+	 * @param string $sql
167 168
 	 * @return	string
168 169
 	 */
169 170
 	function _prep_query($sql)
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -338,13 +338,15 @@
 block discarded – undo
338 338
 	 */
339 339
 	function count_all($table = '')
340 340
 	{
341
-		if ($table == '')
342
-			return '0';
341
+		if ($table == '') {
342
+					return '0';
343
+		}
343 344
 	
344 345
 		$query = $this->query("SELECT COUNT(*) AS numrows FROM ".$this->dbprefix.$table);
345 346
 		
346
-		if ($query->num_rows() == 0)
347
-			return '0';
347
+		if ($query->num_rows() == 0) {
348
+					return '0';
349
+		}
348 350
 
349 351
 		$row = $query->row();
350 352
 		$this->_reset_select();
Please login to merge, or discard this patch.
web_interface/astpp/system/libraries/Encrypt.php 1 patch
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -293,6 +293,8 @@  discard block
 block discarded – undo
293 293
 	 * @access	private
294 294
 	 * @param	string
295 295
 	 * @param	string
296
+	 * @param string $string
297
+	 * @param string $key
296 298
 	 * @return	string
297 299
 	 */
298 300
 	function _xor_merge($string, $key)
@@ -365,6 +367,7 @@  discard block
 block discarded – undo
365 367
 	 * @param	string
366 368
 	 * @param	string
367 369
 	 * @param string $data
370
+	 * @param string $key
368 371
 	 * @return	string
369 372
 	 */
370 373
 	function _add_cipher_noise($data, $key)
@@ -396,6 +399,8 @@  discard block
 block discarded – undo
396 399
 	 *
397 400
 	 * @access	public
398 401
 	 * @param	type
402
+	 * @param string $data
403
+	 * @param string $key
399 404
 	 * @return	string
400 405
 	 */
401 406
 	function _remove_cipher_noise($data, $key)
Please login to merge, or discard this patch.
web_interface/astpp/system/libraries/Fpdf.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -1010,6 +1010,9 @@
 block discarded – undo
1010 1010
 	return $this->x;
1011 1011
 }
1012 1012
 
1013
+/**
1014
+ * @param integer $x
1015
+ */
1013 1016
 function SetX($x)
1014 1017
 {
1015 1018
 	// Set x position
Please login to merge, or discard this patch.
Braces   +518 added lines, -401 removed lines patch added patch discarded remove patch
@@ -116,26 +116,28 @@  discard block
 block discarded – undo
116 116
 	if (defined('FPDF_FONTPATH'))
117 117
 	{
118 118
 		$this->fontpath = FPDF_FONTPATH;
119
-		if (substr($this->fontpath, -1) != '/' && substr($this->fontpath, -1) != '\\')
120
-			$this->fontpath .= '/';
121
-	}
122
-	elseif (is_dir(dirname(__FILE__).'/font'))
123
-		$this->fontpath = dirname(__FILE__).'/font/';
124
-	else
125
-		$this->fontpath = '';	
119
+		if (substr($this->fontpath, -1) != '/' && substr($this->fontpath, -1) != '\\') {
120
+					$this->fontpath .= '/';
121
+		}
122
+	} elseif (is_dir(dirname(__FILE__).'/font')) {
123
+			$this->fontpath = dirname(__FILE__).'/font/';
124
+	} else {
125
+			$this->fontpath = '';
126
+	}
126 127
 	// Core fonts
127 128
 	$this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
128 129
 	// Scale factor
129
-	if ($unit == 'pt')
130
-		$this->k = 1;
131
-	elseif ($unit == 'mm')
132
-		$this->k = 72 / 25.4;
133
-	elseif ($unit == 'cm')
134
-		$this->k = 72 / 2.54;
135
-	elseif ($unit == 'in')
136
-		$this->k = 72;
137
-	else
138
-		$this->Error('Incorrect unit: '.$unit);
130
+	if ($unit == 'pt') {
131
+			$this->k = 1;
132
+	} elseif ($unit == 'mm') {
133
+			$this->k = 72 / 25.4;
134
+	} elseif ($unit == 'cm') {
135
+			$this->k = 72 / 2.54;
136
+	} elseif ($unit == 'in') {
137
+			$this->k = 72;
138
+	} else {
139
+			$this->Error('Incorrect unit: '.$unit);
140
+	}
139 141
 	// Page sizes
140 142
 	$this->StdPageSizes = array('a3'=>array(841.89, 1190.55), 'a4'=>array(595.28, 841.89), 'a5'=>array(420.94, 595.28),
141 143
 		'letter'=>array(612, 792), 'legal'=>array(612, 1008));
@@ -149,15 +151,14 @@  discard block
 block discarded – undo
149 151
 		$this->DefOrientation = 'P';
150 152
 		$this->w = $size[0];
151 153
 		$this->h = $size[1];
152
-	}
153
-	elseif ($orientation == 'l' || $orientation == 'landscape')
154
+	} elseif ($orientation == 'l' || $orientation == 'landscape')
154 155
 	{
155 156
 		$this->DefOrientation = 'L';
156 157
 		$this->w = $size[1];
157 158
 		$this->h = $size[0];
158
-	}
159
-	else
160
-		$this->Error('Incorrect orientation: '.$orientation);
159
+	} else {
160
+			$this->Error('Incorrect orientation: '.$orientation);
161
+	}
161 162
 	$this->CurOrientation = $this->DefOrientation;
162 163
 	$this->wPt = $this->w * $this->k;
163 164
 	$this->hPt = $this->h * $this->k;
@@ -197,9 +198,10 @@  discard block
 block discarded – undo
197 198
 {
198 199
 	// Set left margin
199 200
 	$this->lMargin = $margin;
200
-	if ($this->page > 0 && $this->x < $margin)
201
-		$this->x = $margin;
202
-}
201
+	if ($this->page > 0 && $this->x < $margin) {
202
+			$this->x = $margin;
203
+	}
204
+	}
203 205
 
204 206
 function SetTopMargin($margin)
205 207
 {
@@ -230,15 +232,17 @@  discard block
 block discarded – undo
230 232
 function SetDisplayMode($zoom, $layout='default')
231 233
 {
232 234
 	// Set display mode in viewer
233
-	if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
234
-		$this->ZoomMode = $zoom;
235
-	else
236
-		$this->Error('Incorrect zoom display mode: '.$zoom);
237
-	if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
238
-		$this->LayoutMode = $layout;
239
-	else
240
-		$this->Error('Incorrect layout display mode: '.$layout);
241
-}
235
+	if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) {
236
+			$this->ZoomMode = $zoom;
237
+	} else {
238
+			$this->Error('Incorrect zoom display mode: '.$zoom);
239
+	}
240
+	if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') {
241
+			$this->LayoutMode = $layout;
242
+	} else {
243
+			$this->Error('Incorrect layout display mode: '.$layout);
244
+	}
245
+	}
242 246
 
243 247
 /**
244 248
  * @param boolean $compress
@@ -246,49 +250,55 @@  discard block
 block discarded – undo
246 250
 function SetCompression($compress)
247 251
 {
248 252
 	// Set page compression
249
-	if (function_exists('gzcompress'))
250
-		$this->compress = $compress;
251
-	else
252
-		$this->compress = false;
253
-}
253
+	if (function_exists('gzcompress')) {
254
+			$this->compress = $compress;
255
+	} else {
256
+			$this->compress = false;
257
+	}
258
+	}
254 259
 
255 260
 function SetTitle($title, $isUTF8 = false)
256 261
 {
257 262
 	// Title of document
258
-	if ($isUTF8)
259
-		$title = $this->_UTF8toUTF16($title);
263
+	if ($isUTF8) {
264
+			$title = $this->_UTF8toUTF16($title);
265
+	}
260 266
 	$this->title = $title;
261 267
 }
262 268
 
263 269
 function SetSubject($subject, $isUTF8 = false)
264 270
 {
265 271
 	// Subject of document
266
-	if ($isUTF8)
267
-		$subject = $this->_UTF8toUTF16($subject);
272
+	if ($isUTF8) {
273
+			$subject = $this->_UTF8toUTF16($subject);
274
+	}
268 275
 	$this->subject = $subject;
269 276
 }
270 277
 
271 278
 function SetAuthor($author, $isUTF8 = false)
272 279
 {
273 280
 	// Author of document
274
-	if ($isUTF8)
275
-		$author = $this->_UTF8toUTF16($author);
281
+	if ($isUTF8) {
282
+			$author = $this->_UTF8toUTF16($author);
283
+	}
276 284
 	$this->author = $author;
277 285
 }
278 286
 
279 287
 function SetKeywords($keywords, $isUTF8 = false)
280 288
 {
281 289
 	// Keywords of document
282
-	if ($isUTF8)
283
-		$keywords = $this->_UTF8toUTF16($keywords);
290
+	if ($isUTF8) {
291
+			$keywords = $this->_UTF8toUTF16($keywords);
292
+	}
284 293
 	$this->keywords = $keywords;
285 294
 }
286 295
 
287 296
 function SetCreator($creator, $isUTF8 = false)
288 297
 {
289 298
 	// Creator of document
290
-	if ($isUTF8)
291
-		$creator = $this->_UTF8toUTF16($creator);
299
+	if ($isUTF8) {
300
+			$creator = $this->_UTF8toUTF16($creator);
301
+	}
292 302
 	$this->creator = $creator;
293 303
 }
294 304
 
@@ -313,10 +323,12 @@  discard block
 block discarded – undo
313 323
 function Close()
314 324
 {
315 325
 	// Terminate document
316
-	if ($this->state == 3)
317
-		return;
318
-	if ($this->page == 0)
319
-		$this->AddPage();
326
+	if ($this->state == 3) {
327
+			return;
328
+	}
329
+	if ($this->page == 0) {
330
+			$this->AddPage();
331
+	}
320 332
 	// Page footer
321 333
 	$this->InFooter = true;
322 334
 	$this->Footer();
@@ -330,8 +342,9 @@  discard block
 block discarded – undo
330 342
 function AddPage($orientation = '', $size = '')
331 343
 {
332 344
 	// Start a new page
333
-	if ($this->state == 0)
334
-		$this->Open();
345
+	if ($this->state == 0) {
346
+			$this->Open();
347
+	}
335 348
 	$family = $this->FontFamily;
336 349
 	$style = $this->FontStyle.($this->underline ? 'U' : '');
337 350
 	$fontsize = $this->FontSizePt;
@@ -357,15 +370,18 @@  discard block
 block discarded – undo
357 370
 	$this->LineWidth = $lw;
358 371
 	$this->_out(sprintf('%.2F w', $lw * $this->k));
359 372
 	// Set font
360
-	if ($family)
361
-		$this->SetFont($family, $style, $fontsize);
373
+	if ($family) {
374
+			$this->SetFont($family, $style, $fontsize);
375
+	}
362 376
 	// Set colors
363 377
 	$this->DrawColor = $dc;
364
-	if ($dc != '0 G')
365
-		$this->_out($dc);
378
+	if ($dc != '0 G') {
379
+			$this->_out($dc);
380
+	}
366 381
 	$this->FillColor = $fc;
367
-	if ($fc != '0 g')
368
-		$this->_out($fc);
382
+	if ($fc != '0 g') {
383
+			$this->_out($fc);
384
+	}
369 385
 	$this->TextColor = $tc;
370 386
 	$this->ColorFlag = $cf;
371 387
 	// Page header
@@ -379,8 +395,9 @@  discard block
 block discarded – undo
379 395
 		$this->_out(sprintf('%.2F w', $lw * $this->k));
380 396
 	}
381 397
 	// Restore font
382
-	if ($family)
383
-		$this->SetFont($family, $style, $fontsize);
398
+	if ($family) {
399
+			$this->SetFont($family, $style, $fontsize);
400
+	}
384 401
 	// Restore colors
385 402
 	if ($this->DrawColor != $dc)
386 403
 	{
@@ -415,13 +432,15 @@  discard block
 block discarded – undo
415 432
 function SetDrawColor($r, $g=null, $b=null)
416 433
 {
417 434
 	// Set color for all stroking operations
418
-	if(($r==0 && $g==0 && $b==0) || $g===null)
419
-		$this->DrawColor = sprintf('%.3F G',$r/255);
420
-	else
421
-		$this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
422
-	if($this->page>0)
423
-		$this->_out($this->DrawColor);
424
-}
435
+	if(($r==0 && $g==0 && $b==0) || $g===null) {
436
+			$this->DrawColor = sprintf('%.3F G',$r/255);
437
+	} else {
438
+			$this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
439
+	}
440
+	if($this->page>0) {
441
+			$this->_out($this->DrawColor);
442
+	}
443
+	}
425 444
 
426 445
 /**
427 446
  * @param integer $r
@@ -431,22 +450,25 @@  discard block
 block discarded – undo
431 450
 function SetFillColor($r, $g=null, $b=null)
432 451
 {
433 452
 	// Set color for all filling operations
434
-	if(($r==0 && $g==0 && $b==0) || $g===null)
435
-		$this->FillColor = sprintf('%.3F g',$r/255);
436
-	else
437
-		$this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
453
+	if(($r==0 && $g==0 && $b==0) || $g===null) {
454
+			$this->FillColor = sprintf('%.3F g',$r/255);
455
+	} else {
456
+			$this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
457
+	}
438 458
 	$this->ColorFlag = ($this->FillColor!=$this->TextColor);
439
-	if($this->page>0)
440
-		$this->_out($this->FillColor);
441
-}
459
+	if($this->page>0) {
460
+			$this->_out($this->FillColor);
461
+	}
462
+	}
442 463
 
443 464
 function SetTextColor($r, $g=null, $b=null)
444 465
 {
445 466
 	// Set color for text
446
-	if(($r==0 && $g==0 && $b==0) || $g===null)
447
-		$this->TextColor = sprintf('%.3F g',$r/255);
448
-	else
449
-		$this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
467
+	if(($r==0 && $g==0 && $b==0) || $g===null) {
468
+			$this->TextColor = sprintf('%.3F g',$r/255);
469
+	} else {
470
+			$this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
471
+	}
450 472
 	$this->ColorFlag = ($this->FillColor!=$this->TextColor);
451 473
 }
452 474
 
@@ -594,20 +616,23 @@  discard block
 block discarded – undo
594 616
 	$this->FontSizePt = $size;
595 617
 	$this->FontSize = $size / $this->k;
596 618
 	$this->CurrentFont = &$this->fonts[$fontkey];
597
-	if ($this->page > 0)
598
-		$this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
599
-}
619
+	if ($this->page > 0) {
620
+			$this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
621
+	}
622
+	}
600 623
 
601 624
 function SetFontSize($size)
602 625
 {
603 626
 	// Set font size in points
604
-	if ($this->FontSizePt == $size)
605
-		return;
627
+	if ($this->FontSizePt == $size) {
628
+			return;
629
+	}
606 630
 	$this->FontSizePt = $size;
607 631
 	$this->FontSize = $size / $this->k;
608
-	if ($this->page > 0)
609
-		$this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
610
-}
632
+	if ($this->page > 0) {
633
+			$this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
634
+	}
635
+	}
611 636
 
612 637
 function AddLink()
613 638
 {
@@ -620,10 +645,12 @@  discard block
 block discarded – undo
620 645
 function SetLink($link, $y = 0, $page = -1)
621 646
 {
622 647
 	// Set destination of internal link
623
-	if ($y == -1)
624
-		$y = $this->y;
625
-	if ($page == -1)
626
-		$page = $this->page;
648
+	if ($y == -1) {
649
+			$y = $this->y;
650
+	}
651
+	if ($page == -1) {
652
+			$page = $this->page;
653
+	}
627 654
 	$this->links[$link] = array($page, $y);
628 655
 }
629 656
 
@@ -641,10 +668,12 @@  discard block
 block discarded – undo
641 668
 {
642 669
 	// Output a string
643 670
 	$s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
644
-	if ($this->underline && $txt != '')
645
-		$s .= ' '.$this->_dounderline($x, $y, $txt);
646
-	if ($this->ColorFlag)
647
-		$s = 'q '.$this->TextColor.' '.$s.' Q';
671
+	if ($this->underline && $txt != '') {
672
+			$s .= ' '.$this->_dounderline($x, $y, $txt);
673
+	}
674
+	if ($this->ColorFlag) {
675
+			$s = 'q '.$this->TextColor.' '.$s.' Q';
676
+	}
648 677
 	$this->_out($s);
649 678
 }
650 679
 
@@ -676,62 +705,75 @@  discard block
 block discarded – undo
676 705
 			$this->_out(sprintf('%.3F Tw',$ws*$k));
677 706
 		}
678 707
 	}
679
-	if($w==0)
680
-		$w = $this->w-$this->rMargin-$this->x;
708
+	if($w==0) {
709
+			$w = $this->w-$this->rMargin-$this->x;
710
+	}
681 711
 	$s = '';
682 712
 	if($fill || $border==1)
683 713
 	{
684
-		if($fill)
685
-			$op = ($border==1) ? 'B' : 'f';
686
-		else
687
-			$op = 'S';
714
+		if($fill) {
715
+					$op = ($border==1) ? 'B' : 'f';
716
+		} else {
717
+					$op = 'S';
718
+		}
688 719
 		$s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
689 720
 	}
690 721
 	if(is_string($border))
691 722
 	{
692 723
 		$x = $this->x;
693 724
 		$y = $this->y;
694
-		if(strpos($border,'L')!==false)
695
-			$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
696
-		if(strpos($border,'T')!==false)
697
-			$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
698
-		if(strpos($border,'R')!==false)
699
-			$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
700
-		if(strpos($border,'B')!==false)
701
-			$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
725
+		if(strpos($border,'L')!==false) {
726
+					$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
727
+		}
728
+		if(strpos($border,'T')!==false) {
729
+					$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
730
+		}
731
+		if(strpos($border,'R')!==false) {
732
+					$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
733
+		}
734
+		if(strpos($border,'B')!==false) {
735
+					$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
736
+		}
702 737
 	}
703 738
 	if($txt!=='')
704 739
 	{
705
-		if($align=='R')
706
-			$dx = $w-$this->cMargin-$this->GetStringWidth($txt);
707
-		elseif($align=='C')
708
-			$dx = ($w-$this->GetStringWidth($txt))/2;
709
-		else
710
-			$dx = $this->cMargin;
711
-		if($this->ColorFlag)
712
-			$s .= 'q '.$this->TextColor.' ';
740
+		if($align=='R') {
741
+					$dx = $w-$this->cMargin-$this->GetStringWidth($txt);
742
+		} elseif($align=='C') {
743
+					$dx = ($w-$this->GetStringWidth($txt))/2;
744
+		} else {
745
+					$dx = $this->cMargin;
746
+		}
747
+		if($this->ColorFlag) {
748
+					$s .= 'q '.$this->TextColor.' ';
749
+		}
713 750
 		$txt2 = str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
714 751
 		$s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
715
-		if($this->underline)
716
-			$s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
717
-		if($this->ColorFlag)
718
-			$s .= ' Q';
719
-		if($link)
720
-			$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
752
+		if($this->underline) {
753
+					$s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
754
+		}
755
+		if($this->ColorFlag) {
756
+					$s .= ' Q';
757
+		}
758
+		if($link) {
759
+					$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
760
+		}
721 761
 	}
722
-	if($s)
723
-		$this->_out($s);
762
+	if($s) {
763
+			$this->_out($s);
764
+	}
724 765
 	$this->lasth = $h;
725 766
 	if($ln>0)
726 767
 	{
727 768
 		// Go to next line
728 769
 		$this->y += $h;
729
-		if($ln==1)
730
-			$this->x = $this->lMargin;
770
+		if($ln==1) {
771
+					$this->x = $this->lMargin;
772
+		}
773
+	} else {
774
+			$this->x += $w;
775
+	}
731 776
 	}
732
-	else
733
-		$this->x += $w;
734
-}
735 777
 
736 778
 /**
737 779
  * @param integer $w
@@ -741,13 +783,15 @@  discard block
 block discarded – undo
741 783
 {
742 784
 	// Output text with automatic or explicit line breaks
743 785
 	$cw = &$this->CurrentFont['cw'];
744
-	if($w==0)
745
-		$w = $this->w-$this->rMargin-$this->x;
786
+	if($w==0) {
787
+			$w = $this->w-$this->rMargin-$this->x;
788
+	}
746 789
 	$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
747 790
 	$s = str_replace("\r",'',$txt);
748 791
 	$nb = strlen($s);
749
-	if($nb>0 && $s[$nb-1]=="\n")
750
-		$nb--;
792
+	if($nb>0 && $s[$nb-1]=="\n") {
793
+			$nb--;
794
+	}
751 795
 	$b = 0;
752 796
 	if($border)
753 797
 	{
@@ -756,14 +800,15 @@  discard block
 block discarded – undo
756 800
 			$border = 'LTRB';
757 801
 			$b = 'LRT';
758 802
 			$b2 = 'LR';
759
-		}
760
-		else
803
+		} else
761 804
 		{
762 805
 			$b2 = '';
763
-			if (strpos($border, 'L') !== false)
764
-				$b2 .= 'L';
765
-			if (strpos($border, 'R') !== false)
766
-				$b2 .= 'R';
806
+			if (strpos($border, 'L') !== false) {
807
+							$b2 .= 'L';
808
+			}
809
+			if (strpos($border, 'R') !== false) {
810
+							$b2 .= 'R';
811
+			}
767 812
 			$b = (strpos($border, 'T') !== false) ? $b2.'T' : $b2;
768 813
 		}
769 814
 	}
@@ -792,8 +837,9 @@  discard block
 block discarded – undo
792 837
 			$l = 0;
793 838
 			$ns = 0;
794 839
 			$nl++;
795
-			if ($border && $nl == 2)
796
-				$b = $b2;
840
+			if ($border && $nl == 2) {
841
+							$b = $b2;
842
+			}
797 843
 			continue;
798 844
 		}
799 845
 		if ($c == ' ')
@@ -808,16 +854,16 @@  discard block
 block discarded – undo
808 854
 			// Automatic line break
809 855
 			if ($sep == -1)
810 856
 			{
811
-				if ($i == $j)
812
-					$i++;
857
+				if ($i == $j) {
858
+									$i++;
859
+				}
813 860
 				if ($this->ws > 0)
814 861
 				{
815 862
 					$this->ws = 0;
816 863
 					$this->_out('0 Tw');
817 864
 				}
818 865
 				$this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
819
-			}
820
-			else
866
+			} else
821 867
 			{
822 868
 				if ($align == 'J')
823 869
 				{
@@ -832,11 +878,12 @@  discard block
 block discarded – undo
832 878
 			$l = 0;
833 879
 			$ns = 0;
834 880
 			$nl++;
835
-			if ($border && $nl == 2)
836
-				$b = $b2;
837
-		}
838
-		else
839
-			$i++;
881
+			if ($border && $nl == 2) {
882
+							$b = $b2;
883
+			}
884
+		} else {
885
+					$i++;
886
+		}
840 887
 	}
841 888
 	// Last chunk
842 889
 	if ($this->ws > 0)
@@ -844,8 +891,9 @@  discard block
 block discarded – undo
844 891
 		$this->ws = 0;
845 892
 		$this->_out('0 Tw');
846 893
 	}
847
-	if ($border && strpos($border, 'B') !== false)
848
-		$b .= 'B';
894
+	if ($border && strpos($border, 'B') !== false) {
895
+			$b .= 'B';
896
+	}
849 897
 	$this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
850 898
 	$this->x = $this->lMargin;
851 899
 }
@@ -884,8 +932,9 @@  discard block
 block discarded – undo
884 932
 			$nl++;
885 933
 			continue;
886 934
 		}
887
-		if ($c == ' ')
888
-			$sep = $i;
935
+		if ($c == ' ') {
936
+					$sep = $i;
937
+		}
889 938
 		$l += $cw[$c];
890 939
 		if ($l > $wmax)
891 940
 		{
@@ -903,11 +952,11 @@  discard block
 block discarded – undo
903 952
 					$nl++;
904 953
 					continue;
905 954
 				}
906
-				if ($i == $j)
907
-					$i++;
955
+				if ($i == $j) {
956
+									$i++;
957
+				}
908 958
 				$this->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
909
-			}
910
-			else
959
+			} else
911 960
 			{
912 961
 				$this->Cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link);
913 962
 				$i = $sep + 1;
@@ -922,24 +971,26 @@  discard block
 block discarded – undo
922 971
 				$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
923 972
 			}
924 973
 			$nl++;
925
-		}
926
-		else
927
-			$i++;
974
+		} else {
975
+					$i++;
976
+		}
928 977
 	}
929 978
 	// Last chunk
930
-	if ($i != $j)
931
-		$this->Cell($l / 1000 * $this->FontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
932
-}
979
+	if ($i != $j) {
980
+			$this->Cell($l / 1000 * $this->FontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
981
+	}
982
+	}
933 983
 
934 984
 function Ln($h = null)
935 985
 {
936 986
 	// Line feed; default value is last cell height
937 987
 	$this->x = $this->lMargin;
938
-	if ($h === null)
939
-		$this->y += $this->lasth;
940
-	else
941
-		$this->y += $h;
942
-}
988
+	if ($h === null) {
989
+			$this->y += $this->lasth;
990
+	} else {
991
+			$this->y += $h;
992
+	}
993
+	}
943 994
 
944 995
 function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '')
945 996
 {
@@ -950,22 +1001,25 @@  discard block
 block discarded – undo
950 1001
 		if ($type == '')
951 1002
 		{
952 1003
 			$pos = strrpos($file, '.');
953
-			if ( ! $pos)
954
-				$this->Error('Image file has no extension and no type was specified: '.$file);
1004
+			if ( ! $pos) {
1005
+							$this->Error('Image file has no extension and no type was specified: '.$file);
1006
+			}
955 1007
 			$type = substr($file, $pos + 1);
956 1008
 		}
957 1009
 		$type = strtolower($type);
958
-		if ($type == 'jpeg')
959
-			$type = 'jpg';
1010
+		if ($type == 'jpeg') {
1011
+					$type = 'jpg';
1012
+		}
960 1013
 		$mtd = '_parse'.$type;
961
-		if ( ! method_exists($this, $mtd))
962
-			$this->Error('Unsupported image type: '.$type);
1014
+		if ( ! method_exists($this, $mtd)) {
1015
+					$this->Error('Unsupported image type: '.$type);
1016
+		}
963 1017
 		$info = $this->$mtd($file);
964 1018
 		$info['i'] = count($this->images) + 1;
965 1019
 		$this->images[$file] = $info;
966
-	}
967
-	else
968
-		$info = $this->images[$file];
1020
+	} else {
1021
+			$info = $this->images[$file];
1022
+	}
969 1023
 
970 1024
 	// Automatic width and height calculation if needed
971 1025
 	if ($w == 0 && $h == 0)
@@ -974,14 +1028,18 @@  discard block
 block discarded – undo
974 1028
 		$w = -96;
975 1029
 		$h = -96;
976 1030
 	}
977
-	if ($w < 0)
978
-		$w = -$info['w'] * 72 / $w / $this->k;
979
-	if ($h < 0)
980
-		$h = -$info['h'] * 72 / $h / $this->k;
981
-	if ($w == 0)
982
-		$w = $h * $info['w'] / $info['h'];
983
-	if ($h == 0)
984
-		$h = $w * $info['h'] / $info['w'];
1031
+	if ($w < 0) {
1032
+			$w = -$info['w'] * 72 / $w / $this->k;
1033
+	}
1034
+	if ($h < 0) {
1035
+			$h = -$info['h'] * 72 / $h / $this->k;
1036
+	}
1037
+	if ($w == 0) {
1038
+			$w = $h * $info['w'] / $info['h'];
1039
+	}
1040
+	if ($h == 0) {
1041
+			$h = $w * $info['h'] / $info['w'];
1042
+	}
985 1043
 
986 1044
 	// Flowing mode
987 1045
 	if ($y === null)
@@ -997,12 +1055,14 @@  discard block
 block discarded – undo
997 1055
 		$this->y += $h;
998 1056
 	}
999 1057
 
1000
-	if ($x === null)
1001
-		$x = $this->x;
1058
+	if ($x === null) {
1059
+			$x = $this->x;
1060
+	}
1002 1061
 	$this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', $w * $this->k, $h * $this->k, $x * $this->k, ($this->h - ($y + $h)) * $this->k, $info['i']));
1003
-	if ($link)
1004
-		$this->Link($x, $y, $w, $h, $link);
1005
-}
1062
+	if ($link) {
1063
+			$this->Link($x, $y, $w, $h, $link);
1064
+	}
1065
+	}
1006 1066
 
1007 1067
 function GetX()
1008 1068
 {
@@ -1013,11 +1073,12 @@  discard block
 block discarded – undo
1013 1073
 function SetX($x)
1014 1074
 {
1015 1075
 	// Set x position
1016
-	if ($x >= 0)
1017
-		$this->x = $x;
1018
-	else
1019
-		$this->x = $this->w + $x;
1020
-}
1076
+	if ($x >= 0) {
1077
+			$this->x = $x;
1078
+	} else {
1079
+			$this->x = $this->w + $x;
1080
+	}
1081
+	}
1021 1082
 
1022 1083
 function GetY()
1023 1084
 {
@@ -1029,11 +1090,12 @@  discard block
 block discarded – undo
1029 1090
 {
1030 1091
 	// Set y position and reset x
1031 1092
 	$this->x = $this->lMargin;
1032
-	if ($y >= 0)
1033
-		$this->y = $y;
1034
-	else
1035
-		$this->y = $this->h + $y;
1036
-}
1093
+	if ($y >= 0) {
1094
+			$this->y = $y;
1095
+	} else {
1096
+			$this->y = $this->h + $y;
1097
+	}
1098
+	}
1037 1099
 
1038 1100
 /**
1039 1101
  * @param integer $x
@@ -1048,8 +1110,9 @@  discard block
 block discarded – undo
1048 1110
 function Output($name = '', $dest = '')
1049 1111
 {
1050 1112
 	// Output PDF to some destination
1051
-	if ($this->state < 3)
1052
-		$this->Close();
1113
+	if ($this->state < 3) {
1114
+			$this->Close();
1115
+	}
1053 1116
 	$dest = strtoupper($dest);
1054 1117
 	if ($dest == '')
1055 1118
 	{
@@ -1089,8 +1152,9 @@  discard block
 block discarded – undo
1089 1152
 		case 'F':
1090 1153
 			// Save to local file
1091 1154
 			$f = fopen($name, 'wb');
1092
-			if ( ! $f)
1093
-				$this->Error('Unable to create output file: '.$name);
1155
+			if ( ! $f) {
1156
+							$this->Error('Unable to create output file: '.$name);
1157
+			}
1094 1158
 			fwrite($f, $this->buffer, strlen($this->buffer));
1095 1159
 			fclose($f);
1096 1160
 			break;
@@ -1111,22 +1175,26 @@  discard block
 block discarded – undo
1111 1175
 function _dochecks()
1112 1176
 {
1113 1177
 	// Check availability of %F
1114
-	if (sprintf('%.1F', 1.0) != '1.0')
1115
-		$this->Error('This version of PHP is not supported');
1178
+	if (sprintf('%.1F', 1.0) != '1.0') {
1179
+			$this->Error('This version of PHP is not supported');
1180
+	}
1116 1181
 	// Check mbstring overloading
1117
-	if (ini_get('mbstring.func_overload') & 2)
1118
-		$this->Error('mbstring overloading must be disabled');
1182
+	if (ini_get('mbstring.func_overload') & 2) {
1183
+			$this->Error('mbstring overloading must be disabled');
1184
+	}
1119 1185
 	// Ensure runtime magic quotes are disabled
1120
-	if (get_magic_quotes_runtime())
1121
-		@set_magic_quotes_runtime(0);
1122
-}
1186
+	if (get_magic_quotes_runtime()) {
1187
+			@set_magic_quotes_runtime(0);
1188
+	}
1189
+	}
1123 1190
 
1124 1191
 function _checkoutput()
1125 1192
 {
1126 1193
 	if (PHP_SAPI != 'cli')
1127 1194
 	{
1128
-		if (headers_sent($file, $line))
1129
-			$this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
1195
+		if (headers_sent($file, $line)) {
1196
+					$this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
1197
+		}
1130 1198
 	}
1131 1199
 	if (ob_get_length())
1132 1200
 	{
@@ -1146,17 +1214,18 @@  discard block
 block discarded – undo
1146 1214
 	if (is_string($size))
1147 1215
 	{
1148 1216
 		$size = strtolower($size);
1149
-		if ( ! isset($this->StdPageSizes[$size]))
1150
-			$this->Error('Unknown page size: '.$size);
1217
+		if ( ! isset($this->StdPageSizes[$size])) {
1218
+					$this->Error('Unknown page size: '.$size);
1219
+		}
1151 1220
 		$a = $this->StdPageSizes[$size];
1152 1221
 		return array($a[0] / $this->k, $a[1] / $this->k);
1153
-	}
1154
-	else
1222
+	} else
1155 1223
 	{
1156
-		if ($size[0] > $size[1])
1157
-			return array($size[1], $size[0]);
1158
-		else
1159
-			return $size;
1224
+		if ($size[0] > $size[1]) {
1225
+					return array($size[1], $size[0]);
1226
+		} else {
1227
+					return $size;
1228
+		}
1160 1229
 	}
1161 1230
 }
1162 1231
 
@@ -1173,14 +1242,16 @@  discard block
 block discarded – undo
1173 1242
 	$this->y = $this->tMargin;
1174 1243
 	$this->FontFamily = '';
1175 1244
 	// Check page size and orientation
1176
-	if ($orientation == '')
1177
-		$orientation = $this->DefOrientation;
1178
-	else
1179
-		$orientation = strtoupper($orientation[0]);
1180
-	if ($size == '')
1181
-		$size = $this->DefPageSize;
1182
-	else
1183
-		$size = $this->_getpagesize($size);
1245
+	if ($orientation == '') {
1246
+			$orientation = $this->DefOrientation;
1247
+	} else {
1248
+			$orientation = strtoupper($orientation[0]);
1249
+	}
1250
+	if ($size == '') {
1251
+			$size = $this->DefPageSize;
1252
+	} else {
1253
+			$size = $this->_getpagesize($size);
1254
+	}
1184 1255
 	if ($orientation != $this->CurOrientation || $size[0] != $this->CurPageSize[0] || $size[1] != $this->CurPageSize[1])
1185 1256
 	{
1186 1257
 		// New size or orientation
@@ -1199,9 +1270,10 @@  discard block
 block discarded – undo
1199 1270
 		$this->CurOrientation = $orientation;
1200 1271
 		$this->CurPageSize = $size;
1201 1272
 	}
1202
-	if ($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1])
1203
-		$this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
1204
-}
1273
+	if ($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1]) {
1274
+			$this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
1275
+	}
1276
+	}
1205 1277
 
1206 1278
 function _endpage()
1207 1279
 {
@@ -1216,8 +1288,9 @@  discard block
 block discarded – undo
1216 1288
 	// Load a font definition file from the font directory
1217 1289
 	include($this->fontpath.$font);
1218 1290
 	$a = get_defined_vars();
1219
-	if ( ! isset($a['name']))
1220
-		$this->Error('Could not include font definition file');
1291
+	if ( ! isset($a['name'])) {
1292
+			$this->Error('Could not include font definition file');
1293
+	}
1221 1294
 	return $a;
1222 1295
 }
1223 1296
 
@@ -1253,15 +1326,13 @@  discard block
 block discarded – undo
1253 1326
 			$c3 = ord($s[$i++]);
1254 1327
 			$res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2));
1255 1328
 			$res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F));
1256
-		}
1257
-		elseif ($c1 >= 192)
1329
+		} elseif ($c1 >= 192)
1258 1330
 		{
1259 1331
 			// 2-byte character
1260 1332
 			$c2 = ord($s[$i++]);
1261 1333
 			$res .= chr(($c1 & 0x1C) >> 2);
1262 1334
 			$res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F));
1263
-		}
1264
-		else
1335
+		} else
1265 1336
 		{
1266 1337
 			// Single-byte character
1267 1338
 			$res .= "\0".chr($c1);
@@ -1283,16 +1354,19 @@  discard block
 block discarded – undo
1283 1354
 {
1284 1355
 	// Extract info from a JPEG file
1285 1356
 	$a = getimagesize($file);
1286
-	if ( ! $a)
1287
-		$this->Error('Missing or incorrect image file: '.$file);
1288
-	if ($a[2] != 2)
1289
-		$this->Error('Not a JPEG file: '.$file);
1290
-	if ( ! isset($a['channels']) || $a['channels'] == 3)
1291
-		$colspace = 'DeviceRGB';
1292
-	elseif ($a['channels'] == 4)
1293
-		$colspace = 'DeviceCMYK';
1294
-	else
1295
-		$colspace = 'DeviceGray';
1357
+	if ( ! $a) {
1358
+			$this->Error('Missing or incorrect image file: '.$file);
1359
+	}
1360
+	if ($a[2] != 2) {
1361
+			$this->Error('Not a JPEG file: '.$file);
1362
+	}
1363
+	if ( ! isset($a['channels']) || $a['channels'] == 3) {
1364
+			$colspace = 'DeviceRGB';
1365
+	} elseif ($a['channels'] == 4) {
1366
+			$colspace = 'DeviceCMYK';
1367
+	} else {
1368
+			$colspace = 'DeviceGray';
1369
+	}
1296 1370
 	$bpc = isset($a['bits']) ? $a['bits'] : 8;
1297 1371
 	$data = file_get_contents($file);
1298 1372
 	return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
@@ -1305,8 +1379,9 @@  discard block
 block discarded – undo
1305 1379
 {
1306 1380
 	// Extract info from a PNG file
1307 1381
 	$f = fopen($file, 'rb');
1308
-	if ( ! $f)
1309
-		$this->Error('Can\'t open image file: '.$file);
1382
+	if ( ! $f) {
1383
+			$this->Error('Can\'t open image file: '.$file);
1384
+	}
1310 1385
 	$info = $this->_parsepngstream($f, $file);
1311 1386
 	fclose($f);
1312 1387
 	return $info;
@@ -1315,33 +1390,40 @@  discard block
 block discarded – undo
1315 1390
 function _parsepngstream($f, $file)
1316 1391
 {
1317 1392
 	// Check signature
1318
-	if ($this->_readstream($f, 8) != chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
1319
-		$this->Error('Not a PNG file: '.$file);
1393
+	if ($this->_readstream($f, 8) != chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) {
1394
+			$this->Error('Not a PNG file: '.$file);
1395
+	}
1320 1396
 
1321 1397
 	// Read header chunk
1322 1398
 	$this->_readstream($f, 4);
1323
-	if ($this->_readstream($f, 4) != 'IHDR')
1324
-		$this->Error('Incorrect PNG file: '.$file);
1399
+	if ($this->_readstream($f, 4) != 'IHDR') {
1400
+			$this->Error('Incorrect PNG file: '.$file);
1401
+	}
1325 1402
 	$w = $this->_readint($f);
1326 1403
 	$h = $this->_readint($f);
1327 1404
 	$bpc = ord($this->_readstream($f, 1));
1328
-	if ($bpc > 8)
1329
-		$this->Error('16-bit depth not supported: '.$file);
1405
+	if ($bpc > 8) {
1406
+			$this->Error('16-bit depth not supported: '.$file);
1407
+	}
1330 1408
 	$ct = ord($this->_readstream($f, 1));
1331
-	if ($ct == 0 || $ct == 4)
1332
-		$colspace = 'DeviceGray';
1333
-	elseif ($ct == 2 || $ct == 6)
1334
-		$colspace = 'DeviceRGB';
1335
-	elseif ($ct == 3)
1336
-		$colspace = 'Indexed';
1337
-	else
1338
-		$this->Error('Unknown color type: '.$file);
1339
-	if (ord($this->_readstream($f, 1)) != 0)
1340
-		$this->Error('Unknown compression method: '.$file);
1341
-	if (ord($this->_readstream($f, 1)) != 0)
1342
-		$this->Error('Unknown filter method: '.$file);
1343
-	if (ord($this->_readstream($f, 1)) != 0)
1344
-		$this->Error('Interlacing not supported: '.$file);
1409
+	if ($ct == 0 || $ct == 4) {
1410
+			$colspace = 'DeviceGray';
1411
+	} elseif ($ct == 2 || $ct == 6) {
1412
+			$colspace = 'DeviceRGB';
1413
+	} elseif ($ct == 3) {
1414
+			$colspace = 'Indexed';
1415
+	} else {
1416
+			$this->Error('Unknown color type: '.$file);
1417
+	}
1418
+	if (ord($this->_readstream($f, 1)) != 0) {
1419
+			$this->Error('Unknown compression method: '.$file);
1420
+	}
1421
+	if (ord($this->_readstream($f, 1)) != 0) {
1422
+			$this->Error('Unknown filter method: '.$file);
1423
+	}
1424
+	if (ord($this->_readstream($f, 1)) != 0) {
1425
+			$this->Error('Interlacing not supported: '.$file);
1426
+	}
1345 1427
 	$this->_readstream($f, 4);
1346 1428
 	$dp = '/Predictor 15 /Colors '.($colspace == 'DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w;
1347 1429
 
@@ -1358,44 +1440,45 @@  discard block
 block discarded – undo
1358 1440
 			// Read palette
1359 1441
 			$pal = $this->_readstream($f, $n);
1360 1442
 			$this->_readstream($f, 4);
1361
-		}
1362
-		elseif ($type == 'tRNS')
1443
+		} elseif ($type == 'tRNS')
1363 1444
 		{
1364 1445
 			// Read transparency info
1365 1446
 			$t = $this->_readstream($f, $n);
1366
-			if ($ct == 0)
1367
-				$trns = array(ord(substr($t, 1, 1)));
1368
-			elseif ($ct == 2)
1369
-				$trns = array(ord(substr($t, 1, 1)), ord(substr($t, 3, 1)), ord(substr($t, 5, 1)));
1370
-			else
1447
+			if ($ct == 0) {
1448
+							$trns = array(ord(substr($t, 1, 1)));
1449
+			} elseif ($ct == 2) {
1450
+							$trns = array(ord(substr($t, 1, 1)), ord(substr($t, 3, 1)), ord(substr($t, 5, 1)));
1451
+			} else
1371 1452
 			{
1372 1453
 				$pos = strpos($t, chr(0));
1373
-				if ($pos !== false)
1374
-					$trns = array($pos);
1454
+				if ($pos !== false) {
1455
+									$trns = array($pos);
1456
+				}
1375 1457
 			}
1376 1458
 			$this->_readstream($f, 4);
1377
-		}
1378
-		elseif ($type == 'IDAT')
1459
+		} elseif ($type == 'IDAT')
1379 1460
 		{
1380 1461
 			// Read image data block
1381 1462
 			$data .= $this->_readstream($f, $n);
1382 1463
 			$this->_readstream($f, 4);
1383
-		}
1384
-		elseif ($type == 'IEND')
1385
-			break;
1386
-		else
1387
-			$this->_readstream($f, $n + 4);
1464
+		} elseif ($type == 'IEND') {
1465
+					break;
1466
+		} else {
1467
+					$this->_readstream($f, $n + 4);
1468
+		}
1388 1469
 	}
1389 1470
 	while ($n);
1390 1471
 
1391
-	if ($colspace == 'Indexed' && empty($pal))
1392
-		$this->Error('Missing palette in '.$file);
1472
+	if ($colspace == 'Indexed' && empty($pal)) {
1473
+			$this->Error('Missing palette in '.$file);
1474
+	}
1393 1475
 	$info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
1394 1476
 	if ($ct >= 4)
1395 1477
 	{
1396 1478
 		// Extract alpha channel
1397
-		if ( ! function_exists('gzuncompress'))
1398
-			$this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
1479
+		if ( ! function_exists('gzuncompress')) {
1480
+					$this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
1481
+		}
1399 1482
 		$data = gzuncompress($data);
1400 1483
 		$color = '';
1401 1484
 		$alpha = '';
@@ -1429,8 +1512,9 @@  discard block
 block discarded – undo
1429 1512
 		unset($data);
1430 1513
 		$data = gzcompress($color);
1431 1514
 		$info['smask'] = gzcompress($alpha);
1432
-		if ($this->PDFVersion < '1.4')
1433
-			$this->PDFVersion = '1.4';
1515
+		if ($this->PDFVersion < '1.4') {
1516
+					$this->PDFVersion = '1.4';
1517
+		}
1434 1518
 	}
1435 1519
 	$info['data'] = $data;
1436 1520
 	return $info;
@@ -1443,13 +1527,15 @@  discard block
 block discarded – undo
1443 1527
 	while ($n > 0 && ! feof($f))
1444 1528
 	{
1445 1529
 		$s = fread($f, $n);
1446
-		if ($s === false)
1447
-			$this->Error('Error while reading stream');
1530
+		if ($s === false) {
1531
+					$this->Error('Error while reading stream');
1532
+		}
1448 1533
 		$n -= strlen($s);
1449 1534
 		$res .= $s;
1450 1535
 	}
1451
-	if ($n > 0)
1452
-		$this->Error('Unexpected end of stream');
1536
+	if ($n > 0) {
1537
+			$this->Error('Unexpected end of stream');
1538
+	}
1453 1539
 	return $res;
1454 1540
 }
1455 1541
 
@@ -1463,13 +1549,16 @@  discard block
 block discarded – undo
1463 1549
 function _parsegif($file)
1464 1550
 {
1465 1551
 	// Extract info from a GIF file (via PNG conversion)
1466
-	if ( ! function_exists('imagepng'))
1467
-		$this->Error('GD extension is required for GIF support');
1468
-	if ( ! function_exists('imagecreatefromgif'))
1469
-		$this->Error('GD has no GIF read support');
1552
+	if ( ! function_exists('imagepng')) {
1553
+			$this->Error('GD extension is required for GIF support');
1554
+	}
1555
+	if ( ! function_exists('imagecreatefromgif')) {
1556
+			$this->Error('GD has no GIF read support');
1557
+	}
1470 1558
 	$im = imagecreatefromgif($file);
1471
-	if ( ! $im)
1472
-		$this->Error('Missing or incorrect image file: '.$file);
1559
+	if ( ! $im) {
1560
+			$this->Error('Missing or incorrect image file: '.$file);
1561
+	}
1473 1562
 	imageinterlace($im, 0);
1474 1563
 	$f = @fopen('php://temp', 'rb+');
1475 1564
 	if ($f)
@@ -1483,15 +1572,16 @@  discard block
 block discarded – undo
1483 1572
 		rewind($f);
1484 1573
 		$info = $this->_parsepngstream($f, $file);
1485 1574
 		fclose($f);
1486
-	}
1487
-	else
1575
+	} else
1488 1576
 	{
1489 1577
 		// Use temporary file
1490 1578
 		$tmp = tempnam('.', 'gif');
1491
-		if ( ! $tmp)
1492
-			$this->Error('Unable to create a temporary file');
1493
-		if ( ! imagepng($im, $tmp))
1494
-			$this->Error('Error while saving to temporary file');
1579
+		if ( ! $tmp) {
1580
+					$this->Error('Unable to create a temporary file');
1581
+		}
1582
+		if ( ! imagepng($im, $tmp)) {
1583
+					$this->Error('Error while saving to temporary file');
1584
+		}
1495 1585
 		imagedestroy($im);
1496 1586
 		$info = $this->_parsepng($tmp);
1497 1587
 		unlink($tmp);
@@ -1517,11 +1607,12 @@  discard block
 block discarded – undo
1517 1607
 function _out($s)
1518 1608
 {
1519 1609
 	// Add a line to the document
1520
-	if ($this->state == 2)
1521
-		$this->pages[$this->page] .= $s."\n";
1522
-	else
1523
-		$this->buffer .= $s."\n";
1524
-}
1610
+	if ($this->state == 2) {
1611
+			$this->pages[$this->page] .= $s."\n";
1612
+	} else {
1613
+			$this->buffer .= $s."\n";
1614
+	}
1615
+	}
1525 1616
 
1526 1617
 function _putpages()
1527 1618
 {
@@ -1529,15 +1620,15 @@  discard block
 block discarded – undo
1529 1620
 	if ( ! empty($this->AliasNbPages))
1530 1621
 	{
1531 1622
 		// Replace number of pages
1532
-		for ($n = 1; $n <= $nb; $n++)
1533
-			$this->pages[$n] = str_replace($this->AliasNbPages, $nb, $this->pages[$n]);
1623
+		for ($n = 1; $n <= $nb; $n++) {
1624
+					$this->pages[$n] = str_replace($this->AliasNbPages, $nb, $this->pages[$n]);
1625
+		}
1534 1626
 	}
1535 1627
 	if ($this->DefOrientation == 'P')
1536 1628
 	{
1537 1629
 		$wPt = $this->DefPageSize[0] * $this->k;
1538 1630
 		$hPt = $this->DefPageSize[1] * $this->k;
1539
-	}
1540
-	else
1631
+	} else
1541 1632
 	{
1542 1633
 		$wPt = $this->DefPageSize[1] * $this->k;
1543 1634
 		$hPt = $this->DefPageSize[0] * $this->k;
@@ -1549,8 +1640,9 @@  discard block
 block discarded – undo
1549 1640
 		$this->_newobj();
1550 1641
 		$this->_out('<</Type /Page');
1551 1642
 		$this->_out('/Parent 1 0 R');
1552
-		if (isset($this->PageSizes[$n]))
1553
-			$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $this->PageSizes[$n][0], $this->PageSizes[$n][1]));
1643
+		if (isset($this->PageSizes[$n])) {
1644
+					$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $this->PageSizes[$n][0], $this->PageSizes[$n][1]));
1645
+		}
1554 1646
 		$this->_out('/Resources 2 0 R');
1555 1647
 		if (isset($this->PageLinks[$n]))
1556 1648
 		{
@@ -1560,9 +1652,9 @@  discard block
 block discarded – undo
1560 1652
 			{
1561 1653
 				$rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
1562 1654
 				$annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1563
-				if (is_string($pl[4]))
1564
-					$annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
1565
-				else
1655
+				if (is_string($pl[4])) {
1656
+									$annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
1657
+				} else
1566 1658
 				{
1567 1659
 					$l = $this->links[$pl[4]];
1568 1660
 					$h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
@@ -1571,8 +1663,9 @@  discard block
 block discarded – undo
1571 1663
 			}
1572 1664
 			$this->_out($annots.']');
1573 1665
 		}
1574
-		if ($this->PDFVersion > '1.3')
1575
-			$this->_out('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
1666
+		if ($this->PDFVersion > '1.3') {
1667
+					$this->_out('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
1668
+		}
1576 1669
 		$this->_out('/Contents '.($this->n + 1).' 0 R>>');
1577 1670
 		$this->_out('endobj');
1578 1671
 		// Page content
@@ -1587,8 +1680,9 @@  discard block
 block discarded – undo
1587 1680
 	$this->_out('1 0 obj');
1588 1681
 	$this->_out('<</Type /Pages');
1589 1682
 	$kids = '/Kids [';
1590
-	for ($i = 0; $i < $nb; $i++)
1591
-		$kids .= (3 + 2 * $i).' 0 R ';
1683
+	for ($i = 0; $i < $nb; $i++) {
1684
+			$kids .= (3 + 2 * $i).' 0 R ';
1685
+	}
1592 1686
 	$this->_out($kids.']');
1593 1687
 	$this->_out('/Count '.$nb);
1594 1688
 	$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt));
@@ -1612,17 +1706,21 @@  discard block
 block discarded – undo
1612 1706
 		$this->_newobj();
1613 1707
 		$this->FontFiles[$file]['n'] = $this->n;
1614 1708
 		$font = file_get_contents($this->fontpath.$file, true);
1615
-		if ( ! $font)
1616
-			$this->Error('Font file not found: '.$file);
1709
+		if ( ! $font) {
1710
+					$this->Error('Font file not found: '.$file);
1711
+		}
1617 1712
 		$compressed = (substr($file, -2) == '.z');
1618
-		if ( ! $compressed && isset($info['length2']))
1619
-			$font = substr($font, 6, $info['length1']).substr($font, 6 + $info['length1'] + 6, $info['length2']);
1713
+		if ( ! $compressed && isset($info['length2'])) {
1714
+					$font = substr($font, 6, $info['length1']).substr($font, 6 + $info['length1'] + 6, $info['length2']);
1715
+		}
1620 1716
 		$this->_out('<</Length '.strlen($font));
1621
-		if ($compressed)
1622
-			$this->_out('/Filter /FlateDecode');
1717
+		if ($compressed) {
1718
+					$this->_out('/Filter /FlateDecode');
1719
+		}
1623 1720
 		$this->_out('/Length1 '.$info['length1']);
1624
-		if (isset($info['length2']))
1625
-			$this->_out('/Length2 '.$info['length2'].' /Length3 0');
1721
+		if (isset($info['length2'])) {
1722
+					$this->_out('/Length2 '.$info['length2'].' /Length3 0');
1723
+		}
1626 1724
 		$this->_out('>>');
1627 1725
 		$this->_putstream($font);
1628 1726
 		$this->_out('endobj');
@@ -1640,12 +1738,12 @@  discard block
 block discarded – undo
1640 1738
 			$this->_out('<</Type /Font');
1641 1739
 			$this->_out('/BaseFont /'.$name);
1642 1740
 			$this->_out('/Subtype /Type1');
1643
-			if ($name != 'Symbol' && $name != 'ZapfDingbats')
1644
-				$this->_out('/Encoding /WinAnsiEncoding');
1741
+			if ($name != 'Symbol' && $name != 'ZapfDingbats') {
1742
+							$this->_out('/Encoding /WinAnsiEncoding');
1743
+			}
1645 1744
 			$this->_out('>>');
1646 1745
 			$this->_out('endobj');
1647
-		}
1648
-		elseif ($type == 'Type1' || $type == 'TrueType')
1746
+		} elseif ($type == 'Type1' || $type == 'TrueType')
1649 1747
 		{
1650 1748
 			// Additional Type1 or TrueType/OpenType font
1651 1749
 			$this->_newobj();
@@ -1655,36 +1753,40 @@  discard block
 block discarded – undo
1655 1753
 			$this->_out('/FirstChar 32 /LastChar 255');
1656 1754
 			$this->_out('/Widths '.($this->n + 1).' 0 R');
1657 1755
 			$this->_out('/FontDescriptor '.($this->n + 2).' 0 R');
1658
-			if (isset($font['diffn']))
1659
-				$this->_out('/Encoding '.($nf + $font['diffn']).' 0 R');
1660
-			else
1661
-				$this->_out('/Encoding /WinAnsiEncoding');
1756
+			if (isset($font['diffn'])) {
1757
+							$this->_out('/Encoding '.($nf + $font['diffn']).' 0 R');
1758
+			} else {
1759
+							$this->_out('/Encoding /WinAnsiEncoding');
1760
+			}
1662 1761
 			$this->_out('>>');
1663 1762
 			$this->_out('endobj');
1664 1763
 			// Widths
1665 1764
 			$this->_newobj();
1666 1765
 			$cw = &$font['cw'];
1667 1766
 			$s = '[';
1668
-			for ($i = 32; $i <= 255; $i++)
1669
-				$s .= $cw[chr($i)].' ';
1767
+			for ($i = 32; $i <= 255; $i++) {
1768
+							$s .= $cw[chr($i)].' ';
1769
+			}
1670 1770
 			$this->_out($s.']');
1671 1771
 			$this->_out('endobj');
1672 1772
 			// Descriptor
1673 1773
 			$this->_newobj();
1674 1774
 			$s = '<</Type /FontDescriptor /FontName /'.$name;
1675
-			foreach ($font['desc'] as $k=>$v)
1676
-				$s .= ' /'.$k.' '.$v;
1677
-			if ( ! empty($font['file']))
1678
-				$s .= ' /FontFile'.($type == 'Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R';
1775
+			foreach ($font['desc'] as $k=>$v) {
1776
+							$s .= ' /'.$k.' '.$v;
1777
+			}
1778
+			if ( ! empty($font['file'])) {
1779
+							$s .= ' /FontFile'.($type == 'Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R';
1780
+			}
1679 1781
 			$this->_out($s.'>>');
1680 1782
 			$this->_out('endobj');
1681
-		}
1682
-		else
1783
+		} else
1683 1784
 		{
1684 1785
 			// Allow for additional types
1685 1786
 			$mtd = '_put'.strtolower($type);
1686
-			if ( ! method_exists($this, $mtd))
1687
-				$this->Error('Unsupported font type: '.$type);
1787
+			if ( ! method_exists($this, $mtd)) {
1788
+							$this->Error('Unsupported font type: '.$type);
1789
+			}
1688 1790
 			$this->$mtd($font);
1689 1791
 		}
1690 1792
 	}
@@ -1708,28 +1810,33 @@  discard block
 block discarded – undo
1708 1810
 	$this->_out('/Subtype /Image');
1709 1811
 	$this->_out('/Width '.$info['w']);
1710 1812
 	$this->_out('/Height '.$info['h']);
1711
-	if ($info['cs'] == 'Indexed')
1712
-		$this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal']) / 3 - 1).' '.($this->n + 1).' 0 R]');
1713
-	else
1813
+	if ($info['cs'] == 'Indexed') {
1814
+			$this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal']) / 3 - 1).' '.($this->n + 1).' 0 R]');
1815
+	} else
1714 1816
 	{
1715 1817
 		$this->_out('/ColorSpace /'.$info['cs']);
1716
-		if ($info['cs'] == 'DeviceCMYK')
1717
-			$this->_out('/Decode [1 0 1 0 1 0 1 0]');
1818
+		if ($info['cs'] == 'DeviceCMYK') {
1819
+					$this->_out('/Decode [1 0 1 0 1 0 1 0]');
1820
+		}
1718 1821
 	}
1719 1822
 	$this->_out('/BitsPerComponent '.$info['bpc']);
1720
-	if (isset($info['f']))
1721
-		$this->_out('/Filter /'.$info['f']);
1722
-	if (isset($info['dp']))
1723
-		$this->_out('/DecodeParms <<'.$info['dp'].'>>');
1823
+	if (isset($info['f'])) {
1824
+			$this->_out('/Filter /'.$info['f']);
1825
+	}
1826
+	if (isset($info['dp'])) {
1827
+			$this->_out('/DecodeParms <<'.$info['dp'].'>>');
1828
+	}
1724 1829
 	if (isset($info['trns']) && is_array($info['trns']))
1725 1830
 	{
1726 1831
 		$trns = '';
1727
-		for ($i = 0; $i < count($info['trns']); $i++)
1728
-			$trns .= $info['trns'][$i].' '.$info['trns'][$i].' ';
1832
+		for ($i = 0; $i < count($info['trns']); $i++) {
1833
+					$trns .= $info['trns'][$i].' '.$info['trns'][$i].' ';
1834
+		}
1729 1835
 		$this->_out('/Mask ['.$trns.']');
1730 1836
 	}
1731
-	if (isset($info['smask']))
1732
-		$this->_out('/SMask '.($this->n + 1).' 0 R');
1837
+	if (isset($info['smask'])) {
1838
+			$this->_out('/SMask '.($this->n + 1).' 0 R');
1839
+	}
1733 1840
 	$this->_out('/Length '.strlen($info['data']).'>>');
1734 1841
 	$this->_putstream($info['data']);
1735 1842
 	$this->_out('endobj');
@@ -1754,16 +1861,18 @@  discard block
 block discarded – undo
1754 1861
 
1755 1862
 function _putxobjectdict()
1756 1863
 {
1757
-	foreach ($this->images as $image)
1758
-		$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
1759
-}
1864
+	foreach ($this->images as $image) {
1865
+			$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
1866
+	}
1867
+	}
1760 1868
 
1761 1869
 function _putresourcedict()
1762 1870
 {
1763 1871
 	$this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
1764 1872
 	$this->_out('/Font <<');
1765
-	foreach ($this->fonts as $font)
1766
-		$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
1873
+	foreach ($this->fonts as $font) {
1874
+			$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
1875
+	}
1767 1876
 	$this->_out('>>');
1768 1877
 	$this->_out('/XObject <<');
1769 1878
 	$this->_putxobjectdict();
@@ -1786,16 +1895,21 @@  discard block
 block discarded – undo
1786 1895
 function _putinfo()
1787 1896
 {
1788 1897
 	$this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
1789
-	if ( ! empty($this->title))
1790
-		$this->_out('/Title '.$this->_textstring($this->title));
1791
-	if ( ! empty($this->subject))
1792
-		$this->_out('/Subject '.$this->_textstring($this->subject));
1793
-	if ( ! empty($this->author))
1794
-		$this->_out('/Author '.$this->_textstring($this->author));
1795
-	if ( ! empty($this->keywords))
1796
-		$this->_out('/Keywords '.$this->_textstring($this->keywords));
1797
-	if ( ! empty($this->creator))
1798
-		$this->_out('/Creator '.$this->_textstring($this->creator));
1898
+	if ( ! empty($this->title)) {
1899
+			$this->_out('/Title '.$this->_textstring($this->title));
1900
+	}
1901
+	if ( ! empty($this->subject)) {
1902
+			$this->_out('/Subject '.$this->_textstring($this->subject));
1903
+	}
1904
+	if ( ! empty($this->author)) {
1905
+			$this->_out('/Author '.$this->_textstring($this->author));
1906
+	}
1907
+	if ( ! empty($this->keywords)) {
1908
+			$this->_out('/Keywords '.$this->_textstring($this->keywords));
1909
+	}
1910
+	if ( ! empty($this->creator)) {
1911
+			$this->_out('/Creator '.$this->_textstring($this->creator));
1912
+	}
1799 1913
 	$this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis')));
1800 1914
 }
1801 1915
 
@@ -1803,21 +1917,23 @@  discard block
 block discarded – undo
1803 1917
 {
1804 1918
 	$this->_out('/Type /Catalog');
1805 1919
 	$this->_out('/Pages 1 0 R');
1806
-	if ($this->ZoomMode == 'fullpage')
1807
-		$this->_out('/OpenAction [3 0 R /Fit]');
1808
-	elseif ($this->ZoomMode == 'fullwidth')
1809
-		$this->_out('/OpenAction [3 0 R /FitH null]');
1810
-	elseif ($this->ZoomMode == 'real')
1811
-		$this->_out('/OpenAction [3 0 R /XYZ null null 1]');
1812
-	elseif ( ! is_string($this->ZoomMode))
1813
-		$this->_out('/OpenAction [3 0 R /XYZ null null '.sprintf('%.2F', $this->ZoomMode / 100).']');
1814
-	if ($this->LayoutMode == 'single')
1815
-		$this->_out('/PageLayout /SinglePage');
1816
-	elseif ($this->LayoutMode == 'continuous')
1817
-		$this->_out('/PageLayout /OneColumn');
1818
-	elseif ($this->LayoutMode == 'two')
1819
-		$this->_out('/PageLayout /TwoColumnLeft');
1820
-}
1920
+	if ($this->ZoomMode == 'fullpage') {
1921
+			$this->_out('/OpenAction [3 0 R /Fit]');
1922
+	} elseif ($this->ZoomMode == 'fullwidth') {
1923
+			$this->_out('/OpenAction [3 0 R /FitH null]');
1924
+	} elseif ($this->ZoomMode == 'real') {
1925
+			$this->_out('/OpenAction [3 0 R /XYZ null null 1]');
1926
+	} elseif ( ! is_string($this->ZoomMode)) {
1927
+			$this->_out('/OpenAction [3 0 R /XYZ null null '.sprintf('%.2F', $this->ZoomMode / 100).']');
1928
+	}
1929
+	if ($this->LayoutMode == 'single') {
1930
+			$this->_out('/PageLayout /SinglePage');
1931
+	} elseif ($this->LayoutMode == 'continuous') {
1932
+			$this->_out('/PageLayout /OneColumn');
1933
+	} elseif ($this->LayoutMode == 'two') {
1934
+			$this->_out('/PageLayout /TwoColumnLeft');
1935
+	}
1936
+	}
1821 1937
 
1822 1938
 function _putheader()
1823 1939
 {
@@ -1853,8 +1969,9 @@  discard block
 block discarded – undo
1853 1969
 	$this->_out('xref');
1854 1970
 	$this->_out('0 '.($this->n + 1));
1855 1971
 	$this->_out('0000000000 65535 f ');
1856
-	for ($i = 1; $i <= $this->n; $i++)
1857
-		$this->_out(sprintf('%010d 00000 n ', $this->offsets[$i]));
1972
+	for ($i = 1; $i <= $this->n; $i++) {
1973
+			$this->_out(sprintf('%010d 00000 n ', $this->offsets[$i]));
1974
+	}
1858 1975
 	// Trailer
1859 1976
 	$this->_out('trailer');
1860 1977
 	$this->_out('<<');
Please login to merge, or discard this patch.
web_interface/astpp/system/libraries/Ftp.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -461,6 +461,7 @@
 block discarded – undo
461 461
 	 * @param	string	the file path
462 462
 	 * @param	string	the permissions
463 463
 	 * @param integer $perm
464
+	 * @param string $path
464 465
 	 * @return	bool
465 466
 	 */
466 467
 	function chmod($path, $perm)
Please login to merge, or discard this patch.