@@ -81,22 +81,22 @@ discard block |
||
81 | 81 | $b = $style->length_in_pt($style->margin_bottom, $cb["w"]); |
82 | 82 | |
83 | 83 | // Handle 'auto' values |
84 | - if ( $t === "auto" ) { |
|
84 | + if ($t === "auto") { |
|
85 | 85 | $style->margin_top = "0pt"; |
86 | 86 | $t = 0; |
87 | 87 | } |
88 | 88 | |
89 | - if ( $b === "auto" ) { |
|
89 | + if ($b === "auto") { |
|
90 | 90 | $style->margin_bottom = "0pt"; |
91 | 91 | $b = 0; |
92 | 92 | } |
93 | 93 | |
94 | 94 | // Collapse vertical margins: |
95 | 95 | $n = $this->_frame->get_next_sibling(); |
96 | - while ( $n && !in_array($n->get_style()->display, Style::$BLOCK_TYPES) ) |
|
96 | + while ($n && !in_array($n->get_style()->display, Style::$BLOCK_TYPES)) |
|
97 | 97 | $n = $n->get_next_sibling(); |
98 | 98 | |
99 | - if ( $n ) { // && !$n instanceof Page_Frame_Decorator ) { |
|
99 | + if ($n) { // && !$n instanceof Page_Frame_Decorator ) { |
|
100 | 100 | |
101 | 101 | $b = max($b, $style->length_in_pt($n->get_style()->margin_top, $cb["w"])); |
102 | 102 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | |
108 | 108 | // Collapse our first child's margin |
109 | 109 | $f = $this->_frame->get_first_child(); |
110 | - while ( $f && !in_array($f->get_style()->display, Style::$BLOCK_TYPES) ) |
|
110 | + while ($f && !in_array($f->get_style()->display, Style::$BLOCK_TYPES)) |
|
111 | 111 | $f = $f->get_next_sibling(); |
112 | 112 | |
113 | - if ( $f ) { |
|
114 | - $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"])); |
|
113 | + if ($f) { |
|
114 | + $t = max($t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"])); |
|
115 | 115 | $style->margin_top = "$t pt"; |
116 | 116 | $f->get_style()->margin_top = "0 pt"; |
117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $y = $this->_frame->get_position("y"); |
124 | 124 | $h = $style->length_in_pt($style->height); |
125 | 125 | // Check if we need to move to a new page |
126 | - if ( $y + $h >= $this->_frame->get_root()->get_page_height() ) |
|
126 | + if ($y + $h >= $this->_frame->get_root()->get_page_height()) |
|
127 | 127 | return true; |
128 | 128 | |
129 | 129 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | // This provides a basic implementation. Child classes should override |
140 | 140 | // this if necessary. |
141 | 141 | function get_min_max_width() { |
142 | - if ( !is_null($this->_min_max_cache) ) { |
|
142 | + if (!is_null($this->_min_max_cache)) { |
|
143 | 143 | return $this->_min_max_cache; |
144 | 144 | } |
145 | 145 | |
@@ -157,27 +157,27 @@ discard block |
||
157 | 157 | $delta = $style->length_in_pt($dims, $cb_w); |
158 | 158 | |
159 | 159 | // Handle degenerate case |
160 | - if ( !$this->_frame->get_first_child() ) |
|
161 | - return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta); |
|
160 | + if (!$this->_frame->get_first_child()) |
|
161 | + return $this->_min_max_cache = array($delta, $delta, "min" => $delta, "max" => $delta); |
|
162 | 162 | |
163 | 163 | $low = array(); |
164 | 164 | $high = array(); |
165 | 165 | |
166 | - for ( $iter = $this->_frame->get_children()->getIterator(); |
|
166 | + for ($iter = $this->_frame->get_children()->getIterator(); |
|
167 | 167 | $iter->valid(); |
168 | - $iter->next() ) { |
|
168 | + $iter->next()) { |
|
169 | 169 | |
170 | 170 | $inline_min = 0; |
171 | 171 | $inline_max = 0; |
172 | 172 | |
173 | 173 | // Add all adjacent inline widths together to calculate max width |
174 | - while ( $iter->valid() && in_array( $iter->current()->get_style()->display, Style::$INLINE_TYPES ) ) { |
|
174 | + while ($iter->valid() && in_array($iter->current()->get_style()->display, Style::$INLINE_TYPES)) { |
|
175 | 175 | |
176 | 176 | $child = $iter->current(); |
177 | 177 | |
178 | 178 | $minmax = $child->get_min_max_width(); |
179 | 179 | |
180 | - if ( in_array( $iter->current()->get_style()->white_space, array("pre", "nowrap") ) ) |
|
180 | + if (in_array($iter->current()->get_style()->white_space, array("pre", "nowrap"))) |
|
181 | 181 | $inline_min += $minmax["min"]; |
182 | 182 | else |
183 | 183 | $low[] = $minmax["min"]; |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | |
188 | 188 | } |
189 | 189 | |
190 | - if ( $inline_max > 0 ) |
|
190 | + if ($inline_max > 0) |
|
191 | 191 | $high[] = $inline_max; |
192 | 192 | |
193 | - if ( $inline_min > 0 ) |
|
193 | + if ($inline_min > 0) |
|
194 | 194 | $low[] = $inline_min; |
195 | 195 | |
196 | - if ( $iter->valid() ) { |
|
196 | + if ($iter->valid()) { |
|
197 | 197 | list($low[], $high[]) = $iter->current()->get_min_max_width(); |
198 | 198 | continue; |
199 | 199 | } |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | // Use specified width if it is greater than the minimum defined by the |
206 | 206 | // content. If the width is a percentage ignore it for now. |
207 | 207 | $width = $style->width; |
208 | - if ( $width !== "auto" && !is_percent($width) ) { |
|
208 | + if ($width !== "auto" && !is_percent($width)) { |
|
209 | 209 | $width = $style->length_in_pt($width, $cb_w); |
210 | - if ( $min < $width ) |
|
210 | + if ($min < $width) |
|
211 | 211 | $min = $width; |
212 | - if ( $max < $width ) |
|
212 | + if ($max < $width) |
|
213 | 213 | $max = $width; |
214 | 214 | } |
215 | 215 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $cb = $this->_frame->get_containing_block(); |
57 | 57 | $p = $this->_frame->get_prev_sibling(); |
58 | 58 | |
59 | - if ( $p ) |
|
59 | + if ($p) |
|
60 | 60 | $y = $p->get_position("y") + $p->get_margin_height(); |
61 | 61 | |
62 | 62 | else |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * @param float $h |
118 | 118 | */ |
119 | 119 | function set_containing_block($x = null, $y = null, $w = null, $h = null) { |
120 | - parent::set_containing_block($x,$y,$w,$h); |
|
120 | + parent::set_containing_block($x, $y, $w, $h); |
|
121 | 121 | $w = $this->get_containing_block("w"); |
122 | - if ( isset($h) ) |
|
122 | + if (isset($h)) |
|
123 | 123 | $this->_bottom_page_margin = $h; // - $this->_frame->get_style()->length_in_pt($this->_frame->get_style()->margin_bottom, $w); |
124 | 124 | } |
125 | 125 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | function check_forced_page_break(Frame $frame) { |
177 | 177 | |
178 | 178 | // Skip check if page is already split |
179 | - if ( $this->_page_full ) |
|
179 | + if ($this->_page_full) |
|
180 | 180 | return; |
181 | 181 | |
182 | 182 | $block_types = array("block", "list-item", "table"); |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | |
185 | 185 | $style = $frame->get_style(); |
186 | 186 | |
187 | - if ( !in_array($style->display, $block_types) ) |
|
187 | + if (!in_array($style->display, $block_types)) |
|
188 | 188 | return false; |
189 | 189 | |
190 | 190 | // Find the previous block-level sibling |
191 | 191 | $prev = $frame->get_prev_sibling(); |
192 | - while ( $prev && !in_array($prev->get_style()->display, $block_types) ) |
|
192 | + while ($prev && !in_array($prev->get_style()->display, $block_types)) |
|
193 | 193 | $prev = $prev->get_prev_sibling(); |
194 | 194 | |
195 | - if ( in_array($style->page_break_before, $page_breaks) ) { |
|
195 | + if (in_array($style->page_break_before, $page_breaks)) { |
|
196 | 196 | |
197 | 197 | // Prevent cascading splits |
198 | 198 | $frame->split(); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | return true; |
204 | 204 | } |
205 | 205 | |
206 | - if ( ($prev && in_array($prev->get_style()->page_break_after, $page_breaks)) ) { |
|
206 | + if (($prev && in_array($prev->get_style()->page_break_after, $page_breaks))) { |
|
207 | 207 | // Prevent cascading splits |
208 | 208 | $frame->split(); |
209 | 209 | $prev->get_style()->page_break_after = "auto"; |
@@ -270,32 +270,32 @@ discard block |
||
270 | 270 | */ |
271 | 271 | |
272 | 272 | $block_types = array("block", "list-item", "table"); |
273 | - dompdf_debug("page-break", "_page_break_allowed(" . $frame->get_node()->nodeName. ")"); |
|
273 | + dompdf_debug("page-break", "_page_break_allowed(".$frame->get_node()->nodeName.")"); |
|
274 | 274 | $display = $frame->get_style()->display; |
275 | 275 | |
276 | 276 | // Block Frames (1): |
277 | - if ( in_array($display, $block_types) ) { |
|
277 | + if (in_array($display, $block_types)) { |
|
278 | 278 | |
279 | 279 | // Avoid breaks within table-cells |
280 | - if ( $this->_in_table ) { |
|
281 | - dompdf_debug("page-break", "In table: " . $this->_in_table); |
|
280 | + if ($this->_in_table) { |
|
281 | + dompdf_debug("page-break", "In table: ".$this->_in_table); |
|
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | |
285 | 285 | // Rules A & B |
286 | 286 | |
287 | - if ( $frame->get_style()->page_break_before === "avoid" ) { |
|
287 | + if ($frame->get_style()->page_break_before === "avoid") { |
|
288 | 288 | dompdf_debug("page-break", "before: avoid"); |
289 | 289 | return false; |
290 | 290 | } |
291 | 291 | |
292 | 292 | // Find the preceeding block-level sibling |
293 | 293 | $prev = $frame->get_prev_sibling(); |
294 | - while ( $prev && !in_array($prev->get_style()->display, $block_types) ) |
|
294 | + while ($prev && !in_array($prev->get_style()->display, $block_types)) |
|
295 | 295 | $prev = $prev->get_prev_sibling(); |
296 | 296 | |
297 | 297 | // Does the previous element allow a page break after? |
298 | - if ( $prev && $prev->get_style()->page_break_after === "avoid" ) { |
|
298 | + if ($prev && $prev->get_style()->page_break_after === "avoid") { |
|
299 | 299 | dompdf_debug("page-break", "after: avoid"); |
300 | 300 | return false; |
301 | 301 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // If both $prev & $frame have the same parent, check the parent's |
304 | 304 | // page_break_inside property. |
305 | 305 | $parent = $frame->get_parent(); |
306 | - if ( $prev && $parent && $parent->get_style()->page_break_inside === "avoid" ) { |
|
306 | + if ($prev && $parent && $parent->get_style()->page_break_inside === "avoid") { |
|
307 | 307 | dompdf_debug("page-break", "parent inside: avoid"); |
308 | 308 | return false; |
309 | 309 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | // To prevent cascading page breaks when a top-level element has |
312 | 312 | // page-break-inside: avoid, ensure that at least one frame is |
313 | 313 | // on the page before splitting. |
314 | - if ( $parent->get_node()->nodeName === "body" && !$prev ) { |
|
314 | + if ($parent->get_node()->nodeName === "body" && !$prev) { |
|
315 | 315 | // We are the body's first child |
316 | 316 | dompdf_debug("page-break", "Body's first child."); |
317 | 317 | return false; |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | |
320 | 320 | // If the frame is the first block-level frame, use the value from |
321 | 321 | // $frame's parent instead. |
322 | - if ( !$prev && $parent ) |
|
323 | - return $this->_page_break_allowed( $parent ); |
|
322 | + if (!$prev && $parent) |
|
323 | + return $this->_page_break_allowed($parent); |
|
324 | 324 | |
325 | 325 | dompdf_debug("page-break", "block: break allowed"); |
326 | 326 | return true; |
@@ -328,17 +328,17 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | // Inline frames (2): |
331 | - else if ( in_array($display, Style::$INLINE_TYPES) ) { |
|
331 | + else if (in_array($display, Style::$INLINE_TYPES)) { |
|
332 | 332 | |
333 | 333 | // Avoid breaks within table-cells |
334 | - if ( $this->_in_table ) { |
|
335 | - dompdf_debug("page-break", "In table: " . $this->_in_table); |
|
334 | + if ($this->_in_table) { |
|
335 | + dompdf_debug("page-break", "In table: ".$this->_in_table); |
|
336 | 336 | return false; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // Rule C |
340 | 340 | $block_parent = $frame->find_block_parent(); |
341 | - if ( count($block_parent->get_lines() ) < $frame->get_style()->orphans ) { |
|
341 | + if (count($block_parent->get_lines()) < $frame->get_style()->orphans) { |
|
342 | 342 | dompdf_debug("page-break", "orphans"); |
343 | 343 | return false; |
344 | 344 | } |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // Rule D |
350 | 350 | $p = $block_parent; |
351 | 351 | while ($p) { |
352 | - if ( $p->get_style()->page_break_inside === "avoid" ) { |
|
352 | + if ($p->get_style()->page_break_inside === "avoid") { |
|
353 | 353 | dompdf_debug("page-break", "parent->inside: avoid"); |
354 | 354 | return false; |
355 | 355 | } |
@@ -360,32 +360,32 @@ discard block |
||
360 | 360 | // page-break-inside: avoid, ensure that at least one frame with |
361 | 361 | // some content is on the page before splitting. |
362 | 362 | $prev = $frame->get_prev_sibling(); |
363 | - while ( $prev && ($prev->get_node()->nodeName === "#text" && trim($prev->get_node()->nodeValue) == "") ) |
|
363 | + while ($prev && ($prev->get_node()->nodeName === "#text" && trim($prev->get_node()->nodeValue) == "")) |
|
364 | 364 | $prev = $prev->get_prev_sibling(); |
365 | 365 | |
366 | - if ( $block_parent->get_node()->nodeName === "body" && !$prev ) { |
|
366 | + if ($block_parent->get_node()->nodeName === "body" && !$prev) { |
|
367 | 367 | // We are the body's first child |
368 | 368 | dompdf_debug("page-break", "Body's first child."); |
369 | 369 | return false; |
370 | 370 | } |
371 | 371 | |
372 | 372 | // Skip breaks on empty text nodes |
373 | - if ( $frame->get_node()->nodeName === "#text" && |
|
374 | - $frame->get_node()->nodeValue == "" ) |
|
373 | + if ($frame->get_node()->nodeName === "#text" && |
|
374 | + $frame->get_node()->nodeValue == "") |
|
375 | 375 | return false; |
376 | 376 | |
377 | 377 | dompdf_debug("page-break", "inline: break allowed"); |
378 | 378 | return true; |
379 | 379 | |
380 | 380 | // Table-rows |
381 | - } else if ( $display === "table-row" ) { |
|
381 | + } else if ($display === "table-row") { |
|
382 | 382 | |
383 | 383 | // Simply check if the parent table's page_break_inside property is |
384 | 384 | // not 'avoid' |
385 | 385 | $p = Table_Frame_Decorator::find_parent_table($frame); |
386 | 386 | |
387 | 387 | while ($p) { |
388 | - if ( $p->get_style()->page_break_inside === "avoid" ) { |
|
388 | + if ($p->get_style()->page_break_inside === "avoid") { |
|
389 | 389 | dompdf_debug("page-break", "parent->inside: avoid"); |
390 | 390 | return false; |
391 | 391 | } |
@@ -393,28 +393,28 @@ discard block |
||
393 | 393 | } |
394 | 394 | |
395 | 395 | // Avoid breaking after the first row of a table |
396 | - if ( $p && $p->get_first_child() === $frame) { |
|
396 | + if ($p && $p->get_first_child() === $frame) { |
|
397 | 397 | dompdf_debug("page-break", "table: first-row"); |
398 | 398 | return false; |
399 | 399 | } |
400 | 400 | |
401 | 401 | // If this is a nested table, prevent the page from breaking |
402 | - if ( $this->_in_table > 1 ) { |
|
402 | + if ($this->_in_table > 1) { |
|
403 | 403 | dompdf_debug("page-break", "table: nested table"); |
404 | 404 | return false; |
405 | 405 | } |
406 | 406 | |
407 | - dompdf_debug("page-break","table-row/row-groups: break allowed"); |
|
407 | + dompdf_debug("page-break", "table-row/row-groups: break allowed"); |
|
408 | 408 | return true; |
409 | 409 | |
410 | - } else if ( in_array($display, Table_Frame_Decorator::$ROW_GROUPS) ) { |
|
410 | + } else if (in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) { |
|
411 | 411 | |
412 | 412 | // Disallow breaks at row-groups: only split at row boundaries |
413 | 413 | return false; |
414 | 414 | |
415 | 415 | } else { |
416 | 416 | |
417 | - dompdf_debug("page-break", "? " . $frame->get_style()->display . ""); |
|
417 | + dompdf_debug("page-break", "? ".$frame->get_style()->display.""); |
|
418 | 418 | return false; |
419 | 419 | } |
420 | 420 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | */ |
431 | 431 | function check_page_break(Frame $frame) { |
432 | 432 | // Do not split if we have already |
433 | - if ( $this->_page_full ) |
|
433 | + if ($this->_page_full) |
|
434 | 434 | return false; |
435 | 435 | |
436 | 436 | // Determine the frame's maximum y value |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | // If a split is to occur here, then the bottom margins & paddings of all |
440 | 440 | // parents of $frame must fit on the page as well: |
441 | 441 | $p = $frame->get_parent(); |
442 | - while ( $p ) { |
|
442 | + while ($p) { |
|
443 | 443 | $style = $p->get_style(); |
444 | 444 | $max_y += $style->length_in_pt(array($style->margin_bottom, |
445 | 445 | $style->padding_bottom, |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | |
450 | 450 | |
451 | 451 | // Check if $frame flows off the page |
452 | - if ( $max_y <= $this->_bottom_page_margin ) |
|
452 | + if ($max_y <= $this->_bottom_page_margin) |
|
453 | 453 | // no: do nothing |
454 | 454 | return false; |
455 | 455 | |
456 | 456 | dompdf_debug("page-break", "check_page_break"); |
457 | - dompdf_debug("page-break", "in_table: " . $this->_in_table); |
|
457 | + dompdf_debug("page-break", "in_table: ".$this->_in_table); |
|
458 | 458 | |
459 | 459 | |
460 | 460 | // yes: determine page break location |
@@ -463,42 +463,42 @@ discard block |
||
463 | 463 | |
464 | 464 | $in_table = $this->_in_table; |
465 | 465 | |
466 | - dompdf_debug("page-break","Starting search"); |
|
467 | - while ( $iter ) { |
|
466 | + dompdf_debug("page-break", "Starting search"); |
|
467 | + while ($iter) { |
|
468 | 468 | // echo "\nbacktrack: " .$iter->get_node()->nodeName ." ".spl_object_hash($iter->get_node()). ""; |
469 | - if ( $iter === $this ) { |
|
469 | + if ($iter === $this) { |
|
470 | 470 | dompdf_debug("page-break", "reached root."); |
471 | 471 | // We've reached the root in our search. Just split at $frame. |
472 | 472 | break; |
473 | 473 | } |
474 | 474 | |
475 | - if ( $this->_page_break_allowed($iter) ) { |
|
476 | - dompdf_debug("page-break","break allowed, splitting."); |
|
475 | + if ($this->_page_break_allowed($iter)) { |
|
476 | + dompdf_debug("page-break", "break allowed, splitting."); |
|
477 | 477 | $iter->split(); |
478 | 478 | $this->_page_full = true; |
479 | 479 | $this->_in_table = $in_table; |
480 | 480 | return true; |
481 | 481 | } |
482 | 482 | |
483 | - if ( !$flg && $next = $iter->get_last_child() ) { |
|
483 | + if (!$flg && $next = $iter->get_last_child()) { |
|
484 | 484 | dompdf_debug("page-break", "following last child."); |
485 | 485 | |
486 | - if ( in_array($next->get_style()->display, Style::$TABLE_TYPES) ) |
|
486 | + if (in_array($next->get_style()->display, Style::$TABLE_TYPES)) |
|
487 | 487 | $this->_in_table++; |
488 | 488 | |
489 | 489 | $iter = $next; |
490 | 490 | continue; |
491 | 491 | } |
492 | 492 | |
493 | - if ( $next = $iter->get_prev_sibling() ) { |
|
493 | + if ($next = $iter->get_prev_sibling()) { |
|
494 | 494 | dompdf_debug("page-break", "following prev sibling."); |
495 | 495 | |
496 | - if ( in_array($next->get_style()->display, Style::$TABLE_TYPES) && |
|
497 | - !in_array($iter->get_style()->display, Style::$TABLE_TYPES) ) |
|
496 | + if (in_array($next->get_style()->display, Style::$TABLE_TYPES) && |
|
497 | + !in_array($iter->get_style()->display, Style::$TABLE_TYPES)) |
|
498 | 498 | $this->_in_table++; |
499 | 499 | |
500 | - else if ( !in_array($next->get_style()->display, Style::$TABLE_TYPES) && |
|
501 | - in_array($iter->get_style()->display, Style::$TABLE_TYPES) ) |
|
500 | + else if (!in_array($next->get_style()->display, Style::$TABLE_TYPES) && |
|
501 | + in_array($iter->get_style()->display, Style::$TABLE_TYPES)) |
|
502 | 502 | $this->_in_table--; |
503 | 503 | |
504 | 504 | $iter = $next; |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | continue; |
507 | 507 | } |
508 | 508 | |
509 | - if ( $next = $iter->get_parent() ) { |
|
509 | + if ($next = $iter->get_parent()) { |
|
510 | 510 | dompdf_debug("page-break", "following parent."); |
511 | 511 | |
512 | - if ( in_array($iter->get_style()->display, Style::$TABLE_TYPES) ) |
|
512 | + if (in_array($iter->get_style()->display, Style::$TABLE_TYPES)) |
|
513 | 513 | $this->_in_table--; |
514 | 514 | |
515 | 515 | $iter = $next; |
@@ -527,17 +527,17 @@ discard block |
||
527 | 527 | dompdf_debug("page-break", "no valid break found, just splitting."); |
528 | 528 | |
529 | 529 | // If we are in a table, backtrack to the nearest top-level table row |
530 | - if ( $this->_in_table ) { |
|
530 | + if ($this->_in_table) { |
|
531 | 531 | $num_tables = $this->_in_table - 1; |
532 | 532 | |
533 | 533 | $iter = $frame; |
534 | - while ( $iter && $num_tables && $iter->get_style->display !== "table" ) { |
|
534 | + while ($iter && $num_tables && $iter->get_style->display !== "table") { |
|
535 | 535 | $iter = $iter->get_parent(); |
536 | 536 | $num_tables--; |
537 | 537 | } |
538 | 538 | |
539 | 539 | $iter = $frame; |
540 | - while ($iter && $iter->get_style()->display !== "table-row" ) |
|
540 | + while ($iter && $iter->get_style()->display !== "table-row") |
|
541 | 541 | $iter = $iter->get_parent(); |
542 | 542 | |
543 | 543 | $iter->split(); |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $style = $this->_frame->get_style(); |
54 | 54 | |
55 | 55 | $top = $style->length_in_pt($style->top, $cb["w"]); |
56 | - $left = $style->length_in_pt($style->left, $cb["w"]); |
|
57 | - $right = $style->length_in_pt($style->right, $cb["w"]); |
|
56 | + $left = $style->length_in_pt($style->left, $cb["w"]); |
|
57 | + $right = $style->length_in_pt($style->right, $cb["w"]); |
|
58 | 58 | $bottom = $style->length_in_pt($style->bottom, $cb["w"]); |
59 | 59 | |
60 | 60 | $p = $this->_frame->find_block_parent(); |
61 | 61 | |
62 | - if ( $p ) { |
|
62 | + if ($p) { |
|
63 | 63 | |
64 | 64 | // Get the parent's padding box (see http://www.w3.org/TR/CSS21/visuren.html#propdef-top) |
65 | 65 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | } |
74 | 74 | |
75 | - if ( isset($top) ) { |
|
75 | + if (isset($top)) { |
|
76 | 76 | $y += $top; |
77 | - } else if ( isset($bottom) ) { |
|
77 | + } else if (isset($bottom)) { |
|
78 | 78 | // FIXME: need to know this frame's height before we can do this correctly |
79 | 79 | } |
80 | 80 |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | $cb = $this->_frame->get_containing_block(); |
59 | 59 | |
60 | 60 | // Add our margin, padding & border to the first and last children |
61 | - if ( ($f = $this->_frame->get_first_child()) && $f instanceof Text_Frame_Decorator ) { |
|
61 | + if (($f = $this->_frame->get_first_child()) && $f instanceof Text_Frame_Decorator) { |
|
62 | 62 | $f->get_style()->margin_left = $style->margin_left; |
63 | 63 | $f->get_style()->padding_left = $style->padding_left; |
64 | 64 | $f->get_style()->border_left = $style->border_left; |
65 | 65 | } |
66 | 66 | |
67 | - if ( ($l = $this->_frame->get_last_child()) && $l instanceof Text_Frame_Decorator ) { |
|
67 | + if (($l = $this->_frame->get_last_child()) && $l instanceof Text_Frame_Decorator) { |
|
68 | 68 | $f->get_style()->margin_right = $style->margin_right; |
69 | 69 | $f->get_style()->padding_right = $style->padding_right; |
70 | 70 | $f->get_style()->border_right = $style->border_right; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | // Set the containing blocks and reflow each child. The containing |
74 | 74 | // block is not changed by line boxes. |
75 | - foreach ( $this->_frame->get_children() as $child ) { |
|
75 | + foreach ($this->_frame->get_children() as $child) { |
|
76 | 76 | |
77 | 77 | $child->set_containing_block($cb); |
78 | 78 | $child->reflow(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | protected $_pdf; |
57 | 57 | protected $_cache_id; |
58 | 58 | protected $_current_page_id; |
59 | - protected $_fonts; // fonts used in this document |
|
59 | + protected $_fonts; // fonts used in this document |
|
60 | 60 | |
61 | 61 | function __construct($cache_id, CPDF_Adapter $pdf) { |
62 | 62 | $this->_pdf = $pdf; |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | $this->_pdf->image($img_url, $x, $y, $w, $h); |
116 | 116 | } |
117 | 117 | |
118 | - function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) { |
|
118 | + function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0) { |
|
119 | 119 | $this->_fonts[$font] = true; |
120 | 120 | $this->_pdf->text($x, $y, $text, $font, $size, $color, $adjust, $angle); |
121 | 121 | } |
122 | 122 | |
123 | - function page_text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) { |
|
123 | + function page_text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0) { |
|
124 | 124 | |
125 | 125 | // We want to remove this from cached pages since it may not be correct |
126 | 126 | $this->_pdf->close_object(); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | function stream($filename) { |
155 | 155 | // Store the last page in the page cache |
156 | - if ( !is_null($this->_current_page_id) ) { |
|
156 | + if (!is_null($this->_current_page_id)) { |
|
157 | 157 | $this->_pdf->close_object(); |
158 | 158 | $this->_pdf->add_object($this->_current_page_id, "add"); |
159 | 159 | Page_Cache::store_page($this->_cache_id, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | function &output() { |
171 | 171 | // Store the last page in the page cache |
172 | - if ( !is_null($this->_current_page_id) ) { |
|
172 | + if (!is_null($this->_current_page_id)) { |
|
173 | 173 | $this->_pdf->close_object(); |
174 | 174 | $this->_pdf->add_object($this->_current_page_id, "add"); |
175 | 175 | Page_Cache::store_page($this->_cache_id, |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | /* $Id: tcpdf_adapter.cls.php 217 2010-03-11 23:03:57Z ryan.masten $ */ |
41 | 41 | |
42 | -require_once(DOMPDF_LIB_DIR . '/tcpdf/tcpdf.php'); |
|
42 | +require_once(DOMPDF_LIB_DIR.'/tcpdf/tcpdf.php'); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * TCPDF PDF Rendering interface |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | */ |
139 | 139 | function __construct($paper = "letter", $orientation = "portrait") { |
140 | 140 | |
141 | - if ( is_array($paper) ) |
|
141 | + if (is_array($paper)) |
|
142 | 142 | $size = $paper; |
143 | - else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) ) |
|
143 | + else if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) |
|
144 | 144 | $size = self::$PAPER_SIZE[$paper]; |
145 | 145 | else |
146 | 146 | $size = self::$PAPER_SIZE["letter"]; |
147 | 147 | |
148 | - if ( mb_strtolower($orientation) === "landscape" ) { |
|
148 | + if (mb_strtolower($orientation) === "landscape") { |
|
149 | 149 | $a = $size[3]; |
150 | 150 | $size[3] = $size[2]; |
151 | 151 | $size[2] = $a; |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | $colour[1] = round(255 * $colour[1]); |
187 | 187 | $colour[2] = round(255 * $colour[2]); |
188 | 188 | |
189 | - if ( is_null($this->_last_stroke_color) || $color != $this->_last_stroke_color ) { |
|
190 | - $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]); |
|
189 | + if (is_null($this->_last_stroke_color) || $color != $this->_last_stroke_color) { |
|
190 | + $this->_pdf->SetDrawColor($color[0], $color[1], $color[2]); |
|
191 | 191 | $this->_last_stroke_color = $color; |
192 | 192 | } |
193 | 193 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $colour[1] = round(255 * $colour[1]); |
204 | 204 | $colour[2] = round(255 * $colour[2]); |
205 | 205 | |
206 | - if ( is_null($this->_last_fill_color) || $color != $this->_last_fill_color ) { |
|
207 | - $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]); |
|
206 | + if (is_null($this->_last_fill_color) || $color != $this->_last_fill_color) { |
|
207 | + $this->_pdf->SetDrawColor($color[0], $color[1], $color[2]); |
|
208 | 208 | $this->_last_fill_color = $color; |
209 | 209 | } |
210 | 210 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param int $count |
242 | 242 | */ |
243 | 243 | function set_page_count($count) { |
244 | - $this->_page_count = (int)$count; |
|
244 | + $this->_page_count = (int) $count; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | */ |
262 | 262 | function line($x1, $y1, $x2, $y2, $color, $width, $style = null) { |
263 | 263 | |
264 | - if ( is_null($this->_last_line_width) || $width != $this->_last_line_width ) { |
|
264 | + if (is_null($this->_last_line_width) || $width != $this->_last_line_width) { |
|
265 | 265 | $this->_pdf->SetLineWidth($width); |
266 | 266 | $this->_last_line_width = $width; |
267 | 267 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) { |
291 | 291 | |
292 | - if ( is_null($this->_last_line_width) || $width != $this->_last_line_width ) { |
|
292 | + if (is_null($this->_last_line_width) || $width != $this->_last_line_width) { |
|
293 | 293 | $this->_pdf->SetLineWidth($width); |
294 | 294 | $this->_last_line_width = $width; |
295 | 295 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @param array $style |
364 | 364 | * @param bool $fill Fills the circle if true |
365 | 365 | */ |
366 | - function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false){} |
|
366 | + function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false) {} |
|
367 | 367 | |
368 | 368 | /** |
369 | 369 | * Add an image to the pdf. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @param int $w width (in pixels) |
379 | 379 | * @param int $h height (in pixels) |
380 | 380 | */ |
381 | - function image($img_url, $img_type, $x, $y, $w, $h){} |
|
381 | + function image($img_url, $img_type, $x, $y, $w, $h) {} |
|
382 | 382 | |
383 | 383 | /** |
384 | 384 | * Writes text at the specified x and y coordinates |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | * @param array $color |
394 | 394 | * @param float $adjust word spacing adjustment |
395 | 395 | */ |
396 | - function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0){} |
|
396 | + function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0) {} |
|
397 | 397 | |
398 | - function javascript($code){} |
|
398 | + function javascript($code) {} |
|
399 | 399 | |
400 | 400 | /** |
401 | 401 | * Add a named destination (similar to <a name="foo">...</a> in html) |
402 | 402 | * |
403 | 403 | * @param string $anchorname The name of the named destination |
404 | 404 | */ |
405 | - function add_named_dest($anchorname){} |
|
405 | + function add_named_dest($anchorname) {} |
|
406 | 406 | |
407 | 407 | /** |
408 | 408 | * Add a link to the pdf |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @param float $width The width of the link |
414 | 414 | * @param float $height The height of the link |
415 | 415 | */ |
416 | - function add_link($url, $x, $y, $width, $height){} |
|
416 | + function add_link($url, $x, $y, $width, $height) {} |
|
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Calculates text size, in points |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @param float $spacing word spacing, if any |
425 | 425 | * @return float |
426 | 426 | */ |
427 | - function get_text_width($text, $font, $size, $spacing = 0){} |
|
427 | + function get_text_width($text, $font, $size, $spacing = 0) {} |
|
428 | 428 | |
429 | 429 | /** |
430 | 430 | * Calculates font height, in points |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @param float $size |
434 | 434 | * @return float |
435 | 435 | */ |
436 | - function get_font_height($font, $size){} |
|
436 | + function get_font_height($font, $size) {} |
|
437 | 437 | |
438 | 438 | |
439 | 439 | /** |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * |
442 | 442 | * Subsequent drawing operations will appear on the new page. |
443 | 443 | */ |
444 | - function new_page(){} |
|
444 | + function new_page() {} |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Streams the PDF directly to the browser |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | * @param string $filename the name of the PDF file |
450 | 450 | * @param array $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0 |
451 | 451 | */ |
452 | - function stream($filename, $options = null){} |
|
452 | + function stream($filename, $options = null) {} |
|
453 | 453 | |
454 | 454 | /** |
455 | 455 | * Returns the PDF as a string |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @param array $options associative array: 'compress' => 1 or 0 |
458 | 458 | * @return string |
459 | 459 | */ |
460 | - function output($options = null){} |
|
460 | + function output($options = null) {} |
|
461 | 461 | |
462 | 462 | } |
463 | 463 |
@@ -99,22 +99,22 @@ discard block |
||
99 | 99 | * @param float $aa_factor Anti-aliasing factor, 1 for no AA |
100 | 100 | * @param array $bg_color Image background color: array(r,g,b,a), 0 <= r,g,b,a <= 1 |
101 | 101 | */ |
102 | - function __construct($size, $orientation = "portrait", $aa_factor = 1, $bg_color = array(1,1,1,0) ) { |
|
102 | + function __construct($size, $orientation = "portrait", $aa_factor = 1, $bg_color = array(1, 1, 1, 0)) { |
|
103 | 103 | |
104 | - if ( !is_array($size) ) { |
|
104 | + if (!is_array($size)) { |
|
105 | 105 | |
106 | - if ( isset(CPDF_Adapter::$PAPER_SIZES[ strtolower($size)]) ) |
|
106 | + if (isset(CPDF_Adapter::$PAPER_SIZES[strtolower($size)])) |
|
107 | 107 | $size = CPDF_Adapter::$PAPER_SIZES[$size]; |
108 | 108 | else |
109 | 109 | $size = CPDF_Adapter::$PAPER_SIZES["letter"]; |
110 | 110 | |
111 | 111 | } |
112 | 112 | |
113 | - if ( strtolower($orientation) === "landscape" ) { |
|
114 | - list($size[2],$size[3]) = array($size[3],$size[2]); |
|
113 | + if (strtolower($orientation) === "landscape") { |
|
114 | + list($size[2], $size[3]) = array($size[3], $size[2]); |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( $aa_factor < 1 ) |
|
117 | + if ($aa_factor < 1) |
|
118 | 118 | $aa_factor = 1; |
119 | 119 | |
120 | 120 | $this->_aa_factor = $aa_factor; |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | |
128 | 128 | $this->_img = imagecreatetruecolor($this->_width, $this->_height); |
129 | 129 | |
130 | - if ( is_null($bg_color) || !is_array($bg_color) ) { |
|
130 | + if (is_null($bg_color) || !is_array($bg_color)) { |
|
131 | 131 | // Pure white bg |
132 | - $bg_color = array(1,1,1,0); |
|
132 | + $bg_color = array(1, 1, 1, 0); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $this->_bg_color = $this->_allocate_color($bg_color); |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | private function _allocate_color($color) { |
198 | 198 | |
199 | 199 | // Full opacity if no alpha set |
200 | - if ( !isset($color[3]) ) |
|
200 | + if (!isset($color[3])) |
|
201 | 201 | $color[3] = 0; |
202 | 202 | |
203 | - list($r,$g,$b,$a) = $color; |
|
203 | + list($r, $g, $b, $a) = $color; |
|
204 | 204 | |
205 | 205 | $r *= 255; |
206 | 206 | $g *= 255; |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | |
221 | 221 | $key = sprintf("#%02X%02X%02X%02X", $r, $g, $b, $a); |
222 | 222 | |
223 | - if ( isset($this->_colors[$key]) ) |
|
223 | + if (isset($this->_colors[$key])) |
|
224 | 224 | return $this->_colors[$key]; |
225 | 225 | |
226 | - if ( $a != 0 ) |
|
226 | + if ($a != 0) |
|
227 | 227 | $this->_colors[$key] = imagecolorallocatealpha($this->_img, $r, $g, $b, $a); |
228 | 228 | else |
229 | 229 | $this->_colors[$key] = imagecolorallocate($this->_img, $r, $g, $b); |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | $c = $this->_allocate_color($color); |
260 | 260 | |
261 | 261 | // Convert the style array if required |
262 | - if ( !is_null($style) ) { |
|
262 | + if (!is_null($style)) { |
|
263 | 263 | $gd_style = array(); |
264 | 264 | |
265 | - if ( count($style) == 1 ) { |
|
265 | + if (count($style) == 1) { |
|
266 | 266 | for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) { |
267 | 267 | $gd_style[] = $c; |
268 | 268 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $i = 0; |
277 | 277 | foreach ($style as $length) { |
278 | 278 | |
279 | - if ( $i % 2 == 0 ) { |
|
279 | + if ($i % 2 == 0) { |
|
280 | 280 | // 'On' pattern |
281 | 281 | for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) |
282 | 282 | $gd_style[] = $c; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $c = $this->_allocate_color($color); |
328 | 328 | |
329 | 329 | // Convert the style array if required |
330 | - if ( !is_null($style) ) { |
|
330 | + if (!is_null($style)) { |
|
331 | 331 | $gd_style = array(); |
332 | 332 | |
333 | 333 | foreach ($style as $length) { |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $c = $this->_allocate_color($color); |
405 | 405 | |
406 | 406 | // Convert the style array if required |
407 | - if ( !is_null($style) && !$fill ) { |
|
407 | + if (!is_null($style) && !$fill) { |
|
408 | 408 | $gd_style = array(); |
409 | 409 | |
410 | 410 | foreach ($style as $length) { |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | |
420 | 420 | imagesetthickness($this->_img, $width); |
421 | 421 | |
422 | - if ( $fill ) |
|
422 | + if ($fill) |
|
423 | 423 | imagefilledpolygon($this->_img, $points, count($points) / 2, $c); |
424 | 424 | else |
425 | 425 | imagepolygon($this->_img, $points, count($points) / 2, $c); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | $c = $this->_allocate_color($color); |
452 | 452 | |
453 | 453 | // Convert the style array if required |
454 | - if ( !is_null($style) && !$fill ) { |
|
454 | + if (!is_null($style) && !$fill) { |
|
455 | 455 | $gd_style = array(); |
456 | 456 | |
457 | 457 | foreach ($style as $length) { |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | imagesetthickness($this->_img, $width); |
468 | 468 | |
469 | - if ( $fill ) |
|
469 | + if ($fill) |
|
470 | 470 | imagefilledellipse($this->_img, $x, $y, $r, $r, $c); |
471 | 471 | else |
472 | 472 | imageellipse($this->_img, $x, $y, $r, $r, $c); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | } |
509 | 509 | |
510 | - if ( !$src ) |
|
510 | + if (!$src) |
|
511 | 511 | return; // Probably should add to $_dompdf_errors or whatever here |
512 | 512 | |
513 | 513 | // Scale by the AA factor |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @param float $adjust word spacing adjustment |
540 | 540 | * @param float $angle Text angle |
541 | 541 | */ |
542 | - function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) { |
|
542 | + function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0) { |
|
543 | 543 | |
544 | 544 | // Scale by the AA factor |
545 | 545 | $x *= $this->_aa_factor; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | |
551 | 551 | $c = $this->_allocate_color($color); |
552 | 552 | |
553 | - if ( strpos($font, '.ttf') === false ) |
|
553 | + if (strpos($font, '.ttf') === false) |
|
554 | 554 | $font .= ".ttf"; |
555 | 555 | |
556 | 556 | // FIXME: word spacing |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | */ |
596 | 596 | function get_text_width($text, $font, $size, $spacing = 0) { |
597 | 597 | |
598 | - if ( strpos($font, '.ttf') === false ) |
|
598 | + if (strpos($font, '.ttf') === false) |
|
599 | 599 | $font .= ".ttf"; |
600 | 600 | |
601 | 601 | // FIXME: word spacing |
@@ -611,11 +611,11 @@ discard block |
||
611 | 611 | * @return float |
612 | 612 | */ |
613 | 613 | function get_font_height($font, $size) { |
614 | - if ( strpos($font, '.ttf') === false ) |
|
614 | + if (strpos($font, '.ttf') === false) |
|
615 | 615 | $font .= ".ttf"; |
616 | 616 | |
617 | 617 | // FIXME: word spacing |
618 | - list(,$y2,,,,$y1) = imagettfbbox($size, 0, $font, "MXjpqytfhl"); // Test string with ascenders, descenders and caps |
|
618 | + list(,$y2,,,,$y1) = imagettfbbox($size, 0, $font, "MXjpqytfhl"); // Test string with ascenders, descenders and caps |
|
619 | 619 | return $y2 - $y1; |
620 | 620 | } |
621 | 621 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | function stream($filename, $options = null) { |
639 | 639 | |
640 | 640 | // Perform any antialiasing |
641 | - if ( $this->_aa_factor != 1 ) { |
|
641 | + if ($this->_aa_factor != 1) { |
|
642 | 642 | $dst_w = $this->_width / $this->_aa_factor; |
643 | 643 | $dst_h = $this->_height / $this->_aa_factor; |
644 | 644 | $dst = imagecreatetruecolor($dst_w, $dst_h); |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | $dst = $this->_img; |
650 | 650 | } |
651 | 651 | |
652 | - if ( !isset($options["type"]) ) |
|
652 | + if (!isset($options["type"])) |
|
653 | 653 | $options["type"] = "png"; |
654 | 654 | |
655 | 655 | $type = strtolower($options["type"]); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | |
661 | 661 | case "jpg": |
662 | 662 | case "jpeg": |
663 | - if ( !isset($options["quality"]) ) |
|
663 | + if (!isset($options["quality"])) |
|
664 | 664 | $options["quality"] = 75; |
665 | 665 | |
666 | 666 | header("Content-type: image/jpeg"); |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | break; |
675 | 675 | } |
676 | 676 | |
677 | - if ( $this->_aa_factor != 1 ) |
|
677 | + if ($this->_aa_factor != 1) |
|
678 | 678 | imagedestroy($dst); |
679 | 679 | } |
680 | 680 | |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | */ |
687 | 687 | function output($options = null) { |
688 | 688 | |
689 | - if ( $this->_aa_factor != 1 ) { |
|
689 | + if ($this->_aa_factor != 1) { |
|
690 | 690 | $dst_w = $this->_width / $this->_aa_factor; |
691 | 691 | $dst_h = $this->_height / $this->_aa_factor; |
692 | 692 | $dst = imagecreatetruecolor($dst_w, $dst_h); |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | $dst = $this->_img; |
698 | 698 | } |
699 | 699 | |
700 | - if ( !isset($options["type"]) ) |
|
700 | + if (!isset($options["type"])) |
|
701 | 701 | $options["type"] = "png"; |
702 | 702 | |
703 | 703 | $type = $options["type"]; |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | |
709 | 709 | case "jpg": |
710 | 710 | case "jpeg": |
711 | - if ( !isset($options["quality"]) ) |
|
711 | + if (!isset($options["quality"])) |
|
712 | 712 | $options["quality"] = 75; |
713 | 713 | |
714 | 714 | imagejpeg($dst, '', $options["quality"]); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $image = ob_get_contents(); |
724 | 724 | ob_end_clean(); |
725 | 725 | |
726 | - if ( $this->_aa_factor != 1 ) |
|
726 | + if ($this->_aa_factor != 1) |
|
727 | 727 | imagedestroy($dst); |
728 | 728 | |
729 | 729 | return $image; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | protected $_text_spacing; |
52 | 52 | |
53 | 53 | function __construct(Frame $frame, DOMPDF $dompdf) { |
54 | - if ( $frame->get_node()->nodeName !== "#text" ) |
|
54 | + if ($frame->get_node()->nodeName !== "#text") |
|
55 | 55 | throw new DOMPDF_Exception("Text_Decorator can only be applied to #text nodes."); |
56 | 56 | |
57 | 57 | parent::__construct($frame, $dompdf); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | function get_text() { |
74 | 74 | // FIXME: this should be in a child class (and is incorrect) |
75 | - if ( $this->_frame->get_style()->content !== "normal" ) { |
|
75 | + if ($this->_frame->get_style()->content !== "normal") { |
|
76 | 76 | $this->_frame->get_node()->data = $this->_frame->get_style()->content; |
77 | 77 | $this->_frame->get_style()->content = "normal"; |
78 | 78 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // split the text in this frame at the offset specified. The remaining |
155 | 155 | // text is added a sibling frame following this one and is returned. |
156 | 156 | function split_text($offset) { |
157 | - if ( $offset == 0 ) |
|
157 | + if ($offset == 0) |
|
158 | 158 | return; |
159 | 159 | |
160 | 160 | $split = $this->_frame->get_node()->splitText($offset); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $p = $this->get_parent(); |
164 | 164 | $p->insert_child_after($deco, $this, false); |
165 | 165 | |
166 | - if ( $p instanceof Inline_Frame_Decorator ) |
|
166 | + if ($p instanceof Inline_Frame_Decorator) |
|
167 | 167 | $p->split($deco); |
168 | 168 | |
169 | 169 | } |