Passed
Push — 1.10.x ( aa45ad...6deddd )
by Yannick
44:37
created
main/inc/lib/phpdocx/pdf/include/dompdf.cls.php 1 patch
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -267,25 +267,30 @@  discard block
 block discarded – undo
267 267
     // Store parsing warnings as messages (this is to prevent output to the
268 268
     // browser if the html is ugly and the dom extension complains,
269 269
     // preventing the pdf from being streamed.)
270
-    if ( !$this->_protocol && !$this->_base_host && !$this->_base_path )
271
-      list($this->_protocol, $this->_base_host, $this->_base_path) = explode_url($file);
270
+    if ( !$this->_protocol && !$this->_base_host && !$this->_base_path ) {
271
+          list($this->_protocol, $this->_base_host, $this->_base_path) = explode_url($file);
272
+    }
272 273
 
273 274
     if ( !DOMPDF_ENABLE_REMOTE &&
274
-         ($this->_protocol != "" && $this->_protocol !== "file://" ) )
275
-      throw new DOMPDF_Exception("Remote file requested, but DOMPDF_ENABLE_REMOTE is false.");
275
+         ($this->_protocol != "" && $this->_protocol !== "file://" ) ) {
276
+          throw new DOMPDF_Exception("Remote file requested, but DOMPDF_ENABLE_REMOTE is false.");
277
+    }
276 278
 
277 279
     if ($this->_protocol == "" || $this->_protocol === "file://") {
278 280
 
279 281
       $realfile = realpath($file);
280
-      if ( !$file )
281
-        throw new DOMPDF_Exception("File '$file' not found.");
282
+      if ( !$file ) {
283
+              throw new DOMPDF_Exception("File '$file' not found.");
284
+      }
282 285
 
283
-      if ( strpos($realfile, DOMPDF_CHROOT) !== 0 )
284
-        throw new DOMPDF_Exception("Permission denied on $file.");
286
+      if ( strpos($realfile, DOMPDF_CHROOT) !== 0 ) {
287
+              throw new DOMPDF_Exception("Permission denied on $file.");
288
+      }
285 289
 
286 290
       // Exclude dot files (e.g. .htaccess)
287
-      if ( substr(basename($realfile),0,1) === "." )
288
-        throw new DOMPDF_Exception("Permission denied on $file.");
291
+      if ( substr(basename($realfile),0,1) === "." ) {
292
+              throw new DOMPDF_Exception("Permission denied on $file.");
293
+      }
289 294
 
290 295
       $file = $realfile;
291 296
     }
@@ -396,8 +401,9 @@  discard block
 block discarded – undo
396 401
       // which states that the default media type is 'screen'
397 402
       if ( $style->hasAttributes() &&
398 403
            ($media = $style->getAttribute("media")) &&
399
-           !in_array($media, $acceptedmedia) )
400
-        continue;
404
+           !in_array($media, $acceptedmedia) ) {
405
+              continue;
406
+      }
401 407
 
402 408
       $css = "";
403 409
       if ( $style->hasChildNodes() ) {
@@ -408,8 +414,9 @@  discard block
 block discarded – undo
408 414
           $child = $child->nextSibling;
409 415
         }
410 416
 
411
-      } else
412
-        $css = $style->nodeValue;
417
+      } else {
418
+              $css = $style->nodeValue;
419
+      }
413 420
       
414 421
       // Set the base path of the Stylesheet to that of the file being processed
415 422
       $this->_css->set_protocol($this->_protocol);
@@ -530,8 +537,9 @@  discard block
 block discarded – undo
530 537
     global $_dompdf_warnings, $_dompdf_show_warnings;
531 538
     if ( $_dompdf_show_warnings ) {
532 539
       echo '<b>DOMPDF Warnings</b><br><pre>';
533
-      foreach ($_dompdf_warnings as $msg)
534
-        echo $msg . "\n";
540
+      foreach ($_dompdf_warnings as $msg) {
541
+              echo $msg . "\n";
542
+      }
535 543
       echo $this->get_canvas()->get_cpdf()->messages;
536 544
       echo '</pre>';
537 545
       flush();
@@ -544,8 +552,9 @@  discard block
 block discarded – undo
544 552
    * Add meta information to the PDF after rendering
545 553
    */
546 554
   function add_info($label, $value) {
547
-    if (!is_null($this->_pdf))
548
-      $this->_pdf->add_info($label, $value);
555
+    if (!is_null($this->_pdf)) {
556
+          $this->_pdf->add_info($label, $value);
557
+    }
549 558
   }
550 559
   
551 560
   //........................................................................
@@ -571,8 +580,9 @@  discard block
 block discarded – undo
571 580
    * @param array  $options header options (see above)
572 581
    */
573 582
   function stream($filename, $options = null) {
574
-    if (!is_null($this->_pdf))
575
-      $this->_pdf->stream($filename, $options);
583
+    if (!is_null($this->_pdf)) {
584
+          $this->_pdf->stream($filename, $options);
585
+    }
576 586
   }
577 587
 
578 588
   /**
@@ -591,8 +601,9 @@  discard block
 block discarded – undo
591 601
    */
592 602
   function output($options = null) {
593 603
 
594
-    if ( is_null($this->_pdf) )
595
-      return null;
604
+    if ( is_null($this->_pdf) ) {
605
+          return null;
606
+    }
596 607
 
597 608
     return $this->_pdf->output( $options );
598 609
   }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_frame_decorator.cls.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,13 +68,15 @@
 block discarded – undo
68 68
     foreach ($this->get_children() as $child) {      
69 69
       $display = $child->get_style()->display;
70 70
 
71
-      if ( $display !== "table-cell" )
72
-        $erroneous_frames[] = $child;
71
+      if ( $display !== "table-cell" ) {
72
+              $erroneous_frames[] = $child;
73
+      }
73 74
     }
74 75
     
75 76
     //  dump the extra nodes after the table.
76
-    foreach ($erroneous_frames as $frame) 
77
-      $p->move_after($frame);
77
+    foreach ($erroneous_frames as $frame) {
78
+          $p->move_after($frame);
79
+    }
78 80
   }
79 81
   
80 82
   
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/block_frame_reflower.cls.php 1 patch
Braces   +167 added lines, -119 removed lines patch added patch discarded remove patch
@@ -98,10 +98,12 @@  discard block
 block discarded – undo
98 98
 
99 99
         if ( $width === "auto" && $left === "auto" && $right === "auto" ) {
100 100
 
101
-          if ( $lm === "auto" )
102
-            $lm = 0;
103
-          if ( $rm === "auto" )
104
-            $rm = 0;
101
+          if ( $lm === "auto" ) {
102
+                      $lm = 0;
103
+          }
104
+          if ( $rm === "auto" ) {
105
+                      $rm = 0;
106
+          }
105 107
 
106 108
           // Technically, the width should be "shrink-to-fit" i.e. based on the
107 109
           // preferred width of the content...  a little too costly here as a
@@ -112,33 +114,42 @@  discard block
 block discarded – undo
112 114
 
113 115
         } else if ( $width === "auto" ) {
114 116
 
115
-          if ( $lm === "auto" )
116
-            $lm = 0;
117
-          if ( $rm === "auto" )
118
-            $rm = 0;
119
-          if ( $left === "auto" )
120
-            $left = 0;
121
-          if ( $right === "auto" )
122
-            $right = 0;
117
+          if ( $lm === "auto" ) {
118
+                      $lm = 0;
119
+          }
120
+          if ( $rm === "auto" ) {
121
+                      $rm = 0;
122
+          }
123
+          if ( $left === "auto" ) {
124
+                      $left = 0;
125
+          }
126
+          if ( $right === "auto" ) {
127
+                      $right = 0;
128
+          }
123 129
 
124 130
           $width = $diff;
125 131
 
126 132
         } else if ( $left === "auto" ) {
127
-          if ( $lm === "auto" )
128
-            $lm = 0;
129
-          if ( $rm === "auto" )
130
-            $rm = 0;
131
-          if ( $right === "auto" )
132
-            $right = 0;
133
+          if ( $lm === "auto" ) {
134
+                      $lm = 0;
135
+          }
136
+          if ( $rm === "auto" ) {
137
+                      $rm = 0;
138
+          }
139
+          if ( $right === "auto" ) {
140
+                      $right = 0;
141
+          }
133 142
 
134 143
           $left = $diff;
135 144
 
136 145
         } else if ( $right === "auto" ) {
137 146
 
138
-          if ( $lm === "auto" )
139
-            $lm = 0;
140
-          if ( $rm === "auto" )
141
-            $rm = 0;
147
+          if ( $lm === "auto" ) {
148
+                      $lm = 0;
149
+          }
150
+          if ( $rm === "auto" ) {
151
+                      $rm = 0;
152
+          }
142 153
 
143 154
           $right = $diff;
144 155
         }
@@ -146,17 +157,15 @@  discard block
 block discarded – undo
146 157
       } else {
147 158
 
148 159
         // Find auto properties and get them to take up the slack
149
-        if ( $width === "auto" )
150
-          $width = $diff;
151
-
152
-        else if ( $lm === "auto" && $rm === "auto" )
153
-          $lm = $rm = round($diff / 2);
154
-
155
-        else if ( $lm === "auto" )
156
-          $lm = $diff;
157
-
158
-        else if ( $rm === "auto" )
159
-          $rm = $diff;
160
+        if ( $width === "auto" ) {
161
+                  $width = $diff;
162
+        } else if ( $lm === "auto" && $rm === "auto" ) {
163
+                  $lm = $rm = round($diff / 2);
164
+        } else if ( $lm === "auto" ) {
165
+                  $lm = $diff;
166
+        } else if ( $rm === "auto" ) {
167
+                  $rm = $diff;
168
+        }
160 169
       }
161 170
 
162 171
     } else if ($diff < 0) {
@@ -176,14 +185,16 @@  discard block
 block discarded – undo
176 185
     $style = $this->_frame->get_style();
177 186
     $cb = $this->_frame->get_containing_block();
178 187
 
179
-    if ( !isset($cb["w"]) )
180
-      throw new DOMPDF_Exception("Box property calculation requires containing block width");
188
+    if ( !isset($cb["w"]) ) {
189
+          throw new DOMPDF_Exception("Box property calculation requires containing block width");
190
+    }
181 191
 
182 192
     // Treat width 100% as auto
183
-    if ( $style->width === "100%" )
184
-      $width = "auto";
185
-    else
186
-      $width = $style->length_in_pt($style->width, $cb["w"]);
193
+    if ( $style->width === "100%" ) {
194
+          $width = "auto";
195
+    } else {
196
+          $width = $style->length_in_pt($style->width, $cb["w"]);
197
+    }
187 198
 
188 199
     extract($this->_calculate_width($width));
189 200
 
@@ -191,15 +202,18 @@  discard block
 block discarded – undo
191 202
     $min_width = $style->length_in_pt($style->min_width, $cb["w"]);
192 203
     $max_width = $style->length_in_pt($style->max_width, $cb["w"]);
193 204
 
194
-    if ( $max_width !== "none" && $min_width > $max_width)
195
-      // Swap 'em
205
+    if ( $max_width !== "none" && $min_width > $max_width) {
206
+          // Swap 'em
196 207
       list($max_width, $min_width) = array($min_width, $max_width);
208
+    }
197 209
 
198
-    if ( $max_width !== "none" && $width > $max_width )
199
-      extract($this->_calculate_width($max_width));
210
+    if ( $max_width !== "none" && $width > $max_width ) {
211
+          extract($this->_calculate_width($max_width));
212
+    }
200 213
 
201
-    if ( $width < $min_width )
202
-      extract($this->_calculate_width($min_width));
214
+    if ( $width < $min_width ) {
215
+          extract($this->_calculate_width($min_width));
216
+    }
203 217
 
204 218
     return array($width, $margin_left, $margin_right, $left, $right);
205 219
 
@@ -214,8 +228,9 @@  discard block
 block discarded – undo
214 228
     $height = 0;
215 229
     
216 230
     // Add the height of all lines
217
-    foreach ($this->_frame->get_lines() as $line)
218
-      $height += $line["h"];
231
+    foreach ($this->_frame->get_lines() as $line) {
232
+          $height += $line["h"];
233
+    }
219 234
 
220 235
     return $height;
221 236
 
@@ -257,66 +272,80 @@  discard block
 block discarded – undo
257 272
 
258 273
         if ( $height === "auto" && $top === "auto" && $bottom === "auto" ) {
259 274
 
260
-          if ( $margin_top === "auto" ) 
261
-            $margin_top = 0;
262
-          if ( $margin_bottom === "auto" )
263
-            $margin_bottom = 0;
275
+          if ( $margin_top === "auto" ) {
276
+                      $margin_top = 0;
277
+          }
278
+          if ( $margin_bottom === "auto" ) {
279
+                      $margin_bottom = 0;
280
+          }
264 281
 
265 282
           $height = $diff;
266 283
 
267 284
         } else if ( $height === "auto" && $top === "auto" ) {
268 285
 
269
-          if ( $margin_top === "auto" ) 
270
-            $margin_top = 0;
271
-          if ( $margin_bottom === "auto" )
272
-            $margin_bottom = 0;
286
+          if ( $margin_top === "auto" ) {
287
+                      $margin_top = 0;
288
+          }
289
+          if ( $margin_bottom === "auto" ) {
290
+                      $margin_bottom = 0;
291
+          }
273 292
 
274 293
           $height = $content_height;
275 294
           $top = $diff - $content_height;
276 295
 
277 296
         } else if ( $height === "auto" && $bottom === "auto" ) {
278 297
 
279
-          if ( $margin_top === "auto" ) 
280
-            $margin_top = 0;
281
-          if ( $margin_bottom === "auto" )
282
-            $margin_bottom = 0;
298
+          if ( $margin_top === "auto" ) {
299
+                      $margin_top = 0;
300
+          }
301
+          if ( $margin_bottom === "auto" ) {
302
+                      $margin_bottom = 0;
303
+          }
283 304
 
284 305
           $height = $content_height;
285 306
           $bottom = $diff - $content_height;
286 307
 
287 308
         } else if ( $top === "auto" && $bottom === "auto" ) {
288 309
 
289
-          if ( $margin_top === "auto" ) 
290
-            $margin_top = 0;
291
-          if ( $margin_bottom === "auto" )
292
-            $margin_bottom = 0;
310
+          if ( $margin_top === "auto" ) {
311
+                      $margin_top = 0;
312
+          }
313
+          if ( $margin_bottom === "auto" ) {
314
+                      $margin_bottom = 0;
315
+          }
293 316
 
294 317
           $bottom = $diff;
295 318
 
296 319
         } else if ( $top === "auto" ) {
297 320
 
298
-          if ( $margin_top === "auto" ) 
299
-            $margin_top = 0;
300
-          if ( $margin_bottom === "auto" )
301
-            $margin_bottom = 0;
321
+          if ( $margin_top === "auto" ) {
322
+                      $margin_top = 0;
323
+          }
324
+          if ( $margin_bottom === "auto" ) {
325
+                      $margin_bottom = 0;
326
+          }
302 327
 
303 328
           $top = $diff;
304 329
 
305 330
         } else if ( $height === "auto" ) {
306 331
 
307
-          if ( $margin_top === "auto" ) 
308
-            $margin_top = 0;
309
-          if ( $margin_bottom === "auto" )
310
-            $margin_bottom = 0;
332
+          if ( $margin_top === "auto" ) {
333
+                      $margin_top = 0;
334
+          }
335
+          if ( $margin_bottom === "auto" ) {
336
+                      $margin_bottom = 0;
337
+          }
311 338
 
312 339
           $height = $diff;
313 340
 
314 341
         } else if ( $bottom === "auto" ) {
315 342
 
316
-          if ( $margin_top === "auto" ) 
317
-            $margin_top = 0;
318
-          if ( $margin_bottom === "auto" )
319
-            $margin_bottom = 0;
343
+          if ( $margin_top === "auto" ) {
344
+                      $margin_top = 0;
345
+          }
346
+          if ( $margin_bottom === "auto" ) {
347
+                      $margin_bottom = 0;
348
+          }
320 349
 
321 350
           $bottom = $diff;
322 351
 
@@ -325,16 +354,21 @@  discard block
 block discarded – undo
325 354
           if ( $style->overflow === "visible" ) {
326 355
 
327 356
             // set all autos to zero
328
-            if ( $margin_top === "auto" ) 
329
-              $margin_top = 0;
330
-            if ( $margin_bottom === "auto" )
331
-              $margin_bottom = 0;
332
-            if ( $top === "auto" )
333
-              $top = 0;
334
-            if ( $bottom === "auto" )
335
-              $bottom = 0;
336
-            if ( $height === "auto" )
337
-              $height = $content_height;
357
+            if ( $margin_top === "auto" ) {
358
+                          $margin_top = 0;
359
+            }
360
+            if ( $margin_bottom === "auto" ) {
361
+                          $margin_bottom = 0;
362
+            }
363
+            if ( $top === "auto" ) {
364
+                          $top = 0;
365
+            }
366
+            if ( $bottom === "auto" ) {
367
+                          $bottom = 0;
368
+            }
369
+            if ( $height === "auto" ) {
370
+                          $height = $content_height;
371
+            }
338 372
 
339 373
           }
340 374
 
@@ -346,8 +380,9 @@  discard block
 block discarded – undo
346 380
     } else {
347 381
 
348 382
       // Expand the height if overflow is visible
349
-      if ( $height == "auto" && $content_height > $height && $style->overflow === "visible" )
350
-        $height = $content_height;
383
+      if ( $height == "auto" && $content_height > $height && $style->overflow === "visible" ) {
384
+              $height = $content_height;
385
+      }
351 386
 
352 387
       // FIXME: this should probably be moved to a seperate function as per
353 388
       // _calculate_restricted_width
@@ -365,26 +400,31 @@  discard block
 block discarded – undo
365 400
 
366 401
         } else if ( isset($cb["w"]) ) {
367 402
 
368
-          if ( mb_strpos($min_height, "%") !== false )
369
-            $min_height = 0;
370
-          else
371
-            $min_height = $style->length_in_pt($min_height, $cb["w"]);
403
+          if ( mb_strpos($min_height, "%") !== false ) {
404
+                      $min_height = 0;
405
+          } else {
406
+                      $min_height = $style->length_in_pt($min_height, $cb["w"]);
407
+          }
372 408
 
373
-          if ( mb_strpos($max_height, "%") !== false )
374
-            $max_height = "none";
375
-          else
376
-            $max_height = $style->length_in_pt($max_height, $cb["w"]);
409
+          if ( mb_strpos($max_height, "%") !== false ) {
410
+                      $max_height = "none";
411
+          } else {
412
+                      $max_height = $style->length_in_pt($max_height, $cb["w"]);
413
+          }
377 414
         }
378 415
 
379
-        if ( $max_height !== "none" && $min_height > $max_height )
380
-          // Swap 'em
416
+        if ( $max_height !== "none" && $min_height > $max_height ) {
417
+                  // Swap 'em
381 418
           list($max_height, $min_height) = array($min_height, $max_height);
419
+        }
382 420
 
383
-        if ( $max_height !== "none" && $height > $max_height )
384
-          $height = $max_height;
421
+        if ( $max_height !== "none" && $height > $max_height ) {
422
+                  $height = $max_height;
423
+        }
385 424
 
386
-        if ( $height < $min_height )
387
-          $height = $min_height;
425
+        if ( $height < $min_height ) {
426
+                  $height = $min_height;
427
+        }
388 428
       }
389 429
 
390 430
     }
@@ -413,8 +453,9 @@  discard block
 block discarded – undo
413 453
 
414 454
         // Move each child over by $dx
415 455
         $dx = $width - $line["w"];
416
-        foreach($line["frames"] as $frame)
417
-          $frame->set_position( $frame->get_position("x") + $dx );
456
+        foreach($line["frames"] as $frame) {
457
+                  $frame->set_position( $frame->get_position("x") + $dx );
458
+        }
418 459
 
419 460
       }
420 461
       break;
@@ -427,15 +468,17 @@  discard block
 block discarded – undo
427 468
         // just an aesthetic choice ;)
428 469
         if ( $line["w"] > self::MIN_JUSTIFY_WIDTH * $width ) {
429 470
           // Set the spacing for each child
430
-          if ( $line["wc"] > 1 )
431
-            $spacing = ($width - $line["w"]) / ($line["wc"] - 1);
432
-          else
433
-            $spacing = 0;
471
+          if ( $line["wc"] > 1 ) {
472
+                      $spacing = ($width - $line["w"]) / ($line["wc"] - 1);
473
+          } else {
474
+                      $spacing = 0;
475
+          }
434 476
 
435 477
           $dx = 0;
436 478
           foreach($line["frames"] as $frame) {
437
-            if ( !$frame instanceof Text_Frame_Decorator )
438
-              continue;
479
+            if ( !$frame instanceof Text_Frame_Decorator ) {
480
+                          continue;
481
+            }
439 482
 
440 483
             $frame->set_position( $frame->get_position("x") + $dx );
441 484
             $frame->set_text_spacing($spacing);
@@ -454,8 +497,9 @@  discard block
 block discarded – undo
454 497
       foreach ($this->_frame->get_lines() as $i => $line) {
455 498
         // Centre each line by moving each frame in the line by:
456 499
         $dx = ($width - $line["w"]) / 2;
457
-        foreach ($line["frames"] as $frame)
458
-          $frame->set_position( $frame->get_position("x") + $dx );
500
+        foreach ($line["frames"] as $frame) {
501
+                  $frame->set_position( $frame->get_position("x") + $dx );
502
+        }
459 503
       }
460 504
       break;
461 505
     }
@@ -471,8 +515,9 @@  discard block
 block discarded – undo
471 515
       foreach ( $line["frames"] as $frame ) {
472 516
         $style = $frame->get_style();
473 517
 
474
-        if ( $style->display !== "inline" && $style->display !== "text" )
475
-          continue;
518
+        if ( $style->display !== "inline" && $style->display !== "text" ) {
519
+                  continue;
520
+        }
476 521
 
477 522
         $align = $style->vertical_align;
478 523
 
@@ -523,8 +568,9 @@  discard block
 block discarded – undo
523 568
     $page->check_forced_page_break($this->_frame);
524 569
 
525 570
     // Bail if the page is full
526
-    if ( $page->is_full() )
527
-      return;
571
+    if ( $page->is_full() ) {
572
+          return;
573
+    }
528 574
 
529 575
     // Collapse margins if required
530 576
     $this->_collapse_margins();
@@ -575,15 +621,17 @@  discard block
 block discarded – undo
575 621
     foreach ( $this->_frame->get_children() as $child ) {
576 622
 
577 623
       // Bail out if the page is full
578
-      if ( $page->is_full() )
579
-        break;
624
+      if ( $page->is_full() ) {
625
+              break;
626
+      }
580 627
       
581 628
       $child->set_containing_block($cb_x, $cb_y, $w, $cb_h);
582 629
       $child->reflow();
583 630
 
584 631
       // Don't add the child to the line if a page break has occurred
585
-      if ( $page->check_page_break($child) )
586
-        break;
632
+      if ( $page->check_page_break($child) ) {
633
+              break;
634
+      }
587 635
 
588 636
       // If the frame is not absolutely positioned, It's okay to add the frame
589 637
       // to the line
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_group_frame_reflower.cls.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@  discard block
 block discarded – undo
63 63
     
64 64
     foreach ( $this->_frame->get_children() as $child) {
65 65
       // Bail if the page is full
66
-      if ( $page->is_full() )
67
-        return;
66
+      if ( $page->is_full() ) {
67
+              return;
68
+      }
68 69
 
69 70
       $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]);
70 71
       $child->reflow();
@@ -74,8 +75,9 @@  discard block
 block discarded – undo
74 75
 
75 76
     }
76 77
 
77
-    if ( $page->is_full() )
78
-      return;
78
+    if ( $page->is_full() ) {
79
+          return;
80
+    }
79 81
 
80 82
     $cellmap = $table->get_cellmap();
81 83
     $style->width = $cellmap->get_frame_width($this->_frame);
@@ -83,9 +85,10 @@  discard block
 block discarded – undo
83 85
 
84 86
     $this->_frame->set_position($cellmap->get_frame_position($this->_frame));
85 87
     
86
-    if ( $table->get_style()->border_collapse === "collapse" ) 
87
-      // Unset our borders because our cells are now using them
88
+    if ( $table->get_style()->border_collapse === "collapse" ) {
89
+          // Unset our borders because our cells are now using them
88 90
       $style->border_style = "none";
91
+    }
89 92
  
90 93
   }
91 94
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_cell_renderer.cls.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -85,8 +85,9 @@  discard block
 block discarded – undo
85 85
     if (in_array( $num_rows - 1, $cells["rows"])) {
86 86
       $draw_bottom = true;
87 87
       $bottom_row = $cellmap->get_row($num_rows - 1);
88
-    } else
89
-      $draw_bottom = false;
88
+    } else {
89
+          $draw_bottom = false;
90
+    }
90 91
 
91 92
 
92 93
     // Draw the horizontal borders
@@ -110,8 +111,9 @@  discard block
 block discarded – undo
110 111
 
111 112
       if ( $draw_bottom ) {
112 113
         $bp = $cellmap->get_border_properties($num_rows - 1, $j);
113
-        if ( $bp["bottom"]["style"] === "none" || $bp["bottom"]["width"] <= 0 )
114
-          continue;
114
+        if ( $bp["bottom"]["style"] === "none" || $bp["bottom"]["width"] <= 0 ) {
115
+                  continue;
116
+        }
115 117
 
116 118
         $y = $bottom_row["y"] + $bottom_row["height"] + $bp["bottom"]["width"] / 2;
117 119
 
@@ -132,8 +134,9 @@  discard block
 block discarded – undo
132 134
     if (in_array($num_cols - 1, $cells["columns"])) {
133 135
       $draw_right = true;
134 136
       $right_col = $cellmap->get_column($num_cols - 1);
135
-    } else
136
-      $draw_right = false;
137
+    } else {
138
+          $draw_right = false;
139
+    }
137 140
 
138 141
     // Draw the vertical borders
139 142
     foreach ( $cells["rows"] as $i ) {
@@ -159,8 +162,9 @@  discard block
 block discarded – undo
159 162
 
160 163
       if ( $draw_right ) {
161 164
         $bp = $cellmap->get_border_properties($i, $num_cols - 1);
162
-        if ( $bp["right"]["style"] === "none" || $bp["right"]["width"] <= 0 )
163
-          continue;
165
+        if ( $bp["right"]["style"] === "none" || $bp["right"]["width"] <= 0 ) {
166
+                  continue;
167
+        }
164 168
 
165 169
         $x = $right_col["x"] + $right_col["used-width"] + $bp["right"]["width"] / 2;
166 170
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/php_evaluator.cls.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
   }
55 55
 
56 56
   function evaluate($code, $vars = array()) {
57
-    if ( !DOMPDF_ENABLE_PHP )
58
-      return;
57
+    if ( !DOMPDF_ENABLE_PHP ) {
58
+          return;
59
+    }
59 60
     
60 61
     // Set up some variables for the inline code
61 62
     $pdf = $this->_canvas;
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_tree.cls.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -135,11 +135,13 @@  discard block
 block discarded – undo
135 135
    */
136 136
   function build_tree() {
137 137
     $html = $this->_dom->getElementsByTagName("html")->item(0);
138
-    if ( is_null($html) )
139
-      $html = $this->_dom->firstChild;
138
+    if ( is_null($html) ) {
139
+          $html = $this->_dom->firstChild;
140
+    }
140 141
 
141
-    if ( is_null($html) )
142
-      throw new DOMPDF_Exception("Requested HTML document contains no data.");
142
+    if ( is_null($html) ) {
143
+          throw new DOMPDF_Exception("Requested HTML document contains no data.");
144
+    }
143 145
 
144 146
     $this->_root = $this->_build_tree_r($html);
145 147
 
@@ -162,8 +164,9 @@  discard block
 block discarded – undo
162 164
     $id = $frame->get_id();
163 165
     $this->_registry[ $id ] = $frame;
164 166
     
165
-    if ( !$node->hasChildNodes() )
166
-      return $frame;
167
+    if ( !$node->hasChildNodes() ) {
168
+          return $frame;
169
+    }
167 170
 
168 171
     // Fixes 'cannot access undefined property for object with
169 172
     // overloaded access', fix by Stefan radulian
@@ -172,15 +175,17 @@  discard block
 block discarded – undo
172 175
 
173 176
     // Store the children in an array so that the tree can be modified
174 177
     $children = array();
175
-    for ($i = 0; $i < $node->childNodes->length; $i++)
176
-      $children[] = $node->childNodes->item($i);
178
+    for ($i = 0; $i < $node->childNodes->length; $i++) {
179
+          $children[] = $node->childNodes->item($i);
180
+    }
177 181
 
178 182
     foreach ($children as $child) {
179 183
       // Skip non-displaying nodes
180 184
       if ( in_array( mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS) )  {
181 185
         if ( mb_strtolower($child->nodeName) !== "head" &&
182
-             mb_strtolower($child->nodeName) !== "style" ) 
183
-          $child->parentNode->removeChild($child);
186
+             mb_strtolower($child->nodeName) !== "style" ) {
187
+                  $child->parentNode->removeChild($child);
188
+        }
184 189
         continue;
185 190
       }
186 191
 
@@ -203,15 +208,17 @@  discard block
 block discarded – undo
203 208
         // Move attributes to inner node        
204 209
         foreach ( $child->attributes as $attr => $attr_node ) {
205 210
           // Skip style, but move all other attributes
206
-          if ( $attr === "style" )
207
-            continue;
211
+          if ( $attr === "style" ) {
212
+                      continue;
213
+          }
208 214
        
209 215
           $img_node->setAttribute($attr, $attr_node->value);
210 216
         }
211 217
 
212 218
         foreach ( $child->attributes as $attr => $node ) {
213
-          if ( $attr === "style" )
214
-            continue;
219
+          if ( $attr === "style" ) {
220
+                      continue;
221
+          }
215 222
           $child->removeAttribute($attr);
216 223
         }
217 224
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_frame_decorator.cls.php 1 patch
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -150,8 +150,9 @@  discard block
 block discarded – undo
150 150
 
151 151
         $new_header = $header->deep_copy();
152 152
 
153
-        if ( is_null($first_header) )
154
-          $first_header = $new_header;
153
+        if ( is_null($first_header) ) {
154
+                  $first_header = $new_header;
155
+        }
155 156
 
156 157
         $this->insert_child_before($new_header, $child);
157 158
       }
@@ -184,9 +185,10 @@  discard block
 block discarded – undo
184 185
    */
185 186
   static function find_parent_table(Frame $frame) {
186 187
 
187
-    while ( $frame = $frame->get_parent() )
188
-      if ( in_array($frame->get_style()->display, Style::$TABLE_TYPES) )
188
+    while ( $frame = $frame->get_parent() ) {
189
+          if ( in_array($frame->get_style()->display, Style::$TABLE_TYPES) )
189 190
         break;
191
+    }
190 192
 
191 193
     return $frame;
192 194
   }
@@ -279,8 +281,9 @@  discard block
 block discarded – undo
279 281
           // Lookup styles for tr tags.  If the user wants styles to work
280 282
           // better, they should make the tr explicit... I'm not going to
281 283
           // try to guess what they intended.
282
-          if ( $tr_style = $css->lookup("tr") )
283
-            $style->merge($tr_style);
284
+          if ( $tr_style = $css->lookup("tr") ) {
285
+                      $style->merge($tr_style);
286
+          }
284 287
 
285 288
           // Okay, I have absolutely no idea why I need this clone here, but
286 289
           // if it's omitted, php (as of 2004-07-28) segfaults.
@@ -302,16 +305,17 @@  discard block
 block discarded – undo
302 305
 
303 306
         // Normalise other table parts (i.e. row groups)
304 307
         foreach ($child->get_children() as $grandchild) {
305
-          if ( $grandchild->get_style()->display === "table-row" )
306
-            $grandchild->normalise();
308
+          if ( $grandchild->get_style()->display === "table-row" ) {
309
+                      $grandchild->normalise();
310
+          }
307 311
         }
308 312
 
309 313
         // Add headers and footers
310
-        if ( $display === "table-header-group" )
311
-          $this->_headers[] = $child;
312
-
313
-        else if ( $display === "table-footer-group" )
314
-          $this->_footers[] = $child;
314
+        if ( $display === "table-header-group" ) {
315
+                  $this->_headers[] = $child;
316
+        } else if ( $display === "table-footer-group" ) {
317
+                  $this->_footers[] = $child;
318
+        }
315 319
       }
316 320
     }
317 321
 
@@ -322,8 +326,9 @@  discard block
 block discarded – undo
322 326
       $this->_cellmap->add_row();
323 327
     }
324 328
 
325
-    foreach ($erroneous_frames as $frame)
326
-      $this->move_after($frame);
329
+    foreach ($erroneous_frames as $frame) {
330
+          $this->move_after($frame);
331
+    }
327 332
 
328 333
   }
329 334
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/abstract_renderer.cls.php 1 patch
Braces   +41 added lines, -25 removed lines patch added patch discarded remove patch
@@ -109,11 +109,14 @@  discard block
 block discarded – undo
109 109
     $sheet = $style->get_stylesheet();
110 110
 
111 111
     // Skip degenerate cases
112
-    if ( $width == 0 || $height == 0 )
113
-      return;
112
+    if ( $width == 0 || $height == 0 ) {
113
+          return;
114
+    }
114 115
 
115 116
     //debugpng
116
-    if (DEBUGPNG) print '[_background_image '.$url.']';
117
+    if (DEBUGPNG) {
118
+        print '[_background_image '.$url.']';
119
+    }
117 120
 
118 121
     list($img, $ext) = Image_Cache::resolve_url($url,
119 122
                                                 $sheet->get_protocol(),
@@ -121,8 +124,9 @@  discard block
 block discarded – undo
121 124
                                                 $sheet->get_base_path());
122 125
 
123 126
     // Bail if the image is no good
124
-    if ( $img === DOMPDF_LIB_DIR . "/res/broken_image.png" )
125
-      return;
127
+    if ( $img === DOMPDF_LIB_DIR . "/res/broken_image.png" ) {
128
+          return;
129
+    }
126 130
 
127 131
 	//Try to optimize away reading and composing of same background multiple times
128 132
 	//Postponing read with imagecreatefrom   ...()
@@ -446,16 +450,21 @@  discard block
 block discarded – undo
446 450
 	} else {
447 451
       $tmp_file = tempnam(DOMPDF_TEMP_DIR, "bg_dompdf_img_").'.png';
448 452
       //debugpng
449
-      if (DEBUGPNG) print '[_background_image '.$tmp_file.']';
453
+      if (DEBUGPNG) {
454
+          print '[_background_image '.$tmp_file.']';
455
+      }
450 456
 
451 457
       imagepng($bg, $tmp_file);
452 458
       $this->_canvas->image($tmp_file, "png", $x, $y, $width, $height);
453 459
 
454 460
       //debugpng
455
-      if (DEBUGPNG) print '[_background_image unlink '.$tmp_file.']';
461
+      if (DEBUGPNG) {
462
+          print '[_background_image unlink '.$tmp_file.']';
463
+      }
456 464
 
457
-      if (!DEBUGKEEPTEMP)
458
-        unlink($tmp_file);
465
+      if (!DEBUGKEEPTEMP) {
466
+              unlink($tmp_file);
467
+      }
459 468
     }
460 469
   }
461 470
 
@@ -467,10 +476,11 @@  discard block
 block discarded – undo
467 476
   protected function _border_dotted($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
468 477
     list($top, $right, $bottom, $left) = $widths;
469 478
 
470
-    if ( $$side < 2 )
471
-      $dash = array($$side, 2);
472
-    else
473
-      $dash = array($$side);
479
+    if ( $$side < 2 ) {
480
+          $dash = array($$side, 2);
481
+    } else {
482
+          $dash = array($$side);
483
+    }
474 484
   
475 485
     
476 486
     switch ($side) {
@@ -536,8 +546,9 @@  discard block
 block discarded – undo
536 546
                         $x + $length - $right, $y + $top,
537 547
                         $x + $left, $y + $top);
538 548
         $this->_canvas->polygon($points, $color, null, null, true);
539
-      } else
540
-        $this->_canvas->filled_rectangle($x, $y, $length, $top, $color);
549
+      } else {
550
+              $this->_canvas->filled_rectangle($x, $y, $length, $top, $color);
551
+      }
541 552
       
542 553
       break;
543 554
       
@@ -548,8 +559,9 @@  discard block
 block discarded – undo
548 559
                         $x + $length - $right, $y - $bottom,
549 560
                         $x + $left, $y - $bottom);
550 561
         $this->_canvas->polygon($points, $color, null, null, true);
551
-      } else
552
-        $this->_canvas->filled_rectangle($x, $y - $bottom, $length, $bottom, $color);
562
+      } else {
563
+              $this->_canvas->filled_rectangle($x, $y - $bottom, $length, $bottom, $color);
564
+      }
553 565
       
554 566
       break;
555 567
       
@@ -560,8 +572,9 @@  discard block
 block discarded – undo
560 572
                         $x + $left, $y + $length - $bottom,
561 573
                         $x + $left, $y + $top);
562 574
         $this->_canvas->polygon($points, $color, null, null, true);
563
-      } else
564
-        $this->_canvas->filled_rectangle($x, $y, $left, $length, $color);
575
+      } else {
576
+              $this->_canvas->filled_rectangle($x, $y, $left, $length, $color);
577
+      }
565 578
       
566 579
       break;
567 580
       
@@ -572,8 +585,9 @@  discard block
 block discarded – undo
572 585
                         $x - $right, $y + $length - $bottom,
573 586
                         $x - $right, $y + $top);
574 587
         $this->_canvas->polygon($points, $color, null, null, true);
575
-      } else
576
-        $this->_canvas->filled_rectangle($x - $right, $y, $right, $length, $color);
588
+      } else {
589
+              $this->_canvas->filled_rectangle($x - $right, $y, $right, $length, $color);
590
+      }
577 591
 
578 592
       break;
579 593
 
@@ -784,15 +798,17 @@  discard block
 block discarded – undo
784 798
   }
785 799
 
786 800
   protected function _tint($c) {
787
-    if ( !is_numeric($c) )
788
-      return $c;
801
+    if ( !is_numeric($c) ) {
802
+          return $c;
803
+    }
789 804
     
790 805
     return min(1, $c + 0.66);
791 806
   }
792 807
 
793 808
   protected function _shade($c) {
794
-    if ( !is_numeric($c) )
795
-      return $c;
809
+    if ( !is_numeric($c) ) {
810
+          return $c;
811
+    }
796 812
     
797 813
     return max(0, $c - 0.66);
798 814
   }
Please login to merge, or discard this patch.