Passed
Push — 1.10.x ( 08890a...2189d7 )
by Yannick
116:38 queued 75:46
created
main/inc/lib/phpdocx/pdf/www/examples.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,9 @@  discard block
 block discarded – undo
3 3
 require_once("../dompdf_config.inc.php");
4 4
 if ( isset( $_POST["html"] ) ) {
5 5
 
6
-  if ( get_magic_quotes_gpc() )
7
-    $_POST["html"] = stripslashes($_POST["html"]);
6
+  if ( get_magic_quotes_gpc() ) {
7
+      $_POST["html"] = stripslashes($_POST["html"]);
8
+  }
8 9
   
9 10
   $dompdf = new DOMPDF();
10 11
   $dompdf->load_html($_POST["html"]);
@@ -68,8 +69,9 @@  discard block
 block discarded – undo
68 69
 <p>Paper size and orientaion:
69 70
 <select name="paper">
70 71
 <?php
71
-foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size )
72
+foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size ) {
72 73
   echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n";
74
+}
73 75
 ?>
74 76
 </select>
75 77
 <select name="orientation">
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/inline_positioner.cls.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,9 @@
 block discarded – undo
64 64
 
65 65
     // End debugging
66 66
 
67
-    if ( !$p )
68
-      throw new DOMPDF_Exception("No block-level parent found.  Not good.");
67
+    if ( !$p ) {
68
+          throw new DOMPDF_Exception("No block-level parent found.  Not good.");
69
+    }
69 70
 
70 71
     $line = $p->get_current_line();
71 72
     
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/image_cache.cls.php 1 patch
Braces   +36 added lines, -13 removed lines patch added patch discarded remove patch
@@ -88,7 +88,9 @@  discard block
 block discarded – undo
88 88
     $full_url_dbg = '';
89 89
     
90 90
     //debugpng
91
-    if ($DEBUGPNG) print 'resolve_url('.$url.','.$proto.','.$host.','.$base_path.')('.$parsed_url['protocol'].')';
91
+    if ($DEBUGPNG) {
92
+        print 'resolve_url('.$url.','.$proto.','.$host.','.$base_path.')('.$parsed_url['protocol'].')';
93
+    }
92 94
 
93 95
     $remote = ($proto != "" && $proto !== "file://");
94 96
     $remote = $remote || ($parsed_url['protocol'] != "");
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
       $ext = "png";
99 101
 
100 102
       //debugpng
101
-      if ($DEBUGPNG) $full_url_dbg = '(blockedremote)';
103
+      if ($DEBUGPNG) {
104
+          $full_url_dbg = '(blockedremote)';
105
+      }
102 106
 
103 107
     } else if ( DOMPDF_ENABLE_REMOTE && $remote ) {
104 108
       // Download remote files to a temporary directory
@@ -108,13 +112,17 @@  discard block
 block discarded – undo
108 112
         list($resolved_url,$ext) = self::$_cache[$full_url];
109 113
 
110 114
         //debugpng
111
-        if ($DEBUGPNG) $full_url_dbg = $full_url.'(cache)';
115
+        if ($DEBUGPNG) {
116
+            $full_url_dbg = $full_url.'(cache)';
117
+        }
112 118
 
113 119
       } else {
114 120
 
115 121
         $resolved_url = tempnam(DOMPDF_TEMP_DIR, "ca_dompdf_img_");
116 122
         //debugpng
117
-        if ($DEBUGPNG) echo $resolved_url . "\n";
123
+        if ($DEBUGPNG) {
124
+            echo $resolved_url . "\n";
125
+        }
118 126
 
119 127
         $old_err = set_error_handler("record_warnings");
120 128
         $image = file_get_contents($full_url);
@@ -126,7 +134,9 @@  discard block
 block discarded – undo
126 134
           $ext = "png";
127 135
 
128 136
           //debugpng
129
-          if ($DEBUGPNG) $full_url_dbg = $full_url.'(missing)';
137
+          if ($DEBUGPNG) {
138
+              $full_url_dbg = $full_url.'(missing)';
139
+          }
130 140
 
131 141
         } else {
132 142
 
@@ -167,25 +177,33 @@  discard block
 block discarded – undo
167 177
     } else {
168 178
 
169 179
       $resolved_url = build_url($proto, $host, $base_path, $url);
170
-      if ($DEBUGPNG) print 'build_url('.$proto.','.$host.','.$base_path.','.$url.')('.$resolved_url.')';
180
+      if ($DEBUGPNG) {
181
+          print 'build_url('.$proto.','.$host.','.$base_path.','.$url.')('.$resolved_url.')';
182
+      }
171 183
 
172 184
       if ( !preg_match("/.*\.(\w+)/",$url,$match) ) {
173 185
         //debugpng
174
-        if ($DEBUGPNG) print '[resolve_url exception '.$url.']';
186
+        if ($DEBUGPNG) {
187
+            print '[resolve_url exception '.$url.']';
188
+        }
175 189
           throw new DOMPDF_Exception("Unknown image type: $url.");
176 190
         }
177 191
 
178 192
         $ext = $match[1];
179 193
 
180 194
         //debugpng
181
-        if ($DEBUGPNG) $full_url_dbg = '(local)';
195
+        if ($DEBUGPNG) {
196
+            $full_url_dbg = '(local)';
197
+        }
182 198
 
183 199
     }
184 200
 
185 201
     if ( !is_readable($resolved_url) || !filesize($resolved_url) ) {
186 202
 
187 203
       //debugpng
188
-      if ($DEBUGPNG) $full_url_dbg .= '(nocache'.$resolved_url.')';
204
+      if ($DEBUGPNG) {
205
+          $full_url_dbg .= '(nocache'.$resolved_url.')';
206
+      }
189 207
 
190 208
       $_dompdf_warnings[] = "File " .$resolved_url . " is not readable or is an empty file.\n";
191 209
       $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
@@ -193,7 +211,9 @@  discard block
 block discarded – undo
193 211
     }
194 212
 
195 213
     //debugpng
196
-    if ($DEBUGPNG) print '[resolve_url '.$url.'|'.$full_url_dbg.'|'.$resolved_url.'|'.$ext.']';
214
+    if ($DEBUGPNG) {
215
+        print '[resolve_url '.$url.'|'.$full_url_dbg.'|'.$resolved_url.'|'.$ext.']';
216
+    }
197 217
 
198 218
     return array($resolved_url, $ext);
199 219
   }
@@ -207,10 +227,13 @@  discard block
 block discarded – undo
207 227
       while ($entry = array_shift(self::$_cache)) {
208 228
         list($file, $ext) = $entry;
209 229
         //debugpng
210
-        if (DEBUGPNG) print '[clear unlink '.$file.']';
211
-        if (!DEBUGKEEPTEMP)
212
-          //XXX: Should we have some kind of fallback or warning if unlink() fails?
230
+        if (DEBUGPNG) {
231
+            print '[clear unlink '.$file.']';
232
+        }
233
+        if (!DEBUGKEEPTEMP) {
234
+                  //XXX: Should we have some kind of fallback or warning if unlink() fails?
213 235
           unlink($file);
236
+        }
214 237
       }
215 238
     }
216 239
   }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/image_frame_decorator.cls.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@
 block discarded – undo
80 80
     $url = $frame->get_node()->getAttribute("src");
81 81
       
82 82
     //debugpng
83
-    if (DEBUGPNG) print '[__construct '.$url.']';
83
+    if (DEBUGPNG) {
84
+        print '[__construct '.$url.']';
85
+    }
84 86
 
85 87
     list($this->_image_url, $this->_image_ext) = Image_Cache::resolve_url($url,
86 88
                                                                           $dompdf->get_protocol(),
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame.cls.php 1 patch
Braces   +87 added lines, -58 removed lines patch added patch discarded remove patch
@@ -182,8 +182,9 @@  discard block
 block discarded – undo
182 182
   function dispose($recursive = false) {
183 183
 
184 184
     if ( $recursive ) {
185
-      while ( $child = $this->_first_child )
186
-        $child->dispose(true);
185
+      while ( $child = $this->_first_child ) {
186
+              $child->dispose(true);
187
+      }
187 188
     }
188 189
 
189 190
     // Remove this frame from the tree
@@ -246,14 +247,16 @@  discard block
 block discarded – undo
246 247
   
247 248
   // Layout property accessors
248 249
   function get_containing_block($i = null) {
249
-    if ( isset($i) )
250
-      return $this->_containing_block[$i];    
250
+    if ( isset($i) ) {
251
+          return $this->_containing_block[$i];
252
+    }
251 253
     return $this->_containing_block;
252 254
   }
253 255
   
254 256
   function get_position($i = null) {
255
-    if ( isset($i) )
256
-      return $this->_position[$i];
257
+    if ( isset($i) ) {
258
+          return $this->_position[$i];
259
+    }
257 260
     return array($this->_position["x"],
258 261
                  $this->_position["y"],
259 262
                  "x"=>$this->_position["x"],
@@ -354,13 +357,15 @@  discard block
 block discarded – undo
354 357
     // We can only set attributes of DOMElement objects (nodeType == 1).
355 358
     // Since these are the only objects that we can assign CSS rules to,
356 359
     // this shortcoming is okay.
357
-    if ( $this->_node->nodeType == 1)
358
-      $this->_node->setAttribute("frame_id", $id);
360
+    if ( $this->_node->nodeType == 1) {
361
+          $this->_node->setAttribute("frame_id", $id);
362
+    }
359 363
   }
360 364
 
361 365
   function set_style(Style $style) {
362
-    if ( is_null($this->_style) )
363
-      $this->_original_style = clone $style;
366
+    if ( is_null($this->_style) ) {
367
+          $this->_original_style = clone $style;
368
+    }
364 369
     
365 370
     $this->_style = $style;
366 371
   }
@@ -399,8 +404,9 @@  discard block
 block discarded – undo
399 404
   }
400 405
 
401 406
   function set_position($x = null, $y = null) {
402
-    if ( is_array($x) )
403
-      extract($x);
407
+    if ( is_array($x) ) {
408
+          extract($x);
409
+    }
404 410
     
405 411
     if ( is_numeric($x) ) {
406 412
       $this->_position[0] = $x;
@@ -417,12 +423,14 @@  discard block
 block discarded – undo
417 423
 
418 424
   function prepend_child(Frame $child, $update_node = true) {
419 425
 
420
-    if ( $update_node ) 
421
-      $this->_node->insertBefore($child->_node, $this->_first_child ? $this->_first_child->_node : null);
426
+    if ( $update_node ) {
427
+          $this->_node->insertBefore($child->_node, $this->_first_child ? $this->_first_child->_node : null);
428
+    }
422 429
 
423 430
     // Remove the child from its parent
424
-    if ( $child->_parent )
425
-      $child->_parent->remove_child($child, false);
431
+    if ( $child->_parent ) {
432
+          $child->_parent->remove_child($child, false);
433
+    }
426 434
     
427 435
     $child->_parent = $this;
428 436
     $child->_prev_sibling = null;
@@ -444,12 +452,14 @@  discard block
 block discarded – undo
444 452
   
445 453
   function append_child(Frame $child, $update_node = true) {
446 454
 
447
-    if ( $update_node ) 
448
-      $this->_node->appendChild($child->_node);
455
+    if ( $update_node ) {
456
+          $this->_node->appendChild($child->_node);
457
+    }
449 458
 
450 459
     // Remove the child from its parent
451
-    if ( $child->_parent )
452
-      $child->_parent->remove_child($child, false);
460
+    if ( $child->_parent ) {
461
+          $child->_parent->remove_child($child, false);
462
+    }
453 463
 
454 464
     $child->_parent = $this;
455 465
     $child->_next_sibling = null;
@@ -482,23 +492,27 @@  discard block
 block discarded – undo
482 492
       return;
483 493
     }
484 494
     
485
-    if ( $ref->_parent !== $this )
486
-      throw new DOMPDF_Exception("Reference child is not a child of this node.");
495
+    if ( $ref->_parent !== $this ) {
496
+          throw new DOMPDF_Exception("Reference child is not a child of this node.");
497
+    }
487 498
 
488 499
     // Update the node    
489
-    if ( $update_node )
490
-      $this->_node->insertBefore($new_child->_node, $ref->_node);
500
+    if ( $update_node ) {
501
+          $this->_node->insertBefore($new_child->_node, $ref->_node);
502
+    }
491 503
 
492 504
     // Remove the child from its parent
493
-    if ( $new_child->_parent )
494
-      $new_child->_parent->remove_child($new_child, false);
505
+    if ( $new_child->_parent ) {
506
+          $new_child->_parent->remove_child($new_child, false);
507
+    }
495 508
     
496 509
     $new_child->_parent = $this;
497 510
     $new_child->_next_sibling = $ref;
498 511
     $new_child->_prev_sibling = $ref->_prev_sibling;
499 512
 
500
-    if ( $ref->_prev_sibling )
501
-      $ref->_prev_sibling->_next_sibling = $new_child;
513
+    if ( $ref->_prev_sibling ) {
514
+          $ref->_prev_sibling->_next_sibling = $new_child;
515
+    }
502 516
     
503 517
     $ref->_prev_sibling = $new_child;
504 518
   }
@@ -516,8 +530,9 @@  discard block
 block discarded – undo
516 530
       return;
517 531
     }
518 532
     
519
-    if ( $ref->_parent !== $this )
520
-      throw new DOMPDF_Exception("Reference child is not a child of this node.");
533
+    if ( $ref->_parent !== $this ) {
534
+          throw new DOMPDF_Exception("Reference child is not a child of this node.");
535
+    }
521 536
 
522 537
     // Update the node
523 538
     if ( $update_node ) {
@@ -530,15 +545,17 @@  discard block
 block discarded – undo
530 545
     }
531 546
     
532 547
     // Remove the child from its parent
533
-    if ( $new_child->_parent)
534
-      $new_child->_parent->remove_child($new_child, false);
548
+    if ( $new_child->_parent) {
549
+          $new_child->_parent->remove_child($new_child, false);
550
+    }
535 551
     
536 552
     $new_child->_parent = $this;
537 553
     $new_child->_prev_sibling = $ref;
538 554
     $new_child->_next_sibling = $ref->_next_sibling;
539 555
 
540
-    if ( $ref->_next_sibling ) 
541
-      $ref->_next_sibling->_prev_sibling = $new_child;
556
+    if ( $ref->_next_sibling ) {
557
+          $ref->_next_sibling->_prev_sibling = $new_child;
558
+    }
542 559
 
543 560
     $ref->_next_sibling = $new_child;
544 561
   }
@@ -546,23 +563,29 @@  discard block
 block discarded – undo
546 563
 
547 564
   function remove_child(Frame $child, $update_node = true) {
548 565
 
549
-    if ( $child->_parent !== $this )
550
-      throw new DOMPDF_Exception("Child not found in this frame");
566
+    if ( $child->_parent !== $this ) {
567
+          throw new DOMPDF_Exception("Child not found in this frame");
568
+    }
551 569
 
552
-    if ( $update_node )
553
-      $this->_node->removeChild($child->_node);
570
+    if ( $update_node ) {
571
+          $this->_node->removeChild($child->_node);
572
+    }
554 573
     
555
-    if ( $child === $this->_first_child )
556
-      $this->_first_child = $child->_next_sibling;
574
+    if ( $child === $this->_first_child ) {
575
+          $this->_first_child = $child->_next_sibling;
576
+    }
557 577
 
558
-    if ( $child === $this->_last_child )
559
-      $this->_last_child = $child->_prev_sibling;
578
+    if ( $child === $this->_last_child ) {
579
+          $this->_last_child = $child->_prev_sibling;
580
+    }
560 581
 
561
-    if ( $child->_prev_sibling )
562
-      $child->_prev_sibling->_next_sibling = $child->_next_sibling;
582
+    if ( $child->_prev_sibling ) {
583
+          $child->_prev_sibling->_next_sibling = $child->_next_sibling;
584
+    }
563 585
 
564
-    if ( $child->_next_sibling )
565
-      $child->_next_sibling->_prev_sibling = $child->_prev_sibling;    
586
+    if ( $child->_next_sibling ) {
587
+          $child->_next_sibling->_prev_sibling = $child->_prev_sibling;
588
+    }
566 589
 
567 590
     $child->_next_sibling = null;
568 591
     $child->_prev_sibling = null;
@@ -592,20 +615,23 @@  discard block
 block discarded – undo
592 615
       $str .= "<pre>'" .  mb_substr($tmp,0,70) .
593 616
         (mb_strlen($tmp) > 70 ? "..." : "") . "'</pre>";
594 617
     }
595
-    if ( $this->_parent )
596
-      $str .= "\nParent:" . $this->_parent->_node->nodeName .
618
+    if ( $this->_parent ) {
619
+          $str .= "\nParent:" . $this->_parent->_node->nodeName .
597 620
         " (" . spl_object_hash($this->_parent->_node) . ") " .
598 621
         "<br/>";
622
+    }
599 623
 
600
-    if ( $this->_prev_sibling )
601
-      $str .= "Prev: " . $this->_prev_sibling->_node->nodeName .
624
+    if ( $this->_prev_sibling ) {
625
+          $str .= "Prev: " . $this->_prev_sibling->_node->nodeName .
602 626
         " (" . spl_object_hash($this->_prev_sibling->_node) . ") " .
603 627
         "<br/>";
628
+    }
604 629
 
605
-    if ( $this->_next_sibling )
606
-      $str .= "Next: " . $this->_next_sibling->_node->nodeName .
630
+    if ( $this->_next_sibling ) {
631
+          $str .= "Next: " . $this->_next_sibling->_node->nodeName .
607 632
         " (" . spl_object_hash($this->_next_sibling->_node) . ") " .
608 633
         "<br/>";
634
+    }
609 635
 
610 636
     $d = $this->get_decorator();
611 637
     while ($d && $d != $d->get_decorator()) {
@@ -641,10 +667,11 @@  discard block
 block discarded – undo
641 667
       $str .= "</pre>";
642 668
     }
643 669
     $str .= "\n";
644
-    if ( php_sapi_name() === "cli" )
645
-      $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
670
+    if ( php_sapi_name() === "cli" ) {
671
+          $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
646 672
                                     array("\n","",""),
647 673
                                     $str));
674
+    }
648 675
     
649 676
     return $str;
650 677
   }
@@ -701,8 +728,9 @@  discard block
 block discarded – undo
701 728
   function next() {
702 729
 
703 730
     $ret = $this->_cur;
704
-    if ( !$ret )
705
-      return null;
731
+    if ( !$ret ) {
732
+          return null;
733
+    }
706 734
     
707 735
     $this->_cur = $this->_cur->get_next_sibling();
708 736
     $this->_num++;
@@ -764,8 +792,9 @@  discard block
 block discarded – undo
764 792
     // Push all children onto the stack in reverse order
765 793
     if ( $c = $b->get_last_child() ) {
766 794
       $this->_stack[] = $c;
767
-      while ( $c = $c->get_prev_sibling() )
768
-        $this->_stack[] = $c;
795
+      while ( $c = $c->get_prev_sibling() ) {
796
+              $this->_stack[] = $c;
797
+      }
769 798
     }
770 799
     return $b;
771 800
   }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/page_cache.cls.php 1 patch
Braces   +25 added lines, -18 removed lines patch added patch discarded remove patch
@@ -63,16 +63,18 @@  discard block
 block discarded – undo
63 63
         " user=" . self::DB_USER .
64 64
         " password=" . self::DB_PASS;
65 65
       
66
-      if ( !self::$__connection = pg_connect($con_str) )
67
-        throw new Exception("Database connection failed.");
66
+      if ( !self::$__connection = pg_connect($con_str) ) {
67
+              throw new Exception("Database connection failed.");
68
+      }
68 69
     }
69 70
   }
70 71
   
71 72
   function __construct() { throw new Exception("Can not create instance of Page_Class.  Class is static."); }
72 73
 
73 74
   private static function __query($sql) {
74
-    if ( !($res = pg_query(self::$__connection, $sql)) )
75
-      throw new Exception(pg_last_error(self::$__connection));
75
+    if ( !($res = pg_query(self::$__connection, $sql)) ) {
76
+          throw new Exception(pg_last_error(self::$__connection));
77
+    }
76 78
     return $res;
77 79
   }
78 80
   
@@ -84,12 +86,13 @@  discard block
 block discarded – undo
84 86
 
85 87
     $row = pg_fetch_assoc($res);
86 88
     
87
-    if ( $row ) 
88
-      self::__query("UPDATE page_cache SET data='" . pg_escape_string($data) . "' " . $where);
89
-    else 
90
-      self::__query("INSERT INTO page_cache (id, page_num, data) VALUES ('" . pg_escape_string($id) . "', ".
89
+    if ( $row ) {
90
+          self::__query("UPDATE page_cache SET data='" . pg_escape_string($data) . "' " . $where);
91
+    } else {
92
+          self::__query("INSERT INTO page_cache (id, page_num, data) VALUES ('" . pg_escape_string($id) . "', ".
91 93
                      pg_escape_string($page_num) . ", ".
92 94
                      "'". pg_escape_string($data) . "')");
95
+    }
93 96
 
94 97
   }
95 98
 
@@ -98,9 +101,10 @@  discard block
 block discarded – undo
98 101
     // Update the font information
99 102
     self::__query("DELETE FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");
100 103
 
101
-    foreach (array_keys($fonts) as $font)
102
-      self::__query("INSERT INTO page_fonts (id, font_name) VALUES ('" .
104
+    foreach (array_keys($fonts) as $font) {
105
+          self::__query("INSERT INTO page_fonts (id, font_name) VALUES ('" .
103 106
                     pg_escape_string($id) . "', '" . pg_escape_string($font) . "')");
107
+    }
104 108
     self::__query("COMMIT");
105 109
   }
106 110
   
@@ -131,21 +135,24 @@  discard block
 block discarded – undo
131 135
 
132 136
     // Ensure that the fonts needed by the cached document are loaded into
133 137
     // the pdf
134
-    while ($row = pg_fetch_assoc($res)) 
135
-      $pdf->get_cpdf()->selectFont($row["font_name"]);
138
+    while ($row = pg_fetch_assoc($res)) {
139
+          $pdf->get_cpdf()->selectFont($row["font_name"]);
140
+    }
136 141
     
137 142
     $res = self::__query("SELECT data FROM page_cache WHERE id='" . pg_escape_string($id) . "'");
138 143
 
139
-    if ( $new_page )
140
-      $pdf->new_page();
144
+    if ( $new_page ) {
145
+          $pdf->new_page();
146
+    }
141 147
 
142 148
     $first = true;
143 149
     while ($row = pg_fetch_assoc($res)) {
144 150
 
145
-      if ( !$first ) 
146
-        $pdf->new_page();
147
-      else 
148
-        $first = false;        
151
+      if ( !$first ) {
152
+              $pdf->new_page();
153
+      } else {
154
+              $first = false;
155
+      }
149 156
       
150 157
       $page = $pdf->reopen_serialized_object($row["data"]);
151 158
       //$pdf->close_object();
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_reflower.cls.php 1 patch
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -93,8 +93,9 @@  discard block
 block discarded – undo
93 93
 
94 94
     // Collapse vertical margins:
95 95
     $n = $this->_frame->get_next_sibling();
96
-    while ( $n && !in_array($n->get_style()->display, Style::$BLOCK_TYPES) )
97
-      $n = $n->get_next_sibling();
96
+    while ( $n && !in_array($n->get_style()->display, Style::$BLOCK_TYPES) ) {
97
+          $n = $n->get_next_sibling();
98
+    }
98 99
 
99 100
     if ( $n ) { // && !$n instanceof Page_Frame_Decorator ) {
100 101
 
@@ -107,8 +108,9 @@  discard block
 block discarded – undo
107 108
 
108 109
     // Collapse our first child's margin
109 110
     $f = $this->_frame->get_first_child();
110
-    while ( $f && !in_array($f->get_style()->display, Style::$BLOCK_TYPES) )
111
-      $f = $f->get_next_sibling();
111
+    while ( $f && !in_array($f->get_style()->display, Style::$BLOCK_TYPES) ) {
112
+          $f = $f->get_next_sibling();
113
+    }
112 114
 
113 115
     if ( $f ) {
114 116
       $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"]));
@@ -123,8 +125,9 @@  discard block
 block discarded – undo
123 125
     $y = $this->_frame->get_position("y");
124 126
     $h = $style->length_in_pt($style->height);
125 127
     // Check if we need to move to a new page
126
-    if ( $y + $h >= $this->_frame->get_root()->get_page_height() )
127
-      return true;
128
+    if ( $y + $h >= $this->_frame->get_root()->get_page_height() ) {
129
+          return true;
130
+    }
128 131
 
129 132
   }
130 133
 
@@ -157,8 +160,9 @@  discard block
 block discarded – undo
157 160
     $delta = $style->length_in_pt($dims, $cb_w);
158 161
 
159 162
     // Handle degenerate case
160
-    if ( !$this->_frame->get_first_child() )
161
-      return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta);
163
+    if ( !$this->_frame->get_first_child() ) {
164
+          return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta);
165
+    }
162 166
 
163 167
     $low = array();
164 168
     $high = array();
@@ -177,21 +181,24 @@  discard block
 block discarded – undo
177 181
 
178 182
         $minmax = $child->get_min_max_width();
179 183
 
180
-        if ( in_array( $iter->current()->get_style()->white_space, array("pre", "nowrap") ) )
181
-          $inline_min += $minmax["min"];
182
-        else
183
-          $low[] = $minmax["min"];
184
+        if ( in_array( $iter->current()->get_style()->white_space, array("pre", "nowrap") ) ) {
185
+                  $inline_min += $minmax["min"];
186
+        } else {
187
+                  $low[] = $minmax["min"];
188
+        }
184 189
 
185 190
         $inline_max += $minmax["max"];
186 191
         $iter->next();
187 192
 
188 193
       }
189 194
 
190
-      if ( $inline_max > 0 )
191
-        $high[] = $inline_max;
195
+      if ( $inline_max > 0 ) {
196
+              $high[] = $inline_max;
197
+      }
192 198
 
193
-      if ( $inline_min > 0 )
194
-        $low[] = $inline_min;
199
+      if ( $inline_min > 0 ) {
200
+              $low[] = $inline_min;
201
+      }
195 202
 
196 203
       if ( $iter->valid() ) {
197 204
         list($low[], $high[]) = $iter->current()->get_min_max_width();
@@ -207,10 +214,12 @@  discard block
 block discarded – undo
207 214
     $width = $style->width;
208 215
     if ( $width !== "auto" && !is_percent($width) ) {
209 216
       $width = $style->length_in_pt($width, $cb_w);
210
-      if ( $min < $width )
211
-        $min = $width;
212
-      if ( $max < $width )
213
-        $max = $width;
217
+      if ( $min < $width ) {
218
+              $min = $width;
219
+      }
220
+      if ( $max < $width ) {
221
+              $max = $width;
222
+      }
214 223
     }
215 224
 
216 225
     $min += $delta;
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_positioner.cls.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@
 block discarded – undo
56 56
     $cb = $this->_frame->get_containing_block();    
57 57
     $p = $this->_frame->get_prev_sibling();
58 58
 
59
-    if ( $p ) 
60
-      $y = $p->get_position("y") + $p->get_margin_height();
61
-
62
-    else
63
-      $y = $cb["y"];
59
+    if ( $p ) {
60
+          $y = $p->get_position("y") + $p->get_margin_height();
61
+    } else {
62
+          $y = $cb["y"];
63
+    }
64 64
 
65 65
     $this->_frame->set_position($cb["x"], $y);
66 66
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/page_frame_decorator.cls.php 1 patch
Braces   +46 added lines, -32 removed lines patch added patch discarded remove patch
@@ -119,8 +119,10 @@  discard block
 block discarded – undo
119 119
   function set_containing_block($x = null, $y = null, $w = null, $h = null) {
120 120
     parent::set_containing_block($x,$y,$w,$h);
121 121
     $w = $this->get_containing_block("w");
122
-    if ( isset($h) )
123
-      $this->_bottom_page_margin = $h; // - $this->_frame->get_style()->length_in_pt($this->_frame->get_style()->margin_bottom, $w);
122
+    if ( isset($h) ) {
123
+          $this->_bottom_page_margin = $h;
124
+    }
125
+    // - $this->_frame->get_style()->length_in_pt($this->_frame->get_style()->margin_bottom, $w);
124 126
   }
125 127
 
126 128
   /**
@@ -176,21 +178,24 @@  discard block
 block discarded – undo
176 178
   function check_forced_page_break(Frame $frame) {
177 179
 
178 180
     // Skip check if page is already split
179
-    if ( $this->_page_full )
180
-      return;
181
+    if ( $this->_page_full ) {
182
+          return;
183
+    }
181 184
 
182 185
     $block_types = array("block", "list-item", "table");
183 186
     $page_breaks = array("always", "left", "right");
184 187
 
185 188
     $style = $frame->get_style();
186 189
 
187
-    if ( !in_array($style->display, $block_types) )
188
-      return false;
190
+    if ( !in_array($style->display, $block_types) ) {
191
+          return false;
192
+    }
189 193
 
190 194
     // Find the previous block-level sibling
191 195
     $prev = $frame->get_prev_sibling();
192
-    while ( $prev && !in_array($prev->get_style()->display, $block_types) )
193
-      $prev = $prev->get_prev_sibling();
196
+    while ( $prev && !in_array($prev->get_style()->display, $block_types) ) {
197
+          $prev = $prev->get_prev_sibling();
198
+    }
194 199
 
195 200
     if ( in_array($style->page_break_before, $page_breaks) ) {
196 201
 
@@ -291,8 +296,9 @@  discard block
 block discarded – undo
291 296
 
292 297
       // Find the preceeding block-level sibling
293 298
       $prev = $frame->get_prev_sibling();
294
-      while ( $prev && !in_array($prev->get_style()->display, $block_types) )
295
-        $prev = $prev->get_prev_sibling();
299
+      while ( $prev && !in_array($prev->get_style()->display, $block_types) ) {
300
+              $prev = $prev->get_prev_sibling();
301
+      }
296 302
 
297 303
       // Does the previous element allow a page break after?
298 304
       if ( $prev && $prev->get_style()->page_break_after === "avoid" ) {
@@ -319,8 +325,9 @@  discard block
 block discarded – undo
319 325
 
320 326
       // If the frame is the first block-level frame, use the value from
321 327
       // $frame's parent instead.
322
-      if ( !$prev && $parent )
323
-        return $this->_page_break_allowed( $parent );
328
+      if ( !$prev && $parent ) {
329
+              return $this->_page_break_allowed( $parent );
330
+      }
324 331
 
325 332
       dompdf_debug("page-break", "block: break allowed");
326 333
       return true;
@@ -360,8 +367,9 @@  discard block
 block discarded – undo
360 367
       // page-break-inside: avoid, ensure that at least one frame with
361 368
       // some content is on the page before splitting.
362 369
       $prev = $frame->get_prev_sibling();
363
-      while ( $prev && ($prev->get_node()->nodeName === "#text" && trim($prev->get_node()->nodeValue) == "") )
364
-        $prev = $prev->get_prev_sibling();
370
+      while ( $prev && ($prev->get_node()->nodeName === "#text" && trim($prev->get_node()->nodeValue) == "") ) {
371
+              $prev = $prev->get_prev_sibling();
372
+      }
365 373
 
366 374
       if ( $block_parent->get_node()->nodeName === "body" && !$prev ) {
367 375
         // We are the body's first child
@@ -371,8 +379,9 @@  discard block
 block discarded – undo
371 379
 
372 380
       // Skip breaks on empty text nodes
373 381
       if ( $frame->get_node()->nodeName === "#text" &&
374
-           $frame->get_node()->nodeValue == "" )
375
-        return false;
382
+           $frame->get_node()->nodeValue == "" ) {
383
+              return false;
384
+      }
376 385
 
377 386
       dompdf_debug("page-break", "inline: break allowed");
378 387
       return true;
@@ -430,8 +439,9 @@  discard block
 block discarded – undo
430 439
    */
431 440
   function check_page_break(Frame $frame) {
432 441
     // Do not split if we have already
433
-    if ( $this->_page_full )
434
-      return false;
442
+    if ( $this->_page_full ) {
443
+          return false;
444
+    }
435 445
 
436 446
     // Determine the frame's maximum y value
437 447
     $max_y = $frame->get_position("y") + $frame->get_margin_height();
@@ -449,9 +459,10 @@  discard block
 block discarded – undo
449 459
 
450 460
 
451 461
     // Check if $frame flows off the page
452
-    if ( $max_y <= $this->_bottom_page_margin )
453
-      // no: do nothing
462
+    if ( $max_y <= $this->_bottom_page_margin ) {
463
+          // no: do nothing
454 464
       return false;
465
+    }
455 466
 
456 467
     dompdf_debug("page-break", "check_page_break");
457 468
     dompdf_debug("page-break", "in_table: " . $this->_in_table);
@@ -483,8 +494,9 @@  discard block
 block discarded – undo
483 494
       if ( !$flg && $next = $iter->get_last_child() ) {
484 495
          dompdf_debug("page-break", "following last child.");
485 496
 
486
-        if ( in_array($next->get_style()->display, Style::$TABLE_TYPES) )
487
-          $this->_in_table++;
497
+        if ( in_array($next->get_style()->display, Style::$TABLE_TYPES) ) {
498
+                  $this->_in_table++;
499
+        }
488 500
 
489 501
         $iter = $next;
490 502
         continue;
@@ -494,12 +506,12 @@  discard block
 block discarded – undo
494 506
          dompdf_debug("page-break", "following prev sibling.");
495 507
 
496 508
         if ( in_array($next->get_style()->display, Style::$TABLE_TYPES) &&
497
-             !in_array($iter->get_style()->display, Style::$TABLE_TYPES) )
498
-          $this->_in_table++;
499
-
500
-        else if ( !in_array($next->get_style()->display, Style::$TABLE_TYPES) &&
501
-                  in_array($iter->get_style()->display, Style::$TABLE_TYPES) )
502
-          $this->_in_table--;
509
+             !in_array($iter->get_style()->display, Style::$TABLE_TYPES) ) {
510
+                  $this->_in_table++;
511
+        } else if ( !in_array($next->get_style()->display, Style::$TABLE_TYPES) &&
512
+                  in_array($iter->get_style()->display, Style::$TABLE_TYPES) ) {
513
+                  $this->_in_table--;
514
+        }
503 515
 
504 516
         $iter = $next;
505 517
         $flg = false;
@@ -509,8 +521,9 @@  discard block
 block discarded – undo
509 521
       if ( $next = $iter->get_parent() ) {
510 522
          dompdf_debug("page-break", "following parent.");
511 523
 
512
-        if ( in_array($iter->get_style()->display, Style::$TABLE_TYPES) )
513
-          $this->_in_table--;
524
+        if ( in_array($iter->get_style()->display, Style::$TABLE_TYPES) ) {
525
+                  $this->_in_table--;
526
+        }
514 527
 
515 528
         $iter = $next;
516 529
         $flg = true;
@@ -537,8 +550,9 @@  discard block
 block discarded – undo
537 550
       }
538 551
 
539 552
       $iter = $frame;
540
-      while ($iter && $iter->get_style()->display !== "table-row" )
541
-        $iter = $iter->get_parent();
553
+      while ($iter && $iter->get_style()->display !== "table-row" ) {
554
+              $iter = $iter->get_parent();
555
+      }
542 556
 
543 557
       $iter->split();
544 558
       $this->_page_full = true;
Please login to merge, or discard this patch.