Completed
Push — 1.10.x ( 0f48ee...7b08cd )
by Angel Fernando Quiroz
165:10 queued 123:19
created
main/inc/lib/phpdocx/pdf/include/list_bullet_positioner.cls.php 1 patch
Indentation   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -35,7 +35,6 @@  discard block
 block discarded – undo
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @contributor Helmut Tischer <[email protected]>
37 37
  * @package dompdf
38
-
39 38
  *
40 39
  * Changes
41 40
  * @contributor Helmut Tischer <[email protected]>
@@ -53,11 +52,11 @@  discard block
 block discarded – undo
53 52
  */
54 53
 class List_Bullet_Positioner extends Positioner {
55 54
 
56
-  function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
55
+    function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
57 56
   
58
-  //........................................................................
57
+    //........................................................................
59 58
 
60
-  function position() {
59
+    function position() {
61 60
     
62 61
     // Bullets & friends are positioned an absolute distance to the left of
63 62
     // the content edge of their parent element
@@ -75,19 +74,19 @@  discard block
 block discarded – undo
75 74
     // This is a bit of a hack...
76 75
     $n = $this->_frame->get_next_sibling();
77 76
     if ( $n ) {
78
-      $style = $n->get_style();
79
-      $y += $style->length_in_pt( array($style->margin_top, $style->padding_top),
80
-                                  $n->get_containing_block("w") );
77
+        $style = $n->get_style();
78
+        $y += $style->length_in_pt( array($style->margin_top, $style->padding_top),
79
+                                    $n->get_containing_block("w") );
81 80
     }
82 81
 
83
-	// Now the position is the left top of the block which should be marked with the bullet.
84
-	// We tried to find out the y of the start of the first text character within the block.
85
-	// But the top margin/padding does not fit, neither from this nor from the next sibling
86
-	// The "bit of a hack" above does not work also.
82
+    // Now the position is the left top of the block which should be marked with the bullet.
83
+    // We tried to find out the y of the start of the first text character within the block.
84
+    // But the top margin/padding does not fit, neither from this nor from the next sibling
85
+    // The "bit of a hack" above does not work also.
87 86
 	
88
-	// Instead let's position the bullet vertically centered to the block which should be marked.
89
-	// But for get_next_sibling() the get_containing_block is all zero, and for find_block_parent()
90
-	// the get_containing_block is paper width and the entire list as height.
87
+    // Instead let's position the bullet vertically centered to the block which should be marked.
88
+    // But for get_next_sibling() the get_containing_block is all zero, and for find_block_parent()
89
+    // the get_containing_block is paper width and the entire list as height.
91 90
 	
92 91
     // if ($p) {
93 92
     //   //$cb = $n->get_containing_block();
@@ -96,8 +95,8 @@  discard block
 block discarded – undo
96 95
     // print 'cb:'.$cb["x"].':'.$cb["y"].':'.$cb["w"].':'.$cb["h"].':';
97 96
     // }	 
98 97
 
99
-	// Todo:
100
-	// For now give up on the above. Use Guesswork with font y-pos in the middle of the line spacing
98
+    // Todo:
99
+    // For now give up on the above. Use Guesswork with font y-pos in the middle of the line spacing
101 100
 
102 101
     $style = $p->get_style();
103 102
     $font_size = $style->get_font_size();
@@ -107,5 +106,5 @@  discard block
 block discarded – undo
107 106
     //Position is x-end y-top of character position of the bullet.    
108 107
     $this->_frame->set_position($x, $y);
109 108
     
110
-  }
109
+    }
111 110
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_frame_decorator.cls.php 1 patch
Indentation   +13 added lines, -14 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_row_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,35 +46,35 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Table_Row_Frame_Decorator extends Frame_Decorator {
49 48
 
50
-  // protected members
49
+    // protected members
51 50
   
52
-  function __construct(Frame $frame, DOMPDF $dompdf) {
51
+    function __construct(Frame $frame, DOMPDF $dompdf) {
53 52
     parent::__construct($frame, $dompdf);
54
-  }
53
+    }
55 54
   
56
-  //........................................................................ 
55
+    //........................................................................ 
57 56
 
58
-  /**
59
-   * Remove all non table-cell frames from this row and move them after
60
-   * the table.
61
-   */
62
-  function normalise() {
57
+    /**
58
+     * Remove all non table-cell frames from this row and move them after
59
+     * the table.
60
+     */
61
+    function normalise() {
63 62
 
64 63
     // Find our table parent
65 64
     $p = Table_Frame_Decorator::find_parent_table($this);
66 65
     
67 66
     $erroneous_frames = array();
68 67
     foreach ($this->get_children() as $child) {      
69
-      $display = $child->get_style()->display;
68
+        $display = $child->get_style()->display;
70 69
 
71
-      if ( $display !== "table-cell" )
70
+        if ( $display !== "table-cell" )
72 71
         $erroneous_frames[] = $child;
73 72
     }
74 73
     
75 74
     //  dump the extra nodes after the table.
76 75
     foreach ($erroneous_frames as $frame) 
77
-      $p->move_after($frame);
78
-  }
76
+        $p->move_after($frame);
77
+    }
79 78
   
80 79
   
81 80
 }
Please login to merge, or discard this patch.
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/list_bullet_frame_reflower.cls.php 1 patch
Indentation   +6 added lines, -7 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: list_bullet_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,20 +46,20 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class List_Bullet_Frame_Reflower extends Frame_Reflower {
49 48
 
50
-  function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
49
+    function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
51 50
     
52
-  //........................................................................
51
+    //........................................................................
53 52
 
54
-  function reflow() {
53
+    function reflow() {
55 54
     $style = $this->_frame->get_style();
56 55
 
57 56
     $style->width = $this->_frame->get_width();
58 57
     $this->_frame->position();
59 58
 
60 59
     if ( $style->list_style_position === "inside" ) {
61
-      $p = $this->_frame->find_block_parent();
62
-      $p->add_frame_to_line($this->_frame);
60
+        $p = $this->_frame->find_block_parent();
61
+        $p->add_frame_to_line($this->_frame);
63 62
     }
64 63
 
65
-  }
64
+    }
66 65
 }
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/table_frame_decorator.cls.php 1 patch
Indentation   +188 added lines, -189 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_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -46,73 +45,73 @@  discard block
 block discarded – undo
46 45
  * @package dompdf
47 46
  */
48 47
 class Table_Frame_Decorator extends Frame_Decorator {
49
-  static $VALID_CHILDREN = array("table-row-group",
50
-                                 "table-row",
51
-                                 "table-header-group",
52
-                                 "table-footer-group",
53
-                                 "table-column",
54
-                                 "table-column-group",
55
-                                 "table-caption",
56
-                                 "table-cell");
57
-
58
-  static $ROW_GROUPS = array('table-row-group',
59
-                             'table-header-group',
60
-                             'table-footer-group');
61
-
62
-  /**
63
-   * The Cellmap object for this table.  The cellmap maps table cells
64
-   * to rows and columns, and aids in calculating column widths.
65
-   *
66
-   * @var Cellmap
67
-   */
68
-  protected $_cellmap;
69
-
70
-  /**
71
-   * The minimum width of the table, in pt
72
-   *
73
-   * @var float
74
-   */
75
-  protected $_min_width;
76
-
77
-  /**
78
-   * The maximum width of the table, in pt
79
-   *
80
-   * @var float
81
-   */
82
-  protected $_max_width;
83
-
84
-  /**
85
-   * Table header rows.  Each table header is duplicated when a table
86
-   * spans pages.
87
-   *
88
-   * @var array
89
-   */
90
-  protected $_headers;
91
-
92
-  /**
93
-   * Table footer rows.  Each table footer is duplicated when a table
94
-   * spans pages.
95
-   *
96
-   * @var array
97
-   */
98
-  protected $_footers;
99
-
100
-  /**
101
-   * Class constructor
102
-   *
103
-   * @param Frame $frame the frame to decorate
104
-   */
105
-  function __construct(Frame $frame, DOMPDF $dompdf) {
48
+    static $VALID_CHILDREN = array("table-row-group",
49
+                                    "table-row",
50
+                                    "table-header-group",
51
+                                    "table-footer-group",
52
+                                    "table-column",
53
+                                    "table-column-group",
54
+                                    "table-caption",
55
+                                    "table-cell");
56
+
57
+    static $ROW_GROUPS = array('table-row-group',
58
+                                'table-header-group',
59
+                                'table-footer-group');
60
+
61
+    /**
62
+     * The Cellmap object for this table.  The cellmap maps table cells
63
+     * to rows and columns, and aids in calculating column widths.
64
+     *
65
+     * @var Cellmap
66
+     */
67
+    protected $_cellmap;
68
+
69
+    /**
70
+     * The minimum width of the table, in pt
71
+     *
72
+     * @var float
73
+     */
74
+    protected $_min_width;
75
+
76
+    /**
77
+     * The maximum width of the table, in pt
78
+     *
79
+     * @var float
80
+     */
81
+    protected $_max_width;
82
+
83
+    /**
84
+     * Table header rows.  Each table header is duplicated when a table
85
+     * spans pages.
86
+     *
87
+     * @var array
88
+     */
89
+    protected $_headers;
90
+
91
+    /**
92
+     * Table footer rows.  Each table footer is duplicated when a table
93
+     * spans pages.
94
+     *
95
+     * @var array
96
+     */
97
+    protected $_footers;
98
+
99
+    /**
100
+     * Class constructor
101
+     *
102
+     * @param Frame $frame the frame to decorate
103
+     */
104
+    function __construct(Frame $frame, DOMPDF $dompdf) {
106 105
     parent::__construct($frame, $dompdf);
107 106
     $this->_cellmap = new Cellmap($this);
108 107
     $this->_min_width = null;
109 108
     $this->_max_width = null;
110 109
     $this->_headers = array();
111 110
     $this->_footers = array();
112
-  }
111
+    }
113 112
 
114 113
 
115
-  function reset() {
114
+    function reset() {
116 115
     parent::reset();
117 116
     $this->_cellmap->reset();
118 117
     $this->_min_width = null;
@@ -120,22 +119,22 @@  discard block
 block discarded – undo
120 119
     $this->_headers = array();
121 120
     $this->_footers = array();
122 121
     $this->_reflower->reset();
123
-  }
122
+    }
124 123
 
125
-  //........................................................................
124
+    //........................................................................
126 125
 
127
-  /**
128
-   * split the table at $row.  $row and all subsequent rows will be
129
-   * added to the clone.  This method is overidden in order to remove
130
-   * frames from the cellmap properly.
131
-   *
132
-   * @param Frame $row
133
-   */
134
-  function split($child = null) {
126
+    /**
127
+     * split the table at $row.  $row and all subsequent rows will be
128
+     * added to the clone.  This method is overidden in order to remove
129
+     * frames from the cellmap properly.
130
+     *
131
+     * @param Frame $row
132
+     */
133
+    function split($child = null) {
135 134
 
136 135
     if ( is_null($child) ) {
137
-      parent::split();
138
-      return;
136
+        parent::split();
137
+        return;
139 138
     }
140 139
 
141 140
     // If $child is a header or if it is the first non-header row, do
@@ -143,200 +142,200 @@  discard block
 block discarded – undo
143 142
     if ( count($this->_headers) && !in_array($child, $this->_headers, true) &&
144 143
          !in_array($child->get_prev_sibling(), $this->_headers, true) ) {
145 144
 
146
-      $first_header = null;
145
+        $first_header = null;
147 146
 
148
-      // Insert copies of the table headers before $child
149
-      foreach ($this->_headers as $header) {
147
+        // Insert copies of the table headers before $child
148
+        foreach ($this->_headers as $header) {
150 149
 
151 150
         $new_header = $header->deep_copy();
152 151
 
153 152
         if ( is_null($first_header) )
154
-          $first_header = $new_header;
153
+            $first_header = $new_header;
155 154
 
156 155
         $this->insert_child_before($new_header, $child);
157
-      }
156
+        }
158 157
 
159
-      parent::split($first_header);
158
+        parent::split($first_header);
160 159
 
161 160
     } else if ( in_array($child->get_style()->display, self::$ROW_GROUPS) ) {
162 161
 
163
-      // Individual rows should have already been handled
164
-      parent::split($child);
162
+        // Individual rows should have already been handled
163
+        parent::split($child);
165 164
 
166 165
     } else {
167 166
 
168
-      $iter = $child;
167
+        $iter = $child;
169 168
 
170
-      while ($iter) {
169
+        while ($iter) {
171 170
         $this->_cellmap->remove_row($iter);
172 171
         $iter = $iter->get_next_sibling();
173
-      }
172
+        }
174 173
 
175
-      parent::split($child);
174
+        parent::split($child);
175
+    }
176 176
     }
177
-  }
178 177
 
179
-  /**
180
-   * Static function to locate the parent table of a frame
181
-   *
182
-   * @param Frame $frame
183
-   * @return Frame the table that is an ancestor of $frame
184
-   */
185
-  static function find_parent_table(Frame $frame) {
178
+    /**
179
+     * Static function to locate the parent table of a frame
180
+     *
181
+     * @param Frame $frame
182
+     * @return Frame the table that is an ancestor of $frame
183
+     */
184
+    static function find_parent_table(Frame $frame) {
186 185
 
187 186
     while ( $frame = $frame->get_parent() )
188
-      if ( in_array($frame->get_style()->display, Style::$TABLE_TYPES) )
187
+        if ( in_array($frame->get_style()->display, Style::$TABLE_TYPES) )
189 188
         break;
190 189
 
191 190
     return $frame;
192
-  }
193
-
194
-  /**
195
-   * Return this table's Cellmap
196
-   *
197
-   * @return Cellmap
198
-   */
199
-  function get_cellmap() { return $this->_cellmap; }
200
-
201
-  /**
202
-   * Return the minimum width of this table
203
-   *
204
-   * @return float
205
-   */
206
-  function get_min_width() { return $this->_min_width; }
207
-
208
-  /**
209
-   * Return the maximum width of this table
210
-   *
211
-   * @return float
212
-   */
213
-  function get_max_width() { return $this->_max_width; }
214
-
215
-  /**
216
-   * Set the minimum width of the table
217
-   *
218
-   * @param float $width the new minimum width
219
-   */
220
-  function set_min_width($width) { $this->_min_width = $width; }
221
-
222
-  /**
223
-   * Set the maximum width of the table
224
-   *
225
-   * @param float $width the new maximum width
226
-   */
227
-  function set_max_width($width) { $this->_max_width = $width; }
228
-
229
-  /**
230
-   * Restructure tree so that the table has the correct structure.
231
-   * Invalid children (i.e. all non-table-rows) are moved below the
232
-   * table.
233
-   */
234
-  function normalise() {
191
+    }
192
+
193
+    /**
194
+     * Return this table's Cellmap
195
+     *
196
+     * @return Cellmap
197
+     */
198
+    function get_cellmap() { return $this->_cellmap; }
199
+
200
+    /**
201
+     * Return the minimum width of this table
202
+     *
203
+     * @return float
204
+     */
205
+    function get_min_width() { return $this->_min_width; }
206
+
207
+    /**
208
+     * Return the maximum width of this table
209
+     *
210
+     * @return float
211
+     */
212
+    function get_max_width() { return $this->_max_width; }
213
+
214
+    /**
215
+     * Set the minimum width of the table
216
+     *
217
+     * @param float $width the new minimum width
218
+     */
219
+    function set_min_width($width) { $this->_min_width = $width; }
220
+
221
+    /**
222
+     * Set the maximum width of the table
223
+     *
224
+     * @param float $width the new maximum width
225
+     */
226
+    function set_max_width($width) { $this->_max_width = $width; }
227
+
228
+    /**
229
+     * Restructure tree so that the table has the correct structure.
230
+     * Invalid children (i.e. all non-table-rows) are moved below the
231
+     * table.
232
+     */
233
+    function normalise() {
235 234
 
236 235
     // Store frames generated by invalid tags and move them outside the table
237 236
     $erroneous_frames = array();
238 237
     $anon_row = false;
239 238
     $iter = $this->get_first_child();
240 239
     while ( $iter ) {
241
-      $child = $iter;
242
-      $iter = $iter->get_next_sibling();
240
+        $child = $iter;
241
+        $iter = $iter->get_next_sibling();
243 242
 
244
-      $display = $child->get_style()->display;
243
+        $display = $child->get_style()->display;
245 244
 
246
-      if ( $anon_row ) {
245
+        if ( $anon_row ) {
247 246
 
248 247
         if ( $display === "table-row" ) {
249
-          // Add the previous anonymous row
250
-          $this->insert_child_before($table_row, $child);
248
+            // Add the previous anonymous row
249
+            $this->insert_child_before($table_row, $child);
251 250
 
252
-          $table_row->normalise();
253
-          $child->normalise();
254
-          $anon_row = false;
255
-          continue;
251
+            $table_row->normalise();
252
+            $child->normalise();
253
+            $anon_row = false;
254
+            continue;
256 255
         }
257 256
 
258 257
         // add the child to the anonymous row
259 258
         $table_row->append_child($child);
260 259
         continue;
261 260
 
262
-      } else {
261
+        } else {
263 262
 
264 263
         if ( $display === "table-row" ) {
265
-          $child->normalise();
266
-          continue;
264
+            $child->normalise();
265
+            continue;
267 266
         }
268 267
 
269 268
         if ( $display === "table-cell") {
270
-          // Create an anonymous table row
271
-          $tr = $this->get_node()->ownerDocument->createElement("tr");
269
+            // Create an anonymous table row
270
+            $tr = $this->get_node()->ownerDocument->createElement("tr");
272 271
 
273
-          $frame = new Frame($tr);
272
+            $frame = new Frame($tr);
274 273
 
275
-          $css = $this->get_style()->get_stylesheet();
276
-          $style = $css->create_style();
277
-          $style->inherit($this->get_style());
274
+            $css = $this->get_style()->get_stylesheet();
275
+            $style = $css->create_style();
276
+            $style->inherit($this->get_style());
278 277
 
279
-          // Lookup styles for tr tags.  If the user wants styles to work
280
-          // better, they should make the tr explicit... I'm not going to
281
-          // try to guess what they intended.
282
-          if ( $tr_style = $css->lookup("tr") )
278
+            // Lookup styles for tr tags.  If the user wants styles to work
279
+            // better, they should make the tr explicit... I'm not going to
280
+            // try to guess what they intended.
281
+            if ( $tr_style = $css->lookup("tr") )
283 282
             $style->merge($tr_style);
284 283
 
285
-          // Okay, I have absolutely no idea why I need this clone here, but
286
-          // if it's omitted, php (as of 2004-07-28) segfaults.
287
-          $frame->set_style(clone $style);
288
-          $table_row = Frame_Factory::decorate_frame($frame, $this->_dompdf);
289
-          $table_row->set_root($this->_root);
284
+            // Okay, I have absolutely no idea why I need this clone here, but
285
+            // if it's omitted, php (as of 2004-07-28) segfaults.
286
+            $frame->set_style(clone $style);
287
+            $table_row = Frame_Factory::decorate_frame($frame, $this->_dompdf);
288
+            $table_row->set_root($this->_root);
290 289
 
291
-          // Add the cell to the row
292
-          $table_row->append_child($child);
290
+            // Add the cell to the row
291
+            $table_row->append_child($child);
293 292
 
294
-          $anon_row = true;
295
-          continue;
293
+            $anon_row = true;
294
+            continue;
296 295
         }
297 296
 
298 297
         if ( !in_array($display, self::$VALID_CHILDREN) ) {
299
-          $erroneous_frames[] = $child;
300
-          continue;
298
+            $erroneous_frames[] = $child;
299
+            continue;
301 300
         }
302 301
 
303 302
         // Normalise other table parts (i.e. row groups)
304 303
         foreach ($child->get_children() as $grandchild) {
305
-          if ( $grandchild->get_style()->display === "table-row" )
304
+            if ( $grandchild->get_style()->display === "table-row" )
306 305
             $grandchild->normalise();
307 306
         }
308 307
 
309 308
         // Add headers and footers
310 309
         if ( $display === "table-header-group" )
311
-          $this->_headers[] = $child;
310
+            $this->_headers[] = $child;
312 311
 
313 312
         else if ( $display === "table-footer-group" )
314
-          $this->_footers[] = $child;
315
-      }
313
+            $this->_footers[] = $child;
314
+        }
316 315
     }
317 316
 
318 317
     if ( $anon_row ) {
319
-      // Add the row to the table
320
-      $this->_frame->append_child($table_row);
321
-      $table_row->normalise();
322
-      $this->_cellmap->add_row();
318
+        // Add the row to the table
319
+        $this->_frame->append_child($table_row);
320
+        $table_row->normalise();
321
+        $this->_cellmap->add_row();
323 322
     }
324 323
 
325 324
     foreach ($erroneous_frames as $frame)
326
-      $this->move_after($frame);
325
+        $this->move_after($frame);
327 326
 
328
-  }
327
+    }
329 328
 
330
-  //........................................................................
329
+    //........................................................................
331 330
 
332
-  /**
333
-   * Moves the specified frame and it's corresponding node outside of
334
-   * the table.
335
-   *
336
-   * @param Frame $frame the frame to move
337
-   */
338
-  function move_after(Frame $frame) {
331
+    /**
332
+     * Moves the specified frame and it's corresponding node outside of
333
+     * the table.
334
+     *
335
+     * @param Frame $frame the frame to move
336
+     */
337
+    function move_after(Frame $frame) {
339 338
     $this->get_parent()->insert_child_after($frame, $this);
340
-  }
339
+    }
341 340
 
342 341
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/null_frame_decorator.cls.php 1 patch
Indentation   +2 added lines, -3 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: null_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,13 +46,13 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Null_Frame_Decorator extends Frame_Decorator {
49 48
 
50
-  function __construct(Frame $frame, DOMPDF $dompdf) {
49
+    function __construct(Frame $frame, DOMPDF $dompdf) {
51 50
     parent::__construct($frame, $dompdf);
52 51
     $style = $this->_frame->get_style();
53 52
     $style->width = 0;
54 53
     $style->height = 0;
55 54
     $style->margin = 0;
56 55
     $style->padding = 0;
57
-  }
56
+    }
58 57
 
59 58
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/abstract_renderer.cls.php 1 patch
Indentation   +271 added lines, -271 removed lines patch added patch discarded remove patch
@@ -60,57 +60,57 @@  discard block
 block discarded – undo
60 60
  */
61 61
 abstract class Abstract_Renderer {
62 62
 
63
-  /**
64
-   * Rendering backend
65
-   *
66
-   * @var Canvas
67
-   */
68
-  protected $_canvas;
69
-
70
-  /**
71
-   * Current dompdf instance
72
-   *
73
-   * @var DOMPDF
74
-   */
75
-  protected $_dompdf;
63
+    /**
64
+     * Rendering backend
65
+     *
66
+     * @var Canvas
67
+     */
68
+    protected $_canvas;
69
+
70
+    /**
71
+     * Current dompdf instance
72
+     *
73
+     * @var DOMPDF
74
+     */
75
+    protected $_dompdf;
76 76
   
77
-  /**
78
-   * Class constructor
79
-   *
80
-   * @param DOMPDF $dompdf The current dompdf instance
81
-   */
82
-  function __construct(DOMPDF $dompdf) {
77
+    /**
78
+     * Class constructor
79
+     *
80
+     * @param DOMPDF $dompdf The current dompdf instance
81
+     */
82
+    function __construct(DOMPDF $dompdf) {
83 83
     $this->_dompdf = $dompdf;
84 84
     $this->_canvas = $dompdf->get_canvas();
85
-  }
85
+    }
86 86
   
87
-  /**
88
-   * Render a frame.
89
-   *
90
-   * Specialized in child classes
91
-   *
92
-   * @param Frame $frame The frame to render
93
-   */
94
-  abstract function render(Frame $frame);
95
-
96
-  //........................................................................
97
-
98
-  /**
99
-   * Render a background image over a rectangular area
100
-   *
101
-   * @param string $img      The background image to load
102
-   * @param float  $x        The left edge of the rectangular area
103
-   * @param float  $y        The top edge of the rectangular area
104
-   * @param float  $width    The width of the rectangular area
105
-   * @param float  $height   The height of the rectangular area
106
-   * @param Style  $style    The associated Style object
107
-   */
108
-  protected function _background_image($url, $x, $y, $width, $height, $style) {
87
+    /**
88
+     * Render a frame.
89
+     *
90
+     * Specialized in child classes
91
+     *
92
+     * @param Frame $frame The frame to render
93
+     */
94
+    abstract function render(Frame $frame);
95
+
96
+    //........................................................................
97
+
98
+    /**
99
+     * Render a background image over a rectangular area
100
+     *
101
+     * @param string $img      The background image to load
102
+     * @param float  $x        The left edge of the rectangular area
103
+     * @param float  $y        The top edge of the rectangular area
104
+     * @param float  $width    The width of the rectangular area
105
+     * @param float  $height   The height of the rectangular area
106
+     * @param Style  $style    The associated Style object
107
+     */
108
+    protected function _background_image($url, $x, $y, $width, $height, $style) {
109 109
     $sheet = $style->get_stylesheet();
110 110
 
111 111
     // Skip degenerate cases
112 112
     if ( $width == 0 || $height == 0 )
113
-      return;
113
+        return;
114 114
 
115 115
     //debugpng
116 116
     if (DEBUGPNG) print '[_background_image '.$url.']';
@@ -122,24 +122,24 @@  discard block
 block discarded – undo
122 122
 
123 123
     // Bail if the image is no good
124 124
     if ( $img === DOMPDF_LIB_DIR . "/res/broken_image.png" )
125
-      return;
125
+        return;
126 126
 
127
-	//Try to optimize away reading and composing of same background multiple times
128
-	//Postponing read with imagecreatefrom   ...()
129
-	//final composition paramters and name not known yet
130
-	//Therefore read dimension directly from file, instead of creating gd object first.
127
+    //Try to optimize away reading and composing of same background multiple times
128
+    //Postponing read with imagecreatefrom   ...()
129
+    //final composition paramters and name not known yet
130
+    //Therefore read dimension directly from file, instead of creating gd object first.
131 131
     //$img_w = imagesx($src); $img_h = imagesy($src);
132 132
 
133 133
     list($img_w, $img_h) = getimagesize($img);
134 134
     if (!isset($img_w) || $img_w == 0 || !isset($img_h) || $img_h == 0) {
135
-      return;
135
+        return;
136 136
     }
137 137
 
138 138
     $repeat = $style->background_repeat;
139 139
     $bg_color = $style->background_color;
140 140
 
141
-	//Increase background resolution and dependent box size according to image resolution to be placed in
142
-	//Then image can be copied in without resize
141
+    //Increase background resolution and dependent box size according to image resolution to be placed in
142
+    //Then image can be copied in without resize
143 143
     $bg_width = round((float)($width * DOMPDF_DPI) / 72);
144 144
     $bg_height = round((float)($height * DOMPDF_DPI) / 72);
145 145
 
@@ -148,27 +148,27 @@  discard block
 block discarded – undo
148 148
     list($bg_x, $bg_y) = $style->background_position;
149 149
 
150 150
     if ( is_percent($bg_x) ) {
151
-      // The point $bg_x % from the left edge of the image is placed
152
-      // $bg_x % from the left edge of the background rectangle
153
-      $p = ((float)$bg_x)/100.0;
154
-      $x1 = $p * $img_w;
155
-      $x2 = $p * $bg_width;
151
+        // The point $bg_x % from the left edge of the image is placed
152
+        // $bg_x % from the left edge of the background rectangle
153
+        $p = ((float)$bg_x)/100.0;
154
+        $x1 = $p * $img_w;
155
+        $x2 = $p * $bg_width;
156 156
 
157
-      $bg_x = round($x2 - $x1);
157
+        $bg_x = round($x2 - $x1);
158 158
     } else {
159
-      $bg_x = round((float)($style->length_in_pt($bg_x)*DOMPDF_DPI) / 72);
159
+        $bg_x = round((float)($style->length_in_pt($bg_x)*DOMPDF_DPI) / 72);
160 160
     }
161 161
 
162 162
     if ( is_percent($bg_y) ) {
163
-      // The point $bg_y % from the left edge of the image is placed
164
-      // $bg_y % from the left edge of the background rectangle
165
-      $p = ((float)$bg_y)/100.0;
166
-      $y1 = $p * $img_h;
167
-      $y2 = $p * $bg_height;
163
+        // The point $bg_y % from the left edge of the image is placed
164
+        // $bg_y % from the left edge of the background rectangle
165
+        $p = ((float)$bg_y)/100.0;
166
+        $y1 = $p * $img_h;
167
+        $y2 = $p * $bg_height;
168 168
 
169
-      $bg_y = round($y2 - $y1);
169
+        $bg_y = round($y2 - $y1);
170 170
     } else {
171
-      $bg_y = round((float)($style->length_in_pt($bg_y)*DOMPDF_DPI) / 72);
171
+        $bg_y = round((float)($style->length_in_pt($bg_y)*DOMPDF_DPI) / 72);
172 172
     }
173 173
 
174 174
     //clip background to the image area on partial repeat. Nothing to do if img off area
@@ -177,79 +177,79 @@  discard block
 block discarded – undo
177 177
     //Handle x/y Dimensions separately
178 178
 
179 179
     if ( $repeat !== "repeat" && $repeat !== "repeat-x" ) {
180
-      //No repeat x
181
-      if ($bg_x < 0) {
180
+        //No repeat x
181
+        if ($bg_x < 0) {
182 182
         $bg_width = $img_w + $bg_x;
183
-      } else {
183
+        } else {
184 184
         $x += ($bg_x * 72)/DOMPDF_DPI;
185 185
         $bg_width = $bg_width - $bg_x;
186 186
         if ($bg_width > $img_w) {
187
-          $bg_width = $img_w;
187
+            $bg_width = $img_w;
188 188
         }
189 189
         $bg_x = 0;
190
-      }
191
-      if ($bg_width <= 0) {
192
-      	return;
193
-      }
194
-      $width = (float)($bg_width * 72)/DOMPDF_DPI;
190
+        }
191
+        if ($bg_width <= 0) {
192
+            return;
193
+        }
194
+        $width = (float)($bg_width * 72)/DOMPDF_DPI;
195 195
     } else {
196
-      //repeat x
197
-      if ($bg_x < 0) {
196
+        //repeat x
197
+        if ($bg_x < 0) {
198 198
         $bg_x = - ((-$bg_x) % $img_w);
199
-      } else {
199
+        } else {
200 200
         $bg_x = $bg_x % $img_w;
201 201
         if ($bg_x > 0) {
202
-          $bg_x -= $img_w;
202
+            $bg_x -= $img_w;
203
+        }
203 204
         }
204
-      }
205 205
     }
206 206
 
207 207
     if ( $repeat !== "repeat" && $repeat !== "repeat-y" ) {
208
-      //no repeat y
209
-      if ($bg_y < 0) {
208
+        //no repeat y
209
+        if ($bg_y < 0) {
210 210
         $bg_height = $img_h + $bg_y;
211
-      } else {
211
+        } else {
212 212
         $y += ($bg_y * 72)/DOMPDF_DPI;
213 213
         $bg_height = $bg_height - $bg_y;
214 214
         if ($bg_height > $img_h) {
215
-          $bg_height = $img_h;
215
+            $bg_height = $img_h;
216 216
         }
217 217
         $bg_y = 0;
218
-      }
219
-      if ($bg_height <= 0) {
220
-      	return;
221
-      }
222
-      $height = (float)($bg_height * 72)/DOMPDF_DPI;
218
+        }
219
+        if ($bg_height <= 0) {
220
+            return;
221
+        }
222
+        $height = (float)($bg_height * 72)/DOMPDF_DPI;
223 223
     } else {
224
-      //repeat y
225
-      if ($bg_y < 0) {
224
+        //repeat y
225
+        if ($bg_y < 0) {
226 226
         $bg_y = - ((-$bg_y) % $img_h);
227
-      } else {
227
+        } else {
228 228
         $bg_y = $bg_y % $img_h;
229 229
         if ($bg_y > 0) {
230
-          $bg_y -= $img_h;
230
+            $bg_y -= $img_h;
231
+        }
231 232
         }
232
-      }
233 233
     }
234 234
 
235 235
     //Optimization, if repeat has no effect
236 236
     if ( $repeat === "repeat" && $bg_y <= 0 && $img_h+$bg_y >= $bg_height ) {
237
-      $repeat = "repeat-x";
237
+        $repeat = "repeat-x";
238 238
     }
239 239
     if ( $repeat === "repeat" && $bg_x <= 0 && $img_w+$bg_x >= $bg_width ) {
240
-      $repeat = "repeat-y";
240
+        $repeat = "repeat-y";
241 241
     }
242 242
     if ( ($repeat === "repeat-x" && $bg_x <= 0 && $img_w+$bg_x >= $bg_width) ||
243 243
          ($repeat === "repeat-y" && $bg_y <= 0 && $img_h+$bg_y >= $bg_height) ) {
244
-      $repeat = "no-repeat";
244
+        $repeat = "no-repeat";
245 245
     }
246 246
 
247
-	//Use filename as indicator only
248
-	//different names for different variants to have different copies in the pdf
249
-	//This is not dependent of background color of box! .'_'.(is_array($bg_color) ? $bg_color["hex"] : $bg_color)
250
-	//Note: Here, bg_* are the start values, not end values after going through the tile loops!
247
+    //Use filename as indicator only
248
+    //different names for different variants to have different copies in the pdf
249
+    //This is not dependent of background color of box! .'_'.(is_array($bg_color) ? $bg_color["hex"] : $bg_color)
250
+    //Note: Here, bg_* are the start values, not end values after going through the tile loops!
251 251
 
252
-	$filedummy = $img;
252
+    $filedummy = $img;
253 253
 
254 254
     /* 
255 255
     //Make shorter strings with limited characters for cache associative array index - needed?	
@@ -274,50 +274,50 @@  discard block
 block discarded – undo
274 274
 	}
275 275
 	*/
276 276
 	
277
-	$filedummy .= '_'.$bg_width.'_'.$bg_height.'_'.$bg_x.'_'.$bg_y.'_'.$repeat;
277
+    $filedummy .= '_'.$bg_width.'_'.$bg_height.'_'.$bg_x.'_'.$bg_y.'_'.$repeat;
278 278
     //debugpng
279 279
     //if (DEBUGPNG) print '<pre>[_background_image name '.$filedummy.']</pre>';
280 280
 
281 281
     //Optimization to avoid multiple times rendering the same image.
282 282
     //If check functions are existing and identical image already cached,
283 283
     //then skip creation of duplicate, because it is not needed by addImagePng
284
-	if ( method_exists( $this->_canvas, "get_cpdf" ) &&
285
-	     method_exists( $this->_canvas->get_cpdf(), "addImagePng" ) &&
286
-	     method_exists( $this->_canvas->get_cpdf(), "image_iscached" ) &&
287
-	     $this->_canvas->get_cpdf()->image_iscached($filedummy) ) {
288
-	  $bg = null;
284
+    if ( method_exists( $this->_canvas, "get_cpdf" ) &&
285
+         method_exists( $this->_canvas->get_cpdf(), "addImagePng" ) &&
286
+         method_exists( $this->_canvas->get_cpdf(), "image_iscached" ) &&
287
+         $this->_canvas->get_cpdf()->image_iscached($filedummy) ) {
288
+        $bg = null;
289 289
 
290
-      //debugpng
291
-      //if (DEBUGPNG) print '[_background_image skip]';
290
+        //debugpng
291
+        //if (DEBUGPNG) print '[_background_image skip]';
292 292
 
293
-	} else {
293
+    } else {
294 294
 
295 295
     // Create a new image to fit over the background rectangle
296 296
     $bg = imagecreatetruecolor($bg_width, $bg_height);
297 297
     //anyway default
298
-	//imagealphablending($img, true);
298
+    //imagealphablending($img, true);
299 299
 
300 300
     switch (strtolower($ext)) {
301 301
 
302 302
     case "png":
303 303
       $src = imagecreatefrompng($img);
304
-      break;
304
+        break;
305 305
 
306 306
     case "jpg":
307 307
     case "jpeg":
308 308
       $src = imagecreatefromjpeg($img);
309
-      break;
309
+        break;
310 310
 
311 311
     case "gif":
312 312
       $src = imagecreatefromgif($img);
313
-      break;
313
+        break;
314 314
 
315 315
     default:
316 316
       return; // Unsupported image type
317 317
     }
318 318
 
319 319
     if ($src == null) {
320
-      return;
320
+        return;
321 321
     }
322 322
 
323 323
     //Background color if box is not relevant here
@@ -325,34 +325,34 @@  discard block
 block discarded – undo
325 325
     //Transparent image: The image controls the transparency and lets shine through whatever background.
326 326
     //However on transparent imaage preset the composed image with the transparency color,
327 327
     //to keep the transparency when copying over the non transparent parts of the tiles.
328
-	$ti = imagecolortransparent($src);
329
-	if ($ti >= 0) {
330
-	  $tc = imagecolorsforindex($src,$ti);
331
-      $ti = imagecolorallocate($bg,$tc['red'],$tc['green'],$tc['blue']);
332
-      imagefill($bg,0,0,$ti);
333
-      imagecolortransparent($bg, $ti);
328
+    $ti = imagecolortransparent($src);
329
+    if ($ti >= 0) {
330
+        $tc = imagecolorsforindex($src,$ti);
331
+        $ti = imagecolorallocate($bg,$tc['red'],$tc['green'],$tc['blue']);
332
+        imagefill($bg,0,0,$ti);
333
+        imagecolortransparent($bg, $ti);
334 334
     }
335 335
 
336 336
     //This has only an effect for the non repeatable dimension.
337 337
     //compute start of src and dest coordinates of the single copy
338 338
     if ( $bg_x < 0 ) {
339
-      $dst_x = 0;
340
-      $src_x = -$bg_x;
339
+        $dst_x = 0;
340
+        $src_x = -$bg_x;
341 341
     } else {
342
-      $src_x = 0;
343
-      $dst_x = $bg_x;
342
+        $src_x = 0;
343
+        $dst_x = $bg_x;
344 344
     }
345 345
 
346 346
     if ( $bg_y < 0 ) {
347
-      $dst_y = 0;
348
-      $src_y = -$bg_y;
347
+        $dst_y = 0;
348
+        $src_y = -$bg_y;
349 349
     } else {
350
-      $src_y = 0;
351
-      $dst_y = $bg_y;
350
+        $src_y = 0;
351
+        $dst_y = $bg_y;
352 352
     }
353 353
 
354
-	//For historical reasons exchange meanings of variables:
355
-	//start_* will be the start values, while bg_* will be the temporary start values in the loops
354
+    //For historical reasons exchange meanings of variables:
355
+    //start_* will be the start values, while bg_* will be the temporary start values in the loops
356 356
     $start_x = $bg_x;
357 357
     $start_y = $bg_y;
358 358
 
@@ -360,117 +360,117 @@  discard block
 block discarded – undo
360 360
 
361 361
     if ( $repeat === "no-repeat" ) {
362 362
 
363
-      // Simply place the image on the background
364
-      imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $img_w, $img_h);
363
+        // Simply place the image on the background
364
+        imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $img_w, $img_h);
365 365
 
366 366
     } else if ( $repeat === "repeat-x" ) {
367 367
 
368
-      for ( $bg_x = $start_x; $bg_x < $bg_width; $bg_x += $img_w ) {
368
+        for ( $bg_x = $start_x; $bg_x < $bg_width; $bg_x += $img_w ) {
369 369
         if ( $bg_x < 0 ) {
370
-          $dst_x = 0;
371
-          $src_x = -$bg_x;
372
-          $w = $img_w + $bg_x;
370
+            $dst_x = 0;
371
+            $src_x = -$bg_x;
372
+            $w = $img_w + $bg_x;
373 373
         } else {
374
-          $dst_x = $bg_x;
375
-          $src_x = 0;
376
-          $w = $img_w;
374
+            $dst_x = $bg_x;
375
+            $src_x = 0;
376
+            $w = $img_w;
377 377
         }
378 378
         imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $w, $img_h);
379
-      }
379
+        }
380 380
 
381 381
     } else if ( $repeat === "repeat-y" ) {
382 382
 
383
-      for ( $bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h ) {
383
+        for ( $bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h ) {
384 384
         if ( $bg_y < 0 ) {
385
-          $dst_y = 0;
386
-          $src_y = -$bg_y;
387
-          $h = $img_h + $bg_y;
385
+            $dst_y = 0;
386
+            $src_y = -$bg_y;
387
+            $h = $img_h + $bg_y;
388 388
         } else {
389
-          $dst_y = $bg_y;
390
-          $src_y = 0;
391
-          $h = $img_h;
389
+            $dst_y = $bg_y;
390
+            $src_y = 0;
391
+            $h = $img_h;
392 392
         }
393 393
         imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $img_w, $h);
394 394
 
395
-      }
395
+        }
396 396
 
397 397
     } else if ( $repeat === "repeat" ) {
398 398
 
399
-      for ( $bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h ) {
399
+        for ( $bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h ) {
400 400
         for ( $bg_x = $start_x; $bg_x < $bg_width; $bg_x += $img_w ) {
401 401
 
402
-          if ( $bg_x < 0 ) {
402
+            if ( $bg_x < 0 ) {
403 403
             $dst_x = 0;
404 404
             $src_x = -$bg_x;
405 405
             $w = $img_w + $bg_x;
406
-          } else {
406
+            } else {
407 407
             $dst_x = $bg_x;
408 408
             $src_x = 0;
409 409
             $w = $img_w;
410
-          }
410
+            }
411 411
 
412
-          if ( $bg_y < 0 ) {
412
+            if ( $bg_y < 0 ) {
413 413
             $dst_y = 0;
414 414
             $src_y = -$bg_y;
415 415
             $h = $img_h + $bg_y;
416
-          } else {
416
+            } else {
417 417
             $dst_y = $bg_y;
418 418
             $src_y = 0;
419 419
             $h = $img_h;
420
-          }
421
-          imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $w, $h);
420
+            }
421
+            imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $w, $h);
422
+        }
422 423
         }
423
-      }
424 424
     } else {
425
- print 'Unknown repeat!';
425
+    print 'Unknown repeat!';
426 426
     }   
427 427
 
428 428
     } /* End optimize away creation of duplicates */
429 429
 
430 430
     //img: image url string
431
-	//img_w, img_h: original image size in px
432
-	//width, height: box size in pt
433
-	//bg_width, bg_height: box size in px
434
-	//x, y: left/top edge of box on page in pt
435
-	//start_x, start_y: placement of image relativ to pattern
436
-	//$repeat: repeat mode
437
-	//$bg: GD object of result image
438
-	//$src: GD object of original image
431
+    //img_w, img_h: original image size in px
432
+    //width, height: box size in pt
433
+    //bg_width, bg_height: box size in px
434
+    //x, y: left/top edge of box on page in pt
435
+    //start_x, start_y: placement of image relativ to pattern
436
+    //$repeat: repeat mode
437
+    //$bg: GD object of result image
438
+    //$src: GD object of original image
439 439
     //When using cpdf and optimization to direct png creation from gd object is available,
440 440
     //don't create temp file, but place gd object directly into the pdf
441
-	if ( method_exists( $this->_canvas, "get_cpdf" ) && method_exists( $this->_canvas->get_cpdf(), "addImagePng" ) ) {
442
-      //Note: CPDF_Adapter image converts y position
443
-	  $this->_canvas->get_cpdf()->addImagePng(
444
-	  		$filedummy,
445
-			$x, $this->_canvas->get_height() - $y - $height, $width, $height, $bg);
446
-	} else {
447
-      $tmp_file = tempnam(DOMPDF_TEMP_DIR, "bg_dompdf_img_").'.png';
448
-      //debugpng
449
-      if (DEBUGPNG) print '[_background_image '.$tmp_file.']';
441
+    if ( method_exists( $this->_canvas, "get_cpdf" ) && method_exists( $this->_canvas->get_cpdf(), "addImagePng" ) ) {
442
+        //Note: CPDF_Adapter image converts y position
443
+        $this->_canvas->get_cpdf()->addImagePng(
444
+                $filedummy,
445
+            $x, $this->_canvas->get_height() - $y - $height, $width, $height, $bg);
446
+    } else {
447
+        $tmp_file = tempnam(DOMPDF_TEMP_DIR, "bg_dompdf_img_").'.png';
448
+        //debugpng
449
+        if (DEBUGPNG) print '[_background_image '.$tmp_file.']';
450 450
 
451
-      imagepng($bg, $tmp_file);
452
-      $this->_canvas->image($tmp_file, "png", $x, $y, $width, $height);
451
+        imagepng($bg, $tmp_file);
452
+        $this->_canvas->image($tmp_file, "png", $x, $y, $width, $height);
453 453
 
454
-      //debugpng
455
-      if (DEBUGPNG) print '[_background_image unlink '.$tmp_file.']';
454
+        //debugpng
455
+        if (DEBUGPNG) print '[_background_image unlink '.$tmp_file.']';
456 456
 
457
-      if (!DEBUGKEEPTEMP)
457
+        if (!DEBUGKEEPTEMP)
458 458
         unlink($tmp_file);
459 459
     }
460
-  }
460
+    }
461 461
 
462
-  protected function _border_none($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
462
+    protected function _border_none($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
463 463
     return;
464
-  }
464
+    }
465 465
   
466
-  // Border rendering functions
467
-  protected function _border_dotted($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
466
+    // Border rendering functions
467
+    protected function _border_dotted($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
468 468
     list($top, $right, $bottom, $left) = $widths;
469 469
 
470 470
     if ( $$side < 2 )
471
-      $dash = array($$side, 2);
471
+        $dash = array($$side, 2);
472 472
     else
473
-      $dash = array($$side);
473
+        $dash = array($$side);
474 474
   
475 475
     
476 476
     switch ($side) {
@@ -479,24 +479,24 @@  discard block
 block discarded – undo
479 479
       $delta = $top / 2;
480 480
     case "bottom":
481 481
       $delta = isset($delta) ? $delta : -$bottom / 2;
482
-      $this->_canvas->line($x, $y + $delta, $x + $length, $y + $delta, $color, $$side, $dash);
483
-      break;
482
+        $this->_canvas->line($x, $y + $delta, $x + $length, $y + $delta, $color, $$side, $dash);
483
+        break;
484 484
 
485 485
     case "left":
486 486
       $delta = $left / 2;
487 487
     case "right":
488 488
       $delta = isset($delta) ? $delta : - $right / 2;
489
-      $this->_canvas->line($x + $delta, $y, $x + $delta, $y + $length, $color, $$side, $dash);
490
-      break;
489
+        $this->_canvas->line($x + $delta, $y, $x + $delta, $y + $length, $color, $$side, $dash);
490
+        break;
491 491
 
492 492
     default:
493 493
       return;
494 494
 
495 495
     }
496
-  }
496
+    }
497 497
 
498 498
   
499
-  protected function _border_dashed($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
499
+    protected function _border_dashed($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
500 500
     list($top, $right, $bottom, $left) = $widths;
501 501
 
502 502
     switch ($side) {
@@ -505,24 +505,24 @@  discard block
 block discarded – undo
505 505
       $delta = $top / 2;
506 506
     case "bottom":
507 507
       $delta = isset($delta) ? $delta : -$bottom / 2;
508
-      $this->_canvas->line($x, $y + $delta, $x + $length, $y + $delta, $color, $$side, array(3 * $$side));
509
-      break;
508
+        $this->_canvas->line($x, $y + $delta, $x + $length, $y + $delta, $color, $$side, array(3 * $$side));
509
+        break;
510 510
 
511 511
     case "left":
512 512
       $delta = $left / 2;
513 513
     case "right":
514 514
       $delta = isset($delta) ? $delta : - $right / 2;
515
-      $this->_canvas->line($x + $delta, $y, $x + $delta, $y + $length, $color, $$side, array(3 * $$side));
516
-      break;
515
+        $this->_canvas->line($x + $delta, $y, $x + $delta, $y + $length, $color, $$side, array(3 * $$side));
516
+        break;
517 517
 
518 518
     default:
519 519
       return;
520 520
     }
521 521
     
522
-  }
522
+    }
523 523
 
524 524
   
525
-  protected function _border_solid($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
525
+    protected function _border_solid($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
526 526
     list($top, $right, $bottom, $left) = $widths;
527 527
 
528 528
     // All this polygon business is for beveled corners...
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
                         $x + $length - $right, $y + $top,
537 537
                         $x + $left, $y + $top);
538 538
         $this->_canvas->polygon($points, $color, null, null, true);
539
-      } else
539
+        } else
540 540
         $this->_canvas->filled_rectangle($x, $y, $length, $top, $color);
541 541
       
542
-      break;
542
+        break;
543 543
       
544 544
     case "bottom":
545 545
       if ( $corner_style === "bevel" ) {
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
                         $x + $length - $right, $y - $bottom,
549 549
                         $x + $left, $y - $bottom);
550 550
         $this->_canvas->polygon($points, $color, null, null, true);
551
-      } else
551
+        } else
552 552
         $this->_canvas->filled_rectangle($x, $y - $bottom, $length, $bottom, $color);
553 553
       
554
-      break;
554
+        break;
555 555
       
556 556
     case "left":
557 557
       if ( $corner_style === "bevel" ) {
@@ -560,10 +560,10 @@  discard block
 block discarded – undo
560 560
                         $x + $left, $y + $length - $bottom,
561 561
                         $x + $left, $y + $top);
562 562
         $this->_canvas->polygon($points, $color, null, null, true);
563
-      } else
563
+        } else
564 564
         $this->_canvas->filled_rectangle($x, $y, $left, $length, $color);
565 565
       
566
-      break;
566
+        break;
567 567
       
568 568
     case "right":
569 569
       if ( $corner_style === "bevel" ) {
@@ -572,20 +572,20 @@  discard block
 block discarded – undo
572 572
                         $x - $right, $y + $length - $bottom,
573 573
                         $x - $right, $y + $top);
574 574
         $this->_canvas->polygon($points, $color, null, null, true);
575
-      } else
575
+        } else
576 576
         $this->_canvas->filled_rectangle($x - $right, $y, $right, $length, $color);
577 577
 
578
-      break;
578
+        break;
579 579
 
580 580
     default:
581 581
       return;
582 582
 
583 583
     }
584 584
         
585
-  }
585
+    }
586 586
 
587 587
 
588
-  protected function _border_double($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
588
+    protected function _border_double($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
589 589
     list($top, $right, $bottom, $left) = $widths;
590 590
     
591 591
     $line_width = $$side / 4;
@@ -612,12 +612,12 @@  discard block
 block discarded – undo
612 612
                         $x + $left, $y + $top);
613 613
         $this->_canvas->polygon($points, $color, null, null, true);
614 614
 
615
-      } else {
615
+        } else {
616 616
         $this->_canvas->filled_rectangle($x, $y, $length, $line_width, $color);
617 617
         $this->_canvas->filled_rectangle($x, $y + $top - $line_width, $length, $line_width, $color);
618 618
 
619
-      }
620
-      break;
619
+        }
620
+        break;
621 621
       
622 622
     case "bottom":
623 623
       if ( $corner_style === "bevel" ) {
@@ -636,12 +636,12 @@  discard block
 block discarded – undo
636 636
                         $x + $left, $y - $bottom);
637 637
         $this->_canvas->polygon($points, $color, null, null, true);
638 638
 
639
-      } else {
639
+        } else {
640 640
         $this->_canvas->filled_rectangle($x, $y - $line_width, $length, $line_width, $color);
641 641
         $this->_canvas->filled_rectangle($x, $y - $bottom, $length, $line_width, $color);
642
-      }
642
+        }
643 643
           
644
-      break;
644
+        break;
645 645
 
646 646
     case "left":
647 647
       if ( $corner_style === "bevel" ) {
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
                         $x + $left, $y + $top);
661 661
         $this->_canvas->polygon($points, $color, null, null, true);
662 662
 
663
-      } else {
663
+        } else {
664 664
         $this->_canvas->filled_rectangle($x, $y, $line_width, $length, $color);
665 665
         $this->_canvas->filled_rectangle($x + $left - $line_width, $y, $line_width, $length, $color);
666
-      }
666
+        }
667 667
       
668
-      break;
668
+        break;
669 669
                       
670 670
     case "right":
671 671
       if ( $corner_style === "bevel" ) {
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
         
675 675
       
676 676
         $points = array($x, $y,
677
-                      $x, $y + $length,
677
+                        $x, $y + $length,
678 678
                         $x - $line_width, $y + $length - $bottom_line_width,
679 679
                         $x - $line_width, $y + $top_line_width);
680 680
         $this->_canvas->polygon($points, $color, null, null, true);
@@ -685,21 +685,21 @@  discard block
 block discarded – undo
685 685
                         $x - $right, $y + $top);
686 686
         $this->_canvas->polygon($points, $color, null, null, true);
687 687
 
688
-      } else {
688
+        } else {
689 689
         $this->_canvas->filled_rectangle($x - $line_width, $y, $line_width, $length, $color);
690 690
         $this->_canvas->filled_rectangle($x - $right, $y, $line_width, $length, $color);
691
-      }
691
+        }
692 692
       
693
-      break;
693
+        break;
694 694
 
695 695
     default:
696 696
       return;
697 697
 
698 698
     }
699 699
         
700
-  }
700
+    }
701 701
 
702
-  protected function _border_groove($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
702
+    protected function _border_groove($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
703 703
     list($top, $right, $bottom, $left) = $widths;
704 704
       
705 705
     $half_widths = array($top / 2, $right / 2, $bottom / 2, $left / 2);
@@ -710,27 +710,27 @@  discard block
 block discarded – undo
710 710
 
711 711
     case "top":
712 712
       $x += $left / 2;
713
-      $y += $top / 2;
714
-      $length -= $left / 2 + $right / 2;
715
-      break;
713
+        $y += $top / 2;
714
+        $length -= $left / 2 + $right / 2;
715
+        break;
716 716
 
717 717
     case "bottom":
718 718
       $x += $left / 2;
719
-      $y -= $bottom / 2;
720
-      $length -= $left / 2 + $right / 2;
721
-      break;
719
+        $y -= $bottom / 2;
720
+        $length -= $left / 2 + $right / 2;
721
+        break;
722 722
 
723 723
     case "left":
724 724
       $x += $left / 2;
725
-      $y += $top / 2;
726
-      $length -= $top / 2 + $bottom / 2;
727
-      break;
725
+        $y += $top / 2;
726
+        $length -= $top / 2 + $bottom / 2;
727
+        break;
728 728
 
729 729
     case "right":
730 730
       $x -= $right / 2;
731
-      $y += $top / 2;
732
-      $length -= $top / 2 + $bottom / 2;
733
-      break;
731
+        $y += $top / 2;
732
+        $length -= $top / 2 + $bottom / 2;
733
+        break;
734 734
 
735 735
     default:
736 736
       return;
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 
740 740
     $this->_border_outset($x, $y, $length, $color, $half_widths, $side);
741 741
     
742
-  }
742
+    }
743 743
   
744
-  protected function _border_ridge($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
744
+    protected function _border_ridge($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
745 745
     list($top, $right, $bottom, $left) = $widths;
746 746
      
747 747
     $half_widths = array($top / 2, $right / 2, $bottom / 2, $left / 2);
@@ -752,27 +752,27 @@  discard block
 block discarded – undo
752 752
 
753 753
     case "top":
754 754
       $x += $left / 2;
755
-      $y += $top / 2;
756
-      $length -= $left / 2 + $right / 2;
757
-      break;
755
+        $y += $top / 2;
756
+        $length -= $left / 2 + $right / 2;
757
+        break;
758 758
 
759 759
     case "bottom":
760 760
       $x += $left / 2;
761
-      $y -= $bottom / 2;
762
-      $length -= $left / 2 + $right / 2;
763
-      break;
761
+        $y -= $bottom / 2;
762
+        $length -= $left / 2 + $right / 2;
763
+        break;
764 764
 
765 765
     case "left":
766 766
       $x += $left / 2;
767
-      $y += $top / 2;
768
-      $length -= $top / 2 + $bottom / 2;
769
-      break;
767
+        $y += $top / 2;
768
+        $length -= $top / 2 + $bottom / 2;
769
+        break;
770 770
 
771 771
     case "right":
772 772
       $x -= $right / 2;
773
-      $y += $top / 2;
774
-      $length -= $top / 2 + $bottom / 2;
775
-      break;
773
+        $y += $top / 2;
774
+        $length -= $top / 2 + $bottom / 2;
775
+        break;
776 776
 
777 777
     default:
778 778
       return;
@@ -781,23 +781,23 @@  discard block
 block discarded – undo
781 781
 
782 782
     $this->_border_inset($x, $y, $length, $color, $half_widths, $side);
783 783
 
784
-  }
784
+    }
785 785
 
786
-  protected function _tint($c) {
786
+    protected function _tint($c) {
787 787
     if ( !is_numeric($c) )
788
-      return $c;
788
+        return $c;
789 789
     
790 790
     return min(1, $c + 0.66);
791
-  }
791
+    }
792 792
 
793
-  protected function _shade($c) {
793
+    protected function _shade($c) {
794 794
     if ( !is_numeric($c) )
795
-      return $c;
795
+        return $c;
796 796
     
797 797
     return max(0, $c - 0.66);
798
-  }
798
+    }
799 799
 
800
-  protected function _border_inset($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
800
+    protected function _border_inset($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
801 801
     list($top, $right, $bottom, $left) = $widths;
802 802
     
803 803
     switch ($side) {
@@ -805,43 +805,43 @@  discard block
 block discarded – undo
805 805
     case "top":
806 806
     case "left":
807 807
       $shade = array_map(array($this, "_shade"), $color);
808
-      $this->_border_solid($x, $y, $length, $shade, $widths, $side);
809
-      break;
808
+        $this->_border_solid($x, $y, $length, $shade, $widths, $side);
809
+        break;
810 810
 
811 811
     case "bottom":
812 812
     case "right":
813 813
       $tint = array_map(array($this, "_tint"), $color);
814
-      $this->_border_solid($x, $y, $length, $tint, $widths, $side);
815
-      break;
814
+        $this->_border_solid($x, $y, $length, $tint, $widths, $side);
815
+        break;
816 816
 
817 817
     default:
818 818
       return;
819 819
     }
820
-  }
820
+    }
821 821
   
822
-  protected function _border_outset($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
822
+    protected function _border_outset($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") {
823 823
     list($top, $right, $bottom, $left) = $widths;
824 824
     
825 825
     switch ($side) {
826 826
     case "top":
827 827
     case "left":
828 828
       $tint = array_map(array($this, "_tint"), $color);
829
-      $this->_border_solid($x, $y, $length, $tint, $widths, $side);
830
-      break;
829
+        $this->_border_solid($x, $y, $length, $tint, $widths, $side);
830
+        break;
831 831
 
832 832
     case "bottom":
833 833
     case "right":
834 834
       $shade = array_map(array($this, "_shade"), $color);
835
-      $this->_border_solid($x, $y, $length, $shade, $widths, $side);
836
-      break;
835
+        $this->_border_solid($x, $y, $length, $shade, $widths, $side);
836
+        break;
837 837
 
838 838
     default:
839 839
       return;
840 840
 
841 841
     }
842
-  }
842
+    }
843 843
 
844
-  //........................................................................
844
+    //........................................................................
845 845
   
846 846
 
847 847
 }
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.