@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | */ |
134 | 134 | function split($child = null) { |
135 | 135 | |
136 | - if ( is_null($child) ) { |
|
136 | + if (is_null($child)) { |
|
137 | 137 | parent::split(); |
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | 141 | // If $child is a header or if it is the first non-header row, do |
142 | 142 | // not duplicate headers, simply move the table to the next page. |
143 | - if ( count($this->_headers) && !in_array($child, $this->_headers, true) && |
|
144 | - !in_array($child->get_prev_sibling(), $this->_headers, true) ) { |
|
143 | + if (count($this->_headers) && !in_array($child, $this->_headers, true) && |
|
144 | + !in_array($child->get_prev_sibling(), $this->_headers, true)) { |
|
145 | 145 | |
146 | 146 | $first_header = null; |
147 | 147 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $new_header = $header->deep_copy(); |
152 | 152 | |
153 | - if ( is_null($first_header) ) |
|
153 | + if (is_null($first_header)) |
|
154 | 154 | $first_header = $new_header; |
155 | 155 | |
156 | 156 | $this->insert_child_before($new_header, $child); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | parent::split($first_header); |
160 | 160 | |
161 | - } else if ( in_array($child->get_style()->display, self::$ROW_GROUPS) ) { |
|
161 | + } else if (in_array($child->get_style()->display, self::$ROW_GROUPS)) { |
|
162 | 162 | |
163 | 163 | // Individual rows should have already been handled |
164 | 164 | parent::split($child); |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | */ |
185 | 185 | static function find_parent_table(Frame $frame) { |
186 | 186 | |
187 | - while ( $frame = $frame->get_parent() ) |
|
188 | - if ( in_array($frame->get_style()->display, Style::$TABLE_TYPES) ) |
|
187 | + while ($frame = $frame->get_parent()) |
|
188 | + if (in_array($frame->get_style()->display, Style::$TABLE_TYPES)) |
|
189 | 189 | break; |
190 | 190 | |
191 | 191 | return $frame; |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | $erroneous_frames = array(); |
238 | 238 | $anon_row = false; |
239 | 239 | $iter = $this->get_first_child(); |
240 | - while ( $iter ) { |
|
240 | + while ($iter) { |
|
241 | 241 | $child = $iter; |
242 | 242 | $iter = $iter->get_next_sibling(); |
243 | 243 | |
244 | 244 | $display = $child->get_style()->display; |
245 | 245 | |
246 | - if ( $anon_row ) { |
|
246 | + if ($anon_row) { |
|
247 | 247 | |
248 | - if ( $display === "table-row" ) { |
|
248 | + if ($display === "table-row") { |
|
249 | 249 | // Add the previous anonymous row |
250 | 250 | $this->insert_child_before($table_row, $child); |
251 | 251 | |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | |
262 | 262 | } else { |
263 | 263 | |
264 | - if ( $display === "table-row" ) { |
|
264 | + if ($display === "table-row") { |
|
265 | 265 | $child->normalise(); |
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | - if ( $display === "table-cell") { |
|
269 | + if ($display === "table-cell") { |
|
270 | 270 | // Create an anonymous table row |
271 | 271 | $tr = $this->get_node()->ownerDocument->createElement("tr"); |
272 | 272 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // Lookup styles for tr tags. If the user wants styles to work |
280 | 280 | // better, they should make the tr explicit... I'm not going to |
281 | 281 | // try to guess what they intended. |
282 | - if ( $tr_style = $css->lookup("tr") ) |
|
282 | + if ($tr_style = $css->lookup("tr")) |
|
283 | 283 | $style->merge($tr_style); |
284 | 284 | |
285 | 285 | // Okay, I have absolutely no idea why I need this clone here, but |
@@ -295,27 +295,27 @@ discard block |
||
295 | 295 | continue; |
296 | 296 | } |
297 | 297 | |
298 | - if ( !in_array($display, self::$VALID_CHILDREN) ) { |
|
298 | + if (!in_array($display, self::$VALID_CHILDREN)) { |
|
299 | 299 | $erroneous_frames[] = $child; |
300 | 300 | continue; |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Normalise other table parts (i.e. row groups) |
304 | 304 | foreach ($child->get_children() as $grandchild) { |
305 | - if ( $grandchild->get_style()->display === "table-row" ) |
|
305 | + if ($grandchild->get_style()->display === "table-row") |
|
306 | 306 | $grandchild->normalise(); |
307 | 307 | } |
308 | 308 | |
309 | 309 | // Add headers and footers |
310 | - if ( $display === "table-header-group" ) |
|
310 | + if ($display === "table-header-group") |
|
311 | 311 | $this->_headers[] = $child; |
312 | 312 | |
313 | - else if ( $display === "table-footer-group" ) |
|
313 | + else if ($display === "table-footer-group") |
|
314 | 314 | $this->_footers[] = $child; |
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
318 | - if ( $anon_row ) { |
|
318 | + if ($anon_row) { |
|
319 | 319 | // Add the row to the table |
320 | 320 | $this->_frame->append_child($table_row); |
321 | 321 | $table_row->normalise(); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $sheet = $style->get_stylesheet(); |
110 | 110 | |
111 | 111 | // Skip degenerate cases |
112 | - if ( $width == 0 || $height == 0 ) |
|
112 | + if ($width == 0 || $height == 0) |
|
113 | 113 | return; |
114 | 114 | |
115 | 115 | //debugpng |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $sheet->get_base_path()); |
122 | 122 | |
123 | 123 | // Bail if the image is no good |
124 | - if ( $img === DOMPDF_LIB_DIR . "/res/broken_image.png" ) |
|
124 | + if ($img === DOMPDF_LIB_DIR."/res/broken_image.png") |
|
125 | 125 | return; |
126 | 126 | |
127 | 127 | //Try to optimize away reading and composing of same background multiple times |
@@ -140,35 +140,35 @@ discard block |
||
140 | 140 | |
141 | 141 | //Increase background resolution and dependent box size according to image resolution to be placed in |
142 | 142 | //Then image can be copied in without resize |
143 | - $bg_width = round((float)($width * DOMPDF_DPI) / 72); |
|
144 | - $bg_height = round((float)($height * DOMPDF_DPI) / 72); |
|
143 | + $bg_width = round((float) ($width * DOMPDF_DPI) / 72); |
|
144 | + $bg_height = round((float) ($height * DOMPDF_DPI) / 72); |
|
145 | 145 | |
146 | 146 | //Need %bg_x, $bg_y as background pos, where img starts, converted to pixel |
147 | 147 | |
148 | 148 | list($bg_x, $bg_y) = $style->background_position; |
149 | 149 | |
150 | - if ( is_percent($bg_x) ) { |
|
150 | + if (is_percent($bg_x)) { |
|
151 | 151 | // The point $bg_x % from the left edge of the image is placed |
152 | 152 | // $bg_x % from the left edge of the background rectangle |
153 | - $p = ((float)$bg_x)/100.0; |
|
153 | + $p = ((float) $bg_x) / 100.0; |
|
154 | 154 | $x1 = $p * $img_w; |
155 | 155 | $x2 = $p * $bg_width; |
156 | 156 | |
157 | 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 | - if ( is_percent($bg_y) ) { |
|
162 | + if (is_percent($bg_y)) { |
|
163 | 163 | // The point $bg_y % from the left edge of the image is placed |
164 | 164 | // $bg_y % from the left edge of the background rectangle |
165 | - $p = ((float)$bg_y)/100.0; |
|
165 | + $p = ((float) $bg_y) / 100.0; |
|
166 | 166 | $y1 = $p * $img_h; |
167 | 167 | $y2 = $p * $bg_height; |
168 | 168 | |
169 | 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 |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | //On no repeat with positive offset: move size/start to have offset==0 |
177 | 177 | //Handle x/y Dimensions separately |
178 | 178 | |
179 | - if ( $repeat !== "repeat" && $repeat !== "repeat-x" ) { |
|
179 | + if ($repeat !== "repeat" && $repeat !== "repeat-x") { |
|
180 | 180 | //No repeat x |
181 | 181 | if ($bg_x < 0) { |
182 | 182 | $bg_width = $img_w + $bg_x; |
183 | 183 | } else { |
184 | - $x += ($bg_x * 72)/DOMPDF_DPI; |
|
184 | + $x += ($bg_x * 72) / DOMPDF_DPI; |
|
185 | 185 | $bg_width = $bg_width - $bg_x; |
186 | 186 | if ($bg_width > $img_w) { |
187 | 187 | $bg_width = $img_w; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if ($bg_width <= 0) { |
192 | 192 | return; |
193 | 193 | } |
194 | - $width = (float)($bg_width * 72)/DOMPDF_DPI; |
|
194 | + $width = (float) ($bg_width * 72) / DOMPDF_DPI; |
|
195 | 195 | } else { |
196 | 196 | //repeat x |
197 | 197 | if ($bg_x < 0) { |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - if ( $repeat !== "repeat" && $repeat !== "repeat-y" ) { |
|
207 | + if ($repeat !== "repeat" && $repeat !== "repeat-y") { |
|
208 | 208 | //no repeat y |
209 | 209 | if ($bg_y < 0) { |
210 | 210 | $bg_height = $img_h + $bg_y; |
211 | 211 | } else { |
212 | - $y += ($bg_y * 72)/DOMPDF_DPI; |
|
212 | + $y += ($bg_y * 72) / DOMPDF_DPI; |
|
213 | 213 | $bg_height = $bg_height - $bg_y; |
214 | 214 | if ($bg_height > $img_h) { |
215 | 215 | $bg_height = $img_h; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | if ($bg_height <= 0) { |
220 | 220 | return; |
221 | 221 | } |
222 | - $height = (float)($bg_height * 72)/DOMPDF_DPI; |
|
222 | + $height = (float) ($bg_height * 72) / DOMPDF_DPI; |
|
223 | 223 | } else { |
224 | 224 | //repeat y |
225 | 225 | if ($bg_y < 0) { |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | //Optimization, if repeat has no effect |
236 | - if ( $repeat === "repeat" && $bg_y <= 0 && $img_h+$bg_y >= $bg_height ) { |
|
236 | + if ($repeat === "repeat" && $bg_y <= 0 && $img_h + $bg_y >= $bg_height) { |
|
237 | 237 | $repeat = "repeat-x"; |
238 | 238 | } |
239 | - if ( $repeat === "repeat" && $bg_x <= 0 && $img_w+$bg_x >= $bg_width ) { |
|
239 | + if ($repeat === "repeat" && $bg_x <= 0 && $img_w + $bg_x >= $bg_width) { |
|
240 | 240 | $repeat = "repeat-y"; |
241 | 241 | } |
242 | - if ( ($repeat === "repeat-x" && $bg_x <= 0 && $img_w+$bg_x >= $bg_width) || |
|
243 | - ($repeat === "repeat-y" && $bg_y <= 0 && $img_h+$bg_y >= $bg_height) ) { |
|
242 | + if (($repeat === "repeat-x" && $bg_x <= 0 && $img_w + $bg_x >= $bg_width) || |
|
243 | + ($repeat === "repeat-y" && $bg_y <= 0 && $img_h + $bg_y >= $bg_height)) { |
|
244 | 244 | $repeat = "no-repeat"; |
245 | 245 | } |
246 | 246 | |
@@ -281,10 +281,10 @@ discard block |
||
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) ) { |
|
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 | 288 | $bg = null; |
289 | 289 | |
290 | 290 | //debugpng |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | //to keep the transparency when copying over the non transparent parts of the tiles. |
328 | 328 | $ti = imagecolortransparent($src); |
329 | 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); |
|
330 | + $tc = imagecolorsforindex($src, $ti); |
|
331 | + $ti = imagecolorallocate($bg, $tc['red'], $tc['green'], $tc['blue']); |
|
332 | + imagefill($bg, 0, 0, $ti); |
|
333 | 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 | - if ( $bg_x < 0 ) { |
|
338 | + if ($bg_x < 0) { |
|
339 | 339 | $dst_x = 0; |
340 | 340 | $src_x = -$bg_x; |
341 | 341 | } else { |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $dst_x = $bg_x; |
344 | 344 | } |
345 | 345 | |
346 | - if ( $bg_y < 0 ) { |
|
346 | + if ($bg_y < 0) { |
|
347 | 347 | $dst_y = 0; |
348 | 348 | $src_y = -$bg_y; |
349 | 349 | } else { |
@@ -358,15 +358,15 @@ discard block |
||
358 | 358 | |
359 | 359 | // Copy regions from the source image to the background |
360 | 360 | |
361 | - if ( $repeat === "no-repeat" ) { |
|
361 | + if ($repeat === "no-repeat") { |
|
362 | 362 | |
363 | 363 | // Simply place the image on the background |
364 | 364 | imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $img_w, $img_h); |
365 | 365 | |
366 | - } else if ( $repeat === "repeat-x" ) { |
|
366 | + } else if ($repeat === "repeat-x") { |
|
367 | 367 | |
368 | - for ( $bg_x = $start_x; $bg_x < $bg_width; $bg_x += $img_w ) { |
|
369 | - if ( $bg_x < 0 ) { |
|
368 | + for ($bg_x = $start_x; $bg_x < $bg_width; $bg_x += $img_w) { |
|
369 | + if ($bg_x < 0) { |
|
370 | 370 | $dst_x = 0; |
371 | 371 | $src_x = -$bg_x; |
372 | 372 | $w = $img_w + $bg_x; |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | imagecopy($bg, $src, $dst_x, $dst_y, $src_x, $src_y, $w, $img_h); |
379 | 379 | } |
380 | 380 | |
381 | - } else if ( $repeat === "repeat-y" ) { |
|
381 | + } else if ($repeat === "repeat-y") { |
|
382 | 382 | |
383 | - for ( $bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h ) { |
|
384 | - if ( $bg_y < 0 ) { |
|
383 | + for ($bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h) { |
|
384 | + if ($bg_y < 0) { |
|
385 | 385 | $dst_y = 0; |
386 | 386 | $src_y = -$bg_y; |
387 | 387 | $h = $img_h + $bg_y; |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | |
395 | 395 | } |
396 | 396 | |
397 | - } else if ( $repeat === "repeat" ) { |
|
397 | + } else if ($repeat === "repeat") { |
|
398 | 398 | |
399 | - for ( $bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h ) { |
|
400 | - for ( $bg_x = $start_x; $bg_x < $bg_width; $bg_x += $img_w ) { |
|
399 | + for ($bg_y = $start_y; $bg_y < $bg_height; $bg_y += $img_h) { |
|
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; |
@@ -409,7 +409,7 @@ discard block |
||
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; |
@@ -438,7 +438,7 @@ discard block |
||
438 | 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" ) ) { |
|
441 | + if (method_exists($this->_canvas, "get_cpdf") && method_exists($this->_canvas->get_cpdf(), "addImagePng")) { |
|
442 | 442 | //Note: CPDF_Adapter image converts y position |
443 | 443 | $this->_canvas->get_cpdf()->addImagePng( |
444 | 444 | $filedummy, |
@@ -467,7 +467,7 @@ discard block |
||
467 | 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 | - if ( $$side < 2 ) |
|
470 | + if ($$side < 2) |
|
471 | 471 | $dash = array($$side, 2); |
472 | 472 | else |
473 | 473 | $dash = array($$side); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | switch ($side) { |
530 | 530 | |
531 | 531 | case "top": |
532 | - if ( $corner_style === "bevel" ) { |
|
532 | + if ($corner_style === "bevel") { |
|
533 | 533 | |
534 | 534 | $points = array($x, $y, |
535 | 535 | $x + $length, $y, |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | break; |
543 | 543 | |
544 | 544 | case "bottom": |
545 | - if ( $corner_style === "bevel" ) { |
|
545 | + if ($corner_style === "bevel") { |
|
546 | 546 | $points = array($x, $y, |
547 | 547 | $x + $length, $y, |
548 | 548 | $x + $length - $right, $y - $bottom, |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | break; |
555 | 555 | |
556 | 556 | case "left": |
557 | - if ( $corner_style === "bevel" ) { |
|
557 | + if ($corner_style === "bevel") { |
|
558 | 558 | $points = array($x, $y, |
559 | 559 | $x, $y + $length, |
560 | 560 | $x + $left, $y + $length - $bottom, |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | break; |
567 | 567 | |
568 | 568 | case "right": |
569 | - if ( $corner_style === "bevel" ) { |
|
569 | + if ($corner_style === "bevel") { |
|
570 | 570 | $points = array($x, $y, |
571 | 571 | $x, $y + $length, |
572 | 572 | $x - $right, $y + $length - $bottom, |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | switch ($side) { |
597 | 597 | |
598 | 598 | case "top": |
599 | - if ( $corner_style === "bevel" ) { |
|
599 | + if ($corner_style === "bevel") { |
|
600 | 600 | $left_line_width = $left / 4; |
601 | 601 | $right_line_width = $right / 4; |
602 | 602 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | break; |
621 | 621 | |
622 | 622 | case "bottom": |
623 | - if ( $corner_style === "bevel" ) { |
|
623 | + if ($corner_style === "bevel") { |
|
624 | 624 | $left_line_width = $left / 4; |
625 | 625 | $right_line_width = $right / 4; |
626 | 626 | |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | break; |
645 | 645 | |
646 | 646 | case "left": |
647 | - if ( $corner_style === "bevel" ) { |
|
647 | + if ($corner_style === "bevel") { |
|
648 | 648 | $top_line_width = $top / 4; |
649 | 649 | $bottom_line_width = $bottom / 4; |
650 | 650 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | break; |
669 | 669 | |
670 | 670 | case "right": |
671 | - if ( $corner_style === "bevel" ) { |
|
671 | + if ($corner_style === "bevel") { |
|
672 | 672 | $top_line_width = $top / 4; |
673 | 673 | $bottom_line_width = $bottom / 4; |
674 | 674 | |
@@ -784,14 +784,14 @@ discard block |
||
784 | 784 | } |
785 | 785 | |
786 | 786 | protected function _tint($c) { |
787 | - if ( !is_numeric($c) ) |
|
787 | + if (!is_numeric($c)) |
|
788 | 788 | return $c; |
789 | 789 | |
790 | 790 | return min(1, $c + 0.66); |
791 | 791 | } |
792 | 792 | |
793 | 793 | protected function _shade($c) { |
794 | - if ( !is_numeric($c) ) |
|
794 | + if (!is_numeric($c)) |
|
795 | 795 | return $c; |
796 | 796 | |
797 | 797 | return max(0, $c - 0.66); |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | $this->_frame->get_parent()->get_style()->height.";". |
78 | 78 | $this->_frame->get_parent()->get_parent()->get_style()->width.' '. |
79 | 79 | $this->_frame->get_parent()->get_parent()->get_style()->height.';'. |
80 | - $img_width. ' '. |
|
81 | - $img_height.'|' ; |
|
80 | + $img_width.' '. |
|
81 | + $img_height.'|'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // We need to check both the *parent's* style as well as the current node's because images are wrapped... |
@@ -92,39 +92,39 @@ discard block |
||
92 | 92 | //special ignored unit: e.g. 10ex: e treated as exponent; x ignored; 10e completely invalid ->like auto |
93 | 93 | |
94 | 94 | $width = ($style->width > 0 ? $style->width : ($stylep->width > 0 ? $stylep->width : 0)); |
95 | - if ( is_percent($width) ) { |
|
95 | + if (is_percent($width)) { |
|
96 | 96 | $t = 0.0; |
97 | 97 | for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) { |
98 | - $t = (float)($f->get_style()->width); //always in pt |
|
99 | - if ((float)$t != 0) { |
|
98 | + $t = (float) ($f->get_style()->width); //always in pt |
|
99 | + if ((float) $t != 0) { |
|
100 | 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 | 105 | // Don't set image original size if "%" branch was 0 or size not given. |
106 | 106 | // Otherwise aspect changed on %/auto combination for width/height |
107 | 107 | // Resample according to px per inch |
108 | 108 | // See also List_Bullet_Image_Frame_Decorator::__construct |
109 | - $width = (float)($width * 72) / DOMPDF_DPI; |
|
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 | - if ( is_percent($height) ) { |
|
113 | + if (is_percent($height)) { |
|
114 | 114 | $t = 0.0; |
115 | 115 | for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) { |
116 | - $t = (float)($f->get_style()->height); //always in pt |
|
117 | - if ((float)$t != 0) { |
|
116 | + $t = (float) ($f->get_style()->height); //always in pt |
|
117 | + if ((float) $t != 0) { |
|
118 | 118 | break; |
119 | 119 | } |
120 | 120 | } |
121 | - $height = ((float)rtrim($height,"%") * $t)/100; //maybe 0 |
|
121 | + $height = ((float) rtrim($height, "%") * $t) / 100; //maybe 0 |
|
122 | 122 | } else { |
123 | 123 | // Don't set image original size if "%" branch was 0 or size not given. |
124 | 124 | // Otherwise aspect changed on %/auto combination for width/height |
125 | 125 | // Resample according to px per inch |
126 | 126 | // See also List_Bullet_Image_Frame_Decorator::__construct |
127 | - $height = (float)($height * 72) / DOMPDF_DPI; |
|
127 | + $height = (float) ($height * 72) / DOMPDF_DPI; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | if ($width == 0 || $height == 0) { |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | // See also List_Bullet_Image_Frame_Decorator::__construct |
136 | 136 | |
137 | 137 | if ($width == 0 && $height == 0) { |
138 | - $width = (float)($img_width * 72) / DOMPDF_DPI; |
|
139 | - $height = (float)($img_height * 72) / DOMPDF_DPI; |
|
138 | + $width = (float) ($img_width * 72) / DOMPDF_DPI; |
|
139 | + $height = (float) ($img_height * 72) / DOMPDF_DPI; |
|
140 | 140 | } elseif ($height == 0 && $width != 0) { |
141 | 141 | $height = ($width / $img_width) * $img_height; //keep aspect ratio |
142 | 142 | } elseif ($width == 0 && $height != 0) { |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | |
149 | 149 | // Synchronize the styles |
150 | 150 | $inner_style = $this->_frame->get_style(); |
151 | - $inner_style->width = $style->width = $width . "pt"; |
|
152 | - $inner_style->height = $style->height = $height . "pt"; |
|
151 | + $inner_style->width = $style->width = $width."pt"; |
|
152 | + $inner_style->height = $style->height = $height."pt"; |
|
153 | 153 | |
154 | 154 | $inner_style->padding_top = $style->padding_top; |
155 | 155 | $inner_style->padding_right = $style->padding_right; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $inner_style->margin_bottom = $style->margin_bottom; |
172 | 172 | $inner_style->margin_left = $style->margin_left; |
173 | 173 | |
174 | - return array( $width, $width, "min" => $width, "max" => $width); |
|
174 | + return array($width, $width, "min" => $width, "max" => $width); |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | } |
@@ -54,24 +54,24 @@ |
||
54 | 54 | */ |
55 | 55 | private function __construct() { } |
56 | 56 | |
57 | - static function get_instance($paper = null, $orientation = null, $class = null) { |
|
57 | + static function get_instance($paper = null, $orientation = null, $class = null) { |
|
58 | 58 | |
59 | 59 | $backend = strtolower(DOMPDF_PDF_BACKEND); |
60 | 60 | |
61 | - if ( isset($class) && class_exists($class, false) ) |
|
61 | + if (isset($class) && class_exists($class, false)) |
|
62 | 62 | $class .= "_Adapter"; |
63 | 63 | |
64 | - else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "pdflib" ) && |
|
65 | - class_exists("PDFLib", false) ) |
|
64 | + else if ((DOMPDF_PDF_BACKEND === "auto" || $backend === "pdflib") && |
|
65 | + class_exists("PDFLib", false)) |
|
66 | 66 | $class = "PDFLib_Adapter"; |
67 | 67 | |
68 | - else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "cpdf") ) |
|
68 | + else if ((DOMPDF_PDF_BACKEND === "auto" || $backend === "cpdf")) |
|
69 | 69 | $class = "CPDF_Adapter"; |
70 | 70 | |
71 | - else if ( ( $backend === "tcpdf") ) |
|
71 | + else if (($backend === "tcpdf")) |
|
72 | 72 | $class = "TCPDF_Adapter"; |
73 | 73 | |
74 | - else if ( $backend === "gd" ) |
|
74 | + else if ($backend === "gd") |
|
75 | 75 | $class = "GD_Adapter"; |
76 | 76 | |
77 | 77 | else |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | // Check for end render callback |
106 | 106 | $this->_check_callbacks("end_page_render", $child); |
107 | 107 | |
108 | - if ( $next_child ) |
|
108 | + if ($next_child) |
|
109 | 109 | { |
110 | 110 | $this->_frame->next_page(); |
111 | 111 | } |
112 | 112 | |
113 | 113 | // Wait to dispose of all frames on the previous page |
114 | 114 | // so callback will have access to them |
115 | - if ( $prev_child ) |
|
115 | + if ($prev_child) |
|
116 | 116 | { |
117 | 117 | $prev_child->dispose(true); |
118 | 118 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | // Dispose of previous page if it still exists |
124 | - if ( $prev_child ) |
|
124 | + if ($prev_child) |
|
125 | 125 | { |
126 | 126 | $prev_child->dispose(true); |
127 | 127 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | /* $Id: font_metrics.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
48 | 48 | |
49 | -require_once(DOMPDF_LIB_DIR . "/class.pdf.php"); |
|
49 | +require_once(DOMPDF_LIB_DIR."/class.pdf.php"); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Name of the font cache file |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * |
60 | 60 | * Declared here because PHP5 prevents constants from being declared with expressions |
61 | 61 | */ |
62 | -if (file_exists(DOMPDF_FONT_DIR . "dompdf_font_family_cache")) { |
|
63 | - define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR . "dompdf_font_family_cache"); |
|
62 | +if (file_exists(DOMPDF_FONT_DIR."dompdf_font_family_cache")) { |
|
63 | + define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR."dompdf_font_family_cache"); |
|
64 | 64 | } else { |
65 | - define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR . "dompdf_font_family_cache.dist"); |
|
65 | + define('__DOMPDF_FONT_CACHE_FILE', DOMPDF_FONT_DIR."dompdf_font_family_cache.dist"); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * Only on checking the fallback font, check various subtypes on same font. |
158 | 158 | */ |
159 | 159 | |
160 | - if ( $family ) { |
|
161 | - $family = str_replace( array("'", '"'), "", mb_strtolower($family)); |
|
160 | + if ($family) { |
|
161 | + $family = str_replace(array("'", '"'), "", mb_strtolower($family)); |
|
162 | 162 | $subtype = mb_strtolower($subtype); |
163 | 163 | |
164 | - if ( isset(self::$_font_lookup[$family][$subtype]) ) { |
|
164 | + if (isset(self::$_font_lookup[$family][$subtype])) { |
|
165 | 165 | return self::$_font_lookup[$family][$subtype]; |
166 | 166 | } |
167 | 167 | return null; |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | |
170 | 170 | $family = DOMPDF_DEFAULT_FONT; |
171 | 171 | |
172 | - if ( isset(self::$_font_lookup[$family][$subtype]) ) { |
|
172 | + if (isset(self::$_font_lookup[$family][$subtype])) { |
|
173 | 173 | return self::$_font_lookup[$family][$subtype]; |
174 | 174 | } |
175 | 175 | |
176 | - foreach ( self::$_font_lookup[$family] as $sub => $font ) { |
|
176 | + foreach (self::$_font_lookup[$family] as $sub => $font) { |
|
177 | 177 | if (strpos($subtype, $sub) !== false) { |
178 | 178 | return $font; |
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | 182 | if ($subtype !== "normal") { |
183 | - foreach ( self::$_font_lookup[$family] as $sub => $font ) { |
|
183 | + foreach (self::$_font_lookup[$family] as $sub => $font) { |
|
184 | 184 | if ($sub !== "normal") { |
185 | 185 | return $font; |
186 | 186 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $subtype = "normal"; |
191 | 191 | |
192 | - if ( isset(self::$_font_lookup[$family][$subtype]) ) { |
|
192 | + if (isset(self::$_font_lookup[$family][$subtype])) { |
|
193 | 193 | return self::$_font_lookup[$family][$subtype]; |
194 | 194 | } |
195 | 195 | return null; |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * @see save_font_families() |
217 | 217 | */ |
218 | 218 | static function load_font_families() { |
219 | - if ( !is_readable(self::CACHE_FILE) ) |
|
219 | + if (!is_readable(self::CACHE_FILE)) |
|
220 | 220 | return; |
221 | 221 | |
222 | 222 | $data = file_get_contents(self::CACHE_FILE); |
223 | 223 | |
224 | - if ( $data != "" ) |
|
225 | - eval ('self::$_font_lookup = ' . $data . ";"); |
|
224 | + if ($data != "") |
|
225 | + eval ('self::$_font_lookup = '.$data.";"); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | list($x, $y, $w, $h) = $frame->get_padding_box(); |
55 | 55 | |
56 | 56 | // Draw our background, border and content |
57 | - if ( ($bg = $style->background_color) !== "transparent" ) { |
|
58 | - $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); |
|
57 | + if (($bg = $style->background_color) !== "transparent") { |
|
58 | + $this->_canvas->filled_rectangle($x, $y, $w, $h, $style->background_color); |
|
59 | 59 | } |
60 | 60 | |
61 | - if ( ($url = $style->background_image) && $url !== "none" ) |
|
61 | + if (($url = $style->background_image) && $url !== "none") |
|
62 | 62 | $this->_background_image($url, $x, $y, $w, $h, $style); |
63 | 63 | |
64 | 64 | |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | foreach ($bp as $side => $props) { |
82 | 82 | list($x, $y, $w, $h) = $bbox; |
83 | 83 | |
84 | - if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) |
|
84 | + if (!$props["style"] || $props["style"] === "none" || $props["width"] <= 0) |
|
85 | 85 | continue; |
86 | 86 | |
87 | 87 | |
88 | - switch($side) { |
|
88 | + switch ($side) { |
|
89 | 89 | case "top": |
90 | 90 | $length = $w; |
91 | 91 | break; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | default: |
107 | 107 | break; |
108 | 108 | } |
109 | - $method = "_border_" . $props["style"]; |
|
109 | + $method = "_border_".$props["style"]; |
|
110 | 110 | |
111 | 111 | $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style); |
112 | 112 | } |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | |
58 | 58 | function split($frame = null) { |
59 | 59 | |
60 | - if ( is_null($frame) ) { |
|
60 | + if (is_null($frame)) { |
|
61 | 61 | $this->get_parent()->split($this); |
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - if ( $frame->get_parent() !== $this ) |
|
65 | + if ($frame->get_parent() !== $this) |
|
66 | 66 | throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
67 | 67 | |
68 | - $split = $this->copy( $this->_frame->get_node()->cloneNode() ); |
|
68 | + $split = $this->copy($this->_frame->get_node()->cloneNode()); |
|
69 | 69 | $this->get_parent()->insert_child_after($split, $this); |
70 | 70 | |
71 | 71 | // Unset the current node's right style properties |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | //On continuation of inline element on next line, |
85 | 85 | //don't repeat non-vertically repeatble background images |
86 | 86 | //See e.g. in testcase image_variants, long desriptions |
87 | - if ( ($url = $style->background_image) && $url !== "none" |
|
88 | - && ($repeat = $style->background_repeat) && $repeat !== "repeat" && $repeat !== "repeat-y" |
|
87 | + if (($url = $style->background_image) && $url !== "none" |
|
88 | + && ($repeat = $style->background_repeat) && $repeat !== "repeat" && $repeat !== "repeat-y" |
|
89 | 89 | ) { |
90 | 90 | $style->background_image = "none"; |
91 | 91 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | function render(Frame $frame) { |
80 | 80 | global $_dompdf_debug; |
81 | 81 | |
82 | - if ( $_dompdf_debug ) { |
|
82 | + if ($_dompdf_debug) { |
|
83 | 83 | echo $frame; |
84 | 84 | flush(); |
85 | 85 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | break; |
101 | 101 | |
102 | 102 | case "inline": |
103 | - if ( $frame->get_node()->nodeName === "#text" ) |
|
103 | + if ($frame->get_node()->nodeName === "#text") |
|
104 | 104 | $this->_render_frame("text", $frame); |
105 | 105 | else |
106 | 106 | $this->_render_frame("inline", $frame); |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | case "none": |
122 | 122 | $node = $frame->get_node(); |
123 | 123 | |
124 | - if ( $node->nodeName === "script" ) { |
|
125 | - if ( $node->getAttribute("type") === "text/php" || |
|
126 | - $node->getAttribute("language") === "php" ) { |
|
124 | + if ($node->nodeName === "script") { |
|
125 | + if ($node->getAttribute("type") === "text/php" || |
|
126 | + $node->getAttribute("language") === "php") { |
|
127 | 127 | // Evaluate embedded php scripts |
128 | 128 | $this->_render_frame("php", $frame); |
129 | 129 | } |
130 | 130 | |
131 | - elseif ( $node->getAttribute("type") === "text/javascript" || |
|
132 | - $node->getAttribute("language") === "javascript" ) { |
|
131 | + elseif ($node->getAttribute("type") === "text/javascript" || |
|
132 | + $node->getAttribute("language") === "javascript") { |
|
133 | 133 | // Insert JavaScript |
134 | 134 | $this->_render_frame("javascript", $frame); |
135 | 135 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | protected function _render_frame($type, $frame) { |
194 | 194 | |
195 | - if ( !isset($this->_renderers[$type]) ) { |
|
195 | + if (!isset($this->_renderers[$type])) { |
|
196 | 196 | |
197 | 197 | switch ($type) { |
198 | 198 | case "block": |