Passed
Push — 1.10.x ( f64eef...04397c )
by Angel Fernando Quiroz
132:38 queued 79:40
created
main/inc/lib/phpdocx/pdf/include/text_renderer.cls.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -74,14 +74,17 @@  discard block
 block discarded – undo
74 74
     list($x, $y) = $frame->get_position();
75 75
     $cb = $frame->get_containing_block();
76 76
 
77
-    if ( ($ml = $style->margin_left) === "auto" || $ml === "none" )
78
-      $ml = 0;
77
+    if ( ($ml = $style->margin_left) === "auto" || $ml === "none" ) {
78
+          $ml = 0;
79
+    }
79 80
 
80
-    if ( ($pl = $style->padding_left) === "auto" || $pl === "none" )
81
-      $pl = 0;
81
+    if ( ($pl = $style->padding_left) === "auto" || $pl === "none" ) {
82
+          $pl = 0;
83
+    }
82 84
 
83
-    if ( ($bl = $style->border_left_width) === "auto" || $bl === "none" )
84
-      $bl = 0;
85
+    if ( ($bl = $style->border_left_width) === "auto" || $bl === "none" ) {
86
+          $bl = 0;
87
+    }
85 88
 
86 89
     $x += $style->length_in_pt( array($ml, $pl, $bl), $cb["w"] );
87 90
 
@@ -118,15 +121,17 @@  discard block
 block discarded – undo
118 121
     // our way down.
119 122
     $p = $frame;
120 123
     $stack = array();
121
-    while ( $p = $p->get_parent() )
122
-      $stack[] = $p;
124
+    while ( $p = $p->get_parent() ) {
125
+          $stack[] = $p;
126
+    }
123 127
     
124 128
     while ( count($stack) > 0 ) {
125 129
       $f = array_pop($stack);
126 130
 
127 131
       $deco_y = $y;
128
-      if ( ($text_deco = $f->get_style()->text_decoration) === "none" )
129
-        continue;
132
+      if ( ($text_deco = $f->get_style()->text_decoration) === "none" ) {
133
+              continue;
134
+      }
130 135
 
131 136
       $color = $f->get_style()->color;
132 137
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/cpdf_adapter.cls.php 1 patch
Braces   +51 added lines, -29 removed lines patch added patch discarded remove patch
@@ -201,12 +201,13 @@  discard block
 block discarded – undo
201 201
    */
202 202
   function __construct($paper = "letter", $orientation = "portrait") {
203 203
 
204
-    if ( is_array($paper) )
205
-      $size = $paper;
206
-    else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) )
207
-      $size = self::$PAPER_SIZES[mb_strtolower($paper)];
208
-    else
209
-      $size = self::$PAPER_SIZES["letter"];
204
+    if ( is_array($paper) ) {
205
+          $size = $paper;
206
+    } else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) ) {
207
+          $size = self::$PAPER_SIZES[mb_strtolower($paper)];
208
+    } else {
209
+          $size = self::$PAPER_SIZES["letter"];
210
+    }
210 211
 
211 212
     if ( mb_strtolower($orientation) === "landscape" ) {
212 213
       $a = $size[3];
@@ -243,9 +244,12 @@  discard block
 block discarded – undo
243 244
   function __destruct() {
244 245
     foreach ($this->_image_cache as $img) {
245 246
       //debugpng
246
-      if (DEBUGPNG) print '[__destruct unlink '.$img.']';
247
-      if (!DEBUGKEEPTEMP)
248
-        unlink($img);
247
+      if (DEBUGPNG) {
248
+          print '[__destruct unlink '.$img.']';
249
+      }
250
+      if (!DEBUGKEEPTEMP) {
251
+              unlink($img);
252
+      }
249 253
     }
250 254
   }
251 255
   
@@ -559,12 +563,14 @@  discard block
 block discarded – undo
559 563
     $this->_set_line_transparency($blend, $opacity);
560 564
     $this->_set_fill_transparency($blend, $opacity);
561 565
     
562
-    if ( !$fill && isset($width) )
563
-      $this->_set_line_style($width, "square", "miter", $style);
566
+    if ( !$fill && isset($width) ) {
567
+          $this->_set_line_style($width, "square", "miter", $style);
568
+    }
564 569
     
565 570
     // Adjust y values
566
-    for ( $i = 1; $i < count($points); $i += 2)
567
-      $points[$i] = $this->y($points[$i]);
571
+    for ( $i = 1; $i < count($points); $i += 2) {
572
+          $points[$i] = $this->y($points[$i]);
573
+    }
568 574
     
569 575
     $this->_pdf->polygon($points, count($points) / 2, $fill);
570 576
   }
@@ -580,8 +586,9 @@  discard block
 block discarded – undo
580 586
     $this->_set_line_transparency($blend, $opacity);
581 587
     $this->_set_fill_transparency($blend, $opacity);
582 588
 
583
-    if ( !$fill && isset($width) )
584
-      $this->_set_line_style($width, "round", "round", $style);
589
+    if ( !$fill && isset($width) ) {
590
+          $this->_set_line_style($width, "round", "round", $style);
591
+    }
585 592
 
586 593
     $this->_pdf->ellipse($x, $this->y($y), $r1, 0, 0, 8, 0, 360, 1, $fill);
587 594
   }
@@ -590,7 +597,9 @@  discard block
 block discarded – undo
590 597
 
591 598
   function image($img_url, $img_type, $x, $y, $w, $h) {
592 599
     //debugpng
593
-    if (DEBUGPNG) print '[image:'.$img_url.'|'.$img_type.']';
600
+    if (DEBUGPNG) {
601
+        print '[image:'.$img_url.'|'.$img_type.']';
602
+    }
594 603
 
595 604
     $img_type = mb_strtolower($img_type);
596 605
 
@@ -598,14 +607,18 @@  discard block
 block discarded – undo
598 607
     case "jpeg":
599 608
     case "jpg":
600 609
       //debugpng
601
-      if (DEBUGPNG)  print '!!!jpg!!!';
610
+      if (DEBUGPNG) {
611
+          print '!!!jpg!!!';
612
+      }
602 613
 
603 614
       $this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
604 615
       break;
605 616
 
606 617
     case "png":
607 618
       //debugpng
608
-      if (DEBUGPNG)  print '!!!png!!!';
619
+      if (DEBUGPNG) {
620
+          print '!!!png!!!';
621
+      }
609 622
 
610 623
       $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
611 624
       break;
@@ -616,7 +629,9 @@  discard block
 block discarded – undo
616 629
       //if (0) {
617 630
       if ( method_exists( $this->_pdf, "addImagePng" ) ) {
618 631
         //debugpng
619
-        if (DEBUGPNG)  print '!!!gif addImagePng!!!';
632
+        if (DEBUGPNG) {
633
+            print '!!!gif addImagePng!!!';
634
+        }
620 635
 
621 636
       	//If optimization to direct png creation from gd object is available,
622 637
         //don't create temp file, but place gd object directly into the pdf
@@ -635,7 +650,9 @@  discard block
 block discarded – undo
635 650
     	$this->_pdf->addImagePng($img_url, $x, $this->y($y) - $h, $w, $h, $img);
636 651
       } else {
637 652
         //debugpng
638
-        if (DEBUGPNG)  print '!!!gif addPngFromFile!!!';
653
+        if (DEBUGPNG) {
654
+            print '!!!gif addPngFromFile!!!';
655
+        }
639 656
         $img_url = $this->_convert_gif_to_png($img_url);
640 657
         $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
641 658
       }
@@ -643,7 +660,9 @@  discard block
 block discarded – undo
643 660
 
644 661
     default:
645 662
       //debugpng
646
-      if (DEBUGPNG) print '!!!unknown!!!';
663
+      if (DEBUGPNG) {
664
+          print '!!!unknown!!!';
665
+      }
647 666
       break;
648 667
     }
649 668
     
@@ -733,8 +752,9 @@  discard block
 block discarded – undo
733 752
     if ( strpos($url, '#') === 0 ) {
734 753
       // Local link
735 754
       $name = substr($url,1);
736
-      if ( $name )
737
-        $this->_pdf->addInternalLink($name, $x, $y, $x + $width, $y + $height);
755
+      if ( $name ) {
756
+              $this->_pdf->addInternalLink($name, $x, $y, $x + $width, $y + $height);
757
+      }
738 758
 
739 759
     } else {
740 760
       $this->_pdf->addLink(rawurldecode($url), $x, $y, $x + $width, $y + $height);
@@ -819,8 +839,9 @@  discard block
 block discarded – undo
819 839
    */
820 840
   protected function _add_page_text() {
821 841
     
822
-    if ( !count($this->_page_text) )
823
-      return;
842
+    if ( !count($this->_page_text) ) {
843
+          return;
844
+    }
824 845
 
825 846
     $page_number = 1;
826 847
     $eval = null;
@@ -878,10 +899,11 @@  discard block
 block discarded – undo
878 899
     // Add page text
879 900
     $this->_add_page_text();
880 901
 
881
-    if ( isset($options["compress"]) && $options["compress"] != 1 )
882
-      $debug = 1;
883
-    else
884
-      $debug = 0;
902
+    if ( isset($options["compress"]) && $options["compress"] != 1 ) {
903
+          $debug = 1;
904
+    } else {
905
+          $debug = 0;
906
+    }
885 907
     
886 908
     return $this->_pdf->output($debug);
887 909
     
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/pdflib_adapter.cls.php 1 patch
Braces   +125 added lines, -95 removed lines patch added patch discarded remove patch
@@ -185,12 +185,13 @@  discard block
 block discarded – undo
185 185
    * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
186 186
    */
187 187
   function __construct($paper = "letter", $orientation = "portrait") {
188
-    if ( is_array($paper) )
189
-      $size = $paper;
190
-    else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) )
191
-      $size = self::$PAPER_SIZES[mb_strtolower($paper)];
192
-    else
193
-      $size = self::$PAPER_SIZES["letter"];
188
+    if ( is_array($paper) ) {
189
+          $size = $paper;
190
+    } else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) ) {
191
+          $size = self::$PAPER_SIZES[mb_strtolower($paper)];
192
+    } else {
193
+          $size = self::$PAPER_SIZES["letter"];
194
+    }
194 195
 
195 196
     if ( mb_strtolower($orientation) === "landscape" ) {
196 197
       $a = $size[3];
@@ -202,8 +203,9 @@  discard block
 block discarded – undo
202 203
 
203 204
     $this->_pdf = new PDFLib();
204 205
 
205
-	if ( defined("DOMPDF_PDFLIB_LICENSE") )
206
-      $this->_pdf->set_parameter( "license", DOMPDF_PDFLIB_LICENSE);
206
+	if ( defined("DOMPDF_PDFLIB_LICENSE") ) {
207
+	      $this->_pdf->set_parameter( "license", DOMPDF_PDFLIB_LICENSE);
208
+	}
207 209
 
208 210
 	$this->_pdf->set_parameter("textformat", "utf8");
209 211
     $this->_pdf->set_parameter("fontwarning", "false");
@@ -220,9 +222,9 @@  discard block
 block discarded – undo
220 222
       $this->_pdf->set_info("Date", date("Y-m-d"));
221 223
     }
222 224
 
223
-    if ( self::$IN_MEMORY )
224
-      $this->_pdf->begin_document("","");
225
-    else {
225
+    if ( self::$IN_MEMORY ) {
226
+          $this->_pdf->begin_document("","");
227
+    } else {
226 228
       $this->_file = tempnam(DOMPDF_TEMP_DIR, "libdompdf_pdf_").'.pdf';
227 229
       $this->_pdf->begin_document($this->_file,"");
228 230
     }
@@ -254,19 +256,23 @@  discard block
 block discarded – undo
254 256
         } else if ( file_exists($file . ".pfb") ) {
255 257
           $outline = "$file.pfb";
256 258
 
257
-          if ( file_exists($file . ".afm") )
258
-            $afm = "$file.afm";
259
+          if ( file_exists($file . ".afm") ) {
260
+                      $afm = "$file.afm";
261
+          }
259 262
 
260 263
         } else if ( file_exists($file . ".PFB") ) {
261 264
           $outline = "$file.PFB";
262
-          if ( file_exists($file . ".AFM") )
263
-            $afm = "$file.AFM";
264
-        } else
265
-          continue;
265
+          if ( file_exists($file . ".AFM") ) {
266
+                      $afm = "$file.AFM";
267
+          }
268
+        } else {
269
+                  continue;
270
+        }
266 271
 
267 272
         $this->_pdf->set_parameter("FontOutline", "\{$face\}=\{$outline\}");
268
-        if ( !is_null($afm) )
269
-          $this->_pdf->set_parameter("FontAFM", "\{$face\}=\{$afm\}");
273
+        if ( !is_null($afm) ) {
274
+                  $this->_pdf->set_parameter("FontAFM", "\{$face\}=\{$afm\}");
275
+        }
270 276
       }
271 277
     }
272 278
   }
@@ -369,8 +375,9 @@  discard block
 block discarded – undo
369 375
     if ( mb_strpos($where, "next") !== false ) {
370 376
       $this->_objs[$object]["start_page"]++;
371 377
       $where = str_replace("next", "", $where);
372
-      if ( $where == "" )
373
-        $where = "add";
378
+      if ( $where == "" ) {
379
+              $where = "add";
380
+      }
374 381
     }
375 382
 
376 383
     $this->_objs[$object]["where"] = $where;
@@ -386,8 +393,9 @@  discard block
 block discarded – undo
386 393
    */
387 394
   function stop_object($object) {
388 395
 
389
-    if ( !isset($this->_objs[$object]) )
390
-      return;
396
+    if ( !isset($this->_objs[$object]) ) {
397
+          return;
398
+    }
391 399
 
392 400
     $start = $this->_objs[$object]["start_page"];
393 401
     $where = $this->_objs[$object]["where"];
@@ -396,8 +404,9 @@  discard block
 block discarded – undo
396 404
     if ( $this->_page_number >= $start &&
397 405
          (($this->_page_number % 2 == 0 && $where === "even") ||
398 406
           ($this->_page_number % 2 == 1 && $where === "odd") ||
399
-          ($where === "all")) )
400
-      $this->_pdf->fit_image($object,0,0,"");
407
+          ($where === "all")) ) {
408
+          $this->_pdf->fit_image($object,0,0,"");
409
+    }
401 410
 
402 411
     unset($this->_objs[$object]);
403 412
   }
@@ -445,13 +454,15 @@  discard block
 block discarded – undo
445 454
    */
446 455
   protected function _set_line_style($width, $cap, $join, $dash) {
447 456
 
448
-    if ( count($dash) == 1 )
449
-      $dash[] = $dash[0];
457
+    if ( count($dash) == 1 ) {
458
+          $dash[] = $dash[0];
459
+    }
450 460
 
451
-    if ( count($dash) > 1 )
452
-      $this->_pdf->setdashpattern("dasharray={" . join(" ", $dash) . "}");
453
-    else
454
-      $this->_pdf->setdash(0,0);
461
+    if ( count($dash) > 1 ) {
462
+          $this->_pdf->setdashpattern("dasharray={" . join(" ", $dash) . "}");
463
+    } else {
464
+          $this->_pdf->setdash(0,0);
465
+    }
455 466
 
456 467
     switch ( $join ) {
457 468
     case "miter":
@@ -497,8 +508,9 @@  discard block
 block discarded – undo
497 508
    * @param array $color array(r,g,b)
498 509
    */
499 510
   protected function _set_stroke_color($color) {
500
-    if($this->_last_stroke_color == $color)
501
-    	return;
511
+    if($this->_last_stroke_color == $color) {
512
+        	return;
513
+    }
502 514
 
503 515
     $this->_last_stroke_color = $color;
504 516
 
@@ -512,8 +524,9 @@  discard block
 block discarded – undo
512 524
    * @param array $color array(r,g,b)
513 525
    */
514 526
   protected function _set_fill_color($color) {
515
-    if($this->_last_fill_color == $color)
516
-    	return;
527
+    if($this->_last_fill_color == $color) {
528
+        	return;
529
+    }
517 530
 
518 531
     $this->_last_fill_color = $color;
519 532
 
@@ -549,19 +562,19 @@  discard block
 block discarded – undo
549 562
 
550 563
       // Unicode encoding is only available for the commerical
551 564
       // version of PDFlib and not PDFlib-Lite
552
-      if ( defined("DOMPDF_PDFLIB_LICENSE") )
553
-        $encoding = "unicode";
554
-      else
555
-        $encoding = "auto";
565
+      if ( defined("DOMPDF_PDFLIB_LICENSE") ) {
566
+              $encoding = "unicode";
567
+      } else {
568
+              $encoding = "auto";
569
+      }
556 570
 
557 571
     }
558 572
 
559 573
     $key = $font .":". $encoding .":". $options;
560 574
 
561
-    if ( isset($this->_fonts[$key]) )
562
-      return $this->_fonts[$key];
563
-
564
-    else {
575
+    if ( isset($this->_fonts[$key]) ) {
576
+          return $this->_fonts[$key];
577
+    } else {
565 578
 
566 579
       $this->_fonts[$key] = $this->_pdf->load_font($font, $encoding, $options);
567 580
       return $this->_fonts[$key];
@@ -622,8 +635,9 @@  discard block
 block discarded – undo
622 635
     $this->_set_fill_color($color);
623 636
     $this->_set_stroke_color($color);
624 637
 
625
-    if ( !$fill && isset($width) )
626
-      $this->_set_line_style($width, "square", "miter", $style);
638
+    if ( !$fill && isset($width) ) {
639
+          $this->_set_line_style($width, "square", "miter", $style);
640
+    }
627 641
 
628 642
     $y = $this->y(array_pop($points));
629 643
     $x = array_pop($points);
@@ -635,10 +649,11 @@  discard block
 block discarded – undo
635 649
       $this->_pdf->lineto($x,$y);
636 650
     }
637 651
 
638
-    if ( $fill )
639
-      $this->_pdf->fill();
640
-    else
641
-      $this->_pdf->closepath_stroke();
652
+    if ( $fill ) {
653
+          $this->_pdf->fill();
654
+    } else {
655
+          $this->_pdf->closepath_stroke();
656
+    }
642 657
   }
643 658
 
644 659
   //........................................................................
@@ -648,17 +663,19 @@  discard block
 block discarded – undo
648 663
     $this->_set_fill_color($color);
649 664
     $this->_set_stroke_color($color);
650 665
 
651
-    if ( !$fill && isset($width) )
652
-      $this->_set_line_style($width, "round", "round", $style);
666
+    if ( !$fill && isset($width) ) {
667
+          $this->_set_line_style($width, "round", "round", $style);
668
+    }
653 669
 
654 670
     $y = $this->y($y);
655 671
 
656 672
     $this->_pdf->circle($x, $y, $r);
657 673
 
658
-    if ( $fill )
659
-      $this->_pdf->fill();
660
-    else
661
-      $this->_pdf->stroke();
674
+    if ( $fill ) {
675
+          $this->_pdf->fill();
676
+    } else {
677
+          $this->_pdf->stroke();
678
+    }
662 679
 
663 680
   }
664 681
 
@@ -670,13 +687,13 @@  discard block
 block discarded – undo
670 687
 
671 688
     $img_type = strtolower($img_type);
672 689
 
673
-    if ( $img_type === "jpg" )
674
-      $img_type = "jpeg";
675
-
676
-    if ( isset($this->_imgs[$img_url]) )
677
-      $img = $this->_imgs[$img_url];
690
+    if ( $img_type === "jpg" ) {
691
+          $img_type = "jpeg";
692
+    }
678 693
 
679
-    else {
694
+    if ( isset($this->_imgs[$img_url]) ) {
695
+          $img = $this->_imgs[$img_url];
696
+    } else {
680 697
 
681 698
       $img = $this->_imgs[$img_url] = $this->_pdf->load_image($img_type, $img_url, "");
682 699
     }
@@ -737,14 +754,17 @@  discard block
 block discarded – undo
737 754
     if ( strpos($url, '#') === 0 ) {
738 755
       // Local link
739 756
       $name = substr($url,1);
740
-      if ( $name )
741
-        $this->_pdf->create_annotation($x, $y, $x + $width, $y + $height, 'Link', "contents={$url} destname=". substr($url,1) . " linewidth=0");
757
+      if ( $name ) {
758
+              $this->_pdf->create_annotation($x, $y, $x + $width, $y + $height, 'Link', "contents={$url} destname=". substr($url,1) . " linewidth=0");
759
+      }
742 760
     } else {
743 761
 
744 762
       list($proto, $host, $path, $file) = explode_url($url);
745 763
 
746
-      if ( $proto == "" || $proto === "file://" )
747
-        return; // Local links are not allowed
764
+      if ( $proto == "" || $proto === "file://" ) {
765
+              return;
766
+      }
767
+      // Local links are not allowed
748 768
       $url = build_url($proto, $host, $path, $file);
749 769
       $url = '{' . rawurldecode($url) . '}';
750 770
       
@@ -842,8 +862,9 @@  discard block
 block discarded – undo
842 862
    */
843 863
   protected function _add_page_text() {
844 864
 
845
-    if ( !count($this->_page_text) )
846
-      return;
865
+    if ( !count($this->_page_text) ) {
866
+          return;
867
+    }
847 868
 
848 869
     $this->_pdf->suspend_page("");
849 870
 
@@ -883,10 +904,11 @@  discard block
 block discarded – undo
883 904
     // Add page text
884 905
     $this->_add_page_text();
885 906
 
886
-    if ( isset($options["compress"]) && $options["compress"] != 1 )
887
-      $this->_pdf->set_value("compress", 0);
888
-    else
889
-      $this->_pdf->set_value("compress", 6);
907
+    if ( isset($options["compress"]) && $options["compress"] != 1 ) {
908
+          $this->_pdf->set_value("compress", 0);
909
+    } else {
910
+          $this->_pdf->set_value("compress", 6);
911
+    }
890 912
 
891 913
     $this->_close();
892 914
 
@@ -894,8 +916,9 @@  discard block
 block discarded – undo
894 916
       $data = $this->_pdf->get_buffer();
895 917
       $size = strlen($data);
896 918
 
897
-    } else
898
-      $size = filesize($this->_file);
919
+    } else {
920
+          $size = filesize($this->_file);
921
+    }
899 922
 
900 923
 
901 924
     $filename = str_replace(array("\n","'"),"", $filename);
@@ -907,26 +930,30 @@  discard block
 block discarded – undo
907 930
 
908 931
     //header("Content-length: " . $size);
909 932
 
910
-    if ( self::$IN_MEMORY )
911
-      echo $data;
912
-
913
-    else {
933
+    if ( self::$IN_MEMORY ) {
934
+          echo $data;
935
+    } else {
914 936
 
915 937
       // Chunked readfile()
916 938
       $chunk = (1 << 21); // 2 MB
917 939
       $fh = fopen($this->_file, "rb");
918
-      if ( !$fh )
919
-        throw new DOMPDF_Exception("Unable to load temporary PDF file: " . $this->_file);
940
+      if ( !$fh ) {
941
+              throw new DOMPDF_Exception("Unable to load temporary PDF file: " . $this->_file);
942
+      }
920 943
 
921
-      while ( !feof($fh) )
922
-        echo fread($fh,$chunk);
944
+      while ( !feof($fh) ) {
945
+              echo fread($fh,$chunk);
946
+      }
923 947
       fclose($fh);
924 948
 
925 949
       //debugpng
926
-      if (DEBUGPNG) print '[pdflib stream unlink '.$this->_file.']';
927
-      if (!DEBUGKEEPTEMP)
928
-
950
+      if (DEBUGPNG) {
951
+          print '[pdflib stream unlink '.$this->_file.']';
952
+      }
953
+      if (!DEBUGKEEPTEMP) {
954
+      
929 955
       unlink($this->_file);
956
+      }
930 957
       $this->_file = null;
931 958
     }
932 959
 
@@ -942,24 +969,27 @@  discard block
 block discarded – undo
942 969
     // Add page text
943 970
     $this->_add_page_text();
944 971
 
945
-    if ( isset($options["compress"]) && $options["compress"] != 1 )
946
-      $this->_pdf->set_value("compress", 0);
947
-    else
948
-      $this->_pdf->set_value("compress", 6);
972
+    if ( isset($options["compress"]) && $options["compress"] != 1 ) {
973
+          $this->_pdf->set_value("compress", 0);
974
+    } else {
975
+          $this->_pdf->set_value("compress", 6);
976
+    }
949 977
 
950 978
     $this->_close();
951 979
 
952
-    if ( self::$IN_MEMORY )
953
-      $data = $this->_pdf->get_buffer();
954
-
955
-    else {
980
+    if ( self::$IN_MEMORY ) {
981
+          $data = $this->_pdf->get_buffer();
982
+    } else {
956 983
       $data = file_get_contents($this->_file);
957 984
 
958 985
       //debugpng
959
-      if (DEBUGPNG) print '[pdflib output unlink '.$this->_file.']';
960
-      if (!DEBUGKEEPTEMP)
961
-
986
+      if (DEBUGPNG) {
987
+          print '[pdflib output unlink '.$this->_file.']';
988
+      }
989
+      if (!DEBUGKEEPTEMP) {
990
+      
962 991
       unlink($this->_file);
992
+      }
963 993
       $this->_file = null;
964 994
     }
965 995
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_cell_frame_reflower.cls.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,8 +112,9 @@  discard block
 block discarded – undo
112 112
     // Set the containing blocks and reflow each child
113 113
     foreach ( $this->_frame->get_children() as $child ) {
114 114
       
115
-      if ( $page->is_full() )
116
-        break;
115
+      if ( $page->is_full() ) {
116
+              break;
117
+      }
117 118
     
118 119
       $child->set_containing_block($content_x, $content_y, $cb_w, $h);
119 120
       $child->reflow();
@@ -132,11 +133,13 @@  discard block
 block discarded – undo
132 133
     // Let the cellmap know our height
133 134
     $cell_height = $height / count($cells["rows"]);
134 135
 
135
-    if ($style_height < $height)
136
-      $cell_height += $top_space + $bottom_space;
136
+    if ($style_height < $height) {
137
+          $cell_height += $top_space + $bottom_space;
138
+    }
137 139
 
138
-    foreach ($cells["rows"] as $i)
139
-      $cellmap->set_row_height($i, $cell_height);
140
+    foreach ($cells["rows"] as $i) {
141
+          $cellmap->set_row_height($i, $cell_height);
142
+    }
140 143
 
141 144
     $style->height = $height;
142 145
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/functions.inc.php 1 patch
Braces   +63 added lines, -42 removed lines patch added patch discarded remove patch
@@ -63,17 +63,20 @@  discard block
 block discarded – undo
63 63
  */
64 64
 if ( !function_exists("pre_r") ) {
65 65
 function pre_r($mixed, $return = false) {
66
-  if ($return)
67
-    return "<pre>" . print_r($mixed, true) . "</pre>";
66
+  if ($return) {
67
+      return "<pre>" . print_r($mixed, true) . "</pre>";
68
+  }
68 69
 
69
-  if ( php_sapi_name() !== "cli")
70
-    echo ("<pre>");
70
+  if ( php_sapi_name() !== "cli") {
71
+      echo ("<pre>");
72
+  }
71 73
   print_r($mixed);
72 74
 
73
-  if ( php_sapi_name() !== "cli")
74
-    echo("</pre>");
75
-  else
76
-    echo ("\n");
75
+  if ( php_sapi_name() !== "cli") {
76
+      echo("</pre>");
77
+  } else {
78
+      echo ("\n");
79
+  }
77 80
   flush();
78 81
 
79 82
 }
@@ -89,12 +92,14 @@  discard block
 block discarded – undo
89 92
  */
90 93
 if ( !function_exists("pre_var_dump") ) {
91 94
 function pre_var_dump($mixed) {
92
-  if ( php_sapi_name() !== "cli")
93
-    echo("<pre>");
95
+  if ( php_sapi_name() !== "cli") {
96
+      echo("<pre>");
97
+  }
94 98
   var_dump($mixed);
95
-  if ( php_sapi_name() !== "cli")
96
-    echo("</pre>");
97
-}
99
+  if ( php_sapi_name() !== "cli") {
100
+      echo("</pre>");
101
+  }
102
+  }
98 103
 }
99 104
 
100 105
 /**
@@ -121,8 +126,9 @@  discard block
 block discarded – undo
121 126
   }
122 127
 
123 128
   // Is the url already fully qualified?
124
-  if ( mb_strpos($url, "://") !== false )
125
-    return $url;
129
+  if ( mb_strpos($url, "://") !== false ) {
130
+      return $url;
131
+  }
126 132
 
127 133
   $ret = $protocol;
128 134
 
@@ -170,24 +176,29 @@  discard block
 block discarded – undo
170 176
 
171 177
   if ( isset($arr["scheme"]) &&
172 178
        $arr["scheme"] !== "file" &&
173
-       mb_strlen($arr["scheme"]) > 1 ) // Exclude windows drive letters...
179
+       mb_strlen($arr["scheme"]) > 1 ) {
180
+      // Exclude windows drive letters...
174 181
     {
175 182
     $protocol = $arr["scheme"] . "://";
183
+  }
176 184
 
177 185
     if ( isset($arr["user"]) ) {
178 186
       $host .= $arr["user"];
179 187
 
180
-      if ( isset($arr["pass"]) )
181
-        $host .= "@" . $arr["pass"];
188
+      if ( isset($arr["pass"]) ) {
189
+              $host .= "@" . $arr["pass"];
190
+      }
182 191
 
183 192
       $host .= ":";
184 193
     }
185 194
 
186
-    if ( isset($arr["host"]) )
187
-      $host .= $arr["host"];
195
+    if ( isset($arr["host"]) ) {
196
+          $host .= $arr["host"];
197
+    }
188 198
 
189
-    if ( isset($arr["port"]) )
190
-      $host .= ":" . $arr["port"];
199
+    if ( isset($arr["port"]) ) {
200
+          $host .= ":" . $arr["port"];
201
+    }
191 202
 
192 203
     if ( isset($arr["path"]) && $arr["path"] !== "" ) {
193 204
       // Do we have a trailing slash?
@@ -200,17 +211,20 @@  discard block
 block discarded – undo
200 211
       }
201 212
     }
202 213
 
203
-    if ( isset($arr["query"]) )
204
-      $file .= "?" . $arr["query"];
214
+    if ( isset($arr["query"]) ) {
215
+          $file .= "?" . $arr["query"];
216
+    }
205 217
 
206
-    if ( isset($arr["fragment"]) )
207
-      $file .= "#" . $arr["fragment"];
218
+    if ( isset($arr["fragment"]) ) {
219
+          $file .= "#" . $arr["fragment"];
220
+    }
208 221
 
209 222
   } else {
210 223
 
211 224
     $i = mb_strpos($url, "file://");
212
-    if ( $i !== false)
213
-      $url = mb_substr($url, $i + 7);
225
+    if ( $i !== false) {
226
+          $url = mb_substr($url, $i + 7);
227
+    }
214 228
 
215 229
     $protocol = ""; // "file://"; ? why doesn't this work... It's because of
216 230
                     // network filenames like //COMPU/SHARENAME
@@ -262,11 +276,13 @@  discard block
 block discarded – undo
262 276
                        "dc", "dcc", "dccc", "cm");
263 277
   static $thou = array("", "m", "mm", "mmm");
264 278
 
265
-  if ( !is_numeric($num) )
266
-    throw new DOMPDF_Exception("dec2roman() requires a numeric argument.");
279
+  if ( !is_numeric($num) ) {
280
+      throw new DOMPDF_Exception("dec2roman() requires a numeric argument.");
281
+  }
267 282
 
268
-  if ( $num > 4000 || $num < 0 )
269
-    return "(out of range)";
283
+  if ( $num > 4000 || $num < 0 ) {
284
+      return "(out of range)";
285
+  }
270 286
 
271 287
   $num = strrev((string)$num);
272 288
 
@@ -372,10 +388,11 @@  discard block
 block discarded – undo
372 388
 
373 389
 if ( !function_exists("mb_substr") ) {
374 390
   function mb_substr($str, $start, $length=null, $encoding='iso-8859-1') {
375
-    if ( is_null($length) )
376
-      return substr($str, $start);
377
-    else
378
-      return substr($str, $start, $length);
391
+    if ( is_null($length) ) {
392
+          return substr($str, $start);
393
+    } else {
394
+          return substr($str, $start, $length);
395
+    }
379 396
   }
380 397
 }
381 398
 
@@ -402,14 +419,17 @@  discard block
 block discarded – undo
402 419
  */
403 420
 function record_warnings($errno, $errstr, $errfile, $errline) {
404 421
 
405
-  if ( !($errno & (E_WARNING | E_NOTICE | E_USER_NOTICE | E_USER_WARNING )) ) // Not a warning or notice
422
+  if ( !($errno & (E_WARNING | E_NOTICE | E_USER_NOTICE | E_USER_WARNING )) ) {
423
+      // Not a warning or notice
406 424
     throw new DOMPDF_Exception($errstr . " $errno");
425
+  }
407 426
 
408 427
   global $_dompdf_warnings;
409 428
   global $_dompdf_show_warnings;
410 429
 
411
-  if ( $_dompdf_show_warnings )
412
-    echo $errstr . "\n";
430
+  if ( $_dompdf_show_warnings ) {
431
+      echo $errstr . "\n";
432
+  }
413 433
 
414 434
   $_dompdf_warnings[] = $errstr;
415 435
 }
@@ -496,9 +516,10 @@  discard block
 block discarded – undo
496 516
 if ( !function_exists("mark_memusage") ) {
497 517
 function mark_memusage($location) {
498 518
   global $memusage;
499
-  if ( isset($memusage) )
500
-    $memusage[$location] = memory_get_usage();
501
-}
519
+  if ( isset($memusage) ) {
520
+      $memusage[$location] = memory_get_usage();
521
+  }
522
+  }
502 523
 }
503 524
 
504 525
 /**
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/block_frame_decorator.cls.php 1 patch
Braces   +50 added lines, -34 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@  discard block
 block discarded – undo
87 87
 
88 88
   function get_current_line($i = null) {
89 89
     $cl = $this->_lines[$this->_cl];
90
-    if ( isset($i) )
91
-      return $cl[$i];
90
+    if ( isset($i) ) {
91
+          return $cl[$i];
92
+    }
92 93
     return $cl;
93 94
   }
94 95
 
@@ -102,23 +103,28 @@  discard block
 block discarded – undo
102 103
   }
103 104
 
104 105
   function clear_line($i) {
105
-    if ( isset($this->_lines[$i]) )
106
-      unset($this->_lines[$i]);
106
+    if ( isset($this->_lines[$i]) ) {
107
+          unset($this->_lines[$i]);
108
+    }
107 109
   }
108 110
 
109 111
   function set_line($lineno, $y = null, $w = null, $h = null) {
110 112
 
111
-    if ( is_array($y) )
112
-      extract($y);
113
+    if ( is_array($y) ) {
114
+          extract($y);
115
+    }
113 116
 
114
-    if (is_numeric($y))
115
-      $this->_lines[$lineno]["y"] = $y;
117
+    if (is_numeric($y)) {
118
+          $this->_lines[$lineno]["y"] = $y;
119
+    }
116 120
 
117
-    if (is_numeric($w))
118
-      $this->_lines[$lineno]["w"] = $w;
121
+    if (is_numeric($w)) {
122
+          $this->_lines[$lineno]["w"] = $w;
123
+    }
119 124
 
120
-    if (is_numeric($h))
121
-      $this->_lines[$lineno]["h"] = $h;
125
+    if (is_numeric($h)) {
126
+          $this->_lines[$lineno]["h"] = $h;
127
+    }
122 128
 
123 129
   }
124 130
 
@@ -136,8 +142,9 @@  discard block
 block discarded – undo
136 142
       }
137 143
 
138 144
       // Add each child of the inline frame to the line individually
139
-      foreach ($frame->get_children() as $child)
140
-        $this->add_frame_to_line( $child );
145
+      foreach ($frame->get_children() as $child) {
146
+              $this->add_frame_to_line( $child );
147
+      }
141 148
 
142 149
       return;
143 150
     }
@@ -156,8 +163,9 @@  discard block
 block discarded – undo
156 163
 
157 164
     $w = $frame->get_margin_width();
158 165
 
159
-    if ( $w == 0 )
160
-      return;
166
+    if ( $w == 0 ) {
167
+          return;
168
+    }
161 169
 
162 170
     // Debugging code:
163 171
     /*
@@ -176,16 +184,18 @@  discard block
 block discarded – undo
176 184
     */
177 185
     // End debugging
178 186
 
179
-    if ($this->_lines[$this->_cl]["w"] + $w > $this->get_containing_block("w"))
180
-      $this->add_line();
187
+    if ($this->_lines[$this->_cl]["w"] + $w > $this->get_containing_block("w")) {
188
+          $this->add_line();
189
+    }
181 190
 
182 191
     $frame->position();
183 192
 
184 193
 
185 194
     $this->_lines[$this->_cl]["frames"][] = $frame;
186 195
 
187
-    if ( $frame->get_node()->nodeName === "#text")
188
-      $this->_lines[$this->_cl]["wc"] += count(preg_split("/\s+/", $frame->get_text()));
196
+    if ( $frame->get_node()->nodeName === "#text") {
197
+          $this->_lines[$this->_cl]["wc"] += count(preg_split("/\s+/", $frame->get_text()));
198
+    }
189 199
 
190 200
     $this->_lines[$this->_cl]["w"] += $w;
191 201
     $this->_lines[$this->_cl]["h"] = max($this->_lines[$this->_cl]["h"], $frame->get_margin_height());
@@ -197,13 +207,15 @@  discard block
 block discarded – undo
197 207
     $i = $this->_cl;
198 208
 
199 209
     while ($i >= 0) {
200
-      if ( ($j = in_array($frame, $this->_lines[$i]["frames"], true)) !== false )
201
-        break;
210
+      if ( ($j = in_array($frame, $this->_lines[$i]["frames"], true)) !== false ) {
211
+              break;
212
+      }
202 213
       $i--;
203 214
     }
204 215
 
205
-    if ( $j === false )
206
-      return;
216
+    if ( $j === false ) {
217
+          return;
218
+    }
207 219
 
208 220
     // Remove $frame and all frames that follow
209 221
     while ($j < count($this->_lines[$i]["frames"])) {
@@ -214,14 +226,16 @@  discard block
 block discarded – undo
214 226
 
215 227
     // Recalculate the height of the line
216 228
     $h = 0;
217
-    foreach ($this->_lines[$i]["frames"] as $f)
218
-      $h = max( $h, $f->get_margin_height() );
229
+    foreach ($this->_lines[$i]["frames"] as $f) {
230
+          $h = max( $h, $f->get_margin_height() );
231
+    }
219 232
 
220 233
     $this->_lines[$i]["h"] = $h;
221 234
 
222 235
     // Remove all lines that follow
223
-    while ($this->_cl > $i)
224
-      unset($this->_lines[ $this->_cl-- ]);
236
+    while ($this->_cl > $i) {
237
+          unset($this->_lines[ $this->_cl-- ]);
238
+    }
225 239
 
226 240
   }
227 241
 
@@ -252,17 +266,19 @@  discard block
 block discarded – undo
252 266
   }
253 267
 
254 268
   function increment_counter($id = self::DEFAULT_COUNTER, $increment = 1) {
255
-    if ( !isset($this->_counters[$id]) )
256
-      $this->_counters[$id] = $increment;
257
-    else
258
-      $this->_counters[$id] += $increment;
269
+    if ( !isset($this->_counters[$id]) ) {
270
+          $this->_counters[$id] = $increment;
271
+    } else {
272
+          $this->_counters[$id] += $increment;
273
+    }
259 274
 
260 275
   }
261 276
 
262 277
   function counter_value($id = self::DEFAULT_COUNTER, $type = "decimal") {
263 278
     $type = mb_strtolower($type);
264
-    if ( !isset($this->_counters[$id]) )
265
-      $this->_counters[$id] = 0;
279
+    if ( !isset($this->_counters[$id]) ) {
280
+          $this->_counters[$id] = 0;
281
+    }
266 282
 
267 283
     switch ($type) {
268 284
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/style.cls.php 1 patch
Braces   +132 added lines, -92 removed lines patch added patch discarded remove patch
@@ -398,20 +398,24 @@  discard block
 block discarded – undo
398 398
    */
399 399
   function length_in_pt($length, $ref_size = null) {
400 400
 
401
-    if ( !is_array($length) )
402
-      $length = array($length);
401
+    if ( !is_array($length) ) {
402
+          $length = array($length);
403
+    }
403 404
 
404
-    if ( !isset($ref_size) )
405
-      $ref_size = self::$default_font_size;
405
+    if ( !isset($ref_size) ) {
406
+          $ref_size = self::$default_font_size;
407
+    }
406 408
 
407 409
     $ret = 0;
408 410
     foreach ($length as $l) {
409 411
 
410
-      if ( $l === "auto" )
411
-        return "auto";
412
+      if ( $l === "auto" ) {
413
+              return "auto";
414
+      }
412 415
       
413
-      if ( $l === "none" )
414
-        return "none";
416
+      if ( $l === "none" ) {
417
+              return "none";
418
+      }
415 419
 
416 420
       // Assume numeric values are already in points
417 421
       if ( is_numeric($l) ) {
@@ -567,8 +571,9 @@  discard block
 block discarded – undo
567 571
  	  }
568 572
  	}
569 573
 
570
-    if ( isset($style->_props["font_size"]) )
571
-      $this->__font_size_calculated = false;
574
+    if ( isset($style->_props["font_size"]) ) {
575
+          $this->__font_size_calculated = false;
576
+    }
572 577
   }
573 578
 
574 579
   
@@ -580,10 +585,11 @@  discard block
 block discarded – undo
580 585
    * @return array
581 586
    */
582 587
   function munge_colour($colour) {
583
-    if ( is_array($colour) )
584
-      // Assume the array has the right format...
588
+    if ( is_array($colour) ) {
589
+          // Assume the array has the right format...
585 590
       // FIXME: should/could verify this.
586 591
       return $colour;
592
+    }
587 593
     
588 594
     $r = 0;
589 595
     $g = 0;
@@ -689,19 +695,22 @@  discard block
 block discarded – undo
689 695
         $j = mb_strpos($colour, ")");
690 696
         
691 697
         // Bad colour value
692
-        if ($i === false || $j === false)
693
-          return null;
698
+        if ($i === false || $j === false) {
699
+                  return null;
700
+        }
694 701
 
695 702
         $triplet = explode(",", mb_substr($colour, $i+1, $j-$i-1));
696 703
 
697
-        if (count($triplet) != 3)
698
-          return null;
704
+        if (count($triplet) != 3) {
705
+                  return null;
706
+        }
699 707
         
700 708
         foreach (array_keys($triplet) as $c) {
701 709
           $triplet[$c] = trim($triplet[$c]);
702 710
           
703
-          if ( $triplet[$c]{mb_strlen($triplet[$c]) - 1} === "%" )
704
-            $triplet[$c] = round($triplet[$c] * 0.255);
711
+          if ( $triplet[$c]{mb_strlen($triplet[$c]) - 1} === "%" ) {
712
+                      $triplet[$c] = round($triplet[$c] * 0.255);
713
+          }
705 714
         }
706 715
 
707 716
         list($r, $g, $b) = $triplet;
@@ -796,10 +805,11 @@  discard block
 block discarded – undo
796 805
     
797 806
     $method = "set_$prop";
798 807
 
799
-    if ( method_exists($this, $method) )
800
-      $this->$method($val);
801
-    else
802
-      $this->_props[$prop] = $val;
808
+    if ( method_exists($this, $method) ) {
809
+          $this->$method($val);
810
+    } else {
811
+          $this->_props[$prop] = $val;
812
+    }
803 813
     
804 814
   }
805 815
 
@@ -818,20 +828,24 @@  discard block
 block discarded – undo
818 828
    */
819 829
   function __get($prop) {
820 830
     
821
-    if ( !isset(self::$_defaults[$prop]) )
822
-      throw new DOMPDF_Exception("'$prop' is not a valid CSS2 property.");
831
+    if ( !isset(self::$_defaults[$prop]) ) {
832
+          throw new DOMPDF_Exception("'$prop' is not a valid CSS2 property.");
833
+    }
823 834
 
824
-    if ( isset($this->_prop_cache[$prop]) && $this->_prop_cache[$prop] != null)
825
-      return $this->_prop_cache[$prop];
835
+    if ( isset($this->_prop_cache[$prop]) && $this->_prop_cache[$prop] != null) {
836
+          return $this->_prop_cache[$prop];
837
+    }
826 838
     
827 839
     $method = "get_$prop";
828 840
 
829 841
     // Fall back on defaults if property is not set
830
-    if ( !isset($this->_props[$prop]) )
831
-      $this->_props[$prop] = self::$_defaults[$prop];
842
+    if ( !isset($this->_props[$prop]) ) {
843
+          $this->_props[$prop] = self::$_defaults[$prop];
844
+    }
832 845
 
833
-    if ( method_exists($this, $method) )
834
-      return $this->_prop_cache[$prop] = $this->$method();
846
+    if ( method_exists($this, $method) ) {
847
+          return $this->_prop_cache[$prop] = $this->$method();
848
+    }
835 849
 
836 850
 
837 851
     return $this->_prop_cache[$prop] = $this->_props[$prop];
@@ -859,10 +873,11 @@  discard block
 block discarded – undo
859 873
     
860 874
     if ( is_numeric($weight) ) {
861 875
 
862
-      if ( $weight < 600 )
863
-        $weight = "normal";
864
-      else
865
-        $weight = "bold";
876
+      if ( $weight < 600 ) {
877
+              $weight = "normal";
878
+      } else {
879
+              $weight = "bold";
880
+      }
866 881
 
867 882
     } else if ( $weight === "bold" || $weight === "bolder" ) {
868 883
       $weight = "bold";
@@ -875,14 +890,15 @@  discard block
 block discarded – undo
875 890
     // Resolve font-style
876 891
     $font_style = $this->__get("font_style");
877 892
 
878
-    if ( $weight === "bold" && ($font_style === "italic" || $font_style === "oblique") )
879
-      $subtype = "bold_italic";
880
-    else if ( $weight === "bold" && $font_style !== "italic" && $font_style !== "oblique" )
881
-      $subtype = "bold";
882
-    else if ( $weight !== "bold" && ($font_style === "italic" || $font_style === "oblique") )
883
-      $subtype = "italic";
884
-    else
885
-      $subtype = "normal";
893
+    if ( $weight === "bold" && ($font_style === "italic" || $font_style === "oblique") ) {
894
+          $subtype = "bold_italic";
895
+    } else if ( $weight === "bold" && $font_style !== "italic" && $font_style !== "oblique" ) {
896
+          $subtype = "bold";
897
+    } else if ( $weight !== "bold" && ($font_style === "italic" || $font_style === "oblique") ) {
898
+          $subtype = "italic";
899
+    } else {
900
+          $subtype = "normal";
901
+    }
886 902
     
887 903
     // Resolve the font family
888 904
     if ($DEBUGCSS) {
@@ -899,21 +915,29 @@  discard block
 block discarded – undo
899 915
       //remove leading and trailing string delimiters, e.g. on font names with spaces;
900 916
       //remove leading and trailing whitespace
901 917
       $family=trim($family," \t\n\r\x0B\"'");
902
-      if ($DEBUGCSS) print '('.$family.')';
918
+      if ($DEBUGCSS) {
919
+          print '('.$family.')';
920
+      }
903 921
       $font = Font_Metrics::get_font($family, $subtype);
904 922
 
905 923
       if ( $font ) {
906
-        if ($DEBUGCSS)  print '('.$font.")get_font_family]\n</pre>";
924
+        if ($DEBUGCSS) {
925
+            print '('.$font.")get_font_family]\n</pre>";
926
+        }
907 927
         return $font;
908 928
       }
909 929
     }
910 930
 
911 931
     $family = null;
912
-    if ($DEBUGCSS)  print '(default)';
932
+    if ($DEBUGCSS) {
933
+        print '(default)';
934
+    }
913 935
     $font = Font_Metrics::get_font($family, $subtype);
914 936
 
915 937
     if ( $font ) {
916
-      if ($DEBUGCSS) print '('.$font.")get_font_family]\n</pre>";
938
+      if ($DEBUGCSS) {
939
+          print '('.$font.")get_font_family]\n</pre>";
940
+      }
917 941
       return $font;
918 942
     }
919 943
     throw new DOMPDF_Exception("Unable to find a suitable font replacement for: '" . $this->_props["font_family"] ."'");
@@ -928,16 +952,19 @@  discard block
 block discarded – undo
928 952
    */
929 953
   function get_font_size() {
930 954
 
931
-    if ( $this->__font_size_calculated )
932
-      return $this->_props["font_size"];
955
+    if ( $this->__font_size_calculated ) {
956
+          return $this->_props["font_size"];
957
+    }
933 958
     
934
-    if ( !isset($this->_props["font_size"]) )
935
-      $fs = self::$_defaults["font_size"];
936
-    else
937
-      $fs = $this->_props["font_size"];
959
+    if ( !isset($this->_props["font_size"]) ) {
960
+          $fs = self::$_defaults["font_size"];
961
+    } else {
962
+          $fs = $this->_props["font_size"];
963
+    }
938 964
     
939
-    if ( !isset($this->_parent_font_size) )
940
-      $this->_parent_font_size = self::$default_font_size;
965
+    if ( !isset($this->_parent_font_size) ) {
966
+          $this->_parent_font_size = self::$default_font_size;
967
+    }
941 968
     
942 969
     switch ($fs) {
943 970
       
@@ -976,14 +1003,13 @@  discard block
 block discarded – undo
976 1003
     }
977 1004
 
978 1005
     // Ensure relative sizes resolve to something
979
-    if ( ($i = mb_strpos($fs, "em")) !== false )
980
-      $fs = mb_substr($fs, 0, $i) * $this->_parent_font_size;
981
-
982
-    else if ( ($i = mb_strpos($fs, "ex")) !== false )
983
-      $fs = mb_substr($fs, 0, $i) * $this->_parent_font_size;
984
-
985
-    else
986
-      $fs = $this->length_in_pt($fs);
1006
+    if ( ($i = mb_strpos($fs, "em")) !== false ) {
1007
+          $fs = mb_substr($fs, 0, $i) * $this->_parent_font_size;
1008
+    } else if ( ($i = mb_strpos($fs, "ex")) !== false ) {
1009
+          $fs = mb_substr($fs, 0, $i) * $this->_parent_font_size;
1010
+    } else {
1011
+          $fs = $this->length_in_pt($fs);
1012
+    }
987 1013
 
988 1014
     //see __set and __get, on all assignments clear cache!
989 1015
 	$this->_prop_cache["font_size"] = null;
@@ -998,8 +1024,9 @@  discard block
 block discarded – undo
998 1024
    * @return float
999 1025
    */
1000 1026
   function get_word_spacing() {
1001
-    if ( $this->_props["word_spacing"] === "normal" )
1002
-      return 0;
1027
+    if ( $this->_props["word_spacing"] === "normal" ) {
1028
+          return 0;
1029
+    }
1003 1030
 
1004 1031
     return $this->_props["word_spacing"];
1005 1032
   }
@@ -1009,11 +1036,13 @@  discard block
 block discarded – undo
1009 1036
    * @return float
1010 1037
    */
1011 1038
   function get_line_height() {
1012
-    if ( $this->_props["line_height"] === "normal" )
1013
-      return self::$default_line_height * $this->get_font_size();
1039
+    if ( $this->_props["line_height"] === "normal" ) {
1040
+          return self::$default_line_height * $this->get_font_size();
1041
+    }
1014 1042
 
1015
-    if ( is_numeric($this->_props["line_height"]) )
1016
-      return $this->length_in_pt( $this->_props["line_height"] . "%", $this->get_font_size());
1043
+    if ( is_numeric($this->_props["line_height"]) ) {
1044
+          return $this->length_in_pt( $this->_props["line_height"] . "%", $this->get_font_size());
1045
+    }
1017 1046
     
1018 1047
     return $this->length_in_pt( $this->_props["line_height"], $this->get_font_size() );
1019 1048
   }
@@ -1104,10 +1133,11 @@  discard block
 block discarded – undo
1104 1133
         break;
1105 1134
         
1106 1135
       case "center":
1107
-        if ( $tmp[0] === "left" || $tmp[0] === "right" || $tmp[0] === "center" )
1108
-          $y = "50%";
1109
-        else
1110
-          $x = "50%";
1136
+        if ( $tmp[0] === "left" || $tmp[0] === "right" || $tmp[0] === "center" ) {
1137
+                  $y = "50%";
1138
+        } else {
1139
+                  $x = "50%";
1140
+        }
1111 1141
         break;
1112 1142
         
1113 1143
       default:
@@ -1119,11 +1149,13 @@  discard block
 block discarded – undo
1119 1149
       $y = "50%";
1120 1150
     }
1121 1151
 
1122
-    if ( !isset($x) )
1123
-      $x = "0%";
1152
+    if ( !isset($x) ) {
1153
+          $x = "0%";
1154
+    }
1124 1155
 
1125
-    if ( !isset($y) )
1126
-      $y = "0%";
1156
+    if ( !isset($y) ) {
1157
+          $y = "0%";
1158
+    }
1127 1159
 
1128 1160
     return array( 0 => $x, "x" => $x,
1129 1161
                   1 => $y, "y" => $y );
@@ -1477,8 +1509,9 @@  discard block
 block discarded – undo
1477 1509
   function set_color($colour) {
1478 1510
     $col = $this->munge_colour($colour);
1479 1511
 
1480
-    if ( is_null($col) )
1481
-      $col = self::$_defaults["color"];
1512
+    if ( is_null($col) ) {
1513
+          $col = self::$_defaults["color"];
1514
+    }
1482 1515
 
1483 1516
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1484 1517
 	$this->_prop_cache["color"] = null;
@@ -1493,8 +1526,9 @@  discard block
 block discarded – undo
1493 1526
    */
1494 1527
   function set_background_color($colour) {
1495 1528
     $col = $this->munge_colour($colour);
1496
-    if ( is_null($col) )
1497
-      $col = self::$_defaults["background_color"];
1529
+    if ( is_null($col) ) {
1530
+          $col = self::$_defaults["background_color"];
1531
+    }
1498 1532
 
1499 1533
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1500 1534
 	$this->_prop_cache["background_color"] = null;
@@ -1520,8 +1554,9 @@  discard block
 block discarded – undo
1520 1554
    * @param string $val
1521 1555
    */
1522 1556
   function set_background_repeat($val) {
1523
-    if ( is_null($val) )
1524
-      $val = self::$_defaults["background_repeat"];
1557
+    if ( is_null($val) ) {
1558
+          $val = self::$_defaults["background_repeat"];
1559
+    }
1525 1560
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1526 1561
     $this->_prop_cache["background_repeat"] = null;
1527 1562
     $this->_props["background_repeat"] = $val;
@@ -1534,8 +1569,9 @@  discard block
 block discarded – undo
1534 1569
    * @param string $val
1535 1570
    */
1536 1571
   function set_background_attachment($val) {
1537
-    if ( is_null($val) )
1538
-      $val = self::$_defaults["background_attachment"];
1572
+    if ( is_null($val) ) {
1573
+          $val = self::$_defaults["background_attachment"];
1574
+    }
1539 1575
 
1540 1576
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1541 1577
 	$this->_prop_cache["background_attachment"] = null;
@@ -1549,8 +1585,9 @@  discard block
 block discarded – undo
1549 1585
    * @param string $val
1550 1586
    */
1551 1587
   function set_background_position($val) {
1552
-    if ( is_null($val) )
1553
-      $val = self::$_defaults["background_position"];
1588
+    if ( is_null($val) ) {
1589
+          $val = self::$_defaults["background_position"];
1590
+    }
1554 1591
 
1555 1592
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1556 1593
 	$this->_prop_cache["background_position"] = null;
@@ -1688,8 +1725,9 @@  discard block
 block discarded – undo
1688 1725
    * @param string $break
1689 1726
    */
1690 1727
   function set_page_break_before($break) {
1691
-    if ($break === "left" || $break === "right")
1692
-      $break = "always";
1728
+    if ($break === "left" || $break === "right") {
1729
+          $break = "always";
1730
+    }
1693 1731
 
1694 1732
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1695 1733
 	$this->_prop_cache["page_break_before"] = null;
@@ -1697,8 +1735,9 @@  discard block
 block discarded – undo
1697 1735
   }
1698 1736
 
1699 1737
   function set_page_break_after($break) {
1700
-    if ($break === "left" || $break === "right")
1701
-      $break = "always";
1738
+    if ($break === "left" || $break === "right") {
1739
+          $break = "always";
1740
+    }
1702 1741
 
1703 1742
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1704 1743
 	$this->_prop_cache["page_break_after"] = null;
@@ -1847,8 +1886,9 @@  discard block
 block discarded – undo
1847 1886
 
1848 1887
     $arr = explode(" ", $val);
1849 1888
 
1850
-    if ( count($arr) == 1 )
1851
-      $arr[1] = $arr[0];
1889
+    if ( count($arr) == 1 ) {
1890
+          $arr[1] = $arr[0];
1891
+    }
1852 1892
 
1853 1893
     //see __set and __get, on all assignments clear cache, not needed on direct set through __set
1854 1894
 	$this->_prop_cache["border_spacing"] = null;
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_frame_reflower.cls.php 1 patch
Braces   +110 added lines, -81 removed lines patch added patch discarded remove patch
@@ -112,25 +112,29 @@  discard block
 block discarded – undo
112 112
 
113 113
       $preferred_width = $style->length_in_pt($width, $cb["w"]) - $delta;
114 114
 
115
-      if ( $preferred_width < $min_table_width )
116
-        $preferred_width = $min_table_width;
115
+      if ( $preferred_width < $min_table_width ) {
116
+              $preferred_width = $min_table_width;
117
+      }
117 118
 
118
-      if ( $preferred_width > $min_width )
119
-        $width = $preferred_width;
120
-      else
121
-        $width = $min_width;
119
+      if ( $preferred_width > $min_width ) {
120
+              $width = $preferred_width;
121
+      } else {
122
+              $width = $min_width;
123
+      }
122 124
 
123 125
     } else {
124 126
 
125
-      if ( $max_width + $delta < $cb["w"] )
126
-        $width = $max_width;
127
-      else if ( $cb["w"] - $delta > $min_width )
128
-        $width = $cb["w"] - $delta;
129
-      else
130
-        $width = $min_width;
127
+      if ( $max_width + $delta < $cb["w"] ) {
128
+              $width = $max_width;
129
+      } else if ( $cb["w"] - $delta > $min_width ) {
130
+              $width = $cb["w"] - $delta;
131
+      } else {
132
+              $width = $min_width;
133
+      }
131 134
 
132
-      if ( $width < $min_table_width )
133
-        $width = $min_table_width;
135
+      if ( $width < $min_table_width ) {
136
+              $width = $min_table_width;
137
+      }
134 138
 
135 139
     }
136 140
 
@@ -142,8 +146,9 @@  discard block
 block discarded – undo
142 146
     // If the whole table fits on the page, then assign each column it's max width
143 147
     if ( $width == $max_width ) {
144 148
 
145
-      foreach (array_keys($columns) as $i)
146
-        $cellmap->set_column_width($i, $columns[$i]["max-width"]);
149
+      foreach (array_keys($columns) as $i) {
150
+              $cellmap->set_column_width($i, $columns[$i]["max-width"]);
151
+      }
147 152
 
148 153
       return;
149 154
     }
@@ -171,8 +176,9 @@  discard block
 block discarded – undo
171 176
       if ( $absolute_used == 0 && $percent_used == 0 ) {
172 177
         $increment = $width - $min_width;
173 178
 
174
-        foreach (array_keys($columns) as $i)
175
-          $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width));
179
+        foreach (array_keys($columns) as $i) {
180
+                  $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width));
181
+        }
176 182
         return;
177 183
       }
178 184
 
@@ -180,17 +186,18 @@  discard block
 block discarded – undo
180 186
       // Case 2
181 187
       if ( $absolute_used > 0 && $percent_used == 0 ) {
182 188
 
183
-        if ( count($auto) > 0 )
184
-          $increment = ($width - $auto_min - $absolute_used) / count($auto);
189
+        if ( count($auto) > 0 ) {
190
+                  $increment = ($width - $auto_min - $absolute_used) / count($auto);
191
+        }
185 192
 
186 193
         // Use the absolutely specified width or the increment
187 194
         foreach (array_keys($columns) as $i) {
188 195
 
189
-          if ( $columns[$i]["absolute"] > 0 && count($auto) )
190
-            $cellmap->set_column_width($i, $columns[$i]["min-width"]);
191
-          else if ( count($auto) ) 
192
-            $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment);
193
-          else {
196
+          if ( $columns[$i]["absolute"] > 0 && count($auto) ) {
197
+                      $cellmap->set_column_width($i, $columns[$i]["min-width"]);
198
+          } else if ( count($auto) ) {
199
+                      $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment);
200
+          } else {
194 201
             // All absolute columns
195 202
             $increment = ($width - $absolute_used) * $columns[$i]["absolute"] / $absolute_used;
196 203
 
@@ -210,10 +217,11 @@  discard block
 block discarded – undo
210 217
 
211 218
         // Scale percent values if the total percentage is > 100, or if all
212 219
         // values are specified as percentages.
213
-        if ( $percent_used > 100 || count($auto) == 0)
214
-          $scale = 100 / $percent_used;
215
-        else
216
-          $scale = 1;
220
+        if ( $percent_used > 100 || count($auto) == 0) {
221
+                  $scale = 100 / $percent_used;
222
+        } else {
223
+                  $scale = 1;
224
+        }
217 225
 
218 226
         // Account for the minimum space used by the unassigned auto columns
219 227
         $used_width = $auto_min;
@@ -225,8 +233,9 @@  discard block
 block discarded – undo
225 233
 
226 234
           $w = min($columns[$i]["percent"] * $width/100, $slack);
227 235
 
228
-          if ( $w < $columns[$i]["min-width"] )
229
-            $w = $columns[$i]["min-width"];
236
+          if ( $w < $columns[$i]["min-width"] ) {
237
+                      $w = $columns[$i]["min-width"];
238
+          }
230 239
 
231 240
           $cellmap->set_column_width($i, $w);
232 241
           $used_width += $w;
@@ -238,8 +247,9 @@  discard block
 block discarded – undo
238 247
         if ( count($auto) > 0 ) {
239 248
           $increment = ($width - $used_width) / count($auto);
240 249
 
241
-          foreach ($auto as $i)
242
-            $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment);
250
+          foreach ($auto as $i) {
251
+                      $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment);
252
+          }
243 253
 
244 254
         }
245 255
         return;
@@ -259,10 +269,11 @@  discard block
 block discarded – undo
259 269
 
260 270
         // Scale percent values if the total percentage is > 100 or there
261 271
         // are no auto values to take up slack
262
-        if ( $percent_used > 100 || count($auto) == 0 )
263
-          $scale = 100 / $percent_used;
264
-        else
265
-          $scale = 1;
272
+        if ( $percent_used > 100 || count($auto) == 0 ) {
273
+                  $scale = 100 / $percent_used;
274
+        } else {
275
+                  $scale = 1;
276
+        }
266 277
 
267 278
         $remaining_width = $width - $used_width;
268 279
 
@@ -272,8 +283,9 @@  discard block
 block discarded – undo
272 283
           $columns[$i]["percent"] *= $scale;
273 284
           $w = min($columns[$i]["percent"] * $remaining_width / 100, $slack);
274 285
 
275
-          if ( $w < $columns[$i]["min-width"] )
276
-            $w = $columns[$i]["min-width"];
286
+          if ( $w < $columns[$i]["min-width"] ) {
287
+                      $w = $columns[$i]["min-width"];
288
+          }
277 289
 
278 290
           $columns[$i]["used-width"] = $w;
279 291
           $used_width += $w;
@@ -282,8 +294,9 @@  discard block
 block discarded – undo
282 294
         if ( count($auto) > 0 ) {
283 295
           $increment = ($width - $used_width) / count($auto);
284 296
 
285
-          foreach ($auto as $i)
286
-            $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment);
297
+          foreach ($auto as $i) {
298
+                      $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment);
299
+          }
287 300
 
288 301
         }
289 302
 
@@ -294,8 +307,9 @@  discard block
 block discarded – undo
294 307
     } else { // we are over constrained
295 308
 
296 309
       // Each column gets its minimum width
297
-      foreach (array_keys($columns) as $i)
298
-        $cellmap->set_column_width($i, $columns[$i]["min-width"]);
310
+      foreach (array_keys($columns) as $i) {
311
+              $cellmap->set_column_width($i, $columns[$i]["min-width"]);
312
+      }
299 313
 
300 314
     }
301 315
   }
@@ -314,8 +328,9 @@  discard block
 block discarded – undo
314 328
 
315 329
     // Determine our content height
316 330
     $content_height = 0;
317
-    foreach ( $rows as $r )
318
-      $content_height += $r["height"];
331
+    foreach ( $rows as $r ) {
332
+          $content_height += $r["height"];
333
+    }
319 334
 
320 335
     $cb = $this->_frame->get_containing_block();
321 336
 
@@ -333,26 +348,31 @@  discard block
 block discarded – undo
333 348
 
334 349
       } else if ( isset($cb["w"]) ) {
335 350
 
336
-        if ( mb_strpos($min_height, "%") !== false )
337
-          $min_height = 0;
338
-        else
339
-          $min_height = $style->length_in_pt($min_height, $cb["w"]);
351
+        if ( mb_strpos($min_height, "%") !== false ) {
352
+                  $min_height = 0;
353
+        } else {
354
+                  $min_height = $style->length_in_pt($min_height, $cb["w"]);
355
+        }
340 356
 
341
-        if ( mb_strpos($max_height, "%") !== false )
342
-          $max_height = "none";
343
-        else
344
-          $max_height = $style->length_in_pt($max_height, $cb["w"]);
357
+        if ( mb_strpos($max_height, "%") !== false ) {
358
+                  $max_height = "none";
359
+        } else {
360
+                  $max_height = $style->length_in_pt($max_height, $cb["w"]);
361
+        }
345 362
       }
346 363
 
347
-      if ( $max_height !== "none" && $min_height > $max_height )
348
-        // Swap 'em
364
+      if ( $max_height !== "none" && $min_height > $max_height ) {
365
+              // Swap 'em
349 366
         list($max_height, $min_height) = array($min_height, $max_height);
367
+      }
350 368
 
351
-      if ( $max_height !== "none" && $height > $max_height )
352
-        $height = $max_height;
369
+      if ( $max_height !== "none" && $height > $max_height ) {
370
+              $height = $max_height;
371
+      }
353 372
 
354
-      if ( $height < $min_height )
355
-        $height = $min_height;
373
+      if ( $height < $min_height ) {
374
+              $height = $min_height;
375
+      }
356 376
 
357 377
     } else {
358 378
 
@@ -360,13 +380,15 @@  discard block
 block discarded – undo
360 380
       if ( $height !== "auto" ) {
361 381
         $height = $style->length_in_pt($height, $cb["h"]);
362 382
 
363
-        if ( $height <= $content_height )
364
-          $height = $content_height;
365
-        else
366
-          $cellmap->set_frame_heights($height,$content_height);
383
+        if ( $height <= $content_height ) {
384
+                  $height = $content_height;
385
+        } else {
386
+                  $cellmap->set_frame_heights($height,$content_height);
387
+        }
367 388
 
368
-      } else
369
-        $height = $content_height;
389
+      } else {
390
+              $height = $content_height;
391
+      }
370 392
 
371 393
     }
372 394
 
@@ -382,8 +404,9 @@  discard block
 block discarded – undo
382 404
     $page->check_forced_page_break($this->_frame);
383 405
 
384 406
     // Bail if the page is full
385
-    if ( $page->is_full() )
386
-      return;
407
+    if ( $page->is_full() ) {
408
+          return;
409
+    }
387 410
     
388 411
     // Let the page know that we're reflowing a table so that splits
389 412
     // are suppressed (simply setting page-break-inside: avoid won't
@@ -400,8 +423,9 @@  discard block
 block discarded – undo
400 423
     // Table layout algorithm:
401 424
     // http://www.w3.org/TR/CSS21/tables.html#auto-table-layout
402 425
 
403
-    if ( is_null($this->_state) )
404
-      $this->get_min_max_width();
426
+    if ( is_null($this->_state) ) {
427
+          $this->get_min_max_width();
428
+    }
405 429
 
406 430
     $cb = $this->_frame->get_containing_block();
407 431
     $style = $this->_frame->get_style();
@@ -455,10 +479,11 @@  discard block
 block discarded – undo
455 479
                                                  $style->border_top_width,
456 480
                                                  $style->padding_top), $cb["w"]);
457 481
 
458
-    if ( isset($cb["h"]) )
459
-      $h = $cb["h"];
460
-    else
461
-      $h = null;
482
+    if ( isset($cb["h"]) ) {
483
+          $h = $cb["h"];
484
+    } else {
485
+          $h = null;
486
+    }
462 487
 
463 488
 
464 489
     $cellmap = $this->_frame->get_cellmap();
@@ -474,15 +499,17 @@  discard block
 block discarded – undo
474 499
     foreach ( $this->_frame->get_children() as $child ) {
475 500
 
476 501
       // Bail if the page is full
477
-      if ( !$page->in_nested_table() && $page->is_full() )
478
-        break;
502
+      if ( !$page->in_nested_table() && $page->is_full() ) {
503
+              break;
504
+      }
479 505
 
480 506
       $child->set_containing_block($content_x, $content_y, $width, $h);
481 507
       $child->reflow();
482 508
 
483
-      if ( !$page->in_nested_table() )
484
-        // Check if a split has occured
509
+      if ( !$page->in_nested_table() ) {
510
+              // Check if a split has occured
485 511
         $page->check_page_break($child);
512
+      }
486 513
 
487 514
     }
488 515
 
@@ -504,8 +531,9 @@  discard block
 block discarded – undo
504 531
 
505 532
   function get_min_max_width() {
506 533
 
507
-    if ( !is_null($this->_min_max_cache)  )
508
-      return $this->_min_max_cache;
534
+    if ( !is_null($this->_min_max_cache)  ) {
535
+          return $this->_min_max_cache;
536
+    }
509 537
 
510 538
     $style = $this->_frame->get_style();
511 539
 
@@ -556,8 +584,9 @@  discard block
 block discarded – undo
556 584
                   $style->margin_left,
557 585
                   $style->margin_right);
558 586
 
559
-    if ( $style->border_collapse !== "collapse" ) 
560
-      list($dims[]) = $style->border_spacing;
587
+    if ( $style->border_collapse !== "collapse" ) {
588
+          list($dims[]) = $style->border_spacing;
589
+    }
561 590
 
562 591
     $delta = $style->length_in_pt($dims, $this->_frame->get_containing_block("w"));
563 592
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/load_font.php 1 patch
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -109,8 +109,9 @@  discard block
 block discarded – undo
109 109
 function install_font_family($fontname, $normal, $bold = null, $italic = null, $bold_italic = null) {
110 110
 
111 111
   // Check if the base filename is readable
112
-  if ( !is_readable($normal) )
113
-    throw new DOMPDF_Exception("Unable to read '$normal'.");
112
+  if ( !is_readable($normal) ) {
113
+      throw new DOMPDF_Exception("Unable to read '$normal'.");
114
+  }
114 115
 
115 116
   $dir = dirname($normal);
116 117
   $basename = basename($normal);
@@ -135,14 +136,16 @@  discard block
 block discarded – undo
135 136
 
136 137
         // Try $file . "B"
137 138
         $bold = $dir . "/" . $file . "B" . $ext;
138
-        if ( !is_readable($bold) )
139
-          $bold = null;
139
+        if ( !is_readable($bold) ) {
140
+                  $bold = null;
141
+        }
140 142
       }
141 143
     }
142 144
   }
143 145
 
144
-  if ( is_null($bold) )
145
-    echo ("Unable to find bold face file.\n");
146
+  if ( is_null($bold) ) {
147
+      echo ("Unable to find bold face file.\n");
148
+  }
146 149
 
147 150
   if ( !isset($italic) || !is_readable($italic) ) {
148 151
     $italic = $dir . "/" . $file . "_Italic" . $ext;
@@ -154,14 +157,16 @@  discard block
 block discarded – undo
154 157
 
155 158
         // Try $file . "I"
156 159
         $italic = $dir . "/" . $file . "I" . $ext;
157
-        if ( !is_readable($italic) )
158
-          $italic = null;
160
+        if ( !is_readable($italic) ) {
161
+                  $italic = null;
162
+        }
159 163
       }
160 164
     }
161 165
   }
162 166
 
163
-  if ( is_null($italic) )
164
-    echo ("Unable to find italic face file.\n");
167
+  if ( is_null($italic) ) {
168
+      echo ("Unable to find italic face file.\n");
169
+  }
165 170
 
166 171
   if ( !isset($bold_italic) || !is_readable($bold_italic) ) {
167 172
     $bold_italic = $dir . "/" . $file . "_Bold_Italic" . $ext;
@@ -182,16 +187,18 @@  discard block
 block discarded – undo
182 187
 
183 188
             // Try $file . "IB"
184 189
             $bold_italic = $dir . "/" . $file . "IB" . $ext;
185
-            if ( !is_readable($bold_italic) )
186
-              $bold_italic = null;
190
+            if ( !is_readable($bold_italic) ) {
191
+                          $bold_italic = null;
192
+            }
187 193
           }
188 194
         }
189 195
       }
190 196
     }
191 197
   }
192 198
 
193
-  if ( is_null($bold_italic) )
194
-    echo ("Unable to find bold italic face file.\n");
199
+  if ( is_null($bold_italic) ) {
200
+      echo ("Unable to find bold italic face file.\n");
201
+  }
195 202
 
196 203
   $fonts = compact("normal", "bold", "italic", "bold_italic");
197 204
   $entry = array();
@@ -207,23 +214,27 @@  discard block
 block discarded – undo
207 214
       }
208 215
 
209 216
       // Verify that the fonts exist and are readable
210
-      if ( !is_readable($src) )
211
-        throw new User_DOMPDF_Exception("Requested font '$pathname' is not readable");
217
+      if ( !is_readable($src) ) {
218
+              throw new User_DOMPDF_Exception("Requested font '$pathname' is not readable");
219
+      }
212 220
 
213 221
       $dest = DOMPDF_FONT_DIR . basename($src);
214
-      if ( !is_writeable(dirname($dest)) )
215
-        throw new User_DOMPDF_Exception("Unable to write to destination '$dest'.");
222
+      if ( !is_writeable(dirname($dest)) ) {
223
+              throw new User_DOMPDF_Exception("Unable to write to destination '$dest'.");
224
+      }
216 225
 
217 226
       echo "Copying $src to $dest...\n";
218 227
 
219
-      if ( !copy($src, $dest) )
220
-        throw new DOMPDF_Exception("Unable to copy '$src' to '" . DOMPDF_FONT_DIR . "$dest'.");
228
+      if ( !copy($src, $dest) ) {
229
+              throw new DOMPDF_Exception("Unable to copy '$src' to '" . DOMPDF_FONT_DIR . "$dest'.");
230
+      }
221 231
 
222 232
       $entry[$var] = $dest;
223 233
     }
224 234
 
225
-  } else
226
-    throw new DOMPDF_Exception("Unable to process fonts of type '$ext'.");
235
+  } else {
236
+      throw new DOMPDF_Exception("Unable to process fonts of type '$ext'.");
237
+  }
227 238
 
228 239
 
229 240
   // If the extension is a ttf, try and convert the fonts to afm too
Please login to merge, or discard this patch.