Passed
Push — 1.10.x ( a2cc02...b21e58 )
by Yannick
608:36 queued 565:17
created
main/inc/lib/phpdocx/pdf/include/block_frame_reflower.cls.php 1 patch
Indentation   +172 added lines, -173 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: block_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -46,17 +45,17 @@  discard block
 block discarded – undo
46 45
  * @package dompdf
47 46
  */
48 47
 class Block_Frame_Reflower extends Frame_Reflower {
49
-  const MIN_JUSTIFY_WIDTH = 0.80;  // (Minimum line width to justify, as
50
-                                   // fraction of available width)
48
+    const MIN_JUSTIFY_WIDTH = 0.80;  // (Minimum line width to justify, as
49
+                                    // fraction of available width)
51 50
 
52
-  function __construct(Block_Frame_Decorator $frame) { parent::__construct($frame); }
51
+    function __construct(Block_Frame_Decorator $frame) { parent::__construct($frame); }
53 52
 
54
-  //........................................................................
53
+    //........................................................................
55 54
 
56
-  // Calculate the ideal used value for the width property as per:
57
-  // http://www.w3.org/TR/CSS21/visudet.html#Computing_widths_and_margins
55
+    // Calculate the ideal used value for the width property as per:
56
+    // http://www.w3.org/TR/CSS21/visudet.html#Computing_widths_and_margins
58 57
 
59
-  protected function _calculate_width($width) {
58
+    protected function _calculate_width($width) {
60 59
     $style = $this->_frame->get_style();
61 60
     $w = $this->_frame->get_containing_block("w");
62 61
 
@@ -68,20 +67,20 @@  discard block
 block discarded – undo
68 67
     
69 68
     // Handle 'auto' values
70 69
     $dims = array($style->border_left_width,
71
-                  $style->border_right_width,
72
-                  $style->padding_left,
73
-                  $style->padding_right,
74
-                  $width !== "auto" ? $width : 0,
75
-                  $rm !== "auto" ? $rm : 0,
76
-                  $lm !== "auto" ? $lm : 0);
70
+                    $style->border_right_width,
71
+                    $style->padding_left,
72
+                    $style->padding_right,
73
+                    $width !== "auto" ? $width : 0,
74
+                    $rm !== "auto" ? $rm : 0,
75
+                    $lm !== "auto" ? $lm : 0);
77 76
 
78 77
     // absolutely positioned boxes take the 'left' and 'right' properties into account
79 78
     if ( $style->position === "absolute" || $style->position === "fixed" ) {
80
-      $absolute = true;
81
-      $dims[] = $left !== "auto" ? $left : 0;
82
-      $dims[] = $right !== "auto" ? $right : 0;
79
+        $absolute = true;
80
+        $dims[] = $left !== "auto" ? $left : 0;
81
+        $dims[] = $right !== "auto" ? $right : 0;
83 82
     } else {
84
-      $absolute = false;
83
+        $absolute = false;
85 84
     }
86 85
 
87 86
     $sum = $style->length_in_pt($dims, $w);
@@ -91,99 +90,99 @@  discard block
 block discarded – undo
91 90
 
92 91
     if ( $diff > 0 ) {
93 92
 
94
-      if ( $absolute ) {
93
+        if ( $absolute ) {
95 94
 
96 95
         // resolve auto properties: see
97 96
         // http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width
98 97
 
99 98
         if ( $width === "auto" && $left === "auto" && $right === "auto" ) {
100 99
 
101
-          if ( $lm === "auto" )
100
+            if ( $lm === "auto" )
102 101
             $lm = 0;
103
-          if ( $rm === "auto" )
102
+            if ( $rm === "auto" )
104 103
             $rm = 0;
105 104
 
106
-          // Technically, the width should be "shrink-to-fit" i.e. based on the
107
-          // preferred width of the content...  a little too costly here as a
108
-          // special case.  Just get the width to take up the slack:
109
-          $left = 0;
110
-          $right = 0;
111
-          $width = $diff;
105
+            // Technically, the width should be "shrink-to-fit" i.e. based on the
106
+            // preferred width of the content...  a little too costly here as a
107
+            // special case.  Just get the width to take up the slack:
108
+            $left = 0;
109
+            $right = 0;
110
+            $width = $diff;
112 111
 
113 112
         } else if ( $width === "auto" ) {
114 113
 
115
-          if ( $lm === "auto" )
114
+            if ( $lm === "auto" )
116 115
             $lm = 0;
117
-          if ( $rm === "auto" )
116
+            if ( $rm === "auto" )
118 117
             $rm = 0;
119
-          if ( $left === "auto" )
118
+            if ( $left === "auto" )
120 119
             $left = 0;
121
-          if ( $right === "auto" )
120
+            if ( $right === "auto" )
122 121
             $right = 0;
123 122
 
124
-          $width = $diff;
123
+            $width = $diff;
125 124
 
126 125
         } else if ( $left === "auto" ) {
127
-          if ( $lm === "auto" )
126
+            if ( $lm === "auto" )
128 127
             $lm = 0;
129
-          if ( $rm === "auto" )
128
+            if ( $rm === "auto" )
130 129
             $rm = 0;
131
-          if ( $right === "auto" )
130
+            if ( $right === "auto" )
132 131
             $right = 0;
133 132
 
134
-          $left = $diff;
133
+            $left = $diff;
135 134
 
136 135
         } else if ( $right === "auto" ) {
137 136
 
138
-          if ( $lm === "auto" )
137
+            if ( $lm === "auto" )
139 138
             $lm = 0;
140
-          if ( $rm === "auto" )
139
+            if ( $rm === "auto" )
141 140
             $rm = 0;
142 141
 
143
-          $right = $diff;
142
+            $right = $diff;
144 143
         }
145 144
 
146
-      } else {
145
+        } else {
147 146
 
148 147
         // Find auto properties and get them to take up the slack
149 148
         if ( $width === "auto" )
150
-          $width = $diff;
149
+            $width = $diff;
151 150
 
152 151
         else if ( $lm === "auto" && $rm === "auto" )
153
-          $lm = $rm = round($diff / 2);
152
+            $lm = $rm = round($diff / 2);
154 153
 
155 154
         else if ( $lm === "auto" )
156
-          $lm = $diff;
155
+            $lm = $diff;
157 156
 
158 157
         else if ( $rm === "auto" )
159
-          $rm = $diff;
160
-      }
158
+            $rm = $diff;
159
+        }
161 160
 
162 161
     } else if ($diff < 0) {
163 162
 
164
-      // We are over constrained--set margin-right to the difference
165
-      $rm = $diff;
163
+        // We are over constrained--set margin-right to the difference
164
+        $rm = $diff;
166 165
 
167 166
     }
168 167
 
169 168
     $ret = array("width"=> $width, "margin_left" => $lm, "margin_right" => $rm, "left" => $left, "right" => $right);
170 169
 
171 170
     return $ret;
172
-  }
171
+    }
173 172
 
174
-  // Call the above function, but resolve max/min widths
175
-  protected function _calculate_restricted_width() {
173
+    // Call the above function, but resolve max/min widths
174
+    protected function _calculate_restricted_width() {
176 175
     $style = $this->_frame->get_style();
177 176
     $cb = $this->_frame->get_containing_block();
178 177
 
179 178
     if ( !isset($cb["w"]) )
180
-      throw new DOMPDF_Exception("Box property calculation requires containing block width");
179
+        throw new DOMPDF_Exception("Box property calculation requires containing block width");
181 180
 
182 181
     // Treat width 100% as auto
183 182
     if ( $style->width === "100%" )
184
-      $width = "auto";
183
+        $width = "auto";
185 184
     else
186
-      $width = $style->length_in_pt($style->width, $cb["w"]);
185
+        $width = $style->length_in_pt($style->width, $cb["w"]);
187 186
 
188 187
     extract($this->_calculate_width($width));
189 188
 
@@ -192,37 +191,37 @@  discard block
 block discarded – undo
192 191
     $max_width = $style->length_in_pt($style->max_width, $cb["w"]);
193 192
 
194 193
     if ( $max_width !== "none" && $min_width > $max_width)
195
-      // Swap 'em
196
-      list($max_width, $min_width) = array($min_width, $max_width);
194
+        // Swap 'em
195
+        list($max_width, $min_width) = array($min_width, $max_width);
197 196
 
198 197
     if ( $max_width !== "none" && $width > $max_width )
199
-      extract($this->_calculate_width($max_width));
198
+        extract($this->_calculate_width($max_width));
200 199
 
201 200
     if ( $width < $min_width )
202
-      extract($this->_calculate_width($min_width));
201
+        extract($this->_calculate_width($min_width));
203 202
 
204 203
     return array($width, $margin_left, $margin_right, $left, $right);
205 204
 
206
-  }
205
+    }
207 206
 
208
-  //........................................................................
207
+    //........................................................................
209 208
 
210
-  // Determine the unrestricted height of content within the block
211
-  protected function _calculate_content_height() {
209
+    // Determine the unrestricted height of content within the block
210
+    protected function _calculate_content_height() {
212 211
 
213 212
     // Calculate the actual height
214 213
     $height = 0;
215 214
     
216 215
     // Add the height of all lines
217 216
     foreach ($this->_frame->get_lines() as $line)
218
-      $height += $line["h"];
217
+        $height += $line["h"];
219 218
 
220 219
     return $height;
221 220
 
222
-  }
221
+    }
223 222
 
224
-  // Determine the frame's restricted height
225
-  protected function _calculate_restricted_height() {
223
+    // Determine the frame's restricted height
224
+    protected function _calculate_restricted_height() {
226 225
     $style = $this->_frame->get_style();
227 226
     $content_height = $this->_calculate_content_height();
228 227
     $cb = $this->_frame->get_containing_block();
@@ -237,9 +236,9 @@  discard block
 block discarded – undo
237 236
 
238 237
     if ( $style->position === "absolute" || $style->position === "fixed" ) {
239 238
 
240
-      // see http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height
239
+        // see http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height
241 240
 
242
-      $dims = array($top !== "auto" ? $top : 0,
241
+        $dims = array($top !== "auto" ? $top : 0,
243 242
                     $style->margin_top !== "auto" ? $style->margin_top : 0,
244 243
                     $style->padding_top,
245 244
                     $style->border_top_width,
@@ -249,153 +248,153 @@  discard block
 block discarded – undo
249 248
                     $style->margin_bottom !== "auto" ? $style->margin_bottom : 0,
250 249
                     $bottom !== "auto" ? $bottom : 0);
251 250
 
252
-      $sum = $style->length_in_pt($dims, $cb["h"]);
251
+        $sum = $style->length_in_pt($dims, $cb["h"]);
253 252
 
254
-      $diff = $cb["h"] - $sum; 
253
+        $diff = $cb["h"] - $sum; 
255 254
 
256
-      if ( $diff > 0 ) {
255
+        if ( $diff > 0 ) {
257 256
 
258 257
         if ( $height === "auto" && $top === "auto" && $bottom === "auto" ) {
259 258
 
260
-          if ( $margin_top === "auto" ) 
259
+            if ( $margin_top === "auto" ) 
261 260
             $margin_top = 0;
262
-          if ( $margin_bottom === "auto" )
261
+            if ( $margin_bottom === "auto" )
263 262
             $margin_bottom = 0;
264 263
 
265
-          $height = $diff;
264
+            $height = $diff;
266 265
 
267 266
         } else if ( $height === "auto" && $top === "auto" ) {
268 267
 
269
-          if ( $margin_top === "auto" ) 
268
+            if ( $margin_top === "auto" ) 
270 269
             $margin_top = 0;
271
-          if ( $margin_bottom === "auto" )
270
+            if ( $margin_bottom === "auto" )
272 271
             $margin_bottom = 0;
273 272
 
274
-          $height = $content_height;
275
-          $top = $diff - $content_height;
273
+            $height = $content_height;
274
+            $top = $diff - $content_height;
276 275
 
277 276
         } else if ( $height === "auto" && $bottom === "auto" ) {
278 277
 
279
-          if ( $margin_top === "auto" ) 
278
+            if ( $margin_top === "auto" ) 
280 279
             $margin_top = 0;
281
-          if ( $margin_bottom === "auto" )
280
+            if ( $margin_bottom === "auto" )
282 281
             $margin_bottom = 0;
283 282
 
284
-          $height = $content_height;
285
-          $bottom = $diff - $content_height;
283
+            $height = $content_height;
284
+            $bottom = $diff - $content_height;
286 285
 
287 286
         } else if ( $top === "auto" && $bottom === "auto" ) {
288 287
 
289
-          if ( $margin_top === "auto" ) 
288
+            if ( $margin_top === "auto" ) 
290 289
             $margin_top = 0;
291
-          if ( $margin_bottom === "auto" )
290
+            if ( $margin_bottom === "auto" )
292 291
             $margin_bottom = 0;
293 292
 
294
-          $bottom = $diff;
293
+            $bottom = $diff;
295 294
 
296 295
         } else if ( $top === "auto" ) {
297 296
 
298
-          if ( $margin_top === "auto" ) 
297
+            if ( $margin_top === "auto" ) 
299 298
             $margin_top = 0;
300
-          if ( $margin_bottom === "auto" )
299
+            if ( $margin_bottom === "auto" )
301 300
             $margin_bottom = 0;
302 301
 
303
-          $top = $diff;
302
+            $top = $diff;
304 303
 
305 304
         } else if ( $height === "auto" ) {
306 305
 
307
-          if ( $margin_top === "auto" ) 
306
+            if ( $margin_top === "auto" ) 
308 307
             $margin_top = 0;
309
-          if ( $margin_bottom === "auto" )
308
+            if ( $margin_bottom === "auto" )
310 309
             $margin_bottom = 0;
311 310
 
312
-          $height = $diff;
311
+            $height = $diff;
313 312
 
314 313
         } else if ( $bottom === "auto" ) {
315 314
 
316
-          if ( $margin_top === "auto" ) 
315
+            if ( $margin_top === "auto" ) 
317 316
             $margin_top = 0;
318
-          if ( $margin_bottom === "auto" )
317
+            if ( $margin_bottom === "auto" )
319 318
             $margin_bottom = 0;
320 319
 
321
-          $bottom = $diff;
320
+            $bottom = $diff;
322 321
 
323 322
         } else {
324 323
 
325
-          if ( $style->overflow === "visible" ) {
324
+            if ( $style->overflow === "visible" ) {
326 325
 
327 326
             // set all autos to zero
328 327
             if ( $margin_top === "auto" ) 
329
-              $margin_top = 0;
328
+                $margin_top = 0;
330 329
             if ( $margin_bottom === "auto" )
331
-              $margin_bottom = 0;
330
+                $margin_bottom = 0;
332 331
             if ( $top === "auto" )
333
-              $top = 0;
332
+                $top = 0;
334 333
             if ( $bottom === "auto" )
335
-              $bottom = 0;
334
+                $bottom = 0;
336 335
             if ( $height === "auto" )
337
-              $height = $content_height;
336
+                $height = $content_height;
338 337
 
339
-          }
338
+            }
340 339
 
341
-          // FIXME: overflow hidden
340
+            // FIXME: overflow hidden
342 341
         }
343 342
 
344
-      }
343
+        }
345 344
 
346 345
     } else {
347 346
 
348
-      // Expand the height if overflow is visible
349
-      if ( $height == "auto" && $content_height > $height && $style->overflow === "visible" )
347
+        // Expand the height if overflow is visible
348
+        if ( $height == "auto" && $content_height > $height && $style->overflow === "visible" )
350 349
         $height = $content_height;
351 350
 
352
-      // FIXME: this should probably be moved to a seperate function as per
353
-      // _calculate_restricted_width
351
+        // FIXME: this should probably be moved to a seperate function as per
352
+        // _calculate_restricted_width
354 353
       
355
-      // Only handle min/max height if the height is independent of the frame's content
356
-      if ( !($style->overflow === "visible" ||
354
+        // Only handle min/max height if the height is independent of the frame's content
355
+        if ( !($style->overflow === "visible" ||
357 356
              ($style->overflow === "hidden" && $height === "auto")) ) {
358 357
 
359 358
         $min_height = $style->min_height;
360 359
         $max_height = $style->max_height;
361 360
 
362 361
         if ( isset($cb["h"]) ) {
363
-          $min_height = $style->length_in_pt($min_height, $cb["h"]);
364
-          $max_height = $style->length_in_pt($max_height, $cb["h"]);
362
+            $min_height = $style->length_in_pt($min_height, $cb["h"]);
363
+            $max_height = $style->length_in_pt($max_height, $cb["h"]);
365 364
 
366 365
         } else if ( isset($cb["w"]) ) {
367 366
 
368
-          if ( mb_strpos($min_height, "%") !== false )
367
+            if ( mb_strpos($min_height, "%") !== false )
369 368
             $min_height = 0;
370
-          else
369
+            else
371 370
             $min_height = $style->length_in_pt($min_height, $cb["w"]);
372 371
 
373
-          if ( mb_strpos($max_height, "%") !== false )
372
+            if ( mb_strpos($max_height, "%") !== false )
374 373
             $max_height = "none";
375
-          else
374
+            else
376 375
             $max_height = $style->length_in_pt($max_height, $cb["w"]);
377 376
         }
378 377
 
379 378
         if ( $max_height !== "none" && $min_height > $max_height )
380
-          // Swap 'em
381
-          list($max_height, $min_height) = array($min_height, $max_height);
379
+            // Swap 'em
380
+            list($max_height, $min_height) = array($min_height, $max_height);
382 381
 
383 382
         if ( $max_height !== "none" && $height > $max_height )
384
-          $height = $max_height;
383
+            $height = $max_height;
385 384
 
386 385
         if ( $height < $min_height )
387
-          $height = $min_height;
388
-      }
386
+            $height = $min_height;
387
+        }
389 388
 
390 389
     }
391 390
 
392 391
     return array($height, $margin_top, $margin_bottom, $top, $bottom);
393 392
 
394
-  }
393
+    }
395 394
 
396
-  //........................................................................
395
+    //........................................................................
397 396
 
398
-  protected function _text_align() {
397
+    protected function _text_align() {
399 398
     $style = $this->_frame->get_style();
400 399
     $w = $this->_frame->get_containing_block("w");
401 400
     $width = $style->length_in_pt($style->width, $w);
@@ -414,10 +413,10 @@  discard block
 block discarded – undo
414 413
         // Move each child over by $dx
415 414
         $dx = $width - $line["w"];
416 415
         foreach($line["frames"] as $frame)
417
-          $frame->set_position( $frame->get_position("x") + $dx );
416
+            $frame->set_position( $frame->get_position("x") + $dx );
418 417
 
419
-      }
420
-      break;
418
+        }
419
+        break;
421 420
 
422 421
 
423 422
     case "justify":
@@ -426,28 +425,28 @@  discard block
 block discarded – undo
426 425
         // Only set the spacing if the line is long enough.  This is really
427 426
         // just an aesthetic choice ;)
428 427
         if ( $line["w"] > self::MIN_JUSTIFY_WIDTH * $width ) {
429
-          // Set the spacing for each child
430
-          if ( $line["wc"] > 1 )
428
+            // Set the spacing for each child
429
+            if ( $line["wc"] > 1 )
431 430
             $spacing = ($width - $line["w"]) / ($line["wc"] - 1);
432
-          else
431
+            else
433 432
             $spacing = 0;
434 433
 
435
-          $dx = 0;
436
-          foreach($line["frames"] as $frame) {
434
+            $dx = 0;
435
+            foreach($line["frames"] as $frame) {
437 436
             if ( !$frame instanceof Text_Frame_Decorator )
438
-              continue;
437
+                continue;
439 438
 
440 439
             $frame->set_position( $frame->get_position("x") + $dx );
441 440
             $frame->set_text_spacing($spacing);
442 441
             $dx += mb_substr_count($frame->get_text(), " ") * $spacing;
443
-          }
442
+            }
444 443
 
445
-          // The line (should) now occupy the entire width
446
-          $this->_frame->set_line($i, null, $width);
444
+            // The line (should) now occupy the entire width
445
+            $this->_frame->set_line($i, null, $width);
447 446
 
448 447
         }
449
-      }
450
-      break;
448
+        }
449
+        break;
451 450
 
452 451
     case "center":
453 452
     case "centre":
@@ -455,24 +454,24 @@  discard block
 block discarded – undo
455 454
         // Centre each line by moving each frame in the line by:
456 455
         $dx = ($width - $line["w"]) / 2;
457 456
         foreach ($line["frames"] as $frame)
458
-          $frame->set_position( $frame->get_position("x") + $dx );
459
-      }
460
-      break;
457
+            $frame->set_position( $frame->get_position("x") + $dx );
458
+        }
459
+        break;
461 460
     }
462 461
 
463
-  }
464
-  /**
465
-   * Align inline children vertically
466
-   */
467
-  function vertical_align() {
462
+    }
463
+    /**
464
+     * Align inline children vertically
465
+     */
466
+    function vertical_align() {
468 467
     // Align each child vertically after each line is reflowed
469 468
     foreach ( $this->_frame->get_lines() as $i => $line ) {
470 469
 
471
-      foreach ( $line["frames"] as $frame ) {
470
+        foreach ( $line["frames"] as $frame ) {
472 471
         $style = $frame->get_style();
473 472
 
474 473
         if ( $style->display !== "inline" && $style->display !== "text" )
475
-          continue;
474
+            continue;
476 475
 
477 476
         $align = $style->vertical_align;
478 477
 
@@ -482,41 +481,41 @@  discard block
 block discarded – undo
482 481
 
483 482
         case "baseline":
484 483
           $y = $line["y"] + $line["h"] - $frame_h;
485
-          break;
484
+            break;
486 485
 
487 486
         case "middle":
488 487
           $y = $line["y"] + ($line["h"] + $frame_h) / 2;
489
-          break;
488
+            break;
490 489
 
491 490
         case "sub":
492 491
           $y = $line["y"] + 0.9 * $line["h"];
493
-          break;
492
+            break;
494 493
 
495 494
         case "super":
496 495
           $y = $line["y"] + 0.1 * $line["h"];
497
-          break;
496
+            break;
498 497
 
499 498
         case  "text-top":
500 499
         case "top": // Not strictly accurate, but good enough for now
501 500
           $y = $line["y"];
502
-          break;
501
+            break;
503 502
 
504 503
         case "text-bottom":
505 504
         case "bottom":
506 505
           $y = $line["y"] + $line["h"] - $frame_h;
507
-          break;
506
+            break;
508 507
         }
509 508
 
510 509
         $x = $frame->get_position("x");
511 510
         $frame->set_position($x, $y);
512 511
 
513
-      }
512
+        }
513
+    }
514 514
     }
515
-  }
516 515
 
517
-  //........................................................................
516
+    //........................................................................
518 517
 
519
-  function reflow() {
518
+    function reflow() {
520 519
 
521 520
     // Check if a page break is forced
522 521
     $page = $this->_frame->get_root();
@@ -524,7 +523,7 @@  discard block
 block discarded – undo
524 523
 
525 524
     // Bail if the page is full
526 525
     if ( $page->is_full() )
527
-      return;
526
+        return;
528 527
 
529 528
     // Collapse margins if required
530 529
     $this->_collapse_margins();
@@ -553,12 +552,12 @@  discard block
 block discarded – undo
553 552
 
554 553
     // Determine the content edge
555 554
     $top = $style->length_in_pt(array($style->margin_top,
556
-                                      $style->padding_top,
557
-                                      $style->border_top_width), $cb["h"]);
555
+                                        $style->padding_top,
556
+                                        $style->border_top_width), $cb["h"]);
558 557
 
559 558
     $bottom = $style->length_in_pt(array($style->border_bottom_width,
560
-                                         $style->margin_bottom,
561
-                                         $style->padding_bottom), $cb["h"]);
559
+                                            $style->margin_bottom,
560
+                                            $style->padding_bottom), $cb["h"]);
562 561
 
563 562
     $cb_x = $x + $left_margin +
564 563
       $style->length_in_pt($style->border_left_width, $cb["w"]) +
@@ -574,23 +573,23 @@  discard block
 block discarded – undo
574 573
     // Set the containing blocks and reflow each child
575 574
     foreach ( $this->_frame->get_children() as $child ) {
576 575
 
577
-      // Bail out if the page is full
578
-      if ( $page->is_full() )
576
+        // Bail out if the page is full
577
+        if ( $page->is_full() )
579 578
         break;
580 579
       
581
-      $child->set_containing_block($cb_x, $cb_y, $w, $cb_h);
582
-      $child->reflow();
580
+        $child->set_containing_block($cb_x, $cb_y, $w, $cb_h);
581
+        $child->reflow();
583 582
 
584
-      // Don't add the child to the line if a page break has occurred
585
-      if ( $page->check_page_break($child) )
583
+        // Don't add the child to the line if a page break has occurred
584
+        if ( $page->check_page_break($child) )
586 585
         break;
587 586
 
588
-      // If the frame is not absolutely positioned, It's okay to add the frame
589
-      // to the line
590
-      if ( $child->get_style()->position !== "absolute" &&
587
+        // If the frame is not absolutely positioned, It's okay to add the frame
588
+        // to the line
589
+        if ( $child->get_style()->position !== "absolute" &&
591 590
            $child->get_style()->position !== "fixed" ) {
592 591
         $this->_frame->add_frame_to_line( $child );
593
-      }
592
+        }
594 593
     }
595 594
 
596 595
     // Determine our height
@@ -604,8 +603,8 @@  discard block
 block discarded – undo
604 603
     $this->_text_align();
605 604
 
606 605
     $this->vertical_align();
607
-  }
606
+    }
608 607
 
609
-  //........................................................................
608
+    //........................................................................
610 609
 
611 610
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_group_frame_reflower.cls.php 1 patch
Indentation   +48 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: table_row_group_frame_reflower.cls.php,v $
6
- * Created on: 2004-07-26
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: table_row_group_frame_reflower.cls.php,v $
6
+     * Created on: 2004-07-26
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: table_row_group_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -47,11 +46,11 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Table_Row_Group_Frame_Reflower extends Frame_Reflower {
49 48
 
50
-  function __construct($frame) {
49
+    function __construct($frame) {
51 50
     parent::__construct($frame);
52
-  }
51
+    }
53 52
 
54
-  function reflow() {
53
+    function reflow() {
55 54
     $page = $this->_frame->get_root();
56 55
 
57 56
     $style = $this->_frame->get_style();
@@ -62,20 +61,20 @@  discard block
 block discarded – undo
62 61
     $cb = $this->_frame->get_containing_block();
63 62
     
64 63
     foreach ( $this->_frame->get_children() as $child) {
65
-      // Bail if the page is full
66
-      if ( $page->is_full() )
64
+        // Bail if the page is full
65
+        if ( $page->is_full() )
67 66
         return;
68 67
 
69
-      $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]);
70
-      $child->reflow();
68
+        $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]);
69
+        $child->reflow();
71 70
 
72
-      // Check if a split has occured
73
-      $page->check_page_break($child);
71
+        // Check if a split has occured
72
+        $page->check_page_break($child);
74 73
 
75 74
     }
76 75
 
77 76
     if ( $page->is_full() )
78
-      return;
77
+        return;
79 78
 
80 79
     $cellmap = $table->get_cellmap();
81 80
     $style->width = $cellmap->get_frame_width($this->_frame);
@@ -84,9 +83,9 @@  discard block
 block discarded – undo
84 83
     $this->_frame->set_position($cellmap->get_frame_position($this->_frame));
85 84
     
86 85
     if ( $table->get_style()->border_collapse === "collapse" ) 
87
-      // Unset our borders because our cells are now using them
88
-      $style->border_style = "none";
86
+        // Unset our borders because our cells are now using them
87
+        $style->border_style = "none";
89 88
  
90
-  }
89
+    }
91 90
 
92 91
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_cell_renderer.cls.php 1 patch
Indentation   +34 added lines, -35 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: table_cell_renderer.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,25 +46,25 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Table_Cell_Renderer extends Block_Renderer {
49 48
 
50
-  //........................................................................
49
+    //........................................................................
51 50
 
52
-  function render(Frame $frame) {
51
+    function render(Frame $frame) {
53 52
     $style = $frame->get_style();
54 53
     list($x, $y, $w, $h) = $frame->get_padding_box();
55 54
 
56 55
     // Draw our background, border and content
57 56
     if ( ($bg = $style->background_color) !== "transparent" ) {
58
-      list($x, $y, $w, $h) = $frame->get_padding_box();
59
-      $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color );
57
+        list($x, $y, $w, $h) = $frame->get_padding_box();
58
+        $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color );
60 59
     }
61 60
 
62 61
     if ( ($url = $style->background_image) && $url !== "none" ) {
63
-      $this->_background_image($url, $x, $y, $w, $h, $style);
62
+        $this->_background_image($url, $x, $y, $w, $h, $style);
64 63
     }
65 64
 
66 65
     if ( $style->border_collapse !== "collapse" ) {
67
-      $this->_render_border($frame, "bevel");
68
-      return;
66
+        $this->_render_border($frame, "bevel");
67
+        return;
69 68
     }
70 69
 
71 70
     // The collapsed case is slightly complicated...
@@ -83,35 +82,35 @@  discard block
 block discarded – undo
83 82
     // then we draw its bottom border.  Otherwise the next row down will
84 83
     // draw its top border instead.
85 84
     if (in_array( $num_rows - 1, $cells["rows"])) {
86
-      $draw_bottom = true;
87
-      $bottom_row = $cellmap->get_row($num_rows - 1);
85
+        $draw_bottom = true;
86
+        $bottom_row = $cellmap->get_row($num_rows - 1);
88 87
     } else
89
-      $draw_bottom = false;
88
+        $draw_bottom = false;
90 89
 
91 90
 
92 91
     // Draw the horizontal borders
93 92
     foreach ( $cells["columns"] as $j ) {
94
-      $bp = $cellmap->get_border_properties($i, $j);
93
+        $bp = $cellmap->get_border_properties($i, $j);
95 94
 
96
-      $y = $top_row["y"] - $bp["top"]["width"] / 2;
95
+        $y = $top_row["y"] - $bp["top"]["width"] / 2;
97 96
 
98
-      $col = $cellmap->get_column($j);
99
-      $x = $col["x"] - $bp["left"]["width"] / 2;
100
-      $w = $col["used-width"] + ($bp["left"]["width"] + $bp["right"]["width"] ) / 2;
97
+        $col = $cellmap->get_column($j);
98
+        $x = $col["x"] - $bp["left"]["width"] / 2;
99
+        $w = $col["used-width"] + ($bp["left"]["width"] + $bp["right"]["width"] ) / 2;
101 100
 
102
-      if ( $bp["top"]["style"] !== "none" && $bp["top"]["width"] > 0 ) {
101
+        if ( $bp["top"]["style"] !== "none" && $bp["top"]["width"] > 0 ) {
103 102
         $widths = array($bp["top"]["width"],
104 103
                         $bp["right"]["width"],
105 104
                         $bp["bottom"]["width"],
106 105
                         $bp["left"]["width"]);
107 106
         $method = "_border_". $bp["top"]["style"];
108 107
         $this->$method($x, $y, $w, $bp["top"]["color"], $widths, "top", "square");
109
-      }
108
+        }
110 109
 
111
-      if ( $draw_bottom ) {
110
+        if ( $draw_bottom ) {
112 111
         $bp = $cellmap->get_border_properties($num_rows - 1, $j);
113 112
         if ( $bp["bottom"]["style"] === "none" || $bp["bottom"]["width"] <= 0 )
114
-          continue;
113
+            continue;
115 114
 
116 115
         $y = $bottom_row["y"] + $bottom_row["height"] + $bp["bottom"]["width"] / 2;
117 116
 
@@ -122,7 +121,7 @@  discard block
 block discarded – undo
122 121
         $method = "_border_". $bp["bottom"]["style"];
123 122
         $this->$method($x, $y, $w, $bp["bottom"]["color"], $widths, "bottom", "square");
124 123
 
125
-      }
124
+        }
126 125
     }
127 126
 
128 127
     $j = $cells["columns"][0];
@@ -130,23 +129,23 @@  discard block
 block discarded – undo
130 129
     $left_col = $cellmap->get_column($j);
131 130
 
132 131
     if (in_array($num_cols - 1, $cells["columns"])) {
133
-      $draw_right = true;
134
-      $right_col = $cellmap->get_column($num_cols - 1);
132
+        $draw_right = true;
133
+        $right_col = $cellmap->get_column($num_cols - 1);
135 134
     } else
136
-      $draw_right = false;
135
+        $draw_right = false;
137 136
 
138 137
     // Draw the vertical borders
139 138
     foreach ( $cells["rows"] as $i ) {
140
-      $bp = $cellmap->get_border_properties($i, $j);
139
+        $bp = $cellmap->get_border_properties($i, $j);
141 140
 
142
-      $x = $left_col["x"] - $bp["left"]["width"] / 2;
141
+        $x = $left_col["x"] - $bp["left"]["width"] / 2;
143 142
 
144
-      $row = $cellmap->get_row($i);
143
+        $row = $cellmap->get_row($i);
145 144
 
146
-      $y = $row["y"] - $bp["top"]["width"] / 2;
147
-      $h = $row["height"] + ($bp["top"]["width"] + $bp["bottom"]["width"])/ 2;
145
+        $y = $row["y"] - $bp["top"]["width"] / 2;
146
+        $h = $row["height"] + ($bp["top"]["width"] + $bp["bottom"]["width"])/ 2;
148 147
 
149
-      if ( $bp["left"]["style"] !== "none" && $bp["left"]["width"] > 0 ) {
148
+        if ( $bp["left"]["style"] !== "none" && $bp["left"]["width"] > 0 ) {
150 149
 
151 150
         $widths = array($bp["top"]["width"],
152 151
                         $bp["right"]["width"],
@@ -155,12 +154,12 @@  discard block
 block discarded – undo
155 154
 
156 155
         $method = "_border_" . $bp["left"]["style"];
157 156
         $this->$method($x, $y, $h, $bp["left"]["color"], $widths, "left", "square");
158
-      }
157
+        }
159 158
 
160
-      if ( $draw_right ) {
159
+        if ( $draw_right ) {
161 160
         $bp = $cellmap->get_border_properties($i, $num_cols - 1);
162 161
         if ( $bp["right"]["style"] === "none" || $bp["right"]["width"] <= 0 )
163
-          continue;
162
+            continue;
164 163
 
165 164
         $x = $right_col["x"] + $right_col["used-width"] + $bp["right"]["width"] / 2;
166 165
 
@@ -172,8 +171,8 @@  discard block
 block discarded – undo
172 171
         $method = "_border_" . $bp["right"]["style"];
173 172
         $this->$method($x, $y, $h, $bp["right"]["color"], $widths, "right", "square");
174 173
 
175
-      }
174
+        }
176 175
     }
177 176
 
178
-  }
177
+    }
179 178
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/php_evaluator.cls.php 1 patch
Indentation   +43 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: php_evaluator.cls.php,v $
6
- * Created on: 2004-07-12
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: php_evaluator.cls.php,v $
6
+     * Created on: 2004-07-12
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: php_evaluator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -47,15 +46,15 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class PHP_Evaluator {
49 48
   
50
-  protected $_canvas;
49
+    protected $_canvas;
51 50
 
52
-  function __construct(Canvas $canvas) {
51
+    function __construct(Canvas $canvas) {
53 52
     $this->_canvas = $canvas;
54
-  }
53
+    }
55 54
 
56
-  function evaluate($code, $vars = array()) {
55
+    function evaluate($code, $vars = array()) {
57 56
     if ( !DOMPDF_ENABLE_PHP )
58
-      return;
57
+        return;
59 58
     
60 59
     // Set up some variables for the inline code
61 60
     $pdf = $this->_canvas;
@@ -68,9 +67,9 @@  discard block
 block discarded – undo
68 67
     }
69 68
 
70 69
     eval(utf8_decode($code)); 
71
-  }
70
+    }
72 71
 
73
-  function render($frame) {
72
+    function render($frame) {
74 73
     $this->evaluate($frame->get_node()->nodeValue);
75
-  }
74
+    }
76 75
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_group_frame_decorator.cls.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,40 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: table_row_group_frame_decorator.cls.php,v $
6
- * Created on: 2004-06-02
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004-6 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: table_row_group_frame_decorator.cls.php,v $
6
+     * Created on: 2004-06-02
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004-6 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
38 38
 
39 39
 /* $Id: table_row_group_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
40 40
 
@@ -48,26 +48,26 @@  discard block
 block discarded – undo
48 48
  */
49 49
 class Table_Row_Group_Frame_Decorator extends Frame_Decorator {
50 50
 
51
-  /**
52
-   * Class constructor
53
-   *
54
-   * @param Frame $frame   Frame to decorate
55
-   * @param DOMPDF $dompdf Current dompdf instance
56
-   */
57
-  function __construct(Frame $frame, DOMPDF $dompdf) {
51
+    /**
52
+     * Class constructor
53
+     *
54
+     * @param Frame $frame   Frame to decorate
55
+     * @param DOMPDF $dompdf Current dompdf instance
56
+     */
57
+    function __construct(Frame $frame, DOMPDF $dompdf) {
58 58
     parent::__construct($frame, $dompdf);
59
-  }
59
+    }
60 60
 
61
-  /**
62
-   * Override split() to remove all child rows and this element from the cellmap
63
-   *
64
-   * @param Frame $child
65
-   */
66
-  function split($child = null) {
61
+    /**
62
+     * Override split() to remove all child rows and this element from the cellmap
63
+     *
64
+     * @param Frame $child
65
+     */
66
+    function split($child = null) {
67 67
 
68 68
     if ( is_null($child) ) {
69
-      parent::split();
70
-      return;
69
+        parent::split();
70
+        return;
71 71
     }
72 72
 
73 73
 
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
     $iter = $child;
77 77
 
78 78
     while ( $iter ) {
79
-      $cellmap->remove_row($iter);
80
-      $iter = $iter->get_next_sibling();
79
+        $cellmap->remove_row($iter);
80
+        $iter = $iter->get_next_sibling();
81 81
     }
82 82
 
83 83
     // If we are splitting at the first child remove the
84 84
     // table-row-group from the cellmap as well
85 85
     if ( $child === $this->get_first_child() ) {
86
-      $cellmap->remove_row_group($this);
87
-      parent::split();
88
-      return;
86
+        $cellmap->remove_row_group($this);
87
+        parent::split();
88
+        return;
89 89
     }
90 90
     
91 91
     $cellmap->update_row_group($this, $child->get_prev_sibling());
92 92
     parent::split($child);
93 93
     
94
-  }
94
+    }
95 95
 }
96 96
  
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/image_frame_reflower.cls.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
  */
55 55
 class Image_Frame_Reflower extends Frame_Reflower {
56 56
 
57
-  function __construct(Image_Frame_Decorator $frame) {
57
+    function __construct(Image_Frame_Decorator $frame) {
58 58
     parent::__construct($frame);
59
-  }
59
+    }
60 60
 
61
-  function reflow() {
61
+    function reflow() {
62 62
     
63 63
     // Set the frame's width
64 64
     $this->get_min_max_width();
65 65
     
66
-  }
66
+    }
67 67
 
68
-  function get_min_max_width() {
68
+    function get_min_max_width() {
69 69
 
70 70
     if (DEBUGPNG) {
71
-      // Determine the image's size. Time consuming. Only when really needed?
72
-      list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
73
-      print "get_min_max_width() ".
71
+        // Determine the image's size. Time consuming. Only when really needed?
72
+        list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
73
+        print "get_min_max_width() ".
74 74
         $this->_frame->get_style()->width.' '.
75 75
         $this->_frame->get_style()->height.';'.
76 76
         $this->_frame->get_parent()->get_style()->width." ".
@@ -93,55 +93,55 @@  discard block
 block discarded – undo
93 93
 
94 94
     $width = ($style->width > 0 ? $style->width : ($stylep->width > 0 ? $stylep->width : 0));
95 95
     if ( is_percent($width) ) {
96
-      $t = 0.0;
97
-      for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
96
+        $t = 0.0;
97
+        for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
98 98
         $t = (float)($f->get_style()->width); //always in pt
99 99
         if ((float)$t != 0) {
100
-        	break;
100
+            break;
101
+        }
101 102
         }
102
-      }
103
-      $width = ((float)rtrim($width,"%") * $t)/100; //maybe 0
103
+        $width = ((float)rtrim($width,"%") * $t)/100; //maybe 0
104 104
     } else {
105
-      // Don't set image original size if "%" branch was 0 or size not given.
106
-      // Otherwise aspect changed on %/auto combination for width/height
107
-      // Resample according to px per inch
108
-      // See also List_Bullet_Image_Frame_Decorator::__construct
109
-      $width = (float)($width * 72) / DOMPDF_DPI;
105
+        // Don't set image original size if "%" branch was 0 or size not given.
106
+        // Otherwise aspect changed on %/auto combination for width/height
107
+        // Resample according to px per inch
108
+        // See also List_Bullet_Image_Frame_Decorator::__construct
109
+        $width = (float)($width * 72) / DOMPDF_DPI;
110 110
     }
111 111
 
112 112
     $height = ($style->height > 0 ? $style->height : ($stylep->height > 0 ? $stylep->height : 0));
113 113
     if ( is_percent($height) ) {
114
-      $t = 0.0;
115
-      for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
114
+        $t = 0.0;
115
+        for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
116 116
         $t = (float)($f->get_style()->height); //always in pt
117 117
         if ((float)$t != 0) {
118
-        	break;
118
+            break;
119 119
         }
120
-      }
121
-      $height = ((float)rtrim($height,"%") * $t)/100; //maybe 0
120
+        }
121
+        $height = ((float)rtrim($height,"%") * $t)/100; //maybe 0
122 122
     } else {
123
-      // Don't set image original size if "%" branch was 0 or size not given.
124
-      // Otherwise aspect changed on %/auto combination for width/height
125
-      // Resample according to px per inch
126
-      // See also List_Bullet_Image_Frame_Decorator::__construct
127
-      $height = (float)($height * 72) / DOMPDF_DPI;
123
+        // Don't set image original size if "%" branch was 0 or size not given.
124
+        // Otherwise aspect changed on %/auto combination for width/height
125
+        // Resample according to px per inch
126
+        // See also List_Bullet_Image_Frame_Decorator::__construct
127
+        $height = (float)($height * 72) / DOMPDF_DPI;
128 128
     }
129 129
 
130 130
     if ($width == 0 || $height == 0) {
131
-      // Determine the image's size. Time consuming. Only when really needed!
132
-      list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
133
-      // don't treat 0 as error. Can be downscaled or can be catched elsewhere if image not readable.
134
-      // Resample according to px per inch
135
-      // See also List_Bullet_Image_Frame_Decorator::__construct
131
+        // Determine the image's size. Time consuming. Only when really needed!
132
+        list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
133
+        // don't treat 0 as error. Can be downscaled or can be catched elsewhere if image not readable.
134
+        // Resample according to px per inch
135
+        // See also List_Bullet_Image_Frame_Decorator::__construct
136 136
       
137
-      if ($width == 0 && $height == 0) {
137
+        if ($width == 0 && $height == 0) {
138 138
         $width = (float)($img_width * 72) / DOMPDF_DPI;
139 139
         $height = (float)($img_height * 72) / DOMPDF_DPI;
140
-      } elseif ($height == 0 && $width != 0) {
140
+        } elseif ($height == 0 && $width != 0) {
141 141
         $height = ($width / $img_width) * $img_height; //keep aspect ratio
142
-      } elseif ($width == 0 && $height != 0) {
142
+        } elseif ($width == 0 && $height != 0) {
143 143
         $width = ($height / $img_height) * $img_width; //keep aspect ratio
144
-      }
144
+        }
145 145
     }
146 146
 
147 147
     if (DEBUGPNG) print $width.' '.$height.';';
@@ -173,5 +173,5 @@  discard block
 block discarded – undo
173 173
 
174 174
     return array( $width, $width, "min" => $width, "max" => $width);
175 175
     
176
-  }
176
+    }
177 177
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/font_metrics.cls.php 1 patch
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: font_metrics.cls.php,v $
6
- * Created on: 2004-06-02
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @contributor Helmut Tischer <[email protected]>
37
- * @package dompdf
38
- *
39
- * Changes
40
- * @contributor Helmut Tischer <[email protected]>
41
- * @version 0.5.1.htischer.20090507
42
- * - On missing font on explicite font selection don't change subtype and don't return default font.
43
- * - On requesting default font and missing subtype, check similar subtypes, then any subtype, then normal. The last must exist.
44
- * - Add comments
45
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: font_metrics.cls.php,v $
6
+     * Created on: 2004-06-02
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @contributor Helmut Tischer <[email protected]>
37
+     * @package dompdf
38
+     *
39
+     * Changes
40
+     * @contributor Helmut Tischer <[email protected]>
41
+     * @version 0.5.1.htischer.20090507
42
+     * - On missing font on explicite font selection don't change subtype and don't return default font.
43
+     * - On requesting default font and missing subtype, check similar subtypes, then any subtype, then normal. The last must exist.
44
+     * - Add comments
45
+     */
46 46
 
47 47
 /* $Id: font_metrics.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
48 48
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
  * Declared here because PHP5 prevents constants from being declared with expressions
61 61
  */
62 62
 if (file_exists(DOMPDF_FONT_DIR . "dompdf_font_family_cache")) {
63
-	define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR . "dompdf_font_family_cache");
63
+    define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR . "dompdf_font_family_cache");
64 64
 } else {
65
-	define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR . "dompdf_font_family_cache.dist");
65
+    define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR . "dompdf_font_family_cache.dist");
66 66
 }
67 67
 
68 68
 
@@ -78,76 +78,76 @@  discard block
 block discarded – undo
78 78
  */
79 79
 class Font_Metrics {
80 80
 
81
-  /**
82
-   * @see __DOMPDF_FONT_CACHE_FILE
83
-   */
84
-  const CACHE_FILE = __DOMPDF_FONT_CACHE_FILE;
81
+    /**
82
+     * @see __DOMPDF_FONT_CACHE_FILE
83
+     */
84
+    const CACHE_FILE = __DOMPDF_FONT_CACHE_FILE;
85 85
   
86
-  /**
87
-   * Underlying {@link Cpdf} object to perform text size calculations
88
-   *
89
-   * @var Cpdf
90
-   */
91
-  static protected $_pdf = null;
92
-
93
-  /**
94
-   * Array of font family names to font files
95
-   *
96
-   * Usually cached by the {@link load_font.php} script
97
-   *
98
-   * @var array
99
-   */
100
-  static protected $_font_lookup = array();
86
+    /**
87
+     * Underlying {@link Cpdf} object to perform text size calculations
88
+     *
89
+     * @var Cpdf
90
+     */
91
+    static protected $_pdf = null;
92
+
93
+    /**
94
+     * Array of font family names to font files
95
+     *
96
+     * Usually cached by the {@link load_font.php} script
97
+     *
98
+     * @var array
99
+     */
100
+    static protected $_font_lookup = array();
101 101
   
102 102
   
103
-  /**
104
-   * Class initialization
105
-   *
106
-   */
107
-  static function init() {
103
+    /**
104
+     * Class initialization
105
+     *
106
+     */
107
+    static function init() {
108 108
     if (!self::$_pdf) {
109
-      self::load_font_families();
110
-      self::$_pdf = Canvas_Factory::get_instance();
109
+        self::load_font_families();
110
+        self::$_pdf = Canvas_Factory::get_instance();
111 111
     }
112
-  }
113
-
114
-  /**
115
-   * Calculates text size, in points
116
-   *
117
-   * @param string $text the text to be sized
118
-   * @param string $font the desired font
119
-   * @param float  $size the desired font size
120
-   * @param float  $spacing word spacing, if any
121
-   * @return float
122
-   */
123
-  static function get_text_width($text, $font, $size, $spacing = 0) {
112
+    }
113
+
114
+    /**
115
+     * Calculates text size, in points
116
+     *
117
+     * @param string $text the text to be sized
118
+     * @param string $font the desired font
119
+     * @param float  $size the desired font size
120
+     * @param float  $spacing word spacing, if any
121
+     * @return float
122
+     */
123
+    static function get_text_width($text, $font, $size, $spacing = 0) {
124 124
     return self::$_pdf->get_text_width($text, $font, $size, $spacing);
125
-  }
126
-
127
-  /**
128
-   * Calculates font height
129
-   *
130
-   * @param string $font
131
-   * @param float $size
132
-   * @return float
133
-   */
134
-  static function get_font_height($font, $size) {
125
+    }
126
+
127
+    /**
128
+     * Calculates font height
129
+     *
130
+     * @param string $font
131
+     * @param float $size
132
+     * @return float
133
+     */
134
+    static function get_font_height($font, $size) {
135 135
     return self::$_pdf->get_font_height($font, $size);
136
-  }
137
-
138
-  /**
139
-   * Resolves a font family & subtype into an actual font file
140
-   *
141
-   * Subtype can be one of 'normal', 'bold', 'italic' or 'bold_italic'.  If
142
-   * the particular font family has no suitable font file, the default font
143
-   * ({@link DOMPDF_DEFAULT_FONT}) is used.  The font file returned
144
-   * is the absolute pathname to the font file on the system.
145
-   *
146
-   * @param string $family
147
-   * @param string $subtype
148
-   * @return string
149
-   */
150
-  static function get_font($family, $subtype = "normal") {
136
+    }
137
+
138
+    /**
139
+     * Resolves a font family & subtype into an actual font file
140
+     *
141
+     * Subtype can be one of 'normal', 'bold', 'italic' or 'bold_italic'.  If
142
+     * the particular font family has no suitable font file, the default font
143
+     * ({@link DOMPDF_DEFAULT_FONT}) is used.  The font file returned
144
+     * is the absolute pathname to the font file on the system.
145
+     *
146
+     * @param string $family
147
+     * @param string $subtype
148
+     * @return string
149
+     */
150
+    static function get_font($family, $subtype = "normal") {
151 151
 
152 152
     /* Allow calling for various fonts in search path. Therefore not immediately
153 153
      * return replacement on non match.
@@ -158,85 +158,85 @@  discard block
 block discarded – undo
158 158
      */
159 159
 
160 160
     if ( $family ) {
161
-      $family = str_replace( array("'", '"'), "", mb_strtolower($family));
162
-      $subtype = mb_strtolower($subtype);
161
+        $family = str_replace( array("'", '"'), "", mb_strtolower($family));
162
+        $subtype = mb_strtolower($subtype);
163 163
 
164
-      if ( isset(self::$_font_lookup[$family][$subtype]) ) {
164
+        if ( isset(self::$_font_lookup[$family][$subtype]) ) {
165 165
         return self::$_font_lookup[$family][$subtype];
166
-      }
167
-      return null;
166
+        }
167
+        return null;
168 168
     }
169 169
 
170 170
     $family = DOMPDF_DEFAULT_FONT;
171 171
 
172 172
     if ( isset(self::$_font_lookup[$family][$subtype]) ) {
173
-      return self::$_font_lookup[$family][$subtype];
173
+        return self::$_font_lookup[$family][$subtype];
174 174
     }
175 175
 
176 176
     foreach ( self::$_font_lookup[$family] as $sub => $font ) {
177
-      if (strpos($subtype, $sub) !== false) {
177
+        if (strpos($subtype, $sub) !== false) {
178 178
         return $font;
179
-      }
179
+        }
180 180
     }
181 181
 
182 182
     if ($subtype !== "normal") {
183
-      foreach ( self::$_font_lookup[$family] as $sub => $font ) {
183
+        foreach ( self::$_font_lookup[$family] as $sub => $font ) {
184 184
         if ($sub !== "normal") {
185
-          return $font;
185
+            return $font;
186
+        }
186 187
         }
187
-      }
188 188
     }
189 189
 
190 190
     $subtype = "normal";
191 191
 
192 192
     if ( isset(self::$_font_lookup[$family][$subtype]) ) {
193
-      return self::$_font_lookup[$family][$subtype];
193
+        return self::$_font_lookup[$family][$subtype];
194 194
     }
195 195
     return null;
196
-  }
197
-
198
-  /**
199
-   * Saves the stored font family cache
200
-   *
201
-   * The name and location of the cache file are determined by {@link
202
-   * Font_Metrics::CACHE_FILE}.  This file should be writable by the
203
-   * webserver process.
204
-   *
205
-   * @see Font_Metrics::load_font_families()
206
-   */
207
-  static function save_font_families() {
196
+    }
197
+
198
+    /**
199
+     * Saves the stored font family cache
200
+     *
201
+     * The name and location of the cache file are determined by {@link
202
+     * Font_Metrics::CACHE_FILE}.  This file should be writable by the
203
+     * webserver process.
204
+     *
205
+     * @see Font_Metrics::load_font_families()
206
+     */
207
+    static function save_font_families() {
208 208
 
209 209
     file_put_contents(self::CACHE_FILE, var_export(self::$_font_lookup, true));
210 210
     
211
-  }
212
-
213
-  /**
214
-   * Loads the stored font family cache
215
-   *
216
-   * @see save_font_families()
217
-   */
218
-  static function load_font_families() {
211
+    }
212
+
213
+    /**
214
+     * Loads the stored font family cache
215
+     *
216
+     * @see save_font_families()
217
+     */
218
+    static function load_font_families() {
219 219
     if ( !is_readable(self::CACHE_FILE) )
220
-      return;
220
+        return;
221 221
 
222 222
     $data = file_get_contents(self::CACHE_FILE);
223 223
 
224 224
     if ( $data != "" )
225
-      eval ('self::$_font_lookup = ' . $data . ";");
226
-  }
227
-
228
-  /**
229
-   * Returns the current font lookup table
230
-   *
231
-   * @return array
232
-   */
233
-  static function get_font_families() {
225
+        eval ('self::$_font_lookup = ' . $data . ";");
226
+    }
227
+
228
+    /**
229
+     * Returns the current font lookup table
230
+     *
231
+     * @return array
232
+     */
233
+    static function get_font_families() {
234 234
     return self::$_font_lookup;
235
-  }
235
+    }
236 236
 
237
-  static function set_font_family($fontname, $entry) {
237
+    static function set_font_family($fontname, $entry) {
238 238
     self::$_font_lookup[mb_strtolower($fontname)] = $entry;
239
-  }
239
+    }
240 240
 }
241 241
 
242 242
 Font_Metrics::init();
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/block_renderer.cls.php 1 patch
Indentation   +18 added lines, -19 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: block_renderer.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,26 +46,26 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Block_Renderer extends Abstract_Renderer {
49 48
 
50
-  //........................................................................
49
+    //........................................................................
51 50
 
52
-  function render(Frame $frame) {
51
+    function render(Frame $frame) {
53 52
     $style = $frame->get_style();
54 53
     list($x, $y, $w, $h) = $frame->get_padding_box();
55 54
 
56 55
     // Draw our background, border and content
57 56
     if ( ($bg = $style->background_color) !== "transparent" ) {
58
-      $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color );
57
+        $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color );
59 58
     }
60 59
 
61 60
     if ( ($url = $style->background_image) && $url !== "none" )
62
-      $this->_background_image($url, $x, $y, $w, $h, $style);
61
+        $this->_background_image($url, $x, $y, $w, $h, $style);
63 62
 
64 63
 
65 64
     $this->_render_border($frame);
66 65
 
67
-  }
66
+    }
68 67
 
69
-  protected function _render_border(Frame_Decorator $frame, $corner_style = "bevel") {
68
+    protected function _render_border(Frame_Decorator $frame, $corner_style = "bevel") {
70 69
     $cb = $frame->get_containing_block();
71 70
     $style = $frame->get_style();
72 71
 
@@ -79,36 +78,36 @@  discard block
 block discarded – undo
79 78
                     $style->length_in_pt($bp["left"]["width"]));
80 79
 
81 80
     foreach ($bp as $side => $props) {
82
-      list($x, $y, $w, $h) = $bbox;
81
+        list($x, $y, $w, $h) = $bbox;
83 82
 
84
-      if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 )
83
+        if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 )
85 84
         continue;
86 85
 
87 86
 
88
-      switch($side) {
89
-      case "top":
87
+        switch($side) {
88
+        case "top":
90 89
         $length = $w;
91 90
         break;
92 91
 
93
-      case "bottom":
92
+        case "bottom":
94 93
         $length = $w;
95 94
         $y += $h;
96 95
         break;
97 96
 
98
-      case "left":
97
+        case "left":
99 98
         $length = $h;
100 99
         break;
101 100
 
102
-      case "right":
101
+        case "right":
103 102
         $length = $h;
104 103
         $x += $w;
105 104
         break;
106
-      default:
105
+        default:
107 106
         break;
108
-      }
109
-      $method = "_border_" . $props["style"];
107
+        }
108
+        $method = "_border_" . $props["style"];
110 109
 
111
-      $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style);
110
+        $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style);
111
+    }
112 112
     }
113
-  }
114 113
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/renderer.cls.php 1 patch
Indentation   +115 added lines, -116 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: renderer.cls.php,v $
6
- * Created on: 2004-06-03
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: renderer.cls.php,v $
6
+     * Created on: 2004-06-03
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: renderer.cls.php 217 2010-03-11 23:03:57Z ryan.masten $ */
41 40
 
@@ -50,38 +49,38 @@  discard block
 block discarded – undo
50 49
  */
51 50
 class Renderer extends Abstract_Renderer {
52 51
 
53
-  /**
54
-   * Array of renderers for specific frame types
55
-   *
56
-   * @var array
57
-   */
58
-  protected $_renderers;
52
+    /**
53
+     * Array of renderers for specific frame types
54
+     *
55
+     * @var array
56
+     */
57
+    protected $_renderers;
59 58
     
60
-  /**
61
-   * Cache of the callbacks array
62
-   * 
63
-   * @var array
64
-   */
65
-  private $_callbacks;
59
+    /**
60
+     * Cache of the callbacks array
61
+     * 
62
+     * @var array
63
+     */
64
+    private $_callbacks;
66 65
     
67
-  /**
68
-   * Advance the canvas to the next page
69
-   */  
70
-  function new_page() {
66
+    /**
67
+     * Advance the canvas to the next page
68
+     */  
69
+    function new_page() {
71 70
     $this->_canvas->new_page();
72
-  }
73
-
74
-  /**
75
-   * Render frames recursively
76
-   *
77
-   * @param Frame $frame the frame to render
78
-   */
79
-  function render(Frame $frame) {    
71
+    }
72
+
73
+    /**
74
+     * Render frames recursively
75
+     *
76
+     * @param Frame $frame the frame to render
77
+     */
78
+    function render(Frame $frame) {    
80 79
     global $_dompdf_debug;
81 80
 
82 81
     if ( $_dompdf_debug ) {
83
-      echo $frame;
84
-      flush();
82
+        echo $frame;
83
+        flush();
85 84
     }
86 85
 
87 86
     $display = $frame->get_style()->display;
@@ -97,46 +96,46 @@  discard block
 block discarded – undo
97 96
     case "table-footer-group":
98 97
     case "inline-table":
99 98
       $this->_render_frame("block", $frame);
100
-      break;
99
+        break;
101 100
 
102 101
     case "inline":
103 102
       if ( $frame->get_node()->nodeName === "#text" )
104 103
         $this->_render_frame("text", $frame);
105
-      else
104
+        else
106 105
         $this->_render_frame("inline", $frame);
107
-      break;
106
+        break;
108 107
 
109 108
     case "table-cell":
110 109
       $this->_render_frame("table-cell", $frame);
111
-      break;
110
+        break;
112 111
 
113 112
     case "-dompdf-list-bullet":
114 113
       $this->_render_frame("list-bullet", $frame);
115
-      break;
114
+        break;
116 115
 
117 116
     case "-dompdf-image":
118 117
       $this->_render_frame("image", $frame);
119
-      break;
118
+        break;
120 119
       
121 120
     case "none":
122 121
       $node = $frame->get_node();
123 122
           
124
-      if ( $node->nodeName === "script" ) {
123
+        if ( $node->nodeName === "script" ) {
125 124
         if ( $node->getAttribute("type") === "text/php" ||
126 125
              $node->getAttribute("language") === "php" ) {
127
-          // Evaluate embedded php scripts
128
-          $this->_render_frame("php", $frame);
126
+            // Evaluate embedded php scripts
127
+            $this->_render_frame("php", $frame);
129 128
         }
130 129
         
131 130
         elseif ( $node->getAttribute("type") === "text/javascript" ||
132 131
              $node->getAttribute("language") === "javascript" ) {
133
-          // Insert JavaScript
134
-          $this->_render_frame("javascript", $frame);
132
+            // Insert JavaScript
133
+            $this->_render_frame("javascript", $frame);
134
+        }
135 135
         }
136
-      }
137 136
 
138
-      // Don't render children, so skip to next iter
139
-      return;
137
+        // Don't render children, so skip to next iter
138
+        return;
140 139
       
141 140
     default:
142 141
       break;
@@ -147,90 +146,90 @@  discard block
 block discarded – undo
147 146
     $this->_check_callbacks("begin_frame", $frame);
148 147
     
149 148
     foreach ($frame->get_children() as $child)
150
-      $this->render($child);
149
+        $this->render($child);
151 150
 
152 151
     // Check for end frame callback
153 152
     $this->_check_callbacks("end_frame", $frame);
154 153
     
155
-  }
154
+    }
156 155
   
157
-  /**
158
-   * Check for callbacks that need to be performed when a given event
159
-   * gets triggered on a frame
160
-   *
161
-   * @param string $event the type of event
162
-   * @param Frame $frame the frame that event is triggered on
163
-   */
164
-  protected function _check_callbacks($event, $frame) {
156
+    /**
157
+     * Check for callbacks that need to be performed when a given event
158
+     * gets triggered on a frame
159
+     *
160
+     * @param string $event the type of event
161
+     * @param Frame $frame the frame that event is triggered on
162
+     */
163
+    protected function _check_callbacks($event, $frame) {
165 164
     if (!isset($this->_callbacks)) {
166
-      $this->_callbacks = $this->_dompdf->get_callbacks();
165
+        $this->_callbacks = $this->_dompdf->get_callbacks();
167 166
     }
168 167
     
169 168
     if (is_array($this->_callbacks) && isset($this->_callbacks[$event])) {
170
-      $info = array(0 => $this->_canvas, "canvas" => $this->_canvas,
169
+        $info = array(0 => $this->_canvas, "canvas" => $this->_canvas,
171 170
                     1 => $frame, "frame" => $frame);
172
-      $fs = $this->_callbacks[$event];
173
-      foreach ($fs as $f) {
171
+        $fs = $this->_callbacks[$event];
172
+        foreach ($fs as $f) {
174 173
         if (is_callable($f)) {
175
-          if (is_array($f)) {
174
+            if (is_array($f)) {
176 175
             $f[0]->$f[1]($info);
177
-          } else {
176
+            } else {
178 177
             $f($info);
179
-          }
178
+            }
180 179
         }
181
-      }
180
+        }
181
+    }
182 182
     }
183
-  }
184
-
185
-  /**
186
-   * Render a single frame
187
-   *
188
-   * Creates Renderer objects on demand
189
-   *
190
-   * @param string $type type of renderer to use
191
-   * @param Frame $frame the frame to render
192
-   */
193
-  protected function _render_frame($type, $frame) {
183
+
184
+    /**
185
+     * Render a single frame
186
+     *
187
+     * Creates Renderer objects on demand
188
+     *
189
+     * @param string $type type of renderer to use
190
+     * @param Frame $frame the frame to render
191
+     */
192
+    protected function _render_frame($type, $frame) {
194 193
 
195 194
     if ( !isset($this->_renderers[$type]) ) {
196 195
       
197
-      switch ($type) {
198
-      case "block":
196
+        switch ($type) {
197
+        case "block":
199 198
         $this->_renderers["block"] = new Block_Renderer($this->_dompdf);
200 199
         break;
201 200
 
202
-      case "inline":
201
+        case "inline":
203 202
         $this->_renderers["inline"] = new Inline_Renderer($this->_dompdf);
204 203
         break;
205 204
 
206
-      case "text":
205
+        case "text":
207 206
         $this->_renderers["text"] = new Text_Renderer($this->_dompdf);
208 207
         break;
209 208
 
210
-      case "image":
209
+        case "image":
211 210
         $this->_renderers["image"] = new Image_Renderer($this->_dompdf);
212 211
         break;
213 212
       
214
-      case "table-cell":
213
+        case "table-cell":
215 214
         $this->_renderers["table-cell"] = new Table_Cell_Renderer($this->_dompdf);
216 215
         break;
217 216
 
218
-      case "list-bullet":
217
+        case "list-bullet":
219 218
         $this->_renderers["list-bullet"] = new List_Bullet_Renderer($this->_dompdf);
220 219
         break;
221 220
 
222
-      case "php":
221
+        case "php":
223 222
         $this->_renderers["php"] = new PHP_Evaluator($this->_canvas);
224 223
         break;
225 224
 
226
-      case "javascript":
225
+        case "javascript":
227 226
         $this->_renderers["javascript"] = new Javascript_Embedder($this->_dompdf);
228 227
         break;
229 228
         
230
-      }
229
+        }
231 230
     }
232 231
     
233 232
     $this->_renderers[$type]->render($frame);
234 233
 
235
-  }
234
+    }
236 235
 }
Please login to merge, or discard this patch.