@@ -79,17 +79,22 @@ discard block |
||
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - if ($this->page <= 0) |
|
83 | - $this->error("You have to add a page to fpdf first!"); |
|
82 | + if ($this->page <= 0) { |
|
83 | + $this->error("You have to add a page to fpdf first!"); |
|
84 | + } |
|
84 | 85 | |
85 | - if ($x == null) |
|
86 | - $x = 0; |
|
87 | - if ($y == null) |
|
88 | - $y = 0; |
|
89 | - if ($w == null) |
|
90 | - $w = $this->w; |
|
91 | - if ($h == null) |
|
92 | - $h = $this->h; |
|
86 | + if ($x == null) { |
|
87 | + $x = 0; |
|
88 | + } |
|
89 | + if ($y == null) { |
|
90 | + $y = 0; |
|
91 | + } |
|
92 | + if ($w == null) { |
|
93 | + $w = $this->w; |
|
94 | + } |
|
95 | + if ($h == null) { |
|
96 | + $h = $this->h; |
|
97 | + } |
|
93 | 98 | |
94 | 99 | // Save settings |
95 | 100 | $this->tpl++; |
@@ -165,8 +170,9 @@ discard block |
||
165 | 170 | $this->FontSize = $tpl['o_FontSize']; |
166 | 171 | |
167 | 172 | $fontkey = $this->FontFamily . $this->FontStyle; |
168 | - if ($fontkey) |
|
169 | - $this->CurrentFont =& $this->fonts[$fontkey]; |
|
173 | + if ($fontkey) { |
|
174 | + $this->CurrentFont =& $this->fonts[$fontkey]; |
|
175 | + } |
|
170 | 176 | |
171 | 177 | return $this->tpl; |
172 | 178 | } else { |
@@ -192,11 +198,13 @@ discard block |
||
192 | 198 | * @retrun array The height and width of the template |
193 | 199 | */ |
194 | 200 | function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { |
195 | - if ($this->page <= 0) |
|
196 | - $this->error('You have to add a page first!'); |
|
201 | + if ($this->page <= 0) { |
|
202 | + $this->error('You have to add a page first!'); |
|
203 | + } |
|
197 | 204 | |
198 | - if (!isset($this->tpls[$tplidx])) |
|
199 | - $this->error('Template does not exist!'); |
|
205 | + if (!isset($this->tpls[$tplidx])) { |
|
206 | + $this->error('Template does not exist!'); |
|
207 | + } |
|
200 | 208 | |
201 | 209 | if ($this->_intpl) { |
202 | 210 | $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; |
@@ -206,10 +214,12 @@ discard block |
||
206 | 214 | $w = $tpl['w']; |
207 | 215 | $h = $tpl['h']; |
208 | 216 | |
209 | - if ($_x == null) |
|
210 | - $_x = 0; |
|
211 | - if ($_y == null) |
|
212 | - $_y = 0; |
|
217 | + if ($_x == null) { |
|
218 | + $_x = 0; |
|
219 | + } |
|
220 | + if ($_y == null) { |
|
221 | + $_y = 0; |
|
222 | + } |
|
213 | 223 | |
214 | 224 | $_x += $tpl['x']; |
215 | 225 | $_y += $tpl['y']; |
@@ -249,8 +259,9 @@ discard block |
||
249 | 259 | * @return array The height and width of the template |
250 | 260 | */ |
251 | 261 | function getTemplateSize($tplidx, $_w = 0, $_h = 0) { |
252 | - if (!isset($this->tpls[$tplidx])) |
|
253 | - return false; |
|
262 | + if (!isset($this->tpls[$tplidx])) { |
|
263 | + return false; |
|
264 | + } |
|
254 | 265 | |
255 | 266 | $tpl =& $this->tpls[$tplidx]; |
256 | 267 | $w = $tpl['w']; |
@@ -261,10 +272,12 @@ discard block |
||
261 | 272 | $_h = $h; |
262 | 273 | } |
263 | 274 | |
264 | - if($_w == 0) |
|
265 | - $_w = $_h * $w / $h; |
|
266 | - if($_h == 0) |
|
267 | - $_h = $_w * $h / $w; |
|
275 | + if($_w == 0) { |
|
276 | + $_w = $_h * $w / $h; |
|
277 | + } |
|
278 | + if($_h == 0) { |
|
279 | + $_h = $_w * $h / $w; |
|
280 | + } |
|
268 | 281 | |
269 | 282 | return array("w" => $_w, "h" => $_h); |
270 | 283 | } |
@@ -323,8 +336,9 @@ discard block |
||
323 | 336 | return parent::AddPage(...$args); |
324 | 337 | } |
325 | 338 | |
326 | - if ($this->_intpl) |
|
327 | - $this->Error('Adding pages in templates isn\'t possible!'); |
|
339 | + if ($this->_intpl) { |
|
340 | + $this->Error('Adding pages in templates isn\'t possible!'); |
|
341 | + } |
|
328 | 342 | |
329 | 343 | parent::AddPage($orientation, $format); |
330 | 344 | } |
@@ -338,8 +352,9 @@ discard block |
||
338 | 352 | return parent::Link(...$args); |
339 | 353 | } |
340 | 354 | |
341 | - if ($this->_intpl) |
|
342 | - $this->Error('Using links in templates aren\'t possible!'); |
|
355 | + if ($this->_intpl) { |
|
356 | + $this->Error('Using links in templates aren\'t possible!'); |
|
357 | + } |
|
343 | 358 | |
344 | 359 | parent::Link($x, $y, $w, $h, $link); |
345 | 360 | } |
@@ -351,8 +366,9 @@ discard block |
||
351 | 366 | |
352 | 367 | } |
353 | 368 | |
354 | - if ($this->_intpl) |
|
355 | - $this->Error('Adding links in templates aren\'t possible!'); |
|
369 | + if ($this->_intpl) { |
|
370 | + $this->Error('Adding links in templates aren\'t possible!'); |
|
371 | + } |
|
356 | 372 | return parent::AddLink(); |
357 | 373 | } |
358 | 374 | |
@@ -362,8 +378,9 @@ discard block |
||
362 | 378 | return parent::SetLink(...$args); |
363 | 379 | } |
364 | 380 | |
365 | - if ($this->_intpl) |
|
366 | - $this->Error('Setting links in templates aren\'t possible!'); |
|
381 | + if ($this->_intpl) { |
|
382 | + $this->Error('Setting links in templates aren\'t possible!'); |
|
383 | + } |
|
367 | 384 | parent::SetLink($link, $y, $page); |
368 | 385 | } |
369 | 386 | |
@@ -403,8 +420,9 @@ discard block |
||
403 | 420 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
404 | 421 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
405 | 422 | $this->_out('/Font <<'); |
406 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
407 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
423 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
424 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
425 | + } |
|
408 | 426 | $this->_out('>>'); |
409 | 427 | } |
410 | 428 | if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
@@ -412,12 +430,14 @@ discard block |
||
412 | 430 | { |
413 | 431 | $this->_out('/XObject <<'); |
414 | 432 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
415 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
416 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
433 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
434 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
435 | + } |
|
417 | 436 | } |
418 | 437 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
419 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
420 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
438 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
439 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
440 | + } |
|
421 | 441 | } |
422 | 442 | $this->_out('>>'); |
423 | 443 | } |