@@ -112,25 +112,29 @@ discard block |
||
112 | 112 | |
113 | 113 | $preferred_width = $style->length_in_pt($width, $cb["w"]) - $delta; |
114 | 114 | |
115 | - if ( $preferred_width < $min_table_width ) |
|
116 | - $preferred_width = $min_table_width; |
|
115 | + if ( $preferred_width < $min_table_width ) { |
|
116 | + $preferred_width = $min_table_width; |
|
117 | + } |
|
117 | 118 | |
118 | - if ( $preferred_width > $min_width ) |
|
119 | - $width = $preferred_width; |
|
120 | - else |
|
121 | - $width = $min_width; |
|
119 | + if ( $preferred_width > $min_width ) { |
|
120 | + $width = $preferred_width; |
|
121 | + } else { |
|
122 | + $width = $min_width; |
|
123 | + } |
|
122 | 124 | |
123 | 125 | } else { |
124 | 126 | |
125 | - if ( $max_width + $delta < $cb["w"] ) |
|
126 | - $width = $max_width; |
|
127 | - else if ( $cb["w"] - $delta > $min_width ) |
|
128 | - $width = $cb["w"] - $delta; |
|
129 | - else |
|
130 | - $width = $min_width; |
|
127 | + if ( $max_width + $delta < $cb["w"] ) { |
|
128 | + $width = $max_width; |
|
129 | + } else if ( $cb["w"] - $delta > $min_width ) { |
|
130 | + $width = $cb["w"] - $delta; |
|
131 | + } else { |
|
132 | + $width = $min_width; |
|
133 | + } |
|
131 | 134 | |
132 | - if ( $width < $min_table_width ) |
|
133 | - $width = $min_table_width; |
|
135 | + if ( $width < $min_table_width ) { |
|
136 | + $width = $min_table_width; |
|
137 | + } |
|
134 | 138 | |
135 | 139 | } |
136 | 140 | |
@@ -142,8 +146,9 @@ discard block |
||
142 | 146 | // If the whole table fits on the page, then assign each column it's max width |
143 | 147 | if ( $width == $max_width ) { |
144 | 148 | |
145 | - foreach (array_keys($columns) as $i) |
|
146 | - $cellmap->set_column_width($i, $columns[$i]["max-width"]); |
|
149 | + foreach (array_keys($columns) as $i) { |
|
150 | + $cellmap->set_column_width($i, $columns[$i]["max-width"]); |
|
151 | + } |
|
147 | 152 | |
148 | 153 | return; |
149 | 154 | } |
@@ -171,8 +176,9 @@ discard block |
||
171 | 176 | if ( $absolute_used == 0 && $percent_used == 0 ) { |
172 | 177 | $increment = $width - $min_width; |
173 | 178 | |
174 | - foreach (array_keys($columns) as $i) |
|
175 | - $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width)); |
|
179 | + foreach (array_keys($columns) as $i) { |
|
180 | + $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width)); |
|
181 | + } |
|
176 | 182 | return; |
177 | 183 | } |
178 | 184 | |
@@ -180,17 +186,18 @@ discard block |
||
180 | 186 | // Case 2 |
181 | 187 | if ( $absolute_used > 0 && $percent_used == 0 ) { |
182 | 188 | |
183 | - if ( count($auto) > 0 ) |
|
184 | - $increment = ($width - $auto_min - $absolute_used) / count($auto); |
|
189 | + if ( count($auto) > 0 ) { |
|
190 | + $increment = ($width - $auto_min - $absolute_used) / count($auto); |
|
191 | + } |
|
185 | 192 | |
186 | 193 | // Use the absolutely specified width or the increment |
187 | 194 | foreach (array_keys($columns) as $i) { |
188 | 195 | |
189 | - if ( $columns[$i]["absolute"] > 0 && count($auto) ) |
|
190 | - $cellmap->set_column_width($i, $columns[$i]["min-width"]); |
|
191 | - else if ( count($auto) ) |
|
192 | - $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment); |
|
193 | - else { |
|
196 | + if ( $columns[$i]["absolute"] > 0 && count($auto) ) { |
|
197 | + $cellmap->set_column_width($i, $columns[$i]["min-width"]); |
|
198 | + } else if ( count($auto) ) { |
|
199 | + $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment); |
|
200 | + } else { |
|
194 | 201 | // All absolute columns |
195 | 202 | $increment = ($width - $absolute_used) * $columns[$i]["absolute"] / $absolute_used; |
196 | 203 | |
@@ -210,10 +217,11 @@ discard block |
||
210 | 217 | |
211 | 218 | // Scale percent values if the total percentage is > 100, or if all |
212 | 219 | // values are specified as percentages. |
213 | - if ( $percent_used > 100 || count($auto) == 0) |
|
214 | - $scale = 100 / $percent_used; |
|
215 | - else |
|
216 | - $scale = 1; |
|
220 | + if ( $percent_used > 100 || count($auto) == 0) { |
|
221 | + $scale = 100 / $percent_used; |
|
222 | + } else { |
|
223 | + $scale = 1; |
|
224 | + } |
|
217 | 225 | |
218 | 226 | // Account for the minimum space used by the unassigned auto columns |
219 | 227 | $used_width = $auto_min; |
@@ -225,8 +233,9 @@ discard block |
||
225 | 233 | |
226 | 234 | $w = min($columns[$i]["percent"] * $width/100, $slack); |
227 | 235 | |
228 | - if ( $w < $columns[$i]["min-width"] ) |
|
229 | - $w = $columns[$i]["min-width"]; |
|
236 | + if ( $w < $columns[$i]["min-width"] ) { |
|
237 | + $w = $columns[$i]["min-width"]; |
|
238 | + } |
|
230 | 239 | |
231 | 240 | $cellmap->set_column_width($i, $w); |
232 | 241 | $used_width += $w; |
@@ -238,8 +247,9 @@ discard block |
||
238 | 247 | if ( count($auto) > 0 ) { |
239 | 248 | $increment = ($width - $used_width) / count($auto); |
240 | 249 | |
241 | - foreach ($auto as $i) |
|
242 | - $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment); |
|
250 | + foreach ($auto as $i) { |
|
251 | + $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment); |
|
252 | + } |
|
243 | 253 | |
244 | 254 | } |
245 | 255 | return; |
@@ -259,10 +269,11 @@ discard block |
||
259 | 269 | |
260 | 270 | // Scale percent values if the total percentage is > 100 or there |
261 | 271 | // are no auto values to take up slack |
262 | - if ( $percent_used > 100 || count($auto) == 0 ) |
|
263 | - $scale = 100 / $percent_used; |
|
264 | - else |
|
265 | - $scale = 1; |
|
272 | + if ( $percent_used > 100 || count($auto) == 0 ) { |
|
273 | + $scale = 100 / $percent_used; |
|
274 | + } else { |
|
275 | + $scale = 1; |
|
276 | + } |
|
266 | 277 | |
267 | 278 | $remaining_width = $width - $used_width; |
268 | 279 | |
@@ -272,8 +283,9 @@ discard block |
||
272 | 283 | $columns[$i]["percent"] *= $scale; |
273 | 284 | $w = min($columns[$i]["percent"] * $remaining_width / 100, $slack); |
274 | 285 | |
275 | - if ( $w < $columns[$i]["min-width"] ) |
|
276 | - $w = $columns[$i]["min-width"]; |
|
286 | + if ( $w < $columns[$i]["min-width"] ) { |
|
287 | + $w = $columns[$i]["min-width"]; |
|
288 | + } |
|
277 | 289 | |
278 | 290 | $columns[$i]["used-width"] = $w; |
279 | 291 | $used_width += $w; |
@@ -282,8 +294,9 @@ discard block |
||
282 | 294 | if ( count($auto) > 0 ) { |
283 | 295 | $increment = ($width - $used_width) / count($auto); |
284 | 296 | |
285 | - foreach ($auto as $i) |
|
286 | - $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment); |
|
297 | + foreach ($auto as $i) { |
|
298 | + $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment); |
|
299 | + } |
|
287 | 300 | |
288 | 301 | } |
289 | 302 | |
@@ -294,8 +307,9 @@ discard block |
||
294 | 307 | } else { // we are over constrained |
295 | 308 | |
296 | 309 | // Each column gets its minimum width |
297 | - foreach (array_keys($columns) as $i) |
|
298 | - $cellmap->set_column_width($i, $columns[$i]["min-width"]); |
|
310 | + foreach (array_keys($columns) as $i) { |
|
311 | + $cellmap->set_column_width($i, $columns[$i]["min-width"]); |
|
312 | + } |
|
299 | 313 | |
300 | 314 | } |
301 | 315 | } |
@@ -314,8 +328,9 @@ discard block |
||
314 | 328 | |
315 | 329 | // Determine our content height |
316 | 330 | $content_height = 0; |
317 | - foreach ( $rows as $r ) |
|
318 | - $content_height += $r["height"]; |
|
331 | + foreach ( $rows as $r ) { |
|
332 | + $content_height += $r["height"]; |
|
333 | + } |
|
319 | 334 | |
320 | 335 | $cb = $this->_frame->get_containing_block(); |
321 | 336 | |
@@ -333,26 +348,31 @@ discard block |
||
333 | 348 | |
334 | 349 | } else if ( isset($cb["w"]) ) { |
335 | 350 | |
336 | - if ( mb_strpos($min_height, "%") !== false ) |
|
337 | - $min_height = 0; |
|
338 | - else |
|
339 | - $min_height = $style->length_in_pt($min_height, $cb["w"]); |
|
351 | + if ( mb_strpos($min_height, "%") !== false ) { |
|
352 | + $min_height = 0; |
|
353 | + } else { |
|
354 | + $min_height = $style->length_in_pt($min_height, $cb["w"]); |
|
355 | + } |
|
340 | 356 | |
341 | - if ( mb_strpos($max_height, "%") !== false ) |
|
342 | - $max_height = "none"; |
|
343 | - else |
|
344 | - $max_height = $style->length_in_pt($max_height, $cb["w"]); |
|
357 | + if ( mb_strpos($max_height, "%") !== false ) { |
|
358 | + $max_height = "none"; |
|
359 | + } else { |
|
360 | + $max_height = $style->length_in_pt($max_height, $cb["w"]); |
|
361 | + } |
|
345 | 362 | } |
346 | 363 | |
347 | - if ( $max_height !== "none" && $min_height > $max_height ) |
|
348 | - // Swap 'em |
|
364 | + if ( $max_height !== "none" && $min_height > $max_height ) { |
|
365 | + // Swap 'em |
|
349 | 366 | list($max_height, $min_height) = array($min_height, $max_height); |
367 | + } |
|
350 | 368 | |
351 | - if ( $max_height !== "none" && $height > $max_height ) |
|
352 | - $height = $max_height; |
|
369 | + if ( $max_height !== "none" && $height > $max_height ) { |
|
370 | + $height = $max_height; |
|
371 | + } |
|
353 | 372 | |
354 | - if ( $height < $min_height ) |
|
355 | - $height = $min_height; |
|
373 | + if ( $height < $min_height ) { |
|
374 | + $height = $min_height; |
|
375 | + } |
|
356 | 376 | |
357 | 377 | } else { |
358 | 378 | |
@@ -360,13 +380,15 @@ discard block |
||
360 | 380 | if ( $height !== "auto" ) { |
361 | 381 | $height = $style->length_in_pt($height, $cb["h"]); |
362 | 382 | |
363 | - if ( $height <= $content_height ) |
|
364 | - $height = $content_height; |
|
365 | - else |
|
366 | - $cellmap->set_frame_heights($height,$content_height); |
|
383 | + if ( $height <= $content_height ) { |
|
384 | + $height = $content_height; |
|
385 | + } else { |
|
386 | + $cellmap->set_frame_heights($height,$content_height); |
|
387 | + } |
|
367 | 388 | |
368 | - } else |
|
369 | - $height = $content_height; |
|
389 | + } else { |
|
390 | + $height = $content_height; |
|
391 | + } |
|
370 | 392 | |
371 | 393 | } |
372 | 394 | |
@@ -382,8 +404,9 @@ discard block |
||
382 | 404 | $page->check_forced_page_break($this->_frame); |
383 | 405 | |
384 | 406 | // Bail if the page is full |
385 | - if ( $page->is_full() ) |
|
386 | - return; |
|
407 | + if ( $page->is_full() ) { |
|
408 | + return; |
|
409 | + } |
|
387 | 410 | |
388 | 411 | // Let the page know that we're reflowing a table so that splits |
389 | 412 | // are suppressed (simply setting page-break-inside: avoid won't |
@@ -400,8 +423,9 @@ discard block |
||
400 | 423 | // Table layout algorithm: |
401 | 424 | // http://www.w3.org/TR/CSS21/tables.html#auto-table-layout |
402 | 425 | |
403 | - if ( is_null($this->_state) ) |
|
404 | - $this->get_min_max_width(); |
|
426 | + if ( is_null($this->_state) ) { |
|
427 | + $this->get_min_max_width(); |
|
428 | + } |
|
405 | 429 | |
406 | 430 | $cb = $this->_frame->get_containing_block(); |
407 | 431 | $style = $this->_frame->get_style(); |
@@ -455,10 +479,11 @@ discard block |
||
455 | 479 | $style->border_top_width, |
456 | 480 | $style->padding_top), $cb["w"]); |
457 | 481 | |
458 | - if ( isset($cb["h"]) ) |
|
459 | - $h = $cb["h"]; |
|
460 | - else |
|
461 | - $h = null; |
|
482 | + if ( isset($cb["h"]) ) { |
|
483 | + $h = $cb["h"]; |
|
484 | + } else { |
|
485 | + $h = null; |
|
486 | + } |
|
462 | 487 | |
463 | 488 | |
464 | 489 | $cellmap = $this->_frame->get_cellmap(); |
@@ -474,15 +499,17 @@ discard block |
||
474 | 499 | foreach ( $this->_frame->get_children() as $child ) { |
475 | 500 | |
476 | 501 | // Bail if the page is full |
477 | - if ( !$page->in_nested_table() && $page->is_full() ) |
|
478 | - break; |
|
502 | + if ( !$page->in_nested_table() && $page->is_full() ) { |
|
503 | + break; |
|
504 | + } |
|
479 | 505 | |
480 | 506 | $child->set_containing_block($content_x, $content_y, $width, $h); |
481 | 507 | $child->reflow(); |
482 | 508 | |
483 | - if ( !$page->in_nested_table() ) |
|
484 | - // Check if a split has occured |
|
509 | + if ( !$page->in_nested_table() ) { |
|
510 | + // Check if a split has occured |
|
485 | 511 | $page->check_page_break($child); |
512 | + } |
|
486 | 513 | |
487 | 514 | } |
488 | 515 | |
@@ -504,8 +531,9 @@ discard block |
||
504 | 531 | |
505 | 532 | function get_min_max_width() { |
506 | 533 | |
507 | - if ( !is_null($this->_min_max_cache) ) |
|
508 | - return $this->_min_max_cache; |
|
534 | + if ( !is_null($this->_min_max_cache) ) { |
|
535 | + return $this->_min_max_cache; |
|
536 | + } |
|
509 | 537 | |
510 | 538 | $style = $this->_frame->get_style(); |
511 | 539 | |
@@ -556,8 +584,9 @@ discard block |
||
556 | 584 | $style->margin_left, |
557 | 585 | $style->margin_right); |
558 | 586 | |
559 | - if ( $style->border_collapse !== "collapse" ) |
|
560 | - list($dims[]) = $style->border_spacing; |
|
587 | + if ( $style->border_collapse !== "collapse" ) { |
|
588 | + list($dims[]) = $style->border_spacing; |
|
589 | + } |
|
561 | 590 | |
562 | 591 | $delta = $style->length_in_pt($dims, $this->_frame->get_containing_block("w")); |
563 | 592 |
@@ -109,8 +109,9 @@ discard block |
||
109 | 109 | function install_font_family($fontname, $normal, $bold = null, $italic = null, $bold_italic = null) { |
110 | 110 | |
111 | 111 | // Check if the base filename is readable |
112 | - if ( !is_readable($normal) ) |
|
113 | - throw new DOMPDF_Exception("Unable to read '$normal'."); |
|
112 | + if ( !is_readable($normal) ) { |
|
113 | + throw new DOMPDF_Exception("Unable to read '$normal'."); |
|
114 | + } |
|
114 | 115 | |
115 | 116 | $dir = dirname($normal); |
116 | 117 | $basename = basename($normal); |
@@ -135,14 +136,16 @@ discard block |
||
135 | 136 | |
136 | 137 | // Try $file . "B" |
137 | 138 | $bold = $dir . "/" . $file . "B" . $ext; |
138 | - if ( !is_readable($bold) ) |
|
139 | - $bold = null; |
|
139 | + if ( !is_readable($bold) ) { |
|
140 | + $bold = null; |
|
141 | + } |
|
140 | 142 | } |
141 | 143 | } |
142 | 144 | } |
143 | 145 | |
144 | - if ( is_null($bold) ) |
|
145 | - echo ("Unable to find bold face file.\n"); |
|
146 | + if ( is_null($bold) ) { |
|
147 | + echo ("Unable to find bold face file.\n"); |
|
148 | + } |
|
146 | 149 | |
147 | 150 | if ( !isset($italic) || !is_readable($italic) ) { |
148 | 151 | $italic = $dir . "/" . $file . "_Italic" . $ext; |
@@ -154,14 +157,16 @@ discard block |
||
154 | 157 | |
155 | 158 | // Try $file . "I" |
156 | 159 | $italic = $dir . "/" . $file . "I" . $ext; |
157 | - if ( !is_readable($italic) ) |
|
158 | - $italic = null; |
|
160 | + if ( !is_readable($italic) ) { |
|
161 | + $italic = null; |
|
162 | + } |
|
159 | 163 | } |
160 | 164 | } |
161 | 165 | } |
162 | 166 | |
163 | - if ( is_null($italic) ) |
|
164 | - echo ("Unable to find italic face file.\n"); |
|
167 | + if ( is_null($italic) ) { |
|
168 | + echo ("Unable to find italic face file.\n"); |
|
169 | + } |
|
165 | 170 | |
166 | 171 | if ( !isset($bold_italic) || !is_readable($bold_italic) ) { |
167 | 172 | $bold_italic = $dir . "/" . $file . "_Bold_Italic" . $ext; |
@@ -182,16 +187,18 @@ discard block |
||
182 | 187 | |
183 | 188 | // Try $file . "IB" |
184 | 189 | $bold_italic = $dir . "/" . $file . "IB" . $ext; |
185 | - if ( !is_readable($bold_italic) ) |
|
186 | - $bold_italic = null; |
|
190 | + if ( !is_readable($bold_italic) ) { |
|
191 | + $bold_italic = null; |
|
192 | + } |
|
187 | 193 | } |
188 | 194 | } |
189 | 195 | } |
190 | 196 | } |
191 | 197 | } |
192 | 198 | |
193 | - if ( is_null($bold_italic) ) |
|
194 | - echo ("Unable to find bold italic face file.\n"); |
|
199 | + if ( is_null($bold_italic) ) { |
|
200 | + echo ("Unable to find bold italic face file.\n"); |
|
201 | + } |
|
195 | 202 | |
196 | 203 | $fonts = compact("normal", "bold", "italic", "bold_italic"); |
197 | 204 | $entry = array(); |
@@ -207,23 +214,27 @@ discard block |
||
207 | 214 | } |
208 | 215 | |
209 | 216 | // Verify that the fonts exist and are readable |
210 | - if ( !is_readable($src) ) |
|
211 | - throw new User_DOMPDF_Exception("Requested font '$pathname' is not readable"); |
|
217 | + if ( !is_readable($src) ) { |
|
218 | + throw new User_DOMPDF_Exception("Requested font '$pathname' is not readable"); |
|
219 | + } |
|
212 | 220 | |
213 | 221 | $dest = DOMPDF_FONT_DIR . basename($src); |
214 | - if ( !is_writeable(dirname($dest)) ) |
|
215 | - throw new User_DOMPDF_Exception("Unable to write to destination '$dest'."); |
|
222 | + if ( !is_writeable(dirname($dest)) ) { |
|
223 | + throw new User_DOMPDF_Exception("Unable to write to destination '$dest'."); |
|
224 | + } |
|
216 | 225 | |
217 | 226 | echo "Copying $src to $dest...\n"; |
218 | 227 | |
219 | - if ( !copy($src, $dest) ) |
|
220 | - throw new DOMPDF_Exception("Unable to copy '$src' to '" . DOMPDF_FONT_DIR . "$dest'."); |
|
228 | + if ( !copy($src, $dest) ) { |
|
229 | + throw new DOMPDF_Exception("Unable to copy '$src' to '" . DOMPDF_FONT_DIR . "$dest'."); |
|
230 | + } |
|
221 | 231 | |
222 | 232 | $entry[$var] = $dest; |
223 | 233 | } |
224 | 234 | |
225 | - } else |
|
226 | - throw new DOMPDF_Exception("Unable to process fonts of type '$ext'."); |
|
235 | + } else { |
|
236 | + throw new DOMPDF_Exception("Unable to process fonts of type '$ext'."); |
|
237 | + } |
|
227 | 238 | |
228 | 239 | |
229 | 240 | // If the extension is a ttf, try and convert the fonts to afm too |
@@ -1589,8 +1589,9 @@ discard block |
||
1589 | 1589 | "<< /Type /ExtGState\n"; |
1590 | 1590 | |
1591 | 1591 | foreach ($o["info"] as $parameter => $value) { |
1592 | - if ( !in_array($parameter, $valid_params)) |
|
1593 | - continue; |
|
1592 | + if ( !in_array($parameter, $valid_params)) { |
|
1593 | + continue; |
|
1594 | + } |
|
1594 | 1595 | $res.= "/$parameter $value\n"; |
1595 | 1596 | } |
1596 | 1597 | |
@@ -2514,13 +2515,15 @@ discard block |
||
2514 | 2515 | "ColorDogde", "ColorBurn", "HardLight", |
2515 | 2516 | "SoftLight", "Difference", "Exclusion"); |
2516 | 2517 | |
2517 | - if ( !in_array($mode, $blend_modes) ) |
|
2518 | - $mode = "Normal"; |
|
2518 | + if ( !in_array($mode, $blend_modes) ) { |
|
2519 | + $mode = "Normal"; |
|
2520 | + } |
|
2519 | 2521 | |
2520 | 2522 | // Only create a new graphics state if required |
2521 | 2523 | if ( $mode == $this->currentLineTransparency["mode"] && |
2522 | - $opacity == $this->currentLineTransparency["opacity"] ) |
|
2523 | - return; |
|
2524 | + $opacity == $this->currentLineTransparency["opacity"] ) { |
|
2525 | + return; |
|
2526 | + } |
|
2524 | 2527 | |
2525 | 2528 | $options = array("BM" => "/$mode", |
2526 | 2529 | "CA" => (float)$opacity); |
@@ -2546,12 +2549,14 @@ discard block |
||
2546 | 2549 | "ColorDogde", "ColorBurn", "HardLight", |
2547 | 2550 | "SoftLight", "Difference", "Exclusion"); |
2548 | 2551 | |
2549 | - if ( !in_array($mode, $blend_modes) ) |
|
2550 | - $mode = "Normal"; |
|
2552 | + if ( !in_array($mode, $blend_modes) ) { |
|
2553 | + $mode = "Normal"; |
|
2554 | + } |
|
2551 | 2555 | |
2552 | 2556 | if ( $mode == $this->currentFillTransparency["mode"] && |
2553 | - $opacity == $this->currentFillTransparency["opacity"] ) |
|
2554 | - return; |
|
2557 | + $opacity == $this->currentFillTransparency["opacity"] ) { |
|
2558 | + return; |
|
2559 | + } |
|
2555 | 2560 | |
2556 | 2561 | $options = array("BM" => "/$mode", |
2557 | 2562 | "ca" => (float)$opacity); |
@@ -2840,8 +2845,9 @@ discard block |
||
2840 | 2845 | $options = array(); |
2841 | 2846 | } |
2842 | 2847 | |
2843 | - if ( headers_sent()) |
|
2844 | - die("Unable to stream pdf: headers already sent"); |
|
2848 | + if ( headers_sent()) { |
|
2849 | + die("Unable to stream pdf: headers already sent"); |
|
2850 | + } |
|
2845 | 2851 | |
2846 | 2852 | if ( isset($options['compress']) && $options['compress'] == 0) { |
2847 | 2853 | $tmp = ltrim($this->output(1)); |
@@ -2856,8 +2862,9 @@ discard block |
||
2856 | 2862 | header("Content-Length: " . mb_strlen($tmp, '8bit')); |
2857 | 2863 | $fileName = (isset($options['Content-Disposition']) ? $options['Content-Disposition'] : 'file.pdf'); |
2858 | 2864 | |
2859 | - if ( !isset($options["Attachment"])) |
|
2860 | - $options["Attachment"] = true; |
|
2865 | + if ( !isset($options["Attachment"])) { |
|
2866 | + $options["Attachment"] = true; |
|
2867 | + } |
|
2861 | 2868 | |
2862 | 2869 | $attachment = $options["Attachment"] ? "attachment" : "inline"; |
2863 | 2870 | |
@@ -3035,7 +3042,9 @@ discard block |
||
3035 | 3042 | */ |
3036 | 3043 | function utf8toUtf16BE(&$text, $bom = true) { |
3037 | 3044 | $cf = $this->currentFont; |
3038 | - if (!$this->fonts[$cf]['isUnicode']) return $text; |
|
3045 | + if (!$this->fonts[$cf]['isUnicode']) { |
|
3046 | + return $text; |
|
3047 | + } |
|
3039 | 3048 | $out = $bom ? "\xFE\xFF" : ''; |
3040 | 3049 | |
3041 | 3050 | $unicode = $this->utf8toCodePointsArray($text); |
@@ -3817,8 +3826,9 @@ discard block |
||
3817 | 3826 | * return a storable representation of a specific object |
3818 | 3827 | */ |
3819 | 3828 | function serializeObject($id) { |
3820 | - if ( array_key_exists($id, $this->objects)) |
|
3821 | - return var_export($this->objects[$id], true); |
|
3829 | + if ( array_key_exists($id, $this->objects)) { |
|
3830 | + return var_export($this->objects[$id], true); |
|
3831 | + } |
|
3822 | 3832 | } |
3823 | 3833 | |
3824 | 3834 | |
@@ -3908,7 +3918,9 @@ discard block |
||
3908 | 3918 | $error = 0; |
3909 | 3919 | //DEBUG_IMG_TEMP |
3910 | 3920 | //debugpng |
3911 | - if (DEBUGPNG) print '[addImagePng '.$file.']'; |
|
3921 | + if (DEBUGPNG) { |
|
3922 | + print '[addImagePng '.$file.']'; |
|
3923 | + } |
|
3912 | 3924 | |
3913 | 3925 | ob_start(); |
3914 | 3926 | @imagepng($img); |
@@ -3920,7 +3932,9 @@ discard block |
||
3920 | 3932 | $errormsg = 'trouble writing file from GD'; |
3921 | 3933 | //DEBUG_IMG_TEMP |
3922 | 3934 | //debugpng |
3923 | - if (DEBUGPNG) print 'trouble writing file from GD'; |
|
3935 | + if (DEBUGPNG) { |
|
3936 | + print 'trouble writing file from GD'; |
|
3937 | + } |
|
3924 | 3938 | } |
3925 | 3939 | |
3926 | 3940 | if ($error) { |
@@ -4002,7 +4016,9 @@ discard block |
||
4002 | 4016 | if (mb_substr($data, 0, 8, '8bit') != $header) { |
4003 | 4017 | $error = 1; |
4004 | 4018 | //debugpng |
4005 | - if (DEBUGPNG) print '[addPngFromFile this file does not have a valid header '.$file.']'; |
|
4019 | + if (DEBUGPNG) { |
|
4020 | + print '[addPngFromFile this file does not have a valid header '.$file.']'; |
|
4021 | + } |
|
4006 | 4022 | |
4007 | 4023 | $errormsg = 'this file does not have a valid header'; |
4008 | 4024 | } |
@@ -4041,7 +4057,9 @@ discard block |
||
4041 | 4057 | $error = 1; |
4042 | 4058 | |
4043 | 4059 | //debugpng |
4044 | - if (DEBUGPNG) print '[addPngFromFile unsupported compression method '.$file.']'; |
|
4060 | + if (DEBUGPNG) { |
|
4061 | + print '[addPngFromFile unsupported compression method '.$file.']'; |
|
4062 | + } |
|
4045 | 4063 | |
4046 | 4064 | $errormsg = 'unsupported compression method'; |
4047 | 4065 | } |
@@ -4050,7 +4068,9 @@ discard block |
||
4050 | 4068 | $error = 1; |
4051 | 4069 | |
4052 | 4070 | //debugpng |
4053 | - if (DEBUGPNG) print '[addPngFromFile unsupported filter method '.$file.']'; |
|
4071 | + if (DEBUGPNG) { |
|
4072 | + print '[addPngFromFile unsupported filter method '.$file.']'; |
|
4073 | + } |
|
4054 | 4074 | |
4055 | 4075 | $errormsg = 'unsupported filter method'; |
4056 | 4076 | } |
@@ -4117,7 +4137,9 @@ discard block |
||
4117 | 4137 | } else { |
4118 | 4138 | //unsupported transparency type |
4119 | 4139 | //debugpng |
4120 | - if (DEBUGPNG) print '[addPngFromFile unsupported transparency type '.$file.']'; |
|
4140 | + if (DEBUGPNG) { |
|
4141 | + print '[addPngFromFile unsupported transparency type '.$file.']'; |
|
4142 | + } |
|
4121 | 4143 | } |
4122 | 4144 | // KS End new code |
4123 | 4145 | break; |
@@ -4134,7 +4156,9 @@ discard block |
||
4134 | 4156 | $error = 1; |
4135 | 4157 | |
4136 | 4158 | //debugpng |
4137 | - if (DEBUGPNG) print '[addPngFromFile information header is missing '.$file.']'; |
|
4159 | + if (DEBUGPNG) { |
|
4160 | + print '[addPngFromFile information header is missing '.$file.']'; |
|
4161 | + } |
|
4138 | 4162 | |
4139 | 4163 | $errormsg = 'information header is missing'; |
4140 | 4164 | } |
@@ -4143,7 +4167,9 @@ discard block |
||
4143 | 4167 | $error = 1; |
4144 | 4168 | |
4145 | 4169 | //debugpng |
4146 | - if (DEBUGPNG) print '[addPngFromFile no support for interlaced images in pdf '.$file.']'; |
|
4170 | + if (DEBUGPNG) { |
|
4171 | + print '[addPngFromFile no support for interlaced images in pdf '.$file.']'; |
|
4172 | + } |
|
4147 | 4173 | |
4148 | 4174 | $errormsg = 'There appears to be no support for interlaced images in pdf.'; |
4149 | 4175 | } |
@@ -4153,7 +4179,9 @@ discard block |
||
4153 | 4179 | $error = 1; |
4154 | 4180 | |
4155 | 4181 | //debugpng |
4156 | - if (DEBUGPNG) print '[addPngFromFile bit depth of 8 or less is supported '.$file.']'; |
|
4182 | + if (DEBUGPNG) { |
|
4183 | + print '[addPngFromFile bit depth of 8 or less is supported '.$file.']'; |
|
4184 | + } |
|
4157 | 4185 | |
4158 | 4186 | $errormsg = 'only bit depth of 8 or less is supported'; |
4159 | 4187 | } |
@@ -4163,7 +4191,9 @@ discard block |
||
4163 | 4191 | $error = 1; |
4164 | 4192 | |
4165 | 4193 | //debugpng |
4166 | - if (DEBUGPNG) print '[addPngFromFile alpha channel not supported: '.$info['colorType'].' '.$file.']'; |
|
4194 | + if (DEBUGPNG) { |
|
4195 | + print '[addPngFromFile alpha channel not supported: '.$info['colorType'].' '.$file.']'; |
|
4196 | + } |
|
4167 | 4197 | |
4168 | 4198 | $errormsg = 'transparancey alpha channel not supported, transparency only supported for palette images.'; |
4169 | 4199 | } else { |
@@ -110,8 +110,9 @@ discard block |
||
110 | 110 | if (strpos($type, 'pie') !== false) { |
111 | 111 | $this->generateTABLECOLUMN($i + 2, '0'); |
112 | 112 | break; |
113 | - }else |
|
114 | - $this->generateTABLECOLUMN($i + 2, $dats[0][$i]); |
|
113 | + } else { |
|
114 | + $this->generateTABLECOLUMN($i + 2, $dats[0][$i]); |
|
115 | + } |
|
115 | 116 | } |
116 | 117 | $this->generateTABLESTYLEINFO(); |
117 | 118 | $this->cleanTemplate(); |
@@ -128,8 +129,9 @@ discard block |
||
128 | 129 | protected function generateTABLE($rows, $cols) |
129 | 130 | { |
130 | 131 | $chart = 'A'; |
131 | - for ($i = 0; $i < $cols; $i++) |
|
132 | - $chart++; |
|
132 | + for ($i = 0; $i < $cols; $i++) { |
|
133 | + $chart++; |
|
134 | + } |
|
133 | 135 | $rows++; |
134 | 136 | $this->_xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'. |
135 | 137 | '<table xmlns="http://schemas.openxmlformats.org/spreads'. |
@@ -111,14 +111,16 @@ discard block |
||
111 | 111 | $this->generateSI(); |
112 | 112 | $this->generateT('0'); |
113 | 113 | break; |
114 | - }else |
|
115 | - $this->generateSI(); |
|
114 | + } else { |
|
115 | + $this->generateSI(); |
|
116 | + } |
|
116 | 117 | $this->generateT($dats[0][$i]); |
117 | 118 | } |
118 | 119 | |
119 | 120 | foreach ($dats as $ind => $val) { |
120 | - if ($ind == '0') |
|
121 | - continue; |
|
121 | + if ($ind == '0') { |
|
122 | + continue; |
|
123 | + } |
|
122 | 124 | $this->generateSI(); |
123 | 125 | $this->generateT($ind); |
124 | 126 | } |
@@ -168,8 +170,9 @@ discard block |
||
168 | 170 | protected function generateT($name, $space = '') |
169 | 171 | { |
170 | 172 | $xmlAux = '<t'; |
171 | - if ($space != '') |
|
172 | - $xmlAux .= ' xml:space="' . $space . '"'; |
|
173 | + if ($space != '') { |
|
174 | + $xmlAux .= ' xml:space="' . $space . '"'; |
|
175 | + } |
|
173 | 176 | $xmlAux .= '>' . $name . '</t>'; |
174 | 177 | $this->_xml = str_replace('__GENERATESI__', $xmlAux, $this->_xml); |
175 | 178 | } |
@@ -529,8 +529,9 @@ |
||
529 | 529 | ':graphicFrameLocks xmlns:a="' . |
530 | 530 | 'http://schemas.openxmlformats.org/drawingml/2006/main"'; |
531 | 531 | |
532 | - if ($noChangeAspect != '') |
|
533 | - $xmlAux .= ' noChangeAspect="' . $noChangeAspect . '"'; |
|
532 | + if ($noChangeAspect != '') { |
|
533 | + $xmlAux .= ' noChangeAspect="' . $noChangeAspect . '"'; |
|
534 | + } |
|
534 | 535 | $xmlAux .= '></' . CreateImage::NAMESPACEWORD1 . ':graphicFrameLocks>'; |
535 | 536 | |
536 | 537 | $this->_xml = str_replace( |
@@ -1523,8 +1523,9 @@ discard block |
||
1523 | 1523 | } elseif (strpos($type, 'line') !== false) { |
1524 | 1524 | $this->generateLINECHART(); |
1525 | 1525 | $this->generateGROUPING('standard'); |
1526 | - if (isset($dats[0])) $legends = $dats[0]; |
|
1527 | - else { |
|
1526 | + if (isset($dats[0])) { |
|
1527 | + $legends = $dats[0]; |
|
1528 | + } else { |
|
1528 | 1529 | echo('You must write a legend'); |
1529 | 1530 | return false; |
1530 | 1531 | } |
@@ -1563,7 +1564,9 @@ discard block |
||
1563 | 1564 | |
1564 | 1565 | $num = 0; |
1565 | 1566 | foreach ($dats as $legend => $dat) { |
1566 | - if ($legend == '0') continue; |
|
1567 | + if ($legend == '0') { |
|
1568 | + continue; |
|
1569 | + } |
|
1567 | 1570 | $this->generatePT($num); |
1568 | 1571 | $this->generateV($legend); |
1569 | 1572 | $num++; |
@@ -1577,7 +1580,9 @@ discard block |
||
1577 | 1580 | $this->generatePTCOUNT($sizeDats); |
1578 | 1581 | $num = 0; |
1579 | 1582 | foreach ($dats as $legend => $dat) { |
1580 | - if ($legend == '0') continue; |
|
1583 | + if ($legend == '0') { |
|
1584 | + continue; |
|
1585 | + } |
|
1581 | 1586 | $this->generatePT($num); |
1582 | 1587 | $this->generateV($dat[$i]); |
1583 | 1588 | $num++; |
@@ -1647,14 +1652,14 @@ discard block |
||
1647 | 1652 | { |
1648 | 1653 | $args = func_get_args(); |
1649 | 1654 | $ajusteTexto = 0; |
1650 | - if (isset($args[0][1]['sizeX'])) |
|
1651 | - $sizeX = $args[0][1]['sizeX'] * CreateImage::CONSTWORD; |
|
1652 | - else { |
|
1655 | + if (isset($args[0][1]['sizeX'])) { |
|
1656 | + $sizeX = $args[0][1]['sizeX'] * CreateImage::CONSTWORD; |
|
1657 | + } else { |
|
1653 | 1658 | $sizeX = 2993296; |
1654 | 1659 | } |
1655 | - if (isset($args[0][1]['sizeY'])) |
|
1656 | - $sizeY = $args[0][1]['sizeY'] * CreateImage::CONSTWORD; |
|
1657 | - else { |
|
1660 | + if (isset($args[0][1]['sizeY'])) { |
|
1661 | + $sizeY = $args[0][1]['sizeY'] * CreateImage::CONSTWORD; |
|
1662 | + } else { |
|
1658 | 1663 | $sizeY = 2238233; |
1659 | 1664 | } |
1660 | 1665 |
@@ -112,7 +112,9 @@ discard block |
||
112 | 112 | } |
113 | 113 | $this->generatePGMAR($args); |
114 | 114 | $this->generateCOLS(); |
115 | - if (!empty($args[0]['titlePage'])) $this->generateTITLEPG(); |
|
115 | + if (!empty($args[0]['titlePage'])) { |
|
116 | + $this->generateTITLEPG(); |
|
117 | + } |
|
116 | 118 | $this->generateDOCGRID(); |
117 | 119 | } |
118 | 120 | |
@@ -190,10 +192,18 @@ discard block |
||
190 | 192 | $footer = '0'; |
191 | 193 | $gutter = '0'; |
192 | 194 | $args = func_get_args(); |
193 | - if (isset($args[0][0]['top'])) $top = $args[0][0]['top']; |
|
194 | - if (isset($args[0][0]['bottom'])) $bottom = $args[0][0]['bottom']; |
|
195 | - if (isset($args[0][0]['right'])) $right = $args[0][0]['right']; |
|
196 | - if (isset($args[0][0]['left'])) $left = $args[0][0]['left']; |
|
195 | + if (isset($args[0][0]['top'])) { |
|
196 | + $top = $args[0][0]['top']; |
|
197 | + } |
|
198 | + if (isset($args[0][0]['bottom'])) { |
|
199 | + $bottom = $args[0][0]['bottom']; |
|
200 | + } |
|
201 | + if (isset($args[0][0]['right'])) { |
|
202 | + $right = $args[0][0]['right']; |
|
203 | + } |
|
204 | + if (isset($args[0][0]['left'])) { |
|
205 | + $left = $args[0][0]['left']; |
|
206 | + } |
|
197 | 207 | |
198 | 208 | $xml = '<' . CreateElement::NAMESPACEWORD . ':pgMar ' . |
199 | 209 | CreateElement::NAMESPACEWORD . ':top="' . $top . '" ' . |
@@ -189,9 +189,10 @@ |
||
189 | 189 | |
190 | 190 | $xmlAux = '<' . CreateElement::NAMESPACEWORD . ':footnote'; |
191 | 191 | |
192 | - if ($type != '') |
|
193 | - $xmlAux .= ' ' . CreateElement::NAMESPACEWORD . |
|
192 | + if ($type != '') { |
|
193 | + $xmlAux .= ' ' . CreateElement::NAMESPACEWORD . |
|
194 | 194 | ':type="' . $type . '"'; |
195 | + } |
|
195 | 196 | |
196 | 197 | $this->_xml = $xmlAux . ' ' . CreateElement::NAMESPACEWORD . |
197 | 198 | ':id="' . (self::$_id - 2) . |