Passed
Push — 1.10.x ( a2cc02...b21e58 )
by Yannick
608:36 queued 565:17
created
main/inc/lib/phpdocx/pdf/include/cellmap.cls.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
   }
171 171
 
172 172
   function &get_column($i) {
173
-    if ( !isset($this->_columns[$i]) )
173
+    if (!isset($this->_columns[$i]))
174 174
       $this->_columns[$i] = array("x" => 0,
175 175
                                   "min-width" => 0,
176 176
                                   "max-width" => 0,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
   }
188 188
 
189 189
   function &get_row($j) {
190
-    if ( !isset($this->_rows[$j]) )
190
+    if (!isset($this->_rows[$j]))
191 191
       $this->_rows[$j] = array("y" => 0,
192 192
                                "first-column" => 0,
193 193
                                "height" => null);
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
   }
196 196
 
197 197
   function get_border($i, $j, $h_v, $prop = null) {
198
-    if ( !isset($this->_borders[$i][$j][$h_v]) )
198
+    if (!isset($this->_borders[$i][$j][$h_v]))
199 199
       $this->_borders[$i][$j][$h_v] = array("width" => 0,
200 200
                                            "style" => "solid",
201 201
                                            "color" => "black");
202
-    if ( isset($prop) )
202
+    if (isset($prop))
203 203
       return $this->_borders[$i][$j][$h_v][$prop];
204 204
 
205 205
     return $this->_borders[$i][$j][$h_v];
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
   function get_border_properties($i, $j) {
209 209
 
210 210
     $left = $this->get_border($i, $j, "vertical");
211
-    $right = $this->get_border($i, $j+1, "vertical");
211
+    $right = $this->get_border($i, $j + 1, "vertical");
212 212
     $top = $this->get_border($i, $j, "horizontal");
213
-    $bottom = $this->get_border($i+1, $j, "horizontal");
213
+    $bottom = $this->get_border($i + 1, $j, "horizontal");
214 214
 
215 215
     return compact("top", "bottom", "left", "right");
216 216
   }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
   function get_spanned_cells($frame) {
221 221
     $key = $frame->get_id();
222 222
 
223
-    if ( !isset($this->_frames[$key]) ) {
223
+    if (!isset($this->_frames[$key])) {
224 224
       throw new DOMPDF_Internal_Exception("Frame not found in cellmap");
225 225
     }
226 226
 
@@ -238,20 +238,20 @@  discard block
 block discarded – undo
238 238
 
239 239
     $key = $frame->get_id();
240 240
 
241
-    if ( !isset($this->_frames[$key]) ) {
241
+    if (!isset($this->_frames[$key])) {
242 242
       throw new DOMPDF_Internal_Exception("Frame not found in cellmap");
243 243
     }
244 244
 
245 245
     $col = $this->_frames[$key]["columns"][0];
246 246
     $row = $this->_frames[$key]["rows"][0];
247 247
 
248
-    if ( !isset($this->_columns[$col])) {
248
+    if (!isset($this->_columns[$col])) {
249 249
       $_dompdf_warnings[] = "Frame not found in columns array.  Check your table layout for missing or extra TDs.";
250 250
       $x = 0;
251 251
     } else
252 252
       $x = $this->_columns[$col]["x"];
253 253
 
254
-    if ( !isset($this->_rows[$row])) {
254
+    if (!isset($this->_rows[$row])) {
255 255
       $_dompdf_warnings[] = "Frame not found in row array.  Check your table layout for missing or extra TDs.";
256 256
       $y = 0;
257 257
     } else
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
   function get_frame_width($frame) {
264 264
     $key = $frame->get_id();
265 265
 
266
-    if ( !isset($this->_frames[$key]) ) {
266
+    if (!isset($this->_frames[$key])) {
267 267
       throw new DOMPDF_Internal_Exception("Frame not found in cellmap");
268 268
     }
269 269
 
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
   function get_frame_height($frame) {
280 280
     $key = $frame->get_id();
281 281
 
282
-    if ( !isset($this->_frames[$key]) )
282
+    if (!isset($this->_frames[$key]))
283 283
       throw new DOMPDF_Internal_Exception("Frame not found in cellmap");
284 284
 
285 285
     $rows = $this->_frames[$key]["rows"];
286 286
     $h = 0;
287 287
     foreach ($rows as $i) {
288
-      if ( !isset($this->_rows[$i]) )  {
288
+      if (!isset($this->_rows[$i])) {
289 289
         throw new Exception("foo");
290 290
       }
291 291
       $h += $this->_rows[$i]["height"];
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
   //........................................................................
299 299
 
300 300
   function set_column_width($j, $width) {
301
-    $col =& $this->get_column($j);
301
+    $col = & $this->get_column($j);
302 302
     $col["used-width"] = $width;
303
-    $next_col =& $this->get_column($j+1);
303
+    $next_col = & $this->get_column($j + 1);
304 304
     $next_col["x"] = $next_col["x"] + $width;
305 305
   }
306 306
 
307 307
   function set_row_height($i, $height) {
308
-    $row =& $this->get_row($i);
309
-    if ( $height <= $row["height"] )
308
+    $row = & $this->get_row($i);
309
+    if ($height <= $row["height"])
310 310
       return;
311 311
 
312 312
     $row["height"] = $height;
313
-    $next_row =& $this->get_row($i+1);
313
+    $next_row = & $this->get_row($i + 1);
314 314
     $next_row["y"] = $row["y"] + $height;
315 315
 
316 316
   }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     $n_style = $border_spec["style"];
324 324
     $n_color = $border_spec["color"];
325 325
 
326
-    if ( !isset($this->_borders[$i][$j][$h_v]) ) {
326
+    if (!isset($this->_borders[$i][$j][$h_v])) {
327 327
       $this->_borders[$i][$j][$h_v] = $border_spec;
328 328
       return $this->_borders[$i][$j][$h_v]["width"];
329 329
     }
@@ -332,15 +332,15 @@  discard block
 block discarded – undo
332 332
     $o_style = $this->_borders[$i][$j][$h_v]["style"];
333 333
     $o_color = $this->_borders[$i][$j][$h_v]["color"];
334 334
 
335
-    if ( ($n_style === "hidden" ||
336
-          $n_width  >  $o_width ||
335
+    if (($n_style === "hidden" ||
336
+          $n_width > $o_width ||
337 337
           $o_style === "none")
338 338
 
339 339
          or
340 340
 
341 341
          ($o_width == $n_width &&
342 342
           in_array($n_style, self::$_BORDER_STYLE_SCORE) &&
343
-          self::$_BORDER_STYLE_SCORE[ $n_style ] > self::$_BORDER_STYLE_SCORE[ $o_style ]) )
343
+          self::$_BORDER_STYLE_SCORE[$n_style] > self::$_BORDER_STYLE_SCORE[$o_style]))
344 344
       $this->_borders[$i][$j][$h_v] = $border_spec;
345 345
 
346 346
     return $this->_borders[$i][$j][$h_v]["width"];
@@ -356,37 +356,37 @@  discard block
 block discarded – undo
356 356
     $collapse = $this->_table->get_style()->border_collapse == "collapse";
357 357
 
358 358
     // Recursively add the frames within tables, table-row-groups and table-rows
359
-    if ( $display == "table-row" ||
359
+    if ($display == "table-row" ||
360 360
          $display == "table" ||
361 361
          $display == "inline-table" ||
362
-         in_array($display, Table_Frame_Decorator::$ROW_GROUPS) ) {
362
+         in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) {
363 363
 
364 364
       $start_row = $this->__row;
365
-      foreach ( $frame->get_children() as $child )
366
-        $this->add_frame( $child );
365
+      foreach ($frame->get_children() as $child)
366
+        $this->add_frame($child);
367 367
 
368
-      if ( $display == "table-row" )
368
+      if ($display == "table-row")
369 369
         $this->add_row();
370 370
 
371 371
       $num_rows = $this->__row - $start_row - 1;
372 372
       $key = $frame->get_id();
373 373
 
374 374
       // Row groups always span across the entire table
375
-      $this->_frames[ $key ]["columns"] = range(0,max(0,$this->_num_cols-1));
376
-      $this->_frames[ $key ]["rows"] = range($start_row, max(0, $this->__row - 1));
377
-      $this->_frames[ $key ]["frame"] = $frame;
375
+      $this->_frames[$key]["columns"] = range(0, max(0, $this->_num_cols - 1));
376
+      $this->_frames[$key]["rows"] = range($start_row, max(0, $this->__row - 1));
377
+      $this->_frames[$key]["frame"] = $frame;
378 378
 
379
-      if ( $display != "table-row" && $collapse ) {
379
+      if ($display != "table-row" && $collapse) {
380 380
 
381 381
         $bp = $style->get_border_properties();
382 382
 
383 383
         // Resolve the borders
384
-        for ( $i = 0; $i < $num_rows+1; $i++) {
384
+        for ($i = 0; $i < $num_rows + 1; $i++) {
385 385
           $this->_resolve_border($start_row + $i, 0, "vertical", $bp["left"]);
386 386
           $this->_resolve_border($start_row + $i, $this->_num_cols, "vertical", $bp["right"]);
387 387
         }
388 388
 
389
-        for ( $j = 0; $j < $this->_num_cols; $j++) {
389
+        for ($j = 0; $j < $this->_num_cols; $j++) {
390 390
           $this->_resolve_border($start_row, $j, "horizontal", $bp["top"]);
391 391
           $this->_resolve_border($this->__row, $j, "horizontal", $bp["bottom"]);
392 392
         }
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
     $colspan = $frame->get_node()->getAttribute("colspan");
401 401
     $rowspan = $frame->get_node()->getAttribute("rowspan");
402 402
 
403
-    if ( !$colspan ) {
403
+    if (!$colspan) {
404 404
       $colspan = 1;
405
-      $frame->get_node()->setAttribute("colspan",1);
405
+      $frame->get_node()->setAttribute("colspan", 1);
406 406
     }
407 407
 
408
-    if ( !$rowspan ) {
408
+    if (!$rowspan) {
409 409
       $rowspan = 1;
410
-      $frame->get_node()->setAttribute("rowspan",1);
410
+      $frame->get_node()->setAttribute("rowspan", 1);
411 411
     }
412 412
     $key = $frame->get_id();
413 413
 
@@ -419,20 +419,20 @@  discard block
 block discarded – undo
419 419
 
420 420
     // Find the next available column (fix by Ciro Mondueri)
421 421
     $ac = $this->__col;
422
-    while ( isset($this->_cells[$this->__row][$ac]) )
422
+    while (isset($this->_cells[$this->__row][$ac]))
423 423
        $ac++;
424 424
     $this->__col = $ac;
425 425
 
426 426
     // Rows:
427
-    for ( $i = 0; $i < $rowspan; $i++ ) {
427
+    for ($i = 0; $i < $rowspan; $i++) {
428 428
       $row = $this->__row + $i;
429 429
 
430
-      $this->_frames[ $key ]["rows"][] = $row;
430
+      $this->_frames[$key]["rows"][] = $row;
431 431
 
432
-      for ( $j = 0; $j < $colspan; $j++)
432
+      for ($j = 0; $j < $colspan; $j++)
433 433
         $this->_cells[$row][$this->__col + $j] = $frame;
434 434
 
435
-      if ( $collapse ) {
435
+      if ($collapse) {
436 436
         // Resolve vertical borders
437 437
         $max_left = max($max_left, $this->_resolve_border($row, $this->__col, "vertical", $bp["left"]));
438 438
         $max_right = max($max_right, $this->_resolve_border($row, $this->__col + $colspan, "vertical", $bp["right"]));
@@ -442,21 +442,21 @@  discard block
 block discarded – undo
442 442
     $max_top = $max_bottom = 0;
443 443
 
444 444
     // Columns:
445
-    for ( $j = 0; $j < $colspan; $j++ ) {
445
+    for ($j = 0; $j < $colspan; $j++) {
446 446
       $col = $this->__col + $j;
447
-      $this->_frames[ $key ]["columns"][] = $col;
447
+      $this->_frames[$key]["columns"][] = $col;
448 448
 
449
-      if ( $collapse ) {
449
+      if ($collapse) {
450 450
         // Resolve horizontal borders
451 451
         $max_top = max($max_top, $this->_resolve_border($this->__row, $col, "horizontal", $bp["top"]));
452 452
         $max_bottom = max($max_bottom, $this->_resolve_border($this->__row + $rowspan, $col, "horizontal", $bp["bottom"]));
453 453
       }
454 454
     }
455 455
 
456
-    $this->_frames[ $key ]["frame"] = $frame;
456
+    $this->_frames[$key]["frame"] = $frame;
457 457
 
458 458
     // Handle seperated border model
459
-    if ( !$collapse ) {
459
+    if (!$collapse) {
460 460
       list($h, $v) = $this->_table->get_style()->border_spacing;
461 461
 
462 462
       // Border spacing is effectively a margin between cells
@@ -481,26 +481,26 @@  discard block
 block discarded – undo
481 481
 
482 482
     $width = $style->width;
483 483
 
484
-    if ( is_percent($width) ) {
484
+    if (is_percent($width)) {
485 485
       $var = "percent";
486
-      $val = (float)rtrim($width, "% ") / $colspan;
486
+      $val = (float) rtrim($width, "% ") / $colspan;
487 487
 
488
-    } else if ( $width !== "auto" ) {
488
+    } else if ($width !== "auto") {
489 489
       $var = "absolute";
490 490
       $val = $style->length_in_pt($frame_min) / $colspan;
491 491
     }
492 492
 
493 493
     $min = 0;
494 494
     $max = 0;
495
-    for ( $cs = 0; $cs < $colspan; $cs++ ) {
495
+    for ($cs = 0; $cs < $colspan; $cs++) {
496 496
 
497 497
       // Resolve the frame's width(s) with other cells
498
-      $col =& $this->get_column( $this->__col + $cs );
498
+      $col = & $this->get_column($this->__col + $cs);
499 499
 
500 500
       // Note: $var is either 'percent' or 'absolute'.  We compare the
501 501
       // requested percentage or absolute values with the existing widths
502 502
       // and adjust accordingly.
503
-      if ( isset($var) && $val > $col[$var] ) {
503
+      if (isset($var) && $val > $col[$var]) {
504 504
         $col[$var] = $val;
505 505
         $col["auto"] = false;
506 506
       }
@@ -510,25 +510,25 @@  discard block
 block discarded – undo
510 510
     }
511 511
 
512 512
 
513
-    if ( $frame_min > $min ) {
513
+    if ($frame_min > $min) {
514 514
       // The frame needs more space.  Expand each sub-column
515 515
       $inc = ($frame_min - $min) / $colspan;
516 516
       for ($c = 0; $c < $colspan; $c++) {
517
-        $col =& $this->get_column($this->__col + $c);
517
+        $col = & $this->get_column($this->__col + $c);
518 518
         $col["min-width"] += $inc;
519 519
       }
520 520
     }
521 521
 
522
-    if ( $frame_max > $max ) {
522
+    if ($frame_max > $max) {
523 523
       $inc = ($frame_max - $max) / $colspan;
524 524
       for ($c = 0; $c < $colspan; $c++) {
525
-        $col =& $this->get_column($this->__col + $c);
525
+        $col = & $this->get_column($this->__col + $c);
526 526
         $col["max-width"] += $inc;
527 527
       }
528 528
     }
529 529
 
530 530
     $this->__col += $colspan;
531
-    if ( $this->__col > $this->_num_cols )
531
+    if ($this->__col > $this->_num_cols)
532 532
       $this->_num_cols = $this->__col;
533 533
 
534 534
   }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 
543 543
     // Find the next available column
544 544
     $i = 0;
545
-    while ( isset($this->_cells[$this->__row][$i]) )
545
+    while (isset($this->_cells[$this->__row][$i]))
546 546
       $i++;
547 547
 
548 548
     $this->__col = $i;
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
   function remove_row(Frame $row) {
560 560
 
561 561
     $key = $row->get_id();
562
-    if ( !isset($this->_frames[$key]) )
563
-      return;  // Presumably this row has alredy been removed
562
+    if (!isset($this->_frames[$key]))
563
+      return; // Presumably this row has alredy been removed
564 564
 
565 565
     $this->_row = $this->_num_rows--;
566 566
 
@@ -568,11 +568,11 @@  discard block
 block discarded – undo
568 568
     $columns = $this->_frames[$key]["columns"];
569 569
 
570 570
     // Remove all frames from this row
571
-    foreach ( $rows as $r ) {
572
-      foreach ( $columns as $c ) {
573
-        if ( isset($this->_cells[$r][$c]) ) {
571
+    foreach ($rows as $r) {
572
+      foreach ($columns as $c) {
573
+        if (isset($this->_cells[$r][$c])) {
574 574
           $frame = $this->_cells[$r][$c];
575
-          unset($this->_frames[ $frame->get_id() ]);
575
+          unset($this->_frames[$frame->get_id()]);
576 576
           unset($this->_cells[$r][$c]);
577 577
         }
578 578
       }
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
   function remove_row_group(Frame $group) {
592 592
 
593 593
     $key = $group->get_id();
594
-    if ( !isset($this->_frames[$key]) )
595
-      return;  // Presumably this row has alredy been removed
594
+    if (!isset($this->_frames[$key]))
595
+      return; // Presumably this row has alredy been removed
596 596
 
597 597
     $iter = $group->get_first_child();
598 598
     while ($iter) {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
     $r_key = $last_row->get_id();
616 616
 
617 617
     $r_rows = $this->_frames[$r_key]["rows"];
618
-    $this->_frames[$g_key]["rows"] = range( $this->_frames[$g_key]["rows"][0], end($r_rows) );
618
+    $this->_frames[$g_key]["rows"] = range($this->_frames[$g_key]["rows"][0], end($r_rows));
619 619
 
620 620
   }
621 621
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     // column[0]["x"] must be set.
627 627
 
628 628
     $x = $this->_columns[0]["x"];
629
-    foreach ( array_keys($this->_columns) as $j ) {
629
+    foreach (array_keys($this->_columns) as $j) {
630 630
       $this->_columns[$j]["x"] = $x;
631 631
       $x += $this->_columns[$j]["used-width"];
632 632
 
@@ -638,18 +638,18 @@  discard block
 block discarded – undo
638 638
     // Pre-condition: widths and heights of each column & row must be
639 639
     // calcluated
640 640
 
641
-    foreach ( $this->_frames as $arr ) {
641
+    foreach ($this->_frames as $arr) {
642 642
       $frame = $arr["frame"];
643 643
 
644 644
       $h = 0;
645
-      foreach( $arr["rows"] as $row ) {
646
-        if ( !isset($this->_rows[$row]) )
645
+      foreach ($arr["rows"] as $row) {
646
+        if (!isset($this->_rows[$row]))
647 647
           // The row has been removed because of a page split, so skip it.
648 648
           continue;
649 649
         $h += $this->_rows[$row]["height"];
650 650
       }
651 651
 
652
-      if ( $frame instanceof Table_Cell_Frame_Decorator )
652
+      if ($frame instanceof Table_Cell_Frame_Decorator)
653 653
         $frame->set_cell_height($h);
654 654
       else
655 655
         $frame->get_style()->height = $h;
@@ -666,12 +666,12 @@  discard block
 block discarded – undo
666 666
 
667 667
 
668 668
     // Distribute the increased height proportionally amongst each row
669
-    foreach ( $this->_frames as $arr ) {
669
+    foreach ($this->_frames as $arr) {
670 670
       $frame = $arr["frame"];
671 671
 
672 672
       $h = 0;
673
-      foreach ($arr["rows"] as $row ) {
674
-        if ( !isset($this->_rows[$row]) )
673
+      foreach ($arr["rows"] as $row) {
674
+        if (!isset($this->_rows[$row]))
675 675
           continue;
676 676
 
677 677
         $h += $this->_rows[$row]["height"];
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 
680 680
       $new_height = ($h / $content_height) * $table_height;
681 681
 
682
-      if ( $frame instanceof Table_Cell_Frame_Decorator )
682
+      if ($frame instanceof Table_Cell_Frame_Decorator)
683 683
         $frame->set_cell_height($new_height);
684 684
       else
685 685
         $frame->get_style()->height = $new_height;
@@ -694,19 +694,19 @@  discard block
 block discarded – undo
694 694
     $str = "";
695 695
     $str .= "Columns:<br/>";
696 696
     $str .= pre_r($this->_columns, true);
697
-    $str .=  "Rows:<br/>";
697
+    $str .= "Rows:<br/>";
698 698
     $str .= pre_r($this->_rows, true);
699 699
 
700
-    $str .=  "Frames:<br/>";
700
+    $str .= "Frames:<br/>";
701 701
     $arr = array();
702
-    foreach ( $this->_frames as $key => $val )
702
+    foreach ($this->_frames as $key => $val)
703 703
       $arr[$key] = array("columns" => $val["columns"], "rows" => $val["rows"]);
704 704
 
705 705
     $str .= pre_r($arr, true);
706 706
 
707
-    if ( php_sapi_name() == "cli" )
708
-      $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
709
-                                    array("\n",chr(27)."[01;33m", chr(27)."[0m"),
707
+    if (php_sapi_name() == "cli")
708
+      $str = strip_tags(str_replace(array("<br/>", "<b>", "</b>"),
709
+                                    array("\n", chr(27)."[01;33m", chr(27)."[0m"),
710 710
                                     $str));
711 711
     return $str;
712 712
   }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_frame_reflower.cls.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
   function reflow() {
58 58
     $page = $this->_frame->get_root();
59 59
 
60
-    if ( $page->is_full() )
60
+    if ($page->is_full())
61 61
       return;
62 62
 
63 63
     $this->_frame->position();
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     foreach ($this->_frame->get_children() as $child) {
68 68
 
69
-      if ( $page->is_full() )
69
+      if ($page->is_full())
70 70
         return;
71 71
 
72 72
       $child->set_containing_block($cb);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     }
76 76
 
77
-    if ( $page->is_full() )
77
+    if ($page->is_full())
78 78
       return;
79 79
 
80 80
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/list_bullet_frame_decorator.cls.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 
56 56
   const BULLET_PADDING = 1; // Distance from bullet to text in pt
57 57
   // As fraction of font size (including descent). See also DECO_THICKNESS.
58
-  const BULLET_THICKNESS = 0.04;   // Thickness of bullet outline. Screen: 0.08, print: better less, e.g. 0.04
59
-  const BULLET_DESCENT = 0.3;  //descent of font below baseline. Todo: Guessed for now.
60
-  const BULLET_SIZE = 0.35;   // bullet diameter. For now 0.5 of font_size without descent.
58
+  const BULLET_THICKNESS = 0.04; // Thickness of bullet outline. Screen: 0.08, print: better less, e.g. 0.04
59
+  const BULLET_DESCENT = 0.3; //descent of font below baseline. Todo: Guessed for now.
60
+  const BULLET_SIZE = 0.35; // bullet diameter. For now 0.5 of font_size without descent.
61 61
   
62 62
   static $BULLET_TYPES = array("disc", "circle", "square");
63 63
   
@@ -71,23 +71,23 @@  discard block
 block discarded – undo
71 71
     $style = $this->_frame->get_style();
72 72
     // Small hack to prevent extra indenting of list text on list_style_position === "inside"
73 73
     // and on suppressed bullet
74
-    if ( $style->list_style_position === "outside" ||
75
-         $style->list_style_type === "none" )
74
+    if ($style->list_style_position === "outside" ||
75
+         $style->list_style_type === "none")
76 76
       return 0;
77
-    return $style->get_font_size()*self::BULLET_SIZE + 2 * self::BULLET_PADDING;
77
+    return $style->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING;
78 78
   }
79 79
 
80 80
   //hits only on "inset" lists items, to increase height of box
81 81
   function get_margin_height() {
82
-    return $this->_frame->get_style()->get_font_size()*self::BULLET_SIZE + 2 * self::BULLET_PADDING;
82
+    return $this->_frame->get_style()->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING;
83 83
   }
84 84
 
85 85
   function get_width() {
86
-    return $this->_frame->get_style()->get_font_size()*self::BULLET_SIZE + 2 * self::BULLET_PADDING;
86
+    return $this->_frame->get_style()->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING;
87 87
   }
88 88
   
89 89
   function get_height() {
90
-    return $this->_frame->get_style()->get_font_size()*self::BULLET_SIZE + 2 * self::BULLET_PADDING;
90
+    return $this->_frame->get_style()->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING;
91 91
   }
92 92
   
93 93
   //........................................................................
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/block_positioner.cls.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 
58 58
     $p = $this->_frame->find_block_parent();
59 59
     
60
-    if ( $p ) {
60
+    if ($p) {
61 61
       $p->add_line();
62 62
       $y = $p->get_current_line("y");
63 63
       
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/text_frame_reflower.cls.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 
56 56
     // Handle text transform
57 57
     $transform = $this->_frame->get_style()->text_transform;
58
-    switch ( strtolower($transform) ) {
58
+    switch (strtolower($transform)) {
59 59
     case "capitalize":
60
-      $this->_frame->set_text( ucwords($this->_frame->get_text()) );
60
+      $this->_frame->set_text(ucwords($this->_frame->get_text()));
61 61
       break;
62 62
 
63 63
     case "uppercase":
64
-      $this->_frame->set_text( strtoupper($this->_frame->get_text()) );
64
+      $this->_frame->set_text(strtoupper($this->_frame->get_text()));
65 65
       break;
66 66
 
67 67
     case "lowercase":
68
-      $this->_frame->set_text( strtolower($this->_frame->get_text()) );
68
+      $this->_frame->set_text(strtolower($this->_frame->get_text()));
69 69
       break;
70 70
 
71 71
     default:
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
     // Determine the frame width including margin, padding & border
107 107
     $text_width = Font_Metrics::get_text_width($text, $font, $size, $word_spacing);
108 108
     $mbp_width =
109
-      $style->length_in_pt( array( $style->margin_left,
109
+      $style->length_in_pt(array($style->margin_left,
110 110
                                    $style->border_left_width,
111 111
                                    $style->padding_left,
112 112
                                    $style->padding_right,
113 113
                                    $style->border_right_width,
114
-                                   $style->margin_right), $line_width );
114
+                                   $style->margin_right), $line_width);
115 115
     $frame_width = $text_width + $mbp_width;
116 116
 
117 117
 // Debugging:
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 //     pre_r($words);
127 127
 
128
-    if ( $frame_width <= $available_width )
128
+    if ($frame_width <= $available_width)
129 129
       return false;
130 130
 
131 131
     // Determine the split point
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     reset($words);
135 135
 
136 136
     for ($i = 0; $i < count($words); $i += 2) {
137
-      $word = $words[$i] . (isset($words[$i+1]) ? $words[$i+1] : "");
137
+      $word = $words[$i].(isset($words[$i + 1]) ? $words[$i + 1] : "");
138 138
       $word_width = Font_Metrics::get_text_width($word, $font, $size, $word_spacing);
139
-      if ( $width + $word_width + $mbp_width > $available_width )
139
+      if ($width + $word_width + $mbp_width > $available_width)
140 140
         break;
141 141
 
142 142
       $width += $word_width;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     }
146 146
 
147 147
     // The first word has overflowed.   Force it onto the line
148
-    if ( $current_line_width == 0 && $width == 0 ) {
148
+    if ($current_line_width == 0 && $width == 0) {
149 149
       $width += $word_width;
150 150
       $str .= $word;
151 151
     }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 
166 166
   protected function _newline_break($text) {
167 167
 
168
-    if ( ($i = mb_strpos($text, "\n")) === false)
168
+    if (($i = mb_strpos($text, "\n")) === false)
169 169
       return false;
170 170
 
171
-    return $i+1;
171
+    return $i + 1;
172 172
 
173 173
   }
174 174
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     $word_spacing = $style->length_in_pt($style->word_spacing);
183 183
 
184 184
     // Determine the text height
185
-    $style->height = Font_Metrics::get_font_height( $font, $size );
185
+    $style->height = Font_Metrics::get_font_height($font, $size);
186 186
 
187 187
     $split = false;
188 188
     $add_line = false;
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 
217 217
     default:
218 218
     case "normal":
219
-      $this->_frame->set_text( $text = $this->_collapse_white_space($text) );
220
-      if ( $text == "" )
219
+      $this->_frame->set_text($text = $this->_collapse_white_space($text));
220
+      if ($text == "")
221 221
         break;
222 222
 
223 223
       $split = $this->_line_break($text);
@@ -229,13 +229,13 @@  discard block
 block discarded – undo
229 229
       break;
230 230
 
231 231
     case "nowrap":
232
-      $this->_frame->set_text( $text = $this->_collapse_white_space($text) );
232
+      $this->_frame->set_text($text = $this->_collapse_white_space($text));
233 233
       break;
234 234
 
235 235
     case "pre-wrap":
236 236
       $split = $this->_newline_break($text);
237 237
 
238
-      if ( ($tmp = $this->_line_break($text)) !== false ) {
238
+      if (($tmp = $this->_line_break($text)) !== false) {
239 239
         $add_line = $split < $tmp;
240 240
         $split = min($tmp, $split);
241 241
       } else
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 
246 246
     case "pre-line":
247 247
       // Collapse white-space except for \n
248
-      $this->_frame->set_text( $text = preg_replace( "/[ \t]+/u", " ", $text ) );
248
+      $this->_frame->set_text($text = preg_replace("/[ \t]+/u", " ", $text));
249 249
 
250
-      if ( $text == "" )
250
+      if ($text == "")
251 251
         break;
252 252
 
253 253
       $split = $this->_newline_break($text);
254 254
 
255
-      if ( ($tmp = $this->_line_break($text)) !== false ) {
255
+      if (($tmp = $this->_line_break($text)) !== false) {
256 256
         $add_line = $split < $tmp;
257 257
         $split = min($tmp, $split);
258 258
       } else
@@ -263,18 +263,18 @@  discard block
 block discarded – undo
263 263
     }
264 264
 
265 265
     // Handle degenerate case
266
-    if ( $text === "" )
266
+    if ($text === "")
267 267
       return;
268 268
 
269
-    if ( $split !== false) {
269
+    if ($split !== false) {
270 270
 
271 271
       // Handle edge cases
272
-      if ( $split == 0 && $text === " " ) {
272
+      if ($split == 0 && $text === " ") {
273 273
         $this->_frame->set_text("");
274 274
         return;
275 275
       }
276 276
 
277
-      if ( $split == 0 ) {
277
+      if ($split == 0) {
278 278
 
279 279
         // Trim newlines from the beginning of the line
280 280
         //$this->_frame->set_text(ltrim($text, "\n\r"));
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
         // Layout the new line
286 286
         $this->_layout_line();
287 287
 
288
-      } else if ( $split < mb_strlen($this->_frame->get_text()) ) {
288
+      } else if ($split < mb_strlen($this->_frame->get_text())) {
289 289
 
290 290
         // split the line if required
291 291
         $this->_frame->split_text($split);
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
         // Remove any trailing newlines
294 294
         $t = $this->_frame->get_text();
295 295
 
296
-        if ( $split > 1 && $t[$split-1] === "\n" )
297
-          $this->_frame->set_text( mb_substr($t, 0, -1) );
296
+        if ($split > 1 && $t[$split - 1] === "\n")
297
+          $this->_frame->set_text(mb_substr($t, 0, -1));
298 298
 
299 299
       }
300 300
 
301
-      if ( $add_line ) {
301
+      if ($add_line) {
302 302
         $this->_block_parent->add_line();
303 303
         $this->_frame->position();
304 304
       }
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
 
350 350
     $spacing = $style->length_in_pt($style->word_spacing);
351 351
 
352
-    switch($style->white_space) {
352
+    switch ($style->white_space) {
353 353
 
354 354
     default:
355 355
     case "normal":
356
-      $str = preg_replace("/[\s\n]+/u"," ", $str);
356
+      $str = preg_replace("/[\s\n]+/u", " ", $str);
357 357
     case "pre-wrap":
358 358
     case "pre-line":
359 359
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
       // This technique (using arrays & an anonymous function) is actually
363 363
       // faster than doing a single-pass character by character scan.  Heh,
364 364
       // yes I took the time to bench it ;)
365
-      $words = array_flip(preg_split("/[\s-]+/u",$str, -1, PREG_SPLIT_DELIM_CAPTURE));
365
+      $words = array_flip(preg_split("/[\s-]+/u", $str, -1, PREG_SPLIT_DELIM_CAPTURE));
366 366
       array_walk($words, create_function('&$val,$str',
367 367
                                          '$val = Font_Metrics::get_text_width($str, "'.$font.'", '.$size.', '.$spacing.');'));
368 368
       arsort($words);
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
     default:
390 390
     case "normal":
391 391
     case "nowrap":
392
-      $str = preg_replace("/[\s\n]+/u"," ", $text);
392
+      $str = preg_replace("/[\s\n]+/u", " ", $text);
393 393
       break;
394 394
 
395 395
     case "pre-line":
396
-      $str = preg_replace( "/[ \t]+/u", " ", $text);
396
+      $str = preg_replace("/[ \t]+/u", " ", $text);
397 397
 
398 398
     case "pre-wrap":
399 399
       // Find the longest word (i.e. minimum length)
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/list_bullet_positioner.cls.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@
 block discarded – undo
74 74
 
75 75
     // This is a bit of a hack...
76 76
     $n = $this->_frame->get_next_sibling();
77
-    if ( $n ) {
77
+    if ($n) {
78 78
       $style = $n->get_style();
79
-      $y += $style->length_in_pt( array($style->margin_top, $style->padding_top),
80
-                                  $n->get_containing_block("w") );
79
+      $y += $style->length_in_pt(array($style->margin_top, $style->padding_top),
80
+                                  $n->get_containing_block("w"));
81 81
     }
82 82
 
83 83
 	// Now the position is the left top of the block which should be marked with the bullet.
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/dompdf.cls.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -267,24 +267,24 @@  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 )
270
+    if (!$this->_protocol && !$this->_base_host && !$this->_base_path)
271 271
       list($this->_protocol, $this->_base_host, $this->_base_path) = explode_url($file);
272 272
 
273
-    if ( !DOMPDF_ENABLE_REMOTE &&
274
-         ($this->_protocol != "" && $this->_protocol !== "file://" ) )
273
+    if (!DOMPDF_ENABLE_REMOTE &&
274
+         ($this->_protocol != "" && $this->_protocol !== "file://"))
275 275
       throw new DOMPDF_Exception("Remote file requested, but DOMPDF_ENABLE_REMOTE is false.");
276 276
 
277 277
     if ($this->_protocol == "" || $this->_protocol === "file://") {
278 278
 
279 279
       $realfile = realpath($file);
280
-      if ( !$file )
280
+      if (!$file)
281 281
         throw new DOMPDF_Exception("File '$file' not found.");
282 282
 
283
-      if ( strpos($realfile, DOMPDF_CHROOT) !== 0 )
283
+      if (strpos($realfile, DOMPDF_CHROOT) !== 0)
284 284
         throw new DOMPDF_Exception("Permission denied on $file.");
285 285
 
286 286
       // Exclude dot files (e.g. .htaccess)
287
-      if ( substr(basename($realfile),0,1) === "." )
287
+      if (substr(basename($realfile), 0, 1) === ".")
288 288
         throw new DOMPDF_Exception("Permission denied on $file.");
289 289
 
290 290
       $file = $realfile;
@@ -305,30 +305,30 @@  discard block
 block discarded – undo
305 305
     mb_detect_order('auto');
306 306
     if (mb_detect_encoding($str) != 'UTF-8') {
307 307
       if (mb_detect_encoding($str) == '') {
308
-        if (preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s*?charset=([^\s"]+))?@i',$str,$matches)) {
308
+        if (preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s*?charset=([^\s"]+))?@i', $str, $matches)) {
309 309
           $encoding = strtoupper($matches[3]);
310 310
         } else {
311 311
           $encoding = 'UTF-8';
312 312
         }
313 313
       } else {
314
-        if (preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s*?charset=([^\s"]+))?@i',$str,$matches)) {
314
+        if (preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s*?charset=([^\s"]+))?@i', $str, $matches)) {
315 315
           $encoding = strtoupper($matches[3]);
316 316
         } else {
317 317
           $encoding = 'auto';
318 318
         }
319 319
       }
320 320
       if ($encoding != 'UTF-8') { $str = mb_convert_encoding($str, 'UTF-8', $encoding); }
321
-      if (preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i',$str,$matches)) {
322
-        $str = preg_replace('/charset=([^\s"]+)/i','charset=UTF-8',$str);
321
+      if (preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i', $str, $matches)) {
322
+        $str = preg_replace('/charset=([^\s"]+)/i', 'charset=UTF-8', $str);
323 323
       } else {
324 324
         $str = str_replace('<head>', '<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">', $str);
325 325
       }
326 326
     }
327 327
 
328 328
     // Parse embedded php, first-pass
329
-    if ( DOMPDF_ENABLE_PHP ) {
329
+    if (DOMPDF_ENABLE_PHP) {
330 330
       ob_start();
331
-      eval("?" . ">$str");
331
+      eval("?".">$str");
332 332
       $str = ob_get_contents();
333 333
       ob_end_clean();
334 334
     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     $this->_css->load_css_file(Stylesheet::DEFAULT_STYLESHEET);
350 350
 
351 351
     $acceptedmedia = Stylesheet::$ACCEPTED_GENERIC_MEDIA_TYPES;
352
-    if ( defined("DOMPDF_DEFAULT_MEDIA_TYPE") ) {
352
+    if (defined("DOMPDF_DEFAULT_MEDIA_TYPE")) {
353 353
       $acceptedmedia[] = DOMPDF_DEFAULT_MEDIA_TYPE;
354 354
     } else {
355 355
       $acceptedmedia[] = Stylesheet::$ACCEPTED_DEFAULT_MEDIA_TYPE;
@@ -358,15 +358,15 @@  discard block
 block discarded – undo
358 358
     // load <link rel="STYLESHEET" ... /> tags
359 359
     $links = $this->_xml->getElementsByTagName("link");
360 360
     foreach ($links as $link) {
361
-      if ( mb_strtolower($link->getAttribute("rel")) === "stylesheet" ||
362
-           mb_strtolower($link->getAttribute("type")) === "text/css" ) {
361
+      if (mb_strtolower($link->getAttribute("rel")) === "stylesheet" ||
362
+           mb_strtolower($link->getAttribute("type")) === "text/css") {
363 363
         //Check if the css file is for an accepted media type
364 364
         //media not given then always valid
365
-        $formedialist = preg_split("/[\s\n,]/", $link->getAttribute("media"),-1, PREG_SPLIT_NO_EMPTY);
366
-        if ( count($formedialist) > 0 ) {
365
+        $formedialist = preg_split("/[\s\n,]/", $link->getAttribute("media"), -1, PREG_SPLIT_NO_EMPTY);
366
+        if (count($formedialist) > 0) {
367 367
           $accept = false;
368
-          foreach ( $formedialist as $type ) {
369
-            if ( in_array(mb_strtolower(trim($type)), $acceptedmedia) ) {
368
+          foreach ($formedialist as $type) {
369
+            if (in_array(mb_strtolower(trim($type)), $acceptedmedia)) {
370 370
               $accept = true;
371 371
               break;
372 372
             }
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
       // HTML 4.0 spec:
395 395
       // http://www.w3.org/TR/REC-html40/present/styles.html#adef-media
396 396
       // which states that the default media type is 'screen'
397
-      if ( $style->hasAttributes() &&
397
+      if ($style->hasAttributes() &&
398 398
            ($media = $style->getAttribute("media")) &&
399
-           !in_array($media, $acceptedmedia) )
399
+           !in_array($media, $acceptedmedia))
400 400
         continue;
401 401
 
402 402
       $css = "";
403
-      if ( $style->hasChildNodes() ) {
403
+      if ($style->hasChildNodes()) {
404 404
 
405 405
         $child = $style->firstChild;
406
-        while ( $child ) {
406
+        while ($child) {
407 407
           $css .= $child->nodeValue; // Handle <style><!-- blah --></style>
408 408
           $child = $child->nextSibling;
409 409
         }
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
     foreach ($this->_tree->get_frames() as $frame) {
491 491
       // Set up the root frame
492 492
 
493
-      if ( is_null($root) ) {
494
-        $root = Frame_Factory::decorate_root( $this->_tree->get_root(), $this );
493
+      if (is_null($root)) {
494
+        $root = Frame_Factory::decorate_root($this->_tree->get_root(), $this);
495 495
         continue;
496 496
       }
497 497
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
       $deco->set_root($root);
501 501
 
502 502
       // FIXME: handle generated content
503
-      if ( $frame->get_style()->display === "list-item" ) {
503
+      if ($frame->get_style()->display === "list-item") {
504 504
 
505 505
         // Insert a list-bullet frame
506 506
         $node = $this->_xml->createElement("bullet"); // arbitrary choice
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
         $style->inherit($frame->get_style());
512 512
         $b_f->set_style($style);
513 513
 
514
-        $deco->prepend_child( Frame_Factory::decorate_frame($b_f, $this) );
514
+        $deco->prepend_child(Frame_Factory::decorate_frame($b_f, $this));
515 515
       }
516 516
 
517 517
     }
@@ -528,10 +528,10 @@  discard block
 block discarded – undo
528 528
     Image_Cache::clear();
529 529
     
530 530
     global $_dompdf_warnings, $_dompdf_show_warnings;
531
-    if ( $_dompdf_show_warnings ) {
531
+    if ($_dompdf_show_warnings) {
532 532
       echo '<b>DOMPDF Warnings</b><br><pre>';
533 533
       foreach ($_dompdf_warnings as $msg)
534
-        echo $msg . "\n";
534
+        echo $msg."\n";
535 535
       echo $this->get_canvas()->get_cpdf()->messages;
536 536
       echo '</pre>';
537 537
       flush();
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
    */
592 592
   function output($options = null) {
593 593
 
594
-    if ( is_null($this->_pdf) )
594
+    if (is_null($this->_pdf))
595 595
       return null;
596 596
 
597
-    return $this->_pdf->output( $options );
597
+    return $this->_pdf->output($options);
598 598
   }
599 599
 
600 600
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_frame_decorator.cls.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 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" )
71
+      if ($display !== "table-cell")
72 72
         $erroneous_frames[] = $child;
73 73
     }
74 74
     
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/block_frame_reflower.cls.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * @package dompdf
47 47
  */
48 48
 class Block_Frame_Reflower extends Frame_Reflower {
49
-  const MIN_JUSTIFY_WIDTH = 0.80;  // (Minimum line width to justify, as
49
+  const MIN_JUSTIFY_WIDTH = 0.80; // (Minimum line width to justify, as
50 50
                                    // fraction of available width)
51 51
 
52 52
   function __construct(Block_Frame_Decorator $frame) { parent::__construct($frame); }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                   $lm !== "auto" ? $lm : 0);
77 77
 
78 78
     // absolutely positioned boxes take the 'left' and 'right' properties into account
79
-    if ( $style->position === "absolute" || $style->position === "fixed" ) {
79
+    if ($style->position === "absolute" || $style->position === "fixed") {
80 80
       $absolute = true;
81 81
       $dims[] = $left !== "auto" ? $left : 0;
82 82
       $dims[] = $right !== "auto" ? $right : 0;
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
     // Compare to the containing block
90 90
     $diff = $w - $sum;
91 91
 
92
-    if ( $diff > 0 ) {
92
+    if ($diff > 0) {
93 93
 
94
-      if ( $absolute ) {
94
+      if ($absolute) {
95 95
 
96 96
         // resolve auto properties: see
97 97
         // http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width
98 98
 
99
-        if ( $width === "auto" && $left === "auto" && $right === "auto" ) {
99
+        if ($width === "auto" && $left === "auto" && $right === "auto") {
100 100
 
101
-          if ( $lm === "auto" )
101
+          if ($lm === "auto")
102 102
             $lm = 0;
103
-          if ( $rm === "auto" )
103
+          if ($rm === "auto")
104 104
             $rm = 0;
105 105
 
106 106
           // Technically, the width should be "shrink-to-fit" i.e. based on the
@@ -110,34 +110,34 @@  discard block
 block discarded – undo
110 110
           $right = 0;
111 111
           $width = $diff;
112 112
 
113
-        } else if ( $width === "auto" ) {
113
+        } else if ($width === "auto") {
114 114
 
115
-          if ( $lm === "auto" )
115
+          if ($lm === "auto")
116 116
             $lm = 0;
117
-          if ( $rm === "auto" )
117
+          if ($rm === "auto")
118 118
             $rm = 0;
119
-          if ( $left === "auto" )
119
+          if ($left === "auto")
120 120
             $left = 0;
121
-          if ( $right === "auto" )
121
+          if ($right === "auto")
122 122
             $right = 0;
123 123
 
124 124
           $width = $diff;
125 125
 
126
-        } else if ( $left === "auto" ) {
127
-          if ( $lm === "auto" )
126
+        } else if ($left === "auto") {
127
+          if ($lm === "auto")
128 128
             $lm = 0;
129
-          if ( $rm === "auto" )
129
+          if ($rm === "auto")
130 130
             $rm = 0;
131
-          if ( $right === "auto" )
131
+          if ($right === "auto")
132 132
             $right = 0;
133 133
 
134 134
           $left = $diff;
135 135
 
136
-        } else if ( $right === "auto" ) {
136
+        } else if ($right === "auto") {
137 137
 
138
-          if ( $lm === "auto" )
138
+          if ($lm === "auto")
139 139
             $lm = 0;
140
-          if ( $rm === "auto" )
140
+          if ($rm === "auto")
141 141
             $rm = 0;
142 142
 
143 143
           $right = $diff;
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
       } else {
147 147
 
148 148
         // Find auto properties and get them to take up the slack
149
-        if ( $width === "auto" )
149
+        if ($width === "auto")
150 150
           $width = $diff;
151 151
 
152
-        else if ( $lm === "auto" && $rm === "auto" )
152
+        else if ($lm === "auto" && $rm === "auto")
153 153
           $lm = $rm = round($diff / 2);
154 154
 
155
-        else if ( $lm === "auto" )
155
+        else if ($lm === "auto")
156 156
           $lm = $diff;
157 157
 
158
-        else if ( $rm === "auto" )
158
+        else if ($rm === "auto")
159 159
           $rm = $diff;
160 160
       }
161 161
 
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
     $style = $this->_frame->get_style();
177 177
     $cb = $this->_frame->get_containing_block();
178 178
 
179
-    if ( !isset($cb["w"]) )
179
+    if (!isset($cb["w"]))
180 180
       throw new DOMPDF_Exception("Box property calculation requires containing block width");
181 181
 
182 182
     // Treat width 100% as auto
183
-    if ( $style->width === "100%" )
183
+    if ($style->width === "100%")
184 184
       $width = "auto";
185 185
     else
186 186
       $width = $style->length_in_pt($style->width, $cb["w"]);
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
     $min_width = $style->length_in_pt($style->min_width, $cb["w"]);
192 192
     $max_width = $style->length_in_pt($style->max_width, $cb["w"]);
193 193
 
194
-    if ( $max_width !== "none" && $min_width > $max_width)
194
+    if ($max_width !== "none" && $min_width > $max_width)
195 195
       // Swap 'em
196 196
       list($max_width, $min_width) = array($min_width, $max_width);
197 197
 
198
-    if ( $max_width !== "none" && $width > $max_width )
198
+    if ($max_width !== "none" && $width > $max_width)
199 199
       extract($this->_calculate_width($max_width));
200 200
 
201
-    if ( $width < $min_width )
201
+    if ($width < $min_width)
202 202
       extract($this->_calculate_width($min_width));
203 203
 
204 204
     return array($width, $margin_left, $margin_right, $left, $right);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     $margin_top = $style->length_in_pt($style->margin_top, $cb["h"]);
236 236
     $margin_bottom = $style->length_in_pt($style->margin_bottom, $cb["h"]);
237 237
 
238
-    if ( $style->position === "absolute" || $style->position === "fixed" ) {
238
+    if ($style->position === "absolute" || $style->position === "fixed") {
239 239
 
240 240
       // see http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height
241 241
 
@@ -253,87 +253,87 @@  discard block
 block discarded – undo
253 253
 
254 254
       $diff = $cb["h"] - $sum; 
255 255
 
256
-      if ( $diff > 0 ) {
256
+      if ($diff > 0) {
257 257
 
258
-        if ( $height === "auto" && $top === "auto" && $bottom === "auto" ) {
258
+        if ($height === "auto" && $top === "auto" && $bottom === "auto") {
259 259
 
260
-          if ( $margin_top === "auto" ) 
260
+          if ($margin_top === "auto") 
261 261
             $margin_top = 0;
262
-          if ( $margin_bottom === "auto" )
262
+          if ($margin_bottom === "auto")
263 263
             $margin_bottom = 0;
264 264
 
265 265
           $height = $diff;
266 266
 
267
-        } else if ( $height === "auto" && $top === "auto" ) {
267
+        } else if ($height === "auto" && $top === "auto") {
268 268
 
269
-          if ( $margin_top === "auto" ) 
269
+          if ($margin_top === "auto") 
270 270
             $margin_top = 0;
271
-          if ( $margin_bottom === "auto" )
271
+          if ($margin_bottom === "auto")
272 272
             $margin_bottom = 0;
273 273
 
274 274
           $height = $content_height;
275 275
           $top = $diff - $content_height;
276 276
 
277
-        } else if ( $height === "auto" && $bottom === "auto" ) {
277
+        } else if ($height === "auto" && $bottom === "auto") {
278 278
 
279
-          if ( $margin_top === "auto" ) 
279
+          if ($margin_top === "auto") 
280 280
             $margin_top = 0;
281
-          if ( $margin_bottom === "auto" )
281
+          if ($margin_bottom === "auto")
282 282
             $margin_bottom = 0;
283 283
 
284 284
           $height = $content_height;
285 285
           $bottom = $diff - $content_height;
286 286
 
287
-        } else if ( $top === "auto" && $bottom === "auto" ) {
287
+        } else if ($top === "auto" && $bottom === "auto") {
288 288
 
289
-          if ( $margin_top === "auto" ) 
289
+          if ($margin_top === "auto") 
290 290
             $margin_top = 0;
291
-          if ( $margin_bottom === "auto" )
291
+          if ($margin_bottom === "auto")
292 292
             $margin_bottom = 0;
293 293
 
294 294
           $bottom = $diff;
295 295
 
296
-        } else if ( $top === "auto" ) {
296
+        } else if ($top === "auto") {
297 297
 
298
-          if ( $margin_top === "auto" ) 
298
+          if ($margin_top === "auto") 
299 299
             $margin_top = 0;
300
-          if ( $margin_bottom === "auto" )
300
+          if ($margin_bottom === "auto")
301 301
             $margin_bottom = 0;
302 302
 
303 303
           $top = $diff;
304 304
 
305
-        } else if ( $height === "auto" ) {
305
+        } else if ($height === "auto") {
306 306
 
307
-          if ( $margin_top === "auto" ) 
307
+          if ($margin_top === "auto") 
308 308
             $margin_top = 0;
309
-          if ( $margin_bottom === "auto" )
309
+          if ($margin_bottom === "auto")
310 310
             $margin_bottom = 0;
311 311
 
312 312
           $height = $diff;
313 313
 
314
-        } else if ( $bottom === "auto" ) {
314
+        } else if ($bottom === "auto") {
315 315
 
316
-          if ( $margin_top === "auto" ) 
316
+          if ($margin_top === "auto") 
317 317
             $margin_top = 0;
318
-          if ( $margin_bottom === "auto" )
318
+          if ($margin_bottom === "auto")
319 319
             $margin_bottom = 0;
320 320
 
321 321
           $bottom = $diff;
322 322
 
323 323
         } else {
324 324
 
325
-          if ( $style->overflow === "visible" ) {
325
+          if ($style->overflow === "visible") {
326 326
 
327 327
             // set all autos to zero
328
-            if ( $margin_top === "auto" ) 
328
+            if ($margin_top === "auto") 
329 329
               $margin_top = 0;
330
-            if ( $margin_bottom === "auto" )
330
+            if ($margin_bottom === "auto")
331 331
               $margin_bottom = 0;
332
-            if ( $top === "auto" )
332
+            if ($top === "auto")
333 333
               $top = 0;
334
-            if ( $bottom === "auto" )
334
+            if ($bottom === "auto")
335 335
               $bottom = 0;
336
-            if ( $height === "auto" )
336
+            if ($height === "auto")
337 337
               $height = $content_height;
338 338
 
339 339
           }
@@ -346,44 +346,44 @@  discard block
 block discarded – undo
346 346
     } else {
347 347
 
348 348
       // Expand the height if overflow is visible
349
-      if ( $height == "auto" && $content_height > $height && $style->overflow === "visible" )
349
+      if ($height == "auto" && $content_height > $height && $style->overflow === "visible")
350 350
         $height = $content_height;
351 351
 
352 352
       // FIXME: this should probably be moved to a seperate function as per
353 353
       // _calculate_restricted_width
354 354
       
355 355
       // Only handle min/max height if the height is independent of the frame's content
356
-      if ( !($style->overflow === "visible" ||
357
-             ($style->overflow === "hidden" && $height === "auto")) ) {
356
+      if (!($style->overflow === "visible" ||
357
+             ($style->overflow === "hidden" && $height === "auto"))) {
358 358
 
359 359
         $min_height = $style->min_height;
360 360
         $max_height = $style->max_height;
361 361
 
362
-        if ( isset($cb["h"]) ) {
362
+        if (isset($cb["h"])) {
363 363
           $min_height = $style->length_in_pt($min_height, $cb["h"]);
364 364
           $max_height = $style->length_in_pt($max_height, $cb["h"]);
365 365
 
366
-        } else if ( isset($cb["w"]) ) {
366
+        } else if (isset($cb["w"])) {
367 367
 
368
-          if ( mb_strpos($min_height, "%") !== false )
368
+          if (mb_strpos($min_height, "%") !== false)
369 369
             $min_height = 0;
370 370
           else
371 371
             $min_height = $style->length_in_pt($min_height, $cb["w"]);
372 372
 
373
-          if ( mb_strpos($max_height, "%") !== false )
373
+          if (mb_strpos($max_height, "%") !== false)
374 374
             $max_height = "none";
375 375
           else
376 376
             $max_height = $style->length_in_pt($max_height, $cb["w"]);
377 377
         }
378 378
 
379
-        if ( $max_height !== "none" && $min_height > $max_height )
379
+        if ($max_height !== "none" && $min_height > $max_height)
380 380
           // Swap 'em
381 381
           list($max_height, $min_height) = array($min_height, $max_height);
382 382
 
383
-        if ( $max_height !== "none" && $height > $max_height )
383
+        if ($max_height !== "none" && $height > $max_height)
384 384
           $height = $max_height;
385 385
 
386
-        if ( $height < $min_height )
386
+        if ($height < $min_height)
387 387
           $height = $min_height;
388 388
       }
389 389
 
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 
414 414
         // Move each child over by $dx
415 415
         $dx = $width - $line["w"];
416
-        foreach($line["frames"] as $frame)
417
-          $frame->set_position( $frame->get_position("x") + $dx );
416
+        foreach ($line["frames"] as $frame)
417
+          $frame->set_position($frame->get_position("x") + $dx);
418 418
 
419 419
       }
420 420
       break;
@@ -425,19 +425,19 @@  discard block
 block discarded – undo
425 425
 
426 426
         // Only set the spacing if the line is long enough.  This is really
427 427
         // just an aesthetic choice ;)
428
-        if ( $line["w"] > self::MIN_JUSTIFY_WIDTH * $width ) {
428
+        if ($line["w"] > self::MIN_JUSTIFY_WIDTH * $width) {
429 429
           // Set the spacing for each child
430
-          if ( $line["wc"] > 1 )
430
+          if ($line["wc"] > 1)
431 431
             $spacing = ($width - $line["w"]) / ($line["wc"] - 1);
432 432
           else
433 433
             $spacing = 0;
434 434
 
435 435
           $dx = 0;
436
-          foreach($line["frames"] as $frame) {
437
-            if ( !$frame instanceof Text_Frame_Decorator )
436
+          foreach ($line["frames"] as $frame) {
437
+            if (!$frame instanceof Text_Frame_Decorator)
438 438
               continue;
439 439
 
440
-            $frame->set_position( $frame->get_position("x") + $dx );
440
+            $frame->set_position($frame->get_position("x") + $dx);
441 441
             $frame->set_text_spacing($spacing);
442 442
             $dx += mb_substr_count($frame->get_text(), " ") * $spacing;
443 443
           }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         // Centre each line by moving each frame in the line by:
456 456
         $dx = ($width - $line["w"]) / 2;
457 457
         foreach ($line["frames"] as $frame)
458
-          $frame->set_position( $frame->get_position("x") + $dx );
458
+          $frame->set_position($frame->get_position("x") + $dx);
459 459
       }
460 460
       break;
461 461
     }
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
    */
467 467
   function vertical_align() {
468 468
     // Align each child vertically after each line is reflowed
469
-    foreach ( $this->_frame->get_lines() as $i => $line ) {
469
+    foreach ($this->_frame->get_lines() as $i => $line) {
470 470
 
471
-      foreach ( $line["frames"] as $frame ) {
471
+      foreach ($line["frames"] as $frame) {
472 472
         $style = $frame->get_style();
473 473
 
474
-        if ( $style->display !== "inline" && $style->display !== "text" )
474
+        if ($style->display !== "inline" && $style->display !== "text")
475 475
           continue;
476 476
 
477 477
         $align = $style->vertical_align;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
     $page->check_forced_page_break($this->_frame);
524 524
 
525 525
     // Bail if the page is full
526
-    if ( $page->is_full() )
526
+    if ($page->is_full())
527 527
       return;
528 528
 
529 529
     // Collapse margins if required
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
     $style->width = $w;
541 541
     $style->margin_left = $left_margin."pt";
542 542
     $style->margin_right = $right_margin."pt";
543
-    $style->left = $left ."pt";
544
-    $style->right = $right . "pt";
543
+    $style->left = $left."pt";
544
+    $style->right = $right."pt";
545 545
     
546 546
     // Update the position
547 547
     $this->_frame->position();
@@ -572,24 +572,24 @@  discard block
 block discarded – undo
572 572
     $this->_frame->set_current_line($line_y);
573 573
 
574 574
     // Set the containing blocks and reflow each child
575
-    foreach ( $this->_frame->get_children() as $child ) {
575
+    foreach ($this->_frame->get_children() as $child) {
576 576
 
577 577
       // Bail out if the page is full
578
-      if ( $page->is_full() )
578
+      if ($page->is_full())
579 579
         break;
580 580
       
581 581
       $child->set_containing_block($cb_x, $cb_y, $w, $cb_h);
582 582
       $child->reflow();
583 583
 
584 584
       // Don't add the child to the line if a page break has occurred
585
-      if ( $page->check_page_break($child) )
585
+      if ($page->check_page_break($child))
586 586
         break;
587 587
 
588 588
       // If the frame is not absolutely positioned, It's okay to add the frame
589 589
       // to the line
590
-      if ( $child->get_style()->position !== "absolute" &&
591
-           $child->get_style()->position !== "fixed" ) {
592
-        $this->_frame->add_frame_to_line( $child );
590
+      if ($child->get_style()->position !== "absolute" &&
591
+           $child->get_style()->position !== "fixed") {
592
+        $this->_frame->add_frame_to_line($child);
593 593
       }
594 594
     }
595 595
 
Please login to merge, or discard this patch.